@stacksjs/stx 0.2.874 → 0.2.876
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-027meh1k.js +2 -0
- package/dist/{chunk-gbtbfg7e.js → chunk-0g2mg8cw.js} +3 -3
- package/dist/chunk-0hs633pt.js +2 -0
- package/dist/chunk-0j8zre1m.js +2 -0
- package/dist/{chunk-6mkn81pd.js → chunk-0sa9gqmc.js} +7 -7
- package/dist/chunk-0v02qms8.js +2 -0
- package/dist/chunk-0z9gttw0.js +2 -0
- package/dist/chunk-11dwmcpy.js +3 -0
- package/dist/{chunk-vxtx0khv.js → chunk-1a237qky.js} +9 -9
- package/dist/{chunk-c3kanj1m.js → chunk-1ehjzhnc.js} +3 -3
- package/dist/chunk-1gfg6qmr.js +2 -0
- package/dist/chunk-1kgnk6ds.js +2 -0
- package/dist/{chunk-6ftee542.js → chunk-1q5w3xav.js} +2 -2
- package/dist/chunk-1ztp5vkh.js +3 -0
- package/dist/{chunk-p1a1kbhz.js → chunk-2mt2zc5y.js} +8 -8
- package/dist/{chunk-kdmwy40c.js → chunk-2tcyfrvb.js} +2 -2
- package/dist/{chunk-01mwbg1r.js → chunk-2zaatnnh.js} +4 -4
- package/dist/chunk-32wvc376.js +2 -0
- package/dist/{chunk-b8z3vepm.js → chunk-3922g6sh.js} +9 -9
- package/dist/chunk-3k2d2jsn.js +2 -0
- package/dist/{chunk-v4xes880.js → chunk-3mz9bdf7.js} +3 -3
- package/dist/chunk-3te2y9qf.js +2 -0
- package/dist/{chunk-farh4p7f.js → chunk-3w7gacva.js} +2 -2
- package/dist/chunk-40330tm5.js +2 -0
- package/dist/chunk-447jc6zc.js +2 -0
- package/dist/{chunk-s584xnzx.js → chunk-4517hny7.js} +2 -2
- package/dist/chunk-4dk6k0ad.js +2 -0
- package/dist/chunk-4e48zkq0.js +2 -0
- package/dist/chunk-5ep7p8te.js +2 -0
- package/dist/chunk-5gx403te.js +1184 -0
- package/dist/{chunk-zt9j94ak.js → chunk-6kp4mg3h.js} +2 -2
- package/dist/chunk-6q9a5bph.js +2 -0
- package/dist/{chunk-n3jw3xpj.js → chunk-75v0yxeh.js} +2 -2
- package/dist/chunk-7ds9mx4c.js +2 -0
- package/dist/chunk-7njy024g.js +2 -0
- package/dist/{chunk-p219rr27.js → chunk-7rep2jqh.js} +14 -14
- package/dist/chunk-7tjewwmd.js +2 -0
- package/dist/chunk-85xabvtj.js +2 -0
- package/dist/chunk-880f8j99.js +2 -0
- package/dist/chunk-8f3dbthj.js +2 -0
- package/dist/{chunk-nack2xs5.js → chunk-976kgb3r.js} +5 -5
- package/dist/chunk-99e3mxnn.js +20 -0
- package/dist/chunk-9gv847nn.js +2 -0
- package/dist/chunk-9mz2n39m.js +2 -0
- package/dist/{chunk-55zq2ha8.js → chunk-ae8q4gze.js} +5 -5
- package/dist/{chunk-hev4t4d5.js → chunk-afxfkb60.js} +6 -6
- package/dist/{chunk-fr72bsqd.js → chunk-akthsg33.js} +11 -11
- package/dist/chunk-b1tcym2x.js +2 -0
- package/dist/{chunk-j1efsjsb.js → chunk-b4d4tjvx.js} +5 -5
- package/dist/{chunk-j89p53vx.js → chunk-bdh73gxd.js} +2 -2
- package/dist/{chunk-4068rmzv.js → chunk-bjjfr7qt.js} +2 -2
- package/dist/chunk-bspj1rf1.js +2 -0
- package/dist/chunk-bx3hpsxn.js +2 -0
- package/dist/chunk-byq488g4.js +2 -0
- package/dist/chunk-c4s25bm2.js +2 -0
- package/dist/{chunk-ttm0gvrc.js → chunk-cj44e8mw.js} +5 -5
- package/dist/chunk-csjqtzwc.js +2 -0
- package/dist/{chunk-2xc457bf.js → chunk-ctjxcaxq.js} +14 -14
- package/dist/{chunk-79mmzprp.js → chunk-cvbwxskc.js} +5 -5
- package/dist/{chunk-7j0qkye5.js → chunk-d3q0cg47.js} +2 -2
- package/dist/{chunk-b666d8m6.js → chunk-d6gqh2wv.js} +1 -1
- package/dist/{chunk-vvxcebpn.js → chunk-dbvsa5ya.js} +2 -2
- package/dist/{chunk-hr147ys5.js → chunk-df6vjs3p.js} +5 -5
- package/dist/chunk-df78j74w.js +4 -0
- package/dist/chunk-dgs3d367.js +2 -0
- package/dist/chunk-dmf6zcf4.js +2 -0
- package/dist/{chunk-a0dsp485.js → chunk-dv56x3g8.js} +10 -10
- package/dist/chunk-e2b2f502.js +2 -0
- package/dist/chunk-ec6mrad6.js +2 -0
- package/dist/{chunk-xdfmrv49.js → chunk-eecctzgp.js} +6 -6
- package/dist/{chunk-8hhhmscy.js → chunk-eknm4jrm.js} +2 -2
- package/dist/{chunk-4nb7egk0.js → chunk-esjr9qhe.js} +2 -2
- package/dist/{chunk-wk2rge05.js → chunk-f4vgagjb.js} +3 -3
- package/dist/chunk-fa57bncd.js +2 -0
- package/dist/{chunk-qjey0jk6.js → chunk-fdjx4vs3.js} +2 -2
- package/dist/{chunk-pqy58ps0.js → chunk-fh72k2ks.js} +6 -6
- package/dist/{chunk-zfrzdje6.js → chunk-ft6em3wm.js} +6 -6
- package/dist/{chunk-bv9dbf4m.js → chunk-fwbccyhw.js} +2 -2
- package/dist/{chunk-3z4p70t5.js → chunk-g15reb1h.js} +6 -6
- package/dist/chunk-g4eheg0t.js +24 -0
- package/dist/chunk-gfe1jrw9.js +2 -0
- package/dist/chunk-gn16yq49.js +2 -0
- package/dist/{chunk-qcxrcypb.js → chunk-gqtb53s8.js} +2 -2
- package/dist/chunk-gvs61tqn.js +2 -0
- package/dist/{chunk-gxan9w4e.js → chunk-h17pfbng.js} +2 -2
- package/dist/chunk-h2928108.js +2 -0
- package/dist/chunk-hat353vx.js +2 -0
- package/dist/{chunk-ykapdv6d.js → chunk-j0rqa9bk.js} +3 -3
- package/dist/chunk-jmjgj3nh.js +2 -0
- package/dist/chunk-jqtpzzz4.js +12 -0
- package/dist/{chunk-hmdkf6c6.js → chunk-jqxerj6k.js} +2 -2
- package/dist/{chunk-3z1mmar2.js → chunk-jt5tzddc.js} +2 -2
- package/dist/{chunk-n56x7jg8.js → chunk-jvy7z3hz.js} +1 -1
- package/dist/{chunk-c8jhskx8.js → chunk-k0t9ye9j.js} +38 -38
- package/dist/{chunk-q50x1gfd.js → chunk-k1ew643q.js} +2 -2
- package/dist/{chunk-pqgc8k6k.js → chunk-k9dne5by.js} +1 -1
- package/dist/chunk-kq8mffgf.js +2 -0
- package/dist/chunk-kx06jzdw.js +2 -0
- package/dist/{chunk-ysfeg3cn.js → chunk-kywe0f1v.js} +2 -2
- package/dist/{chunk-60yppcbb.js → chunk-kzc2tqzr.js} +2 -2
- package/dist/{chunk-9zrvh3pz.js → chunk-mce3g2wb.js} +2 -2
- package/dist/{chunk-0k11nsv1.js → chunk-mkwavsb3.js} +3 -3
- package/dist/{chunk-bbq79tap.js → chunk-mw0rb1sf.js} +4 -4
- package/dist/chunk-n5pvdrkb.js +2 -0
- package/dist/chunk-ne8q191s.js +2 -0
- package/dist/{chunk-tabkp672.js → chunk-nn6hvsxp.js} +1 -1
- package/dist/{chunk-e7s109j6.js → chunk-nnp6rf4c.js} +1 -1
- package/dist/chunk-np8wgbsa.js +3 -0
- package/dist/chunk-nthw4dca.js +2 -0
- package/dist/{chunk-tyvm49be.js → chunk-nv4c25zj.js} +3 -3
- package/dist/{chunk-dhbpbjt3.js → chunk-p5m1z6e1.js} +6 -6
- package/dist/{chunk-18a3vdnq.js → chunk-pk714ynv.js} +4 -4
- package/dist/{chunk-csymxc5a.js → chunk-pp99rmjm.js} +15 -15
- package/dist/chunk-pqmjeea6.js +2 -0
- package/dist/chunk-qggwr60r.js +2 -0
- package/dist/chunk-qm3v4qb7.js +2 -0
- package/dist/{chunk-40h07m5w.js → chunk-qnwd5bz4.js} +1 -1
- package/dist/chunk-qty0t69x.js +2 -0
- package/dist/{chunk-tnp2ta5q.js → chunk-r09kz9bf.js} +2 -2
- package/dist/{chunk-q1wxgw5s.js → chunk-r2bxjna3.js} +2 -2
- package/dist/chunk-rjv6885r.js +2 -0
- package/dist/chunk-rm5gbthk.js +2 -0
- package/dist/{chunk-6vgr5g6d.js → chunk-rzd9hyhv.js} +2 -2
- package/dist/{chunk-8tk8yf91.js → chunk-s7fhpkvf.js} +6 -6
- package/dist/{chunk-ew5cey88.js → chunk-saqzk45g.js} +1 -1
- package/dist/chunk-sgengtap.js +2 -0
- package/dist/{chunk-srgnevws.js → chunk-stn7p7f1.js} +2 -2
- package/dist/{chunk-wa3z5c8j.js → chunk-szp7ajfm.js} +4 -4
- package/dist/chunk-ts37jw3s.js +2 -0
- package/dist/{chunk-xakypz4t.js → chunk-ttjscvre.js} +3 -3
- package/dist/{chunk-cqhwzd9y.js → chunk-v0tdg16k.js} +5 -5
- package/dist/chunk-v4emesnw.js +2 -0
- package/dist/{chunk-bast33qy.js → chunk-vnkvnenn.js} +6 -6
- package/dist/{chunk-ymdw4fhd.js → chunk-vnrbjbrw.js} +2 -2
- package/dist/chunk-vxra53wq.js +2 -0
- package/dist/{chunk-w5nw8e2p.js → chunk-w8k9fz1w.js} +7 -7
- package/dist/{chunk-m131znxe.js → chunk-wm029dh0.js} +13 -13
- package/dist/{chunk-hhbt8grm.js → chunk-wp0qpa50.js} +4 -4
- package/dist/{chunk-01c16zw4.js → chunk-wzvdr4ta.js} +2 -2
- package/dist/{chunk-e2t7mk29.js → chunk-x2ftkaz3.js} +2 -2
- package/dist/{chunk-atpscb2m.js → chunk-x4jzhgdm.js} +2 -2
- package/dist/chunk-x76qvq1n.js +2 -0
- package/dist/chunk-x85z6dmw.js +2 -0
- package/dist/chunk-xkfe03y9.js +2 -0
- package/dist/{chunk-v37zmez0.js → chunk-xmws1gaf.js} +2 -2
- package/dist/{chunk-a8164hnf.js → chunk-xtaq95em.js} +1 -1
- package/dist/{chunk-5a0d3048.js → chunk-y2e2zm6y.js} +3 -3
- package/dist/chunk-y4hn1qh0.js +2 -0
- package/dist/{chunk-pywz8q4k.js → chunk-y75bds1g.js} +31 -31
- package/dist/chunk-yc8ggeh2.js +2 -0
- package/dist/{chunk-r0v2chpn.js → chunk-ydppkb8y.js} +2 -2
- package/dist/chunk-yfed67yc.js +2 -0
- package/dist/{chunk-7ayvybdy.js → chunk-ysfgabpf.js} +3 -3
- package/dist/{chunk-fd1bpv35.js → chunk-yxdhz4ps.js} +2 -2
- package/dist/{chunk-rw5492e2.js → chunk-zc8a2erc.js} +4 -4
- package/dist/chunk-zgds9nwv.js +1609 -0
- package/dist/{chunk-7cvbz4eq.js → chunk-zn6n075d.js} +3 -3
- package/dist/cli.js +22 -22
- package/dist/component-library.d.ts +31 -1
- package/dist/component-library.js +74 -54
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/inherited-context.d.ts +14 -0
- package/dist/inherited-context.js +102 -0
- package/dist/native-component-context.d.ts +10 -0
- package/dist/native-component-context.js +95 -0
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +12 -12
- package/dist/stx-virtual-ts.d.ts +14 -2
- package/dist/stx-virtual-ts.js +64 -34
- package/dist/typecheck.d.ts +5 -2
- package/dist/typecheck.js +29 -19
- package/package.json +5 -5
- package/dist/chunk-09jz09k9.js +0 -20
- package/dist/chunk-10h8v5d4.js +0 -2
- package/dist/chunk-19dsn6tp.js +0 -2
- package/dist/chunk-26vxgd2w.js +0 -2
- package/dist/chunk-277dpq3b.js +0 -2
- package/dist/chunk-2asyyky3.js +0 -2
- package/dist/chunk-2r9s38f6.js +0 -2
- package/dist/chunk-2xhwadvn.js +0 -2
- package/dist/chunk-46pxmpeb.js +0 -3
- package/dist/chunk-4es07dwb.js +0 -2
- package/dist/chunk-4pr29yrx.js +0 -2
- package/dist/chunk-4v70bs2q.js +0 -2
- package/dist/chunk-4ygesqbx.js +0 -2
- package/dist/chunk-54jx5hqh.js +0 -2
- package/dist/chunk-5nj2k8zf.js +0 -2
- package/dist/chunk-6pczzq5f.js +0 -2
- package/dist/chunk-73k579v7.js +0 -2
- package/dist/chunk-7c9pzpsw.js +0 -2
- package/dist/chunk-7etvn4dx.js +0 -2
- package/dist/chunk-7wqevtks.js +0 -2
- package/dist/chunk-93538x9s.js +0 -2
- package/dist/chunk-9fyw1xkh.js +0 -3
- package/dist/chunk-9waxasf6.js +0 -712
- package/dist/chunk-a5qxcz86.js +0 -4
- package/dist/chunk-asrzmw7w.js +0 -2
- package/dist/chunk-awmfyb3t.js +0 -2
- package/dist/chunk-ba91r7q9.js +0 -2
- package/dist/chunk-cvgbtmxp.js +0 -2
- package/dist/chunk-d0h18m2r.js +0 -2
- package/dist/chunk-d5zh2663.js +0 -2
- package/dist/chunk-djdganvr.js +0 -2
- package/dist/chunk-dmcmxf3a.js +0 -2
- package/dist/chunk-eczy00w6.js +0 -2
- package/dist/chunk-esb34a1r.js +0 -20
- package/dist/chunk-f4wezqh4.js +0 -2
- package/dist/chunk-f52b9hjv.js +0 -2
- package/dist/chunk-f8pp58kw.js +0 -2
- package/dist/chunk-g3tfct27.js +0 -2
- package/dist/chunk-g9m84nqk.js +0 -2
- package/dist/chunk-gc4bgven.js +0 -2
- package/dist/chunk-gvh45ddc.js +0 -2
- package/dist/chunk-gvz0kqkz.js +0 -2
- package/dist/chunk-h2qgqjkn.js +0 -2
- package/dist/chunk-hcaedzck.js +0 -2
- package/dist/chunk-j4zrq17p.js +0 -2
- package/dist/chunk-kz0txvqb.js +0 -2
- package/dist/chunk-m9cperj4.js +0 -2
- package/dist/chunk-me7cxs0e.js +0 -2
- package/dist/chunk-meqsd5bt.js +0 -2
- package/dist/chunk-p2kqsb5k.js +0 -2
- package/dist/chunk-pvrgv5cx.js +0 -2051
- package/dist/chunk-rqa92xm4.js +0 -2
- package/dist/chunk-s54e61xt.js +0 -2
- package/dist/chunk-s92j8k4z.js +0 -2
- package/dist/chunk-sw8ms82g.js +0 -2
- package/dist/chunk-swfvh1cz.js +0 -3
- package/dist/chunk-tp2ftck2.js +0 -2
- package/dist/chunk-vd679g2w.js +0 -2
- package/dist/chunk-vk98r75z.js +0 -2
- package/dist/chunk-vmq773pb.js +0 -2
- package/dist/chunk-vv65gsys.js +0 -2
- package/dist/chunk-w6ry02z8.js +0 -2
- package/dist/chunk-w8qr5414.js +0 -2
- package/dist/chunk-xjxcwrqs.js +0 -2
- package/dist/chunk-xye2mkbh.js +0 -2
- package/dist/chunk-ytzzth34.js +0 -2
- package/dist/chunk-yxpjj003.js +0 -2
- package/dist/chunk-z6c4c951.js +0 -2
- package/dist/chunk-z9xe3xkg.js +0 -12
- package/dist/chunk-zmfqx1b1.js +0 -2
- package/dist/chunk-zze8tw0h.js +0 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{
|
|
2
|
+
import{qc,s,xe}from"./chunk-5gx403te.js";import{ct}from"./chunk-75v0yxeh.js";import{l}from"./chunk-np8wgbsa.js";import o from"fs";import u from"path";var rg=new Map,m=new Map;async function ny(e){let n;for(let i=0;i<3;i++)try{let g=(await o.promises.stat(e)).mtime.getTime(),a=m.get(e);if(a&&a.mtime===g)return a.content;let h=await Bun.file(e).text(),w=(await o.promises.stat(e)).mtime.getTime();if(w!==g)continue;return m.set(e,{content:h,mtime:w}),h}catch(r){n=r;break}throw m.delete(e),Error(`File not found: ${e}${n?` (${n.message})`:""}`)}function ry(e){m.delete(e)}function sy(e){for(let t of m.keys())if(t.startsWith(e))m.delete(t)}var f=null,B=null,x=null;function oy(e){x=e}async function sg(e=!1){let t=x??await import("./chunk-6q9a5bph.js");if(e)return t.generateSignalsRuntimeDev();if(f===null)f=t.generateSignalsRuntime();return f}var S=null;async function og(){if(S===null){let{getRouterScript:e}=await import("./chunk-027meh1k.js");S=e()}return S}var y={};async function iy(e,t=!1){let n=e==="runtime"?await sg(t):await og(),i=e==="runtime"&&t?"runtime-debug":e,r=y[i];if(!r||r.content!==n)r={content:n,hash:Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)},y[i]=r;return{content:n,hash:r.hash,url:`/_stx/${e}.${r.hash}.js`}}var E=500,T=33554432,c=new Map,p=0;function C(e){return l(process.cwd(),"module-bundles",`${e}.js`)}function ay(e){let t=Bun.hash(e).toString(16).padStart(16,"0").slice(0,16),n=c.get(t),i=n!==void 0;if(i)c.delete(t),p-=n.length*2;c.set(t,e),p+=e.length*2;while(c.size>1&&(c.size>E||p>T)){let r=c.keys().next().value;p-=c.get(r).length*2,c.delete(r)}if(!i)try{let r=C(t);if(!o.existsSync(r))o.mkdirSync(u.dirname(r),{recursive:!0}),o.writeFileSync(r,e)}catch{}return`/_stx/modules.${t}.js`}function ii(e){if(!/^[0-9a-f]{16}$/.test(e))return;let t=c.get(e);if(t!==void 0)return t;try{return o.readFileSync(C(e),"utf8")}catch{return}}function cy(){m.clear(),xe(),qc(),f=null,B=null,S=null}function v(e){let t={debug:e.debug===!0,middleware:(e.middleware??[]).map((n)=>({name:n.name,timing:n.timing,handler:String(n.handler)})),customDirectives:(e.customDirectives??[]).map((n)=>({name:n.name,hasEndTag:n.hasEndTag===!0,rawParams:n.rawParams===!0,handler:String(n.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(t)).digest("hex")}async function yr(e,t){try{if(!t.cachePath)return null;let n=u.resolve(t.cachePath),i=u.join(n,`${Ts(e)}.html`),r=u.join(n,`${Ts(e)}.meta.json`);if(!await s(i)||!await s(r))return null;let g=await Bun.file(r).text(),a=JSON.parse(g);if(a.cacheVersion!==t.cacheVersion)return null;if(a.engine!==ct())return null;if(a.optionsSignature!==v(t))return null;if((await o.promises.stat(e)).mtime.getTime()>a.mtime)return null;for(let d of a.dependencies)if(await s(d)){if((await o.promises.stat(d)).mtime.getTime()>a.mtime)return null}else return null;return await Bun.file(i).text()}catch(n){return console.warn(`Cache error for ${e}:`,n),null}}async function br(e,t,n,i){try{if(!i.cachePath)return;let r=u.resolve(i.cachePath);await o.promises.mkdir(r,{recursive:!0});let g=u.join(r,`${Ts(e)}.html`),a=u.join(r,`${Ts(e)}.meta.json`),h=await o.promises.stat(e);await Bun.write(g,t);let d={sourcePath:e,mtime:h.mtime.getTime(),dependencies:Array.from(n),cacheVersion:i.cacheVersion,engine:ct(),optionsSignature:v(i),generatedAt:Date.now()};await Bun.write(a,JSON.stringify(d,null,2)),rg.set(e,{output:t,mtime:h.mtime.getTime(),dependencies:n})}catch(r){console.warn(`Failed to cache template ${e}:`,r)}}var _=16;function Ts(e){return new Bun.CryptoHasher("sha1").update(e).digest("hex").substring(0,_)}
|
|
3
|
+
export{rg,ny,ry,sy,oy,sg,og,iy,ay,ii,cy,yr,br,Ts};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{St,Jn,Ph}from"./chunk-wm029dh0.js";import{ye,Yn,Ih,Zn,Po,rs,ss,Oh,Nh,Dh,Qn,er,Io,os,Mh}from"./chunk-x2ftkaz3.js";import"./chunk-fdjx4vs3.js";export{Po as batch,Ph as default,Yn as derived,Zn as effect,St as generateSignalsRuntime,Jn as generateSignalsRuntimeDev,er as isDerived,Qn as isSignal,Ih as memo,ss as onDestroy,rs as onMount,os as peek,Dh as pendingLifecycleCounts,Nh as runDestroyCallbacks,Oh as runMountCallbacks,ye as state,Io as untrack,Mh as useOptimistic};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import n from"fs";import a from"path";import{fileURLToPath as s}from"url";var i;function
|
|
3
|
-
export{
|
|
2
|
+
import n from"fs";import a from"path";import{fileURLToPath as s}from"url";var i;function ct(){if(i)return i;let t="unknown";try{t=String(JSON.parse(n.readFileSync(new URL("../package.json",import.meta.url),"utf8")).version)}catch{}if(import.meta.url.endsWith(".ts"))try{let o=a.dirname(s(import.meta.url)),e=0;for(let r of n.readdirSync(o,{recursive:!0,withFileTypes:!0}))if(r.isFile()&&r.name.endsWith(".ts"))e=Math.max(e,n.statSync(a.join(r.parentPath,r.name)).mtimeMs);t+=`+src.${Math.trunc(e)}`}catch{}return i=t,t}
|
|
3
|
+
export{ct};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{as,cs}from"./chunk-y75bds1g.js";import{w}from"./chunk-5gx403te.js";import{a}from"./chunk-ctjxcaxq.js";import{Qe,ue}from"./chunk-f4vgagjb.js";import{uc}from"./chunk-df6vjs3p.js";import{V}from"./chunk-bjjfr7qt.js";import{b}from"./chunk-94mpe1ny.js";import{f}from"./chunk-yxdhz4ps.js";import{existsSync as z,mkdirSync as C,copyFileSync as I,chmodSync as B,rmSync as xe}from"fs";import{join as c,basename as ye,resolve as K}from"path";import{spawn as _}from"child_process";import{platform as Se}from"os";function O(e,r,i){let n=new RegExp(`</${r}\\s*>`,"iy"),s=w(e,(t,o)=>(n.lastIndex=o,n.exec(t)?n.lastIndex:-1))[0];return s?e.slice(0,s.start)+i+e.slice(s.start):null}var Au=`
|
|
3
3
|
<script>
|
|
4
4
|
(function() {
|
|
5
5
|
'use strict';
|
|
@@ -468,9 +468,9 @@ else if (data.type === 'event' && data.method) {
|
|
|
468
468
|
}
|
|
469
469
|
})();
|
|
470
470
|
</script>
|
|
471
|
-
`;function
|
|
471
|
+
`;function Ma(e={}){let{debug:r=!1,timeout:i=30000}=e;return Au.replace("debug: false,",`debug: ${r},`).replace("timeout: 30000",`timeout: ${i}`)}function jh(){return!1}function Bh(e,r={}){let i=/@craft(?:\(([\s\S]*?)\))?/g;return e.replace(i,(n,s)=>{let t={};if(s)try{t=JSON.parse(s.replace(/'/g,'"'))}catch{try{t=Function(`return ${s}`)()}catch{console.warn(`[stx] Invalid @craft config: ${s}`)}}return Ma(t)})}function La(e,r={}){if(e.includes("__craftBridgeInitialized"))return e;let i=Ma(r),n=O(e,"head",`${i}
|
|
472
472
|
`);if(n!==null)return n;let s=V(e);if(s){let t=s.index+s.tag.length;return e.slice(0,t)+`
|
|
473
|
-
${i}`+e.slice(t)}return i+e}var
|
|
473
|
+
${i}`+e.slice(t)}return i+e}var No={button:{nativeType:"craft-button",fallbackTag:"button",fallbackClasses:"craft-button",nativeProps:["variant","size","disabled","loading"]},"text-input":{nativeType:"craft-text-input",fallbackTag:"input",fallbackClasses:"craft-text-input",nativeProps:["placeholder","value","type","disabled","readonly"]},textarea:{nativeType:"craft-textarea",fallbackTag:"textarea",fallbackClasses:"craft-textarea",nativeProps:["placeholder","value","rows","disabled","readonly"]},checkbox:{nativeType:"craft-checkbox",fallbackTag:"input",fallbackClasses:"craft-checkbox",nativeProps:["checked","disabled","label"],render:(e,r)=>{let i=e.checked?"checked":"",n=e.disabled?"disabled":"";return`<label class="craft-checkbox-wrapper">
|
|
474
474
|
<input type="checkbox" class="craft-checkbox" ${i} ${n}>
|
|
475
475
|
<span class="craft-checkbox-label">${r||e.label||""}</span>
|
|
476
476
|
</label>`}},radio:{nativeType:"craft-radio",fallbackTag:"input",fallbackClasses:"craft-radio",nativeProps:["checked","disabled","name","value","label"]},select:{nativeType:"craft-select",fallbackTag:"select",fallbackClasses:"craft-select",nativeProps:["value","disabled","options","placeholder"]},slider:{nativeType:"craft-slider",fallbackTag:"input",fallbackClasses:"craft-slider",nativeProps:["value","min","max","step","disabled"],render:(e,r)=>{let i=e.min??0,n=e.max??100,s=e.step??1,t=e.value??50,o=e.disabled?"disabled":"";return`<input type="range" class="craft-slider" min="${i}" max="${n}" step="${s}" value="${t}" ${o}>`}},label:{nativeType:"craft-label",fallbackTag:"span",fallbackClasses:"craft-label",nativeProps:["text","for"]},badge:{nativeType:"craft-badge",fallbackTag:"span",fallbackClasses:"craft-badge",nativeProps:["variant","size"]},avatar:{nativeType:"craft-avatar",fallbackTag:"div",fallbackClasses:"craft-avatar",nativeProps:["src","alt","size","fallback"],render:(e,r)=>{let i=e.size||40,n=e.src,s=String(e.alt||""),t=e.fallback||(s?s.charAt(0).toUpperCase():"?");if(n)return`<img class="craft-avatar" src="${n}" alt="${s}" style="width:${i}px;height:${i}px;border-radius:50%">`;return`<div class="craft-avatar craft-avatar-fallback" style="width:${i}px;height:${i}px;border-radius:50%;display:flex;align-items:center;justify-content:center">${t}</div>`}},progress:{nativeType:"craft-progress",fallbackTag:"div",fallbackClasses:"craft-progress",nativeProps:["value","max","variant"],render:(e,r)=>{let i=Number(e.value)||0,n=Number(e.max)||100;return`<div class="craft-progress"><div class="craft-progress-bar" style="width:${Math.min(100,Math.max(0,i/n*100))}%"></div></div>`}},spinner:{nativeType:"craft-spinner",fallbackTag:"div",fallbackClasses:"craft-spinner",nativeProps:["size"],render:(e,r)=>{let i=e.size||24;return`<div class="craft-spinner" style="width:${i}px;height:${i}px"></div>`}},card:{nativeType:"craft-card",fallbackTag:"div",fallbackClasses:"craft-card",nativeProps:["title","subtitle","variant"]},modal:{nativeType:"craft-modal",fallbackTag:"dialog",fallbackClasses:"craft-modal",nativeProps:["open","title","closable","size"],render:(e,r)=>{let i=e.open?"open":"",n=e.title||"";return`<dialog class="craft-modal" ${i}>
|
|
@@ -484,7 +484,7 @@ ${i}`+e.slice(t)}return i+e}var Ao={button:{nativeType:"craft-button",fallbackTa
|
|
|
484
484
|
</details>`}},divider:{nativeType:"craft-divider",fallbackTag:"hr",fallbackClasses:"craft-divider",nativeProps:["orientation","variant"]},table:{nativeType:"craft-table",fallbackTag:"table",fallbackClasses:"craft-table",nativeProps:["columns","rows","sortable","selectable"]},list:{nativeType:"craft-list",fallbackTag:"ul",fallbackClasses:"craft-list",nativeProps:["items","selectable"]},tree:{nativeType:"craft-tree",fallbackTag:"div",fallbackClasses:"craft-tree",nativeProps:["nodes","expandable","selectable"]},alert:{nativeType:"craft-alert",fallbackTag:"div",fallbackClasses:"craft-alert",nativeProps:["variant","title","dismissible"],render:(e,r)=>{let i=e.variant||"info",n=e.title||"";return`<div class="craft-alert craft-alert-${i}" role="alert">
|
|
485
485
|
${n?`<div class="craft-alert-title">${n}</div>`:""}
|
|
486
486
|
<div class="craft-alert-content">${r}</div>
|
|
487
|
-
</div>`}},toast:{nativeType:"craft-toast",fallbackTag:"div",fallbackClasses:"craft-toast",nativeProps:["variant","duration","position"]},tooltip:{nativeType:"craft-tooltip",fallbackTag:"span",fallbackClasses:"craft-tooltip",nativeProps:["content","position"],render:(e,r)=>{let i=e.content||"",n=e.position||"top";return`<span class="craft-tooltip" data-tooltip="${i}" data-position="${n}">${r}</span>`}},menu:{nativeType:"craft-menu",fallbackTag:"nav",fallbackClasses:"craft-menu",nativeProps:["items","orientation"]},breadcrumb:{nativeType:"craft-breadcrumb",fallbackTag:"nav",fallbackClasses:"craft-breadcrumb",nativeProps:["items","separator"]},sidebar:{nativeType:"craft-sidebar",fallbackTag:"aside",fallbackClasses:"craft-sidebar craft-sidebar-tahoe",nativeProps:["id","variant","material","backgroundEffect","allowsVibrancy","materialOpacity","materialDarkOpacity","minWidth","maxWidth","canCollapse","searchPlaceholder","selectedItem","sections","spaces","selectedSpace"],render:re},"sidebar-space":{nativeType:"craft-sidebar-space",fallbackTag:"section",fallbackClasses:"craft-sidebar-space",nativeProps:["id","label","icon","tint"],render:ae},"sidebar-section":{nativeType:"craft-sidebar-section",fallbackTag:"section",fallbackClasses:"craft-sidebar-section",nativeProps:["id","title","header"],render:ie},"sidebar-item":{nativeType:"craft-sidebar-item",fallbackTag:"button",fallbackClasses:"craft-sidebar-item",nativeProps:["id","label","icon","badge","tintColor"],render:ne},pagination:{nativeType:"craft-pagination",fallbackTag:"nav",fallbackClasses:"craft-pagination",nativeProps:["total","page","pageSize"]},"code-editor":{nativeType:"craft-code-editor",fallbackTag:"textarea",fallbackClasses:"craft-code-editor",nativeProps:["value","language","theme","readonly","lineNumbers"]},"file-browser":{nativeType:"craft-file-browser",fallbackTag:"div",fallbackClasses:"craft-file-browser",nativeProps:["path","showHidden","selectable"]},"color-picker":{nativeType:"craft-color-picker",fallbackTag:"input",fallbackClasses:"craft-color-picker",nativeProps:["value","format"],render:(e,r)=>`<input type="color" class="craft-color-picker" value="${e.value||"#000000"}">`},"date-picker":{nativeType:"craft-date-picker",fallbackTag:"input",fallbackClasses:"craft-date-picker",nativeProps:["value","min","max","format"],render:(e,r)=>{let i=e.value||"",n=e.min||"",s=e.max||"";return`<input type="date" class="craft-date-picker" value="${i}" min="${n}" max="${s}">`}},"time-picker":{nativeType:"craft-time-picker",fallbackTag:"input",fallbackClasses:"craft-time-picker",nativeProps:["value","min","max","step"],render:(e,r)=>`<input type="time" class="craft-time-picker" value="${e.value||""}">`}},
|
|
487
|
+
</div>`}},toast:{nativeType:"craft-toast",fallbackTag:"div",fallbackClasses:"craft-toast",nativeProps:["variant","duration","position"]},tooltip:{nativeType:"craft-tooltip",fallbackTag:"span",fallbackClasses:"craft-tooltip",nativeProps:["content","position"],render:(e,r)=>{let i=e.content||"",n=e.position||"top";return`<span class="craft-tooltip" data-tooltip="${i}" data-position="${n}">${r}</span>`}},menu:{nativeType:"craft-menu",fallbackTag:"nav",fallbackClasses:"craft-menu",nativeProps:["items","orientation"]},breadcrumb:{nativeType:"craft-breadcrumb",fallbackTag:"nav",fallbackClasses:"craft-breadcrumb",nativeProps:["items","separator"]},sidebar:{nativeType:"craft-sidebar",fallbackTag:"aside",fallbackClasses:"craft-sidebar craft-sidebar-tahoe",nativeProps:["id","variant","material","backgroundEffect","allowsVibrancy","materialOpacity","materialDarkOpacity","minWidth","maxWidth","canCollapse","searchPlaceholder","selectedItem","sections","spaces","selectedSpace"],render:re},"sidebar-space":{nativeType:"craft-sidebar-space",fallbackTag:"section",fallbackClasses:"craft-sidebar-space",nativeProps:["id","label","icon","tint"],render:ae},"sidebar-section":{nativeType:"craft-sidebar-section",fallbackTag:"section",fallbackClasses:"craft-sidebar-section",nativeProps:["id","title","header"],render:ie},"sidebar-item":{nativeType:"craft-sidebar-item",fallbackTag:"button",fallbackClasses:"craft-sidebar-item",nativeProps:["id","label","icon","badge","tintColor"],render:ne},pagination:{nativeType:"craft-pagination",fallbackTag:"nav",fallbackClasses:"craft-pagination",nativeProps:["total","page","pageSize"]},"code-editor":{nativeType:"craft-code-editor",fallbackTag:"textarea",fallbackClasses:"craft-code-editor",nativeProps:["value","language","theme","readonly","lineNumbers"]},"file-browser":{nativeType:"craft-file-browser",fallbackTag:"div",fallbackClasses:"craft-file-browser",nativeProps:["path","showHidden","selectable"]},"color-picker":{nativeType:"craft-color-picker",fallbackTag:"input",fallbackClasses:"craft-color-picker",nativeProps:["value","format"],render:(e,r)=>`<input type="color" class="craft-color-picker" value="${e.value||"#000000"}">`},"date-picker":{nativeType:"craft-date-picker",fallbackTag:"input",fallbackClasses:"craft-date-picker",nativeProps:["value","min","max","format"],render:(e,r)=>{let i=e.value||"",n=e.min||"",s=e.max||"";return`<input type="date" class="craft-date-picker" value="${i}" min="${n}" max="${s}">`}},"time-picker":{nativeType:"craft-time-picker",fallbackTag:"input",fallbackClasses:"craft-time-picker",nativeProps:["value","min","max","step"],render:(e,r)=>`<input type="time" class="craft-time-picker" value="${e.value||""}">`}},is=`
|
|
488
488
|
<style id="craft-component-styles">
|
|
489
489
|
/* Craft Component Base Styles */
|
|
490
490
|
.craft-button {
|
|
@@ -902,7 +902,7 @@ ${i}`+e.slice(t)}return i+e}var Ao={button:{nativeType:"craft-button",fallbackTa
|
|
|
902
902
|
}
|
|
903
903
|
}
|
|
904
904
|
</style>
|
|
905
|
-
`,
|
|
905
|
+
`,ja=`
|
|
906
906
|
<script id="craft-component-runtime">
|
|
907
907
|
(function() {
|
|
908
908
|
if (window.__stxCraftComponentRuntime) return;
|
|
@@ -1006,9 +1006,9 @@ ${i}`+e.slice(t)}return i+e}var Ao={button:{nativeType:"craft-button",fallbackTa
|
|
|
1006
1006
|
document.addEventListener('craft:nativeui:ready', initializeCraftComponents);
|
|
1007
1007
|
})();
|
|
1008
1008
|
</script>
|
|
1009
|
-
`;function
|
|
1010
|
-
`)??
|
|
1011
|
-
`)??e+
|
|
1009
|
+
`;function Ba(e,r={}){let{classPrefix:i="craft"}=r;if(!e.includes("craft-component-styles"))e=O(e,"head",`${is}
|
|
1010
|
+
`)??is+e;if(!e.includes("craft-component-runtime"))e=O(e,"body",`${ja}
|
|
1011
|
+
`)??e+ja;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(n,s,t)=>N("sidebar",s,t.trim(),r,i)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(n,s)=>N("sidebar",s,"",r,i)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(n,s,t)=>N(s,t,"",r,i)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(n,s,t,o)=>N(s,t,o.trim(),r,i)),e}function N(e,r,i,n,s){let t=n.components?.[e]||No[e];if(!t)return console.warn(`[stx] Unknown Craft component: @craft-${e}`),`<div class="${s}-unknown" data-component="${e}">${i}</div>`;let o=F(r),d=[t.fallbackClasses||`${s}-${e}`];if(o.class)d.push(o.class),delete o.class;if(t.render)return o.__fallbackClasses=d.join(" "),t.render(o,i);let p=be(o,t,d);if(["input","hr","br","img"].includes(t.fallbackTag))return`<${t.fallbackTag} ${p}>`;return`<${t.fallbackTag} ${p}>${i}</${t.fallbackTag}>`}function F(e){let r={},i=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,n;while((n=i.exec(e))!==null){let[s,t,o,d]=n,p=o??d;if(s.startsWith(":"))r[t]=p;else if(s.startsWith("@"))r[`on${t.charAt(0).toUpperCase()}${t.slice(1)}`]=p;else if(p===void 0)r[t]=!0;else r[t]=p}return r}function re(e,r){let i=R(String(e.id||`craft-sidebar-${fe(r||JSON.stringify(e))}`)),n=ce(e.spaces)||oe(r),s=n.length?[]:le(e.sections)||j(r),t=String(e.selectedSpace||n[0]?.id||""),o=n.find((y)=>y.id===t)||n[0],d=String(e.selectedItem||e.selected||(n.length?o?.sections[0]?.items[0]?.id:s[0]?.items[0]?.id)||""),p={id:i,variant:String(e.variant||"desktop"),material:String(e.material||"sidebar"),backgroundEffect:String(e.backgroundEffect||"shimmer"),allowsVibrancy:e.allowsVibrancy!==!1&&e.allowsVibrancy!=="false",materialOpacity:Number(e.materialOpacity??0.68),materialDarkOpacity:e.materialDarkOpacity===void 0?void 0:Number(e.materialDarkOpacity),minWidth:e.minWidth===void 0?240:Number(e.minWidth),maxWidth:e.maxWidth===void 0?340:Number(e.maxWidth),canCollapse:e.canCollapse!==!1&&e.canCollapse!=="false",searchPlaceholder:e.searchPlaceholder?String(e.searchPlaceholder):void 0,selectedItem:d,sections:s,spaces:n,selectedSpace:t||void 0},u=String(e.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),l=Number(e.width||e.sidebarWidth||286),g=e.native===!1||e.native==="false"?"false":"true",m=p.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${P(p.searchPlaceholder)}"></div>`:"",h;if(n.length)h=de(n,t,d);else if(s.length)h=s.map((y)=>L(y,d)).join("");else h=r;return`<aside class="${S(u)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${S(i)}" data-native="${g}" style="--craft-sidebar-width:${l}px">
|
|
1012
1012
|
${m}
|
|
1013
1013
|
${h}
|
|
1014
1014
|
</aside>
|
|
@@ -1029,7 +1029,7 @@ ${i}`+e.slice(t)}return i+e}var Ao={button:{nativeType:"craft-button",fallbackTa
|
|
|
1029
1029
|
${e.icon?`<span class="craft-sidebar-item-icon" data-icon="${S(e.icon)}"${i}></span>`:""}
|
|
1030
1030
|
<span class="craft-sidebar-item-label">${P(e.label)}</span>
|
|
1031
1031
|
${e.badge?`<span class="craft-sidebar-item-badge">${P(e.badge)}</span>`:""}
|
|
1032
|
-
</button>`}function R(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function fe(e){let r=5381;for(let i=0;i<e.length;i++)r=r*33^e.charCodeAt(i);return(r>>>0).toString(36)}function P(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function S(e){return P(e).replace(/`/g,"`")}function pe(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function be(e,r,i){let n=[];n.push(`class="${i.join(" ")}"`),n.push(`data-craft="${r.nativeType}"`);for(let[s,t]of Object.entries(e))if(t===!0)n.push(s);else if(t!==!1&&t!==void 0&&t!==null){let o=String(t).replace(/"/g,""");n.push(`${s}="${o}"`)}return n.join(" ")}function
|
|
1032
|
+
</button>`}function R(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function fe(e){let r=5381;for(let i=0;i<e.length;i++)r=r*33^e.charCodeAt(i);return(r>>>0).toString(36)}function P(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function S(e){return P(e).replace(/`/g,"`")}function pe(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function be(e,r,i){let n=[];n.push(`class="${i.join(" ")}"`),n.push(`data-craft="${r.nativeType}"`);for(let[s,t]of Object.entries(e))if(t===!0)n.push(s);else if(t!==!1&&t!==void 0&&t!==null){let o=String(t).replace(/"/g,""");n.push(`${s}="${o}"`)}return n.join(" ")}function Fh(e,r){No[e]=r}function zh(){return{...No}}import{chmodSync as ge,copyFileSync as me,mkdtempSync as J,rmSync as we,writeFileSync as W}from"fs";import{tmpdir as Q}from"os";import{join as D}from"path";function he(e){let r=Bun.spawnSync(["/usr/bin/plutil","-extract","Entitlements","xml1","-o","-","-"],{stdin:e});if(r.exitCode!==0)throw Error(`Could not extract the macOS profile entitlements: ${r.stderr.toString().trim()||r.stdout.toString().trim()}`);let i=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-","-"],{stdin:r.stdout});if(i.exitCode!==0)throw Error(`Could not convert the macOS profile entitlements: ${i.stderr.toString().trim()||i.stdout.toString().trim()}`);let n=JSON.parse(i.stdout.toString());if(!n||typeof n!=="object"||Array.isArray(n))throw Error("The macOS profile entitlements must be a dictionary.");return n}function ve(e,r){let i=D(r,"Contents","embedded.provisionprofile");me(e,i),ge(i,420)}async function Y(e,r=[],i={}){if(process.platform!=="darwin")return;let n=i.entitlements,s;try{if(i.provisioningProfile){if(!i.identity||i.identity==="-")throw Error("A provisioning profile requires a signing identity.");let u=Bun.spawnSync(["/usr/bin/security","cms","-D","-i",i.provisioningProfile]);if(u.exitCode!==0)throw Error("Could not decode the macOS provisioning profile.");let l=he(u.stdout),g={};if(i.entitlements){let m=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-",i.entitlements]);if(m.exitCode!==0)throw Error("Could not read the app entitlements plist.");g=JSON.parse(m.stdout.toString())}for(let m of["com.apple.application-identifier","com.apple.developer.team-identifier"])if(l[m])g[m]=l[m];if(s=J(D(Q(),"stx-entitlements-")),n=D(s,"entitlements.plist"),W(n,JSON.stringify(g)),Bun.spawnSync(["/usr/bin/plutil","-convert","xml1",n]).exitCode!==0)throw Error("Could not generate the provisioned app entitlements.");ve(i.provisioningProfile,e)}let t;if(r.length){let u=!1;if(n){let l=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-",n]);if(l.exitCode!==0)throw Error("Could not read native parent entitlements.");u=JSON.parse(l.stdout.toString())["com.apple.security.app-sandbox"]===!0}if(s??=J(D(Q(),"stx-entitlements-")),t=D(s,"helper.entitlements.plist"),W(t,JSON.stringify({"com.apple.security.cs.allow-jit":!0,...u?{"com.apple.security.app-sandbox":!0,"com.apple.security.inherit":!0}:{}})),Bun.spawnSync(["/usr/bin/plutil","-convert","xml1",t]).exitCode!==0)throw Error("Could not generate native helper entitlements.")}for(let u of[...r,e]){let l=i.hardenedRuntime?["--options","runtime"]:[];if(u===e&&n)l.push("--entitlements",n);if(u!==e&&t)l.push("--entitlements",t);let g=i.identity&&i.identity!=="-"?"--timestamp":"--timestamp=none",m=Bun.spawn(["/usr/bin/codesign","--force","--sign",i.identity||"-",g,...l,u],{stdout:"pipe",stderr:"pipe"}),[h,y]=await Promise.all([new Response(m.stderr).text(),m.exited]);if(y!==0)throw Error(`Could not sign native bundle ${u}: ${h.trim()}`)}let o=Bun.spawn(["/usr/bin/codesign","--verify","--strict",e],{stdout:"pipe",stderr:"pipe"}),[d,p]=await Promise.all([new Response(o.stderr).text(),o.exited]);if(p!==0)throw Error(`Invalid native bundle signature: ${d.trim()}`)}finally{if(s)we(s,{recursive:!0,force:!0})}}var G=(e)=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");function X(e){let r=new Set,i=(n,s,t)=>{if(typeof n==="string")return`${s}<string>${G(n)}</string>`;if(typeof n==="boolean")return`${s}<${n}/>`;if(typeof n==="number"){if(!Number.isFinite(n))throw TypeError(`Non-finite Info.plist number at ${t}`);let o=Number.isSafeInteger(n)?"integer":"real";return`${s}<${o}>${n}</${o}>`}if(n!==null&&typeof n==="object"){let o=Array.isArray(n);if(!o&&Object.getPrototypeOf(n)!==Object.prototype&&Object.getPrototypeOf(n)!==null)throw TypeError(`Unsupported Info.plist value at ${t}`);if(r.has(n))throw TypeError(`Cyclic Info.plist value at ${t}`);r.add(n);try{let d=o?"array":"dict",p=`${s} `,u=o?Array.from(n,(l,g)=>i(l,p,`${t}[${g}]`)):Object.entries(n).map(([l,g])=>`${p}<key>${G(l)}</key>
|
|
1033
1033
|
${i(g,p,`${t}.${l}`)}`);return u.length?`${s}<${d}>
|
|
1034
1034
|
${u.join(`
|
|
1035
1035
|
`)}
|
|
@@ -1038,7 +1038,7 @@ ${s}</${d}>`:`${s}<${d}/>`}finally{r.delete(n)}}throw TypeError(`Unsupported Inf
|
|
|
1038
1038
|
<plist version="1.0">
|
|
1039
1039
|
${i(e,"","infoPlist")}
|
|
1040
1040
|
</plist>
|
|
1041
|
-
`}async function
|
|
1041
|
+
`}async function Fa(e){if(e.window?.cornerRadius!==void 0&&(!Number.isFinite(e.window.cornerRadius)||e.window.cornerRadius<0||e.window.cornerRadius>128))throw Error("Native window cornerRadius must be between 0 and 128");let r=Date.now();try{if(!await Bun.file(e.input).exists())return{success:!1,target:e.target||q(),format:e.format||"app",error:`Input file not found: ${e.input}`};let i=e.target||q(),n=e.format||Re(i);if(e.backend&&i!=="macos")throw Error("Native backend bundles currently support macOS only.");if(e.backend&&!z(K(e.backend.entry)))throw Error(`Native backend not found: ${e.backend.entry}`);let s=e.output||c(process.cwd(),"dist","native");if(!z(s))C(s,{recursive:!0});let t=await a(process.cwd()),o=await uc(e.input,{context:e.context,options:{...t,isDev:!1},injectCSS:!0});if(o=La(o,{debug:e.verbose}),o=Ba(o),!o.includes("craft-component-styles")){if(o.includes("</head>"))o=f(o,is)}let d=e.name||ye(e.input,".stx"),p=e.version||"1.0.0",u=e.craftPath||za(e.runtimeProfile);if(!u)return{success:!1,target:i,format:n,error:"Craft native binary not found on PATH. Run pantry install craft, or specify craftPath for framework development."};if(e.runtimeProfile==="webview"){if(i!=="macos")throw Error("The webview runtime profile is currently available on macOS only.");let g=Bun.spawnSync([u,"--runtime-profile"],{stdout:"pipe",stderr:"pipe",timeout:1e4});if(g.exitCode!==0||g.stdout.toString().trim()!=="webview")throw Error("The requested Craft webview runtime is unavailable. Upgrade Craft with Pantry before building.")}if(u=as(e.craftPath,e.runtimeProfile),e.verbose)console.log(`\uD83D\uDCE6 Building native app for ${i}...`),console.log(` Input: ${e.input}`),console.log(` Output: ${s}`),console.log(` Craft: ${u}`);let l;switch(i){case"macos":l=await Ce(o,d,p,s,n,e,u);break;case"windows":l=await Te(o,d,p,s,n,e,u);break;case"linux":l=await Pe(o,d,p,s,n,e,u);break;case"ios":l=await Ie(o,d,p,s,e,u);break;case"android":l=await Be(o,d,p,s,e,u);break;default:l={success:!1,target:i,format:n,error:`Unsupported target: ${i}`}}return l.duration=Date.now()-r,l}catch(i){return{success:!1,target:e.target||q(),format:e.format||"app",error:i.message,duration:Date.now()-r}}}async function Ce(e,r,i,n,s,t,o){let d=t.bundleId||`com.stx.${r.toLowerCase().replace(/[^a-z0-9]/g,"")}`,p=c(n,`${r}.app`),u=c(p,"Contents"),l=c(u,"MacOS"),g=c(u,"Resources");xe(p,{recursive:!0,force:!0}),C(l,{recursive:!0}),C(g,{recursive:!0});let m=c(g,"index.html");await Bun.write(m,e);let h="";if(t.sidebar?.enabled&&t.sidebar?.config)h=c(g,"sidebar-config.json"),await Bun.write(h,JSON.stringify(t.sidebar.config));let y=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",T=t.menubarOnly??t.systemTray,x=t.bundleStyle||(await $e(o)?"executable":"launcher");if(t.backend){if(!await ke(o))throw Error("This Craft runtime does not support bundled backends. Upgrade Craft before building this app.");I(o,c(l,r)),B(c(l,r),493);let k=Qe("native-backend");try{let v=c(k,"launcher.ts"),M=c(import.meta.dir,"native-backend"+(import.meta.path.endsWith(".ts")?".ts":".js"));await Bun.write(v,`import { runNativeBackend } from ${JSON.stringify(M)}
|
|
1042
1042
|
import * as backend from ${JSON.stringify(K(t.backend.entry))}
|
|
1043
1043
|
await runNativeBackend({ html: ${JSON.stringify(e)}, fetch: backend.default, shutdown: Reflect.get(backend, "shutdown"),
|
|
1044
1044
|
maxRequestBodySize: ${t.backend.maxRequestBodySize??33554432} })
|
|
@@ -1075,7 +1075,7 @@ Name=${r}
|
|
|
1075
1075
|
Exec=${g}
|
|
1076
1076
|
Terminal=false
|
|
1077
1077
|
Categories=Utility;
|
|
1078
|
-
`;if(await Bun.write(c(d,`${r.toLowerCase()}.desktop`),m),s==="deb"){let h=c(n,`${r.toLowerCase()}_${i}_amd64.deb`),y=await De(d,h,r,i,t);if(!y.success)return{success:!1,target:"linux",format:"deb",error:y.error};return{success:!0,target:"linux",format:"deb",outputPath:h}}if(s==="appimage"){let h=c(n,`${r}-${i}-x86_64.AppImage`),y=await qe(d,h,r,t);if(!y.success)return{success:!1,target:"linux",format:"appimage",error:y.error};return{success:!0,target:"linux",format:"appimage",outputPath:h}}return{success:!0,target:"linux",format:"app",outputPath:d}}async function Ie(e,r,i,n,s,t){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${r}' to create an iOS project.`}}async function Be(e,r,i,n,s,t){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${r}' to create an Android project.`}}function
|
|
1078
|
+
`;if(await Bun.write(c(d,`${r.toLowerCase()}.desktop`),m),s==="deb"){let h=c(n,`${r.toLowerCase()}_${i}_amd64.deb`),y=await De(d,h,r,i,t);if(!y.success)return{success:!1,target:"linux",format:"deb",error:y.error};return{success:!0,target:"linux",format:"deb",outputPath:h}}if(s==="appimage"){let h=c(n,`${r}-${i}-x86_64.AppImage`),y=await qe(d,h,r,t);if(!y.success)return{success:!1,target:"linux",format:"appimage",error:y.error};return{success:!0,target:"linux",format:"appimage",outputPath:h}}return{success:!0,target:"linux",format:"app",outputPath:d}}async function Ie(e,r,i,n,s,t){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${r}' to create an iOS project.`}}async function Be(e,r,i,n,s,t){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${r}' to create an Android project.`}}function za(e="full"){let r=process.env.CRAFT_BIN;if(r){if(!z(r))throw Error(`CRAFT_BIN points to a missing file: ${r}`);return r}return Bun.which(e==="webview"?"craft-webview":"craft",{PATH:process.env.PATH??"",cwd:process.cwd()})}function q(){switch(Se()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function Re(e){switch(e){case"macos":return"app";case"windows":return"zip";case"linux":return"appimage";case"ios":return"ipa";case"android":return"apk";default:return"app"}}async function Ee(e,r,i){return cs({appBundlePath:e,outputPath:r,volumeName:i})}async function Oe(e,r){return new Promise((i)=>{let n=_("zip",["-r",r,"."],{cwd:e});n.on("close",(s)=>{if(s===0)i({success:!0});else i({success:!1,error:`zip exited with code ${s}`})}),n.on("error",(s)=>{i({success:!1,error:s.message})})})}async function De(e,r,i,n,s){return new Promise((t)=>{let o=Qe("deb");try{let d=c(o,"pkg"),p=c(d,"DEBIAN"),u=c(d,"usr","bin"),l=c(d,"usr","share","applications"),g=c(d,"usr","share",i.toLowerCase());C(p,{recursive:!0}),C(u,{recursive:!0}),C(l,{recursive:!0}),C(g,{recursive:!0});let m=b("fs").readdirSync(e);for(let x of m)I(c(e,x),c(g,x));let h=`#!/bin/bash
|
|
1079
1079
|
exec /usr/share/${i.toLowerCase()}/${i.toLowerCase()} "$@"`;b("fs").writeFileSync(c(u,i.toLowerCase()),h),B(c(u,i.toLowerCase()),493);let y=`Package: ${i.toLowerCase()}
|
|
1080
1080
|
Version: ${n}
|
|
1081
1081
|
Section: utils
|
|
@@ -1084,7 +1084,7 @@ Architecture: amd64
|
|
|
1084
1084
|
Depends: libgtk-3-0, libwebkit2gtk-4.0-37
|
|
1085
1085
|
Maintainer: ${s.author||"Unknown"}
|
|
1086
1086
|
Description: ${s.description||i}
|
|
1087
|
-
`;b("fs").writeFileSync(c(p,"control"),y);let T=_("dpkg-deb",["--build",d,r]);T.on("close",(x)=>{if(ue(o),x===0)t({success:!0});else t({success:!1,error:`dpkg-deb exited with code ${x}`})}),T.on("error",(x)=>{ue(o),t({success:!1,error:x.message})})}catch(d){ue(o),t({success:!1,error:d.message})}})}async function qe(e,r,i,n){return new Promise((s)=>{let t=
|
|
1087
|
+
`;b("fs").writeFileSync(c(p,"control"),y);let T=_("dpkg-deb",["--build",d,r]);T.on("close",(x)=>{if(ue(o),x===0)t({success:!0});else t({success:!1,error:`dpkg-deb exited with code ${x}`})}),T.on("error",(x)=>{ue(o),t({success:!1,error:x.message})})}catch(d){ue(o),t({success:!1,error:d.message})}})}async function qe(e,r,i,n){return new Promise((s)=>{let t=Qe("appimage");try{let o=c(t,`${i}.AppDir`),d=c(o,"usr"),p=c(d,"bin"),u=c(d,"share");C(p,{recursive:!0}),C(u,{recursive:!0});let l=c(u,i.toLowerCase());C(l,{recursive:!0});let g=b("fs").readdirSync(e);for(let x of g)I(c(e,x),c(l,x));let m=`#!/bin/bash
|
|
1088
1088
|
SELF=$(readlink -f "$0")
|
|
1089
1089
|
HERE=\${SELF%/*}
|
|
1090
1090
|
export PATH="\${HERE}/usr/bin:\${PATH}"
|
|
@@ -1096,5 +1096,5 @@ Exec=${i.toLowerCase()}
|
|
|
1096
1096
|
Terminal=false
|
|
1097
1097
|
Categories=Utility;
|
|
1098
1098
|
Icon=${i.toLowerCase()}
|
|
1099
|
-
`;b("fs").writeFileSync(c(o,`${i.toLowerCase()}.desktop`),h);let y=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(b("fs").writeFileSync(c(o,`${i.toLowerCase()}.png`),y),n.icon&&z(n.icon))I(n.icon,c(o,`${i.toLowerCase()}.png`));let T=_("appimagetool",[o,r],{env:{...process.env,ARCH:"x86_64"}});T.on("close",(x)=>{if(ue(t),x===0)B(r,493),s({success:!0});else s({success:!1,error:`appimagetool exited with code ${x}. Install from https://appimage.github.io/appimagetool/`})}),T.on("error",(x)=>{ue(t),s({success:!1,error:`appimagetool not found: ${x.message}`})})}catch(o){ue(t),s({success:!1,error:o.message})}})}function
|
|
1100
|
-
export{
|
|
1099
|
+
`;b("fs").writeFileSync(c(o,`${i.toLowerCase()}.desktop`),h);let y=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(b("fs").writeFileSync(c(o,`${i.toLowerCase()}.png`),y),n.icon&&z(n.icon))I(n.icon,c(o,`${i.toLowerCase()}.png`));let T=_("appimagetool",[o,r],{env:{...process.env,ARCH:"x86_64"}});T.on("close",(x)=>{if(ue(t),x===0)B(r,493),s({success:!0});else s({success:!1,error:`appimagetool exited with code ${x}. Install from https://appimage.github.io/appimagetool/`})}),T.on("error",(x)=>{ue(t),s({success:!1,error:`appimagetool not found: ${x.message}`})})}catch(o){ue(t),s({success:!1,error:o.message})}})}function Ha(){return[q()]}function Va(e){switch(e){case"macos":return["app","dmg","pkg"];case"windows":return["app","zip","msi"];case"linux":return["app","deb","rpm","appimage"];case"ios":return["ipa"];case"android":return["apk"];default:return["app"]}}var Ae={buildNative:Fa,getAvailableTargets:Ha,getAvailableFormats:Va,detectPlatform:q},Hh=Ae;
|
|
1100
|
+
export{Au,Ma,jh,Bh,La,No,is,ja,Ba,Fh,zh,Fa,za,Ha,Va,Hh};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{fn,zo,Ho,Vo,Wh,Uo}from"./chunk-cvbwxskc.js";import"./chunk-zc8a2erc.js";import"./chunk-wp0qpa50.js";import"./chunk-kzc2tqzr.js";export{Ho as buildServerApi,Wh as createServerApi,fn as discoverServerApi,zo as generateApiTypes,Uo as isServerApiSource,Vo as productionApiDispatcher};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{gm}from"./chunk-h17pfbng.js";import"./chunk-1a237qky.js";import"./chunk-nn6hvsxp.js";import"./chunk-cvbwxskc.js";import"./chunk-11dwmcpy.js";import"./chunk-w8k9fz1w.js";import"./chunk-ctjxcaxq.js";import"./chunk-ttjscvre.js";import"./chunk-r09kz9bf.js";import"./chunk-zc8a2erc.js";import"./chunk-0sa9gqmc.js";import"./chunk-wp0qpa50.js";import"./chunk-5gx403te.js";import"./chunk-x4jzhgdm.js";import"./chunk-kzc2tqzr.js";import"./chunk-pp99rmjm.js";import"./chunk-3w7gacva.js";import"./chunk-fdjx4vs3.js";export{gm as startProductionServer};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{qf,vc,qh,xc,Kf,Gf,mn,pr,Kh,Xf,Jf,Gh,x}from"./chunk-dv56x3g8.js";import"./chunk-6kp4mg3h.js";import"./chunk-5gx403te.js";import"./chunk-x4jzhgdm.js";import"./chunk-kzc2tqzr.js";import"./chunk-pp99rmjm.js";import"./chunk-3w7gacva.js";import"./chunk-fdjx4vs3.js";export{mn as buildCss,Xf as extractClassNames,Gf as fingerprintConfig,Jf as generateCss,Kh as getCachedCSS,qf as getCssServeAsset,x as injectCss,vc as loadCssEngine,xc as loadCssEngineConfig,pr as rebuildCss,qh as resetCssCache,Kf as resolveUserCssConfig,Gh as withLinkedModuleBundles};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import S from"fs";import _ from"path";function
|
|
2
|
+
import S from"fs";import _ from"path";function vo(e){let{token:t,baseUrl:i="https://api.netlify.com/api/v1"}=e;async function s(n,r,l={}){let p=`${i}${r}`,f={Authorization:`Bearer ${t}`,"User-Agent":"stx-deploy/1.0"},u;if(l.rawBody)f["Content-Type"]=l.contentType||"application/octet-stream",u=l.rawBody;else if(l.body)f["Content-Type"]="application/json",u=JSON.stringify(l.body);let o=await fetch(p,{method:n,headers:f,body:u});if(!o.ok){let g=Error(`Netlify API error: ${o.status} ${o.statusText}`);g.status=o.status;try{let b=await o.json();g.message=b.message||g.message,g.code=b.code,g.details=b}catch{}throw g}let a=await o.text();if(!a)return{};return JSON.parse(a)}return{async getSite(n){return s("GET",`/sites/${n}`)},async listSites(){return s("GET","/sites")},async createSite(n){let r={};if(n)r.name=n;return s("POST","/sites",{body:r})},async createDeploy(n,r){let l={files:r.files,draft:r.draft??!0,async:r.async??!0};if(r.title)l.title=r.title;if(r.branch)l.branch=r.branch;if(r.functions)l.functions=r.functions;return s("POST",`/sites/${n}/deploys`,{body:l})},async uploadFile(n,r,l){let p=r.startsWith("/")?r.slice(1):r;await s("PUT",`/deploys/${n}/files/${p}`,{rawBody:l,contentType:"application/octet-stream"})},async uploadFiles(n,r){let p=[...r],f=async()=>{while(p.length>0){let o=p.shift();if(o)await this.uploadFile(n,o.path,o.content)}},u=Array.from({length:Math.min(5,r.length)},()=>f());await Promise.all(u)},async getDeploy(n){return s("GET",`/deploys/${n}`)},async waitForDeploy(n,r={}){let{timeout:l=300000,pollInterval:p=2000,onProgress:f}=r,u=Date.now();while(!0){let o=await this.getDeploy(n);if(f)f(o);if(o.state==="ready")return o;if(o.state==="error"){let a=Error(`Deploy failed: ${o.error_message||"Unknown error"}`);throw a.status=500,a.details=o,a}if(Date.now()-u>l){let a=Error(`Deploy timed out after ${l}ms`);throw a.status=408,a.details=o,a}await new Promise((a)=>setTimeout(a,p))}},async lockDeploy(n){return s("POST",`/deploys/${n}/lock`)},async unlockDeploy(n){return s("POST",`/deploys/${n}/unlock`)}}}async function ha(e){let t=await crypto.subtle.digest("SHA-1",e);return Array.from(new Uint8Array(t)).map((s)=>s.toString(16).padStart(2,"0")).join("")}async function Yr(e,t={}){let{ignore:i=["node_modules",".git",".env*","*.map"]}=t,s=[],n=new Bun.Glob("**/*");for await(let r of n.scan({cwd:e,onlyFiles:!0,dot:!1})){if(i.some((a)=>{if(a.includes("*"))return new RegExp(`^${a.replace(/\*/g,".*")}$`).test(r);return r.includes(a)}))continue;let p=`${e}/${r}`,u=await Bun.file(p).arrayBuffer(),o=await ha(u);s.push({path:r,content:new Uint8Array(u),sha1:o})}return s}function xo(e){let t={};for(let i of e)t[`/${i.path}`]=i.sha1;return t}function So(e,t){let i=new Set(t.map((s)=>s.startsWith("/")?s.slice(1):s));return e.filter((s)=>i.has(s.path))}function Ln(e){if(e<1024)return`${e} B`;if(e<1048576)return`${(e/1024).toFixed(1)} KB`;if(e<1073741824)return`${(e/1048576).toFixed(1)} MB`;return`${(e/1073741824).toFixed(1)} GB`}function Qt(e){return e.reduce((t,i)=>t+i.content.byteLength,0)}import m from"fs";import y from"path";function ya(e){let t=[];if(t.push("[build]"),t.push(` command = "${d(e.build.command)}"`),t.push(` publish = "${d(e.build.publish)}"`),e.build.functions)t.push(` functions = "${d(e.build.functions)}"`);if(e.build.edge_functions)t.push(` edge_functions = "${d(e.build.edge_functions)}"`);if(e.build.environment&&Object.keys(e.build.environment).length>0){t.push(""),t.push("[build.environment]");for(let[i,s]of Object.entries(e.build.environment))t.push(` ${i} = "${d(s)}"`)}if(e.functions){if(t.push(""),t.push("[functions]"),e.functions.directory)t.push(` directory = "${d(e.functions.directory)}"`);if(e.functions.node_bundler)t.push(` node_bundler = "${e.functions.node_bundler}"`);if(e.functions.external_node_modules&&e.functions.external_node_modules.length>0)t.push(` external_node_modules = [${e.functions.external_node_modules.map((i)=>`"${i}"`).join(", ")}]`)}if(e.edge_functions&&e.edge_functions.length>0){t.push("");for(let i of e.edge_functions)t.push("[[edge_functions]]"),t.push(` function = "${d(i.function)}"`),t.push(` path = "${d(i.path)}"`)}if(e.redirects&&e.redirects.length>0){t.push("");for(let i of e.redirects){if(t.push("[[redirects]]"),t.push(` from = "${d(i.from)}"`),t.push(` to = "${d(i.to)}"`),i.status!==void 0)t.push(` status = ${i.status}`);if(i.force!==void 0)t.push(` force = ${i.force}`);if(i.conditions&&Object.keys(i.conditions).length>0){t.push(" [redirects.conditions]");for(let[s,n]of Object.entries(i.conditions))t.push(` ${s} = "${d(n)}"`)}}}if(e.headers&&e.headers.length>0){t.push("");for(let i of e.headers){t.push("[[headers]]"),t.push(` for = "${d(i.for)}"`),t.push(" [headers.values]");for(let[s,n]of Object.entries(i.values))t.push(` ${s} = "${d(n)}"`)}}if(e.plugins&&e.plugins.length>0){t.push("");for(let i of e.plugins)if(t.push("[[plugins]]"),t.push(` package = "${d(i.package)}"`),i.inputs&&Object.keys(i.inputs).length>0){t.push(" [plugins.inputs]");for(let[s,n]of Object.entries(i.inputs))if(typeof n==="string")t.push(` ${s} = "${d(n)}"`);else if(typeof n==="boolean"||typeof n==="number")t.push(` ${s} = ${n}`)}}if(e.context&&Object.keys(e.context).length>0)for(let[i,s]of Object.entries(e.context)){if(t.push(""),t.push(`[context.${i}]`),s.command)t.push(` command = "${d(s.command)}"`);if(s.publish)t.push(` publish = "${d(s.publish)}"`);if(s.environment&&Object.keys(s.environment).length>0){t.push(` [context.${i}.environment]`);for(let[n,r]of Object.entries(s.environment))t.push(` ${n} = "${d(r)}"`)}}return t.join(`
|
|
3
3
|
`)+`
|
|
4
|
-
`}function d(e){return e.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}async function
|
|
4
|
+
`}function d(e){return e.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}async function Zr(e){let t={framework:"stx",buildCommand:"bun run build",outputDir:"dist"},i=y.join(e,"package.json");if(await Bun.file(i).exists())try{let u=JSON.parse(await Bun.file(i).text());if(u.scripts?.build)t.buildCommand="bun run build";let o={...u.dependencies,...u.devDependencies};if(o["@stacksjs/stx"]||o.stx)t.framework="stx"}catch{}let s=y.join(e,"stx.config.ts"),n=y.join(e,".config","stx.config.ts");if(await Bun.file(s).exists()||await Bun.file(n).exists())t.framework="stx";let r=["dist","build","out","public",".output"];for(let u of r){let o=y.join(e,u);if(m.existsSync(o)&&m.statSync(o).isDirectory()){t.outputDir=u;break}}let l=["functions","netlify/functions","api"];for(let u of l){let o=y.join(e,u);if(m.existsSync(o)&&m.statSync(o).isDirectory()){t.functionsDir=u;break}}let p=y.join(e,"netlify","edge-functions");if(m.existsSync(p))t.edgeFunctionsDir="netlify/edge-functions";let f=y.join(e,t.outputDir||"dist");if(m.existsSync(f)){let u=m.existsSync(y.join(f,"index.html")),o=m.readdirSync(f).filter((a)=>a.endsWith(".html"));t.isSPA=u&&o.length===1}return t}function Qr(e={}){let t={build:{command:e.buildCommand||"bun run build",publish:e.outputDir||"dist"}};if(e.functionsDir)t.build.functions=e.functionsDir,t.functions={directory:e.functionsDir,node_bundler:"esbuild"};if(e.edgeFunctionsDir)t.build.edge_functions=e.edgeFunctionsDir;if(t.headers=[{for:"/*",values:{"X-Frame-Options":"DENY","X-Content-Type-Options":"nosniff","X-XSS-Protection":"1; mode=block","Referrer-Policy":"strict-origin-when-cross-origin"}},{for:"/assets/*",values:{"Cache-Control":"public, max-age=31536000, immutable"}}],e.isSPA!==!1)t.redirects=[{from:"/*",to:"/index.html",status:200}];return t.context={production:{environment:{NODE_ENV:"production"}},"deploy-preview":{environment:{NODE_ENV:"development"}}},t}async function ko(e,t){let i=await Zr(e),s=t||Qr(i),n=ya(s),r=y.join(e,"netlify.toml");return await Bun.write(r,n),r}function _o(e){return m.existsSync(y.join(e,"netlify.toml"))}async function mm(e={}){let t=Date.now(),i=[],s=e.cwd||process.cwd(),n=(c)=>{i.push(c)},r=(c)=>{if(e.onProgress)e.onProgress(c)},l=_.resolve(s,e.directory||"dist"),p=e.token||process.env.NETLIFY_AUTH_TOKEN,f=e.siteId||process.env.NETLIFY_SITE_ID;if(!p)throw new bt(`No Netlify auth token found.
|
|
5
5
|
|
|
6
6
|
To deploy to Netlify:
|
|
7
7
|
1. Create account at https://app.netlify.com
|
|
@@ -19,12 +19,12 @@ Find your site ID at: https://app.netlify.com/sites/YOUR_SITE/settings/general`,
|
|
|
19
19
|
|
|
20
20
|
Run \`stx build\` first or specify a different directory with --directory`,"NO_BUILD_DIR");if(!(S.readdirSync(l).length>0))throw new bt(`Build directory is empty: ${l}
|
|
21
21
|
|
|
22
|
-
Run \`stx build\` to generate files`,"EMPTY_BUILD_DIR");if(e.dryRun){r({stage:"collect",message:"Collecting files..."});let c=await
|
|
22
|
+
Run \`stx build\` to generate files`,"EMPTY_BUILD_DIR");if(e.dryRun){r({stage:"collect",message:"Collecting files..."});let c=await Yr(l),w=Qt(c);return n(`Would deploy ${c.length} files (${Ln(w)})`),n(`From: ${l}`),n(`To: Site ${f}`),n(`Mode: ${e.production?"production":"draft"}`),{success:!0,url:`https://${f}.netlify.app (dry-run)`,deployId:"dry-run",logs:i,duration:Date.now()-t,filesUploaded:c.length,totalSize:w}}let o=vo({token:p});r({stage:"collect",message:"Verifying site..."});try{let c=await o.getSite(f);n(`Deploying to: ${c.name} (${c.url})`)}catch(c){if(c.status===404)throw new bt(`Site not found: ${f}
|
|
23
23
|
|
|
24
|
-
Check your site ID or create a new site at https://app.netlify.com`,"SITE_NOT_FOUND");throw c}r({stage:"collect",message:"Collecting files..."});let a=await
|
|
24
|
+
Check your site ID or create a new site at https://app.netlify.com`,"SITE_NOT_FOUND");throw c}r({stage:"collect",message:"Collecting files..."});let a=await Yr(l),g=Qt(a);if(n(`Found ${a.length} files (${Ln(g)})`),a.length===0)throw new bt(`No files found in ${l}`,"NO_FILES");let b=xo(a);r({stage:"upload",message:"Creating deploy...",percent:0});let D=await o.createDeploy(f,{title:e.message||"Deploy from stx CLI",draft:!e.production,files:b});n(`Created deploy: ${D.id}`);let h=So(a,D.required||[]);if(n(`Uploading ${h.length} files...`),h.length>0){let c=0,w=Qt(h);for(let x of h){await o.uploadFile(D.id,x.path,x.content),c++;let C=Math.round(c/h.length*100);r({stage:"upload",message:`Uploading: ${x.path}`,percent:C,details:{uploaded:c,total:h.length}})}n(`Uploaded ${Ln(w)}`)}else n("All files already on CDN (no upload needed)");r({stage:"process",message:"Processing deploy..."});let N=await o.waitForDeploy(D.id,{onProgress:(c)=>{r({stage:"process",message:`Status: ${c.state}`,details:c})}}),P=Date.now()-t;if(r({stage:"done",message:"Deploy complete!"}),n(`Deploy complete in ${(P/1000).toFixed(1)}s`),n(`URL: ${N.deploy_ssl_url}`),e.production)n(`Site: ${N.ssl_url}`);if(e.open){let c=e.production?N.ssl_url:N.deploy_ssl_url;I(c)}return{success:!0,url:N.deploy_ssl_url,siteUrl:e.production?N.ssl_url:void 0,deployId:N.id,logs:i,duration:P,filesUploaded:h.length,totalSize:Qt(h)}}async function hm(e={}){let t=e.directory||process.cwd(),i;if(_o(t))i=_.join(t,"netlify.toml");else{let s=await Zr(t);i=await ko(t,Qr(s))}if(e.siteId){let s=_.join(t,".env.local"),n="";if(await Bun.file(s).exists()){if(n=await Bun.file(s).text(),n=n.split(`
|
|
25
25
|
`).filter((r)=>!r.startsWith("NETLIFY_SITE_ID=")).join(`
|
|
26
26
|
`),n&&!n.endsWith(`
|
|
27
27
|
`))n+=`
|
|
28
28
|
`}n+=`NETLIFY_SITE_ID=${e.siteId}
|
|
29
29
|
`,await Bun.write(s,n)}return{configPath:i,siteId:e.siteId}}class bt extends Error{code;constructor(e,t){super(e);this.name="DeployError",this.code=t}}function I(e){let t=process.platform,i=t==="darwin"?"open":t==="win32"?"start":"xdg-open";Bun.spawn([i,e],{stdio:["ignore","ignore","ignore"]})}
|
|
30
|
-
export{
|
|
30
|
+
export{vo,ha,Yr,xo,So,Ln,Qt,ya,Zr,Qr,ko,_o,mm,hm,bt};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{cr,De}from"./chunk-mce3g2wb.js";import{K,S,Er,Us,T}from"./chunk-5gx403te.js";import{a,M}from"./chunk-ctjxcaxq.js";import{Uo}from"./chunk-cvbwxskc.js";import{ct}from"./chunk-75v0yxeh.js";import{l}from"./chunk-np8wgbsa.js";import{n,se}from"./chunk-jqtpzzz4.js";import d from"path";import j from"fs";import{AsyncLocalStorage as ot}from"async_hooks";import{randomUUID as bt}from"crypto";var $t=11;function J(t,e,s){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(d.basename(t))||Uo(t,e,s)}var at=2;function Lf(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?d.resolve(e):l(t,"bundle-cache")}function nt(t,e){let s=t;for(let i of wt(e))if(i!==d.sep)s=s.split(i).join("\x00root");return s}var st=new Map;function wt(t){let e=d.resolve(t),s=st.get(e);if(!s){let i=e;try{i=j.realpathSync(e)}catch{}s=[...new Set([e,i])].sort((c,p)=>p.length-c.length),st.set(e,s)}return s}function St(t,e){try{let s=j.statSync(t),i=d.resolve(e),c=t.startsWith(`${i}${d.sep}`);return{path:c?d.relative(i,t):t,...c?{inRoot:!0}:{},mtimeMs:s.mtimeMs,size:s.size,hash:Bun.hash(j.readFileSync(t)).toString(36)}}catch{return null}}function lt(t,e){return t.inRoot?d.join(d.resolve(e),t.path):t.path}function vt(t,e){for(let s of t){let i=lt(s,e);try{let c=j.statSync(i);if(c.size!==s.size)return!1;if(c.mtimeMs!==s.mtimeMs&&Bun.hash(j.readFileSync(i)).toString(36)!==s.hash)return!1}catch{return!1}}return!0}var ut=new Map,Bt=100;function jf(t=process.env){let e=Number(t.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(e)&&e>=1?Math.floor(e):2000}var G=new Map;async function jt(t){let e=G.get(t)??0;if(e>0&&e<Bt){G.set(t,e+1);return}G.set(t,1);try{let s=(await j.promises.readdir(t)).filter((o)=>o.endsWith(".js")),i=jf();if(s.length<=i)return;let p=(await Promise.all(s.map(async(o)=>{try{return{name:o,at:(await j.promises.stat(d.join(t,o))).mtimeMs}}catch{return null}}))).filter((o)=>o!==null);p.sort((o,b)=>b.at-o.at);for(let o of p.slice(i)){let b=o.name.slice(0,-3);await j.promises.rm(d.join(t,`${b}.js`),{force:!0}),await j.promises.rm(d.join(t,`${b}.deps.json`),{force:!0})}N("pruned bundle cache to",i,"entries")}catch{}}function ke(t){return ut.get(t)??[]}function q(t,e){if(t)ut.set(t,e)}function Bf(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function N(...t){if(Bf())console.log("[stx:bundler]",...t)}var Y=[];function mc(t,e,s){Y.push({filePath:t||"<inline>",message:e,details:s})}function cn(){return Y.slice()}function ln(){Y.length=0}var Z;function Vh(t){Z=t}function hc(){if(Z)return Z;try{let t=M.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Q=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function un(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,s;while((s=e.exec(t))!==null){let c=s[1];if(!Q.some((o)=>o.test(c)))return N("detected user import:",c),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((s=i.exec(t))!==null){let c=s[1];if(/\.css(?:\?.*)?$/.test(c))continue;if(!Q.some((o)=>o.test(c)))return N("detected side-effect import:",c),!0}return!1}var ar="stx-module:",Et=/\.(?:[cm]?[jt]sx?|json)$/i;function Ff(t,e){return d.relative(t,e).split(d.sep).join("/")}function zf(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(s,i,c,p)=>{let o=e.get(p);return o&&!p.startsWith(ar)?`${i}${c}${o}${c}`:s})}function Hf(t,e){let s=0,i=(p)=>{let o=`__stxMod${s++}`,b=JSON.stringify(p);return e.push(`var ${o} = globalThis.__stxModules && globalThis.__stxModules[${b}];`,`if (${o} === undefined) throw new Error("[stx] module " + ${JSON.stringify(b)} + " is not registered on this page (#1957)");`),o},c=(p,o)=>{for(let b of p.split(",")){let C=b.trim();if(!C)continue;let R=C.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!R)continue;let w=R[1].startsWith('"')?JSON.parse(R[1]):R[1],f=R[2]??w;e.push(`var ${f} = ${o}[${JSON.stringify(w)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,o,b)=>{let C=b.slice(ar.length),R=i(C),w=o.trim(),f=w.match(/^([\w$]+)\s*(?:,\s*|$)/);if(f&&!w.startsWith("{")&&!w.startsWith("*"))e.push(`var ${f[1]} = ${R}.default;`),w=w.slice(f[0].length).trim();let v=w.match(/^\*\s*as\s+([\w$]+)$/);if(v)e.push(`var ${v[1]} = ${R};`);else if(w.startsWith("{"))c(w.replace(/^\{|\}$/g,""),R);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,o)=>(i(o.slice(ar.length)),"")),t}function rt(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,d.join(t,"index.ts"),d.join(t,"index.tsx"),d.join(t,"index.js"),d.join(t,"index.mjs")];for(let s of e)try{if(j.existsSync(s)&&j.statSync(s,{throwIfNoEntry:!1})?.isFile())return s}catch{}return}var X=new ot;function ps(t,e){let s=new Bun.CryptoHasher("md5");for(let[i,c]of[...t].sort(([p],[o])=>p<o?-1:p>o?1:0))s.update(`${i}\x00${c}\x00`);return X.run({modules:t,key:s.digest("hex").slice(0,12)},e)}var dt=new ot;function Vf(t){return dt.run(!0,t)}function Uf(){return dt.getStore()===!0}function yc(t){if(!Uf())return;throw Error(`The client script of ${t} needs bundling, and it is being rendered inside a Bun.build loader, where Bun never finishes a second build. Make the page an entrypoint of the build (bun-plugin-stx renders entrypoints before the bundler starts), or render it once outside the build so its bundle is cached.`)}function dn(){return X.getStore()?.key??""}function pt(t,e,s,i,c,p,o=new Map,b,C,R){let w=new Map([[s,i],...R??[]]),f=(B)=>B!==void 0&&w.has(B),v=(B,r,u)=>{if(J(r,t,b))return null;if(!p||!f(B)||!Et.test(r))return null;try{if(!j.statSync(r,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}c.add(r);let E=`${ar}${Ff(process.cwd(),r)}`;return o.set(u,E),{path:E,external:!0}},y=(B,r)=>{let u=f(B)?e:d.dirname(B),E=d.resolve(u,r);return rt(E)??E};return{name:"stx-client-bundle",setup(B){if(B.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(r)=>({path:r.path,external:!0})),B.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(r)=>({path:r.path,external:!0})),B.onResolve({filter:/^\//},(r)=>{if(f(r.path))return{path:r.path};let u=rt(r.path);if(u){let E=v(r.importer,u,r.path);if(E)return E;if(!f(u))c.add(u);return{path:u}}return{path:r.path,external:!0}}),B.onResolve({filter:/^\.\.?\//},(r)=>{let u=y(r.importer,r.path),E=v(r.importer,u,r.path);if(E)return E;return c.add(u),{path:u}}),B.onResolve({filter:/^[@~]\//},(r)=>{let u=d.resolve(t,r.path.slice(2)),E=[u,`${u}.ts`,`${u}.tsx`,`${u}.js`,`${u}.mjs`,`${u}.jsx`,d.join(u,"index.ts"),d.join(u,"index.tsx"),d.join(u,"index.js"),d.join(u,"index.mjs")];for(let h of E)if(j.existsSync(h)&&j.statSync(h,{throwIfNoEntry:!1})?.isFile()){let D=v(r.importer,h,r.path);if(D)return D;return N(`resolved ${r.path[0]}/ import:`,r.path,"\u2192",h),c.add(h),{path:h}}return console.warn(`[stx:bundler] could not resolve ${r.path[0]}/ import:`,r.path),{path:u}}),p)B.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(r)=>{if(!f(r.importer))return;let u=`${ar}npm:${r.path}`;return o.set(r.path,u),{path:u,external:!0}});B.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(r)=>{if(w.has(r.path))return{contents:w.get(r.path),loader:"ts"};if(J(r.path,t,b))throw Error(`Server-only API source cannot be imported by a client script: ${r.path}`);let u=d.extname(r.path).toLowerCase(),E=u===".json"?"json":u===".tsx"?"tsx":u===".jsx"?"jsx":u===".ts"||u===".mts"||u===".cts"?"ts":"js";if(!f(r.path))c.add(r.path);let h=C?.get(r.path);if(h!==void 0)return{contents:h,loader:"js"};return{contents:j.readFileSync(r.path,"utf8"),loader:E}})}}}var H=new Map,z=S(64),it=Symbol.for("stx.client-bundle-build-queue");function Wf(t){let e=globalThis,i=(e[it]??Promise.resolve()).then(t,t);return e[it]=i.then(()=>{return},()=>{return}),i}async function pn(t,e,s={}){let i=s.projectRoot||process.cwd(),c=(await a(i)).serverApi,p=s.minify??!1,o=s.externalizeUserModules??!0,b=s.expose?.length?[...new Set(s.expose)].sort():void 0,C=s.cacheDir||Lf(i),R=X.getStore(),w=new Bun.CryptoHasher("md5");w.update(`${$t}\x00${ct()}\x00${JSON.stringify(c??!1)}\x00${o?"registry":"inline"}\x00${b?b.join(","):"*"}\x00${p?"minified":"readable"}\x00${R?.key??""}\x00${nt(t,i)}\x00${nt(e,i)}`);let f=w.digest("hex").slice(0,12),v=d.join(C,`${f}.js`),y=z.get(v);if(y){if(Us(y.files)&&y.files.every((h)=>!J(h.path,i,c))){N("memo hit:",f);let h=y.files.map((D)=>D.path);return q(e,h),s.collectInputs?.push(...h),y.code}z.delete(v),N("memo invalidated by dep change:",f)}let B=d.join(C,`${f}.deps.json`),r=Bun.file(v);if(await r.exists()){let h=Bun.file(B),D=!1,k=null;if(await h.exists())try{let O=JSON.parse(await h.text());if(O.metadataVersion===at&&Array.isArray(O.files)&&vt(O.files,i))k=Er(O.files.map((g)=>lt(g,i))),D=k.length===O.files.length&&!k.some((g)=>J(g.path,i,c))}catch{D=!1}if(D){if(N("cache hit:",f),k)q(e,k.map((U)=>U.path)),s.collectInputs?.push(...k.map((U)=>U.path));let O=await r.text(),g=new Date;if(j.promises.utimes(v,g,g).catch(()=>{}),k)z.set(v,{code:O,files:k});return O}N("cache invalidated by dep change:",f)}let u=H.get(f);if(u){let h=await u;if(s.collectInputs)s.collectInputs.push(...(z.get(v)?.files??[]).map((D)=>D.path));return h}yc(e);let E=Wf(()=>_t(t,e,{projectRoot:i,minify:p,cacheDir:C,hash:f,cachePath:v,depsPath:B,collectInputs:s.collectInputs,externalizeUserModules:o,serverApi:c,expose:b,throwOnFailure:s.throwOnFailure,substitutes:R?.modules}));H.set(f,E);try{return await E}finally{H.delete(f)}}function bc(t){return`${t}-${process.pid}-${bt()}`}async function Uh(t,e){let{projectRoot:s}=e,i=bc(new Bun.CryptoHasher("md5").update([...t.keys()].join("\x00")).digest("hex").slice(0,12)),c=d.join(l(s,"bundle-tmp"),"out",i);j.mkdirSync(c,{recursive:!0});let p=new Map,o=new Map,b=0;for(let[f,v]of t){let y=d.join(s,`.stx-split-${i}-${b++}.ts`);p.set(y,v),o.set(d.basename(y).replace(/\.ts$/,""),f)}let[C,R]=[...p][0],w=new Set;yc(e.filePath);try{let f=await Bun.build({entrypoints:[...p.keys()],outdir:c,target:"browser",format:"esm",splitting:!0,minify:!1,naming:{entry:"[name].js",chunk:"chunk-[hash].js"},plugins:[pt(s,d.dirname(e.filePath),C,R,w,!1,new Map,void 0,X.getStore()?.modules,p)],define:{"process.env.NODE_ENV":'"development"',...T()},root:s});if(!f.success)throw Error(f.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ")||"Unable to bundle the entries");let v={entries:new Map,chunks:new Map};for(let y of f.outputs){let B=d.basename(y.path);if(y.kind==="entry-point"){let r=o.get(B.replace(/\.js$/,""));if(r!==void 0)v.entries.set(r,await y.text())}else if(y.kind==="chunk")v.chunks.set(B.replace(/\.js$/,""),await y.text())}return e.collectInputs?.push(...w),v}finally{try{j.rmSync(c,{recursive:!0,force:!0})}catch{}}}async function _t(t,e,s){let{projectRoot:i,minify:c,cacheDir:p,hash:o,cachePath:b,depsPath:C,externalizeUserModules:R}=s,w=l(i,"bundle-tmp"),f=bc(o),v=d.join(i,`.stx-client-${f}.ts`),y=d.join(w,"out",f);j.mkdirSync(y,{recursive:!0});let B=d.dirname(e),r=new Set,u=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,E=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,h=n(t),{depths:D,balanced:k}=se(h),O=(F)=>!k||D[F]===0,g;while((g=u.exec(h))!==null){if(g[1])continue;if(!O(g.index))continue;if(g[2])g[2].split(",").forEach((F)=>{let m=Mt(F);if(m)r.add(m)});else if(g[3])r.add(g[3])}while((g=E.exec(h))!==null){if(g[1])continue;if(!O(g.index))continue;r.add(g[2])}let U=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=U.exec(h))!==null){if(!O(g.index))continue;let F=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(F&&Q.some((m)=>m.test(F)))continue;if(g[1])r.add(g[1]);if(g[2])r.add(g[2]);for(let m of(g[3]??"").split(",")){let _=m.trim();if(!_||/^type\s/.test(_))continue;let L=/\bas\s+(\w+)\s*$/.exec(_)?.[1]??/^\w+$/.exec(_)?.[0];if(L)r.add(L)}}for(let F of h.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let m of F[1].split(",")){let _=/\bas\s+(\w+)\s*$/.exec(m)?.[1]??/^\s*(\w+)\s*$/.exec(m)?.[1];if(_)r.delete(_)}let ft=r.size>0?`
|
|
3
|
+
export { ${[...r].join(", ")} }`:"";N("bundling:",o,"from:",d.basename(e));let tt=new Set,et=new Map;try{let F=await Bun.build({entrypoints:[v],outdir:y,target:"browser",format:"esm",minify:c?{whitespace:!1,identifiers:!0,syntax:!0}:!1,plugins:[pt(i,B,v,t+ft,tt,R,et,s.serverApi,s.substitutes)],define:{"process.env.NODE_ENV":c?'"production"':'"development"',...T()},root:i});if(!F.success){let I=F.logs.filter((A)=>A.level==="error").map((A)=>A.message).join(", ")||`Unable to bundle ${d.basename(e)}`,P=cr(F.logs,e||void 0);if(console.warn("[stx:bundler] build failed:",I),mc(e||"",I,P),s.throwOnFailure||hc()==="error")throw Error(I);return t}let m="";for(let x of F.outputs){m=await x.text();break}let _=[];for(let x of m.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let I of x[1].split(",")){let P=I.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(P){_.push([P[2],P[1]]);continue}let A=I.trim();if(/^[A-Za-z_$][\w$]*$/.test(A))_.push([A,A])}if(s.expose){let x=new Set(s.expose);for(let I=_.length-1;I>=0;I--)if(!x.has(_[I][0]))_.splice(I,1)}let L=[];m=Hf(zf(m,et),L);let mt=m.match(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm)||[];if(m=m.replace(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),c&&m)try{m=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(m)}catch{}let V=`__stxBundle_${o}`,gt=new Set(K(t,!0).split(",").map((x)=>x.trim())),ht=_.map(([x,I])=>`get ${JSON.stringify(x)}() { return ${I} }${gt.has(x)?`, set ${JSON.stringify(x)}(__stxValue_${I}) { ${I} = __stxValue_${I} }`:""}`).join(", "),xt=_.map(([x])=>`var ${x} = undefined;`).join(`
|
|
4
|
+
`),yt=_.map(([x])=>`${x} = ${V}[${JSON.stringify(x)}];`).join(`
|
|
5
|
+
`);if(m=`${mt.join(`
|
|
6
|
+
`)}
|
|
7
|
+
${xt}
|
|
8
|
+
var ${V} = (function() {
|
|
9
|
+
${L.join(`
|
|
10
|
+
`)}
|
|
11
|
+
${m}
|
|
12
|
+
return { ${ht} };
|
|
13
|
+
})();
|
|
14
|
+
${yt}
|
|
15
|
+
var __stxLiveBindings = typeof __stxLiveBindings === 'undefined' ? {} : __stxLiveBindings;
|
|
16
|
+
Object.keys(${V}).forEach(function(name) {
|
|
17
|
+
if (!Object.prototype.hasOwnProperty.call(__stxLiveBindings, name))
|
|
18
|
+
Object.defineProperty(__stxLiveBindings, name, Object.getOwnPropertyDescriptor(${V}, name));
|
|
19
|
+
});`.trim(),N("bundled:",o,"output:",m.length,"bytes"),r.size>0&&_.length===0)return console.warn(`[stx:bundler] dropped every binding for ${d.basename(e)} (${o}); serving the unbundled source and not caching this result`),t;j.mkdirSync(p,{recursive:!0}),await Bun.write(b,m);let W=Er(tt);return await Bun.write(C,JSON.stringify({metadataVersion:at,files:W.map((x)=>St(x.path,i)).filter((x)=>x!==null)})),q(e,W.map((x)=>x.path)),s.collectInputs?.push(...W.map((x)=>x.path)),z.set(b,{code:m,files:W}),await jt(p),m}catch(F){let m=cr(F,e||void 0),_=De(F,e||void 0);if(console.warn(`[stx:bundler] error: ${_}`),mc(e||"",_,m),s.throwOnFailure||hc()==="error")throw F;return t}finally{try{j.rmSync(y,{recursive:!0,force:!0})}catch{}}}function Mt(t){let e=t.trim();if(!e)return null;let s=e.indexOf("=");if(s!==-1)e=e.slice(0,s).trim();let i=e.indexOf(":");if(i!==-1)e=e.slice(i+1).trim();if(e.startsWith("..."))e=e.slice(3).trim();return/^[A-Za-z_$][\w$]*$/.test(e)?e:null}
|
|
20
|
+
export{Lf,jf,ke,Bf,mc,cn,ln,Vh,hc,un,ar,Ff,zf,Hf,ps,Vf,Uf,yc,dn,Wf,pn,bc,Uh};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{fm}from"./chunk-fwbccyhw.js";import"./chunk-ctjxcaxq.js";import"./chunk-ttjscvre.js";import"./chunk-r09kz9bf.js";import"./chunk-zc8a2erc.js";import"./chunk-0sa9gqmc.js";import"./chunk-wp0qpa50.js";import"./chunk-5gx403te.js";import"./chunk-x4jzhgdm.js";import"./chunk-kzc2tqzr.js";import"./chunk-pp99rmjm.js";import"./chunk-3w7gacva.js";import"./chunk-fdjx4vs3.js";export{fm as buildApp};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{fu,gu,mu,hu,yu,bu,wu,vu,xu,Su,Ym}from"./chunk-s7fhpkvf.js";export{fu as createIslandRegistry,Ym as default,Su as generateIslandManifest,mu as generatePartialHydrationCSS,bu as hydrateAll,yu as hydrateByStrategy,hu as hydrateIsland,wu as isHydrated,vu as onHydrated,gu as processPartialHydrationDirectives,xu as processStaticDirectives};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var d=0;function l(){return`keep-alive-${++d}-${Date.now().toString(36)}`}function
|
|
2
|
+
var d=0;function l(){return`keep-alive-${++d}-${Date.now().toString(36)}`}function Vm(e,t={},n){let i=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return e.replace(i,(a,c,o)=>{let s=l(),r=u(c||"");return p(s,o.trim(),r)})}function u(e){let t={max:10},n=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,i;while((i=n.exec(e))!==null){let a=i[1],c=i[2]||i[3],o=i[4];switch(a){case"max":t.max=o?parseInt(o,10):10;break;case"include":t.include=c;break;case"exclude":t.exclude=c;break;case"id":t.id=c;break}}return t}function p(e,t,n){let{max:i,include:a,exclude:c}=n,o=n.id||e;return`
|
|
3
3
|
<div class="stx-keep-alive" data-keep-alive-id="${e}" data-custom-id="${o}">
|
|
4
4
|
<div class="stx-keep-alive-content" data-keep-alive-content="${e}">
|
|
5
5
|
${t}
|
|
@@ -286,7 +286,7 @@ else {
|
|
|
286
286
|
});
|
|
287
287
|
})();
|
|
288
288
|
</script>
|
|
289
|
-
`}function
|
|
289
|
+
`}function Um(e={}){return{id:e.id||l(),cache:new Map,max:e.max||10,include:e.include?e.include.split(",").map((n)=>n.trim()):null,exclude:e.exclude?e.exclude.split(",").map((n)=>n.trim()):null}}function Wm(e,t){if(t.exclude&&t.exclude.includes(e))return!1;if(t.include&&!t.include.includes(e))return!1;return!0}function qm(){return`
|
|
290
290
|
/* STX Keep-Alive Styles */
|
|
291
291
|
.stx-keep-alive {
|
|
292
292
|
position: relative;
|
|
@@ -311,7 +311,7 @@ else {
|
|
|
311
311
|
.stx-keep-alive-content > [data-activated] {
|
|
312
312
|
opacity: 1;
|
|
313
313
|
}
|
|
314
|
-
`}function
|
|
314
|
+
`}function Km(){return`
|
|
315
315
|
// STX Keep-Alive Runtime
|
|
316
316
|
(function() {
|
|
317
317
|
if (typeof window === 'undefined') return;
|
|
@@ -347,5 +347,5 @@ else {
|
|
|
347
347
|
|
|
348
348
|
console.log('[stx] Keep-alive runtime initialized');
|
|
349
349
|
})();
|
|
350
|
-
`}function
|
|
351
|
-
export{
|
|
350
|
+
`}function Gm(e){if(typeof document<"u")document.addEventListener("stx:activated",(t)=>{e(t.detail)})}function Xm(e){if(typeof document<"u")document.addEventListener("stx:deactivated",(t)=>{e(t.detail)})}
|
|
351
|
+
export{Vm,Um,Wm,qm,Km,Gm,Xm};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function
|
|
2
|
+
function Aa(v,c){let{itemHeight:l,containerHeight:u,overscan:s=3,keyProperty:b="id",dynamicHeight:d=!1,estimatedItemHeight:g=l,direction:x="vertical"}=c,e=[...v],t=0,n=new Map;function f(){if(d)return h();let i=Math.max(0,Math.floor(t/l)-s),r=Math.ceil(u/l),m=Math.min(e.length-1,i+r+s*2);return{startIndex:i,endIndex:m}}function h(){let i=0,r=0,m=e.length-1;for(let p=0;p<e.length;p++){let M=n.get(p)||g;if(i+M>t){r=Math.max(0,p-s);break}i+=M}i=0;for(let p=0;p<e.length;p++){let M=n.get(p)||g;if(i+=M,i>t+u){m=Math.min(e.length-1,p+s);break}}return{startIndex:r,endIndex:m}}function w(){if(d){let i=0;for(let r=0;r<e.length;r++)i+=n.get(r)||g;return i}return e.length*l}function y(i){if(d){let r=0;for(let m=0;m<i;m++)r+=n.get(m)||g;return r}return i*l}function S(){let{startIndex:i,endIndex:r}=f();return{startIndex:i,endIndex:r,scrollTop:t,totalHeight:w(),visibleItems:e.slice(i,r+1),itemHeights:new Map(n)}}function L(i,r="auto"){let m=y(i);a(m,r)}function a(i,r="auto"){t=Math.max(0,Math.min(i,w()-u))}function o(){f()}function H(i){e=[...i],n.clear(),o()}function I(){e=[],n.clear()}return{scrollToIndex:L,scrollToOffset:a,getState:S,refresh:o,setItems:H,destroy:I}}function Pa(v,c={},l){let u=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return v.replace(u,(s,b,d,g)=>{let x=b.trim(),e=c[x];if(!e||!Array.isArray(e))return`<!-- virtualList: items "${x}" not found or not an array -->`;let t={itemHeight:50,containerHeight:400,overscan:3};if(d)try{let a=d.trim(),o=Function(`return ${a}`)();t={...t,...o}}catch{}let n=`vlist-${Math.random().toString(36).substring(2,9)}`,f=Math.ceil(t.containerHeight/t.itemHeight),h=t.overscan||3,w=0,y=Math.min(e.length-1,f+h),S="";for(let a=w;a<=y&&a<e.length;a++){let o=e[a],H=g.replace(/\{\{\s*item\s*\}\}/g,typeof o==="object"?JSON.stringify(o):String(o)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(I,i)=>{if(typeof o==="object"&&o!==null)return String(o[i]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(a));S+=`
|
|
3
3
|
<div class="virtual-item ${t.itemClass||""}"
|
|
4
4
|
style="position: absolute; top: ${a*t.itemHeight}px; height: ${t.itemHeight}px; width: 100%;"
|
|
5
5
|
data-index="${a}">
|
|
@@ -76,7 +76,7 @@ function Ta(v,c){let{itemHeight:l,containerHeight:u,overscan:s=3,keyProperty:b="
|
|
|
76
76
|
};
|
|
77
77
|
})();
|
|
78
78
|
</script>
|
|
79
|
-
`})}function
|
|
79
|
+
`})}function lu(){return`
|
|
80
80
|
.virtual-list-container {
|
|
81
81
|
position: relative;
|
|
82
82
|
overflow-y: auto;
|
|
@@ -124,7 +124,7 @@ function Ta(v,c){let{itemHeight:l,containerHeight:u,overscan:s=3,keyProperty:b="
|
|
|
124
124
|
0% { background-position: 200% 0; }
|
|
125
125
|
100% { background-position: -200% 0; }
|
|
126
126
|
}
|
|
127
|
-
`}function
|
|
127
|
+
`}function uu(v,c){let l=null,u=()=>{if(!l)l=Aa(v(),c);return l};return{visibleItems:()=>u().getState().visibleItems,totalHeight:()=>u().getState().totalHeight,containerProps:()=>({style:{height:`${c.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(s)=>{let b=s.target;if(l)l.scrollToOffset(b.scrollTop)}}),itemProps:(s)=>({style:{position:"absolute",top:`${s*c.itemHeight}px`,height:`${c.itemHeight}px`,width:"100%"},"data-index":s}),scrollToIndex:(s)=>{u().scrollToIndex(s)}}}function du(v,c={},l){let u=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return v.replace(u,(s,b,d,g,x)=>{let e=b.trim(),t=c[e];if(!t||!Array.isArray(t))return`<!-- infiniteList: items "${e}" not found or not an array -->`;let n={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(d)try{let w=Function(`return ${d.trim()}`)();n={...n,...w}}catch{}let f=`ilist-${Math.random().toString(36).substring(2,9)}`,h=Pa(`@virtualList(${e}, ${JSON.stringify({itemHeight:n.itemHeight,containerHeight:n.containerHeight,overscan:n.overscan,containerClass:n.containerClass})})${g}@endvirtualList`,c);return h=h.replace("</script>",`
|
|
128
128
|
// Infinite scroll detection
|
|
129
129
|
container.addEventListener('scroll', function() {
|
|
130
130
|
const scrollBottom = container.scrollTop + container.clientHeight;
|
|
@@ -142,7 +142,7 @@ function Ta(v,c){let{itemHeight:l,containerHeight:u,overscan:s=3,keyProperty:b="
|
|
|
142
142
|
${x}
|
|
143
143
|
</div>
|
|
144
144
|
</div>
|
|
145
|
-
`})}function
|
|
145
|
+
`})}function pu(v,c={},l){let u=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return v.replace(u,(s,b,d,g)=>{let x=b.trim(),e=c[x];if(!e||!Array.isArray(e))return`<!-- virtualGrid: items "${x}" not found or not an array -->`;let t={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(d)try{let o=Function(`return ${d.trim()}`)();t={...t,...o}}catch{}let n=`vgrid-${Math.random().toString(36).substring(2,9)}`,f=Math.ceil(e.length/t.columns),h=f*(t.rowHeight+(t.gap||0)),w=Math.ceil(t.containerHeight/(t.rowHeight+(t.gap||0))),y=t.overscan||2,S=0,L=Math.min(f-1,w+y),a="";for(let o=S;o<=L;o++)for(let H=0;H<t.columns;H++){let I=o*t.columns+H;if(I>=e.length)break;let i=e[I],r=H*(100/t.columns),m=o*(t.rowHeight+(t.gap||0)),p=g.replace(/\{\{\s*item\s*\}\}/g,typeof i==="object"?JSON.stringify(i):String(i)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(M,T)=>{if(typeof i==="object"&&i!==null)return String(i[T]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(I));a+=`
|
|
146
146
|
<div class="virtual-grid-item"
|
|
147
147
|
style="position: absolute; top: ${m}px; left: ${r}%; width: calc(${100/t.columns}% - ${t.gap||0}px); height: ${t.rowHeight}px;"
|
|
148
148
|
data-index="${I}">
|
|
@@ -212,5 +212,5 @@ function Ta(v,c){let{itemHeight:l,containerHeight:u,overscan:s=3,keyProperty:b="
|
|
|
212
212
|
});
|
|
213
213
|
})();
|
|
214
214
|
</script>
|
|
215
|
-
`})}var
|
|
216
|
-
export{
|
|
215
|
+
`})}var Jm={createVirtualList:Aa,processVirtualListDirectives:Pa,processInfiniteListDirectives:du,processVirtualGridDirectives:pu,generateVirtualListCSS:lu,useVirtualList:uu};
|
|
216
|
+
export{Aa,Pa,lu,uu,du,pu,Jm};
|