@stacksjs/stx 0.2.888 → 0.2.890
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-c0g30cjs.js → chunk-05x1rd86.js} +2 -2
- package/dist/{chunk-6qq3wy3m.js → chunk-062qfv99.js} +2 -2
- package/dist/{chunk-s29hp1qw.js → chunk-0jdz31q1.js} +3 -3
- package/dist/{chunk-1kc0jyhj.js → chunk-0jkj8thz.js} +1 -1
- package/dist/chunk-0k437z3q.js +2 -0
- package/dist/chunk-0q0nbq50.js +2 -0
- package/dist/{chunk-5ysv0499.js → chunk-0wp23n1d.js} +1 -1
- package/dist/{chunk-9f31gs4m.js → chunk-115bb91s.js} +2 -2
- package/dist/chunk-12cjs6vs.js +2 -0
- package/dist/chunk-1a7a8cjs.js +2 -0
- package/dist/{chunk-wpa3r3b9.js → chunk-1bft48gk.js} +2 -2
- package/dist/{chunk-9tecekzq.js → chunk-1jtsr42q.js} +18 -18
- package/dist/{chunk-vazk5qbh.js → chunk-1knk403z.js} +2 -2
- package/dist/chunk-1p4q6t48.js +2 -0
- package/dist/chunk-1ph2yhfn.js +3 -0
- package/dist/{chunk-c1b0fy70.js → chunk-1t15z230.js} +5 -5
- package/dist/{chunk-2assyczz.js → chunk-1w0bqqh5.js} +2 -2
- package/dist/chunk-1z6pqvmf.js +2 -0
- package/dist/chunk-2nqmw4dv.js +2 -0
- package/dist/{chunk-e9tjxnhn.js → chunk-2xnbdqy4.js} +5 -5
- package/dist/chunk-35j7gaj5.js +2 -0
- package/dist/chunk-3b3mkgpj.js +3 -0
- package/dist/{chunk-7mcs59pr.js → chunk-3bsz7zj3.js} +2 -2
- package/dist/{chunk-w624s5jf.js → chunk-3qk8vf9m.js} +3 -3
- package/dist/chunk-3yvmaphj.js +2 -0
- package/dist/{chunk-mk6thhwf.js → chunk-40k0r6z9.js} +2 -2
- package/dist/{chunk-6t04tqvh.js → chunk-41z7f41b.js} +2 -2
- package/dist/chunk-44teqn0b.js +2 -0
- package/dist/{chunk-372xh1g1.js → chunk-49xwf7dk.js} +6 -6
- package/dist/chunk-4akw3bym.js +2 -0
- package/dist/chunk-4d85str1.js +2 -0
- package/dist/{chunk-whsdyf4t.js → chunk-4eescf3s.js} +7 -7
- package/dist/chunk-4xbtxeak.js +2 -0
- package/dist/chunk-53kcqdjj.js +2 -0
- package/dist/{chunk-1xpq83mc.js → chunk-67j2m620.js} +4 -4
- package/dist/chunk-690518hw.js +2 -0
- package/dist/chunk-6s3jwysv.js +2 -0
- package/dist/{chunk-znnvq1jp.js → chunk-6svc4kb8.js} +65 -65
- package/dist/chunk-732gb689.js +2 -0
- package/dist/{chunk-ah6nc29h.js → chunk-80ky40mm.js} +2 -2
- package/dist/chunk-80xzjxah.js +2 -0
- package/dist/chunk-850tye3c.js +2 -0
- package/dist/{chunk-b8528fra.js → chunk-8ccgty8s.js} +4 -4
- package/dist/{chunk-btsgt6w3.js → chunk-8f8qgjjr.js} +2 -2
- package/dist/{chunk-ry6w43p6.js → chunk-8hwfdwgn.js} +6 -6
- package/dist/chunk-9344rq4r.js +38 -0
- package/dist/chunk-94j4p584.js +2 -0
- package/dist/{chunk-y76znqmh.js → chunk-97snfzsy.js} +54 -54
- package/dist/chunk-9a9cec4x.js +2 -0
- package/dist/chunk-9afkttvz.js +2 -0
- package/dist/{chunk-0hj5apb9.js → chunk-9rjgq8k4.js} +1 -1
- package/dist/chunk-a0aqs5a8.js +3 -0
- package/dist/{chunk-9qrgdekg.js → chunk-a3zrwky3.js} +16 -16
- package/dist/{chunk-care745q.js → chunk-a7bqrjm5.js} +2 -2
- package/dist/{chunk-pm4kn9h2.js → chunk-adsqckg4.js} +10 -10
- package/dist/chunk-ah8az9vv.js +2 -0
- package/dist/{chunk-605g9qhp.js → chunk-aj5tsksz.js} +9 -9
- package/dist/chunk-amb7e0fp.js +2 -0
- package/dist/chunk-arr79m90.js +2 -0
- package/dist/{chunk-55kwxxm5.js → chunk-b0hj8eg2.js} +2 -2
- package/dist/{chunk-r57jz09p.js → chunk-bgfs3mbg.js} +5 -5
- package/dist/chunk-bm0mzk3b.js +2 -0
- package/dist/{chunk-ymqm898x.js → chunk-bvqgq18r.js} +2 -2
- package/dist/{chunk-wbxmn5gk.js → chunk-bw2m1e7g.js} +5 -5
- package/dist/{chunk-wm287dz2.js → chunk-c25q87ys.js} +3 -3
- package/dist/{chunk-98mj0es1.js → chunk-ch9028z3.js} +1 -1
- package/dist/{chunk-sbwvvjkc.js → chunk-cmg9x1ka.js} +3 -3
- package/dist/{chunk-11fxbd71.js → chunk-cphc60zw.js} +2 -2
- package/dist/{chunk-dj9ztcth.js → chunk-dvjv4c3a.js} +1 -1
- package/dist/{chunk-v8e2c2r1.js → chunk-e16ef18k.js} +2 -2
- package/dist/chunk-e28czxw3.js +2 -0
- package/dist/chunk-e8szp5wa.js +2 -0
- package/dist/chunk-eq86wzhr.js +1314 -0
- package/dist/chunk-essd43ad.js +2 -0
- package/dist/chunk-f60k8j9m.js +2 -0
- package/dist/chunk-fsk3rk2x.js +2 -0
- package/dist/{chunk-fce8wj3t.js → chunk-g3vce7ka.js} +2 -2
- package/dist/{chunk-em6fqvjy.js → chunk-g5nfqzfh.js} +2 -2
- package/dist/chunk-gfea8a9y.js +2 -0
- package/dist/chunk-hda7t8g6.js +2 -0
- package/dist/chunk-hk241gt2.js +2 -0
- package/dist/{chunk-c3ca056p.js → chunk-htx5yezj.js} +2 -2
- package/dist/{chunk-b0jekg4c.js → chunk-hxws025y.js} +3 -3
- package/dist/chunk-hyyh7qxw.js +25 -0
- package/dist/chunk-j6fs31va.js +2 -0
- package/dist/chunk-j9kejcrx.js +2 -0
- package/dist/chunk-j9vfv53x.js +20 -0
- package/dist/chunk-jhbz5w30.js +2 -0
- package/dist/chunk-jvnsz2x9.js +2 -0
- package/dist/chunk-k4x680e3.js +2 -0
- package/dist/chunk-k8bk685s.js +2 -0
- package/dist/chunk-kexqmwx8.js +2 -0
- package/dist/chunk-kfdmm240.js +2 -0
- package/dist/{chunk-fepezvdq.js → chunk-kg7vby72.js} +8 -8
- package/dist/{chunk-wf8pdjq5.js → chunk-khm56bfm.js} +1 -1
- package/dist/{chunk-303vzq80.js → chunk-kk2p2tgv.js} +3 -3
- package/dist/chunk-kpjq135z.js +2 -0
- package/dist/chunk-kqsm7gf1.js +2 -0
- package/dist/{chunk-j51wss7s.js → chunk-kr2400c3.js} +4 -4
- package/dist/{chunk-r8xper92.js → chunk-ksmn19qw.js} +2 -2
- package/dist/{chunk-7hm1tpw0.js → chunk-mhrnjaka.js} +6 -6
- package/dist/chunk-mtfymhy1.js +2 -0
- package/dist/{chunk-52mhrbps.js → chunk-n6q1d66k.js} +1 -1
- package/dist/chunk-neg6ckjg.js +12 -0
- package/dist/{chunk-wscry63p.js → chunk-nhv81gp2.js} +2 -2
- package/dist/{chunk-c73c0wf9.js → chunk-nq60tjkz.js} +2 -2
- package/dist/{chunk-v47xc2fr.js → chunk-nzpb263k.js} +9 -9
- package/dist/{chunk-p33npqjt.js → chunk-p0bjbtdx.js} +33 -33
- package/dist/{chunk-gdtj5rfa.js → chunk-p3hbsrk9.js} +6 -6
- package/dist/chunk-p82fzxdg.js +2 -0
- package/dist/{chunk-0d7ypcjb.js → chunk-pjj54ddk.js} +3 -3
- package/dist/{chunk-qsnpqa8q.js → chunk-pnmafbv5.js} +1 -1
- package/dist/{chunk-vgsasnwm.js → chunk-pvm48tse.js} +3 -3
- package/dist/{chunk-zek9t5za.js → chunk-pwpge9bj.js} +2 -2
- package/dist/{chunk-6zq3eh7d.js → chunk-q0y8gv18.js} +2 -2
- package/dist/{chunk-7s3j8pqq.js → chunk-qnf7w4xw.js} +3 -3
- package/dist/chunk-qsv84cwm.js +2 -0
- package/dist/{chunk-xavx271y.js → chunk-r5ecgcx2.js} +5 -5
- package/dist/chunk-r7m60q1m.js +2 -0
- package/dist/chunk-r98pye4h.js +2 -0
- package/dist/{chunk-zf29ahhd.js → chunk-rb2zbdqd.js} +4 -4
- package/dist/{chunk-vjfp8n6p.js → chunk-rd663v1m.js} +3 -3
- package/dist/{chunk-4nnmrp7w.js → chunk-rf0smj4c.js} +2 -2
- package/dist/{chunk-0dq9svfb.js → chunk-sh7a0g09.js} +3 -3
- package/dist/chunk-snkbn5y8.js +2 -0
- package/dist/chunk-sztr4d5g.js +2 -0
- package/dist/{chunk-4c9p434g.js → chunk-t0ttxayz.js} +2 -2
- package/dist/{chunk-5ymf5c8m.js → chunk-t3zmfh8w.js} +7 -7
- package/dist/chunk-t4gcsbna.js +2 -0
- package/dist/chunk-tbh7r1wh.js +2 -0
- package/dist/chunk-tspqdt8e.js +2 -0
- package/dist/{chunk-6fsnnj5v.js → chunk-v1mwwben.js} +6 -6
- package/dist/chunk-v3jyb8k6.js +2 -0
- package/dist/chunk-v6gkjg5f.js +3 -0
- package/dist/chunk-v90nz5xm.js +54 -0
- package/dist/{chunk-7nhgpjjw.js → chunk-vf4ejngv.js} +6 -6
- package/dist/chunk-vfcbz0an.js +3 -0
- package/dist/{chunk-hxhmhw23.js → chunk-vk2jy6mn.js} +3 -3
- package/dist/{chunk-e1qcfesw.js → chunk-vkfw9k1n.js} +8 -8
- package/dist/{chunk-mm1eg2pg.js → chunk-vxbvrbqs.js} +10 -10
- package/dist/chunk-wedwczed.js +2 -0
- package/dist/chunk-wg6fmren.js +4 -0
- package/dist/{chunk-s7wp7a2x.js → chunk-whcrca58.js} +31 -31
- package/dist/chunk-wmvvrsn0.js +2 -0
- package/dist/chunk-wnrh62by.js +2 -0
- package/dist/{chunk-q3bkxg2n.js → chunk-wy6vjz1e.js} +21 -21
- package/dist/{chunk-mbm3ma63.js → chunk-x5bn2svk.js} +2 -2
- package/dist/chunk-x6565mhk.js +2 -0
- package/dist/{chunk-brzjass3.js → chunk-xc5esqcb.js} +2 -2
- package/dist/{chunk-e2ws79vt.js → chunk-xeyq6d0t.js} +8 -8
- package/dist/{chunk-xw291tn7.js → chunk-xmg6bmh6.js} +27 -22
- package/dist/{chunk-3fbgpv1d.js → chunk-xvncq3m5.js} +2 -2
- package/dist/chunk-xwgdcc7w.js +2 -0
- package/dist/chunk-xwrjre34.js +2 -0
- package/dist/{chunk-1wkp3pks.js → chunk-xy8smv5e.js} +2 -2
- package/dist/{chunk-y8p59h6c.js → chunk-y1d3j2j7.js} +4 -4
- package/dist/{chunk-zje94z0k.js → chunk-yesh4dfe.js} +61 -61
- package/dist/chunk-ymc1wgb3.js +2 -0
- package/dist/{chunk-xy4j8t7w.js → chunk-ytjn0gq2.js} +2 -2
- package/dist/chunk-z4tdnfxd.js +2 -0
- package/dist/{chunk-w1q86c89.js → chunk-zf68afyh.js} +3 -3
- package/dist/{chunk-6c1vm6bs.js → chunk-zkwkhesc.js} +2 -2
- package/dist/{chunk-2rmqmajd.js → chunk-zpqjsnz9.js} +3 -3
- package/dist/{chunk-vgr7gd8k.js → chunk-zwqkbk2m.js} +2 -2
- package/dist/chunk-zxjdfgdx.js +3 -0
- package/dist/cli.js +29 -29
- package/dist/component-contract.d.ts +1 -0
- package/dist/component-contract.js +6 -4
- package/dist/component-library.d.ts +2 -1
- package/dist/component-library.js +218 -348
- package/dist/composition-api.d.ts +7 -1
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/directive-arguments.js +39 -6
- package/dist/emits-declaration.d.ts +9 -0
- package/dist/emits-declaration.js +64 -0
- package/dist/parser/tokenizer.d.ts +2 -1
- package/dist/parser/tokenizer.js +7 -5
- package/dist/props-declaration.d.ts +66 -0
- package/dist/props-declaration.js +379 -0
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +28 -28
- package/dist/utils.js +20 -109
- package/package.json +5 -5
- package/dist/chunk-000mwmfq.js +0 -1203
- package/dist/chunk-043d0en0.js +0 -2
- package/dist/chunk-0w66z6eq.js +0 -2
- package/dist/chunk-13wd9gf0.js +0 -3
- package/dist/chunk-1znqedae.js +0 -2
- package/dist/chunk-2drzzjcm.js +0 -2
- package/dist/chunk-3c7nt5qp.js +0 -2
- package/dist/chunk-3ed2erm6.js +0 -12
- package/dist/chunk-3zyzhcd9.js +0 -2
- package/dist/chunk-44rb9fk0.js +0 -2
- package/dist/chunk-472j3bhp.js +0 -2
- package/dist/chunk-4acce1m8.js +0 -2
- package/dist/chunk-4kasmp98.js +0 -2
- package/dist/chunk-53kkjn23.js +0 -2
- package/dist/chunk-5gwvy612.js +0 -2
- package/dist/chunk-61vbqrde.js +0 -2
- package/dist/chunk-6fpzwryt.js +0 -2
- package/dist/chunk-7195598h.js +0 -2
- package/dist/chunk-7zvf79vb.js +0 -2
- package/dist/chunk-88a735jw.js +0 -2
- package/dist/chunk-8v7yjq3b.js +0 -2
- package/dist/chunk-94mpe1ny.js +0 -3
- package/dist/chunk-97kgrevs.js +0 -4
- package/dist/chunk-a8c9j9cj.js +0 -2
- package/dist/chunk-acw851e8.js +0 -2
- package/dist/chunk-andfvr3g.js +0 -2
- package/dist/chunk-aqxh80vh.js +0 -2
- package/dist/chunk-ay5zkfdg.js +0 -2
- package/dist/chunk-b4gptdtc.js +0 -2
- package/dist/chunk-baaw9w7y.js +0 -2
- package/dist/chunk-bw2p9h2g.js +0 -2
- package/dist/chunk-ce0vv7kz.js +0 -2
- package/dist/chunk-d1yj29g2.js +0 -2
- package/dist/chunk-dbhmbef1.js +0 -20
- package/dist/chunk-dfsykk1r.js +0 -2
- package/dist/chunk-e9p596bp.js +0 -2
- package/dist/chunk-edysherg.js +0 -25
- package/dist/chunk-ftecsa8e.js +0 -2
- package/dist/chunk-ge2h5v46.js +0 -2
- package/dist/chunk-gqvnz8a7.js +0 -2
- package/dist/chunk-j41gp8p3.js +0 -2
- package/dist/chunk-jxvccj30.js +0 -2
- package/dist/chunk-k5bbre7d.js +0 -2
- package/dist/chunk-kd47vgs8.js +0 -2
- package/dist/chunk-keqjafdz.js +0 -2
- package/dist/chunk-kvxdyg7e.js +0 -3
- package/dist/chunk-kz3mejc4.js +0 -2
- package/dist/chunk-ngkh0t5b.js +0 -2
- package/dist/chunk-nx9895m6.js +0 -2
- package/dist/chunk-nxgtt1t1.js +0 -2
- package/dist/chunk-nyw2ztar.js +0 -2
- package/dist/chunk-p5q27adr.js +0 -2
- package/dist/chunk-p6hcrg3r.js +0 -3
- package/dist/chunk-pa2vt2ej.js +0 -2
- package/dist/chunk-pczb7xav.js +0 -2
- package/dist/chunk-ps37r6hj.js +0 -2
- package/dist/chunk-pvbhk17r.js +0 -2
- package/dist/chunk-q252qvsy.js +0 -2
- package/dist/chunk-q5b0vpmm.js +0 -2
- package/dist/chunk-qg1kw5yf.js +0 -2
- package/dist/chunk-qjy5yq25.js +0 -54
- package/dist/chunk-r561zt9v.js +0 -38
- package/dist/chunk-sbr85vda.js +0 -2
- package/dist/chunk-tkab24xr.js +0 -2
- package/dist/chunk-vn59yrjh.js +0 -2
- package/dist/chunk-w50yggy3.js +0 -3
- package/dist/chunk-w5zzwe2f.js +0 -2
- package/dist/chunk-wa9q1gyv.js +0 -2
- package/dist/chunk-wbmx0rge.js +0 -2
- package/dist/chunk-wpgxhrd7.js +0 -2
- package/dist/chunk-x3azrbpr.js +0 -2
- package/dist/chunk-x50hk1hq.js +0 -2
- package/dist/chunk-xbkbvfcg.js +0 -2
- package/dist/chunk-z55rpt3s.js +0 -3
- package/dist/chunk-zwde52kw.js +0 -2
- package/dist/chunk-zxff7kq9.js +0 -2
package/dist/ssg.js
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
3
|
-
`)}function V(e){return async()=>({paths:await e(),fallback:!1})}var
|
|
2
|
+
import"./chunk-0jdz31q1.js";import"./chunk-3b3mkgpj.js";import"./chunk-115bb91s.js";import{_,Rl}from"./chunk-xmg6bmh6.js";import"./chunk-cphc60zw.js";import"./chunk-vk2jy6mn.js";import{Vt,x}from"./chunk-eq86wzhr.js";import"./chunk-41z7f41b.js";import"./chunk-g3vce7ka.js";import"./chunk-q0y8gv18.js";import{Lt,jt,Bt,Ft,zt,Ht}from"./chunk-8ccgty8s.js";import{a}from"./chunk-yesh4dfe.js";import{Vs}from"./chunk-t3zmfh8w.js";import"./chunk-rb2zbdqd.js";import"./chunk-2xnbdqy4.js";import{Te,mn,hn}from"./chunk-j9vfv53x.js";import"./chunk-b0hj8eg2.js";import{S}from"./chunk-adsqckg4.js";import{Pt,i}from"./chunk-6svc4kb8.js";import"./chunk-vkfw9k1n.js";import"./chunk-v90nz5xm.js";import{As}from"./chunk-vxbvrbqs.js";import"./chunk-hyyh7qxw.js";import"./chunk-05x1rd86.js";import{Sc,kc,_c}from"./chunk-kk2p2tgv.js";import{fn,pr,fr}from"./chunk-1ph2yhfn.js";import{gn}from"./chunk-1w0bqqh5.js";import"./chunk-vfcbz0an.js";import"./chunk-80ky40mm.js";import{re,Ae}from"./chunk-kg7vby72.js";import"./chunk-9rjgq8k4.js";import"./chunk-n6q1d66k.js";import"./chunk-qnf7w4xw.js";import{l}from"./chunk-zxjdfgdx.js";import{tt}from"./chunk-a0aqs5a8.js";import{t,h}from"./chunk-neg6ckjg.js";import{f}from"./chunk-hxws025y.js";import R from"fs";import w from"path";import{createHash as $t}from"crypto";function kt(e){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return e}}var Dt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function Rt(e){return Bun.hash(e).toString(16)}function lt(e,n={}){if(!e.includes('type="stx/island"'))return{html:e,chunks:[]};let s=new Map,o=e.replace(Dt,(r,u,g,P)=>{let b=P.trim();if(!b)return r;if(/\bdata-stx-src=/.test(g))return r;if(n.minify)b=kt(b);let p=Rt(b);if(!s.has(p))s.set(p,b);let k=n.integrity?` data-stx-integrity="sha384-${$t("sha384").update(b).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${u}" data-stx-src="/_stx/islands/${p}.js"${k}${g}></script>`}),c=Array.from(s,([r,u])=>({hash:r,code:u}));return{html:o,chunks:c}}var Et=new Set(["visible","idle"]);function ut(e){if(!e.includes("data-stx-src="))return e;let n=new Map,s=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,o;while((o=s.exec(e))!==null)n.set(o[1],o[2]);let c=new Set,r=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,u;while((u=r.exec(e))!==null)if(Et.has(n.get(u[1])||""))c.add(u[2]);let g=/<\/head\s*>/iy,P=x(e,(p,k)=>(g.lastIndex=k,g.exec(p)?g.lastIndex:-1))[0]?.start??-1;if(c.size===0||P===-1)return e;let b=Array.from(c).filter((p)=>!e.includes(`rel="prefetch" href="${p}"`)).map((p)=>`<link rel="prefetch" href="${p}" as="script">`).join("");if(!b)return e;return e.slice(0,P)+b+e.slice(P)}var Ct=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function Y(e){let n=e.trim();if(!n)return null;let s=/^https?:\/\//i.test(n)?n:`https://${n}`;try{return new URL(s).origin+new URL(s).pathname.replace(/\/$/,"")}catch{return null}}function It(e){for(let n of Ct){let s=e[n];if(!s)continue;let o=Y(s);if(o)return{url:o,source:"env",via:n}}return null}function dt(e){if(!e||typeof e!=="object")return null;let n=e,s=n.site?.url??n.url??n.app?.url;return typeof s==="string"?Y(s):null}async function Tt(e){let{existsSync:n}=await import("fs"),s=await import("path");for(let o of["site.config.ts","site.config.js",".config/site.config.ts"]){let c=s.resolve(e,o);if(!n(c))continue;try{let r=await import(c),u=dt(r.default??r);if(u)return u}catch{}}return null}async function gt(e={}){let n=e.cwd??process.cwd(),s=e.env??process.env;if(e.explicit){let u=Y(e.explicit);if(u)return{url:u,source:"option"}}let o=dt(e.stxConfig);if(o)return{url:o,source:"stx.config",via:"site.url"};let c=await Tt(n);if(c)return{url:c,source:"site.config",via:"url"};let r=It(s);if(r)return r;return{url:"http://localhost",source:"fallback"}}function pt(){return["No site URL configured \u2014 sitemap.xml and robots.txt will point at http://localhost."," Set one in stx.config.ts (site: { url: 'https://example.com' }), in site.config.ts,"," via --domain, or with SITE_URL in the build environment."].join(`
|
|
3
|
+
`)}function V(e){return async()=>({paths:await e(),fallback:!1})}var At;function Ot(e){let n=t(e),{depths:s}=h(n),o=/\b(?:async\s+)?function\s+getStaticPaths\s*\(/g,c;while((c=o.exec(n))!==null){if(s[c.index]!==0)continue;let u=_(n,"(",")",o.lastIndex-1),g=n.indexOf("{",u+1),P=_(n,"{","}",g);if(u<0||g<0||P<0)break;return e.slice(c.index,P+1)}let r=/\b(?:const|let|var)\s+getStaticPaths\s*=/g;while((c=r.exec(n))!==null){if(s[c.index]!==0)continue;let u=Rl(n,r.lastIndex).endPos;return e.slice(r.lastIndex,u).trim()}throw SyntaxError("Could not extract getStaticPaths; use a top-level function or const declaration")}async function ft(e){let n="read";try{let s=await Bun.file(e).text();n="parse";let o=gn(s),c=[...o.server,...o.client,...o.signals].filter((r)=>/(?:^|\s)server(?:\s|=|$)/i.test(t(r.attrs))).sort((r,u)=>s.indexOf(r.fullTag)-s.indexOf(u.fullTag));for(let r of c){if(!/\bgetStaticPaths\b/.test(t(r.content)))continue;let u=(At??=new Bun.Transpiler({loader:"ts",target:"bun"})).transformSync(r.content);if(!/\bgetStaticPaths\b/.test(t(u)))continue;let g=Ot(u);if(/\bdefineStaticPaths\b/.test(t(g))&&Vt(u,"defineStaticPaths"))throw SyntaxError("Cannot evaluate a module-local defineStaticPaths binding during isolated hook extraction");n="execute";let P=Function("defineStaticPaths",`return (${g})`)(V);if(typeof P!=="function")throw TypeError("getStaticPaths must be a function");let b=await P();n="result";let p=Array.isArray(b)?{paths:b}:b;if(!p||typeof p!=="object"||!("paths"in p)||!Array.isArray(p.paths))throw TypeError("getStaticPaths must return { paths: [...] } or an array of paths");for(let k of p.paths)if(!k||typeof k!=="object"||!k.params||typeof k.params!=="object"||Array.isArray(k.params))throw TypeError("Each getStaticPaths path must contain a params object");return{kind:"ok",value:p}}return{kind:"absent"}}catch(s){return{kind:"error",phase:n,error:s instanceof Error?s:Error(String(s))}}}class ht{cacheDir;cache=new Map;loaded=!1;salt;constructor(e,n=""){this.cacheDir=e,this.salt=n}async load(){if(this.loaded)return;let e=w.join(this.cacheDir,"build-cache.json");if(await Bun.file(e).exists())try{let n=JSON.parse(await Bun.file(e).text());for(let[s,o]of Object.entries(n))this.cache.set(s,o)}catch{}this.loaded=!0}async save(){await R.promises.mkdir(this.cacheDir,{recursive:!0});let e=w.join(this.cacheDir,"build-cache.json"),n={};for(let[s,o]of this.cache)n[s]=o;await Bun.write(e,JSON.stringify(n))}getHash(e,n){let s=R.statSync(e),o=`${this.salt}|${e}:${s.mtimeMs}`;for(let r of n)if(R.existsSync(r)){let u=R.statSync(r);o+=`:${r}:${u.mtimeMs}`}let c=0;for(let r=0;r<o.length;r++){let u=o.charCodeAt(r);c=(c<<5)-c+u,c=c&c}return Math.abs(c).toString(36)}get(e,n){let s=this.cache.get(e);if(!s)return null;let o=wt(n).some((u)=>R.existsSync(u)),c=[n,...s.dependencies??[]].some((u)=>u.endsWith(".stx")&&R.existsSync(u)&&As(R.readFileSync(u,"utf8")).some((g)=>/\bserver\b/.test(g.attrs)));if(o||c)return this.cache.delete(e),null;let r=this.getHash(n,s.dependencies??[]);if(s.hash!==r)return this.cache.delete(e),null;return s.html}set(e,n,s,o){let c=this.getHash(n,s);this.cache.set(e,{hash:c,html:o,generatedAt:Date.now(),dependencies:s})}}class mt{cacheDir;constructor(e){this.cacheDir=e}getFilePath(e){let n=e.replace(/[^a-zA-Z0-9]/g,"_")+".json";return w.join(this.cacheDir,"isr",n)}async get(e){let n=this.getFilePath(e);if(!await Bun.file(n).exists())return null;try{return JSON.parse(await Bun.file(n).text())}catch{return null}}async set(e,n){let s=this.getFilePath(e);await R.promises.mkdir(w.dirname(s),{recursive:!0}),await Bun.write(s,JSON.stringify(n))}async invalidate(e){let n=this.getFilePath(e);if(await Bun.file(n).exists())await R.promises.unlink(n)}async invalidatePattern(e){let n=w.join(this.cacheDir,"isr");if(!R.existsSync(n))return;let s=await R.promises.readdir(n);for(let o of s){let c=o.replace(/_/g,"/").replace(".json","");if(e.test(c))await R.promises.unlink(w.join(n,o))}}async needsRevalidation(e){let n=await this.get(e);if(!n)return!0;return Date.now()>n.revalidateAfter}}async function Ut(e){let n=[];if(!e.isDynamic)n.push({url:e.pattern,params:{}});else{let s=await ft(e.filePath);if(s.kind==="error")throw Error(`getStaticPaths ${s.phase} failed for ${e.pattern} (${e.filePath}): ${s.error.message}`,{cause:s.error});if(s.kind==="absent")return console.warn(`Warning: Dynamic route ${e.pattern} (${e.filePath}) has no getStaticPaths`),n;let o=s.value;if(o.paths.length===0)return console.info(`getStaticPaths returned no paths for dynamic route ${e.pattern} (${e.filePath})`),n;for(let c of o.paths){let r=e.pattern;for(let[u,g]of Object.entries(c.params))r=r.replace(`:${u}`,g).replace(`:${u}*`,g);n.push({url:r,params:c.params,props:c.props,revalidate:c.revalidate})}}return n}function wt(e){return[e.replace(/\.stx$/,".data.ts"),e.replace(/\.stx$/,".data.js"),e+".data.ts",e+".data.js"]}async function _t(e){for(let n of wt(e))if(await Bun.file(n).exists())try{let s=await import(n);if(typeof s.default==="function")return await s.default();else if(typeof s.default==="object")return s.default;else if(typeof s.getData==="function")return await s.getData();else{let{default:o,...c}=s;return c}}catch(s){console.error(`Error loading data file ${n}:`,s)}return null}async function Mt(e,n,s){let o=e.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!o)return null;let c=o[1];if(!c.includes("getStaticProps"))return null;try{let r=c.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!r)return null;return await Function("params",`
|
|
4
4
|
return (async function getStaticProps() {
|
|
5
5
|
${r[1]}
|
|
6
6
|
})()
|
|
7
|
-
`)(n)}catch(r){return console.error(`Error executing getStaticProps in ${s}:`,r),null}}function
|
|
8
|
-
resolved against partialsDir: ${
|
|
9
|
-
${
|
|
7
|
+
`)(n)}catch(r){return console.error(`Error executing getStaticProps in ${s}:`,r),null}}function Gt(e){return/(?:^|[^\w$.])(?:export\s+)?(?:async\s+)?function\s+action\s*\(/.test(e)||/(?:^|[^\w$.])(?:export\s+)?(?:const|let|var)\s+action\s*=/.test(e)}async function yt(e,n,s={},o,c){let r=await Bun.file(e.filePath).text(),u=await _t(e.filePath),g=await Mt(r,n,e.filePath),P={...u||{},...g||{},...s,params:n,$route:{path:e.pattern,params:n}},b=new Set,p=[],k=[],C={...c,minifyClient:!0,...o.partialsDir?{partialsDir:o.partialsDir}:{},...o.componentsDir?{componentsDir:o.componentsDir}:{},debug:!1,cache:!1,autoShell:!0,onIncludeError:(E)=>{p.push(`${w.relative(process.cwd(),E.templatePath)}: ${E.message}
|
|
8
|
+
resolved against partialsDir: ${E.partialsDir}`)},onServerScriptError:(E)=>{k.push(`${w.relative(process.cwd(),E.sourcePath)} (${E.kind}): ${E.message}`)}};if(Gt(r))console.warn(`Warning: ${e.pattern} exports a page action, which cannot run in a static build. Its form will submit to a file. Serve this route with the production server, or point the form's action at a route handler.`);let v=await i(r,P,e.filePath,C,b);for(let E of[e.filePath,...b])for(let O of Te(E))b.add(O);if(Object.keys(n).length>0){let E=`<script>if(window.stx)window.stx._rp=${JSON.stringify(n)};else window.__stx_rp=${JSON.stringify(n)};</script>`;if(v.includes("</head>"))v=f(v,E);else v=`${E}
|
|
9
|
+
${v}`}if(v=await Ae(v,{router:o.router}),v=await S(v),o.minify!==!1)return{html:Nt(v),dependencies:Array.from(b),includeFailures:p,serverScriptFailures:k};return{html:v,dependencies:Array.from(b),includeFailures:p,serverScriptFailures:k}}function Nt(e){let n=[],s=0,o=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,c;while((c=o.exec(e))!==null){let u=e.slice(s,c.index);n.push(u.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let g=c[1],P=c[2],b=c[3];P=tt(P).replace(/<\/script/gi,"<\\/script"),n.push(g+P+b),s=c.index+c[0].length}let r=e.slice(s);return n.push(r.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),n.join("").trim()}function Wt(e){let n=0;for(let s=0;s<e.length;s++){let o=e.charCodeAt(s);n=(n<<5)-n+o,n=n&n}return`"${Math.abs(n).toString(36)}"`}function qt(e,n,s,o){if(s?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(n))return!0;return o.some((c)=>{if(c instanceof RegExp)return c.test(e);return c.endsWith("/")?e===c.slice(0,-1)||e.startsWith(c):e===c})}function Jt(e,n){return`<?xml version="1.0" encoding="UTF-8"?>
|
|
10
10
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
11
11
|
${e.map((o)=>{let c=new URL(o.loc,n).href,r=` <url>
|
|
12
|
-
<loc>${
|
|
12
|
+
<loc>${T(c)}</loc>`;if(o.lastmod)r+=`
|
|
13
13
|
<lastmod>${o.lastmod}</lastmod>`;if(o.changefreq)r+=`
|
|
14
14
|
<changefreq>${o.changefreq}</changefreq>`;if(o.priority!==void 0)r+=`
|
|
15
15
|
<priority>${o.priority}</priority>`;return r+=`
|
|
16
16
|
</url>`,r}).join(`
|
|
17
17
|
`)}
|
|
18
|
-
</urlset>`}function
|
|
19
|
-
<title>${
|
|
20
|
-
<link>${
|
|
21
|
-
<description>${
|
|
18
|
+
</urlset>`}function T(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Kt(e,n){let s=n.map((o)=>{let c=" <item>";if(c+=`
|
|
19
|
+
<title>${T(o.title)}</title>`,c+=`
|
|
20
|
+
<link>${T(o.link)}</link>`,o.description)c+=`
|
|
21
|
+
<description>${T(o.description)}</description>`;if(o.pubDate)c+=`
|
|
22
22
|
<pubDate>${o.pubDate.toUTCString()}</pubDate>`;if(o.author)c+=`
|
|
23
|
-
<author>${
|
|
24
|
-
<category>${
|
|
25
|
-
<guid>${
|
|
23
|
+
<author>${T(o.author)}</author>`;if(o.categories)for(let r of o.categories)c+=`
|
|
24
|
+
<category>${T(r)}</category>`;if(o.guid)c+=`
|
|
25
|
+
<guid>${T(o.guid)}</guid>`;return c+=`
|
|
26
26
|
</item>`,c});return`<?xml version="1.0" encoding="UTF-8"?>
|
|
27
27
|
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
|
28
28
|
<channel>
|
|
29
|
-
<title>${
|
|
30
|
-
<link>${
|
|
31
|
-
<description>${
|
|
29
|
+
<title>${T(e.title)}</title>
|
|
30
|
+
<link>${T(e.link)}</link>
|
|
31
|
+
<description>${T(e.description)}</description>
|
|
32
32
|
${e.language?`<language>${e.language}</language>`:""}
|
|
33
|
-
${e.copyright?`<copyright>${
|
|
33
|
+
${e.copyright?`<copyright>${T(e.copyright)}</copyright>`:""}
|
|
34
34
|
<lastBuildDate>${new Date().toUTCString()}</lastBuildDate>
|
|
35
35
|
<atom:link href="${e.link}/rss.xml" rel="self" type="application/rss+xml"/>
|
|
36
36
|
${s.join(`
|
|
37
37
|
`)}
|
|
38
38
|
</channel>
|
|
39
|
-
</rss>`}async function Xt(e={}){let n=Date.now();
|
|
40
|
-
${
|
|
39
|
+
</rss>`}async function Xt(e={}){let n=Date.now();hn();let s=await a(process.cwd()),o=s.build||{},c=await gt({explicit:e.domain||o.domain,stxConfig:s});if(c.source==="fallback"&&(e.sitemap??o.sitemap??!0))console.warn(pt());let r={router:e.router??s?.router??{},pagesDir:e.pagesDir||o.pagesDir||"pages",outputDir:e.outputDir||o.outputDir||"dist",baseUrl:e.baseUrl||o.baseUrl||"/",domain:c.url,revalidate:e.revalidate??o.revalidate??!1,sitemap:e.sitemap??o.sitemap??!0,sitemapExclude:e.sitemapExclude||o.sitemapExclude||[],robots:e.robots??o.robots??!0,rss:e.rss??o.rss??!1,concurrency:e.concurrency||o.concurrency||10,cache:e.cache??o.cache??!0,cacheDir:e.cacheDir||o.cacheDir||l(process.cwd(),"ssg-cache"),contentLoaders:e.contentLoaders||[],hooks:e.hooks||{},minify:e.minify??o.minify??!0,generate404:e.generate404??o.generate404??!0,publicDir:e.publicDir||o.publicDir||"public",trailingSlash:e.trailingSlash??o.trailingSlash??!1,cleanOutput:e.cleanOutput??o.cleanOutput??!0,cacheSalt:e.cacheSalt??"",partialsDir:e.partialsDir||s?.partialsDir||"",componentsDir:e.componentsDir||s?.componentsDir||"",failOnIncludeError:e.failOnIncludeError??!0,failOnServerScriptError:e.failOnServerScriptError??!0,chunkIslands:e.chunkIslands===!0,prefetchIslands:e.prefetchIslands===!0,integrityIslands:e.integrityIslands===!0},u={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},g=new Set,P=0,b={},p={};await r.hooks.onBuildStart?.();try{if(r.cleanOutput&&R.existsSync(r.outputDir))await R.promises.rm(r.outputDir,{recursive:!0});await R.promises.mkdir(r.outputDir,{recursive:!0});let C=r.cacheSalt;if(!C){let{resolveUserCssConfig:d,fingerprintConfig:y}=await import("./chunk-p82fzxdg.js");try{C=y(await d(process.cwd()))}catch{}}let{prepareImageDelivery:v}=await import("./chunk-k8bk685s.js"),E=await v(r.publicDir,r.outputDir);if(E.count>0)console.log(`Optimized ${E.count} image(s) for responsive delivery`),C=[C,E.fingerprint].filter(Boolean).join(":");let O=new ht(r.cacheDir,C);if(r.cache)await O.load();try{let{generateCss:d}=await import("./chunk-p82fzxdg.js");await d('<div class="bg-black"></div>')}catch{}Lt();let St=s?.routeMiddleware?.dir||"middleware";await Bt(process.cwd(),St);let K=jt();if(K.length>0)console.log(`Loaded ${K.length} middleware: ${K.join(", ")}`);let xt=s?.routeMiddleware?.global||[];_c(s?.layoutsDir,l(process.cwd()));let Q=re(".",{pagesDir:r.pagesDir,pagesDirs:s?._layerPageDirs});console.log(`Found ${Q.length} routes`);let U=[];for(let d of Q)try{let y=await Ut(d);for(let D of y)U.push({route:d,url:D.url,params:D.params,props:D.props,revalidate:D.revalidate??r.revalidate})}catch(y){let D=y instanceof Error?y:Error(String(y));u.failedCount++,u.errors.push({route:d.pattern,error:D}),await r.hooks.onError?.(D,d.pattern),console.error(`Error discovering paths for ${d.pattern}:`,D)}u.totalPages=U.length+u.failedCount,console.log(`Generating ${U.length} pages...`);let M=[],et=[];for(let d=0;d<U.length;d+=r.concurrency)et.push(U.slice(d,d+r.concurrency));for(let d of et)await Promise.all(d.map(async(y)=>{let{route:D,url:m,params:G,props:bt,revalidate:it}=y;try{await r.hooks.onPageStart?.(m);let H=await Bun.file(D.filePath).text(),A=Qt(H),vt=A?.middleware?Array.isArray(A.middleware)?A.middleware:[A.middleware]:[],st=[...xt,...vt];if(st.length>0){let j=Ft(m,G,A||{}),z=zt(j,null,void 0,{isServer:!0}),F=await Ht(st,z);if(F.redirect){let I=typeof F.redirect==="string"?F.redirect:F.redirect.path||F.redirect,W=te(String(I),m),L=ee(m,r);await R.promises.mkdir(w.dirname(L),{recursive:!0}),await Bun.write(L,W),u.successCount++,u.pages.push({route:m,outputPath:L,size:Buffer.byteLength(W),cached:!1}),M.push({loc:m,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${m} \u2192 redirect to ${I}`);return}if(F.abort){let I=typeof F.abort==="string"?F.abort:F.abort?.error?.message||"aborted";console.warn(` \u21B3 ${m} \u2014 middleware aborted: ${I}`);return}}let at=A?.validate;if(typeof at==="function")try{if(!await at({params:G})){console.warn(`Validation failed for ${m}, skipping...`);return}}catch{}let B=null,ot=!1;if(r.cache){if(B=O.get(m,D.filePath),B)ot=!0,u.cachedCount++}if(!B){let j=await yt(D,G,bt,r,s);if(B=j.html,r.failOnIncludeError&&j.includeFailures.length>0)throw Error(`${j.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
|
|
40
|
+
${j.includeFailures.join(`
|
|
41
41
|
`)}
|
|
42
|
-
Set ssg.failOnIncludeError to false to build anyway.`);if(r.failOnServerScriptError&&
|
|
43
|
-
${
|
|
42
|
+
Set ssg.failOnIncludeError to false to build anyway.`);if(r.failOnServerScriptError&&j.serverScriptFailures.length>0)throw Error(`${j.serverScriptFailures.length} <script server> block(s) failed, so this page would have shipped with the content they produce missing:
|
|
43
|
+
${j.serverScriptFailures.join(`
|
|
44
44
|
`)}
|
|
45
|
-
Set ssg.failOnServerScriptError to false to build anyway.`);if(r.cache)
|
|
45
|
+
Set ssg.failOnServerScriptError to false to build anyway.`);if(r.cache)O.set(m,D.filePath,j.dependencies,B)}let N;if(r.trailingSlash)N=w.join(r.outputDir,m,"index.html");else N=m==="/"?w.join(r.outputDir,"index.html"):w.join(r.outputDir,`${m}.html`);if(r.chunkIslands){let{html:j,chunks:z}=lt(B,{integrity:r.integrityIslands,minify:r.minify});if(z.length>0){let F=w.join(r.outputDir,"_stx","islands");await R.promises.mkdir(F,{recursive:!0});for(let I of z){let W=w.join(F,`${I.hash}.js`);if(!await Bun.file(W).exists())await Bun.write(W,I.code);if(!g.has(I.hash)){g.add(I.hash);let L=Buffer.byteLength(I.code,"utf8");P+=L,b[I.hash]={bytes:L,file:`/_stx/islands/${I.hash}.js`}}}if(p[m]=z.map((I)=>I.hash),B=j,r.prefetchIslands)B=ut(B)}}if(await R.promises.mkdir(w.dirname(N),{recursive:!0}),await Bun.write(N,B),!qt(m,B,A,r.sitemapExclude))M.push({loc:m,lastmod:new Date().toISOString().split("T")[0],priority:m==="/"?1:0.8});let ct={route:m,outputPath:N,size:Buffer.byteLength(B,"utf8"),cached:ot};if(it!==!1)ct.revalidateAt=Date.now()+it*1000;u.pages.push(ct),u.successCount++,await r.hooks.onPageEnd?.(m,B)}catch(H){u.failedCount++,u.errors.push({route:m,error:H}),await r.hooks.onError?.(H,m),console.error(`Error generating ${m}:`,H)}}));let rt=mn();if(rt.length>0){let d=rt.map((y)=>`${y.filePath}: ${y.message}`).join(`
|
|
46
46
|
`);throw Error(`Client script bundling failed:
|
|
47
|
-
${d}`)}if(r.cache)await
|
|
47
|
+
${d}`)}if(r.cache)await O.save();if(r.generate404){let d=w.join(r.pagesDir,"404.stx");if(await Bun.file(d).exists()){let y=new Set,D={...s,minifyClient:!0,debug:!1,cache:!1},m=await i(await Bun.file(d).text(),{},d,D,y);await Bun.write(w.join(r.outputDir,"404.html"),m)}else await Bun.write(w.join(r.outputDir,"404.html"),`<!DOCTYPE html>
|
|
48
48
|
<html lang="en">
|
|
49
49
|
<head>
|
|
50
50
|
<meta charset="UTF-8">
|
|
@@ -65,16 +65,16 @@ ${d}`)}if(r.cache)await L.save();if(r.generate404){let d=m.join(r.pagesDir,"404.
|
|
|
65
65
|
<a href="/">Go home</a>
|
|
66
66
|
</div>
|
|
67
67
|
</body>
|
|
68
|
-
</html>`)}for(let d of[500]){let y=
|
|
68
|
+
</html>`)}for(let d of[500]){let y=w.join(r.pagesDir,`${d}.stx`);if(await Bun.file(y).exists()){let D=new Set,m={...s,minifyClient:!0,debug:!1,cache:!1},G=await i(await Bun.file(y).text(),{},y,m,D);await Bun.write(w.join(r.outputDir,`${d}.html`),G)}}let X=w.join(r.pagesDir,"error.stx");if(await Bun.file(X).exists()){let d=new Set,y={...s,minifyClient:!0,debug:!1,cache:!1},D=await i(await Bun.file(X).text(),{},X,y,d);await Bun.write(w.join(r.outputDir,"error.html"),D)}if(r.sitemap&&M.length>0){let d=Jt(M,r.domain),y=w.join(r.outputDir,"sitemap.xml");await Bun.write(y,d),u.sitemapPath=y,console.log(`Generated sitemap.xml with ${M.length} URLs`)}if(r.robots!==!1){let d=typeof r.robots==="object"?r.robots:{},y=[...r.sitemapExclude.filter((m)=>typeof m==="string"),...d.disallow||[]],D=Vs({rules:[{userAgent:d.userAgent||"*",allow:d.allow||["/"],...y.length>0?{disallow:y}:{}}],...d.sitemap!==!1&&u.sitemapPath?{sitemap:new URL("/sitemap.xml",r.domain).href}:{}});await Bun.write(w.join(r.outputDir,"robots.txt"),D),console.log("Generated robots.txt")}if(r.rss){let d=typeof r.rss==="object"?r.rss:{title:"Site Feed",description:"Latest updates",link:r.domain},y=[];if(d.getItems)y=await d.getItems();let D=Kt(d,y),m=w.join(r.outputDir,"rss.xml");await Bun.write(m,D),u.rssPath=m,console.log(`Generated rss.xml with ${y.length} items`)}let q=Sc(r.outputDir);if(q.assets>0)console.log(`Externalized ${q.assets} asset(s) from ${q.pages} page(s) (${(q.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);let J=kc(r.outputDir);if(J.assets>0)console.log(`Externalized ${J.assets} repeated asset(s) from ${J.pages} page(s) (${(J.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(r.publicDir&&R.existsSync(r.publicDir))await Z(r.publicDir,r.outputDir),console.log(`Copied public assets from ${r.publicDir}`);let nt=fr();if(nt)await Z(nt,w.join(r.outputDir,pr)),console.log(`Copied assets from ${fn}`)}catch(C){throw await r.hooks.onError?.(C),C}if(u.buildTime=Date.now()-n,g.size>0){u.islandChunks={count:g.size,totalBytes:P};let C={generatedChunks:g.size,totalBytes:P,chunks:b,pages:p};await Bun.write(w.join(r.outputDir,"_stx","islands-manifest.json"),JSON.stringify(C,null,2))}await r.hooks.onBuildEnd?.(u);let k=u.islandChunks?`
|
|
69
69
|
Island chunks: ${u.islandChunks.count} (${(u.islandChunks.totalBytes/1024).toFixed(1)} KB lifted out of inline HTML)`:"";return console.log(`
|
|
70
70
|
Build complete!
|
|
71
71
|
Total: ${u.totalPages} pages
|
|
72
72
|
Success: ${u.successCount}
|
|
73
73
|
Cached: ${u.cachedCount}
|
|
74
74
|
Failed: ${u.failedCount}
|
|
75
|
-
Time: ${u.buildTime}ms${
|
|
76
|
-
`),u}async function Z(e,n){await R.promises.mkdir(n,{recursive:!0});let s=await R.promises.readdir(e,{withFileTypes:!0});for(let o of s){let c=
|
|
77
|
-
`)){let
|
|
75
|
+
Time: ${u.buildTime}ms${k}
|
|
76
|
+
`),u}async function Z(e,n){await R.promises.mkdir(n,{recursive:!0});let s=await R.promises.readdir(e,{withFileTypes:!0});for(let o of s){let c=w.join(e,o.name),r=w.join(n,o.name);if(o.isDirectory())await R.promises.mkdir(r,{recursive:!0}),await Z(c,r);else await R.promises.copyFile(c,r)}}function Yt(e={}){let n=e.cacheDir||l(process.cwd(),"ssg-cache"),s=new mt(n),o=e.revalidate||3600;return{async get(c){let r=await s.get(c);if(!r)return null;if(Date.now()>r.revalidateAfter)this.revalidate(c).catch(console.error);return{html:r.html,headers:{"Cache-Control":`public, max-age=${o}, stale-while-revalidate=${o*2}`,ETag:r.etag,"X-ISR-Generated":new Date(r.generatedAt).toISOString(),...r.headers}}},async revalidate(c){let u=re(".",{pagesDir:e.pagesDir||"pages"}).find((k)=>c.match(k.regex)!==null);if(!u){console.warn(`Route not found for revalidation: ${c}`);return}let g=c.match(u.regex),P={};if(g)u.params.forEach((k,C)=>{P[k]=g[C+1]});let b=await a(),{html:p}=await yt(u,P,{},e,b);await s.set(c,{html:p,generatedAt:Date.now(),revalidateAfter:Date.now()+o*1000,etag:Wt(p)}),console.log(`Revalidated: ${c}`)},async invalidate(c){if(typeof c==="string")await s.invalidate(c);else await s.invalidatePattern(c)}}}function Zt(){return{name:"markdown",extensions:[".md",".mdx"],async load(e){let n=await Bun.file(e).text(),s=n.match(/^---\n([\s\S]*?)\n---/),o={},c=n;if(s){let b=s[1];c=n.slice(s[0].length).trim();for(let p of b.split(`
|
|
77
|
+
`)){let k=p.indexOf(":");if(k>0){let C=p.slice(0,k).trim(),v=p.slice(k+1).trim();if(v==="true")v=!0;else if(v==="false")v=!1;else if(/^\d+$/.test(v))v=parseInt(v,10);else if(/^\d+\.\d+$/.test(v))v=parseFloat(v);else if(v.startsWith("[")&&v.endsWith("]"))v=v.slice(1,-1).split(",").map((E)=>E.trim().replace(/^['"]|['"]$/g,""));o[C]=v}}}let r=c.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),u=[],g=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,P;while((P=g.exec(r))!==null){let b=parseInt(P[1],10),p=P[2],k=p.toLowerCase().replace(/[^a-z0-9]+/g,"-");u.push({id:k,text:p,level:b})}return{content:r,data:o,toc:u}}}}function Qt(e){return Pt(e)}function te(e,n){return`<!DOCTYPE html>
|
|
78
78
|
<html>
|
|
79
79
|
<head>
|
|
80
80
|
<meta charset="utf-8">
|
|
@@ -86,4 +86,4 @@ Build complete!
|
|
|
86
86
|
<p>Redirecting to <a href="${e}">${e}</a>...</p>
|
|
87
87
|
<script>window.location.replace('${e}')</script>
|
|
88
88
|
</body>
|
|
89
|
-
</html>`}function ee(e,n){if(e==="/"||e==="")return
|
|
89
|
+
</html>`}function ee(e,n){if(e==="/"||e==="")return w.join(n.outputDir,"index.html");let s=e.replace(/^\/|\/$/g,"");if(n.trailingSlash)return w.join(n.outputDir,s,"index.html");return w.join(n.outputDir,`${s}.html`)}var Oe={generateStaticSite:Xt,createISRHandler:Yt,defineStaticPaths:V,createMarkdownLoader:Zt};export{Yt as createISRHandler,Zt as createMarkdownLoader,Gt as declaresPageAction,Oe as default,V as defineStaticPaths,Xt as generateStaticSite,qt as isExcludedFromSitemap};
|
package/dist/utils.js
CHANGED
|
@@ -21,7 +21,7 @@ import { isUsableParamName } from "./safe-evaluator.js";
|
|
|
21
21
|
import { processScopedStyles } from "./style-scoping.js";
|
|
22
22
|
import { findSfcTemplateBlock } from "./sfc-template.js";
|
|
23
23
|
import { importOnce } from "./lazy-module.js";
|
|
24
|
-
import { scanAtElementPosition, skipLeadingHtmlTrivia, stashScriptElements } from "./html-masking.js";
|
|
24
|
+
import { scanAtElementPosition, scanHtmlScriptElements, skipLeadingHtmlTrivia, stashScriptElements } from "./html-masking.js";
|
|
25
25
|
import { hasReactiveDirectives } from "./reactive.js";
|
|
26
26
|
import { markProjectedRefs, markProjectedSlotRoots } from "./misc-directives.js";
|
|
27
27
|
import { collectBlockDeclarations } from "./stx-virtual-ts.js";
|
|
@@ -30,6 +30,8 @@ import { isFallthroughAttribute } from "./builtins/attrs.js";
|
|
|
30
30
|
import { StxValidationError } from "./errors/types.js";
|
|
31
31
|
import { validateClientScript } from "./script-validation.js";
|
|
32
32
|
import { escapeScriptBody } from "./script-emit.js";
|
|
33
|
+
import { literalValue, parsePropsDeclaration } from "./props-declaration.js";
|
|
34
|
+
import { scriptAttributes, scriptContainsCode } from "./script-attributes.js";
|
|
33
35
|
function renderExternalComponentScript(script, context, filePath) {
|
|
34
36
|
const opening = /^<script\b([^>]*)>/i.exec(script);
|
|
35
37
|
if (!opening || !/(?:^|\s)src\s*=/i.test(opening[1] ?? ""))
|
|
@@ -388,117 +390,26 @@ function extractVariableNames(code) {
|
|
|
388
390
|
}
|
|
389
391
|
return names;
|
|
390
392
|
}
|
|
391
|
-
function
|
|
392
|
-
const
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
const c = body[i];
|
|
396
|
-
if (quote) {
|
|
397
|
-
if (c === "\\") {
|
|
398
|
-
i++;
|
|
399
|
-
continue;
|
|
400
|
-
}
|
|
401
|
-
if (c === quote)
|
|
402
|
-
quote = null;
|
|
393
|
+
function applyPublicProps(componentContent, ctx, supplied) {
|
|
394
|
+
for (const script of scanHtmlScriptElements(componentContent)) {
|
|
395
|
+
const attrs = scriptAttributes(script.attrs);
|
|
396
|
+
if (["server", "src", "component", "stx:component"].some((name) => attrs.has(name)) || !scriptContainsCode(attrs))
|
|
403
397
|
continue;
|
|
404
|
-
|
|
405
|
-
if (
|
|
406
|
-
quote = c;
|
|
398
|
+
const declaration = parsePropsDeclaration(componentContent.slice(script.bodyStart, script.bodyEnd));
|
|
399
|
+
if (!declaration)
|
|
407
400
|
continue;
|
|
401
|
+
const props = Object.assign(Object.create(null), supplied);
|
|
402
|
+
for (const [name, expression] of Object.entries(declaration.defaults))
|
|
403
|
+
if (props[name] === void 0)
|
|
404
|
+
props[name] = literalValue(expression);
|
|
405
|
+
for (const name of new Set([...declaration.propNames, ...Object.keys(declaration.defaults)])) {
|
|
406
|
+
const local = declaration.localBindings[name] ?? (declaration.propBindings[name] ? void 0 : name);
|
|
407
|
+
if (local)
|
|
408
|
+
Object.defineProperty(ctx, local, { value: props[name], writable: !0, enumerable: !0, configurable: !0 });
|
|
408
409
|
}
|
|
409
|
-
if (
|
|
410
|
-
|
|
411
|
-
else if (c === ")" || c === "]" || c === "}")
|
|
412
|
-
depth--;
|
|
413
|
-
else if (c === "," && depth === 0) {
|
|
414
|
-
parts.push(body.slice(start, i));
|
|
415
|
-
start = i + 1;
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
if (start < body.length)
|
|
419
|
-
parts.push(body.slice(start));
|
|
420
|
-
return parts;
|
|
421
|
-
}
|
|
422
|
-
function topLevelDefaultEq(entry) {
|
|
423
|
-
let depth = 0, quote = null;
|
|
424
|
-
for (let i = 0;i < entry.length; i++) {
|
|
425
|
-
const c = entry[i];
|
|
426
|
-
if (quote) {
|
|
427
|
-
if (c === "\\") {
|
|
428
|
-
i++;
|
|
429
|
-
continue;
|
|
430
|
-
}
|
|
431
|
-
if (c === quote)
|
|
432
|
-
quote = null;
|
|
433
|
-
continue;
|
|
434
|
-
}
|
|
435
|
-
if (c === '"' || c === "'" || c === "`") {
|
|
436
|
-
quote = c;
|
|
437
|
-
continue;
|
|
438
|
-
}
|
|
439
|
-
if (c === "(" || c === "[" || c === "{")
|
|
440
|
-
depth++;
|
|
441
|
-
else if (c === ")" || c === "]" || c === "}")
|
|
442
|
-
depth--;
|
|
443
|
-
else if (c === "=" && depth === 0) {
|
|
444
|
-
const prev = entry[i - 1], next = entry[i + 1];
|
|
445
|
-
if (prev === "!" || prev === "<" || prev === ">" || prev === "=")
|
|
446
|
-
continue;
|
|
447
|
-
if (next === "=" || next === ">")
|
|
448
|
-
continue;
|
|
449
|
-
return i;
|
|
450
|
-
}
|
|
410
|
+
if (declaration.identifier)
|
|
411
|
+
Object.defineProperty(ctx, declaration.identifier, { value: props, writable: !0, enumerable: !0, configurable: !0 });
|
|
451
412
|
}
|
|
452
|
-
return -1;
|
|
453
|
-
}
|
|
454
|
-
function applyDestructuredPropDefaults(componentContent, ctx) {
|
|
455
|
-
try {
|
|
456
|
-
const m = /=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(componentContent);
|
|
457
|
-
if (!m)
|
|
458
|
-
return;
|
|
459
|
-
let i = m.index - 1;
|
|
460
|
-
while (i >= 0 && /\s/.test(componentContent[i]))
|
|
461
|
-
i--;
|
|
462
|
-
if (componentContent[i] !== "}")
|
|
463
|
-
return;
|
|
464
|
-
const end = i;
|
|
465
|
-
let depth = 0, start = -1;
|
|
466
|
-
for (;i >= 0; i--) {
|
|
467
|
-
const c = componentContent[i];
|
|
468
|
-
if (c === "}")
|
|
469
|
-
depth++;
|
|
470
|
-
else if (c === "{") {
|
|
471
|
-
depth--;
|
|
472
|
-
if (depth === 0) {
|
|
473
|
-
start = i;
|
|
474
|
-
break;
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
if (start === -1)
|
|
479
|
-
return;
|
|
480
|
-
const body = componentContent.slice(start + 1, end);
|
|
481
|
-
for (const rawEntry of splitTopLevelCommas(body)) {
|
|
482
|
-
const entry = rawEntry.trim();
|
|
483
|
-
if (!entry || entry.startsWith("..."))
|
|
484
|
-
continue;
|
|
485
|
-
const eq = topLevelDefaultEq(entry);
|
|
486
|
-
if (eq === -1)
|
|
487
|
-
continue;
|
|
488
|
-
const name = entry.slice(0, eq).trim();
|
|
489
|
-
if (!/^[A-Z_$][\w$]*$/i.test(name))
|
|
490
|
-
continue;
|
|
491
|
-
if (ctx[name] !== void 0)
|
|
492
|
-
continue;
|
|
493
|
-
const expr = entry.slice(eq + 1).trim();
|
|
494
|
-
if (!expr)
|
|
495
|
-
continue;
|
|
496
|
-
try {
|
|
497
|
-
const keys = Object.keys(ctx).filter(isUsableParamName), fn = Function(...keys, `"use strict"; return (${expr});`);
|
|
498
|
-
ctx[name] = fn(...keys.map((k) => ctx[k]));
|
|
499
|
-
} catch {}
|
|
500
|
-
}
|
|
501
|
-
} catch {}
|
|
502
413
|
}
|
|
503
414
|
const WRAPPER_HOISTED_OUT_BY_PARSER = new Set([
|
|
504
415
|
"tr",
|
|
@@ -994,7 +905,7 @@ export async function renderComponentWithSlot(componentPath, props, slotContent,
|
|
|
994
905
|
const { processESImports } = await importOnce("stx/component-renderer", () => import("./component-renderer.js"));
|
|
995
906
|
componentContent = await processESImports(componentContent, componentContext, componentFilePath, options, dependencies);
|
|
996
907
|
}
|
|
997
|
-
|
|
908
|
+
applyPublicProps(componentContent, componentContext, props);
|
|
998
909
|
let workingContent = componentContent;
|
|
999
910
|
const templateBlock = findSfcTemplateBlock(workingContent);
|
|
1000
911
|
if (templateBlock)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/stx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.890",
|
|
5
5
|
"description": "A performant UI Framework. Powered by Bun.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -127,14 +127,14 @@
|
|
|
127
127
|
},
|
|
128
128
|
"dependencies": {
|
|
129
129
|
"@stacksjs/clapp": "^0.2.17",
|
|
130
|
-
"@stacksjs/desktop": "0.2.
|
|
131
|
-
"@stacksjs/sanitizer": "0.2.
|
|
130
|
+
"@stacksjs/desktop": "0.2.890",
|
|
131
|
+
"@stacksjs/sanitizer": "0.2.890",
|
|
132
132
|
"@stacksjs/ts-css": "^0.3.21",
|
|
133
133
|
"@stacksjs/ts-i18n": "^0.1.11",
|
|
134
134
|
"@types/dom-speech-recognition": "^0.0.12",
|
|
135
|
-
"bun-plugin-stx": "0.2.
|
|
135
|
+
"bun-plugin-stx": "0.2.890",
|
|
136
136
|
"bunfig": "^0.15.21",
|
|
137
|
-
"stx-router": "0.2.
|
|
137
|
+
"stx-router": "0.2.890",
|
|
138
138
|
"ts-broadcasting": "^0.0.13",
|
|
139
139
|
"ts-images": "^0.2.22",
|
|
140
140
|
"ts-syntax-highlighter": "^0.2.1"
|