@stacksjs/stx 0.2.674 → 0.2.675
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-szevd7d5.js → chunk-028e9fty.js} +2 -2
- package/dist/{chunk-5vt48yce.js → chunk-03hhanvm.js} +9 -9
- package/dist/{chunk-rr527jt6.js → chunk-078qg8r5.js} +2 -2
- package/dist/{chunk-zmg1peyg.js → chunk-09gchq7d.js} +3 -3
- package/dist/chunk-0gk78x3r.js +2 -0
- package/dist/{chunk-mwnhdsbp.js → chunk-0thxpgtp.js} +2 -2
- package/dist/{chunk-fw413k9q.js → chunk-1b9thkg5.js} +2 -2
- package/dist/chunk-1s2y6f4b.js +2 -0
- package/dist/chunk-1wdawkn8.js +2 -0
- package/dist/chunk-248a88mc.js +2 -0
- package/dist/{chunk-nj343mw2.js → chunk-29wj0c68.js} +5 -5
- package/dist/chunk-2nqtmp8c.js +2 -0
- package/dist/chunk-2pga7zzb.js +4 -0
- package/dist/chunk-2xv29pfj.js +11 -0
- package/dist/{chunk-md2jn67b.js → chunk-374nhgyf.js} +2 -2
- package/dist/chunk-3vwkyjan.js +421 -0
- package/dist/chunk-3wsm9g9c.js +2 -0
- package/dist/chunk-3xx9d934.js +2 -0
- package/dist/chunk-41q5rww8.js +2 -0
- package/dist/chunk-4c5tk71j.js +2 -0
- package/dist/chunk-4e5jrxbn.js +14 -0
- package/dist/{chunk-ham5x7ts.js → chunk-4fhbh04h.js} +4 -4
- package/dist/chunk-4x5dk7a4.js +2 -0
- package/dist/{chunk-hz4x7h0n.js → chunk-54fazdmn.js} +5 -5
- package/dist/chunk-57ege36s.js +2 -0
- package/dist/{chunk-z22zy22p.js → chunk-5fh9m8fm.js} +2 -2
- package/dist/chunk-5n4c99y5.js +2 -0
- package/dist/{chunk-rdr09efy.js → chunk-5z0q3qv3.js} +5 -5
- package/dist/{chunk-6sjtyd0k.js → chunk-5z8mq37c.js} +4 -4
- package/dist/{chunk-p6qd7ad0.js → chunk-5zvrbms2.js} +2 -2
- package/dist/{chunk-ce6zddpf.js → chunk-6beg47t4.js} +2 -2
- package/dist/chunk-6kam8r5y.js +2 -0
- package/dist/{chunk-kdebh22m.js → chunk-6ncvb8gp.js} +10 -10
- package/dist/{chunk-srq9fqq8.js → chunk-6qh2mx6q.js} +38 -38
- package/dist/chunk-6rftdp7c.js +2 -0
- package/dist/{chunk-tddnb5bv.js → chunk-6ycyaf5g.js} +2 -2
- package/dist/chunk-7475sm3m.js +2 -0
- package/dist/{chunk-pb6erpj3.js → chunk-78x52gz3.js} +5 -5
- package/dist/{chunk-zp79zkkd.js → chunk-78yjmbbs.js} +2 -2
- package/dist/{chunk-v21bhhjb.js → chunk-7j7h1eg3.js} +1 -1
- package/dist/{chunk-4bgjrrvz.js → chunk-7q699phs.js} +1 -1
- package/dist/chunk-7s6hypn5.js +2 -0
- package/dist/chunk-7ym269yp.js +2 -0
- package/dist/{chunk-d1a86qx8.js → chunk-81rdyz2n.js} +1 -1
- package/dist/chunk-855h3crg.js +2 -0
- package/dist/chunk-8an7vcxx.js +2 -0
- package/dist/{chunk-bkkpq8dx.js → chunk-8jdbrcgt.js} +10 -10
- package/dist/{chunk-w7t2cfgy.js → chunk-8md2707p.js} +66 -66
- package/dist/chunk-8p92r2sc.js +2 -0
- package/dist/{chunk-rym0309c.js → chunk-8xxc5edr.js} +3 -3
- package/dist/{chunk-trz8z4j4.js → chunk-93z9f2be.js} +37 -37
- package/dist/{chunk-r7fdw2v5.js → chunk-97h9ga3b.js} +3 -3
- package/dist/chunk-9859r1d5.js +2 -0
- package/dist/{chunk-aet1pgw7.js → chunk-9azagdq6.js} +74 -74
- package/dist/{chunk-25zmy8q6.js → chunk-9wdd7eq6.js} +2 -2
- package/dist/{chunk-t0k16vqv.js → chunk-9ybjsfyp.js} +2 -2
- package/dist/chunk-ammn4wbd.js +2 -0
- package/dist/chunk-arh1qgmp.js +2 -0
- package/dist/{chunk-qz5b8ed4.js → chunk-bh19ezq0.js} +5 -5
- package/dist/chunk-bpf3xxng.js +3 -0
- package/dist/chunk-c2rq9pap.js +2 -0
- package/dist/chunk-cfm6a679.js +2 -0
- package/dist/{chunk-hegfgw27.js → chunk-cxgremn0.js} +5 -5
- package/dist/chunk-dasxbb9y.js +2 -0
- package/dist/{chunk-sqn3y9qt.js → chunk-db5017x8.js} +2 -2
- package/dist/{chunk-hgry3mjd.js → chunk-dba795e1.js} +1 -1
- package/dist/{chunk-7adznted.js → chunk-dera8fmc.js} +2 -2
- package/dist/chunk-e02ne8zd.js +2 -0
- package/dist/chunk-e492je6q.js +2 -0
- package/dist/{chunk-v6peecfp.js → chunk-e4ezpevb.js} +2 -2
- package/dist/chunk-etbpzmxv.js +4 -0
- package/dist/{chunk-4s8zacxg.js → chunk-f26n6y9p.js} +4 -4
- package/dist/chunk-fqa5ej45.js +2 -0
- package/dist/{chunk-dgc1a3yt.js → chunk-fzc98qgn.js} +7 -7
- package/dist/{chunk-4w6baw62.js → chunk-g98gafg7.js} +2 -2
- package/dist/chunk-gc4w2s5n.js +31 -0
- package/dist/{chunk-hb3edeq9.js → chunk-ggf4z3bv.js} +6 -6
- package/dist/chunk-ggwvnpwj.js +2 -0
- package/dist/chunk-gx6wxmbv.js +2 -0
- package/dist/chunk-hamk3dky.js +2 -0
- package/dist/{chunk-vayhx642.js → chunk-haz2ezyk.js} +2 -2
- package/dist/chunk-hfbkbrwk.js +130 -0
- package/dist/chunk-hg0dd64a.js +2 -0
- package/dist/chunk-hh58k0nh.js +3 -0
- package/dist/chunk-hz5eh77e.js +2 -0
- package/dist/chunk-hz8dj5jy.js +21 -0
- package/dist/{chunk-9dtbvjpp.js → chunk-j6x7ryyn.js} +11 -11
- package/dist/{chunk-d09q93yf.js → chunk-jv021x8e.js} +2 -2
- package/dist/{chunk-pg2v1pb5.js → chunk-k06n5bjp.js} +3 -3
- package/dist/{chunk-35ezh7de.js → chunk-k72jqz6a.js} +3 -3
- package/dist/chunk-kqbpkg8n.js +2 -0
- package/dist/{chunk-bsajk82t.js → chunk-kzb04293.js} +19 -19
- package/dist/{chunk-5zhp87wv.js → chunk-mabja59q.js} +2 -2
- package/dist/chunk-mf19qxgv.js +3 -0
- package/dist/{chunk-fd49fahd.js → chunk-mn47s2ef.js} +5 -5
- package/dist/{chunk-hsmcbh0p.js → chunk-mvz825w0.js} +5 -5
- package/dist/chunk-n615cbxq.js +2 -0
- package/dist/chunk-nv0jjhtd.js +2 -0
- package/dist/chunk-nvbyscdh.js +20 -0
- package/dist/chunk-nw44qq6h.js +24 -0
- package/dist/{chunk-s0vtjyyj.js → chunk-p6g58hwg.js} +2 -2
- package/dist/chunk-prc5dxp1.js +2 -0
- package/dist/{chunk-am2w363p.js → chunk-q3gactm1.js} +4 -4
- package/dist/{chunk-w3d98907.js → chunk-q4rejyd2.js} +2 -2
- package/dist/{chunk-7j1zgrnf.js → chunk-q7tfqavs.js} +9 -9
- package/dist/{chunk-4b9s7wgy.js → chunk-qdkwg2b8.js} +2 -2
- package/dist/{chunk-a4p18ybc.js → chunk-qr7a378v.js} +3 -3
- package/dist/chunk-qwdgx34g.js +2 -0
- package/dist/chunk-r6t1712p.js +2 -0
- package/dist/{chunk-cbjabv1w.js → chunk-ram7pa4k.js} +6 -6
- package/dist/{chunk-thceyzj6.js → chunk-rza1p6e4.js} +2 -2
- package/dist/chunk-s5q9ztvj.js +2 -0
- package/dist/chunk-s8qe247r.js +2 -0
- package/dist/chunk-sfpymq5h.js +2 -0
- package/dist/chunk-shft9r9d.js +2 -0
- package/dist/{chunk-6s7tvmqp.js → chunk-sr3hmrah.js} +2 -2
- package/dist/chunk-sswy3tfc.js +2 -0
- package/dist/chunk-swxznm5v.js +2 -0
- package/dist/chunk-t8tst3sk.js +2 -0
- package/dist/chunk-t9bsgbwv.js +3 -0
- package/dist/chunk-tst8p27s.js +12 -0
- package/dist/chunk-tz09earb.js +2 -0
- package/dist/{chunk-ck2e3e47.js → chunk-vd5w1jaz.js} +3 -3
- package/dist/chunk-vf6yaymh.js +2 -0
- package/dist/{chunk-xghcsg3f.js → chunk-vg1pg6yt.js} +1 -1
- package/dist/chunk-w0vpvcj0.js +2 -0
- package/dist/{chunk-s2wptfm1.js → chunk-wav0xbnb.js} +2 -2
- package/dist/{chunk-t9kxhe46.js → chunk-wr1gm35v.js} +1 -1
- package/dist/{chunk-faakv1p6.js → chunk-wscnjtss.js} +2 -2
- package/dist/{chunk-asezs2n3.js → chunk-wtvy9r5w.js} +6 -6
- package/dist/{chunk-t79jfpv6.js → chunk-x4q4bx3q.js} +2 -2
- package/dist/{chunk-y1pcdeg9.js → chunk-x7wr720m.js} +5 -5
- package/dist/chunk-xayfz35c.js +2 -0
- package/dist/{chunk-yx3dpdwc.js → chunk-xdn6rtq2.js} +3 -3
- package/dist/chunk-xh5mh8kn.js +2 -0
- package/dist/chunk-xna6b7km.js +2 -0
- package/dist/chunk-xrrx2ddz.js +2 -0
- package/dist/{chunk-fbmth6xv.js → chunk-xtnxvmdb.js} +13 -13
- package/dist/chunk-xw4rm5zj.js +2 -0
- package/dist/{chunk-5qtthtg3.js → chunk-yaccg2c0.js} +7 -7
- package/dist/chunk-yar7fwrb.js +2 -0
- package/dist/{chunk-2zzc7006.js → chunk-yn9kvsk1.js} +2 -2
- package/dist/chunk-yt33wzqk.js +2 -0
- package/dist/{chunk-j6m8xqh3.js → chunk-z17sy8g3.js} +2 -2
- package/dist/chunk-z4bfgvb3.js +25 -0
- package/dist/chunk-z6mrnh98.js +2 -0
- package/dist/chunk-zq7xbc1k.js +2 -0
- package/dist/cli.js +22 -22
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/native/compiler/headwind-to-style.js +13 -1
- package/dist/native/compiler/html-to-ir.d.ts +2 -0
- package/dist/native/compiler/html-to-ir.js +9 -0
- package/dist/native/compiler/ir.d.ts +1 -0
- package/dist/native/compiler/render-screen.js +4 -3
- package/dist/native/compiler/style-config.d.ts +3 -0
- package/dist/native/compiler/style-config.js +5 -0
- package/dist/native/components/primitives.d.ts +2 -0
- package/dist/native/event-names.js +2 -0
- package/dist/native/prop-names.js +1 -0
- package/dist/native/runtime/craft-bridge.js +15 -8
- package/dist/pwa.js +3 -3
- package/dist/signal-processing.js +75 -16
- package/dist/ssg-static-paths.d.ts +12 -0
- package/dist/ssg-static-paths.js +62 -0
- package/dist/ssg.d.ts +2 -4
- package/dist/ssg.js +43 -47
- package/dist/utils.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-0jwdcqj8.js +0 -2
- package/dist/chunk-0mwdq478.js +0 -2
- package/dist/chunk-0nfqgv4n.js +0 -4
- package/dist/chunk-1y6egkty.js +0 -2
- package/dist/chunk-280p4q7a.js +0 -2
- package/dist/chunk-2881tcqt.js +0 -2
- package/dist/chunk-2a775q7x.js +0 -2
- package/dist/chunk-2asdbd5e.js +0 -2
- package/dist/chunk-34yj93hh.js +0 -2
- package/dist/chunk-40tswfe7.js +0 -21
- package/dist/chunk-41de209e.js +0 -2
- package/dist/chunk-506mv7hb.js +0 -3
- package/dist/chunk-5s1ay9mv.js +0 -2
- package/dist/chunk-7kznee1g.js +0 -2
- package/dist/chunk-7mvz972c.js +0 -12
- package/dist/chunk-80zgyaqe.js +0 -2
- package/dist/chunk-84tqb1rn.js +0 -2
- package/dist/chunk-8azm7nha.js +0 -2
- package/dist/chunk-902qnyg0.js +0 -2
- package/dist/chunk-9n6jwcpb.js +0 -2
- package/dist/chunk-a6y8td0d.js +0 -2
- package/dist/chunk-a7kt1ts4.js +0 -2
- package/dist/chunk-a81y8g40.js +0 -2
- package/dist/chunk-aft1zc84.js +0 -2
- package/dist/chunk-bawq4fqy.js +0 -31
- package/dist/chunk-bdp2r0v4.js +0 -2
- package/dist/chunk-brtvm8mb.js +0 -2
- package/dist/chunk-bvzr9zqt.js +0 -2
- package/dist/chunk-cbvgtf3m.js +0 -2
- package/dist/chunk-cfydbaeq.js +0 -2
- package/dist/chunk-dq8c3h4n.js +0 -2
- package/dist/chunk-e36pne7n.js +0 -2
- package/dist/chunk-e62qfexp.js +0 -2
- package/dist/chunk-eq5jzaj5.js +0 -2
- package/dist/chunk-f9zyf9n6.js +0 -421
- package/dist/chunk-fb7t1nn9.js +0 -24
- package/dist/chunk-fr39emcz.js +0 -2
- package/dist/chunk-fsq13amm.js +0 -2
- package/dist/chunk-fxh12vqd.js +0 -2
- package/dist/chunk-gcc9fa33.js +0 -2
- package/dist/chunk-h6t2ney6.js +0 -2
- package/dist/chunk-hvtzw1jh.js +0 -2
- package/dist/chunk-j8g5cvvm.js +0 -2
- package/dist/chunk-jzjpyyw2.js +0 -2
- package/dist/chunk-k1b8x73j.js +0 -2
- package/dist/chunk-nw9bdk2n.js +0 -2
- package/dist/chunk-p4jkswz8.js +0 -2
- package/dist/chunk-p4r90vqf.js +0 -2
- package/dist/chunk-p8bgy5tt.js +0 -2
- package/dist/chunk-pqqe2b6m.js +0 -11
- package/dist/chunk-q6nwcav4.js +0 -2
- package/dist/chunk-qmqavdz2.js +0 -2
- package/dist/chunk-qpw72bty.js +0 -2
- package/dist/chunk-qwnh1kj6.js +0 -2
- package/dist/chunk-qy9m6qdn.js +0 -2
- package/dist/chunk-qychcdsm.js +0 -2
- package/dist/chunk-rj3w1ama.js +0 -2
- package/dist/chunk-rv39s5az.js +0 -20
- package/dist/chunk-sf0r963g.js +0 -2
- package/dist/chunk-ss820yys.js +0 -2
- package/dist/chunk-t4j9g2vh.js +0 -2
- package/dist/chunk-trh7s6k3.js +0 -130
- package/dist/chunk-ttemwrbx.js +0 -2
- package/dist/chunk-twqzn21x.js +0 -14
- package/dist/chunk-v14rq8b4.js +0 -3
- package/dist/chunk-vdxg7e1y.js +0 -4
- package/dist/chunk-vq513cxx.js +0 -2
- package/dist/chunk-vvq8xe3n.js +0 -2
- package/dist/chunk-w8t31bn9.js +0 -2
- package/dist/chunk-x1kz4d7j.js +0 -2
- package/dist/chunk-xaa36b0x.js +0 -3
- package/dist/chunk-xcsyqwxf.js +0 -25
- package/dist/chunk-xn9jrjzh.js +0 -2
- package/dist/chunk-z97bwx8m.js +0 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{M,I,
|
|
3
|
-
`)}async function
|
|
2
|
+
import{M,I,Sr,kr,_r}from"./chunk-rza1p6e4.js";import{resolve as k,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 ri{config;constructor(t={}){this.config={...N,...t}}async get(t,e){return Sr(t,e,"video",this.config)}async set(t,e,a){return kr(t,e,a,"video",this.config)}async clear(){return _r("video",this.config)}updateConfig(t){this.config={...this.config,...t}}}var V=null;function T(t){if(!V)V=new ri(t);else if(t)V.updateConfig(t);return V}async function si(t,e,a){let c=a?{directory:`${a.outputDir}/../.cache`}:{};return T(c).get(t,e)}async function oi(t,e,a,c){let r=c?{directory:`${c.outputDir}/../.cache`}:{};return T(r).set(t,e,a)}async function Tu(){return T().clear()}import{resolve as B,basename as _,extname as D,join as v}from"path";import{mkdir as A}from"fs/promises";async function L(){try{return await import("ts-videos")}catch{return null}}async function ii(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=B(t);if(!await I(n))return null;await A(a,{recursive:!0});let i=await M(n),s=_(t,D(t)),o=e.format||"webp",h=e.timestamp||0,y=`${s}-poster-${i}.${o}`,u=v(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 ai(t,e,a,c){let r=await L();if(!r)return[];try{let n=B(t);if(!await I(n))return[];await A(a,{recursive:!0});let i=await M(n),s=_(t,D(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||v(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 $u(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=B(t);if(!await I(n))return null;await A(a,{recursive:!0});let i=await M(n),s=_(t,D(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=v(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:v(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 F,basename as W,extname as q,join as R}from"path";import{mkdir as H,writeFile as z}from"fs/promises";async function j(){try{return await import("ts-videos")}catch{return null}}var Q=[{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 ci(t,e,a,c,r){let n=await j();if(!n)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let i=F(t);if(!await I(i))return null;let s=await M(i),o=W(t,q(t)),h=R(a,`${o}-${s}-hls`);await H(h,{recursive:!0});let y=e.length>0?e:Q,u=r?.segmentDuration||6,g=(await new n.Input(i).getInfo()).duration||0,l=[],f=0;for(let w of y){let C=R(h,w.label);await H(C,{recursive:!0});let p=`${w.label}.m3u8`,P=R(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=R(h,"master.m3u8"),S=X(l,c,o,s);return await z(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 li(t,e,a,c,r){let n=await j();if(!n)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let i=F(t);if(!await I(i))return null;let s=await M(i),o=W(t,q(t)),h=R(a,`${o}-${s}-dash`);await H(h,{recursive:!0});let y=e.length>0?e:Q,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=R(h,p.label);await H(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=R(h,"manifest.mpd"),w=G(f,b,l,u,m);await z(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=E(a),i=E(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{M,I,wr,xr,Sr}from"./chunk-thceyzj6.js";import{resolve as k,basename as J,
|
|
|
26
26
|
</Representation>
|
|
27
27
|
`}s+=` </AdaptationSet>
|
|
28
28
|
`}return s+=` </Period>
|
|
29
|
-
</MPD>`,s}function E(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 E(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 kc(t){let e=await O();if(!e)return null;try{let a=k(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 Ru(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 si(t,e,a);if(n)return n;try{let i=k(t);if(!await I(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 M(i),y=J(t,K(t)),u={src:t,processed:!0,hash:h};c?.({percentage:5,stage:"analyzing"}),u.metadata=await kc(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 ii(i,d,s,o);if(g)u.poster=g}if(a.thumbnails?.enabled){c?.({percentage:70,stage:"generating-thumbnails"});let d=await ai(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 ci(i,d.qualities||a.streaming?.defaultQualities||[],s,o);if(g)u.streaming={...u.streaming,hls:g}}if(d.format==="dash"){let g=await li(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 oi(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{ri,si,oi,Tu,ii,ai,$u,ci,li,kc,Ru};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{M,I,
|
|
2
|
+
import{M,I,Sr,kr,_r}from"./chunk-rza1p6e4.js";import{resolve as z,basename as j,extname as T,join as q}from"path";import{mkdir as k}from"fs/promises";var S={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0};class ei{config;constructor(e={}){this.config={...S,...e}}async get(e,s){return Sr(e,s,"image",this.config)}async set(e,s,r){return kr(e,s,r,"image",this.config)}async clear(){return _r("image",this.config)}updateConfig(e){this.config={...this.config,...e}}}var w=null;function x(e){if(!w)w=new ei(e);else if(e)w.updateConfig(e);return w}async function ti(e,s,r){let t=r?{directory:`${r.outputDir}/../.cache`}:{};return x(t).get(e,s)}async function ni(e,s,r,t){let a=t?{directory:`${t.outputDir}/../.cache`}:{};return x(a).set(e,s,r)}async function Su(){return x().clear()}async function R(){try{return await import("ts-images")}catch{return null}}function F(e){switch(e){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function E(e,s){let r=s?F(s):F("web"),t=e.formatQuality||{};return{jpeg:{...r.jpeg,...t.jpeg},png:{...r.png,...t.png},webp:{...r.webp,...t.webp},avif:{...r.avif,...t.avif}}}async function ku(e,s,r){let t=await R();if(!t)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:e,processed:!1};let a=await ti(e,s,r);if(a)return a;try{let c=z(e);if(!await I(c))return{src:e,processed:!1,errors:[`Source file not found: ${e}`]};let n=E(r,s.preset),p=r.outputDir||"dist/images",P=r.baseUrl||"/images";await k(p,{recursive:!0});let d=await M(c),b=j(e,T(e)),C=s.outputFormat?[s.outputFormat]:r.defaultFormats||["avif","webp","jpeg"],o={src:e,processed:!0,variants:[],hash:d},u=null;if(s.transformations&&s.transformations.length>0)u=await Sc(c,s.transformations,t);for(let i of C){let l=n[i]||{},g=`${b}-${d}.${i}`,h=q(p,g);try{let m=await t.optimizeImage({input:u||c,output:h,format:i,quality:l.quality,progressive:l.progressive});if(m){if(o.variants.push({path:h,url:`${P}/${g}`,width:m.width||0,height:m.height||0,format:i,size:m.outputSize||0}),!o.originalWidth&&m.width)o.originalWidth=m.width,o.originalHeight=m.height}}catch(m){o.errors=o.errors||[],o.errors.push(`Failed to optimize ${i}: ${m}`)}}if(s.embedThumbhash||s.placeholder==="thumbhash")try{let i=await t.generateThumbHash(c);o.placeholder=i.dataUrl}catch(i){o.errors=o.errors||[],o.errors.push(`Failed to generate thumbhash: ${i}`)}if(s.useDominantColor)try{let i=await t.generatePlaceholder(c,{strategy:"dominant-color"});o.dominantColor=i.dominantColor}catch(i){o.errors=o.errors||[],o.errors.push(`Failed to extract dominant color: ${i}`)}return await ni(e,s,o,r),o}catch(c){return{src:e,processed:!1,errors:[`Processing failed: ${c}`]}}}async function _u(e,s,r,t){let a=await R();if(!a)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await a.optimizeImage({input:e,output:t,format:s,quality:r}))?.outputSize}}catch(c){return{success:!1,error:String(c)}}}async function Sc(e,s,r){let t=r||await R();if(!t)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let a=await t.decode(e);for(let c of s){let n=c.options||{};switch(c.type){case"resize":if(n.width||n.height)a=await t.resize(a,{width:n.width,height:n.height,fit:n.fit});break;case"blur":if(n.sigma!==void 0)a=await t.blur(a,n.sigma);break;case"sharpen":if(n.amount!==void 0)a=await t.sharpen(a,n.amount);break;case"grayscale":a=await t.grayscale(a);break;case"rotate":if(n.angle!==void 0)a=await t.rotate(a,n.angle);break;case"flip":a=await t.flip(a);break;case"flop":a=await t.flop(a);break;case"brightness":if(n.value!==void 0)a=await t.brightness(a,n.value);break;case"contrast":if(n.value!==void 0)a=await t.contrast(a,n.value);break;case"saturation":if(n.value!==void 0)a=await t.saturation(a,n.value);break}}return await t.encode(a,"png")}catch(a){return console.error(`[stx-media] Transformation failed: ${a}`),null}}import{resolve as D,basename as Q,extname as U,join as V}from"path";import{mkdir as L}from"fs/promises";async function H(){try{return await import("ts-images")}catch{return null}}var O=[320,480,640,768,1024,1280,1536,1920];async function Cu(e,s,r){let t=await H();if(!t)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let a=D(e);if(!await I(a))return console.warn(`[stx-media] Source file not found: ${e}`),null;try{let c=s.responsiveWidths||r.breakpoints||O,n=s.formats||r.defaultFormats||["avif","webp","jpeg"],p=r.outputDir||"dist/images",P=r.baseUrl||"/images";await L(p,{recursive:!0});let d=await M(a),b=Q(e,U(e)),C=r.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},o={src:e,byFormat:{},srcsets:{}};for(let i of n){o.byFormat[i]=[];let l=[];for(let g of c){let h=`${b}-${g}w-${d}.${i}`,m=V(p,h),y=`${P}/${h}`;try{let v=C[i]?.quality||80;if(await I(m)){o.byFormat[i].push({path:m,url:y,width:g,height:0,format:i,size:0}),l.push(`${y} ${g}w`);continue}let f=await t.processImage({input:a,output:m,format:i,quality:v,resize:{width:g}});if(f)o.byFormat[i].push({path:m,url:y,width:g,height:f.height||Math.round(g*(f.height||1)/(f.width||1)),format:i,size:f.outputSize||0}),l.push(`${y} ${g}w`)}catch(v){console.warn(`[stx-media] Failed to generate ${i} at ${g}w: ${v}`)}}o.srcsets[i]=l.join(", ")}let u=s.placeholder||r.placeholderStrategy||"thumbhash";if(u!=="none")try{if(u==="thumbhash"){let i=await t.generateThumbHash(a);o.placeholder={dataURL:i.dataUrl,width:i.width||32,height:i.height||32,strategy:"thumbhash"}}else{let i=await t.generatePlaceholder(a,{strategy:u,width:20});o.placeholder={dataURL:i.dataURL,width:i.width,height:i.height,strategy:u}}}catch(i){console.warn(`[stx-media] Failed to generate placeholder: ${i}`)}return o.sizes=s.sizes||A(c),o}catch(c){return console.error(`[stx-media] Responsive generation failed: ${c}`),null}}function A(e){let s=[...e].sort((t,a)=>t-a),r=[];for(let t=0;t<s.length-1;t++){let a=s[t];r.push(`(max-width: ${a}px) ${a}px`)}return r.push(`${s[s.length-1]}px`),r.join(", ")}function Eu(e,s="width"){if(!e||e.length===0)return"";if(s==="dpr")return e.filter((r)=>r.dpr).map((r)=>`${r.url} ${r.dpr}x`).join(", ");return e.map((r)=>`${r.url} ${r.width}w`).join(", ")}export{ei,ti,ni,Su,ku,_u,Sc,Cu,Eu};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Rl,yp,bp,vp,wp,Al,Pl,xp,Sp,go,kp,Zn,Qn,Kr}from"./chunk-qdkwg2b8.js";import{Qe}from"./chunk-yn9kvsk1.js";import"./chunk-3vwkyjan.js";import"./chunk-0thxpgtp.js";import"./chunk-9wdd7eq6.js";import"./chunk-kzb04293.js";import"./chunk-6beg47t4.js";import"./chunk-78yjmbbs.js";export{wp as __setSignalsGeneratorsForTest,Qe as cacheEngineFingerprint,Qn as cacheTemplate,Zn as checkCache,kp as clearDevCaches,Pl as getCachedRouterScript,Al as getCachedSignalsRuntime,xp as getServeClientAsset,go as getServeModuleBundle,Kr as hashFilePath,bp as invalidateFileCache,vp as invalidateFileCacheByDir,yp as readFileCached,Sp as registerServeModuleBundle,Rl as templateCache};
|
|
@@ -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 Vs(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={}){Vs(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{Vs,En};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function
|
|
2
|
+
function Di(e){return e}class a{plugins=new Map;sortedPlugins=[];initialized=!1;async register(e,t){if(this.plugins.has(e.name))throw Error(`Plugin "${e.name}" is already registered`);if(e.dependencies){for(let r of e.dependencies)if(!this.plugins.has(r))throw Error(`Plugin "${e.name}" depends on "${r}" which is not registered`)}if(this.plugins.set(e.name,e),e.onRegister)await e.onRegister(t);this.sortPlugins()}async unregister(e){let t=this.plugins.get(e);if(!t)return!1;for(let[r,i]of this.plugins)if(i.dependencies?.includes(e))throw Error(`Cannot unregister "${e}" because "${r}" depends on it`);if(t.onUnregister)await t.onUnregister();return this.plugins.delete(e),this.sortPlugins(),!0}get(e){return this.plugins.get(e)}has(e){return this.plugins.has(e)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let e=[];for(let t of this.sortedPlugins)if(t.registerDirectives)e.push(...t.registerDirectives());return e}getAllFilters(){let e={};for(let t of this.sortedPlugins)if(t.registerFilters)Object.assign(e,t.registerFilters());return e}async runBeforeProcess(e){return this.runHooks("beforeProcess",e)}async runAfterParse(e){return this.runHooks("afterParse",e)}async runBeforeDirective(e,t){return this.runDirectiveHooks("beforeDirective",e,t)}async runAfterDirective(e,t){return this.runDirectiveHooks("afterDirective",e,t)}async runBeforeRender(e){return this.runHooks("beforeRender",e)}async runAfterRender(e){return this.runHooks("afterRender",e)}async runOnError(e){for(let t of this.sortedPlugins)if(t.onError)try{let r=await t.onError(e);if(r){if(r.template!==void 0)e.template=r.template;if(r.context)e.context={...e.context,...r.context};if(r.metadata)e.metadata={...e.metadata,...r.metadata};if(r.skip)return e}}catch(r){console.error(`Error in plugin "${t.name}" onError hook:`,r)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort((e,t)=>(e.priority??100)-(t.priority??100))}async runHooks(e,t){let r={...t};for(let i of this.sortedPlugins){let s=i[e];if(s)try{let n=await s(r);if(n){if(n.template!==void 0)r.template=n.template;if(n.context)r.context={...r.context,...n.context};if(n.metadata)r.metadata={...r.metadata,...n.metadata};if(n.skip)break}}catch(n){console.error(`Error in plugin "${i.name}" ${e} hook:`,n)}}return r}async runDirectiveHooks(e,t,r){let i={...r};for(let s of this.sortedPlugins){let n=s[e];if(n)try{let o=await n(t,i);if(o){if(o.template!==void 0)i.template=o.template;if(o.context)i.context={...i.context,...o.context};if(o.metadata)i.metadata={...i.metadata,...o.metadata};if(o.skip)break}}catch(o){console.error(`Error in plugin "${s.name}" ${e} hook:`,o)}}return i}}var Zu=new a;var u=Di({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess(e){console.log("[stx-debug] beforeProcess:",e.filePath)},afterParse(e){console.log("[stx-debug] afterParse:",e.template.length,"chars")},beforeDirective(e,t){console.log("[stx-debug] beforeDirective:",e)},afterDirective(e,t){console.log("[stx-debug] afterDirective:",e)},beforeRender(e){console.log("[stx-debug] beforeRender")},afterRender(e){console.log("[stx-debug] afterRender:",e.template.length,"chars")},onError(e){console.error("[stx-debug] onError:",e.error.message,"in phase:",e.phase)}}),l=Di({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess(e){e.metadata.startTime=performance.now()},afterRender(e){let t=e.metadata.startTime;if(t){let r=performance.now()-t;console.log(`[stx-timing] Processing took ${r.toFixed(2)}ms`)}}});export{Di,Zu};
|
|
@@ -72,7 +72,7 @@ else {
|
|
|
72
72
|
${t}
|
|
73
73
|
})();
|
|
74
74
|
</script>
|
|
75
|
-
`}function
|
|
75
|
+
`}function hd(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{hd};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function
|
|
2
|
+
function Mi(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 Li(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 Di(v,c){let{itemHeight:l,containerHeight:u,overscan:s=3,keyProperty:b="
|
|
|
76
76
|
};
|
|
77
77
|
})();
|
|
78
78
|
</script>
|
|
79
|
-
`})}function
|
|
79
|
+
`})}function Uc(){return`
|
|
80
80
|
.virtual-list-container {
|
|
81
81
|
position: relative;
|
|
82
82
|
overflow-y: auto;
|
|
@@ -124,7 +124,7 @@ function Di(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 Wc(v,c){let l=null,u=()=>{if(!l)l=Mi(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 qc(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=Li(`@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 Di(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 Gc(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 Di(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 nd={createVirtualList:Mi,processVirtualListDirectives:Li,processInfiniteListDirectives:qc,processVirtualGridDirectives:Gc,generateVirtualListCSS:Uc,useVirtualList:Wc};
|
|
216
|
+
export{Mi,Li,Uc,Wc,qc,Gc,nd};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{Y,Z,Q,
|
|
2
|
+
import{Ue,te,Yi}from"./chunk-qr7a378v.js";import v from"fs";import g from"path";import V from"crypto";import{generatePlaceholder as T,processImage as L}from"ts-images";var Y=[320,640,768,1024,1280,1536,1920],Z=["webp","jpeg"],Q=80,D=[".jpg",".jpeg",".png",".webp",".avif",".gif",".svg"],U={webp:"image/webp",avif:"image/avif",jpeg:"image/jpeg",png:"image/png"},I=null,M=!1;async function d(){if(M)return I;M=!0;try{let t=await import("sharp");return I=t.default||t,I}catch{return null}}async function Tn(){return await d()!==null}async function ge(){return!0}async function Ce(t,e={}){let{widths:a=Y,formats:r=Z,quality:n=Q,fit:c="cover",placeholder:i="none",outputDir:m=".stx/images",baseUrl:s="/images"}=e,h,l;if(typeof t==="string"){if(l=t,!await Bun.file(t).exists())throw new Or(`Image not found: ${t}`,"NOT_FOUND");h=await Bun.file(t).arrayBuffer().then((o)=>Buffer.from(o))}else l="buffer-input",h=t;let b=V.createHash("sha256").update(h).digest("hex").slice(0,12),j=await Ir(h),{width:u,height:x}=j,F=u/x;await v.promises.mkdir(m,{recursive:!0});let B=[],A=g.basename(l,g.extname(l)),f=a.filter((o)=>o<=u);if(!f.includes(u)&&u<=Math.max(...a))f.push(u);f.sort((o,p)=>o-p);for(let o of f){let p=Math.round(o/F);for(let w of r){let S=`${A}-${o}w-${b}.${w}`,P=g.join(m,S),q=`${s}/${S}`,E=await Vc(h,{width:o,height:p,format:w,quality:n,fit:c});await Bun.write(P,E),B.push({path:P,url:q,width:o,height:p,format:w,size:E.length})}}let y;if(i!=="none")y=await k(h,i);return{src:l,variants:B,placeholder:y,width:u,height:x,aspectRatio:F,hash:b}}async function Ir(t){let e=typeof t==="string"?Buffer.from(await Bun.file(t).arrayBuffer()):t,a=await d();if(a){let n=await a(e).metadata();return{width:n.width||0,height:n.height||0,format:n.format||"unknown",hasAlpha:n.hasAlpha}}return R(e)}function R(t){if(t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71){let e=t.readUInt32BE(16),a=t.readUInt32BE(20);return{width:e,height:a,format:"png",hasAlpha:!0}}if(t[0]===255&&t[1]===216){let e=2;while(e<t.length){if(t[e]!==255)break;let a=t[e+1];if(a>=192&&a<=207&&a!==196&&a!==200&&a!==204){let n=t.readUInt16BE(e+5);return{width:t.readUInt16BE(e+7),height:n,format:"jpeg",hasAlpha:!1}}let r=t.readUInt16BE(e+2);e+=2+r}}if(t.toString("utf8",0,4)==="RIFF"&&t.toString("utf8",8,12)==="WEBP"){let e=t.toString("utf8",12,16);if(e==="VP8 "){let a=t.readUInt16LE(26)&16383,r=t.readUInt16LE(28)&16383;return{width:a,height:r,format:"webp",hasAlpha:!1}}if(e==="VP8L"){let a=t.readUInt32LE(21),r=(a&16383)+1,n=(a>>14&16383)+1;return{width:r,height:n,format:"webp",hasAlpha:!0}}}if(t.toString("utf8",0,3)==="GIF"){let e=t.readUInt16LE(6),a=t.readUInt16LE(8);return{width:e,height:a,format:"gif",hasAlpha:!0}}throw new Or("Unable to parse image dimensions","PARSE_ERROR")}async function Vc(t,e){let a=await d();if(a){let r=a(t).resize(e.width,e.height,{fit:e.fit});switch(e.format){case"webp":r=r.webp({quality:e.quality});break;case"avif":r=r.avif({quality:e.quality});break;case"jpeg":r=r.jpeg({quality:e.quality});break;case"png":r=r.png({quality:e.quality});break}return r.toBuffer()}return await Yi("img",async(r)=>{let n=g.join(r,`out.${e.format}`);return await L({input:t,output:n,format:e.format,quality:e.quality,resize:{width:e.width,height:e.height,fit:e.fit}}),Buffer.from(await Bun.file(n).arrayBuffer())})}async function k(t,e){let a=await d();if(e==="blur"&&a){let m=(await a(t).resize(20).blur(10).toBuffer()).toString("base64"),s=await Ir(t);return`data:${U[s.format]||"image/jpeg"};base64,${m}`}if(e==="dominant-color"&&a){let{dominant:i}=await a(t).resize(1,1).toBuffer().then(async(m)=>{let s=await a(m).metadata();return{dominant:{r:128,g:128,b:128}}}).catch(()=>({dominant:{r:128,g:128,b:128}}));return`rgb(${i.r}, ${i.g}, ${i.b})`}let r=await Ir(t),n=Ue("ph"),c=g.join(n,`in.${r.format==="unknown"?"bin":r.format}`);try{await Bun.write(c,t);let i=e==="blur"?"blur":e==="thumbhash"?"thumbhash":"dominant-color",s=await T(c,{strategy:i,width:i==="thumbhash"?void 0:32});if(e==="dominant-color"&&s.dominantColor)return s.dominantColor;if(s.dataURL)return s.dataURL;return"rgb(128, 128, 128)"}catch{return"rgb(128, 128, 128)"}finally{te(n)}}function dt(t,e){return(e?t.filter((r)=>r.format===e):t).sort((r,n)=>r.width-n.width).map((r)=>`${r.url} ${r.width}w`).join(", ")}function Wt(t){if(!t||Object.keys(t).length===0)return"100vw";return Object.entries(t).sort((a,r)=>{let n=Number.parseInt(a[0].replace(/\D/g,""))||0;return(Number.parseInt(r[0].replace(/\D/g,""))||0)-n}).map(([a,r])=>`(max-width: ${a}) ${r}`).join(", ")+", 100vw"}function $n(t){let e=t.filter((r)=>r.format==="jpeg");if(e.length===0)return t[Math.floor(t.length/2)];let a=e.sort((r,n)=>r.width-n.width);return a[Math.floor(a.length/2)]}function Rn(t){let e=new Map;for(let a of t){let r=e.get(a.format)||[];r.push(a),e.set(a.format,r)}return e}function An(t){let e=g.extname(t).toLowerCase();return D.includes(e)}function ee(t){return U[t]||"application/octet-stream"}function Pn(t){return t.reduce((e,a)=>e+a.size,0)}function In(t){if(t<1024)return`${t} B`;if(t<1048576)return`${(t/1024).toFixed(1)} KB`;return`${(t/1048576).toFixed(2)} MB`}class Or extends Error{code;constructor(t,e){super(t);this.name="ImageProcessingError",this.code=e}}
|
|
3
|
+
export{Y,Z,Q,Tn,ge,Ce,Ir,Vc,dt,Wt,$n,Rn,An,ee,Pn,In,Or};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var d=0;function l(){return`keep-alive-${++d}-${Date.now().toString(36)}`}function
|
|
2
|
+
var d=0;function l(){return`keep-alive-${++d}-${Date.now().toString(36)}`}function Dd(e,t={},n){let i=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return e.replace(i,(a,c,o)=>{let s=l(),r=u(c||"");return p(s,o.trim(),r)})}function u(e){let t={max:10},n=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,i;while((i=n.exec(e))!==null){let a=i[1],c=i[2]||i[3],o=i[4];switch(a){case"max":t.max=o?parseInt(o,10):10;break;case"include":t.include=c;break;case"exclude":t.exclude=c;break;case"id":t.id=c;break}}return t}function p(e,t,n){let{max:i,include:a,exclude:c}=n,o=n.id||e;return`
|
|
3
3
|
<div class="stx-keep-alive" data-keep-alive-id="${e}" data-custom-id="${o}">
|
|
4
4
|
<div class="stx-keep-alive-content" data-keep-alive-content="${e}">
|
|
5
5
|
${t}
|
|
@@ -286,7 +286,7 @@ else {
|
|
|
286
286
|
});
|
|
287
287
|
})();
|
|
288
288
|
</script>
|
|
289
|
-
`}function
|
|
289
|
+
`}function Md(e={}){return{id:e.id||l(),cache:new Map,max:e.max||10,include:e.include?e.include.split(",").map((n)=>n.trim()):null,exclude:e.exclude?e.exclude.split(",").map((n)=>n.trim()):null}}function Ld(e,t){if(t.exclude&&t.exclude.includes(e))return!1;if(t.include&&!t.include.includes(e))return!1;return!0}function jd(){return`
|
|
290
290
|
/* STX Keep-Alive Styles */
|
|
291
291
|
.stx-keep-alive {
|
|
292
292
|
position: relative;
|
|
@@ -311,7 +311,7 @@ else {
|
|
|
311
311
|
.stx-keep-alive-content > [data-activated] {
|
|
312
312
|
opacity: 1;
|
|
313
313
|
}
|
|
314
|
-
`}function
|
|
314
|
+
`}function Bd(){return`
|
|
315
315
|
// STX Keep-Alive Runtime
|
|
316
316
|
(function() {
|
|
317
317
|
if (typeof window === 'undefined') return;
|
|
@@ -347,5 +347,5 @@ else {
|
|
|
347
347
|
|
|
348
348
|
console.log('[stx] Keep-alive runtime initialized');
|
|
349
349
|
})();
|
|
350
|
-
`}function
|
|
351
|
-
export{
|
|
350
|
+
`}function Fd(e){if(typeof document<"u")document.addEventListener("stx:activated",(t)=>{e(t.detail)})}function zd(e){if(typeof document<"u")document.addEventListener("stx:deactivated",(t)=>{e(t.detail)})}
|
|
351
|
+
export{Dd,Md,Ld,jd,Bd,Fd,zd};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{en,Js,Ys,Zs,ap,Qs}from"./chunk-54fazdmn.js";import"./chunk-q3gactm1.js";import"./chunk-f26n6y9p.js";import"./chunk-9wdd7eq6.js";export{Ys as buildServerApi,ap as createServerApi,en as discoverServerApi,Js as generateApiTypes,Qs as isServerApiSource,Zs as productionApiDispatcher};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{k}from"./chunk-
|
|
3
|
-
`)}catch{return""}})}function
|
|
4
|
-
`)}catch{return""}})}function
|
|
2
|
+
import{k}from"./chunk-3vwkyjan.js";import{ce}from"./chunk-9ybjsfyp.js";function g(e,t){let r={};for(let n of e)r[n]=ce(t(n));return new Proxy({},{get:(n,a)=>r[a]?.(),set:(n,a,o)=>{if(r[a])r[a].set(o);else r[a]=ce(o);return!0},has:(n,a)=>(a in r),deleteProperty:(n,a)=>(delete r[a],!0),ownKeys:()=>Reflect.ownKeys(r),getOwnPropertyDescriptor:(n,a)=>(a in r)?{enumerable:!0,configurable:!0,writable:!0,value:r[a]()}:void 0})}function v(e,t){let r={};for(let n of t)r[n]=e[n];return r}function ji(e,t){let r=Object.keys(e),n=g(r,(i)=>t?.[i]??e[i].getDefaultValue()),a=g(r,()=>[]),o=g(r,()=>!1),c=g(r,()=>!1),f=g(r,()=>!1),s=ce(!1);async function u(i){f[i]=!0;let d=await e[i].validate(n[i],n);return a[i]=d,f[i]=!1,d.length===0}async function l(){s.set(!0);let i=await Promise.all(r.map(u));return s.set(!1),i.every(Boolean)}function m(){for(let i of r)n[i]=t?.[i]??e[i].getDefaultValue(),a[i]=[],o[i]=!1,c[i]=!1}function h(i){for(let d of r)if(d in i)n[d]=i[d],c[d]=!0}function b(i,d){n[i]=d,c[i]=!0}function y(i,d=!0){if(o[i]=d,d)u(i)}function p(i){return{value:n[i],errors:a[i],touched:o[i],dirty:c[i],valid:a[i].length===0,validating:f[i]}}function V(i){return async(d)=>{d?.preventDefault?.();for(let w of r)o[w]=!0;if(await l())await i(v(n,r))}}return{values:n,errors:a,touched:o,dirty:c,get isValid(){return r.every((i)=>a[i].length===0)},get isValidating(){return s()||r.some((i)=>f[i])},get isDirty(){return r.some((i)=>c[i])},validate:l,validateField:u,reset:m,setValues:h,setFieldValue:b,setFieldTouched:y,getFieldState:p,handleSubmit:V}}var sl=ji;class On{rules=[];defaultValue="";addRule(e){let t=new On;return t.rules=[...this.rules,e],t.defaultValue=this.defaultValue,t}required(e="This field is required"){return this.addRule({name:"required",message:e,validate:(t)=>{if(t===null||t===void 0)return e;if(typeof t==="string"&&t.trim()==="")return e;if(Array.isArray(t)&&t.length===0)return e;return!0}})}email(e="Please enter a valid email"){return this.addRule({name:"email",message:e,validate:(t)=>{if(!t)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t))||e}})}url(e="Please enter a valid URL"){return this.addRule({name:"url",message:e,validate:(t)=>{if(!t)return!0;try{return new URL(String(t)),!0}catch{return e}}})}min(e,t){let r=t||`Must be at least ${e} characters`;return this.addRule({name:"min",message:r,validate:(n)=>{if(!n)return!0;return String(n).length>=e||r}})}max(e,t){let r=t||`Must be no more than ${e} characters`;return this.addRule({name:"max",message:r,validate:(n)=>{if(!n)return!0;return String(n).length<=e||r}})}length(e,t,r){let n=r||`Must be between ${e} and ${t} characters`;return this.addRule({name:"length",message:n,validate:(a)=>{if(!a)return!0;let o=String(a).length;return o>=e&&o<=t||n}})}pattern(e,t="Invalid format"){return this.addRule({name:"pattern",message:t,validate:(r)=>{if(!r)return!0;return e.test(String(r))||t}})}hasUppercase(e="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,e)}hasLowercase(e="Must contain a lowercase letter"){return this.pattern(/[a-z]/,e)}hasNumber(e="Must contain a number"){return this.pattern(/\d/,e)}hasSpecial(e="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,e)}alphanumeric(e="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,e)}startsWithLetter(e="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,e)}noSpaces(e="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:e,validate:(t)=>{if(!t)return!0;return!String(t).includes(" ")||e}})}number(e="Must be a number"){let t=this.addRule({name:"number",message:e,validate:(r)=>{if(!r&&r!==0)return!0;return!Number.isNaN(Number(r))||e}});return t.defaultValue=0,t}integer(e="Must be a whole number"){return this.addRule({name:"integer",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number.isInteger(Number(t))||e}})}positive(e="Must be a positive number"){return this.addRule({name:"positive",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)>0||e}})}negative(e="Must be a negative number"){return this.addRule({name:"negative",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)<0||e}})}minValue(e,t){let r=t||`Must be at least ${e}`;return this.addRule({name:"minValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)>=e||r}})}maxValue(e,t){let r=t||`Must be no more than ${e}`;return this.addRule({name:"maxValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)<=e||r}})}between(e,t,r){let n=r||`Must be between ${e} and ${t}`;return this.addRule({name:"between",message:n,validate:(a)=>{if(!a&&a!==0)return!0;let o=Number(a);return o>=e&&o<=t||n}})}matches(e,t){let r=t||`Must match ${e}`;return this.addRule({name:"matches",message:r,validate:(n,a)=>{if(!a)return!0;return n===a[e]||r}})}oneOf(e,t){let r=t||`Must be one of: ${e.join(", ")}`;return this.addRule({name:"oneOf",message:r,validate:(n)=>{if(!n)return!0;return e.includes(n)||r}})}notOneOf(e,t){let r=t||`Cannot be one of: ${e.join(", ")}`;return this.addRule({name:"notOneOf",message:r,validate:(n)=>{if(!n)return!0;return!e.includes(n)||r}})}date(e="Must be a valid date"){return this.addRule({name:"date",message:e,validate:(t)=>{if(!t)return!0;let r=new Date(String(t));return!Number.isNaN(r.getTime())||e}})}before(e,t){let r=new Date(e),n=t||`Must be before ${r.toLocaleDateString()}`;return this.addRule({name:"before",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))<r||n}})}after(e,t){let r=new Date(e),n=t||`Must be after ${r.toLocaleDateString()}`;return this.addRule({name:"after",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))>r||n}})}custom(e,t="Invalid value"){return this.addRule({name:"custom",message:t,validate:e})}async(e,t="Invalid value"){return this.addRule({name:"async",message:t,async:!0,validate:e})}when(e,t){let r=new On;r.rules=[...this.rules],r.defaultValue=this.defaultValue;for(let n of t.getRules())r.rules.push({...n,validate:(a,o)=>{if(!e(a,o||{}))return!0;return n.validate(a,o)}});return r}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(e){let t=new On;return t.rules=[...this.rules],t.defaultValue=e,t}async validate(e,t){let r=[];for(let n of this.rules){let a=await n.validate(e,t);if(a!==!0)r.push(a)}return r}validateSync(e,t){let r=[];for(let n of this.rules){if(n.async)continue;let a=n.validate(e,t);if(a!==!0)r.push(a)}return r}}var sd=new On;function ol(e,t,r){let n=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>k(c,{...t,message:l},r)).join(`
|
|
3
|
+
`)}catch{return""}})}function il(e,t,r){let n=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>k(c,{...t,message:l},r)).join(`
|
|
4
|
+
`)}catch{return""}})}function al(e,t,r){let n=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return c}catch{return""}})}function od(e,t,r){let n=e;return n=ol(n,t,r),n=il(n,t,r),n=al(n,t,r),n}export{ji,sl,On,sd,ol,il,al,od};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{pp,Cl,Ge,ia,fp,jr,Br,Fr}from"./chunk-8jdbrcgt.js";import"./chunk-q7tfqavs.js";import"./chunk-e4ezpevb.js";import"./chunk-dba795e1.js";import"./chunk-3vwkyjan.js";import"./chunk-0thxpgtp.js";import"./chunk-9wdd7eq6.js";import"./chunk-kzb04293.js";import"./chunk-6beg47t4.js";import"./chunk-78yjmbbs.js";export{fp as clearOnceStore,ia as onceStore,Ge as partialsCache,jr as processIncludes,Br as processStackPushDirectives,Fr as processStackReplacements,pp as resetUnscopedSignalWarnings,Cl as topLevelElements};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{bo,vo,wo,xo,Zr,Qr,Ep,Tp,$p,Rp,es,Ap}from"./chunk-yaccg2c0.js";import"./chunk-kzb04293.js";export{Ap as generateDefaultRobotsTxt,es as generateRobotsTxt,Tp as generateSitemap,$p as generateSitemapIndex,xo as injectSeoTags,Zr as metaDirective,bo as processMetaDirectives,wo as processSeoDirective,vo as processStructuredData,Ep as registerSeoDirectives,Rp as scanForSitemapEntries,Qr as structuredDataDirective};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{x}from"./chunk-
|
|
3
|
-
`).length;
|
|
4
|
-
`)+1)+1,offset:f,length:
|
|
5
|
-
`.repeat(e.startLine-1):"",
|
|
2
|
+
import{x}from"./chunk-78yjmbbs.js";import{ve,Rt,$o,Ro,Pa,Ia,Oa,Na,ps,Po,Da,Ma,La,pn}from"./chunk-3vwkyjan.js";import{i}from"./chunk-6qh2mx6q.js";import{Us}from"./chunk-mvz825w0.js";import{c}from"./chunk-mf19qxgv.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=[...x].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 S=m[0];if(/^\s*type\s/.test(S))continue;let y=/^\s*([A-Za-z_$][\w$]*)/.exec(S);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
|
+
`).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 S=m.compilerOptions?.plugins;if(Array.isArray(S)){let o=S.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 Nc(e,t="",r=""){let u=e.startLine>1?`
|
|
5
|
+
`.repeat(e.startLine-1):"",s=Po(e)+Ro($o(e.code)),l=e.kind==="client"||e.kind==="plain"?Oa(t,e.code):"";return ps(`${u+s}
|
|
6
6
|
${l}
|
|
7
7
|
export {}
|
|
8
|
-
`,
|
|
9
|
-
`)}function
|
|
10
|
-
`)
|
|
11
|
-
`;continue}if(l==="/"&&e[
|
|
12
|
-
`);for(let d of ne(a,b))S.push({file:n,line:d.line,column:d.column,code:0,message:d.message,category:"error",blockKind:d.kind});if(
|
|
13
|
-
`)
|
|
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(x),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 Ei(e,t,r){return`${e}.__stx_${t}${r}.ts`}function Du(e){return e.replace(/\.__stx_(?:server|client|plain|template)\d+\.ts$/,"")}function Dc(){return se("stx.d.ts")}function Mc(){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
|
+
`)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 S=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(S,p):p)}return{paths:y}}async function Mu(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,S=[],y=[],o=0,f=0,p=Dc();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))S.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)=>Na(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?Da(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(Ei(n,d.kind,E),{source:Nc(d,k,D),origin:n,kind:d.kind})}),v&&R>0)g.set(Ei(n,"template",0),{source:v.text,origin:n,kind:"template",virtual:v})}if(g.size===0)return{diagnostics:S,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?Mc():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.",Pa(p?Ia(K(p,"utf8")):void 0),...p?[]:["declare const window: any",...x.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 Us())].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=La(C.virtual,A,L);if(!P?.expression)continue;if(Ma(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(...S);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:
|
|
18
|
+
`)||"(no output)"}`:void 0;return{diagnostics:j,checkedFiles:y,blockCount:o,expressionCount:f,failure:fe}}function Lu(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{Nc,Ei,Du,Dc,Mc,Mu,Lu};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{t,a,
|
|
2
|
+
import{t,a,Mt,Lt,jt,Fe,nt,P,_s,br,ze}from"./chunk-kzb04293.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 bo(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 vo(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 wo(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;_s(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(", ");_s(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,Dt,Mt,Lt,Be,nt,P,Ss,hr,Fe}from"./chunk-bsajk82t.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 _s(r,`structuredData must be an object or an array of objects, got ${Fe(e.structuredData)}; it was left out`,n)}return i.trim()}function xo(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,Dt,Mt,Lt,Be,nt,P,Ss,hr,Fe}from"./chunk-bsajk82t.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 Zr={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},Qr={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 Ep(){return[Zr,Qr]}function Tp(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 $p(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 Rp(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 es(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 Ap(e){return es({rules:[{userAgent:"*",allow:["/"]}],sitemap:e})}function T(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}
|
|
65
|
+
export{bo,vo,wo,xo,Zr,Qr,Ep,Tp,$p,Rp,es,Ap};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ec,ki,Tc,$c,_i,Rc,Ac,Pc,Ic,Ci,Oc,Nu}from"./chunk-bh19ezq0.js";import{Ni,Bc}from"./chunk-1b9thkg5.js";import{Y,Z,Q,Tn,ge,Ce,Ir,dt,Wt,$n,Rn,An,ee,Pn,In,Or}from"./chunk-x4q4bx3q.js";import{cl}from"./chunk-q4rejyd2.js";import"./chunk-qr7a378v.js";export{Z as DEFAULT_FORMATS,Q as DEFAULT_QUALITY,Y as DEFAULT_WIDTHS,Or as ImageProcessingError,$c as clearImageCache,_i as createImageDirective,Bc as createImageHandler,Ac as createImagePlugin,Nu as defaultImageConfig,In as formatSize,Ci as generateImageManifest,Wt as generateSizes,dt as generateSrcSet,$n as getFallbackVariant,Ir as getImageMetadata,ee as getMimeType,Pn as getTotalSize,Rn as groupVariantsByFormat,Ni as handleImageRequest,Rc as imageDirective,ge as isImageBackendAvailable,An as isImageFile,Tn as isSharpAvailable,Ic as optimizeDirectory,Pc as optimizeImage,ki as parseImageComponent,Ce as processImage,Tc as processImageComponents,Ec as renderImageComponent,cl as rewriteImagesWithSiblings,Oc as writeImageManifest};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import n from"fs";import a from"path";import{fileURLToPath as s}from"url";var i;function
|
|
3
|
-
export{
|
|
2
|
+
import n from"fs";import a from"path";import{fileURLToPath as s}from"url";var i;function Qe(){if(i)return i;let t="unknown";try{t=String(JSON.parse(n.readFileSync(new URL("../package.json",import.meta.url),"utf8")).version)}catch{}if(import.meta.url.endsWith(".ts"))try{let o=a.dirname(s(import.meta.url)),e=0;for(let r of n.readdirSync(o,{recursive:!0,withFileTypes:!0}))if(r.isFile()&&r.name.endsWith(".ts"))e=Math.max(e,n.statSync(a.join(r.parentPath,r.name)).mtimeMs);t+=`+src.${Math.trunc(e)}`}catch{}return i=t,t}
|
|
3
|
+
export{Qe};
|