@stacksjs/stx 0.2.679 → 0.2.682
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-01ks1244.js +2 -0
- package/dist/{chunk-qr7a378v.js → chunk-03xn8244.js} +3 -3
- package/dist/{chunk-ccmc5rqj.js → chunk-0527ytat.js} +2 -2
- package/dist/chunk-0gmwqhs0.js +2 -0
- package/dist/chunk-18jfkg1q.js +2 -0
- package/dist/chunk-1gw26g89.js +31 -0
- package/dist/chunk-1t6dg4s8.js +2 -0
- package/dist/{chunk-n8wvqnfc.js → chunk-1y50gat7.js} +2 -2
- package/dist/chunk-23efje42.js +2 -0
- package/dist/chunk-247fg189.js +2 -0
- package/dist/{chunk-xnx06qqt.js → chunk-2a1eeywj.js} +2 -2
- package/dist/{chunk-hh58k0nh.js → chunk-2ajbhefk.js} +2 -2
- package/dist/{chunk-p9az13b2.js → chunk-2ar5g9pa.js} +2 -2
- package/dist/{chunk-7j7h1eg3.js → chunk-2hh6g3y1.js} +1 -1
- package/dist/chunk-2zepd4ps.js +2 -0
- package/dist/chunk-34ps2w1z.js +2 -0
- package/dist/chunk-3tkag58v.js +2 -0
- package/dist/{chunk-ga5kjf9b.js → chunk-3zbege39.js} +6 -6
- package/dist/{chunk-2933mvwr.js → chunk-42qtadka.js} +10 -10
- package/dist/chunk-47fwr1z7.js +2 -0
- package/dist/{chunk-fzc98qgn.js → chunk-49c5v5fh.js} +6 -6
- package/dist/chunk-4g9wrxkm.js +2 -0
- package/dist/chunk-4m5g3f2b.js +2 -0
- package/dist/{chunk-tx4wfk5v.js → chunk-4z4sqc8q.js} +5 -5
- package/dist/{chunk-6ycyaf5g.js → chunk-58dv14c3.js} +2 -2
- package/dist/{chunk-87em5xdg.js → chunk-5nfb4gxk.js} +82 -82
- package/dist/chunk-5nrqc6v4.js +20 -0
- package/dist/chunk-5rdfcpfe.js +2 -0
- package/dist/{chunk-xyk2zxkk.js → chunk-65jb75vz.js} +2 -2
- package/dist/{chunk-5z8mq37c.js → chunk-6e60jp4a.js} +4 -4
- package/dist/chunk-7jxj6cv1.js +2 -0
- package/dist/{chunk-dnjbzwwn.js → chunk-7yree929.js} +1 -1
- package/dist/chunk-8bwa63m3.js +2 -0
- package/dist/chunk-8d0rqqyx.js +2 -0
- package/dist/chunk-8j0zcyd7.js +2 -0
- package/dist/chunk-8jxqg7kb.js +2 -0
- package/dist/chunk-8nk56cs2.js +2 -0
- package/dist/chunk-8y7tpjfs.js +2 -0
- package/dist/{chunk-q3gactm1.js → chunk-912r15hr.js} +4 -4
- package/dist/chunk-96hkch4q.js +2 -0
- package/dist/{chunk-4fhbh04h.js → chunk-974prn41.js} +4 -4
- package/dist/{chunk-078qg8r5.js → chunk-9bgb9n12.js} +2 -2
- package/dist/chunk-9qx6ansy.js +2 -0
- package/dist/{chunk-tst8p27s.js → chunk-9tg4995v.js} +3 -3
- package/dist/{chunk-sr3hmrah.js → chunk-9wa3t87n.js} +1 -1
- package/dist/{chunk-k06n5bjp.js → chunk-ae12wgc5.js} +3 -3
- package/dist/chunk-b375wt1n.js +2 -0
- package/dist/chunk-b5vqp3b2.js +2 -0
- package/dist/{chunk-vg1pg6yt.js → chunk-b7z6rqfg.js} +1 -1
- package/dist/{chunk-wt7rp7wc.js → chunk-bmqker64.js} +6 -6
- package/dist/{chunk-53e9ta3g.js → chunk-bmv6spcd.js} +4 -4
- package/dist/chunk-bpf3xxng.js +3 -0
- package/dist/{chunk-chy90834.js → chunk-brcj3953.js} +5 -5
- package/dist/chunk-brftzqzj.js +3 -0
- package/dist/chunk-bv43s0gx.js +2 -0
- package/dist/chunk-c9jnkbdb.js +2 -0
- package/dist/{chunk-x7wr720m.js → chunk-d1ssvg9k.js} +5 -5
- package/dist/{chunk-5z0q3qv3.js → chunk-d7js6v1m.js} +5 -5
- package/dist/{chunk-vd5w1jaz.js → chunk-drabexxq.js} +3 -3
- package/dist/{chunk-k72jqz6a.js → chunk-e26pxzjj.js} +2 -2
- package/dist/{chunk-2pvcp0y6.js → chunk-e97xj3rf.js} +6 -6
- package/dist/chunk-ev1tnd36.js +2 -0
- package/dist/{chunk-j388n7v2.js → chunk-f1hxrs7b.js} +17 -17
- package/dist/{chunk-wr1gm35v.js → chunk-f4z9w4kc.js} +1 -1
- package/dist/chunk-f80aqbwm.js +2 -0
- package/dist/chunk-fbbp8j97.js +2 -0
- package/dist/{chunk-26ps9djm.js → chunk-fqts9wvd.js} +5 -5
- package/dist/chunk-fy1waxy0.js +2 -0
- package/dist/chunk-g2v6c7kf.js +2 -0
- package/dist/chunk-g5ep75vp.js +2 -0
- package/dist/{chunk-wejabf6y.js → chunk-g83qeh2x.js} +5 -5
- package/dist/chunk-g9a56wwk.js +2 -0
- package/dist/chunk-gkmh0xys.js +2 -0
- package/dist/{chunk-78yjmbbs.js → chunk-gtktv6nn.js} +2 -2
- package/dist/{chunk-f26n6y9p.js → chunk-gymmbbzc.js} +4 -4
- package/dist/{chunk-48ma0qcr.js → chunk-h3bdqqzy.js} +2 -2
- package/dist/chunk-h5r4c9v5.js +2 -0
- package/dist/{chunk-3xyv2fec.js → chunk-hg7ys8rn.js} +3 -3
- package/dist/{chunk-kxj8e1gd.js → chunk-hm69jxmh.js} +6 -6
- package/dist/{chunk-y4ncmvf2.js → chunk-hwaqwrc2.js} +3 -3
- package/dist/chunk-jecmxby7.js +2 -0
- package/dist/{chunk-a2zb5fgg.js → chunk-jkywbfb0.js} +2 -2
- package/dist/{chunk-haz2ezyk.js → chunk-k3e0hcv7.js} +2 -2
- package/dist/{chunk-drmgwjnb.js → chunk-ka3xmbrd.js} +76 -76
- package/dist/chunk-kerxevf9.js +2 -0
- package/dist/chunk-km37yrk4.js +43 -0
- package/dist/chunk-mdmwgthz.js +2 -0
- package/dist/chunk-myc60z74.js +2 -0
- package/dist/chunk-mzkyw4yx.js +2 -0
- package/dist/{chunk-nb3kkvet.js → chunk-n8jq9yjy.js} +11 -11
- package/dist/{chunk-y34tyrpb.js → chunk-nbjyed3q.js} +7 -7
- package/dist/{chunk-d40zjm6k.js → chunk-np3zdjhr.js} +6 -6
- package/dist/{chunk-wav0xbnb.js → chunk-pfn70zdr.js} +2 -2
- package/dist/{chunk-tbb4en1q.js → chunk-pmma4f1x.js} +4 -4
- package/dist/chunk-pqg3ghvh.js +2 -0
- package/dist/chunk-pvn0fc7j.js +2 -0
- package/dist/{chunk-q4rejyd2.js → chunk-pzxy40a2.js} +2 -2
- package/dist/chunk-q7mpearc.js +2 -0
- package/dist/{chunk-7z7zp8xq.js → chunk-qb806pks.js} +5 -5
- package/dist/{chunk-wscnjtss.js → chunk-qh7fvr2z.js} +2 -2
- package/dist/chunk-r8hszntk.js +2 -0
- package/dist/{chunk-wc5tt6da.js → chunk-remsyfdx.js} +2 -2
- package/dist/chunk-rk8kmshp.js +2 -0
- package/dist/chunk-rs67af2x.js +1592 -0
- package/dist/{chunk-97h9ga3b.js → chunk-rspe6qa5.js} +3 -3
- package/dist/{chunk-78x52gz3.js → chunk-ry501z40.js} +5 -5
- package/dist/chunk-s0wa7zjr.js +2 -0
- package/dist/{chunk-qvefcnyb.js → chunk-se4n8tth.js} +2 -2
- package/dist/chunk-sncp7jhv.js +2 -0
- package/dist/{chunk-jv021x8e.js → chunk-sq4w1e1g.js} +2 -2
- package/dist/chunk-sqvdrk81.js +2 -0
- package/dist/{chunk-9wdd7eq6.js → chunk-t6m5d64b.js} +2 -2
- package/dist/chunk-tdwqwxhf.js +25 -0
- package/dist/{chunk-dera8fmc.js → chunk-tenbwcts.js} +2 -2
- package/dist/chunk-th45zgbz.js +54 -0
- package/dist/{chunk-cxgremn0.js → chunk-tpdvgb3d.js} +1 -1
- package/dist/chunk-tq2m6m3j.js +2 -0
- package/dist/{chunk-aw3jfdca.js → chunk-veh25cv5.js} +1 -1
- package/dist/chunk-vqv5w6gs.js +2 -0
- package/dist/chunk-vt5e25xg.js +2 -0
- package/dist/{chunk-028e9fty.js → chunk-vxnf3xab.js} +2 -2
- package/dist/{chunk-mabja59q.js → chunk-vxrhvrr9.js} +2 -2
- package/dist/{chunk-tmqrbs98.js → chunk-w1wzydvp.js} +8 -5
- package/dist/{chunk-qwdcts9w.js → chunk-w28wc7mv.js} +13 -13
- package/dist/{chunk-yxw8gbnh.js → chunk-wfg5379k.js} +4 -4
- package/dist/chunk-wvz7rp5p.js +2 -0
- package/dist/{chunk-k4x8v39k.js → chunk-xfdfk4g4.js} +2 -2
- package/dist/chunk-xjx1xbey.js +2 -0
- package/dist/{chunk-mn47s2ef.js → chunk-xr9a0hcr.js} +5 -5
- package/dist/{chunk-1b9thkg5.js → chunk-xvnrm5c3.js} +2 -2
- package/dist/{chunk-mf19qxgv.js → chunk-xvs84gas.js} +2 -2
- package/dist/{chunk-8aq07a1j.js → chunk-y55pcfaj.js} +3 -3
- package/dist/{chunk-2hmyj5wh.js → chunk-yhfm939b.js} +2 -2
- package/dist/chunk-ykjzhfyf.js +2 -0
- package/dist/chunk-ypwetty7.js +21 -0
- package/dist/chunk-z4khbpx0.js +2 -0
- package/dist/{chunk-9rs12v0r.js → chunk-z5av310q.js} +9 -9
- package/dist/chunk-zr16mga0.js +2 -0
- package/dist/{chunk-dxh45gve.js → chunk-zt5hp5w5.js} +1 -1
- package/dist/chunk-zwawqx5q.js +2 -0
- package/dist/cli.js +20 -20
- package/dist/client/signals-manifest-hydration-runtime.js +4 -1
- package/dist/component-client-factories.js +14 -3
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/dev-server/serve-app.js +10 -1
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +6 -6
- package/dist/utils.js +13 -1
- package/package.json +5 -5
- package/dist/chunk-0fjwqs9h.js +0 -2
- package/dist/chunk-0gk78x3r.js +0 -2
- package/dist/chunk-0v35wpm7.js +0 -2
- package/dist/chunk-1dkcakve.js +0 -25
- package/dist/chunk-1gg5vxe8.js +0 -2
- package/dist/chunk-1j0sarne.js +0 -21
- package/dist/chunk-248a88mc.js +0 -2
- package/dist/chunk-2nqtmp8c.js +0 -2
- package/dist/chunk-2yzwrvq1.js +0 -2
- package/dist/chunk-3bfegbpw.js +0 -2
- package/dist/chunk-3wsm9g9c.js +0 -2
- package/dist/chunk-3xx9d934.js +0 -2
- package/dist/chunk-52x079ax.js +0 -2
- package/dist/chunk-54zkkxmb.js +0 -2
- package/dist/chunk-5fmxn52y.js +0 -2
- package/dist/chunk-61ww9d2z.js +0 -2
- package/dist/chunk-75zc8w68.js +0 -2
- package/dist/chunk-7b3phzx4.js +0 -2
- package/dist/chunk-8p92r2sc.js +0 -2
- package/dist/chunk-8xr8y9sq.js +0 -2
- package/dist/chunk-909ymsjz.js +0 -2
- package/dist/chunk-ac75vk0w.js +0 -2
- package/dist/chunk-arh1qgmp.js +0 -2
- package/dist/chunk-b0th3d8q.js +0 -888
- package/dist/chunk-bh19ezq0.js +0 -43
- package/dist/chunk-bm42rsaa.js +0 -2
- package/dist/chunk-cfm6a679.js +0 -2
- package/dist/chunk-cwmazy7y.js +0 -2
- package/dist/chunk-e492je6q.js +0 -2
- package/dist/chunk-ft1ht0b3.js +0 -2
- package/dist/chunk-ft3f9nj0.js +0 -2
- package/dist/chunk-ggwvnpwj.js +0 -2
- package/dist/chunk-gx6wxmbv.js +0 -2
- package/dist/chunk-hamk3dky.js +0 -2
- package/dist/chunk-hqj28381.js +0 -3
- package/dist/chunk-k093pr2w.js +0 -2
- package/dist/chunk-kcp392wy.js +0 -2
- package/dist/chunk-kejrhccx.js +0 -2
- package/dist/chunk-kmj127rm.js +0 -2
- package/dist/chunk-kqbpkg8n.js +0 -2
- package/dist/chunk-m0f3strn.js +0 -2
- package/dist/chunk-mjsebtg6.js +0 -2
- package/dist/chunk-n8f0zw1y.js +0 -31
- package/dist/chunk-nadgej53.js +0 -2
- package/dist/chunk-nh3kd03f.js +0 -2
- package/dist/chunk-nw2zh40z.js +0 -2
- package/dist/chunk-p01b07se.js +0 -54
- package/dist/chunk-p99an8rj.js +0 -2
- package/dist/chunk-pgvwysxq.js +0 -2
- package/dist/chunk-pz3mg7hr.js +0 -2
- package/dist/chunk-qyf3jcy1.js +0 -2
- package/dist/chunk-rc79yyqx.js +0 -2
- package/dist/chunk-s8qe247r.js +0 -2
- package/dist/chunk-sswy3tfc.js +0 -2
- package/dist/chunk-swxznm5v.js +0 -2
- package/dist/chunk-t3gmm1ja.js +0 -2
- package/dist/chunk-tsrf4zzy.js +0 -2
- package/dist/chunk-tz09earb.js +0 -2
- package/dist/chunk-vct8a1qf.js +0 -20
- package/dist/chunk-x4q4bx3q.js +0 -3
- package/dist/chunk-xna6b7km.js +0 -2
- package/dist/chunk-xw4rm5zj.js +0 -2
- package/dist/chunk-yar7fwrb.js +0 -2
- package/dist/chunk-yt33wzqk.js +0 -2
- package/dist/chunk-zcbp27x1.js +0 -2
- package/dist/chunk-zq7xbc1k.js +0 -2
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Z,Q,ee,Tn,ge,Ce,dt,Wt,$n,Rn,An,te,Pn,In}from"./chunk-brftzqzj.js";import{bt}from"./chunk-3hxd5td3.js";function $c(s,r={}){let{src:e,alt:t,width:n,height:a,sizes:i="100vw",loading:m="lazy",priority:o=!1,quality:u=ee,placeholder:l="none",formats:f=Q,widths:y=Z,decoding:c="async",fetchpriority:h,objectFit:d,objectPosition:g}=s,{class:p,style:v}=s,{processedImage:w,variants:I,optimize:b=!0,isDev:A=!1}=r;if(I&&I.length>0)return K(s,I,w);if(A||!b)return G(s);return X(s)}function K(s,r,e){let{src:t,alt:n,width:a,height:i,sizes:m="100vw",loading:o="lazy",priority:u=!1,decoding:l="async",fetchpriority:f,objectFit:y,objectPosition:c,placeholder:h="none"}=s,{class:d,style:g}=s,p=Rn(r),v=$n(r),w=typeof m==="object"?Wt(m):m,I=e?e.aspectRatio:a&&i?Number(a)/Number(i):void 0,b=[];if(I)b.push(`aspect-ratio: ${I}`);if(y)b.push(`object-fit: ${y}`);if(c)b.push(`object-position: ${c}`);if(g)b.push(g);let A=b.length>0?` style="${b.join("; ")}"`:"",S=d?` class="${d}"`:"",F=u?"":` loading="${o}"`,R=` decoding="${l}"`,C=f?` fetchpriority="${f}"`:u?' fetchpriority="high"':"",E=["avif","webp","jpeg","png"],M=[];for(let k of E){let z=p.get(k);if(z&&z.length>0){let O=dt(z),J=te(k);M.push(` <source type="${J}" srcset="${O}" sizes="${w}" />`)}}let U="",L="",T;if(h!=="none"&&e?.placeholder){let k=`img-${Math.random().toString(36).slice(2,8)}`;if(U=`<div class="stx-image-wrapper" id="${k}">`,L="</div>",h==="blur")T=`
|
|
3
|
+
#${k} {
|
|
4
|
+
position: relative;
|
|
5
|
+
background-image: url('${e.placeholder}');
|
|
6
|
+
background-size: cover;
|
|
7
|
+
background-position: center;
|
|
8
|
+
}
|
|
9
|
+
#${k} img {
|
|
10
|
+
transition: opacity 0.3s ease;
|
|
11
|
+
}
|
|
12
|
+
#${k}.loaded img {
|
|
13
|
+
opacity: 1;
|
|
14
|
+
}
|
|
15
|
+
`.trim();else if(h==="color")T=`
|
|
16
|
+
#${k} {
|
|
17
|
+
background-color: ${e.placeholder};
|
|
18
|
+
}
|
|
19
|
+
`.trim()}let _=a?` width="${a}"`:e?` width="${e.width}"`:"",H=i?` height="${i}"`:e?` height="${e.height}"`:"",Y=`${U}<picture>
|
|
20
|
+
${M.join(`
|
|
21
|
+
`)}
|
|
22
|
+
<img
|
|
23
|
+
src="${v?.url||t}"
|
|
24
|
+
alt="${B(n)}"${_}${H}${S}${A}${F}${R}${C}
|
|
25
|
+
/>
|
|
26
|
+
</picture>${L}`,V;if(u&&v){let k=p.get("webp"),z=k?.[Math.floor(k.length/2)]||v,O=te(z.format);V=`<link rel="preload" as="image" href="${z.url}" type="${O}" />`}return{html:Y,preloadLink:V,placeholderCss:T}}function G(s){let{src:r,alt:e,width:t,height:n,loading:a="lazy",decoding:i="async",priority:m=!1,fetchpriority:o,objectFit:u,objectPosition:l}=s,{class:f,style:y}=s,c=[];if(u)c.push(`object-fit: ${u}`);if(l)c.push(`object-position: ${l}`);if(y)c.push(y);let h=c.length>0?` style="${c.join("; ")}"`:"",d=f?` class="${f}"`:"",g=t?` width="${t}"`:"",p=n?` height="${n}"`:"",v=m?"":` loading="${a}"`,w=` decoding="${i}"`,I=o?` fetchpriority="${o}"`:m?' fetchpriority="high"':"";return{html:`<img src="${r}" alt="${B(e)}"${g}${p}${d}${h}${v}${w}${I} />`}}function X(s){let{src:r,alt:e,width:t,height:n,sizes:a="100vw",loading:i="lazy",priority:m=!1,quality:o=ee,formats:u=Q,widths:l=Z,decoding:f="async",fetchpriority:y,objectFit:c,objectPosition:h}=s,{class:d,style:g}=s,p=[];if(c)p.push(`object-fit: ${c}`);if(h)p.push(`object-position: ${h}`);if(g)p.push(g);let v=p.length>0?` style="${p.join("; ")}"`:"",w=d?` class="${d}"`:"",I=t?` width="${t}"`:"",b=n?` height="${n}"`:"",A=m?"":` loading="${i}"`,S=` decoding="${f}"`,F=y?` fetchpriority="${y}"`:m?' fetchpriority="high"':"",R=typeof a==="object"?Wt(a):a,C=`
|
|
27
|
+
data-stx-image
|
|
28
|
+
data-src="${r}"
|
|
29
|
+
data-sizes="${R}"
|
|
30
|
+
data-quality="${o}"
|
|
31
|
+
data-formats="${u.join(",")}"
|
|
32
|
+
data-widths="${l.join(",")}"
|
|
33
|
+
`.replace(/\s+/g," ").trim();return{html:`<img src="${r}" alt="${B(e)}"${I}${b}${w}${v}${A}${S}${F} ${C} />`}}function Ci(s){let r=s.match(/<Image\s+([^>]*?)\/?>/);if(!r)return null;let e=r[1],t={},n=/(\w+)(?:=(?:"([^"]*)"|'([^']*)'|(\{[^}]+\})))?/g,a;while((a=n.exec(e))!==null){let[,i,m,o,u]=a,l=m??o??u??!0;switch(i){case"src":t.src=String(l);break;case"alt":t.alt=String(l);break;case"width":t.width=Number(l)||l;break;case"height":t.height=Number(l)||l;break;case"sizes":t.sizes=String(l);break;case"loading":t.loading=l;break;case"priority":t.priority=l===!0||l==="true";break;case"quality":t.quality=Number(l);break;case"placeholder":t.placeholder=l;break;case"class":t.class=String(l);break;case"style":t.style=String(l);break;case"decoding":t.decoding=l;break;case"fetchpriority":t.fetchpriority=l;break;case"objectFit":t.objectFit=l;break;case"objectPosition":t.objectPosition=String(l);break}}if(!t.src||!t.alt)return null;return t}async function Rc(s,r){let e=/<Image\s+[^>]*?\/?>/g,t=[],n=[],a=s,i,m=[];while((i=e.exec(s))!==null)m.push({match:i[0],index:i.index});for(let o=m.length-1;o>=0;o--){let{match:u}=m[o],l=Ci(u);if(l){let f=await r(l);if(a=a.replace(u,f.html),f.preloadLink)t.push(f.preloadLink);if(f.placeholderCss)n.push(f.placeholderCss)}}return{html:a,preloadLinks:t,styles:n}}function B(s){return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var D=new Map;function Ac(){D.clear()}async function se(s,r){let e=`${s}:${JSON.stringify(r)}`;if(D.has(e))return D.get(e);try{let t=await Ce(s,r);return D.set(e,t),t}catch{return null}}function Ei(){return bt({name:"image",hasEndTag:!1,description:"Render an optimized image with responsive variants",transform:async(s,r,e)=>{let{src:t,alt:n,options:a}=re(s,r,e);if(!t)return console.warn("@image directive: missing src argument"),"<!-- @image: missing src -->";let i={widths:a.widths||(a.width?[a.width]:Z),formats:a.formats||Q,quality:a.quality||ee,placeholder:(a.placeholder==="color"?"dominant-color":a.placeholder)||"none"};if(!await ge())return q(t,n||"",a);let o=await se(t,i);if(!o)return q(t,n||"",a);return ie(o,n||"",a)}})}function re(s,r,e){if(r.src)return{src:String(r.src),alt:String(r.alt||""),options:r.options||{}};let n=s.trim();if(n.startsWith("@image(")||n.startsWith("("))n=n.replace(/^@image\(/,"").replace(/^\(/,"").replace(/\)$/,"");let a=ae(n),i=a[0]||"",m=a[1]||"",o={};if(i&&!i.startsWith("/")&&!i.startsWith(".")&&!i.startsWith("http")){let u=e[i];if(typeof u==="string")i=u}if(a[2])try{if(typeof a[2]==="string")o=JSON.parse(a[2]);else o=a[2]}catch{}return{src:i,alt:m,options:o}}function ae(s){let r=[],e="",t=!1,n="",a=0,i=0;for(let m=0;m<s.length;m++){let o=s[m],u=m>0?s[m-1]:"";if((o==='"'||o==="'")&&u!=="\\"){if(!t)t=!0,n=o;else if(o===n)t=!1,n="";else e+=o;continue}if(!t){if(o==="{")a++;if(o==="}")a--;if(o==="[")i++;if(o==="]")i--;if(o===","&&a===0&&i===0){r.push(e.trim()),e="";continue}}e+=o}if(e.trim())r.push(e.trim());return r}function q(s,r,e){let t=[`src="${x(s)}"`];if(r)t.push(`alt="${x(r)}"`);if(e.width)t.push(`width="${e.width}"`);if(e.height)t.push(`height="${e.height}"`);if(e.class)t.push(`class="${x(e.class)}"`);if(e.style)t.push(`style="${x(e.style)}"`);if(e.lazy!==!1)t.push('loading="lazy"');return t.push('decoding="async"'),`<img ${t.join(" ")} />`}function ie(s,r,e){let{variants:t,placeholder:n,width:a,height:i,aspectRatio:m}=s,o=new Map;for(let g of t){let p=o.get(g.format)||[];p.push(g),o.set(g.format,p)}let u=["avif","webp","jpeg","png"],l=[];for(let g of u){let p=o.get(g);if(p&&p.length>0){let v=dt(p),w=te(g),I=e.sizes||"100vw";l.push(` <source type="${w}" srcset="${x(v)}" sizes="${x(I)}" />`)}}let f=o.get("jpeg")||[],y=f.length>0?f[Math.floor(f.length/2)]:t[Math.floor(t.length/2)],c=[`src="${y?.url||s.src}"`,`alt="${x(r)}"`];if(e.width||a)c.push(`width="${e.width||a}"`);if(e.height||i)c.push(`height="${e.height||i}"`);if(e.class)c.push(`class="${x(e.class)}"`);let h=[];if(m)h.push(`aspect-ratio: ${m.toFixed(4)}`);if(e.style)h.push(e.style);if(h.length>0)c.push(`style="${h.join("; ")}"`);if(e.lazy!==!1&&!e.priority)c.push('loading="lazy"');if(c.push('decoding="async"'),e.priority)c.push('fetchpriority="high"');let d=`<picture>
|
|
34
|
+
`;if(d+=l.join(`
|
|
35
|
+
`)+`
|
|
36
|
+
`,d+=` <img ${c.join(" ")} />
|
|
37
|
+
`,d+="</picture>",e.placeholder&&n){let g=`stx-img-${Math.random().toString(36).slice(2,8)}`;if(e.placeholder==="blur"||e.placeholder==="thumbhash"){let p=n.replace(/'/g,"%27").replace(/"/g,"%22");d=`<div id="${g}" class="stx-image-placeholder" style="background-image: url('${p}'); background-size: cover;">
|
|
38
|
+
${d}
|
|
39
|
+
</div>`}else if(e.placeholder==="color"){let p=n.replace(/[^a-zA-Z0-9#(),.\s%-]/g,"");d=`<div id="${g}" class="stx-image-placeholder" style="background-color: ${p};">
|
|
40
|
+
${d}
|
|
41
|
+
</div>`}}if(e.priority&&y){let g=te(y.format);d=`<link rel="preload" as="image" href="${x(y.url)}" type="${g}" />
|
|
42
|
+
`+d}return d}function x(s){return s.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var Pc=Ei();import P from"fs";import j from"path";function Ic(s={}){let{inputDirs:r=["public","src/assets","assets"],outputDir:e="dist/images",baseUrl:t="/images",formats:n=Q,widths:a=Z,quality:i=ee,placeholder:m="none",concurrency:o=4,cache:u=!0,cacheDir:l=".stx/image-cache",referencedOnly:f=!1,verbose:y=!1}=s,c={imageReferences:new Set,processedImages:new Map,stats:{totalImages:0,optimizedImages:0,savedBytes:0,variants:0}};return{name:"stx-image-optimization",async setup(h){if(!await ge()){console.warn("[stx-images] no image backend available, optimization disabled");return}if(u)await P.promises.mkdir(l,{recursive:!0});if(y){let g=await Tn();console.log("[stx-images] Plugin initialized"),console.log(` Backend: ${g?"sharp (native fast path) + ts-images":"ts-images (pure TS)"}`),console.log(` Input dirs: ${r.join(", ")}`),console.log(` Output dir: ${e}`),console.log(` Formats: ${n.join(", ")}`),console.log(` Widths: ${a.join(", ")}`)}},async buildStart(){c.imageReferences.clear(),c.processedImages.clear(),c.stats={totalImages:0,optimizedImages:0,savedBytes:0,variants:0}},async transform(h,d){if(d.endsWith(".html")||d.endsWith(".stx")){let g=ne(h);for(let p of g)c.imageReferences.add(p)}if(h.includes("<Image")||h.includes("@image"))return await ce(h,{formats:n,widths:a,quality:i,placeholder:m,outputDir:e,baseUrl:t,processedImages:c.processedImages});return h},async buildEnd(h){if(!await ge())return;await P.promises.mkdir(e,{recursive:!0});let g=[];for(let w of r){if(!P.existsSync(w))continue;let I=await N(w);g.push(...I)}let p=f?g.filter((w)=>oe(w,c.imageReferences)):g;if(c.stats.totalImages=p.length,y)console.log(`[stx-images] Processing ${p.length} images...`);let v=W(p,o);for(let w of v)await Promise.all(w.map(async(I)=>{try{let b=await Ce(I,{formats:n,widths:a,quality:i,placeholder:m,outputDir:e,baseUrl:t});c.processedImages.set(I,b),c.stats.optimizedImages++,c.stats.variants+=b.variants.length;let A=P.statSync(I).size,S=Pn(b.variants);if(c.stats.savedBytes+=Math.max(0,A-S/b.variants.length),y)console.log(` \u2713 ${j.basename(I)} \u2192 ${b.variants.length} variants`)}catch(b){console.error(`[stx-images] Error processing ${I}:`,b)}}));if(console.log("[stx-images] Optimization complete:"),console.log(` Images: ${c.stats.optimizedImages}/${c.stats.totalImages}`),console.log(` Variants: ${c.stats.variants}`),c.stats.savedBytes>0)console.log(` Saved: ~${In(c.stats.savedBytes)}`)}}}function ne(s){let r=[],e=/src=["']([^"']+\.(jpg|jpeg|png|webp|avif|gif))["']/gi,t;while((t=e.exec(s))!==null)r.push(t[1]);let n=/<Image[^>]+src=["']([^"']+)["']/gi;while((t=n.exec(s))!==null)r.push(t[1]);let a=/@image\s*\(\s*['"]([^'"]+)['"]/gi;while((t=a.exec(s))!==null)r.push(t[1]);let i=/background(?:-image)?:\s*url\(["']?([^"')]+\.(jpg|jpeg|png|webp|avif|gif))["']?\)/gi;while((t=i.exec(s))!==null)r.push(t[1]);return r}function oe(s,r){let e=j.basename(s);for(let t of r)if(t.endsWith(e)||t.includes(e))return!0;return!1}async function ce(s,r){return s}async function N(s){let r=[];async function e(t){let n=await P.promises.readdir(t,{withFileTypes:!0});for(let a of n){let i=j.join(t,a.name);if(a.isDirectory())await e(i);else if(a.isFile()&&An(i))r.push(i)}}return await e(s),r}function W(s,r){let e=[];for(let t=0;t<s.length;t+=r)e.push(s.slice(t,t+r));return e}async function Oc(s,r,e={}){if(!await ge())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");return Ce(s,{...e,outputDir:r})}async function Nc(s,r,e={}){let{formats:t=Q,widths:n=Z,quality:a=ee,placeholder:i="none",concurrency:m=4,verbose:o=!1}=e;if(!await ge())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");await P.promises.mkdir(r,{recursive:!0});let l=await N(s),f=[],y={totalImages:l.length,optimizedImages:0,savedBytes:0,variants:0},c=W(l,m);for(let h of c){let d=await Promise.all(h.map(async(g)=>{try{let p=await Ce(g,{formats:t,widths:n,quality:a,placeholder:i,outputDir:r,baseUrl:"/"});if(y.optimizedImages++,y.variants+=p.variants.length,o)console.log(` \u2713 ${j.basename(g)}`);return p}catch(p){return console.error(`Error processing ${g}:`,p),null}}));f.push(...d.filter((g)=>g!==null))}return{processed:f,stats:y}}function Ti(s){let r={};for(let e of s)r[e.src]={variants:e.variants,placeholder:e.placeholder};return r}async function Dc(s,r){let e=Ti(s);await Bun.write(r,JSON.stringify(e,null,2))}var Mu={enabled:!0,widths:[320,640,768,1024,1280,1536,1920],formats:["webp","jpeg"],quality:80,devOptimize:!1,cacheDir:".stx/image-cache",placeholder:"none",inputDirs:["public","src/assets","assets"],outputDir:"dist/images",baseUrl:"/images"};
|
|
43
|
+
export{$c,Ci,Rc,Ac,Ei,Pc,Ic,Oc,Nc,Ti,Dc,Mu};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{oi,ii,ai,Ru,ci,li,Au,ui,di,Cc,Pu}from"./chunk-drabexxq.js";export{oi as VideoProcessorCache,Cc as analyzeVideo,Ru as clearVideoCache,di as generateDASHManifest,ui as generateHLSManifest,ci as generatePoster,Au as generateSpriteSheet,li as generateThumbnails,ii as getCachedVideoResult,Pu as processVideo,ai as setCachedVideoResult};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{S}from"./chunk-gtktv6nn.js";import{ve,Rt,Ao,Po,Oa,Na,Da,Ma,gs,Oo,La,ja,Ba,pn}from"./chunk-5nfb4gxk.js";import{i}from"./chunk-42qtadka.js";import{Ws}from"./chunk-z5av310q.js";import{c}from"./chunk-xvs84gas.js";import{existsSync as M,readFileSync as K}from"fs";import h from"path";var ge=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),ee=pn.filter((e)=>!ge.has(e)).sort(),te=[...S].sort(),me=[...new Set([...ee,...te])].sort(),he=new Set(ee),be=new Set(te),ye=new Set(me),Y=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function xe(e,t){if(t==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function ne(e,t){let r=[];for(let u of t){if(u.offset===void 0)continue;let s=u.kind==="server"?he:be;Y.lastIndex=0;for(let l of u.code.matchAll(Y)){let g=l.index+l[0].indexOf("{")+1;for(let m of l[1].matchAll(/[^,]+/g)){let x=m[0];if(/^\s*type\s/.test(x))continue;let y=/^\s*([A-Za-z_$][\w$]*)/.exec(x);if(!y)continue;let o=y[1];if(!ye.has(o)||s.has(o))continue;let f=u.offset+g+m.index+y[0].length-o.length,p=e.slice(0,f),w=p.split(`
|
|
3
3
|
`).length;r.push({line:w,column:f-(p.lastIndexOf(`
|
|
4
|
-
`)+1)+1,offset:f,length:o.length,name:o,kind:u.kind,message:xe(o,u.kind)})}}}return r}import T from"path";var Se="@stacksjs/stx-typescript-plugin";function ke(e,t){let r=T.resolve(e);for(;;){let u=T.join(r,"tsconfig.json");if(t(u))return u;let s=T.dirname(r);if(s===r)return;r=s}}function ie(e,t,r){let u=ke(e,r);if(!u)return;let s=new Set,l=(g)=>{if(s.has(g))return;s.add(g);let m=t(g);if(!m)return;let
|
|
5
|
-
`.repeat(e.startLine-1):"",s=
|
|
4
|
+
`)+1)+1,offset:f,length:o.length,name:o,kind:u.kind,message:xe(o,u.kind)})}}}return r}import T from"path";var Se="@stacksjs/stx-typescript-plugin";function ke(e,t){let r=T.resolve(e);for(;;){let u=T.join(r,"tsconfig.json");if(t(u))return u;let s=T.dirname(r);if(s===r)return;r=s}}function ie(e,t,r){let u=ke(e,r);if(!u)return;let s=new Set,l=(g)=>{if(s.has(g))return;s.add(g);let m=t(g);if(!m)return;let x=m.compilerOptions?.plugins;if(Array.isArray(x)){let o=x.find((p)=>p?.name===Se),f=Array.isArray(o?.libs)?o.libs.filter((p)=>typeof p==="string"):[];return o?{configPath:g,libs:f.map((p)=>T.resolve(T.dirname(g),p))}:null}let y=typeof m.extends==="string"?[m.extends]:Array.isArray(m.extends)?m.extends:[];for(let o of[...y].reverse()){if(typeof o!=="string"||!o.startsWith("."))continue;let f=T.resolve(T.dirname(g),o.endsWith(".json")?o:`${o}.json`),p=l(f);if(p!==void 0)return p}return};return l(u)??void 0}function Mc(e,t="",r=""){let u=e.startLine>1?`
|
|
5
|
+
`.repeat(e.startLine-1):"",s=Oo(e)+Po(Ao(e.code)),l=e.kind==="client"||e.kind==="plain"?Da(t,e.code):"";return gs(`${u+s}
|
|
6
6
|
${l}
|
|
7
7
|
export {}
|
|
8
|
-
`,r)}var we=new Set(["name","status","length","location","history","origin","closed","close","open","focus","blur","print","scroll","scrollTo","scrollBy","stop","top","parent","self","frames","event","external","menubar","toolbar"]);function $e(e){if(e.length===0)return"";let t=["// Generated \u2014 the composables the runtime publishes as bare globals."],r=new Set(
|
|
9
|
-
`)}function
|
|
8
|
+
`,r)}var we=new Set(["name","status","length","location","history","origin","closed","close","open","focus","blur","print","scroll","scrollTo","scrollBy","stop","top","parent","self","frames","event","external","menubar","toolbar"]);function $e(e){if(e.length===0)return"";let t=["// Generated \u2014 the composables the runtime publishes as bare globals."],r=new Set(S),u=[];for(let{file:s,names:l}of e){let g=JSON.stringify(s.replace(/\\/g,"/").replace(/\.ts$/,""));u.push(` export * from ${g}`);for(let m of l){if(r.has(m)||we.has(m))continue;r.add(m),t.push(`declare const ${m}: typeof import(${g})[${JSON.stringify(m)}]`)}}return t.push("declare module '@composables' {",...u,"}"),t.join(`
|
|
9
|
+
`)}function $i(e,t,r){return`${e}.__stx_${t}${r}.ts`}function Lu(e){return e.replace(/\.__stx_(?:server|client|plain|template)\d+\.ts$/,"")}function Lc(){return se("stx.d.ts")}function jc(){return se("stx-module.d.ts")}function se(e){for(let t of[h.resolve(import.meta.dir,"..",e),h.resolve(import.meta.dir,"..","..",e)])if(M(t))return t;return null}var Te=/^(.*?)\((\d+),(\d+)\):\s+(error|warning)\s+TS(\d+):\s+(.*)$/;function De(e){return e>=1000&&e<2000}function re(e){let t="",r=!1,u=!1;for(let s=0;s<e.length;s++){let l=e[s];if(r){if(t+=l,u)u=!1;else if(l==="\\")u=!0;else if(l==='"')r=!1;continue}if(l==='"'){r=!0,t+=l;continue}if(l==="/"&&e[s+1]==="/"){while(s<e.length&&e[s]!==`
|
|
10
10
|
`)s++;t+=`
|
|
11
|
-
`;continue}if(l==="/"&&e[s+1]==="*"){s+=2;while(s<e.length&&!(e[s]==="*"&&e[s+1]==="/"))s++;s++;continue}t+=l}return t.replace(/,(\s*[}\]])/g,"$1")}function Ee(e){try{return JSON.parse(re(K(e,"utf8")))}catch{return}}function Oe(e){let t=h.resolve(e),r;for(;;){let o=h.join(t,"tsconfig.json");if(M(o)){r=o;break}let f=h.dirname(t);if(f===t)break;t=f}if(!r)return{};let u=new Set,s=r,l,g,m=r;while(s&&!u.has(s)){u.add(s);let o;try{o=JSON.parse(re(K(s,"utf8")))}catch{break}let f=o?.compilerOptions??{};if(!l&&f.paths&&typeof f.paths==="object")l=f.paths,m=s;if(!g&&typeof f.baseUrl==="string")g=h.resolve(h.dirname(s),f.baseUrl);if(l&&g)break;s=typeof o?.extends==="string"?h.resolve(h.dirname(s),o.extends.endsWith(".json")?o.extends:`${o.extends}.json`):void 0}if(!l)return{};let
|
|
12
|
-
`);for(let d of ne(a,b))
|
|
13
|
-
`),$e(await
|
|
11
|
+
`;continue}if(l==="/"&&e[s+1]==="*"){s+=2;while(s<e.length&&!(e[s]==="*"&&e[s+1]==="/"))s++;s++;continue}t+=l}return t.replace(/,(\s*[}\]])/g,"$1")}function Ee(e){try{return JSON.parse(re(K(e,"utf8")))}catch{return}}function Oe(e){let t=h.resolve(e),r;for(;;){let o=h.join(t,"tsconfig.json");if(M(o)){r=o;break}let f=h.dirname(t);if(f===t)break;t=f}if(!r)return{};let u=new Set,s=r,l,g,m=r;while(s&&!u.has(s)){u.add(s);let o;try{o=JSON.parse(re(K(s,"utf8")))}catch{break}let f=o?.compilerOptions??{};if(!l&&f.paths&&typeof f.paths==="object")l=f.paths,m=s;if(!g&&typeof f.baseUrl==="string")g=h.resolve(h.dirname(s),f.baseUrl);if(l&&g)break;s=typeof o?.extends==="string"?h.resolve(h.dirname(s),o.extends.endsWith(".json")?o.extends:`${o.extends}.json`):void 0}if(!l)return{};let x=g??h.dirname(m),y={};for(let[o,f]of Object.entries(l)){if(!Array.isArray(f))continue;y[o]=f.map((p)=>typeof p==="string"&&!h.isAbsolute(p)?h.resolve(x,p):p)}return{paths:y}}async function ju(e,t={}){let r=t.client!==!1,u=t.server!==!1,s=t.templates!==!1,l=t.componentsDir??(s?(await i()).componentsDir:void 0),g=new Map,m=new Map,x=[],y=[],o=0,f=0,p=Lc();for(let n of e){let a=await Bun.file(n).text(),b=Rt(a).filter((d)=>{if(d.kind==="server")return u;return r}),k=Rt(a).filter((d)=>d.kind==="server").map((d)=>d.code).join(`
|
|
12
|
+
`);for(let d of ne(a,b))x.push({file:n,line:d.line,column:d.column,code:0,message:d.message,category:"error",blockKind:d.kind});if(r&&k){let d=b.filter((O)=>O.kind!=="server"),E=[...new Set(d.flatMap((O)=>Ma(k,O.code)))];if(E.length>0)m.set(n,{names:E,line:d[0].startLine,kind:d[0].kind})}let D=h.dirname(h.resolve(n)),v=s?La(a,{runtimeGlobals:!p,originDir:D,filePath:h.resolve(n),componentsDir:l}):null,R=v?[...v.lineMap.values()].filter((d)=>d.expression).length:0;if(b.length===0&&R===0)continue;if(y.push(n),o+=b.length,f+=R,b.forEach((d,E)=>{g.set($i(n,d.kind,E),{source:Mc(d,k,D),origin:n,kind:d.kind})}),v&&R>0)g.set($i(n,"template",0),{source:v.text,origin:n,kind:"template",virtual:v})}if(g.size===0)return{diagnostics:x,checkedFiles:y,blockCount:0,expressionCount:0};let w=(t.extraLibs??[]).map((n)=>h.resolve(n)),oe=ie(e.length>0?h.dirname(h.resolve(e[0])):process.cwd(),Ee,M);for(let n of oe?.libs??[])if(!w.includes(n)&&M(n))w.push(n);if(p)w.push(p);let G=p?jc():null;if(G)w.push(G);let X=`${c()}/typecheck/__stx_globals.d.ts`,ce=["// Generated \u2014 the context serve.ts injects into <script server> blocks.",Oa(p?Na(K(p,"utf8")):void 0),...p?[]:["declare const window: any",...S.map((n)=>`declare const ${n}: any`)],["// Generated \u2014 the names stx auto-imports from @stacksjs/browser.",...ve.map((n)=>`declare const ${n}: any`)].join(`
|
|
13
|
+
`),$e(await Ws())].filter(Boolean).join(`
|
|
14
14
|
`),_=`${c()}/typecheck`;await Bun.$`rm -rf ${_}`.quiet().nothrow(),await Bun.$`mkdir -p ${_}`.quiet().nothrow(),await Bun.write(X,ce);let N=new Map,ae=0;for(let[n,a]of g){let b=`${ae++}_${n.replace(/[^\w.-]+/g,"_")}`;await Bun.write(`${_}/${b}`,a.source),N.set(b,a)}let le={target:"ESNext",module:"ESNext",moduleResolution:"bundler",strict:!0,noEmit:!0,skipLibCheck:!0,allowJs:!0,esModuleInterop:!0,resolveJsonModule:!0,lib:["ESNext","DOM","DOM.Iterable"],types:[],...Oe(e.length>0?h.dirname(h.resolve(e[0])):process.cwd()),...t.compilerOptions??{}},F=async(n,a)=>{let b=`${_}/tsconfig${a===1?"":`.${a}`}.json`;await Bun.write(b,JSON.stringify({compilerOptions:le,files:n.map((D)=>`${_}/${D}`).concat(X,...w)},null,2));let k=Bun.spawnSync(["bun","x","tsc","-p",b,"--pretty","false"],{stdout:"pipe",stderr:"pipe"});return{output:new TextDecoder().decode(k.stdout)+new TextDecoder().decode(k.stderr),exitCode:k.exitCode??0}},V=await F([...N.keys()],1),J=V.output,I=[],U=V.exitCode,W=0,ue=new Set(w.map((n)=>n.split("/").pop())),z=0,B=new Set,q=(n)=>{for(let a of n.replace(/\n[\t ]+([^\n]*)/g," $1").split(`
|
|
15
|
-
`)){let b=a.match(Te);if(!b)continue;if(W++,ue.has(b[1].split("/").pop()))z++;let[,k,D,v,R,d,E]=b,O=k.split("/").pop(),C=N.get(O);if(!C)continue;if(De(Number(d)))B.add(O);let A=Number(D),L=Number(v),Q;if(C.virtual){let P=
|
|
15
|
+
`)){let b=a.match(Te);if(!b)continue;if(W++,ue.has(b[1].split("/").pop()))z++;let[,k,D,v,R,d,E]=b,O=k.split("/").pop(),C=N.get(O);if(!C)continue;if(De(Number(d)))B.add(O);let A=Number(D),L=Number(v),Q;if(C.virtual){let P=Ba(C.virtual,A,L);if(!P?.expression)continue;if(ja(P,Number(d)))continue;A=P.line,L=P.column,Q=P.expression.code.trim()}I.push({file:C.origin,line:A,column:L,code:Number(d),message:E,category:R==="error"?"error":"warning",blockKind:C.kind,expression:Q})}};q(J);let pe=W,de=z;if(B.size>0&&B.size<N.size){let n=[...N.keys()].filter((a)=>!B.has(a));q((await F(n,2)).output)}if(r)for(let[n,a]of m){if(a.names.length===0)continue;I.push({file:n,line:a.line,column:1,code:0,message:`${a.names.length===1?"1 value reaches":`${a.names.length} values reach`} this block on the implicit bridge and ${a.names.length===1?"is":"are"} untyped: ${a.names.join(", ")}. Declare them with defineClientPayload({ ${a.names.join(", ")} }) in the server block to have them checked.`,category:"warning",blockKind:a.kind})}I.push(...x);let H=new Set,j=I.filter((n)=>{let a=`${n.file}:${n.line}:${n.column}:${n.code}:${n.message}`;if(H.has(a))return!1;return H.add(a),!0});j.sort((n,a)=>n.file.localeCompare(a.file)||n.line-a.line||n.column-a.column);let Z=de>0&&j.length===0,fe=Z||U!==0&&pe===0?`${Z?"a file passed with --lib has errors of its own, so nothing in your code was checked":`tsc exited ${U} without reporting any diagnostic, so nothing was checked`}. `+"A syntax error in an ambient declaration file does this \u2014 skipLibCheck suppresses "+`SEMANTIC diagnostics only. tsc said:
|
|
16
16
|
${J.trim().split(`
|
|
17
17
|
`).slice(0,12).join(`
|
|
18
|
-
`)||"(no output)"}`:void 0;return{diagnostics:j,checkedFiles:y,blockCount:o,expressionCount:f,failure:fe}}function
|
|
18
|
+
`)||"(no output)"}`:void 0;return{diagnostics:j,checkedFiles:y,blockCount:o,expressionCount:f,failure:fe}}function Bu(e){return e.map((t)=>{let r=t.blockKind==="template"?`[template: ${t.expression??""}]`:`[${t.blockKind==="plain"?"<script>":`<script ${t.blockKind}>`}]`;return`${t.file}:${t.line}:${t.column} ${t.category} TS${t.code} ${t.message} ${r}`}).join(`
|
|
19
19
|
`)}
|
|
20
|
-
export{
|
|
20
|
+
export{Mc,$i,Lu,Lc,jc,ju,Bu};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{t,a,Mt,Lt,jt,Fe,nt,P,
|
|
2
|
+
import{t,a,Mt,Lt,jt,Fe,nt,P,Cs,br,ze}from"./chunk-w28wc7mv.js";var O=/(?<![\w$@])@meta\s*\(/g,I=/(?<![\w$@])@metaTag\s*\(/g,C=/(?<![\w$@])@structuredData\s*\(/g,k=/(?<![\w$@])@seo\s*\(/g;function _(e,r){return(n)=>P(e,n,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX)}function N(e){return"property"in e?`<meta property="${l(e.property)}" content="${l(e.content)}">`:`<meta name="${l(e.name)}" content="${l(e.content)}">`}function wo(e,r,n,g){if(!e.includes("@meta"))return e;let i=Mt(e,O,(s,c)=>{let o=br(Lt(s),r);if(o.kind==="tag")return N(o.tag);if(o.kind==="empty")return"";return P("Meta",c,o.message,n,o.code)},_("Meta",n));return i=Mt(i,I,(s,c)=>{let o=jt(s,r);if(!o.ok)return P("MetaTag",c,o.message,n,o.code);if(o.value===void 0||o.value===null)return"";if(!nt(o.value))return P("MetaTag",c,`expected an object such as { name, content }, got ${Fe(o.value)}`,n,t.TYPE_ERROR);let u=o.value;if(!u.name&&!u.property&&!u.httpEquiv)return P("MetaTag",c,"the tag needs a name, property or httpEquiv",n,t.INVALID_DIRECTIVE_SYNTAX);if(u.content===void 0||u.content===null||u.content===""||u.content===!1)return"";let p="<meta";if(u.name)p+=` name="${l(u.name)}"`;if(u.property)p+=` property="${l(u.property)}"`;if(u.httpEquiv)p+=` http-equiv="${l(u.httpEquiv)}"`;return p+=` content="${l(u.content)}">`,p},_("MetaTag",n)),i}function b(e){let r=(n)=>n["@context"]?{...n}:{...n,"@context":"https://schema.org"};if(nt(e))return r(e);if(Array.isArray(e)&&e.length>0&&e.every(nt))return e.map(r);return null}function E(e){return`<script type="application/ld+json">${JSON.stringify(e).replace(/<\//g,"<\\/")}</script>`}function xo(e,r,n){if(!e.includes("@structuredData"))return e;return Mt(e,C,(g,i)=>{let s=jt(g,r);if(!s.ok)return P("StructuredData",i,s.message,n,s.code);if(s.value===void 0||s.value===null)return"";let c=b(s.value);if(!c)return P("StructuredData",i,`expected an object or an array of objects, got ${Fe(s.value)}`,n,t.TYPE_ERROR);try{return E(c)}catch(o){let u=o instanceof Error?o.message:String(o);return P("StructuredData",i,`the data cannot be written as JSON: ${u}`,n,t.EVALUATION_ERROR)}},_("StructuredData",n))}var j=new Set(["title","description","keywords","robots","canonical","openGraph","twitter","structuredData"]),A={image:"openGraph.image",url:"canonical or openGraph.url",type:"openGraph.type",siteName:"openGraph.siteName",locale:"openGraph.locale",og:"openGraph",author:"@meta('author', ...)"};function So(e,r,n,g){if(!e.includes("@seo"))return e;return Mt(e,k,(i,s)=>{if(!i.trim())return P("SEO",s,"expected an object: @seo({ title, description }) or @seo(seoVariable)",n,t.INVALID_DIRECTIVE_SYNTAX);let c=jt(i,r);if(!c.ok)return P("SEO",s,c.message,n,c.code);if(c.value===void 0||c.value===null)return"";if(!nt(c.value))return P("SEO",s,`expected an object such as { title, description }, got ${Fe(c.value)}`,n,t.TYPE_ERROR);try{return L(c.value,s,n)}catch(o){let u=o instanceof Error?o.message:String(o);return P("SEO",s,`Error processing @seo directive: ${u}`,n,t.EVALUATION_ERROR)}},_("SEO",n))}function R(e,r,n,g){let i=e[r];if(i===void 0||i===null||i===!1)return;if(nt(i))return i;Cs(n,`${r} must be an object, got ${Fe(i)}; its tags were left out`,g);return}function L(e,r,n){let g=Object.keys(e).filter((o)=>!j.has(o));if(g.length>0){let o=g.map((u)=>A[u]?`${u} (use ${A[u]})`:u).join(", ");Cs(r,`@seo does not read ${o}; ${g.length===1?"it was":"they were"} ignored`,n)}let i="";if(e.title)i+=`<title>${l(e.title)}</title>
|
|
3
3
|
`,i+=`<meta name="title" content="${l(e.title)}">
|
|
4
4
|
`;if(e.description)i+=`<meta name="description" content="${l(e.description)}">
|
|
5
5
|
`;if(e.keywords){let o=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;i+=`<meta name="keywords" content="${l(o)}">
|
|
@@ -25,7 +25,7 @@ import{t,a,Mt,Lt,jt,Fe,nt,P,_s,br,ze}from"./chunk-qwdcts9w.js";var O=/(?<![\w$@]
|
|
|
25
25
|
`}if(c.site)i+=`<meta name="twitter:site" content="${l(c.site)}">
|
|
26
26
|
`;if(c.creator)i+=`<meta name="twitter:creator" content="${l(c.creator)}">
|
|
27
27
|
`}if(e.structuredData!==void 0&&e.structuredData!==null){let o=b(e.structuredData);if(o)i+=`${E(o)}
|
|
28
|
-
`;else
|
|
28
|
+
`;else Cs(r,`structuredData must be an object or an array of objects, got ${Fe(e.structuredData)}; it was left out`,n)}return i.trim()}function ko(e,r,n){if(n.seo?.enabled===!1)return e;if(e.includes("<!-- stx SEO Tags -->")||r.__stx_seo_staged===!0||n.skipDefaultSeoTags===!0)return e;let g=r.__stx_runtime_head;if(!!(g?.title||g?.meta?.some((S)=>S.property==="og:title"||S.name==="og:title"||S.name==="twitter:title"||S.name==="description")))return e;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test(e)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test(e)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test(e))return e;if(!e.includes("<head>")&&!e.includes("<head "))return e;let s=e.includes("<title>")||e.includes("</title>"),c=q(e),o=M(c),u=G(c),p="";if(r.title)p=r.title;else if(r.meta&&r.meta.title)p=r.meta.title;else if(o)p=o;else if(n.seo?.defaultConfig?.title)p=n.seo.defaultConfig.title;else p=n.defaultTitle||"stx Project";let m="";if(r.description)m=r.description;else if(r.meta&&r.meta.description)m=r.meta.description;else if(u)m=u;else if(n.seo?.defaultConfig?.description)m=n.seo.defaultConfig.description;else m=n.defaultDescription||"A website built with stx templating engine";let d="";if(r.image)d=r.image;else if(r.meta&&r.meta.image)d=r.meta.image;else if(r.openGraph&&r.openGraph.image)d=r.openGraph.image;else if(n.seo?.defaultImage)d=n.seo.defaultImage;else if(n.defaultImage)d=n.defaultImage;let f=s?"":`
|
|
29
29
|
<meta name="title" content="${l(p)}">`,D=V(c)?"":`
|
|
30
30
|
<meta name="description" content="${l(m)}">`,y=`
|
|
31
31
|
<!-- stx SEO Tags -->${f}${D}
|
|
@@ -43,7 +43,7 @@ import{t,a,Mt,Lt,jt,Fe,nt,P,_s,br,ze}from"./chunk-qwdcts9w.js";var O=/(?<![\w$@]
|
|
|
43
43
|
${y}
|
|
44
44
|
`),h;return h.replace(/<head[^>]*>/,`$&
|
|
45
45
|
${y}
|
|
46
|
-
`)}function q(e){let r=e.search(/<\/head\s*>/i);return r===-1?e:e.slice(0,r)}function v(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�*39;|'/g,"'").replace(/&/g,"&")}function M(e){let r=e.match(/<title(?:\s[^>]*)?>([\s\S]*?)<\/title\s*>/i);return r?v(r[1].trim()):""}function x(e){return(e.match(/<meta\s[^>]*>/gi)||[]).filter((r)=>/\sname\s*=\s*["']description["']/i.test(r))}function V(e){return x(e).length>0}function G(e){for(let r of x(e)){let n=r.match(/\scontent\s*=\s*(?:"([^"]*)"|'([^']*)')/i),g=(n?.[1]??n?.[2]??"").trim();if(g)return v(g)}return""}function l(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var
|
|
46
|
+
`)}function q(e){let r=e.search(/<\/head\s*>/i);return r===-1?e:e.slice(0,r)}function v(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�*39;|'/g,"'").replace(/&/g,"&")}function M(e){let r=e.match(/<title(?:\s[^>]*)?>([\s\S]*?)<\/title\s*>/i);return r?v(r[1].trim()):""}function x(e){return(e.match(/<meta\s[^>]*>/gi)||[]).filter((r)=>/\sname\s*=\s*["']description["']/i.test(r))}function V(e){return x(e).length>0}function G(e){for(let r of x(e)){let n=r.match(/\scontent\s*=\s*(?:"([^"]*)"|'([^']*)')/i),g=(n?.[1]??n?.[2]??"").trim();if(g)return v(g)}return""}function l(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var Qr={name:"meta",rawParams:!0,handler:(e,r,n,g)=>{let i=br(r,n??{});if(i.kind==="error")return P("Meta",`@meta(${r.join(", ")})`,i.message,g,i.code);if(i.kind==="empty")return"";if(n)n.__stx_runtime_head=ze(n.__stx_runtime_head??{},{meta:[i.tag]});return""},hasEndTag:!1},es={name:"structuredData",handler:(e,r,n,g)=>{if(e.trim()==="")return a("StructuredData","structuredData directive requires JSON-LD content",t.INVALID_DIRECTIVE_SYNTAX);try{let i=JSON.parse(e);if(!i["@context"])i["@context"]="https://schema.org";if(!i["@type"])return a("StructuredData","structuredData requires @type property",t.INVALID_DIRECTIVE_SYNTAX);return E(i)}catch(i){let s=i instanceof Error?i.message:String(i);return a("StructuredData",s,t.EVALUATION_ERROR)}},hasEndTag:!0};function $p(){return[Qr,es]}function Rp(e,r){let{baseUrl:n,defaultChangefreq:g="weekly",defaultPriority:i=0.5,includeLastmod:s=!0}=r,c=n.replace(/\/$/,""),o=(m)=>m.startsWith("http")?m:`${c}${m.startsWith("/")?"":"/"}${m}`,u=e.map((m)=>{let d=o(m.loc),f=m.lastmod||(s?new Date().toISOString().split("T")[0]:void 0),D=m.changefreq||g,y=m.priority??i,h=` <url>
|
|
47
47
|
<loc>${T(d)}</loc>`;for(let w of m.alternates??[])h+=`
|
|
48
48
|
<xhtml:link rel="alternate" hreflang="${T(w.hreflang)}" href="${T(o(w.href))}"/>`;if(f)h+=`
|
|
49
49
|
<lastmod>${f}</lastmod>`;return h+=`
|
|
@@ -53,13 +53,13 @@ ${y}
|
|
|
53
53
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${e.some((m)=>m.alternates?.length)?' xmlns:xhtml="http://www.w3.org/1999/xhtml"':""}>
|
|
54
54
|
${u.join(`
|
|
55
55
|
`)}
|
|
56
|
-
</urlset>`}function
|
|
56
|
+
</urlset>`}function Ap(e,r){let n=r.replace(/\/$/,""),g=new Date().toISOString().split("T")[0];return`<?xml version="1.0" encoding="UTF-8"?>
|
|
57
57
|
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
58
58
|
${e.map((s)=>{let c=s.startsWith("http")?s:`${n}${s.startsWith("/")?"":"/"}${s}`;return` <sitemap>
|
|
59
59
|
<loc>${T(c)}</loc>
|
|
60
60
|
<lastmod>${g}</lastmod>
|
|
61
61
|
</sitemap>`}).join(`
|
|
62
62
|
`)}
|
|
63
|
-
</sitemapindex>`}async function
|
|
64
|
-
`).trim()}function
|
|
65
|
-
export{
|
|
63
|
+
</sitemapindex>`}async function Pp(e,r){let{extensions:n=[".stx",".html",".htm"],ignore:g=["_*",".*","node_modules","components","partials","layouts"]}=r,i=[],s=n.length===1?`*${n[0]}`:`*{${n.join(",")}}`,c=new Bun.Glob(`**/${s}`);for await(let o of c.scan(e)){if(g.some((f)=>{if(f.startsWith("*"))return o.includes(f.slice(1));return o.startsWith(f)||o.includes(`/${f}`)}))continue;let p=o.replace(/\\/g,"/").replace(/index\.(stx|html|htm)$/,"").replace(/\.(stx|html|htm)$/,"");if(!p.startsWith("/"))p=`/${p}`;if(p!=="/"&&p.endsWith("/"))p=p.slice(0,-1);let m=`${e}/${o}`,d;try{let f=await Bun.file(m).stat();if(f)d=new Date(f.mtime).toISOString().split("T")[0]}catch{}i.push({loc:p||"/",lastmod:d,priority:p==="/"?1:0.5})}return i.sort((o,u)=>o.loc.localeCompare(u.loc)),i}function ts(e){let r=[];for(let n of e.rules){if(r.push(`User-agent: ${n.userAgent}`),n.allow)for(let g of n.allow)r.push(`Allow: ${g}`);if(n.disallow)for(let g of n.disallow)r.push(`Disallow: ${g}`);if(n.crawlDelay!==void 0)r.push(`Crawl-delay: ${n.crawlDelay}`);r.push("")}if(e.sitemap){let n=Array.isArray(e.sitemap)?e.sitemap:[e.sitemap];for(let g of n)r.push(`Sitemap: ${g}`)}if(e.host)r.push(`Host: ${e.host}`);return r.join(`
|
|
64
|
+
`).trim()}function Ip(e){return ts({rules:[{userAgent:"*",allow:["/"]}],sitemap:e})}function T(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}
|
|
65
|
+
export{wo,xo,So,ko,Qr,es,$p,Rp,Ap,Pp,ts,Ip};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{g,m,d}from"./chunk-
|
|
2
|
+
import{g,m,d}from"./chunk-5nfb4gxk.js";import{N}from"./chunk-42qtadka.js";import{o}from"./chunk-rs67af2x.js";import k from"path";var q={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var M=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function H(e){let t=[],i=0,n;M.lastIndex=0;while((n=M.exec(e))!==null){if(n.index>i){let a=e.slice(i,n.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let s=n[1],r=n[2];t.push({type:"suspense",name:s,content:r}),i=n.index+n[0].length}if(i<e.length){let s=e.slice(i);if(s.trim())t.push({type:t.length===0?"shell":"content",content:s})}if(t.length===0)t.push({type:"shell",content:e});return t}async function cd(e,t={},i={}){let n={...N,...i,streaming:{...q,...i.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),f=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),h={...t,__filename:e,__dirname:k.dirname(e)};if(f.trim())await g(f,h,e);let E=H(c),u=new Set;if(!E.some((w)=>w.type==="suspense")){let w=n.streaming?.strategy||"auto",x=new RegExp(T.source,"g");if(!(w!=="manual"&&x.test(c))){let p=await o(c,h,e,n,u);for(let b=0;b<p.length;b+=s)r.enqueue(p.slice(b,b+s)),await new Promise((y)=>setTimeout(y,0))}else{let p=[],b=new RegExp(T.source,"g"),y;while((y=b.exec(c))!==null)p.push({name:y[1],content:y[2],start:y.index,end:y.index+y[0].length});let v=0;for(let _ of p){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let O=await o(I,h,e,n,u);r.enqueue(O),await new Promise((D)=>setTimeout(D,0))}}let C=await o(_.content,h,e,n,u);r.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await o(_,h,e,n,u);r.enqueue(C)}}}}else{let w=new Map;for(let l of E)if(l.type==="shell"||l.type==="content"){let p=await o(l.content,h,e,n,u);r.enqueue(p)}else if(l.type==="suspense"&&l.name){let p=`stx-suspense-${l.name}`;r.enqueue(`<div id="${p}" data-suspense="${l.name}" style="display:contents;">
|
|
3
3
|
<template data-suspense-fallback>Loading...</template>
|
|
4
4
|
</div>`),w.set(l.name,o(l.content,h,e,n,u))}r.enqueue(`
|
|
5
5
|
<script>
|
|
@@ -17,13 +17,13 @@ import{g,m,d}from"./chunk-87em5xdg.js";import{N}from"./chunk-2933mvwr.js";import
|
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
})();
|
|
20
|
-
</script>`);let x=Array.from(w.entries()).map(async([l,p])=>{r.enqueue(await
|
|
20
|
+
</script>`);let x=Array.from(w.entries()).map(async([l,p])=>{r.enqueue(await zi(l,p))});await Promise.all(x)}r.close()}catch(a){r.error(a)}}})}async function zi(e,t){try{let n=(await t).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
|
|
21
21
|
<script>
|
|
22
22
|
window.__stxSuspense.resolve('${e}', \`${n}\`);
|
|
23
23
|
</script>`}catch(i){let n=i instanceof Error?i.message:String(i);return`
|
|
24
24
|
<script>
|
|
25
25
|
window.__stxSuspense.resolve('${e}', '<div class="stx-error">Error loading content: ${d(n)}</div>');
|
|
26
|
-
</script>`}}var
|
|
26
|
+
</script>`}}var dl=`
|
|
27
27
|
<script>
|
|
28
28
|
(function(){
|
|
29
29
|
window.__stxSuspense = window.__stxSuspense || {
|
|
@@ -43,12 +43,12 @@ window.__stxSuspense.resolve('${e}', '<div class="stx-error">Error loading conte
|
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
})();
|
|
46
|
-
</script>`;function z(e,t,i){if(!t||t<=0)return e;let n,s=new Promise((r,a)=>{n=setTimeout(()=>a(Error(`streaming boundary "${i}" timed out after ${t}ms`)),t)});return Promise.race([e,s]).finally(()=>clearTimeout(n))}function
|
|
46
|
+
</script>`;function z(e,t,i){if(!t||t<=0)return e;let n,s=new Promise((r,a)=>{n=setTimeout(()=>a(Error(`streaming boundary "${i}" timed out after ${t}ms`)),t)});return Promise.race([e,s]).finally(()=>clearTimeout(n))}function ld(e,t=[],i={}){let n=i.timeoutMs??0;return new ReadableStream({async start(s){try{if(s.enqueue(e),t.length>0)s.enqueue(dl),await Promise.all(t.map(async(r)=>{let a=z(r.render(),n,r.id);s.enqueue(await zi(r.id,a))}));s.close()}catch(r){s.error(r)}}})}var A=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;function ud(e,t){return e.replace(A,(i,n,s)=>{let r=n.trim(),a=s.split(/@fallback/i),S=a[0].trim(),f=a.length>1?a.slice(1).join("@fallback").trim():"";if(!t.__streamTemplates)t.__streamTemplates={};return t.__streamTemplates[r]=S,`<div data-suspense="${r}">${f}</div>`})}function dd(e){let t=e?.streamBoundaries;if(!t||typeof t!=="object")return;let i=Object.entries(t).filter(([,n])=>typeof n==="function");return i.length>0?i.map(([n,s])=>({id:n,render:s})):void 0}async function pd(e,t={},i={}){let n={...N,...i,streaming:{...q,...i.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),f=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),h={...t,__filename:e,__dirname:k.dirname(e)};if(f.trim())await g(f,h,e);let E=new Set,u=n.streaming?.strategy||"auto",R=new RegExp(T.source,"g");if(!(u!=="manual"&&R.test(c))){let x=await o(c,h,e,n,E);for(let l=0;l<x.length;l+=s)r.enqueue(x.slice(l,l+s))}else{let x=[],l=new RegExp(T.source,"g"),p;while((p=l.exec(c))!==null)x.push({name:p[1],content:p[2],start:p.index,end:p.index+p[0].length});let b=0;for(let y of x){if(y.start>b){let _=c.slice(b,y.start);if(_.trim()){let C=await o(_,h,e,n,E);r.enqueue(C)}}let v=await o(y.content,h,e,n,E);r.enqueue(v),b=y.end}if(b<c.length){let y=c.slice(b);if(y.trim()){let v=await o(y,h,e,n,E);r.enqueue(v)}}}r.close()}catch(a){r.error(a)}}})}async function fd(e,t={}){let i={...N,...t,streaming:{...q,...t.streaming}},n=await Bun.file(e).text(),s=n.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),r=s?s[1]:"",a=n.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),S=a,f={},c;T.lastIndex=0;while((c=T.exec(a))!==null){let u=c[1],R=c[2];f[u]=R}let h=a.replace(T,"");return{renderShell:async(u={})=>{let R={...u,__filename:e,__dirname:k.dirname(e)};return await g(r,R,e),o(h,R,e,i,new Set)},renderSection:async(u,R={})=>{try{if(!f[u])return`<div class="error-message">Section "${d(u)}" not found in template "${d(e)}"</div>`;let w={...R,__filename:e,__dirname:k.dirname(e)};await g(r,w,e);let x=new Set;return await o(f[u],w,e,i,x)}catch(w){let x=w instanceof Error?w.message:String(w);return m("Expression",x,e,f[u]||"",0,f[u]||"")}},getSections:()=>Object.keys(f),getTemplate:()=>S}}var pl={name:"suspense",hasEndTag:!0,handler:(e,t,i,n)=>{if(!t||t.length===0)throw Error("Suspense directive requires a name parameter");let s=t[0].replace(/['"`]/g,"");return`<!-- @suspense:${s} -->${e}<!-- @endsuspense:${s} -->`}},fl={name:"island",hasEndTag:!0,handler:(e,t,i,n)=>{if(!t||t.length===0)throw Error("Island directive requires a name parameter");let s=t[0].replace(/['"`]/g,""),r=t[1]?t[1].replace(/['"`]/g,""):"lazy",a=`island-${s}-${Math.random().toString(36).substring(2,9)}`,S=e.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),f=S?S[1].trim():"",c=S?e.replace(S[0],""):e;return`<div data-island="${s}" data-island-id="${a}" data-priority="${r}">
|
|
47
47
|
${c}
|
|
48
48
|
<script type="application/json" data-island-props="${a}">
|
|
49
49
|
${f?`{${f}}`:"{}"}
|
|
50
50
|
</script>
|
|
51
|
-
</div>`}};function
|
|
51
|
+
</div>`}};function gd(e={}){let t=[];if(e.streaming?.enabled)t.push(pl);if(e.hydration?.enabled)t.push(fl);return t}async function md(e,t,i,n={}){return e}function hd(e,t={}){let i=new TextEncoder,n=e.pipeThrough(new TransformStream({transform(r,a){a.enqueue(i.encode(r))}})),s=new Headers(t.headers);if(!s.has("Content-Type"))s.set("Content-Type","text/html; charset=utf-8");if(!s.has("Transfer-Encoding"))s.set("Transfer-Encoding","chunked");if(!s.has("X-Content-Type-Options"))s.set("X-Content-Type-Options","nosniff");if(!s.has("X-Accel-Buffering"))s.set("X-Accel-Buffering","no");return new Response(n,{...t,headers:s})}function yd(e={mode:"full"}){let{mode:t,components:i={},dynamicImports:n=!0}=e,s=Object.entries(i).map(([r,a])=>`'${r}': ${n?`() => import('${a}')`:`require('${a}')`}`).join(`,
|
|
52
52
|
`);if(t==="loader")return`
|
|
53
53
|
(function() {
|
|
54
54
|
window.__stx = window.__stx || {};
|
|
@@ -191,4 +191,4 @@ else {
|
|
|
191
191
|
stx.hydrate();
|
|
192
192
|
}
|
|
193
193
|
})();`}
|
|
194
|
-
export{
|
|
194
|
+
export{cd,zi,dl,ld,ud,dd,pd,fd,pl,fl,gd,md,hd,yd};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function c(i){if(!i.startsWith("/")||/[?#\\]/.test(i))throw Error(`Invalid route rule pattern: ${i}`);let t=i==="/"?[]:i.slice(1).split("/");if(t.some((r,e)=>!r||r.includes("*")&&r!=="*"&&r!=="**"||r==="**"&&e!==t.length-1||r.startsWith(":")&&!/^:[\w]+$/.test(r)))throw Error(`Unsupported route rule pattern: ${i}`);return t}function
|
|
3
|
-
export{
|
|
2
|
+
function c(i){if(!i.startsWith("/")||/[?#\\]/.test(i))throw Error(`Invalid route rule pattern: ${i}`);let t=i==="/"?[]:i.slice(1).split("/");if(t.some((r,e)=>!r||r.includes("*")&&r!=="*"&&r!=="**"||r==="**"&&e!==t.length-1||r.startsWith(":")&&!/^:[\w]+$/.test(r)))throw Error(`Unsupported route rule pattern: ${i}`);return t}function Us(i){for(let[t,r]of Object.entries(i)){if(c(t),!r||typeof r!=="object"||Object.keys(r).some((e)=>e!=="rendering"&&e!=="cache"))throw Error(`Unsupported route rule for ${t}`);if(r.rendering!==void 0&&r.rendering!=="prerender"&&r.rendering!=="dynamic")throw Error(`Unsupported rendering mode for ${t}`);if(r.cache!==void 0&&r.cache!==!1){let e=r.cache;if(!e||e.public!==!0||Object.keys(e).some((n)=>!["public","maxAge","swr"].includes(n))||!Number.isFinite(e.maxAge)||e.maxAge<=0||e.swr!==void 0&&(!Number.isFinite(e.swr)||e.swr<0))throw Error(`Route cache for ${t} requires public: true, maxAge > 0 and swr >= 0`);if(r.rendering==="prerender")throw Error(`Prerendered route ${t} cannot revalidate; use dynamic rendering with cache`)}}}function En(i={}){Us(i);let t=(e)=>e==="**"?0:e==="*"?1:e.startsWith(":")?2:3,r=Object.entries(i).map(([e,n])=>({pattern:e,parts:c(e),rule:n}));return r.sort((e,n)=>{for(let o=0;o<Math.max(e.parts.length,n.parts.length);o++){let s=(n.parts[o]===void 0?4:t(n.parts[o]))-(e.parts[o]===void 0?4:t(e.parts[o]));if(s)return s}return e.pattern.localeCompare(n.pattern)}),(e)=>{let n=e==="/"?[]:e.replace(/\/$/,"").slice(1).split("/");return r.find(({parts:o})=>o.every((s,u)=>s==="**"||n[u]!==void 0&&(s==="*"||s.startsWith(":")||s===n[u]))&&(o.at(-1)==="**"||o.length===n.length))?.rule??{}}}
|
|
3
|
+
export{Us,En};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{S}from"./chunk-gtktv6nn.js";import{T,xn}from"./chunk-6beg47t4.js";import{k,J}from"./chunk-5nfb4gxk.js";import{i}from"./chunk-42qtadka.js";import{Ee,Yt,Zt,Qt}from"./chunk-5nrqc6v4.js";import{ht}from"./chunk-ypwetty7.js";import{pt,Nn,qt,ae}from"./chunk-2pga7zzb.js";import{C,wr}from"./chunk-2ajbhefk.js";import p from"path";var a=new Map;function _(c,n){for(let s of c.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(s[1])n.add(s[1]);for(let s of c.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let o of(s[1]??"").split(",")){let l=((o.includes(":")?o.split(":").pop():o)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(l))n.add(l)}for(let s of c.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let o of(s[1]??"").split(",")){let r=o.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(r))n.add(r)}}async function Ud(c){let n;if(c)n=p.resolve(c);else{let t=await i();n=p.resolve(t.root||process.cwd(),t.storesDir||"stores")}let s=`${n}\x00${Zt()}`,o=new Bun.Glob("*.ts"),r=[];try{for await(let t of o.scan({cwd:n,absolute:!0})){let e=p.basename(t,".ts");if(["index","types"].includes(e))continue;if(t.includes(".d.ts"))continue;r.push(t)}}catch{return ae(a,s,"",""),null}let l=()=>[...new Set([...r,...r.flatMap((t)=>Ee(t))])],f=pt(l()),d=qt(a,s,f);if(d!==void 0)return d||null;if(r.length===0)return ae(a,s,f,""),null;let u=[];for(let t of r){let e=await Bun.file(t).text();u.push({file:t,hasUseStore:/useStore\s*\(/.test(e)})}u.sort((t,e)=>{if(t.hasUseStore===e.hasUseStore)return 0;return t.hasUseStore?1:-1});let x=u.map((t)=>t.file),m=[],g=new Set,y=J({loader:"ts",target:"browser",define:k()});for(let t of x)try{let e=await Bun.file(t).text(),v=p.basename(t,".ts");if(_(e,g),Yt(e))e=await Qt(e,t,{projectRoot:process.cwd(),externalizeUserModules:C()});e=ht(e),e=T(e),e=xn(e),e=e.replace(/^export\s+(default\s+)?/gm,""),e=y.transformSync(e),m.push(`// Store: ${v}
|
|
3
3
|
${e.trim()}`)}catch(e){console.warn(`[stx] Failed to load store ${t}:`,e)}if(m.length===0)return ae(a,s,f,""),null;let h=m.join(`
|
|
4
4
|
|
|
5
5
|
`),w=`;(function(){
|
|
6
6
|
var __stx = window.stx || {};
|
|
7
|
-
${
|
|
7
|
+
${S.filter((t)=>!g.has(t)&&new RegExp(`\\b${t}\\b`).test(h)).map((t)=>`var ${t} = __stx[${JSON.stringify(t)}];`).join(`
|
|
8
8
|
`)}
|
|
9
9
|
${h}
|
|
10
|
-
})();`,b=C()?wr(w):w;return f=pt(l()),ae(a,s,f,b),b}function
|
|
11
|
-
export{
|
|
10
|
+
})();`,b=C()?wr(w):w;return f=pt(l()),ae(a,s,f,b),b}function Wd(){a.clear(),Nn()}
|
|
11
|
+
export{Ud,Wd};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ft,Dn,Kd}from"./chunk-w1wzydvp.js";import{ce,Mn,Xd,Ln,qs,Nr,Dr,Jd,Yd,Zd,jn,Bn,Gs,Mr,Qd}from"./chunk-2ar5g9pa.js";import"./chunk-gtktv6nn.js";export{qs as batch,Kd as default,Mn as derived,Ln as effect,ft as generateSignalsRuntime,Dn as generateSignalsRuntimeDev,Bn as isDerived,jn as isSignal,Xd as memo,Dr as onDestroy,Nr as onMount,Mr as peek,Zd as pendingLifecycleCounts,Yd as runDestroyCallbacks,Jd as runMountCallbacks,ce as state,Gs as untrack,Qd as useOptimistic};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{_o,Co,vt,le,tr,ns,nr,rs,ss,Ml,Ll,jl,rr,Bl,Fl,zl,Hl,Ca,Ea,Ta,Eo,$a,Vl,wt,xt,St,kt,_t,Ct,Ze,Ul}from"./chunk-gymmbbzc.js";export{nr as Router,zl as abortNavigation,ns as bracketPathToRegex,wt as clearMiddleware,Ea as createClientCookieManager,_t as createMiddlewareContext,kt as createRouteLocation,Ca as createServerCookieManager,Ta as createStorageManager,Hl as defineMiddleware,Ll as defineRoute,jl as defineRoutes,rs as findErrorPage,ss as formatRoutes,Co as generateRouteManifest,_o as generateRouteTypes,$a as getMiddleware,xt as getMiddlewareNames,Ze as getRouterScript,Ul as getRouterScriptDev,Vl as hasMiddleware,vt as isFileRequestPath,St as loadMiddlewareFromDirectory,tr as matchRoute,Fl as navigateTo,le as patternToRegex,Eo as registerMiddleware,Bl as resetRoutes,rr as route,Ct as runMiddleware,Ml as setAppUrl};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import s from"path";var h=new Set([".jpg",".jpeg",".png",".gif"]),d=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}];async function
|
|
3
|
-
export{
|
|
2
|
+
import s from"path";var h=new Set([".jpg",".jpeg",".png",".gif"]),d=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}];async function ul(e,r){let a=r.formats??d;if(!r.publicDir)return e;let i=y(e),o=[],m=/<img\b[^>]*?>/gi,c=[],u;while((u=m.exec(e))!==null){let t=u[0],n=t.match(/\bsrc=["']([^"']+)["']/i);if(!n)continue;if(A(u.index,i))continue;c.push({idx:u.index,length:t.length,src:n[1],raw:t})}if(c.length===0)return e;let f=await Promise.all(c.map(async(t)=>{let n=await S(t.src,r.publicDir,a);return{match:t,sources:n}}));for(let{match:t,sources:n}of f){if(n.length===0)continue;let x=`<picture>${n.map((p)=>`<source type="${p.mime}" srcset="${P(p.url)}">`).join("")}${t.raw}</picture>`;o.push({start:t.idx,end:t.idx+t.length,replacement:x})}if(o.length===0)return e;let l="",g=0;for(let t of o)l+=e.slice(g,t.start),l+=t.replacement,g=t.end;return l+=e.slice(g),l}async function S(e,r,a){if(!w(e))return[];let i=s.extname(e).toLowerCase();if(!h.has(i))return[];if(!e.startsWith("/"))return[];let o=s.join(r,e.slice(1)),m=s.dirname(o),c=s.basename(o,i),u=s.resolve(m),f=s.resolve(r);if(!u.startsWith(f))return[];let l=s.posix.dirname(e),g=a.map(async(n)=>{let b=s.join(m,`${c}${n.ext}`);if(!await Bun.file(b).exists())return null;return{url:s.posix.join(l,`${c}${n.ext}`),mime:n.mime}});return(await Promise.all(g)).filter((n)=>n!==null)}function w(e){if(!e)return!1;if(e.startsWith("http://")||e.startsWith("https://"))return!1;if(e.startsWith("//"))return!1;if(e.startsWith("data:"))return!1;return!0}function y(e){let r=[],a=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,i;while((i=a.exec(e))!==null)r.push([i.index,i.index+i[0].length]);return r}function A(e,r){for(let[a,i]of r)if(e>=a&&e<i)return!0;return!1}function P(e){return e.replace(/&/g,"&").replace(/"/g,""")}
|
|
3
|
+
export{ul};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{jr,Kn,El}from"./chunk-tdwqwxhf.js";import"./chunk-2a1eeywj.js";import"./chunk-ypwetty7.js";import"./chunk-e97xj3rf.js";import"./chunk-zt5hp5w5.js";import"./chunk-42qtadka.js";import"./chunk-hg7ys8rn.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-nbjyed3q.js";import"./chunk-gymmbbzc.js";import{$t}from"./chunk-5nfb4gxk.js";import"./chunk-remsyfdx.js";import"./chunk-t6m5d64b.js";import"./chunk-w28wc7mv.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{El as declareBareLoopHead,$t as parseLoopBinding,Kn as processLoops,jr as reportDeferredLoopWarnings};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{le}from"./chunk-
|
|
3
|
-
`);if(!await Bun.file(o).exists()||await Bun.file(o).text()!==f)await Bun.write(o,f);return o}async function
|
|
4
|
-
`)}`);let a=e.outputs.find((u)=>u.kind==="entry-point");if(!a)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await a.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(l,n),a),f.push({...t,filePath:n})}return f}function j(s,l){let o=s.map((i)=>({route:i,...le(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,a=(r)=>r.replace(/:\w+/g,":param"),p=t.filter((r)=>a(r.route.pattern)===a(e)),n=i.method,u=p.find((r)=>r.route.method===n)??(n==="HEAD"?p.find((r)=>r.route.method==="GET"):void 0);if(!u){let r=new Set(p.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=u.regex.exec(f),g=Object.create(null);try{u.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await l(u.route);if(typeof r!=="function")throw Error(`API endpoint ${u.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function
|
|
5
|
-
`));let u=n.outputs.find((d)=>d.kind==="entry-point");if(!u||n.outputs.length!==1)throw Error(`Unsupported API bundle output: ${p.filePath}`);return(await import(`data:text/javascript;base64,${Buffer.from(await u.text()).toString("base64")}`)).default})(f))}catch(t){return console.error("[stx] API discovery failed:",t),Response.json({error:"API discovery failed; check the server log"},{status:500})}}}function
|
|
6
|
-
export{en,
|
|
2
|
+
import{le}from"./chunk-gymmbbzc.js";import{Be,A}from"./chunk-t6m5d64b.js";import{Sa}from"./chunk-912r15hr.js";import{c}from"./chunk-xvs84gas.js";import S from"fs";import m from"path";import{pathToFileURL as O}from"url";var E=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],P=new Set;function en(s,l={}){let o=m.resolve(s,l.dir??"server/api"),i=[],f=new Map;if(!S.existsSync(o))return i;let t=Array.from(new Bun.Glob("**/*.{ts,js,mts,mjs}").scanSync({cwd:o})).sort();for(let e of t){if(e.endsWith(".d.ts"))continue;let p=e.replace(/\.(?:ts|js|mts|mjs)$/,"").split("/"),n=p.pop(),u=n.lastIndexOf("."),d=u>=0?n.slice(u+1):"get",g=d.toUpperCase();if(!E.includes(g)||d!==d.toLowerCase())throw Error(`Unsupported API method suffix in ${e}; use ${E.map((y)=>y.toLowerCase()).join(", ")}`);if(u>=0)n=n.slice(0,u);if(n!=="index")p.push(n);let r=new Set,h=p.map((y,I)=>{let v=/^\[(\.\.\.)?([A-Za-z_]\w*)\]$/.exec(y);if(v){if(r.has(v[2])||v[1]&&I!==p.length-1)throw Error(`Invalid API parameter in ${e}`);return r.add(v[2]),`:${v[2]}${v[1]?"*":""}`}if(!/^[\w-]+$/.test(y))throw Error(`Unsupported API path segment ${y} in ${e}`);return y}),w=`/api${h.length?`/${h.join("/")}`:""}`,x=`${g} ${w.replace(/:\w+/g,":param")}`;if(f.has(x))throw Error(`Ambiguous API route ${g} ${w}: ${f.get(x)} and ${e}`);f.set(x,e);let R=m.join(o,e);P.add(m.resolve(R)),P.add(S.realpathSync(R)),i.push({pattern:w,method:g,filePath:R})}return i.sort((e,a)=>{let p=e.pattern.split("/"),n=a.pattern.split("/"),u=(d)=>d?.endsWith("*")?0:d?.startsWith(":")?1:2;for(let d=0;d<Math.max(p.length,n.length);d++){let g=u(n[d])-u(p[d]);if(g)return g}return e.pattern.localeCompare(a.pattern)||e.method.localeCompare(a.method)})}async function Ys(s,l){let o=c(s,"api-types.d.ts"),i=["// Generated by stx. Include this file in tsconfig.json.","declare module '@stacksjs/stx/api-client' {"," interface KnownApiRoutes {"];for(let t of l){let e=`./${m.relative(m.dirname(o),t.filePath).replace(/\\/g,"/")}`,{params:a}=le(t.pattern);i.push(` ${JSON.stringify(`${t.method} ${t.pattern}`)}: { params: { ${a.map((p)=>`${JSON.stringify(p)}: string`).join("; ")} }; response: Awaited<ReturnType<typeof import(${JSON.stringify(e)}).default>> }`)}i.push(" }","}","export {}","");let f=i.join(`
|
|
3
|
+
`);if(!await Bun.file(o).exists()||await Bun.file(o).text()!==f)await Bun.write(o,f);return o}async function Zs(s,l,o={}){let i=en(s,o);await Ys(s,i);let f=[];for(let t of i){let e=await Bun.build({entrypoints:[t.filePath],target:"bun",format:"esm",minify:!1,splitting:!1});if(!e.success)throw Error(`API build failed for ${t.filePath}: ${e.logs.join(`
|
|
4
|
+
`)}`);let a=e.outputs.find((u)=>u.kind==="entry-point");if(!a)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await a.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(l,n),a),f.push({...t,filePath:n})}return f}function j(s,l){let o=s.map((i)=>({route:i,...le(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,a=(r)=>r.replace(/:\w+/g,":param"),p=t.filter((r)=>a(r.route.pattern)===a(e)),n=i.method,u=p.find((r)=>r.route.method===n)??(n==="HEAD"?p.find((r)=>r.route.method==="GET"):void 0);if(!u){let r=new Set(p.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=u.regex.exec(f),g=Object.create(null);try{u.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await l(u.route);if(typeof r!=="function")throw Error(`API endpoint ${u.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function Qs(s,l){return j(l,async(o)=>(await import(O(m.resolve(s,o.filePath)).href)).default)}async function lp(s,l){if(!l)return async()=>null;let o=l===!0?{}:l,i=en(s,o);return await Ys(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=en(s,o);await Ys(s,t);let{loadStxConfig:e}=await import("./chunk-5rdfcpfe.js"),a=A((await e(s)).runtimeConfig);return await Be(a,()=>j(t,async(p)=>{let n=await Bun.build({entrypoints:[p.filePath],target:"bun",format:"esm",splitting:!1});if(!n.success)throw Error(n.logs.join(`
|
|
5
|
+
`));let u=n.outputs.find((d)=>d.kind==="entry-point");if(!u||n.outputs.length!==1)throw Error(`Unsupported API bundle output: ${p.filePath}`);return(await import(`data:text/javascript;base64,${Buffer.from(await u.text()).toString("base64")}`)).default})(f))}catch(t){return console.error("[stx] API discovery failed:",t),Response.json({error:"API discovery failed; check the server log"},{status:500})}}}function eo(s,l,o){if(Sa(s))return!0;let i=/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/;if(i.test(m.basename(s)))return!0;try{if(i.test(m.basename(S.realpathSync(s))))return!0}catch{}if(P.has(m.resolve(s)))return!0;if(!o)return!1;let f=m.resolve(l,typeof o==="object"?o.dir??"server/api":"server/api"),t=(a)=>{try{return S.realpathSync(a)}catch{return m.resolve(a)}},e=t(s);return[f,m.resolve(l,"server"),m.resolve(l,".output/server")].some((a)=>{let p=t(a);return e===p||e.startsWith(`${p}${m.sep}`)})}
|
|
6
|
+
export{en,Ys,Zs,Qs,lp,eo};
|
|
@@ -72,7 +72,7 @@ else {
|
|
|
72
72
|
${t}
|
|
73
73
|
})();
|
|
74
74
|
</script>
|
|
75
|
-
`}function
|
|
75
|
+
`}function bd(i,n,o){f=0;let l=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return i.replace(l,(t,e,s)=>{let a=v(),r=p(t,e,s),d=r.placeholder?`<div data-defer-placeholder>${r.placeholder}</div>`:"",c=r.loading?`<div data-defer-loading style="display: none;">${r.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',g=r.error?`<div data-defer-error style="display: none;">${r.error}</div>`:"",u=`<div data-defer-content style="display: none;">${r.content}</div>`,h=E(a,r);return`
|
|
76
76
|
<div id="${a}" class="stx-defer" data-defer-trigger="${r.trigger}">
|
|
77
77
|
${d}
|
|
78
78
|
${c}
|
|
@@ -81,4 +81,4 @@ else {
|
|
|
81
81
|
</div>
|
|
82
82
|
${h}
|
|
83
83
|
`})}
|
|
84
|
-
export{
|
|
84
|
+
export{bd};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{up,ia,dp,aa,Sl,kl,nn,Gn,pp,_l,Cl,fp,h}from"./chunk-bmqker64.js";import"./chunk-yhfm939b.js";import"./chunk-5nfb4gxk.js";import"./chunk-remsyfdx.js";import"./chunk-t6m5d64b.js";import"./chunk-w28wc7mv.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{nn as buildCss,_l as extractClassNames,kl as fingerprintConfig,Cl as generateCss,pp as getCachedCSS,up as getCssServeAsset,h as injectCss,ia as loadCssEngine,aa as loadCssEngineConfig,Gn as rebuildCss,dp as resetCssCache,Sl as resolveUserCssConfig,fp as withLinkedModuleBundles};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{yn,A}from"./chunk-
|
|
2
|
+
import{yn,A}from"./chunk-t6m5d64b.js";import m from"fs";import e from"path";async function hn(r,o,i){if(r.__stx_runtime_config)return;let n=yn();if(n||i){r.__stx_runtime_config=n??A(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-5rdfcpfe.js"),c=await f(t);if(c.runtimeConfig)r.__stx_runtime_config=A(c.runtimeConfig);return}let s=e.dirname(t);if(s===t)return;t=s}}async function Vo(r,o){function i(n){if(n===null)return"null";if(Array.isArray(n))return`Array<${n.length?[...new Set(n.map(i))].join(" | "):"unknown"}>`;if(typeof n==="object")return`{ ${Object.entries(n).map(([t,s])=>`readonly ${JSON.stringify(t)}: ${i(s)}`).join("; ")} }`;return typeof n}await Bun.write(e.join(r,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
|
|
3
3
|
declare module '@stacksjs/stx/runtime-config' { interface PublicRuntimeConfig ${i(o.public??{})} }
|
|
4
4
|
`),await Bun.write(e.join(r,".stx/runtime-config-server.d.ts"),`import '@stacksjs/stx/runtime-config-server'
|
|
5
5
|
declare module '@stacksjs/stx/runtime-config-server' { interface PrivateRuntimeConfig ${i(o.private??{})} }
|
|
6
6
|
`)}
|
|
7
|
-
export{hn,
|
|
7
|
+
export{hn,Vo};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{$l,Vr}from"./chunk-brcj3953.js";import"./chunk-2a1eeywj.js";import"./chunk-zt5hp5w5.js";import{ur}from"./chunk-5nfb4gxk.js";import"./chunk-remsyfdx.js";import"./chunk-t6m5d64b.js";import{tt}from"./chunk-w28wc7mv.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{tt as freeIdentifiers,Vr as processComponents,$l as processESImports,ur as rendersAsElement};
|