@stacksjs/stx 0.2.919 → 0.2.921
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-0678sab4.js +2 -0
- package/dist/chunk-0bnv0aaz.js +2 -0
- package/dist/chunk-0bvfm5h5.js +2 -0
- package/dist/chunk-0c3q5h03.js +2 -0
- package/dist/chunk-0fh84wr5.js +2 -0
- package/dist/chunk-0p9x0m5n.js +2 -0
- package/dist/{chunk-m390z8w8.js → chunk-0rq1w0xr.js} +7 -7
- package/dist/{chunk-fwxgzktt.js → chunk-1pc2p489.js} +2 -2
- package/dist/{chunk-2szhk8mh.js → chunk-29cy41z3.js} +4 -4
- package/dist/{chunk-9mack1g8.js → chunk-2d0pemtc.js} +3 -3
- package/dist/{chunk-1bf0grbf.js → chunk-2qnpr0ty.js} +3 -3
- package/dist/{chunk-fjpt8arw.js → chunk-2r2tayyd.js} +2 -2
- package/dist/chunk-2sfxj244.js +2 -0
- package/dist/{chunk-wxqay5c2.js → chunk-30d298vs.js} +1 -1
- package/dist/{chunk-d69k67bn.js → chunk-36j2drjv.js} +9 -9
- package/dist/{chunk-9gr7m3tb.js → chunk-3d0bjcn7.js} +1 -1
- package/dist/chunk-3k9d0h11.js +2 -0
- package/dist/{chunk-whnzf9hn.js → chunk-3mc9ew9r.js} +6 -6
- package/dist/chunk-43r0h76m.js +2 -0
- package/dist/{chunk-cbqe84g3.js → chunk-4f8h38xr.js} +2 -2
- package/dist/{chunk-858p3hkz.js → chunk-4jg8ddfy.js} +2 -2
- package/dist/chunk-4jh5t3rz.js +2 -0
- package/dist/{chunk-rk16391e.js → chunk-4nabpd82.js} +5 -5
- package/dist/{chunk-p3x7kwb5.js → chunk-4w203ddt.js} +6 -6
- package/dist/chunk-4y2k14ec.js +2 -0
- package/dist/chunk-57xcb1wn.js +2 -0
- package/dist/chunk-5ekbye3p.js +2 -0
- package/dist/chunk-5s1q4y2j.js +2 -0
- package/dist/chunk-6359fekc.js +2 -0
- package/dist/{chunk-wv0wsavj.js → chunk-66cz2ph7.js} +2 -2
- package/dist/{chunk-p0xqm2ne.js → chunk-7767n5k6.js} +1 -1
- package/dist/{chunk-xpsg91dh.js → chunk-78j6c3sf.js} +5 -5
- package/dist/{chunk-qtzfbv7e.js → chunk-7d0h2pa3.js} +5 -5
- package/dist/{chunk-jgtn9t5n.js → chunk-7g720sk3.js} +2 -2
- package/dist/chunk-7nshr15z.js +2 -0
- package/dist/{chunk-14df2jzs.js → chunk-875wejw1.js} +2 -2
- package/dist/chunk-8g6cmgn8.js +2 -0
- package/dist/chunk-8gfdy17b.js +2 -0
- package/dist/{chunk-fn0y9z1t.js → chunk-8vjsmyrk.js} +5 -5
- package/dist/chunk-8yx65vb0.js +2 -0
- package/dist/{chunk-09xqy448.js → chunk-90ps064x.js} +2 -2
- package/dist/chunk-91nwc581.js +2 -0
- package/dist/{chunk-yzqb7y45.js → chunk-94001bha.js} +5 -5
- package/dist/chunk-94skx5m6.js +2 -0
- package/dist/chunk-9aegppj7.js +2 -0
- package/dist/{chunk-gjyz5ma7.js → chunk-9ch2qhbw.js} +1 -1
- package/dist/{chunk-m6hrb7rm.js → chunk-9sk596tw.js} +25 -25
- package/dist/{chunk-3ftrv1f7.js → chunk-a3qb13vr.js} +20 -20
- package/dist/chunk-a5vzdhsk.js +2 -0
- package/dist/{chunk-jjq7c8s2.js → chunk-a78k8fkg.js} +2 -2
- package/dist/{chunk-txk2z7v0.js → chunk-ag07tdhn.js} +4 -4
- package/dist/{chunk-0wctbtad.js → chunk-amnfd29h.js} +3 -3
- package/dist/chunk-aqh48tyw.js +2 -0
- package/dist/{chunk-zaj3nnvv.js → chunk-avtq2p0c.js} +2 -2
- package/dist/{chunk-3kpxkjgm.js → chunk-b0kq5mzq.js} +2 -2
- package/dist/chunk-b6am4h24.js +2 -0
- package/dist/{chunk-qzqqzraq.js → chunk-b9z4nb1v.js} +6 -6
- package/dist/{chunk-d4xjwebv.js → chunk-bwnx71s8.js} +5 -5
- package/dist/{chunk-mr9pp5cf.js → chunk-c3nmjx26.js} +2 -2
- package/dist/chunk-cajg2sz0.js +2 -0
- package/dist/{chunk-3efpqm1f.js → chunk-dhx4m7mf.js} +2 -2
- package/dist/chunk-dktqmf4t.js +2 -0
- package/dist/chunk-dqwxyk1m.js +2 -0
- package/dist/chunk-e2kk1d9z.js +2 -0
- package/dist/{chunk-zrxvj3zf.js → chunk-e8aqkt1b.js} +6 -6
- package/dist/{chunk-mztjpp7m.js → chunk-e8hvbc53.js} +2 -2
- package/dist/{chunk-kk9h53xg.js → chunk-edjzm0vj.js} +3 -3
- package/dist/chunk-ee4ejnk2.js +2 -0
- package/dist/chunk-eezp4a40.js +2 -0
- package/dist/chunk-eh2ynja3.js +2 -0
- package/dist/chunk-emk29htn.js +2 -0
- package/dist/{chunk-xq5s4vc1.js → chunk-eqj8nj5c.js} +1 -1
- package/dist/{chunk-ktv65e3n.js → chunk-f8sh6289.js} +7 -7
- package/dist/{chunk-6n6kndk0.js → chunk-fb1hyhgf.js} +3 -3
- package/dist/chunk-fd0vnz09.js +2 -0
- package/dist/chunk-fyhtp2nt.js +2 -0
- package/dist/{chunk-xk7hdpq5.js → chunk-g2fxp9zp.js} +3 -3
- package/dist/chunk-gbct53j0.js +2 -0
- package/dist/{chunk-m9ta0640.js → chunk-gsm3rk4j.js} +2 -2
- package/dist/{chunk-x40j67z1.js → chunk-gt9bt8xa.js} +2 -2
- package/dist/{chunk-ft34x0h1.js → chunk-gxdy4qjj.js} +4 -4
- package/dist/chunk-gxtq25gr.js +2 -0
- package/dist/chunk-h1dnjn9g.js +2 -0
- package/dist/{chunk-yvaqgdv1.js → chunk-h7z23fpq.js} +1 -1
- package/dist/{chunk-sxrcac01.js → chunk-hakevnm1.js} +2 -2
- package/dist/chunk-hn7fv830.js +2 -0
- package/dist/chunk-hx6tr46s.js +1459 -0
- package/dist/chunk-jenk04c8.js +2 -0
- package/dist/{chunk-1baxccfq.js → chunk-jfy0r3hx.js} +24 -24
- package/dist/{chunk-9zwmfkfg.js → chunk-jh007a8k.js} +5 -5
- package/dist/chunk-jh1hdq31.js +3 -0
- package/dist/{chunk-tb4be5ct.js → chunk-jk1hzawb.js} +3 -3
- package/dist/{chunk-hht7n4zd.js → chunk-jya12bfn.js} +2 -2
- package/dist/chunk-k1qbgpfy.js +2 -0
- package/dist/chunk-kgmwja6f.js +2 -0
- package/dist/{chunk-z6nyyt3n.js → chunk-khf62zkn.js} +5 -5
- package/dist/chunk-kppj8rqa.js +2 -0
- package/dist/{chunk-514yg4dr.js → chunk-m3ra99h8.js} +6 -6
- package/dist/{chunk-qsnw0qyp.js → chunk-m8rzaqm8.js} +2 -2
- package/dist/chunk-msvphygp.js +2 -0
- package/dist/chunk-mzbejejf.js +2 -0
- package/dist/{chunk-v1x96kjr.js → chunk-nkgqhb7s.js} +7 -7
- package/dist/{chunk-9707zz6v.js → chunk-p17jeqz0.js} +2 -2
- package/dist/{chunk-2f46pcg0.js → chunk-pe5sstex.js} +2 -2
- package/dist/{chunk-vtj3dwhh.js → chunk-pqr4gn9b.js} +2 -2
- package/dist/{chunk-40j2pmnb.js → chunk-prj38cyp.js} +5 -5
- package/dist/{chunk-mn9t5fnv.js → chunk-q8snpht6.js} +2 -2
- package/dist/chunk-q99y5115.js +3 -0
- package/dist/{chunk-7axtwg1f.js → chunk-qzspvwv6.js} +2 -2
- package/dist/chunk-r02asm46.js +2 -0
- package/dist/{chunk-vf7tpgqz.js → chunk-r7zvrh58.js} +16 -16
- package/dist/{chunk-ex6dne7e.js → chunk-ra35ptjg.js} +2 -2
- package/dist/chunk-rc4712qh.js +2 -0
- package/dist/chunk-rq7sg012.js +33 -0
- package/dist/{chunk-v060015m.js → chunk-rt4gzqs9.js} +1 -1
- package/dist/chunk-rx1xw7q2.js +2 -0
- package/dist/{chunk-mnpfvxpa.js → chunk-rzmephr2.js} +30 -30
- package/dist/{chunk-0xyfs691.js → chunk-s3rhbwgf.js} +4 -4
- package/dist/{chunk-xap1f1bw.js → chunk-s6w14v6h.js} +2 -2
- package/dist/{chunk-nkbnsbb0.js → chunk-sdvv8zge.js} +2 -2
- package/dist/{chunk-3br07y64.js → chunk-sgppgy5e.js} +5 -5
- package/dist/{chunk-v1a5h1tc.js → chunk-sk7pptzf.js} +9 -9
- package/dist/{chunk-50zzar2c.js → chunk-sk8x8nw8.js} +3 -3
- package/dist/chunk-skjm3zdh.js +2 -0
- package/dist/{chunk-5fdc8pej.js → chunk-t4exh7c9.js} +7 -7
- package/dist/{chunk-3hfv217t.js → chunk-t64mp8x1.js} +6 -6
- package/dist/{chunk-neymp1bb.js → chunk-tfpd7aht.js} +3 -3
- package/dist/chunk-tsnzhke9.js +2 -0
- package/dist/{chunk-yye2pec5.js → chunk-tt6n2mx6.js} +14 -14
- package/dist/chunk-txyze88n.js +2 -0
- package/dist/chunk-v1t7sees.js +2 -0
- package/dist/{chunk-1a2c4pv8.js → chunk-vhp5hqwp.js} +10 -10
- package/dist/{chunk-1vsjmwr1.js → chunk-vn3hsx7v.js} +2 -2
- package/dist/chunk-vt410s5m.js +2 -0
- package/dist/{chunk-3tcy9r6r.js → chunk-w27j0apm.js} +14 -14
- package/dist/{chunk-2zb642qr.js → chunk-w5vxzk5j.js} +6 -6
- package/dist/chunk-w81a1e14.js +9 -0
- package/dist/{chunk-tnbzg7fd.js → chunk-wajvxzt0.js} +2 -2
- package/dist/chunk-wrva7jes.js +2 -0
- package/dist/{chunk-p4twxjfs.js → chunk-ws25jw6x.js} +3 -3
- package/dist/{chunk-m86sjbx7.js → chunk-ww24mxmd.js} +3 -3
- package/dist/chunk-xdprx6tx.js +1331 -0
- package/dist/chunk-xgv3gy1b.js +2 -0
- package/dist/chunk-xjhv5e5f.js +2 -0
- package/dist/chunk-xnvh4jk2.js +21 -0
- package/dist/chunk-xtakhmnb.js +2 -0
- package/dist/{chunk-zb6my502.js → chunk-y97g0kwc.js} +1 -1
- package/dist/chunk-y9f9d4zv.js +2 -0
- package/dist/{chunk-qda8tmk9.js → chunk-yfe380a4.js} +2 -2
- package/dist/{chunk-6x5a2w5a.js → chunk-ygtz9kc7.js} +2 -2
- package/dist/chunk-yyypc7s3.js +2 -0
- package/dist/chunk-z5j4prza.js +2 -0
- package/dist/{chunk-2jm7map2.js → chunk-z68teecy.js} +2 -2
- package/dist/cli.js +20 -20
- package/dist/composables/use-media-query.js +23 -22
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/native/accessibility.d.ts +1 -1
- package/dist/native/accessibility.js +5 -3
- package/dist/native/bridge/protocol.d.ts +1 -0
- package/dist/native/compiler/html-to-ir.js +14 -1
- package/dist/native/compiler/ir.d.ts +7 -0
- package/dist/native/components/primitives.d.ts +1 -0
- package/dist/native/event-names.js +4 -0
- package/dist/native/prop-names.js +3 -1
- package/dist/native/runtime/browser-renderer.js +4 -0
- package/dist/native/runtime/craft-bridge.js +1 -0
- package/dist/native/runtime/craft.d.ts +3 -0
- package/dist/native/runtime/jsc-globals.js +1 -1
- package/dist/native/runtime/native-media.js +8 -3
- package/dist/native/runtime/shared-screen.js +8 -3
- package/dist/native/testing.d.ts +2 -1
- package/dist/native/testing.js +2 -1
- package/dist/process.js +6 -3
- package/dist/pwa.js +3 -3
- package/dist/signal-processing.d.ts +2 -2
- package/dist/signal-processing.js +17 -11
- package/dist/ssg.js +9 -9
- package/dist/utils.js +2 -1
- package/dist/vue-template.d.ts +2 -0
- package/dist/vue-template.js +72 -2
- package/package.json +6 -6
- package/dist/chunk-0ebaf0pr.js +0 -2
- package/dist/chunk-0jjq552g.js +0 -2
- package/dist/chunk-15rc8t28.js +0 -2
- package/dist/chunk-1jrhjn2b.js +0 -2
- package/dist/chunk-1svffhzq.js +0 -2
- package/dist/chunk-2m4ydym0.js +0 -33
- package/dist/chunk-2mv29s6w.js +0 -9
- package/dist/chunk-3aayrnbh.js +0 -21
- package/dist/chunk-426gq0g5.js +0 -2
- package/dist/chunk-4ge80k8j.js +0 -2
- package/dist/chunk-4vdfqr64.js +0 -2
- package/dist/chunk-4yz33vzb.js +0 -2
- package/dist/chunk-4zcswx6x.js +0 -2
- package/dist/chunk-5ht628zp.js +0 -2
- package/dist/chunk-67zy5p7x.js +0 -2
- package/dist/chunk-8153bfpx.js +0 -2
- package/dist/chunk-86p0m920.js +0 -2
- package/dist/chunk-88texeh4.js +0 -2
- package/dist/chunk-8mye65n9.js +0 -2
- package/dist/chunk-8ycgk8w6.js +0 -2
- package/dist/chunk-9xcsn4pb.js +0 -2
- package/dist/chunk-a5tg553d.js +0 -2
- package/dist/chunk-agxxqjjt.js +0 -2
- package/dist/chunk-b44pvac7.js +0 -2
- package/dist/chunk-b4yp16a2.js +0 -2
- package/dist/chunk-fb63xppz.js +0 -2
- package/dist/chunk-ffqqkeye.js +0 -2
- package/dist/chunk-g1v12bjm.js +0 -2
- package/dist/chunk-gg0kkn2e.js +0 -2
- package/dist/chunk-ggg8b8n1.js +0 -2
- package/dist/chunk-ggrcg7k7.js +0 -2
- package/dist/chunk-gmn9ba8f.js +0 -3
- package/dist/chunk-gqe574d9.js +0 -2
- package/dist/chunk-hajamm16.js +0 -2
- package/dist/chunk-hg2n2264.js +0 -2
- package/dist/chunk-hxabvt31.js +0 -2
- package/dist/chunk-j3sat6vn.js +0 -2
- package/dist/chunk-j9gbnqxq.js +0 -2
- package/dist/chunk-jj2z4nxa.js +0 -2
- package/dist/chunk-k289127j.js +0 -2
- package/dist/chunk-m1hfh2t4.js +0 -2
- package/dist/chunk-m3qwqhxp.js +0 -2
- package/dist/chunk-m9smh7fs.js +0 -2
- package/dist/chunk-mhnjtc42.js +0 -2
- package/dist/chunk-n4bxb2hx.js +0 -2
- package/dist/chunk-n958bxm6.js +0 -2
- package/dist/chunk-nkr1aa5z.js +0 -2
- package/dist/chunk-p3vswt0f.js +0 -2
- package/dist/chunk-p8wnp4p1.js +0 -2
- package/dist/chunk-q3z252d9.js +0 -2
- package/dist/chunk-qfkak3jb.js +0 -2
- package/dist/chunk-rt7xy537.js +0 -2
- package/dist/chunk-rwjye578.js +0 -2
- package/dist/chunk-sbr3wg75.js +0 -1467
- package/dist/chunk-sftznswb.js +0 -2
- package/dist/chunk-tz5ktd6d.js +0 -2
- package/dist/chunk-vb609vbj.js +0 -1323
- package/dist/chunk-vtcyber4.js +0 -2
- package/dist/chunk-wq2bpt0w.js +0 -2
- package/dist/chunk-wv8zt78c.js +0 -2
- package/dist/chunk-xakqpa4z.js +0 -3
- package/dist/chunk-xy3ex6ht.js +0 -2
- package/dist/chunk-y899wtm8.js +0 -2
- package/dist/chunk-ye45znz5.js +0 -2
- package/dist/chunk-yegp50jb.js +0 -2
- package/dist/chunk-yq9aqpk8.js +0 -2
- package/dist/chunk-zt45dqfx.js +0 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{existsSync as x,realpathSync as b,statSync as y}from"fs";import f from"path";import k from"process";var E=/^[\w-]+(?:\/[\w-]+)*$/,j=/^[\w-]+$/;async function
|
|
3
|
-
export default kept[${a}] || (kept[${a}] = {});`}var w=new Map;function
|
|
2
|
+
import{existsSync as x,realpathSync as b,statSync as y}from"fs";import f from"path";import k from"process";var E=/^[\w-]+(?:\/[\w-]+)*$/,j=/^[\w-]+$/;async function is(s,e){let a=f.resolve(s,e.dir);if(!e.languages?.length)throw Error("messages.languages must name at least one language");let n=new Map,r=new Map;for(let t of e.languages){if(!j.test(t))throw Error(`messages: "${t}" is not a language directory name`);let g=f.join(a,t);if(!x(g))throw Error(`messages: ${f.relative(s,g)} does not exist`);let o=new Map;for(let l of[...new Bun.Glob("**/*.{ts,js,mjs,json}").scanSync({cwd:g})].sort()){if(/\.(?:test|spec|d)\.[^.]+$/.test(l))continue;let c=l.replace(/\.[^./]+$/,"").split(f.sep).join("/");if(!E.test(c))throw Error(`messages: ${t}/${l} is not an area name`);if(o.has(c))throw Error(`messages: ${t}/${c} is defined twice`);let d=f.join(g,l),i=await import(d),m=Object.keys(i).filter((M)=>M!=="default");if(m.length)throw Error(`messages: ${t}/${l} exports ${m.join(", ")}; a message module exports its messages as default, and nothing else`);let u=i.default,p=u!==null&&typeof u==="object"&&!Array.isArray(u)?JSON.stringify(u):void 0;if(p===void 0||!Bun.deepEquals(JSON.parse(p),u,!0))throw Error(`messages: ${t}/${l} must export plain data (an object JSON can hold) as default`);o.set(c,p),n.set(d,{language:t,area:c})}r.set(t,o)}return{files:n,data:r}}function S(s,e){return`stx-messages:${s}:${e}`}function _(s,e){let a=JSON.stringify(S(s,e));return`var kept = globalThis.__stxMessages || (globalThis.__stxMessages = {});
|
|
3
|
+
export default kept[${a}] || (kept[${a}] = {});`}var w=new Map;function as(s){let e=[s];try{e.push(b(s))}catch{}for(let a of[...e])if(a.startsWith("/private/"))e.push(a.slice(8));return[...new Set(e)]}function $m(s,e=k.env){if(!s.messages||e.STX_PAGE_MESSAGES==="0")return!1;return e.STX_PAGE_MESSAGES==="1"||e.NODE_ENV==="production"}async function Rm(s,e){let a=f.resolve(s,e.dir),n=e.languages.map((i)=>{try{return`${i}:${y(f.join(a,i)).mtimeMs}`}catch{return`${i}:-`}}).join("|"),r=`${a}\x00${e.languages.join(",")}\x00${e.fallback??""}\x00${JSON.stringify(e.preload??[])}`,t=w.get(r);if(t&&t.signature===n)return t.messages;let g=await is(s,e),o=new Map;for(let[i,{language:m,area:u}]of g.files){let p=_(m,u);for(let M of as(i))o.set(M,p)}let l=e.fallback??e.languages[0];if(!e.languages.includes(l))throw Error(`messages.fallback "${l}" is not one of messages.languages`);let c=e.preload==="all"?[...e.languages]:[...e.preload??[]];for(let i of c)if(!e.languages.includes(i))throw Error(`messages.preload "${i}" is not one of messages.languages`);let d={...g,stubs:o,languages:[...e.languages],fallback:l,preload:c};return w.set(r,{signature:n,messages:d}),d}function Am(...s){let e=new Set;for(let a of s){if(!a||!a.includes("stx-messages:"))continue;for(let n of a.matchAll(/stx-messages:[\w-]+:([\w/-]+)/g))e.add(n[1])}return e}function Pm(s,e){let a=/<html\b[^>]*>/i.exec(s)?.[0]??"",n=/\slang\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(a),r=(n?n[1]??n[2]??n[3]??"":"").trim().toLowerCase(),t=new Map(e.languages.map((o)=>[o.toLowerCase(),o])),g=t.get(r)??t.get(r.split(/[-_]/)[0]??"");if(!g)return[...e.languages];return[...new Set([g,e.fallback,...e.preload??[]])]}var h=new WeakMap;function Im(s,e,a){let n=[...a].sort(),r=h.get(s);if(!r)h.set(s,r=new Map);let t=`${e.join(",")}\x00${n.join(",")}`;if(r.has(t))return r.get(t);let g=P(s,e,n);return r.set(t,g),g}function P(s,e,a){let n=[];for(let r of e){let t=s.data.get(r);if(!t)continue;for(let g of a){let o=t.get(g);if(o!==void 0)n.push(`put(${JSON.stringify(S(r,g))},${JSON.stringify(o)})`)}}if(n.length===0)return null;return`;(function(){var kept=globalThis.__stxMessages||(globalThis.__stxMessages={}),filled=globalThis.__stxMessagesFilled||(globalThis.__stxMessagesFilled={});function put(key,json){if(filled[key])return;filled[key]=1;var into=kept[key]||(kept[key]={}),data=JSON.parse(json);for(var name in data)into[name]=data[name]}
|
|
4
4
|
${n.join(`;
|
|
5
5
|
`)};
|
|
6
6
|
})();`}
|
|
7
|
-
export{
|
|
7
|
+
export{is,as,$m,Rm,Am,Pm,Im};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Sr,i}from"./chunk-hx6tr46s.js";import"./chunk-0rq1w0xr.js";import"./chunk-vhp5hqwp.js";import"./chunk-avtq2p0c.js";import"./chunk-36j2drjv.js";import"./chunk-jh1hdq31.js";import"./chunk-3mc9ew9r.js";import"./chunk-2r2tayyd.js";import"./chunk-xnvh4jk2.js";import{Ie}from"./chunk-nkgqhb7s.js";import"./chunk-7767n5k6.js";import"./chunk-1pc2p489.js";import"./chunk-w81a1e14.js";import"./chunk-w27j0apm.js";import"./chunk-sk8x8nw8.js";import"./chunk-c3nmjx26.js";import"./chunk-ag07tdhn.js";import"./chunk-f8sh6289.js";import"./chunk-t4exh7c9.js";import{Ke,fo,go}from"./chunk-xdprx6tx.js";import"./chunk-yfe380a4.js";import"./chunk-875wejw1.js";import"./chunk-r7zvrh58.js";import"./chunk-ayrd026n.js";import"./chunk-ra35ptjg.js";import"./chunk-a78k8fkg.js";import"./chunk-4jg8ddfy.js";export{Sr as buildModulesTag,Ie as injectRouterScript,i as processDirectives,fo as processJsonDirective,go as processOnceDirective,Ke as validateClientScript};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{C}from"./chunk-
|
|
2
|
+
import{C}from"./chunk-4jg8ddfy.js";import{Ne,yt,qt,so,oo,Ce,Fi,An,gl,ml,zi,hl,yl,ao,Hi,Ui,bl,Vi}from"./chunk-xdprx6tx.js";import{a}from"./chunk-w27j0apm.js";import{Ko}from"./chunk-sk7pptzf.js";import{l}from"./chunk-ygtz9kc7.js";import{existsSync as G,readFileSync as U}from"fs";import h from"path";var we=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),oe=yt.filter((e)=>!we.has(e)).sort(),ce=[...C].sort(),ke=[...new Set([...oe,...ce])].sort(),ve=new Set(oe),$e=new Set(ce),De=new Set(ke),re=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function Te(e,t){if(t==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function ae(e,t){let o=[];for(let d of t){if(d.offset===void 0)continue;let i=d.kind==="server"?ve:$e;re.lastIndex=0;for(let c of d.code.matchAll(re)){let m=c.index+c[0].indexOf("{")+1;for(let f of c[1].matchAll(/[^,]+/g)){let k=f[0];if(/^\s*type\s/.test(k))continue;let S=/^\s*([A-Za-z_$][\w$]*)/.exec(k);if(!S)continue;let s=S[1];if(!De.has(s)||i.has(s))continue;let u=d.offset+m+f.index+S[0].length-s.length,g=e.slice(0,u),v=g.split(`
|
|
3
3
|
`).length;o.push({line:v,column:u-(g.lastIndexOf(`
|
|
4
|
-
`)+1)+1,offset:u,length:s.length,name:s,kind:d.kind,message:Te(s,d.kind)})}}}return o}import M from"path";var
|
|
5
|
-
`.repeat(e.startLine-1):"",m=
|
|
4
|
+
`)+1)+1,offset:u,length:s.length,name:s,kind:d.kind,message:Te(s,d.kind)})}}}return o}import M from"path";var Ee="@stacksjs/stx-typescript-plugin";function Oe(e,t){let o=M.resolve(e);for(;;){let d=M.join(o,"tsconfig.json");if(t(d))return d;let i=M.dirname(o);if(i===o)return;o=i}}function le(e,t,o){let d=Oe(e,o);if(!d)return;let i=new Set,c=(m)=>{if(i.has(m))return;i.add(m);let f=t(m);if(!f)return;let k=f.compilerOptions?.plugins;if(Array.isArray(k)){let s=k.find((g)=>g?.name===Ee),u=Array.isArray(s?.libs)?s.libs.filter((g)=>typeof g==="string"):[];return s?{configPath:m,libs:u.map((g)=>M.resolve(M.dirname(m),g))}:null}let S=typeof f.extends==="string"?[f.extends]:Array.isArray(f.extends)?f.extends:[];for(let s of[...S].reverse()){if(typeof s!=="string"||!s.startsWith("."))continue;let u=M.resolve(M.dirname(m),s.endsWith(".json")?s:`${s}.json`),g=c(u);if(g!==void 0)return g}return};return c(d)??void 0}function Ba(e,t="",o="",d=t,i){let c=e.startLine>1?`
|
|
5
|
+
`.repeat(e.startLine-1):"",m=Fi(Hi(e)+e.code,d),f=e.kind==="client"&&i?i.project(m.code):void 0,k=An(f?.code??m.code),S=e.kind==="client"||e.kind==="plain"?hl(t,e.code):"",s=(c+k).split(`
|
|
6
6
|
`),u=s.length,g=new Map;for(let y of m.declarations)for(let[w,D]of y.text.split(`
|
|
7
7
|
`).entries())if(s.push(D),y.origin)g.set(s.length,{...y.origin,line:e.startLine+y.origin.line-1+w,column:w===0?y.origin.column:1});s.push(...S.split(`
|
|
8
8
|
`),...(i?.declarations??"").split(`
|
|
9
|
-
`),...(e.kind==="server"?
|
|
9
|
+
`),...(e.kind==="server"?so(e.code):"").split(`
|
|
10
10
|
`));let v=e.kind==="server"?qt(e.code):void 0;if(v?.unsupported){let y=e.code.slice(0,v.offset),w=e.startLine+y.split(`
|
|
11
11
|
`).length-1,D=v.offset-e.code.lastIndexOf(`
|
|
12
|
-
`,v.offset-1)+(w===e.startLine?(e.startColumn??1)-1:0);s.push(`;({})[${JSON.stringify(v.unsupported)}];`),g.set(s.length,{line:w,column:D,anchor:!0})}s.push("export {}","");let R=
|
|
13
|
-
`),o);return{text:R.code,sourceLineCount:u,lineMap:g,scriptColumns:new Map([...m.columns].map(([y,w])=>[y+e.startLine-1,w])),importColumns:R.columns,componentColumns:f?new Map([...f.columns].map(([y,w])=>[y+e.startLine-1,w])):void 0}}function
|
|
14
|
-
`)}function
|
|
12
|
+
`,v.offset-1)+(w===e.startLine?(e.startColumn??1)-1:0);s.push(`;({})[${JSON.stringify(v.unsupported)}];`),g.set(s.length,{line:w,column:D,anchor:!0})}s.push("export {}","");let R=ao(s.join(`
|
|
13
|
+
`),o);return{text:R.code,sourceLineCount:u,lineMap:g,scriptColumns:new Map([...m.columns].map(([y,w])=>[y+e.startLine-1,w])),importColumns:R.columns,componentColumns:f?new Map([...f.columns].map(([y,w])=>[y+e.startLine-1,w])):void 0}}function Fm(e,t="",o=""){return Ba(e,t,o).text}var _e=new Set(["name","status","length","location","history","origin","closed","close","open","focus","blur","print","scroll","scrollTo","scrollBy","stop","top","parent","self","frames","event","external","menubar","toolbar"]);function Me(e){if(e.length===0)return"";let t=["// Generated \u2014 the composables the runtime publishes as bare globals."],o=new Set(C),d=[];for(let{file:i,names:c}of e){let m=JSON.stringify(i.replace(/\\/g,"/").replace(/\.ts$/,""));d.push(` export * from ${m}`);for(let f of c){if(o.has(f)||_e.has(f))continue;o.add(f),t.push(`declare const ${f}: typeof import(${m})[${JSON.stringify(f)}]`)}}return t.push("declare module '@composables' {",...d,"}"),t.join(`
|
|
14
|
+
`)}function Ho(e,t,o){return`${e}.__stx_${t}${o}.ts`}function zm(e){return e.replace(/\.__stx_(?:server|client|plain|template)\d+\.ts$/,"")}function ku(){return ue("stx.d.ts")}function _u(){return ue("stx-module.d.ts")}function ue(e){for(let t of[h.resolve(import.meta.dir,"..",e),h.resolve(import.meta.dir,"..","..",e)])if(G(t))return t;return null}var Re=/^(.*?)\((\d+),(\d+)\):\s+(error|warning)\s+TS(\d+):\s+(.*)$/;function pe(e){return e>=1000&&e<2000}function de(e){let t="",o=!1,d=!1;for(let i=0;i<e.length;i++){let c=e[i];if(o){if(t+=c,d)d=!1;else if(c==="\\")d=!0;else if(c==='"')o=!1;continue}if(c==='"'){o=!0,t+=c;continue}if(c==="/"&&e[i+1]==="/"){while(i<e.length&&e[i]!==`
|
|
15
15
|
`)i++;t+=`
|
|
16
|
-
`;continue}if(c==="/"&&e[i+1]==="*"){i+=2;while(i<e.length&&!(e[i]==="*"&&e[i+1]==="/"))i++;i++;continue}t+=c}return t.replace(/,(\s*[}\]])/g,"$1")}function je(e){try{return JSON.parse(de(U(e,"utf8")))}catch{return}}function Le(e){let t=h.resolve(e),o;for(;;){let s=h.join(t,"tsconfig.json");if(G(s)){o=s;break}let u=h.dirname(t);if(u===t)break;t=u}if(!o)return{};let d=new Set,i=o,c,m,f=o;while(i&&!d.has(i)){d.add(i);let s;try{s=JSON.parse(de(U(i,"utf8")))}catch{break}let u=s?.compilerOptions??{};if(!c&&u.paths&&typeof u.paths==="object")c=u.paths,f=i;if(!m&&typeof u.baseUrl==="string")m=h.resolve(h.dirname(i),u.baseUrl);if(c&&m)break;i=typeof s?.extends==="string"?h.resolve(h.dirname(i),s.extends.endsWith(".json")?s.extends:`${s.extends}.json`):void 0}if(!c)return{};let k=m??h.dirname(f),S={};for(let[s,u]of Object.entries(c)){if(!Array.isArray(u))continue;S[s]=u.map((g)=>typeof g==="string"&&!h.isAbsolute(g)?h.resolve(k,g):g)}return{paths:S}}async function
|
|
17
|
-
`))),u=new Map,g=new Map,v=[],R=[],y=0,w=0,D=
|
|
18
|
-
`),B=
|
|
19
|
-
`),Me(await
|
|
16
|
+
`;continue}if(c==="/"&&e[i+1]==="*"){i+=2;while(i<e.length&&!(e[i]==="*"&&e[i+1]==="/"))i++;i++;continue}t+=c}return t.replace(/,(\s*[}\]])/g,"$1")}function je(e){try{return JSON.parse(de(U(e,"utf8")))}catch{return}}function Le(e){let t=h.resolve(e),o;for(;;){let s=h.join(t,"tsconfig.json");if(G(s)){o=s;break}let u=h.dirname(t);if(u===t)break;t=u}if(!o)return{};let d=new Set,i=o,c,m,f=o;while(i&&!d.has(i)){d.add(i);let s;try{s=JSON.parse(de(U(i,"utf8")))}catch{break}let u=s?.compilerOptions??{};if(!c&&u.paths&&typeof u.paths==="object")c=u.paths,f=i;if(!m&&typeof u.baseUrl==="string")m=h.resolve(h.dirname(i),u.baseUrl);if(c&&m)break;i=typeof s?.extends==="string"?h.resolve(h.dirname(i),s.extends.endsWith(".json")?s.extends:`${s.extends}.json`):void 0}if(!c)return{};let k=m??h.dirname(f),S={};for(let[s,u]of Object.entries(c)){if(!Array.isArray(u))continue;S[s]=u.map((g)=>typeof g==="string"&&!h.isAbsolute(g)?h.resolve(k,g):g)}return{paths:S}}async function Hm(e,t={}){let o=t.client!==!1,d=t.server!==!1,i=t.templates!==!1,c=i?await a():void 0,m=t.componentsDir??c?.componentsDir,f=t.partialsDir??c?.partialsDir,k=t.layoutsDir??c?.layoutsDir,S=new Map(await Promise.all(e.map(async(n)=>[n,await Bun.file(n).text()]))),s=[...S.values()].some((n)=>qt(Ce(n).filter((r)=>r.kind==="server").map((r)=>r.code).join(`
|
|
17
|
+
`))),u=new Map,g=new Map,v=[],R=[],y=0,w=0,D=ku();for(let n of e){let r=S.get(n),x=Ce(r).filter((p)=>{if(p.kind==="server")return d;return o}),O=Ce(r).filter((p)=>p.kind==="server").map((p)=>p.code).join(`
|
|
18
|
+
`),B=zi(Ce(r)),_=oo(r);for(let p of ae(r,x))v.push({file:n,line:p.line,column:p.column,code:0,message:p.message,category:"error",blockKind:p.kind});if(o&&O){let p=x.filter((E)=>E.kind!=="server"),b=[...new Set(p.flatMap((E)=>yl(O,E.code)))];if(b.length>0)g.set(n,{names:b,line:p[0].startLine,kind:p[0].kind})}let I=h.dirname(h.resolve(n)),T=i?Ui(r,{runtimeGlobals:!D,originDir:I,filePath:h.resolve(n),componentsDir:m,partialsDir:f,layoutsDir:k,inheritedContractsKnown:s}):null,A=T?[...T.lineMap.values()].filter((p)=>p.expression).length:0;if(x.length===0&&A===0&&!_?.checks.length)continue;if(R.push(n),y+=x.length,w+=A,_&&o&&(x.some((p)=>p.kind!=="server")||!i&&_.checks.length)){let p=Ui(r,{runtimeGlobals:!1,globals:!1,originDir:I,templateExpressions:!1,scriptKinds:["client","plain"],nativeChecks:!i});u.set(Ho(n,"client",0),{virtual:p,source:p.text,origin:n,kind:"client"})}if(x.forEach((p,b)=>{if(_&&p.kind!=="server")return;let E=Ba(p,O,I,B);u.set(Ho(n,p.kind,b),{virtual:E,source:E.text,origin:n,kind:p.kind})}),T&&(A>0||_?.checks.length))u.set(Ho(n,"template",0),{source:T.text,origin:n,kind:"template",virtual:T})}if(u.size===0)return{diagnostics:v,checkedFiles:R,blockCount:0,expressionCount:0};let j=(t.extraLibs??[]).map((n)=>h.resolve(n)),fe=le(e.length>0?h.dirname(h.resolve(e[0])):process.cwd(),je,G);for(let n of fe?.libs??[])if(!j.includes(n)&&G(n))j.push(n);if(D)j.push(D);let W=D?_u():null;if(W)j.push(W);let z=`${l()}/typecheck/__stx_globals.d.ts`,me=["// Generated \u2014 the context serve.ts injects into <script server> blocks.",gl(D?ml(U(D,"utf8")):void 0),...D?[]:["declare const window: any",...C.map((n)=>`declare const ${n}: any`)],["// Generated \u2014 the names stx auto-imports from @stacksjs/browser.",...Ne.map((n)=>`declare const ${n}: any`)].join(`
|
|
19
|
+
`),Me(await Ko())].filter(Boolean).join(`
|
|
20
20
|
`),L=`${l()}/typecheck`;await Bun.$`rm -rf ${L}`.quiet().nothrow(),await Bun.$`mkdir -p ${L}`.quiet().nothrow(),await Bun.write(z,me);let P=new Map,ge=0;for(let[n,r]of u){let x=`${ge++}_${n.replace(/[^\w.-]+/g,"_")}`;await Bun.write(`${L}/${x}`,r.source),P.set(x,r)}let he={target:"ESNext",module:"ESNext",moduleResolution:"bundler",strict:!0,noEmit:!0,skipLibCheck:!0,allowJs:!0,esModuleInterop:!0,resolveJsonModule:!0,lib:["ESNext","DOM","DOM.Iterable"],types:[],...Le(e.length>0?h.dirname(h.resolve(e[0])):process.cwd()),...t.compilerOptions??{}},q=async(n,r)=>{let x=`${L}/tsconfig${r===1?"":`.${r}`}.json`;await Bun.write(x,JSON.stringify({compilerOptions:he,files:n.map((B)=>`${L}/${B}`).concat(z,...j)},null,2));let O=Bun.spawnSync(["bun","x","tsc","-p",x,"--pretty","false"],{stdout:"pipe",stderr:"pipe"});return{output:new TextDecoder().decode(O.stdout)+new TextDecoder().decode(O.stderr),exitCode:O.exitCode??0}},H=await q([...P.keys()],1),Z=H.output,K=[],Q=H.exitCode,Y=0,xe=new Set(j.map((n)=>n.split("/").pop())),ee=0,F=new Set,te=(n)=>{for(let r of n.replace(/\n[\t ]+([^\n]*)/g," $1").split(`
|
|
21
|
-
`)){let x=r.match(Re);if(!x)continue;if(Y++,xe.has(x[1].split("/").pop()))ee++;let[,O,B,_,I,T,A]=x,p=O.split("/").pop(),b=P.get(p);if(!b)continue;if(pe(Number(T)))F.add(p);let E=Number(B),X=Number(_),se,J=b.kind;if(b.virtual){let N=
|
|
21
|
+
`)){let x=r.match(Re);if(!x)continue;if(Y++,xe.has(x[1].split("/").pop()))ee++;let[,O,B,_,I,T,A]=x,p=O.split("/").pop(),b=P.get(p);if(!b)continue;if(pe(Number(T)))F.add(p);let E=Number(B),X=Number(_),se,J=b.kind;if(b.virtual){let N=Vi(b.virtual,E,X)??(b.kind!=="template"&&pe(Number(T))?Vi(b.virtual,b.virtual.sourceLineCount,1):null);if(!N||b.kind==="template"&&!N.expression&&!N.diagnosticOrigin)continue;if(bl(N,Number(T)))continue;E=N.line,X=N.column,se=N.expression?.code.trim(),J=N.diagnosticOrigin??J}K.push({file:b.origin,line:E,column:X,code:Number(T),message:A,category:I==="error"?"error":"warning",blockKind:J,expression:se})}};te(Z);let ye=Y,be=ee;if(F.size>0&&F.size<P.size){let n=[...P.keys()].filter((r)=>!F.has(r));te((await q(n,2)).output)}if(o)for(let[n,r]of g){if(r.names.length===0)continue;K.push({file:n,line:r.line,column:1,code:0,message:`${r.names.length===1?"1 value reaches":`${r.names.length} values reach`} this block on the implicit bridge and ${r.names.length===1?"is":"are"} untyped: ${r.names.join(", ")}. Declare them with defineClientPayload({ ${r.names.join(", ")} }) in the server block to have them checked.`,category:"warning",blockKind:r.kind})}K.push(...v);let ne=new Set,V=K.filter((n)=>{let r=`${n.file}:${n.line}:${n.column}:${n.code}:${n.message}`;if(ne.has(r))return!1;return ne.add(r),!0});V.sort((n,r)=>n.file.localeCompare(r.file)||n.line-r.line||n.column-r.column);let ie=be>0&&V.length===0,Se=ie||Q!==0&&ye===0?`${ie?"a file passed with --lib has errors of its own, so nothing in your code was checked":`tsc exited ${Q} without reporting any diagnostic, so nothing was checked`}. `+"A syntax error in an ambient declaration file does this \u2014 skipLibCheck suppresses "+`SEMANTIC diagnostics only. tsc said:
|
|
22
22
|
${Z.trim().split(`
|
|
23
23
|
`).slice(0,12).join(`
|
|
24
|
-
`)||"(no output)"}`:void 0;return{diagnostics:V,checkedFiles:R,blockCount:y,expressionCount:w,failure:Se}}function
|
|
24
|
+
`)||"(no output)"}`:void 0;return{diagnostics:V,checkedFiles:R,blockCount:y,expressionCount:w,failure:Se}}function Um(e){return e.map((t)=>{let o=t.blockKind==="template"?`[template: ${t.expression??""}]`:`[${t.blockKind==="plain"?"<script>":`<script ${t.blockKind}>`}]`;return`${t.file}:${t.line}:${t.column} ${t.category} TS${t.code} ${t.message} ${o}`}).join(`
|
|
25
25
|
`)}
|
|
26
|
-
export{
|
|
26
|
+
export{Ba,Fm,Ho,zm,ku,_u,Hm,Um};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{pu,fu}from"./chunk-9sk596tw.js";import"./chunk-4f8h38xr.js";import"./chunk-4nabpd82.js";import"./chunk-s6w14v6h.js";import"./chunk-sdvv8zge.js";import"./chunk-jh007a8k.js";import"./chunk-e8aqkt1b.js";import"./chunk-tt6n2mx6.js";import"./chunk-z68teecy.js";import"./chunk-rq7sg012.js";import"./chunk-dhx4m7mf.js";import"./chunk-gsm3rk4j.js";import"./chunk-9ch2qhbw.js";import"./chunk-jya12bfn.js";import"./chunk-vn3hsx7v.js";import"./chunk-90ps064x.js";import"./chunk-gxdy4qjj.js";import"./chunk-bwnx71s8.js";import"./chunk-w5vxzk5j.js";import"./chunk-m3ra99h8.js";import"./chunk-ww24mxmd.js";import"./chunk-b9z4nb1v.js";import"./chunk-wajvxzt0.js";import"./chunk-edjzm0vj.js";import"./chunk-8vjsmyrk.js";import"./chunk-7d0h2pa3.js";import"./chunk-t64mp8x1.js";import"./chunk-sk7pptzf.js";import"./chunk-4w203ddt.js";import"./chunk-29cy41z3.js";import"./chunk-2qnpr0ty.js";import"./chunk-g2fxp9zp.js";import{yn}from"./chunk-h7z23fpq.js";import{pg}from"./chunk-sgppgy5e.js";import"./chunk-78j6c3sf.js";import"./chunk-s1x2pc9b.js";import{Ue,i}from"./chunk-hx6tr46s.js";import"./chunk-0rq1w0xr.js";import"./chunk-vhp5hqwp.js";import"./chunk-avtq2p0c.js";import"./chunk-36j2drjv.js";import"./chunk-jh1hdq31.js";import"./chunk-3mc9ew9r.js";import"./chunk-2r2tayyd.js";import"./chunk-xnvh4jk2.js";import{Ie}from"./chunk-nkgqhb7s.js";import"./chunk-7767n5k6.js";import{Ar,Pr}from"./chunk-1pc2p489.js";import"./chunk-w81a1e14.js";import{Us,K,a}from"./chunk-w27j0apm.js";import"./chunk-sk8x8nw8.js";import"./chunk-c3nmjx26.js";import"./chunk-ag07tdhn.js";import"./chunk-f8sh6289.js";import"./chunk-t4exh7c9.js";import{B,b,Ge}from"./chunk-xdprx6tx.js";import"./chunk-yfe380a4.js";import"./chunk-875wejw1.js";import"./chunk-r7zvrh58.js";import"./chunk-ayrd026n.js";import"./chunk-ra35ptjg.js";import"./chunk-a78k8fkg.js";import"./chunk-4jg8ddfy.js";import{fa}from"./chunk-ws25jw6x.js";import"./chunk-3d0bjcn7.js";import"./chunk-2d0pemtc.js";export{Us as buildWebComponents,Pr as cacheTemplate,Ar as checkCache,yn as classifyAllScripts,pu as createMiddleware,fu as createRoute,K as defaultConfig,b as extractVariables,B as findSfcTemplateBlock,Ie as injectRouterScript,fa as insertBeforeBodyClose,a as loadStxConfig,Ge as processClientScript,i as processDirectives,Ue as readMarkdownFile,pg as withinBundlerCallback};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{d,h,D,p,
|
|
3
|
-
`)n++;return!0}if(e[n]==="/"&&e[n+1]==="*"){n+=2;while(n<u-1&&!(e[n]==="*"&&e[n+1]==="/"))n++;return n+=2,!0}return!1},ie=()=>{if(S!==0)return;let
|
|
2
|
+
import{d,h,D,p,ne,vt}from"./chunk-r7zvrh58.js";import{T}from"./chunk-a78k8fkg.js";import{Z,Zs,Ke,B,Ur,Je,Ye,s,w,Me,I}from"./chunk-xdprx6tx.js";import{St}from"./chunk-4jg8ddfy.js";import{L}from"./chunk-ayrd026n.js";import{me}from"./chunk-2r2tayyd.js";import{q,dt}from"./chunk-e8hvbc53.js";import{O,Vn}from"./chunk-q99y5115.js";import M from"path";import{existsSync as ye}from"fs";function ae(c,e){let a=0;for(let r=e;r<c.length;r++){let S=c[r];if(S==="("||S==="["||S==="{")a++;else if(S===")"||S==="]"||S==="}")a--;else if(S===","&&a===0)return r}return-1}function $e(c,e,a){let r=c,S=new RegExp(`${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),n=S.exec(r);while(n){let u=n.index,t=u+n[0].length-1,A=1,W=t+1;while(W<r.length&&A>0){if(r[W]==="(")A++;else if(r[W]===")")A--;W++}if(A!==0)break;let ie=r.substring(t+1,W-1),N=`${a}(${ie})`;r=r.substring(0,u)+N+r.substring(W),S.lastIndex=u+N.length,n=S.exec(r)}return r}function Ee(c){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(c)}function he(c){let e=c,a=[],r=new Set,S=0,n=0,u=e.length,t=(N)=>{n++;while(n<u){if(e[n]==="\\"){n+=2;continue}if(e[n]===N){n++;return}n++}},A=()=>{n++;while(n<u){if(e[n]==="\\"){n+=2;continue}if(e[n]==="`"){n++;return}if(e[n]==="$"&&e[n+1]==="{"){n+=2;let N=1;while(n<u&&N>0)if(e[n]==="{")N++,n++;else if(e[n]==="}")N--,n++;else if(e[n]==="'"||e[n]==='"')t(e[n]);else if(e[n]==="`")A();else n++;continue}n++}},W=()=>{if(e[n]==="/"&&e[n+1]==="/"){while(n<u&&e[n]!==`
|
|
3
|
+
`)n++;return!0}if(e[n]==="/"&&e[n+1]==="*"){n+=2;while(n<u-1&&!(e[n]==="*"&&e[n+1]==="/"))n++;return n+=2,!0}return!1},ie=()=>{if(S!==0)return;let N=e.slice(n).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(N){let H=N[2];if(!r.has(H))a.push(H),r.add(H);return}let te=e.slice(n).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(te){let H=te[1];if(!r.has(H))a.push(H),r.add(H);return}let Y=e.slice(n).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Y){let H=Y[1];if(!r.has(H))a.push(H),r.add(H)}};while(n<u){if(W())continue;if(e[n]==="'"||e[n]==='"'){t(e[n]);continue}if(e[n]==="`"){A();continue}if(e[n]==="{"){S++,n++;continue}if(e[n]==="}"){S--,n++;continue}if(S===0&&/[a-z]/i.test(e[n])&&(n===0||/\s|[;{}()]/.test(e[n-1])))ie();n++}return a.join(", ")}function ve(c,e=""){let a=he(c).split(",").map((r)=>r.trim()).filter(Boolean);return`
|
|
4
4
|
(function() {
|
|
5
5
|
${St("var",a)}
|
|
6
6
|
var __destroyHooks = [];
|
|
@@ -9,7 +9,7 @@ import{d,h,D,p,te,vt}from"./chunk-vf7tpgqz.js";import{T}from"./chunk-jjq7c8s2.js
|
|
|
9
9
|
|
|
10
10
|
${c}
|
|
11
11
|
${e}})();
|
|
12
|
-
`}function Re(c,e){let r=he(c).split(",").map((u)=>u.trim()).filter(Boolean),S=new Set(
|
|
12
|
+
`}function Re(c,e){let r=he(c).split(",").map((u)=>u.trim()).filter(Boolean),S=new Set(Z(c,!0).split(",").map((u)=>u.trim())),n=r.map((u)=>S.has(u)?` try { ${u}; Object.defineProperty(__scopeRegistration, ${JSON.stringify(u)}, ${Zs(u)}); } catch (e) { /* not actually top-level */ }`:` try { __scopeRegistration[${JSON.stringify(u)}] = ${u}; } catch (e) { /* not actually top-level */ }`).join(`
|
|
13
13
|
`);return`
|
|
14
14
|
// Register scope variables for STX runtime
|
|
15
15
|
if (!window.stx._scopes) window.stx._scopes = {};
|
|
@@ -22,7 +22,7 @@ ${n}
|
|
|
22
22
|
try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
|
|
23
23
|
if (typeof __stxLiveBindings !== 'undefined') Object.defineProperties(__scopeRegistration, Object.getOwnPropertyDescriptors(__stxLiveBindings));
|
|
24
24
|
window.stx._scopes['${e}'] = __scopeRegistration;
|
|
25
|
-
`}function ke(c,e){return c.replace(/<script data-stx-scoped data-stx-run="always" data-stx-owner="([^"]*)"/g,(a,r)=>r===e?a:'<script data-stx-scoped data-stx-run="always"')}function
|
|
25
|
+
`}function ke(c,e){return c.replace(/<script data-stx-scoped data-stx-run="always" data-stx-owner="([^"]*)"/g,(a,r)=>r===e?a:'<script data-stx-scoped data-stx-run="always"')}function ge(c,e){let a=Re(c,e);return Ie(ve(c,a),e)}function Ie(c,e){let a=`
|
|
26
26
|
(function() {
|
|
27
27
|
var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${e}"]') : null;
|
|
28
28
|
var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
|
|
@@ -44,11 +44,11 @@ ${n}
|
|
|
44
44
|
}
|
|
45
45
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
46
46
|
}
|
|
47
|
-
})();`;return a+c+r}function
|
|
48
|
-
${b}`}if(de&&!X){
|
|
49
|
-
`;continue}if(X)try{let{extractVariables:
|
|
50
|
-
`}}if(
|
|
47
|
+
})();`;return a+c+r}function Te(c,e){if(q(c)){let n=q(c).tag.match(/data-stx-scope="([^"]*)"/);if(n)return{html:c,mergedIntoExisting:n[1],stamped:!0,root:"body"};return{html:dt(c,(u,t)=>`<body${t} data-stx-scope="${e}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let a=vt(c),r=c.slice(a).match(/^(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(r){let S=r[1]+r[2],n=r[1].slice(1),u=S.match(/data-stx-scope="([^"]*)"/);if(u)return{html:c,mergedIntoExisting:u[1],stamped:!0,root:n};let t=c.slice(0,a),A=r[1],W=r[2];return{html:`${t}${A} data-stx-scope="${e}"${W}${c.slice(a+r[0].length)}`,mergedIntoExisting:null,stamped:!0,root:n}}return{html:c,mergedIntoExisting:null,stamped:!1,root:null}}var Ae=0;function ue(c,e){let a=M.basename(c,".stx").replace(/[^a-zA-Z0-9]/g,"_"),r=e.__stx_scope_seq;return r?`stx_scope_${a}_${++r.n}_${r.key}`:`stx_scope_${a}_${++Ae}`}var le=new Set,pe=new Set;function yy(){le.clear(),pe.clear()}var Ce=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function vg(c){let e=(t)=>t.replace(/[^\n]/g," "),a=c.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,e).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,e).replace(/<!--[\s\S]*?-->/g,e).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,e).replace(/\{\{[\s\S]*?\}\}/g,e).replace(/\{!![\s\S]*?!!\}/g,e),r=[],S=0,n=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,u;while((u=n.exec(a))!==null){let t=u[1]==="/",A=u[2],W=u[3]==="/"||Ce.has(A.toLowerCase());if(t){S=Math.max(0,S-1);continue}if(S===0)r.push(A);if(!W)S++}return r}function fe(c){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(c)}var ut=new T(500),Hc=new Set;function by(){Hc.clear()}function De(c){if(c.__onceStore instanceof Set)return c.__onceStore;return Hc}async function Rs(c,e,a,r,S,n=new Set){let u=r.partialsDir||M.join(M.dirname(a),"partials");if(u&&!M.isAbsolute(u))u=M.resolve(process.cwd(),u);let t=$e(c,"@partial","@include"),A=De(e);t=t.replace(/@once([\s\S]*?)@endonce/g,(f,v,m)=>{let g=v.trim(),i=`${a}:${g}`;if(A.has(i))return"";return A.add(i),v});{let f=/@includeIf\s*\(/g,v;while((v=f.exec(t))!==null){let m=v.index,g=m+v[0].length-1,i=1,x=g+1;while(x<t.length&&i>0){if(t[x]==="(")i++;else if(t[x]===")")i--;x++}if(i!==0)break;let l=t.substring(g+1,x-1),o=l.match(/^\s*['"]([^'"]+)['"]/);if(!o){f.lastIndex=x;continue}let C=o[1],z=W(C,u,a),E="";if(z&&await Bun.file(z).exists())S.add(z),E=`@include(${l})`;t=t.substring(0,m)+E+t.substring(x),f.lastIndex=0}}for(let[f,v]of[["@includeWhen",!1],["@includeUnless",!0]]){let m=new RegExp(`${f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),g;while((g=m.exec(t))!==null){let i=g.index,x=i+g[0].length-1,l=1,o=x+1;while(o<t.length&&l>0){if(t[o]==="(")l++;else if(t[o]===")")l--;o++}if(l!==0)break;let C=t.substring(x+1,o-1),z=ae(C,0);if(z===-1){m.lastIndex=o;continue}let E=C.substring(0,z).trim(),V=C.substring(z+1).trim(),F=V.match(/^\s*['"]([^'"]+)['"]/);if(!F){m.lastIndex=o;continue}let _=F[1],J=V.substring(F[0].length),j,R=ae(J,0);if(R!==-1)j=J.substring(R+1).trim();try{let k=`Boolean(${E})`,P;if(h(k)){let oe=p(k,Object.keys(e));P=Boolean(oe(...Object.values(e)))}else P=Boolean(d(k,e));let ee=v?!P:P,re="";if(ee){let oe=W(_,u,a);if(oe&&await Bun.file(oe).exists())S.add(oe);re=`@include('${_}'${j?`, ${j}`:""})`}t=t.substring(0,i)+re+t.substring(o),m.lastIndex=0}catch(k){let P=k instanceof Error?k.message:String(k),ee=w("Include",`Error evaluating ${f} condition: ${P}`,a,c,i);t=t.substring(0,i)+ee+t.substring(o),m.lastIndex=0}}}{let f=/@each\s*\(/g,v;while((v=f.exec(t))!==null){let m=v.index,g=m+v[0].length-1,i=1,x=g+1;while(x<t.length&&i>0){if(t[x]==="(")i++;else if(t[x]===")"){if(i--,i===0)break}x++}if(i!==0)break;let l=t.substring(g+1,x),o=t.substring(m,x+1),C=l.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!C){f.lastIndex=0,t=t.replace(o,"");continue}let[,z,E,V,F]=C;try{let _,J=E.trim();if(h(J))_=p(J,Object.keys(e))(...Object.values(e));else _=d(J,e);let j="";if(Array.isArray(_)&&_.length>0)for(let R of _){let k={...e,[V]:R},P=await te(z,k,c,m);j+=P}else if(F)j=await te(F,{},c,m);t=t.substring(0,m)+j+t.substring(x+1),f.lastIndex=0}catch(_){let J=_ instanceof Error?_.message:String(_);t=t.substring(0,m)+w("Each",`Error in @each: ${J}`,a,c,m)+t.substring(x+1),f.lastIndex=0}}}{let f=/@includeFirst\s*\(/g,v;while((v=f.exec(t))!==null){let m=v.index,g=m+v[0].length-1,i=1,x=g+1;while(x<t.length&&i>0){if(t[x]==="(")i++;else if(t[x]===")"){if(i--,i===0)break}x++}if(i!==0)break;let l=t.substring(g+1,x),o=t.substring(m,x+1),C=l.match(/^\s*(\[[^\]]+\])/);if(!C){f.lastIndex=0,t=t.replace(o,"");continue}let z=C[1],E=l.slice(C[0].length),V,F=E.match(/^\s*,\s*\{/);if(F){E=E.slice(F[0].length-1);let j=1,R=1;while(R<E.length&&j>0){if(E[R]==="{")j++;else if(E[R]==="}"){if(j--,j===0)break}R++}V=E.substring(0,R+1),E=E.slice(R+1)}let _,J=E.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(J)_=J[1];try{let j=JSON.parse(z.replace(/'/g,'"')),R={};if(V)try{R=D(V,e)}catch(P){let ee=P instanceof Error?P.message:String(P);if(r.debug){let re=w("Include",`Error parsing includeFirst variables: ${ee}`,a,c,m,o);t=t.replace(o,()=>re)}else t=t.replace(o,()=>_||"");continue}let k=!1;for(let P of j){let ee=W(P,u,a);if(!ee)continue;if(await s(ee)){let re=await te(P,R,c,m);t=t.replace(o,()=>re),k=!0;break}}if(!k)if(_!==void 0)t=t.replace(o,()=>_);else if(r.debug){let P=w("Include",`None of the includeFirst paths exist: ${z}`,a,c,m,o);t=t.replace(o,()=>P)}else t=t.replace(o,"")}catch(j){let R=j instanceof Error?j.message:String(j),k=w("Include",`Error processing @includeFirst: ${R}`,a,c,m,o);t=t.replace(o,()=>k)}f.lastIndex=0}}function W(f,v,m){try{let g=f;if(!f.endsWith(".stx"))g=`${f}.stx`;let i=M.resolve(v),x=M.resolve(M.dirname(m)),l;if(!g.startsWith("./")&&!g.startsWith("../")){for(let F of r._layerPartialDirs??[]){let _=M.resolve(F,g);if(_.startsWith(`${M.resolve(F)}${M.sep}`)&&ye(_))return _}l=M.resolve(v,g)}else l=M.resolve(x,g);let o=M.normalize(l),C=o.startsWith(i+M.sep)||o===i,z=o.startsWith(x+M.sep)||o===x,E=!1,V=M.dirname(x);if(o.startsWith(V+M.sep)){if(!M.relative(V,o).split(M.sep).some((j)=>j.startsWith(".")&&j!=="."&&j!==".."))E=!0}if(!C&&!z&&!E)return console.error(`Security: Path traversal attempt blocked for include path: ${f}`),console.error(` Resolved to: ${o}`),console.error(` Allowed dirs: ${i}, ${x}`),null;return o}catch(g){return console.error(`Error resolving path ${f}: ${g}`),null}}let ie=M.resolve(a);n.add(ie);function N(f,v,m,g){return r.onIncludeError?.({includePath:f,templatePath:a,message:v,partialsDir:u}),w("Include",v,a,m,g)}async function te(f,v={},m,g){let i=W(f,u,a);if(!i)return N(f,`Could not resolve path for include: ${f}`,m,g);let x=M.resolve(i);if(n.has(x)){let l=[...n,x].map((o)=>M.basename(o)).join(" -> ");return N(f,`Circular include detected: ${l}`,m,g)}try{S.add(i);let l;if(!l)try{l=await Bun.file(i).text()}catch(y){let K=y instanceof Error?y.message:String(y);return N(f,`Error loading include file ${f}: ${K}`,m,g)}if(l)l=l.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(l&&l.includes("@stream")){let{processStreamDirectives:y}=await import("./chunk-r02asm46.js");l=y(l,e)}if(l&&(r.debug||!O()&&!Vn()))try{let{warnUnbalancedTags:y}=await import("./chunk-6359fekc.js");y(l,i)}catch{}try{let{processESImports:y}=await import("./chunk-yyypc7s3.js");l=await y(l,e,i,r,S)}catch(y){if(r.debug)console.warn(`[stx] partial ES import extraction skipped for ${i}:`,y instanceof Error?y.message:y)}let o=l,C=B(o);if(C)o=C.content.trim();let E=l.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),V="";if(E)V=`<style${E[1]}>${E[2]}</style>`;let F=[];o=o.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(y,K,b)=>{if(!fe(K))return"";return F.push({attrs:K,body:b}),`__STX_DATA_BLOCK_${F.length-1}__`}),o=o.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let _={...e};_.__stx_signals_gate=Me(l,i);for(let[y,K]of Object.entries(v))_[y]=K;let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,j=[...l.matchAll(J)].sort((y,K)=>{let b=(y[1]||"").includes("server"),X=(K[1]||"").includes("server");return Number(X)-Number(b)}),R="",k=null,P=!1,ee=!1;for(let y of j){let K=y[1]||"",b=y[2]||"";if(fe(K))continue;let X=K.includes("server"),be=Je(K);if(!X&&!/\bsrc\s*=/i.test(K))Ke(b,i,r.strict);if(!X&&b.trim()){let{interpolateScriptExpressions:U}=await import("./chunk-emk29htn.js");b=U(b,_,f)}let ce="";try{let{extractAndStripCssImports:U,renderVendorStyleTags:Q}=await import("./chunk-ee4ejnk2.js"),se=U(b,{filePath:i,projectRoot:process.cwd()});b=se.code,ce=Q(se.styles)}catch(U){if(r.debug)console.warn(`[stx] vendor-css extractor skipped for ${i}:`,U instanceof Error?U.message:U)}if(be&&b.trim())b=Ye(b);if(!X){try{let{injectBrowserCoreAutoImports:Q}=await import("./chunk-ee4ejnk2.js");b=Q(b).code;let{hasUserImports:se,bundleClientScript:Se}=await import("./chunk-aqh48tyw.js");if(se(b))b=await Se(b,i,{projectRoot:process.cwd()})}catch(Q){if(r.debug)console.warn(`[stx] bundler skipped for ${i}:`,Q instanceof Error?Q.message:Q)}let{stripStxRuntimeImports:U}=await import("./chunk-k1qbgpfy.js");b=U(b)}let de=Ee(b);if(!X){let{extractBridgeData:U,generateServerDataBridge:Q}=await import("./chunk-ee4ejnk2.js"),se=Q(b,U(_));if(se)b=`${se}
|
|
48
|
+
${b}`}if(de&&!X){P=!0,k=ue(i,e);let U=L(b),Q=ge(U,k);R+=`${ce}<script data-stx-scoped data-stx-run="always" data-stx-owner="${k}">${Q}</script>
|
|
49
|
+
`;continue}if(X)try{let{extractVariables:U}=await import("./chunk-fd0vnz09.js");await U(b,_,i)}catch(U){if(r.debug)console.warn(`Warning: Could not extract variables from server script in ${i}:`,U)}if(!X&&!de){let U=K.replace(/\bclient\b/i,"").trim();k=ue(i,e);let Q=L(b),se=ge(Q,k);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=|Object\.defineProperty\(__scopeRegistration, "(?!__stx)/.test(se))ee=!0;R+=`${ce}<script data-stx-scoped data-stx-run="always" data-stx-owner="${k}"${U?` ${U}`:""}>${se}</script>
|
|
50
|
+
`}}if(F.length>0){let{interpolateScriptExpressions:y}=await import("./chunk-emk29htn.js");o=o.replace(/__STX_DATA_BLOCK_(\d+)__/g,(K,b)=>{let X=F[Number(b)];return`<script${X.attrs}>${y(X.body,_,f)}</script>`})}if(k){let y=Te(o,k);if(o=y.html,y.mergedIntoExisting){let b=k,X=y.mergedIntoExisting;R=R.split(`'${b}'`).join(`'${X}'`).split(`"${b}"`).join(`"${X}"`),k=X}else if(!y.stamped&&P&&!le.has(i))le.add(i),console.warn(`[stx] ${M.relative(process.cwd(),i)} 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(y.stamped&&y.root!=="body"&&(P||ee)&&!pe.has(i)){let b=vg(o);if(b.length>1)pe.add(i),console.warn(`[stx] ${M.relative(process.cwd(),i)} declares ${P?"signals":"bindings"} and has ${b.length} top-level elements (${b.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=y.stamped&&y.root!==null&&Ur(y.root);R=ke(R,K?k:null)}if(o.includes("@include")||o.includes("@partial"))o=await Rs(o,_,i,r,S,n);let{processLoops:re,reportDeferredLoopWarnings:oe}=await import("./chunk-rc4712qh.js"),G=re(o,_,i,void 0,!0);G=me(G,_,i),G=oe(G);let{processMetaDirectives:xe,processSeoDirective:_e,processStructuredData:we}=await import("./chunk-vt410s5m.js");if(G=xe(G,_,i,r),G=we(G,_,i),G=_e(G,_,i,r),G=I(G,_,i),V)G+=`
|
|
51
51
|
`+V;if(R)G+=`
|
|
52
|
-
`+R;return G}catch(l){if(l instanceof
|
|
52
|
+
`+R;return G}catch(l){if(l instanceof ne)throw l;let o=l instanceof Error?l.message:String(l);return N(f,`Error processing include ${f}: ${o}`,m,g)}}let Y=/@include\s*\(/g,H;while((H=Y.exec(t))!==null){let f=H.index,v=f+H[0].length-1,m=1,g=v+1;while(g<t.length&&m>0){if(t[g]==="(")m++;else if(t[g]===")")m--;g++}if(m!==0)break;let i=t.substring(f,g),x=t.substring(v+1,g-1),l=x.match(/^\s*['"]([^'"]+)['"]/);if(!l){Y.lastIndex=g;continue}let o=l[1],C,z=x.substring(l[0].length),E=ae(z,0);if(E!==-1)C=z.substring(E+1).trim();let V={};if(C)try{V=D(C,e)}catch(_){let J=_ instanceof Error?_.message:String(_);t=t.replace(i,w("Include",`Error parsing include variables for ${o}: ${J}`,a,c,f)),Y.lastIndex=0;continue}let F=await te(o,V,c,f);t=t.substring(0,f)+F+t.substring(g),Y.lastIndex=0}return t}function As(c,e){let a=c;function r(S,n,u,t){let A=S,W=!0;while(W){W=!1;let ie=new RegExp(`@${n}\\(['"]([^'"]+)['"]\\)`),N=A.match(ie);if(!N||N.index===void 0)break;let te=N.index,Y=N[1],H=te+N[0].length,f=new RegExp(`@${n}\\(`),v=new RegExp(`@${u}(?![a-z])`),m=1,g=H,i=-1;while(m>0&&g<A.length){let l=A.slice(g),o=l.match(f),C=l.match(v),z=o?g+o.index:1/0,E=C?g+C.index:1/0;if(z<E)m++,g=z+(o[0].length||1);else if(E<1/0){if(m--,m===0){i=E;break}g=E+u.length+1}else break}if(i===-1)break;let x=A.slice(H,i);if(!e[Y])e[Y]=[];if(t)e[Y].unshift(x);else e[Y].push(x);A=A.substring(0,te)+A.substring(i+`@${u}`.length),W=!0}return A}return a=r(a,"push","endpush",!1),a=r(a,"prepend","endprepend",!0),a}function Ps(c,e){return c.replace(/@stack\(['"]([^'"]+)['"]\)/g,(a,r)=>{if(!e[r]||e[r].length===0)return"";return e[r].join(`
|
|
53
53
|
`)})}
|
|
54
|
-
export{
|
|
54
|
+
export{yy,vg,ut,Hc,by,Rs,As,Ps};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{at,
|
|
3
|
-
export{
|
|
2
|
+
import{at,ge,Rc}from"./chunk-2qnpr0ty.js";import v from"fs";import g from"path";import V from"crypto";var ue=[320,640,768,1024,1280,1536,1920],de=["webp","jpeg"],pe=80,T=[".jpg",".jpeg",".png",".webp",".avif",".gif",".svg"],U={webp:"image/webp",avif:"image/avif",jpeg:"image/jpeg",png:"image/png"},I=null,M=!1;async function d(){if(M)return I;M=!0;try{let t=await import("sharp");return I=t.default||t,I}catch{return null}}async function tr(){return await d()!==null}async function $e(){return!0}async function ze(t,e={}){let{widths:a=ue,formats:n=de,quality:r=pe,fit:m="cover",placeholder:l="none",outputDir:o=".stx/images",baseUrl:c="/images"}=e,i,h;if(typeof t==="string"){if(h=t,!await Bun.file(t).exists())throw new ys(`Image not found: ${t}`,"NOT_FOUND");i=await Bun.file(t).arrayBuffer().then((s)=>Buffer.from(s))}else h="buffer-input",i=t;let b=V.createHash("sha256").update(i).digest("hex").slice(0,12),j=await hs(i),{width:u,height:x}=j,F=u/x;await v.promises.mkdir(o,{recursive:!0});let B=[],A=g.basename(h,g.extname(h)),f=a.filter((s)=>s<=u);if(!f.includes(u)&&u<=Math.max(...a))f.push(u);f.sort((s,p)=>s-p);for(let s of f){let p=Math.round(s/F);for(let w of n){let S=`${A}-${s}w-${b}.${w}`,P=g.join(o,S),q=`${c}/${S}`,E=await Au(i,{width:s,height:p,format:w,quality:r,fit:m});await Bun.write(P,E),B.push({path:P,url:q,width:s,height:p,format:w,size:E.length})}}let y;if(l!=="none")y=await D(i,l);return{src:h,variants:B,placeholder:y,width:u,height:x,aspectRatio:F,hash:b}}async function hs(t){let e=typeof t==="string"?Buffer.from(await Bun.file(t).arrayBuffer()):t,a=await d();if(a){let r=await a(e).metadata();return{width:r.width||0,height:r.height||0,format:r.format||"unknown",hasAlpha:r.hasAlpha}}return L(e)}function L(t){if(t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71){let e=t.readUInt32BE(16),a=t.readUInt32BE(20);return{width:e,height:a,format:"png",hasAlpha:!0}}if(t[0]===255&&t[1]===216){let e=2;while(e<t.length){if(t[e]!==255)break;let a=t[e+1];if(a>=192&&a<=207&&a!==196&&a!==200&&a!==204){let r=t.readUInt16BE(e+5);return{width:t.readUInt16BE(e+7),height:r,format:"jpeg",hasAlpha:!1}}let n=t.readUInt16BE(e+2);e+=2+n}}if(t.toString("utf8",0,4)==="RIFF"&&t.toString("utf8",8,12)==="WEBP"){let e=t.toString("utf8",12,16);if(e==="VP8 "){let a=t.readUInt16LE(26)&16383,n=t.readUInt16LE(28)&16383;return{width:a,height:n,format:"webp",hasAlpha:!1}}if(e==="VP8L"){let a=t.readUInt32LE(21),n=(a&16383)+1,r=(a>>14&16383)+1;return{width:n,height:r,format:"webp",hasAlpha:!0}}}if(t.toString("utf8",0,3)==="GIF"){let e=t.readUInt16LE(6),a=t.readUInt16LE(8);return{width:e,height:a,format:"gif",hasAlpha:!0}}throw new ys("Unable to parse image dimensions","PARSE_ERROR")}async function Au(t,e){let a=await d();if(a){let r=a(t).resize(e.width,e.height,{fit:e.fit});switch(e.format){case"webp":r=r.webp({quality:e.quality});break;case"avif":r=r.avif({quality:e.quality});break;case"jpeg":r=r.jpeg({quality:e.quality});break;case"png":r=r.png({quality:e.quality});break}return r.toBuffer()}let{processImage:n}=await import("ts-images");return await Rc("img",async(r)=>{let m=g.join(r,`out.${e.format}`);return await n({input:t,output:m,format:e.format,quality:e.quality,resize:{width:e.width,height:e.height,fit:e.fit}}),Buffer.from(await Bun.file(m).arrayBuffer())})}async function D(t,e){let a=await d();if(e==="blur"&&a){let c=(await a(t).resize(20).blur(10).toBuffer()).toString("base64"),i=await hs(t);return`data:${U[i.format]||"image/jpeg"};base64,${c}`}if(e==="dominant-color"&&a){let{dominant:o}=await a(t).resize(1,1).toBuffer().then(async(c)=>{let i=await a(c).metadata();return{dominant:{r:128,g:128,b:128}}}).catch(()=>({dominant:{r:128,g:128,b:128}}));return`rgb(${o.r}, ${o.g}, ${o.b})`}let{generatePlaceholder:n}=await import("ts-images"),r=await hs(t),m=at("ph"),l=g.join(m,`in.${r.format==="unknown"?"bin":r.format}`);try{await Bun.write(l,t);let o=e==="blur"?"blur":e==="thumbhash"?"thumbhash":"dominant-color",i=await n(l,{strategy:o,width:o==="thumbhash"?void 0:32});if(e==="dominant-color"&&i.dominantColor)return i.dominantColor;if(i.dataURL)return i.dataURL;return"rgb(128, 128, 128)"}catch{return"rgb(128, 128, 128)"}finally{ge(m)}}function Rt(t,e){return(e?t.filter((n)=>n.format===e):t).sort((n,r)=>n.width-r.width).map((n)=>`${n.url} ${n.width}w`).join(", ")}function pn(t){if(!t||Object.keys(t).length===0)return"100vw";return Object.entries(t).sort((a,n)=>{let r=Number.parseInt(a[0].replace(/\D/g,""))||0;return(Number.parseInt(n[0].replace(/\D/g,""))||0)-r}).map(([a,n])=>`(max-width: ${a}) ${n}`).join(", ")+", 100vw"}function nr(t){let e=t.filter((n)=>n.format==="jpeg");if(e.length===0)return t[Math.floor(t.length/2)];let a=e.sort((n,r)=>n.width-r.width);return a[Math.floor(a.length/2)]}function rr(t){let e=new Map;for(let a of t){let n=e.get(a.format)||[];n.push(a),e.set(a.format,n)}return e}function sr(t){let e=g.extname(t).toLowerCase();return T.includes(e)}function fe(t){return U[t]||"application/octet-stream"}function or(t){return t.reduce((e,a)=>e+a.size,0)}function ir(t){if(t<1024)return`${t} B`;if(t<1048576)return`${(t/1024).toFixed(1)} KB`;return`${(t/1048576).toFixed(2)} MB`}class ys extends Error{code;constructor(t,e){super(t);this.name="ImageProcessingError",this.code=e}}
|
|
3
|
+
export{ue,de,pe,tr,$e,ze,hs,Au,Rt,pn,nr,rr,sr,fe,or,ir,ys};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ti,$i,Ri,Ai,qs,Ks,Oy,Ny,My,Dy,Xs,Ly}from"./chunk-f8sh6289.js";import"./chunk-r7zvrh58.js";import"./chunk-a78k8fkg.js";export{Ly as generateDefaultRobotsTxt,Xs as generateRobotsTxt,Ny as generateSitemap,My as generateSitemapIndex,Ai as injectSeoTags,qs as metaDirective,Ti as processMetaDirectives,Ri as processSeoDirective,$i as processStructuredData,Oy as registerSeoDirectives,Dy as scanForSitemapEntries,Ks as structuredDataDirective};
|