@salty-css/webpack 0.0.1-alpha.208 → 0.0.1-alpha.209

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.
@@ -1,7 +1,7 @@
1
1
  import * as yt from "esbuild";
2
2
  import { execSync as Dt } from "child_process";
3
3
  import { join as u, parse as tt } from "path";
4
- import { existsSync as at, writeFileSync as D, readFileSync as M, mkdirSync as H, statSync as _t, readdirSync as Et } from "fs";
4
+ import { existsSync as at, writeFileSync as D, readFileSync as M, mkdirSync as H, statSync as Et, readdirSync as _t } from "fs";
5
5
  import { readFile as $t, writeFile as Tt } from "fs/promises";
6
6
  import { createLogger as Ot, format as rt, transports as Vt } from "winston";
7
7
  const gt = (t) => String.fromCharCode(t + (t > 25 ? 39 : 97)), Mt = (t, e) => {
@@ -26,8 +26,8 @@ const At = (t) => (e) => {
26
26
  return Object.values(t).forEach((o) => {
27
27
  const { pattern: r, transform: a } = o;
28
28
  s = s.replace(r, (g) => {
29
- const { value: j, css: f } = a(g);
30
- return f && n.push(f), j;
29
+ const { value: j, css: l } = a(g);
30
+ return l && n.push(l), j;
31
31
  });
32
32
  }), { transformed: s, additionalCss: n };
33
33
  }, bt = (t) => (e) => typeof e != "string" || !/\{[^{}]+\}/g.test(e) ? void 0 : { transformed: e.replace(/\{([^{}]+)\}/g, (...o) => `var(--${A(o[1].replaceAll(".", "-"))})`) }, Jt = bt(), Wt = [
@@ -54,33 +54,33 @@ const At = (t) => (e) => {
54
54
  ], zt = (t, e, s) => Wt.some((o) => typeof o == "string" ? o === t : o.test(t)) ? `${e}px` : `${e}`, vt = ["Webkit", "Moz", "ms", "O"], Zt = (t) => t.startsWith("-") ? t : vt.some((e) => t.startsWith(e)) ? `-${A(t)}` : A(t), Y = async (t, e = "", s, n = !1) => {
55
55
  if (!t) throw new Error("No styles provided to parseStyles function!");
56
56
  const o = /* @__PURE__ */ new Set(), a = Object.entries(t).map(async ([m, i]) => {
57
- const p = m.trim(), P = Zt(p), F = (k, O = ";") => `${P}:${k}${O}`;
57
+ const p = m.trim(), N = Zt(p), F = (k, O = ";") => `${N}:${k}${O}`;
58
58
  if (typeof i == "function" && (i = i({ scope: e, config: s })), i instanceof Promise && (i = await i), typeof i == "object") {
59
59
  if (!i) return;
60
60
  if (i.isColor) return F(i.toString());
61
61
  if (p === "defaultVariants") return;
62
62
  if (p === "variants") {
63
63
  const C = Object.entries(i);
64
- for (const [_, c] of C) {
64
+ for (const [E, c] of C) {
65
65
  if (!c) return;
66
66
  const h = Object.entries(c);
67
- for (const [b, l] of h) {
68
- if (!l) return;
69
- const w = `${e}.${_}-${b}`;
70
- (await Y(l, w, s)).forEach((V) => o.add(V));
67
+ for (const [b, f] of h) {
68
+ if (!f) return;
69
+ const w = `${e}.${E}-${b}`;
70
+ (await Y(f, w, s)).forEach((V) => o.add(V));
71
71
  }
72
72
  }
73
73
  return;
74
74
  }
75
75
  if (p === "compoundVariants") {
76
76
  for (const C of i) {
77
- const { css: _, ...c } = C, h = Object.entries(c).reduce((l, [w, x]) => `${l}.${w}-${x}`, e);
78
- (await Y(_, h, s)).forEach((l) => o.add(l));
77
+ const { css: E, ...c } = C, h = Object.entries(c).reduce((f, [w, P]) => `${f}.${w}-${P}`, e);
78
+ (await Y(E, h, s)).forEach((f) => o.add(f));
79
79
  }
80
80
  return;
81
81
  }
82
82
  if (p.startsWith("@")) {
83
- const C = p, _ = await L(i, e, s), c = `${C} { ${_} }`;
83
+ const C = p, E = await L(i, e, s), c = `${C} { ${E} }`;
84
84
  o.add(c);
85
85
  return;
86
86
  }
@@ -89,24 +89,24 @@ const At = (t) => (e) => {
89
89
  return;
90
90
  }
91
91
  if (typeof i == "number") {
92
- const k = zt(P, i);
92
+ const k = zt(N, i);
93
93
  return F(k);
94
94
  }
95
95
  if (typeof i != "string")
96
96
  if ("toString" in i) i = i.toString();
97
- else throw new Error(`Invalid value type for property ${P}`);
97
+ else throw new Error(`Invalid value type for property ${N}`);
98
98
  return F(i);
99
99
  }), { modifiers: g } = {}, j = [bt(), At(g)], d = (await Promise.all(a).then((m) => Promise.all(
100
- m.map((i) => j.reduce(async (p, P) => {
100
+ m.map((i) => j.reduce(async (p, N) => {
101
101
  const F = await p;
102
102
  if (!F) return F;
103
- const R = await P(F);
103
+ const R = await N(F);
104
104
  if (!R) return F;
105
105
  const { transformed: k, additionalCss: O } = R;
106
106
  let C = "";
107
107
  if (O)
108
- for (const _ of O)
109
- C += await L(_, "");
108
+ for (const E of O)
109
+ C += await L(E, "");
110
110
  return `${C}${k}`;
111
111
  }, Promise.resolve(i)))
112
112
  ))).filter((m) => m !== void 0).join(`
@@ -211,7 +211,7 @@ const Gt = {
211
211
  externalModules: [],
212
212
  rcFile: void 0,
213
213
  destDir: void 0
214
- }, Nt = (t) => {
214
+ }, xt = (t) => {
215
215
  if (W.externalModules.length > 0) return W.externalModules;
216
216
  const s = M(t, "utf8").match(/externalModules:\s?\[(.*)\]/);
217
217
  if (!s) return [];
@@ -221,18 +221,18 @@ const Gt = {
221
221
  if (W.destDir) return W.destDir;
222
222
  const e = await lt(t), s = u(t, (e == null ? void 0 : e.saltygenDir) || "saltygen");
223
223
  return W.destDir = s, s;
224
- }, xt = ["salty", "css", "styles", "styled"], Lt = (t = []) => new RegExp(`\\.(${[...xt, ...t].join("|")})\\.`), ct = (t, e = []) => Lt(e).test(t), Pt = async (t) => {
224
+ }, Pt = ["salty", "css", "styles", "styled"], Lt = (t = []) => new RegExp(`\\.(${[...Pt, ...t].join("|")})\\.`), ct = (t, e = []) => Lt(e).test(t), Nt = async (t) => {
225
225
  if (W.rcFile) return W.rcFile;
226
226
  if (t === "/") throw new Error("Could not find .saltyrc.json file");
227
227
  const e = u(t, ".saltyrc.json"), s = await $t(e, "utf-8").then(JSON.parse).catch(() => {
228
228
  });
229
- return s ? (W.rcFile = s, s) : Pt(u(t, ".."));
229
+ return s ? (W.rcFile = s, s) : Nt(u(t, ".."));
230
230
  }, lt = async (t) => {
231
231
  var n, o;
232
- const e = await Pt(t), s = (n = e.projects) == null ? void 0 : n.find((r) => t.endsWith(r.dir || ""));
232
+ const e = await Nt(t), s = (n = e.projects) == null ? void 0 : n.find((r) => t.endsWith(r.dir || ""));
233
233
  return s || ((o = e.projects) == null ? void 0 : o.find((r) => r.dir === e.defaultProject));
234
234
  }, Qt = async (t) => {
235
- const e = await lt(t), s = await v(t), n = u(t, (e == null ? void 0 : e.configDir) || "", "salty.config.ts"), o = u(s, "salty.config.js"), r = await jt(t), a = Nt(n);
235
+ const e = await lt(t), s = await v(t), n = u(t, (e == null ? void 0 : e.configDir) || "", "salty.config.ts"), o = u(s, "salty.config.js"), r = await jt(t), a = xt(n);
236
236
  await yt.build({
237
237
  entryPoints: [n],
238
238
  minify: !0,
@@ -254,37 +254,37 @@ const Gt = {
254
254
  };
255
255
  await Promise.all(
256
256
  [...e].map(async (S) => {
257
- const { contents: N, outputFilePath: J } = await et(t, S, s);
258
- Object.entries(N).forEach(([E, T]) => {
259
- T.isMedia ? n.mediaQueries.push([E, T]) : T.isGlobalDefine ? n.globalStyles.push(T) : T.isDefineVariables ? n.variables.push(T) : T.isDefineTemplates && n.templates.push(T._setPath(J));
257
+ const { contents: x, outputFilePath: J } = await et(t, S, s);
258
+ Object.entries(x).forEach(([_, T]) => {
259
+ T.isMedia ? n.mediaQueries.push([_, T]) : T.isGlobalDefine ? n.globalStyles.push(T) : T.isDefineVariables ? n.variables.push(T) : T.isDefineTemplates && n.templates.push(T._setPath(J));
260
260
  });
261
261
  })
262
262
  );
263
- const o = await Qt(t), r = { ...o }, a = /* @__PURE__ */ new Set(), g = (S, N = []) => S ? Object.entries(S).flatMap(([J, E]) => {
264
- if (!E) return;
265
- if (typeof E == "object") return g(E, [...N, J]);
266
- const T = Ft(J), nt = A(J), ot = [...N, T].join(".");
263
+ const o = await Qt(t), r = { ...o }, a = /* @__PURE__ */ new Set(), g = (S, x = []) => S ? Object.entries(S).flatMap(([J, _]) => {
264
+ if (!_) return;
265
+ if (typeof _ == "object") return g(_, [...x, J]);
266
+ const T = Ft(J), nt = A(J), ot = [...x, T].join(".");
267
267
  a.add(`"${ot}"`);
268
- const X = [...N.map(A), nt].join("-"), mt = Jt(E);
269
- return mt ? `--${X}: ${mt.transformed};` : `--${X}: ${E};`;
270
- }) : [], j = (S) => S ? Object.entries(S).flatMap(([N, J]) => {
271
- const E = g(J);
272
- return N === "base" ? E.join("") : `${N} { ${E.join("")} }`;
273
- }) : [], f = (S) => S ? Object.entries(S).flatMap(([N, J]) => Object.entries(J).flatMap(([E, T]) => {
274
- const nt = g(T, [N]), ot = `.${N}-${E}, [data-${N}="${E}"]`, X = nt.join("");
268
+ const X = [...x.map(A), nt].join("-"), mt = Jt(_);
269
+ return mt ? `--${X}: ${mt.transformed};` : `--${X}: ${_};`;
270
+ }) : [], j = (S) => S ? Object.entries(S).flatMap(([x, J]) => {
271
+ const _ = g(J);
272
+ return x === "base" ? _.join("") : `${x} { ${_.join("")} }`;
273
+ }) : [], l = (S) => S ? Object.entries(S).flatMap(([x, J]) => Object.entries(J).flatMap(([_, T]) => {
274
+ const nt = g(T, [x]), ot = `.${x}-${_}, [data-${x}="${_}"]`, X = nt.join("");
275
275
  return `${ot} { ${X} }`;
276
- })) : [], d = (S) => ({ ...S, responsive: void 0, conditional: void 0 }), y = (S) => n.variables.map((N) => S === "static" ? d(N._current) : N._current[S]), $ = B(d(o.variables), y("static")), m = g($), i = B((dt = o.variables) == null ? void 0 : dt.responsive, y("responsive")), p = j(i), P = B((pt = o.variables) == null ? void 0 : pt.conditional, y("conditional")), F = f(P), R = u(s, "css/_variables.css"), k = `:root { ${m.join("")} ${p.join("")} } ${F.join("")}`;
276
+ })) : [], d = (S) => ({ ...S, responsive: void 0, conditional: void 0 }), y = (S) => n.variables.map((x) => S === "static" ? d(x._current) : x._current[S]), $ = B(d(o.variables), y("static")), m = g($), i = B((dt = o.variables) == null ? void 0 : dt.responsive, y("responsive")), p = j(i), N = B((pt = o.variables) == null ? void 0 : pt.conditional, y("conditional")), F = l(N), R = u(s, "css/_variables.css"), k = `:root { ${m.join("")} ${p.join("")} } ${F.join("")}`;
277
277
  D(R, k), r.staticVariables = $;
278
- const O = u(s, "css/_global.css"), C = B(o.global, n.globalStyles), _ = await L(C, "");
279
- D(O, `@layer global { ${_} }`);
280
- const c = u(s, "css/_reset.css"), b = o.reset === "none" ? {} : typeof o.reset == "object" ? o.reset : Gt, l = await L(b, "");
281
- D(c, `@layer reset { ${l} }`);
282
- const w = u(s, "css/_templates.css"), x = B(o.templates, n.templates), V = await wt(x), G = It(x);
283
- D(w, `@layer templates { ${V} }`), r.templates = x;
278
+ const O = u(s, "css/_global.css"), C = B(o.global, n.globalStyles), E = await L(C, "");
279
+ D(O, `@layer global { ${E} }`);
280
+ const c = u(s, "css/_reset.css"), b = o.reset === "none" ? {} : typeof o.reset == "object" ? o.reset : Gt, f = await L(b, "");
281
+ D(c, `@layer reset { ${f} }`);
282
+ const w = u(s, "css/_templates.css"), P = B(o.templates, n.templates), V = await wt(P), G = It(P);
283
+ D(w, `@layer templates { ${V} }`), r.templates = P;
284
284
  const K = Kt(n.templates);
285
- r.templatePaths = Object.fromEntries(Object.entries(K).map(([S, N]) => [S, N._path]));
285
+ r.templatePaths = Object.fromEntries(Object.entries(K).map(([S, x]) => [S, x._path]));
286
286
  const { mediaQueries: Z } = n;
287
- r.mediaQueries = Object.fromEntries(Z.map(([S, N]) => [`@${S}`, N]));
287
+ r.mediaQueries = Object.fromEntries(Z.map(([S, x]) => [`@${S}`, x]));
288
288
  const Q = Z.map(([S]) => `'@${S}'`).join(" | "), st = u(s, "types/css-tokens.d.ts"), U = `
289
289
  // Variable types
290
290
  type VariableTokens = ${[...a].join("|")};
@@ -292,7 +292,7 @@ const Gt = {
292
292
 
293
293
  // Template types
294
294
  type TemplateTokens = {
295
- ${Object.entries(G).map(([S, N]) => `${S}?: ${N}`).join(`
295
+ ${Object.entries(G).map(([S, x]) => `${S}?: ${x}`).join(`
296
296
  `)}
297
297
  }
298
298
 
@@ -309,7 +309,7 @@ const Gt = {
309
309
  const a = o.exec(t);
310
310
  if (a) {
311
311
  const g = a.at(1);
312
- if (xt.some((f) => g == null ? void 0 : g.includes(f))) return e;
312
+ if (Pt.some((l) => g == null ? void 0 : g.includes(l))) return e;
313
313
  }
314
314
  return "styled('div',";
315
315
  }), Ut = (t, e) => {
@@ -329,7 +329,7 @@ ${t}`;
329
329
  const r = tt(e);
330
330
  let a = M(e, "utf8");
331
331
  a = ht(a), a = Ut(a, t);
332
- const g = u(s, "js", n + ".js"), j = await lt(t), f = u(t, (j == null ? void 0 : j.configDir) || "", "salty.config.ts"), d = Nt(f), y = await jt(t);
332
+ const g = u(s, "js", n + ".js"), j = await lt(t), l = u(t, (j == null ? void 0 : j.configDir) || "", "salty.config.ts"), d = xt(l), y = await jt(t);
333
333
  await yt.build({
334
334
  stdin: {
335
335
  contents: a,
@@ -351,8 +351,8 @@ ${t}`;
351
351
  name: "test",
352
352
  setup: (i) => {
353
353
  i.onLoad({ filter: /.*\.css|salty|styles|styled\.ts/ }, (p) => {
354
- const P = M(p.path, "utf8");
355
- return { contents: ht(P), loader: "ts" };
354
+ const N = M(p.path, "utf8");
355
+ return { contents: ht(N), loader: "ts" };
356
356
  });
357
357
  }
358
358
  }
@@ -381,15 +381,15 @@ ${t}`;
381
381
  s && (() => {
382
382
  at(a) && Dt("rm -rf " + a), H(a, { recursive: !0 }), H(u(a, "css")), H(u(a, "types")), H(u(a, "js")), H(u(a, "cache"));
383
383
  })();
384
- const f = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set();
384
+ const l = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set();
385
385
  async function y(c) {
386
- const h = ["node_modules", "saltygen"], b = _t(c);
386
+ const h = ["node_modules", "saltygen"], b = Et(c);
387
387
  if (b.isDirectory()) {
388
- const l = Et(c);
389
- if (h.some((x) => c.includes(x))) return;
390
- await Promise.all(l.map((x) => y(u(c, x))));
388
+ const f = _t(c);
389
+ if (h.some((P) => c.includes(P))) return;
390
+ await Promise.all(f.map((P) => y(u(c, P))));
391
391
  } else if (b.isFile() && ct(c)) {
392
- f.add(c);
392
+ l.add(c);
393
393
  const w = M(c, "utf8");
394
394
  /define[\w\d]+\(/.test(w) && d.add(c);
395
395
  }
@@ -401,19 +401,19 @@ ${t}`;
401
401
  classNames: []
402
402
  };
403
403
  await Promise.all(
404
- [...f].map(async (c) => {
404
+ [...l].map(async (c) => {
405
405
  const { contents: h } = await et(t, c, a);
406
- Object.entries(h).forEach(([b, l]) => {
407
- l.isKeyframes ? $.keyframes.push({
408
- value: l,
406
+ Object.entries(h).forEach(([b, f]) => {
407
+ f.isKeyframes ? $.keyframes.push({
408
+ value: f,
409
409
  src: c,
410
410
  name: b
411
- }) : l.isClassName ? $.classNames.push({
412
- ...l,
411
+ }) : f.isClassName ? $.classNames.push({
412
+ ...f,
413
413
  src: c,
414
414
  name: b
415
- }) : l.generator && $.components.push({
416
- ...l,
415
+ }) : f.generator && $.components.push({
416
+ ...f,
417
417
  src: c,
418
418
  name: b
419
419
  });
@@ -422,38 +422,42 @@ ${t}`;
422
422
  );
423
423
  const m = await ft(t);
424
424
  for (const c of $.keyframes) {
425
- const { value: h } = c, b = `a_${h.animationName}.css`, l = `css/${b}`, w = u(a, l);
425
+ const { value: h } = c, b = `a_${h.animationName}.css`, f = `css/${b}`, w = u(a, f);
426
426
  o.push(b), D(w, h.css);
427
427
  }
428
428
  const i = {};
429
429
  for (const c of $.components) {
430
- const { src: h, name: b } = c, l = c.generator._withBuildContext({
430
+ const { src: h, name: b } = c;
431
+ i[h] || (i[h] = []);
432
+ const f = c.generator._withBuildContext({
431
433
  callerName: b,
432
434
  isProduction: e,
433
435
  config: m
434
436
  });
435
- r[l.priority] || (r[l.priority] = []);
436
- const w = await l.css;
437
+ r[f.priority] || (r[f.priority] = []);
438
+ const w = await f.css;
437
439
  if (!w) continue;
438
- r[l.priority].push(l.cssFileName);
439
- const x = `css/${l.cssFileName}`, V = u(a, x);
440
- D(V, w), m.importStrategy === "component" && (i[h] ? i[h].push(l.cssFileName) : i[h] = [l.cssFileName]);
440
+ r[f.priority].push(f.cssFileName);
441
+ const P = `css/${f.cssFileName}`, V = u(a, P);
442
+ D(V, w), m.importStrategy === "component" && i[h].push(f.cssFileName);
441
443
  }
442
444
  for (const c of $.classNames) {
443
- const { src: h, name: b } = c, l = c.generator._withBuildContext({
445
+ const { src: h, name: b } = c;
446
+ i[h] || (i[h] = []);
447
+ const f = c.generator._withBuildContext({
444
448
  callerName: b,
445
449
  isProduction: e,
446
450
  config: m
447
- }), w = await l.css;
451
+ }), w = await f.css;
448
452
  if (!w) continue;
449
- r[0].push(l.cssFileName);
450
- const x = `css/${l.cssFileName}`, V = u(a, x);
451
- D(V, w), m.importStrategy === "component" && (i[h] ? i[h].push(l.cssFileName) : i[h] = [l.cssFileName]);
453
+ r[0].push(f.cssFileName);
454
+ const P = `css/${f.cssFileName}`, V = u(a, P);
455
+ D(V, w), m.importStrategy === "component" && i[h].push(f.cssFileName);
452
456
  }
453
457
  m.importStrategy === "component" && Object.entries(i).forEach(([c, h]) => {
454
458
  const b = h.map((G) => `@import url('./${G}');`).join(`
455
- `), l = z(c, 6), w = tt(c), x = A(w.name), V = u(a, `css/f_${x}-${l}.css`);
456
- D(V, b);
459
+ `), f = z(c, 6), w = tt(c), P = A(w.name), V = u(a, `css/f_${P}-${f}.css`);
460
+ D(V, b || "/* Empty file */");
457
461
  });
458
462
  const p = o.map((c) => `@import url('./css/${c}');`).join(`
459
463
  `);
@@ -469,7 +473,7 @@ ${["_variables.css", "_reset.css", "_global.css", "_templates.css"].filter((c) =
469
473
  `)}
470
474
  ${p}`;
471
475
  if (m.importStrategy !== "component") {
472
- const c = r.reduce((h, b, l) => {
476
+ const c = r.reduce((h, b, f) => {
473
477
  const w = b.reduce((K, Z) => {
474
478
  var U;
475
479
  const Q = u(a, "css", Z), st = M(Q, "utf8"), q = ((U = /.*-([^-]+)-\d+.css/.exec(Z)) == null ? void 0 : U.at(1)) || z(Q, 6);
@@ -478,16 +482,16 @@ ${p}`;
478
482
  ${st}
479
483
  /*end:${q}*/
480
484
  `;
481
- }, ""), x = `l_${l}.css`, V = u(a, "css", x), G = `@layer l${l} { ${w}
485
+ }, ""), P = `l_${f}.css`, V = u(a, "css", P), G = `@layer l${f} { ${w}
482
486
  }`;
483
487
  return D(V, G), `${h}
484
- @import url('./css/${x}');`;
488
+ @import url('./css/${P}');`;
485
489
  }, "");
486
490
  k += c;
487
491
  }
488
492
  D(g, k);
489
- const C = Date.now() - n, _ = C < 200 ? "🔥" : C < 500 ? "🚀" : C < 1e3 ? "🎉" : C < 2e3 ? "🚗" : C < 5e3 ? "🤔" : "🥴";
490
- it.info(`Generated CSS in ${C}ms! ${_}`);
493
+ const C = Date.now() - n, E = C < 200 ? "🔥" : C < 500 ? "🚀" : C < 1e3 ? "🎉" : C < 2e3 ? "🚗" : C < 5e3 ? "🤔" : "🥴";
494
+ it.info(`Generated CSS in ${C}ms! ${E}`);
491
495
  } catch (n) {
492
496
  console.error(n);
493
497
  }
@@ -496,25 +500,25 @@ ${st}
496
500
  const n = await v(t);
497
501
  if (ct(e)) {
498
502
  const r = [], a = await ft(t), { contents: g } = await et(t, e, n);
499
- for (const [j, f] of Object.entries(g)) {
500
- if (f.isKeyframes && f.css) {
501
- const p = `css/${`a_${f.animationName}.css`}`, P = u(n, p);
502
- D(P, await f.css);
503
+ for (const [j, l] of Object.entries(g)) {
504
+ if (l.isKeyframes && l.css) {
505
+ const p = `css/${`a_${l.animationName}.css`}`, N = u(n, p);
506
+ D(N, await l.css);
503
507
  return;
504
508
  }
505
- if (f.isClassName) {
506
- const i = f.generator._withBuildContext({
509
+ if (l.isClassName) {
510
+ const i = l.generator._withBuildContext({
507
511
  callerName: j,
508
512
  isProduction: s,
509
513
  config: a
510
514
  }), p = await i.css;
511
515
  if (!p) continue;
512
516
  r[0].push(i.cssFileName);
513
- const P = `css/${i.cssFileName}`, F = u(n, P);
517
+ const N = `css/${i.cssFileName}`, F = u(n, N);
514
518
  D(F, p);
515
519
  }
516
- if (!f.generator) return;
517
- const d = f.generator._withBuildContext({
520
+ if (!l.generator) return;
521
+ const d = l.generator._withBuildContext({
518
522
  callerName: j,
519
523
  isProduction: s,
520
524
  config: a
@@ -524,8 +528,8 @@ ${st}
524
528
  D(m, y), r[d.priority] || (r[d.priority] = []), r[d.priority].push(d.cssFileName);
525
529
  }
526
530
  if (a.importStrategy !== "component")
527
- r.forEach((j, f) => {
528
- const d = `l_${f}.css`, y = u(n, "css", d);
531
+ r.forEach((j, l) => {
532
+ const d = `l_${l}.css`, y = u(n, "css", d);
529
533
  let $ = M(y, "utf8");
530
534
  j.forEach((m) => {
531
535
  var F;
@@ -543,8 +547,8 @@ ${k}
543
547
  });
544
548
  else {
545
549
  const j = r.flat().map((m) => `@import url('./${m}');`).join(`
546
- `), f = z(e, 6), d = tt(e), y = A(d.name), $ = u(n, `css/f_${y}-${f}.css`);
547
- D($, j);
550
+ `), l = z(e, 6), d = tt(e), y = A(d.name), $ = u(n, `css/f_${y}-${l}.css`);
551
+ D($, j || "/* Empty file */");
548
552
  }
549
553
  }
550
554
  } catch (n) {
@@ -557,9 +561,9 @@ ${k}
557
561
  const r = M(e, "utf8");
558
562
  r.replace(/^(?!export\s)const\s.*/gm, (d) => `export ${d}`) !== r && await Tt(e, r);
559
563
  const g = await ft(t), { contents: j } = await et(t, e, n);
560
- let f = r;
564
+ let l = r;
561
565
  if (Object.entries(j).forEach(([d, y]) => {
562
- var l;
566
+ var f;
563
567
  if (y.isKeyframes || !y.generator) return;
564
568
  const $ = y.generator._withBuildContext({
565
569
  callerName: d,
@@ -567,26 +571,26 @@ ${k}
567
571
  config: g
568
572
  }), m = new RegExp(`\\s${d}[=\\s]+[^()]+styled\\(([^,]+),`, "g").exec(r);
569
573
  if (!m) return console.error("Could not find the original declaration");
570
- const i = (l = m.at(1)) == null ? void 0 : l.trim(), p = new RegExp(`\\s${d}[=\\s]+styled\\(`, "g").exec(f);
574
+ const i = (f = m.at(1)) == null ? void 0 : f.trim(), p = new RegExp(`\\s${d}[=\\s]+styled\\(`, "g").exec(l);
571
575
  if (!p) return console.error("Could not find the original declaration");
572
- const { index: P } = p;
576
+ const { index: N } = p;
573
577
  let F = !1;
574
578
  const R = setTimeout(() => F = !0, 5e3);
575
579
  let k = 0, O = !1, C = 0;
576
580
  for (; !O && !F; ) {
577
- const w = f[P + k];
578
- w === "(" && C++, w === ")" && C--, C === 0 && w === ")" && (O = !0), k > f.length && (F = !0), k++;
581
+ const w = l[N + k];
582
+ w === "(" && C++, w === ")" && C--, C === 0 && w === ")" && (O = !0), k > l.length && (F = !0), k++;
579
583
  }
580
584
  if (!F) clearTimeout(R);
581
585
  else throw new Error("Failed to find the end of the styled call and timed out");
582
- const _ = P + k, c = f.slice(P, _), h = f, b = ` ${d} = styled(${i}, "${$.classNames}", ${JSON.stringify($.clientProps)});`;
583
- f = f.replace(c, b), h === f && console.error("Minimize file failed to change content", { name: d, tagName: i });
586
+ const E = N + k, c = l.slice(N, E), h = l, b = ` ${d} = styled(${i}, "${$.classNames}", ${JSON.stringify($.clientProps)});`;
587
+ l = l.replace(c, b), h === l && console.error("Minimize file failed to change content", { name: d, tagName: i });
584
588
  }), g.importStrategy === "component") {
585
589
  const d = z(e, 6), y = tt(e);
586
- f = `import '../../saltygen/css/${`f_${A(y.name)}-${d}.css`}';
587
- ${f}`;
590
+ l = `import '../../saltygen/css/${`f_${A(y.name)}-${d}.css`}';
591
+ ${l}`;
588
592
  }
589
- return f = f.replace("{ styled }", "{ styledClient as styled }"), f = f.replace("@salty-css/react/styled", "@salty-css/react/styled-client"), f;
593
+ return l = l.replace("{ styled }", "{ styledClient as styled }"), l = l.replace("@salty-css/react/styled", "@salty-css/react/styled-client"), l;
590
594
  }
591
595
  } catch (n) {
592
596
  console.error("Error in minimizeFile:", n);
@@ -1,42 +1,42 @@
1
- "use strict";const Pe=require("esbuild"),ke=require("child_process"),f=require("path"),d=require("fs"),ie=require("fs/promises"),L=require("winston");var oe=typeof document<"u"?document.currentScript:null;function _e(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 ye=_e(Pe),pe=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=pe(n%52)+s;return s=pe(n%52)+s,s.length<t?s=s.padStart(t,"a"):s.length>t&&(s=s.slice(-t)),s},Oe=(e,t)=>{let s=t.length;for(;s;)e=e*33^t.charCodeAt(--s);return e},J=(e,t=5)=>{const s=Oe(5381,JSON.stringify(e))>>>0;return De(s,t)};function R(e){return e?typeof e!="string"?R(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 Ee=e=>t=>{if(typeof t!="string"||!e)return;let s=t;const n=[];return Object.values(e).forEach(o=>{const{pattern:r,transform:a}=o;s=s.replace(r,g=>{const{value:C,css:u}=a(g);return u&&n.push(u),C})}),{transformed:s,additionalCss:n}},ge=e=>t=>typeof t!="string"||!/\{[^{}]+\}/g.test(t)?void 0:{transformed:t.replace(/\{([^{}]+)\}/g,(...o)=>`var(--${R(o[1].replaceAll(".","-"))})`)},Te=ge(),Ve=["top","right","bottom","left","min-width",/.*width.*/,/^[^line]*height.*/,/padding.*/,/margin.*/,/border.*/,/inset.*/,/.*radius.*/,/.*spacing.*/,/.*gap.*/,/.*indent.*/,/.*offset.*/,/.*size.*/,/.*thickness.*/,/.*font-size.*/],Me=(e,t,s)=>Ve.some(o=>typeof o=="string"?o===e:o.test(e))?`${t}px`:`${t}`,Re=["Webkit","Moz","ms","O"],ze=e=>e.startsWith("-")?e:Re.some(t=>e.startsWith(t))?`-${R(e)}`:R(e),X=async(e,t="",s,n=!1)=>{if(!e)throw new Error("No styles provided to parseStyles function!");const o=new Set,a=Object.entries(e).map(async([y,i])=>{const m=y.trim(),k=ze(m),x=(_,T=";")=>`${k}:${_}${T}`;if(typeof i=="function"&&(i=i({scope:t,config:s})),i instanceof Promise&&(i=await i),typeof i=="object"){if(!i)return;if(i.isColor)return x(i.toString());if(m==="defaultVariants")return;if(m==="variants"){const j=Object.entries(i);for(const[D,c]of j){if(!c)return;const h=Object.entries(c);for(const[b,l]of h){if(!l)return;const S=`${t}.${D}-${b}`;(await X(l,S,s)).forEach(V=>o.add(V))}}return}if(m==="compoundVariants"){for(const j of i){const{css:D,...c}=j,h=Object.entries(c).reduce((l,[S,P])=>`${l}.${S}-${P}`,t);(await X(D,h,s)).forEach(l=>o.add(l))}return}if(m.startsWith("@")){const j=m,D=await B(i,t,s),c=`${j} { ${D} }`;o.add(c);return}const _=y.includes("&")?m.replace("&",t):m.startsWith(":")?`${t}${m}`:`${t} ${m}`;(await X(i,_,s)).forEach(j=>o.add(j));return}if(typeof i=="number"){const _=Me(k,i);return x(_)}if(typeof i!="string")if("toString"in i)i=i.toString();else throw new Error(`Invalid value type for property ${k}`);return x(i)}),{modifiers:g}={},C=[ge(),Ee(g)],p=(await Promise.all(a).then(y=>Promise.all(y.map(i=>C.reduce(async(m,k)=>{const x=await m;if(!x)return x;const M=await k(x);if(!M)return x;const{transformed:_,additionalCss:T}=M;let j="";if(T)for(const D of T)j+=await B(D,"");return`${j}${_}`},Promise.resolve(i)))))).filter(y=>y!==void 0).join(`
1
+ "use strict";const Ne=require("esbuild"),ke=require("child_process"),l=require("path"),d=require("fs"),ie=require("fs/promises"),L=require("winston");var oe=typeof document<"u"?document.currentScript:null;function _e(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 ye=_e(Ne),pe=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=pe(n%52)+s;return s=pe(n%52)+s,s.length<t?s=s.padStart(t,"a"):s.length>t&&(s=s.slice(-t)),s},Ee=(e,t)=>{let s=t.length;for(;s;)e=e*33^t.charCodeAt(--s);return e},J=(e,t=5)=>{const s=Ee(5381,JSON.stringify(e))>>>0;return De(s,t)};function R(e){return e?typeof e!="string"?R(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 Oe=e=>t=>{if(typeof t!="string"||!e)return;let s=t;const n=[];return Object.values(e).forEach(o=>{const{pattern:r,transform:a}=o;s=s.replace(r,g=>{const{value:C,css:f}=a(g);return f&&n.push(f),C})}),{transformed:s,additionalCss:n}},ge=e=>t=>typeof t!="string"||!/\{[^{}]+\}/g.test(t)?void 0:{transformed:t.replace(/\{([^{}]+)\}/g,(...o)=>`var(--${R(o[1].replaceAll(".","-"))})`)},Te=ge(),Ve=["top","right","bottom","left","min-width",/.*width.*/,/^[^line]*height.*/,/padding.*/,/margin.*/,/border.*/,/inset.*/,/.*radius.*/,/.*spacing.*/,/.*gap.*/,/.*indent.*/,/.*offset.*/,/.*size.*/,/.*thickness.*/,/.*font-size.*/],Me=(e,t,s)=>Ve.some(o=>typeof o=="string"?o===e:o.test(e))?`${t}px`:`${t}`,Re=["Webkit","Moz","ms","O"],ze=e=>e.startsWith("-")?e:Re.some(t=>e.startsWith(t))?`-${R(e)}`:R(e),X=async(e,t="",s,n=!1)=>{if(!e)throw new Error("No styles provided to parseStyles function!");const o=new Set,a=Object.entries(e).map(async([y,i])=>{const m=y.trim(),k=ze(m),x=(_,T=";")=>`${k}:${_}${T}`;if(typeof i=="function"&&(i=i({scope:t,config:s})),i instanceof Promise&&(i=await i),typeof i=="object"){if(!i)return;if(i.isColor)return x(i.toString());if(m==="defaultVariants")return;if(m==="variants"){const j=Object.entries(i);for(const[D,c]of j){if(!c)return;const h=Object.entries(c);for(const[b,u]of h){if(!u)return;const S=`${t}.${D}-${b}`;(await X(u,S,s)).forEach(V=>o.add(V))}}return}if(m==="compoundVariants"){for(const j of i){const{css:D,...c}=j,h=Object.entries(c).reduce((u,[S,N])=>`${u}.${S}-${N}`,t);(await X(D,h,s)).forEach(u=>o.add(u))}return}if(m.startsWith("@")){const j=m,D=await B(i,t,s),c=`${j} { ${D} }`;o.add(c);return}const _=y.includes("&")?m.replace("&",t):m.startsWith(":")?`${t}${m}`:`${t} ${m}`;(await X(i,_,s)).forEach(j=>o.add(j));return}if(typeof i=="number"){const _=Me(k,i);return x(_)}if(typeof i!="string")if("toString"in i)i=i.toString();else throw new Error(`Invalid value type for property ${k}`);return x(i)}),{modifiers:g}={},C=[ge(),Oe(g)],p=(await Promise.all(a).then(y=>Promise.all(y.map(i=>C.reduce(async(m,k)=>{const x=await m;if(!x)return x;const M=await k(x);if(!M)return x;const{transformed:_,additionalCss:T}=M;let j="";if(T)for(const D of T)j+=await B(D,"");return`${j}${_}`},Promise.resolve(i)))))).filter(y=>y!==void 0).join(`
2
2
  `);if(!p.trim())return Array.from(o);const w=t?`${t} {
3
3
  ${p}
4
4
  }`:p;return o.has(w)?Array.from(o):[w,...o]},B=async(e,t,s,n=!1)=>(await X(e,t,s,n)).join(`
5
5
  `),he=async(e,t=[])=>{if(!e)return"";const s=[],n={};for(const[o,r]of Object.entries(e))if(typeof r!="function")if(r&&typeof r=="object"){const a=o.trim(),g=await he(r,[...t,a]);s.push(g)}else n[o]=r;if(Object.keys(n).length){const o=t.map(R).join("-"),r="t_"+J(o,4),a=await B(n,`.${o}, .${r}`);s.push(a)}return s.join(`
6
- `)},Ae=e=>e?Object.entries(e).reduce((t,[s,n])=>(typeof n=="function"?t[s]="any":typeof n=="object"&&(t[s]=we(n).map(o=>`"${o}"`).join(" | ")),t),{}):{},we=(e,t="",s=new Set)=>e?(Object.entries(e).forEach(([n,o])=>{const r=t?`${t}.${n}`:n;return typeof o=="object"?we(o,r,s):s.add(t)}),[...s]):[],$e=e=>{if(!e||e==="/")throw new Error("Could not find package.json file");const t=f.join(e,"package.json");return d.existsSync(t)?t:$e(f.join(e,".."))},Je=async e=>{const t=$e(e);return await ie.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},We=async e=>{const t=await Je(e);if(t)return t.type};let I;const be=async e=>{if(I)return I;const t=await We(e);return t==="module"?I="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:oe&&oe.tagName.toUpperCase()==="SCRIPT"&&oe.src||new URL("index-BnYubFKk.cjs",document.baseURI).href).endsWith(".cjs"))&&(I="cjs"),I||"esm"},re=L.createLogger({level:"debug",format:L.format.combine(L.format.colorize(),L.format.cli()),transports:[new L.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 ve={"*, *::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=(...e)=>e.flat().reduce((t,s)=>s!=null&&s._current?{...t,...s._current}:{...t,...s},{}),Ie=(...e)=>e.flat().reduce((t,s)=>({...t,...s._children}),{}),A={externalModules:[],rcFile:void 0,destDir:void 0},je=e=>{if(A.externalModules.length>0)return A.externalModules;const s=d.readFileSync(e,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!s)return[];const n=s[1].split(",").map(o=>o.replace(/['"`]/g,"").trim());return A.externalModules=n,n},W=async e=>{if(A.destDir)return A.destDir;const t=await ae(e),s=f.join(e,(t==null?void 0:t.saltygenDir)||"saltygen");return A.destDir=s,s},Fe=["salty","css","styles","styled"],Ce=(e=[])=>new RegExp(`\\.(${[...Fe,...e].join("|")})\\.`),Y=(e,t=[])=>Ce(t).test(e),xe=async e=>{if(A.rcFile)return A.rcFile;if(e==="/")throw new Error("Could not find .saltyrc.json file");const t=f.join(e,".saltyrc.json"),s=await ie.readFile(t,"utf-8").then(JSON.parse).catch(()=>{});return s?(A.rcFile=s,s):xe(f.join(e,".."))},ae=async e=>{var n,o;const t=await xe(e),s=(n=t.projects)==null?void 0:n.find(r=>e.endsWith(r.dir||""));return s||((o=t.projects)==null?void 0:o.find(r=>r.dir===t.defaultProject))},Ze=async e=>{const t=await ae(e),s=await W(e),n=f.join(e,(t==null?void 0:t.configDir)||"","salty.config.ts"),o=f.join(s,"salty.config.js"),r=await be(e),a=je(n);await ye.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:o,format:r,external:a});const g=Date.now(),{config:C}=await import(`${o}?t=${g}`);return C},qe=async(e,t)=>{var fe,ue;const s=await W(e),n={mediaQueries:[],globalStyles:[],variables:[],templates:[]};await Promise.all([...t].map(async F=>{const{contents:N,outputFilePath:z}=await ee(e,F,s);Object.entries(N).forEach(([O,E])=>{E.isMedia?n.mediaQueries.push([O,E]):E.isGlobalDefine?n.globalStyles.push(E):E.isDefineVariables?n.variables.push(E):E.isDefineTemplates&&n.templates.push(E._setPath(z))})}));const o=await Ze(e),r={...o},a=new Set,g=(F,N=[])=>F?Object.entries(F).flatMap(([z,O])=>{if(!O)return;if(typeof O=="object")return g(O,[...N,z]);const E=Se(z),se=R(z),ne=[...N,E].join(".");a.add(`"${ne}"`);const U=[...N.map(R),se].join("-"),de=Te(O);return de?`--${U}: ${de.transformed};`:`--${U}: ${O};`}):[],C=F=>F?Object.entries(F).flatMap(([N,z])=>{const O=g(z);return N==="base"?O.join(""):`${N} { ${O.join("")} }`}):[],u=F=>F?Object.entries(F).flatMap(([N,z])=>Object.entries(z).flatMap(([O,E])=>{const se=g(E,[N]),ne=`.${N}-${O}, [data-${N}="${O}"]`,U=se.join("");return`${ne} { ${U} }`})):[],p=F=>({...F,responsive:void 0,conditional:void 0}),w=F=>n.variables.map(N=>F==="static"?p(N._current):N._current[F]),$=Z(p(o.variables),w("static")),y=g($),i=Z((fe=o.variables)==null?void 0:fe.responsive,w("responsive")),m=C(i),k=Z((ue=o.variables)==null?void 0:ue.conditional,w("conditional")),x=u(k),M=f.join(s,"css/_variables.css"),_=`:root { ${y.join("")} ${m.join("")} } ${x.join("")}`;d.writeFileSync(M,_),r.staticVariables=$;const T=f.join(s,"css/_global.css"),j=Z(o.global,n.globalStyles),D=await B(j,"");d.writeFileSync(T,`@layer global { ${D} }`);const c=f.join(s,"css/_reset.css"),b=o.reset==="none"?{}:typeof o.reset=="object"?o.reset:ve,l=await B(b,"");d.writeFileSync(c,`@layer reset { ${l} }`);const S=f.join(s,"css/_templates.css"),P=Z(o.templates,n.templates),V=await he(P),q=Ae(P);d.writeFileSync(S,`@layer templates { ${V} }`),r.templates=P;const H=Ie(n.templates);r.templatePaths=Object.fromEntries(Object.entries(H).map(([F,N])=>[F,N._path]));const{mediaQueries:v}=n;r.mediaQueries=Object.fromEntries(v.map(([F,N])=>[`@${F}`,N]));const G=v.map(([F])=>`'@${F}'`).join(" | "),te=f.join(s,"types/css-tokens.d.ts"),Q=`
6
+ `)},Ae=e=>e?Object.entries(e).reduce((t,[s,n])=>(typeof n=="function"?t[s]="any":typeof n=="object"&&(t[s]=we(n).map(o=>`"${o}"`).join(" | ")),t),{}):{},we=(e,t="",s=new Set)=>e?(Object.entries(e).forEach(([n,o])=>{const r=t?`${t}.${n}`:n;return typeof o=="object"?we(o,r,s):s.add(t)}),[...s]):[],$e=e=>{if(!e||e==="/")throw new Error("Could not find package.json file");const t=l.join(e,"package.json");return d.existsSync(t)?t:$e(l.join(e,".."))},Je=async e=>{const t=$e(e);return await ie.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},We=async e=>{const t=await Je(e);if(t)return t.type};let I;const be=async e=>{if(I)return I;const t=await We(e);return t==="module"?I="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:oe&&oe.tagName.toUpperCase()==="SCRIPT"&&oe.src||new URL("index-BG0kLkBd.cjs",document.baseURI).href).endsWith(".cjs"))&&(I="cjs"),I||"esm"},re=L.createLogger({level:"debug",format:L.format.combine(L.format.colorize(),L.format.cli()),transports:[new L.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 ve={"*, *::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=(...e)=>e.flat().reduce((t,s)=>s!=null&&s._current?{...t,...s._current}:{...t,...s},{}),Ie=(...e)=>e.flat().reduce((t,s)=>({...t,...s._children}),{}),A={externalModules:[],rcFile:void 0,destDir:void 0},je=e=>{if(A.externalModules.length>0)return A.externalModules;const s=d.readFileSync(e,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!s)return[];const n=s[1].split(",").map(o=>o.replace(/['"`]/g,"").trim());return A.externalModules=n,n},W=async e=>{if(A.destDir)return A.destDir;const t=await ae(e),s=l.join(e,(t==null?void 0:t.saltygenDir)||"saltygen");return A.destDir=s,s},Fe=["salty","css","styles","styled"],Ce=(e=[])=>new RegExp(`\\.(${[...Fe,...e].join("|")})\\.`),Y=(e,t=[])=>Ce(t).test(e),xe=async e=>{if(A.rcFile)return A.rcFile;if(e==="/")throw new Error("Could not find .saltyrc.json file");const t=l.join(e,".saltyrc.json"),s=await ie.readFile(t,"utf-8").then(JSON.parse).catch(()=>{});return s?(A.rcFile=s,s):xe(l.join(e,".."))},ae=async e=>{var n,o;const t=await xe(e),s=(n=t.projects)==null?void 0:n.find(r=>e.endsWith(r.dir||""));return s||((o=t.projects)==null?void 0:o.find(r=>r.dir===t.defaultProject))},Ze=async e=>{const t=await ae(e),s=await W(e),n=l.join(e,(t==null?void 0:t.configDir)||"","salty.config.ts"),o=l.join(s,"salty.config.js"),r=await be(e),a=je(n);await ye.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:o,format:r,external:a});const g=Date.now(),{config:C}=await import(`${o}?t=${g}`);return C},qe=async(e,t)=>{var fe,ue;const s=await W(e),n={mediaQueries:[],globalStyles:[],variables:[],templates:[]};await Promise.all([...t].map(async F=>{const{contents:P,outputFilePath:z}=await ee(e,F,s);Object.entries(P).forEach(([E,O])=>{O.isMedia?n.mediaQueries.push([E,O]):O.isGlobalDefine?n.globalStyles.push(O):O.isDefineVariables?n.variables.push(O):O.isDefineTemplates&&n.templates.push(O._setPath(z))})}));const o=await Ze(e),r={...o},a=new Set,g=(F,P=[])=>F?Object.entries(F).flatMap(([z,E])=>{if(!E)return;if(typeof E=="object")return g(E,[...P,z]);const O=Se(z),se=R(z),ne=[...P,O].join(".");a.add(`"${ne}"`);const U=[...P.map(R),se].join("-"),de=Te(E);return de?`--${U}: ${de.transformed};`:`--${U}: ${E};`}):[],C=F=>F?Object.entries(F).flatMap(([P,z])=>{const E=g(z);return P==="base"?E.join(""):`${P} { ${E.join("")} }`}):[],f=F=>F?Object.entries(F).flatMap(([P,z])=>Object.entries(z).flatMap(([E,O])=>{const se=g(O,[P]),ne=`.${P}-${E}, [data-${P}="${E}"]`,U=se.join("");return`${ne} { ${U} }`})):[],p=F=>({...F,responsive:void 0,conditional:void 0}),w=F=>n.variables.map(P=>F==="static"?p(P._current):P._current[F]),$=Z(p(o.variables),w("static")),y=g($),i=Z((fe=o.variables)==null?void 0:fe.responsive,w("responsive")),m=C(i),k=Z((ue=o.variables)==null?void 0:ue.conditional,w("conditional")),x=f(k),M=l.join(s,"css/_variables.css"),_=`:root { ${y.join("")} ${m.join("")} } ${x.join("")}`;d.writeFileSync(M,_),r.staticVariables=$;const T=l.join(s,"css/_global.css"),j=Z(o.global,n.globalStyles),D=await B(j,"");d.writeFileSync(T,`@layer global { ${D} }`);const c=l.join(s,"css/_reset.css"),b=o.reset==="none"?{}:typeof o.reset=="object"?o.reset:ve,u=await B(b,"");d.writeFileSync(c,`@layer reset { ${u} }`);const S=l.join(s,"css/_templates.css"),N=Z(o.templates,n.templates),V=await he(N),q=Ae(N);d.writeFileSync(S,`@layer templates { ${V} }`),r.templates=N;const H=Ie(n.templates);r.templatePaths=Object.fromEntries(Object.entries(H).map(([F,P])=>[F,P._path]));const{mediaQueries:v}=n;r.mediaQueries=Object.fromEntries(v.map(([F,P])=>[`@${F}`,P]));const G=v.map(([F])=>`'@${F}'`).join(" | "),te=l.join(s,"types/css-tokens.d.ts"),Q=`
7
7
  // Variable types
8
8
  type VariableTokens = ${[...a].join("|")};
9
9
  type PropertyValueToken = \`{\${VariableTokens}}\`;
10
10
 
11
11
  // Template types
12
12
  type TemplateTokens = {
13
- ${Object.entries(q).map(([F,N])=>`${F}?: ${N}`).join(`
13
+ ${Object.entries(q).map(([F,P])=>`${F}?: ${P}`).join(`
14
14
  `)}
15
15
  }
16
16
 
17
17
  // Media query types
18
18
  type MediaQueryKeys = ${G||"''"};
19
- `;d.writeFileSync(te,Q);const Ne=f.join(s,"cache/config-cache.json");d.writeFileSync(Ne,JSON.stringify(r,null,2))},me=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 a=o.exec(e);if(a){const g=a.at(1);if(Fe.some(u=>g==null?void 0:g.includes(u)))return t}return"styled('div',"}),He=(e,t)=>{try{const s=d.readFileSync(f.join(t,"saltygen/cache/config-cache.json"),"utf8");return s?`globalThis.saltyConfig = ${s};
19
+ `;d.writeFileSync(te,Q);const Pe=l.join(s,"cache/config-cache.json");d.writeFileSync(Pe,JSON.stringify(r,null,2))},me=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 a=o.exec(e);if(a){const g=a.at(1);if(Fe.some(f=>g==null?void 0:g.includes(f)))return t}return"styled('div',"}),He=(e,t)=>{try{const s=d.readFileSync(l.join(t,"saltygen/cache/config-cache.json"),"utf8");return s?`globalThis.saltyConfig = ${s};
20
20
 
21
21
  ${e}`:`globalThis.saltyConfig = {};
22
22
 
23
- ${e}`}catch{return e}},ee=async(e,t,s)=>{const n=J(t),o=f.join(s,"./temp");d.existsSync(o)||d.mkdirSync(o);const r=f.parse(t);let a=d.readFileSync(t,"utf8");a=me(a),a=He(a,e);const g=f.join(s,"js",n+".js"),C=await ae(e),u=f.join(e,(C==null?void 0:C.configDir)||"","salty.config.ts"),p=je(u),w=await be(e);await ye.build({stdin:{contents:a,sourcefile:r.base,resolveDir:r.dir,loader:"tsx"},minify:!1,treeShaking:!0,bundle:!0,outfile:g,format:w,target:["node20"],keepNames:!0,external:p,packages:"external",plugins:[{name:"test",setup:i=>{i.onLoad({filter:/.*\.css|salty|styles|styled\.ts/},m=>{const k=d.readFileSync(m.path,"utf8");return{contents:me(k),loader:"ts"}})}}]});const $=Date.now();return{contents:await import(`${g}?t=${$}`),outputFilePath:g}},Le=async e=>{const t=await W(e),s=f.join(t,"cache/config-cache.json"),n=d.readFileSync(s,"utf8");if(!n)throw new Error("Could not find config cache file");return JSON.parse(n)},ce=async e=>{const t=await Le(e),s=await W(e),n=f.join(s,"salty.config.js"),o=Date.now(),{config:r}=await import(`${n}?t=${o}`);return Z(r,t)},le=()=>{try{return process.env.NODE_ENV==="production"}catch{return!1}},Be=async(e,t=le(),s=!0)=>{try{const n=Date.now();t?re.info("Generating CSS in production mode! 🔥"):re.info("Generating CSS in development mode! 🚀");const o=[],r=[],a=await W(e),g=f.join(a,"index.css");s&&(()=>{d.existsSync(a)&&ke.execSync("rm -rf "+a),d.mkdirSync(a,{recursive:!0}),d.mkdirSync(f.join(a,"css")),d.mkdirSync(f.join(a,"types")),d.mkdirSync(f.join(a,"js")),d.mkdirSync(f.join(a,"cache"))})();const u=new Set,p=new Set;async function w(c){const h=["node_modules","saltygen"],b=d.statSync(c);if(b.isDirectory()){const l=d.readdirSync(c);if(h.some(P=>c.includes(P)))return;await Promise.all(l.map(P=>w(f.join(c,P))))}else if(b.isFile()&&Y(c)){u.add(c);const S=d.readFileSync(c,"utf8");/define[\w\d]+\(/.test(S)&&p.add(c)}}await w(e),await qe(e,p);const $={keyframes:[],components:[],classNames:[]};await Promise.all([...u].map(async c=>{const{contents:h}=await ee(e,c,a);Object.entries(h).forEach(([b,l])=>{l.isKeyframes?$.keyframes.push({value:l,src:c,name:b}):l.isClassName?$.classNames.push({...l,src:c,name:b}):l.generator&&$.components.push({...l,src:c,name:b})})}));const y=await ce(e);for(const c of $.keyframes){const{value:h}=c,b=`a_${h.animationName}.css`,l=`css/${b}`,S=f.join(a,l);o.push(b),d.writeFileSync(S,h.css)}const i={};for(const c of $.components){const{src:h,name:b}=c,l=c.generator._withBuildContext({callerName:b,isProduction:t,config:y});r[l.priority]||(r[l.priority]=[]);const S=await l.css;if(!S)continue;r[l.priority].push(l.cssFileName);const P=`css/${l.cssFileName}`,V=f.join(a,P);d.writeFileSync(V,S),y.importStrategy==="component"&&(i[h]?i[h].push(l.cssFileName):i[h]=[l.cssFileName])}for(const c of $.classNames){const{src:h,name:b}=c,l=c.generator._withBuildContext({callerName:b,isProduction:t,config:y}),S=await l.css;if(!S)continue;r[0].push(l.cssFileName);const P=`css/${l.cssFileName}`,V=f.join(a,P);d.writeFileSync(V,S),y.importStrategy==="component"&&(i[h]?i[h].push(l.cssFileName):i[h]=[l.cssFileName])}y.importStrategy==="component"&&Object.entries(i).forEach(([c,h])=>{const b=h.map(q=>`@import url('./${q}');`).join(`
24
- `),l=J(c,6),S=f.parse(c),P=R(S.name),V=f.join(a,`css/f_${P}-${l}.css`);d.writeFileSync(V,b)});const m=o.map(c=>`@import url('./css/${c}');`).join(`
23
+ ${e}`}catch{return e}},ee=async(e,t,s)=>{const n=J(t),o=l.join(s,"./temp");d.existsSync(o)||d.mkdirSync(o);const r=l.parse(t);let a=d.readFileSync(t,"utf8");a=me(a),a=He(a,e);const g=l.join(s,"js",n+".js"),C=await ae(e),f=l.join(e,(C==null?void 0:C.configDir)||"","salty.config.ts"),p=je(f),w=await be(e);await ye.build({stdin:{contents:a,sourcefile:r.base,resolveDir:r.dir,loader:"tsx"},minify:!1,treeShaking:!0,bundle:!0,outfile:g,format:w,target:["node20"],keepNames:!0,external:p,packages:"external",plugins:[{name:"test",setup:i=>{i.onLoad({filter:/.*\.css|salty|styles|styled\.ts/},m=>{const k=d.readFileSync(m.path,"utf8");return{contents:me(k),loader:"ts"}})}}]});const $=Date.now();return{contents:await import(`${g}?t=${$}`),outputFilePath:g}},Le=async e=>{const t=await W(e),s=l.join(t,"cache/config-cache.json"),n=d.readFileSync(s,"utf8");if(!n)throw new Error("Could not find config cache file");return JSON.parse(n)},ce=async e=>{const t=await Le(e),s=await W(e),n=l.join(s,"salty.config.js"),o=Date.now(),{config:r}=await import(`${n}?t=${o}`);return Z(r,t)},le=()=>{try{return process.env.NODE_ENV==="production"}catch{return!1}},Be=async(e,t=le(),s=!0)=>{try{const n=Date.now();t?re.info("Generating CSS in production mode! 🔥"):re.info("Generating CSS in development mode! 🚀");const o=[],r=[],a=await W(e),g=l.join(a,"index.css");s&&(()=>{d.existsSync(a)&&ke.execSync("rm -rf "+a),d.mkdirSync(a,{recursive:!0}),d.mkdirSync(l.join(a,"css")),d.mkdirSync(l.join(a,"types")),d.mkdirSync(l.join(a,"js")),d.mkdirSync(l.join(a,"cache"))})();const f=new Set,p=new Set;async function w(c){const h=["node_modules","saltygen"],b=d.statSync(c);if(b.isDirectory()){const u=d.readdirSync(c);if(h.some(N=>c.includes(N)))return;await Promise.all(u.map(N=>w(l.join(c,N))))}else if(b.isFile()&&Y(c)){f.add(c);const S=d.readFileSync(c,"utf8");/define[\w\d]+\(/.test(S)&&p.add(c)}}await w(e),await qe(e,p);const $={keyframes:[],components:[],classNames:[]};await Promise.all([...f].map(async c=>{const{contents:h}=await ee(e,c,a);Object.entries(h).forEach(([b,u])=>{u.isKeyframes?$.keyframes.push({value:u,src:c,name:b}):u.isClassName?$.classNames.push({...u,src:c,name:b}):u.generator&&$.components.push({...u,src:c,name:b})})}));const y=await ce(e);for(const c of $.keyframes){const{value:h}=c,b=`a_${h.animationName}.css`,u=`css/${b}`,S=l.join(a,u);o.push(b),d.writeFileSync(S,h.css)}const i={};for(const c of $.components){const{src:h,name:b}=c;i[h]||(i[h]=[]);const u=c.generator._withBuildContext({callerName:b,isProduction:t,config:y});r[u.priority]||(r[u.priority]=[]);const S=await u.css;if(!S)continue;r[u.priority].push(u.cssFileName);const N=`css/${u.cssFileName}`,V=l.join(a,N);d.writeFileSync(V,S),y.importStrategy==="component"&&i[h].push(u.cssFileName)}for(const c of $.classNames){const{src:h,name:b}=c;i[h]||(i[h]=[]);const u=c.generator._withBuildContext({callerName:b,isProduction:t,config:y}),S=await u.css;if(!S)continue;r[0].push(u.cssFileName);const N=`css/${u.cssFileName}`,V=l.join(a,N);d.writeFileSync(V,S),y.importStrategy==="component"&&i[h].push(u.cssFileName)}y.importStrategy==="component"&&Object.entries(i).forEach(([c,h])=>{const b=h.map(q=>`@import url('./${q}');`).join(`
24
+ `),u=J(c,6),S=l.parse(c),N=R(S.name),V=l.join(a,`css/f_${N}-${u}.css`);d.writeFileSync(V,b||"/* Empty file */")});const m=o.map(c=>`@import url('./css/${c}');`).join(`
25
25
  `);let _=`@layer reset, global, templates, l0, l1, l2, l3, l4, l5, l6, l7, l8;
26
26
 
27
- ${["_variables.css","_reset.css","_global.css","_templates.css"].filter(c=>{try{return d.readFileSync(f.join(a,"css",c),"utf8").length>0}catch{return!1}}).map(c=>`@import url('./css/${c}');`).join(`
27
+ ${["_variables.css","_reset.css","_global.css","_templates.css"].filter(c=>{try{return d.readFileSync(l.join(a,"css",c),"utf8").length>0}catch{return!1}}).map(c=>`@import url('./css/${c}');`).join(`
28
28
  `)}
29
- ${m}`;if(y.importStrategy!=="component"){const c=r.reduce((h,b,l)=>{const S=b.reduce((H,v)=>{var Q;const G=f.join(a,"css",v),te=d.readFileSync(G,"utf8"),K=((Q=/.*-([^-]+)-\d+.css/.exec(v))==null?void 0:Q.at(1))||J(G,6);return H.includes(K)?H:`${H}
29
+ ${m}`;if(y.importStrategy!=="component"){const c=r.reduce((h,b,u)=>{const S=b.reduce((H,v)=>{var Q;const G=l.join(a,"css",v),te=d.readFileSync(G,"utf8"),K=((Q=/.*-([^-]+)-\d+.css/.exec(v))==null?void 0:Q.at(1))||J(G,6);return H.includes(K)?H:`${H}
30
30
  /*start:${K}-${v}*/
31
31
  ${te}
32
32
  /*end:${K}*/
33
- `},""),P=`l_${l}.css`,V=f.join(a,"css",P),q=`@layer l${l} { ${S}
33
+ `},""),N=`l_${u}.css`,V=l.join(a,"css",N),q=`@layer l${u} { ${S}
34
34
  }`;return d.writeFileSync(V,q),`${h}
35
- @import url('./css/${P}');`},"");_+=c}d.writeFileSync(g,_);const j=Date.now()-n,D=j<200?"🔥":j<500?"🚀":j<1e3?"🎉":j<2e3?"🚗":j<5e3?"🤔":"🥴";re.info(`Generated CSS in ${j}ms! ${D}`)}catch(n){console.error(n)}},Ge=async(e,t,s=le())=>{try{const n=await W(e);if(Y(t)){const r=[],a=await ce(e),{contents:g}=await ee(e,t,n);for(const[C,u]of Object.entries(g)){if(u.isKeyframes&&u.css){const m=`css/${`a_${u.animationName}.css`}`,k=f.join(n,m);d.writeFileSync(k,await u.css);return}if(u.isClassName){const i=u.generator._withBuildContext({callerName:C,isProduction:s,config:a}),m=await i.css;if(!m)continue;r[0].push(i.cssFileName);const k=`css/${i.cssFileName}`,x=f.join(n,k);d.writeFileSync(x,m)}if(!u.generator)return;const p=u.generator._withBuildContext({callerName:C,isProduction:s,config:a}),w=await p.css;if(!w)continue;const $=`css/${p.cssFileName}`,y=f.join(n,$);d.writeFileSync(y,w),r[p.priority]||(r[p.priority]=[]),r[p.priority].push(p.cssFileName)}if(a.importStrategy!=="component")r.forEach((C,u)=>{const p=`l_${u}.css`,w=f.join(n,"css",p);let $=d.readFileSync(w,"utf8");C.forEach(y=>{var x;const i=f.join(n,"css",y),m=((x=/.*-([^-]+)-\d+.css/.exec(y))==null?void 0:x.at(1))||J(i,6);if(!$.includes(m)){const M=d.readFileSync(i,"utf8"),_=`/*start:${m}-${y}*/
35
+ @import url('./css/${N}');`},"");_+=c}d.writeFileSync(g,_);const j=Date.now()-n,D=j<200?"🔥":j<500?"🚀":j<1e3?"🎉":j<2e3?"🚗":j<5e3?"🤔":"🥴";re.info(`Generated CSS in ${j}ms! ${D}`)}catch(n){console.error(n)}},Ge=async(e,t,s=le())=>{try{const n=await W(e);if(Y(t)){const r=[],a=await ce(e),{contents:g}=await ee(e,t,n);for(const[C,f]of Object.entries(g)){if(f.isKeyframes&&f.css){const m=`css/${`a_${f.animationName}.css`}`,k=l.join(n,m);d.writeFileSync(k,await f.css);return}if(f.isClassName){const i=f.generator._withBuildContext({callerName:C,isProduction:s,config:a}),m=await i.css;if(!m)continue;r[0].push(i.cssFileName);const k=`css/${i.cssFileName}`,x=l.join(n,k);d.writeFileSync(x,m)}if(!f.generator)return;const p=f.generator._withBuildContext({callerName:C,isProduction:s,config:a}),w=await p.css;if(!w)continue;const $=`css/${p.cssFileName}`,y=l.join(n,$);d.writeFileSync(y,w),r[p.priority]||(r[p.priority]=[]),r[p.priority].push(p.cssFileName)}if(a.importStrategy!=="component")r.forEach((C,f)=>{const p=`l_${f}.css`,w=l.join(n,"css",p);let $=d.readFileSync(w,"utf8");C.forEach(y=>{var x;const i=l.join(n,"css",y),m=((x=/.*-([^-]+)-\d+.css/.exec(y))==null?void 0:x.at(1))||J(i,6);if(!$.includes(m)){const M=d.readFileSync(i,"utf8"),_=`/*start:${m}-${y}*/
36
36
  ${M}
37
37
  /*end:${m}*/
38
38
  `;$=`${$.replace(/\}$/,"")}
39
39
  ${_}
40
40
  }`}}),d.writeFileSync(w,$)});else{const C=r.flat().map(y=>`@import url('./${y}');`).join(`
41
- `),u=J(t,6),p=f.parse(t),w=R(p.name),$=f.join(n,`css/f_${w}-${u}.css`);d.writeFileSync($,C)}}}catch(n){console.error(n)}},Ke=async(e,t,s=le())=>{try{const n=await W(e);if(Y(t)){const r=d.readFileSync(t,"utf8");r.replace(/^(?!export\s)const\s.*/gm,p=>`export ${p}`)!==r&&await ie.writeFile(t,r);const g=await ce(e),{contents:C}=await ee(e,t,n);let u=r;if(Object.entries(C).forEach(([p,w])=>{var l;if(w.isKeyframes||!w.generator)return;const $=w.generator._withBuildContext({callerName:p,isProduction:s,config:g}),y=new RegExp(`\\s${p}[=\\s]+[^()]+styled\\(([^,]+),`,"g").exec(r);if(!y)return console.error("Could not find the original declaration");const i=(l=y.at(1))==null?void 0:l.trim(),m=new RegExp(`\\s${p}[=\\s]+styled\\(`,"g").exec(u);if(!m)return console.error("Could not find the original declaration");const{index:k}=m;let x=!1;const M=setTimeout(()=>x=!0,5e3);let _=0,T=!1,j=0;for(;!T&&!x;){const S=u[k+_];S==="("&&j++,S===")"&&j--,j===0&&S===")"&&(T=!0),_>u.length&&(x=!0),_++}if(!x)clearTimeout(M);else throw new Error("Failed to find the end of the styled call and timed out");const D=k+_,c=u.slice(k,D),h=u,b=` ${p} = styled(${i}, "${$.classNames}", ${JSON.stringify($.clientProps)});`;u=u.replace(c,b),h===u&&console.error("Minimize file failed to change content",{name:p,tagName:i})}),g.importStrategy==="component"){const p=J(t,6),w=f.parse(t);u=`import '../../saltygen/css/${`f_${R(w.name)}-${p}.css`}';
42
- ${u}`}return u=u.replace("{ styled }","{ styledClient as styled }"),u=u.replace("@salty-css/react/styled","@salty-css/react/styled-client"),u}}catch(n){console.error("Error in minimizeFile:",n)}};exports.generateCss=Be;exports.generateFile=Ge;exports.isSaltyFile=Y;exports.minimizeFile=Ke;exports.saltyFileRegExp=Ce;
41
+ `),f=J(t,6),p=l.parse(t),w=R(p.name),$=l.join(n,`css/f_${w}-${f}.css`);d.writeFileSync($,C||"/* Empty file */")}}}catch(n){console.error(n)}},Ke=async(e,t,s=le())=>{try{const n=await W(e);if(Y(t)){const r=d.readFileSync(t,"utf8");r.replace(/^(?!export\s)const\s.*/gm,p=>`export ${p}`)!==r&&await ie.writeFile(t,r);const g=await ce(e),{contents:C}=await ee(e,t,n);let f=r;if(Object.entries(C).forEach(([p,w])=>{var u;if(w.isKeyframes||!w.generator)return;const $=w.generator._withBuildContext({callerName:p,isProduction:s,config:g}),y=new RegExp(`\\s${p}[=\\s]+[^()]+styled\\(([^,]+),`,"g").exec(r);if(!y)return console.error("Could not find the original declaration");const i=(u=y.at(1))==null?void 0:u.trim(),m=new RegExp(`\\s${p}[=\\s]+styled\\(`,"g").exec(f);if(!m)return console.error("Could not find the original declaration");const{index:k}=m;let x=!1;const M=setTimeout(()=>x=!0,5e3);let _=0,T=!1,j=0;for(;!T&&!x;){const S=f[k+_];S==="("&&j++,S===")"&&j--,j===0&&S===")"&&(T=!0),_>f.length&&(x=!0),_++}if(!x)clearTimeout(M);else throw new Error("Failed to find the end of the styled call and timed out");const D=k+_,c=f.slice(k,D),h=f,b=` ${p} = styled(${i}, "${$.classNames}", ${JSON.stringify($.clientProps)});`;f=f.replace(c,b),h===f&&console.error("Minimize file failed to change content",{name:p,tagName:i})}),g.importStrategy==="component"){const p=J(t,6),w=l.parse(t);f=`import '../../saltygen/css/${`f_${R(w.name)}-${p}.css`}';
42
+ ${f}`}return f=f.replace("{ styled }","{ styledClient as styled }"),f=f.replace("@salty-css/react/styled","@salty-css/react/styled-client"),f}}catch(n){console.error("Error in minimizeFile:",n)}};exports.generateCss=Be;exports.generateFile=Ge;exports.isSaltyFile=Y;exports.minimizeFile=Ke;exports.saltyFileRegExp=Ce;
package/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("path"),t=require("./index-BnYubFKk.cjs"),y=require("fs/promises"),g=require("fs"),p=async e=>{if(!e||e.includes("node_modules")||e.includes("saltygen"))return!1;if(e.includes("salty.config"))return!0;if(!t.isSaltyFile(e))return!1;const a=await y.readFile(e,"utf-8");return!!/.+define[A-Z]\w+/.test(a)},c=(e,s,l=!1,a=!1)=>{var n,u,i;(u=(n=e.module)==null?void 0:n.rules)==null||u.push({test:t.saltyFileRegExp(),use:[{loader:d.resolve(__dirname,a?"./loader.cjs":"./loader.js"),options:{dir:s}}]}),l||(i=e.plugins)==null||i.push({apply:f=>{let o=!1;f.hooks.watchRun.tapPromise({name:"generateCss"},async()=>{o||(o=!0,await t.generateCss(s),g.watch(s,{recursive:!0},async(h,r)=>{await p(r)?await t.generateCss(s,!1,!1):t.isSaltyFile(r)&&await t.generateFile(s,r)}))})}})};exports.default=c;exports.saltyPlugin=c;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("path"),t=require("./index-BG0kLkBd.cjs"),y=require("fs/promises"),g=require("fs"),p=async e=>{if(!e||e.includes("node_modules")||e.includes("saltygen"))return!1;if(e.includes("salty.config"))return!0;if(!t.isSaltyFile(e))return!1;const a=await y.readFile(e,"utf-8");return!!/.+define[A-Z]\w+/.test(a)},c=(e,s,l=!1,a=!1)=>{var n,u,i;(u=(n=e.module)==null?void 0:n.rules)==null||u.push({test:t.saltyFileRegExp(),use:[{loader:d.resolve(__dirname,a?"./loader.cjs":"./loader.js"),options:{dir:s}}]}),l||(i=e.plugins)==null||i.push({apply:f=>{let o=!1;f.hooks.watchRun.tapPromise({name:"generateCss"},async()=>{o||(o=!0,await t.generateCss(s),g.watch(s,{recursive:!0},async(h,r)=>{await p(r)?await t.generateCss(s,!1,!1):t.isSaltyFile(r)&&await t.generateFile(s,r)}))})}})};exports.default=c;exports.saltyPlugin=c;
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { resolve as d } from "path";
2
- import { i as f, s as p, g as u, a as y } from "./index-BOtuFF93.js";
2
+ import { i as f, s as p, g as u, a as y } from "./index-B3z-tgrO.js";
3
3
  import { readFile as g } from "fs/promises";
4
4
  import { watch as m } from "fs";
5
5
  const w = async (s) => {
package/loader.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";const i=require("./index-BnYubFKk.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-BG0kLkBd.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-BOtuFF93.js";
1
+ import { a as e, m as i } from "./index-B3z-tgrO.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.208",
3
+ "version": "0.0.1-alpha.209",
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.208",
37
+ "@salty-css/core": "^0.0.1-alpha.209",
38
38
  "webpack": ">=5.x"
39
39
  }
40
40
  }