@stacksjs/stx 0.2.245 → 0.2.247
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-w3pzxz3m.js → chunk-009z775h.js} +1 -1
- package/dist/chunk-074bfahy.js +2 -0
- package/dist/{chunk-092sm06a.js → chunk-0athjw48.js} +2 -2
- package/dist/{chunk-d19bydks.js → chunk-0j9hrzjj.js} +1 -1
- package/dist/{chunk-2qkasmq1.js → chunk-0pdrnxg2.js} +2 -2
- package/dist/{chunk-19m7hed6.js → chunk-135mme4g.js} +1 -1
- package/dist/{chunk-2nqtzhgw.js → chunk-1e0kazb9.js} +2 -2
- package/dist/chunk-1vd6bg7v.js +2 -0
- package/dist/{chunk-p7a8mgns.js → chunk-21195t36.js} +1 -1
- package/dist/chunk-2rktp0wn.js +2 -0
- package/dist/chunk-33r05vv1.js +2 -0
- package/dist/{chunk-a8fx6wcb.js → chunk-3gjrq8m7.js} +1 -1
- package/dist/chunk-3mm46ez1.js +2 -0
- package/dist/{chunk-by3zs4ag.js → chunk-3p4txpk9.js} +1 -1
- package/dist/chunk-47ffrbhv.js +2 -0
- package/dist/{chunk-tv4n71jy.js → chunk-49kk0s96.js} +2 -2
- package/dist/{chunk-jqkg6w3p.js → chunk-4fybwpba.js} +2 -2
- package/dist/{chunk-98pkw4t1.js → chunk-4zezcn44.js} +1 -1
- package/dist/{chunk-dq88kv1p.js → chunk-54st8g2j.js} +1 -1
- package/dist/{chunk-frp9fc7j.js → chunk-58f0mthg.js} +1 -1
- package/dist/{chunk-z2gmz9ew.js → chunk-5ec3m8hk.js} +2 -2
- package/dist/{chunk-xddvx94h.js → chunk-5fw9ne30.js} +1 -1
- package/dist/{chunk-0kq46rxg.js → chunk-6kqq7pj3.js} +1 -1
- package/dist/{chunk-2d13x7hs.js → chunk-6nxf4pb0.js} +2 -2
- package/dist/{chunk-9228drk4.js → chunk-6twytnbh.js} +2 -2
- package/dist/{chunk-v0tmvq31.js → chunk-6vkcpz56.js} +1 -1
- package/dist/{chunk-j93x5fzs.js → chunk-74cv4ta1.js} +1 -1
- package/dist/{chunk-g553n48p.js → chunk-7bemc914.js} +2 -2
- package/dist/chunk-7hvr3r5k.js +2 -0
- package/dist/{chunk-fvjh7rx0.js → chunk-7q9mwh4v.js} +1 -1
- package/dist/chunk-7w2sevn5.js +2 -0
- package/dist/{chunk-d35mdkw8.js → chunk-8rtvsq49.js} +2 -2
- package/dist/{chunk-1p0r6k2f.js → chunk-91e3916g.js} +2 -2
- package/dist/{chunk-7djq40jk.js → chunk-99nrwh5w.js} +1 -1
- package/dist/chunk-9cqtcms8.js +2 -0
- package/dist/{chunk-qv3g8tde.js → chunk-9dvrqa2p.js} +1 -1
- package/dist/{chunk-hess6q86.js → chunk-9fkxb5wr.js} +2 -2
- package/dist/{chunk-ht51fz7w.js → chunk-9n0gvfrg.js} +1 -1
- package/dist/{chunk-20q757q9.js → chunk-9rc4cbh6.js} +1 -1
- package/dist/{chunk-ssfhndm6.js → chunk-9y0g8kzt.js} +1 -1
- package/dist/chunk-a91134vp.js +2 -0
- package/dist/{chunk-0s88j6n8.js → chunk-absrtcb0.js} +1 -1
- package/dist/{chunk-n07dds2d.js → chunk-apnp72a6.js} +1 -1
- package/dist/{chunk-cda7v05f.js → chunk-ay8kxhkr.js} +1 -1
- package/dist/chunk-b24yrmwm.js +2 -0
- package/dist/{chunk-sdfe1xce.js → chunk-b6ft3095.js} +1 -1
- package/dist/{chunk-qbc0adqw.js → chunk-bmfnxh4y.js} +3 -3
- package/dist/chunk-brbyqv80.js +2 -0
- package/dist/{chunk-2p5qa9pm.js → chunk-c1s7r715.js} +1 -1
- package/dist/{chunk-b6zt4aqb.js → chunk-c4q2wjza.js} +2 -2
- package/dist/{chunk-xj05xmfg.js → chunk-cqzv09x3.js} +1 -1
- package/dist/chunk-cwrc4qbr.js +2 -0
- package/dist/chunk-d1ezh03e.js +2 -0
- package/dist/{chunk-r84h7wxw.js → chunk-d8y85xdy.js} +1 -1
- package/dist/{chunk-shh4byc3.js → chunk-dgg8a6c8.js} +2 -2
- package/dist/{chunk-ajjwrrmz.js → chunk-dwz2rtwg.js} +1 -1
- package/dist/{chunk-m2w91jne.js → chunk-e2nzn35y.js} +2 -2
- package/dist/{chunk-adj1k3w7.js → chunk-edgvm2rh.js} +1 -1
- package/dist/{chunk-mv2v3g62.js → chunk-f1jd5qjb.js} +1 -1
- package/dist/{chunk-nhn7qftp.js → chunk-f3m0q482.js} +1 -1
- package/dist/{chunk-z4f3gahw.js → chunk-f3wy3jcm.js} +2 -2
- package/dist/{chunk-cs1dc1n7.js → chunk-f5v2qf95.js} +1 -1
- package/dist/{chunk-ax56kn66.js → chunk-fa3pamx8.js} +1 -1
- package/dist/{chunk-fzxjrdnv.js → chunk-fvh9ca47.js} +1 -1
- package/dist/{chunk-b212gjes.js → chunk-gh1vsaa0.js} +2 -2
- package/dist/{chunk-78bpc81t.js → chunk-gpmpcrww.js} +1 -1
- package/dist/chunk-gynahdrf.js +2 -0
- package/dist/{chunk-jwchwn52.js → chunk-h7aynn48.js} +22 -22
- package/dist/{chunk-kaet6r9w.js → chunk-hpybjwwf.js} +1 -1
- package/dist/chunk-j1hwqjv0.js +2 -0
- package/dist/{chunk-1px4xey5.js → chunk-j26v67km.js} +1 -1
- package/dist/chunk-jbjg92a7.js +2 -0
- package/dist/chunk-jej85smh.js +2 -0
- package/dist/chunk-jg1xxdkj.js +2 -0
- package/dist/chunk-kq6nvsph.js +2 -0
- package/dist/chunk-krjh0z9y.js +2 -0
- package/dist/chunk-kv3yrscv.js +2 -0
- package/dist/{chunk-x41v697c.js → chunk-mh4hd2wt.js} +1 -1
- package/dist/{chunk-c9843bnq.js → chunk-mrqzybb8.js} +1 -1
- package/dist/{chunk-q9vxc3gc.js → chunk-nza4qk68.js} +1 -1
- package/dist/chunk-nzkcjb7m.js +2 -0
- package/dist/{chunk-qs0fp63n.js → chunk-p3kn55v4.js} +1 -1
- package/dist/{chunk-vzskgbqj.js → chunk-pbsfbgx7.js} +1 -1
- package/dist/{chunk-vcreetnm.js → chunk-q79583xa.js} +1 -1
- package/dist/{chunk-33pdtz6a.js → chunk-q973vd0p.js} +33 -33
- package/dist/chunk-qg0czr2c.js +2 -0
- package/dist/chunk-qh4bhceg.js +2 -0
- package/dist/{chunk-1md5q98r.js → chunk-qhcwqxsr.js} +2 -2
- package/dist/{chunk-wjahpknc.js → chunk-r1p9hha3.js} +2 -2
- package/dist/{chunk-6z1re4a4.js → chunk-r2nc9hm9.js} +2 -2
- package/dist/{chunk-b6jhznkh.js → chunk-refwkt87.js} +1 -1
- package/dist/chunk-rkhqmedy.js +2 -0
- package/dist/{chunk-c0apssp7.js → chunk-rs83cc1j.js} +1 -1
- package/dist/{chunk-fnty12j5.js → chunk-s2nw5t7p.js} +1 -1
- package/dist/{chunk-7qyz242h.js → chunk-s31j8ztb.js} +2 -2
- package/dist/{chunk-pxzj5tzb.js → chunk-sbsq0jvn.js} +1 -1
- package/dist/{chunk-k26kt6fp.js → chunk-snh1ahqp.js} +1 -1
- package/dist/chunk-t2kftwse.js +2 -0
- package/dist/{chunk-94fee5jw.js → chunk-t6nseeb9.js} +1 -1
- package/dist/{chunk-n3tj3h1q.js → chunk-temdqamx.js} +2 -2
- package/dist/{chunk-m8h6km5v.js → chunk-tzmqq1db.js} +1 -1
- package/dist/{chunk-qtmearwp.js → chunk-v0y3drpw.js} +3 -3
- package/dist/chunk-v8fs3aa7.js +2 -0
- package/dist/{chunk-595kj4n2.js → chunk-vhnnryps.js} +2 -2
- package/dist/{chunk-6mk7fd7v.js → chunk-w3pxkhqm.js} +1 -1
- package/dist/{chunk-0zdy4dpp.js → chunk-w3ttnn6k.js} +117 -117
- package/dist/{chunk-rbke5wqk.js → chunk-w3ycm4na.js} +1 -1
- package/dist/{chunk-4mnmm48x.js → chunk-w8cdwh41.js} +2 -2
- package/dist/{chunk-nhmq45hh.js → chunk-w95sp0k9.js} +1 -1
- package/dist/{chunk-ntnv2f7a.js → chunk-wcm80anz.js} +1 -1
- package/dist/chunk-wnrb5sn6.js +2 -0
- package/dist/chunk-wxm4g8c7.js +2 -0
- package/dist/chunk-x1r9c2hz.js +2 -0
- package/dist/{chunk-bn0td54v.js → chunk-x75qeb7x.js} +1 -1
- package/dist/{chunk-pv9at6r1.js → chunk-xttsqmkm.js} +1 -1
- package/dist/{chunk-1gdzz04h.js → chunk-y7m2dpd3.js} +1 -1
- package/dist/chunk-ycjzgz5v.js +2 -0
- package/dist/chunk-ykqv73eh.js +2 -0
- package/dist/{chunk-jy6madxa.js → chunk-ym3r8ktq.js} +1 -1
- package/dist/{chunk-1gaetkpx.js → chunk-z1yd16w1.js} +2 -2
- package/dist/{chunk-nzser3gj.js → chunk-zh74fq7v.js} +2 -2
- package/dist/chunk-zqxk361v.js +2 -0
- package/dist/chunk-zt8e98fj.js +2 -0
- package/dist/cli.js +14 -14
- package/dist/component-library.d.ts +32 -0
- package/dist/component-library.js +38 -2
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/database.js +1 -1
- package/dist/pwa.js +2 -2
- package/dist/ssg.js +2 -2
- package/dist/visual-testing.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-02btxy6j.js +0 -2
- package/dist/chunk-0hatcb1t.js +0 -2
- package/dist/chunk-15w5gfwe.js +0 -2
- package/dist/chunk-404eam50.js +0 -2
- package/dist/chunk-47be2t3d.js +0 -2
- package/dist/chunk-4j8crbk6.js +0 -2
- package/dist/chunk-56rabpsq.js +0 -2
- package/dist/chunk-5a6dzmj8.js +0 -2
- package/dist/chunk-6qtx7w2r.js +0 -2
- package/dist/chunk-6rfc8exk.js +0 -2
- package/dist/chunk-8g7xy48w.js +0 -2
- package/dist/chunk-8vgcye5c.js +0 -2
- package/dist/chunk-8x4h673x.js +0 -2
- package/dist/chunk-8yn96bkr.js +0 -2
- package/dist/chunk-9k5symz8.js +0 -2
- package/dist/chunk-bx4nptd2.js +0 -2
- package/dist/chunk-cj3zqzd0.js +0 -2
- package/dist/chunk-djct09qx.js +0 -2
- package/dist/chunk-e03bh9ze.js +0 -2
- package/dist/chunk-eyfmvy7z.js +0 -2
- package/dist/chunk-f13qa3kb.js +0 -2
- package/dist/chunk-fad3d1g7.js +0 -2
- package/dist/chunk-fbhhzy5j.js +0 -2
- package/dist/chunk-gcf0z2j8.js +0 -2
- package/dist/chunk-kf8edvxc.js +0 -2
- package/dist/chunk-kq9abgx2.js +0 -2
- package/dist/chunk-myqyr2dp.js +0 -2
- package/dist/chunk-np6b30jn.js +0 -2
- package/dist/chunk-p6gb0bak.js +0 -2
- package/dist/chunk-przv5z6z.js +0 -2
- package/dist/chunk-qaj72jrj.js +0 -2
- package/dist/chunk-r2zcdk2f.js +0 -2
- package/dist/chunk-rg1g3xjx.js +0 -2
- package/dist/chunk-s0b1p8tc.js +0 -2
- package/dist/chunk-v8mxhfp7.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Ks as _}from"./chunk-f1jd5qjb.js";import"./chunk-p3kn55v4.js";function W(j,G,H=240){return j.slice(G,G+H)}var v=[{rule:"route-params",pattern:/\blocation\s*\.\s*pathname\s*\.\s*(?:match|split)\s*\(/g,primitive:"useRoute() / useRouteParams() / useRouteParam(name)",why:"parsing the URL by hand re-implements the router and does not update on SPA navigation"},{rule:"alert",pattern:/(?<![.#\w$])(?:(?:window|globalThis)\s*\.\s*)?alert\s*\(/g,primitive:"stxAlert(message)",why:"themed, focus-trapped and non-blocking \u2014 but `await` it if the code after it "+"depended on the native dialog blocking until dismissal",reject:(j)=>/\b(?:async\s+)?function\s+alert\s*\(/.test(j)||/\b(?:const|let|var)\s+alert\s*=/.test(j)},{rule:"search-params",pattern:/new\s+URLSearchParams\s*\(/g,primitive:"useSearchParams()",why:"reactive, and writes back through the router instead of history.replaceState",reject:(j,G)=>{let H=j.indexOf("(",G);if(H===-1)return!0;let Q=j.slice(H+1,j.indexOf(")",H)+1);return!/\b(?:location|search|href|url)\b/i.test(Q)}},{rule:"navigate",pattern:/\blocation\s*\.\s*(?:assign|replace)\s*\(|\blocation\s*\.\s*href\s*=/g,primitive:"navigate(path) / goBack()",why:"a full document load throws away every store and the scroll position; navigate() is an SPA transition",reject:(j,G)=>/^[^\n]*?(?:['"`]\s*)?(?:mailto:|tel:|sms:|https?:\/\/|\/\/)/.test(W(j,G,160))},{rule:"fetch",pattern:/new\s+AbortController\s*\(/g,primitive:"useFetch(url) / useAsyncData(key, fn)",why:"cancellation, loading and error state are already wired; hand-rolling them is where the races live"},{rule:"polling",pattern:/setInterval\s*\(/g,primitive:"useEventSource() / useSSE() / useWebSocket() / useChannel()",why:"polling burns requests and lags; the push primitives are delivered",reject:(j,G)=>!/\bfetch\s*\(|\$fetch\b|useFetch\b|\.get\s*\(|axios\b/.test(W(j,G))},{rule:"debounce",pattern:/\bclearTimeout\s*\(/g,primitive:"useDebounce(fn, ms) / useThrottle(fn, ms)",why:"a hand-held timer handle per call site is the usual source of stale-result bugs",requires:(j)=>/setTimeout\s*\(/.test(j)},{rule:"click-outside",pattern:/document\s*\.\s*addEventListener\s*\(\s*['"](?:click|mousedown|pointerdown)['"]/g,primitive:"useClickOutside(ref, fn)",why:"the document-level listener plus the blur race is exactly what this composable exists to remove"},{rule:"focus",pattern:/\.\s*(?:getElementById|querySelector)\s*\([^)]*\)\s*(?:\?\.)?\s*\.?focus\s*\(/g,primitive:"useFocus(ref) with x-ref",why:"a query by id breaks under nested scopes and SPA navigation; a ref does not"},{rule:"clipboard",pattern:/navigator\s*\.\s*(?:clipboard|share)\b/g,primitive:"useClipboard() / useShare()",why:"permission state, the copied flag and the unsupported-browser fallback are already handled"},{rule:"watch",pattern:/\beffect\s*\(\s*\(\s*\)\s*=>\s*\{[^}]*\bvoid\s+\w+\s*\(\s*\)/g,primitive:"watch(source, cb) / watchMultiple([...], cb)",why:"the `void a(); void b()` dance is a manual dependency list; watch takes one directly"}],U=["confirm","tooltip",...v.map((j)=>j.rule)];function N(j,G){let H=1;for(let Q=0;Q<G;Q++)if(j[Q]===`
|
|
3
3
|
`)H++;return H}function P(j,G){let H=j.lastIndexOf(`
|
|
4
4
|
`,G)+1,Q=j.indexOf(`
|
|
5
5
|
`,G);return j.slice(H,Q===-1?j.length:Q).trim().slice(0,120)}function q(j,G){let H=j.slice(0,G),Q=H.lastIndexOf("function"),X=H.lastIndexOf("=>"),M=Math.max(Q,X);if(M===-1)return!1;let z=j.slice(Math.max(0,M-120),M);return/\basync\b[^;{}]*$/.test(z)}function L(j){return/\b(?:async\s+)?function\s+confirm\s*\(/.test(j)||/\b(?:const|let|var)\s+confirm\s*=/.test(j)||/\bimport\s*\{[^}]*\bconfirm\b[^}]*\}/.test(j)}function O(j,G,H){if(L(j))return j;let Q=/(^|[^\w$.])(?:(?:window|globalThis)\s*\.\s*)?confirm\s*\(/g,X=F(j),M="",z=0,Y;while((Y=Q.exec(X))!==null){let Z=Y.index+Y[1].length,$=N(j,Z),J=P(j,Z);if(/stxConfirm\s*\($/.test(j.slice(0,Z+8)))continue;let D=q(j,Z);if(H.push({file:G,line:$,rule:"confirm",applied:D,snippet:J,reason:D?void 0:"stxConfirm() returns a Promise and native confirm() is synchronous, so this needs `await` inside an async function. Rewriting it here would make the condition always true."}),D)M+=j.slice(z,Z)+"await stxConfirm(",z=Z+(Y[0].length-Y[1].length)}return M+j.slice(z)}function w(j,G,H){let Q=/(<[a-z][\w-]*\b[^>]*?)\stitle=(["'])(.*?)\2/gis,X=C(j),M="",z=0,Y;while((Y=Q.exec(X))!==null){let[Z,$,J,D]=Y,K=N(j,Y.index),B=P(j,Y.index),V=$.match(/^<([A-Za-z][\w-]*)/)?.[1]??"";if(/^[A-Z]/.test(V)){H.push({file:G,line:K,rule:"tooltip",applied:!1,snippet:B,reason:`\`title\` on <${V}> is a component prop, not an HTML attribute \u2014 `+"adding x-tooltip here would put a tooltip on a component and may duplicate text it already renders."});continue}if(/\bx-tooltip[=\s]/.test($)||D.trim()===""){H.push({file:G,line:K,rule:"tooltip",applied:!1,snippet:B,reason:/\bx-tooltip[=\s]/.test($)?"already has x-tooltip":"empty title"});continue}H.push({file:G,line:K,rule:"tooltip",applied:!0,snippet:B}),M+=j.slice(z,Y.index)+`${$} x-tooltip=${J}${D}${J} title=${J}${D}${J}`,z=Y.index+Z.length}return M+j.slice(z)}function C(j){return j.replace(/<!--[\s\S]*?-->/g,(G)=>G.replace(/[^\n]/g," ")).replace(/\{\{--[\s\S]*?--\}\}/g,(G)=>G.replace(/[^\n]/g," "))}function E(j){let G=(H)=>H.replace(/[^\n]/g," ");return j.replace(/\/\*[\s\S]*?\*\//g,G).replace(/\/\/[^\n]*/g,G)}function F(j,G=!1){let H=C(j);return(G?E(H):_(H)).replace(/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi,(X,M)=>/\bclient\b/i.test(M)?X:X.replace(/[^\n]/g," "))}function S(j,G,H,Q){let X=F(j),M=F(j,!0);for(let z of v){if(!H.includes(z.rule))continue;if(z.requires&&!z.requires(j))continue;z.pattern.lastIndex=0;let Y,Z=/['"]/.test(z.pattern.source)?M:X;z.pattern.lastIndex=0;while((Y=z.pattern.exec(Z))!==null){if(z.reject?.(j,Y.index))continue;Q.push({file:G,line:N(j,Y.index),rule:z.rule,applied:!1,snippet:P(j,Y.index),reason:`${z.primitive} \u2014 ${z.why}`})}}}function k(j,G={}){let H=G.rules??U,Q=G.file??"<source>",X=[];S(j,Q,H,X);let M=j;if(H.includes("confirm"))M=O(M,Q,X);if(H.includes("tooltip"))M=w(M,Q,X);X.sort((Z,$)=>Z.line-$.line);let z=new Set,Y=X.filter((Z)=>{let $=`${Z.rule}:${Z.line}`;if(z.has($))return!1;return z.add($),!0});return{code:M,findings:Y}}var I=new Set(["confirm","tooltip"]);function A(j,G){if(j.length===0)return"No hand-rolled equivalents found.";let H=j.filter((z)=>z.applied),Q=j.filter((z)=>!z.applied&&I.has(z.rule)),X=j.filter((z)=>!z.applied&&!I.has(z.rule)),M=[];if(H.length>0){M.push(G?`Rewrote ${H.length} site(s):`:`Would rewrite ${H.length} site(s) (pass --fix):`);for(let z of H)M.push(` ${z.file}:${z.line} [${z.rule}] ${z.snippet}`)}if(Q.length>0){M.push("",`Needs a human \u2014 ${Q.length} site(s):`);for(let z of Q)M.push(` ${z.file}:${z.line} [${z.rule}] ${z.snippet}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{tk as m}from"./chunk-bmfnxh4y.js";import{Pu as z}from"./chunk-p3kn55v4.js";import{existsSync as s,mkdirSync as T,copyFileSync as F,chmodSync as A}from"fs";import{join as Z,basename as Yq}from"path";import{spawn as j,execSync as Zq}from"child_process";import{tmpdir as c,homedir as P,platform as Lq}from"os";var Iq=`
|
|
3
3
|
<script>
|
|
4
4
|
(function() {
|
|
5
5
|
'use strict';
|
|
@@ -3019,4 +3019,4 @@ Terminal=false
|
|
|
3019
3019
|
Categories=Utility;
|
|
3020
3020
|
Icon=${$.toLowerCase()}
|
|
3021
3021
|
`;z("fs").writeFileSync(Z(Y,`${$.toLowerCase()}.desktop`),_);let E=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(z("fs").writeFileSync(Z(Y,`${$.toLowerCase()}.png`),E),J.icon&&s(J.icon))F(J.icon,Z(Y,`${$.toLowerCase()}.png`));let H=j("appimagetool",[Y,U],{env:{...process.env,ARCH:"x86_64"}});H.on("close",(x)=>{if(z("fs").rmSync(K,{recursive:!0,force:!0}),x===0)A(U,493),W({success:!0});else W({success:!1,error:`appimagetool exited with code ${x}. Install from https://appimage.github.io/appimagetool/`})}),H.on("error",(x)=>{z("fs").rmSync(K,{recursive:!0,force:!0}),W({success:!1,error:`appimagetool not found: ${x.message}`})})}catch(K){W({success:!1,error:K.message})}})}function Vq(){return[I()]}function Fq(q){switch(q){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 Aq={buildNative:Qq,getAvailableTargets:Vq,getAvailableFormats:Fq,detectPlatform:I},cq=Aq;
|
|
3022
|
-
export{Iq as
|
|
3022
|
+
export{Iq as Zj,D as _j,Cq as $j,yq as ak,N as bk,b as ck,h as dk,bq as ek,u as fk,Pq as gk,vq as hk,Qq as ik,Vq as jk,Fq as kk,cq as lk};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import z from"fs";function B(x){return[...x].sort().map((b)=>{try{let j=z.statSync(b);return`${b}:${j.size}:${j.mtimeMs}`}catch{return`${b}:missing`}}).join(`
|
|
3
3
|
`)}function C(x,b,j){let q=x.get(b);return q!==void 0&&q.signature===j?q.value:void 0}function D(x,b,j,q){return x.set(b,{signature:j,value:q}),q}
|
|
4
|
-
export{B as
|
|
4
|
+
export{B as _i,C as $i,D as aj};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{sj as o,tj as p,uj as q}from"./chunk-7bemc914.js";import{Aj as a,Bj as b,Cj as c,Dj as d,Ej as e,Fj as f,Gj as g,Hj as h,Ij as i,Jj as j,Kj as k,Lj as l,Mj as m,Nj as n}from"./chunk-w95sp0k9.js";import"./chunk-fa3pamx8.js";import"./chunk-p3kn55v4.js";export{n as useOptimistic,l as untrack,a as state,g as runMountCallbacks,h as runDestroyCallbacks,i as pendingLifecycleCounts,m as peek,e as onMount,f as onDestroy,j as isSignal,k as isDerived,p as generateSignalsRuntimeDev,o as generateSignalsRuntime,c as effect,b as derived,q as default,d as batch};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{wg as a}from"./chunk-8rtvsq49.js";import"./chunk-r2nc9hm9.js";import"./chunk-h7aynn48.js";import"./chunk-0athjw48.js";import"./chunk-135mme4g.js";import"./chunk-f3m0q482.js";import"./chunk-f1jd5qjb.js";import"./chunk-v0y3drpw.js";import"./chunk-0pdrnxg2.js";import"./chunk-j26v67km.js";import"./chunk-3gjrq8m7.js";import"./chunk-mh4hd2wt.js";import"./chunk-fa3pamx8.js";import"./chunk-5ec3m8hk.js";import"./chunk-snh1ahqp.js";import"./chunk-p3kn55v4.js";export{a as startProductionServer};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Pu as Y}from"./chunk-p3kn55v4.js";import{mkdir as O,writeFile as q}from"fs/promises";import{join as X}from"path";var T="https://api.iconify.design";async function k(){let E=await fetch(`${T}/collections`);if(!E.ok)throw Error(`Failed to fetch collections: ${E.statusText}`);return await E.json()}async function P(E,z){try{let U=Y.resolve("@iconify/json"),S=`${`${U.substring(0,U.lastIndexOf("/node_modules/@iconify/json/"))}/node_modules/@iconify/json`}/json/${E}.json`,M=Bun.file(S);if(await M.exists()){let V=await M.json();if(z&&z.length>0){let Z={};for(let L of z)if(V.icons[L])Z[L]=V.icons[L];return{...V,icons:Z}}return V}}catch{}let K=z&&z.length>0?`${T}/${E}.json?icons=${z.join(",")}`:`${T}/${E}.json`,Q=await fetch(K);if(!Q.ok)throw Error(`Failed to fetch icons for ${E}: ${Q.statusText}`);return await Q.json()}function j(E,z=24,K=24){return{body:E.body,width:E.width||z,height:E.height||K,viewBox:`0 0 ${E.width||z} ${E.height||K}`}}function F(E,z){let K=B(E);return`import type { IconData } from '@stacksjs/iconify-core'
|
|
3
3
|
|
|
4
4
|
export const ${K}: IconData = ${JSON.stringify(z,null,2)}
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-p3kn55v4.js";var Y=null,S=[],F=new WeakMap;function I(z){let K=z,B=new Set,G={get value(){if(Y){let H=F.get(G);if(!H)H=new Set,F.set(G,H);H.add(Y)}return K},set value(H){if(!Object.is(K,H)){K=H,B.forEach((J)=>J(H));let L=F.get(G);if(L)L.forEach((J)=>J())}},subscribe(H){return B.add(H),()=>B.delete(H)},peek(){return K}};return G}function W(z){return z!==null&&typeof z==="object"&&"value"in z&&"subscribe"in z&&"peek"in z}function P(z){return W(z)?z.value:z}function j(z){let K={};for(let B in z)if(Object.prototype.hasOwnProperty.call(z,B))K[B]=I(z[B]);return K}function D(z){return I(z)}function U(z){let K=typeof z==="function",B=K?z:z.get,G=K?void 0:z.set,H=K?Object.is:z.equals||Object.is,L,J=!0,Q=new Set,X=new Set,_=()=>{if(J=!0,X.size>0){let N=T.value;X.forEach(($)=>$(N))}};function Z(){Q.clear();let N=Y;Y=_,S.push(_);try{return B()}finally{S.pop(),Y=N}}let T={get value(){if(Y){let N=F.get(T);if(!N)N=new Set,F.set(T,N);N.add(Y)}if(J){let N=Z();if(!H(L,N))L=N;J=!1}return L},set value(N){if(G)G(N);else console.warn("Computed property is readonly")},subscribe(N){return X.add(N),()=>X.delete(N)},peek(){if(J)L=B(),J=!1;return L},invalidate(){J=!0},get dirty(){return J},get deps(){return Q}};return T}function x(z,K,B={}){let{immediate:G=!1,deep:H=!1,flush:L="pre",once:J=!1}=B,Q,X=!0,_=!1,Z=()=>{if(W(z))return H?q(z.value):z.value;return z()},T=()=>{if(!X||_)return;let M=Z();if(Q!==void 0&&Object.is(Q,M)&&!H)return;let A=()=>{if(K(M,Q),Q=H?q(M):M,J)$()};if(L==="sync")A();else if(L==="post")queueMicrotask(A);else Promise.resolve().then(A)},N=null;if(W(z))N=z.subscribe(()=>T());else N=U(z).subscribe(()=>T());if(G)Q=void 0,T();else Q=Z();let $=()=>{if(X=!1,N)N(),N=null};return $.pause=()=>{_=!0},$.resume=()=>{_=!1},$}function E(z,K,B={}){let{immediate:G=!1,once:H=!1}=B,L=z.map((T)=>W(T)?T.value:void 0),J=!0,Q=!1,X=()=>{if(!J||Q)return;let T=z.map((N)=>W(N)?N.value:void 0);if(K(T,L),L=[...T],H)Z()},_=z.map((T)=>{if(W(T))return T.subscribe(()=>X());return()=>{}});if(G)X();let Z=()=>{J=!1,_.forEach((T)=>T())};return Z.pause=()=>{Q=!0},Z.resume=()=>{Q=!1},Z}function y(z,K={}){let{flush:B="pre"}=K,G,H=!0,L=!1,J=()=>{if(!H||L)return;if(G)G();let X=Y;Y=J,S.push(J);try{G=z()}finally{S.pop(),Y=X}};if(B==="sync")J();else if(B==="post")queueMicrotask(J);else Promise.resolve().then(J);let Q=()=>{if(H=!1,G)G()};return Q.pause=()=>{L=!0},Q.resume=()=>{L=!1},Q}function C(z,K={},B){let G=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return z.replace(G,(H,L,J)=>{try{let X=Function(...Object.keys(K),`return ${J}`)(...Object.values(K));return K[L]=X,`<!-- computed: ${L} = ${X} -->`}catch(Q){return`<!-- computed error: ${L} - ${Q} -->`}})}function R(z,K={},B){let G=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return z.replace(G,(H,L,J)=>{return`
|
|
3
3
|
<script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
|
|
4
4
|
(function() {
|
|
5
5
|
// Watch implementation for ${L}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ai as
|
|
2
|
+
import{Ai as b,Bi as c,Ci as d,Di as e,Ei as f,Fi as g,zi as a}from"./chunk-xttsqmkm.js";import"./chunk-p3kn55v4.js";export{d as useVirtualList,b as processVirtualListDirectives,f as processVirtualGridDirectives,e as processInfiniteListDirectives,c as generateVirtualListCSS,g as default,a as createVirtualList};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Bp as a,Cp as b,Dp as c,Ep as d,Fp as e,Gp as f}from"./chunk-h7aynn48.js";import"./chunk-0athjw48.js";import"./chunk-135mme4g.js";import"./chunk-f3m0q482.js";import"./chunk-f1jd5qjb.js";import"./chunk-v0y3drpw.js";import"./chunk-0pdrnxg2.js";import"./chunk-j26v67km.js";import"./chunk-3gjrq8m7.js";import"./chunk-mh4hd2wt.js";import"./chunk-fa3pamx8.js";import"./chunk-5ec3m8hk.js";import"./chunk-snh1ahqp.js";import"./chunk-p3kn55v4.js";export{f as processStackReplacements,e as processStackPushDirectives,d as processIncludes,a as partialsCache,b as onceStore,c as clearOnceStore};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Kh as a,Lh as b,Mh as c,Nh as d,Oh as e,Ph as f,Qh as g,Rh as h,Sh as i}from"./chunk-gpmpcrww.js";import"./chunk-74cv4ta1.js";import"./chunk-p3kn55v4.js";export{c as setCachedImageResult,e as processImage,f as optimizeImage,b as getCachedImageResult,i as generateSrcset,h as generateResponsiveVariants,d as clearImageCache,g as applyTransformations,a as ImageProcessorCache};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$
|
|
2
|
+
import{$l as F,Fq as k,Hl as A,Il as D,Sm as T,Tm as y,Xo as x,Zl as B,as as w,cp as M,tp as R}from"./chunk-h7aynn48.js";import{Pu as P}from"./chunk-p3kn55v4.js";function b(K){return K.endsWith(".md")||K.endsWith(".markdown")}function C(K){let z=[];_(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let G=[...z];_(/<code\b[^>]*>[\s\S]*?<\/code>/gi,G);function _(J,X){let $;while(($=J.exec(K))!==null){let q=$.index,N=q+$[0].length;if(X?.some((Y)=>q>=Y.start&&N<=Y.end))continue;z.push({start:q,end:N})}}if(z.length===0)return K;z.sort((J,X)=>J.start-X.start);let U="",Q=0;for(let J of z){if(J.start<Q)continue;U+=K.slice(Q,J.start),U+=`@raw${K.slice(J.start,J.end)}@endraw`,Q=J.end}return U+=K.slice(Q),U}async function j(K,z={}){let{data:G,content:_}=A(K),Q=await(z.renderer??((J)=>D(J)))(_);return{html:C(Q),frontmatter:G??{}}}import{dirname as v,resolve as H}from"path";function f(K){let z=K,G=x(K);if(G)z=G.content.trim();let _=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,U=[],Q=[],J=[],X=(N)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(N),$;while(($=_.exec(K))!==null){let N=$[1],Y=$[2],E=$[0],Z=N.includes("server");if(X(Y))J.push(E);else if(Z)Q.push(Y);else U.push(E)}let q=z;{let N=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,Y,E=[];while((Y=N.exec(q))!==null){let Z=Y.index+Y[0].length,L=q.indexOf("</script>",Z);if(L===-1)continue;E.push({start:Y.index,end:L+9}),N.lastIndex=L+9}for(let Z=E.length-1;Z>=0;Z--)q=q.substring(0,E[Z].start)+q.substring(E[Z].end)}for(let N of U)q=q.replace(N,"");return{templateContent:q,serverScripts:Q,clientScripts:U,signalsScripts:J}}function g(K,z){return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -14,5 +14,5 @@ ${Q.join(`
|
|
|
14
14
|
`)}`}else{if(G.processClientScripts!==!1&&Q.length>0){let N=X.__stx_event_bindings||[],Y=B(X),Z=(await Promise.all(Q.map(async(V)=>{let W=V.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!W)return V;return await F(W[1],{eventBindings:N,templateContent:q,serverData:Y,filePath:z})}))).join(`
|
|
15
15
|
`);if(q.match(/(<\/body>)/i))q=q.replace(/(<\/body>)/i,`${Z}
|
|
16
16
|
$1`);else q+=`
|
|
17
|
-
${Z}`}q=await M(q)}if(G.wrapInDocument){if(!q.trim().toLowerCase().startsWith("<!doctype")&&!q.trim().toLowerCase().startsWith("<html"))q=g(q,G.title)}if(G.injectCSS)try{let{injectCrosswindCSS:N}=await import("./chunk-
|
|
18
|
-
export{b as
|
|
17
|
+
${Z}`}q=await M(q)}if(G.wrapInDocument){if(!q.trim().toLowerCase().startsWith("<!doctype")&&!q.trim().toLowerCase().startsWith("<html"))q=g(q,G.title)}if(G.injectCSS)try{let{injectCrosswindCSS:N}=await import("./chunk-sbsq0jvn.js");q=await N(q)}catch{}return q}
|
|
18
|
+
export{b as qk,C as rk,j as sk,s as tk,i as uk,I as vk};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Eh as a,Fh as b,Gh as c,Hh as d,Ih as e,Jh as f}from"./chunk-w8cdwh41.js";import"./chunk-h7aynn48.js";import"./chunk-0athjw48.js";import"./chunk-135mme4g.js";import"./chunk-f3m0q482.js";import"./chunk-f1jd5qjb.js";import"./chunk-v0y3drpw.js";import"./chunk-0pdrnxg2.js";import"./chunk-j26v67km.js";import"./chunk-3gjrq8m7.js";import"./chunk-mh4hd2wt.js";import"./chunk-fa3pamx8.js";import"./chunk-5ec3m8hk.js";import"./chunk-snh1ahqp.js";import"./chunk-p3kn55v4.js";export{c as renderSlot,d as processSlots,a as parseSlots,b as parseSlotElement,e as extractSlotContent,f as applySlots};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{ps as Q}from"./chunk-0athjw48.js";import"./chunk-f3m0q482.js";import{kt as R}from"./chunk-j26v67km.js";import"./chunk-p3kn55v4.js";import O from"fs";import U from"path";async function W(j,b={}){let q=Date.now(),z={total:0,passed:0,failed:0,new:0,failures:[],duration:0},K=b.snapshotDir||R(j.root,"story","snapshots");await O.promises.mkdir(K,{recursive:!0});let B=j.storyFiles;if(b.filter&&b.filter.length>0)B=B.filter((J)=>b.filter.some((G)=>J.fileName.toLowerCase().includes(G.toLowerCase())));for(let J of B)await X(J,K,b,z);return z.duration=Date.now()-q,z}async function X(j,b,q,z){let K=j.story;if(!K)return;for(let B of K.variants){z.total++;let J=U.join(b,`${j.id}-${B.id}.snap`),G=Y(B.source||""),L=await _(J);if(q.update||!L){let M={storyId:j.id,variantId:B.id,component:j.fileName,timestamp:Date.now(),hash:G};if(await O.promises.writeFile(J,JSON.stringify(M,null,2)),!L)z.new++;z.passed++}else try{let M=await O.promises.readFile(J,"utf-8"),N=JSON.parse(M);if(N.hash===G)z.passed++;else z.failed++,z.failures.push({storyId:j.id,variantId:B.id,component:j.fileName,message:"Snapshot mismatch",difference:Z(N.hash,G)})}catch(M){z.failed++,z.failures.push({storyId:j.id,variantId:B.id,component:j.fileName,message:`Error reading snapshot: ${M}`})}}}async function A(j,b={}){return(await W(j,{...b,update:!0})).total}function Y(j){let b=0;for(let q=0;q<j.length;q++){let z=j.charCodeAt(q);b=(b<<5)-b+z,b=b&b}return b.toString(16)}function Z(j,b){if(j===b)return 0;let q=Math.abs(Number.parseInt(j,16)-Number.parseInt(b,16));return Math.min(q/1e6,1)}async function _(j){try{return await O.promises.access(j),!0}catch{return!1}}function I(j){let b=[];if(b.push(""),b.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"),b.push(" STX Story Visual Regression Tests"),b.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"),b.push(""),j.failures.length>0){b.push(" \u274C Failures:"),b.push("");for(let q of j.failures){if(b.push(` \u2022 ${q.component} / ${q.variantId}`),b.push(` ${q.message}`),q.difference!==void 0)b.push(` Difference: ${(q.difference*100).toFixed(2)}%`);b.push("")}}if(b.push(" Summary:"),b.push(` Total: ${j.total}`),b.push(` Passed: ${j.passed} \u2713`),b.push(` Failed: ${j.failed} \u2717`),j.new>0)b.push(` New: ${j.new} \u26A1`);return b.push(` Time: ${j.duration}ms`),b.push(""),b.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"),b.push(""),b.join(`
|
|
3
3
|
`)}async function S(j,b={}){let q=performance.now(),z=[],K=0,B=0;for(let G of j.storyFiles)try{let L=await Bun.file(G.path).text(),M=await Q(L,G.path);if(M.length>0){for(let N of M)z.push({storyId:G.id,variantId:"default",component:G.component,message:`A11y: ${N.message}`,expected:"No accessibility violations",actual:`${N.type}: ${N.message} (impact: ${N.impact})`});B++}else K++}catch(L){z.push({storyId:G.id,variantId:"default",component:G.component,message:`Failed to check a11y: ${L instanceof Error?L.message:String(L)}`,expected:"File readable for a11y check",actual:"File read error"}),B++}let J=performance.now()-q;return{total:j.storyFiles.length,passed:K,failed:B,new:0,failures:z,duration:J}}export{A as updateSnapshots,W as runVisualTests,S as runA11yTests,I as formatTestResults};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Rf as p}from"./chunk-vhnnryps.js";import{Hg as a,Jg as JF,Kg as ZF,Lg as qF}from"./chunk-r2nc9hm9.js";import{sj as C,tj as D}from"./chunk-7bemc914.js";import{Ek as QF,Fk as XF,Gk as YF}from"./chunk-58f0mthg.js";import{$o as o,Bq as FF,Fq as c,Nm as u,as as n,cs as N,em as l,gm as d,gq as e,uq as t}from"./chunk-h7aynn48.js";import{_s as r}from"./chunk-v0y3drpw.js";import{Du as S,Fu as WF}from"./chunk-5ec3m8hk.js";import G from"fs";import Z from"path";import{createHash as $F}from"crypto";WF();function g(J){return $F("sha256").update(J).digest("hex").slice(0,8)}function f(J=!1){let q=J?D():C(),z=g(q);return{content:q,filename:`runtime.${z}.js`,hash:z}}function m(){let J=S(),q=g(J);return{content:J,filename:`router.${q}.js`,hash:q}}function UF(J){return{runtimeTag:J.runtime?`<script src="/__stx/${J.runtime.filename}"></script>`:"",routerTag:J.router?`<script src="/__stx/${J.router.filename}"></script>`:"",cssTag:J.css?`<link rel="stylesheet" href="/__stx/${J.css.filename}">`:""}}import h from"path";import{createHash as GF}from"crypto";function VF(J={}){let q=new Set;return{context:new Proxy(J,{get(Q,X){if(X in Q)return Q[X];if(typeof X==="string"&&!X.startsWith("__"))q.add(X);return},has(Q,X){if(X in Q)return!0;if(typeof X==="string"&&!X.startsWith("__"))q.add(X);return!1}}),accessedKeys:q}}async function i(J,q,z={}){let Q=h.resolve(J),X=await Bun.file(Q).text(),I=GF("sha256").update(X).digest("hex").slice(0,16);l();let K={};try{K=await N()}catch{}let B=[],V=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,k;while((k=V.exec(X))!==null){let $=k[1];if(/\bserver\b/.test($))B.push(k[2])}let W=new Set(B.flatMap(($)=>p($))),{context:E}=VF({__filename:Q,__dirname:h.dirname(Q),__stx_serverDeclared:W}),L=new Set,_={...n,...K,...z,buildMode:"compile",strict:!1},w=await c(X,E,Q,_,L),U=a(w),H=d();return{route:q,sourceFile:J,html:w,fragment:U,placeholders:H,hasServerScripts:B.length>0,serverScriptContent:B,dependencies:Array.from(L),contentHash:I,status:u(X),streamTemplates:E.__streamTemplates}}var kF=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function s(J,q){let z=0,Q=0;if(!G.existsSync(J))return{copied:z,bytes:Q};G.mkdirSync(q,{recursive:!0});function X(I,K){let B=G.readdirSync(I,{withFileTypes:!0});for(let V of B){if(kF.has(V.name))continue;let k=Z.join(I,V.name),W=Z.join(K,V.name);if(V.isDirectory())G.mkdirSync(W,{recursive:!0}),X(k,W);else if(V.isFile()){if(G.existsSync(W))continue;G.copyFileSync(k,W),z++,Q+=G.statSync(W).size}}}return X(J,q),{copied:z,bytes:Q}}async function lF(J={}){let q=Date.now(),z=Z.resolve(J.root||process.cwd()),Q=Z.resolve(z,J.outputDir||".output");console.log("[stx build] Starting production build...");let X={};try{X=await N()}catch{}let I=J.componentsDir??X.componentsDir??"components",K=J.partialsDir??X.partialsDir??"partials",B=J.layoutsDir??X.layoutsDir??"layouts",V=J.publicDir??X.publicDir??"public",k=X.app?.head||{},W=X.app?.colorMode,E=X.router?.container||"main";if(G.existsSync(Q))G.rmSync(Q,{recursive:!0});let L=[Z.join(Q,"public","__stx"),Z.join(Q,"public","assets"),Z.join(Q,"server","pages"),Z.join(Q,"server","fragments")];for(let Y of L)G.mkdirSync(Y,{recursive:!0});console.log("[stx build] Discovering routes...");let _=o(z),w=["components","layouts","partials"],U=_.filter((Y)=>{return!w.some((F)=>Y.pattern.startsWith(`/${F}/`)||Y.pattern===`/${F}`)});console.log(`[stx build] Found ${U.length} page routes (${_.length-U.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let H=f(J.debug),$=m();await Bun.write(Z.join(Q,"public","__stx",H.filename),H.content),await Bun.write(Z.join(Q,"public","__stx",$.filename),$.content),console.log(`[stx build] Runtime: ${H.filename} (${(H.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${$.filename} (${($.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let O=[],j=[];for(let Y of U)try{let F=await i(Y.filePath,Y.pattern,{componentsDir:I,partialsDir:K,layoutsDir:B,debug:J.debug});if(O.push(F),F.html=F.html.replace(/runtime\.__STX_HASH__\.js/g,H.filename).replace(/router\.__STX_HASH__\.js/g,$.filename),F.html=FF(F.html,k,{bodyScripts:[`<script src="/__stx/${$.filename}"></script>`],...W&&{colorMode:W}}),W)F.html=e(F.html,W);if(k.htmlAttrs)F.html=t(F.html,k.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(F.html)){let T=F.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(T&&T[1]){let P=T[1];F.html=F.html.replace(" "+P,""),F.html=F.html.replace(/<body([^>]*)>/,`<body$1 ${P}>`)}}F.html=F.html.replace(/<style data-crosswind="generated">[\s\S]*?<\/style>\s*/g,""),F.html=await r(F.html),F.fragment=JF(F.html,E);let y=Y.pattern==="/"?"index":Y.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),b=Z.join("server","pages",`${y}.compiled.json`),A=Z.join("server","fragments",`${y}.html`);await Bun.write(Z.join(Q,b),JSON.stringify(F,null,2)),await Bun.write(Z.join(Q,A),F.fragment),j.push({pattern:Y.pattern,compiledPath:b,fragmentPath:A,isDynamic:F.hasServerScripts,hasParams:Y.pattern.includes(":")||Y.pattern.includes("[")}),console.log(`[stx build] \u2713 ${Y.pattern}`)}catch(F){console.error(`[stx build] \u2717 ${Y.pattern}:`,F instanceof Error?F.message:F)}let M=Z.resolve(z,V);if(G.existsSync(M)){let{copied:Y,bytes:F}=s(M,Z.join(Q,"public"));if(Y>0)console.log(`[stx build] Copied ${Y} public asset${Y===1?"":"s"} (${(F/1024).toFixed(1)}KB) from ${V}/`)}let v=YF(z);if(v){let{copied:Y,bytes:F}=s(v,Z.join(Q,"public",XF));if(Y>0)console.log(`[stx build] Copied ${Y} asset${Y===1?"":"s"} (${(F/1024).toFixed(1)}KB) from ${QF}/`)}let R={runtime:H.filename,router:$.filename},zF=ZF(j,R,Q);qF(zF,Q);let x=Date.now()-q;return console.log(`
|
|
3
3
|
[stx build] Done in ${x}ms \u2014 ${O.length} pages compiled`),{pageCount:O.length,assets:R,outputDir:Q,duration:x}}
|
|
4
|
-
export{g as
|
|
4
|
+
export{g as Hf,f as If,m as Jf,UF as Kf,i as Lf,lF as Mf};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$g as
|
|
2
|
+
import{$g as d,Yg as a,Zg as b,_g as c,ah as e,bh as f,ch as g,dh as h}from"./chunk-f5v2qf95.js";import"./chunk-p3kn55v4.js";export{g as timingPlugin,c as pluginManager,a as definePlugin,f as debugPlugin,h as createVariablesPlugin,e as createFilterPlugin,d as createDirectivePlugin,b as PluginManager};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Oj as a,Pj as b,Qj as c,Rj as d,Sj as e,Tj as f,Uj as g,Vj as h,Wj as i,Xj as j,Yj as k}from"./chunk-4fybwpba.js";import"./chunk-h7aynn48.js";import"./chunk-0athjw48.js";import"./chunk-135mme4g.js";import"./chunk-f3m0q482.js";import"./chunk-f1jd5qjb.js";import"./chunk-v0y3drpw.js";import"./chunk-0pdrnxg2.js";import"./chunk-j26v67km.js";import"./chunk-3gjrq8m7.js";import"./chunk-mh4hd2wt.js";import"./chunk-fa3pamx8.js";import"./chunk-5ec3m8hk.js";import"./chunk-snh1ahqp.js";import"./chunk-p3kn55v4.js";export{a as templateCache,b as readFileCached,d as invalidateFileCacheByDir,c as invalidateFileCache,k as hashFilePath,f as getCachedSignalsRuntime,g as getCachedRouterScript,h as clearDevCaches,i as checkCache,j as cacheTemplate,e as __setSignalsGeneratorsForTest};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
function G(q){if(!q||typeof q!=="object")return!1;let z=q;return typeof z.message==="string"&&(z.name==="BuildMessage"||z.name==="ResolveMessage"||("position"in z))}function H(q){if(q&&typeof q==="object"&&Array.isArray(q.errors))return q.errors;return[q]}function I(q,z){let j=[];for(let A of H(q)){if(G(A)){let D=A.position||void 0;j.push({file:z||D?.file,line:D?.line,column:D?.column,message:A.message??"",lineText:D?.lineText});continue}j.push({file:z,message:A instanceof Error?A.message:String(A)})}return j}function J(q,z){return I(q,z).map((j)=>{let A=j.file?`${j.file}${j.line?`:${j.line}${j.column?`:${j.column}`:""}`:""}`:"",D=j.lineText?`
|
|
3
3
|
${j.lineText.trim()}`:"";return A?`${A}: ${j.message}${D}`:`${j.message}${D}`}).join(`
|
|
4
4
|
`)}
|
|
5
|
-
export{I as
|
|
5
|
+
export{I as hl,J as il};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{eh as L,fh as w,gh as x,hh as p,ih as F,jh as T,mh as I,nh as f,oh as l,ph as n,qh as i,rh as P,sh as o,th as a}from"./chunk-6twytnbh.js";import{Cs as ZG}from"./chunk-135mme4g.js";function HG(X,Z={}){let{src:G,alt:J,width:q,height:$,sizes:K="100vw",loading:Q="lazy",priority:Y=!1,quality:M=x,placeholder:N="none",formats:j=w,widths:C=L,decoding:B="async",fetchpriority:V,objectFit:O,objectPosition:W}=X,H=X.class,z=X.style,{processedImage:R,variants:_,optimize:E=!0,isDev:S=!1}=Z;if(_&&_.length>0)return OG(X,_,R);if(S||!E)return MG(X);return VG(X)}function OG(X,Z,G){let{src:J,alt:q,width:$,height:K,sizes:Q="100vw",loading:Y="lazy",priority:M=!1,decoding:N="async",fetchpriority:j,objectFit:C,objectPosition:B,placeholder:V="none"}=X,O=X.class,W=X.style,H=n(Z),z=l(Z),R=typeof Q==="object"?f(Q):Q,_=G?G.aspectRatio:$&&K?Number($)/Number(K):void 0,E=[];if(_)E.push(`aspect-ratio: ${_}`);if(C)E.push(`object-fit: ${C}`);if(B)E.push(`object-position: ${B}`);if(W)E.push(W);let S=E.length>0?` style="${E.join("; ")}"`:"",b=O?` class="${O}"`:"",u=M?"":` loading="${Y}"`,d=` decoding="${N}"`,h=j?` fetchpriority="${j}"`:M?' fetchpriority="high"':"",r=["avif","webp","jpeg","png"],s=[];for(let U of r){let D=H.get(U);if(D&&D.length>0){let m=I(D),QG=P(U);s.push(` <source type="${QG}" srcset="${m}" sizes="${R}" />`)}}let e="",t="",g;if(V!=="none"&&G?.placeholder){let U=`img-${Math.random().toString(36).slice(2,8)}`;if(e=`<div class="stx-image-wrapper" id="${U}">`,t="</div>",V==="blur")g=`
|
|
3
3
|
#${U} {
|
|
4
4
|
position: relative;
|
|
5
5
|
background-image: url('${G.placeholder}');
|
|
@@ -40,4 +40,4 @@ ${O}
|
|
|
40
40
|
${O}
|
|
41
41
|
</div>`}}if(G.priority&&C){let W=P(C.format);O=`<link rel="preload" as="image" href="${k(C.url)}" type="${W}" />
|
|
42
42
|
`+O}return O}function k(X){return X.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var UG=$G();import v from"fs";import A from"path";function LG(X={}){let{inputDirs:Z=["public","src/assets","assets"],outputDir:G="dist/images",baseUrl:J="/images",formats:q=w,widths:$=L,quality:K=x,placeholder:Q="none",concurrency:Y=4,cache:M=!0,cacheDir:N=".stx/image-cache",referencedOnly:j=!1,verbose:C=!1}=X,B={imageReferences:new Set,processedImages:new Map,stats:{totalImages:0,optimizedImages:0,savedBytes:0,variants:0}};return{name:"stx-image-optimization",async setup(V){if(!await F()){console.warn("[stx-images] no image backend available, optimization disabled");return}if(M)await v.promises.mkdir(N,{recursive:!0});if(C){let W=await p();console.log("[stx-images] Plugin initialized"),console.log(` Backend: ${W?"sharp (native fast path) + ts-images":"ts-images (pure TS)"}`),console.log(` Input dirs: ${Z.join(", ")}`),console.log(` Output dir: ${G}`),console.log(` Formats: ${q.join(", ")}`),console.log(` Widths: ${$.join(", ")}`)}},async buildStart(){B.imageReferences.clear(),B.processedImages.clear(),B.stats={totalImages:0,optimizedImages:0,savedBytes:0,variants:0}},async transform(V,O){if(O.endsWith(".html")||O.endsWith(".stx")){let W=wG(V);for(let H of W)B.imageReferences.add(H)}if(V.includes("<Image")||V.includes("@image"))return await kG(V,{formats:q,widths:$,quality:K,placeholder:Q,outputDir:G,baseUrl:J,processedImages:B.processedImages});return V},async buildEnd(V){if(!await F())return;await v.promises.mkdir(G,{recursive:!0});let W=[];for(let R of Z){if(!v.existsSync(R))continue;let _=await KG(R);W.push(..._)}let H=j?W.filter((R)=>xG(R,B.imageReferences)):W;if(B.stats.totalImages=H.length,C)console.log(`[stx-images] Processing ${H.length} images...`);let z=qG(H,Y);for(let R of z)await Promise.all(R.map(async(_)=>{try{let E=await T(_,{formats:q,widths:$,quality:K,placeholder:Q,outputDir:G,baseUrl:J});B.processedImages.set(_,E),B.stats.optimizedImages++,B.stats.variants+=E.variants.length;let S=v.statSync(_).size,b=o(E.variants);if(B.stats.savedBytes+=Math.max(0,S-b/E.variants.length),C)console.log(` \u2713 ${A.basename(_)} \u2192 ${E.variants.length} variants`)}catch(E){console.error(`[stx-images] Error processing ${_}:`,E)}}));if(console.log("[stx-images] Optimization complete:"),console.log(` Images: ${B.stats.optimizedImages}/${B.stats.totalImages}`),console.log(` Variants: ${B.stats.variants}`),B.stats.savedBytes>0)console.log(` Saved: ~${a(B.stats.savedBytes)}`)}}}function wG(X){let Z=[],G=/src=["']([^"']+\.(jpg|jpeg|png|webp|avif|gif))["']/gi,J;while((J=G.exec(X))!==null)Z.push(J[1]);let q=/<Image[^>]+src=["']([^"']+)["']/gi;while((J=q.exec(X))!==null)Z.push(J[1]);let $=/@image\s*\(\s*['"]([^'"]+)['"]/gi;while((J=$.exec(X))!==null)Z.push(J[1]);let K=/background(?:-image)?:\s*url\(["']?([^"')]+\.(jpg|jpeg|png|webp|avif|gif))["']?\)/gi;while((J=K.exec(X))!==null)Z.push(J[1]);return Z}function xG(X,Z){let G=A.basename(X);for(let J of Z)if(J.endsWith(G)||J.includes(G))return!0;return!1}async function kG(X,Z){return X}async function KG(X){let Z=[];async function G(J){let q=await v.promises.readdir(J,{withFileTypes:!0});for(let $ of q){let K=A.join(J,$.name);if($.isDirectory())await G(K);else if($.isFile()&&i(K))Z.push(K)}}return await G(X),Z}function qG(X,Z){let G=[];for(let J=0;J<X.length;J+=Z)G.push(X.slice(J,J+Z));return G}async function FG(X,Z,G={}){if(!await F())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");return T(X,{...G,outputDir:Z})}async function SG(X,Z,G={}){let{formats:J=w,widths:q=L,quality:$=x,placeholder:K="none",concurrency:Q=4,verbose:Y=!1}=G;if(!await F())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");await v.promises.mkdir(Z,{recursive:!0});let N=await KG(X),j=[],C={totalImages:N.length,optimizedImages:0,savedBytes:0,variants:0},B=qG(N,Q);for(let V of B){let O=await Promise.all(V.map(async(W)=>{try{let H=await T(W,{formats:J,widths:q,quality:$,placeholder:K,outputDir:Z,baseUrl:"/"});if(C.optimizedImages++,C.variants+=H.variants.length,Y)console.log(` \u2713 ${A.basename(W)}`);return H}catch(H){return console.error(`Error processing ${W}:`,H),null}}));j.push(...O.filter((W)=>W!==null))}return{processed:j,stats:C}}function YG(X){let Z={};for(let G of X)Z[G.src]={variants:G.variants,placeholder:G.placeholder};return Z}async function PG(X,Z){let G=YG(X);await Bun.write(Z,JSON.stringify(G,null,2))}var cG={enabled:!0,widths:[320,640,768,1024,1280,1536,1920],formats:["webp","jpeg"],quality:80,devOptimize:!1,cacheDir:".stx/image-cache",placeholder:"none",inputDirs:["public","src/assets","assets"],outputDir:"dist/images",baseUrl:"/images"};
|
|
43
|
-
export{HG as
|
|
43
|
+
export{HG as mf,JG as nf,jG as of,CG as pf,$G as qf,UG as rf,LG as sf,FG as tf,SG as uf,YG as vf,PG as wf,cG as xf};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{si as a,ti as b,ui as c,vi as d,wi as e,xi as f,yi as g}from"./chunk-t6nseeb9.js";import"./chunk-p3kn55v4.js";export{c as shouldCacheComponent,a as processKeepAliveDirectives,g as onDeactivated,f as onActivated,e as generateKeepAliveRuntime,d as generateKeepAliveCSS,b as createKeepAliveCache};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{hl as _,il as h}from"./chunk-d8y85xdy.js";import{Rl as m,ds as p}from"./chunk-h7aynn48.js";import{kt as N}from"./chunk-j26v67km.js";import K from"path";import q from"fs";var l=5,u=1;function i(J=process.env){return J.STX_DEBUG==="true"||J.STX_DEBUG==="1"}function L(...J){if(i())console.log("[stx:bundler]",...J)}var D=[];function v(J,z,Y){D.push({filePath:J||"<inline>",message:z,details:Y})}function Yw(){return D.slice()}function Zw(){D.length=0}var F;function $w(J){F=J}function b(){if(F)return F;try{let J=p.strict;return typeof J==="object"&&J!==null?J.bundlerFallback??"warn":"warn"}catch{return"warn"}}var f=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function Qw(J){let z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=z.exec(J))!==null){let M=Y[1];if(!f.some((w)=>w.test(M)))return L("detected user import:",M),!0}let Z=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=Z.exec(J))!==null){let M=Y[1];if(/\.css(?:\?.*)?$/.test(M))continue;if(!f.some((w)=>w.test(M)))return L("detected side-effect import:",M),!0}return!1}function t(J,z,Y,Z){let M=($,w)=>{let G=$===Y?z:K.dirname($),W=K.resolve(G,w),H=[W,`${W}.ts`,`${W}.tsx`,`${W}.js`,`${W}.mjs`,`${W}.jsx`,K.join(W,"index.ts"),K.join(W,"index.tsx"),K.join(W,"index.js"),K.join(W,"index.mjs")];for(let j of H)try{if(q.existsSync(j)&&q.statSync(j,{throwIfNoEntry:!1})?.isFile())return j}catch{}return W};return{name:"stx-client-bundle",setup($){$.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(w)=>({path:w.path,external:!0})),$.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(w)=>({path:w.path,external:!0})),$.onResolve({filter:/^\//},(w)=>{if(q.existsSync(w.path))return{path:w.path};return{path:w.path,external:!0}}),$.onResolve({filter:/^\.\.?\//},(w)=>{let G=M(w.importer,w.path);return Z.add(G),{path:G}}),$.onResolve({filter:/^[@~]\//},(w)=>{let G=K.resolve(J,w.path.slice(2)),W=[G,`${G}.ts`,`${G}.tsx`,`${G}.js`,`${G}.mjs`,`${G}.jsx`,K.join(G,"index.ts"),K.join(G,"index.tsx"),K.join(G,"index.js"),K.join(G,"index.mjs")];for(let H of W)if(q.existsSync(H)&&q.statSync(H,{throwIfNoEntry:!1})?.isFile())return L(`resolved ${w.path[0]}/ import:`,w.path,"\u2192",H),Z.add(H),{path:H};return console.warn(`[stx:bundler] could not resolve ${w.path[0]}/ import:`,w.path),{path:G}}),$.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(w)=>{let G=K.extname(w.path).toLowerCase(),W=G===".json"?"json":G===".tsx"?"tsx":G===".jsx"?"jsx":G===".ts"||G===".mts"||G===".cts"?"ts":"js";if(w.path!==Y)Z.add(w.path);return{contents:q.readFileSync(w.path,"utf8"),loader:W}})}}}var R=new Map,g=Symbol.for("stx.client-bundle-build-queue");function s(J){let z=globalThis,Z=(z[g]??Promise.resolve()).then(J,J);return z[g]=Z.then(()=>{return},()=>{return}),Z}async function Xw(J,z,Y={}){let Z=Y.projectRoot||process.cwd(),M=Y.minify??!1,$=Y.cacheDir||N(Z,"bundle-cache"),w=new Bun.CryptoHasher("md5");w.update(`${l}\x00${J}\x00${z}`);let G=w.digest("hex").slice(0,12),W=K.join($,`${G}.js`),H=K.join($,`${G}.deps.json`),j=Bun.file(W);if(await j.exists()){let V=Bun.file(H),O=!0;if(await V.exists())try{let y=JSON.parse(await V.text());if(y.metadataVersion!==u||!Array.isArray(y.files))O=!1;for(let S of Array.isArray(y.files)?y.files:[])try{if(q.statSync(S.path).mtimeMs!==S.mtimeMs){O=!1;break}}catch{O=!1;break}}catch{O=!1}if(O)return L("cache hit:",G),await j.text();L("cache invalidated by dep change:",G)}let T=R.get(G);if(T)return await T;let x=s(()=>a(J,z,{projectRoot:Z,minify:M,cacheDir:$,hash:G,cachePath:W,depsPath:H}));R.set(G,x);try{return await x}finally{R.delete(G)}}async function a(J,z,Y){let{projectRoot:Z,minify:M,cacheDir:$,hash:w,cachePath:G,depsPath:W}=Y,H=N(Z,"bundle-tmp"),j=K.join(H,`${w}.ts`),T=K.join(H,"out",w);q.mkdirSync(H,{recursive:!0}),q.mkdirSync(T,{recursive:!0});let x=K.dirname(z),V=[],O=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,y=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,S;while((S=O.exec(J))!==null){if(S[1])continue;if(S[2])S[2].split(",").forEach((I)=>{let X=e(I);if(X)V.push(X)});else if(S[3])V.push(S[3])}while((S=y.exec(J))!==null){if(S[1])continue;V.push(S[2])}let B=V.length>0?`
|
|
3
3
|
export { ${V.join(", ")} }`:"";await Bun.write(j,J+B),L("bundling:",w,"from:",K.basename(z));let P=new Set;try{let I=await Bun.build({entrypoints:[j],outdir:T,target:"browser",format:"esm",minify:M,plugins:[t(Z,x,j,P)],define:{"process.env.NODE_ENV":M?'"production"':'"development"',...m()},root:Z});if(!I.success){let C=I.logs.filter((U)=>U.level==="error").map((U)=>U.message).join(", ")||`Unable to bundle ${K.basename(z)}`,A=_(I.logs,z||void 0);if(console.warn("[stx:bundler] build failed:",C),v(z||"",C,A),b()==="error")throw Error(C);return J}let X="";for(let Q of I.outputs){X=await Q.text();break}let k=[];for(let Q of X.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let C of Q[1].split(",")){let A=C.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(A){k.push([A[2],A[1]]);continue}let U=C.trim();if(/^[A-Za-z_$][\w$]*$/.test(U))k.push([U,U])}let c=X.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];X=X.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let E=`__stxBundle_${w}`,o=k.map(([Q,C])=>`${JSON.stringify(Q)}: ${C}`).join(", "),n=k.map(([Q])=>`var ${Q} = undefined;`).join(`
|
|
4
4
|
`),r=k.map(([Q])=>`${Q} = ${E}[${JSON.stringify(Q)}];`).join(`
|
|
5
5
|
`);if(X=`${c.join(`
|
|
@@ -10,4 +10,4 @@ ${X}
|
|
|
10
10
|
return { ${o} };
|
|
11
11
|
})();
|
|
12
12
|
${r}`.trim(),L("bundled:",w,"output:",X.length,"bytes"),V.length>0&&k.length===0)return console.warn(`[stx:bundler] dropped every binding for ${K.basename(z)} (${w}); serving the unbundled source and not caching this result`),J;q.mkdirSync($,{recursive:!0}),await Bun.write(G,X);let d=Array.from(P).map((Q)=>{try{return{path:Q,mtimeMs:q.statSync(Q).mtimeMs}}catch{return null}}).filter((Q)=>Q!==null);return await Bun.write(W,JSON.stringify({metadataVersion:u,files:d})),X}catch(I){let X=_(I,z||void 0),k=h(I,z||void 0);if(console.warn(`[stx:bundler] error: ${k}`),v(z||"",k,X),b()==="error")throw I;return J}finally{try{q.rmSync(j,{force:!0}),q.rmSync(T,{recursive:!0,force:!0})}catch{}}}function e(J){let z=J.trim();if(!z)return null;let Y=z.indexOf("=");if(Y!==-1)z=z.slice(0,Y).trim();let Z=z.indexOf(":");if(Z!==-1)z=z.slice(Z+1).trim();if(z.startsWith("..."))z=z.slice(3).trim();return/^[A-Za-z_$][\w$]*$/.test(z)?z:null}
|
|
13
|
-
export{i as
|
|
13
|
+
export{i as _k,v as $k,Yw as al,Zw as bl,$w as cl,b as dl,Qw as el,s as fl,Xw as gl};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{a as N,c as R,e as W,g as j,i as H,k as J}from"./chunk-0y46fbkx.js";import{l as k,m as w,n as B}from"./chunk-q9n5swx7.js";import"./chunk-
|
|
2
|
+
import{a as N,c as R,e as W,g as j,i as H,k as J}from"./chunk-0y46fbkx.js";import{l as k,m as w,n as B}from"./chunk-q9n5swx7.js";import"./chunk-p3kn55v4.js";import E from"fs";import K from"path";var V=[];function _(U){V=[];for(let A of U.storyFiles)if(V.push({text:A.fileName.toLowerCase(),original:A.fileName,type:"story",storyId:A.id}),V.push({text:A.relativePath.toLowerCase(),original:A.relativePath,type:"story",storyId:A.id}),A.story)for(let z of A.story.variants)V.push({text:z.title.toLowerCase(),original:z.title,type:"story",storyId:A.id,variantId:z.id})}function $(){return JSON.stringify(V)}async function O(U={}){let A=Date.now();N();let z=await k({mode:"build"});if(!z.config.enabled){W("Story feature is disabled in config.");return}let P=await H(z);w(z,P);let Y=J(z.config,P);B(z,Y),R(P.length);let X=U.outDir??z.config.outDir,Q=K.resolve(z.root,X);await E.promises.mkdir(Q,{recursive:!0}),console.log(` Building to ${X}...`);let M=F(z);await E.promises.writeFile(K.join(Q,"index.html"),M);let v={files:P.map((G)=>({id:G.id,fileName:G.fileName,relativePath:G.relativePath,treePath:G.treePath})),tree:Y};await E.promises.writeFile(K.join(Q,"stories.json"),JSON.stringify(v,null,2));let L={theme:z.config.theme,responsivePresets:z.config.responsivePresets,backgroundPresets:z.config.backgroundPresets};await E.promises.writeFile(K.join(Q,"config.json"),JSON.stringify(L,null,2));let Z=K.join(Q,"stories");await E.promises.mkdir(Z,{recursive:!0});for(let G of P){let g=await E.promises.readFile(G.path,"utf-8");await E.promises.writeFile(K.join(Z,`${G.id}.stx`),g)}_(z);let T=$();await E.promises.writeFile(K.join(Q,"search-index.json"),T);let C=Date.now()-A;j(P.length,X,C)}function F(U){let{theme:A}=U.config,z=A.title||"STX Story";return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -8,4 +8,4 @@ function G(j,x){let g=j[x],v=x+1;while(v<j.length){if(j[v]==="\\"){v+=2;continue
|
|
|
8
8
|
`:" ",g++}x+=" ",g++;continue}if(z==="`"){x+=" ",g++;while(g<j.length&&j[g]!=="`"){if(j[g]==="\\"){x+=" ",g+=2;continue}if(j[g]==="$"&&j[g+1]==="{"){let B=g+2,D=F(j,B);if(x+=" ",x+=J(j.slice(B,D)),D<j.length)x+=" ";g=D+1;continue}x+=j[g]===`
|
|
9
9
|
`?`
|
|
10
10
|
`:" ",g++}x+=" ",g++;continue}x+=z,g++}return x}
|
|
11
|
-
export{F as
|
|
11
|
+
export{F as Js,J as Ks};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import{existsSync as U,statSync as V}from"fs";import z from"path";var W=/[*?[\]{}]/;function X(D){return W.test(D)}async function $(D,E={}){let H=E.cwd??process.cwd(),N=E.recursive!==!1,Q=E.ignorePaths??[],J=globalThis.Bun.Glob,K=new Set,F=(j)=>{if(j.includes(`${z.sep}node_modules${z.sep}`)||j.includes(`${z.sep}dist${z.sep}`))return;if(Q.some((q)=>q&&j.includes(z.normalize(q))))return;K.add(j)},R=async(j)=>{try{for await(let q of new J(j).scan({cwd:H,absolute:!0}))F(q)}catch{}};for(let j of D){if(!j)continue;if(X(j)){await R(j);continue}let q=z.resolve(H,j);if(!U(q))continue;if(V(q).isDirectory()){for await(let T of new J(N?"**/*.stx":"*.stx").scan({cwd:q,absolute:!0}))F(T);continue}F(q)}return[...K].sort()}
|
|
3
|
-
export{X as
|
|
3
|
+
export{X as Hs,$ as Is};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{M as
|
|
2
|
+
import{cs as E}from"./chunk-h7aynn48.js";import{Pu as D}from"./chunk-p3kn55v4.js";import I from"path";async function M(q={}){let G=performance.now(),J=q.root||process.cwd(),j=await E(),y=j.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${y.toUpperCase()}${j.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let A,B;if(y==="ssg"){let{generateStaticSite:z}=await import("./ssg.js");A=await z({pagesDir:I.join(j.root||".",j.pagesDir||j.build?.pagesDir||"pages"),publicDir:j.publicDir||j.build?.publicDir||"public",outputDir:j.build?.outputDir||"dist",generate404:j.build?.generate404??!0,minify:j.build?.minify??!0,cleanOutput:j.build?.cleanOutput??!0,...q.ssg})}else{let{buildForProduction:z}=await import("./chunk-zqxk361v.js");B=await z({outputDir:".output",debug:q.debug,...q.ssr})}let H=Math.round(performance.now()-G);return{mode:y,ssg:A,ssr:B,duration:H}}
|
|
3
|
+
export{M as kg};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
function D(j){return j}class F{plugins=new Map;sortedPlugins=[];initialized=!1;async register(j,q){if(this.plugins.has(j.name))throw Error(`Plugin "${j.name}" is already registered`);if(j.dependencies){for(let w of j.dependencies)if(!this.plugins.has(w))throw Error(`Plugin "${j.name}" depends on "${w}" which is not registered`)}if(this.plugins.set(j.name,j),j.onRegister)await j.onRegister(q);this.sortPlugins()}async unregister(j){let q=this.plugins.get(j);if(!q)return!1;for(let[w,z]of this.plugins)if(z.dependencies?.includes(j))throw Error(`Cannot unregister "${j}" because "${w}" depends on it`);if(q.onUnregister)await q.onUnregister();return this.plugins.delete(j),this.sortPlugins(),!0}get(j){return this.plugins.get(j)}has(j){return this.plugins.has(j)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let j=[];for(let q of this.sortedPlugins)if(q.registerDirectives)j.push(...q.registerDirectives());return j}getAllFilters(){let j={};for(let q of this.sortedPlugins)if(q.registerFilters)Object.assign(j,q.registerFilters());return j}async runBeforeProcess(j){return this.runHooks("beforeProcess",j)}async runAfterParse(j){return this.runHooks("afterParse",j)}async runBeforeDirective(j,q){return this.runDirectiveHooks("beforeDirective",j,q)}async runAfterDirective(j,q){return this.runDirectiveHooks("afterDirective",j,q)}async runBeforeRender(j){return this.runHooks("beforeRender",j)}async runAfterRender(j){return this.runHooks("afterRender",j)}async runOnError(j){for(let q of this.sortedPlugins)if(q.onError)try{let w=await q.onError(j);if(w){if(w.template!==void 0)j.template=w.template;if(w.context)j.context={...j.context,...w.context};if(w.metadata)j.metadata={...j.metadata,...w.metadata};if(w.skip)return j}}catch(w){console.error(`Error in plugin "${q.name}" onError hook:`,w)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort((j,q)=>(j.priority??100)-(q.priority??100))}async runHooks(j,q){let w={...q};for(let z of this.sortedPlugins){let B=z[j];if(B)try{let y=await B(w);if(y){if(y.template!==void 0)w.template=y.template;if(y.context)w.context={...w.context,...y.context};if(y.metadata)w.metadata={...w.metadata,...y.metadata};if(y.skip)break}}catch(y){console.error(`Error in plugin "${z.name}" ${j} hook:`,y)}}return w}async runDirectiveHooks(j,q,w){let z={...w};for(let B of this.sortedPlugins){let y=B[j];if(y)try{let A=await y(q,z);if(A){if(A.template!==void 0)z.template=A.template;if(A.context)z.context={...z.context,...A.context};if(A.metadata)z.metadata={...z.metadata,...A.metadata};if(A.skip)break}}catch(A){console.error(`Error in plugin "${B.name}" ${j} hook:`,A)}}return z}}var G=new F;function H(j,q,w={}){return{name:j,...w,registerDirectives:()=>q}}function I(j,q,w={}){return{name:j,...w,registerFilters:()=>q}}var J=D({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess(j){console.log("[stx-debug] beforeProcess:",j.filePath)},afterParse(j){console.log("[stx-debug] afterParse:",j.template.length,"chars")},beforeDirective(j,q){console.log("[stx-debug] beforeDirective:",j)},afterDirective(j,q){console.log("[stx-debug] afterDirective:",j)},beforeRender(j){console.log("[stx-debug] beforeRender")},afterRender(j){console.log("[stx-debug] afterRender:",j.template.length,"chars")},onError(j){console.error("[stx-debug] onError:",j.error.message,"in phase:",j.phase)}}),K=D({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess(j){j.metadata.startTime=performance.now()},afterRender(j){let q=j.metadata.startTime;if(q){let w=performance.now()-q;console.log(`[stx-timing] Processing took ${w.toFixed(2)}ms`)}}});function L(j){return D({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(q){return{context:{...q.context,...j}}}})}
|
|
3
|
-
export{D as
|
|
3
|
+
export{D as Yg,F as Zg,G as _g,H as $g,I as ah,J as bh,K as ch,L as dh};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
var j=["batch","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refresh","registerStoresClient","setRouteParams","state","untrack","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],X=["onMount","onDestroy"];function B(z="const",F=[],J){let Z=F.length?j.filter((Q)=>!F.includes(Q)):j;if(J!==void 0)Z=Z.filter((Q)=>{let $=Q.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${$}(?![\\w$])`).test(J)});return`${z} { ${Z.join(", ")} } = window.stx;`}var W=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],D={redirect:{category:"server-only",reason:"returns an HTTP Response for <script server>/edge/build; use navigate() on the client."},useAsyncData:{category:"browser-composable",reason:"inlined on demand from src/composables when a script references it; reachable, not a bare global."},Teleport:{category:"compile-time-directive",reason:"template tag resolved by processTeleportDirectives; not a script callable."},StxModalBuiltin:{category:"builtin-component",reason:"builtin component used as a template tag; drive open/close from the modal store."},StxToastBuiltin:{category:"builtin-component",reason:"builtin component used as a template tag; push toasts via the toast store."},useForm:{category:"browser-composable",reason:"reactive form primitive; lives in src/composables/use-form.ts and is inlined on demand when a <script client> references it (#1846)."},defineForm:{category:"browser-composable",reason:"deprecated alias of useForm, kept for a minor (#1843). Same delivery path \u2014 inlined on demand from src/composables/use-form.ts."},validateFields:{category:"isomorphic-import",reason:"pure validation helper; import it directly, not auto-delivered to <script client> (per client-api-delivery.test.ts)."},validateField:{category:"isomorphic-import",reason:"singular pure validation helper; same explicit-import boundary as validateFields."}},Y=j.filter((z)=>!W.includes(z));function V(z){if(!z)return!1;return Y.some((F)=>new RegExp(`\\b${F}\\s*(?:<[^>]*>)?\\s*\\(`).test(z))}var P=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],C=/\s@[a-z][\w.:-]*\s*=/i;function G(z){if(!z)return!1;let F=K(z);if(P.some((J)=>J.test(F)))return!0;return V(F)}function H(z){if(!z)return!1;return C.test(K(z))||G(z)}var f=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];function w(z){return f.includes(z.toLowerCase())}var q=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],U=["x-init","x-transition","x-effect","x-on"],M=[...q,...U];function O(){return`{${q.map((z)=>`'${z}':1`).join(",")}}`}function K(z){if(!z)return z;let F=(J)=>J.replace(/(<[^>]*>)|([^<]+)/g,(Z,Q,$)=>Q??" ".repeat($.length));return z.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(J,Z,Q,$)=>Z+F(Q)+$).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(J,Z,Q,$)=>Z+F(Q)+$).replace(/<!--[\s\S]*?-->/g,(J)=>" ".repeat(J.length))}
|
|
3
|
-
export{j as
|
|
3
|
+
export{j as Et,X as Ft,B as Gt,W as Ht,D as It,Y as Jt,V as Kt,G as Lt,H as Mt,f as Nt,w as Ot,q as Pt,U as Qt,M as Rt,O as St,K as Tt};
|
|
@@ -5,4 +5,4 @@ var P=new Map([["craft-button",{name:"Button",zigType:"craft.Button",props:[{nam
|
|
|
5
5
|
${F} [${U.join(`,
|
|
6
6
|
${F} `)}]`:"";return`Craft.create("${j.zigType}", ${Q}${W})`}function s(j,q,F){if(q.target==="universal"){let G=[];G.push("// Universal entry point"),G.push("");for(let[Q,U]of F)G.push(`// --- ${Q.toUpperCase()} ---`),G.push(`#if ${Q.toUpperCase()}`),G.push(U),G.push("#endif"),G.push("");return G.join(`
|
|
7
7
|
`)}return F.get(q.target)||J(j,q)}function r(j,q,F){let G=[];function Q(U){G.push({name:U.zigType,hash:D(JSON.stringify(U.props)),props:Object.keys(U.props),events:Array.from(U.events.keys()),slots:[],isNative:U.zigType.startsWith("craft.")});for(let W of U.children)Q(W)}return Q(q),{version:"1.0.0",components:G,entry:j.id,assets:[],styles:j.styles}}function p(j,q){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}var d=0;function E(){return`id_${++d}`}function D(j){let q=0;for(let F=0;F<j.length;F++){let G=j.charCodeAt(F);q=(q<<5)-q+G,q=q&q}return Math.abs(q).toString(36)}function l(j){return j.charAt(0).toUpperCase()+j.slice(1)}function i(j){let q=[],F=/<script[^>]*>([\s\S]*?)<\/script>/gi,G;while((G=F.exec(j))!==null)q.push(G[1]);return q}function a(j){let q=[],F=/<style[^>]*>([\s\S]*?)<\/style>/gi,G;while((G=F.exec(j))!==null)q.push(G[1]);return q}function B(j){let q=j.type==="component"?1:0;if(j.children)for(let F of j.children)q+=B(F);return q}function b(j){let q=j.zigType.startsWith("craft.")?1:0;for(let F of j.children)q+=b(F);return q}function o(j){return{start:async()=>{console.log("[craft-compiler] Hot reload server started")},stop:async()=>{console.log("[craft-compiler] Hot reload server stopped")},notifyChange:(q)=>{console.log(`[craft-compiler] File changed: ${q}`)}}}var t={compileToNative:k,createHotReloadServer:o,NATIVE_COMPONENTS:P},e=t;
|
|
8
|
-
export{P as
|
|
8
|
+
export{P as mk,k as nk,o as ok,e as pk};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Fu as y}from"./chunk-5ec3m8hk.js";import N from"fs";import B from"path";var Y="_stx";function L(M){return Bun.hash(M).toString(16).slice(0,8)}function T(M){let C=[],v=(q)=>{for(let g of N.readdirSync(q,{withFileTypes:!0})){let j=B.join(q,g.name);if(g.isDirectory())v(j);else if(g.isFile()&&j.endsWith(".html"))C.push(j)}};if(N.existsSync(M))v(M);return C}var S=[{pattern:/<script\b([^>]*\bdata-stx-runtime\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"runtime",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(M)=>`<script data-stx-runtime src="${M}"></script>`},{pattern:/<script\b([^>]*\bdata-stx-router\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"router",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(M)=>`<script data-stx-router src="${M}"></script>`},{pattern:/<style\b([^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*)>([\s\S]*?)<\/style>/gi,prefix:"crosswind",extension:"css",contentType:"text/css; charset=utf-8",replace:(M)=>`<link data-crosswind="generated" rel="stylesheet" href="${M}">`}];function _(M,C=`/${Y}`){let v=[],q=new Set,g=0,j=M;for(let G of S)j=j.replace(G.pattern,(R,K,W)=>{if(/\b(?:src|href)\s*=/.test(K)||!W.trim())return R;let Q=`${G.prefix}.${L(W)}.${G.extension}`;if(!q.has(Q))q.add(Q),v.push({filename:Q,contents:W,contentType:G.contentType});return g+=W.length,G.replace(`${C}/${Q}`)});return{html:j,assets:v,bytesInlined:g}}function a(M){let C={pages:0,assets:0,bytesInlined:0},v=B.join(M,Y),q=new Set;for(let g of T(M)){let j=N.readFileSync(g,"utf8"),{html:G,assets:R,bytesInlined:K}=_(j);if(G===j)continue;for(let W of R){if(q.has(W.filename))continue;q.add(W.filename),N.mkdirSync(v,{recursive:!0}),N.writeFileSync(B.join(v,W.filename),W.contents),C.assets++}N.writeFileSync(g,G),C.bytesInlined+=K,C.pages++}return C}import z from"fs";import P from"path";var I=1024,E=/<(script|style)\b([^>]*)>([\s\S]*?)<\/\1>/gi,d=new Set(["","module","text/javascript","application/javascript","module/javascript"]);function b(M){return Bun.hash(M).toString(16).slice(0,8)}function p(M){let C=[],v=(q)=>{for(let g of z.readdirSync(q,{withFileTypes:!0})){let j=P.join(q,g.name);if(g.isDirectory())v(j);else if(g.isFile()&&j.endsWith(".html"))C.push(j)}};if(z.existsSync(M))v(M);return C}function D(M,C){let v=M.match(new RegExp(`\\b${C}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i"));if(!v)return;return v[2]??v[3]??v[4]??""}function m(M,C,v){if(v.length<I)return!1;if(/\b(?:src|href)\s*=/i.test(C))return!1;if(M.toLowerCase()==="script"){if(!d.has((D(C,"type")??"").trim().toLowerCase()))return!1;return!0}return!0}function o(M){let C=[];for(let v of M.matchAll(/<template\b[^>]*>[\s\S]*?<\/template>/gi))C.push([v.index,v.index+v[0].length]);return C}function s(M){let C={pages:0,assets:0,bytesInlined:0},v=p(M);if(v.length<2)return C;let q=new Map,g=new Map;for(let Q of v){let O=z.readFileSync(Q,"utf8");q.set(Q,O);let x=o(O);for(let U of O.matchAll(E)){let[w,V,J,$]=U;if(!m(V,J,$))continue;if(x.some(([A,k])=>U.index>=A&&U.index<k))continue;let H=`${V.toLowerCase()}\x00${$}`,X=g.get(H);if(X)X.push({file:Q,whole:w,tag:V,attrs:J,body:$});else g.set(H,[{file:Q,whole:w,tag:V,attrs:J,body:$}])}}let j=[...g.values()].filter((Q)=>new Set(Q.map((O)=>O.file)).size>1);if(j.length===0)return C;let G=P.join(M,Y),R=new Map(q),K=new Map,W=[];for(let Q of j){let{tag:O,body:x}=Q[0],U=O.toLowerCase()==="script",w=`${U?"chunk":"style"}.${b(x)}.${U?"js":"css"}`;W.push({filename:w,contents:x,contentType:U?"text/javascript; charset=utf-8":"text/css; charset=utf-8"});let V=`/${Y}/${w}`;for(let J of Q){let $=U?`<script${J.attrs} src="${V}"></script>`:`<link${J.attrs} rel="stylesheet" href="${V}">`,H=R.get(J.file),X=H.replace(J.whole,()=>$);if(X===H)continue;R.set(J.file,X),K.set(J.file,(K.get(J.file)??0)+J.body.length)}}z.mkdirSync(G,{recursive:!0});for(let Q of W)z.writeFileSync(P.join(G,Q.filename),Q.contents),C.assets++;for(let[Q,O]of R){if(O===q.get(Q))continue;z.writeFileSync(Q,O),C.pages++,C.bytesInlined+=K.get(Q)??0}return C}y();import Z from"fs";import F from"path";var h="layout-types.d.ts";function f(M){let C=[],v=(q,g)=>{let j;try{j=Z.readdirSync(q,{withFileTypes:!0})}catch{return}for(let G of j){if(G.name.startsWith("."))continue;let R=F.join(q,G.name);if(G.isDirectory())v(R,g?`${g}/${G.name}`:G.name);else if(G.isFile()&&G.name.endsWith(".stx")&&G.name!=="_layout.stx"){let K=G.name.slice(0,-4);C.push(g?`${g}/${K}`:K)}}};return v(M,""),C.sort()}function c(M){let C=["// Auto-generated by stx \u2014 do not edit.","//","// Makes `definePageMeta({ layout })` reject a name with no layout behind it.","// Include this file in your tsconfig (it lives in the stx state directory,","// `.stx/` by default) for the check to apply.",""];if(M.length===0)return C.push("// No layouts found \u2014 `layout` stays typed as `string`.","export {}",""),C.join(`
|
|
3
3
|
`);return C.push("declare module '@stacksjs/stx' {"," interface KnownLayouts {",...M.map((v)=>` '${v}': true`)," }","}","","export {}",""),C.join(`
|
|
4
4
|
`)}function HM(M,C){if(!M)return[];let v=F.isAbsolute(M)?M:F.resolve(process.cwd(),M),q=f(v),g=c(q),j=F.join(C,h);try{if(Z.existsSync(j)&&Z.readFileSync(j,"utf8")===g)return q;Z.mkdirSync(C,{recursive:!0}),Z.writeFileSync(j,g)}catch{}return q}
|
|
5
|
-
export{Y as
|
|
5
|
+
export{Y as wk,_ as xk,a as yk,s as zk,h as Ak,f as Bk,c as Ck,HM as Dk};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{$h as P,Th as x,Yh as M,Zh as C,_h as v}from"./chunk-74cv4ta1.js";import{Pu as y}from"./chunk-p3kn55v4.js";import{resolve as h,basename as f,extname as u,join as m}from"path";import{mkdir as l}from"fs/promises";var I={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0};class z{config;constructor(J={}){this.config={...I,...J}}async get(J,Z){return C(J,Z,"image",this.config)}async set(J,Z,Y){return v(J,Z,Y,"image",this.config)}async clear(){return P("image",this.config)}updateConfig(J){this.config={...this.config,...J}}}var H=null;function S(J){if(!H)H=new z(J);else if(J)H.updateConfig(J);return H}async function w(J,Z,Y){let K=Y?{directory:`${Y.outputDir}/../.cache`}:{};return S(K).get(J,Z)}async function Q(J,Z,Y,K){let X=K?{directory:`${K.outputDir}/../.cache`}:{};return S(X).set(J,Z,Y)}async function d(){return S().clear()}async function R(){try{return await import("ts-images")}catch{return null}}function b(J){switch(J){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function p(J,Z){let Y=Z?b(Z):b("web"),K=J.formatQuality||{};return{jpeg:{...Y.jpeg,...K.jpeg},png:{...Y.png,...K.png},webp:{...Y.webp,...K.webp},avif:{...Y.avif,...K.avif}}}async function g(J,Z,Y){let K=await R();if(!K)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:J,processed:!1};let X=await w(J,Z,Y);if(X)return X;try{let N=h(J);if(!await M(N))return{src:J,processed:!1,errors:[`Source file not found: ${J}`]};let L=p(Y,Z.preset),V=Y.outputDir||"dist/images",F=Y.baseUrl||"/images";await l(V,{recursive:!0});let q=await x(N),U=f(J,u(J)),E=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],G={src:J,processed:!0,variants:[],hash:q},j=null;if(Z.transformations&&Z.transformations.length>0)j=await D(N,Z.transformations,K);for(let $ of E){let A=L[$]||{},W=`${U}-${q}.${$}`,_=m(V,W);try{let O=await K.optimizeImage({input:j||N,output:_,format:$,quality:A.quality,progressive:A.progressive});if(O){if(G.variants.push({path:_,url:`${F}/${W}`,width:O.width||0,height:O.height||0,format:$,size:O.outputSize||0}),!G.originalWidth&&O.width)G.originalWidth=O.width,G.originalHeight=O.height}}catch(O){G.errors=G.errors||[],G.errors.push(`Failed to optimize ${$}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let $=await K.generateThumbHash(N);G.placeholder=$.dataUrl}catch($){G.errors=G.errors||[],G.errors.push(`Failed to generate thumbhash: ${$}`)}if(Z.useDominantColor)try{let $=await K.generatePlaceholder(N,{strategy:"dominant-color"});G.dominantColor=$.dominantColor}catch($){G.errors=G.errors||[],G.errors.push(`Failed to extract dominant color: ${$}`)}return await Q(J,Z,G,Y),G}catch(N){return{src:J,processed:!1,errors:[`Processing failed: ${N}`]}}}async function n(J,Z,Y,K){let X=await R();if(!X)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await X.optimizeImage({input:J,output:K,format:Z,quality:Y}))?.outputSize}}catch(N){return{success:!1,error:String(N)}}}async function D(J,Z,Y){let K=Y||await R();if(!K)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let X=await K.decode(J);for(let N of Z){let L=N.options||{};switch(N.type){case"resize":if(L.width||L.height)X=await K.resize(X,{width:L.width,height:L.height,fit:L.fit});break;case"blur":if(L.sigma!==void 0)X=await K.blur(X,L.sigma);break;case"sharpen":if(L.amount!==void 0)X=await K.sharpen(X,L.amount);break;case"grayscale":X=await K.grayscale(X);break;case"rotate":if(L.angle!==void 0)X=await K.rotate(X,L.angle);break;case"flip":X=await K.flip(X);break;case"flop":X=await K.flop(X);break;case"brightness":if(L.value!==void 0)X=await K.brightness(X,L.value);break;case"contrast":if(L.value!==void 0)X=await K.contrast(X,L.value);break;case"saturation":if(L.value!==void 0)X=await K.saturation(X,L.value);break}}return await K.encode(X,"png")}catch(X){return console.error(`[stx-media] Transformation failed: ${X}`),null}}import{resolve as c,basename as i,extname as r,join as o}from"path";import{mkdir as a}from"fs/promises";async function e(){try{return await import("ts-images")}catch{return null}}var s=[320,480,640,768,1024,1280,1536,1920];async function t(J,Z,Y){let K=await e();if(!K)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let X=c(J);if(!await M(X))return console.warn(`[stx-media] Source file not found: ${J}`),null;try{let N=Z.responsiveWidths||Y.breakpoints||s,L=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],V=Y.outputDir||"dist/images",F=Y.baseUrl||"/images";await a(V,{recursive:!0});let q=await x(X),U=i(J,r(J)),E=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},G={src:J,byFormat:{},srcsets:{}};for(let $ of L){G.byFormat[$]=[];let A=[];for(let W of N){let _=`${U}-${W}w-${q}.${$}`,O=o(V,_),B=`${F}/${_}`;try{let T=E[$]?.quality||80;if(await M(O)){G.byFormat[$].push({path:O,url:B,width:W,height:0,format:$,size:0}),A.push(`${B} ${W}w`);continue}let k=await K.processImage({input:X,output:O,format:$,quality:T,resize:{width:W}});if(k)G.byFormat[$].push({path:O,url:B,width:W,height:k.height||Math.round(W*(k.height||1)/(k.width||1)),format:$,size:k.outputSize||0}),A.push(`${B} ${W}w`)}catch(T){console.warn(`[stx-media] Failed to generate ${$} at ${W}w: ${T}`)}}G.srcsets[$]=A.join(", ")}let j=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(j!=="none")try{if(j==="thumbhash"){let $=await K.generateThumbHash(X);G.placeholder={dataURL:$.dataUrl,width:$.width||32,height:$.height||32,strategy:"thumbhash"}}else{let $=await K.generatePlaceholder(X,{strategy:j,width:20});G.placeholder={dataURL:$.dataURL,width:$.width,height:$.height,strategy:j}}}catch($){console.warn(`[stx-media] Failed to generate placeholder: ${$}`)}return G.sizes=Z.sizes||JJ(N),G}catch(N){return console.error(`[stx-media] Responsive generation failed: ${N}`),null}}function JJ(J){let Z=[...J].sort((K,X)=>K-X),Y=[];for(let K=0;K<Z.length-1;K++){let X=Z[K];Y.push(`(max-width: ${X}px) ${X}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function KJ(J,Z="width"){if(!J||J.length===0)return"";if(Z==="dpr")return J.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return J.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}export{z as Kh,w as Lh,Q as Mh,d as Nh,g as Oh,n as Ph,D as Qh,t as Rh,KJ as Sh};
|