@stacksjs/stx 0.2.620 → 0.2.622

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 (58) hide show
  1. package/dist/chunk-0r2g00m7.js +2 -0
  2. package/dist/{chunk-pw2m64jc.js → chunk-18104nfg.js} +1 -1
  3. package/dist/{chunk-w5qgb5jx.js → chunk-29cbmfrc.js} +2 -2
  4. package/dist/{chunk-1ach06sw.js → chunk-39qcn4gt.js} +1 -1
  5. package/dist/{chunk-5bvc0eew.js → chunk-3dd57j7e.js} +1 -1
  6. package/dist/{chunk-wkadjmmh.js → chunk-3h2rpaps.js} +1 -1
  7. package/dist/{chunk-fpzbtrp6.js → chunk-3rmby39r.js} +1 -1
  8. package/dist/{chunk-czv3a49e.js → chunk-3tp481j5.js} +2 -2
  9. package/dist/{chunk-80ath5b7.js → chunk-40fepd2t.js} +1 -1
  10. package/dist/{chunk-qst8ztxa.js → chunk-5wa3ydkf.js} +1 -1
  11. package/dist/{chunk-3wbtbg22.js → chunk-5zzrth32.js} +3 -3
  12. package/dist/{chunk-s01qe842.js → chunk-6jjrvb9v.js} +1 -1
  13. package/dist/{chunk-vtpsns2g.js → chunk-81h6xyna.js} +1 -1
  14. package/dist/{chunk-ttc1fmn4.js → chunk-8xns82s5.js} +1 -1
  15. package/dist/{chunk-91wzaepm.js → chunk-9eejvpqc.js} +2 -2
  16. package/dist/{chunk-k6v0kbnr.js → chunk-9pz3jh7w.js} +1 -1
  17. package/dist/{chunk-vgt56jd0.js → chunk-a39kvc2p.js} +1 -1
  18. package/dist/{chunk-v66yd92a.js → chunk-e030grrq.js} +195 -195
  19. package/dist/{chunk-m6v0zebf.js → chunk-erk7afjv.js} +1 -1
  20. package/dist/{chunk-17fwgkyp.js → chunk-f53x5d7h.js} +1 -1
  21. package/dist/{chunk-erp0v4mb.js → chunk-fmdezmt4.js} +1 -1
  22. package/dist/{chunk-kjck941v.js → chunk-fqwyfx6c.js} +1 -1
  23. package/dist/{chunk-v9qh2bak.js → chunk-fvk33v69.js} +1 -1
  24. package/dist/{chunk-bqy2wpqx.js → chunk-g6mv9vkp.js} +1 -1
  25. package/dist/{chunk-wg4gydcs.js → chunk-g8f1dqx1.js} +1 -1
  26. package/dist/{chunk-fyp6zk1y.js → chunk-hmpzdq4p.js} +1 -1
  27. package/dist/{chunk-hnagpvee.js → chunk-j8vd52sg.js} +1 -1
  28. package/dist/chunk-jh2kve7q.js +2 -0
  29. package/dist/{chunk-m1nb0z16.js → chunk-jwqz8w58.js} +1 -1
  30. package/dist/{chunk-4qdx2nzq.js → chunk-kaz5smvw.js} +1 -1
  31. package/dist/{chunk-xfw2cwhz.js → chunk-kep8q407.js} +1 -1
  32. package/dist/{chunk-w1n3cvay.js → chunk-m0zmexz1.js} +1 -1
  33. package/dist/{chunk-fz5mzzyj.js → chunk-m64w624a.js} +1 -1
  34. package/dist/{chunk-j9adyb0v.js → chunk-pwsg9w5g.js} +1 -1
  35. package/dist/{chunk-a2mmj1e8.js → chunk-qbh3jk5z.js} +1 -1
  36. package/dist/{chunk-z024wwh6.js → chunk-qk4zkvzh.js} +1 -1
  37. package/dist/{chunk-4z4c7smx.js → chunk-rg4zqdbj.js} +1 -1
  38. package/dist/{chunk-6qbkwqc5.js → chunk-rj8fsjx9.js} +1 -1
  39. package/dist/{chunk-230ssxg1.js → chunk-rmc8cg2n.js} +1 -1
  40. package/dist/{chunk-mn3kjerc.js → chunk-tc62pvzg.js} +1 -1
  41. package/dist/{chunk-mstvaxy1.js → chunk-tftnx4vj.js} +1 -1
  42. package/dist/{chunk-pdw9paq5.js → chunk-vddfv082.js} +1 -1
  43. package/dist/{chunk-ka7g44tj.js → chunk-w28sn5g5.js} +1 -1
  44. package/dist/{chunk-gq9m5tmc.js → chunk-wk95x5ym.js} +5 -5
  45. package/dist/chunk-x5cscz50.js +2 -0
  46. package/dist/{chunk-nw3kevzk.js → chunk-x7v3m9nk.js} +1 -1
  47. package/dist/{chunk-ffaw5he6.js → chunk-y3n2cgev.js} +1 -1
  48. package/dist/{chunk-z4ebap7m.js → chunk-zvg2h3wd.js} +1 -1
  49. package/dist/cli.js +7 -7
  50. package/dist/craft-entry.js +1 -1
  51. package/dist/craft.js +1 -1
  52. package/dist/pwa.js +1 -1
  53. package/dist/ssg.js +2 -2
  54. package/dist/utils.js +1 -1
  55. package/package.json +5 -5
  56. package/dist/chunk-0ax8sqvn.js +0 -2
  57. package/dist/chunk-dvhhmk8n.js +0 -2
  58. package/dist/chunk-e59j52hj.js +0 -2
@@ -1,6 +1,6 @@
1
1
  // @bun
