@stacksjs/stx 0.2.825 → 0.2.827
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-02zvytqx.js +2 -0
- package/dist/{chunk-bt0amey5.js → chunk-04z1xyrb.js} +2 -2
- package/dist/chunk-0jhq2kza.js +2 -0
- package/dist/{chunk-f0txsdpa.js → chunk-0rvntfhj.js} +3 -3
- package/dist/chunk-12m1qwzd.js +2 -0
- package/dist/chunk-17zrprh0.js +2 -0
- package/dist/chunk-1bpx9b0m.js +2 -0
- package/dist/{chunk-wy0gghvh.js → chunk-1vzncfka.js} +2 -2
- package/dist/chunk-2b1w7py1.js +2 -0
- package/dist/chunk-2mrdtxfy.js +2 -0
- package/dist/{chunk-2vqpz4qv.js → chunk-2qngyyaz.js} +2 -2
- package/dist/{chunk-7yb82rm6.js → chunk-2x9zhezb.js} +2 -2
- package/dist/{chunk-9fm8khcc.js → chunk-3esj6tb8.js} +5 -5
- package/dist/{chunk-3fwhb1q4.js → chunk-3g7bjpj6.js} +3 -3
- package/dist/{chunk-981z8va1.js → chunk-3p7r3ajd.js} +2 -2
- package/dist/chunk-3qx7whh5.js +2 -0
- package/dist/chunk-3vsz0vrk.js +2 -0
- package/dist/{chunk-en390342.js → chunk-3x3zcfxp.js} +48 -48
- package/dist/chunk-3zfras5s.js +2 -0
- package/dist/chunk-42c92rp3.js +2 -0
- package/dist/{chunk-0wgjhyb8.js → chunk-48z7tg83.js} +3 -3
- package/dist/chunk-4a3r1kh1.js +43 -0
- package/dist/{chunk-24d3yy27.js → chunk-4d8ep00w.js} +49 -49
- package/dist/chunk-4z0jpzdq.js +3 -0
- package/dist/{chunk-6qvn1h09.js → chunk-5201w0f1.js} +3 -3
- package/dist/{chunk-xmdcjyyx.js → chunk-543yvntm.js} +2 -2
- package/dist/{chunk-e99szqws.js → chunk-5phdmpa7.js} +6 -6
- package/dist/{chunk-06y0da27.js → chunk-5r63bv4g.js} +3 -3
- package/dist/chunk-67nq6csk.js +2 -0
- package/dist/chunk-6aak0b7c.js +2 -0
- package/dist/{chunk-7sh9fa3q.js → chunk-6k26n0sj.js} +2 -2
- package/dist/chunk-6r4teng3.js +2 -0
- package/dist/{chunk-d6d2s7n6.js → chunk-6tjm38e4.js} +2 -2
- package/dist/{chunk-06hc6rs6.js → chunk-716jrdcg.js} +1 -1
- package/dist/{chunk-ac2vz9c3.js → chunk-717qsbap.js} +10 -10
- package/dist/chunk-72n804gy.js +2 -0
- package/dist/chunk-7amk61bt.js +2 -0
- package/dist/{chunk-3yh6y00f.js → chunk-7k9yahng.js} +6 -6
- package/dist/{chunk-wf0n9gpj.js → chunk-7p8m82pj.js} +4 -4
- package/dist/{chunk-rzt51r2b.js → chunk-7z2ygy9p.js} +7 -7
- package/dist/chunk-8n8vj099.js +2 -0
- package/dist/chunk-8ta7f5en.js +2 -0
- package/dist/{chunk-r9e0r6jx.js → chunk-8y8kgw9s.js} +3 -3
- package/dist/{chunk-cnh6tcdj.js → chunk-8yy8qrcv.js} +10 -10
- package/dist/chunk-a7ewznxk.js +2 -0
- package/dist/{chunk-gjf8cjdt.js → chunk-ac9ncbfw.js} +3 -3
- package/dist/chunk-ahd8jdzx.js +2 -0
- package/dist/chunk-ay7ggc4k.js +2 -0
- package/dist/chunk-ayk94a19.js +2 -0
- package/dist/{chunk-mv3yhspn.js → chunk-b1q40vq4.js} +2 -2
- package/dist/{chunk-dsfdgqmd.js → chunk-b3nv89wq.js} +2 -2
- package/dist/{chunk-3axb6t08.js → chunk-b7tb00nz.js} +2 -2
- package/dist/chunk-b92vzax2.js +2 -0
- package/dist/{chunk-pbpr3bdy.js → chunk-bh35v908.js} +1 -1
- package/dist/chunk-bh7v78je.js +2 -0
- package/dist/{chunk-vfy3b7gm.js → chunk-bjvmmsvp.js} +6 -6
- package/dist/{chunk-djpmrctd.js → chunk-bwnwv91e.js} +8 -8
- package/dist/chunk-c7ybxv8x.js +2 -0
- package/dist/{chunk-3dz29mpg.js → chunk-c8vza3p0.js} +22 -22
- package/dist/{chunk-8ttmzcxb.js → chunk-c9mdvpf5.js} +29 -29
- package/dist/{chunk-5emrarpf.js → chunk-car6nhfe.js} +2 -2
- package/dist/{chunk-e4jwhmpb.js → chunk-cca18z35.js} +31 -31
- package/dist/chunk-cfrgrnej.js +2 -0
- package/dist/{chunk-vzbyn4nh.js → chunk-ckg6q98b.js} +5 -5
- package/dist/{chunk-k81trehg.js → chunk-cv1zc9dg.js} +2 -2
- package/dist/chunk-cw8vpk41.js +2 -0
- package/dist/chunk-d2n2zrdg.js +2 -0
- package/dist/{chunk-0scyzg9r.js → chunk-d9s37xm5.js} +19 -19
- package/dist/chunk-db1c0c3c.js +2 -0
- package/dist/{chunk-cxz4cdcn.js → chunk-e75dntfb.js} +2 -2
- package/dist/chunk-e8a6s6xs.js +25 -0
- package/dist/{chunk-wceg59n0.js → chunk-ekh3mxyp.js} +2 -2
- package/dist/{chunk-4mj9dem1.js → chunk-em8tv6nz.js} +2 -2
- package/dist/{chunk-7qk4exw1.js → chunk-ema1c29k.js} +2 -2
- package/dist/{chunk-z23arg8m.js → chunk-f49x34sr.js} +2 -2
- package/dist/{chunk-8w9spdbn.js → chunk-f6b7av6b.js} +9 -9
- package/dist/{chunk-9gmceny5.js → chunk-f7jgda7x.js} +5 -5
- package/dist/chunk-fb90n0by.js +2 -0
- package/dist/chunk-fevyb337.js +3 -0
- package/dist/chunk-fqq5qzm0.js +2 -0
- package/dist/chunk-fr9e8kb9.js +2 -0
- package/dist/{chunk-ge0k6c49.js → chunk-ftw0a5dm.js} +6 -6
- package/dist/{chunk-b4x5ndt9.js → chunk-fwktw49p.js} +4 -4
- package/dist/chunk-g4qzy5hv.js +2 -0
- package/dist/{chunk-tksjakyv.js → chunk-gcf97wgx.js} +1 -1
- package/dist/chunk-gg48cgx3.js +2 -0
- package/dist/{chunk-076fj387.js → chunk-hd378dgy.js} +1 -1
- package/dist/chunk-j9aftb7p.js +2 -0
- package/dist/chunk-jp6sbk05.js +2 -0
- package/dist/chunk-k6ye0159.js +3 -0
- package/dist/{chunk-vyj9xddw.js → chunk-kfkbqwyf.js} +2 -2
- package/dist/{chunk-ap2t6fdt.js → chunk-kh2n3zqa.js} +1 -1
- package/dist/{chunk-b1n2tq8f.js → chunk-kmqcvpz2.js} +5 -5
- package/dist/chunk-kshem79d.js +2 -0
- package/dist/chunk-kve27dy3.js +2 -0
- package/dist/chunk-m3tnxk01.js +2 -0
- package/dist/chunk-m716f2ga.js +2 -0
- package/dist/{chunk-3wjh3aw8.js → chunk-m973xh3a.js} +13 -13
- package/dist/chunk-m9bbhg46.js +3 -0
- package/dist/chunk-m9dj8pgb.js +2 -0
- package/dist/{chunk-gp37b8vw.js → chunk-mfebs2s2.js} +2 -2
- package/dist/{chunk-qj4r08jb.js → chunk-mxvevxb8.js} +4 -4
- package/dist/{chunk-btxnrqxf.js → chunk-myje6fhm.js} +5 -5
- package/dist/{chunk-1f7d1c0y.js → chunk-mypygxdm.js} +2 -2
- package/dist/{chunk-76eh43e9.js → chunk-nfpsaaqm.js} +2 -2
- package/dist/{chunk-zen28e3p.js → chunk-ng5revck.js} +29 -29
- package/dist/chunk-nxnkd48v.js +2 -0
- package/dist/chunk-pe5qqem0.js +2 -0
- package/dist/chunk-pg146fc5.js +2 -0
- package/dist/{chunk-67kbsav0.js → chunk-q5pwvr98.js} +1 -1
- package/dist/{chunk-2nj9aewf.js → chunk-qadce16v.js} +1 -1
- package/dist/chunk-qg2tpvdw.js +2 -0
- package/dist/chunk-qm6epp9h.js +2 -0
- package/dist/{chunk-faxbznng.js → chunk-qn06sy9j.js} +5 -5
- package/dist/{chunk-q7zwv88b.js → chunk-qnrgfm9v.js} +2 -2
- package/dist/{chunk-0kbzs147.js → chunk-qz82cpyv.js} +9 -9
- package/dist/chunk-rbq4dn2a.js +2 -0
- package/dist/{chunk-kvgxmb0s.js → chunk-ret52ds0.js} +6 -6
- package/dist/{chunk-xpy9yjyx.js → chunk-rkdsgfhd.js} +13 -13
- package/dist/{chunk-bfbh0hfn.js → chunk-rmygv0n0.js} +6 -6
- package/dist/{chunk-n7arptzc.js → chunk-s53wjw7y.js} +3 -3
- package/dist/{chunk-p1fpferp.js → chunk-s5dhvnnd.js} +6 -6
- package/dist/chunk-s5ejh2yx.js +2 -0
- package/dist/chunk-s6399qe7.js +2 -0
- package/dist/chunk-se3fqsxk.js +2 -0
- package/dist/chunk-t59bc7na.js +3 -0
- package/dist/{chunk-yr3ped5m.js → chunk-t96229jm.js} +2 -2
- package/dist/{chunk-z5hmwq1z.js → chunk-tngj0fp6.js} +8 -8
- package/dist/chunk-txzap6yn.js +2 -0
- package/dist/{chunk-g0zxp9qh.js → chunk-tzhs7drk.js} +11 -11
- package/dist/chunk-v1mwhvf8.js +2 -0
- package/dist/chunk-vb4xzz5c.js +2 -0
- package/dist/{chunk-me6kgvsm.js → chunk-vpnyqf0h.js} +1 -1
- package/dist/chunk-vxhq8n8y.js +2 -0
- package/dist/{chunk-mwxbdpb1.js → chunk-vyv76w55.js} +2 -2
- package/dist/chunk-w39cfxa6.js +2 -0
- package/dist/chunk-w9gpscjf.js +2 -0
- package/dist/chunk-wb6w807m.js +2 -0
- package/dist/chunk-wpyhavjy.js +2 -0
- package/dist/{chunk-j3st59hv.js → chunk-wr7bmkne.js} +2 -2
- package/dist/chunk-wt7qhv5b.js +2 -0
- package/dist/{chunk-y8p85kcj.js → chunk-wvds0s9m.js} +2 -2
- package/dist/chunk-x742wppj.js +2 -0
- package/dist/chunk-xdwnbr9b.js +4 -0
- package/dist/{chunk-a1htb5r5.js → chunk-xj3my6b9.js} +105 -105
- package/dist/{chunk-qz3fdmrc.js → chunk-xn9jg1q5.js} +3 -3
- package/dist/chunk-xrspzeqx.js +2 -0
- package/dist/{chunk-xegj9wqj.js → chunk-xtn0hnmz.js} +6 -6
- package/dist/{chunk-jb2rvsf4.js → chunk-y6nz6bk2.js} +3 -3
- package/dist/{chunk-cmnze7at.js → chunk-ybq56wam.js} +2 -2
- package/dist/{chunk-y9bj3566.js → chunk-yrw5ensv.js} +3 -3
- package/dist/{chunk-axwa3s1m.js → chunk-yv1vw0kx.js} +2 -2
- package/dist/{chunk-pvj0bpqg.js → chunk-z25w7kmr.js} +4 -4
- package/dist/chunk-zty254tw.js +2 -0
- package/dist/{chunk-j737tnvt.js → chunk-zvvv6x8c.js} +4 -4
- package/dist/cli.js +23 -23
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/loops.d.ts +2 -0
- package/dist/loops.js +22 -3
- package/dist/performance-utils.d.ts +2 -0
- package/dist/performance-utils.js +7 -0
- package/dist/process.js +17 -3
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +11 -11
- package/package.json +5 -5
- package/dist/chunk-030tgwve.js +0 -2
- package/dist/chunk-09285y4b.js +0 -2
- package/dist/chunk-0jvrzpfs.js +0 -2
- package/dist/chunk-1qwb0pyb.js +0 -2
- package/dist/chunk-30rpspzt.js +0 -43
- package/dist/chunk-3bf48zrh.js +0 -2
- package/dist/chunk-3bny2583.js +0 -2
- package/dist/chunk-3e7t4qzd.js +0 -2
- package/dist/chunk-40rzr6qj.js +0 -2
- package/dist/chunk-4sev2jfs.js +0 -2
- package/dist/chunk-5e5jschg.js +0 -3
- package/dist/chunk-5ea3zebc.js +0 -2
- package/dist/chunk-6h1qa3hw.js +0 -2
- package/dist/chunk-6tfhx4zw.js +0 -2
- package/dist/chunk-716qmx26.js +0 -2
- package/dist/chunk-7bjxmzre.js +0 -2
- package/dist/chunk-7mw1yc6j.js +0 -2
- package/dist/chunk-7pz76f28.js +0 -2
- package/dist/chunk-7vfq8t4x.js +0 -2
- package/dist/chunk-9w9vr35m.js +0 -2
- package/dist/chunk-a8fy7jv8.js +0 -2
- package/dist/chunk-akj26p4b.js +0 -3
- package/dist/chunk-an1cc36z.js +0 -2
- package/dist/chunk-b22yj5j5.js +0 -2
- package/dist/chunk-brhas9mp.js +0 -3
- package/dist/chunk-c1e45rtv.js +0 -2
- package/dist/chunk-cgamtmxv.js +0 -2
- package/dist/chunk-d30p1zvd.js +0 -2
- package/dist/chunk-dfy5g8cb.js +0 -2
- package/dist/chunk-e38gkp8q.js +0 -2
- package/dist/chunk-fm8hq9y2.js +0 -2
- package/dist/chunk-g4sdthck.js +0 -2
- package/dist/chunk-g8nqmnb7.js +0 -2
- package/dist/chunk-h67pm636.js +0 -2
- package/dist/chunk-hb8jxg45.js +0 -2
- package/dist/chunk-hfgzqapw.js +0 -2
- package/dist/chunk-hras294c.js +0 -25
- package/dist/chunk-j0hrk24j.js +0 -2
- package/dist/chunk-jjbdtj4w.js +0 -2
- package/dist/chunk-jzgyrxye.js +0 -2
- package/dist/chunk-k0xdvegc.js +0 -2
- package/dist/chunk-kg9gnar1.js +0 -2
- package/dist/chunk-kq5k2qbz.js +0 -2
- package/dist/chunk-m934bzg2.js +0 -2
- package/dist/chunk-mmeck545.js +0 -2
- package/dist/chunk-mz6qjee1.js +0 -2
- package/dist/chunk-ndjmt3vg.js +0 -3
- package/dist/chunk-pgpkrf6g.js +0 -2
- package/dist/chunk-prt4ntb0.js +0 -2
- package/dist/chunk-px6336z8.js +0 -2
- package/dist/chunk-q5bct2ks.js +0 -2
- package/dist/chunk-r2hjn9ds.js +0 -2
- package/dist/chunk-rqdnzbq0.js +0 -2
- package/dist/chunk-rrkn40eq.js +0 -2
- package/dist/chunk-s2zsa16d.js +0 -2
- package/dist/chunk-sddp2398.js +0 -2
- package/dist/chunk-sfr0767s.js +0 -2
- package/dist/chunk-sv4emtcj.js +0 -2
- package/dist/chunk-sx8j2e58.js +0 -2
- package/dist/chunk-t2tv5ezg.js +0 -2
- package/dist/chunk-tcyvwy8p.js +0 -2
- package/dist/chunk-tg18j1yf.js +0 -2
- package/dist/chunk-tj7dh2dz.js +0 -2
- package/dist/chunk-tsvnhc0c.js +0 -4
- package/dist/chunk-vafxrky2.js +0 -2
- package/dist/chunk-vvjp9xp0.js +0 -2
- package/dist/chunk-wpendr22.js +0 -3
- package/dist/chunk-x30gh7vt.js +0 -2
- package/dist/chunk-y3trpdp9.js +0 -2
- package/dist/chunk-zqsygwa0.js +0 -2
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{er,$e}from"./chunk-7sh9fa3q.js";import{H,w,br,Ds,C}from"./chunk-a1htb5r5.js";import{a,I}from"./chunk-zen28e3p.js";import{Oo}from"./chunk-faxbznng.js";import{nt}from"./chunk-5emrarpf.js";import{c}from"./chunk-brhas9mp.js";import{r,ge}from"./chunk-b4x5ndt9.js";import p from"path";import B from"fs";import{AsyncLocalStorage as xt}from"async_hooks";import{randomUUID as yt}from"crypto";var $t=11;function W(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(p.basename(t))||Oo(t,e,n)}var at=2;function xf(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?p.resolve(e):c(t,"bundle-cache")}function st(t,e){let n=t;for(let i of wt(e))if(i!==p.sep)n=n.split(i).join("\x00root");return n}var rt=new Map;function wt(t){let e=p.resolve(t),n=rt.get(e);if(!n){let i=e;try{i=B.realpathSync(e)}catch{}n=[...new Set([e,i])].sort((l,d)=>d.length-l.length),rt.set(e,n)}return n}function bt(t,e){try{let n=B.statSync(t),i=p.resolve(e),l=t.startsWith(`${i}${p.sep}`);return{path:l?p.relative(i,t):t,...l?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(B.readFileSync(t)).toString(36)}}catch{return null}}function ct(t,e){return t.inRoot?p.join(p.resolve(e),t.path):t.path}function St(t,e){for(let n of t){let i=ct(n,e);try{let l=B.statSync(i);if(l.size!==n.size)return!1;if(l.mtimeMs!==n.mtimeMs&&Bun.hash(B.readFileSync(i)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var lt=new Map,vt=100;function Sf(t=process.env){let e=Number(t.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(e)&&e>=1?Math.floor(e):2000}var G=new Map;async function jt(t){let e=G.get(t)??0;if(e>0&&e<vt){G.set(t,e+1);return}G.set(t,1);try{let n=(await B.promises.readdir(t)).filter((o)=>o.endsWith(".js")),i=Sf();if(n.length<=i)return;let d=(await Promise.all(n.map(async(o)=>{try{return{name:o,at:(await B.promises.stat(p.join(t,o))).mtimeMs}}catch{return null}}))).filter((o)=>o!==null);d.sort((o,b)=>b.at-o.at);for(let o of d.slice(i)){let b=o.name.slice(0,-3);await B.promises.rm(p.join(t,`${b}.js`),{force:!0}),await B.promises.rm(p.join(t,`${b}.deps.json`),{force:!0})}A("pruned bundle cache to",i,"entries")}catch{}}function he(t){return lt.get(t)??[]}function Z(t,e){if(t)lt.set(t,e)}function kf(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function A(...t){if(kf())console.log("[stx:bundler]",...t)}var K=[];function tc(t,e,n){K.push({filePath:t||"<inline>",message:e,details:n})}function en(){return K.slice()}function tn(){K.length=0}var Q;function _h(t){Q=t}function nc(){if(Q)return Q;try{let t=I.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Y=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function nn(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let l=n[1];if(!Y.some((o)=>o.test(l)))return A("detected user import:",l),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=i.exec(t))!==null){let l=n[1];if(/\.css(?:\?.*)?$/.test(l))continue;if(!Y.some((o)=>o.test(l)))return A("detected side-effect import:",l),!0}return!1}var Qn="stx-module:",Bt=/\.(?:[cm]?[jt]sx?|json)$/i;function _f(t,e){return p.relative(t,e).split(p.sep).join("/")}function Cf(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,i,l,d)=>{let o=e.get(d);return o&&!d.startsWith(Qn)?`${i}${l}${o}${l}`:n})}function Ef(t,e){let n=0,i=(d)=>{let o=`__stxMod${n++}`,b=JSON.stringify(d);return e.push(`var ${o} = globalThis.__stxModules && globalThis.__stxModules[${b}];`,`if (${o} === undefined) throw new Error("[stx] module " + ${JSON.stringify(b)} + " is not registered on this page (#1957)");`),o},l=(d,o)=>{for(let b of d.split(",")){let D=b.trim();if(!D)continue;let M=D.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!M)continue;let S=M[1].startsWith('"')?JSON.parse(M[1]):M[1],f=M[2]??S;e.push(`var ${f} = ${o}[${JSON.stringify(S)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(d,o,b)=>{let D=b.slice(Qn.length),M=i(D),S=o.trim(),f=S.match(/^([\w$]+)\s*(?:,\s*|$)/);if(f&&!S.startsWith("{")&&!S.startsWith("*"))e.push(`var ${f[1]} = ${M}.default;`),S=S.slice(f[0].length).trim();let v=S.match(/^\*\s*as\s+([\w$]+)$/);if(v)e.push(`var ${v[1]} = ${M};`);else if(S.startsWith("{"))l(S.replace(/^\{|\}$/g,""),M);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(d,o)=>(i(o.slice(Qn.length)),"")),t}function it(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,p.join(t,"index.ts"),p.join(t,"index.tsx"),p.join(t,"index.js"),p.join(t,"index.mjs")];for(let n of e)try{if(B.existsSync(n)&&B.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var X=new xt;function ss(t,e){let n=new Bun.CryptoHasher("md5");for(let[i,l]of[...t].sort(([d],[o])=>d<o?-1:d>o?1:0))n.update(`${i}\x00${l}\x00`);return X.run({modules:t,key:n.digest("hex").slice(0,12)},e)}function rn(){return X.getStore()?.key??""}function ut(t,e,n,i,l,d,o=new Map,b,D,M){let S=new Map([[n,i],...M??[]]),f=(j)=>j!==void 0&&S.has(j),v=(j,s,u)=>{if(W(s,t,b))return null;if(!d||!f(j)||!Bt.test(s))return null;try{if(!B.statSync(s,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}l.add(s);let E=`${Qn}${_f(process.cwd(),s)}`;return o.set(u,E),{path:E,external:!0}},y=(j,s)=>{let u=f(j)?e:p.dirname(j),E=p.resolve(u,s);return it(E)??E};return{name:"stx-client-bundle",setup(j){if(j.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(s)=>({path:s.path,external:!0})),j.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(s)=>({path:s.path,external:!0})),j.onResolve({filter:/^\//},(s)=>{if(f(s.path))return{path:s.path};let u=it(s.path);if(u){let E=v(s.importer,u,s.path);if(E)return E;if(!f(u))l.add(u);return{path:u}}return{path:s.path,external:!0}}),j.onResolve({filter:/^\.\.?\//},(s)=>{let u=y(s.importer,s.path),E=v(s.importer,u,s.path);if(E)return E;return l.add(u),{path:u}}),j.onResolve({filter:/^[@~]\//},(s)=>{let u=p.resolve(t,s.path.slice(2)),E=[u,`${u}.ts`,`${u}.tsx`,`${u}.js`,`${u}.mjs`,`${u}.jsx`,p.join(u,"index.ts"),p.join(u,"index.tsx"),p.join(u,"index.js"),p.join(u,"index.mjs")];for(let h of E)if(B.existsSync(h)&&B.statSync(h,{throwIfNoEntry:!1})?.isFile()){let O=v(s.importer,h,s.path);if(O)return O;return A(`resolved ${s.path[0]}/ import:`,s.path,"\u2192",h),l.add(h),{path:h}}return console.warn(`[stx:bundler] could not resolve ${s.path[0]}/ import:`,s.path),{path:u}}),d)j.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(s)=>{if(!f(s.importer))return;let u=`${Qn}npm:${s.path}`;return o.set(s.path,u),{path:u,external:!0}});j.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(s)=>{if(S.has(s.path))return{contents:S.get(s.path),loader:"ts"};if(W(s.path,t,b))throw Error(`Server-only API source cannot be imported by a client script: ${s.path}`);let u=p.extname(s.path).toLowerCase(),E=u===".json"?"json":u===".tsx"?"tsx":u===".jsx"?"jsx":u===".ts"||u===".mts"||u===".cts"?"ts":"js";if(!f(s.path))l.add(s.path);let h=D?.get(s.path);if(h!==void 0)return{contents:h,loader:"js"};return{contents:B.readFileSync(s.path,"utf8"),loader:E}})}}}var q=new Map,P=w(64),ot=Symbol.for("stx.client-bundle-build-queue");function Tf(t){let e=globalThis,i=(e[ot]??Promise.resolve()).then(t,t);return e[ot]=i.then(()=>{return},()=>{return}),i}async function sn(t,e,n={}){let i=n.projectRoot||process.cwd(),l=(await a(i)).serverApi,d=n.minify??!1,o=n.externalizeUserModules??!0,b=n.expose?.length?[...new Set(n.expose)].sort():void 0,D=n.cacheDir||xf(i),M=X.getStore(),S=new Bun.CryptoHasher("md5");S.update(`${$t}\x00${nt()}\x00${JSON.stringify(l??!1)}\x00${o?"registry":"inline"}\x00${b?b.join(","):"*"}\x00${d?"minified":"readable"}\x00${M?.key??""}\x00${st(t,i)}\x00${st(e,i)}`);let f=S.digest("hex").slice(0,12),v=p.join(D,`${f}.js`),y=P.get(v);if(y){if(Ds(y.files)&&y.files.every((h)=>!W(h.path,i,l))){A("memo hit:",f);let h=y.files.map((O)=>O.path);return Z(e,h),n.collectInputs?.push(...h),y.code}P.delete(v),A("memo invalidated by dep change:",f)}let j=p.join(D,`${f}.deps.json`),s=Bun.file(v);if(await s.exists()){let h=Bun.file(j),O=!1,k=null;if(await h.exists())try{let N=JSON.parse(await h.text());if(N.metadataVersion===at&&Array.isArray(N.files)&&St(N.files,i))k=br(N.files.map((g)=>ct(g,i))),O=k.length===N.files.length&&!k.some((g)=>W(g.path,i,l))}catch{O=!1}if(O){if(A("cache hit:",f),k)Z(e,k.map((U)=>U.path)),n.collectInputs?.push(...k.map((U)=>U.path));let N=await s.text(),g=new Date;if(B.promises.utimes(v,g,g).catch(()=>{}),k)P.set(v,{code:N,files:k});return N}A("cache invalidated by dep change:",f)}let u=q.get(f);if(u){let h=await u;if(n.collectInputs)n.collectInputs.push(...(P.get(v)?.files??[]).map((O)=>O.path));return h}let E=Tf(()=>Et(t,e,{projectRoot:i,minify:d,cacheDir:D,hash:f,cachePath:v,depsPath:j,collectInputs:n.collectInputs,externalizeUserModules:o,serverApi:l,expose:b,throwOnFailure:n.throwOnFailure,substitutes:M?.modules}));q.set(f,E);try{return await E}finally{q.delete(f)}}function rc(t){return`${t}-${process.pid}-${yt()}`}async function Ch(t,e){let{projectRoot:n}=e,i=rc(new Bun.CryptoHasher("md5").update([...t.keys()].join("\x00")).digest("hex").slice(0,12)),l=p.join(c(n,"bundle-tmp"),"out",i);B.mkdirSync(l,{recursive:!0});let d=new Map,o=new Map,b=0;for(let[f,v]of t){let y=p.join(n,`.stx-split-${i}-${b++}.ts`);d.set(y,v),o.set(p.basename(y).replace(/\.ts$/,""),f)}let[D,M]=[...d][0],S=new Set;try{let f=await Bun.build({entrypoints:[...d.keys()],outdir:l,target:"browser",format:"esm",splitting:!0,minify:!1,naming:{entry:"[name].js",chunk:"chunk-[hash].js"},plugins:[ut(n,p.dirname(e.filePath),D,M,S,!1,new Map,void 0,X.getStore()?.modules,d)],define:{"process.env.NODE_ENV":'"development"',...C()},root:n});if(!f.success)throw Error(f.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ")||"Unable to bundle the entries");let v={entries:new Map,chunks:new Map};for(let y of f.outputs){let j=p.basename(y.path);if(y.kind==="entry-point"){let s=o.get(j.replace(/\.js$/,""));if(s!==void 0)v.entries.set(s,await y.text())}else if(y.kind==="chunk")v.chunks.set(j.replace(/\.js$/,""),await y.text())}return e.collectInputs?.push(...S),v}finally{try{B.rmSync(l,{recursive:!0,force:!0})}catch{}}}async function Et(t,e,n){let{projectRoot:i,minify:l,cacheDir:d,hash:o,cachePath:b,depsPath:D,externalizeUserModules:M}=n,S=c(i,"bundle-tmp"),f=rc(o),v=p.join(i,`.stx-client-${f}.ts`),y=p.join(S,"out",f);B.mkdirSync(y,{recursive:!0});let j=p.dirname(e),s=new Set,u=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,E=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,h=r(t),{depths:O,balanced:k}=ge(h),N=(R)=>!k||O[R]===0,g;while((g=u.exec(h))!==null){if(g[1])continue;if(!N(g.index))continue;if(g[2])g[2].split(",").forEach((R)=>{let m=_t(R);if(m)s.add(m)});else if(g[3])s.add(g[3])}while((g=E.exec(h))!==null){if(g[1])continue;if(!N(g.index))continue;s.add(g[2])}let U=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=U.exec(h))!==null){if(!N(g.index))continue;let R=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(R&&Y.some((m)=>m.test(R)))continue;if(g[1])s.add(g[1]);if(g[2])s.add(g[2]);for(let m of(g[3]??"").split(",")){let _=m.trim();if(!_||/^type\s/.test(_))continue;let L=/\bas\s+(\w+)\s*$/.exec(_)?.[1]??/^\w+$/.exec(_)?.[0];if(L)s.add(L)}}for(let R of h.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let m of R[1].split(",")){let _=/\bas\s+(\w+)\s*$/.exec(m)?.[1]??/^\s*(\w+)\s*$/.exec(m)?.[1];if(_)s.delete(_)}let pt=s.size>0?`
|
|
3
|
-
export { ${[...s].join(", ")} }`:"";A("bundling:",o,"from:",p.basename(e));let tt=new Set,et=new Map;try{let R=await Bun.build({entrypoints:[v],outdir:y,target:"browser",format:"esm",minify:l?{whitespace:!1,identifiers:!0,syntax:!0}:!1,plugins:[ut(i,j,v,t+pt,tt,M,et,n.serverApi,n.substitutes)],define:{"process.env.NODE_ENV":l?'"production"':'"development"',...C()},root:i});if(!R.success){let F=R.logs.filter((T)=>T.level==="error").map((T)=>T.message).join(", ")||`Unable to bundle ${p.basename(e)}`,z=
|
|
4
|
-
`),ht=_.map(([x])=>`${x} = ${
|
|
2
|
+
import{tr,Re}from"./chunk-6k26n0sj.js";import{V,w,br,Ds,C}from"./chunk-xj3my6b9.js";import{a,O}from"./chunk-ng5revck.js";import{Oo}from"./chunk-qn06sy9j.js";import{rt}from"./chunk-car6nhfe.js";import{c}from"./chunk-k6ye0159.js";import{r,me}from"./chunk-fwktw49p.js";import p from"path";import B from"fs";import{AsyncLocalStorage as xt}from"async_hooks";import{randomUUID as yt}from"crypto";var $t=11;function X(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(p.basename(t))||Oo(t,e,n)}var at=2;function Sf(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?p.resolve(e):c(t,"bundle-cache")}function nt(t,e){let n=t;for(let i of wt(e))if(i!==p.sep)n=n.split(i).join("\x00root");return n}var st=new Map;function wt(t){let e=p.resolve(t),n=st.get(e);if(!n){let i=e;try{i=B.realpathSync(e)}catch{}n=[...new Set([e,i])].sort((l,d)=>d.length-l.length),st.set(e,n)}return n}function bt(t,e){try{let n=B.statSync(t),i=p.resolve(e),l=t.startsWith(`${i}${p.sep}`);return{path:l?p.relative(i,t):t,...l?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(B.readFileSync(t)).toString(36)}}catch{return null}}function ct(t,e){return t.inRoot?p.join(p.resolve(e),t.path):t.path}function St(t,e){for(let n of t){let i=ct(n,e);try{let l=B.statSync(i);if(l.size!==n.size)return!1;if(l.mtimeMs!==n.mtimeMs&&Bun.hash(B.readFileSync(i)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var lt=new Map,vt=100;function kf(t=process.env){let e=Number(t.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(e)&&e>=1?Math.floor(e):2000}var H=new Map;async function jt(t){let e=H.get(t)??0;if(e>0&&e<vt){H.set(t,e+1);return}H.set(t,1);try{let n=(await B.promises.readdir(t)).filter((o)=>o.endsWith(".js")),i=kf();if(n.length<=i)return;let d=(await Promise.all(n.map(async(o)=>{try{return{name:o,at:(await B.promises.stat(p.join(t,o))).mtimeMs}}catch{return null}}))).filter((o)=>o!==null);d.sort((o,b)=>b.at-o.at);for(let o of d.slice(i)){let b=o.name.slice(0,-3);await B.promises.rm(p.join(t,`${b}.js`),{force:!0}),await B.promises.rm(p.join(t,`${b}.deps.json`),{force:!0})}A("pruned bundle cache to",i,"entries")}catch{}}function ye(t){return lt.get(t)??[]}function Z(t,e){if(t)lt.set(t,e)}function _f(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function A(...t){if(_f())console.log("[stx:bundler]",...t)}var K=[];function nc(t,e,n){K.push({filePath:t||"<inline>",message:e,details:n})}function tn(){return K.slice()}function nn(){K.length=0}var Q;function Eh(t){Q=t}function rc(){if(Q)return Q;try{let t=O.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Y=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function rn(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let l=n[1];if(!Y.some((o)=>o.test(l)))return A("detected user import:",l),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=i.exec(t))!==null){let l=n[1];if(/\.css(?:\?.*)?$/.test(l))continue;if(!Y.some((o)=>o.test(l)))return A("detected side-effect import:",l),!0}return!1}var er="stx-module:",Bt=/\.(?:[cm]?[jt]sx?|json)$/i;function Cf(t,e){return p.relative(t,e).split(p.sep).join("/")}function Ef(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,i,l,d)=>{let o=e.get(d);return o&&!d.startsWith(er)?`${i}${l}${o}${l}`:n})}function Tf(t,e){let n=0,i=(d)=>{let o=`__stxMod${n++}`,b=JSON.stringify(d);return e.push(`var ${o} = globalThis.__stxModules && globalThis.__stxModules[${b}];`,`if (${o} === undefined) throw new Error("[stx] module " + ${JSON.stringify(b)} + " is not registered on this page (#1957)");`),o},l=(d,o)=>{for(let b of d.split(",")){let I=b.trim();if(!I)continue;let M=I.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!M)continue;let S=M[1].startsWith('"')?JSON.parse(M[1]):M[1],f=M[2]??S;e.push(`var ${f} = ${o}[${JSON.stringify(S)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(d,o,b)=>{let I=b.slice(er.length),M=i(I),S=o.trim(),f=S.match(/^([\w$]+)\s*(?:,\s*|$)/);if(f&&!S.startsWith("{")&&!S.startsWith("*"))e.push(`var ${f[1]} = ${M}.default;`),S=S.slice(f[0].length).trim();let v=S.match(/^\*\s*as\s+([\w$]+)$/);if(v)e.push(`var ${v[1]} = ${M};`);else if(S.startsWith("{"))l(S.replace(/^\{|\}$/g,""),M);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(d,o)=>(i(o.slice(er.length)),"")),t}function it(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,p.join(t,"index.ts"),p.join(t,"index.tsx"),p.join(t,"index.js"),p.join(t,"index.mjs")];for(let n of e)try{if(B.existsSync(n)&&B.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var G=new xt;function ss(t,e){let n=new Bun.CryptoHasher("md5");for(let[i,l]of[...t].sort(([d],[o])=>d<o?-1:d>o?1:0))n.update(`${i}\x00${l}\x00`);return G.run({modules:t,key:n.digest("hex").slice(0,12)},e)}function sn(){return G.getStore()?.key??""}function ut(t,e,n,i,l,d,o=new Map,b,I,M){let S=new Map([[n,i],...M??[]]),f=(j)=>j!==void 0&&S.has(j),v=(j,s,u)=>{if(X(s,t,b))return null;if(!d||!f(j)||!Bt.test(s))return null;try{if(!B.statSync(s,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}l.add(s);let E=`${er}${Cf(process.cwd(),s)}`;return o.set(u,E),{path:E,external:!0}},y=(j,s)=>{let u=f(j)?e:p.dirname(j),E=p.resolve(u,s);return it(E)??E};return{name:"stx-client-bundle",setup(j){if(j.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(s)=>({path:s.path,external:!0})),j.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(s)=>({path:s.path,external:!0})),j.onResolve({filter:/^\//},(s)=>{if(f(s.path))return{path:s.path};let u=it(s.path);if(u){let E=v(s.importer,u,s.path);if(E)return E;if(!f(u))l.add(u);return{path:u}}return{path:s.path,external:!0}}),j.onResolve({filter:/^\.\.?\//},(s)=>{let u=y(s.importer,s.path),E=v(s.importer,u,s.path);if(E)return E;return l.add(u),{path:u}}),j.onResolve({filter:/^[@~]\//},(s)=>{let u=p.resolve(t,s.path.slice(2)),E=[u,`${u}.ts`,`${u}.tsx`,`${u}.js`,`${u}.mjs`,`${u}.jsx`,p.join(u,"index.ts"),p.join(u,"index.tsx"),p.join(u,"index.js"),p.join(u,"index.mjs")];for(let h of E)if(B.existsSync(h)&&B.statSync(h,{throwIfNoEntry:!1})?.isFile()){let D=v(s.importer,h,s.path);if(D)return D;return A(`resolved ${s.path[0]}/ import:`,s.path,"\u2192",h),l.add(h),{path:h}}return console.warn(`[stx:bundler] could not resolve ${s.path[0]}/ import:`,s.path),{path:u}}),d)j.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(s)=>{if(!f(s.importer))return;let u=`${er}npm:${s.path}`;return o.set(s.path,u),{path:u,external:!0}});j.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(s)=>{if(S.has(s.path))return{contents:S.get(s.path),loader:"ts"};if(X(s.path,t,b))throw Error(`Server-only API source cannot be imported by a client script: ${s.path}`);let u=p.extname(s.path).toLowerCase(),E=u===".json"?"json":u===".tsx"?"tsx":u===".jsx"?"jsx":u===".ts"||u===".mts"||u===".cts"?"ts":"js";if(!f(s.path))l.add(s.path);let h=I?.get(s.path);if(h!==void 0)return{contents:h,loader:"js"};return{contents:B.readFileSync(s.path,"utf8"),loader:E}})}}}var q=new Map,P=w(64),ot=Symbol.for("stx.client-bundle-build-queue");function $f(t){let e=globalThis,i=(e[ot]??Promise.resolve()).then(t,t);return e[ot]=i.then(()=>{return},()=>{return}),i}async function on(t,e,n={}){let i=n.projectRoot||process.cwd(),l=(await a(i)).serverApi,d=n.minify??!1,o=n.externalizeUserModules??!0,b=n.expose?.length?[...new Set(n.expose)].sort():void 0,I=n.cacheDir||Sf(i),M=G.getStore(),S=new Bun.CryptoHasher("md5");S.update(`${$t}\x00${rt()}\x00${JSON.stringify(l??!1)}\x00${o?"registry":"inline"}\x00${b?b.join(","):"*"}\x00${d?"minified":"readable"}\x00${M?.key??""}\x00${nt(t,i)}\x00${nt(e,i)}`);let f=S.digest("hex").slice(0,12),v=p.join(I,`${f}.js`),y=P.get(v);if(y){if(Ds(y.files)&&y.files.every((h)=>!X(h.path,i,l))){A("memo hit:",f);let h=y.files.map((D)=>D.path);return Z(e,h),n.collectInputs?.push(...h),y.code}P.delete(v),A("memo invalidated by dep change:",f)}let j=p.join(I,`${f}.deps.json`),s=Bun.file(v);if(await s.exists()){let h=Bun.file(j),D=!1,k=null;if(await h.exists())try{let N=JSON.parse(await h.text());if(N.metadataVersion===at&&Array.isArray(N.files)&&St(N.files,i))k=br(N.files.map((g)=>ct(g,i))),D=k.length===N.files.length&&!k.some((g)=>X(g.path,i,l))}catch{D=!1}if(D){if(A("cache hit:",f),k)Z(e,k.map((U)=>U.path)),n.collectInputs?.push(...k.map((U)=>U.path));let N=await s.text(),g=new Date;if(B.promises.utimes(v,g,g).catch(()=>{}),k)P.set(v,{code:N,files:k});return N}A("cache invalidated by dep change:",f)}let u=q.get(f);if(u){let h=await u;if(n.collectInputs)n.collectInputs.push(...(P.get(v)?.files??[]).map((D)=>D.path));return h}let E=$f(()=>Et(t,e,{projectRoot:i,minify:d,cacheDir:I,hash:f,cachePath:v,depsPath:j,collectInputs:n.collectInputs,externalizeUserModules:o,serverApi:l,expose:b,throwOnFailure:n.throwOnFailure,substitutes:M?.modules}));q.set(f,E);try{return await E}finally{q.delete(f)}}function sc(t){return`${t}-${process.pid}-${yt()}`}async function Th(t,e){let{projectRoot:n}=e,i=sc(new Bun.CryptoHasher("md5").update([...t.keys()].join("\x00")).digest("hex").slice(0,12)),l=p.join(c(n,"bundle-tmp"),"out",i);B.mkdirSync(l,{recursive:!0});let d=new Map,o=new Map,b=0;for(let[f,v]of t){let y=p.join(n,`.stx-split-${i}-${b++}.ts`);d.set(y,v),o.set(p.basename(y).replace(/\.ts$/,""),f)}let[I,M]=[...d][0],S=new Set;try{let f=await Bun.build({entrypoints:[...d.keys()],outdir:l,target:"browser",format:"esm",splitting:!0,minify:!1,naming:{entry:"[name].js",chunk:"chunk-[hash].js"},plugins:[ut(n,p.dirname(e.filePath),I,M,S,!1,new Map,void 0,G.getStore()?.modules,d)],define:{"process.env.NODE_ENV":'"development"',...C()},root:n});if(!f.success)throw Error(f.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ")||"Unable to bundle the entries");let v={entries:new Map,chunks:new Map};for(let y of f.outputs){let j=p.basename(y.path);if(y.kind==="entry-point"){let s=o.get(j.replace(/\.js$/,""));if(s!==void 0)v.entries.set(s,await y.text())}else if(y.kind==="chunk")v.chunks.set(j.replace(/\.js$/,""),await y.text())}return e.collectInputs?.push(...S),v}finally{try{B.rmSync(l,{recursive:!0,force:!0})}catch{}}}async function Et(t,e,n){let{projectRoot:i,minify:l,cacheDir:d,hash:o,cachePath:b,depsPath:I,externalizeUserModules:M}=n,S=c(i,"bundle-tmp"),f=sc(o),v=p.join(i,`.stx-client-${f}.ts`),y=p.join(S,"out",f);B.mkdirSync(y,{recursive:!0});let j=p.dirname(e),s=new Set,u=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,E=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,h=r(t),{depths:D,balanced:k}=me(h),N=(R)=>!k||D[R]===0,g;while((g=u.exec(h))!==null){if(g[1])continue;if(!N(g.index))continue;if(g[2])g[2].split(",").forEach((R)=>{let m=_t(R);if(m)s.add(m)});else if(g[3])s.add(g[3])}while((g=E.exec(h))!==null){if(g[1])continue;if(!N(g.index))continue;s.add(g[2])}let U=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=U.exec(h))!==null){if(!N(g.index))continue;let R=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(R&&Y.some((m)=>m.test(R)))continue;if(g[1])s.add(g[1]);if(g[2])s.add(g[2]);for(let m of(g[3]??"").split(",")){let _=m.trim();if(!_||/^type\s/.test(_))continue;let L=/\bas\s+(\w+)\s*$/.exec(_)?.[1]??/^\w+$/.exec(_)?.[0];if(L)s.add(L)}}for(let R of h.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let m of R[1].split(",")){let _=/\bas\s+(\w+)\s*$/.exec(m)?.[1]??/^\s*(\w+)\s*$/.exec(m)?.[1];if(_)s.delete(_)}let pt=s.size>0?`
|
|
3
|
+
export { ${[...s].join(", ")} }`:"";A("bundling:",o,"from:",p.basename(e));let tt=new Set,et=new Map;try{let R=await Bun.build({entrypoints:[v],outdir:y,target:"browser",format:"esm",minify:l?{whitespace:!1,identifiers:!0,syntax:!0}:!1,plugins:[ut(i,j,v,t+pt,tt,M,et,n.serverApi,n.substitutes)],define:{"process.env.NODE_ENV":l?'"production"':'"development"',...C()},root:i});if(!R.success){let F=R.logs.filter((T)=>T.level==="error").map((T)=>T.message).join(", ")||`Unable to bundle ${p.basename(e)}`,z=tr(R.logs,e||void 0);if(console.warn("[stx:bundler] build failed:",F),nc(e||"",F,z),n.throwOnFailure||rc()==="error")throw Error(F);return t}let m="";for(let x of R.outputs){m=await x.text();break}let _=[];for(let x of m.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let F of x[1].split(",")){let z=F.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(z){_.push([z[2],z[1]]);continue}let T=F.trim();if(/^[A-Za-z_$][\w$]*$/.test(T))_.push([T,T])}if(n.expose){let x=new Set(n.expose);for(let F=_.length-1;F>=0;F--)if(!x.has(_[F][0]))_.splice(F,1)}let L=[];m=Tf(Ef(m,et),L);let dt=m.match(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm)||[];if(m=m.replace(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),l&&m)try{m=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(m)}catch{}let J=`__stxBundle_${o}`,ft=new Set(V(t,!0).split(",").map((x)=>x.trim())),mt=_.map(([x,F])=>`get ${JSON.stringify(x)}() { return ${F} }${ft.has(x)?`, set ${JSON.stringify(x)}(__stxValue_${F}) { ${F} = __stxValue_${F} }`:""}`).join(", "),gt=_.map(([x])=>`var ${x} = undefined;`).join(`
|
|
4
|
+
`),ht=_.map(([x])=>`${x} = ${J}[${JSON.stringify(x)}];`).join(`
|
|
5
5
|
`);if(m=`${dt.join(`
|
|
6
6
|
`)}
|
|
7
7
|
${gt}
|
|
8
|
-
var ${
|
|
8
|
+
var ${J} = (function() {
|
|
9
9
|
${L.join(`
|
|
10
10
|
`)}
|
|
11
11
|
${m}
|
|
@@ -13,8 +13,8 @@ return { ${mt} };
|
|
|
13
13
|
})();
|
|
14
14
|
${ht}
|
|
15
15
|
var __stxLiveBindings = typeof __stxLiveBindings === 'undefined' ? {} : __stxLiveBindings;
|
|
16
|
-
Object.keys(${
|
|
16
|
+
Object.keys(${J}).forEach(function(name) {
|
|
17
17
|
if (!Object.prototype.hasOwnProperty.call(__stxLiveBindings, name))
|
|
18
|
-
Object.defineProperty(__stxLiveBindings, name, Object.getOwnPropertyDescriptor(${
|
|
19
|
-
});`.trim(),A("bundled:",o,"output:",m.length,"bytes"),s.size>0&&_.length===0)return console.warn(`[stx:bundler] dropped every binding for ${p.basename(e)} (${o}); serving the unbundled source and not caching this result`),t;B.mkdirSync(d,{recursive:!0}),await Bun.write(b,m);let
|
|
20
|
-
export{
|
|
18
|
+
Object.defineProperty(__stxLiveBindings, name, Object.getOwnPropertyDescriptor(${J}, name));
|
|
19
|
+
});`.trim(),A("bundled:",o,"output:",m.length,"bytes"),s.size>0&&_.length===0)return console.warn(`[stx:bundler] dropped every binding for ${p.basename(e)} (${o}); serving the unbundled source and not caching this result`),t;B.mkdirSync(d,{recursive:!0}),await Bun.write(b,m);let W=br(tt);return await Bun.write(I,JSON.stringify({metadataVersion:at,files:W.map((x)=>bt(x.path,i)).filter((x)=>x!==null)})),Z(e,W.map((x)=>x.path)),n.collectInputs?.push(...W.map((x)=>x.path)),P.set(b,{code:m,files:W}),await jt(d),m}catch(R){let m=tr(R,e||void 0),_=Re(R,e||void 0);if(console.warn(`[stx:bundler] error: ${_}`),nc(e||"",_,m),n.throwOnFailure||rc()==="error")throw R;return t}finally{try{B.rmSync(y,{recursive:!0,force:!0})}catch{}}}function _t(t){let e=t.trim();if(!e)return null;let n=e.indexOf("=");if(n!==-1)e=e.slice(0,n).trim();let i=e.indexOf(":");if(i!==-1)e=e.slice(i+1).trim();if(e.startsWith("..."))e=e.slice(3).trim();return/^[A-Za-z_$][\w$]*$/.test(e)?e:null}
|
|
20
|
+
export{Sf,kf,ye,_f,nc,tn,nn,Eh,rc,rn,er,Cf,Ef,Tf,ss,sn,$f,on,sc,Th};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{T,u,f,
|
|
3
|
-
`)n++;return!0}if(t[n]==="/"&&t[n+1]==="*"){n+=2;while(n<g-1&&!(t[n]==="*"&&t[n+1]==="/"))n++;return n+=2,!0}return!1},rt=()=>{if(S!==0)return;let
|
|
2
|
+
import{T,u,f,P,d,K}from"./chunk-c9mdvpf5.js";import{V,Ps,Ne,pe,kr,Be,Fe,s,h,ke,_}from"./chunk-xj3my6b9.js";import{ct}from"./chunk-04z1xyrb.js";import{I}from"./chunk-8y8kgw9s.js";import{oe}from"./chunk-ekh3mxyp.js";import{B,Ze}from"./chunk-ybq56wam.js";import{E,Cn}from"./chunk-t59bc7na.js";import A 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"),n=S.exec(i);while(n){let g=n.index,e=g+n[0].length-1,D=1,U=e+1;while(U<i.length&&D>0){if(i[U]==="(")D++;else if(i[U]===")")D--;U++}if(D!==0)break;let rt=i.substring(e+1,U-1),j=`${c}(${rt})`;i=i.substring(0,g)+j+i.substring(U),S.lastIndex=g+j.length,n=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,n=0,g=t.length,e=(j)=>{n++;while(n<g){if(t[n]==="\\"){n+=2;continue}if(t[n]===j){n++;return}n++}},D=()=>{n++;while(n<g){if(t[n]==="\\"){n+=2;continue}if(t[n]==="`"){n++;return}if(t[n]==="$"&&t[n+1]==="{"){n+=2;let j=1;while(n<g&&j>0)if(t[n]==="{")j++,n++;else if(t[n]==="}")j--,n++;else if(t[n]==="'"||t[n]==='"')e(t[n]);else if(t[n]==="`")D();else n++;continue}n++}},U=()=>{if(t[n]==="/"&&t[n+1]==="/"){while(n<g&&t[n]!==`
|
|
3
|
+
`)n++;return!0}if(t[n]==="/"&&t[n+1]==="*"){n+=2;while(n<g-1&&!(t[n]==="*"&&t[n+1]==="/"))n++;return n+=2,!0}return!1},rt=()=>{if(S!==0)return;let j=t.slice(n).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(j){let Z=j[2];if(!i.has(Z))c.push(Z),i.add(Z);return}let et=t.slice(n).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(et){let Z=et[1];if(!i.has(Z))c.push(Z),i.add(Z);return}let Y=t.slice(n).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Y){let Z=Y[1];if(!i.has(Z))c.push(Z),i.add(Z)}};while(n<g){if(U())continue;if(t[n]==="'"||t[n]==='"'){e(t[n]);continue}if(t[n]==="`"){D();continue}if(t[n]==="{"){S++,n++;continue}if(t[n]==="}"){S--,n++;continue}if(S===0&&/[a-z]/i.test(t[n])&&(n===0||/\s|[;{}()]/.test(t[n-1])))rt();n++}return c.join(", ")}function Et(a,t=""){let c=mt(a).split(",").map((i)=>i.trim()).filter(Boolean);return`
|
|
4
4
|
(function() {
|
|
5
|
-
${
|
|
5
|
+
${ct("var",c)}
|
|
6
6
|
var __destroyHooks = [];
|
|
7
7
|
var __origOnDestroy = onDestroy;
|
|
8
8
|
onDestroy = function(fn) { __origOnDestroy(fn); __destroyHooks.push(fn); };
|
|
9
9
|
|
|
10
10
|
${a}
|
|
11
11
|
${t}})();
|
|
12
|
-
`}function vt(a,t){let i=mt(a).split(",").map((g)=>g.trim()).filter(Boolean),S=new Set(
|
|
12
|
+
`}function vt(a,t){let i=mt(a).split(",").map((g)=>g.trim()).filter(Boolean),S=new Set(V(a,!0).split(",").map((g)=>g.trim())),n=i.map((g)=>S.has(g)?` try { ${g}; Object.defineProperty(__scopeRegistration, ${JSON.stringify(g)}, ${Ps(g)}); } catch (e) { /* not actually top-level */ }`:` try { __scopeRegistration[${JSON.stringify(g)}] = ${g}; } 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 = {};
|
|
@@ -44,11 +44,11 @@ ${n}
|
|
|
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(
|
|
48
|
-
${y}`}if(dt&&!X){L=!0,
|
|
49
|
-
`;continue}if(X)try{let{extractVariables:F}=await import("./chunk-
|
|
50
|
-
`}}if(z.length>0){let{interpolateScriptExpressions:v}=await import("./chunk-
|
|
51
|
-
`+
|
|
52
|
-
`+
|
|
47
|
+
})();`;return c+a+i}function It(a,t){if(B(a)){let S=B(a).tag.match(/data-stx-scope="([^"]*)"/);if(S)return{html:a,mergedIntoExisting:S[1],stamped:!0,root:"body"};return{html:Ze(a,(n,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),n=i.match(/data-stx-scope="([^"]*)"/);if(n)return{html:a,mergedIntoExisting:n[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=A.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 Ih(){lt.clear(),pt.clear()}var Tt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Nf(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,n=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,g;while((g=n.exec(c))!==null){let e=g[1]==="/",D=g[2],U=g[3]==="/"||Tt.has(D.toLowerCase());if(e){S=Math.max(0,S-1);continue}if(S===0)i.push(D);if(!U)S++}return i}function ft(a){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(a)}var Ye=new T(500),cc=new Set;function Oh(){cc.clear()}function Ct(a){if(a.__onceStore instanceof Set)return a.__onceStore;return cc}async function is(a,t,c,i,S,n=new Set){let g=i.partialsDir||A.join(A.dirname(c),"partials");if(g&&!A.isAbsolute(g))g=A.resolve(process.cwd(),g);let e=yt(a,"@partial","@include"),D=Ct(t);e=e.replace(/@once([\s\S]*?)@endonce/g,(m,k,x)=>{let p=k.trim(),r=`${c}:${p}`;if(D.has(r))return"";return D.add(r),k});{let m=/@includeIf\s*\(/g,k;while((k=m.exec(e))!==null){let x=k.index,p=x+k[0].length-1,r=1,w=p+1;while(w<e.length&&r>0){if(e[w]==="(")r++;else if(e[w]===")")r--;w++}if(r!==0)break;let l=e.substring(p+1,w-1),o=l.match(/^\s*['"]([^'"]+)['"]/);if(!o){m.lastIndex=w;continue}let O=o[1],W=U(O,g,c),R="";if(W&&await Bun.file(W).exists())S.add(W),R=`@include(${l})`;e=e.substring(0,x)+R+e.substring(w),m.lastIndex=0}}for(let[m,k]of[["@includeWhen",!1],["@includeUnless",!0]]){let x=new RegExp(`${m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),p;while((p=x.exec(e))!==null){let r=p.index,w=r+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),W=at(O,0);if(W===-1){x.lastIndex=o;continue}let R=O.substring(0,W).trim(),H=O.substring(W+1).trim(),z=H.match(/^\s*['"]([^'"]+)['"]/);if(!z){x.lastIndex=o;continue}let b=z[1],J=H.substring(z[0].length),N,M=at(J,0);if(M!==-1)N=J.substring(M+1).trim();try{let C=`Boolean(${R})`,L;if(f(C)){let it=d(C,Object.keys(t));L=Boolean(it(...Object.values(t)))}else L=Boolean(u(C,t));let tt=k?!L:L,nt="";if(tt){let it=U(b,g,c);if(it&&await Bun.file(it).exists())S.add(it);nt=`@include('${b}'${N?`, ${N}`:""})`}e=e.substring(0,r)+nt+e.substring(o),x.lastIndex=0}catch(C){let L=C instanceof Error?C.message:String(C),tt=h("Include",`Error evaluating ${m} condition: ${L}`,c,a,r);e=e.substring(0,r)+tt+e.substring(o),x.lastIndex=0}}}{let m=/@each\s*\(/g,k;while((k=m.exec(e))!==null){let x=k.index,p=x+k[0].length-1,r=1,w=p+1;while(w<e.length&&r>0){if(e[w]==="(")r++;else if(e[w]===")"){if(r--,r===0)break}w++}if(r!==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[,W,R,H,z]=O;try{let b,J=R.trim();if(f(J))b=d(J,Object.keys(t))(...Object.values(t));else b=u(J,t);let N="";if(Array.isArray(b)&&b.length>0)for(let M of b){let C={...t,[H]:M},L=await et(W,C,a,x);N+=L}else if(z)N=await et(z,{},a,x);e=e.substring(0,x)+N+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,k;while((k=m.exec(e))!==null){let x=k.index,p=x+k[0].length-1,r=1,w=p+1;while(w<e.length&&r>0){if(e[w]==="(")r++;else if(e[w]===")"){if(r--,r===0)break}w++}if(r!==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 W=O[1],R=l.slice(O[0].length),H,z=R.match(/^\s*,\s*\{/);if(z){R=R.slice(z[0].length-1);let N=1,M=1;while(M<R.length&&N>0){if(R[M]==="{")N++;else if(R[M]==="}"){if(N--,N===0)break}M++}H=R.substring(0,M+1),R=R.slice(M+1)}let b,J=R.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(J)b=J[1];try{let N=JSON.parse(W.replace(/'/g,'"')),M={};if(H)try{M=P(H,t)}catch(L){let tt=L instanceof Error?L.message:String(L);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 C=!1;for(let L of N){let tt=U(L,g,c);if(!tt)continue;if(await s(tt)){let nt=await et(L,M,a,x);e=e.replace(o,()=>nt),C=!0;break}}if(!C)if(b!==void 0)e=e.replace(o,()=>b);else if(i.debug){let L=h("Include",`None of the includeFirst paths exist: ${W}`,c,a,x,o);e=e.replace(o,()=>L)}else e=e.replace(o,"")}catch(N){let M=N instanceof Error?N.message:String(N),C=h("Include",`Error processing @includeFirst: ${M}`,c,a,x,o);e=e.replace(o,()=>C)}m.lastIndex=0}}function U(m,k,x){try{let p=m;if(!m.endsWith(".stx"))p=`${m}.stx`;let r=A.resolve(k),w=A.resolve(A.dirname(x)),l;if(!p.startsWith("./")&&!p.startsWith("../")){for(let z of i._layerPartialDirs??[]){let b=A.resolve(z,p);if(b.startsWith(`${A.resolve(z)}${A.sep}`)&&St(b))return b}l=A.resolve(k,p)}else l=A.resolve(w,p);let o=A.normalize(l),O=o.startsWith(r+A.sep)||o===r,W=o.startsWith(w+A.sep)||o===w,R=!1,H=A.dirname(w);if(o.startsWith(H+A.sep)){if(!A.relative(H,o).split(A.sep).some((N)=>N.startsWith(".")&&N!=="."&&N!==".."))R=!0}if(!O&&!W&&!R)return console.error(`Security: Path traversal attempt blocked for include path: ${m}`),console.error(` Resolved to: ${o}`),console.error(` Allowed dirs: ${r}, ${w}`),null;return o}catch(p){return console.error(`Error resolving path ${m}: ${p}`),null}}let rt=A.resolve(c);n.add(rt);function j(m,k,x,p){return i.onIncludeError?.({includePath:m,templatePath:c,message:k,partialsDir:g}),h("Include",k,c,x,p)}async function et(m,k={},x,p){let r=U(m,g,c);if(!r)return j(m,`Could not resolve path for include: ${m}`,x,p);let w=A.resolve(r);if(n.has(w)){let l=[...n,w].map((o)=>A.basename(o)).join(" -> ");return j(m,`Circular include detected: ${l}`,x,p)}try{S.add(r);let l;if(!l)try{l=await Bun.file(r).text()}catch(v){let q=v instanceof Error?v.message:String(v);return j(m,`Error loading include file ${m}: ${q}`,x,p)}if(l)l=l.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(l&&l.includes("@stream")){let{processStreamDirectives:v}=await import("./chunk-3zfras5s.js");l=v(l,t)}if(l&&(i.debug||!E()&&!Cn()))try{let{warnUnbalancedTags:v}=await import("./chunk-kgn911k7.js");v(l,r)}catch{}try{let{processESImports:v}=await import("./chunk-s6399qe7.js");l=await v(l,t,r,i,S)}catch(v){if(i.debug)console.warn(`[stx] partial ES import extraction skipped for ${r}:`,v instanceof Error?v.message:v)}let o=l,O=pe(o);if(O)o=O.content.trim();let R=l.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),H="";if(R)H=`<style${R[1]}>${R[2]}</style>`;let z=[];o=o.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(v,q,y)=>{if(!ft(q))return"";return z.push({attrs:q,body:y}),`__STX_DATA_BLOCK_${z.length-1}__`}),o=o.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let b={...t};b.__stx_signals_gate=ke(l,r);for(let[v,q]of Object.entries(k))b[v]=q;let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,N=[...l.matchAll(J)].sort((v,q)=>{let y=(v[1]||"").includes("server"),X=(q[1]||"").includes("server");return Number(X)-Number(y)}),M="",C=null,L=!1,tt=!1;for(let v of N){let q=v[1]||"",y=v[2]||"";if(ft(q))continue;let X=q.includes("server"),wt=Be(q);if(!X&&!/\bsrc\s*=/i.test(q))Ne(y,r,i.strict);if(!X&&y.trim()){let{interpolateScriptExpressions:F}=await import("./chunk-7amk61bt.js");y=F(y,b,m)}let ot="";try{let{extractAndStripCssImports:F,renderVendorStyleTags:Q}=await import("./chunk-c7ybxv8x.js"),st=F(y,{filePath:r,projectRoot:process.cwd()});y=st.code,ot=Q(st.styles)}catch(F){if(i.debug)console.warn(`[stx] vendor-css extractor skipped for ${r}:`,F instanceof Error?F.message:F)}if(wt&&y.trim())y=Fe(y);if(!X){try{let{injectBrowserCoreAutoImports:Q}=await import("./chunk-c7ybxv8x.js");y=Q(y).code;let{hasUserImports:st,bundleClientScript:bt}=await import("./chunk-a7ewznxk.js");if(st(y))y=await bt(y,r,{projectRoot:process.cwd()})}catch(Q){if(i.debug)console.warn(`[stx] bundler skipped for ${r}:`,Q instanceof Error?Q.message:Q)}let{stripStxRuntimeImports:F}=await import("./chunk-w9gpscjf.js");y=F(y)}let dt=$t(y);if(!X){let{extractBridgeData:F,generateServerDataBridge:Q}=await import("./chunk-c7ybxv8x.js"),st=Q(y,F(b));if(st)y=`${st}
|
|
48
|
+
${y}`}if(dt&&!X){L=!0,C=ut(r,t);let F=I(y),Q=gt(F,C);M+=`${ot}<script data-stx-scoped data-stx-run="always" data-stx-owner="${C}">${Q}</script>
|
|
49
|
+
`;continue}if(X)try{let{extractVariables:F}=await import("./chunk-bh7v78je.js");await F(y,b,r)}catch(F){if(i.debug)console.warn(`Warning: Could not extract variables from server script in ${r}:`,F)}if(!X&&!dt){let F=q.replace(/\bclient\b/i,"").trim();C=ut(r,t);let Q=I(y),st=gt(Q,C);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=|Object\.defineProperty\(__scopeRegistration, "(?!__stx)/.test(st))tt=!0;M+=`${ot}<script data-stx-scoped data-stx-run="always" data-stx-owner="${C}"${F?` ${F}`:""}>${st}</script>
|
|
50
|
+
`}}if(z.length>0){let{interpolateScriptExpressions:v}=await import("./chunk-7amk61bt.js");o=o.replace(/__STX_DATA_BLOCK_(\d+)__/g,(q,y)=>{let X=z[Number(y)];return`<script${X.attrs}>${v(X.body,b,m)}</script>`})}if(C){let v=It(o,C);if(o=v.html,v.mergedIntoExisting){let y=C,X=v.mergedIntoExisting;M=M.split(`'${y}'`).join(`'${X}'`).split(`"${y}"`).join(`"${X}"`),C=X}else if(!v.stamped&&L&&!lt.has(r))lt.add(r),console.warn(`[stx] ${A.relative(process.cwd(),r)} 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"&&(L||tt)&&!pt.has(r)){let y=Nf(o);if(y.length>1)pt.add(r),console.warn(`[stx] ${A.relative(process.cwd(),r)} declares ${L?"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 q=v.stamped&&v.root!==null&&kr(v.root);M=Rt(M,q?C:null)}if(o.includes("@include")||o.includes("@partial"))o=await is(o,b,r,i,S,n);let{processLoops:nt,reportDeferredLoopWarnings:it}=await import("./chunk-x742wppj.js"),G=nt(o,b,r,void 0,!0);G=oe(G,b,r),G=it(G);let{processMetaDirectives:ht,processSeoDirective:xt,processStructuredData:_t}=await import("./chunk-42c92rp3.js");if(G=ht(G,b,r,i),G=_t(G,b,r),G=xt(G,b,r,i),G=_(G,b,r),H)G+=`
|
|
51
|
+
`+H;if(M)G+=`
|
|
52
|
+
`+M;return G}catch(l){if(l instanceof K)throw l;let o=l instanceof Error?l.message:String(l);return j(m,`Error processing include ${m}: ${o}`,x,p)}}let Y=/@include\s*\(/g,Z;while((Z=Y.exec(e))!==null){let m=Z.index,k=m+Z[0].length-1,x=1,p=k+1;while(p<e.length&&x>0){if(e[p]==="(")x++;else if(e[p]===")")x--;p++}if(x!==0)break;let r=e.substring(m,p),w=e.substring(k+1,p-1),l=w.match(/^\s*['"]([^'"]+)['"]/);if(!l){Y.lastIndex=p;continue}let o=l[1],O,W=w.substring(l[0].length),R=at(W,0);if(R!==-1)O=W.substring(R+1).trim();let H={};if(O)try{H=P(O,t)}catch(b){let J=b instanceof Error?b.message:String(b);e=e.replace(r,h("Include",`Error parsing include variables for ${o}: ${J}`,c,a,m)),Y.lastIndex=0;continue}let z=await et(o,H,a,m);e=e.substring(0,m)+z+e.substring(p),Y.lastIndex=0}return e}function as(a,t){let c=a;function i(S,n,g,e){let D=S,U=!0;while(U){U=!1;let rt=new RegExp(`@${n}\\(['"]([^'"]+)['"]\\)`),j=D.match(rt);if(!j||j.index===void 0)break;let et=j.index,Y=j[1],Z=et+j[0].length,m=new RegExp(`@${n}\\(`),k=new RegExp(`@${g}(?![a-z])`),x=1,p=Z,r=-1;while(x>0&&p<D.length){let l=D.slice(p),o=l.match(m),O=l.match(k),W=o?p+o.index:1/0,R=O?p+O.index:1/0;if(W<R)x++,p=W+(o[0].length||1);else if(R<1/0){if(x--,x===0){r=R;break}p=R+g.length+1}else break}if(r===-1)break;let w=D.slice(Z,r);if(!t[Y])t[Y]=[];if(e)t[Y].unshift(w);else t[Y].push(w);D=D.substring(0,et)+D.substring(r+`@${g}`.length),U=!0}return D}return c=i(c,"push","endpush",!1),c=i(c,"prepend","endprepend",!0),c}function cs(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{Ih,Nf,Ye,cc,Oh,is,as,cs};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Mi,Di,Li,Ng,Mg,Dg,Cl,Lg,jg}from"./chunk-gcf97wgx.js";export{Mi as ImageProcessorCache,Cl as applyTransformations,Ng as clearImageCache,Lg as generateResponsiveVariants,jg as generateSrcset,Di as getCachedImageResult,Dg as optimizeImage,Mg as processImage,Li as setCachedImageResult};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{r}from"./chunk-
|
|
2
|
+
import{r}from"./chunk-fwktw49p.js";function y(e,n,i=240){return e.slice(n,n+i)}var v=[{rule:"route-params",pattern:/\blocation\s*\.\s*pathname\s*\.\s*(?:match|split)\s*\(/g,primitive:"useRoute() / useRouteParams() / useRouteParam(name)",why:"parsing the URL by hand re-implements the router and does not update on SPA navigation"},{rule:"alert",pattern:/(?<![.#\w$])(?:(?:window|globalThis)\s*\.\s*)?alert\s*\(/g,primitive:"stxAlert(message)",why:"themed, focus-trapped and non-blocking \u2014 but `await` it if the code after it "+"depended on the native dialog blocking until dismissal",reject:(e)=>/\b(?:async\s+)?function\s+alert\s*\(/.test(e)||/\b(?:const|let|var)\s+alert\s*=/.test(e)},{rule:"search-params",pattern:/new\s+URLSearchParams\s*\(/g,primitive:"useSearchParams()",why:"reactive, and writes back through the router instead of history.replaceState",reject:(e,n)=>{let i=e.indexOf("(",n);if(i===-1)return!0;let o=e.slice(i+1,e.indexOf(")",i)+1);return!/\b(?:location|search|href|url)\b/i.test(o)}},{rule:"navigate",pattern:/\blocation\s*\.\s*(?:assign|replace)\s*\(|\blocation\s*\.\s*href\s*=/g,primitive:"navigate(path) / goBack()",why:"a full document load throws away every store and the scroll position; navigate() is an SPA transition",reject:(e,n)=>/^[^\n]*?(?:['"`]\s*)?(?:mailto:|tel:|sms:|https?:\/\/|\/\/)/.test(y(e,n,160))},{rule:"fetch",pattern:/new\s+AbortController\s*\(/g,primitive:"useFetch(url) / useAsyncData(key, fn)",why:"cancellation, loading and error state are already wired; hand-rolling them is where the races live"},{rule:"polling",pattern:/setInterval\s*\(/g,primitive:"useEventSource() / useSSE() / useWebSocket() / useChannel()",why:"polling burns requests and lags; the push primitives are delivered",reject:(e,n)=>!/\bfetch\s*\(|\$fetch\b|useFetch\b|\.get\s*\(|axios\b/.test(y(e,n))},{rule:"debounce",pattern:/\bclearTimeout\s*\(/g,primitive:"useDebounce(fn, ms) / useThrottle(fn, ms)",why:"a hand-held timer handle per call site is the usual source of stale-result bugs",requires:(e)=>/setTimeout\s*\(/.test(e)},{rule:"click-outside",pattern:/document\s*\.\s*addEventListener\s*\(\s*['"](?:click|mousedown|pointerdown)['"]/g,primitive:"useClickOutside(ref, fn)",why:"the document-level listener plus the blur race is exactly what this composable exists to remove"},{rule:"focus",pattern:/\.\s*(?:getElementById|querySelector)\s*\([^)]*\)\s*(?:\?\.)?\s*\.?focus\s*\(/g,primitive:"useFocus(ref) with x-ref",why:"a query by id breaks under nested scopes and SPA navigation; a ref does not"},{rule:"clipboard",pattern:/navigator\s*\.\s*(?:clipboard|share)\b/g,primitive:"useClipboard() / useShare()",why:"permission state, the copied flag and the unsupported-browser fallback are already handled"},{rule:"watch",pattern:/\beffect\s*\(\s*\(\s*\)\s*=>\s*\{[^}]*\bvoid\s+\w+\s*\(\s*\)/g,primitive:"watch(source, cb) / watchMultiple([...], cb)",why:"the `void a(); void b()` dance is a manual dependency list; watch takes one directly"}],C=["confirm","tooltip",...v.map((e)=>e.rule)];function g(e,n){let i=1;for(let o=0;o<n;o++)if(e[o]===`
|
|
3
3
|
`)i++;return i}function b(e,n){let i=e.lastIndexOf(`
|
|
4
4
|
`,n)+1,o=e.indexOf(`
|
|
5
5
|
`,n);return e.slice(i,o===-1?e.length:o).trim().slice(0,120)}function S(e,n){let i=e.slice(0,n),o=i.lastIndexOf("function"),l=i.lastIndexOf("=>"),s=Math.max(o,l);if(s===-1)return!1;let t=e.slice(Math.max(0,s-120),s);return/\basync\b[^;{}]*$/.test(t)}function k(e){return/\b(?:async\s+)?function\s+confirm\s*\(/.test(e)||/\b(?:const|let|var)\s+confirm\s*=/.test(e)||/\bimport\s*\{[^}]*\bconfirm\b[^}]*\}/.test(e)}function A(e,n,i){if(k(e))return e;let o=/(^|[^\w$.])(?:(?:window|globalThis)\s*\.\s*)?confirm\s*\(/g,l=m(e),s="",t=0,a;while((a=o.exec(l))!==null){let c=a.index+a[1].length,u=g(e,c),d=b(e,c);if(/stxConfirm\s*\($/.test(e.slice(0,c+8)))continue;let p=S(e,c);if(i.push({file:n,line:u,rule:"confirm",applied:p,snippet:d,reason:p?void 0:"stxConfirm() returns a Promise and native confirm() is synchronous, so this needs `await` inside an async function. Rewriting it here would make the condition always true."}),p)s+=e.slice(t,c)+"await stxConfirm(",t=c+(a[0].length-a[1].length)}return s+e.slice(t)}function E(e,n,i){let o=/(<[a-z][\w-]*\b[^>]*?)\stitle=(["'])(.*?)\2/gis,l=R(e),s="",t=0,a;while((a=o.exec(l))!==null){let[c,u,d,p]=a,h=g(e,a.index),f=b(e,a.index),w=u.match(/^<([A-Za-z][\w-]*)/)?.[1]??"";if(/^[A-Z]/.test(w)){i.push({file:n,line:h,rule:"tooltip",applied:!1,snippet:f,reason:`\`title\` on <${w}> is a component prop, not an HTML attribute \u2014 `+"adding x-tooltip here would put a tooltip on a component and may duplicate text it already renders."});continue}if(/\bx-tooltip[=\s]/.test(u)||p.trim()===""){i.push({file:n,line:h,rule:"tooltip",applied:!1,snippet:f,reason:/\bx-tooltip[=\s]/.test(u)?"already has x-tooltip":"empty title"});continue}i.push({file:n,line:h,rule:"tooltip",applied:!0,snippet:f}),s+=e.slice(t,a.index)+`${u} x-tooltip=${d}${p}${d} title=${d}${p}${d}`,t=a.index+c.length}return s+e.slice(t)}function R(e){return e.replace(/<!--[\s\S]*?-->/g,(n)=>n.replace(/[^\n]/g," ")).replace(/\{\{--[\s\S]*?--\}\}/g,(n)=>n.replace(/[^\n]/g," "))}function F(e){let n=(i)=>i.replace(/[^\n]/g," ");return e.replace(/\/\*[\s\S]*?\*\//g,n).replace(/\/\/[^\n]*/g,n)}function m(e,n=!1){let i=R(e);return(n?F(i):r(i)).replace(/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi,(l,s)=>/\bclient\b/i.test(s)?l:l.replace(/[^\n]/g," "))}function O(e,n,i,o){let l=m(e),s=m(e,!0);for(let t of v){if(!i.includes(t.rule))continue;if(t.requires&&!t.requires(e))continue;t.pattern.lastIndex=0;let a,c=/['"]/.test(t.pattern.source)?s:l;t.pattern.lastIndex=0;while((a=t.pattern.exec(c))!==null){if(t.reject?.(e,a.index))continue;o.push({file:n,line:g(e,a.index),rule:t.rule,applied:!1,snippet:b(e,a.index),reason:`${t.primitive} \u2014 ${t.why}`})}}}function q(e,n={}){let i=n.rules??C,o=n.file??"<source>",l=[];O(e,o,i,l);let s=e;if(i.includes("confirm"))s=A(s,o,l);if(i.includes("tooltip"))s=E(s,o,l);l.sort((c,u)=>c.line-u.line);let t=new Set,a=l.filter((c)=>{let u=`${c.rule}:${c.line}`;if(t.has(u))return!1;return t.add(u),!0});return{code:s,findings:a}}var x=new Set(["confirm","tooltip"]);function I(e,n){if(e.length===0)return"No hand-rolled equivalents found.";let i=e.filter((t)=>t.applied),o=e.filter((t)=>!t.applied&&x.has(t.rule)),l=e.filter((t)=>!t.applied&&!x.has(t.rule)),s=[];if(i.length>0){s.push(n?`Rewrote ${i.length} site(s):`:`Would rewrite ${i.length} site(s) (pass --fix):`);for(let t of i)s.push(` ${t.file}:${t.line} [${t.rule}] ${t.snippet}`)}if(o.length>0){s.push("",`Needs a human \u2014 ${o.length} site(s):`);for(let t of o)s.push(` ${t.file}:${t.line} [${t.rule}] ${t.snippet}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{om}from"./chunk-48z7tg83.js";import"./chunk-ret52ds0.js";import"./chunk-d9s37xm5.js";import"./chunk-543yvntm.js";import"./chunk-qn06sy9j.js";import"./chunk-4d8ep00w.js";import"./chunk-717qsbap.js";import"./chunk-tzhs7drk.js";import"./chunk-c84pxd2k.js";import"./chunk-bwnwv91e.js";import"./chunk-fevyb337.js";import"./chunk-e8a6s6xs.js";import"./chunk-ekh3mxyp.js";import"./chunk-qz82cpyv.js";import"./chunk-5phdmpa7.js";import"./chunk-qadce16v.js";import"./chunk-mfebs2s2.js";import"./chunk-ng5revck.js";import"./chunk-y6nz6bk2.js";import"./chunk-cv1zc9dg.js";import"./chunk-7p8m82pj.js";import"./chunk-rkdsgfhd.js";import"./chunk-mxvevxb8.js";import"./chunk-xj3my6b9.js";import"./chunk-yv1vw0kx.js";import"./chunk-2qngyyaz.js";import"./chunk-c9mdvpf5.js";import"./chunk-8y8kgw9s.js";import"./chunk-04z1xyrb.js";export{om as buildForProduction};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import s from"path";var h=new Set([".jpg",".jpeg",".png",".gif"]),d=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}];async function
|
|
3
|
-
export{
|
|
2
|
+
import s from"path";var h=new Set([".jpg",".jpeg",".png",".gif"]),d=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}];async function Kl(e,r){let a=r.formats??d;if(!r.publicDir)return e;let i=y(e),o=[],m=/<img\b[^>]*?>/gi,c=[],u;while((u=m.exec(e))!==null){let t=u[0],n=t.match(/\bsrc=["']([^"']+)["']/i);if(!n)continue;if(A(u.index,i))continue;c.push({idx:u.index,length:t.length,src:n[1],raw:t})}if(c.length===0)return e;let f=await Promise.all(c.map(async(t)=>{let n=await S(t.src,r.publicDir,a);return{match:t,sources:n}}));for(let{match:t,sources:n}of f){if(n.length===0)continue;let x=`<picture>${n.map((p)=>`<source type="${p.mime}" srcset="${P(p.url)}">`).join("")}${t.raw}</picture>`;o.push({start:t.idx,end:t.idx+t.length,replacement:x})}if(o.length===0)return e;let l="",g=0;for(let t of o)l+=e.slice(g,t.start),l+=t.replacement,g=t.end;return l+=e.slice(g),l}async function S(e,r,a){if(!w(e))return[];let i=s.extname(e).toLowerCase();if(!h.has(i))return[];if(!e.startsWith("/"))return[];let o=s.join(r,e.slice(1)),m=s.dirname(o),c=s.basename(o,i),u=s.resolve(m),f=s.resolve(r);if(!u.startsWith(f))return[];let l=s.posix.dirname(e),g=a.map(async(n)=>{let b=s.join(m,`${c}${n.ext}`);if(!await Bun.file(b).exists())return null;return{url:s.posix.join(l,`${c}${n.ext}`),mime:n.mime}});return(await Promise.all(g)).filter((n)=>n!==null)}function w(e){if(!e)return!1;if(e.startsWith("http://")||e.startsWith("https://"))return!1;if(e.startsWith("//"))return!1;if(e.startsWith("data:"))return!1;return!0}function y(e){let r=[],a=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,i;while((i=a.exec(e))!==null)r.push([i.index,i.index+i[0].length]);return r}function A(e,r){for(let[a,i]of r)if(e>=a&&e<i)return!0;return!1}function P(e){return e.replace(/&/g,"&").replace(/"/g,""")}
|
|
3
|
+
export{Kl};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Dh,ps,Uo,gs,ir,Wo,qo,jf,ms,hs,ys,Ko,uc,Bf,vt}from"./chunk-qz82cpyv.js";import"./chunk-5phdmpa7.js";import"./chunk-qadce16v.js";import"./chunk-ng5revck.js";import"./chunk-y6nz6bk2.js";import"./chunk-cv1zc9dg.js";import"./chunk-7p8m82pj.js";import"./chunk-rkdsgfhd.js";import"./chunk-mxvevxb8.js";import{V}from"./chunk-xj3my6b9.js";import"./chunk-yv1vw0kx.js";import"./chunk-2qngyyaz.js";import"./chunk-c9mdvpf5.js";import"./chunk-8y8kgw9s.js";import"./chunk-04z1xyrb.js";export{jf as bindLoopInterpolations,Dh as clearScriptScanCache,ms as convertServerLoopAttributesToDirectives,Wo as convertSignalDirectivesToAttributes,hs as convertSignalLoopsToAttributes,ir as extractClientSignalNames,V as extractExports,uc as findMarkupIndexOutsideScripts,gs as hasSignalsSyntax,Uo as parseLoopExpression,qo as preEvalLiteralReactiveIfs,ys as processScriptSetup,Ko as processSignals,Bf as rewriteStxImportSpecifiers,ps as scanScriptTags,vt as stripStxRuntimeImports};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function c(i){if(!i.startsWith("/")||/[?#\\]/.test(i))throw Error(`Invalid route rule pattern: ${i}`);let t=i==="/"?[]:i.slice(1).split("/");if(t.some((r,e)=>!r||r.includes("*")&&r!=="*"&&r!=="**"||r==="**"&&e!==t.length-1||r.startsWith(":")&&!/^:[\w]+$/.test(r)))throw Error(`Unsupported route rule pattern: ${i}`);return t}function yo(i){for(let[t,r]of Object.entries(i)){if(c(t),!r||typeof r!=="object"||Object.keys(r).some((e)=>e!=="rendering"&&e!=="cache"))throw Error(`Unsupported route rule for ${t}`);if(r.rendering!==void 0&&r.rendering!=="prerender"&&r.rendering!=="dynamic")throw Error(`Unsupported rendering mode for ${t}`);if(r.cache!==void 0&&r.cache!==!1){let e=r.cache;if(!e||e.public!==!0||Object.keys(e).some((n)=>!["public","maxAge","swr"].includes(n))||!Number.isFinite(e.maxAge)||e.maxAge<=0||e.swr!==void 0&&(!Number.isFinite(e.swr)||e.swr<0))throw Error(`Route cache for ${t} requires public: true, maxAge > 0 and swr >= 0`);if(r.rendering==="prerender")throw Error(`Prerendered route ${t} cannot revalidate; use dynamic rendering with cache`)}}}function
|
|
3
|
-
export{yo,
|
|
2
|
+
function c(i){if(!i.startsWith("/")||/[?#\\]/.test(i))throw Error(`Invalid route rule pattern: ${i}`);let t=i==="/"?[]:i.slice(1).split("/");if(t.some((r,e)=>!r||r.includes("*")&&r!=="*"&&r!=="**"||r==="**"&&e!==t.length-1||r.startsWith(":")&&!/^:[\w]+$/.test(r)))throw Error(`Unsupported route rule pattern: ${i}`);return t}function yo(i){for(let[t,r]of Object.entries(i)){if(c(t),!r||typeof r!=="object"||Object.keys(r).some((e)=>e!=="rendering"&&e!=="cache"))throw Error(`Unsupported route rule for ${t}`);if(r.rendering!==void 0&&r.rendering!=="prerender"&&r.rendering!=="dynamic")throw Error(`Unsupported rendering mode for ${t}`);if(r.cache!==void 0&&r.cache!==!1){let e=r.cache;if(!e||e.public!==!0||Object.keys(e).some((n)=>!["public","maxAge","swr"].includes(n))||!Number.isFinite(e.maxAge)||e.maxAge<=0||e.swr!==void 0&&(!Number.isFinite(e.swr)||e.swr<0))throw Error(`Route cache for ${t} requires public: true, maxAge > 0 and swr >= 0`);if(r.rendering==="prerender")throw Error(`Prerendered route ${t} cannot revalidate; use dynamic rendering with cache`)}}}function Nn(i={}){yo(i);let t=(e)=>e==="**"?0:e==="*"?1:e.startsWith(":")?2:3,r=Object.entries(i).map(([e,n])=>({pattern:e,parts:c(e),rule:n}));return r.sort((e,n)=>{for(let o=0;o<Math.max(e.parts.length,n.parts.length);o++){let s=(n.parts[o]===void 0?4:t(n.parts[o]))-(e.parts[o]===void 0?4:t(e.parts[o]));if(s)return s}return e.pattern.localeCompare(n.pattern)}),(e)=>{let n=e==="/"?[]:e.replace(/\/$/,"").slice(1).split("/");return r.find(({parts:o})=>o.every((s,u)=>s==="**"||n[u]!==void 0&&(s==="*"||s.startsWith(":")||s===n[u]))&&(o.at(-1)==="**"||o.length===n.length))?.rule??{}}}
|
|
3
|
+
export{yo,Nn};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ji,Bi,Fi,Bg,zi,Hi,Fg,Vi,Ui,El,zg}from"./chunk-xn9jg1q5.js";export{ji as VideoProcessorCache,El as analyzeVideo,Bg as clearVideoCache,Ui as generateDASHManifest,Vi as generateHLSManifest,zi as generatePoster,Fg as generateSpriteSheet,Hi as generateThumbnails,Bi as getCachedVideoResult,zg as processVideo,Fi as setCachedVideoResult};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var f=null,D=[],v=0,g=new Set;function x(){return f}function S(e){let n=f;return D.push(e),f=e,n}function h(e){D.pop(),f=e}var A=new WeakMap;function w(e,n){A.set(e,n)}function p(e,n){for(let r of e){let i=A.get(r);if(i)i(n);else n.add(r)}}function b(e){if(v>0){p(e,g);return}let n=new Set;p(e,n);for(let r of n)r()}function C(e){v++;try{e()}finally{if(v--,v===0){let n=[...g];g.clear();for(let r of n)r()}}}function m(e){let n=f;f=null;try{return e()}finally{f=n}}var k=[],T=[];function
|
|
3
|
-
export{
|
|
2
|
+
var f=null,D=[],v=0,g=new Set;function x(){return f}function S(e){let n=f;return D.push(e),f=e,n}function h(e){D.pop(),f=e}var A=new WeakMap;function w(e,n){A.set(e,n)}function p(e,n){for(let r of e){let i=A.get(r);if(i)i(n);else n.add(r)}}function b(e){if(v>0){p(e,g);return}let n=new Set;p(e,n);for(let r of n)r()}function C(e){v++;try{e()}finally{if(v--,v===0){let n=[...g];g.clear();for(let r of n)r()}}}function m(e){let n=f;f=null;try{return e()}finally{f=n}}var k=[],T=[];function ue(e){let n=e,r=new Set,i=new Set,o=()=>{let t=x();if(t)i.add(t);return n};return o.set=(t)=>{if(!Object.is(t,n)){let c=n;n=t,r.forEach((u)=>{try{u(n,c)}catch(l){console.error("[stx] subscriber error:",l)}}),b(i)}},o.update=(t)=>{o.set(t(n))},o.subscribe=(t)=>(r.add(t),()=>r.delete(t)),Object.defineProperty(o,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(o,"value",{get:()=>o(),set:(t)=>o.set(t),configurable:!0}),o}function Un(e,n={}){let r,i=!0,o=!1,t=new Set,c=typeof n.equals==="function"?n.equals:null,u=()=>{let s=S(d);try{r=e(),o=!0}finally{h(s)}i=!1},l=()=>{let s=r,y=o;try{u()}catch{return i=!0,!0}return!y||!c(s,r)},d=()=>{if(i)return;if(c&&t.size){if(l())b(t);return}i=!0,b(t)};w(d,(s)=>{if(i)return;if(c&&t.size){if(l())p(t,s);return}i=!0,p(t,s)});let a=()=>{let s=x();if(s)t.add(s);if(i)u();return r};return Object.defineProperty(a,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(a,"value",{get:()=>a(),configurable:!0}),a}function mh(e,n=Object.is){return Un(e,{equals:n})}function Wn(e,n={}){let r,i=!1,o=()=>{if(i)return;if(r){let c=r;r=void 0;try{c()}catch(u){console.error("[stx] effect cleanup error:",u)}}let t=S(o);try{let c=e();r=typeof c==="function"?c:void 0}catch(c){i=!0,console.error("[stx] effect error (the effect is disposed):",c)}finally{h(t)}};if(n.immediate!==!1)o();return()=>{if(i=!0,r){let t=r;r=void 0,t()}}}function vo(e){C(e)}function Gr(e){k.push(e)}function Jr(e){T.push(e)}function hh(){O(k,"onMount",T)}function yh(){O(T,"onDestroy")}function O(e,n,r){let i=e.splice(0,e.length);for(let o of i)try{let t=o();if(r&&typeof t==="function")r.push(t)}catch(t){console.error(`[stx] ${n} callback threw:`,t)}}function bh(){return{mount:k.length,destroy:T.length}}function qn(e){return typeof e==="function"&&e._isSignal===!0}function Kn(e){return typeof e==="function"&&e._isDerived===!0}function xo(e){if(qn(e)||Kn(e))return m(()=>e());return e}function Yr(e){return m(e)}function wh(e,n){let r=typeof e==="function"?e:()=>e,i=ue([]),o=Un(()=>i().reduce((u,l)=>n(u,l.action),r())),t=!1;return Wn(()=>{if(r(),!t){t=!0;return}if(Yr(()=>i().length))i.set([])}),[o,(u,l)=>{let d={action:u};i.set([...i(),d]);let a=()=>{let s=i().filter((y)=>y!==d);if(s.length!==i().length)i.set(s)};if(l&&typeof l.then==="function")Promise.resolve(l).then(a,a);return a}]}
|
|
3
|
+
export{ue,Un,mh,Wn,vo,Gr,Jr,hh,yh,bh,qn,Kn,xo,Yr,wh};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ds,Df,Fo,Lf}from"./chunk-e8a6s6xs.js";import"./chunk-ekh3mxyp.js";import"./chunk-qz82cpyv.js";import"./chunk-5phdmpa7.js";import"./chunk-qadce16v.js";import"./chunk-ng5revck.js";import"./chunk-y6nz6bk2.js";import"./chunk-cv1zc9dg.js";import"./chunk-7p8m82pj.js";import"./chunk-rkdsgfhd.js";import"./chunk-mxvevxb8.js";import{Pt}from"./chunk-xj3my6b9.js";import"./chunk-yv1vw0kx.js";import"./chunk-2qngyyaz.js";import"./chunk-c9mdvpf5.js";import"./chunk-8y8kgw9s.js";import"./chunk-04z1xyrb.js";export{Lf as declareBareLoopHead,Pt as parseLoopBinding,Df as processLoops,Fo as processLoopsAsync,ds as reportDeferredLoopWarnings};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import a from"fs";function ht(r){return o(r)}var g=1000,i=new Map;function Hn(){i.clear()}function o(r){return[...r].sort().map((n)=>{try{let t=a.statSync(n);return`${n}:${t.size}:${t.mtimeMs}`}catch{return`${n}:missing`}}).join(`
|
|
3
|
+
`)}function Jt(r,n,t){let e=r.get(n);return e!==void 0&&e.signature===t?e.value:void 0}function le(r,n,t,e){return r.set(n,{signature:t,value:e}),e}
|
|
4
|
+
export{ht,Hn,Jt,le};
|