@stacksjs/stx 0.2.570 → 0.2.572
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-01mxer9s.js +2 -0
- package/dist/chunk-09gtbb1w.js +2 -0
- package/dist/{chunk-v9gy8rda.js → chunk-0bt0fbs1.js} +59 -59
- package/dist/{chunk-k0shfsfx.js → chunk-0dz1b6a1.js} +3 -3
- package/dist/{chunk-3m01ym55.js → chunk-0g2ybnht.js} +2 -2
- package/dist/{chunk-jvm6agq7.js → chunk-0q6n3by0.js} +3 -3
- package/dist/chunk-15erabm6.js +2 -0
- package/dist/chunk-194qgkc9.js +2 -0
- package/dist/{chunk-fas9k7sw.js → chunk-1dg5qxg9.js} +5 -5
- package/dist/{chunk-tdv9np5t.js → chunk-1edvsndv.js} +2 -2
- package/dist/{chunk-brkq2s62.js → chunk-1n64749x.js} +3 -3
- package/dist/chunk-1z6c6dyk.js +2 -0
- package/dist/{chunk-36aj0yzt.js → chunk-232jswfm.js} +1 -1
- package/dist/chunk-279jv0yf.js +2 -0
- package/dist/chunk-2a1q5y6r.js +2 -0
- package/dist/{chunk-xfpfs9zq.js → chunk-2ads8rw5.js} +2 -2
- package/dist/chunk-2cqbyb8w.js +2 -0
- package/dist/{chunk-wjazf68a.js → chunk-2crxkm7j.js} +3 -3
- package/dist/{chunk-he2et28k.js → chunk-2jjff8kv.js} +5 -5
- package/dist/chunk-2jsnrfc8.js +2 -0
- package/dist/{chunk-ffxwsa94.js → chunk-2z0trbbm.js} +2 -2
- package/dist/{chunk-ywah1c30.js → chunk-36agnyhe.js} +7 -7
- package/dist/chunk-3gft8zng.js +2 -0
- package/dist/chunk-49gwmcrn.js +2 -0
- package/dist/{chunk-r17t24jr.js → chunk-4bgfpkwx.js} +3 -3
- package/dist/{chunk-dgr561sc.js → chunk-4easd8da.js} +11 -11
- package/dist/chunk-4wfr074d.js +2 -0
- package/dist/{chunk-cbyh8fhn.js → chunk-58tz7tmf.js} +3 -3
- package/dist/chunk-5afw7z6v.js +2 -0
- package/dist/{chunk-9d6dr0dr.js → chunk-5dmkkvs7.js} +2 -2
- package/dist/chunk-5fv4g4et.js +2 -0
- package/dist/{chunk-d8jdr1k4.js → chunk-5t1whxxt.js} +6 -6
- package/dist/{chunk-dkyqkkpj.js → chunk-5vw8493b.js} +3 -3
- package/dist/chunk-604rs9sq.js +2 -0
- package/dist/chunk-636sfxyj.js +2 -0
- package/dist/chunk-6aq3sm83.js +2 -0
- package/dist/chunk-6f4qrd0s.js +2 -0
- package/dist/chunk-6va5pe2m.js +2 -0
- package/dist/{chunk-r8h9b3f8.js → chunk-6wc2t6cd.js} +6 -6
- package/dist/{chunk-2t3bhp2j.js → chunk-707n4pbz.js} +5 -5
- package/dist/{chunk-5s555c1r.js → chunk-74xwzxwz.js} +3 -3
- package/dist/{chunk-nmy7mcbd.js → chunk-79vdkvhf.js} +5 -5
- package/dist/{chunk-mbj9dbrh.js → chunk-7bwkeake.js} +6 -6
- package/dist/chunk-7kh4p06d.js +2 -0
- package/dist/{chunk-8cs45k3f.js → chunk-7t3ykgsm.js} +2 -2
- package/dist/chunk-7xrrzqh7.js +2 -0
- package/dist/{chunk-724zsgbk.js → chunk-83fdt4yj.js} +6 -6
- package/dist/chunk-8jaw6exk.js +2 -0
- package/dist/chunk-8k61b4ae.js +2 -0
- package/dist/{chunk-chythmea.js → chunk-9k7bq97t.js} +1 -1
- package/dist/chunk-9yar9rfq.js +2 -0
- package/dist/{chunk-knpzph55.js → chunk-a6jq7hex.js} +3 -3
- package/dist/{chunk-mw2dravv.js → chunk-anjm087t.js} +5 -5
- package/dist/chunk-asbq9cgs.js +2 -0
- package/dist/{chunk-0zq4btre.js → chunk-b2q8bk8p.js} +2 -2
- package/dist/chunk-b7t8jejd.js +2 -0
- package/dist/chunk-b894fxfc.js +2 -0
- package/dist/{chunk-y3mmeywt.js → chunk-b9r88ysg.js} +2 -2
- package/dist/{chunk-0pzbg1bt.js → chunk-beqkrwt1.js} +2 -2
- package/dist/chunk-bm2q1srp.js +2 -0
- package/dist/{chunk-xjr67xvb.js → chunk-bpdsdbvg.js} +2 -2
- package/dist/{chunk-8zmahjqg.js → chunk-c4zpzxex.js} +6 -6
- package/dist/chunk-cgwyd9aq.js +2 -0
- package/dist/chunk-cvswrbzw.js +2 -0
- package/dist/{chunk-hvzznc50.js → chunk-cyg9w31a.js} +2 -2
- package/dist/chunk-d8206zbp.js +2 -0
- package/dist/chunk-dcpf6kas.js +15 -0
- package/dist/chunk-ensp20xk.js +2 -0
- package/dist/chunk-f10299sf.js +2 -0
- package/dist/chunk-f1apaqfk.js +2 -0
- package/dist/chunk-f4jh9vrj.js +2834 -0
- package/dist/{chunk-rrce2fyv.js → chunk-g66m3g2r.js} +1 -1
- package/dist/chunk-g6zeqvvb.js +2 -0
- package/dist/chunk-ghy82tsc.js +2 -0
- package/dist/{chunk-35kmebz9.js → chunk-gzgc8zk5.js} +4 -4
- package/dist/{chunk-qw4fjtt1.js → chunk-h4k3hyny.js} +2 -2
- package/dist/chunk-jqefcghh.js +31 -0
- package/dist/chunk-jw33eys8.js +2 -0
- package/dist/chunk-jwvzvapp.js +11 -0
- package/dist/{chunk-b76jbdtk.js → chunk-jze68d0z.js} +2 -2
- package/dist/chunk-k6wgh598.js +2 -0
- package/dist/{chunk-c1ys37c9.js → chunk-k7ht6tqe.js} +2 -2
- package/dist/{chunk-q94wdmdp.js → chunk-kgj852hx.js} +4 -4
- package/dist/{chunk-nebtks7j.js → chunk-kzjrgh0b.js} +10 -10
- package/dist/chunk-m2a1fxpb.js +2 -0
- package/dist/chunk-m6mxqepz.js +2 -0
- package/dist/chunk-mbmbaj0m.js +2 -0
- package/dist/{chunk-3tzkqf6e.js → chunk-mr9c2ej6.js} +2 -2
- package/dist/chunk-mzqyv7s5.js +33 -0
- package/dist/chunk-n61v7e3s.js +2 -0
- package/dist/chunk-n6qp05t9.js +2 -0
- package/dist/chunk-nn174xjh.js +2 -0
- package/dist/chunk-ntgy4e1q.js +2 -0
- package/dist/chunk-nw4axkpx.js +2 -0
- package/dist/chunk-p5chk3s9.js +2 -0
- package/dist/{chunk-w8vg3te3.js → chunk-phzs239m.js} +4 -4
- package/dist/{chunk-gwabvrc3.js → chunk-pnag11c4.js} +3 -3
- package/dist/{chunk-tc5zk2ka.js → chunk-pqcvh9pp.js} +1 -1
- package/dist/{chunk-a849hqna.js → chunk-pveafhzg.js} +2 -2
- package/dist/chunk-pw9verqx.js +2 -0
- package/dist/{chunk-rh606w0q.js → chunk-q79kmad5.js} +1 -1
- package/dist/chunk-q83w8edy.js +3 -0
- package/dist/{chunk-je0jxvmj.js → chunk-qcymqscj.js} +5 -5
- package/dist/{chunk-rtc17gy5.js → chunk-qt3x1sh3.js} +3 -3
- package/dist/chunk-qx6tr8mr.js +2 -0
- package/dist/{chunk-q8nw82pz.js → chunk-qzbzn1yf.js} +23 -23
- package/dist/{chunk-kaaxb9c5.js → chunk-r4w1cye7.js} +2 -2
- package/dist/{chunk-ebg20d8s.js → chunk-rfnr4xz6.js} +2 -2
- package/dist/{chunk-dajh1369.js → chunk-rrj5m9xv.js} +2 -2
- package/dist/{chunk-d4ybwtqt.js → chunk-s12b57m9.js} +2 -2
- package/dist/chunk-s34g3awk.js +74 -0
- package/dist/chunk-s6sf70ty.js +2 -0
- package/dist/{chunk-wemq37qe.js → chunk-sfwprq8q.js} +8 -8
- package/dist/chunk-ta8bhz27.js +2 -0
- package/dist/chunk-tc5r2vmw.js +2 -0
- package/dist/chunk-ts80ktq7.js +2 -0
- package/dist/{chunk-9k6r7f3c.js → chunk-tv784gv0.js} +4 -4
- package/dist/{chunk-3wcwtqx1.js → chunk-vp31ff54.js} +2 -2
- package/dist/{chunk-nz0krznq.js → chunk-vr36s2en.js} +2 -2
- package/dist/chunk-vyg8bvkt.js +2 -0
- package/dist/{chunk-9zf49tqg.js → chunk-wwhxgvr8.js} +4 -4
- package/dist/{chunk-ncq5n15k.js → chunk-xckzvbvn.js} +1 -1
- package/dist/chunk-xq2ck69k.js +2 -0
- package/dist/chunk-y4ajd836.js +2 -0
- package/dist/{chunk-j3vwyzvb.js → chunk-ydx3mfpp.js} +7 -7
- package/dist/{chunk-z3smaz4z.js → chunk-yk3wh2xv.js} +3 -3
- package/dist/{chunk-5hxsdkvp.js → chunk-ymawe0y5.js} +2 -2
- package/dist/{chunk-zckbg2vb.js → chunk-zd01r00t.js} +1 -1
- package/dist/chunk-zddzjd60.js +2 -0
- package/dist/chunk-zgxj1q7w.js +2 -0
- package/dist/chunk-zs7qhh40.js +2 -0
- package/dist/{chunk-qh0es7mk.js → chunk-zyk12484.js} +2 -2
- package/dist/cli.js +20 -20
- package/dist/client-script-bundler.js +1 -1
- package/dist/composable-loader.js +3 -2
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/env.d.ts +16 -0
- package/dist/env.js +12 -0
- package/dist/native/compiler/bundle.d.ts +2 -0
- package/dist/native/compiler/bundle.js +51 -12
- package/dist/process.js +3 -3
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +8 -8
- package/dist/store-loader.js +4 -3
- package/package.json +5 -5
- package/dist/chunk-0mw3d5fc.js +0 -2
- package/dist/chunk-1sh80b1c.js +0 -2
- package/dist/chunk-1xyhdpbn.js +0 -2
- package/dist/chunk-20nrvpps.js +0 -2
- package/dist/chunk-2j7tr8wj.js +0 -2
- package/dist/chunk-2mxhp1yy.js +0 -2
- package/dist/chunk-32yj7sbw.js +0 -2
- package/dist/chunk-3ss3vfad.js +0 -2
- package/dist/chunk-4zp2zzch.js +0 -2
- package/dist/chunk-503w9dn3.js +0 -2
- package/dist/chunk-6m406xsn.js +0 -63
- package/dist/chunk-6yja1c8e.js +0 -2
- package/dist/chunk-74va4kza.js +0 -2
- package/dist/chunk-74w81h3v.js +0 -2
- package/dist/chunk-85j8cxfd.js +0 -2
- package/dist/chunk-8bwp2m95.js +0 -2
- package/dist/chunk-8rj08x1d.js +0 -2
- package/dist/chunk-8yn9wxzt.js +0 -31
- package/dist/chunk-98xp5rfe.js +0 -2
- package/dist/chunk-9ah35e2w.js +0 -2
- package/dist/chunk-9d1bs55s.js +0 -2
- package/dist/chunk-9rts16ta.js +0 -2
- package/dist/chunk-a2mztbta.js +0 -33
- package/dist/chunk-ajezxt0s.js +0 -2
- package/dist/chunk-bf572npc.js +0 -2
- package/dist/chunk-cqeccn7x.js +0 -2
- package/dist/chunk-dkyjw3hc.js +0 -3
- package/dist/chunk-dsdxa5x1.js +0 -2
- package/dist/chunk-ectcp21m.js +0 -2
- package/dist/chunk-ewcnyvcd.js +0 -2
- package/dist/chunk-ez7r18ef.js +0 -2
- package/dist/chunk-ffgsaf9e.js +0 -2
- package/dist/chunk-fnnhekdc.js +0 -2
- package/dist/chunk-g8b74qvn.js +0 -2
- package/dist/chunk-ge87hcgb.js +0 -2
- package/dist/chunk-gra2v7xz.js +0 -2
- package/dist/chunk-jg9fydw8.js +0 -2
- package/dist/chunk-k50k9zbw.js +0 -2
- package/dist/chunk-kz131809.js +0 -2834
- package/dist/chunk-mg8yjzkr.js +0 -2
- package/dist/chunk-mjkw1esn.js +0 -2
- package/dist/chunk-n0ra4mv3.js +0 -2
- package/dist/chunk-nspfk500.js +0 -2
- package/dist/chunk-nwyp2xaf.js +0 -2
- package/dist/chunk-pdk87hhe.js +0 -2
- package/dist/chunk-pxcmv1xz.js +0 -2
- package/dist/chunk-re030f77.js +0 -2
- package/dist/chunk-rn80ctkd.js +0 -2
- package/dist/chunk-s7dzs6yg.js +0 -2
- package/dist/chunk-t1tqn3xx.js +0 -2
- package/dist/chunk-tgwdk0gt.js +0 -15
- package/dist/chunk-tma2vac1.js +0 -2
- package/dist/chunk-v0chatw1.js +0 -2
- package/dist/chunk-v9mkambt.js +0 -2
- package/dist/chunk-vwjqbn5y.js +0 -2
- package/dist/chunk-wrvksj26.js +0 -2
- package/dist/chunk-wvjpvs89.js +0 -11
- package/dist/chunk-xkxwg6d4.js +0 -2
- package/dist/chunk-xspkz804.js +0 -2
- package/dist/chunk-xwqyw7zt.js +0 -2
- package/dist/chunk-y3kp87w1.js +0 -2
- package/dist/chunk-ya39wk58.js +0 -2
- package/dist/chunk-ygbdfzqn.js +0 -2
- package/dist/chunk-ypswj8sv.js +0 -2
- package/dist/chunk-yqzhev40.js +0 -2
- package/dist/chunk-z1tnn2pm.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{b,d,n,g,
|
|
2
|
+
import{b,d,n,g,A}from"./chunk-f4jh9vrj.js";import k from"path";var q={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var M=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function H(e){let t=[],o=0,s;M.lastIndex=0;while((s=M.exec(e))!==null){if(s.index>o){let a=e.slice(o,s.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let r=s[1],i=s[2];t.push({type:"suspense",name:r,content:i}),o=s.index+s[0].length}if(o<e.length){let r=e.slice(o);if(r.trim())t.push({type:t.length===0?"shell":"content",content:r})}if(t.length===0)t.push({type:"shell",content:e});return t}async function yd(e,t={},o={}){let s={...A,...o,streaming:{...q,...o.streaming}},r=s.streaming?.bufferSize||16384;return new ReadableStream({async start(i){try{let a=await Bun.file(e).text(),w=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),m=w?w[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y={...t,__filename:e,__dirname:k.dirname(e)};if(m.trim())await d(m,y,e);let E=H(c),u=new Set;if(!E.some((h)=>h.type==="suspense")){let h=s.streaming?.strategy||"auto",S=new RegExp(T.source,"g");if(!(h!=="manual"&&S.test(c))){let p=await n(c,y,e,s,u);for(let x=0;x<p.length;x+=r)i.enqueue(p.slice(x,x+r)),await new Promise((f)=>setTimeout(f,0))}else{let p=[],x=new RegExp(T.source,"g"),f;while((f=x.exec(c))!==null)p.push({name:f[1],content:f[2],start:f.index,end:f.index+f[0].length});let v=0;for(let _ of p){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let O=await n(I,y,e,s,u);i.enqueue(O),await new Promise((D)=>setTimeout(D,0))}}let C=await n(_.content,y,e,s,u);i.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await n(_,y,e,s,u);i.enqueue(C)}}}}else{let h=new Map;for(let l of E)if(l.type==="shell"||l.type==="content"){let p=await n(l.content,y,e,s,u);i.enqueue(p)}else if(l.type==="suspense"&&l.name){let p=`stx-suspense-${l.name}`;i.enqueue(`<div id="${p}" data-suspense="${l.name}" style="display:contents;">
|
|
3
3
|
<template data-suspense-fallback>Loading...</template>
|
|
4
4
|
</div>`),h.set(l.name,n(l.content,y,e,s,u))}i.enqueue(`
|
|
5
5
|
<script>
|
|
@@ -17,13 +17,13 @@ import{b,d,n,g,R}from"./chunk-kz131809.js";import q from"path";var M={enabled:!0
|
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
})();
|
|
20
|
-
</script>`);let S=Array.from(h.entries()).map(async([l,p])=>{i.enqueue(await
|
|
20
|
+
</script>`);let S=Array.from(h.entries()).map(async([l,p])=>{i.enqueue(await $o(l,p))});await Promise.all(S)}i.close()}catch(a){i.error(a)}}})}async function $o(e,t){try{let s=(await t).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
|
|
21
21
|
<script>
|
|
22
22
|
window.__stxSuspense.resolve('${e}', \`${s}\`);
|
|
23
23
|
</script>`}catch(o){let s=o instanceof Error?o.message:String(o);return`
|
|
24
24
|
<script>
|
|
25
25
|
window.__stxSuspense.resolve('${e}', '<div class="stx-error">Error loading content: ${b(s)}</div>');
|
|
26
|
-
</script>`}}var
|
|
26
|
+
</script>`}}var qa=`
|
|
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
|
|
46
|
+
</script>`;function z(e,t,o){if(!t||t<=0)return e;let s,r=new Promise((i,a)=>{s=setTimeout(()=>a(Error(`streaming boundary "${o}" timed out after ${t}ms`)),t)});return Promise.race([e,r]).finally(()=>clearTimeout(s))}function bd(e,t=[],o={}){let s=o.timeoutMs??0;return new ReadableStream({async start(r){try{if(r.enqueue(e),t.length>0)r.enqueue(qa),await Promise.all(t.map(async(i)=>{let a=z(i.render(),s,i.id);r.enqueue(await $o(i.id,a))}));r.close()}catch(i){r.error(i)}}})}var B=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;function wd(e,t){return e.replace(B,(o,s,r)=>{let i=s.trim(),a=r.split(/@fallback/i),w=a[0].trim(),m=a.length>1?a.slice(1).join("@fallback").trim():"";if(!t.__streamTemplates)t.__streamTemplates={};return t.__streamTemplates[i]=w,`<div data-suspense="${i}">${m}</div>`})}function vd(e){let t=e?.streamBoundaries;if(!t||typeof t!=="object")return;let o=Object.entries(t).filter(([,s])=>typeof s==="function");return o.length>0?o.map(([s,r])=>({id:s,render:r})):void 0}async function xd(e,t={},o={}){let s={...A,...o,streaming:{...q,...o.streaming}},r=s.streaming?.bufferSize||16384;return new ReadableStream({async start(i){try{let a=await Bun.file(e).text(),w=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),m=w?w[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y={...t,__filename:e,__dirname:k.dirname(e)};if(m.trim())await d(m,y,e);let E=new Set,u=s.streaming?.strategy||"auto",R=new RegExp(T.source,"g");if(!(u!=="manual"&&R.test(c))){let S=await n(c,y,e,s,E);for(let l=0;l<S.length;l+=r)i.enqueue(S.slice(l,l+r))}else{let S=[],l=new RegExp(T.source,"g"),p;while((p=l.exec(c))!==null)S.push({name:p[1],content:p[2],start:p.index,end:p.index+p[0].length});let x=0;for(let f of S){if(f.start>x){let _=c.slice(x,f.start);if(_.trim()){let C=await n(_,y,e,s,E);i.enqueue(C)}}let v=await n(f.content,y,e,s,E);i.enqueue(v),x=f.end}if(x<c.length){let f=c.slice(x);if(f.trim()){let v=await n(f,y,e,s,E);i.enqueue(v)}}}i.close()}catch(a){i.error(a)}}})}async function Sd(e,t={}){let o={...A,...t,streaming:{...q,...t.streaming}},s=await Bun.file(e).text(),r=s.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),i=r?r[1]:"",a=s.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),w=a,m={},c;T.lastIndex=0;while((c=T.exec(a))!==null){let u=c[1],R=c[2];m[u]=R}let y=a.replace(T,"");return{renderShell:async(u={})=>{let R={...u,__filename:e,__dirname:k.dirname(e)};return await d(i,R,e),n(y,R,e,o,new Set)},renderSection:async(u,R={})=>{try{if(!m[u])return`<div class="error-message">Section "${b(u)}" not found in template "${b(e)}"</div>`;let h={...R,__filename:e,__dirname:k.dirname(e)};await d(i,h,e);let S=new Set;return await n(m[u],h,e,o,S)}catch(h){let S=h instanceof Error?h.message:String(h);return g("Expression",S,e,m[u]||"",0,m[u]||"")}},getSections:()=>Object.keys(m),getTemplate:()=>w}}var Ga={name:"suspense",hasEndTag:!0,handler:(e,t,o,s)=>{if(!t||t.length===0)throw Error("Suspense directive requires a name parameter");let r=t[0].replace(/['"`]/g,"");return`<!-- @suspense:${r} -->${e}<!-- @endsuspense:${r} -->`}},Xa={name:"island",hasEndTag:!0,handler:(e,t,o,s)=>{if(!t||t.length===0)throw Error("Island directive requires a name parameter");let r=t[0].replace(/['"`]/g,""),i=t[1]?t[1].replace(/['"`]/g,""):"lazy",a=`island-${r}-${Math.random().toString(36).substring(2,9)}`,w=e.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),m=w?w[1].trim():"",c=w?e.replace(w[0],""):e;return`<div data-island="${r}" data-island-id="${a}" data-priority="${i}">
|
|
47
47
|
${c}
|
|
48
48
|
<script type="application/json" data-island-props="${a}">
|
|
49
49
|
${m?`{${m}}`:"{}"}
|
|
50
50
|
</script>
|
|
51
|
-
</div>`}};function
|
|
51
|
+
</div>`}};function kd(e={}){let t=[];if(e.streaming?.enabled)t.push(Ga);if(e.hydration?.enabled)t.push(Xa);return t}async function Cd(e,t,o,s={}){return e}function _d(e,t={}){let o=new TextEncoder,s=e.pipeThrough(new TransformStream({transform(i,a){a.enqueue(o.encode(i))}})),r=new Headers(t.headers);if(!r.has("Content-Type"))r.set("Content-Type","text/html; charset=utf-8");if(!r.has("Transfer-Encoding"))r.set("Transfer-Encoding","chunked");if(!r.has("X-Content-Type-Options"))r.set("X-Content-Type-Options","nosniff");if(!r.has("X-Accel-Buffering"))r.set("X-Accel-Buffering","no");return new Response(s,{...t,headers:r})}function Ed(e={mode:"full"}){let{mode:t,components:o={},dynamicImports:s=!0}=e,r=Object.entries(o).map(([i,a])=>`'${i}': ${s?`() => 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{yd,$o,qa,bd,wd,vd,xd,Sd,Ga,Xa,kd,Cd,_d,Ed};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-ydx3mfpp.js";import"./chunk-vp31ff54.js";import"./chunk-pnag11c4.js";import{a}from"./chunk-0g2ybnht.js";import f from"fs";import l from"path";async function d(e,t={}){let s=Date.now(),n={total:0,passed:0,failed:0,new:0,failures:[],duration:0},o=t.snapshotDir||a(e.root,"story","snapshots");await f.promises.mkdir(o,{recursive:!0});let r=e.storyFiles;if(t.filter&&t.filter.length>0)r=r.filter((i)=>t.filter.some((p)=>i.fileName.toLowerCase().includes(p.toLowerCase())));for(let i of r)await h(i,o,t,n);return n.duration=Date.now()-s,n}async function h(e,t,s,n){let o=e.story;if(!o)return;for(let r of o.variants){n.total++;let i=l.join(t,`${e.id}-${r.id}.snap`),p=g(r.source||""),c=await w(i);if(s.update||!c){let u={storyId:e.id,variantId:r.id,component:e.fileName,timestamp:Date.now(),hash:p};if(await f.promises.writeFile(i,JSON.stringify(u,null,2)),!c)n.new++;n.passed++}else try{let u=await f.promises.readFile(i,"utf-8"),m=JSON.parse(u);if(m.hash===p)n.passed++;else n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:"Snapshot mismatch",difference:y(m.hash,p)})}catch(u){n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:`Error reading snapshot: ${u}`})}}}async function x(e,t={}){return(await d(e,{...t,update:!0})).total}function g(e){let t=0;for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);t=(t<<5)-t+n,t=t&t}return t.toString(16)}function y(e,t){if(e===t)return 0;let s=Math.abs(Number.parseInt(e,16)-Number.parseInt(t,16));return Math.min(s/1e6,1)}async function w(e){try{return await f.promises.access(e),!0}catch{return!1}}function F(e){let t=[];if(t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(" STX Story Visual Regression Tests"),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),e.failures.length>0){t.push(" \u274C Failures:"),t.push("");for(let s of e.failures){if(t.push(` \u2022 ${s.component} / ${s.variantId}`),t.push(` ${s.message}`),s.difference!==void 0)t.push(` Difference: ${(s.difference*100).toFixed(2)}%`);t.push("")}}if(t.push(" Summary:"),t.push(` Total: ${e.total}`),t.push(` Passed: ${e.passed} \u2713`),t.push(` Failed: ${e.failed} \u2717`),e.new>0)t.push(` New: ${e.new} \u26A1`);return t.push(` Time: ${e.duration}ms`),t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),t.join(`
|
|
3
3
|
`)}export{F as formatTestResults,d as runVisualTests,x as updateSnapshots};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
`)}async function
|
|
2
|
+
import{R,k,Wt,qt,Gt}from"./chunk-2ads8rw5.js";import{resolve as Q,basename as J,extname as K,join as Y}from"path";import{mkdir as Z}from"fs/promises";var N={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0};class Mr{config;constructor(t={}){this.config={...N,...t}}async get(t,e){return Wt(t,e,"video",this.config)}async set(t,e,a){return qt(t,e,a,"video",this.config)}async clear(){return Gt("video",this.config)}updateConfig(t){this.config={...this.config,...t}}}var v=null;function B(t){if(!v)v=new Mr(t);else if(t)v.updateConfig(t);return v}async function Nr(t,e,a){let c=a?{directory:`${a.outputDir}/../.cache`}:{};return B(c).get(t,e)}async function Lr(t,e,a,c){let r=c?{directory:`${c.outputDir}/../.cache`}:{};return B(r).set(t,e,a)}async function Ca(){return B().clear()}import{resolve as _,basename as D,extname as A,join as H}from"path";import{mkdir as M}from"fs/promises";async function L(){try{return await import("ts-videos")}catch{return null}}async function jr(t,e,a,c){let r=await L();if(!r)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let n=_(t);if(!await k(n))return null;await M(a,{recursive:!0});let i=await R(n),s=D(t,A(t)),o=e.format||"webp",h=e.timestamp||0,y=`${s}-poster-${i}.${o}`,u=H(a,y),m=await r.extractThumbnails(n,{timestamps:[h],width:e.width||1280,height:e.height,format:o,quality:e.quality||85,outputDir:a,outputPattern:y.replace(`.${o}`,"")});if(m&&m.length>0){let d=m[0];return{path:u,url:`${c}/${y}`,width:d.width||e.width||1280,height:d.height||720,timestamp:h,size:d.size||0}}return null}catch(n){return console.warn(`[stx-media] Failed to generate poster: ${n}`),null}}async function Br(t,e,a,c){let r=await L();if(!r)return[];try{let n=_(t);if(!await k(n))return[];await M(a,{recursive:!0});let i=await R(n),s=D(t,A(t)),o=e.format||"webp",u=(await new r.Input(n).getInfo()).duration||60,m=e.count||10,d=e.interval||u/m,g=[];for(let f=0;f<m&&f*d<u;f++)g.push(f*d);let l=await r.extractThumbnails(n,{timestamps:g,width:e.width||320,format:o,quality:e.quality||80,outputDir:a,outputPattern:`${s}-thumb-${i}`});if(l&&l.length>0)return l.map((f,b)=>({path:f.path||H(a,`${s}-thumb-${i}-${b}.${o}`),url:`${c}/${s}-thumb-${i}-${b}.${o}`,width:f.width||e.width||320,height:f.height||180,timestamp:g[b],size:f.size||0}));return[]}catch(n){return console.warn(`[stx-media] Failed to generate thumbnails: ${n}`),[]}}async function _a(t,e,a,c){let r=await L();if(!r)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let n=_(t);if(!await k(n))return null;await M(a,{recursive:!0});let i=await R(n),s=D(t,A(t)),y=(await new r.Input(n).getInfo()).duration||60,u=e.columns||10,m=e.interval||5,d=e.thumbnailWidth||160,g=e.thumbnailHeight||90,l=e.format||"jpeg",f=Math.ceil(y/m),b=Math.ceil(f/u),S=`${s}-sprite-${i}.${l}`,w=H(a,S),C=[];for(let P=0;P<f;P++)C.push(P*m);let p=await r.extractThumbnails(n,{timestamps:C,width:d,height:g,format:l,quality:e.quality||70,outputDir:H(a,".temp")});if(!p||p.length===0)return null;try{let P=await import("ts-images"),x=u*d,ie=b*g,re=await P.createSprite({images:p.map((U)=>U.path),columns:u,padding:0,outputPath:w,format:l,quality:e.quality||70});return{url:`${c}/${S}`,path:w,columns:u,rows:b,thumbnailWidth:d,thumbnailHeight:g,interval:m,totalFrames:f}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(n){return console.warn(`[stx-media] Failed to generate sprite sheet: ${n}`),null}}import{resolve as E,basename as F,extname as W,join as V}from"path";import{mkdir as T,writeFile as q}from"fs/promises";async function z(){try{return await import("ts-videos")}catch{return null}}var j=[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000},{label:"360p",width:640,height:360,bitrate:600000,audioBitrate:64000}];async function Fr(t,e,a,c,r){let n=await z();if(!n)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let i=E(t);if(!await k(i))return null;let s=await R(i),o=F(t,W(t)),h=V(a,`${o}-${s}-hls`);await T(h,{recursive:!0});let y=e.length>0?e:j,u=r?.segmentDuration||6,g=(await new n.Input(i).getInfo()).duration||0,l=[],f=0;for(let w of y){let C=V(h,w.label);await T(C,{recursive:!0});let p=`${w.label}.m3u8`,P=V(C,p);try{let x=await n.generateHLS(i,{outputDir:C,segmentDuration:u,width:w.width,height:w.height,videoBitrate:w.bitrate,audioBitrate:w.audioBitrate,playlistName:w.label});if(x)l.push({quality:w,url:`${c}/${o}-${s}-hls/${w.label}/${p}`,path:P}),f+=x.segmentCount||Math.ceil(g/u)}catch(x){console.warn(`[stx-media] Failed to generate HLS for ${w.label}: ${x}`)}}if(l.length===0)return null;let b=V(h,"master.m3u8"),S=X(l,c,o,s);return await q(b,S),{manifestUrl:`${c}/${o}-${s}-hls/master.m3u8`,manifestPath:b,playlists:l,segmentCount:f,duration:g}}catch(i){return console.warn(`[stx-media] Failed to generate HLS manifest: ${i}`),null}}function X(t,e,a,c){let r=["#EXTM3U","#EXT-X-VERSION:3"];for(let n of t){let{quality:i}=n,s=i.bitrate+(i.audioBitrate||128000),o=`${i.width}x${i.height||Math.round(i.width*9/16)}`;r.push(`#EXT-X-STREAM-INF:BANDWIDTH=${s},RESOLUTION=${o},NAME="${i.label}"`,`${i.label}/${i.label}.m3u8`)}return r.join(`
|
|
3
|
+
`)}async function zr(t,e,a,c,r){let n=await z();if(!n)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let i=E(t);if(!await k(i))return null;let s=await R(i),o=F(t,W(t)),h=V(a,`${o}-${s}-dash`);await T(h,{recursive:!0});let y=e.length>0?e:j,u=r?.segmentDuration||4,m=r?.minBufferTime||2,l=(await new n.Input(i).getInfo()).duration||0,f=[],b=[];for(let p of y){let P=V(h,p.label);await T(P,{recursive:!0});try{if(await n.generateDASH(i,{outputDir:P,segmentDuration:u,width:p.width,height:p.height,videoBitrate:p.bitrate,audioBitrate:p.audioBitrate})){if(f.push({bandwidth:p.bitrate,width:p.width,height:p.height||Math.round(p.width*9/16),url:`${c}/${o}-${s}-dash/${p.label}/video`}),p.audioBitrate)b.push({bandwidth:p.audioBitrate,url:`${c}/${o}-${s}-dash/${p.label}/audio`})}}catch(x){console.warn(`[stx-media] Failed to generate DASH for ${p.label}: ${x}`)}}if(f.length===0)return null;let S=V(h,"manifest.mpd"),w=G(f,b,l,u,m);await q(S,w);let C=[{type:"video",representations:f}];if(b.length>0)C.push({type:"audio",representations:b});return{manifestUrl:`${c}/${o}-${s}-dash/manifest.mpd`,manifestPath:S,adaptationSets:C,duration:l}}catch(i){return console.warn(`[stx-media] Failed to generate DASH manifest: ${i}`),null}}function G(t,e,a,c,r){let n=I(a),i=I(r),s=`<?xml version="1.0" encoding="UTF-8"?>
|
|
4
4
|
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
|
|
5
5
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
6
6
|
xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
|
|
@@ -26,4 +26,4 @@ import{T,k,Wt,qt,Gt}from"./chunk-xfpfs9zq.js";import{resolve as Q,basename as J,
|
|
|
26
26
|
</Representation>
|
|
27
27
|
`}s+=` </AdaptationSet>
|
|
28
28
|
`}return s+=` </Period>
|
|
29
|
-
</MPD>`,s}function I(t){let e=Math.floor(t/3600),a=Math.floor(t%3600/60),c=Math.floor(t%60),r="PT";if(e>0)r+=`${e}H`;if(a>0)r+=`${a}M`;return r+=`${c}S`,r}async function O(){try{return await import("ts-videos")}catch{return null}}function ee(t){switch(t){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function te(t){switch(t){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function
|
|
29
|
+
</MPD>`,s}function I(t){let e=Math.floor(t/3600),a=Math.floor(t%3600/60),c=Math.floor(t%60),r="PT";if(e>0)r+=`${e}H`;if(a>0)r+=`${a}M`;return r+=`${c}S`,r}async function O(){try{return await import("ts-videos")}catch{return null}}function ee(t){switch(t){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function te(t){switch(t){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function Co(t){let e=await O();if(!e)return null;try{let a=Q(t),r=await new e.Input(a).getInfo();return{duration:r.duration||0,width:r.width||0,height:r.height||0,frameRate:r.frameRate||0,bitrate:r.bitrate||0,codec:r.videoCodec||"",audioCodec:r.audioCodec}}catch(a){return console.warn(`[stx-media] Failed to analyze video: ${a}`),null}}async function Ea(t,e,a,c){let r=await O();if(!r)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:t,processed:!1};let n=await Nr(t,e,a);if(n)return n;try{let i=Q(t);if(!await k(i))return{src:t,processed:!1,errors:[`Source file not found: ${t}`]};let s=a.outputDir||"dist/videos",o=a.baseUrl||"/videos";await Z(s,{recursive:!0});let h=await R(i),y=J(t,K(t)),u={src:t,processed:!0,hash:h};c?.({percentage:5,stage:"analyzing"}),u.metadata=await Co(i)||void 0;let m={};if(e.quality)m.bitrate=ee(e.quality);if(e.platform)Object.assign(m,te(e.platform));if(e.transcode)Object.assign(m,e.transcode);if(Object.keys(m).length>0||e.process){c?.({percentage:10,stage:"transcoding"});let d=`${y}-${h}.mp4`,g=Y(s,d);try{let l=await ae(i,g,m,r,(f)=>c?.({percentage:10+f*0.5,stage:"transcoding"}));if(l)u.transcoded={path:g,url:`${o}/${d}`,duration:l.duration,size:l.size,video:{codec:m.codec||"h264",width:l.width,height:l.height,bitrate:l.bitrate,frameRate:l.frameRate},audio:l.audioCodec?{codec:m.audioCodec||"aac",bitrate:m.audioBitrate||128000,sampleRate:m.sampleRate||48000,channels:m.channels||2}:void 0}}catch(l){u.errors=u.errors||[],u.errors.push(`Transcoding failed: ${l}`)}}if(e.generatePoster){c?.({percentage:65,stage:"generating-poster"});let d=typeof e.generatePoster==="object"?e.generatePoster:{timestamp:0},g=await jr(i,d,s,o);if(g)u.poster=g}if(a.thumbnails?.enabled){c?.({percentage:70,stage:"generating-thumbnails"});let d=await Br(i,a.thumbnails,s,o);if(d.length>0)u.thumbnails=d}if(e.streaming){c?.({percentage:80,stage:"generating-manifests"});let d=typeof e.streaming==="object"?e.streaming:a.streaming||{format:"hls"};if(d.format==="hls"||d.format===void 0){let g=await Fr(i,d.qualities||a.streaming?.defaultQualities||[],s,o);if(g)u.streaming={...u.streaming,hls:g}}if(d.format==="dash"){let g=await zr(i,d.qualities||a.streaming?.defaultQualities||[],s,o);if(g)u.streaming={...u.streaming,dash:g}}}if(e.spriteSheet)c?.({percentage:90,stage:"generating-sprite-sheet"});return c?.({percentage:100,stage:"complete"}),await Lr(t,e,u,a),u}catch(i){return{src:t,processed:!1,errors:[`Processing failed: ${i}`]}}}async function ae(t,e,a,c,r){try{let i=await new c.Conversion(t,e,{videoCodec:a.codec,videoBitrate:a.bitrate,width:a.maxWidth,height:a.maxHeight,frameRate:a.frameRate,audioCodec:a.audioCodec,audioBitrate:a.audioBitrate,sampleRate:a.sampleRate,channels:a.channels}).run((s)=>{r?.(s.percentage/100)});return{duration:i.duration||0,size:i.size||0,width:i.width||a.maxWidth||0,height:i.height||a.maxHeight||0,bitrate:i.bitrate||a.bitrate||0,frameRate:i.frameRate||a.frameRate||30,audioCodec:i.audioCodec}}catch(n){return console.error(`[stx-media] Transcoding failed: ${n}`),null}}export{Mr,Nr,Lr,Ca,jr,Br,_a,Fr,zr,Co,Ea};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function m(e,t={}){return{enterFrom:t.enterClass||`${e}-enter-from`,enterActive:t.enterActiveClass||`${e}-enter-active`,enterTo:t.enterToClass||`${e}-enter-to`,leaveFrom:t.leaveClass||`${e}-leave-from`,leaveActive:t.leaveActiveClass||`${e}-leave-active`,leaveTo:t.leaveToClass||`${e}-leave-to`}}function u(e){let t=getComputedStyle(e),o=t.transitionDuration||"0s",n=t.animationDuration||"0s",s=(a)=>{let i=a.match(/^([\d.]+)(s|ms)?$/);if(!i)return 0;let r=parseFloat(i[1]);return(i[2]||"s")==="ms"?r:r*1000};return Math.max(s(o),s(n))}function v(e,t){return new Promise((o)=>{let n=t??u(e);if(n===0){o();return}let s=!1,a=()=>{if(s)return;s=!0,e.removeEventListener("transitionend",i),e.removeEventListener("animationend",i),o()},i=(r)=>{if(r.target===e)a()};e.addEventListener("transitionend",i),e.addEventListener("animationend",i),setTimeout(a,n+50)})}function f(e){e.offsetHeight}async function
|
|
2
|
+
function m(e,t={}){return{enterFrom:t.enterClass||`${e}-enter-from`,enterActive:t.enterActiveClass||`${e}-enter-active`,enterTo:t.enterToClass||`${e}-enter-to`,leaveFrom:t.leaveClass||`${e}-leave-from`,leaveActive:t.leaveActiveClass||`${e}-leave-active`,leaveTo:t.leaveToClass||`${e}-leave-to`}}function u(e){let t=getComputedStyle(e),o=t.transitionDuration||"0s",n=t.animationDuration||"0s",s=(a)=>{let i=a.match(/^([\d.]+)(s|ms)?$/);if(!i)return 0;let r=parseFloat(i[1]);return(i[2]||"s")==="ms"?r:r*1000};return Math.max(s(o),s(n))}function v(e,t){return new Promise((o)=>{let n=t??u(e);if(n===0){o();return}let s=!1,a=()=>{if(s)return;s=!0,e.removeEventListener("transitionend",i),e.removeEventListener("animationend",i),o()},i=(r)=>{if(r.target===e)a()};e.addEventListener("transitionend",i),e.addEventListener("animationend",i),setTimeout(a,n+50)})}function f(e){e.offsetHeight}async function Xl(e,t={}){let o=t.name||"stx",n=m(o,t),s=typeof t.duration==="object"?t.duration.enter:t.duration;if(t.onBeforeEnter?.(e),e.classList.add(n.enterFrom),e.classList.add(n.enterActive),f(e),e.classList.remove(n.enterFrom),e.classList.add(n.enterTo),t.onEnter)await new Promise((a)=>{t.onEnter(e,a)});else await v(e,s);e.classList.remove(n.enterActive),e.classList.remove(n.enterTo),t.onAfterEnter?.(e)}async function Kl(e,t={}){let o=t.name||"stx",n=m(o,t),s=typeof t.duration==="object"?t.duration.leave:t.duration;if(t.onBeforeLeave?.(e),e.classList.add(n.leaveFrom),e.classList.add(n.leaveActive),f(e),e.classList.remove(n.leaveFrom),e.classList.add(n.leaveTo),t.onLeave)await new Promise((a)=>{t.onLeave(e,a)});else await v(e,s);e.classList.remove(n.leaveActive),e.classList.remove(n.leaveTo),t.onAfterLeave?.(e)}function Jl(e,t={},o){let n=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return e.replace(n,(s,a,i)=>{let r=p(a),l=r.name||"stx",c=r.duration||300,d=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
|
|
3
3
|
<div
|
|
4
4
|
class="stx-transition-wrapper"
|
|
5
5
|
data-transition="${l}"
|
|
@@ -41,7 +41,7 @@ function m(e,t={}){return{enterFrom:t.enterClass||`${e}-enter-from`,enterActive:
|
|
|
41
41
|
});
|
|
42
42
|
})();
|
|
43
43
|
</script>
|
|
44
|
-
`})}function p(e){let t={},o=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,n;while((n=o.exec(e))!==null){let s=n[1],a=n[2]||n[3]||n[4]||n[5];switch(s){case"name":t.name=a;break;case"duration":t.duration=parseInt(a,10);break;case"mode":t.mode=a;break;case"easing":t.easing=a;break}}return t}function
|
|
44
|
+
`})}function p(e){let t={},o=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,n;while((n=o.exec(e))!==null){let s=n[1],a=n[2]||n[3]||n[4]||n[5];switch(s){case"name":t.name=a;break;case"duration":t.duration=parseInt(a,10);break;case"mode":t.mode=a;break;case"easing":t.easing=a;break}}return t}function Yl(){return`
|
|
45
45
|
/* STX Transition Presets */
|
|
46
46
|
|
|
47
47
|
/* Fade */
|
|
@@ -228,7 +228,7 @@ function m(e,t={}){return{enterFrom:t.enterClass||`${e}-enter-from`,enterActive:
|
|
|
228
228
|
opacity: 1;
|
|
229
229
|
max-height: 1000px;
|
|
230
230
|
}
|
|
231
|
-
`}function
|
|
231
|
+
`}function Zl(){return`
|
|
232
232
|
// STX Transition Runtime
|
|
233
233
|
(function() {
|
|
234
234
|
if (typeof window === 'undefined') return;
|
|
@@ -317,5 +317,5 @@ else {
|
|
|
317
317
|
|
|
318
318
|
console.log('[stx] Transition runtime initialized');
|
|
319
319
|
})();
|
|
320
|
-
`}function
|
|
321
|
-
export{
|
|
320
|
+
`}function Ql(e){let t=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return e.replace(t,(o,n,s,a)=>{let i=s||"300",r=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${n}" data-stx-transition-duration="${i}" data-stx-transition-condition="${a}" data-stx-transition-id="${r}"`})}
|
|
321
|
+
export{Xl,Kl,Jl,Yl,Zl,Ql};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var l=null,k=[],a=0,v=new Set;function b(){return l}function y(e){let n=l;return k.push(e),l=e,n}function T(e){k.pop(),l=e}var m=new WeakMap;function A(e,n){m.set(e,n)}function f(e,n){for(let t of e){let i=m.get(t);if(i)i(n);else n.add(t)}}function g(e){if(a>0){f(e,v);return}let n=new Set;f(e,n);for(let t of n)t()}function D(e){a++;try{e()}finally{if(a--,a===0){let n=[...v];v.clear();for(let t of n)t()}}}function C(e){let n=l;l=null;try{return e()}finally{l=n}}var S=[],d=[];function
|
|
3
|
-
export{
|
|
2
|
+
var l=null,k=[],a=0,v=new Set;function b(){return l}function y(e){let n=l;return k.push(e),l=e,n}function T(e){k.pop(),l=e}var m=new WeakMap;function A(e,n){m.set(e,n)}function f(e,n){for(let t of e){let i=m.get(t);if(i)i(n);else n.add(t)}}function g(e){if(a>0){f(e,v);return}let n=new Set;f(e,n);for(let t of n)t()}function D(e){a++;try{e()}finally{if(a--,a===0){let n=[...v];v.clear();for(let t of n)t()}}}function C(e){let n=l;l=null;try{return e()}finally{l=n}}var S=[],d=[];function W(e){let n=e,t=new Set,i=new Set,o=()=>{let r=b();if(r)i.add(r);return n};return o.set=(r)=>{if(!Object.is(r,n)){let c=n;n=r,t.forEach((s)=>{try{s(n,c)}catch(u){console.error("[stx] subscriber error:",u)}}),g(i)}},o.update=(r)=>{o.set(r(n))},o.subscribe=(r)=>(t.add(r),()=>t.delete(r)),Object.defineProperty(o,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(o,"value",{get:()=>o(),set:(r)=>o.set(r),configurable:!0}),o}function Ln(e){let n,t=!0,i=new Set,o=()=>{if(!t)t=!0,g(i)};A(o,(c)=>{if(!t)t=!0,f(i,c)});let r=()=>{let c=b();if(c)i.add(c);if(t){let s=y(o);try{n=e()}finally{T(s)}t=!1}return n};return Object.defineProperty(r,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(r,"value",{get:()=>r(),configurable:!0}),r}function Yt(e,n={}){let t,i=!1,o=()=>{if(i)return;if(t){let c=t;t=void 0;try{c()}catch(s){console.error("[stx] effect cleanup error:",s)}}let r=y(o);try{let c=e();t=typeof c==="function"?c:void 0}catch(c){i=!0,console.error("[stx] effect error (the effect is disposed):",c)}finally{T(r)}};if(n.immediate!==!1)o();return()=>{if(i=!0,t){let r=t;t=void 0,r()}}}function Ur(e){D(e)}function Vr(e){S.push(e)}function jn(e){d.push(e)}function fd(){w(S,"onMount",d)}function gd(){w(d,"onDestroy")}function w(e,n,t){let i=e.splice(0,e.length);for(let o of i)try{let r=o();if(t&&typeof r==="function")t.push(r)}catch(r){console.error(`[stx] ${n} callback threw:`,r)}}function md(){return{mount:S.length,destroy:d.length}}function Zt(e){return typeof e==="function"&&e._isSignal===!0}function Qt(e){return typeof e==="function"&&e._isDerived===!0}function Wr(e){if(Zt(e)||Qt(e))return e();return e}function Bn(e){return C(e)}function hd(e,n){let t=typeof e==="function"?e:()=>e,i=W([]),o=Ln(()=>i().reduce((s,u)=>n(s,u.action),t())),r=!1;return Yt(()=>{if(t(),!r){r=!0;return}if(Bn(()=>i().length))i.set([])}),[o,(s,u)=>{let x={action:s};i.set([...i(),x]);let p=()=>{let h=i().filter((O)=>O!==x);if(h.length!==i().length)i.set(h)};if(u&&typeof u.then==="function")Promise.resolve(u).then(p,p);return p}]}
|
|
3
|
+
export{W,Ln,Yt,Ur,Vr,jn,fd,gd,md,Zt,Qt,Wr,Bn,hd};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{B,F,z,Bt,Q,ae,Mn,ma,Oe,gt,Ft,zt,Ht,H,Ut,Vt,Nn}from"./chunk-zyk12484.js";import"./chunk-qt3x1sh3.js";export{F as DEFAULT_FORMATS,z as DEFAULT_QUALITY,B as DEFAULT_WIDTHS,Nn as ImageProcessingError,Vt as formatSize,gt as generateSizes,Oe as generateSrcSet,Ft as getFallbackVariant,Mn as getImageMetadata,H as getMimeType,Ut as getTotalSize,zt as groupVariantsByFormat,Q as isImageBackendAvailable,Ht as isImageFile,Bt as isSharpAvailable,ae as processImage,ma as resizeAndConvert};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{
|
|
2
|
+
import{H}from"./chunk-zyk12484.js";import R from"fs";import g from"path";import C from"crypto";var S=new Set(["webp","avif","jpeg","png"]),T=new Set(["cover","contain","fill","inside","outside"]),q=new Set([".jpg",".jpeg",".png",".webp",".avif",".gif"]),k=4096,D=80,U="cover";async function xo(e,t){let r=t.routePath??"/_stx/img",h=new URL(e.url);if(h.pathname!==r)return null;let a=A(h,t);if(!a.ok)return new Response(a.error,{status:a.status,headers:{"Content-Type":"text/plain"}});let{srcFsPath:n,srcUrl:d,width:l,height:i,format:s,quality:u,fit:c}=a,m;try{m=R.statSync(n)}catch{return new Response(`Source image not found: ${d}`,{status:404,headers:{"Content-Type":"text/plain"}})}if(!m.isFile())return new Response("Not a file",{status:404,headers:{"Content-Type":"text/plain"}});let w=t.cacheDir??".stx/cache/img";await R.promises.mkdir(w,{recursive:!0});let b=`${n}:${m.mtimeMs}:${m.size}`,I=`${l}x${i}:${s}:${u}:${c}`,f=C.createHash("sha256").update(`${b}|${I}`).digest("hex").slice(0,16),o=g.join(w,`${f}.${s}`),p={"Content-Type":H(s),"Cache-Control":"public, max-age=31536000, immutable",ETag:`"${f}"`,"X-Stx-Image-Cache":"HIT"};if(e.headers.get("if-none-match")===`"${f}"`)return new Response(null,{status:304,headers:p});let v=Bun.file(o);if(await v.exists())return new Response(v,{headers:p});try{let x=Buffer.from(await Bun.file(n).arrayBuffer()),{resizeAndConvert:P}=await L(),F=await P(x,{width:l,height:i,format:s,quality:u,fit:c});return await Bun.write(o,F),p["X-Stx-Image-Cache"]="MISS",new Response(new Uint8Array(F),{headers:p})}catch(x){let P=x.message;return new Response(`Image processing failed: ${P}`,{status:500,headers:{"Content-Type":"text/plain"}})}}function ga(e){return async(t)=>await xo(t,e)??new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain"}})}function A(e,t){let r=e.searchParams.get("src");if(!r)return{ok:!1,error:"Missing required param: src",status:400};if(!r.startsWith("/"))return{ok:!1,error:"src must be an absolute URL path (start with /)",status:400};if(r.startsWith("//"))return{ok:!1,error:"src must be a local path",status:400};let h=g.extname(r).toLowerCase();if(!q.has(h))return{ok:!1,error:`Unsupported source extension: ${h}`,status:400};let a=g.resolve(t.publicDir),n=g.resolve(a,r.slice(1));if(!n.startsWith(`${a}${g.sep}`)&&n!==a)return{ok:!1,error:"src is outside publicDir",status:400};let d=t.maxWidth??k,l=t.maxHeight??k,i=e.searchParams.get("w"),s=e.searchParams.get("h"),u=i?Number.parseInt(i,10):0,c=s?Number.parseInt(s,10):0;if(i&&(!Number.isFinite(u)||u<=0))return{ok:!1,error:"Invalid w (must be positive integer)",status:400};if(s&&(!Number.isFinite(c)||c<=0))return{ok:!1,error:"Invalid h (must be positive integer)",status:400};if(!i&&!s)return{ok:!1,error:"At least one of w or h is required",status:400};let m=Math.min(u||d,d),w=Math.min(c||l,l),b=e.searchParams.get("f")||"webp";if(!S.has(b))return{ok:!1,error:`Invalid f (must be one of: ${[...S].join(", ")})`,status:400};let I=b,f=e.searchParams.get("q"),o=f?Number.parseInt(f,10):t.defaultQuality??D;if(!Number.isFinite(o)||o<1||o>100)return{ok:!1,error:"Invalid q (must be 1-100)",status:400};let y=e.searchParams.get("fit")||t.defaultFit||U;if(!T.has(y))return{ok:!1,error:`Invalid fit (must be one of: ${[...T].join(", ")})`,status:400};return{ok:!0,srcFsPath:n,srcUrl:r,width:m,height:w,format:I,quality:o,fit:y}}async function L(){return await import("./chunk-b894fxfc.js")}
|
|
3
|
+
export{xo,ga};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var w={black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",brightRed:"\x1B[91m",brightGreen:"\x1B[92m",brightYellow:"\x1B[93m",brightBlue:"\x1B[94m",brightMagenta:"\x1B[95m",brightCyan:"\x1B[96m",brightWhite:"\x1B[97m"},R={bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",inverse:"\x1B[7m",strikethrough:"\x1B[9m"};function p(e,t){return`${w[t]}${e}\x1B[0m`}function C(e,t){return`${R[t]}${e}\x1B[0m`}var b=(e)=>p(e,"red"),S=(e)=>p(e,"green"),y=(e)=>p(e,"yellow"),O=(e)=>p(e,"blue");var c=(e)=>p(e,"cyan");var a=(e)=>C(e,"bold"),m=(e)=>C(e,"dim");function lt(){console.log(""),console.log(c(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),console.log(c(" \u2551")+a(" \uD83D\uDCD6 STX Story ")+c("\u2551")),console.log(c(" \u2551")+m(" Component Showcase & Testing ")+c("\u2551")),console.log(c(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),console.log("")}function
|
|
3
|
-
export{lt,
|
|
2
|
+
var w={black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",brightRed:"\x1B[91m",brightGreen:"\x1B[92m",brightYellow:"\x1B[93m",brightBlue:"\x1B[94m",brightMagenta:"\x1B[95m",brightCyan:"\x1B[96m",brightWhite:"\x1B[97m"},R={bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",inverse:"\x1B[7m",strikethrough:"\x1B[9m"};function p(e,t){return`${w[t]}${e}\x1B[0m`}function C(e,t){return`${R[t]}${e}\x1B[0m`}var b=(e)=>p(e,"red"),S=(e)=>p(e,"green"),y=(e)=>p(e,"yellow"),O=(e)=>p(e,"blue");var c=(e)=>p(e,"cyan");var a=(e)=>C(e,"bold"),m=(e)=>C(e,"dim");function lt(){console.log(""),console.log(c(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),console.log(c(" \u2551")+a(" \uD83D\uDCD6 STX Story ")+c("\u2551")),console.log(c(" \u2551")+m(" Component Showcase & Testing ")+c("\u2551")),console.log(c(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),console.log("")}function wr(e,t){if(console.log(a(" Server running at:")),console.log(""),console.log(` ${m("\u279C")} ${a("Local:")} ${c(e)}`),t)console.log(` ${m("\u279C")} ${a("Network:")} ${c(t)}`);console.log("")}function dt(e){let t=e>0?"\u2713":"\u25CB",r=e>0?S:y;console.log(` ${r(t)} Found ${a(String(e))} story ${e===1?"file":"files"}`)}function Ks(e,t){if(console.log(""),console.log(` ${b("\u2717")} ${a(b("Error:"))} ${e}`),t)console.log(` ${m(t)}`);console.log("")}function Te(e){console.log(` ${y("\u26A0")} ${y("Warning:")} ${e}`)}function Js(e){console.log(` ${O("\u2139")} ${e}`)}function Ys(e,t,r){console.log(""),console.log(c(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),console.log(c(" \u2551")+a(" Build Complete ")+c("\u2551")),console.log(c(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),console.log(""),console.log(` ${S("\u2713")} Stories: ${a(String(e))}`),console.log(` ${S("\u2713")} Output: ${a(t)}`),console.log(` ${S("\u2713")} Time: ${a(`${r}ms`)}`),console.log("")}function vr(){console.log(""),console.log(a(" Keyboard Shortcuts:")),console.log(""),console.log(` ${c("h")} Show this help`),console.log(` ${c("o")} Open in browser`),console.log(` ${c("r")} Restart server`),console.log(` ${c("c")} Clear console`),console.log(` ${c("q")} Quit`),console.log("")}import h from"fs";import d from"path";async function ut(e){let{root:t,config:r}=e,o=[],i=await P(t,r.storyMatch,r.storyIgnored);for(let s of i){let n=d.resolve(t,s),l=v(s,n);o.push(l)}return o}async function P(e,t,r){let o=[];async function i(s,n){let l=await h.promises.readdir(s,{withFileTypes:!0});for(let g of l){let f=d.join(s,g.name),u=d.relative(n,f);if(T(u,r))continue;if(g.isDirectory())await i(f,n);else if(g.isFile()){if(F(u,t))o.push(u)}}}return await i(e,e),o}function T(e,t){for(let r of t)if(E(e,r))return!0;return!1}function F(e,t){for(let r of t)if(E(e,r))return!0;return!1}function E(e,t){let r=e.replace(/\\/g,"/"),i=t.replace(/\\/g,"/").replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"{{GLOBSTAR}}").replace(/\*/g,"[^/]*").replace(/\?/g,".").replace(/\{\{GLOBSTAR\}\}/g,".*");return i=`^${i}$`,new RegExp(i).test(r)}function v(e,t){let r=d.basename(e,".story.stx");return{id:e.toLowerCase().replace(/\.story\.stx$/,"").replace(/[/\\]/g,"-").replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""),path:t,relativePath:e,fileName:r,treeFile:{title:r,path:e}}}function Zs(e,t){let{root:r,config:o}=e,i=[],s=h.watch(r,{recursive:!0},async(n,l)=>{if(!l)return;let g=l.replace(/\\/g,"/");if(!F(g,o.storyMatch))return;if(T(g,o.storyIgnored))return;let f=d.resolve(r,g);try{await h.promises.access(f);let u=v(g,f);t(n==="rename"?"add":"change",u)}catch{let u=v(g,f);t("unlink",u)}});return i.push(s),()=>{for(let n of i)n.close()}}function N(e,t){let r=t.treeFile||{title:t.fileName,path:t.relativePath};if(e.tree.file==="title")return r.title.split("/");if(e.tree.file==="path")return[...t.relativePath.split("/").slice(0,-1),r.title];if(typeof e.tree.file==="function")return e.tree.file(r);return[r.title]}function pt(e,t){for(let n of t)n.treePath=N(e,n);let r=(e.tree.groups||[]).map((n)=>({groupConfig:{id:n.id||n.title,title:n.title,include:n.include},treeObject:{}})),o={treeObject:{}};r.push(o);for(let n=0;n<t.length;n++){let l=t[n],g=j(l,r,o);k(l.treePath,n,g.treeObject)}let i=e.tree.order==="asc"?(n,l)=>n.localeCompare(l):e.tree.order,s=[];for(let n of r)if(n===o)s.push(...x(n.treeObject,i));else if(n.groupConfig&&Object.keys(n.treeObject).length>0)s.push({group:!0,id:n.groupConfig.id,title:n.groupConfig.title,children:x(n.treeObject,i)});return s}function j(e,t,r){let o=e.treeFile||{title:e.fileName,path:e.relativePath};for(let i of t)if(i.groupConfig?.include&&i.groupConfig.include(o))return i;return r}function k(e,t,r){let o=r;for(let i=0;i<e.length;i++){let s=e[i];if(i===e.length-1)if(o[s]!==void 0){let l=1;while(o[`${s}-${l}`]!==void 0)l++;o[`${s}-${l}`]=t}else o[s]=t;else{if(o[s]===void 0)o[s]={};else if(typeof o[s]==="number"){let l=o[s];o[s]={"":l}}o=o[s]}}}function x(e,t){let r=[];for(let[o,i]of Object.entries(e))if(typeof i==="number")r.push({title:o,index:i});else r.push({title:o,children:x(i,t)});return r.sort((o,i)=>t(o.title,i.title)),r}
|
|
3
|
+
export{lt,wr,dt,Ks,Te,Js,Ys,vr,ut,Zs,pt};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Hr,Ul,Vl}from"./chunk-mzqyv7s5.js";import"./chunk-dcpf6kas.js";import"./chunk-79vdkvhf.js";import"./chunk-2z0trbbm.js";import"./chunk-f4jh9vrj.js";import"./chunk-pnag11c4.js";import"./chunk-vp31ff54.js";import"./chunk-tv784gv0.js";import"./chunk-rrj5m9xv.js";import"./chunk-rfnr4xz6.js";import"./chunk-36agnyhe.js";import"./chunk-sfwprq8q.js";import"./chunk-ydx3mfpp.js";import"./chunk-s12b57m9.js";import"./chunk-k7ht6tqe.js";import"./chunk-phzs239m.js";import"./chunk-1edvsndv.js";export{Vl as clearComposableCache,Ul as getComposableScript,Hr as listComposableModules};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Broadcast as s,BroadcastServer as h}from"ts-broadcasting";import{channel as
|
|
3
|
-
export{
|
|
2
|
+
import{Broadcast as s,BroadcastServer as h}from"ts-broadcasting";import{channel as Cl}from"ts-broadcasting";import{Broadcast as _l,BroadcastServer as El}from"ts-broadcasting";var e=null,u=[];function hl(){return e}async function yl(n){if(e)return e;let t=n.driver??"bun",r=n.host??"0.0.0.0",c=n.port??6001,l=n.scheme??"ws",a={verbose:n.verbose??!1,driver:t,default:t,connections:{[t]:{driver:t,host:r,port:c,scheme:l}}};return e=new h(a),s.setServer(e),await e.start(),e}async function bl(){for(let n of u)clearInterval(n);if(u.length=0,!e)return;await e.stop(),e=null}async function wl(n){let t=await import(n),r=t.default??t;if(typeof r!=="function")throw Error(`routes/channels.ts must export a default function, got ${typeof r}`);let c=0;return r({channel(a,o){if(c++,o.authorize&&e)e.channels.channel(a,o.authorize);if(o.interval&&o.data){let d=o.event??`${a}.updated`,p=o.data,v=setInterval(async()=>{try{let g=await p();fa(a,d,g)}catch{}},o.interval);u.push(v)}}}),c}var f=!1;function i(){if(e)return!0;if(!f)f=!0,console.warn("[stx] broadcast() called before server started \u2014 messages will be sent once broadcasting is ready");return!1}function fa(n,t,r){if(!i())return;s.send(n,t,r)}function vl(n,t,r){if(!i())return;s.toUser(n,t,r)}function xl(n,t,r){if(!i())return;s.toUsers(n,t,r)}function Sl(n,t,r){if(!i())return;s.send(`private-${n}`,t,r)}function kl(n,t,r){if(!i())return;s.presence(n,t,r)}
|
|
3
|
+
export{hl,yl,bl,wl,fa,vl,xl,Sl,kl,Cl,_l,El};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function
|
|
2
|
+
function _o(v,c){let{itemHeight:l,containerHeight:u,overscan:s=3,keyProperty:b="id",dynamicHeight:d=!1,estimatedItemHeight:g=l,direction:x="vertical"}=c,e=[...v],t=0,n=new Map;function f(){if(d)return h();let i=Math.max(0,Math.floor(t/l)-s),r=Math.ceil(u/l),m=Math.min(e.length-1,i+r+s*2);return{startIndex:i,endIndex:m}}function h(){let i=0,r=0,m=e.length-1;for(let p=0;p<e.length;p++){let M=n.get(p)||g;if(i+M>t){r=Math.max(0,p-s);break}i+=M}i=0;for(let p=0;p<e.length;p++){let M=n.get(p)||g;if(i+=M,i>t+u){m=Math.min(e.length-1,p+s);break}}return{startIndex:r,endIndex:m}}function w(){if(d){let i=0;for(let r=0;r<e.length;r++)i+=n.get(r)||g;return i}return e.length*l}function y(i){if(d){let r=0;for(let m=0;m<i;m++)r+=n.get(m)||g;return r}return i*l}function S(){let{startIndex:i,endIndex:r}=f();return{startIndex:i,endIndex:r,scrollTop:t,totalHeight:w(),visibleItems:e.slice(i,r+1),itemHeights:new Map(n)}}function L(i,r="auto"){let m=y(i);a(m,r)}function a(i,r="auto"){t=Math.max(0,Math.min(i,w()-u))}function o(){f()}function H(i){e=[...i],n.clear(),o()}function I(){e=[],n.clear()}return{scrollToIndex:L,scrollToOffset:a,getState:S,refresh:o,setItems:H,destroy:I}}function Eo(v,c={},l){let u=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return v.replace(u,(s,b,d,g)=>{let x=b.trim(),e=c[x];if(!e||!Array.isArray(e))return`<!-- virtualList: items "${x}" not found or not an array -->`;let t={itemHeight:50,containerHeight:400,overscan:3};if(d)try{let a=d.trim(),o=Function(`return ${a}`)();t={...t,...o}}catch{}let n=`vlist-${Math.random().toString(36).substring(2,9)}`,f=Math.ceil(t.containerHeight/t.itemHeight),h=t.overscan||3,w=0,y=Math.min(e.length-1,f+h),S="";for(let a=w;a<=y&&a<e.length;a++){let o=e[a],H=g.replace(/\{\{\s*item\s*\}\}/g,typeof o==="object"?JSON.stringify(o):String(o)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(I,i)=>{if(typeof o==="object"&&o!==null)return String(o[i]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(a));S+=`
|
|
3
3
|
<div class="virtual-item ${t.itemClass||""}"
|
|
4
4
|
style="position: absolute; top: ${a*t.itemHeight}px; height: ${t.itemHeight}px; width: 100%;"
|
|
5
5
|
data-index="${a}">
|
|
@@ -76,7 +76,7 @@ function ko(v,c){let{itemHeight:l,containerHeight:u,overscan:s=3,keyProperty:b="
|
|
|
76
76
|
};
|
|
77
77
|
})();
|
|
78
78
|
</script>
|
|
79
|
-
`})}function
|
|
79
|
+
`})}function Ta(){return`
|
|
80
80
|
.virtual-list-container {
|
|
81
81
|
position: relative;
|
|
82
82
|
overflow-y: auto;
|
|
@@ -124,7 +124,7 @@ function ko(v,c){let{itemHeight:l,containerHeight:u,overscan:s=3,keyProperty:b="
|
|
|
124
124
|
0% { background-position: 200% 0; }
|
|
125
125
|
100% { background-position: -200% 0; }
|
|
126
126
|
}
|
|
127
|
-
`}function
|
|
127
|
+
`}function $a(v,c){let l=null,u=()=>{if(!l)l=_o(v(),c);return l};return{visibleItems:()=>u().getState().visibleItems,totalHeight:()=>u().getState().totalHeight,containerProps:()=>({style:{height:`${c.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(s)=>{let b=s.target;if(l)l.scrollToOffset(b.scrollTop)}}),itemProps:(s)=>({style:{position:"absolute",top:`${s*c.itemHeight}px`,height:`${c.itemHeight}px`,width:"100%"},"data-index":s}),scrollToIndex:(s)=>{u().scrollToIndex(s)}}}function Ra(v,c={},l){let u=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return v.replace(u,(s,b,d,g,x)=>{let e=b.trim(),t=c[e];if(!t||!Array.isArray(t))return`<!-- infiniteList: items "${e}" not found or not an array -->`;let n={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(d)try{let w=Function(`return ${d.trim()}`)();n={...n,...w}}catch{}let f=`ilist-${Math.random().toString(36).substring(2,9)}`,h=Eo(`@virtualList(${e}, ${JSON.stringify({itemHeight:n.itemHeight,containerHeight:n.containerHeight,overscan:n.overscan,containerClass:n.containerClass})})${g}@endvirtualList`,c);return h=h.replace("</script>",`
|
|
128
128
|
// Infinite scroll detection
|
|
129
129
|
container.addEventListener('scroll', function() {
|
|
130
130
|
const scrollBottom = container.scrollTop + container.clientHeight;
|
|
@@ -142,7 +142,7 @@ function ko(v,c){let{itemHeight:l,containerHeight:u,overscan:s=3,keyProperty:b="
|
|
|
142
142
|
${x}
|
|
143
143
|
</div>
|
|
144
144
|
</div>
|
|
145
|
-
`})}function
|
|
145
|
+
`})}function Aa(v,c={},l){let u=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return v.replace(u,(s,b,d,g)=>{let x=b.trim(),e=c[x];if(!e||!Array.isArray(e))return`<!-- virtualGrid: items "${x}" not found or not an array -->`;let t={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(d)try{let o=Function(`return ${d.trim()}`)();t={...t,...o}}catch{}let n=`vgrid-${Math.random().toString(36).substring(2,9)}`,f=Math.ceil(e.length/t.columns),h=f*(t.rowHeight+(t.gap||0)),w=Math.ceil(t.containerHeight/(t.rowHeight+(t.gap||0))),y=t.overscan||2,S=0,L=Math.min(f-1,w+y),a="";for(let o=S;o<=L;o++)for(let H=0;H<t.columns;H++){let I=o*t.columns+H;if(I>=e.length)break;let i=e[I],r=H*(100/t.columns),m=o*(t.rowHeight+(t.gap||0)),p=g.replace(/\{\{\s*item\s*\}\}/g,typeof i==="object"?JSON.stringify(i):String(i)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(M,T)=>{if(typeof i==="object"&&i!==null)return String(i[T]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(I));a+=`
|
|
146
146
|
<div class="virtual-grid-item"
|
|
147
147
|
style="position: absolute; top: ${m}px; left: ${r}%; width: calc(${100/t.columns}% - ${t.gap||0}px); height: ${t.rowHeight}px;"
|
|
148
148
|
data-index="${I}">
|
|
@@ -212,5 +212,5 @@ function ko(v,c){let{itemHeight:l,containerHeight:u,overscan:s=3,keyProperty:b="
|
|
|
212
212
|
});
|
|
213
213
|
})();
|
|
214
214
|
</script>
|
|
215
|
-
`})}var
|
|
216
|
-
export{
|
|
215
|
+
`})}var Bl={createVirtualList:_o,processVirtualListDirectives:Eo,processInfiniteListDirectives:Ra,processVirtualGridDirectives:Aa,generateVirtualListCSS:Ta,useVirtualList:$a};
|
|
216
|
+
export{_o,Eo,Ta,$a,Ra,Aa,Bl};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Un,cc,jd,lc,Bd,dc,Vn,b,_t,we,uc,os,pc,Fd,K,fc,zd,x,Hd}from"./chunk-f4jh9vrj.js";import"./chunk-pnag11c4.js";import"./chunk-vp31ff54.js";import"./chunk-tv784gv0.js";import"./chunk-rrj5m9xv.js";import"./chunk-rfnr4xz6.js";import"./chunk-36agnyhe.js";import"./chunk-sfwprq8q.js";import"./chunk-ydx3mfpp.js";import"./chunk-s12b57m9.js";import"./chunk-k7ht6tqe.js";import"./chunk-phzs239m.js";import"./chunk-1edvsndv.js";export{fc as applyFilters,Bd as clearCustomFilters,uc as clientLoopScopes,Un as defaultFilters,b as escapeHtml,_t as escapeHtmlValue,x as evaluateExpression,dc as findMustacheEnd,lc as getAllFilters,pc as interpolateScriptAttributes,os as interpolateScriptExpressions,Fd as interpolateScriptsInTemplate,K as processExpressions,cc as registerFilter,jd as registerFilters,Vn as replaceInterpolations,zd as resetRejectedExpressionWarnings,Hd as unescapeHtml,we as usesSignalsInScript};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{St,Jr,Yr,Zr,Nd,Qr}from"./chunk-79vdkvhf.js";import"./chunk-tv784gv0.js";import"./chunk-rfnr4xz6.js";import"./chunk-phzs239m.js";export{Yr as buildServerApi,Nd as createServerApi,St as discoverServerApi,Jr as generateApiTypes,Qr as isServerApiSource,Zr as productionApiDispatcher};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{o}from"./chunk-
|
|
3
|
-
export{
|
|
2
|
+
import{o}from"./chunk-f4jh9vrj.js";import{Pr}from"./chunk-jze68d0z.js";import p from"path";async function Tl(t={}){let d=performance.now(),s=t.root||process.cwd(),e=await o(s),u=t.ssr?.routeRules??e.routeRules??{};if(Pr(u),!e.ssr&&Object.keys(u).length)throw Error("routeRules require ssr: true and the production server; flat SSG output cannot apply request/cache policies");if(!e.ssr&&(t.ssr?.serverApi??e.serverApi))throw Error("serverApi requires ssr: true; flat SSG output cannot execute API endpoints");let r=e.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${r.toUpperCase()}${e.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let n,l;if(r==="ssg"){let{generateStaticSite:i}=await import("./ssg.js");n=await i({pagesDir:p.join(e.root||".",e.pagesDir||e.build?.pagesDir||"pages"),publicDir:e.publicDir||e.build?.publicDir||"public",outputDir:e.build?.outputDir||"dist",generate404:e.build?.generate404??!0,minify:e.build?.minify??!0,cleanOutput:e.build?.cleanOutput??!0,router:e.router,...t.ssg})}else{let{buildForProduction:i}=await import("./chunk-2jsnrfc8.js");l=await i({root:s,outputDir:".output",debug:t.debug,...t.ssr})}let a=Math.round(performance.now()-d);return{mode:r,ssg:n,ssr:l,duration:a}}
|
|
3
|
+
export{Tl};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{rn,de}from"./chunk-2z0trbbm.js";import{m,sn,w,Be,o,P}from"./chunk-f4jh9vrj.js";import{Qr}from"./chunk-79vdkvhf.js";import{s,xe}from"./chunk-74xwzxwz.js";import{a}from"./chunk-0g2ybnht.js";import h from"path";import v from"fs";var pe=10;function J(e,n,i){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(h.basename(e))||Qr(e,n,i)}var ne=1,re=new Map,V=600,fe=100,W=new Map;async function me(e){let n=W.get(e)??0;if(n>0&&n<fe){W.set(e,n+1);return}W.set(e,1);try{let i=(await v.promises.readdir(e)).filter((c)=>c.endsWith(".js"));if(i.length<=V)return;let g=(await Promise.all(i.map(async(c)=>{try{return{name:c,at:(await v.promises.stat(h.join(e,c))).mtimeMs}}catch{return null}}))).filter((c)=>c!==null);g.sort((c,l)=>l.at-c.at);for(let c of g.slice(V)){let l=c.name.slice(0,-3);await v.promises.rm(h.join(e,`${l}.js`),{force:!0}),await v.promises.rm(h.join(e,`${l}.deps.json`),{force:!0})}R("pruned bundle cache to",V,"entries")}catch{}}function le(e){return re.get(e)??[]}function X(e,n){if(e)re.set(e,n)}function tc(e=process.env){return e.STX_DEBUG==="true"||e.STX_DEBUG==="1"}function R(...e){if(tc())console.log("[stx:bundler]",...e)}var Z=[];function Go(e,n,i){Z.push({filePath:e||"<inline>",message:n,details:i})}function bt(){return Z.slice()}function wt(){Z.length=0}var q;function Md(e){q=e}function Xo(){if(q)return q;try{let e=P.strict;return typeof e==="object"&&e!==null?e.bundlerFallback??"warn":"warn"}catch{return"warn"}}var H=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function vt(e){let n=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,i;while((i=n.exec(e))!==null){let g=i[1];if(!H.some((l)=>l.test(g)))return R("detected user import:",g),!0}let u=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((i=u.exec(e))!==null){let g=i[1];if(/\.css(?:\?.*)?$/.test(g))continue;if(!H.some((l)=>l.test(g)))return R("detected side-effect import:",g),!0}return!1}var nn="stx-module:",ge=/\.(?:[cm]?[jt]sx?|json)$/i;function nc(e,n){return h.relative(e,n).split(h.sep).join("/")}function rc(e,n){if(n.size===0)return e;return e.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(i,u,g,c)=>{let l=n.get(c);return l&&!c.startsWith(nn)?`${u}${g}${l}${g}`:i})}function sc(e,n){let i=0,u=(c)=>{let l=`__stxMod${i++}`,S=JSON.stringify(c);return n.push(`var ${l} = globalThis.__stxModules && globalThis.__stxModules[${S}];`,`if (${l} === undefined) throw new Error("[stx] module " + ${JSON.stringify(S)} + " is not registered on this page (#1957)");`),l},g=(c,l)=>{for(let S of c.split(",")){let M=S.trim();if(!M)continue;let f=M.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!f)continue;let t=f[1].startsWith('"')?JSON.parse(f[1]):f[1],r=f[2]??t;n.push(`var ${r} = ${l}[${JSON.stringify(t)}];`)}};return e=e.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(c,l,S)=>{let M=S.slice(nn.length),f=u(M),t=l.trim(),r=t.match(/^([\w$]+)\s*(?:,\s*|$)/);if(r&&!t.startsWith("{")&&!t.startsWith("*"))n.push(`var ${r[1]} = ${f}.default;`),t=t.slice(r[0].length).trim();let d=t.match(/^\*\s*as\s+([\w$]+)$/);if(d)n.push(`var ${d[1]} = ${f};`);else if(t.startsWith("{"))g(t.replace(/^\{|\}$/g,""),f);return""}),e=e.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(c,l)=>(u(l.slice(nn.length)),"")),e}function ee(e){let n=[e,`${e}.ts`,`${e}.tsx`,`${e}.js`,`${e}.mjs`,`${e}.jsx`,h.join(e,"index.ts"),h.join(e,"index.tsx"),h.join(e,"index.js"),h.join(e,"index.mjs")];for(let i of n)try{if(v.existsSync(i)&&v.statSync(i,{throwIfNoEntry:!1})?.isFile())return i}catch{}return}function he(e,n,i,u,g,c=new Map,l){let S=(f,t,r)=>{if(J(t,e,l))return null;if(!g||f!==i||!ge.test(t))return null;try{if(!v.statSync(t,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}u.add(t);let d=`${nn}${nc(process.cwd(),t)}`;return c.set(r,d),{path:d,external:!0}},M=(f,t)=>{let r=f===i?n:h.dirname(f),d=h.resolve(r,t);return ee(d)??d};return{name:"stx-client-bundle",setup(f){if(f.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(t)=>({path:t.path,external:!0})),f.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(t)=>({path:t.path,external:!0})),f.onResolve({filter:/^\//},(t)=>{let r=ee(t.path);if(r){let d=S(t.importer,r,t.path);if(d)return d;if(r!==i)u.add(r);return{path:r}}return{path:t.path,external:!0}}),f.onResolve({filter:/^\.\.?\//},(t)=>{let r=M(t.importer,t.path),d=S(t.importer,r,t.path);if(d)return d;return u.add(r),{path:r}}),f.onResolve({filter:/^[@~]\//},(t)=>{let r=h.resolve(e,t.path.slice(2)),d=[r,`${r}.ts`,`${r}.tsx`,`${r}.js`,`${r}.mjs`,`${r}.jsx`,h.join(r,"index.ts"),h.join(r,"index.tsx"),h.join(r,"index.js"),h.join(r,"index.mjs")];for(let E of d)if(v.existsSync(E)&&v.statSync(E,{throwIfNoEntry:!1})?.isFile()){let O=S(t.importer,E,t.path);if(O)return O;return R(`resolved ${t.path[0]}/ import:`,t.path,"\u2192",E),u.add(E),{path:E}}return console.warn(`[stx:bundler] could not resolve ${t.path[0]}/ import:`,t.path),{path:r}}),g)f.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(t)=>{if(t.importer!==i)return;let r=`${nn}npm:${t.path}`;return c.set(t.path,r),{path:r,external:!0}});f.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(t)=>{if(J(t.path,e,l))throw Error(`Server-only API source cannot be imported by a client script: ${t.path}`);let r=h.extname(t.path).toLowerCase(),d=r===".json"?"json":r===".tsx"?"tsx":r===".jsx"?"jsx":r===".ts"||r===".mts"||r===".cts"?"ts":"js";if(t.path!==i)u.add(t.path);return{contents:v.readFileSync(t.path,"utf8"),loader:d}})}}}var G=new Map,k=m(64),te=Symbol.for("stx.client-bundle-build-queue");function oc(e){let n=globalThis,u=(n[te]??Promise.resolve()).then(e,e);return n[te]=u.then(()=>{return},()=>{return}),u}async function xt(e,n,i={}){let u=i.projectRoot||process.cwd(),g=(await o(u)).serverApi,c=i.minify??!1,l=i.externalizeUserModules??!0,S=i.expose?.length?[...new Set(i.expose)].sort():void 0,M=i.cacheDir||a(u,"bundle-cache"),f=new Bun.CryptoHasher("md5");f.update(`${pe}\x00${Be()}\x00${JSON.stringify(g??!1)}\x00${l?"registry":"inline"}\x00${S?S.join(","):"*"}\x00${c?"minified":"readable"}\x00${e}\x00${n}`);let t=f.digest("hex").slice(0,12),r=h.join(M,`${t}.js`),d=k.get(r);if(d){if(sn(d.files)&&d.files.every((A)=>!J(A.path,u,g))){R("memo hit:",t);let A=d.files.map((B)=>B.path);return X(n,A),i.collectInputs?.push(...A),d.code}k.delete(r),R("memo invalidated by dep change:",t)}let E=h.join(M,`${t}.deps.json`),O=Bun.file(r);if(await O.exists()){let A=Bun.file(E),B=!1,N=null;if(await A.exists())try{let D=JSON.parse(await A.text());if(D.metadataVersion!==ne||!Array.isArray(D.files))B=!1;else N=D.files,B=!0;if(N&&(!sn(N)||N.some((I)=>J(I.path,u,g))))B=!1}catch{B=!1}if(B){if(R("cache hit:",t),N)X(n,N.map((I)=>I.path)),i.collectInputs?.push(...N.map((I)=>I.path));let D=await O.text();if(N)k.set(r,{code:D,files:N});return D}R("cache invalidated by dep change:",t)}let _=G.get(t);if(_){let A=await _;if(i.collectInputs)i.collectInputs.push(...(k.get(r)?.files??[]).map((B)=>B.path));return A}let L=oc(()=>we(e,n,{projectRoot:u,minify:c,cacheDir:M,hash:t,cachePath:r,depsPath:E,collectInputs:i.collectInputs,externalizeUserModules:l,serverApi:g,expose:S,throwOnFailure:i.throwOnFailure}));G.set(t,L);try{return await L}finally{G.delete(t)}}var $e=0;function ic(e){return`${e}-${process.pid}-${++$e}`}async function we(e,n,i){let{projectRoot:u,minify:g,cacheDir:c,hash:l,cachePath:S,depsPath:M,externalizeUserModules:f}=i,t=a(u,"bundle-tmp"),r=ic(l),d=h.join(t,`${r}.ts`),E=h.join(t,"out",r);v.mkdirSync(t,{recursive:!0}),v.mkdirSync(E,{recursive:!0});let O=h.dirname(n),_=new Set,L=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,A=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,B=s(e),{depths:N,balanced:D}=xe(B),I=(j)=>!D||N[j]===0,y;while((y=L.exec(B))!==null){if(y[1])continue;if(!I(y.index))continue;if(y[2])y[2].split(",").forEach((j)=>{let p=ye(j);if(p)_.add(p)});else if(y[3])_.add(y[3])}while((y=A.exec(B))!==null){if(y[1])continue;if(!I(y.index))continue;_.add(y[2])}let se=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((y=se.exec(B))!==null){if(!I(y.index))continue;let j=/^\s*['"]([^'"]+)['"]/.exec(e.slice(y.index+y[0].length))?.[1];if(j&&H.some((p)=>p.test(j)))continue;if(y[1])_.add(y[1]);if(y[2])_.add(y[2]);for(let p of(y[3]??"").split(",")){let b=p.trim();if(!b||/^type\s/.test(b))continue;let T=/\bas\s+(\w+)\s*$/.exec(b)?.[1]??/^\w+$/.exec(b)?.[0];if(T)_.add(T)}}for(let j of B.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let p of j[1].split(",")){let b=/\bas\s+(\w+)\s*$/.exec(p)?.[1]??/^\s*(\w+)\s*$/.exec(p)?.[1];if(b)_.delete(b)}let ie=_.size>0?`
|
|
3
|
+
export { ${[..._].join(", ")} }`:"";await Bun.write(d,e+ie),R("bundling:",l,"from:",h.basename(n));let Y=new Set,Q=new Map;try{let j=await Bun.build({entrypoints:[d],outdir:E,target:"browser",format:"esm",minify:g?{whitespace:!1,identifiers:!0,syntax:!0}:!1,plugins:[he(u,O,d,Y,f,Q,i.serverApi)],define:{"process.env.NODE_ENV":g?'"production"':'"development"',...w()},root:u});if(!j.success){let F=j.logs.filter((C)=>C.level==="error").map((C)=>C.message).join(", ")||`Unable to bundle ${h.basename(n)}`,U=rn(j.logs,n||void 0);if(console.warn("[stx:bundler] build failed:",F),Go(n||"",F,U),i.throwOnFailure||Xo()==="error")throw Error(F);return e}let p="";for(let x of j.outputs){p=await x.text();break}let b=[];for(let x of p.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let F of x[1].split(",")){let U=F.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(U){b.push([U[2],U[1]]);continue}let C=F.trim();if(/^[A-Za-z_$][\w$]*$/.test(C))b.push([C,C])}if(i.expose){let x=new Set(i.expose);for(let F=b.length-1;F>=0;F--)if(!x.has(b[F][0]))b.splice(F,1)}let T=[];p=sc(rc(p,Q),T);let oe=p.match(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm)||[];if(p=p.replace(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),g&&p)try{p=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(p)}catch{}let K=`__stxBundle_${l}`,ae=b.map(([x,F])=>`${JSON.stringify(x)}: ${F}`).join(", "),ce=b.map(([x])=>`var ${x} = undefined;`).join(`
|
|
4
|
+
`),ue=b.map(([x])=>`${x} = ${K}[${JSON.stringify(x)}];`).join(`
|
|
5
|
+
`);if(p=`${oe.join(`
|
|
6
|
+
`)}
|
|
7
|
+
${ce}
|
|
8
|
+
var ${K} = (function() {
|
|
9
|
+
${T.join(`
|
|
10
|
+
`)}
|
|
11
|
+
${p}
|
|
12
|
+
return { ${ae} };
|
|
13
|
+
})();
|
|
14
|
+
${ue}`.trim(),R("bundled:",l,"output:",p.length,"bytes"),_.size>0&&b.length===0)return console.warn(`[stx:bundler] dropped every binding for ${h.basename(n)} (${l}); serving the unbundled source and not caching this result`),e;v.mkdirSync(c,{recursive:!0}),await Bun.write(S,p);let z=Array.from(Y).map((x)=>{try{return{path:x,mtimeMs:v.statSync(x).mtimeMs}}catch{return null}}).filter((x)=>x!==null);return await Bun.write(M,JSON.stringify({metadataVersion:ne,files:z})),X(n,z.map((x)=>x.path)),i.collectInputs?.push(...z.map((x)=>x.path)),k.set(S,{code:p,files:z}),await me(c),p}catch(j){let p=rn(j,n||void 0),b=de(j,n||void 0);if(console.warn(`[stx:bundler] error: ${b}`),Go(n||"",b,p),i.throwOnFailure||Xo()==="error")throw j;return e}finally{try{v.rmSync(d,{force:!0}),v.rmSync(E,{recursive:!0,force:!0})}catch{}}}function ye(e){let n=e.trim();if(!n)return null;let i=n.indexOf("=");if(i!==-1)n=n.slice(0,i).trim();let u=n.indexOf(":");if(u!==-1)n=n.slice(u+1).trim();if(n.startsWith("..."))n=n.slice(3).trim();return/^[A-Za-z_$][\w$]*$/.test(n)?n:null}
|
|
15
|
+
export{le,tc,Go,bt,wt,Md,Xo,vt,nn,nc,rc,sc,oc,xt,ic};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{hl,yl,bl,wl,fa,vl,xl,Sl,kl,Cl,_l,El}from"./chunk-bpdsdbvg.js";export{_l as Broadcast,El as BroadcastServer,fa as broadcast,kl as broadcastPresence,Sl as broadcastPrivate,Cl as channel,hl as getBroadcastServer,wl as loadChannels,yl as startBroadcasting,bl as stopBroadcasting,vl as toUser,xl as toUsers};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ta,co,na,ra,lo,sa,oa,ia,aa,uo,ca,dl}from"./chunk-4easd8da.js";import{xo,ga}from"./chunk-b9r88ysg.js";import{B,F,z,Bt,Q,ae,Mn,Oe,gt,Ft,zt,Ht,H,Ut,Vt,Nn}from"./chunk-zyk12484.js";import{Wa}from"./chunk-pveafhzg.js";import"./chunk-qt3x1sh3.js";export{F as DEFAULT_FORMATS,z as DEFAULT_QUALITY,B as DEFAULT_WIDTHS,Nn as ImageProcessingError,ra as clearImageCache,lo as createImageDirective,ga as createImageHandler,oa as createImagePlugin,dl as defaultImageConfig,Vt as formatSize,uo as generateImageManifest,gt as generateSizes,Oe as generateSrcSet,Ft as getFallbackVariant,Mn as getImageMetadata,H as getMimeType,Ut as getTotalSize,zt as groupVariantsByFormat,xo as handleImageRequest,sa as imageDirective,Q as isImageBackendAvailable,Ht as isImageFile,Bt as isSharpAvailable,aa as optimizeDirectory,ia as optimizeImage,co as parseImageComponent,ae as processImage,na as processImageComponents,ta as renderImageComponent,Wa as rewriteImagesWithSiblings,ca as writeImageManifest};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Tl}from"./chunk-cyg9w31a.js";import"./chunk-f4jh9vrj.js";import"./chunk-pnag11c4.js";import"./chunk-vp31ff54.js";import"./chunk-tv784gv0.js";import"./chunk-rrj5m9xv.js";import"./chunk-rfnr4xz6.js";import"./chunk-36agnyhe.js";import"./chunk-sfwprq8q.js";import"./chunk-ydx3mfpp.js";import"./chunk-s12b57m9.js";import"./chunk-k7ht6tqe.js";import"./chunk-phzs239m.js";import"./chunk-1edvsndv.js";export{Tl as buildApp};
|