@stacksjs/stx 0.2.812 → 0.2.815
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-053yyx5n.js +2 -0
- package/dist/{chunk-ttj34qz6.js → chunk-080zb2qx.js} +1 -1
- package/dist/{chunk-9k7c5y4t.js → chunk-0dnzcrb1.js} +1 -1
- package/dist/{chunk-46npem9j.js → chunk-0x02gm7d.js} +1 -1
- package/dist/chunk-0xv48z98.js +3 -0
- package/dist/{chunk-9t4qc1ej.js → chunk-0yf28g7v.js} +1 -1
- package/dist/chunk-0ywcbka3.js +2 -0
- package/dist/{chunk-p4yhhx16.js → chunk-1cxf9chb.js} +4 -4
- package/dist/{chunk-x1tt23w7.js → chunk-2gcvcpt8.js} +1 -1
- package/dist/chunk-2yngdnq6.js +2 -0
- package/dist/{chunk-021eq782.js → chunk-3ht64v1a.js} +2 -2
- package/dist/{chunk-p77087r3.js → chunk-3qr7dz76.js} +1 -1
- package/dist/{chunk-4g2vnemw.js → chunk-5d8123c9.js} +4 -4
- package/dist/{chunk-et7s58sj.js → chunk-5h0p34jj.js} +1 -1
- package/dist/{chunk-db3h2e1r.js → chunk-6em1xeax.js} +1 -1
- package/dist/{chunk-d8kvpb4n.js → chunk-6vbtvpn4.js} +2 -2
- package/dist/{chunk-a9t7ytwg.js → chunk-72pek719.js} +1 -1
- package/dist/{chunk-r94q8xdh.js → chunk-74ck7kk1.js} +1 -1
- package/dist/chunk-74dw9yf0.js +2 -0
- package/dist/chunk-7bxk9mjy.js +2 -0
- package/dist/{chunk-6vqm866c.js → chunk-7cwb7pyf.js} +1 -1
- package/dist/{chunk-db4bd5vc.js → chunk-7qarrdq6.js} +1 -1
- package/dist/{chunk-crfj882k.js → chunk-81pykb48.js} +1 -1
- package/dist/{chunk-dn17ve25.js → chunk-84qv8bxe.js} +5 -5
- package/dist/{chunk-kgmeby9f.js → chunk-89pes7at.js} +1 -1
- package/dist/{chunk-x14jm9hg.js → chunk-8taa0exz.js} +1 -1
- package/dist/{chunk-2sqkzpt5.js → chunk-9k037sk6.js} +1 -1
- package/dist/chunk-as5ej9s8.js +2 -0
- package/dist/{chunk-rggdk5e2.js → chunk-b0yvap9e.js} +1 -1
- package/dist/{chunk-zqfdeh3y.js → chunk-b12wg4jp.js} +1 -1
- package/dist/{chunk-chwt709a.js → chunk-c4y1pcf6.js} +2 -2
- package/dist/{chunk-fwwf1t9k.js → chunk-c5fved0k.js} +1 -1
- package/dist/{chunk-nrnzkh3e.js → chunk-cea665ds.js} +1 -1
- package/dist/{chunk-ygrc6aej.js → chunk-d2vr1169.js} +6 -6
- package/dist/{chunk-60bhj25e.js → chunk-eg95a7q7.js} +1 -1
- package/dist/{chunk-e3sd2w5t.js → chunk-eqrjfceb.js} +1 -1
- package/dist/{chunk-bega3dk7.js → chunk-few3k1dz.js} +1 -1
- package/dist/{chunk-6sh0qbqe.js → chunk-gt0csenq.js} +4 -4
- package/dist/{chunk-0aqrjw4c.js → chunk-h9cpa5jq.js} +1 -1
- package/dist/{chunk-acftnzex.js → chunk-hbq922er.js} +1 -1
- package/dist/chunk-km00bn5z.js +2 -0
- package/dist/{chunk-je1nvds2.js → chunk-kmr3cd71.js} +2 -2
- package/dist/{chunk-et7jca3r.js → chunk-m8w7rcmt.js} +1 -1
- package/dist/{chunk-hea7mctr.js → chunk-m8zbae89.js} +2 -2
- package/dist/{chunk-962800vx.js → chunk-macvhhf0.js} +2 -2
- package/dist/{chunk-r13bcmsh.js → chunk-mjjfx1yp.js} +3 -3
- package/dist/{chunk-atbqt79s.js → chunk-p9y5hh4m.js} +1 -1
- package/dist/{chunk-awqq6rxz.js → chunk-pda7fv19.js} +1 -1
- package/dist/{chunk-6yjyymnd.js → chunk-q9ggx1jb.js} +1 -1
- package/dist/chunk-qfc662nf.js +2 -0
- package/dist/{chunk-vq65ywpx.js → chunk-qxr4teqr.js} +1 -1
- package/dist/chunk-rdsrc8wv.js +2 -0
- package/dist/{chunk-yvqmr4p0.js → chunk-rpw3f34s.js} +1 -1
- package/dist/{chunk-xaycmazr.js → chunk-rvb5gz33.js} +1 -1
- package/dist/chunk-s7db9xc4.js +2 -0
- package/dist/{chunk-y4yz5qf5.js → chunk-se251nhv.js} +1 -1
- package/dist/{chunk-vntea4k0.js → chunk-t6sddfv8.js} +4 -4
- package/dist/{chunk-xbcktxjc.js → chunk-tc15aznt.js} +1 -1
- package/dist/{chunk-rz0zww80.js → chunk-vhe6p6b0.js} +1 -1
- package/dist/{chunk-154n9bj7.js → chunk-vn5cd6av.js} +1 -1
- package/dist/{chunk-f8awd1cy.js → chunk-xd5n2qx4.js} +1 -1
- package/dist/{chunk-b83vt90z.js → chunk-yacdg7kq.js} +1 -1
- package/dist/{chunk-0752padg.js → chunk-z1edw8fc.js} +1 -1
- package/dist/{chunk-5d98q2hm.js → chunk-z5b863fw.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.d.ts +1 -0
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-6pghczk4.js +0 -3
- package/dist/chunk-cnvetevs.js +0 -2
- package/dist/chunk-ef2367nq.js +0 -2
- package/dist/chunk-etg32aev.js +0 -2
- package/dist/chunk-ezd6jev1.js +0 -2
- package/dist/chunk-ga5f5try.js +0 -2
- package/dist/chunk-vgddw569.js +0 -2
- package/dist/chunk-ws0tc67p.js +0 -2
- package/dist/chunk-y9hacnzt.js +0 -2
- package/dist/chunk-ze2ykje6.js +0 -2
- package/dist/chunk-zvmm78rc.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Si,Ks,u,f,A,st,d,Xs,t,l,w}from"./chunk-gebb12ak.js";import{ve,At,J,O,Mt,Z,_}from"./chunk-ygrc6aej.js";import{ir}from"./chunk-021eq782.js";import{se}from"./chunk-y7sf7aj0.js";import{ws}from"./chunk-1carv1dw.js";var de=1000,pe=!1;function he(n,r){let c=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,e="",o=0,i;while((i=c.exec(n))!==null){let g=i.index+i[0].length,x=i.index+i[0].indexOf("("),b=w(n,"(",")",x);if(b===-1)continue;let p=n.slice(g,b).trim();if(!p)continue;if(!Object.keys(r).some((a)=>new RegExp(`(?:^|[^\\w$.])${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(p)))continue;let m;try{let a=A(p,r);if(!a||typeof a!=="object")continue;m=JSON.stringify(a)}catch{continue}e+=n.slice(o,g)+m,o=b,c.lastIndex=b}return o===0?n:e+n.slice(o)}function me(n,r){let c=/@component\s*\(/g,e=n,o,i=[];while((o=c.exec(e))!==null){let g=o.index,x=g+o[0].length-1,b=1,p=x+1;while(p<e.length&&b>0){if(e[p]==="(")b++;else if(e[p]===")"){if(b--,b===0)break}p++}if(b!==0)continue;let s=e.substring(x+1,p),m=p+1,a=s.match(/^\s*['"]([^'"]+)['"]/);if(!a)continue;let y=a[1],h=s.slice(a[0].length),k=h.match(/^\s*,\s*/);if(!k)continue;let S=h.slice(k[0].length).trim();if(!S)continue;try{let v=A(S,r),W=JSON.stringify(v),F=`@component('${y}', ${W})`;i.push({start:g,end:m,replacement:F})}catch{continue}}for(let g=i.length-1;g>=0;g--){let{start:x,end:b,replacement:p}=i[g];e=e.substring(0,x)+p+e.substring(b)}return e}function oe(n,r,c){let e=n,o=new RegExp(`${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),i;while((i=o.exec(e))!==null){let g=i.index,x=g+i[0].length-1,b=1,p=x+1,s=null,m=!1;while(p<e.length&&b>0){let h=e[p];if(m){m=!1,p++;continue}if(h==="\\"&&s){m=!0,p++;continue}if(s){if(h===s)s=null;p++;continue}if(h==='"'||h==="'"||h==="`"){s=h,p++;continue}if(h==="(")b++;else if(h===")"){if(b--,b===0)break}p++}if(b!==0)break;let a=e.substring(x+1,p),y=c(a);e=e.substring(0,g)+y+e.substring(p+1)}return e}function be(n,r){let c=n;return c=c.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(e,o)=>{if(o in r)return`:${o}="${o}"`;return e}),c=c.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(e,o,i)=>{try{if(O(i,r.__stx_client_signal_names||[]))return e;let g=Object.keys(r),x=Object.values(r);Si(i);let b=!1,s=d(i,g,()=>{b=!0})(...x);if(b)return e;let m=JSON.stringify(s);if(m===void 0){if(!st(i).some((h)=>!(h in r)))return"";return e}let a=Buffer.from(m,"utf8").toString("base64");return`__stx_${o}="${a}"`}catch(g){return e}}),c}var ee="<!--__STX_BREAK__-->",ne="<!--__STX_CONTINUE__-->";function le(n,r){let c=/\{\{\{?|\{!!|@(break|continue)(?![\w$])/g,e="",o=0;for(let i=c.exec(n);i;i=c.exec(n)){if(!i[1]){let p=i[0].length===3&&i[0]==="{{{"?3:2,s=i[0]==="{!!"?n.indexOf("!!}",c.lastIndex):ve(n,i.index,p);if(s<0)break;c.lastIndex=s+(i[0]==="{!!"?3:p);continue}let g=c.lastIndex,x=!0,b=/^\s*\(/.exec(n.slice(g));if(b){let p=g+b[0].length-1,s=w(n,"(",")",p);if(s<0)break;g=s+1;try{let m=`!!(${n.slice(p+1,s).trim()})`;x=f(m)?Boolean(d(m,Object.keys(r))(...Object.values(r))):Boolean(u(m,r))}catch{x=!1}}if(e+=n.slice(o,i.index),x)return e+(i[1]==="break"?ee:ne);o=g,c.lastIndex=g}return e+n.slice(o)}function ae(n){let r=(o)=>o.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),c="",e=0;return Mt(n,(o,i,g)=>(c+=ie(r(n.slice(e,g))),c+=`\${__stxRenderLoopValue(${g}, (${i}), ${o.length})}`,e=g+o.length,o)),c+ie(r(n.slice(e)))}function ue(n,r,c,e){return Z(n,r,c==null?"":String(c),!1,e)}function ie(n){let r=n;return r=oe(r,"@break",(c)=>{let e=c.trim();if(!Xs(e))return"";return`\`; if (${e}) { break; } result += \``}),r=oe(r,"@continue",(c)=>{let e=c.trim();if(!Xs(e))return"";return`\`; if (${e}) { continue; } result += \``}),r=r.replace(/@break(?!\()/g,"`; break; result += `"),r=r.replace(/@continue(?!\()/g,"`; continue; result += `"),r}function xe(n){let r=/@forelse\s*\(/g,c,e=[],o=/@foreach\s*\(/g,i=/@endforeach/g,g;while((g=o.exec(n))!==null)e.push({pos:g.index,delta:1});while((g=i.exec(n))!==null)e.push({pos:g.index,delta:-1});e.sort((s,m)=>s.pos-m.pos);let x=[],b=0;for(let s of e)b+=s.delta,x.push({pos:s.pos,depth:b});function p(s){let m=0,a=x.length-1,y=0;while(m<=a){let h=m+a>>1;if(x[h].pos<=s)y=x[h].depth,m=h+1;else a=h-1}return y}while((c=r.exec(n))!==null){if(p(c.index)>0)continue;let s=c.index,m=c.index+c[0].length-1,a=1,y=m+1,h=-1;while(y<n.length&&a>0){if(n[y]==="(")a++;else if(n[y]===")"){if(a--,a===0){h=y;break}}y++}if(h===-1)continue;let k=n.substring(m+1,h),S=At(k);if(!S)continue;let{arrayExpr:v,itemVar:W}=S,F=h+1,R=1,B=F,D=/@forelse\s*\(/g,L=/@endforelse/g,V=-1;while(R>0&&B<n.length){D.lastIndex=B,L.lastIndex=B;let P=D.exec(n),E=L.exec(n);if(!E)break;if(P&&P.index<E.index)R++,B=P.index+P[0].length;else{if(R--,R===0){V=E.index;break}B=E.index+11}}if(V===-1)continue;let I=n.substring(F,V),K=V+11,U=-1,z=0,N=0;while(N<I.length){let P=I.indexOf("@",N);if(P===-1)break;let E=I.substring(P);if(/^@forelse\s*\(/.test(E))z++,N=P+1;else if(E.startsWith("@endforelse"))z--,N=P+11;else if(z===0&&E.startsWith("@empty")){if(I.length<=P+6||!/[a-z]/i.test(I[P+6])){U=P;break}N=P+1}else N=P+1}if(U===-1)continue;return{start:s,end:K,arrayExpr:v,itemVar:W,foreachContent:I.substring(0,U),emptyContent:I.substring(U+6)}}return null}function ce(n,r){let c=n;while(!0){let e=xe(c);if(!e)break;let{start:o,end:i,arrayExpr:g,itemVar:x,foreachContent:b,emptyContent:p}=e;try{let s;if(f(g))s=d(g,Object.keys(r))(...Object.values(r));else s=u(g,r);let m;if(!Array.isArray(s)||s.length===0)m=p;else m=`@foreach (${g} as ${x})${b}@endforeach`;c=c.substring(0,o)+m+c.substring(i)}catch(s){let m=s instanceof Error?s.message:String(s),a=l("Forelse",`Error in @forelse(${g} as ${x}): ${m}`,t.EVALUATION_ERROR);c=c.substring(0,o)+a+c.substring(i)}}return c}var fe="<!--stx:foreach-not-iterable:",ye=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function Ee(n,r){return`${fe}${encodeURIComponent(n)}|${encodeURIComponent(r)}-->`}function _e(n,r){console.warn(`[stx] @foreach(${n}) in ${r}: ${n} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function ps(n){if(!n.includes(fe))return n;return n.replace(ye,(r,c,e)=>(_e(decodeURIComponent(c),decodeURIComponent(e)),""))}function or(n,r,c,e,o=!1){let i=n,g=new Set(r.__stx_client_signal_names||[]);for(let s of ir(n))g.add(s);if(g.size)r={...r,__stx_client_signal_names:[...g]};i=ce(i,r);function x(s){let m=/@foreach\s*\(/g,a;while((a=m.exec(s))!==null){let y=a.index,h=a.index+a[0].length-1,k=1,S=h+1,v=-1;while(S<s.length&&k>0){if(s[S]==="(")k++;else if(s[S]===")"){if(k--,k===0){v=S;break}}S++}if(v===-1)continue;let W=s.substring(h+1,v),F=At(W);if(!F)continue;let R=y,{arrayExpr:B,itemVar:D}=F,L=v+1,V=1,I=L,K=/@foreach\s*\(/g,U=/@endforeach/g;while(V>0&&I<s.length){K.lastIndex=I,U.lastIndex=I;let z=K.exec(s),N=U.exec(s);if(!N)break;if(z&&z.index<N.index)V++,I=z.index+z[0].length;else{if(V--,V===0){let P=s.substring(L,N.index),E=N.index+11;return{start:R,end:E,arrayExpr:B,itemVar:D,content:P}}I=N.index+11}}}return null}function b(s,m){let a=s;while(!0){let y=x(a);if(!y)break;let{start:h,end:k,arrayExpr:S,itemVar:v,content:W}=y;try{let F=S.trim(),R;if(f(F))R=d(F,Object.keys(m))(...Object.values(m));else R=u(F,m);let B=!1;if(!Array.isArray(R))if(R instanceof Map)R=Array.from(R),B=!0;else if(R instanceof Set)R=Array.from(R);else if(typeof R==="string")R=Array.from(R);else if(R&&typeof R==="object"&&!(R instanceof Date)&&!(R instanceof RegExp))R=Object.entries(R),B=!0;else{let E=Ee(F,c)+l("Foreach",`Error in @foreach: ${F} is not iterable`,t.TYPE_ERROR);a=a.substring(0,h)+E+a.substring(k);continue}let D=e?.loops?.useAltLoopVariable??pe,L=v.trim(),V=null,I,K=!1;if(L.includes("=>")){let E=L.split("=>").map((j)=>j.trim());if(E.length===2&&E[0]&&E[1])V=E[0],I=E[1];else I=L}else if(!L.startsWith("[")&&!L.startsWith("{")&&L.includes(",")){let E=L.split(",").map((j)=>j.trim());if(E.length===2&&E[0]&&E[1])I=E[0],V=E[1],K=!0;else I=L}else I=L;let U="",z=new Set(J(`${S} as ${v}`)),N=R,P=m[Ks]??new WeakMap;for(let E=0;E<N.length;E++){let j=N[E],te={index:E,iteration:E+1,first:E===0,last:E===N.length-1,count:N.length},M={...m,loop:te,$loop:te,[Ks]:P};if(Array.isArray(m.__stx_client_signal_names))M.__stx_client_signal_names=m.__stx_client_signal_names.filter((H)=>!z.has(H));if(I.startsWith("[")&&I.endsWith("]")){let H=I.slice(1,-1).split(",").map((T)=>T.trim());if(Array.isArray(j))H.forEach((T,X)=>{if(T)M[T]=j[X]});else M[I]=j}else if(I.startsWith("{")&&I.endsWith("}")){let H=I.slice(1,-1).split(",").map((T)=>T.trim()).filter(Boolean);if(j!==null&&typeof j==="object")H.forEach((T)=>{let X=T.indexOf(":"),Q=(X===-1?T:T.slice(0,X)).trim(),re=X===-1?Q:T.slice(X+1).trim();if(Q&&re)M[re]=j[Q]});else M[I]=j}else M[I]=j;if(V)if(!K&&B&&Array.isArray(j)&&j.length===2)M[V]=j[0],M[I]=j[1];else M[V]=E;let C=ce(W,M);C=or(C,M,c,e,!0),C=se(C,M,c),C=le(C,M);let q=C.indexOf(ee),G=C.indexOf(ne),Y=q<0?G:G<0?q:Math.min(q,G);if(Y>=0)C=C.slice(0,Y);if(C=_(C,M,c),C=be(C,M),C=me(C,M),C=he(C,M),U+=C,Y>=0&&Y===q)break}a=a.substring(0,h)+U+a.substring(k)}catch(F){let R=l("Foreach",`Error in @foreach(${S.trim()} as ${v.trim()}): ${F instanceof Error?F.message:String(F)}`,t.EVALUATION_ERROR);a=a.substring(0,h)+R+a.substring(k)}}return a}i=b(i,r),i=$e(i,r,c,e);let p=e?.loops?.maxWhileIterations??de;return i=we(i,r,p),o?i:ps(i)}function Of(n){let r=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(n);if(!r||/^(?:const|let|var)$/.test(r[2]))return n;return`${r[1]}let ${n.slice(r[1].length)}`}function ge(n){return Xs(n)}function $e(n,r,c,e){let o=n,i=!0;while(i){i=!1;let g=o.match(/@for\s*\(/);if(!g||g.index===void 0)break;let x=g.index,b=x+g[0].length-1,p=w(o,"(",")",b);if(p===-1)break;let s=Of(o.slice(b+1,p)),m=p+1,a=ws(o.slice(x),"for","endfor");if(a.length===0)break;let y=a[0].content,h=x+a[0].end;if(!ge(s)){let k=l("For",`Unsafe expression in @for: ${s}`,t.UNSAFE_EXPRESSION);o=o.substring(0,x)+k+o.substring(h),i=!0;continue}try{let k=Ae(s),S=/@(?:for|foreach|if|unless)\s*\(/.test(y);if(k.length>0&&S){let D=Re({forExpr:s,content:y,iterVarNames:k,context:r,filePath:c,options:e});o=o.substring(0,x)+D+o.substring(h),i=!0;continue}let v=Object.keys(r),W=Object.values(r),F=ae(y),B=Function(...v,"__stxRenderLoopValue",`
|
|
2
|
+
import{Si,Ks,u,f,A,st,d,Xs,t,l,w}from"./chunk-gebb12ak.js";import{ve,At,J,O,Mt,Z,_}from"./chunk-d2vr1169.js";import{ir}from"./chunk-3ht64v1a.js";import{se}from"./chunk-y7sf7aj0.js";import{ws}from"./chunk-1carv1dw.js";var de=1000,pe=!1;function he(n,r){let c=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,e="",o=0,i;while((i=c.exec(n))!==null){let g=i.index+i[0].length,x=i.index+i[0].indexOf("("),b=w(n,"(",")",x);if(b===-1)continue;let p=n.slice(g,b).trim();if(!p)continue;if(!Object.keys(r).some((a)=>new RegExp(`(?:^|[^\\w$.])${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(p)))continue;let m;try{let a=A(p,r);if(!a||typeof a!=="object")continue;m=JSON.stringify(a)}catch{continue}e+=n.slice(o,g)+m,o=b,c.lastIndex=b}return o===0?n:e+n.slice(o)}function me(n,r){let c=/@component\s*\(/g,e=n,o,i=[];while((o=c.exec(e))!==null){let g=o.index,x=g+o[0].length-1,b=1,p=x+1;while(p<e.length&&b>0){if(e[p]==="(")b++;else if(e[p]===")"){if(b--,b===0)break}p++}if(b!==0)continue;let s=e.substring(x+1,p),m=p+1,a=s.match(/^\s*['"]([^'"]+)['"]/);if(!a)continue;let y=a[1],h=s.slice(a[0].length),k=h.match(/^\s*,\s*/);if(!k)continue;let S=h.slice(k[0].length).trim();if(!S)continue;try{let v=A(S,r),W=JSON.stringify(v),F=`@component('${y}', ${W})`;i.push({start:g,end:m,replacement:F})}catch{continue}}for(let g=i.length-1;g>=0;g--){let{start:x,end:b,replacement:p}=i[g];e=e.substring(0,x)+p+e.substring(b)}return e}function oe(n,r,c){let e=n,o=new RegExp(`${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),i;while((i=o.exec(e))!==null){let g=i.index,x=g+i[0].length-1,b=1,p=x+1,s=null,m=!1;while(p<e.length&&b>0){let h=e[p];if(m){m=!1,p++;continue}if(h==="\\"&&s){m=!0,p++;continue}if(s){if(h===s)s=null;p++;continue}if(h==='"'||h==="'"||h==="`"){s=h,p++;continue}if(h==="(")b++;else if(h===")"){if(b--,b===0)break}p++}if(b!==0)break;let a=e.substring(x+1,p),y=c(a);e=e.substring(0,g)+y+e.substring(p+1)}return e}function be(n,r){let c=n;return c=c.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(e,o)=>{if(o in r)return`:${o}="${o}"`;return e}),c=c.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(e,o,i)=>{try{if(O(i,r.__stx_client_signal_names||[]))return e;let g=Object.keys(r),x=Object.values(r);Si(i);let b=!1,s=d(i,g,()=>{b=!0})(...x);if(b)return e;let m=JSON.stringify(s);if(m===void 0){if(!st(i).some((h)=>!(h in r)))return"";return e}let a=Buffer.from(m,"utf8").toString("base64");return`__stx_${o}="${a}"`}catch(g){return e}}),c}var ee="<!--__STX_BREAK__-->",ne="<!--__STX_CONTINUE__-->";function le(n,r){let c=/\{\{\{?|\{!!|@(break|continue)(?![\w$])/g,e="",o=0;for(let i=c.exec(n);i;i=c.exec(n)){if(!i[1]){let p=i[0].length===3&&i[0]==="{{{"?3:2,s=i[0]==="{!!"?n.indexOf("!!}",c.lastIndex):ve(n,i.index,p);if(s<0)break;c.lastIndex=s+(i[0]==="{!!"?3:p);continue}let g=c.lastIndex,x=!0,b=/^\s*\(/.exec(n.slice(g));if(b){let p=g+b[0].length-1,s=w(n,"(",")",p);if(s<0)break;g=s+1;try{let m=`!!(${n.slice(p+1,s).trim()})`;x=f(m)?Boolean(d(m,Object.keys(r))(...Object.values(r))):Boolean(u(m,r))}catch{x=!1}}if(e+=n.slice(o,i.index),x)return e+(i[1]==="break"?ee:ne);o=g,c.lastIndex=g}return e+n.slice(o)}function ae(n){let r=(o)=>o.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),c="",e=0;return Mt(n,(o,i,g)=>(c+=ie(r(n.slice(e,g))),c+=`\${__stxRenderLoopValue(${g}, (${i}), ${o.length})}`,e=g+o.length,o)),c+ie(r(n.slice(e)))}function ue(n,r,c,e){return Z(n,r,c==null?"":String(c),!1,e)}function ie(n){let r=n;return r=oe(r,"@break",(c)=>{let e=c.trim();if(!Xs(e))return"";return`\`; if (${e}) { break; } result += \``}),r=oe(r,"@continue",(c)=>{let e=c.trim();if(!Xs(e))return"";return`\`; if (${e}) { continue; } result += \``}),r=r.replace(/@break(?!\()/g,"`; break; result += `"),r=r.replace(/@continue(?!\()/g,"`; continue; result += `"),r}function xe(n){let r=/@forelse\s*\(/g,c,e=[],o=/@foreach\s*\(/g,i=/@endforeach/g,g;while((g=o.exec(n))!==null)e.push({pos:g.index,delta:1});while((g=i.exec(n))!==null)e.push({pos:g.index,delta:-1});e.sort((s,m)=>s.pos-m.pos);let x=[],b=0;for(let s of e)b+=s.delta,x.push({pos:s.pos,depth:b});function p(s){let m=0,a=x.length-1,y=0;while(m<=a){let h=m+a>>1;if(x[h].pos<=s)y=x[h].depth,m=h+1;else a=h-1}return y}while((c=r.exec(n))!==null){if(p(c.index)>0)continue;let s=c.index,m=c.index+c[0].length-1,a=1,y=m+1,h=-1;while(y<n.length&&a>0){if(n[y]==="(")a++;else if(n[y]===")"){if(a--,a===0){h=y;break}}y++}if(h===-1)continue;let k=n.substring(m+1,h),S=At(k);if(!S)continue;let{arrayExpr:v,itemVar:W}=S,F=h+1,R=1,B=F,D=/@forelse\s*\(/g,L=/@endforelse/g,V=-1;while(R>0&&B<n.length){D.lastIndex=B,L.lastIndex=B;let P=D.exec(n),E=L.exec(n);if(!E)break;if(P&&P.index<E.index)R++,B=P.index+P[0].length;else{if(R--,R===0){V=E.index;break}B=E.index+11}}if(V===-1)continue;let I=n.substring(F,V),K=V+11,U=-1,z=0,N=0;while(N<I.length){let P=I.indexOf("@",N);if(P===-1)break;let E=I.substring(P);if(/^@forelse\s*\(/.test(E))z++,N=P+1;else if(E.startsWith("@endforelse"))z--,N=P+11;else if(z===0&&E.startsWith("@empty")){if(I.length<=P+6||!/[a-z]/i.test(I[P+6])){U=P;break}N=P+1}else N=P+1}if(U===-1)continue;return{start:s,end:K,arrayExpr:v,itemVar:W,foreachContent:I.substring(0,U),emptyContent:I.substring(U+6)}}return null}function ce(n,r){let c=n;while(!0){let e=xe(c);if(!e)break;let{start:o,end:i,arrayExpr:g,itemVar:x,foreachContent:b,emptyContent:p}=e;try{let s;if(f(g))s=d(g,Object.keys(r))(...Object.values(r));else s=u(g,r);let m;if(!Array.isArray(s)||s.length===0)m=p;else m=`@foreach (${g} as ${x})${b}@endforeach`;c=c.substring(0,o)+m+c.substring(i)}catch(s){let m=s instanceof Error?s.message:String(s),a=l("Forelse",`Error in @forelse(${g} as ${x}): ${m}`,t.EVALUATION_ERROR);c=c.substring(0,o)+a+c.substring(i)}}return c}var fe="<!--stx:foreach-not-iterable:",ye=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function Ee(n,r){return`${fe}${encodeURIComponent(n)}|${encodeURIComponent(r)}-->`}function _e(n,r){console.warn(`[stx] @foreach(${n}) in ${r}: ${n} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function ps(n){if(!n.includes(fe))return n;return n.replace(ye,(r,c,e)=>(_e(decodeURIComponent(c),decodeURIComponent(e)),""))}function or(n,r,c,e,o=!1){let i=n,g=new Set(r.__stx_client_signal_names||[]);for(let s of ir(n))g.add(s);if(g.size)r={...r,__stx_client_signal_names:[...g]};i=ce(i,r);function x(s){let m=/@foreach\s*\(/g,a;while((a=m.exec(s))!==null){let y=a.index,h=a.index+a[0].length-1,k=1,S=h+1,v=-1;while(S<s.length&&k>0){if(s[S]==="(")k++;else if(s[S]===")"){if(k--,k===0){v=S;break}}S++}if(v===-1)continue;let W=s.substring(h+1,v),F=At(W);if(!F)continue;let R=y,{arrayExpr:B,itemVar:D}=F,L=v+1,V=1,I=L,K=/@foreach\s*\(/g,U=/@endforeach/g;while(V>0&&I<s.length){K.lastIndex=I,U.lastIndex=I;let z=K.exec(s),N=U.exec(s);if(!N)break;if(z&&z.index<N.index)V++,I=z.index+z[0].length;else{if(V--,V===0){let P=s.substring(L,N.index),E=N.index+11;return{start:R,end:E,arrayExpr:B,itemVar:D,content:P}}I=N.index+11}}}return null}function b(s,m){let a=s;while(!0){let y=x(a);if(!y)break;let{start:h,end:k,arrayExpr:S,itemVar:v,content:W}=y;try{let F=S.trim(),R;if(f(F))R=d(F,Object.keys(m))(...Object.values(m));else R=u(F,m);let B=!1;if(!Array.isArray(R))if(R instanceof Map)R=Array.from(R),B=!0;else if(R instanceof Set)R=Array.from(R);else if(typeof R==="string")R=Array.from(R);else if(R&&typeof R==="object"&&!(R instanceof Date)&&!(R instanceof RegExp))R=Object.entries(R),B=!0;else{let E=Ee(F,c)+l("Foreach",`Error in @foreach: ${F} is not iterable`,t.TYPE_ERROR);a=a.substring(0,h)+E+a.substring(k);continue}let D=e?.loops?.useAltLoopVariable??pe,L=v.trim(),V=null,I,K=!1;if(L.includes("=>")){let E=L.split("=>").map((j)=>j.trim());if(E.length===2&&E[0]&&E[1])V=E[0],I=E[1];else I=L}else if(!L.startsWith("[")&&!L.startsWith("{")&&L.includes(",")){let E=L.split(",").map((j)=>j.trim());if(E.length===2&&E[0]&&E[1])I=E[0],V=E[1],K=!0;else I=L}else I=L;let U="",z=new Set(J(`${S} as ${v}`)),N=R,P=m[Ks]??new WeakMap;for(let E=0;E<N.length;E++){let j=N[E],te={index:E,iteration:E+1,first:E===0,last:E===N.length-1,count:N.length},M={...m,loop:te,$loop:te,[Ks]:P};if(Array.isArray(m.__stx_client_signal_names))M.__stx_client_signal_names=m.__stx_client_signal_names.filter((H)=>!z.has(H));if(I.startsWith("[")&&I.endsWith("]")){let H=I.slice(1,-1).split(",").map((T)=>T.trim());if(Array.isArray(j))H.forEach((T,X)=>{if(T)M[T]=j[X]});else M[I]=j}else if(I.startsWith("{")&&I.endsWith("}")){let H=I.slice(1,-1).split(",").map((T)=>T.trim()).filter(Boolean);if(j!==null&&typeof j==="object")H.forEach((T)=>{let X=T.indexOf(":"),Q=(X===-1?T:T.slice(0,X)).trim(),re=X===-1?Q:T.slice(X+1).trim();if(Q&&re)M[re]=j[Q]});else M[I]=j}else M[I]=j;if(V)if(!K&&B&&Array.isArray(j)&&j.length===2)M[V]=j[0],M[I]=j[1];else M[V]=E;let C=ce(W,M);C=or(C,M,c,e,!0),C=se(C,M,c),C=le(C,M);let q=C.indexOf(ee),G=C.indexOf(ne),Y=q<0?G:G<0?q:Math.min(q,G);if(Y>=0)C=C.slice(0,Y);if(C=_(C,M,c),C=be(C,M),C=me(C,M),C=he(C,M),U+=C,Y>=0&&Y===q)break}a=a.substring(0,h)+U+a.substring(k)}catch(F){let R=l("Foreach",`Error in @foreach(${S.trim()} as ${v.trim()}): ${F instanceof Error?F.message:String(F)}`,t.EVALUATION_ERROR);a=a.substring(0,h)+R+a.substring(k)}}return a}i=b(i,r),i=$e(i,r,c,e);let p=e?.loops?.maxWhileIterations??de;return i=we(i,r,p),o?i:ps(i)}function Of(n){let r=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(n);if(!r||/^(?:const|let|var)$/.test(r[2]))return n;return`${r[1]}let ${n.slice(r[1].length)}`}function ge(n){return Xs(n)}function $e(n,r,c,e){let o=n,i=!0;while(i){i=!1;let g=o.match(/@for\s*\(/);if(!g||g.index===void 0)break;let x=g.index,b=x+g[0].length-1,p=w(o,"(",")",b);if(p===-1)break;let s=Of(o.slice(b+1,p)),m=p+1,a=ws(o.slice(x),"for","endfor");if(a.length===0)break;let y=a[0].content,h=x+a[0].end;if(!ge(s)){let k=l("For",`Unsafe expression in @for: ${s}`,t.UNSAFE_EXPRESSION);o=o.substring(0,x)+k+o.substring(h),i=!0;continue}try{let k=Ae(s),S=/@(?:for|foreach|if|unless)\s*\(/.test(y);if(k.length>0&&S){let D=Re({forExpr:s,content:y,iterVarNames:k,context:r,filePath:c,options:e});o=o.substring(0,x)+D+o.substring(h),i=!0;continue}let v=Object.keys(r),W=Object.values(r),F=ae(y),B=Function(...v,"__stxRenderLoopValue",`
|
|
3
3
|
let result = '';
|
|
4
4
|
for (${s}) {
|
|
5
5
|
result += \`${F}\`;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Kg}from"./chunk-tc15aznt.js";import"./chunk-mjjfx1yp.js";import"./chunk-pda7fv19.js";import"./chunk-m8w7rcmt.js";import"./chunk-0xv48z98.js";import"./chunk-1cxf9chb.js";import"./chunk-kmr3cd71.js";import"./chunk-c5fved0k.js";import"./chunk-2ws2qe1k.js";import"./chunk-vbc8a8fh.js";import"./chunk-3z0e637x.js";import"./chunk-bmkm1c8s.js";import"./chunk-d2vr1169.js";import"./chunk-8taa0exz.js";import"./chunk-m7hfcxt3.js";import"./chunk-gebb12ak.js";import"./chunk-r9e0r6jx.js";import"./chunk-ybjfr7e8.js";export{Kg as startProductionServer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$h,Pf,Je,ic,Rh,as,cs,ls}from"./chunk-
|
|
2
|
+
import{$h,Pf,Je,ic,Rh,as,cs,ls}from"./chunk-5d8123c9.js";import"./chunk-p9y5hh4m.js";import"./chunk-0xv48z98.js";import"./chunk-y7sf7aj0.js";import"./chunk-1carv1dw.js";import"./chunk-d2vr1169.js";import"./chunk-8taa0exz.js";import"./chunk-m7hfcxt3.js";import"./chunk-gebb12ak.js";import"./chunk-r9e0r6jx.js";import"./chunk-ybjfr7e8.js";export{Rh as clearOnceStore,ic as onceStore,Je as partialsCache,as as processIncludes,cs as processStackPushDirectives,ls as processStackReplacements,$h as resetUnscopedSignalWarnings,Pf as topLevelElements};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{oa,Yg,ia,Zg,Dl,Ll,Qg,em}from"./chunk-74ck7kk1.js";import"./chunk-5h0p34jj.js";import"./chunk-few3k1dz.js";import"./chunk-m8w7rcmt.js";import"./chunk-7sh9fa3q.js";import"./chunk-3ht64v1a.js";import"./chunk-1cxf9chb.js";import"./chunk-1carv1dw.js";import"./chunk-kmr3cd71.js";import"./chunk-c5fved0k.js";import"./chunk-2ws2qe1k.js";import"./chunk-vbc8a8fh.js";import"./chunk-3z0e637x.js";import"./chunk-bmkm1c8s.js";import{Pt,Jf}from"./chunk-d2vr1169.js";import"./chunk-8taa0exz.js";import"./chunk-m7hfcxt3.js";import"./chunk-gebb12ak.js";import"./chunk-r9e0r6jx.js";import"./chunk-ybjfr7e8.js";export{oa as buildScriptVirtualFile,Yg as buildVirtualSource,Pt as extractScriptBlocks,Jf as extractTemplateExpressions,Dl as findRuntimeTypeDeclarations,Ll as findStxModuleDeclarations,em as formatTypecheckDiagnostics,Zg as sourcePathFor,Qg as typecheckStxFiles,ia as virtualPathFor};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{B,Bf,Go,a,I,Fh,zh}from"./chunk-
|
|
2
|
+
import{B,Bf,Go,a,I,Fh,zh}from"./chunk-kmr3cd71.js";import"./chunk-c5fved0k.js";import"./chunk-2ws2qe1k.js";import"./chunk-vbc8a8fh.js";import"./chunk-3z0e637x.js";import"./chunk-bmkm1c8s.js";import"./chunk-d2vr1169.js";import"./chunk-8taa0exz.js";import"./chunk-m7hfcxt3.js";import"./chunk-gebb12ak.js";import"./chunk-r9e0r6jx.js";import"./chunk-ybjfr7e8.js";export{I as config,B as defaultConfig,Fh as defineStxConfig,Go as discoverConfig,a as loadStxConfig,Bf as resolveStxDirectories,zh as validateConfig};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-gebb12ak.js";import"./chunk-ybjfr7e8.js";import"./chunk-r9e0r6jx.js";import"./chunk-
|
|
2
|
+
import"./chunk-gebb12ak.js";import"./chunk-ybjfr7e8.js";import"./chunk-r9e0r6jx.js";import"./chunk-d2vr1169.js";import"./chunk-m7hfcxt3.js";import"./chunk-8taa0exz.js";import"./chunk-2ws2qe1k.js";import"./chunk-c5fved0k.js";import{c}from"./chunk-0rjcbqk3.js";import u from"fs";import l from"path";async function d(e,t={}){let s=Date.now(),n={total:0,passed:0,failed:0,new:0,failures:[],duration:0},i=t.snapshotDir||c(e.root,"story","snapshots");await u.promises.mkdir(i,{recursive:!0});let r=e.storyFiles;if(t.filter&&t.filter.length>0)r=r.filter((a)=>t.filter.some((o)=>a.fileName.toLowerCase().includes(o.toLowerCase())));for(let a of r)await h(a,i,t,n);return n.duration=Date.now()-s,n}async function h(e,t,s,n){let i=e.story;if(!i)return;for(let r of i.variants){n.total++;let a=l.join(t,`${e.id}-${r.id}.snap`),o=g(r.source||""),f=await w(a);if(s.update||!f){let p={storyId:e.id,variantId:r.id,component:e.fileName,timestamp:Date.now(),hash:o};if(await u.promises.writeFile(a,JSON.stringify(p,null,2)),!f)n.new++;n.passed++}else try{let p=await u.promises.readFile(a,"utf-8"),m=JSON.parse(p);if(m.hash===o)n.passed++;else n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:"Snapshot mismatch",difference:y(m.hash,o)})}catch(p){n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:`Error reading snapshot: ${p}`})}}}async function x(e,t={}){return(await d(e,{...t,update:!0})).total}function g(e){let t=0;for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);t=(t<<5)-t+n,t=t&t}return t.toString(16)}function y(e,t){if(e===t)return 0;let s=Math.abs(Number.parseInt(e,16)-Number.parseInt(t,16));return Math.min(s/1e6,1)}async function w(e){try{return await u.promises.access(e),!0}catch{return!1}}function F(e){let t=[];if(t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(" STX Story Visual Regression Tests"),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),e.failures.length>0){t.push(" \u274C Failures:"),t.push("");for(let s of e.failures){if(t.push(` \u2022 ${s.component} / ${s.variantId}`),t.push(` ${s.message}`),s.difference!==void 0)t.push(` Difference: ${(s.difference*100).toFixed(2)}%`);t.push("")}}if(t.push(" Summary:"),t.push(` Total: ${e.total}`),t.push(` Passed: ${e.passed} \u2713`),t.push(` Failed: ${e.failed} \u2717`),e.new>0)t.push(` New: ${e.new} \u26A1`);return t.push(` Time: ${e.duration}ms`),t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),t.join(`
|
|
3
3
|
`)}export{F as formatTestResults,d as runVisualTests,x as updateSnapshots};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{tr,i}from"./chunk-gt0csenq.js";import"./chunk-m8zbae89.js";import"./chunk-5d8123c9.js";import"./chunk-c84pxd2k.js";import"./chunk-p9y5hh4m.js";import"./chunk-0xv48z98.js";import"./chunk-q9ggx1jb.js";import"./chunk-y7sf7aj0.js";import"./chunk-3ht64v1a.js";import{we}from"./chunk-1cxf9chb.js";import"./chunk-1carv1dw.js";import"./chunk-z1edw8fc.js";import"./chunk-kmr3cd71.js";import"./chunk-c5fved0k.js";import"./chunk-2ws2qe1k.js";import"./chunk-vbc8a8fh.js";import"./chunk-3z0e637x.js";import"./chunk-bmkm1c8s.js";import{Oe,zs,Hs}from"./chunk-d2vr1169.js";import"./chunk-8taa0exz.js";import"./chunk-m7hfcxt3.js";import"./chunk-gebb12ak.js";import"./chunk-r9e0r6jx.js";import"./chunk-ybjfr7e8.js";export{tr as buildModulesTag,we as injectRouterScript,i as processDirectives,zs as processJsonDirective,Hs as processOnceDirective,Oe as validateClientScript};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{m,h,p}from"./chunk-
|
|
2
|
+
import{m,h,p}from"./chunk-d2vr1169.js";import{B}from"./chunk-kmr3cd71.js";import{i}from"./chunk-gt0csenq.js";import k from"path";var q={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var M=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function H(e){let t=[],o=0,n;M.lastIndex=0;while((n=M.exec(e))!==null){if(n.index>o){let a=e.slice(o,n.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let s=n[1],r=n[2];t.push({type:"suspense",name:s,content:r}),o=n.index+n[0].length}if(o<e.length){let s=e.slice(o);if(s.trim())t.push({type:t.length===0?"shell":"content",content:s})}if(t.length===0)t.push({type:"shell",content:e});return t}async function Om(e,t={},o={}){let n={...B,...o,streaming:{...q,...o.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),g=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y={...t,__filename:e,__dirname:k.dirname(e)};if(g.trim())await m(g,y,e);let E=H(c),l=new Set;if(!E.some((w)=>w.type==="suspense")){let w=n.streaming?.strategy||"auto",x=new RegExp(T.source,"g");if(!(w!=="manual"&&x.test(c))){let u=await i(c,y,e,n,l);for(let b=0;b<u.length;b+=s)r.enqueue(u.slice(b,b+s)),await new Promise((f)=>setTimeout(f,0))}else{let u=[],b=new RegExp(T.source,"g"),f;while((f=b.exec(c))!==null)u.push({name:f[1],content:f[2],start:f.index,end:f.index+f[0].length});let v=0;for(let _ of u){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let O=await i(I,y,e,n,l);r.enqueue(O),await new Promise((D)=>setTimeout(D,0))}}let C=await i(_.content,y,e,n,l);r.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await i(_,y,e,n,l);r.enqueue(C)}}}}else{let w=new Map;for(let d of E)if(d.type==="shell"||d.type==="content"){let u=await i(d.content,y,e,n,l);r.enqueue(u)}else if(d.type==="suspense"&&d.name){let u=`stx-suspense-${d.name}`;r.enqueue(`<div id="${u}" data-suspense="${d.name}" style="display:contents;">
|
|
3
3
|
<template data-suspense-fallback>Loading...</template>
|
|
4
4
|
</div>`),w.set(d.name,i(d.content,y,e,n,l))}r.enqueue(`
|
|
5
5
|
<script>
|