@stacksjs/bun-router 0.0.26 → 0.1.0
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-0gjq8ttx.js +14 -0
- package/dist/chunk-0t5vz87j.js +35 -0
- package/dist/chunk-30rkn2ym.js +2 -0
- package/dist/chunk-38cmrard.js +2 -0
- package/dist/chunk-3qna6dwd.js +2 -0
- package/dist/chunk-4d5fmta0.js +2 -0
- package/dist/chunk-4x3b4b4q.js +2 -0
- package/dist/chunk-5be9x5cq.js +3 -0
- package/dist/chunk-5mxby3fd.js +1654 -0
- package/dist/chunk-5n0ckcmc.js +3 -0
- package/dist/chunk-5ncn73tp.js +3 -0
- package/dist/chunk-5s0pnsd6.js +12 -0
- package/dist/chunk-5s1pr62n.js +3 -0
- package/dist/chunk-67wgad4f.js +60 -0
- package/dist/chunk-6bbmkwng.js +3 -0
- package/dist/chunk-6s1kbajm.js +7851 -0
- package/dist/chunk-6sjvhy5f.js +3 -0
- package/dist/chunk-6xed4va1.js +2 -0
- package/dist/chunk-73k79n7q.js +15413 -0
- package/dist/chunk-748n6ydj.js +2 -0
- package/dist/chunk-7qnxdedn.js +321 -0
- package/dist/chunk-7rsf8tes.js +898 -0
- package/dist/chunk-8aspmtf1.js +2 -0
- package/dist/chunk-8wpj3fqe.js +351 -0
- package/dist/chunk-8yfdg595.js +2 -0
- package/dist/chunk-90eze7av.js +3 -0
- package/dist/chunk-9805tt8n.js +341 -0
- package/dist/chunk-9dvwyej7.js +2 -0
- package/dist/chunk-9ght4n4r.js +216 -0
- package/dist/chunk-a2w45krb.js +2 -0
- package/dist/chunk-a3wahyg7.js +3 -0
- package/dist/chunk-a547f2ab.js +48 -0
- package/dist/chunk-bqdycvtc.js +2 -0
- package/dist/chunk-brpgjyqg.js +3 -0
- package/dist/chunk-cd03rk3x.js +2 -0
- package/dist/chunk-csfrpsp7.js +185 -0
- package/dist/chunk-ct0m17q5.js +2 -0
- package/dist/chunk-dhbvvr5h.js +2 -0
- package/dist/chunk-dhptcsya.js +943 -0
- package/dist/chunk-dq93zag9.js +2 -0
- package/dist/chunk-dxg045wj.js +5 -0
- package/dist/chunk-e3qej0jr.js +4 -0
- package/dist/chunk-edrtesh7.js +2 -0
- package/dist/chunk-ejcws37w.js +2 -0
- package/dist/chunk-ex5fkjah.js +397 -0
- package/dist/chunk-ex890p45.js +51 -0
- package/dist/chunk-f69cpnhw.js +2 -0
- package/dist/chunk-fjf53b44.js +2 -0
- package/dist/chunk-fjzye4qj.js +2 -0
- package/dist/chunk-gfd23b6t.js +2 -0
- package/dist/chunk-habv0vef.js +12 -0
- package/dist/chunk-hmgedrmr.js +11 -0
- package/dist/chunk-hz6fc788.js +2 -0
- package/dist/chunk-jff6j9y3.js +10 -0
- package/dist/chunk-jmeb7n8k.js +70 -0
- package/dist/chunk-jrf5a2ap.js +2 -0
- package/dist/chunk-jy2jhcpy.js +246 -0
- package/dist/chunk-kc659vhx.js +4 -0
- package/dist/chunk-kjtjbcq4.js +71 -0
- package/dist/chunk-krkchy8v.js +4 -0
- package/dist/chunk-kxp888dn.js +4540 -0
- package/dist/chunk-m249t3je.js +3 -0
- package/dist/chunk-m9yabnjx.js +2 -0
- package/dist/chunk-mekrq9wd.js +2 -0
- package/dist/chunk-mmxv535f.js +82 -0
- package/dist/chunk-mypn7jss.js +2 -0
- package/dist/chunk-n18x1k3c.js +2 -0
- package/dist/chunk-nkddjzsa.js +2 -0
- package/dist/chunk-pjmhqmr9.js +2 -0
- package/dist/chunk-qyrnsaq1.js +2 -0
- package/dist/chunk-r19ff2qm.js +62 -0
- package/dist/chunk-r338fssq.js +2 -0
- package/dist/chunk-s36z58x2.js +29 -0
- package/dist/chunk-s3dn1kwx.js +231 -0
- package/dist/chunk-s79dd325.js +471 -0
- package/dist/chunk-sw0chtw4.js +4 -0
- package/dist/chunk-ta38j9em.js +2 -0
- package/dist/chunk-tpfgntwj.js +4211 -0
- package/dist/chunk-vr10sbbh.js +3 -0
- package/dist/chunk-vsh4390q.js +358 -0
- package/dist/chunk-vv3gb1m5.js +84 -0
- package/dist/chunk-vw8rwv6e.js +2 -0
- package/dist/chunk-w4r464v5.js +288 -0
- package/dist/chunk-wcrqs5z9.js +2 -0
- package/dist/chunk-x6d1rmwa.js +2 -0
- package/dist/chunk-x7ft15zz.js +2 -0
- package/dist/chunk-x8trwn7j.js +3 -0
- package/dist/chunk-xg9xscqz.js +1 -0
- package/dist/chunk-xhepdj1f.js +2 -0
- package/dist/chunk-xv2em0q4.js +4 -0
- package/dist/chunk-ypw6g0te.js +2 -0
- package/dist/chunk-z8szsm21.js +2 -0
- package/dist/chunk-zetqzgf3.js +194 -0
- package/dist/chunk-zfbh14qe.js +2 -0
- package/dist/chunk-zhx0hxdd.js +28 -0
- package/dist/cli.js +67 -3240
- package/dist/container/index.js +1 -321
- package/dist/index.js +80 -13987
- package/dist/types.d.ts +12 -2
- package/package.json +1 -1
- package/dist/chunk-1ahs68ys.js +0 -18
- package/dist/chunk-cgptvjdf.js +0 -18131
- package/dist/chunk-g3ybefhg.js +0 -1923
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Au as g,Bu as h,Cu as i,Du as j,Eu as k,uu as a,vu as b,wu as c,xu as d,yu as e,zu as f}from"./chunk-s36z58x2.js";import"./chunk-5n0ckcmc.js";import"./chunk-a3wahyg7.js";export{c as setCachedVideoResult,k as processVideo,b as getCachedVideoResult,f as generateThumbnails,g as generateSpriteSheet,e as generatePoster,h as generateHLSManifest,i as generateDASHManifest,d as clearVideoCache,j as analyzeVideo,a as VideoProcessorCache};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{$m as b,_m as a,an as c,bn as d,cn as e,dn as f,en as g,fn as h,gn as i,hn as j,in as k}from"./chunk-jff6j9y3.js";import"./chunk-jmeb7n8k.js";import"./chunk-a3wahyg7.js";export{c as resetCssCache,d as resetCrosswindCache,g as rebuildCrosswindCSS,e as loadCrosswindConfig,b as loadCrosswind,k as injectCrosswindCSS,a as getCrosswindServeAsset,h as getCachedCSS,j as generateCrosswindCSS,i as extractClassNames,f as buildCrosswindCSS};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
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-tpfgntwj.js";import"./chunk-jff6j9y3.js";import"./chunk-csfrpsp7.js";import"./chunk-0t5vz87j.js";import"./chunk-krkchy8v.js";import"./chunk-brpgjyqg.js";import"./chunk-5mxby3fd.js";import"./chunk-5be9x5cq.js";import"./chunk-jmeb7n8k.js";import"./chunk-kc659vhx.js";import"./chunk-a3wahyg7.js";export{g as usesSignalsInScript,n as unescapeHtml,c as registerFilters,b as registerFilter,k as processExpressions,j as interpolateScriptsInTemplate,h as interpolateScriptExpressions,i as interpolateScriptAttributes,d as getAllFilters,m as evaluateExpression,f as escapeHtml,a as defaultFilters,e as clearCustomFilters,l as applyFilters};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{$s as H,$t as Ha,As as g,At as ga,Bs as h,Bt as ha,Cs as i,Ct as ia,Ds as j,Dt as ja,Es as k,Et as ka,Fs as l,Ft as la,Gs as m,Gt as ma,Hs as n,Ht as na,Is as o,It as oa,Js as p,Jt as pa,Ks as q,Kt as qa,Ls as r,Lt as ra,Ms as s,Mt as sa,Ns as t,Nt as ta,Os as u,Ot as ua,Ps as v,Pt as va,Qs as w,Qt as wa,Rs as x,Rt as xa,Ss as y,St as ya,Ts as z,Tt as za,Us as A,Ut as Aa,Vs as B,Vt as Ba,Ws as C,Wt as Ca,Xs as D,Xt as Da,Ys as E,Yt as Ea,Zs as F,Zt as Fa,_s as G,_t as Ga,at as I,au as Ia,bt as J,bu as Ja,ct as K,cu as Ka,dt as L,du as La,et as M,eu as Ma,ft as N,fu as Na,gt as O,gu as Oa,ht as P,hu as Pa,it as Q,iu as Qa,jt as R,ju as Ra,kt as S,ku as Sa,lt as T,mt as U,nt as V,ot as W,pt as X,qt as Y,rt as Z,st as _,tt as $,us as a,ut as aa,vs as b,vt as ba,ws as c,wt as ca,xs as d,xt as da,ys as e,yt as ea,zs as f,zt as fa}from"./chunk-jy2jhcpy.js";import"./chunk-a3wahyg7.js";export{A as watchFiles,q as trim,oa as toColorSpace,g as toCodecData,ia as tint,wa as thumbHashToRGBA,Aa as thumbHashToDataURL,xa as thumbHashToAverageRGBA,ya as thumbHashToApproximateAspectRatio,ba as threshold,ma as srgbToLinear,Oa as splatHashToRgba,Ra as splatHashToDataURL,Pa as splatHashToBase64,Qa as splatHashFromBase64,Z as sobelEdgeDetection,X as sharpenConvolution,W as sharpen,d as setPixel,ea as sepia,i as rotate90,k as rotate270,j as rotate180,h as rotate,va as rgbaToThumbHash,Ma as rgbaToSplatHash,za as rgbaToDataURL,ka as rgbToHsl,S as resizeLanczos,R as resizeBilinear,Q as resizeBicubic,T as resize,I as processSvg,ua as processMultiple,H as processImage,ta as process,G as printSummary,E as parseFileSize,J as optimizeSvg,O as optimizeImage,ha as normalize,ca as modulate,na as linearToSrgb,r as jpegExifOrientation,B as isPathMatching,da as invert,K as imageToSvg,Na as imageToSplatHash,la as hslToRgb,aa as grayscale,e as getPixelBilinear,c as getPixel,v as getMetadata,z as getFiles,ja as getDominantColor,Ba as generateThumbHash,Fa as generateSprite,Ia as generateSocialImages,Ja as generateResponsiveImages,x as generateReport,L as generatePlaceholder,Sa as generatePictureSet,Ca as generateMacOSAppIcons,Ka as generateImageSet,Da as generateIOSAppIcons,Ga as generateFavicons,Ea as generateAppIcons,ga as gamma,f as fromCodecData,F as formatBytes,m as flop,l as flip,C as filterPaths,o as extract,p as extend,u as encode,_ as emboss,t as decode,D as debugLog,n as crop,ra as createSolidColor,sa as createLinearGradient,a as createImageData,Y as convolve,M as convertImageFormat,fa as contrast,y as config,qa as compositeMultiple,pa as composite,b as cloneImageData,V as boxBlur,U as blur,N as batchProcessImages,P as applyWatermark,s as applyExifOrientation,w as analyzeImage,Ha as _internals,La as SPLATHASH_TARGET_SIZE,$ as KERNELS};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{If as O,Jf as T}from"./chunk-dxg045wj.js";import{gj as I}from"./chunk-tpfgntwj.js";import{Vm as A}from"./chunk-jff6j9y3.js";import"./chunk-csfrpsp7.js";import"./chunk-0t5vz87j.js";import"./chunk-krkchy8v.js";import"./chunk-brpgjyqg.js";import"./chunk-5mxby3fd.js";import{Mo as L}from"./chunk-5be9x5cq.js";import"./chunk-jmeb7n8k.js";import"./chunk-kc659vhx.js";import"./chunk-a3wahyg7.js";import o from"path";import p from"fs";var X=5,M=1;function Z(n=process.env){return n.STX_DEBUG==="true"||n.STX_DEBUG==="1"}function b(...n){if(Z())console.log("[stx:bundler]",...n)}var R=[];function q(n,i,c){R.push({filePath:n||"<inline>",message:i,details:c})}function oe(){return R.slice()}function ie(){R.length=0}var _;function ce(n){_=n}function G(){if(_)return _;try{let n=I.strict;return typeof n==="object"&&n!==null?n.bundlerFallback??"warn":"warn"}catch{return"warn"}}var k=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function ae(n){let i=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,c;while((c=i.exec(n))!==null){let d=c[1];if(!k.some((s)=>s.test(d)))return b("detected user import:",d),!0}let f=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((c=f.exec(n))!==null){let d=c[1];if(/\.css(?:\?.*)?$/.test(d))continue;if(!k.some((s)=>s.test(d)))return b("detected side-effect import:",d),!0}return!1}function Q(n,i,c,f){let d=(s,t)=>{let e=s===c?i:o.dirname(s),r=o.resolve(e,t),u=[r,`${r}.ts`,`${r}.tsx`,`${r}.js`,`${r}.mjs`,`${r}.jsx`,o.join(r,"index.ts"),o.join(r,"index.tsx"),o.join(r,"index.js"),o.join(r,"index.mjs")];for(let h of u)try{if(p.existsSync(h)&&p.statSync(h,{throwIfNoEntry:!1})?.isFile())return h}catch{}return r};return{name:"stx-client-bundle",setup(s){s.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(t)=>({path:t.path,external:!0})),s.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(t)=>({path:t.path,external:!0})),s.onResolve({filter:/^\//},(t)=>{if(p.existsSync(t.path))return{path:t.path};return{path:t.path,external:!0}}),s.onResolve({filter:/^\.\.?\//},(t)=>{let e=d(t.importer,t.path);return f.add(e),{path:e}}),s.onResolve({filter:/^[@~]\//},(t)=>{let e=o.resolve(n,t.path.slice(2)),r=[e,`${e}.ts`,`${e}.tsx`,`${e}.js`,`${e}.mjs`,`${e}.jsx`,o.join(e,"index.ts"),o.join(e,"index.tsx"),o.join(e,"index.js"),o.join(e,"index.mjs")];for(let u of r)if(p.existsSync(u)&&p.statSync(u,{throwIfNoEntry:!1})?.isFile())return b(`resolved ${t.path[0]}/ import:`,t.path,"\u2192",u),f.add(u),{path:u};return console.warn(`[stx:bundler] could not resolve ${t.path[0]}/ import:`,t.path),{path:e}}),s.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(t)=>{let e=o.extname(t.path).toLowerCase(),r=e===".json"?"json":e===".tsx"?"tsx":e===".jsx"?"jsx":e===".ts"||e===".mts"||e===".cts"?"ts":"js";if(t.path!==c)f.add(t.path);return{contents:p.readFileSync(t.path,"utf8"),loader:r}})}}}var D=new Map,C=Symbol.for("stx.client-bundle-build-queue");function K(n){let i=globalThis,c=(i[C]??Promise.resolve()).then(n,n);return i[C]=c.then(()=>{return},()=>{return}),c}async function le(n,i,c={}){let f=c.projectRoot||process.cwd(),d=c.minify??!1,s=c.cacheDir||A(f,"bundle-cache"),t=new Bun.CryptoHasher("md5");t.update(`${X}\x00${n}\x00${i}`);let e=t.digest("hex").slice(0,12),r=o.join(s,`${e}.js`),u=o.join(s,`${e}.deps.json`),h=Bun.file(r);if(await h.exists()){let x=Bun.file(u),w=!0;if(await x.exists())try{let v=JSON.parse(await x.text());if(v.metadataVersion!==M||!Array.isArray(v.files))w=!1;for(let m of Array.isArray(v.files)?v.files:[])try{if(p.statSync(m.path).mtimeMs!==m.mtimeMs){w=!1;break}}catch{w=!1;break}}catch{w=!1}if(w)return b("cache hit:",e),await h.text();b("cache invalidated by dep change:",e)}let g=D.get(e);if(g)return await g;let B=K(()=>W(n,i,{projectRoot:f,minify:d,cacheDir:s,hash:e,cachePath:r,depsPath:u}));D.set(e,B);try{return await B}finally{D.delete(e)}}async function W(n,i,c){let{projectRoot:f,minify:d,cacheDir:s,hash:t,cachePath:e,depsPath:r}=c,u=A(f,"bundle-tmp"),h=o.join(u,`${t}.ts`),g=o.join(u,"out",t);p.mkdirSync(u,{recursive:!0}),p.mkdirSync(g,{recursive:!0});let B=o.dirname(i),x=[],w=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,v=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,m;while((m=w.exec(n))!==null){if(m[1])continue;if(m[2])m[2].split(",").forEach(($)=>{let l=$.split(":")[0].trim();if(l)x.push(l)});else if(m[3])x.push(m[3])}while((m=v.exec(n))!==null){if(m[1])continue;x.push(m[2])}let U=x.length>0?`
|
|
3
|
+
export { ${x.join(", ")} }`:"";await Bun.write(h,n+U),b("bundling:",t,"from:",o.basename(i));let N=new Set;try{let $=await Bun.build({entrypoints:[h],outdir:g,target:"browser",format:"esm",minify:d,plugins:[Q(f,B,h,N)],define:{"process.env.NODE_ENV":d?'"production"':'"development"',...L()},root:f});if(!$.success){let a=$.logs.filter((j)=>j.level==="error").map((j)=>j.message).join(", ");return console.warn("[stx:bundler] build failed:",a),n}let l="";for(let a of $.outputs){l=await a.text();break}let y=[];for(let a of l.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let j of a[1].split(",")){let S=j.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(S){y.push([S[2],S[1]]);continue}let E=j.trim();if(/^[A-Za-z_$][\w$]*$/.test(E))y.push([E,E])}let V=l.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];l=l.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let F=`__stxBundle_${t}`,J=y.map(([a,j])=>`${JSON.stringify(a)}: ${j}`).join(", "),z=y.map(([a])=>`var ${a} = undefined;`).join(`
|
|
4
|
+
`),H=y.map(([a])=>`${a} = ${F}[${JSON.stringify(a)}];`).join(`
|
|
5
|
+
`);if(l=`${V.join(`
|
|
6
|
+
`)}
|
|
7
|
+
${z}
|
|
8
|
+
var ${F} = (function() {
|
|
9
|
+
${l}
|
|
10
|
+
return { ${J} };
|
|
11
|
+
})();
|
|
12
|
+
${H}`.trim(),b("bundled:",t,"output:",l.length,"bytes"),x.length>0&&y.length===0)return console.warn(`[stx:bundler] dropped every binding for ${o.basename(i)} (${t}); serving the unbundled source and not caching this result`),n;p.mkdirSync(s,{recursive:!0}),await Bun.write(e,l);let P=Array.from(N).map((a)=>{try{return{path:a,mtimeMs:p.statSync(a).mtimeMs}}catch{return null}}).filter((a)=>a!==null);return await Bun.write(r,JSON.stringify({metadataVersion:M,files:P})),l}catch($){let l=O($,i||void 0),y=T($,i||void 0);if(console.warn(`[stx:bundler] error: ${y}`),q(i||"",y,l),G()==="error")throw $;return n}finally{try{p.rmSync(h,{force:!0}),p.rmSync(g,{recursive:!0,force:!0})}catch{}}}export{Z as shouldLogBundlerDiagnostics,ce as setBundlerFallbackMode,G as resolveBundlerFallback,q as recordBundleFailure,K as queueClientBundleBuild,ae as hasUserImports,oe as getBundleFailures,ie as clearBundleFailures,le as bundleClientScript};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ff as x,Gf as v,Hf as i}from"./chunk-e3qej0jr.js";import{fj as b,og as w,pg as g}from"./chunk-tpfgntwj.js";import{Un as S}from"./chunk-brpgjyqg.js";import{Mo as $}from"./chunk-5be9x5cq.js";import l from"path";var c=new Map;function B(a,s){for(let n of a.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(n[1])s.add(n[1]);for(let n of a.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let o of(n[1]??"").split(",")){let r=((o.includes(":")?o.split(":").pop():o)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(r))s.add(r)}for(let n of a.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let o of(n[1]??"").split(",")){let r=o.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(r))s.add(r)}}async function E(a){let s;if(a)s=l.resolve(a);else{let t=await b();s=l.resolve(t.root||process.cwd(),t.storesDir||"stores")}let n=new Bun.Glob("*.ts"),o=[];try{for await(let t of n.scan({cwd:s,absolute:!0})){let e=l.basename(t,".ts");if(["index","types"].includes(e))continue;if(t.includes(".d.ts"))continue;o.push(t)}}catch{return i(c,s,"",""),null}let r=x(o),u=v(c,s,r);if(u!==void 0)return u||null;if(o.length===0)return i(c,s,r,""),null;let f=[];for(let t of o){let e=await Bun.file(t).text();f.push({file:t,hasUseStore:/useStore\s*\(/.test(e)})}f.sort((t,e)=>{if(t.hasUseStore===e.hasUseStore)return 0;return t.hasUseStore?1:-1});let _=f.map((t)=>t.file),p=[],m=new Set,A=new Bun.Transpiler({loader:"ts",target:"browser",define:$()});for(let t of _)try{let e=await Bun.file(t).text(),y=l.basename(t,".ts");B(e,m),e=w(e),e=g(e),e=e.replace(/^export\s+(default\s+)?/gm,""),e=A.transformSync(e),p.push(`// Store: ${y}
|
|
3
|
+
${e.trim()}`)}catch(e){console.warn(`[stx] Failed to load store ${t}:`,e)}if(p.length===0)return i(c,s,r,""),null;let d=p.join(`
|
|
4
|
+
|
|
5
|
+
`),h=`;(function(){
|
|
6
|
+
var __stx = window.stx || {};
|
|
7
|
+
${S.filter((t)=>!m.has(t)&&new RegExp(`\\b${t}\\b`).test(d)).map((t)=>`var ${t} = __stx[${JSON.stringify(t)}];`).join(`
|
|
8
|
+
`)}
|
|
9
|
+
${d}
|
|
10
|
+
})();`;return i(c,s,r,h),h}function F(){c.clear()}
|
|
11
|
+
export{E as Bf,F as Cf};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Fu as x,Ku as d,Lu as R,Mu as k,Nu as D}from"./chunk-5n0ckcmc.js";import{Zu as T}from"./chunk-a3wahyg7.js";import{resolve as H,basename as E,dirname as se,extname as W,join as V}from"path";import{mkdir as A,writeFile as ne}from"fs/promises";var Q={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0};class S{config;constructor(e={}){this.config={...Q,...e}}async get(e,i){return R(e,i,"image",this.config)}async set(e,i,r){return k(e,i,r,"image",this.config)}async clear(){return D("image",this.config)}updateConfig(e){this.config={...this.config,...e}}}var b=null;function q(e){if(!b)b=new S(e);else if(e)b.updateConfig(e);return b}async function v(e,i,r){let t=r?{directory:`${r.outputDir}/../.cache`}:{};return q(t).get(e,i)}async function $(e,i,r,t){let a=t?{directory:`${t.outputDir}/../.cache`}:{};return q(a).set(e,i,r)}async function L(){return q().clear()}async function F(){try{return await import("./chunk-gfd23b6t.js")}catch{return null}}function P(e){switch(e){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 B(e,i){let r=i?P(i):P("web"),t=e.formatQuality||{};return{jpeg:{...r.jpeg,...t.jpeg},png:{...r.png,...t.png},webp:{...r.webp,...t.webp},avif:{...r.avif,...t.avif}}}async function M(e,i,r){let t=await F();if(!t)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:e,processed:!1};let a=await v(e,i,r);if(a)return a;try{let u=H(e);if(!await d(u))return{src:e,processed:!1,errors:[`Source file not found: ${e}`]};let n=B(r,i.preset),m=r.outputDir||"dist/images",I=r.baseUrl||"/images";await A(m,{recursive:!0});let w=await x(u),C=E(e,W(e)),z=i.outputFormat?[i.outputFormat]:r.defaultFormats||["avif","webp","jpeg"],o={src:e,processed:!0,variants:[],hash:w},h=null;if(i.transformations&&i.transformations.length>0)h=await U(u,i.transformations,t);for(let s of z){let p=n[s]||{},l=`${C}-${w}.${s}`,g=V(m,l);try{let c=await t.optimizeImage({input:h||u,output:g,format:s,quality:p.quality,progressive:p.progressive});if(c){if(o.variants.push({path:g,url:`${I}/${l}`,width:c.width||0,height:c.height||0,format:s,size:c.outputSize||0}),!o.originalWidth&&c.width)o.originalWidth=c.width,o.originalHeight=c.height}}catch(c){o.errors=o.errors||[],o.errors.push(`Failed to optimize ${s}: ${c}`)}}if(i.embedThumbhash||i.placeholder==="thumbhash")try{let s=await t.generateThumbHash(u);o.placeholder=s.dataUrl}catch(s){o.errors=o.errors||[],o.errors.push(`Failed to generate thumbhash: ${s}`)}if(i.useDominantColor)try{let s=await t.generatePlaceholder(u,{strategy:"dominant-color"});o.dominantColor=s.dominantColor}catch(s){o.errors=o.errors||[],o.errors.push(`Failed to extract dominant color: ${s}`)}return await $(e,i,o,r),o}catch(u){return{src:e,processed:!1,errors:[`Processing failed: ${u}`]}}}async function O(e,i,r,t){let a=await F();if(!a)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await a.optimizeImage({input:e,output:t,format:i,quality:r}))?.outputSize}}catch(u){return{success:!1,error:String(u)}}}async function U(e,i,r){let t=r||await F();if(!t)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let a=await t.decode(e);for(let u of i){let n=u.options||{};switch(u.type){case"resize":if(n.width||n.height)a=await t.resize(a,{width:n.width,height:n.height,fit:n.fit});break;case"blur":if(n.sigma!==void 0)a=await t.blur(a,n.sigma);break;case"sharpen":if(n.amount!==void 0)a=await t.sharpen(a,n.amount);break;case"grayscale":a=await t.grayscale(a);break;case"rotate":if(n.angle!==void 0)a=await t.rotate(a,n.angle);break;case"flip":a=await t.flip(a);break;case"flop":a=await t.flop(a);break;case"brightness":if(n.value!==void 0)a=await t.brightness(a,n.value);break;case"contrast":if(n.value!==void 0)a=await t.contrast(a,n.value);break;case"saturation":if(n.value!==void 0)a=await t.saturation(a,n.value);break}}return await t.encode(a,"png")}catch(a){return console.error(`[stx-media] Transformation failed: ${a}`),null}}import{resolve as _,basename as N,extname as G,join as J}from"path";import{mkdir as K}from"fs/promises";async function X(){try{return await import("./chunk-gfd23b6t.js")}catch{return null}}var Y=[320,480,640,768,1024,1280,1536,1920];async function Z(e,i,r){let t=await X();if(!t)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let a=_(e);if(!await d(a))return console.warn(`[stx-media] Source file not found: ${e}`),null;try{let u=i.responsiveWidths||r.breakpoints||Y,n=i.formats||r.defaultFormats||["avif","webp","jpeg"],m=r.outputDir||"dist/images",I=r.baseUrl||"/images";await K(m,{recursive:!0});let w=await x(a),C=N(e,G(e)),z=r.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},o={src:e,byFormat:{},srcsets:{}};for(let s of n){o.byFormat[s]=[];let p=[];for(let l of u){let g=`${C}-${l}w-${w}.${s}`,c=J(m,g),y=`${I}/${g}`;try{let j=z[s]?.quality||80;if(await d(c)){o.byFormat[s].push({path:c,url:y,width:l,height:0,format:s,size:0}),p.push(`${y} ${l}w`);continue}let f=await t.processImage({input:a,output:c,format:s,quality:j,resize:{width:l}});if(f)o.byFormat[s].push({path:c,url:y,width:l,height:f.height||Math.round(l*(f.height||1)/(f.width||1)),format:s,size:f.outputSize||0}),p.push(`${y} ${l}w`)}catch(j){console.warn(`[stx-media] Failed to generate ${s} at ${l}w: ${j}`)}}o.srcsets[s]=p.join(", ")}let h=i.placeholder||r.placeholderStrategy||"thumbhash";if(h!=="none")try{if(h==="thumbhash"){let s=await t.generateThumbHash(a);o.placeholder={dataURL:s.dataUrl,width:s.width||32,height:s.height||32,strategy:"thumbhash"}}else{let s=await t.generatePlaceholder(a,{strategy:h,width:20});o.placeholder={dataURL:s.dataURL,width:s.width,height:s.height,strategy:h}}}catch(s){console.warn(`[stx-media] Failed to generate placeholder: ${s}`)}return o.sizes=i.sizes||ee(u),o}catch(u){return console.error(`[stx-media] Responsive generation failed: ${u}`),null}}function ee(e){let i=[...e].sort((t,a)=>t-a),r=[];for(let t=0;t<i.length-1;t++){let a=i[t];r.push(`(max-width: ${a}px) ${a}px`)}return r.push(`${i[i.length-1]}px`),r.join(", ")}function te(e,i="width"){if(!e||e.length===0)return"";if(i==="dpr")return e.filter((r)=>r.dpr).map((r)=>`${r.url} ${r.dpr}x`).join(", ");return e.map((r)=>`${r.url} ${r.width}w`).join(", ")}export{S as lu,v as mu,$ as nu,L as ou,M as pu,O as qu,U as ru,Z as su,te as tu};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Zo as te}from"./chunk-jmeb7n8k.js";import{Zu as se}from"./chunk-a3wahyg7.js";import r from"path";function J(s){return typeof s==="object"&&s!==null&&!Array.isArray(s)}function L(s,e){let t={...s};for(let[o,n]of Object.entries(e))t[o]=J(n)&&J(t[o])?L(t[o],n):n;return t}function Y(s={},e={}){let t=s.theme||{},o=e.theme||{},{extend:n,...c}=o,{extend:i,...x}=t,f=L(x,c),S=L(i||{},n||{});if(Object.keys(S).length>0)f.extend=S;let $=[...s.safelist||[],...e.safelist||[]],B={...s.shortcuts||{},...e.shortcuts||{}},j=[...s.preflights||[],...e.preflights||[]];return{config:{...s,...e,theme:f,safelist:$,shortcuts:B,...j.length>0?{preflights:j}:{},content:[],output:""},safelist:$,shortcuts:B,includePreflight:e.preflight!==!1,minify:e.minify===!0}}import D from"path";var A=".stx",ie="STX_DIR",q=null;function he(s){q=s?.trim()||null}function N(){return process.env[ie]?.trim()||q||A}function Z(s=process.cwd(),...e){let t=N();return D.isAbsolute(t)?D.join(t,...e):D.join(s,t,...e)}function me(s){if(!s||D.isAbsolute(s))return s;let e=s.replace(/\\/g,"/");if(e!==A&&!e.startsWith(`${A}/`))return s;let t=e.slice(A.length+1);return t?D.join(N(),t):N()}var a={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};var p=null,W=!1,w=null,E="",b=!1,ne=256,m=new Map,g=new Map,C=null,P=null;function O(s){return Bun.hash(s).toString(16).padStart(16,"0").slice(0,16)}function F(s,e){if(m.has(s))m.delete(s);else if(m.size>=ne)m.delete(m.keys().next().value);m.set(s,e)}function ce(s){let e=O(s);if(g.has(e))g.delete(e);else if(g.size>=ne)g.delete(g.keys().next().value);return g.set(e,s),e}function ke(s){let e=g.get(s);if(e===void 0)return;return g.delete(s),g.set(s,e),e}async function ae(s){if(!C)return null;try{let e=Bun.file(r.join(C,`cw-${O(s)}.css`));if(!await e.exists())return null;return await e.text()}catch{return null}}async function le(s,e){if(!C)return;try{if(!fs.existsSync(C))fs.mkdirSync(C,{recursive:!0});await Bun.write(r.join(C,`cw-${O(s)}.css`),e)}catch{}}async function ee(s){try{let e=await import(s);if(e&&e.CSSGenerator)return{CSSGenerator:e.CSSGenerator,config:e.config,build:e.build,defaultConfig:e.defaultConfig,extractClasses:e.extractClasses}}catch{}return null}function de(){let s=[],e=process.cwd();while(e!==r.dirname(e))s.push(r.join(e,"node_modules","@cwcss","crosswind","dist","index.js")),s.push(r.join(e,"node_modules","@cwcss","crosswind","src","index.ts")),s.push(r.join(e,"pantry","@cwcss","crosswind","dist","index.js")),s.push(r.join(e,"pantry","@cwcss","crosswind","src","index.ts")),s.push(r.join(e,"node_modules","@stacksjs","crosswind","dist","index.js")),s.push(r.join(e,"pantry","@stacksjs","crosswind","dist","index.js")),e=r.dirname(e);return s}function fe(){let s=[],e=process.env.HOME||process.env.USERPROFILE||"";if(e){let t=[r.join(e,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),r.join(e,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),r.join(e,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),r.join(e,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),r.join(e,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),r.join(e,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];s.push(...t)}return s.push(r.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),s.push(r.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),s}async function re(){if(W)return p;W=!0;try{let s=async(n)=>{for(let c of n){if(!await Bun.file(c).exists())continue;let i=await ee(c);if(i){if(!process.env.STACKS_DEV_QUIET)console.log(`${a.green}[Crosswind]${a.reset} CSS engine loaded from ${r.dirname(r.dirname(c))}`);return i}}return null};if(process.env.CROSSWIND_SRC){let n=r.resolve(process.env.CROSSWIND_SRC),c=await s([n]);if(!c)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${n}`);return p=c,p}let e=await s(de());if(e)return p=e,p;let t=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let n of t){let c=await ee(n);if(c){if(p=c,!process.env.STACKS_DEV_QUIET)console.log(`${a.green}[Crosswind]${a.reset} CSS engine loaded`);return p}}let o=await s(fe());if(o)return p=o,p;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${a.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${a.reset}`),console.warn(`${a.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${a.reset}`),null}}function ve(){m.clear(),g.clear()}function Te(){p=null,W=!1,w=null,E="",m.clear(),g.clear(),P=null}async function oe(s){try{if(!te({name:"crosswind",cwd:s}))return null;let{loadConfigWithResult:e}=await import("./chunk-z8szsm21.js"),t=await e({name:"crosswind",cwd:s,defaultConfig:{},checkEnv:!1,verbose:!1});if(!t?.path||!t.config||Object.keys(t.config).length===0)return null;let o=r.relative(s,t.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${a.green}[Crosswind]${a.reset} Loaded config from ${o||t.path}`);return t.config}catch(e){if(e instanceof Error&&e.name==="ConfigNotFoundError")return null;return console.warn(`${a.yellow}[Crosswind]${a.reset} Failed to load crosswind config:`,e instanceof Error?e.message:e),null}}async function ue(s){if(b)return E;b=!0;try{let e=await re();if(!e||!e.build)return b=!1,"";if(!w)w=await oe(s);if(!w)return b=!1,"";let t=e.defaultConfig?.theme||{},o=w.theme||{},n={...e.defaultConfig,...w,theme:{...t,...o,extend:{...t.extend||{},...o.extend||{}}}},c=performance.now(),i=await e.build(n),x=performance.now()-c;if(E=i.css,console.log(`${a.cyan}[Crosswind]${a.reset} Built ${i.classes.size} classes in ${x.toFixed(1)}ms`),n.output){let f=r.isAbsolute(n.output)?n.output:r.join(s,n.output),S=r.dirname(f);if(!fs.existsSync(S))fs.mkdirSync(S,{recursive:!0});await Bun.write(f,i.css)}return b=!1,i.css}catch(e){return console.error(`${a.red}[Crosswind]${a.reset} Build error:`,e),b=!1,E}}async function De(s){w=null,await ue(s)}function Ee(){return E}function ge(s){let e=new Set,t=/class\s*=\s*["']([^"']+)["']/gi,o=t.exec(s);while(o!==null){for(let i of o[1].split(/\s+/))if(i.trim())e.add(i.trim());o=t.exec(s)}let n=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,c=n.exec(s);while(c!==null){let i=c[1].match(/'([^']+)'/g);if(i){for(let x of i)for(let f of x.slice(1,-1).split(/\s+/))if(f.trim())e.add(f.trim())}c=n.exec(s)}return e}async function we(s,e){try{let t=await re();if(!t)return"";let o=typeof t.extractClasses==="function"?t.extractClasses(s):ge(s);if(o.size===0)return"";let n=e?r.resolve(e):process.cwd();if(!C)C=Z(n,"cache");let c=[...o].sort().join(" "),i=`${P||"default"}::${c}`,x=m.get(i);if(x!==void 0)return F(i,x),x;let f=await ae(i);if(f!==null)return F(i,f),f;if(!w){let d=null;try{let{loadStxConfig:T}=await import("./chunk-cd03rk3x.js"),l=await T(n);if(l.css)if(typeof l.css==="string"){let u=r.isAbsolute(l.css)?l.css:r.resolve(n,l.css);if(await Bun.file(u).exists()){let h=await import(u);d=h.default||h,console.log(`${a.green}[Crosswind]${a.reset} Loaded config from stx.config.ts \u2192 ${l.css}`)}}else{if(d={...l.css,content:l.css.content||[],preflight:l.css.preflight??!0,minify:l.css.minify??!1},l.css.config){let u=r.isAbsolute(l.css.config)?l.css.config:r.resolve(n,l.css.config);if(await Bun.file(u).exists()){let h=await import(u);d={...h.default||h,...d}}}console.log(`${a.green}[Crosswind]${a.reset} Using inline CSS config from stx.config.ts`)}}catch{}w=d||await oe(n);try{P=O(JSON.stringify(w??{}))}catch{P="unhashable"}}let S=t.defaultConfig||t.config,$=w||{},B=Y(S,$),{safelist:j,includePreflight:G,minify:K}=B,z=B.config,k=new t.CSSGenerator(z);for(let d of j)k.generate(d);for(let d of o)k.generate(d);let y=k.toCSS(G,K),U=z.shortcuts||$.shortcuts||{};for(let[d,T]of Object.entries(U)){if(!o.has(d)&&!j.includes(d))continue;let l=T.split(/\s+/).filter(Boolean);for(let u of l)k.generate(u)}y=k.toCSS(G,K);let v=y.split(`
|
|
3
|
+
`);for(let[d,T]of Object.entries(U)){if(!o.has(d)&&!j.includes(d))continue;let l=T.split(/\s+/).filter(Boolean),u=[],h=[];for(let M of l){let V=M.startsWith("dark:"),H=`.${(V?M.slice(5):M).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let _=0;_<v.length;_++){let Q=v[_].trim();if(Q===`${H} {`||Q.startsWith(`${H} {`)){let R=_,X="";while(R<v.length){if(X+=v[R],v[R].includes("}"))break;R++}let I=X.match(/\{([^}]+)\}/);if(I)if(V)h.push(I[1].trim());else u.push(I[1].trim());break}}}if(u.length)y+=`
|
|
4
|
+
.${d} { ${u.join(" ")} }`;if(h.length)y+=`
|
|
5
|
+
@media (prefers-color-scheme: dark) { .dark .${d} { ${h.join(" ")} } }`}return F(i,y),le(i,y),y}catch(t){return console.warn("Failed to generate Crosswind CSS:",t),""}}async function _e(s,e,t=!1){let o=await we(s,e);if(!o)return s;let n=t?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${ce(o)}.css">`:`<style data-crosswind="generated">
|
|
6
|
+
${o}
|
|
7
|
+
</style>`,c=/(?:<style\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>)/g;if(c.test(s)){let i=!1;return s.replace(c,()=>{if(i)return"";return i=!0,n})}if(s.includes("</head>"))return s.replace("</head>",`${n}
|
|
8
|
+
</head>`);if(s.includes("<body"))return s.replace(/<body([^>]*)>/,`<body$1>
|
|
9
|
+
${n}`);return n+s}
|
|
10
|
+
export{A as Rm,ie as Sm,he as Tm,N as Um,Z as Vm,me as Wm,L as Xm,Y as Ym,a as Zm,ke as _m,re as $m,ve as an,Te as bn,oe as cn,ue as dn,De as en,Ee as fn,ge as gn,we as hn,_e as in};
|