@salty-css/webpack 0.0.1-alpha.235 → 0.0.1-alpha.236
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/index-C97eBBve.cjs +42 -0
- package/index-CHPE5cnj.js +678 -0
- package/index.cjs +1 -1
- package/index.js +1 -1
- package/loader.cjs +1 -1
- package/loader.js +1 -1
- package/package.json +2 -2
- package/index-B5IaIfZg.cjs +0 -42
- package/index-gNPxxbk_.js +0 -678
@@ -0,0 +1,42 @@
|
|
1
|
+
"use strict";var Vt=Object.defineProperty;var Mt=(t,e,s)=>e in t?Vt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var et=(t,e,s)=>Mt(t,typeof e!="symbol"?e+"":e,s);const vt=require("esbuild"),Rt=require("child_process"),c=require("path"),d=require("fs"),bt=require("fs/promises"),B=require("winston"),lt=require("typescript");var ft=typeof document<"u"?document.currentScript:null;function zt(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 St=zt(vt),wt=t=>String.fromCharCode(t+(t>25?39:97)),Jt=(t,e)=>{let s="",n;for(n=Math.abs(t);n>52;n=n/52|0)s=wt(n%52)+s;return s=wt(n%52)+s,s.length<e?s=s.padStart(e,"a"):s.length>e&&(s=s.slice(-e)),s},Wt=(t,e)=>{let s=e.length;for(;s;)t=t*33^e.charCodeAt(--s);return t},q=(t,e=5)=>{const s=Wt(5381,JSON.stringify(t))>>>0;return Jt(s,e)};function R(t){return t?typeof t!="string"?R(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 At=t=>e=>{if(typeof e!="string"||!t)return;let s=e;const n=[];return Object.values(t).forEach(i=>{const{pattern:r,transform:o}=i;s=s.replace(r,y=>{const{value:b,css:m}=o(y);return m&&n.push(m),b})}),{transformed:s,additionalCss:n}},jt=t=>e=>typeof e!="string"||!/\{[^{}]+\}/g.test(e)?void 0:{transformed:e.replace(/\{([^{}]+)\}/g,(...i)=>`var(--${R(i[1].replaceAll(".","-"))})`)},qt=jt(),It=["top","right","bottom","left","min-width",/.*width.*/,/^[^line]*height.*/,/padding.*/,/margin.*/,/border.*/,/inset.*/,/.*radius.*/,/.*spacing.*/,/.*gap.*/,/.*indent.*/,/.*offset.*/,/.*size.*/,/.*thickness.*/,/.*font-size.*/],Ht=(t,e,s)=>It.some(i=>typeof i=="string"?i===t:i.test(t))?`${e}px`:`${e}`,Lt=["Webkit","Moz","ms","O"],Qt=t=>t.startsWith("-")?t:Lt.some(e=>t.startsWith(e))?`-${R(t)}`:R(t),st=async(t,e="",s,n=!1)=>{if(!t)throw new Error("No styles provided to parseStyles function!");const i=new Set,r=Object.entries(t),o=async([p,u])=>{const $=p.trim(),P=Qt($),x=(v,k=";")=>`${P}:${v}${k}`,E={scope:e,config:s};if(typeof u=="function")return o([p,u(E)]);if(u instanceof Promise)return o([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 st(C,N,s)).forEach(J=>i.add(J))}}return}if($==="compoundVariants"){for(const D of u){const{css:a,...g}=D,j=Object.entries(g).reduce((C,[N,O])=>`${C}.${N}-${O}`,e);(await st(a,j,s)).forEach(C=>i.add(C))}return}if($.startsWith("@")){const D=$,a=await Z(u,e,s),g=`${D} { ${a} }`;i.add(g);return}const v=p.includes("&")?$.replace("&",e):$.startsWith(":")?`${e}${$}`:`${e} ${$}`;(await st(u,v,s)).forEach(D=>i.add(D));return}if(typeof u=="number"){const v=Ht(P,u);return x(v)}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=r.map(o),{modifiers:b}={},m=[jt(),At(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 E=await P(x);if(!E)return x;const{transformed:v,additionalCss:k}=E;let D="";if(k)for(const a of k)D+=await Z(a,"");return`${D}${v}`},Promise.resolve(u)))))).filter(p=>p!==void 0).join(`
|
2
|
+
`);if(!w.trim())return Array.from(i);const h=e?`${e} {
|
3
|
+
${w}
|
4
|
+
}`:w;return i.has(h)?Array.from(i):[h,...i]},Z=async(t,e,s,n=!1)=>(await st(t,e,s,n)).join(`
|
5
|
+
`),Ft=async(t,e=[])=>{if(!t)return"";const s=[],n={};for(const[i,r]of Object.entries(t))if(typeof r!="function")if(r&&typeof r=="object"){const o=i.trim(),y=await Ft(r,[...e,o]);s.push(y)}else n[i]=r;if(Object.keys(n).length){const i=e.map(R).join("-"),r="t_"+q(i,4),o=await Z(n,`.${i}, .${r}`);s.push(o)}return s.join(`
|
6
|
+
`)},Gt=t=>t?Object.entries(t).reduce((e,[s,n])=>(typeof n=="function"?e[s]="any":typeof n=="object"&&(e[s]=Ct(n).map(i=>`"${i}"`).join(" | ")),e),{}):{},Ct=(t,e="",s=new Set)=>t?(Object.entries(t).forEach(([n,i])=>{const r=e?`${e}.${n}`:n;return typeof i=="object"?Ct(i,r,s):s.add(e)}),[...s]):[],Pt=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:Pt(c.join(t,".."))},Kt=async t=>{const e=Pt(t);return await bt.readFile(e,"utf-8").then(JSON.parse).catch(()=>{})},Ut=async t=>{const e=await Kt(t);if(e)return e.type};let H;const Nt=async t=>{if(H)return H;const e=await Ut(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-C97eBBve.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 _t(t){return t?typeof t!="string"?_t(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},{}),Zt=(...t)=>t.flat().reduce((e,s)=>({...e,...s._children}),{});class Xt{constructor(e){et(this,"_path");this.params=e}get _current(){return this.params.template}get isDefineTemplate(){return!0}_setPath(e){return this._path=e,this}}class Yt{constructor(e){et(this,"_path");et(this,"templates",[]);this.params=e,Object.entries(e).forEach(([s,n])=>{this.templates.push(new Xt({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 te=t=>new Yt(t),ee=(t,e)=>new Promise((s,n)=>{const i=setTimeout(()=>{n(new Error("Timeout"))},100),r=lt.createSourceFile("temp.ts",t,lt.ScriptTarget.Latest,!0);function o(y){if(lt.isVariableDeclaration(y)&&y.name.getText()===e){const b=y.getStart(),m=y.getEnd();clearTimeout(i),s([b,m])}y.forEachChild(o)}o(r)}),z={externalModules:[],rcFile:void 0,destDir:void 0},xt=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(i=>i.replace(/['"`]/g,"").trim());return z.externalModules=n,n},I=async t=>{if(z.destDir)return z.destDir;const e=await dt(t),s=c.join(t,(e==null?void 0:e.saltygenDir)||"saltygen");return z.destDir=s,s},Tt=["salty","css","styles","styled"],kt=(t=[])=>new RegExp(`\\.(${[...Tt,...t].join("|")})\\.`),nt=(t,e=[])=>kt(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 bt.readFile(e,"utf-8").then(JSON.parse).catch(()=>{});return s?(z.rcFile=s,s):Dt(c.join(t,".."))},dt=async t=>{var n,i;const e=await Dt(t),s=(n=e.projects)==null?void 0:n.find(r=>t.endsWith(r.dir||""));return s||((i=e.projects)==null?void 0:i.find(r=>r.dir===e.defaultProject))},se=async t=>{const e=await dt(t),s=await I(t),n=c.join(t,(e==null?void 0:e.configDir)||"","salty.config.ts"),i=c.join(s,"salty.config.js"),r=await Nt(t),o=xt(n);await St.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:i,format:r,external:o});const y=Date.now(),{config:b}=await import(`${i}?t=${y}`);return{config:b,path:i}},ne=async(t,e)=>{var yt,ht;const s=await I(t),n={mediaQueries:[],globalStyles:[],variables:[],templates:[]};await Promise.all([...e].map(async F=>{const{contents:_,outputFilePath:K}=await it(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};;${K}`))})}));const{config:i,path:r}=await se(t),o={...i},{mediaQueries:y}=n;o.mediaQueries=Object.fromEntries(y.map(([F,_])=>[`@${F}`,_]));const b=y.map(([F])=>`'@${F}'`).join(" | "),m=new Set,l=async(F,_=[])=>{if(!F)return[];const K=Object.entries(F).map(async([T,A])=>{const U=async M=>{if(!M)return;if(M instanceof Promise)return await U(await M);if(typeof M=="function")return await U(await M());if(typeof M=="object")return await l(M,[..._,T]);const rt=_t(T),at=R(T),ct=[..._,rt].join(".");m.add(`"${ct}"`);const tt=[..._.map(R),at].join("-"),gt=qt(M);return gt?`--${tt}: ${gt.transformed};`:`--${tt}: ${M};`};return await U(A)});return(await Promise.all(K)).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(""):o.mediaQueries[V]?`${o.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([M,rt])=>{const at=await l(rt,[V]),ct=`.${V}-${M}, [data-${V}="${M}"]`,tt=at.join("");return`${ct} { ${tt} }`});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(i.variables),p("static")),$=await l(u),P=L((yt=i.variables)==null?void 0:yt.responsive,p("responsive")),x=await w(P),E=L((ht=i.variables)==null?void 0:ht.conditional,p("conditional")),v=await h(E),k=c.join(s,"css/_variables.css"),D=`:root { ${$.join("")} ${x.join("")} } ${v.join("")}`;d.writeFileSync(k,D),o.staticVariables=u;const a=c.join(s,"css/_global.css"),g=L(i.global,n.globalStyles),j=await Z(g,"");d.writeFileSync(a,`@layer global { ${j} }`);const f=c.join(s,"css/_reset.css"),N=i.reset==="none"?{}:typeof i.reset=="object"?i.reset:Bt,O=await Z(N,"");d.writeFileSync(f,`@layer reset { ${O} }`);const J=c.join(s,"css/_templates.css"),W=L(i.templates,n.templates),Q=await Ft(W),X=Gt(W);d.writeFileSync(J,`@layer templates { ${Q} }`),o.templates=W;const ot=i.templates?[te(i.templates)._setPath(`config;;${r}`)]:[],G=Zt(n.templates,ot);o.templatePaths=Object.fromEntries(Object.entries(G).map(([F,_])=>[F,_._path]));const Y=c.join(s,"types/css-tokens.d.ts"),Et=`
|
7
|
+
// Variable types
|
8
|
+
type VariableTokens = ${[...m].join("|")};
|
9
|
+
type PropertyValueToken = \`{\${VariableTokens}}\`;
|
10
|
+
|
11
|
+
// Template types
|
12
|
+
type TemplateTokens = {
|
13
|
+
${Object.entries(X).map(([F,_])=>`${F}?: ${_}`).join(`
|
14
|
+
`)}
|
15
|
+
}
|
16
|
+
|
17
|
+
// Media query types
|
18
|
+
type MediaQueryKeys = ${b||"''"};
|
19
|
+
`;d.writeFileSync(Y,Et);const Ot=c.join(s,"cache/config-cache.json");d.writeFileSync(Ot,JSON.stringify(o,null,2))},$t=t=>t.replace(/styled\(([^"'`{,]+),/g,(e,s)=>{if(/^['"`]/.test(s))return e;const i=new RegExp(`import[^;]*${s}[,\\s{][^;]*from\\s?([^{};]+);`);if(!i.test(t))return e;const o=i.exec(t);if(o){const y=o.at(1);if(Tt.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
|
+
|
21
|
+
${t}`:`globalThis.saltyConfig = {};
|
22
|
+
|
23
|
+
${t}`}catch{return t}},it=async(t,e,s)=>{const n=q(e),i=c.join(s,"./temp");d.existsSync(i)||d.mkdirSync(i);const r=c.parse(e);let o=d.readFileSync(e,"utf8");o=$t(o),o=ie(o,t);const y=c.join(s,"js",n+".js"),b=await dt(t),m=c.join(t,(b==null?void 0:b.configDir)||"","salty.config.ts"),l=xt(m),w=await Nt(t);await St.build({stdin:{contents:o,sourcefile:r.base,resolveDir:r.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:$t($),loader:"ts"}})}}]});const h=Date.now();return{contents:await import(`${y}?t=${h}`),outputFilePath:y}},oe=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)},pt=async t=>{const e=await oe(t),s=await I(t),n=c.join(s,"salty.config.js"),i=Date.now(),{config:r}=await import(`${n}?t=${i}`);return L(r,e)},mt=()=>{try{return process.env.NODE_ENV==="production"}catch{return!1}},re=async(t,e=mt(),s=!0)=>{try{const n=Date.now();e?ut.info("Generating CSS in production mode! 🔥"):ut.info("Generating CSS in development mode! 🚀");const i=[],r=[],o=await I(t),y=c.join(o,"index.css");s&&(()=>{d.existsSync(o)&&Rt.execSync("rm -rf "+o),d.mkdirSync(o,{recursive:!0}),d.mkdirSync(c.join(o,"css")),d.mkdirSync(c.join(o,"types")),d.mkdirSync(c.join(o,"js")),d.mkdirSync(c.join(o,"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()&&nt(a)){m.add(a);const C=d.readFileSync(a,"utf8");/define[\w\d]+\(/.test(C)&&l.add(a)}}await w(t),await ne(t,l);const h={keyframes:[],components:[],classNames:[]};await Promise.all([...m].map(async a=>{const{contents:g}=await it(t,a,o);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 pt(t);for(const a of h.keyframes){const{value:g}=a,j=`a_${g.animationName}.css`,f=`css/${j}`,C=c.join(o,f);i.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});r[f.priority]||(r[f.priority]=[]);const C=await f.css;if(!C)continue;r[f.priority].push(f.cssFileName);const N=`css/${f.cssFileName}`,O=c.join(o,N);d.writeFileSync(O,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;r[f.priority]||(r[f.priority]=[]),r[f.priority].push(f.cssFileName);const N=`css/${f.cssFileName}`,O=c.join(o,N);d.writeFileSync(O,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=R(C.name),O=c.join(o,`css/f_${N}-${f}.css`);d.writeFileSync(O,j||"/* Empty file */")});const u=i.map(a=>`@import url('./css/${a}');`).join(`
|
25
|
+
`);let E=`@layer reset, global, templates, l0, l1, l2, l3, l4, l5, l6, l7, l8;
|
26
|
+
|
27
|
+
${["_variables.css","_reset.css","_global.css","_templates.css"].filter(a=>{try{return d.readFileSync(c.join(o,"css",a),"utf8").length>0}catch{return!1}}).map(a=>`@import url('./css/${a}');`).join(`
|
28
|
+
`)}
|
29
|
+
${u}`;if(S.importStrategy!=="component"){const a=r.reduce((g,j,f)=>{const C=j.reduce((W,Q)=>{var Y;const X=c.join(o,"css",Q),ot=d.readFileSync(X,"utf8"),G=((Y=/.*-([^-]+)-\d+.css/.exec(Q))==null?void 0:Y.at(1))||q(X,6);return W.includes(G)?W:`${W}
|
30
|
+
/*start:${G}-${Q}*/
|
31
|
+
${ot}
|
32
|
+
/*end:${G}*/
|
33
|
+
`},""),N=`l_${f}.css`,O=c.join(o,"css",N),J=`@layer l${f} { ${C}
|
34
|
+
}`;return d.writeFileSync(O,J),`${g}
|
35
|
+
@import url('./css/${N}');`},"");E+=a}d.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)}},ae=async(t,e,s=mt())=>{try{const n=await I(t);if(nt(e)){const r=[],o=await pt(t),{contents:y}=await it(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:o}),u=await p.css;if(!u)continue;r[p.priority]||(r[p.priority]=[]),r[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:o}),w=await l.css;if(!w)continue;const h=`css/${l.cssFileName}`,S=c.join(n,h);d.writeFileSync(S,w),r[l.priority]||(r[l.priority]=[]),r[l.priority].push(l.cssFileName)}if(o.importStrategy!=="component")r.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"),E=`/*start:${u}-${S}*/
|
36
|
+
${x}
|
37
|
+
/*end:${u}*/
|
38
|
+
`;h=`${h.replace(/\}$/,"")}
|
39
|
+
${E}
|
40
|
+
}`}}),d.writeFileSync(w,h)});else{const b=r.flat().map(S=>`@import url('./${S}');`).join(`
|
41
|
+
`),m=q(e,6),l=c.parse(e),w=R(l.name),h=c.join(n,`css/f_${w}-${m}.css`);d.writeFileSync(h,b||"/* Empty file */")}}}catch(n){console.error(n)}},ce=async(t,e,s=mt())=>{var n,i;try{const r=await I(t);if(nt(e)){const y=d.readFileSync(e,"utf8"),b=await pt(t),{contents:m}=await it(t,e,r);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 ee(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=(i=(n=/styled\(([^,]+),/.exec($))==null?void 0:n.at(1))==null?void 0:i.trim(),x=l,E=` ${w} = styled(${P}, "${S.classNames}", ${JSON.stringify(S.clientProps)})`;l=l.replace($,E),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_${R(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(r){console.error("Error in minimizeFile:",r)}};exports.generateCss=re;exports.generateFile=ae;exports.isSaltyFile=nt;exports.minimizeFile=ce;exports.saltyFileRegExp=kt;
|