@stacksjs/stx 0.2.868 → 0.2.869
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/app-shell.js +5 -4
- package/dist/chunk-05dtat6q.js +2 -0
- package/dist/{chunk-3wcwr2qt.js → chunk-05qpze12.js} +1 -1
- package/dist/{chunk-sxh28q9h.js → chunk-095cn3p0.js} +26 -26
- package/dist/chunk-0snga2v8.js +2 -0
- package/dist/{chunk-g0xn80gz.js → chunk-0tyyad6q.js} +9 -9
- package/dist/chunk-0xqefkqr.js +2 -0
- package/dist/{chunk-67dgp45w.js → chunk-1dt8e7ew.js} +2 -2
- package/dist/chunk-1t8tkryw.js +2 -0
- package/dist/{chunk-amkzap4f.js → chunk-2wa1keyw.js} +1 -1
- package/dist/{chunk-5dvkphbe.js → chunk-311mrz2n.js} +1 -1
- package/dist/chunk-3eqa6hnx.js +2 -0
- package/dist/{chunk-z512gt4v.js → chunk-3f51tn2b.js} +3 -3
- package/dist/{chunk-8s6s6nd0.js → chunk-4068rmzv.js} +2 -2
- package/dist/chunk-4math14x.js +2 -0
- package/dist/{chunk-8arfg8kp.js → chunk-4vtw6f0c.js} +1 -1
- package/dist/{chunk-5kkq2eqr.js → chunk-5d0csn7w.js} +1 -1
- package/dist/chunk-5debppk8.js +2 -0
- package/dist/{chunk-krhcqf22.js → chunk-5f9z82xp.js} +2 -2
- package/dist/{chunk-vvzys1x7.js → chunk-5h9d6jew.js} +3 -3
- package/dist/{chunk-j4ec0g5g.js → chunk-5qk506kn.js} +1 -1
- package/dist/{chunk-h65shwe9.js → chunk-5sbtbfj3.js} +1 -1
- package/dist/{chunk-k32q90b2.js → chunk-60yppcbb.js} +2 -2
- package/dist/{chunk-eafqxbr0.js → chunk-6ggme8xx.js} +1 -1
- package/dist/{chunk-fmzyrg2e.js → chunk-6ksyrmpp.js} +1 -1
- package/dist/{chunk-x64afx6z.js → chunk-6mjd3pqd.js} +1 -1
- package/dist/{chunk-6k4ac74t.js → chunk-6vgr5g6d.js} +2 -2
- package/dist/{chunk-qc4eca8y.js → chunk-73vtvzb1.js} +1 -1
- package/dist/{chunk-5kh12nvn.js → chunk-7vc8b7c5.js} +1 -1
- package/dist/{chunk-6jpgyb22.js → chunk-81kk8dnr.js} +1 -1
- package/dist/chunk-8veysx0v.js +2 -0
- package/dist/{chunk-tdp2tvf3.js → chunk-9fk02w6v.js} +3 -3
- package/dist/{chunk-t76vnqff.js → chunk-9mkv1se7.js} +1 -1
- package/dist/{chunk-9a7tds1a.js → chunk-9rjr7hvf.js} +1 -1
- package/dist/chunk-a9y9ghm2.js +2 -0
- package/dist/chunk-ac5sa72c.js +2 -0
- package/dist/{chunk-hw156fjb.js → chunk-ajy9tjct.js} +2 -2
- package/dist/{chunk-f22sdw5q.js → chunk-akv760py.js} +1 -1
- package/dist/{chunk-pnqap5yf.js → chunk-bfww6qxt.js} +1 -1
- package/dist/chunk-bv6rx5w4.js +2 -0
- package/dist/{chunk-je3wv4qx.js → chunk-cvpbgf6h.js} +1 -1
- package/dist/{chunk-chd60py8.js → chunk-d2m57nd1.js} +1 -1
- package/dist/{chunk-mcnwvh06.js → chunk-d9k8j44b.js} +5 -5
- package/dist/chunk-djdganvr.js +2 -0
- package/dist/{chunk-kh6njq2r.js → chunk-dy7vqv1x.js} +2 -2
- package/dist/chunk-f3d1y318.js +33 -0
- package/dist/chunk-f64wbr0j.js +2 -0
- package/dist/{chunk-3hrps6aa.js → chunk-fzz251r8.js} +9 -9
- package/dist/{chunk-ynkbv9jq.js → chunk-gcsy3z1e.js} +2 -2
- package/dist/{chunk-cra4g128.js → chunk-gj16gta9.js} +6 -6
- package/dist/{chunk-jx8nha8j.js → chunk-gk8472hq.js} +2 -2
- package/dist/{chunk-ycqnq4b0.js → chunk-gxq3jnkb.js} +1 -1
- package/dist/chunk-h2r54207.js +54 -0
- package/dist/{chunk-he975510.js → chunk-h8h97bcc.js} +1 -1
- package/dist/chunk-hb6r4pxp.js +2 -0
- package/dist/{chunk-ypfbw069.js → chunk-hvh7v5bx.js} +4 -4
- package/dist/{chunk-jbgj2hph.js → chunk-hvx6j4a2.js} +2 -2
- package/dist/{chunk-egvyeet8.js → chunk-j148k8rf.js} +1 -1
- package/dist/{chunk-tv8107sc.js → chunk-jsyrp1n2.js} +1 -1
- package/dist/{chunk-wrvs1hh1.js → chunk-k3qh0esd.js} +7 -7
- package/dist/{chunk-2rz0wdft.js → chunk-k4dcnc4e.js} +3 -3
- package/dist/{chunk-8me8hamk.js → chunk-k7m8659h.js} +2 -2
- package/dist/chunk-kdat1ht1.js +3 -0
- package/dist/{chunk-d54r5c9e.js → chunk-kgh1xsfe.js} +74 -74
- package/dist/{chunk-cjy9cdm0.js → chunk-m4k6ndf5.js} +1 -1
- package/dist/{chunk-0kzawt78.js → chunk-mbp7j1a7.js} +2 -2
- package/dist/{chunk-7xhwqc0c.js → chunk-mnx6njd4.js} +4 -4
- package/dist/{chunk-p50qqwed.js → chunk-nqz4es8a.js} +1 -1
- package/dist/chunk-nrpqrqqe.js +2 -0
- package/dist/{chunk-xk555zd5.js → chunk-p3yesft1.js} +1 -1
- package/dist/chunk-ps6m8n9n.js +2 -0
- package/dist/{chunk-aef82ns3.js → chunk-pxce4aag.js} +1 -1
- package/dist/{chunk-mapk8tws.js → chunk-qqvj5zra.js} +1 -1
- package/dist/{chunk-mayk025t.js → chunk-r3eezdg4.js} +26 -26
- package/dist/chunk-r53eeyhv.js +42 -0
- package/dist/chunk-rhhq8k9f.js +2 -0
- package/dist/{chunk-bwdbj60y.js → chunk-rpep1ve3.js} +2 -2
- package/dist/{chunk-2tpsbzfe.js → chunk-s6fe2wp6.js} +1 -1
- package/dist/{chunk-83tvkw4y.js → chunk-sbvkk4cn.js} +2 -2
- package/dist/{chunk-f6ypmk8x.js → chunk-stdddhk9.js} +1 -1
- package/dist/chunk-swp254eb.js +2 -0
- package/dist/chunk-szfh1sg3.js +2 -0
- package/dist/{chunk-n3z0d58b.js → chunk-tdd3765y.js} +39 -39
- package/dist/{chunk-6m6y9bbx.js → chunk-tjwzy9xq.js} +1 -1
- package/dist/{chunk-5n3f6mg2.js → chunk-tz7b6fdz.js} +1 -1
- package/dist/{chunk-gd56arnm.js → chunk-vrcr4b13.js} +1 -1
- package/dist/{chunk-nq4zvers.js → chunk-vzq77h80.js} +1 -1
- package/dist/{chunk-0v2yj490.js → chunk-w2hqjv5e.js} +1 -1
- package/dist/{chunk-tefr8tve.js → chunk-wcq7a5pv.js} +3 -3
- package/dist/{chunk-5zvytrge.js → chunk-wrgaxvxy.js} +3 -3
- package/dist/{chunk-0qx649hq.js → chunk-wxggf5aq.js} +1 -1
- package/dist/{chunk-4hb62hcj.js → chunk-xsbaha1z.js} +2 -2
- package/dist/{chunk-9mvc7t63.js → chunk-xtcba3r1.js} +2 -2
- package/dist/chunk-ympa56f9.js +2 -0
- package/dist/{chunk-64ebysb4.js → chunk-yx3vghee.js} +1 -1
- package/dist/chunk-z2t6f4gt.js +2 -0
- package/dist/{chunk-ea3c80wv.js → chunk-za61jaep.js} +2 -2
- package/dist/{chunk-d9r6xy5m.js → chunk-zfj8rfv2.js} +1 -1
- package/dist/cli.js +12 -12
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/pwa.js +2 -2
- package/dist/ssg.js +3 -3
- package/package.json +5 -5
- package/dist/chunk-02stnjr0.js +0 -2
- package/dist/chunk-0twkeh31.js +0 -2
- package/dist/chunk-1872e8z8.js +0 -2
- package/dist/chunk-23nr1jcs.js +0 -2
- package/dist/chunk-2d8kfrs8.js +0 -2
- package/dist/chunk-3gk1e2b1.js +0 -2
- package/dist/chunk-49bx8g98.js +0 -2
- package/dist/chunk-7nvaapgm.js +0 -2
- package/dist/chunk-8qyc4nqe.js +0 -3
- package/dist/chunk-9cwag0tk.js +0 -2
- package/dist/chunk-9vq7vk10.js +0 -2
- package/dist/chunk-cm8wy2wv.js +0 -42
- package/dist/chunk-dvvp0bdw.js +0 -2
- package/dist/chunk-etjaf7f2.js +0 -2
- package/dist/chunk-f4ct7tj1.js +0 -2
- package/dist/chunk-g5hpzby1.js +0 -2
- package/dist/chunk-gy6p5xx4.js +0 -2
- package/dist/chunk-ha9qcfys.js +0 -54
- package/dist/chunk-hqgnpq8n.js +0 -33
- package/dist/chunk-kejcaqbd.js +0 -2
- package/dist/chunk-m05y60v0.js +0 -2
- package/dist/chunk-nrhahqye.js +0 -2
- package/dist/chunk-phppqwdd.js +0 -2
- package/dist/chunk-wzsr1z0z.js +0 -2
- package/dist/chunk-z1rs6b4x.js +0 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{d,m,hl,p,t,u}from"./chunk-g0xn80gz.js";import{rt,Et,hn,ti}from"./chunk-5dvkphbe.js";function L(w,e){try{let g=w.trim();if(m(g))return p(g,Object.keys(e))(...Object.values(e));else return d(g,e)}catch{return!1}}function Q(w,e,g){let n=w,v=!0;while(v){v=!1;let a=n.match(/@switch\s*\(/);if(!a||a.index===void 0)break;let f=a.index,s=ti(n,f);if(!s)break;try{let o;if(m(s.expression))o=p(s.expression,Object.keys(e))(...Object.values(e));else o=d(s.expression,e);let r="",c=!1;for(let i of s.cases)if(i.type==="default"){if(!c)r=i.content.trim()}else try{let b;if(i.value&&m(i.value))b=p(i.value,Object.keys(e))(...Object.values(e));else if(i.value)b=d(i.value,e);if(o===b){r=i.content.trim(),c=!0;break}}catch{continue}n=n.substring(0,f)+r+n.substring(s.end),v=!0}catch(o){let r=o instanceof Error?o.message:String(o),c=u("Switch",`Error evaluating @switch expression: ${r}`,t.EVALUATION_ERROR);n=n.substring(0,f)+c+n.substring(s.end);break}}return n}function H(w){let e=[];return{masked:w.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(n)=>(e.push(n),`\x00stx-script-${e.length-1}\x00`)),scripts:e}}function J(w,e){if(e.length===0)return w;return w.replace(/\u0000stx-script-(\d+)\u0000/g,(g,n)=>e[Number(n)]??g)}function le(w,e,g){let{masked:n,scripts:v}=H(w);return J(K(n,e,g),v)}function K(w,e,g){let n=w;n=Q(n,e,g);{let a=!0;while(a){a=!1;let f=n.match(/@unless\s*\(/);if(!f||f.index===void 0)break;let s=f.index,o=rt(n,s+7);if(!o)break;let r=o.endPos,c=Et(n,"unless","endunless",r);if(c===-1){console.warn(`[stx] @unless directive at position ${s} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let i=n.slice(r,c),b=o.expression,y=-1;{let x=0,k=/@(?:if|unless)\s*\(/g,h=/@(?:endif|endunless)(?![a-z])/g,E=/@else(?![a-z])/g,S=[],C;while((C=k.exec(i))!==null)S.push({pos:C.index,type:"open"});while((C=h.exec(i))!==null)S.push({pos:C.index,type:"close"});while((C=E.exec(i))!==null)S.push({pos:C.index,type:"else"});S.sort((P,R)=>P.pos-R.pos);for(let P of S)if(P.type==="open")x++;else if(P.type==="close")x--;else if(P.type==="else"&&x===0){y=P.pos;break}}let l;if(y!==-1){let x=i.slice(0,y),k=i.slice(y+5);l=`@if (${b})${k}@else ${x}@endif`}else l=`@if (!(${b}))${i}@endif`;n=n.substring(0,s)+l+n.substring(c+10),a=!0}}n=Xo(n,e,g),n=Jo(n,e,g),n=Go(n,e);let v=()=>{let a=hn(n);if(a.length===0)return!1;let f=Array(a.length);for(let r=a.length-1;r>=0;r--){let c=a[r];try{let i="",b=!1;for(let y of c.branches){if(b)break;if(y.type==="else")i=y.content,b=!0;else try{if(y.condition?hl(y.condition,e):!1)i=y.content,b=!0}catch(l){i=u(y.type==="if"?"If":"Elseif",`Error in @${y.type}(${y.condition}): ${l instanceof Error?l.message:String(l)}`,t.EVALUATION_ERROR),b=!0}}f[r]=i}catch(i){let b=i instanceof Error?i.message:String(i);f[r]=u("If",`Error processing @if block: ${b}`,t.EVALUATION_ERROR)}}let s=Array(a.length*2+1),o=0;for(let r=0;r<a.length;r++){let c=a[r];s[r*2]=n.slice(o,c.start),s[r*2+1]=f[r],o=c.end}return s[a.length*2]=n.slice(o),n=s.join(""),!0};while(!0){let a=n;if(!v())break;if(n===a)break}return n}function q(w){let e=0;while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!=="(")return null;e++;while(e<w.length&&/\s/.test(w[e]))e++;let g=w[e];if(g!=="'"&&g!=='"')return null;e++;let n=[];while(e<w.length){let v=w[e];if(v==="\\"&&e+1<w.length){n.push(w[e+1]),e+=2;continue}if(v===g){e++;break}n.push(v),e++}while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!==")")return null;return e++,{value:n.join(""),consumed:e}}function Go(w,e){let g=w;function n(s,o,r,c){let i=1,b=c,y=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),l=new RegExp(`@${r}(?![a-z])`,"g");while(b<s.length&&i>0){y.lastIndex=b,l.lastIndex=b;let x=y.exec(s),k=l.exec(s),h=x?x.index:1/0,E=k?k.index:1/0;if(h<E)i++,b=h+x[0].length;else if(E<1/0){if(i--,i===0)return E;b=E+k[0].length}else break}return-1}function v(s,o,r){let c=0,i=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),b=new RegExp(`@${r}(?![a-z])`,"g"),y=/@else(?![a-z])/g,l=[],x;while((x=i.exec(s))!==null)l.push({pos:x.index,type:"open"});while((x=b.exec(s))!==null)l.push({pos:x.index,type:"close"});while((x=y.exec(s))!==null)l.push({pos:x.index,type:"else"});l.sort((k,h)=>k.pos-h.pos);for(let k of l)if(k.type==="open")c++;else if(k.type==="close")c--;else if(k.type==="else"&&c===0)return k.pos;return-1}{let s=!0;while(s){s=!1;let o=g.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,c,i,b=g.slice(r+5),y=q(b);if(y)c=y.value,i=r+5+y.consumed;else i=r+5;let l=n(g,"auth","endauth",i);if(l===-1){console.warn(`[stx] @auth directive at position ${r} has no matching @endauth \u2014 the block was skipped.`);break}let x=g.slice(i,l),k=v(x,"auth","endauth"),h;if(!e.auth)h=!1;else h=c?L(`auth?.check && auth?.user?.[${c}]`,e):L("auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=h?S:C}else E=h?x:"";g=g.substring(0,r)+E+g.substring(l+8),s=!0}}{let s=!0;while(s){s=!1;let o=g.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,c,i,b=g.slice(r+6),y=q(b);if(y)c=y.value,i=r+6+y.consumed;else i=r+6;let l=n(g,"guest","endguest",i);if(l===-1){console.warn(`[stx] @guest directive at position ${r} has no matching @endguest \u2014 the block was skipped.`);break}let x=g.slice(i,l),k=v(x,"guest","endguest"),h;if(!e.auth)h=!0;else h=c?L(`!auth?.check || !auth?.user?.[${c}]`,e):L("!auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=h?S:C}else E=h?x:"";g=g.substring(0,r)+E+g.substring(l+9),s=!0}}function a(s,o,r){if(e.userCan&&typeof e.userCan[s]==="boolean")return e.userCan[s];if(e.permissions?.check&&typeof e.permissions.check==="function")try{let c=[s];if(o)c.push(o);if(r){let i=L(r,e);c.push(i)}return e.permissions.check(...c)}catch{return!1}return!1}function f(s){let o=s.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!o)return null;return{ability:o[1],type:o[2],id:o[3]?.trim(),paramsEnd:o[0].length}}for(let s of["can","cannot"]){let o=`end${s}`,r=s==="can"?"elsecan":"elsecannot",c=!0;while(c){c=!1;let i=g.match(new RegExp(`@${s}\\s*\\(`));if(!i||i.index===void 0)break;let b=i.index,y=g.slice(b+`@${s}`.length),l=f(y);if(!l)break;let x=b+`@${s}`.length+l.paramsEnd,k=n(g,s,o,x);if(k===-1){console.warn(`[stx] @${s} directive at position ${b} has no matching @${o} \u2014 the block was skipped.`);break}let h=g.slice(x,k),E=[],S=0,C=new RegExp(`@${s}\\s*\\(`,"g"),P=new RegExp(`@${o}(?![a-z])`,"g"),R=new RegExp(`@${r}\\s*\\(`,"g"),T=/@else(?![a-z])/g,_=[],M;while((M=C.exec(h))!==null)_.push({pos:M.index,type:"open"});while((M=P.exec(h))!==null)_.push({pos:M.index,type:"close"});while((M=R.exec(h))!==null)_.push({pos:M.index,type:"elseDirective"});while((M=T.exec(h))!==null)_.push({pos:M.index,type:"else"});_.sort((A,z)=>A.pos-z.pos);for(let A of _){if(A.type==="open"){S++;continue}if(A.type==="close"){S--;continue}if(S===0)E.push(A)}let I=[],F=0;for(let A=0;A<E.length;A++){let z=E[A];if(I.push({content:h.slice(F,z.pos),ability:void 0}),z.type==="elseDirective"){let D=h.slice(z.pos+`@${r}`.length),B=f(D);if(B){I[I.length-1]={content:h.slice(F,z.pos)},F=z.pos+`@${r}`.length+B.paramsEnd,I.push({content:"",ability:B.ability,type:B.type,id:B.id}),I.pop();let G=E[A+1],U=G?G.pos:h.length;I.push({content:h.slice(F,U),ability:B.ability,type:B.type,id:B.id}),F=U}}else F=z.pos+5}if(F<h.length){let A=I[I.length-1];if(E.length>0&&E[E.length-1].type==="else")I.push({content:h.slice(F),isFinalElse:!0});else if(I.length===0)I.push({content:h.slice(F)})}let O=a(l.ability,l.type,l.id),j=s==="can"?O:!O,V="";if(j)V=I[0]?.content||"";else{let A=!1;for(let z=1;z<I.length;z++){let D=I[z];if(D.isFinalElse){V=D.content,A=!0;break}if(D.ability){let B=a(D.ability,D.type,D.id);if(s==="can"?B:!B){V=D.content,A=!0;break}}}if(!A&&I.length>0){let z=I[I.length-1];if(z.isFinalElse)V=z.content}}g=g.substring(0,b)+V+g.substring(k+`@${o}`.length),c=!0}}return g}function Xo(w,e,g){let n=w;function v(a,f,s,o,r){let c=!0;while(c){c=!1;let i=new RegExp(`@${f}\\s*\\(`),b=a.match(i);if(!b||b.index===void 0)break;let y=b.index,l=rt(a,y+`@${f}`.length);if(!l)break;let x=l.endPos,k=Et(a,f,s,x);if(k===-1){console.warn(`[stx] @${f} directive at position ${y} has no matching @${s} \u2014 the block was skipped.`);break}let h=a.slice(x,k),E=l.expression,S=-1,C=0,P=0;while(P<h.length){let R=h.indexOf("@",P);if(R===-1)break;let T=h.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(T)){C++,P=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(T)){C--,P=R+1;continue}if(C===0&&/^@else(?![a-z])/.test(T)){S=R;break}P=R+1}try{let R=o(E.trim()),T;if(S!==-1){let _=h.slice(0,S),M=h.slice(S+5);T=R?_:M}else T=R?h:"";a=a.substring(0,y)+T+a.substring(k+`@${s}`.length),c=!0}catch(R){let T=R instanceof Error?R.message:String(R),_=u(r,`Error processing @${f} directive: ${T}`,t.EVALUATION_ERROR);a=a.substring(0,y)+_+a.substring(k+`@${s}`.length);break}}return a}return n=v(n,"isset","endisset",(a)=>{let f=L(a,e);return f!==void 0&&f!==null},"Isset"),n=v(n,"empty","endempty",(a)=>{let f=L(a,e);return f===void 0||f===null||f===""||f===0||f===!1||Array.isArray(f)&&f.length===0||typeof f==="object"&&f!==null&&Object.keys(f).length===0},"Empty"),n}function Jo(w,e,g){let n=w,v="development";function a(f,s,o,r){let c=new RegExp(`@${s}(?![a-z])`,"g"),i=new RegExp(`@${o}(?![a-z])`,"g"),b=new RegExp(`^@${s}(?![a-z])`),y=new RegExp(`^@${o}(?![a-z])`),l=f,x=!0;while(x){x=!1,c.lastIndex=0;let k=c.exec(l);if(!k)break;let h=k.index,E=h+k[0].length;if(s==="env"){let O=l.substring(E).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!O)break;E+=O[0].length,r=v===O[2]}let S=1,C=E,P=-1;while(S>0&&C<l.length){c.lastIndex=C,i.lastIndex=C;let O=c.exec(l),j=i.exec(l),V=O?O.index:1/0,A=j?j.index:1/0;if(V<A)S++,C=V+O[0].length;else if(A<1/0){if(S--,S===0){P=A;break}C=A+j[0].length}else break}if(P===-1){console.warn(`[stx] @${s} directive at position ${h} has no matching @${o} \u2014 the block was skipped.`);break}let R=l.substring(E,P),T=-1,_=0,M=0;while(M<R.length){let O=R.indexOf("@",M);if(O===-1)break;let j=R.substring(O);if(b.test(j)){_++,M=O+1;continue}if(y.test(j)){_--,M=O+1;continue}if(_===0&&/^@else(?![a-z])/.test(j)){T=O;break}M=O+1}let I;if(T!==-1){let O=R.slice(0,T),j=R.slice(T+5);I=r?O:j}else I=r?R:"";let F=`@${o}`.length;l=l.substring(0,h)+I+l.substring(P+F),x=!0}return l}return n=a(n,"env","endenv",!1),n=a(n,"production","endproduction",v==="production"),n=a(n,"development","enddevelopment",v==="development"),n=a(n,"staging","endstaging",v==="staging"),n=a(n,"testing","endtesting",v==="testing"),n}
|
|
3
|
-
export{
|
|
2
|
+
import{d,m,hl,p,t,u}from"./chunk-0tyyad6q.js";import{rt,Et,hn,ti}from"./chunk-311mrz2n.js";function L(w,e){try{let g=w.trim();if(m(g))return p(g,Object.keys(e))(...Object.values(e));else return d(g,e)}catch{return!1}}function Q(w,e,g){let n=w,v=!0;while(v){v=!1;let a=n.match(/@switch\s*\(/);if(!a||a.index===void 0)break;let f=a.index,s=ti(n,f);if(!s)break;try{let o;if(m(s.expression))o=p(s.expression,Object.keys(e))(...Object.values(e));else o=d(s.expression,e);let r="",c=!1;for(let i of s.cases)if(i.type==="default"){if(!c)r=i.content.trim()}else try{let b;if(i.value&&m(i.value))b=p(i.value,Object.keys(e))(...Object.values(e));else if(i.value)b=d(i.value,e);if(o===b){r=i.content.trim(),c=!0;break}}catch{continue}n=n.substring(0,f)+r+n.substring(s.end),v=!0}catch(o){let r=o instanceof Error?o.message:String(o),c=u("Switch",`Error evaluating @switch expression: ${r}`,t.EVALUATION_ERROR);n=n.substring(0,f)+c+n.substring(s.end);break}}return n}function H(w){let e=[];return{masked:w.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(n)=>(e.push(n),`\x00stx-script-${e.length-1}\x00`)),scripts:e}}function J(w,e){if(e.length===0)return w;return w.replace(/\u0000stx-script-(\d+)\u0000/g,(g,n)=>e[Number(n)]??g)}function ue(w,e,g){let{masked:n,scripts:v}=H(w);return J(K(n,e,g),v)}function K(w,e,g){let n=w;n=Q(n,e,g);{let a=!0;while(a){a=!1;let f=n.match(/@unless\s*\(/);if(!f||f.index===void 0)break;let s=f.index,o=rt(n,s+7);if(!o)break;let r=o.endPos,c=Et(n,"unless","endunless",r);if(c===-1){console.warn(`[stx] @unless directive at position ${s} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let i=n.slice(r,c),b=o.expression,y=-1;{let x=0,k=/@(?:if|unless)\s*\(/g,h=/@(?:endif|endunless)(?![a-z])/g,E=/@else(?![a-z])/g,S=[],C;while((C=k.exec(i))!==null)S.push({pos:C.index,type:"open"});while((C=h.exec(i))!==null)S.push({pos:C.index,type:"close"});while((C=E.exec(i))!==null)S.push({pos:C.index,type:"else"});S.sort((P,R)=>P.pos-R.pos);for(let P of S)if(P.type==="open")x++;else if(P.type==="close")x--;else if(P.type==="else"&&x===0){y=P.pos;break}}let l;if(y!==-1){let x=i.slice(0,y),k=i.slice(y+5);l=`@if (${b})${k}@else ${x}@endif`}else l=`@if (!(${b}))${i}@endif`;n=n.substring(0,s)+l+n.substring(c+10),a=!0}}n=Xo(n,e,g),n=Jo(n,e,g),n=Go(n,e);let v=()=>{let a=hn(n);if(a.length===0)return!1;let f=Array(a.length);for(let r=a.length-1;r>=0;r--){let c=a[r];try{let i="",b=!1;for(let y of c.branches){if(b)break;if(y.type==="else")i=y.content,b=!0;else try{if(y.condition?hl(y.condition,e):!1)i=y.content,b=!0}catch(l){i=u(y.type==="if"?"If":"Elseif",`Error in @${y.type}(${y.condition}): ${l instanceof Error?l.message:String(l)}`,t.EVALUATION_ERROR),b=!0}}f[r]=i}catch(i){let b=i instanceof Error?i.message:String(i);f[r]=u("If",`Error processing @if block: ${b}`,t.EVALUATION_ERROR)}}let s=Array(a.length*2+1),o=0;for(let r=0;r<a.length;r++){let c=a[r];s[r*2]=n.slice(o,c.start),s[r*2+1]=f[r],o=c.end}return s[a.length*2]=n.slice(o),n=s.join(""),!0};while(!0){let a=n;if(!v())break;if(n===a)break}return n}function q(w){let e=0;while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!=="(")return null;e++;while(e<w.length&&/\s/.test(w[e]))e++;let g=w[e];if(g!=="'"&&g!=='"')return null;e++;let n=[];while(e<w.length){let v=w[e];if(v==="\\"&&e+1<w.length){n.push(w[e+1]),e+=2;continue}if(v===g){e++;break}n.push(v),e++}while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!==")")return null;return e++,{value:n.join(""),consumed:e}}function Go(w,e){let g=w;function n(s,o,r,c){let i=1,b=c,y=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),l=new RegExp(`@${r}(?![a-z])`,"g");while(b<s.length&&i>0){y.lastIndex=b,l.lastIndex=b;let x=y.exec(s),k=l.exec(s),h=x?x.index:1/0,E=k?k.index:1/0;if(h<E)i++,b=h+x[0].length;else if(E<1/0){if(i--,i===0)return E;b=E+k[0].length}else break}return-1}function v(s,o,r){let c=0,i=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),b=new RegExp(`@${r}(?![a-z])`,"g"),y=/@else(?![a-z])/g,l=[],x;while((x=i.exec(s))!==null)l.push({pos:x.index,type:"open"});while((x=b.exec(s))!==null)l.push({pos:x.index,type:"close"});while((x=y.exec(s))!==null)l.push({pos:x.index,type:"else"});l.sort((k,h)=>k.pos-h.pos);for(let k of l)if(k.type==="open")c++;else if(k.type==="close")c--;else if(k.type==="else"&&c===0)return k.pos;return-1}{let s=!0;while(s){s=!1;let o=g.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,c,i,b=g.slice(r+5),y=q(b);if(y)c=y.value,i=r+5+y.consumed;else i=r+5;let l=n(g,"auth","endauth",i);if(l===-1){console.warn(`[stx] @auth directive at position ${r} has no matching @endauth \u2014 the block was skipped.`);break}let x=g.slice(i,l),k=v(x,"auth","endauth"),h;if(!e.auth)h=!1;else h=c?L(`auth?.check && auth?.user?.[${c}]`,e):L("auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=h?S:C}else E=h?x:"";g=g.substring(0,r)+E+g.substring(l+8),s=!0}}{let s=!0;while(s){s=!1;let o=g.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,c,i,b=g.slice(r+6),y=q(b);if(y)c=y.value,i=r+6+y.consumed;else i=r+6;let l=n(g,"guest","endguest",i);if(l===-1){console.warn(`[stx] @guest directive at position ${r} has no matching @endguest \u2014 the block was skipped.`);break}let x=g.slice(i,l),k=v(x,"guest","endguest"),h;if(!e.auth)h=!0;else h=c?L(`!auth?.check || !auth?.user?.[${c}]`,e):L("!auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=h?S:C}else E=h?x:"";g=g.substring(0,r)+E+g.substring(l+9),s=!0}}function a(s,o,r){if(e.userCan&&typeof e.userCan[s]==="boolean")return e.userCan[s];if(e.permissions?.check&&typeof e.permissions.check==="function")try{let c=[s];if(o)c.push(o);if(r){let i=L(r,e);c.push(i)}return e.permissions.check(...c)}catch{return!1}return!1}function f(s){let o=s.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!o)return null;return{ability:o[1],type:o[2],id:o[3]?.trim(),paramsEnd:o[0].length}}for(let s of["can","cannot"]){let o=`end${s}`,r=s==="can"?"elsecan":"elsecannot",c=!0;while(c){c=!1;let i=g.match(new RegExp(`@${s}\\s*\\(`));if(!i||i.index===void 0)break;let b=i.index,y=g.slice(b+`@${s}`.length),l=f(y);if(!l)break;let x=b+`@${s}`.length+l.paramsEnd,k=n(g,s,o,x);if(k===-1){console.warn(`[stx] @${s} directive at position ${b} has no matching @${o} \u2014 the block was skipped.`);break}let h=g.slice(x,k),E=[],S=0,C=new RegExp(`@${s}\\s*\\(`,"g"),P=new RegExp(`@${o}(?![a-z])`,"g"),R=new RegExp(`@${r}\\s*\\(`,"g"),T=/@else(?![a-z])/g,_=[],M;while((M=C.exec(h))!==null)_.push({pos:M.index,type:"open"});while((M=P.exec(h))!==null)_.push({pos:M.index,type:"close"});while((M=R.exec(h))!==null)_.push({pos:M.index,type:"elseDirective"});while((M=T.exec(h))!==null)_.push({pos:M.index,type:"else"});_.sort((A,z)=>A.pos-z.pos);for(let A of _){if(A.type==="open"){S++;continue}if(A.type==="close"){S--;continue}if(S===0)E.push(A)}let I=[],F=0;for(let A=0;A<E.length;A++){let z=E[A];if(I.push({content:h.slice(F,z.pos),ability:void 0}),z.type==="elseDirective"){let D=h.slice(z.pos+`@${r}`.length),B=f(D);if(B){I[I.length-1]={content:h.slice(F,z.pos)},F=z.pos+`@${r}`.length+B.paramsEnd,I.push({content:"",ability:B.ability,type:B.type,id:B.id}),I.pop();let G=E[A+1],U=G?G.pos:h.length;I.push({content:h.slice(F,U),ability:B.ability,type:B.type,id:B.id}),F=U}}else F=z.pos+5}if(F<h.length){let A=I[I.length-1];if(E.length>0&&E[E.length-1].type==="else")I.push({content:h.slice(F),isFinalElse:!0});else if(I.length===0)I.push({content:h.slice(F)})}let O=a(l.ability,l.type,l.id),j=s==="can"?O:!O,V="";if(j)V=I[0]?.content||"";else{let A=!1;for(let z=1;z<I.length;z++){let D=I[z];if(D.isFinalElse){V=D.content,A=!0;break}if(D.ability){let B=a(D.ability,D.type,D.id);if(s==="can"?B:!B){V=D.content,A=!0;break}}}if(!A&&I.length>0){let z=I[I.length-1];if(z.isFinalElse)V=z.content}}g=g.substring(0,b)+V+g.substring(k+`@${o}`.length),c=!0}}return g}function Xo(w,e,g){let n=w;function v(a,f,s,o,r){let c=!0;while(c){c=!1;let i=new RegExp(`@${f}\\s*\\(`),b=a.match(i);if(!b||b.index===void 0)break;let y=b.index,l=rt(a,y+`@${f}`.length);if(!l)break;let x=l.endPos,k=Et(a,f,s,x);if(k===-1){console.warn(`[stx] @${f} directive at position ${y} has no matching @${s} \u2014 the block was skipped.`);break}let h=a.slice(x,k),E=l.expression,S=-1,C=0,P=0;while(P<h.length){let R=h.indexOf("@",P);if(R===-1)break;let T=h.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(T)){C++,P=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(T)){C--,P=R+1;continue}if(C===0&&/^@else(?![a-z])/.test(T)){S=R;break}P=R+1}try{let R=o(E.trim()),T;if(S!==-1){let _=h.slice(0,S),M=h.slice(S+5);T=R?_:M}else T=R?h:"";a=a.substring(0,y)+T+a.substring(k+`@${s}`.length),c=!0}catch(R){let T=R instanceof Error?R.message:String(R),_=u(r,`Error processing @${f} directive: ${T}`,t.EVALUATION_ERROR);a=a.substring(0,y)+_+a.substring(k+`@${s}`.length);break}}return a}return n=v(n,"isset","endisset",(a)=>{let f=L(a,e);return f!==void 0&&f!==null},"Isset"),n=v(n,"empty","endempty",(a)=>{let f=L(a,e);return f===void 0||f===null||f===""||f===0||f===!1||Array.isArray(f)&&f.length===0||typeof f==="object"&&f!==null&&Object.keys(f).length===0},"Empty"),n}function Jo(w,e,g){let n=w,v="development";function a(f,s,o,r){let c=new RegExp(`@${s}(?![a-z])`,"g"),i=new RegExp(`@${o}(?![a-z])`,"g"),b=new RegExp(`^@${s}(?![a-z])`),y=new RegExp(`^@${o}(?![a-z])`),l=f,x=!0;while(x){x=!1,c.lastIndex=0;let k=c.exec(l);if(!k)break;let h=k.index,E=h+k[0].length;if(s==="env"){let O=l.substring(E).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!O)break;E+=O[0].length,r=v===O[2]}let S=1,C=E,P=-1;while(S>0&&C<l.length){c.lastIndex=C,i.lastIndex=C;let O=c.exec(l),j=i.exec(l),V=O?O.index:1/0,A=j?j.index:1/0;if(V<A)S++,C=V+O[0].length;else if(A<1/0){if(S--,S===0){P=A;break}C=A+j[0].length}else break}if(P===-1){console.warn(`[stx] @${s} directive at position ${h} has no matching @${o} \u2014 the block was skipped.`);break}let R=l.substring(E,P),T=-1,_=0,M=0;while(M<R.length){let O=R.indexOf("@",M);if(O===-1)break;let j=R.substring(O);if(b.test(j)){_++,M=O+1;continue}if(y.test(j)){_--,M=O+1;continue}if(_===0&&/^@else(?![a-z])/.test(j)){T=O;break}M=O+1}let I;if(T!==-1){let O=R.slice(0,T),j=R.slice(T+5);I=r?O:j}else I=r?R:"";let F=`@${o}`.length;l=l.substring(0,h)+I+l.substring(P+F),x=!0}return l}return n=a(n,"env","endenv",!1),n=a(n,"production","endproduction",v==="production"),n=a(n,"development","enddevelopment",v==="development"),n=a(n,"staging","endstaging",v==="staging"),n=a(n,"testing","endtesting",v==="testing"),n}
|
|
3
|
+
export{ue,Go,Xo,Jo};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{it}from"./chunk-
|
|
2
|
+
import{it}from"./chunk-dy7vqv1x.js";import{St,Xn}from"./chunk-mnx6njd4.js";import{Dr,Mr,Lr,Br,Re}from"./chunk-0tyyad6q.js";import{Fe,vn,pl,fl}from"./chunk-kgh1xsfe.js";import{B}from"./chunk-60yppcbb.js";import{Pi}from"./chunk-h8h97bcc.js";import{x}from"./chunk-za61jaep.js";import{i}from"./chunk-tdd3765y.js";import{U,a}from"./chunk-095cn3p0.js";import{Mc}from"./chunk-rw5492e2.js";import{Ln,jn,Je,Pe,xa,Sa,Bn}from"./chunk-f3d1y318.js";import{fn,jo}from"./chunk-xsbaha1z.js";import{Fn}from"./chunk-3z1mmar2.js";import{on,sr,or}from"./chunk-ymdw4fhd.js";import{Q}from"./chunk-gj16gta9.js";import m from"fs";import c from"path";import{createHash as Y}from"crypto";function I(n){return Y("sha256").update(n).digest("hex").slice(0,8)}function W(n=!1){let l=n?Xn():St(),o=I(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function J(){let n=it(),l=I(n);return{content:n,filename:`router.${l}.js`,hash:l}}import V 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 q(n,l,o={}){let r=V.resolve(n),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);pl();let _={};try{_=await a(o.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))y.push(g[2])}let u=new Set(y.flatMap((R)=>Fe(R))),{context:D}=te({__filename:r,__dirname:V.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...U,..._,...o,buildMode:"compile",strict:!1},f=await i(e,D,r,T,A),w=Ln(f)+jn(f)+Je(f),j=fl();return{route:l,sourceFile:n,html:f,fragment:w,placeholders:j,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(A),contentHash:S,status:vn(e),streamTemplates:D.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function X(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 y=m.readdirSync(S,{withFileTypes:!0});for(let d of y){if(re.has(d.name))continue;let g=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function wm(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"),y=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=Re(e.app?.head,{known:Br,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=Fn(A),f=n.serverApi??e.serverApi,w=typeof f==="object"?f:{};if(f)fn(o,w);if(e.runtimeConfig)B(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=Q(o,{pagesDirs:e._layerPageDirs}),Z=["components","layouts","partials"],P=R.filter((s)=>!Z.some((h)=>s.pattern.startsWith(`/${h}/`)||s.pattern===`/${h}`));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=W(n.debug),b=J();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",b.filename),b.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${b.filename} (${(b.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let M=[],H=[];for(let s of P){let h=T(s.pattern),O=h.rendering==="prerender";if(O&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await q(s.filePath,s.pattern,{configDir:o,componentsDir:S,partialsDir:_,layoutsDir:y,debug:n.debug});if(M.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,b.filename),t.html=Lr(t.html,g,{bodyScripts:[`<script src="/__stx/${b.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=Dr(t.html,u);if(g.htmlAttrs)t.html=Mr(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 G=p[1];t.html=t.html.replace(" "+G,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${G}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await x(t.html),O){let p=await Bn(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=Pe(t.html,D,!0);let K=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),L=c.join("server","pages",`${K}.compiled.json`),z=c.join("server","fragments",`${K}.html`);await Bun.write(c.join(r,L),JSON.stringify(t,null,2)),await Bun.write(c.join(r,z),t.fragment),H.push({pattern:s.pattern,compiledPath:L,fragmentPath:z,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:O}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(h).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let k=c.resolve(o,d);if(m.existsSync(k)){let{copied:s,bytes:h}=X(k,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${d}/`)}let E=or(o);if(E){let{copied:s,bytes:h}=X(E,c.join(r,"public",sr));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${on}/`)}let F={runtime:v.filename,router:b.filename},C=xa(H,F,r);if(C.routeRules=A,C.routerContainer=D,f)C.apiRoutes=await jo(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await Pi(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Mc(e._layerGraph),null,2));Sa(C,r);let N=Date.now()-l;return console.log(`
|
|
3
3
|
[stx build] Done in ${N}ms \u2014 ${M.length} pages compiled`),{pageCount:M.length,assets:F,outputDir:r,duration:N}}
|
|
4
4
|
export{wm};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ur,po,nm,Bl,fo}from"./chunk-
|
|
2
|
+
import{Ur,po,nm,Bl,fo}from"./chunk-ajy9tjct.js";export{nm as buildModuleRegistryScript,fo as buildSharedModuleRegistries,Bl as exportsMutableBinding,Ur as registeredModuleIdsIn,po as registeredModuleNamesIn};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ft,El}from"./chunk-qjey0jk6.js";import{N}from"./chunk-farh4p7f.js";import{
|
|
3
|
-
`)}else{if(!
|
|
2
|
+
import{ft,El}from"./chunk-qjey0jk6.js";import{N}from"./chunk-farh4p7f.js";import{K,Bs,o,de,J,w,Uc,zt,kn,Ve,Ue}from"./chunk-kgh1xsfe.js";import{mr}from"./chunk-gj16gta9.js";import{V}from"./chunk-4068rmzv.js";import{hn}from"./chunk-311mrz2n.js";var G=`(?:"[^"]*"|'[^']*'|[^>"'])*`,X=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,H=65536,Q=4,O=new Map;function Zh(){O.clear()}function q(e){let c=[];for(let t of w(e,J)){let n=t.token.match(/^<script\b([^>]*)>/i),s=t.token.match(/<\/script\s*>$/i);if(!n||!s)continue;let u=n[0].length,f=t.token.length-s[0].length;c.push(Object.freeze({fullMatch:t.token,attrs:n[1],body:t.token.slice(u,f),start:t.start,end:t.end}))}return c}function vs(e,c={}){let t=e.length>=H,n=t?O.get(e):void 0;if(n===void 0){if(n=q(e),t)Uc(O,Q),O.set(e,n)}let s=c.skipAttrs;if(!s)return n.slice();let u=[];for(let f of n)if(s.lastIndex=0,!s.test(f.attrs))u.push(f);return u}function Yo(e){let c=e.trim(),t=c.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(t){let s=t[1].trim(),u=t[2].trim(),{itemVar:f,indexVar:i}=z(u);if(f)return{style:"as",iterable:s,itemVar:f,indexVar:i}}let n=c.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(n){let s=n[1].trim(),u=n[2].trim(),{itemVar:f,indexVar:i}=z(s);if(f)return{style:"in",iterable:u,itemVar:f,indexVar:i}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function z(e){let c=e.trim(),t=c.match(/^(\w+)\s*=>\s*(\w+)$/);if(t)return{itemVar:t[2],indexVar:t[1]};let n=c.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(n)return{itemVar:n[1],indexVar:n[2]||null};let s=c.match(/^(\w+)\s*,\s*(\w+)$/);if(s)return{itemVar:s[1],indexVar:s[2]};let u=c.match(/^(\w+)$/);if(u)return{itemVar:u[1],indexVar:null};return{itemVar:null,indexVar:null}}function xs(e,c){return El(e,c)}function Y(e){let c=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,t=0,n;while((n=c.exec(e))!==null){let s=n[1];if(s.startsWith("if"))t++;else if(s==="endif")t--;else if(t===0)return!0}return!1}function fr(e){let c=new Set,t=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,n=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel)\s*(?:<[^>]*>)?\s*\(/g,s;while((s=t.exec(e))!==null){let u=s[1],f;while((f=n.exec(u))!==null)c.add(f[1])}return c}function ee(e){if(!/[:@]for\s*=/.test(e)&&!/\bx-for\s*=/.test(e))return[];let c=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${G})>`,"iy"),t=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,n=w(e,(u,f)=>{c.lastIndex=f;let i=c.exec(u);if(!i||i.index!==f||!t.test(i[2]))return-1;return c.lastIndex}),s=[];for(let u of n){c.lastIndex=0;let f=c.exec(u.token);if(!f)continue;let i=f[2].match(t),p=Yo(i?.[1]??i?.[2]??""),m=[p.itemVar,p.indexVar].filter(Boolean);if(m.length===0)continue;let r=f[1],g=/\/\s*>$/.test(u.token)||P.has(r.toLowerCase())?u.end:D(e,u.start,r,u.end);if(g!==-1)s.push({start:u.start,end:g,vars:new Set(m)})}return s}var W=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);function te(e){return e.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function B(e,c,t,n){if(!e)return!1;let s=te(e),u=!1,f=!1,i=!1,p=/([a-zA-Z_$][\w$]*)/g,m;while((m=p.exec(s))!==null){let l=m[1];if(s.slice(0,m.index).trimEnd().endsWith("."))continue;if(W.has(l))continue;if(c.has(l)||n?.has(l))u=!0;else if(t&&l in t)f=!0}let r=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,a;while((a=r.exec(s))!==null){let l=a[1];if(s.slice(0,a.index).trimEnd().endsWith("."))continue;if(W.has(l)||t&&l in t)continue;i=!0}return(u||i)&&!f}function M(e,c,t){let n=t===void 0?` ${c}`:` ${c}="${t.replace(/"/g,""")}"`,s=e.trim(),u=s.match(X);if(u&&ne(u[3],u[1])){let[,f,i,p]=u;return`<${f}${i}${n}>${p}</${f}>`}return`<template${n}>${s}</template>`}function ne(e,c){let t=new RegExp(`<(/)?${c}(?=[\\s/>])`,"gi"),n=0,s;while((s=t.exec(e))!==null)if(s[1]){if(n--,n<0)return!1}else n++;return!0}function Zo(e,c){let t=fr(e);function n(s){let u=s,f=ee(s),i=(a)=>{let g=new Set;for(let l of f)if(a>l.start&&a<l.end)for(let d of l.vars)g.add(d);return g},p=/@if\s*\(/g,m,r=[];while((m=p.exec(u))!==null){let a=m.index,g=a+m[0].length,l=1,d=g;while(d<u.length&&l>0){if(u[d]==="(")l++;else if(u[d]===")")l--;d++}if(l!==0)continue;let b=u.substring(g,d-1).trim(),S=d,E=1,y=S,x=/@(if\s*\(|endif)/g;x.lastIndex=S;let h;while((h=x.exec(u))!==null)if(h[1].startsWith("if"))E++;else if(h[1]==="endif"){if(E--,E===0){y=h.index+h[0].length;break}}if(E!==0)continue;let R=u.substring(S,y-6).trim(),A;if(Y(R)){let C=hn(u.substring(a,y));if(C.length===0)continue;let T=C[0].branches.filter((_)=>_.type!=="else"),k=i(a);if(!(T.length>0&&T.every((_)=>B(_.condition,t,c,k))))continue;A=C[0].branches.map((_)=>{let L=n(_.content);if(_.type==="elseif")return M(L,"@else-if",_.condition??"");if(_.type==="else")return M(L,"@else");return M(L,"@if",_.condition??"")}).join(`
|
|
3
|
+
`)}else{if(!B(b,t,c,i(a)))continue;A=M(n(R),"@if",b)}r.push({start:a,end:y,replacement:A}),p.lastIndex=y}for(let a=r.length-1;a>=0;a--){let{start:g,end:l,replacement:d}=r[a];u=u.substring(0,g)+d+u.substring(l)}return u}return n(e)}function se(e){let c=e.trim();if(c==="")return;if(c==="true")return!0;if(c==="false")return!1;if(c==="null")return!1;if(c==="undefined")return!1;if(c==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(c)){let s=Number(c);return s!==0&&!Number.isNaN(s)}let t=c.match(/^'((?:\\.|[^'\\])*)'$/);if(t)return t[1].length>0;let n=c.match(/^"((?:\\.|[^"\\])*)"$/);if(n)return n[1].length>0;return}var P=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Z=/<(script|style)\b/iy,re=/<\/script/gi,ie=/<\/style/gi;function D(e,c,t,n){if(P.has(t.toLowerCase()))return n;let s=t.toLowerCase(),u=e.length,f=1,i=n;while(i<u){let p=e.indexOf("<",i);if(p===-1)return-1;if(i=p,e.startsWith("<!--",i)){let g=e.indexOf("-->",i+4);if(g===-1)return-1;i=g+3;continue}Z.lastIndex=i;let m=Z.exec(e);if(m){let g=e.indexOf(">",i);if(g===-1)return-1;if(e[g-1]==="/"){i=g+1;continue}let l=m[1].toLowerCase()==="script"?re:ie;l.lastIndex=i;let d=l.exec(e);if(d===null)return-1;let b=e.indexOf(">",d.index);if(b===-1)return-1;i=b+1;continue}if(e[i+1]==="/"){let g=/^<\/([a-z][\w-]*)\s*>/i.exec(e.slice(i,i+64));if(!g){i++;continue}if(g[1].toLowerCase()===s){if(f--,i+=g[0].length,f===0)return i;continue}i+=g[0].length;continue}let r=/^<([a-z][\w-]*)\b/i.exec(e.slice(i,i+64));if(!r){i++;continue}let a=e.indexOf(">",i);if(a===-1)return-1;if(r[1].toLowerCase()===s){let g=e.slice(i,a+1);if(!(/\/\s*>$/.test(g)||P.has(s)))f++}i=a+1}return-1}var oe=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function ce(e,c){let t=c,n=e.length;for(;;){while(t<n&&e[t]!=="<")t++;if(t>=n)return!1;if(e.startsWith("<!--",t)){let f=e.indexOf("-->",t+4);if(f===-1)return!1;t=f+3;continue}break}if(e[t+1]==="/")return!1;let s=e.indexOf(">",t);if(s===-1)return!1;let u=e.slice(t,s+1);return oe.test(u)}function Qo(e){if(!e.includes(":if")&&!e.includes(":show")&&!e.includes("x-if")&&!e.includes("x-show")&&!e.includes("@if=")&&!e.includes("@show="))return e;let c=[],t=/<([a-zA-Z][\w-]*)/y,n=/\s/,s=new Set([":if",":show","x-if","x-show","@if","@show"]);w(e,(r,a)=>{t.lastIndex=a;let g=t.exec(r);if(!g||/^(?:script|style)$/i.test(g[1]))return-1;let l=t.lastIndex,d;while(l<r.length){let b=l;while(l<r.length&&n.test(r[l]))l++;let S=l;if(r[S]==="/"){S++;while(S<r.length&&n.test(r[S]))S++}if(r[S]===">"){if(d)c.push({start:a,end:S+1,tag:g[1],...d});return-1}if(l===b)return-1;let E=l;while(l<r.length&&!n.test(r[l])&&r[l]!=="="&&r[l]!==">")l++;if(l===E)return-1;let y=r.slice(E,l);if(y.startsWith("@")&&y.includes("("))return-1;let x=l,h=l;while(h<r.length&&n.test(r[h]))h++;if(r[h]!=="="){l=x;continue}h++;while(h<r.length&&n.test(r[h]))h++;let R=r[h];if(R==='"'||R==="'"){let A=r.indexOf(R,h+1);if(A===-1)return-1;if(!d&&R==='"'&&s.has(y))d={attrName:y,attrStart:b,attrEnd:A+1,value:r.slice(h+1,A)};l=A+1}else{l=h;while(l<r.length&&!n.test(r[l])&&r[l]!==">")l++}}return-1});let u=[],f=-1;for(let r of c){let{start:a,end:g,tag:l,attrName:d,value:b}=r;if(a<f)continue;let S=se(b);if(S===void 0)continue;let x=/\/\s*>$/.test(e.slice(a,g))||P.has(l.toLowerCase())?g:D(e,a,l,g);if(x===-1)continue;if((d===":if"||d==="x-if"||d==="@if")&&ce(e,x))continue;if(S===!0){let R=e.slice(a,r.attrStart)+e.slice(r.attrEnd,g);u.push({start:a,end:g,replacement:R});continue}u.push({start:a,end:x,replacement:""}),f=x}if(u.length===0)return e;u.sort((r,a)=>r.start-a.start);let i=[],p=-1;for(let r of u){if(r.start<p)continue;i.push(r),p=r.end}let m=e;for(let r=i.length-1;r>=0;r--){let{start:a,end:g,replacement:l}=i[r];m=m.substring(0,a)+l+m.substring(g)}return m}var F=[":for","@for","x-for"];function Zf(e){let c=/(\s)((?::|@|x-|v-)[\w.:-]+)\s*=\s*"([^"]*\{\{[^"]*)"/g;return e.replace(c,(t,n,s,u)=>{let f=u.replace(/'((?:[^'\\]|\\.)*)'/g,(i,p)=>{if(!p.includes("{{"))return i;return`\`${p.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{\s*([^}]+?)\s*\}\}/g,(r,a)=>`\${${a}}`)}\``});return`${n}${s}="${f}"`})}function Ss(e,c){if(!c||Object.keys(c).length===0)return e;if(!F.some((i)=>e.includes(`${i}=`)))return e;let t=fr(e);if(Array.isArray(c.__stx_client_signal_names)){for(let i of c.__stx_client_signal_names)if(typeof i==="string")t.add(i)}let n=e,s=[],u=/<([a-zA-Z][\w-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g,f;while((f=u.exec(n))!==null){let[i,p,m]=f,r=f.index,a=r+i.length,g=F.map((A)=>({attr:A,m:new RegExp(`\\s${A}="([^"]*)"`).exec(m)})).find((A)=>A.m!==null);if(!g||!g.m)continue;let l=Yo(g.m[1]);if(!l.iterable||!l.itemVar)continue;let d=l.iterable.trim().split(/[.[(]/)[0].trim();if(!d||t.has(d)||!(d in c))continue;let b=D(n,r,p,a);if(b===-1)continue;let S=m.replace(new RegExp(`\\s${g.attr}="[^"]*"`),"").replace(/\s:key="[^"]*"/,"").replace(/\sx-cloak(?=\s|$)/,""),E=n.slice(a,b-`</${p}>`.length),y={...c,[l.itemVar]:void 0};if(l.indexVar)y[l.indexVar]=void 0;let x=Ss(E,y),h=l.indexVar?`${l.iterable} as ${l.indexVar} => ${l.itemVar}`:`${l.iterable} as ${l.itemVar}`,R=p.toLowerCase()==="template"?x:`<${p}${S}>${x}</${p}>`;s.push({start:r,end:b,replacement:`@foreach(${h})${R}@endforeach`}),u.lastIndex=b}for(let i=s.length-1;i>=0;i--){let{start:p,end:m,replacement:r}=s[i];n=n.slice(0,p)+r+n.slice(m)}return n}function ks(e,c){let t=e,n=/@(for|foreach)\s*\(/g,s,u=[],f=[];while((s=n.exec(t))!==null){let i=s[1],p=s.index,m=p+s[0].length,r=1,a=m;while(a<t.length&&r>0){if(t[a]==="(")r++;else if(t[a]===")")r--;a++}if(r!==0)continue;let g=t.substring(m,a-1).trim(),l=a,d=Yo(g),b=i==="for"?"@endfor":"@endforeach",S=1,E=l,y=i==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${i}\\s*\\(|end${i})`,"g");y.lastIndex=l;let x;while((x=y.exec(t))!==null)if(x[1].startsWith(i))S++;else if(S--,S===0){E=x.index+x[0].length;break}if(S!==0)continue;let h=()=>{let v=[d.itemVar,d.indexVar].filter(Boolean);if(v.length)f.push({start:p,end:E,vars:v})};if(d.iterable){let v=d.iterable.trim();if(v.startsWith("[")||v.startsWith("{")||v.startsWith("'")||v.startsWith('"')||v.startsWith("`")||/^-?\d/.test(v)){h();continue}let I=v.split(/[.[(]/)[0].trim(),_=c?I in c:!1,L=f.some((j)=>p>j.start&&p<j.end&&j.vars.includes(I));if(I&&(_||L)){h();continue}}if(d.style==="as")g=d.indexVar?`(${d.itemVar}, ${d.indexVar}) in ${d.iterable}`:`${d.itemVar} in ${d.iterable}`;let R=t.substring(l,E-b.length).trim(),A=c?{...c}:{};if(d.itemVar)delete A[d.itemVar];if(d.indexVar)delete A[d.indexVar];let C=Zf(ks(R,A)),T=C.match(X),k;if(T){let[,v,I,_]=T;k=`<${v}${I} @for="${g}">${_}</${v}>`}else k=`<template @for="${g}">${C}</template>`;u.push({start:p,end:E,replacement:k}),n.lastIndex=E}for(let i=u.length-1;i>=0;i--){let{start:p,end:m,replacement:r}=u[i];t=t.substring(0,p)+r+t.substring(m)}return t}function ae(e){let c=new Set,t=[],n=0,s=0,u=e.length,f=(r)=>{let a=n+1;while(a<u){let g=e[a];if(g==="\\"){a+=2;continue}if(g===r)return a+1;a++}return u},i=()=>{let r=n+2;while(r<u&&e[r]!==`
|
|
4
4
|
`)r++;return r},p=()=>{let r=n+2;while(r<u-1){if(e[r]==="*"&&e[r+1]==="/")return r+2;r++}return u},m=(r)=>{let a=r,g=0;while(a<u){let l=e[a];if(l==="/"&&e[a+1]==="/"){let d=a+2;while(d<u&&e[d]!==`
|
|
5
|
-
`)d++;a=d;continue}if(l==="/"&&e[a+1]==="*"){let d=a+2;while(d<u-1&&!(e[d]==="*"&&e[d+1]==="/"))d++;a=d+2;continue}if(l==='"'||l==="'"||l==="`"){let d=a+1;while(d<u){if(e[d]==="\\"){d+=2;continue}if(e[d]===l){d++;break}d++}a=d;continue}if(l==="("||l==="["||l==="{"){g++,a++;continue}if(l===")"||l==="]"||l==="}"){g--,a++;continue}if(l===";"&&g===0)return a+1;a++}return u};while(n<u){let r=e[n];if(r==="/"&&e[n+1]==="/"){let a=i();t.push(e.slice(n,a)),n=a;continue}if(r==="/"&&e[n+1]==="*"){let a=p();t.push(e.slice(n,a)),n=a;continue}if(r==='"'||r==="'"||r==="`"){let a=f(r);t.push(e.slice(n,a)),n=a;continue}if(r==="{"){s++,t.push(r),n++;continue}if(r==="}"){s--,t.push(r),n++;continue}if(s===0){let a=n>0?e[n-1]:"";if(a===""||/\s/.test(a)||a===";"||a==="}"||a==="{"){let l=e.slice(n).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(l){let d=l[2],b=m(n+l[0].length);if(c.has(d)){t.push(`/* stx: deduped const ${d} */`),n=b;continue}c.add(d),t.push(e.slice(n,b)),n=b;continue}}}t.push(r),n++}return t.join("")}var le=new Set(["script","style","html","head","meta","link","title","!doctype"]);function
|
|
5
|
+
`)d++;a=d;continue}if(l==="/"&&e[a+1]==="*"){let d=a+2;while(d<u-1&&!(e[d]==="*"&&e[d+1]==="/"))d++;a=d+2;continue}if(l==='"'||l==="'"||l==="`"){let d=a+1;while(d<u){if(e[d]==="\\"){d+=2;continue}if(e[d]===l){d++;break}d++}a=d;continue}if(l==="("||l==="["||l==="{"){g++,a++;continue}if(l===")"||l==="]"||l==="}"){g--,a++;continue}if(l===";"&&g===0)return a+1;a++}return u};while(n<u){let r=e[n];if(r==="/"&&e[n+1]==="/"){let a=i();t.push(e.slice(n,a)),n=a;continue}if(r==="/"&&e[n+1]==="*"){let a=p();t.push(e.slice(n,a)),n=a;continue}if(r==='"'||r==="'"||r==="`"){let a=f(r);t.push(e.slice(n,a)),n=a;continue}if(r==="{"){s++,t.push(r),n++;continue}if(r==="}"){s--,t.push(r),n++;continue}if(s===0){let a=n>0?e[n-1]:"";if(a===""||/\s/.test(a)||a===";"||a==="}"||a==="{"){let l=e.slice(n).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(l){let d=l[2],b=m(n+l[0].length);if(c.has(d)){t.push(`/* stx: deduped const ${d} */`),n=b;continue}c.add(d),t.push(e.slice(n,b)),n=b;continue}}}t.push(r),n++}return t.join("")}var le=new Set(["script","style","html","head","meta","link","title","!doctype"]);function ue(e){let c=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${G})>`,"iy"),t=null,n=null;return w(e,(s,u)=>{c.lastIndex=u;let f=c.exec(s);if(!f)return-1;let i=f[1].toLowerCase();if(i==="script"||i==="style")return-1;let p=u+f[0].length-1;if(i==="body"&&n===null)n=p;if(t===null&&!le.has(i))t=p;return u+f[0].length}),n??t}function fe(e,c,t,n){let s=[],u=` data-stx="${n}"`,f=0,i=!1,p=(m)=>{if(t!==null&&!i&&t>=f&&t<=m)s.push(e.slice(f,t),u,e.slice(t,m)),i=!0;else s.push(e.slice(f,m))};for(let m of c){if(m.start<f)continue;p(m.start),f=m.end}return p(e.length),s.join("")}async function _s(e,c,t,n={}){let s=vs(e,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),u=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|keptState|useCookie|useId|useModel|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,f=[],{hasUserImports:i,bundleClientScript:p}=await o("stx/client-script-bundler",()=>import("./chunk-nqz4es8a.js"));for(let x of s){let h=x.body;if(Ve(x.attrs))h=Ue(h);if(n.forceClientSetup||u.test(h)){f.push({content:h,start:x.start,end:x.end});continue}if(!i(h))continue;try{let R=await p(zt(h).code,c||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(u.test(R))f.push({content:h,start:x.start,end:x.end})}catch{}}if(f.length===0)return{output:e,setupCode:null};let m=`${c??""}\x00${f.map((x)=>x.content).join("\x00")}`,r=`__stx_setup_${Bun.hash(m).toString(36).slice(0,10)}`,a=[];for(let x=0;x<f.length;x++){let h=f[x].bundled??zt(f[x].content).code;if(!f[x].bundled&&i(h))h=await p(h,c||"",{projectRoot:process.cwd()});h=Ct(h);let R=N(h);a.push(`// \u2500\u2500 merged signal script #${x+1} \u2500\u2500
|
|
6
6
|
${R}`)}let g=a.join(`
|
|
7
7
|
|
|
8
|
-
`);g=ae(g);let d=
|
|
8
|
+
`);g=ae(g);let d=K(g).split(",").map((x)=>x.trim()).filter(Boolean),b=kn(g,t),S=`
|
|
9
9
|
<script data-stx-scoped>
|
|
10
10
|
function ${r}() {
|
|
11
11
|
${ft("const",d)}
|
|
12
|
-
${
|
|
12
|
+
${de(`${b}${g}`)}
|
|
13
13
|
return ${Bs(g,d)};
|
|
14
14
|
}
|
|
15
15
|
window.__stx_latestSetup=${r};
|
|
16
16
|
if(window.stx)window.stx._latestSetup=${r};
|
|
17
|
-
</script>`,E=
|
|
17
|
+
</script>`,E=ue(e);return{output:fe(e,f,E,r),setupCode:S}}async function ei(e,c,t,n){if(!xs(e,t))return e;let s=e;if(c.skipSignalsRuntime)return s;let{output:u,setupCode:f}=await _s(s,t,n);if(s=u,!f){let i=V(s);if(i&&!/data-stx/.test(i.attrs)&&!/data-stx-auto/.test(i.attrs)){let p=i.tag.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>");s=s.slice(0,i.index)+p+s.slice(i.index+i.tag.length)}}if(s=await mr(s,c),f){let i=xc(s,/<\/head>/i),p=i===-1?xc(s,/<body[^>]*>/i):-1;if(i!==-1)s=`${s.slice(0,i)}${f}
|
|
18
18
|
${s.slice(i)}`;else if(p!==-1){let m=/<body[^>]*>/i.exec(s.slice(p))[0],r=p+m.length;s=`${s.slice(0,r)}
|
|
19
19
|
${f}${s.slice(r)}`}else s=`${s}
|
|
20
|
-
${f}`}return s}function xc(e,c){let t=/<(script|style)\b[\s\S]*?<\/\1>/gi,n=[],s;while((s=t.exec(e))!==null)n.push([s.index,s.index+s[0].length]);let u=new RegExp(c.source,c.flags.replace(/[gy]/g,"")),f=0;while(f<e.length){let i=u.exec(e.slice(f));if(!i)return-1;let p=f+i.index;if(!n.some(([r,a])=>p>=r&&p<a))return p;f=p+Math.max(i[0].length,1)}return-1}var
|
|
20
|
+
${f}`}return s}function xc(e,c){let t=/<(script|style)\b[\s\S]*?<\/\1>/gi,n=[],s;while((s=t.exec(e))!==null)n.push([s.index,s.index+s[0].length]);let u=new RegExp(c.source,c.flags.replace(/[gy]/g,"")),f=0;while(f<e.length){let i=u.exec(e.slice(f));if(!i)return-1;let p=f+i.index;if(!n.some(([r,a])=>p>=r&&p<a))return p;f=p+Math.max(i[0].length,1)}return-1}var U="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function Qf(e){let c=[];for(let t of e.split(",")){let n=t.trim();if(!n||n.startsWith("type "))continue;let s=n.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(s&&s[1]!==s[2])c.push(`${s[2]} = ${s[1]}`)}if(c.length===0)return U;return`var ${c.join(", ")}; ${U}`}var ge=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function Ct(e){return e.replace(ge,(c,t)=>Qf(t))}
|
|
21
21
|
export{Zh,vs,Yo,xs,fr,Zo,Qo,Zf,Ss,ks,_s,ei,xc,Qf,Ct};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Le,S,_,T,
|
|
3
|
-
${l.trim()}`)}catch(l){console.warn(`[stx] Failed to load composable ${o}:`,l)}if(D.length===0||M.size===0)return
|
|
2
|
+
import{Le,S,_,T,ne}from"./chunk-kgh1xsfe.js";import{C}from"./chunk-qjey0jk6.js";import{N,On}from"./chunk-farh4p7f.js";import{a}from"./chunk-095cn3p0.js";import{xe,un,dn,pn}from"./chunk-9fk02w6v.js";import{Ct}from"./chunk-k3qh0esd.js";import{xt,Gn,nn,ge}from"./chunk-gcsy3z1e.js";import{A,In}from"./chunk-rpep1ve3.js";import h from"path";var v=new Map,E=new Map,I=S(64),F=new Map,V=["composables","functions"];function H(e){let s=h.basename(e,".ts");return s==="index"||s==="types"||e.endsWith(".d.ts")}async function Y(e){if(e)return h.resolve(e);let s=`<default>:${process.cwd()}`,r=F.get(s);if(r!==void 0)return r;let t=await ee();if(t!==null)F.set(s,t);return t}async function ee(){let e=await a(),s=e.root||process.cwd(),r=e.composablesDir;if(r)return h.resolve(s,r);for(let t of V){let n=h.resolve(s,t);try{let c=new Bun.Glob("**/*.ts");for await(let i of c.scan({cwd:n,absolute:!0}))if(!H(i))return n}catch{}}return null}async function W(e){let s=Array.isArray(e)?e:e?[h.resolve(e)]:(await a())._layerComposableDirs??[await Y()].filter((t)=>!!t),r=new Map;for(let t of s){let n=new Bun.Glob("**/*.ts");try{for await(let c of n.scan({cwd:t,absolute:!0})){let i=h.relative(t,c);if(!H(c)&&!r.has(i))r.set(i,c)}}catch{}}return{key:s.join("\x00"),files:[...r.values()].sort()}}async function Eo(e){let{files:s}=await W(e),r=ne({loader:"ts",target:"browser",define:T()}),t=[];for(let n of s)try{let c=await Bun.file(n).text(),i=r.scan(c).exports.filter((u)=>u!=="default");if(i.length>0)t.push({file:n,names:i})}catch{}return t}function te(e,s){return new RegExp(`\\b${s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(e)}function R(e,s){let r=new Set(e.match(/\w+/g)),t=new Set;for(let n of s)if(/^\w+$/.test(n)?r.has(n):te(e,n))t.add(n);return t}var J=S(64);function X(e,s){let r=_(e,s.size),t=J.get(r);if(t)return t;let n;try{n=Le(e,s)}catch{n=R(e,s)}let c=[...e.matchAll(/(?:const|let|var)\s*\{([^}]*)\}\s*=\s*window\.__composables\u0008/g),...e.matchAll(/import\s*\{([^}]*)\}\s*from\s*['"]@composables['"]/g)];for(let i of c)for(let u of i[1].split(",")){let f=u.trim().split(/\s*(?::|\u0008as\u0008)\s*/)[0];if(f&&s.has(f))n.add(f)}return J.set(r,n),n}function se(e){return!e||/^(?:module|(?:text|application)\/(?:java|ecma)script|application\/stx-[\w-]+)$/i.test(e)}var L=S(256);function oe(e,s){let r=new Set(s),t="",n=0,c=new Set;for(let i of e.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi)){t+=e.slice(n,i.index),n=i.index+i[0].length;let u=i[1]??"",f=i[2]??"",d=/\btype\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(u),m=d?(d[1]??d[2]??d[3]??"").trim():void 0;if(!se(m)){if(!/json/i.test(m??""))t+=` ${f} `;continue}let y=R(f,r);if(y.size===0)continue;let b=_(f,[...y].sort().join(",")),w=L.get(b);if(!w)w=X(f,y),L.set(b,w);for(let B of w)c.add(B)}t+=e.slice(n);for(let i of R(t,r))c.add(i);return c}function ie(e,s,r){let t=new Map;for(let{file:f,names:d}of e)for(let m of d)if(!t.has(m))t.set(m,f);let n=new Set(t.keys()),c=(f)=>{let d=[];for(let m of X(f,n))d.push(t.get(m));return d},i=new Set,u=r.flatMap((f,d)=>d===0?[...oe(f,t.keys())].map((m)=>t.get(m)):c(f));while(u.length>0){let f=[];for(let d of u){if(i.has(d))continue;i.add(d);for(let m of c(s.get(d)??""))if(!i.has(m))f.push(m)}u=f}return i}async function Eh(e,s,r,t){let{key:n,files:c}=await W(e);if(!n)return null;let i=()=>[...new Set([...c,...c.flatMap((o)=>xe(o))])],u=xt(i());if(c.length===0)return ge(v,n,u,""),null;c.sort();let f=ne({loader:"ts",target:"browser",define:T()}),d=nn(E,n,u);if(!d){let o=new Map,l=[];for(let p of c)try{let x=await Bun.file(p).text();o.set(p,x);let g=f.scan(x).exports.filter((Q)=>Q!=="default");if(g.length>0)l.push({file:p,names:g})}catch{o.set(p,"")}d=ge(E,n,u,{codeByFile:o,modules:l})}let{codeByFile:m,modules:y}=d,b;if(s===void 0)b=new Set(c);else{let o=r?[s,...r]:[s],l=_(o.join("\x00"),n,o.length,u),p=I.get(l);if(b=p??ie(y,m,o),!p)I.set(l,b)}if(b.size===0)return null;let w=c.filter((o)=>b.has(o)),B=()=>{if(!t)return;for(let o of w)t.push(o,...xe(o))},k=`${n}\x00${w.join("\x00")}\x00${dn()}`,P=nn(v,k,u);if(P!==void 0)return B(),P||null;let D=[],M=new Set,U=new Set;for(let o of w)try{let l=m.get(o)??await Bun.file(o).text(),p=h.basename(o,".ts");for(let g of l.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(g[1])U.add(g[1]);let x=[];try{for(let g of f.scan(l).exports)if(g!=="default")M.add(g),x.push(g)}catch{}if(l=N(l),un(l))l=await pn(l,o,{projectRoot:process.cwd(),externalizeUserModules:!1,expose:x}),l=Ct(l);l=On(l),l=l.replace(/^export\s+(default\s+)?/gm,""),l=f.transformSync(l),D.push(`// Composable: ${p}
|
|
3
|
+
${l.trim()}`)}catch(l){console.warn(`[stx] Failed to load composable ${o}:`,l)}if(D.length===0||M.size===0)return ge(v,k,u,""),null;let Z=[...M].map((o)=>` try { if (!(${JSON.stringify(o)} in __c)) __c[${JSON.stringify(o)}] = ${o}; } catch (e) {}`).join(`
|
|
4
4
|
`),z=JSON.stringify([...M]),j=D.join(`
|
|
5
5
|
|
|
6
6
|
`),q=C.filter((o)=>!U.has(o)&&new RegExp(`\\b${o}\\b`).test(j)).map((o)=>`var ${o} = __stx[${JSON.stringify(o)}];`).join(`
|
|
@@ -29,5 +29,5 @@ ${Z}
|
|
|
29
29
|
window[__n] = __c[__n];
|
|
30
30
|
__published[__n] = true;
|
|
31
31
|
}
|
|
32
|
-
})();`,G=A()?In(O):O;return u=xt(i()),
|
|
32
|
+
})();`,G=A()?In(O):O;return u=xt(i()),ge(v,k,u,G),B(),G}function Th(){v.clear(),Gn(),E.clear(),I.clear(),F.clear()}
|
|
33
33
|
export{Eo,Eh,Th};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ze,
|
|
3
|
-
export{
|
|
2
|
+
import{Ze,le,cc}from"./chunk-5h9d6jew.js";import v from"fs";import g from"path";import V from"crypto";var oe=[320,640,768,1024,1280,1536,1920],ie=["webp","jpeg"],ae=80,T=[".jpg",".jpeg",".png",".webp",".avif",".gif",".svg"],U={webp:"image/webp",avif:"image/avif",jpeg:"image/jpeg",png:"image/png"},I=null,M=!1;async function d(){if(M)return I;M=!0;try{let t=await import("sharp");return I=t.default||t,I}catch{return null}}async function zn(){return await d()!==null}async function ve(){return!0}async function Ie(t,e={}){let{widths:a=oe,formats:n=ie,quality:r=ae,fit:m="cover",placeholder:l="none",outputDir:o=".stx/images",baseUrl:c="/images"}=e,i,h;if(typeof t==="string"){if(h=t,!await Bun.file(t).exists())throw new ts(`Image not found: ${t}`,"NOT_FOUND");i=await Bun.file(t).arrayBuffer().then((s)=>Buffer.from(s))}else h="buffer-input",i=t;let b=V.createHash("sha256").update(i).digest("hex").slice(0,12),j=await es(i),{width:u,height:x}=j,F=u/x;await v.promises.mkdir(o,{recursive:!0});let B=[],A=g.basename(h,g.extname(h)),f=a.filter((s)=>s<=u);if(!f.includes(u)&&u<=Math.max(...a))f.push(u);f.sort((s,p)=>s-p);for(let s of f){let p=Math.round(s/F);for(let w of n){let S=`${A}-${s}w-${b}.${w}`,P=g.join(o,S),q=`${c}/${S}`,E=await su(i,{width:s,height:p,format:w,quality:r,fit:m});await Bun.write(P,E),B.push({path:P,url:q,width:s,height:p,format:w,size:E.length})}}let y;if(l!=="none")y=await D(i,l);return{src:h,variants:B,placeholder:y,width:u,height:x,aspectRatio:F,hash:b}}async function es(t){let e=typeof t==="string"?Buffer.from(await Bun.file(t).arrayBuffer()):t,a=await d();if(a){let r=await a(e).metadata();return{width:r.width||0,height:r.height||0,format:r.format||"unknown",hasAlpha:r.hasAlpha}}return L(e)}function L(t){if(t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71){let e=t.readUInt32BE(16),a=t.readUInt32BE(20);return{width:e,height:a,format:"png",hasAlpha:!0}}if(t[0]===255&&t[1]===216){let e=2;while(e<t.length){if(t[e]!==255)break;let a=t[e+1];if(a>=192&&a<=207&&a!==196&&a!==200&&a!==204){let r=t.readUInt16BE(e+5);return{width:t.readUInt16BE(e+7),height:r,format:"jpeg",hasAlpha:!1}}let n=t.readUInt16BE(e+2);e+=2+n}}if(t.toString("utf8",0,4)==="RIFF"&&t.toString("utf8",8,12)==="WEBP"){let e=t.toString("utf8",12,16);if(e==="VP8 "){let a=t.readUInt16LE(26)&16383,n=t.readUInt16LE(28)&16383;return{width:a,height:n,format:"webp",hasAlpha:!1}}if(e==="VP8L"){let a=t.readUInt32LE(21),n=(a&16383)+1,r=(a>>14&16383)+1;return{width:n,height:r,format:"webp",hasAlpha:!0}}}if(t.toString("utf8",0,3)==="GIF"){let e=t.readUInt16LE(6),a=t.readUInt16LE(8);return{width:e,height:a,format:"gif",hasAlpha:!0}}throw new ts("Unable to parse image dimensions","PARSE_ERROR")}async function su(t,e){let a=await d();if(a){let r=a(t).resize(e.width,e.height,{fit:e.fit});switch(e.format){case"webp":r=r.webp({quality:e.quality});break;case"avif":r=r.avif({quality:e.quality});break;case"jpeg":r=r.jpeg({quality:e.quality});break;case"png":r=r.png({quality:e.quality});break}return r.toBuffer()}let{processImage:n}=await import("ts-images");return await cc("img",async(r)=>{let m=g.join(r,`out.${e.format}`);return await n({input:t,output:m,format:e.format,quality:e.quality,resize:{width:e.width,height:e.height,fit:e.fit}}),Buffer.from(await Bun.file(m).arrayBuffer())})}async function D(t,e){let a=await d();if(e==="blur"&&a){let c=(await a(t).resize(20).blur(10).toBuffer()).toString("base64"),i=await es(t);return`data:${U[i.format]||"image/jpeg"};base64,${c}`}if(e==="dominant-color"&&a){let{dominant:o}=await a(t).resize(1,1).toBuffer().then(async(c)=>{let i=await a(c).metadata();return{dominant:{r:128,g:128,b:128}}}).catch(()=>({dominant:{r:128,g:128,b:128}}));return`rgb(${o.r}, ${o.g}, ${o.b})`}let{generatePlaceholder:n}=await import("ts-images"),r=await es(t),m=Ze("ph"),l=g.join(m,`in.${r.format==="unknown"?"bin":r.format}`);try{await Bun.write(l,t);let o=e==="blur"?"blur":e==="thumbhash"?"thumbhash":"dominant-color",i=await n(l,{strategy:o,width:o==="thumbhash"?void 0:32});if(e==="dominant-color"&&i.dominantColor)return i.dominantColor;if(i.dataURL)return i.dataURL;return"rgb(128, 128, 128)"}catch{return"rgb(128, 128, 128)"}finally{le(m)}}function vt(t,e){return(e?t.filter((n)=>n.format===e):t).sort((n,r)=>n.width-r.width).map((n)=>`${n.url} ${n.width}w`).join(", ")}function tn(t){if(!t||Object.keys(t).length===0)return"100vw";return Object.entries(t).sort((a,n)=>{let r=Number.parseInt(a[0].replace(/\D/g,""))||0;return(Number.parseInt(n[0].replace(/\D/g,""))||0)-r}).map(([a,n])=>`(max-width: ${a}) ${n}`).join(", ")+", 100vw"}function Hn(t){let e=t.filter((n)=>n.format==="jpeg");if(e.length===0)return t[Math.floor(t.length/2)];let a=e.sort((n,r)=>n.width-r.width);return a[Math.floor(a.length/2)]}function Vn(t){let e=new Map;for(let a of t){let n=e.get(a.format)||[];n.push(a),e.set(a.format,n)}return e}function Un(t){let e=g.extname(t).toLowerCase();return T.includes(e)}function ce(t){return U[t]||"application/octet-stream"}function Wn(t){return t.reduce((e,a)=>e+a.size,0)}function qn(t){if(t<1024)return`${t} B`;if(t<1048576)return`${(t/1024).toFixed(1)} KB`;return`${(t/1048576).toFixed(2)} MB`}class ts extends Error{code;constructor(t,e){super(t);this.name="ImageProcessingError",this.code=e}}
|
|
3
|
+
export{oe,ie,ae,zn,ve,Ie,es,su,vt,tn,Hn,Vn,Un,ce,Wn,qn,ts};
|