@salty-css/webpack 0.0.1-alpha.201 → 0.0.1-alpha.203

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/loader.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";const i=require("./index-Dq_u-jmb.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-BvNnzbqp.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-2dgpGWxF.js";
1
+ import { a as e, m as i } from "./index-BhdhQhTB.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.201",
3
+ "version": "0.0.1-alpha.203",
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.201",
37
+ "@salty-css/core": "^0.0.1-alpha.203",
38
38
  "webpack": ">=5.x"
39
39
  }
40
40
  }
package/index-2dgpGWxF.js DELETED
@@ -1,577 +0,0 @@
1
- import * as gt from "esbuild";
2
- import { execSync as Pt } from "child_process";
3
- import { join as f, parse as X } from "path";
4
- import { existsSync as rt, writeFileSync as k, readFileSync as O, mkdirSync as H, statSync as kt, readdirSync as Dt } from "fs";
5
- import { readFile as mt, writeFile as Et } from "fs/promises";
6
- import { createLogger as _t, format as nt, transports as Tt } from "winston";
7
- const pt = (t) => String.fromCharCode(t + (t > 25 ? 39 : 97)), Ot = (t, e) => {
8
- let s = "", n;
9
- for (n = Math.abs(t); n > 52; n = n / 52 | 0) s = pt(n % 52) + s;
10
- return s = pt(n % 52) + s, s.length < e ? s = s.padStart(e, "a") : s.length > e && (s = s.slice(-e)), s;
11
- }, Vt = (t, e) => {
12
- let s = e.length;
13
- for (; s; ) t = t * 33 ^ e.charCodeAt(--s);
14
- return t;
15
- }, B = (t, e = 5) => {
16
- const s = Vt(5381, JSON.stringify(t)) >>> 0;
17
- return Ot(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 Mt = (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: o, transform: a } = n;
28
- t = t.replace(o, (i) => {
29
- const { value: p, css: r } = a(i);
30
- return r && s.push(r), p;
31
- });
32
- }), { result: t, additionalCss: s };
33
- }, ht = (t) => typeof t != "string" ? { result: t } : /\{[^{}]+\}/g.test(t) ? { result: t.replace(/\{([^{}]+)\}/g, (...n) => `var(--${V(n[1].replaceAll(".", "-"))})`) } : { result: t }, Rt = [
34
- "top",
35
- "right",
36
- "bottom",
37
- "left",
38
- "min-width",
39
- /.*width.*/,
40
- /^[^line]*height.*/,
41
- // Exclude line-height
42
- /padding.*/,
43
- /margin.*/,
44
- /border.*/,
45
- /inset.*/,
46
- /.*radius.*/,
47
- /.*spacing.*/,
48
- /.*gap.*/,
49
- /.*indent.*/,
50
- /.*offset.*/,
51
- /.*size.*/,
52
- /.*thickness.*/,
53
- /.*font-size.*/
54
- ], Jt = (t, e, s) => Rt.some((o) => typeof o == "string" ? o === t : o.test(t)) ? `${e}px` : `${e}`, Wt = ["Webkit", "Moz", "ms", "O"], zt = (t) => t.startsWith("-") ? t : Wt.some((e) => t.startsWith(e)) ? `-${V(t)}` : V(t), W = (t, e, s) => {
55
- if (!t) return "";
56
- const n = [], o = Object.entries(t).reduce((i, [p, r]) => {
57
- const c = p.trim(), g = zt(c), m = (w, D = ";") => i = `${i}${w}${D}`, d = (w) => m(`${g}:${w}`);
58
- if (typeof r == "function" && (r = r()), typeof r == "object") {
59
- if (!r) return i;
60
- if (r.isColor)
61
- return d(r.toString()), i;
62
- if (c === "variants")
63
- return Object.entries(r).forEach(([E, F]) => {
64
- F && Object.entries(F).forEach(([T, N]) => {
65
- if (!N) return;
66
- const M = `${e}.${E}-${T}`, l = W(N, M);
67
- n.push(l);
68
- });
69
- }), i;
70
- if (c === "defaultVariants")
71
- return i;
72
- if (c === "compoundVariants")
73
- return r.forEach((E) => {
74
- const { css: F, ...T } = E, N = Object.entries(T).reduce((l, [h, $]) => `${l}.${h}-${$}`, e), M = W(F, N);
75
- n.push(M);
76
- }), i;
77
- if (c.startsWith("@")) {
78
- const E = c, F = W(r, e), T = `${E} {
79
- ${F.replace(`
80
- `, `
81
- `)}
82
- }`;
83
- return n.push(T), i;
84
- }
85
- const w = p.includes("&") ? c.replace("&", e) : c.startsWith(":") ? `${e}${c}` : `${e} ${c}`, D = W(r, w);
86
- return n.push(D), i;
87
- }
88
- if (typeof r == "number") {
89
- const w = Jt(g, r);
90
- return d(w);
91
- }
92
- if (typeof r != "string")
93
- if ("toString" in r) r = r.toString();
94
- else return i;
95
- const { modifiers: b } = {}, _ = function* () {
96
- yield ht(r), yield Mt(r, b);
97
- }();
98
- for (const { result: w, additionalCss: D = [] } of _)
99
- r = w, D.forEach((E) => {
100
- const F = W(E, "");
101
- m(F, "");
102
- });
103
- return d(r);
104
- }, "");
105
- return o ? e ? [`${e} { ${o} }`, ...n].join(`
106
- `) : o : n.join(`
107
- `);
108
- }, yt = (t, e = []) => {
109
- if (!t) return "";
110
- const s = [], n = {};
111
- if (Object.entries(t).forEach(([o, a]) => {
112
- if (typeof a == "object") {
113
- if (!a) return;
114
- const i = o.trim(), p = yt(a, [...e, i]);
115
- s.push(p);
116
- } else
117
- n[o] = a;
118
- }), Object.keys(n).length) {
119
- const o = e.map(V).join("-"), a = W(n, `.${o}`);
120
- s.push(a);
121
- }
122
- return s.join(`
123
- `);
124
- }, At = (t) => t ? Object.entries(t).reduce((e, [s, n]) => (typeof n == "object" && (e[s] = $t(n).map((o) => `"${o}"`).join(" | ")), e), {}) : {}, $t = (t, e = "", s = /* @__PURE__ */ new Set()) => t ? (Object.entries(t).forEach(([n, o]) => {
125
- const a = e ? `${e}.${n}` : n;
126
- return typeof o == "object" ? $t(o, a, s) : s.add(e);
127
- }), [...s]) : [], bt = (t) => {
128
- if (!t || t === "/") throw new Error("Could not find package.json file");
129
- const e = f(t, "package.json");
130
- return rt(e) ? e : bt(f(t, ".."));
131
- }, Zt = async (t) => {
132
- const e = bt(t);
133
- return await mt(e, "utf-8").then(JSON.parse).catch(() => {
134
- });
135
- }, Ht = async (t) => {
136
- const e = await Zt(t);
137
- if (e)
138
- return e.type;
139
- };
140
- let Z;
141
- const wt = async (t) => {
142
- if (Z) return Z;
143
- const e = await Ht(t);
144
- return e === "module" ? Z = "esm" : (e === "commonjs" || import.meta.url.endsWith(".cjs")) && (Z = "cjs"), Z || "esm";
145
- }, ot = _t({
146
- level: "debug",
147
- format: nt.combine(nt.colorize(), nt.cli()),
148
- transports: [new Tt.Console({})]
149
- });
150
- function St(t) {
151
- return t ? typeof t != "string" ? St(String(t)) : t.replace(/[\s-]/g, ".").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g, (e, s) => (s > 0 ? "." : "") + e.toLowerCase()) : "";
152
- }
153
- const It = {
154
- /** Set box model to border-box */
155
- "*, *::before, *::after": {
156
- boxSizing: "border-box"
157
- },
158
- /** Remove default margin and padding */
159
- "*": {
160
- margin: 0
161
- },
162
- /** Remove adjust font properties */
163
- html: {
164
- lineHeight: 1.15,
165
- textSizeAdjust: "100%",
166
- WebkitFontSmoothing: "antialiased"
167
- },
168
- /** Make media elements responsive */
169
- "img, picture, video, canvas, svg": {
170
- display: "block",
171
- maxWidth: "100%"
172
- },
173
- /** Avoid overflow of text */
174
- "p, h1, h2, h3, h4, h5, h6": {
175
- overflowWrap: "break-word"
176
- },
177
- /** Improve text wrapping */
178
- p: {
179
- textWrap: "pretty"
180
- },
181
- "h1, h2, h3, h4, h5, h6": {
182
- textWrap: "balance"
183
- },
184
- /** Improve link color */
185
- a: {
186
- color: "currentColor"
187
- },
188
- /** Improve button line height */
189
- button: {
190
- lineHeight: "1em",
191
- color: "currentColor"
192
- },
193
- /** Improve form elements */
194
- "input, optgroup, select, textarea": {
195
- fontFamily: "inherit",
196
- fontSize: "100%",
197
- lineHeight: "1.15em"
198
- }
199
- }, I = (...t) => t.flat().reduce((e, s) => s != null && s._current ? { ...e, ...s._current } : { ...e, ...s }, {}), J = {
200
- externalModules: [],
201
- rcFile: void 0,
202
- destDir: void 0
203
- }, Ct = (t) => {
204
- if (J.externalModules.length > 0) return J.externalModules;
205
- const s = O(t, "utf8").match(/externalModules:\s?\[(.*)\]/);
206
- if (!s) return [];
207
- const n = s[1].split(",").map((o) => o.replace(/['"`]/g, "").trim());
208
- return J.externalModules = n, n;
209
- }, z = async (t) => {
210
- if (J.destDir) return J.destDir;
211
- const e = await ct(t), s = f(t, (e == null ? void 0 : e.saltygenDir) || "saltygen");
212
- return J.destDir = s, s;
213
- }, jt = ["salty", "css", "styles", "styled"], Bt = (t = []) => new RegExp(`\\.(${[...jt, ...t].join("|")})\\.`), it = (t, e = []) => Bt(e).test(t), Ft = async (t) => {
214
- if (J.rcFile) return J.rcFile;
215
- if (t === "/") throw new Error("Could not find .saltyrc.json file");
216
- const e = f(t, ".saltyrc.json"), s = await mt(e, "utf-8").then(JSON.parse).catch(() => {
217
- });
218
- return s ? (J.rcFile = s, s) : Ft(f(t, ".."));
219
- }, ct = async (t) => {
220
- var n, o;
221
- const e = await Ft(t), s = (n = e.projects) == null ? void 0 : n.find((a) => t.endsWith(a.dir || ""));
222
- return s || ((o = e.projects) == null ? void 0 : o.find((a) => a.dir === e.defaultProject));
223
- }, Gt = async (t) => {
224
- const e = await ct(t), s = await z(t), n = f(t, (e == null ? void 0 : e.configDir) || "", "salty.config.ts"), o = f(s, "salty.config.js"), a = await wt(t), i = Ct(n);
225
- await gt.build({
226
- entryPoints: [n],
227
- minify: !0,
228
- treeShaking: !0,
229
- bundle: !0,
230
- outfile: o,
231
- format: a,
232
- external: i
233
- });
234
- const p = Date.now(), { config: r } = await import(`${o}?t=${p}`);
235
- return r;
236
- }, Kt = async (t, e) => {
237
- var ft, ut;
238
- const s = await z(t), n = {
239
- mediaQueries: [],
240
- globalStyles: [],
241
- variables: [],
242
- templates: []
243
- };
244
- await Promise.all(
245
- [...e].map(async (S) => {
246
- const C = await Y(t, S, s);
247
- Object.entries(C).forEach(([R, j]) => {
248
- j.isMedia ? n.mediaQueries.push([R, j]) : j.isGlobalDefine ? n.globalStyles.push(j) : j.isDefineVariables ? n.variables.push(j) : j.isDefineTemplates && n.templates.push(j);
249
- });
250
- })
251
- );
252
- const o = await Gt(t), a = { ...o }, i = /* @__PURE__ */ new Set(), p = (S, C = []) => S ? Object.entries(S).flatMap(([R, j]) => {
253
- if (!j) return;
254
- if (typeof j == "object") return p(j, [...C, R]);
255
- const v = St(R), tt = V(R), et = [...C, v].join(".");
256
- i.add(`"${et}"`);
257
- const st = [...C.map(V), tt].join("-"), { result: Nt } = ht(j);
258
- return `--${st}: ${Nt};`;
259
- }) : [], r = (S) => S ? Object.entries(S).flatMap(([C, R]) => {
260
- const j = p(R);
261
- return C === "base" ? j.join("") : `${C} { ${j.join("")} }`;
262
- }) : [], c = (S) => S ? Object.entries(S).flatMap(([C, R]) => Object.entries(R).flatMap(([j, v]) => {
263
- const tt = p(v, [C]), et = `.${C}-${j}, [data-${C}="${j}"]`, st = tt.join("");
264
- return `${et} { ${st} }`;
265
- })) : [], g = (S) => ({ ...S, responsive: void 0, conditional: void 0 }), m = (S) => n.variables.map((C) => S === "static" ? g(C._current) : C._current[S]), d = I(g(o.variables), m("static")), b = p(d), y = I((ft = o.variables) == null ? void 0 : ft.responsive, m("responsive")), _ = r(y), w = I((ut = o.variables) == null ? void 0 : ut.conditional, m("conditional")), D = c(w), E = f(s, "css/_variables.css"), F = `:root { ${b.join("")} ${_.join("")} } ${D.join("")}`;
266
- k(E, F), a.staticVariables = d;
267
- const T = f(s, "css/_global.css"), N = I(o.global, n.globalStyles), M = W(N, "");
268
- k(T, `@layer global { ${M} }`);
269
- const l = f(s, "css/_reset.css"), $ = o.reset === "none" ? {} : typeof o.reset == "object" ? o.reset : It, u = W($, "");
270
- k(l, `@layer reset { ${u} }`);
271
- const x = f(s, "css/_templates.css"), P = I(o.templates, n.templates), G = yt(P), K = At(P);
272
- k(x, G), a.templates = P;
273
- const { mediaQueries: A } = n;
274
- a.mediaQueries = Object.fromEntries(A.map(([S, C]) => [`@${S}`, C]));
275
- const Q = A.map(([S]) => `'@${S}'`).join(" | "), q = f(s, "types/css-tokens.d.ts"), L = `
276
- // Variable types
277
- type VariableTokens = ${[...i].join("|")};
278
- type PropertyValueToken = \`{\${VariableTokens}}\`;
279
-
280
- // Template types
281
- type TemplateTokens = {
282
- ${Object.entries(K).map(([S, C]) => `${S}?: ${C}`).join(`
283
- `)}
284
- }
285
-
286
- // Media query types
287
- type MediaQueryKeys = ${Q || "''"};
288
- `;
289
- k(q, L);
290
- const U = f(s, "cache/config-cache.json");
291
- k(U, JSON.stringify(a, null, 2));
292
- }, dt = (t) => t.replace(/styled\(([^"'`{,]+),/g, (e, s) => {
293
- if (/^['"`]/.test(s)) return e;
294
- const o = new RegExp(`import[^;]*${s}[,\\s{][^;]*from\\s?([^{};]+);`);
295
- if (!o.test(t)) return e;
296
- const i = o.exec(t);
297
- if (i) {
298
- const p = i.at(1);
299
- if (jt.some((c) => p == null ? void 0 : p.includes(c))) return e;
300
- }
301
- return "styled('div',";
302
- }), Lt = (t, e) => {
303
- try {
304
- const s = O(f(e, "saltygen/cache/config-cache.json"), "utf8");
305
- return s ? `globalThis.saltyConfig = ${s};
306
-
307
- ${t}` : `globalThis.saltyConfig = {};
308
-
309
- ${t}`;
310
- } catch {
311
- return t;
312
- }
313
- }, Y = async (t, e, s) => {
314
- const n = B(e), o = f(s, "./temp");
315
- rt(o) || H(o);
316
- const a = X(e);
317
- let i = O(e, "utf8");
318
- i = dt(i), i = Lt(i, t);
319
- const p = f(s, "js", n + ".js"), r = await ct(t), c = f(t, (r == null ? void 0 : r.configDir) || "", "salty.config.ts"), g = Ct(c), m = await wt(t);
320
- await gt.build({
321
- stdin: {
322
- contents: i,
323
- sourcefile: a.base,
324
- resolveDir: a.dir,
325
- loader: "tsx"
326
- },
327
- minify: !1,
328
- treeShaking: !0,
329
- bundle: !0,
330
- outfile: p,
331
- format: m,
332
- target: ["node20"],
333
- keepNames: !0,
334
- external: g,
335
- packages: "external",
336
- plugins: [
337
- {
338
- name: "test",
339
- setup: (y) => {
340
- y.onLoad({ filter: /.*\.css|salty|styles|styled\.ts/ }, (_) => {
341
- const w = O(_.path, "utf8");
342
- return { contents: dt(w), loader: "ts" };
343
- });
344
- }
345
- }
346
- ]
347
- });
348
- const d = Date.now();
349
- return await import(`${p}?t=${d}`);
350
- }, Qt = async (t) => {
351
- const e = await z(t), s = f(e, "cache/config-cache.json"), n = O(s, "utf8");
352
- if (!n) throw new Error("Could not find config cache file");
353
- return JSON.parse(n);
354
- }, at = async (t) => {
355
- const e = await Qt(t), s = await z(t), n = f(s, "salty.config.js"), o = Date.now(), { config: a } = await import(`${n}?t=${o}`);
356
- return I(a, e);
357
- }, xt = () => {
358
- try {
359
- return process.env.NODE_ENV === "production";
360
- } catch {
361
- return !1;
362
- }
363
- }, te = async (t, e = xt(), s = !0) => {
364
- try {
365
- const n = Date.now();
366
- e ? ot.info("Generating CSS in production mode! 🔥") : ot.info("Generating CSS in development mode! 🚀");
367
- const o = [], a = [], i = await z(t), p = f(i, "index.css");
368
- s && (() => {
369
- rt(i) && Pt("rm -rf " + i), H(i, { recursive: !0 }), H(f(i, "css")), H(f(i, "types")), H(f(i, "js")), H(f(i, "cache"));
370
- })();
371
- const c = /* @__PURE__ */ new Set(), g = /* @__PURE__ */ new Set();
372
- async function m(l) {
373
- const h = ["node_modules", "saltygen"], $ = kt(l);
374
- if ($.isDirectory()) {
375
- const u = Dt(l);
376
- if (h.some((P) => l.includes(P))) return;
377
- await Promise.all(u.map((P) => m(f(l, P))));
378
- } else if ($.isFile() && it(l)) {
379
- c.add(l);
380
- const x = O(l, "utf8");
381
- /define[\w\d]+\(/.test(x) && g.add(l);
382
- }
383
- }
384
- await m(t), await Kt(t, g);
385
- const d = {
386
- keyframes: [],
387
- components: [],
388
- classNames: []
389
- };
390
- await Promise.all(
391
- [...c].map(async (l) => {
392
- const h = await Y(t, l, i);
393
- Object.entries(h).forEach(([$, u]) => {
394
- u.isKeyframes ? d.keyframes.push({
395
- value: u,
396
- src: l,
397
- name: $
398
- }) : u.isClassName ? d.classNames.push({
399
- ...u,
400
- src: l,
401
- name: $
402
- }) : u.generator && d.components.push({
403
- ...u,
404
- src: l,
405
- name: $
406
- });
407
- });
408
- })
409
- );
410
- const b = await at(t);
411
- for (const l of d.keyframes) {
412
- const { value: h } = l, $ = `a_${h.animationName}.css`, u = `css/${$}`, x = f(i, u);
413
- o.push($), k(x, h.css);
414
- }
415
- const y = {};
416
- for (const l of d.components) {
417
- const { src: h, name: $ } = l, u = l.generator._withBuildContext({
418
- callerName: $,
419
- isProduction: e,
420
- config: b
421
- });
422
- a[u.priority] || (a[u.priority] = []), a[u.priority].push(u.cssFileName);
423
- const x = `css/${u.cssFileName}`, P = f(i, x);
424
- k(P, u.css), b.importStrategy === "component" && (y[h] ? y[h].push(u.cssFileName) : y[h] = [u.cssFileName]);
425
- }
426
- for (const l of d.classNames) {
427
- const { src: h, name: $ } = l, u = l.generator._withBuildContext({
428
- callerName: $,
429
- isProduction: e,
430
- config: b
431
- });
432
- a[0].push(u.cssFileName);
433
- const x = `css/${u.cssFileName}`, P = f(i, x);
434
- k(P, u.css), b.importStrategy === "component" && (y[h] ? y[h].push(u.cssFileName) : y[h] = [u.cssFileName]);
435
- }
436
- b.importStrategy === "component" && Object.entries(y).forEach(([l, h]) => {
437
- const $ = h.map((K) => `@import url('./${K}');`).join(`
438
- `), u = B(l, 6), x = X(l), P = V(x.name), G = f(i, `css/f_${P}-${u}.css`);
439
- k(G, $);
440
- });
441
- const _ = o.map((l) => `@import url('./css/${l}');`).join(`
442
- `);
443
- let F = `@layer reset, global, l0, l1, l2, l3, l4, l5, l6, l7, l8;
444
-
445
- ${["_variables.css", "_reset.css", "_global.css", "_templates.css"].filter((l) => {
446
- try {
447
- return O(f(i, "css", l), "utf8").length > 0;
448
- } catch {
449
- return !1;
450
- }
451
- }).map((l) => `@import url('./css/${l}');`).join(`
452
- `)}
453
- ${_}`;
454
- if (b.importStrategy !== "component") {
455
- const l = a.reduce((h, $, u) => {
456
- const x = $.reduce((A, Q) => {
457
- var U;
458
- const q = f(i, "css", Q), lt = O(q, "utf8"), L = ((U = /.*-([^-]+)-\d+.css/.exec(Q)) == null ? void 0 : U.at(1)) || B(q, 6);
459
- return A.includes(L) ? A : `${A}
460
- /*start:${L}*/
461
- ${lt}
462
- /*end:${L}*/
463
- `;
464
- }, ""), P = `l_${u}.css`, G = f(i, "css", P), K = `@layer l${u} { ${x}
465
- }`;
466
- return k(G, K), `${h}
467
- @import url('./css/${P}');`;
468
- }, "");
469
- F += l;
470
- }
471
- k(p, F);
472
- const N = Date.now() - n, M = N < 200 ? "🔥" : N < 500 ? "🚀" : N < 1e3 ? "🎉" : N < 2e3 ? "🚗" : N < 5e3 ? "🤔" : "🥴";
473
- ot.info(`Generated CSS in ${N}ms! ${M}`);
474
- } catch (n) {
475
- console.error(n);
476
- }
477
- }, ee = async (t, e) => {
478
- try {
479
- const s = await z(t);
480
- if (it(e)) {
481
- const o = [], a = await at(t), i = await Y(t, e, s);
482
- if (Object.entries(i).forEach(([p, r]) => {
483
- if (r.isKeyframes && r.css) {
484
- const b = `css/${`a_${r.animationName}.css`}`, y = f(s, b);
485
- k(y, r.css);
486
- return;
487
- }
488
- if (r.isClassName) {
489
- const d = r.factory._withBuildContext({
490
- name: p
491
- });
492
- o[0].push(d.cssFileName);
493
- const b = `css/${d.cssFileName}`, y = f(s, b);
494
- k(y, d.css);
495
- }
496
- if (!r.generator) return;
497
- const c = r.generator._withBuildContext({
498
- name: p,
499
- config: a
500
- }), g = `css/${c.cssFileName}`, m = f(s, g);
501
- k(m, c.css), o[c.priority] || (o[c.priority] = []), o[c.priority].push(c.cssFileName);
502
- }), a.importStrategy !== "component")
503
- o.forEach((p, r) => {
504
- const c = `l_${r}.css`, g = f(s, "css", c);
505
- let m = O(g, "utf8");
506
- p.forEach((d) => {
507
- var w;
508
- const b = f(s, "css", d), y = ((w = /.*-([^-]+)-\d+.css/.exec(d)) == null ? void 0 : w.at(1)) || B(b, 6);
509
- if (!m.includes(y)) {
510
- const D = O(b, "utf8"), E = `/*start:${y}*/
511
- ${D}
512
- /*end:${y}*/
513
- `;
514
- m = `${m.replace(/\}$/, "")}
515
- ${E}
516
- }`;
517
- }
518
- }), k(g, m);
519
- });
520
- else {
521
- const p = o.flat().map((d) => `@import url('./${d}');`).join(`
522
- `), r = B(e, 6), c = X(e), g = V(c.name), m = f(s, `css/f_${g}-${r}.css`);
523
- k(m, p);
524
- }
525
- }
526
- } catch (s) {
527
- console.error(s);
528
- }
529
- }, se = async (t, e, s = xt()) => {
530
- try {
531
- const n = await z(t);
532
- if (it(e)) {
533
- const a = O(e, "utf8");
534
- a.replace(/^(?!export\s)const\s.*/gm, (g) => `export ${g}`) !== a && await Et(e, a);
535
- const p = await at(t), r = await Y(t, e, n);
536
- let c = a;
537
- if (Object.entries(r).forEach(([g, m]) => {
538
- var u;
539
- if (m.isKeyframes || !m.generator) return;
540
- const d = m.generator._withBuildContext({
541
- name: g,
542
- config: p,
543
- prod: s
544
- }), b = new RegExp(`\\s${g}[=\\s]+[^()]+styled\\(([^,]+),`, "g").exec(a);
545
- if (!b) return console.error("Could not find the original declaration");
546
- const y = (u = b.at(1)) == null ? void 0 : u.trim(), _ = new RegExp(`\\s${g}[=\\s]+styled\\(`, "g").exec(c);
547
- if (!_) return console.error("Could not find the original declaration");
548
- const { index: w } = _;
549
- let D = !1;
550
- const E = setTimeout(() => D = !0, 5e3);
551
- let F = 0, T = !1, N = 0;
552
- for (; !T && !D; ) {
553
- const x = c[w + F];
554
- x === "(" && N++, x === ")" && N--, N === 0 && x === ")" && (T = !0), F > c.length && (D = !0), F++;
555
- }
556
- if (!D) clearTimeout(E);
557
- else throw new Error("Failed to find the end of the styled call and timed out");
558
- const M = w + F, l = c.slice(w, M), h = c, $ = ` ${g} = styled(${y}, "${d.classNames}", ${JSON.stringify(d.clientProps)});`;
559
- c = c.replace(l, $), h === c && console.error("Minimize file failed to change content", { name: g, tagName: y });
560
- }), p.importStrategy === "component") {
561
- const g = B(e, 6), m = X(e);
562
- c = `import '../../saltygen/css/${`f_${V(m.name)}-${g}.css`}';
563
- ${c}`;
564
- }
565
- return c = c.replace("{ styled }", "{ styledClient as styled }"), c = c.replace("@salty-css/react/styled", "@salty-css/react/styled-client"), c;
566
- }
567
- } catch (n) {
568
- console.error("Error in minimizeFile:", n);
569
- }
570
- };
571
- export {
572
- ee as a,
573
- te as g,
574
- it as i,
575
- se as m,
576
- Bt as s
577
- };
@@ -1,44 +0,0 @@
1
- "use strict";const xe=require("esbuild"),Ne=require("child_process"),l=require("path"),u=require("fs"),oe=require("fs/promises"),B=require("winston");var se=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 de=Pe(xe),fe=e=>String.fromCharCode(e+(e>25?39:97)),ke=(e,t)=>{let s="",n;for(n=Math.abs(e);n>52;n=n/52|0)s=fe(n%52)+s;return s=fe(n%52)+s,s.length<t?s=s.padStart(t,"a"):s.length>t&&(s=s.slice(-t)),s},De=(e,t)=>{let s=t.length;for(;s;)e=e*33^t.charCodeAt(--s);return e},Z=(e,t=5)=>{const s=De(5381,JSON.stringify(e))>>>0;return ke(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 _e=(e,t)=>{if(typeof e!="string")return{result:e};if(!t)return{result:e};const s=[];return Object.values(t).forEach(n=>{const{pattern:o,transform:a}=n;e=e.replace(o,i=>{const{value:p,css:r}=a(i);return r&&s.push(r),p})}),{result:e,additionalCss:s}},pe=e=>typeof e!="string"?{result:e}:/\{[^{}]+\}/g.test(e)?{result:e.replace(/\{([^{}]+)\}/g,(...n)=>`var(--${E(n[1].replaceAll(".","-"))})`)}:{result:e},Oe=["top","right","bottom","left","min-width",/.*width.*/,/^[^line]*height.*/,/padding.*/,/margin.*/,/border.*/,/inset.*/,/.*radius.*/,/.*spacing.*/,/.*gap.*/,/.*indent.*/,/.*offset.*/,/.*size.*/,/.*thickness.*/,/.*font-size.*/],Te=(e,t,s)=>Oe.some(o=>typeof o=="string"?o===e:o.test(e))?`${t}px`:`${t}`,Ee=["Webkit","Moz","ms","O"],Ve=e=>e.startsWith("-")?e:Ee.some(t=>e.startsWith(t))?`-${E(e)}`:E(e),z=(e,t,s)=>{if(!e)return"";const n=[],o=Object.entries(e).reduce((i,[p,r])=>{const c=p.trim(),y=Ve(c),m=(j,D=";")=>i=`${i}${j}${D}`,g=j=>m(`${y}:${j}`);if(typeof r=="function"&&(r=r()),typeof r=="object"){if(!r)return i;if(r.isColor)return g(r.toString()),i;if(c==="variants")return Object.entries(r).forEach(([_,x])=>{x&&Object.entries(x).forEach(([T,P])=>{if(!P)return;const V=`${t}.${_}-${T}`,f=z(P,V);n.push(f)})}),i;if(c==="defaultVariants")return i;if(c==="compoundVariants")return r.forEach(_=>{const{css:x,...T}=_,P=Object.entries(T).reduce((f,[h,$])=>`${f}.${h}-${$}`,t),V=z(x,P);n.push(V)}),i;if(c.startsWith("@")){const _=c,x=z(r,t),T=`${_} {
2
- ${x.replace(`
3
- `,`
4
- `)}
5
- }`;return n.push(T),i}const j=p.includes("&")?c.replace("&",t):c.startsWith(":")?`${t}${c}`:`${t} ${c}`,D=z(r,j);return n.push(D),i}if(typeof r=="number"){const j=Te(y,r);return g(j)}if(typeof r!="string")if("toString"in r)r=r.toString();else return i;const{modifiers:b}={},O=function*(){yield pe(r),yield _e(r,b)}();for(const{result:j,additionalCss:D=[]}of O)r=j,D.forEach(_=>{const x=z(_,"");m(x,"")});return g(r)},"");return o?t?[`${t} { ${o} }`,...n].join(`
6
- `):o:n.join(`
7
- `)},ge=(e,t=[])=>{if(!e)return"";const s=[],n={};if(Object.entries(e).forEach(([o,a])=>{if(typeof a=="object"){if(!a)return;const i=o.trim(),p=ge(a,[...t,i]);s.push(p)}else n[o]=a}),Object.keys(n).length){const o=t.map(E).join("-"),a=z(n,`.${o}`);s.push(a)}return s.join(`
8
- `)},Me=e=>e?Object.entries(e).reduce((t,[s,n])=>(typeof n=="object"&&(t[s]=ye(n).map(o=>`"${o}"`).join(" | ")),t),{}):{},ye=(e,t="",s=new Set)=>e?(Object.entries(e).forEach(([n,o])=>{const a=t?`${t}.${n}`:n;return typeof o=="object"?ye(o,a,s):s.add(t)}),[...s]):[],me=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:me(l.join(e,".."))},Re=async e=>{const t=me(e);return await oe.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},ze=async e=>{const t=await Re(e);if(t)return t.type};let A;const he=async e=>{if(A)return A;const t=await ze(e);return t==="module"?A="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:se&&se.tagName.toUpperCase()==="SCRIPT"&&se.src||new URL("index-Dq_u-jmb.cjs",document.baseURI).href).endsWith(".cjs"))&&(A="cjs"),A||"esm"},ne=B.createLogger({level:"debug",format:B.format.combine(B.format.colorize(),B.format.cli()),transports:[new B.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 Je={"*, *::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"}},I=(...e)=>e.flat().reduce((t,s)=>s!=null&&s._current?{...t,...s._current}:{...t,...s},{}),R={externalModules:[],rcFile:void 0,destDir:void 0},$e=e=>{if(R.externalModules.length>0)return R.externalModules;const s=u.readFileSync(e,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!s)return[];const n=s[1].split(",").map(o=>o.replace(/['"`]/g,"").trim());return R.externalModules=n,n},J=async e=>{if(R.destDir)return R.destDir;const t=await re(e),s=l.join(e,(t==null?void 0:t.saltygenDir)||"saltygen");return R.destDir=s,s},be=["salty","css","styles","styled"],je=(e=[])=>new RegExp(`\\.(${[...be,...e].join("|")})\\.`),U=(e,t=[])=>je(t).test(e),we=async e=>{if(R.rcFile)return R.rcFile;if(e==="/")throw new Error("Could not find .saltyrc.json file");const t=l.join(e,".saltyrc.json"),s=await oe.readFile(t,"utf-8").then(JSON.parse).catch(()=>{});return s?(R.rcFile=s,s):we(l.join(e,".."))},re=async e=>{var n,o;const t=await we(e),s=(n=t.projects)==null?void 0:n.find(a=>e.endsWith(a.dir||""));return s||((o=t.projects)==null?void 0:o.find(a=>a.dir===t.defaultProject))},We=async e=>{const t=await re(e),s=await J(e),n=l.join(e,(t==null?void 0:t.configDir)||"","salty.config.ts"),o=l.join(s,"salty.config.js"),a=await he(e),i=$e(n);await de.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:o,format:a,external:i});const p=Date.now(),{config:r}=await import(`${o}?t=${p}`);return r},Ae=async(e,t)=>{var ae,le;const s=await J(e),n={mediaQueries:[],globalStyles:[],variables:[],templates:[]};await Promise.all([...t].map(async w=>{const F=await X(e,w,s);Object.entries(F).forEach(([M,C])=>{C.isMedia?n.mediaQueries.push([M,C]):C.isGlobalDefine?n.globalStyles.push(C):C.isDefineVariables?n.variables.push(C):C.isDefineTemplates&&n.templates.push(C)})}));const o=await We(e),a={...o},i=new Set,p=(w,F=[])=>w?Object.entries(w).flatMap(([M,C])=>{if(!C)return;if(typeof C=="object")return p(C,[...F,M]);const Y=Se(M),v=E(M),ee=[...F,Y].join(".");i.add(`"${ee}"`);const te=[...F.map(E),v].join("-"),{result:Ce}=pe(C);return`--${te}: ${Ce};`}):[],r=w=>w?Object.entries(w).flatMap(([F,M])=>{const C=p(M);return F==="base"?C.join(""):`${F} { ${C.join("")} }`}):[],c=w=>w?Object.entries(w).flatMap(([F,M])=>Object.entries(M).flatMap(([C,Y])=>{const v=p(Y,[F]),ee=`.${F}-${C}, [data-${F}="${C}"]`,te=v.join("");return`${ee} { ${te} }`})):[],y=w=>({...w,responsive:void 0,conditional:void 0}),m=w=>n.variables.map(F=>w==="static"?y(F._current):F._current[w]),g=I(y(o.variables),m("static")),b=p(g),S=I((ae=o.variables)==null?void 0:ae.responsive,m("responsive")),O=r(S),j=I((le=o.variables)==null?void 0:le.conditional,m("conditional")),D=c(j),_=l.join(s,"css/_variables.css"),x=`:root { ${b.join("")} ${O.join("")} } ${D.join("")}`;u.writeFileSync(_,x),a.staticVariables=g;const T=l.join(s,"css/_global.css"),P=I(o.global,n.globalStyles),V=z(P,"");u.writeFileSync(T,`@layer global { ${V} }`);const f=l.join(s,"css/_reset.css"),$=o.reset==="none"?{}:typeof o.reset=="object"?o.reset:Je,d=z($,"");u.writeFileSync(f,`@layer reset { ${d} }`);const N=l.join(s,"css/_templates.css"),k=I(o.templates,n.templates),q=ge(k),H=Me(k);u.writeFileSync(N,q),a.templates=k;const{mediaQueries:W}=n;a.mediaQueries=Object.fromEntries(W.map(([w,F])=>[`@${w}`,F]));const G=W.map(([w])=>`'@${w}'`).join(" | "),K=l.join(s,"types/css-tokens.d.ts"),L=`
9
- // Variable types
10
- type VariableTokens = ${[...i].join("|")};
11
- type PropertyValueToken = \`{\${VariableTokens}}\`;
12
-
13
- // Template types
14
- type TemplateTokens = {
15
- ${Object.entries(H).map(([w,F])=>`${w}?: ${F}`).join(`
16
- `)}
17
- }
18
-
19
- // Media query types
20
- type MediaQueryKeys = ${G||"''"};
21
- `;u.writeFileSync(K,L);const Q=l.join(s,"cache/config-cache.json");u.writeFileSync(Q,JSON.stringify(a,null,2))},ue=e=>e.replace(/styled\(([^"'`{,]+),/g,(t,s)=>{if(/^['"`]/.test(s))return t;const o=new RegExp(`import[^;]*${s}[,\\s{][^;]*from\\s?([^{};]+);`);if(!o.test(e))return t;const i=o.exec(e);if(i){const p=i.at(1);if(be.some(c=>p==null?void 0:p.includes(c)))return t}return"styled('div',"}),Ie=(e,t)=>{try{const s=u.readFileSync(l.join(t,"saltygen/cache/config-cache.json"),"utf8");return s?`globalThis.saltyConfig = ${s};
22
-
23
- ${e}`:`globalThis.saltyConfig = {};
24
-
25
- ${e}`}catch{return e}},X=async(e,t,s)=>{const n=Z(t),o=l.join(s,"./temp");u.existsSync(o)||u.mkdirSync(o);const a=l.parse(t);let i=u.readFileSync(t,"utf8");i=ue(i),i=Ie(i,e);const p=l.join(s,"js",n+".js"),r=await re(e),c=l.join(e,(r==null?void 0:r.configDir)||"","salty.config.ts"),y=$e(c),m=await he(e);await de.build({stdin:{contents:i,sourcefile:a.base,resolveDir:a.dir,loader:"tsx"},minify:!1,treeShaking:!0,bundle:!0,outfile:p,format:m,target:["node20"],keepNames:!0,external:y,packages:"external",plugins:[{name:"test",setup:S=>{S.onLoad({filter:/.*\.css|salty|styles|styled\.ts/},O=>{const j=u.readFileSync(O.path,"utf8");return{contents:ue(j),loader:"ts"}})}}]});const g=Date.now();return await import(`${p}?t=${g}`)},Ze=async e=>{const t=await J(e),s=l.join(t,"cache/config-cache.json"),n=u.readFileSync(s,"utf8");if(!n)throw new Error("Could not find config cache file");return JSON.parse(n)},ie=async e=>{const t=await Ze(e),s=await J(e),n=l.join(s,"salty.config.js"),o=Date.now(),{config:a}=await import(`${n}?t=${o}`);return I(a,t)},Fe=()=>{try{return process.env.NODE_ENV==="production"}catch{return!1}},qe=async(e,t=Fe(),s=!0)=>{try{const n=Date.now();t?ne.info("Generating CSS in production mode! 🔥"):ne.info("Generating CSS in development mode! 🚀");const o=[],a=[],i=await J(e),p=l.join(i,"index.css");s&&(()=>{u.existsSync(i)&&Ne.execSync("rm -rf "+i),u.mkdirSync(i,{recursive:!0}),u.mkdirSync(l.join(i,"css")),u.mkdirSync(l.join(i,"types")),u.mkdirSync(l.join(i,"js")),u.mkdirSync(l.join(i,"cache"))})();const c=new Set,y=new Set;async function m(f){const h=["node_modules","saltygen"],$=u.statSync(f);if($.isDirectory()){const d=u.readdirSync(f);if(h.some(k=>f.includes(k)))return;await Promise.all(d.map(k=>m(l.join(f,k))))}else if($.isFile()&&U(f)){c.add(f);const N=u.readFileSync(f,"utf8");/define[\w\d]+\(/.test(N)&&y.add(f)}}await m(e),await Ae(e,y);const g={keyframes:[],components:[],classNames:[]};await Promise.all([...c].map(async f=>{const h=await X(e,f,i);Object.entries(h).forEach(([$,d])=>{d.isKeyframes?g.keyframes.push({value:d,src:f,name:$}):d.isClassName?g.classNames.push({...d,src:f,name:$}):d.generator&&g.components.push({...d,src:f,name:$})})}));const b=await ie(e);for(const f of g.keyframes){const{value:h}=f,$=`a_${h.animationName}.css`,d=`css/${$}`,N=l.join(i,d);o.push($),u.writeFileSync(N,h.css)}const S={};for(const f of g.components){const{src:h,name:$}=f,d=f.generator._withBuildContext({callerName:$,isProduction:t,config:b});a[d.priority]||(a[d.priority]=[]),a[d.priority].push(d.cssFileName);const N=`css/${d.cssFileName}`,k=l.join(i,N);u.writeFileSync(k,d.css),b.importStrategy==="component"&&(S[h]?S[h].push(d.cssFileName):S[h]=[d.cssFileName])}for(const f of g.classNames){const{src:h,name:$}=f,d=f.generator._withBuildContext({callerName:$,isProduction:t,config:b});a[0].push(d.cssFileName);const N=`css/${d.cssFileName}`,k=l.join(i,N);u.writeFileSync(k,d.css),b.importStrategy==="component"&&(S[h]?S[h].push(d.cssFileName):S[h]=[d.cssFileName])}b.importStrategy==="component"&&Object.entries(S).forEach(([f,h])=>{const $=h.map(H=>`@import url('./${H}');`).join(`
26
- `),d=Z(f,6),N=l.parse(f),k=E(N.name),q=l.join(i,`css/f_${k}-${d}.css`);u.writeFileSync(q,$)});const O=o.map(f=>`@import url('./css/${f}');`).join(`
27
- `);let x=`@layer reset, global, l0, l1, l2, l3, l4, l5, l6, l7, l8;
28
-
29
- ${["_variables.css","_reset.css","_global.css","_templates.css"].filter(f=>{try{return u.readFileSync(l.join(i,"css",f),"utf8").length>0}catch{return!1}}).map(f=>`@import url('./css/${f}');`).join(`
30
- `)}
31
- ${O}`;if(b.importStrategy!=="component"){const f=a.reduce((h,$,d)=>{const N=$.reduce((W,G)=>{var Q;const K=l.join(i,"css",G),ce=u.readFileSync(K,"utf8"),L=((Q=/.*-([^-]+)-\d+.css/.exec(G))==null?void 0:Q.at(1))||Z(K,6);return W.includes(L)?W:`${W}
32
- /*start:${L}*/
33
- ${ce}
34
- /*end:${L}*/
35
- `},""),k=`l_${d}.css`,q=l.join(i,"css",k),H=`@layer l${d} { ${N}
36
- }`;return u.writeFileSync(q,H),`${h}
37
- @import url('./css/${k}');`},"");x+=f}u.writeFileSync(p,x);const P=Date.now()-n,V=P<200?"🔥":P<500?"🚀":P<1e3?"🎉":P<2e3?"🚗":P<5e3?"🤔":"🥴";ne.info(`Generated CSS in ${P}ms! ${V}`)}catch(n){console.error(n)}},He=async(e,t)=>{try{const s=await J(e);if(U(t)){const o=[],a=await ie(e),i=await X(e,t,s);if(Object.entries(i).forEach(([p,r])=>{if(r.isKeyframes&&r.css){const b=`css/${`a_${r.animationName}.css`}`,S=l.join(s,b);u.writeFileSync(S,r.css);return}if(r.isClassName){const g=r.factory._withBuildContext({name:p});o[0].push(g.cssFileName);const b=`css/${g.cssFileName}`,S=l.join(s,b);u.writeFileSync(S,g.css)}if(!r.generator)return;const c=r.generator._withBuildContext({name:p,config:a}),y=`css/${c.cssFileName}`,m=l.join(s,y);u.writeFileSync(m,c.css),o[c.priority]||(o[c.priority]=[]),o[c.priority].push(c.cssFileName)}),a.importStrategy!=="component")o.forEach((p,r)=>{const c=`l_${r}.css`,y=l.join(s,"css",c);let m=u.readFileSync(y,"utf8");p.forEach(g=>{var j;const b=l.join(s,"css",g),S=((j=/.*-([^-]+)-\d+.css/.exec(g))==null?void 0:j.at(1))||Z(b,6);if(!m.includes(S)){const D=u.readFileSync(b,"utf8"),_=`/*start:${S}*/
38
- ${D}
39
- /*end:${S}*/
40
- `;m=`${m.replace(/\}$/,"")}
41
- ${_}
42
- }`}}),u.writeFileSync(y,m)});else{const p=o.flat().map(g=>`@import url('./${g}');`).join(`
43
- `),r=Z(t,6),c=l.parse(t),y=E(c.name),m=l.join(s,`css/f_${y}-${r}.css`);u.writeFileSync(m,p)}}}catch(s){console.error(s)}},Le=async(e,t,s=Fe())=>{try{const n=await J(e);if(U(t)){const a=u.readFileSync(t,"utf8");a.replace(/^(?!export\s)const\s.*/gm,y=>`export ${y}`)!==a&&await oe.writeFile(t,a);const p=await ie(e),r=await X(e,t,n);let c=a;if(Object.entries(r).forEach(([y,m])=>{var d;if(m.isKeyframes||!m.generator)return;const g=m.generator._withBuildContext({name:y,config:p,prod:s}),b=new RegExp(`\\s${y}[=\\s]+[^()]+styled\\(([^,]+),`,"g").exec(a);if(!b)return console.error("Could not find the original declaration");const S=(d=b.at(1))==null?void 0:d.trim(),O=new RegExp(`\\s${y}[=\\s]+styled\\(`,"g").exec(c);if(!O)return console.error("Could not find the original declaration");const{index:j}=O;let D=!1;const _=setTimeout(()=>D=!0,5e3);let x=0,T=!1,P=0;for(;!T&&!D;){const N=c[j+x];N==="("&&P++,N===")"&&P--,P===0&&N===")"&&(T=!0),x>c.length&&(D=!0),x++}if(!D)clearTimeout(_);else throw new Error("Failed to find the end of the styled call and timed out");const V=j+x,f=c.slice(j,V),h=c,$=` ${y} = styled(${S}, "${g.classNames}", ${JSON.stringify(g.clientProps)});`;c=c.replace(f,$),h===c&&console.error("Minimize file failed to change content",{name:y,tagName:S})}),p.importStrategy==="component"){const y=Z(t,6),m=l.parse(t);c=`import '../../saltygen/css/${`f_${E(m.name)}-${y}.css`}';
44
- ${c}`}return c=c.replace("{ styled }","{ styledClient as styled }"),c=c.replace("@salty-css/react/styled","@salty-css/react/styled-client"),c}}catch(n){console.error("Error in minimizeFile:",n)}};exports.generateCss=qe;exports.generateFile=He;exports.isSaltyFile=U;exports.minimizeFile=Le;exports.saltyFileRegExp=je;