@stacksjs/stx 0.2.824 → 0.2.825
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-zxnfpy6r.js → chunk-030tgwve.js} +1 -1
- package/dist/{chunk-9cpg01sv.js → chunk-06y0da27.js} +1 -1
- package/dist/{chunk-kgjtq6fb.js → chunk-0kbzs147.js} +2 -2
- package/dist/{chunk-vvvaf66t.js → chunk-0scyzg9r.js} +3 -1
- package/dist/{chunk-a2xy4z6q.js → chunk-0wgjhyb8.js} +1 -1
- package/dist/{chunk-ccvcq9ve.js → chunk-1qwb0pyb.js} +1 -1
- package/dist/{chunk-zb3g4qvd.js → chunk-24d3yy27.js} +4 -4
- package/dist/{chunk-hgwkrd4d.js → chunk-3bny2583.js} +1 -1
- package/dist/{chunk-5rxd1r60.js → chunk-3dz29mpg.js} +1 -1
- package/dist/{chunk-cqq026d3.js → chunk-3e7t4qzd.js} +1 -1
- package/dist/{chunk-01d9sd40.js → chunk-3fwhb1q4.js} +1 -1
- package/dist/{chunk-q5vej1ft.js → chunk-3wjh3aw8.js} +4 -4
- package/dist/{chunk-ejr5k9np.js → chunk-40rzr6qj.js} +1 -1
- package/dist/chunk-4sev2jfs.js +2 -0
- package/dist/chunk-5e5jschg.js +3 -0
- package/dist/{chunk-dd74gjmv.js → chunk-5ea3zebc.js} +1 -1
- package/dist/{chunk-281eg1pf.js → chunk-6tfhx4zw.js} +1 -1
- package/dist/{chunk-jy0tvbtg.js → chunk-716qmx26.js} +1 -1
- package/dist/chunk-7bjxmzre.js +2 -0
- package/dist/{chunk-ct4qnbtn.js → chunk-7mw1yc6j.js} +1 -1
- package/dist/chunk-7vfq8t4x.js +2 -0
- package/dist/{chunk-k5s6ngaf.js → chunk-9fm8khcc.js} +2 -2
- package/dist/{chunk-3smq9j5a.js → chunk-9w9vr35m.js} +1 -1
- package/dist/{chunk-36ga0q0r.js → chunk-a1htb5r5.js} +6 -6
- package/dist/{chunk-w01f9n4r.js → chunk-ac2vz9c3.js} +2 -2
- package/dist/{chunk-h1djr7rt.js → chunk-an1cc36z.js} +1 -1
- package/dist/{chunk-aq5xxevm.js → chunk-ap2t6fdt.js} +1 -1
- package/dist/{chunk-kfvbd9c9.js → chunk-axwa3s1m.js} +1 -1
- package/dist/{chunk-nfzm71pr.js → chunk-b1n2tq8f.js} +2 -2
- package/dist/{chunk-n2zger20.js → chunk-cnh6tcdj.js} +1 -1
- package/dist/{chunk-skh6pwy7.js → chunk-d30p1zvd.js} +1 -1
- package/dist/{chunk-xjtm9gde.js → chunk-dfy5g8cb.js} +1 -1
- package/dist/{chunk-8nb1z4af.js → chunk-djpmrctd.js} +1 -1
- package/dist/{chunk-pxm90y95.js → chunk-dsfdgqmd.js} +1 -1
- package/dist/chunk-e38gkp8q.js +2 -0
- package/dist/{chunk-w992as39.js → chunk-e99szqws.js} +4 -4
- package/dist/{chunk-97d46jvh.js → chunk-en390342.js} +5 -5
- package/dist/{chunk-56brw839.js → chunk-faxbznng.js} +1 -1
- package/dist/chunk-fm8hq9y2.js +2 -0
- package/dist/{chunk-t9hrbrw0.js → chunk-g0zxp9qh.js} +4 -4
- package/dist/{chunk-jntc0v38.js → chunk-ge0k6c49.js} +1 -1
- package/dist/{chunk-nx6kvnhw.js → chunk-gp37b8vw.js} +1 -1
- package/dist/{chunk-jbv8197c.js → chunk-hras294c.js} +1 -1
- package/dist/{chunk-x4pzwbns.js → chunk-jb2rvsf4.js} +1 -1
- package/dist/{chunk-0hs4nee7.js → chunk-kg9gnar1.js} +1 -1
- package/dist/{chunk-akd4f3pg.js → chunk-kq5k2qbz.js} +1 -1
- package/dist/{chunk-c9dywwkx.js → chunk-kvgxmb0s.js} +3 -3
- package/dist/{chunk-12g7me4m.js → chunk-pbpr3bdy.js} +1 -1
- package/dist/chunk-pgpkrf6g.js +2 -0
- package/dist/{chunk-qsdwmymw.js → chunk-px6336z8.js} +1 -1
- package/dist/chunk-rqdnzbq0.js +2 -0
- package/dist/{chunk-fr1585t7.js → chunk-rrkn40eq.js} +1 -1
- package/dist/{chunk-jkyw0xmt.js → chunk-rzt51r2b.js} +1 -1
- package/dist/{chunk-d6jcyxad.js → chunk-sfr0767s.js} +1 -1
- package/dist/chunk-sx8j2e58.js +2 -0
- package/dist/chunk-t2tv5ezg.js +2 -0
- package/dist/{chunk-wfh3g5w4.js → chunk-vfy3b7gm.js} +2 -2
- package/dist/chunk-vvjp9xp0.js +2 -0
- package/dist/{chunk-z73wddy9.js → chunk-vyj9xddw.js} +1 -1
- package/dist/{chunk-caz5a61p.js → chunk-xegj9wqj.js} +1 -1
- package/dist/{chunk-0vtdhckb.js → chunk-xmdcjyyx.js} +1 -1
- package/dist/{chunk-7vvhdrby.js → chunk-y3trpdp9.js} +1 -1
- package/dist/{chunk-kqbkvfmg.js → chunk-yr3ped5m.js} +1 -1
- package/dist/{chunk-9r0cx3k4.js → chunk-z5hmwq1z.js} +1 -1
- package/dist/{chunk-n5kg8njw.js → chunk-zen28e3p.js} +2 -2
- package/dist/{chunk-phs7n6tk.js → chunk-zqsygwa0.js} +1 -1
- package/dist/cli.js +8 -8
- package/dist/client/signals-component-props-runtime.js +3 -1
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-4ka2g6bp.js +0 -2
- package/dist/chunk-88th2wz6.js +0 -2
- package/dist/chunk-9cp6whxd.js +0 -2
- package/dist/chunk-aqesy5ac.js +0 -2
- package/dist/chunk-cknd3nb7.js +0 -2
- package/dist/chunk-crxtxw1d.js +0 -2
- package/dist/chunk-ezm9jzz1.js +0 -2
- package/dist/chunk-f6dm5a98.js +0 -2
- package/dist/chunk-kd8w41p2.js +0 -3
- package/dist/chunk-stp2hgag.js +0 -2
- package/dist/chunk-y9ak2xcy.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{hn,Qf,eg,tg,ng,rg,m,sg,mi,og,qc,Kc}from"./chunk-
|
|
2
|
+
import{hn,Qf,eg,tg,ng,rg,m,sg,mi,og,qc,Kc}from"./chunk-a1htb5r5.js";import"./chunk-axwa3s1m.js";import"./chunk-2vqpz4qv.js";import"./chunk-8ttmzcxb.js";import"./chunk-r9e0r6jx.js";import"./chunk-bt0amey5.js";export{hn as STX_ENGINE_BINDING_NAMES,mi as convertToCommonJS,qc as extractScriptFromTemplate,m as extractVariables,Kc as hasVariables,sg as isCompleteImport,rg as isMissingBindingFailure,tg as isModuleResolutionFailure,ng as isSyntaxFailure,og as splitDeclaration,Qf as stripTypeScript,eg as withoutStxReferrer};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{_}from"./chunk-
|
|
2
|
+
import{_}from"./chunk-a1htb5r5.js";import{i}from"./chunk-24d3yy27.js";import p from"fs";import g from"path";import*as y from"readline";var e={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},u={help:{description:"Show available commands",usage:"help [command]",handler:async(t,o)=>{if(t[0]&&u[t[0]]){let n=u[t[0]];console.log(`
|
|
3
3
|
${e.bold}${t[0]}${e.reset} - ${n.description}`),console.log(` Usage: ${e.cyan}${n.usage}${e.reset}
|
|
4
4
|
`)}else{console.log(`
|
|
5
5
|
${e.bold}Available Commands:${e.reset}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{at,fl}from"./chunk-bt0amey5.js";import{P}from"./chunk-r9e0r6jx.js";import{H,Is,o,dn,W,y,Pc,Nt,yn,je,Be}from"./chunk-
|
|
2
|
+
import{at,fl}from"./chunk-bt0amey5.js";import{P}from"./chunk-r9e0r6jx.js";import{H,Is,o,dn,W,y,Pc,Nt,yn,je,Be}from"./chunk-a1htb5r5.js";import{cr}from"./chunk-e99szqws.js";import{j}from"./chunk-cmnze7at.js";import{ln}from"./chunk-2nj9aewf.js";var X=`(?:"[^"]*"|'[^']*'|[^>"'])*`,Q=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,q=65536,J=4,N=new Map;function Nh(){N.clear()}function K(e){let c=[];for(let t of y(e,W)){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 ps(e,c={}){let t=e.length>=q,n=t?N.get(e):void 0;if(n===void 0){if(n=K(e),t)Pc(N,J),N.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 Vo(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 gs(e,c){return fl(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 ir(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(${X})>`,"iy"),t=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,n=y(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=Vo(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)||M.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 B=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 Z(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(B.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(B.has(l)||t&&l in t)continue;i=!0}return(u||i)&&!f}function L(e,c,t){let n=t===void 0?` ${c}`:` ${c}="${t.replace(/"/g,""")}"`,s=e.trim(),u=s.match(Q);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 Uo(e,c){let t=ir(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,w=1,E=S,x=/@(if\s*\(|endif)/g;x.lastIndex=S;let h;while((h=x.exec(u))!==null)if(h[1].startsWith("if"))w++;else if(h[1]==="endif"){if(w--,w===0){E=h.index+h[0].length;break}}if(w!==0)continue;let R=u.substring(S,E-6).trim(),A;if(Y(R)){let C=ln(u.substring(a,E));if(C.length===0)continue;let T=C[0].branches.filter((_)=>_.type!=="else"),k=i(a);if(!(T.length>0&&T.every((_)=>Z(_.condition,t,c,k))))continue;A=C[0].branches.map((_)=>{let V=n(_.content);if(_.type==="elseif")return L(V,"@else-if",_.condition??"");if(_.type==="else")return L(V,"@else");return L(V,"@if",_.condition??"")}).join(`
|
|
3
3
|
`)}else{if(!Z(b,t,c,i(a)))continue;A=L(n(R),"@if",b)}r.push({start:a,end:E,replacement:A}),p.lastIndex=E}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 M=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),F=/<(script|style)\b/iy,re=/<\/script/gi,ie=/<\/style/gi;function D(e,c,t,n){if(M.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}F.lastIndex=i;let m=F.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)||M.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 Wo(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"]);y(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 w=l;while(l<r.length&&!n.test(r[l])&&r[l]!=="="&&r[l]!==">")l++;if(l===w)return-1;let E=r.slice(w,l);if(E.startsWith("@")&&E.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(E))d={attrName:E,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))||M.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 U=[":for","@for","x-for"];function Df(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 ms(e,c){if(!c||Object.keys(c).length===0)return e;if(!U.some((i)=>e.includes(`${i}=`)))return e;let t=ir(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=U.map((A)=>({attr:A,m:new RegExp(`\\s${A}="([^"]*)"`).exec(m)})).find((A)=>A.m!==null);if(!g||!g.m)continue;let l=Vo(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|$)/,""),w=n.slice(a,b-`</${p}>`.length),E={...c,[l.itemVar]:void 0};if(l.indexVar)E[l.indexVar]=void 0;let x=ms(w,E),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 hs(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=Vo(g),b=i==="for"?"@endfor":"@endforeach",S=1,w=l,E=i==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${i}\\s*\\(|end${i})`,"g");E.lastIndex=l;let x;while((x=E.exec(t))!==null)if(x[1].startsWith(i))S++;else if(S--,S===0){w=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:w,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,V=f.some((O)=>p>O.start&&p<O.end&&O.vars.includes(I));if(I&&(_||V)){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,w-b.length).trim(),A=c?{...c}:{};if(d.itemVar)delete A[d.itemVar];if(d.indexVar)delete A[d.indexVar];let C=Df(hs(R,A)),T=C.match(Q),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:w,replacement:k}),n.lastIndex=w}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 ue(e){let c=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${X})>`,"iy"),t=null,n=null;return y(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 ys(e,c,t,n={}){let s=ps(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-
|
|
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(${X})>`,"iy"),t=null,n=null;return y(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 ys(e,c,t,n={}){let s=ps(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-zqsygwa0.js"));for(let x of s){let h=x.body;if(je(x.attrs))h=Be(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(Nt(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??Nt(f[x].content).code;if(!f[x].bundled&&i(h))h=await p(h,c||"",{projectRoot:process.cwd()});h=wt(h);let R=P(h);a.push(`// \u2500\u2500 merged signal script #${x+1} \u2500\u2500
|
|
6
6
|
${R}`)}let g=a.join(`
|
|
7
7
|
|
|
8
8
|
`);g=ae(g);let d=H(g).split(",").map((x)=>x.trim()).filter(Boolean),b=yn(g,t),S=`
|
|
@@ -1072,7 +1072,9 @@ else {
|
|
|
1072
1072
|
function resolveComponentCallerScope(el, pageScope) {
|
|
1073
1073
|
if (el && el.__stx_slot_scope) return el.__stx_slot_scope;
|
|
1074
1074
|
if (el && el.__stx_for_scope) return el.__stx_for_scope;
|
|
1075
|
-
|
|
1075
|
+
// Detached conditional branches temporarily lose their ancestor chain.
|
|
1076
|
+
// Keep the captured caller as the base until those ancestors reconnect.
|
|
1077
|
+
return projectedSlotCallerScope(el, pageScope) || componentCallerScopeFrom(el && (el.parentElement || el.parentNode), (el && el.__stx_parent_scope) || pageScope);
|
|
1076
1078
|
}
|
|
1077
1079
|
|
|
1078
1080
|
function projectedSlotCallerScope(el, pageScope) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{tt}from"./chunk-qj4r08jb.js";import{ht,Hn}from"./chunk-
|
|
2
|
+
import{tt}from"./chunk-qj4r08jb.js";import{ht,Hn}from"./chunk-0scyzg9r.js";import{$r,Rr,Ar,Ir,_e}from"./chunk-8ttmzcxb.js";import{Me,gn,Qc,el}from"./chunk-a1htb5r5.js";import{N}from"./chunk-2vqpz4qv.js";import{xi}from"./chunk-axwa3s1m.js";import{b}from"./chunk-ac2vz9c3.js";import{i}from"./chunk-24d3yy27.js";import{B,a}from"./chunk-zen28e3p.js";import{kc}from"./chunk-wf0n9gpj.js";import{Pn,We,Ee,ua,da,In}from"./chunk-kvgxmb0s.js";import{on,Po}from"./chunk-faxbznng.js";import{On}from"./chunk-j3st59hv.js";import{Zt,Yn,Zn}from"./chunk-ndjmt3vg.js";import{X}from"./chunk-e99szqws.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function W(n){return Q("sha256").update(n).digest("hex").slice(0,8)}function J(n=!1){let l=n?Hn():ht(),o=W(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function U(){let n=tt(),l=W(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);Qc();let _={};try{_=await a(o.configDir)}catch{}let h=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))h.push(g[2])}let u=new Set(h.flatMap((R)=>Me(R))),{context:D}=te({__filename:r,__dirname:V.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...B,..._,...o,buildMode:"compile",strict:!1},y=await i(e,D,r,T,A),w=Pn(y)+We(y),j=el();return{route:l,sourceFile:n,html:y,fragment:w,placeholders:j,hasServerScripts:h.length>0,serverScriptContent:h,dependencies:Array.from(A),contentHash:S,status:gn(e),streamTemplates:D.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let h=m.readdirSync(S,{withFileTypes:!0});for(let d of h){if(re.has(d.name))continue;let g=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function rm(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),S=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),h=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=_e(e.app?.head,{known:Ir,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=On(A),y=n.serverApi??e.serverApi,w=typeof y==="object"?y:{};if(y)on(o,w);if(e.runtimeConfig)N(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=X(o,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],P=R.filter((s)=>!Y.some((f)=>s.pattern.startsWith(`/${f}/`)||s.pattern===`/${f}`));console.log(`[stx build] Found ${P.length} page routes (${R.length-P.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=J(n.debug),x=U();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let M=[],H=[];for(let s of P){let f=T(s.pattern),O=f.rendering==="prerender";if(O&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await q(s.filePath,s.pattern,{configDir:o,componentsDir:S,partialsDir:_,layoutsDir:h,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,x.filename),t.html=Ar(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=$r(t.html,u);if(g.htmlAttrs)t.html=Rr(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 I=p[1];t.html=t.html.replace(" "+I,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${I}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await b(t.html),O){let p=await In(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=Ee(t.html,D,!0);let L=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),z=c.join("server","pages",`${L}.compiled.json`),G=c.join("server","fragments",`${L}.html`);await Bun.write(c.join(r,z),JSON.stringify(t,null,2)),await Bun.write(c.join(r,G),t.fragment),H.push({pattern:s.pattern,compiledPath:z,fragmentPath:G,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:O}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(f).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let k=c.resolve(o,d);if(m.existsSync(k)){let{copied:s,bytes:f}=Z(k,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${d}/`)}let E=Zn(o);if(E){let{copied:s,bytes:f}=Z(E,c.join(r,"public",Yn));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${Zt}/`)}let F={runtime:v.filename,router:x.filename},C=ua(H,F,r);if(C.routeRules=A,C.routerContainer=D,y)C.apiRoutes=await Po(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await xi(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(kc(e._layerGraph),null,2));da(C,r);let K=Date.now()-l;return console.log(`
|
|
3
3
|
[stx build] Done in ${K}ms \u2014 ${M.length} pages compiled`),{pageCount:M.length,assets:F,outputDir:r,duration:K}}
|
|
4
4
|
export{rm};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Hl,hm,Vl,Ul,ym,bm}from"./chunk-
|
|
2
|
+
import{Hl,hm,Vl,Ul,ym,bm}from"./chunk-yr3ped5m.js";import"./chunk-a1htb5r5.js";import"./chunk-axwa3s1m.js";import"./chunk-2vqpz4qv.js";import"./chunk-8ttmzcxb.js";import"./chunk-r9e0r6jx.js";import"./chunk-bt0amey5.js";export{bm as applySlots,ym as extractSlotContent,hm as parseSlotElement,Hl as parseSlots,Ul as processSlots,Vl as renderSlot};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Lt,ie,u,f,A,t,ae,q,l,ke,_i,F,Sn,Ci,Ft,Ei,ol,$r,il,it,al,Rr,cl,kn,Ti,ll,Ar,Ir,_e,$i}from"./chunk-8ttmzcxb.js";import{ai,Rc,o,C,Oe,pn,Ne,pe,G,vr,fn,Bs,Bc,Fc,mn,_r,zs,Hs,zc,gi,Hc,Vc,Uc,Wc,De,Le,Vs,Fe,s,bn,h,p,U,Z,Se,_}from"./chunk-
|
|
2
|
+
import{Lt,ie,u,f,A,t,ae,q,l,ke,_i,F,Sn,Ci,Ft,Ei,ol,$r,il,it,al,Rr,cl,kn,Ti,ll,Ar,Ir,_e,$i}from"./chunk-8ttmzcxb.js";import{ai,Rc,o,C,Oe,pn,Ne,pe,G,vr,fn,Bs,Bc,Fc,mn,_r,zs,Hs,zc,gi,Hc,Vc,Uc,Wc,De,Le,Vs,Fe,s,bn,h,p,U,Z,Se,_}from"./chunk-a1htb5r5.js";import{Dt}from"./chunk-2vqpz4qv.js";import{vn}from"./chunk-axwa3s1m.js";import{b}from"./chunk-ac2vz9c3.js";import{gr,As}from"./chunk-qj4r08jb.js";import{fc,gc,dr,Qe,mc,I}from"./chunk-zen28e3p.js";import{Zo,Qo,ei,ti}from"./chunk-xpy9yjyx.js";import{cc,us}from"./chunk-djpmrctd.js";import{is,as,cs}from"./chunk-g0zxp9qh.js";import{gs,Uo,Wo,ms,hs,qo}from"./chunk-0kbzs147.js";import{ds,or}from"./chunk-hras294c.js";import{Do}from"./chunk-c84pxd2k.js";import{se,Fo,zo,Ho}from"./chunk-wceg59n0.js";import{ar,be,uc,cr,dc}from"./chunk-e99szqws.js";import{j,Ye}from"./chunk-cmnze7at.js";import{hc,yc}from"./chunk-jb2rvsf4.js";import{E,_n,Ri}from"./chunk-wpendr22.js";import Xn from"fs";import oe from"path";function ut(){return`
|
|
3
3
|
// STX Lifecycle Runtime
|
|
4
4
|
(function() {
|
|
5
5
|
if (typeof window === 'undefined') return;
|
|
@@ -1293,7 +1293,7 @@ ${R}
|
|
|
1293
1293
|
</style>`;a=a.replace(x,D),y.lastIndex=0}catch(R){}}}return a}import st from"path";var qn=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,Vn=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function Wn(n,e){if(!e||!n.includes("/"))return n;let c=st.dirname(e);return n.replace(qn,(a,g,r,d)=>{let y=st.resolve(c,d);return`${g}${r}${y.split(st.sep).join("/")}${r}`})}function lr(n,e){if(!e||!n.includes("<script"))return n;return n.replace(Vn,(c,a,g,r)=>`${a}${Wn(g,e)}${r}`)}var Ee="<!--PARENT_CONTENT_PLACEHOLDER-->";function ur(n){return n.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function wr(n,e){let c=n.length,a=e,g=!0,r=[],d=(y)=>y+9<=c&&n[y]==="<"&&n[y+1]==="/"&&(n[y+2]==="s"||n[y+2]==="S")&&(n[y+3]==="c"||n[y+3]==="C")&&(n[y+4]==="r"||n[y+4]==="R")&&(n[y+5]==="i"||n[y+5]==="I")&&(n[y+6]==="p"||n[y+6]==="P")&&(n[y+7]==="t"||n[y+7]==="T")&&(n[y+8]===">"||/\s/.test(n[y+8]));while(a<c){let y=n[a];if(d(a))return a;if(y==="/"&&n[a+1]==="/"){if(a=n.indexOf(`
|
|
1294
1294
|
`,a+2),a===-1)return-1;a+=1,g=!0;continue}if(y==="/"&&n[a+1]==="*"){let m=n.indexOf("*/",a+2);if(m===-1)return-1;a=m+2,g=!0;continue}if(y==="/"&&g){let m=a+1,x=!1;while(m<c){let w=n[m];if(w==="\\"){m+=2;continue}if(w==="[")x=!0;else if(w==="]")x=!1;else if(w==="/"&&!x){m++;break}else if(w===`
|
|
1295
1295
|
`){m=-1;break}m++}if(m===-1){a++,g=!1;continue}while(m<c&&/[a-z]/.test(n[m]))m++;a=m,g=!1;continue}if(y==="'"||y==='"'){let m=y;a++;while(a<c){if(n[a]==="\\"){a+=2;continue}if(n[a]===m){a++;break}if(n[a]===`
|
|
1296
|
-
`)break;a++}g=!1;continue}if(y==="`"){a++;while(a<c){if(n[a]==="\\"){a+=2;continue}if(n[a]==="`"){a++;break}if(n[a]==="$"&&n[a+1]==="{"){r.push(!0),a+=2,g=!0;break}a++}if(r.length===0)g=!1;continue}if(y==="}"&&r.length>0){r.pop(),a++;while(a<c){if(n[a]==="\\"){a+=2;continue}if(n[a]==="`"){a++,g=!1;break}if(n[a]==="$"&&n[a+1]==="{"){r.push(!0),a+=2,g=!0;break}a++}continue}if(/\s/.test(y));else if(/[)\].\w$]/.test(y))g=!1;else g=!0;a++}return-1}function xr(n,e){let c=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${c}(?:\\s|=|/?>))[^>]*>`,"i").exec(n);if(!a)return null;let g=a.index+a[0].length,r=n.indexOf("</script>",g);if(r===-1)return null;let d=n.indexOf(">",r);if(d===-1)return null;return{start:a.index,end:d+1}}var zn=4096;async function ot(n,e,c){if(c.buildMode!=="serve"||e.length<zn)return null;let{registerServeModuleBundle:a}=await import("./chunk-
|
|
1296
|
+
`)break;a++}g=!1;continue}if(y==="`"){a++;while(a<c){if(n[a]==="\\"){a+=2;continue}if(n[a]==="`"){a++;break}if(n[a]==="$"&&n[a+1]==="{"){r.push(!0),a+=2,g=!0;break}a++}if(r.length===0)g=!1;continue}if(y==="}"&&r.length>0){r.pop(),a++;while(a<c){if(n[a]==="\\"){a+=2;continue}if(n[a]==="`"){a++,g=!1;break}if(n[a]==="$"&&n[a+1]==="{"){r.push(!0),a+=2,g=!0;break}a++}continue}if(/\s/.test(y));else if(/[)\].\w$]/.test(y))g=!1;else g=!0;a++}return-1}function xr(n,e){let c=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${c}(?:\\s|=|/?>))[^>]*>`,"i").exec(n);if(!a)return null;let g=a.index+a[0].length,r=n.indexOf("</script>",g);if(r===-1)return null;let d=n.indexOf(">",r);if(d===-1)return null;return{start:a.index,end:d+1}}var zn=4096;async function ot(n,e,c){if(c.buildMode!=="serve"||e.length<zn)return null;let{registerServeModuleBundle:a}=await import("./chunk-6tfhx4zw.js");return`<script ${n} src="${a(e)}"></script>`}async function tr(n,e,c,a){try{let{registeredModuleIdsIn:g,buildModuleRegistryScript:r}=await o("stx/client-module-registry",()=>import("./chunk-d30p1zvd.js")),d=[],y=await r(g(...n),{minify:Ri(e.buildMode,e.minifyClient),collectInputs:d});for(let m of d)c?.add(m);if(a)a.inputs=d,a.code=y??void 0;if(!y)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:m}=await import("./chunk-6tfhx4zw.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${m(y)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${y.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}async function Kn(n,e,c,a){let g={modulesTag:null,modulesCode:null,storeTag:null,storeCode:null,composableTag:null,composableCode:null,frameworkScript:null};try{let{getFrameworkComposableScript:k}=await o("stx/framework-composables",()=>import("./chunk-ap2t6fdt.js"));g.frameworkScript=await k(n)}catch{}let r=null;try{r=await o("stx/store-loader",()=>import("./chunk-t2tv5ezg.js"))}catch{}let d=e.storesDir,y=!!a.__stx_native_screen||(r?.pageStoresAll()??!0),m=y?"":n.replace(/<script\b[^>]*\bdata-stx-(?:runtime|router|hmr)\b[^>]*>[\s\S]*?<\/script>/gi,""),x=[],w=[],v=null;for(let k=0;k<8;k++){let S=null,M="",T=!1;try{if(r){let N=y?await r.getStoreScript(d).then((B)=>B?{code:B,stores:["*"],functions:null}:null):await r.getStoreScriptFor(d,[m],{reads:r.storesReadInFiles([...x,...w]),runOnce:!0});if(N)S=N.code,M=N.stores.join(","),T=!!N.functions&&!y}}catch{}if(v!==null&&M===v)break;v=M;let R=T?'data-stx-scoped data-stx-run="always" data-stx-stores':"data-stx-stores",D=S?`<script ${R}>${S}</script>`:null;g.storeCode=S,g.storeTag=S?await ot(R,S,e)??D:null;let P={};g.modulesTag=await tr([n,D],e,c,P),g.modulesCode=P.code??null,x=P.inputs??[],g.composableTag=null,g.composableCode=null,w=[];try{let{getComposableScript:N}=await o("stx/composable-loader",()=>import("./chunk-e38gkp8q.js")),B=e.composablesDir,O=[g.modulesCode??g.modulesTag,D,g.frameworkScript].filter((H)=>H!==null),L=await N(e._layerComposableDirs??B,n,O,w);if(L)g.composableCode=L,g.composableTag=await ot('data-stx-scoped data-stx-run="always" data-stx-composables',L,e)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${L}</script>`}catch{}if(y||!r)break}return g}async function Gn(n,e,c,a={}){let{withModuleSubstitutes:g,moduleSubstitutionKey:r}=await import("./chunk-zqsygwa0.js"),d=await import("./chunk-tg18j1yf.js"),{messages:y,webModules:m}=e,x=null,w=null,v=r()===""&&!a.__stx_native_screen;if(y&&d.pageMessagesEnabled(e)&&v)try{x=await d.loadPageMessages(process.cwd(),y)}catch(R){Zn(R)}if(m&&Object.keys(m).length&&v)try{w=await(await import("./chunk-076fj387.js")).loadWebModules(process.cwd(),m)}catch(R){Jn(R)}let k=new Map([...w??[],...x?.stubs??[]]),S=()=>Kn(n,e,c,a),M=k.size?await g(k,S):await S(),T=null;if(x){let R=d.messageAreasIn(M.modulesCode,M.storeCode,M.composableCode),D=d.pageMessagesScript(x,d.pageLanguages(n,x),R);if(D)T=await ot('data-stx-scoped data-stx-run="always" data-stx-messages',D,e)??`<script data-stx-scoped data-stx-run="always" data-stx-messages>${D.replace(/<\/script/gi,"<\\/script")}</script>`}return[T,M.modulesTag,M.storeTag,M.composableTag,M.frameworkScript].filter((R)=>R!==null)}var pr=!1;function Zn(n){if(pr)return;pr=!0,console.warn(`[stx] messages: ${n instanceof Error?n.message:String(n)}; pages ship every language`)}var fr=!1;function Jn(n){if(fr)return;fr=!0,console.warn(`[stx] ${n instanceof Error?n.message:String(n)}; pages bundle the real modules`)}function Qn(n,e=""){let c=xr(n,"data-stx-runtime");if(!c)return n;let a=ar(n);if(a===-1||a===c.start){if(!e)return n;return n.slice(0,c.end)+e+n.slice(c.end)}if(a<c.start)return n.slice(0,a)+n.slice(c.start,c.end)+e+`
|
|
1297
1297
|
`+n.slice(a,c.start)+n.slice(c.end);let g=n.slice(c.start,c.end),r=n.slice(0,c.start)+n.slice(c.end),d=ar(r);if(d===-1)return g+e+`
|
|
1298
1298
|
`+r;return r.slice(0,d)+g+e+`
|
|
1299
1299
|
`+r.slice(d)}function Yn(n){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return n.replace(e,(c,a,g)=>{let r=n.slice(0,g);return r.lastIndexOf("<")>r.lastIndexOf(">")?`{{${a}}}`:`{<!--stx-literal-->{${a}}}`})}async function i(n,e,c,a,g){if(a.ssr===!1&&!a.autoShell&&a.buildMode==="spa")return n;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=Se(n,c);let r=!e.__stxProcessingDepth;mn(e);for(let d of a._layerGraph?.configDependencies??[])g.add(d);if(r&&a.runtimeConfig)await vn(e,c,a.runtimeConfig);if(r)Uc(e),e.__stx_scope_seq??={n:0,key:Vs(String(e.__filename??c))},e.__stx_head_injections=Ei(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((a.debug||!E()&&!_n())&&c&&c.endsWith(".stx"))Do(n,c);try{return await ie.timeAsync("template-processing",async()=>{let d=await es(n,e,c,a,g);if(r)d=gi(d);if(r&&a.autoShell&&a.buildMode!=="compile"){let y=_e(a.app?.head,{known:Ir,source:"app.head"}),x=(e.__stx_runtime_head||null)??$i(),w=(e.__stx_head_raw||"").trim(),v,k=w.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(k)v=k[1].trim(),w=w.replace(k[0],"").trim();let S=e.__sections?.title,M=S?_(S,e,c):void 0,T=x.title||v||M,R=!x.title&&(!!v||!!M),D=x.meta||[],P=new Set(D.map((X)=>it(X)).filter(Boolean)),N={...y,...T&&{title:T},meta:[...(y.meta||[]).filter((X)=>!P.has(it(X))),...D],link:[...y.link||[],...x.link||[]],script:[...y.script||[],...x.script||[]],headRaw:[y.headRaw,w].filter(Boolean).join(`
|
|
@@ -1308,7 +1308,7 @@ ${m.trim()}
|
|
|
1308
1308
|
@endsection`}}if(D&&m.includes("<script")){let O=G(m),L=O.scripts.map((H)=>mr(H,c)??H);m=vr(O.output,L)}if(m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,L,H)=>(R[L]=H,"")),m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,L,H)=>{if(/^(['"]).*\1$/.test(H.trim()))return O;try{let X=u(H.trim(),e);if(X===void 0)return O;let Y=(e.__stx_inline_section_values??=[]).push(X)-1;return R[L]=`{{ __stx_inline_section_values[${Y}] }}`,""}catch{return O}}),m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,L,H)=>{if(H.includes("@parent"))R[L]=H.replace("@parent",Ee);else R[L]=H.trim();return""}),e.__sections=R,m=m.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,L,H)=>R[L]||H||""),!("slot"in e)||e.slot===void 0)m=m.replace(/\{\{\s*slot\s*\}\}/g,()=>R.content||"");if(m=cs(m,T),D){let O=[],L=G(m),H=pe(L.output,pn,(X,z)=>`\x00STX_ORPHAN_STYLE_${z}\x00`);if(m=H.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(X,z,Y)=>{let ee=z==="SCRIPT"?mr(L.scripts[Number(Y)],c):H.tokens[Number(Y)];if(ee)O.push(ee);return""}),O.length>0){let X=O.join(`
|
|
1309
1309
|
`);R.content=R.content?`${R.content}
|
|
1310
1310
|
${X}`:X,e.__sections=R}}if(D)try{let O;if(oe.isAbsolute(D))O=D,g.add(D);else O=await ke(()=>bn(D,c,d,g),null,()=>{throw new ae(`Failed to resolve layout path: ${D}`,c,void 0,void 0,`Layout referenced from ${c}`)});if(!O){let ee=(K)=>{if(!K)return[];try{let ge=oe.isAbsolute(K)?K:oe.resolve(process.cwd(),K);return Xn.readdirSync(ge).filter((we)=>we.endsWith(".stx")).map((we)=>we.replace(/\.stx$/,""))}catch{return[]}},te=[...ee(d.layoutsDir),...ee(d.fallbackLayoutsDir)].filter((K,ge,we)=>we.indexOf(K)===ge).sort(),ce=[d.layoutsDir,d.fallbackLayoutsDir].filter((K)=>typeof K==="string"&&K.length>0),ue=ce.length>0?` Searched: ${ce.join(", ")} (set \`layoutsDir\` to look elsewhere).`:"",ne=`Layout not found: ${D} (referenced from ${c})`+(te.length>0?`. Available layouts: ${te.join(", ")}`:d.layoutsDir?`. No .stx layouts found in ${d.layoutsDir}`:"")+ue;if(F.log(Error(ne),{layoutPath:D,filePath:c,available:te},"error"),console.error(`[stx] ${ne}`),d.debug)throw new ae(ne,c);return m}let L=await ke(()=>Bun.file(O).text(),"",()=>{throw new ae(`Failed to read layout file: ${O}`,c,void 0,void 0,"Layout content could not be loaded")});L=lr(L,O);let H=L.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(H){if(d.debug)console.log(`Found nested layout: ${H[1]} in ${O}`);let ee={},te=L.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ne,K,ge)=>(ee[K]=ge.trim(),""));for(let[ne,K]of Object.entries(ee))if(R[ne]&&R[ne].includes(Ee)){let ge=R[ne].indexOf(Ee);R[ne]=R[ne].slice(0,ge)+K+R[ne].slice(ge+Ee.length)}else if(!R[ne])R[ne]=K;let ce={...e,__sections:R},ue=`@layout('${H[1]}')${te}`;return await i(ue,ce,O,d,g)}let X=L.replace(/\{\{--[\s\S]*?--\}\}/g,""),z=as(X,T),Y={};return z=z.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ee,te,ce)=>(Y[te]=ce.trim(),`@slot('${te}')`)),z=z.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(ee,te,ce)=>{if(R[te]){let ue=R[te];if(ue.includes(Ee)){let ne=Y[te]||"",K=ue.indexOf(Ee);ue=ue.slice(0,K)+ne+ue.slice(K+Ee.length)}return ue}return ce||""}),z=ts(z,R),z=z.replace(/\{\{\s*slot\s*\}\}/g,()=>R.content||""),z=cs(z,T),e.__originalFilePath=c,m=await br(z,e,O,d,g),m=`<!-- stx-layout: ${D} -->
|
|
1311
|
-
${m}`,v(m)}catch(O){if(O instanceof q)throw O;throw new ae(`Error processing layout ${D}: ${O instanceof Error?O.message:String(O)}`,c)}return v(await br(m,e,c,d,g))}function ts(n,e){return n.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(c,a,g)=>{let r=e[a];if(r!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(r))return r}return g||""})}function rs(n,e){if(n.__stx_sfc_mode=!0,n.__stx_options=e,e.buildMode)n.__stx_buildMode=e.buildMode;let c=e.envPrefix||"STX_PUBLIC_",a={};for(let[g,r]of Object.entries(process.env))if(g.startsWith(c)&&r!==void 0)a[g]=r;n.$env=a}async function ns(n,e){await ke(()=>Xt(n,e),void 0,(c)=>{F.log(c,{filePath:n,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${n}: ${c.message}`)})}var at="data-stx-source";function mr(n,e){if(!n)return n;let c=/^<script\b([^>]*)>/i.exec(n);if(!c||!/\bserver\b/.test(c[1])||c[1].includes(at))return n;return`<script ${at}="${encodeURIComponent(e)}"${n.slice(7)}`}function ss(n){let e=new RegExp(`${at}="([^"]*)"`).exec(n);return e?decodeURIComponent(e[1]):void 0}function hr(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function yr(n,e,c){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a <script server> ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${hr(n)}</span><span style="display:block;margin-top:4px">${hr(c)}</span></div>`}async function ls(n,e,c,a){let{scanScriptTags:g}=await o("stx/signal-processing",()=>import("./chunk-
|
|
1311
|
+
${m}`,v(m)}catch(O){if(O instanceof q)throw O;throw new ae(`Error processing layout ${D}: ${O instanceof Error?O.message:String(O)}`,c)}return v(await br(m,e,c,d,g))}function ts(n,e){return n.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(c,a,g)=>{let r=e[a];if(r!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(r))return r}return g||""})}function rs(n,e){if(n.__stx_sfc_mode=!0,n.__stx_options=e,e.buildMode)n.__stx_buildMode=e.buildMode;let c=e.envPrefix||"STX_PUBLIC_",a={};for(let[g,r]of Object.entries(process.env))if(g.startsWith(c)&&r!==void 0)a[g]=r;n.$env=a}async function ns(n,e){await ke(()=>Xt(n,e),void 0,(c)=>{F.log(c,{filePath:n,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${n}: ${c.message}`)})}var at="data-stx-source";function mr(n,e){if(!n)return n;let c=/^<script\b([^>]*)>/i.exec(n);if(!c||!/\bserver\b/.test(c[1])||c[1].includes(at))return n;return`<script ${at}="${encodeURIComponent(e)}"${n.slice(7)}`}function ss(n){let e=new RegExp(`${at}="([^"]*)"`).exec(n);return e?decodeURIComponent(e[1]):void 0}function hr(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function yr(n,e,c){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a <script server> ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${hr(n)}</span><span style="display:block;margin-top:4px">${hr(c)}</span></div>`}async function ls(n,e,c,a){let{scanScriptTags:g}=await o("stx/signal-processing",()=>import("./chunk-dfy5g8cb.js")),r=[],d=!E()&&!_n();for(let m of g(n)){let x=m.attrs;if(!/\bserver\b/.test(x))continue;let w=m.start+m.fullMatch.indexOf(">")+1,v=wr(n,w);if(v===-1)continue;let k=n.slice(w,v);if(!k.trim())continue;let S=ss(x)??c,M={index:m.start,length:v+9-m.start};try{let{extractVariables:T}=await o("stx/variable-extractor",()=>import("./chunk-030tgwve.js"));await T(k,e,S,{preserveExisting:!0,onFailure:(R)=>{if(R.kind==="unknown")return;if(a?.onServerScriptError?.({sourcePath:S,kind:R.kind,message:R.message}),!d)return;r.push({...M,markup:yr(S,R.kind,R.message)})}})}catch(T){let R=T instanceof Error?T:Error(String(T));if(F.log(R,{filePath:S,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${S}: ${R.message}`),d)r.push({...M,markup:yr(S,"unknown",R.message)})}}if(r.length===0)return n;let y=n;for(let m of r.sort((x,w)=>w.index-x.index))y=y.slice(0,m.index)+m.markup+y.slice(m.index+m.length);return y}async function ps(n,e,c){try{let{interpolateScriptsInTemplate:a}=await o("stx/expressions",()=>import("./chunk-3e7t4qzd.js"));return a(n,e,{skipServer:!0})}catch(a){let g=a instanceof Error?a:Error(String(a));return F.log(g,{filePath:c,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${c}: ${g.message}`),n}}async function br(n,e,c,a,g){let r=n,d=a;if(r=await ls(r,e,c,a),r=await Nt(r,e,c),r=await jt(r,e,c),r=await ps(r,e,c),r=await Tt(r,e,c,d),Se(r))r=Uo(r,e),r=hs(r,e),r=ms(r,e);r=Wo(r);let{processStreamDirectives:y}=await o("stx/streaming",()=>import("./chunk-sfr0767s.js"));r=y(r,e),r=or(r,e,c,d,!0),r=await Qt(r,e,c,d,g),r=await us(r,e,c,d,g),r=fc(r,e,c,d);let{processDeferDirectives:m}=await o("stx/defer",()=>import("./chunk-mmeck545.js"));r=m(r,e,c);let{processTeleportDirectives:x}=await o("stx/teleport",()=>import("./chunk-a8fy7jv8.js"));r=x(r,e,c);let{processTransitionDirectives:w,processTransitionAttributes:v}=await o("stx/transitions",()=>import("./chunk-tj7dh2dz.js"));r=w(r,e,c),r=v(r);let{processErrorBoundaryDirectives:k,stripRenderFailedMarkers:S}=await o("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));r=k(r,e,c),r=S(r);let{processSuspenseDirectives:M}=await o("stx/suspense",()=>import("./chunk-x30gh7vt.js"));r=M(r,e,c);let{processAsyncDirectives:T}=await o("stx/async-components",()=>import("./chunk-m934bzg2.js"));r=T(r,e,c);let{processKeepAliveDirectives:R}=await o("stx/keep-alive",()=>import("./chunk-k0xdvegc.js"));r=R(r,e,c);let{processVirtualListDirectives:D,processVirtualGridDirectives:P,processInfiniteListDirectives:N}=await o("stx/virtual-scrolling",()=>import("./chunk-q5bct2ks.js"));r=D(r,e,c),r=P(r,e,c),r=N(r,e,c);let{processPartialHydrationDirectives:B,processStaticDirectives:O}=await o("stx/partial-hydration",()=>import("./chunk-j0hrk24j.js"));r=B(r,e,c),r=O(r);let{processComputedDirectives:L,processWatchDirectives:H}=await o("stx/computed",()=>import("./chunk-1xdzcy9d.js"));r=L(r,e,c),r=H(r,e,c);let{processFormValidationDirectives:X}=await o("stx/forms-validation",()=>import("./chunk-px6336z8.js"));r=X(r,e,c);let{processHeadDirective:z,processTitleDirective:Y,processMetaDirective:ee,resetHead:te}=await o("stx/head",()=>import("./chunk-s2zsa16d.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)te();let ce=z(r);if(r=ce.content,ce.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${ce.headContent}
|
|
1312
1312
|
`;if(r=Y(r,e),r=ee(r,e,c),r=Wt(r),r=Fo(r,e),r=Et(r),r=Bt(r),r=await is(r,e,c,d,g),r=await us(r,e,c,d,g),r=r.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),r=gi(r),r=se(r,e,c),r=ds(r),e.__stxProcessingDepth===1)r=Wc(r,e);if(r=Bc(r,e,{filePath:c,buildMode:d.buildMode}),r=zo(r,e),r=Ho(r,e),r=We(r,e),r=Ot(r,e),r=Pt(r,e),r=await ht(r,e,c,d),r=await mc(r,e,c),r=await hc(r,e,c,d),r=yc(r,e,c,d),r=Zo(r,e,c,d),r=Qo(r,e,c),r=ei(r,e,c,d),r=St(r,e,c,d),r=zs(r,e),r=Hs(r),r=zc(r),!d.skipEventDirectives)r=Rc(r,e,c);if(r=Fc(r,e,c,a.skipSignalsRuntime===!0&&Number(e.__stxProcessingDepth)>0),d.debug){let V=/\bx-data\s*=/.test(r),W=gs(n);if(V&&W)console.warn(`[stx] ${c}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
1313
1313
|
Both work on the same page, but they manage separate scopes.
|
|
1314
1314
|
Prefer signals (state/derived/effect) for new components.`)}r=cc(r,e),r=await _(r,e,c),r=Hc(r),r=Vc(r),r=ft(r);let{processXElementDirectives:ue}=await o("stx/x-element",()=>import("./chunk-zhxdpzga.js"));r=ue(r);let ne=e.__originalFilePath||c,K=De(e);if(r=await qo(r,d,ne,K),r=Rt(r,e),r=await Vt(r,e,c,d),d.media?.image?.autoSiblings){let V=d.publicDir||"public",{rewriteImagesWithSiblings:W}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-6h1qa3hw.js"));r=await W(r,{publicDir:V})}if(d.seo?.enabled)r=ti(r,e,d);let ge=(V,W,J=!0)=>{if(!W)return V;let me=W.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),re=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(V),de=re?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(re[0]):null;if(me&&re&&de){if(J){let Te=re.index+de.index;V=V.slice(0,Te)+me[0]+V.slice(Te+de[0].length)}if(W=W.replace(me[0],"").trim(),!W)return V}if(/<\/head>/i.test(V))return V.replace(/<\/head>/i,`${W}
|
|
@@ -1322,6 +1322,6 @@ ${ut()}
|
|
|
1322
1322
|
`+Te}else r=r.replace("</head>",`${W}
|
|
1323
1323
|
</head>`)}else if(r.includes("<body"))r=r.replace(/<body([^>]*)>/,`<body$1>
|
|
1324
1324
|
${W}`);else r=W+`
|
|
1325
|
-
`+r}{let{scanScriptTags:V}=await o("stx/signal-processing",()=>import("./chunk-
|
|
1325
|
+
`+r}{let{scanScriptTags:V}=await o("stx/signal-processing",()=>import("./chunk-dfy5g8cb.js")),W=[];for(let J of V(r)){if(!/\bserver\b/i.test(J.attrs))continue;let me=J.start+J.fullMatch.indexOf(">")+1,re=wr(r,me);if(re===-1)continue;let de=re+9;while(de<r.length&&/\s/.test(r[de]))de++;W.push({start:J.start,end:de})}if(W.length>0){let J=Array(W.length+1),me=0;for(let re=0;re<W.length;re++){let{start:de,end:Te}=W[re];J[re]=r.slice(me,de),me=Te}J[W.length]=r.slice(me),r=J.join("")}}let ct=Bs(r,c);if(ct.hasScoped)r=ct.html;let Cr=e.__stx_event_bindings||[],ze=!1,lt=[],Mr=/\s:[a-z][\w.-]*\s*=/.test(r),{scanScriptTags:Dr}=await o("stx/signal-processing",()=>import("./chunk-dfy5g8cb.js"));for(let V of Dr(r,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))lt.push({match:V.fullMatch,attrs:V.attrs,content:V.body});for(let{match:V,attrs:W,content:J}of lt){ze=!0;let me=J;Oe(J,c,a.strict,e.__originalFilePath);let re=await Le(J,{eventBindings:Cr,attrs:W,hasColonDirectives:Mr,templateContent:n,filePath:c,projectRoot:process.cwd(),production:Ri(a.buildMode,a.minifyClient),serverData:K});r=r.replace(V,()=>re)}if(ze)e.__stx_event_bindings=[];if(!ze&&e.__stxProcessingDepth===1){let V=e.__stx_event_bindings||[];if(V.length>0){let W=ai(V);if(W){let J=r.lastIndexOf("</body>");r=J===-1?r+W:r.slice(0,J)+W+`
|
|
1326
1326
|
`+r.slice(J)}e.__stx_event_bindings=[]}}if(!d.skipSignalsRuntime&&!be(r)&&uc(r))r=await cr(r,d);if(r=dc(r),d.csp?.enabled&&d.csp.useNonce&&typeof e.cspNonce==="string")r=kt(r,e.cspNonce);return r}
|
|
1327
1327
|
export{yt,Re,sc,os,No,Mo,tr,i};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Nf,us}from"./chunk-
|
|
2
|
+
import{Nf,us}from"./chunk-djpmrctd.js";import"./chunk-5e5jschg.js";import"./chunk-wceg59n0.js";import"./chunk-2nj9aewf.js";import{kr}from"./chunk-a1htb5r5.js";import"./chunk-axwa3s1m.js";import"./chunk-2vqpz4qv.js";import{st}from"./chunk-8ttmzcxb.js";import"./chunk-r9e0r6jx.js";import"./chunk-bt0amey5.js";export{st as freeIdentifiers,us as processComponents,Nf as processESImports,kr as rendersAsElement};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Qr,es}from"./chunk-e4jwhmpb.js";import{y}from"./chunk-
|
|
2
|
+
import{Qr,es}from"./chunk-e4jwhmpb.js";import{y}from"./chunk-a1htb5r5.js";import{a}from"./chunk-zen28e3p.js";import{Ke,re}from"./chunk-n7arptzc.js";import{Ja}from"./chunk-9fm8khcc.js";import{j}from"./chunk-cmnze7at.js";import{g}from"./chunk-0dve54ne.js";import{existsSync as F,mkdirSync as S,copyFileSync as P,chmodSync as I,rmSync as ve}from"fs";import{join as c,basename as xe,resolve as X}from"path";import{spawn as z}from"child_process";import{platform as ye}from"os";function E(e,r,i){let n=new RegExp(`</${r}\\s*>`,"iy"),s=y(e,(t,o)=>(n.lastIndex=o,n.exec(t)?n.lastIndex:-1))[0];return s?e.slice(0,s.start)+i+e.slice(s.start):null}var gu=`
|
|
3
3
|
<script>
|
|
4
4
|
(function() {
|
|
5
5
|
'use strict';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ve,Us,hg,Yh,yg,Zh,Mt,p,U,Z,wn,Se,bg,vi,wg,Qh,_,vg,ey,R,ty}from"./chunk-
|
|
2
|
+
import{ve,Us,hg,Yh,yg,Zh,Mt,p,U,Z,wn,Se,bg,vi,wg,Qh,_,vg,ey,R,ty}from"./chunk-a1htb5r5.js";import"./chunk-axwa3s1m.js";import"./chunk-2vqpz4qv.js";import"./chunk-8ttmzcxb.js";import"./chunk-r9e0r6jx.js";import"./chunk-bt0amey5.js";export{vg as applyFilters,Zh as clearCustomFilters,bg as clientLoopScopes,Us as defaultFilters,wn as escapeAttributeValue,p as escapeHtml,U as escapeHtmlValue,Z as escapeInterpolatedHtmlValue,R as evaluateExpression,ve as findMustacheEnd,yg as getAllFilters,wg as interpolateScriptAttributes,vi as interpolateScriptExpressions,Qh as interpolateScriptsInTemplate,_ as processExpressions,hg as registerFilter,Yh as registerFilters,Mt as replaceInterpolations,ey as resetRejectedExpressionWarnings,ty as unescapeHtml,Se as usesSignalsInScript};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{_}from"./chunk-
|
|
2
|
+
import{_}from"./chunk-a1htb5r5.js";import{le}from"./chunk-y8p85kcj.js";function g(e,t){let r={};for(let n of e)r[n]=le(t(n));return new Proxy({},{get:(n,a)=>r[a]?.(),set:(n,a,o)=>{if(r[a])r[a].set(o);else r[a]=le(o);return!0},has:(n,a)=>(a in r),deleteProperty:(n,a)=>(delete r[a],!0),ownKeys:()=>Reflect.ownKeys(r),getOwnPropertyDescriptor:(n,a)=>(a in r)?{enumerable:!0,configurable:!0,writable:!0,value:r[a]()}:void 0})}function v(e,t){let r={};for(let n of t)r[n]=e[n];return r}function ba(e,t){let r=Object.keys(e),n=g(r,(i)=>t?.[i]??e[i].getDefaultValue()),a=g(r,()=>[]),o=g(r,()=>!1),c=g(r,()=>!1),f=g(r,()=>!1),s=le(!1);async function u(i){f[i]=!0;let d=await e[i].validate(n[i],n);return a[i]=d,f[i]=!1,d.length===0}async function l(){s.set(!0);let i=await Promise.all(r.map(u));return s.set(!1),i.every(Boolean)}function m(){for(let i of r)n[i]=t?.[i]??e[i].getDefaultValue(),a[i]=[],o[i]=!1,c[i]=!1}function h(i){for(let d of r)if(d in i)n[d]=i[d],c[d]=!0}function b(i,d){n[i]=d,c[i]=!0}function y(i,d=!0){if(o[i]=d,d)u(i)}function p(i){return{value:n[i],errors:a[i],touched:o[i],dirty:c[i],valid:a[i].length===0,validating:f[i]}}function V(i){return async(d)=>{d?.preventDefault?.();for(let w of r)o[w]=!0;if(await l())await i(v(n,r))}}return{values:n,errors:a,touched:o,dirty:c,get isValid(){return r.every((i)=>a[i].length===0)},get isValidating(){return s()||r.some((i)=>f[i])},get isDirty(){return r.some((i)=>c[i])},validate:l,validateField:u,reset:m,setValues:h,setFieldValue:b,setFieldTouched:y,getFieldState:p,handleSubmit:V}}var au=ba;class Fn{rules=[];defaultValue="";addRule(e){let t=new Fn;return t.rules=[...this.rules,e],t.defaultValue=this.defaultValue,t}required(e="This field is required"){return this.addRule({name:"required",message:e,validate:(t)=>{if(t===null||t===void 0)return e;if(typeof t==="string"&&t.trim()==="")return e;if(Array.isArray(t)&&t.length===0)return e;return!0}})}email(e="Please enter a valid email"){return this.addRule({name:"email",message:e,validate:(t)=>{if(!t)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t))||e}})}url(e="Please enter a valid URL"){return this.addRule({name:"url",message:e,validate:(t)=>{if(!t)return!0;try{return new URL(String(t)),!0}catch{return e}}})}min(e,t){let r=t||`Must be at least ${e} characters`;return this.addRule({name:"min",message:r,validate:(n)=>{if(!n)return!0;return String(n).length>=e||r}})}max(e,t){let r=t||`Must be no more than ${e} characters`;return this.addRule({name:"max",message:r,validate:(n)=>{if(!n)return!0;return String(n).length<=e||r}})}length(e,t,r){let n=r||`Must be between ${e} and ${t} characters`;return this.addRule({name:"length",message:n,validate:(a)=>{if(!a)return!0;let o=String(a).length;return o>=e&&o<=t||n}})}pattern(e,t="Invalid format"){return this.addRule({name:"pattern",message:t,validate:(r)=>{if(!r)return!0;return e.test(String(r))||t}})}hasUppercase(e="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,e)}hasLowercase(e="Must contain a lowercase letter"){return this.pattern(/[a-z]/,e)}hasNumber(e="Must contain a number"){return this.pattern(/\d/,e)}hasSpecial(e="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,e)}alphanumeric(e="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,e)}startsWithLetter(e="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,e)}noSpaces(e="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:e,validate:(t)=>{if(!t)return!0;return!String(t).includes(" ")||e}})}number(e="Must be a number"){let t=this.addRule({name:"number",message:e,validate:(r)=>{if(!r&&r!==0)return!0;return!Number.isNaN(Number(r))||e}});return t.defaultValue=0,t}integer(e="Must be a whole number"){return this.addRule({name:"integer",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number.isInteger(Number(t))||e}})}positive(e="Must be a positive number"){return this.addRule({name:"positive",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)>0||e}})}negative(e="Must be a negative number"){return this.addRule({name:"negative",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)<0||e}})}minValue(e,t){let r=t||`Must be at least ${e}`;return this.addRule({name:"minValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)>=e||r}})}maxValue(e,t){let r=t||`Must be no more than ${e}`;return this.addRule({name:"maxValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)<=e||r}})}between(e,t,r){let n=r||`Must be between ${e} and ${t}`;return this.addRule({name:"between",message:n,validate:(a)=>{if(!a&&a!==0)return!0;let o=Number(a);return o>=e&&o<=t||n}})}matches(e,t){let r=t||`Must match ${e}`;return this.addRule({name:"matches",message:r,validate:(n,a)=>{if(!a)return!0;return n===a[e]||r}})}oneOf(e,t){let r=t||`Must be one of: ${e.join(", ")}`;return this.addRule({name:"oneOf",message:r,validate:(n)=>{if(!n)return!0;return e.includes(n)||r}})}notOneOf(e,t){let r=t||`Cannot be one of: ${e.join(", ")}`;return this.addRule({name:"notOneOf",message:r,validate:(n)=>{if(!n)return!0;return!e.includes(n)||r}})}date(e="Must be a valid date"){return this.addRule({name:"date",message:e,validate:(t)=>{if(!t)return!0;let r=new Date(String(t));return!Number.isNaN(r.getTime())||e}})}before(e,t){let r=new Date(e),n=t||`Must be before ${r.toLocaleDateString()}`;return this.addRule({name:"before",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))<r||n}})}after(e,t){let r=new Date(e),n=t||`Must be after ${r.toLocaleDateString()}`;return this.addRule({name:"after",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))>r||n}})}custom(e,t="Invalid value"){return this.addRule({name:"custom",message:t,validate:e})}async(e,t="Invalid value"){return this.addRule({name:"async",message:t,async:!0,validate:e})}when(e,t){let r=new Fn;r.rules=[...this.rules],r.defaultValue=this.defaultValue;for(let n of t.getRules())r.rules.push({...n,validate:(a,o)=>{if(!e(a,o||{}))return!0;return n.validate(a,o)}});return r}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(e){let t=new Fn;return t.rules=[...this.rules],t.defaultValue=e,t}async validate(e,t){let r=[];for(let n of this.rules){let a=await n.validate(e,t);if(a!==!0)r.push(a)}return r}validateSync(e,t){let r=[];for(let n of this.rules){if(n.async)continue;let a=n.validate(e,t);if(a!==!0)r.push(a)}return r}}var Om=new Fn;function cu(e,t,r){let n=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>_(c,{...t,message:l},r)).join(`
|
|
3
3
|
`)}catch{return""}})}function lu(e,t,r){let n=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>_(c,{...t,message:l},r)).join(`
|
|
4
4
|
`)}catch{return""}})}function uu(e,t,r){let n=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return c}catch{return""}})}function Nm(e,t,r){let n=e;return n=cu(n,t,r),n=lu(n,t,r),n=uu(n,t,r),n}export{ba,au,Fn,Om,cu,lu,uu,Nm};
|