@stacksjs/stx 0.2.461 → 0.2.462
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-03ek5ag5.js +2 -0
- package/dist/chunk-0a2w25j8.js +2 -0
- package/dist/chunk-0e1rga0j.js +2 -0
- package/dist/chunk-0f1f6y2w.js +2 -0
- package/dist/chunk-14p5jgqp.js +2 -0
- package/dist/{chunk-26gxw0e2.js → chunk-18pagcsc.js} +5 -5
- package/dist/chunk-1fccwkkq.js +2 -0
- package/dist/{chunk-ab56jdah.js → chunk-1k01h1zb.js} +1 -1
- package/dist/chunk-22972c8b.js +2 -0
- package/dist/{chunk-w1zvh5y7.js → chunk-2jbyks2t.js} +2 -2
- package/dist/{chunk-2cy956js.js → chunk-3rpbzfw5.js} +2 -2
- package/dist/{chunk-s25yesdx.js → chunk-3rrzxapr.js} +1 -1
- package/dist/{chunk-kp54j5hy.js → chunk-4mcmbvxb.js} +1 -1
- package/dist/{chunk-vqdv6ay9.js → chunk-501kq69r.js} +1 -1
- package/dist/{chunk-bq2e9qf6.js → chunk-5bqs0ve6.js} +1 -1
- package/dist/chunk-5ex4hjt3.js +2 -0
- package/dist/{chunk-dxxs52yw.js → chunk-5j5msbks.js} +2 -2
- package/dist/{chunk-jfps4n28.js → chunk-5pgvfxtx.js} +2 -2
- package/dist/{chunk-w6zz18jt.js → chunk-5w87wmc4.js} +2 -2
- package/dist/{chunk-18fa768q.js → chunk-6ths0ktv.js} +1 -1
- package/dist/{chunk-fm7crc6s.js → chunk-6wqvgy6x.js} +1 -1
- package/dist/{chunk-zchtjtq9.js → chunk-6yt2dpsb.js} +1 -1
- package/dist/{chunk-n1dyjhte.js → chunk-7h57dt0z.js} +3 -3
- package/dist/chunk-8xkr55v2.js +2 -0
- package/dist/{chunk-exgyf65a.js → chunk-8yrk8ybh.js} +3 -3
- package/dist/chunk-995ytskb.js +2 -0
- package/dist/chunk-9mmsb0zb.js +2 -0
- package/dist/{chunk-kppgyqwb.js → chunk-9n10mh5q.js} +1 -1
- package/dist/{chunk-ks35e0ze.js → chunk-9y6bn8hk.js} +1 -1
- package/dist/{chunk-mhpsz5m0.js → chunk-9yywhkc7.js} +8 -8
- package/dist/{chunk-6pyydsn1.js → chunk-a51ftv2n.js} +137 -7
- package/dist/{chunk-jkyb1f9r.js → chunk-a6pjaw6w.js} +1 -1
- package/dist/chunk-amvnckr7.js +2 -0
- package/dist/{chunk-zskhxkbk.js → chunk-b6e36vr2.js} +127 -112
- package/dist/{chunk-6cp3afft.js → chunk-b8p9y1kv.js} +2 -2
- package/dist/{chunk-12w518qc.js → chunk-bagh6sc1.js} +4 -4
- package/dist/chunk-c0wcvbhr.js +2 -0
- package/dist/chunk-darbqs38.js +2 -0
- package/dist/{chunk-1wtm4ayp.js → chunk-e02b66yn.js} +1 -1
- package/dist/chunk-e38fyh0y.js +2 -0
- package/dist/chunk-gcz1wex2.js +2 -0
- package/dist/{chunk-qxcw9k0z.js → chunk-gn32cr6z.js} +1 -1
- package/dist/{chunk-n866vbgj.js → chunk-gxhwg1f4.js} +2 -2
- package/dist/{chunk-5erw0wsr.js → chunk-hp901qmd.js} +1 -1
- package/dist/chunk-jbdvkj3q.js +2 -0
- package/dist/{chunk-9r6nd1nf.js → chunk-jnn745tt.js} +1 -1
- package/dist/chunk-jy58t59b.js +2 -0
- package/dist/{chunk-xz6dfe70.js → chunk-kggx9jc1.js} +1 -1
- package/dist/chunk-khx54f41.js +2 -0
- package/dist/{chunk-y15ybsg3.js → chunk-m2yy86d8.js} +4 -4
- package/dist/{chunk-5p56w2ke.js → chunk-n1mspzv7.js} +1 -1
- package/dist/{chunk-y1hx8re2.js → chunk-n3r5m938.js} +1 -1
- package/dist/chunk-n76phhd2.js +2 -0
- package/dist/{chunk-9z22zs86.js → chunk-neq30d52.js} +1 -1
- package/dist/{chunk-h9e032kq.js → chunk-pf0d8y9n.js} +2 -2
- package/dist/{chunk-fyh1w7j0.js → chunk-pq84ycrv.js} +1 -1
- package/dist/{chunk-fzs6v9x5.js → chunk-ptxvex42.js} +45 -45
- package/dist/{chunk-aeb8621d.js → chunk-q0d0q8r8.js} +2 -2
- package/dist/{chunk-ps54xqba.js → chunk-qer8jpr5.js} +1 -1
- package/dist/{chunk-1vgmzmsw.js → chunk-qr68w6qf.js} +1 -1
- package/dist/chunk-sd2gc341.js +2 -0
- package/dist/{chunk-bf519g5n.js → chunk-t0j0d802.js} +1 -1
- package/dist/chunk-t1s00kj6.js +2 -0
- package/dist/{chunk-ycdzhjt0.js → chunk-ty3j2ryw.js} +1 -1
- package/dist/{chunk-4fa3jec9.js → chunk-ver2yf41.js} +1 -1
- package/dist/chunk-vvyfeyxk.js +2 -0
- package/dist/{chunk-7sbgpmwt.js → chunk-vxhy0a3n.js} +2 -2
- package/dist/{chunk-tr7dz5g5.js → chunk-w28dbef2.js} +1 -1
- package/dist/{chunk-h356tjvs.js → chunk-wz29ahjp.js} +1 -1
- package/dist/{chunk-c491hsm1.js → chunk-x4yqyea2.js} +2 -2
- package/dist/{chunk-jdhs9w6h.js → chunk-xq4x3cy0.js} +1 -1
- package/dist/chunk-y2p3scx0.js +2 -0
- package/dist/{chunk-bf7aa9w7.js → chunk-yfbj4qce.js} +1 -1
- package/dist/{chunk-r6pax860.js → chunk-ynvce0q6.js} +2 -2
- package/dist/chunk-yxwam84p.js +2 -0
- package/dist/{chunk-mp633tnh.js → chunk-zkp2cw7q.js} +1 -1
- package/dist/chunk-zxbz8v00.js +2 -0
- package/dist/cli.js +9 -9
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/pwa.js +1 -1
- package/dist/signals.js +133 -3
- package/dist/ssg.js +3 -3
- package/dist/utils.js +18 -3
- package/package.json +5 -5
- package/dist/chunk-0r0cbqpj.js +0 -2
- package/dist/chunk-0snysm7z.js +0 -2
- package/dist/chunk-3wkrrps3.js +0 -2
- package/dist/chunk-5m8q7c5r.js +0 -2
- package/dist/chunk-6vye2exm.js +0 -2
- package/dist/chunk-80a84qry.js +0 -2
- package/dist/chunk-8p2vfjg2.js +0 -2
- package/dist/chunk-9r1jj3rm.js +0 -2
- package/dist/chunk-cq7se10f.js +0 -2
- package/dist/chunk-cy2bskcx.js +0 -2
- package/dist/chunk-ef0gstkd.js +0 -2
- package/dist/chunk-f8hd3kh3.js +0 -2
- package/dist/chunk-fb1711er.js +0 -2
- package/dist/chunk-g7ksavh1.js +0 -2
- package/dist/chunk-hskrxdcc.js +0 -2
- package/dist/chunk-m00nek1y.js +0 -2
- package/dist/chunk-nqvb9094.js +0 -2
- package/dist/chunk-p0nx92aq.js +0 -2
- package/dist/chunk-q0qd0bm4.js +0 -2
- package/dist/chunk-q98v7bhs.js +0 -2
- package/dist/chunk-r61m4j2j.js +0 -2
- package/dist/chunk-rf9hm92z.js +0 -2
- package/dist/chunk-rpsjz8jd.js +0 -2
- package/dist/chunk-t68s37hg.js +0 -2
- package/dist/chunk-twb35cwb.js +0 -2
- package/dist/chunk-wz1bgf8q.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ei,Ti
|
|
2
|
+
import{Ei,_i,Ti}from"./chunk-2jbyks2t.js";import{V,_n,qt,Mr,Nr,Tn,Kt,Xt,Lr,Rn}from"./chunk-3rpbzfw5.js";function W(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 h=JSON.parse(y?.textContent||"{}");o.__STX_DATA__=h&&typeof h==="object"&&!Array.isArray(h)?h:{}}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 X(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 Q(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((f,l)=>{let a=u.open(o,1);a.onupgradeneeded=()=>{a.result.createObjectStore("kv")},a.onsuccess=()=>f(a.result),a.onerror=()=>l(a.error),a.onblocked=()=>l(Error("blocked"))}),i.catch(()=>{i=null});return i},h=(f,l)=>y().then((a)=>new Promise((v,g)=>{let t=a.transaction("kv",f),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:(f)=>h("readonly",(l)=>l.get(f)),set:(f,l)=>h("readwrite",(a)=>{a.put(l,f)}),remove:(f)=>h("readwrite",(l)=>{l.delete(f)}),removePrefix:(f)=>h("readwrite",(l)=>{l.delete(IDBKeyRange.bound(f,`${f}\uFFFF`))})}}function G(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 h=()=>{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},f=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()})},O=(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:h();if(n||!c)return Promise.resolve(n);return c.get(e).then((_)=>{if(a.has(e))return{value:a.get(e)};let w=O(_);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<=f&&p(e,c))return;if(!h()){if(c.length>f)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=h();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 J(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 Y(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,h=(t)=>t===void 0?y:t,f=(t,s)=>{let m=h(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:f,seed(t,s){let m=f(t,s);return m?l(r.kept.peek(m)):void 0},restore(t,s){let m=f(t,s);return m?r.kept.load(m).then(l):Promise.resolve(void 0)},persist(t,s,m){let p=f(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,O=()=>({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(O(),e)),H=r.state(!1),q=r.state(!1),B=r.state(null),I=r.state(_?_.at:0),N=0,M=()=>{w.set(v.overlay(O(),e))},z=(b)=>{let x=N;v.restore(t,b).then((C)=>{if(!C||x!==N||n)return;e=C.data,I.set(C.at),M()})};if(!_)z(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,I.set(x?x.at:0),M(),!x)z(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)}),K;if(p.load)K=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;K=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([K,ne]).then((D)=>{if(k)clearTimeout(k);return p.transform?p.transform(D):D},(D)=>{if(k)clearTimeout(k);throw D})},U=(b)=>{if(c)return c;let x=N;if(q.set(!0),n===0&&!I())H.set(!0);let C=()=>{if(x!==N)return;c=null,q.set(!1),H.set(!1)},A=te(b).then((k)=>{if(x!==N)return w();return e=k,n=Date.now(),I.set(n),B.set(null),v.persist(t,k,E),M(),C(),w()},(k)=>{if(x===N)B.set(k&&k.message?k.message:"Could not load.");return C(),w()});return c=A,A},j={data:w,loading:H,isFetching:q,error:B,updatedAt:I,get key(){return t},load(b){if(ee(),!b&&n&&Date.now()-n<(p.staleTime||0))return Promise.resolve(w());return U(!!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:O,updated:()=>{if(n||I())U(!1)},outbox:(b)=>{if(b)e=v.overlay(O(),e,b.id),n=0,U(!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 Z(r,d,u,o,i){let y=!0,h=new Set,f=(a)=>o.get?o.get(a):a,l=()=>f(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(f(g),f(t)));return h.add(v),()=>{v(),h.delete(v)}},Object.defineProperty(l,"value",{get:l,set:l.set}),i(()=>{y=!1,h.forEach((a)=>a()),h.clear()}),l}function Pe(){let r=re(Wt());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,h=i+o.length;while(h<r.length&&y>0){let f=r[h];if(f==='"'||f==="'"||f==="`"){let l=f;h++;while(h<r.length&&r[h]!==l){if(r[h]==="\\")h++;h++}h++;continue}if(f==="(")y++;else if(f===")")y--;h++}d.push("0"),u=h}return d.join("")}function Wt(){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
|
|
@@ -1148,6 +1148,10 @@ finally {
|
|
|
1148
1148
|
if (scope) {
|
|
1149
1149
|
scope.__mountCallbacks = scope.__mountCallbacks || [];
|
|
1150
1150
|
scope.__mountCallbacks.push(fn);
|
|
1151
|
+
// Kept apart from the queue, which a flush drains: a component behind an
|
|
1152
|
+
// :if mounts again every time it is shown (see suspendSubtreeScopes).
|
|
1153
|
+
scope.__mountHooks = scope.__mountHooks || [];
|
|
1154
|
+
scope.__mountHooks.push(fn);
|
|
1151
1155
|
return;
|
|
1152
1156
|
}
|
|
1153
1157
|
mountCallbacks.push(fn);
|
|
@@ -1169,6 +1173,10 @@ finally {
|
|
|
1169
1173
|
if (scope) {
|
|
1170
1174
|
scope.__destroyCallbacks = scope.__destroyCallbacks || [];
|
|
1171
1175
|
scope.__destroyCallbacks.push(fn);
|
|
1176
|
+
// Registered once, at setup, and owed at every unmount -- including each
|
|
1177
|
+
// time an :if hides the component (see suspendSubtreeScopes).
|
|
1178
|
+
scope.__destroyHooks = scope.__destroyHooks || [];
|
|
1179
|
+
scope.__destroyHooks.push(fn);
|
|
1172
1180
|
return;
|
|
1173
1181
|
}
|
|
1174
1182
|
if (activeDestroySink) {
|
|
@@ -3133,7 +3141,7 @@ catch (e2) {
|
|
|
3133
3141
|
};
|
|
3134
3142
|
|
|
3135
3143
|
// Known directive names to exclude from generic :attr binding
|
|
3136
|
-
var DIRECTIVE_NAMES = ${
|
|
3144
|
+
var DIRECTIVE_NAMES = ${_i()};
|
|
3137
3145
|
|
|
3138
3146
|
// A bound value cannot introduce a URL scheme the page did not ask for.
|
|
3139
3147
|
// This is the client half of url-safety.ts: the server refuses a scheme
|
|
@@ -3168,7 +3176,7 @@ catch (e2) {
|
|
|
3168
3176
|
// a dead duplicate attribute and the real viewBox never updates.
|
|
3169
3177
|
var SVG_ATTR_CASE = {attributename:'attributeName', attributetype:'attributeType', basefrequency:'baseFrequency', baseprofile:'baseProfile', calcmode:'calcMode', clippathunits:'clipPathUnits', diffuseconstant:'diffuseConstant', edgemode:'edgeMode', filterunits:'filterUnits', glyphref:'glyphRef', gradienttransform:'gradientTransform', gradientunits:'gradientUnits', kernelmatrix:'kernelMatrix', kernelunitlength:'kernelUnitLength', keypoints:'keyPoints', keysplines:'keySplines', keytimes:'keyTimes', lengthadjust:'lengthAdjust', limitingconeangle:'limitingConeAngle', markerheight:'markerHeight', markerunits:'markerUnits', markerwidth:'markerWidth', maskcontentunits:'maskContentUnits', maskunits:'maskUnits', numoctaves:'numOctaves', pathlength:'pathLength', patterncontentunits:'patternContentUnits', patterntransform:'patternTransform', patternunits:'patternUnits', pointsatx:'pointsAtX', pointsaty:'pointsAtY', pointsatz:'pointsAtZ', preservealpha:'preserveAlpha', preserveaspectratio:'preserveAspectRatio', primitiveunits:'primitiveUnits', refx:'refX', refy:'refY', repeatcount:'repeatCount', repeatdur:'repeatDur', requiredextensions:'requiredExtensions', requiredfeatures:'requiredFeatures', specularconstant:'specularConstant', specularexponent:'specularExponent', spreadmethod:'spreadMethod', startoffset:'startOffset', stddeviation:'stdDeviation', stitchtiles:'stitchTiles', surfacescale:'surfaceScale', systemlanguage:'systemLanguage', tablevalues:'tableValues', targetx:'targetX', targety:'targetY', textlength:'textLength', viewbox:'viewBox', viewtarget:'viewTarget', xchannelselector:'xChannelSelector', ychannelselector:'yChannelSelector', zoomandpan:'zoomAndPan'};
|
|
3170
3178
|
var SVG_NS = 'http://www.w3.org/2000/svg';
|
|
3171
|
-
var EVENT_RE = ${
|
|
3179
|
+
var EVENT_RE = ${Ti()};
|
|
3172
3180
|
var KEY_MAP = {enter:'Enter', tab:'Tab', escape:'Escape', space:' ', up:'ArrowUp', down:'ArrowDown', left:'ArrowLeft', right:'ArrowRight', 'delete':'Delete', backspace:'Backspace'};
|
|
3173
3181
|
|
|
3174
3182
|
// Handle attributes
|
|
@@ -4195,7 +4203,20 @@ catch (e2) {
|
|
|
4195
4203
|
var resolvedCallerScope = resolveComponentCallerScope(root, callerScope);
|
|
4196
4204
|
root.__stx_parent_scope = resolvedCallerScope;
|
|
4197
4205
|
bindParentComponentProps(root, resolvedCallerScope);
|
|
4198
|
-
if (!scopeVars
|
|
4206
|
+
if (!scopeVars) return;
|
|
4207
|
+
if (root.__stx_disposers) {
|
|
4208
|
+
// Bound already, by the page's scope walk: a component behind a false
|
|
4209
|
+
// :if in a PARTIAL is in the list that walk collects, and is detached
|
|
4210
|
+
// by the time it is reached, so it was bound and its mount deferred
|
|
4211
|
+
// (stacksjs/stx#2036). Showing the branch is that mount. Without this
|
|
4212
|
+
// the component rendered and its onMount never ran at all.
|
|
4213
|
+
if (scopeVars.__mountCallbacks && !scopeVars.__mounted && !scopeVars.__suspended && root.isConnected) {
|
|
4214
|
+
scopeVars.__el = root;
|
|
4215
|
+
scopeVars.__mounted = true;
|
|
4216
|
+
runMountCallbacks(scopeVars.__mountCallbacks, scopeDestroySink(scopeVars));
|
|
4217
|
+
}
|
|
4218
|
+
return;
|
|
4219
|
+
}
|
|
4199
4220
|
scopeVars.__el = root;
|
|
4200
4221
|
var childScope = { ...resolvedCallerScope, ...scopeVars };
|
|
4201
4222
|
root.__stx_disposers = trackEffects(function() {
|
|
@@ -5102,6 +5123,14 @@ catch (e2) {
|
|
|
5102
5123
|
var gone = chain[currentIdx];
|
|
5103
5124
|
gone.el.__stx_chain_active = false;
|
|
5104
5125
|
gone.el.__stx_if_visible.set(false);
|
|
5126
|
+
// Unmount what the branch held, as a single :if does, before any of
|
|
5127
|
+
// it leaves the page.
|
|
5128
|
+
var leavingNodes = gone.nodes.filter(function (n) { return n.parentNode; });
|
|
5129
|
+
if (gone.isTemplate && gone.endMarker && gone.endMarker.parentNode) {
|
|
5130
|
+
leavingNodes = [];
|
|
5131
|
+
for (var walk = gone.placeholder.nextSibling; walk && walk !== gone.endMarker; walk = walk.nextSibling) leavingNodes.push(walk);
|
|
5132
|
+
}
|
|
5133
|
+
suspendSubtreeScopes(leavingNodes);
|
|
5105
5134
|
|
|
5106
5135
|
if (gone.isTemplate) {
|
|
5107
5136
|
// Everything this branch rendered goes, not just the clones it owns:
|
|
@@ -5170,6 +5199,15 @@ catch (e) { /* a disposer of its own is not this branch's problem */ }
|
|
|
5170
5199
|
stxHost.insert(pickHost, pick.endMarker, anchor);
|
|
5171
5200
|
}
|
|
5172
5201
|
pick.el.__stx_shown_at = performance.now();
|
|
5202
|
+
// An element branch shown before keeps its bindings and its scopes;
|
|
5203
|
+
// the components in it mount again (a template branch is cloned afresh
|
|
5204
|
+
// and mounts through hydrateComponentScopes below).
|
|
5205
|
+
if (pick.childrenProcessed) {
|
|
5206
|
+
var shownNodes = pick.nodes;
|
|
5207
|
+
queueMicrotask(function () {
|
|
5208
|
+
if (pick.el.__stx_chain_active) peek(function () { resumeSubtreeScopes(shownNodes); });
|
|
5209
|
+
});
|
|
5210
|
+
}
|
|
5173
5211
|
if (!pick.childrenProcessed) {
|
|
5174
5212
|
pick.childrenProcessed = true;
|
|
5175
5213
|
// Hydrate before the outer scope walk can see the inserted branch.
|
|
@@ -5397,6 +5435,9 @@ else if (!value && isInserted) {
|
|
|
5397
5435
|
// parent and took a sibling <template :if> with it -- the initial
|
|
5398
5436
|
// server-rendered state has no marker to stop at.
|
|
5399
5437
|
if (endMarker && endMarker.parentNode === parent) {
|
|
5438
|
+
var leaving = [];
|
|
5439
|
+
for (var cursor = placeholder.nextSibling; cursor && cursor !== endMarker; cursor = cursor.nextSibling) leaving.push(cursor);
|
|
5440
|
+
suspendSubtreeScopes(leaving);
|
|
5400
5441
|
var doomed = placeholder.nextSibling;
|
|
5401
5442
|
while (doomed && doomed !== endMarker) {
|
|
5402
5443
|
var nextDoomed = doomed.nextSibling;
|
|
@@ -5406,6 +5447,7 @@ else if (!value && isInserted) {
|
|
|
5406
5447
|
}
|
|
5407
5448
|
stxHost.remove(endMarker);
|
|
5408
5449
|
}
|
|
5450
|
+
suspendSubtreeScopes(currentNodes.filter(node => node.parentNode));
|
|
5409
5451
|
currentNodes.forEach(node => { disposeSubtreeEffects(node); stxHost.remove(node); });
|
|
5410
5452
|
currentNodes = [];
|
|
5411
5453
|
isInserted = false;
|
|
@@ -5436,10 +5478,21 @@ else {
|
|
|
5436
5478
|
// Its children may have become visible while it was detached, so
|
|
5437
5479
|
// resume their pending bindings now that the subtree is connected.
|
|
5438
5480
|
peek(resumeDetachedBranches);
|
|
5481
|
+
// Shown before, so the components in it mounted and were suspended
|
|
5482
|
+
// when it hid. They mount again now -- in a microtask, the same
|
|
5483
|
+
// moment their first mount ran, and only if still shown by then.
|
|
5484
|
+
if (childrenProcessed) {
|
|
5485
|
+
queueMicrotask(function() {
|
|
5486
|
+
if (isInserted) peek(function() { resumeSubtreeScopes(currentNodes); });
|
|
5487
|
+
});
|
|
5488
|
+
}
|
|
5439
5489
|
}
|
|
5440
5490
|
else if (!value && isInserted) {
|
|
5441
5491
|
console.log('[stx] bindIf REMOVING element for :if=' + expr, 'el.isConnected:', el.isConnected, 'parent:', parent.tagName);
|
|
5442
5492
|
el.__stx_if_visible.set(false);
|
|
5493
|
+
// Unmounted, not disposed: the components in it release what they
|
|
5494
|
+
// hold while their markup is still on the page, and keep their scopes.
|
|
5495
|
+
suspendSubtreeScopes(currentNodes);
|
|
5443
5496
|
// Do NOT disposeSubtreeScopes here. :if is a TOGGLE \u2014 the element is
|
|
5444
5497
|
// re-shown when the condition flips back \u2014 not a permanent unmount.
|
|
5445
5498
|
// A nested data-stx-scope inside this subtree is created once by its
|
|
@@ -6580,6 +6633,13 @@ catch (e) {} }
|
|
|
6580
6633
|
if (initialAttribute.has) {
|
|
6581
6634
|
lastRaw = initialAttribute.raw;
|
|
6582
6635
|
initial = parse(lastRaw);
|
|
6636
|
+
} else if (typeof staticValue === 'string' && (opts.parse || typeof defaultValue !== 'string')) {
|
|
6637
|
+
// A prop written as a plain attribute is serialized as the string it was
|
|
6638
|
+
// written as, so it gets the same parse an attribute does. Taken raw,
|
|
6639
|
+
// currentPage="1" reached Pagination as "1": "1" + 1 is "11", the
|
|
6640
|
+
// range maths took the wrong branch, and ten pages rendered as
|
|
6641
|
+
// 1 ... 1 2 3 4 5 6 7 8 9 10 ... 10. A string prop stays a string.
|
|
6642
|
+
initial = parse(staticValue);
|
|
6583
6643
|
} else {
|
|
6584
6644
|
initial = staticValue;
|
|
6585
6645
|
}
|
|
@@ -8833,6 +8893,70 @@ catch (e) {
|
|
|
8833
8893
|
}
|
|
8834
8894
|
}
|
|
8835
8895
|
|
|
8896
|
+
// :if is a toggle, and a component inside one lives through every toggle:
|
|
8897
|
+
// its scope is registered once and kept (#1737), and showing the branch puts
|
|
8898
|
+
// the same markup back. Its LIFECYCLE follows the toggle, though. Hiding runs
|
|
8899
|
+
// what the component registered to release -- its onDestroy, and whatever
|
|
8900
|
+
// its onMount handed back -- and showing it again runs its onMount again.
|
|
8901
|
+
// Each show is a mount and each hide an unmount, which is the pairing every
|
|
8902
|
+
// component on a page already gets.
|
|
8903
|
+
//
|
|
8904
|
+
// Before this, a hidden component never heard about it and a re-shown one
|
|
8905
|
+
// was never told it was back (the asymmetry stacksjs/stx#2036 stopped short
|
|
8906
|
+
// of). A gated modal shell -- one that traps focus, locks body scroll and
|
|
8907
|
+
// claims Escape from onMount, and releases them in onDestroy -- did all of
|
|
8908
|
+
// that on its first opening and on no later one: the second time it opened
|
|
8909
|
+
// with the page scrolling behind it and Escape doing nothing.
|
|
8910
|
+
//
|
|
8911
|
+
// Only scopes that actually mounted are suspended, so a component whose
|
|
8912
|
+
// first mount is still deferred (behind a false :if, or an stx-hydrate
|
|
8913
|
+
// island) keeps waiting for its own flush.
|
|
8914
|
+
function suspendSubtreeScopes(nodes) {
|
|
8915
|
+
if (!nodes || !window.stx || !window.stx._scopes) return;
|
|
8916
|
+
var ids = [];
|
|
8917
|
+
for (var i = 0; i < nodes.length; i++) {
|
|
8918
|
+
var found = stxHost.scopesIn(nodes[i]);
|
|
8919
|
+
for (var k = 0; k < found.length; k++) {
|
|
8920
|
+
if (ids.indexOf(found[k]) === -1) ids.push(found[k]);
|
|
8921
|
+
}
|
|
8922
|
+
}
|
|
8923
|
+
// Innermost first, the order a page unmounts in: a child releases what it
|
|
8924
|
+
// holds before the component it sits in does.
|
|
8925
|
+
for (var n = ids.length - 1; n >= 0; n--) {
|
|
8926
|
+
var scopeVars = window.stx._scopes[ids[n]];
|
|
8927
|
+
if (!scopeVars || !scopeVars.__mounted) continue;
|
|
8928
|
+
scopeVars.__mounted = false;
|
|
8929
|
+
scopeVars.__suspended = true;
|
|
8930
|
+
var release = scopeVars.__destroyCallbacks || [];
|
|
8931
|
+
// What onDestroy registered at setup is owed again at the next hide;
|
|
8932
|
+
// a cleanup a mount handed back belonged to that mount alone.
|
|
8933
|
+
scopeVars.__destroyCallbacks = (scopeVars.__destroyHooks || []).slice();
|
|
8934
|
+
for (var j = 0; j < release.length; j++) {
|
|
8935
|
+
try { release[j](); }
|
|
8936
|
+
catch (e) { console.warn('[stx] scope destroy error:', e); }
|
|
8937
|
+
}
|
|
8938
|
+
scopeVars.__mountCallbacks = (scopeVars.__mountHooks || []).slice();
|
|
8939
|
+
}
|
|
8940
|
+
}
|
|
8941
|
+
|
|
8942
|
+
// The other half: a suspended scope whose markup is back on the page mounts
|
|
8943
|
+
// again. A scope still off the page (hidden by an :if of its own inside this
|
|
8944
|
+
// branch) is left for that :if to resume.
|
|
8945
|
+
function resumeSubtreeScopes(nodes) {
|
|
8946
|
+
if (!nodes || !window.stx || !window.stx._scopes) return;
|
|
8947
|
+
for (var i = 0; i < nodes.length; i++) {
|
|
8948
|
+
var ids = stxHost.scopesIn(nodes[i]);
|
|
8949
|
+
for (var k = 0; k < ids.length; k++) {
|
|
8950
|
+
var scopeVars = window.stx._scopes[ids[k]];
|
|
8951
|
+
if (!scopeVars || scopeVars.__mounted || !scopeVars.__suspended) continue;
|
|
8952
|
+
if (scopeVars.__el && scopeVars.__el.isConnected === false) continue;
|
|
8953
|
+
scopeVars.__suspended = false;
|
|
8954
|
+
scopeVars.__mounted = true;
|
|
8955
|
+
runMountCallbacks(scopeVars.__mountCallbacks, scopeDestroySink(scopeVars));
|
|
8956
|
+
}
|
|
8957
|
+
}
|
|
8958
|
+
}
|
|
8959
|
+
|
|
8836
8960
|
function disposeSubtreeScopes(root) {
|
|
8837
8961
|
if (!root || !window.stx || !window.stx._scopes) return;
|
|
8838
8962
|
// The host reports which scopes live in this subtree: the document finds
|
|
@@ -8844,7 +8968,12 @@ catch (e) {
|
|
|
8844
8968
|
if (!scopeId) continue;
|
|
8845
8969
|
var scopeVars = window.stx._scopes[scopeId];
|
|
8846
8970
|
if (!scopeVars) continue;
|
|
8847
|
-
if
|
|
8971
|
+
// Hidden by an :if, it already released everything on the way out;
|
|
8972
|
+
// running the hooks again would unmount it twice. (A hidden component's
|
|
8973
|
+
// root is detached, so no walk reaches it today; this keeps the next
|
|
8974
|
+
// disposal path that does from unmounting it twice.)
|
|
8975
|
+
var alreadyReleased = scopeVars.__suspended && !scopeVars.__mounted;
|
|
8976
|
+
if (!alreadyReleased && scopeVars.__destroyCallbacks && Array.isArray(scopeVars.__destroyCallbacks)) {
|
|
8848
8977
|
for (var j = 0; j < scopeVars.__destroyCallbacks.length; j++) {
|
|
8849
8978
|
try { scopeVars.__destroyCallbacks[j](); }
|
|
8850
8979
|
catch (e) { console.warn('[stx] scope destroy error:', e); }
|
|
@@ -8896,7 +9025,8 @@ catch (e) {
|
|
|
8896
9025
|
if (p.__stx_if_bound || p.__stx_chain_member) { retained = true; break; }
|
|
8897
9026
|
}
|
|
8898
9027
|
if (retained) continue;
|
|
8899
|
-
if
|
|
9028
|
+
// Suspended by an :if: released when it hid, so not again here.
|
|
9029
|
+
if (!(entry.__suspended && !entry.__mounted) && entry.__destroyCallbacks && Array.isArray(entry.__destroyCallbacks)) {
|
|
8900
9030
|
for (var k = 0; k < entry.__destroyCallbacks.length; k++) {
|
|
8901
9031
|
try { entry.__destroyCallbacks[k](); }
|
|
8902
9032
|
catch (e) { console.warn('[stx] scope destroy error:', e); }
|
|
@@ -9405,5 +9535,5 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
|
|
|
9405
9535
|
}
|
|
9406
9536
|
}
|
|
9407
9537
|
})();
|
|
9408
|
-
`}var Kl={state:V,derived:
|
|
9538
|
+
`}var Kl={state:V,derived:_n,effect:qt,batch:Mr,onMount:Nr,onDestroy:Tn,isSignal:Kt,isDerived:Xt,untrack:Lr,peek:Rn,generateSignalsRuntime:Pe,generateSignalsRuntimeDev:Wt};
|
|
9409
9539
|
export{Pe,Wt,Kl};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{m,Zt,w,Me,o,R}from"./chunk-
|
|
2
|
+
import{m,Zt,w,Me,o,R}from"./chunk-b6e36vr2.js";import{Wr}from"./chunk-5pgvfxtx.js";import{s,be}from"./chunk-y3cqh2jv.js";import{a}from"./chunk-7tt84v1y.js";import g from"path";import v from"fs";function pe(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 fe(e){if(e&&typeof e==="object"&&Array.isArray(e.errors))return e.errors;return[e]}function J(e,t){let r=[];for(let l of fe(e)){if(pe(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 De(e,t){return J(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=10;function P(e,t,r){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(g.basename(e))||Wr(e,t,r)}var re=1,se=new Map,W=600,ge=100,G=new Map;async function he(e){let t=G.get(e)??0;if(t>0&&t<ge){G.set(e,t+1);return}G.set(e,1);try{let r=(await v.promises.readdir(e)).filter((p)=>p.endsWith(".js"));if(r.length<=W)return;let u=(await Promise.all(r.map(async(p)=>{try{return{name:p,at:(await v.promises.stat(g.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(W)){let d=p.name.slice(0,-3);await v.promises.rm(g.join(e,`${d}.js`),{force:!0}),await v.promises.rm(g.join(e,`${d}.deps.json`),{force:!0})}D("pruned bundle cache to",W,"entries")}catch{}}function ie(e){return se.get(e)??[]}function q(e,t){if(e)se.set(e,t)}function Na(e=process.env){return e.STX_DEBUG==="true"||e.STX_DEBUG==="1"}function D(...e){if(Na())console.log("[stx:bundler]",...e)}var Y=[];function Mo(e,t,r){Y.push({filePath:e||"<inline>",message:t,details:r})}function gt(){return Y.slice()}function mt(){Y.length=0}var H;function hu(e){H=e}function No(){if(H)return H;try{let e=R.strict;return typeof e==="object"&&e!==null?e.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Z=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function ht(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(!Z.some((d)=>d.test(u)))return D("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(!Z.some((d)=>d.test(u)))return D("detected side-effect import:",u),!0}return!1}var Yt="stx-module:",xe=/\.(?:[cm]?[jt]sx?|json)$/i;function La(e,t){return g.relative(e,t).split(g.sep).join("/")}function ja(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(Yt)?`${l}${u}${d}${u}`:r})}function Ba(e,t){let r=0,l=(p)=>{let d=`__stxMod${r++}`,y=JSON.stringify(p);return t.push(`var ${d} = globalThis.__stxModules && globalThis.__stxModules[${y}];`,`if (${d} === undefined) throw new Error("[stx] module " + ${JSON.stringify(y)} + " is not registered on this page (#1957)");`),d},u=(p,d)=>{for(let y of p.split(",")){let F=y.trim();if(!F)continue;let c=F.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!c)continue;let n=c[1].startsWith('"')?JSON.parse(c[1]):c[1],i=c[2]??n;t.push(`var ${i} = ${d}[${JSON.stringify(n)}];`)}};return e=e.replace(/^[ \t]*import\s+([^;"']*?)\s+from\s+["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,d,y)=>{let F=y.slice(Yt.length),c=l(F),n=d.trim(),i=n.match(/^([\w$]+)\s*(?:,\s*|$)/);if(i&&!n.startsWith("{")&&!n.startsWith("*"))t.push(`var ${i[1]} = ${c}.default;`),n=n.slice(i[0].length).trim();let f=n.match(/^\*\s*as\s+([\w$]+)$/);if(f)t.push(`var ${f[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(Yt.length)),"")),e}function te(e){let t=[e,`${e}.ts`,`${e}.tsx`,`${e}.js`,`${e}.mjs`,`${e}.jsx`,g.join(e,"index.ts"),g.join(e,"index.tsx"),g.join(e,"index.js"),g.join(e,"index.mjs")];for(let r of t)try{if(v.existsSync(r)&&v.statSync(r,{throwIfNoEntry:!1})?.isFile())return r}catch{}return}function $e(e,t,r,l,u,p=new Map,d){let y=(c,n,i)=>{if(P(n,e,d))return null;if(!u||c!==r||!xe.test(n))return null;try{if(!v.statSync(n,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}l.add(n);let f=`${Yt}${La(process.cwd(),n)}`;return p.set(i,f),{path:f,external:!0}},F=(c,n)=>{let i=c===r?t:g.dirname(c),f=g.resolve(i,n);return te(f)??f};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 i=te(n.path);if(i){let f=y(n.importer,i,n.path);if(f)return f;if(i!==r)l.add(i);return{path:i}}return{path:n.path,external:!0}}),c.onResolve({filter:/^\.\.?\//},(n)=>{let i=F(n.importer,n.path),f=y(n.importer,i,n.path);if(f)return f;return l.add(i),{path:i}}),c.onResolve({filter:/^[@~]\//},(n)=>{let i=g.resolve(e,n.path.slice(2)),f=[i,`${i}.ts`,`${i}.tsx`,`${i}.js`,`${i}.mjs`,`${i}.jsx`,g.join(i,"index.ts"),g.join(i,"index.tsx"),g.join(i,"index.js"),g.join(i,"index.mjs")];for(let S of f)if(v.existsSync(S)&&v.statSync(S,{throwIfNoEntry:!1})?.isFile()){let k=y(n.importer,S,n.path);if(k)return k;return D(`resolved ${n.path[0]}/ import:`,n.path,"\u2192",S),l.add(S),{path:S}}return console.warn(`[stx:bundler] could not resolve ${n.path[0]}/ import:`,n.path),{path:i}}),u)c.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(n)=>{if(n.importer!==r)return;let i=`${Yt}npm:${n.path}`;return p.set(n.path,i),{path:i,external:!0}});c.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(n)=>{if(P(n.path,e,d))throw Error(`Server-only API source cannot be imported by a client script: ${n.path}`);let i=g.extname(n.path).toLowerCase(),f=i===".json"?"json":i===".tsx"?"tsx":i===".jsx"?"jsx":i===".ts"||i===".mts"||i===".cts"?"ts":"js";if(n.path!==r)l.add(n.path);return{contents:v.readFileSync(n.path,"utf8"),loader:f}})}}}var X=new Map,U=m(64),ne=Symbol.for("stx.client-bundle-build-queue");function Fa(e){let t=globalThis,l=(t[ne]??Promise.resolve()).then(e,e);return t[ne]=l.then(()=>{return},()=>{return}),l}async function yt(e,t,r={}){let l=r.projectRoot||process.cwd(),u=(await o(l)).serverApi,p=r.minify??!1,d=r.externalizeUserModules??!0,y=r.cacheDir||a(l,"bundle-cache"),F=new Bun.CryptoHasher("md5");F.update(`${me}\x00${Me()}\x00${JSON.stringify(u??!1)}\x00${d?"registry":"inline"}\x00${e}\x00${t}`);let c=F.digest("hex").slice(0,12),n=g.join(y,`${c}.js`),i=U.get(n);if(i){if(Zt(i.files)&&i.files.every((_)=>!P(_.path,l,u))){D("memo hit:",c);let _=i.files.map((A)=>A.path);return q(t,_),r.collectInputs?.push(..._),i.code}U.delete(n),D("memo invalidated by dep change:",c)}let f=g.join(y,`${c}.deps.json`),S=Bun.file(n);if(await S.exists()){let _=Bun.file(f),A=!1,E=null;if(await _.exists())try{let N=JSON.parse(await _.text());if(N.metadataVersion!==re||!Array.isArray(N.files))A=!1;else E=N.files,A=!0;if(E&&(!Zt(E)||E.some((T)=>P(T.path,l,u))))A=!1}catch{A=!1}if(A){if(D("cache hit:",c),E)q(t,E.map((T)=>T.path)),r.collectInputs?.push(...E.map((T)=>T.path));let N=await S.text();if(E)U.set(n,{code:N,files:E});return N}D("cache invalidated by dep change:",c)}let k=X.get(c);if(k){let _=await k;if(r.collectInputs)r.collectInputs.push(...(U.get(n)?.files??[]).map((A)=>A.path));return _}let M=Fa(()=>ye(e,t,{projectRoot:l,minify:p,cacheDir:y,hash:c,cachePath:n,depsPath:f,collectInputs:r.collectInputs,externalizeUserModules:d,serverApi:u}));X.set(c,M);try{return await M}finally{X.delete(c)}}var we=0;function za(e){return`${e}-${process.pid}-${++we}`}async function ye(e,t,r){let{projectRoot:l,minify:u,cacheDir:p,hash:d,cachePath:y,depsPath:F,externalizeUserModules:c}=r,n=a(l,"bundle-tmp"),i=za(d),f=g.join(n,`${i}.ts`),S=g.join(n,"out",i);v.mkdirSync(n,{recursive:!0}),v.mkdirSync(S,{recursive:!0});let k=g.dirname(t),M=new Set,_=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,A=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,E=s(e),{depths:N,balanced:T}=be(E),V=(B)=>!T||N[B]===0,x;while((x=_.exec(E))!==null){if(x[1])continue;if(!V(x.index))continue;if(x[2])x[2].split(",").forEach((B)=>{let h=Be(B);if(h)M.add(h)});else if(x[3])M.add(x[3])}while((x=A.exec(E))!==null){if(x[1])continue;if(!V(x.index))continue;M.add(x[2])}let oe=/^[ \t]*import\s+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((x=oe.exec(E))!==null){if(!V(x.index))continue;let B=/^\s*['"]([^'"]+)['"]/.exec(e.slice(x.index+x[0].length))?.[1];if(B&&Z.some((h)=>h.test(B)))continue;if(x[1])M.add(x[1]);if(x[2])M.add(x[2]);for(let h of(x[3]??"").split(",")){let j=h.trim();if(!j||/^type\s/.test(j))continue;let L=/\bas\s+(\w+)\s*$/.exec(j)?.[1]??/^\w+$/.exec(j)?.[0];if(L)M.add(L)}}for(let B of E.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let h of B[1].split(",")){let j=/\bas\s+(\w+)\s*$/.exec(h)?.[1]??/^\s*(\w+)\s*$/.exec(h)?.[1];if(j)M.delete(j)}let le=M.size>0?`
|
|
5
5
|
export { ${[...M].join(", ")} }`:"";await Bun.write(f,e+le),D("bundling:",d,"from:",g.basename(t));let Q=new Set,K=new Map;try{let B=await Bun.build({entrypoints:[f],outdir:S,target:"browser",format:"esm",minify:u,plugins:[$e(l,k,f,Q,c,K,r.serverApi)],define:{"process.env.NODE_ENV":u?'"production"':'"development"',...w()},root:l});if(!B.success){let I=B.logs.filter((C)=>C.level==="error").map((C)=>C.message).join(", ")||`Unable to bundle ${g.basename(t)}`,O=J(B.logs,t||void 0);if(console.warn("[stx:bundler] build failed:",I),Mo(t||"",I,O),No()==="error")throw Error(I);return e}let h="";for(let b of B.outputs){h=await b.text();break}let j=[];for(let b of h.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let I of b[1].split(",")){let O=I.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(O){j.push([O[2],O[1]]);continue}let C=I.trim();if(/^[A-Za-z_$][\w$]*$/.test(C))j.push([C,C])}let L=[];h=Ba(ja(h,K),L);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 ee=`__stxBundle_${d}`,ce=j.map(([b,I])=>`${JSON.stringify(b)}: ${I}`).join(", "),ue=j.map(([b])=>`var ${b} = undefined;`).join(`
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Zl,yo,_a,Ql,eu,tu,nu,ru,Ta,Ra,su,ou,iu,au}from"./chunk-18pagcsc.js";import"./chunk-b6e36vr2.js";import"./chunk-5bqs0ve6.js";import"./chunk-8xz8t9xp.js";import"./chunk-0trfbqa7.js";import"./chunk-n3r5m938.js";import"./chunk-zydg3wgt.js";import"./chunk-ver2yf41.js";import"./chunk-8yrk8ybh.js";import"./chunk-ynvce0q6.js";import"./chunk-pf0d8y9n.js";import"./chunk-2jbyks2t.js";import"./chunk-5w87wmc4.js";import"./chunk-jz7pvh7b.js";export{_a as SUSPENSE_RESOLVER_RUNTIME,yo as buildSuspenseResolveScript,ru as createStreamRenderer,tu as extractStreamBoundaries,au as generateHydrationRuntime,Ra as islandDirective,ou as processSectionDirectives,eu as processStreamDirectives,su as registerStreamingDirectives,Ql as renderStreamingPage,Zl as streamTemplate,nu as streamTemplateSimple,iu as streamToResponse,Ta as streamingSuspenseDirective};
|