@salty-css/webpack 0.0.1-alpha.134 → 0.0.1-alpha.136

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.
@@ -0,0 +1,29 @@
1
+ "use strict";const ue=require("esbuild"),pe=require("child_process"),l=require("path"),u=require("fs"),U=require("fs/promises"),z=require("winston");var W=typeof document<"u"?document.currentScript:null;function de(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const X=de(ue),G=e=>String.fromCharCode(e+(e>25?39:97)),ye=(e,t)=>{let s="",n;for(n=Math.abs(e);n>52;n=n/52|0)s=G(n%52)+s;return s=G(n%52)+s,s.length<t?s=s.padStart(t,"a"):s.length>t&&(s=s.slice(-t)),s},ge=(e,t)=>{let s=t.length;for(;s;)e=e*33^t.charCodeAt(--s);return e},q=(e,t=5)=>{const s=ge(5381,JSON.stringify(e))>>>0;return ye(s,t)};function E(e){return e?typeof e!="string"?E(String(e)):e.replace(/[\s.]/g,"-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(t,s)=>(s>0?"-":"")+t.toLowerCase()):""}const me=(e,t)=>{if(typeof e!="string")return{result:e};if(!t)return{result:e};const s=[];return Object.values(t).forEach(n=>{const{pattern:i,transform:o}=n;e=e.replace(i,f=>{const{value:m,css:a}=o(f);return a&&s.push(a),m})}),{result:e,additionalCss:s}},Y=e=>typeof e!="string"?{result:e}:/\{[^{}]+\}/g.test(e)?{result:e.replace(/\{([^{}]+)\}/g,(...n)=>`var(--${E(n[1].replaceAll(".","-"))})`)}:{result:e},O=(e,t,s)=>{if(!e)return"";const n=[],i=Object.entries(e).reduce((f,[m,a])=>{const r=m.trim();if(typeof a=="function"&&(a=a()),typeof a=="object"){if(!a)return f;if(r==="variants")return Object.entries(a).forEach(([c,y])=>{y&&Object.entries(y).forEach(([x,w])=>{if(!w)return;const T=`${t}.${c}-${x}`,P=O(w,T);n.push(P)})}),f;if(r==="defaultVariants")return f;if(r==="compoundVariants")return a.forEach(c=>{const{css:y,...x}=c,w=Object.entries(x).reduce((P,[p,g])=>`${P}.${p}-${g}`,t),T=O(y,w);n.push(T)}),f;if(r.startsWith("@")){const c=O(a,t),y=`${r} {
2
+ ${c.replace(`
3
+ `,`
4
+ `)}
5
+ }`;return n.push(y),f}const d=m.includes("&")?r.replace("&",t):r.startsWith(":")?`${t}${r}`:`${t} ${r}`,S=O(a,d);return n.push(S),f}const h=r.startsWith("-")?r:E(r),F=(d,S=";")=>f=`${f}${d}${S}`,j=d=>F(`${h}:${d}`);if(typeof a=="number")return j(a);if(typeof a!="string")if("toString"in a)a=a.toString();else return f;const{modifiers:$}={},N=function*(){yield Y(a),yield me(a,$)}();for(const{result:d,additionalCss:S=[]}of N)a=d,S.forEach(c=>{const y=O(c,"");F(y,"")});return j(a)},"");return i?t?[`${t} { ${i} }`,...n].join(`
6
+ `):i:n.join(`
7
+ `)},Q=(e,t=[])=>{if(!e)return"";const s=[],n={};if(Object.entries(e).forEach(([i,o])=>{if(typeof o=="object"){if(!o)return;const f=i.trim(),m=Q(o,[...t,f]);s.push(m)}else n[i]=o}),Object.keys(n).length){const i=t.map(E).join("-"),o=O(n,`.${i}`);s.push(o)}return s.join(`
8
+ `)},he=e=>Object.entries(e).reduce((t,[s,n])=>(typeof n=="object"&&(t[s]=v(n).map(i=>`"${i}"`).join(" | ")),t),{}),v=(e,t="",s=new Set)=>e?(Object.entries(e).forEach(([n,i])=>{const o=t?`${t}.${n}`:n;return typeof i=="object"?v(i,o,s):s.add(t)}),[...s]):[],ee=e=>{if(!e||e==="/")throw new Error("Could not find package.json file");const t=l.join(e,"package.json");return u.existsSync(t)?t:ee(l.join(e,".."))},$e=async e=>{const t=ee(e);return await U.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},Se=async e=>{const t=await $e(e);if(t)return t.type};let R;const te=async e=>{if(R)return R;const t=await Se(e);return t==="module"?R="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:W&&W.tagName.toUpperCase()==="SCRIPT"&&W.src||new URL("index-B3d_60Gq.cjs",document.baseURI).href).endsWith(".cjs"))&&(R="cjs"),R||"esm"},I=z.createLogger({level:"debug",format:z.format.combine(z.format.colorize(),z.format.cli()),transports:[new z.transports.Console({})]});function se(e){return e?typeof e!="string"?se(String(e)):e.replace(/[\s-]/g,".").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(t,s)=>(s>0?".":"")+t.toLowerCase()):""}const be={"*, *::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"}},Z={externalModules:[]},ne=e=>{if(Z.externalModules.length>0)return Z.externalModules;const t=l.join(e,"salty.config.ts"),n=u.readFileSync(t,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!n)return[];const i=n[1].split(",").map(o=>o.replace(/['"`]/g,"").trim());return Z.externalModules=i,i},J=e=>l.join(e,"./saltygen"),oe=["salty","css","styles","styled"],re=(e=[])=>new RegExp(`\\.(${[...oe,...e].join("|")})\\.`),H=(e,t=[])=>re(t).test(e),je=async e=>{const t=J(e),s=l.join(e,"salty.config.ts"),n=l.join(t,"salty.config.js"),i=await te(e),o=ne(e);await X.build({entryPoints:[s],minify:!0,treeShaking:!0,bundle:!0,outfile:n,format:i,external:o});const f=Date.now(),{config:m}=await import(`${n}?t=${f}`);return m},we=async e=>{const t=await je(e),s=new Set,n=(p,g=[])=>p?Object.entries(p).flatMap(([C,b])=>{if(!b)return;if(typeof b=="object")return n(b,[...g,C]);const M=se(C),A=E(C),V=[...g,M].join(".");s.add(`"${V}"`);const _=[...g.map(E),A].join("-"),{result:D}=Y(b);return`--${_}: ${D};`}):[],i=p=>p?Object.entries(p).flatMap(([g,C])=>{const b=n(C);return g==="base"?b.join(""):`${g} { ${b.join("")} }`}):[],o=p=>p?Object.entries(p).flatMap(([g,C])=>Object.entries(C).flatMap(([b,M])=>{const A=n(M,[g]),V=`.${g}-${b}, [data-${g}="${b}"]`,_=A.join("");return`${V} { ${_} }`})):[],f=n(t.variables),m=i(t.responsiveVariables),a=o(t.conditionalVariables),r=J(e),h=l.join(r,"css/_variables.css"),F=`:root { ${f.join("")} ${m.join("")} } ${a.join("")}`;u.writeFileSync(h,F);const j=l.join(r,"css/_global.css"),$=O(t.global,"");u.writeFileSync(j,`@layer global { ${$} }`);const k=l.join(r,"css/_reset.css"),d=t.reset==="none"?{}:typeof t.reset=="object"?t.reset:be,S=O(d,"");u.writeFileSync(k,`@layer reset { ${S} }`);const c=l.join(r,"css/_templates.css"),y=Q(t.templates),x=he(t.templates);u.writeFileSync(c,y);const w=l.join(r,"types/css-tokens.d.ts"),P=`
9
+ // Variable types
10
+ type VariableTokens = ${[...s].join("|")};
11
+ type PropertyValueToken = \`{\${VariableTokens}}\`;
12
+
13
+ // Template types
14
+ type TemplateTokens = {
15
+ ${Object.entries(x).map(([p,g])=>`${p}?: ${g}`).join(`
16
+ `)}
17
+ }
18
+ `;u.writeFileSync(w,P)},L=async(e,t,s)=>{const n=q(t),i=l.join(s,"./temp");u.existsSync(i)||u.mkdirSync(i);const o=l.parse(t);let f=u.readFileSync(t,"utf8");f=f.replace(/styled\(([^"'`{,]+),/g,(j,$)=>{if(/^['"`]/.test($))return j;const N=new RegExp(`import\\s?\\{[^{}]*${$}[^{}]*\\}\\s?from\\s?([^{};]+);`);if(!N.test(f))return j;const S=N.exec(f);if(S){const c=S.at(1);if(oe.some(x=>c==null?void 0:c.includes(x)))return j}return"styled('div',"});const m=l.join(s,"js",n+".js"),a=ne(e),r=await te(e);await X.build({stdin:{contents:f,sourcefile:o.base,resolveDir:o.dir,loader:"tsx"},minify:!1,treeShaking:!0,bundle:!0,outfile:m,format:r,target:["node20"],keepNames:!0,external:a,packages:"external"});const h=Date.now();return await import(`${m}?t=${h}`)},B=async e=>{const t=J(e),s=l.join(t,"salty.config.js"),n=Date.now(),{config:i}=await import(`${s}?t=${n}`);return i},ie=()=>{try{return process.env.NODE_ENV==="production"}catch{return!1}},Fe=async(e,t=ie())=>{try{const s=Date.now();t?I.info("Generating CSS in production mode! 🔥"):I.info("Generating CSS in development mode! 🚀");const n=[],i=[],o=J(e),f=l.join(o,"index.css");(()=>{u.existsSync(o)&&pe.execSync("rm -rf "+o),u.mkdirSync(o),u.mkdirSync(l.join(o,"css")),u.mkdirSync(l.join(o,"types"))})(),await we(e);const a=await B(e);async function r(c,y){const x=["node_modules","saltygen"],w=u.statSync(c);if(w.isDirectory()){const T=u.readdirSync(c);if(x.some(p=>c.includes(p)))return;await Promise.all(T.map(p=>r(l.join(c,p),l.join(y,p))))}else if(w.isFile()&&H(c)){const P=await L(e,c,o),p=[];Object.entries(P).forEach(([V,_])=>{if(_.isKeyframes&&_.css){const K=`a_${_.animationName}.css`,le=`css/${K}`,fe=l.join(o,le);n.push(K),u.writeFileSync(fe,_.css);return}if(!_.generator)return;const D=_.generator._withBuildContext({name:V,config:a,prod:t});i[D.priority]||(i[D.priority]=[]),i[D.priority].push(D.cssFileName),p.push(D.cssFileName);const ce=`css/${D.cssFileName}`,ae=l.join(o,ce);u.writeFileSync(ae,D.css)});const g=p.map(V=>`@import url('./${V}');`).join(`
19
+ `),C=q(c,6),b=l.parse(c),M=E(b.name),A=l.join(o,`css/f_${M}-${C}.css`);u.writeFileSync(A,g)}}await r(e,o);const h=n.map(c=>`@import url('./css/${c}');`).join(`
20
+ `);let k=`@layer reset, global, l0, l1, l2, l3, l4, l5, l6, l7, l8;
21
+
22
+ ${["_variables.css","_reset.css","_global.css","_templates.css"].filter(c=>{try{return u.readFileSync(l.join(o,"css",c),"utf8").length>0}catch{return!1}}).map(c=>`@import url('./css/${c}');`).join(`
23
+ `)}
24
+ ${h}`;if(a.importStrategy!=="component"){const c=i.reduce((y,x,w)=>{const T=x.reduce((C,b)=>{const M=u.readFileSync(l.join(o,"css",b),"utf8");return`${C}
25
+ ${M}`},""),P=`l_${w}.css`,p=l.join(o,"css",P),g=`@layer l${w} { ${T} }`;return u.writeFileSync(p,g),`${y}
26
+ @import url('./css/${P}');`},"");k+=c}u.writeFileSync(f,k);const d=Date.now()-s,S=d<200?"🔥":d<500?"🚀":d<1e3?"🎉":d<2e3?"🚗":d<5e3?"🤔":"🥴";I.info(`Generated CSS in ${d}ms! ${S}`)}catch(s){console.error(s)}},xe=async(e,t)=>{try{const s=[],n=l.join(e,"./saltygen"),i=l.join(n,"index.css");if(H(t)){const f=await B(e),m=await L(e,t,n);Object.entries(m).forEach(([j,$])=>{if($.isKeyframes&&$.css){const c=`css/${`a_${$.animationName}.css`}`,y=l.join(n,c);u.writeFileSync(y,$.css);return}if(!$.generator)return;const k=$.generator._withBuildContext({name:j,config:f}),N=`css/${k.cssFileName}`,d=l.join(n,N);s.push(k.cssFileName),u.writeFileSync(d,k.css)});const a=u.readFileSync(i,"utf8").split(`
27
+ `),r=s.map(j=>`@import url('../saltygen/css/${j}');`),F=[...new Set([...a,...r])].join(`
28
+ `);u.writeFileSync(i,F)}}catch(s){console.error(s)}},Ce=async(e,t,s=ie())=>{try{const n=l.join(e,"./saltygen");if(H(t)){const o=u.readFileSync(t,"utf8");o.replace(/^(?!export\s)const\s.*/gm,h=>`export ${h}`)!==o&&await U.writeFile(t,o);const m=await B(e),a=await L(e,t,n);let r=o;if(Object.entries(a).forEach(([h,F])=>{var C;if(F.isKeyframes||!F.generator)return;const j=F.generator._withBuildContext({name:h,config:m,prod:s}),$=new RegExp(`\\s${h}[=\\s]+[^()]+styled\\(([^,]+),`,"g").exec(o);if(!$)return console.error("Could not find the original declaration");const k=(C=$.at(1))==null?void 0:C.trim(),N=new RegExp(`\\s${h}[=\\s]+styled\\(`,"g").exec(r);if(!N)return console.error("Could not find the original declaration");const{index:d}=N;let S=!1;const c=setTimeout(()=>S=!0,5e3);let y=0,x=!1,w=0;for(;!x&&!S;){const b=r[d+y];b==="("&&w++,b===")"&&w--,w===0&&b===")"&&(x=!0),y>r.length&&(S=!0),y++}if(!S)clearTimeout(c);else throw new Error("Failed to find the end of the styled call and timed out");const T=d+y,P=r.slice(d,T),p=r,g=` ${h} = styled(${k}, "${j.classNames}", ${JSON.stringify(j.props)});`;r=r.replace(P,g),p===r&&console.error("Minimize file failed to change content",{name:h,tagName:k})}),m.importStrategy==="component"){const h=q(t,6),F=l.parse(t);r=`import '../../saltygen/css/${`f_${E(F.name)}-${h}.css`}';
29
+ ${r}`}return r=r.replace("{ styled }","{ styledClient as styled }"),r=r.replace("@salty-css/react/styled","@salty-css/react/styled-client"),r}}catch(n){console.error("Error in minimizeFile:",n)}};exports.generateCss=Fe;exports.generateFile=xe;exports.minimizeFile=Ce;exports.saltyFileRegExp=re;
@@ -0,0 +1,417 @@
1
+ import * as Q from "esbuild";
2
+ import { execSync as ut } from "child_process";
3
+ import { join as l, parse as B } from "path";
4
+ import { existsSync as K, writeFileSync as N, readFileSync as R, mkdirSync as W, statSync as dt, readdirSync as gt } from "fs";
5
+ import { readFile as mt, writeFile as yt } from "fs/promises";
6
+ import { createLogger as ht, format as Z, transports as $t } from "winston";
7
+ const Y = (t) => String.fromCharCode(t + (t > 25 ? 39 : 97)), bt = (t, e) => {
8
+ let s = "", n;
9
+ for (n = Math.abs(t); n > 52; n = n / 52 | 0) s = Y(n % 52) + s;
10
+ return s = Y(n % 52) + s, s.length < e ? s = s.padStart(e, "a") : s.length > e && (s = s.slice(-e)), s;
11
+ }, St = (t, e) => {
12
+ let s = e.length;
13
+ for (; s; ) t = t * 33 ^ e.charCodeAt(--s);
14
+ return t;
15
+ }, G = (t, e = 5) => {
16
+ const s = St(5381, JSON.stringify(t)) >>> 0;
17
+ return bt(s, e);
18
+ };
19
+ function V(t) {
20
+ 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()) : "";
21
+ }
22
+ const jt = (t, e) => {
23
+ if (typeof t != "string") return { result: t };
24
+ if (!e) return { result: t };
25
+ const s = [];
26
+ return Object.values(e).forEach((n) => {
27
+ const { pattern: i, transform: o } = n;
28
+ t = t.replace(i, (f) => {
29
+ const { value: m, css: a } = o(f);
30
+ return a && s.push(a), m;
31
+ });
32
+ }), { result: t, additionalCss: s };
33
+ }, v = (t) => typeof t != "string" ? { result: t } : /\{[^{}]+\}/g.test(t) ? { result: t.replace(/\{([^{}]+)\}/g, (...n) => `var(--${V(n[1].replaceAll(".", "-"))})`) } : { result: t }, O = (t, e, s) => {
34
+ if (!t) return "";
35
+ const n = [], i = Object.entries(t).reduce((f, [m, a]) => {
36
+ const r = m.trim();
37
+ if (typeof a == "function" && (a = a()), typeof a == "object") {
38
+ if (!a) return f;
39
+ if (r === "variants")
40
+ return Object.entries(a).forEach(([c, d]) => {
41
+ d && Object.entries(d).forEach(([x, j]) => {
42
+ if (!j) return;
43
+ const T = `${e}.${c}-${x}`, k = O(j, T);
44
+ n.push(k);
45
+ });
46
+ }), f;
47
+ if (r === "defaultVariants")
48
+ return f;
49
+ if (r === "compoundVariants")
50
+ return a.forEach((c) => {
51
+ const { css: d, ...x } = c, j = Object.entries(x).reduce((k, [p, g]) => `${k}.${p}-${g}`, e), T = O(d, j);
52
+ n.push(T);
53
+ }), f;
54
+ if (r.startsWith("@")) {
55
+ const c = O(a, e), d = `${r} {
56
+ ${c.replace(`
57
+ `, `
58
+ `)}
59
+ }`;
60
+ return n.push(d), f;
61
+ }
62
+ const u = m.includes("&") ? r.replace("&", e) : r.startsWith(":") ? `${e}${r}` : `${e} ${r}`, $ = O(a, u);
63
+ return n.push($), f;
64
+ }
65
+ const y = r.startsWith("-") ? r : V(r), w = (u, $ = ";") => f = `${f}${u}${$}`, S = (u) => w(`${y}:${u}`);
66
+ if (typeof a == "number") return S(a);
67
+ if (typeof a != "string")
68
+ if ("toString" in a) a = a.toString();
69
+ else return f;
70
+ const { modifiers: h } = {}, P = function* () {
71
+ yield v(a), yield jt(a, h);
72
+ }();
73
+ for (const { result: u, additionalCss: $ = [] } of P)
74
+ a = u, $.forEach((c) => {
75
+ const d = O(c, "");
76
+ w(d, "");
77
+ });
78
+ return S(a);
79
+ }, "");
80
+ return i ? e ? [`${e} { ${i} }`, ...n].join(`
81
+ `) : i : n.join(`
82
+ `);
83
+ }, tt = (t, e = []) => {
84
+ if (!t) return "";
85
+ const s = [], n = {};
86
+ if (Object.entries(t).forEach(([i, o]) => {
87
+ if (typeof o == "object") {
88
+ if (!o) return;
89
+ const f = i.trim(), m = tt(o, [...e, f]);
90
+ s.push(m);
91
+ } else
92
+ n[i] = o;
93
+ }), Object.keys(n).length) {
94
+ const i = e.map(V).join("-"), o = O(n, `.${i}`);
95
+ s.push(o);
96
+ }
97
+ return s.join(`
98
+ `);
99
+ }, wt = (t) => Object.entries(t).reduce((e, [s, n]) => (typeof n == "object" && (e[s] = et(n).map((i) => `"${i}"`).join(" | ")), e), {}), et = (t, e = "", s = /* @__PURE__ */ new Set()) => t ? (Object.entries(t).forEach(([n, i]) => {
100
+ const o = e ? `${e}.${n}` : n;
101
+ return typeof i == "object" ? et(i, o, s) : s.add(e);
102
+ }), [...s]) : [], st = (t) => {
103
+ if (!t || t === "/") throw new Error("Could not find package.json file");
104
+ const e = l(t, "package.json");
105
+ return K(e) ? e : st(l(t, ".."));
106
+ }, xt = async (t) => {
107
+ const e = st(t);
108
+ return await mt(e, "utf-8").then(JSON.parse).catch(() => {
109
+ });
110
+ }, Ft = async (t) => {
111
+ const e = await xt(t);
112
+ if (e)
113
+ return e.type;
114
+ };
115
+ let A;
116
+ const nt = async (t) => {
117
+ if (A) return A;
118
+ const e = await Ft(t);
119
+ return e === "module" ? A = "esm" : (e === "commonjs" || import.meta.url.endsWith(".cjs")) && (A = "cjs"), A || "esm";
120
+ }, I = ht({
121
+ level: "debug",
122
+ format: Z.combine(Z.colorize(), Z.cli()),
123
+ transports: [new $t.Console({})]
124
+ });
125
+ function ot(t) {
126
+ return t ? typeof t != "string" ? ot(String(t)) : t.replace(/[\s-]/g, ".").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g, (e, s) => (s > 0 ? "." : "") + e.toLowerCase()) : "";
127
+ }
128
+ const Ct = {
129
+ /** Set box model to border-box */
130
+ "*, *::before, *::after": {
131
+ boxSizing: "border-box"
132
+ },
133
+ /** Remove default margin and padding */
134
+ "*": {
135
+ margin: 0
136
+ },
137
+ /** Remove adjust font properties */
138
+ html: {
139
+ lineHeight: 1.15,
140
+ textSizeAdjust: "100%",
141
+ WebkitFontSmoothing: "antialiased"
142
+ },
143
+ /** Make media elements responsive */
144
+ "img, picture, video, canvas, svg": {
145
+ display: "block",
146
+ maxWidth: "100%"
147
+ },
148
+ /** Avoid overflow of text */
149
+ "p, h1, h2, h3, h4, h5, h6": {
150
+ overflowWrap: "break-word"
151
+ },
152
+ /** Improve text wrapping */
153
+ p: {
154
+ textWrap: "pretty"
155
+ },
156
+ "h1, h2, h3, h4, h5, h6": {
157
+ textWrap: "balance"
158
+ },
159
+ /** Improve link color */
160
+ a: {
161
+ color: "currentColor"
162
+ },
163
+ /** Improve button line height */
164
+ button: {
165
+ lineHeight: "1em",
166
+ color: "currentColor"
167
+ },
168
+ /** Improve form elements */
169
+ "input, optgroup, select, textarea": {
170
+ fontFamily: "inherit",
171
+ fontSize: "100%",
172
+ lineHeight: "1.15em"
173
+ }
174
+ }, H = {
175
+ externalModules: []
176
+ }, rt = (t) => {
177
+ if (H.externalModules.length > 0) return H.externalModules;
178
+ const e = l(t, "salty.config.ts"), n = R(e, "utf8").match(/externalModules:\s?\[(.*)\]/);
179
+ if (!n) return [];
180
+ const i = n[1].split(",").map((o) => o.replace(/['"`]/g, "").trim());
181
+ return H.externalModules = i, i;
182
+ }, z = (t) => l(t, "./saltygen"), it = ["salty", "css", "styles", "styled"], kt = (t = []) => new RegExp(`\\.(${[...it, ...t].join("|")})\\.`), L = (t, e = []) => kt(e).test(t), Nt = async (t) => {
183
+ const e = z(t), s = l(t, "salty.config.ts"), n = l(e, "salty.config.js"), i = await nt(t), o = rt(t);
184
+ await Q.build({
185
+ entryPoints: [s],
186
+ minify: !0,
187
+ treeShaking: !0,
188
+ bundle: !0,
189
+ outfile: n,
190
+ format: i,
191
+ external: o
192
+ });
193
+ const f = Date.now(), { config: m } = await import(`${n}?t=${f}`);
194
+ return m;
195
+ }, Pt = async (t) => {
196
+ const e = await Nt(t), s = /* @__PURE__ */ new Set(), n = (p, g = []) => p ? Object.entries(p).flatMap(([F, b]) => {
197
+ if (!b) return;
198
+ if (typeof b == "object") return n(b, [...g, F]);
199
+ const M = ot(F), J = V(F), _ = [...g, M].join(".");
200
+ s.add(`"${_}"`);
201
+ const D = [...g.map(V), J].join("-"), { result: E } = v(b);
202
+ return `--${D}: ${E};`;
203
+ }) : [], i = (p) => p ? Object.entries(p).flatMap(([g, F]) => {
204
+ const b = n(F);
205
+ return g === "base" ? b.join("") : `${g} { ${b.join("")} }`;
206
+ }) : [], o = (p) => p ? Object.entries(p).flatMap(([g, F]) => Object.entries(F).flatMap(([b, M]) => {
207
+ const J = n(M, [g]), _ = `.${g}-${b}, [data-${g}="${b}"]`, D = J.join("");
208
+ return `${_} { ${D} }`;
209
+ })) : [], f = n(e.variables), m = i(e.responsiveVariables), a = o(e.conditionalVariables), r = z(t), y = l(r, "css/_variables.css"), w = `:root { ${f.join("")} ${m.join("")} } ${a.join("")}`;
210
+ N(y, w);
211
+ const S = l(r, "css/_global.css"), h = O(e.global, "");
212
+ N(S, `@layer global { ${h} }`);
213
+ const C = l(r, "css/_reset.css"), u = e.reset === "none" ? {} : typeof e.reset == "object" ? e.reset : Ct, $ = O(u, "");
214
+ N(C, `@layer reset { ${$} }`);
215
+ const c = l(r, "css/_templates.css"), d = tt(e.templates), x = wt(e.templates);
216
+ N(c, d);
217
+ const j = l(r, "types/css-tokens.d.ts"), k = `
218
+ // Variable types
219
+ type VariableTokens = ${[...s].join("|")};
220
+ type PropertyValueToken = \`{\${VariableTokens}}\`;
221
+
222
+ // Template types
223
+ type TemplateTokens = {
224
+ ${Object.entries(x).map(([p, g]) => `${p}?: ${g}`).join(`
225
+ `)}
226
+ }
227
+ `;
228
+ N(j, k);
229
+ }, q = async (t, e, s) => {
230
+ const n = G(e), i = l(s, "./temp");
231
+ K(i) || W(i);
232
+ const o = B(e);
233
+ let f = R(e, "utf8");
234
+ f = f.replace(/styled\(([^"'`{,]+),/g, (S, h) => {
235
+ if (/^['"`]/.test(h)) return S;
236
+ const P = new RegExp(`import\\s?\\{[^{}]*${h}[^{}]*\\}\\s?from\\s?([^{};]+);`);
237
+ if (!P.test(f)) return S;
238
+ const $ = P.exec(f);
239
+ if ($) {
240
+ const c = $.at(1);
241
+ if (it.some((x) => c == null ? void 0 : c.includes(x))) return S;
242
+ }
243
+ return "styled('div',";
244
+ });
245
+ const m = l(s, "js", n + ".js"), a = rt(t), r = await nt(t);
246
+ await Q.build({
247
+ stdin: {
248
+ contents: f,
249
+ sourcefile: o.base,
250
+ resolveDir: o.dir,
251
+ loader: "tsx"
252
+ },
253
+ minify: !1,
254
+ treeShaking: !0,
255
+ bundle: !0,
256
+ outfile: m,
257
+ format: r,
258
+ target: ["node20"],
259
+ keepNames: !0,
260
+ external: a,
261
+ packages: "external"
262
+ });
263
+ const y = Date.now();
264
+ return await import(`${m}?t=${y}`);
265
+ }, U = async (t) => {
266
+ const e = z(t), s = l(e, "salty.config.js"), n = Date.now(), { config: i } = await import(`${s}?t=${n}`);
267
+ return i;
268
+ }, ct = () => {
269
+ try {
270
+ return process.env.NODE_ENV === "production";
271
+ } catch {
272
+ return !1;
273
+ }
274
+ }, Mt = async (t, e = ct()) => {
275
+ try {
276
+ const s = Date.now();
277
+ e ? I.info("Generating CSS in production mode! 🔥") : I.info("Generating CSS in development mode! 🚀");
278
+ const n = [], i = [], o = z(t), f = l(o, "index.css");
279
+ (() => {
280
+ K(o) && ut("rm -rf " + o), W(o), W(l(o, "css")), W(l(o, "types"));
281
+ })(), await Pt(t);
282
+ const a = await U(t);
283
+ async function r(c, d) {
284
+ const x = ["node_modules", "saltygen"], j = dt(c);
285
+ if (j.isDirectory()) {
286
+ const T = gt(c);
287
+ if (x.some((p) => c.includes(p))) return;
288
+ await Promise.all(T.map((p) => r(l(c, p), l(d, p))));
289
+ } else if (j.isFile() && L(c)) {
290
+ const k = await q(t, c, o), p = [];
291
+ Object.entries(k).forEach(([_, D]) => {
292
+ if (D.isKeyframes && D.css) {
293
+ const X = `a_${D.animationName}.css`, ft = `css/${X}`, pt = l(o, ft);
294
+ n.push(X), N(pt, D.css);
295
+ return;
296
+ }
297
+ if (!D.generator) return;
298
+ const E = D.generator._withBuildContext({
299
+ name: _,
300
+ config: a,
301
+ prod: e
302
+ });
303
+ i[E.priority] || (i[E.priority] = []), i[E.priority].push(E.cssFileName), p.push(E.cssFileName);
304
+ const at = `css/${E.cssFileName}`, lt = l(o, at);
305
+ N(lt, E.css);
306
+ });
307
+ const g = p.map((_) => `@import url('./${_}');`).join(`
308
+ `), F = G(c, 6), b = B(c), M = V(b.name), J = l(o, `css/f_${M}-${F}.css`);
309
+ N(J, g);
310
+ }
311
+ }
312
+ await r(t, o);
313
+ const y = n.map((c) => `@import url('./css/${c}');`).join(`
314
+ `);
315
+ let C = `@layer reset, global, l0, l1, l2, l3, l4, l5, l6, l7, l8;
316
+
317
+ ${["_variables.css", "_reset.css", "_global.css", "_templates.css"].filter((c) => {
318
+ try {
319
+ return R(l(o, "css", c), "utf8").length > 0;
320
+ } catch {
321
+ return !1;
322
+ }
323
+ }).map((c) => `@import url('./css/${c}');`).join(`
324
+ `)}
325
+ ${y}`;
326
+ if (a.importStrategy !== "component") {
327
+ const c = i.reduce((d, x, j) => {
328
+ const T = x.reduce((F, b) => {
329
+ const M = R(l(o, "css", b), "utf8");
330
+ return `${F}
331
+ ${M}`;
332
+ }, ""), k = `l_${j}.css`, p = l(o, "css", k), g = `@layer l${j} { ${T} }`;
333
+ return N(p, g), `${d}
334
+ @import url('./css/${k}');`;
335
+ }, "");
336
+ C += c;
337
+ }
338
+ N(f, C);
339
+ const u = Date.now() - s, $ = u < 200 ? "🔥" : u < 500 ? "🚀" : u < 1e3 ? "🎉" : u < 2e3 ? "🚗" : u < 5e3 ? "🤔" : "🥴";
340
+ I.info(`Generated CSS in ${u}ms! ${$}`);
341
+ } catch (s) {
342
+ console.error(s);
343
+ }
344
+ }, _t = async (t, e) => {
345
+ try {
346
+ const s = [], n = l(t, "./saltygen"), i = l(n, "index.css");
347
+ if (L(e)) {
348
+ const f = await U(t), m = await q(t, e, n);
349
+ Object.entries(m).forEach(([S, h]) => {
350
+ if (h.isKeyframes && h.css) {
351
+ const c = `css/${`a_${h.animationName}.css`}`, d = l(n, c);
352
+ N(d, h.css);
353
+ return;
354
+ }
355
+ if (!h.generator) return;
356
+ const C = h.generator._withBuildContext({
357
+ name: S,
358
+ config: f
359
+ }), P = `css/${C.cssFileName}`, u = l(n, P);
360
+ s.push(C.cssFileName), N(u, C.css);
361
+ });
362
+ const a = R(i, "utf8").split(`
363
+ `), r = s.map((S) => `@import url('../saltygen/css/${S}');`), w = [.../* @__PURE__ */ new Set([...a, ...r])].join(`
364
+ `);
365
+ N(i, w);
366
+ }
367
+ } catch (s) {
368
+ console.error(s);
369
+ }
370
+ }, At = async (t, e, s = ct()) => {
371
+ try {
372
+ const n = l(t, "./saltygen");
373
+ if (L(e)) {
374
+ const o = R(e, "utf8");
375
+ o.replace(/^(?!export\s)const\s.*/gm, (y) => `export ${y}`) !== o && await yt(e, o);
376
+ const m = await U(t), a = await q(t, e, n);
377
+ let r = o;
378
+ if (Object.entries(a).forEach(([y, w]) => {
379
+ var F;
380
+ if (w.isKeyframes || !w.generator) return;
381
+ const S = w.generator._withBuildContext({
382
+ name: y,
383
+ config: m,
384
+ prod: s
385
+ }), h = new RegExp(`\\s${y}[=\\s]+[^()]+styled\\(([^,]+),`, "g").exec(o);
386
+ if (!h) return console.error("Could not find the original declaration");
387
+ const C = (F = h.at(1)) == null ? void 0 : F.trim(), P = new RegExp(`\\s${y}[=\\s]+styled\\(`, "g").exec(r);
388
+ if (!P) return console.error("Could not find the original declaration");
389
+ const { index: u } = P;
390
+ let $ = !1;
391
+ const c = setTimeout(() => $ = !0, 5e3);
392
+ let d = 0, x = !1, j = 0;
393
+ for (; !x && !$; ) {
394
+ const b = r[u + d];
395
+ b === "(" && j++, b === ")" && j--, j === 0 && b === ")" && (x = !0), d > r.length && ($ = !0), d++;
396
+ }
397
+ if (!$) clearTimeout(c);
398
+ else throw new Error("Failed to find the end of the styled call and timed out");
399
+ const T = u + d, k = r.slice(u, T), p = r, g = ` ${y} = styled(${C}, "${S.classNames}", ${JSON.stringify(S.props)});`;
400
+ r = r.replace(k, g), p === r && console.error("Minimize file failed to change content", { name: y, tagName: C });
401
+ }), m.importStrategy === "component") {
402
+ const y = G(e, 6), w = B(e);
403
+ r = `import '../../saltygen/css/${`f_${V(w.name)}-${y}.css`}';
404
+ ${r}`;
405
+ }
406
+ return r = r.replace("{ styled }", "{ styledClient as styled }"), r = r.replace("@salty-css/react/styled", "@salty-css/react/styled-client"), r;
407
+ }
408
+ } catch (n) {
409
+ console.error("Error in minimizeFile:", n);
410
+ }
411
+ };
412
+ export {
413
+ _t as a,
414
+ Mt as g,
415
+ At as m,
416
+ kt as s
417
+ };
package/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("path"),u=require("./index-qF3BcfMG.cjs"),r=(e,s,o=!1,n=!1)=>{var a,l,t;(l=(a=e.module)==null?void 0:a.rules)==null||l.push({test:u.saltyFileRegExp(),use:[{loader:p.resolve(__dirname,n?"./loader.cjs":"./loader.js"),options:{dir:s}}]}),o||(t=e.plugins)==null||t.push({apply:i=>{i.hooks.afterPlugins.tap({name:"generateCss"},async()=>{await u.generateCss(s)})}})};exports.default=r;exports.saltyPlugin=r;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("path"),u=require("./index-B3d_60Gq.cjs"),r=(e,s,o=!1,n=!1)=>{var a,l,t;(l=(a=e.module)==null?void 0:a.rules)==null||l.push({test:u.saltyFileRegExp(),use:[{loader:p.resolve(__dirname,n?"./loader.cjs":"./loader.js"),options:{dir:s}}]}),o||(t=e.plugins)==null||t.push({apply:i=>{i.hooks.afterPlugins.tap({name:"generateCss"},async()=>{await u.generateCss(s)})}})};exports.default=r;exports.saltyPlugin=r;
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { resolve as n } from "path";
2
- import { s as u, g as i } from "./index-DjRqyDX1.js";
2
+ import { s as u, g as i } from "./index-Bsx1QEJo.js";
3
3
  const g = (s, e, o = !1, r = !1) => {
4
4
  var a, l, t;
5
5
  (l = (a = s.module) == null ? void 0 : a.rules) == null || l.push({
package/loader.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";const i=require("./index-qF3BcfMG.cjs");async function n(){const{dir:e}=this.getOptions(),{resourcePath:t}=this;return await i.generateFile(e,t),await i.minimizeFile(e,t)}module.exports=n;
1
+ "use strict";const i=require("./index-B3d_60Gq.cjs");async function n(){const{dir:e}=this.getOptions(),{resourcePath:t}=this;return await i.generateFile(e,t),await i.minimizeFile(e,t)}module.exports=n;
package/loader.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as e, m as i } from "./index-DjRqyDX1.js";
1
+ import { a as e, m as i } from "./index-Bsx1QEJo.js";
2
2
  async function s() {
3
3
  const { dir: t } = this.getOptions(), { resourcePath: a } = this;
4
4
  return await e(t, a), await i(t, a);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/webpack",
3
- "version": "0.0.1-alpha.134",
3
+ "version": "0.0.1-alpha.136",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",
@@ -34,7 +34,7 @@
34
34
  }
35
35
  },
36
36
  "dependencies": {
37
- "@salty-css/core": "^0.0.1-alpha.134",
37
+ "@salty-css/core": "^0.0.1-alpha.136",
38
38
  "webpack": ">=5.x"
39
39
  }
40
40
  }
package/index-DjRqyDX1.js DELETED
@@ -1,403 +0,0 @@
1
- import * as Q from "esbuild";
2
- import { execSync as pt } from "child_process";
3
- import { join as l, parse as I } from "path";
4
- import { existsSync as K, writeFileSync as P, readFileSync as W, mkdirSync as z, statSync as ut, readdirSync as dt } from "fs";
5
- import { readFile as gt, writeFile as mt } from "fs/promises";
6
- import { createLogger as yt, format as Z, transports as ht } from "winston";
7
- const Y = (t) => String.fromCharCode(t + (t > 25 ? 39 : 97)), $t = (t, e) => {
8
- let s = "", n;
9
- for (n = Math.abs(t); n > 52; n = n / 52 | 0) s = Y(n % 52) + s;
10
- return s = Y(n % 52) + s, s.length < e ? s = s.padStart(e, "a") : s.length > e && (s = s.slice(-e)), s;
11
- }, bt = (t, e) => {
12
- let s = e.length;
13
- for (; s; ) t = t * 33 ^ e.charCodeAt(--s);
14
- return t;
15
- }, G = (t, e = 5) => {
16
- const s = bt(5381, JSON.stringify(t)) >>> 0;
17
- return $t(s, e);
18
- };
19
- function V(t) {
20
- 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()) : "";
21
- }
22
- const St = (t, e) => {
23
- if (typeof t != "string") return { result: t };
24
- if (!e) return { result: t };
25
- const s = [];
26
- return Object.values(e).forEach((n) => {
27
- const { pattern: c, transform: r } = n;
28
- t = t.replace(c, (f) => {
29
- const { value: g, css: i } = r(f);
30
- return i && s.push(i), g;
31
- });
32
- }), { result: t, additionalCss: s };
33
- }, v = (t) => typeof t != "string" ? { result: t } : /\{[^{}]+\}/g.test(t) ? { result: t.replace(/\{([^{}]+)\}/g, (...n) => `var(--${V(n[1].replaceAll(".", "-"))})`) } : { result: t }, O = (t, e, s) => {
34
- if (!t) return "";
35
- const n = [], c = Object.entries(t).reduce((f, [g, i]) => {
36
- const o = g.trim();
37
- if (typeof i == "function" && (i = i()), typeof i == "object") {
38
- if (!i) return f;
39
- if (o === "variants")
40
- return Object.entries(i).forEach(([a, d]) => {
41
- d && Object.entries(d).forEach(([x, S]) => {
42
- if (!S) return;
43
- const N = `${e}.${a}-${x}`, C = O(S, N);
44
- n.push(C);
45
- });
46
- }), f;
47
- if (o === "defaultVariants")
48
- return f;
49
- if (o === "compoundVariants")
50
- return i.forEach((a) => {
51
- const { css: d, ...x } = a, S = Object.entries(x).reduce((C, [p, y]) => `${C}.${p}-${y}`, e), N = O(d, S);
52
- n.push(N);
53
- }), f;
54
- if (o.startsWith("@")) {
55
- const a = O(i, e), d = `${o} {
56
- ${a.replace(`
57
- `, `
58
- `)}
59
- }`;
60
- return n.push(d), f;
61
- }
62
- const u = g.includes("&") ? o.replace("&", e) : o.startsWith(":") ? `${e}${o}` : `${e} ${o}`, b = O(i, u);
63
- return n.push(b), f;
64
- }
65
- const m = o.startsWith("-") ? o : V(o), j = (u, b = ";") => f = `${f}${u}${b}`, w = (u) => j(`${m}:${u}`);
66
- if (typeof i == "number") return w(i);
67
- if (typeof i != "string")
68
- if ("toString" in i) i = i.toString();
69
- else return f;
70
- const { modifiers: $ } = {}, E = function* () {
71
- yield v(i), yield St(i, $);
72
- }();
73
- for (const { result: u, additionalCss: b = [] } of E)
74
- i = u, b.forEach((a) => {
75
- const d = O(a, "");
76
- j(d, "");
77
- });
78
- return w(i);
79
- }, "");
80
- return c ? e ? [`${e} { ${c} }`, ...n].join(`
81
- `) : c : n.join(`
82
- `);
83
- }, tt = (t, e = []) => {
84
- if (!t) return "";
85
- const s = [], n = {};
86
- if (Object.entries(t).forEach(([c, r]) => {
87
- if (typeof r == "object") {
88
- if (!r) return;
89
- const f = c.trim(), g = tt(r, [...e, f]);
90
- s.push(g);
91
- } else
92
- n[c] = r;
93
- }), Object.keys(n).length) {
94
- const c = e.map(V).join("-"), r = O(n, `.${c}`);
95
- s.push(r);
96
- }
97
- return s.join(`
98
- `);
99
- }, jt = (t) => Object.entries(t).reduce((e, [s, n]) => (typeof n == "object" && (e[s] = et(n).map((c) => `"${c}"`).join(" | ")), e), {}), et = (t, e = "", s = /* @__PURE__ */ new Set()) => t ? (Object.entries(t).forEach(([n, c]) => {
100
- const r = e ? `${e}.${n}` : n;
101
- return typeof c == "object" ? et(c, r, s) : s.add(e);
102
- }), [...s]) : [], st = (t) => {
103
- if (!t || t === "/") throw new Error("Could not find package.json file");
104
- const e = l(t, "package.json");
105
- return K(e) ? e : st(l(t, ".."));
106
- }, wt = async (t) => {
107
- const e = st(t);
108
- return await gt(e, "utf-8").then(JSON.parse).catch(() => {
109
- });
110
- }, Ft = async (t) => {
111
- const e = await wt(t);
112
- if (e)
113
- return e.type;
114
- };
115
- let _;
116
- const nt = async (t) => {
117
- if (_) return _;
118
- const e = await Ft(t);
119
- return e === "module" ? _ = "esm" : (e === "commonjs" || import.meta.url.endsWith(".cjs")) && (_ = "cjs"), _ || "esm";
120
- }, H = yt({
121
- level: "debug",
122
- format: Z.combine(Z.colorize(), Z.cli()),
123
- transports: [new ht.Console({})]
124
- });
125
- function ot(t) {
126
- return t ? typeof t != "string" ? ot(String(t)) : t.replace(/[\s-]/g, ".").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g, (e, s) => (s > 0 ? "." : "") + e.toLowerCase()) : "";
127
- }
128
- const xt = {
129
- /** Set box model to border-box */
130
- "*, *::before, *::after": {
131
- boxSizing: "border-box"
132
- },
133
- /** Remove default margin and padding */
134
- "*": {
135
- margin: 0
136
- },
137
- /** Remove adjust font properties */
138
- html: {
139
- lineHeight: 1.15,
140
- textSizeAdjust: "100%",
141
- WebkitFontSmoothing: "antialiased"
142
- },
143
- /** Make media elements responsive */
144
- "img, picture, video, canvas, svg": {
145
- display: "block",
146
- maxWidth: "100%"
147
- },
148
- /** Avoid overflow of text */
149
- "p, h1, h2, h3, h4, h5, h6": {
150
- overflowWrap: "break-word"
151
- },
152
- /** Improve text wrapping */
153
- p: {
154
- textWrap: "pretty"
155
- },
156
- "h1, h2, h3, h4, h5, h6": {
157
- textWrap: "balance"
158
- },
159
- /** Improve link color */
160
- a: {
161
- color: "currentColor"
162
- },
163
- /** Improve button line height */
164
- button: {
165
- lineHeight: "1em",
166
- color: "currentColor"
167
- },
168
- /** Improve form elements */
169
- "input, optgroup, select, textarea": {
170
- fontFamily: "inherit",
171
- fontSize: "100%",
172
- lineHeight: "1.15em"
173
- }
174
- }, B = {
175
- externalModules: []
176
- }, rt = (t) => {
177
- if (B.externalModules.length > 0) return B.externalModules;
178
- const e = l(t, "salty.config.ts"), n = W(e, "utf8").match(/externalModules:\s?\[(.*)\]/);
179
- if (!n) return [];
180
- const c = n[1].split(",").map((r) => r.replace(/['"`]/g, "").trim());
181
- return B.externalModules = c, c;
182
- }, R = (t) => l(t, "./saltygen"), Ct = ["salty", "css", "styles", "styled"], kt = (t = []) => new RegExp(`\\.(${[...Ct, ...t].join("|")})\\.`), L = (t, e = []) => kt(e).test(t), Pt = async (t) => {
183
- const e = R(t), s = l(t, "salty.config.ts"), n = l(e, "salty.config.js"), c = await nt(t), r = rt(t);
184
- await Q.build({
185
- entryPoints: [s],
186
- minify: !0,
187
- treeShaking: !0,
188
- bundle: !0,
189
- outfile: n,
190
- format: c,
191
- external: r
192
- });
193
- const f = Date.now(), { config: g } = await import(`${n}?t=${f}`);
194
- return g;
195
- }, Nt = async (t) => {
196
- const e = await Pt(t), s = /* @__PURE__ */ new Set(), n = (p, y = []) => p ? Object.entries(p).flatMap(([k, h]) => {
197
- if (!h) return;
198
- if (typeof h == "object") return n(h, [...y, k]);
199
- const A = ot(k), J = V(k), M = [...y, A].join(".");
200
- s.add(`"${M}"`);
201
- const T = [...y.map(V), J].join("-"), { result: D } = v(h);
202
- return `--${T}: ${D};`;
203
- }) : [], c = (p) => p ? Object.entries(p).flatMap(([y, k]) => {
204
- const h = n(k);
205
- return y === "base" ? h.join("") : `${y} { ${h.join("")} }`;
206
- }) : [], r = (p) => p ? Object.entries(p).flatMap(([y, k]) => Object.entries(k).flatMap(([h, A]) => {
207
- const J = n(A, [y]), M = `.${y}-${h}, [data-${y}="${h}"]`, T = J.join("");
208
- return `${M} { ${T} }`;
209
- })) : [], f = n(e.variables), g = c(e.responsiveVariables), i = r(e.conditionalVariables), o = R(t), m = l(o, "css/_variables.css"), j = `:root { ${f.join("")} ${g.join("")} } ${i.join("")}`;
210
- P(m, j);
211
- const w = l(o, "css/_global.css"), $ = O(e.global, "");
212
- P(w, `@layer global { ${$} }`);
213
- const F = l(o, "css/_reset.css"), u = e.reset === "none" ? {} : typeof e.reset == "object" ? e.reset : xt, b = O(u, "");
214
- P(F, `@layer reset { ${b} }`);
215
- const a = l(o, "css/_templates.css"), d = tt(e.templates), x = jt(e.templates);
216
- P(a, d);
217
- const S = l(o, "types/css-tokens.d.ts"), C = `
218
- // Variable types
219
- type VariableTokens = ${[...s].join("|")};
220
- type PropertyValueToken = \`{\${VariableTokens}}\`;
221
-
222
- // Template types
223
- type TemplateTokens = {
224
- ${Object.entries(x).map(([p, y]) => `${p}?: ${y}`).join(`
225
- `)}
226
- }
227
- `;
228
- P(S, C);
229
- }, q = async (t, e, s) => {
230
- const n = G(e), c = l(s, "./temp");
231
- K(c) || z(c);
232
- const r = I(e);
233
- let f = W(e, "utf8");
234
- f = f.replace(/styled\([^"'`{,]+,/g, "styled('div',");
235
- const g = l(s, "js", n + ".js"), i = rt(t), o = await nt(t);
236
- await Q.build({
237
- stdin: {
238
- contents: f,
239
- sourcefile: r.base,
240
- resolveDir: r.dir,
241
- loader: "tsx"
242
- },
243
- minify: !1,
244
- treeShaking: !0,
245
- bundle: !0,
246
- outfile: g,
247
- format: o,
248
- target: ["node20"],
249
- keepNames: !0,
250
- external: i,
251
- packages: "external"
252
- });
253
- const m = Date.now();
254
- return await import(`${g}?t=${m}`);
255
- }, U = async (t) => {
256
- const e = R(t), s = l(e, "salty.config.js"), n = Date.now(), { config: c } = await import(`${s}?t=${n}`);
257
- return c;
258
- }, ct = () => {
259
- try {
260
- return process.env.NODE_ENV === "production";
261
- } catch {
262
- return !1;
263
- }
264
- }, Mt = async (t, e = ct()) => {
265
- try {
266
- const s = Date.now();
267
- e ? H.info("Generating CSS in production mode! 🔥") : H.info("Generating CSS in development mode! 🚀");
268
- const n = [], c = [], r = R(t), f = l(r, "index.css");
269
- (() => {
270
- K(r) && pt("rm -rf " + r), z(r), z(l(r, "css")), z(l(r, "types"));
271
- })(), await Nt(t);
272
- const i = await U(t);
273
- async function o(a, d) {
274
- const x = ["node_modules", "saltygen"], S = ut(a);
275
- if (S.isDirectory()) {
276
- const N = dt(a);
277
- if (x.some((p) => a.includes(p))) return;
278
- await Promise.all(N.map((p) => o(l(a, p), l(d, p))));
279
- } else if (S.isFile() && L(a)) {
280
- const C = await q(t, a, r), p = [];
281
- Object.entries(C).forEach(([M, T]) => {
282
- if (T.isKeyframes && T.css) {
283
- const X = `a_${T.animationName}.css`, lt = `css/${X}`, ft = l(r, lt);
284
- n.push(X), P(ft, T.css);
285
- return;
286
- }
287
- if (!T.generator) return;
288
- const D = T.generator._withBuildContext({
289
- name: M,
290
- config: i,
291
- prod: e
292
- });
293
- c[D.priority] || (c[D.priority] = []), c[D.priority].push(D.cssFileName), p.push(D.cssFileName);
294
- const it = `css/${D.cssFileName}`, at = l(r, it);
295
- P(at, D.css);
296
- });
297
- const y = p.map((M) => `@import url('./${M}');`).join(`
298
- `), k = G(a, 6), h = I(a), A = V(h.name), J = l(r, `css/f_${A}-${k}.css`);
299
- P(J, y);
300
- }
301
- }
302
- await o(t, r);
303
- const m = n.map((a) => `@import url('./css/${a}');`).join(`
304
- `);
305
- let F = `@layer reset, global, l0, l1, l2, l3, l4, l5, l6, l7, l8;
306
-
307
- ${["_variables.css", "_reset.css", "_global.css", "_templates.css"].filter((a) => {
308
- try {
309
- return W(l(r, "css", a), "utf8").length > 0;
310
- } catch {
311
- return !1;
312
- }
313
- }).map((a) => `@import url('./css/${a}');`).join(`
314
- `)}
315
- ${m}`;
316
- if (i.importStrategy !== "component") {
317
- const a = c.reduce((d, x, S) => {
318
- const N = x.reduce((C, p) => C + `@import url('./css/${p}') layer(l${S});`, "");
319
- return `${d}
320
- ${N}`;
321
- }, "");
322
- F += a;
323
- }
324
- P(f, F);
325
- const u = Date.now() - s, b = u < 200 ? "🔥" : u < 500 ? "🚀" : u < 1e3 ? "🎉" : u < 2e3 ? "🚗" : u < 5e3 ? "🤔" : "🥴";
326
- H.info(`Generated CSS in ${u}ms! ${b}`);
327
- } catch (s) {
328
- console.error(s);
329
- }
330
- }, _t = async (t, e) => {
331
- try {
332
- const s = [], n = l(t, "./saltygen"), c = l(n, "index.css");
333
- if (L(e)) {
334
- const f = await U(t), g = await q(t, e, n);
335
- Object.entries(g).forEach(([w, $]) => {
336
- if ($.isKeyframes && $.css) {
337
- const a = `css/${`a_${$.animationName}.css`}`, d = l(n, a);
338
- P(d, $.css);
339
- return;
340
- }
341
- if (!$.generator) return;
342
- const F = $.generator._withBuildContext({
343
- name: w,
344
- config: f
345
- }), E = `css/${F.cssFileName}`, u = l(n, E);
346
- s.push(F.cssFileName), P(u, F.css);
347
- });
348
- const i = W(c, "utf8").split(`
349
- `), o = s.map((w) => `@import url('../saltygen/css/${w}');`), j = [.../* @__PURE__ */ new Set([...i, ...o])].join(`
350
- `);
351
- P(c, j);
352
- }
353
- } catch (s) {
354
- console.error(s);
355
- }
356
- }, At = async (t, e, s = ct()) => {
357
- try {
358
- const n = l(t, "./saltygen");
359
- if (L(e)) {
360
- const r = W(e, "utf8");
361
- r.replace(/^(?!export\s)const\s.*/gm, (m) => `export ${m}`) !== r && await mt(e, r);
362
- const g = await U(t), i = await q(t, e, n);
363
- let o = r;
364
- if (Object.entries(i).forEach(([m, j]) => {
365
- var k;
366
- if (j.isKeyframes || !j.generator) return;
367
- const w = j.generator._withBuildContext({
368
- name: m,
369
- config: g,
370
- prod: s
371
- }), $ = new RegExp(`\\s${m}[=\\s]+[^()]+styled\\(([^,]+),`, "g").exec(r);
372
- if (!$) return console.error("Could not find the original declaration");
373
- const F = (k = $.at(1)) == null ? void 0 : k.trim(), E = new RegExp(`\\s${m}[=\\s]+styled\\(`, "g").exec(o);
374
- if (!E) return console.error("Could not find the original declaration");
375
- const { index: u } = E;
376
- let b = !1;
377
- const a = setTimeout(() => b = !0, 5e3);
378
- let d = 0, x = !1, S = 0;
379
- for (; !x && !b; ) {
380
- const h = o[u + d];
381
- h === "(" && S++, h === ")" && S--, S === 0 && h === ")" && (x = !0), d > o.length && (b = !0), d++;
382
- }
383
- if (!b) clearTimeout(a);
384
- else throw new Error("Failed to find the end of the styled call and timed out");
385
- const N = u + d, C = o.slice(u, N), p = o, y = ` ${m} = styled(${F}, "${w.classNames}", ${JSON.stringify(w.props)});`;
386
- o = o.replace(C, y), p === o && console.error("Minimize file failed to change content", { name: m, tagName: F });
387
- }), g.importStrategy === "component") {
388
- const m = G(e, 6), j = I(e);
389
- o = `import '../../saltygen/css/${`f_${V(j.name)}-${m}.css`}';
390
- ${o}`;
391
- }
392
- return o = o.replace("{ styled }", "{ styledClient as styled }"), o = o.replace("@salty-css/react/styled", "@salty-css/react/styled-client"), o;
393
- }
394
- } catch (n) {
395
- console.error("Error in minimizeFile:", n);
396
- }
397
- };
398
- export {
399
- _t as a,
400
- Mt as g,
401
- At as m,
402
- kt as s
403
- };
@@ -1,28 +0,0 @@
1
- "use strict";const fe=require("esbuild"),ue=require("child_process"),a=require("path"),u=require("fs"),U=require("fs/promises"),z=require("winston");var W=typeof document<"u"?document.currentScript:null;function pe(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const X=pe(fe),G=e=>String.fromCharCode(e+(e>25?39:97)),de=(e,t)=>{let s="",n;for(n=Math.abs(e);n>52;n=n/52|0)s=G(n%52)+s;return s=G(n%52)+s,s.length<t?s=s.padStart(t,"a"):s.length>t&&(s=s.slice(-t)),s},ge=(e,t)=>{let s=t.length;for(;s;)e=e*33^t.charCodeAt(--s);return e},I=(e,t=5)=>{const s=ge(5381,JSON.stringify(e))>>>0;return de(s,t)};function E(e){return e?typeof e!="string"?E(String(e)):e.replace(/[\s.]/g,"-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(t,s)=>(s>0?"-":"")+t.toLowerCase()):""}const ye=(e,t)=>{if(typeof e!="string")return{result:e};if(!t)return{result:e};const s=[];return Object.values(t).forEach(n=>{const{pattern:i,transform:r}=n;e=e.replace(i,f=>{const{value:y,css:c}=r(f);return c&&s.push(c),y})}),{result:e,additionalCss:s}},Y=e=>typeof e!="string"?{result:e}:/\{[^{}]+\}/g.test(e)?{result:e.replace(/\{([^{}]+)\}/g,(...n)=>`var(--${E(n[1].replaceAll(".","-"))})`)}:{result:e},_=(e,t,s)=>{if(!e)return"";const n=[],i=Object.entries(e).reduce((f,[y,c])=>{const o=y.trim();if(typeof c=="function"&&(c=c()),typeof c=="object"){if(!c)return f;if(o==="variants")return Object.entries(c).forEach(([l,g])=>{g&&Object.entries(g).forEach(([C,S])=>{if(!S)return;const N=`${t}.${l}-${C}`,k=_(S,N);n.push(k)})}),f;if(o==="defaultVariants")return f;if(o==="compoundVariants")return c.forEach(l=>{const{css:g,...C}=l,S=Object.entries(C).reduce((k,[p,h])=>`${k}.${p}-${h}`,t),N=_(g,S);n.push(N)}),f;if(o.startsWith("@")){const l=_(c,t),g=`${o} {
2
- ${l.replace(`
3
- `,`
4
- `)}
5
- }`;return n.push(g),f}const d=y.includes("&")?o.replace("&",t):o.startsWith(":")?`${t}${o}`:`${t} ${o}`,j=_(c,d);return n.push(j),f}const m=o.startsWith("-")?o:E(o),w=(d,j=";")=>f=`${f}${d}${j}`,F=d=>w(`${m}:${d}`);if(typeof c=="number")return F(c);if(typeof c!="string")if("toString"in c)c=c.toString();else return f;const{modifiers:$}={},O=function*(){yield Y(c),yield ye(c,$)}();for(const{result:d,additionalCss:j=[]}of O)c=d,j.forEach(l=>{const g=_(l,"");w(g,"")});return F(c)},"");return i?t?[`${t} { ${i} }`,...n].join(`
6
- `):i:n.join(`
7
- `)},Q=(e,t=[])=>{if(!e)return"";const s=[],n={};if(Object.entries(e).forEach(([i,r])=>{if(typeof r=="object"){if(!r)return;const f=i.trim(),y=Q(r,[...t,f]);s.push(y)}else n[i]=r}),Object.keys(n).length){const i=t.map(E).join("-"),r=_(n,`.${i}`);s.push(r)}return s.join(`
8
- `)},me=e=>Object.entries(e).reduce((t,[s,n])=>(typeof n=="object"&&(t[s]=v(n).map(i=>`"${i}"`).join(" | ")),t),{}),v=(e,t="",s=new Set)=>e?(Object.entries(e).forEach(([n,i])=>{const r=t?`${t}.${n}`:n;return typeof i=="object"?v(i,r,s):s.add(t)}),[...s]):[],ee=e=>{if(!e||e==="/")throw new Error("Could not find package.json file");const t=a.join(e,"package.json");return u.existsSync(t)?t:ee(a.join(e,".."))},he=async e=>{const t=ee(e);return await U.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},be=async e=>{const t=await he(e);if(t)return t.type};let V;const te=async e=>{if(V)return V;const t=await be(e);return t==="module"?V="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:W&&W.tagName.toUpperCase()==="SCRIPT"&&W.src||new URL("index-qF3BcfMG.cjs",document.baseURI).href).endsWith(".cjs"))&&(V="cjs"),V||"esm"},Z=z.createLogger({level:"debug",format:z.format.combine(z.format.colorize(),z.format.cli()),transports:[new z.transports.Console({})]});function se(e){return e?typeof e!="string"?se(String(e)):e.replace(/[\s-]/g,".").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(t,s)=>(s>0?".":"")+t.toLowerCase()):""}const $e={"*, *::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"}},q={externalModules:[]},ne=e=>{if(q.externalModules.length>0)return q.externalModules;const t=a.join(e,"salty.config.ts"),n=u.readFileSync(t,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!n)return[];const i=n[1].split(",").map(r=>r.replace(/['"`]/g,"").trim());return q.externalModules=i,i},J=e=>a.join(e,"./saltygen"),je=["salty","css","styles","styled"],oe=(e=[])=>new RegExp(`\\.(${[...je,...e].join("|")})\\.`),H=(e,t=[])=>oe(t).test(e),Se=async e=>{const t=J(e),s=a.join(e,"salty.config.ts"),n=a.join(t,"salty.config.js"),i=await te(e),r=ne(e);await X.build({entryPoints:[s],minify:!0,treeShaking:!0,bundle:!0,outfile:n,format:i,external:r});const f=Date.now(),{config:y}=await import(`${n}?t=${f}`);return y},we=async e=>{const t=await Se(e),s=new Set,n=(p,h=[])=>p?Object.entries(p).flatMap(([P,b])=>{if(!b)return;if(typeof b=="object")return n(b,[...h,P]);const A=se(P),R=E(P),M=[...h,A].join(".");s.add(`"${M}"`);const T=[...h.map(E),R].join("-"),{result:D}=Y(b);return`--${T}: ${D};`}):[],i=p=>p?Object.entries(p).flatMap(([h,P])=>{const b=n(P);return h==="base"?b.join(""):`${h} { ${b.join("")} }`}):[],r=p=>p?Object.entries(p).flatMap(([h,P])=>Object.entries(P).flatMap(([b,A])=>{const R=n(A,[h]),M=`.${h}-${b}, [data-${h}="${b}"]`,T=R.join("");return`${M} { ${T} }`})):[],f=n(t.variables),y=i(t.responsiveVariables),c=r(t.conditionalVariables),o=J(e),m=a.join(o,"css/_variables.css"),w=`:root { ${f.join("")} ${y.join("")} } ${c.join("")}`;u.writeFileSync(m,w);const F=a.join(o,"css/_global.css"),$=_(t.global,"");u.writeFileSync(F,`@layer global { ${$} }`);const x=a.join(o,"css/_reset.css"),d=t.reset==="none"?{}:typeof t.reset=="object"?t.reset:$e,j=_(d,"");u.writeFileSync(x,`@layer reset { ${j} }`);const l=a.join(o,"css/_templates.css"),g=Q(t.templates),C=me(t.templates);u.writeFileSync(l,g);const S=a.join(o,"types/css-tokens.d.ts"),k=`
9
- // Variable types
10
- type VariableTokens = ${[...s].join("|")};
11
- type PropertyValueToken = \`{\${VariableTokens}}\`;
12
-
13
- // Template types
14
- type TemplateTokens = {
15
- ${Object.entries(C).map(([p,h])=>`${p}?: ${h}`).join(`
16
- `)}
17
- }
18
- `;u.writeFileSync(S,k)},B=async(e,t,s)=>{const n=I(t),i=a.join(s,"./temp");u.existsSync(i)||u.mkdirSync(i);const r=a.parse(t);let f=u.readFileSync(t,"utf8");f=f.replace(/styled\([^"'`{,]+,/g,"styled('div',");const y=a.join(s,"js",n+".js"),c=ne(e),o=await te(e);await X.build({stdin:{contents:f,sourcefile:r.base,resolveDir:r.dir,loader:"tsx"},minify:!1,treeShaking:!0,bundle:!0,outfile:y,format:o,target:["node20"],keepNames:!0,external:c,packages:"external"});const m=Date.now();return await import(`${y}?t=${m}`)},K=async e=>{const t=J(e),s=a.join(t,"salty.config.js"),n=Date.now(),{config:i}=await import(`${s}?t=${n}`);return i},re=()=>{try{return process.env.NODE_ENV==="production"}catch{return!1}},Fe=async(e,t=re())=>{try{const s=Date.now();t?Z.info("Generating CSS in production mode! 🔥"):Z.info("Generating CSS in development mode! 🚀");const n=[],i=[],r=J(e),f=a.join(r,"index.css");(()=>{u.existsSync(r)&&ue.execSync("rm -rf "+r),u.mkdirSync(r),u.mkdirSync(a.join(r,"css")),u.mkdirSync(a.join(r,"types"))})(),await we(e);const c=await K(e);async function o(l,g){const C=["node_modules","saltygen"],S=u.statSync(l);if(S.isDirectory()){const N=u.readdirSync(l);if(C.some(p=>l.includes(p)))return;await Promise.all(N.map(p=>o(a.join(l,p),a.join(g,p))))}else if(S.isFile()&&H(l)){const k=await B(e,l,r),p=[];Object.entries(k).forEach(([M,T])=>{if(T.isKeyframes&&T.css){const L=`a_${T.animationName}.css`,ae=`css/${L}`,le=a.join(r,ae);n.push(L),u.writeFileSync(le,T.css);return}if(!T.generator)return;const D=T.generator._withBuildContext({name:M,config:c,prod:t});i[D.priority]||(i[D.priority]=[]),i[D.priority].push(D.cssFileName),p.push(D.cssFileName);const ie=`css/${D.cssFileName}`,ce=a.join(r,ie);u.writeFileSync(ce,D.css)});const h=p.map(M=>`@import url('./${M}');`).join(`
19
- `),P=I(l,6),b=a.parse(l),A=E(b.name),R=a.join(r,`css/f_${A}-${P}.css`);u.writeFileSync(R,h)}}await o(e,r);const m=n.map(l=>`@import url('./css/${l}');`).join(`
20
- `);let x=`@layer reset, global, l0, l1, l2, l3, l4, l5, l6, l7, l8;
21
-
22
- ${["_variables.css","_reset.css","_global.css","_templates.css"].filter(l=>{try{return u.readFileSync(a.join(r,"css",l),"utf8").length>0}catch{return!1}}).map(l=>`@import url('./css/${l}');`).join(`
23
- `)}
24
- ${m}`;if(c.importStrategy!=="component"){const l=i.reduce((g,C,S)=>{const N=C.reduce((k,p)=>k+`@import url('./css/${p}') layer(l${S});`,"");return`${g}
25
- ${N}`},"");x+=l}u.writeFileSync(f,x);const d=Date.now()-s,j=d<200?"🔥":d<500?"🚀":d<1e3?"🎉":d<2e3?"🚗":d<5e3?"🤔":"🥴";Z.info(`Generated CSS in ${d}ms! ${j}`)}catch(s){console.error(s)}},xe=async(e,t)=>{try{const s=[],n=a.join(e,"./saltygen"),i=a.join(n,"index.css");if(H(t)){const f=await K(e),y=await B(e,t,n);Object.entries(y).forEach(([F,$])=>{if($.isKeyframes&&$.css){const l=`css/${`a_${$.animationName}.css`}`,g=a.join(n,l);u.writeFileSync(g,$.css);return}if(!$.generator)return;const x=$.generator._withBuildContext({name:F,config:f}),O=`css/${x.cssFileName}`,d=a.join(n,O);s.push(x.cssFileName),u.writeFileSync(d,x.css)});const c=u.readFileSync(i,"utf8").split(`
26
- `),o=s.map(F=>`@import url('../saltygen/css/${F}');`),w=[...new Set([...c,...o])].join(`
27
- `);u.writeFileSync(i,w)}}catch(s){console.error(s)}},Ce=async(e,t,s=re())=>{try{const n=a.join(e,"./saltygen");if(H(t)){const r=u.readFileSync(t,"utf8");r.replace(/^(?!export\s)const\s.*/gm,m=>`export ${m}`)!==r&&await U.writeFile(t,r);const y=await K(e),c=await B(e,t,n);let o=r;if(Object.entries(c).forEach(([m,w])=>{var P;if(w.isKeyframes||!w.generator)return;const F=w.generator._withBuildContext({name:m,config:y,prod:s}),$=new RegExp(`\\s${m}[=\\s]+[^()]+styled\\(([^,]+),`,"g").exec(r);if(!$)return console.error("Could not find the original declaration");const x=(P=$.at(1))==null?void 0:P.trim(),O=new RegExp(`\\s${m}[=\\s]+styled\\(`,"g").exec(o);if(!O)return console.error("Could not find the original declaration");const{index:d}=O;let j=!1;const l=setTimeout(()=>j=!0,5e3);let g=0,C=!1,S=0;for(;!C&&!j;){const b=o[d+g];b==="("&&S++,b===")"&&S--,S===0&&b===")"&&(C=!0),g>o.length&&(j=!0),g++}if(!j)clearTimeout(l);else throw new Error("Failed to find the end of the styled call and timed out");const N=d+g,k=o.slice(d,N),p=o,h=` ${m} = styled(${x}, "${F.classNames}", ${JSON.stringify(F.props)});`;o=o.replace(k,h),p===o&&console.error("Minimize file failed to change content",{name:m,tagName:x})}),y.importStrategy==="component"){const m=I(t,6),w=a.parse(t);o=`import '../../saltygen/css/${`f_${E(w.name)}-${m}.css`}';
28
- ${o}`}return o=o.replace("{ styled }","{ styledClient as styled }"),o=o.replace("@salty-css/react/styled","@salty-css/react/styled-client"),o}}catch(n){console.error("Error in minimizeFile:",n)}};exports.generateCss=Fe;exports.generateFile=xe;exports.minimizeFile=Ce;exports.saltyFileRegExp=oe;