@stacksjs/stx 0.2.421 → 0.2.422
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-wynvh7dc.js → chunk-1569v24d.js} +1 -1
- package/dist/{chunk-cw6j75ck.js → chunk-1r0c5920.js} +2 -2
- package/dist/{chunk-6aqcgrhw.js → chunk-2cn8krpp.js} +1 -1
- package/dist/{chunk-8j8k27xb.js → chunk-3xm6dyab.js} +30 -7
- package/dist/chunk-4363reg4.js +2 -0
- package/dist/{chunk-bvbank3z.js → chunk-48axv7bm.js} +1 -1
- package/dist/{chunk-dscsvkfa.js → chunk-50hgr79y.js} +1 -1
- package/dist/chunk-54wczcee.js +2 -0
- package/dist/{chunk-rj3hyqff.js → chunk-597rfddk.js} +34 -34
- package/dist/{chunk-4e101kjp.js → chunk-5e9zkd65.js} +1 -1
- package/dist/{chunk-r8wze9ym.js → chunk-681cxw8j.js} +2 -2
- package/dist/{chunk-p7b17yr0.js → chunk-74gz26zs.js} +1 -1
- package/dist/{chunk-32y3767j.js → chunk-788g87ft.js} +1 -1
- package/dist/{chunk-y8rpk1b9.js → chunk-7906p8zs.js} +1 -1
- package/dist/{chunk-014gmm8w.js → chunk-7abgzdsm.js} +1 -1
- package/dist/{chunk-vwxasbtx.js → chunk-7dkfjmjw.js} +1 -1
- package/dist/{chunk-89e1d0rz.js → chunk-7vr5w75r.js} +2 -2
- package/dist/{chunk-ncvfjcr2.js → chunk-7zn0yyqk.js} +1 -1
- package/dist/{chunk-10967rws.js → chunk-837nb4zv.js} +1 -1
- package/dist/{chunk-s0pmn48x.js → chunk-8d2kamh2.js} +1 -1
- package/dist/{chunk-z521cyfv.js → chunk-95e3rz88.js} +2 -2
- package/dist/chunk-9bpnz431.js +2 -0
- package/dist/{chunk-srdzwtsq.js → chunk-d0q2x8e3.js} +1 -1
- package/dist/{chunk-a4r19yxm.js → chunk-d2z6828s.js} +1 -1
- package/dist/{chunk-3kmhv1kf.js → chunk-dejsjk4h.js} +1 -1
- package/dist/{chunk-0y7x0hvr.js → chunk-dmxh7zwq.js} +1 -1
- package/dist/{chunk-debz86rr.js → chunk-ebkpdc45.js} +1 -1
- package/dist/{chunk-rj8rdd8n.js → chunk-epv0ahg1.js} +1 -1
- package/dist/chunk-f5489ese.js +2 -0
- package/dist/{chunk-eav0pt6d.js → chunk-fqq1w9m1.js} +1 -1
- package/dist/{chunk-pzngjk81.js → chunk-gp8xzbyt.js} +6 -6
- package/dist/{chunk-bh4x090w.js → chunk-h1585jbm.js} +3 -3
- package/dist/chunk-hcgsgnq8.js +2 -0
- package/dist/{chunk-4mew0ae3.js → chunk-hmdnn9ja.js} +1 -1
- package/dist/chunk-hp7ewdnp.js +2 -0
- package/dist/{chunk-h1h6xe1k.js → chunk-ja7znxnz.js} +1 -1
- package/dist/{chunk-awtrcb5m.js → chunk-js79j12f.js} +2 -2
- package/dist/{chunk-yvq1f313.js → chunk-kfsp322p.js} +1 -1
- package/dist/chunk-kt557jaj.js +2 -0
- package/dist/{chunk-8vq0qjq9.js → chunk-kzkjc12e.js} +3 -3
- package/dist/{chunk-m16h8ea0.js → chunk-n7jjp08m.js} +2 -2
- package/dist/chunk-n8kqvzba.js +2 -0
- package/dist/{chunk-5eqd40k0.js → chunk-na70r4sp.js} +1 -1
- package/dist/{chunk-8drvzsk1.js → chunk-nqr77pxk.js} +2 -2
- package/dist/{chunk-3zye6eh1.js → chunk-psqk7932.js} +1 -1
- package/dist/{chunk-hahzjyxc.js → chunk-pv5nr9pd.js} +1 -1
- package/dist/{chunk-kea18wnc.js → chunk-q0cehgy2.js} +1 -1
- package/dist/{chunk-b01jqb5f.js → chunk-qeye0901.js} +1 -1
- package/dist/{chunk-z0ck9t6j.js → chunk-qwgdtrhj.js} +1 -1
- package/dist/{chunk-b7z2yegr.js → chunk-qy59yp2v.js} +1 -1
- package/dist/{chunk-m2jphkdv.js → chunk-vv4kkwhn.js} +1 -1
- package/dist/{chunk-bmk0s261.js → chunk-vwhd3h8x.js} +1 -1
- package/dist/{chunk-cvzkbsds.js → chunk-vxj8kd2v.js} +1 -1
- package/dist/chunk-vzzpvn21.js +2 -0
- package/dist/{chunk-mk7b3qdz.js → chunk-w1a2v264.js} +1 -1
- package/dist/{chunk-ax58cds3.js → chunk-w72p2ak0.js} +2 -2
- package/dist/{chunk-hjp990p8.js → chunk-w83djypm.js} +1 -1
- package/dist/{chunk-4488r5j1.js → chunk-wcs7w8wv.js} +1 -1
- package/dist/{chunk-1336h4sv.js → chunk-wr6b99pw.js} +1 -1
- package/dist/{chunk-s58yz9q0.js → chunk-x6ndnpvr.js} +1 -1
- package/dist/{chunk-jjm0ekw8.js → chunk-ykwmqh8z.js} +1 -1
- package/dist/{chunk-y4xs4m7p.js → chunk-ys71pmrb.js} +1 -1
- package/dist/{chunk-8nsqac4z.js → chunk-z5y4qyhg.js} +1 -1
- package/dist/{chunk-3ynkg5dz.js → chunk-zp0mg8b2.js} +1 -1
- package/dist/cli.js +13 -13
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/pwa.js +1 -1
- package/dist/signals.js +27 -4
- package/dist/ssg.js +2 -2
- package/dist/variable-extractor.js +4 -1
- package/package.json +5 -5
- package/dist/chunk-0n76c3g8.js +0 -2
- package/dist/chunk-4amznxaq.js +0 -2
- package/dist/chunk-5akd7qsb.js +0 -2
- package/dist/chunk-6r9y4p81.js +0 -2
- package/dist/chunk-75zcwcrt.js +0 -2
- package/dist/chunk-k1am0dyg.js +0 -2
- package/dist/chunk-y9m93qkk.js +0 -2
- package/dist/chunk-ya9c8nec.js +0 -2
- package/dist/chunk-yy3dgwfm.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{St,ns,qi,lc}from"./chunk-
|
|
2
|
+
import{St,ns,qi,lc}from"./chunk-597rfddk.js";import"./chunk-11ra3sbc.js";import"./chunk-x5ks23vx.js";import"./chunk-g1fxmp9z.js";import"./chunk-5e9zkd65.js";import"./chunk-62r4fa4q.js";import"./chunk-788g87ft.js";import"./chunk-w72p2ak0.js";import"./chunk-09hhrjk9.js";import"./chunk-tafebmtg.js";import"./chunk-757ec865.js";import"./chunk-66k7yxnr.js";import"./chunk-4n6c5rp5.js";export{lc as declareBareLoopHead,St as parseLoopBinding,qi as processLoops,ns as reportDeferredLoopWarnings};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Mi,Wr,Y,Ne,bt,b,je,Be,Ln,d,nn}from"./chunk-
|
|
2
|
+
import{Mi,Wr,Y,Ne,bt,b,je,Be,Ln,d,nn}from"./chunk-597rfddk.js";import{D}from"./chunk-jjnfj9nf.js";var j=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function F(t,n,e){let r={fullTag:e,content:n,attrs:t};if(/\bserver\b/.test(t))return{...r,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...r,type:"client"};if(j.test(n))return{...r,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...r,type:"client"};return{...r,type:"server"}}var H=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function Js(t){let n=[],e=[],r=[],o=0;while(o<t.length){let s=t.indexOf("<",o);if(s===-1)break;let a=Ne(t,s);if(a>s){o=a;continue}let i=Y(t,s);if(i>s){let c=t.slice(s,i),u=H.exec(c);if(u){let l=F(u[1],u[2],c);switch(l.type){case"signals":n.push(l);break;case"client":e.push(l);break;case"server":r.push(l);break}}o=i;continue}o=s+(t.startsWith("<!--",s)?4:1)}return{signals:n,client:e,server:r}}var L=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function V(t){let n=[],e=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,r;while((r=e.exec(t))!==null)n.push({start:r.index,end:r.index+r[0].length});return n}function P(t,n){return n.some((e)=>t>=e.start&&t<e.end)}function B(t){let n=(t||"").trim();if(!n)return null;if(/[\s>+~,:]/.test(n))return null;let e={},r=n,o=r.match(/^[a-z][\w-]*/i);if(o)e.tag=o[0].toLowerCase(),r=r.slice(o[0].length);while(r.length>0){let s=r.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(s){if(e.attr=s[1],s[3]!==void 0&&s[3]!=="")e.attrValue=s[3];r=r.slice(s[0].length);continue}let a=r.match(/^#([\w-]+)/);if(a){e.id=a[1],r=r.slice(a[0].length);continue}let i=r.match(/^\.([\w-]+)/);if(i){e.className=i[1],r=r.slice(i[0].length);continue}return null}if(!e.tag&&!e.attr&&!e.id&&!e.className)return null;return e}function q(t,n){if(n.attr){if(!(n.attrValue===void 0?new RegExp(`\\b${n.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${n.attr}\\s*=\\s*(["'])\\s*${n.attrValue}\\s*\\1`,"i")).test(t))return!1}if(n.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${n.id}\\s*\\1`,"i").test(t))return!1}if(n.className){let e=t.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!e)return!1;if(!e[2].split(/\s+/).includes(n.className))return!1}return!0}function T(t,n="main"){let e=B(n);if(!e)return null;let r=/<([a-z][\w-]*)\b([^>]*)>/gi,o=V(t),s;while((s=r.exec(t))!==null){if(P(s.index,o))continue;let a=s[1].toLowerCase(),i=s[2]||"";if(i.trimEnd().endsWith("/")||L.has(a))continue;if(e.tag&&e.tag!==a)continue;if(!q(i,e))continue;let c=s[0],u=s.index+c.length,l=new RegExp(`<(/?)${a}\\b([^>]*)>`,"gi");l.lastIndex=u;let f=1,p;while((p=l.exec(t))!==null){if(P(p.index,o))continue;let h=p[1]==="/";if(!h&&(p[2]||"").trimEnd().endsWith("/"))continue;if(f+=h?-1:1,f===0)return{openTag:c,openIndex:s.index,start:u,end:p.index,tagName:a}}return null}return null}var _e="private, no-store";function Ys(t){return t.replace(/&#(\d+);/g,(n,e)=>O(Number(e),n)).replace(/&#x([0-9a-f]+);/gi,(n,e)=>O(Number.parseInt(e,16),n)).replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&")}function O(t,n){if(!Number.isInteger(t)||t<0||t>1114111)return n;try{return String.fromCodePoint(t)}catch{return n}}function ne(t){return t.headers.get("X-STX-Router")==="true"}function z(t,n){if(!t)return n;return t.split(",").some((r)=>r.trim().toLowerCase()===n.toLowerCase())?t:`${t}, ${n}`}function C(t){return{Vary:z(t,"X-STX-Router")}}import E from"path";var G="stx-page-head:",U=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,v={dev:null,prod:null};function W(){let t=D()?"dev":"prod",n=v[t];if(n!==null)return n;try{let e=import.meta.require("./chunk-ac033b93.js"),r=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;v[t]=`<script>${r()}</script>`}catch{v[t]=""}return v[t]}async function Zs(t,n){if(n===!1)return null;if(n&&typeof n==="string"){let r=E.resolve(t,n);if(await Bun.file(r).exists())return r;return null}let e=E.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function yr(t,n){try{let e=await Bun.file(t).text(),r=e,o=e.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(o)r=o[1].trim();let s=Js(e),a=[...s.client.map((m)=>m.fullTag),...s.signals.map((m)=>m.fullTag)],i=[],c=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,u;while((u=c.exec(e))!==null)i.push(u[0]);let l=r;for(let m of s.server)l=l.replace(m.fullTag,"");for(let m of s.client)l=l.replace(m.fullTag,"");l=l.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let f="<!--__STX_PAGE_SLOT__-->";if(l=l.replace(/<slot\s*\/>/gi,f).replace(/<slot\s*>\s*<\/slot>/gi,f),!l.includes(f))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:p,extractVariables:h,defaultConfig:x,loadStxConfig:y}=await import("./chunk-vzzpvn21.js"),R=await y(),g={__filename:t,__dirname:E.dirname(t)};for(let m of a){let A=m.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(A&&!m.includes("client")&&!m.includes('type="module"'))await h(A[1],g,t)}let S=await p(l,g,t,{...x,...R,...n},new Set),w=S.indexOf(f);if(w===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:S.substring(0,w),afterSlot:S.substring(w+f.length),filePath:t,shellScripts:a,shellStyles:i}}catch(e){return console.error(`[stx] Error processing shell ${t}:`,e),null}}function Sn(t,n,e){let r,o="",s=n.match(U);if(s){n=n.replace(s[0],"");try{let l=Buffer.from(s[1],"base64").toString("utf8"),f=l.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(f)r=f[1].trim();o=l.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let a=e||r||"stx App",i=W(),c="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -26,5 +26,5 @@ ${i}
|
|
|
26
26
|
`));if(o.length>0)x.push(o.join(`
|
|
27
27
|
`));if(f.length>0)x.push(f.join(`
|
|
28
28
|
`));return x.push(l),x.join(`
|
|
29
|
-
`)}import _ from"fs";import N from"path";function ei(t,n,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:n,outputDir:e}}function ti(t,n){let e=N.join(n,"manifest.json");_.writeFileSync(e,JSON.stringify(t,null,2))}function ni(t){let n=N.join(t,"manifest.json");if(!_.existsSync(n))return null;try{let e=_.readFileSync(n,"utf-8"),r=JSON.parse(e);if(r.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${r.version}`),null;return r}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function k(t,n,e={}){let r=`${encodeURIComponent(t)}=${encodeURIComponent(n)}`;if(e.maxAge!==void 0)r+=`; Max-Age=${e.maxAge}`;if(e.expires)r+=`; Expires=${e.expires.toUTCString()}`;if(e.path)r+=`; Path=${e.path}`;if(e.domain)r+=`; Domain=${e.domain}`;if(e.secure)r+="; Secure";if(e.httpOnly)r+="; HttpOnly";if(e.sameSite)r+=`; SameSite=${e.sameSite}`;return r}async function J(t){let n=t.headers.get("content-type")||"",e={},r=(o,s)=>{let a=e[o];if(a===void 0)e[o]=s;else if(Array.isArray(a))a.push(s);else e[o]=[a,s]};if(n.includes("multipart/form-data")){let o=await t.formData();for(let[s,a]of o.entries())if(typeof a==="string")r(s,a);return e}if(n.includes("application/x-www-form-urlencoded")){for(let[o,s]of new URLSearchParams(await t.text()).entries())r(o,s);return e}return e}function br(t){if(!t)return!1;let n=t.toUpperCase();return n!=="GET"&&n!=="HEAD"}async function I(t,n={}){let e=n.request,r=n.method??e?.method;if(!e||!br(r))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let o={};try{o=await J(e)}catch{}let s=await t.action({request:e,form:o,params:n.params??{},query:t.query??{},cookies:n.cookies??{}});if(s&&typeof s==="object"){let a=s,i=K(a.cookies),c=a.redirect;if(typeof c==="string"&&c)return{redirect:c,ran:!0,...i.length>0?{cookies:i}:{}};let{cookies:u,redirect:l,...f}=a;if(Object.assign(t,f),i.length>0)return{ran:!0,cookies:i}}return{ran:!0}}function K(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let n=[];for(let[e,r]of Object.entries(t)){if(!e)continue;if(typeof r==="string"){n.push(k(e,r));continue}if(r&&typeof r==="object"){let o=r;if(typeof o.value!=="string")continue;n.push(k(e,o.value,o))}}return n}function ri(t,n=[],e){let r=new Headers({Location:t,"Cache-Control":"no-store"});for(let o of n)r.append("Set-Cookie",o);for(let[o,s]of Object.entries(e??{}))if(o.toLowerCase()!=="location")r.set(o,s);return new Response(null,{status:303,headers:r})}async function At(t,n={}){let{html:e,context:r,redirect:o,cookies:s}=await Z(t,n),a=je(r),i=Be(r);if(o)return{html:e,redirect:o,cookies:s,status:a,headers:i};let{extractStreamBoundaries:c}=await import("./chunk-
|
|
29
|
+
`)}import _ from"fs";import N from"path";function ei(t,n,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:n,outputDir:e}}function ti(t,n){let e=N.join(n,"manifest.json");_.writeFileSync(e,JSON.stringify(t,null,2))}function ni(t){let n=N.join(t,"manifest.json");if(!_.existsSync(n))return null;try{let e=_.readFileSync(n,"utf-8"),r=JSON.parse(e);if(r.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${r.version}`),null;return r}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function k(t,n,e={}){let r=`${encodeURIComponent(t)}=${encodeURIComponent(n)}`;if(e.maxAge!==void 0)r+=`; Max-Age=${e.maxAge}`;if(e.expires)r+=`; Expires=${e.expires.toUTCString()}`;if(e.path)r+=`; Path=${e.path}`;if(e.domain)r+=`; Domain=${e.domain}`;if(e.secure)r+="; Secure";if(e.httpOnly)r+="; HttpOnly";if(e.sameSite)r+=`; SameSite=${e.sameSite}`;return r}async function J(t){let n=t.headers.get("content-type")||"",e={},r=(o,s)=>{let a=e[o];if(a===void 0)e[o]=s;else if(Array.isArray(a))a.push(s);else e[o]=[a,s]};if(n.includes("multipart/form-data")){let o=await t.formData();for(let[s,a]of o.entries())if(typeof a==="string")r(s,a);return e}if(n.includes("application/x-www-form-urlencoded")){for(let[o,s]of new URLSearchParams(await t.text()).entries())r(o,s);return e}return e}function br(t){if(!t)return!1;let n=t.toUpperCase();return n!=="GET"&&n!=="HEAD"}async function I(t,n={}){let e=n.request,r=n.method??e?.method;if(!e||!br(r))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let o={};try{o=await J(e)}catch{}let s=await t.action({request:e,form:o,params:n.params??{},query:t.query??{},cookies:n.cookies??{}});if(s&&typeof s==="object"){let a=s,i=K(a.cookies),c=a.redirect;if(typeof c==="string"&&c)return{redirect:c,ran:!0,...i.length>0?{cookies:i}:{}};let{cookies:u,redirect:l,...f}=a;if(Object.assign(t,f),i.length>0)return{ran:!0,cookies:i}}return{ran:!0}}function K(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let n=[];for(let[e,r]of Object.entries(t)){if(!e)continue;if(typeof r==="string"){n.push(k(e,r));continue}if(r&&typeof r==="object"){let o=r;if(typeof o.value!=="string")continue;n.push(k(e,o.value,o))}}return n}function ri(t,n=[],e){let r=new Headers({Location:t,"Cache-Control":"no-store"});for(let o of n)r.append("Set-Cookie",o);for(let[o,s]of Object.entries(e??{}))if(o.toLowerCase()!=="location")r.set(o,s);return new Response(null,{status:303,headers:r})}async function At(t,n={}){let{html:e,context:r,redirect:o,cookies:s}=await Z(t,n),a=je(r),i=Be(r);if(o)return{html:e,redirect:o,cookies:s,status:a,headers:i};let{extractStreamBoundaries:c}=await import("./chunk-vwhd3h8x.js"),u=c(r),l=t.streamTemplates;if(l&&Object.keys(l).length>0){let{processDirectives:f}=await import("./chunk-psqk7932.js"),{defaultConfig:p}=await import("./chunk-7zn0yyqk.js"),h=r.streamBoundaries||{},x={...p,autoShell:!1},y=Object.keys(l).map((g)=>({id:g,render:async()=>{let S=typeof h[g]==="function"?await h[g]():void 0;return f(l[g],{...r,$boundary:S},t.sourceFile,x,new Set)}})),R=new Set(y.map((g)=>g.id));u=[...(u||[]).filter((g)=>!R.has(g.id)),...y]}return{html:e,boundaries:u&&u.length>0?u:void 0,cookies:s,status:a,headers:i}}async function Z(t,n){let e={__filename:t.sourceFile,__dirname:t.sourceFile.replace(/[/\\][^/\\]+$/,""),...n};if(!t.hasServerScripts&&!Wr(t.html))return{html:t.html,context:e};for(let a of t.serverScriptContent)try{await d(a,e,t.sourceFile)}catch(i){if(n.__stx_strict_hydration)throw i;console.warn(`[stx] Server script error in ${t.sourceFile}:`,i)}let r=await I(e,{request:n.request,method:n.method,params:n.params??{},cookies:n.cookies??{}}),o=(a)=>{let i=a.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),c=Ln(e);if(!c)return i;let u=i.indexOf("</head>");return u<0?c+i:i.slice(0,u)+c+i.slice(u)};if(r.redirect)return{html:t.html,context:e,redirect:r.redirect,cookies:r.cookies};if(!Wr(t.html))return{html:o(t.html),context:e,cookies:r.cookies};let s=new Map;for(let[a,i]of Object.entries(t.placeholders))if(i.expression)try{let c=b(i.expression,e);if(i.type==="raw")s.set(a,c!==void 0&&c!==null?String(c):"");else s.set(a,c!==void 0&&c!==null?bt(String(c)):"")}catch(c){if(n.__stx_strict_hydration)throw c;s.set(a,"")}return{html:o(Mi(t.html,s)),context:e,cookies:r.cookies}}
|
|
30
30
|
export{Js,_e,Ys,ne,C,Zs,yr,Sn,ge,Qs,re,ei,ti,ni,br,ri,At};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{y,Oe,I,Jt,i,T}from"./chunk-
|
|
2
|
+
import{y,Oe,I,Jt,i,T}from"./chunk-597rfddk.js";import{zr}from"./chunk-qwgdtrhj.js";import{s,be}from"./chunk-12b8akfg.js";import{a}from"./chunk-tfypkw4y.js";import f from"path";import b from"fs";function de(e){if(!e||typeof e!=="object")return!1;let t=e;return typeof t.message==="string"&&(t.name==="BuildMessage"||t.name==="ResolveMessage"||("position"in t))}function pe(e){if(e&&typeof e==="object"&&Array.isArray(e.errors))return e.errors;return[e]}function z(e,t){let r=[];for(let l of pe(e)){if(de(l)){let u=l.position||void 0;r.push({file:t||u?.file,line:u?.line,column:u?.column,message:l.message??"",lineText:u?.lineText});continue}r.push({file:t,message:l instanceof Error?l.message:String(l)})}return r}function Ie(e,t){return z(e,t).map((r)=>{let l=r.file?`${r.file}${r.line?`:${r.line}${r.column?`:${r.column}`:""}`:""}`:"",u=r.lineText?`
|
|
3
3
|
${r.lineText.trim()}`:"";return l?`${l}: ${r.message}${u}`:`${r.message}${u}`}).join(`
|
|
4
4
|
`)}var me=9;function J(e,t,r){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(f.basename(e))||zr(e,t,r)}var re=1,se=new Map,P=600,fe=100,V=new Map;async function ge(e){let t=V.get(e)??0;if(t>0&&t<fe){V.set(e,t+1);return}V.set(e,1);try{let r=(await b.promises.readdir(e)).filter((p)=>p.endsWith(".js"));if(r.length<=P)return;let u=(await Promise.all(r.map(async(p)=>{try{return{name:p,at:(await b.promises.stat(f.join(e,p))).mtimeMs}}catch{return null}}))).filter((p)=>p!==null);u.sort((p,d)=>d.at-p.at);for(let p of u.slice(P)){let d=p.name.slice(0,-3);await b.promises.rm(f.join(e,`${d}.js`),{force:!0}),await b.promises.rm(f.join(e,`${d}.deps.json`),{force:!0})}F("pruned bundle cache to",P,"entries")}catch{}}function oe(e){return se.get(e)??[]}function G(e,t){if(e)se.set(e,t)}function Aa(e=process.env){return e.STX_DEBUG==="true"||e.STX_DEBUG==="1"}function F(...e){if(Aa())console.log("[stx:bundler]",...e)}var q=[];function _i(e,t,r){q.push({filePath:e||"<inline>",message:t,details:r})}function pt(){return q.slice()}function ft(){q.length=0}var X;function du(e){X=e}function Ri(){if(X)return X;try{let e=T.strict;return typeof e==="object"&&e!==null?e.bundlerFallback??"warn":"warn"}catch{return"warn"}}var ee=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function gt(e){let t=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,r;while((r=t.exec(e))!==null){let u=r[1];if(!ee.some((d)=>d.test(u)))return F("detected user import:",u),!0}let l=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((r=l.exec(e))!==null){let u=r[1];if(/\.css(?:\?.*)?$/.test(u))continue;if(!ee.some((d)=>d.test(u)))return F("detected side-effect import:",u),!0}return!1}var Gt="stx-module:",he=/\.(?:[cm]?[jt]sx?|json)$/i;function Pa(e,t){return f.relative(e,t).split(f.sep).join("/")}function Ia(e,t){if(t.size===0)return e;return e.replace(/^([ \t]*import\s+(?:[^;"']*?\s+from\s+)?)(["'])([^"']+)\2/gm,(r,l,u,p)=>{let d=t.get(p);return d&&!p.startsWith(Gt)?`${l}${u}${d}${u}`:r})}function Da(e,t){let r=0,l=(p)=>{let d=`__stxMod${r++}`,x=JSON.stringify(p);return t.push(`var ${d} = globalThis.__stxModules && globalThis.__stxModules[${x}];`,`if (${d} === undefined) throw new Error("[stx] module " + ${JSON.stringify(x)} + " is not registered on this page (#1957)");`),d},u=(p,d)=>{for(let x of p.split(",")){let v=x.trim();if(!v)continue;let c=v.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!c)continue;let n=c[1].startsWith('"')?JSON.parse(c[1]):c[1],o=c[2]??n;t.push(`var ${o} = ${d}[${JSON.stringify(n)}];`)}};return e=e.replace(/^[ \t]*import\s+([^;"']*?)\s+from\s+["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,d,x)=>{let v=x.slice(Gt.length),c=l(v),n=d.trim(),o=n.match(/^([\w$]+)\s*(?:,\s*|$)/);if(o&&!n.startsWith("{")&&!n.startsWith("*"))t.push(`var ${o[1]} = ${c}.default;`),n=n.slice(o[0].length).trim();let m=n.match(/^\*\s*as\s+([\w$]+)$/);if(m)t.push(`var ${m[1]} = ${c};`);else if(n.startsWith("{"))u(n.replace(/^\{|\}$/g,""),c);return""}),e=e.replace(/^[ \t]*import\s+["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,d)=>(l(d.slice(Gt.length)),"")),e}function te(e){let t=[e,`${e}.ts`,`${e}.tsx`,`${e}.js`,`${e}.mjs`,`${e}.jsx`,f.join(e,"index.ts"),f.join(e,"index.tsx"),f.join(e,"index.js"),f.join(e,"index.mjs")];for(let r of t)try{if(b.existsSync(r)&&b.statSync(r,{throwIfNoEntry:!1})?.isFile())return r}catch{}return}function xe(e,t,r,l,u,p=new Map,d){let x=(c,n,o)=>{if(J(n,e,d))return null;if(!u||c!==r||!he.test(n))return null;try{if(!b.statSync(n,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}l.add(n);let m=`${Gt}${Pa(process.cwd(),n)}`;return p.set(o,m),{path:m,external:!0}},v=(c,n)=>{let o=c===r?t:f.dirname(c),m=f.resolve(o,n);return te(m)??m};return{name:"stx-client-bundle",setup(c){if(c.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(n)=>({path:n.path,external:!0})),c.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(n)=>({path:n.path,external:!0})),c.onResolve({filter:/^\//},(n)=>{let o=te(n.path);if(o){let m=x(n.importer,o,n.path);if(m)return m;if(o!==r)l.add(o);return{path:o}}return{path:n.path,external:!0}}),c.onResolve({filter:/^\.\.?\//},(n)=>{let o=v(n.importer,n.path),m=x(n.importer,o,n.path);if(m)return m;return l.add(o),{path:o}}),c.onResolve({filter:/^[@~]\//},(n)=>{let o=f.resolve(e,n.path.slice(2)),m=[o,`${o}.ts`,`${o}.tsx`,`${o}.js`,`${o}.mjs`,`${o}.jsx`,f.join(o,"index.ts"),f.join(o,"index.tsx"),f.join(o,"index.js"),f.join(o,"index.mjs")];for(let w of m)if(b.existsSync(w)&&b.statSync(w,{throwIfNoEntry:!1})?.isFile()){let N=x(n.importer,w,n.path);if(N)return N;return F(`resolved ${n.path[0]}/ import:`,n.path,"\u2192",w),l.add(w),{path:w}}return console.warn(`[stx:bundler] could not resolve ${n.path[0]}/ import:`,n.path),{path:o}}),u)c.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(n)=>{if(n.importer!==r)return;let o=`${Gt}npm:${n.path}`;return p.set(n.path,o),{path:o,external:!0}});c.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(n)=>{if(J(n.path,e,d))throw Error(`Server-only API source cannot be imported by a client script: ${n.path}`);let o=f.extname(n.path).toLowerCase(),m=o===".json"?"json":o===".tsx"?"tsx":o===".jsx"?"jsx":o===".ts"||o===".mts"||o===".cts"?"ts":"js";if(n.path!==r)l.add(n.path);return{contents:b.readFileSync(n.path,"utf8"),loader:m}})}}}var W=new Map,O=I(64),ne=Symbol.for("stx.client-bundle-build-queue");function Oa(e){let t=globalThis,l=(t[ne]??Promise.resolve()).then(e,e);return t[ne]=l.then(()=>{return},()=>{return}),l}async function mt(e,t,r={}){let l=r.projectRoot||process.cwd(),u=(await i(l)).serverApi,p=r.minify??!1,d=r.externalizeUserModules??!0,x=r.cacheDir||a(l,"bundle-cache"),v=new Bun.CryptoHasher("md5");v.update(`${me}\x00${Oe()}\x00${JSON.stringify(u??!1)}\x00${d?"registry":"inline"}\x00${e}\x00${t}`);let c=v.digest("hex").slice(0,12),n=f.join(x,`${c}.js`),o=O.get(n);if(o){if(Jt(o.files)&&o.files.every((E)=>!J(E.path,l,u))){F("memo hit:",c);let E=o.files.map((S)=>S.path);return G(t,E),r.collectInputs?.push(...E),o.code}O.delete(n),F("memo invalidated by dep change:",c)}let m=f.join(x,`${c}.deps.json`),w=Bun.file(n);if(await w.exists()){let E=Bun.file(m),S=!1,B=null;if(await E.exists())try{let D=JSON.parse(await E.text());if(D.metadataVersion!==re||!Array.isArray(D.files))S=!1;else B=D.files,S=!0;if(B&&(!Jt(B)||B.some((k)=>J(k.path,l,u))))S=!1}catch{S=!1}if(S){if(F("cache hit:",c),B)G(t,B.map((k)=>k.path)),r.collectInputs?.push(...B.map((k)=>k.path));let D=await w.text();if(B)O.set(n,{code:D,files:B});return D}F("cache invalidated by dep change:",c)}let N=W.get(c);if(N){let E=await N;if(r.collectInputs)r.collectInputs.push(...(O.get(n)?.files??[]).map((S)=>S.path));return E}let _=Oa(()=>ye(e,t,{projectRoot:l,minify:p,cacheDir:x,hash:c,cachePath:n,depsPath:m,collectInputs:r.collectInputs,externalizeUserModules:d,serverApi:u}));W.set(c,_);try{return await _}finally{W.delete(c)}}var $e=0;function Ma(e){return`${e}-${process.pid}-${++$e}`}async function ye(e,t,r){let{projectRoot:l,minify:u,cacheDir:p,hash:d,cachePath:x,depsPath:v,externalizeUserModules:c}=r,n=a(l,"bundle-tmp"),o=Ma(d),m=f.join(n,`${o}.ts`),w=f.join(n,"out",o);b.mkdirSync(n,{recursive:!0}),b.mkdirSync(w,{recursive:!0});let N=f.dirname(t),_=new Set,E=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,S=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,B=s(e),{depths:D,balanced:k}=be(B),H=(j)=>!k||D[j]===0,M;while((M=E.exec(B))!==null){if(M[1])continue;if(!H(M.index))continue;if(M[2])M[2].split(",").forEach((j)=>{let h=we(j);if(h)_.add(h)});else if(M[3])_.add(M[3])}while((M=S.exec(B))!==null){if(M[1])continue;if(!H(M.index))continue;_.add(M[2])}let ie=_.size>0?`
|
|
5
5
|
export { ${[..._].join(", ")} }`:"";await Bun.write(m,e+ie),F("bundling:",d,"from:",f.basename(t));let Z=new Set,Y=new Map;try{let j=await Bun.build({entrypoints:[m],outdir:w,target:"browser",format:"esm",minify:u,plugins:[xe(l,N,m,Z,c,Y,r.serverApi)],define:{"process.env.NODE_ENV":u?'"production"':'"development"',...y()},root:l});if(!j.success){let R=j.logs.filter((C)=>C.level==="error").map((C)=>C.message).join(", ")||`Unable to bundle ${f.basename(t)}`,L=z(j.logs,t||void 0);if(console.warn("[stx:bundler] build failed:",R),_i(t||"",R,L),Ri()==="error")throw Error(R);return e}let h="";for(let g of j.outputs){h=await g.text();break}let A=[];for(let g of h.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let R of g[1].split(",")){let L=R.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(L){A.push([L[2],L[1]]);continue}let C=R.trim();if(/^[A-Za-z_$][\w$]*$/.test(C))A.push([C,C])}let Q=[];h=Da(Ia(h,Y),Q);let ae=h.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];h=h.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let K=`__stxBundle_${d}`,le=A.map(([g,R])=>`${JSON.stringify(g)}: ${R}`).join(", "),ce=A.map(([g])=>`var ${g} = undefined;`).join(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{xo,So,ko}from"./chunk-757ec865.js";import{z,En,
|
|
2
|
+
import{xo,So,ko}from"./chunk-757ec865.js";import{z,En,Ut,Pr,Ir,Tn,Wt,qt,Dr,_n}from"./chunk-nqr77pxk.js";function W(r,d,u,o,i){let y=!0,f=new Set,h=(a)=>o.get?o.get(a):a,l=()=>h(r());return Object.defineProperty(l,"_isSignal",{value:!0}),Object.defineProperty(l,"modifiers",{get:d}),l.set=(a)=>{if(!y)return;let v=d(),g=o.set?o.set(a,v):a;if(v.trim&&typeof g==="string")g=g.trim();if(v.number&&typeof g==="string"&&g!==""){let t=Number(g);if(!Number.isNaN(t))g=t}if(Object.is(r(),g))return;r.set(g),u(g)},l.update=(a)=>l.set(a(l())),l.input=(a)=>{if(!d().lazy)l.set(a)},l.change=(a)=>{if(d().lazy)l.set(a)},l.subscribe=(a)=>{if(!y)return()=>{};let v=r.subscribe((g,t)=>a(h(g),h(t)));return f.add(v),()=>{v(),f.delete(v)}},Object.defineProperty(l,"value",{get:l,set:l.set}),i(()=>{y=!1,f.forEach((a)=>a()),f.clear()}),l}function X(r,d=!0,u){if(!d||!r||typeof window>"u")return;let o=window;if(!o.__STX_DATA__){let y=document.querySelector("script[data-stx-server-data]");try{let f=JSON.parse(y?.textContent||"{}");o.__STX_DATA__=f&&typeof f==="object"&&!Array.isArray(f)?f:{}}catch{o.__STX_DATA__={}}}let i=o.__STX_DATA__;if(i&&Object.prototype.hasOwnProperty.call(i,r))try{return{data:u?u(i[r]):i[r]}}catch(y){return{data:null,error:y instanceof Error?y:Error(String(y))}}return}function Q(r){if(typeof window>"u")return;let d=window;if(r===void 0)d.__STX_DATA__={};else{if(!d.__STX_DATA__)try{let u=JSON.parse(document.querySelector("script[data-stx-server-data]")?.textContent||"{}");d.__STX_DATA__=u&&typeof u==="object"&&!Array.isArray(u)?u:{}}catch{d.__STX_DATA__={}}if(d.__STX_DATA__)delete d.__STX_DATA__[r]}}function G(r){let d=null;try{d=typeof indexedDB<"u"?indexedDB:null}catch{d=null}if(!d)return null;let u=d,o=r||"stx-kept",i=null,y=()=>{if(!i)i=new Promise((h,l)=>{let a=u.open(o,1);a.onupgradeneeded=()=>{a.result.createObjectStore("kv")},a.onsuccess=()=>h(a.result),a.onerror=()=>l(a.error),a.onblocked=()=>l(Error("blocked"))}),i.catch(()=>{i=null});return i},f=(h,l)=>y().then((a)=>new Promise((v,g)=>{let t=a.transaction("kv",h),s=l(t.objectStore("kv"));t.oncomplete=()=>v(s?s.result:void 0),t.onerror=()=>g(t.error),t.onabort=()=>g(t.error)}));return{get:(h)=>f("readonly",(l)=>l.get(h)),set:(h,l)=>f("readwrite",(a)=>{a.put(l,h)}),remove:(h)=>f("readwrite",(l)=>{l.delete(h)}),removePrefix:(h)=>f("readwrite",(l)=>{l.delete(IDBKeyRange.bound(h,`${h}\uFFFF`))})}}function J(r,d){let u=r||{},o=null;if(u.storage!==void 0)o=u.storage;else try{o=typeof localStorage<"u"?localStorage:null}catch{o=null}let i=null,y=u.backend!==void 0;if(y)i=u.backend||null;let f=()=>{if(y)return i;y=!0;try{i=d?d():null}catch{i=null}if(i){let e=i;e.get("__stx_probe__").catch(()=>{if(i===e)i=null})}return i},h=u.limit||32768,l=u.defer||((e)=>{let n=typeof requestIdleCallback==="function"?requestIdleCallback:null;if(n)n(e,{timeout:200});else setTimeout(e,16)}),a=new Map,v=new Set,g=new Map,t=!1,s=Promise.resolve(),m=(e)=>{try{return JSON.parse(e)}catch{return e}},p=(e,n)=>{if(!o)return!1;try{return o.setItem(e,n),!0}catch{return!1}},T=(e)=>{try{if(o)o.removeItem(e)}catch{}},S=()=>{if(t=!1,!g.size)return s;let e=Array.from(g.entries());return g.clear(),s=s.then(()=>Promise.all(e.map(([n,c])=>{if(!i){v.delete(n);try{p(n,JSON.stringify(c===void 0?null:c))}catch{}return}let _;try{return _={v:c},i.set(n,_).catch(()=>{let w;try{w=JSON.stringify(c)}catch{return}return i?i.set(n,{j:w}).catch(()=>{p(n,w)}):void 0})}catch{return}}))).then(()=>{}),s},R=(e,n)=>{if(g.set(e,n),v.add(e),t)return;t=!0,l(()=>{S()})},I=(e)=>{if(!e||typeof e!=="object")return;let n=e;if("v"in n)return{value:n.v};if(typeof n.j==="string")return{value:m(n.j)};return},E={peek(e){if(a.has(e))return{value:a.get(e)};let n=null;try{n=o?o.getItem(e):null}catch{n=null}if(n===null||n===void 0)return;let c=m(n);return a.set(e,c),{value:c}},load(e){let n=E.peek(e),c=n?null:f();if(n||!c)return Promise.resolve(n);return c.get(e).then((_)=>{if(a.has(e))return{value:a.get(e)};let w=I(_);if(w)a.set(e,w.value),v.add(e);return w},()=>{return})},set(e,n){if(a.set(e,n),i&&v.has(e)){R(e,n);return}let c;try{c=JSON.stringify(n===void 0?null:n)}catch{return}if(c.length<=h&&p(e,c))return;if(!f()){if(c.length>h)p(e,c);return}T(e),R(e,n)},forget(e){for(let c of Array.from(a.keys()))if(c.indexOf(e)===0)a.delete(c);for(let c of Array.from(g.keys()))if(c.indexOf(e)===0)g.delete(c);for(let c of Array.from(v))if(c.indexOf(e)===0)v.delete(c);try{if(o)for(let c=o.length-1;c>=0;c--){let _=o.key(c);if(_&&_.indexOf(e)===0)o.removeItem(_)}}catch{}let n=f();if(!n)return s;return s=s.then(()=>n.removePrefix(e)).catch(()=>{}),s},flush(){return S()}};try{if(typeof document<"u"&&document.addEventListener)document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden")S()});if(typeof addEventListener==="function")addEventListener("pagehide",()=>{S()})}catch{}return E}function Y(r,d){if(!r)return!1;if(r===d.key)return!0;if(!d.url)return!1;if(r===d.url)return!0;try{let u=typeof location<"u"&&location.origin&&location.origin!=="null"?location.origin:"http://localhost",o=new URL(r,u),i=new URL(d.url,u);if(o.origin!==i.origin||o.pathname!==i.pathname)return!1;return!o.search||o.search===i.search}catch{return!1}}function Z(r){let d=r.prefix||"stx:kept:",u=r.matches||((t,s)=>t===s.key||t===s.url),o=new Set,i=new Map,y,f=(t)=>t===void 0?y:t,h=(t,s)=>{let m=f(s);if(m===!1||m===null||m==="")return null;return`${d}${m===void 0?"":`${m}:`}query:${t}`},l=(t)=>{let s=t&&t.value;if(!s||typeof s!=="object"||!("d"in s))return;return{data:s.d,at:Number(s.at)||0}},a=()=>{let t=globalThis;return t.__stx_outboxes instanceof Map?t.__stx_outboxes:null},v={setScope(t){y=t},scope:()=>y,keyFor:h,seed(t,s){let m=h(t,s);return m?l(r.kept.peek(m)):void 0},restore(t,s){let m=h(t,s);return m?r.kept.load(m).then(l):Promise.resolve(void 0)},persist(t,s,m){let p=h(t,m);if(p)r.kept.set(p,{d:s,at:Date.now()})},overlay(t,s,m){let p=a();if(!p||!p.size)return s;let T=s;return p.forEach((S)=>{try{T=S.overlay(t,T,m)}catch{}}),T},watch(t){return o.add(t),()=>{o.delete(t)}},cachedQuery(t,s){let m=i.get(t);if(m){if(s&&m.__options)m.__options(s);return m}let p=s||{},T=p.initial===void 0?null:p.initial,S=()=>typeof p.scope==="function"?p.scope():p.scope,R=()=>(typeof p.url==="function"?p.url():p.url)||null,I=()=>({key:t,url:R()}),E=S(),e=T,n=0,c=null,_=v.seed(t,E);if(_)e=_.data;let w=r.state(v.overlay(I(),e)),H=r.state(!1),V=r.state(!1),q=r.state(null),O=r.state(_?_.at:0),N=0,M=()=>{w.set(v.overlay(I(),e))},K=(b)=>{let x=N;v.restore(t,b).then((C)=>{if(!C||x!==N||n)return;e=C.data,O.set(C.at),M()})};if(!_)K(E);let ee=()=>{let b=S();if(b===E)return;E=b,N++,c=null,n=0;let x=v.seed(t,E);if(e=x?x.data:T,O.set(x?x.at:0),M(),!x)K(E)},te=(b)=>{let x=R(),C=p.timeoutMs||15000,A=typeof AbortController<"u"?new AbortController:null,k=null,ne=new Promise((D,L)=>{k=setTimeout(()=>{if(A)A.abort();L(Error("The request took too long."))},C)}),U;if(p.load)U=p.load({force:b,url:x,signal:A?A.signal:void 0});else if(x){let D=p.fetch||((P,F)=>fetch(P,F)),L={method:"GET",headers:{Accept:"application/json"}};if(b)L.cache="no-cache";if(A)L.signal=A.signal;U=D(x,L).then((P)=>{if(!P.ok)return P.json().catch(()=>null).then((F)=>{throw Error(F&&(F.error||F.message)||`Request failed (${P.status})`)});return P.json()})}else return Promise.resolve(w());return Promise.race([U,ne]).then((D)=>{if(k)clearTimeout(k);return p.transform?p.transform(D):D},(D)=>{if(k)clearTimeout(k);throw D})},B=(b)=>{if(c)return c;let x=N;if(V.set(!0),n===0&&!O())H.set(!0);let C=()=>{if(x!==N)return;c=null,V.set(!1),H.set(!1)},A=te(b).then((k)=>{if(x!==N)return w();return e=k,n=Date.now(),O.set(n),q.set(null),v.persist(t,k,E),M(),C(),w()},(k)=>{if(x===N)q.set(k&&k.message?k.message:"Could not load.");return C(),w()});return c=A,A},j={data:w,loading:H,isFetching:V,error:q,updatedAt:O,get key(){return t},load(b){if(ee(),!b&&n&&Date.now()-n<(p.staleTime||0))return Promise.resolve(w());return B(!!b)},refresh(){return j.load(!0)},set(b){e=typeof b==="function"?b(e):b,v.persist(t,e,E),M()},invalidate(){n=0},__options(b){p={...p,...b}}};if(o.add({target:I,updated:()=>{if(n||O())B(!1)},outbox:(b)=>{if(b)e=v.overlay(I(),e,b.id),n=0,B(!0);M()}}),i.set(t,j),p.immediate)j.load();return j}},g=typeof window<"u"?window:typeof addEventListener==="function"?globalThis:null;if(r.listen!==!1&&g&&typeof g.addEventListener==="function")g.addEventListener("stx:updated",(t)=>{let s=t.detail||{};if(s.kind!=="api"||typeof s.url!=="string")return;o.forEach((m)=>{if(u(s.url,m.target()))m.updated()})}),g.addEventListener("stx:outbox",(t)=>{let s=t.detail||{},m=s.sent&&typeof s.sent.id==="string"?s.sent:null;o.forEach((p)=>{if(m){let T=Array.isArray(m.affects)?m.affects:[],S=p.target();if(!T.some((R)=>u(R,S)))return}p.outbox(m)})});return v}function $n(){let r=re(Vt());try{let u=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(r);return u=u.replace(/\}(var |let |const |function )/g,"};$1"),u}catch{return r}}function re(r){let d=[],u=0,o="console.log(";while(u<r.length){let i=r.indexOf(o,u);if(i===-1){d.push(r.slice(u));break}d.push(r.slice(u,i));let y=1,f=i+o.length;while(f<r.length&&y>0){let h=r[f];if(h==='"'||h==="'"||h==="`"){let l=h;f++;while(f<r.length&&r[f]!==l){if(r[f]==="\\")f++;f++}f++;continue}if(h==="(")y++;else if(h===")")y--;f++}d.push("0"),u=f}return d.join("")}function Vt(){return`
|
|
3
3
|
// STX Signals Runtime (Development Build)
|
|
4
4
|
console.log('[stx] signals runtime loading');
|
|
5
5
|
// Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
|
|
@@ -2993,6 +2993,19 @@ else if (part) {
|
|
|
2993
2993
|
// Use the passed scope parameter to preserve context through nested processing
|
|
2994
2994
|
const attrCapturedScope = { ...globalHelpers, ...scope, ...(findElementScope(el) || {}) };
|
|
2995
2995
|
|
|
2996
|
+
// Keep the conditional owners captured while the element is in the tree.
|
|
2997
|
+
// Walking parents on each update loses an outer owner when an inner :if
|
|
2998
|
+
// detaches its own root. These signals suspend writes while either owner
|
|
2999
|
+
// is hidden and refresh the latest value AFTER reinsertion, even when the
|
|
3000
|
+
// attribute's source did not change on that show.
|
|
3001
|
+
const attrVisibility = [];
|
|
3002
|
+
for (var attrAncestor = el; attrAncestor; attrAncestor = attrAncestor.parentNode) {
|
|
3003
|
+
if (attrAncestor.__stx_if_visible) attrVisibility.push(attrAncestor.__stx_if_visible);
|
|
3004
|
+
}
|
|
3005
|
+
function attributesVisible() {
|
|
3006
|
+
return attrVisibility.every(function(visible) { return visible(); });
|
|
3007
|
+
}
|
|
3008
|
+
|
|
2996
3009
|
// Post-eval unwrap: if the expression result is a signal function (e.g.
|
|
2997
3010
|
// step was resolved via identifier lookup, not via the auto-unwrap
|
|
2998
3011
|
// proxy \u2014 happens when a client script declares const step = state(...)
|
|
@@ -3134,6 +3147,7 @@ catch (e2) {
|
|
|
3134
3147
|
? el.__stx_parent_scope
|
|
3135
3148
|
: attrCapturedScope;
|
|
3136
3149
|
effect(() => {
|
|
3150
|
+
if (!attributesVisible()) return;
|
|
3137
3151
|
const v = evalAttrExpr(value, bindingScope);
|
|
3138
3152
|
// Form control values are live DOM properties. Setting only the HTML
|
|
3139
3153
|
// attribute does not update a <select>'s chosen option and can leave
|
|
@@ -3147,6 +3161,7 @@ catch (e2) {
|
|
|
3147
3161
|
controlValue = v === false || v === null || v === undefined ? '' : String(controlValue);
|
|
3148
3162
|
el.__stx_bound_value = controlValue;
|
|
3149
3163
|
var applyControlValue = function() {
|
|
3164
|
+
if (!attributesVisible()) return;
|
|
3150
3165
|
var desiredValue = el.__stx_bound_value == null ? '' : String(el.__stx_bound_value);
|
|
3151
3166
|
el.value = desiredValue;
|
|
3152
3167
|
if (desiredValue === '' && el.tagName !== 'OPTION') el.removeAttribute(attrName);
|
|
@@ -3237,11 +3252,11 @@ else {
|
|
|
3237
3252
|
el.removeAttribute(name);
|
|
3238
3253
|
}
|
|
3239
3254
|
else if (name === '@class' || name === ':class' || name === 'x-class') {
|
|
3240
|
-
bindClass(el, value, scope);
|
|
3255
|
+
bindClass(el, value, scope, attributesVisible);
|
|
3241
3256
|
el.removeAttribute(name);
|
|
3242
3257
|
}
|
|
3243
3258
|
else if (name === '@style' || name === ':style' || name === 'x-style') {
|
|
3244
|
-
bindStyle(el, value, scope);
|
|
3259
|
+
bindStyle(el, value, scope, attributesVisible);
|
|
3245
3260
|
el.removeAttribute(name);
|
|
3246
3261
|
}
|
|
3247
3262
|
else if (name === '@text' || name === ':text' || name === 'x-text') {
|
|
@@ -3727,7 +3742,7 @@ else {
|
|
|
3727
3742
|
el.removeAttribute(attrName);
|
|
3728
3743
|
}
|
|
3729
3744
|
|
|
3730
|
-
function bindClass(el, expr, passedScope = componentScope) {
|
|
3745
|
+
function bindClass(el, expr, passedScope = componentScope, isVisible) {
|
|
3731
3746
|
const originalClasses = el.className;
|
|
3732
3747
|
const capturedScope = { ...globalHelpers, ...passedScope, ...(findElementScope(el) || {}) };
|
|
3733
3748
|
const keys = Object.keys(capturedScope);
|
|
@@ -3746,6 +3761,7 @@ else {
|
|
|
3746
3761
|
}
|
|
3747
3762
|
|
|
3748
3763
|
effect(() => {
|
|
3764
|
+
if (isVisible && !isVisible()) return;
|
|
3749
3765
|
// Subscribe to signals by reading them, establishing reactive deps.
|
|
3750
3766
|
// But pass RAW scope values to the fn so call-expressions like
|
|
3751
3767
|
// activeTab() === 'overview' work \u2014 if we passed unwrapped values,
|
|
@@ -3795,7 +3811,7 @@ else {
|
|
|
3795
3811
|
});
|
|
3796
3812
|
}
|
|
3797
3813
|
|
|
3798
|
-
function bindStyle(el, expr, passedScope = componentScope) {
|
|
3814
|
+
function bindStyle(el, expr, passedScope = componentScope, isVisible) {
|
|
3799
3815
|
// Capture scope at setup time - use passed scope to preserve context
|
|
3800
3816
|
const capturedScope = { ...globalHelpers, ...passedScope, ...(findElementScope(el) || {}) };
|
|
3801
3817
|
|
|
@@ -3824,6 +3840,7 @@ catch (e2) {
|
|
|
3824
3840
|
};
|
|
3825
3841
|
|
|
3826
3842
|
effect(() => {
|
|
3843
|
+
if (isVisible && !isVisible()) return;
|
|
3827
3844
|
const value = evalExpr();
|
|
3828
3845
|
if (typeof value === 'object' && value !== null) {
|
|
3829
3846
|
Object.assign(el.style, value);
|
|
@@ -4864,6 +4881,7 @@ catch (e) {
|
|
|
4864
4881
|
b.el.__stx_if_bound = true;
|
|
4865
4882
|
b.el.__stx_chain_member = true;
|
|
4866
4883
|
b.el.__stx_chain_active = false;
|
|
4884
|
+
b.el.__stx_if_visible = state(false);
|
|
4867
4885
|
b.capturedElementScope = findElementScope(b.el);
|
|
4868
4886
|
b.placeholder = stxHost.anchor('stx-if-chain');
|
|
4869
4887
|
stxHost.insert(parent, b.placeholder, b.el);
|
|
@@ -4983,6 +5001,7 @@ catch (e2) {
|
|
|
4983
5001
|
if (currentIdx !== -1) {
|
|
4984
5002
|
var gone = chain[currentIdx];
|
|
4985
5003
|
gone.el.__stx_chain_active = false;
|
|
5004
|
+
gone.el.__stx_if_visible.set(false);
|
|
4986
5005
|
|
|
4987
5006
|
if (gone.isTemplate) {
|
|
4988
5007
|
// Everything this branch rendered goes, not just the clones it owns:
|
|
@@ -5043,6 +5062,7 @@ catch (e) { /* a disposer of its own is not this branch's problem */ }
|
|
|
5043
5062
|
if (pickHost.__stx_detached_if) pickHost.__stx_detached_if.delete(n);
|
|
5044
5063
|
stxHost.insert(pickHost, n, anchor);
|
|
5045
5064
|
});
|
|
5065
|
+
pick.el.__stx_if_visible.set(true);
|
|
5046
5066
|
// Bound AFTER the clones, so hiding can remove whatever a structural
|
|
5047
5067
|
// directive inside the branch renders as their sibling.
|
|
5048
5068
|
if (pick.isTemplate) {
|
|
@@ -5138,6 +5158,7 @@ catch (e) { /* a disposer of its own is not this branch's problem */ }
|
|
|
5138
5158
|
|
|
5139
5159
|
// Handle <template> elements specially - clone their content
|
|
5140
5160
|
const isTemplate = el.tagName === 'TEMPLATE';
|
|
5161
|
+
if (!isTemplate) el.__stx_if_visible = state(true);
|
|
5141
5162
|
const componentSetupSiblings = isTemplate ? [] : findConditionalComponentSetupSiblings(el);
|
|
5142
5163
|
let currentNodes = isTemplate ? [] : [el, ...componentSetupSiblings];
|
|
5143
5164
|
|
|
@@ -5308,11 +5329,13 @@ else {
|
|
|
5308
5329
|
const insertionAnchor = placeholder.nextSibling;
|
|
5309
5330
|
currentNodes.forEach(node => stxHost.insert(parent, node, insertionAnchor));
|
|
5310
5331
|
if (parent && parent.__stx_detached_if) currentNodes.forEach(node => parent.__stx_detached_if.delete(node));
|
|
5332
|
+
el.__stx_if_visible.set(true);
|
|
5311
5333
|
el.__stx_shown_at = performance.now();
|
|
5312
5334
|
isInserted = true;
|
|
5313
5335
|
}
|
|
5314
5336
|
else if (!value && isInserted) {
|
|
5315
5337
|
console.log('[stx] bindIf REMOVING element for :if=' + expr, 'el.isConnected:', el.isConnected, 'parent:', parent.tagName);
|
|
5338
|
+
el.__stx_if_visible.set(false);
|
|
5316
5339
|
// Do NOT disposeSubtreeScopes here. :if is a TOGGLE \u2014 the element is
|
|
5317
5340
|
// re-shown when the condition flips back \u2014 not a permanent unmount.
|
|
5318
5341
|
// A nested data-stx-scope inside this subtree is created once by its
|
|
@@ -9242,5 +9265,5 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
|
|
|
9242
9265
|
}
|
|
9243
9266
|
}
|
|
9244
9267
|
})();
|
|
9245
|
-
`}var Hl={state:z,derived:En,effect:
|
|
9246
|
-
export{$n,
|
|
9268
|
+
`}var Hl={state:z,derived:En,effect:Ut,batch:Pr,onMount:Ir,onDestroy:Tn,isSignal:Wt,isDerived:qt,untrack:Dr,peek:_n,generateSignalsRuntime:$n,generateSignalsRuntimeDev:Vt};
|
|
9269
|
+
export{$n,Vt,Hl};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Oe,Va,wu,vu,xu,Su,Ua,Wa,ku,Cu,Ni,$u,Yt,Zt,On}from"./chunk-597rfddk.js";import"./chunk-11ra3sbc.js";import"./chunk-x5ks23vx.js";import"./chunk-g1fxmp9z.js";import"./chunk-5e9zkd65.js";import"./chunk-62r4fa4q.js";import"./chunk-788g87ft.js";import"./chunk-w72p2ak0.js";import"./chunk-09hhrjk9.js";import"./chunk-tafebmtg.js";import"./chunk-757ec865.js";import"./chunk-66k7yxnr.js";import"./chunk-4n6c5rp5.js";export{Su as __setSignalsGeneratorsForTest,Oe as cacheEngineFingerprint,Zt as cacheTemplate,Yt as checkCache,$u as clearDevCaches,Wa as getCachedRouterScript,Ua as getCachedSignalsRuntime,ku as getServeClientAsset,Ni as getServeModuleBundle,On as hashFilePath,vu as invalidateFileCache,xu as invalidateFileCacheByDir,wu as readFileCached,Cu as registerServeModuleBundle,Va as templateCache};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{oe,Aa,_i,pt,ft,du,Ri,gt,Gt,Pa,Ia,Da,Oa,mt,Ma}from"./chunk-
|
|
2
|
+
import{oe,Aa,_i,pt,ft,du,Ri,gt,Gt,Pa,Ia,Da,Oa,mt,Ma}from"./chunk-2cn8krpp.js";import"./chunk-qwgdtrhj.js";import"./chunk-597rfddk.js";import"./chunk-11ra3sbc.js";import"./chunk-x5ks23vx.js";import"./chunk-g1fxmp9z.js";import"./chunk-5e9zkd65.js";import"./chunk-62r4fa4q.js";import"./chunk-788g87ft.js";import"./chunk-w72p2ak0.js";import"./chunk-09hhrjk9.js";import"./chunk-tafebmtg.js";import"./chunk-757ec865.js";import"./chunk-66k7yxnr.js";import"./chunk-4n6c5rp5.js";export{Gt as MODULE_SPECIFIER_PREFIX,mt as bundleClientScript,ft as clearBundleFailures,oe as clientBundleDependencies,pt as getBundleFailures,gt as hasUserImports,Ia as normalizeRegistrySpecifiers,Oa as queueClientBundleBuild,_i as recordBundleFailure,Pa as registryIdForPath,Ri as resolveBundlerFallback,Da as rewriteRegistryImports,du as setBundlerFallbackMode,Aa as shouldLogBundlerDiagnostics,Ma as tempBuildName};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{jo,Xs,Bc,Bo,Fo,Fc,zc}from"./chunk-
|
|
2
|
+
import{jo,Xs,Bc,Bo,Fo,Fc,zc}from"./chunk-ebkpdc45.js";import"./chunk-q0cehgy2.js";import"./chunk-2cn8krpp.js";import"./chunk-qwgdtrhj.js";import{ze,uc}from"./chunk-597rfddk.js";import"./chunk-11ra3sbc.js";import"./chunk-x5ks23vx.js";import"./chunk-g1fxmp9z.js";import"./chunk-5e9zkd65.js";import"./chunk-62r4fa4q.js";import"./chunk-788g87ft.js";import"./chunk-w72p2ak0.js";import"./chunk-09hhrjk9.js";import"./chunk-tafebmtg.js";import"./chunk-757ec865.js";import"./chunk-66k7yxnr.js";import"./chunk-4n6c5rp5.js";export{jo as buildVirtualSource,ze as extractScriptBlocks,uc as extractTemplateExpressions,Bo as findRuntimeTypeDeclarations,Fo as findStxModuleDeclarations,zc as formatTypecheckDiagnostics,Bc as sourcePathFor,Fc as typecheckStxFiles,Xs as virtualPathFor};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Wo,il,qo,Ko,ol,al}from"./chunk-w83djypm.js";import"./chunk-597rfddk.js";import"./chunk-11ra3sbc.js";import"./chunk-x5ks23vx.js";import"./chunk-g1fxmp9z.js";import"./chunk-5e9zkd65.js";import"./chunk-62r4fa4q.js";import"./chunk-788g87ft.js";import"./chunk-w72p2ak0.js";import"./chunk-09hhrjk9.js";import"./chunk-tafebmtg.js";import"./chunk-757ec865.js";import"./chunk-66k7yxnr.js";import"./chunk-4n6c5rp5.js";export{al as applySlots,ol as extractSlotContent,il as parseSlotElement,Wo as parseSlots,Ko as processSlots,qo as renderSlot};
|