@stacksjs/stx 0.2.471 → 0.2.472
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.
- package/dist/{chunk-m8nn4fmg.js → chunk-06h5b4ae.js} +1 -1
- package/dist/{chunk-7ekp1tw8.js → chunk-0s3kjdqz.js} +1 -1
- package/dist/{chunk-h9afpxpp.js → chunk-0tv7srqw.js} +1 -1
- package/dist/{chunk-hc01wxaf.js → chunk-1385gt0h.js} +1 -1
- package/dist/{chunk-hr487qbk.js → chunk-1h3xv51f.js} +1 -1
- package/dist/{chunk-r6174yzb.js → chunk-2cjz23ed.js} +1 -1
- package/dist/{chunk-8319g47g.js → chunk-2e0bgme3.js} +1 -1
- package/dist/{chunk-8y71t1j7.js → chunk-2j105ssm.js} +1 -1
- package/dist/{chunk-t1x2gjtj.js → chunk-2sq74c7t.js} +1 -1
- package/dist/{chunk-bp9snrj7.js → chunk-31rx2tgv.js} +1 -1
- package/dist/{chunk-zam9d5bk.js → chunk-46zk1sva.js} +1 -1
- package/dist/{chunk-0ax9kmf8.js → chunk-4dn8fjv6.js} +1 -1
- package/dist/{chunk-8sxkvdz2.js → chunk-5jxxfs61.js} +1 -1
- package/dist/{chunk-tt28sg5z.js → chunk-62vwxyvr.js} +1 -1
- package/dist/{chunk-106r55j4.js → chunk-7tw5m0y7.js} +1 -1
- package/dist/{chunk-vnaxhk3z.js → chunk-8wfs6753.js} +1 -1
- package/dist/{chunk-cetdwrqh.js → chunk-910yr22j.js} +18 -18
- package/dist/{chunk-045kr10b.js → chunk-99j03b1k.js} +1 -1
- package/dist/{chunk-sxf8nb5z.js → chunk-9j5xghg9.js} +2 -2
- package/dist/{chunk-czxs5tf2.js → chunk-bbx35ba3.js} +1 -1
- package/dist/chunk-bepnzs0v.js +2 -0
- package/dist/{chunk-vt5k0j68.js → chunk-dhd4fy4d.js} +1 -1
- package/dist/{chunk-1p7pws60.js → chunk-ebxkd6t4.js} +5 -5
- package/dist/{chunk-16h7wedx.js → chunk-grzm54tq.js} +2 -2
- package/dist/{chunk-crjmrhkh.js → chunk-h5wbt9kn.js} +1 -1
- package/dist/{chunk-bfvmkncd.js → chunk-jcddb0cg.js} +1 -1
- package/dist/{chunk-a0grp45v.js → chunk-jce36k67.js} +1 -1
- package/dist/{chunk-2p7d1psf.js → chunk-jkeyh3tk.js} +1 -1
- package/dist/{chunk-sx89w4af.js → chunk-k4yv8d99.js} +1 -1
- package/dist/{chunk-x7tsekgw.js → chunk-kq81b4g2.js} +1 -1
- package/dist/{chunk-eqf8985n.js → chunk-mm82qk7b.js} +1 -1
- package/dist/{chunk-x3vqyegd.js → chunk-mwr2mfy0.js} +1 -1
- package/dist/chunk-mxb3pcjk.js +2 -0
- package/dist/chunk-mz1mrxeg.js +2 -0
- package/dist/{chunk-w8qmc1mn.js → chunk-qkps282f.js} +1 -1
- package/dist/{chunk-86knxbhs.js → chunk-qm9hwar4.js} +1 -1
- package/dist/{chunk-x5yzgahy.js → chunk-s545g4mf.js} +1 -1
- package/dist/{chunk-ykfkvk67.js → chunk-sqat6rbj.js} +1 -1
- package/dist/{chunk-9q3dbv0w.js → chunk-sw168dnp.js} +1 -1
- package/dist/{chunk-ezf8r05n.js → chunk-v81y568k.js} +1 -1
- package/dist/{chunk-0xqy73ss.js → chunk-vrs86fxc.js} +1 -1
- package/dist/{chunk-bnd6kd6d.js → chunk-vvqxq8s1.js} +1 -1
- package/dist/{chunk-nma8b17c.js → chunk-w1fy86aa.js} +22 -5
- package/dist/{chunk-wxaezzq7.js → chunk-wbgmfyd2.js} +1 -1
- package/dist/{chunk-jzax5rnm.js → chunk-x99t4atr.js} +1 -1
- package/dist/{chunk-f6kwahhn.js → chunk-xgw58rzk.js} +1 -1
- package/dist/{chunk-5tgctj1p.js → chunk-xweh2gem.js} +1 -1
- package/dist/{chunk-znwpwae1.js → chunk-y4nk5b2h.js} +1 -1
- package/dist/{chunk-93q4tw6z.js → chunk-yr17q3z0.js} +1 -1
- package/dist/{chunk-0r7gsny3.js → chunk-zs131awg.js} +2 -2
- package/dist/cli.js +8 -8
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/pwa.js +1 -1
- package/dist/signals.js +22 -5
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-1g8p13wt.js +0 -2
- package/dist/chunk-71e050r2.js +0 -2
- package/dist/chunk-f5yg6sp3.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{kt,ds,ii,hc}from"./chunk-
|
|
2
|
+
import{kt,ds,ii,hc}from"./chunk-910yr22j.js";import"./chunk-8adstrk5.js";import"./chunk-wkc34drs.js";import"./chunk-j4afmryj.js";import"./chunk-xgw58rzk.js";import"./chunk-99kt56fn.js";import"./chunk-s10r6hxp.js";import"./chunk-tbef3yyk.js";import"./chunk-ab7vh24b.js";import"./chunk-pf0d8y9n.js";import"./chunk-01nx6zcw.js";import"./chunk-9ztdvnkk.js";import"./chunk-pcq6vphz.js";export{hc as declareBareLoopHead,kt as parseLoopBinding,ii as processLoops,ds as reportDeferredLoopWarnings};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{M,ce}from"./chunk-
|
|
2
|
+
import{M,ce}from"./chunk-910yr22j.js";import{ue,C,Ke}from"./chunk-99kt56fn.js";import{Ze,G,Se}from"./chunk-9ztdvnkk.js";import{Re,ne,_,re,co,kr,lo,It}from"./chunk-grzm54tq.js";import{Wr}from"./chunk-xweh2gem.js";import{Dt}from"./chunk-7grtpdw5.js";import F from"zlib";import{promisify as Z}from"util";var ee=Z(F.brotliCompress),te=Z(F.gzip),se=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],oe=["text/event-stream","multipart/x-mixed-replace"],ae=1024;function ie(t){if(!t)return!1;let e=t.toLowerCase();if(oe.some((o)=>e.startsWith(o)))return!1;return se.some((o)=>e.startsWith(o))}function pe(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 le(t){if(!t)return null;let e=pe(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 J=33554432,H=new Map,U=0;function me(t,e){if(e.length>J/8)return;H.set(t,e),U+=e.length;for(let[o,r]of H){if(U<=J)break;H.delete(o),U-=r.length}}async function At(t,e,o={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!ie(e.headers.get("content-type")))return e;let r=le(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:Q(e.headers)});if(a.length<(o.threshold??ae))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),me(g,l);if(l.length>=a.length)return f();let m=Q(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 Q(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}import K from"fs";import P from"path";var{serve:fe}=globalThis.Bun;class q{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",_(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}|${ne(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 B=await s.clone().arrayBuffer();if(B.byteLength>1048576)return null;s.headers.set("Vary",_(s.headers.get("Vary")).Vary);let n={body:B,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 E=await v;return E?l(E):a()}}var de={".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 Uc(t={}){let e=P.resolve(t.outputDir||".output"),o=t.port??3000,r=co(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=Dt(r.routeRules),f=new q,h=Wr(e,r.apiRoutes??[]),g=Bun.file(P.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,E=new Map;for(let n of r.routes)try{let y=P.join(e,n.compiledPath),i=JSON.parse(await Bun.file(y).text());if(m)i.html=Ke(i.html,m);b.set(n.pattern,i),v.set(n.pattern,Se(i.html)),E.set(n.pattern,ce(i.html));let X=P.join(e,n.fragmentPath);if(await Bun.file(X).exists()){let A=await Bun.file(X).text();k.set(n.pattern,m?Ke(A,m):A)}}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}=G(n.pattern,{page:!0});S.push({regex:y,route:n,paramNames:i})}else s.set(n.pattern,n);let B=fe({port:o,async fetch(n){return At(n,await ue(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 X=await h(n);if(X)return X;if((n.method==="GET"||n.method==="HEAD")&&i!=="/"){let p=P.resolve(e,"public"),d;try{d=decodeURIComponent(i)}catch{d=i}if(!d.includes("\x00")){let u=P.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${P.sep}`))try{if(K.existsSync(u)&&K.statSync(u).isFile()){let R=P.extname(u).toLowerCase(),L=de[R]||"application/octet-stream",N=i.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(i);return new Response(Bun.file(u),{headers:{"Content-Type":L,"Cache-Control":N?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let A=ne(n),w=null,W={};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,L)=>{W[R]=c[L+1]});break}}if(!w){let p=Ze(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),Y=Object.keys(O).length>0;return f.respond(n,O.cache,async()=>{let p=b.get(w.pattern);if(A&&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",...E.has(w.pattern)?{"X-STX-Runtime":E.get(w.pattern)?"true":"false"}:{},...R?{"X-STX-Layout":R.layout,"X-STX-Layout-Group":R.group}:{},..._(),...O.cache?{}:{"Cache-Control":Re}}})}}let d=kr(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",..._(),"Cache-Control":"public, max-age=60"}});try{let{html:c,boundaries:R,redirect:L,cookies:N,status:I,headers:D}=await It(u,{params:W,request:n,method:n.method,__stx_strict_hydration:Y,__stx_runtime_config:m});if(L)return lo(L,N,D);if(R&&R.length>0){let{renderStreamingPage:T,streamToResponse:z}=await import("./chunk-jce36k67.js"),j=new Headers({..._(),...D,"Cache-Control":"private, no-store"});for(let V of N??[])j.append("Set-Cookie",V);if(A&&!d){let V=Se(c);j.set("X-STX-Fragment","true"),j.set("X-STX-Runtime",ce(c)?"true":"false"),j.set("X-STX-Layout",V.layout),j.set("X-STX-Layout-Group",V.group)}return z(T(A&&!d?re(c,r.routerContainer||"main"):c,R,{timeoutMs:30000}),{status:I??u.status??200,headers:j})}let x=new Headers({"Content-Type":"text/html",..._(),...O.cache?{}:{"Cache-Control":"private, no-store"}});for(let T of N??[])x.append("Set-Cookie",T);for(let[T,z]of Object.entries(D??{}))x.set(T,z);if(x.set("Vary",_(x.get("Vary")).Vary),A&&!d){let T=Se(c);return x.set("X-STX-Fragment","true"),x.set("X-STX-Runtime",ce(c)?"true":"false"),x.set("X-STX-Layout",T.layout),x.set("X-STX-Layout-Group",T.group),new Response(re(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),Y)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:${B.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${b.size} pre-loaded)`),{port:B.port,stop:()=>{f.invalidate(),B.stop()},invalidate:(n)=>f.invalidate(n)}}
|
|
3
3
|
export{At,Uc};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Zc}from"./chunk-
|
|
2
|
+
import{Zc}from"./chunk-62vwxyvr.js";import"./chunk-grzm54tq.js";import"./chunk-w1fy86aa.js";import"./chunk-xweh2gem.js";import"./chunk-910yr22j.js";import"./chunk-8adstrk5.js";import"./chunk-wkc34drs.js";import"./chunk-j4afmryj.js";import"./chunk-xgw58rzk.js";import"./chunk-99kt56fn.js";import"./chunk-s10r6hxp.js";import"./chunk-tbef3yyk.js";import"./chunk-ab7vh24b.js";import"./chunk-pf0d8y9n.js";import"./chunk-01nx6zcw.js";import"./chunk-9ztdvnkk.js";import"./chunk-pcq6vphz.js";export{Zc as buildForProduction};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Vc}from"./chunk-
|
|
2
|
+
import{Vc}from"./chunk-sqat6rbj.js";import"./chunk-910yr22j.js";import"./chunk-8adstrk5.js";import"./chunk-wkc34drs.js";import"./chunk-j4afmryj.js";import"./chunk-xgw58rzk.js";import"./chunk-99kt56fn.js";import"./chunk-s10r6hxp.js";import"./chunk-tbef3yyk.js";import"./chunk-ab7vh24b.js";import"./chunk-pf0d8y9n.js";import"./chunk-01nx6zcw.js";import"./chunk-9ztdvnkk.js";import"./chunk-pcq6vphz.js";export{Vc as startInteractive};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{y}from"./chunk-01nx6zcw.js";import{P,Tt}from"./chunk-pf0d8y9n.js";import{w,He,L,o}from"./chunk-
|
|
2
|
+
import{y}from"./chunk-01nx6zcw.js";import{P,Tt}from"./chunk-pf0d8y9n.js";import{w,He,L,o}from"./chunk-910yr22j.js";import{ie,ht,yt}from"./chunk-4dn8fjv6.js";import{Pe,Ut,dt,H}from"./chunk-xnjcmhs5.js";import f from"path";var l=new Map;function v(a,s){for(let n of a.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(n[1])s.add(n[1]);for(let n of a.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let r of(n[1]??"").split(",")){let i=((r.includes(":")?r.split(":").pop():r)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(i))s.add(i)}for(let n of a.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let r of(n[1]??"").split(",")){let c=r.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(c))s.add(c)}}async function Kl(a){let s;if(a)s=f.resolve(a);else{let t=await o();s=f.resolve(t.root||process.cwd(),t.storesDir||"stores")}let n=new Bun.Glob("*.ts"),r=[];try{for await(let t of n.scan({cwd:s,absolute:!0})){let e=f.basename(t,".ts");if(["index","types"].includes(e))continue;if(t.includes(".d.ts"))continue;r.push(t)}}catch{return H(l,s,"",""),null}let c=()=>[...new Set([...r,...r.flatMap((t)=>ie(t))])],i=Pe(c()),d=dt(l,s,i);if(d!==void 0)return d||null;if(r.length===0)return H(l,s,i,""),null;let p=[];for(let t of r){let e=await Bun.file(t).text();p.push({file:t,hasUseStore:/useStore\s*\(/.test(e)})}p.sort((t,e)=>{if(t.hasUseStore===e.hasUseStore)return 0;return t.hasUseStore?1:-1});let h=p.map((t)=>t.file),u=[],m=new Set,b=L({loader:"ts",target:"browser",define:w()});for(let t of h)try{let e=await Bun.file(t).text(),x=f.basename(t,".ts");if(v(e,m),ht(e))e=await yt(e,t,{projectRoot:process.cwd(),externalizeUserModules:!1});e=He(e),e=P(e),e=Tt(e),e=e.replace(/^export\s+(default\s+)?/gm,""),e=b.transformSync(e),u.push(`// Store: ${x}
|
|
3
3
|
${e.trim()}`)}catch(e){console.warn(`[stx] Failed to load store ${t}:`,e)}if(u.length===0)return H(l,s,i,""),null;let g=u.join(`
|
|
4
4
|
|
|
5
5
|
`),S=`;(function(){
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{d,us,si,oi,bc,wc,vc,xc,Sc,kc,Ve,L,Ue,Cc,qn,$c,li,Ec,We,r,Kn,ui,g,ee,zu}from"./chunk-
|
|
2
|
+
import{d,us,si,oi,bc,wc,vc,xc,Sc,kc,Ve,L,Ue,Cc,qn,$c,li,Ec,We,r,Kn,ui,g,ee,zu}from"./chunk-910yr22j.js";import"./chunk-8adstrk5.js";import"./chunk-wkc34drs.js";import"./chunk-j4afmryj.js";import"./chunk-xgw58rzk.js";import"./chunk-99kt56fn.js";import"./chunk-s10r6hxp.js";import"./chunk-tbef3yyk.js";import"./chunk-ab7vh24b.js";import"./chunk-pf0d8y9n.js";import"./chunk-01nx6zcw.js";import"./chunk-9ztdvnkk.js";import"./chunk-pcq6vphz.js";export{ee as clearComponentCache,Ec as componentClientSignalNames,us as convertToCommonJS,g as createDetailedErrorMessage,Sc as extractDirectiveNames,si as extractScriptFromTemplate,d as extractVariables,r as fileExists,zu as getComponentCacheStats,wc as getPositionInfo,L as getSharedTranspiler,ui as getSourceLineInfo,xc as hasDirectives,oi as hasVariables,$c as isHydrateTrigger,kc as isJavaScriptScript,We as renderComponentWithSlot,Kn as resolveTemplatePath,Cc as scopeOnRootElement,Ve as shouldTranspileTypeScript,li as slotContentHasExpressions,Ue as transpileTypeScript,qn as userComponentFileExists,vc as validateDirective,bc as validateTemplate};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ko,Co,$o,hu}from"./chunk-
|
|
2
|
+
import{ko,Co,$o,hu}from"./chunk-0s3kjdqz.js";import"./chunk-zs131awg.js";import"./chunk-910yr22j.js";import"./chunk-8adstrk5.js";import"./chunk-wkc34drs.js";import"./chunk-j4afmryj.js";import"./chunk-xgw58rzk.js";import"./chunk-99kt56fn.js";import"./chunk-s10r6hxp.js";import"./chunk-tbef3yyk.js";import"./chunk-ab7vh24b.js";import"./chunk-pf0d8y9n.js";import"./chunk-01nx6zcw.js";import"./chunk-9ztdvnkk.js";import"./chunk-pcq6vphz.js";export{ko as buildNative,hu as default,$o as getAvailableFormats,Co as getAvailableTargets};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ul}from"./chunk-
|
|
2
|
+
import{ul}from"./chunk-5jxxfs61.js";import"./chunk-910yr22j.js";import"./chunk-8adstrk5.js";import"./chunk-wkc34drs.js";import"./chunk-j4afmryj.js";import"./chunk-xgw58rzk.js";import"./chunk-99kt56fn.js";import"./chunk-s10r6hxp.js";import"./chunk-tbef3yyk.js";import"./chunk-ab7vh24b.js";import"./chunk-pf0d8y9n.js";import"./chunk-01nx6zcw.js";import"./chunk-9ztdvnkk.js";import"./chunk-pcq6vphz.js";export{ul as buildApp};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{I,_c,o,R,Hu,Vu}from"./chunk-
|
|
2
|
+
import{I,_c,o,R,Hu,Vu}from"./chunk-910yr22j.js";import"./chunk-8adstrk5.js";import"./chunk-wkc34drs.js";import"./chunk-j4afmryj.js";import"./chunk-xgw58rzk.js";import"./chunk-99kt56fn.js";import"./chunk-s10r6hxp.js";import"./chunk-tbef3yyk.js";import"./chunk-ab7vh24b.js";import"./chunk-pf0d8y9n.js";import"./chunk-01nx6zcw.js";import"./chunk-9ztdvnkk.js";import"./chunk-pcq6vphz.js";export{R as config,I as defaultConfig,Hu as defineStxConfig,o as loadStxConfig,_c as resolveStxDirectories,Vu as validateConfig};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Uc}from"./chunk-
|
|
2
|
+
import{Uc}from"./chunk-0tv7srqw.js";import"./chunk-grzm54tq.js";import"./chunk-xweh2gem.js";import"./chunk-910yr22j.js";import"./chunk-8adstrk5.js";import"./chunk-wkc34drs.js";import"./chunk-j4afmryj.js";import"./chunk-xgw58rzk.js";import"./chunk-99kt56fn.js";import"./chunk-s10r6hxp.js";import"./chunk-tbef3yyk.js";import"./chunk-ab7vh24b.js";import"./chunk-pf0d8y9n.js";import"./chunk-01nx6zcw.js";import"./chunk-9ztdvnkk.js";import"./chunk-pcq6vphz.js";export{Uc as startProductionServer};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Zt,ae}from"./chunk-8scw1bes.js";import{m,Qt,w,Me,o,R}from"./chunk-
|
|
2
|
+
import{Zt,ae}from"./chunk-8scw1bes.js";import{m,Qt,w,Me,o,R}from"./chunk-910yr22j.js";import{qr}from"./chunk-xweh2gem.js";import{s,we}from"./chunk-ak95401g.js";import{a}from"./chunk-kk5cyjfs.js";import f from"path";import j from"fs";var pe=10;function V(e,n,i){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(f.basename(e))||qr(e,n,i)}var ne=1,re=new Map,P=600,fe=100,W=new Map;async function me(e){let n=W.get(e)??0;if(n>0&&n<fe){W.set(e,n+1);return}W.set(e,1);try{let i=(await j.promises.readdir(e)).filter((u)=>u.endsWith(".js"));if(i.length<=P)return;let g=(await Promise.all(i.map(async(u)=>{try{return{name:u,at:(await j.promises.stat(f.join(e,u))).mtimeMs}}catch{return null}}))).filter((u)=>u!==null);g.sort((u,l)=>l.at-u.at);for(let u of g.slice(P)){let l=u.name.slice(0,-3);await j.promises.rm(f.join(e,`${l}.js`),{force:!0}),await j.promises.rm(f.join(e,`${l}.deps.json`),{force:!0})}I("pruned bundle cache to",P,"entries")}catch{}}function ie(e){return re.get(e)??[]}function X(e,n){if(e)re.set(e,n)}function La(e=process.env){return e.STX_DEBUG==="true"||e.STX_DEBUG==="1"}function I(...e){if(La())console.log("[stx:bundler]",...e)}var Z=[];function No(e,n,i){Z.push({filePath:e||"<inline>",message:n,details:i})}function gt(){return Z.slice()}function mt(){Z.length=0}var q;function bu(e){q=e}function Lo(){if(q)return q;try{let e=R.strict;return typeof e==="object"&&e!==null?e.bundlerFallback??"warn":"warn"}catch{return"warn"}}var H=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function ht(e){let n=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,i;while((i=n.exec(e))!==null){let g=i[1];if(!H.some((l)=>l.test(g)))return I("detected user import:",g),!0}let c=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((i=c.exec(e))!==null){let g=i[1];if(/\.css(?:\?.*)?$/.test(g))continue;if(!H.some((l)=>l.test(g)))return I("detected side-effect import:",g),!0}return!1}var Yt="stx-module:",ge=/\.(?:[cm]?[jt]sx?|json)$/i;function ja(e,n){return f.relative(e,n).split(f.sep).join("/")}function Ba(e,n){if(n.size===0)return e;return e.replace(/^([ \t]*import\s+(?:[^;"']*?\s+from\s+)?)(["'])([^"']+)\2/gm,(i,c,g,u)=>{let l=n.get(u);return l&&!u.startsWith(Yt)?`${c}${g}${l}${g}`:i})}function Fa(e,n){let i=0,c=(u)=>{let l=`__stxMod${i++}`,v=JSON.stringify(u);return n.push(`var ${l} = globalThis.__stxModules && globalThis.__stxModules[${v}];`,`if (${l} === undefined) throw new Error("[stx] module " + ${JSON.stringify(v)} + " is not registered on this page (#1957)");`),l},g=(u,l)=>{for(let v of u.split(",")){let M=v.trim();if(!M)continue;let p=M.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!p)continue;let t=p[1].startsWith('"')?JSON.parse(p[1]):p[1],r=p[2]??t;n.push(`var ${r} = ${l}[${JSON.stringify(t)}];`)}};return e=e.replace(/^[ \t]*import\s+([^;"']*?)\s+from\s+["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(u,l,v)=>{let M=v.slice(Yt.length),p=c(M),t=l.trim(),r=t.match(/^([\w$]+)\s*(?:,\s*|$)/);if(r&&!t.startsWith("{")&&!t.startsWith("*"))n.push(`var ${r[1]} = ${p}.default;`),t=t.slice(r[0].length).trim();let d=t.match(/^\*\s*as\s+([\w$]+)$/);if(d)n.push(`var ${d[1]} = ${p};`);else if(t.startsWith("{"))g(t.replace(/^\{|\}$/g,""),p);return""}),e=e.replace(/^[ \t]*import\s+["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(u,l)=>(c(l.slice(Yt.length)),"")),e}function ee(e){let n=[e,`${e}.ts`,`${e}.tsx`,`${e}.js`,`${e}.mjs`,`${e}.jsx`,f.join(e,"index.ts"),f.join(e,"index.tsx"),f.join(e,"index.js"),f.join(e,"index.mjs")];for(let i of n)try{if(j.existsSync(i)&&j.statSync(i,{throwIfNoEntry:!1})?.isFile())return i}catch{}return}function he(e,n,i,c,g,u=new Map,l){let v=(p,t,r)=>{if(V(t,e,l))return null;if(!g||p!==i||!ge.test(t))return null;try{if(!j.statSync(t,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}c.add(t);let d=`${Yt}${ja(process.cwd(),t)}`;return u.set(r,d),{path:d,external:!0}},M=(p,t)=>{let r=p===i?n:f.dirname(p),d=f.resolve(r,t);return ee(d)??d};return{name:"stx-client-bundle",setup(p){if(p.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(t)=>({path:t.path,external:!0})),p.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(t)=>({path:t.path,external:!0})),p.onResolve({filter:/^\//},(t)=>{let r=ee(t.path);if(r){let d=v(t.importer,r,t.path);if(d)return d;if(r!==i)c.add(r);return{path:r}}return{path:t.path,external:!0}}),p.onResolve({filter:/^\.\.?\//},(t)=>{let r=M(t.importer,t.path),d=v(t.importer,r,t.path);if(d)return d;return c.add(r),{path:r}}),p.onResolve({filter:/^[@~]\//},(t)=>{let r=f.resolve(e,t.path.slice(2)),d=[r,`${r}.ts`,`${r}.tsx`,`${r}.js`,`${r}.mjs`,`${r}.jsx`,f.join(r,"index.ts"),f.join(r,"index.tsx"),f.join(r,"index.js"),f.join(r,"index.mjs")];for(let E of d)if(j.existsSync(E)&&j.statSync(E,{throwIfNoEntry:!1})?.isFile()){let C=v(t.importer,E,t.path);if(C)return C;return I(`resolved ${t.path[0]}/ import:`,t.path,"\u2192",E),c.add(E),{path:E}}return console.warn(`[stx:bundler] could not resolve ${t.path[0]}/ import:`,t.path),{path:r}}),g)p.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(t)=>{if(t.importer!==i)return;let r=`${Yt}npm:${t.path}`;return u.set(t.path,r),{path:r,external:!0}});p.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(t)=>{if(V(t.path,e,l))throw Error(`Server-only API source cannot be imported by a client script: ${t.path}`);let r=f.extname(t.path).toLowerCase(),d=r===".json"?"json":r===".tsx"?"tsx":r===".jsx"?"jsx":r===".ts"||r===".mts"||r===".cts"?"ts":"js";if(t.path!==i)c.add(t.path);return{contents:j.readFileSync(t.path,"utf8"),loader:d}})}}}var G=new Map,L=m(64),te=Symbol.for("stx.client-bundle-build-queue");function za(e){let n=globalThis,c=(n[te]??Promise.resolve()).then(e,e);return n[te]=c.then(()=>{return},()=>{return}),c}async function yt(e,n,i={}){let c=i.projectRoot||process.cwd(),g=(await o(c)).serverApi,u=i.minify??!1,l=i.externalizeUserModules??!0,v=i.expose?.length?[...new Set(i.expose)].sort():void 0,M=i.cacheDir||a(c,"bundle-cache"),p=new Bun.CryptoHasher("md5");p.update(`${pe}\x00${Me()}\x00${JSON.stringify(g??!1)}\x00${l?"registry":"inline"}\x00${v?v.join(","):"*"}\x00${e}\x00${n}`);let t=p.digest("hex").slice(0,12),r=f.join(M,`${t}.js`),d=L.get(r);if(d){if(Qt(d.files)&&d.files.every((A)=>!V(A.path,c,g))){I("memo hit:",t);let A=d.files.map((B)=>B.path);return X(n,A),i.collectInputs?.push(...A),d.code}L.delete(r),I("memo invalidated by dep change:",t)}let E=f.join(M,`${t}.deps.json`),C=Bun.file(r);if(await C.exists()){let A=Bun.file(E),B=!1,N=null;if(await A.exists())try{let O=JSON.parse(await A.text());if(O.metadataVersion!==ne||!Array.isArray(O.files))B=!1;else N=O.files,B=!0;if(N&&(!Qt(N)||N.some((D)=>V(D.path,c,g))))B=!1}catch{B=!1}if(B){if(I("cache hit:",t),N)X(n,N.map((D)=>D.path)),i.collectInputs?.push(...N.map((D)=>D.path));let O=await C.text();if(N)L.set(r,{code:O,files:N});return O}I("cache invalidated by dep change:",t)}let _=G.get(t);if(_){let A=await _;if(i.collectInputs)i.collectInputs.push(...(L.get(r)?.files??[]).map((B)=>B.path));return A}let z=za(()=>$e(e,n,{projectRoot:c,minify:u,cacheDir:M,hash:t,cachePath:r,depsPath:E,collectInputs:i.collectInputs,externalizeUserModules:l,serverApi:g,expose:v,throwOnFailure:i.throwOnFailure}));G.set(t,z);try{return await z}finally{G.delete(t)}}var xe=0;function Ha(e){return`${e}-${process.pid}-${++xe}`}async function $e(e,n,i){let{projectRoot:c,minify:g,cacheDir:u,hash:l,cachePath:v,depsPath:M,externalizeUserModules:p}=i,t=a(c,"bundle-tmp"),r=Ha(l),d=f.join(t,`${r}.ts`),E=f.join(t,"out",r);j.mkdirSync(t,{recursive:!0}),j.mkdirSync(E,{recursive:!0});let C=f.dirname(n),_=new Set,z=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,A=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,B=s(e),{depths:N,balanced:O}=we(B),D=(S)=>!O||N[S]===0,b;while((b=z.exec(B))!==null){if(b[1])continue;if(!D(b.index))continue;if(b[2])b[2].split(",").forEach((S)=>{let h=be(S);if(h)_.add(h)});else if(b[3])_.add(b[3])}while((b=A.exec(B))!==null){if(b[1])continue;if(!D(b.index))continue;_.add(b[2])}let se=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((b=se.exec(B))!==null){if(!D(b.index))continue;let S=/^\s*['"]([^'"]+)['"]/.exec(e.slice(b.index+b[0].length))?.[1];if(S&&H.some((h)=>h.test(S)))continue;if(b[1])_.add(b[1]);if(b[2])_.add(b[2]);for(let h of(b[3]??"").split(",")){let y=h.trim();if(!y||/^type\s/.test(y))continue;let U=/\bas\s+(\w+)\s*$/.exec(y)?.[1]??/^\w+$/.exec(y)?.[0];if(U)_.add(U)}}for(let S of B.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let h of S[1].split(",")){let y=/\bas\s+(\w+)\s*$/.exec(h)?.[1]??/^\s*(\w+)\s*$/.exec(h)?.[1];if(y)_.delete(y)}let oe=_.size>0?`
|
|
3
3
|
export { ${[..._].join(", ")} }`:"";await Bun.write(d,e+oe),I("bundling:",l,"from:",f.basename(n));let Y=new Set,Q=new Map;try{let S=await Bun.build({entrypoints:[d],outdir:E,target:"browser",format:"esm",minify:g,plugins:[he(c,C,d,Y,p,Q,i.serverApi)],define:{"process.env.NODE_ENV":g?'"production"':'"development"',...w()},root:c});if(!S.success){let F=S.logs.filter((T)=>T.level==="error").map((T)=>T.message).join(", ")||`Unable to bundle ${f.basename(n)}`,k=Zt(S.logs,n||void 0);if(console.warn("[stx:bundler] build failed:",F),No(n||"",F,k),i.throwOnFailure||Lo()==="error")throw Error(F);return e}let h="";for(let x of S.outputs){h=await x.text();break}let y=[];for(let x of h.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let F of x[1].split(",")){let k=F.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(k){y.push([k[2],k[1]]);continue}let T=F.trim();if(/^[A-Za-z_$][\w$]*$/.test(T))y.push([T,T])}if(i.expose){let x=new Set(i.expose);for(let F=y.length-1;F>=0;F--)if(!x.has(y[F][0]))y.splice(F,1)}let U=[];h=Fa(Ba(h,Q),U);let le=h.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];h=h.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let K=`__stxBundle_${l}`,ce=y.map(([x,F])=>`${JSON.stringify(x)}: ${F}`).join(", "),ue=y.map(([x])=>`var ${x} = undefined;`).join(`
|
|
4
4
|
`),de=y.map(([x])=>`${x} = ${K}[${JSON.stringify(x)}];`).join(`
|
|
5
5
|
`);if(h=`${le.join(`
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{o}from"./chunk-
|
|
2
|
+
import{o}from"./chunk-910yr22j.js";import{Cr}from"./chunk-7grtpdw5.js";import p from"path";async function ul(t={}){let d=performance.now(),s=t.root||process.cwd(),e=await o(s),u=t.ssr?.routeRules??e.routeRules??{};if(Cr(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-1385gt0h.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{ul};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ie,Wt}from"./chunk-
|
|
2
|
+
import{Ie,Wt}from"./chunk-w1fy86aa.js";import{ke}from"./chunk-9ztdvnkk.js";import{Fo,zo,f,St,Q,N,Vn,Un,Wn,n,I,o}from"./chunk-910yr22j.js";import{C}from"./chunk-99kt56fn.js";import{Ss}from"./chunk-xgw58rzk.js";import{dn,pe}from"./chunk-tbef3yyk.js";import{wi}from"./chunk-j4afmryj.js";import{me,re,io,ao,It}from"./chunk-grzm54tq.js";import{bt,Ur}from"./chunk-xweh2gem.js";import{Dt}from"./chunk-7grtpdw5.js";import{pt,Gt,Jt}from"./chunk-5pjsc9zv.js";import{createHash as ee}from"crypto";function J(i){return ee("sha256").update(i).digest("hex").slice(0,8)}function U(i=!1){let l=i?Wt():Ie(),a=J(l);return{content:l,filename:`runtime.${a}.js`,hash:a}}function V(){let i=ke(),l=J(i);return{content:i,filename:`router.${l}.js`,hash:l}}import m from"fs";import c from"path";import q from"path";import{createHash as te}from"crypto";function se(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=te("sha256").update(e).digest("hex").slice(0,16);Fo();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)=>Q(R))),{context:D}=se({__filename:r,__dirname:q.dirname(r),__stx_serverDeclared:u}),A=new Set,j={...I,..._,...a,buildMode:"compile",strict:!1},b=await n(e,D,r,j,A),w=me(b),P=zo();return{route:l,sourceFile:i,html:b,fragment:w,placeholders:P,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(A),contentHash:S,status:St(e),streamTemplates:D.__streamTemplates}}var ne=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(ne.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 Zc(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=pe(e.app?.head,{known:dn,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=i.routeRules??e.routeRules??{},j=Dt(A),b=i.serverApi??e.serverApi,w=typeof b==="object"?b:{};if(b)bt(a,w);if(e.runtimeConfig)C(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let P=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of P)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=N(a,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],B=R.filter((s)=>!Y.some((h)=>s.pattern.startsWith(`/${h}/`)||s.pattern===`/${h}`));console.log(`[stx build] Found ${B.length} page routes (${R.length-B.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 M=[],k=[];for(let s of B){let h=j(s.pattern),O=h.rendering==="prerender";if(O&&(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(M.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=Wn(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=Vn(t.html,u);if(g.htmlAttrs)t.html=Un(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),O){let p=await It(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=re(t.html,D);let L=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),z=c.join("server","pages",`${L}.compiled.json`),G=c.join("server","fragments",`${L}.html`);await Bun.write(c.join(r,z),JSON.stringify(t,null,2)),await Bun.write(c.join(r,G),t.fragment),k.push({pattern:s.pattern,compiledPath:z,fragmentPath:G,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:O}),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 E=c.resolve(a,d);if(m.existsSync(E)){let{copied:s,bytes:h}=Z(E,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 H=Jt(a);if(H){let{copied:s,bytes:h}=Z(H,c.join(r,"public",Gt));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${pt}/`)}let F={runtime:v.filename,router:x.filename},T=io(k,F,r);if(T.routeRules=A,T.routerContainer=D,b)T.apiRoutes=await Ur(a,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await Ss(a,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(wi(e._layerGraph),null,2));ao(T,r);let K=Date.now()-l;return console.log(`
|
|
3
3
|
[stx build] Done in ${K}ms \u2014 ${M.length} pages compiled`),{pageCount:M.length,assets:F,outputDir:r,duration:K}}
|
|
4
4
|
export{Zc};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ju,ic,is,as,ei,ti,cs,ls,zn,ac,ni,ri,cc,He}from"./chunk-
|
|
2
|
+
import{ju,ic,is,as,ei,ti,cs,ls,zn,ac,ni,ri,cc,He}from"./chunk-910yr22j.js";import"./chunk-8adstrk5.js";import"./chunk-wkc34drs.js";import"./chunk-j4afmryj.js";import"./chunk-xgw58rzk.js";import"./chunk-99kt56fn.js";import"./chunk-s10r6hxp.js";import"./chunk-tbef3yyk.js";import"./chunk-ab7vh24b.js";import"./chunk-pf0d8y9n.js";import"./chunk-01nx6zcw.js";import"./chunk-9ztdvnkk.js";import"./chunk-pcq6vphz.js";export{ju as clearScriptScanCache,cs as convertServerLoopAttributesToDirectives,ei as convertSignalDirectivesToAttributes,ls as convertSignalLoopsToAttributes,ac as extractExports,ri as findMarkupIndexOutsideScripts,as as hasSignalsSyntax,is as parseLoopExpression,ti as preEvalLiteralReactiveIfs,zn as processScriptSetup,ni as processSignals,cc as rewriteStxImportSpecifiers,ic as scanScriptTags,He as stripStxRuntimeImports};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{W,Kr,Xr,Va,wt,jo,Gr,Bo,vu,Ne,Jr,he}from"./chunk-
|
|
2
|
+
import{W,Kr,Xr,Va,wt,jo,Gr,Bo,vu,Ne,Jr,he}from"./chunk-910yr22j.js";import"./chunk-8adstrk5.js";import"./chunk-wkc34drs.js";import{hi,s}from"./chunk-ak95401g.js";import"./chunk-j4afmryj.js";import"./chunk-xgw58rzk.js";import"./chunk-99kt56fn.js";import"./chunk-s10r6hxp.js";import"./chunk-tbef3yyk.js";import"./chunk-ab7vh24b.js";import"./chunk-pf0d8y9n.js";import"./chunk-01nx6zcw.js";import"./chunk-9ztdvnkk.js";import"./chunk-pcq6vphz.js";export{W as BROWSER_CORE_IMPORTS,Va as STX_AUTO_IMPORTS,Kr as extractAndStripCssImports,Ne as extractBridgeData,hi as findInterpolationEnd,Bo as generateAutoImportDestructuring,vu as generateBrowserAutoImportDestructuring,Jr as generateServerDataBridge,wt as injectBrowserCoreAutoImports,he as processClientScript,Gr as referencesName,Xr as renderVendorStyleTags,s as stripCommentsAndLiterals,jo as transformAutoImports};
|