@salty-css/vite 0.0.1-alpha.235 → 0.0.1-alpha.237

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.
Files changed (3) hide show
  1. package/index.cjs +26 -26
  2. package/index.js +264 -264
  3. package/package.json +2 -2
package/index.cjs CHANGED
@@ -1,42 +1,42 @@
1
- "use strict";var Rt=Object.defineProperty;var Mt=(t,e,s)=>e in t?Rt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var nt=(t,e,s)=>Mt(t,typeof e!="symbol"?e+"":e,s);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const vt=require("esbuild"),zt=require("child_process"),c=require("path"),f=require("fs"),dt=require("fs/promises"),Z=require("winston"),lt=require("typescript");var ft=typeof document<"u"?document.currentScript:null;function Jt(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,n.get?n:{enumerable:!0,get:()=>t[s]})}}return e.default=t,Object.freeze(e)}const jt=Jt(vt),bt=t=>String.fromCharCode(t+(t>25?39:97)),Wt=(t,e)=>{let s="",n;for(n=Math.abs(t);n>52;n=n/52|0)s=bt(n%52)+s;return s=bt(n%52)+s,s.length<e?s=s.padStart(e,"a"):s.length>e&&(s=s.slice(-e)),s},At=(t,e)=>{let s=e.length;for(;s;)t=t*33^e.charCodeAt(--s);return t},W=(t,e=5)=>{const s=At(5381,JSON.stringify(t))>>>0;return Wt(s,e)};function v(t){return t?typeof t!="string"?v(String(t)):t.replace(/[\s.]/g,"-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(e,s)=>(s>0?"-":"")+e.toLowerCase()):""}const qt=t=>e=>{if(typeof e!="string"||!t)return;let s=e;const n=[];return Object.values(t).forEach(o=>{const{pattern:r,transform:i}=o;s=s.replace(r,y=>{const{value:g,css:h}=i(y);return h&&n.push(h),g})}),{transformed:s,additionalCss:n}},Ft=t=>e=>typeof e!="string"||!/\{[^{}]+\}/g.test(e)?void 0:{transformed:e.replace(/\{([^{}]+)\}/g,(...o)=>`var(--${v(o[1].replaceAll(".","-"))})`)},It=Ft(),Ht=["top","right","bottom","left","min-width",/.*width.*/,/^[^line]*height.*/,/padding.*/,/margin.*/,/border.*/,/inset.*/,/.*radius.*/,/.*spacing.*/,/.*gap.*/,/.*indent.*/,/.*offset.*/,/.*size.*/,/.*thickness.*/,/.*font-size.*/],Lt=(t,e,s)=>Ht.some(o=>typeof o=="string"?o===t:o.test(t))?`${e}px`:`${e}`,Gt=["Webkit","Moz","ms","O"],Kt=t=>t.startsWith("-")?t:Gt.some(e=>t.startsWith(e))?`-${v(t)}`:v(t),ot=async(t,e="",s,n=!1)=>{if(!t)throw new Error("No styles provided to parseStyles function!");const o=new Set,r=Object.entries(t),i=async([p,d])=>{const $=p.trim(),P=Kt($),x=(R,k=";")=>`${P}:${R}${k}`,E={scope:e,config:s};if(typeof d=="function")return i([p,d(E)]);if(d instanceof Promise)return i([p,await d]);if(typeof d=="object"){if(!d)return;if(d.isColor)return x(d.toString());if($==="defaultVariants")return;if($==="variants"){const D=Object.entries(d);for(const[a,b]of D){if(!b)return;const C=Object.entries(b);for(const[l,j]of C){if(!j)return;const N=`${e}.${a}-${l}`;(await ot(j,N,s)).forEach(J=>o.add(J))}}return}if($==="compoundVariants"){for(const D of d){const{css:a,...b}=D,C=Object.entries(b).reduce((j,[N,O])=>`${j}.${N}-${O}`,e);(await ot(a,C,s)).forEach(j=>o.add(j))}return}if($.startsWith("@")){const D=$,a=await B(d,e,s),b=`${D} { ${a} }`;o.add(b);return}const R=p.includes("&")?$.replace("&",e):$.startsWith(":")?`${e}${$}`:`${e} ${$}`;(await ot(d,R,s)).forEach(D=>o.add(D));return}if(typeof d=="number"){const R=Lt(P,d);return x(R)}if(typeof d!="string")if("toString"in d)d=d.toString();else throw new Error(`Invalid value type for property ${P}`);return x(d)},y=r.map(i),{modifiers:g}={},h=[Ft(),qt(g)],w=(await Promise.all(y).then(p=>Promise.all(p.map(d=>h.reduce(async($,P)=>{const x=await $;if(!x)return x;const E=await P(x);if(!E)return x;const{transformed:R,additionalCss:k}=E;let D="";if(k)for(const a of k)D+=await B(a,"");return`${D}${R}`},Promise.resolve(d)))))).filter(p=>p!==void 0).join(`
2
- `);if(!w.trim())return Array.from(o);const m=e?`${e} {
1
+ "use strict";var Rt=Object.defineProperty;var Mt=(t,e,s)=>e in t?Rt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var st=(t,e,s)=>Mt(t,typeof e!="symbol"?e+"":e,s);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const vt=require("esbuild"),zt=require("child_process"),c=require("path"),d=require("fs"),dt=require("fs/promises"),B=require("winston"),lt=require("typescript");var ft=typeof document<"u"?document.currentScript:null;function Jt(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,n.get?n:{enumerable:!0,get:()=>t[s]})}}return e.default=t,Object.freeze(e)}const jt=Jt(vt),$t=t=>String.fromCharCode(t+(t>25?39:97)),Wt=(t,e)=>{let s="",n;for(n=Math.abs(t);n>52;n=n/52|0)s=$t(n%52)+s;return s=$t(n%52)+s,s.length<e?s=s.padStart(e,"a"):s.length>e&&(s=s.slice(-e)),s},At=(t,e)=>{let s=e.length;for(;s;)t=t*33^e.charCodeAt(--s);return t},q=(t,e=5)=>{const s=At(5381,JSON.stringify(t))>>>0;return Wt(s,e)};function v(t){return t?typeof t!="string"?v(String(t)):t.replace(/[\s.]/g,"-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(e,s)=>(s>0?"-":"")+e.toLowerCase()):""}const qt=t=>e=>{if(typeof e!="string"||!t)return;let s=e;const n=[];return Object.values(t).forEach(o=>{const{pattern:i,transform:r}=o;s=s.replace(i,y=>{const{value:b,css:m}=r(y);return m&&n.push(m),b})}),{transformed:s,additionalCss:n}},Ft=t=>e=>typeof e!="string"||!/\{[^{}]+\}/g.test(e)?void 0:{transformed:e.replace(/\{([^{}]+)\}/g,(...o)=>`var(--${v(o[1].replaceAll(".","-"))})`)},It=Ft(),Ht=["top","right","bottom","left","min-width",/.*width.*/,/^[^line]*height.*/,/padding.*/,/margin.*/,/border.*/,/inset.*/,/.*radius.*/,/.*spacing.*/,/.*gap.*/,/.*indent.*/,/.*offset.*/,/.*size.*/,/.*thickness.*/,/.*font-size.*/],Lt=(t,e,s)=>Ht.some(o=>typeof o=="string"?o===t:o.test(t))?`${e}px`:`${e}`,Qt=["Webkit","Moz","ms","O"],Gt=t=>t.startsWith("-")?t:Qt.some(e=>t.startsWith(e))?`-${v(t)}`:v(t),nt=async(t,e="",s,n=!1)=>{if(!t)throw new Error("No styles provided to parseStyles function!");const o=new Set,i=Object.entries(t),r=async([p,u])=>{const $=p.trim(),P=Gt($),x=(M,k=";")=>`${P}:${M}${k}`,O={scope:e,config:s};if(typeof u=="function")return r([p,u(O)]);if(u instanceof Promise)return r([p,await u]);if(typeof u=="object"){if(!u)return;if(u.isColor)return x(u.toString());if($==="defaultVariants")return;if($==="variants"){const D=Object.entries(u);for(const[a,g]of D){if(!g)return;const j=Object.entries(g);for(const[f,C]of j){if(!C)return;const N=`${e}.${a}-${f}`;(await nt(C,N,s)).forEach(J=>o.add(J))}}return}if($==="compoundVariants"){for(const D of u){const{css:a,...g}=D,j=Object.entries(g).reduce((C,[N,E])=>`${C}.${N}-${E}`,e);(await nt(a,j,s)).forEach(C=>o.add(C))}return}if($.startsWith("@")){const D=$,a=await X(u,e,s),g=`${D} { ${a} }`;o.add(g);return}const M=p.includes("&")?$.replace("&",e):$.startsWith(":")?`${e}${$}`:`${e} ${$}`;(await nt(u,M,s)).forEach(D=>o.add(D));return}if(typeof u=="number"){const M=Lt(P,u);return x(M)}if(typeof u!="string")if("toString"in u)u=u.toString();else throw new Error(`Invalid value type for property ${P}`);return x(u)},y=i.map(r),{modifiers:b}={},m=[Ft(),qt(b)],w=(await Promise.all(y).then(p=>Promise.all(p.map(u=>m.reduce(async($,P)=>{const x=await $;if(!x)return x;const O=await P(x);if(!O)return x;const{transformed:M,additionalCss:k}=O;let D="";if(k)for(const a of k)D+=await X(a,"");return`${D}${M}`},Promise.resolve(u)))))).filter(p=>p!==void 0).join(`
2
+ `);if(!w.trim())return Array.from(o);const h=e?`${e} {
3
3
  ${w}
4
- }`:w;return o.has(m)?Array.from(o):[m,...o]},B=async(t,e,s,n=!1)=>(await ot(t,e,s,n)).join(`
5
- `),Ct=async(t,e=[])=>{if(!t)return"";const s=[],n={};for(const[o,r]of Object.entries(t))if(typeof r!="function")if(r&&typeof r=="object"){const i=o.trim(),y=await Ct(r,[...e,i]);s.push(y)}else n[o]=r;if(Object.keys(n).length){const o=e.map(v).join("-"),r="t_"+W(o,4),i=await B(n,`.${o}, .${r}`);s.push(i)}return s.join(`
6
- `)},Ut=t=>t?Object.entries(t).reduce((e,[s,n])=>(typeof n=="function"?e[s]="any":typeof n=="object"&&(e[s]=Pt(n).map(o=>`"${o}"`).join(" | ")),e),{}):{},Pt=(t,e="",s=new Set)=>t?(Object.entries(t).forEach(([n,o])=>{const r=e?`${e}.${n}`:n;return typeof o=="object"?Pt(o,r,s):s.add(e)}),[...s]):[],Nt=t=>{if(!t||t==="/")throw new Error("Could not find package.json file");const e=c.join(t,"package.json");return f.existsSync(e)?e:Nt(c.join(t,".."))},Qt=async t=>{const e=Nt(t);return await dt.readFile(e,"utf-8").then(JSON.parse).catch(()=>{})},Zt=async t=>{const e=await Qt(t);if(e)return e.type};let I;const _t=async t=>{if(I)return I;const e=await Zt(t);return e==="module"?I="esm":(e==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:ft&&ft.tagName.toUpperCase()==="SCRIPT"&&ft.src||new URL("index.cjs",document.baseURI).href).endsWith(".cjs"))&&(I="cjs"),I||"esm"},ut=Z.createLogger({level:"debug",format:Z.format.combine(Z.format.colorize(),Z.format.cli()),transports:[new Z.transports.Console({})]});function xt(t){return t?typeof t!="string"?xt(String(t)):t.replace(/[^\d\w]/g,"."):""}const Bt={"*, *::before, *::after":{boxSizing:"border-box"},"*":{margin:0},html:{lineHeight:1.15,textSizeAdjust:"100%",WebkitFontSmoothing:"antialiased"},"img, picture, video, canvas, svg":{display:"block",maxWidth:"100%"},"p, h1, h2, h3, h4, h5, h6":{overflowWrap:"break-word"},p:{textWrap:"pretty"},"h1, h2, h3, h4, h5, h6":{textWrap:"balance"},a:{color:"currentColor"},button:{lineHeight:"1em",color:"currentColor"},"input, optgroup, select, textarea":{fontFamily:"inherit",fontSize:"100%",lineHeight:"1.15em"}},H=(...t)=>t.flat().reduce((e,s)=>s!=null&&s._current?{...e,...s._current}:{...e,...s},{}),Xt=(...t)=>t.flat().reduce((e,s)=>({...e,...s._children}),{});class Yt{constructor(e){nt(this,"_path");this.params=e}get _current(){return this.params.template}get isDefineTemplate(){return!0}_setPath(e){return this._path=e,this}}class te{constructor(e){nt(this,"_path");nt(this,"templates",[]);this.params=e,Object.entries(e).forEach(([s,n])=>{this.templates.push(new Yt({name:s,template:n}))})}get _current(){return this.params}get _children(){return Object.fromEntries(this.templates.map(e=>[e.params.name,e]))}get isDefineTemplates(){return!0}_setPath(e){return this._path=e,this.templates.forEach(s=>s._setPath(e)),this}}const ee=t=>new te(t),se=(t,e)=>new Promise((s,n)=>{const o=setTimeout(()=>{n(new Error("Timeout"))},100),r=lt.createSourceFile("temp.ts",t,lt.ScriptTarget.Latest,!0);function i(y){if(lt.isVariableDeclaration(y)&&y.name.getText()===e){const g=y.getStart(),h=y.getEnd();clearTimeout(o),s([g,h])}y.forEachChild(i)}i(r)}),z={externalModules:[],rcFile:void 0,destDir:void 0},Tt=t=>{if(z.externalModules.length>0)return z.externalModules;const s=f.readFileSync(t,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!s)return[];const n=s[1].split(",").map(o=>o.replace(/['"`]/g,"").trim());return z.externalModules=n,n},A=async t=>{if(z.destDir)return z.destDir;const e=await pt(t),s=c.join(t,(e==null?void 0:e.saltygenDir)||"saltygen");return z.destDir=s,s},kt=["salty","css","styles","styled"],ne=(t=[])=>new RegExp(`\\.(${[...kt,...t].join("|")})\\.`),L=(t,e=[])=>ne(e).test(t),Dt=async t=>{if(z.rcFile)return z.rcFile;if(t==="/")throw new Error("Could not find .saltyrc.json file");const e=c.join(t,".saltyrc.json"),s=await dt.readFile(e,"utf-8").then(JSON.parse).catch(()=>{});return s?(z.rcFile=s,s):Dt(c.join(t,".."))},pt=async t=>{var n,o;const e=await Dt(t),s=(n=e.projects)==null?void 0:n.find(r=>t.endsWith(r.dir||""));return s||((o=e.projects)==null?void 0:o.find(r=>r.dir===e.defaultProject))},oe=async t=>{const e=await pt(t),s=await A(t),n=c.join(t,(e==null?void 0:e.configDir)||"","salty.config.ts"),o=c.join(s,"salty.config.js"),r=await _t(t),i=Tt(n);await jt.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:o,format:r,external:i});const y=Date.now(),{config:g}=await import(`${o}?t=${y}`);return{config:g,path:o}},re=async(t,e)=>{var ht,gt;const s=await A(t),n={mediaQueries:[],globalStyles:[],variables:[],templates:[]};await Promise.all([...e].map(async F=>{const{contents:_,outputFilePath:Q}=await rt(t,F,s);Object.entries(_).forEach(([M,T])=>{T.isMedia?n.mediaQueries.push([M,T]):T.isGlobalDefine?n.globalStyles.push(T):T.isDefineVariables?n.variables.push(T):T.isDefineTemplates&&n.templates.push(T._setPath(`${M};;${Q}`))})}));const{config:o,path:r}=await oe(t),i={...o},y=new Set,g=async(F,_=[])=>{if(!F)return[];const Q=Object.entries(F).map(async([T,q])=>{const et=async V=>{if(!V)return;if(V instanceof Promise)return await et(await V);if(typeof V=="function")return await et(await V());if(typeof V=="object")return await g(V,[..._,T]);const it=xt(T),at=v(T),ct=[..._,it].join(".");y.add(`"${ct}"`);const st=[..._.map(v),at].join("-"),wt=It(V);return wt?`--${st}: ${wt.transformed};`:`--${st}: ${V};`};return await et(q)});return(await Promise.all(Q)).flat()},h=async F=>{if(!F)return[];const _=Object.entries(F).map(async([M,T])=>{const q=await g(T);return M==="base"?q.join(""):`${M} { ${q.join("")} }`});return(await Promise.all(_)).flat()},u=async F=>{if(!F)return[];const _=Object.entries(F).map(async([M,T])=>{const q=Object.entries(T).map(async([V,it])=>{const at=await g(it,[M]),ct=`.${M}-${V}, [data-${M}="${V}"]`,st=at.join("");return`${ct} { ${st} }`});return(await Promise.all(q)).flat()});return(await Promise.all(_)).flat()},w=F=>({...F,responsive:void 0,conditional:void 0}),m=F=>n.variables.map(_=>F==="static"?w(_._current):_._current[F]),S=H(w(o.variables),m("static")),p=await g(S),d=H((ht=o.variables)==null?void 0:ht.responsive,m("responsive")),$=await h(d),P=H((gt=o.variables)==null?void 0:gt.conditional,m("conditional")),x=await u(P),E=c.join(s,"css/_variables.css"),R=`:root { ${p.join("")} ${$.join("")} } ${x.join("")}`;f.writeFileSync(E,R),i.staticVariables=S;const k=c.join(s,"css/_global.css"),D=H(o.global,n.globalStyles),a=await B(D,"");f.writeFileSync(k,`@layer global { ${a} }`);const b=c.join(s,"css/_reset.css"),l=o.reset==="none"?{}:typeof o.reset=="object"?o.reset:Bt,j=await B(l,"");f.writeFileSync(b,`@layer reset { ${j} }`);const N=c.join(s,"css/_templates.css"),O=H(o.templates,n.templates),J=await Ct(O),G=Ut(O);f.writeFileSync(N,`@layer templates { ${J} }`),i.templates=O;const K=o.templates?[ee(o.templates)._setPath(`config;;${r}`)]:[],X=Xt(n.templates,K);i.templatePaths=Object.fromEntries(Object.entries(X).map(([F,_])=>[F,_._path]));const{mediaQueries:Y}=n;i.mediaQueries=Object.fromEntries(Y.map(([F,_])=>[`@${F}`,_]));const U=Y.map(([F])=>`'@${F}'`).join(" | "),tt=c.join(s,"types/css-tokens.d.ts"),Et=`
4
+ }`:w;return o.has(h)?Array.from(o):[h,...o]},X=async(t,e,s,n=!1)=>(await nt(t,e,s,n)).join(`
5
+ `),Ct=async(t,e=[])=>{if(!t)return"";const s=[],n={};for(const[o,i]of Object.entries(t))if(typeof i!="function")if(i&&typeof i=="object"){const r=o.trim(),y=await Ct(i,[...e,r]);s.push(y)}else n[o]=i;if(Object.keys(n).length){const o=e.map(v).join("-"),i="t_"+q(o,4),r=await X(n,`.${o}, .${i}`);s.push(r)}return s.join(`
6
+ `)},Kt=t=>t?Object.entries(t).reduce((e,[s,n])=>(typeof n=="function"?e[s]="any":typeof n=="object"&&(e[s]=Pt(n).map(o=>`"${o}"`).join(" | ")),e),{}):{},Pt=(t,e="",s=new Set)=>t?(Object.entries(t).forEach(([n,o])=>{const i=e?`${e}.${n}`:n;return typeof o=="object"?Pt(o,i,s):s.add(e)}),[...s]):[],Nt=t=>{if(!t||t==="/")throw new Error("Could not find package.json file");const e=c.join(t,"package.json");return d.existsSync(e)?e:Nt(c.join(t,".."))},Ut=async t=>{const e=Nt(t);return await dt.readFile(e,"utf-8").then(JSON.parse).catch(()=>{})},Zt=async t=>{const e=await Ut(t);if(e)return e.type};let H;const _t=async t=>{if(H)return H;const e=await Zt(t);return e==="module"?H="esm":(e==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:ft&&ft.tagName.toUpperCase()==="SCRIPT"&&ft.src||new URL("index.cjs",document.baseURI).href).endsWith(".cjs"))&&(H="cjs"),H||"esm"},ut=B.createLogger({level:"debug",format:B.format.combine(B.format.colorize(),B.format.cli()),transports:[new B.transports.Console({})]});function xt(t){return t?typeof t!="string"?xt(String(t)):t.replace(/[^\d\w]/g,"."):""}const Bt={"*, *::before, *::after":{boxSizing:"border-box"},"*":{margin:0},html:{lineHeight:1.15,textSizeAdjust:"100%",WebkitFontSmoothing:"antialiased"},"img, picture, video, canvas, svg":{display:"block",maxWidth:"100%"},"p, h1, h2, h3, h4, h5, h6":{overflowWrap:"break-word"},p:{textWrap:"pretty"},"h1, h2, h3, h4, h5, h6":{textWrap:"balance"},a:{color:"currentColor"},button:{lineHeight:"1em",color:"currentColor"},"input, optgroup, select, textarea":{fontFamily:"inherit",fontSize:"100%",lineHeight:"1.15em"}},L=(...t)=>t.flat().reduce((e,s)=>s!=null&&s._current?{...e,...s._current}:{...e,...s},{}),Xt=(...t)=>t.flat().reduce((e,s)=>({...e,...s._children}),{});class Yt{constructor(e){st(this,"_path");this.params=e}get _current(){return this.params.template}get isDefineTemplate(){return!0}_setPath(e){return this._path=e,this}}class te{constructor(e){st(this,"_path");st(this,"templates",[]);this.params=e,Object.entries(e).forEach(([s,n])=>{this.templates.push(new Yt({name:s,template:n}))})}get _current(){return this.params}get _children(){return Object.fromEntries(this.templates.map(e=>[e.params.name,e]))}get isDefineTemplates(){return!0}_setPath(e){return this._path=e,this.templates.forEach(s=>s._setPath(e)),this}}const ee=t=>new te(t),se=(t,e)=>new Promise((s,n)=>{const o=setTimeout(()=>{n(new Error("Timeout"))},100),i=lt.createSourceFile("temp.ts",t,lt.ScriptTarget.Latest,!0);function r(y){if(lt.isVariableDeclaration(y)&&y.name.getText()===e){const b=y.getStart(),m=y.getEnd();clearTimeout(o),s([b,m])}y.forEachChild(r)}r(i)}),z={externalModules:[],rcFile:void 0,destDir:void 0},Tt=t=>{if(z.externalModules.length>0)return z.externalModules;const s=d.readFileSync(t,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!s)return[];const n=s[1].split(",").map(o=>o.replace(/['"`]/g,"").trim());return z.externalModules=n,n},I=async t=>{if(z.destDir)return z.destDir;const e=await pt(t),s=c.join(t,(e==null?void 0:e.saltygenDir)||"saltygen");return z.destDir=s,s},kt=["salty","css","styles","styled"],ne=(t=[])=>new RegExp(`\\.(${[...kt,...t].join("|")})\\.`),Q=(t,e=[])=>ne(e).test(t),Dt=async t=>{if(z.rcFile)return z.rcFile;if(t==="/")throw new Error("Could not find .saltyrc.json file");const e=c.join(t,".saltyrc.json"),s=await dt.readFile(e,"utf-8").then(JSON.parse).catch(()=>{});return s?(z.rcFile=s,s):Dt(c.join(t,".."))},pt=async t=>{var n,o;const e=await Dt(t),s=(n=e.projects)==null?void 0:n.find(i=>t.endsWith(i.dir||""));return s||((o=e.projects)==null?void 0:o.find(i=>i.dir===e.defaultProject))},oe=async t=>{const e=await pt(t),s=await I(t),n=c.join(t,(e==null?void 0:e.configDir)||"","salty.config.ts"),o=c.join(s,"salty.config.js"),i=await _t(t),r=Tt(n);await jt.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:o,format:i,external:r});const y=Date.now(),{config:b}=await import(`${o}?t=${y}`);return{config:b,path:o}},re=async(t,e)=>{var ht,gt;const s=await I(t),n={mediaQueries:[],globalStyles:[],variables:[],templates:[]};await Promise.all([...e].map(async F=>{const{contents:_,outputFilePath:U}=await ot(t,F,s);Object.entries(_).forEach(([V,T])=>{T.isMedia?n.mediaQueries.push([V,T]):T.isGlobalDefine?n.globalStyles.push(T):T.isDefineVariables?n.variables.push(T):T.isDefineTemplates&&n.templates.push(T._setPath(`${V};;${U}`))})}));const{config:o,path:i}=await oe(t),r={...o},{mediaQueries:y}=n;r.mediaQueries=Object.fromEntries(y.map(([F,_])=>[`@${F}`,_]));const b=y.map(([F])=>`'@${F}'`).join(" | "),m=new Set,l=async(F,_=[])=>{if(!F)return[];const U=Object.entries(F).map(async([T,A])=>{const Z=async R=>{if(!R)return;if(R instanceof Promise)return await Z(await R);if(typeof R=="function")return await Z(await R());if(typeof R=="object")return await l(R,[..._,T]);const it=xt(T),at=v(T),ct=[..._,it].join(".");m.add(`"${ct}"`);const et=[..._.map(v),at].join("-"),wt=It(R);return wt?`--${et}: ${wt.transformed};`:`--${et}: ${R};`};return await Z(A)});return(await Promise.all(U)).flat()},w=async F=>{if(!F)return[];const _=Object.entries(F).map(async([V,T])=>{const A=await l(T);return V==="base"?A.join(""):r.mediaQueries[V]?`${r.mediaQueries[V]} { ${A.join("")} }`:`${V} { ${A.join("")} }`});return(await Promise.all(_)).flat()},h=async F=>{if(!F)return[];const _=Object.entries(F).map(async([V,T])=>{const A=Object.entries(T).map(async([R,it])=>{const at=await l(it,[V]),ct=`.${V}-${R}, [data-${V}="${R}"]`,et=at.join("");return`${ct} { ${et} }`});return(await Promise.all(A)).flat()});return(await Promise.all(_)).flat()},S=F=>({...F,responsive:void 0,conditional:void 0}),p=F=>n.variables.map(_=>F==="static"?S(_._current):_._current[F]),u=L(S(o.variables),p("static")),$=await l(u),P=L((ht=o.variables)==null?void 0:ht.responsive,p("responsive")),x=await w(P),O=L((gt=o.variables)==null?void 0:gt.conditional,p("conditional")),M=await h(O),k=c.join(s,"css/_variables.css"),D=`:root { ${$.join("")} ${x.join("")} } ${M.join("")}`;d.writeFileSync(k,D),r.staticVariables=u;const a=c.join(s,"css/_global.css"),g=L(o.global,n.globalStyles),j=await X(g,"");d.writeFileSync(a,`@layer global { ${j} }`);const f=c.join(s,"css/_reset.css"),N=o.reset==="none"?{}:typeof o.reset=="object"?o.reset:Bt,E=await X(N,"");d.writeFileSync(f,`@layer reset { ${E} }`);const J=c.join(s,"css/_templates.css"),W=L(o.templates,n.templates),G=await Ct(W),Y=Kt(W);d.writeFileSync(J,`@layer templates { ${G} }`),r.templates=W;const rt=o.templates?[ee(o.templates)._setPath(`config;;${i}`)]:[],K=Xt(n.templates,rt);r.templatePaths=Object.fromEntries(Object.entries(K).map(([F,_])=>[F,_._path]));const tt=c.join(s,"types/css-tokens.d.ts"),Et=`
7
7
  // Variable types
8
- type VariableTokens = ${[...y].join("|")};
8
+ type VariableTokens = ${[...m].join("|")};
9
9
  type PropertyValueToken = \`{\${VariableTokens}}\`;
10
10
 
11
11
  // Template types
12
12
  type TemplateTokens = {
13
- ${Object.entries(G).map(([F,_])=>`${F}?: ${_}`).join(`
13
+ ${Object.entries(Y).map(([F,_])=>`${F}?: ${_}`).join(`
14
14
  `)}
15
15
  }
16
16
 
17
17
  // Media query types
18
- type MediaQueryKeys = ${U||"''"};
19
- `;f.writeFileSync(tt,Et);const Vt=c.join(s,"cache/config-cache.json");f.writeFileSync(Vt,JSON.stringify(i,null,2))},$t=t=>t.replace(/styled\(([^"'`{,]+),/g,(e,s)=>{if(/^['"`]/.test(s))return e;const o=new RegExp(`import[^;]*${s}[,\\s{][^;]*from\\s?([^{};]+);`);if(!o.test(t))return e;const i=o.exec(t);if(i){const y=i.at(1);if(kt.some(h=>y==null?void 0:y.includes(h)))return e}return"styled('div',"}),ie=(t,e)=>{try{const s=f.readFileSync(c.join(e,"saltygen/cache/config-cache.json"),"utf8");return s?`globalThis.saltyConfig = ${s};
18
+ type MediaQueryKeys = ${b||"''"};
19
+ `;d.writeFileSync(tt,Et);const Vt=c.join(s,"cache/config-cache.json");d.writeFileSync(Vt,JSON.stringify(r,null,2))},bt=t=>t.replace(/styled\(([^"'`{,]+),/g,(e,s)=>{if(/^['"`]/.test(s))return e;const o=new RegExp(`import[^;]*${s}[,\\s{][^;]*from\\s?([^{};]+);`);if(!o.test(t))return e;const r=o.exec(t);if(r){const y=r.at(1);if(kt.some(m=>y==null?void 0:y.includes(m)))return e}return"styled('div',"}),ie=(t,e)=>{try{const s=d.readFileSync(c.join(e,"saltygen/cache/config-cache.json"),"utf8");return s?`globalThis.saltyConfig = ${s};
20
20
 
21
21
  ${t}`:`globalThis.saltyConfig = {};
22
22
 
23
- ${t}`}catch{return t}},rt=async(t,e,s)=>{const n=W(e),o=c.join(s,"./temp");f.existsSync(o)||f.mkdirSync(o);const r=c.parse(e);let i=f.readFileSync(e,"utf8");i=$t(i),i=ie(i,t);const y=c.join(s,"js",n+".js"),g=await pt(t),h=c.join(t,(g==null?void 0:g.configDir)||"","salty.config.ts"),u=Tt(h),w=await _t(t);await jt.build({stdin:{contents:i,sourcefile:r.base,resolveDir:r.dir,loader:"tsx"},minify:!1,treeShaking:!0,bundle:!0,outfile:y,format:w,target:["node20"],keepNames:!0,external:u,packages:"external",plugins:[{name:"test",setup:p=>{p.onLoad({filter:/.*\.css|salty|styles|styled\.ts/},d=>{const $=f.readFileSync(d.path,"utf8");return{contents:$t($),loader:"ts"}})}}]});const m=Date.now();return{contents:await import(`${y}?t=${m}`),outputFilePath:y}},ae=async t=>{const e=await A(t),s=c.join(e,"cache/config-cache.json"),n=f.readFileSync(s,"utf8");if(!n)throw new Error("Could not find config cache file");return JSON.parse(n)},mt=async t=>{const e=await ae(t),s=await A(t),n=c.join(s,"salty.config.js"),o=Date.now(),{config:r}=await import(`${n}?t=${o}`);return H(r,e)},yt=()=>{try{return process.env.NODE_ENV==="production"}catch{return!1}},ce=async(t,e=yt(),s=!0)=>{try{const n=Date.now();e?ut.info("Generating CSS in production mode! 🔥"):ut.info("Generating CSS in development mode! 🚀");const o=[],r=[],i=await A(t),y=c.join(i,"index.css");s&&(()=>{f.existsSync(i)&&zt.execSync("rm -rf "+i),f.mkdirSync(i,{recursive:!0}),f.mkdirSync(c.join(i,"css")),f.mkdirSync(c.join(i,"types")),f.mkdirSync(c.join(i,"js")),f.mkdirSync(c.join(i,"cache"))})();const h=new Set,u=new Set;async function w(a){const b=["node_modules","saltygen"],C=f.statSync(a);if(C.isDirectory()){const l=f.readdirSync(a);if(b.some(N=>a.includes(N)))return;await Promise.all(l.map(N=>w(c.join(a,N))))}else if(C.isFile()&&L(a)){h.add(a);const j=f.readFileSync(a,"utf8");/define[\w\d]+\(/.test(j)&&u.add(a)}}await w(t),await re(t,u);const m={keyframes:[],components:[],classNames:[]};await Promise.all([...h].map(async a=>{const{contents:b}=await rt(t,a,i);for(let[C,l]of Object.entries(b))l instanceof Promise&&(l=await l),l.isKeyframes?m.keyframes.push({value:l,src:a,name:C}):l.isClassName?m.classNames.push({...l,src:a,name:C}):l.generator&&m.components.push({...l,src:a,name:C})}));const S=await mt(t);for(const a of m.keyframes){const{value:b}=a,C=`a_${b.animationName}.css`,l=`css/${C}`,j=c.join(i,l);o.push(C),f.writeFileSync(j,b.css)}const p={};for(const a of m.components){const{src:b,name:C}=a;p[b]||(p[b]=[]);const l=a.generator._withBuildContext({callerName:C,isProduction:e,config:S});r[l.priority]||(r[l.priority]=[]);const j=await l.css;if(!j)continue;r[l.priority].push(l.cssFileName);const N=`css/${l.cssFileName}`,O=c.join(i,N);f.writeFileSync(O,j),S.importStrategy==="component"&&p[b].push(l.cssFileName)}for(const a of m.classNames){const{src:b,name:C}=a;p[b]||(p[b]=[]);const l=a.generator._withBuildContext({callerName:C,isProduction:e,config:S}),j=await l.css;if(!j)continue;r[l.priority]||(r[l.priority]=[]),r[l.priority].push(l.cssFileName);const N=`css/${l.cssFileName}`,O=c.join(i,N);f.writeFileSync(O,j),S.importStrategy==="component"&&p[b].push(l.cssFileName)}S.importStrategy==="component"&&Object.entries(p).forEach(([a,b])=>{const C=b.map(J=>`@import url('./${J}');`).join(`
24
- `),l=W(a,6),j=c.parse(a),N=v(j.name),O=c.join(i,`css/f_${N}-${l}.css`);f.writeFileSync(O,C||"/* Empty file */")});const d=o.map(a=>`@import url('./css/${a}');`).join(`
25
- `);let E=`@layer reset, global, templates, l0, l1, l2, l3, l4, l5, l6, l7, l8;
23
+ ${t}`}catch{return t}},ot=async(t,e,s)=>{const n=q(e),o=c.join(s,"./temp");d.existsSync(o)||d.mkdirSync(o);const i=c.parse(e);let r=d.readFileSync(e,"utf8");r=bt(r),r=ie(r,t);const y=c.join(s,"js",n+".js"),b=await pt(t),m=c.join(t,(b==null?void 0:b.configDir)||"","salty.config.ts"),l=Tt(m),w=await _t(t);await jt.build({stdin:{contents:r,sourcefile:i.base,resolveDir:i.dir,loader:"tsx"},minify:!1,treeShaking:!0,bundle:!0,outfile:y,format:w,target:["node20"],keepNames:!0,external:l,packages:"external",plugins:[{name:"test",setup:p=>{p.onLoad({filter:/.*\.css|salty|styles|styled\.ts/},u=>{const $=d.readFileSync(u.path,"utf8");return{contents:bt($),loader:"ts"}})}}]});const h=Date.now();return{contents:await import(`${y}?t=${h}`),outputFilePath:y}},ae=async t=>{const e=await I(t),s=c.join(e,"cache/config-cache.json"),n=d.readFileSync(s,"utf8");if(!n)throw new Error("Could not find config cache file");return JSON.parse(n)},mt=async t=>{const e=await ae(t),s=await I(t),n=c.join(s,"salty.config.js"),o=Date.now(),{config:i}=await import(`${n}?t=${o}`);return L(i,e)},yt=()=>{try{return process.env.NODE_ENV==="production"}catch{return!1}},ce=async(t,e=yt(),s=!0)=>{try{const n=Date.now();e?ut.info("Generating CSS in production mode! 🔥"):ut.info("Generating CSS in development mode! 🚀");const o=[],i=[],r=await I(t),y=c.join(r,"index.css");s&&(()=>{d.existsSync(r)&&zt.execSync("rm -rf "+r),d.mkdirSync(r,{recursive:!0}),d.mkdirSync(c.join(r,"css")),d.mkdirSync(c.join(r,"types")),d.mkdirSync(c.join(r,"js")),d.mkdirSync(c.join(r,"cache"))})();const m=new Set,l=new Set;async function w(a){const g=["node_modules","saltygen"],j=d.statSync(a);if(j.isDirectory()){const f=d.readdirSync(a);if(g.some(N=>a.includes(N)))return;await Promise.all(f.map(N=>w(c.join(a,N))))}else if(j.isFile()&&Q(a)){m.add(a);const C=d.readFileSync(a,"utf8");/define[\w\d]+\(/.test(C)&&l.add(a)}}await w(t),await re(t,l);const h={keyframes:[],components:[],classNames:[]};await Promise.all([...m].map(async a=>{const{contents:g}=await ot(t,a,r);for(let[j,f]of Object.entries(g))f instanceof Promise&&(f=await f),f.isKeyframes?h.keyframes.push({value:f,src:a,name:j}):f.isClassName?h.classNames.push({...f,src:a,name:j}):f.generator&&h.components.push({...f,src:a,name:j})}));const S=await mt(t);for(const a of h.keyframes){const{value:g}=a,j=`a_${g.animationName}.css`,f=`css/${j}`,C=c.join(r,f);o.push(j),d.writeFileSync(C,g.css)}const p={};for(const a of h.components){const{src:g,name:j}=a;p[g]||(p[g]=[]);const f=a.generator._withBuildContext({callerName:j,isProduction:e,config:S});i[f.priority]||(i[f.priority]=[]);const C=await f.css;if(!C)continue;i[f.priority].push(f.cssFileName);const N=`css/${f.cssFileName}`,E=c.join(r,N);d.writeFileSync(E,C),S.importStrategy==="component"&&p[g].push(f.cssFileName)}for(const a of h.classNames){const{src:g,name:j}=a;p[g]||(p[g]=[]);const f=a.generator._withBuildContext({callerName:j,isProduction:e,config:S}),C=await f.css;if(!C)continue;i[f.priority]||(i[f.priority]=[]),i[f.priority].push(f.cssFileName);const N=`css/${f.cssFileName}`,E=c.join(r,N);d.writeFileSync(E,C),S.importStrategy==="component"&&p[g].push(f.cssFileName)}S.importStrategy==="component"&&Object.entries(p).forEach(([a,g])=>{const j=g.map(J=>`@import url('./${J}');`).join(`
24
+ `),f=q(a,6),C=c.parse(a),N=v(C.name),E=c.join(r,`css/f_${N}-${f}.css`);d.writeFileSync(E,j||"/* Empty file */")});const u=o.map(a=>`@import url('./css/${a}');`).join(`
25
+ `);let O=`@layer reset, global, templates, l0, l1, l2, l3, l4, l5, l6, l7, l8;
26
26
 
27
- ${["_variables.css","_reset.css","_global.css","_templates.css"].filter(a=>{try{return f.readFileSync(c.join(i,"css",a),"utf8").length>0}catch{return!1}}).map(a=>`@import url('./css/${a}');`).join(`
27
+ ${["_variables.css","_reset.css","_global.css","_templates.css"].filter(a=>{try{return d.readFileSync(c.join(r,"css",a),"utf8").length>0}catch{return!1}}).map(a=>`@import url('./css/${a}');`).join(`
28
28
  `)}
29
- ${d}`;if(S.importStrategy!=="component"){const a=r.reduce((b,C,l)=>{const j=C.reduce((G,K)=>{var tt;const X=c.join(i,"css",K),Y=f.readFileSync(X,"utf8"),U=((tt=/.*-([^-]+)-\d+.css/.exec(K))==null?void 0:tt.at(1))||W(X,6);return G.includes(U)?G:`${G}
30
- /*start:${U}-${K}*/
31
- ${Y}
32
- /*end:${U}*/
33
- `},""),N=`l_${l}.css`,O=c.join(i,"css",N),J=`@layer l${l} { ${j}
34
- }`;return f.writeFileSync(O,J),`${b}
35
- @import url('./css/${N}');`},"");E+=a}f.writeFileSync(y,E);const k=Date.now()-n,D=k<200?"🔥":k<500?"🚀":k<1e3?"🎉":k<2e3?"🚗":k<5e3?"🤔":"🥴";ut.info(`Generated CSS in ${k}ms! ${D}`)}catch(n){console.error(n)}},le=async(t,e,s=yt())=>{try{const n=await A(t);if(L(e)){const r=[],i=await mt(t),{contents:y}=await rt(t,e,n);for(const[g,h]of Object.entries(y)){if(h.isKeyframes&&h.css){const d=`css/${`a_${h.animationName}.css`}`,$=c.join(n,d);f.writeFileSync($,await h.css);return}if(h.isClassName){const p=h.generator._withBuildContext({callerName:g,isProduction:s,config:i}),d=await p.css;if(!d)continue;r[p.priority]||(r[p.priority]=[]),r[p.priority].push(p.cssFileName);const $=`css/${p.cssFileName}`,P=c.join(n,$);f.writeFileSync(P,d)}if(!h.generator)return;const u=h.generator._withBuildContext({callerName:g,isProduction:s,config:i}),w=await u.css;if(!w)continue;const m=`css/${u.cssFileName}`,S=c.join(n,m);f.writeFileSync(S,w),r[u.priority]||(r[u.priority]=[]),r[u.priority].push(u.cssFileName)}if(i.importStrategy!=="component")r.forEach((g,h)=>{const u=`l_${h}.css`,w=c.join(n,"css",u);let m=f.readFileSync(w,"utf8");g.forEach(S=>{var P;const p=c.join(n,"css",S),d=((P=/.*-([^-]+)-\d+.css/.exec(S))==null?void 0:P.at(1))||W(p,6);if(!m.includes(d)){const x=f.readFileSync(p,"utf8"),E=`/*start:${d}-${S}*/
29
+ ${u}`;if(S.importStrategy!=="component"){const a=i.reduce((g,j,f)=>{const C=j.reduce((W,G)=>{var tt;const Y=c.join(r,"css",G),rt=d.readFileSync(Y,"utf8"),K=((tt=/.*-([^-]+)-\d+.css/.exec(G))==null?void 0:tt.at(1))||q(Y,6);return W.includes(K)?W:`${W}
30
+ /*start:${K}-${G}*/
31
+ ${rt}
32
+ /*end:${K}*/
33
+ `},""),N=`l_${f}.css`,E=c.join(r,"css",N),J=`@layer l${f} { ${C}
34
+ }`;return d.writeFileSync(E,J),`${g}
35
+ @import url('./css/${N}');`},"");O+=a}d.writeFileSync(y,O);const k=Date.now()-n,D=k<200?"🔥":k<500?"🚀":k<1e3?"🎉":k<2e3?"🚗":k<5e3?"🤔":"🥴";ut.info(`Generated CSS in ${k}ms! ${D}`)}catch(n){console.error(n)}},le=async(t,e,s=yt())=>{try{const n=await I(t);if(Q(e)){const i=[],r=await mt(t),{contents:y}=await ot(t,e,n);for(const[b,m]of Object.entries(y)){if(m.isKeyframes&&m.css){const u=`css/${`a_${m.animationName}.css`}`,$=c.join(n,u);d.writeFileSync($,await m.css);return}if(m.isClassName){const p=m.generator._withBuildContext({callerName:b,isProduction:s,config:r}),u=await p.css;if(!u)continue;i[p.priority]||(i[p.priority]=[]),i[p.priority].push(p.cssFileName);const $=`css/${p.cssFileName}`,P=c.join(n,$);d.writeFileSync(P,u)}if(!m.generator)return;const l=m.generator._withBuildContext({callerName:b,isProduction:s,config:r}),w=await l.css;if(!w)continue;const h=`css/${l.cssFileName}`,S=c.join(n,h);d.writeFileSync(S,w),i[l.priority]||(i[l.priority]=[]),i[l.priority].push(l.cssFileName)}if(r.importStrategy!=="component")i.forEach((b,m)=>{const l=`l_${m}.css`,w=c.join(n,"css",l);let h=d.readFileSync(w,"utf8");b.forEach(S=>{var P;const p=c.join(n,"css",S),u=((P=/.*-([^-]+)-\d+.css/.exec(S))==null?void 0:P.at(1))||q(p,6);if(!h.includes(u)){const x=d.readFileSync(p,"utf8"),O=`/*start:${u}-${S}*/
36
36
  ${x}
37
- /*end:${d}*/
38
- `;m=`${m.replace(/\}$/,"")}
39
- ${E}
40
- }`}}),f.writeFileSync(w,m)});else{const g=r.flat().map(S=>`@import url('./${S}');`).join(`
41
- `),h=W(e,6),u=c.parse(e),w=v(u.name),m=c.join(n,`css/f_${w}-${h}.css`);f.writeFileSync(m,g||"/* Empty file */")}}}catch(n){console.error(n)}},fe=async(t,e,s=yt())=>{var n,o;try{const r=await A(t);if(L(e)){const y=f.readFileSync(e,"utf8"),g=await mt(t),{contents:h}=await rt(t,e,r);let u=y;for(const[w,m]of Object.entries(h)){if(m.isKeyframes||!m.generator)continue;const S=m.generator._withBuildContext({callerName:w,isProduction:s,config:g}),[p,d]=await se(u,w),$=u.slice(p,d);if(m.isClassName){const P=u,x=` ${w} = className("${S.classNames}")`;u=u.replace($,x),P===u&&console.error("Minimize file failed to change content",{name:w})}if($.includes("styled")){const P=(o=(n=/styled\(([^,]+),/.exec($))==null?void 0:n.at(1))==null?void 0:o.trim(),x=u,E=` ${w} = styled(${P}, "${S.classNames}", ${JSON.stringify(S.clientProps)})`;u=u.replace($,E),x===u&&console.error("Minimize file failed to change content",{name:w,tagName:P})}}if(g.importStrategy==="component"){const w=W(e,6),m=c.parse(e);u=`import '../../saltygen/css/${`f_${v(m.name)}-${w}.css`}';
42
- ${u}`}return u=u.replace("@salty-css/react/class-name","@salty-css/react/class-name-client"),u=u.replace("{ styled }","{ styledClient as styled }"),u=u.replace("@salty-css/react/styled","@salty-css/react/styled-client"),u}}catch(r){console.error("Error in minimizeFile:",r)}},St=async t=>{if(!t||t.includes("node_modules")||t.includes("saltygen"))return!1;if(t.includes("salty.config"))return!0;if(!L(t))return!1;const n=await dt.readFile(t,"utf-8");return!!/.+define[A-Z]\w+/.test(n)},Ot=t=>({name:"stylegen",buildStart:()=>ce(t),load:async e=>{if(L(e))return await fe(t,e)},handleHotUpdate:async({file:e,server:s})=>{await St(e)&&s.restart()},watchChange:{handler:async e=>{L(e)&&(await St(e)||await le(t,e))}}});exports.default=Ot;exports.saltyPlugin=Ot;
37
+ /*end:${u}*/
38
+ `;h=`${h.replace(/\}$/,"")}
39
+ ${O}
40
+ }`}}),d.writeFileSync(w,h)});else{const b=i.flat().map(S=>`@import url('./${S}');`).join(`
41
+ `),m=q(e,6),l=c.parse(e),w=v(l.name),h=c.join(n,`css/f_${w}-${m}.css`);d.writeFileSync(h,b||"/* Empty file */")}}}catch(n){console.error(n)}},fe=async(t,e,s=yt())=>{var n,o;try{const i=await I(t);if(Q(e)){const y=d.readFileSync(e,"utf8"),b=await mt(t),{contents:m}=await ot(t,e,i);let l=y;for(const[w,h]of Object.entries(m)){if(h.isKeyframes||!h.generator)continue;const S=h.generator._withBuildContext({callerName:w,isProduction:s,config:b}),[p,u]=await se(l,w),$=l.slice(p,u);if(h.isClassName){const P=l,x=` ${w} = className("${S.classNames}")`;l=l.replace($,x),P===l&&console.error("Minimize file failed to change content",{name:w})}if($.includes("styled")){const P=(o=(n=/styled\(([^,]+),/.exec($))==null?void 0:n.at(1))==null?void 0:o.trim(),x=l,O=` ${w} = styled(${P}, "${S.classNames}", ${JSON.stringify(S.clientProps)})`;l=l.replace($,O),x===l&&console.error("Minimize file failed to change content",{name:w,tagName:P})}}if(b.importStrategy==="component"){const w=q(e,6),h=c.parse(e);l=`import '../../saltygen/css/${`f_${v(h.name)}-${w}.css`}';
42
+ ${l}`}return l=l.replace("@salty-css/react/class-name","@salty-css/react/class-name-client"),l=l.replace("{ styled }","{ styledClient as styled }"),l=l.replace("@salty-css/react/styled","@salty-css/react/styled-client"),l}}catch(i){console.error("Error in minimizeFile:",i)}},St=async t=>{if(!t||t.includes("node_modules")||t.includes("saltygen"))return!1;if(t.includes("salty.config"))return!0;if(!Q(t))return!1;const n=await dt.readFile(t,"utf-8");return!!/.+define[A-Z]\w+/.test(n)},Ot=t=>({name:"stylegen",buildStart:()=>ce(t),load:async e=>{if(Q(e))return await fe(t,e)},handleHotUpdate:async({file:e,server:s})=>{await St(e)&&s.restart()},watchChange:{handler:async e=>{Q(e)&&(await St(e)||await le(t,e))}}});exports.default=Ot;exports.saltyPlugin=Ot;
package/index.js CHANGED
@@ -1,40 +1,40 @@
1
1
  var vt = Object.defineProperty;
2
2
  var Jt = (e, t, s) => t in e ? vt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
- var ot = (e, t, s) => Jt(e, typeof t != "symbol" ? t + "" : t, s);
3
+ var nt = (e, t, s) => Jt(e, typeof t != "symbol" ? t + "" : t, s);
4
4
  import * as Pt from "esbuild";
5
5
  import { execSync as zt } from "child_process";
6
- import { join as u, parse as at } from "path";
7
- import { existsSync as mt, mkdirSync as K, statSync as Wt, readdirSync as At, readFileSync as M, writeFileSync as x } from "fs";
6
+ import { join as u, parse as rt } from "path";
7
+ import { existsSync as mt, mkdirSync as K, statSync as Wt, readdirSync as At, readFileSync as R, writeFileSync as x } from "fs";
8
8
  import { readFile as ht } from "fs/promises";
9
9
  import { createLogger as Ht, format as ut, transports as It } from "winston";
10
10
  import pt from "typescript";
11
- const Ct = (e) => String.fromCharCode(e + (e > 25 ? 39 : 97)), Gt = (e, t) => {
11
+ const Ct = (e) => String.fromCharCode(e + (e > 25 ? 39 : 97)), Qt = (e, t) => {
12
12
  let s = "", n;
13
13
  for (n = Math.abs(e); n > 52; n = n / 52 | 0) s = Ct(n % 52) + s;
14
14
  return s = Ct(n % 52) + s, s.length < t ? s = s.padStart(t, "a") : s.length > t && (s = s.slice(-t)), s;
15
- }, Kt = (e, t) => {
15
+ }, Gt = (e, t) => {
16
16
  let s = t.length;
17
17
  for (; s; ) e = e * 33 ^ t.charCodeAt(--s);
18
18
  return e;
19
- }, A = (e, t = 5) => {
20
- const s = Kt(5381, JSON.stringify(e)) >>> 0;
21
- return Gt(s, t);
19
+ }, I = (e, t = 5) => {
20
+ const s = Gt(5381, JSON.stringify(e)) >>> 0;
21
+ return Qt(s, t);
22
22
  };
23
23
  function J(e) {
24
24
  return e ? typeof e != "string" ? J(String(e)) : e.replace(/[\s.]/g, "-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g, (t, s) => (s > 0 ? "-" : "") + t.toLowerCase()) : "";
25
25
  }
26
- const Lt = (e) => (t) => {
26
+ const Kt = (e) => (t) => {
27
27
  if (typeof t != "string" || !e) return;
28
28
  let s = t;
29
29
  const n = [];
30
30
  return Object.values(e).forEach((o) => {
31
- const { pattern: r, transform: a } = o;
32
- s = s.replace(r, (m) => {
33
- const { value: y, css: h } = a(m);
34
- return h && n.push(h), y;
31
+ const { pattern: a, transform: r } = o;
32
+ s = s.replace(a, (m) => {
33
+ const { value: $, css: d } = r(m);
34
+ return d && n.push(d), $;
35
35
  });
36
36
  }), { transformed: s, additionalCss: n };
37
- }, Nt = (e) => (t) => typeof t != "string" || !/\{[^{}]+\}/g.test(t) ? void 0 : { transformed: t.replace(/\{([^{}]+)\}/g, (...o) => `var(--${J(o[1].replaceAll(".", "-"))})`) }, Qt = Nt(), Zt = [
37
+ }, Nt = (e) => (t) => typeof t != "string" || !/\{[^{}]+\}/g.test(t) ? void 0 : { transformed: t.replace(/\{([^{}]+)\}/g, (...o) => `var(--${J(o[1].replaceAll(".", "-"))})`) }, Lt = Nt(), Zt = [
38
38
  "top",
39
39
  "right",
40
40
  "bottom",
@@ -55,92 +55,92 @@ const Lt = (e) => (t) => {
55
55
  /.*size.*/,
56
56
  /.*thickness.*/,
57
57
  /.*font-size.*/
58
- ], Bt = (e, t, s) => Zt.some((o) => typeof o == "string" ? o === e : o.test(e)) ? `${t}px` : `${t}`, Ut = ["Webkit", "Moz", "ms", "O"], qt = (e) => e.startsWith("-") ? e : Ut.some((t) => e.startsWith(t)) ? `-${J(e)}` : J(e), rt = async (e, t = "", s, n = !1) => {
58
+ ], Bt = (e, t, s) => Zt.some((o) => typeof o == "string" ? o === e : o.test(e)) ? `${t}px` : `${t}`, Ut = ["Webkit", "Moz", "ms", "O"], qt = (e) => e.startsWith("-") ? e : Ut.some((t) => e.startsWith(t)) ? `-${J(e)}` : J(e), ot = async (e, t = "", s, n = !1) => {
59
59
  if (!e) throw new Error("No styles provided to parseStyles function!");
60
- const o = /* @__PURE__ */ new Set(), r = Object.entries(e), a = async ([p, f]) => {
61
- const $ = p.trim(), F = qt($), _ = (R, D = ";") => `${F}:${R}${D}`, O = { scope: t, config: s };
62
- if (typeof f == "function") return a([p, f(O)]);
63
- if (f instanceof Promise) return a([p, await f]);
60
+ const o = /* @__PURE__ */ new Set(), a = Object.entries(e), r = async ([p, f]) => {
61
+ const w = p.trim(), F = qt(w), _ = (v, D = ";") => `${F}:${v}${D}`, E = { scope: t, config: s };
62
+ if (typeof f == "function") return r([p, f(E)]);
63
+ if (f instanceof Promise) return r([p, await f]);
64
64
  if (typeof f == "object") {
65
65
  if (!f) return;
66
66
  if (f.isColor) return _(f.toString());
67
- if ($ === "defaultVariants") return;
68
- if ($ === "variants") {
67
+ if (w === "defaultVariants") return;
68
+ if (w === "variants") {
69
69
  const k = Object.entries(f);
70
- for (const [i, w] of k) {
71
- if (!w) return;
72
- const j = Object.entries(w);
73
- for (const [c, S] of j) {
74
- if (!S) return;
75
- const P = `${t}.${i}-${c}`;
76
- (await rt(S, P, s)).forEach((W) => o.add(W));
70
+ for (const [i, y] of k) {
71
+ if (!y) return;
72
+ const S = Object.entries(y);
73
+ for (const [l, j] of S) {
74
+ if (!j) return;
75
+ const P = `${t}.${i}-${l}`;
76
+ (await ot(j, P, s)).forEach((W) => o.add(W));
77
77
  }
78
78
  }
79
79
  return;
80
80
  }
81
- if ($ === "compoundVariants") {
81
+ if (w === "compoundVariants") {
82
82
  for (const k of f) {
83
- const { css: i, ...w } = k, j = Object.entries(w).reduce((S, [P, E]) => `${S}.${P}-${E}`, t);
84
- (await rt(i, j, s)).forEach((S) => o.add(S));
83
+ const { css: i, ...y } = k, S = Object.entries(y).reduce((j, [P, O]) => `${j}.${P}-${O}`, t);
84
+ (await ot(i, S, s)).forEach((j) => o.add(j));
85
85
  }
86
86
  return;
87
87
  }
88
- if ($.startsWith("@")) {
89
- const k = $, i = await X(f, t, s), w = `${k} { ${i} }`;
90
- o.add(w);
88
+ if (w.startsWith("@")) {
89
+ const k = w, i = await Y(f, t, s), y = `${k} { ${i} }`;
90
+ o.add(y);
91
91
  return;
92
92
  }
93
- const R = p.includes("&") ? $.replace("&", t) : $.startsWith(":") ? `${t}${$}` : `${t} ${$}`;
94
- (await rt(f, R, s)).forEach((k) => o.add(k));
93
+ const v = p.includes("&") ? w.replace("&", t) : w.startsWith(":") ? `${t}${w}` : `${t} ${w}`;
94
+ (await ot(f, v, s)).forEach((k) => o.add(k));
95
95
  return;
96
96
  }
97
97
  if (typeof f == "number") {
98
- const R = Bt(F, f);
99
- return _(R);
98
+ const v = Bt(F, f);
99
+ return _(v);
100
100
  }
101
101
  if (typeof f != "string")
102
102
  if ("toString" in f) f = f.toString();
103
103
  else throw new Error(`Invalid value type for property ${F}`);
104
104
  return _(f);
105
- }, m = r.map(a), { modifiers: y } = {}, h = [Nt(), Lt(y)], g = (await Promise.all(m).then((p) => Promise.all(
106
- p.map((f) => h.reduce(async ($, F) => {
107
- const _ = await $;
105
+ }, m = a.map(r), { modifiers: $ } = {}, d = [Nt(), Kt($)], g = (await Promise.all(m).then((p) => Promise.all(
106
+ p.map((f) => d.reduce(async (w, F) => {
107
+ const _ = await w;
108
108
  if (!_) return _;
109
- const O = await F(_);
110
- if (!O) return _;
111
- const { transformed: R, additionalCss: D } = O;
109
+ const E = await F(_);
110
+ if (!E) return _;
111
+ const { transformed: v, additionalCss: D } = E;
112
112
  let k = "";
113
113
  if (D)
114
114
  for (const i of D)
115
- k += await X(i, "");
116
- return `${k}${R}`;
115
+ k += await Y(i, "");
116
+ return `${k}${v}`;
117
117
  }, Promise.resolve(f)))
118
118
  ))).filter((p) => p !== void 0).join(`
119
119
  `);
120
120
  if (!g.trim()) return Array.from(o);
121
- const d = t ? `${t} {
121
+ const h = t ? `${t} {
122
122
  ${g}
123
123
  }` : g;
124
- return o.has(d) ? Array.from(o) : [d, ...o];
125
- }, X = async (e, t, s, n = !1) => (await rt(e, t, s, n)).join(`
124
+ return o.has(h) ? Array.from(o) : [h, ...o];
125
+ }, Y = async (e, t, s, n = !1) => (await ot(e, t, s, n)).join(`
126
126
  `), _t = async (e, t = []) => {
127
127
  if (!e) return "";
128
128
  const s = [], n = {};
129
- for (const [o, r] of Object.entries(e))
130
- if (typeof r != "function") if (r && typeof r == "object") {
131
- const a = o.trim(), m = await _t(r, [...t, a]);
129
+ for (const [o, a] of Object.entries(e))
130
+ if (typeof a != "function") if (a && typeof a == "object") {
131
+ const r = o.trim(), m = await _t(a, [...t, r]);
132
132
  s.push(m);
133
133
  } else
134
- n[o] = r;
134
+ n[o] = a;
135
135
  if (Object.keys(n).length) {
136
- const o = t.map(J).join("-"), r = "t_" + A(o, 4), a = await X(n, `.${o}, .${r}`);
137
- s.push(a);
136
+ const o = t.map(J).join("-"), a = "t_" + I(o, 4), r = await Y(n, `.${o}, .${a}`);
137
+ s.push(r);
138
138
  }
139
139
  return s.join(`
140
140
  `);
141
141
  }, Xt = (e) => e ? Object.entries(e).reduce((t, [s, n]) => (typeof n == "function" ? t[s] = "any" : typeof n == "object" && (t[s] = xt(n).map((o) => `"${o}"`).join(" | ")), t), {}) : {}, xt = (e, t = "", s = /* @__PURE__ */ new Set()) => e ? (Object.entries(e).forEach(([n, o]) => {
142
- const r = t ? `${t}.${n}` : n;
143
- return typeof o == "object" ? xt(o, r, s) : s.add(t);
142
+ const a = t ? `${t}.${n}` : n;
143
+ return typeof o == "object" ? xt(o, a, s) : s.add(t);
144
144
  }), [...s]) : [], Tt = (e) => {
145
145
  if (!e || e === "/") throw new Error("Could not find package.json file");
146
146
  const t = u(e, "package.json");
@@ -216,7 +216,7 @@ const ee = {
216
216
  }, L = (...e) => e.flat().reduce((t, s) => s != null && s._current ? { ...t, ...s._current } : { ...t, ...s }, {}), se = (...e) => e.flat().reduce((t, s) => ({ ...t, ...s._children }), {});
217
217
  class ne {
218
218
  constructor(t) {
219
- ot(this, "_path");
219
+ nt(this, "_path");
220
220
  this.params = t;
221
221
  }
222
222
  get _current() {
@@ -231,8 +231,8 @@ class ne {
231
231
  }
232
232
  class oe {
233
233
  constructor(t) {
234
- ot(this, "_path");
235
- ot(this, "templates", []);
234
+ nt(this, "_path");
235
+ nt(this, "templates", []);
236
236
  this.params = t, Object.entries(t).forEach(([s, n]) => {
237
237
  this.templates.push(
238
238
  new ne({
@@ -260,30 +260,30 @@ class oe {
260
260
  const re = (e) => new oe(e), ae = (e, t) => new Promise((s, n) => {
261
261
  const o = setTimeout(() => {
262
262
  n(new Error("Timeout"));
263
- }, 100), r = pt.createSourceFile("temp.ts", e, pt.ScriptTarget.Latest, !0);
264
- function a(m) {
263
+ }, 100), a = pt.createSourceFile("temp.ts", e, pt.ScriptTarget.Latest, !0);
264
+ function r(m) {
265
265
  if (pt.isVariableDeclaration(m) && m.name.getText() === t) {
266
- const y = m.getStart(), h = m.getEnd();
267
- clearTimeout(o), s([y, h]);
266
+ const $ = m.getStart(), d = m.getEnd();
267
+ clearTimeout(o), s([$, d]);
268
268
  }
269
- m.forEachChild(a);
269
+ m.forEachChild(r);
270
270
  }
271
- a(r);
271
+ r(a);
272
272
  }), z = {
273
273
  externalModules: [],
274
274
  rcFile: void 0,
275
275
  destDir: void 0
276
276
  }, Et = (e) => {
277
277
  if (z.externalModules.length > 0) return z.externalModules;
278
- const s = M(e, "utf8").match(/externalModules:\s?\[(.*)\]/);
278
+ const s = R(e, "utf8").match(/externalModules:\s?\[(.*)\]/);
279
279
  if (!s) return [];
280
280
  const n = s[1].split(",").map((o) => o.replace(/['"`]/g, "").trim());
281
281
  return z.externalModules = n, n;
282
- }, H = async (e) => {
282
+ }, Q = async (e) => {
283
283
  if (z.destDir) return z.destDir;
284
284
  const t = await yt(e), s = u(e, (t == null ? void 0 : t.saltygenDir) || "saltygen");
285
285
  return z.destDir = s, s;
286
- }, Ot = ["salty", "css", "styles", "styled"], ie = (e = []) => new RegExp(`\\.(${[...Ot, ...e].join("|")})\\.`), Q = (e, t = []) => ie(t).test(e), Vt = async (e) => {
286
+ }, Ot = ["salty", "css", "styles", "styled"], ie = (e = []) => new RegExp(`\\.(${[...Ot, ...e].join("|")})\\.`), Z = (e, t = []) => ie(t).test(e), Vt = async (e) => {
287
287
  if (z.rcFile) return z.rcFile;
288
288
  if (e === "/") throw new Error("Could not find .saltyrc.json file");
289
289
  const t = u(e, ".saltyrc.json"), s = await ht(t, "utf-8").then(JSON.parse).catch(() => {
@@ -291,24 +291,24 @@ const re = (e) => new oe(e), ae = (e, t) => new Promise((s, n) => {
291
291
  return s ? (z.rcFile = s, s) : Vt(u(e, ".."));
292
292
  }, yt = async (e) => {
293
293
  var n, o;
294
- const t = await Vt(e), s = (n = t.projects) == null ? void 0 : n.find((r) => e.endsWith(r.dir || ""));
295
- return s || ((o = t.projects) == null ? void 0 : o.find((r) => r.dir === t.defaultProject));
294
+ const t = await Vt(e), s = (n = t.projects) == null ? void 0 : n.find((a) => e.endsWith(a.dir || ""));
295
+ return s || ((o = t.projects) == null ? void 0 : o.find((a) => a.dir === t.defaultProject));
296
296
  }, ce = async (e) => {
297
- const t = await yt(e), s = await H(e), n = u(e, (t == null ? void 0 : t.configDir) || "", "salty.config.ts"), o = u(s, "salty.config.js"), r = await Dt(e), a = Et(n);
297
+ const t = await yt(e), s = await Q(e), n = u(e, (t == null ? void 0 : t.configDir) || "", "salty.config.ts"), o = u(s, "salty.config.js"), a = await Dt(e), r = Et(n);
298
298
  await Pt.build({
299
299
  entryPoints: [n],
300
300
  minify: !0,
301
301
  treeShaking: !0,
302
302
  bundle: !0,
303
303
  outfile: o,
304
- format: r,
305
- external: a
304
+ format: a,
305
+ external: r
306
306
  });
307
- const m = Date.now(), { config: y } = await import(`${o}?t=${m}`);
308
- return { config: y, path: o };
307
+ const m = Date.now(), { config: $ } = await import(`${o}?t=${m}`);
308
+ return { config: $, path: o };
309
309
  }, le = async (e, t) => {
310
310
  var $t, bt;
311
- const s = await H(e), n = {
311
+ const s = await Q(e), n = {
312
312
  mediaQueries: [],
313
313
  globalStyles: [],
314
314
  variables: [],
@@ -316,87 +316,87 @@ const re = (e) => new oe(e), ae = (e, t) => new Promise((s, n) => {
316
316
  };
317
317
  await Promise.all(
318
318
  [...t].map(async (C) => {
319
- const { contents: N, outputFilePath: q } = await it(e, C, s);
320
- Object.entries(N).forEach(([v, T]) => {
321
- T.isMedia ? n.mediaQueries.push([v, T]) : T.isGlobalDefine ? n.globalStyles.push(T) : T.isDefineVariables ? n.variables.push(T) : T.isDefineTemplates && n.templates.push(T._setPath(`${v};;${q}`));
319
+ const { contents: N, outputFilePath: q } = await at(e, C, s);
320
+ Object.entries(N).forEach(([V, T]) => {
321
+ T.isMedia ? n.mediaQueries.push([V, T]) : T.isGlobalDefine ? n.globalStyles.push(T) : T.isDefineVariables ? n.variables.push(T) : T.isDefineTemplates && n.templates.push(T._setPath(`${V};;${q}`));
322
322
  });
323
323
  })
324
324
  );
325
- const { config: o, path: r } = await ce(e), a = { ...o }, m = /* @__PURE__ */ new Set(), y = async (C, N = []) => {
325
+ const { config: o, path: a } = await ce(e), r = { ...o }, { mediaQueries: m } = n;
326
+ r.mediaQueries = Object.fromEntries(m.map(([C, N]) => [`@${C}`, N]));
327
+ const $ = m.map(([C]) => `'@${C}'`).join(" | "), d = /* @__PURE__ */ new Set(), c = async (C, N = []) => {
326
328
  if (!C) return [];
327
- const q = Object.entries(C).map(async ([T, I]) => {
328
- const st = async (V) => {
329
- if (!V) return;
330
- if (V instanceof Promise) return await st(await V);
331
- if (typeof V == "function") return await st(await V());
332
- if (typeof V == "object") return await y(V, [...N, T]);
329
+ const q = Object.entries(C).map(async ([T, H]) => {
330
+ const X = async (M) => {
331
+ if (!M) return;
332
+ if (M instanceof Promise) return await X(await M);
333
+ if (typeof M == "function") return await X(await M());
334
+ if (typeof M == "object") return await c(M, [...N, T]);
333
335
  const ct = kt(T), lt = J(T), ft = [...N, ct].join(".");
334
- m.add(`"${ft}"`);
335
- const nt = [...N.map(J), lt].join("-"), St = Qt(V);
336
- return St ? `--${nt}: ${St.transformed};` : `--${nt}: ${V};`;
336
+ d.add(`"${ft}"`);
337
+ const st = [...N.map(J), lt].join("-"), St = Lt(M);
338
+ return St ? `--${st}: ${St.transformed};` : `--${st}: ${M};`;
337
339
  };
338
- return await st(I);
340
+ return await X(H);
339
341
  });
340
342
  return (await Promise.all(q)).flat();
341
- }, h = async (C) => {
343
+ }, g = async (C) => {
342
344
  if (!C) return [];
343
- const N = Object.entries(C).map(async ([v, T]) => {
344
- const I = await y(T);
345
- return v === "base" ? I.join("") : `${v} { ${I.join("")} }`;
345
+ const N = Object.entries(C).map(async ([V, T]) => {
346
+ const H = await c(T);
347
+ return V === "base" ? H.join("") : r.mediaQueries[V] ? `${r.mediaQueries[V]} { ${H.join("")} }` : `${V} { ${H.join("")} }`;
346
348
  });
347
349
  return (await Promise.all(N)).flat();
348
- }, l = async (C) => {
350
+ }, h = async (C) => {
349
351
  if (!C) return [];
350
- const N = Object.entries(C).map(async ([v, T]) => {
351
- const I = Object.entries(T).map(async ([V, ct]) => {
352
- const lt = await y(ct, [v]), ft = `.${v}-${V}, [data-${v}="${V}"]`, nt = lt.join("");
353
- return `${ft} { ${nt} }`;
352
+ const N = Object.entries(C).map(async ([V, T]) => {
353
+ const H = Object.entries(T).map(async ([M, ct]) => {
354
+ const lt = await c(ct, [V]), ft = `.${V}-${M}, [data-${V}="${M}"]`, st = lt.join("");
355
+ return `${ft} { ${st} }`;
354
356
  });
355
- return (await Promise.all(I)).flat();
357
+ return (await Promise.all(H)).flat();
356
358
  });
357
359
  return (await Promise.all(N)).flat();
358
- }, g = (C) => ({ ...C, responsive: void 0, conditional: void 0 }), d = (C) => n.variables.map((N) => C === "static" ? g(N._current) : N._current[C]), b = L(g(o.variables), d("static")), p = await y(b), f = L(($t = o.variables) == null ? void 0 : $t.responsive, d("responsive")), $ = await h(f), F = L((bt = o.variables) == null ? void 0 : bt.conditional, d("conditional")), _ = await l(F), O = u(s, "css/_variables.css"), R = `:root { ${p.join("")} ${$.join("")} } ${_.join("")}`;
359
- x(O, R), a.staticVariables = b;
360
- const D = u(s, "css/_global.css"), k = L(o.global, n.globalStyles), i = await X(k, "");
361
- x(D, `@layer global { ${i} }`);
362
- const w = u(s, "css/_reset.css"), c = o.reset === "none" ? {} : typeof o.reset == "object" ? o.reset : ee, S = await X(c, "");
363
- x(w, `@layer reset { ${S} }`);
364
- const P = u(s, "css/_templates.css"), E = L(o.templates, n.templates), W = await _t(E), Z = Xt(E);
365
- x(P, `@layer templates { ${W} }`), a.templates = E;
366
- const B = o.templates ? [re(o.templates)._setPath(`config;;${r}`)] : [], Y = se(n.templates, B);
367
- a.templatePaths = Object.fromEntries(Object.entries(Y).map(([C, N]) => [C, N._path]));
368
- const { mediaQueries: tt } = n;
369
- a.mediaQueries = Object.fromEntries(tt.map(([C, N]) => [`@${C}`, N]));
370
- const U = tt.map(([C]) => `'@${C}'`).join(" | "), et = u(s, "types/css-tokens.d.ts"), Mt = `
360
+ }, b = (C) => ({ ...C, responsive: void 0, conditional: void 0 }), p = (C) => n.variables.map((N) => C === "static" ? b(N._current) : N._current[C]), f = L(b(o.variables), p("static")), w = await c(f), F = L(($t = o.variables) == null ? void 0 : $t.responsive, p("responsive")), _ = await g(F), E = L((bt = o.variables) == null ? void 0 : bt.conditional, p("conditional")), v = await h(E), D = u(s, "css/_variables.css"), k = `:root { ${w.join("")} ${_.join("")} } ${v.join("")}`;
361
+ x(D, k), r.staticVariables = f;
362
+ const i = u(s, "css/_global.css"), y = L(o.global, n.globalStyles), S = await Y(y, "");
363
+ x(i, `@layer global { ${S} }`);
364
+ const l = u(s, "css/_reset.css"), P = o.reset === "none" ? {} : typeof o.reset == "object" ? o.reset : ee, O = await Y(P, "");
365
+ x(l, `@layer reset { ${O} }`);
366
+ const W = u(s, "css/_templates.css"), A = L(o.templates, n.templates), B = await _t(A), tt = Xt(A);
367
+ x(W, `@layer templates { ${B} }`), r.templates = A;
368
+ const it = o.templates ? [re(o.templates)._setPath(`config;;${a}`)] : [], U = se(n.templates, it);
369
+ r.templatePaths = Object.fromEntries(Object.entries(U).map(([C, N]) => [C, N._path]));
370
+ const et = u(s, "types/css-tokens.d.ts"), Mt = `
371
371
  // Variable types
372
- type VariableTokens = ${[...m].join("|")};
372
+ type VariableTokens = ${[...d].join("|")};
373
373
  type PropertyValueToken = \`{\${VariableTokens}}\`;
374
374
 
375
375
  // Template types
376
376
  type TemplateTokens = {
377
- ${Object.entries(Z).map(([C, N]) => `${C}?: ${N}`).join(`
377
+ ${Object.entries(tt).map(([C, N]) => `${C}?: ${N}`).join(`
378
378
  `)}
379
379
  }
380
380
 
381
381
  // Media query types
382
- type MediaQueryKeys = ${U || "''"};
382
+ type MediaQueryKeys = ${$ || "''"};
383
383
  `;
384
384
  x(et, Mt);
385
385
  const Rt = u(s, "cache/config-cache.json");
386
- x(Rt, JSON.stringify(a, null, 2));
386
+ x(Rt, JSON.stringify(r, null, 2));
387
387
  }, jt = (e) => e.replace(/styled\(([^"'`{,]+),/g, (t, s) => {
388
388
  if (/^['"`]/.test(s)) return t;
389
389
  const o = new RegExp(`import[^;]*${s}[,\\s{][^;]*from\\s?([^{};]+);`);
390
390
  if (!o.test(e)) return t;
391
- const a = o.exec(e);
392
- if (a) {
393
- const m = a.at(1);
394
- if (Ot.some((h) => m == null ? void 0 : m.includes(h))) return t;
391
+ const r = o.exec(e);
392
+ if (r) {
393
+ const m = r.at(1);
394
+ if (Ot.some((d) => m == null ? void 0 : m.includes(d))) return t;
395
395
  }
396
396
  return "styled('div',";
397
397
  }), fe = (e, t) => {
398
398
  try {
399
- const s = M(u(t, "saltygen/cache/config-cache.json"), "utf8");
399
+ const s = R(u(t, "saltygen/cache/config-cache.json"), "utf8");
400
400
  return s ? `globalThis.saltyConfig = ${s};
401
401
 
402
402
  ${e}` : `globalThis.saltyConfig = {};
@@ -405,18 +405,18 @@ ${e}`;
405
405
  } catch {
406
406
  return e;
407
407
  }
408
- }, it = async (e, t, s) => {
409
- const n = A(t), o = u(s, "./temp");
408
+ }, at = async (e, t, s) => {
409
+ const n = I(t), o = u(s, "./temp");
410
410
  mt(o) || K(o);
411
- const r = at(t);
412
- let a = M(t, "utf8");
413
- a = jt(a), a = fe(a, e);
414
- const m = u(s, "js", n + ".js"), y = await yt(e), h = u(e, (y == null ? void 0 : y.configDir) || "", "salty.config.ts"), l = Et(h), g = await Dt(e);
411
+ const a = rt(t);
412
+ let r = R(t, "utf8");
413
+ r = jt(r), r = fe(r, e);
414
+ const m = u(s, "js", n + ".js"), $ = await yt(e), d = u(e, ($ == null ? void 0 : $.configDir) || "", "salty.config.ts"), c = Et(d), g = await Dt(e);
415
415
  await Pt.build({
416
416
  stdin: {
417
- contents: a,
418
- sourcefile: r.base,
419
- resolveDir: r.dir,
417
+ contents: r,
418
+ sourcefile: a.base,
419
+ resolveDir: a.dir,
420
420
  loader: "tsx"
421
421
  },
422
422
  minify: !1,
@@ -426,29 +426,29 @@ ${e}`;
426
426
  format: g,
427
427
  target: ["node20"],
428
428
  keepNames: !0,
429
- external: l,
429
+ external: c,
430
430
  packages: "external",
431
431
  plugins: [
432
432
  {
433
433
  name: "test",
434
434
  setup: (p) => {
435
435
  p.onLoad({ filter: /.*\.css|salty|styles|styled\.ts/ }, (f) => {
436
- const $ = M(f.path, "utf8");
437
- return { contents: jt($), loader: "ts" };
436
+ const w = R(f.path, "utf8");
437
+ return { contents: jt(w), loader: "ts" };
438
438
  });
439
439
  }
440
440
  }
441
441
  ]
442
442
  });
443
- const d = Date.now();
444
- return { contents: await import(`${m}?t=${d}`), outputFilePath: m };
443
+ const h = Date.now();
444
+ return { contents: await import(`${m}?t=${h}`), outputFilePath: m };
445
445
  }, ue = async (e) => {
446
- const t = await H(e), s = u(t, "cache/config-cache.json"), n = M(s, "utf8");
446
+ const t = await Q(e), s = u(t, "cache/config-cache.json"), n = R(s, "utf8");
447
447
  if (!n) throw new Error("Could not find config cache file");
448
448
  return JSON.parse(n);
449
449
  }, gt = async (e) => {
450
- const t = await ue(e), s = await H(e), n = u(s, "salty.config.js"), o = Date.now(), { config: r } = await import(`${n}?t=${o}`);
451
- return L(r, t);
450
+ const t = await ue(e), s = await Q(e), n = u(s, "salty.config.js"), o = Date.now(), { config: a } = await import(`${n}?t=${o}`);
451
+ return L(a, t);
452
452
  }, wt = () => {
453
453
  try {
454
454
  return process.env.NODE_ENV === "production";
@@ -459,94 +459,94 @@ ${e}`;
459
459
  try {
460
460
  const n = Date.now();
461
461
  t ? dt.info("Generating CSS in production mode! 🔥") : dt.info("Generating CSS in development mode! 🚀");
462
- const o = [], r = [], a = await H(e), m = u(a, "index.css");
462
+ const o = [], a = [], r = await Q(e), m = u(r, "index.css");
463
463
  s && (() => {
464
- mt(a) && zt("rm -rf " + a), K(a, { recursive: !0 }), K(u(a, "css")), K(u(a, "types")), K(u(a, "js")), K(u(a, "cache"));
464
+ mt(r) && zt("rm -rf " + r), K(r, { recursive: !0 }), K(u(r, "css")), K(u(r, "types")), K(u(r, "js")), K(u(r, "cache"));
465
465
  })();
466
- const h = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set();
466
+ const d = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set();
467
467
  async function g(i) {
468
- const w = ["node_modules", "saltygen"], j = Wt(i);
469
- if (j.isDirectory()) {
470
- const c = At(i);
471
- if (w.some((P) => i.includes(P))) return;
472
- await Promise.all(c.map((P) => g(u(i, P))));
473
- } else if (j.isFile() && Q(i)) {
474
- h.add(i);
475
- const S = M(i, "utf8");
476
- /define[\w\d]+\(/.test(S) && l.add(i);
468
+ const y = ["node_modules", "saltygen"], S = Wt(i);
469
+ if (S.isDirectory()) {
470
+ const l = At(i);
471
+ if (y.some((P) => i.includes(P))) return;
472
+ await Promise.all(l.map((P) => g(u(i, P))));
473
+ } else if (S.isFile() && Z(i)) {
474
+ d.add(i);
475
+ const j = R(i, "utf8");
476
+ /define[\w\d]+\(/.test(j) && c.add(i);
477
477
  }
478
478
  }
479
- await g(e), await le(e, l);
480
- const d = {
479
+ await g(e), await le(e, c);
480
+ const h = {
481
481
  keyframes: [],
482
482
  components: [],
483
483
  classNames: []
484
484
  };
485
485
  await Promise.all(
486
- [...h].map(async (i) => {
487
- const { contents: w } = await it(e, i, a);
488
- for (let [j, c] of Object.entries(w))
489
- c instanceof Promise && (c = await c), c.isKeyframes ? d.keyframes.push({
490
- value: c,
486
+ [...d].map(async (i) => {
487
+ const { contents: y } = await at(e, i, r);
488
+ for (let [S, l] of Object.entries(y))
489
+ l instanceof Promise && (l = await l), l.isKeyframes ? h.keyframes.push({
490
+ value: l,
491
491
  src: i,
492
- name: j
493
- }) : c.isClassName ? d.classNames.push({
494
- ...c,
492
+ name: S
493
+ }) : l.isClassName ? h.classNames.push({
494
+ ...l,
495
495
  src: i,
496
- name: j
497
- }) : c.generator && d.components.push({
498
- ...c,
496
+ name: S
497
+ }) : l.generator && h.components.push({
498
+ ...l,
499
499
  src: i,
500
- name: j
500
+ name: S
501
501
  });
502
502
  })
503
503
  );
504
504
  const b = await gt(e);
505
- for (const i of d.keyframes) {
506
- const { value: w } = i, j = `a_${w.animationName}.css`, c = `css/${j}`, S = u(a, c);
507
- o.push(j), x(S, w.css);
505
+ for (const i of h.keyframes) {
506
+ const { value: y } = i, S = `a_${y.animationName}.css`, l = `css/${S}`, j = u(r, l);
507
+ o.push(S), x(j, y.css);
508
508
  }
509
509
  const p = {};
510
- for (const i of d.components) {
511
- const { src: w, name: j } = i;
512
- p[w] || (p[w] = []);
513
- const c = i.generator._withBuildContext({
514
- callerName: j,
510
+ for (const i of h.components) {
511
+ const { src: y, name: S } = i;
512
+ p[y] || (p[y] = []);
513
+ const l = i.generator._withBuildContext({
514
+ callerName: S,
515
515
  isProduction: t,
516
516
  config: b
517
517
  });
518
- r[c.priority] || (r[c.priority] = []);
519
- const S = await c.css;
520
- if (!S) continue;
521
- r[c.priority].push(c.cssFileName);
522
- const P = `css/${c.cssFileName}`, E = u(a, P);
523
- x(E, S), b.importStrategy === "component" && p[w].push(c.cssFileName);
518
+ a[l.priority] || (a[l.priority] = []);
519
+ const j = await l.css;
520
+ if (!j) continue;
521
+ a[l.priority].push(l.cssFileName);
522
+ const P = `css/${l.cssFileName}`, O = u(r, P);
523
+ x(O, j), b.importStrategy === "component" && p[y].push(l.cssFileName);
524
524
  }
525
- for (const i of d.classNames) {
526
- const { src: w, name: j } = i;
527
- p[w] || (p[w] = []);
528
- const c = i.generator._withBuildContext({
529
- callerName: j,
525
+ for (const i of h.classNames) {
526
+ const { src: y, name: S } = i;
527
+ p[y] || (p[y] = []);
528
+ const l = i.generator._withBuildContext({
529
+ callerName: S,
530
530
  isProduction: t,
531
531
  config: b
532
- }), S = await c.css;
533
- if (!S) continue;
534
- r[c.priority] || (r[c.priority] = []), r[c.priority].push(c.cssFileName);
535
- const P = `css/${c.cssFileName}`, E = u(a, P);
536
- x(E, S), b.importStrategy === "component" && p[w].push(c.cssFileName);
532
+ }), j = await l.css;
533
+ if (!j) continue;
534
+ a[l.priority] || (a[l.priority] = []), a[l.priority].push(l.cssFileName);
535
+ const P = `css/${l.cssFileName}`, O = u(r, P);
536
+ x(O, j), b.importStrategy === "component" && p[y].push(l.cssFileName);
537
537
  }
538
- b.importStrategy === "component" && Object.entries(p).forEach(([i, w]) => {
539
- const j = w.map((W) => `@import url('./${W}');`).join(`
540
- `), c = A(i, 6), S = at(i), P = J(S.name), E = u(a, `css/f_${P}-${c}.css`);
541
- x(E, j || "/* Empty file */");
538
+ b.importStrategy === "component" && Object.entries(p).forEach(([i, y]) => {
539
+ const S = y.map((W) => `@import url('./${W}');`).join(`
540
+ `), l = I(i, 6), j = rt(i), P = J(j.name), O = u(r, `css/f_${P}-${l}.css`);
541
+ x(O, S || "/* Empty file */");
542
542
  });
543
543
  const f = o.map((i) => `@import url('./css/${i}');`).join(`
544
544
  `);
545
- let O = `@layer reset, global, templates, l0, l1, l2, l3, l4, l5, l6, l7, l8;
545
+ let E = `@layer reset, global, templates, l0, l1, l2, l3, l4, l5, l6, l7, l8;
546
546
 
547
547
  ${["_variables.css", "_reset.css", "_global.css", "_templates.css"].filter((i) => {
548
548
  try {
549
- return M(u(a, "css", i), "utf8").length > 0;
549
+ return R(u(r, "css", i), "utf8").length > 0;
550
550
  } catch {
551
551
  return !1;
552
552
  }
@@ -554,23 +554,23 @@ ${["_variables.css", "_reset.css", "_global.css", "_templates.css"].filter((i) =
554
554
  `)}
555
555
  ${f}`;
556
556
  if (b.importStrategy !== "component") {
557
- const i = r.reduce((w, j, c) => {
558
- const S = j.reduce((Z, B) => {
557
+ const i = a.reduce((y, S, l) => {
558
+ const j = S.reduce((A, B) => {
559
559
  var et;
560
- const Y = u(a, "css", B), tt = M(Y, "utf8"), U = ((et = /.*-([^-]+)-\d+.css/.exec(B)) == null ? void 0 : et.at(1)) || A(Y, 6);
561
- return Z.includes(U) ? Z : `${Z}
560
+ const tt = u(r, "css", B), it = R(tt, "utf8"), U = ((et = /.*-([^-]+)-\d+.css/.exec(B)) == null ? void 0 : et.at(1)) || I(tt, 6);
561
+ return A.includes(U) ? A : `${A}
562
562
  /*start:${U}-${B}*/
563
- ${tt}
563
+ ${it}
564
564
  /*end:${U}*/
565
565
  `;
566
- }, ""), P = `l_${c}.css`, E = u(a, "css", P), W = `@layer l${c} { ${S}
566
+ }, ""), P = `l_${l}.css`, O = u(r, "css", P), W = `@layer l${l} { ${j}
567
567
  }`;
568
- return x(E, W), `${w}
568
+ return x(O, W), `${y}
569
569
  @import url('./css/${P}');`;
570
570
  }, "");
571
- O += i;
571
+ E += i;
572
572
  }
573
- x(m, O);
573
+ x(m, E);
574
574
  const D = Date.now() - n, k = D < 200 ? "🔥" : D < 500 ? "🚀" : D < 1e3 ? "🎉" : D < 2e3 ? "🚗" : D < 5e3 ? "🤔" : "🥴";
575
575
  dt.info(`Generated CSS in ${D}ms! ${k}`);
576
576
  } catch (n) {
@@ -578,58 +578,58 @@ ${tt}
578
578
  }
579
579
  }, de = async (e, t, s = wt()) => {
580
580
  try {
581
- const n = await H(e);
582
- if (Q(t)) {
583
- const r = [], a = await gt(e), { contents: m } = await it(e, t, n);
584
- for (const [y, h] of Object.entries(m)) {
585
- if (h.isKeyframes && h.css) {
586
- const f = `css/${`a_${h.animationName}.css`}`, $ = u(n, f);
587
- x($, await h.css);
581
+ const n = await Q(e);
582
+ if (Z(t)) {
583
+ const a = [], r = await gt(e), { contents: m } = await at(e, t, n);
584
+ for (const [$, d] of Object.entries(m)) {
585
+ if (d.isKeyframes && d.css) {
586
+ const f = `css/${`a_${d.animationName}.css`}`, w = u(n, f);
587
+ x(w, await d.css);
588
588
  return;
589
589
  }
590
- if (h.isClassName) {
591
- const p = h.generator._withBuildContext({
592
- callerName: y,
590
+ if (d.isClassName) {
591
+ const p = d.generator._withBuildContext({
592
+ callerName: $,
593
593
  isProduction: s,
594
- config: a
594
+ config: r
595
595
  }), f = await p.css;
596
596
  if (!f) continue;
597
- r[p.priority] || (r[p.priority] = []), r[p.priority].push(p.cssFileName);
598
- const $ = `css/${p.cssFileName}`, F = u(n, $);
597
+ a[p.priority] || (a[p.priority] = []), a[p.priority].push(p.cssFileName);
598
+ const w = `css/${p.cssFileName}`, F = u(n, w);
599
599
  x(F, f);
600
600
  }
601
- if (!h.generator) return;
602
- const l = h.generator._withBuildContext({
603
- callerName: y,
601
+ if (!d.generator) return;
602
+ const c = d.generator._withBuildContext({
603
+ callerName: $,
604
604
  isProduction: s,
605
- config: a
606
- }), g = await l.css;
605
+ config: r
606
+ }), g = await c.css;
607
607
  if (!g) continue;
608
- const d = `css/${l.cssFileName}`, b = u(n, d);
609
- x(b, g), r[l.priority] || (r[l.priority] = []), r[l.priority].push(l.cssFileName);
608
+ const h = `css/${c.cssFileName}`, b = u(n, h);
609
+ x(b, g), a[c.priority] || (a[c.priority] = []), a[c.priority].push(c.cssFileName);
610
610
  }
611
- if (a.importStrategy !== "component")
612
- r.forEach((y, h) => {
613
- const l = `l_${h}.css`, g = u(n, "css", l);
614
- let d = M(g, "utf8");
615
- y.forEach((b) => {
611
+ if (r.importStrategy !== "component")
612
+ a.forEach(($, d) => {
613
+ const c = `l_${d}.css`, g = u(n, "css", c);
614
+ let h = R(g, "utf8");
615
+ $.forEach((b) => {
616
616
  var F;
617
- const p = u(n, "css", b), f = ((F = /.*-([^-]+)-\d+.css/.exec(b)) == null ? void 0 : F.at(1)) || A(p, 6);
618
- if (!d.includes(f)) {
619
- const _ = M(p, "utf8"), O = `/*start:${f}-${b}*/
617
+ const p = u(n, "css", b), f = ((F = /.*-([^-]+)-\d+.css/.exec(b)) == null ? void 0 : F.at(1)) || I(p, 6);
618
+ if (!h.includes(f)) {
619
+ const _ = R(p, "utf8"), E = `/*start:${f}-${b}*/
620
620
  ${_}
621
621
  /*end:${f}*/
622
622
  `;
623
- d = `${d.replace(/\}$/, "")}
624
- ${O}
623
+ h = `${h.replace(/\}$/, "")}
624
+ ${E}
625
625
  }`;
626
626
  }
627
- }), x(g, d);
627
+ }), x(g, h);
628
628
  });
629
629
  else {
630
- const y = r.flat().map((b) => `@import url('./${b}');`).join(`
631
- `), h = A(t, 6), l = at(t), g = J(l.name), d = u(n, `css/f_${g}-${h}.css`);
632
- x(d, y || "/* Empty file */");
630
+ const $ = a.flat().map((b) => `@import url('./${b}');`).join(`
631
+ `), d = I(t, 6), c = rt(t), g = J(c.name), h = u(n, `css/f_${g}-${d}.css`);
632
+ x(h, $ || "/* Empty file */");
633
633
  }
634
634
  }
635
635
  } catch (n) {
@@ -638,47 +638,47 @@ ${O}
638
638
  }, me = async (e, t, s = wt()) => {
639
639
  var n, o;
640
640
  try {
641
- const r = await H(e);
642
- if (Q(t)) {
643
- const m = M(t, "utf8"), y = await gt(e), { contents: h } = await it(e, t, r);
644
- let l = m;
645
- for (const [g, d] of Object.entries(h)) {
646
- if (d.isKeyframes || !d.generator) continue;
647
- const b = d.generator._withBuildContext({
641
+ const a = await Q(e);
642
+ if (Z(t)) {
643
+ const m = R(t, "utf8"), $ = await gt(e), { contents: d } = await at(e, t, a);
644
+ let c = m;
645
+ for (const [g, h] of Object.entries(d)) {
646
+ if (h.isKeyframes || !h.generator) continue;
647
+ const b = h.generator._withBuildContext({
648
648
  callerName: g,
649
649
  isProduction: s,
650
- config: y
651
- }), [p, f] = await ae(l, g), $ = l.slice(p, f);
652
- if (d.isClassName) {
653
- const F = l, _ = ` ${g} = className("${b.classNames}")`;
654
- l = l.replace($, _), F === l && console.error("Minimize file failed to change content", { name: g });
650
+ config: $
651
+ }), [p, f] = await ae(c, g), w = c.slice(p, f);
652
+ if (h.isClassName) {
653
+ const F = c, _ = ` ${g} = className("${b.classNames}")`;
654
+ c = c.replace(w, _), F === c && console.error("Minimize file failed to change content", { name: g });
655
655
  }
656
- if ($.includes("styled")) {
657
- const F = (o = (n = /styled\(([^,]+),/.exec($)) == null ? void 0 : n.at(1)) == null ? void 0 : o.trim(), _ = l, O = ` ${g} = styled(${F}, "${b.classNames}", ${JSON.stringify(b.clientProps)})`;
658
- l = l.replace($, O), _ === l && console.error("Minimize file failed to change content", { name: g, tagName: F });
656
+ if (w.includes("styled")) {
657
+ const F = (o = (n = /styled\(([^,]+),/.exec(w)) == null ? void 0 : n.at(1)) == null ? void 0 : o.trim(), _ = c, E = ` ${g} = styled(${F}, "${b.classNames}", ${JSON.stringify(b.clientProps)})`;
658
+ c = c.replace(w, E), _ === c && console.error("Minimize file failed to change content", { name: g, tagName: F });
659
659
  }
660
660
  }
661
- if (y.importStrategy === "component") {
662
- const g = A(t, 6), d = at(t);
663
- l = `import '../../saltygen/css/${`f_${J(d.name)}-${g}.css`}';
664
- ${l}`;
661
+ if ($.importStrategy === "component") {
662
+ const g = I(t, 6), h = rt(t);
663
+ c = `import '../../saltygen/css/${`f_${J(h.name)}-${g}.css`}';
664
+ ${c}`;
665
665
  }
666
- return l = l.replace("@salty-css/react/class-name", "@salty-css/react/class-name-client"), l = l.replace("{ styled }", "{ styledClient as styled }"), l = l.replace("@salty-css/react/styled", "@salty-css/react/styled-client"), l;
666
+ return c = c.replace("@salty-css/react/class-name", "@salty-css/react/class-name-client"), c = c.replace("{ styled }", "{ styledClient as styled }"), c = c.replace("@salty-css/react/styled", "@salty-css/react/styled-client"), c;
667
667
  }
668
- } catch (r) {
669
- console.error("Error in minimizeFile:", r);
668
+ } catch (a) {
669
+ console.error("Error in minimizeFile:", a);
670
670
  }
671
671
  }, Ft = async (e) => {
672
672
  if (!e || e.includes("node_modules") || e.includes("saltygen")) return !1;
673
673
  if (e.includes("salty.config")) return !0;
674
- if (!Q(e)) return !1;
674
+ if (!Z(e)) return !1;
675
675
  const n = await ht(e, "utf-8");
676
676
  return !!/.+define[A-Z]\w+/.test(n);
677
677
  }, je = (e) => ({
678
678
  name: "stylegen",
679
679
  buildStart: () => pe(e),
680
680
  load: async (t) => {
681
- if (Q(t))
681
+ if (Z(t))
682
682
  return await me(e, t);
683
683
  },
684
684
  handleHotUpdate: async ({ file: t, server: s }) => {
@@ -686,7 +686,7 @@ ${l}`;
686
686
  },
687
687
  watchChange: {
688
688
  handler: async (t) => {
689
- Q(t) && (await Ft(t) || await de(e, t));
689
+ Z(t) && (await Ft(t) || await de(e, t));
690
690
  }
691
691
  }
692
692
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/vite",
3
- "version": "0.0.1-alpha.235",
3
+ "version": "0.0.1-alpha.237",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",
@@ -34,6 +34,6 @@
34
34
  }
35
35
  },
36
36
  "dependencies": {
37
- "@salty-css/core": "^0.0.1-alpha.235"
37
+ "@salty-css/core": "^0.0.1-alpha.237"
38
38
  }
39
39
  }