@stacksjs/stx 0.2.837 → 0.2.839
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/builtins/image-delivery.js +7 -3
- package/dist/chunk-02cntwd8.js +2 -0
- package/dist/chunk-07hvjvj1.js +2 -0
- package/dist/{chunk-gh62p9mx.js → chunk-11y84h2d.js} +2 -2
- package/dist/{chunk-3bjnrmha.js → chunk-1b1ntgt7.js} +2 -2
- package/dist/{chunk-z25w7kmr.js → chunk-1m16mvt4.js} +4 -4
- package/dist/{chunk-rj68w7em.js → chunk-1zfxmjrf.js} +55 -55
- package/dist/{chunk-4ntm3dtk.js → chunk-23r3rby6.js} +2 -2
- package/dist/chunk-23zzbsms.js +2 -0
- package/dist/{chunk-ya6bp08c.js → chunk-2fj5zev7.js} +1 -1
- package/dist/{chunk-29f6vmyz.js → chunk-2j5yane9.js} +4 -4
- package/dist/chunk-2pgc087j.js +2 -0
- package/dist/{chunk-yeg4cahs.js → chunk-31cnrpd1.js} +9 -9
- package/dist/{chunk-ac9ncbfw.js → chunk-321e41ck.js} +3 -3
- package/dist/{chunk-hrcpq9k1.js → chunk-3tydmgwh.js} +5 -5
- package/dist/chunk-41sh9y5w.js +2 -0
- package/dist/chunk-4654xm1h.js +2 -0
- package/dist/{chunk-amg6kr1p.js → chunk-4657mnht.js} +4 -4
- package/dist/{chunk-s33andzg.js → chunk-4dxq7ft1.js} +2 -2
- package/dist/chunk-4eagsz5d.js +2 -0
- package/dist/{chunk-f7jgda7x.js → chunk-4j08cbjd.js} +5 -5
- package/dist/{chunk-ykyf7513.js → chunk-4w3qpewn.js} +3 -3
- package/dist/{chunk-tx8wk6h7.js → chunk-4y6hes3h.js} +2 -2
- package/dist/chunk-53j9wakh.js +2 -0
- package/dist/{chunk-j97zjjkh.js → chunk-5hmm01av.js} +5 -5
- package/dist/chunk-5t93dqft.js +2 -0
- package/dist/{chunk-2x9zhezb.js → chunk-6wrf6302.js} +2 -2
- package/dist/chunk-78nsbzcm.js +2 -0
- package/dist/{chunk-vpnyqf0h.js → chunk-7cg2f588.js} +4 -4
- package/dist/chunk-7ka7pvj9.js +2 -0
- package/dist/chunk-7m0r7mq9.js +2 -0
- package/dist/chunk-7mz6ze0x.js +2 -0
- package/dist/{chunk-ckg6q98b.js → chunk-7t57cnz9.js} +5 -5
- package/dist/chunk-7t9951at.js +2 -0
- package/dist/{chunk-jr0r5pzw.js → chunk-7vhm0jj5.js} +2 -2
- package/dist/{chunk-vfj9wp11.js → chunk-8370x30n.js} +2 -2
- package/dist/chunk-8913k8g7.js +3 -0
- package/dist/{chunk-txd2js5v.js → chunk-89d3h8mp.js} +14 -14
- package/dist/chunk-8byydry7.js +2 -0
- package/dist/chunk-8c363c2r.js +2 -0
- package/dist/chunk-8em568fw.js +2 -0
- package/dist/{chunk-n0zdxcfh.js → chunk-8h0pnn5p.js} +6 -6
- package/dist/{chunk-em8tv6nz.js → chunk-8pj4v1eh.js} +2 -2
- package/dist/{chunk-8z1p3mag.js → chunk-8q3pyq6a.js} +3 -3
- package/dist/{chunk-z0ynyz62.js → chunk-8qbp5skx.js} +7 -7
- package/dist/chunk-8w0n2rae.js +2 -0
- package/dist/{chunk-9snk4mzf.js → chunk-8y3f5fyg.js} +6 -6
- package/dist/chunk-8z3yjex0.js +2 -0
- package/dist/chunk-8zzepd7g.js +2 -0
- package/dist/{chunk-c3dg8qdn.js → chunk-97k72dfh.js} +2 -2
- package/dist/chunk-98258444.js +2 -0
- package/dist/{chunk-s53wjw7y.js → chunk-9xps62ek.js} +2 -2
- package/dist/{chunk-52g026sc.js → chunk-a1s5wqw4.js} +2 -2
- package/dist/{chunk-myje6fhm.js → chunk-a9tzjqny.js} +5 -5
- package/dist/{chunk-ztkd6mxj.js → chunk-aekq1zyn.js} +6 -6
- package/dist/chunk-aywvbcae.js +2 -0
- package/dist/chunk-aza2zrhk.js +54 -0
- package/dist/chunk-b0fkvrat.js +2 -0
- package/dist/chunk-b6w3457c.js +2 -0
- package/dist/{chunk-fvgk1w9s.js → chunk-bp918end.js} +2 -2
- package/dist/chunk-bq7qcndg.js +3 -0
- package/dist/chunk-c18pafmf.js +3 -0
- package/dist/chunk-c2v38ghp.js +2 -0
- package/dist/{chunk-c9vxm8yq.js → chunk-ca3c5qx2.js} +31 -31
- package/dist/chunk-cax1wts7.js +2 -0
- package/dist/{chunk-vkynagtn.js → chunk-cw1ar3dq.js} +4 -4
- package/dist/{chunk-bky02g7k.js → chunk-d0dzzpfx.js} +2 -2
- package/dist/{chunk-sz88tmbm.js → chunk-d1vkjxb1.js} +5 -5
- package/dist/chunk-d2mdh669.js +2 -0
- package/dist/chunk-d44g9sek.js +2 -0
- package/dist/chunk-d5vr9g4b.js +2 -0
- package/dist/{chunk-yw1s8kyj.js → chunk-dgn87554.js} +4 -4
- package/dist/{chunk-8q7ah3ct.js → chunk-efdfkfp1.js} +3 -3
- package/dist/{chunk-33czswpt.js → chunk-f1hkagxk.js} +3 -3
- package/dist/chunk-f69cmsz9.js +2 -0
- package/dist/{chunk-55e46spy.js → chunk-g7rsd8st.js} +5 -5
- package/dist/chunk-gaxx0z19.js +2 -0
- package/dist/chunk-gft9pg9n.js +2 -0
- package/dist/{chunk-3y9jtfzr.js → chunk-gpschnvk.js} +12 -12
- package/dist/chunk-h8h79939.js +2 -0
- package/dist/{chunk-q5pwvr98.js → chunk-jc5y35b7.js} +1 -1
- package/dist/{chunk-3r65z9vs.js → chunk-jjyt3tsv.js} +2 -2
- package/dist/{chunk-q14j0wsq.js → chunk-jzh0n2ct.js} +9 -9
- package/dist/{chunk-vfxkn1pe.js → chunk-kd6r7z27.js} +3 -3
- package/dist/chunk-ksc83y9t.js +2 -0
- package/dist/{chunk-02kycznh.js → chunk-ksr6c2kh.js} +5 -5
- package/dist/{chunk-rnm8ejpz.js → chunk-m5bj2jnb.js} +2 -2
- package/dist/chunk-mad4g0yx.js +2 -0
- package/dist/{chunk-b7tb00nz.js → chunk-mhyd24bg.js} +2 -2
- package/dist/chunk-mtjt2z77.js +2 -0
- package/dist/{chunk-0psdpeq8.js → chunk-mv49hr9y.js} +1 -1
- package/dist/chunk-mzj71r0m.js +3 -0
- package/dist/chunk-n7pvz99f.js +2 -0
- package/dist/chunk-n8a4jm0p.js +3 -0
- package/dist/chunk-nb2tedk0.js +2 -0
- package/dist/chunk-ndyj1d0z.js +2 -0
- package/dist/{chunk-n4qznmkm.js → chunk-ngnr831a.js} +5 -5
- package/dist/chunk-nhk0aat9.js +2 -0
- package/dist/{chunk-vntth7mg.js → chunk-nk7nxzxf.js} +2 -2
- package/dist/chunk-np6h1ct6.js +2 -0
- package/dist/{chunk-50w73wey.js → chunk-nsnzgdjt.js} +1 -1
- package/dist/{chunk-7y78ffds.js → chunk-p83h2dbg.js} +52 -52
- package/dist/{chunk-dv11h4f0.js → chunk-p9d2txcg.js} +1 -1
- package/dist/chunk-phxkmjnw.js +2 -0
- package/dist/chunk-pjkdn8zf.js +2 -0
- package/dist/{chunk-64b0yzrm.js → chunk-pqg6j26p.js} +3 -3
- package/dist/{chunk-xtqapjz3.js → chunk-q0s0kc66.js} +2 -2
- package/dist/chunk-q88w2rv9.js +2 -0
- package/dist/{chunk-v3xyb3ws.js → chunk-qfvddpcg.js} +2 -2
- package/dist/{chunk-e75dntfb.js → chunk-qk079ca7.js} +2 -2
- package/dist/{chunk-a40hrcq2.js → chunk-r0ssa1xd.js} +2 -2
- package/dist/chunk-r5bhgyes.js +2 -0
- package/dist/chunk-rdn1d4bf.js +42 -0
- package/dist/{chunk-7bvvv74e.js → chunk-rk2ex6qx.js} +3 -3
- package/dist/chunk-rmc6dfj4.js +2 -0
- package/dist/chunk-rsn9rh07.js +2 -0
- package/dist/chunk-rt29w5ns.js +2 -0
- package/dist/chunk-ryrdx5mw.js +2 -0
- package/dist/chunk-rzfbffnv.js +2 -0
- package/dist/chunk-s85chp3w.js +2 -0
- package/dist/chunk-s92f8w68.js +2 -0
- package/dist/chunk-sm9f980t.js +2 -0
- package/dist/chunk-st75663x.js +2 -0
- package/dist/chunk-sv2d6nfe.js +2 -0
- package/dist/{chunk-7k9yahng.js → chunk-t0jed809.js} +6 -6
- package/dist/{chunk-s5dhvnnd.js → chunk-t3p0jy0s.js} +6 -6
- package/dist/{chunk-f49x34sr.js → chunk-v3q126ys.js} +2 -2
- package/dist/{chunk-ees0kc6z.js → chunk-v49rvx9y.js} +114 -114
- package/dist/{chunk-kw5gra2z.js → chunk-v4ybemgb.js} +2 -2
- package/dist/chunk-vcx6dy59.js +2 -0
- package/dist/{chunk-q3pw43jm.js → chunk-vr6qa0g2.js} +14 -14
- package/dist/chunk-w5h67xec.js +2 -0
- package/dist/{chunk-vyv76w55.js → chunk-wbgc2n04.js} +2 -2
- package/dist/{chunk-p5r2p459.js → chunk-whmqfr3y.js} +6 -6
- package/dist/{chunk-nyg0nbjj.js → chunk-x110ssw2.js} +3 -3
- package/dist/{chunk-fwktw49p.js → chunk-x4f7efgp.js} +6 -6
- package/dist/chunk-x5wkbcsf.js +2 -0
- package/dist/{chunk-w0a6yz73.js → chunk-xbcnnk8x.js} +5 -5
- package/dist/{chunk-84nw3921.js → chunk-xmsf1bnx.js} +3 -3
- package/dist/{chunk-af50ebx1.js → chunk-xvhxxj4g.js} +92 -92
- package/dist/{chunk-dhdezdt2.js → chunk-xx3reejx.js} +2 -2
- package/dist/chunk-y64qhgv1.js +2 -0
- package/dist/{chunk-52t0qpx6.js → chunk-y68xstqy.js} +1 -1
- package/dist/chunk-yg5a54pj.js +2 -0
- package/dist/chunk-yjskeqaj.js +2 -0
- package/dist/{chunk-qmqc9p98.js → chunk-yn17484y.js} +6 -6
- package/dist/{chunk-dc0cde6n.js → chunk-ynf16yz4.js} +3 -3
- package/dist/chunk-yxqzarzh.js +2 -0
- package/dist/chunk-z4g64re8.js +3 -0
- package/dist/{chunk-ms3v5nat.js → chunk-zg44cf8a.js} +7 -7
- package/dist/{chunk-s6r54dyf.js → chunk-zjqvbcwa.js} +2 -2
- package/dist/{chunk-0rvntfhj.js → chunk-zvy88beh.js} +3 -3
- package/dist/{chunk-ycf2qbmz.js → chunk-zyeg9t2t.js} +2 -2
- package/dist/cli.js +20 -20
- package/dist/compression.js +3 -3
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/dev-server/port-utils.js +2 -1
- package/dist/expressions.js +1 -1
- package/dist/html-masking.d.ts +2 -0
- package/dist/html-masking.js +23 -0
- package/dist/image-optimization/processor.js +2 -2
- package/dist/includes.js +5 -4
- package/dist/misc-directives.js +2 -2
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +16 -16
- package/dist/utils.js +37 -7
- package/package.json +5 -5
- package/dist/chunk-0a36jnq4.js +0 -2
- package/dist/chunk-0rnfywsx.js +0 -2
- package/dist/chunk-1bpx9b0m.js +0 -2
- package/dist/chunk-1n04yp1x.js +0 -2
- package/dist/chunk-205gzszh.js +0 -54
- package/dist/chunk-29ptxt2j.js +0 -2
- package/dist/chunk-2nxxhcyy.js +0 -2
- package/dist/chunk-3ahpedfv.js +0 -3
- package/dist/chunk-68f2xqw4.js +0 -2
- package/dist/chunk-6aak0b7c.js +0 -2
- package/dist/chunk-6cv4kv7w.js +0 -2
- package/dist/chunk-72n804gy.js +0 -2
- package/dist/chunk-7efkc3gk.js +0 -2
- package/dist/chunk-830s2hfc.js +0 -2
- package/dist/chunk-87599134.js +0 -2
- package/dist/chunk-91zpxwx0.js +0 -2
- package/dist/chunk-9w3r1ch2.js +0 -3
- package/dist/chunk-a1hxz8q4.js +0 -2
- package/dist/chunk-a4k7neqx.js +0 -2
- package/dist/chunk-a579jdwb.js +0 -2
- package/dist/chunk-ahd8jdzx.js +0 -2
- package/dist/chunk-ay7ggc4k.js +0 -2
- package/dist/chunk-bc4x45vx.js +0 -2
- package/dist/chunk-c7hw37ww.js +0 -2
- package/dist/chunk-ca8bj7ga.js +0 -2
- package/dist/chunk-cfrgrnej.js +0 -2
- package/dist/chunk-chcvz6y7.js +0 -42
- package/dist/chunk-cw8vpk41.js +0 -2
- package/dist/chunk-d75s3a90.js +0 -2
- package/dist/chunk-db1c0c3c.js +0 -2
- package/dist/chunk-dkh794nh.js +0 -2
- package/dist/chunk-f6vzn90z.js +0 -2
- package/dist/chunk-gcxtgezg.js +0 -2
- package/dist/chunk-gtj8wy95.js +0 -2
- package/dist/chunk-h4tbpr7p.js +0 -2
- package/dist/chunk-hjvv9dbw.js +0 -2
- package/dist/chunk-hqp6cj7g.js +0 -2
- package/dist/chunk-j0w048sj.js +0 -2
- package/dist/chunk-jd5e3s4e.js +0 -2
- package/dist/chunk-k761q7s7.js +0 -2
- package/dist/chunk-k79ftcxh.js +0 -2
- package/dist/chunk-m3tnxk01.js +0 -2
- package/dist/chunk-mad9bbcp.js +0 -2
- package/dist/chunk-mca71wrp.js +0 -2
- package/dist/chunk-mdtysd2d.js +0 -2
- package/dist/chunk-mjf4naae.js +0 -3
- package/dist/chunk-nmtya57z.js +0 -3
- package/dist/chunk-nxfyjw59.js +0 -2
- package/dist/chunk-pe5qqem0.js +0 -2
- package/dist/chunk-ptcvxx5v.js +0 -2
- package/dist/chunk-pvab0bq4.js +0 -2
- package/dist/chunk-pwv77cyb.js +0 -2
- package/dist/chunk-qaswy58a.js +0 -2
- package/dist/chunk-qgrhcg7f.js +0 -2
- package/dist/chunk-ra967vfn.js +0 -3
- package/dist/chunk-s3j5vxy9.js +0 -3
- package/dist/chunk-t612xpa4.js +0 -2
- package/dist/chunk-tesbhpbp.js +0 -2
- package/dist/chunk-tvw571ab.js +0 -2
- package/dist/chunk-txzap6yn.js +0 -2
- package/dist/chunk-vqpypnys.js +0 -2
- package/dist/chunk-w39cfxa6.js +0 -2
- package/dist/chunk-wrr61y84.js +0 -2
- package/dist/chunk-x50xn4w1.js +0 -2
- package/dist/chunk-xefcgvy6.js +0 -2
- package/dist/chunk-xhabjf42.js +0 -2
- package/dist/chunk-xrspzeqx.js +0 -2
- package/dist/chunk-y191vfqa.js +0 -2
- package/dist/chunk-y2sdtw2t.js +0 -2
- package/dist/chunk-zrrxw94h.js +0 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{q,Me}from"./chunk-
|
|
3
|
-
export{
|
|
2
|
+
import{q,Me}from"./chunk-xvhxxj4g.js";var o=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function u(t,e,r){let i={fullTag:r,content:e,attrs:t};if(/\bserver\b/.test(t))return{...i,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...i,type:"client"};if(o.test(e))return{...i,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...i,type:"client"};return{...i,type:"server"}}var S=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function tn(t){let e=[],r=[],i=[],c=0;while(c<t.length){let s=t.indexOf("<",c);if(s===-1)break;let p=Me(t,s);if(p>s){c=p;continue}let a=q(t,s);if(a>s){let f=t.slice(s,a),l=S.exec(f);if(l){let n=u(l[1],l[2],f);switch(n.type){case"signals":e.push(n);break;case"client":r.push(n);break;case"server":i.push(n);break}}c=a;continue}c=s+(t.startsWith("<!--",s)?4:1)}return{signals:e,client:r,server:i}}
|
|
3
|
+
export{tn};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ut,dt,pt}from"./chunk-ema1c29k.js";import{
|
|
2
|
+
import{ut,dt,pt}from"./chunk-ema1c29k.js";import{Wt,qt,lt,Xi,Kt,Xt}from"./chunk-qfvddpcg.js";import o from"fs";import i from"path";var c=[];function m(a){c=[];for(let e of a.storyFiles)if(c.push({text:e.fileName.toLowerCase(),original:e.fileName,type:"story",storyId:e.id}),c.push({text:e.relativePath.toLowerCase(),original:e.relativePath,type:"story",storyId:e.id}),e.story)for(let t of e.story.variants)c.push({text:t.title.toLowerCase(),original:t.title,type:"story",storyId:e.id,variantId:t.id})}function f(){return JSON.stringify(c)}async function F(a={}){let e=Date.now();Wt();let t=await ut({mode:"build"});if(!t.config.enabled){lt("Story feature is disabled in config.");return}let n=await Kt(t);dt(t,n);let l=Xt(t.config,n);pt(t,l),qt(n.length);let d=a.outDir??t.config.outDir,s=i.resolve(t.root,d);await o.promises.mkdir(s,{recursive:!0}),console.log(` Building to ${d}...`);let g=v(t);await o.promises.writeFile(i.join(s,"index.html"),g);let y={files:n.map((r)=>({id:r.id,fileName:r.fileName,relativePath:r.relativePath,treePath:r.treePath})),tree:l};await o.promises.writeFile(i.join(s,"stories.json"),JSON.stringify(y,null,2));let u={theme:t.config.theme,responsivePresets:t.config.responsivePresets,backgroundPresets:t.config.backgroundPresets};await o.promises.writeFile(i.join(s,"config.json"),JSON.stringify(u,null,2));let p=i.join(s,"stories");await o.promises.mkdir(p,{recursive:!0});for(let r of n){let b=await o.promises.readFile(r.path,"utf-8");await o.promises.writeFile(i.join(p,`${r.id}.stx`),b)}m(t);let h=f();await o.promises.writeFile(i.join(s,"search-index.json"),h);let x=Date.now()-e;Xi(n.length,d,x)}function v(a){let{theme:e}=a.config,t=e.title||"STX Story";return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
`}import O from"path";var Y="stx-page-head:",Z=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,v={dev:null,prod:null};function Q(){let t=X()?"dev":"prod",r=v[t];if(r!==null)return r;try{let e=import.meta.require("./chunk-
|
|
2
|
+
import{En}from"./chunk-89d3h8mp.js";import{q,y,Nt,Mt,Er,m,rl,xi,W,R}from"./chunk-xvhxxj4g.js";import{tn}from"./chunk-xx3reejx.js";import{n}from"./chunk-n8a4jm0p.js";import{X}from"./chunk-7vhm0jj5.js";var z=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function U(t){let r=[],e=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,s;while((s=e.exec(t))!==null)r.push({start:s.index,end:s.index+s[0].length});return r}function N(t,r){return r.some((e)=>t>=e.start&&t<e.end)}function G(t){let r=(t||"").trim();if(!r)return null;if(/[\s>+~,:]/.test(r))return null;let e={},s=r,a=s.match(/^[a-z][\w-]*/i);if(a)e.tag=a[0].toLowerCase(),s=s.slice(a[0].length);while(s.length>0){let i=s.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(i){if(e.attr=i[1],i[3]!==void 0&&i[3]!=="")e.attrValue=i[3];s=s.slice(i[0].length);continue}let o=s.match(/^#([\w-]+)/);if(o){e.id=o[1],s=s.slice(o[0].length);continue}let c=s.match(/^\.([\w-]+)/);if(c){e.className=c[1],s=s.slice(c[0].length);continue}return null}if(!e.tag&&!e.attr&&!e.id&&!e.className)return null;return e}function J(t,r){if(r.attr){if(!(r.attrValue===void 0?new RegExp(`\\b${r.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${r.attr}\\s*=\\s*(["'])\\s*${r.attrValue}\\s*\\1`,"i")).test(t))return!1}if(r.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${r.id}\\s*\\1`,"i").test(t))return!1}if(r.className){let e=t.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!e)return!1;if(!e[2].split(/\s+/).includes(r.className))return!1}return!0}function P(t,r="main"){let e=G(r);if(!e)return null;let s=/<([a-z][\w-]*)\b([^>]*)>/gi,a=U(t),i;while((i=s.exec(t))!==null){if(N(i.index,a))continue;let o=i[1].toLowerCase(),c=i[2]||"";if(c.trimEnd().endsWith("/")||z.has(o))continue;if(e.tag&&e.tag!==o)continue;if(!J(c,e))continue;let l=i[0],u=i.index+l.length,f=new RegExp(`<(/?)${o}\\b([^>]*)>`,"gi");f.lastIndex=u;let p=1,h;while((h=f.exec(t))!==null){if(N(h.index,a))continue;let S=h[1]==="/";if(!S&&(h[2]||"").trimEnd().endsWith("/"))continue;if(p+=S?-1:1,p===0)return{openTag:l,openIndex:i.index,start:u,end:h.index,tagName:o}}return null}return null}var gt="private, no-store";function On(t){return t.replace(/&#(\d+);/g,(r,e)=>D(Number(e),r)).replace(/&#x([0-9a-f]+);/gi,(r,e)=>D(Number.parseInt(e,16),r)).replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&")}function D(t,r){if(!Number.isInteger(t)||t<0||t>1114111)return r;try{return String.fromCodePoint(t)}catch{return r}}function Ee(t){return t.headers.get("X-STX-Router")==="true"}function K(t,r){if(!t)return r;return t.split(",").some((s)=>s.trim().toLowerCase()===r.toLowerCase())?t:`${t}, ${r}`}function j(t){return{Vary:K(t,"X-STX-Router")}}function k(t){return t.replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Nn(t){let r=/<head\b[^>]*>([\s\S]*?)<\/head\s*>/i.exec(t)?.[1]??"",e=/<(meta|link)\b(?:[^>"']|"[^"]*"|'[^']*')*>|<title\b[^>]*>[\s\S]*?<\/title\s*>/giy,s=y(r,(i,o)=>(e.lastIndex=o,e.exec(i)?e.lastIndex:-1)),a=[];for(let{token:i}of s){if(/^<title\b/i.test(i)){a.push(`<title>${k(i.replace(/^<title\b[^>]*>|<\/title\s*>$/gi,""))}</title>`);continue}let o=Object.create(null),c=i.replace(/^<\w+\b|>$/g,"");for(let l of c.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)){let u=l[1].toLowerCase();if(!(u in o))o[u]=l[2]??l[3]??l[4]??""}if(/^<meta\b/i.test(i)){let l=o.property?"property":"name",u=On(o[l]??"").toLowerCase();if(u==="description"||/^(?:og|twitter):[\w:]+$/.test(u))a.push(`<meta ${l}="${n(u)}" content="${k(o.content??"")}">`)}else{let l=On(o.rel??"").toLowerCase();if(l==="canonical"||l==="alternate"&&o.hreflang)a.push(`<link rel="${l}" href="${k(o.href??"")}"${l==="alternate"?` hreflang="${k(o.hreflang)}"`:""}>`)}}return`<template data-stx-page-head="1">${a.join("")}</template>
|
|
3
|
+
`}import O from"path";var Y="stx-page-head:",Z=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,v={dev:null,prod:null};function Q(){let t=X()?"dev":"prod",r=v[t];if(r!==null)return r;try{let e=import.meta.require("./chunk-7m0r7mq9.js"),s=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;v[t]=`<script>${s()}</script>`}catch{v[t]=""}return v[t]}async function ua(t,r){if(r===!1)return null;if(r&&typeof r==="string"){let s=O.resolve(t,r);if(await Bun.file(s).exists())return s;return null}let e=O.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function yo(t,r){try{let e=await Bun.file(t).text(),s=e,a=e.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(a)s=a[1].trim();let i=tn(e),o=[...i.client.map((g)=>g.fullTag),...i.signals.map((g)=>g.fullTag)],c=[],l=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,u;while((u=l.exec(e))!==null)c.push(u[0]);let f=s;for(let g of i.server)f=f.replace(g.fullTag,"");for(let g of i.client)f=f.replace(g.fullTag,"");f=f.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let p="<!--__STX_PAGE_SLOT__-->";if(f=f.replace(/<slot\s*\/>/gi,p).replace(/<slot\s*>\s*<\/slot>/gi,p),!f.includes(p))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:h,extractVariables:S,defaultConfig:w,loadStxConfig:b}=await import("./chunk-rt29w5ns.js"),E=await b(),d={__filename:t,__dirname:O.dirname(t)};for(let g of o){let A=g.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(A&&!g.includes("client")&&!g.includes('type="module"'))await S(A[1],d,t)}let x=await h(f,d,t,{...w,...E,...r},new Set),C=x.indexOf(p);if(C===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:x.substring(0,C),afterSlot:x.substring(C+p.length),filePath:t,shellScripts:o,shellStyles:c}}catch(e){return console.error(`[stx] Error processing shell ${t}:`,e),null}}function Xr(t,r,e){let s,a="",i=r.match(Z);if(i){r=r.replace(i[0],"");try{let f=Buffer.from(i[1],"base64").toString("utf8"),p=f.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(p)s=p[1].trim();a=f.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let o=e||s||"stx App",c=Q(),l="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
|
|
4
4
|
<html lang="en">
|
|
5
5
|
<head>
|
|
6
6
|
<meta charset="UTF-8">
|
|
@@ -19,14 +19,14 @@ ${t.shellScripts.filter((f)=>!f.includes("server")).join(`
|
|
|
19
19
|
${l}
|
|
20
20
|
${c}
|
|
21
21
|
</body>
|
|
22
|
-
</html>`}function qe(t,r={}){let e=t.trim();if(!
|
|
22
|
+
</html>`}function qe(t,r={}){let e=t.trim();if(!En(e))return t;let s=[],a=e.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(a){let l=a[1],u=/<style\b[^>]*>[\s\S]*?<\/style>/gi,f;while((f=u.exec(l))!==null)s.push(f[0]);let p=l.match(/<script\b[^>]*data-stx-server-data[^>]*>[\s\S]*?<\/script>/i);if(p)s.push(p[0]);let h=l.match(/<script\b[^>]*data-stx-runtime-config[^>]*>[\s\S]*?<\/script>/i);if(h)s.push(h[0])}if(r.preserveHead&&a){let l=[],u=/<title\b[^>]*>[\s\S]*?<\/title>|<meta\b[^>]*>|<link\b[^>]*>/gi,f;while((f=u.exec(a[1]))!==null){if(/<meta\b[^>]*(?:\bcharset|name="viewport")/i.test(f[0]))continue;l.push(f[0])}if(l.length>0)s.unshift(`<!--${Y}${Buffer.from(l.join(`
|
|
23
23
|
`),"utf8").toString("base64")}-->`)}let i=e.match(/<body\b[^>]*>/i),o=e.lastIndexOf("</body>");if(i&&o!==-1){let l=i.index+i[0].length,u=e.slice(l,o).trim();if(s.length>0)return s.join(`
|
|
24
24
|
`)+`
|
|
25
25
|
`+u;return u}let c=e;if(c=c.replace(/<!DOCTYPE\b[^>]*>/i,""),c=c.replace(/<html\b[^>]*>/i,""),c=c.replace(/<\/html\s*>/i,""),a)c=c.replace(/<head\b[^>]*>[\s\S]*?<\/head>/i,s.join(`
|
|
26
|
-
`));return c=c.replace(/<body\b[^>]*>/i,""),c=c.replace(/<\/body\s*>/i,""),c.trim()}var F=/^<script\b[^>]*\sdata-stx-(?:owner|instance)(?=[\s=/>])/i;function L(t,r,e,s){if(!F.test(r))return!1;let a=r.slice(0,r.indexOf(">")+1),i=/\sdata-stx-owner="([^"]+)"/i.exec(a)?.[1];if(!i)return!0;let o=`data-stx-scope="${i}"`;for(let c=t.indexOf(o);c!==-1;c=t.indexOf(o,c+o.length))if(c>=e&&c<s)return!1;return!0}function
|
|
26
|
+
`));return c=c.replace(/<body\b[^>]*>/i,""),c=c.replace(/<\/body\s*>/i,""),c.trim()}var F=/^<script\b[^>]*\sdata-stx-(?:owner|instance)(?=[\s=/>])/i;function L(t,r,e,s){if(!F.test(r))return!1;let a=r.slice(0,r.indexOf(">")+1),i=/\sdata-stx-owner="([^"]+)"/i.exec(a)?.[1];if(!i)return!0;let o=`data-stx-scope="${i}"`;for(let c=t.indexOf(o);c!==-1;c=t.indexOf(o,c+o.length))if(c>=e&&c<s)return!1;return!0}function da(t){return Ee(t)}function tt(t,r){let e=[],s=new Set;for(let a of y(t,q)){if(a.start>=r.start&&a.start<r.end)continue;let i=a.token.match(/^<script\b((?:"[^"]*"|'[^']*'|[^'">])*)>/i)?.[1]??"",o=new Map;for(let u of i.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g))o.set(u[1].toLowerCase(),u[2]??u[3]??u[4]??"");let c=o.get("src")?.trim(),l=o.get("type")?.trim().toLowerCase();if(!c||o.has("server")||l&&!["module","text/javascript","application/javascript"].includes(l))continue;if(o.has("data-stx-runtime")||o.has("data-stx-router")||/^\/_stx\/(?:runtime|router)(?:\.[a-f0-9]{16})?\.js(?:[?#]|$)/i.test(c))continue;if(L(t,a.token,r.start,r.end)||s.has(a.token))continue;s.add(a.token),e.push(a.token)}return e}function Ke(t,r="main"){return!!P(t.trim(),r)}function Te(t,r="main",e=!1){let s=t.trim(),a=[],i=[],o=s.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(o){let x=o[1],C=/<style\b[^>]*>[\s\S]*?<\/style>/gi,g;while((g=C.exec(x))!==null)a.push(g[0]);let A=/<script\b[^>]*data-stx-(?:route-params|server-data|scoped|component-factories)[^>]*>[\s\S]*?<\/script>/gi;while((g=A.exec(x))!==null){if(F.test(g[0])||g[0].includes("__stx_early_mounts")||/^<script\b[^>]*\bdata-stx-runtime(?=[\s=>])/i.test(g[0]))continue;i.push(g[0])}}let c=P(s,r);if(!c)return(e?Nn(t):"")+qe(t);let l=tt(s,c),u=new Set(l),{tagName:f,start:p,end:h}=c,S=s.slice(p,h).trim(),w=[],b=s.match(/<body\b[^>]*>/i),E=s.lastIndexOf("</body>");if(b&&b.index!==void 0&&E!==-1){let C=[[b.index+b[0].length,c.openIndex],[h+`</${f}>`.length,E]],g=/<script\b[^>]*>[\s\S]*?<\/script>/gi;for(let[A,I]of C){if(A>=I)continue;let B=s.slice(A,I),_;g.lastIndex=0;while((_=g.exec(B))!==null){if(L(s,_[0],p,h))continue;w.push(_[0])}}}let d=[];if(e)d.push(Nn(t));if(a.length>0)d.push(a.join(`
|
|
27
27
|
`));if(l.length>0)d.push(l.join(`
|
|
28
28
|
`));if(i.length>0)d.push(i.filter((x)=>!u.has(x)).join(`
|
|
29
29
|
`));if(w.length>0)d.push(w.filter((x)=>!u.has(x)).join(`
|
|
30
30
|
`));return d.push(S),d.join(`
|
|
31
|
-
`)}import T from"fs";import H from"path";function
|
|
32
|
-
export{gt,
|
|
31
|
+
`)}import T from"fs";import H from"path";function pa(t,r,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:r,outputDir:e}}function fa(t,r){let e=H.join(r,"manifest.json");T.writeFileSync(e,JSON.stringify(t,null,2))}function ga(t){let r=H.join(t,"manifest.json");if(!T.existsSync(r))return null;try{let e=T.readFileSync(r,"utf-8"),s=JSON.parse(e);if(s.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${s.version}`),null;return s}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function M(t,r,e={}){let s=`${encodeURIComponent(t)}=${encodeURIComponent(r)}`;if(e.maxAge!==void 0)s+=`; Max-Age=${e.maxAge}`;if(e.expires)s+=`; Expires=${e.expires.toUTCString()}`;if(e.path)s+=`; Path=${e.path}`;if(e.domain)s+=`; Domain=${e.domain}`;if(e.secure)s+="; Secure";if(e.httpOnly)s+="; HttpOnly";if(e.sameSite)s+=`; SameSite=${e.sameSite}`;return s}async function et(t){let r=t.headers.get("content-type")||"",e={},s=(a,i)=>{let o=e[a];if(o===void 0)e[a]=i;else if(Array.isArray(o))o.push(i);else e[a]=[o,i]};if(r.includes("multipart/form-data")){let a=await t.formData();for(let[i,o]of a.entries())if(typeof o==="string")s(i,o);return e}if(r.includes("application/x-www-form-urlencoded")){for(let[a,i]of new URLSearchParams(await t.text()).entries())s(a,i);return e}return e}function bo(t){if(!t)return!1;let r=t.toUpperCase();return r!=="GET"&&r!=="HEAD"}async function V(t,r={}){let e=r.request,s=r.method??e?.method;if(!e||!bo(s))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let a={};try{a=await et(e)}catch{}let i=await t.action({request:e,form:a,params:r.params??{},query:t.query??{},cookies:r.cookies??{}});if(i&&typeof i==="object"){let o=i,c=nt(o.cookies),l=o.redirect;if(typeof l==="string"&&l)return{redirect:l,ran:!0,...c.length>0?{cookies:c}:{}};let{cookies:u,redirect:f,...p}=o;if(Object.assign(t,p),c.length>0)return{ran:!0,cookies:c}}return{ran:!0}}function nt(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let r=[];for(let[e,s]of Object.entries(t)){if(!e)continue;if(typeof s==="string"){r.push(M(e,s));continue}if(s&&typeof s==="object"){let a=s;if(typeof a.value!=="string")continue;r.push(M(e,a.value,a))}}return r}function ma(t,r=[],e){let s=new Headers({Location:t,"Cache-Control":"no-store"});for(let a of r)s.append("Set-Cookie",a);for(let[a,i]of Object.entries(e??{}))if(a.toLowerCase()!=="location")s.set(a,i);return new Response(null,{status:303,headers:s})}async function Mn(t,r={}){let{html:e,context:s,redirect:a,cookies:i}=await rt(t,r),o=Nt(s),c=Mt(s);if(a)return{html:e,redirect:a,cookies:i,status:o,headers:c};let{extractStreamBoundaries:l}=await import("./chunk-s85chp3w.js"),u=l(s),f=t.streamTemplates;if(f&&Object.keys(f).length>0){let{processDirectives:p}=await import("./chunk-8z3yjex0.js"),{defaultConfig:h}=await import("./chunk-78nsbzcm.js"),S=s.streamBoundaries||{},w={...h,autoShell:!1},b=Object.keys(f).map((d)=>({id:d,render:async()=>{let x=typeof S[d]==="function"?await S[d]():void 0;return p(f[d],{...s,$boundary:x},t.sourceFile,w,new Set)}})),E=new Set(b.map((d)=>d.id));u=[...(u||[]).filter((d)=>!E.has(d.id)),...b]}return{html:e,boundaries:u&&u.length>0?u:void 0,cookies:i,status:o,headers:c}}async function rt(t,r){let e={__filename:t.sourceFile,__dirname:t.sourceFile.replace(/[/\\][^/\\]+$/,""),...r};if(!t.hasServerScripts&&!xi(t.html))return{html:t.html,context:e};for(let o of t.serverScriptContent)try{await m(o,e,t.sourceFile)}catch(c){if(r.__stx_strict_hydration)throw c;console.warn(`[stx] Server script error in ${t.sourceFile}:`,c)}let s=await V(e,{request:r.request,method:r.method,params:r.params??{},cookies:r.cookies??{}}),a=(o)=>{let c=o.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),l=Er(e);if(!l)return c;let u=c.indexOf("</head>");return u<0?l+c:c.slice(0,u)+l+c.slice(u)};if(s.redirect)return{html:t.html,context:e,redirect:s.redirect,cookies:s.cookies};if(!xi(t.html))return{html:a(t.html),context:e,cookies:s.cookies};let i=new Map;for(let[o,c]of Object.entries(t.placeholders))if(c.expression)try{let l=R(c.expression,e);if(c.type==="raw")i.set(o,l!==void 0&&l!==null?String(l):"");else i.set(o,l!==void 0&&l!==null?W(String(l)):"")}catch(l){if(r.__stx_strict_hydration)throw l;i.set(o,"")}return{html:a(rl(t.html,i)),context:e,cookies:s.cookies}}
|
|
32
|
+
export{gt,On,Ee,j,Nn,ua,yo,Xr,qe,da,Ke,Te,pa,fa,ga,bo,ma,Mn};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{_}from"./chunk-
|
|
2
|
+
import{_}from"./chunk-xvhxxj4g.js";import{i}from"./chunk-1zfxmjrf.js";import p from"fs";import g from"path";import*as y from"readline";var e={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},u={help:{description:"Show available commands",usage:"help [command]",handler:async(t,o)=>{if(t[0]&&u[t[0]]){let n=u[t[0]];console.log(`
|
|
3
3
|
${e.bold}${t[0]}${e.reset} - ${n.description}`),console.log(` Usage: ${e.cyan}${n.usage}${e.reset}
|
|
4
4
|
`)}else{console.log(`
|
|
5
5
|
${e.bold}Available Commands:${e.reset}
|
|
@@ -16,9 +16,9 @@ ${e.bold}Markdown:${e.reset}`),a.forEach((c)=>console.log(` ${e.blue}${c}${e.re
|
|
|
16
16
|
${e.bold}Other:${e.reset}`),d.forEach((c)=>console.log(` ${e.dim}${c}${e.reset}`));console.log()}},cat:{description:"Show file contents",usage:"cat <file>",handler:async(t,o)=>{if(!t[0]){console.log(`${e.red}Error: Please specify a file${e.reset}`);return}let n=g.resolve(o.cwd,t[0]);if(!await Bun.file(n).exists()){console.log(`${e.red}Error: File not found: ${n}${e.reset}`);return}let s=(await Bun.file(n).text()).split(`
|
|
17
17
|
`);console.log(),s.forEach((l,a)=>{let d=String(a+1).padStart(3," ");console.log(`${e.dim}${d}${e.reset} ${l}`)}),console.log()}},load:{description:"Load context from JSON file",usage:"load <file.json>",handler:async(t,o)=>{if(!t[0]){console.log(`${e.red}Error: Please specify a JSON file${e.reset}`);return}let n=g.resolve(o.cwd,t[0]);if(!await Bun.file(n).exists()){console.log(`${e.red}Error: File not found: ${n}${e.reset}`);return}try{let r=await Bun.file(n).text(),s=JSON.parse(r);o.context={...o.context,...s},console.log(`${e.green}\u2713${e.reset} Loaded ${Object.keys(s).length} variables from ${t[0]}`)}catch(r){console.log(`${e.red}Error parsing JSON:${e.reset}`,r)}}},save:{description:"Save context to JSON file",usage:"save <file.json>",handler:async(t,o)=>{if(!t[0]){console.log(`${e.red}Error: Please specify a file name${e.reset}`);return}let n=g.resolve(o.cwd,t[0]);try{await Bun.write(n,JSON.stringify(o.context,null,2)),console.log(`${e.green}\u2713${e.reset} Context saved to ${t[0]}`)}catch(r){console.log(`${e.red}Error saving file:${e.reset}`,r)}}},history:{description:"Show command history",usage:"history [count]",handler:async(t,o)=>{let n=t[0]?Number.parseInt(t[0],10):20,r=o.history.slice(-n);if(r.length===0){console.log(`${e.dim}No history${e.reset}`);return}console.log(),r.forEach((s,l)=>{let a=String(o.history.length-r.length+l+1).padStart(3," ");console.log(`${e.dim}${a}${e.reset} ${s}`)}),console.log()}},exit:{description:"Exit interactive mode",usage:"exit",handler:async(t,o)=>{o.running=!1,console.log(`
|
|
18
18
|
${e.dim}Goodbye!${e.reset}
|
|
19
|
-
`)}},quit:{description:"Exit interactive mode (alias for exit)",usage:"quit",handler:async(t,o)=>u.exit.handler(t,o)}};function h(t,o){let n=t.split(" "),r=n[0];if(n.length===1)return Object.keys(u).filter((s)=>s.startsWith(r));if(["render","cat","load","cd"].includes(r)){let s=n.slice(1).join(" "),l=g.dirname(s)||".",a=g.basename(s),d=g.resolve(o.cwd,l);if(p.existsSync(d)&&p.statSync(d).isDirectory())try{return p.readdirSync(d).filter((f)=>f.startsWith(a)).map((f)=>`${r} ${l==="."?"":`${l}/`}${f}`)}catch{return[]}}if(["unset","eval","set"].includes(r)){let s=n[1]||"";return Object.keys(o.context).filter((l)=>l.startsWith(s)).map((l)=>`${r} ${l}`)}return[]}async function
|
|
19
|
+
`)}},quit:{description:"Exit interactive mode (alias for exit)",usage:"quit",handler:async(t,o)=>u.exit.handler(t,o)}};function h(t,o){let n=t.split(" "),r=n[0];if(n.length===1)return Object.keys(u).filter((s)=>s.startsWith(r));if(["render","cat","load","cd"].includes(r)){let s=n.slice(1).join(" "),l=g.dirname(s)||".",a=g.basename(s),d=g.resolve(o.cwd,l);if(p.existsSync(d)&&p.statSync(d).isDirectory())try{return p.readdirSync(d).filter((f)=>f.startsWith(a)).map((f)=>`${r} ${l==="."?"":`${l}/`}${f}`)}catch{return[]}}if(["unset","eval","set"].includes(r)){let s=n[1]||"";return Object.keys(o.context).filter((l)=>l.startsWith(s)).map((l)=>`${r} ${l}`)}return[]}async function Jg(t={}){let o={context:t.context||{},cwd:t.cwd||process.cwd(),history:[],running:!0,lastResult:null},n=y.createInterface({input:process.stdin,output:process.stdout,completer:(s)=>[h(s,o),s],historySize:t.maxHistory||100});console.log(`
|
|
20
20
|
${e.bold}${e.blue}stx Interactive Mode${e.reset}
|
|
21
21
|
${e.dim}Type 'help' for available commands, 'exit' to quit${e.reset}
|
|
22
22
|
`);let r=()=>{let s=o.cwd.replace(process.env.HOME||"","~");n.question(`${e.cyan}stx${e.reset} ${e.dim}${s}${e.reset} ${e.green}>${e.reset} `,async(l)=>{let a=l.trim();if(!a){if(o.running)r();return}o.history.push(a);let d=a.match(/(?:[^\s"]|"[^"]*")+/g)||[],c=d[0]?.toLowerCase(),f=d.slice(1).map((m)=>m.replace(/^"|"$/g,""));if(c&&u[c])try{await u[c].handler(f,o)}catch(m){console.log(`${e.red}Error:${e.reset}`,m)}else if(c)if(a.includes("{{")||a.includes("}}"))try{let m=await _(a,o.context,"eval");console.log(`${e.green}\u2192${e.reset} ${m}`)}catch{console.log(`${e.red}Unknown command: ${c}${e.reset}`),console.log(`${e.dim}Type 'help' for available commands${e.reset}`)}else console.log(`${e.red}Unknown command: ${c}${e.reset}`),console.log(`${e.dim}Type 'help' for available commands${e.reset}`);if(o.running)r();else n.close()})};n.on("SIGINT",()=>{console.log(`
|
|
23
23
|
${e.dim}(Use 'exit' to quit)${e.reset}`),r()}),r()}
|
|
24
|
-
export{
|
|
24
|
+
export{Jg};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import i from"path";var pn=".stx",o="STX_DIR",e=null;function Ac(t){e=t?.trim()||null}function yr(){return process.env[o]?.trim()||e||pn}function c(t=process.cwd(),...n){let r=yr();return i.isAbsolute(r)?i.join(r,...n):i.join(t,r,...n)}function br(t){if(!t||i.isAbsolute(t))return t;let n=t.replace(/\\/g,"/");if(n!==pn&&!n.startsWith(`${pn}/`))return t;let r=n.slice(pn.length+1);return r?i.join(yr(),r):yr()}
|
|
3
|
+
export{pn,Ac,yr,c,br};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{t,l,
|
|
2
|
+
import{t,l,zt,Ht,Vt,Ve,it,D,Ys,Or,Ue}from"./chunk-89d3h8mp.js";var I=/(?<![\w$@])@meta\s*\(/g,C=/(?<![\w$@])@metaTag\s*\(/g,k=/(?<![\w$@])@structuredData\s*\(/g,N=/(?<![\w$@])@seo\s*\(/g;function _(e,r){return(n)=>D(e,n,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX)}function j(e){return"property"in e?`<meta property="${c(e.property)}" content="${c(e.content)}">`:`<meta name="${c(e.name)}" content="${c(e.content)}">`}function ti(e,r,n,g){if(!e.includes("@meta"))return e;let i=zt(e,I,(a,o)=>{let s=Or(Ht(a),r);if(s.kind==="tag")return j(s.tag);if(s.kind==="empty")return"";return D("Meta",o,s.message,n,s.code)},_("Meta",n));return i=zt(i,C,(a,o)=>{let s=Vt(a,r);if(!s.ok)return D("MetaTag",o,s.message,n,s.code);if(s.value===void 0||s.value===null)return"";if(!it(s.value))return D("MetaTag",o,`expected an object such as { name, content }, got ${Ve(s.value)}`,n,t.TYPE_ERROR);let u=s.value;if(!u.name&&!u.property&&!u.httpEquiv)return D("MetaTag",o,"the tag needs a name, property or httpEquiv",n,t.INVALID_DIRECTIVE_SYNTAX);if(u.content===void 0||u.content===null||u.content===""||u.content===!1)return"";let p="<meta";if(u.name)p+=` name="${c(u.name)}"`;if(u.property)p+=` property="${c(u.property)}"`;if(u.httpEquiv)p+=` http-equiv="${c(u.httpEquiv)}"`;return p+=` content="${c(u.content)}">`,p},_("MetaTag",n)),i}function v(e){let r=(n)=>n["@context"]?{...n}:{...n,"@context":"https://schema.org"};if(it(e))return r(e);if(Array.isArray(e)&&e.length>0&&e.every(it))return e.map(r);return null}function A(e){return`<script type="application/ld+json">${JSON.stringify(e).replace(/<\//g,"<\\/")}</script>`}function ni(e,r,n){if(!e.includes("@structuredData"))return e;return zt(e,k,(g,i)=>{let a=Vt(g,r);if(!a.ok)return D("StructuredData",i,a.message,n,a.code);if(a.value===void 0||a.value===null)return"";let o=v(a.value);if(!o)return D("StructuredData",i,`expected an object or an array of objects, got ${Ve(a.value)}`,n,t.TYPE_ERROR);try{return A(o)}catch(s){let u=s instanceof Error?s.message:String(s);return D("StructuredData",i,`the data cannot be written as JSON: ${u}`,n,t.EVALUATION_ERROR)}},_("StructuredData",n))}var L=new Set(["title","description","keywords","robots","canonical","openGraph","twitter","structuredData"]),R={image:"openGraph.image",url:"canonical or openGraph.url",type:"openGraph.type",siteName:"openGraph.siteName",locale:"openGraph.locale",og:"openGraph",author:"@meta('author', ...)"};function ri(e,r,n,g){if(!e.includes("@seo"))return e;return zt(e,N,(i,a)=>{if(!i.trim())return D("SEO",a,"expected an object: @seo({ title, description }) or @seo(seoVariable)",n,t.INVALID_DIRECTIVE_SYNTAX);let o=Vt(i,r);if(!o.ok)return D("SEO",a,o.message,n,o.code);if(o.value===void 0||o.value===null)return"";if(!it(o.value))return D("SEO",a,`expected an object such as { title, description }, got ${Ve(o.value)}`,n,t.TYPE_ERROR);try{return q(o.value,a,n)}catch(s){let u=s instanceof Error?s.message:String(s);return D("SEO",a,`Error processing @seo directive: ${u}`,n,t.EVALUATION_ERROR)}},_("SEO",n))}function b(e,r,n,g){let i=e[r];if(i===void 0||i===null||i===!1)return;if(it(i))return i;Ys(n,`${r} must be an object, got ${Ve(i)}; its tags were left out`,g);return}function q(e,r,n){let g=Object.keys(e).filter((s)=>!L.has(s));if(g.length>0){let s=g.map((u)=>R[u]?`${u} (use ${R[u]})`:u).join(", ");Ys(r,`@seo does not read ${s}; ${g.length===1?"it was":"they were"} ignored`,n)}let i="";if(e.title)i+=`<title>${c(e.title)}</title>
|
|
3
3
|
`,i+=`<meta name="title" content="${c(e.title)}">
|
|
4
4
|
`;if(e.description)i+=`<meta name="description" content="${c(e.description)}">
|
|
5
5
|
`;if(e.keywords){let s=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;i+=`<meta name="keywords" content="${c(s)}">
|
|
@@ -25,7 +25,7 @@ import{t,l,Ft,zt,Ht,Ve,it,D,Js,Ir,Ue}from"./chunk-txd2js5v.js";var I=/(?<![\w$@]
|
|
|
25
25
|
`}if(o.site)i+=`<meta name="twitter:site" content="${c(o.site)}">
|
|
26
26
|
`;if(o.creator)i+=`<meta name="twitter:creator" content="${c(o.creator)}">
|
|
27
27
|
`}if(e.structuredData!==void 0&&e.structuredData!==null){let s=v(e.structuredData);if(s)i+=`${A(s)}
|
|
28
|
-
`;else
|
|
28
|
+
`;else Ys(r,`structuredData must be an object or an array of objects, got ${Ve(e.structuredData)}; it was left out`,n)}return i.trim()}function si(e,r,n){if(n.seo?.enabled===!1)return e;if(e.includes("<!-- stx SEO Tags -->")||r.__stx_seo_staged===!0||n.skipDefaultSeoTags===!0)return e;let g=r.__stx_runtime_head;if(!!(g?.title||g?.meta?.some((S)=>S.property==="og:title"||S.name==="og:title"||S.name==="twitter:title"||S.name==="description")))return e;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test(e)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test(e)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test(e))return e;if(!e.includes("<head>")&&!e.includes("<head "))return e;let a=e.includes("<title>")||e.includes("</title>"),o=M(e),s=V(o),u=U(o),p="";if(r.title)p=r.title;else if(r.meta&&r.meta.title)p=r.meta.title;else if(s)p=s;else if(n.seo?.defaultConfig?.title)p=n.seo.defaultConfig.title;else p=n.defaultTitle||"stx Project";let m="";if(r.description)m=r.description;else if(r.meta&&r.meta.description)m=r.meta.description;else if(u)m=u;else if(n.seo?.defaultConfig?.description)m=n.seo.defaultConfig.description;else m=n.defaultDescription||"A website built with stx templating engine";let d="";if(r.image)d=r.image;else if(r.meta&&r.meta.image)d=r.meta.image;else if(r.openGraph&&r.openGraph.image)d=r.openGraph.image;else if(n.seo?.defaultImage)d=n.seo.defaultImage;else if(n.defaultImage)d=n.defaultImage;let f=a?"":`
|
|
29
29
|
<meta name="title" content="${c(p)}">`,E=G(o)?"":`
|
|
30
30
|
<meta name="description" content="${c(m)}">`,y=`
|
|
31
31
|
<!-- stx SEO Tags -->${f}${E}
|
|
@@ -43,7 +43,7 @@ import{t,l,Ft,zt,Ht,Ve,it,D,Js,Ir,Ue}from"./chunk-txd2js5v.js";var I=/(?<![\w$@]
|
|
|
43
43
|
${y}
|
|
44
44
|
`),h;return h.replace(/<head[^>]*>/,`$&
|
|
45
45
|
${y}
|
|
46
|
-
`)}function M(e){let r=e.search(/<\/head\s*>/i);return r===-1?e:e.slice(0,r)}function x(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�*39;|'/g,"'").replace(/&/g,"&")}function V(e){let r=e.match(/<title(?:\s[^>]*)?>([\s\S]*?)<\/title\s*>/i);return r?x(r[1].trim()):""}function O(e){return(e.match(/<meta\s[^>]*>/gi)||[]).filter((r)=>/\sname\s*=\s*["']description["']/i.test(r))}function G(e){return O(e).length>0}function U(e){for(let r of O(e)){let n=r.match(/\scontent\s*=\s*(?:"([^"]*)"|'([^']*)')/i),g=(n?.[1]??n?.[2]??"").trim();if(g)return x(g)}return""}function c(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var
|
|
46
|
+
`)}function M(e){let r=e.search(/<\/head\s*>/i);return r===-1?e:e.slice(0,r)}function x(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�*39;|'/g,"'").replace(/&/g,"&")}function V(e){let r=e.match(/<title(?:\s[^>]*)?>([\s\S]*?)<\/title\s*>/i);return r?x(r[1].trim()):""}function O(e){return(e.match(/<meta\s[^>]*>/gi)||[]).filter((r)=>/\sname\s*=\s*["']description["']/i.test(r))}function G(e){return O(e).length>0}function U(e){for(let r of O(e)){let n=r.match(/\scontent\s*=\s*(?:"([^"]*)"|'([^']*)')/i),g=(n?.[1]??n?.[2]??"").trim();if(g)return x(g)}return""}function c(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var Es={name:"meta",rawParams:!0,handler:(e,r,n,g)=>{let i=Or(r,n??{});if(i.kind==="error")return D("Meta",`@meta(${r.join(", ")})`,i.message,g,i.code);if(i.kind==="empty")return"";if(n)n.__stx_runtime_head=Ue(n.__stx_runtime_head??{},{meta:[i.tag]});return""},hasEndTag:!1},Ts={name:"structuredData",handler:(e,r,n,g)=>{if(e.trim()==="")return l("StructuredData","structuredData directive requires JSON-LD content",t.INVALID_DIRECTIVE_SYNTAX);try{let i=JSON.parse(e);if(!i["@context"])i["@context"]="https://schema.org";if(!i["@type"])return l("StructuredData","structuredData requires @type property",t.INVALID_DIRECTIVE_SYNTAX);return A(i)}catch(i){let a=i instanceof Error?i.message:String(i);return l("StructuredData",a,t.EVALUATION_ERROR)}},hasEndTag:!0};function Kh(){return[Es,Ts]}function Xh(e,r){let{baseUrl:n,defaultChangefreq:g="weekly",defaultPriority:i=0.5,includeLastmod:a=!0}=r,o=n.replace(/\/$/,""),s=(m)=>m.startsWith("http")?m:`${o}${m.startsWith("/")?"":"/"}${m}`,u=e.map((m)=>{let d=s(m.loc),f=m.lastmod||(a?new Date().toISOString().split("T")[0]:void 0),E=m.changefreq||g,y=m.priority??i,h=` <url>
|
|
47
47
|
<loc>${T(d)}</loc>`;for(let w of m.alternates??[])h+=`
|
|
48
48
|
<xhtml:link rel="alternate" hreflang="${T(w.hreflang)}" href="${T(s(w.href))}"/>`;if(f)h+=`
|
|
49
49
|
<lastmod>${f}</lastmod>`;return h+=`
|
|
@@ -53,13 +53,13 @@ ${y}
|
|
|
53
53
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${e.some((m)=>m.alternates?.length)?' xmlns:xhtml="http://www.w3.org/1999/xhtml"':""}>
|
|
54
54
|
${u.join(`
|
|
55
55
|
`)}
|
|
56
|
-
</urlset>`}function
|
|
56
|
+
</urlset>`}function Gh(e,r){let n=r.replace(/\/$/,""),g=new Date().toISOString().split("T")[0];return`<?xml version="1.0" encoding="UTF-8"?>
|
|
57
57
|
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
58
58
|
${e.map((a)=>{let o=a.startsWith("http")?a:`${n}${a.startsWith("/")?"":"/"}${a}`;return` <sitemap>
|
|
59
59
|
<loc>${T(o)}</loc>
|
|
60
60
|
<lastmod>${g}</lastmod>
|
|
61
61
|
</sitemap>`}).join(`
|
|
62
62
|
`)}
|
|
63
|
-
</sitemapindex>`}async function
|
|
64
|
-
`).trim()}function
|
|
65
|
-
export{
|
|
63
|
+
</sitemapindex>`}async function Jh(e,r){let{extensions:n=[".stx",".html",".htm"],ignore:g=["_*",".*","node_modules","components","partials","layouts"]}=r,i=[],a=n.length===1?`*${n[0]}`:`*{${n.join(",")}}`,o=new Bun.Glob(`**/${a}`);for await(let s of o.scan(e)){if(g.some((f)=>{if(f.startsWith("*"))return s.includes(f.slice(1));return s.startsWith(f)||s.includes(`/${f}`)}))continue;let p=s.replace(/\\/g,"/").replace(/index\.(stx|html|htm)$/,"").replace(/\.(stx|html|htm)$/,"");if(!p.startsWith("/"))p=`/${p}`;if(p!=="/"&&p.endsWith("/"))p=p.slice(0,-1);let m=`${e}/${s}`,d;try{let f=await Bun.file(m).stat();if(f)d=new Date(f.mtime).toISOString().split("T")[0]}catch{}i.push({loc:p||"/",lastmod:d,priority:p==="/"?1:0.5})}return i.sort((s,u)=>s.loc.localeCompare(u.loc)),i}function $s(e){let r=[];for(let n of e.rules){if(r.push(`User-agent: ${n.userAgent}`),n.allow)for(let g of n.allow)r.push(`Allow: ${g}`);if(n.disallow)for(let g of n.disallow)r.push(`Disallow: ${g}`);if(n.crawlDelay!==void 0)r.push(`Crawl-delay: ${n.crawlDelay}`);r.push("")}if(e.sitemap){let n=Array.isArray(e.sitemap)?e.sitemap:[e.sitemap];for(let g of n)r.push(`Sitemap: ${g}`)}if(e.host)r.push(`Host: ${e.host}`);return r.join(`
|
|
64
|
+
`).trim()}function Yh(e){return $s({rules:[{userAgent:"*",allow:["/"]}],sitemap:e})}function T(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}
|
|
65
|
+
export{ti,ni,ri,si,Es,Ts,Kh,Xh,Gh,Jh,$s,Yh};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
function I(s){let o=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;s=s.replace(o,(e,t)=>`const { ${t.split(",").map((r)=>r.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
|
|
3
3
|
`);let n=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return s=s.replace(n,(e,t)=>`const { ${t.split(",").map((r)=>r.trim()).filter(Boolean).join(", ")} } = window.__composables
|
|
4
|
-
`),s}function
|
|
5
|
-
export{I
|
|
4
|
+
`),s}function Rn(s){return s.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}
|
|
5
|
+
export{I,Rn};
|
|
@@ -45,12 +45,12 @@ var p=0;function f(){return`stx-teleport-${++p}`}function g(t){let e=t.split(","
|
|
|
45
45
|
});
|
|
46
46
|
})();
|
|
47
47
|
</script>
|
|
48
|
-
`}function
|
|
48
|
+
`}function Gm(t,e,l){p=0;let o=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return t.replace(o,(r,s,d)=>{let a=f(),{target:u,disabled:n}=g(s),c=d.trim();if(n)try{let i=!1;if(n==="true")i=!0;else if(n==="false")i=!1;else if(n in e)i=Boolean(e[n]);if(i)return`<div class="stx-teleport-inline" data-teleport-disabled>${c}</div>`}catch{}let m=h(a,u);return`
|
|
49
49
|
<div id="${a}" class="stx-teleport-source" style="display: none;">
|
|
50
50
|
<template>${c}</template>
|
|
51
51
|
</div>
|
|
52
52
|
${m}
|
|
53
|
-
`})}function
|
|
53
|
+
`})}function Jm(){return`
|
|
54
54
|
<script>
|
|
55
55
|
(function() {
|
|
56
56
|
// Common teleport targets
|
|
@@ -68,4 +68,4 @@ var p=0;function f(){return`stx-teleport-${++p}`}function g(t){let e=t.split(","
|
|
|
68
68
|
})();
|
|
69
69
|
</script>
|
|
70
70
|
`}
|
|
71
|
-
export{
|
|
71
|
+
export{Gm,Jm};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{nt}from"./chunk-
|
|
2
|
+
import{nt}from"./chunk-2j5yane9.js";import{yt,Wn}from"./chunk-xbcnnk8x.js";import{Ar,Pr,Ir,Nr,Ce}from"./chunk-89d3h8mp.js";import{De,yn,tl,nl}from"./chunk-xvhxxj4g.js";import{M}from"./chunk-8370x30n.js";import{ki}from"./chunk-jjyt3tsv.js";import{b}from"./chunk-31cnrpd1.js";import{i}from"./chunk-1zfxmjrf.js";import{F,a}from"./chunk-p83h2dbg.js";import{Cc}from"./chunk-4657mnht.js";import{Nn,qe,Te,pa,fa,Mn}from"./chunk-yn17484y.js";import{cn,Oo}from"./chunk-ksr6c2kh.js";import{Dn}from"./chunk-bp918end.js";import{en,er,tr}from"./chunk-c18pafmf.js";import{G}from"./chunk-aekq1zyn.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function J(n){return Q("sha256").update(n).digest("hex").slice(0,8)}function U(n=!1){let l=n?Wn():yt(),o=J(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function V(){let n=nt(),l=J(n);return{content:n,filename:`router.${l}.js`,hash:l}}import q from"path";import{createHash as ee}from"crypto";function te(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function X(n,l,o={}){let r=q.resolve(n),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);tl();let _={};try{_=await a(o.configDir)}catch{}let h=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))h.push(g[2])}let u=new Set(h.flatMap((R)=>De(R))),{context:D}=te({__filename:r,__dirname:q.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...F,..._,...o,buildMode:"compile",strict:!1},y=await i(e,D,r,T,A),w=Nn(y)+qe(y),j=nl();return{route:l,sourceFile:n,html:y,fragment:w,placeholders:j,hasServerScripts:h.length>0,serverScriptContent:h,dependencies:Array.from(A),contentHash:S,status:yn(e),streamTemplates:D.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let h=m.readdirSync(S,{withFileTypes:!0});for(let d of h){if(re.has(d.name))continue;let g=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function im(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),S=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),h=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=Ce(e.app?.head,{known:Nr,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=Dn(A),y=n.serverApi??e.serverApi,w=typeof y==="object"?y:{};if(y)cn(o,w);if(e.runtimeConfig)M(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let j=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of j)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=G(o,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],P=R.filter((s)=>!Y.some((f)=>s.pattern.startsWith(`/${f}/`)||s.pattern===`/${f}`));console.log(`[stx build] Found ${P.length} page routes (${R.length-P.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=U(n.debug),x=V();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let B=[],H=[];for(let s of P){let f=T(s.pattern),O=f.rendering==="prerender";if(O&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await X(s.filePath,s.pattern,{configDir:o,componentsDir:S,partialsDir:_,layoutsDir:h,debug:n.debug});if(B.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=Ir(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=Ar(t.html,u);if(g.htmlAttrs)t.html=Pr(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let W=p[1];t.html=t.html.replace(" "+W,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${W}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await b(t.html),O){let p=await Mn(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=Te(t.html,D,!0);let L=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),z=c.join("server","pages",`${L}.compiled.json`),I=c.join("server","fragments",`${L}.html`);await Bun.write(c.join(r,z),JSON.stringify(t,null,2)),await Bun.write(c.join(r,I),t.fragment),H.push({pattern:s.pattern,compiledPath:z,fragmentPath:I,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:O}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(f).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let k=c.resolve(o,d);if(m.existsSync(k)){let{copied:s,bytes:f}=Z(k,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${d}/`)}let E=tr(o);if(E){let{copied:s,bytes:f}=Z(E,c.join(r,"public",er));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${en}/`)}let N={runtime:v.filename,router:x.filename},C=pa(H,N,r);if(C.routeRules=A,C.routerContainer=D,y)C.apiRoutes=await Oo(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await ki(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Cc(e._layerGraph),null,2));fa(C,r);let K=Date.now()-l;return console.log(`
|
|
3
3
|
[stx build] Done in ${K}ms \u2014 ${B.length} pages compiled`),{pageCount:B.length,assets:N,outputDir:r,duration:K}}
|
|
4
|
-
export{
|
|
4
|
+
export{im};
|