@stacksjs/stx 0.2.343 → 0.2.345
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/binding-manifest.d.ts +32 -0
- package/dist/binding-manifest.js +64 -0
- package/dist/{chunk-zr1x54bt.js → chunk-05zfez2g.js} +1 -1
- package/dist/{chunk-jagf7h9y.js → chunk-0k1mtwby.js} +1 -1
- package/dist/{chunk-jh6f1a9y.js → chunk-1c9453w0.js} +1 -1
- package/dist/chunk-1qyg1q6d.js +2 -0
- package/dist/chunk-1t4ece3v.js +2 -0
- package/dist/{chunk-7zxv2631.js → chunk-1vt1h19d.js} +1 -1
- package/dist/chunk-1vtdege3.js +2 -0
- package/dist/{chunk-stqm4brp.js → chunk-1vv9g6cj.js} +1 -1
- package/dist/{chunk-p3awq80d.js → chunk-1yh6pq6b.js} +1 -1
- package/dist/{chunk-57dxdvjh.js → chunk-223makqc.js} +1 -1
- package/dist/chunk-2fhk4e68.js +2 -0
- package/dist/{chunk-wyhb3nb0.js → chunk-34f8c48f.js} +1 -1
- package/dist/chunk-3zm4hgcf.js +2 -0
- package/dist/{chunk-xgw269cf.js → chunk-4spaszfn.js} +286 -286
- package/dist/chunk-57t402mn.js +2 -0
- package/dist/{chunk-wdaf98ya.js → chunk-59906baj.js} +1 -1
- package/dist/{chunk-z9hb80mk.js → chunk-64n10kpa.js} +1 -1
- package/dist/chunk-66tgkvqw.js +2 -0
- package/dist/{chunk-daxr6p6q.js → chunk-6fwp7gee.js} +1 -1
- package/dist/{chunk-1bfvdjpy.js → chunk-6h3r8v55.js} +1 -1
- package/dist/{chunk-safmgrq5.js → chunk-6wmjwbq9.js} +1 -1
- package/dist/{chunk-53sjbp3z.js → chunk-72x62kch.js} +2 -2
- package/dist/{chunk-amfq5rnz.js → chunk-72yrrggn.js} +2 -2
- package/dist/{chunk-2853ye06.js → chunk-77p1kjg2.js} +2 -2
- package/dist/chunk-7g5vk4c3.js +2 -0
- package/dist/{chunk-7mc1k1tq.js → chunk-7h9fajgs.js} +1 -1
- package/dist/{chunk-gvfgrve8.js → chunk-7m9qk7da.js} +1 -1
- package/dist/{chunk-3d3x7dwy.js → chunk-7qp3zphs.js} +1 -1
- package/dist/{chunk-grnmr3y1.js → chunk-86c461ca.js} +1 -1
- package/dist/chunk-86q2h34b.js +2 -0
- package/dist/{chunk-7r79j1hs.js → chunk-89mqnh67.js} +1 -1
- package/dist/{chunk-5hq25yky.js → chunk-8cc4vdkh.js} +1 -1
- package/dist/chunk-8rhjt6fh.js +2 -0
- package/dist/{chunk-45ydb29q.js → chunk-8v2k21n4.js} +1 -1
- package/dist/{chunk-aqxwwq6w.js → chunk-8y1ve8tc.js} +2 -2
- package/dist/{chunk-ag8gdk51.js → chunk-99b5tfxc.js} +1 -1
- package/dist/{chunk-4vd0rqfs.js → chunk-9jbssgem.js} +197 -88
- package/dist/{chunk-s60eccqk.js → chunk-9nrgjtah.js} +1 -1
- package/dist/{chunk-y5sxa2sq.js → chunk-9qtf2b1p.js} +1 -1
- package/dist/chunk-aapqf6bj.js +2 -0
- package/dist/{chunk-k8skvm0d.js → chunk-at622hg0.js} +1 -1
- package/dist/{chunk-1qtd4ex2.js → chunk-avwywzsj.js} +2 -2
- package/dist/{chunk-a0ajg9z5.js → chunk-b5hank5e.js} +1 -1
- package/dist/chunk-b5mnam29.js +2 -0
- package/dist/{chunk-4fafxr8d.js → chunk-bk1zb1xp.js} +1 -1
- package/dist/{chunk-hrdd26r4.js → chunk-bqdfbwdf.js} +1 -1
- package/dist/{chunk-c7qdnc5d.js → chunk-c30qnb6z.js} +1 -1
- package/dist/chunk-c4tf1vpy.js +2 -0
- package/dist/{chunk-g0dbtyk7.js → chunk-c8e2deyp.js} +1 -1
- package/dist/chunk-cypg8qwn.js +2 -0
- package/dist/{chunk-fbmjw0bh.js → chunk-d86q27j8.js} +1 -1
- package/dist/{chunk-dj5mqnp1.js → chunk-dgv43ccd.js} +1 -1
- package/dist/{chunk-em8cr7wy.js → chunk-dsztk2kp.js} +1 -1
- package/dist/{chunk-mwvxhv0r.js → chunk-dxkjvajv.js} +1 -1
- package/dist/{chunk-4pg6wbt6.js → chunk-e631svvs.js} +1 -1
- package/dist/chunk-e7gs18rc.js +2 -0
- package/dist/{chunk-h6y99nak.js → chunk-e7np0h2q.js} +1 -1
- package/dist/{chunk-0s3ry262.js → chunk-ejqpq0wc.js} +1 -1
- package/dist/chunk-ek2m0kkw.js +2 -0
- package/dist/chunk-eqzc88et.js +2 -0
- package/dist/chunk-erb294sv.js +2 -0
- package/dist/{chunk-36j9qset.js → chunk-esjcyxa9.js} +2 -2
- package/dist/{chunk-5azeswj2.js → chunk-evfr2zgg.js} +1 -1
- package/dist/{chunk-e53pwshq.js → chunk-fp868yhg.js} +1 -1
- package/dist/{chunk-5zemhhwe.js → chunk-gsc2vds7.js} +1 -1
- package/dist/{chunk-q6825wwz.js → chunk-gvemapw4.js} +1 -1
- package/dist/chunk-h1vax4wg.js +2 -0
- package/dist/chunk-hke0k33t.js +2 -0
- package/dist/{chunk-zcytk5w9.js → chunk-jekrtm2j.js} +1 -1
- package/dist/{chunk-pwhf5kte.js → chunk-jnbg3e4r.js} +1 -1
- package/dist/{chunk-brjfzbq9.js → chunk-kfkf9v2d.js} +1 -1
- package/dist/chunk-kq30wqp6.js +2 -0
- package/dist/{chunk-s7qbba8r.js → chunk-kqzpmwx2.js} +10 -10
- package/dist/{chunk-0dpgh7a6.js → chunk-kw9cgyfc.js} +1 -1
- package/dist/{chunk-0fp16c1x.js → chunk-m2j5skez.js} +1 -1
- package/dist/{chunk-vj3nx26v.js → chunk-mph46gkj.js} +1 -1
- package/dist/chunk-mr8ccsnm.js +2 -0
- package/dist/{chunk-1h1c2048.js → chunk-msywnv5n.js} +1 -1
- package/dist/{chunk-649dfqqz.js → chunk-n5657hm3.js} +1 -1
- package/dist/{chunk-t00ga194.js → chunk-njx93b4z.js} +1 -1
- package/dist/{chunk-m0xaw0qw.js → chunk-nm60wh6r.js} +1 -1
- package/dist/{chunk-8ah5mhst.js → chunk-nqz501eq.js} +2 -2
- package/dist/{chunk-hq3phk1a.js → chunk-nrt99ptw.js} +1 -1
- package/dist/{chunk-62vng8g8.js → chunk-pajk5680.js} +2 -2
- package/dist/{chunk-ey1tsk22.js → chunk-ppzz953j.js} +1 -1
- package/dist/{chunk-7yfk9393.js → chunk-qkdcbeaw.js} +1 -1
- package/dist/chunk-qr3zcm87.js +2 -0
- package/dist/chunk-r38xq7fp.js +33 -0
- package/dist/{chunk-tqw1yean.js → chunk-rwwfzkz4.js} +1 -1
- package/dist/{chunk-rns7wjy9.js → chunk-rzda6bd6.js} +1 -1
- package/dist/{chunk-rzg9pars.js → chunk-san1eq0r.js} +2 -2
- package/dist/{chunk-eh3meyd3.js → chunk-tc4pj651.js} +2 -2
- package/dist/{chunk-6g8rvnhc.js → chunk-v6e35j4g.js} +1 -1
- package/dist/{chunk-wnmegbw0.js → chunk-v7aa7v85.js} +1 -1
- package/dist/{chunk-e6rxvz3p.js → chunk-vhg91hnw.js} +1 -1
- package/dist/{chunk-k3dtvay1.js → chunk-vhta1be7.js} +1 -1
- package/dist/{chunk-tz68qv47.js → chunk-w5j9tbsk.js} +1 -1
- package/dist/{chunk-ec18ftcg.js → chunk-wj21f1e0.js} +1 -1
- package/dist/{chunk-12qteqk8.js → chunk-ws0282jr.js} +1 -1
- package/dist/chunk-x054qzma.js +2 -0
- package/dist/{chunk-q9ckfwhh.js → chunk-xj6bcwqa.js} +1 -1
- package/dist/chunk-xq0e2y4x.js +2 -0
- package/dist/chunk-xrjx7b2v.js +2 -0
- package/dist/{chunk-ay336sqb.js → chunk-xvh1k1a4.js} +1 -1
- package/dist/{chunk-vaggjvsm.js → chunk-y2f41kaq.js} +1 -1
- package/dist/{chunk-1zav2sf1.js → chunk-y6xzr30x.js} +1 -1
- package/dist/chunk-ybx8n794.js +2 -0
- package/dist/{chunk-yefnrr5z.js → chunk-yca761bm.js} +1 -1
- package/dist/{chunk-kgbz86sa.js → chunk-yg5r7bnm.js} +2 -2
- package/dist/{chunk-kbah2k8e.js → chunk-z8wb7kbj.js} +2 -2
- package/dist/chunk-zkxnarrh.js +2 -0
- package/dist/{chunk-hzbty7hz.js → chunk-zmazqcb8.js} +1 -1
- package/dist/chunk-zp14ksx1.js +2 -0
- package/dist/chunk-zwr4bn6a.js +2 -0
- package/dist/cli.js +14 -14
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/database.js +1 -1
- package/dist/expressions.d.ts +1 -1
- package/dist/expressions.js +15 -3
- package/dist/includes.js +2 -2
- package/dist/pwa.js +2 -2
- package/dist/runtime-globals.d.ts +22 -0
- package/dist/runtime-globals.js +46 -0
- package/dist/signals.js +193 -84
- package/dist/slots.js +3 -3
- package/dist/ssg.js +2 -2
- package/dist/theme-tokens.d.ts +59 -0
- package/dist/theme-tokens.js +83 -17
- package/dist/ts-css-config.js +4 -2
- package/dist/utils.d.ts +10 -0
- package/dist/utils.js +77 -12
- package/dist/variable-extractor.d.ts +1 -1
- package/dist/variable-extractor.js +23 -3
- package/dist/visual-testing.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-160g7ynw.js +0 -2
- package/dist/chunk-16hr5y08.js +0 -2
- package/dist/chunk-3h97y3n3.js +0 -2
- package/dist/chunk-3j915h2d.js +0 -2
- package/dist/chunk-4hkg6kx4.js +0 -2
- package/dist/chunk-57494khk.js +0 -2
- package/dist/chunk-5xavmr4t.js +0 -2
- package/dist/chunk-6rsfkms1.js +0 -2
- package/dist/chunk-6xs80tka.js +0 -32
- package/dist/chunk-905j49fe.js +0 -2
- package/dist/chunk-9czj483k.js +0 -2
- package/dist/chunk-9kv0qavn.js +0 -2
- package/dist/chunk-bcz8yp2g.js +0 -2
- package/dist/chunk-bxefsc7k.js +0 -2
- package/dist/chunk-c4kv3r8t.js +0 -2
- package/dist/chunk-fytemc96.js +0 -2
- package/dist/chunk-g7gc0ten.js +0 -2
- package/dist/chunk-gqsxxd81.js +0 -2
- package/dist/chunk-gx9z0wmm.js +0 -2
- package/dist/chunk-jnxzzzm4.js +0 -2
- package/dist/chunk-jy6jwxhs.js +0 -2
- package/dist/chunk-khqn40gv.js +0 -2
- package/dist/chunk-mhbzrh5y.js +0 -2
- package/dist/chunk-p8anntjb.js +0 -2
- package/dist/chunk-pwe51myj.js +0 -2
- package/dist/chunk-rqqdvnp5.js +0 -2
- package/dist/chunk-w1mbrq1g.js +0 -2
- package/dist/chunk-w84qe2m6.js +0 -2
- package/dist/chunk-wjm7hv5e.js +0 -2
- package/dist/chunk-yr7s02f7.js +0 -2
- package/dist/chunk-zq3tm2c2.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ye as a}from"./chunk-zmazqcb8.js";import"./chunk-esjcyxa9.js";import"./chunk-57atgbyq.js";import"./chunk-77p1kjg2.js";import"./chunk-4spaszfn.js";import"./chunk-8y1ve8tc.js";import"./chunk-njx93b4z.js";import"./chunk-bqdfbwdf.js";import"./chunk-89mqnh67.js";import"./chunk-xvh1k1a4.js";import"./chunk-r38xq7fp.js";import"./chunk-y2f41kaq.js";import"./chunk-xj6bcwqa.js";import"./chunk-z8wb7kbj.js";import"./chunk-vhta1be7.js";import"./chunk-tc4pj651.js";import"./chunk-san1eq0r.js";import"./chunk-avwywzsj.js";import"./chunk-wj21f1e0.js";import"./chunk-d86q27j8.js";import"./chunk-72x62kch.js";import"./chunk-yg5r7bnm.js";import"./chunk-9nrgjtah.js";import"./chunk-ejqpq0wc.js";export{a as startProductionServer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{l as a,m as b,n as c}from"./chunk-q9n5swx7.js";import"./chunk-
|
|
2
|
+
import{l as a,m as b,n as c}from"./chunk-q9n5swx7.js";import"./chunk-ejqpq0wc.js";export{c as updateContextTree,b as updateContextStoryFiles,a as createContext};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$g as c,Zg as a,_g as b,ah as d,bh as e,ch as f,dh as g,eh as h,fh as i,gh as j,hh as k}from"./chunk-
|
|
2
|
+
import{$g as c,Zg as a,_g as b,ah as d,bh as e,ch as f,dh as g,eh as h,fh as i,gh as j,hh as k}from"./chunk-7h9fajgs.js";import"./chunk-18018jkn.js";import"./chunk-ejqpq0wc.js";export{c as setCachedVideoResult,k as processVideo,b as getCachedVideoResult,f as generateThumbnails,g as generateSpriteSheet,e as generatePoster,h as generateHLSManifest,i as generateDASHManifest,d as clearVideoCache,j as analyzeVideo,a as VideoProcessorCache};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Wf as a}from"./chunk-7m9qk7da.js";import"./chunk-esjcyxa9.js";import"./chunk-57atgbyq.js";import"./chunk-9jbssgem.js";import"./chunk-e4g8wz6t.js";import"./chunk-c0n802j1.js";import"./chunk-77p1kjg2.js";import"./chunk-4spaszfn.js";import"./chunk-8y1ve8tc.js";import"./chunk-njx93b4z.js";import"./chunk-bqdfbwdf.js";import"./chunk-89mqnh67.js";import"./chunk-xvh1k1a4.js";import"./chunk-r38xq7fp.js";import"./chunk-y2f41kaq.js";import"./chunk-xj6bcwqa.js";import"./chunk-z8wb7kbj.js";import"./chunk-vhta1be7.js";import"./chunk-tc4pj651.js";import"./chunk-san1eq0r.js";import"./chunk-avwywzsj.js";import"./chunk-wj21f1e0.js";import"./chunk-d86q27j8.js";import"./chunk-72x62kch.js";import"./chunk-yg5r7bnm.js";import"./chunk-9nrgjtah.js";import"./chunk-ejqpq0wc.js";export{a as buildForProduction};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ji as O,Ki as w,Li as Z}from"./chunk-7we3xfde.js";import{Zk as R,el as U,kl as T}from"./chunk-
|
|
2
|
+
import{Ji as O,Ki as w,Li as Z}from"./chunk-7we3xfde.js";import{Zk as R,el as U,kl as T}from"./chunk-223makqc.js";import{am as M,aq as k,sr as C,yo as W}from"./chunk-4spaszfn.js";import{qv as E,rv as L}from"./chunk-wj21f1e0.js";import{vv as B}from"./chunk-72x62kch.js";import $ from"path";var Y=new Map;function b(Q,z){for(let J of Q.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(J[1])z.add(J[1]);for(let J of Q.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let H of(J[1]??"").split(",")){let K=((H.includes(":")?H.split(":").pop():H)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(K))z.add(K)}for(let J of Q.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let H of(J[1]??"").split(",")){let V=H.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(V))z.add(V)}}async function l(Q){let z;if(Q)z=$.resolve(Q);else{let q=await C();z=$.resolve(q.root||process.cwd(),q.storesDir||"stores")}let J=new Bun.Glob("*.ts"),H=[];try{for await(let q of J.scan({cwd:z,absolute:!0})){let y=$.basename(q,".ts");if(["index","types"].includes(y))continue;if(q.includes(".d.ts"))continue;H.push(q)}}catch{return Z(Y,z,"",""),null}let V=()=>[...new Set([...H,...H.flatMap((q)=>R(q))])],K=O(V()),P=w(Y,z,K);if(P!==void 0)return P||null;if(H.length===0)return Z(Y,z,K,""),null;let A=[];for(let q of H){let y=await Bun.file(q).text();A.push({file:q,hasUseStore:/useStore\s*\(/.test(y)})}A.sort((q,y)=>{if(q.hasUseStore===y.hasUseStore)return 0;return q.hasUseStore?1:-1});let N=A.map((q)=>q.file),G=[],X=new Set,F=k({loader:"ts",target:"browser",define:M()});for(let q of N)try{let y=await Bun.file(q).text(),I=$.basename(q,".ts");if(b(y,X),U(y))y=await T(y,q,{projectRoot:process.cwd(),externalizeUserModules:!1});y=W(y),y=E(y),y=L(y),y=y.replace(/^export\s+(default\s+)?/gm,""),y=F.transformSync(y),G.push(`// Store: ${I}
|
|
3
3
|
${y.trim()}`)}catch(y){console.warn(`[stx] Failed to load store ${q}:`,y)}if(G.length===0)return Z(Y,z,K,""),null;let j=G.join(`
|
|
4
4
|
|
|
5
5
|
`),x=`;(function(){
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$e as c,Ze as a,_e as b,af as d,bf as e,cf as f,df as g,ef as h,ff as i,gf as j,hf as k,if as l,jf as m,kf as n,lf as o}from"./chunk-ym3r8ktq.js";import"./chunk-
|
|
2
|
+
import{$e as c,Ze as a,_e as b,af as d,bf as e,cf as f,df as g,ef as h,ff as i,gf as j,hf as k,if as l,jf as m,kf as n,lf as o}from"./chunk-ym3r8ktq.js";import"./chunk-ejqpq0wc.js";export{k as writeNetlifyConfig,n as initNetlify,l as hasNetlifyConfig,g as getTotalSize,h as generateNetlifyToml,f as formatSize,e as filterRequiredFiles,i as detectProjectConfig,m as deploy,a as createNetlifyClient,d as createFileManifest,j as createDefaultNetlifyConfig,c as collectDeployFiles,b as calculateSha1,o as DeployError};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{am as x,aq as M}from"./chunk-
|
|
2
|
+
import{am as x,aq as M}from"./chunk-4spaszfn.js";import"./chunk-8y1ve8tc.js";import"./chunk-njx93b4z.js";import"./chunk-bqdfbwdf.js";import"./chunk-89mqnh67.js";import"./chunk-xvh1k1a4.js";import{Fs as B,Hs as P}from"./chunk-r38xq7fp.js";import"./chunk-y2f41kaq.js";import"./chunk-xj6bcwqa.js";import"./chunk-z8wb7kbj.js";import"./chunk-vhta1be7.js";import"./chunk-tc4pj651.js";import"./chunk-san1eq0r.js";import"./chunk-avwywzsj.js";import"./chunk-wj21f1e0.js";import"./chunk-d86q27j8.js";import"./chunk-72x62kch.js";import"./chunk-yg5r7bnm.js";import"./chunk-9nrgjtah.js";import"./chunk-ejqpq0wc.js";import G from"path";var T=["broadcast","calculateDistance","canNotify","clearCookies","clearFetchCache","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],O=new Set(T);var K=new Map,U=B(64),V=new Set,D=0,N=new Set(T);function f(){K.clear(),U.clear()}function S(H){let J=new Map;for(let Q of H){let Z=G.basename(Q);if(Z.endsWith(".d.ts"))continue;let z=Z.replace(/\.[jt]s$/,"");if(z==="index")continue;if(z===Z)continue;let X=J.get(z);if(X&&!X.endsWith(".js"))continue;J.set(z,Q)}return[...J.values()].sort()}function g(H,J){let Q=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Q}\\b`).test(H)}function y(H){if(!H)return[];let J=P(H,D),Q=U.get(J);if(Q)return Q.slice();let Z=H.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),z=[];for(let X of N){if(V.has(X))continue;let A=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${A}\\s*\\(`).test(Z))z.push(X)}return z.sort(),U.set(J,z),z.slice()}async function p(H,J){let Q=y(H);if(Q.length===0)return null;let Z=J??G.join(import.meta.dir,"composables"),z=`${Z}\x00${Q.join(",")}`,X=K.get(z);if(X!==void 0)return X||null;let A=M({loader:"ts",target:"browser",define:x()}),L=new Set(Q),W=[],C=new Set,F=[];try{let q=new Bun.Glob("*.{ts,js}");for await(let j of q.scan({cwd:Z,absolute:!0}))F.push(j)}catch{return K.set(z,""),null}F=S(F);for(let q of F){let j;try{j=await Bun.file(q).text()}catch{continue}let I=[];try{I=A.scan(j).exports.filter(($)=>$!=="default")}catch{continue}if(!I.some(($)=>L.has($)))continue;try{j=j.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^import\s+type\s+.*$/gm,""),j=j.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),j=j.replace(/^export\s+default\s+/gm,""),j=j.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),W.push(`// ${G.basename(q).replace(/\.[jt]s$/,"")}
|
|
3
3
|
${A.transformSync(j).trim()}`);for(let $ of I)C.add($)}catch($){console.warn(`[stx] framework composable ${G.basename(q)} could not be bundled:`,$)}}let Y=Q.filter((q)=>!C.has(q)&&!g(H,q));if(Y.length>0)console.warn(`[stx] could not bundle ${Y.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(W.length===0)return K.set(z,""),null;let k=[...C].map((q)=>` try { if (!(${JSON.stringify(q)} in __s)) { __s[${JSON.stringify(q)}] = ${q}; if (!(${JSON.stringify(q)} in window)) window[${JSON.stringify(q)}] = ${q}; } } catch (e) {}`).join(`
|
|
4
4
|
`),w=`<script data-stx-framework-composables>
|
|
5
5
|
;(function(){
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import
|
|
3
|
-
export{K as
|
|
2
|
+
import F from"fs";import y from"path";var U=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^<>()]*>)?\s*\(/,g=/(?:^|\n)\s*(?:import|export)\s+(?:[^'"]*?\sfrom\s+)?['"](\.[^'"]*)['"]/g,D=["",".ts",".tsx",".js",".jsx",".mts",".mjs","/index.ts","/index.js"],H=3;function k(j,q){let J=y.resolve(y.dirname(q),j);for(let Q of D){let z=J+Q;try{if(F.statSync(z).isFile())return z}catch{}}return null}function K(j,q,J=0,Q=new Set){if(!q||J>=H)return!1;for(let z of j.matchAll(g)){let Z=k(z[1],q);if(!Z||Q.has(Z))continue;Q.add(Z);let $;try{$=F.readFileSync(Z,"utf8")}catch{continue}if(U.test($))return!0;if(K($,Z,J+1,Q))return!0}return!1}var Y=["batch","clearServerData","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refresh","registerStoresClient","setRouteParams","state","untrack","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useDocumentVisibility","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useModel","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],d=["onMount","onDestroy"];function p(j="const",q=[],J){let Q=q.length?Y.filter((z)=>!q.includes(z)):Y;if(J!==void 0)Q=Q.filter((z)=>{let Z=z.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${Z}(?![\\w$])`).test(J)});return`${j} { ${Q.join(", ")} } = window.stx;`}var x=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],T={useServerData:{category:"server-only",reason:"loads and serializes request-scoped data from <script server>; clients consume it through a keyed useFetch/useAsyncData."},redirect:{category:"server-only",reason:"returns an HTTP Response for <script server>/edge/build; use navigate() on the client."},useAsyncData:{category:"browser-composable",reason:"inlined on demand from src/composables when a script references it; reachable, not a bare global."},Teleport:{category:"compile-time-directive",reason:"template tag resolved by processTeleportDirectives; not a script callable."},StxModalBuiltin:{category:"builtin-component",reason:"builtin component used as a template tag; drive open/close from the modal store."},StxToastBuiltin:{category:"builtin-component",reason:"builtin component used as a template tag; push toasts via the toast store."},useForm:{category:"browser-composable",reason:"reactive form primitive; lives in src/composables/use-form.ts and is inlined on demand when a <script client> references it (#1846)."},defineForm:{category:"browser-composable",reason:"deprecated alias of useForm, kept for a minor (#1843). Same delivery path \u2014 inlined on demand from src/composables/use-form.ts."},validateFields:{category:"isomorphic-import",reason:"pure validation helper; import it directly, not auto-delivered to <script client> (per client-api-delivery.test.ts)."},validateField:{category:"isomorphic-import",reason:"singular pure validation helper; same explicit-import boundary as validateFields."}},O=Y.filter((j)=>!x.includes(j));function P(j){if(!j)return!1;return O.some((q)=>new RegExp(`\\b${q}\\s*(?:<[^>]*>)?\\s*\\(`).test(j))}var C=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],u=/\s@[a-z][\w.:-]*\s*=/i;function _(j,q){if(!j)return!1;let J=X(j);return G(J,q)}function G(j,q){if(C.some((J)=>J.test(j)))return!0;if(P(j))return!0;return M(j,q)}function M(j,q){if(!q)return!1;for(let J of j.matchAll(/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script\s*>/gi))if(K(J[1],q))return!0;return!1}function E(j,q){if(!j)return!1;let J=X(j);return u.test(J)||G(J,q)}var b=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];function c(j){return b.includes(j.toLowerCase())}var V=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],f=["x-init","x-transition","x-effect","x-on"],r=[...V,...f];function h(){return`{${V.map((j)=>`'${j}':1`).join(",")}}`}var L=["class","style","text","html","show","model","if","ref"];function o(){return`{${L.map((j)=>j==="if"?"'if':1":`${j}:1`).join(",")}}`}var B=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","keydown","keyup","keypress","input","change","submit","focus","blur","scroll","resize","touchstart","touchend","touchmove","contextmenu","wheel","pointerdown","pointerup","pointermove"];function i(){return`/^(${B.join("|")})/`}function s(j){return B.some((q)=>j===q||j.startsWith(`${q}.`))}var S=65536,v=4,w=new Map;function m(){w.clear()}function X(j){if(!j)return j;if(!j.includes("<!--")&&!/<(?:pre|code)\b/i.test(j))return j;let q=j.length>=S;if(q){let z=w.get(j);if(z!==void 0)return z}let J=(z)=>z.replace(/(<[^>]*>)|([^<]+)/g,(Z,$,W)=>$??" ".repeat(W.length)),Q=j.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(z,Z,$,W)=>Z+J($)+W).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(z,Z,$,W)=>Z+J($)+W).replace(/<!--[\s\S]*?-->/g,(z)=>" ".repeat(z.length));if(q){while(w.size>=v){let z=w.keys().next();if(z.done)break;w.delete(z.value)}w.set(j,Q)}return Q}
|
|
3
|
+
export{K as uv,Y as vv,d as wv,p as xv,x as yv,T as zv,O as Av,P as Bv,_ as Cv,E as Dv,b as Ev,c as Fv,V as Gv,f as Hv,r as Iv,h as Jv,L as Kv,o as Lv,B as Mv,i as Nv,s as Ov,m as Pv,X as Qv};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
`),B;try{let{bundleClientScript:j}=await import("./chunk-
|
|
2
|
+
import{Nw as H}from"./chunk-ejqpq0wc.js";import P from"path";var $=/__stxModules\["((?:[^"\\]|\\.)*)"\]/g;function G(...v){let w=new Set;for(let q of v){if(!q||!q.includes("__stxModules["))continue;for(let z of q.matchAll($))try{w.add(JSON.parse(`"${z[1]}"`))}catch{}}return[...w].sort()}async function T(v,w={}){if(v.length===0)return null;let q=process.cwd(),z=[],J=[];v.forEach((j,X)=>{let Z=j.startsWith("npm:")?j.slice(4):P.resolve(q,j),N=`__stxRegistered${X}`,O=JSON.stringify(j);z.push(`import * as ${N} from ${JSON.stringify(Z)};`),J.push(`if (!globalThis.__stxModules[${O}]) globalThis.__stxModules[${O}] = ${N};`)});let L=[...z,"globalThis.__stxModules = globalThis.__stxModules || {};",...J].join(`
|
|
3
|
+
`),B;try{let{bundleClientScript:j}=await import("./chunk-7g5vk4c3.js");B=await j(L,P.join(q,".stx-module-registry.ts"),{projectRoot:q,minify:w.minify,externalizeUserModules:!1})}catch(j){return console.warn("[stx] could not build the page module registry (#1957):",j),null}let{transformAutoImports:Q,generateAutoImportDestructuring:U}=await import("./chunk-1qyg1q6d.js"),F=Q(B),V=U(F.stxImports,F.browserImports),{transformStoreImports:W}=await import("./chunk-zkxnarrh.js");B=W(F.code);let M=JSON.stringify(new Bun.CryptoHasher("md5").update(L).digest("hex").slice(0,12));return[";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${M}]) return;`,` __stxBundles[${M}] = true;`,V,B,"})();"].join(`
|
|
4
4
|
`)}export{G as registeredModuleIdsIn,T as buildModuleRegistryScript};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{ns as x}from"./chunk-89mqnh67.js";import{nt as A}from"./chunk-y2f41kaq.js";import{Dt as T,Ht as q}from"./chunk-vhta1be7.js";import{Dw as y,Xv as C}from"./chunk-yg5r7bnm.js";import{Nw as P}from"./chunk-ejqpq0wc.js";y();import H from"fs";import $ from"path";import{pathToFileURL as b}from"url";var R=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],O=new Set;function N(J,Y={}){let K=$.resolve(J,Y.dir??"server/api"),Q=[],Z=new Map;if(!H.existsSync(K))return Q;let B=Array.from(new Bun.Glob("**/*.{ts,js,mts,mjs}").scanSync({cwd:K})).sort();for(let z of B){if(z.endsWith(".d.ts"))continue;let W=z.replace(/\.(?:ts|js|mts|mjs)$/,"").split("/"),I=W.pop(),X=I.lastIndexOf("."),_=X>=0?I.slice(X+1):"get",F=_.toUpperCase();if(!R.includes(F)||_!==_.toLowerCase())throw Error(`Unsupported API method suffix in ${z}; use ${R.map((k)=>k.toLowerCase()).join(", ")}`);if(X>=0)I=I.slice(0,X);if(I!=="index")W.push(I);let G=new Set,j=W.map((k,S)=>{let E=/^\[(\.\.\.)?([A-Za-z_]\w*)\]$/.exec(k);if(E){if(G.has(E[2])||E[1]&&S!==W.length-1)throw Error(`Invalid API parameter in ${z}`);return G.add(E[2]),`:${E[2]}${E[1]?"*":""}`}if(!/^[\w-]+$/.test(k))throw Error(`Unsupported API path segment ${k} in ${z}`);return k}),U=`/api${j.length?`/${j.join("/")}`:""}`,L=`${F} ${U.replace(/:\w+/g,":param")}`;if(Z.has(L))throw Error(`Ambiguous API route ${F} ${U}: ${Z.get(L)} and ${z}`);Z.set(L,z);let M=$.join(K,z);O.add($.resolve(M)),O.add(H.realpathSync(M)),Q.push({pattern:U,method:F,filePath:M})}return Q.sort((z,V)=>{let W=z.pattern.split("/"),I=V.pattern.split("/"),X=(_)=>_?.endsWith("*")?0:_?.startsWith(":")?1:2;for(let _=0;_<Math.max(W.length,I.length);_++){let F=X(I[_])-X(W[_]);if(F)return F}return z.pattern.localeCompare(V.pattern)||z.method.localeCompare(V.method)})}async function w(J,Y){let K=A(J,"api-types.d.ts"),Q=["// Generated by stx. Include this file in tsconfig.json.","declare module '@stacksjs/stx/api-client' {"," interface KnownApiRoutes {"];for(let B of Y){let z=`./${$.relative($.dirname(K),B.filePath).replace(/\\/g,"/")}`,{params:V}=C(B.pattern);Q.push(` ${JSON.stringify(`${B.method} ${B.pattern}`)}: { params: { ${V.map((W)=>`${JSON.stringify(W)}: string`).join("; ")} }; response: Awaited<ReturnType<typeof import(${JSON.stringify(z)}).default>> }`)}Q.push(" }","}","export {}","");let Z=Q.join(`
|
|
3
3
|
`);if(!await Bun.file(K).exists()||await Bun.file(K).text()!==Z)await Bun.write(K,Z);return K}async function p(J,Y,K={}){let Q=N(J,K);await w(J,Q);let Z=[];for(let B of Q){let z=await Bun.build({entrypoints:[B.filePath],target:"bun",format:"esm",minify:!1,splitting:!1});if(!z.success)throw Error(`API build failed for ${B.filePath}: ${z.logs.join(`
|
|
4
|
-
`)}`);let V=z.outputs.find((X)=>X.kind==="entry-point");if(!V)throw Error(`No API bundle for ${B.filePath}`);if(z.outputs.length!==1)throw Error(`API endpoint ${B.filePath} emits assets; package those explicitly instead`);let I=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await V.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write($.join(Y,I),V),Z.push({...B,filePath:I})}return Z}function D(J,Y){let K=J.map((Q)=>({route:Q,...C(Q.pattern)}));return async(Q)=>{let Z=new URL(Q.url).pathname,B=K.filter((G)=>G.regex.test(Z));if(!B.length)return null;let z=B[0].route.pattern,V=(G)=>G.replace(/:\w+/g,":param"),W=B.filter((G)=>V(G.route.pattern)===V(z)),I=Q.method,X=W.find((G)=>G.route.method===I)??(I==="HEAD"?W.find((G)=>G.route.method==="GET"):void 0);if(!X){let G=new Set(W.map((j)=>j.route.method));if(G.has("GET"))G.add("HEAD");return G.add("OPTIONS"),new Response(null,{status:I==="OPTIONS"?204:405,headers:{Allow:Array.from(G).sort().join(", ")}})}let _=X.regex.exec(Z),F=Object.create(null);try{X.params.forEach((G,j)=>{F[G]=decodeURIComponent(_[j+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let G=await Y(X.route);if(typeof G!=="function")throw Error(`API endpoint ${X.route.filePath} must default-export a handler`);let j=await G(Q,{params:F}),U=j instanceof Response?j:j===void 0?new Response(null,{status:204}):Response.json(j);if(I==="HEAD")return new Response(null,{status:U.status,headers:U.headers});return U}catch(G){return console.error(`[stx] API error for ${I} ${z}:`,G),Response.json({error:"Internal Server Error"},{status:500})}}}function l(J,Y){return D(Y,async(K)=>(await import(b($.resolve(J,K.filePath)).href)).default)}async function s(J,Y){if(!Y)return async()=>null;let K=Y===!0?{}:Y,Q=N(J,K);return await w(J,Q),async(Z)=>{if(!new URL(Z.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let B=N(J,K);await w(J,B);let{loadStxConfig:z}=await import("./chunk-
|
|
4
|
+
`)}`);let V=z.outputs.find((X)=>X.kind==="entry-point");if(!V)throw Error(`No API bundle for ${B.filePath}`);if(z.outputs.length!==1)throw Error(`API endpoint ${B.filePath} emits assets; package those explicitly instead`);let I=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await V.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write($.join(Y,I),V),Z.push({...B,filePath:I})}return Z}function D(J,Y){let K=J.map((Q)=>({route:Q,...C(Q.pattern)}));return async(Q)=>{let Z=new URL(Q.url).pathname,B=K.filter((G)=>G.regex.test(Z));if(!B.length)return null;let z=B[0].route.pattern,V=(G)=>G.replace(/:\w+/g,":param"),W=B.filter((G)=>V(G.route.pattern)===V(z)),I=Q.method,X=W.find((G)=>G.route.method===I)??(I==="HEAD"?W.find((G)=>G.route.method==="GET"):void 0);if(!X){let G=new Set(W.map((j)=>j.route.method));if(G.has("GET"))G.add("HEAD");return G.add("OPTIONS"),new Response(null,{status:I==="OPTIONS"?204:405,headers:{Allow:Array.from(G).sort().join(", ")}})}let _=X.regex.exec(Z),F=Object.create(null);try{X.params.forEach((G,j)=>{F[G]=decodeURIComponent(_[j+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let G=await Y(X.route);if(typeof G!=="function")throw Error(`API endpoint ${X.route.filePath} must default-export a handler`);let j=await G(Q,{params:F}),U=j instanceof Response?j:j===void 0?new Response(null,{status:204}):Response.json(j);if(I==="HEAD")return new Response(null,{status:U.status,headers:U.headers});return U}catch(G){return console.error(`[stx] API error for ${I} ${z}:`,G),Response.json({error:"Internal Server Error"},{status:500})}}}function l(J,Y){return D(Y,async(K)=>(await import(b($.resolve(J,K.filePath)).href)).default)}async function s(J,Y){if(!Y)return async()=>null;let K=Y===!0?{}:Y,Q=N(J,K);return await w(J,Q),async(Z)=>{if(!new URL(Z.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let B=N(J,K);await w(J,B);let{loadStxConfig:z}=await import("./chunk-8rhjt6fh.js"),V=q((await z(J)).runtimeConfig);return await T(V,()=>D(B,async(W)=>{let I=await Bun.build({entrypoints:[W.filePath],target:"bun",format:"esm",splitting:!1});if(!I.success)throw Error(I.logs.join(`
|
|
5
5
|
`));let X=I.outputs.find((_)=>_.kind==="entry-point");if(!X||I.outputs.length!==1)throw Error(`Unsupported API bundle output: ${W.filePath}`);return(await import(`data:text/javascript;base64,${Buffer.from(await X.text()).toString("base64")}`)).default})(Z))}catch(B){return console.error("[stx] API discovery failed:",B),Response.json({error:"API discovery failed; check the server log"},{status:500})}}}function u(J,Y,K){if(x(J))return!0;let Q=/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/;if(Q.test($.basename(J)))return!0;try{if(Q.test($.basename(H.realpathSync(J))))return!0}catch{}if(O.has($.resolve(J)))return!0;if(!K)return!1;let Z=$.resolve(Y,typeof K==="object"?K.dir??"server/api":"server/api"),B=(V)=>{try{return H.realpathSync(V)}catch{return $.resolve(V)}},z=B(J);return[Z,$.resolve(Y,"server"),$.resolve(Y,".output/server")].some((V)=>{let W=B(V);return z===W||z.startsWith(`${W}${$.sep}`)})}
|
|
6
6
|
export{N as ml,w as nl,p as ol,D as pl,l as ql,s as rl,u as sl};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{$k as c,Zk as a,_k as b,al as d,bl as e,cl as f,dl as g,el as h,fl as i,gl as j,hl as k,il as l,jl as m,kl as n,ll as o}from"./chunk-223makqc.js";import"./chunk-77p1kjg2.js";import"./chunk-fvsefztj.js";import"./chunk-4spaszfn.js";import"./chunk-8y1ve8tc.js";import"./chunk-njx93b4z.js";import"./chunk-bqdfbwdf.js";import"./chunk-89mqnh67.js";import"./chunk-xvh1k1a4.js";import"./chunk-r38xq7fp.js";import"./chunk-y2f41kaq.js";import"./chunk-xj6bcwqa.js";import"./chunk-z8wb7kbj.js";import"./chunk-vhta1be7.js";import"./chunk-tc4pj651.js";import"./chunk-san1eq0r.js";import"./chunk-avwywzsj.js";import"./chunk-wj21f1e0.js";import"./chunk-d86q27j8.js";import"./chunk-72x62kch.js";import"./chunk-yg5r7bnm.js";import"./chunk-9nrgjtah.js";import"./chunk-ejqpq0wc.js";export{o as tempBuildName,b as shouldLogBundlerDiagnostics,f as setBundlerFallbackMode,l as rewriteRegistryImports,g as resolveBundlerFallback,j as registryIdForPath,c as recordBundleFailure,m as queueClientBundleBuild,k as normalizeRegistrySpecifiers,h as hasUserImports,d as getBundleFailures,a as clientBundleDependencies,e as clearBundleFailures,n as bundleClientScript,i as MODULE_SPECIFIER_PREFIX};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ih as x,nh as B,oh as c,ph as u,qh as n}from"./chunk-18018jkn.js";import{
|
|
2
|
+
import{ih as x,nh as B,oh as c,ph as u,qh as n}from"./chunk-18018jkn.js";import{Nw as v}from"./chunk-ejqpq0wc.js";import{resolve as JJ,basename as WJ,extname as _J,join as LJ}from"path";import{mkdir as QJ}from"fs/promises";var ZJ={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0};class V{config;constructor(K={}){this.config={...ZJ,...K}}async get(K,J){return c(K,J,"video",this.config)}async set(K,J,X){return u(K,J,X,"video",this.config)}async clear(){return n("video",this.config)}updateConfig(K){this.config={...this.config,...K}}}var S=null;function D(K){if(!S)S=new V(K);else if(K)S.updateConfig(K);return S}async function q(K,J,X){let N=X?{directory:`${X.outputDir}/../.cache`}:{};return D(N).get(K,J)}async function b(K,J,X,N){let Z=N?{directory:`${N.outputDir}/../.cache`}:{};return D(Z).set(K,J,X)}async function $J(){return D().clear()}import{resolve as y,basename as P,extname as f,join as U}from"path";import{mkdir as g}from"fs/promises";async function m(){try{return await import("ts-videos")}catch{return null}}async function h(K,J,X,N){let Z=await m();if(!Z)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let $=y(K);if(!await B($))return null;await g(X,{recursive:!0});let Y=await x($),z=P(K,f(K)),G=J.format||"webp",M=J.timestamp||0,E=`${z}-poster-${Y}.${G}`,W=U(X,E),Q=await Z.extractThumbnails($,{timestamps:[M],width:J.width||1280,height:J.height,format:G,quality:J.quality||85,outputDir:X,outputPattern:E.replace(`.${G}`,"")});if(Q&&Q.length>0){let _=Q[0];return{path:W,url:`${N}/${E}`,width:_.width||J.width||1280,height:_.height||720,timestamp:M,size:_.size||0}}return null}catch($){return console.warn(`[stx-media] Failed to generate poster: ${$}`),null}}async function d(K,J,X,N){let Z=await m();if(!Z)return[];try{let $=y(K);if(!await B($))return[];await g(X,{recursive:!0});let Y=await x($),z=P(K,f(K)),G=J.format||"webp",W=(await new Z.Input($).getInfo()).duration||60,Q=J.count||10,_=J.interval||W/Q,O=[];for(let w=0;w<Q&&w*_<W;w++)O.push(w*_);let L=await Z.extractThumbnails($,{timestamps:O,width:J.width||320,format:G,quality:J.quality||80,outputDir:X,outputPattern:`${z}-thumb-${Y}`});if(L&&L.length>0)return L.map((w,j)=>({path:w.path||U(X,`${z}-thumb-${Y}-${j}.${G}`),url:`${N}/${z}-thumb-${Y}-${j}.${G}`,width:w.width||J.width||320,height:w.height||180,timestamp:O[j],size:w.size||0}));return[]}catch($){return console.warn(`[stx-media] Failed to generate thumbnails: ${$}`),[]}}async function zJ(K,J,X,N){let Z=await m();if(!Z)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let $=y(K);if(!await B($))return null;await g(X,{recursive:!0});let Y=await x($),z=P(K,f(K)),E=(await new Z.Input($).getInfo()).duration||60,W=J.columns||10,Q=J.interval||5,_=J.thumbnailWidth||160,O=J.thumbnailHeight||90,L=J.format||"jpeg",w=Math.ceil(E/Q),j=Math.ceil(w/W),F=`${z}-sprite-${Y}.${L}`,k=U(X,F),T=[];for(let I=0;I<w;I++)T.push(I*Q);let A=await Z.extractThumbnails($,{timestamps:T,width:_,height:O,format:L,quality:J.quality||70,outputDir:U(X,".temp")});if(!A||A.length===0)return null;try{let I=await import("ts-images"),H=W*_,kJ=j*O,jJ=await I.createSprite({images:A.map((YJ)=>YJ.path),columns:W,padding:0,outputPath:k,format:L,quality:J.quality||70});return{url:`${N}/${F}`,path:k,columns:W,rows:j,thumbnailWidth:_,thumbnailHeight:O,interval:Q,totalFrames:w}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch($){return console.warn(`[stx-media] Failed to generate sprite sheet: ${$}`),null}}import{resolve as r,basename as e,extname as i,join as C}from"path";import{mkdir as R,writeFile as o}from"fs/promises";async function t(){try{return await import("ts-videos")}catch{return null}}var s=[{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 p(K,J,X,N,Z){let $=await t();if(!$)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let Y=r(K);if(!await B(Y))return null;let z=await x(Y),G=e(K,i(K)),M=C(X,`${G}-${z}-hls`);await R(M,{recursive:!0});let E=J.length>0?J:s,W=Z?.segmentDuration||6,O=(await new $.Input(Y).getInfo()).duration||0,L=[],w=0;for(let k of E){let T=C(M,k.label);await R(T,{recursive:!0});let A=`${k.label}.m3u8`,I=C(T,A);try{let H=await $.generateHLS(Y,{outputDir:T,segmentDuration:W,width:k.width,height:k.height,videoBitrate:k.bitrate,audioBitrate:k.audioBitrate,playlistName:k.label});if(H)L.push({quality:k,url:`${N}/${G}-${z}-hls/${k.label}/${A}`,path:I}),w+=H.segmentCount||Math.ceil(O/W)}catch(H){console.warn(`[stx-media] Failed to generate HLS for ${k.label}: ${H}`)}}if(L.length===0)return null;let j=C(M,"master.m3u8"),F=GJ(L,N,G,z);return await o(j,F),{manifestUrl:`${N}/${G}-${z}-hls/master.m3u8`,manifestPath:j,playlists:L,segmentCount:w,duration:O}}catch(Y){return console.warn(`[stx-media] Failed to generate HLS manifest: ${Y}`),null}}function GJ(K,J,X,N){let Z=["#EXTM3U","#EXT-X-VERSION:3"];for(let $ of K){let{quality:Y}=$,z=Y.bitrate+(Y.audioBitrate||128000),G=`${Y.width}x${Y.height||Math.round(Y.width*9/16)}`;Z.push(`#EXT-X-STREAM-INF:BANDWIDTH=${z},RESOLUTION=${G},NAME="${Y.label}"`,`${Y.label}/${Y.label}.m3u8`)}return Z.join(`
|
|
3
3
|
`)}async function l(K,J,X,N,Z){let $=await t();if(!$)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let Y=r(K);if(!await B(Y))return null;let z=await x(Y),G=e(K,i(K)),M=C(X,`${G}-${z}-dash`);await R(M,{recursive:!0});let E=J.length>0?J:s,W=Z?.segmentDuration||4,Q=Z?.minBufferTime||2,L=(await new $.Input(Y).getInfo()).duration||0,w=[],j=[];for(let A of E){let I=C(M,A.label);await R(I,{recursive:!0});try{if(await $.generateDASH(Y,{outputDir:I,segmentDuration:W,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate})){if(w.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${N}/${G}-${z}-dash/${A.label}/video`}),A.audioBitrate)j.push({bandwidth:A.audioBitrate,url:`${N}/${G}-${z}-dash/${A.label}/audio`})}}catch(H){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${H}`)}}if(w.length===0)return null;let F=C(M,"manifest.mpd"),k=NJ(w,j,L,W,Q);await o(F,k);let T=[{type:"video",representations:w}];if(j.length>0)T.push({type:"audio",representations:j});return{manifestUrl:`${N}/${G}-${z}-dash/manifest.mpd`,manifestPath:F,adaptationSets:T,duration:L}}catch(Y){return console.warn(`[stx-media] Failed to generate DASH manifest: ${Y}`),null}}function NJ(K,J,X,N,Z){let $=a(X),Y=a(Z),z=`<?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"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ig as e,kg as kF,lg as UF,mg as wF,ug as EF}from"./chunk-
|
|
2
|
+
import{ig as e,kg as kF,lg as UF,mg as wF,ug as EF}from"./chunk-esjcyxa9.js";import{xg as BF}from"./chunk-57atgbyq.js";import{nj as l,oj as d}from"./chunk-9jbssgem.js";import{Ck as HF,Dk as IF,Ek as KF}from"./chunk-c0n802j1.js";import{ml as YF,ol as ZF}from"./chunk-77p1kjg2.js";import{Fp as VF,Jp as r,Op as o,Wm as s,io as zF,ip as $F,nm as p,pm as i,qr as t,sr as M,xp as GF}from"./chunk-4spaszfn.js";import{ss as XF}from"./chunk-89mqnh67.js";import{it as qF}from"./chunk-r38xq7fp.js";import{Ct as WF}from"./chunk-z8wb7kbj.js";import{Ht as QF}from"./chunk-vhta1be7.js";import{Aw as h,Dw as _F}from"./chunk-yg5r7bnm.js";import G from"fs";import q from"path";import{createHash as NF}from"crypto";_F();function u(Q){return NF("sha256").update(Q).digest("hex").slice(0,8)}function c(Q=!1){let z=Q?d():l(),Z=u(z);return{content:z,filename:`runtime.${Z}.js`,hash:Z}}function a(){let Q=h(),z=u(Q);return{content:Q,filename:`router.${z}.js`,hash:z}}function bF(Q){return{runtimeTag:Q.runtime?`<script src="/__stx/${Q.runtime.filename}"></script>`:"",routerTag:Q.router?`<script src="/__stx/${Q.router.filename}"></script>`:"",cssTag:Q.css?`<link rel="stylesheet" href="/__stx/${Q.css.filename}">`:""}}import n from"path";import{createHash as OF}from"crypto";function TF(Q={}){let z=new Set;return{context:new Proxy(Q,{get(X,F){if(F in X)return X[F];if(typeof F==="string"&&!F.startsWith("__"))z.add(F);return},has(X,F){if(F in X)return!0;if(typeof F==="string"&&!F.startsWith("__"))z.add(F);return!1}}),accessedKeys:z}}async function FF(Q,z,Z={}){let X=n.resolve(Q),F=await Bun.file(X).text(),U=OF("sha256").update(F).digest("hex").slice(0,16);p();let w={};try{w=await M(Z.configDir)}catch{}let H=[],V=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,k;while((k=V.exec(F))!==null){let E=k[1];if(/\bserver\b/.test(E))H.push(k[2])}let W=new Set(H.flatMap((E)=>o(E))),{context:_}=TF({__filename:X,__dirname:n.dirname(X),__stx_serverDeclared:W}),N=new Set,x={...t,...w,...Z,buildMode:"compile",strict:!1},I=await r(F,_,X,x,N),O=e(I),j=i();return{route:z,sourceFile:Q,html:I,fragment:O,placeholders:j,hasServerScripts:H.length>0,serverScriptContent:H,dependencies:Array.from(N),contentHash:U,status:s(F),streamTemplates:_.__streamTemplates}}var MF=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function JF(Q,z){let Z=0,X=0;if(!G.existsSync(Q))return{copied:Z,bytes:X};G.mkdirSync(z,{recursive:!0});function F(U,w){let H=G.readdirSync(U,{withFileTypes:!0});for(let V of H){if(MF.has(V.name))continue;let k=q.join(U,V.name),W=q.join(w,V.name);if(V.isDirectory())G.mkdirSync(W,{recursive:!0}),F(k,W);else if(V.isFile()){if(G.existsSync(W))continue;G.copyFileSync(k,W),Z++,X+=G.statSync(W).size}}}return F(Q,z),{copied:Z,bytes:X}}async function qJ(Q={}){let z=Date.now(),Z=q.resolve(Q.root||process.cwd()),X=q.resolve(Z,Q.outputDir||".output");console.log("[stx build] Starting production build...");let F=await M(Z),U=q.resolve(Z,Q.componentsDir??F.componentsDir??"components"),w=q.resolve(Z,Q.partialsDir??F.partialsDir??"partials"),H=q.resolve(Z,Q.layoutsDir??F.layoutsDir??"layouts"),V=Q.publicDir??F.publicDir??"public",k=F.app?.head||{},W=F.app?.colorMode,_=F.router?.container||"main",N=Q.routeRules??F.routeRules??{},x=BF(N),I=Q.serverApi??F.serverApi,O=typeof I==="object"?I:{};if(I)YF(Z,O);if(F.runtimeConfig)QF(F.runtimeConfig,{});if(G.existsSync(X))G.rmSync(X,{recursive:!0});let j=[q.join(X,"public","__stx"),q.join(X,"public","assets"),q.join(X,"server","pages"),q.join(X,"server","fragments")];for(let Y of j)G.mkdirSync(Y,{recursive:!0});console.log("[stx build] Discovering routes...");let E=zF(Z,{pagesDirs:F._layerPageDirs}),LF=["components","layouts","partials"],y=E.filter((Y)=>{return!LF.some((B)=>Y.pattern.startsWith(`/${B}/`)||Y.pattern===`/${B}`)});console.log(`[stx build] Found ${y.length} page routes (${E.length-y.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let L=c(Q.debug),K=a();await Bun.write(q.join(X,"public","__stx",L.filename),L.content),await Bun.write(q.join(X,"public","__stx",K.filename),K.content),console.log(`[stx build] Runtime: ${L.filename} (${(L.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${K.filename} (${(K.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let R=[],v=[];for(let Y of y){let B=x(Y.pattern),b=B.rendering==="prerender";if(b&&(Y.pattern.includes(":")||Y.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${Y.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let J=await FF(Y.filePath,Y.pattern,{configDir:Z,componentsDir:U,partialsDir:w,layoutsDir:H,debug:Q.debug});if(R.push(J),J.html=J.html.replace(/runtime\.__STX_HASH__\.js/g,L.filename).replace(/router\.__STX_HASH__\.js/g,K.filename),J.html=VF(J.html,k,{bodyScripts:[`<script src="/__stx/${K.filename}"></script>`],...W&&{colorMode:W}}),W)J.html=$F(J.html,W);if(k.htmlAttrs)J.html=GF(J.html,k.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(J.html)){let $=J.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if($&&$[1]){let m=$[1];J.html=J.html.replace(" "+m,""),J.html=J.html.replace(/<body([^>]*)>/,`<body$1 ${m}>`)}}if(J.html=J.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),J.html=await qF(J.html),b){let $=await EF(J,{params:{},request:new Request(`http://stx.build${Y.pattern}`),method:"GET",__stx_strict_hydration:!0});if($.redirect||$.cookies?.length||$.boundaries?.length||$.headers&&Object.keys($.headers).length)throw Error(`Prerendered route ${Y.pattern} cannot set response headers/cookies, redirect or stream`);J.html=$.html,J.status=$.status??J.status,J.hasServerScripts=!1,J.serverScriptContent=[],J.placeholders={}}J.fragment=kF(J.html,_);let C=Y.pattern==="/"?"index":Y.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),g=q.join("server","pages",`${C}.compiled.json`),f=q.join("server","fragments",`${C}.html`);await Bun.write(q.join(X,g),JSON.stringify(J,null,2)),await Bun.write(q.join(X,f),J.fragment),v.push({pattern:Y.pattern,compiledPath:g,fragmentPath:f,isDynamic:J.hasServerScripts,hasParams:Y.pattern.includes(":")||Y.pattern.includes("["),prerendered:b}),console.log(`[stx build] \u2713 ${Y.pattern}`)}catch(J){if(Object.keys(B).length)throw J;console.error(`[stx build] \u2717 ${Y.pattern}:`,J instanceof Error?J.message:J)}}let P=q.resolve(Z,V);if(G.existsSync(P)){let{copied:Y,bytes:B}=JF(P,q.join(X,"public"));if(Y>0)console.log(`[stx build] Copied ${Y} public asset${Y===1?"":"s"} (${(B/1024).toFixed(1)}KB) from ${V}/`)}let A=KF(Z);if(A){let{copied:Y,bytes:B}=JF(A,q.join(X,"public",IF));if(Y>0)console.log(`[stx build] Copied ${Y} asset${Y===1?"":"s"} (${(B/1024).toFixed(1)}KB) from ${HF}/`)}let S={runtime:L.filename,router:K.filename},T=UF(v,S,X);if(T.routeRules=N,T.routerContainer=_,I)T.apiRoutes=await ZF(Z,X,O);if(F.runtimeConfig)await Bun.write(q.join(X,"server/runtime-config.json"),JSON.stringify(F.runtimeConfig)),await WF(Z,F.runtimeConfig);if(F._layerGraph)await Bun.write(q.join(X,"server/layers.json"),JSON.stringify(XF(F._layerGraph),null,2));wF(T,X);let D=Date.now()-z;return console.log(`
|
|
3
3
|
[stx build] Done in ${D}ms \u2014 ${R.length} pages compiled`),{pageCount:R.length,assets:S,outputDir:X,duration:D}}
|
|
4
4
|
export{u as Rf,c as Sf,a as Tf,bF as Uf,FF as Vf,qJ as Wf};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Nw as l}from"./chunk-ejqpq0wc.js";import U from"fs";import G from"path";import I from"os";import H from"crypto";import{generatePlaceholder as m,processImage as g}from"ts-images";var d=[320,640,768,1024,1280,1536,1920],h=["webp","jpeg"],b=80,u=[".jpg",".jpeg",".png",".webp",".avif",".gif",".svg"],P={webp:"image/webp",avif:"image/avif",jpeg:"image/jpeg",png:"image/png"},N=null,W=!1;async function Y(){if(W)return N;W=!0;try{let J=await import("sharp");return N=J.default||J,N}catch{return null}}async function e(){return await Y()!==null}async function t(){return!0}async function JJ(J,K={}){let{widths:Z=d,formats:$=h,quality:q=b,fit:C="cover",placeholder:X="none",outputDir:Q=".stx/images",baseUrl:_="/images"}=K,j,x;if(typeof J==="string"){if(x=J,!await Bun.file(J).exists())throw new L(`Image not found: ${J}`,"NOT_FOUND");j=await Bun.file(J).arrayBuffer().then((V)=>Buffer.from(V))}else x="buffer-input",j=J;let w=H.createHash("sha256").update(j).digest("hex").slice(0,12),y=await O(j),{width:B,height:D}=y,A=B/D;await U.promises.mkdir(Q,{recursive:!0});let T=[],v=G.basename(x,G.extname(x)),z=Z.filter((V)=>V<=B);if(!z.includes(B)&&B<=Math.max(...Z))z.push(B);z.sort((V,R)=>V-R);for(let V of z){let R=Math.round(V/A);for(let F of $){let S=`${v}-${V}w-${w}.${F}`,k=G.join(Q,S),c=`${_}/${S}`,E=await n(j,{width:V,height:R,format:F,quality:q,fit:C});await Bun.write(k,E),T.push({path:k,url:c,width:V,height:R,format:F,size:E.length})}}let M;if(X!=="none")M=await o(j,X);return{src:x,variants:T,placeholder:M,width:B,height:D,aspectRatio:A,hash:w}}async function O(J){let K=typeof J==="string"?Buffer.from(await Bun.file(J).arrayBuffer()):J,Z=await Y();if(Z){let q=await Z(K).metadata();return{width:q.width||0,height:q.height||0,format:q.format||"unknown",hasAlpha:q.hasAlpha}}return p(K)}function p(J){if(J[0]===137&&J[1]===80&&J[2]===78&&J[3]===71){let K=J.readUInt32BE(16),Z=J.readUInt32BE(20);return{width:K,height:Z,format:"png",hasAlpha:!0}}if(J[0]===255&&J[1]===216){let K=2;while(K<J.length){if(J[K]!==255)break;let Z=J[K+1];if(Z>=192&&Z<=207&&Z!==196&&Z!==200&&Z!==204){let q=J.readUInt16BE(K+5);return{width:J.readUInt16BE(K+7),height:q,format:"jpeg",hasAlpha:!1}}let $=J.readUInt16BE(K+2);K+=2+$}}if(J.toString("utf8",0,4)==="RIFF"&&J.toString("utf8",8,12)==="WEBP"){let K=J.toString("utf8",12,16);if(K==="VP8 "){let Z=J.readUInt16LE(26)&16383,$=J.readUInt16LE(28)&16383;return{width:Z,height:$,format:"webp",hasAlpha:!1}}if(K==="VP8L"){let Z=J.readUInt32LE(21),$=(Z&16383)+1,q=(Z>>14&16383)+1;return{width:$,height:q,format:"webp",hasAlpha:!0}}}if(J.toString("utf8",0,3)==="GIF"){let K=J.readUInt16LE(6),Z=J.readUInt16LE(8);return{width:K,height:Z,format:"gif",hasAlpha:!0}}throw new L("Unable to parse image dimensions","PARSE_ERROR")}async function n(J,K){let Z=await Y();if(Z){let q=Z(J).resize(K.width,K.height,{fit:K.fit});switch(K.format){case"webp":q=q.webp({quality:K.quality});break;case"avif":q=q.avif({quality:K.quality});break;case"jpeg":q=q.jpeg({quality:K.quality});break;case"png":q=q.png({quality:K.quality});break}return q.toBuffer()}let $=G.join(I.tmpdir(),`stx-img-${H.randomBytes(8).toString("hex")}.${K.format}`);try{return await g({input:J,output:$,format:K.format,quality:K.quality,resize:{width:K.width,height:K.height,fit:K.fit}}),Buffer.from(await Bun.file($).arrayBuffer())}finally{await U.promises.unlink($).catch(()=>{})}}async function o(J,K){let Z=await Y();if(K==="blur"&&Z){let X=(await Z(J).resize(20).blur(10).toBuffer()).toString("base64"),Q=await O(J);return`data:${P[Q.format]||"image/jpeg"};base64,${X}`}if(K==="dominant-color"&&Z){let{dominant:C}=await Z(J).resize(1,1).toBuffer().then(async(X)=>{let Q=await Z(X).metadata();return{dominant:{r:128,g:128,b:128}}}).catch(()=>({dominant:{r:128,g:128,b:128}}));return`rgb(${C.r}, ${C.g}, ${C.b})`}let $=await O(J),q=G.join(I.tmpdir(),`stx-ph-${H.randomBytes(8).toString("hex")}.${$.format==="unknown"?"bin":$.format}`);try{await Bun.write(q,J);let C=K==="blur"?"blur":K==="thumbhash"?"thumbhash":"dominant-color",Q=await m(q,{strategy:C,width:C==="thumbhash"?void 0:32});if(K==="dominant-color"&&Q.dominantColor)return Q.dominantColor;if(Q.dataURL)return Q.dataURL;return"rgb(128, 128, 128)"}catch{return"rgb(128, 128, 128)"}finally{await U.promises.unlink(q).catch(()=>{})}}function KJ(J,K){return(K?J.filter(($)=>$.format===K):J).sort(($,q)=>$.width-q.width).map(($)=>`${$.url} ${$.width}w`).join(", ")}function ZJ(J){if(!J||Object.keys(J).length===0)return"100vw";return Object.entries(J).sort((Z,$)=>{let q=Number.parseInt(Z[0].replace(/\D/g,""))||0;return(Number.parseInt($[0].replace(/\D/g,""))||0)-q}).map(([Z,$])=>`(max-width: ${Z}) ${$}`).join(", ")+", 100vw"}function $J(J){let K=J.filter(($)=>$.format==="jpeg");if(K.length===0)return J[Math.floor(J.length/2)];let Z=K.sort(($,q)=>$.width-q.width);return Z[Math.floor(Z.length/2)]}function qJ(J){let K=new Map;for(let Z of J){let $=K.get(Z.format)||[];$.push(Z),K.set(Z.format,$)}return K}function CJ(J){let K=G.extname(J).toLowerCase();return u.includes(K)}function QJ(J){return P[J]||"application/octet-stream"}function VJ(J){return J.reduce((K,Z)=>K+Z.size,0)}function XJ(J){if(J<1024)return`${J} B`;if(J<1048576)return`${(J/1024).toFixed(1)} KB`;return`${(J/1048576).toFixed(2)} MB`}class L extends Error{code;constructor(J,K){super(J);this.name="ImageProcessingError",this.code=K}}
|
|
3
3
|
export{d as Af,h as Bf,b as Cf,e as Df,t as Ef,JJ as Ff,O as Gf,n as Hf,KJ as If,ZJ as Jf,$J as Kf,qJ as Lf,CJ as Mf,QJ as Nf,VJ as Of,XJ as Pf,L as Qf};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Qg as a,Rg as b,Sg as c,Tg as d,Ug as e,Vg as f,Wg as g,Xg as h,Yg as i}from"./chunk-
|
|
2
|
+
import{Qg as a,Rg as b,Sg as c,Tg as d,Ug as e,Vg as f,Wg as g,Xg as h,Yg as i}from"./chunk-rwwfzkz4.js";import"./chunk-18018jkn.js";import"./chunk-ejqpq0wc.js";export{c as setCachedImageResult,e as processImage,f as optimizeImage,b as getCachedImageResult,i as generateSrcset,h as generateResponsiveVariants,d as clearImageCache,g as applyTransformations,a as ImageProcessorCache};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
import I from"fs";import F from"path";import{createHash as w}from"crypto";var H=["pages","components","layouts","partials","composables"],Y=new Set;function u(j){try{return Y.has(I.realpathSync(j))}catch{return Y.has(F.resolve(j))}}var L=new Set(["extends","root",...H.map((j)=>`${j}Dir`),"publicDir","stateDir","cachePath"]),Z=(j)=>j!==null&&typeof j==="object"&&(Object.getPrototypeOf(j)===Object.prototype||Object.getPrototypeOf(j)===null);function _(j,z,A=""){if(Array.isArray(z))return["middleware","plugins"].includes(A)?[...Array.isArray(j)?j:[],...z]:[...z];if(!Z(z))return z;let E={...Z(j)?j:{}};for(let[B,G]of Object.entries(z)){if(["__proto__","constructor","prototype"].includes(B))throw Error(`Invalid layer config key: ${B}`);E[B]=_(E[B],G,B)}return E}function $(j){for(let z of["stx.config.ts","stx.config.js","stx.config.mjs",".config/stx.config.ts",".config/stx.ts","ui.config.ts"]){let A=F.join(j,z);if(I.existsSync(A))return I.realpathSync(A)}throw Error(`Application layer has no stx.config.ts: ${j}`)}function S(j,z,A){if(typeof j!=="string"||!j||/^(?:https?:|git[+:])/.test(j))throw Error(`Invalid application layer ${JSON.stringify(j)} in ${z}; use a local path or installed package`);if(j.startsWith(".")||F.isAbsolute(j)){let B=F.resolve(z,j);return I.statSync(B).isDirectory()?$(B):I.realpathSync(B)}let E=z;while(!0){let B=F.join(E,"node_modules",j),G=F.join(B,"package.json");if(I.existsSync(G)){A.add(I.realpathSync(G));let T=JSON.parse(I.readFileSync(G,"utf8"));return T.stx?.layer?I.realpathSync(F.resolve(B,T.stx.layer)):$(B)}let J=F.dirname(E);if(J===E)break;E=J}throw Error(`Cannot resolve application layer ${JSON.stringify(j)} from ${z}`)}async function C(j,z){let A=await Bun.build({entrypoints:[j],target:"bun",format:"esm",splitting:!1,plugins:[{name:"stx-layer-config",setup(G){G.onResolve({filter:/^[^./]/},(J)=>{if(J.path.startsWith("node:"))return{path:J.path,external:!0};return{path:Bun.resolveSync(J.path,J.resolveDir),external:!0}}),G.onLoad({filter:/./},(J)=>{let T=I.realpathSync(J.path);z.add(T),Y.add(T);return})}}]});if(!A.success)throw Error(`Cannot load layer ${j}: ${A.logs.join(`
|
|
3
3
|
`)}`);let E=A.outputs.find((G)=>G.kind==="entry-point");if(!E||A.outputs.length!==1)throw Error(`Unsupported layer config output: ${j}`);let B=(await import(`data:text/javascript;base64,${Buffer.from(await E.text()).toString("base64")}`)).default;if(!Z(B))throw Error(`Layer ${j} must default-export a config object`);return B}async function v(j,z){let A=new Set,E=[],B=[],G=new Set,J=[];async function T(q,M){if(q=I.realpathSync(q),J.includes(q))throw Error(`Application layer cycle: ${[...J,q].join(" -> ")}`);if(G.has(q))return;G.add(q),J.push(q);let U=await C(q,A);M??=F.basename(F.dirname(q))===".config"?F.dirname(F.dirname(q)):F.dirname(q),M=I.realpathSync(M);let D=F.resolve(M,U.root??"."),K=Object.fromEntries(H.map((Q)=>[Q,F.resolve(D,U[`${Q}Dir`]??(Q==="composables"?"functions":Q))]));E.push({root:M,configFile:q,resources:K});let N={...U};if(N.plugins)N.plugins=N.plugins.map((Q)=>{let W=typeof Q==="string"?Q:Q[0],X=W.startsWith(".")?F.resolve(M,W):F.isAbsolute(W)?W:Bun.resolveSync(W,M);return A.add(I.realpathSync(X)),typeof Q==="string"?X:[X,Q[1]]});if(typeof N.css==="string")N.css=F.resolve(M,N.css);if(N.serverApi)N.serverApi={...typeof N.serverApi==="object"?N.serverApi:{},dir:F.resolve(M,typeof N.serverApi==="object"?N.serverApi.dir??"server/api":"server/api")};if(B.push(N),U.extends!==void 0&&!Array.isArray(U.extends))throw Error(`extends in ${q} must be an array`);for(let Q of U.extends??[])await T(S(Q,M,A));J.pop()}await T($(j),j);for(let q of["package.json","bun.lock","package-lock.json","pnpm-lock.yaml"]){let M=F.join(j,q);if(I.existsSync(M))A.add(I.realpathSync(M))}let O=_({},z);for(let q=B.length-1;q>=0;q--){let M=q===0?B[q]:Object.fromEntries(Object.entries(B[q]).filter(([U])=>!L.has(U)));O=_(O,M)}let V={layers:E,configDependencies:[...A].sort()};return O._layerGraph=V,O._layerPageDirs=E.map((q)=>q.resources.pages),O._layerComponentDirs=E.map((q)=>q.resources.components),O._layerLayoutDirs=E.map((q)=>q.resources.layouts),O._layerPartialDirs=E.map((q)=>q.resources.partials),O._layerComposableDirs=E.map((q)=>q.resources.composables),await R(V,j),{config:O,graph:V}}async function R(j,z){let A=new Map,E=[];for(let B of j.layers)for(let[G,J]of Object.entries(B.resources)){if(!I.existsSync(J))continue;let T=new Bun.Glob(G==="composables"?"**/*.ts":"**/*.stx");for(let O of[...T.scanSync({cwd:J})].sort()){let V=`${G}/${O}`,q=F.join(J,O),M=A.get(V);if(M)E.push({resource:V,winner:M,shadowed:q});else A.set(V,q)}}Object.assign(j,{overrides:E}),await Bun.write(F.join(z,".stx/layers.json"),JSON.stringify(j,null,2))}function P(j){let z=new Set(j.configDependencies);function A(E){if(!I.existsSync(E))return;z.add(E);for(let B of I.readdirSync(E,{withFileTypes:!0}).sort((G,J)=>G.name.localeCompare(J.name))){if(B.name.startsWith(".")||B.name==="node_modules")continue;let G=F.join(E,B.name);if(B.isDirectory())A(G);else if(B.isFile())z.add(G)}}for(let E of j.layers)for(let B of Object.values(E.resources))A(B);return[...z].sort()}function h(j){return x(P(j))}function y(j){return x(j.configDependencies)}function x(j){return j.map((z)=>{try{let A=I.statSync(z);return`${z}:${A.mtimeMs}:${A.size}`}catch{return`${z}:missing`}}).join(`
|
|
4
4
|
`)}function g(j){return j.layers.map((z)=>({config:F.relative(z.root,z.configFile),files:P({layers:[z],configDependencies:j.configDependencies.filter((A)=>A.startsWith(`${z.root}${F.sep}`))}).filter((A)=>I.statSync(A).isFile()).map((A)=>({path:F.relative(z.root,A).replaceAll(F.sep,"/"),sha256:w("sha256").update(I.readFileSync(A)).digest("hex")}))}))}
|
|
5
|
-
export{u as
|
|
5
|
+
export{u as ns,v as os,R as ps,h as qs,y as rs,g as ss};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Af as a,Bf as b,Cf as c,Df as d,Ef as e,Ff as f,Gf as g,Hf as h,If as i,Jf as j,Kf as k,Lf as l,Mf as m,Nf as n,Of as o,Pf as p,Qf as q}from"./chunk-
|
|
2
|
+
import{Af as a,Bf as b,Cf as c,Df as d,Ef as e,Ff as f,Gf as g,Hf as h,If as i,Jf as j,Kf as k,Lf as l,Mf as m,Nf as n,Of as o,Pf as p,Qf as q}from"./chunk-7qp3zphs.js";import"./chunk-ejqpq0wc.js";export{h as resizeAndConvert,f as processImage,d as isSharpAvailable,m as isImageFile,e as isImageBackendAvailable,l as groupVariantsByFormat,o as getTotalSize,n as getMimeType,g as getImageMetadata,k as getFallbackVariant,i as generateSrcSet,j as generateSizes,p as formatSize,q as ImageProcessingError,a as DEFAULT_WIDTHS,c as DEFAULT_QUALITY,b as DEFAULT_FORMATS};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{qr as a,rr as b,sr as c,tr as d,ur as e,vr as f}from"./chunk-4spaszfn.js";import"./chunk-8y1ve8tc.js";import"./chunk-njx93b4z.js";import"./chunk-bqdfbwdf.js";import"./chunk-89mqnh67.js";import"./chunk-xvh1k1a4.js";import"./chunk-r38xq7fp.js";import"./chunk-y2f41kaq.js";import"./chunk-xj6bcwqa.js";import"./chunk-z8wb7kbj.js";import"./chunk-vhta1be7.js";import"./chunk-tc4pj651.js";import"./chunk-san1eq0r.js";import"./chunk-avwywzsj.js";import"./chunk-wj21f1e0.js";import"./chunk-d86q27j8.js";import"./chunk-72x62kch.js";import"./chunk-yg5r7bnm.js";import"./chunk-9nrgjtah.js";import"./chunk-ejqpq0wc.js";export{f as validateConfig,b as resolveStxDirectories,c as loadStxConfig,e as defineStxConfig,a as defaultConfig,d as config};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{ls as _}from"./chunk-bqdfbwdf.js";import"./chunk-ejqpq0wc.js";function W(j,G,H=240){return j.slice(G,G+H)}var v=[{rule:"route-params",pattern:/\blocation\s*\.\s*pathname\s*\.\s*(?:match|split)\s*\(/g,primitive:"useRoute() / useRouteParams() / useRouteParam(name)",why:"parsing the URL by hand re-implements the router and does not update on SPA navigation"},{rule:"alert",pattern:/(?<![.#\w$])(?:(?:window|globalThis)\s*\.\s*)?alert\s*\(/g,primitive:"stxAlert(message)",why:"themed, focus-trapped and non-blocking \u2014 but `await` it if the code after it "+"depended on the native dialog blocking until dismissal",reject:(j)=>/\b(?:async\s+)?function\s+alert\s*\(/.test(j)||/\b(?:const|let|var)\s+alert\s*=/.test(j)},{rule:"search-params",pattern:/new\s+URLSearchParams\s*\(/g,primitive:"useSearchParams()",why:"reactive, and writes back through the router instead of history.replaceState",reject:(j,G)=>{let H=j.indexOf("(",G);if(H===-1)return!0;let Q=j.slice(H+1,j.indexOf(")",H)+1);return!/\b(?:location|search|href|url)\b/i.test(Q)}},{rule:"navigate",pattern:/\blocation\s*\.\s*(?:assign|replace)\s*\(|\blocation\s*\.\s*href\s*=/g,primitive:"navigate(path) / goBack()",why:"a full document load throws away every store and the scroll position; navigate() is an SPA transition",reject:(j,G)=>/^[^\n]*?(?:['"`]\s*)?(?:mailto:|tel:|sms:|https?:\/\/|\/\/)/.test(W(j,G,160))},{rule:"fetch",pattern:/new\s+AbortController\s*\(/g,primitive:"useFetch(url) / useAsyncData(key, fn)",why:"cancellation, loading and error state are already wired; hand-rolling them is where the races live"},{rule:"polling",pattern:/setInterval\s*\(/g,primitive:"useEventSource() / useSSE() / useWebSocket() / useChannel()",why:"polling burns requests and lags; the push primitives are delivered",reject:(j,G)=>!/\bfetch\s*\(|\$fetch\b|useFetch\b|\.get\s*\(|axios\b/.test(W(j,G))},{rule:"debounce",pattern:/\bclearTimeout\s*\(/g,primitive:"useDebounce(fn, ms) / useThrottle(fn, ms)",why:"a hand-held timer handle per call site is the usual source of stale-result bugs",requires:(j)=>/setTimeout\s*\(/.test(j)},{rule:"click-outside",pattern:/document\s*\.\s*addEventListener\s*\(\s*['"](?:click|mousedown|pointerdown)['"]/g,primitive:"useClickOutside(ref, fn)",why:"the document-level listener plus the blur race is exactly what this composable exists to remove"},{rule:"focus",pattern:/\.\s*(?:getElementById|querySelector)\s*\([^)]*\)\s*(?:\?\.)?\s*\.?focus\s*\(/g,primitive:"useFocus(ref) with x-ref",why:"a query by id breaks under nested scopes and SPA navigation; a ref does not"},{rule:"clipboard",pattern:/navigator\s*\.\s*(?:clipboard|share)\b/g,primitive:"useClipboard() / useShare()",why:"permission state, the copied flag and the unsupported-browser fallback are already handled"},{rule:"watch",pattern:/\beffect\s*\(\s*\(\s*\)\s*=>\s*\{[^}]*\bvoid\s+\w+\s*\(\s*\)/g,primitive:"watch(source, cb) / watchMultiple([...], cb)",why:"the `void a(); void b()` dance is a manual dependency list; watch takes one directly"}],U=["confirm","tooltip",...v.map((j)=>j.rule)];function N(j,G){let H=1;for(let Q=0;Q<G;Q++)if(j[Q]===`
|
|
3
3
|
`)H++;return H}function P(j,G){let H=j.lastIndexOf(`
|
|
4
4
|
`,G)+1,Q=j.indexOf(`
|
|
5
5
|
`,G);return j.slice(H,Q===-1?j.length:Q).trim().slice(0,120)}function q(j,G){let H=j.slice(0,G),Q=H.lastIndexOf("function"),X=H.lastIndexOf("=>"),M=Math.max(Q,X);if(M===-1)return!1;let z=j.slice(Math.max(0,M-120),M);return/\basync\b[^;{}]*$/.test(z)}function L(j){return/\b(?:async\s+)?function\s+confirm\s*\(/.test(j)||/\b(?:const|let|var)\s+confirm\s*=/.test(j)||/\bimport\s*\{[^}]*\bconfirm\b[^}]*\}/.test(j)}function O(j,G,H){if(L(j))return j;let Q=/(^|[^\w$.])(?:(?:window|globalThis)\s*\.\s*)?confirm\s*\(/g,X=F(j),M="",z=0,Y;while((Y=Q.exec(X))!==null){let Z=Y.index+Y[1].length,$=N(j,Z),J=P(j,Z);if(/stxConfirm\s*\($/.test(j.slice(0,Z+8)))continue;let D=q(j,Z);if(H.push({file:G,line:$,rule:"confirm",applied:D,snippet:J,reason:D?void 0:"stxConfirm() returns a Promise and native confirm() is synchronous, so this needs `await` inside an async function. Rewriting it here would make the condition always true."}),D)M+=j.slice(z,Z)+"await stxConfirm(",z=Z+(Y[0].length-Y[1].length)}return M+j.slice(z)}function w(j,G,H){let Q=/(<[a-z][\w-]*\b[^>]*?)\stitle=(["'])(.*?)\2/gis,X=C(j),M="",z=0,Y;while((Y=Q.exec(X))!==null){let[Z,$,J,D]=Y,K=N(j,Y.index),B=P(j,Y.index),V=$.match(/^<([A-Za-z][\w-]*)/)?.[1]??"";if(/^[A-Z]/.test(V)){H.push({file:G,line:K,rule:"tooltip",applied:!1,snippet:B,reason:`\`title\` on <${V}> is a component prop, not an HTML attribute \u2014 `+"adding x-tooltip here would put a tooltip on a component and may duplicate text it already renders."});continue}if(/\bx-tooltip[=\s]/.test($)||D.trim()===""){H.push({file:G,line:K,rule:"tooltip",applied:!1,snippet:B,reason:/\bx-tooltip[=\s]/.test($)?"already has x-tooltip":"empty title"});continue}H.push({file:G,line:K,rule:"tooltip",applied:!0,snippet:B}),M+=j.slice(z,Y.index)+`${$} x-tooltip=${J}${D}${J} title=${J}${D}${J}`,z=Y.index+Z.length}return M+j.slice(z)}function C(j){return j.replace(/<!--[\s\S]*?-->/g,(G)=>G.replace(/[^\n]/g," ")).replace(/\{\{--[\s\S]*?--\}\}/g,(G)=>G.replace(/[^\n]/g," "))}function E(j){let G=(H)=>H.replace(/[^\n]/g," ");return j.replace(/\/\*[\s\S]*?\*\//g,G).replace(/\/\/[^\n]*/g,G)}function F(j,G=!1){let H=C(j);return(G?E(H):_(H)).replace(/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi,(X,M)=>/\bclient\b/i.test(M)?X:X.replace(/[^\n]/g," "))}function S(j,G,H,Q){let X=F(j),M=F(j,!0);for(let z of v){if(!H.includes(z.rule))continue;if(z.requires&&!z.requires(j))continue;z.pattern.lastIndex=0;let Y,Z=/['"]/.test(z.pattern.source)?M:X;z.pattern.lastIndex=0;while((Y=z.pattern.exec(Z))!==null){if(z.reject?.(j,Y.index))continue;Q.push({file:G,line:N(j,Y.index),rule:z.rule,applied:!1,snippet:P(j,Y.index),reason:`${z.primitive} \u2014 ${z.why}`})}}}function k(j,G={}){let H=G.rules??U,Q=G.file??"<source>",X=[];S(j,Q,H,X);let M=j;if(H.includes("confirm"))M=O(M,Q,X);if(H.includes("tooltip"))M=w(M,Q,X);X.sort((Z,$)=>Z.line-$.line);let z=new Set,Y=X.filter((Z)=>{let $=`${Z.rule}:${Z.line}`;if(z.has($))return!1;return z.add($),!0});return{code:M,findings:Y}}var I=new Set(["confirm","tooltip"]);function A(j,G){if(j.length===0)return"No hand-rolled equivalents found.";let H=j.filter((z)=>z.applied),Q=j.filter((z)=>!z.applied&&I.has(z.rule)),X=j.filter((z)=>!z.applied&&!I.has(z.rule)),M=[];if(H.length>0){M.push(G?`Rewrote ${H.length} site(s):`:`Would rewrite ${H.length} site(s) (pass --fix):`);for(let z of H)M.push(` ${z.file}:${z.line} [${z.rule}] ${z.snippet}`)}if(Q.length>0){M.push("",`Needs a human \u2014 ${Q.length} site(s):`);for(let z of Q)M.push(` ${z.file}:${z.line} [${z.rule}] ${z.snippet}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{js as i}from"./chunk-njx93b4z.js";import{Du as R,Tu as T,lv as S}from"./chunk-avwywzsj.js";import{Nw as g}from"./chunk-ejqpq0wc.js";import k from"path";var O;async function t(){if(O!==void 0)return O;try{O=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{O=null}return O}var y={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},F={},V={},E={};function vq(q){if(q)delete F[q];else for(let X of Object.keys(F))delete F[X]}function fq(){let q=Object.entries(F).map(([X,Q])=>({locale:X,loadedAt:new Date(Q.loadedAt),keyCount:p(Q.translations)}));return{size:Object.keys(F).length,locales:Object.keys(F),entries:q}}function p(q,X=0){for(let Q of Object.values(q))if(X++,Q&&typeof Q==="object"&&!Array.isArray(Q))X=p(Q,X);return X}function e(q,X=0){if(X<=0)return!1;return Date.now()-q.loadedAt>X}function dq(q){if(F[q])return"loaded";return E[q]||"idle"}function gq(q){return E[q]==="loading"}function uq(q){return!!F[q]}async function qq(q,X){let{locales:Q,parallel:H=!0,priority:J={},onLocaleLoaded:Y,onComplete:W,onError:$}=q,Z=H?Q:[...Q].sort((_,z)=>(J[z]||0)-(J[_]||0));if(H){let _=Z.map(async(z)=>{try{await P(z,X),Y?.(z)}catch(G){$?.(z,G instanceof Error?G:Error(String(G)))}});await Promise.all(_)}else for(let _ of Z)try{await P(_,X),Y?.(_)}catch(z){$?.(_,z instanceof Error?z:Error(String(z)))}W?.()}function hq(q,X){queueMicrotask(()=>{qq(q,X).catch((Q)=>{if(X.debug)console.error("Background preload error:",Q)})})}async function P(q,X){if({...y,...X.i18n}.cache&&F[q]){let J=F[q],Y=X.i18n?.cacheMaxAge??0;if(!e(J,Y))return J.translations}if(V[q]?.state==="loading")return V[q].promise;E[q]="loading";let H=b(q,X).then((J)=>{return E[q]="loaded",delete V[q],J}).catch((J)=>{throw E[q]="error",V[q]={promise:H,state:"error",error:J instanceof Error?J:Error(String(J))},J});return V[q]={promise:H,state:"loading"},H}function Hq(q){return F[q]?.translations}async function pq(q,X){let Q=Hq(q);if(Q)return Q;return P(q,X)}async function mq(q,X){if(F[q])return F[q].translations;if(V[q]){if(X)return Promise.race([V[q].promise,new Promise((Q,H)=>setTimeout(()=>H(Error(`Timeout waiting for locale: ${q}`)),X))]);return V[q].promise}throw Error(`Locale "${q}" is not loading. Call loadTranslationLazy first.`)}function cq(){return Object.entries(E).filter(([q,X])=>X==="loading").map(([q])=>q)}function iq(q){if(q)delete V[q],delete E[q];else{for(let X of Object.keys(V))delete V[X];for(let X of Object.keys(E))delete E[X]}}async function b(q,X){let Q={...y,...X.i18n},H=k.isAbsolute(Q.translationsDir)?Q.translationsDir:k.resolve(X.root||process.cwd(),Q.translationsDir);try{let J=await t(),Y=J?await J(q,{translationsDir:H,defaultLocale:Q.defaultLocale,sources:$q(Q.format)}):await Jq(q,Q,H);if(Y===void 0){if(q!==Q.defaultLocale)return b(Q.defaultLocale,X);return{}}let W=Y;if(Q.cache)F[q]={translations:W,loadedAt:Date.now(),locale:q};return W}catch(J){if(X.debug)console.error(`Error loading translation file for locale "${q}":`,J);if(q!==Q.defaultLocale)return b(Q.defaultLocale,X);return{}}}async function Jq(q,X,Q){let H=k.join(Q,`${q}${Qq(X.format)}`);try{let J=await import(H);return J.default||J}catch(J){try{let Y=await Bun.file(H).text();if(X.format==="yaml"||X.format==="yml")return Xq(Y);if(X.format==="json")return JSON.parse(Y);throw J}catch{return}}}function Qq(q){switch(q){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function Xq(q){let X={},Q=q.split(`
|
|
3
3
|
`),H=[{obj:X,indent:-1}];for(let J of Q){let Y=J.replace(/#.*$/,"").trimEnd();if(!Y.trim())continue;let W=Y.search(/\S/);if(W===-1)continue;while(H.length>1&&H[H.length-1].indent>=W)H.pop();let $=H[H.length-1].obj,Z=Y.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(Z){let[,,_,z]=Z,G=_.trim(),w=z.trim();if(w==="")$[G]={},H.push({obj:$[G],indent:W});else $[G]=Zq(w)}}return X}function Zq(q){if(q.startsWith("'")&&q.endsWith("'")||q.startsWith('"')&&q.endsWith('"'))return q.slice(1,-1);let X=q.toLowerCase();if(X==="true"||X==="yes")return!0;if(X==="false"||X==="no")return!1;if(X==="null"||X==="~")return null;let Q=Number(q);if(!Number.isNaN(Q)&&q!=="")return Q;return q}function $q(q){switch(q){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function Wq(q,X){return P(q,X)}function Yq(q,X){for(let Q of q){let H=Q.trim(),J=H.match(/^\{(\d+)\}\s*(.*)$/);if(J){let W=Number.parseInt(J[1],10);if(X===W)return J[2];continue}let Y=H.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(Y){let W=Number.parseInt(Y[1],10),$=Y[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(Y[2],10);if(X>=W&&X<=$)return Y[3];continue}}if(q.length===2)return X===1?q[0].trim():q[1].trim();if(X<q.length)return q[X].trim();return q[q.length-1].trim()}function _q(q,X={}){return m(q,X)}function m(q,X){let Q="",H=0;while(H<q.length)if(q[H]==="{"){let J=zq(q,H);if(J===-1){Q+=q[H],H++;continue}let Y=q.slice(H+1,J);Q+=Gq(Y,X),H=J+1}else if(q[H]==="'"&&H+1<q.length)if(q[H+1]==="'")Q+="'",H+=2;else if(q[H+1]==="{"||q[H+1]==="}")Q+=q[H+1],H+=2;else Q+=q[H],H++;else Q+=q[H],H++;return Q}function zq(q,X){let Q=0;for(let H=X;H<q.length;H++)if(q[H]==="{")Q++;else if(q[H]==="}"){if(Q--,Q===0)return H}return-1}function Gq(q,X){let Q=Bq(q);if(Q.length===0)return`{${q}}`;let H=Q[0].trim(),J=X[H];if(Q.length===1)return J!==void 0?String(J):`{${H}}`;switch(Q[1].trim().toLowerCase()){case"plural":return wq(J,Q.slice(2).join(","),X);case"select":return Dq(J,Q.slice(2).join(","));case"selectordinal":return Kq(J,Q.slice(2).join(","));case"number":return Vq(J,Q[2]?.trim());case"date":return Eq(J,Q[2]?.trim());case"time":return Aq(J,Q[2]?.trim());default:return J!==void 0?String(J):`{${q}}`}}function Bq(q){let X=[],Q="",H=0;for(let J=0;J<q.length;J++){let Y=q[J];if(Y==="{")H++,Q+=Y;else if(Y==="}")H--,Q+=Y;else if(Y===","&&H===0)X.push(Q),Q="";else Q+=Y}if(Q)X.push(Q);return X}function wq(q,X,Q){let H=Number(q)||0,J=C(X),Y=`=${H}`;if(J[Y])return I(J[Y],H,Q);let W=jq(H);if(J[W])return I(J[W],H,Q);if(J.other)return I(J.other,H,Q);return String(H)}function I(q,X,Q){let H=q.replace(/#/g,String(X));return m(H,Q)}function jq(q){let X=Math.abs(q),Q=Math.floor(X),H=String(q).includes(".")?String(q).split(".")[1].length:0;if(Q===1&&H===0)return"one";return"other"}function Dq(q,X){let Q=String(q||""),H=C(X);if(H[Q])return H[Q];return H.other||String(q)}function Kq(q,X){let Q=Number(q)||0,H=C(X),J=Fq(Q);if(H[J])return H[J].replace(/#/g,String(Q));if(H.other)return H.other.replace(/#/g,String(Q));return String(Q)}function Fq(q){let X=Math.abs(q),Q=X%10,H=X%100;if(Q===1&&H!==11)return"one";if(Q===2&&H!==12)return"two";if(Q===3&&H!==13)return"few";return"other"}function C(q){let X={},Q=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,H=Q.exec(q);while(H!==null)X[H[1]]=H[2],H=Q.exec(q);return X}function Vq(q,X){let Q=Number(q);if(Number.isNaN(Q))return String(q);switch(X){case"integer":return Math.floor(Q).toLocaleString();case"percent":return`${(Q*100).toFixed(0)}%`;case"currency":return Q.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Q.toLocaleString()}}function Eq(q,X){let Q=q instanceof Date?q:new Date(String(q));if(Number.isNaN(Q.getTime()))return String(q);let H={};switch(X){case"short":H.dateStyle="short";break;case"medium":H.dateStyle="medium";break;case"long":H.dateStyle="long";break;case"full":H.dateStyle="full";break;default:H.dateStyle="medium"}return Q.toLocaleDateString(void 0,H)}function Aq(q,X){let Q=q instanceof Date?q:new Date(String(q));if(Number.isNaN(Q.getTime()))return String(q);let H={};switch(X){case"short":H.timeStyle="short";break;case"medium":H.timeStyle="medium";break;case"long":H.timeStyle="long";break;case"full":H.timeStyle="full";break;default:H.timeStyle="short"}return Q.toLocaleTimeString(void 0,H)}function Uq(q){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(q)}function L(q,X,Q=!0,H={}){let J=q.split("."),Y=X;for(let $ of J){if(Y===void 0||Y===null)break;Y=Y[$]}if(Y===void 0||Y===null)return Q?q:"";let W=String(Y);if(Uq(W))return _q(W,H);if(W.includes("|")&&"count"in H){let $=Number(H.count),Z=W.split("|");W=Yq(Z,$)}for(let[$,Z]of Object.entries(H)){let _=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");W=W.replace(new RegExp(`:${_}`,"g"),String(Z))}return W}var u=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),Mq=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function x(q){if(!q)return"ltr";let X=q.trim().toLowerCase().replace(/_/g,"-").split("-"),Q=X[0];if(!Q)return"ltr";let H=X[1]?.length===4?X[1]:void 0;if(H)return Mq.has(H)?"rtl":"ltr";if(X.length>1&&u.has(`${Q}-${X[1]}`))return"rtl";return u.has(Q)?"rtl":"ltr"}function nq(q){return x(q)==="rtl"}async function sq(q,X,Q,H){let J=q,Y=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,W={...y,...H.i18n},$=await Wq(W.locale,H);X.__translations=$,X.__locale=W.locale,X.__i18nConfig=W,J=await h(J,Y,async(z,G,w,K,j)=>{try{let D={};if(w)try{let B=[()=>JSON.parse(w),()=>{let U=`{"data":${w}}`,M=JSON.parse(U);return typeof M.data==="object"?M.data:{}},()=>{return S(w,X)}];for(let U of B)try{if(D=U(),Object.keys(D).length>0)break}catch{}}catch(B){if(H.debug)console.error("Error parsing parameters for @translate directive:",B)}return L(G,$,W.fallbackToKey,D)||K.trim()}catch(D){if(H.debug)console.error("Error processing @translate directive:",D);return T("Translate",`Error in @translate('${G}'): ${D instanceof Error?D.message:String(D)}`,R.EVALUATION_ERROR)}});let Z=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(H.debug){console.warn(`Processing translations in template. Sections: ${J.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let z=[...J.matchAll(Z)];console.warn(`Found ${z.length} @translate matches`),z.forEach((G,w)=>console.warn(`Match ${w}: ${G[0]}, Key: ${G[1]}, Params: ${G[2]||"none"}`))}return J=await h(J,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(z,G,w,K)=>{try{let j={};if(w)try{let D=[()=>JSON.parse(w),()=>{let A=`{"data":${w}}`,B=JSON.parse(A);return typeof B.data==="object"?B.data:{}},()=>{return S(w,X)}];for(let A of D)try{if(j=A(),Object.keys(j).length>0)break}catch{}}catch(D){if(H.debug)console.error("Error parsing parameters for @translate directive:",D)}return L(G,$,W.fallbackToKey,j)}catch(j){if(H.debug)console.error("Error processing @translate directive:",j);return T("Translate",`Error in @translate('${G}'): ${j instanceof Error?j.message:String(j)}`,R.EVALUATION_ERROR)}}),J}async function h(q,X,Q){let H=[];return q.replace(X,(Y,...W)=>{let $=Q(Y,...W).then((Z)=>({match:Y,replacement:Z}));return H.push($),Y}),(await Promise.all(H)).reduce((Y,{match:W,replacement:$})=>Y.replace(W,$),q)}function rq(q,X=!0){return(Q,H={})=>{return L(Q,q,X,H)}}import c from"path";function v(q,X){if(!q||x(q)!=="rtl")return!1;return!X||X.trim().toLowerCase()!=="rtl"}function n(q){if(!q)return!1;return q.trim().split(/\s+/)[0]?.toLowerCase()==="presentation"||q.trim().split(/\s+/)[0]?.toLowerCase()==="none"}function N(q,X){let Q=new RegExp(`\\b${X}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(q);if(!Q)return null;return Q[2]??Q[3]??Q[4]??null}function eq(q,X,Q,H){let J=q;J=J.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(W,$,Z)=>{let z={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[$]||"Make this element accessible";return`<!-- a11y-hint: ${Z||z} -->`});let Y=/@screenReader\(([^@]*)\)@endScreenReader/g;return J=J.replace(Y,(W,$)=>{return`<span class="sr-only">${$.trim()}</span>`}),J=J.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(W,$,Z)=>{return`<span id="${`desc-${$}`}" class="sr-only">${Z}</span>`}),J}function qH(){return`
|
|
4
4
|
.sr-only {
|
|
5
5
|
position: absolute;
|
|
@@ -13,4 +13,4 @@ import{is as i}from"./chunk-t00ga194.js";import{Cu as R,Su as T,kv as S}from"./c
|
|
|
13
13
|
border-width: 0;
|
|
14
14
|
}
|
|
15
15
|
`.trim()}function Oq(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function s(q){let X=new Map,Q=q.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,(J,Y,W)=>{let $=X.get(W);if(!$)$=`stx-a11y-component-${X.size}`,X.set(W,$);return`<${Y}${$}`}),H=new Map([...X.entries()].map(([J,Y])=>[Y,J]));return{protectedSource:Q,restore:(J)=>J.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(Y,W,$)=>{let Z=H.get($);return Z?`<${W}${Z}`:Y})}}function Nq(q,X){let Q=[],H=/<img\s+([^>]*)>/gi,J;J=H.exec(q);while(J!==null){let B=J[1];if(!/\balt\s*=/i.test(B))Q.push({type:"missing-alt",element:J[0].substring(0,100),message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"});J=H.exec(q)}let Y=/<button([^>]*)>\s*<\/button>/gi;J=Y.exec(q);while(J!==null){let B=J[1];if(!/\baria-label\s*=/i.test(B)&&!/\btitle\s*=/i.test(B))Q.push({type:"missing-accessible-name",element:J[0].substring(0,100),message:"Empty button missing accessible name",impact:"critical",help:"Add text content, aria-label, or title",helpUrl:"https://web.dev/learn/accessibility/aria-html/"});J=Y.exec(q)}let W=/<a\s+([^>]*)>\s*<\/a>/gi;J=W.exec(q);while(J!==null){let B=J[1];if(!/\baria-label\s*=/i.test(B)&&!/\btitle\s*=/i.test(B))Q.push({type:"link-missing-text",element:J[0].substring(0,100),message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"});J=W.exec(q)}let $=/<(input|select|textarea)\s+([^>]*)>/gi;J=$.exec(q);while(J!==null){let B=J[2];if(/\btype\s*=\s*["']hidden["']/i.test(B)){J=$.exec(q);continue}let U=/\baria-label\s*=/i.test(B)||/\baria-labelledby\s*=/i.test(B),M=B.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!U){let r=M&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${M[1]}["']`,"i").test(q),f=J.index,d=q.substring(0,f),Lq=q.substring(f),l=(d.match(/<label\b/gi)||[]).length,o=(d.match(/<\/label>/gi)||[]).length,a=l>o;if(!r&&!a)Q.push({type:"input-missing-label",element:J[0].substring(0,100),message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})}J=$.exec(q)}let Z=/<h([1-6])[^>]*>/gi,_=[];J=Z.exec(q);while(J!==null)_.push(Number.parseInt(J[1],10)),J=Z.exec(q);let z=0;for(let B of _){if(z>0&&B>z+1)Q.push({type:"heading-skip",element:`<h${B}>`,message:`Heading level skipped from h${z} to h${B}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});z=B}if(/<html\b/i.test(q)&&!/<html[^>]*\slang\s*=/i.test(q))Q.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});let G=q.match(/<html\b([^>]*)>/i);if(G&&v(N(G[1],"lang"),N(G[1],"dir")))Q.push({type:"missing-dir",element:G[0].substring(0,100),message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});let w=/<table([^>]*)>([\s\S]*?)<\/table>/gi;J=w.exec(q);while(J!==null){let B=J[2];if(!n(N(J[1],"role"))&&!/<th\b/i.test(B))Q.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});J=w.exec(q)}let K=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;J=K.exec(q);while(J!==null){if(!/\bmuted\b/i.test(J[0]))Q.push({type:"autoplay-audio",element:`<${J[1]}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"});J=K.exec(q)}let j=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;J=j.exec(q);while(J!==null)Q.push({type:"positive-tabindex",element:`tabindex="${J[1]}"`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"}),J=j.exec(q);let D=/<iframe\s+([^>]*)>/gi;J=D.exec(q);while(J!==null){let B=J[1];if(!/\btitle\s*=/i.test(B)&&!/\baria-label\s*=/i.test(B))Q.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"});J=D.exec(q)}let A=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;J=A.exec(q);while(J!==null){let B=J[1].toLowerCase(),U=J[2];if(B!=="button"&&!/\btabindex\s*=/i.test(U))Q.push({type:"button-not-focusable",element:J[0].substring(0,100),message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"});J=A.exec(q)}return Q}async function Pq(q,X){let{protectedSource:Q}=s(q);if(!Oq())return Nq(Q,X);let H=[];try{let J=globalThis.document.createElement("div");J.innerHTML=Q,J.querySelectorAll("img").forEach((Z)=>{if(!Z.hasAttribute("alt"))H.push({type:"missing-alt",element:`<${Z.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),J.querySelectorAll('button, a, [role="button"]').forEach((Z)=>{if(!(Z.hasAttribute("aria-label")||Z.hasAttribute("aria-labelledby")||Z.textContent&&Z.textContent.trim().length>0))H.push({type:"missing-accessible-name",element:`<${Z.outerHTML}>`,message:"Interactive element missing accessible name",impact:"critical",help:"Add text content, aria-label, or aria-labelledby",helpUrl:"https://web.dev/learn/accessibility/aria-html/"})}),J.querySelectorAll("input, select, textarea").forEach((Z)=>{let _=Z.getAttribute("id"),z=_&&J.querySelector(`label[for="${_}"]`),G=Z.hasAttribute("aria-label")||Z.hasAttribute("aria-labelledby"),w=Z.closest("label")!==null;if(!z&&!G&&!w)H.push({type:"input-missing-label",element:`<${Z.outerHTML}>`,message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})});let Y=Array.from(J.querySelectorAll("h1, h2, h3, h4, h5, h6")),W=0;for(let Z of Y){let _=Number.parseInt(Z.tagName.charAt(1));if(W>0&&_>W+1)H.push({type:"heading-skip",element:`<${Z.outerHTML}>`,message:`Heading level skipped from h${W} to h${_}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});W=_}let $=J.querySelector("html");if(Q.includes("<html")&&$&&!$.hasAttribute("lang"))H.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});if($&&v($.getAttribute("lang"),$.getAttribute("dir")))H.push({type:"missing-dir",element:"<html>",message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});if(J.querySelectorAll("a").forEach((Z)=>{let _=Z.textContent&&Z.textContent.trim().length>0,z=Z.hasAttribute("aria-label")||Z.hasAttribute("aria-labelledby"),G=Z.hasAttribute("title"),w=Z.querySelector("img[alt]");if(!_&&!z&&!G&&!w)H.push({type:"link-missing-text",element:`<${Z.outerHTML}>`,message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"})}),Q.includes("<nav")||Q.includes("<header")){if(!J.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&J.querySelectorAll("a").length>5)H.push({type:"missing-skip-link",element:"<nav>",message:"Consider adding a skip navigation link",impact:"minor",help:"Add a skip link to allow keyboard users to bypass navigation",helpUrl:"https://web.dev/learn/accessibility/focus/#skip-links"})}if(J.querySelectorAll("table").forEach((Z)=>{if(n(Z.getAttribute("role")))return;let _=Z.querySelector("caption");if(!Z.querySelector("th"))H.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});if(!_&&!Z.hasAttribute("aria-label")&&!Z.hasAttribute("aria-labelledby"))H.push({type:"table-missing-caption",element:"<table>",message:"Table missing caption or accessible name",impact:"minor",help:"Add a caption element or aria-label to describe the table",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"})}),J.querySelectorAll('[style*="color"]').forEach((Z)=>{let _=Z.getAttribute("style")||"";if(_.includes("color:")&&!_.includes("background"))H.push({type:"potential-contrast-issue",element:`<${Z.tagName.toLowerCase()}>`,message:"Element has inline color style - verify contrast ratio",impact:"minor",help:"Ensure text has sufficient contrast ratio (4.5:1 for normal text)",helpUrl:"https://web.dev/learn/accessibility/color-contrast/"})}),J.querySelectorAll("video[autoplay], audio[autoplay]").forEach((Z)=>{if(!Z.hasAttribute("muted"))H.push({type:"autoplay-audio",element:`<${Z.tagName.toLowerCase()}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"})}),J.querySelectorAll("[tabindex]").forEach((Z)=>{if(Number.parseInt(Z.getAttribute("tabindex")||"0")>0)H.push({type:"positive-tabindex",element:`<${Z.tagName.toLowerCase()}>`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"})}),J.querySelectorAll('[role="button"]').forEach((Z)=>{if(!Z.hasAttribute("tabindex"))H.push({type:"button-not-focusable",element:`<${Z.outerHTML}>`,message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"})}),Q.includes("<body")&&!J.querySelector('main, [role="main"]'))H.push({type:"missing-main-landmark",element:"<body>",message:"Document missing main landmark region",impact:"moderate",help:"Add a main element to identify the primary content",helpUrl:"https://web.dev/learn/accessibility/structure/#landmarks"});J.querySelectorAll("iframe").forEach((Z)=>{if(!Z.hasAttribute("title")&&!Z.hasAttribute("aria-label"))H.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"})})}catch(J){console.error(`Error checking accessibility in ${X}:`,J)}return H}async function Iq(q,X={}){let Q={},{recursive:H=!0,ignorePaths:J=[]}=X,Y=Array.isArray(q)?q:[q],W=await i(Y,{recursive:H,ignorePaths:J}),$=[];for(let Z of W)try{let _=await Bun.file(Z).text();if(Z.endsWith("good-a11y.stx"))continue;let z=await Pq(_,Z);if($.push(Z),z.length>0)Q[Z]=z}catch(_){console.error(`Error scanning ${Z}:`,_)}return{results:Q,scannedFiles:$}}async function HH(q,X={}){return(await Iq(q,X)).results}var Rq={fixMissingAlt:!0,fixMissingLabels:!0,fixMissingFormLabels:!0,fixTableHeaders:!0,fixMissingLang:!0,fixMissingDir:!0,fixPositiveTabindex:!0,fixButtonFocusable:!0,defaultLang:"en"};function Tq(q,X={}){let Q={...Rq,...X},H=[],{protectedSource:J,restore:Y}=s(q),W=J;if(Q.fixMissingAlt)W=W.replace(/<img([^>]*?)(?<!\balt\s*=\s*["'][^"']*["'])(\s*\/?>)/gi,($,Z,_)=>{if(/\balt\s*=/i.test(Z))return $;let z=$,G=`<img${Z} alt=""${_}`;return H.push({type:"missing-alt",description:"Added empty alt attribute to image",before:z,after:G}),G});if(Q.fixMissingLabels)W=W.replace(/<button([^>]*)>\s*<\/button>/gi,($,Z)=>{if(/\baria-label\s*=/i.test(Z)||/\btitle\s*=/i.test(Z))return $;let _=$,z=`<button${Z} aria-label="Button"></button>`;return H.push({type:"missing-accessible-name",description:"Added aria-label to empty button",before:_,after:z}),z}),W=W.replace(/<a([^>]*)>\s*(<(?:i|span|svg)[^>]*(?:class="[^"]*icon[^"]*")?[^>]*>.*?<\/(?:i|span|svg)>)?\s*<\/a>/gi,($,Z,_)=>{if(/\baria-label\s*=/i.test(Z)||/\btitle\s*=/i.test(Z))return $;if(!_&&$.replace(/<a[^>]*>|<\/a>/gi,"").trim())return $;let z=$,G=`<a${Z} aria-label="Link">${_||""}</a>`;return H.push({type:"missing-accessible-name",description:"Added aria-label to link without text",before:z,after:G}),G});if(Q.fixMissingFormLabels)W=W.replace(/<(input|select|textarea)([^>]*)>/gi,($,Z,_)=>{if(/\baria-label\s*=/i.test(_)||/\baria-labelledby\s*=/i.test(_))return $;if(/\btype\s*=\s*["']hidden["']/i.test(_))return $;let z=_.match(/\bname\s*=\s*["']([^"']+)["']/i),G=_.match(/\bid\s*=\s*["']([^"']+)["']/i),w=z?.[1]||G?.[1]||Z,K=$,j=`<${Z}${_} aria-label="${w}">`;return H.push({type:"input-missing-label",description:`Added aria-label to ${Z} element`,before:K,after:j}),j});if(Q.fixMissingLang)W=W.replace(/<html([^>]*)>/gi,($,Z)=>{if(/\blang\s*=/i.test(Z))return $;let _=$,z=`<html${Z} lang="${Q.defaultLang}">`;return H.push({type:"missing-lang",description:`Added lang="${Q.defaultLang}" to html element`,before:_,after:z}),z});if(Q.fixMissingDir)W=W.replace(/<html([^>]*)>/gi,($,Z)=>{let _=N(Z,"lang");if(!v(_,N(Z,"dir")))return $;let z=/\bdir\s*=/i.test(Z)?`<html${Z.replace(/\bdir\s*=\s*(["'])[^"']*\1/i,'dir="rtl"')}>`:`<html${Z} dir="rtl">`;return H.push({type:"missing-dir",description:`Added dir="rtl" to html element (lang="${_}" is right-to-left)`,before:$,after:z}),z});if(Q.fixPositiveTabindex)W=W.replace(/\btabindex\s*=\s*["']([1-9]\d*)["']/gi,($,Z)=>{let _=$,z='tabindex="0"';return H.push({type:"positive-tabindex",description:`Changed tabindex="${Z}" to tabindex="0"`,before:_,after:'tabindex="0"'}),'tabindex="0"'});if(Q.fixButtonFocusable)W=W.replace(/<([a-z]+)(\s[^>]*role\s*=\s*["']button["'][^>]*)>/gi,($,Z,_)=>{if(/\btabindex\s*=/i.test(_))return $;if(Z.toLowerCase()==="button")return $;let z=$,G=`<${Z}${_} tabindex="0">`;return H.push({type:"button-not-focusable",description:'Added tabindex="0" to element with role="button"',before:z,after:G}),G});if(Q.fixTableHeaders)W=W.replace(/<th([^>]*)>/gi,($,Z)=>{if(/\bscope\s*=/i.test(Z))return $;let _=$,z=`<th${Z} scope="col">`;return H.push({type:"table-missing-scope",description:'Added scope="col" to table header',before:_,after:z}),z});return{original:q,fixed:Y(W),fixCount:H.length,fixes:H}}async function Sq(q,X={},Q=!1){let H=await Bun.file(q).text(),J=Tq(H,X);if(Q&&J.fixCount>0)await Bun.write(q,J.fixed);return J}async function JH(q,X={},Q={}){let H={},{recursive:J=!0,ignorePaths:Y=[],writeBack:W=!1,extensions:$=[".stx",".html",".htm"]}=Q,Z=$.length===1?`*${$[0]}`:`*{${$.join(",")}}`,_=c.join(q,J?`**/${Z}`:Z),z=new Bun.Glob(_);for await(let G of z.scan()){if(Y.some((K)=>G.includes(c.normalize(K))))continue;try{let K=await Sq(G,X,W);if(K.fixCount>0)H[G]=K}catch(K){console.error(`Error fixing ${G}:`,K)}}return H}var kq={name:"a11y",handler:(q,X,Q,H)=>{if(!X.length)return q;let J=X[0].replace(/['"]/g,""),Y=X.length>1?X[1].replace(/['"]/g,""):"",$={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[J]||"Make this element accessible";return`<!-- a11y-hint: ${Y||$} -->${q}`},hasEndTag:!1},bq={name:"screenReader",handler:(q)=>{return`<span class="sr-only">${q}</span>`},hasEndTag:!0};function QH(){return[kq,bq]}
|
|
16
|
-
export{y as
|
|
16
|
+
export{y as zr,vq as Ar,fq as Br,dq as Cr,gq as Dr,uq as Er,qq as Fr,hq as Gr,P as Hr,Hq as Ir,pq as Jr,mq as Kr,cq as Lr,iq as Mr,Wq as Nr,_q as Or,Uq as Pr,L as Qr,x as Rr,nq as Sr,sq as Tr,rq as Ur,n as Vr,N as Wr,eq as Xr,qH as Yr,Oq as Zr,Nq as _r,Pq as $r,Iq as as,HH as bs,Tq as cs,Sq as ds,JH as es,kq as fs,bq as gs,QH as hs};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-ejqpq0wc.js";var Y=null,S=[],F=new WeakMap;function I(z){let K=z,B=new Set,G={get value(){if(Y){let H=F.get(G);if(!H)H=new Set,F.set(G,H);H.add(Y)}return K},set value(H){if(!Object.is(K,H)){K=H,B.forEach((J)=>J(H));let L=F.get(G);if(L)L.forEach((J)=>J())}},subscribe(H){return B.add(H),()=>B.delete(H)},peek(){return K}};return G}function W(z){return z!==null&&typeof z==="object"&&"value"in z&&"subscribe"in z&&"peek"in z}function P(z){return W(z)?z.value:z}function j(z){let K={};for(let B in z)if(Object.prototype.hasOwnProperty.call(z,B))K[B]=I(z[B]);return K}function D(z){return I(z)}function U(z){let K=typeof z==="function",B=K?z:z.get,G=K?void 0:z.set,H=K?Object.is:z.equals||Object.is,L,J=!0,Q=new Set,X=new Set,_=()=>{if(J=!0,X.size>0){let N=T.value;X.forEach(($)=>$(N))}};function Z(){Q.clear();let N=Y;Y=_,S.push(_);try{return B()}finally{S.pop(),Y=N}}let T={get value(){if(Y){let N=F.get(T);if(!N)N=new Set,F.set(T,N);N.add(Y)}if(J){let N=Z();if(!H(L,N))L=N;J=!1}return L},set value(N){if(G)G(N);else console.warn("Computed property is readonly")},subscribe(N){return X.add(N),()=>X.delete(N)},peek(){if(J)L=B(),J=!1;return L},invalidate(){J=!0},get dirty(){return J},get deps(){return Q}};return T}function x(z,K,B={}){let{immediate:G=!1,deep:H=!1,flush:L="pre",once:J=!1}=B,Q,X=!0,_=!1,Z=()=>{if(W(z))return H?q(z.value):z.value;return z()},T=()=>{if(!X||_)return;let M=Z();if(Q!==void 0&&Object.is(Q,M)&&!H)return;let A=()=>{if(K(M,Q),Q=H?q(M):M,J)$()};if(L==="sync")A();else if(L==="post")queueMicrotask(A);else Promise.resolve().then(A)},N=null;if(W(z))N=z.subscribe(()=>T());else N=U(z).subscribe(()=>T());if(G)Q=void 0,T();else Q=Z();let $=()=>{if(X=!1,N)N(),N=null};return $.pause=()=>{_=!0},$.resume=()=>{_=!1},$}function E(z,K,B={}){let{immediate:G=!1,once:H=!1}=B,L=z.map((T)=>W(T)?T.value:void 0),J=!0,Q=!1,X=()=>{if(!J||Q)return;let T=z.map((N)=>W(N)?N.value:void 0);if(K(T,L),L=[...T],H)Z()},_=z.map((T)=>{if(W(T))return T.subscribe(()=>X());return()=>{}});if(G)X();let Z=()=>{J=!1,_.forEach((T)=>T())};return Z.pause=()=>{Q=!0},Z.resume=()=>{Q=!1},Z}function y(z,K={}){let{flush:B="pre"}=K,G,H=!0,L=!1,J=()=>{if(!H||L)return;if(G)G();let X=Y;Y=J,S.push(J);try{G=z()}finally{S.pop(),Y=X}};if(B==="sync")J();else if(B==="post")queueMicrotask(J);else Promise.resolve().then(J);let Q=()=>{if(H=!1,G)G()};return Q.pause=()=>{L=!0},Q.resume=()=>{L=!1},Q}function C(z,K={},B){let G=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return z.replace(G,(H,L,J)=>{try{let X=Function(...Object.keys(K),`return ${J}`)(...Object.values(K));return K[L]=X,`<!-- computed: ${L} = ${X} -->`}catch(Q){return`<!-- computed error: ${L} - ${Q} -->`}})}function R(z,K={},B){let G=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return z.replace(G,(H,L,J)=>{return`
|
|
3
3
|
<script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
|
|
4
4
|
(function() {
|
|
5
5
|
// Watch implementation for ${L}
|