@stacksjs/stx 0.2.684 → 0.2.686
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-2ajbhefk.js → chunk-078as147.js} +1 -1
- package/dist/{chunk-cv10vetd.js → chunk-0nt17nas.js} +2 -2
- package/dist/{chunk-jwxr8rya.js → chunk-0y2hkbc6.js} +1 -1
- package/dist/{chunk-2yphax0x.js → chunk-1rgjy80j.js} +2 -2
- package/dist/chunk-1x0pf3sw.js +2 -0
- package/dist/chunk-31jvtxpx.js +2 -0
- package/dist/{chunk-a20ytcth.js → chunk-4cksc4n3.js} +1 -1
- package/dist/{chunk-1q8cx10w.js → chunk-4dzh6g52.js} +1 -1
- package/dist/{chunk-3ntkdmm9.js → chunk-4j9p27kn.js} +1 -1
- package/dist/chunk-4ntt6d6q.js +2 -0
- package/dist/{chunk-x145xm5r.js → chunk-51fqvchq.js} +6 -6
- package/dist/{chunk-pkcd41b9.js → chunk-58m0kfb3.js} +1 -1
- package/dist/{chunk-yxx4866s.js → chunk-5ahrdnm0.js} +1 -1
- package/dist/{chunk-1y50gat7.js → chunk-5tbey00z.js} +2 -2
- package/dist/{chunk-sa574ehw.js → chunk-67v3rh14.js} +3 -3
- package/dist/{chunk-vf8kma48.js → chunk-6te346zf.js} +1 -1
- package/dist/chunk-71d927c6.js +2 -0
- package/dist/chunk-7gprzmd9.js +2 -0
- package/dist/chunk-7w7e24e9.js +2 -0
- package/dist/{chunk-hk6w3zhm.js → chunk-840waqpm.js} +1 -1
- package/dist/{chunk-rwzmfx1g.js → chunk-90ggz2m1.js} +1 -1
- package/dist/{chunk-mhsshvg1.js → chunk-9c3x72qy.js} +1 -1
- package/dist/chunk-9rv27cdd.js +2 -0
- package/dist/chunk-a1r3jbt4.js +2 -0
- package/dist/{chunk-q28n3hyy.js → chunk-a7hcwkjz.js} +2 -2
- package/dist/chunk-av02901t.js +2 -0
- package/dist/{chunk-5h618jv3.js → chunk-bg6t69qq.js} +1 -1
- package/dist/{chunk-2ar5g9pa.js → chunk-bz3zn6f7.js} +2 -2
- package/dist/chunk-c0fkhe6t.js +2 -0
- package/dist/{chunk-mwxz9kbh.js → chunk-cge9pgyb.js} +2 -2
- package/dist/{chunk-hm69jxmh.js → chunk-cjf01cp4.js} +3 -3
- package/dist/{chunk-w1wzydvp.js → chunk-ct0ee0fr.js} +3 -3
- package/dist/{chunk-8jxqg7kb.js → chunk-d26nb6zy.js} +1 -1
- package/dist/{chunk-sz9xjmx0.js → chunk-d9esaahz.js} +2 -2
- package/dist/{chunk-wyvcxjb8.js → chunk-dbxq6fd7.js} +1 -1
- package/dist/{chunk-jayacz7s.js → chunk-dnbdxbkb.js} +11 -11
- package/dist/{chunk-98xp87m0.js → chunk-dv8a3gp8.js} +1 -1
- package/dist/{chunk-7kzwpskb.js → chunk-dxcn65hq.js} +3 -3
- package/dist/chunk-ebmcecyh.js +2 -0
- package/dist/chunk-ejphs9fs.js +2 -0
- package/dist/chunk-em77nd40.js +2 -0
- package/dist/chunk-exbs8qm6.js +2 -0
- package/dist/{chunk-273mr301.js → chunk-f4fxj7xg.js} +1 -1
- package/dist/{chunk-gwyx2pwf.js → chunk-ffwvbqkp.js} +1 -1
- package/dist/{chunk-ps5v9vm3.js → chunk-fndg9ar3.js} +1 -1
- package/dist/{chunk-dr1em45p.js → chunk-fw12pvmr.js} +5 -5
- package/dist/chunk-gyye3mcb.js +2 -0
- package/dist/chunk-hqj28381.js +3 -0
- package/dist/{chunk-2a1eeywj.js → chunk-hx787tfa.js} +1 -1
- package/dist/{chunk-54mq30ag.js → chunk-hxnvcvkz.js} +1 -1
- package/dist/{chunk-jv7dk4dq.js → chunk-j7phk6kh.js} +1 -1
- package/dist/chunk-jdhdae0h.js +2 -0
- package/dist/{chunk-zt5hp5w5.js → chunk-jgxzbthg.js} +1 -1
- package/dist/chunk-jmjjjgy4.js +2 -0
- package/dist/{chunk-39g00f1z.js → chunk-jq4h969v.js} +1 -1
- package/dist/chunk-k8b4fme9.js +2 -0
- package/dist/{chunk-6e60jp4a.js → chunk-kq1hmpgb.js} +1 -1
- package/dist/{chunk-n11mcrmk.js → chunk-kqzrm2ym.js} +12 -12
- package/dist/{chunk-gymmbbzc.js → chunk-kypwg2ws.js} +21 -9
- package/dist/{chunk-pvn0fc7j.js → chunk-mkaw0bn4.js} +1 -1
- package/dist/{chunk-mhjnz2rh.js → chunk-n4qp4q2x.js} +3 -3
- package/dist/{chunk-49c5v5fh.js → chunk-n93krbsx.js} +1 -1
- package/dist/{chunk-zxqgr2n6.js → chunk-pf25jb54.js} +7 -7
- package/dist/chunk-q4jpjjdc.js +2 -0
- package/dist/{chunk-w28wc7mv.js → chunk-r0ys9aqa.js} +5 -5
- package/dist/{chunk-9wa3t87n.js → chunk-r21m7gsd.js} +1 -1
- package/dist/chunk-rz0kkfd3.js +2 -0
- package/dist/{chunk-8t0fpc9h.js → chunk-s84zv8ky.js} +1 -1
- package/dist/chunk-t2eadw9a.js +2 -0
- package/dist/{chunk-6q1cv39j.js → chunk-v6wa51js.js} +3 -3
- package/dist/{chunk-btdxdmew.js → chunk-vewm4kr8.js} +1 -1
- package/dist/{chunk-xjx1xbey.js → chunk-vnnwp1cg.js} +1 -1
- package/dist/{chunk-nvbkt6a3.js → chunk-w0zrp51m.js} +1 -1
- package/dist/{chunk-t9hx6cr0.js → chunk-x828kq22.js} +1 -1
- package/dist/{chunk-fv1k21jx.js → chunk-xp2cn23j.js} +1 -1
- package/dist/{chunk-p9jkv2y0.js → chunk-xw0cqb5m.js} +36 -36
- package/dist/{chunk-gkmh0xys.js → chunk-ydad3kq5.js} +1 -1
- package/dist/{chunk-qv0zkqem.js → chunk-yf42bhjw.js} +2 -2
- package/dist/{chunk-jkywbfb0.js → chunk-yft8yn6y.js} +2 -2
- package/dist/{chunk-nbjyed3q.js → chunk-ygb33q5w.js} +1 -1
- package/dist/{chunk-15tkxrfe.js → chunk-ymjpqt50.js} +1 -1
- package/dist/{chunk-8gbp2p7c.js → chunk-yqgrjf9q.js} +1 -1
- package/dist/{chunk-12760frv.js → chunk-ywpyxqn5.js} +3 -3
- package/dist/chunk-z0r4vm2m.js +2 -0
- package/dist/{chunk-vfsapkh9.js → chunk-z10ffhzy.js} +8 -8
- package/dist/cli.js +8 -8
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/env.d.ts +1 -1
- package/dist/env.js +2 -2
- package/dist/process.js +2 -2
- package/dist/pwa.js +2 -2
- package/dist/ssg.js +6 -6
- package/dist/types/config-types.d.ts +1 -0
- package/package.json +5 -5
- package/dist/chunk-1yb1haw7.js +0 -2
- package/dist/chunk-2vm6pbj6.js +0 -2
- package/dist/chunk-6rzbn1nb.js +0 -2
- package/dist/chunk-75ftntkm.js +0 -2
- package/dist/chunk-8bwa63m3.js +0 -2
- package/dist/chunk-8y7tpjfs.js +0 -2
- package/dist/chunk-910s13rr.js +0 -2
- package/dist/chunk-97zv3gpm.js +0 -2
- package/dist/chunk-9md86rzc.js +0 -2
- package/dist/chunk-aftam4we.js +0 -2
- package/dist/chunk-bpf3xxng.js +0 -3
- package/dist/chunk-ehvjbag8.js +0 -2
- package/dist/chunk-nfkaeycg.js +0 -2
- package/dist/chunk-p9228zqe.js +0 -2
- package/dist/chunk-pqg3ghvh.js +0 -2
- package/dist/chunk-tq2m6m3j.js +0 -2
- package/dist/chunk-x8w54snc.js +0 -2
- package/dist/chunk-xpqcr7yj.js +0 -2
- package/dist/chunk-xy16pnty.js +0 -2
- package/dist/chunk-yps3rpny.js +0 -2
- package/dist/chunk-ysra569w.js +0 -2
- package/dist/chunk-zhe25pab.js +0 -2
- package/dist/chunk-zr2vnj6g.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{As,Bt,kc,vu}from"./chunk-
|
|
2
|
+
import{As,Bt,kc,vu}from"./chunk-kq1hmpgb.js";export{As as generateServiceWorker,vu as generateServiceWorkerAuto,Bt as getServiceWorkerFileName,kc as isWorkboxEnabled};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ue,Fa,hs,dn,g,Ne,De}from"./chunk-
|
|
2
|
+
import{ue,Fa,hs,dn,g,Ne,De}from"./chunk-xw0cqb5m.js";import{er,Je,N}from"./chunk-1rgjy80j.js";import{Un,o}from"./chunk-dnbdxbkb.js";import{ye}from"./chunk-fw12pvmr.js";function b(s){return s.endsWith(".md")||s.endsWith(".markdown")}function k(s){let e=[];m(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];m(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function m(n,p){let u;while((u=n.exec(s))!==null){let t=u.index,i=t+u[0].length;if(p?.some((l)=>t>=l.start&&i<=l.end))continue;e.push({start:t,end:i})}}if(e.length===0)return s;e.sort((n,p)=>n.start-p.start);let c="",a=0;for(let n of e){if(n.start<a)continue;c+=s.slice(a,n.start),c+=`@raw${s.slice(n.start,n.end)}@endraw`,a=n.end}return c+=s.slice(a),c}async function R(s,e={}){let{data:r,content:m}=er(s),a=await(e.renderer??((n)=>Je(n)))(m);return{html:k(a),frontmatter:r??{}}}import{dirname as v,resolve as _}from"path";function M(s){let e=s,r=ue(s);if(r)e=r.content.trim();let m=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],a=[],n=[],p=(i)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(i),u;while((u=m.exec(s))!==null){let i=u[1],l=u[2],d=u[0],f=i.includes("server");if(p(l))n.push(d);else if(f)a.push(l);else c.push(d)}let t=e;{let i=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,d=[];while((l=i.exec(t))!==null){let f=l.index+l[0].length,x=t.indexOf("</script>",f);if(x===-1)continue;d.push({start:l.index,end:x+9}),i.lastIndex=x+9}for(let f=d.length-1;f>=0;f--)t=t.substring(0,d[f].start)+t.substring(d[f].end)}for(let i of c)t=t.replace(i,"");return{templateContent:t,serverScripts:a,clientScripts:c,signalsScripts:n}}function E(s,e){return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -14,5 +14,5 @@ ${a.join(`
|
|
|
14
14
|
`)}`}else{if(r.processClientScripts!==!1&&a.length>0){let i=p.__stx_event_bindings||[],l=Ne(p),d=await Promise.all(a.map(async(w)=>{let C=w.match(/<script\b([^>]*)>/i)?.[1]||"";if(/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(C))return w;let h=w.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!h)return w;return await De(h[1],{eventBindings:i,templateContent:t,serverData:l,filePath:e})})),x=[await Un(d,{...n,buildMode:"compile"}),...d].filter(Boolean).join(`
|
|
15
15
|
`);if(t.match(/(<\/body>)/i))t=t.replace(/(<\/body>)/i,`${x}
|
|
16
16
|
$1`);else t+=`
|
|
17
|
-
${x}`}t=await ye(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=E(t,r.title)}if(r.injectCSS)try{let{injectCss:i}=await import("./chunk-
|
|
17
|
+
${x}`}t=await ye(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=E(t,r.title)}if(r.injectCSS)try{let{injectCss:i}=await import("./chunk-1x0pf3sw.js");t=await i(t)}catch{}return t}
|
|
18
18
|
export{Zi};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var d=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],u=/<body\b([^>]*)>/gi;function
|
|
3
|
-
export{
|
|
2
|
+
var d=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],u=/<body\b([^>]*)>/gi;function K(n){let i=0,e,c=d.map(()=>{return});while(i<n.length){if(e===void 0||e!==null&&e.index<i)u.lastIndex=i,e=u.exec(n);if(!e)return null;let a=e.index,r=-1,o=null;for(let l=0;l<d.length;l++){let g=d[l],t=c[l];if(t===void 0||t!==null&&t.index<i)g.open.lastIndex=i,t=g.open.exec(n),c[l]=t;if(!t)continue;if(t.index<a&&(r===-1||t.index<r))r=t.index,o=g.close}if(r===-1||!o)return{index:a,tag:e[0],attrs:e[1]??""};o.lastIndex=r;let s=o.exec(n);if(!s)return null;i=s.index+s[0].length}return null}function Ge(n,i){let e=K(n);if(!e)return n;return n.slice(0,e.index)+i(e.tag,e.attrs)+n.slice(e.index+e.tag.length)}
|
|
3
|
+
export{K,Ge};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{t,a,Mt,Lt,jt,Fe,nt,P,Cs,br,ze}from"./chunk-
|
|
2
|
+
import{t,a,Mt,Lt,jt,Fe,nt,P,Cs,br,ze}from"./chunk-r0ys9aqa.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)=>P(e,n,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX)}function N(e){return"property"in e?`<meta property="${l(e.property)}" content="${l(e.content)}">`:`<meta name="${l(e.name)}" content="${l(e.content)}">`}function wo(e,r,n,g){if(!e.includes("@meta"))return e;let i=Mt(e,O,(s,c)=>{let o=br(Lt(s),r);if(o.kind==="tag")return N(o.tag);if(o.kind==="empty")return"";return P("Meta",c,o.message,n,o.code)},_("Meta",n));return i=Mt(i,I,(s,c)=>{let o=jt(s,r);if(!o.ok)return P("MetaTag",c,o.message,n,o.code);if(o.value===void 0||o.value===null)return"";if(!nt(o.value))return P("MetaTag",c,`expected an object such as { name, content }, got ${Fe(o.value)}`,n,t.TYPE_ERROR);let u=o.value;if(!u.name&&!u.property&&!u.httpEquiv)return P("MetaTag",c,"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="${l(u.name)}"`;if(u.property)p+=` property="${l(u.property)}"`;if(u.httpEquiv)p+=` http-equiv="${l(u.httpEquiv)}"`;return p+=` content="${l(u.content)}">`,p},_("MetaTag",n)),i}function b(e){let r=(n)=>n["@context"]?{...n}:{...n,"@context":"https://schema.org"};if(nt(e))return r(e);if(Array.isArray(e)&&e.length>0&&e.every(nt))return e.map(r);return null}function E(e){return`<script type="application/ld+json">${JSON.stringify(e).replace(/<\//g,"<\\/")}</script>`}function xo(e,r,n){if(!e.includes("@structuredData"))return e;return Mt(e,C,(g,i)=>{let s=jt(g,r);if(!s.ok)return P("StructuredData",i,s.message,n,s.code);if(s.value===void 0||s.value===null)return"";let c=b(s.value);if(!c)return P("StructuredData",i,`expected an object or an array of objects, got ${Fe(s.value)}`,n,t.TYPE_ERROR);try{return E(c)}catch(o){let u=o instanceof Error?o.message:String(o);return P("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 So(e,r,n,g){if(!e.includes("@seo"))return e;return Mt(e,k,(i,s)=>{if(!i.trim())return P("SEO",s,"expected an object: @seo({ title, description }) or @seo(seoVariable)",n,t.INVALID_DIRECTIVE_SYNTAX);let c=jt(i,r);if(!c.ok)return P("SEO",s,c.message,n,c.code);if(c.value===void 0||c.value===null)return"";if(!nt(c.value))return P("SEO",s,`expected an object such as { title, description }, got ${Fe(c.value)}`,n,t.TYPE_ERROR);try{return L(c.value,s,n)}catch(o){let u=o instanceof Error?o.message:String(o);return P("SEO",s,`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(nt(i))return i;Cs(n,`${r} must be an object, got ${Fe(i)}; its tags were left out`,g);return}function L(e,r,n){let g=Object.keys(e).filter((o)=>!j.has(o));if(g.length>0){let o=g.map((u)=>A[u]?`${u} (use ${A[u]})`:u).join(", ");Cs(r,`@seo does not read ${o}; ${g.length===1?"it was":"they were"} ignored`,n)}let i="";if(e.title)i+=`<title>${l(e.title)}</title>
|
|
3
3
|
`,i+=`<meta name="title" content="${l(e.title)}">
|
|
4
4
|
`;if(e.description)i+=`<meta name="description" content="${l(e.description)}">
|
|
5
5
|
`;if(e.keywords){let o=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;i+=`<meta name="keywords" content="${l(o)}">
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-r0ys9aqa.js";import"./chunk-gtktv6nn.js";import"./chunk-6beg47t4.js";import"./chunk-xw0cqb5m.js";import"./chunk-t6m5d64b.js";import"./chunk-bg6t69qq.js";import"./chunk-tenbwcts.js";import"./chunk-0y2hkbc6.js";import{c}from"./chunk-xvs84gas.js";import u from"fs";import l from"path";async function d(e,t={}){let s=Date.now(),n={total:0,passed:0,failed:0,new:0,failures:[],duration:0},i=t.snapshotDir||c(e.root,"story","snapshots");await u.promises.mkdir(i,{recursive:!0});let r=e.storyFiles;if(t.filter&&t.filter.length>0)r=r.filter((a)=>t.filter.some((o)=>a.fileName.toLowerCase().includes(o.toLowerCase())));for(let a of r)await h(a,i,t,n);return n.duration=Date.now()-s,n}async function h(e,t,s,n){let i=e.story;if(!i)return;for(let r of i.variants){n.total++;let a=l.join(t,`${e.id}-${r.id}.snap`),o=g(r.source||""),f=await w(a);if(s.update||!f){let p={storyId:e.id,variantId:r.id,component:e.fileName,timestamp:Date.now(),hash:o};if(await u.promises.writeFile(a,JSON.stringify(p,null,2)),!f)n.new++;n.passed++}else try{let p=await u.promises.readFile(a,"utf-8"),m=JSON.parse(p);if(m.hash===o)n.passed++;else n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:"Snapshot mismatch",difference:y(m.hash,o)})}catch(p){n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:`Error reading snapshot: ${p}`})}}}async function x(e,t={}){return(await d(e,{...t,update:!0})).total}function g(e){let t=0;for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);t=(t<<5)-t+n,t=t&t}return t.toString(16)}function y(e,t){if(e===t)return 0;let s=Math.abs(Number.parseInt(e,16)-Number.parseInt(t,16));return Math.min(s/1e6,1)}async function w(e){try{return await u.promises.access(e),!0}catch{return!1}}function F(e){let t=[];if(t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(" STX Story Visual Regression Tests"),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),e.failures.length>0){t.push(" \u274C Failures:"),t.push("");for(let s of e.failures){if(t.push(` \u2022 ${s.component} / ${s.variantId}`),t.push(` ${s.message}`),s.difference!==void 0)t.push(` Difference: ${(s.difference*100).toFixed(2)}%`);t.push("")}}if(t.push(" Summary:"),t.push(` Total: ${e.total}`),t.push(` Passed: ${e.passed} \u2713`),t.push(` Failed: ${e.failed} \u2717`),e.new>0)t.push(` New: ${e.new} \u26A1`);return t.push(` Time: ${e.duration}ms`),t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),t.join(`
|
|
3
3
|
`)}export{F as formatTestResults,d as runVisualTests,x as updateSnapshots};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{gl,ml,Ee,hl,ra,Xt,Jt,cp,sa,Yt,Hn,yl,bl,vl,Js,Zt,wl,Qt,xl}from"./chunk-
|
|
2
|
+
import{gl,ml,Ee,hl,ra,Xt,Jt,cp,sa,Yt,Hn,yl,bl,vl,Js,Zt,wl,Qt,xl}from"./chunk-ffwvbqkp.js";import"./chunk-0nt17nas.js";import"./chunk-374nhgyf.js";import"./chunk-1rgjy80j.js";import"./chunk-0y2hkbc6.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-ygb33q5w.js";import"./chunk-kypwg2ws.js";import"./chunk-xw0cqb5m.js";import"./chunk-bg6t69qq.js";import"./chunk-t6m5d64b.js";import"./chunk-r0ys9aqa.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{Hn as MODULE_SPECIFIER_PREFIX,gl as bundleCacheDir,ml as bundleCacheEntryLimit,Qt as bundleClientScript,Jt as clearBundleFailures,Ee as clientBundleDependencies,Xt as getBundleFailures,Yt as hasUserImports,Zt as moduleSubstitutionKey,bl as normalizeRegistrySpecifiers,wl as queueClientBundleBuild,ra as recordBundleFailure,yl as registryIdForPath,sa as resolveBundlerFallback,vl as rewriteRegistryImports,cp as setBundlerFallbackMode,hl as shouldLogBundlerDiagnostics,xl as tempBuildName,Js as withModuleSubstitutes};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{S}from"./chunk-gtktv6nn.js";import{T,xn}from"./chunk-6beg47t4.js";import{on,b,w,k,J}from"./chunk-
|
|
2
|
+
import{S}from"./chunk-gtktv6nn.js";import{T,xn}from"./chunk-6beg47t4.js";import{on,b,w,k,J}from"./chunk-xw0cqb5m.js";import{i}from"./chunk-1rgjy80j.js";import{Ee,Yt,Zt,Qt}from"./chunk-ffwvbqkp.js";import{ht}from"./chunk-51fqvchq.js";import{pt,Nn,qt,ae}from"./chunk-2pga7zzb.js";import{C,wr}from"./chunk-078as147.js";import h from"path";var x=new Map,D=new Map,A=b(64),E=new Map,Z=["composables","functions"];function z(t){let n=h.basename(t,".ts");return n==="index"||n==="types"||t.endsWith(".d.ts")}async function q(t){if(t)return h.resolve(t);let n=`<default>:${process.cwd()}`,a=E.get(n);if(a!==void 0)return a;let e=await Q();if(e!==null)E.set(n,e);return e}async function Q(){let t=await i(),n=t.root||process.cwd(),a=t.composablesDir;if(a)return h.resolve(n,a);for(let e of Z){let s=h.resolve(n,e);try{let d=new Bun.Glob("**/*.ts");for await(let c of d.scan({cwd:s,absolute:!0}))if(!z(c))return s}catch{}}return null}async function G(t){let n=Array.isArray(t)?t:t?[h.resolve(t)]:(await i())._layerComposableDirs??[await q()].filter((e)=>!!e),a=new Map;for(let e of n){let s=new Bun.Glob("**/*.ts");try{for await(let d of s.scan({cwd:e,absolute:!0})){let c=h.relative(e,d);if(!z(d)&&!a.has(c))a.set(c,d)}}catch{}}return{key:n.join("\x00"),files:[...a.values()].sort()}}async function Ws(t){let{files:n}=await G(t),a=J({loader:"ts",target:"browser",define:k()}),e=[];for(let s of n)try{let d=await Bun.file(s).text(),c=a.scan(d).exports.filter((m)=>m!=="default");if(c.length>0)e.push({file:s,names:c})}catch{}return e}function V(t,n){return new RegExp(`\\b${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(t)}function L(t,n){let a=new Set(t.match(/\w+/g)),e=new Set;for(let s of n)if(/^\w+$/.test(s)?a.has(s):V(t,s))e.add(s);return e}var U=b(64);function Y(t,n){let a=w(t,n.size),e=U.get(a);if(e)return e;let s;try{s=on(t,n)}catch{s=L(t,n)}let d=[...t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}\s*=\s*window\.__composables\u0008/g),...t.matchAll(/import\s*\{([^}]*)\}\s*from\s*['"]@composables['"]/g)];for(let c of d)for(let m of c[1].split(",")){let p=m.trim().split(/\s*(?::|\u0008as\u0008)\s*/)[0];if(p&&n.has(p))s.add(p)}return U.set(a,s),s}function ee(t,n,a){let e=new Map;for(let{file:u,names:l}of t)for(let f of l)if(!e.has(f))e.set(f,u);let s=(u)=>{let l=[];for(let f of L(u,e.keys()))l.push(e.get(f));return l},d=new Set(e.keys()),c=(u)=>{let l=[];for(let f of Y(u,d))l.push(e.get(f));return l},m=new Set,p=a.flatMap((u,l)=>l===0?s(u):c(u));while(p.length>0){let u=[];for(let l of p){if(m.has(l))continue;m.add(l);for(let f of c(n.get(l)??""))if(!m.has(f))u.push(f)}p=u}return m}async function qd(t,n,a){let{key:e,files:s}=await G(t);if(!e)return null;let d=()=>[...new Set([...s,...s.flatMap((o)=>Ee(o))])],c=pt(d());if(s.length===0)return ae(x,e,c,""),null;s.sort();let m=J({loader:"ts",target:"browser",define:k()}),p=qt(D,e,c);if(!p){let o=new Map,r=[];for(let g of s)try{let y=await Bun.file(g).text();o.set(g,y);let _=m.scan(y).exports.filter((X)=>X!=="default");if(_.length>0)r.push({file:g,names:_})}catch{o.set(g,"")}p=ae(D,e,c,{codeByFile:o,modules:r})}let{codeByFile:u,modules:l}=p,f;if(n===void 0)f=new Set(s);else{let o=a?[n,...a]:[n],r=w(o.join("\x00"),e,o.length,c),g=A.get(r);if(f=g??ee(l,u,o),!g)A.set(r,f)}if(f.size===0)return null;let I=s.filter((o)=>f.has(o)),B=`${e}\x00${I.join("\x00")}\x00${Zt()}`,F=qt(x,B,c);if(F!==void 0)return F||null;let M=[],v=new Set,R=new Set;for(let o of I)try{let r=u.get(o)??await Bun.file(o).text(),g=h.basename(o,".ts");for(let _ of r.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(_[1])R.add(_[1]);let y=[];try{for(let _ of m.scan(r).exports)if(_!=="default")v.add(_),y.push(_)}catch{}if(r=T(r),Yt(r))r=await Qt(r,o,{projectRoot:process.cwd(),externalizeUserModules:!1,expose:y}),r=ht(r);r=xn(r),r=r.replace(/^export\s+(default\s+)?/gm,""),r=m.transformSync(r),M.push(`// Composable: ${g}
|
|
3
3
|
${r.trim()}`)}catch(r){console.warn(`[stx] Failed to load composable ${o}:`,r)}if(M.length===0||v.size===0)return ae(x,B,c,""),null;let H=[...v].map((o)=>` try { if (!(${JSON.stringify(o)} in __c)) __c[${JSON.stringify(o)}] = ${o}; } catch (e) {}`).join(`
|
|
4
4
|
`),j=JSON.stringify([...v]),N=M.join(`
|
|
5
5
|
|
|
@@ -29,5 +29,5 @@ ${H}
|
|
|
29
29
|
window[__n] = __c[__n];
|
|
30
30
|
__published[__n] = true;
|
|
31
31
|
}
|
|
32
|
-
})();`,O=C()?wr(K):K;return c=pt(d()),ae(x,B,c,O),O}function
|
|
33
|
-
export{Ws,qd,
|
|
32
|
+
})();`,O=C()?wr(K):K;return c=pt(d()),ae(x,B,c,O),O}function Kd(){x.clear(),Nn(),D.clear(),A.clear(),E.clear()}
|
|
33
|
+
export{Ws,qd,Kd};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Iu}from"./chunk-hxnvcvkz.js";import"./chunk-dnbdxbkb.js";import"./chunk-67v3rh14.js";import"./chunk-9bgb9n12.js";import"./chunk-dxcn65hq.js";import"./chunk-pf25jb54.js";import"./chunk-n4qp4q2x.js";import"./chunk-hx787tfa.js";import"./chunk-51fqvchq.js";import"./chunk-fw12pvmr.js";import"./chunk-jgxzbthg.js";import"./chunk-58m0kfb3.js";import"./chunk-1rgjy80j.js";import"./chunk-0y2hkbc6.js";import"./chunk-tenbwcts.js";import"./chunk-912r15hr.js";import"./chunk-ygb33q5w.js";import"./chunk-kypwg2ws.js";import"./chunk-xw0cqb5m.js";import"./chunk-bg6t69qq.js";import"./chunk-t6m5d64b.js";import"./chunk-r0ys9aqa.js";import"./chunk-6beg47t4.js";import"./chunk-gtktv6nn.js";export{Iu as startInteractive};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{i}from"./chunk-
|
|
2
|
+
import{i}from"./chunk-1rgjy80j.js";import{Ue,ne}from"./chunk-03xn8244.js";import{Zi}from"./chunk-yf42bhjw.js";import{f}from"./chunk-b7e07ybq.js";import{existsSync as A,mkdirSync as x,copyFileSync as T,chmodSync as P,rmSync as ue}from"fs";import{join as c,basename as be,resolve as H}from"path";import{spawn as q}from"child_process";import{platform as ge}from"os";var ep=`
|
|
3
3
|
<script>
|
|
4
4
|
(function() {
|
|
5
5
|
'use strict';
|
|
@@ -939,7 +939,7 @@ else if (data.type === 'event' && data.method) {
|
|
|
939
939
|
</script>
|
|
940
940
|
`.replace("debug: false,",`debug: ${r},`).replace("timeout: 30000",`timeout: ${a}`)}function tp(){return!1}function np(e,r={}){let a=/@craft(?:\(([\s\S]*?)\))?/g;return e.replace(a,(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 Hi(t)})}function Vi(e,r={}){if(e.includes("__craftBridgeInitialized"))return e;let a=Hi(r);if(e.includes("</head>"))return e.replace("</head>",`${a}
|
|
941
941
|
</head>`);if(e.includes("<body"))return e.replace(/(<body[^>]*>)/,`$1
|
|
942
|
-
${a}`);return a+e}var
|
|
942
|
+
${a}`);return a+e}var Gs={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 a=e.checked?"checked":"",n=e.disabled?"disabled":"";return`<label class="craft-checkbox-wrapper">
|
|
943
943
|
<input type="checkbox" class="craft-checkbox" ${a} ${n}>
|
|
944
944
|
<span class="craft-checkbox-label">${r||e.label||""}</span>
|
|
945
945
|
</label>`}},radio:{nativeType:"craft-radio",fallbackTag:"input",fallbackClasses:"craft-radio",nativeProps:["checked","disabled","name","value","label"]},select:{nativeType:"craft-select",fallbackTag:"select",fallbackClasses:"craft-select",nativeProps:["value","disabled","options","placeholder"]},slider:{nativeType:"craft-slider",fallbackTag:"input",fallbackClasses:"craft-slider",nativeProps:["value","min","max","step","disabled"],render:(e,r)=>{let a=e.min??0,n=e.max??100,s=e.step??1,t=e.value??50,o=e.disabled?"disabled":"";return`<input type="range" class="craft-slider" min="${a}" max="${n}" step="${s}" value="${t}" ${o}>`}},label:{nativeType:"craft-label",fallbackTag:"span",fallbackClasses:"craft-label",nativeProps:["text","for"]},badge:{nativeType:"craft-badge",fallbackTag:"span",fallbackClasses:"craft-badge",nativeProps:["variant","size"]},avatar:{nativeType:"craft-avatar",fallbackTag:"div",fallbackClasses:"craft-avatar",nativeProps:["src","alt","size","fallback"],render:(e,r)=>{let a=e.size||40,n=e.src,s=String(e.alt||""),t=e.fallback||(s?s.charAt(0).toUpperCase():"?");if(n)return`<img class="craft-avatar" src="${n}" alt="${s}" style="width:${a}px;height:${a}px;border-radius:50%">`;return`<div class="craft-avatar craft-avatar-fallback" style="width:${a}px;height:${a}px;border-radius:50%;display:flex;align-items:center;justify-content:center">${t}</div>`}},progress:{nativeType:"craft-progress",fallbackTag:"div",fallbackClasses:"craft-progress",nativeProps:["value","max","variant"],render:(e,r)=>{let a=Number(e.value)||0,n=Number(e.max)||100;return`<div class="craft-progress"><div class="craft-progress-bar" style="width:${Math.min(100,Math.max(0,a/n*100))}%"></div></div>`}},spinner:{nativeType:"craft-spinner",fallbackTag:"div",fallbackClasses:"craft-spinner",nativeProps:["size"],render:(e,r)=>{let a=e.size||24;return`<div class="craft-spinner" style="width:${a}px;height:${a}px"></div>`}},card:{nativeType:"craft-card",fallbackTag:"div",fallbackClasses:"craft-card",nativeProps:["title","subtitle","variant"]},modal:{nativeType:"craft-modal",fallbackTag:"dialog",fallbackClasses:"craft-modal",nativeProps:["open","title","closable","size"],render:(e,r)=>{let a=e.open?"open":"",n=e.title||"";return`<dialog class="craft-modal" ${a}>
|
|
@@ -2940,7 +2940,7 @@ ${a}`);return a+e}var Ks={button:{nativeType:"craft-button",fallbackTag:"button"
|
|
|
2940
2940
|
document.addEventListener('craft:nativeui:ready', initializeCraftComponents);
|
|
2941
2941
|
})();
|
|
2942
2942
|
</script>
|
|
2943
|
-
`;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(n,s,t)=>O("sidebar",s,t.trim(),r,a)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(n,s)=>O("sidebar",s,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(n,s,t)=>O(s,t,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(n,s,t,o)=>O(s,t,o.trim(),r,a)),e}function O(e,r,a,n,s){let t=n.components?.[e]||
|
|
2943
|
+
`;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(n,s,t)=>O("sidebar",s,t.trim(),r,a)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(n,s)=>O("sidebar",s,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(n,s,t)=>O(s,t,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(n,s,t,o)=>O(s,t,o.trim(),r,a)),e}function O(e,r,a,n,s){let t=n.components?.[e]||Gs[e];if(!t)return console.warn(`[stx] Unknown Craft component: @craft-${e}`),`<div class="${s}-unknown" data-component="${e}">${a}</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,a);let l=se(o,t,d);if(["input","hr","br","img"].includes(t.fallbackTag))return`<${t.fallbackTag} ${l}>`;return`<${t.fallbackTag} ${l}>${a}</${t.fallbackTag}>`}function N(e){let r={},a=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,n;while((n=a.exec(e))!==null){let[s,t,o,d]=n,l=o??d;if(s.startsWith(":"))r[t]=l;else if(s.startsWith("@"))r[`on${t.charAt(0).toUpperCase()}${t.slice(1)}`]=l;else if(l===void 0)r[t]=!0;else r[t]=l}return r}function Y(e,r){let a=I(String(e.id||`craft-sidebar-${ae(r||JSON.stringify(e))}`)),n=ee(e.spaces)||Z(r),s=n.length?[]:re(e.sections)||z(r),t=String(e.selectedSpace||n[0]?.id||""),o=n.find((w)=>w.id===t)||n[0],d=String(e.selectedItem||e.selected||(n.length?o?.sections[0]?.items[0]?.id:s[0]?.items[0]?.id)||""),l={id:a,variant:String(e.variant||"desktop"),material:String(e.material||"sidebar"),backgroundEffect:String(e.backgroundEffect||"shimmer"),allowsVibrancy:e.allowsVibrancy!==!1&&e.allowsVibrancy!=="false",materialOpacity:Number(e.materialOpacity??0.68),materialDarkOpacity:e.materialDarkOpacity===void 0?void 0:Number(e.materialDarkOpacity),minWidth:e.minWidth===void 0?240:Number(e.minWidth),maxWidth:e.maxWidth===void 0?340:Number(e.maxWidth),canCollapse:e.canCollapse!==!1&&e.canCollapse!=="false",searchPlaceholder:e.searchPlaceholder?String(e.searchPlaceholder):void 0,selectedItem:d,sections:s,spaces:n,selectedSpace:t||void 0},u=String(e.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),p=Number(e.width||e.sidebarWidth||286),b=e.native===!1||e.native==="false"?"false":"true",y=l.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${k(l.searchPlaceholder)}"></div>`:"",g;if(n.length)g=te(n,t,d);else if(s.length)g=s.map((w)=>M(w,d)).join("");else g=r;return`<aside class="${v(u)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${v(a)}" data-native="${b}" style="--craft-sidebar-width:${p}px">
|
|
2944
2944
|
${y}
|
|
2945
2945
|
${g}
|
|
2946
2946
|
</aside>
|
|
@@ -2961,8 +2961,8 @@ ${a}`);return a+e}var Ks={button:{nativeType:"craft-button",fallbackTag:"button"
|
|
|
2961
2961
|
${e.icon?`<span class="craft-sidebar-item-icon" data-icon="${v(e.icon)}"${a}></span>`:""}
|
|
2962
2962
|
<span class="craft-sidebar-item-label">${k(e.label)}</span>
|
|
2963
2963
|
${e.badge?`<span class="craft-sidebar-item-badge">${k(e.badge)}</span>`:""}
|
|
2964
|
-
</button>`}function I(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function ae(e){let r=5381;for(let a=0;a<e.length;a++)r=r*33^e.charCodeAt(a);return(r>>>0).toString(36)}function k(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function v(e){return k(e).replace(/`/g,"`")}function ie(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function se(e,r,a){let n=[];n.push(`class="${a.join(" ")}"`),n.push(`data-craft="${r.nativeType}"`);for(let[s,t]of Object.entries(e))if(t===!0)n.push(s);else if(t!==!1&&t!==void 0&&t!==null){let o=String(t).replace(/"/g,""");n.push(`${s}="${o}"`)}return n.join(" ")}function sp(e,r){
|
|
2965
|
-
</head>`)}let d=e.name||be(e.input,".stx"),l=e.version||"1.0.0",u=e.craftPath||await
|
|
2964
|
+
</button>`}function I(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function ae(e){let r=5381;for(let a=0;a<e.length;a++)r=r*33^e.charCodeAt(a);return(r>>>0).toString(36)}function k(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function v(e){return k(e).replace(/`/g,"`")}function ie(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function se(e,r,a){let n=[];n.push(`class="${a.join(" ")}"`),n.push(`data-craft="${r.nativeType}"`);for(let[s,t]of Object.entries(e))if(t===!0)n.push(s);else if(t!==!1&&t!==void 0&&t!==null){let o=String(t).replace(/"/g,""");n.push(`${s}="${o}"`)}return n.join(" ")}function sp(e,r){Gs[e]=r}function op(){return{...Gs}}import{copyFileSync as oe,mkdtempSync as ce,rmSync as de,writeFileSync as le}from"fs";import{tmpdir as fe}from"os";import{join as F}from"path";function pe(e){let r=Bun.spawnSync(["/usr/bin/plutil","-extract","Entitlements","xml1","-o","-","-"],{stdin:e});if(r.exitCode!==0)throw Error(`Could not extract the macOS profile entitlements: ${r.stderr.toString().trim()||r.stdout.toString().trim()}`);let a=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-","-"],{stdin:r.stdout});if(a.exitCode!==0)throw Error(`Could not convert the macOS profile entitlements: ${a.stderr.toString().trim()||a.stdout.toString().trim()}`);let n=JSON.parse(a.stdout.toString());if(!n||typeof n!=="object"||Array.isArray(n))throw Error("The macOS profile entitlements must be a dictionary.");return n}async function L(e,r=[],a={}){if(process.platform!=="darwin")return;let n=a.entitlements,s;try{if(a.provisioningProfile){if(!a.identity||a.identity==="-")throw Error("A provisioning profile requires a signing identity.");let l=Bun.spawnSync(["/usr/bin/security","cms","-D","-i",a.provisioningProfile]);if(l.exitCode!==0)throw Error("Could not decode the macOS provisioning profile.");let u=pe(l.stdout),p={};if(a.entitlements){let b=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-",a.entitlements]);if(b.exitCode!==0)throw Error("Could not read the app entitlements plist.");p=JSON.parse(b.stdout.toString())}for(let b of["com.apple.application-identifier","com.apple.developer.team-identifier"])if(u[b])p[b]=u[b];if(s=ce(F(fe(),"stx-entitlements-")),n=F(s,"entitlements.plist"),le(n,JSON.stringify(p)),Bun.spawnSync(["/usr/bin/plutil","-convert","xml1",n]).exitCode!==0)throw Error("Could not generate the provisioned app entitlements.");oe(a.provisioningProfile,F(e,"Contents","embedded.provisionprofile"))}for(let l of[...r,e]){let u=a.hardenedRuntime?["--options","runtime"]:[];if(l===e&&n)u.push("--entitlements",n);let p=a.identity&&a.identity!=="-"?"--timestamp":"--timestamp=none",b=Bun.spawn(["/usr/bin/codesign","--force","--sign",a.identity||"-",p,...u,l],{stdout:"pipe",stderr:"pipe"}),[y,g]=await Promise.all([new Response(b.stderr).text(),b.exited]);if(g!==0)throw Error(`Could not sign native bundle ${l}: ${y.trim()}`)}let t=Bun.spawn(["/usr/bin/codesign","--verify","--strict",e],{stdout:"pipe",stderr:"pipe"}),[o,d]=await Promise.all([new Response(t.stderr).text(),t.exited]);if(d!==0)throw Error(`Invalid native bundle signature: ${o.trim()}`)}finally{if(s)de(s,{recursive:!0,force:!0})}}async function qi(e){let r=Date.now();try{if(!await Bun.file(e.input).exists())return{success:!1,target:e.target||R(),format:e.format||"app",error:`Input file not found: ${e.input}`};let a=e.target||R(),n=e.format||ke(a);if(e.backend&&a!=="macos")throw Error("Native backend bundles currently support macOS only.");if(e.backend&&!A(H(e.backend.entry)))throw Error(`Native backend not found: ${e.backend.entry}`);let s=e.output||c(process.cwd(),"dist","native");if(!A(s))x(s,{recursive:!0});let t=await i(process.cwd()),o=await Zi(e.input,{context:e.context,options:{...t,isDev:!1}});if(o=Vi(o,{debug:e.verbose}),o=Wi(o),!o.includes("craft-component-styles")){if(o.includes("</head>"))o=o.replace("</head>",`${Ui}
|
|
2965
|
+
</head>`)}let d=e.name||be(e.input,".stx"),l=e.version||"1.0.0",u=e.craftPath||await Ki();if(!u)return{success:!1,target:a,format:n,error:"Craft native binary not found on PATH. Run pantry install craft, or specify craftPath for framework development."};if(e.verbose)console.log(`\uD83D\uDCE6 Building native app for ${a}...`),console.log(` Input: ${e.input}`),console.log(` Output: ${s}`),console.log(` Craft: ${u}`);let p;switch(a){case"macos":p=await me(o,d,l,s,n,e,u);break;case"windows":p=await xe(o,d,l,s,n,e,u);break;case"linux":p=await ye(o,d,l,s,n,e,u);break;case"ios":p=await Se(o,d,l,s,e,u);break;case"android":p=await Ce(o,d,l,s,e,u);break;default:p={success:!1,target:a,format:n,error:`Unsupported target: ${a}`}}return p.duration=Date.now()-r,p}catch(a){return{success:!1,target:e.target||R(),format:e.format||"app",error:a.message,duration:Date.now()-r}}}async function me(e,r,a,n,s,t,o){let d=t.bundleId||`com.stx.${r.toLowerCase().replace(/[^a-z0-9]/g,"")}`,l=c(n,`${r}.app`),u=c(l,"Contents"),p=c(u,"MacOS"),b=c(u,"Resources");ue(l,{recursive:!0,force:!0}),x(p,{recursive:!0}),x(b,{recursive:!0});let y=c(b,"index.html");await Bun.write(y,e);let g="";if(t.sidebar?.enabled&&t.sidebar?.config)g=c(b,"sidebar-config.json"),await Bun.write(g,JSON.stringify(t.sidebar.config));let w=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",C=t.menubarOnly??t.systemTray,m=t.bundleStyle||(await we(o)?"executable":"launcher");if(t.backend){if(!await he(o))throw Error("This Craft runtime does not support bundled backends. Upgrade Craft before building this app.");T(o,c(p,r)),P(c(p,r),493);let S=Ue("native-backend");try{let h=c(S,"launcher.ts"),_=c(import.meta.dir,"native-backend"+(import.meta.path.endsWith(".ts")?".ts":".js"));await Bun.write(h,`import { runNativeBackend } from ${JSON.stringify(_)}
|
|
2966
2966
|
import handler from ${JSON.stringify(H(t.backend.entry))}
|
|
2967
2967
|
await runNativeBackend({ html: ${JSON.stringify(e)}, fetch: handler,
|
|
2968
2968
|
maxRequestBodySize: ${t.backend.maxRequestBodySize??33554432} })
|
|
@@ -3008,7 +3008,7 @@ Name=${r}
|
|
|
3008
3008
|
Exec=${b}
|
|
3009
3009
|
Terminal=false
|
|
3010
3010
|
Categories=Utility;
|
|
3011
|
-
`;if(await Bun.write(c(d,`${r.toLowerCase()}.desktop`),y),s==="deb"){let g=c(n,`${r.toLowerCase()}_${a}_amd64.deb`),w=await Pe(d,g,r,a,t);if(!w.success)return{success:!1,target:"linux",format:"deb",error:w.error};return{success:!0,target:"linux",format:"deb",outputPath:g}}if(s==="appimage"){let g=c(n,`${r}-${a}-x86_64.AppImage`),w=await Ie(d,g,r,t);if(!w.success)return{success:!1,target:"linux",format:"appimage",error:w.error};return{success:!0,target:"linux",format:"appimage",outputPath:g}}return{success:!0,target:"linux",format:"app",outputPath:d}}async function Se(e,r,a,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 Ce(e,r,a,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
|
|
3011
|
+
`;if(await Bun.write(c(d,`${r.toLowerCase()}.desktop`),y),s==="deb"){let g=c(n,`${r.toLowerCase()}_${a}_amd64.deb`),w=await Pe(d,g,r,a,t);if(!w.success)return{success:!1,target:"linux",format:"deb",error:w.error};return{success:!0,target:"linux",format:"deb",outputPath:g}}if(s==="appimage"){let g=c(n,`${r}-${a}-x86_64.AppImage`),w=await Ie(d,g,r,t);if(!w.success)return{success:!1,target:"linux",format:"appimage",error:w.error};return{success:!0,target:"linux",format:"appimage",outputPath:g}}return{success:!0,target:"linux",format:"app",outputPath:d}}async function Se(e,r,a,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 Ce(e,r,a,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 Ki(){let e=process.env.CRAFT_BIN;if(e){if(!A(e))throw Error(`CRAFT_BIN points to a missing file: ${e}`);return e}return Bun.which("craft",{PATH:process.env.PATH??"",cwd:process.cwd()})}function R(){switch(ge()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function ke(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 $e(e,r,a){return new Promise((n)=>{let s=q("hdiutil",["create","-volname",a,"-srcfolder",e,"-ov","-format","UDZO",r]);s.on("close",(t)=>{if(t===0)n({success:!0});else n({success:!1,error:`hdiutil exited with code ${t}`})}),s.on("error",(t)=>{n({success:!1,error:t.message})})})}async function Te(e,r){return new Promise((a)=>{let n=q("zip",["-r",r,"."],{cwd:e});n.on("close",(s)=>{if(s===0)a({success:!0});else a({success:!1,error:`zip exited with code ${s}`})}),n.on("error",(s)=>{a({success:!1,error:s.message})})})}async function Pe(e,r,a,n,s){return new Promise((t)=>{let o=Ue("deb");try{let d=c(o,"pkg"),l=c(d,"DEBIAN"),u=c(d,"usr","bin"),p=c(d,"usr","share","applications"),b=c(d,"usr","share",a.toLowerCase());x(l,{recursive:!0}),x(u,{recursive:!0}),x(p,{recursive:!0}),x(b,{recursive:!0});let y=f("fs").readdirSync(e);for(let m of y)T(c(e,m),c(b,m));let g=`#!/bin/bash
|
|
3012
3012
|
exec /usr/share/${a.toLowerCase()}/${a.toLowerCase()} "$@"`;f("fs").writeFileSync(c(u,a.toLowerCase()),g),P(c(u,a.toLowerCase()),493);let w=`Package: ${a.toLowerCase()}
|
|
3013
3013
|
Version: ${n}
|
|
3014
3014
|
Section: utils
|
|
@@ -3029,5 +3029,5 @@ Exec=${a.toLowerCase()}
|
|
|
3029
3029
|
Terminal=false
|
|
3030
3030
|
Categories=Utility;
|
|
3031
3031
|
Icon=${a.toLowerCase()}
|
|
3032
|
-
`;f("fs").writeFileSync(c(o,`${a.toLowerCase()}.desktop`),g);let w=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(f("fs").writeFileSync(c(o,`${a.toLowerCase()}.png`),w),n.icon&&A(n.icon))T(n.icon,c(o,`${a.toLowerCase()}.png`));let C=q("appimagetool",[o,r],{env:{...process.env,ARCH:"x86_64"}});C.on("close",(m)=>{if(ne(t),m===0)P(r,493),s({success:!0});else s({success:!1,error:`appimagetool exited with code ${m}. Install from https://appimage.github.io/appimagetool/`})}),C.on("error",(m)=>{ne(t),s({success:!1,error:`appimagetool not found: ${m.message}`})})}catch(o){ne(t),s({success:!1,error:o.message})}})}function
|
|
3033
|
-
export{ep,Hi,tp,np,Vi,
|
|
3032
|
+
`;f("fs").writeFileSync(c(o,`${a.toLowerCase()}.desktop`),g);let w=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(f("fs").writeFileSync(c(o,`${a.toLowerCase()}.png`),w),n.icon&&A(n.icon))T(n.icon,c(o,`${a.toLowerCase()}.png`));let C=q("appimagetool",[o,r],{env:{...process.env,ARCH:"x86_64"}});C.on("close",(m)=>{if(ne(t),m===0)P(r,493),s({success:!0});else s({success:!1,error:`appimagetool exited with code ${m}. Install from https://appimage.github.io/appimagetool/`})}),C.on("error",(m)=>{ne(t),s({success:!1,error:`appimagetool not found: ${m.message}`})})}catch(o){ne(t),s({success:!1,error:o.message})}})}function Gi(){return[R()]}function Xi(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 Be={buildNative:qi,getAvailableTargets:Gi,getAvailableFormats:Xi,detectPlatform:R},ip=Be;
|
|
3033
|
+
export{ep,Hi,tp,np,Vi,Gs,Ui,rp,Wi,sp,op,qi,Ki,Gi,Xi,ip};
|
package/dist/cli.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
import"./chunk-
|
|
3
|
+
import"./chunk-r0ys9aqa.js";import"./chunk-gtktv6nn.js";import"./chunk-6beg47t4.js";import{Ae,se}from"./chunk-xw0cqb5m.js";import"./chunk-t6m5d64b.js";import"./chunk-bg6t69qq.js";import"./chunk-tenbwcts.js";import"./chunk-kypwg2ws.js";import"./chunk-1rgjy80j.js";import"./chunk-ygb33q5w.js";import"./chunk-912r15hr.js";import"./chunk-dnbdxbkb.js";import"./chunk-58m0kfb3.js";import"./chunk-67v3rh14.js";import"./chunk-n4qp4q2x.js";import"./chunk-pf25jb54.js";import"./chunk-90ggz2m1.js";import"./chunk-xr9a0hcr.js";import"./chunk-03xn8244.js";import"./chunk-brftzqzj.js";import"./chunk-pzxy40a2.js";import"./chunk-xvnrm5c3.js";import"./chunk-km37yrk4.js";import"./chunk-d9esaahz.js";import"./chunk-974prn41.js";import"./chunk-f4fxj7xg.js";import"./chunk-ct0ee0fr.js";import"./chunk-5tbey00z.js";import"./chunk-qh7fvr2z.js";import"./chunk-9c3x72qy.js";import"./chunk-58dv14c3.js";import"./chunk-51fqvchq.js";import"./chunk-dxcn65hq.js";import"./chunk-9bgb9n12.js";import"./chunk-hxnvcvkz.js";import"./chunk-d1ssvg9k.js";import"./chunk-0nt17nas.js";import"./chunk-dv8a3gp8.js";import"./chunk-vewm4kr8.js";import"./chunk-ry501z40.js";import"./chunk-ae12wgc5.js";import"./chunk-d7js6v1m.js";import"./chunk-374nhgyf.js";import{Xt,Jt}from"./chunk-ffwvbqkp.js";import"./chunk-ywpyxqn5.js";import"./chunk-jq4h969v.js";import"./chunk-cjf01cp4.js";import"./chunk-3zbege39.js";import"./chunk-b7z6rqfg.js";import"./chunk-drabexxq.js";import"./chunk-f4z9w4kc.js";import"./chunk-xp2cn23j.js";import"./chunk-5ahrdnm0.js";import{hi,yi,bi,vi,Ns,wi,xi,Si,Ds,Ms,Cr,Er,Tr}from"./chunk-kqzrm2ym.js";import"./chunk-yf42bhjw.js";import"./chunk-rspe6qa5.js";import"./chunk-cge9pgyb.js";import"./chunk-hx787tfa.js";import"./chunk-fw12pvmr.js";import"./chunk-jgxzbthg.js";import{va}from"./chunk-0y2hkbc6.js";import{f}from"./chunk-b7e07ybq.js";import{spawn as R}from"child_process";import S from"fs";import p from"path";import n from"process";import{CLI as z}from"@stacksjs/clapp";var __dirname="/home/runner/work/stx/stx/packages/stx/bin",y=new z("stx");function E(h){let m=typeof h==="string"?Number.parseInt(h,10):h;if(Number.isNaN(m))return{isValid:!1,error:"Port must be a valid number",suggestion:"Try using a number between 1024 and 65535"};if(m<1024||m>65535)return{isValid:!1,error:"Port must be between 1024 and 65535",suggestion:"Try using a port between 1024 and 65535"};return{isValid:!0}}function A(h){try{if(!S.existsSync(h)){let x=p.dirname(h),t=p.basename(h);if(S.existsSync(x)){let o=S.readdirSync(x).filter((s)=>s.toLowerCase().includes(t.toLowerCase().substring(0,3))||s.endsWith(".stx")||s.endsWith(".md")),r=o.length>0?`File not found. Similar files in ${x}: ${o.slice(0,3).join(", ")}`:`File not found. Directory ${x} exists but doesn't contain the specified file.`;return{isValid:!1,error:`File does not exist: ${h}`,suggestion:r}}return{isValid:!1,error:`File does not exist: ${h}`,suggestion:"Check the file path and try again"}}if(S.statSync(h).isDirectory())return{isValid:!1,error:`Expected file but got directory: ${h}`,suggestion:"Specify a .stx or .md file path"};return{isValid:!0}}catch(m){return{isValid:!1,error:`Cannot access file: ${h}`,suggestion:"Check file permissions and path"}}}function I(h){let m=typeof h==="string"?Number.parseInt(h,10):h;if(Number.isNaN(m))return{isValid:!1,error:"Timeout must be a valid number",suggestion:"Specify timeout in milliseconds (e.g., 5000 for 5 seconds)"};if(m<100)return{isValid:!1,error:"Timeout too short (minimum 100ms)",suggestion:"Use a timeout of at least 100ms"};if(m>300000)return{isValid:!1,error:"Timeout too long (maximum 5 minutes)",suggestion:"Use a timeout of less than 300000ms (5 minutes)"};return{isValid:!0}}var O=(h)=>h.includes("*")||h.includes("?")||h.includes("{")||h.includes("["),W=(h)=>h.endsWith(".stx")||h.endsWith(".md");function F(h,m=1){if(console.error(`\u274C ${h.error}`),h.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${h.suggestion}`);n.exit(m)}function M(h){if(!h)return;let m;try{m=JSON.parse(h)}catch(x){console.error(`\u274C --info-plist is not valid JSON: ${x.message}`),n.exit(1)}if(typeof m!=="object"||m===null||Array.isArray(m))console.error(`\u274C --info-plist must be a JSON object, e.g. '{"NSFocusStatusUsageDescription":"\u2026"}'`),n.exit(1);for(let[x,t]of Object.entries(m))if(typeof t!=="string"&&typeof t!=="number"&&typeof t!=="boolean")console.error(`\u274C --info-plist value for "${x}" must be a string, number or boolean`),n.exit(1);return m}async function V(h,m){try{let x=["test"],t=[];if(h&&h.length>0)for(let c of h)if(O(c))try{let i=await Array.fromAsync(new Bun.Glob(c).scan({onlyFiles:!0,absolute:!0}));if(i.length===0)console.warn(`Warning: No files found matching pattern: ${c}`);else if(t.push(...i),m.verbose)console.log(`Found ${i.length} file(s) matching pattern: ${c}`)}catch(i){return console.error(`Error expanding glob pattern ${c}:`,i),!1}else t.push(c);if(t.length===0)return console.error("Error: No test files found matching the provided patterns."),!1;if(x.push(...t),m.filter)x.push("--pattern",m.filter);if(m.timeout)x.push("--timeout",m.timeout.toString());if(m.reporter&&m.reporter!=="default")if(m.reporter==="junit"){let c=p.resolve("stx-test-report.xml");x.push("--reporter",m.reporter),x.push("--reporter-outfile",c),console.log(`JUnit report: ${c}`)}else console.warn(`Warning: Reporter '${m.reporter}' is not supported. Using default reporter.`);if(m.coverage)x.push("--coverage");if(m.watch)x.push("--watch");x.push("--preload",p.join(__dirname,"../../../test-utils/happy-dom.ts"));let e={...n.env,STX_TEST_MODE:"true",STX_TEST_UI:m.ui?"true":"false",STX_TEST_VERBOSE:m.verbose?"true":"false"},o="bun";if(m.verbose)console.log(`Running: ${o} ${x.join(" ")}`);let r=performance.now(),s=R(o,x,{stdio:"inherit",shell:!1,env:e});return new Promise((c)=>{s.on("close",(i)=>{let d=((performance.now()-r)/1000).toFixed(2);if(i===0)c(!0);else c(!1)}),n.on("SIGINT",()=>{console.log(`
|
|
4
4
|
Test run interrupted`),s.kill("SIGINT"),n.exit(1)})})}catch(x){return console.error("Error running tests:",x instanceof Error?x.message:String(x)),!1}}var U=n.argv.length>=3&&(W(n.argv[2])&&S.existsSync(n.argv[2])||O(n.argv[2]));if(U){let h=n.argv[2],m={port:3000,watch:!0,cache:!0,markdown:{syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}}};for(let x=3;x<n.argv.length;x++){let t=n.argv[x];if(t==="--port"&&x+1<n.argv.length){let e=E(n.argv[++x]);if(!e.isValid)F(e);m.port=Number.parseInt(n.argv[x],10)}else if(t==="--no-watch")m.watch=!1;else if(t==="--highlight-theme"&&x+1<n.argv.length){if(!m.markdown)m.markdown={};if(!m.markdown.syntaxHighlighting)m.markdown.syntaxHighlighting={};m.markdown.syntaxHighlighting.defaultTheme=n.argv[++x]}else if(t==="--no-highlight"){if(!m.markdown)m.markdown={};if(!m.markdown.syntaxHighlighting)m.markdown.syntaxHighlighting={};m.markdown.syntaxHighlighting.enabled=!1}else if(t==="--no-highlight-unknown"){if(!m.markdown)m.markdown={};if(!m.markdown.syntaxHighlighting)m.markdown.syntaxHighlighting={};m.markdown.syntaxHighlighting.highlightUnknownLanguages=!1}else if(t==="--no-cache")m.cache=!1;else if(t==="--native")m.native=!0}if(O(h))try{let x=await Array.fromAsync(new Bun.Glob(h).scan({onlyFiles:!0,absolute:!0})),t=h.endsWith(".stx")?x.filter((s)=>s.endsWith(".stx")):h.endsWith(".md")?x.filter((s)=>s.endsWith(".md")):x.filter((s)=>s.endsWith(".stx")||s.endsWith(".md")),e=h.split("*")[0].replace(/\/$/,"")||".",o=p.resolve(e);try{let s=new Bun.Glob("**/*.stx"),i=(await Array.fromAsync(s.scan({cwd:o,onlyFiles:!0,absolute:!0}))).filter((l)=>/\[.+\]/.test(p.basename(l)));for(let l of i)if(!t.includes(l))t.push(l)}catch{}if(t.length===0)console.error(`Error: No STX or Markdown files found matching pattern: ${h}`),n.exit(1);if(!await Er(t,m))n.exit(1)}catch(x){console.error("Failed to process files:",x),n.exit(1)}else Cr(h,m).catch((x)=>{console.error("Failed to start dev server:",x),n.exit(1)})}else{let h=function(t,e){let o=[];for(let r=0;r<=e.length;r++)o[r]=[r];for(let r=0;r<=t.length;r++)o[0][r]=r;for(let r=1;r<=e.length;r++)for(let s=1;s<=t.length;s++)if(e.charAt(r-1)===t.charAt(s-1))o[r][s]=o[r-1][s-1];else o[r][s]=Math.min(o[r-1][s-1]+1,o[r][s-1]+1,o[r-1][s]+1);return o[e.length][t.length]};y.command("docs","Generate documentation for components, templates, and directives").option("--output <dir>","Output directory for documentation",{default:"docs"}).option("--format <format>","Documentation format (markdown, html, json)",{default:"markdown"}).option("--components-dir <dir>","Components directory",{default:"components"}).option("--templates-dir <dir>","Templates directory",{default:"."}).option("--no-components","Disable components documentation").option("--no-templates","Disable templates documentation").option("--no-directives","Disable directives documentation").option("--extra-content <content>","Extra content to include in documentation").example("stx docs --output docs --format html").action(async(t)=>{try{if(await vi(t))console.log("Documentation generated successfully."),n.exit(0);else console.error("Documentation generation failed."),n.exit(1)}catch(e){console.error("Error generating documentation:",e),n.exit(1)}}),y.command("iconify <command>","Generate Iconify icon packages").option("--output <dir>","Output directory for generated packages",{default:"packages"}).option("--icons <icons>","Comma-separated list of specific icons to generate").example("stx iconify list").example("stx iconify generate mdi").example("stx iconify generate lucide --icons home,settings,user").action(async(t,e)=>{try{let{fetchCollections:o,generatePackage:r}=await import("./chunk-3850m7ab.js");if(t==="list"){console.log(`
|
|
5
5
|
\uD83D\uDCDA Fetching available icon collections...
|
|
6
6
|
`);let s=await o(),c=Object.entries(s).sort((i,l)=>l[1].total-i[1].total);console.log(`Available collections:
|
|
7
7
|
`);for(let[i,l]of c){let d=l;console.log(` ${i.padEnd(30)} ${d.name} (${d.total} icons)`)}console.log(`
|
|
8
8
|
Total: ${c.length} collections`)}else if(t.startsWith("generate")){let s=t==="generate"?"":t.replace("generate:","").replace("generate-","").replace("generate","").trim();if(!s)console.error("Error: Please specify a collection prefix"),console.error("Usage: stx iconify generate <prefix> [--icons icon1,icon2,...]"),n.exit(1);let c=e.output||p.join(n.cwd(),"packages/collections"),i=e.icons?e.icons.split(",").map((l)=>l.trim()):void 0;await r(s,c,i),console.log(`
|
|
9
9
|
\u2713 Package generated successfully!`),console.log(`
|
|
10
|
-
To use the package:`),console.log(` 1. cd packages/collections/iconify-${s}`),console.log(" 2. bun install"),console.log(" 3. bun run build")}else console.error(`Unknown iconify command: ${t}`),console.error("Available commands: list, generate"),n.exit(1)}catch(o){console.error("Error:",o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("pwa <command>","PWA tools - audit configuration and build output").option("--output <dir>","Build output directory to audit",{default:"dist"}).example("stx pwa audit").example("stx pwa audit --output build").action(async(t,e)=>{try{if(t==="audit"){let{runPwaAudit:o,formatAuditResult:r}=await import("./chunk-g5ep75vp.js"),{loadConfig:s}=await import("./chunk-
|
|
10
|
+
To use the package:`),console.log(` 1. cd packages/collections/iconify-${s}`),console.log(" 2. bun install"),console.log(" 3. bun run build")}else console.error(`Unknown iconify command: ${t}`),console.error("Available commands: list, generate"),n.exit(1)}catch(o){console.error("Error:",o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("pwa <command>","PWA tools - audit configuration and build output").option("--output <dir>","Build output directory to audit",{default:"dist"}).example("stx pwa audit").example("stx pwa audit --output build").action(async(t,e)=>{try{if(t==="audit"){let{runPwaAudit:o,formatAuditResult:r}=await import("./chunk-g5ep75vp.js"),{loadConfig:s}=await import("./chunk-7w7e24e9.js");console.log(`
|
|
11
11
|
\uD83D\uDD0D Running PWA audit...
|
|
12
12
|
`);let c=await s(),i=e.output||"dist",l=o(c,i);if(console.log(r(l)),l.failed>0)n.exit(1)}else console.error(`Unknown pwa command: ${t}`),console.error("Available commands: audit"),n.exit(1)}catch(o){console.error("Error:",o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("dev [file]","Start a development server for an STX app or file").option("--port <port>","Port to use for the dev server",{default:3000}).option("--pages <dir>",'Directory containing page templates (default: pagesDir from stx.config.ts, else "pages")').option("--no-watch","Disable file watching and auto-reload").option("--native","Open in a native desktop window using Zyte").option("--titlebar-hidden","Hide the native titlebar but keep the traffic-light buttons (web content draws under a transparent full-size titlebar). Implies --native.").option("--highlight-theme <theme>","Syntax highlighting theme for Markdown code blocks",{default:"github-dark"}).option("--no-highlight","Disable syntax highlighting for Markdown code blocks").option("--no-highlight-unknown","Disable syntax highlighting for unknown languages in Markdown").option("--no-cache","Disable caching of parsed files").option("--no-hmr","Disable HMR / live-reload script injection (useful for clean network traces)").option("--profile","Print per-directive timing for every page render via performanceMonitor").option("--debug-directives","Log directive ordering and intermediate template state during rendering").example("stx dev").example("stx dev --port 8080").example("stx dev --pages src/pages").example("stx dev template.stx").example("stx dev components/hero.stx --port 8080").example("stx dev **/*.stx").example("stx dev docs/guide.md").example("stx dev template.stx --native").action(async(t,e)=>{try{if(e.port!==void 0){let r=E(e.port);if(!r.isValid)F(r);e.port=Number.parseInt(String(e.port),10)}if(e.timeout!==void 0){let r=I(e.timeout);if(!r.isValid)F(r)}let o={syntaxHighlighting:{enabled:e.highlight!==!1,serverSide:!0,defaultTheme:e.highlightTheme||"github-dark",highlightUnknownLanguages:e.highlightUnknown!==!1}};if(!t){if(!await Tr(".",{port:e.port,watch:e.watch!==!1,native:e.native||e.titlebarHidden||!1,titlebarHidden:e.titlebarHidden===!0,cache:e.cache!==!1,hotReload:e.hmr!==!1,profile:e.profile===!0,debugDirectives:e.debugDirectives===!0,...e.pages&&{pagesDir:e.pages}}))n.exit(1);return}if(!O(t))try{let r=await import("fs");if(r.existsSync(t)&&r.statSync(t).isDirectory()){if(!await Tr(t,{port:e.port,watch:e.watch!==!1,native:e.native||e.titlebarHidden||!1,titlebarHidden:e.titlebarHidden===!0,cache:e.cache!==!1,hotReload:e.hmr!==!1,profile:e.profile===!0,debugDirectives:e.debugDirectives===!0,...e.pages&&{pagesDir:e.pages}}))n.exit(1);return}}catch{}if(O(t)){console.log(`Expanding glob pattern: ${t}`);let r=await se.timeAsync("glob-expansion",async()=>Array.fromAsync(new Bun.Glob(t).scan({onlyFiles:!0,absolute:!0}))),s=t.endsWith(".stx")?r.filter((d)=>d.endsWith(".stx")):t.endsWith(".md")?r.filter((d)=>d.endsWith(".md")):r.filter((d)=>d.endsWith(".stx")||d.endsWith(".md"));if(s.length===0)console.error(`No STX or Markdown files found matching pattern: ${t}`),console.error("Try using patterns like '*.stx' or 'components/**/*.stx'"),n.exit(1);let c=t.split("*")[0].replace(/\/$/,"")||".",i=p.resolve(c);try{let d=new Bun.Glob("**/*.stx"),u=(await Array.fromAsync(d.scan({cwd:i,onlyFiles:!0,absolute:!0}))).filter((g)=>/\[.+\]/.test(p.basename(g)));for(let g of u)if(!s.includes(g))s.push(g)}catch{}if(console.log(`Found ${s.length} ${s.length===1?"file":"files"} matching ${t}`),!await Er(s,{port:e.port,watch:e.watch!==!1,native:e.native||e.titlebarHidden||!1,titlebarHidden:e.titlebarHidden===!0,markdown:o,cache:e.cache!==!1}))n.exit(1)}else{if(!O(t)){let s=A(t);if(!s.isValid)F(s)}if(!await Cr(t,{port:e.port,watch:e.watch!==!1,native:e.native||e.titlebarHidden||!1,titlebarHidden:e.titlebarHidden===!0,markdown:o,cache:e.cache!==!1}))n.exit(1)}}catch(o){console.error("Error starting dev server:",o),n.exit(1)}}),y.command("a11y [target]","Scan .stx files for accessibility issues (directory, file, or glob)").option("--no-recursive","Disable recursive scanning of directories").option("--ignore <paths>","Comma-separated paths to ignore",{default:""}).option("--json","Output results as JSON").option("--output <file>","Write results to a file instead of stdout").option("--fix","Automatically fix common accessibility issues").example("stx a11y ./templates").example('stx a11y "resources/**/*.stx"').example("stx a11y resources/emails/welcome.stx").example("stx a11y --json --output a11y-report.json").action(async(t=".",e)=>{try{console.log(`Scanning ${t} for accessibility issues...`);let o=e.ignore?e.ignore.split(",").map((l)=>l.trim()):[],{results:r,scannedFiles:s}=await va(t,{recursive:e.recursive!==!1,ignorePaths:o});if(s.length===0)console.log(`
|
|
13
13
|
No .stx files matched ${t}
|
|
@@ -69,7 +69,7 @@ Total: ${i} issues in ${c} files`),e.output){let l=`
|
|
|
69
69
|
File not found: ${t}`),n.exit(1);if(!t.endsWith(".stx"))console.error(`
|
|
70
70
|
File must have .stx extension: ${t}`),n.exit(1)}let r=p.resolve(e.pages),s=p.resolve(e.out);if(!t&&!S.existsSync(r))console.error(`
|
|
71
71
|
Pages directory not found: ${r}`),console.log(`
|
|
72
|
-
Create a 'pages' directory with .stx files, or use --pages to specify a different directory.`),n.exit(1);let{buildApp:c}=await import("./chunk-
|
|
72
|
+
Create a 'pages' directory with .stx files, or use --pages to specify a different directory.`),n.exit(1);let{buildApp:c}=await import("./chunk-exbs8qm6.js");Jt();let i=await c({root:t?p.dirname(t):void 0,debug:e.verbose,ssg:{pagesDir:e.pages,outputDir:e.out,domain:e.domain,baseUrl:e.base,sitemap:e.sitemap,rss:e.rss,minify:e.minify,cache:e.cache!==!1,cleanOutput:e.clean,concurrency:Number.parseInt(e.concurrency,10)||10,publicDir:e.public,trailingSlash:e.trailingSlash,generate404:!0,hooks:e.verbose?{onPageStart:(d)=>console.log(` Generating: ${d}`),onPageEnd:(d,a)=>console.log(` Generated: ${d} (${a.length} bytes)`),onError:(d,a)=>console.error(` Error in ${a}: ${d.message}`)}:void 0},ssr:{outputDir:e.out==="dist"?".output":e.out,debug:e.verbose}}),l=((performance.now()-o)/1000).toFixed(2);if(i.mode==="ssr"&&i.ssr)console.log(`
|
|
73
73
|
Build complete! (SSR)
|
|
74
74
|
`),console.log(` Pages compiled: ${i.ssr.pageCount}`),console.log(` Output: ${i.ssr.outputDir}`),console.log(` Duration: ${l}s
|
|
75
75
|
`);else if(i.ssg){if(console.log(`
|
|
@@ -84,7 +84,7 @@ Total: ${i} issues in ${c} files`),e.output){let l=`
|
|
|
84
84
|
Build completed with ${i.ssg.failedCount} error(s). Fix the issues above and try again.
|
|
85
85
|
`),n.exit(1);console.log(" To preview locally:"),console.log(` cd ${e.out||"dist"} && npx serve
|
|
86
86
|
`)}}catch(o){console.error(`
|
|
87
|
-
Build failed:`,o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("start","Start the production server (serves pre-built .output/)").option("--port <number>","Server port",{default:"3000"}).option("--output <dir>","Output directory from stx build",{default:".output"}).example("stx start").example("stx start --port 8080").action(async(t)=>{try{let e=p.resolve(t.output);if(!S.existsSync(p.join(e,"manifest.json")))console.error("\n No production build found. Run `stx build --out .output` first.\n"),n.exit(1);let{startProductionServer:o}=await import("./chunk-
|
|
87
|
+
Build failed:`,o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("start","Start the production server (serves pre-built .output/)").option("--port <number>","Server port",{default:"3000"}).option("--output <dir>","Output directory from stx build",{default:".output"}).example("stx start").example("stx start --port 8080").action(async(t)=>{try{let e=p.resolve(t.output);if(!S.existsSync(p.join(e,"manifest.json")))console.error("\n No production build found. Run `stx build --out .output` first.\n"),n.exit(1);let{startProductionServer:o}=await import("./chunk-q4jpjjdc.js");await o({outputDir:e,port:Number.parseInt(t.port,10)||3000})}catch(e){console.error(`
|
|
88
88
|
Failed to start production server:`,e instanceof Error?e.message:String(e)),n.exit(1)}}),y.command("deploy [directory]","Deploy built site to Netlify").option("--site-id <id>","Netlify site ID (or set NETLIFY_SITE_ID env var)").option("--token <token>","Auth token (or set NETLIFY_AUTH_TOKEN env var)").option("--production","Deploy to production (default: draft preview)").option("--message <msg>","Deploy message/title").option("--no-build","Skip build step before deploy").option("--open","Open deployed URL in browser").option("--dry-run","Preview deployment without uploading").option("--init","Initialize Netlify configuration for this project").example("stx deploy").example("stx deploy --production").example("stx deploy dist --site-id my-site-abc123").example("stx deploy --init").example("stx deploy --dry-run").action(async(t,e)=>{try{let{deploy:o,initNetlify:r,DeployError:s}=await import("./chunk-2zepd4ps.js");if(console.log(`\x1B[1mstx deploy\x1B[0m \x1B[2mv${Ae}\x1B[0m`),e.init){console.log(`
|
|
89
89
|
\uD83D\uDCDD Initializing Netlify configuration...
|
|
90
90
|
`);let i=await r({directory:t||n.cwd(),siteId:e.siteId});if(console.log(`\u2713 Created ${i.configPath}`),i.siteId)console.log("\u2713 Saved site ID to .env.local");console.log(`
|
|
@@ -124,7 +124,7 @@ To view it in the development server:`),console.log(` stx dev ${t}
|
|
|
124
124
|
\uD83D\uDCDD ${p.relative(n.cwd(),a)}:`),console.log("--- Original"),console.log("+++ Formatted"),console.log(`@@ Changes in ${p.basename(a)} @@`),console.log("+ Formatted content would be applied");else await Bun.write(a,b),console.log(`\u2705 Formatted ${p.relative(n.cwd(),a)}`),l++}catch(u){console.error(`\u274C Error formatting ${p.relative(n.cwd(),a)}:`,u),d++}if(e.check&&d>0)console.log(`
|
|
125
125
|
${d} files need formatting. Run 'stx format' to fix.`),n.exit(1);else if(!e.check&&!e.diff)console.log(`\u2728 Formatted ${l} files successfully`)}catch(o){console.error("Error formatting files:",o),n.exit(1)}}),y.command("perf [command...]","Show performance statistics for STX operations").option("--clear","Clear performance statistics").option("--json","Output as JSON").example("stx perf").example("stx perf --clear").example("stx perf --json").action(async(t,e)=>{try{if(e.clear){se.clear(),console.log("\u2705 Performance statistics cleared");return}let o=se.getStats();if(Object.keys(o).length===0){if(e.json){console.log(JSON.stringify({},null,2));return}console.log("No performance data available. Run some STX commands first.");return}if(e.json)console.log(JSON.stringify(o,null,2));else{console.log(`
|
|
126
126
|
\uD83D\uDCCA STX Performance Statistics
|
|
127
|
-
`);for(let[r,s]of Object.entries(o))console.log(`\uD83D\uDD27 ${r}:`),console.log(` Count: ${s.count}`),console.log(` Average: ${s.avgTime.toFixed(2)}ms`),console.log(` Total: ${s.totalTime.toFixed(2)}ms`),console.log(` Min: ${s.minTime.toFixed(2)}ms`),console.log(` Max: ${s.maxTime.toFixed(2)}ms`),console.log("")}}catch(o){console.error("Error showing performance stats:",o),n.exit(1)}}),y.command("typecheck [patterns...]","Type-check the TypeScript inside .stx script blocks").option("--no-client","Skip <script client> and bare <script> blocks").option("--no-server","Skip <script server> blocks").option("--no-templates","Skip {{ }} and directive expressions in the markup").option("--lib <path>","Extra ambient declaration file (repeatable)").example("stx typecheck").example('stx typecheck "resources/views/**/*.stx"').action(async(t,e)=>{let{formatTypecheckDiagnostics:o,typecheckStxFiles:r}=await import("./chunk-
|
|
127
|
+
`);for(let[r,s]of Object.entries(o))console.log(`\uD83D\uDD27 ${r}:`),console.log(` Count: ${s.count}`),console.log(` Average: ${s.avgTime.toFixed(2)}ms`),console.log(` Total: ${s.totalTime.toFixed(2)}ms`),console.log(` Min: ${s.minTime.toFixed(2)}ms`),console.log(` Max: ${s.maxTime.toFixed(2)}ms`),console.log("")}}catch(o){console.error("Error showing performance stats:",o),n.exit(1)}}),y.command("typecheck [patterns...]","Type-check the TypeScript inside .stx script blocks").option("--no-client","Skip <script client> and bare <script> blocks").option("--no-server","Skip <script server> blocks").option("--no-templates","Skip {{ }} and directive expressions in the markup").option("--lib <path>","Extra ambient declaration file (repeatable)").example("stx typecheck").example('stx typecheck "resources/views/**/*.stx"').action(async(t,e)=>{let{formatTypecheckDiagnostics:o,typecheckStxFiles:r}=await import("./chunk-ebmcecyh.js"),{resolveStxTargets:s}=await import("./chunk-mdmwgthz.js"),c=Array.isArray(t)?t:t?[t]:[],i=c.length?c:["**/*.stx"],l=await s(i);if(l.length===0){console.log(`
|
|
128
128
|
No .stx files matched ${i.join(", ")}
|
|
129
129
|
`);return}let d=hi(n.argv,"--lib"),a=d.length>0?d:e.lib?Array.isArray(e.lib)?e.lib:[e.lib]:[],u=await r(l,{client:e.client!==!1,server:e.server!==!1,templates:e.templates!==!1,extraLibs:a});if(u.failure)console.error(`
|
|
130
130
|
Type-check did not run.
|
|
@@ -136,7 +136,7 @@ ${d} files need formatting. Run 'stx format' to fix.`),n.exit(1);else if(!e.chec
|
|
|
136
136
|
${o(u.diagnostics)}
|
|
137
137
|
`);if(console.log(` Checked ${u.blockCount} script block(s) and ${u.expressionCount} template expression(s) in ${u.checkedFiles.length} file(s) \u2014 `+`${g.length} error(s), ${u.diagnostics.length-g.length} warning(s)
|
|
138
138
|
`),g.length>0)n.exit(1)}),y.command("codemod [patterns...]","Find hand-rolled code that an stx primitive already covers").option("--fix","Write the safe rewrites (default is report-only)").option("--rule <rule>","Run one rule only: confirm | tooltip (rewritable) \xB7 alert | route-params | search-params | navigate | "+"fetch | polling | debounce | click-outside | focus | clipboard | watch (report-only)").example("stx codemod").example("stx codemod --rule route-params").example('stx codemod --fix "resources/views/**/*.stx"').action(async(t,e)=>{let{codemodSource:o,formatCodemodFindings:r}=await import("./chunk-tpdvgb3d.js"),s=globalThis.Bun.Glob,c=Array.isArray(t)?t:t?[t]:[],i=c.length?c:["**/*.stx","**/*.ts"],l=e.rule?[e.rule]:void 0;if(e.rule&&e.rule!=="confirm"&&e.rule!=="tooltip")console.error(`Unknown rule "${e.rule}". Expected: confirm | tooltip`),n.exit(1);let d=new Set,a=[],u=0,g=new Set;try{let b=Bun.spawnSync(["git","ls-files","--others","--ignored","--exclude-standard","-z"],{cwd:n.cwd(),stdout:"pipe",stderr:"pipe"});for(let w of new TextDecoder().decode(b.stdout).split("\x00"))if(w)g.add(p.resolve(n.cwd(),w))}catch{}for(let b of i)for await(let w of new s(b).scan({cwd:n.cwd(),absolute:!0})){if(w.includes("/node_modules/")||w.includes("/dist/")||d.has(w)||g.has(w))continue;d.add(w);let k=await Bun.file(w).text(),v=o(k,{file:w,rules:l});if(a.push(...v.findings),e.fix&&v.code!==k)await Bun.write(w,v.code),u++}if(console.error(r(a,Boolean(e.fix))),e.fix)console.error(`
|
|
139
|
-
${u} file(s) written.`)}),y.command("doctor","Diagnose the stx framework-runtime resolution + staleness chain").option("--json","Output the report as JSON").example("stx doctor").example("stx doctor --json").action(async(t)=>{try{let e;try{let r=await import("./chunk-
|
|
139
|
+
${u} file(s) written.`)}),y.command("doctor","Diagnose the stx framework-runtime resolution + staleness chain").option("--json","Output the report as JSON").example("stx doctor").example("stx doctor --json").action(async(t)=>{try{let e;try{let r=await import("./chunk-jmjjjgy4.js");e=r.generateSignalsRuntime}catch{e=void 0}let o=await Ds({generateRuntime:e});if(t.json)console.log(JSON.stringify(o,null,2));else console.log(Ms(o));if(!o.ok)n.exit(1)}catch(e){console.error("Error running doctor:",e),n.exit(1)}}),y.command("debug <file>","Debug STX template processing step by step").option("--step","Step through processing stages interactively").option("--verbose","Show detailed processing information").option("--context <data>","JSON string of context data to use").option("--save-report <file>","Save debug report to file").example("stx debug template.stx").example("stx debug template.stx --step").example(`stx debug template.stx --context '{"name": "John", "items": [1,2,3]}'`).action(async(t,e)=>{try{let o=A(t);if(!o.isValid)F(o);console.log(`\uD83D\uDD0D Debugging stx template: ${t}
|
|
140
140
|
`);let r={};if(e.context)try{r=JSON.parse(e.context)}catch(i){console.error("\u274C Invalid JSON in --context option"),n.exit(1)}let s=await Bun.file(t).text();console.log(`\uD83D\uDCC4 Template Content (${s.length} chars):`),console.log("\u2500".repeat(50)),console.log(s.substring(0,500)+(s.length>500?`
|
|
141
141
|
...
|
|
142
142
|
`:"")),console.log("\u2500".repeat(50));let c=s.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(c)console.log(`
|
|
@@ -160,11 +160,11 @@ Press Ctrl+C to stop watching...
|
|
|
160
160
|
\uD83D\uDCC4 Files with issues:`),d.forEach((a)=>{let u=a.issues.filter((g)=>s[g.type]>=c).length;if(u>0)console.log(` ${p.relative(n.cwd(),a.file)} (${u} issues)`)});if(e.saveReport){let a={summary:l,results:d,generatedAt:new Date().toISOString(),commandOptions:e};await Bun.write(e.saveReport,JSON.stringify(a,null,2)),console.log(`
|
|
161
161
|
\uD83D\uDCCB Analysis report saved to: ${e.saveReport}`)}console.log(`
|
|
162
162
|
\u2728 Analysis complete! Use --detailed for more information.`)}catch(o){console.error("Error analyzing templates:",o),n.exit(1)}}),y.command("screenshot [input]","Capture PNG screenshot(s) of page(s) via Bun WebView \u2014 a file, URL, or dist directory").option("--out <dir>","Output directory",{default:"screenshots"}).option("--width <px>","Viewport width",{default:"1440"}).option("--height <px>","Viewport height",{default:"2200"}).option("--wait <ms>","Settle time after navigation before capture",{default:"800"}).option("--timeout <ms>","Hard cap on waiting for navigation",{default:"15000"}).option("--full-page","Capture the entire scrollable page, not just the viewport").option("--wait-selector <sel>","Wait until a CSS selector exists before capturing").option("--format <fmt>","Image format: png | jpeg | webp",{default:"png"}).option("--backend <name>","WebView backend: webkit (macOS, default) | chrome").action(async(t,e)=>{let{captureScreenshots:o}=await import("./chunk-8d0rqqyx.js"),r=t||"dist";try{let s=await o(r,e.out,{width:Number.parseInt(e.width,10),height:Number.parseInt(e.height,10),waitMs:Number.parseInt(e.wait,10),timeoutMs:Number.parseInt(e.timeout,10),fullPage:Boolean(e.fullPage),waitSelector:e.waitSelector,format:e.format,backend:e.backend});for(let c of s)console.log(`\uD83D\uDCF8 ${c.output} (${(c.bytes/1024).toFixed(0)} KB)`);console.log(`
|
|
163
|
-
\u2728 Captured ${s.length} screenshot(s) to ${e.out}/ via Bun WebView`)}catch(s){console.error(`Screenshot failed: ${s.message}`),n.exit(1)}}),y.command("version","Show the version of the CLI").action(()=>{console.log(Ae)}),y.command("interactive","Start interactive REPL mode for template development").alias("i").option("--context <file>","Load initial context from JSON file").option("--cwd <directory>","Set working directory").option("--verbose","Show verbose output").action(async(t)=>{let{startInteractive:e}=await import("./chunk-
|
|
163
|
+
\u2728 Captured ${s.length} screenshot(s) to ${e.out}/ via Bun WebView`)}catch(s){console.error(`Screenshot failed: ${s.message}`),n.exit(1)}}),y.command("version","Show the version of the CLI").action(()=>{console.log(Ae)}),y.command("interactive","Start interactive REPL mode for template development").alias("i").option("--context <file>","Load initial context from JSON file").option("--cwd <directory>","Set working directory").option("--verbose","Show verbose output").action(async(t)=>{let{startInteractive:e}=await import("./chunk-z0r4vm2m.js"),o={};if(t.context){let r=p.resolve(t.context);if(S.existsSync(r))try{let s=S.readFileSync(r,"utf-8");o=JSON.parse(s)}catch(s){console.error("Error loading context file:",s),n.exit(1)}else console.error(`Context file not found: ${r}`),n.exit(1)}await e({context:o,cwd:t.cwd?p.resolve(t.cwd):n.cwd(),verbose:t.verbose})}),y.command("build:native <input>","Build stx template into a native desktop/mobile app").option("--output <dir>","Output directory",{default:"dist/native"}).option("--target <platform>","Target platform: macos, windows, linux, ios, android").option("--format <format>","Output format: app, dmg, pkg, msi, zip, deb, rpm, appimage, ipa, apk").option("--name <name>","Application name (defaults to filename)").option("--version <version>","Application version",{default:"1.0.0"}).option("--description <desc>","Application description").option("--author <author>","Author/Maintainer name").option("--bundle-id <id>","Bundle identifier (macOS/iOS)").option("--icon <path>","Path to application icon").option("--width <width>","Window width",{default:"1200"}).option("--height <height>","Window height",{default:"800"}).option("--title <title>","Window title").option("--system-tray","Enable system tray/menubar mode").option("--menubar-only","Run without a dock icon (implied by --system-tray)").option("--category <type>","LSApplicationCategoryType (macOS)").option("--copyright <text>","NSHumanReadableCopyright (macOS)").option("--min-system-version <v>","LSMinimumSystemVersion (macOS)").option("--info-plist <json>","Extra Info.plist keys as a JSON object (macOS)").option("--dev-tools","Enable developer tools").option("--frameless","Create frameless window").option("--always-on-top","Keep window always on top").option("--craft-path <path>","Path to Craft binary").option("--verbose","Show verbose output").example("stx build:native app.stx --target macos").example("stx build:native app.stx --target macos --format dmg").example("stx build:native app.stx --target linux --format appimage").example('stx build:native app.stx --name "My App" --icon icon.png').action(async(t,e)=>{try{let{buildNative:o,getAvailableTargets:r,getAvailableFormats:s}=await import("./chunk-t2eadw9a.js"),c=p.resolve(t);if(!S.existsSync(c))console.error(`\u274C Input file not found: ${t}`),n.exit(1);let i=r();if(e.target&&!["macos","windows","linux","ios","android"].includes(e.target))console.error(`\u274C Invalid target: ${e.target}`),console.error("\uD83D\uDCA1 Available targets: macos, windows, linux, ios, android"),console.error(`\uD83D\uDCA1 Targets available on this machine: ${i.join(", ")}`),n.exit(1);let l=e.target||i[0],d=s(l);if(e.format&&!d.includes(e.format))console.error(`\u274C Invalid format for ${l}: ${e.format}`),console.error(`\uD83D\uDCA1 Available formats: ${d.join(", ")}`),n.exit(1);console.log(`
|
|
164
164
|
\uD83D\uDD28 Building native app...`),console.log(` Input: ${t}`),console.log(` Target: ${l}`),console.log(` Format: ${e.format||"default"}`),console.log(` Output: ${e.output}
|
|
165
165
|
`);let a=await o({input:c,output:p.resolve(e.output),target:l,format:e.format,name:e.name,version:e.version,description:e.description,author:e.author,bundleId:e.bundleId,icon:e.icon?p.resolve(e.icon):void 0,window:{title:e.title,width:Number.parseInt(e.width,10),height:Number.parseInt(e.height,10),frameless:e.frameless,alwaysOnTop:e.alwaysOnTop},systemTray:e.systemTray,menubarOnly:e.menubarOnly,category:e.category,copyright:e.copyright,minimumSystemVersion:e.minSystemVersion,infoPlist:M(e.infoPlist),devTools:e.devTools,craftPath:e.craftPath,verbose:e.verbose});if(a.success){if(console.log("\u2705 Build successful!"),console.log(` Output: ${a.outputPath}`),a.duration)console.log(` Duration: ${(a.duration/1000).toFixed(2)}s`);if(l==="macos"&&a.format==="app")console.log(`
|
|
166
166
|
\uD83D\uDCA1 To run: open "${a.outputPath}"`);else if(l==="linux"&&a.format==="appimage")console.log(`
|
|
167
|
-
\uD83D\uDCA1 To run: chmod +x "${a.outputPath}" && "${a.outputPath}"`)}else console.error(`\u274C Build failed: ${a.error}`),n.exit(1)}catch(o){console.error(`\u274C Build error: ${o.message}`),n.exit(1)}}),y.command("story","Start component showcase and testing server").option("-p, --port <port>","Server port",{default:"6006"}).option("-o, --open","Open browser automatically",{default:!1}).option("--host <host>","Host to bind to",{default:"localhost"}).example("stx story").example("stx story --port 3000 --open").action(async(t)=>{try{let{devCommand:e}=await import("./chunk-
|
|
167
|
+
\uD83D\uDCA1 To run: chmod +x "${a.outputPath}" && "${a.outputPath}"`)}else console.error(`\u274C Build failed: ${a.error}`),n.exit(1)}catch(o){console.error(`\u274C Build error: ${o.message}`),n.exit(1)}}),y.command("story","Start component showcase and testing server").option("-p, --port <port>","Server port",{default:"6006"}).option("-o, --open","Open browser automatically",{default:!1}).option("--host <host>","Host to bind to",{default:"localhost"}).example("stx story").example("stx story --port 3000 --open").action(async(t)=>{try{let{devCommand:e}=await import("./chunk-a7hcwkjz.js");await e({port:t.port?Number.parseInt(t.port,10):6006,open:t.open,host:t.host})}catch(e){console.error(`\u274C Story error: ${e.message}`),n.exit(1)}}),y.command("story:build","Build static story site").option("-o, --outDir <dir>","Output directory",{default:".stx/dist/story"}).example("stx story:build").example("stx story:build --outDir ./docs/components").action(async(t)=>{try{let{buildCommand:e}=await import("./chunk-2hh6g3y1.js");await e({outDir:t.outDir})}catch(e){console.error(`\u274C Story build error: ${e.message}`),n.exit(1)}}),y.command("story:test","Run visual regression tests").option("-u, --update","Update snapshots",{default:!1}).option("-f, --filter <name>","Filter components by name").example("stx story:test").example("stx story:test --update").example("stx story:test --filter Button").action(async(t)=>{try{let{createContext:e}=await import("./chunk-1e79xcc8.js"),{runVisualTests:o,updateSnapshots:r,formatTestResults:s}=await import("./chunk-ymjpqt50.js"),c=await e({mode:"build"});if(t.update){let i=await r(c,{filter:t.filter?[t.filter]:void 0});console.log(`Updated ${i} snapshots`)}else{let i=await o(c,{filter:t.filter?[t.filter]:void 0});if(console.log(s(i)),i.failed>0)n.exit(1)}}catch(e){console.error(`\u274C Story test error: ${e.message}`),n.exit(1)}}),y.command("native <action> [file]","Compile .stx screens into the JavaScriptCore bundle Craft renders natively").option("--format <format>","bundle (the JavaScriptCore bundle) or ir (the template as JSON)",{default:"ir"}).option("--output <path>","Write to this file instead of stdout").option("--minify","Minify the bundle",{default:!1}).option("--config <file>","Screens config (default: native.config.json in the working directory)").example("stx native compile Screen.stx --format bundle --output native-screen.js").example("stx native compile --format bundle --output native-screen.js --minify").example("stx native compile Screen.stx").action(async(t,e,o)=>{if(t!=="compile")console.error(`Unknown native command: ${t}`),console.error("Usage: stx native compile [file.stx] --format bundle|ir [--output <file>] [--minify] [--config <file>]"),n.exit(1);try{let{runNativeCompile:r}=await import("./chunk-v6wa51js.js"),s=await r(e,{format:o.format,output:o.output,minify:Boolean(o.minify),config:o.config});for(let c of s.diagnostics)console.warn(`${c.level}: ${c.message}`);if(s.written)console.log(`Compiled: ${e??"screens"} \u2192 ${p.relative(n.cwd(),s.written)||s.written}`);else console.log(s.output)}catch(r){console.error(r instanceof Error?r.message:String(r)),n.exit(1)}}),y.command("compile <input>","Compile stx template to native Craft component code").option("--target <platform>","Target platform: macos, windows, linux, ios, android, universal",{default:"universal"}).option("--format <format>","Output format: zig, typescript, json",{default:"zig"}).option("--output <path>","Output directory for compiled files",{default:"./dist"}).option("--optimize","Enable optimizations",{default:!0}).option("--tree-shake","Enable tree shaking",{default:!0}).option("--hot-reload","Enable hot reload support",{default:!1}).option("--sourcemaps","Generate source maps",{default:!1}).option("--bundle","Bundle all dependencies",{default:!0}).option("--minify","Minify output",{default:!1}).option("--verbose","Show detailed output",{default:!1}).example("stx compile app.stx").example("stx compile app.stx --target macos --format zig").example("stx compile app.stx --format typescript --output ./native").example("stx compile app.stx --optimize --tree-shake --minify").action(async(t,e)=>{try{let{compileToNative:o}=await import("./chunk-zwawqx5q.js"),r=p.resolve(t);if(!S.existsSync(r))console.error(`\u274C Input file not found: ${t}`),n.exit(1);let s=["macos","windows","linux","ios","android","universal"];if(!s.includes(e.target))console.error(`\u274C Invalid target: ${e.target}`),console.error(`\uD83D\uDCA1 Available targets: ${s.join(", ")}`),n.exit(1);let c=["zig","typescript","json"];if(!c.includes(e.format))console.error(`\u274C Invalid format: ${e.format}`),console.error(`\uD83D\uDCA1 Available formats: ${c.join(", ")}`),n.exit(1);console.log(`
|
|
168
168
|
\uD83D\uDD27 Compiling stx template to native code...`),console.log(` Input: ${t}`),console.log(` Target: ${e.target}`),console.log(` Format: ${e.format}`),console.log(` Output: ${e.output}
|
|
169
169
|
`);let i=S.readFileSync(r,"utf-8"),l=await o(i,{target:e.target,format:e.format,optimize:e.optimize,treeShake:e.treeShake,hotReload:e.hotReload,debug:e.verbose,sourceMaps:e.sourcemaps,bundle:e.bundle,minify:e.minify}),d=p.resolve(e.output);if(!S.existsSync(d))S.mkdirSync(d,{recursive:!0});let a=p.basename(t,p.extname(t)),u=e.format==="typescript"?"ts":e.format==="json"?"json":"zig",g=p.join(d,`${a}.${u}`);S.writeFileSync(g,l.code);let b=p.join(d,`${a}.manifest.json`);if(S.writeFileSync(b,JSON.stringify(l.manifest,null,2)),e.sourcemaps&&l.sourceMaps){let w=p.join(d,`${a}.${u}.map`);S.writeFileSync(w,l.sourceMaps)}if(e.target==="universal"&&l.platformCode.size>0)for(let[w,k]of l.platformCode){let v=p.join(d,`${a}.${w}.${u}`);S.writeFileSync(v,k)}if(console.log("\u2705 Compilation successful!"),console.log(` Output: ${g}`),console.log(` Manifest: ${b}`),console.log(`
|
|
170
170
|
\uD83D\uDCCA Statistics:`),console.log(` Compilation time: ${l.stats.compilationTime.toFixed(2)}ms`),console.log(` Total components: ${l.stats.totalComponents}`),console.log(` Native components: ${l.stats.nativeComponents}`),console.log(` Web fallback components: ${l.stats.webComponents}`),console.log(` Bundle size: ${(l.stats.bundleSize/1024).toFixed(2)}KB`),l.stats.warnings.length>0){console.log(`
|
package/dist/craft-entry.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Xs,Ji,Yi}from"./chunk-y55pcfaj.js";import"./chunk-
|
|
2
|
+
import{Xs,Ji,Yi}from"./chunk-y55pcfaj.js";import"./chunk-r0ys9aqa.js";import"./chunk-gtktv6nn.js";import"./chunk-6beg47t4.js";import"./chunk-xw0cqb5m.js";import"./chunk-t6m5d64b.js";import"./chunk-bg6t69qq.js";import"./chunk-tenbwcts.js";import"./chunk-kypwg2ws.js";import"./chunk-1rgjy80j.js";import"./chunk-ygb33q5w.js";import"./chunk-912r15hr.js";import"./chunk-58m0kfb3.js";import"./chunk-67v3rh14.js";import"./chunk-dnbdxbkb.js";import"./chunk-n4qp4q2x.js";import"./chunk-pf25jb54.js";import"./chunk-51fqvchq.js";import"./chunk-dxcn65hq.js";import"./chunk-9bgb9n12.js";import"./chunk-03xn8244.js";import{ep,Hi,tp,np,Vi,Gs,Ui,rp,Wi,sp,op,qi,Ki,Gi,Xi}from"./chunk-z10ffhzy.js";import"./chunk-yf42bhjw.js";import"./chunk-hx787tfa.js";import"./chunk-fw12pvmr.js";import"./chunk-jgxzbthg.js";import"./chunk-0y2hkbc6.js";var m=new Map,d=new Map;function R(t,e){let n=e?.id||E(t),r=I(t),a=m.get(n);if(a&&a.hash===r)return a;let i=M(t),s=L(t),o=W(t),c=O(i),{staticParts:p,dynamicParts:l}=A(i),f=_(t),g={id:n,hash:r,tree:i,scripts:s,styles:o,staticParts:p,dynamicParts:l,dependencies:f,metadata:c};return m.set(n,g),g}async function Q(t,e={},n={}){let r=performance.now();if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`,c=d.get(o);if(c&&Date.now()-c.timestamp<(n.cacheTTL||60000))return{html:c.html,styles:t.styles.join(`
|
|
3
3
|
`),scripts:t.scripts.join(`
|
|
4
4
|
`),metadata:{renderTime:0,cacheHit:!0,totalSize:c.html.length,componentCount:t.metadata.componentCount}}}let a;if(n.streaming)a=await H(t.tree,e);else a=h(t.tree,e);let i;if(n.hydrate){let o=j(a,t,e);a=o.html,i=o.data}if(n.minify)a=D(a);if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`;d.set(o,{html:a,timestamp:Date.now()})}let s=performance.now()-r;return{html:a,styles:t.styles.join(`
|
|
5
5
|
`),scripts:t.scripts.join(`
|
|
6
6
|
`),hydrationData:i,metadata:{renderTime:s,cacheHit:!1,totalSize:a.length,componentCount:t.metadata.componentCount}}}function V(t,e){let n=[],r=[],a=[],i=new Map,s=[];return y(t.tree,(o,c)=>{if(o.type==="component"&&o.componentName){if(T(o.componentName))n.push(o.componentName)}if(o.type==="element"&&o.tag){let p=J(o);if(p)s.push(p);if(o.props){for(let[l,f]of Object.entries(o.props))if(l.startsWith("on")&&typeof f==="string"){let g=`handler_${i.size}`;i.set(g,f)}}}if(o.isStatic&&o.type==="element")r.push(b(o));else if(!o.isStatic&&o.type!=="text")a.push(o.tag||o.componentName||"unknown")}),{nativeComponents:n,staticHTML:r,dynamicParts:a,eventHandlers:i,nativeWidgets:s}}function Y(t,e={}){let n=R(t),r=P(n,e),a=new Map,i=[];return y(n.tree,(s)=>{if(s.type==="component"&&s.componentName){if(T(s.componentName)){i.push(s.componentName);let o=`<!--craft:${s.componentName}:${s.hydrationKey||"default"}-->`;a.set(s.hydrationKey||s.componentName,o)}}}),{staticHTML:r,dynamicPlaceholders:a,craftComponents:i}}function M(t){let e={type:"fragment",children:[]},n=e,r=[e],a=t,i=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);while(a.length>0){let s=a.match(/^<(@?[\w-]+)([^>]*)>/);if(s){let[p,l,f]=s,g=z(f),u=l.startsWith("@craft-"),C=u?l:l.toLowerCase(),S={type:u?"component":"element",tag:C,props:g,children:[],componentName:u?C.slice(1):void 0,isStatic:!v(f),hydrationKey:F()};if(n.children=n.children||[],n.children.push(S),!i.has(C)&&!f.endsWith("/"))r.push(S),n=S;a=a.slice(p.length);continue}let o=a.match(/^<\/(@?[\w-]+)>/);if(o){let[p,l]=o,g=l.startsWith("@craft-")?l:l.toLowerCase();while(r.length>1){let u=r.pop();if(n=r[r.length-1],u.tag===g)break}a=a.slice(p.length);continue}let c=a.match(/^[^<]+/);if(c){let p=c[0];if(p.trim()){let l={type:"text",text:p,isStatic:!v(p)};n.children=n.children||[],n.children.push(l)}a=a.slice(p.length);continue}a=a.slice(1)}return e}function z(t){let e={},n=/([\w-:@]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S+)))?/g,r;while((r=n.exec(t))!==null){let[,a,i,s,o]=r,c=i??s??o??!0;e[a]=c}return e}function y(t,e,n=[]){if(e(t,n),t.children)t.children.forEach((r,a)=>{y(r,e,[...n,`${a}`])})}function h(t,e){switch(t.type){case"text":return x(t.text||"",e);case"element":case"component":{let n=t.tag||"div",r=N(t.props||{},e),a=(t.children||[]).map((i)=>h(i,e)).join("");if(!t.children||t.children.length===0){if(["input","br","hr","img","meta","link"].includes(n))return`<${n}${r} />`}return`<${n}${r}>${a}</${n}>`}case"fragment":return(t.children||[]).map((n)=>h(n,e)).join("");case"slot":return`<!--slot:${t.slotName||"default"}-->`;default:return""}}function b(t){if(t.type==="text")return t.text||"";let e=t.tag||"div",n=N(t.props||{},{});return`<${e}${n}></${e}>`}function N(t,e){let n=[];for(let[r,a]of Object.entries(t))if(a===!0)n.push(` ${r}`);else if(a!==!1&&a!==null&&a!==void 0){let i=x(String(a),e);n.push(` ${r}="${k(i)}"`)}return n.join("")}async function H(t,e){return h(t,e)}function P(t,e){let n=[];return y(t.tree,(r)=>{if(r.isStatic)n.push(h(r,e))}),n.join("")}function j(t,e,n){let r={templateId:e.id,context:n,dynamicParts:Array.from(e.dynamicParts.entries())},a=`
|
|
7
7
|
<script data-craft-hydration>
|
|
8
8
|
window.__CRAFT_HYDRATION__ = ${JSON.stringify(r)};
|
|
9
|
-
</script>`;return{html:t+a,data:r}}function O(t){let e=!1,n=!1,r=!1,a=!1,i=0,s=0;function o(c,p){if(s=Math.max(s,p),c.type==="slot")e=!0;if(c.type==="component")i++;if(!c.isStatic)n=!0;if(c.props)for(let l of Object.keys(c.props)){if(l.startsWith("on"))r=!0;if(l==="@async"||l==="data-async")a=!0}if(c.children)c.children.forEach((l)=>o(l,p+1))}return o(t,0),{hasSlots:e,hasDynamicContent:n,hasEventHandlers:r,hasAsyncContent:a,componentCount:i,maxDepth:s,estimatedSize:JSON.stringify(t).length}}function A(t){let e=new Map,n=new Map;return y(t,(r,a)=>{let i=a.join(".");if(r.isStatic)e.set(i,b(r));else n.set(i,r.tag||r.componentName||"dynamic")}),{staticParts:e,dynamicParts:n}}function L(t){let e=[],n=/<script[^>]*>([\s\S]*?)<\/script>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function W(t){let e=[],n=/<style[^>]*>([\s\S]*?)<\/style>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function _(t){let e=[],n=/@include\s*\(\s*['"]([^'"]+)['"]/g,r;while((r=n.exec(t))!==null)e.push(r[1]);let a=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((r=a.exec(t))!==null)e.push(r[1]);let i=/<@craft-[\w-]+/g;while((r=i.exec(t))!==null)e.push(r[0].slice(2));return[...new Set(e)]}function v(t){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(t)}function x(t,e){let n=t.replace(/\{\{\s*(.+?)\s*\}\}/g,(r,a)=>{try{let i=w(a.trim(),e);return k(String(i??""))}catch{return""}});return n=n.replace(/\{!!\s*(.+?)\s*!!\}/g,(r,a)=>{try{let i=w(a.trim(),e);return String(i??"")}catch{return""}}),n}function w(t,e){if(/^[\w.]+$/.test(t)){let n=t.split("."),r=e;for(let a of n)if(r&&typeof r==="object"&&a in r)r=r[a];else return;return r}try{return Function(...Object.keys(e),`return ${t}`)(...Object.values(e))}catch{return}}function k(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function D(t){return t.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function E(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return`tpl_${Math.abs(e).toString(36)}`}function I(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(36)}var K=0;function F(){return`h_${++K}`}function T(t){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes(t)}function J(t){let e=t.tag?.toLowerCase(),n=t.props?.type,r={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},a=n?`${e}:${n}`:e,i=r[a||""]||r[e||""];if(i)return{htmlSelector:a||e||"",nativeComponent:i.component,confidence:i.confidence,reason:i.reason};return null}function U(){m.clear()}function q(){d.clear()}function B(){U(),q()}function G(){return{templateCacheSize:m.size,renderCacheSize:d.size,totalEntries:m.size+d.size}}export{ep as CRAFT_BRIDGE_SCRIPT,
|
|
9
|
+
</script>`;return{html:t+a,data:r}}function O(t){let e=!1,n=!1,r=!1,a=!1,i=0,s=0;function o(c,p){if(s=Math.max(s,p),c.type==="slot")e=!0;if(c.type==="component")i++;if(!c.isStatic)n=!0;if(c.props)for(let l of Object.keys(c.props)){if(l.startsWith("on"))r=!0;if(l==="@async"||l==="data-async")a=!0}if(c.children)c.children.forEach((l)=>o(l,p+1))}return o(t,0),{hasSlots:e,hasDynamicContent:n,hasEventHandlers:r,hasAsyncContent:a,componentCount:i,maxDepth:s,estimatedSize:JSON.stringify(t).length}}function A(t){let e=new Map,n=new Map;return y(t,(r,a)=>{let i=a.join(".");if(r.isStatic)e.set(i,b(r));else n.set(i,r.tag||r.componentName||"dynamic")}),{staticParts:e,dynamicParts:n}}function L(t){let e=[],n=/<script[^>]*>([\s\S]*?)<\/script>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function W(t){let e=[],n=/<style[^>]*>([\s\S]*?)<\/style>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function _(t){let e=[],n=/@include\s*\(\s*['"]([^'"]+)['"]/g,r;while((r=n.exec(t))!==null)e.push(r[1]);let a=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((r=a.exec(t))!==null)e.push(r[1]);let i=/<@craft-[\w-]+/g;while((r=i.exec(t))!==null)e.push(r[0].slice(2));return[...new Set(e)]}function v(t){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(t)}function x(t,e){let n=t.replace(/\{\{\s*(.+?)\s*\}\}/g,(r,a)=>{try{let i=w(a.trim(),e);return k(String(i??""))}catch{return""}});return n=n.replace(/\{!!\s*(.+?)\s*!!\}/g,(r,a)=>{try{let i=w(a.trim(),e);return String(i??"")}catch{return""}}),n}function w(t,e){if(/^[\w.]+$/.test(t)){let n=t.split("."),r=e;for(let a of n)if(r&&typeof r==="object"&&a in r)r=r[a];else return;return r}try{return Function(...Object.keys(e),`return ${t}`)(...Object.values(e))}catch{return}}function k(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function D(t){return t.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function E(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return`tpl_${Math.abs(e).toString(36)}`}function I(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(36)}var K=0;function F(){return`h_${++K}`}function T(t){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes(t)}function J(t){let e=t.tag?.toLowerCase(),n=t.props?.type,r={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},a=n?`${e}:${n}`:e,i=r[a||""]||r[e||""];if(i)return{htmlSelector:a||e||"",nativeComponent:i.component,confidence:i.confidence,reason:i.reason};return null}function U(){m.clear()}function q(){d.clear()}function B(){U(),q()}function G(){return{templateCacheSize:m.size,renderCacheSize:d.size,totalEntries:m.size+d.size}}export{ep as CRAFT_BRIDGE_SCRIPT,Gs as CRAFT_COMPONENTS,rp as CRAFT_COMPONENT_RUNTIME,Ui as CRAFT_COMPONENT_STYLES,Xs as NATIVE_COMPONENTS,qi as buildNative,B as clearAllCaches,q as clearRenderCache,U as clearTemplateCache,R as compileTemplate,Ji as compileToNative,Yi as createHotReloadServer,Ki as findCraftBinary,Hi as generateCraftBridgeScript,V as generateCraftOptimizations,Xi as getAvailableFormats,Gi as getAvailableTargets,op as getCraftComponents,G as getSSRCacheStats,Vi as injectCraftBridge,tp as isCraftEnvironment,Y as prerenderForCraft,Wi as processCraftComponents,np as processCraftDirective,sp as registerCraftComponent,Q as renderSSR};
|