@stacksjs/stx 0.2.801 → 0.2.803
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-bbt09ebh.js → chunk-0ekdbagy.js} +3 -3
- package/dist/{chunk-brhas9mp.js → chunk-0rjcbqk3.js} +2 -2
- package/dist/{chunk-83myk906.js → chunk-0svj1nfa.js} +4 -4
- package/dist/chunk-0xqec4yj.js +2 -0
- package/dist/{chunk-k4nhwd9p.js → chunk-16362f43.js} +2 -2
- package/dist/chunk-19nnq90g.js +2 -0
- package/dist/{chunk-kydgndkt.js → chunk-1carv1dw.js} +1 -1
- package/dist/{chunk-enpx5t99.js → chunk-1ydz2w3t.js} +1 -1
- package/dist/{chunk-9gwhs0gk.js → chunk-2ws2qe1k.js} +2 -2
- package/dist/chunk-36zj3myn.js +2 -0
- package/dist/chunk-3e85etrf.js +2 -0
- package/dist/{chunk-8kvj2wz0.js → chunk-3ebwrpax.js} +6 -6
- package/dist/{chunk-sprgkk9j.js → chunk-3ec6jf9b.js} +30 -30
- package/dist/{chunk-9nbv6nk4.js → chunk-3es17qjn.js} +9 -9
- package/dist/{chunk-2vejgrj7.js → chunk-3k4xb05m.js} +5 -5
- package/dist/{chunk-b9d70mgr.js → chunk-3vpgr6nk.js} +3 -3
- package/dist/{chunk-dq87xd5c.js → chunk-3z0e637x.js} +3 -3
- package/dist/{chunk-qxt6hdat.js → chunk-427mhgje.js} +1 -1
- package/dist/{chunk-gqgcsgc3.js → chunk-4jrf6gsk.js} +1 -1
- package/dist/chunk-4mb75g61.js +2 -0
- package/dist/chunk-4n7yqb9w.js +2 -0
- package/dist/chunk-5eqna31h.js +2 -0
- package/dist/{chunk-zfzjn93c.js → chunk-5s31y4m0.js} +15 -15
- package/dist/{chunk-6162chg7.js → chunk-5vxk8bz9.js} +43 -43
- package/dist/chunk-69cphbrz.js +420 -0
- package/dist/chunk-6a97a9wk.js +2 -0
- package/dist/{chunk-dwydz68f.js → chunk-6dcc4ezx.js} +1 -1
- package/dist/{chunk-7yb82rm6.js → chunk-6s9bk98p.js} +2 -2
- package/dist/chunk-72cm91wm.js +2 -0
- package/dist/{chunk-s763dt8e.js → chunk-77a2hse0.js} +6 -6
- package/dist/{chunk-mt95md1e.js → chunk-7agp0wj2.js} +1 -1
- package/dist/{chunk-gctyy7r9.js → chunk-7v1pwjke.js} +9 -9
- package/dist/{chunk-y9bj3566.js → chunk-7xs45trj.js} +2 -2
- package/dist/chunk-85w7kf2j.js +2 -0
- package/dist/chunk-87g1ryzs.js +2 -0
- package/dist/chunk-8g3bgcac.js +2 -0
- package/dist/{chunk-2fh4wvtv.js → chunk-8je2zse3.js} +34 -34
- package/dist/chunk-8m5w99f3.js +2 -0
- package/dist/chunk-8wd83rnz.js +2 -0
- package/dist/chunk-97daxgfk.js +2 -0
- package/dist/{chunk-f52esq8m.js → chunk-9h72drk3.js} +1 -1
- package/dist/chunk-9wmjmas8.js +2 -0
- package/dist/{chunk-x82zksaj.js → chunk-a0r4dpzs.js} +2 -2
- package/dist/{chunk-s85s2kd3.js → chunk-amewvsn1.js} +2 -2
- package/dist/chunk-aqydav9y.js +2 -0
- package/dist/chunk-aznnh6cy.js +3 -0
- package/dist/{chunk-33vr7x2t.js → chunk-baj6w8ja.js} +3 -3
- package/dist/{chunk-j0bbr6ee.js → chunk-bejj0gra.js} +3 -3
- package/dist/{chunk-w0zayhmg.js → chunk-c5vzr1va.js} +2 -2
- package/dist/{chunk-ddhkhhc7.js → chunk-cfbpvm5e.js} +2 -2
- package/dist/{chunk-k3rcpnzm.js → chunk-cmnze7at.js} +2 -2
- package/dist/{chunk-61h00ba5.js → chunk-cwnx4rxk.js} +6 -6
- package/dist/chunk-cxahdpzz.js +2 -0
- package/dist/chunk-d3gncxq1.js +2 -0
- package/dist/{chunk-d8rcba53.js → chunk-d47m4qat.js} +2 -2
- package/dist/{chunk-t0qh1m5e.js → chunk-d98hgxky.js} +4 -4
- package/dist/chunk-da886asf.js +2 -0
- package/dist/{chunk-25q462jp.js → chunk-dc584r4z.js} +4 -4
- package/dist/{chunk-fw9dhsd9.js → chunk-dqa1g676.js} +2 -2
- package/dist/{chunk-9kadf7pv.js → chunk-dvbd5fxe.js} +1 -1
- package/dist/{chunk-t5vjt37c.js → chunk-e39nkbt4.js} +3 -3
- package/dist/chunk-e6snnz4t.js +2 -0
- package/dist/chunk-e848m5tj.js +2 -0
- package/dist/chunk-et8n16k2.js +2 -0
- package/dist/{chunk-gqdkvwjp.js → chunk-evmxrmjb.js} +50 -50
- package/dist/chunk-ewzdsksb.js +2 -0
- package/dist/chunk-fsjkavq5.js +2 -0
- package/dist/chunk-g4sdthck.js +2 -0
- package/dist/{chunk-56j2egg3.js → chunk-g9xx8qh1.js} +3 -3
- package/dist/{chunk-6n5cbyes.js → chunk-gb3tv53p.js} +2 -2
- package/dist/chunk-gebb12ak.js +72 -0
- package/dist/{chunk-e08hzdpw.js → chunk-gmme8c1s.js} +1 -1
- package/dist/{chunk-nn1f1h3q.js → chunk-gq5ffpq0.js} +1 -1
- package/dist/chunk-gzs0ertq.js +2 -0
- package/dist/chunk-h9yvb9qn.js +2 -0
- package/dist/{chunk-j2v9f2dk.js → chunk-hn2me1qx.js} +2 -2
- package/dist/{chunk-vzmkex8f.js → chunk-hpqrcpjb.js} +1 -1
- package/dist/{chunk-gjf8cjdt.js → chunk-hwcfgs3e.js} +3 -3
- package/dist/chunk-j49t3p7e.js +2 -0
- package/dist/chunk-jjcw2pa9.js +2 -0
- package/dist/{chunk-hzs3h76s.js → chunk-k4csq6pk.js} +4 -4
- package/dist/{chunk-hyz90d8w.js → chunk-k5xyb0dq.js} +2 -2
- package/dist/{chunk-8ey61ppd.js → chunk-k86573fe.js} +5 -5
- package/dist/chunk-kn84qg00.js +2 -0
- package/dist/{chunk-wz3gk8js.js → chunk-kq0cee7k.js} +3 -3
- package/dist/{chunk-vg3scf4d.js → chunk-m1mrq876.js} +9 -9
- package/dist/chunk-m5cdkb11.js +2 -0
- package/dist/{chunk-akcyaxwv.js → chunk-m7hfcxt3.js} +2 -2
- package/dist/{chunk-r32pqvpq.js → chunk-mmh2k7ab.js} +5 -5
- package/dist/chunk-mrc7hc4a.js +2 -0
- package/dist/{chunk-t0bcbhvs.js → chunk-ncptqa8v.js} +5 -5
- package/dist/{chunk-sxee2rxz.js → chunk-ncyjaxyz.js} +1 -1
- package/dist/chunk-nmc1vj8f.js +2 -0
- package/dist/chunk-nrqv8s48.js +2 -0
- package/dist/{chunk-gzfvj15b.js → chunk-nsxjt6h3.js} +1 -1
- package/dist/{chunk-hcwjdpzv.js → chunk-p8wq37hd.js} +2 -2
- package/dist/chunk-pr6nrg6x.js +2 -0
- package/dist/{chunk-jce3scvg.js → chunk-ps5by9sq.js} +16 -16
- package/dist/{chunk-v47yfe9k.js → chunk-qeyzgyhk.js} +1 -1
- package/dist/{chunk-8xx1yf34.js → chunk-qm3hkrcw.js} +4 -4
- package/dist/{chunk-hp9e8nz6.js → chunk-r1vkk7qp.js} +2 -2
- package/dist/{chunk-2yxva96k.js → chunk-r9e0r6jx.js} +2 -2
- package/dist/chunk-rmpgtyqh.js +2 -0
- package/dist/chunk-rnz6g3xv.js +2 -0
- package/dist/{chunk-gvnfb6s2.js → chunk-rpen41w3.js} +2 -2
- package/dist/{chunk-x8m28yea.js → chunk-rssxm2jw.js} +2 -2
- package/dist/chunk-s1k2sc69.js +2 -0
- package/dist/chunk-s3z8jtfj.js +2 -0
- package/dist/{chunk-q3dsjk2b.js → chunk-s9xs2ff4.js} +6 -6
- package/dist/{chunk-znx5m1jv.js → chunk-sphc7xzx.js} +1 -1
- package/dist/chunk-syvsj91a.js +2 -0
- package/dist/{chunk-x8h81amr.js → chunk-t4j2rw91.js} +2 -2
- package/dist/chunk-tdcgskyy.js +2 -0
- package/dist/chunk-tzb0n60s.js +2 -0
- package/dist/chunk-va9w63nh.js +2 -0
- package/dist/{chunk-qpvwxppw.js → chunk-vbc8a8fh.js} +4 -4
- package/dist/{chunk-s9b6abkb.js → chunk-vkn133cs.js} +2 -2
- package/dist/chunk-w3dsj0a6.js +3 -0
- package/dist/chunk-w5xq1217.js +2 -0
- package/dist/{chunk-hrrrf46j.js → chunk-w6n4y2xg.js} +2 -2
- package/dist/chunk-wwbng2jf.js +2 -0
- package/dist/chunk-x2hc3zth.js +2 -0
- package/dist/chunk-x7qctqj2.js +2 -0
- package/dist/{chunk-c1bsagbe.js → chunk-xrd1md4j.js} +6 -6
- package/dist/{chunk-1htxem27.js → chunk-y2q46m8b.js} +3 -3
- package/dist/{chunk-2yb1rwmy.js → chunk-y7sf7aj0.js} +1 -1
- package/dist/{chunk-t65tn8ee.js → chunk-ybjfr7e8.js} +2 -2
- package/dist/{chunk-8adf5x29.js → chunk-ycr9bkww.js} +1 -1
- package/dist/{chunk-xtwcz8dg.js → chunk-yhfrs6yn.js} +7 -7
- package/dist/chunk-yjezsy4p.js +2 -0
- package/dist/{chunk-3ajbbtqx.js → chunk-zmckz1eq.js} +7 -7
- package/dist/cli.js +19 -19
- package/dist/client-parameter-bindings.js +10 -6
- package/dist/client-script.js +11 -10
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/native/compiler/inline-style.js +51 -28
- package/dist/native/runtime/craft-bridge.js +37 -4
- package/dist/performance-utils.d.ts +255 -115
- package/dist/pwa.js +3 -3
- package/dist/safe-evaluator.js +28 -3
- package/dist/ssg.js +5 -5
- package/package.json +5 -5
- package/dist/chunk-1yhrq2nx.js +0 -2
- package/dist/chunk-1zy94dxs.js +0 -2
- package/dist/chunk-26505qjh.js +0 -2
- package/dist/chunk-2ehn5r6d.js +0 -2
- package/dist/chunk-3gcdq401.js +0 -2
- package/dist/chunk-3rgb6kc1.js +0 -2
- package/dist/chunk-5fzvcr9v.js +0 -2
- package/dist/chunk-6b10096c.js +0 -2
- package/dist/chunk-6fq522rd.js +0 -2
- package/dist/chunk-6mdvx2bf.js +0 -2
- package/dist/chunk-6q0c9j7p.js +0 -2
- package/dist/chunk-77v7g18n.js +0 -2
- package/dist/chunk-7m4eesp0.js +0 -2
- package/dist/chunk-92te36hf.js +0 -2
- package/dist/chunk-9736003n.js +0 -2
- package/dist/chunk-9sgzv5ze.js +0 -2
- package/dist/chunk-acwqb3ys.js +0 -2
- package/dist/chunk-amc8xdcz.js +0 -2
- package/dist/chunk-b3b9tfpx.js +0 -2
- package/dist/chunk-bb3y1g34.js +0 -2
- package/dist/chunk-bf3va62c.js +0 -2
- package/dist/chunk-c2x9wea0.js +0 -2
- package/dist/chunk-cas0vn5m.js +0 -2
- package/dist/chunk-d1c1qggs.js +0 -2
- package/dist/chunk-dd1vqndp.js +0 -2
- package/dist/chunk-ef8p88as.js +0 -2
- package/dist/chunk-ej8q3kyc.js +0 -2
- package/dist/chunk-eszpqrxy.js +0 -2
- package/dist/chunk-fn4jk05k.js +0 -2
- package/dist/chunk-h72d9174.js +0 -2
- package/dist/chunk-jn6g5n02.js +0 -2
- package/dist/chunk-kdhsev5v.js +0 -3
- package/dist/chunk-nm20k22y.js +0 -2
- package/dist/chunk-nq4d91zm.js +0 -2
- package/dist/chunk-nv0n2hjg.js +0 -431
- package/dist/chunk-p9j909eq.js +0 -2
- package/dist/chunk-pmf53mgj.js +0 -2
- package/dist/chunk-ps9fcjyg.js +0 -2
- package/dist/chunk-pxxhhaaw.js +0 -3
- package/dist/chunk-q38vjqv2.js +0 -2
- package/dist/chunk-q78jxqnr.js +0 -2
- package/dist/chunk-qkck7zx0.js +0 -2
- package/dist/chunk-se44tmvx.js +0 -61
- package/dist/chunk-shag9bcm.js +0 -2
- package/dist/chunk-t4yy48dh.js +0 -2
- package/dist/chunk-t55nk8sw.js +0 -2
- package/dist/chunk-tkb335d7.js +0 -2
- package/dist/chunk-vse4ewax.js +0 -2
- package/dist/chunk-vy92xwbg.js +0 -2
- package/dist/chunk-whq40bdm.js +0 -2
- package/dist/chunk-wqt2hep2.js +0 -2
- package/dist/chunk-ys46rqxg.js +0 -2
- package/dist/chunk-zhz8er14.js +0 -2
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{xe,Pt,ci,js,Pc,Ic,Oc,Nc,_r,ui,Mc,Dc,di,hn}from"./chunk-69cphbrz.js";import{k}from"./chunk-ybjfr7e8.js";import{a}from"./chunk-evmxrmjb.js";import{wo}from"./chunk-16362f43.js";import{c}from"./chunk-0rjcbqk3.js";import{existsSync as B,readFileSync as K}from"fs";import h from"path";var ge=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),ee=hn.filter((e)=>!ge.has(e)).sort(),te=[...k].sort(),he=[...new Set([...ee,...te])].sort(),be=new Set(ee),ye=new Set(te),Se=new Set(he),Y=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function ke(e,t){if(t==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function ne(e,t){let s=[];for(let d of t){if(d.offset===void 0)continue;let i=d.kind==="server"?be:ye;Y.lastIndex=0;for(let l of d.code.matchAll(Y)){let g=l.index+l[0].indexOf("{")+1;for(let u of l[1].matchAll(/[^,]+/g)){let y=u[0];if(/^\s*type\s/.test(y))continue;let b=/^\s*([A-Za-z_$][\w$]*)/.exec(y);if(!b)continue;let r=b[1];if(!Se.has(r)||i.has(r))continue;let p=d.offset+g+u.index+b[0].length-r.length,f=e.slice(0,p),T=f.split(`
|
|
3
3
|
`).length;s.push({line:T,column:p-(f.lastIndexOf(`
|
|
4
|
-
`)+1)+1,offset:p,length:r.length,name:r,kind:d.kind,message:ke(r,d.kind)})}}}return s}import E from"path";var we="@stacksjs/stx-typescript-plugin";function $e(e,t){let s=E.resolve(e);for(;;){let d=E.join(s,"tsconfig.json");if(t(d))return d;let i=E.dirname(s);if(i===s)return;s=i}}function ie(e,t,s){let d=$e(e,s);if(!d)return;let i=new Set,l=(g)=>{if(i.has(g))return;i.add(g);let u=t(g);if(!u)return;let y=u.compilerOptions?.plugins;if(Array.isArray(y)){let r=y.find((f)=>f?.name===we),p=Array.isArray(r?.libs)?r.libs.filter((f)=>typeof f==="string"):[];return r?{configPath:g,libs:p.map((f)=>E.resolve(E.dirname(g),f))}:null}let b=typeof u.extends==="string"?[u.extends]:Array.isArray(u.extends)?u.extends:[];for(let r of[...b].reverse()){if(typeof r!=="string"||!r.startsWith("."))continue;let p=E.resolve(E.dirname(g),r.endsWith(".json")?r:`${r}.json`),f=l(p);if(f!==void 0)return f}return};return l(d)??void 0}function
|
|
5
|
-
`.repeat(e.startLine-1):"",i=ci(ui(e)+e.code,t),l=js(i.code),g=e.kind==="client"||e.kind==="plain"?
|
|
4
|
+
`)+1)+1,offset:p,length:r.length,name:r,kind:d.kind,message:ke(r,d.kind)})}}}return s}import E from"path";var we="@stacksjs/stx-typescript-plugin";function $e(e,t){let s=E.resolve(e);for(;;){let d=E.join(s,"tsconfig.json");if(t(d))return d;let i=E.dirname(s);if(i===s)return;s=i}}function ie(e,t,s){let d=$e(e,s);if(!d)return;let i=new Set,l=(g)=>{if(i.has(g))return;i.add(g);let u=t(g);if(!u)return;let y=u.compilerOptions?.plugins;if(Array.isArray(y)){let r=y.find((f)=>f?.name===we),p=Array.isArray(r?.libs)?r.libs.filter((f)=>typeof f==="string"):[];return r?{configPath:g,libs:p.map((f)=>E.resolve(E.dirname(g),f))}:null}let b=typeof u.extends==="string"?[u.extends]:Array.isArray(u.extends)?u.extends:[];for(let r of[...b].reverse()){if(typeof r!=="string"||!r.startsWith("."))continue;let p=E.resolve(E.dirname(g),r.endsWith(".json")?r:`${r}.json`),f=l(p);if(f!==void 0)return f}return};return l(d)??void 0}function oa(e,t="",s=""){let d=e.startLine>1?`
|
|
5
|
+
`.repeat(e.startLine-1):"",i=ci(ui(e)+e.code,t),l=js(i.code),g=e.kind==="client"||e.kind==="plain"?Oc(t,e.code):"",u=(d+l).split(`
|
|
6
6
|
`),y=u.length,b=new Map;for(let r of i.declarations)for(let[p,f]of r.text.split(`
|
|
7
7
|
`).entries())if(u.push(f),r.origin)b.set(u.length,{...r.origin,line:e.startLine+r.origin.line-1+p,column:p===0?r.origin.column:1});return u.push(g,"export {}",""),{text:_r(u.join(`
|
|
8
|
-
`),s),sourceLineCount:y,lineMap:b,scriptColumns:new Map([...i.columns].map(([r,p])=>[r+e.startLine-1,p]))}}function Yg(e,t="",s=""){return
|
|
9
|
-
`)}function
|
|
8
|
+
`),s),sourceLineCount:y,lineMap:b,scriptColumns:new Map([...i.columns].map(([r,p])=>[r+e.startLine-1,p]))}}function Yg(e,t="",s=""){return oa(e,t,s).text}var ve=new Set(["name","status","length","location","history","origin","closed","close","open","focus","blur","print","scroll","scrollTo","scrollBy","stop","top","parent","self","frames","event","external","menubar","toolbar"]);function Te(e){if(e.length===0)return"";let t=["// Generated \u2014 the composables the runtime publishes as bare globals."],s=new Set(k),d=[];for(let{file:i,names:l}of e){let g=JSON.stringify(i.replace(/\\/g,"/").replace(/\.ts$/,""));d.push(` export * from ${g}`);for(let u of l){if(s.has(u)||ve.has(u))continue;s.add(u),t.push(`declare const ${u}: typeof import(${g})[${JSON.stringify(u)}]`)}}return t.push("declare module '@composables' {",...d,"}"),t.join(`
|
|
9
|
+
`)}function ia(e,t,s){return`${e}.__stx_${t}${s}.ts`}function Zg(e){return e.replace(/\.__stx_(?:server|client|plain|template)\d+\.ts$/,"")}function Dl(){return se("stx.d.ts")}function Ll(){return se("stx-module.d.ts")}function se(e){for(let t of[h.resolve(import.meta.dir,"..",e),h.resolve(import.meta.dir,"..","..",e)])if(B(t))return t;return null}var De=/^(.*?)\((\d+),(\d+)\):\s+(error|warning)\s+TS(\d+):\s+(.*)$/;function re(e){return e>=1000&&e<2000}function oe(e){let t="",s=!1,d=!1;for(let i=0;i<e.length;i++){let l=e[i];if(s){if(t+=l,d)d=!1;else if(l==="\\")d=!0;else if(l==='"')s=!1;continue}if(l==='"'){s=!0,t+=l;continue}if(l==="/"&&e[i+1]==="/"){while(i<e.length&&e[i]!==`
|
|
10
10
|
`)i++;t+=`
|
|
11
|
-
`;continue}if(l==="/"&&e[i+1]==="*"){i+=2;while(i<e.length&&!(e[i]==="*"&&e[i+1]==="/"))i++;i++;continue}t+=l}return t.replace(/,(\s*[}\]])/g,"$1")}function Ee(e){try{return JSON.parse(oe(K(e,"utf8")))}catch{return}}function Ne(e){let t=h.resolve(e),s;for(;;){let r=h.join(t,"tsconfig.json");if(B(r)){s=r;break}let p=h.dirname(t);if(p===t)break;t=p}if(!s)return{};let d=new Set,i=s,l,g,u=s;while(i&&!d.has(i)){d.add(i);let r;try{r=JSON.parse(oe(K(i,"utf8")))}catch{break}let p=r?.compilerOptions??{};if(!l&&p.paths&&typeof p.paths==="object")l=p.paths,u=i;if(!g&&typeof p.baseUrl==="string")g=h.resolve(h.dirname(i),p.baseUrl);if(l&&g)break;i=typeof r?.extends==="string"?h.resolve(h.dirname(i),r.extends.endsWith(".json")?r.extends:`${r.extends}.json`):void 0}if(!l)return{};let y=g??h.dirname(u),b={};for(let[r,p]of Object.entries(l)){if(!Array.isArray(p))continue;b[r]=p.map((f)=>typeof f==="string"&&!h.isAbsolute(f)?h.resolve(y,f):f)}return{paths:b}}async function Qg(e,t={}){let s=t.client!==!1,d=t.server!==!1,i=t.templates!==!1,l=t.componentsDir??(i?(await a()).componentsDir:void 0),g=new Map,u=new Map,y=[],b=[],r=0,p=0,f=
|
|
12
|
-
`);for(let m of ne(o,x))y.push({file:n,line:m.line,column:m.column,code:0,message:m.message,category:"error",blockKind:m.kind});if(s&&S){let m=x.filter((w)=>w.kind!=="server"),O=[...new Set(m.flatMap((w)=>
|
|
11
|
+
`;continue}if(l==="/"&&e[i+1]==="*"){i+=2;while(i<e.length&&!(e[i]==="*"&&e[i+1]==="/"))i++;i++;continue}t+=l}return t.replace(/,(\s*[}\]])/g,"$1")}function Ee(e){try{return JSON.parse(oe(K(e,"utf8")))}catch{return}}function Ne(e){let t=h.resolve(e),s;for(;;){let r=h.join(t,"tsconfig.json");if(B(r)){s=r;break}let p=h.dirname(t);if(p===t)break;t=p}if(!s)return{};let d=new Set,i=s,l,g,u=s;while(i&&!d.has(i)){d.add(i);let r;try{r=JSON.parse(oe(K(i,"utf8")))}catch{break}let p=r?.compilerOptions??{};if(!l&&p.paths&&typeof p.paths==="object")l=p.paths,u=i;if(!g&&typeof p.baseUrl==="string")g=h.resolve(h.dirname(i),p.baseUrl);if(l&&g)break;i=typeof r?.extends==="string"?h.resolve(h.dirname(i),r.extends.endsWith(".json")?r.extends:`${r.extends}.json`):void 0}if(!l)return{};let y=g??h.dirname(u),b={};for(let[r,p]of Object.entries(l)){if(!Array.isArray(p))continue;b[r]=p.map((f)=>typeof f==="string"&&!h.isAbsolute(f)?h.resolve(y,f):f)}return{paths:b}}async function Qg(e,t={}){let s=t.client!==!1,d=t.server!==!1,i=t.templates!==!1,l=t.componentsDir??(i?(await a()).componentsDir:void 0),g=new Map,u=new Map,y=[],b=[],r=0,p=0,f=Dl();for(let n of e){let o=await Bun.file(n).text(),x=Pt(o).filter((m)=>{if(m.kind==="server")return d;return s}),S=Pt(o).filter((m)=>m.kind==="server").map((m)=>m.code).join(`
|
|
12
|
+
`);for(let m of ne(o,x))y.push({file:n,line:m.line,column:m.column,code:0,message:m.message,category:"error",blockKind:m.kind});if(s&&S){let m=x.filter((w)=>w.kind!=="server"),O=[...new Set(m.flatMap((w)=>Nc(S,w.code)))];if(O.length>0)u.set(n,{names:O,line:m[0].startLine,kind:m[0].kind})}let N=h.dirname(h.resolve(n)),D=i?Mc(o,{runtimeGlobals:!f,originDir:N,filePath:h.resolve(n),componentsDir:l}):null,R=D?[...D.lineMap.values()].filter((m)=>m.expression).length:0;if(x.length===0&&R===0)continue;if(b.push(n),r+=x.length,p+=R,x.forEach((m,O)=>{let w=oa(m,S,N);g.set(ia(n,m.kind,O),{virtual:w,source:w.text,origin:n,kind:m.kind})}),D&&R>0)g.set(ia(n,"template",0),{source:D.text,origin:n,kind:"template",virtual:D})}if(g.size===0)return{diagnostics:y,checkedFiles:b,blockCount:0,expressionCount:0};let T=(t.extraLibs??[]).map((n)=>h.resolve(n)),ce=ie(e.length>0?h.dirname(h.resolve(e[0])):process.cwd(),Ee,B);for(let n of ce?.libs??[])if(!T.includes(n)&&B(n))T.push(n);if(f)T.push(f);let F=f?Ll():null;if(F)T.push(F);let G=`${c()}/typecheck/__stx_globals.d.ts`,ae=["// Generated \u2014 the context serve.ts injects into <script server> blocks.",Pc(f?Ic(K(f,"utf8")):void 0),...f?[]:["declare const window: any",...k.map((n)=>`declare const ${n}: any`)],["// Generated \u2014 the names stx auto-imports from @stacksjs/browser.",...xe.map((n)=>`declare const ${n}: any`)].join(`
|
|
13
13
|
`),Te(await wo())].filter(Boolean).join(`
|
|
14
14
|
`),C=`${c()}/typecheck`;await Bun.$`rm -rf ${C}`.quiet().nothrow(),await Bun.$`mkdir -p ${C}`.quiet().nothrow(),await Bun.write(G,ae);let M=new Map,le=0;for(let[n,o]of g){let x=`${le++}_${n.replace(/[^\w.-]+/g,"_")}`;await Bun.write(`${C}/${x}`,o.source),M.set(x,o)}let ue={target:"ESNext",module:"ESNext",moduleResolution:"bundler",strict:!0,noEmit:!0,skipLibCheck:!0,allowJs:!0,esModuleInterop:!0,resolveJsonModule:!0,lib:["ESNext","DOM","DOM.Iterable"],types:[],...Ne(e.length>0?h.dirname(h.resolve(e[0])):process.cwd()),...t.compilerOptions??{}},V=async(n,o)=>{let x=`${C}/tsconfig${o===1?"":`.${o}`}.json`;await Bun.write(x,JSON.stringify({compilerOptions:ue,files:n.map((N)=>`${C}/${N}`).concat(G,...T)},null,2));let S=Bun.spawnSync(["bun","x","tsc","-p",x,"--pretty","false"],{stdout:"pipe",stderr:"pipe"});return{output:new TextDecoder().decode(S.stdout)+new TextDecoder().decode(S.stderr),exitCode:S.exitCode??0}},X=await V([...M.keys()],1),J=X.output,P=[],U=X.exitCode,W=0,pe=new Set(T.map((n)=>n.split("/").pop())),z=0,j=new Set,q=(n)=>{for(let o of n.replace(/\n[\t ]+([^\n]*)/g," $1").split(`
|
|
15
|
-
`)){let x=o.match(De);if(!x)continue;if(W++,pe.has(x[1].split("/").pop()))z++;let[,S,N,D,R,m,O]=x,w=S.split("/").pop(),v=M.get(w);if(!v)continue;if(re(Number(m)))j.add(w);let L=Number(N),A=Number(D),Q;if(v.virtual){let _=di(v.virtual,L,A)??(v.kind!=="template"&&re(Number(m))?di(v.virtual,v.virtual.sourceLineCount,1):null);if(!_||v.kind==="template"&&!_.expression)continue;if(
|
|
15
|
+
`)){let x=o.match(De);if(!x)continue;if(W++,pe.has(x[1].split("/").pop()))z++;let[,S,N,D,R,m,O]=x,w=S.split("/").pop(),v=M.get(w);if(!v)continue;if(re(Number(m)))j.add(w);let L=Number(N),A=Number(D),Q;if(v.virtual){let _=di(v.virtual,L,A)??(v.kind!=="template"&&re(Number(m))?di(v.virtual,v.virtual.sourceLineCount,1):null);if(!_||v.kind==="template"&&!_.expression)continue;if(Dc(_,Number(m)))continue;L=_.line,A=_.column,Q=_.expression?.code.trim()}P.push({file:v.origin,line:L,column:A,code:Number(m),message:O,category:R==="error"?"error":"warning",blockKind:v.kind,expression:Q})}};q(J);let de=W,fe=z;if(j.size>0&&j.size<M.size){let n=[...M.keys()].filter((o)=>!j.has(o));q((await V(n,2)).output)}if(s)for(let[n,o]of u){if(o.names.length===0)continue;P.push({file:n,line:o.line,column:1,code:0,message:`${o.names.length===1?"1 value reaches":`${o.names.length} values reach`} this block on the implicit bridge and ${o.names.length===1?"is":"are"} untyped: ${o.names.join(", ")}. Declare them with defineClientPayload({ ${o.names.join(", ")} }) in the server block to have them checked.`,category:"warning",blockKind:o.kind})}P.push(...y);let H=new Set,I=P.filter((n)=>{let o=`${n.file}:${n.line}:${n.column}:${n.code}:${n.message}`;if(H.has(o))return!1;return H.add(o),!0});I.sort((n,o)=>n.file.localeCompare(o.file)||n.line-o.line||n.column-o.column);let Z=fe>0&&I.length===0,me=Z||U!==0&&de===0?`${Z?"a file passed with --lib has errors of its own, so nothing in your code was checked":`tsc exited ${U} without reporting any diagnostic, so nothing was checked`}. `+"A syntax error in an ambient declaration file does this \u2014 skipLibCheck suppresses "+`SEMANTIC diagnostics only. tsc said:
|
|
16
16
|
${J.trim().split(`
|
|
17
17
|
`).slice(0,12).join(`
|
|
18
18
|
`)||"(no output)"}`:void 0;return{diagnostics:I,checkedFiles:b,blockCount:r,expressionCount:p,failure:me}}function em(e){return e.map((t)=>{let s=t.blockKind==="template"?`[template: ${t.expression??""}]`:`[${t.blockKind==="plain"?"<script>":`<script ${t.blockKind}>`}]`;return`${t.file}:${t.line}:${t.column} ${t.category} TS${t.code} ${t.message} ${s}`}).join(`
|
|
19
19
|
`)}
|
|
20
|
-
export{
|
|
20
|
+
export{oa,Yg,ia,Zg,Dl,Ll,Qg,em};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{kn}from"./chunk-
|
|
3
|
-
`}import P from"path";var Y="stx-page-head:",Z=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,k={dev:null,prod:null};function Q(){let t=
|
|
2
|
+
import{kn}from"./chunk-gebb12ak.js";import{W,S,It,Ot,Cr,m,Qc,bi,U,T}from"./chunk-69cphbrz.js";import{Qt}from"./chunk-qeyzgyhk.js";import{n}from"./chunk-aznnh6cy.js";import{K}from"./chunk-c5vzr1va.js";var q=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function z(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 I(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 X(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 _(t,r="main"){let e=G(r);if(!e)return null;let s=/<([a-z][\w-]*)\b([^>]*)>/gi,a=z(t),i;while((i=s.exec(t))!==null){if(I(i.index,a))continue;let o=i[1].toLowerCase(),c=i[2]||"";if(c.trimEnd().endsWith("/")||q.has(o))continue;if(e.tag&&e.tag!==o)continue;if(!X(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(I(h.index,a))continue;let y=h[1]==="/";if(!y&&(h[2]||"").trimEnd().endsWith("/"))continue;if(p+=y?-1:1,p===0)return{openTag:l,openIndex:i.index,start:u,end:h.index,tagName:o}}return null}return null}var ft="private, no-store";function An(t){return t.replace(/&#(\d+);/g,(r,e)=>N(Number(e),r)).replace(/&#x([0-9a-f]+);/gi,(r,e)=>N(Number.parseInt(e,16),r)).replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&")}function N(t,r){if(!Number.isInteger(t)||t<0||t>1114111)return r;try{return String.fromCodePoint(t)}catch{return r}}function Ce(t){return t.headers.get("X-STX-Router")==="true"}function J(t,r){if(!t)return r;return t.split(",").some((s)=>s.trim().toLowerCase()===r.toLowerCase())?t:`${t}, ${r}`}function L(t){return{Vary:J(t,"X-STX-Router")}}function E(t){return t.replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Pn(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=S(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>${E(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=An(o[l]??"").toLowerCase();if(u==="description"||/^(?:og|twitter):[\w:]+$/.test(u))a.push(`<meta ${l}="${n(u)}" content="${E(o.content??"")}">`)}else{let l=An(o.rel??"").toLowerCase();if(l==="canonical"||l==="alternate"&&o.hreflang)a.push(`<link rel="${l}" href="${E(o.href??"")}"${l==="alternate"?` hreflang="${E(o.hreflang)}"`:""}>`)}}return`<template data-stx-page-head="1">${a.join("")}</template>
|
|
3
|
+
`}import P from"path";var Y="stx-page-head:",Z=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,k={dev:null,prod:null};function Q(){let t=K()?"dev":"prod",r=k[t];if(r!==null)return r;try{let e=import.meta.require("./chunk-nrqv8s48.js"),s=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;k[t]=`<script>${s()}</script>`}catch{k[t]=""}return k[t]}async function aa(t,r){if(r===!1)return null;if(r&&typeof r==="string"){let s=P.resolve(t,r);if(await Bun.file(s).exists())return s;return null}let e=P.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function mo(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=Qt(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:y,defaultConfig:R,loadStxConfig:b}=await import("./chunk-wwbng2jf.js"),A=await b(),d={__filename:t,__dirname:P.dirname(t)};for(let g of o){let C=g.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(C&&!g.includes("client")&&!g.includes('type="module"'))await y(C[1],d,t)}let x=await h(f,d,t,{...R,...A,...r},new Set),w=x.indexOf(p);if(w===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:x.substring(0,w),afterSlot:x.substring(w+p.length),filePath:t,shellScripts:o,shellStyles:c}}catch(e){return console.error(`[stx] Error processing shell ${t}:`,e),null}}function Kr(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">
|
|
@@ -23,10 +23,10 @@ ${c}
|
|
|
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
|
|
26
|
+
`));return c=c.replace(/<body\b[^>]*>/i,""),c=c.replace(/<\/body\s*>/i,""),c.trim()}var D=/^<script\b[^>]*\sdata-stx-(?:owner|instance)(?=[\s=/>])/i;function F(t,r,e,s){if(!D.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 ca(t){return Ce(t)}function tt(t,r){let e=[],s=new Set;for(let a of S(t,W)){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(F(t,a.token,r.start,r.end)||s.has(a.token))continue;s.add(a.token),e.push(a.token)}return e}function qe(t,r="main"){return!!_(t.trim(),r)}function Ee(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],w=/<style\b[^>]*>[\s\S]*?<\/style>/gi,g;while((g=w.exec(x))!==null)a.push(g[0]);let C=/<script\b[^>]*data-stx-(?:route-params|server-data|scoped|component-factories)[^>]*>[\s\S]*?<\/script>/gi;while((g=C.exec(x))!==null){if(D.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=_(s,r);if(!c)return(e?Pn(t):"")+We(t);let l=tt(s,c),u=new Set(l),{tagName:f,start:p,end:h}=c,y=s.slice(p,h).trim(),R=[],b=s.match(/<body\b[^>]*>/i),A=s.lastIndexOf("</body>");if(b&&b.index!==void 0&&A!==-1){let w=[[b.index+b[0].length,c.openIndex],[h+`</${f}>`.length,A]],g=/<script\b[^>]*>[\s\S]*?<\/script>/gi;for(let[C,j]of w){if(C>=j)continue;let B=s.slice(C,j),v;g.lastIndex=0;while((v=g.exec(B))!==null){if(F(s,v[0],p,h))continue;R.push(v[0])}}}let d=[];if(e)d.push(Pn(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(R.length>0)d.push(R.filter((x)=>!u.has(x)).join(`
|
|
30
30
|
`));return d.push(y),d.join(`
|
|
31
|
-
`)}import O from"fs";import H from"path";function
|
|
32
|
-
export{ft,An,Ce,
|
|
31
|
+
`)}import O from"fs";import H from"path";function la(t,r,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:r,outputDir:e}}function ua(t,r){let e=H.join(r,"manifest.json");O.writeFileSync(e,JSON.stringify(t,null,2))}function da(t){let r=H.join(t,"manifest.json");if(!O.existsSync(r))return null;try{let e=O.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 ho(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||!ho(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 pa(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 In(t,r={}){let{html:e,context:s,redirect:a,cookies:i}=await rt(t,r),o=It(s),c=Ot(s);if(a)return{html:e,redirect:a,cookies:i,status:o,headers:c};let{extractStreamBoundaries:l}=await import("./chunk-e6snnz4t.js"),u=l(s),f=t.streamTemplates;if(f&&Object.keys(f).length>0){let{processDirectives:p}=await import("./chunk-0xqec4yj.js"),{defaultConfig:h}=await import("./chunk-72cm91wm.js"),y=s.streamBoundaries||{},R={...h,autoShell:!1},b=Object.keys(f).map((d)=>({id:d,render:async()=>{let x=typeof y[d]==="function"?await y[d]():void 0;return p(f[d],{...s,$boundary:x},t.sourceFile,R,new Set)}})),A=new Set(b.map((d)=>d.id));u=[...(u||[]).filter((d)=>!A.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&&!bi(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=Cr(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(!bi(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=T(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?U(String(l)):"")}catch(l){if(r.__stx_strict_hydration)throw l;i.set(o,"")}return{html:a(Qc(t.html,i)),context:e,cookies:s.cookies}}
|
|
32
|
+
export{ft,An,Ce,L,Pn,aa,mo,Kr,We,ca,qe,Ee,la,ua,da,ho,pa,In};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function o(t,i){let n=t[i],e=i+1;while(e<t.length){if(t[e]==="\\"){e+=2;continue}if(t[e]===n)return e+1;e++}return t.length}function b(t,i){let n=i+1;while(n<t.length){if(t[n]==="\\"){n+=2;continue}if(t[n]==="`")return n+1;if(t[n]==="$"&&t[n+1]==="{"){if(n=
|
|
2
|
+
function o(t,i){let n=t[i],e=i+1;while(e<t.length){if(t[e]==="\\"){e+=2;continue}if(t[e]===n)return e+1;e++}return t.length}function b(t,i){let n=i+1;while(n<t.length){if(t[n]==="\\"){n+=2;continue}if(t[n]==="`")return n+1;if(t[n]==="$"&&t[n+1]==="{"){if(n=el(t,n+2),n<t.length)n++;continue}n++}return t.length}function el(t,i){let n=1,e=i,s="{",f="";while(e<t.length){let l=t[e];if(l==="\\"){e+=2;continue}if(l==='"'||l==="'"){e=o(t,e),s=h,f="";continue}if(l==="`"){e=b(t,e),s=h,f="";continue}if(l==="/"&&t[e+1]==="/"){while(e<t.length&&t[e]!==`
|
|
3
3
|
`)e++;continue}if(l==="/"&&t[e+1]==="*"){e+=2;while(e<t.length&&t.slice(e,e+2)!=="*/")e++;e+=2;continue}if(l==="/"&&a(s,f)){let u=w(t,e);if(u!==-1){e=u,s=h,f="";continue}}if(l==="{")n++;else if(l==="}"){if(n--,n===0)return e}if(/[\w$]/.test(l))f=/[\w$]/.test(s)?f+l:l,s=l;else if(!/\s/.test(l))s=l,f="";e++}return t.length}var m=new Set(["return","typeof","instanceof","in","of","new","delete","void","throw","case","do","else","yield","await"]);function a(t,i){if(i)return m.has(i);return!(t===")"||t==="]"||t===h)}var h="\x00";function w(t,i){let n=i+1,e=!1;while(n<t.length){let s=t[n];if(s===`
|
|
4
4
|
`)return-1;if(s==="\\"){n+=2;continue}if(s==="[")e=!0;else if(s==="]")e=!1;else if(s==="/"&&!e){n++;while(n<t.length&&/[a-z]/i.test(t[n]))n++;return n}n++}return-1}function r(t){let i="",n=0,e="",s="";while(n<t.length){let f=t.slice(n,n+2);if(f==="//"){while(n<t.length&&t[n]!==`
|
|
5
5
|
`)i+=" ",n++;continue}if(f==="/*"){while(n<t.length&&t.slice(n,n+2)!=="*/")i+=t[n]===`
|
|
6
6
|
`?`
|
|
7
7
|
`:" ",n++;i+=" ",n+=2;continue}let l=t[n];if(l==='"'||l==="'"){let u=l;i+=" ",n++;while(n<t.length&&t[n]!==u){if(t[n]==="\\"){i+=" ",n+=2;continue}i+=t[n]===`
|
|
8
8
|
`?`
|
|
9
|
-
`:" ",n++}i+=" ",n++,e=h,s="";continue}if(l==="/"&&a(e,s)){let u=w(t,n);if(u!==-1){i+=`/${" ".repeat(u-n-2)}/`,n=u,e=h,s="";continue}}if(l==="`"){i+=" ",n++;while(n<t.length&&t[n]!=="`"){if(t[n]==="\\"){i+=" ",n+=2;continue}if(t[n]==="$"&&t[n+1]==="{"){let u=n+2,g=
|
|
9
|
+
`:" ",n++}i+=" ",n++,e=h,s="";continue}if(l==="/"&&a(e,s)){let u=w(t,n);if(u!==-1){i+=`/${" ".repeat(u-n-2)}/`,n=u,e=h,s="";continue}}if(l==="`"){i+=" ",n++;while(n<t.length&&t[n]!=="`"){if(t[n]==="\\"){i+=" ",n+=2;continue}if(t[n]==="$"&&t[n+1]==="{"){let u=n+2,g=el(t,u);if(i+=" ",i+=r(t.slice(u,g)),g<t.length)i+=" ";n=g+1;continue}i+=t[n]===`
|
|
10
10
|
`?`
|
|
11
11
|
`:" ",n++}i+=" ",n++,e=h,s="";continue}if(i+=l,n++,/[\w$]/.test(l))s=/[\w$]/.test(e)?s+l:l,e=l;else if(!/\s/.test(l))e=l,s=""}return i}function ge(t){let i=new Uint16Array(t.length),n=0,e=!0;for(let s=0;s<t.length;s++){let f=t[s];if(f===")"||f==="]"||f==="}")if(n===0)e=!1;else n--;if(i[s]=n,f==="("||f==="["||f==="{")n++}return{depths:i,balanced:e&&n===0}}
|
|
12
|
-
export{
|
|
12
|
+
export{el,r,ge};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{t,l,Bt,Ft,zt,He,ot,
|
|
2
|
+
import{t,l,Bt,Ft,zt,He,ot,M,Gs,Ir,Ve}from"./chunk-gebb12ak.js";var O=/(?<![\w$@])@meta\s*\(/g,I=/(?<![\w$@])@metaTag\s*\(/g,C=/(?<![\w$@])@structuredData\s*\(/g,k=/(?<![\w$@])@seo\s*\(/g;function _(e,r){return(n)=>M(e,n,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX)}function N(e){return"property"in e?`<meta property="${c(e.property)}" content="${c(e.content)}">`:`<meta name="${c(e.name)}" content="${c(e.content)}">`}function Zo(e,r,n,g){if(!e.includes("@meta"))return e;let i=Bt(e,O,(a,o)=>{let s=Ir(Ft(a),r);if(s.kind==="tag")return N(s.tag);if(s.kind==="empty")return"";return M("Meta",o,s.message,n,s.code)},_("Meta",n));return i=Bt(i,I,(a,o)=>{let s=zt(a,r);if(!s.ok)return M("MetaTag",o,s.message,n,s.code);if(s.value===void 0||s.value===null)return"";if(!ot(s.value))return M("MetaTag",o,`expected an object such as { name, content }, got ${He(s.value)}`,n,t.TYPE_ERROR);let u=s.value;if(!u.name&&!u.property&&!u.httpEquiv)return M("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 b(e){let r=(n)=>n["@context"]?{...n}:{...n,"@context":"https://schema.org"};if(ot(e))return r(e);if(Array.isArray(e)&&e.length>0&&e.every(ot))return e.map(r);return null}function E(e){return`<script type="application/ld+json">${JSON.stringify(e).replace(/<\//g,"<\\/")}</script>`}function Qo(e,r,n){if(!e.includes("@structuredData"))return e;return Bt(e,C,(g,i)=>{let a=zt(g,r);if(!a.ok)return M("StructuredData",i,a.message,n,a.code);if(a.value===void 0||a.value===null)return"";let o=b(a.value);if(!o)return M("StructuredData",i,`expected an object or an array of objects, got ${He(a.value)}`,n,t.TYPE_ERROR);try{return E(o)}catch(s){let u=s instanceof Error?s.message:String(s);return M("StructuredData",i,`the data cannot be written as JSON: ${u}`,n,t.EVALUATION_ERROR)}},_("StructuredData",n))}var j=new Set(["title","description","keywords","robots","canonical","openGraph","twitter","structuredData"]),A={image:"openGraph.image",url:"canonical or openGraph.url",type:"openGraph.type",siteName:"openGraph.siteName",locale:"openGraph.locale",og:"openGraph",author:"@meta('author', ...)"};function ei(e,r,n,g){if(!e.includes("@seo"))return e;return Bt(e,k,(i,a)=>{if(!i.trim())return M("SEO",a,"expected an object: @seo({ title, description }) or @seo(seoVariable)",n,t.INVALID_DIRECTIVE_SYNTAX);let o=zt(i,r);if(!o.ok)return M("SEO",a,o.message,n,o.code);if(o.value===void 0||o.value===null)return"";if(!ot(o.value))return M("SEO",a,`expected an object such as { title, description }, got ${He(o.value)}`,n,t.TYPE_ERROR);try{return L(o.value,a,n)}catch(s){let u=s instanceof Error?s.message:String(s);return M("SEO",a,`Error processing @seo directive: ${u}`,n,t.EVALUATION_ERROR)}},_("SEO",n))}function R(e,r,n,g){let i=e[r];if(i===void 0||i===null||i===!1)return;if(ot(i))return i;Gs(n,`${r} must be an object, got ${He(i)}; its tags were left out`,g);return}function L(e,r,n){let g=Object.keys(e).filter((s)=>!j.has(s));if(g.length>0){let s=g.map((u)=>A[u]?`${u} (use ${A[u]})`:u).join(", ");Gs(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,Bt,Ft,zt,He,ot,N,Gs,Ir,Ve}from"./chunk-se44tmvx.js";var O=/(?<![\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=b(e.structuredData);if(s)i+=`${E(s)}
|
|
28
|
-
`;else Gs(r,`structuredData must be an object or an array of objects, got ${He(e.structuredData)}; it was left out`,n)}return i.trim()}function ti(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=
|
|
28
|
+
`;else Gs(r,`structuredData must be an object or an array of objects, got ${He(e.structuredData)}; it was left out`,n)}return i.trim()}function ti(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=q(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)}">`,D=G(o)?"":`
|
|
30
30
|
<meta name="description" content="${c(m)}">`,y=`
|
|
31
31
|
<!-- stx SEO Tags -->${f}${D}
|
|
@@ -43,7 +43,7 @@ import{t,l,Bt,Ft,zt,He,ot,N,Gs,Ir,Ve}from"./chunk-se44tmvx.js";var O=/(?<![\w$@]
|
|
|
43
43
|
${y}
|
|
44
44
|
`),h;return h.replace(/<head[^>]*>/,`$&
|
|
45
45
|
${y}
|
|
46
|
-
`)}function
|
|
46
|
+
`)}function q(e){let r=e.search(/<\/head\s*>/i);return r===-1?e:e.slice(0,r)}function v(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?v(r[1].trim()):""}function x(e){return(e.match(/<meta\s[^>]*>/gi)||[]).filter((r)=>/\sname\s*=\s*["']description["']/i.test(r))}function G(e){return x(e).length>0}function U(e){for(let r of x(e)){let n=r.match(/\scontent\s*=\s*(?:"([^"]*)"|'([^']*)')/i),g=(n?.[1]??n?.[2]??"").trim();if(g)return v(g)}return""}function c(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var Cs={name:"meta",rawParams:!0,handler:(e,r,n,g)=>{let i=Ir(r,n??{});if(i.kind==="error")return M("Meta",`@meta(${r.join(", ")})`,i.message,g,i.code);if(i.kind==="empty")return"";if(n)n.__stx_runtime_head=Ve(n.__stx_runtime_head??{},{meta:[i.tag]});return""},hasEndTag:!1},Es={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 E(i)}catch(i){let a=i instanceof Error?i.message:String(i);return l("StructuredData",a,t.EVALUATION_ERROR)}},hasEndTag:!0};function Hh(){return[Cs,Es]}function Vh(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),D=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+=`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{E}from"./chunk-
|
|
2
|
+
import{E}from"./chunk-c5vzr1va.js";import{Ue,Tn}from"./chunk-7xs45trj.js";function m(e){let t={"cache-first":{className:"CacheFirst",importFrom:"workbox-strategies"},"network-first":{className:"NetworkFirst",importFrom:"workbox-strategies"},"stale-while-revalidate":{className:"StaleWhileRevalidate",importFrom:"workbox-strategies"},"network-only":{className:"NetworkOnly",importFrom:"workbox-strategies"},"cache-only":{className:"CacheOnly",importFrom:"workbox-strategies"}};return t[e]||t["network-first"]}function g(e){return m(e).className}function d(e){let t=e.pwa;if(!t?.enabled)return"";let r=t.routes||[],n=t.cacheStorage,c=[];for(let a of r){let i=g(a.strategy),s=[];if(a.maxAgeSeconds||a.maxEntries||n?.maxEntries){let o=a.maxEntries||n?.maxEntries||100,u=a.maxAgeSeconds||(n?.maxAge?n.maxAge*24*60*60:void 0);s.push(`new ExpirationPlugin({
|
|
3
3
|
maxEntries: ${o},
|
|
4
4
|
${u?`maxAgeSeconds: ${u},`:""}
|
|
5
5
|
purgeOnQuotaError: true,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-ybjfr7e8.js";import"./chunk-r9e0r6jx.js";import"./chunk-gebb12ak.js";import{b,x,C,Y}from"./chunk-69cphbrz.js";import"./chunk-m7hfcxt3.js";import"./chunk-dqa1g676.js";import f from"path";var h=["applyOfflineUpdate","broadcast","cacheMedia","calculateDistance","canNotify","clearCookies","clearFetchCache","clearOfflineData","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","onOfflineUpdateReady","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAmbientSound","useAnimationFrame","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBreathPacer","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useCompletion","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useOutbox","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVirtualList","useVisibility","useWakeLock","useWindowSize"],L=new Set(h);var l=new Map,S=b(64),w=new Set,k=0,R=new Set(h);function T(){l.clear(),S.clear()}function P(n){let o=new Map;for(let r of n){let a=f.basename(r);if(a.endsWith(".d.ts"))continue;let t=a.replace(/\.[jt]s$/,"");if(t==="index")continue;if(t===a)continue;let i=o.get(t);if(i&&!i.endsWith(".js"))continue;o.set(t,r)}return[...o.values()].sort()}function I(n,o){let r=o.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${r}\\b`).test(n)}function M(n){if(!n)return[];let o=x(n,k),r=S.get(o);if(r)return r.slice();let a=n.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),t=[];for(let i of R){if(w.has(i))continue;let u=i.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${u}\\s*\\(`).test(a))t.push(i)}return t.sort(),S.set(o,t),t.slice()}async function A(n,o){let r=M(n);if(r.length===0)return null;let a=o??f.join(import.meta.dir,"composables"),t=`${a}\x00${r.join(",")}`,i=l.get(t);if(i!==void 0)return i||null;let u=Y({loader:"ts",target:"browser",define:C()}),O=new Set(r),m=[],d=new Set,p=[];try{let s=new Bun.Glob("*.{ts,js}");for await(let e of s.scan({cwd:a,absolute:!0}))p.push(e)}catch{return l.set(t,""),null}p=P(p);for(let s of p){let e;try{e=await Bun.file(s).text()}catch{continue}let g=[];try{g=u.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!g.some((c)=>O.has(c)))continue;try{e=e.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^import\s+type\s+.*$/gm,""),e=e.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),e=e.replace(/^export\s+default\s+/gm,""),e=e.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),m.push(`// ${f.basename(s).replace(/\.[jt]s$/,"")}
|
|
3
3
|
${u.transformSync(e).trim()}`);for(let c of g)d.add(c)}catch(c){console.warn(`[stx] framework composable ${f.basename(s)} could not be bundled:`,c)}}let y=r.filter((s)=>!d.has(s)&&!I(n,s));if(y.length>0)console.warn(`[stx] could not bundle ${y.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(m.length===0)return l.set(t,""),null;let E=[...d].map((s)=>` try { if (!(${JSON.stringify(s)} in __s)) { __s[${JSON.stringify(s)}] = ${s}; if (!(${JSON.stringify(s)} in window)) window[${JSON.stringify(s)}] = ${s}; } } catch (e) {}`).join(`
|
|
4
4
|
`),v=`<script data-stx-scoped data-stx-run="always" data-stx-framework-composables>
|
|
5
5
|
;(function(){
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Kg}from"./chunk-w3dsj0a6.js";import"./chunk-3k4xb05m.js";import"./chunk-qeyzgyhk.js";import"./chunk-kq0cee7k.js";import"./chunk-aznnh6cy.js";import"./chunk-3ebwrpax.js";import"./chunk-evmxrmjb.js";import"./chunk-g9xx8qh1.js";import"./chunk-2ws2qe1k.js";import"./chunk-vbc8a8fh.js";import"./chunk-3z0e637x.js";import"./chunk-hn2me1qx.js";import"./chunk-69cphbrz.js";import"./chunk-dqa1g676.js";import"./chunk-m7hfcxt3.js";import"./chunk-gebb12ak.js";import"./chunk-r9e0r6jx.js";import"./chunk-ybjfr7e8.js";export{Kg as startProductionServer};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{xe,mi,hi,sg,Nt,qc,og,Kc,Kh,De,yn,Le}from"./chunk-69cphbrz.js";import{el,r}from"./chunk-3vpgr6nk.js";import"./chunk-dqa1g676.js";import"./chunk-m7hfcxt3.js";import"./chunk-gebb12ak.js";import"./chunk-r9e0r6jx.js";import"./chunk-ybjfr7e8.js";export{xe as BROWSER_CORE_IMPORTS,sg as STX_AUTO_IMPORTS,mi as extractAndStripCssImports,De as extractBridgeData,el as findInterpolationEnd,Kc as generateAutoImportDestructuring,Kh as generateBrowserAutoImportDestructuring,yn as generateServerDataBridge,Nt as injectBrowserCoreAutoImports,Le as processClientScript,og as referencesName,hi as renderVendorStyleTags,r as stripCommentsAndLiterals,qc as transformAutoImports};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{es,ts}from"./chunk-
|
|
2
|
+
import{es,ts}from"./chunk-3ec6jf9b.js";import{S}from"./chunk-69cphbrz.js";import{a}from"./chunk-evmxrmjb.js";import{Ke,re}from"./chunk-baj6w8ja.js";import{Ga}from"./chunk-dc584r4z.js";import{j}from"./chunk-cmnze7at.js";import{g}from"./chunk-0dve54ne.js";import{existsSync as F,mkdirSync as y,copyFileSync as P,chmodSync as I,rmSync as ve}from"fs";import{join as c,basename as xe,resolve as X}from"path";import{spawn as z}from"child_process";import{platform as ye}from"os";function E(e,r,i){let n=new RegExp(`</${r}\\s*>`,"iy"),s=S(e,(t,o)=>(n.lastIndex=o,n.exec(t)?n.lastIndex:-1))[0];return s?e.slice(0,s.start)+i+e.slice(s.start):null}var pu=`
|
|
3
3
|
<script>
|
|
4
4
|
(function() {
|
|
5
5
|
'use strict';
|
|
@@ -468,8 +468,8 @@ else if (data.type === 'event' && data.method) {
|
|
|
468
468
|
}
|
|
469
469
|
})();
|
|
470
470
|
</script>
|
|
471
|
-
`;function
|
|
472
|
-
`);if(n!==null)return n;let s=
|
|
471
|
+
`;function xa(e={}){let{debug:r=!1,timeout:i=30000}=e;return pu.replace("debug: false,",`debug: ${r},`).replace("timeout: 30000",`timeout: ${i}`)}function yh(){return!1}function bh(e,r={}){let i=/@craft(?:\(([\s\S]*?)\))?/g;return e.replace(i,(n,s)=>{let t={};if(s)try{t=JSON.parse(s.replace(/'/g,'"'))}catch{try{t=Function(`return ${s}`)()}catch{console.warn(`[stx] Invalid @craft config: ${s}`)}}return xa(t)})}function Sa(e,r={}){if(e.includes("__craftBridgeInitialized"))return e;let i=xa(r),n=E(e,"head",`${i}
|
|
472
|
+
`);if(n!==null)return n;let s=j(e);if(s){let t=s.index+s.tag.length;return e.slice(0,t)+`
|
|
473
473
|
${i}`+e.slice(t)}return i+e}var ko={button:{nativeType:"craft-button",fallbackTag:"button",fallbackClasses:"craft-button",nativeProps:["variant","size","disabled","loading"]},"text-input":{nativeType:"craft-text-input",fallbackTag:"input",fallbackClasses:"craft-text-input",nativeProps:["placeholder","value","type","disabled","readonly"]},textarea:{nativeType:"craft-textarea",fallbackTag:"textarea",fallbackClasses:"craft-textarea",nativeProps:["placeholder","value","rows","disabled","readonly"]},checkbox:{nativeType:"craft-checkbox",fallbackTag:"input",fallbackClasses:"craft-checkbox",nativeProps:["checked","disabled","label"],render:(e,r)=>{let i=e.checked?"checked":"",n=e.disabled?"disabled":"";return`<label class="craft-checkbox-wrapper">
|
|
474
474
|
<input type="checkbox" class="craft-checkbox" ${i} ${n}>
|
|
475
475
|
<span class="craft-checkbox-label">${r||e.label||""}</span>
|
|
@@ -902,7 +902,7 @@ ${i}`+e.slice(t)}return i+e}var ko={button:{nativeType:"craft-button",fallbackTa
|
|
|
902
902
|
}
|
|
903
903
|
}
|
|
904
904
|
</style>
|
|
905
|
-
`,
|
|
905
|
+
`,ka=`
|
|
906
906
|
<script id="craft-component-runtime">
|
|
907
907
|
(function() {
|
|
908
908
|
if (window.__stxCraftComponentRuntime) return;
|
|
@@ -1006,9 +1006,9 @@ ${i}`+e.slice(t)}return i+e}var ko={button:{nativeType:"craft-button",fallbackTa
|
|
|
1006
1006
|
document.addEventListener('craft:nativeui:ready', initializeCraftComponents);
|
|
1007
1007
|
})();
|
|
1008
1008
|
</script>
|
|
1009
|
-
`;function
|
|
1010
|
-
`)??Qr+e;if(!e.includes("craft-component-runtime"))e=E(e,"body",`${
|
|
1011
|
-
`)??e+
|
|
1009
|
+
`;function _a(e,r={}){let{classPrefix:i="craft"}=r;if(!e.includes("craft-component-styles"))e=E(e,"head",`${Qr}
|
|
1010
|
+
`)??Qr+e;if(!e.includes("craft-component-runtime"))e=E(e,"body",`${ka}
|
|
1011
|
+
`)??e+ka;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(n,s,t)=>A("sidebar",s,t.trim(),r,i)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(n,s)=>A("sidebar",s,"",r,i)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(n,s,t)=>A(s,t,"",r,i)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(n,s,t,o)=>A(s,t,o.trim(),r,i)),e}function A(e,r,i,n,s){let t=n.components?.[e]||ko[e];if(!t)return console.warn(`[stx] Unknown Craft component: @craft-${e}`),`<div class="${s}-unknown" data-component="${e}">${i}</div>`;let o=N(r),d=[t.fallbackClasses||`${s}-${e}`];if(o.class)d.push(o.class),delete o.class;if(t.render)return o.__fallbackClasses=d.join(" "),t.render(o,i);let f=ue(o,t,d);if(["input","hr","br","img"].includes(t.fallbackTag))return`<${t.fallbackTag} ${f}>`;return`<${t.fallbackTag} ${f}>${i}</${t.fallbackTag}>`}function N(e){let r={},i=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,n;while((n=i.exec(e))!==null){let[s,t,o,d]=n,f=o??d;if(s.startsWith(":"))r[t]=f;else if(s.startsWith("@"))r[`on${t.charAt(0).toUpperCase()}${t.slice(1)}`]=f;else if(f===void 0)r[t]=!0;else r[t]=f}return r}function te(e,r){let i=B(String(e.id||`craft-sidebar-${fe(r||JSON.stringify(e))}`)),n=ce(e.spaces)||oe(r),s=n.length?[]:le(e.sections)||M(r),t=String(e.selectedSpace||n[0]?.id||""),o=n.find((v)=>v.id===t)||n[0],d=String(e.selectedItem||e.selected||(n.length?o?.sections[0]?.items[0]?.id:s[0]?.items[0]?.id)||""),f={id:i,variant:String(e.variant||"desktop"),material:String(e.material||"sidebar"),backgroundEffect:String(e.backgroundEffect||"shimmer"),allowsVibrancy:e.allowsVibrancy!==!1&&e.allowsVibrancy!=="false",materialOpacity:Number(e.materialOpacity??0.68),materialDarkOpacity:e.materialDarkOpacity===void 0?void 0:Number(e.materialDarkOpacity),minWidth:e.minWidth===void 0?240:Number(e.minWidth),maxWidth:e.maxWidth===void 0?340:Number(e.maxWidth),canCollapse:e.canCollapse!==!1&&e.canCollapse!=="false",searchPlaceholder:e.searchPlaceholder?String(e.searchPlaceholder):void 0,selectedItem:d,sections:s,spaces:n,selectedSpace:t||void 0},p=String(e.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),l=Number(e.width||e.sidebarWidth||286),u=e.native===!1||e.native==="false"?"false":"true",b=f.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${T(f.searchPlaceholder)}"></div>`:"",m;if(n.length)m=de(n,t,d);else if(s.length)m=s.map((v)=>L(v,d)).join("");else m=r;return`<aside class="${x(p)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${x(i)}" data-native="${u}" style="--craft-sidebar-width:${l}px">
|
|
1012
1012
|
${b}
|
|
1013
1013
|
${m}
|
|
1014
1014
|
</aside>
|
|
@@ -1020,9 +1020,9 @@ ${i}`+e.slice(t)}return i+e}var ko={button:{nativeType:"craft-button",fallbackTa
|
|
|
1020
1020
|
${r}
|
|
1021
1021
|
</section>`}function ne(e,r){let i={id:String(e.id||B(String(e.label||r||"item"))),label:String(e.label||r||""),icon:e.icon?String(e.icon):void 0,badge:e.badge?String(e.badge):void 0,tintColor:e.tintColor?String(e.tintColor):void 0};return H(i,String(e.selected||"")==="true")}function M(e){let r=[],i=/<@craft-sidebar-section\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-section>)/g,n;while((n=i.exec(e))!==null){let s=N(n[1]||""),t=n[2]||"",o=String(s.id||B(String(s.header||s.title||`section-${r.length+1}`))),d=String(s.header||s.title||o),f=se(t);r.push({id:o,header:d,title:d,items:f})}return r}function se(e){let r=[],i=/<@craft-sidebar-item\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-item>)/g,n;while((n=i.exec(e))!==null){let s=N(n[1]||""),t=String(s.label||(n[2]||"").replace(/<[^>]*>/g,"").trim()),o=String(s.id||B(t||`item-${r.length+1}`));r.push({id:o,label:t,icon:s.icon?String(s.icon):void 0,badge:s.badge?String(s.badge):void 0,tintColor:s.tintColor?String(s.tintColor):void 0})}return r}function oe(e){let r=[],i=/<@craft-sidebar-space\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-space>)/g,n;while((n=i.exec(e))!==null){let s=N(n[1]||""),t=n[2]||"",o=String(s.label||s.title||`Space ${r.length+1}`);r.push({id:String(s.id||B(o)),label:o,icon:s.icon?String(s.icon):void 0,tint:s.tint?String(s.tint):void 0,sections:M(t)})}return r}function ce(e){if(!e)return;if(Array.isArray(e))return e;if(typeof e!=="string")return;try{let r=JSON.parse(e);return Array.isArray(r)?r:void 0}catch{return}}function de(e,r,i){let n=e.map((t)=>`<button class="craft-sidebar-space-tab" type="button" data-space-target="${x(t.id)}" data-selected="${t.id===r?"true":"false"}" title="${x(t.label||t.id)}">${t.icon?`<span class="craft-sidebar-item-icon" data-icon="${x(t.icon)}"></span>`:T((t.label||t.id).charAt(0))}</button>`).join("");return`<div class="craft-sidebar-spaces">${e.map((t)=>`<section class="craft-sidebar-space" data-space-id="${x(t.id)}" data-selected="${t.id===r?"true":"false"}">
|
|
1022
1022
|
${t.label?`<div class="craft-sidebar-space-title">${T(t.label)}</div>`:""}
|
|
1023
|
-
${t.sections.map((o)=>
|
|
1023
|
+
${t.sections.map((o)=>L(o,i)).join("")}
|
|
1024
1024
|
</section>`).join("")}</div>
|
|
1025
|
-
<div class="craft-sidebar-space-switcher">${n}</div>`}function le(e){if(!e)return;if(Array.isArray(e))return e;if(typeof e!=="string")return;try{let r=JSON.parse(e);return Array.isArray(r)?r:void 0}catch{return}}function
|
|
1025
|
+
<div class="craft-sidebar-space-switcher">${n}</div>`}function le(e){if(!e)return;if(Array.isArray(e))return e;if(typeof e!=="string")return;try{let r=JSON.parse(e);return Array.isArray(r)?r:void 0}catch{return}}function L(e,r){let i=e.header||e.title||e.id;return`<section class="craft-sidebar-section" data-section-id="${x(e.id)}">
|
|
1026
1026
|
<div class="craft-sidebar-section-title">${T(i)}</div>
|
|
1027
1027
|
${e.items.map((n)=>H(n,n.id===r)).join("")}
|
|
1028
1028
|
</section>`}function H(e,r){let i=e.tintColor?` style="--craft-sidebar-icon-color:${x(e.tintColor)}"`:"";return`<button class="craft-sidebar-item" type="button" data-item-id="${x(e.id)}" data-selected="${r?"true":"false"}">
|
|
@@ -1038,8 +1038,8 @@ ${s}</${d}>`:`${s}<${d}/>`}finally{r.delete(n)}}throw TypeError(`Unsupported Inf
|
|
|
1038
1038
|
<plist version="1.0">
|
|
1039
1039
|
${i(e,"","infoPlist")}
|
|
1040
1040
|
</plist>
|
|
1041
|
-
`}async function
|
|
1042
|
-
</head>`)}let d=e.name||xe(e.input,".stx"),f=e.version||"1.0.0",p=e.craftPath||
|
|
1041
|
+
`}async function Ca(e){if(e.window?.cornerRadius!==void 0&&(!Number.isFinite(e.window.cornerRadius)||e.window.cornerRadius<0||e.window.cornerRadius>128))throw Error("Native window cornerRadius must be between 0 and 128");let r=Date.now();try{if(!await Bun.file(e.input).exists())return{success:!1,target:e.target||D(),format:e.format||"app",error:`Input file not found: ${e.input}`};let i=e.target||D(),n=e.format||Be(i);if(e.backend&&i!=="macos")throw Error("Native backend bundles currently support macOS only.");if(e.backend&&!F(X(e.backend.entry)))throw Error(`Native backend not found: ${e.backend.entry}`);let s=e.output||c(process.cwd(),"dist","native");if(!F(s))y(s,{recursive:!0});let t=await a(process.cwd()),o=await Ga(e.input,{context:e.context,options:{...t,isDev:!1},injectCSS:!0});if(o=Sa(o,{debug:e.verbose}),o=_a(o),!o.includes("craft-component-styles")){if(o.includes("</head>"))o=o.replace("</head>",`${Qr}
|
|
1042
|
+
</head>`)}let d=e.name||xe(e.input,".stx"),f=e.version||"1.0.0",p=e.craftPath||Ea(e.runtimeProfile);if(!p)return{success:!1,target:i,format:n,error:"Craft native binary not found on PATH. Run pantry install craft, or specify craftPath for framework development."};if(e.runtimeProfile==="webview"){if(i!=="macos")throw Error("The webview runtime profile is currently available on macOS only.");let u=Bun.spawnSync([p,"--runtime-profile"],{stdout:"pipe",stderr:"pipe",timeout:1e4});if(u.exitCode!==0||u.stdout.toString().trim()!=="webview")throw Error("The requested Craft webview runtime is unavailable. Upgrade Craft with Pantry before building.")}if(p=es(e.craftPath,e.runtimeProfile),e.verbose)console.log(`\uD83D\uDCE6 Building native app for ${i}...`),console.log(` Input: ${e.input}`),console.log(` Output: ${s}`),console.log(` Craft: ${p}`);let l;switch(i){case"macos":l=await Se(o,d,f,s,n,e,p);break;case"windows":l=await $e(o,d,f,s,n,e,p);break;case"linux":l=await Te(o,d,f,s,n,e,p);break;case"ios":l=await Pe(o,d,f,s,e,p);break;case"android":l=await Ie(o,d,f,s,e,p);break;default:l={success:!1,target:i,format:n,error:`Unsupported target: ${i}`}}return l.duration=Date.now()-r,l}catch(i){return{success:!1,target:e.target||D(),format:e.format||"app",error:i.message,duration:Date.now()-r}}}async function Se(e,r,i,n,s,t,o){let d=t.bundleId||`com.stx.${r.toLowerCase().replace(/[^a-z0-9]/g,"")}`,f=c(n,`${r}.app`),p=c(f,"Contents"),l=c(p,"MacOS"),u=c(p,"Resources");ve(f,{recursive:!0,force:!0}),y(l,{recursive:!0}),y(u,{recursive:!0});let b=c(u,"index.html");await Bun.write(b,e);let m="";if(t.sidebar?.enabled&&t.sidebar?.config)m=c(u,"sidebar-config.json"),await Bun.write(m,JSON.stringify(t.sidebar.config));let v=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",k=t.menubarOnly??t.systemTray,h=t.bundleStyle||(await ke(o)?"executable":"launcher");if(t.backend){if(!await Ce(o))throw Error("This Craft runtime does not support bundled backends. Upgrade Craft before building this app.");P(o,c(l,r)),I(c(l,r),493);let C=Ke("native-backend");try{let w=c(C,"launcher.ts"),U=c(import.meta.dir,"native-backend"+(import.meta.path.endsWith(".ts")?".ts":".js"));await Bun.write(w,`import { runNativeBackend } from ${JSON.stringify(U)}
|
|
1043
1043
|
import * as backend from ${JSON.stringify(X(t.backend.entry))}
|
|
1044
1044
|
await runNativeBackend({ html: ${JSON.stringify(e)}, fetch: backend.default, shutdown: Reflect.get(backend, "shutdown"),
|
|
1045
1045
|
maxRequestBodySize: ${t.backend.maxRequestBodySize??33554432} })
|
|
@@ -1076,7 +1076,7 @@ Name=${r}
|
|
|
1076
1076
|
Exec=${u}
|
|
1077
1077
|
Terminal=false
|
|
1078
1078
|
Categories=Utility;
|
|
1079
|
-
`;if(await Bun.write(c(d,`${r.toLowerCase()}.desktop`),b),s==="deb"){let m=c(n,`${r.toLowerCase()}_${i}_amd64.deb`),v=await Oe(d,m,r,i,t);if(!v.success)return{success:!1,target:"linux",format:"deb",error:v.error};return{success:!0,target:"linux",format:"deb",outputPath:m}}if(s==="appimage"){let m=c(n,`${r}-${i}-x86_64.AppImage`),v=await De(d,m,r,t);if(!v.success)return{success:!1,target:"linux",format:"appimage",error:v.error};return{success:!0,target:"linux",format:"appimage",outputPath:m}}return{success:!0,target:"linux",format:"app",outputPath:d}}async function Pe(e,r,i,n,s,t){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${r}' to create an iOS project.`}}async function Ie(e,r,i,n,s,t){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${r}' to create an Android project.`}}function
|
|
1079
|
+
`;if(await Bun.write(c(d,`${r.toLowerCase()}.desktop`),b),s==="deb"){let m=c(n,`${r.toLowerCase()}_${i}_amd64.deb`),v=await Oe(d,m,r,i,t);if(!v.success)return{success:!1,target:"linux",format:"deb",error:v.error};return{success:!0,target:"linux",format:"deb",outputPath:m}}if(s==="appimage"){let m=c(n,`${r}-${i}-x86_64.AppImage`),v=await De(d,m,r,t);if(!v.success)return{success:!1,target:"linux",format:"appimage",error:v.error};return{success:!0,target:"linux",format:"appimage",outputPath:m}}return{success:!0,target:"linux",format:"app",outputPath:d}}async function Pe(e,r,i,n,s,t){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${r}' to create an iOS project.`}}async function Ie(e,r,i,n,s,t){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${r}' to create an Android project.`}}function Ea(e="full"){let r=process.env.CRAFT_BIN;if(r){if(!F(r))throw Error(`CRAFT_BIN points to a missing file: ${r}`);return r}return Bun.which(e==="webview"?"craft-webview":"craft",{PATH:process.env.PATH??"",cwd:process.cwd()})}function D(){switch(ye()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function Be(e){switch(e){case"macos":return"app";case"windows":return"zip";case"linux":return"appimage";case"ios":return"ipa";case"android":return"apk";default:return"app"}}async function Re(e,r,i){return ts({appBundlePath:e,outputPath:r,volumeName:i})}async function Ee(e,r){return new Promise((i)=>{let n=z("zip",["-r",r,"."],{cwd:e});n.on("close",(s)=>{if(s===0)i({success:!0});else i({success:!1,error:`zip exited with code ${s}`})}),n.on("error",(s)=>{i({success:!1,error:s.message})})})}async function Oe(e,r,i,n,s){return new Promise((t)=>{let o=Ke("deb");try{let d=c(o,"pkg"),f=c(d,"DEBIAN"),p=c(d,"usr","bin"),l=c(d,"usr","share","applications"),u=c(d,"usr","share",i.toLowerCase());y(f,{recursive:!0}),y(p,{recursive:!0}),y(l,{recursive:!0}),y(u,{recursive:!0});let b=g("fs").readdirSync(e);for(let h of b)P(c(e,h),c(u,h));let m=`#!/bin/bash
|
|
1080
1080
|
exec /usr/share/${i.toLowerCase()}/${i.toLowerCase()} "$@"`;g("fs").writeFileSync(c(p,i.toLowerCase()),m),I(c(p,i.toLowerCase()),493);let v=`Package: ${i.toLowerCase()}
|
|
1081
1081
|
Version: ${n}
|
|
1082
1082
|
Section: utils
|
|
@@ -1085,7 +1085,7 @@ Architecture: amd64
|
|
|
1085
1085
|
Depends: libgtk-3-0, libwebkit2gtk-4.0-37
|
|
1086
1086
|
Maintainer: ${s.author||"Unknown"}
|
|
1087
1087
|
Description: ${s.description||i}
|
|
1088
|
-
`;g("fs").writeFileSync(c(f,"control"),v);let k=z("dpkg-deb",["--build",d,r]);k.on("close",(h)=>{if(re(o),h===0)t({success:!0});else t({success:!1,error:`dpkg-deb exited with code ${h}`})}),k.on("error",(h)=>{re(o),t({success:!1,error:h.message})})}catch(d){re(o),t({success:!1,error:d.message})}})}async function De(e,r,i,n){return new Promise((s)=>{let t=
|
|
1088
|
+
`;g("fs").writeFileSync(c(f,"control"),v);let k=z("dpkg-deb",["--build",d,r]);k.on("close",(h)=>{if(re(o),h===0)t({success:!0});else t({success:!1,error:`dpkg-deb exited with code ${h}`})}),k.on("error",(h)=>{re(o),t({success:!1,error:h.message})})}catch(d){re(o),t({success:!1,error:d.message})}})}async function De(e,r,i,n){return new Promise((s)=>{let t=Ke("appimage");try{let o=c(t,`${i}.AppDir`),d=c(o,"usr"),f=c(d,"bin"),p=c(d,"share");y(f,{recursive:!0}),y(p,{recursive:!0});let l=c(p,i.toLowerCase());y(l,{recursive:!0});let u=g("fs").readdirSync(e);for(let h of u)P(c(e,h),c(l,h));let b=`#!/bin/bash
|
|
1089
1089
|
SELF=$(readlink -f "$0")
|
|
1090
1090
|
HERE=\${SELF%/*}
|
|
1091
1091
|
export PATH="\${HERE}/usr/bin:\${PATH}"
|
|
@@ -1097,5 +1097,5 @@ Exec=${i.toLowerCase()}
|
|
|
1097
1097
|
Terminal=false
|
|
1098
1098
|
Categories=Utility;
|
|
1099
1099
|
Icon=${i.toLowerCase()}
|
|
1100
|
-
`;g("fs").writeFileSync(c(o,`${i.toLowerCase()}.desktop`),m);let v=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(g("fs").writeFileSync(c(o,`${i.toLowerCase()}.png`),v),n.icon&&F(n.icon))P(n.icon,c(o,`${i.toLowerCase()}.png`));let k=z("appimagetool",[o,r],{env:{...process.env,ARCH:"x86_64"}});k.on("close",(h)=>{if(re(t),h===0)I(r,493),s({success:!0});else s({success:!1,error:`appimagetool exited with code ${h}. Install from https://appimage.github.io/appimagetool/`})}),k.on("error",(h)=>{re(t),s({success:!1,error:`appimagetool not found: ${h.message}`})})}catch(o){re(t),s({success:!1,error:o.message})}})}function
|
|
1101
|
-
export{
|
|
1100
|
+
`;g("fs").writeFileSync(c(o,`${i.toLowerCase()}.desktop`),m);let v=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(g("fs").writeFileSync(c(o,`${i.toLowerCase()}.png`),v),n.icon&&F(n.icon))P(n.icon,c(o,`${i.toLowerCase()}.png`));let k=z("appimagetool",[o,r],{env:{...process.env,ARCH:"x86_64"}});k.on("close",(h)=>{if(re(t),h===0)I(r,493),s({success:!0});else s({success:!1,error:`appimagetool exited with code ${h}. Install from https://appimage.github.io/appimagetool/`})}),k.on("error",(h)=>{re(t),s({success:!1,error:`appimagetool not found: ${h.message}`})})}catch(o){re(t),s({success:!1,error:o.message})}})}function Ta(){return[D()]}function $a(e){switch(e){case"macos":return["app","dmg","pkg"];case"windows":return["app","zip","msi"];case"linux":return["app","deb","rpm","appimage"];case"ios":return["ipa"];case"android":return["apk"];default:return["app"]}}var qe={buildNative:Ca,getAvailableTargets:Ta,getAvailableFormats:$a,detectPlatform:D},xh=qe;
|
|
1101
|
+
export{pu,xa,yh,bh,Sa,ko,Qr,ka,_a,wh,vh,Ca,Ea,Ta,$a,xh};
|