@stacksjs/stx 0.2.582 → 0.2.583
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-ayy9mmrw.js → chunk-02qaqamv.js} +6 -6
- package/dist/{chunk-6w2yqtrd.js → chunk-07anexcg.js} +1 -1
- package/dist/{chunk-dvgvvy5b.js → chunk-09zwhsf9.js} +1 -1
- package/dist/{chunk-cb2pyg5t.js → chunk-0dfgefjv.js} +2 -2
- package/dist/chunk-0fx3ppnt.js +2 -0
- package/dist/chunk-0sfexf9t.js +2 -0
- package/dist/chunk-2927nax9.js +2 -0
- package/dist/{chunk-eww6sdzz.js → chunk-2943qhdt.js} +1 -1
- package/dist/{chunk-9jh2ake5.js → chunk-2nehykbm.js} +5 -5
- package/dist/chunk-2rj0ttas.js +2 -0
- package/dist/chunk-3ae39ttg.js +2 -0
- package/dist/{chunk-q2a58n2a.js → chunk-440yjsk5.js} +1 -1
- package/dist/{chunk-kp0hg06s.js → chunk-4pkpr5cg.js} +2 -2
- package/dist/{chunk-g4crr86j.js → chunk-4pmgr32a.js} +3 -3
- package/dist/chunk-521pe0hb.js +18 -0
- package/dist/chunk-58z26y07.js +2 -0
- package/dist/chunk-5r9k9s3m.js +2 -0
- package/dist/{chunk-vx75fb0d.js → chunk-6fc8vw2v.js} +2 -2
- package/dist/{chunk-43h8q2cm.js → chunk-6m3me7yj.js} +6 -6
- package/dist/chunk-76vza4ve.js +2 -0
- package/dist/{chunk-c1r7zq0q.js → chunk-8tq83fq7.js} +71 -71
- package/dist/chunk-8y8bbsh5.js +2 -0
- package/dist/{chunk-620szfcp.js → chunk-96mb3brj.js} +2 -2
- package/dist/chunk-9kzycb15.js +2 -0
- package/dist/{chunk-djft0m5h.js → chunk-ac6v3s3k.js} +1 -1
- package/dist/chunk-agfhb2qd.js +2 -0
- package/dist/chunk-ay6dzpt4.js +2 -0
- package/dist/{chunk-dtcc09x1.js → chunk-b9njk81d.js} +1 -1
- package/dist/chunk-bfbcmfww.js +2 -0
- package/dist/chunk-br01jvra.js +2 -0
- package/dist/{chunk-v8p5p2kp.js → chunk-c12y2bet.js} +1 -1
- package/dist/chunk-c2nwchk0.js +2 -0
- package/dist/{chunk-3qrrv6af.js → chunk-cby4mkjf.js} +1 -1
- package/dist/{chunk-qazn64pm.js → chunk-ck1yca7g.js} +1 -1
- package/dist/chunk-cxqrwvc5.js +2 -0
- package/dist/chunk-czea8zr1.js +2 -0
- package/dist/chunk-d99kfx3k.js +2 -0
- package/dist/{chunk-7hkc96de.js → chunk-dhq80e4r.js} +4 -4
- package/dist/{chunk-cdgwkzms.js → chunk-dm1qh2vq.js} +1 -1
- package/dist/{chunk-5pgbsc3a.js → chunk-dskrwa8f.js} +1 -1
- package/dist/{chunk-zk2xk0wd.js → chunk-dvc15djp.js} +2 -2
- package/dist/chunk-e6ycqvdm.js +2 -0
- package/dist/{chunk-8v19753h.js → chunk-e809x7m0.js} +1 -1
- package/dist/{chunk-ta3wn842.js → chunk-en7xxgtb.js} +2 -2
- package/dist/chunk-fvx6pd66.js +2 -0
- package/dist/{chunk-xpnpg967.js → chunk-g9zeybqh.js} +2 -2
- package/dist/{chunk-zz02hwec.js → chunk-h3z9b6bw.js} +22 -22
- package/dist/{chunk-yk3fbzx5.js → chunk-hp9nxva6.js} +3 -3
- package/dist/chunk-hrbjapvr.js +2 -0
- package/dist/{chunk-pmpb34md.js → chunk-hzqyfdpy.js} +5 -5
- package/dist/chunk-jc4mxq56.js +2 -0
- package/dist/chunk-jdpyxt8j.js +2 -0
- package/dist/{chunk-4rkvwm6v.js → chunk-je1as16r.js} +9 -9
- package/dist/chunk-k0zev8wc.js +2 -0
- package/dist/{chunk-nrfh7gaa.js → chunk-kfwmqacd.js} +1 -1
- package/dist/{chunk-t61vdbje.js → chunk-ktvr45qg.js} +6 -6
- package/dist/{chunk-y8q1n7hx.js → chunk-ky1426s1.js} +6 -6
- package/dist/{chunk-rr8a7d4q.js → chunk-m417sp42.js} +3 -3
- package/dist/{chunk-101ekf6y.js → chunk-mjj24qpb.js} +2 -2
- package/dist/{chunk-ev5f79mg.js → chunk-mt9x626h.js} +3 -3
- package/dist/{chunk-faghmmrs.js → chunk-n4e02qdz.js} +85 -85
- package/dist/{chunk-yy3ser06.js → chunk-nh3svtvj.js} +3 -3
- package/dist/{chunk-yfq2v7x5.js → chunk-nhd9m8h5.js} +6 -6
- package/dist/chunk-nx8rf4qd.js +2 -0
- package/dist/{chunk-t8wpzqs4.js → chunk-pbwk8tzz.js} +1 -1
- package/dist/chunk-pe5bk9ns.js +2 -0
- package/dist/chunk-qb2j34sp.js +2 -0
- package/dist/chunk-qknfceta.js +2 -0
- package/dist/{chunk-0vnngvy1.js → chunk-qn8gdw21.js} +4 -4
- package/dist/chunk-sf98zgw2.js +2 -0
- package/dist/chunk-sgsp4dph.js +2 -0
- package/dist/{chunk-jtbzmbzz.js → chunk-sv08pd66.js} +2 -2
- package/dist/{chunk-30rf7k4n.js → chunk-tfxmzat6.js} +24 -24
- package/dist/chunk-tms7amrb.js +2 -0
- package/dist/chunk-v0zgarvv.js +2 -0
- package/dist/chunk-vczw73ga.js +2 -0
- package/dist/{chunk-be2ba3hj.js → chunk-vkc51n9m.js} +2 -2
- package/dist/{chunk-1v1mew46.js → chunk-vke73gts.js} +1 -1
- package/dist/{chunk-c0s3k64c.js → chunk-w6wtxj54.js} +2 -2
- package/dist/chunk-webrqm20.js +2 -0
- package/dist/chunk-wngqr949.js +2 -0
- package/dist/{chunk-71sdgv7e.js → chunk-wyn5rfzk.js} +105 -35
- package/dist/{chunk-yhpyqsbr.js → chunk-x552npae.js} +2 -2
- package/dist/{chunk-3wy8q3aq.js → chunk-xp7fxc6p.js} +5 -5
- package/dist/{chunk-t4g2fptt.js → chunk-xytkfa48.js} +4 -4
- package/dist/chunk-xyzy84x0.js +2 -0
- package/dist/chunk-y1jffvkj.js +2 -0
- package/dist/{chunk-74j18qk0.js → chunk-y8h823cb.js} +28 -28
- package/dist/chunk-yas134jv.js +2 -0
- package/dist/{chunk-tszkg6sj.js → chunk-ycj0342k.js} +1 -1
- package/dist/{chunk-mxe21m6q.js → chunk-yd55vynh.js} +1 -1
- package/dist/{chunk-hzfhn2vr.js → chunk-ye66wc53.js} +2 -2
- package/dist/{chunk-k9th7hc4.js → chunk-ym1sb5bg.js} +2 -2
- package/dist/chunk-yn2d8x8m.js +3 -0
- package/dist/chunk-ze86h6vp.js +2 -0
- package/dist/cli.js +44 -44
- package/dist/client/signals-authoring-runtime.js +13 -6
- package/dist/client/signals-binding-utils-runtime.js +14 -1
- package/dist/client/signals-component-api-runtime.js +3 -1
- package/dist/client/signals-event-shorthand-runtime.js +1 -1
- package/dist/client/signals-expression-runtime.js +1 -1
- package/dist/client/signals-host-runtime.js +20 -0
- package/dist/client/signals-manifest-hydration-runtime.js +7 -0
- package/dist/client/signals-model-runtime.js +2 -0
- package/dist/client/signals-mount-runtime.js +5 -1
- package/dist/client/signals-process-element-runtime.js +22 -7
- package/dist/component-model.d.ts +1 -1
- package/dist/component-model.js +6 -3
- package/dist/composition-api.js +3 -2
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/native/compiler/bundle.js +8 -3
- package/dist/native/compiler/html-to-ir.d.ts +3 -1
- package/dist/native/compiler/html-to-ir.js +28 -1
- package/dist/native/runtime/binding-tree.js +12 -0
- package/dist/native/runtime/craft-bridge.js +2 -1
- package/dist/native/runtime/jsc-globals.d.ts +10 -3
- package/dist/native/runtime/jsc-globals.js +23 -4
- package/dist/native/runtime/native-host.d.ts +4 -0
- package/dist/native/runtime/native-host.js +273 -21
- package/dist/native/runtime/shared-screen.js +1 -0
- package/dist/native/testing.js +1 -1
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +7 -7
- package/package.json +5 -5
- package/dist/chunk-0047meje.js +0 -2
- package/dist/chunk-1cat8kdj.js +0 -2
- package/dist/chunk-1dwnp35v.js +0 -2
- package/dist/chunk-2dnr5qfk.js +0 -2
- package/dist/chunk-2v73cjbc.js +0 -2
- package/dist/chunk-3akgppsy.js +0 -2
- package/dist/chunk-4t67wmcg.js +0 -2
- package/dist/chunk-51zn42jy.js +0 -2
- package/dist/chunk-5702x95v.js +0 -2
- package/dist/chunk-60c2bsh9.js +0 -2
- package/dist/chunk-79v4d9qh.js +0 -2
- package/dist/chunk-7pp2vx1g.js +0 -2
- package/dist/chunk-8zm6tkqb.js +0 -2
- package/dist/chunk-a1z36dt5.js +0 -2
- package/dist/chunk-atsf1fe0.js +0 -2
- package/dist/chunk-b8qd6h1q.js +0 -2
- package/dist/chunk-ccxs40xy.js +0 -2
- package/dist/chunk-cg8hg6cs.js +0 -3
- package/dist/chunk-cp442y7a.js +0 -2
- package/dist/chunk-d4en5d3s.js +0 -2
- package/dist/chunk-dh80d57p.js +0 -2
- package/dist/chunk-dyqte1xq.js +0 -2
- package/dist/chunk-e4n4v022.js +0 -2
- package/dist/chunk-g2fw68zm.js +0 -2
- package/dist/chunk-hcgm37dy.js +0 -2
- package/dist/chunk-hd2bn5q7.js +0 -2
- package/dist/chunk-j1nqnmcd.js +0 -18
- package/dist/chunk-k7jqkt93.js +0 -2
- package/dist/chunk-mqy7g74k.js +0 -2
- package/dist/chunk-ne03tfje.js +0 -2
- package/dist/chunk-p2sns0bn.js +0 -2
- package/dist/chunk-s1sycp43.js +0 -2
- package/dist/chunk-sp46w7z9.js +0 -2
- package/dist/chunk-sy1bk1ry.js +0 -2
- package/dist/chunk-tpd5nwa3.js +0 -2
- package/dist/chunk-tpt4bgs5.js +0 -2
- package/dist/chunk-vq0cb1m9.js +0 -2
- package/dist/chunk-y1bppxgw.js +0 -2
- package/dist/chunk-yv5rwthv.js +0 -2
- package/dist/chunk-z1r4tdqy.js +0 -2
- package/dist/chunk-zv288w4e.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{t,i}from"./chunk-
|
|
2
|
+
import{t,i}from"./chunk-dhq80e4r.js";import{Ze,Qe,et,ge,ke,_,dr,Sn,he}from"./chunk-6m3me7yj.js";var I=/(?<![\w$@])@meta\s*\(/g,C=/(?<![\w$@])@metaTag\s*\(/g,k=/(?<![\w$@])@structuredData\s*\(/g,N=/(?<![\w$@])@seo\s*\(/g;function D(e,r){return(n)=>_(e,n,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX)}function j(e){return"property"in e?`<meta property="${l(e.property)}" content="${l(e.content)}">`:`<meta name="${l(e.name)}" content="${l(e.content)}">`}function Ms(e,r,n,g){if(!e.includes("@meta"))return e;let a=Ze(e,I,(s,c)=>{let o=Sn(Qe(s),r);if(o.kind==="tag")return j(o.tag);if(o.kind==="empty")return"";return _("Meta",c,o.message,n,o.code)},D("Meta",n));return a=Ze(a,C,(s,c)=>{let o=et(s,r);if(!o.ok)return _("MetaTag",c,o.message,n,o.code);if(o.value===void 0||o.value===null)return"";if(!ke(o.value))return _("MetaTag",c,`expected an object such as { name, content }, got ${ge(o.value)}`,n,t.TYPE_ERROR);let u=o.value;if(!u.name&&!u.property&&!u.httpEquiv)return _("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},D("MetaTag",n)),a}function v(e){let r=(n)=>n["@context"]?{...n}:{...n,"@context":"https://schema.org"};if(ke(e))return r(e);if(Array.isArray(e)&&e.length>0&&e.every(ke))return e.map(r);return null}function A(e){return`<script type="application/ld+json">${JSON.stringify(e).replace(/<\//g,"<\\/")}</script>`}function Ns(e,r,n){if(!e.includes("@structuredData"))return e;return Ze(e,k,(g,a)=>{let s=et(g,r);if(!s.ok)return _("StructuredData",a,s.message,n,s.code);if(s.value===void 0||s.value===null)return"";let c=v(s.value);if(!c)return _("StructuredData",a,`expected an object or an array of objects, got ${ge(s.value)}`,n,t.TYPE_ERROR);try{return A(c)}catch(o){let u=o instanceof Error?o.message:String(o);return _("StructuredData",a,`the data cannot be written as JSON: ${u}`,n,t.EVALUATION_ERROR)}},D("StructuredData",n))}var L=new Set(["title","description","keywords","robots","canonical","openGraph","twitter","structuredData"]),R={image:"openGraph.image",url:"canonical or openGraph.url",type:"openGraph.type",siteName:"openGraph.siteName",locale:"openGraph.locale",og:"openGraph",author:"@meta('author', ...)"};function Ls(e,r,n,g){if(!e.includes("@seo"))return e;return Ze(e,N,(a,s)=>{if(!a.trim())return _("SEO",s,"expected an object: @seo({ title, description }) or @seo(seoVariable)",n,t.INVALID_DIRECTIVE_SYNTAX);let c=et(a,r);if(!c.ok)return _("SEO",s,c.message,n,c.code);if(c.value===void 0||c.value===null)return"";if(!ke(c.value))return _("SEO",s,`expected an object such as { title, description }, got ${ge(c.value)}`,n,t.TYPE_ERROR);try{return q(c.value,s,n)}catch(o){let u=o instanceof Error?o.message:String(o);return _("SEO",s,`Error processing @seo directive: ${u}`,n,t.EVALUATION_ERROR)}},D("SEO",n))}function b(e,r,n,g){let a=e[r];if(a===void 0||a===null||a===!1)return;if(ke(a))return a;dr(n,`${r} must be an object, got ${ge(a)}; its tags were left out`,g);return}function q(e,r,n){let g=Object.keys(e).filter((o)=>!L.has(o));if(g.length>0){let o=g.map((u)=>R[u]?`${u} (use ${R[u]})`:u).join(", ");dr(r,`@seo does not read ${o}; ${g.length===1?"it was":"they were"} ignored`,n)}let a="";if(e.title)a+=`<title>${l(e.title)}</title>
|
|
3
3
|
`,a+=`<meta name="title" content="${l(e.title)}">
|
|
4
4
|
`;if(e.description)a+=`<meta name="description" content="${l(e.description)}">
|
|
5
5
|
`;if(e.keywords){let o=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;a+=`<meta name="keywords" content="${l(o)}">
|
|
@@ -43,7 +43,7 @@ import{t,i}from"./chunk-7hkc96de.js";import{Ze,Qe,et,ge,ke,_,dr,Sn,he}from"./chu
|
|
|
43
43
|
${y}
|
|
44
44
|
`),h;return h.replace(/<head[^>]*>/,`$&
|
|
45
45
|
${y}
|
|
46
|
-
`)}function M(e){let r=e.search(/<\/head\s*>/i);return r===-1?e:e.slice(0,r)}function x(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�*39;|'/g,"'").replace(/&/g,"&")}function V(e){let r=e.match(/<title(?:\s[^>]*)?>([\s\S]*?)<\/title\s*>/i);return r?x(r[1].trim()):""}function O(e){return(e.match(/<meta\s[^>]*>/gi)||[]).filter((r)=>/\sname\s*=\s*["']description["']/i.test(r))}function G(e){return O(e).length>0}function U(e){for(let r of O(e)){let n=r.match(/\scontent\s*=\s*(?:"([^"]*)"|'([^']*)')/i),g=(n?.[1]??n?.[2]??"").trim();if(g)return x(g)}return""}function l(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var
|
|
46
|
+
`)}function M(e){let r=e.search(/<\/head\s*>/i);return r===-1?e:e.slice(0,r)}function x(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�*39;|'/g,"'").replace(/&/g,"&")}function V(e){let r=e.match(/<title(?:\s[^>]*)?>([\s\S]*?)<\/title\s*>/i);return r?x(r[1].trim()):""}function O(e){return(e.match(/<meta\s[^>]*>/gi)||[]).filter((r)=>/\sname\s*=\s*["']description["']/i.test(r))}function G(e){return O(e).length>0}function U(e){for(let r of O(e)){let n=r.match(/\scontent\s*=\s*(?:"([^"]*)"|'([^']*)')/i),g=(n?.[1]??n?.[2]??"").trim();if(g)return x(g)}return""}function l(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var cr={name:"meta",rawParams:!0,handler:(e,r,n,g)=>{let a=Sn(r,n??{});if(a.kind==="error")return _("Meta",`@meta(${r.join(", ")})`,a.message,g,a.code);if(a.kind==="empty")return"";if(n)n.__stx_runtime_head=he(n.__stx_runtime_head??{},{meta:[a.tag]});return""},hasEndTag:!1},lr={name:"structuredData",handler:(e,r,n,g)=>{if(e.trim()==="")return i("StructuredData","structuredData directive requires JSON-LD content",t.INVALID_DIRECTIVE_SYNTAX);try{let a=JSON.parse(e);if(!a["@context"])a["@context"]="https://schema.org";if(!a["@type"])return i("StructuredData","structuredData requires @type property",t.INVALID_DIRECTIVE_SYNTAX);return A(a)}catch(a){let s=a instanceof Error?a.message:String(a);return i("StructuredData",s,t.EVALUATION_ERROR)}},hasEndTag:!0};function dd(){return[cr,lr]}function pd(e,r){let{baseUrl:n,defaultChangefreq:g="weekly",defaultPriority:a=0.5,includeLastmod:s=!0}=r,c=n.replace(/\/$/,""),o=(m)=>m.startsWith("http")?m:`${c}${m.startsWith("/")?"":"/"}${m}`,u=e.map((m)=>{let d=o(m.loc),f=m.lastmod||(s?new Date().toISOString().split("T")[0]:void 0),E=m.changefreq||g,y=m.priority??a,h=` <url>
|
|
47
47
|
<loc>${T(d)}</loc>`;for(let w of m.alternates??[])h+=`
|
|
48
48
|
<xhtml:link rel="alternate" hreflang="${T(w.hreflang)}" href="${T(o(w.href))}"/>`;if(f)h+=`
|
|
49
49
|
<lastmod>${f}</lastmod>`;return h+=`
|
|
@@ -53,13 +53,13 @@ ${y}
|
|
|
53
53
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${e.some((m)=>m.alternates?.length)?' xmlns:xhtml="http://www.w3.org/1999/xhtml"':""}>
|
|
54
54
|
${u.join(`
|
|
55
55
|
`)}
|
|
56
|
-
</urlset>`}function
|
|
56
|
+
</urlset>`}function fd(e,r){let n=r.replace(/\/$/,""),g=new Date().toISOString().split("T")[0];return`<?xml version="1.0" encoding="UTF-8"?>
|
|
57
57
|
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
58
58
|
${e.map((s)=>{let c=s.startsWith("http")?s:`${n}${s.startsWith("/")?"":"/"}${s}`;return` <sitemap>
|
|
59
59
|
<loc>${T(c)}</loc>
|
|
60
60
|
<lastmod>${g}</lastmod>
|
|
61
61
|
</sitemap>`}).join(`
|
|
62
62
|
`)}
|
|
63
|
-
</sitemapindex>`}async function
|
|
64
|
-
`).trim()}function
|
|
65
|
-
export{Ms,Ns,Ls,js,
|
|
63
|
+
</sitemapindex>`}async function gd(e,r){let{extensions:n=[".stx",".html",".htm"],ignore:g=["_*",".*","node_modules","components","partials","layouts"]}=r,a=[],s=n.length===1?`*${n[0]}`:`*{${n.join(",")}}`,c=new Bun.Glob(`**/${s}`);for await(let o of c.scan(e)){if(g.some((f)=>{if(f.startsWith("*"))return o.includes(f.slice(1));return o.startsWith(f)||o.includes(`/${f}`)}))continue;let p=o.replace(/\\/g,"/").replace(/index\.(stx|html|htm)$/,"").replace(/\.(stx|html|htm)$/,"");if(!p.startsWith("/"))p=`/${p}`;if(p!=="/"&&p.endsWith("/"))p=p.slice(0,-1);let m=`${e}/${o}`,d;try{let f=await Bun.file(m).stat();if(f)d=new Date(f.mtime).toISOString().split("T")[0]}catch{}a.push({loc:p||"/",lastmod:d,priority:p==="/"?1:0.5})}return a.sort((o,u)=>o.loc.localeCompare(u.loc)),a}function ur(e){let r=[];for(let n of e.rules){if(r.push(`User-agent: ${n.userAgent}`),n.allow)for(let g of n.allow)r.push(`Allow: ${g}`);if(n.disallow)for(let g of n.disallow)r.push(`Disallow: ${g}`);if(n.crawlDelay!==void 0)r.push(`Crawl-delay: ${n.crawlDelay}`);r.push("")}if(e.sitemap){let n=Array.isArray(e.sitemap)?e.sitemap:[e.sitemap];for(let g of n)r.push(`Sitemap: ${g}`)}if(e.host)r.push(`Host: ${e.host}`);return r.join(`
|
|
64
|
+
`).trim()}function md(e){return ur({rules:[{userAgent:"*",allow:["/"]}],sitemap:e})}function T(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}
|
|
65
|
+
export{Ms,Ns,Ls,js,cr,lr,dd,pd,fd,gd,ur,md};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Te}from"./chunk-
|
|
2
|
+
import{Te}from"./chunk-x552npae.js";import{Ne,Zt}from"./chunk-wyn5rfzk.js";import{ei,ti,f,Rt,ue,L,n,A,o}from"./chunk-n4e02qdz.js";import{C}from"./chunk-vkc51n9m.js";import{Os}from"./chunk-2943qhdt.js";import{vn,wn,xn,kn,me}from"./chunk-6m3me7yj.js";import{Oi}from"./chunk-sv08pd66.js";import{ye,oe,wo,xo,Bt}from"./chunk-je1as16r.js";import{kt,ts}from"./chunk-nh3svtvj.js";import{Ft}from"./chunk-g9zeybqh.js";import{ht,rn,sn}from"./chunk-wg2w7zmt.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function J(i){return Q("sha256").update(i).digest("hex").slice(0,8)}function U(i=!1){let l=i?Zt():Ne(),a=J(l);return{content:l,filename:`runtime.${a}.js`,hash:a}}function V(){let i=Te(),l=J(i);return{content:i,filename:`router.${l}.js`,hash:l}}import q from"path";import{createHash as ee}from"crypto";function te(i={}){let l=new Set;return{context:new Proxy(i,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function X(i,l,a={}){let r=q.resolve(i),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);ei();let _={};try{_=await o(a.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))y.push(g[2])}let u=new Set(y.flatMap((R)=>ue(R))),{context:D}=te({__filename:r,__dirname:q.dirname(r),__stx_serverDeclared:u}),w=new Set,P={...A,..._,...a,buildMode:"compile",strict:!1},b=await n(e,D,r,P,w),T=ye(b),B=ti();return{route:l,sourceFile:i,html:b,fragment:T,placeholders:B,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(w),contentHash:S,status:Rt(e),streamTemplates:D.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(i,l){let a=0,r=0;if(!m.existsSync(i))return{copied:a,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let y=m.readdirSync(S,{withFileTypes:!0});for(let d of y){if(re.has(d.name))continue;let g=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),a++,r+=m.statSync(u).size}}}return e(i,l),{copied:a,bytes:r}}async function yl(i={}){let l=Date.now(),a=c.resolve(i.root||process.cwd()),r=c.resolve(a,i.outputDir||".output");console.log("[stx build] Starting production build...");let e=await o(a),S=c.resolve(a,i.componentsDir??e.componentsDir??"components"),_=c.resolve(a,i.partialsDir??e.partialsDir??"partials"),y=c.resolve(a,i.layoutsDir??e.layoutsDir??"layouts"),d=i.publicDir??e.publicDir??"public",g=me(e.app?.head,{known:kn,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",w=i.routeRules??e.routeRules??{},P=Ft(w),b=i.serverApi??e.serverApi,T=typeof b==="object"?b:{};if(b)kt(a,T);if(e.runtimeConfig)C(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let B=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of B)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=L(a,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],M=R.filter((s)=>!Y.some((h)=>s.pattern.startsWith(`/${h}/`)||s.pattern===`/${h}`));console.log(`[stx build] Found ${M.length} page routes (${R.length-M.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=U(i.debug),x=V();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let O=[],E=[];for(let s of M){let h=P(s.pattern),k=h.rendering==="prerender";if(k&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await X(s.filePath,s.pattern,{configDir:a,componentsDir:S,partialsDir:_,layoutsDir:y,debug:i.debug});if(O.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=xn(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=vn(t.html,u);if(g.htmlAttrs)t.html=wn(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let W=p[1];t.html=t.html.replace(" "+W,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${W}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await f(t.html),k){let p=await Bt(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=oe(t.html,D);let z=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),G=c.join("server","pages",`${z}.compiled.json`),I=c.join("server","fragments",`${z}.html`);await Bun.write(c.join(r,G),JSON.stringify(t,null,2)),await Bun.write(c.join(r,I),t.fragment),E.push({pattern:s.pattern,compiledPath:G,fragmentPath:I,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:k}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(h).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let H=c.resolve(a,d);if(m.existsSync(H)){let{copied:s,bytes:h}=Z(H,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${d}/`)}let F=sn(a);if(F){let{copied:s,bytes:h}=Z(F,c.join(r,"public",rn));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${ht}/`)}let N={runtime:v.filename,router:x.filename},j=wo(E,N,r);if(j.routeRules=w,j.routerContainer=D,b)j.apiRoutes=await ts(a,r,T);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await Os(a,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Oi(e._layerGraph),null,2));xo(j,r);let K=Date.now()-l;return console.log(`
|
|
3
3
|
[stx build] Done in ${K}ms \u2014 ${O.length} pages compiled`),{pageCount:O.length,assets:N,outputDir:r,duration:K}}
|
|
4
4
|
export{yl};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{X,n}from"./chunk-
|
|
2
|
+
import{X,n}from"./chunk-n4e02qdz.js";import p from"fs";import g from"path";import*as y from"readline";var e={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},u={help:{description:"Show available commands",usage:"help [command]",handler:async(t,o)=>{if(t[0]&&u[t[0]]){let r=u[t[0]];console.log(`
|
|
3
3
|
${e.bold}${t[0]}${e.reset} - ${r.description}`),console.log(` Usage: ${e.cyan}${r.usage}${e.reset}
|
|
4
4
|
`)}else{console.log(`
|
|
5
5
|
${e.bold}Available Commands:${e.reset}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{p,c}from"./chunk-
|
|
3
|
-
export{ba,Pl,wa,
|
|
2
|
+
import{p,c}from"./chunk-dhq80e4r.js";import{b}from"./chunk-n4e02qdz.js";function y(t,o){let i=1,r=o,e="<template",n="</template";while(r<t.length&&i>0){let s=t.indexOf("<",r);if(s===-1)break;if(r=s,t.startsWith(e,r)&&(r+e.length>=t.length||/[\s>\/]/.test(t[r+e.length]))){i++,r+=e.length;continue}if(t.startsWith(n,r)){let a=t.indexOf(">",r+n.length);if(a!==-1){if(i--,i===0)return a+1;r=a+1;continue}}r++}return i===0?r:-1}var w=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function x(t,o){let i=null;for(let r=o;r<t.length;r++){let e=t[r];if(i){if(e==="\\"){r++;continue}if(e===i)i=null;continue}if(e==='"'||e==="'"){i=e;continue}if(e===">")return r+1}return-1}function N(t,o,i){let r=o.toLowerCase(),e=1,n=i;while(n<t.length){let s=t.indexOf("<",n);if(s===-1)return-1;if(t.startsWith("<!--",s)){let g=t.indexOf("-->",s+4);n=g===-1?t.length:g+3;continue}let a=x(t,s+1);if(a===-1)return-1;let f=t.slice(s,a),u=f.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(u&&u[2].toLowerCase()===r){if(u[1]==="/"){if(e--,e===0)return a}else if(!/\/\s*>$/.test(f))e++}n=a}return-1}function A(t){let o=[],i=[],r=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=x(t,n+1);if(s===-1)break;let a=t.slice(n,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){e=s;continue}let u=f[2].toLowerCase();if(f[1]==="/"){let l=i.lastIndexOf(u);if(l!==-1)i.splice(l);e=s;continue}let g=/\/\s*>$/.test(a),d=i.length===0?a.match(r):null;if(d){let l=d[1]||d[2],m=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),h=g||w.has(u)?-1:N(t,u,s);if(h===-1)o.push({start:n,end:s,slotName:l,element:m}),e=s;else o.push({start:n,end:h,slotName:l,element:m+t.slice(s,h)}),e=h;continue}if(!g&&!w.has(u)){if(i.push(u),u==="script"||u==="style"){let l=t.toLowerCase().indexOf(`</${u}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function O(t){let o=[],i=[],r=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=x(t,n+1);if(s===-1)break;let a=t.slice(n,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){e=s;continue}let u=f[1]==="/",g=f[2].toLowerCase();if(u){let l=i.lastIndexOf(g);if(l!==-1)i.splice(l);e=s;continue}if(g==="template"&&i.length===0){let l=a.match(r);if(l){let m=y(t,s);if(m!==-1){let h=l[1]||l[2]||l[3];o.push({start:n,end:m,slotName:h,content:t.slice(s,m-11).trim(),propsBinding:l[4]||void 0}),e=m;continue}}}if(!/\/\s*>$/.test(a)&&!w.has(g)){if(i.push(g),g==="script"||g==="style"){let l=t.toLowerCase().indexOf(`</${g}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function ba(t){let o={default:"",named:new Map},i=t,r=O(t);for(let n of r)o.named.set(n.slotName,{name:n.slotName,content:n.content,propsBinding:n.propsBinding});r.sort((n,s)=>s.start-n.start);for(let n of r)i=i.slice(0,n.start)+i.slice(n.end);let e=A(i);for(let n of e){let s=o.named.get(n.slotName);if(s)s.content+=n.element;else o.named.set(n.slotName,{name:n.slotName,content:n.element})}for(let n=e.length-1;n>=0;n--){let s=e[n];i=i.slice(0,s.start)+i.slice(s.end)}return o.default=i.trim(),o}function Pl(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),i=o?o[1]:"",r={},e=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,n;while((n=e.exec(t))!==null)r[n[1]]=n[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),a=s?s[1].trim():"";return{name:i,props:r,defaultContent:a}}async function va(t,o,i,r){if(!t)return i;let e=t.content;if(t.propsBinding&&Object.keys(o).length>0){let n=t.propsBinding.trim(),s={...r};if(n.startsWith("{")&&n.endsWith("}")){let a=n.slice(1,-1).split(",").map((f)=>f.trim()).filter(Boolean);for(let f of a){let[u,g]=f.split(":").map((l)=>l.trim()),d=g||u;if(o[u]!==void 0)s[d]=o[u]}}else s[n]=o;e=C(e,s)}return e}function C(t,o){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(i,r)=>{try{let e=r.trim(),n=k(e,o);return b(String(n??""))}catch{return`{{ ${r} }}`}})}function k(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let r=t.split("."),e=o;for(let n of r)if(e&&typeof e==="object"&&n in e)e=e[n];else return;return e}let i=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(i){let[,r,e,n]=i,s=o[r],a=parseInt(n,10);if(typeof s==="number")switch(e){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":return s/a}}try{if(!p(t))return;return c(t,Object.keys(o))(...Object.values(o))}catch{return}}async function wa(t,o,i){let r=t;r=await M(r,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(s,a,f,u)=>{let g=o.named.get(a),d=u?.trim()||"",l=f||"",m={},h=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,S;while((S=h.exec(l))!==null){let E=S[1],R=S[2];m[E]=k(R,i)}return await va(g,m,d,i)});let n=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return r=r.replace(n,(s,a,f)=>{if(/\bname\s*=/.test(a||""))return s;let u=f?.trim()||"";return o.default||u}),r}async function M(t,o,i){let r=[],e=[];t.replace(o,(a,...f)=>{let u=f[f.length-2];return e.push({match:a,index:u}),r.push(i(a,...f.slice(0,-2))),a});let n=await Promise.all(r),s=t;for(let a=e.length-1;a>=0;a--){let{match:f,index:u}=e[a];s=s.slice(0,u)+n[a]+s.slice(u+f.length)}return s}function Il(t){let o=ba(t);return{defaultSlot:o.default,namedSlots:o.named}}async function Ol(t,o,i,r){return await wa(t,{default:o,named:i},r)}
|
|
3
|
+
export{ba,Pl,va,wa,Il,Ol};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Qu,si,ed,oi,vc,wc,$t,pn,td,xc,Sc,nd,f}from"./chunk-n4e02qdz.js";import"./chunk-dm1qh2vq.js";import"./chunk-ah9xyss2.js";import"./chunk-sv08pd66.js";import"./chunk-2943qhdt.js";import"./chunk-vkc51n9m.js";import"./chunk-02qaqamv.js";import"./chunk-6m3me7yj.js";import"./chunk-dhq80e4r.js";import"./chunk-vpdx7qr3.js";import"./chunk-dvc15djp.js";import"./chunk-x552npae.js";import"./chunk-qdyp2zqf.js";export{$t as buildCss,xc as extractClassNames,wc as fingerprintConfig,Sc as generateCss,td as getCachedCSS,Qu as getCssServeAsset,f as injectCss,si as loadCssEngine,oi as loadCssEngineConfig,pn as rebuildCss,ed as resetCssCache,vc as resolveUserCssConfig,nd as withLinkedModuleBundles};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{A,qc,As,o,P,ld,ud}from"./chunk-n4e02qdz.js";import"./chunk-dm1qh2vq.js";import"./chunk-ah9xyss2.js";import"./chunk-sv08pd66.js";import"./chunk-2943qhdt.js";import"./chunk-vkc51n9m.js";import"./chunk-02qaqamv.js";import"./chunk-6m3me7yj.js";import"./chunk-dhq80e4r.js";import"./chunk-vpdx7qr3.js";import"./chunk-dvc15djp.js";import"./chunk-x552npae.js";import"./chunk-qdyp2zqf.js";export{P as config,A as defaultConfig,ld as defineStxConfig,As as discoverConfig,o as loadStxConfig,qc as resolveStxDirectories,ud as validateConfig};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{It,C}from"./chunk-
|
|
2
|
+
import{It,C}from"./chunk-vkc51n9m.js";import m from"fs";import e from"path";async function yn(r,o,i){if(r.__stx_runtime_config)return;let n=It();if(n||i){r.__stx_runtime_config=n??C(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-2927nax9.js"),c=await f(t);if(c.runtimeConfig)r.__stx_runtime_config=C(c.runtimeConfig);return}let s=e.dirname(t);if(s===t)return;t=s}}async function Os(r,o){function i(n){if(n===null)return"null";if(Array.isArray(n))return`Array<${n.length?[...new Set(n.map(i))].join(" | "):"unknown"}>`;if(typeof n==="object")return`{ ${Object.entries(n).map(([t,s])=>`readonly ${JSON.stringify(t)}: ${i(s)}`).join("; ")} }`;return typeof n}await Bun.write(e.join(r,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
|
|
3
3
|
declare module '@stacksjs/stx/runtime-config' { interface PublicRuntimeConfig ${i(o.public??{})} }
|
|
4
4
|
`),await Bun.write(e.join(r,".stx/runtime-config-server.d.ts"),`import '@stacksjs/stx/runtime-config-server'
|
|
5
5
|
declare module '@stacksjs/stx/runtime-config-server' { interface PrivateRuntimeConfig ${i(o.private??{})} }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var c=0;function l(){return`suspense-${++c}-${Date.now().toString(36)}`}function
|
|
2
|
+
var c=0;function l(){return`suspense-${++c}-${Date.now().toString(36)}`}function nu(s,n={},t){let e=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return s.replace(e,(r,i,o,d)=>{let u=l(),a=p(i||"");return f(u,o.trim(),d.trim(),a)})}function p(s){let n={},t=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,e;while((e=t.exec(s))!==null){let r=e[1],i=e[2]||e[3],o=e[4];switch(r){case"id":n.id=i;break;case"timeout":n.timeout=o?parseInt(o,10):void 0;break}}return n}function f(s,n,t,e){let r=e.timeout||30000,i=e.id||s;return`
|
|
3
3
|
<div class="stx-suspense" data-suspense-id="${s}" data-custom-id="${i}" data-status="pending">
|
|
4
4
|
<div class="stx-suspense-fallback" data-suspense-fallback="${s}">
|
|
5
5
|
${t}
|
|
@@ -189,7 +189,7 @@ else {
|
|
|
189
189
|
}, 0);
|
|
190
190
|
})();
|
|
191
191
|
</script>
|
|
192
|
-
`}function
|
|
192
|
+
`}function ru(s,n,t){return{id:s,fallback:t,content:n}}async function su(s){let n=s.map((e)=>`
|
|
193
193
|
<div id="stx-ssr-suspense-${e.id}" class="stx-ssr-suspense">
|
|
194
194
|
${e.fallback}
|
|
195
195
|
</div>
|
|
@@ -214,7 +214,7 @@ else {
|
|
|
214
214
|
}
|
|
215
215
|
})();
|
|
216
216
|
</script>
|
|
217
|
-
`}}return{initial:n,streaming:t()}}function
|
|
217
|
+
`}}return{initial:n,streaming:t()}}function ou(){return`
|
|
218
218
|
/* STX Suspense Styles */
|
|
219
219
|
.stx-suspense {
|
|
220
220
|
position: relative;
|
|
@@ -270,7 +270,7 @@ else {
|
|
|
270
270
|
background-size: 200% 100%;
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
|
-
`}function
|
|
273
|
+
`}function iu(){return`
|
|
274
274
|
// STX Suspense Runtime
|
|
275
275
|
(function() {
|
|
276
276
|
if (typeof window === 'undefined') return;
|
|
@@ -338,4 +338,4 @@ else {
|
|
|
338
338
|
console.log('[stx] Suspense runtime initialized');
|
|
339
339
|
})();
|
|
340
340
|
`}
|
|
341
|
-
export{
|
|
341
|
+
export{nu,ru,su,ou,iu};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ne,Zt,gu}from"./chunk-wyn5rfzk.js";import{W,Qt,mu,en,Gr,zn,Hn,hu,yu,bu,tn,nn,Kr,Un,vu}from"./chunk-w6wtxj54.js";import"./chunk-dvc15djp.js";export{Gr as batch,gu as default,Qt as derived,en as effect,Ne as generateSignalsRuntime,Zt as generateSignalsRuntimeDev,nn as isDerived,tn as isSignal,mu as memo,Hn as onDestroy,zn as onMount,Un as peek,bu as pendingLifecycleCounts,yu as runDestroyCallbacks,hu as runMountCallbacks,W as state,Kr as untrack,vu as useOptimistic};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{qr,Wl,ql}from"./chunk-6fc8vw2v.js";import"./chunk-4pkpr5cg.js";import"./chunk-nh3svtvj.js";import"./chunk-ktyctev3.js";import"./chunk-n4e02qdz.js";import"./chunk-dm1qh2vq.js";import"./chunk-ah9xyss2.js";import"./chunk-sv08pd66.js";import"./chunk-2943qhdt.js";import"./chunk-vkc51n9m.js";import"./chunk-02qaqamv.js";import"./chunk-6m3me7yj.js";import"./chunk-dhq80e4r.js";import"./chunk-vpdx7qr3.js";import"./chunk-dvc15djp.js";import"./chunk-x552npae.js";import"./chunk-qdyp2zqf.js";export{ql as clearComposableCache,Wl as getComposableScript,qr as listComposableModules};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ao,Ua,Jt,Ul,Va,Wa,qa,Vl}from"./chunk-
|
|
2
|
+
import{Ao,Ua,Jt,Ul,Va,Wa,qa,Vl}from"./chunk-kfwmqacd.js";export{Jt as Validator,Ua as defineForm,Va as processErrorDirective,Wa as processErrorsDirective,Vl as processFormValidationDirectives,qa as processHasErrorsDirective,Ao as useForm,Ul as v};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{an,le}from"./chunk-ktyctev3.js";import{m,cn,w,Fe,o,P}from"./chunk-
|
|
2
|
+
import{an,le}from"./chunk-ktyctev3.js";import{m,cn,w,Fe,o,P}from"./chunk-n4e02qdz.js";import{rs}from"./chunk-nh3svtvj.js";import{s,Se}from"./chunk-3e3dpp7w.js";import{a}from"./chunk-00p22wzr.js";import h from"path";import v from"fs";import{AsyncLocalStorage as fe}from"async_hooks";var me=10;function J(e,n,r){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(h.basename(e))||rs(e,n,r)}var re=1,se=new Map,V=600,ge=100,W=new Map;async function he(e){let n=W.get(e)??0;if(n>0&&n<ge){W.set(e,n+1);return}W.set(e,1);try{let r=(await v.promises.readdir(e)).filter((c)=>c.endsWith(".js"));if(r.length<=V)return;let p=(await Promise.all(r.map(async(c)=>{try{return{name:c,at:(await v.promises.stat(h.join(e,c))).mtimeMs}}catch{return null}}))).filter((c)=>c!==null);p.sort((c,l)=>l.at-c.at);for(let c of p.slice(V)){let l=c.name.slice(0,-3);await v.promises.rm(h.join(e,`${l}.js`),{force:!0}),await v.promises.rm(h.join(e,`${l}.deps.json`),{force:!0})}D("pruned bundle cache to",V,"entries")}catch{}}function ce(e){return se.get(e)??[]}function X(e,n){if(e)se.set(e,n)}function rc(e=process.env){return e.STX_DEBUG==="true"||e.STX_DEBUG==="1"}function D(...e){if(rc())console.log("[stx:bundler]",...e)}var Z=[];function Jo(e,n,r){Z.push({filePath:e||"<inline>",message:n,details:r})}function bt(){return Z.slice()}function vt(){Z.length=0}var H;function ju(e){H=e}function Yo(){if(H)return H;try{let e=P.strict;return typeof e==="object"&&e!==null?e.bundlerFallback??"warn":"warn"}catch{return"warn"}}var q=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function wt(e){let n=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,r;while((r=n.exec(e))!==null){let p=r[1];if(!q.some((l)=>l.test(p)))return D("detected user import:",p),!0}let u=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((r=u.exec(e))!==null){let p=r[1];if(/\.css(?:\?.*)?$/.test(p))continue;if(!q.some((l)=>l.test(p)))return D("detected side-effect import:",p),!0}return!1}var on="stx-module:",xe=/\.(?:[cm]?[jt]sx?|json)$/i;function sc(e,n){return h.relative(e,n).split(h.sep).join("/")}function oc(e,n){if(n.size===0)return e;return e.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(r,u,p,c)=>{let l=n.get(c);return l&&!c.startsWith(on)?`${u}${p}${l}${p}`:r})}function ic(e,n){let r=0,u=(c)=>{let l=`__stxMod${r++}`,E=JSON.stringify(c);return n.push(`var ${l} = globalThis.__stxModules && globalThis.__stxModules[${E}];`,`if (${l} === undefined) throw new Error("[stx] module " + ${JSON.stringify(E)} + " is not registered on this page (#1957)");`),l},p=(c,l)=>{for(let E of c.split(",")){let _=E.trim();if(!_)continue;let j=_.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!j)continue;let d=j[1].startsWith('"')?JSON.parse(j[1]):j[1],t=j[2]??d;n.push(`var ${t} = ${l}[${JSON.stringify(d)}];`)}};return e=e.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(c,l,E)=>{let _=E.slice(on.length),j=u(_),d=l.trim(),t=d.match(/^([\w$]+)\s*(?:,\s*|$)/);if(t&&!d.startsWith("{")&&!d.startsWith("*"))n.push(`var ${t[1]} = ${j}.default;`),d=d.slice(t[0].length).trim();let i=d.match(/^\*\s*as\s+([\w$]+)$/);if(i)n.push(`var ${i[1]} = ${j};`);else if(d.startsWith("{"))p(d.replace(/^\{|\}$/g,""),j);return""}),e=e.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(c,l)=>(u(l.slice(on.length)),"")),e}function te(e){let n=[e,`${e}.ts`,`${e}.tsx`,`${e}.js`,`${e}.mjs`,`${e}.jsx`,h.join(e,"index.ts"),h.join(e,"index.tsx"),h.join(e,"index.js"),h.join(e,"index.mjs")];for(let r of n)try{if(v.existsSync(r)&&v.statSync(r,{throwIfNoEntry:!1})?.isFile())return r}catch{}return}var Y=new fe;function Qr(e,n){let r=new Bun.CryptoHasher("md5");for(let[u,p]of[...e].sort(([c],[l])=>c<l?-1:c>l?1:0))r.update(`${u}\x00${p}\x00`);return Y.run({modules:e,key:r.digest("hex").slice(0,12)},n)}function xt(){return Y.getStore()?.key??""}function $e(e,n,r,u,p,c=new Map,l,E){let _=(d,t,i)=>{if(J(t,e,l))return null;if(!p||d!==r||!xe.test(t))return null;try{if(!v.statSync(t,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}u.add(t);let x=`${on}${sc(process.cwd(),t)}`;return c.set(i,x),{path:x,external:!0}},j=(d,t)=>{let i=d===r?n:h.dirname(d),x=h.resolve(i,t);return te(x)??x};return{name:"stx-client-bundle",setup(d){if(d.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(t)=>({path:t.path,external:!0})),d.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(t)=>({path:t.path,external:!0})),d.onResolve({filter:/^\//},(t)=>{let i=te(t.path);if(i){let x=_(t.importer,i,t.path);if(x)return x;if(i!==r)u.add(i);return{path:i}}return{path:t.path,external:!0}}),d.onResolve({filter:/^\.\.?\//},(t)=>{let i=j(t.importer,t.path),x=_(t.importer,i,t.path);if(x)return x;return u.add(i),{path:i}}),d.onResolve({filter:/^[@~]\//},(t)=>{let i=h.resolve(e,t.path.slice(2)),x=[i,`${i}.ts`,`${i}.tsx`,`${i}.js`,`${i}.mjs`,`${i}.jsx`,h.join(i,"index.ts"),h.join(i,"index.tsx"),h.join(i,"index.js"),h.join(i,"index.mjs")];for(let F of x)if(v.existsSync(F)&&v.statSync(F,{throwIfNoEntry:!1})?.isFile()){let B=_(t.importer,F,t.path);if(B)return B;return D(`resolved ${t.path[0]}/ import:`,t.path,"\u2192",F),u.add(F),{path:F}}return console.warn(`[stx:bundler] could not resolve ${t.path[0]}/ import:`,t.path),{path:i}}),p)d.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(t)=>{if(t.importer!==r)return;let i=`${on}npm:${t.path}`;return c.set(t.path,i),{path:i,external:!0}});d.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(t)=>{if(J(t.path,e,l))throw Error(`Server-only API source cannot be imported by a client script: ${t.path}`);let i=h.extname(t.path).toLowerCase(),x=i===".json"?"json":i===".tsx"?"tsx":i===".jsx"?"jsx":i===".ts"||i===".mts"||i===".cts"?"ts":"js";if(t.path!==r)u.add(t.path);let F=E?.get(t.path);if(F!==void 0)return{contents:F,loader:"js"};return{contents:v.readFileSync(t.path,"utf8"),loader:x}})}}}var G=new Map,k=m(64),ne=Symbol.for("stx.client-bundle-build-queue");function ac(e){let n=globalThis,u=(n[ne]??Promise.resolve()).then(e,e);return n[ne]=u.then(()=>{return},()=>{return}),u}async function St(e,n,r={}){let u=r.projectRoot||process.cwd(),p=(await o(u)).serverApi,c=r.minify??!1,l=r.externalizeUserModules??!0,E=r.expose?.length?[...new Set(r.expose)].sort():void 0,_=r.cacheDir||a(u,"bundle-cache"),j=Y.getStore(),d=new Bun.CryptoHasher("md5");d.update(`${me}\x00${Fe()}\x00${JSON.stringify(p??!1)}\x00${l?"registry":"inline"}\x00${E?E.join(","):"*"}\x00${c?"minified":"readable"}\x00${j?.key??""}\x00${e}\x00${n}`);let t=d.digest("hex").slice(0,12),i=h.join(_,`${t}.js`),x=k.get(i);if(x){if(cn(x.files)&&x.files.every((M)=>!J(M.path,u,p))){D("memo hit:",t);let M=x.files.map((A)=>A.path);return X(n,M),r.collectInputs?.push(...M),x.code}k.delete(i),D("memo invalidated by dep change:",t)}let F=h.join(_,`${t}.deps.json`),B=Bun.file(i);if(await B.exists()){let M=Bun.file(F),A=!1,N=null;if(await M.exists())try{let I=JSON.parse(await M.text());if(I.metadataVersion!==re||!Array.isArray(I.files))A=!1;else N=I.files,A=!0;if(N&&(!cn(N)||N.some((g)=>J(g.path,u,p))))A=!1}catch{A=!1}if(A){if(D("cache hit:",t),N)X(n,N.map((g)=>g.path)),r.collectInputs?.push(...N.map((g)=>g.path));let I=await B.text();if(N)k.set(i,{code:I,files:N});return I}D("cache invalidated by dep change:",t)}let U=G.get(t);if(U){let M=await U;if(r.collectInputs)r.collectInputs.push(...(k.get(i)?.files??[]).map((A)=>A.path));return M}let L=ac(()=>be(e,n,{projectRoot:u,minify:c,cacheDir:_,hash:t,cachePath:i,depsPath:F,collectInputs:r.collectInputs,externalizeUserModules:l,serverApi:p,expose:E,throwOnFailure:r.throwOnFailure,substitutes:j?.modules}));G.set(t,L);try{return await L}finally{G.delete(t)}}var ye=0;function cc(e){return`${e}-${process.pid}-${++ye}`}async function be(e,n,r){let{projectRoot:u,minify:p,cacheDir:c,hash:l,cachePath:E,depsPath:_,externalizeUserModules:j}=r,d=a(u,"bundle-tmp"),t=cc(l),i=h.join(d,`${t}.ts`),x=h.join(d,"out",t);v.mkdirSync(d,{recursive:!0}),v.mkdirSync(x,{recursive:!0});let F=h.dirname(n),B=new Set,U=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,L=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,M=s(e),{depths:A,balanced:N}=Se(M),I=(S)=>!N||A[S]===0,g;while((g=U.exec(M))!==null){if(g[1])continue;if(!I(g.index))continue;if(g[2])g[2].split(",").forEach((S)=>{let f=we(S);if(f)B.add(f)});else if(g[3])B.add(g[3])}while((g=L.exec(M))!==null){if(g[1])continue;if(!I(g.index))continue;B.add(g[2])}let ie=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=ie.exec(M))!==null){if(!I(g.index))continue;let S=/^\s*['"]([^'"]+)['"]/.exec(e.slice(g.index+g[0].length))?.[1];if(S&&q.some((f)=>f.test(S)))continue;if(g[1])B.add(g[1]);if(g[2])B.add(g[2]);for(let f of(g[3]??"").split(",")){let b=f.trim();if(!b||/^type\s/.test(b))continue;let T=/\bas\s+(\w+)\s*$/.exec(b)?.[1]??/^\w+$/.exec(b)?.[0];if(T)B.add(T)}}for(let S of M.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let f of S[1].split(",")){let b=/\bas\s+(\w+)\s*$/.exec(f)?.[1]??/^\s*(\w+)\s*$/.exec(f)?.[1];if(b)B.delete(b)}let oe=B.size>0?`
|
|
3
3
|
export { ${[...B].join(", ")} }`:"";await Bun.write(i,e+oe),D("bundling:",l,"from:",h.basename(n));let Q=new Set,K=new Map;try{let S=await Bun.build({entrypoints:[i],outdir:x,target:"browser",format:"esm",minify:p?{whitespace:!1,identifiers:!0,syntax:!0}:!1,plugins:[$e(u,F,i,Q,j,K,r.serverApi,r.substitutes)],define:{"process.env.NODE_ENV":p?'"production"':'"development"',...w()},root:u});if(!S.success){let R=S.logs.filter((O)=>O.level==="error").map((O)=>O.message).join(", ")||`Unable to bundle ${h.basename(n)}`,C=an(S.logs,n||void 0);if(console.warn("[stx:bundler] build failed:",R),Jo(n||"",R,C),r.throwOnFailure||Yo()==="error")throw Error(R);return e}let f="";for(let y of S.outputs){f=await y.text();break}let b=[];for(let y of f.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let R of y[1].split(",")){let C=R.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(C){b.push([C[2],C[1]]);continue}let O=R.trim();if(/^[A-Za-z_$][\w$]*$/.test(O))b.push([O,O])}if(r.expose){let y=new Set(r.expose);for(let R=b.length-1;R>=0;R--)if(!y.has(b[R][0]))b.splice(R,1)}let T=[];f=ic(oc(f,K),T);let ae=f.match(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm)||[];if(f=f.replace(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),p&&f)try{f=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(f)}catch{}let ee=`__stxBundle_${l}`,ue=b.map(([y,R])=>`${JSON.stringify(y)}: ${R}`).join(", "),de=b.map(([y])=>`var ${y} = undefined;`).join(`
|
|
4
4
|
`),pe=b.map(([y])=>`${y} = ${ee}[${JSON.stringify(y)}];`).join(`
|
|
5
5
|
`);if(f=`${ae.join(`
|
|
@@ -12,4 +12,4 @@ ${f}
|
|
|
12
12
|
return { ${ue} };
|
|
13
13
|
})();
|
|
14
14
|
${pe}`.trim(),D("bundled:",l,"output:",f.length,"bytes"),B.size>0&&b.length===0)return console.warn(`[stx:bundler] dropped every binding for ${h.basename(n)} (${l}); serving the unbundled source and not caching this result`),e;v.mkdirSync(c,{recursive:!0}),await Bun.write(E,f);let z=Array.from(Q).map((y)=>{try{return{path:y,mtimeMs:v.statSync(y).mtimeMs}}catch{return null}}).filter((y)=>y!==null);return await Bun.write(_,JSON.stringify({metadataVersion:re,files:z})),X(n,z.map((y)=>y.path)),r.collectInputs?.push(...z.map((y)=>y.path)),k.set(E,{code:f,files:z}),await he(c),f}catch(S){let f=an(S,n||void 0),b=le(S,n||void 0);if(console.warn(`[stx:bundler] error: ${b}`),Jo(n||"",b,f),r.throwOnFailure||Yo()==="error")throw S;return e}finally{try{v.rmSync(i,{force:!0}),v.rmSync(x,{recursive:!0,force:!0})}catch{}}}function we(e){let n=e.trim();if(!n)return null;let r=n.indexOf("=");if(r!==-1)n=n.slice(0,r).trim();let u=n.indexOf(":");if(u!==-1)n=n.slice(u+1).trim();if(n.startsWith("..."))n=n.slice(3).trim();return/^[A-Za-z_$][\w$]*$/.test(n)?n:null}
|
|
15
|
-
export{ce,rc,Jo,bt,
|
|
15
|
+
export{ce,rc,Jo,bt,vt,ju,Yo,wt,on,sc,oc,ic,Qr,xt,ac,St,cc};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{R,k,Gt,Kt,Xt}from"./chunk-m8tm44rq.js";import{resolve as Q,basename as J,extname as K,join as Y}from"path";import{mkdir as Z}from"fs/promises";var N={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0};class
|
|
3
|
-
`)}async function
|
|
2
|
+
import{R,k,Gt,Kt,Xt}from"./chunk-m8tm44rq.js";import{resolve as Q,basename as J,extname as K,join as Y}from"path";import{mkdir as Z}from"fs/promises";var N={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0};class Br{config;constructor(t={}){this.config={...N,...t}}async get(t,e){return Gt(t,e,"video",this.config)}async set(t,e,a){return Kt(t,e,a,"video",this.config)}async clear(){return Xt("video",this.config)}updateConfig(t){this.config={...this.config,...t}}}var v=null;function B(t){if(!v)v=new Br(t);else if(t)v.updateConfig(t);return v}async function Fr(t,e,a){let c=a?{directory:`${a.outputDir}/../.cache`}:{};return B(c).get(t,e)}async function zr(t,e,a,c){let r=c?{directory:`${c.outputDir}/../.cache`}:{};return B(r).set(t,e,a)}async function Ea(){return B().clear()}import{resolve as _,basename as D,extname as A,join as H}from"path";import{mkdir as M}from"fs/promises";async function L(){try{return await import("ts-videos")}catch{return null}}async function Hr(t,e,a,c){let r=await L();if(!r)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let n=_(t);if(!await k(n))return null;await M(a,{recursive:!0});let i=await R(n),s=D(t,A(t)),o=e.format||"webp",h=e.timestamp||0,y=`${s}-poster-${i}.${o}`,u=H(a,y),m=await r.extractThumbnails(n,{timestamps:[h],width:e.width||1280,height:e.height,format:o,quality:e.quality||85,outputDir:a,outputPattern:y.replace(`.${o}`,"")});if(m&&m.length>0){let d=m[0];return{path:u,url:`${c}/${y}`,width:d.width||e.width||1280,height:d.height||720,timestamp:h,size:d.size||0}}return null}catch(n){return console.warn(`[stx-media] Failed to generate poster: ${n}`),null}}async function Ur(t,e,a,c){let r=await L();if(!r)return[];try{let n=_(t);if(!await k(n))return[];await M(a,{recursive:!0});let i=await R(n),s=D(t,A(t)),o=e.format||"webp",u=(await new r.Input(n).getInfo()).duration||60,m=e.count||10,d=e.interval||u/m,g=[];for(let f=0;f<m&&f*d<u;f++)g.push(f*d);let l=await r.extractThumbnails(n,{timestamps:g,width:e.width||320,format:o,quality:e.quality||80,outputDir:a,outputPattern:`${s}-thumb-${i}`});if(l&&l.length>0)return l.map((f,b)=>({path:f.path||H(a,`${s}-thumb-${i}-${b}.${o}`),url:`${c}/${s}-thumb-${i}-${b}.${o}`,width:f.width||e.width||320,height:f.height||180,timestamp:g[b],size:f.size||0}));return[]}catch(n){return console.warn(`[stx-media] Failed to generate thumbnails: ${n}`),[]}}async function Ta(t,e,a,c){let r=await L();if(!r)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let n=_(t);if(!await k(n))return null;await M(a,{recursive:!0});let i=await R(n),s=D(t,A(t)),y=(await new r.Input(n).getInfo()).duration||60,u=e.columns||10,m=e.interval||5,d=e.thumbnailWidth||160,g=e.thumbnailHeight||90,l=e.format||"jpeg",f=Math.ceil(y/m),b=Math.ceil(f/u),S=`${s}-sprite-${i}.${l}`,w=H(a,S),C=[];for(let P=0;P<f;P++)C.push(P*m);let p=await r.extractThumbnails(n,{timestamps:C,width:d,height:g,format:l,quality:e.quality||70,outputDir:H(a,".temp")});if(!p||p.length===0)return null;try{let P=await import("ts-images"),x=u*d,ie=b*g,re=await P.createSprite({images:p.map((U)=>U.path),columns:u,padding:0,outputPath:w,format:l,quality:e.quality||70});return{url:`${c}/${S}`,path:w,columns:u,rows:b,thumbnailWidth:d,thumbnailHeight:g,interval:m,totalFrames:f}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(n){return console.warn(`[stx-media] Failed to generate sprite sheet: ${n}`),null}}import{resolve as E,basename as F,extname as W,join as V}from"path";import{mkdir as T,writeFile as q}from"fs/promises";async function z(){try{return await import("ts-videos")}catch{return null}}var j=[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000},{label:"360p",width:640,height:360,bitrate:600000,audioBitrate:64000}];async function Vr(t,e,a,c,r){let n=await z();if(!n)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let i=E(t);if(!await k(i))return null;let s=await R(i),o=F(t,W(t)),h=V(a,`${o}-${s}-hls`);await T(h,{recursive:!0});let y=e.length>0?e:j,u=r?.segmentDuration||6,g=(await new n.Input(i).getInfo()).duration||0,l=[],f=0;for(let w of y){let C=V(h,w.label);await T(C,{recursive:!0});let p=`${w.label}.m3u8`,P=V(C,p);try{let x=await n.generateHLS(i,{outputDir:C,segmentDuration:u,width:w.width,height:w.height,videoBitrate:w.bitrate,audioBitrate:w.audioBitrate,playlistName:w.label});if(x)l.push({quality:w,url:`${c}/${o}-${s}-hls/${w.label}/${p}`,path:P}),f+=x.segmentCount||Math.ceil(g/u)}catch(x){console.warn(`[stx-media] Failed to generate HLS for ${w.label}: ${x}`)}}if(l.length===0)return null;let b=V(h,"master.m3u8"),S=X(l,c,o,s);return await q(b,S),{manifestUrl:`${c}/${o}-${s}-hls/master.m3u8`,manifestPath:b,playlists:l,segmentCount:f,duration:g}}catch(i){return console.warn(`[stx-media] Failed to generate HLS manifest: ${i}`),null}}function X(t,e,a,c){let r=["#EXTM3U","#EXT-X-VERSION:3"];for(let n of t){let{quality:i}=n,s=i.bitrate+(i.audioBitrate||128000),o=`${i.width}x${i.height||Math.round(i.width*9/16)}`;r.push(`#EXT-X-STREAM-INF:BANDWIDTH=${s},RESOLUTION=${o},NAME="${i.label}"`,`${i.label}/${i.label}.m3u8`)}return r.join(`
|
|
3
|
+
`)}async function Wr(t,e,a,c,r){let n=await z();if(!n)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let i=E(t);if(!await k(i))return null;let s=await R(i),o=F(t,W(t)),h=V(a,`${o}-${s}-dash`);await T(h,{recursive:!0});let y=e.length>0?e:j,u=r?.segmentDuration||4,m=r?.minBufferTime||2,l=(await new n.Input(i).getInfo()).duration||0,f=[],b=[];for(let p of y){let P=V(h,p.label);await T(P,{recursive:!0});try{if(await n.generateDASH(i,{outputDir:P,segmentDuration:u,width:p.width,height:p.height,videoBitrate:p.bitrate,audioBitrate:p.audioBitrate})){if(f.push({bandwidth:p.bitrate,width:p.width,height:p.height||Math.round(p.width*9/16),url:`${c}/${o}-${s}-dash/${p.label}/video`}),p.audioBitrate)b.push({bandwidth:p.audioBitrate,url:`${c}/${o}-${s}-dash/${p.label}/audio`})}}catch(x){console.warn(`[stx-media] Failed to generate DASH for ${p.label}: ${x}`)}}if(f.length===0)return null;let S=V(h,"manifest.mpd"),w=G(f,b,l,u,m);await q(S,w);let C=[{type:"video",representations:f}];if(b.length>0)C.push({type:"audio",representations:b});return{manifestUrl:`${c}/${o}-${s}-dash/manifest.mpd`,manifestPath:S,adaptationSets:C,duration:l}}catch(i){return console.warn(`[stx-media] Failed to generate DASH manifest: ${i}`),null}}function G(t,e,a,c,r){let n=I(a),i=I(r),s=`<?xml version="1.0" encoding="UTF-8"?>
|
|
4
4
|
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
|
|
5
5
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
6
6
|
xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
|
|
@@ -26,4 +26,4 @@ import{R,k,Gt,Kt,Xt}from"./chunk-m8tm44rq.js";import{resolve as Q,basename as J,
|
|
|
26
26
|
</Representation>
|
|
27
27
|
`}s+=` </AdaptationSet>
|
|
28
28
|
`}return s+=` </Period>
|
|
29
|
-
</MPD>`,s}function I(t){let e=Math.floor(t/3600),a=Math.floor(t%3600/60),c=Math.floor(t%60),r="PT";if(e>0)r+=`${e}H`;if(a>0)r+=`${a}M`;return r+=`${c}S`,r}async function O(){try{return await import("ts-videos")}catch{return null}}function ee(t){switch(t){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function te(t){switch(t){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function To(t){let e=await O();if(!e)return null;try{let a=Q(t),r=await new e.Input(a).getInfo();return{duration:r.duration||0,width:r.width||0,height:r.height||0,frameRate:r.frameRate||0,bitrate:r.bitrate||0,codec:r.videoCodec||"",audioCodec:r.audioCodec}}catch(a){return console.warn(`[stx-media] Failed to analyze video: ${a}`),null}}async function $a(t,e,a,c){let r=await O();if(!r)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:t,processed:!1};let n=await
|
|
29
|
+
</MPD>`,s}function I(t){let e=Math.floor(t/3600),a=Math.floor(t%3600/60),c=Math.floor(t%60),r="PT";if(e>0)r+=`${e}H`;if(a>0)r+=`${a}M`;return r+=`${c}S`,r}async function O(){try{return await import("ts-videos")}catch{return null}}function ee(t){switch(t){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function te(t){switch(t){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function To(t){let e=await O();if(!e)return null;try{let a=Q(t),r=await new e.Input(a).getInfo();return{duration:r.duration||0,width:r.width||0,height:r.height||0,frameRate:r.frameRate||0,bitrate:r.bitrate||0,codec:r.videoCodec||"",audioCodec:r.audioCodec}}catch(a){return console.warn(`[stx-media] Failed to analyze video: ${a}`),null}}async function $a(t,e,a,c){let r=await O();if(!r)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:t,processed:!1};let n=await Fr(t,e,a);if(n)return n;try{let i=Q(t);if(!await k(i))return{src:t,processed:!1,errors:[`Source file not found: ${t}`]};let s=a.outputDir||"dist/videos",o=a.baseUrl||"/videos";await Z(s,{recursive:!0});let h=await R(i),y=J(t,K(t)),u={src:t,processed:!0,hash:h};c?.({percentage:5,stage:"analyzing"}),u.metadata=await To(i)||void 0;let m={};if(e.quality)m.bitrate=ee(e.quality);if(e.platform)Object.assign(m,te(e.platform));if(e.transcode)Object.assign(m,e.transcode);if(Object.keys(m).length>0||e.process){c?.({percentage:10,stage:"transcoding"});let d=`${y}-${h}.mp4`,g=Y(s,d);try{let l=await ae(i,g,m,r,(f)=>c?.({percentage:10+f*0.5,stage:"transcoding"}));if(l)u.transcoded={path:g,url:`${o}/${d}`,duration:l.duration,size:l.size,video:{codec:m.codec||"h264",width:l.width,height:l.height,bitrate:l.bitrate,frameRate:l.frameRate},audio:l.audioCodec?{codec:m.audioCodec||"aac",bitrate:m.audioBitrate||128000,sampleRate:m.sampleRate||48000,channels:m.channels||2}:void 0}}catch(l){u.errors=u.errors||[],u.errors.push(`Transcoding failed: ${l}`)}}if(e.generatePoster){c?.({percentage:65,stage:"generating-poster"});let d=typeof e.generatePoster==="object"?e.generatePoster:{timestamp:0},g=await Hr(i,d,s,o);if(g)u.poster=g}if(a.thumbnails?.enabled){c?.({percentage:70,stage:"generating-thumbnails"});let d=await Ur(i,a.thumbnails,s,o);if(d.length>0)u.thumbnails=d}if(e.streaming){c?.({percentage:80,stage:"generating-manifests"});let d=typeof e.streaming==="object"?e.streaming:a.streaming||{format:"hls"};if(d.format==="hls"||d.format===void 0){let g=await Vr(i,d.qualities||a.streaming?.defaultQualities||[],s,o);if(g)u.streaming={...u.streaming,hls:g}}if(d.format==="dash"){let g=await Wr(i,d.qualities||a.streaming?.defaultQualities||[],s,o);if(g)u.streaming={...u.streaming,dash:g}}}if(e.spriteSheet)c?.({percentage:90,stage:"generating-sprite-sheet"});return c?.({percentage:100,stage:"complete"}),await zr(t,e,u,a),u}catch(i){return{src:t,processed:!1,errors:[`Processing failed: ${i}`]}}}async function ae(t,e,a,c,r){try{let i=await new c.Conversion(t,e,{videoCodec:a.codec,videoBitrate:a.bitrate,width:a.maxWidth,height:a.maxHeight,frameRate:a.frameRate,audioCodec:a.audioCodec,audioBitrate:a.audioBitrate,sampleRate:a.sampleRate,channels:a.channels}).run((s)=>{r?.(s.percentage/100)});return{duration:i.duration||0,size:i.size||0,width:i.width||a.maxWidth||0,height:i.height||a.maxHeight||0,bitrate:i.bitrate||a.bitrate||0,frameRate:i.frameRate||a.frameRate||30,audioCodec:i.audioCodec}}catch(n){return console.error(`[stx-media] Transcoding failed: ${n}`),null}}export{Br,Fr,zr,Ea,Hr,Ur,Ta,Vr,Wr,To,$a};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{qn,Be,be,ve,ii,Yn,te,J,gn,u,n,A}from"./chunk-n4e02qdz.js";function h(o){return o.endsWith(".md")||o.endsWith(".markdown")}function _(o){let e=[];g(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];g(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function g(s,p){let m;while((m=s.exec(o))!==null){let t=m.index,i=t+m[0].length;if(p?.some((l)=>t>=l.start&&i<=l.end))continue;e.push({start:t,end:i})}}if(e.length===0)return o;e.sort((s,p)=>s.start-p.start);let a="",c=0;for(let s of e){if(s.start<c)continue;a+=o.slice(c,s.start),a+=`@raw${o.slice(s.start,s.end)}@endraw`,c=s.end}return a+=o.slice(c),a}async function b(o,e={}){let{data:r,content:g}=qn(o),c=await(e.renderer??((s)=>Be(s)))(g);return{html:_(c),frontmatter:r??{}}}import{dirname as C,resolve as R}from"path";function k(o){let e=o,r=te(o);if(r)e=r.content.trim();let g=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,a=[],c=[],s=[],p=(i)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(i),m;while((m=g.exec(o))!==null){let i=m[1],l=m[2],f=m[0],d=i.includes("server");if(p(l))s.push(f);else if(d)c.push(l);else a.push(f)}let t=e;{let i=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,f=[];while((l=i.exec(t))!==null){let d=l.index+l[0].length,x=t.indexOf("</script>",d);if(x===-1)continue;f.push({start:l.index,end:x+9}),i.lastIndex=x+9}for(let d=f.length-1;d>=0;d--)t=t.substring(0,f[d].start)+t.substring(f[d].end)}for(let i of a)t=t.replace(i,"");return{templateContent:t,serverScripts:c,clientScripts:a,signalsScripts:s}}function v(o,e){return`<!DOCTYPE html>
|
|
3
|
+
<html lang="en">
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
<title>${(e||"stx").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
${o}
|
|
11
|
+
</body>
|
|
12
|
+
</html>`}async function zo(o,e={}){let r=R(o),g=Bun.file(r);if(!await g.exists())throw Error(`Template file not found: ${r}`);let a=await g.text(),c=null;if(h(r)){let s=await b(a,{renderer:e.markdownRenderer});a=s.html,c=s.frontmatter}if(c)e={...e,context:{...c,...e.context||{}}};if(e.layout){let s=R(e.layout),p=Bun.file(s);if(!await p.exists())throw Error(`Layout template not found: ${s}`);let{layout:m,injectCSS:t,...i}=e,l={...e.context||{}};gn(l);let f=await S(a,r,{...i,context:{...l,__stx_defer_server_data:!0},injectCSS:!1}),d=await p.text(),x={...l,content:f},w={...i,context:x,injectCSS:t};return S(d,s,w)}return S(a,r,e)}async function S(o,e,r={}){let{templateContent:g,serverScripts:a,clientScripts:c}=k(o),s={...A,...r.options},p={__filename:e,__dirname:C(e),__stx:{},__stx_options:s,__stx_sfc_mode:!0,__stx_inject_css:r.injectCSS===!0,__stxServeContext:void 0,...Yn(r.context??{}),definePageMeta:()=>{},...r.context||{}};for(let i of a)await u(i,p,e);let m=new Set,t=g;if(t=await n(t,p,e,s,m),ii(p,r.context),r.templateOnly){if(t=t.replace(/<script data-stx-scoped>[\s\S]*?<\/script>\s*/gi,""),t=t.replace(/<!-- stx SEO Tags -->[\s\S]*?(?=<)/i,""),c.length>0)t+=`
|
|
13
|
+
${c.join(`
|
|
14
|
+
`)}`}else{if(r.processClientScripts!==!1&&c.length>0){let i=p.__stx_event_bindings||[],l=be(p),d=(await Promise.all(c.map(async(w)=>{let y=w.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!y)return w;return await ve(y[1],{eventBindings:i,templateContent:t,serverData:l,filePath:e})}))).join(`
|
|
15
|
+
`);if(t.match(/(<\/body>)/i))t=t.replace(/(<\/body>)/i,`${d}
|
|
16
|
+
$1`);else t+=`
|
|
17
|
+
${d}`}t=await J(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=v(t,r.title)}if(r.injectCSS)try{let{injectCss:i}=await import("./chunk-0fx3ppnt.js");t=await i(t)}catch{}return t}
|
|
18
|
+
export{zo};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{fn,Cc,hs}from"./chunk-n4e02qdz.js";import"./chunk-dm1qh2vq.js";import"./chunk-ah9xyss2.js";import"./chunk-sv08pd66.js";import"./chunk-2943qhdt.js";import"./chunk-vkc51n9m.js";import"./chunk-02qaqamv.js";import"./chunk-6m3me7yj.js";import{_e}from"./chunk-dhq80e4r.js";import"./chunk-vpdx7qr3.js";import"./chunk-dvc15djp.js";import"./chunk-x552npae.js";import"./chunk-qdyp2zqf.js";export{_e as freeIdentifiers,hs as processComponents,Cc as processESImports,fn as rendersAsElement};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{y}from"./chunk-
|
|
2
|
+
import{y}from"./chunk-dvc15djp.js";import{O,Mt}from"./chunk-vpdx7qr3.js";import{Ct,m,h,w,qe,j,o}from"./chunk-n4e02qdz.js";import{ce,wt,xt,St}from"./chunk-4pkpr5cg.js";import{Me,Yt,mt,V}from"./chunk-2rx9d75e.js";import{E,Tn}from"./chunk-5db5sxy3.js";import S from"path";var C=new Map,D=new Map,k=m(64),A=new Map,Z=["composables","functions"];function G(t){let n=S.basename(t,".ts");return n==="index"||n==="types"||t.endsWith(".d.ts")}async function q(t){if(t)return S.resolve(t);let n=`<default>:${process.cwd()}`,a=A.get(n);if(a!==void 0)return a;let e=await Q();if(e!==null)A.set(n,e);return e}async function Q(){let t=await o(),n=t.root||process.cwd(),a=t.composablesDir;if(a)return S.resolve(n,a);for(let e of Z){let s=S.resolve(n,e);try{let d=new Bun.Glob("**/*.ts");for await(let c of d.scan({cwd:s,absolute:!0}))if(!G(c))return s}catch{}}return null}async function J(t){let n=Array.isArray(t)?t:t?[S.resolve(t)]:(await o())._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=S.relative(e,d);if(!G(d)&&!a.has(c))a.set(c,d)}}catch{}}return{key:n.join("\x00"),files:[...a.values()].sort()}}async function qr(t){let{files:n}=await J(t),a=j({loader:"ts",target:"browser",define:w()}),e=[];for(let s of n)try{let d=await Bun.file(s).text(),c=a.scan(d).exports.filter((p)=>p!=="default");if(c.length>0)e.push({file:s,names:c})}catch{}return e}function Y(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):Y(t,s))e.add(s);return e}var z=m(64);function ee(t,n){let a=h(t,n.size),e=z.get(a);if(e)return e;let s;try{s=Ct(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 p of c[1].split(",")){let g=p.trim().split(/\s*(?::|\u0008as\u0008)\s*/)[0];if(g&&n.has(g))s.add(g)}return z.set(a,s),s}function te(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 ee(u,d))l.push(e.get(f));return l},p=new Set,g=a.flatMap((u,l)=>l===0?s(u):c(u));while(g.length>0){let u=[];for(let l of g){if(p.has(l))continue;p.add(l);for(let f of c(n.get(l)??""))if(!p.has(f))u.push(f)}g=u}return p}async function Wl(t,n,a){let{key:e,files:s}=await J(t);if(!e)return null;let d=()=>[...new Set([...s,...s.flatMap((r)=>ce(r))])],c=Me(d());if(s.length===0)return V(C,e,c,""),null;s.sort();let p=j({loader:"ts",target:"browser",define:w()}),g=mt(D,e,c);if(!g){let r=new Map,i=[];for(let _ of s)try{let x=await Bun.file(_).text();r.set(_,x);let b=p.scan(x).exports.filter((X)=>X!=="default");if(b.length>0)i.push({file:_,names:b})}catch{r.set(_,"")}g=V(D,e,c,{codeByFile:r,modules:i})}let{codeByFile:u,modules:l}=g,f;if(n===void 0)f=new Set(s);else{let r=a?[n,...a]:[n],i=h(r.join("\x00"),e,r.length,c),_=k.get(i);if(f=_??te(l,u,r),!_)k.set(i,f)}if(f.size===0)return null;let I=s.filter((r)=>f.has(r)),B=`${e}\x00${I.join("\x00")}\x00${xt()}`,F=mt(C,B,c);if(F!==void 0)return F||null;let M=[],v=new Set,R=new Set;for(let r of I)try{let i=u.get(r)??await Bun.file(r).text(),_=S.basename(r,".ts");for(let b of i.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(b[1])R.add(b[1]);let x=[];try{for(let b of p.scan(i).exports)if(b!=="default")v.add(b),x.push(b)}catch{}if(i=O(i),wt(i))i=await St(i,r,{projectRoot:process.cwd(),externalizeUserModules:!1,expose:x}),i=qe(i);i=Mt(i),i=i.replace(/^export\s+(default\s+)?/gm,""),i=p.transformSync(i),M.push(`// Composable: ${_}
|
|
3
3
|
${i.trim()}`)}catch(i){console.warn(`[stx] Failed to load composable ${r}:`,i)}if(M.length===0||v.size===0)return V(C,B,c,""),null;let H=[...v].map((r)=>` try { if (!(${JSON.stringify(r)} in __c)) __c[${JSON.stringify(r)}] = ${r}; } catch (e) {}`).join(`
|
|
4
4
|
`),P=JSON.stringify([...v]),N=M.join(`
|
|
5
5
|
|
|
@@ -30,4 +30,4 @@ ${H}
|
|
|
30
30
|
__published[__n] = true;
|
|
31
31
|
}
|
|
32
32
|
})();`,U=E()?Tn(T):T;return c=Me(d()),V(C,B,c,U),U}function ql(){C.clear(),Yt(),D.clear(),k.clear(),A.clear()}
|
|
33
|
-
export{
|
|
33
|
+
export{qr,Wl,ql};
|