@stacksjs/stx 0.2.690 → 0.2.691
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-cm8ad78x.js → chunk-0yvar2ha.js} +1 -1
- package/dist/{chunk-g9c284gf.js → chunk-11tvhxt0.js} +1 -1
- package/dist/chunk-1bpjqst8.js +2 -0
- package/dist/{chunk-5m42k74p.js → chunk-1db0zrz0.js} +1 -1
- package/dist/{chunk-yxp7jmnz.js → chunk-3dwr8pyh.js} +1 -1
- package/dist/{chunk-5mcwf93c.js → chunk-463r8dqk.js} +2 -2
- package/dist/{chunk-4f5bmy7h.js → chunk-467acz2w.js} +6 -6
- package/dist/{chunk-h176dx1q.js → chunk-5btsefqt.js} +2 -2
- package/dist/chunk-5f7vry8p.js +2 -0
- package/dist/{chunk-q3xesyn0.js → chunk-6kyhgvzh.js} +1 -1
- package/dist/chunk-7ynw1f29.js +2 -0
- package/dist/{chunk-psprkndv.js → chunk-806rdn0n.js} +1 -1
- package/dist/{chunk-c9fs966z.js → chunk-8e32860g.js} +1 -1
- package/dist/{chunk-mwmmmbxj.js → chunk-a0rymg4g.js} +4 -4
- package/dist/{chunk-sj6t3cj2.js → chunk-aw1wrygx.js} +1 -1
- package/dist/{chunk-smqgdmc4.js → chunk-ay262g2y.js} +1 -1
- package/dist/{chunk-4hbevevz.js → chunk-bkppc1rf.js} +1 -1
- package/dist/{chunk-j5127cxs.js → chunk-dg2f47za.js} +1 -1
- package/dist/{chunk-4566drka.js → chunk-dnwd04ch.js} +1 -1
- package/dist/{chunk-znhrftsf.js → chunk-e8nmm7g1.js} +1 -1
- package/dist/chunk-ez0pzhh7.js +2 -0
- package/dist/{chunk-hy4gaf8g.js → chunk-f9e5k693.js} +1 -1
- package/dist/{chunk-84vsb4v3.js → chunk-fbb68bw1.js} +1 -1
- package/dist/chunk-fvyhrmwt.js +2 -0
- package/dist/{chunk-tjwv101c.js → chunk-g5jtypvv.js} +1 -1
- package/dist/{chunk-jt9kxnva.js → chunk-h82f12we.js} +2 -2
- package/dist/{chunk-n42421az.js → chunk-hfsd13r5.js} +2 -2
- package/dist/{chunk-vvezfjt1.js → chunk-hnwcd41v.js} +1 -1
- package/dist/{chunk-91ytsvhd.js → chunk-j46gqse8.js} +1 -1
- package/dist/{chunk-43h27729.js → chunk-jg9zwx1t.js} +3 -3
- package/dist/{chunk-fk2m3xdd.js → chunk-jtbx9zgs.js} +1 -1
- package/dist/chunk-jxvyvz64.js +2 -0
- package/dist/{chunk-v7xpafs9.js → chunk-k74v03v7.js} +1 -1
- package/dist/{chunk-1k7js5nz.js → chunk-k7gcx130.js} +1 -1
- package/dist/{chunk-ppc64he4.js → chunk-k9j0cp1w.js} +1 -1
- package/dist/{chunk-s0ntt1cn.js → chunk-k9pk5yq0.js} +1 -1
- package/dist/{chunk-063y8kcp.js → chunk-kdz8yfdx.js} +1 -1
- package/dist/chunk-kkkcs6e6.js +2 -0
- package/dist/chunk-kv6z74k1.js +2 -0
- package/dist/chunk-m3sg02tk.js +2 -0
- package/dist/{chunk-jkhc0q7g.js → chunk-madrssd6.js} +1 -1
- package/dist/chunk-mc66eb1v.js +2 -0
- package/dist/{chunk-bzxfbh2x.js → chunk-mdx9fcej.js} +1 -1
- package/dist/{chunk-vjt6c16n.js → chunk-n1xyrx1a.js} +1 -1
- package/dist/{chunk-4mqq6896.js → chunk-nfh78ama.js} +5 -5
- package/dist/{chunk-67mex2d1.js → chunk-prr1meps.js} +1 -1
- package/dist/{chunk-s0vs1n7n.js → chunk-q2ph1a11.js} +1 -1
- package/dist/chunk-r82ywv0f.js +2 -0
- package/dist/{chunk-e9fmqn0g.js → chunk-smmwjt35.js} +1 -1
- package/dist/{chunk-s0226rfp.js → chunk-v2zmq70s.js} +4 -4
- package/dist/{chunk-jk0gba16.js → chunk-v4amxvbd.js} +2 -2
- package/dist/{chunk-8485q7dh.js → chunk-vhgrvw4p.js} +1 -1
- package/dist/{chunk-ejafjap5.js → chunk-vm2qnbvv.js} +1 -1
- package/dist/{chunk-ngd9dsrd.js → chunk-w91raavj.js} +1 -1
- package/dist/{chunk-nc85m4p9.js → chunk-waje9p23.js} +1 -1
- package/dist/{chunk-5gh02j5x.js → chunk-wkd5027b.js} +1 -1
- package/dist/{chunk-35cvjgj2.js → chunk-wxj9846e.js} +1 -1
- package/dist/{chunk-r86d03dv.js → chunk-xdvw04da.js} +1 -1
- package/dist/{chunk-hqzhej1p.js → chunk-y01dhmxc.js} +2 -2
- package/dist/{chunk-dsrgestd.js → chunk-yvvhgy8r.js} +5 -5
- package/dist/{chunk-1pzshxft.js → chunk-z7vpdebr.js} +1 -1
- package/dist/{chunk-a5agchz8.js → chunk-zjr0wrzw.js} +1 -1
- package/dist/cli.js +7 -7
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/native/runtime/craft-bridge.js +4 -3
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-2mf8shg5.js +0 -2
- package/dist/chunk-5443hz48.js +0 -2
- package/dist/chunk-55eek6b1.js +0 -2
- package/dist/chunk-5y61b94b.js +0 -2
- package/dist/chunk-b6vwy6bd.js +0 -2
- package/dist/chunk-b8v19j69.js +0 -2
- package/dist/chunk-nrw84rpj.js +0 -2
- package/dist/chunk-p7nkw2nr.js +0 -2
- package/dist/chunk-pj1we4mn.js +0 -2
- package/dist/chunk-twk9kr73.js +0 -2
- package/dist/chunk-ywydtzba.js +0 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import{le}from"./chunk-kypwg2ws.js";import{Be,A}from"./chunk-t6m5d64b.js";import{Sa}from"./chunk-912r15hr.js";import{c}from"./chunk-xvs84gas.js";import S from"fs";import m from"path";import{pathToFileURL as O}from"url";var E=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],P=new Set;function en(s,l={}){let o=m.resolve(s,l.dir??"server/api"),i=[],f=new Map;if(!S.existsSync(o))return i;let t=Array.from(new Bun.Glob("**/*.{ts,js,mts,mjs}").scanSync({cwd:o})).sort();for(let e of t){if(e.endsWith(".d.ts"))continue;let p=e.replace(/\.(?:ts|js|mts|mjs)$/,"").split("/"),n=p.pop(),u=n.lastIndexOf("."),d=u>=0?n.slice(u+1):"get",g=d.toUpperCase();if(!E.includes(g)||d!==d.toLowerCase())throw Error(`Unsupported API method suffix in ${e}; use ${E.map((y)=>y.toLowerCase()).join(", ")}`);if(u>=0)n=n.slice(0,u);if(n!=="index")p.push(n);let r=new Set,h=p.map((y,I)=>{let v=/^\[(\.\.\.)?([A-Za-z_]\w*)\]$/.exec(y);if(v){if(r.has(v[2])||v[1]&&I!==p.length-1)throw Error(`Invalid API parameter in ${e}`);return r.add(v[2]),`:${v[2]}${v[1]?"*":""}`}if(!/^[\w-]+$/.test(y))throw Error(`Unsupported API path segment ${y} in ${e}`);return y}),w=`/api${h.length?`/${h.join("/")}`:""}`,x=`${g} ${w.replace(/:\w+/g,":param")}`;if(f.has(x))throw Error(`Ambiguous API route ${g} ${w}: ${f.get(x)} and ${e}`);f.set(x,e);let R=m.join(o,e);P.add(m.resolve(R)),P.add(S.realpathSync(R)),i.push({pattern:w,method:g,filePath:R})}return i.sort((e,a)=>{let p=e.pattern.split("/"),n=a.pattern.split("/"),u=(d)=>d?.endsWith("*")?0:d?.startsWith(":")?1:2;for(let d=0;d<Math.max(p.length,n.length);d++){let g=u(n[d])-u(p[d]);if(g)return g}return e.pattern.localeCompare(a.pattern)||e.method.localeCompare(a.method)})}async function Ys(s,l){let o=c(s,"api-types.d.ts"),i=["// Generated by stx. Include this file in tsconfig.json.","declare module '@stacksjs/stx/api-client' {"," interface KnownApiRoutes {"];for(let t of l){let e=`./${m.relative(m.dirname(o),t.filePath).replace(/\\/g,"/")}`,{params:a}=le(t.pattern);i.push(` ${JSON.stringify(`${t.method} ${t.pattern}`)}: { params: { ${a.map((p)=>`${JSON.stringify(p)}: string`).join("; ")} }; response: Awaited<ReturnType<typeof import(${JSON.stringify(e)}).default>> }`)}i.push(" }","}","export {}","");let f=i.join(`
|
|
3
3
|
`);if(!await Bun.file(o).exists()||await Bun.file(o).text()!==f)await Bun.write(o,f);return o}async function Zs(s,l,o={}){let i=en(s,o);await Ys(s,i);let f=[];for(let t of i){let e=await Bun.build({entrypoints:[t.filePath],target:"bun",format:"esm",minify:!1,splitting:!1});if(!e.success)throw Error(`API build failed for ${t.filePath}: ${e.logs.join(`
|
|
4
|
-
`)}`);let a=e.outputs.find((u)=>u.kind==="entry-point");if(!a)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await a.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(l,n),a),f.push({...t,filePath:n})}return f}function j(s,l){let o=s.map((i)=>({route:i,...le(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,a=(r)=>r.replace(/:\w+/g,":param"),p=t.filter((r)=>a(r.route.pattern)===a(e)),n=i.method,u=p.find((r)=>r.route.method===n)??(n==="HEAD"?p.find((r)=>r.route.method==="GET"):void 0);if(!u){let r=new Set(p.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=u.regex.exec(f),g=Object.create(null);try{u.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await l(u.route);if(typeof r!=="function")throw Error(`API endpoint ${u.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function Qs(s,l){return j(l,async(o)=>(await import(O(m.resolve(s,o.filePath)).href)).default)}async function lp(s,l){if(!l)return async()=>null;let o=l===!0?{}:l,i=en(s,o);return await Ys(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=en(s,o);await Ys(s,t);let{loadStxConfig:e}=await import("./chunk-
|
|
4
|
+
`)}`);let a=e.outputs.find((u)=>u.kind==="entry-point");if(!a)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await a.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(l,n),a),f.push({...t,filePath:n})}return f}function j(s,l){let o=s.map((i)=>({route:i,...le(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,a=(r)=>r.replace(/:\w+/g,":param"),p=t.filter((r)=>a(r.route.pattern)===a(e)),n=i.method,u=p.find((r)=>r.route.method===n)??(n==="HEAD"?p.find((r)=>r.route.method==="GET"):void 0);if(!u){let r=new Set(p.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=u.regex.exec(f),g=Object.create(null);try{u.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await l(u.route);if(typeof r!=="function")throw Error(`API endpoint ${u.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function Qs(s,l){return j(l,async(o)=>(await import(O(m.resolve(s,o.filePath)).href)).default)}async function lp(s,l){if(!l)return async()=>null;let o=l===!0?{}:l,i=en(s,o);return await Ys(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=en(s,o);await Ys(s,t);let{loadStxConfig:e}=await import("./chunk-kdz8yfdx.js"),a=A((await e(s)).runtimeConfig);return await Be(a,()=>j(t,async(p)=>{let n=await Bun.build({entrypoints:[p.filePath],target:"bun",format:"esm",splitting:!1});if(!n.success)throw Error(n.logs.join(`
|
|
5
5
|
`));let u=n.outputs.find((d)=>d.kind==="entry-point");if(!u||n.outputs.length!==1)throw Error(`Unsupported API bundle output: ${p.filePath}`);return(await import(`data:text/javascript;base64,${Buffer.from(await u.text()).toString("base64")}`)).default})(f))}catch(t){return console.error("[stx] API discovery failed:",t),Response.json({error:"API discovery failed; check the server log"},{status:500})}}}function eo(s,l,o){if(Sa(s))return!0;let i=/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/;if(i.test(m.basename(s)))return!0;try{if(i.test(m.basename(S.realpathSync(s))))return!0}catch{}if(P.has(m.resolve(s)))return!0;if(!o)return!1;let f=m.resolve(l,typeof o==="object"?o.dir??"server/api":"server/api"),t=(a)=>{try{return S.realpathSync(a)}catch{return m.resolve(a)}},e=t(s);return[f,m.resolve(l,"server"),m.resolve(l,".output/server")].some((a)=>{let p=t(a);return e===p||e.startsWith(`${p}${m.sep}`)})}
|
|
6
6
|
export{en,Ys,Zs,Qs,lp,eo};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-r0ys9aqa.js";import"./chunk-gtktv6nn.js";import"./chunk-6beg47t4.js";import"./chunk-
|
|
2
|
+
import"./chunk-r0ys9aqa.js";import"./chunk-gtktv6nn.js";import"./chunk-6beg47t4.js";import"./chunk-467acz2w.js";import"./chunk-t6m5d64b.js";import"./chunk-g5jtypvv.js";import"./chunk-tenbwcts.js";import"./chunk-k9pk5yq0.js";import{c}from"./chunk-xvs84gas.js";import u from"fs";import l from"path";async function d(e,t={}){let s=Date.now(),n={total:0,passed:0,failed:0,new:0,failures:[],duration:0},i=t.snapshotDir||c(e.root,"story","snapshots");await u.promises.mkdir(i,{recursive:!0});let r=e.storyFiles;if(t.filter&&t.filter.length>0)r=r.filter((a)=>t.filter.some((o)=>a.fileName.toLowerCase().includes(o.toLowerCase())));for(let a of r)await h(a,i,t,n);return n.duration=Date.now()-s,n}async function h(e,t,s,n){let i=e.story;if(!i)return;for(let r of i.variants){n.total++;let a=l.join(t,`${e.id}-${r.id}.snap`),o=g(r.source||""),f=await w(a);if(s.update||!f){let p={storyId:e.id,variantId:r.id,component:e.fileName,timestamp:Date.now(),hash:o};if(await u.promises.writeFile(a,JSON.stringify(p,null,2)),!f)n.new++;n.passed++}else try{let p=await u.promises.readFile(a,"utf-8"),m=JSON.parse(p);if(m.hash===o)n.passed++;else n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:"Snapshot mismatch",difference:y(m.hash,o)})}catch(p){n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:`Error reading snapshot: ${p}`})}}}async function x(e,t={}){return(await d(e,{...t,update:!0})).total}function g(e){let t=0;for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);t=(t<<5)-t+n,t=t&t}return t.toString(16)}function y(e,t){if(e===t)return 0;let s=Math.abs(Number.parseInt(e,16)-Number.parseInt(t,16));return Math.min(s/1e6,1)}async function w(e){try{return await u.promises.access(e),!0}catch{return!1}}function F(e){let t=[];if(t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(" STX Story Visual Regression Tests"),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),e.failures.length>0){t.push(" \u274C Failures:"),t.push("");for(let s of e.failures){if(t.push(` \u2022 ${s.component} / ${s.variantId}`),t.push(` ${s.message}`),s.difference!==void 0)t.push(` Difference: ${(s.difference*100).toFixed(2)}%`);t.push("")}}if(t.push(" Summary:"),t.push(` Total: ${e.total}`),t.push(` Passed: ${e.passed} \u2713`),t.push(` Failed: ${e.failed} \u2717`),e.new>0)t.push(` New: ${e.new} \u26A1`);return t.push(` Time: ${e.duration}ms`),t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),t.join(`
|
|
3
3
|
`)}export{F as formatTestResults,d as runVisualTests,x as updateSnapshots};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{qi,Ki,Gi,Xi,ip}from"./chunk-jtbx9zgs.js";import"./chunk-463r8dqk.js";import"./chunk-03xn8244.js";import"./chunk-nfh78ama.js";import"./chunk-h82f12we.js";import"./chunk-9bgb9n12.js";import"./chunk-806rdn0n.js";import"./chunk-a0rymg4g.js";import"./chunk-hnwcd41v.js";import"./chunk-hx787tfa.js";import"./chunk-hfsd13r5.js";import"./chunk-v2zmq70s.js";import"./chunk-jgxzbthg.js";import"./chunk-waje9p23.js";import"./chunk-5btsefqt.js";import"./chunk-k9pk5yq0.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-ygb33q5w.js";import"./chunk-kypwg2ws.js";import"./chunk-467acz2w.js";import"./chunk-g5jtypvv.js";import"./chunk-t6m5d64b.js";import"./chunk-r0ys9aqa.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{qi as buildNative,ip as default,Ki as findCraftBinary,Xi as getAvailableFormats,Gi as getAvailableTargets};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{hn,Vo}from"./chunk-
|
|
2
|
+
import{hn,Vo}from"./chunk-g5jtypvv.js";import"./chunk-t6m5d64b.js";export{Vo as generateRuntimeConfigTypes,hn as prepareRuntimeConfig};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{g,Mo,Ka,Ga,eu,tu,nu,ru,su,vs,ou,Me,J,Le,iu,pr,au,Ya,Fo,je,n,gn,Za,m,pe,Np}from"./chunk-
|
|
2
|
+
import{g,Mo,Ka,Ga,eu,tu,nu,ru,su,vs,ou,Me,J,Le,iu,pr,au,Ya,Fo,je,n,gn,Za,m,pe,Np}from"./chunk-467acz2w.js";import"./chunk-g5jtypvv.js";import"./chunk-t6m5d64b.js";import"./chunk-r0ys9aqa.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{pe as clearComponentCache,Fo as componentClientSignalNames,Mo as convertToCommonJS,m as createDetailedErrorMessage,su as extractDirectiveNames,Ka as extractScriptFromTemplate,g as extractVariables,n as fileExists,Np as getComponentCacheStats,tu as getPositionInfo,J as getSharedTranspiler,Za as getSourceLineInfo,ru as hasDirectives,Ga as hasVariables,au as isHydrateTrigger,ou as isJavaScriptScript,je as renderComponentWithSlot,gn as resolveTemplatePath,iu as scopeOnRootElement,vs as scopeSequenceKey,Me as shouldTranspileTypeScript,Ya as slotContentHasExpressions,Le as transpileTypeScript,pr as userComponentFileExists,nu as validateDirective,eu as validateTemplate};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ue,Fa,hs,dn,g,Ne,De}from"./chunk-
|
|
2
|
+
import{ue,Fa,hs,dn,g,Ne,De}from"./chunk-467acz2w.js";import{er,Je,N}from"./chunk-5btsefqt.js";import{Un,o}from"./chunk-nfh78ama.js";import{ye}from"./chunk-v2zmq70s.js";function b(s){return s.endsWith(".md")||s.endsWith(".markdown")}function k(s){let e=[];m(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];m(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function m(n,p){let u;while((u=n.exec(s))!==null){let t=u.index,i=t+u[0].length;if(p?.some((l)=>t>=l.start&&i<=l.end))continue;e.push({start:t,end:i})}}if(e.length===0)return s;e.sort((n,p)=>n.start-p.start);let c="",a=0;for(let n of e){if(n.start<a)continue;c+=s.slice(a,n.start),c+=`@raw${s.slice(n.start,n.end)}@endraw`,a=n.end}return c+=s.slice(a),c}async function R(s,e={}){let{data:r,content:m}=er(s),a=await(e.renderer??((n)=>Je(n)))(m);return{html:k(a),frontmatter:r??{}}}import{dirname as v,resolve as _}from"path";function M(s){let e=s,r=ue(s);if(r)e=r.content.trim();let m=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],a=[],n=[],p=(i)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(i),u;while((u=m.exec(s))!==null){let i=u[1],l=u[2],d=u[0],f=i.includes("server");if(p(l))n.push(d);else if(f)a.push(l);else c.push(d)}let t=e;{let i=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,d=[];while((l=i.exec(t))!==null){let f=l.index+l[0].length,x=t.indexOf("</script>",f);if(x===-1)continue;d.push({start:l.index,end:x+9}),i.lastIndex=x+9}for(let f=d.length-1;f>=0;f--)t=t.substring(0,d[f].start)+t.substring(d[f].end)}for(let i of c)t=t.replace(i,"");return{templateContent:t,serverScripts:a,clientScripts:c,signalsScripts:n}}function E(s,e){return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -14,5 +14,5 @@ ${a.join(`
|
|
|
14
14
|
`)}`}else{if(r.processClientScripts!==!1&&a.length>0){let i=p.__stx_event_bindings||[],l=Ne(p),d=await Promise.all(a.map(async(w)=>{let C=w.match(/<script\b([^>]*)>/i)?.[1]||"";if(/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(C))return w;let h=w.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!h)return w;return await De(h[1],{eventBindings:i,templateContent:t,serverData:l,filePath:e})})),x=[await Un(d,{...n,buildMode:"compile"}),...d].filter(Boolean).join(`
|
|
15
15
|
`);if(t.match(/(<\/body>)/i))t=t.replace(/(<\/body>)/i,`${x}
|
|
16
16
|
$1`);else t+=`
|
|
17
|
-
${x}`}t=await ye(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=E(t,r.title)}if(r.injectCSS)try{let{injectCss:i}=await import("./chunk-
|
|
17
|
+
${x}`}t=await ye(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=E(t,r.title)}if(r.injectCSS)try{let{injectCss:i}=await import("./chunk-bkppc1rf.js");t=await i(t)}catch{}return t}
|
|
18
18
|
export{Zi};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Be,yn,xs,Uo,A}from"./chunk-t6m5d64b.js";import{hn}from"./chunk-
|
|
2
|
+
import{Be,yn,xs,Uo,A}from"./chunk-t6m5d64b.js";import{hn}from"./chunk-g5jtypvv.js";import{xr,S,dc,st,Zo,pc}from"./chunk-gtktv6nn.js";import{T}from"./chunk-6beg47t4.js";import{Ss,l,p,Dt,u,U,D,y,Es,Se,ze,Ts}from"./chunk-r0ys9aqa.js";import{r,fe}from"./chunk-9tg4995v.js";import{f}from"./chunk-b7e07ybq.js";import{W}from"./chunk-078as147.js";import Ge from"path";import Ct from"process";import{AsyncLocalStorage as uo}from"async_hooks";var fr=new uo;function dn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function gr(e,i){return fr.run(dn(e),i)}async function mr(e,i){let t=fr.getStore();if(!t)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let o=t.pending.get(e);if(o)return o;let a=Promise.resolve().then(i).then((h)=>{let c=JSON.stringify(h,(E,R)=>{if(R===void 0||typeof R==="function"||typeof R==="symbol"||typeof R==="bigint"||typeof R==="number"&&!Number.isFinite(R))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(R&&typeof R==="object"&&!Array.isArray(R)&&Object.getPrototypeOf(R)!==Object.prototype&&Object.getPrototypeOf(R)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return R}),v=JSON.parse(c);return t.values.set(e,v),v}).catch((h)=>{throw t.pending.delete(e),h});return t.pending.set(e,a),a}function dr(e){let i=e.__stx_server_data;if(!i?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(i.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function L(e,i=!1){let t=r(e),o=[],a=new Set,h=0,c=0,v=t.length,E=()=>{if(h!==0)return;let R=t.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(R){if(i&&R[1]==="const")return;let I=R[2];if(!a.has(I))o.push(I),a.add(I);return}let C=t.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(C){if(i&&t.slice(c).startsWith("const"))return;C[1].split(",").forEach((I)=>{let P=I.trim();if(!P)return;let q=P.indexOf(":"),K=(q>=0?P.slice(q+1).trim():P).split(/[\s=]/)[0];if(K&&!a.has(K))o.push(K),a.add(K)});return}let O=t.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(O){if(i&&t.slice(c).startsWith("const"))return;O[1].split(",").forEach((I)=>{let P=I.trim().replace(/^\.\.\./,"");if(!P)return;let q=P.split(/[\s=]/)[0];if(q&&!a.has(q))o.push(q),a.add(q)});return}if(i)return;let M=t.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(M){let I=M[1];if(!a.has(I))o.push(I),a.add(I);return}let N=t.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let I=N[1];if(!a.has(I))o.push(I),a.add(I)}};while(c<v){if(t[c]==="{"){h++,c++;continue}if(t[c]==="}"){h--,c++;continue}if(h===0&&/[a-z]/i.test(t[c])&&(c===0||/\s|[;{}()]/.test(t[c-1])))E();c++}return o.join(", ")}function is(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function fo(e,i=L(e).split(",").map((t)=>t.trim()).filter(Boolean)){let t=new Set(L(e,!0).split(",").map((o)=>o.trim()));return i.map((o)=>t.has(o)?`get ${o}() { return ${o} }, set ${o}(__stxValue_${o}) { ${o} = __stxValue_${o} }`:o).join(", ")}function as(e,i){let t=`{ ${fo(e,i)} }`;return L(e).split(",").some((o)=>o.trim()==="__stxLiveBindings")?`Object.defineProperties(${t}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:t}import Tn from"fs";import Te from"path";function j(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var hr=new Map;function cs(e,i=!0){let t=hr.get(e);if(i&&t)return t;let o=new Map,a=[Te.join(e,"src"),Te.join(e,"dist"),e];function h(c,v){if(v>6)return;let E;try{E=Tn.readdirSync(c,{withFileTypes:!0})}catch{return}for(let R of E){let C=Te.join(c,R.name);if(R.isDirectory()){if(R.name==="node_modules"||R.name.startsWith("."))continue;h(C,v+1)}else if(R.isFile()&&R.name.endsWith(".stx")){let O=R.name.slice(0,-4);if(!o.has(O))o.set(O,C);let M=O.toLowerCase();if(!o.has(M))o.set(M,C);let N=j(O);if(!o.has(N))o.set(N,C)}}}for(let c of a)if(h(c,0),o.size>0)break;if(i)hr.set(e,o);return o}function ls(e,i){if(e.startsWith(".")||e.startsWith("/"))return null;let t=i;while(!0){let o=Te.join(t,"node_modules",e);try{if(Tn.statSync(o).isDirectory())return o}catch{}let a=Te.dirname(t);if(a===t)return null;t=a}}function us(e,i,t={}){return[Te.resolve(Te.dirname(i),`${e}.stx`),Te.resolve(Te.dirname(i),e),Te.resolve(t.componentsDir||"components",`${e}.stx`),Te.resolve(t.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function br(e){let i=e.endsWith(".stx")?e.slice(0,-4):e,t=i.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),o=j(i);return[i,t,o]}function To(e,i){let[t,o,a]=br(e);for(let h of[t,t.toLowerCase(),o,a]){let c=i?.__importedComponents?.get(h);if(c!==void 0)return c}}function*$o(e,i,t={},o){let a=br(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield Te.resolve(Te.dirname(i),`${a[0]}.stx`);return}let h=[...new Set(a.map((E)=>`${E}.stx`))],c=t.projectRoot||process.cwd(),v=[...o?.__originalFilePath?[Te.join(Te.dirname(o.__originalFilePath),"components")]:[],...t.componentsDir?[t.componentsDir]:[],Te.join(Te.dirname(i),"components"),Te.resolve(c,"src/components"),Te.resolve(c,"components"),...import.meta.dir?[Te.resolve(import.meta.dir,"components")]:[]];for(let E of new Set(v)){for(let R of h)yield Te.join(E,R);try{for(let R of Tn.readdirSync(E,{withFileTypes:!0}))if(R.isDirectory())for(let C of h)yield Te.join(E,R.name,C)}catch{}}}function yr(e,i,t={},o){let a=To(e,o);if(a!==void 0)return a;for(let h of $o(e,i,t,o))try{if(Tn.statSync(h,{throwIfNoEntry:!1})?.isFile())return h}catch{}return null}import Xs from"fs";import le from"path";import gt from"path";import Zt from"fs";var po=new Set(["touchstart","touchmove","wheel","mousewheel"]);function ss(e,i){if(i.passive)return!0;if(i.prevent||i.nonpassive)return!1;return po.has(e.toLowerCase())}var _r=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),wr={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},go=new Set(["ctrl","alt","shift","meta"]),vr={left:0,middle:1,right:2};function Sr(e){let i={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let t of e){let o=t.toLowerCase();if(o==="prevent")i.prevent=!0;else if(o==="stop")i.stop=!0;else if(o==="once")i.once=!0;else if(o==="capture")i.capture=!0;else if(o==="self")i.self=!0;else if(o==="passive")i.passive=!0;else if(o==="nonpassive")i.nonpassive=!0;else if(go.has(o))i.systemKeys.push(o);else if(o in vr)i.mouse=o;else if(o in wr||/^[a-z]$/.test(o))i.keys.push(wr[o]||o.toUpperCase());else if(o.startsWith("debounce")){let a=o.match(/debounce(?:\.(\d+))?/);i.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(o.startsWith("throttle")){let a=o.match(/throttle(?:\.(\d+))?/);i.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return i}function Er(e,i=""){let t=[],o=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,h;while((h=a.exec(e))!==null){let[c,v,E]=h,R=h.index,C=R+c.length,O=`__stx_evt_${i}${o++}`,M=[],N=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,I;while((I=N.exec(E))!==null){let[,q,Z]=I,K=q.split("."),Q=K[0];if(!_r.has(Q))continue;M.push({attribute:`@${q}`,event:Q,handler:Z,modifiers:Sr(K.slice(1)),elementId:O})}let P=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((I=P.exec(E))!==null){let[,q,Z]=I,K=q.split("."),Q=K[0];if(!_r.has(Q))continue;M.push({attribute:`@${q}`,event:Q,handler:Z,modifiers:Sr(K.slice(1)),elementId:O})}if(M.length>0)t.push({originalTag:c,elementId:O,events:M,startIndex:R,endIndex:C})}return t}function mo(e){let i=[],{modifiers:t}=e;if(t.self)i.push("if ($event.target !== $el) return");for(let o of t.systemKeys)i.push(`if (!$event.${o}Key) return`);if(t.keys.length>0){let o=t.keys.map((a)=>`$event.key === '${a}'`).join(" || ");i.push(`if (!(${o})) return`)}if(t.mouse!==null){let o=vr[t.mouse];i.push(`if ($event.button !== ${o}) return`)}if(t.prevent)i.push("$event.preventDefault()");if(t.stop)i.push("$event.stopPropagation()");return i.join("; ")}function ho(e,i){let t=e;if(i.debounce!==null)t=`__stx_debounce(() => { ${t} }, ${i.debounce})`;else if(i.throttle!==null)t=`__stx_throttle(() => { ${t} }, ${i.throttle})`;return t}function rs(e){let i=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(i))return e;return`if (typeof ${i} === 'function' && !${i}._isSignal) ${i}($event);`}function xo(e){let{modifiers:i}=e,t=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),o=mo(e),a=ho(rs(e.handler),i),h=[];if(i.once)h.push("once: true");if(i.capture)h.push("capture: true");if(ss(e.event,i))h.push("passive: true");let c=h.length>0?`, { ${h.join(", ")} }`:"",v=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
|
|
3
3
|
(function() {
|
|
4
4
|
var $el = document.getElementById('${t}');
|
|
5
5
|
if (!$el) return;
|
|
@@ -112,7 +112,7 @@ else {
|
|
|
112
112
|
`)}
|
|
113
113
|
})();
|
|
114
114
|
</script>`}function bo(e,i=""){let t=Er(e,i);if(t.length===0)return{template:e,bindings:[]};let o=e,a=[];for(let h=t.length-1;h>=0;h--){let c=t[h],v=c.originalTag;if(!v.includes(" id="))v=v.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${c.elementId}"`);else{let E=v.match(/id=["']([^"']+)["']/);if(E)for(let R of c.events)R.elementId=E[1]}for(let E of c.events){let R=E.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),C=new RegExp(`\\s*${R}\\s*=\\s*"[^"]*"`,"g"),O=new RegExp(`\\s*${R}\\s*=\\s*'[^']*'`,"g");v=v.replace(C,""),v=v.replace(O,"")}o=o.slice(0,c.startIndex)+v+o.slice(c.endIndex),a.push(...c.events)}return{template:o,bindings:a}}function $r(e){let i=e.$uid;return typeof i==="string"&&i?`${i}_`:""}function Aa(e,i,t){if(pc(e))return e;if(i.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:v,bindings:E}=bo(e,$r(i)),R=i.__stx_event_bindings||[];return i.__stx_event_bindings=[...R,...E],v}let o=Er(e,$r(i));if(o.length===0)return e;let a=e;for(let v=o.length-1;v>=0;v--){let E=o[v],R=E.originalTag;if(!R.includes(" id="))R=R.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${E.elementId}"`);else{let C=R.match(/id=["']([^"']+)["']/);if(C)for(let O of E.events)O.elementId=C[1]}for(let C of E.events){let O=C.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),M=new RegExp(`\\s*${O}\\s*=\\s*"[^"]*"`,"g"),N=new RegExp(`\\s*${O}\\s*=\\s*'[^']*'`,"g");R=R.replace(M,""),R=R.replace(N,"")}a=a.slice(0,E.startIndex)+R+a.slice(E.endIndex)}let h=Ro(o.flatMap((v)=>v.events)),c=a.lastIndexOf("</body>");if(c!==-1)a=a.slice(0,c)+h+`
|
|
115
|
-
`+a.slice(c);else a+=h;return a}function kr(e,i){let t=new Set;for(let o of e.split(",")){let a=o.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(i){let h=a.lastIndexOf(":");if(h!==-1)a=a.slice(h+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))t.add(a)}return t}function Et(e,i){let t=r(e),{depths:o,balanced:a}=fe(t),h=(v)=>!a||o[v]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${i}\\b)`,"g");for(let v of t.matchAll(c)){let E=(v.index??0)+v[0].length-v[1].length;if(h(E))return!0}for(let v of t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(h(v.index??0)&&kr(v[1],!0).has(i))return!0;for(let v of t.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(h(v.index??0)&&kr(v[1],!1).has(i))return!0;return!1}var Rr="",An,at=/^[A-Za-z_$][\w$]*$/,yo=new Set(["if","for","while","switch","with"]),Cr=["(","[","{"],Tr=[")","]","}"],_o=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function wo(e){let i=r(e),t=[];for(let o of i.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=o.index??0;t.push({text:o[0],start:a,end:a+o[0].length})}return{code:i,tokens:t}}function os(e){if(An&&e===Rr)return An;let{code:i,tokens:t}=wo(e),o=new Map,a=[];for(let I=0;I<t.length;I++){let P=t[I].text;if(["(","[","{"].includes(P))a.push(I);else if([")","]","}"].includes(P)){let q=a.at(-1);if(q!==void 0&&["()","[]","{}"].includes(t[q].text+P))a.pop(),o.set(q,I),o.set(I,q)}}function h(I,P){let q=[],Z=I;for(let K=I;K<P;K++){if(["(","[","{"].includes(t[K].text)&&(o.get(K)??P)<P){K=o.get(K);continue}if(t[K].text===",")q.push([Z,K]),Z=K+1}return q.push([Z,P]),q}let c=[];function v(I,P,q,Z=!1){if(t[I]?.text==="...")I++;if(I>=P)return;let K=t[I].text;if(at.test(K)){if(q.add(K),q===C)c.push({name:K,token:I,functionScoped:Z});return}if(K!=="{"&&K!=="[")return;let Q=o.get(I);if(Q===void 0||Q>=P)return;for(let[te,ne]of h(I+1,Q)){let ae=te;if(K==="{")for(let me=te;me<ne;me++){if(t[me].text===":"){ae=me+1;break}if(t[me].text==="=")break;if(["(","[","{"].includes(t[me].text)&&o.has(me))me=o.get(me)}v(ae,ne,q,Z)}}function E(I,P){let q=new Set;for(let[Z,K]of h(I,P))v(Z,K,q);return q}function R(I){let P=I;for(;P<t.length;P++){let q=t[P].text;if(["(","[","{"].includes(q)&&o.has(P)){P=o.get(P);continue}if([",",";",")","]","}"].includes(q))break}return t[Math.max(I,P-1)]?.end??i.length}let C=new Set,O=[];for(let I=0;I<t.length;I++)if(t[I].text==="=>"){let P=I-1,q=P,Z;if(t[P]?.text===")"&&o.has(P))q=o.get(P),Z=E(q+1,P);else if(t[P]&&at.test(t[P].text))Z=new Set([t[P].text]);else continue;let K=I+1,Q=t[K]?.text==="{"&&o.has(K)?t[o.get(K)].end:R(K);O.push({start:t[q].start,end:Q,bodyStart:t[K]?.start??Q,functionBody:!0,names:Z})}else if(t[I].text==="("&&o.has(I)){let P=t[I-1]?.text;if(!P||yo.has(P)||!at.test(P)&&P!=="*"&&P!=="]")continue;let q=o.get(I),Z=q+1;if(t[Z]?.text===":"){Z++;while(Z<t.length&&!["{","=>",";","="].includes(t[Z].text))Z++}if(t[Z]?.text!=="{"||!o.has(Z))continue;O.push({start:t[I].start,end:t[o.get(Z)].end,bodyStart:t[Z].start,functionBody:P!=="catch",names:E(I+1,q)})}function M(I){let P=I;for(;P<t.length;P++){let q=t[P].text;if(Cr.includes(q)&&o.has(P)){P=o.get(P);continue}if(q===";"||Tr.includes(q))break;let Z=t[P-1];if(P>I&&_o.has(q)&&Z.text!==".")break;if(P>I&&/[\n\r]/.test(i.slice(Z.end,t[P].start))&&(/^[\w$]+$/.test(Z.text)||Tr.includes(Z.text)||['"',"'","`"].includes(Z.text))&&at.test(q)&&!["in","of","instanceof"].includes(q))break}return P}let N=[];for(let I=0;I<t.length;I++){if(t[I].text!=="for")continue;let P=t[I+1]?.text==="await"?I+2:I+1;if(t[P]?.text!=="("||!o.has(P))continue;let q=o.get(P),Z=q+1,K=t[Z]?.text==="{"&&o.has(Z)?o.get(Z):M(Z),Q=t[K]?.text===";"||t[K]?.text==="}"?t[K].end:t[Math.max(Z,K-1)]?.end??i.length;N.push({headStart:P,headEnd:q,start:t[P].start,end:Q})}for(let I=0;I<t.length;I++){let P=t[I].text,q=t[I-1]?.text;if(q==="."||t[I+1]?.text===":")continue;if(q==="as"||q==="<")continue;if(P==="const"||P==="let"||P==="var"){let Z=M(I+1),K=I+1,Q=!1,te=!1,ne=0;for(let ae=I+1;ae<=Z;ae++){let me=t[ae]?.text;if(ae<Z&&Cr.includes(me)&&o.has(ae)&&o.get(ae)<Z){ae=o.get(ae);continue}if(ae<Z&&me===":"&&!te)Q=!0;else if(ae<Z&&me==="="&&ne===0)Q=!1,te=!0;else if(ae<Z&&Q&&me==="<")ne++;else if(ae<Z&&Q&&me===">"&&ne>0)ne--;else if(ae===Z||me===","&&ne===0)v(K,ae,C,P==="var"),K=ae+1,Q=!1,te=!1}}else if(P==="function"||P==="class"){let Z=I+1;if(t[Z]?.text==="*")Z++;if(t[Z]&&at.test(t[Z].text)&&t[Z].text!=="extends")C.add(t[Z].text),c.push({name:t[Z].text,token:Z})}else if(P==="import"){let Z=I+1;if(t[Z]?.text==="*"&&t[Z+1]?.text==="as")Z+=2;let K=t[Z]?.text;if(K&&at.test(K)&&K!=="type"&&t[Z+1]?.text!=="("&&t[Z+1]?.text!==".")C.add(K),c.push({name:K,token:Z,file:!0});let Q=t[Z]?.text==="{"?Z:t[Z+1]?.text===","&&t[Z+2]?.text==="{"?Z+2:-1;if(Q!==-1&&o.has(Q)){let te=o.get(Q);for(let[ne,ae]of h(Q+1,te)){let me=ae-1;while(me>=ne&&!at.test(t[me].text))me--;if(me>=ne&&t[me].text!=="type")c.push({name:t[me].text,token:me,file:!0})}}}}return Rr=e,An={code:i,scopes:O,loops:N,declarations:C,sites:c,tokens:t,pairs:o},An}function fs(e){let i=os(e);return{code:i.code,shadows:(t,o)=>i.scopes.some((a)=>o>=a.start&&o<a.end&&a.names.has(t))}}function In(e){return new Set(os(e).declarations)}function on(e,i){let{scopes:t,loops:o,sites:a,tokens:h,pairs:c}=os(e),v=Array.from({length:h.length},()=>-1),E=[];for(let N=0;N<h.length;N++){v[N]=E.length?E[E.length-1]:-1;let I=h[N].text;if(I==="{"&&c.has(N))E.push(N);else if(I==="}"&&E.length&&c.get(N)===E[E.length-1])E.pop()}let R=new Set,C=new Map;for(let N of a){if(!i.has(N.name))continue;R.add(N.token);let I=N.file?-1:v[N.token],P=I===-1?[0,Number.POSITIVE_INFINITY]:[h[I].start,h[c.get(I)].end];if(N.functionScoped){let Z=h[N.token].start,K=t.filter((Q)=>Q.functionBody&&Z>=Q.bodyStart&&Z<Q.end).sort((Q,te)=>Q.end-Q.bodyStart-(te.end-te.bodyStart))[0];P=K?[K.bodyStart,K.end]:[0,Number.POSITIVE_INFINITY]}else if(!N.file){let Z=o.filter((K)=>N.token>K.headStart&&N.token<K.headEnd).sort((K,Q)=>K.headEnd-K.headStart-(Q.headEnd-Q.headStart))[0];if(Z)P=[Z.start,Z.end]}let q=C.get(N.name);if(q)q.push(P);else C.set(N.name,[P])}let O=new Set;for(let N=0;N<h.length;N++){if(h[N].text!=="import"||h[N-1]?.text===".")continue;let I=N+1;if(h[I]?.text==="type")I++;if(h[I]&&at.test(h[I].text)&&h[I+1]?.text===",")I+=2;if(h[I]?.text==="{"&&c.has(I))for(let P=I+1;P<c.get(I);P++)O.add(P)}let M=new Set;for(let N=0;N<h.length;N++){let I=h[N].text;if(!i.has(I)||M.has(I)||R.has(N)||O.has(N))continue;let P=h[N-1]?.text;if(P==="#"||P==="."&&h[N-2]?.text!=="..")continue;if(h[N+1]?.text===":"&&(P==="{"||P===","))continue;let q=h[N].start;if(C.get(I)?.some(([Z,K])=>q>=Z&&q<K))continue;if(t.some((Z)=>q>=Z.start&&q<Z.end&&Z.names.has(I)))continue;M.add(I)}return M}var Ae="0.2.
|
|
115
|
+
`+a.slice(c);else a+=h;return a}function kr(e,i){let t=new Set;for(let o of e.split(",")){let a=o.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(i){let h=a.lastIndexOf(":");if(h!==-1)a=a.slice(h+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))t.add(a)}return t}function Et(e,i){let t=r(e),{depths:o,balanced:a}=fe(t),h=(v)=>!a||o[v]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${i}\\b)`,"g");for(let v of t.matchAll(c)){let E=(v.index??0)+v[0].length-v[1].length;if(h(E))return!0}for(let v of t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(h(v.index??0)&&kr(v[1],!0).has(i))return!0;for(let v of t.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(h(v.index??0)&&kr(v[1],!1).has(i))return!0;return!1}var Rr="",An,at=/^[A-Za-z_$][\w$]*$/,yo=new Set(["if","for","while","switch","with"]),Cr=["(","[","{"],Tr=[")","]","}"],_o=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function wo(e){let i=r(e),t=[];for(let o of i.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=o.index??0;t.push({text:o[0],start:a,end:a+o[0].length})}return{code:i,tokens:t}}function os(e){if(An&&e===Rr)return An;let{code:i,tokens:t}=wo(e),o=new Map,a=[];for(let I=0;I<t.length;I++){let P=t[I].text;if(["(","[","{"].includes(P))a.push(I);else if([")","]","}"].includes(P)){let q=a.at(-1);if(q!==void 0&&["()","[]","{}"].includes(t[q].text+P))a.pop(),o.set(q,I),o.set(I,q)}}function h(I,P){let q=[],Z=I;for(let K=I;K<P;K++){if(["(","[","{"].includes(t[K].text)&&(o.get(K)??P)<P){K=o.get(K);continue}if(t[K].text===",")q.push([Z,K]),Z=K+1}return q.push([Z,P]),q}let c=[];function v(I,P,q,Z=!1){if(t[I]?.text==="...")I++;if(I>=P)return;let K=t[I].text;if(at.test(K)){if(q.add(K),q===C)c.push({name:K,token:I,functionScoped:Z});return}if(K!=="{"&&K!=="[")return;let Q=o.get(I);if(Q===void 0||Q>=P)return;for(let[te,ne]of h(I+1,Q)){let ae=te;if(K==="{")for(let me=te;me<ne;me++){if(t[me].text===":"){ae=me+1;break}if(t[me].text==="=")break;if(["(","[","{"].includes(t[me].text)&&o.has(me))me=o.get(me)}v(ae,ne,q,Z)}}function E(I,P){let q=new Set;for(let[Z,K]of h(I,P))v(Z,K,q);return q}function R(I){let P=I;for(;P<t.length;P++){let q=t[P].text;if(["(","[","{"].includes(q)&&o.has(P)){P=o.get(P);continue}if([",",";",")","]","}"].includes(q))break}return t[Math.max(I,P-1)]?.end??i.length}let C=new Set,O=[];for(let I=0;I<t.length;I++)if(t[I].text==="=>"){let P=I-1,q=P,Z;if(t[P]?.text===")"&&o.has(P))q=o.get(P),Z=E(q+1,P);else if(t[P]&&at.test(t[P].text))Z=new Set([t[P].text]);else continue;let K=I+1,Q=t[K]?.text==="{"&&o.has(K)?t[o.get(K)].end:R(K);O.push({start:t[q].start,end:Q,bodyStart:t[K]?.start??Q,functionBody:!0,names:Z})}else if(t[I].text==="("&&o.has(I)){let P=t[I-1]?.text;if(!P||yo.has(P)||!at.test(P)&&P!=="*"&&P!=="]")continue;let q=o.get(I),Z=q+1;if(t[Z]?.text===":"){Z++;while(Z<t.length&&!["{","=>",";","="].includes(t[Z].text))Z++}if(t[Z]?.text!=="{"||!o.has(Z))continue;O.push({start:t[I].start,end:t[o.get(Z)].end,bodyStart:t[Z].start,functionBody:P!=="catch",names:E(I+1,q)})}function M(I){let P=I;for(;P<t.length;P++){let q=t[P].text;if(Cr.includes(q)&&o.has(P)){P=o.get(P);continue}if(q===";"||Tr.includes(q))break;let Z=t[P-1];if(P>I&&_o.has(q)&&Z.text!==".")break;if(P>I&&/[\n\r]/.test(i.slice(Z.end,t[P].start))&&(/^[\w$]+$/.test(Z.text)||Tr.includes(Z.text)||['"',"'","`"].includes(Z.text))&&at.test(q)&&!["in","of","instanceof"].includes(q))break}return P}let N=[];for(let I=0;I<t.length;I++){if(t[I].text!=="for")continue;let P=t[I+1]?.text==="await"?I+2:I+1;if(t[P]?.text!=="("||!o.has(P))continue;let q=o.get(P),Z=q+1,K=t[Z]?.text==="{"&&o.has(Z)?o.get(Z):M(Z),Q=t[K]?.text===";"||t[K]?.text==="}"?t[K].end:t[Math.max(Z,K-1)]?.end??i.length;N.push({headStart:P,headEnd:q,start:t[P].start,end:Q})}for(let I=0;I<t.length;I++){let P=t[I].text,q=t[I-1]?.text;if(q==="."||t[I+1]?.text===":")continue;if(q==="as"||q==="<")continue;if(P==="const"||P==="let"||P==="var"){let Z=M(I+1),K=I+1,Q=!1,te=!1,ne=0;for(let ae=I+1;ae<=Z;ae++){let me=t[ae]?.text;if(ae<Z&&Cr.includes(me)&&o.has(ae)&&o.get(ae)<Z){ae=o.get(ae);continue}if(ae<Z&&me===":"&&!te)Q=!0;else if(ae<Z&&me==="="&&ne===0)Q=!1,te=!0;else if(ae<Z&&Q&&me==="<")ne++;else if(ae<Z&&Q&&me===">"&&ne>0)ne--;else if(ae===Z||me===","&&ne===0)v(K,ae,C,P==="var"),K=ae+1,Q=!1,te=!1}}else if(P==="function"||P==="class"){let Z=I+1;if(t[Z]?.text==="*")Z++;if(t[Z]&&at.test(t[Z].text)&&t[Z].text!=="extends")C.add(t[Z].text),c.push({name:t[Z].text,token:Z})}else if(P==="import"){let Z=I+1;if(t[Z]?.text==="*"&&t[Z+1]?.text==="as")Z+=2;let K=t[Z]?.text;if(K&&at.test(K)&&K!=="type"&&t[Z+1]?.text!=="("&&t[Z+1]?.text!==".")C.add(K),c.push({name:K,token:Z,file:!0});let Q=t[Z]?.text==="{"?Z:t[Z+1]?.text===","&&t[Z+2]?.text==="{"?Z+2:-1;if(Q!==-1&&o.has(Q)){let te=o.get(Q);for(let[ne,ae]of h(Q+1,te)){let me=ae-1;while(me>=ne&&!at.test(t[me].text))me--;if(me>=ne&&t[me].text!=="type")c.push({name:t[me].text,token:me,file:!0})}}}}return Rr=e,An={code:i,scopes:O,loops:N,declarations:C,sites:c,tokens:t,pairs:o},An}function fs(e){let i=os(e);return{code:i.code,shadows:(t,o)=>i.scopes.some((a)=>o>=a.start&&o<a.end&&a.names.has(t))}}function In(e){return new Set(os(e).declarations)}function on(e,i){let{scopes:t,loops:o,sites:a,tokens:h,pairs:c}=os(e),v=Array.from({length:h.length},()=>-1),E=[];for(let N=0;N<h.length;N++){v[N]=E.length?E[E.length-1]:-1;let I=h[N].text;if(I==="{"&&c.has(N))E.push(N);else if(I==="}"&&E.length&&c.get(N)===E[E.length-1])E.pop()}let R=new Set,C=new Map;for(let N of a){if(!i.has(N.name))continue;R.add(N.token);let I=N.file?-1:v[N.token],P=I===-1?[0,Number.POSITIVE_INFINITY]:[h[I].start,h[c.get(I)].end];if(N.functionScoped){let Z=h[N.token].start,K=t.filter((Q)=>Q.functionBody&&Z>=Q.bodyStart&&Z<Q.end).sort((Q,te)=>Q.end-Q.bodyStart-(te.end-te.bodyStart))[0];P=K?[K.bodyStart,K.end]:[0,Number.POSITIVE_INFINITY]}else if(!N.file){let Z=o.filter((K)=>N.token>K.headStart&&N.token<K.headEnd).sort((K,Q)=>K.headEnd-K.headStart-(Q.headEnd-Q.headStart))[0];if(Z)P=[Z.start,Z.end]}let q=C.get(N.name);if(q)q.push(P);else C.set(N.name,[P])}let O=new Set;for(let N=0;N<h.length;N++){if(h[N].text!=="import"||h[N-1]?.text===".")continue;let I=N+1;if(h[I]?.text==="type")I++;if(h[I]&&at.test(h[I].text)&&h[I+1]?.text===",")I+=2;if(h[I]?.text==="{"&&c.has(I))for(let P=I+1;P<c.get(I);P++)O.add(P)}let M=new Set;for(let N=0;N<h.length;N++){let I=h[N].text;if(!i.has(I)||M.has(I)||R.has(N)||O.has(N))continue;let P=h[N-1]?.text;if(P==="#"||P==="."&&h[N-2]?.text!=="..")continue;if(h[N+1]?.text===":"&&(P==="{"||P===","))continue;let q=h[N].start;if(C.get(I)?.some(([Z,K])=>q>=Z&&q<K))continue;if(t.some((Z)=>q>=Z.start&&q<Z.end&&Z.names.has(I)))continue;M.add(I)}return M}var Ae="0.2.691";var Ar=Symbol.for(`stx.lazy-module-promises.${Ae}`);function vo(){let e=globalThis;return e[Ar]??=new Map,e[Ar]}function s(e,i){let t=vo(),o=`${import.meta.url}\x00${e}`,a=t.get(o);if(a)return a;let h=i();return t.set(o,h),h.catch(()=>{if(t.get(o)===h)t.delete(o)}),h}var Eo=/<\/(script)/gi;function an(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(Eo,"<\\/$1")}import Pr from"fs";class B{cache=new Map;maxSize;options;sizes;bytes=0;constructor(e=100,i){this.maxSize=e,this.options=i??null,this.sizes=i?new Map:null}get byteSize(){return this.bytes}setMaxBytes(e){if(!this.options)return;this.options={...this.options,maxBytes:e};while(this.bytes>e&&this.cache.size>0){let i=this.cache.keys().next().value;if(i===void 0)break;this.delete(i)}}get(e){if(!this.cache.has(e))return;let i=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,i),i}set(e,i){if(this.cache.has(e))this.delete(e);let t=this.options?this.options.sizeOf(i):0;if(this.options&&t>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+t>this.options.maxBytes)){let o=this.cache.keys().next().value;if(o===void 0)break;this.delete(o)}if(this.cache.set(e,i),this.sizes)this.sizes.set(e,t),this.bytes+=t}has(e){return this.cache.has(e)}delete(e){if(this.sizes){let i=this.sizes.get(e);if(i!==void 0)this.bytes-=i,this.sizes.delete(e)}return this.cache.delete(e)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var St=new Map,ko=500;function Tt(e,i){if(i?.includes("g"))return new RegExp(e,i);let t=`${e}:${i||""}`;if(!St.has(t)){if(St.size>=ko){let o=St.keys().next().value;if(o)St.delete(o)}St.set(t,new RegExp(e,i))}return St.get(t)}class Ir{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(e){let i=Array.from(new Set(e)),t=i.sort().join(","),o=this.pool.find((v)=>v.context.join(",")===t);if(o)return o.func;let a=this.fnCache,h=this.fnCacheMaxSize,c=(...v)=>(E)=>{try{let R=`${t}:${E}`,C=a.get(R);if(!C){if(a.size>=h){let O=a.keys().next().value;if(O)a.delete(O)}C=Function(...i,`
|
|
116
116
|
'use strict';
|
|
117
117
|
try {
|
|
118
118
|
return ${E};
|
|
@@ -193,7 +193,7 @@ else {
|
|
|
193
193
|
// STX: auto-generated event bindings
|
|
194
194
|
${e.map((t,o)=>aa(t,o)).join(`
|
|
195
195
|
`)}`}function Lr(e){let i=[],t=new Set,o=e.replace(/^\s*import\s+.*$/gm,""),a=0,h=o.length,c=0;while(c<h){let v=o[c];if(v==="'"||v==='"'||v==="`"){let E=v;if(c++,E==="`"){let R=0;while(c<h){if(o[c]==="\\"){c+=2;continue}if(o[c]==="`"&&R===0){c++;break}if(o[c]==="$"&&o[c+1]==="{"){R++,c+=2;continue}if(o[c]==="}"&&R>0){R--,c++;continue}c++}}else while(c<h){if(o[c]==="\\"){c+=2;continue}if(o[c]===E){c++;break}c++}continue}if(v==="/"&&o[c+1]==="/"){while(c<h&&o[c]!==`
|
|
196
|
-
`)c++;continue}if(v==="/"&&o[c+1]==="*"){c+=2;while(c<h-1&&!(o[c]==="*"&&o[c+1]==="/"))c++;c+=2;continue}if(v==="{"){a++,c++;continue}if(v==="}"){a--,c++;continue}if(a===0){let E=o.slice(c),R=E.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(R){let M=R[1];if(!M.startsWith("_")&&!t.has(M))i.push(M),t.add(M);c+=R[0].length;continue}let C=E.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(C){C[1].split(",").forEach((M)=>{let N=M.trim(),I=N.indexOf(":"),P=I>=0?N.slice(I+1).trim().split(/[\s=]/)[0]:N.split(/[\s=]/)[0];if(P&&!P.startsWith("_")&&!t.has(P))i.push(P),t.add(P)}),c+=C[0].length;continue}let O=E.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(O){let M=O[1];if(!M.startsWith("_")&&!t.has(M))i.push(M),t.add(M);c+=O[0].length;continue}}c++}return i}var la=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function ua(e){let i=new Set,t=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function o(M){let N;while((N=t.exec(M))!==null){let I=N[0];if(!la.has(I))i.add(I)}}let a=/\{\{([\s\S]*?)\}\}/g,h;while((h=a.exec(e))!==null)o(h[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((h=c.exec(e))!==null)o(h[1]);let v=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((h=v.exec(e))!==null)o(h[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((h=E.exec(e))!==null)o(h[1]);let R=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((h=R.exec(e))!==null)o(h[1]);let C=/@model\s*=\s*["']([^"']*)["']/gi;while((h=C.exec(e))!==null)o(h[1]);let O=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((h=O.exec(e))!==null)o(h[1]);return i}async function De(e,i={}){let t=e,o="",a=!1,h=[],c=Lo(t,{filePath:i.filePath,projectRoot:i.projectRoot});t=c.code;let v=jo(c.styles),E=It(t);t=E.code,h=[...E.imports,...E.models];let{hasUserImports:R,bundleClientScript:C}=await s("stx/client-script-bundler",()=>import("./chunk-
|
|
196
|
+
`)c++;continue}if(v==="/"&&o[c+1]==="*"){c+=2;while(c<h-1&&!(o[c]==="*"&&o[c+1]==="/"))c++;c+=2;continue}if(v==="{"){a++,c++;continue}if(v==="}"){a--,c++;continue}if(a===0){let E=o.slice(c),R=E.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(R){let M=R[1];if(!M.startsWith("_")&&!t.has(M))i.push(M),t.add(M);c+=R[0].length;continue}let C=E.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(C){C[1].split(",").forEach((M)=>{let N=M.trim(),I=N.indexOf(":"),P=I>=0?N.slice(I+1).trim().split(/[\s=]/)[0]:N.split(/[\s=]/)[0];if(P&&!P.startsWith("_")&&!t.has(P))i.push(P),t.add(P)}),c+=C[0].length;continue}let O=E.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(O){let M=O[1];if(!M.startsWith("_")&&!t.has(M))i.push(M),t.add(M);c+=O[0].length;continue}}c++}return i}var la=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function ua(e){let i=new Set,t=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function o(M){let N;while((N=t.exec(M))!==null){let I=N[0];if(!la.has(I))i.add(I)}}let a=/\{\{([\s\S]*?)\}\}/g,h;while((h=a.exec(e))!==null)o(h[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((h=c.exec(e))!==null)o(h[1]);let v=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((h=v.exec(e))!==null)o(h[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((h=E.exec(e))!==null)o(h[1]);let R=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((h=R.exec(e))!==null)o(h[1]);let C=/@model\s*=\s*["']([^"']*)["']/gi;while((h=C.exec(e))!==null)o(h[1]);let O=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((h=O.exec(e))!==null)o(h[1]);return i}async function De(e,i={}){let t=e,o="",a=!1,h=[],c=Lo(t,{filePath:i.filePath,projectRoot:i.projectRoot});t=c.code;let v=jo(c.styles),E=It(t);t=E.code,h=[...E.imports,...E.models];let{hasUserImports:R,bundleClientScript:C}=await s("stx/client-script-bundler",()=>import("./chunk-k74v03v7.js"));if(R(t))t=await C(t,i.filePath||"",{projectRoot:i.projectRoot,minify:i.production}),a=!0;if(i.autoImports!==!1){let Q=Xa(t);t=Q.code,o=Ja(Q.stxImports,Q.browserImports.filter((te)=>!h.includes(te)))}if(o=`${fn(t,i.serverData)}${o}`,t=T(t),!a&&Me(i.attrs||""))t=Le(t);let O=ca(i.eventBindings||[]),M=(i.attrs||"").trim(),N=/\btype\s*=\s*["']module["']/i.test(M),I=i.instanceId?` data-stx-instance="${i.instanceId}"`:"";if(N){let Q=M.replace(/\btype\s*=\s*["']module["']/i,"").trim(),te=`type="module" data-stx-scoped${I}${Q?` ${Q}`:""}`;return`${v}<script ${te}>
|
|
197
197
|
${an(`${o}${t}
|
|
198
198
|
${O}`)}
|
|
199
199
|
</script>`}let P=Zo(e),q=/function __stx_setup_/.test(t),Z=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function K(Q){let te=Q.length>0?`
|
|
@@ -286,8 +286,8 @@ ${R.join(`
|
|
|
286
286
|
`)a++;return!0}if(e[a]==="/"&&e[a+1]==="*"){a+=2;while(a<h-1&&!(e[a]==="*"&&e[a+1]==="/"))a++;return a+=2,!0}return!1},R=()=>{if(o!==0)return;let C=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(C){let I=C[2].split(",").map((P)=>{let q=P.trim().split(":");return q[q.length-1].trim()});for(let P of I)if(P&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(P)&&!t.has(P))i.push(P),t.add(P);return}let O=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(O){let I=O[2];if(!t.has(I))i.push(I),t.add(I);return}let M=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(M){let I=M[1];if(!t.has(I))i.push(I),t.add(I);return}let N=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let I=N[1];if(!t.has(I))i.push(I),t.add(I)}};while(a<h){if(E())continue;if(e[a]==="'"||e[a]==='"'){c(e[a]);continue}if(e[a]==="`"){v();continue}if(e[a]==="{"){o++,a++;continue}if(e[a]==="}"){o--,a++;continue}if(o===0&&/[a-z]/i.test(e[a])&&(a===0||/\s|[;{}()]/.test(e[a-1])))R();a++}return i}function hl(e){let i=[],t=0,o=0,a=null;for(let h=0;h<e.length;h++){let c=e[h];if(a){if(c==="\\"){h++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="("||c==="["||c==="{")t++;else if(c===")"||c==="]"||c==="}")t--;else if(c===","&&t===0)i.push(e.slice(o,h)),o=h+1}if(o<e.length)i.push(e.slice(o));return i}function xl(e){let i=0,t=null;for(let o=0;o<e.length;o++){let a=e[o];if(t){if(a==="\\"){o++;continue}if(a===t)t=null;continue}if(a==='"'||a==="'"||a==="`"){t=a;continue}if(a==="("||a==="["||a==="{")i++;else if(a===")"||a==="]"||a==="}")i--;else if(a==="="&&i===0){let h=e[o-1],c=e[o+1];if(h==="!"||h==="<"||h===">"||h==="=")continue;if(c==="="||c===">")continue;return o}}return-1}function bl(e,i){try{let t=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!t)return;let o=t.index-1;while(o>=0&&/\s/.test(e[o]))o--;if(e[o]!=="}")return;let a=o,h=0,c=-1;for(;o>=0;o--){let E=e[o];if(E==="}")h++;else if(E==="{"){if(h--,h===0){c=o;break}}}if(c===-1)return;let v=e.slice(c+1,a);for(let E of hl(v)){let R=E.trim();if(!R||R.startsWith("..."))continue;let C=xl(R);if(C===-1)continue;let O=R.slice(0,C).trim();if(!/^[A-Z_$][\w$]*$/i.test(O))continue;if(i[O]!==void 0)continue;let M=R.slice(C+1).trim();if(!M)continue;try{let N=Object.keys(i).filter(Dt),I=Function(...N,`"use strict"; return (${M});`);i[O]=I(...N.map((P)=>i[P]))}catch{}}}catch{}}var yl=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function iu(e,i){let t=e.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!t)return null;let o=t[2].toLowerCase();if(!yl.has(o))return null;let a=new RegExp(`<\\/?${o}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),h=z(e,(R,C)=>(a.lastIndex=C,a.exec(R)?.index===C?a.lastIndex:-1));if(o==="span"&&/\sdata-stx-scope\s*=/.test(h[0]?.token||""))return null;let c=0,v=!1;for(let R of h){if(c+=R.token.startsWith("</")?-1:1,c<0)return null;if(c===0){if(e.slice(R.end).trim())return null;v=!0;break}}if(!v)return null;let E=t[0].length;return e.slice(0,E)+i+e.slice(E)}async function pr(e,i,t,o,a){let h=e.endsWith(".stx")?e.slice(0,-4):e,c=(ne)=>ne.split("-").map((ae)=>ae.charAt(0).toUpperCase()+ae.slice(1)).join(""),v=t.__importedComponents;if(v){for(let ne of[h,h.toLowerCase(),c(h),j(h)])if(v.has(ne))return!0}let E=[...new Set([`${h}.stx`,`${c(h)}.stx`,`${j(h)}.stx`])],R=typeof a.root==="string"?le.resolve(a.root):void 0,C=R??le.dirname(o),O=[],M=(ne)=>{if(ne&&!O.includes(ne))O.push(ne)},N=t.__originalFilePath;if(N)M(le.join(le.dirname(N),"components"));M(i),M(a._rootComponentsDir),M(le.join(le.dirname(o),"components")),M(a.componentsDir);let I=a._targetComponentFallbackNames?.some((ne)=>ne.toLowerCase()===h.toLowerCase());if(!I)for(let ne of a._targetComponentDirs??[])M(ne);if(R)M(le.resolve(R,"resources/views/components")),M(le.resolve(R,"resources/components")),M(le.resolve(R,"src/components")),M(le.resolve(R,"components"));for(let ne of a._layerComponentDirs??[])M(ne);let P=a._pluginComponentDirs;if(Array.isArray(P))for(let ne of P)M(typeof ne==="string"?ne:null);if(M(a.fallbackComponentsDir),I)for(let ne of a._targetComponentDirs??[])M(ne);if(h.startsWith("./")||h.startsWith("../"))return n(le.resolve(le.dirname(o),`${h}.stx`));let q=Vi(le.resolve(import.meta.dir,"components")),Z=O.map((ne)=>le.isAbsolute(ne)?ne:le.resolve(C,ne)),K=`${E.join("\x00")}\x00\x00${Z.join("\x00")}`,Q=Hs.get(K);if(Q!==void 0)return Q;let te=!1;e:for(let ne of Z){if(Vi(ne)===q)continue;for(let ae of E)if(await n(le.join(ne,ae))){te=!0;break e}}return Hs.set(K,te),te}function Vi(e){let i=Ks.get(e);if(i!==void 0)return i;let t=e;try{t=Xs.realpathSync(e)}catch{}return Ks.set(e,t),t}function au(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function Ya(e){if(!e)return!1;let i=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(i)}function _l(e,i,t){if(!e.includes("{{")&&!e.includes("{!!"))return e;let o=(a,h)=>{let c;try{c=_(a,i)}catch{return h}if(c===void 0||c===null)return"";let v=String(c);if(/<\/style/i.test(v))return console.warn(`[stx] a <style> expression in ${t??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return v};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,h)=>o(h,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,h)=>o(h,a))}var Ui=new Set;function Hi(e,i,t,o){let a=`${e}\x00${i}\x00${o??""}`;if(!process.env.STX_DEBUG&&Ui.has(a))return;Ui.add(a);let h=i?` used in ${i}`:"",c=o?` Cause: ${o}.`:"",v=t.length>0?`
|
|
287
287
|
searched:
|
|
288
288
|
${t.map((E)=>` - ${E}`).join(`
|
|
289
|
-
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${h}, so it rendered as nothing.${c}${v}`)}function Ki(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Fo(e){let i=new Set,t=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let o of e){let a;while((a=t.exec(o))!==null)i.add(a[1]);t.lastIndex=0}return[...i]}async function je(e,i,t,o,a,h,c,v=new Set,E,R=et(a),C,O=e){let{extractVariables:M}=await s("stx/variable-extractor",()=>import("./chunk-
|
|
290
|
-
`)}`}if(t&&re.includes("{{ text || slot }}"))re=re.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>t);let{applySlots:ge}=await s("stx/slots",()=>import("./chunk-
|
|
289
|
+
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${h}, so it rendered as nothing.${c}${v}`)}function Ki(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Fo(e){let i=new Set,t=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let o of e){let a;while((a=t.exec(o))!==null)i.add(a[1]);t.lastIndex=0}return[...i]}async function je(e,i,t,o,a,h,c,v=new Set,E,R=et(a),C,O=e){let{extractVariables:M}=await s("stx/variable-extractor",()=>import("./chunk-xdvw04da.js")),N=v??new Set;if(N.has(e))return`[Circular component reference: ${e}]`;let I=new Set(N);I.add(e);let P=typeof i.client==="string"?i.client.trim():"";if("client"in i)delete i.client;let q=P&&P!=="load"&&au(P)?P:"";try{let Z=(ce)=>ce.split("-").map((ie)=>ie.charAt(0).toUpperCase()+ie.slice(1)).join(""),K=O.endsWith(".stx")?O.slice(0,-4):O,Q=null,te=a.__importedComponents;if(te){let ce=[K,K.toLowerCase(),Z(K),j(K)];for(let ie of ce)if(te.has(ie)){Q=te.get(ie);break}}let ne=[];if(!Q){let ce=[`${K}.stx`,`${Z(K)}.stx`,`${j(K)}.stx`],ie=[...new Set(ce)],he=a.__originalFilePath,xe=[];if(xe.push(...c._layerComponentDirs??[]),he){let _e=le.join(le.dirname(he),"components");xe.push(_e)}if(o)xe.push(o);let Ke=c._rootComponentsDir;if(typeof Ke==="string"&&!xe.includes(Ke))xe.push(Ke);let Ce=le.join(le.dirname(h),"components");if(!xe.includes(Ce))xe.push(Ce);if(c.componentsDir&&c.componentsDir!==o&&!xe.includes(c.componentsDir))xe.push(c.componentsDir);let pt=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(K),rt=(C?.events??[]).map((_e)=>_e.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Ut=Object.hasOwn(i,"checked")||Boolean(C?.reactiveProps?.includes("checked")),dt=Object.hasOwn(i,"value")||Boolean(C?.reactiveProps?.includes("value")),yt=!rt.includes("valuechange")&&(Ut||rt.includes("change")&&!dt),wn=c._nativeHostAttrs&&/^textinput$/i.test(K),Yn=rt.includes("update:value")&&!rt.includes("input"),Ht=c._nativeHostAttrs&&/^video$/i.test(K),_t=Object.hasOwn(i,"src")||Boolean(C?.reactiveProps?.includes("src")),Sn=Object.hasOwn(i,"source")||Boolean(C?.reactiveProps?.includes("source")),$n=Ht&&_t&&!Sn&&(C?.events??[]).every((_e)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(_e.replace(/^@/,"").split(".")[0])),Kt=c._targetComponentFallbackNames?.some((_e)=>_e.toLowerCase()===K.toLowerCase())&&(!pt||yt)&&(!wn||Yn)&&(!Ht||$n);for(let _e of Kt?[]:c._targetComponentDirs??[])if(_e&&!xe.includes(_e))xe.push(_e);let it=typeof c.root==="string"?le.resolve(c.root):void 0,vn=it??le.dirname(h),wt=[];if(it)wt.push(le.resolve(it,"resources/views/components")),wt.push(le.resolve(it,"resources/components")),wt.push(le.resolve(it,"src/components")),wt.push(le.resolve(it,"components"));wt.push(le.resolve(import.meta.dir,"components"));for(let _e of wt)if(!xe.includes(_e))xe.push(_e);let nr=c._pluginComponentDirs;if(Array.isArray(nr)){for(let _e of nr)if(typeof _e==="string"&&!xe.includes(_e))xe.push(_e)}if(c.fallbackComponentsDir&&!xe.includes(c.fallbackComponentsDir))xe.push(c.fallbackComponentsDir);if(Kt){for(let _e of c._targetComponentDirs??[])if(_e&&!xe.includes(_e))xe.push(_e)}let sr=[...new Set(xe.map((_e)=>{if(!_e)return _e;return le.isAbsolute(_e)?_e:le.resolve(vn,_e)}))];xe.length=0,xe.push(...sr);let Qn=`${K}\x00${h}\x00${sr.join("\x00")}`,es=Hn.get(Qn);if(es)if(await n(es))Q=es;else Hn.delete(Qn);if(!Q&&(K.startsWith("./")||K.startsWith("../")))Q=le.resolve(le.dirname(h),`${K}.stx`),ne.push(Q);else if(!Q)for(let _e of xe){if(!_e)continue;for(let En of ie){let kn=le.join(_e,En);if(ne.push(kn),await n(kn)){Q=kn;break}}if(Q)break;if(!Q)try{let En=await import("fs");if(!En.statSync(_e,{throwIfNoEntry:!1})?.isDirectory())continue;let co=8,ts=[{path:_e,depth:0}];while(ts.length>0&&!Q){let Rn=ts.pop();if(Rn.depth>=co)continue;let rr;try{rr=En.readdirSync(Rn.path,{withFileTypes:!0})}catch{continue}for(let Cn of rr){if(!Cn.isDirectory())continue;if(Cn.name==="node_modules"||Cn.name.startsWith("."))continue;let or=le.join(Rn.path,Cn.name);for(let lo of ie){let ns=le.join(or,lo);if(ne.push(ns),await n(ns)){Q=ns;break}}if(Q)break;ts.push({path:or,depth:Rn.depth+1})}}}catch{}if(Q)break}if(Q)Hn.set(Qn,Q)}if(!Q||!await n(Q))return Hi(e,h,ne),Ki(e);E.add(Q);let ae;if(en.has(Q))ae=en.get(Q);else try{ae=await Bun.file(Q).text(),en.set(Q,ae)}catch(ce){let ie=ce instanceof Error?ce.message:String(ce);return Hi(e,h,[Q],ie),Ki(e)}if(C)for(let ce of new Set([...Object.keys(i),...C.reactiveProps??[]])){let ie=ce.toLowerCase();if(ie.startsWith("aria-")||ie.startsWith("data-"))continue;let he=ce.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${he}\\b`).test(ae))C.declaredProps.add(ce);if(new RegExp(`\\$props\\s*(?:\\.\\s*${he}\\b|\\[\\s*['"]${he}['"]\\s*\\])`).test(ae)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${he}['"]`).test(ae))C.consumedProps?.add(ce)}let me=new Set(["__originalFilePath","__importedComponents",Mn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),ke={};for(let[ce,ie]of Object.entries(a))if(!ce.startsWith("__")||me.has(ce))ke[ce]=ie;let Re=R.length>0?{[zn]:[...R]}:{},Ue=t;if(t.includes("@include")){let{processIncludes:ce}=await s("stx/includes",()=>import("./chunk-w91raavj.js"));Ue=await ce(t,a,h,c,E)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ue)){let{processComponents:ce}=await s("stx/component-renderer",()=>import("./chunk-smmwjt35.js"));Ue=await ce(Ue,{...a,__processedComponents:N,...Re},h,c,E)}let We=[];if(Ya(Ue)){let{processExpressions:ce}=await s("stx/expressions",()=>import("./chunk-zjr0wrzw.js")),ie=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...Re}:R.length>0?{...a,...Re}:a;Ue=ce(Ue,ie,h);for(let he of Ue.matchAll(/\{\{([\s\S]*?)\}\}/g))We.push(he[1].trim())}let Ze=G(Ue),Ye=[],ht=Ze.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(ce,ie)=>{let he=Ze.scripts[Number(ie)]||"",xe=he.match(/^<script\b([^>]*)>/i)?.[1]||"",Ke=xe.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Ce=!Ke||["module","text/javascript","application/javascript"].includes(Ke),pt=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${xe}`);if(!/\bserver\b/i.test(xe)&&Ce&&!pt)return Ye.push(he),"";return he}),{extractSlotContent:qn}=await s("stx/slots",()=>import("./chunk-fbb68bw1.js")),ct=qn(ht),lt={};if(ct.defaultSlot?.trim())lt.default=ct.defaultSlot;for(let[ce,ie]of ct.namedSlots)lt[ce]=ie.content;let ut=a.__stx_scope_seq??={n:0,key:vs(String(a.__filename??h))},Mt=qi(e,process.cwd()),ot=`stx_${(Mt.endsWith(".stx")?Mt.slice(0,-4):Mt).replace(/[^a-zA-Z0-9]/g,"_")}_${++ut.n}_${ut.key}`,Fe={...ke,$uid:ot,$native:c._nativeHostAttrs===!0,...i,props:i,slot:ht,$slots:lt,__processedComponents:I,__sections:{},__stx_signals_gate:we(ae)||Ya(t),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...We]};bl(ae,Fe);let jt=ae,nn=ue(jt);if(nn)jt=nn.content.trim();let Xn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Nt=[...ae.matchAll(Xn)];for(let[,ce,ie]of Nt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(ce))Pe(ie,Q,c.strict);let Je=[],Lt=null,Jn=Nt.some((ce)=>/\bserver\b/.test(ce[1]||"")&&/\bcache\b/.test(ce[1]||"")),xt=null,Qe=null,Bt=null,sn=0,zt=null;if(fl(c),Jn&&Zs>0){let ce=pl({props:i,slot:Ue,slotContext:t.trim()?dl(ke):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...R].sort(),layers:c._layerGraph?.layers.map((ie)=>ie.configFile),uid:ot});if(ce!==null){xt=`${Q}\x00${w(ae)}\x00${ce}`;let ie=Kn.get(xt);if(ie){for(let he of ie.dependencies)E.add(he);if(Kr(a,ie.clientFactories),ut.n+=ie.uidsConsumed,ie.preservedClientExpressions.length>0){let he=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let xe of ie.preservedClientExpressions)he.add(xe);a.__stx_preserved_client_expressions=[...he]}return ie.output}Qe=new Set(E),Bt=Ur(a),sn=ut.n,zt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Wt=new Set;for(let ce of Nt){let ie=ce[1]||"",he=ce[2]||"",xe=ie.includes("server");if(Me(ie)&&he.trim())he=Le(he);if(xe&&he){for(let Ce of Oe(he))Wt.add(Ce);try{await M(he,Fe,Q,{onFailure:(Ce)=>{if(Ce.kind!=="unknown")Lt=Ce.kind}})}catch(Ce){}}if(!xe){let Ce=he.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),pt=Ce.includes("{{")&&Ce.includes("}}"),rt=Ce.includes("{!!")&&Ce.includes("!!}");if(pt||rt)Ce=Ho(Ce,Fe,Q);let Ut=ie.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Je.push(`<script${Ut}>${Ce}</script>`)}}let qe=G(ae).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Ft=qe?qe[1]:"",Gn=qe?qe[2]:"",tt="",ee=Ft&&/\bscoped\b/i.test(Ft);if(qe)tt=`<style${Ft}>${_l(Gn,Fe,Q)}</style>`;let re=jt;if(re=re.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),qe)re=re.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let ce=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ie=[];if(re=re.replace(ce,(he,xe)=>{let Ke=xe.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Ke)ie.push(`<style${Ke[1]}>${Ke[2]}</style>`);return""}),re=re.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ie.length>0)tt=`${tt}${ie.join(`
|
|
290
|
+
`)}`}if(t&&re.includes("{{ text || slot }}"))re=re.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>t);let{applySlots:ge}=await s("stx/slots",()=>import("./chunk-fbb68bw1.js")),{defaultSlot:ye,namedSlots:Ee}=ct,Ve=c._nativeHostAttrs===!0&&Je.length>0||Je.some((ce)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(ce)),ft=(ce)=>Ve?bi(ce,ot):ce,tr=new Map([...Ee].map(([ce,ie])=>[ce,{...ie,content:ft(ie.content)}]));re=await ge(re,ft(ye),tr,Fe,Ve?ot:"");let rn=Fo(Je),xn=(Array.isArray(Fe.__stx_client_signal_names)?Fe.__stx_client_signal_names:[]).filter((ce)=>!Wt.has(ce));if(rn.length>0||xn.length>0)Fe.__stx_client_signal_names=[...new Set([...xn,...rn])];else delete Fe.__stx_client_signal_names;let Vt=R.filter((ce)=>!Wt.has(ce)&&!(ce in i));if(Vt.length>0)Fe[zn]=Vt;let bn={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:le.dirname(Q),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||Ve||Je.length===0,defaultLayout:void 0};Fe.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:_n}=await s("stx/process",()=>import("./chunk-kv6z74k1.js")),nt=await _n(re,Fe,Q,bn,E),bt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let ce of nt.matchAll(/\{\{([\s\S]*?)\}\}/g))bt.add(ce[1].trim());if(bt.size>0)a.__stx_preserved_client_expressions=[...bt];let Xe=ot,He=nt;if(Ve){let ce="";if(Object.keys(i).length>0)try{ce=` data-stx-props="${Vs(JSON.stringify(i))}"`}catch{}let ie=q?` stx-hydrate="${Vs(q)}"`:"",he=Object.fromEntries(Object.entries(lt).map(([dt,yt])=>[dt,Boolean(yt)])),xe=Object.keys(he).length>0?` data-stx-slots="${Vs(JSON.stringify(he))}"`:"",Ke=` data-stx-scope="${Xe}"${ce}${xe}${ie}`,Ce=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(nt),pt=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(nt),rt=Ce?"span":"div";He=iu(nt,Ke)??`<${rt}${Ke} data-stx-component-wrapper${Ce||pt?' style="display:contents"':""}>${nt}</${rt}>`;let Ut=await Promise.all(Je.map(async(dt)=>{let yt=dt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!yt)return dt;let[,wn,Yn]=yt,Ht=zi(dt,Fe,Q);if(Ht!==null)return Ht;let _t=await $l(Yn,Q,c.buildMode==="compile"),Sn=fn(_t.clientCode,Ne(Fe)),{vendorStyleTags:$n}=_t,Kt=Sn?`function(__scopeId) {
|
|
291
291
|
${Sn}
|
|
292
292
|
return (${_t.factoryBody})(__scopeId);
|
|
293
293
|
}`:_t.factoryBody,it=q?null:Is(a,Kt),vn=it?`window.__stxComponentFactories[${JSON.stringify(it)}](${JSON.stringify(Xe)});`:`(${Kt})(${JSON.stringify(Xe)});`;if(q)return`${$n}<script type="stx/island" data-stx-island="${Xe}" data-stx-scoped data-stx-owner="${Xe}"${wn}>${vn}</script>`;return`${$n}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Xe}"${wn}>${vn}</script>`}));if(He=He+`
|
|
@@ -313,7 +313,7 @@ ${$e.yellow}${$e.bold}Message:${$e.reset} ${i}
|
|
|
313
313
|
`,v)C+=`
|
|
314
314
|
${$e.blue}${$e.bold}Context:${$e.reset}
|
|
315
315
|
${$e.dim}${v}${$e.reset}
|
|
316
|
-
`;return C}function pe(){en.clear(),Hn.clear(),Hs.clear(),Ks.clear(),Kn.clear()}function Np(){return{size:en.size,maxSize:500}}var Us=b(128);async function $l(e,i,t){let o=w(e,i,t),a=Us.get(o);if(a){if(ds(a.deps))return a;Us.delete(o)}let h=Lo(e,{filePath:i,projectRoot:process.cwd()}),c=h.code,v=jo(h.styles);c=It(c).code;let{hasUserImports:E,bundleClientScript:R}=await s("stx/client-script-bundler",()=>import("./chunk-
|
|
316
|
+
`;return C}function pe(){en.clear(),Hn.clear(),Hs.clear(),Ks.clear(),Kn.clear()}function Np(){return{size:en.size,maxSize:500}}var Us=b(128);async function $l(e,i,t){let o=w(e,i,t),a=Us.get(o);if(a){if(ds(a.deps))return a;Us.delete(o)}let h=Lo(e,{filePath:i,projectRoot:process.cwd()}),c=h.code,v=jo(h.styles);c=It(c).code;let{hasUserImports:E,bundleClientScript:R}=await s("stx/client-script-bundler",()=>import("./chunk-k74v03v7.js")),C=[],O=!1;if(E(c)){let K=c;c=await R(K,i,{projectRoot:process.cwd(),minify:t,collectInputs:C}),O=c===K}let{stripStxRuntimeImports:M}=await s("stx/signal-processing",()=>import("./chunk-k7gcx130.js"));c=M(c);let N=T(c),I=ml(N),P=new Set(L(N,!0).split(",").map((K)=>K.trim())),q=`function(__scopeId) {
|
|
317
317
|
${st("const",[...dc,...I],N)}
|
|
318
318
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
319
319
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{t,a}from"./chunk-r0ys9aqa.js";import{n,gn,m}from"./chunk-
|
|
2
|
+
import{t,a}from"./chunk-r0ys9aqa.js";import{n,gn,m}from"./chunk-467acz2w.js";import{Ze}from"./chunk-kypwg2ws.js";import{Qr,es}from"./chunk-ygb33q5w.js";import{ka,vo,Yr,Zr}from"./chunk-912r15hr.js";import{wa,xa}from"./chunk-k9pk5yq0.js";import{bt}from"./chunk-3hxd5td3.js";import{sn,Ra,sr,or}from"./chunk-xvs84gas.js";import{f}from"./chunk-b7e07ybq.js";import{Ps}from"./chunk-vxrhvrr9.js";import Q from"fs";import j from"path";import{loadConfigWithResult as Ht}from"bunfig";var B={duration:300,delay:0,ease:"ease",direction:"both"};function nt(e,r={}){let{duration:o,delay:l,ease:s,direction:c,custom:d}={...B,...r};if(e==="custom"&&d)return d;switch(e){case"fade":return`${c==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":c==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
|
|
3
3
|
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
|
|
4
4
|
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${c==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":c==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
|
|
5
5
|
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
|
|
@@ -1307,6 +1307,6 @@ ${y}
|
|
|
1307
1307
|
customElements.define('${r}', ${d});
|
|
1308
1308
|
`}async function Qe(e,r,o,l){if(r.length<1)return a("WebComponent","@webcomponent directive requires at least the tag name parameter",t.INVALID_DIRECTIVE_SYNTAX);let s=r[0].replace(/['"]/g,""),d=(o.__stx_options||{}).componentsDir||"components",p=q.isAbsolute(d)?[q.join(d,`${s}.stx`),q.join(q.dirname(l),`${s}.stx`)]:[q.join(q.dirname(l),d,`${s}.stx`),q.join(process.cwd(),d,`${s}.stx`),q.join(q.dirname(l),`${s}.stx`)],u=null;for(let h of p)if(await n(h)){u=await Bun.file(h).text();break}if(!u)return a("WebComponent",`Component file not found: ${s}.stx`,t.FILE_NOT_FOUND);let g=Ft(u,s);return`<script type="module">
|
|
1309
1309
|
${qt(g)}
|
|
1310
|
-
</script>`}var N={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:sn,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:Ie,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:Qe,hasEndTag:!1,description:"Include a web component in the template"},wa,xa,Qr,es,De,ke,Ae,Pe,_e,Oe,Fe,$e,...Ps],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,scrollRestoration:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function Ut(e,r,o){let l=r||"pages";if(e)return{root:e,pagesDir:l};let s=o||process.cwd(),c=j.join(s,"resources","views"),d=j.join(s,"resources","layouts");if(Q.existsSync(c)&&Q.existsSync(d))return{root:"resources",pagesDir:"views"};let p=j.join(s,"resources","views","pages");if(Q.existsSync(p))return{root:"resources/views",pagesDir:l};return{root:".",pagesDir:l}}var et=new Set,ue=["partialsDir","componentsDir","layoutsDir"],Se=new WeakMap;function Bt(e,r){let o=r.replace(/[\\/]+$/,"");if(!o||o===".")return!0;let l=e.replace(/\\/g,"/"),s=o.replace(/\\/g,"/");return l===s||l.startsWith(`${s}/`)}function Nl(e,r){let o=!e.root,l=Ut(e.root,e.pagesDir,r);if(e.root=l.root,e.pagesDir=l.pagesDir,o&&l.root!=="."){let s=`${r}::${l.root}`;if(!et.has(s))et.add(s),console.warn(`[stx] No "root" in config \u2014 inferred "${l.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!Se.has(e)){let s={};for(let c of ue){let d=e[c];if(typeof d==="string"&&d)s[c]=d}Se.set(e,s)}if(e.root&&e.root!=="."){let s=e.root;for(let c of ue){let d=e[c];if(typeof d!=="string"||!d)continue;if(j.isAbsolute(d)||Bt(d,s))continue;e[c]=j.join(s,d)}}for(let s of ue){let c=e[s];if(typeof c!=="string"||!c||j.isAbsolute(c))continue;e[s]=j.resolve(r,c)}return e}function Jt(e,r){let o=Se.get(e);for(let l of ue){let s=e[l];if(typeof s!=="string"||!s)continue;let c=j.isAbsolute(s)?s:j.join(r,s);if(Q.existsSync(c))continue;let d=o?.[l]??s,p=e.root,u=!!p&&p!==".";console.warn(`[stx] ${String(l)} resolves to "${c}", which does not exist. Configured as "${d}"`+(u?`, resolved under root "${p}".`:"."))}}function Kt(e){if(e.customDirectives)e.customDirectives=[...e.customDirectives];if(e.middleware)e.middleware=[...e.middleware];if(e.apiRoutes)e.apiRoutes={...e.apiRoutes}}function Gt(e){if(Ra(e.stateDir),e.stateDir=sr(),e.cachePath=or(e.cachePath),e.build)e.build.cacheDir=or(e.build.cacheDir);if(e.media?.cache)e.media.cache.directory=or(e.media.cache.directory);if(e.story)e.story.outDir=or(e.story.outDir)}var K=null,Y=new Map,de=new Map,se=null;async function yo(e,r=Ht){try{return await r(e)}catch(o){if(o instanceof Error&&o.name==="ConfigNotFoundError")return{config:e.defaultConfig};throw o}}async function i(e){let r=e?j.resolve(e):process.cwd(),o=de.get(r);if(o&&o.signature!==Yr(o.graph)){let c=Y.get(r);if(Y.delete(r),de.delete(r),!e)K=null,se=null;let{clearComponentCache:d}=await import("./chunk-yxp7jmnz.js"),{partialsCache:p}=await import("./chunk-ngd9dsrd.js");if(d(),p.clear(),c&&o.configSignature===Zr(o.graph)){let u=c.then(async(g)=>{let y={...o.graph};await vo(y,r),de.set(r,{graph:y,signature:Yr(y),configSignature:Zr(y)});let h={...g,_layerGraph:y};if(!e)K=h;return h});return Y.set(r,u),u}}if(!e){if(K)return K;if(se)return se}let l=Y.get(r);if(l)return l;let s=(async()=>{let c=[".ts",".js",".mjs",".cjs",".json"],d=c.some((v)=>Q.existsSync(j.join(r,`stx.config${v}`))),p=c.some((v)=>Q.existsSync(j.join(r,"config",`ui${v}`))),u;if(d&&p){let v=await yo({name:"ui",cwd:j.join(r,"config"),defaultConfig:N,errorPolicy:"throw",verbose:!1});u=(await yo({name:"stx",alias:"ui",cwd:r,defaultConfig:v.config,errorPolicy:"throw",verbose:!1})).config}else u=(await yo({name:"stx",alias:"ui",cwd:r,defaultConfig:N,errorPolicy:"throw",verbose:!1})).config;if(u.extends!==void 0||o){let v=await ka(r,N);u=v.config,de.set(r,{graph:v.graph,signature:Yr(v.graph),configSignature:Zr(v.graph)})}if(u.runtimeConfig){let{resolveRuntimeConfig:v}=await import("./chunk-wvz7rp5p.js");v(u.runtimeConfig,{});let{generateRuntimeConfigTypes:b}=await import("./chunk-5m42k74p.js");await b(r,u.runtimeConfig)}Kt(u),Gt(u),Nl(u,r),Jt(u,r);let g=[],y=new Set((u.plugins??[]).map((v)=>typeof v==="string"?v:v[0]));for(let v of u.componentPackages??["@stacksjs/components"]){let b=`${v}/stx-plugin`;if(y.has(b)||y.has(v))continue;try{f.resolve(b,{paths:[r]}),g.push(b)}catch{}}let h=[...u.plugins??[],...g];if(h.length>0){let{pluginManager:v}=await import("./chunk-vqv5w6gs.js"),b=[],x=[];for(let P of h){let S=typeof P==="string"?P:P[0],A=typeof P==="string"?{}:P[1]||{};try{let k,E;try{let w=f.resolve(S,{paths:[r]});k=await import(w),E=j.dirname(w)}catch{let w=j.resolve(r,S);k=await import(w),E=j.dirname(w)}let I=k.default||k;if(!v.has(I.name))await v.register(I,u);if(I.components){let w=Array.isArray(I.components)?I.components:[I.components];for(let C of w)b.push(j.resolve(E,C))}if(I.pages){let w=j.resolve(E,I.pages),C=A.path||"/";x.push({dir:w,prefix:C})}if(I.setup){let w={addDirective:(C)=>{u.customDirectives=u.customDirectives||[],u.customDirectives.push(C)},addRoute:(C,D)=>{u.apiRoutes=u.apiRoutes||{},u.apiRoutes[C]=D},addMiddleware:(C)=>{u.middleware=u.middleware||[],u.middleware.push(C)},pluginDir:E,config:u};await I.setup(A,w)}process.stderr.write(`[stx] Plugin loaded: ${I.name||S}
|
|
1310
|
+
</script>`}var N={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:sn,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:Ie,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:Qe,hasEndTag:!1,description:"Include a web component in the template"},wa,xa,Qr,es,De,ke,Ae,Pe,_e,Oe,Fe,$e,...Ps],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,scrollRestoration:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function Ut(e,r,o){let l=r||"pages";if(e)return{root:e,pagesDir:l};let s=o||process.cwd(),c=j.join(s,"resources","views"),d=j.join(s,"resources","layouts");if(Q.existsSync(c)&&Q.existsSync(d))return{root:"resources",pagesDir:"views"};let p=j.join(s,"resources","views","pages");if(Q.existsSync(p))return{root:"resources/views",pagesDir:l};return{root:".",pagesDir:l}}var et=new Set,ue=["partialsDir","componentsDir","layoutsDir"],Se=new WeakMap;function Bt(e,r){let o=r.replace(/[\\/]+$/,"");if(!o||o===".")return!0;let l=e.replace(/\\/g,"/"),s=o.replace(/\\/g,"/");return l===s||l.startsWith(`${s}/`)}function Nl(e,r){let o=!e.root,l=Ut(e.root,e.pagesDir,r);if(e.root=l.root,e.pagesDir=l.pagesDir,o&&l.root!=="."){let s=`${r}::${l.root}`;if(!et.has(s))et.add(s),console.warn(`[stx] No "root" in config \u2014 inferred "${l.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!Se.has(e)){let s={};for(let c of ue){let d=e[c];if(typeof d==="string"&&d)s[c]=d}Se.set(e,s)}if(e.root&&e.root!=="."){let s=e.root;for(let c of ue){let d=e[c];if(typeof d!=="string"||!d)continue;if(j.isAbsolute(d)||Bt(d,s))continue;e[c]=j.join(s,d)}}for(let s of ue){let c=e[s];if(typeof c!=="string"||!c||j.isAbsolute(c))continue;e[s]=j.resolve(r,c)}return e}function Jt(e,r){let o=Se.get(e);for(let l of ue){let s=e[l];if(typeof s!=="string"||!s)continue;let c=j.isAbsolute(s)?s:j.join(r,s);if(Q.existsSync(c))continue;let d=o?.[l]??s,p=e.root,u=!!p&&p!==".";console.warn(`[stx] ${String(l)} resolves to "${c}", which does not exist. Configured as "${d}"`+(u?`, resolved under root "${p}".`:"."))}}function Kt(e){if(e.customDirectives)e.customDirectives=[...e.customDirectives];if(e.middleware)e.middleware=[...e.middleware];if(e.apiRoutes)e.apiRoutes={...e.apiRoutes}}function Gt(e){if(Ra(e.stateDir),e.stateDir=sr(),e.cachePath=or(e.cachePath),e.build)e.build.cacheDir=or(e.build.cacheDir);if(e.media?.cache)e.media.cache.directory=or(e.media.cache.directory);if(e.story)e.story.outDir=or(e.story.outDir)}var K=null,Y=new Map,de=new Map,se=null;async function yo(e,r=Ht){try{return await r(e)}catch(o){if(o instanceof Error&&o.name==="ConfigNotFoundError")return{config:e.defaultConfig};throw o}}async function i(e){let r=e?j.resolve(e):process.cwd(),o=de.get(r);if(o&&o.signature!==Yr(o.graph)){let c=Y.get(r);if(Y.delete(r),de.delete(r),!e)K=null,se=null;let{clearComponentCache:d}=await import("./chunk-3dwr8pyh.js"),{partialsCache:p}=await import("./chunk-w91raavj.js");if(d(),p.clear(),c&&o.configSignature===Zr(o.graph)){let u=c.then(async(g)=>{let y={...o.graph};await vo(y,r),de.set(r,{graph:y,signature:Yr(y),configSignature:Zr(y)});let h={...g,_layerGraph:y};if(!e)K=h;return h});return Y.set(r,u),u}}if(!e){if(K)return K;if(se)return se}let l=Y.get(r);if(l)return l;let s=(async()=>{let c=[".ts",".js",".mjs",".cjs",".json"],d=c.some((v)=>Q.existsSync(j.join(r,`stx.config${v}`))),p=c.some((v)=>Q.existsSync(j.join(r,"config",`ui${v}`))),u;if(d&&p){let v=await yo({name:"ui",cwd:j.join(r,"config"),defaultConfig:N,errorPolicy:"throw",verbose:!1});u=(await yo({name:"stx",alias:"ui",cwd:r,defaultConfig:v.config,errorPolicy:"throw",verbose:!1})).config}else u=(await yo({name:"stx",alias:"ui",cwd:r,defaultConfig:N,errorPolicy:"throw",verbose:!1})).config;if(u.extends!==void 0||o){let v=await ka(r,N);u=v.config,de.set(r,{graph:v.graph,signature:Yr(v.graph),configSignature:Zr(v.graph)})}if(u.runtimeConfig){let{resolveRuntimeConfig:v}=await import("./chunk-wvz7rp5p.js");v(u.runtimeConfig,{});let{generateRuntimeConfigTypes:b}=await import("./chunk-1db0zrz0.js");await b(r,u.runtimeConfig)}Kt(u),Gt(u),Nl(u,r),Jt(u,r);let g=[],y=new Set((u.plugins??[]).map((v)=>typeof v==="string"?v:v[0]));for(let v of u.componentPackages??["@stacksjs/components"]){let b=`${v}/stx-plugin`;if(y.has(b)||y.has(v))continue;try{f.resolve(b,{paths:[r]}),g.push(b)}catch{}}let h=[...u.plugins??[],...g];if(h.length>0){let{pluginManager:v}=await import("./chunk-vqv5w6gs.js"),b=[],x=[];for(let P of h){let S=typeof P==="string"?P:P[0],A=typeof P==="string"?{}:P[1]||{};try{let k,E;try{let w=f.resolve(S,{paths:[r]});k=await import(w),E=j.dirname(w)}catch{let w=j.resolve(r,S);k=await import(w),E=j.dirname(w)}let I=k.default||k;if(!v.has(I.name))await v.register(I,u);if(I.components){let w=Array.isArray(I.components)?I.components:[I.components];for(let C of w)b.push(j.resolve(E,C))}if(I.pages){let w=j.resolve(E,I.pages),C=A.path||"/";x.push({dir:w,prefix:C})}if(I.setup){let w={addDirective:(C)=>{u.customDirectives=u.customDirectives||[],u.customDirectives.push(C)},addRoute:(C,D)=>{u.apiRoutes=u.apiRoutes||{},u.apiRoutes[C]=D},addMiddleware:(C)=>{u.middleware=u.middleware||[],u.middleware.push(C)},pluginDir:E,config:u};await I.setup(A,w)}process.stderr.write(`[stx] Plugin loaded: ${I.name||S}
|
|
1311
1311
|
`)}catch(k){console.warn(`[stx] Failed to load plugin ${S}:`,k.message)}}u._pluginComponentDirs=b,u._pluginPageDirs=x}return u})();if(Y.set(r,s),s.catch(()=>{if(Y.get(r)===s)Y.delete(r)}),!e)se=s,s.then((c)=>{K=c}).catch(()=>{});return s}var R=new Proxy(N,{get(e,r){if(K&&r in K)return K[r];if(!se)i().catch((o)=>{console.warn("[stx] Failed to load config file:",o?.message||o)});return e[r]}});function Ep(e){return e}function Tp(e){let r=[],o=[];if(e.partialsDir!==void 0&&typeof e.partialsDir!=="string")r.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(e.componentsDir!==void 0&&typeof e.componentsDir!=="string")r.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(e.cache!==void 0&&typeof e.cache!=="boolean")r.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(e.debug!==void 0&&typeof e.debug!=="boolean")r.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(e.streaming){if(e.streaming.bufferSize!==void 0){if(typeof e.streaming.bufferSize!=="number"||e.streaming.bufferSize<=0)r.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(e.streaming.timeout!==void 0){if(typeof e.streaming.timeout!=="number"||e.streaming.timeout<=0)r.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(e.streaming.strategy!==void 0){let l=["auto","manual","sections"];if(!l.includes(e.streaming.strategy))r.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${l.join(", ")}`,severity:"error"})}}if(e.i18n){if(e.i18n.format!==void 0){let l=["json","yaml","yml","js"];if(!l.includes(e.i18n.format))r.push({path:"i18n.format",message:`i18n.format must be one of: ${l.join(", ")}`,severity:"error"})}}if(e.animation){if(e.animation.defaultDuration!==void 0){if(typeof e.animation.defaultDuration!=="number"||e.animation.defaultDuration<0)r.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(e.animation.staggerDelay!==void 0){if(typeof e.animation.staggerDelay!=="number"||e.animation.staggerDelay<0)r.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(e.a11y){if(e.a11y.level!==void 0){let l=["AA","AAA"];if(!l.includes(e.a11y.level))r.push({path:"a11y.level",message:`a11y.level must be one of: ${l.join(", ")}`,severity:"error"})}}if(e.hydration){if(e.hydration.mode!==void 0){let l=["progressive","islands"];if(!l.includes(e.hydration.mode))r.push({path:"hydration.mode",message:`hydration.mode must be one of: ${l.join(", ")}`,severity:"error"})}if(e.hydration.preload!==void 0){let l=["none","eager","lazy"];if(!l.includes(e.hydration.preload))r.push({path:"hydration.preload",message:`hydration.preload must be one of: ${l.join(", ")}`,severity:"error"})}}if(e.customDirectives)if(!Array.isArray(e.customDirectives))r.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else e.customDirectives.forEach((l,s)=>{if(!l.name||typeof l.name!=="string")r.push({path:`customDirectives[${s}].name`,message:"Custom directive must have a name string",severity:"error"});if(!l.handler||typeof l.handler!=="function")r.push({path:`customDirectives[${s}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(e.middleware)if(!Array.isArray(e.middleware))r.push({path:"middleware",message:"middleware must be an array",severity:"error"});else e.middleware.forEach((l,s)=>{if(!l.name||typeof l.name!=="string")r.push({path:`middleware[${s}].name`,message:"Middleware must have a name string",severity:"error"});if(!l.handler||typeof l.handler!=="function")r.push({path:`middleware[${s}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!l.timing||!["before","after"].includes(l.timing))r.push({path:`middleware[${s}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(e.debug===!0&&e.cache===!0)o.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(e.seo?.enabled===!0&&!e.seo?.defaultConfig?.title)o.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(e.pwa){if(e.pwa.enabled===!0&&!e.pwa.manifest?.name)r.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(e.pwa.manifest?.display!==void 0){let l=["fullscreen","standalone","minimal-ui","browser"];if(!l.includes(e.pwa.manifest.display))r.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${l.join(", ")}`,severity:"error"})}if(e.pwa.manifest?.orientation!==void 0){let l=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!l.includes(e.pwa.manifest.orientation))r.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${l.join(", ")}`,severity:"error"})}if(e.pwa.routes){let l=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];e.pwa.routes.forEach((s,c)=>{if(!s.pattern||typeof s.pattern!=="string")r.push({path:`pwa.routes[${c}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!l.includes(s.strategy))r.push({path:`pwa.routes[${c}].strategy`,message:`PWA route strategy must be one of: ${l.join(", ")}`,severity:"error"});if(s.maxAgeSeconds!==void 0&&(typeof s.maxAgeSeconds!=="number"||s.maxAgeSeconds<0))r.push({path:`pwa.routes[${c}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(s.maxEntries!==void 0&&(typeof s.maxEntries!=="number"||s.maxEntries<1))r.push({path:`pwa.routes[${c}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(e.pwa.icons?.sizes){if(!Array.isArray(e.pwa.icons.sizes))r.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(e.pwa.icons.sizes.filter((s)=>typeof s!=="number"||s<16||s>1024).length>0)r.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(e.pwa.icons?.purpose){let l=["any","maskable","monochrome"];if(e.pwa.icons.purpose.filter((c)=>!l.includes(c)).length>0)r.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${l.join(", ")}`,severity:"error"})}if(e.pwa.enabled===!0&&!e.pwa.icons?.src)o.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(e.pwa.enabled===!0&&!e.pwa.manifest?.themeColor)o.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:r.length===0,errors:r,warnings:o}}
|
|
1312
1312
|
export{ga,ma,er,Je,ha,Jr,N,Nl,yo,i,R,Ep,Tp};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Mc,$i,Lu,Lc,jc,ju,Bu}from"./chunk-k9j0cp1w.js";import"./chunk-wxj9846e.js";import"./chunk-vm2qnbvv.js";import"./chunk-0yvar2ha.js";import"./chunk-374nhgyf.js";import"./chunk-hfsd13r5.js";import"./chunk-v2zmq70s.js";import"./chunk-jgxzbthg.js";import"./chunk-5btsefqt.js";import"./chunk-k9pk5yq0.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-ygb33q5w.js";import"./chunk-kypwg2ws.js";import{Rt,Wl}from"./chunk-467acz2w.js";import"./chunk-g5jtypvv.js";import"./chunk-t6m5d64b.js";import"./chunk-r0ys9aqa.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{Mc as buildVirtualSource,Rt as extractScriptBlocks,Wl as extractTemplateExpressions,Lc as findRuntimeTypeDeclarations,jc as findStxModuleDeclarations,Bu as formatTypecheckDiagnostics,Lu as sourcePathFor,ju as typecheckStxFiles,$i as virtualPathFor};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{so,oo,io,hp,Hr,yp}from"./chunk-
|
|
2
|
+
import{so,oo,io,hp,Hr,yp}from"./chunk-hnwcd41v.js";export{Hr as clearImageDeliveryCatalog,hp as deliveredImage,io as efficientDeliverySources,so as getImageDelivery,oo as isTransparentImage,yp as prepareImageDelivery};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ud,Wd}from"./chunk-q2ph1a11.js";import"./chunk-vm2qnbvv.js";import"./chunk-0yvar2ha.js";import"./chunk-374nhgyf.js";import"./chunk-hfsd13r5.js";import"./chunk-v2zmq70s.js";import"./chunk-jgxzbthg.js";import"./chunk-5btsefqt.js";import"./chunk-k9pk5yq0.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-ygb33q5w.js";import"./chunk-kypwg2ws.js";import"./chunk-467acz2w.js";import"./chunk-g5jtypvv.js";import"./chunk-t6m5d64b.js";import"./chunk-r0ys9aqa.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{Wd as clearStoreCache,Ud as getStoreScript};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Wo,ks,l,p,E,tt,u,_s,t,a,y}from"./chunk-r0ys9aqa.js";import{be,$t,X,H,Ot,Y,x}from"./chunk-4f5bmy7h.js";import{Xn}from"./chunk-n42421az.js";import{re}from"./chunk-hx787tfa.js";import{Gr}from"./chunk-jgxzbthg.js";var de=1000,pe=!1;function he(n,r){let c=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,e="",o=0,i;while((i=c.exec(n))!==null){let g=i.index+i[0].length,_=i.index+i[0].indexOf("("),b=y(n,"(",")",_);if(b===-1)continue;let d=n.slice(g,b).trim();if(!d)continue;if(!Object.keys(r).some((f)=>new RegExp(`(?:^|[^\\w$.])${f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(d)))continue;let m;try{let f=E(d,r);if(!f||typeof f!=="object")continue;m=JSON.stringify(f)}catch{continue}e+=n.slice(o,g)+m,o=b,c.lastIndex=b}return o===0?n:e+n.slice(o)}function me(n,r){let c=/@component\s*\(/g,e=n,o,i=[];while((o=c.exec(e))!==null){let g=o.index,_=g+o[0].length-1,b=1,d=_+1;while(d<e.length&&b>0){if(e[d]==="(")b++;else if(e[d]===")"){if(b--,b===0)break}d++}if(b!==0)continue;let s=e.substring(_+1,d),m=d+1,f=s.match(/^\s*['"]([^'"]+)['"]/);if(!f)continue;let A=f[1],h=s.slice(f[0].length),O=h.match(/^\s*,\s*/);if(!O)continue;let I=h.slice(O[0].length).trim();if(!I)continue;try{let F=E(I,r),j=JSON.stringify(F),S=`@component('${A}', ${j})`;i.push({start:g,end:m,replacement:S})}catch{continue}}for(let g=i.length-1;g>=0;g--){let{start:_,end:b,replacement:d}=i[g];e=e.substring(0,_)+d+e.substring(b)}return e}function oe(n,r,c){let e=n,o=new RegExp(`${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),i;while((i=o.exec(e))!==null){let g=i.index,_=g+i[0].length-1,b=1,d=_+1,s=null,m=!1;while(d<e.length&&b>0){let h=e[d];if(m){m=!1,d++;continue}if(h==="\\"&&s){m=!0,d++;continue}if(s){if(h===s)s=null;d++;continue}if(h==='"'||h==="'"||h==="`"){s=h,d++;continue}if(h==="(")b++;else if(h===")"){if(b--,b===0)break}d++}if(b!==0)break;let f=e.substring(_+1,d),A=c(f);e=e.substring(0,g)+A+e.substring(d+1)}return e}function xe(n,r){let c=n;return c=c.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(e,o)=>{if(o in r)return`:${o}="${o}"`;return e}),c=c.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(e,o,i)=>{try{if(H(i,r.__stx_client_signal_names||[]))return e;let g=Object.keys(r),_=Object.values(r);Wo(i);let b=!1,s=u(i,g,()=>{b=!0})(..._);if(b)return e;let m=JSON.stringify(s);if(m===void 0){if(!tt(i).some((h)=>!(h in r)))return"";return e}let f=Buffer.from(m,"utf8").toString("base64");return`__stx_${o}="${f}"`}catch(g){return e}}),c}var ee="<!--__STX_BREAK__-->",ne="<!--__STX_CONTINUE__-->";function le(n,r){let c=/\{\{\{?|\{!!|@(break|continue)(?![\w$])/g,e="",o=0;for(let i=c.exec(n);i;i=c.exec(n)){if(!i[1]){let d=i[0].length===3&&i[0]==="{{{"?3:2,s=i[0]==="{!!"?n.indexOf("!!}",c.lastIndex):be(n,i.index,d);if(s<0)break;c.lastIndex=s+(i[0]==="{!!"?3:d);continue}let g=c.lastIndex,_=!0,b=/^\s*\(/.exec(n.slice(g));if(b){let d=g+b[0].length-1,s=y(n,"(",")",d);if(s<0)break;g=s+1;try{let m=`!!(${n.slice(d+1,s).trim()})`;_=p(m)?Boolean(u(m,Object.keys(r))(...Object.values(r))):Boolean(l(m,r))}catch{_=!1}}if(e+=n.slice(o,i.index),_)return e+(i[1]==="break"?ee:ne);o=g,c.lastIndex=g}return e+n.slice(o)}function ae(n){let r=(o)=>o.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),c="",e=0;return Ot(n,(o,i,g)=>(c+=ie(r(n.slice(e,g))),c+=`\${__stxRenderLoopValue(${g}, (${i}), ${o.length})}`,e=g+o.length,o)),c+ie(r(n.slice(e)))}function ue(n,r,c,e){return Y(n,r,c==null?"":String(c),!1,e)}function ie(n){let r=n;return r=oe(r,"@break",(c)=>{let e=c.trim();if(!_s(e))return"";return`\`; if (${e}) { break; } result += \``}),r=oe(r,"@continue",(c)=>{let e=c.trim();if(!_s(e))return"";return`\`; if (${e}) { continue; } result += \``}),r=r.replace(/@break(?!\()/g,"`; break; result += `"),r=r.replace(/@continue(?!\()/g,"`; continue; result += `"),r}function ye(n){let r=/@forelse\s*\(/g,c,e=[],o=/@foreach\s*\(/g,i=/@endforeach/g,g;while((g=o.exec(n))!==null)e.push({pos:g.index,delta:1});while((g=i.exec(n))!==null)e.push({pos:g.index,delta:-1});e.sort((s,m)=>s.pos-m.pos);let _=[],b=0;for(let s of e)b+=s.delta,_.push({pos:s.pos,depth:b});function d(s){let m=0,f=_.length-1,A=0;while(m<=f){let h=m+f>>1;if(_[h].pos<=s)A=_[h].depth,m=h+1;else f=h-1}return A}while((c=r.exec(n))!==null){if(d(c.index)>0)continue;let s=c.index,m=c.index+c[0].length-1,f=1,A=m+1,h=-1;while(A<n.length&&f>0){if(n[A]==="(")f++;else if(n[A]===")"){if(f--,f===0){h=A;break}}A++}if(h===-1)continue;let O=n.substring(m+1,h),I=$t(O);if(!I)continue;let{arrayExpr:F,itemVar:j}=I,S=h+1,w=1,W=S,z=/@forelse\s*\(/g,P=/@endforelse/g,L=-1;while(w>0&&W<n.length){z.lastIndex=W,P.lastIndex=W;let C=z.exec(n),R=P.exec(n);if(!R)break;if(C&&C.index<R.index)w++,W=C.index+C[0].length;else{if(w--,w===0){L=R.index;break}W=R.index+11}}if(L===-1)continue;let k=n.substring(S,L),D=L+11,T=-1,U=0,V=0;while(V<k.length){let C=k.indexOf("@",V);if(C===-1)break;let R=k.substring(C);if(/^@forelse\s*\(/.test(R))U++,V=C+1;else if(R.startsWith("@endforelse"))U--,V=C+11;else if(U===0&&R.startsWith("@empty")){if(k.length<=C+6||!/[a-z]/i.test(k[C+6])){T=C;break}V=C+1}else V=C+1}if(T===-1)continue;return{start:s,end:D,arrayExpr:F,itemVar:j,foreachContent:k.substring(0,T),emptyContent:k.substring(T+6)}}return null}function ce(n,r){let c=n;while(!0){let e=ye(c);if(!e)break;let{start:o,end:i,arrayExpr:g,itemVar:_,foreachContent:b,emptyContent:d}=e;try{let s;if(p(g))s=u(g,Object.keys(r))(...Object.values(r));else s=l(g,r);let m;if(!Array.isArray(s)||s.length===0)m=d;else m=`@foreach (${g} as ${_})${b}@endforeach`;c=c.substring(0,o)+m+c.substring(i)}catch(s){let m=s instanceof Error?s.message:String(s),f=a("Forelse",`Error in @forelse(${g} as ${_}): ${m}`,t.EVALUATION_ERROR);c=c.substring(0,o)+f+c.substring(i)}}return c}var fe="<!--stx:foreach-not-iterable:",Ee=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function _e(n,r){return`${fe}${encodeURIComponent(n)}|${encodeURIComponent(r)}-->`}function $e(n,r){console.warn(`[stx] @foreach(${n}) in ${r}: ${n} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function jr(n){if(!n.includes(fe))return n;return n.replace(Ee,(r,c,e)=>($e(decodeURIComponent(c),decodeURIComponent(e)),""))}function Gn(n,r,c,e,o=!1){let i=n,g=new Set(r.__stx_client_signal_names||[]);for(let s of Xn(n))g.add(s);if(g.size)r={...r,__stx_client_signal_names:[...g]};i=ce(i,r);function _(s){let m=/@foreach\s*\(/g,f;while((f=m.exec(s))!==null){let A=f.index,h=f.index+f[0].length-1,O=1,I=h+1,F=-1;while(I<s.length&&O>0){if(s[I]==="(")O++;else if(s[I]===")"){if(O--,O===0){F=I;break}}I++}if(F===-1)continue;let j=s.substring(h+1,F),S=$t(j);if(!S)continue;let w=A,{arrayExpr:W,itemVar:z}=S,P=F+1,L=1,k=P,D=/@foreach\s*\(/g,T=/@endforeach/g;while(L>0&&k<s.length){D.lastIndex=k,T.lastIndex=k;let U=D.exec(s),V=T.exec(s);if(!V)break;if(U&&U.index<V.index)L++,k=U.index+U[0].length;else{if(L--,L===0){let C=s.substring(P,V.index),R=V.index+11;return{start:w,end:R,arrayExpr:W,itemVar:z,content:C}}k=V.index+11}}}return null}function b(s,m){let f=s;while(!0){let A=_(f);if(!A)break;let{start:h,end:O,arrayExpr:I,itemVar:F,content:j}=A;try{let S=I.trim(),w;if(p(S))w=u(S,Object.keys(m))(...Object.values(m));else w=l(S,m);let W=!1;if(!Array.isArray(w))if(w instanceof Map)w=Array.from(w),W=!0;else if(w instanceof Set)w=Array.from(w);else if(typeof w==="string")w=Array.from(w);else if(w&&typeof w==="object"&&!(w instanceof Date)&&!(w instanceof RegExp))w=Object.entries(w),W=!0;else{let R=_e(S,c)+a("Foreach",`Error in @foreach: ${S} is not iterable`,t.TYPE_ERROR);f=f.substring(0,h)+R+f.substring(O);continue}let z=e?.loops?.useAltLoopVariable??pe,P=F.trim(),L=null,k,D=!1;if(P.includes("=>")){let R=P.split("=>").map((M)=>M.trim());if(R.length===2&&R[0]&&R[1])L=R[0],k=R[1];else k=P}else if(!P.startsWith("[")&&!P.startsWith("{")&&P.includes(",")){let R=P.split(",").map((M)=>M.trim());if(R.length===2&&R[0]&&R[1])k=R[0],L=R[1],D=!0;else k=P}else k=P;let T="",U=new Set(X(`${I} as ${F}`)),V=w,C=m[ks]??new WeakMap;for(let R=0;R<V.length;R++){let M=V[R],te={index:R,iteration:R+1,first:R===0,last:R===V.length-1,count:V.length},N={...m,loop:te,$loop:te,[ks]:C};if(Array.isArray(m.__stx_client_signal_names))N.__stx_client_signal_names=m.__stx_client_signal_names.filter((Z)=>!U.has(Z));if(k.startsWith("[")&&k.endsWith("]")){let Z=k.slice(1,-1).split(",").map((B)=>B.trim());if(Array.isArray(M))Z.forEach((B,K)=>{if(B)N[B]=M[K]});else N[k]=M}else if(k.startsWith("{")&&k.endsWith("}")){let Z=k.slice(1,-1).split(",").map((B)=>B.trim()).filter(Boolean);if(M!==null&&typeof M==="object")Z.forEach((B)=>{let K=B.indexOf(":"),Q=(K===-1?B:B.slice(0,K)).trim(),se=K===-1?Q:B.slice(K+1).trim();if(Q&&se)N[se]=M[Q]});else N[k]=M}else N[k]=M;if(L)if(!D&&W&&Array.isArray(M)&&M.length===2)N[L]=M[0],N[k]=M[1];else N[L]=R;let v=ce(j,N);v=Gn(v,N,c,e,!0),v=re(v,N,c),v=le(v,N);let J=v.indexOf(ee),G=v.indexOf(ne),q=J<0?G:G<0?J:Math.min(J,G);if(q>=0)v=v.slice(0,q);if(v=x(v,N,c),v=xe(v,N),v=me(v,N),v=he(v,N),T+=v,q>=0&&q===J)break}f=f.substring(0,h)+T+f.substring(O)}catch(S){let w=a("Foreach",`Error in @foreach(${I.trim()} as ${F.trim()}): ${S instanceof Error?S.message:String(S)}`,t.EVALUATION_ERROR);f=f.substring(0,h)+w+f.substring(O)}}return f}i=b(i,r),i=Ae(i,r,c,e);let d=e?.loops?.maxWhileIterations??de;return i=Oe(i,r,d),o?i:jr(i)}function El(n){let r=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(n);if(!r||/^(?:const|let|var)$/.test(r[2]))return n;return`${r[1]}let ${n.slice(r[1].length)}`}function ge(n){return _s(n)}function Ae(n,r,c,e){let o=n,i=!0;while(i){i=!1;let g=o.match(/@for\s*\(/);if(!g||g.index===void 0)break;let _=g.index,b=_+g[0].length-1,d=y(o,"(",")",b);if(d===-1)break;let s=El(o.slice(b+1,d)),m=d+1,f=Gr(o.slice(_),"for","endfor");if(f.length===0)break;let A=f[0].content,h=_+f[0].end;if(!ge(s)){let O=a("For",`Unsafe expression in @for: ${s}`,t.UNSAFE_EXPRESSION);o=o.substring(0,_)+O+o.substring(h),i=!0;continue}try{let O=Re(s),I=/@(?:for|foreach|if|unless)\s*\(/.test(A);if(O.length>0&&I){let z=we({forExpr:s,content:A,iterVarNames:O,context:r,filePath:c,options:e});o=o.substring(0,_)+z+o.substring(h),i=!0;continue}let F=Object.keys(r),j=Object.values(r),S=ae(A),W=Function(...F,"__stxRenderLoopValue",`
|
|
2
|
+
import{Wo,ks,l,p,E,tt,u,_s,t,a,y}from"./chunk-r0ys9aqa.js";import{be,$t,X,H,Ot,Y,x}from"./chunk-467acz2w.js";import{Xn}from"./chunk-hfsd13r5.js";import{re}from"./chunk-hx787tfa.js";import{Gr}from"./chunk-jgxzbthg.js";var de=1000,pe=!1;function he(n,r){let c=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,e="",o=0,i;while((i=c.exec(n))!==null){let g=i.index+i[0].length,_=i.index+i[0].indexOf("("),b=y(n,"(",")",_);if(b===-1)continue;let d=n.slice(g,b).trim();if(!d)continue;if(!Object.keys(r).some((f)=>new RegExp(`(?:^|[^\\w$.])${f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(d)))continue;let m;try{let f=E(d,r);if(!f||typeof f!=="object")continue;m=JSON.stringify(f)}catch{continue}e+=n.slice(o,g)+m,o=b,c.lastIndex=b}return o===0?n:e+n.slice(o)}function me(n,r){let c=/@component\s*\(/g,e=n,o,i=[];while((o=c.exec(e))!==null){let g=o.index,_=g+o[0].length-1,b=1,d=_+1;while(d<e.length&&b>0){if(e[d]==="(")b++;else if(e[d]===")"){if(b--,b===0)break}d++}if(b!==0)continue;let s=e.substring(_+1,d),m=d+1,f=s.match(/^\s*['"]([^'"]+)['"]/);if(!f)continue;let A=f[1],h=s.slice(f[0].length),O=h.match(/^\s*,\s*/);if(!O)continue;let I=h.slice(O[0].length).trim();if(!I)continue;try{let F=E(I,r),j=JSON.stringify(F),S=`@component('${A}', ${j})`;i.push({start:g,end:m,replacement:S})}catch{continue}}for(let g=i.length-1;g>=0;g--){let{start:_,end:b,replacement:d}=i[g];e=e.substring(0,_)+d+e.substring(b)}return e}function oe(n,r,c){let e=n,o=new RegExp(`${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),i;while((i=o.exec(e))!==null){let g=i.index,_=g+i[0].length-1,b=1,d=_+1,s=null,m=!1;while(d<e.length&&b>0){let h=e[d];if(m){m=!1,d++;continue}if(h==="\\"&&s){m=!0,d++;continue}if(s){if(h===s)s=null;d++;continue}if(h==='"'||h==="'"||h==="`"){s=h,d++;continue}if(h==="(")b++;else if(h===")"){if(b--,b===0)break}d++}if(b!==0)break;let f=e.substring(_+1,d),A=c(f);e=e.substring(0,g)+A+e.substring(d+1)}return e}function xe(n,r){let c=n;return c=c.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(e,o)=>{if(o in r)return`:${o}="${o}"`;return e}),c=c.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(e,o,i)=>{try{if(H(i,r.__stx_client_signal_names||[]))return e;let g=Object.keys(r),_=Object.values(r);Wo(i);let b=!1,s=u(i,g,()=>{b=!0})(..._);if(b)return e;let m=JSON.stringify(s);if(m===void 0){if(!tt(i).some((h)=>!(h in r)))return"";return e}let f=Buffer.from(m,"utf8").toString("base64");return`__stx_${o}="${f}"`}catch(g){return e}}),c}var ee="<!--__STX_BREAK__-->",ne="<!--__STX_CONTINUE__-->";function le(n,r){let c=/\{\{\{?|\{!!|@(break|continue)(?![\w$])/g,e="",o=0;for(let i=c.exec(n);i;i=c.exec(n)){if(!i[1]){let d=i[0].length===3&&i[0]==="{{{"?3:2,s=i[0]==="{!!"?n.indexOf("!!}",c.lastIndex):be(n,i.index,d);if(s<0)break;c.lastIndex=s+(i[0]==="{!!"?3:d);continue}let g=c.lastIndex,_=!0,b=/^\s*\(/.exec(n.slice(g));if(b){let d=g+b[0].length-1,s=y(n,"(",")",d);if(s<0)break;g=s+1;try{let m=`!!(${n.slice(d+1,s).trim()})`;_=p(m)?Boolean(u(m,Object.keys(r))(...Object.values(r))):Boolean(l(m,r))}catch{_=!1}}if(e+=n.slice(o,i.index),_)return e+(i[1]==="break"?ee:ne);o=g,c.lastIndex=g}return e+n.slice(o)}function ae(n){let r=(o)=>o.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),c="",e=0;return Ot(n,(o,i,g)=>(c+=ie(r(n.slice(e,g))),c+=`\${__stxRenderLoopValue(${g}, (${i}), ${o.length})}`,e=g+o.length,o)),c+ie(r(n.slice(e)))}function ue(n,r,c,e){return Y(n,r,c==null?"":String(c),!1,e)}function ie(n){let r=n;return r=oe(r,"@break",(c)=>{let e=c.trim();if(!_s(e))return"";return`\`; if (${e}) { break; } result += \``}),r=oe(r,"@continue",(c)=>{let e=c.trim();if(!_s(e))return"";return`\`; if (${e}) { continue; } result += \``}),r=r.replace(/@break(?!\()/g,"`; break; result += `"),r=r.replace(/@continue(?!\()/g,"`; continue; result += `"),r}function ye(n){let r=/@forelse\s*\(/g,c,e=[],o=/@foreach\s*\(/g,i=/@endforeach/g,g;while((g=o.exec(n))!==null)e.push({pos:g.index,delta:1});while((g=i.exec(n))!==null)e.push({pos:g.index,delta:-1});e.sort((s,m)=>s.pos-m.pos);let _=[],b=0;for(let s of e)b+=s.delta,_.push({pos:s.pos,depth:b});function d(s){let m=0,f=_.length-1,A=0;while(m<=f){let h=m+f>>1;if(_[h].pos<=s)A=_[h].depth,m=h+1;else f=h-1}return A}while((c=r.exec(n))!==null){if(d(c.index)>0)continue;let s=c.index,m=c.index+c[0].length-1,f=1,A=m+1,h=-1;while(A<n.length&&f>0){if(n[A]==="(")f++;else if(n[A]===")"){if(f--,f===0){h=A;break}}A++}if(h===-1)continue;let O=n.substring(m+1,h),I=$t(O);if(!I)continue;let{arrayExpr:F,itemVar:j}=I,S=h+1,w=1,W=S,z=/@forelse\s*\(/g,P=/@endforelse/g,L=-1;while(w>0&&W<n.length){z.lastIndex=W,P.lastIndex=W;let C=z.exec(n),R=P.exec(n);if(!R)break;if(C&&C.index<R.index)w++,W=C.index+C[0].length;else{if(w--,w===0){L=R.index;break}W=R.index+11}}if(L===-1)continue;let k=n.substring(S,L),D=L+11,T=-1,U=0,V=0;while(V<k.length){let C=k.indexOf("@",V);if(C===-1)break;let R=k.substring(C);if(/^@forelse\s*\(/.test(R))U++,V=C+1;else if(R.startsWith("@endforelse"))U--,V=C+11;else if(U===0&&R.startsWith("@empty")){if(k.length<=C+6||!/[a-z]/i.test(k[C+6])){T=C;break}V=C+1}else V=C+1}if(T===-1)continue;return{start:s,end:D,arrayExpr:F,itemVar:j,foreachContent:k.substring(0,T),emptyContent:k.substring(T+6)}}return null}function ce(n,r){let c=n;while(!0){let e=ye(c);if(!e)break;let{start:o,end:i,arrayExpr:g,itemVar:_,foreachContent:b,emptyContent:d}=e;try{let s;if(p(g))s=u(g,Object.keys(r))(...Object.values(r));else s=l(g,r);let m;if(!Array.isArray(s)||s.length===0)m=d;else m=`@foreach (${g} as ${_})${b}@endforeach`;c=c.substring(0,o)+m+c.substring(i)}catch(s){let m=s instanceof Error?s.message:String(s),f=a("Forelse",`Error in @forelse(${g} as ${_}): ${m}`,t.EVALUATION_ERROR);c=c.substring(0,o)+f+c.substring(i)}}return c}var fe="<!--stx:foreach-not-iterable:",Ee=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function _e(n,r){return`${fe}${encodeURIComponent(n)}|${encodeURIComponent(r)}-->`}function $e(n,r){console.warn(`[stx] @foreach(${n}) in ${r}: ${n} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function jr(n){if(!n.includes(fe))return n;return n.replace(Ee,(r,c,e)=>($e(decodeURIComponent(c),decodeURIComponent(e)),""))}function Gn(n,r,c,e,o=!1){let i=n,g=new Set(r.__stx_client_signal_names||[]);for(let s of Xn(n))g.add(s);if(g.size)r={...r,__stx_client_signal_names:[...g]};i=ce(i,r);function _(s){let m=/@foreach\s*\(/g,f;while((f=m.exec(s))!==null){let A=f.index,h=f.index+f[0].length-1,O=1,I=h+1,F=-1;while(I<s.length&&O>0){if(s[I]==="(")O++;else if(s[I]===")"){if(O--,O===0){F=I;break}}I++}if(F===-1)continue;let j=s.substring(h+1,F),S=$t(j);if(!S)continue;let w=A,{arrayExpr:W,itemVar:z}=S,P=F+1,L=1,k=P,D=/@foreach\s*\(/g,T=/@endforeach/g;while(L>0&&k<s.length){D.lastIndex=k,T.lastIndex=k;let U=D.exec(s),V=T.exec(s);if(!V)break;if(U&&U.index<V.index)L++,k=U.index+U[0].length;else{if(L--,L===0){let C=s.substring(P,V.index),R=V.index+11;return{start:w,end:R,arrayExpr:W,itemVar:z,content:C}}k=V.index+11}}}return null}function b(s,m){let f=s;while(!0){let A=_(f);if(!A)break;let{start:h,end:O,arrayExpr:I,itemVar:F,content:j}=A;try{let S=I.trim(),w;if(p(S))w=u(S,Object.keys(m))(...Object.values(m));else w=l(S,m);let W=!1;if(!Array.isArray(w))if(w instanceof Map)w=Array.from(w),W=!0;else if(w instanceof Set)w=Array.from(w);else if(typeof w==="string")w=Array.from(w);else if(w&&typeof w==="object"&&!(w instanceof Date)&&!(w instanceof RegExp))w=Object.entries(w),W=!0;else{let R=_e(S,c)+a("Foreach",`Error in @foreach: ${S} is not iterable`,t.TYPE_ERROR);f=f.substring(0,h)+R+f.substring(O);continue}let z=e?.loops?.useAltLoopVariable??pe,P=F.trim(),L=null,k,D=!1;if(P.includes("=>")){let R=P.split("=>").map((M)=>M.trim());if(R.length===2&&R[0]&&R[1])L=R[0],k=R[1];else k=P}else if(!P.startsWith("[")&&!P.startsWith("{")&&P.includes(",")){let R=P.split(",").map((M)=>M.trim());if(R.length===2&&R[0]&&R[1])k=R[0],L=R[1],D=!0;else k=P}else k=P;let T="",U=new Set(X(`${I} as ${F}`)),V=w,C=m[ks]??new WeakMap;for(let R=0;R<V.length;R++){let M=V[R],te={index:R,iteration:R+1,first:R===0,last:R===V.length-1,count:V.length},N={...m,loop:te,$loop:te,[ks]:C};if(Array.isArray(m.__stx_client_signal_names))N.__stx_client_signal_names=m.__stx_client_signal_names.filter((Z)=>!U.has(Z));if(k.startsWith("[")&&k.endsWith("]")){let Z=k.slice(1,-1).split(",").map((B)=>B.trim());if(Array.isArray(M))Z.forEach((B,K)=>{if(B)N[B]=M[K]});else N[k]=M}else if(k.startsWith("{")&&k.endsWith("}")){let Z=k.slice(1,-1).split(",").map((B)=>B.trim()).filter(Boolean);if(M!==null&&typeof M==="object")Z.forEach((B)=>{let K=B.indexOf(":"),Q=(K===-1?B:B.slice(0,K)).trim(),se=K===-1?Q:B.slice(K+1).trim();if(Q&&se)N[se]=M[Q]});else N[k]=M}else N[k]=M;if(L)if(!D&&W&&Array.isArray(M)&&M.length===2)N[L]=M[0],N[k]=M[1];else N[L]=R;let v=ce(j,N);v=Gn(v,N,c,e,!0),v=re(v,N,c),v=le(v,N);let J=v.indexOf(ee),G=v.indexOf(ne),q=J<0?G:G<0?J:Math.min(J,G);if(q>=0)v=v.slice(0,q);if(v=x(v,N,c),v=xe(v,N),v=me(v,N),v=he(v,N),T+=v,q>=0&&q===J)break}f=f.substring(0,h)+T+f.substring(O)}catch(S){let w=a("Foreach",`Error in @foreach(${I.trim()} as ${F.trim()}): ${S instanceof Error?S.message:String(S)}`,t.EVALUATION_ERROR);f=f.substring(0,h)+w+f.substring(O)}}return f}i=b(i,r),i=Ae(i,r,c,e);let d=e?.loops?.maxWhileIterations??de;return i=Oe(i,r,d),o?i:jr(i)}function El(n){let r=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(n);if(!r||/^(?:const|let|var)$/.test(r[2]))return n;return`${r[1]}let ${n.slice(r[1].length)}`}function ge(n){return _s(n)}function Ae(n,r,c,e){let o=n,i=!0;while(i){i=!1;let g=o.match(/@for\s*\(/);if(!g||g.index===void 0)break;let _=g.index,b=_+g[0].length-1,d=y(o,"(",")",b);if(d===-1)break;let s=El(o.slice(b+1,d)),m=d+1,f=Gr(o.slice(_),"for","endfor");if(f.length===0)break;let A=f[0].content,h=_+f[0].end;if(!ge(s)){let O=a("For",`Unsafe expression in @for: ${s}`,t.UNSAFE_EXPRESSION);o=o.substring(0,_)+O+o.substring(h),i=!0;continue}try{let O=Re(s),I=/@(?:for|foreach|if|unless)\s*\(/.test(A);if(O.length>0&&I){let z=we({forExpr:s,content:A,iterVarNames:O,context:r,filePath:c,options:e});o=o.substring(0,_)+z+o.substring(h),i=!0;continue}let F=Object.keys(r),j=Object.values(r),S=ae(A),W=Function(...F,"__stxRenderLoopValue",`
|
|
3
3
|
let result = '';
|
|
4
4
|
for (${s}) {
|
|
5
5
|
result += \`${S}\`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import m from"path";var y=/__stxModules\["((?:[^"\\]|\\.)*)"\]/g;function I(...o){let r=new Set;for(let s of o){if(!s||!s.includes("__stxModules["))continue;for(let e of s.matchAll(y))try{r.add(JSON.parse(`"${e[1]}"`))}catch{}}return[...r].sort()}async function w(o,r={}){if(o.length===0)return null;let s=process.cwd(),e=[],a=[];o.forEach((t,c)=>{let i=t.startsWith("npm:")?t.slice(4):m.resolve(s,t),l=`__stxRegistered${c}`,p=JSON.stringify(t);e.push(`import * as ${l} from ${JSON.stringify(i)};`),a.push(`if (!globalThis.__stxModules[${p}]) globalThis.__stxModules[${p}] = ${l};`)});let d=[...e,"globalThis.__stxModules = globalThis.__stxModules || {};",...a].join(`
|
|
3
|
-
`),n;try{let{bundleClientScript:t}=await import("./chunk-
|
|
3
|
+
`),n;try{let{bundleClientScript:t}=await import("./chunk-k74v03v7.js");n=await t(d,m.join(s,".stx-module-registry.ts"),{projectRoot:s,minify:r.minify,externalizeUserModules:!1,collectInputs:r.collectInputs,throwOnFailure:!0})}catch(t){let{formatBuildFailure:c}=await import("./chunk-6kam8r5y.js"),i=c(t);console.warn(`[stx] could not build the page module registry (#1957): ${i}`);let l=`[stx] the page module registry did not build, so ${o.join(", ")} cannot load (#1957): ${i}`;return`;console.error(${JSON.stringify(l)});`}let{transformAutoImports:f,generateAutoImportDestructuring:_}=await import("./chunk-n1xyrx1a.js"),u=f(n),h=_(u.stxImports,u.browserImports),{transformStoreImports:x}=await import("./chunk-9859r1d5.js");n=x(u.code);let g=JSON.stringify(new Bun.CryptoHasher("md5").update(d).digest("hex").slice(0,12));return[";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${g}]) return;`,` __stxBundles[${g}] = true;`,h,n,"})();"].join(`
|
|
4
4
|
`)}export{w as buildModuleRegistryScript,I as registeredModuleIdsIn};
|