@stacksjs/stx 0.2.839 → 0.2.840
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-03v59965.js +2 -0
- package/dist/{chunk-mtjt2z77.js → chunk-2knr61g3.js} +1 -1
- package/dist/{chunk-aza2zrhk.js → chunk-2vprq4x0.js} +4 -4
- package/dist/{chunk-aywvbcae.js → chunk-3gzhh69y.js} +1 -1
- package/dist/{chunk-np6h1ct6.js → chunk-40bkdswh.js} +1 -1
- package/dist/{chunk-w5h67xec.js → chunk-4rswqcfc.js} +1 -1
- package/dist/{chunk-1zfxmjrf.js → chunk-57x8wxdf.js} +4 -4
- package/dist/chunk-5khpy4na.js +2 -0
- package/dist/{chunk-mv49hr9y.js → chunk-5pbxjx8s.js} +1 -1
- package/dist/{chunk-rsn9rh07.js → chunk-66eba1h4.js} +1 -1
- package/dist/{chunk-8em568fw.js → chunk-6efz68j8.js} +1 -1
- package/dist/{chunk-8913k8g7.js → chunk-6n5kew7a.js} +1 -1
- package/dist/{chunk-d2mdh669.js → chunk-6nb07mdj.js} +1 -1
- package/dist/{chunk-yn17484y.js → chunk-7dnp8evg.js} +3 -3
- package/dist/{chunk-zyeg9t2t.js → chunk-7m53tpxn.js} +1 -1
- package/dist/{chunk-vr6qa0g2.js → chunk-7y5gz0cs.js} +1 -1
- package/dist/{chunk-mzj71r0m.js → chunk-88rwr1w2.js} +1 -1
- package/dist/{chunk-jzh0n2ct.js → chunk-8d4br2j5.js} +2 -2
- package/dist/{chunk-nb2tedk0.js → chunk-8gdtys3s.js} +1 -1
- package/dist/{chunk-whmqfr3y.js → chunk-9razzga7.js} +2 -2
- package/dist/chunk-a2p42cxf.js +2 -0
- package/dist/{chunk-8h0pnn5p.js → chunk-azderqyk.js} +5 -5
- package/dist/{chunk-f69cmsz9.js → chunk-b3fx75th.js} +1 -1
- package/dist/{chunk-pqg6j26p.js → chunk-b685aqy4.js} +1 -1
- package/dist/{chunk-4w3qpewn.js → chunk-b90xw7v4.js} +1 -1
- package/dist/{chunk-23zzbsms.js → chunk-c87zgwzn.js} +1 -1
- package/dist/{chunk-p83h2dbg.js → chunk-chjdnmqv.js} +2 -2
- package/dist/{chunk-v49rvx9y.js → chunk-ebxz30e5.js} +5 -5
- package/dist/{chunk-r0ssa1xd.js → chunk-ecjx9z8a.js} +1 -1
- package/dist/{chunk-78nsbzcm.js → chunk-fpn5txnm.js} +1 -1
- package/dist/{chunk-ndyj1d0z.js → chunk-g6r2313a.js} +1 -1
- package/dist/chunk-g957a2m3.js +2 -0
- package/dist/{chunk-cax1wts7.js → chunk-ga8waz0a.js} +1 -1
- package/dist/chunk-gbcwna5q.js +2 -0
- package/dist/chunk-jgx0ex9p.js +3 -0
- package/dist/{chunk-5hmm01av.js → chunk-kvpzxnww.js} +1 -1
- package/dist/{chunk-3tydmgwh.js → chunk-m7acbayx.js} +2 -2
- package/dist/{chunk-8byydry7.js → chunk-mh4kpnjr.js} +1 -1
- package/dist/chunk-ndah5rvs.js +2 -0
- package/dist/{chunk-efdfkfp1.js → chunk-ns0171xk.js} +1 -1
- package/dist/{chunk-s85chp3w.js → chunk-p2e02hh7.js} +1 -1
- package/dist/{chunk-jjyt3tsv.js → chunk-p65ax8s0.js} +1 -1
- package/dist/{chunk-nsnzgdjt.js → chunk-pqn7r8fw.js} +1 -1
- package/dist/{chunk-d1vkjxb1.js → chunk-px5kda00.js} +2 -2
- package/dist/{chunk-8q3pyq6a.js → chunk-q1nj47gn.js} +1 -1
- package/dist/chunk-qb3c05qq.js +2 -0
- package/dist/{chunk-sm9f980t.js → chunk-qcars8ar.js} +1 -1
- package/dist/{chunk-ksr6c2kh.js → chunk-qzms4d8s.js} +1 -1
- package/dist/{chunk-nk7nxzxf.js → chunk-rb17ssxh.js} +1 -1
- package/dist/{chunk-ynf16yz4.js → chunk-s2k1x2rn.js} +1 -1
- package/dist/chunk-spdh99jy.js +2 -0
- package/dist/{chunk-xvhxxj4g.js → chunk-vbw9jhz2.js} +6 -6
- package/dist/chunk-vv7b8p5z.js +2 -0
- package/dist/{chunk-31cnrpd1.js → chunk-vwddsdk5.js} +2 -2
- package/dist/{chunk-c2v38ghp.js → chunk-x0ygwk9x.js} +1 -1
- package/dist/{chunk-ryrdx5mw.js → chunk-x42tsdbx.js} +1 -1
- package/dist/{chunk-xx3reejx.js → chunk-xdzy4pm0.js} +1 -1
- package/dist/{chunk-aekq1zyn.js → chunk-xqtt5t6d.js} +4 -4
- package/dist/{chunk-8y3f5fyg.js → chunk-xz2569ra.js} +1 -1
- package/dist/{chunk-cw1ar3dq.js → chunk-y8zzvzww.js} +1 -1
- package/dist/{chunk-7mz6ze0x.js → chunk-ywpan1k5.js} +1 -1
- package/dist/{chunk-rdn1d4bf.js → chunk-z9xjhc5m.js} +1 -1
- package/dist/{chunk-53j9wakh.js → chunk-znwc8gta.js} +1 -1
- package/dist/{chunk-gpschnvk.js → chunk-zrp4159x.js} +1 -1
- package/dist/cli.js +7 -7
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/native/runtime/craft-bridge.js +2 -10
- package/dist/native/runtime/craft.d.ts +11 -0
- package/dist/native/runtime/navigation-chrome.d.ts +2 -0
- package/dist/native/runtime/navigation-chrome.js +25 -3
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +6 -9
- package/package.json +5 -5
- package/dist/chunk-7ka7pvj9.js +0 -2
- package/dist/chunk-7t9951at.js +0 -2
- package/dist/chunk-8z3yjex0.js +0 -2
- package/dist/chunk-8zzepd7g.js +0 -2
- package/dist/chunk-98258444.js +0 -2
- package/dist/chunk-mad4g0yx.js +0 -2
- package/dist/chunk-n8a4jm0p.js +0 -3
- package/dist/chunk-phxkmjnw.js +0 -2
- package/dist/chunk-rt29w5ns.js +0 -2
- package/dist/chunk-s92f8w68.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ch,vo,lh,uh,dh,ph}from"./chunk-kvpzxnww.js";import"./chunk-y8zzvzww.js";import"./chunk-qzms4d8s.js";import"./chunk-4y6hes3h.js";import"./chunk-8d4br2j5.js";import"./chunk-xqtt5t6d.js";import"./chunk-2fj5zev7.js";import"./chunk-chjdnmqv.js";import"./chunk-ns0171xk.js";import"./chunk-11y84h2d.js";import"./chunk-4657mnht.js";import"./chunk-zg44cf8a.js";import"./chunk-2j5yane9.js";import"./chunk-vbw9jhz2.js";import"./chunk-p65ax8s0.js";import"./chunk-8370x30n.js";import"./chunk-89d3h8mp.js";import"./chunk-zjqvbcwa.js";import"./chunk-23r3rby6.js";export{ph as clearStoreCache,ch as getStoreScript,dh as getStoreScriptFor,uh as pageStoresAll,vo as storesRead,lh as storesReadInFiles};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{kn,ki}from"./chunk-
|
|
2
|
+
import{kn,ki}from"./chunk-p65ax8s0.js";import"./chunk-8370x30n.js";export{ki as generateRuntimeConfigTypes,kn as prepareRuntimeConfig};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{T,u,f,P,d,K}from"./chunk-89d3h8mp.js";import{V,Os,Ne,pe,Pt,Cr,Be,Fe,r,h,ke,_}from"./chunk-
|
|
2
|
+
import{T,u,f,P,d,K}from"./chunk-89d3h8mp.js";import{V,Os,Ne,pe,Pt,Cr,Be,Fe,r,h,ke,_}from"./chunk-vbw9jhz2.js";import{ct}from"./chunk-23r3rby6.js";import{I}from"./chunk-zjqvbcwa.js";import{oe}from"./chunk-1b1ntgt7.js";import{B,Ze}from"./chunk-ybq56wam.js";import{E,Tn}from"./chunk-7vhm0jj5.js";import C from"path";import{existsSync as ye}from"fs";function ae(c,e){let a=0;for(let n=e;n<c.length;n++){let y=c[n];if(y==="("||y==="["||y==="{")a++;else if(y===")"||y==="]"||y==="}")a--;else if(y===","&&a===0)return n}return-1}function $e(c,e,a){let n=c,y=new RegExp(`${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),s=y.exec(n);while(s){let g=s.index,t=g+s[0].length-1,D=1,W=t+1;while(W<n.length&&D>0){if(n[W]==="(")D++;else if(n[W]===")")D--;W++}if(D!==0)break;let re=n.substring(t+1,W-1),N=`${a}(${re})`;n=n.substring(0,g)+N+n.substring(W),y.lastIndex=g+N.length,s=y.exec(n)}return n}function Ee(c){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(c)}function he(c){let e=c,a=[],n=new Set,y=0,s=0,g=e.length,t=(N)=>{s++;while(s<g){if(e[s]==="\\"){s+=2;continue}if(e[s]===N){s++;return}s++}},D=()=>{s++;while(s<g){if(e[s]==="\\"){s+=2;continue}if(e[s]==="`"){s++;return}if(e[s]==="$"&&e[s+1]==="{"){s+=2;let N=1;while(s<g&&N>0)if(e[s]==="{")N++,s++;else if(e[s]==="}")N--,s++;else if(e[s]==="'"||e[s]==='"')t(e[s]);else if(e[s]==="`")D();else s++;continue}s++}},W=()=>{if(e[s]==="/"&&e[s+1]==="/"){while(s<g&&e[s]!==`
|
|
3
3
|
`)s++;return!0}if(e[s]==="/"&&e[s+1]==="*"){s+=2;while(s<g-1&&!(e[s]==="*"&&e[s+1]==="/"))s++;return s+=2,!0}return!1},re=()=>{if(y!==0)return;let N=e.slice(s).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(N){let Z=N[2];if(!n.has(Z))a.push(Z),n.add(Z);return}let te=e.slice(s).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(te){let Z=te[1];if(!n.has(Z))a.push(Z),n.add(Z);return}let Y=e.slice(s).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Y){let Z=Y[1];if(!n.has(Z))a.push(Z),n.add(Z)}};while(s<g){if(W())continue;if(e[s]==="'"||e[s]==='"'){t(e[s]);continue}if(e[s]==="`"){D();continue}if(e[s]==="{"){y++,s++;continue}if(e[s]==="}"){y--,s++;continue}if(y===0&&/[a-z]/i.test(e[s])&&(s===0||/\s|[;{}()]/.test(e[s-1])))re();s++}return a.join(", ")}function ve(c,e=""){let a=he(c).split(",").map((n)=>n.trim()).filter(Boolean);return`
|
|
4
4
|
(function() {
|
|
5
5
|
${ct("var",a)}
|
|
@@ -44,10 +44,10 @@ ${s}
|
|
|
44
44
|
}
|
|
45
45
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
46
46
|
}
|
|
47
|
-
})();`;return a+c+n}function Te(c,e){if(B(c)){let s=B(c).tag.match(/data-stx-scope="([^"]*)"/);if(s)return{html:c,mergedIntoExisting:s[1],stamped:!0,root:"body"};return{html:Ze(c,(g,t)=>`<body${t} data-stx-scope="${e}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let a=Pt(c),n=c.slice(a).match(/^(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(n){let y=n[1]+n[2],s=n[1].slice(1),g=y.match(/data-stx-scope="([^"]*)"/);if(g)return{html:c,mergedIntoExisting:g[1],stamped:!0,root:s};let t=c.slice(0,a),D=n[1],W=n[2];return{html:`${t}${D} data-stx-scope="${e}"${W}${c.slice(a+n[0].length)}`,mergedIntoExisting:null,stamped:!0,root:s}}return{html:c,mergedIntoExisting:null,stamped:!1,root:null}}var Ae=0;function fe(c,e){let a=C.basename(c,".stx").replace(/[^a-zA-Z0-9]/g,"_"),n=e.__stx_scope_seq;return n?`stx_scope_${a}_${++n.n}_${n.key}`:`stx_scope_${a}_${++Ae}`}var le=new Set,de=new Set;function Oh(){le.clear(),de.clear()}var Ce=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Mf(c){let e=(t)=>t.replace(/[^\n]/g," "),a=c.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,e).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,e).replace(/<!--[\s\S]*?-->/g,e).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,e).replace(/\{\{[\s\S]*?\}\}/g,e).replace(/\{!![\s\S]*?!!\}/g,e),n=[],y=0,s=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,g;while((g=s.exec(a))!==null){let t=g[1]==="/",D=g[2],W=g[3]==="/"||Ce.has(D.toLowerCase());if(t){y=Math.max(0,y-1);continue}if(y===0)n.push(D);if(!W)y++}return n}function me(c){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(c)}var Ye=new T(500),lc=new Set;function Nh(){lc.clear()}function De(c){if(c.__onceStore instanceof Set)return c.__onceStore;return lc}async function cs(c,e,a,n,y,s=new Set){let g=n.partialsDir||C.join(C.dirname(a),"partials");if(g&&!C.isAbsolute(g))g=C.resolve(process.cwd(),g);let t=$e(c,"@partial","@include"),D=De(e);t=t.replace(/@once([\s\S]*?)@endonce/g,(m,k,x)=>{let p=k.trim(),i=`${a}:${p}`;if(D.has(i))return"";return D.add(i),k});{let m=/@includeIf\s*\(/g,k;while((k=m.exec(t))!==null){let x=k.index,p=x+k[0].length-1,i=1,w=p+1;while(w<t.length&&i>0){if(t[w]==="(")i++;else if(t[w]===")")i--;w++}if(i!==0)break;let l=t.substring(p+1,w-1),o=l.match(/^\s*['"]([^'"]+)['"]/);if(!o){m.lastIndex=w;continue}let O=o[1],z=W(O,g,a),R="";if(z&&await Bun.file(z).exists())y.add(z),R=`@include(${l})`;t=t.substring(0,x)+R+t.substring(w),m.lastIndex=0}}for(let[m,k]of[["@includeWhen",!1],["@includeUnless",!0]]){let x=new RegExp(`${m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),p;while((p=x.exec(t))!==null){let i=p.index,w=i+p[0].length-1,l=1,o=w+1;while(o<t.length&&l>0){if(t[o]==="(")l++;else if(t[o]===")")l--;o++}if(l!==0)break;let O=t.substring(w+1,o-1),z=ae(O,0);if(z===-1){x.lastIndex=o;continue}let R=O.substring(0,z).trim(),H=O.substring(z+1).trim(),F=H.match(/^\s*['"]([^'"]+)['"]/);if(!F){x.lastIndex=o;continue}let b=F[1],J=H.substring(F[0].length),j,M=ae(J,0);if(M!==-1)j=J.substring(M+1).trim();try{let A=`Boolean(${R})`,L;if(f(A)){let ie=d(A,Object.keys(e));L=Boolean(ie(...Object.values(e)))}else L=Boolean(u(A,e));let ee=k?!L:L,ne="";if(ee){let ie=W(b,g,a);if(ie&&await Bun.file(ie).exists())y.add(ie);ne=`@include('${b}'${j?`, ${j}`:""})`}t=t.substring(0,i)+ne+t.substring(o),x.lastIndex=0}catch(A){let L=A instanceof Error?A.message:String(A),ee=h("Include",`Error evaluating ${m} condition: ${L}`,a,c,i);t=t.substring(0,i)+ee+t.substring(o),x.lastIndex=0}}}{let m=/@each\s*\(/g,k;while((k=m.exec(t))!==null){let x=k.index,p=x+k[0].length-1,i=1,w=p+1;while(w<t.length&&i>0){if(t[w]==="(")i++;else if(t[w]===")"){if(i--,i===0)break}w++}if(i!==0)break;let l=t.substring(p+1,w),o=t.substring(x,w+1),O=l.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!O){m.lastIndex=0,t=t.replace(o,"");continue}let[,z,R,H,F]=O;try{let b,J=R.trim();if(f(J))b=d(J,Object.keys(e))(...Object.values(e));else b=u(J,e);let j="";if(Array.isArray(b)&&b.length>0)for(let M of b){let A={...e,[H]:M},L=await te(z,A,c,x);j+=L}else if(F)j=await te(F,{},c,x);t=t.substring(0,x)+j+t.substring(w+1),m.lastIndex=0}catch(b){let J=b instanceof Error?b.message:String(b);t=t.substring(0,x)+h("Each",`Error in @each: ${J}`,a,c,x)+t.substring(w+1),m.lastIndex=0}}}{let m=/@includeFirst\s*\(/g,k;while((k=m.exec(t))!==null){let x=k.index,p=x+k[0].length-1,i=1,w=p+1;while(w<t.length&&i>0){if(t[w]==="(")i++;else if(t[w]===")"){if(i--,i===0)break}w++}if(i!==0)break;let l=t.substring(p+1,w),o=t.substring(x,w+1),O=l.match(/^\s*(\[[^\]]+\])/);if(!O){m.lastIndex=0,t=t.replace(o,"");continue}let z=O[1],R=l.slice(O[0].length),H,F=R.match(/^\s*,\s*\{/);if(F){R=R.slice(F[0].length-1);let j=1,M=1;while(M<R.length&&j>0){if(R[M]==="{")j++;else if(R[M]==="}"){if(j--,j===0)break}M++}H=R.substring(0,M+1),R=R.slice(M+1)}let b,J=R.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(J)b=J[1];try{let j=JSON.parse(z.replace(/'/g,'"')),M={};if(H)try{M=P(H,e)}catch(L){let ee=L instanceof Error?L.message:String(L);if(n.debug){let ne=h("Include",`Error parsing includeFirst variables: ${ee}`,a,c,x,o);t=t.replace(o,()=>ne)}else t=t.replace(o,()=>b||"");continue}let A=!1;for(let L of j){let ee=W(L,g,a);if(!ee)continue;if(await r(ee)){let ne=await te(L,M,c,x);t=t.replace(o,()=>ne),A=!0;break}}if(!A)if(b!==void 0)t=t.replace(o,()=>b);else if(n.debug){let L=h("Include",`None of the includeFirst paths exist: ${z}`,a,c,x,o);t=t.replace(o,()=>L)}else t=t.replace(o,"")}catch(j){let M=j instanceof Error?j.message:String(j),A=h("Include",`Error processing @includeFirst: ${M}`,a,c,x,o);t=t.replace(o,()=>A)}m.lastIndex=0}}function W(m,k,x){try{let p=m;if(!m.endsWith(".stx"))p=`${m}.stx`;let i=C.resolve(k),w=C.resolve(C.dirname(x)),l;if(!p.startsWith("./")&&!p.startsWith("../")){for(let F of n._layerPartialDirs??[]){let b=C.resolve(F,p);if(b.startsWith(`${C.resolve(F)}${C.sep}`)&&ye(b))return b}l=C.resolve(k,p)}else l=C.resolve(w,p);let o=C.normalize(l),O=o.startsWith(i+C.sep)||o===i,z=o.startsWith(w+C.sep)||o===w,R=!1,H=C.dirname(w);if(o.startsWith(H+C.sep)){if(!C.relative(H,o).split(C.sep).some((j)=>j.startsWith(".")&&j!=="."&&j!==".."))R=!0}if(!O&&!z&&!R)return console.error(`Security: Path traversal attempt blocked for include path: ${m}`),console.error(` Resolved to: ${o}`),console.error(` Allowed dirs: ${i}, ${w}`),null;return o}catch(p){return console.error(`Error resolving path ${m}: ${p}`),null}}let re=C.resolve(a);s.add(re);function N(m,k,x,p){return n.onIncludeError?.({includePath:m,templatePath:a,message:k,partialsDir:g}),h("Include",k,a,x,p)}async function te(m,k={},x,p){let i=W(m,g,a);if(!i)return N(m,`Could not resolve path for include: ${m}`,x,p);let w=C.resolve(i);if(s.has(w)){let l=[...s,w].map((o)=>C.basename(o)).join(" -> ");return N(m,`Circular include detected: ${l}`,x,p)}try{y.add(i);let l;if(!l)try{l=await Bun.file(i).text()}catch(v){let q=v instanceof Error?v.message:String(v);return N(m,`Error loading include file ${m}: ${q}`,x,p)}if(l)l=l.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(l&&l.includes("@stream")){let{processStreamDirectives:v}=await import("./chunk-
|
|
47
|
+
})();`;return a+c+n}function Te(c,e){if(B(c)){let s=B(c).tag.match(/data-stx-scope="([^"]*)"/);if(s)return{html:c,mergedIntoExisting:s[1],stamped:!0,root:"body"};return{html:Ze(c,(g,t)=>`<body${t} data-stx-scope="${e}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let a=Pt(c),n=c.slice(a).match(/^(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(n){let y=n[1]+n[2],s=n[1].slice(1),g=y.match(/data-stx-scope="([^"]*)"/);if(g)return{html:c,mergedIntoExisting:g[1],stamped:!0,root:s};let t=c.slice(0,a),D=n[1],W=n[2];return{html:`${t}${D} data-stx-scope="${e}"${W}${c.slice(a+n[0].length)}`,mergedIntoExisting:null,stamped:!0,root:s}}return{html:c,mergedIntoExisting:null,stamped:!1,root:null}}var Ae=0;function fe(c,e){let a=C.basename(c,".stx").replace(/[^a-zA-Z0-9]/g,"_"),n=e.__stx_scope_seq;return n?`stx_scope_${a}_${++n.n}_${n.key}`:`stx_scope_${a}_${++Ae}`}var le=new Set,de=new Set;function Oh(){le.clear(),de.clear()}var Ce=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Mf(c){let e=(t)=>t.replace(/[^\n]/g," "),a=c.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,e).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,e).replace(/<!--[\s\S]*?-->/g,e).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,e).replace(/\{\{[\s\S]*?\}\}/g,e).replace(/\{!![\s\S]*?!!\}/g,e),n=[],y=0,s=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,g;while((g=s.exec(a))!==null){let t=g[1]==="/",D=g[2],W=g[3]==="/"||Ce.has(D.toLowerCase());if(t){y=Math.max(0,y-1);continue}if(y===0)n.push(D);if(!W)y++}return n}function me(c){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(c)}var Ye=new T(500),lc=new Set;function Nh(){lc.clear()}function De(c){if(c.__onceStore instanceof Set)return c.__onceStore;return lc}async function cs(c,e,a,n,y,s=new Set){let g=n.partialsDir||C.join(C.dirname(a),"partials");if(g&&!C.isAbsolute(g))g=C.resolve(process.cwd(),g);let t=$e(c,"@partial","@include"),D=De(e);t=t.replace(/@once([\s\S]*?)@endonce/g,(m,k,x)=>{let p=k.trim(),i=`${a}:${p}`;if(D.has(i))return"";return D.add(i),k});{let m=/@includeIf\s*\(/g,k;while((k=m.exec(t))!==null){let x=k.index,p=x+k[0].length-1,i=1,w=p+1;while(w<t.length&&i>0){if(t[w]==="(")i++;else if(t[w]===")")i--;w++}if(i!==0)break;let l=t.substring(p+1,w-1),o=l.match(/^\s*['"]([^'"]+)['"]/);if(!o){m.lastIndex=w;continue}let O=o[1],z=W(O,g,a),R="";if(z&&await Bun.file(z).exists())y.add(z),R=`@include(${l})`;t=t.substring(0,x)+R+t.substring(w),m.lastIndex=0}}for(let[m,k]of[["@includeWhen",!1],["@includeUnless",!0]]){let x=new RegExp(`${m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),p;while((p=x.exec(t))!==null){let i=p.index,w=i+p[0].length-1,l=1,o=w+1;while(o<t.length&&l>0){if(t[o]==="(")l++;else if(t[o]===")")l--;o++}if(l!==0)break;let O=t.substring(w+1,o-1),z=ae(O,0);if(z===-1){x.lastIndex=o;continue}let R=O.substring(0,z).trim(),H=O.substring(z+1).trim(),F=H.match(/^\s*['"]([^'"]+)['"]/);if(!F){x.lastIndex=o;continue}let b=F[1],J=H.substring(F[0].length),j,M=ae(J,0);if(M!==-1)j=J.substring(M+1).trim();try{let A=`Boolean(${R})`,L;if(f(A)){let ie=d(A,Object.keys(e));L=Boolean(ie(...Object.values(e)))}else L=Boolean(u(A,e));let ee=k?!L:L,ne="";if(ee){let ie=W(b,g,a);if(ie&&await Bun.file(ie).exists())y.add(ie);ne=`@include('${b}'${j?`, ${j}`:""})`}t=t.substring(0,i)+ne+t.substring(o),x.lastIndex=0}catch(A){let L=A instanceof Error?A.message:String(A),ee=h("Include",`Error evaluating ${m} condition: ${L}`,a,c,i);t=t.substring(0,i)+ee+t.substring(o),x.lastIndex=0}}}{let m=/@each\s*\(/g,k;while((k=m.exec(t))!==null){let x=k.index,p=x+k[0].length-1,i=1,w=p+1;while(w<t.length&&i>0){if(t[w]==="(")i++;else if(t[w]===")"){if(i--,i===0)break}w++}if(i!==0)break;let l=t.substring(p+1,w),o=t.substring(x,w+1),O=l.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!O){m.lastIndex=0,t=t.replace(o,"");continue}let[,z,R,H,F]=O;try{let b,J=R.trim();if(f(J))b=d(J,Object.keys(e))(...Object.values(e));else b=u(J,e);let j="";if(Array.isArray(b)&&b.length>0)for(let M of b){let A={...e,[H]:M},L=await te(z,A,c,x);j+=L}else if(F)j=await te(F,{},c,x);t=t.substring(0,x)+j+t.substring(w+1),m.lastIndex=0}catch(b){let J=b instanceof Error?b.message:String(b);t=t.substring(0,x)+h("Each",`Error in @each: ${J}`,a,c,x)+t.substring(w+1),m.lastIndex=0}}}{let m=/@includeFirst\s*\(/g,k;while((k=m.exec(t))!==null){let x=k.index,p=x+k[0].length-1,i=1,w=p+1;while(w<t.length&&i>0){if(t[w]==="(")i++;else if(t[w]===")"){if(i--,i===0)break}w++}if(i!==0)break;let l=t.substring(p+1,w),o=t.substring(x,w+1),O=l.match(/^\s*(\[[^\]]+\])/);if(!O){m.lastIndex=0,t=t.replace(o,"");continue}let z=O[1],R=l.slice(O[0].length),H,F=R.match(/^\s*,\s*\{/);if(F){R=R.slice(F[0].length-1);let j=1,M=1;while(M<R.length&&j>0){if(R[M]==="{")j++;else if(R[M]==="}"){if(j--,j===0)break}M++}H=R.substring(0,M+1),R=R.slice(M+1)}let b,J=R.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(J)b=J[1];try{let j=JSON.parse(z.replace(/'/g,'"')),M={};if(H)try{M=P(H,e)}catch(L){let ee=L instanceof Error?L.message:String(L);if(n.debug){let ne=h("Include",`Error parsing includeFirst variables: ${ee}`,a,c,x,o);t=t.replace(o,()=>ne)}else t=t.replace(o,()=>b||"");continue}let A=!1;for(let L of j){let ee=W(L,g,a);if(!ee)continue;if(await r(ee)){let ne=await te(L,M,c,x);t=t.replace(o,()=>ne),A=!0;break}}if(!A)if(b!==void 0)t=t.replace(o,()=>b);else if(n.debug){let L=h("Include",`None of the includeFirst paths exist: ${z}`,a,c,x,o);t=t.replace(o,()=>L)}else t=t.replace(o,"")}catch(j){let M=j instanceof Error?j.message:String(j),A=h("Include",`Error processing @includeFirst: ${M}`,a,c,x,o);t=t.replace(o,()=>A)}m.lastIndex=0}}function W(m,k,x){try{let p=m;if(!m.endsWith(".stx"))p=`${m}.stx`;let i=C.resolve(k),w=C.resolve(C.dirname(x)),l;if(!p.startsWith("./")&&!p.startsWith("../")){for(let F of n._layerPartialDirs??[]){let b=C.resolve(F,p);if(b.startsWith(`${C.resolve(F)}${C.sep}`)&&ye(b))return b}l=C.resolve(k,p)}else l=C.resolve(w,p);let o=C.normalize(l),O=o.startsWith(i+C.sep)||o===i,z=o.startsWith(w+C.sep)||o===w,R=!1,H=C.dirname(w);if(o.startsWith(H+C.sep)){if(!C.relative(H,o).split(C.sep).some((j)=>j.startsWith(".")&&j!=="."&&j!==".."))R=!0}if(!O&&!z&&!R)return console.error(`Security: Path traversal attempt blocked for include path: ${m}`),console.error(` Resolved to: ${o}`),console.error(` Allowed dirs: ${i}, ${w}`),null;return o}catch(p){return console.error(`Error resolving path ${m}: ${p}`),null}}let re=C.resolve(a);s.add(re);function N(m,k,x,p){return n.onIncludeError?.({includePath:m,templatePath:a,message:k,partialsDir:g}),h("Include",k,a,x,p)}async function te(m,k={},x,p){let i=W(m,g,a);if(!i)return N(m,`Could not resolve path for include: ${m}`,x,p);let w=C.resolve(i);if(s.has(w)){let l=[...s,w].map((o)=>C.basename(o)).join(" -> ");return N(m,`Circular include detected: ${l}`,x,p)}try{y.add(i);let l;if(!l)try{l=await Bun.file(i).text()}catch(v){let q=v instanceof Error?v.message:String(v);return N(m,`Error loading include file ${m}: ${q}`,x,p)}if(l)l=l.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(l&&l.includes("@stream")){let{processStreamDirectives:v}=await import("./chunk-p2e02hh7.js");l=v(l,e)}if(l&&(n.debug||!E()&&!Tn()))try{let{warnUnbalancedTags:v}=await import("./chunk-yg5a54pj.js");v(l,i)}catch{}try{let{processESImports:v}=await import("./chunk-b3fx75th.js");l=await v(l,e,i,n,y)}catch(v){if(n.debug)console.warn(`[stx] partial ES import extraction skipped for ${i}:`,v instanceof Error?v.message:v)}let o=l,O=pe(o);if(O)o=O.content.trim();let R=l.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),H="";if(R)H=`<style${R[1]}>${R[2]}</style>`;let F=[];o=o.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(v,q,S)=>{if(!me(q))return"";return F.push({attrs:q,body:S}),`__STX_DATA_BLOCK_${F.length-1}__`}),o=o.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let b={...e};b.__stx_signals_gate=ke(l,i);for(let[v,q]of Object.entries(k))b[v]=q;let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,j=[...l.matchAll(J)].sort((v,q)=>{let S=(v[1]||"").includes("server"),X=(q[1]||"").includes("server");return Number(X)-Number(S)}),M="",A=null,L=!1,ee=!1;for(let v of j){let q=v[1]||"",S=v[2]||"";if(me(q))continue;let X=q.includes("server"),be=Be(q);if(!X&&!/\bsrc\s*=/i.test(q))Ne(S,i,n.strict);if(!X&&S.trim()){let{interpolateScriptExpressions:U}=await import("./chunk-8gdtys3s.js");S=U(S,b,m)}let ce="";try{let{extractAndStripCssImports:U,renderVendorStyleTags:Q}=await import("./chunk-x0ygwk9x.js"),se=U(S,{filePath:i,projectRoot:process.cwd()});S=se.code,ce=Q(se.styles)}catch(U){if(n.debug)console.warn(`[stx] vendor-css extractor skipped for ${i}:`,U instanceof Error?U.message:U)}if(be&&S.trim())S=Fe(S);if(!X){try{let{injectBrowserCoreAutoImports:Q}=await import("./chunk-x0ygwk9x.js");S=Q(S).code;let{hasUserImports:se,bundleClientScript:Se}=await import("./chunk-mh4kpnjr.js");if(se(S))S=await Se(S,i,{projectRoot:process.cwd()})}catch(Q){if(n.debug)console.warn(`[stx] bundler skipped for ${i}:`,Q instanceof Error?Q.message:Q)}let{stripStxRuntimeImports:U}=await import("./chunk-qcars8ar.js");S=U(S)}let ge=Ee(S);if(!X){let{extractBridgeData:U,generateServerDataBridge:Q}=await import("./chunk-x0ygwk9x.js"),se=Q(S,U(b));if(se)S=`${se}
|
|
48
48
|
${S}`}if(ge&&!X){L=!0,A=fe(i,e);let U=I(S),Q=ue(U,A);M+=`${ce}<script data-stx-scoped data-stx-run="always" data-stx-owner="${A}">${Q}</script>
|
|
49
|
-
`;continue}if(X)try{let{extractVariables:U}=await import("./chunk-
|
|
50
|
-
`}}if(F.length>0){let{interpolateScriptExpressions:v}=await import("./chunk-
|
|
49
|
+
`;continue}if(X)try{let{extractVariables:U}=await import("./chunk-3gzhh69y.js");await U(S,b,i)}catch(U){if(n.debug)console.warn(`Warning: Could not extract variables from server script in ${i}:`,U)}if(!X&&!ge){let U=q.replace(/\bclient\b/i,"").trim();A=fe(i,e);let Q=I(S),se=ue(Q,A);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=|Object\.defineProperty\(__scopeRegistration, "(?!__stx)/.test(se))ee=!0;M+=`${ce}<script data-stx-scoped data-stx-run="always" data-stx-owner="${A}"${U?` ${U}`:""}>${se}</script>
|
|
50
|
+
`}}if(F.length>0){let{interpolateScriptExpressions:v}=await import("./chunk-8gdtys3s.js");o=o.replace(/__STX_DATA_BLOCK_(\d+)__/g,(q,S)=>{let X=F[Number(S)];return`<script${X.attrs}>${v(X.body,b,m)}</script>`})}if(A){let v=Te(o,A);if(o=v.html,v.mergedIntoExisting){let S=A,X=v.mergedIntoExisting;M=M.split(`'${S}'`).join(`'${X}'`).split(`"${S}"`).join(`"${X}"`),A=X}else if(!v.stamped&&L&&!le.has(i))le.add(i),console.warn(`[stx] ${C.relative(process.cwd(),i)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);if(v.stamped&&v.root!=="body"&&(L||ee)&&!de.has(i)){let S=Mf(o);if(S.length>1)de.add(i),console.warn(`[stx] ${C.relative(process.cwd(),i)} declares ${L?"signals":"bindings"} and has ${S.length} top-level elements (${S.map((X)=>`<${X}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see what this partial's script declares. Wrap the partial's markup in a single root element.`)}let q=v.stamped&&v.root!==null&&Cr(v.root);M=Ie(M,q?A:null)}if(o.includes("@include")||o.includes("@partial"))o=await cs(o,b,i,n,y,s);let{processLoops:ne,reportDeferredLoopWarnings:ie}=await import("./chunk-66eba1h4.js"),G=ne(o,b,i,void 0,!0);G=oe(G,b,i),G=ie(G);let{processMetaDirectives:xe,processSeoDirective:_e,processStructuredData:we}=await import("./chunk-8w0n2rae.js");if(G=xe(G,b,i,n),G=we(G,b,i),G=_e(G,b,i,n),G=_(G,b,i),H)G+=`
|
|
51
51
|
`+H;if(M)G+=`
|
|
52
52
|
`+M;return G}catch(l){if(l instanceof K)throw l;let o=l instanceof Error?l.message:String(l);return N(m,`Error processing include ${m}: ${o}`,x,p)}}let Y=/@include\s*\(/g,Z;while((Z=Y.exec(t))!==null){let m=Z.index,k=m+Z[0].length-1,x=1,p=k+1;while(p<t.length&&x>0){if(t[p]==="(")x++;else if(t[p]===")")x--;p++}if(x!==0)break;let i=t.substring(m,p),w=t.substring(k+1,p-1),l=w.match(/^\s*['"]([^'"]+)['"]/);if(!l){Y.lastIndex=p;continue}let o=l[1],O,z=w.substring(l[0].length),R=ae(z,0);if(R!==-1)O=z.substring(R+1).trim();let H={};if(O)try{H=P(O,e)}catch(b){let J=b instanceof Error?b.message:String(b);t=t.replace(i,h("Include",`Error parsing include variables for ${o}: ${J}`,a,c,m)),Y.lastIndex=0;continue}let F=await te(o,H,c,m);t=t.substring(0,m)+F+t.substring(p),Y.lastIndex=0}return t}function ls(c,e){let a=c;function n(y,s,g,t){let D=y,W=!0;while(W){W=!1;let re=new RegExp(`@${s}\\(['"]([^'"]+)['"]\\)`),N=D.match(re);if(!N||N.index===void 0)break;let te=N.index,Y=N[1],Z=te+N[0].length,m=new RegExp(`@${s}\\(`),k=new RegExp(`@${g}(?![a-z])`),x=1,p=Z,i=-1;while(x>0&&p<D.length){let l=D.slice(p),o=l.match(m),O=l.match(k),z=o?p+o.index:1/0,R=O?p+O.index:1/0;if(z<R)x++,p=z+(o[0].length||1);else if(R<1/0){if(x--,x===0){i=R;break}p=R+g.length+1}else break}if(i===-1)break;let w=D.slice(Z,i);if(!e[Y])e[Y]=[];if(t)e[Y].unshift(w);else e[Y].push(w);D=D.substring(0,te)+D.substring(i+`@${g}`.length),W=!0}return D}return a=n(a,"push","endpush",!1),a=n(a,"prepend","endprepend",!0),a}function us(c,e){return c.replace(/@stack\(['"]([^'"]+)['"]\)/g,(a,n)=>{if(!e[n]||e[n].length===0)return"";return e[n].join(`
|
|
53
53
|
`)})}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{wn,ng,rg,sg,og,ig,m,ag,yi,cg,Xc,Gc}from"./chunk-
|
|
2
|
+
import{wn,ng,rg,sg,og,ig,m,ag,yi,cg,Xc,Gc}from"./chunk-vbw9jhz2.js";import"./chunk-p65ax8s0.js";import"./chunk-8370x30n.js";import"./chunk-89d3h8mp.js";import"./chunk-zjqvbcwa.js";import"./chunk-23r3rby6.js";export{wn as STX_ENGINE_BINDING_NAMES,yi as convertToCommonJS,Xc as extractScriptFromTemplate,m as extractVariables,Gc as hasVariables,ag as isCompleteImport,ig as isMissingBindingFailure,sg as isModuleResolutionFailure,og as isSyntaxFailure,cg as splitDeclaration,ng as stripTypeScript,rg as withoutStxReferrer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Oh,Mf,Ye,lc,Nh,cs,ls,us}from"./chunk-
|
|
2
|
+
import{Oh,Mf,Ye,lc,Nh,cs,ls,us}from"./chunk-2vprq4x0.js";import"./chunk-z9xjhc5m.js";import"./chunk-jgx0ex9p.js";import"./chunk-1b1ntgt7.js";import"./chunk-2fj5zev7.js";import"./chunk-vbw9jhz2.js";import"./chunk-p65ax8s0.js";import"./chunk-8370x30n.js";import"./chunk-89d3h8mp.js";import"./chunk-zjqvbcwa.js";import"./chunk-23r3rby6.js";export{Nh as clearOnceStore,lc as onceStore,Ye as partialsCache,cs as processIncludes,ls as processStackPushDirectives,us as processStackReplacements,Oh as resetUnscopedSignalWarnings,Mf as topLevelElements};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Af,ac,Ah,cc,Pf,If,un,ar,Ph,Of,Nf,Ih,b}from"./chunk-
|
|
2
|
+
import{Af,ac,Ah,cc,Pf,If,un,ar,Ph,Of,Nf,Ih,b}from"./chunk-vwddsdk5.js";import"./chunk-88rwr1w2.js";import"./chunk-vbw9jhz2.js";import"./chunk-p65ax8s0.js";import"./chunk-8370x30n.js";import"./chunk-89d3h8mp.js";import"./chunk-zjqvbcwa.js";import"./chunk-23r3rby6.js";export{un as buildCss,Of as extractClassNames,If as fingerprintConfig,Nf as generateCss,Ph as getCachedCSS,Af as getCssServeAsset,b as injectCss,ac as loadCssEngine,cc as loadCssEngineConfig,ar as rebuildCss,Ah as resetCssCache,Pf as resolveUserCssConfig,Ih as withLinkedModuleBundles};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Bt,ae,A,u,f,P,t,ce,K,l,_e,Ei,z,Cn,Ti,Ht,$i,al,Ar,cl,at,ll,Pr,ul,En,Ri,dl,Ir,Nr,Ce,Ai}from"./chunk-89d3h8mp.js";import{ui,Pc,o,C,Ne,gn,mn,Me,fe,J,xr,hn,zs,zc,Hc,bn,Er,Vs,Us,Vc,hi,Uc,Wc,qc,Kc,Le,je,Ws,ze,r,xn,h,p,W,Q,ke,_}from"./chunk-
|
|
2
|
+
import{Bt,ae,A,u,f,P,t,ce,K,l,_e,Ei,z,Cn,Ti,Ht,$i,al,Ar,cl,at,ll,Pr,ul,En,Ri,dl,Ir,Nr,Ce,Ai}from"./chunk-89d3h8mp.js";import{ui,Pc,o,C,Ne,gn,mn,Me,fe,J,xr,hn,zs,zc,Hc,bn,Er,Vs,Us,Vc,hi,Uc,Wc,qc,Kc,Le,je,Ws,ze,r,xn,h,p,W,Q,ke,_}from"./chunk-vbw9jhz2.js";import{jt}from"./chunk-8370x30n.js";import{kn}from"./chunk-p65ax8s0.js";import{b}from"./chunk-vwddsdk5.js";import{hr,Is}from"./chunk-2j5yane9.js";import{mc,hc,fr,et,yc,O}from"./chunk-chjdnmqv.js";import{ti,ni,ri,si}from"./chunk-zg44cf8a.js";import{uc,ps}from"./chunk-z9xjhc5m.js";import{cs,ls,us}from"./chunk-2vprq4x0.js";import{hs,Ko,Xo,ys,bs,Go}from"./chunk-8d4br2j5.js";import{gs,Ho}from"./chunk-b90xw7v4.js";import{jo}from"./chunk-4dxq7ft1.js";import{oe,Vo,Uo,Wo}from"./chunk-1b1ntgt7.js";import{lr,we,pc,ur,fc}from"./chunk-xqtt5t6d.js";import{B,Ze}from"./chunk-ybq56wam.js";import{bc,wc}from"./chunk-ns0171xk.js";import{E,Tn,Pi}from"./chunk-7vhm0jj5.js";import Kn from"fs";import ie from"path";function dt(s){let e=gn(s),c=e.find((x)=>x.closing&&x.name.toLowerCase()==="head");if(!c)return s;let a=new Set(["template","svg","noscript","math","textarea","title","xmp","iframe","noembed","noframes","plaintext"]),g=0,n=[];for(let x=0;x<e.length;x++){let w=e[x];if(w.start<c.end)continue;let v=w.name.toLowerCase();if(a.has(v)){g=Math.max(0,g+(w.closing?-1:w.selfClosing?0:1));continue}if(v!=="style"||w.closing||g>0)continue;let k=e[x+1];if(k?.name.toLowerCase()==="style"&&k.closing){if(/@scope\s*\{/.test(s.slice(w.end,k.start)))continue;n.push({start:w.start,end:k.end}),x++}}if(!n.length)return s;let d=n.map((x)=>s.slice(x.start,x.end)).join(`
|
|
3
3
|
`),y=[s.slice(0,c.start),d,`
|
|
4
4
|
`],m=c.start;for(let x of n)y.push(s.slice(m,x.start)),m=x.end;return y.push(s.slice(m)),y.join("")}function pt(){return`
|
|
5
5
|
// STX Lifecycle Runtime
|
|
@@ -1295,7 +1295,7 @@ ${R}
|
|
|
1295
1295
|
</style>`;a=a.replace(x,D),y.lastIndex=0}catch(R){}}}return a}import it from"path";var Wn=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,Xn=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function zn(s,e){if(!e||!s.includes("/"))return s;let c=it.dirname(e);return s.replace(Wn,(a,g,n,d)=>{let y=it.resolve(c,d);return`${g}${n}${y.split(it.sep).join("/")}${n}`})}function cr(s,e){if(!e||!s.includes("<script"))return s;return s.replace(Xn,(c,a,g,n)=>`${a}${zn(g,e)}${n}`)}var Ee="<!--PARENT_CONTENT_PLACEHOLDER-->";function dr(s){return s.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function vr(s,e){let c=s.length,a=e,g=!0,n=[],d=(y)=>y+9<=c&&s[y]==="<"&&s[y+1]==="/"&&(s[y+2]==="s"||s[y+2]==="S")&&(s[y+3]==="c"||s[y+3]==="C")&&(s[y+4]==="r"||s[y+4]==="R")&&(s[y+5]==="i"||s[y+5]==="I")&&(s[y+6]==="p"||s[y+6]==="P")&&(s[y+7]==="t"||s[y+7]==="T")&&(s[y+8]===">"||/\s/.test(s[y+8]));while(a<c){let y=s[a];if(d(a))return a;if(y==="/"&&s[a+1]==="/"){if(a=s.indexOf(`
|
|
1296
1296
|
`,a+2),a===-1)return-1;a+=1,g=!0;continue}if(y==="/"&&s[a+1]==="*"){let m=s.indexOf("*/",a+2);if(m===-1)return-1;a=m+2,g=!0;continue}if(y==="/"&&g){let m=a+1,x=!1;while(m<c){let w=s[m];if(w==="\\"){m+=2;continue}if(w==="[")x=!0;else if(w==="]")x=!1;else if(w==="/"&&!x){m++;break}else if(w===`
|
|
1297
1297
|
`){m=-1;break}m++}if(m===-1){a++,g=!1;continue}while(m<c&&/[a-z]/.test(s[m]))m++;a=m,g=!1;continue}if(y==="'"||y==='"'){let m=y;a++;while(a<c){if(s[a]==="\\"){a+=2;continue}if(s[a]===m){a++;break}if(s[a]===`
|
|
1298
|
-
`)break;a++}g=!1;continue}if(y==="`"){a++;while(a<c){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,g=!0;break}a++}if(n.length===0)g=!1;continue}if(y==="}"&&n.length>0){n.pop(),a++;while(a<c){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++,g=!1;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,g=!0;break}a++}continue}if(/\s/.test(y));else if(/[)\].\w$]/.test(y))g=!1;else g=!0;a++}return-1}function kr(s,e){let c=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${c}(?:\\s|=|/?>))[^>]*>`,"i").exec(s);if(!a)return null;let g=a.index+a[0].length,n=s.indexOf("</script>",g);if(n===-1)return null;let d=s.indexOf(">",n);if(d===-1)return null;return{start:a.index,end:d+1}}var Gn=4096;async function ot(s,e,c){if(c.buildMode!=="serve"||e.length<Gn)return null;let{registerServeModuleBundle:a}=await import("./chunk-
|
|
1298
|
+
`)break;a++}g=!1;continue}if(y==="`"){a++;while(a<c){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,g=!0;break}a++}if(n.length===0)g=!1;continue}if(y==="}"&&n.length>0){n.pop(),a++;while(a<c){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++,g=!1;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,g=!0;break}a++}continue}if(/\s/.test(y));else if(/[)\].\w$]/.test(y))g=!1;else g=!0;a++}return-1}function kr(s,e){let c=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${c}(?:\\s|=|/?>))[^>]*>`,"i").exec(s);if(!a)return null;let g=a.index+a[0].length,n=s.indexOf("</script>",g);if(n===-1)return null;let d=s.indexOf(">",n);if(d===-1)return null;return{start:a.index,end:d+1}}var Gn=4096;async function ot(s,e,c){if(c.buildMode!=="serve"||e.length<Gn)return null;let{registerServeModuleBundle:a}=await import("./chunk-ywpan1k5.js");return`<script ${s} src="${a(e)}"></script>`}async function sr(s,e,c,a){try{let{registeredModuleIdsIn:g,buildModuleRegistryScript:n}=await o("stx/client-module-registry",()=>import("./chunk-znwc8gta.js")),d=[],y=await n(g(...s),{minify:Pi(e.buildMode,e.minifyClient),collectInputs:d});for(let m of d)c?.add(m);if(a)a.inputs=d,a.code=y??void 0;if(!y)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:m}=await import("./chunk-ywpan1k5.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${m(y)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${y.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}async function Zn(s,e,c,a){let g={modulesTag:null,modulesCode:null,storeTag:null,storeCode:null,composableTag:null,composableCode:null,frameworkScript:null};try{let{getFrameworkComposableScript:k}=await o("stx/framework-composables",()=>import("./chunk-5pbxjx8s.js"));g.frameworkScript=await k(s)}catch{}let n=null;try{n=await o("stx/store-loader",()=>import("./chunk-03v59965.js"))}catch{}let d=e.storesDir,y=!!a.__stx_native_screen||(n?.pageStoresAll()??!0),m=y?"":s.replace(/<script\b[^>]*\bdata-stx-(?:runtime|router|hmr)\b[^>]*>[\s\S]*?<\/script>/gi,""),x=[],w=[],v=null;for(let k=0;k<8;k++){let S=null,M="",T=!1;try{if(n){let N=y?await n.getStoreScript(d).then((F)=>F?{code:F,stores:["*"],functions:null}:null):await n.getStoreScriptFor(d,[m],{reads:n.storesReadInFiles([...x,...w]),runOnce:!0});if(N)S=N.code,M=N.stores.join(","),T=!!N.functions&&!y}}catch{}if(v!==null&&M===v)break;v=M;let R=T?'data-stx-scoped data-stx-run="always" data-stx-stores':"data-stx-stores",D=S?`<script ${R}>${S}</script>`:null;g.storeCode=S,g.storeTag=S?await ot(R,S,e)??D:null;let j={};g.modulesTag=await sr([s,D],e,c,j),g.modulesCode=j.code??null,x=j.inputs??[],g.composableTag=null,g.composableCode=null,w=[];try{let{getComposableScript:N}=await o("stx/composable-loader",()=>import("./chunk-a2p42cxf.js")),F=e.composablesDir,I=[g.modulesCode??g.modulesTag,D,g.frameworkScript].filter((H)=>H!==null),L=await N(e._layerComposableDirs??F,s,I,w);if(L)g.composableCode=L,g.composableTag=await ot('data-stx-scoped data-stx-run="always" data-stx-composables',L,e)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${L}</script>`}catch{}if(y||!n)break}return g}async function Jn(s,e,c,a={}){let{withModuleSubstitutes:g,moduleSubstitutionKey:n}=await import("./chunk-mh4kpnjr.js"),d=await import("./chunk-sv2d6nfe.js"),{messages:y,webModules:m}=e,x=null,w=null,v=n()===""&&!a.__stx_native_screen;if(y&&d.pageMessagesEnabled(e)&&v)try{x=await d.loadPageMessages(process.cwd(),y)}catch(R){Qn(R)}if(m&&Object.keys(m).length&&v)try{w=await(await import("./chunk-97k72dfh.js")).loadWebModules(process.cwd(),m)}catch(R){Yn(R)}let k=new Map([...w??[],...x?.stubs??[]]),S=()=>Zn(s,e,c,a),M=k.size?await g(k,S):await S(),T=null;if(x){let R=d.messageAreasIn(M.modulesCode,M.storeCode,M.composableCode),D=d.pageMessagesScript(x,d.pageLanguages(s,x),R);if(D)T=await ot('data-stx-scoped data-stx-run="always" data-stx-messages',D,e)??`<script data-stx-scoped data-stx-run="always" data-stx-messages>${D.replace(/<\/script/gi,"<\\/script")}</script>`}return[T,M.modulesTag,M.storeTag,M.composableTag,M.frameworkScript].filter((R)=>R!==null)}var pr=!1;function Qn(s){if(pr)return;pr=!0,console.warn(`[stx] messages: ${s instanceof Error?s.message:String(s)}; pages ship every language`)}var gr=!1;function Yn(s){if(gr)return;gr=!0,console.warn(`[stx] ${s instanceof Error?s.message:String(s)}; pages bundle the real modules`)}function es(s,e=""){let c=kr(s,"data-stx-runtime");if(!c)return s;let a=lr(s);if(a===-1||a===c.start){if(!e)return s;return s.slice(0,c.end)+e+s.slice(c.end)}if(a<c.start)return s.slice(0,a)+s.slice(c.start,c.end)+e+`
|
|
1299
1299
|
`+s.slice(a,c.start)+s.slice(c.end);let g=s.slice(c.start,c.end),n=s.slice(0,c.start)+s.slice(c.end),d=lr(n);if(d===-1)return g+e+`
|
|
1300
1300
|
`+n;return n.slice(0,d)+g+e+`
|
|
1301
1301
|
`+n.slice(d)}function ts(s){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return s.replace(e,(c,a,g)=>{let n=s.slice(0,g);return n.lastIndexOf("<")>n.lastIndexOf(">")?`{{${a}}}`:`{<!--stx-literal-->{${a}}}`})}async function i(s,e,c,a,g){if(await A(),a.ssr===!1&&!a.autoShell&&a.buildMode==="spa")return s;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=ke(s,c);let n=!e.__stxProcessingDepth;bn(e);for(let d of a._layerGraph?.configDependencies??[])g.add(d);if(n&&a.runtimeConfig)await kn(e,c,a.runtimeConfig);if(n)qc(e),e.__stx_scope_seq??={n:0,key:Ws(String(e.__filename??c))},e.__stx_head_injections=$i(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((a.debug||!E()&&!Tn())&&c&&c.endsWith(".stx"))jo(s,c);try{return await ae.timeAsync("template-processing",async()=>{let d=await rs(s,e,c,a,g);if(n)d=hi(d);if(n&&a.autoShell&&a.buildMode!=="compile"){let y=Ce(a.app?.head,{known:Nr,source:"app.head"}),x=(e.__stx_runtime_head||null)??Ai(),w=(e.__stx_head_raw||"").trim(),v,k=w.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(k)v=k[1].trim(),w=w.replace(k[0],"").trim();let S=e.__sections?.title,M=S?_(S,e,c):void 0,T=x.title||v||M,R=!x.title&&(!!v||!!M),D=x.meta||[],j=new Set(D.map((V)=>at(V)).filter(Boolean)),N={...y,...T&&{title:T},meta:[...(y.meta||[]).filter((V)=>!j.has(at(V))),...D],link:[...y.link||[],...x.link||[]],script:[...y.script||[],...x.script||[]],headRaw:[y.headRaw,w].filter(Boolean).join(`
|
|
@@ -1310,7 +1310,7 @@ ${m.trim()}
|
|
|
1310
1310
|
@endsection`}}if(D&&m.includes("<script")){let I=J(m),L=I.scripts.map((H)=>mr(H,c)??H);m=xr(I.output,L)}if(m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(I,L,H)=>(R[L]=H,"")),m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(I,L,H)=>{if(/^(['"]).*\1$/.test(H.trim()))return I;try{let V=u(H.trim(),e);if(V===void 0)return I;let ee=(e.__stx_inline_section_values??=[]).push(V)-1;return R[L]=`{{ __stx_inline_section_values[${ee}] }}`,""}catch{return I}}),m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(I,L,H)=>{if(H.includes("@parent"))R[L]=H.replace("@parent",Ee);else R[L]=H.trim();return""}),e.__sections=R,m=m.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(I,L,H)=>R[L]||H||""),!("slot"in e)||e.slot===void 0)m=m.replace(/\{\{\s*slot\s*\}\}/g,()=>R.content||"");if(m=us(m,T),D){let I=[],L=J(m),H=fe(L.output,mn,(V,X)=>`\x00STX_ORPHAN_STYLE_${X}\x00`);if(m=H.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(V,X,ee)=>{let te=X==="SCRIPT"?mr(L.scripts[Number(ee)],c):H.tokens[Number(ee)];if(te)I.push(te);return""}),I.length>0){let V=I.join(`
|
|
1311
1311
|
`);R.content=R.content?`${R.content}
|
|
1312
1312
|
${V}`:V,e.__sections=R}}if(D)try{let I;if(ie.isAbsolute(D))I=D,g.add(D);else I=await _e(()=>xn(D,c,d,g),null,()=>{throw new ce(`Failed to resolve layout path: ${D}`,c,void 0,void 0,`Layout referenced from ${c}`)});if(!I){let te=(G)=>{if(!G)return[];try{let me=ie.isAbsolute(G)?G:ie.resolve(process.cwd(),G);return Kn.readdirSync(me).filter((ve)=>ve.endsWith(".stx")).map((ve)=>ve.replace(/\.stx$/,""))}catch{return[]}},re=[...te(d.layoutsDir),...te(d.fallbackLayoutsDir)].filter((G,me,ve)=>ve.indexOf(G)===me).sort(),le=[d.layoutsDir,d.fallbackLayoutsDir].filter((G)=>typeof G==="string"&&G.length>0),de=le.length>0?` Searched: ${le.join(", ")} (set \`layoutsDir\` to look elsewhere).`:"",se=`Layout not found: ${D} (referenced from ${c})`+(re.length>0?`. Available layouts: ${re.join(", ")}`:d.layoutsDir?`. No .stx layouts found in ${d.layoutsDir}`:"")+de;if(z.log(Error(se),{layoutPath:D,filePath:c,available:re},"error"),console.error(`[stx] ${se}`),d.debug)throw new ce(se,c);return m}let L=await _e(()=>Bun.file(I).text(),"",()=>{throw new ce(`Failed to read layout file: ${I}`,c,void 0,void 0,"Layout content could not be loaded")});L=cr(L,I);let H=L.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(H){if(d.debug)console.log(`Found nested layout: ${H[1]} in ${I}`);let te={},re=L.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(se,G,me)=>(te[G]=me.trim(),""));for(let[se,G]of Object.entries(te))if(R[se]&&R[se].includes(Ee)){let me=R[se].indexOf(Ee);R[se]=R[se].slice(0,me)+G+R[se].slice(me+Ee.length)}else if(!R[se])R[se]=G;let le={...e,__sections:R},de=`@layout('${H[1]}')${re}`;return await i(de,le,I,d,g)}let V=L.replace(/\{\{--[\s\S]*?--\}\}/g,""),X=ls(V,T),ee={};return X=X.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(te,re,le)=>(ee[re]=le.trim(),`@slot('${re}')`)),X=X.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(te,re,le)=>{if(R[re]){let de=R[re];if(de.includes(Ee)){let se=ee[re]||"",G=de.indexOf(Ee);de=de.slice(0,G)+se+de.slice(G+Ee.length)}return de}return le||""}),X=ns(X,R),X=X.replace(/\{\{\s*slot\s*\}\}/g,()=>R.content||""),X=us(X,T),e.__originalFilePath=c,m=await wr(X,e,I,d,g),m=`<!-- stx-layout: ${D} -->
|
|
1313
|
-
${m}`,v(m)}catch(I){if(I instanceof K)throw I;throw new ce(`Error processing layout ${D}: ${I instanceof Error?I.message:String(I)}`,c)}return v(await wr(m,e,c,d,g))}function ns(s,e){return s.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(c,a,g)=>{let n=e[a];if(n!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(n))return n}return g||""})}function ss(s,e){if(s.__stx_sfc_mode=!0,s.__stx_options=e,e.buildMode)s.__stx_buildMode=e.buildMode;let c=e.envPrefix||"STX_PUBLIC_",a={};for(let[g,n]of Object.entries(process.env))if(g.startsWith(c)&&n!==void 0)a[g]=n;s.$env=a}async function is(s,e){await _e(()=>Kt(s,e),void 0,(c)=>{z.log(c,{filePath:s,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${s}: ${c.message}`)})}var ct="data-stx-source";function mr(s,e){if(!s)return s;let c=/^<script\b([^>]*)>/i.exec(s);if(!c||!/\bserver\b/.test(c[1])||c[1].includes(ct))return s;return`<script ${ct}="${encodeURIComponent(e)}"${s.slice(7)}`}function os(s){let e=new RegExp(`${ct}="([^"]*)"`).exec(s);return e?decodeURIComponent(e[1]):void 0}function yr(s){return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function br(s,e,c){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a <script server> ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${yr(s)}</span><span style="display:block;margin-top:4px">${yr(c)}</span></div>`}async function ds(s,e,c,a){let{scanScriptTags:g}=await o("stx/signal-processing",()=>import("./chunk-
|
|
1313
|
+
${m}`,v(m)}catch(I){if(I instanceof K)throw I;throw new ce(`Error processing layout ${D}: ${I instanceof Error?I.message:String(I)}`,c)}return v(await wr(m,e,c,d,g))}function ns(s,e){return s.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(c,a,g)=>{let n=e[a];if(n!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(n))return n}return g||""})}function ss(s,e){if(s.__stx_sfc_mode=!0,s.__stx_options=e,e.buildMode)s.__stx_buildMode=e.buildMode;let c=e.envPrefix||"STX_PUBLIC_",a={};for(let[g,n]of Object.entries(process.env))if(g.startsWith(c)&&n!==void 0)a[g]=n;s.$env=a}async function is(s,e){await _e(()=>Kt(s,e),void 0,(c)=>{z.log(c,{filePath:s,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${s}: ${c.message}`)})}var ct="data-stx-source";function mr(s,e){if(!s)return s;let c=/^<script\b([^>]*)>/i.exec(s);if(!c||!/\bserver\b/.test(c[1])||c[1].includes(ct))return s;return`<script ${ct}="${encodeURIComponent(e)}"${s.slice(7)}`}function os(s){let e=new RegExp(`${ct}="([^"]*)"`).exec(s);return e?decodeURIComponent(e[1]):void 0}function yr(s){return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function br(s,e,c){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a <script server> ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${yr(s)}</span><span style="display:block;margin-top:4px">${yr(c)}</span></div>`}async function ds(s,e,c,a){let{scanScriptTags:g}=await o("stx/signal-processing",()=>import("./chunk-qcars8ar.js")),n=[],d=!E()&&!Tn();for(let m of g(s)){let x=m.attrs;if(!/\bserver\b/.test(x))continue;let w=m.start+m.fullMatch.indexOf(">")+1,v=vr(s,w);if(v===-1)continue;let k=s.slice(w,v);if(!k.trim())continue;let S=os(x)??c,M={index:m.start,length:v+9-m.start};try{let{extractVariables:T}=await o("stx/variable-extractor",()=>import("./chunk-3gzhh69y.js"));await T(k,e,S,{preserveExisting:!0,onFailure:(R)=>{if(R.kind==="unknown")return;if(a?.onServerScriptError?.({sourcePath:S,kind:R.kind,message:R.message}),!d)return;n.push({...M,markup:br(S,R.kind,R.message)})}})}catch(T){let R=T instanceof Error?T:Error(String(T));if(z.log(R,{filePath:S,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${S}: ${R.message}`),d)n.push({...M,markup:br(S,"unknown",R.message)})}}if(n.length===0)return s;let y=s;for(let m of n.sort((x,w)=>w.index-x.index))y=y.slice(0,m.index)+m.markup+y.slice(m.index+m.length);return y}async function fs(s,e,c){try{let{interpolateScriptsInTemplate:a}=await o("stx/expressions",()=>import("./chunk-8gdtys3s.js"));return a(s,e,{skipServer:!0})}catch(a){let g=a instanceof Error?a:Error(String(a));return z.log(g,{filePath:c,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${c}: ${g.message}`),s}}async function wr(s,e,c,a,g){let n=s;await A();let d=a;if(n=await ds(n,e,c,a),n=await Nt(n,e,c),n=await Ft(n,e,c),n=await fs(n,e,c),await A(),n=await Ct(n,e,c,d),ke(n))n=Ko(n,e),n=bs(n,e),n=ys(n,e);n=Xo(n),await A();let{processStreamDirectives:y}=await o("stx/streaming",()=>import("./chunk-p2e02hh7.js"));n=y(n,e),n=await Ho(n,e,c,d,!0),await A(),n=await er(n,e,c,d,g),n=await ps(n,e,c,d,g),await A(),n=mc(n,e,c,d);let{processDeferDirectives:m}=await o("stx/defer",()=>import("./chunk-d5vr9g4b.js"));n=m(n,e,c);let{processTeleportDirectives:x}=await o("stx/teleport",()=>import("./chunk-r5bhgyes.js"));n=x(n,e,c);let{processTransitionDirectives:w,processTransitionAttributes:v}=await o("stx/transitions",()=>import("./chunk-y64qhgv1.js"));n=w(n,e,c),n=v(n);let{processErrorBoundaryDirectives:k,stripRenderFailedMarkers:S}=await o("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));n=k(n,e,c),n=S(n);let{processSuspenseDirectives:M}=await o("stx/suspense",()=>import("./chunk-d44g9sek.js"));n=M(n,e,c);let{processAsyncDirectives:T}=await o("stx/async-components",()=>import("./chunk-41sh9y5w.js"));n=T(n,e,c);let{processKeepAliveDirectives:R}=await o("stx/keep-alive",()=>import("./chunk-gaxx0z19.js"));n=R(n,e,c);let{processVirtualListDirectives:D,processVirtualGridDirectives:j,processInfiniteListDirectives:N}=await o("stx/virtual-scrolling",()=>import("./chunk-yjskeqaj.js"));n=D(n,e,c),n=j(n,e,c),n=N(n,e,c),await A();let{processPartialHydrationDirectives:F,processStaticDirectives:I}=await o("stx/partial-hydration",()=>import("./chunk-h8h79939.js"));n=F(n,e,c),n=I(n);let{processComputedDirectives:L,processWatchDirectives:H}=await o("stx/computed",()=>import("./chunk-1xdzcy9d.js"));n=L(n,e,c),n=H(n,e,c);let{processFormValidationDirectives:V}=await o("stx/forms-validation",()=>import("./chunk-ga8waz0a.js"));n=V(n,e,c);let{processHeadDirective:X,processTitleDirective:ee,processMetaDirective:te,resetHead:re}=await o("stx/head",()=>import("./chunk-ksc83y9t.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)re();let le=X(n);if(n=le.content,le.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${le.headContent}
|
|
1314
1314
|
`;if(n=ee(n,e),n=te(n,e,c),n=zt(n),n=Vo(n,e),n=_t(n),n=qt(n),n=await cs(n,e,c,d,g),n=await ps(n,e,c,d,g),await A(),n=n.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),n=hi(n),n=oe(n,e,c),n=gs(n),await A(),e.__stxProcessingDepth===1)n=Kc(n,e);if(n=zc(n,e,{filePath:c,buildMode:d.buildMode}),n=Uo(n,e),n=Wo(n,e),n=We(n,e),n=Lt(n,e),n=Pt(n,e),n=await wt(n,e,c,d),n=await yc(n,e,c),n=await bc(n,e,c,d),await A(),n=wc(n,e,c,d),n=ti(n,e,c,d),n=ni(n,e,c),n=ri(n,e,c,d),n=Et(n,e,c,d),n=Vs(n,e),n=Us(n),n=Vc(n),!d.skipEventDirectives)n=Pc(n,e,c);if(n=Hc(n,e,c,a.skipSignalsRuntime===!0&&Number(e.__stxProcessingDepth)>0),await A(),d.debug){let U=/\bx-data\s*=/.test(n),q=hs(s);if(U&&q)console.warn(`[stx] ${c}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
1315
1315
|
Both work on the same page, but they manage separate scopes.
|
|
1316
1316
|
Prefer signals (state/derived/effect) for new components.`)}n=uc(n,e),n=await _(n,e,c),await A(),n=Uc(n),n=Wc(n),n=mt(n);let{processXElementDirectives:de}=await o("stx/x-element",()=>import("./chunk-zhxdpzga.js"));n=de(n);let se=e.__originalFilePath||c,G=Le(e);if(n=await Go(n,d,se,G),await A(),n=Dt(n,e),n=await Xt(n,e,c,d),await A(),d.media?.image?.autoSiblings){let U=d.publicDir||"public",{rewriteImagesWithSiblings:q}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-rzfbffnv.js"));n=await q(n,{publicDir:U})}if(d.seo?.enabled)n=si(n,e,d);let me=(U,q,Z=!0)=>{if(!q)return U;let he=q.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),ne=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(U),pe=ne?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(ne[0]):null;if(he&&ne&&pe){if(Z){let Te=ne.index+pe.index;U=U.slice(0,Te)+he[0]+U.slice(Te+pe[0].length)}if(q=q.replace(he[0],"").trim(),!q)return U}if(/<\/head>/i.test(U))return U.replace(/<\/head>/i,`${q}
|
|
@@ -1324,6 +1324,6 @@ ${pt()}
|
|
|
1324
1324
|
`+Te}else n=n.replace("</head>",`${q}
|
|
1325
1325
|
</head>`)}else if(n.includes("<body"))n=n.replace(/<body([^>]*)>/,`<body$1>
|
|
1326
1326
|
${q}`);else n=q+`
|
|
1327
|
-
`+n}{let{scanScriptTags:U}=await o("stx/signal-processing",()=>import("./chunk-
|
|
1327
|
+
`+n}{let{scanScriptTags:U}=await o("stx/signal-processing",()=>import("./chunk-qcars8ar.js")),q=[];for(let Z of U(n)){if(!/\bserver\b/i.test(Z.attrs))continue;let he=Z.start+Z.fullMatch.indexOf(">")+1,ne=vr(n,he);if(ne===-1)continue;let pe=ne+9;while(pe<n.length&&/\s/.test(n[pe]))pe++;q.push({start:Z.start,end:pe})}if(q.length>0){let Z=Array(q.length+1),he=0;for(let ne=0;ne<q.length;ne++){let{start:pe,end:Te}=q[ne];Z[ne]=n.slice(he,pe),he=Te}Z[q.length]=n.slice(he),n=Z.join("")}}let lt=zs(n,c);if(lt.hasScoped)n=lt.html;let Cr=e.__stx_event_bindings||[],Ke=!1,ut=[],Rr=/\s:[a-z][\w.-]*\s*=/.test(n),{scanScriptTags:Mr}=await o("stx/signal-processing",()=>import("./chunk-qcars8ar.js"));for(let U of Mr(n,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))ut.push({match:U.fullMatch,attrs:U.attrs,content:U.body});for(let{match:U,attrs:q,content:Z}of ut){Ke=!0;let he=Z;Ne(Z,c,a.strict,e.__originalFilePath);let ne=await je(Z,{eventBindings:Cr,attrs:q,hasColonDirectives:Rr,templateContent:s,filePath:c,projectRoot:process.cwd(),production:Pi(a.buildMode,a.minifyClient),serverData:G});n=n.replace(U,()=>ne)}if(Ke)e.__stx_event_bindings=[];if(!Ke&&e.__stxProcessingDepth===1){let U=e.__stx_event_bindings||[];if(U.length>0){let q=ui(U);if(q){let Z=n.lastIndexOf("</body>");n=Z===-1?n+q:n.slice(0,Z)+q+`
|
|
1328
1328
|
`+n.slice(Z)}e.__stx_event_bindings=[]}}if(!d.skipSignalsRuntime&&!we(n)&&pc(n))n=await ur(n,d);if(n=fc(n),d.csp?.enabled&&d.csp.useNonce&&typeof e.cspNonce==="string")n=$t(n,e.cspNonce);return n}
|
|
1329
1329
|
export{bt,Ae,ic,as,Do,Lo,sr,i};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Zg}from"./chunk-6n5kew7a.js";import"./chunk-7dnp8evg.js";import"./chunk-xdzy4pm0.js";import"./chunk-qzms4d8s.js";import"./chunk-jgx0ex9p.js";import"./chunk-xqtt5t6d.js";import"./chunk-chjdnmqv.js";import"./chunk-ns0171xk.js";import"./chunk-11y84h2d.js";import"./chunk-4657mnht.js";import"./chunk-zg44cf8a.js";import"./chunk-2j5yane9.js";import"./chunk-vbw9jhz2.js";import"./chunk-p65ax8s0.js";import"./chunk-8370x30n.js";import"./chunk-89d3h8mp.js";import"./chunk-zjqvbcwa.js";import"./chunk-23r3rby6.js";export{Zg as startProductionServer};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-23r3rby6.js";import"./chunk-zjqvbcwa.js";import"./chunk-89d3h8mp.js";import{w,S,C,Z}from"./chunk-
|
|
2
|
+
import"./chunk-23r3rby6.js";import"./chunk-zjqvbcwa.js";import"./chunk-89d3h8mp.js";import{w,S,C,Z}from"./chunk-vbw9jhz2.js";import"./chunk-8370x30n.js";import"./chunk-p65ax8s0.js";import f from"path";var b=["applyOfflineUpdate","broadcast","cacheMedia","calculateDistance","canNotify","clearCookies","clearFetchCache","clearOfflineData","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","onOfflineUpdateReady","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAmbientSound","useAnimationFrame","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBreathPacer","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useCompletion","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useOutbox","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVirtualList","useVisibility","useWakeLock","useWindowSize"],L=new Set(b);var l=new Map,h=w(64),x=new Set,k=0,R=new Set(b);function T(){l.clear(),h.clear()}function P(n){let o=new Map;for(let r of n){let a=f.basename(r);if(a.endsWith(".d.ts"))continue;let t=a.replace(/\.[jt]s$/,"");if(t==="index")continue;if(t===a)continue;let i=o.get(t);if(i&&!i.endsWith(".js"))continue;o.set(t,r)}return[...o.values()].sort()}function I(n,o){let r=o.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${r}\\b`).test(n)}function M(n){if(!n)return[];let o=S(n,k),r=h.get(o);if(r)return r.slice();let a=n.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),t=[];for(let i of R){if(x.has(i))continue;let u=i.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${u}\\s*\\(`).test(a))t.push(i)}return t.sort(),h.set(o,t),t.slice()}async function A(n,o){let r=M(n);if(r.length===0)return null;let a=o??f.join(import.meta.dir,"composables"),t=`${a}\x00${r.join(",")}`,i=l.get(t);if(i!==void 0)return i||null;let u=Z({loader:"ts",target:"browser",define:C()}),O=new Set(r),m=[],d=new Set,p=[];try{let s=new Bun.Glob("*.{ts,js}");for await(let e of s.scan({cwd:a,absolute:!0}))p.push(e)}catch{return l.set(t,""),null}p=P(p);for(let s of p){let e;try{e=await Bun.file(s).text()}catch{continue}let g=[];try{g=u.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!g.some((c)=>O.has(c)))continue;try{e=e.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^import\s+type\s+.*$/gm,""),e=e.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),e=e.replace(/^export\s+default\s+/gm,""),e=e.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),m.push(`// ${f.basename(s).replace(/\.[jt]s$/,"")}
|
|
3
3
|
${u.transformSync(e).trim()}`);for(let c of g)d.add(c)}catch(c){console.warn(`[stx] framework composable ${f.basename(s)} could not be bundled:`,c)}}let y=r.filter((s)=>!d.has(s)&&!I(n,s));if(y.length>0)console.warn(`[stx] could not bundle ${y.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(m.length===0)return l.set(t,""),null;let E=[...d].map((s)=>` try { if (!(${JSON.stringify(s)} in __s)) { __s[${JSON.stringify(s)}] = ${s}; if (!(${JSON.stringify(s)} in window)) window[${JSON.stringify(s)}] = ${s}; } } catch (e) {}`).join(`
|
|
4
4
|
`),v=`<script data-stx-scoped data-stx-run="always" data-stx-framework-composables>
|
|
5
5
|
;(function(){
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{gs,Lf,Ho,jf}from"./chunk-
|
|
2
|
+
import{gs,Lf,Ho,jf}from"./chunk-b90xw7v4.js";import"./chunk-1b1ntgt7.js";import"./chunk-8d4br2j5.js";import"./chunk-xqtt5t6d.js";import"./chunk-2fj5zev7.js";import"./chunk-chjdnmqv.js";import"./chunk-ns0171xk.js";import"./chunk-11y84h2d.js";import"./chunk-4657mnht.js";import"./chunk-zg44cf8a.js";import"./chunk-2j5yane9.js";import{It}from"./chunk-vbw9jhz2.js";import"./chunk-p65ax8s0.js";import"./chunk-8370x30n.js";import"./chunk-89d3h8mp.js";import"./chunk-zjqvbcwa.js";import"./chunk-23r3rby6.js";export{jf as declareBareLoopHead,It as parseLoopBinding,Lf as processLoops,Ho as processLoopsAsync,gs as reportDeferredLoopWarnings};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Yg}from"./chunk-
|
|
2
|
+
import{Yg}from"./chunk-rb17ssxh.js";import"./chunk-chjdnmqv.js";import"./chunk-ns0171xk.js";import"./chunk-11y84h2d.js";import"./chunk-4657mnht.js";import"./chunk-zg44cf8a.js";import"./chunk-2j5yane9.js";import"./chunk-vbw9jhz2.js";import"./chunk-p65ax8s0.js";import"./chunk-8370x30n.js";import"./chunk-89d3h8mp.js";import"./chunk-zjqvbcwa.js";import"./chunk-23r3rby6.js";export{Yg as buildApp};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{He,M,jt}from"./chunk-8370x30n.js";import{T}from"./chunk-89d3h8mp.js";import{gt,Ee,j,Ke,Te,ga,bo,ma,Mn}from"./chunk-yn17484y.js";import{kt,de,tt}from"./chunk-2j5yane9.js";import{No}from"./chunk-ksr6c2kh.js";import{Dn}from"./chunk-bp918end.js";import{we}from"./chunk-aekq1zyn.js";import Z from"fs";import P from"path";var{serve:ae}=globalThis.Bun;import H from"zlib";import{promisify as Y}from"util";var K=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ee=["text/event-stream","multipart/x-mixed-replace"],te=1024;function ne(t){if(!t)return!1;let e=t.toLowerCase();if(ee.some((a)=>e.startsWith(a)))return!1;return K.some((a)=>e.startsWith(a))}function re(t){let e=new Map;for(let a of t.split(",")){let[r,...i]=a.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of i){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 se(t){if(!t)return null;let e=re(t),a=e.get("*"),r=(i)=>e.get(i)??a??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var J=33554432,F=new Map,z=0;function oe(t,e){if(e.length>J/8)return;F.set(t,e),z+=e.length;for(let[a,r]of F){if(z<=J)break;F.delete(a),z-=r.length}}async function Pn(t,e,a={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!ne(e.headers.get("content-type")))return e;let r=se(t.headers.get("accept-encoding"));if(!r)return e;let i;try{i=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(i,{status:e.status,statusText:e.statusText,headers:Q(e.headers)});if(i.length<(a.threshold??te))return f();try{let h=a.quality??5,g=`${r}:${h}:${i.length}:${Bun.hash(i)}`,l=F.get(g);if(!l)l=r==="br"?await Y(H.brotliCompress)(i,{params:{[H.constants.BROTLI_PARAM_QUALITY]:h,[H.constants.BROTLI_PARAM_SIZE_HINT]:i.length}}):await Y(H.gzip)(i),oe(g,l);if(l.length>=i.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),a=e.get("Vary");if(!a)return e.set("Vary","Accept-Encoding"),e;if(!a.split(",").some((i)=>i.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${a}, Accept-Encoding`);return e}class G{now;entries=new T(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,a){let r,i=async()=>{let s=r??await a();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",j(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return i();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${Ee(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let b=new Headers(s.headers);return b.set("Cache-Control","private, no-store"),b.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:b})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let v=this.generation,k=async()=>{let s=await a();r=s;let b=(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")??"")||b.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",j(s.headers.get("Vary")).Vary);let n={body:B,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===v)this.entries.set(h,n);return n},x=this.pending.get(h);if(!x){if(this.pending.size>=1000)return i();x=k().finally(()=>{if(this.pending.get(h)===x)this.pending.delete(h)}),this.pending.set(h,x)}if(g&&m<e.maxAge+(e.swr??0))return x.catch(()=>{}),l(g);let E=await x;return E?l(E):i()}}var ie={".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 Zg(t={}){let e=P.resolve(t.outputDir||".output"),a=t.port??3000,r=ga(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 i=Dn(r.routeRules),f=new G,h=No(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?M(l):void 0,v=new Map,k=new Map,x=new Map,E=new Map;for(let n of r.routes)try{let y=P.join(e,n.compiledPath),c=JSON.parse(await Bun.file(y).text());if(m)c.html=jt(c.html,m);v.set(n.pattern,c),x.set(n.pattern,tt(c.html)),E.set(n.pattern,we(c.html));let _=P.join(e,n.fragmentPath);if(Ke(c.html,r.routerContainer||"main")&&await Bun.file(_).exists()){let A=await Bun.file(_).text();k.set(n.pattern,m?jt(A,m):A)}}catch(y){console.warn(`[stx] Failed to load route ${n.pattern}:`,y)}let s=new Map,b=[];for(let n of r.routes)if(n.hasParams){let{regex:y,params:c}=de(n.pattern,{page:!0});b.push({regex:y,route:n,paramNames:c})}else s.set(n.pattern,n);let B=ae({port:a,async fetch(n){return Pn(n,await He(m??M(),async()=>{let c=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?.[c])return t.apiRoutes[c](n);let _=await h(n);if(_)return _;if((n.method==="GET"||n.method==="HEAD")&&c!=="/"){let p=P.resolve(e,"public"),d;try{d=decodeURIComponent(c)}catch{d=c}if(!d.includes("\x00")){let u=P.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${P.sep}`))try{if(Z.existsSync(u)&&Z.statSync(u).isFile()){let R=P.extname(u).toLowerCase(),L=ie[R]||"application/octet-stream",N=c.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(c);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=Ee(n),C=null,q={};if(C=s.get(c)||null,!C)for(let{regex:p,route:d,paramNames:u}of b){let o=c.match(p);if(o){C=d,u.forEach((R,L)=>{q[R]=o[L+1]});break}}if(!C){let p=kt(c)?null:s.get("/404")||null;if(p){let d=v.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=i(c),W=Object.keys(O).length>0;return f.respond(n,O.cache,async()=>{let p=v.get(C.pattern);if(A&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let o=k.get(C.pattern);if(o){let R=x.get(C.pattern);return new Response(o,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...E.has(C.pattern)?{"X-STX-Runtime":E.get(C.pattern)?"true":"false"}:{},...R?{"X-STX-Layout":R.layout,"X-STX-Layout-Group":R.group}:{},...j(),...O.cache?{}:{"Cache-Control":gt}}})}}let d=bo(n.method),u=v.get(C.pattern);if(!u){let o=s.get("/500")||null;if(o){let R=v.get(o.pattern);if(R)return new Response(R.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(C.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",...j(),"Cache-Control":"public, max-age=60"}});try{let{html:o,boundaries:R,redirect:L,cookies:N,status:I,headers:D}=await Mn(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(L)return ma(L,N,D);if(R&&R.length>0){let{renderStreamingPage:S,streamToResponse:U}=await import("./chunk-s85chp3w.js"),X=new Headers({...j(),...D,"Cache-Control":"private, no-store"});for(let V of N??[])X.append("Set-Cookie",V);if(A&&!d&&Ke(o,r.routerContainer||"main")){let V=tt(o);X.set("X-STX-Fragment","true"),X.set("X-STX-Runtime",we(o)?"true":"false"),X.set("X-STX-Layout",V.layout),X.set("X-STX-Layout-Group",V.group)}return U(S(A&&!d&&Ke(o,r.routerContainer||"main")?Te(o,r.routerContainer||"main",!0):o,R,{timeoutMs:30000}),{status:I??u.status??200,headers:X})}let w=new Headers({"Content-Type":"text/html",...j(),...O.cache?{}:{"Cache-Control":"private, no-store"}});for(let S of N??[])w.append("Set-Cookie",S);for(let[S,U]of Object.entries(D??{}))w.set(S,U);if(w.set("Vary",j(w.get("Vary")).Vary),A&&!d&&Ke(o,r.routerContainer||"main")){let S=tt(o);return w.set("X-STX-Fragment","true"),w.set("X-STX-Runtime",we(o)?"true":"false"),w.set("X-STX-Layout",S.layout),w.set("X-STX-Layout-Group",S.group),new Response(Te(o,r.routerContainer||"main",!0),{status:I??u.status??200,headers:w})}return new Response(o,{status:I??u.status??200,headers:w})}catch(o){if(console.error(`[stx] Hydration error for ${c}:`,o),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:${B.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${v.size} pre-loaded)`),{port:B.port,stop:()=>{f.invalidate(),B.stop()},invalidate:(n)=>f.invalidate(n)}}
|
|
2
|
+
import{He,M,jt}from"./chunk-8370x30n.js";import{T}from"./chunk-89d3h8mp.js";import{gt,Ee,j,Ke,Te,ga,bo,ma,Mn}from"./chunk-7dnp8evg.js";import{kt,de,tt}from"./chunk-2j5yane9.js";import{No}from"./chunk-qzms4d8s.js";import{Dn}from"./chunk-bp918end.js";import{we}from"./chunk-xqtt5t6d.js";import Z from"fs";import P from"path";var{serve:ae}=globalThis.Bun;import H from"zlib";import{promisify as Y}from"util";var K=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ee=["text/event-stream","multipart/x-mixed-replace"],te=1024;function ne(t){if(!t)return!1;let e=t.toLowerCase();if(ee.some((a)=>e.startsWith(a)))return!1;return K.some((a)=>e.startsWith(a))}function re(t){let e=new Map;for(let a of t.split(",")){let[r,...i]=a.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of i){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 se(t){if(!t)return null;let e=re(t),a=e.get("*"),r=(i)=>e.get(i)??a??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var J=33554432,F=new Map,z=0;function oe(t,e){if(e.length>J/8)return;F.set(t,e),z+=e.length;for(let[a,r]of F){if(z<=J)break;F.delete(a),z-=r.length}}async function Pn(t,e,a={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!ne(e.headers.get("content-type")))return e;let r=se(t.headers.get("accept-encoding"));if(!r)return e;let i;try{i=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(i,{status:e.status,statusText:e.statusText,headers:Q(e.headers)});if(i.length<(a.threshold??te))return f();try{let h=a.quality??5,g=`${r}:${h}:${i.length}:${Bun.hash(i)}`,l=F.get(g);if(!l)l=r==="br"?await Y(H.brotliCompress)(i,{params:{[H.constants.BROTLI_PARAM_QUALITY]:h,[H.constants.BROTLI_PARAM_SIZE_HINT]:i.length}}):await Y(H.gzip)(i),oe(g,l);if(l.length>=i.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),a=e.get("Vary");if(!a)return e.set("Vary","Accept-Encoding"),e;if(!a.split(",").some((i)=>i.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${a}, Accept-Encoding`);return e}class G{now;entries=new T(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,a){let r,i=async()=>{let s=r??await a();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",j(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return i();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${Ee(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let b=new Headers(s.headers);return b.set("Cache-Control","private, no-store"),b.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:b})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let v=this.generation,k=async()=>{let s=await a();r=s;let b=(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")??"")||b.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",j(s.headers.get("Vary")).Vary);let n={body:B,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===v)this.entries.set(h,n);return n},x=this.pending.get(h);if(!x){if(this.pending.size>=1000)return i();x=k().finally(()=>{if(this.pending.get(h)===x)this.pending.delete(h)}),this.pending.set(h,x)}if(g&&m<e.maxAge+(e.swr??0))return x.catch(()=>{}),l(g);let E=await x;return E?l(E):i()}}var ie={".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 Zg(t={}){let e=P.resolve(t.outputDir||".output"),a=t.port??3000,r=ga(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 i=Dn(r.routeRules),f=new G,h=No(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?M(l):void 0,v=new Map,k=new Map,x=new Map,E=new Map;for(let n of r.routes)try{let y=P.join(e,n.compiledPath),c=JSON.parse(await Bun.file(y).text());if(m)c.html=jt(c.html,m);v.set(n.pattern,c),x.set(n.pattern,tt(c.html)),E.set(n.pattern,we(c.html));let _=P.join(e,n.fragmentPath);if(Ke(c.html,r.routerContainer||"main")&&await Bun.file(_).exists()){let A=await Bun.file(_).text();k.set(n.pattern,m?jt(A,m):A)}}catch(y){console.warn(`[stx] Failed to load route ${n.pattern}:`,y)}let s=new Map,b=[];for(let n of r.routes)if(n.hasParams){let{regex:y,params:c}=de(n.pattern,{page:!0});b.push({regex:y,route:n,paramNames:c})}else s.set(n.pattern,n);let B=ae({port:a,async fetch(n){return Pn(n,await He(m??M(),async()=>{let c=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?.[c])return t.apiRoutes[c](n);let _=await h(n);if(_)return _;if((n.method==="GET"||n.method==="HEAD")&&c!=="/"){let p=P.resolve(e,"public"),d;try{d=decodeURIComponent(c)}catch{d=c}if(!d.includes("\x00")){let u=P.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${P.sep}`))try{if(Z.existsSync(u)&&Z.statSync(u).isFile()){let R=P.extname(u).toLowerCase(),L=ie[R]||"application/octet-stream",N=c.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(c);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=Ee(n),C=null,q={};if(C=s.get(c)||null,!C)for(let{regex:p,route:d,paramNames:u}of b){let o=c.match(p);if(o){C=d,u.forEach((R,L)=>{q[R]=o[L+1]});break}}if(!C){let p=kt(c)?null:s.get("/404")||null;if(p){let d=v.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=i(c),W=Object.keys(O).length>0;return f.respond(n,O.cache,async()=>{let p=v.get(C.pattern);if(A&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let o=k.get(C.pattern);if(o){let R=x.get(C.pattern);return new Response(o,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...E.has(C.pattern)?{"X-STX-Runtime":E.get(C.pattern)?"true":"false"}:{},...R?{"X-STX-Layout":R.layout,"X-STX-Layout-Group":R.group}:{},...j(),...O.cache?{}:{"Cache-Control":gt}}})}}let d=bo(n.method),u=v.get(C.pattern);if(!u){let o=s.get("/500")||null;if(o){let R=v.get(o.pattern);if(R)return new Response(R.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(C.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",...j(),"Cache-Control":"public, max-age=60"}});try{let{html:o,boundaries:R,redirect:L,cookies:N,status:I,headers:D}=await Mn(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(L)return ma(L,N,D);if(R&&R.length>0){let{renderStreamingPage:S,streamToResponse:U}=await import("./chunk-p2e02hh7.js"),X=new Headers({...j(),...D,"Cache-Control":"private, no-store"});for(let V of N??[])X.append("Set-Cookie",V);if(A&&!d&&Ke(o,r.routerContainer||"main")){let V=tt(o);X.set("X-STX-Fragment","true"),X.set("X-STX-Runtime",we(o)?"true":"false"),X.set("X-STX-Layout",V.layout),X.set("X-STX-Layout-Group",V.group)}return U(S(A&&!d&&Ke(o,r.routerContainer||"main")?Te(o,r.routerContainer||"main",!0):o,R,{timeoutMs:30000}),{status:I??u.status??200,headers:X})}let w=new Headers({"Content-Type":"text/html",...j(),...O.cache?{}:{"Cache-Control":"private, no-store"}});for(let S of N??[])w.append("Set-Cookie",S);for(let[S,U]of Object.entries(D??{}))w.set(S,U);if(w.set("Vary",j(w.get("Vary")).Vary),A&&!d&&Ke(o,r.routerContainer||"main")){let S=tt(o);return w.set("X-STX-Fragment","true"),w.set("X-STX-Runtime",we(o)?"true":"false"),w.set("X-STX-Layout",S.layout),w.set("X-STX-Layout-Group",S.group),new Response(Te(o,r.routerContainer||"main",!0),{status:I??u.status??200,headers:w})}return new Response(o,{status:I??u.status??200,headers:w})}catch(o){if(console.error(`[stx] Hydration error for ${c}:`,o),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:${B.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${v.size} pre-loaded)`),{port:B.port,stop:()=>{f.invalidate(),B.stop()},invalidate:(n)=>f.invalidate(n)}}
|
|
3
3
|
export{Pn,Zg};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ul,wm,Wl,ql,vm,xm}from"./chunk-
|
|
2
|
+
import{Ul,wm,Wl,ql,vm,xm}from"./chunk-ecjx9z8a.js";import"./chunk-vbw9jhz2.js";import"./chunk-p65ax8s0.js";import"./chunk-8370x30n.js";import"./chunk-89d3h8mp.js";import"./chunk-zjqvbcwa.js";import"./chunk-23r3rby6.js";export{xm as applySlots,vm as extractSlotContent,wm as parseSlotElement,Ul as parseSlots,ql as processSlots,Wl as renderSlot};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{En}from"./chunk-89d3h8mp.js";import{q,y,Nt,Mt,Er,m,rl,xi,W,R}from"./chunk-
|
|
3
|
-
`}import O from"path";var Y="stx-page-head:",Z=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,v={dev:null,prod:null};function Q(){let t=X()?"dev":"prod",r=v[t];if(r!==null)return r;try{let e=import.meta.require("./chunk-7m0r7mq9.js"),s=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;v[t]=`<script>${s()}</script>`}catch{v[t]=""}return v[t]}async function ua(t,r){if(r===!1)return null;if(r&&typeof r==="string"){let s=O.resolve(t,r);if(await Bun.file(s).exists())return s;return null}let e=O.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function yo(t,r){try{let e=await Bun.file(t).text(),s=e,a=e.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(a)s=a[1].trim();let i=tn(e),o=[...i.client.map((g)=>g.fullTag),...i.signals.map((g)=>g.fullTag)],c=[],l=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,u;while((u=l.exec(e))!==null)c.push(u[0]);let f=s;for(let g of i.server)f=f.replace(g.fullTag,"");for(let g of i.client)f=f.replace(g.fullTag,"");f=f.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let p="<!--__STX_PAGE_SLOT__-->";if(f=f.replace(/<slot\s*\/>/gi,p).replace(/<slot\s*>\s*<\/slot>/gi,p),!f.includes(p))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:h,extractVariables:S,defaultConfig:w,loadStxConfig:b}=await import("./chunk-
|
|
2
|
+
import{En}from"./chunk-89d3h8mp.js";import{q,y,Nt,Mt,Er,m,rl,xi,W,R}from"./chunk-vbw9jhz2.js";import{tn}from"./chunk-xdzy4pm0.js";import{n}from"./chunk-jgx0ex9p.js";import{X}from"./chunk-7vhm0jj5.js";var z=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function U(t){let r=[],e=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,s;while((s=e.exec(t))!==null)r.push({start:s.index,end:s.index+s[0].length});return r}function N(t,r){return r.some((e)=>t>=e.start&&t<e.end)}function G(t){let r=(t||"").trim();if(!r)return null;if(/[\s>+~,:]/.test(r))return null;let e={},s=r,a=s.match(/^[a-z][\w-]*/i);if(a)e.tag=a[0].toLowerCase(),s=s.slice(a[0].length);while(s.length>0){let i=s.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(i){if(e.attr=i[1],i[3]!==void 0&&i[3]!=="")e.attrValue=i[3];s=s.slice(i[0].length);continue}let o=s.match(/^#([\w-]+)/);if(o){e.id=o[1],s=s.slice(o[0].length);continue}let c=s.match(/^\.([\w-]+)/);if(c){e.className=c[1],s=s.slice(c[0].length);continue}return null}if(!e.tag&&!e.attr&&!e.id&&!e.className)return null;return e}function J(t,r){if(r.attr){if(!(r.attrValue===void 0?new RegExp(`\\b${r.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${r.attr}\\s*=\\s*(["'])\\s*${r.attrValue}\\s*\\1`,"i")).test(t))return!1}if(r.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${r.id}\\s*\\1`,"i").test(t))return!1}if(r.className){let e=t.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!e)return!1;if(!e[2].split(/\s+/).includes(r.className))return!1}return!0}function P(t,r="main"){let e=G(r);if(!e)return null;let s=/<([a-z][\w-]*)\b([^>]*)>/gi,a=U(t),i;while((i=s.exec(t))!==null){if(N(i.index,a))continue;let o=i[1].toLowerCase(),c=i[2]||"";if(c.trimEnd().endsWith("/")||z.has(o))continue;if(e.tag&&e.tag!==o)continue;if(!J(c,e))continue;let l=i[0],u=i.index+l.length,f=new RegExp(`<(/?)${o}\\b([^>]*)>`,"gi");f.lastIndex=u;let p=1,h;while((h=f.exec(t))!==null){if(N(h.index,a))continue;let S=h[1]==="/";if(!S&&(h[2]||"").trimEnd().endsWith("/"))continue;if(p+=S?-1:1,p===0)return{openTag:l,openIndex:i.index,start:u,end:h.index,tagName:o}}return null}return null}var gt="private, no-store";function On(t){return t.replace(/&#(\d+);/g,(r,e)=>D(Number(e),r)).replace(/&#x([0-9a-f]+);/gi,(r,e)=>D(Number.parseInt(e,16),r)).replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&")}function D(t,r){if(!Number.isInteger(t)||t<0||t>1114111)return r;try{return String.fromCodePoint(t)}catch{return r}}function Ee(t){return t.headers.get("X-STX-Router")==="true"}function K(t,r){if(!t)return r;return t.split(",").some((s)=>s.trim().toLowerCase()===r.toLowerCase())?t:`${t}, ${r}`}function j(t){return{Vary:K(t,"X-STX-Router")}}function k(t){return t.replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Nn(t){let r=/<head\b[^>]*>([\s\S]*?)<\/head\s*>/i.exec(t)?.[1]??"",e=/<(meta|link)\b(?:[^>"']|"[^"]*"|'[^']*')*>|<title\b[^>]*>[\s\S]*?<\/title\s*>/giy,s=y(r,(i,o)=>(e.lastIndex=o,e.exec(i)?e.lastIndex:-1)),a=[];for(let{token:i}of s){if(/^<title\b/i.test(i)){a.push(`<title>${k(i.replace(/^<title\b[^>]*>|<\/title\s*>$/gi,""))}</title>`);continue}let o=Object.create(null),c=i.replace(/^<\w+\b|>$/g,"");for(let l of c.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)){let u=l[1].toLowerCase();if(!(u in o))o[u]=l[2]??l[3]??l[4]??""}if(/^<meta\b/i.test(i)){let l=o.property?"property":"name",u=On(o[l]??"").toLowerCase();if(u==="description"||/^(?:og|twitter):[\w:]+$/.test(u))a.push(`<meta ${l}="${n(u)}" content="${k(o.content??"")}">`)}else{let l=On(o.rel??"").toLowerCase();if(l==="canonical"||l==="alternate"&&o.hreflang)a.push(`<link rel="${l}" href="${k(o.href??"")}"${l==="alternate"?` hreflang="${k(o.hreflang)}"`:""}>`)}}return`<template data-stx-page-head="1">${a.join("")}</template>
|
|
3
|
+
`}import O from"path";var Y="stx-page-head:",Z=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,v={dev:null,prod:null};function Q(){let t=X()?"dev":"prod",r=v[t];if(r!==null)return r;try{let e=import.meta.require("./chunk-7m0r7mq9.js"),s=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;v[t]=`<script>${s()}</script>`}catch{v[t]=""}return v[t]}async function ua(t,r){if(r===!1)return null;if(r&&typeof r==="string"){let s=O.resolve(t,r);if(await Bun.file(s).exists())return s;return null}let e=O.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function yo(t,r){try{let e=await Bun.file(t).text(),s=e,a=e.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(a)s=a[1].trim();let i=tn(e),o=[...i.client.map((g)=>g.fullTag),...i.signals.map((g)=>g.fullTag)],c=[],l=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,u;while((u=l.exec(e))!==null)c.push(u[0]);let f=s;for(let g of i.server)f=f.replace(g.fullTag,"");for(let g of i.client)f=f.replace(g.fullTag,"");f=f.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let p="<!--__STX_PAGE_SLOT__-->";if(f=f.replace(/<slot\s*\/>/gi,p).replace(/<slot\s*>\s*<\/slot>/gi,p),!f.includes(p))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:h,extractVariables:S,defaultConfig:w,loadStxConfig:b}=await import("./chunk-qb3c05qq.js"),E=await b(),d={__filename:t,__dirname:O.dirname(t)};for(let g of o){let A=g.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(A&&!g.includes("client")&&!g.includes('type="module"'))await S(A[1],d,t)}let x=await h(f,d,t,{...w,...E,...r},new Set),C=x.indexOf(p);if(C===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:x.substring(0,C),afterSlot:x.substring(C+p.length),filePath:t,shellScripts:o,shellStyles:c}}catch(e){return console.error(`[stx] Error processing shell ${t}:`,e),null}}function Xr(t,r,e){let s,a="",i=r.match(Z);if(i){r=r.replace(i[0],"");try{let f=Buffer.from(i[1],"base64").toString("utf8"),p=f.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(p)s=p[1].trim();a=f.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let o=e||s||"stx App",c=Q(),l="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
|
|
4
4
|
<html lang="en">
|
|
5
5
|
<head>
|
|
6
6
|
<meta charset="UTF-8">
|
|
@@ -28,5 +28,5 @@ ${c}
|
|
|
28
28
|
`));if(i.length>0)d.push(i.filter((x)=>!u.has(x)).join(`
|
|
29
29
|
`));if(w.length>0)d.push(w.filter((x)=>!u.has(x)).join(`
|
|
30
30
|
`));return d.push(S),d.join(`
|
|
31
|
-
`)}import T from"fs";import H from"path";function pa(t,r,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:r,outputDir:e}}function fa(t,r){let e=H.join(r,"manifest.json");T.writeFileSync(e,JSON.stringify(t,null,2))}function ga(t){let r=H.join(t,"manifest.json");if(!T.existsSync(r))return null;try{let e=T.readFileSync(r,"utf-8"),s=JSON.parse(e);if(s.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${s.version}`),null;return s}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function M(t,r,e={}){let s=`${encodeURIComponent(t)}=${encodeURIComponent(r)}`;if(e.maxAge!==void 0)s+=`; Max-Age=${e.maxAge}`;if(e.expires)s+=`; Expires=${e.expires.toUTCString()}`;if(e.path)s+=`; Path=${e.path}`;if(e.domain)s+=`; Domain=${e.domain}`;if(e.secure)s+="; Secure";if(e.httpOnly)s+="; HttpOnly";if(e.sameSite)s+=`; SameSite=${e.sameSite}`;return s}async function et(t){let r=t.headers.get("content-type")||"",e={},s=(a,i)=>{let o=e[a];if(o===void 0)e[a]=i;else if(Array.isArray(o))o.push(i);else e[a]=[o,i]};if(r.includes("multipart/form-data")){let a=await t.formData();for(let[i,o]of a.entries())if(typeof o==="string")s(i,o);return e}if(r.includes("application/x-www-form-urlencoded")){for(let[a,i]of new URLSearchParams(await t.text()).entries())s(a,i);return e}return e}function bo(t){if(!t)return!1;let r=t.toUpperCase();return r!=="GET"&&r!=="HEAD"}async function V(t,r={}){let e=r.request,s=r.method??e?.method;if(!e||!bo(s))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let a={};try{a=await et(e)}catch{}let i=await t.action({request:e,form:a,params:r.params??{},query:t.query??{},cookies:r.cookies??{}});if(i&&typeof i==="object"){let o=i,c=nt(o.cookies),l=o.redirect;if(typeof l==="string"&&l)return{redirect:l,ran:!0,...c.length>0?{cookies:c}:{}};let{cookies:u,redirect:f,...p}=o;if(Object.assign(t,p),c.length>0)return{ran:!0,cookies:c}}return{ran:!0}}function nt(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let r=[];for(let[e,s]of Object.entries(t)){if(!e)continue;if(typeof s==="string"){r.push(M(e,s));continue}if(s&&typeof s==="object"){let a=s;if(typeof a.value!=="string")continue;r.push(M(e,a.value,a))}}return r}function ma(t,r=[],e){let s=new Headers({Location:t,"Cache-Control":"no-store"});for(let a of r)s.append("Set-Cookie",a);for(let[a,i]of Object.entries(e??{}))if(a.toLowerCase()!=="location")s.set(a,i);return new Response(null,{status:303,headers:s})}async function Mn(t,r={}){let{html:e,context:s,redirect:a,cookies:i}=await rt(t,r),o=Nt(s),c=Mt(s);if(a)return{html:e,redirect:a,cookies:i,status:o,headers:c};let{extractStreamBoundaries:l}=await import("./chunk-
|
|
31
|
+
`)}import T from"fs";import H from"path";function pa(t,r,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:r,outputDir:e}}function fa(t,r){let e=H.join(r,"manifest.json");T.writeFileSync(e,JSON.stringify(t,null,2))}function ga(t){let r=H.join(t,"manifest.json");if(!T.existsSync(r))return null;try{let e=T.readFileSync(r,"utf-8"),s=JSON.parse(e);if(s.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${s.version}`),null;return s}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function M(t,r,e={}){let s=`${encodeURIComponent(t)}=${encodeURIComponent(r)}`;if(e.maxAge!==void 0)s+=`; Max-Age=${e.maxAge}`;if(e.expires)s+=`; Expires=${e.expires.toUTCString()}`;if(e.path)s+=`; Path=${e.path}`;if(e.domain)s+=`; Domain=${e.domain}`;if(e.secure)s+="; Secure";if(e.httpOnly)s+="; HttpOnly";if(e.sameSite)s+=`; SameSite=${e.sameSite}`;return s}async function et(t){let r=t.headers.get("content-type")||"",e={},s=(a,i)=>{let o=e[a];if(o===void 0)e[a]=i;else if(Array.isArray(o))o.push(i);else e[a]=[o,i]};if(r.includes("multipart/form-data")){let a=await t.formData();for(let[i,o]of a.entries())if(typeof o==="string")s(i,o);return e}if(r.includes("application/x-www-form-urlencoded")){for(let[a,i]of new URLSearchParams(await t.text()).entries())s(a,i);return e}return e}function bo(t){if(!t)return!1;let r=t.toUpperCase();return r!=="GET"&&r!=="HEAD"}async function V(t,r={}){let e=r.request,s=r.method??e?.method;if(!e||!bo(s))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let a={};try{a=await et(e)}catch{}let i=await t.action({request:e,form:a,params:r.params??{},query:t.query??{},cookies:r.cookies??{}});if(i&&typeof i==="object"){let o=i,c=nt(o.cookies),l=o.redirect;if(typeof l==="string"&&l)return{redirect:l,ran:!0,...c.length>0?{cookies:c}:{}};let{cookies:u,redirect:f,...p}=o;if(Object.assign(t,p),c.length>0)return{ran:!0,cookies:c}}return{ran:!0}}function nt(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let r=[];for(let[e,s]of Object.entries(t)){if(!e)continue;if(typeof s==="string"){r.push(M(e,s));continue}if(s&&typeof s==="object"){let a=s;if(typeof a.value!=="string")continue;r.push(M(e,a.value,a))}}return r}function ma(t,r=[],e){let s=new Headers({Location:t,"Cache-Control":"no-store"});for(let a of r)s.append("Set-Cookie",a);for(let[a,i]of Object.entries(e??{}))if(a.toLowerCase()!=="location")s.set(a,i);return new Response(null,{status:303,headers:s})}async function Mn(t,r={}){let{html:e,context:s,redirect:a,cookies:i}=await rt(t,r),o=Nt(s),c=Mt(s);if(a)return{html:e,redirect:a,cookies:i,status:o,headers:c};let{extractStreamBoundaries:l}=await import("./chunk-p2e02hh7.js"),u=l(s),f=t.streamTemplates;if(f&&Object.keys(f).length>0){let{processDirectives:p}=await import("./chunk-ndah5rvs.js"),{defaultConfig:h}=await import("./chunk-fpn5txnm.js"),S=s.streamBoundaries||{},w={...h,autoShell:!1},b=Object.keys(f).map((d)=>({id:d,render:async()=>{let x=typeof S[d]==="function"?await S[d]():void 0;return p(f[d],{...s,$boundary:x},t.sourceFile,w,new Set)}})),E=new Set(b.map((d)=>d.id));u=[...(u||[]).filter((d)=>!E.has(d.id)),...b]}return{html:e,boundaries:u&&u.length>0?u:void 0,cookies:i,status:o,headers:c}}async function rt(t,r){let e={__filename:t.sourceFile,__dirname:t.sourceFile.replace(/[/\\][^/\\]+$/,""),...r};if(!t.hasServerScripts&&!xi(t.html))return{html:t.html,context:e};for(let o of t.serverScriptContent)try{await m(o,e,t.sourceFile)}catch(c){if(r.__stx_strict_hydration)throw c;console.warn(`[stx] Server script error in ${t.sourceFile}:`,c)}let s=await V(e,{request:r.request,method:r.method,params:r.params??{},cookies:r.cookies??{}}),a=(o)=>{let c=o.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),l=Er(e);if(!l)return c;let u=c.indexOf("</head>");return u<0?l+c:c.slice(0,u)+l+c.slice(u)};if(s.redirect)return{html:t.html,context:e,redirect:s.redirect,cookies:s.cookies};if(!xi(t.html))return{html:a(t.html),context:e,cookies:s.cookies};let i=new Map;for(let[o,c]of Object.entries(t.placeholders))if(c.expression)try{let l=R(c.expression,e);if(c.type==="raw")i.set(o,l!==void 0&&l!==null?String(l):"");else i.set(o,l!==void 0&&l!==null?W(String(l)):"")}catch(l){if(r.__stx_strict_hydration)throw l;i.set(o,"")}return{html:a(rl(t.html,i)),context:e,cookies:s.cookies}}
|
|
32
32
|
export{gt,On,Ee,j,Nn,ua,yo,Xr,qe,da,Ke,Te,pa,fa,ga,bo,ma,Mn};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{nt}from"./chunk-2j5yane9.js";import{yt,Wn}from"./chunk-xbcnnk8x.js";import{Ar,Pr,Ir,Nr,Ce}from"./chunk-89d3h8mp.js";import{De,yn,tl,nl}from"./chunk-
|
|
2
|
+
import{nt}from"./chunk-2j5yane9.js";import{yt,Wn}from"./chunk-xbcnnk8x.js";import{Ar,Pr,Ir,Nr,Ce}from"./chunk-89d3h8mp.js";import{De,yn,tl,nl}from"./chunk-vbw9jhz2.js";import{M}from"./chunk-8370x30n.js";import{ki}from"./chunk-p65ax8s0.js";import{b}from"./chunk-vwddsdk5.js";import{i}from"./chunk-57x8wxdf.js";import{F,a}from"./chunk-chjdnmqv.js";import{Cc}from"./chunk-4657mnht.js";import{Nn,qe,Te,pa,fa,Mn}from"./chunk-7dnp8evg.js";import{cn,Oo}from"./chunk-qzms4d8s.js";import{Dn}from"./chunk-bp918end.js";import{en,er,tr}from"./chunk-c18pafmf.js";import{G}from"./chunk-xqtt5t6d.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function J(n){return Q("sha256").update(n).digest("hex").slice(0,8)}function U(n=!1){let l=n?Wn():yt(),o=J(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function V(){let n=nt(),l=J(n);return{content:n,filename:`router.${l}.js`,hash:l}}import q from"path";import{createHash as ee}from"crypto";function te(n={}){let l=new Set;return{context:new Proxy(n,{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(n,l,o={}){let r=q.resolve(n),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);tl();let _={};try{_=await a(o.configDir)}catch{}let h=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))h.push(g[2])}let u=new Set(h.flatMap((R)=>De(R))),{context:D}=te({__filename:r,__dirname:q.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...F,..._,...o,buildMode:"compile",strict:!1},y=await i(e,D,r,T,A),w=Nn(y)+qe(y),j=nl();return{route:l,sourceFile:n,html:y,fragment:w,placeholders:j,hasServerScripts:h.length>0,serverScriptContent:h,dependencies:Array.from(A),contentHash:S,status:yn(e),streamTemplates:D.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let h=m.readdirSync(S,{withFileTypes:!0});for(let d of h){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),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function im(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),S=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),h=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=Ce(e.app?.head,{known:Nr,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=Dn(A),y=n.serverApi??e.serverApi,w=typeof y==="object"?y:{};if(y)cn(o,w);if(e.runtimeConfig)M(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let j=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of j)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=G(o,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],P=R.filter((s)=>!Y.some((f)=>s.pattern.startsWith(`/${f}/`)||s.pattern===`/${f}`));console.log(`[stx build] Found ${P.length} page routes (${R.length-P.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=U(n.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 B=[],H=[];for(let s of P){let f=T(s.pattern),O=f.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:o,componentsDir:S,partialsDir:_,layoutsDir:h,debug:n.debug});if(B.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=Ir(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=Ar(t.html,u);if(g.htmlAttrs)t.html=Pr(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 b(t.html),O){let p=await Mn(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=Te(t.html,D,!0);let L=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),z=c.join("server","pages",`${L}.compiled.json`),I=c.join("server","fragments",`${L}.html`);await Bun.write(c.join(r,z),JSON.stringify(t,null,2)),await Bun.write(c.join(r,I),t.fragment),H.push({pattern:s.pattern,compiledPath:z,fragmentPath:I,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:O}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(f).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let k=c.resolve(o,d);if(m.existsSync(k)){let{copied:s,bytes:f}=Z(k,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${d}/`)}let E=tr(o);if(E){let{copied:s,bytes:f}=Z(E,c.join(r,"public",er));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${en}/`)}let N={runtime:v.filename,router:x.filename},C=pa(H,N,r);if(C.routeRules=A,C.routerContainer=D,y)C.apiRoutes=await Oo(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await ki(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Cc(e._layerGraph),null,2));fa(C,r);let K=Date.now()-l;return console.log(`
|
|
3
3
|
[stx build] Done in ${K}ms \u2014 ${B.length} pages compiled`),{pageCount:B.length,assets:N,outputDir:r,duration:K}}
|
|
4
4
|
export{im};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ts,ns}from"./chunk-ca3c5qx2.js";import{y}from"./chunk-
|
|
2
|
+
import{ts,ns}from"./chunk-ca3c5qx2.js";import{y}from"./chunk-vbw9jhz2.js";import{a}from"./chunk-chjdnmqv.js";import{Xe,se}from"./chunk-9xps62ek.js";import{Za}from"./chunk-px5kda00.js";import{B}from"./chunk-ybq56wam.js";import{g}from"./chunk-0dve54ne.js";import{existsSync as z,mkdirSync as S,copyFileSync as P,chmodSync as I,rmSync as ve}from"fs";import{join as c,basename as xe,resolve as X}from"path";import{spawn as _}from"child_process";import{platform as ye}from"os";function O(e,r,i){let n=new RegExp(`</${r}\\s*>`,"iy"),s=y(e,(t,o)=>(n.lastIndex=o,n.exec(t)?n.lastIndex:-1))[0];return s?e.slice(0,s.start)+i+e.slice(s.start):null}var hu=`
|
|
3
3
|
<script>
|
|
4
4
|
(function() {
|
|
5
5
|
'use strict';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ic,r,ge}from"./chunk-
|
|
2
|
+
import{Ic,r,ge}from"./chunk-vbw9jhz2.js";import{rt}from"./chunk-car6nhfe.js";import{c}from"./chunk-z4g64re8.js";import o from"fs";import l from"path";var zf=new Map,m=new Map;async function jh(e){let n;for(let i=0;i<3;i++)try{let g=(await o.promises.stat(e)).mtime.getTime(),a=m.get(e);if(a&&a.mtime===g)return a.content;let h=await Bun.file(e).text(),w=(await o.promises.stat(e)).mtime.getTime();if(w!==g)continue;return m.set(e,{content:h,mtime:w}),h}catch(s){n=s;break}throw m.delete(e),Error(`File not found: ${e}${n?` (${n.message})`:""}`)}function Bh(e){m.delete(e)}function Fh(e){for(let t of m.keys())if(t.startsWith(e))m.delete(t)}var f=null,B=null,x=null;function zh(e){x=e}async function Hf(e=!1){let t=x??await import("./chunk-x5wkbcsf.js");if(e)return t.generateSignalsRuntimeDev();if(f===null)f=t.generateSignalsRuntime();return f}var S=null;async function Vf(){if(S===null){let{getRouterScript:e}=await import("./chunk-7m0r7mq9.js");S=e()}return S}var y={};async function Hh(e,t=!1){let n=e==="runtime"?await Hf(t):await Vf(),i=e==="runtime"&&t?"runtime-debug":e,s=y[i];if(!s||s.content!==n)s={content:n,hash:Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)},y[i]=s;return{content:n,hash:s.hash,url:`/_stx/${e}.${s.hash}.js`}}var E=500,T=33554432,u=new Map,p=0;function C(e){return c(process.cwd(),"module-bundles",`${e}.js`)}function Vh(e){let t=Bun.hash(e).toString(16).padStart(16,"0").slice(0,16),n=u.get(t),i=n!==void 0;if(i)u.delete(t),p-=n.length*2;u.set(t,e),p+=e.length*2;while(u.size>1&&(u.size>E||p>T)){let s=u.keys().next().value;p-=u.get(s).length*2,u.delete(s)}if(!i)try{let s=C(t);if(!o.existsSync(s))o.mkdirSync(l.dirname(s),{recursive:!0}),o.writeFileSync(s,e)}catch{}return`/_stx/modules.${t}.js`}function Yo(e){if(!/^[0-9a-f]{16}$/.test(e))return;let t=u.get(e);if(t!==void 0)return t;try{return o.readFileSync(C(e),"utf8")}catch{return}}function Uh(){m.clear(),ge(),Ic(),f=null,B=null,S=null}function v(e){let t={debug:e.debug===!0,middleware:(e.middleware??[]).map((n)=>({name:n.name,timing:n.timing,handler:String(n.handler)})),customDirectives:(e.customDirectives??[]).map((n)=>({name:n.name,hasEndTag:n.hasEndTag===!0,rawParams:n.rawParams===!0,handler:String(n.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(t)).digest("hex")}async function dr(e,t){try{if(!t.cachePath)return null;let n=l.resolve(t.cachePath),i=l.join(n,`${xs(e)}.html`),s=l.join(n,`${xs(e)}.meta.json`);if(!await r(i)||!await r(s))return null;let g=await Bun.file(s).text(),a=JSON.parse(g);if(a.cacheVersion!==t.cacheVersion)return null;if(a.engine!==rt())return null;if(a.optionsSignature!==v(t))return null;if((await o.promises.stat(e)).mtime.getTime()>a.mtime)return null;for(let d of a.dependencies)if(await r(d)){if((await o.promises.stat(d)).mtime.getTime()>a.mtime)return null}else return null;return await Bun.file(i).text()}catch(n){return console.warn(`Cache error for ${e}:`,n),null}}async function pr(e,t,n,i){try{if(!i.cachePath)return;let s=l.resolve(i.cachePath);await o.promises.mkdir(s,{recursive:!0});let g=l.join(s,`${xs(e)}.html`),a=l.join(s,`${xs(e)}.meta.json`),h=await o.promises.stat(e);await Bun.write(g,t);let d={sourcePath:e,mtime:h.mtime.getTime(),dependencies:Array.from(n),cacheVersion:i.cacheVersion,engine:rt(),optionsSignature:v(i),generatedAt:Date.now()};await Bun.write(a,JSON.stringify(d,null,2)),zf.set(e,{output:t,mtime:h.mtime.getTime(),dependencies:n})}catch(s){console.warn(`Failed to cache template ${e}:`,s)}}var _=16;function xs(e){return new Bun.CryptoHasher("sha1").update(e).digest("hex").substring(0,_)}
|
|
3
3
|
export{zf,jh,Bh,Fh,zh,Hf,Vf,Hh,Vh,Yo,Uh,dr,pr,xs};
|