@stacksjs/stx 0.2.707 → 0.2.709
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-03xe9hxn.js +130 -0
- package/dist/chunk-20sv64qp.js +2 -0
- package/dist/{chunk-eqz0g5c5.js → chunk-2t59wh9y.js} +1 -1
- package/dist/{chunk-b2ajtmvk.js → chunk-2xp44gz3.js} +1 -1
- package/dist/chunk-40q04wnz.js +2 -0
- package/dist/{chunk-7ppbv5bc.js → chunk-4eatxb55.js} +6 -6
- package/dist/{chunk-p4s8hq38.js → chunk-4g152e86.js} +32 -16
- package/dist/chunk-5p1tvw02.js +2 -0
- package/dist/{chunk-wevcmbn6.js → chunk-5vejh42a.js} +4 -4
- package/dist/{chunk-nzyr320e.js → chunk-62qjy45q.js} +1 -1
- package/dist/{chunk-dzkg6cy5.js → chunk-659vn8hx.js} +1 -1
- package/dist/{chunk-txr51pkd.js → chunk-7d2astjj.js} +1 -1
- package/dist/{chunk-j9mpwt71.js → chunk-7f9mmtrs.js} +1 -1
- package/dist/{chunk-czy6hs6g.js → chunk-86b173cz.js} +2 -2
- package/dist/{chunk-t21ae4rx.js → chunk-89gemg31.js} +1 -1
- package/dist/{chunk-vjyrwvz0.js → chunk-8nfrqcd1.js} +1 -1
- package/dist/{chunk-1f4e06c2.js → chunk-8rvdpsjw.js} +1 -1
- package/dist/{chunk-r96wcqs6.js → chunk-8t9ws0ct.js} +1 -1
- package/dist/{chunk-2tqekz3d.js → chunk-9adx6f4k.js} +2 -2
- package/dist/{chunk-dmcjap96.js → chunk-9r5ntnef.js} +2 -2
- package/dist/chunk-bny1grrf.js +2 -0
- package/dist/chunk-c2dqq1mt.js +2 -0
- package/dist/{chunk-taste5sr.js → chunk-ck2kb6hd.js} +1 -1
- package/dist/{chunk-cam9je83.js → chunk-ck7e0yy2.js} +10 -10
- package/dist/{chunk-j3emvkjb.js → chunk-d7ayzcyg.js} +1 -1
- package/dist/{chunk-9v1t47d2.js → chunk-dcpgj3c6.js} +1 -1
- package/dist/{chunk-x8zekavj.js → chunk-dwda6jcc.js} +1 -1
- package/dist/{chunk-79p5580k.js → chunk-dyhzrdee.js} +1 -1
- package/dist/{chunk-7c7jnph2.js → chunk-e97h1wzd.js} +2 -2
- package/dist/{chunk-kqdzjgm6.js → chunk-fgjp28yp.js} +59 -58
- package/dist/{chunk-pfjsyvmj.js → chunk-g0eakxxe.js} +5 -5
- package/dist/{chunk-ktf42hmd.js → chunk-gkfm4v2a.js} +1 -1
- package/dist/chunk-gsn8mp7c.js +2 -0
- package/dist/{chunk-4m9qn8ps.js → chunk-h6pmg82p.js} +2 -2
- package/dist/{chunk-0v5nfhwg.js → chunk-hh3tgx1f.js} +2 -2
- package/dist/{chunk-4y73c35z.js → chunk-hjq5463c.js} +1 -1
- package/dist/chunk-hv7k0bmv.js +2 -0
- package/dist/{chunk-89s38bat.js → chunk-jbxyg5sc.js} +1 -1
- package/dist/{chunk-qprjkz11.js → chunk-jdgfzxyg.js} +2 -2
- package/dist/{chunk-cm8m2ygc.js → chunk-jh2jmbta.js} +4 -4
- package/dist/chunk-k4dehf34.js +2 -0
- package/dist/{chunk-0f12mv0z.js → chunk-k7e5nv70.js} +1 -1
- package/dist/chunk-kfzenpwm.js +2 -0
- package/dist/{chunk-g03tkxds.js → chunk-m8zahrwp.js} +1 -1
- package/dist/chunk-mg2zgvhz.js +2 -0
- package/dist/{chunk-2gny5jdt.js → chunk-mr3r8crk.js} +2 -2
- package/dist/chunk-n0dajrzk.js +2 -0
- package/dist/chunk-n3kbyt3h.js +2 -0
- package/dist/{chunk-t7ezw8cj.js → chunk-n7cw9ce3.js} +1 -1
- package/dist/{chunk-7hpwcwwh.js → chunk-nccxqcj2.js} +1 -1
- package/dist/{chunk-pgjqx3kg.js → chunk-nd9rs768.js} +1 -1
- package/dist/{chunk-3hhcea1p.js → chunk-p12nxr1r.js} +7 -7
- package/dist/{chunk-59k5ntkt.js → chunk-p3dkhz9v.js} +5 -5
- package/dist/{chunk-59g266vc.js → chunk-prhws9sn.js} +2 -2
- package/dist/{chunk-d21twmm2.js → chunk-qs2bt5vp.js} +1 -1
- package/dist/{chunk-sdpzaase.js → chunk-rdj74dqc.js} +1 -1
- package/dist/chunk-rnxrrhbv.js +2 -0
- package/dist/chunk-rtbkjq0y.js +2 -0
- package/dist/{chunk-c5tky2vf.js → chunk-t4ak76e6.js} +5 -5
- package/dist/{chunk-998zvkzr.js → chunk-tvcr9sct.js} +2 -2
- package/dist/{chunk-km5dpg5v.js → chunk-tzkyfw0p.js} +13 -13
- package/dist/{chunk-79vj1txq.js → chunk-vjqm4a5c.js} +1 -1
- package/dist/{chunk-6ms7rtqt.js → chunk-vpe6qaw2.js} +1 -1
- package/dist/chunk-w1bxxgm5.js +2 -0
- package/dist/{chunk-46s9ma3t.js → chunk-w7rczhn5.js} +1 -1
- package/dist/{chunk-qy1ss1en.js → chunk-wpfnbcvn.js} +1 -1
- package/dist/{chunk-zdpd29xd.js → chunk-wt18wv6x.js} +2 -2
- package/dist/{chunk-533g1b9b.js → chunk-x2gxx8eg.js} +2 -2
- package/dist/{chunk-f7a6nzx6.js → chunk-x91zfx03.js} +1 -1
- package/dist/chunk-xbbxa1t8.js +3 -0
- package/dist/{chunk-jx7q5cnv.js → chunk-xf3bt7xf.js} +1 -1
- package/dist/chunk-xnxj3z0t.js +2 -0
- package/dist/{chunk-jztsks2y.js → chunk-xz103bfc.js} +1 -1
- package/dist/chunk-zsfwzwsd.js +2 -0
- package/dist/cli.js +8 -8
- package/dist/client/signals-authoring-runtime.js +8 -1
- package/dist/client/signals-binding-utils-runtime.js +10 -1
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/native/accessibility.d.ts +2 -2
- package/dist/native/accessibility.js +5 -3
- package/dist/native/compiler/html-to-ir.js +1 -1
- package/dist/native/runtime/native-host.js +5 -5
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +8 -8
- package/dist/utils.js +41 -0
- package/package.json +5 -5
- package/dist/chunk-2dgbme86.js +0 -2
- package/dist/chunk-42t97n9v.js +0 -2
- package/dist/chunk-8ss2v7sw.js +0 -2
- package/dist/chunk-921gb49g.js +0 -2
- package/dist/chunk-9frqh3bj.js +0 -2
- package/dist/chunk-a35m0g7z.js +0 -2
- package/dist/chunk-bd9p1xmr.js +0 -2
- package/dist/chunk-d22sgyg2.js +0 -3
- package/dist/chunk-enssxcpa.js +0 -2
- package/dist/chunk-fen5nnc4.js +0 -2
- package/dist/chunk-gbkcc96c.js +0 -2
- package/dist/chunk-hs2sbkvk.js +0 -2
- package/dist/chunk-jef9mn1h.js +0 -2
- package/dist/chunk-pank9g6n.js +0 -2
- package/dist/chunk-pf427myt.js +0 -2
- package/dist/chunk-qf0bs4a5.js +0 -2
- package/dist/chunk-txjx2xd6.js +0 -2
- package/dist/chunk-w4vxhedk.js +0 -2
- package/dist/chunk-wj235n59.js +0 -130
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Yn,$e}from"./chunk-1xjv71dw.js";import{F,w,gr,_s,_}from"./chunk-kqdzjgm6.js";import{a,P}from"./chunk-59g266vc.js";import{bo}from"./chunk-t21ae4rx.js";import{et}from"./chunk-j2mpqa4p.js";import{l}from"./chunk-5n4qg8za.js";import{s,ge}from"./chunk-vstvadc2.js";import d from"path";import v from"fs";import{AsyncLocalStorage as ht}from"async_hooks";var xt=11;function X(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(d.basename(t))||bo(t,e,n)}var at=2;function Qp(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?d.resolve(e):l(t,"bundle-cache")}function st(t,e){let n=t;for(let i of $t(e))if(i!==d.sep)n=n.split(i).join("\x00root");return n}var rt=new Map;function $t(t){let e=d.resolve(t),n=rt.get(e);if(!n){let i=e;try{i=v.realpathSync(e)}catch{}n=[...new Set([e,i])].sort((u,m)=>m.length-u.length),rt.set(e,n)}return n}function yt(t,e){try{let n=v.statSync(t),i=d.resolve(e),u=t.startsWith(`${i}${d.sep}`);return{path:u?d.relative(i,t):t,...u?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(v.readFileSync(t)).toString(36)}}catch{return null}}function ct(t,e){return t.inRoot?d.join(d.resolve(e),t.path):t.path}function bt(t,e){for(let n of t){let i=ct(n,e);try{let u=v.statSync(i);if(u.size!==n.size)return!1;if(u.mtimeMs!==n.mtimeMs&&Bun.hash(v.readFileSync(i)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var lt=new Map,wt=100;function ef(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 St(t){let e=G.get(t)??0;if(e>0&&e<wt){G.set(t,e+1);return}G.set(t,1);try{let n=(await v.promises.readdir(t)).filter((c)=>c.endsWith(".js")),i=ef();if(n.length<=i)return;let m=(await Promise.all(n.map(async(c)=>{try{return{name:c,at:(await v.promises.stat(d.join(t,c))).mtimeMs}}catch{return null}}))).filter((c)=>c!==null);m.sort((c,y)=>y.at-c.at);for(let c of m.slice(i)){let y=c.name.slice(0,-3);await v.promises.rm(d.join(t,`${y}.js`),{force:!0}),await v.promises.rm(d.join(t,`${y}.deps.json`),{force:!0})}C("pruned bundle cache to",i,"entries")}catch{}}function Te(t){return lt.get(t)??[]}function q(t,e){if(t)lt.set(t,e)}function tf(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function C(...t){if(tf())console.log("[stx:bundler]",...t)}var Y=[];function ja(t,e,n){Y.push({filePath:t||"<inline>",message:e,details:n})}function Yt(){return Y.slice()}function Zt(){Y.length=0}var Z;function Km(t){Z=t}function Ba(){if(Z)return Z;try{let t=P.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Q=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function Qt(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let u=n[1];if(!Q.some((c)=>c.test(u)))return C("detected user import:",u),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=i.exec(t))!==null){let u=n[1];if(/\.css(?:\?.*)?$/.test(u))continue;if(!Q.some((c)=>c.test(u)))return C("detected side-effect import:",u),!0}return!1}var Jn="stx-module:",vt=/\.(?:[cm]?[jt]sx?|json)$/i;function nf(t,e){return d.relative(t,e).split(d.sep).join("/")}function rf(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,i,u,m)=>{let c=e.get(m);return c&&!m.startsWith(Jn)?`${i}${u}${c}${u}`:n})}function sf(t,e){let n=0,i=(m)=>{let c=`__stxMod${n++}`,y=JSON.stringify(m);return e.push(`var ${c} = globalThis.__stxModules && globalThis.__stxModules[${y}];`,`if (${c} === undefined) throw new Error("[stx] module " + ${JSON.stringify(y)} + " is not registered on this page (#1957)");`),c},u=(m,c)=>{for(let y of m.split(",")){let I=y.trim();if(!I)continue;let B=I.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!B)continue;let j=B[1].startsWith('"')?JSON.parse(B[1]):B[1],p=B[2]??j;e.push(`var ${p} = ${c}[${JSON.stringify(j)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(m,c,y)=>{let I=y.slice(Jn.length),B=i(I),j=c.trim(),p=j.match(/^([\w$]+)\s*(?:,\s*|$)/);if(p&&!j.startsWith("{")&&!j.startsWith("*"))e.push(`var ${p[1]} = ${B}.default;`),j=j.slice(p[0].length).trim();let r=j.match(/^\*\s*as\s+([\w$]+)$/);if(r)e.push(`var ${r[1]} = ${B};`);else if(j.startsWith("{"))u(j.replace(/^\{|\}$/g,""),B);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(m,c)=>(i(c.slice(Jn.length)),"")),t}function it(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,d.join(t,"index.ts"),d.join(t,"index.tsx"),d.join(t,"index.js"),d.join(t,"index.mjs")];for(let n of e)try{if(v.existsSync(n)&&v.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var K=new ht;function go(t,e){let n=new Bun.CryptoHasher("md5");for(let[i,u]of[...t].sort(([m],[c])=>m<c?-1:m>c?1:0))n.update(`${i}\x00${u}\x00`);return K.run({modules:t,key:n.digest("hex").slice(0,12)},e)}function en(){return K.getStore()?.key??""}function Bt(t,e,n,i,u,m,c=new Map,y,I){let B=(p,r,o)=>{if(X(r,t,y))return null;if(!m||p!==n||!vt.test(r))return null;try{if(!v.statSync(r,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}u.add(r);let b=`${Jn}${nf(process.cwd(),r)}`;return c.set(o,b),{path:b,external:!0}},j=(p,r)=>{let o=p===n?e:d.dirname(p),b=d.resolve(o,r);return it(b)??b};return{name:"stx-client-bundle",setup(p){if(p.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(r)=>({path:r.path,external:!0})),p.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(r)=>({path:r.path,external:!0})),p.onResolve({filter:/^\//},(r)=>{if(r.path===n)return{path:n};let o=it(r.path);if(o){let b=B(r.importer,o,r.path);if(b)return b;if(o!==n)u.add(o);return{path:o}}return{path:r.path,external:!0}}),p.onResolve({filter:/^\.\.?\//},(r)=>{let o=j(r.importer,r.path),b=B(r.importer,o,r.path);if(b)return b;return u.add(o),{path:o}}),p.onResolve({filter:/^[@~]\//},(r)=>{let o=d.resolve(t,r.path.slice(2)),b=[o,`${o}.ts`,`${o}.tsx`,`${o}.js`,`${o}.mjs`,`${o}.jsx`,d.join(o,"index.ts"),d.join(o,"index.tsx"),d.join(o,"index.js"),d.join(o,"index.mjs")];for(let x of b)if(v.existsSync(x)&&v.statSync(x,{throwIfNoEntry:!1})?.isFile()){let N=B(r.importer,x,r.path);if(N)return N;return C(`resolved ${r.path[0]}/ import:`,r.path,"\u2192",x),u.add(x),{path:x}}return console.warn(`[stx:bundler] could not resolve ${r.path[0]}/ import:`,r.path),{path:o}}),m)p.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(r)=>{if(r.importer!==n)return;let o=`${Jn}npm:${r.path}`;return c.set(r.path,o),{path:o,external:!0}});p.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(r)=>{if(r.path===n)return{contents:i,loader:"ts"};if(X(r.path,t,y))throw Error(`Server-only API source cannot be imported by a client script: ${r.path}`);let o=d.extname(r.path).toLowerCase(),b=o===".json"?"json":o===".tsx"?"tsx":o===".jsx"?"jsx":o===".ts"||o===".mts"||o===".cts"?"ts":"js";if(r.path!==n)u.add(r.path);let x=I?.get(r.path);if(x!==void 0)return{contents:x,loader:"js"};return{contents:v.readFileSync(r.path,"utf8"),loader:b}})}}}var H=new Map,z=w(64),ot=Symbol.for("stx.client-bundle-build-queue");function of(t){let e=globalThis,i=(e[ot]??Promise.resolve()).then(t,t);return e[ot]=i.then(()=>{return},()=>{return}),i}async function tn(t,e,n={}){let i=n.projectRoot||process.cwd(),u=(await a(i)).serverApi,m=n.minify??!1,c=n.externalizeUserModules??!0,y=n.expose?.length?[...new Set(n.expose)].sort():void 0,I=n.cacheDir||Qp(i),B=K.getStore(),j=new Bun.CryptoHasher("md5");j.update(`${xt}\x00${et()}\x00${JSON.stringify(u??!1)}\x00${c?"registry":"inline"}\x00${y?y.join(","):"*"}\x00${m?"minified":"readable"}\x00${B?.key??""}\x00${st(t,i)}\x00${st(e,i)}`);let p=j.digest("hex").slice(0,12),r=d.join(I,`${p}.js`),o=z.get(r);if(o){if(_s(o.files)&&o.files.every((R)=>!X(R.path,i,u))){C("memo hit:",p);let R=o.files.map((A)=>A.path);return q(e,R),n.collectInputs?.push(...R),o.code}z.delete(r),C("memo invalidated by dep change:",p)}let b=d.join(I,`${p}.deps.json`),x=Bun.file(r);if(await x.exists()){let R=Bun.file(b),A=!1,O=null;if(await R.exists())try{let D=JSON.parse(await R.text());if(D.metadataVersion===at&&Array.isArray(D.files)&&bt(D.files,i))O=gr(D.files.map((g)=>ct(g,i))),A=O.length===D.files.length&&!O.some((g)=>X(g.path,i,u))}catch{A=!1}if(A){if(C("cache hit:",p),O)q(e,O.map((L)=>L.path)),n.collectInputs?.push(...O.map((L)=>L.path));let D=await x.text(),g=new Date;if(v.promises.utimes(r,g,g).catch(()=>{}),O)z.set(r,{code:D,files:O});return D}C("cache invalidated by dep change:",p)}let N=H.get(p);if(N){let R=await N;if(n.collectInputs)n.collectInputs.push(...(z.get(r)?.files??[]).map((A)=>A.path));return R}let V=of(()=>_t(t,e,{projectRoot:i,minify:m,cacheDir:I,hash:p,cachePath:r,depsPath:b,collectInputs:n.collectInputs,externalizeUserModules:c,serverApi:u,expose:y,throwOnFailure:n.throwOnFailure,substitutes:B?.modules}));H.set(p,V);try{return await V}finally{H.delete(p)}}var jt=0;function af(t){return`${t}-${process.pid}-${++jt}`}async function _t(t,e,n){let{projectRoot:i,minify:u,cacheDir:m,hash:c,cachePath:y,depsPath:I,externalizeUserModules:B}=n,j=l(i,"bundle-tmp"),p=af(c),r=d.join(i,`.stx-client-${p}.ts`),o=d.join(j,"out",p);v.mkdirSync(o,{recursive:!0});let b=d.dirname(e),x=new Set,N=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,V=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,R=s(t),{depths:A,balanced:O}=ge(R),D=(E)=>!O||A[E]===0,g;while((g=N.exec(R))!==null){if(g[1])continue;if(!D(g.index))continue;if(g[2])g[2].split(",").forEach((E)=>{let f=Et(E);if(f)x.add(f)});else if(g[3])x.add(g[3])}while((g=V.exec(R))!==null){if(g[1])continue;if(!D(g.index))continue;x.add(g[2])}let L=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=L.exec(R))!==null){if(!D(g.index))continue;let E=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(E&&Q.some((f)=>f.test(E)))continue;if(g[1])x.add(g[1]);if(g[2])x.add(g[2]);for(let f of(g[3]??"").split(",")){let S=f.trim();if(!S||/^type\s/.test(S))continue;let U=/\bas\s+(\w+)\s*$/.exec(S)?.[1]??/^\w+$/.exec(S)?.[0];if(U)x.add(U)}}for(let E of R.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let f of E[1].split(",")){let S=/\bas\s+(\w+)\s*$/.exec(f)?.[1]??/^\s*(\w+)\s*$/.exec(f)?.[1];if(S)x.delete(S)}let ut=x.size>0?`
|
|
2
|
+
import{Yn,$e}from"./chunk-1xjv71dw.js";import{F,w,gr,_s,_}from"./chunk-fgjp28yp.js";import{a,P}from"./chunk-prhws9sn.js";import{bo}from"./chunk-89gemg31.js";import{et}from"./chunk-j2mpqa4p.js";import{l}from"./chunk-5n4qg8za.js";import{s,ge}from"./chunk-vstvadc2.js";import d from"path";import v from"fs";import{AsyncLocalStorage as ht}from"async_hooks";var xt=11;function X(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(d.basename(t))||bo(t,e,n)}var at=2;function Qp(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?d.resolve(e):l(t,"bundle-cache")}function st(t,e){let n=t;for(let i of $t(e))if(i!==d.sep)n=n.split(i).join("\x00root");return n}var rt=new Map;function $t(t){let e=d.resolve(t),n=rt.get(e);if(!n){let i=e;try{i=v.realpathSync(e)}catch{}n=[...new Set([e,i])].sort((u,m)=>m.length-u.length),rt.set(e,n)}return n}function yt(t,e){try{let n=v.statSync(t),i=d.resolve(e),u=t.startsWith(`${i}${d.sep}`);return{path:u?d.relative(i,t):t,...u?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(v.readFileSync(t)).toString(36)}}catch{return null}}function ct(t,e){return t.inRoot?d.join(d.resolve(e),t.path):t.path}function bt(t,e){for(let n of t){let i=ct(n,e);try{let u=v.statSync(i);if(u.size!==n.size)return!1;if(u.mtimeMs!==n.mtimeMs&&Bun.hash(v.readFileSync(i)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var lt=new Map,wt=100;function ef(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 St(t){let e=G.get(t)??0;if(e>0&&e<wt){G.set(t,e+1);return}G.set(t,1);try{let n=(await v.promises.readdir(t)).filter((c)=>c.endsWith(".js")),i=ef();if(n.length<=i)return;let m=(await Promise.all(n.map(async(c)=>{try{return{name:c,at:(await v.promises.stat(d.join(t,c))).mtimeMs}}catch{return null}}))).filter((c)=>c!==null);m.sort((c,y)=>y.at-c.at);for(let c of m.slice(i)){let y=c.name.slice(0,-3);await v.promises.rm(d.join(t,`${y}.js`),{force:!0}),await v.promises.rm(d.join(t,`${y}.deps.json`),{force:!0})}C("pruned bundle cache to",i,"entries")}catch{}}function Te(t){return lt.get(t)??[]}function q(t,e){if(t)lt.set(t,e)}function tf(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function C(...t){if(tf())console.log("[stx:bundler]",...t)}var Y=[];function ja(t,e,n){Y.push({filePath:t||"<inline>",message:e,details:n})}function Yt(){return Y.slice()}function Zt(){Y.length=0}var Z;function Gm(t){Z=t}function Ba(){if(Z)return Z;try{let t=P.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Q=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function Qt(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let u=n[1];if(!Q.some((c)=>c.test(u)))return C("detected user import:",u),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=i.exec(t))!==null){let u=n[1];if(/\.css(?:\?.*)?$/.test(u))continue;if(!Q.some((c)=>c.test(u)))return C("detected side-effect import:",u),!0}return!1}var Jn="stx-module:",vt=/\.(?:[cm]?[jt]sx?|json)$/i;function nf(t,e){return d.relative(t,e).split(d.sep).join("/")}function rf(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,i,u,m)=>{let c=e.get(m);return c&&!m.startsWith(Jn)?`${i}${u}${c}${u}`:n})}function sf(t,e){let n=0,i=(m)=>{let c=`__stxMod${n++}`,y=JSON.stringify(m);return e.push(`var ${c} = globalThis.__stxModules && globalThis.__stxModules[${y}];`,`if (${c} === undefined) throw new Error("[stx] module " + ${JSON.stringify(y)} + " is not registered on this page (#1957)");`),c},u=(m,c)=>{for(let y of m.split(",")){let I=y.trim();if(!I)continue;let B=I.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!B)continue;let j=B[1].startsWith('"')?JSON.parse(B[1]):B[1],p=B[2]??j;e.push(`var ${p} = ${c}[${JSON.stringify(j)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(m,c,y)=>{let I=y.slice(Jn.length),B=i(I),j=c.trim(),p=j.match(/^([\w$]+)\s*(?:,\s*|$)/);if(p&&!j.startsWith("{")&&!j.startsWith("*"))e.push(`var ${p[1]} = ${B}.default;`),j=j.slice(p[0].length).trim();let r=j.match(/^\*\s*as\s+([\w$]+)$/);if(r)e.push(`var ${r[1]} = ${B};`);else if(j.startsWith("{"))u(j.replace(/^\{|\}$/g,""),B);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(m,c)=>(i(c.slice(Jn.length)),"")),t}function it(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,d.join(t,"index.ts"),d.join(t,"index.tsx"),d.join(t,"index.js"),d.join(t,"index.mjs")];for(let n of e)try{if(v.existsSync(n)&&v.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var K=new ht;function go(t,e){let n=new Bun.CryptoHasher("md5");for(let[i,u]of[...t].sort(([m],[c])=>m<c?-1:m>c?1:0))n.update(`${i}\x00${u}\x00`);return K.run({modules:t,key:n.digest("hex").slice(0,12)},e)}function en(){return K.getStore()?.key??""}function Bt(t,e,n,i,u,m,c=new Map,y,I){let B=(p,r,o)=>{if(X(r,t,y))return null;if(!m||p!==n||!vt.test(r))return null;try{if(!v.statSync(r,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}u.add(r);let b=`${Jn}${nf(process.cwd(),r)}`;return c.set(o,b),{path:b,external:!0}},j=(p,r)=>{let o=p===n?e:d.dirname(p),b=d.resolve(o,r);return it(b)??b};return{name:"stx-client-bundle",setup(p){if(p.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(r)=>({path:r.path,external:!0})),p.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(r)=>({path:r.path,external:!0})),p.onResolve({filter:/^\//},(r)=>{if(r.path===n)return{path:n};let o=it(r.path);if(o){let b=B(r.importer,o,r.path);if(b)return b;if(o!==n)u.add(o);return{path:o}}return{path:r.path,external:!0}}),p.onResolve({filter:/^\.\.?\//},(r)=>{let o=j(r.importer,r.path),b=B(r.importer,o,r.path);if(b)return b;return u.add(o),{path:o}}),p.onResolve({filter:/^[@~]\//},(r)=>{let o=d.resolve(t,r.path.slice(2)),b=[o,`${o}.ts`,`${o}.tsx`,`${o}.js`,`${o}.mjs`,`${o}.jsx`,d.join(o,"index.ts"),d.join(o,"index.tsx"),d.join(o,"index.js"),d.join(o,"index.mjs")];for(let x of b)if(v.existsSync(x)&&v.statSync(x,{throwIfNoEntry:!1})?.isFile()){let N=B(r.importer,x,r.path);if(N)return N;return C(`resolved ${r.path[0]}/ import:`,r.path,"\u2192",x),u.add(x),{path:x}}return console.warn(`[stx:bundler] could not resolve ${r.path[0]}/ import:`,r.path),{path:o}}),m)p.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(r)=>{if(r.importer!==n)return;let o=`${Jn}npm:${r.path}`;return c.set(r.path,o),{path:o,external:!0}});p.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(r)=>{if(r.path===n)return{contents:i,loader:"ts"};if(X(r.path,t,y))throw Error(`Server-only API source cannot be imported by a client script: ${r.path}`);let o=d.extname(r.path).toLowerCase(),b=o===".json"?"json":o===".tsx"?"tsx":o===".jsx"?"jsx":o===".ts"||o===".mts"||o===".cts"?"ts":"js";if(r.path!==n)u.add(r.path);let x=I?.get(r.path);if(x!==void 0)return{contents:x,loader:"js"};return{contents:v.readFileSync(r.path,"utf8"),loader:b}})}}}var H=new Map,z=w(64),ot=Symbol.for("stx.client-bundle-build-queue");function of(t){let e=globalThis,i=(e[ot]??Promise.resolve()).then(t,t);return e[ot]=i.then(()=>{return},()=>{return}),i}async function tn(t,e,n={}){let i=n.projectRoot||process.cwd(),u=(await a(i)).serverApi,m=n.minify??!1,c=n.externalizeUserModules??!0,y=n.expose?.length?[...new Set(n.expose)].sort():void 0,I=n.cacheDir||Qp(i),B=K.getStore(),j=new Bun.CryptoHasher("md5");j.update(`${xt}\x00${et()}\x00${JSON.stringify(u??!1)}\x00${c?"registry":"inline"}\x00${y?y.join(","):"*"}\x00${m?"minified":"readable"}\x00${B?.key??""}\x00${st(t,i)}\x00${st(e,i)}`);let p=j.digest("hex").slice(0,12),r=d.join(I,`${p}.js`),o=z.get(r);if(o){if(_s(o.files)&&o.files.every((R)=>!X(R.path,i,u))){C("memo hit:",p);let R=o.files.map((A)=>A.path);return q(e,R),n.collectInputs?.push(...R),o.code}z.delete(r),C("memo invalidated by dep change:",p)}let b=d.join(I,`${p}.deps.json`),x=Bun.file(r);if(await x.exists()){let R=Bun.file(b),A=!1,O=null;if(await R.exists())try{let D=JSON.parse(await R.text());if(D.metadataVersion===at&&Array.isArray(D.files)&&bt(D.files,i))O=gr(D.files.map((g)=>ct(g,i))),A=O.length===D.files.length&&!O.some((g)=>X(g.path,i,u))}catch{A=!1}if(A){if(C("cache hit:",p),O)q(e,O.map((L)=>L.path)),n.collectInputs?.push(...O.map((L)=>L.path));let D=await x.text(),g=new Date;if(v.promises.utimes(r,g,g).catch(()=>{}),O)z.set(r,{code:D,files:O});return D}C("cache invalidated by dep change:",p)}let N=H.get(p);if(N){let R=await N;if(n.collectInputs)n.collectInputs.push(...(z.get(r)?.files??[]).map((A)=>A.path));return R}let V=of(()=>_t(t,e,{projectRoot:i,minify:m,cacheDir:I,hash:p,cachePath:r,depsPath:b,collectInputs:n.collectInputs,externalizeUserModules:c,serverApi:u,expose:y,throwOnFailure:n.throwOnFailure,substitutes:B?.modules}));H.set(p,V);try{return await V}finally{H.delete(p)}}var jt=0;function af(t){return`${t}-${process.pid}-${++jt}`}async function _t(t,e,n){let{projectRoot:i,minify:u,cacheDir:m,hash:c,cachePath:y,depsPath:I,externalizeUserModules:B}=n,j=l(i,"bundle-tmp"),p=af(c),r=d.join(i,`.stx-client-${p}.ts`),o=d.join(j,"out",p);v.mkdirSync(o,{recursive:!0});let b=d.dirname(e),x=new Set,N=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,V=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,R=s(t),{depths:A,balanced:O}=ge(R),D=(E)=>!O||A[E]===0,g;while((g=N.exec(R))!==null){if(g[1])continue;if(!D(g.index))continue;if(g[2])g[2].split(",").forEach((E)=>{let f=Et(E);if(f)x.add(f)});else if(g[3])x.add(g[3])}while((g=V.exec(R))!==null){if(g[1])continue;if(!D(g.index))continue;x.add(g[2])}let L=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=L.exec(R))!==null){if(!D(g.index))continue;let E=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(E&&Q.some((f)=>f.test(E)))continue;if(g[1])x.add(g[1]);if(g[2])x.add(g[2]);for(let f of(g[3]??"").split(",")){let S=f.trim();if(!S||/^type\s/.test(S))continue;let U=/\bas\s+(\w+)\s*$/.exec(S)?.[1]??/^\w+$/.exec(S)?.[0];if(U)x.add(U)}}for(let E of R.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let f of E[1].split(",")){let S=/\bas\s+(\w+)\s*$/.exec(f)?.[1]??/^\s*(\w+)\s*$/.exec(f)?.[1];if(S)x.delete(S)}let ut=x.size>0?`
|
|
3
3
|
export { ${[...x].join(", ")} }`:"";C("bundling:",c,"from:",d.basename(e));let tt=new Set,nt=new Map;try{let E=await Bun.build({entrypoints:[r],outdir:o,target:"browser",format:"esm",minify:u?{whitespace:!1,identifiers:!0,syntax:!0}:!1,plugins:[Bt(i,b,r,t+ut,tt,B,nt,n.serverApi,n.substitutes)],define:{"process.env.NODE_ENV":u?'"production"':'"development"',..._()},root:i});if(!E.success){let M=E.logs.filter((T)=>T.level==="error").map((T)=>T.message).join(", ")||`Unable to bundle ${d.basename(e)}`,k=Yn(E.logs,e||void 0);if(console.warn("[stx:bundler] build failed:",M),ja(e||"",M,k),n.throwOnFailure||Ba()==="error")throw Error(M);return t}let f="";for(let h of E.outputs){f=await h.text();break}let S=[];for(let h of f.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let M of h[1].split(",")){let k=M.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(k){S.push([k[2],k[1]]);continue}let T=M.trim();if(/^[A-Za-z_$][\w$]*$/.test(T))S.push([T,T])}if(n.expose){let h=new Set(n.expose);for(let M=S.length-1;M>=0;M--)if(!h.has(S[M][0]))S.splice(M,1)}let U=[];f=sf(rf(f,nt),U);let dt=f.match(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm)||[];if(f=f.replace(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),u&&f)try{f=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(f)}catch{}let J=`__stxBundle_${c}`,pt=new Set(F(t,!0).split(",").map((h)=>h.trim())),ft=S.map(([h,M])=>`get ${JSON.stringify(h)}() { return ${M} }${pt.has(h)?`, set ${JSON.stringify(h)}(__stxValue_${M}) { ${M} = __stxValue_${M} }`:""}`).join(", "),mt=S.map(([h])=>`var ${h} = undefined;`).join(`
|
|
4
4
|
`),gt=S.map(([h])=>`${h} = ${J}[${JSON.stringify(h)}];`).join(`
|
|
5
5
|
`);if(f=`${dt.join(`
|
|
@@ -17,4 +17,4 @@ Object.keys(${J}).forEach(function(name) {
|
|
|
17
17
|
if (!Object.prototype.hasOwnProperty.call(__stxLiveBindings, name))
|
|
18
18
|
Object.defineProperty(__stxLiveBindings, name, Object.getOwnPropertyDescriptor(${J}, name));
|
|
19
19
|
});`.trim(),C("bundled:",c,"output:",f.length,"bytes"),x.size>0&&S.length===0)return console.warn(`[stx:bundler] dropped every binding for ${d.basename(e)} (${c}); serving the unbundled source and not caching this result`),t;v.mkdirSync(m,{recursive:!0}),await Bun.write(y,f);let W=gr(tt);return await Bun.write(I,JSON.stringify({metadataVersion:at,files:W.map((h)=>yt(h.path,i)).filter((h)=>h!==null)})),q(e,W.map((h)=>h.path)),n.collectInputs?.push(...W.map((h)=>h.path)),z.set(y,{code:f,files:W}),await St(m),f}catch(E){let f=Yn(E,e||void 0),S=$e(E,e||void 0);if(console.warn(`[stx:bundler] error: ${S}`),ja(e||"",S,f),n.throwOnFailure||Ba()==="error")throw E;return t}finally{try{v.rmSync(o,{recursive:!0,force:!0})}catch{}}}function Et(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{Qp,ef,Te,tf,ja,Yt,Zt,
|
|
20
|
+
export{Qp,ef,Te,tf,ja,Yt,Zt,Gm,Ba,Qt,Jn,nf,rf,sf,go,en,of,tn,af};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{vg}from"./chunk-8t9ws0ct.js";import"./chunk-t4ak76e6.js";import"./chunk-wpfnbcvn.js";import"./chunk-89gemg31.js";import"./chunk-xbbxa1t8.js";import"./chunk-4eatxb55.js";import"./chunk-prhws9sn.js";import"./chunk-7f9mmtrs.js";import"./chunk-stvw8y3c.js";import"./chunk-zjw6j2x0.js";import"./chunk-3t3p2c1t.js";import"./chunk-0myrwz84.js";import"./chunk-fgjp28yp.js";import"./chunk-8rvdpsjw.js";import"./chunk-wp6q0geg.js";import"./chunk-xyyt8v1r.js";import"./chunk-zn3c0ew5.js";import"./chunk-wt18wv6x.js";export{vg as startProductionServer};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{eh,ff,Ge,Va,th,Yr,Zr,Qr}from"./chunk-p12nxr1r.js";import"./chunk-nd9rs768.js";import"./chunk-xbbxa1t8.js";import"./chunk-7dc3n69c.js";import"./chunk-8v2vbc4y.js";import"./chunk-fgjp28yp.js";import"./chunk-8rvdpsjw.js";import"./chunk-wp6q0geg.js";import"./chunk-xyyt8v1r.js";import"./chunk-zn3c0ew5.js";import"./chunk-wt18wv6x.js";export{th as clearOnceStore,Va as onceStore,Ge as partialsCache,Yr as processIncludes,Zr as processStackPushDirectives,Qr as processStackReplacements,eh as resetUnscopedSignalWarnings,ff as topLevelElements};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{bn,ii}from"./chunk-
|
|
2
|
+
import{bn,ii}from"./chunk-8rvdpsjw.js";import"./chunk-wp6q0geg.js";export{ii as generateRuntimeConfigTypes,bn as prepareRuntimeConfig};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{qo,dc,o,$t,oe,_,Ie,un,Oe,pe,X,hr,dn,Ts,Sc,fn,vr,Rs,As,kc,Zo,_c,Cc,Ec,Tc,De,Me,Ps,Be,r,hn,h,p,H,Z,xe,S,E}from"./chunk-
|
|
2
|
+
import{qo,dc,o,$t,oe,_,Ie,un,Oe,pe,X,hr,dn,Ts,Sc,fn,vr,Rs,As,kc,Zo,_c,Cc,Ec,Tc,De,Me,Ps,Be,r,hn,h,p,H,Z,xe,S,E}from"./chunk-fgjp28yp.js";import{u,f,R,t,ae,W,c,Se,li,j,wn,ui,jt,di,Fc,kr,zc,st,Hc,_r,Vc,xn,pi,Uc,Cr,Tr,ke,fi}from"./chunk-xyyt8v1r.js";import{Dt}from"./chunk-wp6q0geg.js";import{bn}from"./chunk-8rvdpsjw.js";import{y}from"./chunk-jh2jmbta.js";import{dr,bs}from"./chunk-0myrwz84.js";import{Xa,Ja,cr,Ye,Ya,P}from"./chunk-prhws9sn.js";import{Lo,jo,Bo,Fo}from"./chunk-3t3p2c1t.js";import{Ua,ts}from"./chunk-nd9rs768.js";import{Yr,Zr,Qr}from"./chunk-p12nxr1r.js";import{ns,Ro,Ao,rs,ss,Po}from"./chunk-g0eakxxe.js";import{Jr,nr}from"./chunk-2t59wh9y.js";import{xo}from"./chunk-ap30qs8p.js";import{se,Co,Eo,To}from"./chunk-7dc3n69c.js";import{sr,ye,qa,or,Ka}from"./chunk-4eatxb55.js";import{G,Xe}from"./chunk-x2gxx8eg.js";import{Za,Qa}from"./chunk-7f9mmtrs.js";import{T,Sn,gi}from"./chunk-ncs2j5kc.js";import fs from"fs";import ce from"path";function lt(){return`
|
|
3
3
|
// STX Lifecycle Runtime
|
|
4
4
|
(function() {
|
|
5
5
|
if (typeof window === 'undefined') return;
|
|
@@ -1558,22 +1558,22 @@ ${M}
|
|
|
1558
1558
|
</style>`;a=a.replace(x,I),v.lastIndex=0}catch(M){}}}return a}import it from"path";var us=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,ds=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function ps(s,e){if(!e||!s.includes("/"))return s;let l=it.dirname(e);return s.replace(us,(a,g,n,d)=>{let v=it.resolve(l,d);return`${g}${n}${v.split(it.sep).join("/")}${n}`})}function cn(s,e){if(!e||!s.includes("<script"))return s;return s.replace(ds,(l,a,g,n)=>`${a}${ps(g,e)}${n}`)}var _e="<!--PARENT_CONTENT_PLACEHOLDER-->";function ln(s){return s.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function kn(s,e){let l=s.length,a=e,g=!0,n=[],d=(v)=>v+9<=l&&s[v]==="<"&&s[v+1]==="/"&&(s[v+2]==="s"||s[v+2]==="S")&&(s[v+3]==="c"||s[v+3]==="C")&&(s[v+4]==="r"||s[v+4]==="R")&&(s[v+5]==="i"||s[v+5]==="I")&&(s[v+6]==="p"||s[v+6]==="P")&&(s[v+7]==="t"||s[v+7]==="T")&&(s[v+8]===">"||/\s/.test(s[v+8]));while(a<l){let v=s[a];if(d(a))return a;if(v==="/"&&s[a+1]==="/"){if(a=s.indexOf(`
|
|
1559
1559
|
`,a+2),a===-1)return-1;a+=1,g=!0;continue}if(v==="/"&&s[a+1]==="*"){let m=s.indexOf("*/",a+2);if(m===-1)return-1;a=m+2,g=!0;continue}if(v==="/"&&g){let m=a+1,x=!1;while(m<l){let b=s[m];if(b==="\\"){m+=2;continue}if(b==="[")x=!0;else if(b==="]")x=!1;else if(b==="/"&&!x){m++;break}else if(b===`
|
|
1560
1560
|
`){m=-1;break}m++}if(m===-1){a++,g=!1;continue}while(m<l&&/[a-z]/.test(s[m]))m++;a=m,g=!1;continue}if(v==="'"||v==='"'){let m=v;a++;while(a<l){if(s[a]==="\\"){a+=2;continue}if(s[a]===m){a++;break}if(s[a]===`
|
|
1561
|
-
`)break;a++}g=!1;continue}if(v==="`"){a++;while(a<l){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,g=!0;break}a++}if(n.length===0)g=!1;continue}if(v==="}"&&n.length>0){n.pop(),a++;while(a<l){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++,g=!1;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,g=!0;break}a++}continue}if(/\s/.test(v));else if(/[)\].\w$]/.test(v))g=!1;else g=!0;a++}return-1}function $n(s,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${l}(?:\\s|=|/?>))[^>]*>`,"i").exec(s);if(!a)return null;let g=a.index+a[0].length,n=s.indexOf("</script>",g);if(n===-1)return null;let d=s.indexOf(">",n);if(d===-1)return null;return{start:a.index,end:d+1}}var gs=4096;async function pn(s,e,l){if(l.buildMode!=="serve"||e.length<gs)return null;let{registerServeModuleBundle:a}=await import("./chunk-
|
|
1561
|
+
`)break;a++}g=!1;continue}if(v==="`"){a++;while(a<l){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,g=!0;break}a++}if(n.length===0)g=!1;continue}if(v==="}"&&n.length>0){n.pop(),a++;while(a<l){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++,g=!1;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,g=!0;break}a++}continue}if(/\s/.test(v));else if(/[)\].\w$]/.test(v))g=!1;else g=!0;a++}return-1}function $n(s,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${l}(?:\\s|=|/?>))[^>]*>`,"i").exec(s);if(!a)return null;let g=a.index+a[0].length,n=s.indexOf("</script>",g);if(n===-1)return null;let d=s.indexOf(">",n);if(d===-1)return null;return{start:a.index,end:d+1}}var gs=4096;async function pn(s,e,l){if(l.buildMode!=="serve"||e.length<gs)return null;let{registerServeModuleBundle:a}=await import("./chunk-nccxqcj2.js");return`<script ${s} src="${a(e)}"></script>`}async function Zn(s,e,l){try{let{registeredModuleIdsIn:a,buildModuleRegistryScript:g}=await o("stx/client-module-registry",()=>import("./chunk-qs2bt5vp.js")),n=[],d=await g(a(...s),{minify:gi(e.buildMode,e.minifyClient),collectInputs:n});for(let v of n)l?.add(v);if(!d)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:v}=await import("./chunk-nccxqcj2.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${v(d)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${d.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function ms(s,e=""){let l=$n(s,"data-stx-runtime");if(!l)return s;let a=sr(s);if(a===-1||a===l.start){if(!e)return s;return s.slice(0,l.end)+e+s.slice(l.end)}if(a<l.start)return s.slice(0,a)+s.slice(l.start,l.end)+e+`
|
|
1562
1562
|
`+s.slice(a,l.start)+s.slice(l.end);let g=s.slice(l.start,l.end),n=s.slice(0,l.start)+s.slice(l.end),d=sr(n);if(d===-1)return g+e+`
|
|
1563
1563
|
`+n;return n.slice(0,d)+g+e+`
|
|
1564
1564
|
`+n.slice(d)}function hs(s){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return s.replace(e,(l,a,g)=>{let n=s.slice(0,g);return n.lastIndexOf("<")>n.lastIndexOf(">")?`{{${a}}}`:`{<!--stx-literal-->{${a}}}`})}async function i(s,e,l,a,g){if(a.ssr===!1&&!a.autoShell&&a.buildMode==="spa")return s;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=xe(s,l);let n=!e.__stxProcessingDepth;fn(e);for(let d of a._layerGraph?.configDependencies??[])g.add(d);if(n&&a.runtimeConfig)await bn(e,l,a.runtimeConfig);if(n)Ec(e),e.__stx_scope_seq??={n:0,key:Ps(String(e.__filename??l))},e.__stx_head_injections=di(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((a.debug||!T()&&!Sn())&&l&&l.endsWith(".stx"))xo(s,l);try{return await oe.timeAsync("template-processing",async()=>{let d=await ys(s,e,l,a,g);if(n)d=Zo(d);if(n&&a.autoShell&&a.buildMode!=="compile"){let v=ke(a.app?.head,{known:Tr,source:"app.head"}),x=(e.__stx_runtime_head||null)??fi(),b=(e.__stx_head_raw||"").trim(),w,k=b.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(k)w=k[1].trim(),b=b.replace(k[0],"").trim();let C=e.__sections?.title,D=C?S(C,e,l):void 0,A=x.title||w||D,M=!x.title&&(!!w||!!D),I=x.meta||[],N=new Set(I.map((z)=>st(z)).filter(Boolean)),q={...v,...A&&{title:A},meta:[...(v.meta||[]).filter((z)=>!N.has(st(z))),...I],link:[...v.link||[],...x.link||[]],script:[...v.script||[],...x.script||[]],headRaw:[v.headRaw,b].filter(Boolean).join(`
|
|
1565
|
-
`),...x.htmlAttrs&&{htmlAttrs:Hc(v.htmlAttrs,x.htmlAttrs)},...x.bodyAttrs&&{bodyAttrs:{...v.bodyAttrs||{},...x.bodyAttrs}}},V=pi(d);if(d=Cr(d,q,{...M&&{titleIsHtml:!0},...a.app?.colorMode&&{colorMode:a.app.colorMode}},V),V)d=Uc(d,v),d=_r(d,q.htmlAttrs);let O=d.match(/<!-- stx-layout: ([^ ]+) -->/);if(O&&d.includes("<head")){let z=O[1],
|
|
1565
|
+
`),...x.htmlAttrs&&{htmlAttrs:Hc(v.htmlAttrs,x.htmlAttrs)},...x.bodyAttrs&&{bodyAttrs:{...v.bodyAttrs||{},...x.bodyAttrs}}},V=pi(d);if(d=Cr(d,q,{...M&&{titleIsHtml:!0},...a.app?.colorMode&&{colorMode:a.app.colorMode}},V),V)d=Uc(d,v),d=_r(d,q.htmlAttrs);let O=d.match(/<!-- stx-layout: ([^ ]+) -->/);if(O&&d.includes("<head")){let z=O[1],K=bs(z);d=d.replace(/<head\b[^>]*>/i,(Y)=>`${Y}
|
|
1566
1566
|
<meta name="stx-layout" content="${ln(z)}">
|
|
1567
|
-
<meta name="stx-layout-group" content="${ln(
|
|
1567
|
+
<meta name="stx-layout-group" content="${ln(K)}">`)}let L=d.match(/function (__stx_setup_\w+)\(/),B=L?G(d):null;if(L&&B&&!/\bdata-stx=/.test(B.tag)){d=Xe(d,(K,Y)=>`<body${Y} data-stx="${L[1]}">`);let z=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${L[1]}"`,"i");d=d.replace(z,"$1")}}if(n){let v=e.__stx_head_injections??di(),m=Vc(d);if(m!==null)v.beforeClose.push(m);let x=tn(d);if(x!==null)v.afterOpen.push(x);if(a.offline?.enabled&&!d.includes("data-stx-offline"))v.beforeClose.push(nn);d=Fc(d,v);let b=a.app?.colorMode;if(b)d=kr(d,b)}if(n)if($n(d,"data-stx-runtime")){let m=null,x=null,b=null,w=null,k=null;try{let{getStoreScript:D}=await o("stx/store-loader",()=>import("./chunk-mg2zgvhz.js")),A=a.storesDir,M=await D(A);if(M)b=`<script data-stx-stores>${M}</script>`,x=await pn("data-stx-stores",M,a)??b}catch{}m=await Zn([d,b],a,g);try{let{getFrameworkComposableScript:D}=await o("stx/framework-composables",()=>import("./chunk-dyhzrdee.js"));k=await D(d)}catch{}try{let{getComposableScript:D}=await o("stx/composable-loader",()=>import("./chunk-5p1tvw02.js")),A=a.composablesDir,M=[m,b,k].filter((N)=>N!==null),I=await D(a._layerComposableDirs??A,d,M);if(I)w=await pn('data-stx-scoped data-stx-run="always" data-stx-composables',I,a)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${I}</script>`}catch{}let C=[m,x,w,k].filter((D)=>D!==null).map((D)=>`
|
|
1568
1568
|
${D}`).join("");d=ms(d,C)}else{let m=await Zn([d],a,g);if(m){let x=d.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(x!==-1)d=d.slice(0,x)+m+`
|
|
1569
1569
|
`+d.slice(x)}}if(n)d=zc(d);if(n&&e.__stx_inject_css!==!1)d=await y(d,void 0,a.buildMode==="serve",!0);else if(n)d=dn(d);if(d=d.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),d=hs(d),n&&e.__stx_runtime_config)d=Dt(d,e.__stx_runtime_config);if(n&&!e.__stx_defer_server_data){let v=vr(e);if(v){let m=/<head\b[^>]*>/i.exec(d),x=m?m.index+m[0].length:0;d=d.slice(0,x)+v+d.slice(x)}}return d})}catch(d){if(d instanceof W)throw d;let v=d instanceof Error?d.message:String(d),m=new ae(`Template processing failed: ${v}`,l,void 0,void 0,s.substring(0,200)+(s.length>200?"...":""));if(j.log(m,{filePath:l,context:e}),wn.logDetailedError(m,{filePath:l,template:s.substring(0,500)}),T()&&!a.debug)console.error(`[stx] ${ce.relative(process.cwd(),l)||l}: ${m.message}`);if(a.debug)throw m;return li.createFallbackContent("Template Processing",m)}}async function ys(s,e,l,a,g){let n=process.cwd(),d={...a,partialsDir:a.partialsDir&&!ce.isAbsolute(a.partialsDir)?ce.resolve(n,a.partialsDir):a.partialsDir,componentsDir:a.componentsDir&&!ce.isAbsolute(a.componentsDir)?ce.resolve(n,a.componentsDir):a.componentsDir,layoutsDir:a.layoutsDir&&!ce.isAbsolute(a.layoutsDir)?ce.resolve(n,a.layoutsDir):a.layoutsDir},v=d,m=s;await xs(l,e),ws(e,v),m=await Se(()=>zt(m,e,l,v),m,(O)=>{j.log(O,{filePath:l,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${l}: ${O.message}`)}),m=m.replace(/\{\{--[\s\S]*?--\}\}/g,"");let x=pe(m,Oe,(O,L)=>`\x00STX_HTML_COMMENT_${L}\x00`);m=x.output;let b=x.tokens,w=(O)=>b.length===0?O:O.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(L,B)=>b[Number(B)]??""),k="\x00STX_ESCAPED_AT\x00",C="\x00STX_ESC_MUSTACHE_OPEN\x00",D="\x00STX_ESC_MUSTACHE_CLOSE\x00";m=m.replace(/@@/g,k),m=m.replace(/@\{\{([\s\S]*?)\}\}/g,(O,L)=>`${C}${L}${D}`),m=Jt(m),m=await an(m,l,g);let A={};m=Zr(m,A);let M={...e.__sections||{}},I="",N=gt(mt(s)),q=/@nolayout\b/.test(m)||N===!1;if(/@nolayout\b/.test(m))m=m.replace(/@nolayout\b\s*/g,"");let V=m.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(V)I=V[1],m=m.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof N==="string"){if(I=N,!/@section\s*\(/.test(m))m=`@section('content')
|
|
1570
1570
|
${m.trim()}
|
|
1571
|
-
@endsection`}if(!I&&!q&&v.defaultLayout){let O=xn(m),L=/@section\s*\(/.test(m);if(!O||L){let B="",z=ce.dirname(l),
|
|
1571
|
+
@endsection`}if(!I&&!q&&v.defaultLayout){let O=xn(m),L=/@section\s*\(/.test(m);if(!O||L){let B="",z=ce.dirname(l),K=v.layoutsDir?ce.dirname(v.layoutsDir):process.cwd();for(let Y=0;Y<20;Y++){let ee=ce.join(z,"_layout.stx");if(await r(ee)){B=ee;break}let te=ce.dirname(z);if(te===z||te.length<K.length)break;z=te}if(B)I=B;else if(v.layoutsDir){let Y=ce.isAbsolute(v.layoutsDir)?v.layoutsDir:ce.resolve(process.cwd(),v.layoutsDir),ee=ce.join(Y,`${v.defaultLayout}.stx`);if(await r(ee))I=ee}if(I&&!L)m=`@section('content')
|
|
1572
1572
|
${m.trim()}
|
|
1573
|
-
@endsection`}}if(I&&m.includes("<script")){let O=X(m),L=O.scripts.map((B)=>gn(B,l)??B);m=hr(O.output,L)}if(m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,L,B)=>(M[L]=B,"")),m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,L,B)=>{if(/^(['"]).*\1$/.test(B.trim()))return O;try{let z=u(B.trim(),e);if(z===void 0)return O;let Y=(e.__stx_inline_section_values??=[]).push(z)-1;return M[L]=`{{ __stx_inline_section_values[${Y}] }}`,""}catch{return O}}),m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,L,B)=>{if(B.includes("@parent"))M[L]=B.replace("@parent",_e);else M[L]=B.trim();return""}),e.__sections=M,m=m.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,L,B)=>M[L]||B||""),!("slot"in e)||e.slot===void 0)m=m.replace(/\{\{\s*slot\s*\}\}/g,()=>M.content||"");if(m=Qr(m,A),I){let O=[],L=X(m),B=pe(L.output,un,(z,
|
|
1573
|
+
@endsection`}}if(I&&m.includes("<script")){let O=X(m),L=O.scripts.map((B)=>gn(B,l)??B);m=hr(O.output,L)}if(m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,L,B)=>(M[L]=B,"")),m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,L,B)=>{if(/^(['"]).*\1$/.test(B.trim()))return O;try{let z=u(B.trim(),e);if(z===void 0)return O;let Y=(e.__stx_inline_section_values??=[]).push(z)-1;return M[L]=`{{ __stx_inline_section_values[${Y}] }}`,""}catch{return O}}),m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,L,B)=>{if(B.includes("@parent"))M[L]=B.replace("@parent",_e);else M[L]=B.trim();return""}),e.__sections=M,m=m.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,L,B)=>M[L]||B||""),!("slot"in e)||e.slot===void 0)m=m.replace(/\{\{\s*slot\s*\}\}/g,()=>M.content||"");if(m=Qr(m,A),I){let O=[],L=X(m),B=pe(L.output,un,(z,K)=>`\x00STX_ORPHAN_STYLE_${K}\x00`);if(m=B.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(z,K,Y)=>{let ee=K==="SCRIPT"?gn(L.scripts[Number(Y)],l):B.tokens[Number(Y)];if(ee)O.push(ee);return""}),O.length>0){let z=O.join(`
|
|
1574
1574
|
`);M.content=M.content?`${M.content}
|
|
1575
|
-
${z}`:z,e.__sections=M}}if(I)try{let O;if(ce.isAbsolute(I))O=I,g.add(I);else O=await Se(()=>hn(I,l,d,g),null,()=>{throw new ae(`Failed to resolve layout path: ${I}`,l,void 0,void 0,`Layout referenced from ${l}`)});if(!O){let ee=(re)=>{if(!re)return[];try{let ie=ce.isAbsolute(re)?re:ce.resolve(process.cwd(),re);return fs.readdirSync(ie).filter((le)=>le.endsWith(".stx")).map((le)=>le.replace(/\.stx$/,""))}catch{return[]}},te=[...ee(d.layoutsDir),...ee(d.fallbackLayoutsDir)].filter((re,ie,le)=>le.indexOf(re)===ie).sort(),ue=`Layout not found: ${I} (referenced from ${l})`+(te.length>0?`. Available layouts: ${te.join(", ")}`:d.layoutsDir?`. No .stx layouts found in ${d.layoutsDir}`:"");if(j.log(Error(ue),{layoutPath:I,filePath:l,available:te},"error"),console.error(`[stx] ${ue}`),d.debug)throw new ae(ue,l);return m}let L=await Se(()=>Bun.file(O).text(),"",()=>{throw new ae(`Failed to read layout file: ${O}`,l,void 0,void 0,"Layout content could not be loaded")});L=cn(L,O);let B=L.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(B){if(d.debug)console.log(`Found nested layout: ${B[1]} in ${O}`);let ee={},te=L.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ie,le,be)=>(ee[le]=be.trim(),""));for(let[ie,le]of Object.entries(ee))if(M[ie]&&M[ie].includes(_e)){let be=M[ie].indexOf(_e);M[ie]=M[ie].slice(0,be)+le+M[ie].slice(be+_e.length)}else if(!M[ie])M[ie]=le;let ue={...e,__sections:M},re=`@layout('${B[1]}')${te}`;return await i(re,ue,O,d,g)}let z=L.replace(/\{\{--[\s\S]*?--\}\}/g,""),
|
|
1576
|
-
${m}`,w(m)}catch(O){if(O instanceof W)throw O;throw new ae(`Error processing layout ${I}: ${O instanceof Error?O.message:String(O)}`,l)}return w(await vn(m,e,l,d,g))}function vs(s,e){return s.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,a,g)=>{let n=e[a];if(n!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(n))return n}return g||""})}function ws(s,e){if(s.__stx_sfc_mode=!0,s.__stx_options=e,e.buildMode)s.__stx_buildMode=e.buildMode;let l=e.envPrefix||"STX_PUBLIC_",a={};for(let[g,n]of Object.entries(process.env))if(g.startsWith(l)&&n!==void 0)a[g]=n;s.$env=a}async function xs(s,e){await Se(()=>Kt(s,e),void 0,(l)=>{j.log(l,{filePath:s,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${s}: ${l.message}`)})}var ot="data-stx-source";function gn(s,e){if(!s)return s;let l=/^<script\b([^>]*)>/i.exec(s);if(!l||!/\bserver\b/.test(l[1])||l[1].includes(ot))return s;return`<script ${ot}="${encodeURIComponent(e)}"${s.slice(7)}`}function ks(s){let e=new RegExp(`${ot}="([^"]*)"`).exec(s);return e?decodeURIComponent(e[1]):void 0}function mn(s){return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function yn(s,e,l){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a <script server> ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${mn(s)}</span><span style="display:block;margin-top:4px">${mn(l)}</span></div>`}async function Ss(s,e,l,a){let{scanScriptTags:g}=await o("stx/signal-processing",()=>import("./chunk-
|
|
1575
|
+
${z}`:z,e.__sections=M}}if(I)try{let O;if(ce.isAbsolute(I))O=I,g.add(I);else O=await Se(()=>hn(I,l,d,g),null,()=>{throw new ae(`Failed to resolve layout path: ${I}`,l,void 0,void 0,`Layout referenced from ${l}`)});if(!O){let ee=(re)=>{if(!re)return[];try{let ie=ce.isAbsolute(re)?re:ce.resolve(process.cwd(),re);return fs.readdirSync(ie).filter((le)=>le.endsWith(".stx")).map((le)=>le.replace(/\.stx$/,""))}catch{return[]}},te=[...ee(d.layoutsDir),...ee(d.fallbackLayoutsDir)].filter((re,ie,le)=>le.indexOf(re)===ie).sort(),ue=`Layout not found: ${I} (referenced from ${l})`+(te.length>0?`. Available layouts: ${te.join(", ")}`:d.layoutsDir?`. No .stx layouts found in ${d.layoutsDir}`:"");if(j.log(Error(ue),{layoutPath:I,filePath:l,available:te},"error"),console.error(`[stx] ${ue}`),d.debug)throw new ae(ue,l);return m}let L=await Se(()=>Bun.file(O).text(),"",()=>{throw new ae(`Failed to read layout file: ${O}`,l,void 0,void 0,"Layout content could not be loaded")});L=cn(L,O);let B=L.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(B){if(d.debug)console.log(`Found nested layout: ${B[1]} in ${O}`);let ee={},te=L.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ie,le,be)=>(ee[le]=be.trim(),""));for(let[ie,le]of Object.entries(ee))if(M[ie]&&M[ie].includes(_e)){let be=M[ie].indexOf(_e);M[ie]=M[ie].slice(0,be)+le+M[ie].slice(be+_e.length)}else if(!M[ie])M[ie]=le;let ue={...e,__sections:M},re=`@layout('${B[1]}')${te}`;return await i(re,ue,O,d,g)}let z=L.replace(/\{\{--[\s\S]*?--\}\}/g,""),K=Zr(z,A),Y={};return K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ee,te,ue)=>(Y[te]=ue.trim(),`@slot('${te}')`)),K=K.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(ee,te,ue)=>{if(M[te]){let re=M[te];if(re.includes(_e)){let ie=Y[te]||"",le=re.indexOf(_e);re=re.slice(0,le)+ie+re.slice(le+_e.length)}return re}return ue||""}),K=vs(K,M),K=K.replace(/\{\{\s*slot\s*\}\}/g,()=>M.content||""),K=Qr(K,A),e.__originalFilePath=l,m=await vn(K,e,O,d,g),m=`<!-- stx-layout: ${I} -->
|
|
1576
|
+
${m}`,w(m)}catch(O){if(O instanceof W)throw O;throw new ae(`Error processing layout ${I}: ${O instanceof Error?O.message:String(O)}`,l)}return w(await vn(m,e,l,d,g))}function vs(s,e){return s.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,a,g)=>{let n=e[a];if(n!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(n))return n}return g||""})}function ws(s,e){if(s.__stx_sfc_mode=!0,s.__stx_options=e,e.buildMode)s.__stx_buildMode=e.buildMode;let l=e.envPrefix||"STX_PUBLIC_",a={};for(let[g,n]of Object.entries(process.env))if(g.startsWith(l)&&n!==void 0)a[g]=n;s.$env=a}async function xs(s,e){await Se(()=>Kt(s,e),void 0,(l)=>{j.log(l,{filePath:s,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${s}: ${l.message}`)})}var ot="data-stx-source";function gn(s,e){if(!s)return s;let l=/^<script\b([^>]*)>/i.exec(s);if(!l||!/\bserver\b/.test(l[1])||l[1].includes(ot))return s;return`<script ${ot}="${encodeURIComponent(e)}"${s.slice(7)}`}function ks(s){let e=new RegExp(`${ot}="([^"]*)"`).exec(s);return e?decodeURIComponent(e[1]):void 0}function mn(s){return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function yn(s,e,l){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a <script server> ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${mn(s)}</span><span style="display:block;margin-top:4px">${mn(l)}</span></div>`}async function Ss(s,e,l,a){let{scanScriptTags:g}=await o("stx/signal-processing",()=>import("./chunk-w7rczhn5.js")),n=[],d=!T()&&!Sn();for(let m of g(s)){let x=m.attrs;if(!/\bserver\b/.test(x))continue;let b=m.start+m.fullMatch.indexOf(">")+1,w=kn(s,b);if(w===-1)continue;let k=s.slice(b,w);if(!k.trim())continue;let C=ks(x)??l,D={index:m.start,length:w+9-m.start};try{let{extractVariables:A}=await o("stx/variable-extractor",()=>import("./chunk-62qjy45q.js"));await A(k,e,C,{preserveExisting:!0,onFailure:(M)=>{if(M.kind==="unknown")return;if(a?.onServerScriptError?.({sourcePath:C,kind:M.kind,message:M.message}),!d)return;n.push({...D,markup:yn(C,M.kind,M.message)})}})}catch(A){let M=A instanceof Error?A:Error(String(A));if(j.log(M,{filePath:C,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${C}: ${M.message}`),d)n.push({...D,markup:yn(C,"unknown",M.message)})}}if(n.length===0)return s;let v=s;for(let m of n.sort((x,b)=>b.index-x.index))v=v.slice(0,m.index)+m.markup+v.slice(m.index+m.length);return v}async function $s(s,e,l){try{let{interpolateScriptsInTemplate:a}=await o("stx/expressions",()=>import("./chunk-2xp44gz3.js"));return a(s,e,{skipServer:!0})}catch(a){let g=a instanceof Error?a:Error(String(a));return j.log(g,{filePath:l,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${l}: ${g.message}`),s}}async function vn(s,e,l,a,g){let n=s,d=a;if(n=await Ss(n,e,l,a),n=await Bt(n,e,l),n=await Ft(n,e,l),n=await $s(n,e,l),n=await At(n,e,l,d),xe(n))n=Ro(n,e),n=ss(n,e),n=rs(n,e);n=Ao(n);let{processStreamDirectives:v}=await o("stx/streaming",()=>import("./chunk-n0dajrzk.js"));n=v(n,e),n=nr(n,e,l,d,!0),n=await en(n,e,l,d,g),n=await ts(n,e,l,d,g),n=Xa(n,e,l,d);let{processDeferDirectives:m}=await o("stx/defer",()=>import("./chunk-dhdt7e54.js"));n=m(n,e,l);let{processTeleportDirectives:x}=await o("stx/teleport",()=>import("./chunk-w2h6nn70.js"));n=x(n,e,l);let{processTransitionDirectives:b,processTransitionAttributes:w}=await o("stx/transitions",()=>import("./chunk-g6wd49b5.js"));n=b(n,e,l),n=w(n);let{processErrorBoundaryDirectives:k,stripRenderFailedMarkers:C}=await o("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));n=k(n,e,l),n=C(n);let{processSuspenseDirectives:D}=await o("stx/suspense",()=>import("./chunk-r6bc2q44.js"));n=D(n,e,l);let{processAsyncDirectives:A}=await o("stx/async-components",()=>import("./chunk-bcr8sq50.js"));n=A(n,e,l);let{processKeepAliveDirectives:M}=await o("stx/keep-alive",()=>import("./chunk-h8kbcz9t.js"));n=M(n,e,l);let{processVirtualListDirectives:I,processVirtualGridDirectives:N,processInfiniteListDirectives:q}=await o("stx/virtual-scrolling",()=>import("./chunk-4fxg20je.js"));n=I(n,e,l),n=N(n,e,l),n=q(n,e,l);let{processPartialHydrationDirectives:V,processStaticDirectives:O}=await o("stx/partial-hydration",()=>import("./chunk-t7mbaf69.js"));n=V(n,e,l),n=O(n);let{processComputedDirectives:L,processWatchDirectives:B}=await o("stx/computed",()=>import("./chunk-1xdzcy9d.js"));n=L(n,e,l),n=B(n,e,l);let{processFormValidationDirectives:z}=await o("stx/forms-validation",()=>import("./chunk-n3kbyt3h.js"));n=z(n,e,l);let{processHeadDirective:K,processTitleDirective:Y,processMetaDirective:ee,resetHead:te}=await o("stx/head",()=>import("./chunk-rwjgpmrw.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)te();let ue=K(n);if(n=ue.content,ue.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${ue.headContent}
|
|
1577
1577
|
`;if(n=Y(n,e),n=ee(n,e,l),n=Xt(n),n=Co(n,e),n=Ct(n),n=Ut(n),n=await Yr(n,e,l,d,g),n=await ts(n,e,l,d,g),e.__stxProcessingDepth===1)n=Tc(n,e);if(n=n.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),n=Zo(n),n=se(n,e,l),n=Jr(n),n=Sc(n,e,{filePath:l,buildMode:d.buildMode}),n=Eo(n,e),n=To(n,e),n=ze(n,e),n=Nt(n,e),n=Ht(n,e),n=await bt(n,e,l,d),n=await Ya(n,e,l),n=await Za(n,e,l,d),n=Qa(n,e,l,d),n=Lo(n,e,l,d),n=jo(n,e,l),n=Bo(n,e,l,d),n=_t(n,e,l,d),n=Rs(n,e),n=As(n),n=kc(n),!d.skipEventDirectives)n=dc(n,e,l);if(n=vt(n,e,l),d.debug){let F=/\bx-data\s*=/.test(n),U=ns(s);if(F&&U)console.warn(`[stx] ${l}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
1578
1578
|
Both work on the same page, but they manage separate scopes.
|
|
1579
1579
|
Prefer signals (state/derived/effect) for new components.`)}n=Ua(n,e),n=await S(n,e,l),n=_c(n),n=Cc(n),n=pt(n);let{processXElementDirectives:re}=await o("stx/x-element",()=>import("./chunk-zhxdpzga.js"));n=re(n);let ie=e.__originalFilePath||l,le=De(e);if(n=await Po(n,d,ie,le),n=Ot(n,e),n=await Wt(n,e,l,d),d.media?.image?.autoSiblings){let F=d.publicDir||"public",{rewriteImagesWithSiblings:U}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-9736003n.js"));n=await U(n,{publicDir:F})}if(d.seo?.enabled)n=Fo(n,e,d);let be=(F,U,J=!0)=>{if(!U)return F;let me=U.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),ne=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(F),fe=ne?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(ne[0]):null;if(me&&ne&&fe){if(J){let Te=ne.index+fe.index;F=F.slice(0,Te)+me[0]+F.slice(Te+fe[0].length)}if(U=U.replace(me[0],"").trim(),!U)return F}if(/<\/head>/i.test(F))return F.replace(/<\/head>/i,`${U}
|
|
@@ -1587,6 +1587,6 @@ ${lt()}
|
|
|
1587
1587
|
`+Te}else n=n.replace("</head>",`${U}
|
|
1588
1588
|
</head>`)}else if(n.includes("<body"))n=n.replace(/<body([^>]*)>/,`<body$1>
|
|
1589
1589
|
${U}`);else n=U+`
|
|
1590
|
-
`+n}{let{scanScriptTags:F}=await o("stx/signal-processing",()=>import("./chunk-
|
|
1591
|
-
`+n.slice(J)}e.__stx_event_bindings=[]}}if(!ye(n)&&qa(n))n=await or(n,d);if(n=
|
|
1590
|
+
`+n}{let{scanScriptTags:F}=await o("stx/signal-processing",()=>import("./chunk-w7rczhn5.js")),U=[];for(let J of F(n)){if(!/\bserver\b/i.test(J.attrs))continue;let me=J.start+J.fullMatch.indexOf(">")+1,ne=kn(n,me);if(ne===-1)continue;let fe=ne+9;while(fe<n.length&&/\s/.test(n[fe]))fe++;U.push({start:J.start,end:fe})}if(U.length>0){let J=Array(U.length+1),me=0;for(let ne=0;ne<U.length;ne++){let{start:fe,end:Te}=U[ne];J[ne]=n.slice(me,fe),me=Te}J[U.length]=n.slice(me),n=J.join("")}}let at=Ts(n,l);if(at.hasScoped)n=at.html;let Rn=e.__stx_event_bindings||[],Ke=!1,ct=[],Mn=/\s:[a-z][\w.-]*\s*=/.test(n),{scanScriptTags:Dn}=await o("stx/signal-processing",()=>import("./chunk-w7rczhn5.js"));for(let F of Dn(n,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))ct.push({match:F.fullMatch,attrs:F.attrs,content:F.body});for(let{match:F,attrs:U,content:J}of ct){Ke=!0;let me=J;Ie(J,l,a.strict,e.__originalFilePath);let ne=await Me(J,{eventBindings:Rn,attrs:U,hasColonDirectives:Mn,templateContent:s,filePath:l,projectRoot:process.cwd(),production:gi(a.buildMode,a.minifyClient),serverData:le});n=n.replace(F,()=>ne)}if(Ke)e.__stx_event_bindings=[];if(!Ke&&e.__stxProcessingDepth===1){let F=e.__stx_event_bindings||[];if(F.length>0){let U=qo(F);if(U){let J=n.lastIndexOf("</body>");n=J===-1?n+U:n.slice(0,J)+U+`
|
|
1591
|
+
`+n.slice(J)}e.__stx_event_bindings=[]}}if(!ye(n)&&qa(n))n=await or(n,d);if(n=Ka(n),d.csp?.enabled&&d.csp.useNonce&&typeof e.cspNonce==="string")n=Et(n,e.cspNonce);return n}
|
|
1592
1592
|
export{mt,Re,Fa,Xr,vo,wo,Zn,i};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{gf,ts}from"./chunk-
|
|
2
|
+
import{gf,ts}from"./chunk-nd9rs768.js";import"./chunk-xbbxa1t8.js";import"./chunk-7dc3n69c.js";import"./chunk-8v2vbc4y.js";import{br}from"./chunk-fgjp28yp.js";import"./chunk-8rvdpsjw.js";import"./chunk-wp6q0geg.js";import{nt}from"./chunk-xyyt8v1r.js";import"./chunk-zn3c0ew5.js";import"./chunk-wt18wv6x.js";export{nt as freeIdentifiers,ts as processComponents,gf as processESImports,br as rendersAsElement};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{f,d}from"./chunk-xyyt8v1r.js";import{J,I,p}from"./chunk-
|
|
2
|
+
import{f,d}from"./chunk-xyyt8v1r.js";import{J,I,p}from"./chunk-fgjp28yp.js";function z(t,o){let i=1,r=o,e="<template",n="</template";while(r<t.length&&i>0){let s=t.indexOf("<",r);if(s===-1)break;if(r=s,t.startsWith(e,r)&&(r+e.length>=t.length||/[\s>\/]/.test(t[r+e.length]))){i++,r+=e.length;continue}if(t.startsWith(n,r)){let a=t.indexOf(">",r+n.length);if(a!==-1){if(i--,i===0)return a+1;r=a+1;continue}}r++}return i===0?r:-1}var N=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function k(t,o){let i=null;for(let r=o;r<t.length;r++){let e=t[r];if(i){if(e==="\\"){r++;continue}if(e===i)i=null;continue}if(e==='"'||e==="'"){i=e;continue}if(e===">")return r+1}return-1}function B(t,o,i){let r=o.toLowerCase(),e=1,n=i;while(n<t.length){let s=t.indexOf("<",n);if(s===-1)return-1;if(t.startsWith("<!--",s)){let g=t.indexOf("-->",s+4);n=g===-1?t.length:g+3;continue}let a=k(t,s+1);if(a===-1)return-1;let u=t.slice(s,a),c=u.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(c&&c[2].toLowerCase()===r){if(c[1]==="/"){if(e--,e===0)return a}else if(!/\/\s*>$/.test(u))e++}n=a}return-1}function Z(t){let o=[],i=[],r=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),u=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!u){e=s;continue}let c=u[2].toLowerCase();if(u[1]==="/"){let l=i.lastIndexOf(c);if(l!==-1)i.splice(l);e=s;continue}let g=/\/\s*>$/.test(a),m=i.length===0?a.match(r):null;if(m){let l=m[1]||m[2],h=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),S=g||N.has(c)?-1:B(t,c,s);if(S===-1)o.push({start:n,end:s,slotName:l,element:h}),e=s;else o.push({start:n,end:S,slotName:l,element:h+t.slice(s,S)}),e=S;continue}if(!g&&!N.has(c)){if(i.push(c),c==="script"||c==="style"){let l=t.toLowerCase().indexOf(`</${c}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function L(t){let o=[],i=[],r=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),u=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!u){e=s;continue}let c=u[1]==="/",g=u[2].toLowerCase();if(c){let l=i.lastIndexOf(g);if(l!==-1)i.splice(l);e=s;continue}if(g==="template"&&i.length===0){let l=a.match(r);if(l){let h=z(t,s);if(h!==-1){let S=l[1]||l[2]||l[3];o.push({start:n,end:h,slotName:S,content:t.slice(s,h-11).trim(),propsBinding:l[4]||void 0}),e=h;continue}}}if(!/\/\s*>$/.test(a)&&!N.has(g)){if(i.push(g),g==="script"||g==="style"){let l=t.toLowerCase().indexOf(`</${g}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function kl(t){let o={default:"",named:new Map},i=t,r=L(t);for(let n of r)o.named.set(n.slotName,{name:n.slotName,content:n.content,propsBinding:n.propsBinding});r.sort((n,s)=>s.start-n.start);for(let n of r)i=i.slice(0,n.start)+i.slice(n.end);let e=Z(i);for(let n of e){let s=o.named.get(n.slotName);if(s)s.content+=n.element;else o.named.set(n.slotName,{name:n.slotName,content:n.element})}for(let n=e.length-1;n>=0;n--){let s=e[n];i=i.slice(0,s.start)+i.slice(s.end)}return o.default=i.trim(),o}function zg(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),i=o?o[1]:"",r={},e=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,n;while((n=e.exec(t))!==null)r[n[1]]=n[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),a=s?s[1].trim():"";return{name:i,props:r,defaultContent:a}}async function _l(t,o,i,r){if(!t)return i;let e=t.content;if(t.propsBinding&&Object.keys(o).length>0){let n=t.propsBinding.trim(),s={...r},a=new Set,u=new Set;if(n.startsWith("{")&&n.endsWith("}")){let c=n.slice(1,-1).split(",").map((g)=>g.trim()).filter(Boolean);for(let g of c){let[m,l]=g.split(":").map((S)=>S.trim()),h=l||m;if(s[h]=o[m],o[m]!==void 0)u.add(h);else a.add(h)}}else if(s[n]=o,Object.values(o).some((c)=>c===void 0))a.add(n);else u.add(n);e=j(e,s,a,u)}return e}function j(t,o,i,r){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(e,n)=>{try{let s=n.trim();if(I(s,i))return e;if(Array.isArray(o.__stx_preserved_client_expressions)&&o.__stx_preserved_client_expressions.includes(s)&&!I(s,r))return e;let a=_(s,o);if(a===void 0)return e;return p(String(a??""))}catch{return`{{ ${n} }}`}})}function _(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let r=t.split("."),e=o;for(let n of r)if(e&&typeof e==="object"&&n in e)e=e[n];else return;return e}let i=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(i){let[,r,e,n]=i,s=o[r],a=parseInt(n,10);if(typeof s==="number")switch(e){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":return s/a}}try{if(!f(t))return;return d(t,Object.keys(o))(...Object.values(o))}catch{return}}async function Cl(t,o,i,r){let e=t;e=await W(e,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(a,u,c,g)=>{let m=o.named.get(u),l=g?.trim()||"",h=c||"",S={},E=[],C=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,b;while((b=C.exec(h))!==null){let w=b[1],x=b[2];S[w]=_(x,i),E.push([w,x])}if(r!==void 0&&m?.propsBinding&&Object.values(S).some((w)=>w===void 0)){let w=m.propsBinding.trim(),x=J(`${w} in []`),y="__stx_slot_props";while(x.includes(y))y+="_";let M=E.map(([A,P])=>{let O=S[A],R;try{R=O===void 0?void 0:JSON.stringify(O)}catch{}return`${JSON.stringify(A)}:(${R??P})`}).join(","),v=p(JSON.stringify({binding:w,names:x,owner:r}));return`<template :for="${p(`${y} in [{${M}}]`)}" data-stx-slot-binding="${encodeURIComponent(w)}" data-stx-slot-scope="${v}">${m.content}</template>`}return await _l(m,S,l,i)});let s=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return e=e.replace(s,(a,u,c)=>{if(/\bname\s*=/.test(u||""))return a;let g=c?.trim()||"";return o.default||g}),e}async function W(t,o,i){let r=[],e=[];t.replace(o,(a,...u)=>{let c=u[u.length-2];return e.push({match:a,index:c}),r.push(i(a,...u.slice(0,-2))),a});let n=await Promise.all(r),s=t;for(let a=e.length-1;a>=0;a--){let{match:u,index:c}=e[a];s=s.slice(0,c)+n[a]+s.slice(c+u.length)}return s}function Hg(t){let o=kl(t);return{defaultSlot:o.default,namedSlots:o.named}}async function Vg(t,o,i,r,e){return await Cl(t,{default:o,named:i},r,e)}
|
|
3
3
|
export{kl,zg,_l,Cl,Hg,Vg};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{we,ei,ti,Bf,Ot,Ac,ni,Pc,vh,De,mn,Me}from"./chunk-
|
|
2
|
+
import{we,ei,ti,Bf,Ot,Ac,ni,Pc,vh,De,mn,Me}from"./chunk-fgjp28yp.js";import{Lc,s}from"./chunk-vstvadc2.js";import"./chunk-8rvdpsjw.js";import"./chunk-wp6q0geg.js";import"./chunk-xyyt8v1r.js";import"./chunk-zn3c0ew5.js";import"./chunk-wt18wv6x.js";export{we as BROWSER_CORE_IMPORTS,Bf as STX_AUTO_IMPORTS,ei as extractAndStripCssImports,De as extractBridgeData,Lc as findInterpolationEnd,Pc as generateAutoImportDestructuring,vh as generateBrowserAutoImportDestructuring,mn as generateServerDataBridge,Ot as injectBrowserCoreAutoImports,Me as processClientScript,ni as referencesName,ti as renderVendorStyleTags,s as stripCommentsAndLiterals,Ac as transformAutoImports};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-wt18wv6x.js";import"./chunk-zn3c0ew5.js";import{w,x,_,Y}from"./chunk-fgjp28yp.js";import"./chunk-xyyt8v1r.js";import"./chunk-wp6q0geg.js";import"./chunk-8rvdpsjw.js";import f from"path";var b=["applyOfflineUpdate","broadcast","cacheMedia","calculateDistance","canNotify","clearCookies","clearFetchCache","clearOfflineData","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","onOfflineUpdateReady","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAmbientSound","useAnimationFrame","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBreathPacer","useBroadcastChannel","useBroadcastStream","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useOutbox","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],M=new Set(b);var l=new Map,h=w(64),S=new Set,k=0,E=new Set(b);function T(){l.clear(),h.clear()}function R(n){let o=new Map;for(let r of n){let a=f.basename(r);if(a.endsWith(".d.ts"))continue;let t=a.replace(/\.[jt]s$/,"");if(t==="index")continue;if(t===a)continue;let i=o.get(t);if(i&&!i.endsWith(".js"))continue;o.set(t,r)}return[...o.values()].sort()}function P(n,o){let r=o.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${r}\\b`).test(n)}function I(n){if(!n)return[];let o=x(n,k),r=h.get(o);if(r)return r.slice();let a=n.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),t=[];for(let i of E){if(S.has(i))continue;let u=i.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${u}\\s*\\(`).test(a))t.push(i)}return t.sort(),h.set(o,t),t.slice()}async function A(n,o){let r=I(n);if(r.length===0)return null;let a=o??f.join(import.meta.dir,"composables"),t=`${a}\x00${r.join(",")}`,i=l.get(t);if(i!==void 0)return i||null;let u=Y({loader:"ts",target:"browser",define:_()}),O=new Set(r),m=[],d=new Set,p=[];try{let s=new Bun.Glob("*.{ts,js}");for await(let e of s.scan({cwd:a,absolute:!0}))p.push(e)}catch{return l.set(t,""),null}p=R(p);for(let s of p){let e;try{e=await Bun.file(s).text()}catch{continue}let g=[];try{g=u.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!g.some((c)=>O.has(c)))continue;try{e=e.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^import\s+type\s+.*$/gm,""),e=e.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),e=e.replace(/^export\s+default\s+/gm,""),e=e.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),m.push(`// ${f.basename(s).replace(/\.[jt]s$/,"")}
|
|
3
3
|
${u.transformSync(e).trim()}`);for(let c of g)d.add(c)}catch(c){console.warn(`[stx] framework composable ${f.basename(s)} could not be bundled:`,c)}}let y=r.filter((s)=>!d.has(s)&&!P(n,s));if(y.length>0)console.warn(`[stx] could not bundle ${y.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(m.length===0)return l.set(t,""),null;let C=[...d].map((s)=>` try { if (!(${JSON.stringify(s)} in __s)) { __s[${JSON.stringify(s)}] = ${s}; if (!(${JSON.stringify(s)} in window)) window[${JSON.stringify(s)}] = ${s}; } } catch (e) {}`).join(`
|
|
4
4
|
`),v=`<script data-stx-scoped data-stx-run="always" data-stx-framework-composables>
|
|
5
5
|
;(function(){
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{k}from"./chunk-
|
|
2
|
+
import{k}from"./chunk-wt18wv6x.js";import{we,At,Ko,Go,gc,mc,hc,yc,Es,Jo,bc,vc,wc,gn}from"./chunk-fgjp28yp.js";import{a}from"./chunk-prhws9sn.js";import{ro}from"./chunk-hjq5463c.js";import{l}from"./chunk-5n4qg8za.js";import{existsSync as M,readFileSync as K}from"fs";import h from"path";var ge=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),ee=gn.filter((e)=>!ge.has(e)).sort(),te=[...k].sort(),me=[...new Set([...ee,...te])].sort(),he=new Set(ee),be=new Set(te),ye=new Set(me),Y=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function xe(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 ne(e,t){let s=[];for(let u of t){if(u.offset===void 0)continue;let i=u.kind==="server"?he:be;Y.lastIndex=0;for(let c of u.code.matchAll(Y)){let g=c.index+c[0].indexOf("{")+1;for(let m of c[1].matchAll(/[^,]+/g)){let x=m[0];if(/^\s*type\s/.test(x))continue;let y=/^\s*([A-Za-z_$][\w$]*)/.exec(x);if(!y)continue;let r=y[1];if(!ye.has(r)||i.has(r))continue;let f=u.offset+g+m.index+y[0].length-r.length,p=e.slice(0,f),w=p.split(`
|
|
3
3
|
`).length;s.push({line:w,column:f-(p.lastIndexOf(`
|
|
4
4
|
`)+1)+1,offset:f,length:r.length,name:r,kind:u.kind,message:xe(r,u.kind)})}}}return s}import T from"path";var Se="@stacksjs/stx-typescript-plugin";function ke(e,t){let s=T.resolve(e);for(;;){let u=T.join(s,"tsconfig.json");if(t(u))return u;let i=T.dirname(s);if(i===s)return;s=i}}function ie(e,t,s){let u=ke(e,s);if(!u)return;let i=new Set,c=(g)=>{if(i.has(g))return;i.add(g);let m=t(g);if(!m)return;let x=m.compilerOptions?.plugins;if(Array.isArray(x)){let r=x.find((p)=>p?.name===Se),f=Array.isArray(r?.libs)?r.libs.filter((p)=>typeof p==="string"):[];return r?{configPath:g,libs:f.map((p)=>T.resolve(T.dirname(g),p))}:null}let y=typeof m.extends==="string"?[m.extends]:Array.isArray(m.extends)?m.extends:[];for(let r of[...y].reverse()){if(typeof r!=="string"||!r.startsWith("."))continue;let f=T.resolve(T.dirname(g),r.endsWith(".json")?r:`${r}.json`),p=c(f);if(p!==void 0)return p}return};return c(u)??void 0}function yl(e,t="",s=""){let u=e.startLine>1?`
|
|
5
|
-
`.repeat(e.startLine-1):"",i=Jo(e)+Ko(
|
|
5
|
+
`.repeat(e.startLine-1):"",i=Jo(e)+Go(Ko(e.code)),c=e.kind==="client"||e.kind==="plain"?hc(t,e.code):"";return Es(`${u+i}
|
|
6
6
|
${c}
|
|
7
7
|
export {}
|
|
8
8
|
`,s)}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 ve(e){if(e.length===0)return"";let t=["// Generated \u2014 the composables the runtime publishes as bare globals."],s=new Set(k),u=[];for(let{file:i,names:c}of e){let g=JSON.stringify(i.replace(/\\/g,"/").replace(/\.ts$/,""));u.push(` export * from ${g}`);for(let m of c){if(s.has(m)||$e.has(m))continue;s.add(m),t.push(`declare const ${m}: typeof import(${g})[${JSON.stringify(m)}]`)}}return t.push("declare module '@composables' {",...u,"}"),t.join(`
|