@stacksjs/stx 0.2.582 → 0.2.583
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-ayy9mmrw.js → chunk-02qaqamv.js} +6 -6
- package/dist/{chunk-6w2yqtrd.js → chunk-07anexcg.js} +1 -1
- package/dist/{chunk-dvgvvy5b.js → chunk-09zwhsf9.js} +1 -1
- package/dist/{chunk-cb2pyg5t.js → chunk-0dfgefjv.js} +2 -2
- package/dist/chunk-0fx3ppnt.js +2 -0
- package/dist/chunk-0sfexf9t.js +2 -0
- package/dist/chunk-2927nax9.js +2 -0
- package/dist/{chunk-eww6sdzz.js → chunk-2943qhdt.js} +1 -1
- package/dist/{chunk-9jh2ake5.js → chunk-2nehykbm.js} +5 -5
- package/dist/chunk-2rj0ttas.js +2 -0
- package/dist/chunk-3ae39ttg.js +2 -0
- package/dist/{chunk-q2a58n2a.js → chunk-440yjsk5.js} +1 -1
- package/dist/{chunk-kp0hg06s.js → chunk-4pkpr5cg.js} +2 -2
- package/dist/{chunk-g4crr86j.js → chunk-4pmgr32a.js} +3 -3
- package/dist/chunk-521pe0hb.js +18 -0
- package/dist/chunk-58z26y07.js +2 -0
- package/dist/chunk-5r9k9s3m.js +2 -0
- package/dist/{chunk-vx75fb0d.js → chunk-6fc8vw2v.js} +2 -2
- package/dist/{chunk-43h8q2cm.js → chunk-6m3me7yj.js} +6 -6
- package/dist/chunk-76vza4ve.js +2 -0
- package/dist/{chunk-c1r7zq0q.js → chunk-8tq83fq7.js} +71 -71
- package/dist/chunk-8y8bbsh5.js +2 -0
- package/dist/{chunk-620szfcp.js → chunk-96mb3brj.js} +2 -2
- package/dist/chunk-9kzycb15.js +2 -0
- package/dist/{chunk-djft0m5h.js → chunk-ac6v3s3k.js} +1 -1
- package/dist/chunk-agfhb2qd.js +2 -0
- package/dist/chunk-ay6dzpt4.js +2 -0
- package/dist/{chunk-dtcc09x1.js → chunk-b9njk81d.js} +1 -1
- package/dist/chunk-bfbcmfww.js +2 -0
- package/dist/chunk-br01jvra.js +2 -0
- package/dist/{chunk-v8p5p2kp.js → chunk-c12y2bet.js} +1 -1
- package/dist/chunk-c2nwchk0.js +2 -0
- package/dist/{chunk-3qrrv6af.js → chunk-cby4mkjf.js} +1 -1
- package/dist/{chunk-qazn64pm.js → chunk-ck1yca7g.js} +1 -1
- package/dist/chunk-cxqrwvc5.js +2 -0
- package/dist/chunk-czea8zr1.js +2 -0
- package/dist/chunk-d99kfx3k.js +2 -0
- package/dist/{chunk-7hkc96de.js → chunk-dhq80e4r.js} +4 -4
- package/dist/{chunk-cdgwkzms.js → chunk-dm1qh2vq.js} +1 -1
- package/dist/{chunk-5pgbsc3a.js → chunk-dskrwa8f.js} +1 -1
- package/dist/{chunk-zk2xk0wd.js → chunk-dvc15djp.js} +2 -2
- package/dist/chunk-e6ycqvdm.js +2 -0
- package/dist/{chunk-8v19753h.js → chunk-e809x7m0.js} +1 -1
- package/dist/{chunk-ta3wn842.js → chunk-en7xxgtb.js} +2 -2
- package/dist/chunk-fvx6pd66.js +2 -0
- package/dist/{chunk-xpnpg967.js → chunk-g9zeybqh.js} +2 -2
- package/dist/{chunk-zz02hwec.js → chunk-h3z9b6bw.js} +22 -22
- package/dist/{chunk-yk3fbzx5.js → chunk-hp9nxva6.js} +3 -3
- package/dist/chunk-hrbjapvr.js +2 -0
- package/dist/{chunk-pmpb34md.js → chunk-hzqyfdpy.js} +5 -5
- package/dist/chunk-jc4mxq56.js +2 -0
- package/dist/chunk-jdpyxt8j.js +2 -0
- package/dist/{chunk-4rkvwm6v.js → chunk-je1as16r.js} +9 -9
- package/dist/chunk-k0zev8wc.js +2 -0
- package/dist/{chunk-nrfh7gaa.js → chunk-kfwmqacd.js} +1 -1
- package/dist/{chunk-t61vdbje.js → chunk-ktvr45qg.js} +6 -6
- package/dist/{chunk-y8q1n7hx.js → chunk-ky1426s1.js} +6 -6
- package/dist/{chunk-rr8a7d4q.js → chunk-m417sp42.js} +3 -3
- package/dist/{chunk-101ekf6y.js → chunk-mjj24qpb.js} +2 -2
- package/dist/{chunk-ev5f79mg.js → chunk-mt9x626h.js} +3 -3
- package/dist/{chunk-faghmmrs.js → chunk-n4e02qdz.js} +85 -85
- package/dist/{chunk-yy3ser06.js → chunk-nh3svtvj.js} +3 -3
- package/dist/{chunk-yfq2v7x5.js → chunk-nhd9m8h5.js} +6 -6
- package/dist/chunk-nx8rf4qd.js +2 -0
- package/dist/{chunk-t8wpzqs4.js → chunk-pbwk8tzz.js} +1 -1
- package/dist/chunk-pe5bk9ns.js +2 -0
- package/dist/chunk-qb2j34sp.js +2 -0
- package/dist/chunk-qknfceta.js +2 -0
- package/dist/{chunk-0vnngvy1.js → chunk-qn8gdw21.js} +4 -4
- package/dist/chunk-sf98zgw2.js +2 -0
- package/dist/chunk-sgsp4dph.js +2 -0
- package/dist/{chunk-jtbzmbzz.js → chunk-sv08pd66.js} +2 -2
- package/dist/{chunk-30rf7k4n.js → chunk-tfxmzat6.js} +24 -24
- package/dist/chunk-tms7amrb.js +2 -0
- package/dist/chunk-v0zgarvv.js +2 -0
- package/dist/chunk-vczw73ga.js +2 -0
- package/dist/{chunk-be2ba3hj.js → chunk-vkc51n9m.js} +2 -2
- package/dist/{chunk-1v1mew46.js → chunk-vke73gts.js} +1 -1
- package/dist/{chunk-c0s3k64c.js → chunk-w6wtxj54.js} +2 -2
- package/dist/chunk-webrqm20.js +2 -0
- package/dist/chunk-wngqr949.js +2 -0
- package/dist/{chunk-71sdgv7e.js → chunk-wyn5rfzk.js} +105 -35
- package/dist/{chunk-yhpyqsbr.js → chunk-x552npae.js} +2 -2
- package/dist/{chunk-3wy8q3aq.js → chunk-xp7fxc6p.js} +5 -5
- package/dist/{chunk-t4g2fptt.js → chunk-xytkfa48.js} +4 -4
- package/dist/chunk-xyzy84x0.js +2 -0
- package/dist/chunk-y1jffvkj.js +2 -0
- package/dist/{chunk-74j18qk0.js → chunk-y8h823cb.js} +28 -28
- package/dist/chunk-yas134jv.js +2 -0
- package/dist/{chunk-tszkg6sj.js → chunk-ycj0342k.js} +1 -1
- package/dist/{chunk-mxe21m6q.js → chunk-yd55vynh.js} +1 -1
- package/dist/{chunk-hzfhn2vr.js → chunk-ye66wc53.js} +2 -2
- package/dist/{chunk-k9th7hc4.js → chunk-ym1sb5bg.js} +2 -2
- package/dist/chunk-yn2d8x8m.js +3 -0
- package/dist/chunk-ze86h6vp.js +2 -0
- package/dist/cli.js +44 -44
- package/dist/client/signals-authoring-runtime.js +13 -6
- package/dist/client/signals-binding-utils-runtime.js +14 -1
- package/dist/client/signals-component-api-runtime.js +3 -1
- package/dist/client/signals-event-shorthand-runtime.js +1 -1
- package/dist/client/signals-expression-runtime.js +1 -1
- package/dist/client/signals-host-runtime.js +20 -0
- package/dist/client/signals-manifest-hydration-runtime.js +7 -0
- package/dist/client/signals-model-runtime.js +2 -0
- package/dist/client/signals-mount-runtime.js +5 -1
- package/dist/client/signals-process-element-runtime.js +22 -7
- package/dist/component-model.d.ts +1 -1
- package/dist/component-model.js +6 -3
- package/dist/composition-api.js +3 -2
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/native/compiler/bundle.js +8 -3
- package/dist/native/compiler/html-to-ir.d.ts +3 -1
- package/dist/native/compiler/html-to-ir.js +28 -1
- package/dist/native/runtime/binding-tree.js +12 -0
- package/dist/native/runtime/craft-bridge.js +2 -1
- package/dist/native/runtime/jsc-globals.d.ts +10 -3
- package/dist/native/runtime/jsc-globals.js +23 -4
- package/dist/native/runtime/native-host.d.ts +4 -0
- package/dist/native/runtime/native-host.js +273 -21
- package/dist/native/runtime/shared-screen.js +1 -0
- package/dist/native/testing.js +1 -1
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +7 -7
- package/package.json +5 -5
- package/dist/chunk-0047meje.js +0 -2
- package/dist/chunk-1cat8kdj.js +0 -2
- package/dist/chunk-1dwnp35v.js +0 -2
- package/dist/chunk-2dnr5qfk.js +0 -2
- package/dist/chunk-2v73cjbc.js +0 -2
- package/dist/chunk-3akgppsy.js +0 -2
- package/dist/chunk-4t67wmcg.js +0 -2
- package/dist/chunk-51zn42jy.js +0 -2
- package/dist/chunk-5702x95v.js +0 -2
- package/dist/chunk-60c2bsh9.js +0 -2
- package/dist/chunk-79v4d9qh.js +0 -2
- package/dist/chunk-7pp2vx1g.js +0 -2
- package/dist/chunk-8zm6tkqb.js +0 -2
- package/dist/chunk-a1z36dt5.js +0 -2
- package/dist/chunk-atsf1fe0.js +0 -2
- package/dist/chunk-b8qd6h1q.js +0 -2
- package/dist/chunk-ccxs40xy.js +0 -2
- package/dist/chunk-cg8hg6cs.js +0 -3
- package/dist/chunk-cp442y7a.js +0 -2
- package/dist/chunk-d4en5d3s.js +0 -2
- package/dist/chunk-dh80d57p.js +0 -2
- package/dist/chunk-dyqte1xq.js +0 -2
- package/dist/chunk-e4n4v022.js +0 -2
- package/dist/chunk-g2fw68zm.js +0 -2
- package/dist/chunk-hcgm37dy.js +0 -2
- package/dist/chunk-hd2bn5q7.js +0 -2
- package/dist/chunk-j1nqnmcd.js +0 -18
- package/dist/chunk-k7jqkt93.js +0 -2
- package/dist/chunk-mqy7g74k.js +0 -2
- package/dist/chunk-ne03tfje.js +0 -2
- package/dist/chunk-p2sns0bn.js +0 -2
- package/dist/chunk-s1sycp43.js +0 -2
- package/dist/chunk-sp46w7z9.js +0 -2
- package/dist/chunk-sy1bk1ry.js +0 -2
- package/dist/chunk-tpd5nwa3.js +0 -2
- package/dist/chunk-tpt4bgs5.js +0 -2
- package/dist/chunk-vq0cb1m9.js +0 -2
- package/dist/chunk-y1bppxgw.js +0 -2
- package/dist/chunk-yv5rwthv.js +0 -2
- package/dist/chunk-z1r4tdqy.js +0 -2
- package/dist/chunk-zv288w4e.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{kt,es,ts,ns,Bu,rs}from"./chunk-nh3svtvj.js";import"./chunk-sv08pd66.js";import"./chunk-vkc51n9m.js";import"./chunk-x552npae.js";export{ts as buildServerApi,Bu as createServerApi,kt as discoverServerApi,es as generateApiTypes,rs as isServerApiSource,ns as productionApiDispatcher};
|
|
@@ -4,5 +4,5 @@ var Jr=new Map([["craft-button",{name:"Button",zigType:"craft.Button",props:[{na
|
|
|
4
4
|
`)}function v(e,t){let r=" ".repeat(t),n=[];for(let[a,l]of Object.entries(e.props))if(l.type==="literal"){let p=typeof l.value==="string"?`"${l.value}"`:String(l.value);n.push(`${a}: ${p}`)}let i=n.length>0?`{ ${n.join(", ")} }`:"{}",o=e.children.map((a)=>a.type==="text"?`"${a.props.text?.type==="literal"?a.props.text.value:""}"`:v(a,t+1)),s=o.length>0?`,
|
|
5
5
|
${r} [${o.join(`,
|
|
6
6
|
${r} `)}]`:"";return`Craft.create("${e.zigType}", ${i}${s})`}function H(e,t,r){if(t.target==="universal"){let n=[];n.push("// Universal entry point"),n.push("");for(let[i,o]of r)n.push(`// --- ${i.toUpperCase()} ---`),n.push(`#if ${i.toUpperCase()}`),n.push(o),n.push("#endif"),n.push("");return n.join(`
|
|
7
|
-
`)}return r.get(t.target)||u(e,t)}function _(e,t,r){let n=[];function i(o){n.push({name:o.zigType,hash:x(JSON.stringify(o.props)),props:Object.keys(o.props),events:Array.from(o.events.keys()),slots:[],isNative:o.zigType.startsWith("craft.")});for(let s of o.children)i(s)}return i(t),{version:"1.0.0",components:n,entry:e.id,assets:[],styles:e.styles}}function B(e,t){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}var F=0;function T(){return`id_${++F}`}function x(e){let t=0;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return Math.abs(t).toString(36)}function J(e){return e.charAt(0).toUpperCase()+e.slice(1)}function U(e){let t=[],r=/<script[^>]*>([\s\S]*?)<\/script>/gi,n;while((n=r.exec(e))!==null)t.push(n[1]);return t}function Z(e){let t=[],r=/<style[^>]*>([\s\S]*?)<\/style>/gi,n;while((n=r.exec(e))!==null)t.push(n[1]);return t}function f(e){let t=e.type==="component"?1:0;if(e.children)for(let r of e.children)t+=f(r);return t}function d(e){let t=e.zigType.startsWith("craft.")?1:0;for(let r of e.children)t+=d(r);return t}function Fo(e){return{start:async()=>{console.log("[craft-compiler] Hot reload server started")},stop:async()=>{console.log("[craft-compiler] Hot reload server stopped")},notifyChange:(t)=>{console.log(`[craft-compiler] File changed: ${t}`)}}}var K={compileToNative:Bo,createHotReloadServer:Fo,NATIVE_COMPONENTS:Jr},
|
|
8
|
-
export{Jr,Bo,Fo,
|
|
7
|
+
`)}return r.get(t.target)||u(e,t)}function _(e,t,r){let n=[];function i(o){n.push({name:o.zigType,hash:x(JSON.stringify(o.props)),props:Object.keys(o.props),events:Array.from(o.events.keys()),slots:[],isNative:o.zigType.startsWith("craft.")});for(let s of o.children)i(s)}return i(t),{version:"1.0.0",components:n,entry:e.id,assets:[],styles:e.styles}}function B(e,t){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}var F=0;function T(){return`id_${++F}`}function x(e){let t=0;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return Math.abs(t).toString(36)}function J(e){return e.charAt(0).toUpperCase()+e.slice(1)}function U(e){let t=[],r=/<script[^>]*>([\s\S]*?)<\/script>/gi,n;while((n=r.exec(e))!==null)t.push(n[1]);return t}function Z(e){let t=[],r=/<style[^>]*>([\s\S]*?)<\/style>/gi,n;while((n=r.exec(e))!==null)t.push(n[1]);return t}function f(e){let t=e.type==="component"?1:0;if(e.children)for(let r of e.children)t+=f(r);return t}function d(e){let t=e.zigType.startsWith("craft.")?1:0;for(let r of e.children)t+=d(r);return t}function Fo(e){return{start:async()=>{console.log("[craft-compiler] Hot reload server started")},stop:async()=>{console.log("[craft-compiler] Hot reload server stopped")},notifyChange:(t)=>{console.log(`[craft-compiler] File changed: ${t}`)}}}var K={compileToNative:Bo,createHotReloadServer:Fo,NATIVE_COMPONENTS:Jr},Lu=K;
|
|
8
|
+
export{Jr,Bo,Fo,Lu};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{N,
|
|
2
|
+
import{N,de}from"./chunk-n4e02qdz.js";import{fe,C,Ye}from"./chunk-vkc51n9m.js";import{nt,Z,Ee}from"./chunk-x552npae.js";import{Oe,se,T,oe,So,Dr,ko,Bt}from"./chunk-je1as16r.js";import{ns}from"./chunk-nh3svtvj.js";import{Ft}from"./chunk-g9zeybqh.js";import K from"fs";import A from"path";var{serve:le}=globalThis.Bun;import F from"zlib";import{promisify as Q}from"util";var ee=Q(F.brotliCompress),te=Q(F.gzip),ne=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],re=["text/event-stream","multipart/x-mixed-replace"],ae=1024;function ie(t){if(!t)return!1;let e=t.toLowerCase();if(re.some((o)=>e.startsWith(o)))return!1;return ne.some((o)=>e.startsWith(o))}function ce(t){let e=new Map;for(let o of t.split(",")){let[r,...a]=o.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of a){let l=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(g);if(!l)continue;let m=Number.parseFloat(l[1]);if(Number.isFinite(m))h=m}e.set(f,h)}return e}function pe(t){if(!t)return null;let e=ce(t),o=e.get("*"),r=(a)=>e.get(a)??o??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var Y=33554432,H=new Map,U=0;function ue(t,e){if(e.length>Y/8)return;H.set(t,e),U+=e.length;for(let[o,r]of H){if(U<=Y)break;H.delete(o),U-=r.length}}async function Lt(t,e,o={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!ie(e.headers.get("content-type")))return e;let r=pe(t.headers.get("accept-encoding"));if(!r)return e;let a;try{a=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(a,{status:e.status,statusText:e.statusText,headers:J(e.headers)});if(a.length<(o.threshold??ae))return f();try{let h=o.quality??5,g=`${r}:${h}:${a.length}:${Bun.hash(a)}`,l=H.get(g);if(!l)l=r==="br"?await ee(a,{params:{[F.constants.BROTLI_PARAM_QUALITY]:h,[F.constants.BROTLI_PARAM_SIZE_HINT]:a.length}}):await te(a),ue(g,l);if(l.length>=a.length)return f();let m=J(e.headers);return m.set("Content-Encoding",r),m.set("Content-Length",String(l.length)),new Response(l,{status:e.status,statusText:e.statusText,headers:m})}catch{return f()}}function J(t){let e=new Headers(t),o=e.get("Vary");if(!o)return e.set("Vary","Accept-Encoding"),e;if(!o.split(",").some((a)=>a.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${o}, Accept-Encoding`);return e}class G{now;entries=new N(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,o){let r,a=async()=>{let s=r??await o();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",T(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return a();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${se(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let S=new Headers(s.headers);return S.set("Cache-Control","private, no-store"),S.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:S})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let b=this.generation,k=async()=>{let s=await o();r=s;let S=(s.headers.get("Vary")??"").toLowerCase().split(",").map((y)=>y.trim()).filter(Boolean);if(s.status!==200||s.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(s.headers.get("Cache-Control")??"")||S.some((y)=>y!=="x-stx-router"&&y!=="accept-encoding"))return null;let B=await s.clone().arrayBuffer();if(B.byteLength>1048576)return null;s.headers.set("Vary",T(s.headers.get("Vary")).Vary);let n={body:B,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===b)this.entries.set(h,n);return n},v=this.pending.get(h);if(!v){if(this.pending.size>=1000)return a();v=k().finally(()=>{if(this.pending.get(h)===v)this.pending.delete(h)}),this.pending.set(h,v)}if(g&&m<e.maxAge+(e.swr??0))return v.catch(()=>{}),l(g);let E=await v;return E?l(E):a()}}var me={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function ll(t={}){let e=A.resolve(t.outputDir||".output"),o=t.port??3000,r=So(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let a=Ft(r.routeRules),f=new G,h=ns(e,r.apiRoutes??[]),g=Bun.file(A.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?C(l):void 0,b=new Map,k=new Map,v=new Map,E=new Map;for(let n of r.routes)try{let y=A.join(e,n.compiledPath),i=JSON.parse(await Bun.file(y).text());if(m)i.html=Ye(i.html,m);b.set(n.pattern,i),v.set(n.pattern,Ee(i.html)),E.set(n.pattern,de(i.html));let X=A.join(e,n.fragmentPath);if(await Bun.file(X).exists()){let M=await Bun.file(X).text();k.set(n.pattern,m?Ye(M,m):M)}}catch(y){console.warn(`[stx] Failed to load route ${n.pattern}:`,y)}let s=new Map,S=[];for(let n of r.routes)if(n.hasParams){let{regex:y,params:i}=Z(n.pattern,{page:!0});S.push({regex:y,route:n,paramNames:i})}else s.set(n.pattern,n);let B=le({port:o,async fetch(n){return Lt(n,await fe(m??C(),async()=>{let i=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[i])return t.apiRoutes[i](n);let X=await h(n);if(X)return X;if((n.method==="GET"||n.method==="HEAD")&&i!=="/"){let p=A.resolve(e,"public"),d;try{d=decodeURIComponent(i)}catch{d=i}if(!d.includes("\x00")){let u=A.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${A.sep}`))try{if(K.existsSync(u)&&K.statSync(u).isFile()){let R=A.extname(u).toLowerCase(),L=me[R]||"application/octet-stream",_=i.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(i);return new Response(Bun.file(u),{headers:{"Content-Type":L,"Cache-Control":_?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let M=se(n),w=null,q={};if(w=s.get(i)||null,!w)for(let{regex:p,route:d,paramNames:u}of S){let c=i.match(p);if(c){w=d,u.forEach((R,L)=>{q[R]=c[L+1]});break}}if(!w){let p=nt(i)?null:s.get("/404")||null;if(p){let d=b.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let O=a(i),W=Object.keys(O).length>0;return f.respond(n,O.cache,async()=>{let p=b.get(w.pattern);if(M&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let c=k.get(w.pattern);if(c){let R=v.get(w.pattern);return new Response(c,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...E.has(w.pattern)?{"X-STX-Runtime":E.get(w.pattern)?"true":"false"}:{},...R?{"X-STX-Layout":R.layout,"X-STX-Layout-Group":R.group}:{},...T(),...O.cache?{}:{"Cache-Control":Oe}}})}}let d=Dr(n.method),u=b.get(w.pattern);if(!u){let c=s.get("/500")||null;if(c){let R=b.get(c.pattern);if(R)return new Response(R.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(w.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...T(),"Cache-Control":"public, max-age=60"}});try{let{html:c,boundaries:R,redirect:L,cookies:_,status:I,headers:D}=await Bt(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(L)return ko(L,_,D);if(R&&R.length>0){let{renderStreamingPage:P,streamToResponse:z}=await import("./chunk-webrqm20.js"),j=new Headers({...T(),...D,"Cache-Control":"private, no-store"});for(let V of _??[])j.append("Set-Cookie",V);if(M&&!d){let V=Ee(c);j.set("X-STX-Fragment","true"),j.set("X-STX-Runtime",de(c)?"true":"false"),j.set("X-STX-Layout",V.layout),j.set("X-STX-Layout-Group",V.group)}return z(P(M&&!d?oe(c,r.routerContainer||"main"):c,R,{timeoutMs:30000}),{status:I??u.status??200,headers:j})}let x=new Headers({"Content-Type":"text/html",...T(),...O.cache?{}:{"Cache-Control":"private, no-store"}});for(let P of _??[])x.append("Set-Cookie",P);for(let[P,z]of Object.entries(D??{}))x.set(P,z);if(x.set("Vary",T(x.get("Vary")).Vary),M&&!d){let P=Ee(c);return x.set("X-STX-Fragment","true"),x.set("X-STX-Runtime",de(c)?"true":"false"),x.set("X-STX-Layout",P.layout),x.set("X-STX-Layout-Group",P.group),new Response(oe(c,r.routerContainer||"main"),{status:I??u.status??200,headers:x})}return new Response(c,{status:I??u.status??200,headers:x})}catch(c){if(console.error(`[stx] Hydration error for ${i}:`,c),W)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${B.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${b.size} pre-loaded)`),{port:B.port,stop:()=>{f.invalidate(),B.stop()},invalidate:(n)=>f.invalidate(n)}}
|
|
3
3
|
export{Lt,ll};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{K,ss,os,lc,_t,Zo,is,Qo,Fu,be,ln,ve}from"./chunk-n4e02qdz.js";import"./chunk-dm1qh2vq.js";import"./chunk-ah9xyss2.js";import{Ai,s}from"./chunk-3e3dpp7w.js";import"./chunk-sv08pd66.js";import"./chunk-2943qhdt.js";import"./chunk-vkc51n9m.js";import"./chunk-02qaqamv.js";import"./chunk-6m3me7yj.js";import"./chunk-dhq80e4r.js";import"./chunk-vpdx7qr3.js";import"./chunk-dvc15djp.js";import"./chunk-x552npae.js";import"./chunk-qdyp2zqf.js";export{K as BROWSER_CORE_IMPORTS,lc as STX_AUTO_IMPORTS,ss as extractAndStripCssImports,be as extractBridgeData,Ai as findInterpolationEnd,Qo as generateAutoImportDestructuring,Fu as generateBrowserAutoImportDestructuring,ln as generateServerDataBridge,_t as injectBrowserCoreAutoImports,ve as processClientScript,is as referencesName,os as renderVendorStyleTags,s as stripCommentsAndLiterals,Zo as transformAutoImports};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{u,xs,bi,vi,Lc,jc,Bc,Fc,zc,Hc,Ge,j,Ke,Uc,nr,Vc,ki,Wc,Xe,r,rr,Ci,g,ne,cd}from"./chunk-n4e02qdz.js";import"./chunk-dm1qh2vq.js";import"./chunk-ah9xyss2.js";import"./chunk-sv08pd66.js";import"./chunk-2943qhdt.js";import"./chunk-vkc51n9m.js";import"./chunk-02qaqamv.js";import"./chunk-6m3me7yj.js";import"./chunk-dhq80e4r.js";import"./chunk-vpdx7qr3.js";import"./chunk-dvc15djp.js";import"./chunk-x552npae.js";import"./chunk-qdyp2zqf.js";export{ne as clearComponentCache,Wc as componentClientSignalNames,xs as convertToCommonJS,g as createDetailedErrorMessage,zc as extractDirectiveNames,bi as extractScriptFromTemplate,u as extractVariables,r as fileExists,cd as getComponentCacheStats,jc as getPositionInfo,j as getSharedTranspiler,Ci as getSourceLineInfo,Fc as hasDirectives,vi as hasVariables,Vc as isHydrateTrigger,Hc as isJavaScriptScript,Xe as renderComponentWithSlot,rr as resolveTemplatePath,Uc as scopeOnRootElement,Ge as shouldTranspileTypeScript,ki as slotContentHasExpressions,Ke as transpileTypeScript,nr as userComponentFileExists,Bc as validateDirective,Lc as validateTemplate};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ra,po,sa,oa,fo,ia,aa,ca,la,go,
|
|
2
|
+
import{ra,po,sa,oa,fo,ia,aa,ca,la,go,ua,pl}from"./chunk-ym1sb5bg.js";import{Co,ha}from"./chunk-h0a2s340.js";import{B,F,z,zt,Q,ie,Bn,De,gt,Ht,Ut,Vt,H,Wt,qt,Fn}from"./chunk-sv5nvfmb.js";import{Ga}from"./chunk-w3rmepwy.js";import"./chunk-117xss52.js";export{F as DEFAULT_FORMATS,z as DEFAULT_QUALITY,B as DEFAULT_WIDTHS,Fn as ImageProcessingError,oa as clearImageCache,fo as createImageDirective,ha as createImageHandler,aa as createImagePlugin,pl as defaultImageConfig,qt as formatSize,go as generateImageManifest,gt as generateSizes,De as generateSrcSet,Ht as getFallbackVariant,Bn as getImageMetadata,H as getMimeType,Wt as getTotalSize,Ut as groupVariantsByFormat,Co as handleImageRequest,ia as imageDirective,Q as isImageBackendAvailable,Vt as isImageFile,zt as isSharpAvailable,la as optimizeDirectory,ca as optimizeImage,po as parseImageComponent,ie as processImage,sa as processImageComponents,ra as renderImageComponent,Ga as rewriteImagesWithSiblings,ua as writeImageManifest};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{pu,fu}from"./chunk-m417sp42.js";import"./chunk-4pkpr5cg.js";import"./chunk-nh3svtvj.js";import"./chunk-ktyctev3.js";import"./chunk-n4e02qdz.js";import"./chunk-dm1qh2vq.js";import"./chunk-ah9xyss2.js";import"./chunk-sv08pd66.js";import"./chunk-2943qhdt.js";import"./chunk-vkc51n9m.js";import"./chunk-02qaqamv.js";import"./chunk-6m3me7yj.js";import"./chunk-dhq80e4r.js";import"./chunk-vpdx7qr3.js";import"./chunk-dvc15djp.js";import"./chunk-x552npae.js";import"./chunk-qdyp2zqf.js";export{fu as clearStoreCache,pu as getStoreScript};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ks,Xs,nt,Z,Rn,
|
|
2
|
+
import{Ks,Xs,nt,Z,Rn,br,An,vr,wr,Xc,Jc,Yc,Pn,Zc,Qc,el,tl,Yi,Zi,Qi,Js,ea,nl,rt,st,ot,it,at,ct,Te,rl}from"./chunk-x552npae.js";export{An as Router,el as abortNavigation,br as bracketPathToRegex,rt as clearMiddleware,Zi as createClientCookieManager,at as createMiddlewareContext,it as createRouteLocation,Yi as createServerCookieManager,Qi as createStorageManager,tl as defineMiddleware,Jc as defineRoute,Yc as defineRoutes,vr as findErrorPage,wr as formatRoutes,Xs as generateRouteManifest,Ks as generateRouteTypes,ea as getMiddleware,st as getMiddlewareNames,Te as getRouterScript,rl as getRouterScriptDev,nl as hasMiddleware,nt as isFileRequestPath,ot as loadMiddlewareFromDirectory,Rn as matchRoute,Qc as navigateTo,Z as patternToRegex,Js as registerMiddleware,Zc as resetRoutes,Pn as route,ct as runMiddleware,Xc as setAppUrl};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Nr,Lr,jr,xa,Sa,ka,Eo,Ca,_a}from"./chunk-pbwk8tzz.js";export{Nr as ImageProcessorCache,Eo as applyTransformations,xa as clearImageCache,Ca as generateResponsiveVariants,_a as generateSrcset,Lr as getCachedImageResult,ka as optimizeImage,Sa as processImage,jr as setCachedImageResult};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-dvc15djp.js";import"./chunk-vpdx7qr3.js";import{m,h,w,j}from"./chunk-n4e02qdz.js";import"./chunk-dhq80e4r.js";import"./chunk-ah9xyss2.js";import"./chunk-x552npae.js";import"./chunk-6m3me7yj.js";import"./chunk-02qaqamv.js";import"./chunk-sv08pd66.js";import"./chunk-vkc51n9m.js";import"./chunk-2943qhdt.js";import"./chunk-qdyp2zqf.js";import"./chunk-dm1qh2vq.js";import f from"path";var S=["applyOfflineUpdate","broadcast","cacheMedia","calculateDistance","canNotify","clearCookies","clearFetchCache","clearOfflineData","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","onOfflineUpdateReady","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAmbientSound","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBreathPacer","useBroadcastChannel","useBroadcastStream","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","useOutbox","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],L=new Set(S);var l=new Map,x=m(64),y=new Set,O=0,R=new Set(S);function W(){l.clear(),x.clear()}function P(o){let n=new Map;for(let r of o){let a=f.basename(r);if(a.endsWith(".d.ts"))continue;let t=a.replace(/\.[jt]s$/,"");if(t==="index")continue;if(t===a)continue;let i=n.get(t);if(i&&!i.endsWith(".js"))continue;n.set(t,r)}return[...n.values()].sort()}function I(o,n){let r=n.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${r}\\b`).test(o)}function M(o){if(!o)return[];let n=h(o,O),r=x.get(n);if(r)return r.slice();let a=o.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,""),t=[];for(let i of R){if(y.has(i))continue;let u=i.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${u}\\s*\\(`).test(a))t.push(i)}return t.sort(),x.set(n,t),t.slice()}async function A(o,n){let r=M(o);if(r.length===0)return null;let a=n??f.join(import.meta.dir,"composables"),t=`${a}\x00${r.join(",")}`,i=l.get(t);if(i!==void 0)return i||null;let u=j({loader:"ts",target:"browser",define:w()}),C=new Set(r),d=[],g=new Set,p=[];try{let s=new Bun.Glob("*.{ts,js}");for await(let e of s.scan({cwd:a,absolute:!0}))p.push(e)}catch{return l.set(t,""),null}p=P(p);for(let s of p){let e;try{e=await Bun.file(s).text()}catch{continue}let b=[];try{b=u.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!b.some((c)=>C.has(c)))continue;try{e=e.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^import\s+type\s+.*$/gm,""),e=e.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),e=e.replace(/^export\s+default\s+/gm,""),e=e.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),d.push(`// ${f.basename(s).replace(/\.[jt]s$/,"")}
|
|
3
3
|
${u.transformSync(e).trim()}`);for(let c of b)g.add(c)}catch(c){console.warn(`[stx] framework composable ${f.basename(s)} could not be bundled:`,c)}}let v=r.filter((s)=>!g.has(s)&&!I(o,s));if(v.length>0)console.warn(`[stx] could not bundle ${v.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(d.length===0)return l.set(t,""),null;let E=[...g].map((s)=>` try { if (!(${JSON.stringify(s)} in __s)) { __s[${JSON.stringify(s)}] = ${s}; if (!(${JSON.stringify(s)} in window)) window[${JSON.stringify(s)}] = ${s}; } } catch (e) {}`).join(`
|
|
4
4
|
`),k=`<script data-stx-scoped data-stx-run="always" data-stx-framework-composables>
|
|
5
5
|
;(function(){
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Re,Ae,Pe}from"./chunk-30acme5g.js";import{lt,
|
|
2
|
+
import{Re,Ae,Pe}from"./chunk-30acme5g.js";import{lt,ut,$e,eo,dt,pt}from"./chunk-mjj24qpb.js";import o from"fs";import i from"path";var c=[];function m(a){c=[];for(let e of a.storyFiles)if(c.push({text:e.fileName.toLowerCase(),original:e.fileName,type:"story",storyId:e.id}),c.push({text:e.relativePath.toLowerCase(),original:e.relativePath,type:"story",storyId:e.id}),e.story)for(let t of e.story.variants)c.push({text:t.title.toLowerCase(),original:t.title,type:"story",storyId:e.id,variantId:t.id})}function f(){return JSON.stringify(c)}async function F(a={}){let e=Date.now();lt();let t=await Re({mode:"build"});if(!t.config.enabled){$e("Story feature is disabled in config.");return}let n=await dt(t);Ae(t,n);let l=pt(t.config,n);Pe(t,l),ut(n.length);let d=a.outDir??t.config.outDir,s=i.resolve(t.root,d);await o.promises.mkdir(s,{recursive:!0}),console.log(` Building to ${d}...`);let g=v(t);await o.promises.writeFile(i.join(s,"index.html"),g);let y={files:n.map((r)=>({id:r.id,fileName:r.fileName,relativePath:r.relativePath,treePath:r.treePath})),tree:l};await o.promises.writeFile(i.join(s,"stories.json"),JSON.stringify(y,null,2));let u={theme:t.config.theme,responsivePresets:t.config.responsivePresets,backgroundPresets:t.config.backgroundPresets};await o.promises.writeFile(i.join(s,"config.json"),JSON.stringify(u,null,2));let p=i.join(s,"stories");await o.promises.mkdir(p,{recursive:!0});for(let r of n){let b=await o.promises.readFile(r.path,"utf-8");await o.promises.writeFile(i.join(p,`${r.id}.stx`),b)}m(t);let h=f();await o.promises.writeFile(i.join(s,"search-index.json"),h);let x=Date.now()-e;eo(n.length,d,x)}function v(a){let{theme:e}=a.config,t=e.title||"STX Story";return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ce,rc,Jo,bt,vt,ju,Yo,wt,on,sc,oc,ic,Qr,xt,ac,St,cc}from"./chunk-4pkpr5cg.js";import"./chunk-nh3svtvj.js";import"./chunk-ktyctev3.js";import"./chunk-n4e02qdz.js";import"./chunk-dm1qh2vq.js";import"./chunk-ah9xyss2.js";import"./chunk-sv08pd66.js";import"./chunk-2943qhdt.js";import"./chunk-vkc51n9m.js";import"./chunk-02qaqamv.js";import"./chunk-6m3me7yj.js";import"./chunk-dhq80e4r.js";import"./chunk-vpdx7qr3.js";import"./chunk-dvc15djp.js";import"./chunk-x552npae.js";import"./chunk-qdyp2zqf.js";export{on as MODULE_SPECIFIER_PREFIX,St as bundleClientScript,vt as clearBundleFailures,ce as clientBundleDependencies,bt as getBundleFailures,wt as hasUserImports,xt as moduleSubstitutionKey,oc as normalizeRegistrySpecifiers,ac as queueClientBundleBuild,Jo as recordBundleFailure,sc as registryIdForPath,Yo as resolveBundlerFallback,ic as rewriteRegistryImports,ju as setBundlerFallbackMode,rc as shouldLogBundlerDiagnostics,cc as tempBuildName,Qr as withModuleSubstitutes};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{da,mo,fl,pa,fa,gl,ml}from"./chunk-ky1426s1.js";import"./chunk-6fc8vw2v.js";import"./chunk-4pkpr5cg.js";import"./chunk-nh3svtvj.js";import"./chunk-ktyctev3.js";import{We,kc}from"./chunk-n4e02qdz.js";import"./chunk-dm1qh2vq.js";import"./chunk-ah9xyss2.js";import"./chunk-sv08pd66.js";import"./chunk-2943qhdt.js";import"./chunk-vkc51n9m.js";import"./chunk-02qaqamv.js";import"./chunk-6m3me7yj.js";import"./chunk-dhq80e4r.js";import"./chunk-vpdx7qr3.js";import"./chunk-dvc15djp.js";import"./chunk-x552npae.js";import"./chunk-qdyp2zqf.js";export{da as buildVirtualSource,We as extractScriptBlocks,kc as extractTemplateExpressions,pa as findRuntimeTypeDeclarations,fa as findStxModuleDeclarations,ml as formatTypecheckDiagnostics,fl as sourcePathFor,gl as typecheckStxFiles,mo as virtualPathFor};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Et,Ss,wi,Mc}from"./chunk-n4e02qdz.js";import"./chunk-dm1qh2vq.js";import"./chunk-ah9xyss2.js";import"./chunk-sv08pd66.js";import"./chunk-2943qhdt.js";import"./chunk-vkc51n9m.js";import"./chunk-02qaqamv.js";import"./chunk-6m3me7yj.js";import"./chunk-dhq80e4r.js";import"./chunk-vpdx7qr3.js";import"./chunk-dvc15djp.js";import"./chunk-x552npae.js";import"./chunk-qdyp2zqf.js";export{Mc as declareBareLoopHead,Et as parseLoopBinding,wi as processLoops,Ss as reportDeferredLoopWarnings};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{M}from"./chunk-5db5sxy3.js";var t={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603};function L(e){for(let[r,n]of Object.entries(t))if(n===e)return r;return}import le from"path";var ue={showRelativePaths:!1,enableAutoRecovery:M(),logRecoveryWarnings:!0},A={...ue};function k(){return{...A}}function _(e){if(!A.showRelativePaths||!e)return e;let r=A.baseDir||process.cwd();try{let n=le.relative(r,e);return n.startsWith("..")?e:n}catch{return e}}class R extends Error{code;filePath;line;column;context;numericCode;constructor(e,r,n,o,s,a,g){super(e);this.code=r;this.filePath=n;this.line=o;this.column=s;this.context=a;if(this.name="StxError",this.numericCode=g||t.EVALUATION_ERROR,this.filePath)this.filePath=_(this.filePath)}}class Y extends R{constructor(e,r,n,o,s,a){super(e,"stx_RUNTIME_ERROR",r,n,o,s,a||t.EVALUATION_ERROR);this.name="StxRuntimeError"}}class Cn extends R{constructor(e,r,n,o,s,a){super(e,"stx_FILE_ERROR",r,n,o,s,a||t.FILE_NOT_FOUND);this.name="StxFileError"}}class
|
|
2
|
+
import{M}from"./chunk-5db5sxy3.js";var t={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603};function L(e){for(let[r,n]of Object.entries(t))if(n===e)return r;return}import le from"path";var ue={showRelativePaths:!1,enableAutoRecovery:M(),logRecoveryWarnings:!0},A={...ue};function k(){return{...A}}function _(e){if(!A.showRelativePaths||!e)return e;let r=A.baseDir||process.cwd();try{let n=le.relative(r,e);return n.startsWith("..")?e:n}catch{return e}}class R extends Error{code;filePath;line;column;context;numericCode;constructor(e,r,n,o,s,a,g){super(e);this.code=r;this.filePath=n;this.line=o;this.column=s;this.context=a;if(this.name="StxError",this.numericCode=g||t.EVALUATION_ERROR,this.filePath)this.filePath=_(this.filePath)}}class Y extends R{constructor(e,r,n,o,s,a){super(e,"stx_RUNTIME_ERROR",r,n,o,s,a||t.EVALUATION_ERROR);this.name="StxRuntimeError"}}class Cn extends R{constructor(e,r,n,o,s,a){super(e,"stx_FILE_ERROR",r,n,o,s,a||t.FILE_NOT_FOUND);this.name="StxFileError"}}class gr extends R{isFatal=!0;constructor(e,r,n,o,s,a){super(e,"stx_VALIDATION_ERROR",r,n,o,s,a||t.DOM_API_VIOLATION);this.name="StxValidationError"}}function G(e){let{type:r,message:n,code:o,filePath:s,line:a,column:g,template:u,offset:h,snippet:m,suggestion:d,format:f="text"}=e,E=a,x=g;if(!E&&u&&h!==void 0){let V=he(u,h);E=V.line,x=V.column}let w=s?_(s):void 0,y=o?L(o):void 0,S={type:r,code:o,codeName:y,message:n,filePath:w,line:E,column:x,snippet:m,suggestion:d,timestamp:new Date().toISOString()},v;switch(f){case"html":v=fe(S);break;case"json":v=JSON.stringify(S,null,2);break;case"console":v=me(S,u,h);break;case"text":default:v=ge(S,u,h);break}return{formatted:v,data:S}}function ge(e,r,n){let o=[],s=e.code?` [${e.codeName||e.code}]`:"";if(o.push(`[${e.type} Error${s}]`),e.filePath){let a=e.filePath;if(e.line){if(a+=`:${e.line}`,e.column)a+=`:${e.column}`}o.push(`at ${a}`)}if(o.push(`
|
|
3
3
|
${e.message}`),r&&e.line){let a=pe(r,e.line,2);if(a)o.push(`
|
|
4
4
|
${a}`)}if(e.snippet)o.push(`
|
|
5
5
|
Snippet: ${e.snippet}`);if(e.suggestion)o.push(`
|
|
@@ -25,7 +25,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
|
|
|
25
25
|
`;r.appendFileSync(this.logFilePath,s,"utf-8")}catch(r){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",r)}})}async rotateIfNeeded(e){try{if(!e.existsSync(this.logFilePath))return;if(e.statSync(this.logFilePath).size<this.maxFileSize)return;for(let n=this.maxLogFiles-1;n>=1;n--){let o=`${this.logFilePath}.${n}`,s=`${this.logFilePath}.${n+1}`;if(e.existsSync(o))if(n>=this.maxLogFiles-1)e.unlinkSync(o);else e.renameSync(o,s)}if(this.maxLogFiles<=1)e.writeFileSync(this.logFilePath,"");else e.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(r){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",r)}}getRecentErrors(e=10){return this.errors.slice(-e)}getErrorsByType(e){return this.errors.filter((r)=>r.error.constructor.name===e)}getErrorsByLevel(e){return this.errors.filter((r)=>r.level===e)}clear(){this.errors.length=0}async clearLogFile(){try{let e=await import("fs");if(e.existsSync(this.logFilePath))e.writeFileSync(this.logFilePath,"","utf-8")}catch(e){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",e)}}getStats(){let e={},r={error:0,warning:0,info:0};for(let n of this.errors){let o=n.error.constructor.name;e[o]=(e[o]||0)+1;let s=n.level||"error";r[s]=(r[s]||0)+1}return{total:this.errors.length,byType:e,byLevel:r}}async exportToFile(e,r="json"){let n=await import("fs"),o=await import("path"),s=o.dirname(e);if(!n.existsSync(s))n.mkdirSync(s,{recursive:!0});if(r==="json"){let a=this.errors.map((g)=>({timestamp:g.timestamp.toISOString(),level:g.level||"error",type:g.error.constructor.name,message:g.error.message,stack:g.error.stack,context:g.context}));n.writeFileSync(e,JSON.stringify(a,null,2),"utf-8")}else{let a=this.errors.map((g)=>this.formatEntry(g));n.writeFileSync(e,a.join(`
|
|
26
26
|
|
|
27
27
|
`),"utf-8")}}async flush(){await this.writeQueue}}var I=new P,Dt={isDevelopment(){return M()},logDetailedError(e,r){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",e.message),console.error("Stack:",e.stack),r)console.error("Context:",r);console.error("========================")},createErrorReport(e,r){let n=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${e.message}`,`Type: ${e.constructor.name}`,`Stack: ${e.stack}`];if(r)n.push(`Context: ${JSON.stringify(r,null,2)}`);return n.push("========================"),n.join(`
|
|
28
|
-
`)}};var Ee={maxSanitizeDepth:10,allowBracketNotation:!1},K={...Ee};var O=/\bnew\s+/,F="__stx_safe_ctors",ee=["Bun","Deno","Buffer","fetch","atob","btoa","console","Response","Request","Headers","WebAssembly","structuredClone","queueMicrotask","crypto","performance","navigator","Worker","WebSocket","BroadcastChannel","EventSource","XMLHttpRequest","localStorage","sessionStorage"],N=[...ee,"Function","setTimeout","setInterval","setImmediate","process","require","exports","module","window","document","global","globalThis","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry"],H=N.map(()=>{return}),T=Object.freeze(Object.assign(Object.create(null),{keys:Object.keys,values:Object.values,entries:Object.entries,fromEntries:Object.fromEntries,assign:Object.assign,hasOwn:Object.hasOwn,is:Object.is})),j=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,O,/\bdelete\s+/,/\bthis\b/,/\\u(?:\{[\dA-Fa-f]+\}|[\dA-Fa-f]{4})/],U=new Set([...ee,"eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this",F]),B=new Set(["__proto__","constructor","prototype"]);function te(e){let r="",n=[],o=null,s=!1;for(let a=0;a<e.length;a++){let g=e[a];if(s){s=!1;continue}if(g==="\\"&&o){s=!0;continue}if(o){if(o==="`"&&g==="$"&&a+1<e.length&&e[a+1]==="{"){let u=1;a+=2;while(a<e.length&&u>0){if(e[a]==="{")u++;else if(e[a]==="}")u--;if(u>0)r+=e[a],n.push(a),a++}continue}if(g===o)o=null;continue}if(g==='"'||g==="'"||g==="`"){o=g;continue}r+=g,n.push(a)}return{text:r,map:n}}function ne(e){return te(e).text}var oe=["Collator","DateTimeFormat","DisplayNames","ListFormat","Locale","NumberFormat","PluralRules","RelativeTimeFormat","Segmenter"],se=(()=>{let e={Date,URL,URLSearchParams},r=Intl;for(let n of oe)if(typeof r[n]==="function")e[`Intl_${n}`]=r[n];return Object.freeze(Object.assign(Object.create(null),e))})(),xe=/^new(\s+)(Date|URLSearchParams|URL|Intl\s*\.\s*([A-Z_a-z]\w*))\s*\(/,q=/(?<![\w$])new(?![\w$])/g,J=`only new Date(), new URL(), new URLSearchParams() and new Intl.{${oe.join(",")}}() are allowed`;function be(e){let{text:r,map:n}=te(e),o=[];q.lastIndex=0;let s;while((s=q.exec(r))!==null){let g=s.index;if(/(?<!\.)\.\s*$/.test(r.slice(0,g)))continue;let u=xe.exec(r.slice(g)),h=u?.[3],m=!u?null:h?`Intl_${h}`:u[2];if(!u||!m||!(m in se))throw new b(`matched /${O.source}/; ${J}`,e);let d=g+u[0].length,f=n[g],E=n[d-1]+1;if(e.slice(f,E)!==r.slice(g,d))throw new b(`matched /${O.source}/; ${J}`,e);let x=f+3+u[1].length;o.push({start:x,end:x+u[2].length,key:m})}let a=e;for(let g=o.length-1;g>=0;g--){let u=o[g];a=`${a.slice(0,u.start)}${F}.${u.key}${a.slice(u.end)}`}return{source:a,usesSafeConstructors:o.length>0}}class b extends Error{rule;expression;constructor(e,r,n){super(n??`Potentially unsafe expression (${e}): ${r}`);this.name="UnsafeExpressionError",this.rule=e,this.expression=r}}function _n(e){try{return W(e),null}catch(r){return r instanceof b?r.rule:r instanceof Error?r.message:String(r)}}function ie(e,r){let n=/[$A-Z_a-z][$\w]*/g,o;while((o=n.exec(e))!==null){let s=o[0],a=e[o.index-1];if(U.has(s))throw new b(`matched /\\b${s}\\b/; identifier ${s}`,r);if(a==="."&&B.has(s))throw new b(`matched /.${s}/; property ${s}`,r)}}function ae(e,r=!0){let n=/(?:[$\w)\].]|\?\.)\s*\[([^\]]*)\]/g,o=new Set,s;while((s=n.exec(e))!==null){let a=s.index+s[0].indexOf("["),g=e.slice(0,a);if(/(?:^|[^$\w])(?:let|const|var)\s*$/.test(g))continue;let u=s[1].trim(),h=/^'(?:[^'\\]|\\.)*'$/.test(u),m=/^"(?:[^"\\]|\\.)*"$/.test(u);if(/^\d+$/.test(u))continue;if(h||m){let f=u.slice(1,-1);if(B.has(f))throw new b(`bracket key ${f}`,e);if(!K.allowBracketNotation)throw new b("bracket notation with a string key; enable with configureSafeEvaluator({ allowBracketNotation: true })",e,`Bracket notation with strings not allowed: ${e}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);continue}if(r&&/^[$A-Z_a-z][$\w]*$/.test(u)){o.add(u);continue}throw new b("dynamic bracket notation is not allowed",e)}return[...o]}function W(e){let r=e.trim(),n=ne(r);ie(n,r);let o=ae(r);for(let s of j){if(s===O)continue;if(s.test(n))throw new b(`matched /${s.source}/`,r)}return{...be(r),dynamicKeys:o}}function Vs(e){return W(e),e.trim()}function
|
|
28
|
+
`)}};var Ee={maxSanitizeDepth:10,allowBracketNotation:!1},K={...Ee};var O=/\bnew\s+/,F="__stx_safe_ctors",ee=["Bun","Deno","Buffer","fetch","atob","btoa","console","Response","Request","Headers","WebAssembly","structuredClone","queueMicrotask","crypto","performance","navigator","Worker","WebSocket","BroadcastChannel","EventSource","XMLHttpRequest","localStorage","sessionStorage"],N=[...ee,"Function","setTimeout","setInterval","setImmediate","process","require","exports","module","window","document","global","globalThis","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry"],H=N.map(()=>{return}),T=Object.freeze(Object.assign(Object.create(null),{keys:Object.keys,values:Object.values,entries:Object.entries,fromEntries:Object.fromEntries,assign:Object.assign,hasOwn:Object.hasOwn,is:Object.is})),j=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,O,/\bdelete\s+/,/\bthis\b/,/\\u(?:\{[\dA-Fa-f]+\}|[\dA-Fa-f]{4})/],U=new Set([...ee,"eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this",F]),B=new Set(["__proto__","constructor","prototype"]);function te(e){let r="",n=[],o=null,s=!1;for(let a=0;a<e.length;a++){let g=e[a];if(s){s=!1;continue}if(g==="\\"&&o){s=!0;continue}if(o){if(o==="`"&&g==="$"&&a+1<e.length&&e[a+1]==="{"){let u=1;a+=2;while(a<e.length&&u>0){if(e[a]==="{")u++;else if(e[a]==="}")u--;if(u>0)r+=e[a],n.push(a),a++}continue}if(g===o)o=null;continue}if(g==='"'||g==="'"||g==="`"){o=g;continue}r+=g,n.push(a)}return{text:r,map:n}}function ne(e){return te(e).text}var oe=["Collator","DateTimeFormat","DisplayNames","ListFormat","Locale","NumberFormat","PluralRules","RelativeTimeFormat","Segmenter"],se=(()=>{let e={Date,URL,URLSearchParams},r=Intl;for(let n of oe)if(typeof r[n]==="function")e[`Intl_${n}`]=r[n];return Object.freeze(Object.assign(Object.create(null),e))})(),xe=/^new(\s+)(Date|URLSearchParams|URL|Intl\s*\.\s*([A-Z_a-z]\w*))\s*\(/,q=/(?<![\w$])new(?![\w$])/g,J=`only new Date(), new URL(), new URLSearchParams() and new Intl.{${oe.join(",")}}() are allowed`;function be(e){let{text:r,map:n}=te(e),o=[];q.lastIndex=0;let s;while((s=q.exec(r))!==null){let g=s.index;if(/(?<!\.)\.\s*$/.test(r.slice(0,g)))continue;let u=xe.exec(r.slice(g)),h=u?.[3],m=!u?null:h?`Intl_${h}`:u[2];if(!u||!m||!(m in se))throw new b(`matched /${O.source}/; ${J}`,e);let d=g+u[0].length,f=n[g],E=n[d-1]+1;if(e.slice(f,E)!==r.slice(g,d))throw new b(`matched /${O.source}/; ${J}`,e);let x=f+3+u[1].length;o.push({start:x,end:x+u[2].length,key:m})}let a=e;for(let g=o.length-1;g>=0;g--){let u=o[g];a=`${a.slice(0,u.start)}${F}.${u.key}${a.slice(u.end)}`}return{source:a,usesSafeConstructors:o.length>0}}class b extends Error{rule;expression;constructor(e,r,n){super(n??`Potentially unsafe expression (${e}): ${r}`);this.name="UnsafeExpressionError",this.rule=e,this.expression=r}}function _n(e){try{return W(e),null}catch(r){return r instanceof b?r.rule:r instanceof Error?r.message:String(r)}}function ie(e,r){let n=/[$A-Z_a-z][$\w]*/g,o;while((o=n.exec(e))!==null){let s=o[0],a=e[o.index-1];if(U.has(s))throw new b(`matched /\\b${s}\\b/; identifier ${s}`,r);if(a==="."&&B.has(s))throw new b(`matched /.${s}/; property ${s}`,r)}}function ae(e,r=!0){let n=/(?:[$\w)\].]|\?\.)\s*\[([^\]]*)\]/g,o=new Set,s;while((s=n.exec(e))!==null){let a=s.index+s[0].indexOf("["),g=e.slice(0,a);if(/(?:^|[^$\w])(?:let|const|var)\s*$/.test(g))continue;let u=s[1].trim(),h=/^'(?:[^'\\]|\\.)*'$/.test(u),m=/^"(?:[^"\\]|\\.)*"$/.test(u);if(/^\d+$/.test(u))continue;if(h||m){let f=u.slice(1,-1);if(B.has(f))throw new b(`bracket key ${f}`,e);if(!K.allowBracketNotation)throw new b("bracket notation with a string key; enable with configureSafeEvaluator({ allowBracketNotation: true })",e,`Bracket notation with strings not allowed: ${e}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);continue}if(r&&/^[$A-Z_a-z][$\w]*$/.test(u)){o.add(u);continue}throw new b("dynamic bracket notation is not allowed",e)}return[...o]}function W(e){let r=e.trim(),n=ne(r);ie(n,r);let o=ae(r);for(let s of j){if(s===O)continue;if(s.test(n))throw new b(`matched /${s.source}/`,r)}return{...be(r),dynamicKeys:o}}function Vs(e){return W(e),e.trim()}function mr(e){let r={};r.Math=Math,r.JSON=JSON,r.Date=Date,r.String=String,r.Number=Number,r.Boolean=Boolean,r.Array=Array,r.Object=T,r.parseInt=Number.parseInt,r.parseFloat=Number.parseFloat,r.isNaN=Number.isNaN,r.isFinite=Number.isFinite,r.encodeURIComponent=encodeURIComponent,r.decodeURIComponent=decodeURIComponent;for(let[n,o]of Object.entries(e)){if(n.startsWith("__")||j.some((s)=>s.test(n)))continue;if(o&&typeof o==="object"&&!Array.isArray(o))r[n]=z(o);else r[n]=o}return r}function z(e,r=0){if(r>=K.maxSanitizeDepth)return"[Object too deep]";if(e===null||typeof e!=="object")return e;if(Array.isArray(e))return e.map((o)=>z(o,r+1));if(e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error)return e;let n={};for(let[o,s]of Object.entries(e)){if(o.startsWith("__")||o==="constructor"||o==="prototype")continue;if(s&&typeof s==="object")n[o]=z(s,r+1);else n[o]=s}return n}function l(e,r){try{let n=mr(r),o=Object.keys(n),s=Object.values(n);return c(e,o)(...s)}catch{return}}function p(e){try{return Vs(e),!0}catch{return!1}}function zi(e,r){try{let n=mr(r),o=Object.keys(n),s=Object.values(n),a=!1,u=c(e,o,()=>{a=!0})(...s);return!a&&Boolean(u)}catch{return!1}}function D(e,r){try{let n=l(e,r);if(n&&typeof n==="object"&&!Array.isArray(n))return n;return{}}catch{return{}}}var ce=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"]),ye=2000,C=new Map;function Q(e,r){let n=`${e.join(",")}\x00${r}`,o=C.get(n);if(o)return o;let s=Function(...e,r);if(C.size>=ye)C.clear();return C.set(n,s),s}function _e(e){return e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:)/g,"$1$2").match(/\b[a-zA-Z_$][\w$]*\b/g)||[]}var we=/^[A-Za-z_$][\w$]*$/;function tt(e){return we.test(e)&&!ce.has(e)}function c(e,r,n){let{source:o,usesSafeConstructors:s,dynamicKeys:a}=W(e),g=[];for(let f=0;f<r.length;f++){if(!tt(r[f]))continue;if(r[f]===F||r[f]==="Object"||U.has(r[f]))continue;g.push({key:r[f],index:f})}g.sort((f,E)=>f.key.localeCompare(E.key));let u=g.map((f)=>f.key),h=g.map((f)=>f.index),m=`
|
|
29
29
|
'use strict';
|
|
30
30
|
try {
|
|
31
31
|
return ${o};
|
|
@@ -36,5 +36,5 @@ catch (e) {
|
|
|
36
36
|
}
|
|
37
37
|
throw e;
|
|
38
38
|
}
|
|
39
|
-
`;return Se(ve(s?(f)=>{let E=Q([F,"Object",...N,...u,...f],m);return(...x)=>E(se,T,...H,...x)}:(f)=>{let E=Q(["Object",...N,...u,...f],m);return(...x)=>E(T,...H,...x)},u,r,g,h,n),r,a)}function Se(e,r,n){if(n.length===0)return e;let o=n.map((s)=>r.indexOf(s));return(...s)=>{for(let a of o){if(a<0)continue;let g=s[a];if(typeof g==="string"&&B.has(g))return}return e(...s)}}function ve(e,r,n,o,s,a){let g=e([]),u=o.every((m,d)=>m.index===d);if(r.length===n.length&&u)return Z(g,r,e,void 0,a);return Z((...m)=>{let d=Array(s.length);for(let f=0;f<s.length;f++)d[f]=m[s[f]];return g(...d)},r,e,(m)=>{g=e(m)},a)}function Z(e,r,n,o,s){let g=/^(\w+) is not defined$/,u=e,h=[],m=new Set(r);return(...d)=>{for(let f=0;f<=8;f++)try{return u(...d)}catch(E){let x=E instanceof Error?E.message:"",w=g.exec(x);if(!(E instanceof ReferenceError)||!w)return;let y=w[1];if(m.has(y)||ce.has(y)||U.has(y))return;if(s?.(y),m.add(y),h.push(y),o)o(h);else u=n(h)}return}}function
|
|
40
|
-
export{t,Y,Cn,
|
|
39
|
+
`;return Se(ve(s?(f)=>{let E=Q([F,"Object",...N,...u,...f],m);return(...x)=>E(se,T,...H,...x)}:(f)=>{let E=Q(["Object",...N,...u,...f],m);return(...x)=>E(T,...H,...x)},u,r,g,h,n),r,a)}function Se(e,r,n){if(n.length===0)return e;let o=n.map((s)=>r.indexOf(s));return(...s)=>{for(let a of o){if(a<0)continue;let g=s[a];if(typeof g==="string"&&B.has(g))return}return e(...s)}}function ve(e,r,n,o,s,a){let g=e([]),u=o.every((m,d)=>m.index===d);if(r.length===n.length&&u)return Z(g,r,e,void 0,a);return Z((...m)=>{let d=Array(s.length);for(let f=0;f<s.length;f++)d[f]=m[s[f]];return g(...d)},r,e,(m)=>{g=e(m)},a)}function Z(e,r,n,o,s){let g=/^(\w+) is not defined$/,u=e,h=[],m=new Set(r);return(...d)=>{for(let f=0;f<=8;f++)try{return u(...d)}catch(E){let x=E instanceof Error?E.message:"",w=g.exec(x);if(!(E instanceof ReferenceError)||!w)return;let y=w[1];if(m.has(y)||ce.has(y)||U.has(y))return;if(s?.(y),m.add(y),h.push(y),o)o(h);else u=n(h)}return}}function hr(e){let r=e.trim();try{let n=ne(r);if(/\b(?:eval|function|import|require|process|globalthis|window|document|fetch|bun|deno|buffer|console|reflect|proxy|prototype|constructor|this)\b/i.test(n))return!1;ie(n,r),ae(r);for(let o of j)if(o.test(n))return!1}catch{return!1}return!0}
|
|
40
|
+
export{t,Y,Cn,gr,i,re,Us,I,Dt,_n,Vs,mr,l,p,zi,D,_e,tt,c,hr};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{t,i,D}from"./chunk-
|
|
2
|
+
import{t,i,D}from"./chunk-dhq80e4r.js";import{Ps}from"./chunk-ah9xyss2.js";import E from"path";var S;async function W(){if(S!==void 0)return S;try{let e=await import("@stacksjs/ts-i18n");S=e.loadLocale??null}catch{S=null}return S}var T={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},v={},L={},k={};function J(e,a=0){if(a<=0)return!1;return Date.now()-e.loadedAt>a}async function G(e,a){if({...T,...a.i18n}.cache&&v[e]){let r=v[e],l=a.i18n?.cacheMaxAge??0;if(!J(r,l))return r.translations}if(L[e]?.state==="loading")return L[e].promise;k[e]="loading";let n=C(e,a).then((r)=>(k[e]="loaded",delete L[e],r)).catch((r)=>{throw k[e]="error",L[e]={promise:n,state:"error",error:r instanceof Error?r:Error(String(r))},r});return L[e]={promise:n,state:"loading"},n}async function C(e,a){let s={...T,...a.i18n},n=E.isAbsolute(s.translationsDir)?s.translationsDir:E.resolve(a.root||process.cwd(),s.translationsDir);try{let r=await W(),l=r?await r(e,{translationsDir:n,defaultLocale:s.defaultLocale,sources:ee(s.format)}):await Y(e,s,n);if(l===void 0){let u=e!==s.defaultLocale?await C(s.defaultLocale,a):{};if(s.cache)v[e]={translations:u,loadedAt:Date.now(),locale:e};return u}let c=l;if(s.cache)v[e]={translations:c,loadedAt:Date.now(),locale:e};return c}catch(r){if(a.debug)console.error(`Error loading translation file for locale "${e}":`,r);if(e!==s.defaultLocale)return C(s.defaultLocale,a);return{}}}async function Y(e,a,s){let n=E.join(s,`${e}${Z(a.format)}`);try{let r=await import(n);return r.default||r}catch(r){try{let l=await Bun.file(n).text();if(a.format==="yaml"||a.format==="yml")return Q(l);if(a.format==="json")return JSON.parse(l);throw r}catch{return}}}function Z(e){switch(e){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function Q(e){let a={},s=e.split(`
|
|
3
3
|
`),n=[{obj:a,indent:-1}];for(let r of s){let l=r.replace(/#.*$/,"").trimEnd();if(!l.trim())continue;let c=l.search(/\S/);if(c===-1)continue;while(n.length>1&&n[n.length-1].indent>=c)n.pop();let u=n[n.length-1].obj,o=l.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(o){let[,,g,f]=o,p=g.trim(),m=f.trim();if(m==="")u[p]={},n.push({obj:u[p],indent:c});else u[p]=X(m)}}return a}function X(e){if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);let a=e.toLowerCase();if(a==="true"||a==="yes")return!0;if(a==="false"||a==="no")return!1;if(a==="null"||a==="~")return null;let s=Number(e);if(!Number.isNaN(s)&&e!=="")return s;return e}function ee(e){switch(e){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function te(e,a){return G(e,a)}function re(e,a){for(let s of e){let n=s.trim(),r=n.match(/^\{(\d+)\}\s*(.*)$/);if(r){let c=Number.parseInt(r[1],10);if(a===c)return r[2];continue}let l=n.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(l){let c=Number.parseInt(l[1],10),u=l[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(l[2],10);if(a>=c&&a<=u)return l[3];continue}}if(e.length===2)return a===1?e[0].trim():e[1].trim();if(a<e.length)return e[a].trim();return e[e.length-1].trim()}function ne(e,a={}){return j(e,a)}function j(e,a){let s="",n=0;while(n<e.length)if(e[n]==="{"){let r=ie(e,n);if(r===-1){s+=e[n],n++;continue}let l=e.slice(n+1,r);s+=se(l,a),n=r+1}else if(e[n]==="'"&&n+1<e.length)if(e[n+1]==="'")s+="'",n+=2;else if(e[n+1]==="{"||e[n+1]==="}")s+=e[n+1],n+=2;else s+=e[n],n++;else s+=e[n],n++;return s}function ie(e,a){let s=0;for(let n=a;n<e.length;n++)if(e[n]==="{")s++;else if(e[n]==="}"){if(s--,s===0)return n}return-1}function se(e,a){let s=ae(e);if(s.length===0)return`{${e}}`;let n=s[0].trim(),r=a[n];if(s.length===1)return r!==void 0?String(r):`{${n}}`;switch(s[1].trim().toLowerCase()){case"plural":return oe(r,s.slice(2).join(","),a);case"select":return ce(r,s.slice(2).join(","));case"selectordinal":return ue(r,s.slice(2).join(","));case"number":return ge(r,s[2]?.trim());case"date":return pe(r,s[2]?.trim());case"time":return fe(r,s[2]?.trim());default:return r!==void 0?String(r):`{${e}}`}}function ae(e){let a=[],s="",n=0;for(let r=0;r<e.length;r++){let l=e[r];if(l==="{")n++,s+=l;else if(l==="}")n--,s+=l;else if(l===","&&n===0)a.push(s),s="";else s+=l}if(s)a.push(s);return a}function oe(e,a,s){let n=Number(e)||0,r=P(a),l=`=${n}`;if(r[l])return R(r[l],n,s);let c=le(n);if(r[c])return R(r[c],n,s);if(r.other)return R(r.other,n,s);return String(n)}function R(e,a,s){let n=e.replace(/#/g,String(a));return j(n,s)}function le(e){let a=Math.abs(e),s=Math.floor(a),n=String(e).includes(".")?String(e).split(".")[1].length:0;if(s===1&&n===0)return"one";return"other"}function ce(e,a){let s=String(e||""),n=P(a);if(n[s])return n[s];return n.other||String(e)}function ue(e,a){let s=Number(e)||0,n=P(a),r=de(s);if(n[r])return n[r].replace(/#/g,String(s));if(n.other)return n.other.replace(/#/g,String(s));return String(s)}function de(e){let a=Math.abs(e),s=a%10,n=a%100;if(s===1&&n!==11)return"one";if(s===2&&n!==12)return"two";if(s===3&&n!==13)return"few";return"other"}function P(e){let a={},s=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,n=s.exec(e);while(n!==null)a[n[1]]=n[2],n=s.exec(e);return a}function ge(e,a){let s=Number(e);if(Number.isNaN(s))return String(e);switch(a){case"integer":return Math.floor(s).toLocaleString();case"percent":return`${(s*100).toFixed(0)}%`;case"currency":return s.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return s.toLocaleString()}}function pe(e,a){let s=e instanceof Date?e:new Date(String(e));if(Number.isNaN(s.getTime()))return String(e);let n={};switch(a){case"short":n.dateStyle="short";break;case"medium":n.dateStyle="medium";break;case"long":n.dateStyle="long";break;case"full":n.dateStyle="full";break;default:n.dateStyle="medium"}return s.toLocaleDateString(void 0,n)}function fe(e,a){let s=e instanceof Date?e:new Date(String(e));if(Number.isNaN(s.getTime()))return String(e);let n={};switch(a){case"short":n.timeStyle="short";break;case"medium":n.timeStyle="medium";break;case"long":n.timeStyle="long";break;case"full":n.timeStyle="full";break;default:n.timeStyle="short"}return s.toLocaleTimeString(void 0,n)}function me(e){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(e)}function N(e,a,s=!0,n={}){let r=e.split("."),l=a;for(let u of r){if(l===void 0||l===null)break;l=l[u]}if(l===void 0||l===null)return s?e:"";let c=String(l);if(me(c))return ne(c,n);if(c.includes("|")&&"count"in n){let u=Number(n.count),o=c.split("|");c=re(o,u)}for(let[u,o]of Object.entries(n)){let g=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");c=c.replace(new RegExp(`:${g}`,"g"),String(o))}return c}var O=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),be=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function _(e){if(!e)return"ltr";let a=e.trim().toLowerCase().replace(/_/g,"-").split("-"),s=a[0];if(!s)return"ltr";let n=a[1]?.length===4?a[1]:void 0;if(n)return be.has(n)?"rtl":"ltr";if(a.length>1&&O.has(`${s}-${a[1]}`))return"rtl";return O.has(s)?"rtl":"ltr"}async function _i(e,a,s,n){let r=e,l=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,c={...T,...n.i18n},u=await te(c.locale,n);a.__translations=u,a.__locale=c.locale,a.__i18nConfig=c,r=await F(r,l,async(f,p,m,w,h)=>{try{let b={};if(m)try{let d=[()=>JSON.parse(m),()=>{let x=`{"data":${m}}`,A=JSON.parse(x);return typeof A.data==="object"?A.data:{}},()=>D(m,a)];for(let x of d)try{if(b=x(),Object.keys(b).length>0)break}catch{}}catch(d){if(n.debug)console.error("Error parsing parameters for @translate directive:",d)}return N(p,u,c.fallbackToKey,b)||w.trim()}catch(b){if(n.debug)console.error("Error processing @translate directive:",b);return i("Translate",`Error in @translate('${p}'): ${b instanceof Error?b.message:String(b)}`,t.EVALUATION_ERROR)}});let o=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(n.debug){console.warn(`Processing translations in template. Sections: ${r.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let f=[...r.matchAll(o)];console.warn(`Found ${f.length} @translate matches`),f.forEach((p,m)=>console.warn(`Match ${m}: ${p[0]}, Key: ${p[1]}, Params: ${p[2]||"none"}`))}return r=await F(r,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(f,p,m,w)=>{try{let h={};if(m)try{let b=[()=>JSON.parse(m),()=>{let y=`{"data":${m}}`,d=JSON.parse(y);return typeof d.data==="object"?d.data:{}},()=>D(m,a)];for(let y of b)try{if(h=y(),Object.keys(h).length>0)break}catch{}}catch(b){if(n.debug)console.error("Error parsing parameters for @translate directive:",b)}return N(p,u,c.fallbackToKey,h)}catch(h){if(n.debug)console.error("Error processing @translate directive:",h);return i("Translate",`Error in @translate('${p}'): ${h instanceof Error?h.message:String(h)}`,t.EVALUATION_ERROR)}}),r}async function F(e,a,s){let n=[];return e.replace(a,(l,...c)=>{let u=s(l,...c).then((o)=>({match:l,replacement:o}));return n.push(u),l}),(await Promise.all(n)).reduce((l,{match:c,replacement:u})=>l.replace(c,u),e)}function q(e,a){if(!e||_(e)!=="rtl")return!1;return!a||a.trim().toLowerCase()!=="rtl"}function V(e){if(!e)return!1;return e.trim().split(/\s+/)[0]?.toLowerCase()==="presentation"||e.trim().split(/\s+/)[0]?.toLowerCase()==="none"}function I(e,a){let s=new RegExp(`\\b${a}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(e);if(!s)return null;return s[2]??s[3]??s[4]??null}function Ei(e,a,s,n){let r=e;r=r.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(c,u,o)=>{let f={"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"}[u]||"Make this element accessible";return`<!-- a11y-hint: ${o||f} -->`});let l=/@screenReader\(([^@]*)\)@endScreenReader/g;return r=r.replace(l,(c,u)=>`<span class="sr-only">${u.trim()}</span>`),r=r.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(c,u,o)=>`<span id="${`desc-${u}`}" class="sr-only">${o}</span>`),r}function he(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function ye(e){let a=new Map,s=e.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,(r,l,c)=>{let u=a.get(c);if(!u)u=`stx-a11y-component-${a.size}`,a.set(c,u);return`<${l}${u}`}),n=new Map([...a.entries()].map(([r,l])=>[l,r]));return{protectedSource:s,restore:(r)=>r.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(l,c,u)=>{let o=n.get(u);return o?`<${c}${o}`:l})}}function xe(e,a){let s=[],n=/<img\s+([^>]*)>/gi,r;r=n.exec(e);while(r!==null){let d=r[1];if(!/\balt\s*=/i.test(d))s.push({type:"missing-alt",element:r[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/"});r=n.exec(e)}let l=/<button([^>]*)>\s*<\/button>/gi;r=l.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))s.push({type:"missing-accessible-name",element:r[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/"});r=l.exec(e)}let c=/<a\s+([^>]*)>\s*<\/a>/gi;r=c.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))s.push({type:"link-missing-text",element:r[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"});r=c.exec(e)}let u=/<(input|select|textarea)\s+([^>]*)>/gi;r=u.exec(e);while(r!==null){let d=r[2];if(/\btype\s*=\s*["']hidden["']/i.test(d)){r=u.exec(e);continue}let x=/\baria-label\s*=/i.test(d)||/\baria-labelledby\s*=/i.test(d),A=d.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!x){let B=A&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${A[1]}["']`,"i").test(e),U=r.index,M=e.substring(0,U),Ae=e.substring(U),H=(M.match(/<label\b/gi)||[]).length,z=(M.match(/<\/label>/gi)||[]).length,K=H>z;if(!B&&!K)s.push({type:"input-missing-label",element:r[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/"})}r=u.exec(e)}let o=/<h([1-6])[^>]*>/gi,g=[];r=o.exec(e);while(r!==null)g.push(Number.parseInt(r[1],10)),r=o.exec(e);let f=0;for(let d of g){if(f>0&&d>f+1)s.push({type:"heading-skip",element:`<h${d}>`,message:`Heading level skipped from h${f} to h${d}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});f=d}if(/<html\b/i.test(e)&&!/<html[^>]*\slang\s*=/i.test(e))s.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 p=e.match(/<html\b([^>]*)>/i);if(p&&q(I(p[1],"lang"),I(p[1],"dir")))s.push({type:"missing-dir",element:p[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 m=/<table([^>]*)>([\s\S]*?)<\/table>/gi;r=m.exec(e);while(r!==null){let d=r[2];if(!V(I(r[1],"role"))&&!/<th\b/i.test(d))s.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"});r=m.exec(e)}let w=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;r=w.exec(e);while(r!==null){if(!/\bmuted\b/i.test(r[0]))s.push({type:"autoplay-audio",element:`<${r[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"});r=w.exec(e)}let h=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;r=h.exec(e);while(r!==null)s.push({type:"positive-tabindex",element:`tabindex="${r[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"}),r=h.exec(e);let b=/<iframe\s+([^>]*)>/gi;r=b.exec(e);while(r!==null){let d=r[1];if(!/\btitle\s*=/i.test(d)&&!/\baria-label\s*=/i.test(d))s.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"});r=b.exec(e)}let y=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;r=y.exec(e);while(r!==null){let d=r[1].toLowerCase(),x=r[2];if(d!=="button"&&!/\btabindex\s*=/i.test(x))s.push({type:"button-not-focusable",element:r[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/"});r=y.exec(e)}return s}async function we(e,a){let{protectedSource:s}=ye(e);if(!he())return xe(s,a);let n=[];try{let r=globalThis.document.createElement("div");r.innerHTML=s,r.querySelectorAll("img").forEach((o)=>{if(!o.hasAttribute("alt"))n.push({type:"missing-alt",element:`<${o.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),r.querySelectorAll('button, a, [role="button"]').forEach((o)=>{if(!(o.hasAttribute("aria-label")||o.hasAttribute("aria-labelledby")||o.textContent&&o.textContent.trim().length>0))n.push({type:"missing-accessible-name",element:`<${o.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/"})}),r.querySelectorAll("input, select, textarea").forEach((o)=>{let g=o.getAttribute("id"),f=g&&r.querySelector(`label[for="${g}"]`),p=o.hasAttribute("aria-label")||o.hasAttribute("aria-labelledby"),m=o.closest("label")!==null;if(!f&&!p&&!m)n.push({type:"input-missing-label",element:`<${o.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 l=Array.from(r.querySelectorAll("h1, h2, h3, h4, h5, h6")),c=0;for(let o of l){let g=Number.parseInt(o.tagName.charAt(1));if(c>0&&g>c+1)n.push({type:"heading-skip",element:`<${o.outerHTML}>`,message:`Heading level skipped from h${c} to h${g}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});c=g}let u=r.querySelector("html");if(s.includes("<html")&&u&&!u.hasAttribute("lang"))n.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(u&&q(u.getAttribute("lang"),u.getAttribute("dir")))n.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(r.querySelectorAll("a").forEach((o)=>{let g=o.textContent&&o.textContent.trim().length>0,f=o.hasAttribute("aria-label")||o.hasAttribute("aria-labelledby"),p=o.hasAttribute("title"),m=o.querySelector("img[alt]");if(!g&&!f&&!p&&!m)n.push({type:"link-missing-text",element:`<${o.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"})}),s.includes("<nav")||s.includes("<header")){if(!r.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&r.querySelectorAll("a").length>5)n.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(r.querySelectorAll("table").forEach((o)=>{if(V(o.getAttribute("role")))return;let g=o.querySelector("caption");if(!o.querySelector("th"))n.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(!g&&!o.hasAttribute("aria-label")&&!o.hasAttribute("aria-labelledby"))n.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"})}),r.querySelectorAll('[style*="color"]').forEach((o)=>{let g=o.getAttribute("style")||"";if(g.includes("color:")&&!g.includes("background"))n.push({type:"potential-contrast-issue",element:`<${o.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/"})}),r.querySelectorAll("video[autoplay], audio[autoplay]").forEach((o)=>{if(!o.hasAttribute("muted"))n.push({type:"autoplay-audio",element:`<${o.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"})}),r.querySelectorAll("[tabindex]").forEach((o)=>{if(Number.parseInt(o.getAttribute("tabindex")||"0")>0)n.push({type:"positive-tabindex",element:`<${o.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"})}),r.querySelectorAll('[role="button"]').forEach((o)=>{if(!o.hasAttribute("tabindex"))n.push({type:"button-not-focusable",element:`<${o.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/"})}),s.includes("<body")&&!r.querySelector('main, [role="main"]'))n.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"});r.querySelectorAll("iframe").forEach((o)=>{if(!o.hasAttribute("title")&&!o.hasAttribute("aria-label"))n.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(r){console.error(`Error checking accessibility in ${a}:`,r)}return n}async function Ti(e,a={}){let s={},{recursive:n=!0,ignorePaths:r=[]}=a,l=Array.isArray(e)?e:[e],c=await Ps(l,{recursive:n,ignorePaths:r}),u=[];for(let o of c)try{let g=await Bun.file(o).text();if(o.endsWith("good-a11y.stx"))continue;let f=await we(g,o);if(u.push(o),f.length>0)s[o]=f}catch(g){console.error(`Error scanning ${o}:`,g)}return{results:s,scannedFiles:u}}var $i={name:"a11y",handler:(e,a,s,n)=>{if(!a.length)return e;let r=a[0].replace(/['"]/g,""),l=a.length>1?a[1].replace(/['"]/g,""):"",u={"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"}[r]||"Make this element accessible";return`<!-- a11y-hint: ${l||u} -->${e}`},hasEndTag:!1},Ri={name:"screenReader",handler:(e)=>`<span class="sr-only">${e}</span>`,hasEndTag:!0};
|
|
4
4
|
export{_i,Ei,Ti,$i,Ri};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{yn,Os}from"./chunk-
|
|
2
|
+
import{yn,Os}from"./chunk-2943qhdt.js";import"./chunk-vkc51n9m.js";export{Os as generateRuntimeConfigTypes,yn as prepareRuntimeConfig};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import l from"fs";import u from"path";var m=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^<>()]*>)?\s*\(/,g=/(?:^|\n)\s*(?:import|export)\s+(?:[^'"]*?\sfrom\s+)?['"](\.[^'"]*)['"]/g,b=["",".ts",".tsx",".js",".jsx",".mts",".mjs","/index.ts","/index.js"],x=3;function h(e,t){let r=u.resolve(u.dirname(t),e);for(let o of b){let s=r+o;try{if(l.statSync(s).isFile())return s}catch{}}return null}function $n(e,t,r=0,o=new Set){if(!t||r>=x)return!1;for(let s of e.matchAll(g)){let n=h(s[1],t);if(!n||o.has(n))continue;o.add(n);let i;try{i=l.readFileSync(n,"utf8")}catch{continue}if(m.test(i))return!0;if($n(i,n,r+1,o))return!0}return!1}var y=["batch","cachedQuery","clearServerData","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","flushKeptState","forgetKeptState","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","keptState","memo","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refDebounced","refresh","registerStoresClient","setKeptScope","setRouteParams","sharedRequest","state","untrack","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebounceFn","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","useThrottleFn","useTimeout","useTimeoutFn","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],Hi=["onMount","onDestroy"];function Nt(e="const",t=[],r){let o=t.length?y.filter((s)=>!t.includes(s)):y;if(r!==void 0)o=o.filter((s)=>{let n=s.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${n}(?![\\w$])`).test(r)});return`${e} { ${o.join(", ")} } = window.stx;`}var E=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"];var S=y.filter((e)=>!E.includes(e));function qs(e){if(!e)return!1;return S.some((t)=>new RegExp(`\\b${t}\\s*(?:<[^>]*>)?\\s*\\(`).test(e))}var v=[/@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/],T=/\s@[a-z][\w.:-]*\s*=/i;function Ui(e,t){if(!e)return!1;let r=f(e);return d(r,t)}function d(e,t){if(v.some((r)=>r.test(e)))return!0;if(qs(e))return!0;return R(e,t)}function R(e,t){if(!t)return!1;for(let r of e.matchAll(/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script\s*>/gi))if($n(r[1],t))return!0;return!1}function Vi(e,t){if(!e)return!1;let r=f(e);return T.test(r)||d(r,t)}var _=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];function Wi(e){return _.includes(e.toLowerCase())}var
|
|
3
|
-
export{$n,y,Hi,Nt,qs,Ui,Vi,Wi,
|
|
2
|
+
import l from"fs";import u from"path";var m=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^<>()]*>)?\s*\(/,g=/(?:^|\n)\s*(?:import|export)\s+(?:[^'"]*?\sfrom\s+)?['"](\.[^'"]*)['"]/g,b=["",".ts",".tsx",".js",".jsx",".mts",".mjs","/index.ts","/index.js"],x=3;function h(e,t){let r=u.resolve(u.dirname(t),e);for(let o of b){let s=r+o;try{if(l.statSync(s).isFile())return s}catch{}}return null}function $n(e,t,r=0,o=new Set){if(!t||r>=x)return!1;for(let s of e.matchAll(g)){let n=h(s[1],t);if(!n||o.has(n))continue;o.add(n);let i;try{i=l.readFileSync(n,"utf8")}catch{continue}if(m.test(i))return!0;if($n(i,n,r+1,o))return!0}return!1}var y=["batch","cachedQuery","clearServerData","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","flushKeptState","forgetKeptState","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","keptState","memo","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refDebounced","refresh","registerStoresClient","setKeptScope","setRouteParams","sharedRequest","state","untrack","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebounceFn","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","useThrottleFn","useTimeout","useTimeoutFn","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],Hi=["onMount","onDestroy"];function Nt(e="const",t=[],r){let o=t.length?y.filter((s)=>!t.includes(s)):y;if(r!==void 0)o=o.filter((s)=>{let n=s.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${n}(?![\\w$])`).test(r)});return`${e} { ${o.join(", ")} } = window.stx;`}var E=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"];var S=y.filter((e)=>!E.includes(e));function qs(e){if(!e)return!1;return S.some((t)=>new RegExp(`\\b${t}\\s*(?:<[^>]*>)?\\s*\\(`).test(e))}var v=[/@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/],T=/\s@[a-z][\w.:-]*\s*=/i;function Ui(e,t){if(!e)return!1;let r=f(e);return d(r,t)}function d(e,t){if(v.some((r)=>r.test(e)))return!0;if(qs(e))return!0;return R(e,t)}function R(e,t){if(!t)return!1;for(let r of e.matchAll(/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script\s*>/gi))if($n(r[1],t))return!0;return!1}function Vi(e,t){if(!e)return!1;let r=f(e);return T.test(r)||d(r,t)}var _=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];function Wi(e){return _.includes(e.toLowerCase())}var yr=["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"],w=["x-init","x-transition","x-effect","x-on"],qi=[...yr,...w];function Gi(){return`{${yr.map((e)=>`'${e}':1`).join(",")}}`}var Gs=["class","style","text","html","show","model","if","ref"];function Ki(){return`{${Gs.map((e)=>e==="if"?"'if':1":`${e}:1`).join(",")}}`}var p=["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 Xi(){return`/^(${p.join("|")})(?:\\.|$)/`}function Ji(e){return p.some((t)=>e===t||e.startsWith(`${t}.`))}var A=65536,N=4,c=new Map;function f(e){if(!e)return e;if(!e.includes("<!--")&&!/<(?:pre|code)\b/i.test(e))return e;let t=e.length>=A;if(t){let s=c.get(e);if(s!==void 0)return s}let r=(s)=>s.replace(/(<[^>]*>)|([^<]+)/g,(n,i,a)=>i??" ".repeat(a.length)),o=e.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/<!--[\s\S]*?-->/g,(s)=>" ".repeat(s.length));if(t){while(c.size>=N){let s=c.keys().next();if(s.done)break;c.delete(s.value)}c.set(e,o)}return o}
|
|
3
|
+
export{$n,y,Hi,Nt,qs,Ui,Vi,Wi,yr,qi,Gi,Gs,Ki,Xi,Ji};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Rl}from"./chunk-ycj0342k.js";import"./chunk-n4e02qdz.js";import"./chunk-dm1qh2vq.js";import"./chunk-ah9xyss2.js";import"./chunk-sv08pd66.js";import"./chunk-2943qhdt.js";import"./chunk-vkc51n9m.js";import"./chunk-02qaqamv.js";import"./chunk-6m3me7yj.js";import"./chunk-dhq80e4r.js";import"./chunk-vpdx7qr3.js";import"./chunk-dvc15djp.js";import"./chunk-x552npae.js";import"./chunk-qdyp2zqf.js";export{Rl as buildApp};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import m from"path";var y=/__stxModules\["((?:[^"\\]|\\.)*)"\]/g;function I(...o){let r=new Set;for(let s of o){if(!s||!s.includes("__stxModules["))continue;for(let e of s.matchAll(y))try{r.add(JSON.parse(`"${e[1]}"`))}catch{}}return[...r].sort()}async function w(o,r={}){if(o.length===0)return null;let s=process.cwd(),e=[],a=[];o.forEach((t,c)=>{let i=t.startsWith("npm:")?t.slice(4):m.resolve(s,t),l=`__stxRegistered${c}`,p=JSON.stringify(t);e.push(`import * as ${l} from ${JSON.stringify(i)};`),a.push(`if (!globalThis.__stxModules[${p}]) globalThis.__stxModules[${p}] = ${l};`)});let d=[...e,"globalThis.__stxModules = globalThis.__stxModules || {};",...a].join(`
|
|
3
|
-
`),n;try{let{bundleClientScript:t}=await import("./chunk-
|
|
3
|
+
`),n;try{let{bundleClientScript:t}=await import("./chunk-cxqrwvc5.js");n=await t(d,m.join(s,".stx-module-registry.ts"),{projectRoot:s,minify:r.minify,externalizeUserModules:!1,collectInputs:r.collectInputs,throwOnFailure:!0})}catch(t){let{formatBuildFailure:c}=await import("./chunk-wgkxgsqx.js"),i=c(t);console.warn(`[stx] could not build the page module registry (#1957): ${i}`);let l=`[stx] the page module registry did not build, so ${o.join(", ")} cannot load (#1957): ${i}`;return`;console.error(${JSON.stringify(l)});`}let{transformAutoImports:f,generateAutoImportDestructuring:_}=await import("./chunk-agfhb2qd.js"),u=f(n),h=_(u.stxImports,u.browserImports),{transformStoreImports:x}=await import("./chunk-mhjwtkx9.js");n=x(u.code);let g=JSON.stringify(new Bun.CryptoHasher("md5").update(d).digest("hex").slice(0,12));return[";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${g}]) return;`,` __stxBundles[${g}] = true;`,h,n,"})();"].join(`
|
|
4
4
|
`)}export{w as buildModuleRegistryScript,I as registeredModuleIdsIn};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Broadcast as s,BroadcastServer as h}from"ts-broadcasting";import{channel as El}from"ts-broadcasting";import{Broadcast as Tl,BroadcastServer as $l}from"ts-broadcasting";var e=null,u=[];function bl(){return e}async function
|
|
3
|
-
export{bl,wl,
|
|
2
|
+
import{Broadcast as s,BroadcastServer as h}from"ts-broadcasting";import{channel as El}from"ts-broadcasting";import{Broadcast as Tl,BroadcastServer as $l}from"ts-broadcasting";var e=null,u=[];function bl(){return e}async function vl(n){if(e)return e;let t=n.driver??"bun",r=n.host??"0.0.0.0",c=n.port??6001,l=n.scheme??"ws",a={verbose:n.verbose??!1,driver:t,default:t,connections:{[t]:{driver:t,host:r,port:c,scheme:l}}};return e=new h(a),s.setServer(e),await e.start(),e}async function wl(){for(let n of u)clearInterval(n);if(u.length=0,!e)return;await e.stop(),e=null}async function xl(n){let t=await import(n),r=t.default??t;if(typeof r!=="function")throw Error(`routes/channels.ts must export a default function, got ${typeof r}`);let c=0;return r({channel(a,o){if(c++,o.authorize&&e)e.channels.channel(a,o.authorize);if(o.interval&&o.data){let d=o.event??`${a}.updated`,p=o.data,v=setInterval(async()=>{try{let g=await p();ma(a,d,g)}catch{}},o.interval);u.push(v)}}}),c}var f=!1;function i(){if(e)return!0;if(!f)f=!0,console.warn("[stx] broadcast() called before server started \u2014 messages will be sent once broadcasting is ready");return!1}function ma(n,t,r){if(!i())return;s.send(n,t,r)}function Sl(n,t,r){if(!i())return;s.toUser(n,t,r)}function kl(n,t,r){if(!i())return;s.toUsers(n,t,r)}function Cl(n,t,r){if(!i())return;s.send(`private-${n}`,t,r)}function _l(n,t,r){if(!i())return;s.presence(n,t,r)}
|
|
3
|
+
export{bl,vl,wl,xl,ma,Sl,kl,Cl,_l,El,Tl,$l};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Fe,hc,qu,Gu,Ku,Xu,yc,bc,Ju,Yu,ri,Zu,un,dn,Xn}from"./chunk-n4e02qdz.js";import"./chunk-dm1qh2vq.js";import"./chunk-ah9xyss2.js";import"./chunk-sv08pd66.js";import"./chunk-2943qhdt.js";import"./chunk-vkc51n9m.js";import"./chunk-02qaqamv.js";import"./chunk-6m3me7yj.js";import"./chunk-dhq80e4r.js";import"./chunk-vpdx7qr3.js";import"./chunk-dvc15djp.js";import"./chunk-x552npae.js";import"./chunk-qdyp2zqf.js";export{Xu as __setSignalsGeneratorsForTest,Fe as cacheEngineFingerprint,dn as cacheTemplate,un as checkCache,Zu as clearDevCaches,bc as getCachedRouterScript,yc as getCachedSignalsRuntime,Ju as getServeClientAsset,ri as getServeModuleBundle,Xn as hashFilePath,Gu as invalidateFileCache,Ku as invalidateFileCacheByDir,qu as readFileCached,Yu as registerServeModuleBundle,hc as templateCache};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function c(i){if(!i.startsWith("/")||/[?#\\]/.test(i))throw Error(`Invalid route rule pattern: ${i}`);let t=i==="/"?[]:i.slice(1).split("/");if(t.some((r,e)=>!r||r.includes("*")&&r!=="*"&&r!=="**"||r==="**"&&e!==t.length-1||r.startsWith(":")&&!/^:[\w]+$/.test(r)))throw Error(`Unsupported route rule pattern: ${i}`);return t}function
|
|
3
|
-
export{
|
|
2
|
+
function c(i){if(!i.startsWith("/")||/[?#\\]/.test(i))throw Error(`Invalid route rule pattern: ${i}`);let t=i==="/"?[]:i.slice(1).split("/");if(t.some((r,e)=>!r||r.includes("*")&&r!=="*"&&r!=="**"||r==="**"&&e!==t.length-1||r.startsWith(":")&&!/^:[\w]+$/.test(r)))throw Error(`Unsupported route rule pattern: ${i}`);return t}function Mr(i){for(let[t,r]of Object.entries(i)){if(c(t),!r||typeof r!=="object"||Object.keys(r).some((e)=>e!=="rendering"&&e!=="cache"))throw Error(`Unsupported route rule for ${t}`);if(r.rendering!==void 0&&r.rendering!=="prerender"&&r.rendering!=="dynamic")throw Error(`Unsupported rendering mode for ${t}`);if(r.cache!==void 0&&r.cache!==!1){let e=r.cache;if(!e||e.public!==!0||Object.keys(e).some((n)=>!["public","maxAge","swr"].includes(n))||!Number.isFinite(e.maxAge)||e.maxAge<=0||e.swr!==void 0&&(!Number.isFinite(e.swr)||e.swr<0))throw Error(`Route cache for ${t} requires public: true, maxAge > 0 and swr >= 0`);if(r.rendering==="prerender")throw Error(`Prerendered route ${t} cannot revalidate; use dynamic rendering with cache`)}}}function Ft(i={}){Mr(i);let t=(e)=>e==="**"?0:e==="*"?1:e.startsWith(":")?2:3,r=Object.entries(i).map(([e,n])=>({pattern:e,parts:c(e),rule:n}));return r.sort((e,n)=>{for(let o=0;o<Math.max(e.parts.length,n.parts.length);o++){let s=(n.parts[o]===void 0?4:t(n.parts[o]))-(e.parts[o]===void 0?4:t(e.parts[o]));if(s)return s}return e.pattern.localeCompare(n.pattern)}),(e)=>{let n=e==="/"?[]:e.replace(/\/$/,"").slice(1).split("/");return r.find(({parts:o})=>o.every((s,u)=>s==="**"||n[u]!==void 0&&(s==="*"||s.startsWith(":")||s===n[u]))&&(o.at(-1)==="**"||o.length===n.length))?.rule??{}}}
|
|
3
|
+
export{Mr,Ft};
|