@stacksjs/stx 0.2.760 → 0.2.762
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-00nz3pas.js +2 -0
- package/dist/{chunk-eazvp48w.js → chunk-02c46de1.js} +26 -9
- package/dist/chunk-05jdq9tw.js +177 -0
- package/dist/chunk-0cajfv7y.js +2 -0
- package/dist/{chunk-3nxe5xmy.js → chunk-0fs9kx0h.js} +3 -3
- package/dist/{chunk-42hcspws.js → chunk-0kq0k4pg.js} +2 -2
- package/dist/{chunk-y8srg0q3.js → chunk-0sd4td6z.js} +3 -3
- package/dist/{chunk-f4gqzg1y.js → chunk-0wj31pqy.js} +2 -2
- package/dist/chunk-13v3vgb6.js +2 -0
- package/dist/{chunk-v5afjcy3.js → chunk-18chz0q4.js} +1 -1
- package/dist/chunk-1p8t2ekg.js +2 -0
- package/dist/chunk-1rcntvgx.js +2 -0
- package/dist/chunk-1w5gtkd6.js +2 -0
- package/dist/chunk-28vtqwxh.js +2 -0
- package/dist/chunk-298gj90a.js +2 -0
- package/dist/{chunk-n8s5301s.js → chunk-2eamszdq.js} +2 -2
- package/dist/chunk-2gn6smrq.js +2 -0
- package/dist/{chunk-h692k9xn.js → chunk-2typf9dh.js} +4 -4
- package/dist/chunk-2wq0h5ye.js +2 -0
- package/dist/{chunk-prej5pk6.js → chunk-2zd51tj4.js} +2 -2
- package/dist/chunk-2zg3jmy7.js +2 -0
- package/dist/{chunk-ztdjdxjt.js → chunk-319aez2f.js} +3 -3
- package/dist/{chunk-7g9vd5fv.js → chunk-37y8sg48.js} +2 -2
- package/dist/{chunk-j2mpqa4p.js → chunk-3csfmhg0.js} +2 -2
- package/dist/{chunk-jb1dk0w7.js → chunk-3mz088mb.js} +2 -2
- package/dist/chunk-3wxb7mfb.js +2 -0
- package/dist/{chunk-cehjp06v.js → chunk-42zqmcnc.js} +3 -3
- package/dist/{chunk-89h4snzd.js → chunk-4833k99b.js} +2 -2
- package/dist/{chunk-jevd16gq.js → chunk-48g9wez2.js} +30 -30
- package/dist/chunk-4tgn1frg.js +3 -0
- package/dist/chunk-528cn6qm.js +2 -0
- package/dist/{chunk-afj19nsj.js → chunk-59k4xb92.js} +5 -5
- package/dist/chunk-5x0g7e9y.js +2 -0
- package/dist/{chunk-83ezv8yz.js → chunk-5yhv5eqq.js} +3 -3
- package/dist/chunk-633a53wg.js +2 -0
- package/dist/chunk-6b737vch.js +2 -0
- package/dist/chunk-72ns4q88.js +2 -0
- package/dist/chunk-736ex6r5.js +26 -0
- package/dist/chunk-86cg9qqm.js +2 -0
- package/dist/{chunk-gs6wc7sr.js → chunk-89801pjp.js} +5 -5
- package/dist/chunk-8czxtjwm.js +2 -0
- package/dist/chunk-8h5mqs28.js +2 -0
- package/dist/{chunk-yp6w740k.js → chunk-8rk79ha1.js} +2 -2
- package/dist/{chunk-kpr09x3g.js → chunk-8y54tpbr.js} +7 -7
- package/dist/{chunk-s4y26fk6.js → chunk-8yyq3nfg.js} +2 -2
- package/dist/{chunk-30j6mbrf.js → chunk-932zx5q4.js} +7 -7
- package/dist/chunk-940wny2b.js +2 -0
- package/dist/chunk-9fh4ah7t.js +2 -0
- package/dist/{chunk-sgm6tg8h.js → chunk-9k8ztdcc.js} +2 -2
- package/dist/{chunk-vvc39v6p.js → chunk-a222bwpc.js} +5 -5
- package/dist/chunk-a81rt2t4.js +3 -0
- package/dist/chunk-ad9dt9rk.js +2 -0
- package/dist/chunk-ak4w2emd.js +2 -0
- package/dist/{chunk-tb56j1zt.js → chunk-ak93e1zz.js} +5 -5
- package/dist/{chunk-jt28zh50.js → chunk-b0z2n941.js} +2 -2
- package/dist/{chunk-xgegyttg.js → chunk-b51p56k5.js} +2 -2
- package/dist/{chunk-r4sawwmp.js → chunk-b7x8b83z.js} +1 -1
- package/dist/chunk-b8dtz3v8.js +2 -0
- package/dist/{chunk-frk6rzrq.js → chunk-ben8bjnk.js} +4 -4
- package/dist/{chunk-w8p1y4c0.js → chunk-bvctccab.js} +4 -4
- package/dist/{chunk-hk98vptc.js → chunk-cdcrd33m.js} +2 -2
- package/dist/chunk-cenvzm5q.js +2 -0
- package/dist/chunk-d49pst1m.js +2 -0
- package/dist/{chunk-hfbzfrpv.js → chunk-d96xddt9.js} +14 -14
- package/dist/chunk-dj0qy19b.js +2 -0
- package/dist/{chunk-asp7ett1.js → chunk-dnsf934e.js} +9 -9
- package/dist/{chunk-7r7j7vwt.js → chunk-ds6mbfdq.js} +3 -3
- package/dist/{chunk-bsgg8zzk.js → chunk-dvpk4c1y.js} +2 -2
- package/dist/chunk-e2q79dfs.js +2 -0
- package/dist/{chunk-9s1qnf90.js → chunk-eb6p3p62.js} +2 -2
- package/dist/chunk-ebxncrd8.js +2 -0
- package/dist/{chunk-q49ykyq9.js → chunk-edhxg3rz.js} +14 -14
- package/dist/{chunk-rcfmwx8r.js → chunk-epa73jvs.js} +2 -2
- package/dist/{chunk-3cn9y08d.js → chunk-evxp3wmv.js} +7 -7
- package/dist/{chunk-z8k3fx4r.js → chunk-f8p8ggvw.js} +4 -4
- package/dist/{chunk-se28p2xy.js → chunk-fhpsf4z7.js} +6 -6
- package/dist/chunk-fht1zs1r.js +2 -0
- package/dist/chunk-fjfrgef4.js +2 -0
- package/dist/chunk-fmk9hjht.js +2 -0
- package/dist/{chunk-4s9kytdz.js → chunk-fxmc5006.js} +2 -2
- package/dist/chunk-fxnk5ee8.js +2 -0
- package/dist/{chunk-6ts3sthp.js → chunk-g4k0svq6.js} +2 -2
- package/dist/{chunk-2qz891k4.js → chunk-gwjh981q.js} +10 -10
- package/dist/chunk-hnen9b45.js +2 -0
- package/dist/{chunk-7v2srnpv.js → chunk-j1tsda22.js} +10 -10
- package/dist/chunk-j1z7tgdp.js +2 -0
- package/dist/{chunk-4zw118tn.js → chunk-jgk5j35w.js} +4 -4
- package/dist/chunk-jq1698j4.js +2 -0
- package/dist/{chunk-pwmkhs7z.js → chunk-jyp2mmts.js} +2 -2
- package/dist/chunk-k0jkpw0q.js +2 -0
- package/dist/{chunk-3kfbs0mw.js → chunk-k2ex94n8.js} +1 -1
- package/dist/chunk-k469ym7a.js +2 -0
- package/dist/{chunk-m00c7sh0.js → chunk-k9247v28.js} +1 -1
- package/dist/{chunk-rprewgyj.js → chunk-k9wr8xf5.js} +6 -6
- package/dist/chunk-m3z13f59.js +25 -0
- package/dist/chunk-m5740sd3.js +2 -0
- package/dist/{chunk-qw9kgzb3.js → chunk-m6rzsbas.js} +5 -5
- package/dist/{chunk-5vmbycy5.js → chunk-mbe4gqd3.js} +2 -2
- package/dist/{chunk-myynywry.js → chunk-mdvtermb.js} +2 -2
- package/dist/chunk-mdw96yhg.js +2 -0
- package/dist/chunk-mebf9vwb.js +2 -0
- package/dist/{chunk-ej1jkt9a.js → chunk-nm9tnxnw.js} +6 -6
- package/dist/chunk-p2se8s6r.js +2 -0
- package/dist/chunk-p7zrz0wb.js +2 -0
- package/dist/chunk-pdnyfk2v.js +2 -0
- package/dist/{chunk-fjxhga6w.js → chunk-pqbxa0r7.js} +2 -2
- package/dist/chunk-q245q8z1.js +2 -0
- package/dist/{chunk-5q9ss7ty.js → chunk-q3azy64b.js} +4 -4
- package/dist/chunk-qfhjtz2q.js +2 -0
- package/dist/chunk-qjbcp3tc.js +33 -0
- package/dist/{chunk-qwsgc5rc.js → chunk-qystt1qc.js} +1 -1
- package/dist/{chunk-dh9aagwm.js → chunk-r1tp2gnr.js} +1 -1
- package/dist/chunk-r5tsewzd.js +2 -0
- package/dist/{chunk-pes27snj.js → chunk-r8zhed35.js} +3 -3
- package/dist/{chunk-g4e6egrr.js → chunk-rd33qkfs.js} +8 -8
- package/dist/{chunk-hmydy949.js → chunk-rh2qth8r.js} +5 -5
- package/dist/chunk-rha8sv1h.js +3 -0
- package/dist/{chunk-n7s4n62j.js → chunk-rj3p5fdy.js} +3 -3
- package/dist/{chunk-94ymndc5.js → chunk-rmk8efc3.js} +43 -43
- package/dist/chunk-rnvrtcz6.js +2 -0
- package/dist/{chunk-xsf7ax50.js → chunk-rqd6b2nc.js} +3 -3
- package/dist/{chunk-vtv7165t.js → chunk-rxm1mjkb.js} +2 -2
- package/dist/chunk-s36cpnxa.js +2 -0
- package/dist/{chunk-0y2zzqsq.js → chunk-t1shvfhm.js} +76 -76
- package/dist/{chunk-vh1d5eqk.js → chunk-t2cq4bpe.js} +6 -6
- package/dist/chunk-tfy1m821.js +2 -0
- package/dist/{chunk-465resq9.js → chunk-tpfxvw4q.js} +17 -17
- package/dist/{chunk-t6qn1374.js → chunk-tshpcvcy.js} +2 -2
- package/dist/chunk-v1ff2dfp.js +7 -0
- package/dist/chunk-vc3ppphz.js +2 -0
- package/dist/chunk-vttx66q0.js +2 -0
- package/dist/chunk-vxs07119.js +2 -0
- package/dist/chunk-w2pch5xn.js +4 -0
- package/dist/{chunk-j4snweyz.js → chunk-wby7qzha.js} +3 -3
- package/dist/{chunk-19safa6y.js → chunk-wmnzapn8.js} +2 -2
- package/dist/chunk-wwnqbv9j.js +3 -0
- package/dist/chunk-x1x69g3s.js +2 -0
- package/dist/{chunk-gs373714.js → chunk-x5seqmrv.js} +2 -2
- package/dist/chunk-x8hz5gzb.js +2 -0
- package/dist/chunk-xfdtym3s.js +2 -0
- package/dist/{chunk-q9npggak.js → chunk-xgnmgjpv.js} +8 -8
- package/dist/{chunk-bsq9zg9j.js → chunk-xt034729.js} +6 -6
- package/dist/{chunk-m220n98m.js → chunk-xtwc2dbk.js} +2 -2
- package/dist/{chunk-0ggwm837.js → chunk-y4mp1rra.js} +101 -101
- package/dist/chunk-y6mqq78g.js +2 -0
- package/dist/chunk-y8pftjg8.js +12 -0
- package/dist/{chunk-wz5m7ybz.js → chunk-yb71b2d6.js} +2 -2
- package/dist/chunk-ycttwgpg.js +2 -0
- package/dist/chunk-yd6x9226.js +2 -0
- package/dist/{chunk-3m9vrhja.js → chunk-yk456jp4.js} +8 -8
- package/dist/chunk-yn3kff5k.js +2 -0
- package/dist/chunk-ynjm2tm0.js +2 -0
- package/dist/{chunk-j04v4rgf.js → chunk-zhrz4zvw.js} +5 -5
- package/dist/chunk-zpjdp0he.js +2 -0
- package/dist/cli.js +20 -20
- package/dist/client/signals-hydration-audit-runtime.js +2 -0
- package/dist/client/signals-process-element-runtime.js +17 -2
- package/dist/composable-loader.d.ts +1 -1
- package/dist/composable-loader.js +47 -10
- package/dist/composables/index.d.ts +3 -0
- package/dist/composables/index.js +1 -0
- package/dist/composables/use-completion.d.ts +29 -0
- package/dist/composables/use-completion.js +125 -0
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/message-catalogs.d.ts +39 -0
- package/dist/message-catalogs.js +128 -0
- package/dist/native/compiler/bundle.js +3 -33
- package/dist/process.d.ts +1 -1
- package/dist/process.js +87 -22
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +14 -14
- package/dist/store-loader.d.ts +27 -3
- package/dist/store-loader.js +115 -10
- package/dist/types/config-types.d.ts +1 -0
- package/dist/unresolved-identifiers.js +1 -0
- package/package.json +5 -5
- package/dist/chunk-0b7f2mby.js +0 -2
- package/dist/chunk-0j7e56zm.js +0 -2
- package/dist/chunk-1khg5vjs.js +0 -2
- package/dist/chunk-3h2yz805.js +0 -2
- package/dist/chunk-3kmwgpm1.js +0 -2
- package/dist/chunk-3wfewscj.js +0 -2
- package/dist/chunk-4tz00fkp.js +0 -2
- package/dist/chunk-52q8184e.js +0 -2
- package/dist/chunk-59ytzyp1.js +0 -2
- package/dist/chunk-5e2ez5n0.js +0 -2
- package/dist/chunk-6ndeycxk.js +0 -2
- package/dist/chunk-75r09rqt.js +0 -2
- package/dist/chunk-76679dw7.js +0 -33
- package/dist/chunk-7h5d35bf.js +0 -2
- package/dist/chunk-7kac7hdw.js +0 -2
- package/dist/chunk-7nz28a6c.js +0 -16
- package/dist/chunk-82ybmdqk.js +0 -2
- package/dist/chunk-8av44gw2.js +0 -2
- package/dist/chunk-8frs2dtp.js +0 -2
- package/dist/chunk-8prq9t3b.js +0 -2
- package/dist/chunk-8sxngenk.js +0 -2
- package/dist/chunk-9epeb4sn.js +0 -2
- package/dist/chunk-9zmb7dcv.js +0 -2
- package/dist/chunk-abs1k04e.js +0 -2
- package/dist/chunk-akgt21vw.js +0 -2
- package/dist/chunk-b561wv5x.js +0 -2
- package/dist/chunk-bfdd0nmc.js +0 -2
- package/dist/chunk-c05r0rzw.js +0 -3
- package/dist/chunk-c7yjhjr2.js +0 -2
- package/dist/chunk-c9xq89nt.js +0 -2
- package/dist/chunk-cpep999n.js +0 -2
- package/dist/chunk-cr7mn65s.js +0 -2
- package/dist/chunk-dqs4bgec.js +0 -2
- package/dist/chunk-e30kgg28.js +0 -2
- package/dist/chunk-e3fkq9gb.js +0 -2
- package/dist/chunk-e9kajy9a.js +0 -2
- package/dist/chunk-eab8na0z.js +0 -2
- package/dist/chunk-ec5q50ve.js +0 -2
- package/dist/chunk-ec8gn2m0.js +0 -2
- package/dist/chunk-ex2397dc.js +0 -2
- package/dist/chunk-exg7ry7b.js +0 -2
- package/dist/chunk-f4j42tsg.js +0 -2
- package/dist/chunk-fj105fff.js +0 -2
- package/dist/chunk-gk775pcy.js +0 -177
- package/dist/chunk-ha6tr22a.js +0 -2
- package/dist/chunk-htc7pasb.js +0 -2
- package/dist/chunk-jfvr1135.js +0 -2
- package/dist/chunk-k3wnmpt3.js +0 -2
- package/dist/chunk-kb8654dp.js +0 -4
- package/dist/chunk-kfqdx75m.js +0 -2
- package/dist/chunk-mmdfjmgk.js +0 -25
- package/dist/chunk-mreh1t5x.js +0 -2
- package/dist/chunk-n839v6az.js +0 -2
- package/dist/chunk-ptzzpf97.js +0 -2
- package/dist/chunk-py7g5hxd.js +0 -2
- package/dist/chunk-qgsrxyh9.js +0 -2
- package/dist/chunk-qmxcs806.js +0 -2
- package/dist/chunk-qvcs4f4v.js +0 -2
- package/dist/chunk-qz9fzz5k.js +0 -2
- package/dist/chunk-rh90yh1c.js +0 -2
- package/dist/chunk-s0wst4wj.js +0 -2
- package/dist/chunk-sj5t0tnv.js +0 -2
- package/dist/chunk-stddpecv.js +0 -2
- package/dist/chunk-t4mpq6t0.js +0 -3
- package/dist/chunk-tb6jcr2v.js +0 -2
- package/dist/chunk-tdjw105v.js +0 -2
- package/dist/chunk-tn40nh9e.js +0 -3
- package/dist/chunk-tp2g09ca.js +0 -3
- package/dist/chunk-wpgq0tq4.js +0 -2
- package/dist/chunk-xabs41cv.js +0 -12
- package/dist/chunk-yme43vbp.js +0 -2
- package/dist/chunk-zg5xh20b.js +0 -2
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{bi,Hs,u,f,R,rt,d,Vs,t,c,w}from"./chunk-tpfxvw4q.js";import{ve,At,J,I,Dt,Z,_}from"./chunk-y4mp1rra.js";import{or}from"./chunk-yk456jp4.js";import{se}from"./chunk-9k8ztdcc.js";import{gs}from"./chunk-k2ex94n8.js";var de=1000,pe=!1;function he(n,r){let l=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,e="",o=0,i;while((i=l.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=R(p,r);if(!a||typeof a!=="object")continue;m=JSON.stringify(a)}catch{continue}e+=n.slice(o,g)+m,o=b,l.lastIndex=b}return o===0?n:e+n.slice(o)}function me(n,r){let l=/@component\s*\(/g,e=n,o,i=[];while((o=l.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),O=h.match(/^\s*,\s*/);if(!O)continue;let S=h.slice(O[0].length).trim();if(!S)continue;try{let v=R(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,l){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=l(a);e=e.substring(0,g)+y+e.substring(p+1)}return e}function be(n,r){let l=n;return l=l.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(e,o)=>{if(o in r)return`:${o}="${o}"`;return e}),l=l.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(e,o,i)=>{try{if(I(i,r.__stx_client_signal_names||[]))return e;let g=Object.keys(r),x=Object.values(r);bi(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(!rt(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}}),l}var ee="<!--__STX_BREAK__-->",ne="<!--__STX_CONTINUE__-->";function le(n,r){let l=/\{\{\{?|\{!!|@(break|continue)(?![\w$])/g,e="",o=0;for(let i=l.exec(n);i;i=l.exec(n)){if(!i[1]){let p=i[0].length===3&&i[0]==="{{{"?3:2,s=i[0]==="{!!"?n.indexOf("!!}",l.lastIndex):ve(n,i.index,p);if(s<0)break;l.lastIndex=s+(i[0]==="{!!"?3:p);continue}let g=l.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,l.lastIndex=g}return e+n.slice(o)}function ae(n){let r=(o)=>o.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),l="",e=0;return Dt(n,(o,i,g)=>(l+=ie(r(n.slice(e,g))),l+=`\${__stxRenderLoopValue(${g}, (${i}), ${o.length})}`,e=g+o.length,o)),l+ie(r(n.slice(e)))}function ue(n,r,l,e){return Z(n,r,l==null?"":String(l),!1,e)}function ie(n){let r=n;return r=oe(r,"@break",(l)=>{let e=l.trim();if(!Vs(e))return"";return`\`; if (${e}) { break; } result += \``}),r=oe(r,"@continue",(l)=>{let e=l.trim();if(!Vs(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,l,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((l=r.exec(n))!==null){if(p(l.index)>0)continue;let s=l.index,m=l.index+l[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 O=n.substring(m+1,h),S=At(O);if(!S)continue;let{arrayExpr:v,itemVar:W}=S,F=h+1,A=1,B=F,D=/@forelse\s*\(/g,L=/@endforelse/g,V=-1;while(A>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)A++,B=P.index+P[0].length;else{if(A--,A===0){V=E.index;break}B=E.index+11}}if(V===-1)continue;let k=n.substring(F,V),K=V+11,U=-1,z=0,N=0;while(N<k.length){let P=k.indexOf("@",N);if(P===-1)break;let E=k.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(k.length<=P+6||!/[a-z]/i.test(k[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:k.substring(0,U),emptyContent:k.substring(U+6)}}return null}function ce(n,r){let l=n;while(!0){let e=xe(l);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`;l=l.substring(0,o)+m+l.substring(i)}catch(s){let m=s instanceof Error?s.message:String(s),a=c("Forelse",`Error in @forelse(${g} as ${x}): ${m}`,t.EVALUATION_ERROR);l=l.substring(0,o)+a+l.substring(i)}}return l}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 ns(n){if(!n.includes(fe))return n;return n.replace(ye,(r,l,e)=>(_e(decodeURIComponent(l),decodeURIComponent(e)),""))}function sr(n,r,l,e,o=!1){let i=n,g=new Set(r.__stx_client_signal_names||[]);for(let s of or(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,O=1,S=h+1,v=-1;while(S<s.length&&O>0){if(s[S]==="(")O++;else if(s[S]===")"){if(O--,O===0){v=S;break}}S++}if(v===-1)continue;let W=s.substring(h+1,v),F=At(W);if(!F)continue;let A=y,{arrayExpr:B,itemVar:D}=F,L=v+1,V=1,k=L,K=/@foreach\s*\(/g,U=/@endforeach/g;while(V>0&&k<s.length){K.lastIndex=k,U.lastIndex=k;let z=K.exec(s),N=U.exec(s);if(!N)break;if(z&&z.index<N.index)V++,k=z.index+z[0].length;else{if(V--,V===0){let P=s.substring(L,N.index),E=N.index+11;return{start:A,end:E,arrayExpr:B,itemVar:D,content:P}}k=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:O,arrayExpr:S,itemVar:v,content:W}=y;try{let F=S.trim(),A;if(f(F))A=d(F,Object.keys(m))(...Object.values(m));else A=u(F,m);let B=!1;if(!Array.isArray(A))if(A instanceof Map)A=Array.from(A),B=!0;else if(A instanceof Set)A=Array.from(A);else if(typeof A==="string")A=Array.from(A);else if(A&&typeof A==="object"&&!(A instanceof Date)&&!(A instanceof RegExp))A=Object.entries(A),B=!0;else{let E=Ee(F,l)+c("Foreach",`Error in @foreach: ${F} is not iterable`,t.TYPE_ERROR);a=a.substring(0,h)+E+a.substring(O);continue}let D=e?.loops?.useAltLoopVariable??pe,L=v.trim(),V=null,k,K=!1;if(L.includes("=>")){let E=L.split("=>").map((j)=>j.trim());if(E.length===2&&E[0]&&E[1])V=E[0],k=E[1];else k=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])k=E[0],V=E[1],K=!0;else k=L}else k=L;let U="",z=new Set(J(`${S} as ${v}`)),N=A,P=m[Hs]??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,[Hs]: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(k.startsWith("[")&&k.endsWith("]")){let H=k.slice(1,-1).split(",").map((T)=>T.trim());if(Array.isArray(j))H.forEach((T,X)=>{if(T)M[T]=j[X]});else M[k]=j}else if(k.startsWith("{")&&k.endsWith("}")){let H=k.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[k]=j}else M[k]=j;if(V)if(!K&&B&&Array.isArray(j)&&j.length===2)M[V]=j[0],M[k]=j[1];else M[V]=E;let C=ce(W,M);C=sr(C,M,l,e,!0),C=se(C,M,l),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,l),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(O)}catch(F){let A=c("Foreach",`Error in @foreach(${S.trim()} as ${v.trim()}): ${F instanceof Error?F.message:String(F)}`,t.EVALUATION_ERROR);a=a.substring(0,h)+A+a.substring(O)}}return a}i=b(i,r),i=$e(i,r,l,e);let p=e?.loops?.maxWhileIterations??de;return i=we(i,r,p),o?i:ns(i)}function Ef(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 Vs(n)}function $e(n,r,l,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=Ef(o.slice(b+1,p)),m=p+1,a=gs(o.slice(x),"for","endfor");if(a.length===0)break;let y=a[0].content,h=x+a[0].end;if(!ge(s)){let O=c("For",`Unsafe expression in @for: ${s}`,t.UNSAFE_EXPRESSION);o=o.substring(0,x)+O+o.substring(h),i=!0;continue}try{let O=Ae(s),S=/@(?:for|foreach|if|unless)\s*\(/.test(y);if(O.length>0&&S){let D=Re({forExpr:s,content:y,iterVarNames:O,context:r,filePath:l,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
|
+
let result = '';
|
|
4
|
+
for (${s}) {
|
|
5
|
+
result += \`${F}\`;
|
|
6
|
+
}
|
|
7
|
+
return result;
|
|
8
|
+
`)(...W,(D,L,V)=>ue(y,D,L,V));o=o.substring(0,x)+B+o.substring(h),i=!0}catch(O){let S=c("For",`Error in @for(${s}): ${O instanceof Error?O.message:String(O)}`,t.EVALUATION_ERROR);o=o.substring(0,x)+S+o.substring(h),i=!0}}return o}function Ae(n){let r=n.trim(),l=r.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(l){let i=l[1];return i.slice(1,-1).split(",").map((x)=>{let b=x.trim();if(!b)return"";let p=b.indexOf(":");if(p>=0&&i.startsWith("{")){let a=b.slice(p+1).trim(),y=a.indexOf("=");return(y>=0?a.slice(0,y):a).trim()}let s=b.indexOf("="),m=(s>=0?b.slice(0,s):b).trim();return/^[A-Za-z_$][\w$]*$/.test(m)?m:""}).filter(Boolean)}let e=r.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(e)return[e[1]];let o=r.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(o)return[o[1]];return[]}function Re(n){let{forExpr:r,content:l,iterVarNames:e,context:o,filePath:i,options:g}=n,x=Object.keys(o),b=Object.values(o),p=i??"inline.stx",s="";return Function(...x,"__renderIteration",`
|
|
9
|
+
for (${r}) {
|
|
10
|
+
if (!__renderIteration([${e.join(", ")}])) break;
|
|
11
|
+
}
|
|
12
|
+
`)(...b,(a)=>{let y={...o};e.forEach((W,F)=>{y[W]=a[F]});let h=sr(l,y,p,g,!0);h=se(h,y,p),h=le(h,y);let O=h.indexOf(ee),S=h.indexOf(ne),v=O<0?S:S<0?O:Math.min(O,S);if(v>=0)h=h.slice(0,v);return s+=_(h,y,p),v<0||v!==O}),s}function we(n,r,l){let e=n,o=!0;while(o){o=!1;let i=e.match(/@while\s*\(/);if(!i||i.index===void 0)break;let g=i.index,x=g+i[0].length-1,b=w(e,"(",")",x);if(b===-1)break;let p=e.slice(x+1,b),s=gs(e.slice(g),"while","endwhile");if(s.length===0)break;let m=s[0].content,a=g+s[0].end;if(!ge(p)){let y=c("While",`Unsafe expression in @while: ${p}`,t.UNSAFE_EXPRESSION);e=e.substring(0,g)+y+e.substring(a),o=!0;continue}try{let y=Object.keys(r),h=Object.values(r),O=ae(m),v=Function(...y,"__stxRenderLoopValue",`
|
|
13
|
+
let result = '';
|
|
14
|
+
let maxIterations = ${l}; // Configurable safety limit
|
|
15
|
+
let counter = 0;
|
|
16
|
+
while (${p} && counter < maxIterations) {
|
|
17
|
+
counter++;
|
|
18
|
+
result += \`${O}\`;
|
|
19
|
+
}
|
|
20
|
+
if (counter > maxIterations) {
|
|
21
|
+
result += '<!-- [While Error [1104]]: Maximum iterations (${l}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
|
|
22
|
+
}
|
|
23
|
+
return result;
|
|
24
|
+
`)(...h,(W,F,A)=>ue(m,W,F,A));e=e.substring(0,g)+v+e.substring(a),o=!0}catch(y){let h=c("While",`Error in @while(${p}): ${y instanceof Error?y.message:String(y)}`,t.EVALUATION_ERROR);e=e.substring(0,g)+h+e.substring(a),o=!0}}return e}
|
|
25
|
+
export{ns,sr,Ef};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ko,Go,Xo,Jo,ws,vs,Dh,Mh,Lh,jh,xs,Bh}from"./chunk-evxp3wmv.js";import"./chunk-tpfxvw4q.js";export{Bh as generateDefaultRobotsTxt,xs as generateRobotsTxt,Mh as generateSitemap,Lh as generateSitemapIndex,Jo as injectSeoTags,ws as metaDirective,Ko as processMetaDirectives,Xo as processSeoDirective,Go as processStructuredData,Dh as registerSeoDirectives,jh as scanForSitemapEntries,vs as structuredDataDirective};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{de,
|
|
2
|
+
import{de,Oc,Ds,gn,m,Me,Le}from"./chunk-y4mp1rra.js";import{ur,Ze,j}from"./chunk-edhxg3rz.js";import{er,i}from"./chunk-t1shvfhm.js";import{we}from"./chunk-932zx5q4.js";function b(s){return s.endsWith(".md")||s.endsWith(".markdown")}function k(s){let e=[];g(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];g(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function g(n,p){let u;while((u=n.exec(s))!==null){let t=u.index,o=t+u[0].length;if(p?.some((l)=>t>=l.start&&o<=l.end))continue;e.push({start:t,end:o})}}if(e.length===0)return s;e.sort((n,p)=>n.start-p.start);let c="",a=0;for(let n of e){if(n.start<a)continue;c+=s.slice(a,n.start),c+=`@raw${s.slice(n.start,n.end)}@endraw`,a=n.end}return c+=s.slice(a),c}async function R(s,e={}){let{data:r,content:g}=ur(s),a=await(e.renderer??((n)=>Ze(n)))(g);return{html:k(a),frontmatter:r??{}}}import{dirname as v,resolve as _}from"path";function M(s){let e=s,r=de(s);if(r)e=r.content.trim();let g=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],a=[],n=[],p=(o)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(o),u;while((u=g.exec(s))!==null){let o=u[1],l=u[2],d=u[0],f=o.includes("server");if(p(l))n.push(d);else if(f)a.push(l);else c.push(d)}let t=e;{let o=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,d=[];while((l=o.exec(t))!==null){let f=l.index+l[0].length,x=t.indexOf("</script>",f);if(x===-1)continue;d.push({start:l.index,end:x+9}),o.lastIndex=x+9}for(let f=d.length-1;f>=0;f--)t=t.substring(0,d[f].start)+t.substring(d[f].end)}for(let o of c)t=t.replace(o,"");return{templateContent:t,serverScripts:a,clientScripts:c,signalsScripts:n}}function E(s,e){return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -9,10 +9,10 @@ import{de,Ic,Ns,gn,m,De,Me}from"./chunk-0ggwm837.js";import{lr,Ye,j}from"./chunk
|
|
|
9
9
|
<body>
|
|
10
10
|
${s}
|
|
11
11
|
</body>
|
|
12
|
-
</html>`}async function
|
|
12
|
+
</html>`}async function Ua(s,e={}){let r=_(s),g=Bun.file(r);if(!await g.exists())throw Error(`Template file not found: ${r}`);let c=await g.text(),a=null;if(b(r)){let n=await R(c,{renderer:e.markdownRenderer});c=n.html,a=n.frontmatter}if(a)e={...e,context:{...a,...e.context||{}}};if(e.layout){let n=_(e.layout),p=Bun.file(n);if(!await p.exists())throw Error(`Layout template not found: ${n}`);let{layout:u,injectCSS:t,...o}=e,l={...e.context||{}};gn(l);let d=await S(c,r,{...o,context:{...l,__stx_defer_server_data:!0},injectCSS:!1}),f=await p.text(),x={...l,content:d},y={...o,context:x,injectCSS:t};return S(f,n,y)}return S(c,r,e)}async function S(s,e,r={}){let{templateContent:g,serverScripts:c,clientScripts:a}=M(s),n={...j,...r.options},p={__filename:e,__dirname:v(e),__stx:{},__stx_options:n,__stx_sfc_mode:!0,__stx_inject_css:r.injectCSS===!0,__stxServeContext:void 0,...Ds(r.context??{}),definePageMeta:()=>{},...r.context||{}};for(let o of c)await m(o,p,e);let u=new Set,t=g;if(t=await i(t,p,e,n,u),Oc(p,r.context),r.templateOnly){if(t=t.replace(/<script data-stx-scoped>[\s\S]*?<\/script>\s*/gi,""),t=t.replace(/<!-- stx SEO Tags -->[\s\S]*?(?=<)/i,""),a.length>0)t+=`
|
|
13
13
|
${a.join(`
|
|
14
|
-
`)}`}else{if(r.processClientScripts!==!1&&a.length>0){let o=p.__stx_event_bindings||[],l=
|
|
14
|
+
`)}`}else{if(r.processClientScripts!==!1&&a.length>0){let o=p.__stx_event_bindings||[],l=Me(p),d=await Promise.all(a.map(async(w)=>{let C=w.match(/<script\b([^>]*)>/i)?.[1]||"";if(/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(C))return w;let h=w.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!h)return w;return await Le(h[1],{eventBindings:o,templateContent:t,serverData:l,filePath:e})})),x=[await er(d,{...n,buildMode:"compile"}),...d].filter(Boolean).join(`
|
|
15
15
|
`);if(t.match(/(<\/body>)/i))t=t.replace(/(<\/body>)/i,`${x}
|
|
16
16
|
$1`);else t+=`
|
|
17
|
-
${x}`}t=await
|
|
18
|
-
export{
|
|
17
|
+
${x}`}t=await we(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=E(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-p2se8s6r.js");t=await o(t)}catch{}return t}
|
|
18
|
+
export{Ua};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{U}from"./chunk-
|
|
3
|
-
export{
|
|
2
|
+
import{U}from"./chunk-y4mp1rra.js";import{ze,O,Mt}from"./chunk-x5seqmrv.js";import{pt,Ce,M,Ee,ia,uo,aa,Pn}from"./chunk-fhpsf4z7.js";import{xt,ue,Qe}from"./chunk-f8p8ggvw.js";import{To}from"./chunk-59k4xb92.js";import{In}from"./chunk-3mz088mb.js";import{be}from"./chunk-932zx5q4.js";import Z from"fs";import T from"path";var{serve:ce}=globalThis.Bun;import H from"zlib";import{promisify as Q}from"util";var K=Q(H.brotliCompress),ee=Q(H.gzip),te=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ne=["text/event-stream","multipart/x-mixed-replace"],re=1024;function se(t){if(!t)return!1;let e=t.toLowerCase();if(ne.some((o)=>e.startsWith(o)))return!1;return te.some((o)=>e.startsWith(o))}function oe(t){let e=new Map;for(let o of t.split(",")){let[r,...a]=o.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of a){let l=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(g);if(!l)continue;let m=Number.parseFloat(l[1]);if(Number.isFinite(m))h=m}e.set(f,h)}return e}function ae(t){if(!t)return null;let e=oe(t),o=e.get("*"),r=(a)=>e.get(a)??o??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var Y=33554432,V=new Map,z=0;function ie(t,e){if(e.length>Y/8)return;V.set(t,e),z+=e.length;for(let[o,r]of V){if(z<=Y)break;V.delete(o),z-=r.length}}async function Tn(t,e,o={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!se(e.headers.get("content-type")))return e;let r=ae(t.headers.get("accept-encoding"));if(!r)return e;let a;try{a=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(a,{status:e.status,statusText:e.statusText,headers:J(e.headers)});if(a.length<(o.threshold??re))return f();try{let h=o.quality??5,g=`${r}:${h}:${a.length}:${Bun.hash(a)}`,l=V.get(g);if(!l)l=r==="br"?await K(a,{params:{[H.constants.BROTLI_PARAM_QUALITY]:h,[H.constants.BROTLI_PARAM_SIZE_HINT]:a.length}}):await ee(a),ie(g,l);if(l.length>=a.length)return f();let m=J(e.headers);return m.set("Content-Encoding",r),m.set("Content-Length",String(l.length)),new Response(l,{status:e.status,statusText:e.statusText,headers:m})}catch{return f()}}function J(t){let e=new Headers(t),o=e.get("Vary");if(!o)return e.set("Vary","Accept-Encoding"),e;if(!o.split(",").some((a)=>a.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${o}, Accept-Encoding`);return e}class G{now;entries=new U(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,o){let r,a=async()=>{let s=r??await o();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",M(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return a();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${Ce(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let b=new Headers(s.headers);return b.set("Cache-Control","private, no-store"),b.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:b})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let v=this.generation,_=async()=>{let s=await o();r=s;let b=(s.headers.get("Vary")??"").toLowerCase().split(",").map((y)=>y.trim()).filter(Boolean);if(s.status!==200||s.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(s.headers.get("Cache-Control")??"")||b.some((y)=>y!=="x-stx-router"&&y!=="accept-encoding"))return null;let E=await s.clone().arrayBuffer();if(E.byteLength>1048576)return null;s.headers.set("Vary",M(s.headers.get("Vary")).Vary);let n={body:E,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===v)this.entries.set(h,n);return n},x=this.pending.get(h);if(!x){if(this.pending.size>=1000)return a();x=_().finally(()=>{if(this.pending.get(h)===x)this.pending.delete(h)}),this.pending.set(h,x)}if(g&&m<e.maxAge+(e.swr??0))return x.catch(()=>{}),l(g);let A=await x;return A?l(A):a()}}var pe={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function Fg(t={}){let e=T.resolve(t.outputDir||".output"),o=t.port??3000,r=ia(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let a=In(r.routeRules),f=new G,h=To(e,r.apiRoutes??[]),g=Bun.file(T.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?O(l):void 0,v=new Map,_=new Map,x=new Map,A=new Map;for(let n of r.routes)try{let y=T.join(e,n.compiledPath),i=JSON.parse(await Bun.file(y).text());if(m)i.html=Mt(i.html,m);v.set(n.pattern,i),x.set(n.pattern,Qe(i.html)),A.set(n.pattern,be(i.html));let j=T.join(e,n.fragmentPath);if(await Bun.file(j).exists()){let P=await Bun.file(j).text();_.set(n.pattern,m?Mt(P,m):P)}}catch(y){console.warn(`[stx] Failed to load route ${n.pattern}:`,y)}let s=new Map,b=[];for(let n of r.routes)if(n.hasParams){let{regex:y,params:i}=ue(n.pattern,{page:!0});b.push({regex:y,route:n,paramNames:i})}else s.set(n.pattern,n);let E=ce({port:o,async fetch(n){return Tn(n,await ze(m??O(),async()=>{let i=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[i])return t.apiRoutes[i](n);let j=await h(n);if(j)return j;if((n.method==="GET"||n.method==="HEAD")&&i!=="/"){let p=T.resolve(e,"public"),d;try{d=decodeURIComponent(i)}catch{d=i}if(!d.includes("\x00")){let u=T.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${T.sep}`))try{if(Z.existsSync(u)&&Z.statSync(u).isFile()){let R=T.extname(u).toLowerCase(),B=pe[R]||"application/octet-stream",X=i.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(i);return new Response(Bun.file(u),{headers:{"Content-Type":B,"Cache-Control":X?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let P=Ce(n),C=null,q={};if(C=s.get(i)||null,!C)for(let{regex:p,route:d,paramNames:u}of b){let c=i.match(p);if(c){C=d,u.forEach((R,B)=>{q[R]=c[B+1]});break}}if(!C){let p=xt(i)?null:s.get("/404")||null;if(p){let d=v.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let N=a(i),W=Object.keys(N).length>0;return f.respond(n,N.cache,async()=>{let p=v.get(C.pattern);if(P&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let c=_.get(C.pattern);if(c){let R=x.get(C.pattern);return new Response(c,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...A.has(C.pattern)?{"X-STX-Runtime":A.get(C.pattern)?"true":"false"}:{},...R?{"X-STX-Layout":R.layout,"X-STX-Layout-Group":R.group}:{},...M(),...N.cache?{}:{"Cache-Control":pt}}})}}let d=uo(n.method),u=v.get(C.pattern);if(!u){let c=s.get("/500")||null;if(c){let R=v.get(c.pattern);if(R)return new Response(R.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(C.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...M(),"Cache-Control":"public, max-age=60"}});try{let{html:c,boundaries:R,redirect:B,cookies:X,status:F,headers:I}=await Pn(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(B)return aa(B,X,I);if(R&&R.length>0){let{renderStreamingPage:S,streamToResponse:D}=await import("./chunk-ycttwgpg.js"),L=new Headers({...M(),...I,"Cache-Control":"private, no-store"});for(let k of X??[])L.append("Set-Cookie",k);if(P&&!d){let k=Qe(c);L.set("X-STX-Fragment","true"),L.set("X-STX-Runtime",be(c)?"true":"false"),L.set("X-STX-Layout",k.layout),L.set("X-STX-Layout-Group",k.group)}return D(S(P&&!d?Ee(c,r.routerContainer||"main",!0):c,R,{timeoutMs:30000}),{status:F??u.status??200,headers:L})}let w=new Headers({"Content-Type":"text/html",...M(),...N.cache?{}:{"Cache-Control":"private, no-store"}});for(let S of X??[])w.append("Set-Cookie",S);for(let[S,D]of Object.entries(I??{}))w.set(S,D);if(w.set("Vary",M(w.get("Vary")).Vary),P&&!d){let S=Qe(c);return w.set("X-STX-Fragment","true"),w.set("X-STX-Runtime",be(c)?"true":"false"),w.set("X-STX-Layout",S.layout),w.set("X-STX-Layout-Group",S.group),new Response(Ee(c,r.routerContainer||"main",!0),{status:F??u.status??200,headers:w})}return new Response(c,{status:F??u.status??200,headers:w})}catch(c){if(console.error(`[stx] Hydration error for ${i}:`,c),W)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${E.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${v.size} pre-loaded)`),{port:E.port,stop:()=>{f.invalidate(),E.stop()},invalidate:(n)=>f.invalidate(n)}}
|
|
3
|
+
export{Tn,Fg};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{Q,ee,te,
|
|
2
|
+
import{qe,re,Wa}from"./chunk-r8zhed35.js";import v from"fs";import g from"path";import V from"crypto";import{generatePlaceholder as T,processImage as L}from"ts-images";var Q=[320,640,768,1024,1280,1536,1920],ee=["webp","jpeg"],te=80,D=[".jpg",".jpeg",".png",".webp",".avif",".gif",".svg"],U={webp:"image/webp",avif:"image/avif",jpeg:"image/jpeg",png:"image/png"},I=null,M=!1;async function d(){if(M)return I;M=!0;try{let t=await import("sharp");return I=t.default||t,I}catch{return null}}async function On(){return await d()!==null}async function me(){return!0}async function Te(t,e={}){let{widths:a=Q,formats:r=ee,quality:n=te,fit:c="cover",placeholder:i="none",outputDir:m=".stx/images",baseUrl:s="/images"}=e,h,l;if(typeof t==="string"){if(l=t,!await Bun.file(t).exists())throw new Wr(`Image not found: ${t}`,"NOT_FOUND");h=await Bun.file(t).arrayBuffer().then((o)=>Buffer.from(o))}else l="buffer-input",h=t;let b=V.createHash("sha256").update(h).digest("hex").slice(0,12),j=await Ur(h),{width:u,height:x}=j,F=u/x;await v.promises.mkdir(m,{recursive:!0});let B=[],A=g.basename(l,g.extname(l)),f=a.filter((o)=>o<=u);if(!f.includes(u)&&u<=Math.max(...a))f.push(u);f.sort((o,p)=>o-p);for(let o of f){let p=Math.round(o/F);for(let w of r){let S=`${A}-${o}w-${b}.${w}`,P=g.join(m,S),q=`${s}/${S}`,E=await Bl(h,{width:o,height:p,format:w,quality:n,fit:c});await Bun.write(P,E),B.push({path:P,url:q,width:o,height:p,format:w,size:E.length})}}let y;if(i!=="none")y=await k(h,i);return{src:l,variants:B,placeholder:y,width:u,height:x,aspectRatio:F,hash:b}}async function Ur(t){let e=typeof t==="string"?Buffer.from(await Bun.file(t).arrayBuffer()):t,a=await d();if(a){let n=await a(e).metadata();return{width:n.width||0,height:n.height||0,format:n.format||"unknown",hasAlpha:n.hasAlpha}}return R(e)}function R(t){if(t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71){let e=t.readUInt32BE(16),a=t.readUInt32BE(20);return{width:e,height:a,format:"png",hasAlpha:!0}}if(t[0]===255&&t[1]===216){let e=2;while(e<t.length){if(t[e]!==255)break;let a=t[e+1];if(a>=192&&a<=207&&a!==196&&a!==200&&a!==204){let n=t.readUInt16BE(e+5);return{width:t.readUInt16BE(e+7),height:n,format:"jpeg",hasAlpha:!1}}let r=t.readUInt16BE(e+2);e+=2+r}}if(t.toString("utf8",0,4)==="RIFF"&&t.toString("utf8",8,12)==="WEBP"){let e=t.toString("utf8",12,16);if(e==="VP8 "){let a=t.readUInt16LE(26)&16383,r=t.readUInt16LE(28)&16383;return{width:a,height:r,format:"webp",hasAlpha:!1}}if(e==="VP8L"){let a=t.readUInt32LE(21),r=(a&16383)+1,n=(a>>14&16383)+1;return{width:r,height:n,format:"webp",hasAlpha:!0}}}if(t.toString("utf8",0,3)==="GIF"){let e=t.readUInt16LE(6),a=t.readUInt16LE(8);return{width:e,height:a,format:"gif",hasAlpha:!0}}throw new Wr("Unable to parse image dimensions","PARSE_ERROR")}async function Bl(t,e){let a=await d();if(a){let r=a(t).resize(e.width,e.height,{fit:e.fit});switch(e.format){case"webp":r=r.webp({quality:e.quality});break;case"avif":r=r.avif({quality:e.quality});break;case"jpeg":r=r.jpeg({quality:e.quality});break;case"png":r=r.png({quality:e.quality});break}return r.toBuffer()}return await Wa("img",async(r)=>{let n=g.join(r,`out.${e.format}`);return await L({input:t,output:n,format:e.format,quality:e.quality,resize:{width:e.width,height:e.height,fit:e.fit}}),Buffer.from(await Bun.file(n).arrayBuffer())})}async function k(t,e){let a=await d();if(e==="blur"&&a){let m=(await a(t).resize(20).blur(10).toBuffer()).toString("base64"),s=await Ur(t);return`data:${U[s.format]||"image/jpeg"};base64,${m}`}if(e==="dominant-color"&&a){let{dominant:i}=await a(t).resize(1,1).toBuffer().then(async(m)=>{let s=await a(m).metadata();return{dominant:{r:128,g:128,b:128}}}).catch(()=>({dominant:{r:128,g:128,b:128}}));return`rgb(${i.r}, ${i.g}, ${i.b})`}let r=await Ur(t),n=qe("ph"),c=g.join(n,`in.${r.format==="unknown"?"bin":r.format}`);try{await Bun.write(c,t);let i=e==="blur"?"blur":e==="thumbhash"?"thumbhash":"dominant-color",s=await T(c,{strategy:i,width:i==="thumbhash"?void 0:32});if(e==="dominant-color"&&s.dominantColor)return s.dominantColor;if(s.dataURL)return s.dataURL;return"rgb(128, 128, 128)"}catch{return"rgb(128, 128, 128)"}finally{re(n)}}function ft(t,e){return(e?t.filter((r)=>r.format===e):t).sort((r,n)=>r.width-n.width).map((r)=>`${r.url} ${r.width}w`).join(", ")}function Kt(t){if(!t||Object.keys(t).length===0)return"100vw";return Object.entries(t).sort((a,r)=>{let n=Number.parseInt(a[0].replace(/\D/g,""))||0;return(Number.parseInt(r[0].replace(/\D/g,""))||0)-n}).map(([a,r])=>`(max-width: ${a}) ${r}`).join(", ")+", 100vw"}function Nn(t){let e=t.filter((r)=>r.format==="jpeg");if(e.length===0)return t[Math.floor(t.length/2)];let a=e.sort((r,n)=>r.width-n.width);return a[Math.floor(a.length/2)]}function Dn(t){let e=new Map;for(let a of t){let r=e.get(a.format)||[];r.push(a),e.set(a.format,r)}return e}function Mn(t){let e=g.extname(t).toLowerCase();return D.includes(e)}function ne(t){return U[t]||"application/octet-stream"}function Ln(t){return t.reduce((e,a)=>e+a.size,0)}function jn(t){if(t<1024)return`${t} B`;if(t<1048576)return`${(t/1024).toFixed(1)} KB`;return`${(t/1048576).toFixed(2)} MB`}class Wr extends Error{code;constructor(t,e){super(t);this.name="ImageProcessingError",this.code=e}}
|
|
3
|
+
export{Q,ee,te,On,me,Te,Ur,Bl,ft,Kt,Nn,Dn,Mn,ne,Ln,jn,Wr};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{mf,hf,he,yf,Xa,Qt,en,gh,Ja,tn,Zn,bf,wf,vf,es,nn,xf,rn,Ya,mh}from"./chunk-ben8bjnk.js";import"./chunk-59k4xb92.js";import"./chunk-wmnzapn8.js";import"./chunk-edhxg3rz.js";import"./chunk-rqd6b2nc.js";import"./chunk-8rk79ha1.js";import"./chunk-q3azy64b.js";import"./chunk-evxp3wmv.js";import"./chunk-f8p8ggvw.js";import"./chunk-y4mp1rra.js";import"./chunk-dvpk4c1y.js";import"./chunk-x5seqmrv.js";import"./chunk-tpfxvw4q.js";import"./chunk-4833k99b.js";import"./chunk-b51p56k5.js";export{Zn as MODULE_SPECIFIER_PREFIX,mf as bundleCacheDir,hf as bundleCacheEntryLimit,mh as bundleClientEntriesSplit,rn as bundleClientScript,en as clearBundleFailures,he as clientBundleDependencies,Qt as getBundleFailures,tn as hasUserImports,nn as moduleSubstitutionKey,wf as normalizeRegistrySpecifiers,xf as queueClientBundleBuild,Xa as recordBundleFailure,bf as registryIdForPath,Ja as resolveBundlerFallback,vf as rewriteRegistryImports,gh as setBundlerFallbackMode,yf as shouldLogBundlerDiagnostics,Ya as tempBuildName,es as withModuleSubstitutes};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import R from"path";var O=/__stxModules\["((?:[^"\\]|\\.)*)"\]/g;function Dr(...g){let d=new Set;for(let c of g){if(!c||!c.includes("__stxModules["))continue;for(let s of c.matchAll(O))try{d.add(JSON.parse(`"${s[1]}"`))}catch{}}return[...d].sort()}function
|
|
3
|
-
`)}async function
|
|
2
|
+
import R from"path";var O=/__stxModules\["((?:[^"\\]|\\.)*)"\]/g;function Dr(...g){let d=new Set;for(let c of g){if(!c||!c.includes("__stxModules["))continue;for(let s of c.matchAll(O))try{d.add(JSON.parse(`"${s[1]}"`))}catch{}}return[...d].sort()}function Qs(...g){let d=new Map,c=(s,e)=>{let r=d.get(s);if(r===null)return;if(e===null){d.set(s,null);return}let n=r??new Set;for(let i of e)n.add(i);d.set(s,n)};for(let s of g){if(!s||!s.includes("__stxModules["))continue;let e=[];for(let n of s.matchAll(/([\w$]+)\s*=\s*globalThis\.__stxModules\s*&&\s*globalThis\.__stxModules\["((?:[^"\\]|\\.)*)"\]/g)){let i;try{i=JSON.parse(`"${n[2]}"`)}catch{continue}e.push({variable:n[1],id:i,start:n.index+n[0].length,end:s.length})}let r=s.match(/__stxModules\["(?:[^"\\]|\\.)*"\]/g)?.length??0;if(e.length===0||r!==e.length){for(let n of Dr(s))c(n,null);continue}for(let[n,i]of e.entries()){let p=e.slice(n+1).find((h)=>h.variable===i.variable);i.end=p?p.start:s.length}for(let n of e){let i=new Set,p=!1,h=n.variable.replace(/[$]/g,"\\$&"),o=s.slice(n.start,n.end);for(let l of o.matchAll(new RegExp(`(?<![\\w$.])${h}(?![\\w$])`,"g"))){let f=o.slice(l.index+n.variable.length,l.index+n.variable.length+200),a=/^\s*\[\s*(["'])([A-Za-z_$][\w$]*)\1\s*\]/.exec(f)??/^\s*\.\s*([A-Za-z_$][\w$]*)/.exec(f);if(a){i.add(a[a.length-1]);continue}if(/^\s*[!=]==?\s*(?:undefined|void 0)\b/.test(f))continue;p=!0;break}c(n.id,p?null:i)}}return d}function v(g,d,c){let s=[],e=[];return g.forEach((r,n)=>{let i=r.startsWith("npm:")?r.slice(4):R.resolve(d,r),p=`__stxRegistered${n}`,h=JSON.stringify(r),o=c?.get(r);if(o&&[...o].every((l)=>/^[A-Za-z_$][\w$]*$/.test(l))){let l=[...o].sort(),f=l.map((m,_)=>`${m} as ${p}_${_}`);s.push(l.length>0?`import { ${f.join(", ")} } from ${JSON.stringify(i)};`:`import ${JSON.stringify(i)};`);let a=l.map((m,_)=>`get ${JSON.stringify(m)}() { return ${p}_${_}; }`).join(", ");e.push(`if (!globalThis.__stxModules[${h}]) globalThis.__stxModules[${h}] = { ${a} };`);return}s.push(`import * as ${p} from ${JSON.stringify(i)};`),e.push(`if (!globalThis.__stxModules[${h}]) globalThis.__stxModules[${h}] = ${p};`)}),[...s,"globalThis.__stxModules = globalThis.__stxModules || {};",...e].join(`
|
|
3
|
+
`)}async function Pg(g,d={}){if(g.length===0)return null;let c=process.cwd(),s=v(g,c,d.names),e;try{let{bundleClientScript:l}=await import("./chunk-mdw96yhg.js"),f=()=>l(s,R.join(c,".stx-module-registry.ts"),{projectRoot:c,minify:d.minify,externalizeUserModules:!1,collectInputs:d.collectInputs,throwOnFailure:!0});try{e=await f()}catch(a){if(!d.names)throw a;s=v(g,c,void 0),e=await f()}}catch(l){let{formatBuildFailure:f}=await import("./chunk-q245q8z1.js"),a=f(l);console.warn(`[stx] could not build the page module registry (#1957): ${a}`);let m=`[stx] the page module registry did not build, so ${g.join(", ")} cannot load (#1957): ${a}`;return`;console.error(${JSON.stringify(m)});`}let{transformAutoImports:r,generateAutoImportDestructuring:n}=await import("./chunk-vttx66q0.js"),i=r(e),p=n(i.stxImports,i.browserImports),{transformStoreImports:h}=await import("./chunk-2zg3jmy7.js");e=h(i.code);let o=JSON.stringify(new Bun.CryptoHasher("md5").update(s).digest("hex").slice(0,12));return[";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${o}]) return;`,` __stxBundles[${o}] = true;`,p,e,"})();"].join(`
|
|
4
4
|
`)}var P=/^import(?:[ \t]*(\{[^}]*\})[ \t]*from|[ \t]*\*[ \t]*as[ \t]+([\w$]+)[ \t]+from)?[ \t]*["']\.\/(chunk-[\w-]+)\.js["'][ \t]*;?[ \t]*$/gm,j=/^export\s*\{([^}]*)\}\s*;?[ \t]*$/gm,I=new Set(["__preload","__chunks"]),N=/^("[^"]*"|[\w$]+)(?:\s+as\s+("[^"]*"|[\w$]+))?$/;function J(g){let d=[],c=[],s=!0,r=g.replace(/^var __chunkGraphs;[\s\S]*?^var __chunks = [\s\S]*?^\};[ \t]*\n?/m,"").replace(/^__chunks\(import\.meta\.url,[^\n]*\);[ \t]*\n?/gm,"").replace(P,(h,o,l,f)=>{let a=`__stxChunkExports${d.length}`;if(d.push(f),c.push(`var ${a} = __stxChunk(${JSON.stringify(f)});`),l)c.push(`var ${l} = ${a};`);else if(o)for(let m of o.slice(1,-1).split(",")){let _=m.trim();if(!_)continue;let w=N.exec(_);if(!w){s=!1;continue}if(I.has(w[1]))continue;let M=w[1].startsWith('"')?JSON.parse(w[1]):w[1],t=w[2]??w[1];if(t.startsWith('"')){s=!1;continue}c.push(`var ${t} = ${a}[${JSON.stringify(M)}];`)}return""});if(!s)throw Error("an import it does not read");let n=[];r=r.replace(/\(\s*__preload\([^)]*\)\s*,\s*import\(\s*["']\.\/(chunk-[\w-]+)\.js["']\s*\)\s*\)|\bimport\(\s*["']\.\/(chunk-[\w-]+)\.js["']\s*\)/g,(h,o,l)=>{let f=o??l;return n.push(f),`Promise.resolve().then(function () { return __stxChunk(${JSON.stringify(f)}); })`});let i=[];r=r.replace(j,(h,o)=>{for(let l of o.split(",")){let f=l.trim();if(!f)continue;let a=N.exec(f);if(!a||a[1].startsWith('"')){s=!1;continue}if(I.has(a[1]))continue;let m=a[2]??a[1];i.push([a[1],m.startsWith('"')?JSON.parse(m):m])}return""});let p=[/\bimport\.meta\b/,/\b__chunks\b/,/\b__preload\b/,/^\s*export\s+(?:default\b|const\b|let\b|var\b|function\b|class\b|async\b|\*|\{)/m,/\bfrom\s*["']\.\/chunk-/,/^\s*import\s*["']\.\/chunk-/m].find((h)=>h.test(r));if(!s||p)throw Error(`${p?`${p.source} is left in it`:"an export it does not read"}`);return{reads:c.join(`
|
|
5
|
-
`),chunks:d,lazy:n,body:r,exports:i}}function
|
|
6
|
-
`).length)>200)return!1;for(let d of g.matchAll(/\bexport\s*\{([^}]*)\}(?!\s*from\b)/g))for(let c of d[1].split(",")){let s=c.trim().split(/\s+as\s+/)[0].trim();if(!/^[A-Za-z_$][\w$]*$/.test(s))continue;let e=s.replace(/[$]/g,"\\$&");if(!new RegExp(`(?<![\\w$.])(?:let|var)\\s+${e}(?![\\w$])`,"g").test(g))continue;let n=new RegExp(`(?<![\\w$.])${e}\\s*(?:=(?![=>])|[-+*/%&|^]=|\\*\\*=|<<=|>>>?=|&&=|\\|\\|=|\\?\\?=|\\+\\+|--)|(?:\\+\\+|--)\\s*${e}(?![\\w$])`,"g"),i=new RegExp(`(?<![\\w$.])(?:let|var|const)\\s+${e}\\s*=`,"g");if((g.match(n)?.length??0)>(g.match(i)?.length??0))return!0}return!1}async function
|
|
5
|
+
`),chunks:d,lazy:n,body:r,exports:i}}function wl(g){if(/\bexport\s+(?:let|var)\b/.test(g))return!0;if(g.length/Math.max(1,g.split(`
|
|
6
|
+
`).length)>200)return!1;for(let d of g.matchAll(/\bexport\s*\{([^}]*)\}(?!\s*from\b)/g))for(let c of d[1].split(",")){let s=c.trim().split(/\s+as\s+/)[0].trim();if(!/^[A-Za-z_$][\w$]*$/.test(s))continue;let e=s.replace(/[$]/g,"\\$&");if(!new RegExp(`(?<![\\w$.])(?:let|var)\\s+${e}(?![\\w$])`,"g").test(g))continue;let n=new RegExp(`(?<![\\w$.])${e}\\s*(?:=(?![=>])|[-+*/%&|^]=|\\*\\*=|<<=|>>>?=|&&=|\\|\\|=|\\?\\?=|\\+\\+|--)|(?:\\+\\+|--)\\s*${e}(?![\\w$])`,"g"),i=new RegExp(`(?<![\\w$.])(?:let|var|const)\\s+${e}\\s*=`,"g");if((g.match(n)?.length??0)>(g.match(i)?.length??0))return!0}return!1}async function eo(g,d={}){let c=g.filter((e)=>e.ids.length>0);if(c.length===0)return{chunks:new Map,routes:new Map,reads:new Map};let s=process.cwd();try{let{bundleClientEntriesSplit:e}=await import("./chunk-mdw96yhg.js"),r=[],n=await e(new Map(c.map((t)=>[t.name,v(t.ids,s,t.names)])),{projectRoot:s,filePath:R.join(s,".stx-module-registry.ts"),collectInputs:r});d.collectInputs?.push(...r);let{transformAutoImports:i,generateAutoImportDestructuring:p}=await import("./chunk-vttx66q0.js"),{transformStoreImports:h}=await import("./chunk-2zg3jmy7.js"),o=new Map;for(let[t,u]of[...n.chunks,...n.entries])try{o.set(t,J(u))}catch(b){throw Error(`cannot read ${t}: ${b instanceof Error?b.message:String(b)}`)}for(let[t,u]of[...n.chunks,...n.entries])if(/\b__esm\(/.test(u))throw Error(`${t} initialises a module lazily`);for(let t of r)if(/\.(?:[cm]?[jt]sx?)$/.test(t)&&wl(await Bun.file(t).text()))throw Error(`${t} exports a binding that changes after it is read`);let l=new Set,f=new Set,a=(t)=>{if(f.has(t))return;if(l.has(t))throw Error(`the chunks import each other (${t})`);l.add(t);for(let u of o.get(t)?.chunks??[]){if(!o.has(u))throw Error(`${t} imports ${u}, which was not built`);a(u)}for(let u of o.get(t)?.lazy??[])if(!o.has(u))throw Error(`${t} imports ${u}, which was not built`);l.delete(t),f.add(t)};for(let t of o.keys())a(t);let m=(t)=>{let u=i(t.body);return{prelude:p(u.stxImports,u.browserImports),body:h(u.code)}},_=new Map;for(let t of n.chunks.keys()){let u=o.get(t),{prelude:b,body:k}=m(u),y=u.exports.map(([S,x])=>`get ${JSON.stringify(x)}() { return ${S}; }`).join(", ");_.set(t,`function (__stxChunk) {
|
|
7
7
|
${b}
|
|
8
8
|
${u.reads}
|
|
9
9
|
${k}
|
|
@@ -13,5 +13,5 @@ var __stxChunk = function (name) { return globalThis.__stxNativeRuntime.chunk(na
|
|
|
13
13
|
${b}
|
|
14
14
|
${u.reads}
|
|
15
15
|
${k}
|
|
16
|
-
})();`);let y=new Set,S=(x)=>{if(y.has(x))return;y.add(x);let E=o.get(x);for(let A of[...E.chunks,...E.lazy])S(A)};for(let x of[...u.chunks,...u.lazy])S(x);M.set(t,[...y].sort())}return{chunks:_,routes:w,reads:M}}catch(e){let{formatBuildFailure:r}=await import("./chunk-
|
|
17
|
-
export{Dr,
|
|
16
|
+
})();`);let y=new Set,S=(x)=>{if(y.has(x))return;y.add(x);let E=o.get(x);for(let A of[...E.chunks,...E.lazy])S(A)};for(let x of[...u.chunks,...u.lazy])S(x);M.set(t,[...y].sort())}return{chunks:_,routes:w,reads:M}}catch(e){let{formatBuildFailure:r}=await import("./chunk-q245q8z1.js");return console.warn(`[stx] could not share the native routes' modules, building each route's alone: ${r(e)}`),null}}
|
|
17
|
+
export{Dr,Qs,Pg,wl,eo};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{yh,Qa,bh,ec,Sf,kf,an,rr,wh,_f,Cf,vh,y}from"./chunk-rd33qkfs.js";import"./chunk-yb71b2d6.js";import"./chunk-y4mp1rra.js";import"./chunk-dvpk4c1y.js";import"./chunk-x5seqmrv.js";import"./chunk-tpfxvw4q.js";import"./chunk-4833k99b.js";import"./chunk-b51p56k5.js";export{an as buildCss,_f as extractClassNames,kf as fingerprintConfig,Cf as generateCss,wh as getCachedCSS,yh as getCssServeAsset,y as injectCss,Qa as loadCssEngine,ec as loadCssEngineConfig,rr as rebuildCss,bh as resetCssCache,Sf as resolveUserCssConfig,vh as withLinkedModuleBundles};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{mt,zn,nh}from"./chunk-02c46de1.js";import{le,Hn,rh,Vn,mo,qr,Kr,sh,oh,ih,Un,Wn,ho,Gr,ah}from"./chunk-jyp2mmts.js";import"./chunk-b51p56k5.js";export{mo as batch,nh as default,Hn as derived,Vn as effect,mt as generateSignalsRuntime,zn as generateSignalsRuntimeDev,Wn as isDerived,Un as isSignal,rh as memo,Kr as onDestroy,qr as onMount,Gr as peek,ih as pendingLifecycleCounts,oh as runDestroyCallbacks,sh as runMountCallbacks,le as state,ho as untrack,ah as useOptimistic};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{er,i}from"./chunk-t1shvfhm.js";import"./chunk-rd33qkfs.js";import"./chunk-b0z2n941.js";import"./chunk-m3z13f59.js";import"./chunk-gwjh981q.js";import"./chunk-xgnmgjpv.js";import"./chunk-a81rt2t4.js";import"./chunk-9k8ztdcc.js";import"./chunk-yk456jp4.js";import{we}from"./chunk-932zx5q4.js";import"./chunk-k2ex94n8.js";import"./chunk-yb71b2d6.js";import"./chunk-edhxg3rz.js";import"./chunk-rqd6b2nc.js";import"./chunk-8rk79ha1.js";import"./chunk-q3azy64b.js";import"./chunk-evxp3wmv.js";import"./chunk-f8p8ggvw.js";import{Oe,Ms,Ls}from"./chunk-y4mp1rra.js";import"./chunk-dvpk4c1y.js";import"./chunk-x5seqmrv.js";import"./chunk-tpfxvw4q.js";import"./chunk-4833k99b.js";import"./chunk-b51p56k5.js";export{er as buildModulesTag,we as injectRouterScript,i as processDirectives,Ms as processJsonDirective,Ls as processOnceDirective,Oe as validateClientScript};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import c from"fs";import i from"path";import{createHash as k}from"crypto";var j=["pages","components","layouts","partials","composables"],w=new Set;function
|
|
3
|
-
`)}`);let o=r.outputs.find((a)=>a.kind==="entry-point");if(!o||r.outputs.length!==1)throw Error(`Unsupported layer config output: ${e}`);let s=(await import(`data:text/javascript;base64,${Buffer.from(await o.text()).toString("base64")}`)).default;if(!x(s))throw Error(`Layer ${e} must default-export a config object`);return s}async function
|
|
4
|
-
`)}function
|
|
5
|
-
export{
|
|
2
|
+
import c from"fs";import i from"path";import{createHash as k}from"crypto";var j=["pages","components","layouts","partials","composables"],w=new Set;function mc(e){try{return w.has(c.realpathSync(e))}catch{return w.has(i.resolve(e))}}var _=new Set(["extends","root",...j.map((e)=>`${e}Dir`),"publicDir","stateDir","cachePath"]),x=(e)=>e!==null&&typeof e==="object"&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null);function b(e,n,r=""){if(Array.isArray(n))return["middleware","plugins"].includes(r)?[...Array.isArray(e)?e:[],...n]:[...n];if(!x(n))return n;let o={...x(e)?e:{}};for(let[s,a]of Object.entries(n)){if(["__proto__","constructor","prototype"].includes(s))throw Error(`Invalid layer config key: ${s}`);o[s]=b(o[s],a,s)}return o}function v(e){for(let n of["stx.config.ts","stx.config.js","stx.config.mjs",".config/stx.config.ts",".config/stx.ts","ui.config.ts"]){let r=i.join(e,n);if(c.existsSync(r))return c.realpathSync(r)}throw Error(`Application layer has no stx.config.ts: ${e}`)}function E(e,n,r){if(typeof e!=="string"||!e||/^(?:https?:|git[+:])/.test(e))throw Error(`Invalid application layer ${JSON.stringify(e)} in ${n}; use a local path or installed package`);if(e.startsWith(".")||i.isAbsolute(e)){let s=i.resolve(n,e);return c.statSync(s).isDirectory()?v(s):c.realpathSync(s)}let o=n;while(!0){let s=i.join(o,"node_modules",e),a=i.join(s,"package.json");if(c.existsSync(a)){r.add(c.realpathSync(a));let g=JSON.parse(c.readFileSync(a,"utf8"));return g.stx?.layer?c.realpathSync(i.resolve(s,g.stx.layer)):v(s)}let p=i.dirname(o);if(p===o)break;o=p}throw Error(`Cannot resolve application layer ${JSON.stringify(e)} from ${n}`)}async function C(e,n){let r=await Bun.build({entrypoints:[e],target:"bun",format:"esm",splitting:!1,plugins:[{name:"stx-layer-config",setup(a){a.onResolve({filter:/^[^./]/},(p)=>{if(p.path.startsWith("node:"))return{path:p.path,external:!0};return{path:Bun.resolveSync(p.path,p.resolveDir),external:!0}}),a.onLoad({filter:/./},(p)=>{let g=c.realpathSync(p.path);n.add(g),w.add(g);return})}}]});if(!r.success)throw Error(`Cannot load layer ${e}: ${r.logs.join(`
|
|
3
|
+
`)}`);let o=r.outputs.find((a)=>a.kind==="entry-point");if(!o||r.outputs.length!==1)throw Error(`Unsupported layer config output: ${e}`);let s=(await import(`data:text/javascript;base64,${Buffer.from(await o.text()).toString("base64")}`)).default;if(!x(s))throw Error(`Layer ${e} must default-export a config object`);return s}async function hc(e,n){let r=new Set,o=[],s=[],a=new Set,p=[];async function g(t,l){if(t=c.realpathSync(t),p.includes(t))throw Error(`Application layer cycle: ${[...p,t].join(" -> ")}`);if(a.has(t))return;a.add(t),p.push(t);let d=await C(t,r);l??=i.basename(i.dirname(t))===".config"?i.dirname(i.dirname(t)):i.dirname(t),l=c.realpathSync(l);let D=i.resolve(l,d.root??"."),L=Object.fromEntries(j.map((y)=>[y,i.resolve(D,d[`${y}Dir`]??(y==="composables"?"functions":y))]));o.push({root:l,configFile:t,resources:L});let u={...d};if(u.plugins)u.plugins=u.plugins.map((y)=>{let h=typeof y==="string"?y:y[0],S=h.startsWith(".")?i.resolve(l,h):i.isAbsolute(h)?h:Bun.resolveSync(h,l);return r.add(c.realpathSync(S)),typeof y==="string"?S:[S,y[1]]});if(typeof u.css==="string")u.css=i.resolve(l,u.css);if(u.serverApi)u.serverApi={...typeof u.serverApi==="object"?u.serverApi:{},dir:i.resolve(l,typeof u.serverApi==="object"?u.serverApi.dir??"server/api":"server/api")};if(s.push(u),d.extends!==void 0&&!Array.isArray(d.extends))throw Error(`extends in ${t} must be an array`);for(let y of d.extends??[])await g(E(y,l,r));p.pop()}await g(v(e),e);for(let t of["package.json","bun.lock","package-lock.json","pnpm-lock.yaml"]){let l=i.join(e,t);if(c.existsSync(l))r.add(c.realpathSync(l))}let f=b({},n);for(let t=s.length-1;t>=0;t--){let l=t===0?s[t]:Object.fromEntries(Object.entries(s[t]).filter(([d])=>!_.has(d)));f=b(f,l)}let m={layers:o,configDependencies:[...r].sort()};return f._layerGraph=m,f._layerPageDirs=o.map((t)=>t.resources.pages),f._layerComponentDirs=o.map((t)=>t.resources.components),f._layerLayoutDirs=o.map((t)=>t.resources.layouts),f._layerPartialDirs=o.map((t)=>t.resources.partials),f._layerComposableDirs=o.map((t)=>t.resources.composables),await qo(m,e),{config:f,graph:m}}async function qo(e,n){let r=new Map,o=[];for(let s of e.layers)for(let[a,p]of Object.entries(s.resources)){if(!c.existsSync(p))continue;let g=new Bun.Glob(a==="composables"?"**/*.ts":"**/*.stx");for(let f of[...g.scanSync({cwd:p})].sort()){let m=`${a}/${f}`,t=i.join(p,f),l=r.get(m);if(l)o.push({resource:m,winner:l,shadowed:t});else r.set(m,t)}}Object.assign(e,{overrides:o}),await Bun.write(i.join(n,".stx/layers.json"),JSON.stringify(e,null,2))}function A(e){let n=new Set(e.configDependencies);function r(o){if(!c.existsSync(o))return;n.add(o);for(let s of c.readdirSync(o,{withFileTypes:!0}).sort((a,p)=>a.name.localeCompare(p.name))){if(s.name.startsWith(".")||s.name==="node_modules")continue;let a=i.join(o,s.name);if(s.isDirectory())r(a);else if(s.isFile())n.add(a)}}for(let o of e.layers)for(let s of Object.values(o.resources))r(s);return[...n].sort()}function ys(e){return O(A(e))}function bs(e){return O(e.configDependencies)}function O(e){return e.map((n)=>{try{let r=c.statSync(n);return`${n}:${r.mtimeMs}:${r.size}`}catch{return`${n}:missing`}}).join(`
|
|
4
|
+
`)}function yc(e){return e.layers.map((n)=>({config:i.relative(n.root,n.configFile),files:A({layers:[n],configDependencies:e.configDependencies.filter((r)=>r.startsWith(`${n.root}${i.sep}`))}).filter((r)=>c.statSync(r).isFile()).map((r)=>({path:i.relative(n.root,r).replaceAll(i.sep,"/"),sha256:k("sha256").update(c.readFileSync(r)).digest("hex")}))}))}
|
|
5
|
+
export{mc,hc,qo,ys,bs,yc};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{xh,Tf,Xe,tc,Sh,rs,ss,os}from"./chunk-gwjh981q.js";import"./chunk-xgnmgjpv.js";import"./chunk-a81rt2t4.js";import"./chunk-9k8ztdcc.js";import"./chunk-k2ex94n8.js";import"./chunk-y4mp1rra.js";import"./chunk-dvpk4c1y.js";import"./chunk-x5seqmrv.js";import"./chunk-tpfxvw4q.js";import"./chunk-4833k99b.js";import"./chunk-b51p56k5.js";export{Sh as clearOnceStore,tc as onceStore,Xe as partialsCache,rs as processIncludes,ss as processStackPushDirectives,os as processStackReplacements,xh as resetUnscopedSignalWarnings,Tf as topLevelElements};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{k}from"./chunk-b51p56k5.js";import{A,Cn}from"./chunk-4833k99b.js";import{Ie,b,x,C,Y}from"./chunk-y4mp1rra.js";import{a}from"./chunk-edhxg3rz.js";import{he,tn,nn,rn}from"./chunk-ben8bjnk.js";import{bt}from"./chunk-yk456jp4.js";import{gt,Fn,Gt,ce}from"./chunk-w2pch5xn.js";import{E,_n}from"./chunk-rha8sv1h.js";import h from"path";var v=new Map,I=new Map,F=b(64),R=new Map,V=["composables","functions"];function H(e){let s=h.basename(e,".ts");return s==="index"||s==="types"||e.endsWith(".d.ts")}async function ee(e){if(e)return h.resolve(e);let s=`<default>:${process.cwd()}`,r=R.get(s);if(r!==void 0)return r;let t=await te();if(t!==null)R.set(s,t);return t}async function te(){let e=await a(),s=e.root||process.cwd(),r=e.composablesDir;if(r)return h.resolve(s,r);for(let t of V){let n=h.resolve(s,t);try{let c=new Bun.Glob("**/*.ts");for await(let i of c.scan({cwd:n,absolute:!0}))if(!H(i))return n}catch{}}return null}async function W(e){let s=Array.isArray(e)?e:e?[h.resolve(e)]:(await a())._layerComposableDirs??[await ee()].filter((t)=>!!t),r=new Map;for(let t of s){let n=new Bun.Glob("**/*.ts");try{for await(let c of n.scan({cwd:t,absolute:!0})){let i=h.relative(t,c);if(!H(c)&&!r.has(i))r.set(i,c)}}catch{}}return{key:s.join("\x00"),files:[...r.values()].sort()}}async function go(e){let{files:s}=await W(e),r=Y({loader:"ts",target:"browser",define:C()}),t=[];for(let n of s)try{let c=await Bun.file(n).text(),i=r.scan(c).exports.filter((u)=>u!=="default");if(i.length>0)t.push({file:n,names:i})}catch{}return t}function ne(e,s){return new RegExp(`\\b${s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(e)}function P(e,s){let r=new Set(e.match(/\w+/g)),t=new Set;for(let n of s)if(/^\w+$/.test(n)?r.has(n):ne(e,n))t.add(n);return t}var J=b(64);function X(e,s){let r=x(e,s.size),t=J.get(r);if(t)return t;let n;try{n=Ie(e,s)}catch{n=P(e,s)}let c=[...e.matchAll(/(?:const|let|var)\s*\{([^}]*)\}\s*=\s*window\.__composables\u0008/g),...e.matchAll(/import\s*\{([^}]*)\}\s*from\s*['"]@composables['"]/g)];for(let i of c)for(let u of i[1].split(",")){let f=u.trim().split(/\s*(?::|\u0008as\u0008)\s*/)[0];if(f&&s.has(f))n.add(f)}return J.set(r,n),n}function se(e){return!e||/^(?:module|(?:text|application)\/(?:java|ecma)script|application\/stx-[\w-]+)$/i.test(e)}var L=b(256);function oe(e,s){let r=new Set(s),t="",n=0,c=new Set;for(let i of e.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi)){t+=e.slice(n,i.index),n=i.index+i[0].length;let u=i[1]??"",f=i[2]??"",d=/\btype\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(u),m=d?(d[1]??d[2]??d[3]??"").trim():void 0;if(!se(m)){if(!/json/i.test(m??""))t+=` ${f} `;continue}let y=P(f,r);if(y.size===0)continue;let _=x(f,[...y].sort().join(",")),w=L.get(_);if(!w)w=X(f,y),L.set(_,w);for(let B of w)c.add(B)}t+=e.slice(n);for(let i of P(t,r))c.add(i);return c}function ie(e,s,r){let t=new Map;for(let{file:f,names:d}of e)for(let m of d)if(!t.has(m))t.set(m,f);let n=new Set(t.keys()),c=(f)=>{let d=[];for(let m of X(f,n))d.push(t.get(m));return d},i=new Set,u=r.flatMap((f,d)=>d===0?[...oe(f,t.keys())].map((m)=>t.get(m)):c(f));while(u.length>0){let f=[];for(let d of u){if(i.has(d))continue;i.add(d);for(let m of c(s.get(d)??""))if(!i.has(m))f.push(m)}u=f}return i}async function eh(e,s,r,t){let{key:n,files:c}=await W(e);if(!n)return null;let i=()=>[...new Set([...c,...c.flatMap((o)=>he(o))])],u=gt(i());if(c.length===0)return ce(v,n,u,""),null;c.sort();let f=Y({loader:"ts",target:"browser",define:C()}),d=Gt(I,n,u);if(!d){let o=new Map,l=[];for(let p of c)try{let S=await Bun.file(p).text();o.set(p,S);let g=f.scan(S).exports.filter((Q)=>Q!=="default");if(g.length>0)l.push({file:p,names:g})}catch{o.set(p,"")}d=ce(I,n,u,{codeByFile:o,modules:l})}let{codeByFile:m,modules:y}=d,_;if(s===void 0)_=new Set(c);else{let o=r?[s,...r]:[s],l=x(o.join("\x00"),n,o.length,u),p=F.get(l);if(_=p??ie(y,m,o),!p)F.set(l,_)}if(_.size===0)return null;let w=c.filter((o)=>_.has(o)),B=()=>{if(!t)return;for(let o of w)t.push(o,...he(o))},N=`${n}\x00${w.join("\x00")}\x00${nn()}`,U=Gt(v,N,u);if(U!==void 0)return B(),U||null;let D=[],M=new Set,T=new Set;for(let o of w)try{let l=m.get(o)??await Bun.file(o).text(),p=h.basename(o,".ts");for(let g of l.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(g[1])T.add(g[1]);let S=[];try{for(let g of f.scan(l).exports)if(g!=="default")M.add(g),S.push(g)}catch{}if(l=A(l),tn(l))l=await rn(l,o,{projectRoot:process.cwd(),externalizeUserModules:!1,expose:S}),l=bt(l);l=Cn(l),l=l.replace(/^export\s+(default\s+)?/gm,""),l=f.transformSync(l),D.push(`// Composable: ${p}
|
|
3
|
+
${l.trim()}`)}catch(l){console.warn(`[stx] Failed to load composable ${o}:`,l)}if(D.length===0||M.size===0)return ce(v,N,u,""),null;let Z=[...M].map((o)=>` try { if (!(${JSON.stringify(o)} in __c)) __c[${JSON.stringify(o)}] = ${o}; } catch (e) {}`).join(`
|
|
4
|
+
`),z=JSON.stringify([...M]),j=D.join(`
|
|
5
|
+
|
|
6
|
+
`),q=k.filter((o)=>!T.has(o)&&new RegExp(`\\b${o}\\b`).test(j)).map((o)=>`var ${o} = __stx[${JSON.stringify(o)}];`).join(`
|
|
7
|
+
`),K=JSON.stringify(new Bun.CryptoHasher("md5").update(`${z}\x00${j}`).digest("hex").slice(0,12)),O=`;(function(){
|
|
8
|
+
var __bundles = window.__stxComposableBundles || (window.__stxComposableBundles = {});
|
|
9
|
+
if (__bundles[${K}]) return;
|
|
10
|
+
__bundles[${K}] = true;
|
|
11
|
+
var __published = window.__stxComposableGlobals || (window.__stxComposableGlobals = {});
|
|
12
|
+
window.__composables = window.__composables || {};
|
|
13
|
+
var __c = window.__composables;
|
|
14
|
+
var __stx = window.stx || {};
|
|
15
|
+
${q}
|
|
16
|
+
${j}
|
|
17
|
+
${Z}
|
|
18
|
+
var __names = ${z};
|
|
19
|
+
for (var __i = 0; __i < __names.length; __i++) {
|
|
20
|
+
var __n = __names[__i];
|
|
21
|
+
if (!(__n in __c) || __published[__n]) continue;
|
|
22
|
+
var __takenByBuiltin = !!(window.stx && __n in window.stx);
|
|
23
|
+
if (__takenByBuiltin || __n in window) {
|
|
24
|
+
console.warn('[stx] composable "' + __n + '" is not available as a bare identifier: '
|
|
25
|
+
+ (__takenByBuiltin ? 'a built-in of that name already exists' : 'window already defines that property')
|
|
26
|
+
+ '. Rename it, or use: import { ' + __n + ' } from "@composables"');
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
window[__n] = __c[__n];
|
|
30
|
+
__published[__n] = true;
|
|
31
|
+
}
|
|
32
|
+
})();`,G=E()?_n(O):O;return u=gt(i()),ce(v,N,u,G),B(),G}function th(){v.clear(),Fn(),I.clear(),F.clear(),R.clear()}
|
|
33
|
+
export{go,eh,th};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{ct,lt,ut}from"./chunk-g4k0svq6.js";import{Ht,Vt,at,zi,Ut,Wt}from"./chunk-0kq0k4pg.js";import o from"fs";import i from"path";var c=[];function m(a){c=[];for(let e of a.storyFiles)if(c.push({text:e.fileName.toLowerCase(),original:e.fileName,type:"story",storyId:e.id}),c.push({text:e.relativePath.toLowerCase(),original:e.relativePath,type:"story",storyId:e.id}),e.story)for(let t of e.story.variants)c.push({text:t.title.toLowerCase(),original:t.title,type:"story",storyId:e.id,variantId:t.id})}function f(){return JSON.stringify(c)}async function F(a={}){let e=Date.now();Ht();let t=await ct({mode:"build"});if(!t.config.enabled){at("Story feature is disabled in config.");return}let n=await Ut(t);lt(t,n);let l=Wt(t.config,n);ut(t,l),Vt(n.length);let d=a.outDir??t.config.outDir,s=i.resolve(t.root,d);await o.promises.mkdir(s,{recursive:!0}),console.log(` Building to ${d}...`);let g=v(t);await o.promises.writeFile(i.join(s,"index.html"),g);let y={files:n.map((r)=>({id:r.id,fileName:r.fileName,relativePath:r.relativePath,treePath:r.treePath})),tree:l};await o.promises.writeFile(i.join(s,"stories.json"),JSON.stringify(y,null,2));let u={theme:t.config.theme,responsivePresets:t.config.responsivePresets,backgroundPresets:t.config.backgroundPresets};await o.promises.writeFile(i.join(s,"config.json"),JSON.stringify(u,null,2));let p=i.join(s,"stories");await o.promises.mkdir(p,{recursive:!0});for(let r of n){let b=await o.promises.readFile(r.path,"utf-8");await o.promises.writeFile(i.join(p,`${r.id}.stx`),b)}m(t);let h=f();await o.promises.writeFile(i.join(s,"search-index.json"),h);let x=Date.now()-e;zi(n.length,d,x)}function v(a){let{theme:e}=a.config,t=e.title||"STX Story";return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{F,D,Ir,Or,Nr}from"./chunk-qpb80r4b.js";import{resolve as z,basename as j,extname as T,join as q}from"path";import{mkdir as k}from"fs/promises";var S={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0};class
|
|
2
|
+
import{F,D,Ir,Or,Nr}from"./chunk-qpb80r4b.js";import{resolve as z,basename as j,extname as T,join as q}from"path";import{mkdir as k}from"fs/promises";var S={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0};class Ri{config;constructor(e={}){this.config={...S,...e}}async get(e,s){return Ir(e,s,"image",this.config)}async set(e,s,r){return Or(e,s,r,"image",this.config)}async clear(){return Nr("image",this.config)}updateConfig(e){this.config={...this.config,...e}}}var w=null;function v(e){if(!w)w=new Ri(e);else if(e)w.updateConfig(e);return w}async function Ai(e,s,r){let t=r?{directory:`${r.outputDir}/../.cache`}:{};return v(t).get(e,s)}async function Pi(e,s,r,t){let a=t?{directory:`${t.outputDir}/../.cache`}:{};return v(a).set(e,s,r)}async function kg(){return v().clear()}async function x(){try{return await import("ts-images")}catch{return null}}function R(e){switch(e){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function E(e,s){let r=s?R(s):R("web"),t=e.formatQuality||{};return{jpeg:{...r.jpeg,...t.jpeg},png:{...r.png,...t.png},webp:{...r.webp,...t.webp},avif:{...r.avif,...t.avif}}}async function _g(e,s,r){let t=await x();if(!t)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:e,processed:!1};let a=await Ai(e,s,r);if(a)return a;try{let c=z(e);if(!await D(c))return{src:e,processed:!1,errors:[`Source file not found: ${e}`]};let n=E(r,s.preset),p=r.outputDir||"dist/images",I=r.baseUrl||"/images";await k(p,{recursive:!0});let d=await F(c),P=j(e,T(e)),b=s.outputFormat?[s.outputFormat]:r.defaultFormats||["avif","webp","jpeg"],o={src:e,processed:!0,variants:[],hash:d},u=null;if(s.transformations&&s.transformations.length>0)u=await yl(c,s.transformations,t);for(let i of b){let l=n[i]||{},g=`${P}-${d}.${i}`,h=q(p,g);try{let m=await t.optimizeImage({input:u||c,output:h,format:i,quality:l.quality,progressive:l.progressive});if(m){if(o.variants.push({path:h,url:`${I}/${g}`,width:m.width||0,height:m.height||0,format:i,size:m.outputSize||0}),!o.originalWidth&&m.width)o.originalWidth=m.width,o.originalHeight=m.height}}catch(m){o.errors=o.errors||[],o.errors.push(`Failed to optimize ${i}: ${m}`)}}if(s.embedThumbhash||s.placeholder==="thumbhash")try{let i=await t.generateThumbHash(c);o.placeholder=i.dataUrl}catch(i){o.errors=o.errors||[],o.errors.push(`Failed to generate thumbhash: ${i}`)}if(s.useDominantColor)try{let i=await t.generatePlaceholder(c,{strategy:"dominant-color"});o.dominantColor=i.dominantColor}catch(i){o.errors=o.errors||[],o.errors.push(`Failed to extract dominant color: ${i}`)}return await Pi(e,s,o,r),o}catch(c){return{src:e,processed:!1,errors:[`Processing failed: ${c}`]}}}async function Cg(e,s,r,t){let a=await x();if(!a)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await a.optimizeImage({input:e,output:t,format:s,quality:r}))?.outputSize}}catch(c){return{success:!1,error:String(c)}}}async function yl(e,s,r){let t=r||await x();if(!t)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let a=await t.decode(e);for(let c of s){let n=c.options||{};switch(c.type){case"resize":if(n.width||n.height)a=await t.resize(a,{width:n.width,height:n.height,fit:n.fit});break;case"blur":if(n.sigma!==void 0)a=await t.blur(a,n.sigma);break;case"sharpen":if(n.amount!==void 0)a=await t.sharpen(a,n.amount);break;case"grayscale":a=await t.grayscale(a);break;case"rotate":if(n.angle!==void 0)a=await t.rotate(a,n.angle);break;case"flip":a=await t.flip(a);break;case"flop":a=await t.flop(a);break;case"brightness":if(n.value!==void 0)a=await t.brightness(a,n.value);break;case"contrast":if(n.value!==void 0)a=await t.contrast(a,n.value);break;case"saturation":if(n.value!==void 0)a=await t.saturation(a,n.value);break}}return await t.encode(a,"png")}catch(a){return console.error(`[stx-media] Transformation failed: ${a}`),null}}import{resolve as Q,basename as U,extname as V,join as L}from"path";import{mkdir as H}from"fs/promises";async function O(){try{return await import("ts-images")}catch{return null}}var A=[320,480,640,768,1024,1280,1536,1920];async function Eg(e,s,r){let t=await O();if(!t)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let a=Q(e);if(!await D(a))return console.warn(`[stx-media] Source file not found: ${e}`),null;try{let c=s.responsiveWidths||r.breakpoints||A,n=s.formats||r.defaultFormats||["avif","webp","jpeg"],p=r.outputDir||"dist/images",I=r.baseUrl||"/images";await H(p,{recursive:!0});let d=await F(a),P=U(e,V(e)),b=r.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},o={src:e,byFormat:{},srcsets:{}};for(let i of n){o.byFormat[i]=[];let l=[];for(let g of c){let h=`${P}-${g}w-${d}.${i}`,m=L(p,h),y=`${I}/${h}`;try{let C=b[i]?.quality||80;if(await D(m)){o.byFormat[i].push({path:m,url:y,width:g,height:0,format:i,size:0}),l.push(`${y} ${g}w`);continue}let f=await t.processImage({input:a,output:m,format:i,quality:C,resize:{width:g}});if(f)o.byFormat[i].push({path:m,url:y,width:g,height:f.height||Math.round(g*(f.height||1)/(f.width||1)),format:i,size:f.outputSize||0}),l.push(`${y} ${g}w`)}catch(C){console.warn(`[stx-media] Failed to generate ${i} at ${g}w: ${C}`)}}o.srcsets[i]=l.join(", ")}let u=s.placeholder||r.placeholderStrategy||"thumbhash";if(u!=="none")try{if(u==="thumbhash"){let i=await t.generateThumbHash(a);o.placeholder={dataURL:i.dataUrl,width:i.width||32,height:i.height||32,strategy:"thumbhash"}}else{let i=await t.generatePlaceholder(a,{strategy:u,width:20});o.placeholder={dataURL:i.dataURL,width:i.width,height:i.height,strategy:u}}}catch(i){console.warn(`[stx-media] Failed to generate placeholder: ${i}`)}return o.sizes=s.sizes||B(c),o}catch(c){return console.error(`[stx-media] Responsive generation failed: ${c}`),null}}function B(e){let s=[...e].sort((t,a)=>t-a),r=[];for(let t=0;t<s.length-1;t++){let a=s[t];r.push(`(max-width: ${a}px) ${a}px`)}return r.push(`${s[s.length-1]}px`),r.join(", ")}function Tg(e,s="width"){if(!e||e.length===0)return"";if(s==="dpr")return e.filter((r)=>r.dpr).map((r)=>`${r.url} ${r.dpr}x`).join(", ");return e.map((r)=>`${r.url} ${r.width}w`).join(", ")}export{Ri,Ai,Pi,kg,_g,Cg,yl,Eg,Tg};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Gg,Xg,Jg,Yg,Nl,Zg,Qg,em,tm,nm,rm,sm}from"./chunk-tshpcvcy.js";export{rm as Broadcast,sm as BroadcastServer,Nl as broadcast,tm as broadcastPresence,em as broadcastPrivate,nm as channel,Gg as getBroadcastServer,Yg as loadChannels,Xg as startBroadcasting,Jg as stopBroadcasting,Zg as toUser,Qg as toUsers};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{existsSync as A,mkdtempSync as D,readdirSync as M,rmSync as b,statSync as g,writeFileSync as k}from"fs";import{constants as P,tmpdir as x}from"os";import{join as s}from"path";import t from"process";var _=/^stx-(?:.+-)?p(\d+)-\w{6}$/,v=".stx-keep",I=60000,N=["SIGINT","SIGTERM","SIGHUP"],i=new Set,y=new Set,c=!1,S=new Set;function p(e){try{b(e,{recursive:!0,force:!0})}catch{}}function R(){for(let e of i)p(e);i.clear(),f()}function E(){for(let e of i)p(e);i.clear()}function C(e){if(R(),t.listenerCount(e)===0)t.exit(128+(P.signals[e]??1))}var h=new Map(N.map((e)=>[e,()=>C(e)]));function G(){if(c)return;c=!0,t.on("exit",E);for(let[e,n]of h)try{t.on(e,n)}catch{}}function f(){if(!c)return;c=!1,t.off("exit",E);for(let[e,n]of h)t.off(e,n)}function K(e){try{return t.kill(e,0),!0}catch(n){return n.code==="EPERM"}}function O(e={}){let n=e.root??x(),r=e.isAlive??K,w=e.minAgeMs??I,T=e.now??Date.now(),a=[],u;try{u=M(n)}catch{return a}for(let d of u){let l=_.exec(d);if(!l)continue;let m=Number(l[1]);if(m===t.pid||r(m))continue;let o=s(n,d);try{if(!g(o).isDirectory())continue;if(T-g(o).mtimeMs<w)continue;if(A(s(o,v)))continue}catch{continue}p(o),a.push(o)}return a}function L(e){let n=e.replace(/^stx-/,"").replace(/-+$/,"");return n?`stx-${n}-p${t.pid}-`:`stx-p${t.pid}-`}function z(e=t.env){let n=e.STX_KEEP_TEMP?.trim().toLowerCase();return!!n&&n!=="0"&&n!=="false"}function
|
|
3
|
-
`)}catch{}if(y.add(e),i.delete(e),i.size===0)f()}async function
|
|
4
|
-
export{
|
|
2
|
+
import{existsSync as A,mkdtempSync as D,readdirSync as M,rmSync as b,statSync as g,writeFileSync as k}from"fs";import{constants as P,tmpdir as x}from"os";import{join as s}from"path";import t from"process";var _=/^stx-(?:.+-)?p(\d+)-\w{6}$/,v=".stx-keep",I=60000,N=["SIGINT","SIGTERM","SIGHUP"],i=new Set,y=new Set,c=!1,S=new Set;function p(e){try{b(e,{recursive:!0,force:!0})}catch{}}function R(){for(let e of i)p(e);i.clear(),f()}function E(){for(let e of i)p(e);i.clear()}function C(e){if(R(),t.listenerCount(e)===0)t.exit(128+(P.signals[e]??1))}var h=new Map(N.map((e)=>[e,()=>C(e)]));function G(){if(c)return;c=!0,t.on("exit",E);for(let[e,n]of h)try{t.on(e,n)}catch{}}function f(){if(!c)return;c=!1,t.off("exit",E);for(let[e,n]of h)t.off(e,n)}function K(e){try{return t.kill(e,0),!0}catch(n){return n.code==="EPERM"}}function O(e={}){let n=e.root??x(),r=e.isAlive??K,w=e.minAgeMs??I,T=e.now??Date.now(),a=[],u;try{u=M(n)}catch{return a}for(let d of u){let l=_.exec(d);if(!l)continue;let m=Number(l[1]);if(m===t.pid||r(m))continue;let o=s(n,d);try{if(!g(o).isDirectory())continue;if(T-g(o).mtimeMs<w)continue;if(A(s(o,v)))continue}catch{continue}p(o),a.push(o)}return a}function L(e){let n=e.replace(/^stx-/,"").replace(/-+$/,"");return n?`stx-${n}-p${t.pid}-`:`stx-p${t.pid}-`}function z(e=t.env){let n=e.STX_KEEP_TEMP?.trim().toLowerCase();return!!n&&n!=="0"&&n!=="false"}function qe(e="stx",n=x()){if(!S.has(n))S.add(n),O({root:n});let r=D(s(n,L(e)));if(z())return H(r),console.warn(`[stx] STX_KEEP_TEMP: keeping ${r}`),r;return G(),i.add(r),r}function re(e){if(y.has(e))return;if(p(e),i.delete(e),i.size===0)f()}function H(e){try{k(s(e,v),`kept by pid ${t.pid}
|
|
3
|
+
`)}catch{}if(y.add(e),i.delete(e),i.size===0)f()}async function Wa(e,n){let r=qe(e);try{return await n(r)}finally{re(r)}}
|
|
4
|
+
export{qe,re,Wa};
|