@stacksjs/stx 0.2.764 → 0.2.769
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-096g00ba.js +2 -0
- package/dist/chunk-0ga7sn1k.js +2 -0
- package/dist/{chunk-admzbntt.js → chunk-0hf0mtaf.js} +2 -2
- package/dist/{chunk-31e7xkrt.js → chunk-0nhk9p9r.js} +1 -1
- package/dist/{chunk-scq0h2cs.js → chunk-1a4vpk9x.js} +2 -2
- package/dist/{chunk-85w2y7fy.js → chunk-1e67szzk.js} +4 -4
- package/dist/chunk-1nzg53pv.js +2 -0
- package/dist/chunk-1respkkp.js +2 -0
- package/dist/{chunk-w2nzevn0.js → chunk-20dsfgmq.js} +1 -1
- package/dist/{chunk-6h6teyxp.js → chunk-2bb4g9qr.js} +2 -2
- package/dist/{chunk-6eds5zjz.js → chunk-2w16z2y1.js} +2 -2
- package/dist/{chunk-rntegv4f.js → chunk-30kemrry.js} +5 -5
- package/dist/{chunk-cge03y9d.js → chunk-33jagtss.js} +2 -2
- package/dist/{chunk-as4s0nf5.js → chunk-342e6mhn.js} +3 -3
- package/dist/{chunk-n8gfetjx.js → chunk-3g8cnsbk.js} +2 -2
- package/dist/chunk-3k6tem86.js +2 -0
- package/dist/chunk-3pma2q0h.js +2 -0
- package/dist/chunk-4cr8bep2.js +2 -0
- package/dist/chunk-4ew0291t.js +2 -0
- package/dist/{chunk-b6dtw4j0.js → chunk-4qrr2mdd.js} +89 -88
- package/dist/{chunk-et831a4y.js → chunk-4rtr07x9.js} +2 -2
- package/dist/{chunk-t92f0qnk.js → chunk-528b302x.js} +3 -3
- package/dist/{chunk-6jnrpnxb.js → chunk-586xes7a.js} +2 -2
- package/dist/{chunk-zq5c0enz.js → chunk-5fab5wt2.js} +2 -2
- package/dist/chunk-5ftthxab.js +2 -0
- package/dist/{chunk-4b6dtyd7.js → chunk-5q97egpw.js} +45 -45
- package/dist/chunk-5wp7s24b.js +3 -0
- package/dist/{chunk-1w4a0xya.js → chunk-7s9wx19m.js} +3 -3
- package/dist/{chunk-mdtjjzqc.js → chunk-7vqq2w3x.js} +2 -2
- package/dist/{chunk-3mf27gj6.js → chunk-80gg1k0h.js} +2 -2
- package/dist/{chunk-b62g7wvg.js → chunk-8x4gmead.js} +5 -5
- package/dist/{chunk-a3azc16d.js → chunk-90n5kb78.js} +3 -3
- package/dist/chunk-9v21mwfs.js +2 -0
- package/dist/{chunk-43fhjxxj.js → chunk-9y6hbdfh.js} +4 -4
- package/dist/{chunk-r6ajkw2d.js → chunk-a81m2ewb.js} +2 -2
- package/dist/chunk-b6kfq08s.js +2 -0
- package/dist/chunk-b94xf9vs.js +2 -0
- package/dist/chunk-bjggcj45.js +2 -0
- package/dist/chunk-bk3b5jyw.js +2 -0
- package/dist/chunk-bntw35k0.js +2 -0
- package/dist/chunk-bt01gdaj.js +2 -0
- package/dist/chunk-ctmadzad.js +2 -0
- package/dist/chunk-cwmjqker.js +2 -0
- package/dist/{chunk-nr5qsgcw.js → chunk-cyd10m6m.js} +3 -3
- package/dist/{chunk-ay02q27h.js → chunk-cz3trbvn.js} +6 -6
- package/dist/{chunk-p42kp93g.js → chunk-dbpzrkmj.js} +1 -1
- package/dist/chunk-dbx628ra.js +2 -0
- package/dist/{chunk-qp0v9b0h.js → chunk-ddpt7ejx.js} +3 -3
- package/dist/chunk-ddwsms1t.js +2 -0
- package/dist/chunk-dpjf62qw.js +2 -0
- package/dist/chunk-e4bsnxsj.js +2 -0
- package/dist/{chunk-nzety7kj.js → chunk-ecakhzkq.js} +7 -7
- package/dist/{chunk-qf0z03k8.js → chunk-enzrpxsj.js} +2 -2
- package/dist/chunk-f8jwrvky.js +2 -0
- package/dist/{chunk-8hanmv49.js → chunk-fxy7jjnv.js} +29 -2
- package/dist/{chunk-47t7qsfy.js → chunk-ggvnmmv3.js} +2 -2
- package/dist/chunk-h8yy3y3p.js +2 -0
- package/dist/chunk-hddwx35m.js +2 -0
- package/dist/{chunk-mpaepc7n.js → chunk-hpdb8vkt.js} +78 -8
- package/dist/{chunk-8ge1y01k.js → chunk-hxyarbb6.js} +1 -1
- package/dist/chunk-hyqsvw1b.js +2 -0
- package/dist/{chunk-stww901w.js → chunk-j34wqxb1.js} +5 -5
- package/dist/{chunk-fta169tc.js → chunk-j5dd5ncz.js} +2 -2
- package/dist/chunk-j835421z.js +2 -0
- package/dist/{chunk-0d29b573.js → chunk-jd84zgn3.js} +2 -2
- package/dist/{chunk-42kjqjst.js → chunk-jgmmg2fw.js} +4 -4
- package/dist/{chunk-74y29xxs.js → chunk-knvt4bap.js} +4 -4
- package/dist/{chunk-54nknqzx.js → chunk-mg38q3jh.js} +5 -5
- package/dist/chunk-mhc72pp2.js +2 -0
- package/dist/{chunk-nj5azxxj.js → chunk-mkk8k3nd.js} +4 -4
- package/dist/{chunk-1day2nbr.js → chunk-msy46ges.js} +3 -3
- package/dist/{chunk-zfbekcnz.js → chunk-napd81ht.js} +3 -3
- package/dist/{chunk-c1b481my.js → chunk-nrh8t8re.js} +2 -2
- package/dist/{chunk-r3as289z.js → chunk-nsxg0t06.js} +1 -1
- package/dist/{chunk-14wn1c3t.js → chunk-p66fgjeb.js} +1 -1
- package/dist/{chunk-0nzeqc13.js → chunk-p7cvn8q9.js} +2 -2
- package/dist/{chunk-vkpmemb1.js → chunk-p7h4y7mk.js} +1 -1
- package/dist/chunk-phjfsm8d.js +2 -0
- package/dist/chunk-pts7jpqc.js +2 -0
- package/dist/{chunk-qv99gqee.js → chunk-py818vbj.js} +1 -1
- package/dist/{chunk-twmj9qv5.js → chunk-pzt3g2m0.js} +1 -1
- package/dist/{chunk-fyv2pjrx.js → chunk-q69dvpg1.js} +1 -1
- package/dist/chunk-qcjtfrzm.js +2 -0
- package/dist/{chunk-v2yd11zy.js → chunk-qdysx0fd.js} +5 -5
- package/dist/{chunk-3ffz7pd4.js → chunk-qr6jyd08.js} +1 -1
- package/dist/{chunk-ntf433nb.js → chunk-r3qez0ph.js} +14 -14
- package/dist/{chunk-9hbvt06e.js → chunk-rfzfk8zd.js} +6 -6
- package/dist/{chunk-sd3b6swd.js → chunk-rj9dcjeg.js} +1 -1
- package/dist/{chunk-6nm3h2vw.js → chunk-rk2v0wzs.js} +3 -3
- package/dist/chunk-rqpktvkn.js +2 -0
- package/dist/chunk-s1a69a8q.js +2 -0
- package/dist/{chunk-q0rfq81t.js → chunk-s5kfndxv.js} +2 -2
- package/dist/{chunk-dphhs29v.js → chunk-s6ss1qnq.js} +2 -2
- package/dist/chunk-spmbnchd.js +2 -0
- package/dist/{chunk-csddc2st.js → chunk-svrjbeyq.js} +1 -1
- package/dist/chunk-t1gk6y8z.js +2 -0
- package/dist/chunk-t3cdnbq1.js +2 -0
- package/dist/chunk-t96gj0ey.js +2 -0
- package/dist/{chunk-sja3ntnh.js → chunk-tykyhmyx.js} +1 -1
- package/dist/chunk-vcks4gwd.js +2 -0
- package/dist/chunk-vg6p0zst.js +2 -0
- package/dist/chunk-vjsyf8m1.js +2 -0
- package/dist/{chunk-2mckhfet.js → chunk-vp8sjx6w.js} +5 -5
- package/dist/chunk-vq88tjma.js +2 -0
- package/dist/chunk-vqa2s0v4.js +2 -0
- package/dist/chunk-wtqj99tg.js +2 -0
- package/dist/{chunk-fq3cdhc5.js → chunk-xj1k9bx9.js} +2 -2
- package/dist/chunk-xqa8f03q.js +2 -0
- package/dist/chunk-y7a0y5jq.js +2 -0
- package/dist/chunk-ydj0r3kw.js +2 -0
- package/dist/chunk-ydq170j1.js +2 -0
- package/dist/chunk-yz30cgyx.js +2 -0
- package/dist/{chunk-xmym6tre.js → chunk-yz85drm8.js} +1 -1
- package/dist/{chunk-4h3agcnm.js → chunk-zg43k117.js} +2 -2
- package/dist/{chunk-m3dr63n0.js → chunk-zj32s5na.js} +2 -2
- package/dist/{chunk-m15nbvck.js → chunk-zmesddf4.js} +1 -1
- package/dist/{chunk-dvh63p75.js → chunk-znhzrjbm.js} +2 -2
- package/dist/{chunk-zs8yjtaz.js → chunk-zv924m9g.js} +5 -5
- package/dist/cli.js +11 -11
- package/dist/client/signals-for-runtime.js +2 -0
- package/dist/client/signals-if-runtime.js +2 -0
- package/dist/client/signals-loop-conditional-runtime.js +66 -0
- package/dist/component-contract-checks.js +3 -2
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/expressions.js +15 -0
- package/dist/native/event-names.js +2 -0
- package/dist/native/prop-names.js +2 -0
- package/dist/process.js +1 -1
- package/dist/pwa.js +3 -3
- package/dist/signal-processing.d.ts +12 -0
- package/dist/signal-processing.js +12 -1
- package/dist/ssg.js +2 -2
- package/dist/utils.js +14 -2
- package/package.json +5 -5
- package/dist/chunk-0f5276fm.js +0 -2
- package/dist/chunk-0kjc72hk.js +0 -2
- package/dist/chunk-16n128gh.js +0 -2
- package/dist/chunk-171bbyqv.js +0 -2
- package/dist/chunk-1g0g498y.js +0 -2
- package/dist/chunk-1z77g0j6.js +0 -2
- package/dist/chunk-209vqf2d.js +0 -2
- package/dist/chunk-2bd3b7tx.js +0 -2
- package/dist/chunk-33ysd18c.js +0 -2
- package/dist/chunk-34jqhv4k.js +0 -2
- package/dist/chunk-3a5nc7pm.js +0 -2
- package/dist/chunk-4bhbtvtm.js +0 -2
- package/dist/chunk-54kxajmw.js +0 -2
- package/dist/chunk-59r38w60.js +0 -2
- package/dist/chunk-62c6mgyp.js +0 -2
- package/dist/chunk-65h2h51z.js +0 -2
- package/dist/chunk-6baywk2t.js +0 -2
- package/dist/chunk-8k3q3ggt.js +0 -2
- package/dist/chunk-aav6t96n.js +0 -2
- package/dist/chunk-bnm7ym0g.js +0 -2
- package/dist/chunk-brg2ydrk.js +0 -2
- package/dist/chunk-c8256r1a.js +0 -2
- package/dist/chunk-evbxyw80.js +0 -2
- package/dist/chunk-f66n66c8.js +0 -2
- package/dist/chunk-fh1hw4zy.js +0 -2
- package/dist/chunk-gaatje2g.js +0 -2
- package/dist/chunk-m8mfav9s.js +0 -2
- package/dist/chunk-mkfd752v.js +0 -2
- package/dist/chunk-mpr6m0tj.js +0 -2
- package/dist/chunk-mya7gawb.js +0 -2
- package/dist/chunk-n9zka6dg.js +0 -2
- package/dist/chunk-pvx57vpw.js +0 -2
- package/dist/chunk-qgvez75f.js +0 -2
- package/dist/chunk-qhgzkpz0.js +0 -2
- package/dist/chunk-r0j6jkxc.js +0 -2
- package/dist/chunk-rafkhe18.js +0 -2
- package/dist/chunk-rfh99ndp.js +0 -2
- package/dist/chunk-rzv9xcyp.js +0 -2
- package/dist/chunk-sy4wqxta.js +0 -2
- package/dist/chunk-vvhdt94w.js +0 -2
- package/dist/chunk-vvj09a7b.js +0 -2
- package/dist/chunk-wadp2rmj.js +0 -2
- package/dist/chunk-wcj1zf73.js +0 -2
- package/dist/chunk-wwd9yfkq.js +0 -2
- package/dist/chunk-y0mdsbdx.js +0 -2
- package/dist/chunk-yvg3njph.js +0 -2
- package/dist/chunk-yy0edrwz.js +0 -3
- package/dist/chunk-z5zr9qrm.js +0 -2
- package/dist/chunk-zgkkfb7f.js +0 -2
|
@@ -56,6 +56,6 @@ ${it.join(`
|
|
|
56
56
|
</body>
|
|
57
57
|
</html>`}var pe=/\s+/y,fe=/<(script|style)\b[^>]*>/iy,Wt=/<\/script>/gi,Xt=/<\/style>/gi,je=/<!DOCTYPE\b/iy,ze=/<html[\s>]/iy;function Sn(e){let n=0;while(n<e.length){if(pe.lastIndex=n,pe.exec(e)){n=pe.lastIndex;continue}if(e.startsWith("<!--",n)){let s=e.indexOf("-->",n);if(s===-1)return!1;n=s+3;continue}fe.lastIndex=n;let i=fe.exec(e);if(i){let s=i[1].toLowerCase()==="script"?Wt:Xt;s.lastIndex=fe.lastIndex;let o=s.exec(e);if(o===null)return!1;n=o.index+o[0].length;continue}if(je.lastIndex=n,je.test(e))return!0;return ze.lastIndex=n,ze.test(e)}return!1}function ki(e){return Sn(e)}function rl(e,n={}){let r=e.lastIndexOf("</head>");if(r===-1)return e;let{meta:i=[],link:s=[],script:o=[],headRaw:a=""}=n,l=e.slice(0,r),p=[];for(let g of i){let h=ot(g);if(h&&l.includes(h))continue;p.push(` <meta ${_(g)}>`)}for(let g of s){if(g.href&&l.includes(`href="${g.href}"`))continue;p.push(` <link ${_(g)}>`)}for(let g of o)if(g.src){if(l.includes(`src="${g.src}"`))continue;p.push(` <script ${_(g,(h)=>h==="content")}></script>`)}else if(g.content){if(l.includes(W(g)))continue;p.push(` ${We(g)}`)}if(a&&!l.includes(a))p.push(` ${a}`);if(p.length===0)return e;return`${e.slice(0,r)}${p.join(`
|
|
58
58
|
`)}
|
|
59
|
-
${e.slice(r)}`}function Rr(e,n={},r={},i){if(i??ki(e))return e;return Vt(e,n,r)}var Kt=["og:","article:","book:","profile:","fb:","music:","video:"],qt=/^[a-z][\w-]*(?::[\w:-]+)?$/i;function Ar(e,n){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 r=Gt(e[0],n);if(typeof r!=="string")return r;let i;if(e.length===2){let o=Yt(e[1],n);if(typeof o!=="string")return o;i=o}else{let o=r.includes(":")?r.slice(r.indexOf(":")+1):r,a=n.openGraph,l=n[o]??(st(a)?a[o]:void 0);i=l===void 0||l===null||typeof l==="object"?"":String(l)}if(!i)return{kind:"empty"};return{kind:"tag",tag:Kt.some((o)=>r.startsWith(o))?{property:r,content:i}:{name:r,content:i}}}function Gt(e,n){let r=ce(e);if(r!==null)return r.trim()?r:{kind:"error",message:"the meta name is empty",code:t.INVALID_DIRECTIVE_SYNTAX};if(qt.test(e.trim()))return e.trim();let i=Ft(e,n);if(!i.ok)return{kind:"error",message:`meta name: ${i.message}`,code:i.code};if(typeof i.value!=="string"||!i.value.trim())return{kind:"error",message:`the meta name must be a non-empty string, got ${He(i.value)}`,code:t.TYPE_ERROR};return i.value}function Yt(e,n){let r=ce(e);if(r!==null)return r;let i=Ft(e,n);if(!i.ok)return{kind:"error",message:i.message,code:i.code};let s=i.value;if(s===void 0||s===null||s===!1)return"";if(Array.isArray(s))return s.filter((o)=>o!==void 0&&o!==null&&o!=="").map(String).join(", ");if(typeof s==="object"&&!(s instanceof Date))return{kind:"error",message:`the content must be text, got ${He(s)}`,code:t.TYPE_ERROR};return String(s)}var Pr=["title","lang","meta","link","script","headRaw","htmlAttrs","bodyClass","bodyAttrs"],qs=["title","titleTemplate","base","meta","link","script","style","htmlAttrs","bodyAttrs"],qe={links:"link",metas:"meta",scripts:"script",styles:"style"},Xe=new Set,Ke=new WeakMap;function de(e){if(Xe.has(e))return;Xe.add(e),console.warn(e)}function Jt(e,n){let r=Array.from({length:n.length+1},(i,s)=>s);for(let i=1;i<=e.length;i++){let s=r[0];r[0]=i;for(let o=1;o<=n.length;o++){let a=r[o];r[o]=Math.min(r[o]+1,r[o-1]+1,s+(e[i-1]===n[o-1]?0:1)),s=a}}return r[n.length]}function Zt(e,n){let r=e.toLowerCase(),i=n.find((p)=>p.toLowerCase()===r);if(i)return i;let s=qe[r];if(s&&n.includes(s))return s;let o,a=1/0;for(let p of n){let g=Jt(r,p.toLowerCase());if(g<a)o=p,a=g}let l=Math.min(e.length,o?.length??0)<=4?1:2;return a<=l?o:void 0}function _e(e,n){if(!e||typeof e!=="object"||Array.isArray(e))return e||{};let r=Ke.get(e);if(r)return r;let{known:i,source:s}=n,o=e;for(let a of Object.keys(e)){if(i.includes(a))continue;let l=qe[a];if(l&&i.includes(l)&&Array.isArray(e[a])){if(o===e)o={...e};let g=Array.isArray(o[l])?o[l]:[];o[l]=[...g,...e[a]],delete o[a],de(`[stx] ${s}.${a} is not a head key; reading it as ${s}.${l}. Rename it to \`${l}\`.`);continue}if(/^styles?$/.test(a)&&!i.includes("style")){de(`[stx] ${s}.${a} is not a head key and is ignored. Use \`link\` with rel: 'stylesheet', or \`headRaw\` for an inline <style>.`);continue}let p=Zt(a,i);de(p?`[stx] ${s}.${a} is not a head key and is ignored. Did you mean \`${p}\`?`:`[stx] ${s}.${a} is not a head key and is ignored. Known keys: ${i.join(", ")}.`)}return Ke.set(e,o),o}var T={},Qt=[],X={};function _i(){return T}function
|
|
60
|
-
`)}function
|
|
61
|
-
`,"")),headContent:n.trim()}}function
|
|
59
|
+
${e.slice(r)}`}function Rr(e,n={},r={},i){if(i??ki(e))return e;return Vt(e,n,r)}var Kt=["og:","article:","book:","profile:","fb:","music:","video:"],qt=/^[a-z][\w-]*(?::[\w:-]+)?$/i;function Ar(e,n){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 r=Gt(e[0],n);if(typeof r!=="string")return r;let i;if(e.length===2){let o=Yt(e[1],n);if(typeof o!=="string")return o;i=o}else{let o=r.includes(":")?r.slice(r.indexOf(":")+1):r,a=n.openGraph,l=n[o]??(st(a)?a[o]:void 0);i=l===void 0||l===null||typeof l==="object"?"":String(l)}if(!i)return{kind:"empty"};return{kind:"tag",tag:Kt.some((o)=>r.startsWith(o))?{property:r,content:i}:{name:r,content:i}}}function Gt(e,n){let r=ce(e);if(r!==null)return r.trim()?r:{kind:"error",message:"the meta name is empty",code:t.INVALID_DIRECTIVE_SYNTAX};if(qt.test(e.trim()))return e.trim();let i=Ft(e,n);if(!i.ok)return{kind:"error",message:`meta name: ${i.message}`,code:i.code};if(typeof i.value!=="string"||!i.value.trim())return{kind:"error",message:`the meta name must be a non-empty string, got ${He(i.value)}`,code:t.TYPE_ERROR};return i.value}function Yt(e,n){let r=ce(e);if(r!==null)return r;let i=Ft(e,n);if(!i.ok)return{kind:"error",message:i.message,code:i.code};let s=i.value;if(s===void 0||s===null||s===!1)return"";if(Array.isArray(s))return s.filter((o)=>o!==void 0&&o!==null&&o!=="").map(String).join(", ");if(typeof s==="object"&&!(s instanceof Date))return{kind:"error",message:`the content must be text, got ${He(s)}`,code:t.TYPE_ERROR};return String(s)}var Pr=["title","lang","meta","link","script","headRaw","htmlAttrs","bodyClass","bodyAttrs"],qs=["title","titleTemplate","base","meta","link","script","style","htmlAttrs","bodyAttrs"],qe={links:"link",metas:"meta",scripts:"script",styles:"style"},Xe=new Set,Ke=new WeakMap;function de(e){if(Xe.has(e))return;Xe.add(e),console.warn(e)}function Jt(e,n){let r=Array.from({length:n.length+1},(i,s)=>s);for(let i=1;i<=e.length;i++){let s=r[0];r[0]=i;for(let o=1;o<=n.length;o++){let a=r[o];r[o]=Math.min(r[o]+1,r[o-1]+1,s+(e[i-1]===n[o-1]?0:1)),s=a}}return r[n.length]}function Zt(e,n){let r=e.toLowerCase(),i=n.find((p)=>p.toLowerCase()===r);if(i)return i;let s=qe[r];if(s&&n.includes(s))return s;let o,a=1/0;for(let p of n){let g=Jt(r,p.toLowerCase());if(g<a)o=p,a=g}let l=Math.min(e.length,o?.length??0)<=4?1:2;return a<=l?o:void 0}function _e(e,n){if(!e||typeof e!=="object"||Array.isArray(e))return e||{};let r=Ke.get(e);if(r)return r;let{known:i,source:s}=n,o=e;for(let a of Object.keys(e)){if(i.includes(a))continue;let l=qe[a];if(l&&i.includes(l)&&Array.isArray(e[a])){if(o===e)o={...e};let g=Array.isArray(o[l])?o[l]:[];o[l]=[...g,...e[a]],delete o[a],de(`[stx] ${s}.${a} is not a head key; reading it as ${s}.${l}. Rename it to \`${l}\`.`);continue}if(/^styles?$/.test(a)&&!i.includes("style")){de(`[stx] ${s}.${a} is not a head key and is ignored. Use \`link\` with rel: 'stylesheet', or \`headRaw\` for an inline <style>.`);continue}let p=Zt(a,i);de(p?`[stx] ${s}.${a} is not a head key and is ignored. Did you mean \`${p}\`?`:`[stx] ${s}.${a} is not a head key and is ignored. Known keys: ${i.join(", ")}.`)}return Ke.set(e,o),o}var T={},Qt=[],X={};function _i(){return T}function Gh(){return X}function Jh(){T={},Qt.length=0,X={}}function sl(e){T=Ve(T,_e(e,{known:qs,source:"useHead()"}))}function Ge(e,n,r){let i=[...e||[]];for(let s of n||[]){let o=r(s),a=o?i.findIndex((l)=>r(l)===o):-1;if(a<0)i.push(s);else i[a]=s}return i}function Ve(e,n){return{title:n.title??e.title,titleTemplate:n.titleTemplate??e.titleTemplate,base:n.base??e.base,meta:Ge(e.meta,n.meta,(r)=>r.name||r.property||(r.httpEquiv?`http:${r.httpEquiv}`:void 0)),link:Ge(e.link,n.link,(r)=>["icon","apple-touch-icon","canonical"].includes(r.rel||"")?[r.rel,r.type,r.media,r.sizes].join(":"):void 0),script:[...e.script||[],...n.script||[]],style:[...e.style||[],...n.style||[]],htmlAttrs:{...e.htmlAttrs,...n.htmlAttrs},bodyAttrs:{...e.bodyAttrs,...n.bodyAttrs}}}function gg(e){sl(Ks(e))}function Ks(e){let n=[];if(e.description)n.push({name:"description",content:e.description});if(e.keywords){let p=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;n.push({name:"keywords",content:p})}if(e.author)n.push({name:"author",content:e.author});if(e.robots)n.push({name:"robots",content:e.robots});let r=e.ogTitle??e.title,i=e.ogDescription??e.description;if(r)n.push({property:"og:title",content:r});if(i)n.push({property:"og:description",content:i});if(e.ogImage){if(n.push({property:"og:image",content:e.ogImage}),e.ogImageType)n.push({property:"og:image:type",content:e.ogImageType});if(e.ogImageWidth)n.push({property:"og:image:width",content:String(e.ogImageWidth)});if(e.ogImageHeight)n.push({property:"og:image:height",content:String(e.ogImageHeight)});if(e.ogImageAlt)n.push({property:"og:image:alt",content:e.ogImageAlt})}if(e.ogUrl)n.push({property:"og:url",content:e.ogUrl});if(e.ogType)n.push({property:"og:type",content:e.ogType});if(e.ogSiteName)n.push({property:"og:site_name",content:e.ogSiteName});if(e.ogLocale)n.push({property:"og:locale",content:e.ogLocale});if(e.profileFirstName)n.push({property:"profile:first_name",content:e.profileFirstName});if(e.profileLastName)n.push({property:"profile:last_name",content:e.profileLastName});if(e.profileUsername)n.push({property:"profile:username",content:e.profileUsername});let s=e.twitterTitle??e.title,o=e.twitterDescription??e.description,a=e.twitterImage??e.ogImage;if(e.twitterCard)n.push({name:"twitter:card",content:e.twitterCard});if(s)n.push({name:"twitter:title",content:s});if(o)n.push({name:"twitter:description",content:o});if(a){n.push({name:"twitter:image",content:a});let p=e.twitterImageAlt??(e.twitterImage?void 0:e.ogImageAlt);if(p)n.push({name:"twitter:image:alt",content:p})}if(e.twitterSite)n.push({name:"twitter:site",content:e.twitterSite});if(e.twitterCreator)n.push({name:"twitter:creator",content:e.twitterCreator});if(e.articleAuthor)n.push({property:"article:author",content:e.articleAuthor});if(e.articlePublishedTime)n.push({property:"article:published_time",content:e.articlePublishedTime});if(e.articleModifiedTime)n.push({property:"article:modified_time",content:e.articleModifiedTime});if(e.articleSection)n.push({property:"article:section",content:e.articleSection});if(e.articleTags)for(let p of e.articleTags)n.push({property:"article:tag",content:p});let l=[];if(e.canonical)l.push({rel:"canonical",href:e.canonical});return{title:e.title,titleTemplate:e.titleTemplate,meta:n,link:l}}function Yh(e){if(X={...X,...e},e.title||e.description)gg({title:e.title,description:e.description})}function Zh(e){let n=typeof e==="function"?e():e;sl({title:n})}function Qh(e=T){let n=[];if(e.title){let r=e.title;if(e.titleTemplate)r=typeof e.titleTemplate==="function"?e.titleTemplate(r):e.titleTemplate.replace("%s",r);n.push(`<title>${I(r)}</title>`)}if(e.base){let r=Object.entries(e.base).map(([i,s])=>`${i}="${I(s)}"`).join(" ");n.push(`<base ${r}>`)}for(let r of e.meta||[]){let i=Object.entries(r).filter(([s,o])=>o!==void 0).map(([s,o])=>`${s==="httpEquiv"?"http-equiv":s}="${I(String(o))}"`).join(" ");n.push(`<meta ${i}>`)}for(let r of e.link||[]){let i=Object.entries(r).filter(([s,o])=>o!==void 0).map(([s,o])=>`${s}="${I(String(o))}"`).join(" ");n.push(`<link ${i}>`)}for(let r of e.script||[]){let{content:i,...s}=r,o=Object.entries(s).filter(([a,l])=>l!==void 0).map(([a,l])=>{if(typeof l==="boolean")return l?a:"";return`${a}="${I(String(l))}"`}).filter(Boolean).join(" ");if(i)n.push(`<script ${o}>${W(r)}</script>`);else n.push(`<script ${o}></script>`)}for(let r of e.style||[]){let i=r.type?` type="${r.type}"`:"";n.push(`<style${i}>${r.content}</style>`)}return n.join(`
|
|
60
|
+
`)}function ey(e=T){if(!e.htmlAttrs)return"";return Object.entries(e.htmlAttrs).map(([n,r])=>`${n}="${I(r)}"`).join(" ")}function ty(e=T){if(!e.bodyAttrs)return"";return Object.entries(e.bodyAttrs).map(([n,r])=>`${n}="${I(r)}"`).join(" ")}function I(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function ny(e=T){if(typeof document>"u")return;if(e.title){let n=e.title;if(e.titleTemplate)n=typeof e.titleTemplate==="function"?e.titleTemplate(n):e.titleTemplate.replace("%s",n);document.title=n}for(let n of e.meta||[]){let r=n.name?`meta[name="${n.name}"]`:n.property?`meta[property="${n.property}"]`:null;if(r){let i=document.querySelector(r);if(!i){if(i=document.createElement("meta"),n.name)i.setAttribute("name",n.name);if(n.property)i.setAttribute("property",n.property);document.head.appendChild(i)}i.setAttribute("content",n.content)}}for(let n of e.link||[]){let r=`link[rel="${n.rel}"]${n.href?`[href="${n.href}"]`:""}`,i=document.querySelector(r);if(!i)i=document.createElement("link"),document.head.appendChild(i);for(let[s,o]of Object.entries(n))if(o!==void 0)i.setAttribute(s,String(o))}if(e.htmlAttrs)for(let[n,r]of Object.entries(e.htmlAttrs))if(n==="class")for(let i of String(r).split(/\s+/).filter(Boolean))document.documentElement.classList.add(i);else document.documentElement.setAttribute(n,r);if(e.bodyAttrs)for(let[n,r]of Object.entries(e.bodyAttrs))document.body.setAttribute(n,r)}function ry(e){let n="";return{content:e.replace(/@head\s*([\s\S]*?)@endhead/g,(i,s)=>(n+=s.trim()+`
|
|
61
|
+
`,"")),headContent:n.trim()}}function sy(e,n){return e.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(r,i,s,o)=>{let a=i?s:n[(o||"").trim()]??o,l=n.__stx_runtime_head??{};return n.__stx_runtime_head=Ve(l,{title:a}),""})}function oy(e,n,r=""){if(!e.includes("@meta"))return e;return jt(e,/(?<![\w$@])@meta\s*\(/g,(i,s)=>{let o=Ar(Bt(i),n);if(o.kind==="error")return N("Meta",s,o.message,r,o.code);if(o.kind==="tag"){let a=n.__stx_runtime_head??{};n.__stx_runtime_head=Ve(a,{meta:[o.tag]})}return""},(i)=>N("Meta",i,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX))}export{Hs,wi,Vs,u,f,Yc,R,rt,Lt,d,Us,t,ae,Cr,q,c,ke,vi,B,xn,w,Zc,xi,jt,Bt,Ft,He,st,N,Ws,Si,Qc,Er,Tr,el,ot,tl,$r,nl,Sn,ki,rl,Rr,Ar,Pr,qs,_e,_i,Gh,Jh,sl,Ve,gg,Ks,Yh,Zh,Qh,ey,ty,ny,ry,sy,oy};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import d from"fs";import l from"path";function gl(n){let s=[],e=n.pwa;if(s.push({id:"pwa-enabled",name:"PWA Enabled",category:"required",passed:e?.enabled===!0,message:e?.enabled?"PWA is enabled":"PWA is not enabled in config"}),!e?.enabled)return s;s.push({id:"manifest-name",name:"App Name",category:"required",passed:Boolean(e.manifest?.name),message:e.manifest?.name?`App name: "${e.manifest.name}"`:"Missing required manifest name"}),s.push({id:"manifest-short-name",name:"Short Name",category:"recommended",passed:Boolean(e.manifest?.shortName),message:e.manifest?.shortName?`Short name: "${e.manifest.shortName}"`:"Short name not set (will use full name)"}),s.push({id:"manifest-description",name:"App Description",category:"recommended",passed:Boolean(e.manifest?.description),message:e.manifest?.description?"Description is set":"App description not provided"}),s.push({id:"manifest-theme-color",name:"Theme Color",category:"required",passed:Boolean(e.manifest?.themeColor),message:e.manifest?.themeColor?`Theme color: ${e.manifest.themeColor}`:"Theme color not set"}),s.push({id:"manifest-background-color",name:"Background Color",category:"required",passed:Boolean(e.manifest?.backgroundColor),message:e.manifest?.backgroundColor?`Background color: ${e.manifest.backgroundColor}`:"Background color not set"}),s.push({id:"manifest-display",name:"Display Mode",category:"required",passed:["standalone","fullscreen","minimal-ui"].includes(e.manifest?.display||""),message:e.manifest?.display?`Display mode: ${e.manifest.display}`:"Display mode should be standalone, fullscreen, or minimal-ui"}),s.push({id:"manifest-start-url",name:"Start URL",category:"required",passed:Boolean(e.manifest?.startUrl),message:e.manifest?.startUrl?`Start URL: ${e.manifest.startUrl}`:"Start URL not set"}),s.push({id:"icons-source",name:"Icon Source",category:"required",passed:Boolean(e.icons?.src),message:e.icons?.src?`Icon source: ${e.icons.src}`:"No icon source configured"});let a=e.icons?.sizes||[];s.push({id:"icons-192",name:"192x192 Icon",category:"required",passed:a.includes(192),message:a.includes(192)?"192x192 icon will be generated":"Missing 192x192 icon (required for Android)"}),s.push({id:"icons-512",name:"512x512 Icon",category:"required",passed:a.includes(512),message:a.includes(512)?"512x512 icon will be generated":"Missing 512x512 icon (required for splash screen)"}),s.push({id:"icons-maskable",name:"Maskable Icon",category:"recommended",passed:e.icons?.purpose?.includes("maskable")||!1,message:e.icons?.purpose?.includes("maskable")?"Maskable icon purpose is set":"Consider adding maskable icon purpose for adaptive icons"}),s.push({id:"sw-configured",name:"Service Worker",category:"required",passed:Boolean(e.serviceWorker),message:e.serviceWorker?"Service worker is configured":"Service worker configuration missing"}),s.push({id:"sw-cache-version",name:"Cache Version",category:"recommended",passed:Boolean(e.serviceWorker?.cacheVersion),message:e.serviceWorker?.cacheVersion?`Cache version: ${e.serviceWorker.cacheVersion}`:"Set cache version for proper cache busting"}),s.push({id:"offline-enabled",name:"Offline Support",category:"required",passed:e.offline?.enabled===!0,message:e.offline?.enabled?"Offline support is enabled":"Offline support is disabled"});let t=e.routes||[];return s.push({id:"caching-strategies",name:"Caching Strategies",category:"recommended",passed:t.length>0,message:t.length>0?`${t.length} route caching strategies configured`:"No custom caching strategies defined"}),s.push({id:"push-config",name:"Push Notifications",category:"optional",passed:!e.push?.enabled||Boolean(e.push?.vapidPublicKey),message:e.push?.enabled?e.push?.vapidPublicKey?"Push notifications configured with VAPID key":"Push enabled but missing VAPID key":"Push notifications not enabled"}),s.push({id:"share-target",name:"Share Target",category:"optional",passed:!0,message:e.shareTarget?.enabled?`Share target enabled at ${e.shareTarget.action}`:"Share target not enabled"}),s.push({id:"auto-inject",name:"Auto-injection",category:"recommended",passed:e.autoInject!==!1,message:e.autoInject!==!1?"PWA tags will be auto-injected":"Auto-injection disabled - manual tag insertion required"}),s}function ml(n){let s=[],e=l.join(n,"manifest.json"),a=d.existsSync(e);if(s.push({id:"build-manifest",name:"Manifest File",category:"required",passed:a,message:a?"manifest.json exists":"manifest.json not found in build output"}),a)try{let r=JSON.parse(d.readFileSync(e,"utf-8"));s.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!0,message:"Manifest is valid JSON"}),s.push({id:"build-manifest-icons",name:"Manifest Icons",category:"required",passed:Array.isArray(r.icons)&&r.icons.length>0,message:r.icons?.length?`${r.icons.length} icons defined in manifest`:"No icons defined in manifest"})}catch{s.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!1,message:"Manifest is not valid JSON"})}let t=l.join(n,"sw.js"),c=d.existsSync(t);s.push({id:"build-sw",name:"Service Worker File",category:"required",passed:c,message:c?"Service worker (sw.js) exists":"Service worker not found in build output"});let o=l.join(n,"offline.html"),u=d.existsSync(o);s.push({id:"build-offline",name:"Offline Page",category:"recommended",passed:u,message:u?"Offline page exists":"No offline.html found"});let i=l.join(n,"pwa-icons");if(d.existsSync(i)){let r=d.readdirSync(i).filter((m)=>m.endsWith(".png")||m.endsWith(".webp"));s.push({id:"build-icons",name:"Generated Icons",category:"required",passed:r.length>0,message:r.length>0?`${r.length} icon files generated`:"No icon files found"})}else s.push({id:"build-icons",name:"Generated Icons",category:"required",passed:!1,message:"Icons directory not found"});return s}function hl(n){let s=n.filter((i)=>i.category==="required"),e=n.filter((i)=>i.category==="recommended"),a=s.filter((i)=>i.passed).length,t=e.filter((i)=>i.passed).length,c=s.length>0?a/s.length*70:70,o=e.length>0?t/e.length*30:30;return{score:Math.round(c+o),passed:n.filter((i)=>i.passed).length,failed:n.filter((i)=>!i.passed&&i.category==="required").length,warnings:n.filter((i)=>!i.passed&&i.category!=="required").length,checks:n}}function
|
|
2
|
+
import d from"fs";import l from"path";function gl(n){let s=[],e=n.pwa;if(s.push({id:"pwa-enabled",name:"PWA Enabled",category:"required",passed:e?.enabled===!0,message:e?.enabled?"PWA is enabled":"PWA is not enabled in config"}),!e?.enabled)return s;s.push({id:"manifest-name",name:"App Name",category:"required",passed:Boolean(e.manifest?.name),message:e.manifest?.name?`App name: "${e.manifest.name}"`:"Missing required manifest name"}),s.push({id:"manifest-short-name",name:"Short Name",category:"recommended",passed:Boolean(e.manifest?.shortName),message:e.manifest?.shortName?`Short name: "${e.manifest.shortName}"`:"Short name not set (will use full name)"}),s.push({id:"manifest-description",name:"App Description",category:"recommended",passed:Boolean(e.manifest?.description),message:e.manifest?.description?"Description is set":"App description not provided"}),s.push({id:"manifest-theme-color",name:"Theme Color",category:"required",passed:Boolean(e.manifest?.themeColor),message:e.manifest?.themeColor?`Theme color: ${e.manifest.themeColor}`:"Theme color not set"}),s.push({id:"manifest-background-color",name:"Background Color",category:"required",passed:Boolean(e.manifest?.backgroundColor),message:e.manifest?.backgroundColor?`Background color: ${e.manifest.backgroundColor}`:"Background color not set"}),s.push({id:"manifest-display",name:"Display Mode",category:"required",passed:["standalone","fullscreen","minimal-ui"].includes(e.manifest?.display||""),message:e.manifest?.display?`Display mode: ${e.manifest.display}`:"Display mode should be standalone, fullscreen, or minimal-ui"}),s.push({id:"manifest-start-url",name:"Start URL",category:"required",passed:Boolean(e.manifest?.startUrl),message:e.manifest?.startUrl?`Start URL: ${e.manifest.startUrl}`:"Start URL not set"}),s.push({id:"icons-source",name:"Icon Source",category:"required",passed:Boolean(e.icons?.src),message:e.icons?.src?`Icon source: ${e.icons.src}`:"No icon source configured"});let a=e.icons?.sizes||[];s.push({id:"icons-192",name:"192x192 Icon",category:"required",passed:a.includes(192),message:a.includes(192)?"192x192 icon will be generated":"Missing 192x192 icon (required for Android)"}),s.push({id:"icons-512",name:"512x512 Icon",category:"required",passed:a.includes(512),message:a.includes(512)?"512x512 icon will be generated":"Missing 512x512 icon (required for splash screen)"}),s.push({id:"icons-maskable",name:"Maskable Icon",category:"recommended",passed:e.icons?.purpose?.includes("maskable")||!1,message:e.icons?.purpose?.includes("maskable")?"Maskable icon purpose is set":"Consider adding maskable icon purpose for adaptive icons"}),s.push({id:"sw-configured",name:"Service Worker",category:"required",passed:Boolean(e.serviceWorker),message:e.serviceWorker?"Service worker is configured":"Service worker configuration missing"}),s.push({id:"sw-cache-version",name:"Cache Version",category:"recommended",passed:Boolean(e.serviceWorker?.cacheVersion),message:e.serviceWorker?.cacheVersion?`Cache version: ${e.serviceWorker.cacheVersion}`:"Set cache version for proper cache busting"}),s.push({id:"offline-enabled",name:"Offline Support",category:"required",passed:e.offline?.enabled===!0,message:e.offline?.enabled?"Offline support is enabled":"Offline support is disabled"});let t=e.routes||[];return s.push({id:"caching-strategies",name:"Caching Strategies",category:"recommended",passed:t.length>0,message:t.length>0?`${t.length} route caching strategies configured`:"No custom caching strategies defined"}),s.push({id:"push-config",name:"Push Notifications",category:"optional",passed:!e.push?.enabled||Boolean(e.push?.vapidPublicKey),message:e.push?.enabled?e.push?.vapidPublicKey?"Push notifications configured with VAPID key":"Push enabled but missing VAPID key":"Push notifications not enabled"}),s.push({id:"share-target",name:"Share Target",category:"optional",passed:!0,message:e.shareTarget?.enabled?`Share target enabled at ${e.shareTarget.action}`:"Share target not enabled"}),s.push({id:"auto-inject",name:"Auto-injection",category:"recommended",passed:e.autoInject!==!1,message:e.autoInject!==!1?"PWA tags will be auto-injected":"Auto-injection disabled - manual tag insertion required"}),s}function ml(n){let s=[],e=l.join(n,"manifest.json"),a=d.existsSync(e);if(s.push({id:"build-manifest",name:"Manifest File",category:"required",passed:a,message:a?"manifest.json exists":"manifest.json not found in build output"}),a)try{let r=JSON.parse(d.readFileSync(e,"utf-8"));s.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!0,message:"Manifest is valid JSON"}),s.push({id:"build-manifest-icons",name:"Manifest Icons",category:"required",passed:Array.isArray(r.icons)&&r.icons.length>0,message:r.icons?.length?`${r.icons.length} icons defined in manifest`:"No icons defined in manifest"})}catch{s.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!1,message:"Manifest is not valid JSON"})}let t=l.join(n,"sw.js"),c=d.existsSync(t);s.push({id:"build-sw",name:"Service Worker File",category:"required",passed:c,message:c?"Service worker (sw.js) exists":"Service worker not found in build output"});let o=l.join(n,"offline.html"),u=d.existsSync(o);s.push({id:"build-offline",name:"Offline Page",category:"recommended",passed:u,message:u?"Offline page exists":"No offline.html found"});let i=l.join(n,"pwa-icons");if(d.existsSync(i)){let r=d.readdirSync(i).filter((m)=>m.endsWith(".png")||m.endsWith(".webp"));s.push({id:"build-icons",name:"Generated Icons",category:"required",passed:r.length>0,message:r.length>0?`${r.length} icon files generated`:"No icon files found"})}else s.push({id:"build-icons",name:"Generated Icons",category:"required",passed:!1,message:"Icons directory not found"});return s}function hl(n){let s=n.filter((i)=>i.category==="required"),e=n.filter((i)=>i.category==="recommended"),a=s.filter((i)=>i.passed).length,t=e.filter((i)=>i.passed).length,c=s.length>0?a/s.length*70:70,o=e.length>0?t/e.length*30:30;return{score:Math.round(c+o),passed:n.filter((i)=>i.passed).length,failed:n.filter((i)=>!i.passed&&i.category==="required").length,warnings:n.filter((i)=>!i.passed&&i.category!=="required").length,checks:n}}function mg(n,s){let e=gl(n),a=s&&d.existsSync(s)?ml(s):[];return hl([...e,...a])}function hg(n){let s=[];s.push(`
|
|
3
3
|
=== PWA Audit Report ===
|
|
4
4
|
`);let e=n.score>=90?"32":n.score>=70?"33":"31";s.push(`Score: \x1B[${e}m${n.score}/100\x1B[0m`),s.push(`Passed: ${n.passed} | Failed: ${n.failed} | Warnings: ${n.warnings}
|
|
5
5
|
`);let a=["required","recommended","optional"];for(let t of a){let c=n.checks.filter((o)=>o.category===t);if(c.length===0)continue;s.push(`
|
|
6
6
|
${t.toUpperCase()}:`);for(let o of c){let u=o.passed?"\x1B[32m\u2713\x1B[0m":"\x1B[31m\u2717\x1B[0m";if(s.push(` ${u} ${o.name}: ${o.message}`),o.details)s.push(` ${o.details}`)}}return s.push(""),s.join(`
|
|
7
7
|
`)}
|
|
8
|
-
export{gl,ml,hl,
|
|
8
|
+
export{gl,ml,hl,mg,hg};
|
|
@@ -72,7 +72,7 @@ else {
|
|
|
72
72
|
${t}
|
|
73
73
|
})();
|
|
74
74
|
</script>
|
|
75
|
-
`}function
|
|
75
|
+
`}function Im(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{Im};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{u,f,R,d,q}from"./chunk-
|
|
2
|
+
import{u,f,R,d,q}from"./chunk-7s9wx19m.js";import{z,$s,U,Oe,de,Sr,je,Be,r,h,Se,_}from"./chunk-4qrr2mdd.js";import{it}from"./chunk-07c8rk93.js";import{A}from"./chunk-4833k99b.js";import{se}from"./chunk-p7h4y7mk.js";import{L,Je}from"./chunk-0wj31pqy.js";import{E,kn}from"./chunk-zjar9jdd.js";import C from"path";import{existsSync as St}from"fs";function at(a,t){let c=0;for(let i=t;i<a.length;i++){let S=a[i];if(S==="("||S==="["||S==="{")c++;else if(S===")"||S==="]"||S==="}")c--;else if(S===","&&c===0)return i}return-1}function yt(a,t,c){let i=a,S=new RegExp(`${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),s=S.exec(i);while(s){let g=s.index,e=g+s[0].length-1,D=1,Z=e+1;while(Z<i.length&&D>0){if(i[Z]==="(")D++;else if(i[Z]===")")D--;Z++}if(D!==0)break;let rt=i.substring(e+1,Z-1),N=`${c}(${rt})`;i=i.substring(0,g)+N+i.substring(Z),S.lastIndex=g+N.length,s=S.exec(i)}return i}function $t(a){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(a)}function mt(a){let t=a,c=[],i=new Set,S=0,s=0,g=t.length,e=(N)=>{s++;while(s<g){if(t[s]==="\\"){s+=2;continue}if(t[s]===N){s++;return}s++}},D=()=>{s++;while(s<g){if(t[s]==="\\"){s+=2;continue}if(t[s]==="`"){s++;return}if(t[s]==="$"&&t[s+1]==="{"){s+=2;let N=1;while(s<g&&N>0)if(t[s]==="{")N++,s++;else if(t[s]==="}")N--,s++;else if(t[s]==="'"||t[s]==='"')e(t[s]);else if(t[s]==="`")D();else s++;continue}s++}},Z=()=>{if(t[s]==="/"&&t[s+1]==="/"){while(s<g&&t[s]!==`
|
|
3
3
|
`)s++;return!0}if(t[s]==="/"&&t[s+1]==="*"){s+=2;while(s<g-1&&!(t[s]==="*"&&t[s+1]==="/"))s++;return s+=2,!0}return!1},rt=()=>{if(S!==0)return;let N=t.slice(s).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(N){let H=N[2];if(!i.has(H))c.push(H),i.add(H);return}let et=t.slice(s).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(et){let H=et[1];if(!i.has(H))c.push(H),i.add(H);return}let Y=t.slice(s).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Y){let H=Y[1];if(!i.has(H))c.push(H),i.add(H)}};while(s<g){if(Z())continue;if(t[s]==="'"||t[s]==='"'){e(t[s]);continue}if(t[s]==="`"){D();continue}if(t[s]==="{"){S++,s++;continue}if(t[s]==="}"){S--,s++;continue}if(S===0&&/[a-z]/i.test(t[s])&&(s===0||/\s|[;{}()]/.test(t[s-1])))rt();s++}return c.join(", ")}function Et(a,t=""){let c=mt(a).split(",").map((i)=>i.trim()).filter(Boolean);return`
|
|
4
4
|
(function() {
|
|
5
5
|
${it("var",c)}
|
|
@@ -44,11 +44,11 @@ ${s}
|
|
|
44
44
|
}
|
|
45
45
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
46
46
|
}
|
|
47
|
-
})();`;return c+a+i}function It(a,t){if(L(a)){let S=L(a).tag.match(/data-stx-scope="([^"]*)"/);if(S)return{html:a,mergedIntoExisting:S[1],stamped:!0,root:"body"};return{html:Je(a,(s,g)=>`<body${g} data-stx-scope="${t}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let c=a.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(c){let i=c[2]+c[3],S=c[2].slice(1),s=i.match(/data-stx-scope="([^"]*)"/);if(s)return{html:a,mergedIntoExisting:s[1],stamped:!0,root:S};let g=c[1],e=c[2],D=c[3];return{html:`${g}${e} data-stx-scope="${t}"${D}${a.slice(c[0].length)}`,mergedIntoExisting:null,stamped:!0,root:S}}return{html:a,mergedIntoExisting:null,stamped:!1,root:null}}var Mt=0;function ut(a,t){let c=C.basename(a,".stx").replace(/[^a-zA-Z0-9]/g,"_"),i=t.__stx_scope_seq;return i?`stx_scope_${c}_${++i.n}_${i.key}`:`stx_scope_${c}_${++Mt}`}var lt=new Set,pt=new Set;function
|
|
47
|
+
})();`;return c+a+i}function It(a,t){if(L(a)){let S=L(a).tag.match(/data-stx-scope="([^"]*)"/);if(S)return{html:a,mergedIntoExisting:S[1],stamped:!0,root:"body"};return{html:Je(a,(s,g)=>`<body${g} data-stx-scope="${t}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let c=a.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(c){let i=c[2]+c[3],S=c[2].slice(1),s=i.match(/data-stx-scope="([^"]*)"/);if(s)return{html:a,mergedIntoExisting:s[1],stamped:!0,root:S};let g=c[1],e=c[2],D=c[3];return{html:`${g}${e} data-stx-scope="${t}"${D}${a.slice(c[0].length)}`,mergedIntoExisting:null,stamped:!0,root:S}}return{html:a,mergedIntoExisting:null,stamped:!1,root:null}}var Mt=0;function ut(a,t){let c=C.basename(a,".stx").replace(/[^a-zA-Z0-9]/g,"_"),i=t.__stx_scope_seq;return i?`stx_scope_${c}_${++i.n}_${i.key}`:`stx_scope_${c}_${++Mt}`}var lt=new Set,pt=new Set;function kh(){lt.clear(),pt.clear()}var Tt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function $f(a){let t=(e)=>e.replace(/[^\n]/g," "),c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,t).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,t).replace(/<!--[\s\S]*?-->/g,t).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,t).replace(/\{\{[\s\S]*?\}\}/g,t).replace(/\{!![\s\S]*?!!\}/g,t),i=[],S=0,s=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,g;while((g=s.exec(c))!==null){let e=g[1]==="/",D=g[2],Z=g[3]==="/"||Tt.has(D.toLowerCase());if(e){S=Math.max(0,S-1);continue}if(S===0)i.push(D);if(!Z)S++}return i}function ft(a){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(a)}var Ge=new U(500),nc=new Set;function _h(){nc.clear()}function Ct(a){if(a.__onceStore instanceof Set)return a.__onceStore;return nc}async function ss(a,t,c,i,S,s=new Set){let g=i.partialsDir||C.join(C.dirname(c),"partials");if(g&&!C.isAbsolute(g))g=C.resolve(process.cwd(),g);let e=yt(a,"@partial","@include"),D=Ct(t);e=e.replace(/@once([\s\S]*?)@endonce/g,(m,I,x)=>{let p=I.trim(),n=`${c}:${p}`;if(D.has(n))return"";return D.add(n),I});{let m=/@includeIf\s*\(/g,I;while((I=m.exec(e))!==null){let x=I.index,p=x+I[0].length-1,n=1,w=p+1;while(w<e.length&&n>0){if(e[w]==="(")n++;else if(e[w]===")")n--;w++}if(n!==0)break;let l=e.substring(p+1,w-1),o=l.match(/^\s*['"]([^'"]+)['"]/);if(!o){m.lastIndex=w;continue}let O=o[1],P=Z(O,g,c),k="";if(P&&await Bun.file(P).exists())S.add(P),k=`@include(${l})`;e=e.substring(0,x)+k+e.substring(w),m.lastIndex=0}}for(let[m,I]of[["@includeWhen",!1],["@includeUnless",!0]]){let x=new RegExp(`${m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),p;while((p=x.exec(e))!==null){let n=p.index,w=n+p[0].length-1,l=1,o=w+1;while(o<e.length&&l>0){if(e[o]==="(")l++;else if(e[o]===")")l--;o++}if(l!==0)break;let O=e.substring(w+1,o-1),P=at(O,0);if(P===-1){x.lastIndex=o;continue}let k=O.substring(0,P).trim(),V=O.substring(P+1).trim(),W=V.match(/^\s*['"]([^'"]+)['"]/);if(!W){x.lastIndex=o;continue}let b=W[1],J=V.substring(W[0].length),B,M=at(J,0);if(M!==-1)B=J.substring(M+1).trim();try{let T=`Boolean(${k})`,j;if(f(T)){let ot=d(T,Object.keys(t));j=Boolean(ot(...Object.values(t)))}else j=Boolean(u(T,t));let tt=I?!j:j,nt="";if(tt){let ot=Z(b,g,c);if(ot&&await Bun.file(ot).exists())S.add(ot);nt=`@include('${b}'${B?`, ${B}`:""})`}e=e.substring(0,n)+nt+e.substring(o),x.lastIndex=0}catch(T){let j=T instanceof Error?T.message:String(T),tt=h("Include",`Error evaluating ${m} condition: ${j}`,c,a,n);e=e.substring(0,n)+tt+e.substring(o),x.lastIndex=0}}}{let m=/@each\s*\(/g,I;while((I=m.exec(e))!==null){let x=I.index,p=x+I[0].length-1,n=1,w=p+1;while(w<e.length&&n>0){if(e[w]==="(")n++;else if(e[w]===")"){if(n--,n===0)break}w++}if(n!==0)break;let l=e.substring(p+1,w),o=e.substring(x,w+1),O=l.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!O){m.lastIndex=0,e=e.replace(o,"");continue}let[,P,k,V,W]=O;try{let b,J=k.trim();if(f(J))b=d(J,Object.keys(t))(...Object.values(t));else b=u(J,t);let B="";if(Array.isArray(b)&&b.length>0)for(let M of b){let T={...t,[V]:M},j=await et(P,T,a,x);B+=j}else if(W)B=await et(W,{},a,x);e=e.substring(0,x)+B+e.substring(w+1),m.lastIndex=0}catch(b){let J=b instanceof Error?b.message:String(b);e=e.substring(0,x)+h("Each",`Error in @each: ${J}`,c,a,x)+e.substring(w+1),m.lastIndex=0}}}{let m=/@includeFirst\s*\(/g,I;while((I=m.exec(e))!==null){let x=I.index,p=x+I[0].length-1,n=1,w=p+1;while(w<e.length&&n>0){if(e[w]==="(")n++;else if(e[w]===")"){if(n--,n===0)break}w++}if(n!==0)break;let l=e.substring(p+1,w),o=e.substring(x,w+1),O=l.match(/^\s*(\[[^\]]+\])/);if(!O){m.lastIndex=0,e=e.replace(o,"");continue}let P=O[1],k=l.slice(O[0].length),V,W=k.match(/^\s*,\s*\{/);if(W){k=k.slice(W[0].length-1);let B=1,M=1;while(M<k.length&&B>0){if(k[M]==="{")B++;else if(k[M]==="}"){if(B--,B===0)break}M++}V=k.substring(0,M+1),k=k.slice(M+1)}let b,J=k.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(J)b=J[1];try{let B=JSON.parse(P.replace(/'/g,'"')),M={};if(V)try{M=R(V,t)}catch(j){let tt=j instanceof Error?j.message:String(j);if(i.debug){let nt=h("Include",`Error parsing includeFirst variables: ${tt}`,c,a,x,o);e=e.replace(o,()=>nt)}else e=e.replace(o,()=>b||"");continue}let T=!1;for(let j of B){let tt=Z(j,g,c);if(!tt)continue;if(await r(tt)){let nt=await et(j,M,a,x);e=e.replace(o,()=>nt),T=!0;break}}if(!T)if(b!==void 0)e=e.replace(o,()=>b);else if(i.debug){let j=h("Include",`None of the includeFirst paths exist: ${P}`,c,a,x,o);e=e.replace(o,()=>j)}else e=e.replace(o,"")}catch(B){let M=B instanceof Error?B.message:String(B),T=h("Include",`Error processing @includeFirst: ${M}`,c,a,x,o);e=e.replace(o,()=>T)}m.lastIndex=0}}function Z(m,I,x){try{let p=m;if(!m.endsWith(".stx"))p=`${m}.stx`;let n=C.resolve(I),w=C.resolve(C.dirname(x)),l;if(!p.startsWith("./")&&!p.startsWith("../")){for(let W of i._layerPartialDirs??[]){let b=C.resolve(W,p);if(b.startsWith(`${C.resolve(W)}${C.sep}`)&&St(b))return b}l=C.resolve(I,p)}else l=C.resolve(w,p);let o=C.normalize(l),O=o.startsWith(n+C.sep)||o===n,P=o.startsWith(w+C.sep)||o===w,k=!1,V=C.dirname(w);if(o.startsWith(V+C.sep)){if(!C.relative(V,o).split(C.sep).some((B)=>B.startsWith(".")&&B!=="."&&B!==".."))k=!0}if(!O&&!P&&!k)return console.error(`Security: Path traversal attempt blocked for include path: ${m}`),console.error(` Resolved to: ${o}`),console.error(` Allowed dirs: ${n}, ${w}`),null;return o}catch(p){return console.error(`Error resolving path ${m}: ${p}`),null}}let rt=C.resolve(c);s.add(rt);function N(m,I,x,p){return i.onIncludeError?.({includePath:m,templatePath:c,message:I,partialsDir:g}),h("Include",I,c,x,p)}async function et(m,I={},x,p){let n=Z(m,g,c);if(!n)return N(m,`Could not resolve path for include: ${m}`,x,p);let w=C.resolve(n);if(s.has(w)){let l=[...s,w].map((o)=>C.basename(o)).join(" -> ");return N(m,`Circular include detected: ${l}`,x,p)}try{S.add(n);let l;if(!l)try{l=await Bun.file(n).text()}catch(v){let K=v instanceof Error?v.message:String(v);return N(m,`Error loading include file ${m}: ${K}`,x,p)}if(l)l=l.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(l&&l.includes("@stream")){let{processStreamDirectives:v}=await import("./chunk-bjggcj45.js");l=v(l,t)}if(l&&(i.debug||!E()&&!kn()))try{let{warnUnbalancedTags:v}=await import("./chunk-hfcmbbkq.js");v(l,n)}catch{}try{let{processESImports:v}=await import("./chunk-ddwsms1t.js");l=await v(l,t,n,i,S)}catch(v){if(i.debug)console.warn(`[stx] partial ES import extraction skipped for ${n}:`,v instanceof Error?v.message:v)}let o=l,O=de(o);if(O)o=O.content.trim();let k=l.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),V="";if(k)V=`<style${k[1]}>${k[2]}</style>`;let W=[];o=o.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(v,K,y)=>{if(!ft(K))return"";return W.push({attrs:K,body:y}),`__STX_DATA_BLOCK_${W.length-1}__`}),o=o.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let b={...t};b.__stx_signals_gate=Se(l,n);for(let[v,K]of Object.entries(I))b[v]=K;let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,B=[...l.matchAll(J)].sort((v,K)=>{let y=(v[1]||"").includes("server"),X=(K[1]||"").includes("server");return Number(X)-Number(y)}),M="",T=null,j=!1,tt=!1;for(let v of B){let K=v[1]||"",y=v[2]||"";if(ft(K))continue;let X=K.includes("server"),wt=je(K);if(!X&&!/\bsrc\s*=/i.test(K))Oe(y,n,i.strict);if(!X&&y.trim()){let{interpolateScriptExpressions:F}=await import("./chunk-wtqj99tg.js");y=F(y,b,m)}let ct="";try{let{extractAndStripCssImports:F,renderVendorStyleTags:Q}=await import("./chunk-nsxg0t06.js"),st=F(y,{filePath:n,projectRoot:process.cwd()});y=st.code,ct=Q(st.styles)}catch(F){if(i.debug)console.warn(`[stx] vendor-css extractor skipped for ${n}:`,F instanceof Error?F.message:F)}if(wt&&y.trim())y=Be(y);if(!X){try{let{injectBrowserCoreAutoImports:Q}=await import("./chunk-nsxg0t06.js");y=Q(y).code;let{hasUserImports:st,bundleClientScript:bt}=await import("./chunk-s1a69a8q.js");if(st(y))y=await bt(y,n,{projectRoot:process.cwd()})}catch(Q){if(i.debug)console.warn(`[stx] bundler skipped for ${n}:`,Q instanceof Error?Q.message:Q)}let{stripStxRuntimeImports:F}=await import("./chunk-bk3b5jyw.js");y=F(y)}let dt=$t(y);if(!X){let{extractBridgeData:F,generateServerDataBridge:Q}=await import("./chunk-nsxg0t06.js"),st=Q(y,F(b));if(st)y=`${st}
|
|
48
48
|
${y}`}if(dt&&!X){j=!0,T=ut(n,t);let F=A(y),Q=gt(F,T);M+=`${ct}<script data-stx-scoped data-stx-run="always" data-stx-owner="${T}">${Q}</script>
|
|
49
|
-
`;continue}if(X)try{let{extractVariables:F}=await import("./chunk-
|
|
50
|
-
`}}if(W.length>0){let{interpolateScriptExpressions:v}=await import("./chunk-
|
|
49
|
+
`;continue}if(X)try{let{extractVariables:F}=await import("./chunk-rqpktvkn.js");await F(y,b,n)}catch(F){if(i.debug)console.warn(`Warning: Could not extract variables from server script in ${n}:`,F)}if(!X&&!dt){let F=K.replace(/\bclient\b/i,"").trim();T=ut(n,t);let Q=A(y),st=gt(Q,T);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=|Object\.defineProperty\(__scopeRegistration, "(?!__stx)/.test(st))tt=!0;M+=`${ct}<script data-stx-scoped data-stx-run="always" data-stx-owner="${T}"${F?` ${F}`:""}>${st}</script>
|
|
50
|
+
`}}if(W.length>0){let{interpolateScriptExpressions:v}=await import("./chunk-wtqj99tg.js");o=o.replace(/__STX_DATA_BLOCK_(\d+)__/g,(K,y)=>{let X=W[Number(y)];return`<script${X.attrs}>${v(X.body,b,m)}</script>`})}if(T){let v=It(o,T);if(o=v.html,v.mergedIntoExisting){let y=T,X=v.mergedIntoExisting;M=M.split(`'${y}'`).join(`'${X}'`).split(`"${y}"`).join(`"${X}"`),T=X}else if(!v.stamped&&j&&!lt.has(n))lt.add(n),console.warn(`[stx] ${C.relative(process.cwd(),n)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);if(v.stamped&&v.root!=="body"&&(j||tt)&&!pt.has(n)){let y=$f(o);if(y.length>1)pt.add(n),console.warn(`[stx] ${C.relative(process.cwd(),n)} declares ${j?"signals":"bindings"} and has ${y.length} top-level elements (${y.map((X)=>`<${X}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see what this partial's script declares. Wrap the partial's markup in a single root element.`)}let K=v.stamped&&v.root!==null&&Sr(v.root);M=Rt(M,K?T:null)}if(o.includes("@include")||o.includes("@partial"))o=await ss(o,b,n,i,S,s);let{processLoops:nt,reportDeferredLoopWarnings:ot}=await import("./chunk-3pma2q0h.js"),G=nt(o,b,n,void 0,!0);G=se(G,b,n),G=ot(G);let{processMetaDirectives:ht,processSeoDirective:xt,processStructuredData:_t}=await import("./chunk-hyqsvw1b.js");if(G=ht(G,b,n,i),G=_t(G,b,n),G=xt(G,b,n,i),G=_(G,b,n),V)G+=`
|
|
51
51
|
`+V;if(M)G+=`
|
|
52
52
|
`+M;return G}catch(l){if(l instanceof q)throw l;let o=l instanceof Error?l.message:String(l);return N(m,`Error processing include ${m}: ${o}`,x,p)}}let Y=/@include\s*\(/g,H;while((H=Y.exec(e))!==null){let m=H.index,I=m+H[0].length-1,x=1,p=I+1;while(p<e.length&&x>0){if(e[p]==="(")x++;else if(e[p]===")")x--;p++}if(x!==0)break;let n=e.substring(m,p),w=e.substring(I+1,p-1),l=w.match(/^\s*['"]([^'"]+)['"]/);if(!l){Y.lastIndex=p;continue}let o=l[1],O,P=w.substring(l[0].length),k=at(P,0);if(k!==-1)O=P.substring(k+1).trim();let V={};if(O)try{V=R(O,t)}catch(b){let J=b instanceof Error?b.message:String(b);e=e.replace(n,h("Include",`Error parsing include variables for ${o}: ${J}`,c,a,m)),Y.lastIndex=0;continue}let W=await et(o,V,a,m);e=e.substring(0,m)+W+e.substring(p),Y.lastIndex=0}return e}function os(a,t){let c=a;function i(S,s,g,e){let D=S,Z=!0;while(Z){Z=!1;let rt=new RegExp(`@${s}\\(['"]([^'"]+)['"]\\)`),N=D.match(rt);if(!N||N.index===void 0)break;let et=N.index,Y=N[1],H=et+N[0].length,m=new RegExp(`@${s}\\(`),I=new RegExp(`@${g}(?![a-z])`),x=1,p=H,n=-1;while(x>0&&p<D.length){let l=D.slice(p),o=l.match(m),O=l.match(I),P=o?p+o.index:1/0,k=O?p+O.index:1/0;if(P<k)x++,p=P+(o[0].length||1);else if(k<1/0){if(x--,x===0){n=k;break}p=k+g.length+1}else break}if(n===-1)break;let w=D.slice(H,n);if(!t[Y])t[Y]=[];if(e)t[Y].unshift(w);else t[Y].push(w);D=D.substring(0,et)+D.substring(n+`@${g}`.length),Z=!0}return D}return c=i(c,"push","endpush",!1),c=i(c,"prepend","endprepend",!0),c}function is(a,t){return a.replace(/@stack\(['"]([^'"]+)['"]\)/g,(c,i)=>{if(!t[i]||t[i].length===0)return"";return t[i].join(`
|
|
53
53
|
`)})}
|
|
54
|
-
export{
|
|
54
|
+
export{kh,$f,Ge,nc,_h,ss,os,is};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{_}from"./chunk-
|
|
2
|
+
import{_}from"./chunk-4qrr2mdd.js";import{i}from"./chunk-5q97egpw.js";import p from"fs";import g from"path";import*as y from"readline";var e={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},u={help:{description:"Show available commands",usage:"help [command]",handler:async(t,o)=>{if(t[0]&&u[t[0]]){let n=u[t[0]];console.log(`
|
|
3
3
|
${e.bold}${t[0]}${e.reset} - ${n.description}`),console.log(` Usage: ${e.cyan}${n.usage}${e.reset}
|
|
4
4
|
`)}else{console.log(`
|
|
5
5
|
${e.bold}Available Commands:${e.reset}
|
|
@@ -16,9 +16,9 @@ ${e.bold}Markdown:${e.reset}`),a.forEach((c)=>console.log(` ${e.blue}${c}${e.re
|
|
|
16
16
|
${e.bold}Other:${e.reset}`),d.forEach((c)=>console.log(` ${e.dim}${c}${e.reset}`));console.log()}},cat:{description:"Show file contents",usage:"cat <file>",handler:async(t,o)=>{if(!t[0]){console.log(`${e.red}Error: Please specify a file${e.reset}`);return}let n=g.resolve(o.cwd,t[0]);if(!await Bun.file(n).exists()){console.log(`${e.red}Error: File not found: ${n}${e.reset}`);return}let s=(await Bun.file(n).text()).split(`
|
|
17
17
|
`);console.log(),s.forEach((l,a)=>{let d=String(a+1).padStart(3," ");console.log(`${e.dim}${d}${e.reset} ${l}`)}),console.log()}},load:{description:"Load context from JSON file",usage:"load <file.json>",handler:async(t,o)=>{if(!t[0]){console.log(`${e.red}Error: Please specify a JSON file${e.reset}`);return}let n=g.resolve(o.cwd,t[0]);if(!await Bun.file(n).exists()){console.log(`${e.red}Error: File not found: ${n}${e.reset}`);return}try{let r=await Bun.file(n).text(),s=JSON.parse(r);o.context={...o.context,...s},console.log(`${e.green}\u2713${e.reset} Loaded ${Object.keys(s).length} variables from ${t[0]}`)}catch(r){console.log(`${e.red}Error parsing JSON:${e.reset}`,r)}}},save:{description:"Save context to JSON file",usage:"save <file.json>",handler:async(t,o)=>{if(!t[0]){console.log(`${e.red}Error: Please specify a file name${e.reset}`);return}let n=g.resolve(o.cwd,t[0]);try{await Bun.write(n,JSON.stringify(o.context,null,2)),console.log(`${e.green}\u2713${e.reset} Context saved to ${t[0]}`)}catch(r){console.log(`${e.red}Error saving file:${e.reset}`,r)}}},history:{description:"Show command history",usage:"history [count]",handler:async(t,o)=>{let n=t[0]?Number.parseInt(t[0],10):20,r=o.history.slice(-n);if(r.length===0){console.log(`${e.dim}No history${e.reset}`);return}console.log(),r.forEach((s,l)=>{let a=String(o.history.length-r.length+l+1).padStart(3," ");console.log(`${e.dim}${a}${e.reset} ${s}`)}),console.log()}},exit:{description:"Exit interactive mode",usage:"exit",handler:async(t,o)=>{o.running=!1,console.log(`
|
|
18
18
|
${e.dim}Goodbye!${e.reset}
|
|
19
|
-
`)}},quit:{description:"Exit interactive mode (alias for exit)",usage:"quit",handler:async(t,o)=>u.exit.handler(t,o)}};function h(t,o){let n=t.split(" "),r=n[0];if(n.length===1)return Object.keys(u).filter((s)=>s.startsWith(r));if(["render","cat","load","cd"].includes(r)){let s=n.slice(1).join(" "),l=g.dirname(s)||".",a=g.basename(s),d=g.resolve(o.cwd,l);if(p.existsSync(d)&&p.statSync(d).isDirectory())try{return p.readdirSync(d).filter((f)=>f.startsWith(a)).map((f)=>`${r} ${l==="."?"":`${l}/`}${f}`)}catch{return[]}}if(["unset","eval","set"].includes(r)){let s=n[1]||"";return Object.keys(o.context).filter((l)=>l.startsWith(s)).map((l)=>`${r} ${l}`)}return[]}async function
|
|
19
|
+
`)}},quit:{description:"Exit interactive mode (alias for exit)",usage:"quit",handler:async(t,o)=>u.exit.handler(t,o)}};function h(t,o){let n=t.split(" "),r=n[0];if(n.length===1)return Object.keys(u).filter((s)=>s.startsWith(r));if(["render","cat","load","cd"].includes(r)){let s=n.slice(1).join(" "),l=g.dirname(s)||".",a=g.basename(s),d=g.resolve(o.cwd,l);if(p.existsSync(d)&&p.statSync(d).isDirectory())try{return p.readdirSync(d).filter((f)=>f.startsWith(a)).map((f)=>`${r} ${l==="."?"":`${l}/`}${f}`)}catch{return[]}}if(["unset","eval","set"].includes(r)){let s=n[1]||"";return Object.keys(o.context).filter((l)=>l.startsWith(s)).map((l)=>`${r} ${l}`)}return[]}async function Fg(t={}){let o={context:t.context||{},cwd:t.cwd||process.cwd(),history:[],running:!0,lastResult:null},n=y.createInterface({input:process.stdin,output:process.stdout,completer:(s)=>[h(s,o),s],historySize:t.maxHistory||100});console.log(`
|
|
20
20
|
${e.bold}${e.blue}stx Interactive Mode${e.reset}
|
|
21
21
|
${e.dim}Type 'help' for available commands, 'exit' to quit${e.reset}
|
|
22
22
|
`);let r=()=>{let s=o.cwd.replace(process.env.HOME||"","~");n.question(`${e.cyan}stx${e.reset} ${e.dim}${s}${e.reset} ${e.green}>${e.reset} `,async(l)=>{let a=l.trim();if(!a){if(o.running)r();return}o.history.push(a);let d=a.match(/(?:[^\s"]|"[^"]*")+/g)||[],c=d[0]?.toLowerCase(),f=d.slice(1).map((m)=>m.replace(/^"|"$/g,""));if(c&&u[c])try{await u[c].handler(f,o)}catch(m){console.log(`${e.red}Error:${e.reset}`,m)}else if(c)if(a.includes("{{")||a.includes("}}"))try{let m=await _(a,o.context,"eval");console.log(`${e.green}\u2192${e.reset} ${m}`)}catch{console.log(`${e.red}Unknown command: ${c}${e.reset}`),console.log(`${e.dim}Type 'help' for available commands${e.reset}`)}else console.log(`${e.red}Unknown command: ${c}${e.reset}`),console.log(`${e.dim}Type 'help' for available commands${e.reset}`);if(o.running)r();else n.close()})};n.on("SIGINT",()=>{console.log(`
|
|
23
23
|
${e.dim}(Use 'exit' to quit)${e.reset}`),r()}),r()}
|
|
24
|
-
export{
|
|
24
|
+
export{Fg};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Hg}from"./chunk-xj1k9bx9.js";import"./chunk-napd81ht.js";import"./chunk-q69dvpg1.js";import"./chunk-cyd10m6m.js";import"./chunk-5wp7s24b.js";import"./chunk-jgmmg2fw.js";import"./chunk-rfzfk8zd.js";import"./chunk-svrjbeyq.js";import"./chunk-nrh8t8re.js";import"./chunk-ztbk9yqv.js";import"./chunk-cz3trbvn.js";import"./chunk-fxy7jjnv.js";import"./chunk-4qrr2mdd.js";import"./chunk-rj9dcjeg.js";import"./chunk-1g5fg1ys.js";import"./chunk-7s9wx19m.js";import"./chunk-4833k99b.js";import"./chunk-07c8rk93.js";export{Hg as startProductionServer};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{k}from"./chunk-07c8rk93.js";import{A,Cn}from"./chunk-4833k99b.js";import{Ie,C,Y}from"./chunk-
|
|
2
|
+
import{k}from"./chunk-07c8rk93.js";import{A,Cn}from"./chunk-4833k99b.js";import{Ie,C,Y}from"./chunk-4qrr2mdd.js";import{a}from"./chunk-rfzfk8zd.js";import{he,tn,nn,rn}from"./chunk-5fab5wt2.js";import{bt}from"./chunk-ecakhzkq.js";import{gt,Fn,Xt,ce}from"./chunk-e645nk33.js";import{E,_n}from"./chunk-zjar9jdd.js";import M from"fs";import b from"path";import x from"process";function B(s,o){for(let e of s.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(e[1])o.add(e[1]);for(let e of s.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let t of(e[1]??"").split(",")){let r=((t.includes(":")?t.split(":").pop():t)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(r))o.add(r)}for(let e of s.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let t of(e[1]??"").split(",")){let n=t.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(n))o.add(n)}}var h=new Map;async function R(s,o=E()){let e;if(s)e=b.resolve(s);else{let l=await a();e=b.resolve(l.root||x.cwd(),l.storesDir||"stores")}let t=`${e}\x00${nn()}\x00${o?"shared":"inline"}`,n=new Bun.Glob("*.ts"),r=[];try{for await(let l of n.scan({cwd:e,absolute:!0})){let c=b.basename(l,".ts");if(["index","types"].includes(c))continue;if(l.includes(".d.ts"))continue;r.push(l)}}catch{return ce(h,t,"",{chunks:[]}),null}let i=()=>[...new Set([...r,...r.flatMap((l)=>he(l))])],f=gt(i()),u=Xt(h,t,f);if(u!==void 0)return u.chunks.length>0?u:null;if(r.length===0)return ce(h,t,f,{chunks:[]}),null;let m=[];for(let l of r){let c=await Bun.file(l).text();m.push({file:l,hasUseStore:/useStore\s*\(/.test(c)})}m.sort((l,c)=>{if(l.hasUseStore===c.hasUseStore)return 0;return l.hasUseStore?1:-1});let p=m.map((l)=>l.file),g=[],d=Y({loader:"ts",target:"browser",define:C()});for(let l of p)try{let c=await Bun.file(l).text(),_=b.basename(l,".ts"),y=new Set;B(c,y);let v=[...c.matchAll(/\bdefineStore\s*(?:<[^>()]*>)?\(\s*(['"`])([^'"`$\\]+)\1/g)].map((U)=>U[2]),N=c.match(/\bdefineStore\s*(?:<[^>()]*>)?\(/g)?.length??0;if(tn(c))c=await rn(c,l,{projectRoot:x.cwd(),externalizeUserModules:o});c=bt(c),c=A(c),c=Cn(c),c=c.replace(/^export\s+(default\s+)?/gm,""),c=d.transformSync(c),g.push({name:_,ids:v.length===N?v:[],declared:y,code:`// Store: ${_}
|
|
3
3
|
${c.trim()}`})}catch(c){console.warn(`[stx] Failed to load store ${l}:`,c)}if(g.length===0)return ce(h,t,f,{chunks:[]}),null;f=gt(i());let S={chunks:g};return ce(h,t,f,S),S}function j(s){let o=new Set;for(let r of s)for(let i of r.declared)o.add(i);let e=s.map((r)=>r.code).join(`
|
|
4
4
|
|
|
5
5
|
`),n=`;(function(){
|
|
@@ -12,7 +12,7 @@ var __stx = window.stx || {};
|
|
|
12
12
|
${k.filter((i)=>!n.has(i)&&new RegExp(`\\b${i}\\b`).test(e.code)).map((i)=>`var ${i} = __stx[${JSON.stringify(i)}];`).join(`
|
|
13
13
|
`)}
|
|
14
14
|
${e.code}
|
|
15
|
-
}`})}var z=new WeakMap;async function
|
|
15
|
+
}`})}var z=new WeakMap;async function Ym(s){let o=await R(s);if(!o)return null;let e=z.get(o);if(e===void 0)e=j(o.chunks),z.set(o,e);return e}function W(s){if(!/\buseStore\b/.test(s))return!1;if(/\buseStore\s+as\s+[A-Za-z_$]/.test(s))return!0;if(/\{[^{}]*\buseStore\s*:\s*[A-Za-z_$[{][^{}]*\}\s*=(?!=)/.test(s))return!0;if(/\[\s*(['"`])useStore\1\s*\]/.test(s.replace(/\b(?:var|let|const)\s+useStore\s*=\s*[\w$.]*\[\s*(['"`])useStore\1\s*\]/g," ")))return!0;let o=s.replace(/\/\*[\s\S]*?\*\//g," ").replace(/(^|[^:\\'"`])\/\/[^\n]*/g,"$1 ").replace(/\b(?:var|let|const)\s+useStore\s*=\s*[\w$.]*\[\s*(['"`])useStore\1\s*\]/g," ").replace(/\b(?:const|let|var)\s*\{[^{}]*\}\s*=/g," ").replace(/\bimport\s*(?:type\s+)?\{[^{}]*\}\s*from\b/g," ").replace(/\bexport\s*(?:type\s+)?\{[^{}]*\}/g," ").replace(/\btypeof\s+useStore\b/g," ").replace(/(['"`])useStore\1/g," ");for(let e of o.matchAll(/\buseStore\b/g)){let t=o.slice(Math.max(0,e.index-9),e.index);if(/\bfunction\s*$/.test(t))continue;let n=o.slice(e.index+8).trimStart();if(n.startsWith("(")||n.startsWith("<")||n.startsWith("?.("))continue;if(/^=(?![=>])/.test(n))continue;return!0}return!1}function go(...s){let o=new Set,e=!1;for(let t of s){if(!t)continue;if(/__STX_STORES__|\b_stores\b/.test(t))e=!0;if(W(t))e=!0;let n=t.match(/\buseStore\s*(?:<[^>()]*>)?\s*(?:\?\.\s*)?\(/g)?.length??0;if(n===0)continue;let r=0;for(let i of t.matchAll(/\buseStore\s*(?:<[^>()]*>)?\s*(?:\?\.\s*)?\(\s*(['"`])([^'"`$\\]+)\1\s*[,)]/g))o.add(i[2]),r++;if(r!==n)e=!0}return{names:o,all:e}}var F=new Map;function Zm(s){let o=new Set,e=!1;for(let t of s){if(/\.(?:css|json|svg|wasm|png|jpe?g|gif|webp|avif|woff2?|ttf|txt|md)$/i.test(t))continue;let n;try{let r=M.statSync(t),i=F.get(t);if(i&&i.mtimeMs===r.mtimeMs&&i.size===r.size)n=i.read;else n=go(M.readFileSync(t,"utf8")),F.set(t,{mtimeMs:r.mtimeMs,size:r.size,read:n})}catch{n={names:new Set,all:!0}}if(n.all)e=!0;for(let r of n.names)o.add(r)}return{names:o,all:e}}function Qm(s=x.env){return s.STX_PAGE_STORES==="all"}async function eh(s,o,e={}){let t=await R(s,e.sharedModules);if(!t)return null;let{chunks:n}=t,r=go(...o);if(e.reads){if(e.reads.all)r.all=!0;for(let u of e.reads.names)r.names.add(u)}let i=e.runOnce?Z(t):void 0,f;if(e.all||r.all||n.some((u)=>u.ids.length===0)||i===null)f=n;else{let u=new Map;for(let d of n)for(let S of d.ids)u.set(S,d);let m=new Set,p=[...r.names],g=!1;while(p.length>0&&!g){let d=u.get(p.pop());if(!d||m.has(d))continue;m.add(d);let S=go(d.code);if(S.all)g=!0;else p.push(...S.names)}f=g?n:n.filter((d)=>m.has(d))}if(f.length===0)return null;if(i){let u=f.map((d)=>i.get(d)),m=f.map((d)=>d.name),p=O.get(t);if(!p)O.set(t,p=new Map);let g=p.get(m.join("\x00"));if(g===void 0)p.set(m.join("\x00"),g=P(m,u));return{code:g,stores:m,functions:u}}return{code:j(f),stores:f.map((u)=>u.name),functions:I(f)}}var O=new WeakMap,w=new WeakMap;function Z(s){if(w.has(s))return w.get(s);let o=I(s.chunks),e=o?new Map(s.chunks.map((t,n)=>[t,o[n]])):null;return w.set(s,e),e}function P(s,o){let t=`;(function(){
|
|
16
16
|
var ran = window.__stxStoreFiles || (window.__stxStoreFiles = {});
|
|
17
17
|
function run(name, define) {
|
|
18
18
|
if (ran[name]) return;
|
|
@@ -22,5 +22,5 @@ function run(name, define) {
|
|
|
22
22
|
}
|
|
23
23
|
${s.map((n,r)=>`run(${JSON.stringify(n)}, ${o[r]})`).join(`;
|
|
24
24
|
`)};
|
|
25
|
-
})();`;return E()?_n(t):t}function
|
|
26
|
-
export{
|
|
25
|
+
})();`;return E()?_n(t):t}function th(){h.clear(),Fn()}
|
|
26
|
+
export{Ym,go,Zm,Qm,eh,th};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{f,d}from"./chunk-
|
|
3
|
-
export{Ll,
|
|
2
|
+
import{f,d}from"./chunk-7s9wx19m.js";import{J,I,p}from"./chunk-4qrr2mdd.js";function z(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 N=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function k(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 B(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=k(t,s+1);if(a===-1)return-1;let u=t.slice(s,a),c=u.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(c&&c[2].toLowerCase()===r){if(c[1]==="/"){if(e--,e===0)return a}else if(!/\/\s*>$/.test(u))e++}n=a}return-1}function Z(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 l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),u=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!u){e=s;continue}let c=u[2].toLowerCase();if(u[1]==="/"){let l=i.lastIndexOf(c);if(l!==-1)i.splice(l);e=s;continue}let g=/\/\s*>$/.test(a),m=i.length===0?a.match(r):null;if(m){let l=m[1]||m[2],h=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),S=g||N.has(c)?-1:B(t,c,s);if(S===-1)o.push({start:n,end:s,slotName:l,element:h}),e=s;else o.push({start:n,end:S,slotName:l,element:h+t.slice(s,S)}),e=S;continue}if(!g&&!N.has(c)){if(i.push(c),c==="script"||c==="style"){let l=t.toLowerCase().indexOf(`</${c}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function L(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 l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),u=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!u){e=s;continue}let c=u[1]==="/",g=u[2].toLowerCase();if(c){let l=i.lastIndexOf(g);if(l!==-1)i.splice(l);e=s;continue}if(g==="template"&&i.length===0){let l=a.match(r);if(l){let h=z(t,s);if(h!==-1){let S=l[1]||l[2]||l[3];o.push({start:n,end:h,slotName:S,content:t.slice(s,h-11).trim(),propsBinding:l[4]||void 0}),e=h;continue}}}if(!/\/\s*>$/.test(a)&&!N.has(g)){if(i.push(g),g==="script"||g==="style"){let l=t.toLowerCase().indexOf(`</${g}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function Ll(t){let o={default:"",named:new Map},i=t,r=L(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=Z(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 cm(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 jl(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},a=new Set,u=new Set;if(n.startsWith("{")&&n.endsWith("}")){let c=n.slice(1,-1).split(",").map((g)=>g.trim()).filter(Boolean);for(let g of c){let[m,l]=g.split(":").map((S)=>S.trim()),h=l||m;if(s[h]=o[m],o[m]!==void 0)u.add(h);else a.add(h)}}else if(s[n]=o,Object.values(o).some((c)=>c===void 0))a.add(n);else u.add(n);e=j(e,s,a,u)}return e}function j(t,o,i,r){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(e,n)=>{try{let s=n.trim();if(I(s,i))return e;if(Array.isArray(o.__stx_preserved_client_expressions)&&o.__stx_preserved_client_expressions.includes(s)&&!I(s,r))return e;let a=_(s,o);if(a===void 0)return e;return p(String(a??""))}catch{return`{{ ${n} }}`}})}function _(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(!f(t))return;return d(t,Object.keys(o))(...Object.values(o))}catch{return}}async function Bl(t,o,i,r){let e=t;e=await W(e,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(a,u,c,g)=>{let m=o.named.get(u),l=g?.trim()||"",h=c||"",S={},E=[],C=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,b;while((b=C.exec(h))!==null){let w=b[1],x=b[2];S[w]=_(x,i),E.push([w,x])}if(r!==void 0&&m?.propsBinding&&Object.values(S).some((w)=>w===void 0)){let w=m.propsBinding.trim(),x=J(`${w} in []`),y="__stx_slot_props";while(x.includes(y))y+="_";let M=E.map(([A,P])=>{let O=S[A],R;try{R=O===void 0?void 0:JSON.stringify(O)}catch{}return`${JSON.stringify(A)}:(${R??P})`}).join(","),v=p(JSON.stringify({binding:w,names:x,owner:r}));return`<template :for="${p(`${y} in [{${M}}]`)}" data-stx-slot-binding="${encodeURIComponent(w)}" data-stx-slot-scope="${v}">${m.content}</template>`}return await jl(m,S,l,i)});let s=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return e=e.replace(s,(a,u,c)=>{if(/\bname\s*=/.test(u||""))return a;let g=c?.trim()||"";return o.default||g}),e}async function W(t,o,i){let r=[],e=[];t.replace(o,(a,...u)=>{let c=u[u.length-2];return e.push({match:a,index:c}),r.push(i(a,...u.slice(0,-2))),a});let n=await Promise.all(r),s=t;for(let a=e.length-1;a>=0;a--){let{match:u,index:c}=e[a];s=s.slice(0,c)+n[a]+s.slice(c+u.length)}return s}function lm(t){let o=Ll(t);return{defaultSlot:o.default,namedSlots:o.named}}async function um(t,o,i,r,e){return await Bl(t,{default:o,named:i},r,e)}
|
|
3
|
+
export{Ll,cm,jl,Bl,lm,um};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Sm,ga,iu,km,_m,Cm,Em,Tm,au,cu,$m,Rm,Am,Pm}from"./chunk-1e67szzk.js";import"./chunk-5q97egpw.js";import"./chunk-rk2v0wzs.js";import"./chunk-h8yk9qm7.js";import"./chunk-hxyarbb6.js";import"./chunk-8x4gmead.js";import"./chunk-enzrpxsj.js";import"./chunk-5wp7s24b.js";import"./chunk-p7h4y7mk.js";import"./chunk-ecakhzkq.js";import"./chunk-jgmmg2fw.js";import"./chunk-py818vbj.js";import"./chunk-s5kfndxv.js";import"./chunk-rfzfk8zd.js";import"./chunk-svrjbeyq.js";import"./chunk-nrh8t8re.js";import"./chunk-ztbk9yqv.js";import"./chunk-cz3trbvn.js";import"./chunk-fxy7jjnv.js";import"./chunk-4qrr2mdd.js";import"./chunk-rj9dcjeg.js";import"./chunk-1g5fg1ys.js";import"./chunk-7s9wx19m.js";import"./chunk-4833k99b.js";import"./chunk-07c8rk93.js";export{iu as SUSPENSE_RESOLVER_RUNTIME,ga as buildSuspenseResolveScript,Tm as createStreamRenderer,Cm as extractStreamBoundaries,Pm as generateHydrationRuntime,cu as islandDirective,Rm as processSectionDirectives,_m as processStreamDirectives,$m as registerStreamingDirectives,km as renderStreamingPage,Sm as streamTemplate,Em as streamTemplateSimple,Am as streamToResponse,au as streamingSuspenseDirective};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Th,ls,Bo,us,or,Fo,zo,Af,ds,ps,gs,Ho,sc,Pf,bt}from"./chunk-ecakhzkq.js";import"./chunk-jgmmg2fw.js";import"./chunk-py818vbj.js";import"./chunk-rfzfk8zd.js";import"./chunk-svrjbeyq.js";import"./chunk-nrh8t8re.js";import"./chunk-ztbk9yqv.js";import"./chunk-cz3trbvn.js";import"./chunk-fxy7jjnv.js";import{z}from"./chunk-4qrr2mdd.js";import"./chunk-rj9dcjeg.js";import"./chunk-1g5fg1ys.js";import"./chunk-7s9wx19m.js";import"./chunk-4833k99b.js";import"./chunk-07c8rk93.js";export{Af as bindLoopInterpolations,Th as clearScriptScanCache,ds as convertServerLoopAttributesToDirectives,Fo as convertSignalDirectivesToAttributes,ps as convertSignalLoopsToAttributes,or as extractClientSignalNames,z as extractExports,sc as findMarkupIndexOutsideScripts,us as hasSignalsSyntax,Bo as parseLoopExpression,zo as preEvalLiteralReactiveIfs,gs as processScriptSetup,Ho as processSignals,Pf as rewriteStxImportSpecifiers,ls as scanScriptTags,bt as stripStxRuntimeImports};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Zo,Qo,xt,ue,dr,_s,pr,Cs,Es,Lf,jf,Bf,fr,Ff,zf,Hf,Vf,wc,vc,xc,ei,Sc,Uf,St,kt,_t,Ct,Et,Tt,et,Wf}from"./chunk-fxy7jjnv.js";export{pr as Router,Hf as abortNavigation,_s as bracketPathToRegex,St as clearMiddleware,vc as createClientCookieManager,Et as createMiddlewareContext,Ct as createRouteLocation,wc as createServerCookieManager,xc as createStorageManager,Vf as defineMiddleware,jf as defineRoute,Bf as defineRoutes,Cs as findErrorPage,Es as formatRoutes,Qo as generateRouteManifest,Zo as generateRouteTypes,Sc as getMiddleware,kt as getMiddlewareNames,et as getRouterScript,Wf as getRouterScriptDev,Uf as hasMiddleware,xt as isFileRequestPath,_t as loadMiddlewareFromDirectory,dr as matchRoute,zf as navigateTo,ue as patternToRegex,ei as registerMiddleware,Ff as resetRoutes,fr as route,Tt as runMiddleware,Lf as setAppUrl};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ue}from"./chunk-
|
|
2
|
+
import{ue}from"./chunk-fxy7jjnv.js";import{ze,O}from"./chunk-1g5fg1ys.js";import{hc}from"./chunk-ztbk9yqv.js";import{l}from"./chunk-s2py8kg7.js";import v from"fs";import m from"path";import{pathToFileURL as I}from"url";var P=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],R=new Set;function sn(s,c={}){let o=m.resolve(s,c.dir??"server/api"),i=[],f=new Map;if(!v.existsSync(o))return i;let t=Array.from(new Bun.Glob("**/*.{ts,js,mts,mjs}").scanSync({cwd:o})).sort();for(let e of t){if(e.endsWith(".d.ts"))continue;let p=e.replace(/\.(?:ts|js|mts|mjs)$/,"").split("/"),n=p.pop(),u=n.lastIndexOf("."),d=u>=0?n.slice(u+1):"get",g=d.toUpperCase();if(!P.includes(g)||d!==d.toLowerCase())throw Error(`Unsupported API method suffix in ${e}; use ${P.map((A)=>A.toLowerCase()).join(", ")}`);if(u>=0)n=n.slice(0,u);if(n!=="index")p.push(n);let r=new Set,h=p.map((A,j)=>{let y=/^\[(\.\.\.)?([A-Za-z_]\w*)\]$/.exec(A);if(y){if(r.has(y[2])||y[1]&&j!==p.length-1)throw Error(`Invalid API parameter in ${e}`);return r.add(y[2]),`:${y[2]}${y[1]?"*":""}`}if(!/^[\w-]+$/.test(A))throw Error(`Unsupported API path segment ${A} in ${e}`);return A}),w=`/api${h.length?`/${h.join("/")}`:""}`,S=`${g} ${w.replace(/:\w+/g,":param")}`;if(f.has(S))throw Error(`Ambiguous API route ${g} ${w}: ${f.get(S)} and ${e}`);f.set(S,e);let x=m.join(o,e);R.add(m.resolve(x)),R.add(v.realpathSync(x)),i.push({pattern:w,method:g,filePath:x})}return i.sort((e,a)=>{let p=e.pattern.split("/"),n=a.pattern.split("/"),u=(d)=>d?.endsWith("*")?0:d?.startsWith(":")?1:2;for(let d=0;d<Math.max(p.length,n.length);d++){let g=u(n[d])-u(p[d]);if(g)return g}return e.pattern.localeCompare(a.pattern)||e.method.localeCompare(a.method)})}async function Eo(s,c){let o=l(s,"api-types.d.ts"),i=["// Generated by stx. Include this file in tsconfig.json.","declare module '@stacksjs/stx/api-client' {"," interface KnownApiRoutes {"];for(let t of c){let e=`./${m.relative(m.dirname(o),t.filePath).replace(/\\/g,"/")}`,{params:a}=ue(t.pattern);i.push(` ${JSON.stringify(`${t.method} ${t.pattern}`)}: { params: { ${a.map((p)=>`${JSON.stringify(p)}: string`).join("; ")} }; response: Awaited<ReturnType<typeof import(${JSON.stringify(e)}).default>> }`)}i.push(" }","}","export {}","");let f=i.join(`
|
|
3
3
|
`);if(!await Bun.file(o).exists()||await Bun.file(o).text()!==f)await Bun.write(o,f);return o}async function To(s,c,o={}){let i=sn(s,o);await Eo(s,i);let f=[];for(let t of i){let e=await Bun.build({entrypoints:[t.filePath],target:"bun",format:"esm",minify:!1,splitting:!1});if(!e.success)throw Error(`API build failed for ${t.filePath}: ${e.logs.join(`
|
|
4
|
-
`)}`);let a=e.outputs.find((u)=>u.kind==="entry-point");if(!a)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await a.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(c,n),a),f.push({...t,filePath:n})}return f}function E(s,c){let o=s.map((i)=>({route:i,...ue(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,a=(r)=>r.replace(/:\w+/g,":param"),p=t.filter((r)=>a(r.route.pattern)===a(e)),n=i.method,u=p.find((r)=>r.route.method===n)??(n==="HEAD"?p.find((r)=>r.route.method==="GET"):void 0);if(!u){let r=new Set(p.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=u.regex.exec(f),g=Object.create(null);try{u.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await c(u.route);if(typeof r!=="function")throw Error(`API endpoint ${u.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function $o(s,c){return E(c,async(o)=>(await import(I(m.resolve(s,o.filePath)).href)).default)}async function
|
|
4
|
+
`)}`);let a=e.outputs.find((u)=>u.kind==="entry-point");if(!a)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await a.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(c,n),a),f.push({...t,filePath:n})}return f}function E(s,c){let o=s.map((i)=>({route:i,...ue(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,a=(r)=>r.replace(/:\w+/g,":param"),p=t.filter((r)=>a(r.route.pattern)===a(e)),n=i.method,u=p.find((r)=>r.route.method===n)??(n==="HEAD"?p.find((r)=>r.route.method==="GET"):void 0);if(!u){let r=new Set(p.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=u.regex.exec(f),g=Object.create(null);try{u.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await c(u.route);if(typeof r!=="function")throw Error(`API endpoint ${u.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function $o(s,c){return E(c,async(o)=>(await import(I(m.resolve(s,o.filePath)).href)).default)}async function bh(s,c){if(!c)return async()=>null;let o=c===!0?{}:c,i=sn(s,o);return await Eo(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=sn(s,o);await Eo(s,t);let{loadStxConfig:e}=await import("./chunk-dbx628ra.js"),a=O((await e(s)).runtimeConfig);return await ze(a,()=>E(t,async(p)=>{let n=await Bun.build({entrypoints:[p.filePath],target:"bun",format:"esm",splitting:!1});if(!n.success)throw Error(n.logs.join(`
|
|
5
5
|
`));let u=n.outputs.find((d)=>d.kind==="entry-point");if(!u||n.outputs.length!==1)throw Error(`Unsupported API bundle output: ${p.filePath}`);return(await import(`data:text/javascript;base64,${Buffer.from(await u.text()).toString("base64")}`)).default})(f))}catch(t){return console.error("[stx] API discovery failed:",t),Response.json({error:"API discovery failed; check the server log"},{status:500})}}}function Ro(s,c,o){if(hc(s))return!0;let i=/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/;if(i.test(m.basename(s)))return!0;try{if(i.test(m.basename(v.realpathSync(s))))return!0}catch{}if(R.has(m.resolve(s)))return!0;if(!o)return!1;let f=m.resolve(c,typeof o==="object"?o.dir??"server/api":"server/api"),t=(a)=>{try{return v.realpathSync(a)}catch{return m.resolve(a)}},e=t(s);return[f,m.resolve(c,"server"),m.resolve(c,".output/server")].some((a)=>{let p=t(a);return e===p||e.startsWith(`${p}${m.sep}`)})}
|
|
6
|
-
export{sn,Eo,To,$o,
|
|
6
|
+
export{sn,Eo,To,$o,bh,Ro};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{t,c,jt,Bt,Ft,He,st,N,Ws,Ar,Ve}from"./chunk-
|
|
2
|
+
import{t,c,jt,Bt,Ft,He,st,N,Ws,Ar,Ve}from"./chunk-7s9wx19m.js";var O=/(?<![\w$@])@meta\s*\(/g,I=/(?<![\w$@])@metaTag\s*\(/g,C=/(?<![\w$@])@structuredData\s*\(/g,k=/(?<![\w$@])@seo\s*\(/g;function _(e,r){return(n)=>N(e,n,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX)}function j(e){return"property"in e?`<meta property="${l(e.property)}" content="${l(e.content)}">`:`<meta name="${l(e.name)}" content="${l(e.content)}">`}function Xo(e,r,n,g){if(!e.includes("@meta"))return e;let i=jt(e,O,(a,o)=>{let s=Ar(Bt(a),r);if(s.kind==="tag")return j(s.tag);if(s.kind==="empty")return"";return N("Meta",o,s.message,n,s.code)},_("Meta",n));return i=jt(i,I,(a,o)=>{let s=Ft(a,r);if(!s.ok)return N("MetaTag",o,s.message,n,s.code);if(s.value===void 0||s.value===null)return"";if(!st(s.value))return N("MetaTag",o,`expected an object such as { name, content }, got ${He(s.value)}`,n,t.TYPE_ERROR);let u=s.value;if(!u.name&&!u.property&&!u.httpEquiv)return N("MetaTag",o,"the tag needs a name, property or httpEquiv",n,t.INVALID_DIRECTIVE_SYNTAX);if(u.content===void 0||u.content===null||u.content===""||u.content===!1)return"";let p="<meta";if(u.name)p+=` name="${l(u.name)}"`;if(u.property)p+=` property="${l(u.property)}"`;if(u.httpEquiv)p+=` http-equiv="${l(u.httpEquiv)}"`;return p+=` content="${l(u.content)}">`,p},_("MetaTag",n)),i}function b(e){let r=(n)=>n["@context"]?{...n}:{...n,"@context":"https://schema.org"};if(st(e))return r(e);if(Array.isArray(e)&&e.length>0&&e.every(st))return e.map(r);return null}function E(e){return`<script type="application/ld+json">${JSON.stringify(e).replace(/<\//g,"<\\/")}</script>`}function Go(e,r,n){if(!e.includes("@structuredData"))return e;return jt(e,C,(g,i)=>{let a=Ft(g,r);if(!a.ok)return N("StructuredData",i,a.message,n,a.code);if(a.value===void 0||a.value===null)return"";let o=b(a.value);if(!o)return N("StructuredData",i,`expected an object or an array of objects, got ${He(a.value)}`,n,t.TYPE_ERROR);try{return E(o)}catch(s){let u=s instanceof Error?s.message:String(s);return N("StructuredData",i,`the data cannot be written as JSON: ${u}`,n,t.EVALUATION_ERROR)}},_("StructuredData",n))}var L=new Set(["title","description","keywords","robots","canonical","openGraph","twitter","structuredData"]),A={image:"openGraph.image",url:"canonical or openGraph.url",type:"openGraph.type",siteName:"openGraph.siteName",locale:"openGraph.locale",og:"openGraph",author:"@meta('author', ...)"};function Jo(e,r,n,g){if(!e.includes("@seo"))return e;return jt(e,k,(i,a)=>{if(!i.trim())return N("SEO",a,"expected an object: @seo({ title, description }) or @seo(seoVariable)",n,t.INVALID_DIRECTIVE_SYNTAX);let o=Ft(i,r);if(!o.ok)return N("SEO",a,o.message,n,o.code);if(o.value===void 0||o.value===null)return"";if(!st(o.value))return N("SEO",a,`expected an object such as { title, description }, got ${He(o.value)}`,n,t.TYPE_ERROR);try{return q(o.value,a,n)}catch(s){let u=s instanceof Error?s.message:String(s);return N("SEO",a,`Error processing @seo directive: ${u}`,n,t.EVALUATION_ERROR)}},_("SEO",n))}function R(e,r,n,g){let i=e[r];if(i===void 0||i===null||i===!1)return;if(st(i))return i;Ws(n,`${r} must be an object, got ${He(i)}; its tags were left out`,g);return}function q(e,r,n){let g=Object.keys(e).filter((s)=>!L.has(s));if(g.length>0){let s=g.map((u)=>A[u]?`${u} (use ${A[u]})`:u).join(", ");Ws(r,`@seo does not read ${s}; ${g.length===1?"it was":"they were"} ignored`,n)}let i="";if(e.title)i+=`<title>${l(e.title)}</title>
|
|
3
3
|
`,i+=`<meta name="title" content="${l(e.title)}">
|
|
4
4
|
`;if(e.description)i+=`<meta name="description" content="${l(e.description)}">
|
|
5
5
|
`;if(e.keywords){let s=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;i+=`<meta name="keywords" content="${l(s)}">
|
|
@@ -43,7 +43,7 @@ import{t,c,jt,Bt,Ft,He,st,N,Ws,Ar,Ve}from"./chunk-1w4a0xya.js";var O=/(?<![\w$@]
|
|
|
43
43
|
${y}
|
|
44
44
|
`),h;return h.replace(/<head[^>]*>/,`$&
|
|
45
45
|
${y}
|
|
46
|
-
`)}function M(e){let r=e.search(/<\/head\s*>/i);return r===-1?e:e.slice(0,r)}function v(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�*39;|'/g,"'").replace(/&/g,"&")}function V(e){let r=e.match(/<title(?:\s[^>]*)?>([\s\S]*?)<\/title\s*>/i);return r?v(r[1].trim()):""}function x(e){return(e.match(/<meta\s[^>]*>/gi)||[]).filter((r)=>/\sname\s*=\s*["']description["']/i.test(r))}function G(e){return x(e).length>0}function U(e){for(let r of x(e)){let n=r.match(/\scontent\s*=\s*(?:"([^"]*)"|'([^']*)')/i),g=(n?.[1]??n?.[2]??"").trim();if(g)return v(g)}return""}function l(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var xs={name:"meta",rawParams:!0,handler:(e,r,n,g)=>{let i=Ar(r,n??{});if(i.kind==="error")return N("Meta",`@meta(${r.join(", ")})`,i.message,g,i.code);if(i.kind==="empty")return"";if(n)n.__stx_runtime_head=Ve(n.__stx_runtime_head??{},{meta:[i.tag]});return""},hasEndTag:!1},Ss={name:"structuredData",handler:(e,r,n,g)=>{if(e.trim()==="")return c("StructuredData","structuredData directive requires JSON-LD content",t.INVALID_DIRECTIVE_SYNTAX);try{let i=JSON.parse(e);if(!i["@context"])i["@context"]="https://schema.org";if(!i["@type"])return c("StructuredData","structuredData requires @type property",t.INVALID_DIRECTIVE_SYNTAX);return E(i)}catch(i){let a=i instanceof Error?i.message:String(i);return c("StructuredData",a,t.EVALUATION_ERROR)}},hasEndTag:!0};function
|
|
46
|
+
`)}function M(e){let r=e.search(/<\/head\s*>/i);return r===-1?e:e.slice(0,r)}function v(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�*39;|'/g,"'").replace(/&/g,"&")}function V(e){let r=e.match(/<title(?:\s[^>]*)?>([\s\S]*?)<\/title\s*>/i);return r?v(r[1].trim()):""}function x(e){return(e.match(/<meta\s[^>]*>/gi)||[]).filter((r)=>/\sname\s*=\s*["']description["']/i.test(r))}function G(e){return x(e).length>0}function U(e){for(let r of x(e)){let n=r.match(/\scontent\s*=\s*(?:"([^"]*)"|'([^']*)')/i),g=(n?.[1]??n?.[2]??"").trim();if(g)return v(g)}return""}function l(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var xs={name:"meta",rawParams:!0,handler:(e,r,n,g)=>{let i=Ar(r,n??{});if(i.kind==="error")return N("Meta",`@meta(${r.join(", ")})`,i.message,g,i.code);if(i.kind==="empty")return"";if(n)n.__stx_runtime_head=Ve(n.__stx_runtime_head??{},{meta:[i.tag]});return""},hasEndTag:!1},Ss={name:"structuredData",handler:(e,r,n,g)=>{if(e.trim()==="")return c("StructuredData","structuredData directive requires JSON-LD content",t.INVALID_DIRECTIVE_SYNTAX);try{let i=JSON.parse(e);if(!i["@context"])i["@context"]="https://schema.org";if(!i["@type"])return c("StructuredData","structuredData requires @type property",t.INVALID_DIRECTIVE_SYNTAX);return E(i)}catch(i){let a=i instanceof Error?i.message:String(i);return c("StructuredData",a,t.EVALUATION_ERROR)}},hasEndTag:!0};function Lh(){return[xs,Ss]}function jh(e,r){let{baseUrl:n,defaultChangefreq:g="weekly",defaultPriority:i=0.5,includeLastmod:a=!0}=r,o=n.replace(/\/$/,""),s=(m)=>m.startsWith("http")?m:`${o}${m.startsWith("/")?"":"/"}${m}`,u=e.map((m)=>{let d=s(m.loc),f=m.lastmod||(a?new Date().toISOString().split("T")[0]:void 0),D=m.changefreq||g,y=m.priority??i,h=` <url>
|
|
47
47
|
<loc>${T(d)}</loc>`;for(let w of m.alternates??[])h+=`
|
|
48
48
|
<xhtml:link rel="alternate" hreflang="${T(w.hreflang)}" href="${T(s(w.href))}"/>`;if(f)h+=`
|
|
49
49
|
<lastmod>${f}</lastmod>`;return h+=`
|
|
@@ -53,13 +53,13 @@ ${y}
|
|
|
53
53
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${e.some((m)=>m.alternates?.length)?' xmlns:xhtml="http://www.w3.org/1999/xhtml"':""}>
|
|
54
54
|
${u.join(`
|
|
55
55
|
`)}
|
|
56
|
-
</urlset>`}function
|
|
56
|
+
</urlset>`}function Bh(e,r){let n=r.replace(/\/$/,""),g=new Date().toISOString().split("T")[0];return`<?xml version="1.0" encoding="UTF-8"?>
|
|
57
57
|
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
58
58
|
${e.map((a)=>{let o=a.startsWith("http")?a:`${n}${a.startsWith("/")?"":"/"}${a}`;return` <sitemap>
|
|
59
59
|
<loc>${T(o)}</loc>
|
|
60
60
|
<lastmod>${g}</lastmod>
|
|
61
61
|
</sitemap>`}).join(`
|
|
62
62
|
`)}
|
|
63
|
-
</sitemapindex>`}async function
|
|
64
|
-
`).trim()}function
|
|
65
|
-
export{Xo,Go,Jo,Yo,xs,Ss,
|
|
63
|
+
</sitemapindex>`}async function Fh(e,r){let{extensions:n=[".stx",".html",".htm"],ignore:g=["_*",".*","node_modules","components","partials","layouts"]}=r,i=[],a=n.length===1?`*${n[0]}`:`*{${n.join(",")}}`,o=new Bun.Glob(`**/${a}`);for await(let s of o.scan(e)){if(g.some((f)=>{if(f.startsWith("*"))return s.includes(f.slice(1));return s.startsWith(f)||s.includes(`/${f}`)}))continue;let p=s.replace(/\\/g,"/").replace(/index\.(stx|html|htm)$/,"").replace(/\.(stx|html|htm)$/,"");if(!p.startsWith("/"))p=`/${p}`;if(p!=="/"&&p.endsWith("/"))p=p.slice(0,-1);let m=`${e}/${s}`,d;try{let f=await Bun.file(m).stat();if(f)d=new Date(f.mtime).toISOString().split("T")[0]}catch{}i.push({loc:p||"/",lastmod:d,priority:p==="/"?1:0.5})}return i.sort((s,u)=>s.loc.localeCompare(u.loc)),i}function ks(e){let r=[];for(let n of e.rules){if(r.push(`User-agent: ${n.userAgent}`),n.allow)for(let g of n.allow)r.push(`Allow: ${g}`);if(n.disallow)for(let g of n.disallow)r.push(`Disallow: ${g}`);if(n.crawlDelay!==void 0)r.push(`Crawl-delay: ${n.crawlDelay}`);r.push("")}if(e.sitemap){let n=Array.isArray(e.sitemap)?e.sitemap:[e.sitemap];for(let g of n)r.push(`Sitemap: ${g}`)}if(e.host)r.push(`Host: ${e.host}`);return r.join(`
|
|
64
|
+
`).trim()}function zh(e){return ks({rules:[{userAgent:"*",allow:["/"]}],sitemap:e})}function T(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}
|
|
65
|
+
export{Xo,Go,Jo,Yo,xs,Ss,Lh,jh,Bh,Fh,ks,zh};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{F,D,Or,Nr,Dr}from"./chunk-efr9dgt6.js";import{resolve as z,basename as j,extname as T,join as q}from"path";import{mkdir as k}from"fs/promises";var S={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0};class Ai{config;constructor(e={}){this.config={...S,...e}}async get(e,s){return Or(e,s,"image",this.config)}async set(e,s,r){return Nr(e,s,r,"image",this.config)}async clear(){return Dr("image",this.config)}updateConfig(e){this.config={...this.config,...e}}}var w=null;function v(e){if(!w)w=new Ai(e);else if(e)w.updateConfig(e);return w}async function Pi(e,s,r){let t=r?{directory:`${r.outputDir}/../.cache`}:{};return v(t).get(e,s)}async function Ii(e,s,r,t){let a=t?{directory:`${t.outputDir}/../.cache`}:{};return v(a).set(e,s,r)}async function
|
|
2
|
+
import{F,D,Or,Nr,Dr}from"./chunk-efr9dgt6.js";import{resolve as z,basename as j,extname as T,join as q}from"path";import{mkdir as k}from"fs/promises";var S={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0};class Ai{config;constructor(e={}){this.config={...S,...e}}async get(e,s){return Or(e,s,"image",this.config)}async set(e,s,r){return Nr(e,s,r,"image",this.config)}async clear(){return Dr("image",this.config)}updateConfig(e){this.config={...this.config,...e}}}var w=null;function v(e){if(!w)w=new Ai(e);else if(e)w.updateConfig(e);return w}async function Pi(e,s,r){let t=r?{directory:`${r.outputDir}/../.cache`}:{};return v(t).get(e,s)}async function Ii(e,s,r,t){let a=t?{directory:`${t.outputDir}/../.cache`}:{};return v(a).set(e,s,r)}async function Cg(){return v().clear()}async function x(){try{return await import("ts-images")}catch{return null}}function R(e){switch(e){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function E(e,s){let r=s?R(s):R("web"),t=e.formatQuality||{};return{jpeg:{...r.jpeg,...t.jpeg},png:{...r.png,...t.png},webp:{...r.webp,...t.webp},avif:{...r.avif,...t.avif}}}async function Eg(e,s,r){let t=await x();if(!t)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:e,processed:!1};let a=await Pi(e,s,r);if(a)return a;try{let c=z(e);if(!await D(c))return{src:e,processed:!1,errors:[`Source file not found: ${e}`]};let n=E(r,s.preset),p=r.outputDir||"dist/images",I=r.baseUrl||"/images";await k(p,{recursive:!0});let d=await F(c),P=j(e,T(e)),b=s.outputFormat?[s.outputFormat]:r.defaultFormats||["avif","webp","jpeg"],o={src:e,processed:!0,variants:[],hash:d},u=null;if(s.transformations&&s.transformations.length>0)u=await bl(c,s.transformations,t);for(let i of b){let l=n[i]||{},g=`${P}-${d}.${i}`,h=q(p,g);try{let m=await t.optimizeImage({input:u||c,output:h,format:i,quality:l.quality,progressive:l.progressive});if(m){if(o.variants.push({path:h,url:`${I}/${g}`,width:m.width||0,height:m.height||0,format:i,size:m.outputSize||0}),!o.originalWidth&&m.width)o.originalWidth=m.width,o.originalHeight=m.height}}catch(m){o.errors=o.errors||[],o.errors.push(`Failed to optimize ${i}: ${m}`)}}if(s.embedThumbhash||s.placeholder==="thumbhash")try{let i=await t.generateThumbHash(c);o.placeholder=i.dataUrl}catch(i){o.errors=o.errors||[],o.errors.push(`Failed to generate thumbhash: ${i}`)}if(s.useDominantColor)try{let i=await t.generatePlaceholder(c,{strategy:"dominant-color"});o.dominantColor=i.dominantColor}catch(i){o.errors=o.errors||[],o.errors.push(`Failed to extract dominant color: ${i}`)}return await Ii(e,s,o,r),o}catch(c){return{src:e,processed:!1,errors:[`Processing failed: ${c}`]}}}async function Tg(e,s,r,t){let a=await x();if(!a)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await a.optimizeImage({input:e,output:t,format:s,quality:r}))?.outputSize}}catch(c){return{success:!1,error:String(c)}}}async function bl(e,s,r){let t=r||await x();if(!t)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let a=await t.decode(e);for(let c of s){let n=c.options||{};switch(c.type){case"resize":if(n.width||n.height)a=await t.resize(a,{width:n.width,height:n.height,fit:n.fit});break;case"blur":if(n.sigma!==void 0)a=await t.blur(a,n.sigma);break;case"sharpen":if(n.amount!==void 0)a=await t.sharpen(a,n.amount);break;case"grayscale":a=await t.grayscale(a);break;case"rotate":if(n.angle!==void 0)a=await t.rotate(a,n.angle);break;case"flip":a=await t.flip(a);break;case"flop":a=await t.flop(a);break;case"brightness":if(n.value!==void 0)a=await t.brightness(a,n.value);break;case"contrast":if(n.value!==void 0)a=await t.contrast(a,n.value);break;case"saturation":if(n.value!==void 0)a=await t.saturation(a,n.value);break}}return await t.encode(a,"png")}catch(a){return console.error(`[stx-media] Transformation failed: ${a}`),null}}import{resolve as Q,basename as U,extname as V,join as L}from"path";import{mkdir as H}from"fs/promises";async function O(){try{return await import("ts-images")}catch{return null}}var A=[320,480,640,768,1024,1280,1536,1920];async function $g(e,s,r){let t=await O();if(!t)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let a=Q(e);if(!await D(a))return console.warn(`[stx-media] Source file not found: ${e}`),null;try{let c=s.responsiveWidths||r.breakpoints||A,n=s.formats||r.defaultFormats||["avif","webp","jpeg"],p=r.outputDir||"dist/images",I=r.baseUrl||"/images";await H(p,{recursive:!0});let d=await F(a),P=U(e,V(e)),b=r.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},o={src:e,byFormat:{},srcsets:{}};for(let i of n){o.byFormat[i]=[];let l=[];for(let g of c){let h=`${P}-${g}w-${d}.${i}`,m=L(p,h),y=`${I}/${h}`;try{let C=b[i]?.quality||80;if(await D(m)){o.byFormat[i].push({path:m,url:y,width:g,height:0,format:i,size:0}),l.push(`${y} ${g}w`);continue}let f=await t.processImage({input:a,output:m,format:i,quality:C,resize:{width:g}});if(f)o.byFormat[i].push({path:m,url:y,width:g,height:f.height||Math.round(g*(f.height||1)/(f.width||1)),format:i,size:f.outputSize||0}),l.push(`${y} ${g}w`)}catch(C){console.warn(`[stx-media] Failed to generate ${i} at ${g}w: ${C}`)}}o.srcsets[i]=l.join(", ")}let u=s.placeholder||r.placeholderStrategy||"thumbhash";if(u!=="none")try{if(u==="thumbhash"){let i=await t.generateThumbHash(a);o.placeholder={dataURL:i.dataUrl,width:i.width||32,height:i.height||32,strategy:"thumbhash"}}else{let i=await t.generatePlaceholder(a,{strategy:u,width:20});o.placeholder={dataURL:i.dataURL,width:i.width,height:i.height,strategy:u}}}catch(i){console.warn(`[stx-media] Failed to generate placeholder: ${i}`)}return o.sizes=s.sizes||B(c),o}catch(c){return console.error(`[stx-media] Responsive generation failed: ${c}`),null}}function B(e){let s=[...e].sort((t,a)=>t-a),r=[];for(let t=0;t<s.length-1;t++){let a=s[t];r.push(`(max-width: ${a}px) ${a}px`)}return r.push(`${s[s.length-1]}px`),r.join(", ")}function Rg(e,s="width"){if(!e||e.length===0)return"";if(s==="dpr")return e.filter((r)=>r.dpr).map((r)=>`${r.url} ${r.dpr}x`).join(", ");return e.map((r)=>`${r.url} ${r.width}w`).join(", ")}export{Ai,Pi,Ii,Cg,Eg,Tg,bl,$g,Rg};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{j,Df,Wo,a,P,Dh,Mh}from"./chunk-rfzfk8zd.js";import"./chunk-svrjbeyq.js";import"./chunk-nrh8t8re.js";import"./chunk-ztbk9yqv.js";import"./chunk-cz3trbvn.js";import"./chunk-fxy7jjnv.js";import"./chunk-4qrr2mdd.js";import"./chunk-rj9dcjeg.js";import"./chunk-1g5fg1ys.js";import"./chunk-7s9wx19m.js";import"./chunk-4833k99b.js";import"./chunk-07c8rk93.js";export{P as config,j as defaultConfig,Dh as defineStxConfig,Wo as discoverConfig,a as loadStxConfig,Df as resolveStxDirectories,Mh as validateConfig};
|