2
2
  import{Q}from"./chunk-sxpnpvt5.js";import{ye,C}from"./chunk-gc1dzxee.js";import{Hi}from"./chunk-z4te6223.js";import{a}from"./chunk-q4a2j4qr.js";import v from"fs";import m from"path";import{pathToFileURL as I}from"url";var P=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],R=new Set;function Pt(s,l={}){let o=m.resolve(s,l.dir??"server/api"),i=[],f=new Map;if(!v.existsSync(o))return i;let t=Array.from(new Bun.Glob("**/*.{ts,js,mts,mjs}").scanSync({cwd:o})).sort();for(let e of t){if(e.endsWith(".d.ts"))continue;let u=e.replace(/\.(?:ts|js|mts|mjs)$/,"").split("/"),n=u.pop(),c=n.lastIndexOf("."),d=c>=0?n.slice(c+1):"get",g=d.toUpperCase();if(!P.includes(g)||d!==d.toLowerCase())throw Error(`Unsupported API method suffix in ${e}; use ${P.map((A)=>A.toLowerCase()).join(", ")}`);if(c>=0)n=n.slice(0,c);if(n!=="index")u.push(n);let r=new Set,h=u.map((A,j)=>{let y=/^\[(\.\.\.)?([A-Za-z_]\w*)\]$/.exec(A);if(y){if(r.has(y[2])||y[1]&&j!==u.length-1)throw Error(`Invalid API parameter in ${e}`);return r.add(y[2]),`:${y[2]}${y[1]?"*":""}`}if(!/^[\w-]+$/.test(A))throw Error(`Unsupported API path segment ${A} in ${e}`);return A}),w=`/api${h.length?`/${h.join("/")}`:""}`,S=`${g} ${w.replace(/:\w+/g,":param")}`;if(f.has(S))throw Error(`Ambiguous API route ${g} ${w}: ${f.get(S)} and ${e}`);f.set(S,e);let x=m.join(o,e);R.add(m.resolve(x)),R.add(v.realpathSync(x)),i.push({pattern:w,method:g,filePath:x})}return i.sort((e,p)=>{let u=e.pattern.split("/"),n=p.pattern.split("/"),c=(d)=>d?.endsWith("*")?0:d?.startsWith(":")?1:2;for(let d=0;d<Math.max(u.length,n.length);d++){let g=c(n[d])-c(u[d]);if(g)return g}return e.pattern.localeCompare(p.pattern)||e.method.localeCompare(p.method)})}async function ds(s,l){let o=a(s,"api-types.d.ts"),i=["// Generated by stx. Include this file in tsconfig.json.","declare module '@stacksjs/stx/api-client' {"," interface KnownApiRoutes {"];for(let t of l){let e=`./${m.relative(m.dirname(o),t.filePath).replace(/\\/g,"/")}`,{params:p}=Q(t.pattern);i.push(` ${JSON.stringify(`${t.method} ${t.pattern}`)}: { params: { ${p.map((u)=>`${JSON.stringify(u)}: string`).join("; ")} }; response: Awaited<ReturnType<typeof import(${JSON.stringify(e)}).default>> }`)}i.push(" }","}","export {}","");let f=i.join(`
3
3
  `);if(!await Bun.file(o).exists()||await Bun.file(o).text()!==f)await Bun.write(o,f);return o}async function ps(s,l,o={}){let i=Pt(s,o);await ds(s,i);let f=[];for(let t of i){let e=await Bun.build({entrypoints:[t.filePath],target:"bun",format:"esm",minify:!1,splitting:!1});if(!e.success)throw Error(`API build failed for ${t.filePath}: ${e.logs.join(`
4
- `)}`);let p=e.outputs.find((c)=>c.kind==="entry-point");if(!p)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await p.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(l,n),p),f.push({...t,filePath:n})}return f}function E(s,l){let o=s.map((i)=>({route:i,...Q(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,p=(r)=>r.replace(/:\w+/g,":param"),u=t.filter((r)=>p(r.route.pattern)===p(e)),n=i.method,c=u.find((r)=>r.route.method===n)??(n==="HEAD"?u.find((r)=>r.route.method==="GET"):void 0);if(!c){let r=new Set(u.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=c.regex.exec(f),g=Object.create(null);try{c.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await l(c.route);if(typeof r!=="function")throw Error(`API endpoint ${c.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function gs(s,l){return E(l,async(o)=>(await import(I(m.resolve(s,o.filePath)).href)).default)}async function Ju(s,l){if(!l)return async()=>null;let o=l===!0?{}:l,i=Pt(s,o);return await ds(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=Pt(s,o);await ds(s,t);let{loadStxConfig:e}=await import("./chunk-s01qe842.js"),p=C((await e(s)).runtimeConfig);return await ye(p,()=>E(t,async(u)=>{let n=await Bun.build({entrypoints:[u.filePath],target:"bun",format:"esm",splitting:!1});if(!n.success)throw Error(n.logs.join(`
4
+ `)}`);let p=e.outputs.find((c)=>c.kind==="entry-point");if(!p)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await p.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(l,n),p),f.push({...t,filePath:n})}return f}function E(s,l){let o=s.map((i)=>({route:i,...Q(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,p=(r)=>r.replace(/:\w+/g,":param"),u=t.filter((r)=>p(r.route.pattern)===p(e)),n=i.method,c=u.find((r)=>r.route.method===n)??(n==="HEAD"?u.find((r)=>r.route.method==="GET"):void 0);if(!c){let r=new Set(u.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=c.regex.exec(f),g=Object.create(null);try{c.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await l(c.route);if(typeof r!=="function")throw Error(`API endpoint ${c.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function gs(s,l){return E(l,async(o)=>(await import(I(m.resolve(s,o.filePath)).href)).default)}async function Ju(s,l){if(!l)return async()=>null;let o=l===!0?{}:l,i=Pt(s,o);return await ds(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=Pt(s,o);await ds(s,t);let{loadStxConfig:e}=await import("./chunk-6jjrvb9v.js"),p=C((await e(s)).runtimeConfig);return await ye(p,()=>E(t,async(u)=>{let n=await Bun.build({entrypoints:[u.filePath],target:"bun",format:"esm",splitting:!1});if(!n.success)throw Error(n.logs.join(`
5
5
  `));let c=n.outputs.find((d)=>d.kind==="entry-point");if(!c||n.outputs.length!==1)throw Error(`Unsupported API bundle output: ${u.filePath}`);return(await import(`data:text/javascript;base64,${Buffer.from(await c.text()).toString("base64")}`)).default})(f))}catch(t){return console.error("[stx] API discovery failed:",t),Response.json({error:"API discovery failed; check the server log"},{status:500})}}}function ms(s,l,o){if(Hi(s))return!0;let i=/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/;if(i.test(m.basename(s)))return!0;try{if(i.test(m.basename(v.realpathSync(s))))return!0}catch{}if(R.has(m.resolve(s)))return!0;if(!o)return!1;let f=m.resolve(l,typeof o==="object"?o.dir??"server/api":"server/api"),t=(p)=>{try{return v.realpathSync(p)}catch{return m.resolve(p)}},e=t(s);return[f,m.resolve(l,"server"),m.resolve(l,".output/server")].some((p)=>{let u=t(p);return e===u||e.startsWith(`${u}${m.sep}`)})}
6
6
  export{Pt,ds,ps,gs,Ju,ms};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Nt,Os,Pi,Gc}from"./chunk-v66yd92a.js";import"./chunk-n5xbv1a9.js";import"./chunk-10s16tad.js";import"./chunk-z4te6223.js";import"./chunk-hnagpvee.js";import"./chunk-gc1dzxee.js";import"./chunk-khzyc41k.js";import"./chunk-x6pz1h3x.js";import"./chunk-1gtrs8va.js";import"./chunk-66e4ga0z.js";import"./chunk-dvbgbd06.js";import"./chunk-sxpnpvt5.js";import"./chunk-jp6yn9mj.js";export{Gc as declareBareLoopHead,Nt as parseLoopBinding,Pi as processLoops,Os as reportDeferredLoopWarnings};
2
+ import{Nt,Os,Pi,Gc}from"./chunk-e030grrq.js";import"./chunk-n5xbv1a9.js";import"./chunk-10s16tad.js";import"./chunk-z4te6223.js";import"./chunk-j8vd52sg.js";import"./chunk-gc1dzxee.js";import"./chunk-khzyc41k.js";import"./chunk-x6pz1h3x.js";import"./chunk-1gtrs8va.js";import"./chunk-66e4ga0z.js";import"./chunk-dvbgbd06.js";import"./chunk-sxpnpvt5.js";import"./chunk-jp6yn9mj.js";export{Gc as declareBareLoopHead,Nt as parseLoopBinding,Pi as processLoops,Os as reportDeferredLoopWarnings};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{wl}from"./chunk-j9adyb0v.js";import"./chunk-91wzaepm.js";import"./chunk-m6v0zebf.js";import"./chunk-v66yd92a.js";import"./chunk-n5xbv1a9.js";import"./chunk-10s16tad.js";import"./chunk-z4te6223.js";import"./chunk-hnagpvee.js";import"./chunk-gc1dzxee.js";import"./chunk-khzyc41k.js";import"./chunk-x6pz1h3x.js";import"./chunk-1gtrs8va.js";import"./chunk-66e4ga0z.js";import"./chunk-dvbgbd06.js";import"./chunk-sxpnpvt5.js";import"./chunk-jp6yn9mj.js";export{wl as startProductionServer};
2
+ import{wl}from"./chunk-pwsg9w5g.js";import"./chunk-9eejvpqc.js";import"./chunk-erk7afjv.js";import"./chunk-e030grrq.js";import"./chunk-n5xbv1a9.js";import"./chunk-10s16tad.js";import"./chunk-z4te6223.js";import"./chunk-j8vd52sg.js";import"./chunk-gc1dzxee.js";import"./chunk-khzyc41k.js";import"./chunk-x6pz1h3x.js";import"./chunk-1gtrs8va.js";import"./chunk-66e4ga0z.js";import"./chunk-dvbgbd06.js";import"./chunk-sxpnpvt5.js";import"./chunk-jp6yn9mj.js";export{wl as startProductionServer};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{hn,pe}from"./chunk-5rtatjwq.js";import{m,yn,sr,w,qe,o,P}from"./chunk-v66yd92a.js";import{ms}from"./chunk-m6v0zebf.js";import{s,$e}from"./chunk-6qvskcwp.js";import{a}from"./chunk-q4a2j4qr.js";import d from"path";import S from"fs";import{AsyncLocalStorage as ft}from"async_hooks";var mt=10;function W(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(d.basename(t))||ms(t,e,n)}var rt=2;function gc(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?d.resolve(e):a(t,"bundle-cache")}function et(t,e){let n=d.resolve(e);return n===d.sep?t:t.split(n).join("\x00root")}function gt(t,e){try{let n=S.statSync(t),c=d.resolve(e),u=t.startsWith(`${c}${d.sep}`);return{path:u?d.relative(c,t):t,...u?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(S.readFileSync(t)).toString(36)}}catch{return null}}function it(t,e){return t.inRoot?d.join(d.resolve(e),t.path):t.path}function ht(t,e){for(let n of t){let c=it(n,e);try{let u=S.statSync(c);if(u.size!==n.size)return!1;if(u.mtimeMs!==n.mtimeMs&&Bun.hash(S.readFileSync(c)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var ot=new Map,J=600,xt=100,V=new Map;async function yt(t){let e=V.get(t)??0;if(e>0&&e<xt){V.set(t,e+1);return}V.set(t,1);try{let n=(await S.promises.readdir(t)).filter((p)=>p.endsWith(".js"));if(n.length<=J)return;let u=(await Promise.all(n.map(async(p)=>{try{return{name:p,at:(await S.promises.stat(d.join(t,p))).mtimeMs}}catch{return null}}))).filter((p)=>p!==null);u.sort((p,l)=>l.at-p.at);for(let p of u.slice(J)){let l=p.name.slice(0,-3);await S.promises.rm(d.join(t,`${l}.js`),{force:!0}),await S.promises.rm(d.join(t,`${l}.deps.json`),{force:!0})}D("pruned bundle cache to",J,"entries")}catch{}}function de(t){return ot.get(t)??[]}function G(t,e){if(t)ot.set(t,e)}function mc(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function D(...t){if(mc())console.log("[stx:bundler]",...t)}var Z=[];function ai(t,e,n){Z.push({filePath:t||"<inline>",message:e,details:n})}function Et(){return Z.slice()}function Tt(){Z.length=0}var H;function Xu(t){H=t}function ci(){if(H)return H;try{let t=P.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var q=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function $t(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let u=n[1];if(!q.some((l)=>l.test(u)))return D("detected user import:",u),!0}let c=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=c.exec(t))!==null){let u=n[1];if(/\.css(?:\?.*)?$/.test(u))continue;if(!q.some((l)=>l.test(u)))return D("detected side-effect import:",u),!0}return!1}var mn="stx-module:",bt=/\.(?:[cm]?[jt]sx?|json)$/i;function hc(t,e){return d.relative(t,e).split(d.sep).join("/")}function yc(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,c,u,p)=>{let l=e.get(p);return l&&!p.startsWith(mn)?`${c}${u}${l}${u}`:n})}function bc(t,e){let n=0,c=(p)=>{let l=`__stxMod${n++}`,E=JSON.stringify(p);return e.push(`var ${l} = globalThis.__stxModules && globalThis.__stxModules[${E}];`,`if (${l} === undefined) throw new Error("[stx] module " + ${JSON.stringify(E)} + " is not registered on this page (#1957)");`),l},u=(p,l)=>{for(let E of p.split(",")){let R=E.trim();if(!R)continue;let j=R.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!j)continue;let f=j[1].startsWith('"')?JSON.parse(j[1]):j[1],r=j[2]??f;e.push(`var ${r} = ${l}[${JSON.stringify(f)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,l,E)=>{let R=E.slice(mn.length),j=c(R),f=l.trim(),r=f.match(/^([\w$]+)\s*(?:,\s*|$)/);if(r&&!f.startsWith("{")&&!f.startsWith("*"))e.push(`var ${r[1]} = ${j}.default;`),f=f.slice(r[0].length).trim();let i=f.match(/^\*\s*as\s+([\w$]+)$/);if(i)e.push(`var ${i[1]} = ${j};`);else if(f.startsWith("{"))u(f.replace(/^\{|\}$/g,""),j);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,l)=>(c(l.slice(mn.length)),"")),t}function nt(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,d.join(t,"index.ts"),d.join(t,"index.tsx"),d.join(t,"index.js"),d.join(t,"index.mjs")];for(let n of e)try{if(S.existsSync(n)&&S.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var Y=new ft;function us(t,e){let n=new Bun.CryptoHasher("md5");for(let[c,u]of[...t].sort(([p],[l])=>p<l?-1:p>l?1:0))n.update(`${c}\x00${u}\x00`);return Y.run({modules:t,key:n.digest("hex").slice(0,12)},e)}function Rt(){return Y.getStore()?.key??""}function wt(t,e,n,c,u,p=new Map,l,E){let R=(f,r,i)=>{if(W(r,t,l))return null;if(!u||f!==n||!bt.test(r))return null;try{if(!S.statSync(r,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}c.add(r);let x=`${mn}${hc(process.cwd(),r)}`;return p.set(i,x),{path:x,external:!0}},j=(f,r)=>{let i=f===n?e:d.dirname(f),x=d.resolve(i,r);return nt(x)??x};return{name:"stx-client-bundle",setup(f){if(f.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(r)=>({path:r.path,external:!0})),f.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(r)=>({path:r.path,external:!0})),f.onResolve({filter:/^\//},(r)=>{let i=nt(r.path);if(i){let x=R(r.importer,i,r.path);if(x)return x;if(i!==n)c.add(i);return{path:i}}return{path:r.path,external:!0}}),f.onResolve({filter:/^\.\.?\//},(r)=>{let i=j(r.importer,r.path),x=R(r.importer,i,r.path);if(x)return x;return c.add(i),{path:i}}),f.onResolve({filter:/^[@~]\//},(r)=>{let i=d.resolve(t,r.path.slice(2)),x=[i,`${i}.ts`,`${i}.tsx`,`${i}.js`,`${i}.mjs`,`${i}.jsx`,d.join(i,"index.ts"),d.join(i,"index.tsx"),d.join(i,"index.js"),d.join(i,"index.mjs")];for(let _ of x)if(S.existsSync(_)&&S.statSync(_,{throwIfNoEntry:!1})?.isFile()){let B=R(r.importer,_,r.path);if(B)return B;return D(`resolved ${r.path[0]}/ import:`,r.path,"\u2192",_),c.add(_),{path:_}}return console.warn(`[stx:bundler] could not resolve ${r.path[0]}/ import:`,r.path),{path:i}}),u)f.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(r)=>{if(r.importer!==n)return;let i=`${mn}npm:${r.path}`;return p.set(r.path,i),{path:i,external:!0}});f.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(r)=>{if(W(r.path,t,l))throw Error(`Server-only API source cannot be imported by a client script: ${r.path}`);let i=d.extname(r.path).toLowerCase(),x=i===".json"?"json":i===".tsx"?"tsx":i===".jsx"?"jsx":i===".ts"||i===".mts"||i===".cts"?"ts":"js";if(r.path!==n)c.add(r.path);let _=E?.get(r.path);if(_!==void 0)return{contents:_,loader:"js"};return{contents:S.readFileSync(r.path,"utf8"),loader:x}})}}}var X=new Map,U=m(64),st=Symbol.for("stx.client-bundle-build-queue");function vc(t){let e=globalThis,c=(e[st]??Promise.resolve()).then(t,t);return e[st]=c.then(()=>{return},()=>{return}),c}async function At(t,e,n={}){let c=n.projectRoot||process.cwd(),u=(await o(c)).serverApi,p=n.minify??!1,l=n.externalizeUserModules??!0,E=n.expose?.length?[...new Set(n.expose)].sort():void 0,R=n.cacheDir||gc(c),j=Y.getStore(),f=new Bun.CryptoHasher("md5");f.update(`${mt}\x00${qe()}\x00${JSON.stringify(u??!1)}\x00${l?"registry":"inline"}\x00${E?E.join(","):"*"}\x00${p?"minified":"readable"}\x00${j?.key??""}\x00${et(t,c)}\x00${et(e,c)}`);let r=f.digest("hex").slice(0,12),i=d.join(R,`${r}.js`),x=U.get(i);if(x){if(sr(x.files)&&x.files.every((M)=>!W(M.path,c,u))){D("memo hit:",r);let M=x.files.map((N)=>N.path);return G(e,M),n.collectInputs?.push(...M),x.code}U.delete(i),D("memo invalidated by dep change:",r)}let _=d.join(R,`${r}.deps.json`),B=Bun.file(i);if(await B.exists()){let M=Bun.file(_),N=!1,C=null;if(await M.exists())try{let F=JSON.parse(await M.text());if(F.metadataVersion===rt&&Array.isArray(F.files)&&ht(F.files,c))C=yn(F.files.map((g)=>it(g,c))),N=C.length===F.files.length&&!C.some((g)=>W(g.path,c,u))}catch{N=!1}if(N){if(D("cache hit:",r),C)G(e,C.map((g)=>g.path)),n.collectInputs?.push(...C.map((g)=>g.path));let F=await B.text();if(C)U.set(i,{code:F,files:C});return F}D("cache invalidated by dep change:",r)}let k=X.get(r);if(k){let M=await k;if(n.collectInputs)n.collectInputs.push(...(U.get(i)?.files??[]).map((N)=>N.path));return M}let L=vc(()=>vt(t,e,{projectRoot:c,minify:p,cacheDir:R,hash:r,cachePath:i,depsPath:_,collectInputs:n.collectInputs,externalizeUserModules:l,serverApi:u,expose:E,throwOnFailure:n.throwOnFailure,substitutes:j?.modules}));X.set(r,L);try{return await L}finally{X.delete(r)}}var St=0;function wc(t){return`${t}-${process.pid}-${++St}`}async function vt(t,e,n){let{projectRoot:c,minify:u,cacheDir:p,hash:l,cachePath:E,depsPath:R,externalizeUserModules:j}=n,f=a(c,"bundle-tmp"),r=wc(l),i=d.join(f,`${r}.ts`),x=d.join(f,"out",r);S.mkdirSync(f,{recursive:!0}),S.mkdirSync(x,{recursive:!0});let _=d.dirname(e),B=new Set,k=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,L=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,M=s(t),{depths:N,balanced:C}=$e(M),F=(v)=>!C||N[v]===0,g;while((g=k.exec(M))!==null){if(g[1])continue;if(!F(g.index))continue;if(g[2])g[2].split(",").forEach((v)=>{let h=jt(v);if(h)B.add(h)});else if(g[3])B.add(g[3])}while((g=L.exec(M))!==null){if(g[1])continue;if(!F(g.index))continue;B.add(g[2])}let at=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=at.exec(M))!==null){if(!F(g.index))continue;let v=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(v&&q.some((h)=>h.test(v)))continue;if(g[1])B.add(g[1]);if(g[2])B.add(g[2]);for(let h of(g[3]??"").split(",")){let b=h.trim();if(!b||/^type\s/.test(b))continue;let O=/\bas\s+(\w+)\s*$/.exec(b)?.[1]??/^\w+$/.exec(b)?.[0];if(O)B.add(O)}}for(let v of M.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let h of v[1].split(",")){let b=/\bas\s+(\w+)\s*$/.exec(h)?.[1]??/^\s*(\w+)\s*$/.exec(h)?.[1];if(b)B.delete(b)}let ct=B.size>0?`
2
+ import{hn,pe}from"./chunk-5rtatjwq.js";import{m,yn,sr,w,qe,o,P}from"./chunk-e030grrq.js";import{ms}from"./chunk-erk7afjv.js";import{s,$e}from"./chunk-6qvskcwp.js";import{a}from"./chunk-q4a2j4qr.js";import d from"path";import S from"fs";import{AsyncLocalStorage as ft}from"async_hooks";var mt=10;function W(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(d.basename(t))||ms(t,e,n)}var rt=2;function gc(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?d.resolve(e):a(t,"bundle-cache")}function et(t,e){let n=d.resolve(e);return n===d.sep?t:t.split(n).join("\x00root")}function gt(t,e){try{let n=S.statSync(t),c=d.resolve(e),u=t.startsWith(`${c}${d.sep}`);return{path:u?d.relative(c,t):t,...u?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(S.readFileSync(t)).toString(36)}}catch{return null}}function it(t,e){return t.inRoot?d.join(d.resolve(e),t.path):t.path}function ht(t,e){for(let n of t){let c=it(n,e);try{let u=S.statSync(c);if(u.size!==n.size)return!1;if(u.mtimeMs!==n.mtimeMs&&Bun.hash(S.readFileSync(c)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var ot=new Map,J=600,xt=100,V=new Map;async function yt(t){let e=V.get(t)??0;if(e>0&&e<xt){V.set(t,e+1);return}V.set(t,1);try{let n=(await S.promises.readdir(t)).filter((p)=>p.endsWith(".js"));if(n.length<=J)return;let u=(await Promise.all(n.map(async(p)=>{try{return{name:p,at:(await S.promises.stat(d.join(t,p))).mtimeMs}}catch{return null}}))).filter((p)=>p!==null);u.sort((p,l)=>l.at-p.at);for(let p of u.slice(J)){let l=p.name.slice(0,-3);await S.promises.rm(d.join(t,`${l}.js`),{force:!0}),await S.promises.rm(d.join(t,`${l}.deps.json`),{force:!0})}D("pruned bundle cache to",J,"entries")}catch{}}function de(t){return ot.get(t)??[]}function G(t,e){if(t)ot.set(t,e)}function mc(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function D(...t){if(mc())console.log("[stx:bundler]",...t)}var Z=[];function ai(t,e,n){Z.push({filePath:t||"<inline>",message:e,details:n})}function Et(){return Z.slice()}function Tt(){Z.length=0}var H;function Xu(t){H=t}function ci(){if(H)return H;try{let t=P.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var q=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function $t(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let u=n[1];if(!q.some((l)=>l.test(u)))return D("detected user import:",u),!0}let c=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=c.exec(t))!==null){let u=n[1];if(/\.css(?:\?.*)?$/.test(u))continue;if(!q.some((l)=>l.test(u)))return D("detected side-effect import:",u),!0}return!1}var mn="stx-module:",bt=/\.(?:[cm]?[jt]sx?|json)$/i;function hc(t,e){return d.relative(t,e).split(d.sep).join("/")}function yc(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,c,u,p)=>{let l=e.get(p);return l&&!p.startsWith(mn)?`${c}${u}${l}${u}`:n})}function bc(t,e){let n=0,c=(p)=>{let l=`__stxMod${n++}`,E=JSON.stringify(p);return e.push(`var ${l} = globalThis.__stxModules && globalThis.__stxModules[${E}];`,`if (${l} === undefined) throw new Error("[stx] module " + ${JSON.stringify(E)} + " is not registered on this page (#1957)");`),l},u=(p,l)=>{for(let E of p.split(",")){let R=E.trim();if(!R)continue;let j=R.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!j)continue;let f=j[1].startsWith('"')?JSON.parse(j[1]):j[1],r=j[2]??f;e.push(`var ${r} = ${l}[${JSON.stringify(f)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,l,E)=>{let R=E.slice(mn.length),j=c(R),f=l.trim(),r=f.match(/^([\w$]+)\s*(?:,\s*|$)/);if(r&&!f.startsWith("{")&&!f.startsWith("*"))e.push(`var ${r[1]} = ${j}.default;`),f=f.slice(r[0].length).trim();let i=f.match(/^\*\s*as\s+([\w$]+)$/);if(i)e.push(`var ${i[1]} = ${j};`);else if(f.startsWith("{"))u(f.replace(/^\{|\}$/g,""),j);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,l)=>(c(l.slice(mn.length)),"")),t}function nt(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,d.join(t,"index.ts"),d.join(t,"index.tsx"),d.join(t,"index.js"),d.join(t,"index.mjs")];for(let n of e)try{if(S.existsSync(n)&&S.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var Y=new ft;function us(t,e){let n=new Bun.CryptoHasher("md5");for(let[c,u]of[...t].sort(([p],[l])=>p<l?-1:p>l?1:0))n.update(`${c}\x00${u}\x00`);return Y.run({modules:t,key:n.digest("hex").slice(0,12)},e)}function Rt(){return Y.getStore()?.key??""}function wt(t,e,n,c,u,p=new Map,l,E){let R=(f,r,i)=>{if(W(r,t,l))return null;if(!u||f!==n||!bt.test(r))return null;try{if(!S.statSync(r,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}c.add(r);let x=`${mn}${hc(process.cwd(),r)}`;return p.set(i,x),{path:x,external:!0}},j=(f,r)=>{let i=f===n?e:d.dirname(f),x=d.resolve(i,r);return nt(x)??x};return{name:"stx-client-bundle",setup(f){if(f.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(r)=>({path:r.path,external:!0})),f.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(r)=>({path:r.path,external:!0})),f.onResolve({filter:/^\//},(r)=>{let i=nt(r.path);if(i){let x=R(r.importer,i,r.path);if(x)return x;if(i!==n)c.add(i);return{path:i}}return{path:r.path,external:!0}}),f.onResolve({filter:/^\.\.?\//},(r)=>{let i=j(r.importer,r.path),x=R(r.importer,i,r.path);if(x)return x;return c.add(i),{path:i}}),f.onResolve({filter:/^[@~]\//},(r)=>{let i=d.resolve(t,r.path.slice(2)),x=[i,`${i}.ts`,`${i}.tsx`,`${i}.js`,`${i}.mjs`,`${i}.jsx`,d.join(i,"index.ts"),d.join(i,"index.tsx"),d.join(i,"index.js"),d.join(i,"index.mjs")];for(let _ of x)if(S.existsSync(_)&&S.statSync(_,{throwIfNoEntry:!1})?.isFile()){let B=R(r.importer,_,r.path);if(B)return B;return D(`resolved ${r.path[0]}/ import:`,r.path,"\u2192",_),c.add(_),{path:_}}return console.warn(`[stx:bundler] could not resolve ${r.path[0]}/ import:`,r.path),{path:i}}),u)f.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(r)=>{if(r.importer!==n)return;let i=`${mn}npm:${r.path}`;return p.set(r.path,i),{path:i,external:!0}});f.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(r)=>{if(W(r.path,t,l))throw Error(`Server-only API source cannot be imported by a client script: ${r.path}`);let i=d.extname(r.path).toLowerCase(),x=i===".json"?"json":i===".tsx"?"tsx":i===".jsx"?"jsx":i===".ts"||i===".mts"||i===".cts"?"ts":"js";if(r.path!==n)c.add(r.path);let _=E?.get(r.path);if(_!==void 0)return{contents:_,loader:"js"};return{contents:S.readFileSync(r.path,"utf8"),loader:x}})}}}var X=new Map,U=m(64),st=Symbol.for("stx.client-bundle-build-queue");function vc(t){let e=globalThis,c=(e[st]??Promise.resolve()).then(t,t);return e[st]=c.then(()=>{return},()=>{return}),c}async function At(t,e,n={}){let c=n.projectRoot||process.cwd(),u=(await o(c)).serverApi,p=n.minify??!1,l=n.externalizeUserModules??!0,E=n.expose?.length?[...new Set(n.expose)].sort():void 0,R=n.cacheDir||gc(c),j=Y.getStore(),f=new Bun.CryptoHasher("md5");f.update(`${mt}\x00${qe()}\x00${JSON.stringify(u??!1)}\x00${l?"registry":"inline"}\x00${E?E.join(","):"*"}\x00${p?"minified":"readable"}\x00${j?.key??""}\x00${et(t,c)}\x00${et(e,c)}`);let r=f.digest("hex").slice(0,12),i=d.join(R,`${r}.js`),x=U.get(i);if(x){if(sr(x.files)&&x.files.every((M)=>!W(M.path,c,u))){D("memo hit:",r);let M=x.files.map((N)=>N.path);return G(e,M),n.collectInputs?.push(...M),x.code}U.delete(i),D("memo invalidated by dep change:",r)}let _=d.join(R,`${r}.deps.json`),B=Bun.file(i);if(await B.exists()){let M=Bun.file(_),N=!1,C=null;if(await M.exists())try{let F=JSON.parse(await M.text());if(F.metadataVersion===rt&&Array.isArray(F.files)&&ht(F.files,c))C=yn(F.files.map((g)=>it(g,c))),N=C.length===F.files.length&&!C.some((g)=>W(g.path,c,u))}catch{N=!1}if(N){if(D("cache hit:",r),C)G(e,C.map((g)=>g.path)),n.collectInputs?.push(...C.map((g)=>g.path));let F=await B.text();if(C)U.set(i,{code:F,files:C});return F}D("cache invalidated by dep change:",r)}let k=X.get(r);if(k){let M=await k;if(n.collectInputs)n.collectInputs.push(...(U.get(i)?.files??[]).map((N)=>N.path));return M}let L=vc(()=>vt(t,e,{projectRoot:c,minify:p,cacheDir:R,hash:r,cachePath:i,depsPath:_,collectInputs:n.collectInputs,externalizeUserModules:l,serverApi:u,expose:E,throwOnFailure:n.throwOnFailure,substitutes:j?.modules}));X.set(r,L);try{return await L}finally{X.delete(r)}}var St=0;function wc(t){return`${t}-${process.pid}-${++St}`}async function vt(t,e,n){let{projectRoot:c,minify:u,cacheDir:p,hash:l,cachePath:E,depsPath:R,externalizeUserModules:j}=n,f=a(c,"bundle-tmp"),r=wc(l),i=d.join(f,`${r}.ts`),x=d.join(f,"out",r);S.mkdirSync(f,{recursive:!0}),S.mkdirSync(x,{recursive:!0});let _=d.dirname(e),B=new Set,k=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,L=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,M=s(t),{depths:N,balanced:C}=$e(M),F=(v)=>!C||N[v]===0,g;while((g=k.exec(M))!==null){if(g[1])continue;if(!F(g.index))continue;if(g[2])g[2].split(",").forEach((v)=>{let h=jt(v);if(h)B.add(h)});else if(g[3])B.add(g[3])}while((g=L.exec(M))!==null){if(g[1])continue;if(!F(g.index))continue;B.add(g[2])}let at=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=at.exec(M))!==null){if(!F(g.index))continue;let v=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(v&&q.some((h)=>h.test(v)))continue;if(g[1])B.add(g[1]);if(g[2])B.add(g[2]);for(let h of(g[3]??"").split(",")){let b=h.trim();if(!b||/^type\s/.test(b))continue;let O=/\bas\s+(\w+)\s*$/.exec(b)?.[1]??/^\w+$/.exec(b)?.[0];if(O)B.add(O)}}for(let v of M.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let h of v[1].split(",")){let b=/\bas\s+(\w+)\s*$/.exec(h)?.[1]??/^\s*(\w+)\s*$/.exec(h)?.[1];if(b)B.delete(b)}let ct=B.size>0?`
3
3
  export { ${[...B].join(", ")} }`:"";await Bun.write(i,t+ct),D("bundling:",l,"from:",d.basename(e));let Q=new Set,K=new Map;try{let v=await Bun.build({entrypoints:[i],outdir:x,target:"browser",format:"esm",minify:u?{whitespace:!1,identifiers:!0,syntax:!0}:!1,plugins:[wt(c,_,i,Q,j,K,n.serverApi,n.substitutes)],define:{"process.env.NODE_ENV":u?'"production"':'"development"',...w()},root:c});if(!v.success){let I=v.logs.filter((A)=>A.level==="error").map((A)=>A.message).join(", ")||`Unable to bundle ${d.basename(e)}`,T=hn(v.logs,e||void 0);if(console.warn("[stx:bundler] build failed:",I),ai(e||"",I,T),n.throwOnFailure||ci()==="error")throw Error(I);return t}let h="";for(let y of v.outputs){h=await y.text();break}let b=[];for(let y of h.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let I of y[1].split(",")){let T=I.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(T){b.push([T[2],T[1]]);continue}let A=I.trim();if(/^[A-Za-z_$][\w$]*$/.test(A))b.push([A,A])}if(n.expose){let y=new Set(n.expose);for(let I=b.length-1;I>=0;I--)if(!y.has(b[I][0]))b.splice(I,1)}let O=[];h=bc(yc(h,K),O);let lt=h.match(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm)||[];if(h=h.replace(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),u&&h)try{h=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(h)}catch{}let tt=`__stxBundle_${l}`,ut=b.map(([y,I])=>`${JSON.stringify(y)}: ${I}`).join(", "),dt=b.map(([y])=>`var ${y} = undefined;`).join(`
4
4
  `),pt=b.map(([y])=>`${y} = ${tt}[${JSON.stringify(y)}];`).join(`
5
5
  `);if(h=`${lt.join(`
@@ -1,4 +1,4 @@
1
1
  // @bun
2
2
  import m from"path";var y=/__stxModules\["((?:[^"\\]|\\.)*)"\]/g;function I(...o){let r=new Set;for(let s of o){if(!s||!s.includes("__stxModules["))continue;for(let e of s.matchAll(y))try{r.add(JSON.parse(`"${e[1]}"`))}catch{}}return[...r].sort()}async function w(o,r={}){if(o.length===0)return null;let s=process.cwd(),e=[],a=[];o.forEach((t,c)=>{let i=t.startsWith("npm:")?t.slice(4):m.resolve(s,t),l=`__stxRegistered${c}`,p=JSON.stringify(t);e.push(`import * as ${l} from ${JSON.stringify(i)};`),a.push(`if (!globalThis.__stxModules[${p}]) globalThis.__stxModules[${p}] = ${l};`)});let d=[...e,"globalThis.__stxModules = globalThis.__stxModules || {};",...a].join(`
3
- `),n;try{let{bundleClientScript:t}=await import("./chunk-pdw9paq5.js");n=await t(d,m.join(s,".stx-module-registry.ts"),{projectRoot:s,minify:r.minify,externalizeUserModules:!1,collectInputs:r.collectInputs,throwOnFailure:!0})}catch(t){let{formatBuildFailure:c}=await import("./chunk-0fgp13q4.js"),i=c(t);console.warn(`[stx] could not build the page module registry (#1957): ${i}`);let l=`[stx] the page module registry did not build, so ${o.join(", ")} cannot load (#1957): ${i}`;return`;console.error(${JSON.stringify(l)});`}let{transformAutoImports:f,generateAutoImportDestructuring:_}=await import("./chunk-m1nb0z16.js"),u=f(n),h=_(u.stxImports,u.browserImports),{transformStoreImports:x}=await import("./chunk-ekfmad19.js");n=x(u.code);let g=JSON.stringify(new Bun.CryptoHasher("md5").update(d).digest("hex").slice(0,12));return[";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${g}]) return;`,` __stxBundles[${g}] = true;`,h,n,"})();"].join(`
3
+ `),n;try{let{bundleClientScript:t}=await import("./chunk-vddfv082.js");n=await t(d,m.join(s,".stx-module-registry.ts"),{projectRoot:s,minify:r.minify,externalizeUserModules:!1,collectInputs:r.collectInputs,throwOnFailure:!0})}catch(t){let{formatBuildFailure:c}=await import("./chunk-0fgp13q4.js"),i=c(t);console.warn(`[stx] could not build the page module registry (#1957): ${i}`);let l=`[stx] the page module registry did not build, so ${o.join(", ")} cannot load (#1957): ${i}`;return`;console.error(${JSON.stringify(l)});`}let{transformAutoImports:f,generateAutoImportDestructuring:_}=await import("./chunk-jwqz8w58.js"),u=f(n),h=_(u.stxImports,u.browserImports),{transformStoreImports:x}=await import("./chunk-ekfmad19.js");n=x(u.code);let g=JSON.stringify(new Bun.CryptoHasher("md5").update(d).digest("hex").slice(0,12));return[";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${g}]) return;`,` __stxBundles[${g}] = true;`,h,n,"})();"].join(`
4
4
  `)}export{w as buildModuleRegistryScript,I as registeredModuleIdsIn};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Cn,Mc,Ts}from"./chunk-v66yd92a.js";import"./chunk-n5xbv1a9.js";import"./chunk-10s16tad.js";import"./chunk-z4te6223.js";import"./chunk-hnagpvee.js";import"./chunk-gc1dzxee.js";import"./chunk-khzyc41k.js";import"./chunk-x6pz1h3x.js";import{Pe}from"./chunk-1gtrs8va.js";import"./chunk-66e4ga0z.js";import"./chunk-dvbgbd06.js";import"./chunk-sxpnpvt5.js";import"./chunk-jp6yn9mj.js";export{Pe as freeIdentifiers,Ts as processComponents,Mc as processESImports,Cn as rendersAsElement};
2
+ import{Cn,Mc,Ts}from"./chunk-e030grrq.js";import"./chunk-n5xbv1a9.js";import"./chunk-10s16tad.js";import"./chunk-z4te6223.js";import"./chunk-j8vd52sg.js";import"./chunk-gc1dzxee.js";import"./chunk-khzyc41k.js";import"./chunk-x6pz1h3x.js";import{Pe}from"./chunk-1gtrs8va.js";import"./chunk-66e4ga0z.js";import"./chunk-dvbgbd06.js";import"./chunk-sxpnpvt5.js";import"./chunk-jp6yn9mj.js";export{Pe as freeIdentifiers,Ts as processComponents,Mc as processESImports,Cn as rendersAsElement};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Pt,ds,ps,gs,Ju,ms}from"./chunk-m6v0zebf.js";import"./chunk-z4te6223.js";import"./chunk-gc1dzxee.js";import"./chunk-sxpnpvt5.js";export{ps as buildServerApi,Ju as createServerApi,Pt as discoverServerApi,ds as generateApiTypes,ms as isServerApiSource,gs as productionApiDispatcher};
2
+ import{Pt,ds,ps,gs,Ju,ms}from"./chunk-erk7afjv.js";import"./chunk-z4te6223.js";import"./chunk-gc1dzxee.js";import"./chunk-sxpnpvt5.js";export{ps as buildServerApi,Ju as createServerApi,Pt as discoverServerApi,ds as generateApiTypes,ms as isServerApiSource,gs as productionApiDispatcher};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{y}from"./chunk-dvbgbd06.js";import{I,Ut}from"./chunk-66e4ga0z.js";import{w,et,j,o}from"./chunk-v66yd92a.js";import{de,$t,Rt,At}from"./chunk-kjck941v.js";import{ze,an,kt,q}from"./chunk-swv69q75.js";import{E,jn}from"./chunk-szjgbjw1.js";import p from"path";var a=new Map;function A(c,n){for(let s of c.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(s[1])n.add(s[1]);for(let s of c.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let i of(s[1]??"").split(",")){let l=((i.includes(":")?i.split(":").pop():i)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(l))n.add(l)}for(let s of c.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let i of(s[1]??"").split(",")){let r=i.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(r))n.add(r)}}async function ku(c){let n;if(c)n=p.resolve(c);else{let t=await o();n=p.resolve(t.root||process.cwd(),t.storesDir||"stores")}let s=`${n}\x00${Rt()}`,i=new Bun.Glob("*.ts"),r=[];try{for await(let t of i.scan({cwd:n,absolute:!0})){let e=p.basename(t,".ts");if(["index","types"].includes(e))continue;if(t.includes(".d.ts"))continue;r.push(t)}}catch{return q(a,s,"",""),null}let l=()=>[...new Set([...r,...r.flatMap((t)=>de(t))])],f=ze(l()),d=kt(a,s,f);if(d!==void 0)return d||null;if(r.length===0)return q(a,s,f,""),null;let u=[];for(let t of r){let e=await Bun.file(t).text();u.push({file:t,hasUseStore:/useStore\s*\(/.test(e)})}u.sort((t,e)=>{if(t.hasUseStore===e.hasUseStore)return 0;return t.hasUseStore?1:-1});let x=u.map((t)=>t.file),m=[],g=new Set,v=j({loader:"ts",target:"browser",define:w()});for(let t of x)try{let e=await Bun.file(t).text(),_=p.basename(t,".ts");if(A(e,g),$t(e))e=await At(e,t,{projectRoot:process.cwd(),externalizeUserModules:E()});e=et(e),e=I(e),e=Ut(e),e=e.replace(/^export\s+(default\s+)?/gm,""),e=v.transformSync(e),m.push(`// Store: ${_}
2
+ import{y}from"./chunk-dvbgbd06.js";import{I,Ut}from"./chunk-66e4ga0z.js";import{w,et,j,o}from"./chunk-e030grrq.js";import{de,$t,Rt,At}from"./chunk-fqwyfx6c.js";import{ze,an,kt,q}from"./chunk-swv69q75.js";import{E,jn}from"./chunk-szjgbjw1.js";import p from"path";var a=new Map;function A(c,n){for(let s of c.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(s[1])n.add(s[1]);for(let s of c.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let i of(s[1]??"").split(",")){let l=((i.includes(":")?i.split(":").pop():i)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(l))n.add(l)}for(let s of c.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let i of(s[1]??"").split(",")){let r=i.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(r))n.add(r)}}async function ku(c){let n;if(c)n=p.resolve(c);else{let t=await o();n=p.resolve(t.root||process.cwd(),t.storesDir||"stores")}let s=`${n}\x00${Rt()}`,i=new Bun.Glob("*.ts"),r=[];try{for await(let t of i.scan({cwd:n,absolute:!0})){let e=p.basename(t,".ts");if(["index","types"].includes(e))continue;if(t.includes(".d.ts"))continue;r.push(t)}}catch{return q(a,s,"",""),null}let l=()=>[...new Set([...r,...r.flatMap((t)=>de(t))])],f=ze(l()),d=kt(a,s,f);if(d!==void 0)return d||null;if(r.length===0)return q(a,s,f,""),null;let u=[];for(let t of r){let e=await Bun.file(t).text();u.push({file:t,hasUseStore:/useStore\s*\(/.test(e)})}u.sort((t,e)=>{if(t.hasUseStore===e.hasUseStore)return 0;return t.hasUseStore?1:-1});let x=u.map((t)=>t.file),m=[],g=new Set,v=j({loader:"ts",target:"browser",define:w()});for(let t of x)try{let e=await Bun.file(t).text(),_=p.basename(t,".ts");if(A(e,g),$t(e))e=await At(e,t,{projectRoot:process.cwd(),externalizeUserModules:E()});e=et(e),e=I(e),e=Ut(e),e=e.replace(/^export\s+(default\s+)?/gm,""),e=v.transformSync(e),m.push(`// Store: ${_}
3
3
  ${e.trim()}`)}catch(e){console.warn(`[stx] Failed to load store ${t}:`,e)}if(m.length===0)return q(a,s,f,""),null;let S=m.join(`
4
4
 
5
5
  `),h=`;(function(){
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{zt,C}from"./chunk-gc1dzxee.js";import m from"fs";import e from"path";async function $n(r,o,i){if(r.__stx_runtime_config)return;let n=zt();if(n||i){r.__stx_runtime_config=n??C(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-s01qe842.js"),c=await f(t);if(c.runtimeConfig)r.__stx_runtime_config=C(c.runtimeConfig);return}let s=e.dirname(t);if(s===t)return;t=s}}async function Us(r,o){function i(n){if(n===null)return"null";if(Array.isArray(n))return`Array<${n.length?[...new Set(n.map(i))].join(" | "):"unknown"}>`;if(typeof n==="object")return`{ ${Object.entries(n).map(([t,s])=>`readonly ${JSON.stringify(t)}: ${i(s)}`).join("; ")} }`;return typeof n}await Bun.write(e.join(r,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
2
+ import{zt,C}from"./chunk-gc1dzxee.js";import m from"fs";import e from"path";async function $n(r,o,i){if(r.__stx_runtime_config)return;let n=zt();if(n||i){r.__stx_runtime_config=n??C(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-6jjrvb9v.js"),c=await f(t);if(c.runtimeConfig)r.__stx_runtime_config=C(c.runtimeConfig);return}let s=e.dirname(t);if(s===t)return;t=s}}async function Us(r,o){function i(n){if(n===null)return"null";if(Array.isArray(n))return`Array<${n.length?[...new Set(n.map(i))].join(" | "):"unknown"}>`;if(typeof n==="object")return`{ ${Object.entries(n).map(([t,s])=>`readonly ${JSON.stringify(t)}: ${i(s)}`).join("; ")} }`;return typeof n}await Bun.write(e.join(r,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
3
3
  declare module '@stacksjs/stx/runtime-config' { interface PublicRuntimeConfig ${i(o.public??{})} }
4
4
  `),await Bun.write(e.join(r,".stx/runtime-config-server.d.ts"),`import '@stacksjs/stx/runtime-config-server'
5
5
  declare module '@stacksjs/stx/runtime-config-server' { interface PrivateRuntimeConfig ${i(o.private??{})} }
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{rs,nu,ru}from"./chunk-a39kvc2p.js";import"./chunk-fqwyfx6c.js";import"./chunk-erk7afjv.js";import"./chunk-5rtatjwq.js";import"./chunk-e030grrq.js";import"./chunk-n5xbv1a9.js";import"./chunk-10s16tad.js";import"./chunk-z4te6223.js";import"./chunk-j8vd52sg.js";import"./chunk-gc1dzxee.js";import"./chunk-khzyc41k.js";import"./chunk-x6pz1h3x.js";import"./chunk-1gtrs8va.js";import"./chunk-66e4ga0z.js";import"./chunk-dvbgbd06.js";import"./chunk-sxpnpvt5.js";import"./chunk-jp6yn9mj.js";export{ru as clearComposableCache,nu as getComposableScript,rs as listComposableModules};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{J,hs,ys,xc,Ot,li,bs,ui,Yu,Se,bn,ke}from"./chunk-v66yd92a.js";import"./chunk-n5xbv1a9.js";import"./chunk-10s16tad.js";import{zi,s}from"./chunk-6qvskcwp.js";import"./chunk-z4te6223.js";import"./chunk-hnagpvee.js";import"./chunk-gc1dzxee.js";import"./chunk-khzyc41k.js";import"./chunk-x6pz1h3x.js";import"./chunk-1gtrs8va.js";import"./chunk-66e4ga0z.js";import"./chunk-dvbgbd06.js";import"./chunk-sxpnpvt5.js";import"./chunk-jp6yn9mj.js";export{J as BROWSER_CORE_IMPORTS,xc as STX_AUTO_IMPORTS,hs as extractAndStripCssImports,Se as extractBridgeData,zi as findInterpolationEnd,ui as generateAutoImportDestructuring,Yu as generateBrowserAutoImportDestructuring,bn as generateServerDataBridge,Ot as injectBrowserCoreAutoImports,ke as processClientScript,bs as referencesName,ys as renderVendorStyleTags,s as stripCommentsAndLiterals,li as transformAutoImports};
2
+ import{J,hs,ys,xc,Ot,li,bs,ui,Yu,Se,bn,ke}from"./chunk-e030grrq.js";import"./chunk-n5xbv1a9.js";import"./chunk-10s16tad.js";import{zi,s}from"./chunk-6qvskcwp.js";import"./chunk-z4te6223.js";import"./chunk-j8vd52sg.js";import"./chunk-gc1dzxee.js";import"./chunk-khzyc41k.js";import"./chunk-x6pz1h3x.js";import"./chunk-1gtrs8va.js";import"./chunk-66e4ga0z.js";import"./chunk-dvbgbd06.js";import"./chunk-sxpnpvt5.js";import"./chunk-jp6yn9mj.js";export{J as BROWSER_CORE_IMPORTS,xc as STX_AUTO_IMPORTS,hs as extractAndStripCssImports,Se as extractBridgeData,zi as findInterpolationEnd,ui as generateAutoImportDestructuring,Yu as generateBrowserAutoImportDestructuring,bn as generateServerDataBridge,Ot as injectBrowserCoreAutoImports,ke as processClientScript,bs as referencesName,ys as renderVendorStyleTags,s as stripCommentsAndLiterals,li as transformAutoImports};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Bt,Fc,zc,Hc,Vc,Uc,u,Wc,Is,qc,Ri,Ai}from"./chunk-v66yd92a.js";import"./chunk-n5xbv1a9.js";import"./chunk-10s16tad.js";import"./chunk-z4te6223.js";import"./chunk-hnagpvee.js";import"./chunk-gc1dzxee.js";import"./chunk-khzyc41k.js";import"./chunk-x6pz1h3x.js";import"./chunk-1gtrs8va.js";import"./chunk-66e4ga0z.js";import"./chunk-dvbgbd06.js";import"./chunk-sxpnpvt5.js";import"./chunk-jp6yn9mj.js";export{Bt as STX_ENGINE_BINDING_NAMES,Is as convertToCommonJS,Ri as extractScriptFromTemplate,u as extractVariables,Ai as hasVariables,Wc as isCompleteImport,Uc as isMissingBindingFailure,Hc as isModuleResolutionFailure,Vc as isSyntaxFailure,qc as splitDeclaration,Fc as stripTypeScript,zc as withoutStxReferrer};
2
+ import{Bt,Fc,zc,Hc,Vc,Uc,u,Wc,Is,qc,Ri,Ai}from"./chunk-e030grrq.js";import"./chunk-n5xbv1a9.js";import"./chunk-10s16tad.js";import"./chunk-z4te6223.js";import"./chunk-j8vd52sg.js";import"./chunk-gc1dzxee.js";import"./chunk-khzyc41k.js";import"./chunk-x6pz1h3x.js";import"./chunk-1gtrs8va.js";import"./chunk-66e4ga0z.js";import"./chunk-dvbgbd06.js";import"./chunk-sxpnpvt5.js";import"./chunk-jp6yn9mj.js";export{Bt as STX_ENGINE_BINDING_NAMES,Is as convertToCommonJS,Ri as extractScriptFromTemplate,u as extractVariables,Ai as hasVariables,Wc as isCompleteImport,Uc as isMissingBindingFailure,Hc as isModuleResolutionFailure,Vc as isSyntaxFailure,qc as splitDeclaration,Fc as stripTypeScript,zc as withoutStxReferrer};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{Oe}from"./chunk-sxpnpvt5.js";import{He,cn}from"./chunk-19bhnbyn.js";import{di,pi,f,jt,ge,L,n,A,o}from"./chunk-v66yd92a.js";import{C}from"./chunk-gc1dzxee.js";import{Us}from"./chunk-hnagpvee.js";import{An,Pn,In,Nn,ve}from"./chunk-x6pz1h3x.js";import{Ui}from"./chunk-z4te6223.js";import{xe,ce,Po,Io,Kt}from"./chunk-91wzaepm.js";import{Pt,ps}from"./chunk-m6v0zebf.js";import{Xt}from"./chunk-m735gtc4.js";import{Ct,fn,gn}from"./chunk-hjp38m0w.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function J(i){return Q("sha256").update(i).digest("hex").slice(0,8)}function U(i=!1){let l=i?cn():He(),a=J(l);return{content:l,filename:`runtime.${a}.js`,hash:a}}function V(){let i=Oe(),l=J(i);return{content:i,filename:`router.${l}.js`,hash:l}}import q from"path";import{createHash as ee}from"crypto";function te(i={}){let l=new Set;return{context:new Proxy(i,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function X(i,l,a={}){let r=q.resolve(i),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);di();let _={};try{_=await o(a.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))y.push(g[2])}let u=new Set(y.flatMap((R)=>ge(R))),{context:D}=te({__filename:r,__dirname:q.dirname(r),__stx_serverDeclared:u}),w=new Set,P={...A,..._,...a,buildMode:"compile",strict:!1},b=await n(e,D,r,P,w),T=xe(b),B=pi();return{route:l,sourceFile:i,html:b,fragment:T,placeholders:B,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(w),contentHash:S,status:jt(e),streamTemplates:D.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(i,l){let a=0,r=0;if(!m.existsSync(i))return{copied:a,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let y=m.readdirSync(S,{withFileTypes:!0});for(let d of y){if(re.has(d.name))continue;let g=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),a++,r+=m.statSync(u).size}}}return e(i,l),{copied:a,bytes:r}}async function $l(i={}){let l=Date.now(),a=c.resolve(i.root||process.cwd()),r=c.resolve(a,i.outputDir||".output");console.log("[stx build] Starting production build...");let e=await o(a),S=c.resolve(a,i.componentsDir??e.componentsDir??"components"),_=c.resolve(a,i.partialsDir??e.partialsDir??"partials"),y=c.resolve(a,i.layoutsDir??e.layoutsDir??"layouts"),d=i.publicDir??e.publicDir??"public",g=ve(e.app?.head,{known:Nn,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",w=i.routeRules??e.routeRules??{},P=Xt(w),b=i.serverApi??e.serverApi,T=typeof b==="object"?b:{};if(b)Pt(a,T);if(e.runtimeConfig)C(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let B=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of B)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=L(a,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],M=R.filter((s)=>!Y.some((h)=>s.pattern.startsWith(`/${h}/`)||s.pattern===`/${h}`));console.log(`[stx build] Found ${M.length} page routes (${R.length-M.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=U(i.debug),x=V();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let O=[],E=[];for(let s of M){let h=P(s.pattern),k=h.rendering==="prerender";if(k&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await X(s.filePath,s.pattern,{configDir:a,componentsDir:S,partialsDir:_,layoutsDir:y,debug:i.debug});if(O.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=In(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=An(t.html,u);if(g.htmlAttrs)t.html=Pn(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let W=p[1];t.html=t.html.replace(" "+W,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${W}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await f(t.html),k){let p=await Kt(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=ce(t.html,D);let z=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),G=c.join("server","pages",`${z}.compiled.json`),I=c.join("server","fragments",`${z}.html`);await Bun.write(c.join(r,G),JSON.stringify(t,null,2)),await Bun.write(c.join(r,I),t.fragment),E.push({pattern:s.pattern,compiledPath:G,fragmentPath:I,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:k}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(h).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let H=c.resolve(a,d);if(m.existsSync(H)){let{copied:s,bytes:h}=Z(H,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${d}/`)}let F=gn(a);if(F){let{copied:s,bytes:h}=Z(F,c.join(r,"public",fn));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${Ct}/`)}let N={runtime:v.filename,router:x.filename},j=Po(E,N,r);if(j.routeRules=w,j.routerContainer=D,b)j.apiRoutes=await ps(a,r,T);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await Us(a,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Ui(e._layerGraph),null,2));Io(j,r);let K=Date.now()-l;return console.log(`
2
+ import{Oe}from"./chunk-sxpnpvt5.js";import{He,cn}from"./chunk-19bhnbyn.js";import{di,pi,f,jt,ge,L,n,A,o}from"./chunk-e030grrq.js";import{C}from"./chunk-gc1dzxee.js";import{Us}from"./chunk-j8vd52sg.js";import{An,Pn,In,Nn,ve}from"./chunk-x6pz1h3x.js";import{Ui}from"./chunk-z4te6223.js";import{xe,ce,Po,Io,Kt}from"./chunk-9eejvpqc.js";import{Pt,ps}from"./chunk-erk7afjv.js";import{Xt}from"./chunk-m735gtc4.js";import{Ct,fn,gn}from"./chunk-hjp38m0w.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function J(i){return Q("sha256").update(i).digest("hex").slice(0,8)}function U(i=!1){let l=i?cn():He(),a=J(l);return{content:l,filename:`runtime.${a}.js`,hash:a}}function V(){let i=Oe(),l=J(i);return{content:i,filename:`router.${l}.js`,hash:l}}import q from"path";import{createHash as ee}from"crypto";function te(i={}){let l=new Set;return{context:new Proxy(i,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function X(i,l,a={}){let r=q.resolve(i),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);di();let _={};try{_=await o(a.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))y.push(g[2])}let u=new Set(y.flatMap((R)=>ge(R))),{context:D}=te({__filename:r,__dirname:q.dirname(r),__stx_serverDeclared:u}),w=new Set,P={...A,..._,...a,buildMode:"compile",strict:!1},b=await n(e,D,r,P,w),T=xe(b),B=pi();return{route:l,sourceFile:i,html:b,fragment:T,placeholders:B,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(w),contentHash:S,status:jt(e),streamTemplates:D.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(i,l){let a=0,r=0;if(!m.existsSync(i))return{copied:a,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let y=m.readdirSync(S,{withFileTypes:!0});for(let d of y){if(re.has(d.name))continue;let g=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),a++,r+=m.statSync(u).size}}}return e(i,l),{copied:a,bytes:r}}async function $l(i={}){let l=Date.now(),a=c.resolve(i.root||process.cwd()),r=c.resolve(a,i.outputDir||".output");console.log("[stx build] Starting production build...");let e=await o(a),S=c.resolve(a,i.componentsDir??e.componentsDir??"components"),_=c.resolve(a,i.partialsDir??e.partialsDir??"partials"),y=c.resolve(a,i.layoutsDir??e.layoutsDir??"layouts"),d=i.publicDir??e.publicDir??"public",g=ve(e.app?.head,{known:Nn,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",w=i.routeRules??e.routeRules??{},P=Xt(w),b=i.serverApi??e.serverApi,T=typeof b==="object"?b:{};if(b)Pt(a,T);if(e.runtimeConfig)C(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let B=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of B)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=L(a,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],M=R.filter((s)=>!Y.some((h)=>s.pattern.startsWith(`/${h}/`)||s.pattern===`/${h}`));console.log(`[stx build] Found ${M.length} page routes (${R.length-M.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=U(i.debug),x=V();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let O=[],E=[];for(let s of M){let h=P(s.pattern),k=h.rendering==="prerender";if(k&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await X(s.filePath,s.pattern,{configDir:a,componentsDir:S,partialsDir:_,layoutsDir:y,debug:i.debug});if(O.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=In(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=An(t.html,u);if(g.htmlAttrs)t.html=Pn(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let W=p[1];t.html=t.html.replace(" "+W,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${W}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await f(t.html),k){let p=await Kt(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=ce(t.html,D);let z=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),G=c.join("server","pages",`${z}.compiled.json`),I=c.join("server","fragments",`${z}.html`);await Bun.write(c.join(r,G),JSON.stringify(t,null,2)),await Bun.write(c.join(r,I),t.fragment),E.push({pattern:s.pattern,compiledPath:G,fragmentPath:I,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:k}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(h).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let H=c.resolve(a,d);if(m.existsSync(H)){let{copied:s,bytes:h}=Z(H,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${d}/`)}let F=gn(a);if(F){let{copied:s,bytes:h}=Z(F,c.join(r,"public",fn));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${Ct}/`)}let N={runtime:v.filename,router:x.filename},j=Po(E,N,r);if(j.routeRules=w,j.routerContainer=D,b)j.apiRoutes=await ps(a,r,T);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await Us(a,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Ui(e._layerGraph),null,2));Io(j,r);let K=Date.now()-l;return console.log(`
3
3
  [stx build] Done in ${K}ms \u2014 ${O.length} pages compiled`),{pageCount:O.length,assets:N,outputDir:r,duration:K}}
4
4
  export{$l};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Fl}from"./chunk-fz5mzzyj.js";import"./chunk-v66yd92a.js";import"./chunk-n5xbv1a9.js";import"./chunk-10s16tad.js";import"./chunk-z4te6223.js";import"./chunk-hnagpvee.js";import"./chunk-gc1dzxee.js";import"./chunk-khzyc41k.js";import"./chunk-x6pz1h3x.js";import"./chunk-1gtrs8va.js";import"./chunk-66e4ga0z.js";import"./chunk-dvbgbd06.js";import"./chunk-sxpnpvt5.js";import"./chunk-jp6yn9mj.js";export{Fl as buildApp};
2
+ import{Fl}from"./chunk-m64w624a.js";import"./chunk-e030grrq.js";import"./chunk-n5xbv1a9.js";import"./chunk-10s16tad.js";import"./chunk-z4te6223.js";import"./chunk-j8vd52sg.js";import"./chunk-gc1dzxee.js";import"./chunk-khzyc41k.js";import"./chunk-x6pz1h3x.js";import"./chunk-1gtrs8va.js";import"./chunk-66e4ga0z.js";import"./chunk-dvbgbd06.js";import"./chunk-sxpnpvt5.js";import"./chunk-jp6yn9mj.js";export{Fl as buildApp};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{o}from"./chunk-v66yd92a.js";import{qr}from"./chunk-m735gtc4.js";import p from"path";async function Fl(t={}){let d=performance.now(),s=t.root||process.cwd(),e=await o(s),u=t.ssr?.routeRules??e.routeRules??{};if(qr(u),!e.ssr&&Object.keys(u).length)throw Error("routeRules require ssr: true and the production server; flat SSG output cannot apply request/cache policies");if(!e.ssr&&(t.ssr?.serverApi??e.serverApi))throw Error("serverApi requires ssr: true; flat SSG output cannot execute API endpoints");let r=e.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${r.toUpperCase()}${e.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let n,l;if(r==="ssg"){let{generateStaticSite:i}=await import("./ssg.js");n=await i({pagesDir:p.join(e.root||".",e.pagesDir||e.build?.pagesDir||"pages"),publicDir:e.publicDir||e.build?.publicDir||"public",outputDir:e.build?.outputDir||"dist",generate404:e.build?.generate404??!0,minify:e.build?.minify??!0,cleanOutput:e.build?.cleanOutput??!0,router:e.router,...t.ssg})}else{let{buildForProduction:i}=await import("./chunk-nw3kevzk.js");l=await i({root:s,outputDir:".output",debug:t.debug,...t.ssr})}let a=Math.round(performance.now()-d);return{mode:r,ssg:n,ssr:l,duration:a}}
2
+ import{o}from"./chunk-e030grrq.js";import{qr}from"./chunk-m735gtc4.js";import p from"path";async function Fl(t={}){let d=performance.now(),s=t.root||process.cwd(),e=await o(s),u=t.ssr?.routeRules??e.routeRules??{};if(qr(u),!e.ssr&&Object.keys(u).length)throw Error("routeRules require ssr: true and the production server; flat SSG output cannot apply request/cache policies");if(!e.ssr&&(t.ssr?.serverApi??e.serverApi))throw Error("serverApi requires ssr: true; flat SSG output cannot execute API endpoints");let r=e.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${r.toUpperCase()}${e.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let n,l;if(r==="ssg"){let{generateStaticSite:i}=await import("./ssg.js");n=await i({pagesDir:p.join(e.root||".",e.pagesDir||e.build?.pagesDir||"pages"),publicDir:e.publicDir||e.build?.publicDir||"public",outputDir:e.build?.outputDir||"dist",generate404:e.build?.generate404??!0,minify:e.build?.minify??!0,cleanOutput:e.build?.cleanOutput??!0,router:e.router,...t.ssg})}else{let{buildForProduction:i}=await import("./chunk-x7v3m9nk.js");l=await i({root:s,outputDir:".output",debug:t.debug,...t.ssr})}let a=Math.round(performance.now()-d);return{mode:r,ssg:n,ssr:l,duration:a}}
3
3
  export{Fl};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{M,me}from"./chunk-v66yd92a.js";import{ye,C,ot}from"./chunk-gc1dzxee.js";import{ut,Q,Ie}from"./chunk-sxpnpvt5.js";import{Be,ae,T,ce,Oo,Wr,No,Kt}from"./chunk-91wzaepm.js";import{gs}from"./chunk-m6v0zebf.js";import{Xt}from"./chunk-m735gtc4.js";import K from"fs";import A from"path";var{serve:le}=globalThis.Bun;import F from"zlib";import{promisify as Z}from"util";var ee=Z(F.brotliCompress),te=Z(F.gzip),ne=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],re=["text/event-stream","multipart/x-mixed-replace"],se=1024;function oe(t){if(!t)return!1;let e=t.toLowerCase();if(re.some((o)=>e.startsWith(o)))return!1;return ne.some((o)=>e.startsWith(o))}function ie(t){let e=new Map;for(let o of t.split(",")){let[r,...a]=o.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of a){let l=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(g);if(!l)continue;let m=Number.parseFloat(l[1]);if(Number.isFinite(m))h=m}e.set(f,h)}return e}function pe(t){if(!t)return null;let e=ie(t),o=e.get("*"),r=(a)=>e.get(a)??o??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var Y=33554432,H=new Map,U=0;function ue(t,e){if(e.length>Y/8)return;H.set(t,e),U+=e.length;for(let[o,r]of H){if(U<=Y)break;H.delete(o),U-=r.length}}async function qt(t,e,o={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!oe(e.headers.get("content-type")))return e;let r=pe(t.headers.get("accept-encoding"));if(!r)return e;let a;try{a=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(a,{status:e.status,statusText:e.statusText,headers:J(e.headers)});if(a.length<(o.threshold??se))return f();try{let h=o.quality??5,g=`${r}:${h}:${a.length}:${Bun.hash(a)}`,l=H.get(g);if(!l)l=r==="br"?await ee(a,{params:{[F.constants.BROTLI_PARAM_QUALITY]:h,[F.constants.BROTLI_PARAM_SIZE_HINT]:a.length}}):await te(a),ue(g,l);if(l.length>=a.length)return f();let m=J(e.headers);return m.set("Content-Encoding",r),m.set("Content-Length",String(l.length)),new Response(l,{status:e.status,statusText:e.statusText,headers:m})}catch{return f()}}function J(t){let e=new Headers(t),o=e.get("Vary");if(!o)return e.set("Vary","Accept-Encoding"),e;if(!o.split(",").some((a)=>a.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${o}, Accept-Encoding`);return e}class G{now;entries=new M(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,o){let r,a=async()=>{let s=r??await o();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",T(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return a();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${ae(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let S=new Headers(s.headers);return S.set("Cache-Control","private, no-store"),S.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:S})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let b=this.generation,k=async()=>{let s=await o();r=s;let S=(s.headers.get("Vary")??"").toLowerCase().split(",").map((y)=>y.trim()).filter(Boolean);if(s.status!==200||s.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(s.headers.get("Cache-Control")??"")||S.some((y)=>y!=="x-stx-router"&&y!=="accept-encoding"))return null;let L=await s.clone().arrayBuffer();if(L.byteLength>1048576)return null;s.headers.set("Vary",T(s.headers.get("Vary")).Vary);let n={body:L,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===b)this.entries.set(h,n);return n},v=this.pending.get(h);if(!v){if(this.pending.size>=1000)return a();v=k().finally(()=>{if(this.pending.get(h)===v)this.pending.delete(h)}),this.pending.set(h,v)}if(g&&m<e.maxAge+(e.swr??0))return v.catch(()=>{}),l(g);let B=await v;return B?l(B):a()}}var fe={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function wl(t={}){let e=A.resolve(t.outputDir||".output"),o=t.port??3000,r=Oo(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let a=Xt(r.routeRules),f=new G,h=gs(e,r.apiRoutes??[]),g=Bun.file(A.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?C(l):void 0,b=new Map,k=new Map,v=new Map,B=new Map;for(let n of r.routes)try{let y=A.join(e,n.compiledPath),i=JSON.parse(await Bun.file(y).text());if(m)i.html=ot(i.html,m);b.set(n.pattern,i),v.set(n.pattern,Ie(i.html)),B.set(n.pattern,me(i.html));let _=A.join(e,n.fragmentPath);if(await Bun.file(_).exists()){let E=await Bun.file(_).text();k.set(n.pattern,m?ot(E,m):E)}}catch(y){console.warn(`[stx] Failed to load route ${n.pattern}:`,y)}let s=new Map,S=[];for(let n of r.routes)if(n.hasParams){let{regex:y,params:i}=Q(n.pattern,{page:!0});S.push({regex:y,route:n,paramNames:i})}else s.set(n.pattern,n);let L=le({port:o,async fetch(n){return qt(n,await ye(m??C(),async()=>{let i=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[i])return t.apiRoutes[i](n);let _=await h(n);if(_)return _;if((n.method==="GET"||n.method==="HEAD")&&i!=="/"){let p=A.resolve(e,"public"),d;try{d=decodeURIComponent(i)}catch{d=i}if(!d.includes("\x00")){let u=A.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${A.sep}`))try{if(K.existsSync(u)&&K.statSync(u).isFile()){let R=A.extname(u).toLowerCase(),j=fe[R]||"application/octet-stream",N=i.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(i);return new Response(Bun.file(u),{headers:{"Content-Type":j,"Cache-Control":N?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let E=ae(n),w=null,q={};if(w=s.get(i)||null,!w)for(let{regex:p,route:d,paramNames:u}of S){let c=i.match(p);if(c){w=d,u.forEach((R,j)=>{q[R]=c[j+1]});break}}if(!w){let p=ut(i)?null:s.get("/404")||null;if(p){let d=b.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let O=a(i),W=Object.keys(O).length>0;return f.respond(n,O.cache,async()=>{let p=b.get(w.pattern);if(E&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let c=k.get(w.pattern);if(c){let R=v.get(w.pattern);return new Response(c,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...B.has(w.pattern)?{"X-STX-Runtime":B.get(w.pattern)?"true":"false"}:{},...R?{"X-STX-Layout":R.layout,"X-STX-Layout-Group":R.group}:{},...T(),...O.cache?{}:{"Cache-Control":Be}}})}}let d=Wr(n.method),u=b.get(w.pattern);if(!u){let c=s.get("/500")||null;if(c){let R=b.get(c.pattern);if(R)return new Response(R.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(w.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...T(),"Cache-Control":"public, max-age=60"}});try{let{html:c,boundaries:R,redirect:j,cookies:N,status:I,headers:D}=await Kt(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(j)return No(j,N,D);if(R&&R.length>0){let{renderStreamingPage:P,streamToResponse:z}=await import("./chunk-z024wwh6.js"),X=new Headers({...T(),...D,"Cache-Control":"private, no-store"});for(let V of N??[])X.append("Set-Cookie",V);if(E&&!d){let V=Ie(c);X.set("X-STX-Fragment","true"),X.set("X-STX-Runtime",me(c)?"true":"false"),X.set("X-STX-Layout",V.layout),X.set("X-STX-Layout-Group",V.group)}return z(P(E&&!d?ce(c,r.routerContainer||"main"):c,R,{timeoutMs:30000}),{status:I??u.status??200,headers:X})}let x=new Headers({"Content-Type":"text/html",...T(),...O.cache?{}:{"Cache-Control":"private, no-store"}});for(let P of N??[])x.append("Set-Cookie",P);for(let[P,z]of Object.entries(D??{}))x.set(P,z);if(x.set("Vary",T(x.get("Vary")).Vary),E&&!d){let P=Ie(c);return x.set("X-STX-Fragment","true"),x.set("X-STX-Runtime",me(c)?"true":"false"),x.set("X-STX-Layout",P.layout),x.set("X-STX-Layout-Group",P.group),new Response(ce(c,r.routerContainer||"main"),{status:I??u.status??200,headers:x})}return new Response(c,{status:I??u.status??200,headers:x})}catch(c){if(console.error(`[stx] Hydration error for ${i}:`,c),W)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${L.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${b.size} pre-loaded)`),{port:L.port,stop:()=>{f.invalidate(),L.stop()},invalidate:(n)=>f.invalidate(n)}}
2
+ import{M,me}from"./chunk-e030grrq.js";import{ye,C,ot}from"./chunk-gc1dzxee.js";import{ut,Q,Ie}from"./chunk-sxpnpvt5.js";import{Be,ae,T,ce,Oo,Wr,No,Kt}from"./chunk-9eejvpqc.js";import{gs}from"./chunk-erk7afjv.js";import{Xt}from"./chunk-m735gtc4.js";import K from"fs";import A from"path";var{serve:le}=globalThis.Bun;import F from"zlib";import{promisify as Z}from"util";var ee=Z(F.brotliCompress),te=Z(F.gzip),ne=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],re=["text/event-stream","multipart/x-mixed-replace"],se=1024;function oe(t){if(!t)return!1;let e=t.toLowerCase();if(re.some((o)=>e.startsWith(o)))return!1;return ne.some((o)=>e.startsWith(o))}function ie(t){let e=new Map;for(let o of t.split(",")){let[r,...a]=o.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of a){let l=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(g);if(!l)continue;let m=Number.parseFloat(l[1]);if(Number.isFinite(m))h=m}e.set(f,h)}return e}function pe(t){if(!t)return null;let e=ie(t),o=e.get("*"),r=(a)=>e.get(a)??o??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var Y=33554432,H=new Map,U=0;function ue(t,e){if(e.length>Y/8)return;H.set(t,e),U+=e.length;for(let[o,r]of H){if(U<=Y)break;H.delete(o),U-=r.length}}async function qt(t,e,o={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!oe(e.headers.get("content-type")))return e;let r=pe(t.headers.get("accept-encoding"));if(!r)return e;let a;try{a=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(a,{status:e.status,statusText:e.statusText,headers:J(e.headers)});if(a.length<(o.threshold??se))return f();try{let h=o.quality??5,g=`${r}:${h}:${a.length}:${Bun.hash(a)}`,l=H.get(g);if(!l)l=r==="br"?await ee(a,{params:{[F.constants.BROTLI_PARAM_QUALITY]:h,[F.constants.BROTLI_PARAM_SIZE_HINT]:a.length}}):await te(a),ue(g,l);if(l.length>=a.length)return f();let m=J(e.headers);return m.set("Content-Encoding",r),m.set("Content-Length",String(l.length)),new Response(l,{status:e.status,statusText:e.statusText,headers:m})}catch{return f()}}function J(t){let e=new Headers(t),o=e.get("Vary");if(!o)return e.set("Vary","Accept-Encoding"),e;if(!o.split(",").some((a)=>a.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${o}, Accept-Encoding`);return e}class G{now;entries=new M(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,o){let r,a=async()=>{let s=r??await o();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",T(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return a();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${ae(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let S=new Headers(s.headers);return S.set("Cache-Control","private, no-store"),S.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:S})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let b=this.generation,k=async()=>{let s=await o();r=s;let S=(s.headers.get("Vary")??"").toLowerCase().split(",").map((y)=>y.trim()).filter(Boolean);if(s.status!==200||s.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(s.headers.get("Cache-Control")??"")||S.some((y)=>y!=="x-stx-router"&&y!=="accept-encoding"))return null;let L=await s.clone().arrayBuffer();if(L.byteLength>1048576)return null;s.headers.set("Vary",T(s.headers.get("Vary")).Vary);let n={body:L,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===b)this.entries.set(h,n);return n},v=this.pending.get(h);if(!v){if(this.pending.size>=1000)return a();v=k().finally(()=>{if(this.pending.get(h)===v)this.pending.delete(h)}),this.pending.set(h,v)}if(g&&m<e.maxAge+(e.swr??0))return v.catch(()=>{}),l(g);let B=await v;return B?l(B):a()}}var fe={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function wl(t={}){let e=A.resolve(t.outputDir||".output"),o=t.port??3000,r=Oo(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let a=Xt(r.routeRules),f=new G,h=gs(e,r.apiRoutes??[]),g=Bun.file(A.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?C(l):void 0,b=new Map,k=new Map,v=new Map,B=new Map;for(let n of r.routes)try{let y=A.join(e,n.compiledPath),i=JSON.parse(await Bun.file(y).text());if(m)i.html=ot(i.html,m);b.set(n.pattern,i),v.set(n.pattern,Ie(i.html)),B.set(n.pattern,me(i.html));let _=A.join(e,n.fragmentPath);if(await Bun.file(_).exists()){let E=await Bun.file(_).text();k.set(n.pattern,m?ot(E,m):E)}}catch(y){console.warn(`[stx] Failed to load route ${n.pattern}:`,y)}let s=new Map,S=[];for(let n of r.routes)if(n.hasParams){let{regex:y,params:i}=Q(n.pattern,{page:!0});S.push({regex:y,route:n,paramNames:i})}else s.set(n.pattern,n);let L=le({port:o,async fetch(n){return qt(n,await ye(m??C(),async()=>{let i=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[i])return t.apiRoutes[i](n);let _=await h(n);if(_)return _;if((n.method==="GET"||n.method==="HEAD")&&i!=="/"){let p=A.resolve(e,"public"),d;try{d=decodeURIComponent(i)}catch{d=i}if(!d.includes("\x00")){let u=A.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${A.sep}`))try{if(K.existsSync(u)&&K.statSync(u).isFile()){let R=A.extname(u).toLowerCase(),j=fe[R]||"application/octet-stream",N=i.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(i);return new Response(Bun.file(u),{headers:{"Content-Type":j,"Cache-Control":N?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let E=ae(n),w=null,q={};if(w=s.get(i)||null,!w)for(let{regex:p,route:d,paramNames:u}of S){let c=i.match(p);if(c){w=d,u.forEach((R,j)=>{q[R]=c[j+1]});break}}if(!w){let p=ut(i)?null:s.get("/404")||null;if(p){let d=b.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let O=a(i),W=Object.keys(O).length>0;return f.respond(n,O.cache,async()=>{let p=b.get(w.pattern);if(E&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let c=k.get(w.pattern);if(c){let R=v.get(w.pattern);return new Response(c,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...B.has(w.pattern)?{"X-STX-Runtime":B.get(w.pattern)?"true":"false"}:{},...R?{"X-STX-Layout":R.layout,"X-STX-Layout-Group":R.group}:{},...T(),...O.cache?{}:{"Cache-Control":Be}}})}}let d=Wr(n.method),u=b.get(w.pattern);if(!u){let c=s.get("/500")||null;if(c){let R=b.get(c.pattern);if(R)return new Response(R.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(w.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...T(),"Cache-Control":"public, max-age=60"}});try{let{html:c,boundaries:R,redirect:j,cookies:N,status:I,headers:D}=await Kt(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(j)return No(j,N,D);if(R&&R.length>0){let{renderStreamingPage:P,streamToResponse:z}=await import("./chunk-qk4zkvzh.js"),X=new Headers({...T(),...D,"Cache-Control":"private, no-store"});for(let V of N??[])X.append("Set-Cookie",V);if(E&&!d){let V=Ie(c);X.set("X-STX-Fragment","true"),X.set("X-STX-Runtime",me(c)?"true":"false"),X.set("X-STX-Layout",V.layout),X.set("X-STX-Layout-Group",V.group)}return z(P(E&&!d?ce(c,r.routerContainer||"main"):c,R,{timeoutMs:30000}),{status:I??u.status??200,headers:X})}let x=new Headers({"Content-Type":"text/html",...T(),...O.cache?{}:{"Cache-Control":"private, no-store"}});for(let P of N??[])x.append("Set-Cookie",P);for(let[P,z]of Object.entries(D??{}))x.set(P,z);if(x.set("Vary",T(x.get("Vary")).Vary),E&&!d){let P=Ie(c);return x.set("X-STX-Fragment","true"),x.set("X-STX-Runtime",me(c)?"true":"false"),x.set("X-STX-Layout",P.layout),x.set("X-STX-Layout-Group",P.group),new Response(ce(c,r.routerContainer||"main"),{status:I??u.status??200,headers:x})}return new Response(c,{status:I??u.status??200,headers:x})}catch(c){if(console.error(`[stx] Hydration error for ${i}:`,c),W)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${L.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${b.size} pre-loaded)`),{port:L.port,stop:()=>{f.invalidate(),L.stop()},invalidate:(n)=>f.invalidate(n)}}
3
3
  export{qt,wl};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{b,u,n,g,A}from"./chunk-v66yd92a.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 Pu(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 u(m,y,e);let E=H(c),l=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,l);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,l);i.enqueue(O),await new Promise((D)=>setTimeout(D,0))}}let C=await n(_.content,y,e,s,l);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,l);i.enqueue(C)}}}}else{let h=new Map;for(let d of E)if(d.type==="shell"||d.type==="content"){let p=await n(d.content,y,e,s,l);i.enqueue(p)}else if(d.type==="suspense"&&d.name){let p=`stx-suspense-${d.name}`;i.enqueue(`<div id="${p}" data-suspense="${d.name}" style="display:contents;">
2
+ import{b,u,n,g,A}from"./chunk-e030grrq.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 Pu(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 u(m,y,e);let E=H(c),l=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,l);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,l);i.enqueue(O),await new Promise((D)=>setTimeout(D,0))}}let C=await n(_.content,y,e,s,l);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,l);i.enqueue(C)}}}}else{let h=new Map;for(let d of E)if(d.type==="shell"||d.type==="content"){let p=await n(d.content,y,e,s,l);i.enqueue(p)}else if(d.type==="suspense"&&d.name){let p=`stx-suspense-${d.name}`;i.enqueue(`<div id="${p}" data-suspense="${d.name}" style="display:contents;">
3
3
  <template data-suspense-fallback>Loading...</template>
4
4
  </div>`),h.set(d.name,n(d.content,y,e,s,l))}i.enqueue(`
5
5
  <script>
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Pu,Ho,oc,Iu,Ou,Nu,Du,Mu,ic,ac,Lu,ju,Bu,Fu}from"./chunk-a2mmj1e8.js";import"./chunk-v66yd92a.js";import"./chunk-n5xbv1a9.js";import"./chunk-10s16tad.js";import"./chunk-z4te6223.js";import"./chunk-hnagpvee.js";import"./chunk-gc1dzxee.js";import"./chunk-khzyc41k.js";import"./chunk-x6pz1h3x.js";import"./chunk-1gtrs8va.js";import"./chunk-66e4ga0z.js";import"./chunk-dvbgbd06.js";import"./chunk-sxpnpvt5.js";import"./chunk-jp6yn9mj.js";export{oc as SUSPENSE_RESOLVER_RUNTIME,Ho as buildSuspenseResolveScript,Mu as createStreamRenderer,Nu as extractStreamBoundaries,Fu as generateHydrationRuntime,ac as islandDirective,ju as processSectionDirectives,Ou as processStreamDirectives,Lu as registerStreamingDirectives,Iu as renderStreamingPage,Pu as streamTemplate,Du as streamTemplateSimple,Bu as streamToResponse,ic as streamingSuspenseDirective};
2
+ import{Pu,Ho,oc,Iu,Ou,Nu,Du,Mu,ic,ac,Lu,ju,Bu,Fu}from"./chunk-qbh3jk5z.js";import"./chunk-e030grrq.js";import"./chunk-n5xbv1a9.js";import"./chunk-10s16tad.js";import"./chunk-z4te6223.js";import"./chunk-j8vd52sg.js";import"./chunk-gc1dzxee.js";import"./chunk-khzyc41k.js";import"./chunk-x6pz1h3x.js";import"./chunk-1gtrs8va.js";import"./chunk-66e4ga0z.js";import"./chunk-dvbgbd06.js";import"./chunk-sxpnpvt5.js";import"./chunk-jp6yn9mj.js";export{oc as SUSPENSE_RESOLVER_RUNTIME,Ho as buildSuspenseResolveScript,Mu as createStreamRenderer,Nu as extractStreamBoundaries,Fu as generateHydrationRuntime,ac as islandDirective,ju as processSectionDirectives,Ou as processStreamDirectives,Lu as registerStreamingDirectives,Iu as renderStreamingPage,Pu as streamTemplate,Du as streamTemplateSimple,Bu as streamToResponse,ic as streamingSuspenseDirective};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{u,Is,Ri,Ai,Xc,Jc,Yc,Zc,Qc,el,tt,j,nt,tl,fr,nl,Ni,Fs,rt,r,gr,Di,g,oe,vd}from"./chunk-v66yd92a.js";import"./chunk-n5xbv1a9.js";import"./chunk-10s16tad.js";import"./chunk-z4te6223.js";import"./chunk-hnagpvee.js";import"./chunk-gc1dzxee.js";import"./chunk-khzyc41k.js";import"./chunk-x6pz1h3x.js";import"./chunk-1gtrs8va.js";import"./chunk-66e4ga0z.js";import"./chunk-dvbgbd06.js";import"./chunk-sxpnpvt5.js";import"./chunk-jp6yn9mj.js";export{oe as clearComponentCache,Fs as componentClientSignalNames,Is as convertToCommonJS,g as createDetailedErrorMessage,Qc as extractDirectiveNames,Ri as extractScriptFromTemplate,u as extractVariables,r as fileExists,vd as getComponentCacheStats,Jc as getPositionInfo,j as getSharedTranspiler,Di as getSourceLineInfo,Zc as hasDirectives,Ai as hasVariables,nl as isHydrateTrigger,el as isJavaScriptScript,rt as renderComponentWithSlot,gr as resolveTemplatePath,tl as scopeOnRootElement,tt as shouldTranspileTypeScript,Ni as slotContentHasExpressions,nt as transpileTypeScript,fr as userComponentFileExists,Yc as validateDirective,Xc as validateTemplate};
2
+ import{u,Is,Ri,Ai,Xc,Jc,Yc,Zc,Qc,el,tt,j,nt,tl,fr,nl,Ni,Fs,rt,r,gr,Di,g,oe,vd}from"./chunk-e030grrq.js";import"./chunk-n5xbv1a9.js";import"./chunk-10s16tad.js";import"./chunk-z4te6223.js";import"./chunk-j8vd52sg.js";import"./chunk-gc1dzxee.js";import"./chunk-khzyc41k.js";import"./chunk-x6pz1h3x.js";import"./chunk-1gtrs8va.js";import"./chunk-66e4ga0z.js";import"./chunk-dvbgbd06.js";import"./chunk-sxpnpvt5.js";import"./chunk-jp6yn9mj.js";export{oe as clearComponentCache,Fs as componentClientSignalNames,Is as convertToCommonJS,g as createDetailedErrorMessage,Qc as extractDirectiveNames,Ri as extractScriptFromTemplate,u as extractVariables,r as fileExists,vd as getComponentCacheStats,Jc as getPositionInfo,j as getSharedTranspiler,Di as getSourceLineInfo,Zc as hasDirectives,Ai as hasVariables,nl as isHydrateTrigger,el as isJavaScriptScript,rt as renderComponentWithSlot,gr as resolveTemplatePath,tl as scopeOnRootElement,tt as shouldTranspileTypeScript,Ni as slotContentHasExpressions,nt as transpileTypeScript,fr as userComponentFileExists,Yc as validateDirective,Xc as validateTemplate};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{xs,Ss,ks,gd,lr,md}from"./chunk-v66yd92a.js";export{lr as clearImageDeliveryCatalog,gd as deliveredImage,ks as efficientDeliverySources,xs as getImageDelivery,Ss as isTransparentImage,md as prepareImageDelivery};
2
+ import{xs,Ss,ks,gd,lr,md}from"./chunk-e030grrq.js";export{lr as clearImageDeliveryCatalog,gd as deliveredImage,ks as efficientDeliverySources,xs as getImageDelivery,Ss as isTransparentImage,md as prepareImageDelivery};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{or,Sc,Zu,kc,Qu,Cc,ir,b,Dt,Ce,_c,ws,Ec,ed,Y,Tc,td,x,nd}from"./chunk-v66yd92a.js";import"./chunk-n5xbv1a9.js";import"./chunk-10s16tad.js";import"./chunk-z4te6223.js";import"./chunk-hnagpvee.js";import"./chunk-gc1dzxee.js";import"./chunk-khzyc41k.js";import"./chunk-x6pz1h3x.js";import"./chunk-1gtrs8va.js";import"./chunk-66e4ga0z.js";import"./chunk-dvbgbd06.js";import"./chunk-sxpnpvt5.js";import"./chunk-jp6yn9mj.js";export{Tc as applyFilters,Qu as clearCustomFilters,_c as clientLoopScopes,or as defaultFilters,b as escapeHtml,Dt as escapeHtmlValue,x as evaluateExpression,Cc as findMustacheEnd,kc as getAllFilters,Ec as interpolateScriptAttributes,ws as interpolateScriptExpressions,ed as interpolateScriptsInTemplate,Y as processExpressions,Sc as registerFilter,Zu as registerFilters,ir as replaceInterpolations,td as resetRejectedExpressionWarnings,nd as unescapeHtml,Ce as usesSignalsInScript};
2
+ import{or,Sc,Zu,kc,Qu,Cc,ir,b,Dt,Ce,_c,ws,Ec,ed,Y,Tc,td,x,nd}from"./chunk-e030grrq.js";import"./chunk-n5xbv1a9.js";import"./chunk-10s16tad.js";import"./chunk-z4te6223.js";import"./chunk-j8vd52sg.js";import"./chunk-gc1dzxee.js";import"./chunk-khzyc41k.js";import"./chunk-x6pz1h3x.js";import"./chunk-1gtrs8va.js";import"./chunk-66e4ga0z.js";import"./chunk-dvbgbd06.js";import"./chunk-sxpnpvt5.js";import"./chunk-jp6yn9mj.js";export{Tc as applyFilters,Qu as clearCustomFilters,_c as clientLoopScopes,or as defaultFilters,b as escapeHtml,Dt as escapeHtmlValue,x as evaluateExpression,Cc as findMustacheEnd,kc as getAllFilters,Ec as interpolateScriptAttributes,ws as interpolateScriptExpressions,ed as interpolateScriptsInTemplate,Y as processExpressions,Sc as registerFilter,Zu as registerFilters,ir as replaceInterpolations,td as resetRejectedExpressionWarnings,nd as unescapeHtml,Ce as usesSignalsInScript};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ud,mi,dd,hi,Pc,Ic,Lt,kn,pd,Oc,Nc,fd,f}from"./chunk-v66yd92a.js";import"./chunk-n5xbv1a9.js";import"./chunk-10s16tad.js";import"./chunk-z4te6223.js";import"./chunk-hnagpvee.js";import"./chunk-gc1dzxee.js";import"./chunk-khzyc41k.js";import"./chunk-x6pz1h3x.js";import"./chunk-1gtrs8va.js";import"./chunk-66e4ga0z.js";import"./chunk-dvbgbd06.js";import"./chunk-sxpnpvt5.js";import"./chunk-jp6yn9mj.js";export{Lt as buildCss,Oc as extractClassNames,Ic as fingerprintConfig,Nc as generateCss,pd as getCachedCSS,ud as getCssServeAsset,f as injectCss,mi as loadCssEngine,hi as loadCssEngineConfig,kn as rebuildCss,dd as resetCssCache,Pc as resolveUserCssConfig,fd as withLinkedModuleBundles};
2
+ import{ud,mi,dd,hi,Pc,Ic,Lt,kn,pd,Oc,Nc,fd,f}from"./chunk-e030grrq.js";import"./chunk-n5xbv1a9.js";import"./chunk-10s16tad.js";import"./chunk-z4te6223.js";import"./chunk-j8vd52sg.js";import"./chunk-gc1dzxee.js";import"./chunk-khzyc41k.js";import"./chunk-x6pz1h3x.js";import"./chunk-1gtrs8va.js";import"./chunk-66e4ga0z.js";import"./chunk-dvbgbd06.js";import"./chunk-sxpnpvt5.js";import"./chunk-jp6yn9mj.js";export{Lt as buildCss,Oc as extractClassNames,Ic as fingerprintConfig,Nc as generateCss,pd as getCachedCSS,ud as getCssServeAsset,f as injectCss,mi as loadCssEngine,hi as loadCssEngineConfig,kn as rebuildCss,dd as resetCssCache,Pc as resolveUserCssConfig,fd as withLinkedModuleBundles};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{yd,Kc,Te,Ii,bd,Ns,Ds,Ms}from"./chunk-v66yd92a.js";import"./chunk-n5xbv1a9.js";import"./chunk-10s16tad.js";import"./chunk-z4te6223.js";import"./chunk-hnagpvee.js";import"./chunk-gc1dzxee.js";import"./chunk-khzyc41k.js";import"./chunk-x6pz1h3x.js";import"./chunk-1gtrs8va.js";import"./chunk-66e4ga0z.js";import"./chunk-dvbgbd06.js";import"./chunk-sxpnpvt5.js";import"./chunk-jp6yn9mj.js";export{bd as clearOnceStore,Ii as onceStore,Te as partialsCache,Ns as processIncludes,Ds as processStackPushDirectives,Ms as processStackReplacements,yd as resetUnscopedSignalWarnings,Kc as topLevelElements};
2
+ import{yd,Kc,Te,Ii,bd,Ns,Ds,Ms}from"./chunk-e030grrq.js";import"./chunk-n5xbv1a9.js";import"./chunk-10s16tad.js";import"./chunk-z4te6223.js";import"./chunk-j8vd52sg.js";import"./chunk-gc1dzxee.js";import"./chunk-khzyc41k.js";import"./chunk-x6pz1h3x.js";import"./chunk-1gtrs8va.js";import"./chunk-66e4ga0z.js";import"./chunk-dvbgbd06.js";import"./chunk-sxpnpvt5.js";import"./chunk-jp6yn9mj.js";export{bd as clearOnceStore,Ii as onceStore,Te as partialsCache,Ns as processIncludes,Ds as processStackPushDirectives,Ms as processStackReplacements,yd as resetUnscopedSignalWarnings,Kc as topLevelElements};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{gc,de,mc,ai,Et,Tt,Xu,ci,$t,mn,hc,yc,bc,us,Rt,vc,At,wc}from"./chunk-kjck941v.js";import"./chunk-m6v0zebf.js";import"./chunk-5rtatjwq.js";import"./chunk-v66yd92a.js";import"./chunk-n5xbv1a9.js";import"./chunk-10s16tad.js";import"./chunk-z4te6223.js";import"./chunk-hnagpvee.js";import"./chunk-gc1dzxee.js";import"./chunk-khzyc41k.js";import"./chunk-x6pz1h3x.js";import"./chunk-1gtrs8va.js";import"./chunk-66e4ga0z.js";import"./chunk-dvbgbd06.js";import"./chunk-sxpnpvt5.js";import"./chunk-jp6yn9mj.js";export{mn as MODULE_SPECIFIER_PREFIX,gc as bundleCacheDir,At as bundleClientScript,Tt as clearBundleFailures,de as clientBundleDependencies,Et as getBundleFailures,$t as hasUserImports,Rt as moduleSubstitutionKey,yc as normalizeRegistrySpecifiers,vc as queueClientBundleBuild,ai as recordBundleFailure,hc as registryIdForPath,ci as resolveBundlerFallback,bc as rewriteRegistryImports,Xu as setBundlerFallbackMode,mc as shouldLogBundlerDiagnostics,wc as tempBuildName,us as withModuleSubstitutes};
2
+ import{gc,de,mc,ai,Et,Tt,Xu,ci,$t,mn,hc,yc,bc,us,Rt,vc,At,wc}from"./chunk-fqwyfx6c.js";import"./chunk-erk7afjv.js";import"./chunk-5rtatjwq.js";import"./chunk-e030grrq.js";import"./chunk-n5xbv1a9.js";import"./chunk-10s16tad.js";import"./chunk-z4te6223.js";import"./chunk-j8vd52sg.js";import"./chunk-gc1dzxee.js";import"./chunk-khzyc41k.js";import"./chunk-x6pz1h3x.js";import"./chunk-1gtrs8va.js";import"./chunk-66e4ga0z.js";import"./chunk-dvbgbd06.js";import"./chunk-sxpnpvt5.js";import"./chunk-jp6yn9mj.js";export{mn as MODULE_SPECIFIER_PREFIX,gc as bundleCacheDir,At as bundleClientScript,Tt as clearBundleFailures,de as clientBundleDependencies,Et as getBundleFailures,$t as hasUserImports,Rt as moduleSubstitutionKey,yc as normalizeRegistrySpecifiers,vc as queueClientBundleBuild,ai as recordBundleFailure,hc as registryIdForPath,ci as resolveBundlerFallback,bc as rewriteRegistryImports,Xu as setBundlerFallbackMode,mc as shouldLogBundlerDiagnostics,wc as tempBuildName,us as withModuleSubstitutes};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ra,Hl,Aa,Pa,Vl,Ul}from"./chunk-ffaw5he6.js";import"./chunk-v66yd92a.js";import"./chunk-n5xbv1a9.js";import"./chunk-10s16tad.js";import"./chunk-z4te6223.js";import"./chunk-hnagpvee.js";import"./chunk-gc1dzxee.js";import"./chunk-khzyc41k.js";import"./chunk-x6pz1h3x.js";import"./chunk-1gtrs8va.js";import"./chunk-66e4ga0z.js";import"./chunk-dvbgbd06.js";import"./chunk-sxpnpvt5.js";import"./chunk-jp6yn9mj.js";export{Ul as applySlots,Vl as extractSlotContent,Hl as parseSlotElement,Ra as parseSlots,Pa as processSlots,Aa as renderSlot};
2
+ import{Ra,Hl,Aa,Pa,Vl,Ul}from"./chunk-y3n2cgev.js";import"./chunk-e030grrq.js";import"./chunk-n5xbv1a9.js";import"./chunk-10s16tad.js";import"./chunk-z4te6223.js";import"./chunk-j8vd52sg.js";import"./chunk-gc1dzxee.js";import"./chunk-khzyc41k.js";import"./chunk-x6pz1h3x.js";import"./chunk-1gtrs8va.js";import"./chunk-66e4ga0z.js";import"./chunk-dvbgbd06.js";import"./chunk-sxpnpvt5.js";import"./chunk-jp6yn9mj.js";export{Ul as applySlots,Vl as extractSlotContent,Hl as parseSlotElement,Ra as parseSlots,Pa as processSlots,Aa as renderSlot};