@stacksjs/stx 0.2.415 → 0.2.417
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-072f6hnz.js +2 -0
- package/dist/{chunk-0zaess6f.js → chunk-072mzamc.js} +5 -5
- package/dist/{chunk-q9bdh4s5.js → chunk-08p07eq7.js} +2 -2
- package/dist/chunk-0x076wz1.js +2 -0
- package/dist/{chunk-xfp7k0v8.js → chunk-0xgf3xgy.js} +16 -16
- package/dist/chunk-1680nbq4.js +2816 -0
- package/dist/{chunk-9g27ybyr.js → chunk-25n4gmek.js} +2 -2
- package/dist/chunk-2gfj59pt.js +2 -0
- package/dist/chunk-2gntnw7e.js +2 -0
- package/dist/chunk-2hvvwhmv.js +2 -0
- package/dist/{chunk-m4sk62wb.js → chunk-31a8eh0j.js} +4 -4
- package/dist/{chunk-t4hzprsm.js → chunk-3aqe7wy7.js} +2 -2
- package/dist/{chunk-ej9j6k1q.js → chunk-3f5td68v.js} +2 -2
- package/dist/chunk-3senpdjt.js +3 -0
- package/dist/{chunk-5qns2sdz.js → chunk-3wmxb126.js} +2 -2
- package/dist/{chunk-ft4p6d28.js → chunk-47h689h6.js} +2 -2
- package/dist/chunk-4bhertga.js +2 -0
- package/dist/chunk-4s9dypby.js +2 -0
- package/dist/{chunk-s5xezjps.js → chunk-5f3k2mke.js} +1 -1
- package/dist/{chunk-r3f9jcf7.js → chunk-5fwy3xap.js} +3 -3
- package/dist/{chunk-g186znp9.js → chunk-5vzamjf6.js} +4 -4
- package/dist/chunk-5z56g0n4.js +2 -0
- package/dist/chunk-68rq2fqt.js +12 -0
- package/dist/chunk-6ad0nseq.js +2 -0
- package/dist/{chunk-czxt605c.js → chunk-76japd6k.js} +4 -4
- package/dist/chunk-7eazcxzf.js +2 -0
- package/dist/chunk-7hy29tcy.js +2 -0
- package/dist/{chunk-ngc2wke4.js → chunk-7q1yy18q.js} +2 -2
- package/dist/{chunk-thyt8ed8.js → chunk-85bm5xrm.js} +3 -3
- package/dist/{chunk-7gkv67ky.js → chunk-865xvpp2.js} +2 -2
- package/dist/chunk-8fyqbq14.js +2 -0
- package/dist/chunk-92xzpt6p.js +2 -0
- package/dist/{chunk-96k8s808.js → chunk-94ky725r.js} +2 -2
- package/dist/{chunk-fh1qrp68.js → chunk-9af8qbwb.js} +5 -5
- package/dist/{chunk-j03revz2.js → chunk-9bq4w4d6.js} +3 -3
- package/dist/chunk-9kmmafp4.js +2 -0
- package/dist/{chunk-vgvtnwxa.js → chunk-9r5ycpdg.js} +3 -3
- package/dist/{chunk-gawrg4gb.js → chunk-9yt899e7.js} +6 -6
- package/dist/chunk-atgwc7r7.js +2 -0
- package/dist/{chunk-a688m6js.js → chunk-ayd5r3se.js} +2 -2
- package/dist/{chunk-ce1sejr3.js → chunk-bk5ndwv3.js} +2 -2
- package/dist/chunk-bs6y5wy2.js +2 -0
- package/dist/{chunk-y5310237.js → chunk-bt11a8z4.js} +3 -3
- package/dist/{chunk-amd6ey3t.js → chunk-c8p4v1rd.js} +5 -5
- package/dist/chunk-ccg6xjr1.js +2 -0
- package/dist/chunk-ckv4aty5.js +2 -0
- package/dist/{chunk-mp6hy8g4.js → chunk-d0ynfema.js} +1 -1
- package/dist/chunk-d6h9rpm4.js +30 -0
- package/dist/chunk-dbh7h0kt.js +2 -0
- package/dist/chunk-dhqkg0ph.js +2 -0
- package/dist/{chunk-h6zsqb9r.js → chunk-dw961rvn.js} +2 -2
- package/dist/{chunk-340a824p.js → chunk-dym1eteb.js} +1 -1
- package/dist/{chunk-ak1cgcah.js → chunk-e2m674vf.js} +4 -4
- package/dist/{chunk-169n1vpx.js → chunk-e83j8xe9.js} +4 -4
- package/dist/chunk-ettat5ah.js +2 -0
- package/dist/{chunk-6hc5vz20.js → chunk-ev8bhsc0.js} +2 -2
- package/dist/chunk-f4ws0qcd.js +2 -0
- package/dist/chunk-f97v10zr.js +2 -0
- package/dist/chunk-fe5st320.js +2 -0
- package/dist/chunk-fet3hce8.js +2 -0
- package/dist/chunk-fq7128p1.js +2 -0
- package/dist/{chunk-x0q32ees.js → chunk-fr8jq2ys.js} +2 -2
- package/dist/chunk-fwy2h1ms.js +2 -0
- package/dist/{chunk-shr559s7.js → chunk-fxhvkenf.js} +2 -2
- package/dist/{chunk-6h38kkjf.js → chunk-g947brd0.js} +6 -6
- package/dist/{chunk-tafqyf2g.js → chunk-gfm7g98y.js} +95 -95
- package/dist/chunk-gtkhykc4.js +2 -0
- package/dist/{chunk-y1cmjvk3.js → chunk-h8f18cc5.js} +6 -6
- package/dist/chunk-h8pkm7c5.js +2 -0
- package/dist/{chunk-hkrmcbwy.js → chunk-hg3tyzn5.js} +11 -11
- package/dist/{chunk-ym95v4nc.js → chunk-hkxxfzfd.js} +2 -2
- package/dist/{chunk-b84h16er.js → chunk-hm2k9a04.js} +7 -7
- package/dist/chunk-hneg0155.js +2 -0
- package/dist/chunk-hs90en70.js +2 -0
- package/dist/{chunk-v91p6ekp.js → chunk-jfjym18d.js} +5 -5
- package/dist/chunk-jgsgd6rt.js +17 -0
- package/dist/chunk-jn3njpxs.js +2 -0
- package/dist/chunk-ka8x4sw6.js +18 -0
- package/dist/{chunk-8eqrwj1k.js → chunk-kds79hq3.js} +11 -11
- package/dist/{chunk-9vrja6vp.js → chunk-kkj5x9rp.js} +1 -1
- package/dist/chunk-mcqn70v8.js +3 -0
- package/dist/chunk-mcs7p3fy.js +2 -0
- package/dist/{chunk-hepd9qgx.js → chunk-mj6fme15.js} +5 -5
- package/dist/{chunk-yazk54jr.js → chunk-mj9yv1vb.js} +1 -1
- package/dist/chunk-mmtg0jxd.js +2 -0
- package/dist/chunk-mrsxwd0h.js +2 -0
- package/dist/chunk-mscky0ww.js +2 -0
- package/dist/chunk-mtphm33a.js +2 -0
- package/dist/chunk-p2jbc71s.js +2 -0
- package/dist/{chunk-fr2txj8q.js → chunk-pb0fgdvn.js} +4 -4
- package/dist/{chunk-amtr3rmf.js → chunk-psmdbcbc.js} +4 -4
- package/dist/chunk-pvd9k3kx.js +2 -0
- package/dist/chunk-pz1jc3db.js +2 -0
- package/dist/chunk-q8swb7na.js +4 -0
- package/dist/{chunk-3kthfs03.js → chunk-qmzwhtr2.js} +2 -2
- package/dist/chunk-qvr6e2ve.js +3 -0
- package/dist/chunk-ra0pkkvd.js +2 -0
- package/dist/chunk-rcbtd4w3.js +2 -0
- package/dist/chunk-rd2r9jvn.js +2 -0
- package/dist/chunk-s8srb8bg.js +2 -0
- package/dist/{chunk-md8rqn48.js → chunk-sjjc670z.js} +9 -9
- package/dist/chunk-snf2b68p.js +2 -0
- package/dist/chunk-t2bfwr9v.js +2 -0
- package/dist/chunk-tbmwdahm.js +2 -0
- package/dist/{chunk-qghxz7jm.js → chunk-v15g9jjh.js} +6 -6
- package/dist/{chunk-8nhshfz6.js → chunk-vdqa5gt7.js} +2 -2
- package/dist/{chunk-9amp82bx.js → chunk-vepc9rbt.js} +2 -2
- package/dist/{chunk-eed4fwps.js → chunk-vfdwvt23.js} +2 -2
- package/dist/chunk-vpv896zx.js +2 -0
- package/dist/{chunk-bay9s6rs.js → chunk-vyfg2qd2.js} +5 -5
- package/dist/{chunk-9pt8fd2n.js → chunk-w5zmvn7b.js} +3 -3
- package/dist/chunk-w6h63b48.js +2 -0
- package/dist/{chunk-pgzvyrv6.js → chunk-wgzxmh7w.js} +3 -3
- package/dist/{chunk-jnkrn913.js → chunk-wpkxbggq.js} +1 -1
- package/dist/chunk-wrk3gkgg.js +2 -0
- package/dist/chunk-wtd71jsa.js +2 -0
- package/dist/{chunk-z0g9jvv0.js → chunk-wweasgq9.js} +18 -18
- package/dist/chunk-wymf1ek6.js +2 -0
- package/dist/chunk-wz8hyh8h.js +4 -0
- package/dist/chunk-x32wpjs0.js +2 -0
- package/dist/chunk-x4q2eyt0.js +2 -0
- package/dist/chunk-x95ejws0.js +2 -0
- package/dist/chunk-xket8ejt.js +2 -0
- package/dist/{chunk-pbh4smw3.js → chunk-xt6d3zws.js} +4 -4
- package/dist/{chunk-752hw7cd.js → chunk-xvn3sv3v.js} +3 -3
- package/dist/{chunk-tfexmdkt.js → chunk-xwkdv585.js} +2 -2
- package/dist/{chunk-765e1s44.js → chunk-y9t55tv7.js} +6 -6
- package/dist/chunk-ypfzy1mq.js +2 -0
- package/dist/{chunk-9p9qkbtg.js → chunk-yrbzsrde.js} +2 -2
- package/dist/chunk-zg68pwy8.js +2 -0
- package/dist/chunk-zs58fnme.js +2 -0
- package/dist/chunk-zy3p0vmx.js +3 -0
- package/dist/cli.js +21 -21
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/dev-server/serve-app.js +3 -0
- package/dist/dev-server/serve-multi.js +1 -1
- package/dist/dev-server/ts-css.d.ts +11 -0
- package/dist/dev-server/ts-css.js +13 -1
- package/dist/document-shell.js +15 -3
- package/dist/native/components/primitives.d.ts +2 -0
- package/dist/production-server.js +4 -4
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +17 -17
- package/package.json +5 -5
- package/dist/chunk-020xyn9q.js +0 -3
- package/dist/chunk-04jhmfbz.js +0 -2
- package/dist/chunk-0pnj3zt2.js +0 -2
- package/dist/chunk-1098mas0.js +0 -2
- package/dist/chunk-18vmfkcc.js +0 -2
- package/dist/chunk-1b6t12hd.js +0 -2
- package/dist/chunk-1zs30k3y.js +0 -2
- package/dist/chunk-2ce7f416.js +0 -2
- package/dist/chunk-393341w7.js +0 -2
- package/dist/chunk-39g1134q.js +0 -2
- package/dist/chunk-3efw27as.js +0 -2785
- package/dist/chunk-3qn1wcdg.js +0 -2
- package/dist/chunk-3s2vnqcf.js +0 -2
- package/dist/chunk-42wbs8vq.js +0 -17
- package/dist/chunk-4bjravgk.js +0 -2
- package/dist/chunk-5gsxpaqk.js +0 -2
- package/dist/chunk-6cfa3g0r.js +0 -2
- package/dist/chunk-7z2ra0yf.js +0 -2
- package/dist/chunk-92ps1xpk.js +0 -2
- package/dist/chunk-9xrbve19.js +0 -2
- package/dist/chunk-atws6p5s.js +0 -2
- package/dist/chunk-b98be3yp.js +0 -32
- package/dist/chunk-dd8cja4h.js +0 -2
- package/dist/chunk-dgdm3hy3.js +0 -2
- package/dist/chunk-e9hs7kk6.js +0 -12
- package/dist/chunk-et0rr8c7.js +0 -3
- package/dist/chunk-f1sxycmv.js +0 -2
- package/dist/chunk-f46qsp4m.js +0 -4
- package/dist/chunk-fbcv4fes.js +0 -2
- package/dist/chunk-fjs0a8h7.js +0 -2
- package/dist/chunk-fpfzm238.js +0 -2
- package/dist/chunk-fyzajkrx.js +0 -2
- package/dist/chunk-fzapbw9p.js +0 -3
- package/dist/chunk-g03s93qr.js +0 -3
- package/dist/chunk-gc1drn2p.js +0 -2
- package/dist/chunk-gea5hf0v.js +0 -2
- package/dist/chunk-gqv3ta5d.js +0 -2
- package/dist/chunk-h6kp2m9r.js +0 -2
- package/dist/chunk-hbxz85wy.js +0 -2
- package/dist/chunk-hhnw2sn3.js +0 -2
- package/dist/chunk-hjg3ndgh.js +0 -2
- package/dist/chunk-hk1mj4tz.js +0 -2
- package/dist/chunk-hn9pkyv8.js +0 -2
- package/dist/chunk-hpgr4qgp.js +0 -2
- package/dist/chunk-hrbbbtbn.js +0 -2
- package/dist/chunk-j9qcrwbg.js +0 -2
- package/dist/chunk-jk4njz0w.js +0 -2
- package/dist/chunk-jmabeqfq.js +0 -2
- package/dist/chunk-jp10q90g.js +0 -2
- package/dist/chunk-jt0n43mk.js +0 -2
- package/dist/chunk-kjbv8a3m.js +0 -2
- package/dist/chunk-m1vdghnx.js +0 -2
- package/dist/chunk-nc8my58s.js +0 -2
- package/dist/chunk-nn2vstke.js +0 -2
- package/dist/chunk-nppdrf0x.js +0 -2
- package/dist/chunk-p2v2a68k.js +0 -2
- package/dist/chunk-pazfr1a1.js +0 -2
- package/dist/chunk-pdb5fw3r.js +0 -2
- package/dist/chunk-pdt69hpb.js +0 -2
- package/dist/chunk-px7fvbj6.js +0 -3
- package/dist/chunk-q6vrb2pe.js +0 -2
- package/dist/chunk-q7qchkvk.js +0 -2
- package/dist/chunk-re8b5r9x.js +0 -3
- package/dist/chunk-sd321bn3.js +0 -2
- package/dist/chunk-t5pvq5mx.js +0 -2
- package/dist/chunk-w72qx0eb.js +0 -2
- package/dist/chunk-wfy1zq53.js +0 -30
- package/dist/chunk-wzx0164n.js +0 -18
- package/dist/chunk-xtvf6n6f.js +0 -4
- package/dist/chunk-xwzvfqcb.js +0 -2
- package/dist/chunk-ydjfar14.js +0 -2
- package/dist/chunk-z23kaxq6.js +0 -2
- package/dist/chunk-z8xn5ta3.js +0 -2
|
@@ -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 hr(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 At(i={}){hr(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{hr,At};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{t,
|
|
3
|
-
`:u==="t"?"\t":u;continue}if(i===n)return null;if(n==="`"&&i==="$"&&r[
|
|
4
|
-
`)}function
|
|
5
|
-
`,"")),headContent:r.trim()}}function
|
|
2
|
+
import{t,o,cn,ks,ve,l}from"./chunk-wweasgq9.js";import T from"path";function w(e,r,n,s=0){let a=0,i=s,u=null,c=0,p=!1;while(i<e.length){let h=e[i];if(u&&p){p=!1,i++;continue}if(u&&h==="\\"){p=!0,i++;continue}if(p=!1,(h==='"'||h==="'"||h==="`")&&!u){u=h,i++;continue}if(h===u&&u!=="`"){u=null,i++;continue}if(u==="`"&&h==="$"&&e[i+1]==="{"){c++,i+=2;continue}if(c>0&&h==="}"){c--,i++;continue}if(h==="`"&&u==="`"&&c===0){u=null,i++;continue}if(u){i++;continue}if(h===r)a++;else if(h===n){if(a--,a===0)return i}i++}return-1}function vs(e,r){let n=[];r.lastIndex=0;let s;while((s=r.exec(e))!==null){let a=s.index,i=a+s[0].length-1,u=w(e,"(",")",i);if(u===-1){n.push({start:a,end:-1,args:"",call:e.slice(a,Math.min(e.length,a+80))}),r.lastIndex=i+1;continue}n.push({start:a,end:u+1,args:e.slice(i+1,u),call:e.slice(a,u+1)}),r.lastIndex=u+1}return n}function qe(e,r,n,s){let a="",i=0;for(let u of vs(e,r)){if(a+=e.slice(i,u.start),u.end===-1){a+=s(u.call),i=u.start;continue}a+=n(u.args,u.call),i=u.end}return a+e.slice(i)}function Xe(e){let r=[],n=0,s=null,a="";for(let i=0;i<e.length;i++){let u=e[i];if(s){if(a+=u,u==="\\"&&i+1<e.length){a+=e[++i];continue}if(u===s)s=null;continue}if(u==="'"||u==='"'||u==="`")s=u;else if(u==="("||u==="["||u==="{")n++;else if(u===")"||u==="]"||u==="}")n--;else if(u===","&&n===0){r.push(a.trim()),a="";continue}a+=u}if(a.trim())r.push(a.trim());return r}function y(e){let r=e.trim(),n=r[0];if(n!=="'"&&n!=='"'&&n!=="`"||r.length<2||r.at(-1)!==n)return null;let s="";for(let a=1;a<r.length-1;a++){let i=r[a];if(i==="\\"&&a+1<r.length-1){let u=r[++a];s+=u==="n"?`
|
|
3
|
+
`:u==="t"?"\t":u;continue}if(i===n)return null;if(n==="`"&&i==="$"&&r[a+1]==="{")return null;s+=i}return s}var b=new Set(["true","false","null","undefined","typeof","void","new","in","of","instanceof","this","delete","await","async","function","return","NaN","Infinity"]);function Ke(e,r){let n=e.trim();if(!n)return{ok:!1,message:"the argument is empty",code:t.INVALID_DIRECTIVE_SYNTAX};let s=cn(n);if(s)return{ok:!1,message:`the expression is not allowed (${s})`,code:t.UNSAFE_EXPRESSION};let a=ks(r),i;try{i=l(n,Object.keys(a))(...Object.values(a))}catch(c){return{ok:!1,message:`the expression could not be evaluated: ${c instanceof Error?c.message:String(c)}`,code:t.EVALUATION_ERROR}}if(i!==void 0&&i!==null)return{ok:!0,value:i};let u=[...new Set(ve(n))].filter((c)=>!b.has(c)&&!(c in a)&&!(c in globalThis));if(u.length>0)return{ok:!1,message:`${u.map((p)=>`"${p}"`).join(", ")} ${u.length===1?"is":"are"} not defined here. Values a directive reads must come from <script server> or the render context; a plain <script> runs in the browser. To pass literal text, quote it.`,code:t.UNDEFINED_VARIABLE};if(i===void 0&&(n.startsWith("{")||n.startsWith("[")))return{ok:!1,message:"the expression threw while it was evaluated",code:t.EVALUATION_ERROR};return{ok:!0,value:i}}function ue(e){if(e===null)return"null";if(Array.isArray(e))return"an array";if(typeof e==="object")return"an object";if(typeof e==="string")return`a string ("${e.length>40?`${e.slice(0,40)}...`:e}")`;return`${/^[aeiou]/.test(typeof e)?"an":"a"} ${typeof e}`}function be(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function v(e){if(!e)return"";return T.isAbsolute(e)?T.relative(process.cwd(),e)||e:e}function f(e){let r=e.replace(/\s+/g," ").trim();return r.length>80?`${r.slice(0,77)}...`:r}function k(e,r,n,s,a=t.EVALUATION_ERROR){let i=s?` in ${v(s)}`:"";return console.warn(`[stx] ${f(r)}${i}: ${n}`),o(e,`${f(r)}: ${n}`,a)}function Gn(e,r,n){let s=n?` in ${v(n)}`:"";console.warn(`[stx] ${f(e)}${s}: ${r}`)}var A=["og:","article:","book:","profile:","fb:","music:","video:"],E=/^[a-z][\w-]*(?::[\w:-]+)?$/i;function on(e,r){if(e.length<1)return{kind:"error",message:"meta directive requires at least the meta name",code:t.INVALID_DIRECTIVE_SYNTAX};if(e.length>2)return{kind:"error",message:`@meta takes a name and a value, got ${e.length} arguments`,code:t.INVALID_DIRECTIVE_SYNTAX};let n=I(e[0],r);if(typeof n!=="string")return n;let s;if(e.length===2){let i=S(e[1],r);if(typeof i!=="string")return i;s=i}else{let i=n.includes(":")?n.slice(n.indexOf(":")+1):n,u=r.openGraph,c=r[i]??(be(u)?u[i]:void 0);s=c===void 0||c===null||typeof c==="object"?"":String(c)}if(!s)return{kind:"empty"};return{kind:"tag",tag:A.some((i)=>n.startsWith(i))?{property:n,content:s}:{name:n,content:s}}}function I(e,r){let n=y(e);if(n!==null)return n.trim()?n:{kind:"error",message:"the meta name is empty",code:t.INVALID_DIRECTIVE_SYNTAX};if(E.test(e.trim()))return e.trim();let s=Ke(e,r);if(!s.ok)return{kind:"error",message:`meta name: ${s.message}`,code:s.code};if(typeof s.value!=="string"||!s.value.trim())return{kind:"error",message:`the meta name must be a non-empty string, got ${ue(s.value)}`,code:t.TYPE_ERROR};return s.value}function S(e,r){let n=y(e);if(n!==null)return n;let s=Ke(e,r);if(!s.ok)return{kind:"error",message:s.message,code:s.code};let a=s.value;if(a===void 0||a===null||a===!1)return"";if(Array.isArray(a))return a.filter((i)=>i!==void 0&&i!==null&&i!=="").map(String).join(", ");if(typeof a==="object"&&!(a instanceof Date))return{kind:"error",message:`the content must be text, got ${ue(a)}`,code:t.TYPE_ERROR};return String(a)}var d={},R=[],g={};function ws(){return d}function Bu(){return g}function Fu(){d={},R.length=0,g={}}function po(e){d=de(d,e)}function de(e,r){return{title:r.title??e.title,titleTemplate:r.titleTemplate??e.titleTemplate,base:r.base??e.base,meta:[...e.meta||[],...r.meta||[]],link:[...e.link||[],...r.link||[]],script:[...e.script||[],...r.script||[]],style:[...e.style||[],...r.style||[]],htmlAttrs:{...e.htmlAttrs,...r.htmlAttrs},bodyAttrs:{...e.bodyAttrs,...r.bodyAttrs}}}function vc(e){po(Jn(e))}function Jn(e){let r=[];if(e.description)r.push({name:"description",content:e.description});if(e.keywords){let p=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;r.push({name:"keywords",content:p})}if(e.author)r.push({name:"author",content:e.author});if(e.robots)r.push({name:"robots",content:e.robots});let n=e.ogTitle??e.title,s=e.ogDescription??e.description;if(n)r.push({property:"og:title",content:n});if(s)r.push({property:"og:description",content:s});if(e.ogImage){if(r.push({property:"og:image",content:e.ogImage}),e.ogImageType)r.push({property:"og:image:type",content:e.ogImageType});if(e.ogImageWidth)r.push({property:"og:image:width",content:String(e.ogImageWidth)});if(e.ogImageHeight)r.push({property:"og:image:height",content:String(e.ogImageHeight)});if(e.ogImageAlt)r.push({property:"og:image:alt",content:e.ogImageAlt})}if(e.ogUrl)r.push({property:"og:url",content:e.ogUrl});if(e.ogType)r.push({property:"og:type",content:e.ogType});if(e.ogSiteName)r.push({property:"og:site_name",content:e.ogSiteName});if(e.ogLocale)r.push({property:"og:locale",content:e.ogLocale});if(e.profileFirstName)r.push({property:"profile:first_name",content:e.profileFirstName});if(e.profileLastName)r.push({property:"profile:last_name",content:e.profileLastName});if(e.profileUsername)r.push({property:"profile:username",content:e.profileUsername});let a=e.twitterTitle??e.title,i=e.twitterDescription??e.description,u=e.twitterImage??e.ogImage;if(e.twitterCard)r.push({name:"twitter:card",content:e.twitterCard});if(a)r.push({name:"twitter:title",content:a});if(i)r.push({name:"twitter:description",content:i});if(u){r.push({name:"twitter:image",content:u});let p=e.twitterImageAlt??(e.twitterImage?void 0:e.ogImageAlt);if(p)r.push({name:"twitter:image:alt",content:p})}if(e.twitterSite)r.push({name:"twitter:site",content:e.twitterSite});if(e.twitterCreator)r.push({name:"twitter:creator",content:e.twitterCreator});if(e.articleAuthor)r.push({property:"article:author",content:e.articleAuthor});if(e.articlePublishedTime)r.push({property:"article:published_time",content:e.articlePublishedTime});if(e.articleModifiedTime)r.push({property:"article:modified_time",content:e.articleModifiedTime});if(e.articleSection)r.push({property:"article:section",content:e.articleSection});if(e.articleTags)for(let p of e.articleTags)r.push({property:"article:tag",content:p});let c=[];if(e.canonical)c.push({rel:"canonical",href:e.canonical});return{title:e.title,titleTemplate:e.titleTemplate,meta:r,link:c}}function zu(e){if(g={...g,...e},e.title||e.description)vc({title:e.title,description:e.description})}function Hu(e){let r=typeof e==="function"?e():e;po({title:r})}function Vu(e=d){let r=[];if(e.title){let n=e.title;if(e.titleTemplate)n=typeof e.titleTemplate==="function"?e.titleTemplate(n):e.titleTemplate.replace("%s",n);r.push(`<title>${m(n)}</title>`)}if(e.base){let n=Object.entries(e.base).map(([s,a])=>`${s}="${m(a)}"`).join(" ");r.push(`<base ${n}>`)}for(let n of e.meta||[]){let s=Object.entries(n).filter(([a,i])=>i!==void 0).map(([a,i])=>`${a==="httpEquiv"?"http-equiv":a}="${m(String(i))}"`).join(" ");r.push(`<meta ${s}>`)}for(let n of e.link||[]){let s=Object.entries(n).filter(([a,i])=>i!==void 0).map(([a,i])=>`${a}="${m(String(i))}"`).join(" ");r.push(`<link ${s}>`)}for(let n of e.script||[]){let{content:s,...a}=n,i=Object.entries(a).filter(([u,c])=>c!==void 0).map(([u,c])=>{if(typeof c==="boolean")return c?u:"";return`${u}="${m(String(c))}"`}).filter(Boolean).join(" ");if(s)r.push(`<script ${i}>${s}</script>`);else r.push(`<script ${i}></script>`)}for(let n of e.style||[]){let s=n.type?` type="${n.type}"`:"";r.push(`<style${s}>${n.content}</style>`)}return r.join(`
|
|
4
|
+
`)}function Uu(e=d){if(!e.htmlAttrs)return"";return Object.entries(e.htmlAttrs).map(([r,n])=>`${r}="${m(n)}"`).join(" ")}function Wu(e=d){if(!e.bodyAttrs)return"";return Object.entries(e.bodyAttrs).map(([r,n])=>`${r}="${m(n)}"`).join(" ")}function m(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function qu(e=d){if(typeof document>"u")return;if(e.title){let r=e.title;if(e.titleTemplate)r=typeof e.titleTemplate==="function"?e.titleTemplate(r):e.titleTemplate.replace("%s",r);document.title=r}for(let r of e.meta||[]){let n=r.name?`meta[name="${r.name}"]`:r.property?`meta[property="${r.property}"]`:null;if(n){let s=document.querySelector(n);if(!s){if(s=document.createElement("meta"),r.name)s.setAttribute("name",r.name);if(r.property)s.setAttribute("property",r.property);document.head.appendChild(s)}s.setAttribute("content",r.content)}}for(let r of e.link||[]){let n=`link[rel="${r.rel}"]${r.href?`[href="${r.href}"]`:""}`,s=document.querySelector(n);if(!s)s=document.createElement("link"),document.head.appendChild(s);for(let[a,i]of Object.entries(r))if(i!==void 0)s.setAttribute(a,String(i))}if(e.htmlAttrs)for(let[r,n]of Object.entries(e.htmlAttrs))if(r==="class")for(let s of String(n).split(/\s+/).filter(Boolean))document.documentElement.classList.add(s);else document.documentElement.setAttribute(r,n);if(e.bodyAttrs)for(let[r,n]of Object.entries(e.bodyAttrs))document.body.setAttribute(r,n)}function Xu(e){let r="";return{content:e.replace(/@head\s*([\s\S]*?)@endhead/g,(s,a)=>(r+=a.trim()+`
|
|
5
|
+
`,"")),headContent:r.trim()}}function Ku(e,r){return e.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(n,s,a,i)=>{let u=s?a:r[(i||"").trim()]??i,c=r.__stx_runtime_head??{};return r.__stx_runtime_head=de(c,{title:u}),""})}function Gu(e,r,n=""){if(!e.includes("@meta"))return e;return qe(e,/(?<![\w$@])@meta\s*\(/g,(s,a)=>{let i=on(Xe(s),r);if(i.kind==="error")return k("Meta",a,i.message,n,i.code);if(i.kind==="tag"){let u=r.__stx_runtime_head??{};r.__stx_runtime_head=de(u,{meta:[i.tag]})}return""},(s)=>k("Meta",s,"the call has no closing parenthesis",n,t.INVALID_DIRECTIVE_SYNTAX))}export{w,vs,qe,Xe,Ke,ue,be,k,Gn,on,ws,Bu,Fu,po,de,vc,Jn,zu,Hu,Vu,Uu,Wu,qu,Xu,Ku,Gu};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import s from"path";var h=new Set([".jpg",".jpeg",".png",".gif"]),d=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}];async function
|
|
3
|
-
export{
|
|
2
|
+
import s from"path";var h=new Set([".jpg",".jpeg",".png",".gif"]),d=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}];async function ya(e,r){let a=r.formats??d;if(!r.publicDir)return e;let i=y(e),o=[],m=/<img\b[^>]*?>/gi,c=[],u;while((u=m.exec(e))!==null){let t=u[0],n=t.match(/\bsrc=["']([^"']+)["']/i);if(!n)continue;if(A(u.index,i))continue;c.push({idx:u.index,length:t.length,src:n[1],raw:t})}if(c.length===0)return e;let f=await Promise.all(c.map(async(t)=>{let n=await S(t.src,r.publicDir,a);return{match:t,sources:n}}));for(let{match:t,sources:n}of f){if(n.length===0)continue;let x=`<picture>${n.map((p)=>`<source type="${p.mime}" srcset="${P(p.url)}">`).join("")}${t.raw}</picture>`;o.push({start:t.idx,end:t.idx+t.length,replacement:x})}if(o.length===0)return e;let l="",g=0;for(let t of o)l+=e.slice(g,t.start),l+=t.replacement,g=t.end;return l+=e.slice(g),l}async function S(e,r,a){if(!w(e))return[];let i=s.extname(e).toLowerCase();if(!h.has(i))return[];if(!e.startsWith("/"))return[];let o=s.join(r,e.slice(1)),m=s.dirname(o),c=s.basename(o,i),u=s.resolve(m),f=s.resolve(r);if(!u.startsWith(f))return[];let l=s.posix.dirname(e),g=a.map(async(n)=>{let b=s.join(m,`${c}${n.ext}`);if(!await Bun.file(b).exists())return null;return{url:s.posix.join(l,`${c}${n.ext}`),mime:n.mime}});return(await Promise.all(g)).filter((n)=>n!==null)}function w(e){if(!e)return!1;if(e.startsWith("http://")||e.startsWith("https://"))return!1;if(e.startsWith("//"))return!1;if(e.startsWith("data:"))return!1;return!0}function y(e){let r=[],a=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,i;while((i=a.exec(e))!==null)r.push([i.index,i.index+i[0].length]);return r}function A(e,r){for(let[a,i]of r)if(e>=a&&e<i)return!0;return!1}function P(e){return e.replace(/&/g,"&").replace(/"/g,""")}
|
|
3
|
+
export{ya};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{F}from"./chunk-
|
|
3
|
-
export{
|
|
2
|
+
import{F}from"./chunk-vfdwvt23.js";import S from"fs";import g from"path";import q from"crypto";var T=new Set(["webp","avif","jpeg","png"]),k=new Set(["cover","contain","fill","inside","outside"]),D=new Set([".jpg",".jpeg",".png",".webp",".avif",".gif"]),C=4096,U=80,A="cover";async function qs(e,t){let r=t.routePath??"/_stx/img",h=new URL(e.url);if(h.pathname!==r)return null;let a=L(h,t);if(!a.ok)return new Response(a.error,{status:a.status,headers:{"Content-Type":"text/plain"}});let{srcFsPath:n,srcUrl:d,width:l,height:i,format:s,quality:u,fit:c}=a,m;try{m=S.statSync(n)}catch{return new Response(`Source image not found: ${d}`,{status:404,headers:{"Content-Type":"text/plain"}})}if(!m.isFile())return new Response("Not a file",{status:404,headers:{"Content-Type":"text/plain"}});let w=t.cacheDir??".stx/cache/img";await S.promises.mkdir(w,{recursive:!0});let b=`${n}:${m.mtimeMs}:${m.size}`,I=`${l}x${i}:${s}:${u}:${c}`,f=q.createHash("sha256").update(`${b}|${I}`).digest("hex").slice(0,16),o=g.join(w,`${f}.${s}`),p={"Content-Type":F(s),"Cache-Control":"public, max-age=31536000, immutable",ETag:`"${f}"`,"X-Stx-Image-Cache":"HIT"};if(e.headers.get("if-none-match")===`"${f}"`)return new Response(null,{status:304,headers:p});let v=Bun.file(o);if(await v.exists())return new Response(v,{headers:p});try{let x=Buffer.from(await Bun.file(n).arrayBuffer()),{resizeAndConvert:P}=await N(),R=await P(x,{width:l,height:i,format:s,quality:u,fit:c});return await Bun.write(o,R),p["X-Stx-Image-Cache"]="MISS",new Response(new Uint8Array(R),{headers:p})}catch(x){let P=x.message;return new Response(`Image processing failed: ${P}`,{status:500,headers:{"Content-Type":"text/plain"}})}}function Fo(e){return async(t)=>await qs(t,e)??new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain"}})}function L(e,t){let r=e.searchParams.get("src");if(!r)return{ok:!1,error:"Missing required param: src",status:400};if(!r.startsWith("/"))return{ok:!1,error:"src must be an absolute URL path (start with /)",status:400};if(r.startsWith("//"))return{ok:!1,error:"src must be a local path",status:400};let h=g.extname(r).toLowerCase();if(!D.has(h))return{ok:!1,error:`Unsupported source extension: ${h}`,status:400};let a=g.resolve(t.publicDir),n=g.resolve(a,r.slice(1));if(!n.startsWith(`${a}${g.sep}`)&&n!==a)return{ok:!1,error:"src is outside publicDir",status:400};let d=t.maxWidth??C,l=t.maxHeight??C,i=e.searchParams.get("w"),s=e.searchParams.get("h"),u=i?Number.parseInt(i,10):0,c=s?Number.parseInt(s,10):0;if(i&&(!Number.isFinite(u)||u<=0))return{ok:!1,error:"Invalid w (must be positive integer)",status:400};if(s&&(!Number.isFinite(c)||c<=0))return{ok:!1,error:"Invalid h (must be positive integer)",status:400};if(!i&&!s)return{ok:!1,error:"At least one of w or h is required",status:400};let m=Math.min(u||d,d),w=Math.min(c||l,l),b=e.searchParams.get("f")||"webp";if(!T.has(b))return{ok:!1,error:`Invalid f (must be one of: ${[...T].join(", ")})`,status:400};let I=b,f=e.searchParams.get("q"),o=f?Number.parseInt(f,10):t.defaultQuality??U;if(!Number.isFinite(o)||o<1||o>100)return{ok:!1,error:"Invalid q (must be 1-100)",status:400};let y=e.searchParams.get("fit")||t.defaultFit||A;if(!k.has(y))return{ok:!1,error:`Invalid fit (must be one of: ${[...k].join(", ")})`,status:400};return{ok:!0,srcFsPath:n,srcUrl:r,width:m,height:w,format:I,quality:o,fit:y}}async function N(){return await import("./chunk-9kmmafp4.js")}
|
|
3
|
+
export{qs,Fo};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{V,ae}from"./chunk-1680nbq4.js";import{le,S,We}from"./chunk-7q1yy18q.js";import{Je,K,we}from"./chunk-76japd6k.js";import{Te,ne,C,re,Qs,mr,ei,Rt}from"./chunk-d6h9rpm4.js";import{Lr}from"./chunk-mj6fme15.js";import{At}from"./chunk-25n4gmek.js";import Y from"fs";import M from"path";var{serve:ce}=globalThis.Bun;import F from"zlib";import{promisify as q}from"util";var J=q(F.brotliCompress),Q=q(F.gzip),Z=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ee=["text/event-stream","multipart/x-mixed-replace"],te=1024;function se(t){if(!t)return!1;let e=t.toLowerCase();if(ee.some((i)=>e.startsWith(i)))return!1;return Z.some((i)=>e.startsWith(i))}function oe(t){let e=new Map;for(let i of t.split(",")){let[s,...c]=i.trim().split(";"),l=s.trim().toLowerCase();if(!l)continue;let m=1;for(let f of c){let x=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(f);if(!x)continue;let g=Number.parseFloat(x[1]);if(Number.isFinite(g))m=g}e.set(l,m)}return e}function ie(t){if(!t)return null;let e=oe(t),i=e.get("*"),s=(c)=>e.get(c)??i??0;if(s("br")>0)return"br";if(s("gzip")>0)return"gzip";return null}async function _t(t,e,i={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!se(e.headers.get("content-type")))return e;let s=ie(t.headers.get("accept-encoding"));if(!s)return e;let c;try{c=new Uint8Array(await e.arrayBuffer())}catch{return e}let l=()=>new Response(c,{status:e.status,statusText:e.statusText,headers:W(e.headers)});if(c.length<(i.threshold??te))return l();try{let m=s==="br"?await J(c,{params:{[F.constants.BROTLI_PARAM_QUALITY]:i.quality??5,[F.constants.BROTLI_PARAM_SIZE_HINT]:c.length}}):await Q(c);if(m.length>=c.length)return l();let f=W(e.headers);return f.set("Content-Encoding",s),f.set("Content-Length",String(m.length)),new Response(m,{status:e.status,statusText:e.statusText,headers:f})}catch{return l()}}function W(t){let e=new Headers(t),i=e.get("Vary");if(!i)return e.set("Vary","Accept-Encoding"),e;if(!i.split(",").some((c)=>c.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${i}, Accept-Encoding`);return e}class D{now;entries=new V(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,i){let s,c=async()=>{let r=s??await i();return r.headers.set("Cache-Control","private, no-store"),r.headers.set("Vary",C(r.headers.get("Vary")).Vary),r};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return c();let l=new URL(t.url),m=`${l.origin}${l.pathname}${l.search}|${ne(t)?"fragment":"document"}`,f=this.entries.get(m),x=(r)=>{let T=new Headers(r.headers);return T.set("Cache-Control","private, no-store"),T.set("Age",String(Math.max(0,Math.floor((this.now()-r.created)/1000)))),new Response(r.body.slice(0),{headers:T})},g=f?(this.now()-f.created)/1000:1/0;if(f&&g<e.maxAge)return x(f);let b=this.generation,B=async()=>{let r=await i();s=r;let T=(r.headers.get("Vary")??"").toLowerCase().split(",").map((R)=>R.trim()).filter(Boolean);if(r.status!==200||r.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(r.headers.get("Cache-Control")??"")||T.some((R)=>R!=="x-stx-router"&&R!=="accept-encoding"))return null;let L=await r.clone().arrayBuffer();if(L.byteLength>1048576)return null;r.headers.set("Vary",C(r.headers.get("Vary")).Vary);let n={body:L,headers:Array.from(r.headers.entries()),created:this.now(),path:l.pathname};if(this.generation===b)this.entries.set(m,n);return n},v=this.pending.get(m);if(!v){if(this.pending.size>=1000)return c();v=B().finally(()=>{if(this.pending.get(m)===v)this.pending.delete(m)}),this.pending.set(m,v)}if(f&&g<e.maxAge+(e.swr??0))return v.catch(()=>{}),x(f);let E=await v;return E?x(E):c()}}var pe={".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 el(t={}){let e=M.resolve(t.outputDir||".output"),i=t.port??3000,s=Qs(e);if(!s)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${s.routes.length} routes...`);let c=At(s.routeRules),l=new D,m=Lr(e,s.apiRoutes??[]),f=Bun.file(M.join(e,"server/runtime-config.json")),x=t.runtimeConfig??(await f.exists()?await f.json():void 0),g=x?S(x):void 0,b=new Map,B=new Map,v=new Map,E=new Map;for(let n of s.routes)try{let R=M.join(e,n.compiledPath),o=JSON.parse(await Bun.file(R).text());if(g)o.html=We(o.html,g);b.set(n.pattern,o),v.set(n.pattern,we(o.html)),E.set(n.pattern,ae(o.html));let N=M.join(e,n.fragmentPath);if(await Bun.file(N).exists()){let A=await Bun.file(N).text();B.set(n.pattern,g?We(A,g):A)}}catch(R){console.warn(`[stx] Failed to load route ${n.pattern}:`,R)}let r=new Map,T=[];for(let n of s.routes)if(n.hasParams){let{regex:R,params:o}=K(n.pattern,{page:!0});T.push({regex:R,route:n,paramNames:o})}else r.set(n.pattern,n);let L=ce({port:i,async fetch(n){return _t(n,await le(g??S(),async()=>{let o=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?.[o])return t.apiRoutes[o](n);let N=await m(n);if(N)return N;if((n.method==="GET"||n.method==="HEAD")&&o!=="/"){let p=M.resolve(e,"public"),d;try{d=decodeURIComponent(o)}catch{d=o}if(!d.includes("\x00")){let u=M.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${M.sep}`))try{if(Y.existsSync(u)&&Y.statSync(u).isFile()){let h=M.extname(u).toLowerCase(),j=pe[h]||"application/octet-stream",_=o.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(o);return new Response(Bun.file(u),{headers:{"Content-Type":j,"Cache-Control":_?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let A=ne(n),y=null,G={};if(y=r.get(o)||null,!y)for(let{regex:p,route:d,paramNames:u}of T){let a=o.match(p);if(a){y=d,u.forEach((h,j)=>{G[h]=a[j+1]});break}}if(!y){let p=Je(o)?null:r.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=c(o),U=Object.keys(O).length>0;return l.respond(n,O.cache,async()=>{let p=b.get(y.pattern);if(A&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let a=B.get(y.pattern);if(a){let h=v.get(y.pattern);return new Response(a,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...E.has(y.pattern)?{"X-STX-Runtime":E.get(y.pattern)?"true":"false"}:{},...h?{"X-STX-Layout":h.layout,"X-STX-Layout-Group":h.group}:{},...C(),...O.cache?{}:{"Cache-Control":Te}}})}}let d=mr(n.method),u=b.get(y.pattern);if(!u){let a=r.get("/500")||null;if(a){let h=b.get(a.pattern);if(h)return new Response(h.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(y.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",...C(),"Cache-Control":"public, max-age=60"}});try{let{html:a,boundaries:h,redirect:j,cookies:_,status:H,headers:I}=await Rt(u,{params:G,request:n,method:n.method,__stx_strict_hydration:U,__stx_runtime_config:g});if(j)return ei(j,_,I);if(h&&h.length>0){let{renderStreamingPage:P,streamToResponse:z}=await import("./chunk-fe5st320.js"),X=new Headers({...C(),...I,"Cache-Control":"private, no-store"});for(let k of _??[])X.append("Set-Cookie",k);if(A&&!d){let k=we(a);X.set("X-STX-Fragment","true"),X.set("X-STX-Runtime",ae(a)?"true":"false"),X.set("X-STX-Layout",k.layout),X.set("X-STX-Layout-Group",k.group)}return z(P(A&&!d?re(a,s.routerContainer||"main"):a,h,{timeoutMs:30000}),{status:H??u.status??200,headers:X})}let w=new Headers({"Content-Type":"text/html",...C(),...O.cache?{}:{"Cache-Control":"private, no-store"}});for(let P of _??[])w.append("Set-Cookie",P);for(let[P,z]of Object.entries(I??{}))w.set(P,z);if(w.set("Vary",C(w.get("Vary")).Vary),A&&!d){let P=we(a);return w.set("X-STX-Fragment","true"),w.set("X-STX-Runtime",ae(a)?"true":"false"),w.set("X-STX-Layout",P.layout),w.set("X-STX-Layout-Group",P.group),new Response(re(a,s.routerContainer||"main"),{status:H??u.status??200,headers:w})}return new Response(a,{status:H??u.status??200,headers:w})}catch(a){if(console.error(`[stx] Hydration error for ${o}:`,a),U)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:${L.port}`),console.log(`[stx] Serving ${s.routes.length} routes (${b.size} pre-loaded)`),{port:L.port,stop:()=>{l.invalidate(),L.stop()},invalidate:(n)=>l.invalidate(n)}}
|
|
3
|
+
export{_t,el};
|
|
@@ -72,7 +72,7 @@ else {
|
|
|
72
72
|
${t}
|
|
73
73
|
})();
|
|
74
74
|
</script>
|
|
75
|
-
`}function
|
|
75
|
+
`}function dl(i,n,o){f=0;let l=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return i.replace(l,(t,e,s)=>{let a=v(),r=p(t,e,s),d=r.placeholder?`<div data-defer-placeholder>${r.placeholder}</div>`:"",c=r.loading?`<div data-defer-loading style="display: none;">${r.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',g=r.error?`<div data-defer-error style="display: none;">${r.error}</div>`:"",u=`<div data-defer-content style="display: none;">${r.content}</div>`,h=E(a,r);return`
|
|
76
76
|
<div id="${a}" class="stx-defer" data-defer-trigger="${r.trigger}">
|
|
77
77
|
${d}
|
|
78
78
|
${c}
|
|
@@ -81,4 +81,4 @@ else {
|
|
|
81
81
|
</div>
|
|
82
82
|
${h}
|
|
83
83
|
`})}
|
|
84
|
-
export{
|
|
84
|
+
export{dl};
|
|
@@ -298,5 +298,5 @@ catch (error) {
|
|
|
298
298
|
init();
|
|
299
299
|
}
|
|
300
300
|
})();
|
|
301
|
-
</script>`}var
|
|
302
|
-
export{
|
|
301
|
+
</script>`}var Rc={name:"pwa.installButton",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return r(t,n)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},Ac={name:"pwa.updatePrompt",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return p(t,n)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},Pc={name:"pwa.offlineIndicator",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return d(t,n)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},Ic={name:"pwa.pushSubscribe",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return l(t,n)},hasEndTag:!0,description:"Renders a push notification subscription button"},rr=[Rc,Ac,Pc,Ic];function Ju(t){return[...t,...rr]}
|
|
302
|
+
export{Rc,Ac,Pc,Ic,rr,Ju};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ms,hs,ys,bs,qn,Xn,Ou,Mu,Nu,Lu,Kn,ju}from"./chunk-0xgf3xgy.js";import"./chunk-31a8eh0j.js";import"./chunk-wweasgq9.js";export{ju as generateDefaultRobotsTxt,Kn as generateRobotsTxt,Mu as generateSitemap,Nu as generateSitemapIndex,bs as injectSeoTags,qn as metaDirective,ms as processMetaDirectives,ys as processSeoDirective,hs as processStructuredData,Ou as registerSeoDirectives,Lu as scanForSitemapEntries,Xn as structuredDataDirective};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-wweasgq9.js";import"./chunk-fxhvkenf.js";import"./chunk-xvn3sv3v.js";import{a}from"./chunk-mcqn70v8.js";import f from"fs";import l from"path";async function d(e,t={}){let s=Date.now(),n={total:0,passed:0,failed:0,new:0,failures:[],duration:0},o=t.snapshotDir||a(e.root,"story","snapshots");await f.promises.mkdir(o,{recursive:!0});let r=e.storyFiles;if(t.filter&&t.filter.length>0)r=r.filter((i)=>t.filter.some((p)=>i.fileName.toLowerCase().includes(p.toLowerCase())));for(let i of r)await h(i,o,t,n);return n.duration=Date.now()-s,n}async function h(e,t,s,n){let o=e.story;if(!o)return;for(let r of o.variants){n.total++;let i=l.join(t,`${e.id}-${r.id}.snap`),p=g(r.source||""),c=await w(i);if(s.update||!c){let u={storyId:e.id,variantId:r.id,component:e.fileName,timestamp:Date.now(),hash:p};if(await f.promises.writeFile(i,JSON.stringify(u,null,2)),!c)n.new++;n.passed++}else try{let u=await f.promises.readFile(i,"utf-8"),m=JSON.parse(u);if(m.hash===p)n.passed++;else n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:"Snapshot mismatch",difference:y(m.hash,p)})}catch(u){n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:`Error reading snapshot: ${u}`})}}}async function x(e,t={}){return(await d(e,{...t,update:!0})).total}function g(e){let t=0;for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);t=(t<<5)-t+n,t=t&t}return t.toString(16)}function y(e,t){if(e===t)return 0;let s=Math.abs(Number.parseInt(e,16)-Number.parseInt(t,16));return Math.min(s/1e6,1)}async function w(e){try{return await f.promises.access(e),!0}catch{return!1}}function F(e){let t=[];if(t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(" STX Story Visual Regression Tests"),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),e.failures.length>0){t.push(" \u274C Failures:"),t.push("");for(let s of e.failures){if(t.push(` \u2022 ${s.component} / ${s.variantId}`),t.push(` ${s.message}`),s.difference!==void 0)t.push(` Difference: ${(s.difference*100).toFixed(2)}%`);t.push("")}}if(t.push(" Summary:"),t.push(` Total: ${e.total}`),t.push(` Passed: ${e.passed} \u2713`),t.push(` Failed: ${e.failed} \u2717`),e.new>0)t.push(` New: ${e.new} \u26A1`);return t.push(` Time: ${e.duration}ms`),t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),t.join(`
|
|
3
3
|
`)}export{F as formatTestResults,d as runVisualTests,x as updateSnapshots};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import y from"fs";import R from"path";var S="_stx";function F(e){return Bun.hash(e).toString(16).slice(0,8)}function k(e){let t=[],n=(i)=>{for(let s of y.readdirSync(i,{withFileTypes:!0})){let r=R.join(i,s.name);if(s.isDirectory())n(r);else if(s.isFile()&&r.endsWith(".html"))t.push(r)}};if(y.existsSync(e))n(e);return t}var z=[{pattern:/<script\b([^>]*\bdata-stx-runtime\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"runtime",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(e)=>`<script data-stx-runtime src="${e}"></script>`},{pattern:/<script\b([^>]*\bdata-stx-router\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"router",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(e)=>`<script data-stx-router src="${e}"></script>`},{pattern:/<style\b([^>]*\bdata-css=(?:"generated"|'generated')[^>]*)>([\s\S]*?)<\/style>/gi,prefix:"css",extension:"css",contentType:"text/css; charset=utf-8",replace:(e)=>`<link data-css="generated" rel="stylesheet" href="${e}">`}];function I(e,t=`/${S}`){let n=[],i=new Set,s=0,r=e;for(let o of z)r=r.replace(o.pattern,(g,u,c)=>{if(/\b(?:src|href)\s*=/.test(u)||!c.trim())return g;let a=`${o.prefix}.${F(c)}.${o.extension}`;if(!i.has(a))i.add(a),n.push({filename:a,contents:c,contentType:o.contentType});return s+=c.length,o.replace(`${t}/${a}`)});return{html:r,assets:n,bytesInlined:s}}function
|
|
2
|
+
import y from"fs";import R from"path";var S="_stx";function F(e){return Bun.hash(e).toString(16).slice(0,8)}function k(e){let t=[],n=(i)=>{for(let s of y.readdirSync(i,{withFileTypes:!0})){let r=R.join(i,s.name);if(s.isDirectory())n(r);else if(s.isFile()&&r.endsWith(".html"))t.push(r)}};if(y.existsSync(e))n(e);return t}var z=[{pattern:/<script\b([^>]*\bdata-stx-runtime\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"runtime",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(e)=>`<script data-stx-runtime src="${e}"></script>`},{pattern:/<script\b([^>]*\bdata-stx-router\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"router",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(e)=>`<script data-stx-router src="${e}"></script>`},{pattern:/<style\b([^>]*\bdata-css=(?:"generated"|'generated')[^>]*)>([\s\S]*?)<\/style>/gi,prefix:"css",extension:"css",contentType:"text/css; charset=utf-8",replace:(e)=>`<link data-css="generated" rel="stylesheet" href="${e}">`}];function I(e,t=`/${S}`){let n=[],i=new Set,s=0,r=e;for(let o of z)r=r.replace(o.pattern,(g,u,c)=>{if(/\b(?:src|href)\s*=/.test(u)||!c.trim())return g;let a=`${o.prefix}.${F(c)}.${o.extension}`;if(!i.has(a))i.add(a),n.push({filename:a,contents:c,contentType:o.contentType});return s+=c.length,o.replace(`${t}/${a}`)});return{html:r,assets:n,bytesInlined:s}}function bi(e){let t={pages:0,assets:0,bytesInlined:0},n=R.join(e,S),i=new Set;for(let s of k(e)){let r=y.readFileSync(s,"utf8"),{html:o,assets:g,bytesInlined:u}=I(r);if(o===r)continue;for(let c of g){if(i.has(c.filename))continue;i.add(c.filename),y.mkdirSync(n,{recursive:!0}),y.writeFileSync(R.join(n,c.filename),c.contents),t.assets++}y.writeFileSync(s,o),t.bytesInlined+=u,t.pages++}return t}import h from"fs";import T from"path";var L=1024,N=/<(script|style)\b([^>]*)>([\s\S]*?)<\/\1>/gi,_=new Set(["","module","text/javascript","application/javascript","module/javascript"]);function B(e){return Bun.hash(e).toString(16).slice(0,8)}function C(e){let t=[],n=(i)=>{for(let s of h.readdirSync(i,{withFileTypes:!0})){let r=T.join(i,s.name);if(s.isDirectory())n(r);else if(s.isFile()&&r.endsWith(".html"))t.push(r)}};if(h.existsSync(e))n(e);return t}function O(e,t){let n=e.match(new RegExp(`\\b${t}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i"));if(!n)return;return n[2]??n[3]??n[4]??""}function H(e,t,n){if(n.length<L)return!1;if(/\b(?:src|href)\s*=/i.test(t))return!1;if(e.toLowerCase()==="script"){if(!_.has((O(t,"type")??"").trim().toLowerCase()))return!1;return!0}return!0}function D(e){let t=[];for(let n of e.matchAll(/<template\b[^>]*>[\s\S]*?<\/template>/gi))t.push([n.index,n.index+n[0].length]);return t}function vi(e){let t={pages:0,assets:0,bytesInlined:0},n=C(e);if(n.length<2)return t;let i=new Map,s=new Map;for(let a of n){let f=h.readFileSync(a,"utf8");i.set(a,f);let M=D(f);for(let d of f.matchAll(N)){let[x,p,l,m]=d;if(!H(p,l,m))continue;if(M.some(([j,A])=>d.index>=j&&d.index<A))continue;let w=`${p.toLowerCase()}\x00${m}`,b=s.get(w);if(b)b.push({file:a,whole:x,tag:p,attrs:l,body:m});else s.set(w,[{file:a,whole:x,tag:p,attrs:l,body:m}])}}let r=[...s.values()].filter((a)=>new Set(a.map((f)=>f.file)).size>1);if(r.length===0)return t;let o=T.join(e,S),g=new Map(i),u=new Map,c=[];for(let a of r){let{tag:f,body:M}=a[0],d=f.toLowerCase()==="script",x=`${d?"chunk":"style"}.${B(M)}.${d?"js":"css"}`;c.push({filename:x,contents:M,contentType:d?"text/javascript; charset=utf-8":"text/css; charset=utf-8"});let p=`/${S}/${x}`;for(let l of a){let m=d?`<script${l.attrs} src="${p}"></script>`:`<link${l.attrs} rel="stylesheet" href="${p}">`,w=g.get(l.file),b=w.replace(l.whole,()=>m);if(b===w)continue;g.set(l.file,b),u.set(l.file,(u.get(l.file)??0)+l.body.length)}}h.mkdirSync(o,{recursive:!0});for(let a of c)h.writeFileSync(T.join(o,a.filename),a.contents),t.assets++;for(let[a,f]of g){if(f===i.get(a))continue;h.writeFileSync(a,f),t.pages++,t.bytesInlined+=u.get(a)??0}return t}import E from"fs";import v from"path";var K="layout-types.d.ts";function P(e){let t=[],n=(i,s)=>{let r;try{r=E.readdirSync(i,{withFileTypes:!0})}catch{return}for(let o of r){if(o.name.startsWith("."))continue;let g=v.join(i,o.name);if(o.isDirectory())n(g,s?`${s}/${o.name}`:o.name);else if(o.isFile()&&o.name.endsWith(".stx")&&o.name!=="_layout.stx"){let u=o.name.slice(0,-4);t.push(s?`${s}/${u}`:u)}}};return n(e,""),t.sort()}function W(e){let t=["// Auto-generated by stx \u2014 do not edit.","//","// Makes `definePageMeta({ layout })` reject a name with no layout behind it.","// Include this file in your tsconfig (it lives in the stx state directory,","// `.stx/` by default) for the check to apply.",""];if(e.length===0)return t.push("// No layouts found \u2014 `layout` stays typed as `string`.","export {}",""),t.join(`
|
|
3
3
|
`);return t.push("declare module '@stacksjs/stx' {"," interface KnownLayouts {",...e.map((n)=>` '${n}': true`)," }","}","","export {}",""),t.join(`
|
|
4
|
-
`)}function
|
|
5
|
-
export{
|
|
4
|
+
`)}function wi(e,t){if(!e)return[];let n=v.isAbsolute(e)?e:v.resolve(process.cwd(),e),i=P(n),s=W(i),r=v.join(t,K);try{if(E.existsSync(r)&&E.readFileSync(r,"utf8")===s)return i;E.mkdirSync(t,{recursive:!0}),E.writeFileSync(r,s)}catch{}return i}
|
|
5
|
+
export{bi,vi,wi};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{m}from"./chunk-
|
|
3
|
-
${o.trim()}`)}catch(o){console.warn(`[stx] Failed to load composable ${e}:`,o)}if(S.length===0||b.size===0)return
|
|
2
|
+
import{m}from"./chunk-bk5ndwv3.js";import{R,$t}from"./chunk-vdqa5gt7.js";import{y,Be,N,i}from"./chunk-1680nbq4.js";import{oe,ft,gt}from"./chunk-jgsgd6rt.js";import{Re,zt,J}from"./chunk-q8swb7na.js";import _ from"path";var g=new Map,v=new Map,P=["composables","functions"];function E(n){let t=_.basename(n,".ts");return t==="index"||t==="types"||n.endsWith(".d.ts")}async function G(n){if(n)return _.resolve(n);let t=`<default>:${process.cwd()}`,l=v.get(t);if(l!==void 0)return l;let s=await T();if(s!==null)v.set(t,s);return s}async function T(){let n=await i(),t=n.root||process.cwd(),l=n.composablesDir;if(l)return _.resolve(t,l);for(let s of P){let r=_.resolve(t,s);try{let c=new Bun.Glob("**/*.ts");for await(let a of c.scan({cwd:r,absolute:!0}))if(!E(a))return r}catch{}}return null}async function j(n){let t=Array.isArray(n)?n:n?[_.resolve(n)]:(await i())._layerComposableDirs??[await G()].filter((s)=>!!s),l=new Map;for(let s of t){let r=new Bun.Glob("**/*.ts");try{for await(let c of r.scan({cwd:s,absolute:!0})){let a=_.relative(s,c);if(!E(c)&&!l.has(a))l.set(a,c)}}catch{}}return{key:t.join("\x00"),files:[...l.values()].sort()}}async function Tr(n){let{files:t}=await j(n),l=N({loader:"ts",target:"browser",define:y()}),s=[];for(let r of t)try{let c=await Bun.file(r).text(),a=l.scan(c).exports.filter((d)=>d!=="default");if(a.length>0)s.push({file:r,names:a})}catch{}return s}function z(n,t){return new RegExp(`\\b${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(n)}function U(n,t,l){let s=new Map;for(let{file:d,names:f}of n)for(let u of f)if(!s.has(u))s.set(u,d);let r=(d)=>{let f=[];for(let[u,w]of s)if(z(d,u))f.push(w);return f},c=new Set,a=l.flatMap(r);while(a.length>0){let d=[];for(let f of a){if(c.has(f))continue;c.add(f);for(let u of r(t.get(f)??""))if(!c.has(u))d.push(u)}a=d}return c}async function ll(n,t,l){let{key:s,files:r}=await j(n);if(!s)return null;let c=()=>[...new Set([...r,...r.flatMap((e)=>oe(e))])],a=Re(c());if(r.length===0)return J(g,s,a,""),null;r.sort();let d=N({loader:"ts",target:"browser",define:y()}),f=new Map,u=[];for(let e of r)try{let o=await Bun.file(e).text();f.set(e,o);let h=d.scan(o).exports.filter((p)=>p!=="default");if(h.length>0)u.push({file:e,names:h})}catch{f.set(e,"")}let w=t===void 0?new Set(r):U(u,f,l?[t,...l]:[t]);if(w.size===0)return null;let B=r.filter((e)=>w.has(e)),x=`${s}\x00${B.join("\x00")}`,M=zt(g,x,a);if(M!==void 0)return M||null;let S=[],b=new Set,D=new Set;for(let e of B)try{let o=f.get(e)??await Bun.file(e).text(),h=_.basename(e,".ts");for(let p of o.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(p[1])D.add(p[1]);try{for(let p of d.scan(o).exports)if(p!=="default")b.add(p)}catch{}if(o=R(o),ft(o))o=await gt(o,e,{projectRoot:process.cwd(),externalizeUserModules:!1}),o=Be(o);o=$t(o),o=o.replace(/^export\s+(default\s+)?/gm,""),o=d.transformSync(o),S.push(`// Composable: ${h}
|
|
3
|
+
${o.trim()}`)}catch(o){console.warn(`[stx] Failed to load composable ${e}:`,o)}if(S.length===0||b.size===0)return J(g,x,a,""),null;let F=[...b].map((e)=>` try { if (!(${JSON.stringify(e)} in __c)) __c[${JSON.stringify(e)}] = ${e}; } catch (e) {}`).join(`
|
|
4
4
|
`),k=JSON.stringify([...b]),C=S.join(`
|
|
5
5
|
|
|
6
6
|
`),O=m.filter((e)=>!D.has(e)&&new RegExp(`\\b${e}\\b`).test(C)).map((e)=>`var ${e} = __stx[${JSON.stringify(e)}];`).join(`
|
|
@@ -29,5 +29,5 @@ ${F}
|
|
|
29
29
|
window[__n] = __c[__n];
|
|
30
30
|
__published[__n] = true;
|
|
31
31
|
}
|
|
32
|
-
})();`;return a=
|
|
33
|
-
export{
|
|
32
|
+
})();`;return a=Re(c()),J(g,x,a,A),A}function ul(){g.clear(),v.clear()}
|
|
33
|
+
export{Tr,ll,ul};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import"./chunk-bk5ndwv3.js";import"./chunk-vdqa5gt7.js";import{y,I,O,N}from"./chunk-1680nbq4.js";import"./chunk-wweasgq9.js";import"./chunk-fxhvkenf.js";import"./chunk-76japd6k.js";import"./chunk-31a8eh0j.js";import"./chunk-0xgf3xgy.js";import"./chunk-e2m674vf.js";import"./chunk-7q1yy18q.js";import"./chunk-vepc9rbt.js";import"./chunk-865xvpp2.js";import"./chunk-xvn3sv3v.js";import f from"path";var b=["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","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useOutbox","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],L=new Set(b);var l=new Map,h=I(64),S=new Set,v=0,E=new Set(b);function W(){l.clear(),h.clear()}function R(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 P(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=O(o,v),r=h.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 E){if(S.has(i))continue;let u=i.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${u}\\s*\\(`).test(a))t.push(i)}return t.sort(),h.set(n,t),t.slice()}async function U(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=N({loader:"ts",target:"browser",define:y()}),k=new Set(r),m=[],d=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=R(p);for(let s of p){let e;try{e=await Bun.file(s).text()}catch{continue}let g=[];try{g=u.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!g.some((c)=>k.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,""),m.push(`// ${f.basename(s).replace(/\.[jt]s$/,"")}
|
|
3
|
+
${u.transformSync(e).trim()}`);for(let c of g)d.add(c)}catch(c){console.warn(`[stx] framework composable ${f.basename(s)} could not be bundled:`,c)}}let w=r.filter((s)=>!d.has(s)&&!P(o,s));if(w.length>0)console.warn(`[stx] could not bundle ${w.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(m.length===0)return l.set(t,""),null;let C=[...d].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
|
+
`),x=`<script data-stx-framework-composables>
|
|
5
|
+
;(function(){
|
|
6
|
+
var __s = window.stx = window.stx || {};
|
|
7
|
+
${m.join(`
|
|
8
|
+
|
|
9
|
+
`)}
|
|
10
|
+
${C}
|
|
11
|
+
})();
|
|
12
|
+
</script>`;return l.set(t,x),x}function A(o){S.clear();for(let n of o)S.add(n);v++}export{A as __setRuntimeOwnedForTest,W as clearFrameworkComposableCache,U as getFrameworkComposableScript,M as referencedFrameworkComposables,R as selectComposableFiles};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import x from"fs";import u from"path";import p from"fs";import v from"path";var y=["components","layouts","partials","emails"];function
|
|
3
|
-
`),
|
|
4
|
-
`))}import P from"path";function R(e,t){let r=P.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(P.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function Y(e){let t=[],a="",r=0;while(r<e.length){let n=e.slice(r),i=/^\/:([^/?*]+)\?/.exec(n);if(i){t.push(i[1]),a+="(?:/([^/]+))?",r+=i[0].length;continue}let o=/^:([^/?*]+)\*/.exec(n);if(o){t.push(o[1]),a+="(.+)",r+=o[0].length;continue}let l=/^:([^/?*]+)/.exec(n);if(l){t.push(l[1]),a+="([^/]+)",r+=l[0].length;continue}a+=e[r].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),r+=1}return{regex:new RegExp(`^${a}$`),params:t}}function yn(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let i={};return r.params.forEach((o,l)=>{i[o]=n[l+1]}),{route:r,params:i}}}return null}function ar(e){let t=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return Y(t)}import U from"fs";import E from"path";function L(e,t){let a=[],r=E.dirname(e);while(r.startsWith(t)||r===t){let n=E.join(r,"_layout.stx");if(U.existsSync(n))a.unshift(n);if(r===t)break;r=E.dirname(r)}return a}function N(e,t){let a=[];if(!x.existsSync(e))return a;let r=x.readdirSync(e,{withFileTypes:!0});for(let n of r){let i=u.join(e,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(y.includes(n.name))continue;a.push(...N(i,t))}else if(n.isFile()){let o=u.extname(n.name);if(t.includes(o)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(i)}}}return a}class bn{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let a=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=a.map((s)=>u.resolve(e,s)),this.pagesDir=this.pagesDirs[0];let r=t.extensions||[".stx"],n=(s)=>{let c=u.resolve(e,s);try{return x.realpathSync(c)}catch{return c}},i=(t.exclude??[]).filter((s)=>typeof s==="string"&&s.trim()!=="").map(n),o=(s)=>{if(i.length===0)return!1;let c=n(s);return i.some((d)=>c===d||c.startsWith(`${d}${u.sep}`))},l=new Set;this.routes=[];for(let s of this.pagesDirs){let c=N(s,r).filter((h)=>!o(h)),d=new Map;for(let h of c){let g=R(h,s),m=t.pagesDirs?g.replace(/:[\w]+/g,":param"):g;if(t.pagesDirs&&d.has(m))throw Error(`Conflicting layer pages for ${g}: ${d.get(m)} and ${h}`);if(d.set(m,h),l.has(m))continue;l.add(m);let{regex:q,params:O}=Y(g),T=t.layouts!==!1?L(h,s):[];this.routes.push({pattern:g,regex:q,params:O,filePath:h,isDynamic:O.length>0,layout:T.length>0?T[T.length-1]:void 0})}}if(this.routes.sort((s,c)=>{if(!s.isDynamic&&c.isDynamic)return-1;if(s.isDynamic&&!c.isDynamic)return 1;let d=s.pattern.split("/").length,h=c.pattern.split("/").length;if(d!==h)return h-d;return s.pattern.localeCompare(c.pattern)}),t.emit!==!1){let s=u.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");Os(this.routes,s),Ms(this.routes,s,this.pagesDir)}}match(e){let t=e===""?"/":e;for(let a of this.routes){let r=t.match(a.regex);if(r){let n={};return a.params.forEach((i,o)=>{n[i]=r[o+1]}),{route:a,params:n}}}return null}resolve(e,t){let a=this.routes.find((n)=>n.pattern===e||n.filePath.includes(e));if(!a)return"#not-found";let r=a.pattern;if(t)for(let[n,i]of Object.entries(t))r=r.replace(`:${n}`,encodeURIComponent(i));return r}addRoute(e){this.routes.push(e),this.routes.sort((t,a)=>{if(!t.isDynamic&&a.isDynamic)return-1;if(t.isDynamic&&!a.isDynamic)return 1;return t.pattern.localeCompare(a.pattern)})}getLayout(e){return e.layout??null}}function cr(e,t){let a=[`${t}.stx`,"error.stx"];for(let r of a){let n=u.join(e,r);if(x.existsSync(n))return n}return null}function lr(e,t){return e.map((a)=>{let r=u.relative(t,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var f={},k="";function Rc(e){k=e.replace(/\/$/,"")}function Ac(e,t,a={}){f[e]={path:t,name:e,params:a}}function Pc(e){for(let[t,a]of Object.entries(e))if(typeof a==="string")f[t]={path:a,name:t};else f[t]={...a,name:t}}function vn(e,t={},a=!1){let r=f[e];if(!r)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let n={...r.params,...t},i=r.path;i=i.replace(/:(\w+)/g,(l,s)=>{let c=n[s];if(c===void 0)return console.warn(`Missing parameter [${s}] for route [${e}].`),`:${s}`;return delete n[s],encodeURIComponent(String(c))});let o=Object.entries(n);if(o.length>0){let l=o.map(([s,c])=>`${encodeURIComponent(s)}=${encodeURIComponent(String(c))}`).join("&");i+=(i.includes("?")?"&":"?")+l}return a&&k?`${k}${i}`:i}function Ic(){for(let e of Object.keys(f))delete f[e];k=""}import D from"fs";import I from"path";function Dc(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function Oc(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function Mc(e,t={}){return{handler:e,mode:t.mode??"universal"}}function _(e){let t={};if(!e)return t;let a=e.split(";");for(let r of a){let[n,...i]=r.split("=");if(n){let o=n.trim(),l=i.join("=").trim();if(o)t[o]=decodeURIComponent(l)}}return t}function S(e,t,a={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function Po(e,t){let a=e.headers.get("cookie")||"",r=_(a);return{get(n){return r[n]},set(n,i,o={}){r[n]=i,t.append("Set-Cookie",S(n,i,o))},delete(n){delete r[n],t.append("Set-Cookie",S(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function Io(){return{get(e){if(typeof document>"u")return;return _(document.cookie)[e]},set(e,t,a={}){if(typeof document>"u")return;document.cookie=S(e,t,a)},delete(e){if(typeof document>"u")return;document.cookie=S(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return _(document.cookie)}}}function Do(){let e=typeof window<"u"&&typeof window.localStorage<"u";return{get(t){if(!e)return null;try{return window.localStorage.getItem(t)}catch{return null}},set(t,a){if(!e)return;try{window.localStorage.setItem(t,a)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}var w=new Map;function Ns(e,t){w.set(e,t)}function Oo(e){return w.get(e)}function Nc(e){return w.has(e)}function Qe(){w.clear()}function et(){return Array.from(w.keys())}async function tt(e,t="middleware"){let a=I.resolve(e,t);if(!D.existsSync(a))return;let r=D.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let i=n.replace(/\.(ts|js)$/,""),o=I.join(a,n);try{let s=(await import(o)).default;if(s&&typeof s.handler==="function")Ns(i,s);else if(typeof s==="function")Ns(i,{handler:s,mode:"universal"})}catch(l){console.warn(`Failed to load middleware '${i}' from ${o}:`,l)}}}function X(e){let t={};if(!e)return t;let a=new URLSearchParams(e);for(let[r,n]of a)t[r]=n;return t}function nt(e,t,a,r=""){return{path:e,params:t,query:X(r),fullPath:r?`${e}?${r}`:e,meta:a}}function rt(e,t,a,r){let n=r?.isServer??typeof window>"u",i=!n,o=new Headers;return{to:e,from:t,isClient:i,isServer:n,cookies:n&&a?Po(a,o):Io(),storage:Do(),state:{},request:a,responseHeaders:o}}async function st(e,t){let a=Array.isArray(e)?e:[e],r=t.isServer;for(let n of a){let i=Oo(n);if(!i)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(i.mode==="server"&&!r)continue;try{let o=await i.handler(t);if(o){if(o.type==="redirect")return{passed:!1,redirect:o,state:t.state,responseHeaders:t.responseHeaders};if(o.type==="abort")return{passed:!1,abort:o,state:t.state,responseHeaders:t.responseHeaders}}}catch(o){return console.error(`Error in middleware '${n}':`,o),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:o instanceof Error?o.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}function ur(e){let a=e.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function Ce(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=t?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||ur(n)}}var A,C;function G(e){let t=[],a="log(",r=0;while(r<e.length){let n=e.indexOf("log(",r);if(n===-1){t.push(e.slice(r));break}let i=n>0?e[n-1]:" ",o=/\bfunction\s+$/.test(e.slice(Math.max(0,n-16),n));if(/[\w$.]/.test(i)||o){t.push(e.slice(r,n+4)),r=n+4;continue}t.push(e.slice(r,n));let l=1,s=n+4;while(s<e.length&&l>0){let c=e[s];if(c==='"'||c==="'"||c==="`"){let d=c;s++;while(s<e.length&&e[s]!==d){if(e[s]==="\\")s++;s++}s++;continue}if(c==="(")l++;else if(c===")")l--;s++}t.push("0"),r=s}return t.join("")}function F(e,t=!1){try{return new Bun.Transpiler(t?{loader:"js",minify:{whitespace:!0,identifiers:!0}}:{loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return e}}function B(){return`
|
|
2
|
+
import x from"fs";import u from"path";import p from"fs";import v from"path";var y=["components","layouts","partials","emails"];function P(e){return e.split(/[\\/]/).filter(Boolean).slice(0,-1).some((a)=>y.includes(a))}function b(e){return P(e.replace(/^\//,""))}function $s(e,t){let a=e.filter((i)=>!b(i.pattern)),r=["// Auto-generated by STX - do not edit"];if(a.length===0)r.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{r.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let i of a){let c=[];for(let l of i.params){let d=i.pattern.includes(`:${l}?`)?"?":"";c.push(`${l}${d}: string`)}let s=c.join("; ");r.push(` '${i.pattern}': { ${s} }`)}r.push(" }","}","","export {}","")}let n=r.join(`
|
|
3
|
+
`),o=v.join(t,"route-types.d.ts");try{if(p.existsSync(o)&&p.readFileSync(o,"utf8")===n)return;p.mkdirSync(t,{recursive:!0}),p.writeFileSync(o,n)}catch{}}function Es(e,t,a){let r=process.cwd(),n=v.relative(r,a),o=e.filter((c)=>!b(c.pattern)),i=["// Auto-generated by stx \u2014 do not edit",`// Source: ${n||"pages"}/`,"","export const routes = ["];for(let c of o){let s=v.relative(r,c.filePath).replace(/\\/g,"/"),l=JSON.stringify(c.params),d=c.layout?`, layout: '${v.relative(r,c.layout).replace(/\\/g,"/")}'`:"";i.push(` { pattern: '${c.pattern}', filePath: '${s}', isDynamic: ${c.isDynamic}, params: ${l}${d} },`)}i.push("] as const",""),i.push("export type RouteName = typeof routes[number]['pattern']",""),p.mkdirSync(t,{recursive:!0}),p.writeFileSync(v.join(t,"routes.ts"),i.join(`
|
|
4
|
+
`))}import D from"path";var N=Object.freeze(["ico","png","jpg","jpeg","gif","webp","avif","svg","bmp","tif","tiff","heic","css","js","mjs","cjs","map","wasm","webmanifest","json","xml","txt","rss","atom","woff","woff2","ttf","otf","eot","mp3","mp4","m4a","m4v","mov","webm","ogg","ogv","oga","wav","flac","avi","mkv","pdf","csv","doc","docx","xls","xlsx","ppt","pptx","rtf","odt","zip","gz","tgz","tar","rar","7z","bz2","xz","php","phtml","asp","aspx","jsp","cgi","env","ini","yml","yaml","toml","sql","bak","old","swp","log","conf","cfg","exe","dmg","pkg","apk","ipa","msi","iso","bin","dll"]),I=N.flatMap((e)=>e===e.toUpperCase()?[e]:[e,e.toUpperCase()]).join("|"),H=new RegExp(`\\.(?:${I})$`),E=`(?![^/]*\\.(?:${I})$)`;function Je(e){let t=e,a=t.search(/[?#]/);if(a!==-1)t=t.slice(0,a);let r=t.slice(t.lastIndexOf("/")+1);return r.length>0&&H.test(r)}function R(e,t){let r=D.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(D.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function K(e,t={}){let a=t.page?E:"",r=[],n="",o=0;while(o<e.length){let i=e.slice(o),c=/^\/:([^/?*]+)\?/.exec(i);if(c){r.push(c[1]);let d=o+c[0].length===e.length;n+=`(?:/${d?a:""}([^/]+))?`,o+=c[0].length;continue}let s=/^:([^/?*]+)\*/.exec(i);if(s){r.push(s[1]),n+="(.+)",o+=s[0].length;continue}let l=/^:([^/?*]+)/.exec(i);if(l){r.push(l[1]);let d=o+l[0].length===e.length;n+=`${d?a:""}([^/]+)`,o+=l[0].length;continue}n+=e[o].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),o+=1}return{regex:new RegExp(`^${n}$`),params:r}}function dn(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let o={};return r.params.forEach((i,c)=>{o[i]=n[c+1]}),{route:r,params:o}}}return null}function Qn(e,t={}){let a=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return K(a,t)}import j from"fs";import L from"path";function _(e,t){let a=[],r=L.dirname(e);while(r.startsWith(t)||r===t){let n=L.join(r,"_layout.stx");if(j.existsSync(n))a.unshift(n);if(r===t)break;r=L.dirname(r)}return a}function F(e,t){let a=[];if(!x.existsSync(e))return a;let r=x.readdirSync(e,{withFileTypes:!0});for(let n of r){let o=u.join(e,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(y.includes(n.name))continue;a.push(...F(o,t))}else if(n.isFile()){let i=u.extname(n.name);if(t.includes(i)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(o)}}}return a}class pn{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let a=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=a.map((s)=>u.resolve(e,s)),this.pagesDir=this.pagesDirs[0];let r=t.extensions||[".stx"],n=(s)=>{let l=u.resolve(e,s);try{return x.realpathSync(l)}catch{return l}},o=(t.exclude??[]).filter((s)=>typeof s==="string"&&s.trim()!=="").map(n),i=(s)=>{if(o.length===0)return!1;let l=n(s);return o.some((d)=>l===d||l.startsWith(`${d}${u.sep}`))},c=new Set;this.routes=[];for(let s of this.pagesDirs){let l=F(s,r).filter((h)=>!i(h)),d=new Map;for(let h of l){let g=R(h,s),m=t.pagesDirs?g.replace(/:[\w]+/g,":param"):g;if(t.pagesDirs&&d.has(m))throw Error(`Conflicting layer pages for ${g}: ${d.get(m)} and ${h}`);if(d.set(m,h),c.has(m))continue;c.add(m);let{regex:G,params:M}=K(g,{page:!0}),C=t.layouts!==!1?_(h,s):[];this.routes.push({pattern:g,regex:G,params:M,filePath:h,isDynamic:M.length>0,layout:C.length>0?C[C.length-1]:void 0})}}if(this.routes.sort((s,l)=>{if(!s.isDynamic&&l.isDynamic)return-1;if(s.isDynamic&&!l.isDynamic)return 1;let d=s.pattern.split("/").length,h=l.pattern.split("/").length;if(d!==h)return h-d;return s.pattern.localeCompare(l.pattern)}),t.emit!==!1){let s=u.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");$s(this.routes,s),Es(this.routes,s,this.pagesDir)}}match(e){let t=e===""?"/":e;for(let a of this.routes){let r=t.match(a.regex);if(r){let n={};return a.params.forEach((o,i)=>{n[o]=r[i+1]}),{route:a,params:n}}}return null}resolve(e,t){let a=this.routes.find((n)=>n.pattern===e||n.filePath.includes(e));if(!a)return"#not-found";let r=a.pattern;if(t)for(let[n,o]of Object.entries(t))r=r.replace(`:${n}`,encodeURIComponent(o));return r}addRoute(e){this.routes.push(e),this.routes.sort((t,a)=>{if(!t.isDynamic&&a.isDynamic)return-1;if(t.isDynamic&&!a.isDynamic)return 1;return t.pattern.localeCompare(a.pattern)})}getLayout(e){return e.layout??null}}function er(e,t){let a=[`${t}.stx`,"error.stx"];for(let r of a){let n=u.join(e,r);if(x.existsSync(n))return n}return null}function tr(e,t){return e.map((a)=>{let r=u.relative(t,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var f={},k="";function wc(e){k=e.replace(/\/$/,"")}function xc(e,t,a={}){f[e]={path:t,name:e,params:a}}function Sc(e){for(let[t,a]of Object.entries(e))if(typeof a==="string")f[t]={path:a,name:t};else f[t]={...a,name:t}}function fn(e,t={},a=!1){let r=f[e];if(!r)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let n={...r.params,...t},o=r.path;o=o.replace(/:(\w+)/g,(c,s)=>{let l=n[s];if(l===void 0)return console.warn(`Missing parameter [${s}] for route [${e}].`),`:${s}`;return delete n[s],encodeURIComponent(String(l))});let i=Object.entries(n);if(i.length>0){let c=i.map(([s,l])=>`${encodeURIComponent(s)}=${encodeURIComponent(String(l))}`).join("&");o+=(o.includes("?")?"&":"?")+c}return a&&k?`${k}${o}`:o}function kc(){for(let e of Object.keys(f))delete f[e];k=""}import B from"fs";import U from"path";function Cc(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function $c(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function Ec(e,t={}){return{handler:e,mode:t.mode??"universal"}}function O(e){let t={};if(!e)return t;let a=e.split(";");for(let r of a){let[n,...o]=r.split("=");if(n){let i=n.trim(),c=o.join("=").trim();if(i)t[i]=decodeURIComponent(c)}}return t}function S(e,t,a={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function xo(e,t){let a=e.headers.get("cookie")||"",r=O(a);return{get(n){return r[n]},set(n,o,i={}){r[n]=o,t.append("Set-Cookie",S(n,o,i))},delete(n){delete r[n],t.append("Set-Cookie",S(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function So(){return{get(e){if(typeof document>"u")return;return O(document.cookie)[e]},set(e,t,a={}){if(typeof document>"u")return;document.cookie=S(e,t,a)},delete(e){if(typeof document>"u")return;document.cookie=S(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return O(document.cookie)}}}function ko(){let e=typeof window<"u"&&typeof window.localStorage<"u";return{get(t){if(!e)return null;try{return window.localStorage.getItem(t)}catch{return null}},set(t,a){if(!e)return;try{window.localStorage.setItem(t,a)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}var w=new Map;function Ts(e,t){w.set(e,t)}function Co(e){return w.get(e)}function Tc(e){return w.has(e)}function Ye(){w.clear()}function Ze(){return Array.from(w.keys())}async function Qe(e,t="middleware"){let a=U.resolve(e,t);if(!B.existsSync(a))return;let r=B.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let o=n.replace(/\.(ts|js)$/,""),i=U.join(a,n);try{let s=(await import(i)).default;if(s&&typeof s.handler==="function")Ts(o,s);else if(typeof s==="function")Ts(o,{handler:s,mode:"universal"})}catch(c){console.warn(`Failed to load middleware '${o}' from ${i}:`,c)}}}function W(e){let t={};if(!e)return t;let a=new URLSearchParams(e);for(let[r,n]of a)t[r]=n;return t}function et(e,t,a,r=""){return{path:e,params:t,query:W(r),fullPath:r?`${e}?${r}`:e,meta:a}}function tt(e,t,a,r){let n=r?.isServer??typeof window>"u",o=!n,i=new Headers;return{to:e,from:t,isClient:o,isServer:n,cookies:n&&a?xo(a,i):So(),storage:ko(),state:{},request:a,responseHeaders:i}}async function nt(e,t){let a=Array.isArray(e)?e:[e],r=t.isServer;for(let n of a){let o=Co(n);if(!o)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(o.mode==="server"&&!r)continue;try{let i=await o.handler(t);if(i){if(i.type==="redirect")return{passed:!1,redirect:i,state:t.state,responseHeaders:t.responseHeaders};if(i.type==="abort")return{passed:!1,abort:i,state:t.state,responseHeaders:t.responseHeaders}}}catch(i){return console.error(`Error in middleware '${n}':`,i),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:i instanceof Error?i.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}function nr(e){let a=e.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function we(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=t?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||nr(n)}}var A,T;function z(e){let t=[],a="log(",r=0;while(r<e.length){let n=e.indexOf("log(",r);if(n===-1){t.push(e.slice(r));break}let o=n>0?e[n-1]:" ",i=/\bfunction\s+$/.test(e.slice(Math.max(0,n-16),n));if(/[\w$.]/.test(o)||i){t.push(e.slice(r,n+4)),r=n+4;continue}t.push(e.slice(r,n));let c=1,s=n+4;while(s<e.length&&c>0){let l=e[s];if(l==='"'||l==="'"||l==="`"){let d=l;s++;while(s<e.length&&e[s]!==d){if(e[s]==="\\")s++;s++}s++;continue}if(l==="(")c++;else if(l===")")c--;s++}t.push("0"),r=s}return t.join("")}function q(e,t=!1){try{return new Bun.Transpiler(t?{loader:"js",minify:{whitespace:!0,identifiers:!0}}:{loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return e}}function X(){return`
|
|
5
5
|
;(function(){
|
|
6
6
|
'use strict';
|
|
7
7
|
var ROUTER_REV=7;
|
|
@@ -3532,4 +3532,4 @@ else {
|
|
|
3532
3532
|
|
|
3533
3533
|
if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
|
|
3534
3534
|
})();
|
|
3535
|
-
`}function
|
|
3535
|
+
`}function xe(){if(A)return A;return A=q(z(X()),!0),A}function _c(){if(T)return T;return T=q(X()),T}export{$s,Es,Je,K,dn,Qn,pn,er,tr,wc,xc,Sc,fn,kc,Cc,$c,Ec,xo,So,ko,Ts,Co,Tc,Ye,Ze,Qe,et,tt,nt,nr,we,xe,_c};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Qt,Ka,Xr}from"./chunk-1680nbq4.js";import"./chunk-xvn3sv3v.js";import"./chunk-fxhvkenf.js";import"./chunk-e2m674vf.js";import"./chunk-vepc9rbt.js";import"./chunk-7q1yy18q.js";import"./chunk-0xgf3xgy.js";import"./chunk-31a8eh0j.js";import{ve}from"./chunk-wweasgq9.js";import"./chunk-vdqa5gt7.js";import"./chunk-bk5ndwv3.js";import"./chunk-76japd6k.js";import"./chunk-865xvpp2.js";export{ve as freeIdentifiers,Xr as processComponents,Ka as processESImports,Qt as rendersAsElement};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ho,nl,Vo,Uo,rl,sl}from"./chunk-94ky725r.js";import"./chunk-1680nbq4.js";import"./chunk-xvn3sv3v.js";import"./chunk-fxhvkenf.js";import"./chunk-e2m674vf.js";import"./chunk-vepc9rbt.js";import"./chunk-7q1yy18q.js";import"./chunk-0xgf3xgy.js";import"./chunk-31a8eh0j.js";import"./chunk-wweasgq9.js";import"./chunk-vdqa5gt7.js";import"./chunk-bk5ndwv3.js";import"./chunk-76japd6k.js";import"./chunk-865xvpp2.js";export{sl as applySlots,rl as extractSlotContent,nl as parseSlotElement,Ho as parseSlots,Uo as processSlots,Vo as renderSlot};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{AsyncLocalStorage as R}from"async_hooks";var b=Symbol.for("stx.runtime-config.scope"),y=globalThis,m=y[b]??=new R;function
|
|
3
|
-
export{
|
|
2
|
+
import{AsyncLocalStorage as R}from"async_hooks";var b=Symbol.for("stx.runtime-config.scope"),y=globalThis,m=y[b]??=new R;function le(n,f){return m.run(n,f)}function kt(){return m.getStore()}function Wn(){let n=m.getStore();if(!n)throw Error("useServerRuntimeConfig requires a server request or template render");return Object.freeze(Object.defineProperty({public:n.public},"private",{value:n.private}))}function gs(){return Wn().public}function S(n={},f=process.env){let s=new Set;function o(e,i){if(i===null)return e===null;if(Array.isArray(i))return Array.isArray(e)&&(!i.length||e.every((r)=>i.some((u)=>o(r,u))));if(typeof i==="object")return e!==null&&typeof e==="object"&&!Array.isArray(e)&&Object.entries(i).every(([r,u])=>Object.hasOwn(e,r)&&o(e[r],u));return typeof e===typeof i}function g(e,i){if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null)throw TypeError(`Runtime config ${i.join(".")} must contain JSON values`);let t=Object.create(null);for(let[c,l]of Object.entries(e)){if(!/^[a-zA-Z][a-zA-Z0-9_]*$/.test(c)||["constructor","prototype","__proto__"].includes(c))throw TypeError(`Invalid runtime config key: ${c}`);t[c]=g(l,[...i,c])}return Object.freeze(t)}let r=`STX_RUNTIME_${i.map((t)=>t.replace(/([a-z0-9])([A-Z])/g,"$1_$2").toUpperCase()).join("__")}`;if(s.has(r))throw TypeError(`Ambiguous runtime config environment key: ${r}`);s.add(r);let u=f[r],a=e;if(u!==void 0){try{a=typeof e==="string"?u:JSON.parse(u)}catch{throw TypeError(`Invalid runtime config override: ${r}`)}if(!o(a,e))throw TypeError(`Wrong runtime config override type: ${r}`)}function p(t){if(t===null||typeof t==="string"||typeof t==="boolean")return t;if(typeof t==="number"&&Number.isFinite(t))return t;if(Array.isArray(t))return Object.freeze(t.map(p));if(t&&typeof t==="object"&&(Object.getPrototypeOf(t)===Object.prototype||Object.getPrototypeOf(t)===null))return Object.freeze(Object.fromEntries(Object.entries(t).map(([c,l])=>[c,p(l)])));throw TypeError(`Runtime config ${i.join(".")} must contain JSON values`)}return p(a)}return Object.freeze({public:g(n.public??{},["public"]),private:g(n.private??{},["private"])})}function C(n){return`<script data-stx-scoped data-stx-runtime-config type="application/json">${JSON.stringify(n.public).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function We(n,f){let s=n.replace(/<script\b[^>]*\bdata-stx-runtime-config\b[^>]*>[\s\S]*?<\/script>/gi,""),o=/<head\b[^>]*>/i.exec(s),g=o?o.index+o[0].length:0;return s.slice(0,g)+C(f)+s.slice(g)}
|
|
3
|
+
export{le,kt,Wn,gs,S,We};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import o from"fs";import u from"path";var h={".html":"includeHtml",".htm":"includeHtml",".js":"includeJs",".mjs":"includeJs",".css":"includeCss",".png":"includeImages",".jpg":"includeImages",".jpeg":"includeImages",".gif":"includeImages",".webp":"includeImages",".svg":"includeImages",".ico":"includeImages",".woff":"includeFonts",".woff2":"includeFonts",".ttf":"includeFonts",".eot":"includeFonts",".otf":"includeFonts"};function p(e){let r=0;for(let t=0;t<e.length;t++){let n=e[t];r=(r<<5)-r+n,r=r&r}return Math.abs(r).toString(16).padStart(8,"0")}function x(e,r){let t=u.basename(e);for(let n of r)if(n.startsWith("*.")){let i=n.slice(1);if(t.endsWith(i))return!0}else if(n.includes("*")){let i=new RegExp(`^${n.replace(/\*/g,".*")}$`);if(i.test(t)||i.test(e))return!0}else if(t===n||e.includes(n))return!0;return!1}function S(e,r,t){let n=u.extname(e).toLowerCase(),i=h[n],c=(t.maxFileSizeKB||500)*1024;if(r>c)return!1;if(t.exclude&&x(e,t.exclude))return!1;if(t.include&&t.include.length>0){for(let s of t.include)if(s.startsWith("*.")){if(e.endsWith(s.slice(1)))return!0}else if(e.includes(s))return!0}if(i&&t[i]===!0)return!0;if(!i)return!1;return!1}function f(e,r,t,n){let i=o.readdirSync(e,{withFileTypes:!0});for(let c of i){let s=u.join(e,c.name);if(c.isDirectory()){if(["node_modules",".git",".stx"].includes(c.name))continue;f(s,r,t,n)}else if(c.isFile()){let a=o.statSync(s),l=u.relative(r,s);if(S(l,a.size,t)){let d=o.readFileSync(s),g=p(d),m=`/${l.replace(/\\/g,"/")}`;n.push({url:m,revision:g,size:a.size})}}}}function
|
|
2
|
+
import o from"fs";import u from"path";var h={".html":"includeHtml",".htm":"includeHtml",".js":"includeJs",".mjs":"includeJs",".css":"includeCss",".png":"includeImages",".jpg":"includeImages",".jpeg":"includeImages",".gif":"includeImages",".webp":"includeImages",".svg":"includeImages",".ico":"includeImages",".woff":"includeFonts",".woff2":"includeFonts",".ttf":"includeFonts",".eot":"includeFonts",".otf":"includeFonts"};function p(e){let r=0;for(let t=0;t<e.length;t++){let n=e[t];r=(r<<5)-r+n,r=r&r}return Math.abs(r).toString(16).padStart(8,"0")}function x(e,r){let t=u.basename(e);for(let n of r)if(n.startsWith("*.")){let i=n.slice(1);if(t.endsWith(i))return!0}else if(n.includes("*")){let i=new RegExp(`^${n.replace(/\*/g,".*")}$`);if(i.test(t)||i.test(e))return!0}else if(t===n||e.includes(n))return!0;return!1}function S(e,r,t){let n=u.extname(e).toLowerCase(),i=h[n],c=(t.maxFileSizeKB||500)*1024;if(r>c)return!1;if(t.exclude&&x(e,t.exclude))return!1;if(t.include&&t.include.length>0){for(let s of t.include)if(s.startsWith("*.")){if(e.endsWith(s.slice(1)))return!0}else if(e.includes(s))return!0}if(i&&t[i]===!0)return!0;if(!i)return!1;return!1}function f(e,r,t,n){let i=o.readdirSync(e,{withFileTypes:!0});for(let c of i){let s=u.join(e,c.name);if(c.isDirectory()){if(["node_modules",".git",".stx"].includes(c.name))continue;f(s,r,t,n)}else if(c.isFile()){let a=o.statSync(s),l=u.relative(r,s);if(S(l,a.size,t)){let d=o.readFileSync(s),g=p(d),m=`/${l.replace(/\\/g,"/")}`;n.push({url:m,revision:g,size:a.size})}}}}function ie(e,r){let t=r.pwa?.precache,n=[];if(!t?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!o.existsSync(e))return{entries:[],totalSize:0,fileCount:0};f(e,e,t,n),n.sort((c,s)=>c.url.localeCompare(s.url));let i=n.reduce((c,s)=>c+s.size,0);return{entries:n,totalSize:i,fileCount:n.length}}function ut(e){if(e.entries.length===0)return"[]";return`[
|
|
3
3
|
${e.entries.map((t)=>` { url: '${t.url}', revision: '${t.revision}' }`).join(`,
|
|
4
4
|
`)}
|
|
5
|
-
]`}function
|
|
6
|
-
export{
|
|
5
|
+
]`}function Or(e){if(e<1024)return`${e} B`;if(e<1048576)return`${(e/1024).toFixed(1)} KB`;return`${(e/1048576).toFixed(2)} MB`}
|
|
6
|
+
export{ie,ut,Or};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
var f=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),b=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);function l(i){return i.replace(/[^\n]/g," ")}function w(i){let o=i.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,l).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,l).replace(/<!--[\s\S]*?-->/g,l).replace(/\{\{\{[\s\S]*?\}\}\}/g,l).replace(/\{\{[\s\S]*?\}\}/g,l).replace(/\{!![\s\S]*?!!\}/g,l),s=new Map,r=new Map,p=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,t;while((t=p.exec(o))!==null){let e=t[1]==="/",n=t[2],a=t[3]==="/";if(f.has(n.toLowerCase()))continue;if(a)continue;if(e)r.set(n,(r.get(n)??0)+1);else{let g=s.get(n);if(g)g.count++;else{let d=o.slice(0,t.index).split(`
|
|
3
|
-
`).length;s.set(n,{count:1,firstLine:d})}}}let c=[];for(let e of new Set([...s.keys(),...r.keys()])){if(b.has(e.toLowerCase()))continue;let n=s.get(e)?.count??0,a=r.get(e)??0;if(n!==a)c.push({tag:e,opened:n,closed:a,firstOpenLine:s.get(e)?.firstLine??0})}return c}var u=new Set;function
|
|
4
|
-
export{
|
|
3
|
+
`).length;s.set(n,{count:1,firstLine:d})}}}let c=[];for(let e of new Set([...s.keys(),...r.keys()])){if(b.has(e.toLowerCase()))continue;let n=s.get(e)?.count??0,a=r.get(e)??0;if(n!==a)c.push({tag:e,opened:n,closed:a,firstOpenLine:s.get(e)?.firstLine??0})}return c}var u=new Set;function _s(i,o){let s;try{s=w(i)}catch{return}if(s.length===0)return;let r=`${o}:${i.length}`;if(u.has(r))return;u.add(r);let p=o?o.split(/[/\\]/).pop()||o:"template";for(let{tag:t,opened:c,closed:e,firstOpenLine:n}of s)if(c>e){let a=n?` (first opened at line ${n})`:"";console.warn(`[stx] ${p}: <${t}> ${c} opened, ${e} closed \u2014 an unclosed <${t}>${a} may swallow the content that follows it.`)}else console.warn(`[stx] ${p}: <${t}> ${c} opened, ${e} closed \u2014 ${e-c} stray </${t}>.`)}
|
|
4
|
+
export{_s};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{xt,Qr,Vi,oc}from"./chunk-1680nbq4.js";import"./chunk-xvn3sv3v.js";import"./chunk-fxhvkenf.js";import"./chunk-e2m674vf.js";import"./chunk-vepc9rbt.js";import"./chunk-7q1yy18q.js";import"./chunk-0xgf3xgy.js";import"./chunk-31a8eh0j.js";import"./chunk-wweasgq9.js";import"./chunk-vdqa5gt7.js";import"./chunk-bk5ndwv3.js";import"./chunk-76japd6k.js";import"./chunk-865xvpp2.js";export{oc as declareBareLoopHead,xt as parseLoopBinding,Vi as processLoops,Qr as reportDeferredLoopWarnings};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{p,l}from"./chunk-
|
|
3
|
-
export{
|
|
2
|
+
import{p,l}from"./chunk-wweasgq9.js";import{h}from"./chunk-1680nbq4.js";function y(t,o){let i=1,r=o,e="<template",n="</template";while(r<t.length&&i>0){let s=t.indexOf("<",r);if(s===-1)break;if(r=s,t.startsWith(e,r)&&(r+e.length>=t.length||/[\s>\/]/.test(t[r+e.length]))){i++,r+=e.length;continue}if(t.startsWith(n,r)){let a=t.indexOf(">",r+n.length);if(a!==-1){if(i--,i===0)return a+1;r=a+1;continue}}r++}return i===0?r:-1}var x=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function b(t,o){let i=null;for(let r=o;r<t.length;r++){let e=t[r];if(i){if(e==="\\"){r++;continue}if(e===i)i=null;continue}if(e==='"'||e==="'"){i=e;continue}if(e===">")return r+1}return-1}function N(t,o,i){let r=o.toLowerCase(),e=1,n=i;while(n<t.length){let s=t.indexOf("<",n);if(s===-1)return-1;if(t.startsWith("<!--",s)){let g=t.indexOf("-->",s+4);n=g===-1?t.length:g+3;continue}let a=b(t,s+1);if(a===-1)return-1;let f=t.slice(s,a),u=f.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(u&&u[2].toLowerCase()===r){if(u[1]==="/"){if(e--,e===0)return a}else if(!/\/\s*>$/.test(f))e++}n=a}return-1}function A(t){let o=[],i=[],r=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let c=t.indexOf("-->",n+4);e=c===-1?t.length:c+3;continue}let s=b(t,n+1);if(s===-1)break;let a=t.slice(n,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){e=s;continue}let u=f[2].toLowerCase();if(f[1]==="/"){let c=i.lastIndexOf(u);if(c!==-1)i.splice(c);e=s;continue}let g=/\/\s*>$/.test(a),d=i.length===0?a.match(r):null;if(d){let c=d[1]||d[2],m=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),S=g||x.has(u)?-1:N(t,u,s);if(S===-1)o.push({start:n,end:s,slotName:c,element:m}),e=s;else o.push({start:n,end:S,slotName:c,element:m+t.slice(s,S)}),e=S;continue}if(!g&&!x.has(u)){if(i.push(u),u==="script"||u==="style"){let c=t.toLowerCase().indexOf(`</${u}>`,s);if(c!==-1){e=c;continue}}}e=s}return o}function O(t){let o=[],i=[],r=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let c=t.indexOf("-->",n+4);e=c===-1?t.length:c+3;continue}let s=b(t,n+1);if(s===-1)break;let a=t.slice(n,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){e=s;continue}let u=f[1]==="/",g=f[2].toLowerCase();if(u){let c=i.lastIndexOf(g);if(c!==-1)i.splice(c);e=s;continue}if(g==="template"&&i.length===0){let c=a.match(r);if(c){let m=y(t,s);if(m!==-1){let S=c[1]||c[2]||c[3];o.push({start:n,end:m,slotName:S,content:t.slice(s,m-11).trim(),propsBinding:c[4]||void 0}),e=m;continue}}}if(!/\/\s*>$/.test(a)&&!x.has(g)){if(i.push(g),g==="script"||g==="style"){let c=t.toLowerCase().indexOf(`</${g}>`,s);if(c!==-1){e=c;continue}}}e=s}return o}function Ho(t){let o={default:"",named:new Map},i=t,r=O(t);for(let n of r)o.named.set(n.slotName,{name:n.slotName,content:n.content,propsBinding:n.propsBinding});r.sort((n,s)=>s.start-n.start);for(let n of r)i=i.slice(0,n.start)+i.slice(n.end);let e=A(i);for(let n of e){let s=o.named.get(n.slotName);if(s)s.content+=n.element;else o.named.set(n.slotName,{name:n.slotName,content:n.element})}for(let n=e.length-1;n>=0;n--){let s=e[n];i=i.slice(0,s.start)+i.slice(s.end)}return o.default=i.trim(),o}function nl(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),i=o?o[1]:"",r={},e=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,n;while((n=e.exec(t))!==null)r[n[1]]=n[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),a=s?s[1].trim():"";return{name:i,props:r,defaultContent:a}}async function Vo(t,o,i,r){if(!t)return i;let e=t.content;if(t.propsBinding&&Object.keys(o).length>0){let n=t.propsBinding.trim(),s={...r};if(n.startsWith("{")&&n.endsWith("}")){let a=n.slice(1,-1).split(",").map((f)=>f.trim()).filter(Boolean);for(let f of a){let[u,g]=f.split(":").map((c)=>c.trim()),d=g||u;if(o[u]!==void 0)s[d]=o[u]}}else s[n]=o;e=C(e,s)}return e}function C(t,o){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(i,r)=>{try{let e=r.trim(),n=k(e,o);return h(String(n??""))}catch{return`{{ ${r} }}`}})}function k(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let r=t.split("."),e=o;for(let n of r)if(e&&typeof e==="object"&&n in e)e=e[n];else return;return e}let i=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(i){let[,r,e,n]=i,s=o[r],a=parseInt(n,10);if(typeof s==="number")switch(e){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":return s/a}}try{if(!p(t))return;return l(t,Object.keys(o))(...Object.values(o))}catch{return}}async function Uo(t,o,i){let r=t;r=await M(r,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(s,a,f,u)=>{let g=o.named.get(a),d=u?.trim()||"",c=f||"",m={},S=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,w;while((w=S.exec(c))!==null){let E=w[1],R=w[2];m[E]=k(R,i)}return await Vo(g,m,d,i)});let n=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return r=r.replace(n,(s,a,f)=>{if(/\bname\s*=/.test(a||""))return s;let u=f?.trim()||"";return o.default||u}),r}async function M(t,o,i){let r=[],e=[];t.replace(o,(a,...f)=>{let u=f[f.length-2];return e.push({match:a,index:u}),r.push(i(a,...f.slice(0,-2))),a});let n=await Promise.all(r),s=t;for(let a=e.length-1;a>=0;a--){let{match:f,index:u}=e[a];s=s.slice(0,u)+n[a]+s.slice(u+f.length)}return s}function rl(t){let o=Ho(t);return{defaultSlot:o.default,namedSlots:o.named}}async function sl(t,o,i,r){return await Uo(t,{default:o,named:i},r)}
|
|
3
|
+
export{Ho,nl,Vo,Uo,rl,sl};
|