@stacksjs/stx 0.2.530 → 0.2.532
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-35j1evvy.js → chunk-03wggzg8.js} +3 -3
- package/dist/chunk-08emfsq3.js +2 -0
- package/dist/{chunk-2twfqcxm.js → chunk-0dqxnx20.js} +2 -2
- package/dist/chunk-0p9pwd61.js +2 -0
- package/dist/chunk-0pebjkzx.js +18 -0
- package/dist/{chunk-f1n4e4jy.js → chunk-0wvsfs4s.js} +2 -2
- package/dist/chunk-0zmv31nc.js +2 -0
- package/dist/{chunk-c322rrge.js → chunk-12e4a0ab.js} +2 -2
- package/dist/chunk-12v4d123.js +2 -0
- package/dist/{chunk-2m5mx0x8.js → chunk-15r72kw7.js} +1 -1
- package/dist/{chunk-gvngrxvb.js → chunk-1945hk44.js} +1 -1
- package/dist/chunk-28xtazwz.js +2 -0
- package/dist/{chunk-y8h823cb.js → chunk-292vew7b.js} +36 -36
- package/dist/chunk-2936t942.js +2 -0
- package/dist/chunk-29qwmthc.js +2 -0
- package/dist/chunk-2a4szpje.js +3 -0
- package/dist/{chunk-8m3k43d3.js → chunk-2dzd2h15.js} +7 -7
- package/dist/{chunk-0rt5ec7a.js → chunk-2jk0vceh.js} +4 -4
- package/dist/{chunk-ktvr45qg.js → chunk-2qbvsvwc.js} +2 -2
- package/dist/chunk-2y6tzn6d.js +3 -0
- package/dist/{chunk-csbft3wz.js → chunk-31c1g3rt.js} +3 -3
- package/dist/chunk-323cxa69.js +2 -0
- package/dist/chunk-375zp0vr.js +2 -0
- package/dist/{chunk-21rm5kv6.js → chunk-38w14qs7.js} +2 -2
- package/dist/{chunk-raqbqt1r.js → chunk-3vvppnws.js} +6 -6
- package/dist/chunk-3w49r16x.js +2 -0
- package/dist/chunk-3zyvhf4p.js +2 -0
- package/dist/chunk-458etq5a.js +4 -0
- package/dist/chunk-4cmqjmqr.js +3 -0
- package/dist/{chunk-37nybpw1.js → chunk-4gt0r98p.js} +65 -14
- package/dist/{chunk-3x9d58f4.js → chunk-4xxhprts.js} +11 -11
- package/dist/{chunk-4drgbkga.js → chunk-587ehsxn.js} +2 -2
- package/dist/{chunk-5tyes97j.js → chunk-5tj6expd.js} +2 -2
- package/dist/{chunk-kzztmawd.js → chunk-664503e6.js} +6 -6
- package/dist/{chunk-hkjqqx92.js → chunk-6abvk7vj.js} +3 -3
- package/dist/{chunk-ba88n1j7.js → chunk-6v1gwdbv.js} +2 -2
- package/dist/{chunk-y0c1srgj.js → chunk-7s14bthq.js} +5 -5
- package/dist/{chunk-2etevws0.js → chunk-7tabykst.js} +2 -2
- package/dist/{chunk-zw029e7n.js → chunk-7wfh2hqy.js} +4 -4
- package/dist/chunk-7ybgfk0m.js +3 -0
- package/dist/chunk-8bcvb86w.js +2 -0
- package/dist/chunk-8gmb3k1p.js +2 -0
- package/dist/{chunk-v2zxxjqn.js → chunk-90wh9zzy.js} +6 -6
- package/dist/{chunk-d8ramz4s.js → chunk-9a73re8k.js} +2 -2
- package/dist/{chunk-p4gbvge6.js → chunk-9pztpvvk.js} +1 -1
- package/dist/chunk-9skdekv5.js +2 -0
- package/dist/{chunk-7p0zerfj.js → chunk-9sqjmd9a.js} +10 -10
- package/dist/{chunk-czmw5xsd.js → chunk-9w2vmfha.js} +2 -2
- package/dist/chunk-9xq5yer8.js +2 -0
- package/dist/chunk-a15yzfc6.js +2 -0
- package/dist/{chunk-2hc5mbw8.js → chunk-azb58ven.js} +2 -2
- package/dist/{chunk-869wyw0j.js → chunk-b7xdk1g4.js} +6 -6
- package/dist/{chunk-9mjy16pw.js → chunk-bpr4bkde.js} +2 -2
- package/dist/chunk-cp4dr9ch.js +2 -0
- package/dist/{chunk-6t0rq51y.js → chunk-d2r8t40y.js} +2 -2
- package/dist/chunk-d4155ec5.js +2 -0
- package/dist/{chunk-6k7spr38.js → chunk-d7x6n702.js} +7 -7
- package/dist/chunk-dd31q423.js +2 -0
- package/dist/{chunk-qhg55cvv.js → chunk-ee4wwr89.js} +5 -5
- package/dist/{chunk-f5pmyxtn.js → chunk-ennxrn5g.js} +5 -5
- package/dist/{chunk-xevnx24r.js → chunk-er031j13.js} +2 -2
- package/dist/chunk-f2q5bckn.js +2 -0
- package/dist/chunk-fhx35529.js +2 -0
- package/dist/chunk-frw35d2v.js +2 -0
- package/dist/chunk-fyxydww2.js +4 -0
- package/dist/{chunk-nzk14k6w.js → chunk-g060jncp.js} +7 -7
- package/dist/{chunk-x1tzt7yc.js → chunk-g12j8ahm.js} +4 -4
- package/dist/chunk-g5t10z04.js +2837 -0
- package/dist/{chunk-x9mzfq3p.js → chunk-grb3kfya.js} +1 -1
- package/dist/{chunk-3cn7973z.js → chunk-gsxb0ry9.js} +1 -1
- package/dist/{chunk-619j0mnz.js → chunk-gvw8wh29.js} +5 -5
- package/dist/{chunk-e6y6s7q8.js → chunk-gxfnmjzp.js} +2 -2
- package/dist/chunk-h1y5q942.js +2 -0
- package/dist/chunk-h791c7sb.js +2 -0
- package/dist/chunk-h88jcr3k.js +2 -0
- package/dist/chunk-heq5c0gd.js +2 -0
- package/dist/{chunk-ravc60z0.js → chunk-hp1tnxzb.js} +8 -8
- package/dist/chunk-hpeg9erh.js +3 -0
- package/dist/chunk-j3b24e77.js +2 -0
- package/dist/{chunk-vrrqnp5k.js → chunk-j8pacd7m.js} +5 -5
- package/dist/{chunk-346zc43s.js → chunk-jjwg83xv.js} +1 -1
- package/dist/chunk-jpck8nm5.js +2 -0
- package/dist/{chunk-58jyc7kp.js → chunk-kg77xs08.js} +3 -3
- package/dist/{chunk-1te1s9fa.js → chunk-khwj964t.js} +4 -4
- package/dist/{chunk-299xbyhn.js → chunk-kwvexxey.js} +4 -4
- package/dist/chunk-ky25egh1.js +2 -0
- package/dist/{chunk-w6ys6eq4.js → chunk-m2v04c6v.js} +93 -93
- package/dist/chunk-m4d99a9r.js +2 -0
- package/dist/chunk-ndv44bgs.js +2 -0
- package/dist/chunk-ng2sdph7.js +2 -0
- package/dist/{chunk-yh3p86qa.js → chunk-p8qr0q85.js} +2 -2
- package/dist/{chunk-6k4f583z.js → chunk-p8yh7mgr.js} +2 -2
- package/dist/chunk-pkfwxp9n.js +2 -0
- package/dist/chunk-pr5q4wev.js +2 -0
- package/dist/{chunk-fk45zc1b.js → chunk-q6e45gnw.js} +5 -5
- package/dist/chunk-qs3p7sc6.js +2 -0
- package/dist/{chunk-wqxdx2td.js → chunk-r6gxy92f.js} +2 -2
- package/dist/chunk-rchwwcxy.js +2 -0
- package/dist/chunk-rk4mttds.js +2 -0
- package/dist/chunk-rma3bv36.js +2 -0
- package/dist/chunk-rp5a91ak.js +2 -0
- package/dist/{chunk-hhys3aaa.js → chunk-rs46hksk.js} +2 -2
- package/dist/{chunk-wn5zjs5m.js → chunk-rtk6n3vh.js} +3 -3
- package/dist/chunk-rwn3b21z.js +3 -0
- package/dist/chunk-sp5x96rn.js +2 -0
- package/dist/chunk-st79dqpz.js +2 -0
- package/dist/{chunk-8g1fx4mg.js → chunk-stbsqy7e.js} +2 -2
- package/dist/chunk-t2mjeezd.js +2 -0
- package/dist/chunk-t61j834x.js +2 -0
- package/dist/{chunk-s19r6qe3.js → chunk-t6769zcy.js} +55 -55
- package/dist/chunk-t94z65ry.js +2 -0
- package/dist/{chunk-0ytm2ecf.js → chunk-tkeabv04.js} +16 -16
- package/dist/{chunk-1e7g79x4.js → chunk-v1m9nrn9.js} +1 -1
- package/dist/chunk-v2vg5jqq.js +2 -0
- package/dist/{chunk-07abr1v4.js → chunk-vg8thz41.js} +3 -3
- package/dist/chunk-vmfw4svt.js +2 -0
- package/dist/chunk-w6ecbk3y.js +2 -0
- package/dist/chunk-wbv6vjhm.js +2 -0
- package/dist/chunk-wfbr3txe.js +2 -0
- package/dist/{chunk-1v6yyvxf.js → chunk-wk85dz07.js} +3 -3
- package/dist/chunk-wpnv0naj.js +2 -0
- package/dist/chunk-wwny5dk9.js +2 -0
- package/dist/chunk-wzymzex7.js +2 -0
- package/dist/chunk-x55avrcf.js +2 -0
- package/dist/{chunk-hbwmmt91.js → chunk-xab6b4mt.js} +2 -2
- package/dist/{chunk-fd795e6s.js → chunk-xb0785wp.js} +2 -2
- package/dist/{chunk-1s7qdv2h.js → chunk-xcfhy5bj.js} +3 -3
- package/dist/{chunk-b0zz4dbx.js → chunk-xdtz2v5r.js} +3 -3
- package/dist/chunk-xmwd2xm6.js +2 -0
- package/dist/chunk-xtknewf7.js +2 -0
- package/dist/{chunk-wm5b2y65.js → chunk-y4qks0bd.js} +2 -2
- package/dist/{chunk-1h4z3xpy.js → chunk-y7ds4qyb.js} +3 -3
- package/dist/{chunk-p8c5g5n2.js → chunk-yn3kp3qy.js} +5 -5
- package/dist/chunk-yts2745t.js +2 -0
- package/dist/chunk-zah67v44.js +2 -0
- package/dist/chunk-zpdq0kx1.js +2 -0
- package/dist/chunk-zpf9he2x.js +2 -0
- package/dist/chunk-zpftj8s8.js +2 -0
- package/dist/{chunk-xpvvne6r.js → chunk-zzphh8g9.js} +9 -9
- package/dist/cli.js +62 -62
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/image-optimization/processor.js +6 -8
- package/dist/native/runtime/native-host.js +4 -1
- package/dist/native-build.js +12 -7
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +13 -13
- package/dist/temp-dir.d.ts +52 -0
- package/dist/temp-dir.js +140 -0
- package/package.json +5 -5
- package/dist/chunk-088jh5zy.js +0 -2
- package/dist/chunk-089x96rp.js +0 -2
- package/dist/chunk-0fad6jf4.js +0 -2
- package/dist/chunk-0fna7gd0.js +0 -2
- package/dist/chunk-0ksq0e6s.js +0 -2
- package/dist/chunk-2bwhc8ea.js +0 -2
- package/dist/chunk-2fb4yx25.js +0 -4
- package/dist/chunk-2y82wf9d.js +0 -3
- package/dist/chunk-3bsnte2s.js +0 -2
- package/dist/chunk-3j02tj5n.js +0 -2
- package/dist/chunk-3j9de8yh.js +0 -2
- package/dist/chunk-3v2bf157.js +0 -2
- package/dist/chunk-62ry3ta3.js +0 -2
- package/dist/chunk-62s4jb6m.js +0 -2
- package/dist/chunk-6dd0zr74.js +0 -2
- package/dist/chunk-87zse67b.js +0 -2
- package/dist/chunk-9hx4s11k.js +0 -2
- package/dist/chunk-9z76qhdm.js +0 -2
- package/dist/chunk-a0pq8xg4.js +0 -2
- package/dist/chunk-ad0czgpa.js +0 -2
- package/dist/chunk-axjzqh7v.js +0 -2
- package/dist/chunk-bday3eyq.js +0 -2
- package/dist/chunk-c2243par.js +0 -2
- package/dist/chunk-csy2m03w.js +0 -2
- package/dist/chunk-d3qdcdz9.js +0 -2
- package/dist/chunk-dvph69ej.js +0 -2
- package/dist/chunk-e1c9gypy.js +0 -2
- package/dist/chunk-eadr1eph.js +0 -2
- package/dist/chunk-eh3nvr2g.js +0 -2
- package/dist/chunk-f3nxd8z8.js +0 -2
- package/dist/chunk-fanmabb0.js +0 -2
- package/dist/chunk-fjd5ka6v.js +0 -2
- package/dist/chunk-fq5xecrx.js +0 -2
- package/dist/chunk-g25n9e8z.js +0 -2
- package/dist/chunk-g7ey7mtw.js +0 -3
- package/dist/chunk-gaz311xs.js +0 -2
- package/dist/chunk-ggb57j6c.js +0 -3
- package/dist/chunk-hmk2x1t8.js +0 -2
- package/dist/chunk-j1tbfabt.js +0 -2
- package/dist/chunk-jftv278d.js +0 -2
- package/dist/chunk-jj8ssn0d.js +0 -3
- package/dist/chunk-jkd0c82m.js +0 -2
- package/dist/chunk-jw536pve.js +0 -2
- package/dist/chunk-jwx0h9qb.js +0 -2
- package/dist/chunk-k4p80n25.js +0 -2
- package/dist/chunk-kpvr93cb.js +0 -2
- package/dist/chunk-kxa069d6.js +0 -2
- package/dist/chunk-pkwed7dt.js +0 -2
- package/dist/chunk-pq5nywkf.js +0 -2
- package/dist/chunk-qfm2gy40.js +0 -2
- package/dist/chunk-r37sf7ys.js +0 -18
- package/dist/chunk-rnnead1w.js +0 -2
- package/dist/chunk-szbvewf8.js +0 -2
- package/dist/chunk-t2yrb7pt.js +0 -2
- package/dist/chunk-tjjvphx3.js +0 -2
- package/dist/chunk-tsdjwe93.js +0 -2
- package/dist/chunk-v70hfs6d.js +0 -2
- package/dist/chunk-vp37585y.js +0 -2
- package/dist/chunk-vr0fb0x1.js +0 -2
- package/dist/chunk-w5kx0qzg.js +0 -2
- package/dist/chunk-wy36z6qp.js +0 -2
- package/dist/chunk-wyxjsx4k.js +0 -2837
- package/dist/chunk-x7a4c0x1.js +0 -2
- package/dist/chunk-y0a89hgw.js +0 -2
- package/dist/chunk-y4b60ke0.js +0 -2
- package/dist/chunk-yn2d8x8m.js +0 -3
- package/dist/chunk-yqh6dny3.js +0 -2
- package/dist/chunk-z4f2msjp.js +0 -2
- package/dist/chunk-zmdyr321.js +0 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import y from"fs";import R from"path";var S="_stx";function F(e){return Bun.hash(e).toString(16).slice(0,8)}function k(e){let t=[],n=(i)=>{for(let s of y.readdirSync(i,{withFileTypes:!0})){let r=R.join(i,s.name);if(s.isDirectory())n(r);else if(s.isFile()&&r.endsWith(".html"))t.push(r)}};if(y.existsSync(e))n(e);return t}var z=[{pattern:/<script\b([^>]*\bdata-stx-runtime\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"runtime",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(e)=>`<script data-stx-runtime src="${e}"></script>`},{pattern:/<script\b([^>]*\bdata-stx-router\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"router",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(e)=>`<script data-stx-router src="${e}"></script>`},{pattern:/<style\b([^>]*\bdata-css=(?:"generated"|'generated')[^>]*)>([\s\S]*?)<\/style>/gi,prefix:"css",extension:"css",contentType:"text/css; charset=utf-8",replace:(e)=>`<link data-css="generated" rel="stylesheet" href="${e}">`}];function I(e,t=`/${S}`){let n=[],i=new Set,s=0,r=e;for(let o of z)r=r.replace(o.pattern,(g,u,c)=>{if(/\b(?:src|href)\s*=/.test(u)||!c.trim())return g;let a=`${o.prefix}.${F(c)}.${o.extension}`;if(!i.has(a))i.add(a),n.push({filename:a,contents:c,contentType:o.contentType});return s+=c.length,o.replace(`${t}/${a}`)});return{html:r,assets:n,bytesInlined:s}}function
|
|
2
|
+
import y from"fs";import R from"path";var S="_stx";function F(e){return Bun.hash(e).toString(16).slice(0,8)}function k(e){let t=[],n=(i)=>{for(let s of y.readdirSync(i,{withFileTypes:!0})){let r=R.join(i,s.name);if(s.isDirectory())n(r);else if(s.isFile()&&r.endsWith(".html"))t.push(r)}};if(y.existsSync(e))n(e);return t}var z=[{pattern:/<script\b([^>]*\bdata-stx-runtime\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"runtime",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(e)=>`<script data-stx-runtime src="${e}"></script>`},{pattern:/<script\b([^>]*\bdata-stx-router\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"router",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(e)=>`<script data-stx-router src="${e}"></script>`},{pattern:/<style\b([^>]*\bdata-css=(?:"generated"|'generated')[^>]*)>([\s\S]*?)<\/style>/gi,prefix:"css",extension:"css",contentType:"text/css; charset=utf-8",replace:(e)=>`<link data-css="generated" rel="stylesheet" href="${e}">`}];function I(e,t=`/${S}`){let n=[],i=new Set,s=0,r=e;for(let o of z)r=r.replace(o.pattern,(g,u,c)=>{if(/\b(?:src|href)\s*=/.test(u)||!c.trim())return g;let a=`${o.prefix}.${F(c)}.${o.extension}`;if(!i.has(a))i.add(a),n.push({filename:a,contents:c,contentType:o.contentType});return s+=c.length,o.replace(`${t}/${a}`)});return{html:r,assets:n,bytesInlined:s}}function No(e){let t={pages:0,assets:0,bytesInlined:0},n=R.join(e,S),i=new Set;for(let s of k(e)){let r=y.readFileSync(s,"utf8"),{html:o,assets:g,bytesInlined:u}=I(r);if(o===r)continue;for(let c of g){if(i.has(c.filename))continue;i.add(c.filename),y.mkdirSync(n,{recursive:!0}),y.writeFileSync(R.join(n,c.filename),c.contents),t.assets++}y.writeFileSync(s,o),t.bytesInlined+=u,t.pages++}return t}import h from"fs";import T from"path";var L=1024,N=/<(script|style)\b([^>]*)>([\s\S]*?)<\/\1>/gi,_=new Set(["","module","text/javascript","application/javascript","module/javascript"]);function B(e){return Bun.hash(e).toString(16).slice(0,8)}function C(e){let t=[],n=(i)=>{for(let s of h.readdirSync(i,{withFileTypes:!0})){let r=T.join(i,s.name);if(s.isDirectory())n(r);else if(s.isFile()&&r.endsWith(".html"))t.push(r)}};if(h.existsSync(e))n(e);return t}function O(e,t){let n=e.match(new RegExp(`\\b${t}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i"));if(!n)return;return n[2]??n[3]??n[4]??""}function H(e,t,n){if(n.length<L)return!1;if(/\b(?:src|href)\s*=/i.test(t))return!1;if(e.toLowerCase()==="script"){if(!_.has((O(t,"type")??"").trim().toLowerCase()))return!1;return!0}return!0}function D(e){let t=[];for(let n of e.matchAll(/<template\b[^>]*>[\s\S]*?<\/template>/gi))t.push([n.index,n.index+n[0].length]);return t}function Lo(e){let t={pages:0,assets:0,bytesInlined:0},n=C(e);if(n.length<2)return t;let i=new Map,s=new Map;for(let a of n){let f=h.readFileSync(a,"utf8");i.set(a,f);let M=D(f);for(let d of f.matchAll(N)){let[x,p,l,m]=d;if(!H(p,l,m))continue;if(M.some(([j,A])=>d.index>=j&&d.index<A))continue;let w=`${p.toLowerCase()}\x00${m}`,b=s.get(w);if(b)b.push({file:a,whole:x,tag:p,attrs:l,body:m});else s.set(w,[{file:a,whole:x,tag:p,attrs:l,body:m}])}}let r=[...s.values()].filter((a)=>new Set(a.map((f)=>f.file)).size>1);if(r.length===0)return t;let o=T.join(e,S),g=new Map(i),u=new Map,c=[];for(let a of r){let{tag:f,body:M}=a[0],d=f.toLowerCase()==="script",x=`${d?"chunk":"style"}.${B(M)}.${d?"js":"css"}`;c.push({filename:x,contents:M,contentType:d?"text/javascript; charset=utf-8":"text/css; charset=utf-8"});let p=`/${S}/${x}`;for(let l of a){let m=d?`<script${l.attrs} src="${p}"></script>`:`<link${l.attrs} rel="stylesheet" href="${p}">`,w=g.get(l.file),b=w.replace(l.whole,()=>m);if(b===w)continue;g.set(l.file,b),u.set(l.file,(u.get(l.file)??0)+l.body.length)}}h.mkdirSync(o,{recursive:!0});for(let a of c)h.writeFileSync(T.join(o,a.filename),a.contents),t.assets++;for(let[a,f]of g){if(f===i.get(a))continue;h.writeFileSync(a,f),t.pages++,t.bytesInlined+=u.get(a)??0}return t}import E from"fs";import v from"path";var K="layout-types.d.ts";function P(e){let t=[],n=(i,s)=>{let r;try{r=E.readdirSync(i,{withFileTypes:!0})}catch{return}for(let o of r){if(o.name.startsWith("."))continue;let g=v.join(i,o.name);if(o.isDirectory())n(g,s?`${s}/${o.name}`:o.name);else if(o.isFile()&&o.name.endsWith(".stx")&&o.name!=="_layout.stx"){let u=o.name.slice(0,-4);t.push(s?`${s}/${u}`:u)}}};return n(e,""),t.sort()}function W(e){let t=["// Auto-generated by stx \u2014 do not edit.","//","// Makes `definePageMeta({ layout })` reject a name with no layout behind it.","// Include this file in your tsconfig (it lives in the stx state directory,","// `.stx/` by default) for the check to apply.",""];if(e.length===0)return t.push("// No layouts found \u2014 `layout` stays typed as `string`.","export {}",""),t.join(`
|
|
3
3
|
`);return t.push("declare module '@stacksjs/stx' {"," interface KnownLayouts {",...e.map((n)=>` '${n}': true`)," }","}","","export {}",""),t.join(`
|
|
4
|
-
`)}function
|
|
5
|
-
export{
|
|
4
|
+
`)}function jo(e,t){if(!e)return[];let n=v.isAbsolute(e)?e:v.resolve(process.cwd(),e),i=P(n),s=W(i),r=v.join(t,K);try{if(E.existsSync(r)&&E.readFileSync(r,"utf8")===s)return i;E.mkdirSync(t,{recursive:!0}),E.writeFileSync(r,s)}catch{}return i}
|
|
5
|
+
export{No,Lo,jo};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{d,ms,pi,fi,Pc,Ic,Dc,Oc,Mc,Nc,qe,L,Ke,Lc,Jn,jc,yi,Bc,Xe,r,Yn,bi,g,te,eu}from"./chunk-g5t10z04.js";import"./chunk-kg77xs08.js";import"./chunk-bpr4bkde.js";import"./chunk-kwvexxey.js";import"./chunk-y4qks0bd.js";import"./chunk-p8yh7mgr.js";import"./chunk-2dzd2h15.js";import"./chunk-9sqjmd9a.js";import"./chunk-tkeabv04.js";import"./chunk-6v1gwdbv.js";import"./chunk-5tj6expd.js";import"./chunk-4gt0r98p.js";import"./chunk-gxfnmjzp.js";export{te as clearComponentCache,Bc as componentClientSignalNames,ms as convertToCommonJS,g as createDetailedErrorMessage,Mc as extractDirectiveNames,pi as extractScriptFromTemplate,d as extractVariables,r as fileExists,eu as getComponentCacheStats,Ic as getPositionInfo,L as getSharedTranspiler,bi as getSourceLineInfo,Oc as hasDirectives,fi as hasVariables,jc as isHydrateTrigger,Nc as isJavaScriptScript,Xe as renderComponentWithSlot,Yn as resolveTemplatePath,Lc as scopeOnRootElement,qe as shouldTranspileTypeScript,yi as slotContentHasExpressions,Ke as transpileTypeScript,Jn as userComponentFileExists,Dc as validateDirective,Pc as validateTemplate};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{kl}from"./chunk-rs46hksk.js";import"./chunk-g5t10z04.js";import"./chunk-kg77xs08.js";import"./chunk-bpr4bkde.js";import"./chunk-kwvexxey.js";import"./chunk-y4qks0bd.js";import"./chunk-p8yh7mgr.js";import"./chunk-2dzd2h15.js";import"./chunk-9sqjmd9a.js";import"./chunk-tkeabv04.js";import"./chunk-6v1gwdbv.js";import"./chunk-5tj6expd.js";import"./chunk-4gt0r98p.js";import"./chunk-gxfnmjzp.js";export{kl as buildApp};
|
|
@@ -72,7 +72,7 @@ else {
|
|
|
72
72
|
${t}
|
|
73
73
|
})();
|
|
74
74
|
</script>
|
|
75
|
-
`}function
|
|
75
|
+
`}function zl(i,n,o){f=0;let l=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return i.replace(l,(t,e,s)=>{let a=v(),r=p(t,e,s),d=r.placeholder?`<div data-defer-placeholder>${r.placeholder}</div>`:"",c=r.loading?`<div data-defer-loading style="display: none;">${r.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',g=r.error?`<div data-defer-error style="display: none;">${r.error}</div>`:"",u=`<div data-defer-content style="display: none;">${r.content}</div>`,h=E(a,r);return`
|
|
76
76
|
<div id="${a}" class="stx-defer" data-defer-trigger="${r.trigger}">
|
|
77
77
|
${d}
|
|
78
78
|
${c}
|
|
@@ -81,4 +81,4 @@ else {
|
|
|
81
81
|
</div>
|
|
82
82
|
${h}
|
|
83
83
|
`})}
|
|
84
|
-
export{
|
|
84
|
+
export{zl};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{M,
|
|
3
|
-
export{
|
|
2
|
+
import{M,le}from"./chunk-g5t10z04.js";import{ue,C,Je}from"./chunk-p8yh7mgr.js";import{tt,J,Ce}from"./chunk-4gt0r98p.js";import{Pe,re,T,se,mo,_r,ho,Nt}from"./chunk-hp1tnxzb.js";import{Gr}from"./chunk-ee4wwr89.js";import{Lt}from"./chunk-7tabykst.js";import F from"zlib";import{promisify as Z}from"util";var ee=Z(F.brotliCompress),te=Z(F.gzip),ne=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],oe=["text/event-stream","multipart/x-mixed-replace"],ae=1024;function ie(t){if(!t)return!1;let e=t.toLowerCase();if(oe.some((o)=>e.startsWith(o)))return!1;return ne.some((o)=>e.startsWith(o))}function ce(t){let e=new Map;for(let o of t.split(",")){let[r,...a]=o.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of a){let l=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(g);if(!l)continue;let m=Number.parseFloat(l[1]);if(Number.isFinite(m))h=m}e.set(f,h)}return e}function pe(t){if(!t)return null;let e=ce(t),o=e.get("*"),r=(a)=>e.get(a)??o??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var Y=33554432,H=new Map,U=0;function me(t,e){if(e.length>Y/8)return;H.set(t,e),U+=e.length;for(let[o,r]of H){if(U<=Y)break;H.delete(o),U-=r.length}}async function Ot(t,e,o={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!ie(e.headers.get("content-type")))return e;let r=pe(t.headers.get("accept-encoding"));if(!r)return e;let a;try{a=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(a,{status:e.status,statusText:e.statusText,headers:Q(e.headers)});if(a.length<(o.threshold??ae))return f();try{let h=o.quality??5,g=`${r}:${h}:${a.length}:${Bun.hash(a)}`,l=H.get(g);if(!l)l=r==="br"?await ee(a,{params:{[F.constants.BROTLI_PARAM_QUALITY]:h,[F.constants.BROTLI_PARAM_SIZE_HINT]:a.length}}):await te(a),me(g,l);if(l.length>=a.length)return f();let m=Q(e.headers);return m.set("Content-Encoding",r),m.set("Content-Length",String(l.length)),new Response(l,{status:e.status,statusText:e.statusText,headers:m})}catch{return f()}}function Q(t){let e=new Headers(t),o=e.get("Vary");if(!o)return e.set("Vary","Accept-Encoding"),e;if(!o.split(",").some((a)=>a.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${o}, Accept-Encoding`);return e}import K from"fs";import A from"path";var{serve:fe}=globalThis.Bun;class G{now;entries=new M(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,o){let r,a=async()=>{let s=r??await o();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",T(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return a();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${re(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let S=new Headers(s.headers);return S.set("Cache-Control","private, no-store"),S.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:S})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let b=this.generation,k=async()=>{let s=await o();r=s;let S=(s.headers.get("Vary")??"").toLowerCase().split(",").map((y)=>y.trim()).filter(Boolean);if(s.status!==200||s.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(s.headers.get("Cache-Control")??"")||S.some((y)=>y!=="x-stx-router"&&y!=="accept-encoding"))return null;let L=await s.clone().arrayBuffer();if(L.byteLength>1048576)return null;s.headers.set("Vary",T(s.headers.get("Vary")).Vary);let n={body:L,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===b)this.entries.set(h,n);return n},v=this.pending.get(h);if(!v){if(this.pending.size>=1000)return a();v=k().finally(()=>{if(this.pending.get(h)===v)this.pending.delete(h)}),this.pending.set(h,v)}if(g&&m<e.maxAge+(e.swr??0))return v.catch(()=>{}),l(g);let B=await v;return B?l(B):a()}}var de={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function rl(t={}){let e=A.resolve(t.outputDir||".output"),o=t.port??3000,r=mo(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let a=Lt(r.routeRules),f=new G,h=Gr(e,r.apiRoutes??[]),g=Bun.file(A.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?C(l):void 0,b=new Map,k=new Map,v=new Map,B=new Map;for(let n of r.routes)try{let y=A.join(e,n.compiledPath),i=JSON.parse(await Bun.file(y).text());if(m)i.html=Je(i.html,m);b.set(n.pattern,i),v.set(n.pattern,Ce(i.html)),B.set(n.pattern,le(i.html));let _=A.join(e,n.fragmentPath);if(await Bun.file(_).exists()){let E=await Bun.file(_).text();k.set(n.pattern,m?Je(E,m):E)}}catch(y){console.warn(`[stx] Failed to load route ${n.pattern}:`,y)}let s=new Map,S=[];for(let n of r.routes)if(n.hasParams){let{regex:y,params:i}=J(n.pattern,{page:!0});S.push({regex:y,route:n,paramNames:i})}else s.set(n.pattern,n);let L=fe({port:o,async fetch(n){return Ot(n,await ue(m??C(),async()=>{let i=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[i])return t.apiRoutes[i](n);let _=await h(n);if(_)return _;if((n.method==="GET"||n.method==="HEAD")&&i!=="/"){let p=A.resolve(e,"public"),d;try{d=decodeURIComponent(i)}catch{d=i}if(!d.includes("\x00")){let u=A.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${A.sep}`))try{if(K.existsSync(u)&&K.statSync(u).isFile()){let R=A.extname(u).toLowerCase(),j=de[R]||"application/octet-stream",N=i.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(i);return new Response(Bun.file(u),{headers:{"Content-Type":j,"Cache-Control":N?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let E=re(n),w=null,q={};if(w=s.get(i)||null,!w)for(let{regex:p,route:d,paramNames:u}of S){let c=i.match(p);if(c){w=d,u.forEach((R,j)=>{q[R]=c[j+1]});break}}if(!w){let p=tt(i)?null:s.get("/404")||null;if(p){let d=b.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let O=a(i),W=Object.keys(O).length>0;return f.respond(n,O.cache,async()=>{let p=b.get(w.pattern);if(E&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let c=k.get(w.pattern);if(c){let R=v.get(w.pattern);return new Response(c,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...B.has(w.pattern)?{"X-STX-Runtime":B.get(w.pattern)?"true":"false"}:{},...R?{"X-STX-Layout":R.layout,"X-STX-Layout-Group":R.group}:{},...T(),...O.cache?{}:{"Cache-Control":Pe}}})}}let d=_r(n.method),u=b.get(w.pattern);if(!u){let c=s.get("/500")||null;if(c){let R=b.get(c.pattern);if(R)return new Response(R.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(w.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...T(),"Cache-Control":"public, max-age=60"}});try{let{html:c,boundaries:R,redirect:j,cookies:N,status:I,headers:D}=await Nt(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(j)return ho(j,N,D);if(R&&R.length>0){let{renderStreamingPage:P,streamToResponse:z}=await import("./chunk-0p9pwd61.js"),X=new Headers({...T(),...D,"Cache-Control":"private, no-store"});for(let V of N??[])X.append("Set-Cookie",V);if(E&&!d){let V=Ce(c);X.set("X-STX-Fragment","true"),X.set("X-STX-Runtime",le(c)?"true":"false"),X.set("X-STX-Layout",V.layout),X.set("X-STX-Layout-Group",V.group)}return z(P(E&&!d?se(c,r.routerContainer||"main"):c,R,{timeoutMs:30000}),{status:I??u.status??200,headers:X})}let x=new Headers({"Content-Type":"text/html",...T(),...O.cache?{}:{"Cache-Control":"private, no-store"}});for(let P of N??[])x.append("Set-Cookie",P);for(let[P,z]of Object.entries(D??{}))x.set(P,z);if(x.set("Vary",T(x.get("Vary")).Vary),E&&!d){let P=Ce(c);return x.set("X-STX-Fragment","true"),x.set("X-STX-Runtime",le(c)?"true":"false"),x.set("X-STX-Layout",P.layout),x.set("X-STX-Layout-Group",P.group),new Response(se(c,r.routerContainer||"main"),{status:I??u.status??200,headers:x})}return new Response(c,{status:I??u.status??200,headers:x})}catch(c){if(console.error(`[stx] Hydration error for ${i}:`,c),W)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${L.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${b.size} pre-loaded)`),{port:L.port,stop:()=>{f.invalidate(),L.stop()},invalidate:(n)=>f.invalidate(n)}}
|
|
3
|
+
export{Ot,rl};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{V}from"./chunk-
|
|
3
|
-
`)}catch{return""}})}function
|
|
4
|
-
`)}catch{return""}})}function
|
|
2
|
+
import{V}from"./chunk-0wvsfs4s.js";function g(e,t){let r={};for(let n of e)r[n]=V(t(n));return new Proxy({},{get:(n,a)=>r[a]?.(),set:(n,a,o)=>{if(r[a])r[a].set(o);else r[a]=V(o);return!0},has:(n,a)=>(a in r),deleteProperty:(n,a)=>(delete r[a],!0),ownKeys:()=>Reflect.ownKeys(r),getOwnPropertyDescriptor:(n,a)=>(a in r)?{enumerable:!0,configurable:!0,writable:!0,value:r[a]()}:void 0})}function R(e,t){let r={};for(let n of t)r[n]=e[n];return r}function ko(e,t){let r=Object.keys(e),n=g(r,(i)=>t?.[i]??e[i].getDefaultValue()),a=g(r,()=>[]),o=g(r,()=>!1),c=g(r,()=>!1),f=g(r,()=>!1),s=V(!1);async function u(i){f[i]=!0;let d=await e[i].validate(n[i],n);return a[i]=d,f[i]=!1,d.length===0}async function l(){s.set(!0);let i=await Promise.all(r.map(u));return s.set(!1),i.every(Boolean)}function m(){for(let i of r)n[i]=t?.[i]??e[i].getDefaultValue(),a[i]=[],o[i]=!1,c[i]=!1}function h(i){for(let d of r)if(d in i)n[d]=i[d],c[d]=!0}function b(i,d){n[i]=d,c[i]=!0}function y(i,d=!0){if(o[i]=d,d)u(i)}function p(i){return{value:n[i],errors:a[i],touched:o[i],dirty:c[i],valid:a[i].length===0,validating:f[i]}}function w(i){return async(d)=>{d?.preventDefault?.();for(let v of r)o[v]=!0;if(await l())await i(R(n,r))}}return{values:n,errors:a,touched:o,dirty:c,get isValid(){return r.every((i)=>a[i].length===0)},get isValidating(){return s()||r.some((i)=>f[i])},get isDirty(){return r.some((i)=>c[i])},validate:l,validateField:u,reset:m,setValues:h,setFieldValue:b,setFieldTouched:y,getFieldState:p,handleSubmit:w}}var Na=ko;class Kt{rules=[];defaultValue="";addRule(e){let t=new Kt;return t.rules=[...this.rules,e],t.defaultValue=this.defaultValue,t}required(e="This field is required"){return this.addRule({name:"required",message:e,validate:(t)=>{if(t===null||t===void 0)return e;if(typeof t==="string"&&t.trim()==="")return e;if(Array.isArray(t)&&t.length===0)return e;return!0}})}email(e="Please enter a valid email"){return this.addRule({name:"email",message:e,validate:(t)=>{if(!t)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t))||e}})}url(e="Please enter a valid URL"){return this.addRule({name:"url",message:e,validate:(t)=>{if(!t)return!0;try{return new URL(String(t)),!0}catch{return e}}})}min(e,t){let r=t||`Must be at least ${e} characters`;return this.addRule({name:"min",message:r,validate:(n)=>{if(!n)return!0;return String(n).length>=e||r}})}max(e,t){let r=t||`Must be no more than ${e} characters`;return this.addRule({name:"max",message:r,validate:(n)=>{if(!n)return!0;return String(n).length<=e||r}})}length(e,t,r){let n=r||`Must be between ${e} and ${t} characters`;return this.addRule({name:"length",message:n,validate:(a)=>{if(!a)return!0;let o=String(a).length;return o>=e&&o<=t||n}})}pattern(e,t="Invalid format"){return this.addRule({name:"pattern",message:t,validate:(r)=>{if(!r)return!0;return e.test(String(r))||t}})}hasUppercase(e="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,e)}hasLowercase(e="Must contain a lowercase letter"){return this.pattern(/[a-z]/,e)}hasNumber(e="Must contain a number"){return this.pattern(/\d/,e)}hasSpecial(e="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,e)}alphanumeric(e="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,e)}startsWithLetter(e="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,e)}noSpaces(e="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:e,validate:(t)=>{if(!t)return!0;return!String(t).includes(" ")||e}})}number(e="Must be a number"){let t=this.addRule({name:"number",message:e,validate:(r)=>{if(!r&&r!==0)return!0;return!Number.isNaN(Number(r))||e}});return t.defaultValue=0,t}integer(e="Must be a whole number"){return this.addRule({name:"integer",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number.isInteger(Number(t))||e}})}positive(e="Must be a positive number"){return this.addRule({name:"positive",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)>0||e}})}negative(e="Must be a negative number"){return this.addRule({name:"negative",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)<0||e}})}minValue(e,t){let r=t||`Must be at least ${e}`;return this.addRule({name:"minValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)>=e||r}})}maxValue(e,t){let r=t||`Must be no more than ${e}`;return this.addRule({name:"maxValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)<=e||r}})}between(e,t,r){let n=r||`Must be between ${e} and ${t}`;return this.addRule({name:"between",message:n,validate:(a)=>{if(!a&&a!==0)return!0;let o=Number(a);return o>=e&&o<=t||n}})}matches(e,t){let r=t||`Must match ${e}`;return this.addRule({name:"matches",message:r,validate:(n,a)=>{if(!a)return!0;return n===a[e]||r}})}oneOf(e,t){let r=t||`Must be one of: ${e.join(", ")}`;return this.addRule({name:"oneOf",message:r,validate:(n)=>{if(!n)return!0;return e.includes(n)||r}})}notOneOf(e,t){let r=t||`Cannot be one of: ${e.join(", ")}`;return this.addRule({name:"notOneOf",message:r,validate:(n)=>{if(!n)return!0;return!e.includes(n)||r}})}date(e="Must be a valid date"){return this.addRule({name:"date",message:e,validate:(t)=>{if(!t)return!0;let r=new Date(String(t));return!Number.isNaN(r.getTime())||e}})}before(e,t){let r=new Date(e),n=t||`Must be before ${r.toLocaleDateString()}`;return this.addRule({name:"before",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))<r||n}})}after(e,t){let r=new Date(e),n=t||`Must be after ${r.toLocaleDateString()}`;return this.addRule({name:"after",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))>r||n}})}custom(e,t="Invalid value"){return this.addRule({name:"custom",message:t,validate:e})}async(e,t="Invalid value"){return this.addRule({name:"async",message:t,async:!0,validate:e})}when(e,t){let r=new Kt;r.rules=[...this.rules],r.defaultValue=this.defaultValue;for(let n of t.getRules())r.rules.push({...n,validate:(a,o)=>{if(!e(a,o||{}))return!0;return n.validate(a,o)}});return r}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(e){let t=new Kt;return t.rules=[...this.rules],t.defaultValue=e,t}async validate(e,t){let r=[];for(let n of this.rules){let a=await n.validate(e,t);if(a!==!0)r.push(a)}return r}validateSync(e,t){let r=[];for(let n of this.rules){if(n.async)continue;let a=n.validate(e,t);if(a!==!0)r.push(a)}return r}}var Ll=new Kt;function La(e,t,r){let n=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>c.replace(/\{\{\s*message\s*\}\}/g,l)).join(`
|
|
3
|
+
`)}catch{return""}})}function ja(e,t,r){let n=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>c.replace(/\{\{\s*message\s*\}\}/g,l)).join(`
|
|
4
|
+
`)}catch{return""}})}function Ba(e,t,r){let n=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return c}catch{return""}})}function jl(e,t,r){let n=e;return n=La(n,t,r),n=ja(n,t,r),n=Ba(n,t,r),n}export{ko,Na,Kt,Ll,La,ja,Ba,jl};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{y}from"./chunk-
|
|
2
|
+
import{y}from"./chunk-5tj6expd.js";import{I,It}from"./chunk-6v1gwdbv.js";import{w,We,L,o}from"./chunk-g5t10z04.js";import{ae,wt,vt}from"./chunk-664503e6.js";import{De,Xt,gt,H}from"./chunk-fyxydww2.js";import f from"path";var l=new Map;function v(a,s){for(let n of a.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(n[1])s.add(n[1]);for(let n of a.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let r of(n[1]??"").split(",")){let i=((r.includes(":")?r.split(":").pop():r)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(i))s.add(i)}for(let n of a.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let r of(n[1]??"").split(",")){let c=r.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(c))s.add(c)}}async function id(a){let s;if(a)s=f.resolve(a);else{let t=await o();s=f.resolve(t.root||process.cwd(),t.storesDir||"stores")}let n=new Bun.Glob("*.ts"),r=[];try{for await(let t of n.scan({cwd:s,absolute:!0})){let e=f.basename(t,".ts");if(["index","types"].includes(e))continue;if(t.includes(".d.ts"))continue;r.push(t)}}catch{return H(l,s,"",""),null}let c=()=>[...new Set([...r,...r.flatMap((t)=>ae(t))])],i=De(c()),d=gt(l,s,i);if(d!==void 0)return d||null;if(r.length===0)return H(l,s,i,""),null;let p=[];for(let t of r){let e=await Bun.file(t).text();p.push({file:t,hasUseStore:/useStore\s*\(/.test(e)})}p.sort((t,e)=>{if(t.hasUseStore===e.hasUseStore)return 0;return t.hasUseStore?1:-1});let h=p.map((t)=>t.file),u=[],m=new Set,b=L({loader:"ts",target:"browser",define:w()});for(let t of h)try{let e=await Bun.file(t).text(),x=f.basename(t,".ts");if(v(e,m),wt(e))e=await vt(e,t,{projectRoot:process.cwd(),externalizeUserModules:!1});e=We(e),e=I(e),e=It(e),e=e.replace(/^export\s+(default\s+)?/gm,""),e=b.transformSync(e),u.push(`// Store: ${x}
|
|
3
3
|
${e.trim()}`)}catch(e){console.warn(`[stx] Failed to load store ${t}:`,e)}if(u.length===0)return H(l,s,i,""),null;let g=u.join(`
|
|
4
4
|
|
|
5
5
|
`),S=`;(function(){
|
|
@@ -7,5 +7,5 @@ var __stx = window.stx || {};
|
|
|
7
7
|
${y.filter((t)=>!m.has(t)&&new RegExp(`\\b${t}\\b`).test(g)).map((t)=>`var ${t} = __stx[${JSON.stringify(t)}];`).join(`
|
|
8
8
|
`)}
|
|
9
9
|
${g}
|
|
10
|
-
})();`;return i=
|
|
11
|
-
export{
|
|
10
|
+
})();`;return i=De(c()),H(l,s,i,S),S}function ad(){l.clear(),Xt()}
|
|
11
|
+
export{id,ad};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ms,cu,lu,Oi,ge,Hc,ar,du,uu,pu,fu,gu,mu,hu,yu,bu}from"./chunk-9sqjmd9a.js";import"./chunk-tkeabv04.js";export{mu as applyHead,du as definePageMeta,Ms as getHead,cu as getPageMeta,ge as mergeHeadConfigs,hu as processHeadDirective,bu as processMetaDirective,yu as processTitleDirective,gu as renderBodyAttrs,pu as renderHead,fu as renderHtmlAttrs,lu as resetHead,ar as seoMetaToHeadConfig,Oi as useHead,uu as usePageTitle,Hc as useSeoMeta,uu as useTitle};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Rt,C}from"./chunk-p8yh7mgr.js";import m from"fs";import e from"path";async function pn(r,o,i){if(r.__stx_runtime_config)return;let n=Rt();if(n||i){r.__stx_runtime_config=n??C(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-3w49r16x.js"),c=await f(t);if(c.runtimeConfig)r.__stx_runtime_config=C(c.runtimeConfig);return}let s=e.dirname(t);if(s===t)return;t=s}}async function Ts(r,o){function i(n){if(n===null)return"null";if(Array.isArray(n))return`Array<${n.length?[...new Set(n.map(i))].join(" | "):"unknown"}>`;if(typeof n==="object")return`{ ${Object.entries(n).map(([t,s])=>`readonly ${JSON.stringify(t)}: ${i(s)}`).join("; ")} }`;return typeof n}await Bun.write(e.join(r,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
|
|
3
3
|
declare module '@stacksjs/stx/runtime-config' { interface PublicRuntimeConfig ${i(o.public??{})} }
|
|
4
4
|
`),await Bun.write(e.join(r,".stx/runtime-config-server.d.ts"),`import '@stacksjs/stx/runtime-config-server'
|
|
5
5
|
declare module '@stacksjs/stx/runtime-config-server' { interface PrivateRuntimeConfig ${i(o.private??{})} }
|
|
6
6
|
`)}
|
|
7
|
-
export{
|
|
7
|
+
export{pn,Ts};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{y}from"./chunk-
|
|
2
|
+
import{y}from"./chunk-5tj6expd.js";import{I,It}from"./chunk-6v1gwdbv.js";import{Wo,m,h,w,We,L,o}from"./chunk-g5t10z04.js";import{ae,wt,vt}from"./chunk-664503e6.js";import{De,Xt,gt,H}from"./chunk-fyxydww2.js";import S from"path";var C=new Map,D=new Map,k=m(64),A=new Map,X=["composables","functions"];function U(t){let n=S.basename(t,".ts");return n==="index"||n==="types"||t.endsWith(".d.ts")}async function Z(t){if(t)return S.resolve(t);let n=`<default>:${process.cwd()}`,a=A.get(n);if(a!==void 0)return a;let e=await q();if(e!==null)A.set(n,e);return e}async function q(){let t=await o(),n=t.root||process.cwd(),a=t.composablesDir;if(a)return S.resolve(n,a);for(let e of X){let s=S.resolve(n,e);try{let d=new Bun.Glob("**/*.ts");for await(let c of d.scan({cwd:s,absolute:!0}))if(!U(c))return s}catch{}}return null}async function z(t){let n=Array.isArray(t)?t:t?[S.resolve(t)]:(await o())._layerComposableDirs??[await Z()].filter((e)=>!!e),a=new Map;for(let e of n){let s=new Bun.Glob("**/*.ts");try{for await(let d of s.scan({cwd:e,absolute:!0})){let c=S.relative(e,d);if(!U(d)&&!a.has(c))a.set(c,d)}}catch{}}return{key:n.join("\x00"),files:[...a.values()].sort()}}async function Br(t){let{files:n}=await z(t),a=L({loader:"ts",target:"browser",define:w()}),e=[];for(let s of n)try{let d=await Bun.file(s).text(),c=a.scan(d).exports.filter((p)=>p!=="default");if(c.length>0)e.push({file:s,names:c})}catch{}return e}function Q(t,n){return new RegExp(`\\b${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(t)}function G(t,n){let a=new Set(t.match(/\w+/g)),e=new Set;for(let s of n)if(/^\w+$/.test(s)?a.has(s):Q(t,s))e.add(s);return e}var T=m(64);function V(t,n){let a=h(t,n.size),e=T.get(a);if(e)return e;let s;try{s=Wo(t,n)}catch{s=G(t,n)}let d=[...t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}\s*=\s*window\.__composables\u0008/g),...t.matchAll(/import\s*\{([^}]*)\}\s*from\s*['"]@composables['"]/g)];for(let c of d)for(let p of c[1].split(",")){let g=p.trim().split(/\s*(?::|\u0008as\u0008)\s*/)[0];if(g&&n.has(g))s.add(g)}return T.set(a,s),s}function Y(t,n,a){let e=new Map;for(let{file:u,names:l}of t)for(let f of l)if(!e.has(f))e.set(f,u);let s=(u)=>{let l=[];for(let f of G(u,e.keys()))l.push(e.get(f));return l},d=new Set(e.keys()),c=(u)=>{let l=[];for(let f of V(u,d))l.push(e.get(f));return l},p=new Set,g=a.flatMap((u,l)=>l===0?s(u):c(u));while(g.length>0){let u=[];for(let l of g){if(p.has(l))continue;p.add(l);for(let f of c(n.get(l)??""))if(!p.has(f))u.push(f)}g=u}return p}async function Bl(t,n,a){let{key:e,files:s}=await z(t);if(!e)return null;let d=()=>[...new Set([...s,...s.flatMap((r)=>ae(r))])],c=De(d());if(s.length===0)return H(C,e,c,""),null;s.sort();let p=L({loader:"ts",target:"browser",define:w()}),g=gt(D,e,c);if(!g){let r=new Map,i=[];for(let _ of s)try{let x=await Bun.file(_).text();r.set(_,x);let b=p.scan(x).exports.filter((W)=>W!=="default");if(b.length>0)i.push({file:_,names:b})}catch{r.set(_,"")}g=H(D,e,c,{codeByFile:r,modules:i})}let{codeByFile:u,modules:l}=g,f;if(n===void 0)f=new Set(s);else{let r=a?[n,...a]:[n],i=h(r.join("\x00"),e,r.length,c),_=k.get(i);if(f=_??Y(l,u,r),!_)k.set(i,f)}if(f.size===0)return null;let E=s.filter((r)=>f.has(r)),B=`${e}\x00${E.join("\x00")}`,F=gt(C,B,c);if(F!==void 0)return F||null;let M=[],v=new Set,R=new Set;for(let r of E)try{let i=u.get(r)??await Bun.file(r).text(),_=S.basename(r,".ts");for(let b of i.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(b[1])R.add(b[1]);let x=[];try{for(let b of p.scan(i).exports)if(b!=="default")v.add(b),x.push(b)}catch{}if(i=I(i),wt(i))i=await vt(i,r,{projectRoot:process.cwd(),externalizeUserModules:!1,expose:x}),i=We(i);i=It(i),i=i.replace(/^export\s+(default\s+)?/gm,""),i=p.transformSync(i),M.push(`// Composable: ${_}
|
|
3
3
|
${i.trim()}`)}catch(i){console.warn(`[stx] Failed to load composable ${r}:`,i)}if(M.length===0||v.size===0)return H(C,B,c,""),null;let J=[...v].map((r)=>` try { if (!(${JSON.stringify(r)} in __c)) __c[${JSON.stringify(r)}] = ${r}; } catch (e) {}`).join(`
|
|
4
4
|
`),j=JSON.stringify([...v]),N=M.join(`
|
|
5
5
|
|
|
@@ -29,5 +29,5 @@ ${J}
|
|
|
29
29
|
window[__n] = __c[__n];
|
|
30
30
|
__published[__n] = true;
|
|
31
31
|
}
|
|
32
|
-
})();`;return c=
|
|
33
|
-
export{
|
|
32
|
+
})();`;return c=De(d()),H(C,B,c,O),O}function Fl(){C.clear(),Xt(),D.clear(),k.clear(),A.clear()}
|
|
33
|
+
export{Br,Bl,Fl};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var c=0;function l(){return`suspense-${++c}-${Date.now().toString(36)}`}function
|
|
2
|
+
var c=0;function l(){return`suspense-${++c}-${Date.now().toString(36)}`}function Jl(s,n={},t){let e=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return s.replace(e,(r,i,o,d)=>{let u=l(),a=p(i||"");return f(u,o.trim(),d.trim(),a)})}function p(s){let n={},t=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,e;while((e=t.exec(s))!==null){let r=e[1],i=e[2]||e[3],o=e[4];switch(r){case"id":n.id=i;break;case"timeout":n.timeout=o?parseInt(o,10):void 0;break}}return n}function f(s,n,t,e){let r=e.timeout||30000,i=e.id||s;return`
|
|
3
3
|
<div class="stx-suspense" data-suspense-id="${s}" data-custom-id="${i}" data-status="pending">
|
|
4
4
|
<div class="stx-suspense-fallback" data-suspense-fallback="${s}">
|
|
5
5
|
${t}
|
|
@@ -189,7 +189,7 @@ else {
|
|
|
189
189
|
}, 0);
|
|
190
190
|
})();
|
|
191
191
|
</script>
|
|
192
|
-
`}function
|
|
192
|
+
`}function Yl(s,n,t){return{id:s,fallback:t,content:n}}async function Zl(s){let n=s.map((e)=>`
|
|
193
193
|
<div id="stx-ssr-suspense-${e.id}" class="stx-ssr-suspense">
|
|
194
194
|
${e.fallback}
|
|
195
195
|
</div>
|
|
@@ -214,7 +214,7 @@ else {
|
|
|
214
214
|
}
|
|
215
215
|
})();
|
|
216
216
|
</script>
|
|
217
|
-
`}}return{initial:n,streaming:t()}}function
|
|
217
|
+
`}}return{initial:n,streaming:t()}}function Ql(){return`
|
|
218
218
|
/* STX Suspense Styles */
|
|
219
219
|
.stx-suspense {
|
|
220
220
|
position: relative;
|
|
@@ -270,7 +270,7 @@ else {
|
|
|
270
270
|
background-size: 200% 100%;
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
|
-
`}function
|
|
273
|
+
`}function ed(){return`
|
|
274
274
|
// STX Suspense Runtime
|
|
275
275
|
(function() {
|
|
276
276
|
if (typeof window === 'undefined') return;
|
|
@@ -338,4 +338,4 @@ else {
|
|
|
338
338
|
console.log('[stx] Suspense runtime initialized');
|
|
339
339
|
})();
|
|
340
340
|
`}
|
|
341
|
-
export{
|
|
341
|
+
export{Jl,Yl,Zl,Ql,ed};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{qd,Zo,Kd,Qo,pc,fc,Et,an,Xd,gc,mc,hc,f}from"./chunk-g5t10z04.js";import"./chunk-kg77xs08.js";import"./chunk-bpr4bkde.js";import"./chunk-kwvexxey.js";import"./chunk-y4qks0bd.js";import"./chunk-p8yh7mgr.js";import"./chunk-2dzd2h15.js";import"./chunk-9sqjmd9a.js";import"./chunk-tkeabv04.js";import"./chunk-6v1gwdbv.js";import"./chunk-5tj6expd.js";import"./chunk-4gt0r98p.js";import"./chunk-gxfnmjzp.js";export{Et as buildCss,gc as extractClassNames,fc as fingerprintConfig,mc as generateCss,Xd as getCachedCSS,qd as getCssServeAsset,f as injectCss,Zo as loadCssEngine,Qo as loadCssEngineConfig,an as rebuildCss,Kd as resetCssCache,pc as resolveUserCssConfig,hc as withLinkedModuleBundles};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{j,B,F,jt,Y,oe,Dn,da,Ie,ft,Bt,Ft,zt,z,Ht,Vt,On}from"./chunk-2y6tzn6d.js";import"./chunk-458etq5a.js";export{B as DEFAULT_FORMATS,F as DEFAULT_QUALITY,j as DEFAULT_WIDTHS,On as ImageProcessingError,Vt as formatSize,ft as generateSizes,Ie as generateSrcSet,Bt as getFallbackVariant,Dn as getImageMetadata,z as getMimeType,Ht as getTotalSize,Ft as groupVariantsByFormat,Y as isImageBackendAvailable,zt as isImageFile,jt as isSharpAvailable,oe as processImage,da as resizeAndConvert};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ji,so,Yi,Zi,oo,Qi,ea,ta,na,io,ra,il}from"./chunk-q6e45gnw.js";import{yo,la}from"./chunk-38w14qs7.js";import{j,B,F,jt,Y,oe,Dn,Ie,ft,Bt,Ft,zt,z,Ht,Vt,On}from"./chunk-2y6tzn6d.js";import{Fa}from"./chunk-9a73re8k.js";import"./chunk-458etq5a.js";export{B as DEFAULT_FORMATS,F as DEFAULT_QUALITY,j as DEFAULT_WIDTHS,On as ImageProcessingError,Zi as clearImageCache,oo as createImageDirective,la as createImageHandler,ea as createImagePlugin,il as defaultImageConfig,Vt as formatSize,io as generateImageManifest,ft as generateSizes,Ie as generateSrcSet,Bt as getFallbackVariant,Dn as getImageMetadata,z as getMimeType,Ht as getTotalSize,Ft as groupVariantsByFormat,yo as handleImageRequest,Qi as imageDirective,Y as isImageBackendAvailable,zt as isImageFile,jt as isSharpAvailable,na as optimizeDirectory,ta as optimizeImage,so as parseImageComponent,oe as processImage,Yi as processImageComponents,Ji as renderImageComponent,Fa as rewriteImagesWithSiblings,ra as writeImageManifest};
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import S from"fs";import _ from"path";function
|
|
2
|
+
import S from"fs";import _ from"path";function xr(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 no(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 Rn(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 no(u);s.push({path:r,content:new Uint8Array(u),sha1:o})}return s}function Sr(e){let t={};for(let i of e)t[`/${i.path}`]=i.sha1;return t}function kr(e,t){let i=new Set(t.map((s)=>s.startsWith("/")?s.slice(1):s));return e.filter((s)=>i.has(s.path))}function Mt(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 pt(e){return e.reduce((t,i)=>t+i.content.byteLength,0)}import m from"fs";import y from"path";function ro(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 An(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 Pn(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 Cr(e,t){let i=await An(e),s=t||Pn(i),n=ro(s),r=y.join(e,"netlify.toml");return await Bun.write(r,n),r}function Er(e){return m.existsSync(y.join(e,"netlify.toml"))}async function sl(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 Ae(`No Netlify auth token found.
|
|
5
5
|
|
|
6
6
|
To deploy to Netlify:
|
|
7
7
|
1. Create account at https://app.netlify.com
|
|
8
8
|
2. Get token at https://app.netlify.com/user/applications#personal-access-tokens
|
|
9
9
|
3. Set NETLIFY_AUTH_TOKEN environment variable
|
|
10
10
|
|
|
11
|
-
export NETLIFY_AUTH_TOKEN=your_token_here`,"NO_TOKEN");if(!f)throw new
|
|
11
|
+
export NETLIFY_AUTH_TOKEN=your_token_here`,"NO_TOKEN");if(!f)throw new Ae(`No Netlify site ID found.
|
|
12
12
|
|
|
13
13
|
Either:
|
|
14
14
|
1. Set NETLIFY_SITE_ID environment variable
|
|
15
15
|
2. Pass --site-id option
|
|
16
16
|
3. Run \`stx deploy --init\` to set up
|
|
17
17
|
|
|
18
|
-
Find your site ID at: https://app.netlify.com/sites/YOUR_SITE/settings/general`,"NO_SITE_ID");if(!S.existsSync(l))throw new
|
|
18
|
+
Find your site ID at: https://app.netlify.com/sites/YOUR_SITE/settings/general`,"NO_SITE_ID");if(!S.existsSync(l))throw new Ae(`Build directory not found: ${l}
|
|
19
19
|
|
|
20
|
-
Run \`stx build\` first or specify a different directory with --directory`,"NO_BUILD_DIR");if(!(S.readdirSync(l).length>0))throw new
|
|
20
|
+
Run \`stx build\` first or specify a different directory with --directory`,"NO_BUILD_DIR");if(!(S.readdirSync(l).length>0))throw new Ae(`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 Rn(l),w=pt(c);return n(`Would deploy ${c.length} files (${Mt(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=xr({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 Ae(`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 Rn(l),g=pt(a);if(n(`Found ${a.length} files (${Mt(g)})`),a.length===0)throw new Ae(`No files found in ${l}`,"NO_FILES");let b=Sr(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=kr(a,D.required||[]);if(n(`Uploading ${h.length} files...`),h.length>0){let c=0,w=pt(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 ${Mt(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:pt(h)}}async function ol(e={}){let t=e.directory||process.cwd(),i;if(Er(t))i=_.join(t,"netlify.toml");else{let s=await An(t);i=await Cr(t,Pn(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
|
-
`,await Bun.write(s,n)}return{configPath:i,siteId:e.siteId}}class
|
|
30
|
-
export{
|
|
29
|
+
`,await Bun.write(s,n)}return{configPath:i,siteId:e.siteId}}class Ae 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{xr,no,Rn,Sr,kr,Mt,pt,ro,An,Pn,Cr,Er,sl,ol,Ae};
|