@salty-css/webpack 0.0.1-alpha.189 → 0.0.1-alpha.190
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{index-DwOltaBl.js → index-BthpPBL_.js} +170 -169
- package/index-LHz82WN_.cjs +37 -0
- package/index.cjs +1 -1
- package/index.js +1 -1
- package/loader.cjs +1 -1
- package/loader.js +1 -1
- package/package.json +2 -2
- package/index-BaNRirm4.cjs +0 -37
@@ -3,7 +3,7 @@ import { execSync as wt } from "child_process";
|
|
3
3
|
import { join as f, parse as q } from "path";
|
4
4
|
import { existsSync as et, writeFileSync as k, readFileSync as V, mkdirSync as z, statSync as jt, readdirSync as Ct } from "fs";
|
5
5
|
import { readFile as lt, writeFile as Ft } from "fs/promises";
|
6
|
-
import { createLogger as
|
6
|
+
import { createLogger as Nt, format as v, transports as xt } from "winston";
|
7
7
|
const it = (t) => String.fromCharCode(t + (t > 25 ? 39 : 97)), kt = (t, e) => {
|
8
8
|
let s = "", o;
|
9
9
|
for (o = Math.abs(t); o > 52; o = o / 52 | 0) s = it(o % 52) + s;
|
@@ -26,56 +26,56 @@ const Dt = (t, e) => {
|
|
26
26
|
return Object.values(e).forEach((o) => {
|
27
27
|
const { pattern: i, transform: a } = o;
|
28
28
|
t = t.replace(i, (c) => {
|
29
|
-
const { value:
|
30
|
-
return r && s.push(r),
|
29
|
+
const { value: p, css: r } = a(c);
|
30
|
+
return r && s.push(r), p;
|
31
31
|
});
|
32
32
|
}), { result: t, additionalCss: s };
|
33
33
|
}, ft = (t) => typeof t != "string" ? { result: t } : /\{[^{}]+\}/g.test(t) ? { result: t.replace(/\{([^{}]+)\}/g, (...o) => `var(--${M(o[1].replaceAll(".", "-"))})`) } : { result: t }, J = (t, e, s) => {
|
34
34
|
if (!t) return "";
|
35
|
-
const o = [], i = Object.entries(t).reduce((c, [
|
36
|
-
const n =
|
35
|
+
const o = [], i = Object.entries(t).reduce((c, [p, r]) => {
|
36
|
+
const n = p.trim();
|
37
37
|
if (typeof r == "function" && (r = r()), typeof r == "object") {
|
38
38
|
if (!r) return c;
|
39
39
|
if (n === "variants")
|
40
|
-
return Object.entries(r).forEach(([D,
|
41
|
-
|
40
|
+
return Object.entries(r).forEach(([D, b]) => {
|
41
|
+
b && Object.entries(b).forEach(([_, l]) => {
|
42
42
|
if (!l) return;
|
43
|
-
const
|
44
|
-
o.push(
|
43
|
+
const h = `${e}.${D}-${_}`, S = J(l, h);
|
44
|
+
o.push(S);
|
45
45
|
});
|
46
46
|
}), c;
|
47
47
|
if (n === "defaultVariants")
|
48
48
|
return c;
|
49
49
|
if (n === "compoundVariants")
|
50
50
|
return r.forEach((D) => {
|
51
|
-
const { css:
|
52
|
-
o.push(
|
51
|
+
const { css: b, ..._ } = D, l = Object.entries(_).reduce((S, [u, N]) => `${S}.${u}-${N}`, e), h = J(b, l);
|
52
|
+
o.push(h);
|
53
53
|
}), c;
|
54
54
|
if (n.startsWith("@")) {
|
55
|
-
const D = J(r, e),
|
55
|
+
const D = J(r, e), b = `${n} {
|
56
56
|
${D.replace(`
|
57
57
|
`, `
|
58
58
|
`)}
|
59
59
|
}`;
|
60
|
-
return o.push(
|
60
|
+
return o.push(b), c;
|
61
61
|
}
|
62
|
-
const
|
63
|
-
return o.push(
|
62
|
+
const j = p.includes("&") ? n.replace("&", e) : n.startsWith(":") ? `${e}${n}` : `${e} ${n}`, F = J(r, j);
|
63
|
+
return o.push(F), c;
|
64
64
|
}
|
65
|
-
const
|
66
|
-
if (typeof r == "number") return
|
65
|
+
const g = n.startsWith("-") ? n : M(n), d = (j, F = ";") => c = `${c}${j}${F}`, m = (j) => d(`${g}:${j}`);
|
66
|
+
if (typeof r == "number") return m(r);
|
67
67
|
if (typeof r != "string")
|
68
68
|
if ("toString" in r) r = r.toString();
|
69
69
|
else return c;
|
70
|
-
const { modifiers:
|
71
|
-
yield ft(r), yield Dt(r,
|
70
|
+
const { modifiers: $ } = {}, E = function* () {
|
71
|
+
yield ft(r), yield Dt(r, $);
|
72
72
|
}();
|
73
|
-
for (const { result:
|
74
|
-
r =
|
75
|
-
const
|
76
|
-
|
73
|
+
for (const { result: j, additionalCss: F = [] } of E)
|
74
|
+
r = j, F.forEach((D) => {
|
75
|
+
const b = J(D, "");
|
76
|
+
d(b, "");
|
77
77
|
});
|
78
|
-
return
|
78
|
+
return m(r);
|
79
79
|
}, "");
|
80
80
|
return i ? e ? [`${e} { ${i} }`, ...o].join(`
|
81
81
|
`) : i : o.join(`
|
@@ -86,8 +86,8 @@ const Dt = (t, e) => {
|
|
86
86
|
if (Object.entries(t).forEach(([i, a]) => {
|
87
87
|
if (typeof a == "object") {
|
88
88
|
if (!a) return;
|
89
|
-
const c = i.trim(),
|
90
|
-
s.push(
|
89
|
+
const c = i.trim(), p = ut(a, [...e, c]);
|
90
|
+
s.push(p);
|
91
91
|
} else
|
92
92
|
o[i] = a;
|
93
93
|
}), Object.keys(o).length) {
|
@@ -113,17 +113,17 @@ const Dt = (t, e) => {
|
|
113
113
|
return e.type;
|
114
114
|
};
|
115
115
|
let W;
|
116
|
-
const
|
116
|
+
const mt = async (t) => {
|
117
117
|
if (W) return W;
|
118
118
|
const e = await _t(t);
|
119
119
|
return e === "module" ? W = "esm" : (e === "commonjs" || import.meta.url.endsWith(".cjs")) && (W = "cjs"), W || "esm";
|
120
|
-
}, tt =
|
120
|
+
}, tt = Nt({
|
121
121
|
level: "debug",
|
122
122
|
format: v.combine(v.colorize(), v.cli()),
|
123
|
-
transports: [new
|
123
|
+
transports: [new xt.Console({})]
|
124
124
|
});
|
125
|
-
function
|
126
|
-
return t ? typeof t != "string" ?
|
125
|
+
function gt(t) {
|
126
|
+
return t ? typeof t != "string" ? gt(String(t)) : t.replace(/[\s-]/g, ".").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g, (e, s) => (s > 0 ? "." : "") + e.toLowerCase()) : "";
|
127
127
|
}
|
128
128
|
const Ot = {
|
129
129
|
/** Set box model to border-box */
|
@@ -196,7 +196,7 @@ const Ot = {
|
|
196
196
|
const e = await $t(t), s = (o = e.projects) == null ? void 0 : o.find((a) => t.endsWith(a.dir || ""));
|
197
197
|
return s || ((i = e.projects) == null ? void 0 : i.find((a) => a.dir === e.defaultProject));
|
198
198
|
}, Mt = async (t) => {
|
199
|
-
const e = await nt(t), s = await A(t), o = f(t, (e == null ? void 0 : e.configDir) || "", "salty.config.ts"), i = f(s, "salty.config.js"), a = await
|
199
|
+
const e = await nt(t), s = await A(t), o = f(t, (e == null ? void 0 : e.configDir) || "", "salty.config.ts"), i = f(s, "salty.config.js"), a = await mt(t), c = ht(o);
|
200
200
|
await at.build({
|
201
201
|
entryPoints: [o],
|
202
202
|
minify: !0,
|
@@ -206,44 +206,44 @@ const Ot = {
|
|
206
206
|
format: a,
|
207
207
|
external: c
|
208
208
|
});
|
209
|
-
const
|
209
|
+
const p = Date.now(), { config: r } = await import(`${i}?t=${p}`);
|
210
210
|
return r;
|
211
211
|
}, Jt = async (t, e) => {
|
212
212
|
var B, K;
|
213
|
-
const s = await Mt(t), o = { ...s }, i = /* @__PURE__ */ new Set(), a = (
|
213
|
+
const s = await Mt(t), o = { ...s }, i = /* @__PURE__ */ new Set(), a = (C, x = []) => C ? Object.entries(C).flatMap(([R, T]) => {
|
214
214
|
if (!T) return;
|
215
|
-
if (typeof T == "object") return a(T, [...
|
216
|
-
const Q =
|
215
|
+
if (typeof T == "object") return a(T, [...x, R]);
|
216
|
+
const Q = gt(R), U = M(R), X = [...x, Q].join(".");
|
217
217
|
i.add(`"${X}"`);
|
218
|
-
const Y = [...
|
218
|
+
const Y = [...x.map(M), U].join("-"), { result: St } = ft(T);
|
219
219
|
return `--${Y}: ${St};`;
|
220
|
-
}) : [], c = (
|
220
|
+
}) : [], c = (C) => C ? Object.entries(C).flatMap(([x, R]) => {
|
221
221
|
const T = a(R);
|
222
|
-
return
|
223
|
-
}) : [],
|
224
|
-
const U = a(Q, [
|
222
|
+
return x === "base" ? T.join("") : `${x} { ${T.join("")} }`;
|
223
|
+
}) : [], p = (C) => C ? Object.entries(C).flatMap(([x, R]) => Object.entries(R).flatMap(([T, Q]) => {
|
224
|
+
const U = a(Q, [x]), X = `.${x}-${T}, [data-${x}="${T}"]`, Y = U.join("");
|
225
225
|
return `${X} { ${Y} }`;
|
226
|
-
})) : [], r = (
|
226
|
+
})) : [], r = (C) => ({ ...C, responsive: void 0, conditional: void 0 }), n = (C) => e.variables.map((x) => C === "static" ? r(x._current) : x._current[C]), g = a(Z(r(s.variables), n("static"))), d = c(Z((B = s.variables) == null ? void 0 : B.responsive, n("responsive"))), m = p(Z((K = s.variables) == null ? void 0 : K.conditional, n("conditional"))), $ = await A(t), P = f($, "css/_variables.css"), E = `:root { ${g.join("")} ${d.join("")} } ${m.join("")}`;
|
227
227
|
k(P, E);
|
228
|
-
const
|
229
|
-
k(
|
230
|
-
const
|
231
|
-
k(
|
232
|
-
const
|
233
|
-
k(
|
234
|
-
const
|
228
|
+
const j = f($, "css/_global.css"), F = Z(s.global, e.globalStyles), D = J(F, "");
|
229
|
+
k(j, `@layer global { ${D} }`);
|
230
|
+
const b = f($, "css/_reset.css"), l = s.reset === "none" ? {} : typeof s.reset == "object" ? s.reset : Ot, h = J(l, "");
|
231
|
+
k(b, `@layer reset { ${h} }`);
|
232
|
+
const S = f($, "css/_templates.css"), u = Z(s.templates, e.templates), N = ut(u), w = Et(u);
|
233
|
+
k(S, N), o.templates = u;
|
234
|
+
const y = f($, "types/css-tokens.d.ts"), I = `
|
235
235
|
// Variable types
|
236
236
|
type VariableTokens = ${[...i].join("|")};
|
237
237
|
type PropertyValueToken = \`{\${VariableTokens}}\`;
|
238
238
|
|
239
239
|
// Template types
|
240
240
|
type TemplateTokens = {
|
241
|
-
${Object.entries(
|
241
|
+
${Object.entries(w).map(([C, x]) => `${C}?: ${x}`).join(`
|
242
242
|
`)}
|
243
243
|
}
|
244
244
|
`;
|
245
|
-
k(
|
246
|
-
const L = f(
|
245
|
+
k(y, I);
|
246
|
+
const L = f($, "cache/config-cache.json");
|
247
247
|
k(L, JSON.stringify(o, null, 2));
|
248
248
|
}, ct = (t) => t.replace(/styled\(([^"'`{,]+),/g, (e, s) => {
|
249
249
|
if (/^['"`]/.test(s)) return e;
|
@@ -251,8 +251,8 @@ const Ot = {
|
|
251
251
|
if (!i.test(t)) return e;
|
252
252
|
const c = i.exec(t);
|
253
253
|
if (c) {
|
254
|
-
const
|
255
|
-
if (yt.some((n) =>
|
254
|
+
const p = c.at(1);
|
255
|
+
if (yt.some((n) => p == null ? void 0 : p.includes(n))) return e;
|
256
256
|
}
|
257
257
|
return "styled('div',";
|
258
258
|
}), ot = async (t, e, s) => {
|
@@ -261,7 +261,7 @@ const Ot = {
|
|
261
261
|
const a = q(e);
|
262
262
|
let c = V(e, "utf8");
|
263
263
|
c = ct(c);
|
264
|
-
const
|
264
|
+
const p = f(s, "js", o + ".js"), r = await nt(t), n = f(t, (r == null ? void 0 : r.configDir) || "", "salty.config.ts"), g = ht(n), d = await mt(t);
|
265
265
|
await at.build({
|
266
266
|
stdin: {
|
267
267
|
contents: c,
|
@@ -272,26 +272,26 @@ const Ot = {
|
|
272
272
|
minify: !1,
|
273
273
|
treeShaking: !0,
|
274
274
|
bundle: !0,
|
275
|
-
outfile:
|
276
|
-
format:
|
275
|
+
outfile: p,
|
276
|
+
format: d,
|
277
277
|
target: ["node20"],
|
278
278
|
keepNames: !0,
|
279
|
-
external:
|
279
|
+
external: g,
|
280
280
|
packages: "external",
|
281
281
|
plugins: [
|
282
282
|
{
|
283
283
|
name: "test",
|
284
284
|
setup: (P) => {
|
285
285
|
P.onLoad({ filter: /.*\.css|salty|styles|styled\.ts/ }, (E) => {
|
286
|
-
const
|
287
|
-
return { contents: ct(
|
286
|
+
const j = V(E.path, "utf8");
|
287
|
+
return { contents: ct(j), loader: "ts" };
|
288
288
|
});
|
289
289
|
}
|
290
290
|
}
|
291
291
|
]
|
292
292
|
});
|
293
|
-
const
|
294
|
-
return await import(`${
|
293
|
+
const m = Date.now();
|
294
|
+
return await import(`${p}?t=${m}`);
|
295
295
|
}, Rt = async (t) => {
|
296
296
|
const e = await A(t), s = f(e, "cache/config-cache.json"), o = V(s, "utf8");
|
297
297
|
if (!o) throw new Error("Could not find config cache file");
|
@@ -309,7 +309,7 @@ const Ot = {
|
|
309
309
|
try {
|
310
310
|
const o = Date.now();
|
311
311
|
e ? tt.info("Generating CSS in production mode! 🔥") : tt.info("Generating CSS in development mode! 🚀");
|
312
|
-
const i = [], a = [], c = await A(t),
|
312
|
+
const i = [], a = [], c = await A(t), p = f(c, "index.css");
|
313
313
|
s && (() => {
|
314
314
|
et(c) && wt("rm -rf " + c), z(c, { recursive: !0 }), z(f(c, "css")), z(f(c, "types")), z(f(c, "js")), z(f(c, "cache"));
|
315
315
|
})();
|
@@ -322,65 +322,66 @@ const Ot = {
|
|
322
322
|
components: [],
|
323
323
|
classNames: []
|
324
324
|
};
|
325
|
-
async function
|
326
|
-
const
|
327
|
-
if (
|
328
|
-
const
|
329
|
-
if (
|
330
|
-
await Promise.all(
|
331
|
-
} else if (
|
332
|
-
const
|
333
|
-
Object.entries(
|
334
|
-
|
335
|
-
value:
|
325
|
+
async function g(l) {
|
326
|
+
const h = ["node_modules", "saltygen"], S = jt(l);
|
327
|
+
if (S.isDirectory()) {
|
328
|
+
const u = Ct(l);
|
329
|
+
if (h.some((w) => l.includes(w))) return;
|
330
|
+
await Promise.all(u.map((w) => g(f(l, w))));
|
331
|
+
} else if (S.isFile() && st(l)) {
|
332
|
+
const N = await ot(t, l, c);
|
333
|
+
Object.entries(N).forEach(([w, y]) => {
|
334
|
+
y.isKeyframes ? n.keyframes.push({
|
335
|
+
value: y,
|
336
336
|
src: l,
|
337
|
-
name:
|
338
|
-
}) :
|
339
|
-
|
337
|
+
name: w
|
338
|
+
}) : y.isMedia ? n.mediaQueries.push(y) : y.isGlobalDefine ? n.globalStyles.push(y) : y.isDefineVariables ? n.variables.push(y) : y.isDefineTemplates ? n.templates.push(y) : y.isClassName ? n.classNames.push({
|
339
|
+
...y,
|
340
340
|
src: l,
|
341
|
-
name:
|
342
|
-
}) :
|
343
|
-
|
341
|
+
name: w
|
342
|
+
}) : y.generator && n.components.push({
|
343
|
+
...y,
|
344
344
|
src: l,
|
345
|
-
name:
|
345
|
+
name: w
|
346
346
|
});
|
347
347
|
});
|
348
348
|
}
|
349
349
|
}
|
350
|
-
await
|
351
|
-
const
|
350
|
+
await g(t), await Jt(t, n);
|
351
|
+
const d = await rt(t);
|
352
352
|
for (const l of n.keyframes) {
|
353
|
-
const { value:
|
354
|
-
i.push(
|
353
|
+
const { value: h } = l, S = `a_${h.animationName}.css`, u = `css/${S}`, N = f(c, u);
|
354
|
+
i.push(S), k(N, h.css);
|
355
355
|
}
|
356
|
-
const
|
356
|
+
const m = {};
|
357
357
|
for (const l of n.components) {
|
358
|
-
const {
|
359
|
-
|
360
|
-
|
361
|
-
|
358
|
+
const { src: h, name: S } = l, u = l.generator._withBuildContext({
|
359
|
+
callerName: S,
|
360
|
+
isProduction: e,
|
361
|
+
config: d
|
362
362
|
});
|
363
|
-
a[
|
364
|
-
const
|
365
|
-
k(
|
363
|
+
a[u.priority] || (a[u.priority] = []), a[u.priority].push(u.cssFileName);
|
364
|
+
const N = `css/${u.cssFileName}`, w = f(c, N);
|
365
|
+
k(w, u.css), d.importStrategy === "component" && (m[h] ? m[h].push(u.cssFileName) : m[h] = [u.cssFileName]);
|
366
366
|
}
|
367
367
|
for (const l of n.classNames) {
|
368
|
-
const {
|
369
|
-
|
370
|
-
|
368
|
+
const { src: h, name: S } = l, u = l.generator._withBuildContext({
|
369
|
+
callerName: S,
|
370
|
+
isProduction: e,
|
371
|
+
config: d
|
371
372
|
});
|
372
|
-
a[0].push(
|
373
|
-
const
|
374
|
-
k(
|
373
|
+
a[0].push(u.cssFileName);
|
374
|
+
const N = `css/${u.cssFileName}`, w = f(c, N);
|
375
|
+
k(w, u.css), d.importStrategy === "component" && (m[h] ? m[h].push(u.cssFileName) : m[h] = [u.cssFileName]);
|
375
376
|
}
|
376
|
-
|
377
|
-
const
|
378
|
-
`),
|
379
|
-
k(
|
377
|
+
d.importStrategy === "component" && Object.entries(m).forEach(([l, h]) => {
|
378
|
+
const S = h.map((G) => `@import url('./${G}');`).join(`
|
379
|
+
`), u = H(l, 6), N = q(l), w = M(N.name), y = f(c, `css/f_${w}-${u}.css`);
|
380
|
+
k(y, S);
|
380
381
|
});
|
381
|
-
const
|
382
|
+
const $ = i.map((l) => `@import url('./css/${l}');`).join(`
|
382
383
|
`);
|
383
|
-
let
|
384
|
+
let F = `@layer reset, global, l0, l1, l2, l3, l4, l5, l6, l7, l8;
|
384
385
|
|
385
386
|
${["_variables.css", "_reset.css", "_global.css", "_templates.css"].filter((l) => {
|
386
387
|
try {
|
@@ -390,27 +391,27 @@ ${["_variables.css", "_reset.css", "_global.css", "_templates.css"].filter((l) =
|
|
390
391
|
}
|
391
392
|
}).map((l) => `@import url('./css/${l}');`).join(`
|
392
393
|
`)}
|
393
|
-
${
|
394
|
-
if (
|
395
|
-
const l = a.reduce((
|
396
|
-
const
|
397
|
-
var
|
398
|
-
const B = f(c, "css", L), K = V(B, "utf8"),
|
399
|
-
return I.includes(
|
400
|
-
/*start:${
|
394
|
+
${$}`;
|
395
|
+
if (d.importStrategy !== "component") {
|
396
|
+
const l = a.reduce((h, S, u) => {
|
397
|
+
const N = S.reduce((I, L) => {
|
398
|
+
var x;
|
399
|
+
const B = f(c, "css", L), K = V(B, "utf8"), C = ((x = /.*-([^-]+)-\d+.css/.exec(L)) == null ? void 0 : x.at(1)) || H(B, 6);
|
400
|
+
return I.includes(C) ? I : `${I}
|
401
|
+
/*start:${C}*/
|
401
402
|
${K}
|
402
|
-
/*end:${
|
403
|
+
/*end:${C}*/
|
403
404
|
`;
|
404
|
-
}, ""),
|
405
|
+
}, ""), w = `l_${u}.css`, y = f(c, "css", w), G = `@layer l${u} { ${N}
|
405
406
|
}`;
|
406
|
-
return k(
|
407
|
-
@import url('./css/${
|
407
|
+
return k(y, G), `${h}
|
408
|
+
@import url('./css/${w}');`;
|
408
409
|
}, "");
|
409
|
-
|
410
|
+
F += l;
|
410
411
|
}
|
411
|
-
k(
|
412
|
-
const
|
413
|
-
tt.info(`Generated CSS in ${
|
412
|
+
k(p, F);
|
413
|
+
const b = Date.now() - o, _ = b < 200 ? "🔥" : b < 500 ? "🚀" : b < 1e3 ? "🎉" : b < 2e3 ? "🚗" : b < 5e3 ? "🤔" : "🥴";
|
414
|
+
tt.info(`Generated CSS in ${b}ms! ${_}`);
|
414
415
|
} catch (o) {
|
415
416
|
console.error(o);
|
416
417
|
}
|
@@ -419,48 +420,48 @@ ${K}
|
|
419
420
|
const s = await A(t);
|
420
421
|
if (st(e)) {
|
421
422
|
const i = [], a = await rt(t), c = await ot(t, e, s);
|
422
|
-
if (Object.entries(c).forEach(([
|
423
|
+
if (Object.entries(c).forEach(([p, r]) => {
|
423
424
|
if (r.isKeyframes && r.css) {
|
424
|
-
const
|
425
|
+
const $ = `css/${`a_${r.animationName}.css`}`, P = f(s, $);
|
425
426
|
k(P, r.css);
|
426
427
|
return;
|
427
428
|
}
|
428
429
|
if (r.isClassName) {
|
429
|
-
const
|
430
|
-
name:
|
430
|
+
const m = r.factory._withBuildContext({
|
431
|
+
name: p
|
431
432
|
});
|
432
|
-
i[0].push(
|
433
|
-
const
|
434
|
-
k(P,
|
433
|
+
i[0].push(m.cssFileName);
|
434
|
+
const $ = `css/${m.cssFileName}`, P = f(s, $);
|
435
|
+
k(P, m.css);
|
435
436
|
}
|
436
437
|
if (!r.generator) return;
|
437
438
|
const n = r.generator._withBuildContext({
|
438
|
-
name:
|
439
|
+
name: p,
|
439
440
|
config: a
|
440
|
-
}),
|
441
|
-
k(
|
441
|
+
}), g = `css/${n.cssFileName}`, d = f(s, g);
|
442
|
+
k(d, n.css), i[n.priority] || (i[n.priority] = []), i[n.priority].push(n.cssFileName);
|
442
443
|
}), a.importStrategy !== "component")
|
443
|
-
i.forEach((
|
444
|
-
const n = `l_${r}.css`,
|
445
|
-
let
|
446
|
-
|
447
|
-
var
|
448
|
-
const
|
449
|
-
if (!
|
450
|
-
const
|
451
|
-
${
|
444
|
+
i.forEach((p, r) => {
|
445
|
+
const n = `l_${r}.css`, g = f(s, "css", n);
|
446
|
+
let d = V(g, "utf8");
|
447
|
+
p.forEach((m) => {
|
448
|
+
var j;
|
449
|
+
const $ = f(s, "css", m), P = ((j = /.*-([^-]+)-\d+.css/.exec(m)) == null ? void 0 : j.at(1)) || H($, 6);
|
450
|
+
if (!d.includes(P)) {
|
451
|
+
const F = V($, "utf8"), D = `/*start:${P}*/
|
452
|
+
${F}
|
452
453
|
/*end:${P}*/
|
453
454
|
`;
|
454
|
-
|
455
|
+
d = `${d.replace(/\}$/, "")}
|
455
456
|
${D}
|
456
457
|
}`;
|
457
458
|
}
|
458
|
-
}), k(
|
459
|
+
}), k(g, d);
|
459
460
|
});
|
460
461
|
else {
|
461
|
-
const
|
462
|
-
`), r = H(e, 6), n = q(e),
|
463
|
-
k(
|
462
|
+
const p = i.flat().map((m) => `@import url('./${m}');`).join(`
|
463
|
+
`), r = H(e, 6), n = q(e), g = M(n.name), d = f(s, `css/f_${g}-${r}.css`);
|
464
|
+
k(d, p);
|
464
465
|
}
|
465
466
|
}
|
466
467
|
} catch (s) {
|
@@ -471,35 +472,35 @@ ${D}
|
|
471
472
|
const o = await A(t);
|
472
473
|
if (st(e)) {
|
473
474
|
const a = V(e, "utf8");
|
474
|
-
a.replace(/^(?!export\s)const\s.*/gm, (
|
475
|
-
const
|
475
|
+
a.replace(/^(?!export\s)const\s.*/gm, (g) => `export ${g}`) !== a && await Ft(e, a);
|
476
|
+
const p = await rt(t), r = await ot(t, e, o);
|
476
477
|
let n = a;
|
477
|
-
if (Object.entries(r).forEach(([
|
478
|
-
var
|
479
|
-
if (
|
480
|
-
const
|
481
|
-
name:
|
482
|
-
config:
|
478
|
+
if (Object.entries(r).forEach(([g, d]) => {
|
479
|
+
var w;
|
480
|
+
if (d.isKeyframes || !d.generator) return;
|
481
|
+
const m = d.generator._withBuildContext({
|
482
|
+
name: g,
|
483
|
+
config: p,
|
483
484
|
prod: s
|
484
|
-
}),
|
485
|
-
if (
|
486
|
-
const P = (
|
485
|
+
}), $ = new RegExp(`\\s${g}[=\\s]+[^()]+styled\\(([^,]+),`, "g").exec(a);
|
486
|
+
if (!$) return console.error("Could not find the original declaration");
|
487
|
+
const P = (w = $.at(1)) == null ? void 0 : w.trim(), E = new RegExp(`\\s${g}[=\\s]+styled\\(`, "g").exec(n);
|
487
488
|
if (!E) return console.error("Could not find the original declaration");
|
488
|
-
const { index:
|
489
|
-
let
|
490
|
-
const D = setTimeout(() =>
|
491
|
-
let
|
492
|
-
for (; !_ && !
|
493
|
-
const
|
494
|
-
|
489
|
+
const { index: j } = E;
|
490
|
+
let F = !1;
|
491
|
+
const D = setTimeout(() => F = !0, 5e3);
|
492
|
+
let b = 0, _ = !1, l = 0;
|
493
|
+
for (; !_ && !F; ) {
|
494
|
+
const y = n[j + b];
|
495
|
+
y === "(" && l++, y === ")" && l--, l === 0 && y === ")" && (_ = !0), b > n.length && (F = !0), b++;
|
495
496
|
}
|
496
|
-
if (!
|
497
|
+
if (!F) clearTimeout(D);
|
497
498
|
else throw new Error("Failed to find the end of the styled call and timed out");
|
498
|
-
const
|
499
|
-
n = n.replace(
|
500
|
-
}),
|
501
|
-
const
|
502
|
-
n = `import '../../saltygen/css/${`f_${M(
|
499
|
+
const h = j + b, S = n.slice(j, h), u = n, N = ` ${g} = styled(${P}, "${m.classNames}", ${JSON.stringify(m.clientProps)});`;
|
500
|
+
n = n.replace(S, N), u === n && console.error("Minimize file failed to change content", { name: g, tagName: P });
|
501
|
+
}), p.importStrategy === "component") {
|
502
|
+
const g = H(e, 6), d = q(e);
|
503
|
+
n = `import '../../saltygen/css/${`f_${M(d.name)}-${g}.css`}';
|
503
504
|
${n}`;
|
504
505
|
}
|
505
506
|
return n = n.replace("{ styled }", "{ styledClient as styled }"), n = n.replace("@salty-css/react/styled", "@salty-css/react/styled-client"), n;
|
@@ -0,0 +1,37 @@
|
|
1
|
+
"use strict";const $e=require("esbuild"),je=require("child_process"),l=require("path"),u=require("fs"),ee=require("fs/promises"),q=require("winston");var Y=typeof document<"u"?document.currentScript:null;function be(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 ie=be($e),oe=e=>String.fromCharCode(e+(e>25?39:97)),we=(e,t)=>{let s="",n;for(n=Math.abs(e);n>52;n=n/52|0)s=oe(n%52)+s;return s=oe(n%52)+s,s.length<t?s=s.padStart(t,"a"):s.length>t&&(s=s.slice(-t)),s},Fe=(e,t)=>{let s=t.length;for(;s;)e=e*33^t.charCodeAt(--s);return e},W=(e,t=5)=>{const s=Fe(5381,JSON.stringify(e))>>>0;return we(s,t)};function V(e){return e?typeof e!="string"?V(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 Ce=(e,t)=>{if(typeof e!="string")return{result:e};if(!t)return{result:e};const s=[];return Object.values(t).forEach(n=>{const{pattern:i,transform:a}=n;e=e.replace(i,c=>{const{value:d,css:r}=a(c);return r&&s.push(r),d})}),{result:e,additionalCss:s}},ce=e=>typeof e!="string"?{result:e}:/\{[^{}]+\}/g.test(e)?{result:e.replace(/\{([^{}]+)\}/g,(...n)=>`var(--${V(n[1].replaceAll(".","-"))})`)}:{result:e},M=(e,t,s)=>{if(!e)return"";const n=[],i=Object.entries(e).reduce((c,[d,r])=>{const o=d.trim();if(typeof r=="function"&&(r=r()),typeof r=="object"){if(!r)return c;if(o==="variants")return Object.entries(r).forEach(([D,j])=>{j&&Object.entries(j).forEach(([E,f])=>{if(!f)return;const h=`${t}.${D}-${E}`,b=M(f,h);n.push(b)})}),c;if(o==="defaultVariants")return c;if(o==="compoundVariants")return r.forEach(D=>{const{css:j,...E}=D,f=Object.entries(E).reduce((b,[p,x])=>`${b}.${p}-${x}`,t),h=M(j,f);n.push(h)}),c;if(o.startsWith("@")){const D=M(r,t),j=`${o} {
|
2
|
+
${D.replace(`
|
3
|
+
`,`
|
4
|
+
`)}
|
5
|
+
}`;return n.push(j),c}const F=d.includes("&")?o.replace("&",t):o.startsWith(":")?`${t}${o}`:`${t} ${o}`,N=M(r,F);return n.push(N),c}const m=o.startsWith("-")?o:V(o),y=(F,N=";")=>c=`${c}${F}${N}`,g=F=>y(`${m}:${F}`);if(typeof r=="number")return g(r);if(typeof r!="string")if("toString"in r)r=r.toString();else return c;const{modifiers:$}={},_=function*(){yield ce(r),yield Ce(r,$)}();for(const{result:F,additionalCss:N=[]}of _)r=F,N.forEach(D=>{const j=M(D,"");y(j,"")});return g(r)},"");return i?t?[`${t} { ${i} }`,...n].join(`
|
6
|
+
`):i:n.join(`
|
7
|
+
`)},ae=(e,t=[])=>{if(!e)return"";const s=[],n={};if(Object.entries(e).forEach(([i,a])=>{if(typeof a=="object"){if(!a)return;const c=i.trim(),d=ae(a,[...t,c]);s.push(d)}else n[i]=a}),Object.keys(n).length){const i=t.map(V).join("-"),a=M(n,`.${i}`);s.push(a)}return s.join(`
|
8
|
+
`)},Ne=e=>e?Object.entries(e).reduce((t,[s,n])=>(typeof n=="object"&&(t[s]=le(n).map(i=>`"${i}"`).join(" | ")),t),{}):{},le=(e,t="",s=new Set)=>e?(Object.entries(e).forEach(([n,i])=>{const a=t?`${t}.${n}`:n;return typeof i=="object"?le(i,a,s):s.add(t)}),[...s]):[],fe=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:fe(l.join(e,".."))},xe=async e=>{const t=fe(e);return await ee.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},ke=async e=>{const t=await xe(e);if(t)return t.type};let z;const ue=async e=>{if(z)return z;const t=await ke(e);return t==="module"?z="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:Y&&Y.tagName.toUpperCase()==="SCRIPT"&&Y.src||new URL("index-LHz82WN_.cjs",document.baseURI).href).endsWith(".cjs"))&&(z="cjs"),z||"esm"},v=q.createLogger({level:"debug",format:q.format.combine(q.format.colorize(),q.format.cli()),transports:[new q.transports.Console({})]});function pe(e){return e?typeof e!="string"?pe(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 Pe={"*, *::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"}},A=(...e)=>e.flat().reduce((t,s)=>s!=null&&s._current?{...t,...s._current}:{...t,...s},{}),O={externalModules:[],rcFile:void 0,destDir:void 0},de=e=>{if(O.externalModules.length>0)return O.externalModules;const s=u.readFileSync(e,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!s)return[];const n=s[1].split(",").map(i=>i.replace(/['"`]/g,"").trim());return O.externalModules=n,n},J=async e=>{if(O.destDir)return O.destDir;const t=await te(e),s=l.join(e,(t==null?void 0:t.saltygenDir)||"saltygen");return O.destDir=s,s},ye=["salty","css","styles","styled"],ge=(e=[])=>new RegExp(`\\.(${[...ye,...e].join("|")})\\.`),G=(e,t=[])=>ge(t).test(e),me=async e=>{if(O.rcFile)return O.rcFile;if(e==="/")throw new Error("Could not find .saltyrc.json file");const t=l.join(e,".saltyrc.json"),s=await ee.readFile(t,"utf-8").then(JSON.parse).catch(()=>{});return s?(O.rcFile=s,s):me(l.join(e,".."))},te=async e=>{var n,i;const t=await me(e),s=(n=t.projects)==null?void 0:n.find(a=>e.endsWith(a.dir||""));return s||((i=t.projects)==null?void 0:i.find(a=>a.dir===t.defaultProject))},De=async e=>{const t=await te(e),s=await J(e),n=l.join(e,(t==null?void 0:t.configDir)||"","salty.config.ts"),i=l.join(s,"salty.config.js"),a=await ue(e),c=de(n);await ie.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:i,format:a,external:c});const d=Date.now(),{config:r}=await import(`${i}?t=${d}`);return r},_e=async(e,t)=>{var Z,B;const s=await De(e),n={...s},i=new Set,a=(C,k=[])=>C?Object.entries(C).flatMap(([R,T])=>{if(!T)return;if(typeof T=="object")return a(T,[...k,R]);const K=pe(R),U=V(R),Q=[...k,K].join(".");i.add(`"${Q}"`);const X=[...k.map(V),U].join("-"),{result:Se}=ce(T);return`--${X}: ${Se};`}):[],c=C=>C?Object.entries(C).flatMap(([k,R])=>{const T=a(R);return k==="base"?T.join(""):`${k} { ${T.join("")} }`}):[],d=C=>C?Object.entries(C).flatMap(([k,R])=>Object.entries(R).flatMap(([T,K])=>{const U=a(K,[k]),Q=`.${k}-${T}, [data-${k}="${T}"]`,X=U.join("");return`${Q} { ${X} }`})):[],r=C=>({...C,responsive:void 0,conditional:void 0}),o=C=>t.variables.map(k=>C==="static"?r(k._current):k._current[C]),m=a(A(r(s.variables),o("static"))),y=c(A((Z=s.variables)==null?void 0:Z.responsive,o("responsive"))),g=d(A((B=s.variables)==null?void 0:B.conditional,o("conditional"))),$=await J(e),P=l.join($,"css/_variables.css"),_=`:root { ${m.join("")} ${y.join("")} } ${g.join("")}`;u.writeFileSync(P,_);const F=l.join($,"css/_global.css"),N=A(s.global,t.globalStyles),D=M(N,"");u.writeFileSync(F,`@layer global { ${D} }`);const j=l.join($,"css/_reset.css"),f=s.reset==="none"?{}:typeof s.reset=="object"?s.reset:Pe,h=M(f,"");u.writeFileSync(j,`@layer reset { ${h} }`);const b=l.join($,"css/_templates.css"),p=A(s.templates,t.templates),x=ae(p),w=Ne(p);u.writeFileSync(b,x),n.templates=p;const S=l.join($,"types/css-tokens.d.ts"),I=`
|
9
|
+
// Variable types
|
10
|
+
type VariableTokens = ${[...i].join("|")};
|
11
|
+
type PropertyValueToken = \`{\${VariableTokens}}\`;
|
12
|
+
|
13
|
+
// Template types
|
14
|
+
type TemplateTokens = {
|
15
|
+
${Object.entries(w).map(([C,k])=>`${C}?: ${k}`).join(`
|
16
|
+
`)}
|
17
|
+
}
|
18
|
+
`;u.writeFileSync(S,I);const L=l.join($,"cache/config-cache.json");u.writeFileSync(L,JSON.stringify(n,null,2))},re=e=>e.replace(/styled\(([^"'`{,]+),/g,(t,s)=>{if(/^['"`]/.test(s))return t;const i=new RegExp(`import[^;]*${s}[,\\s{][^;]*from\\s?([^{};]+);`);if(!i.test(e))return t;const c=i.exec(e);if(c){const d=c.at(1);if(ye.some(o=>d==null?void 0:d.includes(o)))return t}return"styled('div',"}),se=async(e,t,s)=>{const n=W(t),i=l.join(s,"./temp");u.existsSync(i)||u.mkdirSync(i);const a=l.parse(t);let c=u.readFileSync(t,"utf8");c=re(c);const d=l.join(s,"js",n+".js"),r=await te(e),o=l.join(e,(r==null?void 0:r.configDir)||"","salty.config.ts"),m=de(o),y=await ue(e);await ie.build({stdin:{contents:c,sourcefile:a.base,resolveDir:a.dir,loader:"tsx"},minify:!1,treeShaking:!0,bundle:!0,outfile:d,format:y,target:["node20"],keepNames:!0,external:m,packages:"external",plugins:[{name:"test",setup:P=>{P.onLoad({filter:/.*\.css|salty|styles|styled\.ts/},_=>{const F=u.readFileSync(_.path,"utf8");return{contents:re(F),loader:"ts"}})}}]});const g=Date.now();return await import(`${d}?t=${g}`)},Te=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)},ne=async e=>{const t=await Te(e),s=await J(e),n=l.join(s,"salty.config.js"),i=Date.now(),{config:a}=await import(`${n}?t=${i}`);return A(a,t)},he=()=>{try{return process.env.NODE_ENV==="production"}catch{return!1}},Ee=async(e,t=he(),s=!0)=>{try{const n=Date.now();t?v.info("Generating CSS in production mode! 🔥"):v.info("Generating CSS in development mode! 🚀");const i=[],a=[],c=await J(e),d=l.join(c,"index.css");s&&(()=>{u.existsSync(c)&&je.execSync("rm -rf "+c),u.mkdirSync(c,{recursive:!0}),u.mkdirSync(l.join(c,"css")),u.mkdirSync(l.join(c,"types")),u.mkdirSync(l.join(c,"js")),u.mkdirSync(l.join(c,"cache"))})();const o={keyframes:[],mediaQueries:[],globalStyles:[],variables:[],templates:[],components:[],classNames:[]};async function m(f){const h=["node_modules","saltygen"],b=u.statSync(f);if(b.isDirectory()){const p=u.readdirSync(f);if(h.some(w=>f.includes(w)))return;await Promise.all(p.map(w=>m(l.join(f,w))))}else if(b.isFile()&&G(f)){const x=await se(e,f,c);Object.entries(x).forEach(([w,S])=>{S.isKeyframes?o.keyframes.push({value:S,src:f,name:w}):S.isMedia?o.mediaQueries.push(S):S.isGlobalDefine?o.globalStyles.push(S):S.isDefineVariables?o.variables.push(S):S.isDefineTemplates?o.templates.push(S):S.isClassName?o.classNames.push({...S,src:f,name:w}):S.generator&&o.components.push({...S,src:f,name:w})})}}await m(e),await _e(e,o);const y=await ne(e);for(const f of o.keyframes){const{value:h}=f,b=`a_${h.animationName}.css`,p=`css/${b}`,x=l.join(c,p);i.push(b),u.writeFileSync(x,h.css)}const g={};for(const f of o.components){const{src:h,name:b}=f,p=f.generator._withBuildContext({callerName:b,isProduction:t,config:y});a[p.priority]||(a[p.priority]=[]),a[p.priority].push(p.cssFileName);const x=`css/${p.cssFileName}`,w=l.join(c,x);u.writeFileSync(w,p.css),y.importStrategy==="component"&&(g[h]?g[h].push(p.cssFileName):g[h]=[p.cssFileName])}for(const f of o.classNames){const{src:h,name:b}=f,p=f.generator._withBuildContext({callerName:b,isProduction:t,config:y});a[0].push(p.cssFileName);const x=`css/${p.cssFileName}`,w=l.join(c,x);u.writeFileSync(w,p.css),y.importStrategy==="component"&&(g[h]?g[h].push(p.cssFileName):g[h]=[p.cssFileName])}y.importStrategy==="component"&&Object.entries(g).forEach(([f,h])=>{const b=h.map(H=>`@import url('./${H}');`).join(`
|
19
|
+
`),p=W(f,6),x=l.parse(f),w=V(x.name),S=l.join(c,`css/f_${w}-${p}.css`);u.writeFileSync(S,b)});const $=i.map(f=>`@import url('./css/${f}');`).join(`
|
20
|
+
`);let N=`@layer reset, global, l0, l1, l2, l3, l4, l5, l6, l7, l8;
|
21
|
+
|
22
|
+
${["_variables.css","_reset.css","_global.css","_templates.css"].filter(f=>{try{return u.readFileSync(l.join(c,"css",f),"utf8").length>0}catch{return!1}}).map(f=>`@import url('./css/${f}');`).join(`
|
23
|
+
`)}
|
24
|
+
${$}`;if(y.importStrategy!=="component"){const f=a.reduce((h,b,p)=>{const x=b.reduce((I,L)=>{var k;const Z=l.join(c,"css",L),B=u.readFileSync(Z,"utf8"),C=((k=/.*-([^-]+)-\d+.css/.exec(L))==null?void 0:k.at(1))||W(Z,6);return I.includes(C)?I:`${I}
|
25
|
+
/*start:${C}*/
|
26
|
+
${B}
|
27
|
+
/*end:${C}*/
|
28
|
+
`},""),w=`l_${p}.css`,S=l.join(c,"css",w),H=`@layer l${p} { ${x}
|
29
|
+
}`;return u.writeFileSync(S,H),`${h}
|
30
|
+
@import url('./css/${w}');`},"");N+=f}u.writeFileSync(d,N);const j=Date.now()-n,E=j<200?"🔥":j<500?"🚀":j<1e3?"🎉":j<2e3?"🚗":j<5e3?"🤔":"🥴";v.info(`Generated CSS in ${j}ms! ${E}`)}catch(n){console.error(n)}},Oe=async(e,t)=>{try{const s=await J(e);if(G(t)){const i=[],a=await ne(e),c=await se(e,t,s);if(Object.entries(c).forEach(([d,r])=>{if(r.isKeyframes&&r.css){const $=`css/${`a_${r.animationName}.css`}`,P=l.join(s,$);u.writeFileSync(P,r.css);return}if(r.isClassName){const g=r.factory._withBuildContext({name:d});i[0].push(g.cssFileName);const $=`css/${g.cssFileName}`,P=l.join(s,$);u.writeFileSync(P,g.css)}if(!r.generator)return;const o=r.generator._withBuildContext({name:d,config:a}),m=`css/${o.cssFileName}`,y=l.join(s,m);u.writeFileSync(y,o.css),i[o.priority]||(i[o.priority]=[]),i[o.priority].push(o.cssFileName)}),a.importStrategy!=="component")i.forEach((d,r)=>{const o=`l_${r}.css`,m=l.join(s,"css",o);let y=u.readFileSync(m,"utf8");d.forEach(g=>{var F;const $=l.join(s,"css",g),P=((F=/.*-([^-]+)-\d+.css/.exec(g))==null?void 0:F.at(1))||W($,6);if(!y.includes(P)){const N=u.readFileSync($,"utf8"),D=`/*start:${P}*/
|
31
|
+
${N}
|
32
|
+
/*end:${P}*/
|
33
|
+
`;y=`${y.replace(/\}$/,"")}
|
34
|
+
${D}
|
35
|
+
}`}}),u.writeFileSync(m,y)});else{const d=i.flat().map(g=>`@import url('./${g}');`).join(`
|
36
|
+
`),r=W(t,6),o=l.parse(t),m=V(o.name),y=l.join(s,`css/f_${m}-${r}.css`);u.writeFileSync(y,d)}}}catch(s){console.error(s)}},Ve=async(e,t,s=he())=>{try{const n=await J(e);if(G(t)){const a=u.readFileSync(t,"utf8");a.replace(/^(?!export\s)const\s.*/gm,m=>`export ${m}`)!==a&&await ee.writeFile(t,a);const d=await ne(e),r=await se(e,t,n);let o=a;if(Object.entries(r).forEach(([m,y])=>{var w;if(y.isKeyframes||!y.generator)return;const g=y.generator._withBuildContext({name:m,config:d,prod:s}),$=new RegExp(`\\s${m}[=\\s]+[^()]+styled\\(([^,]+),`,"g").exec(a);if(!$)return console.error("Could not find the original declaration");const P=(w=$.at(1))==null?void 0:w.trim(),_=new RegExp(`\\s${m}[=\\s]+styled\\(`,"g").exec(o);if(!_)return console.error("Could not find the original declaration");const{index:F}=_;let N=!1;const D=setTimeout(()=>N=!0,5e3);let j=0,E=!1,f=0;for(;!E&&!N;){const S=o[F+j];S==="("&&f++,S===")"&&f--,f===0&&S===")"&&(E=!0),j>o.length&&(N=!0),j++}if(!N)clearTimeout(D);else throw new Error("Failed to find the end of the styled call and timed out");const h=F+j,b=o.slice(F,h),p=o,x=` ${m} = styled(${P}, "${g.classNames}", ${JSON.stringify(g.clientProps)});`;o=o.replace(b,x),p===o&&console.error("Minimize file failed to change content",{name:m,tagName:P})}),d.importStrategy==="component"){const m=W(t,6),y=l.parse(t);o=`import '../../saltygen/css/${`f_${V(y.name)}-${m}.css`}';
|
37
|
+
${o}`}return o=o.replace("{ styled }","{ styledClient as styled }"),o=o.replace("@salty-css/react/styled","@salty-css/react/styled-client"),o}}catch(n){console.error("Error in minimizeFile:",n)}};exports.generateCss=Ee;exports.generateFile=Oe;exports.isSaltyFile=G;exports.minimizeFile=Ve;exports.saltyFileRegExp=ge;
|
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-
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("path"),t=require("./index-LHz82WN_.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-
|
2
|
+
import { i as f, s as p, g as u, a as y } from "./index-BthpPBL_.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-
|
1
|
+
"use strict";const i=require("./index-LHz82WN_.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
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@salty-css/webpack",
|
3
|
-
"version": "0.0.1-alpha.
|
3
|
+
"version": "0.0.1-alpha.190",
|
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.
|
37
|
+
"@salty-css/core": "^0.0.1-alpha.190",
|
38
38
|
"webpack": ">=5.x"
|
39
39
|
}
|
40
40
|
}
|
package/index-BaNRirm4.cjs
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
"use strict";const $e=require("esbuild"),je=require("child_process"),l=require("path"),u=require("fs"),ee=require("fs/promises"),q=require("winston");var Y=typeof document<"u"?document.currentScript:null;function be(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 ie=be($e),oe=e=>String.fromCharCode(e+(e>25?39:97)),we=(e,t)=>{let s="",n;for(n=Math.abs(e);n>52;n=n/52|0)s=oe(n%52)+s;return s=oe(n%52)+s,s.length<t?s=s.padStart(t,"a"):s.length>t&&(s=s.slice(-t)),s},Fe=(e,t)=>{let s=t.length;for(;s;)e=e*33^t.charCodeAt(--s);return e},W=(e,t=5)=>{const s=Fe(5381,JSON.stringify(e))>>>0;return we(s,t)};function V(e){return e?typeof e!="string"?V(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 Ce=(e,t)=>{if(typeof e!="string")return{result:e};if(!t)return{result:e};const s=[];return Object.values(t).forEach(n=>{const{pattern:i,transform:a}=n;e=e.replace(i,c=>{const{value:p,css:r}=a(c);return r&&s.push(r),p})}),{result:e,additionalCss:s}},ce=e=>typeof e!="string"?{result:e}:/\{[^{}]+\}/g.test(e)?{result:e.replace(/\{([^{}]+)\}/g,(...n)=>`var(--${V(n[1].replaceAll(".","-"))})`)}:{result:e},M=(e,t,s)=>{if(!e)return"";const n=[],i=Object.entries(e).reduce((c,[p,r])=>{const o=p.trim();if(typeof r=="function"&&(r=r()),typeof r=="object"){if(!r)return c;if(o==="variants")return Object.entries(r).forEach(([D,b])=>{b&&Object.entries(b).forEach(([E,f])=>{if(!f)return;const w=`${t}.${D}-${E}`,S=M(f,w);n.push(S)})}),c;if(o==="defaultVariants")return c;if(o==="compoundVariants")return r.forEach(D=>{const{css:b,...E}=D,f=Object.entries(E).reduce((S,[$,d])=>`${S}.${$}-${d}`,t),w=M(b,f);n.push(w)}),c;if(o.startsWith("@")){const D=M(r,t),b=`${o} {
|
2
|
-
${D.replace(`
|
3
|
-
`,`
|
4
|
-
`)}
|
5
|
-
}`;return n.push(b),c}const C=p.includes("&")?o.replace("&",t):o.startsWith(":")?`${t}${o}`:`${t} ${o}`,N=M(r,C);return n.push(N),c}const h=o.startsWith("-")?o:V(o),m=(C,N=";")=>c=`${c}${C}${N}`,y=C=>m(`${h}:${C}`);if(typeof r=="number")return y(r);if(typeof r!="string")if("toString"in r)r=r.toString();else return c;const{modifiers:j}={},_=function*(){yield ce(r),yield Ce(r,j)}();for(const{result:C,additionalCss:N=[]}of _)r=C,N.forEach(D=>{const b=M(D,"");m(b,"")});return y(r)},"");return i?t?[`${t} { ${i} }`,...n].join(`
|
6
|
-
`):i:n.join(`
|
7
|
-
`)},ae=(e,t=[])=>{if(!e)return"";const s=[],n={};if(Object.entries(e).forEach(([i,a])=>{if(typeof a=="object"){if(!a)return;const c=i.trim(),p=ae(a,[...t,c]);s.push(p)}else n[i]=a}),Object.keys(n).length){const i=t.map(V).join("-"),a=M(n,`.${i}`);s.push(a)}return s.join(`
|
8
|
-
`)},xe=e=>e?Object.entries(e).reduce((t,[s,n])=>(typeof n=="object"&&(t[s]=le(n).map(i=>`"${i}"`).join(" | ")),t),{}):{},le=(e,t="",s=new Set)=>e?(Object.entries(e).forEach(([n,i])=>{const a=t?`${t}.${n}`:n;return typeof i=="object"?le(i,a,s):s.add(t)}),[...s]):[],fe=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:fe(l.join(e,".."))},Ne=async e=>{const t=fe(e);return await ee.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},ke=async e=>{const t=await Ne(e);if(t)return t.type};let z;const ue=async e=>{if(z)return z;const t=await ke(e);return t==="module"?z="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:Y&&Y.tagName.toUpperCase()==="SCRIPT"&&Y.src||new URL("index-BaNRirm4.cjs",document.baseURI).href).endsWith(".cjs"))&&(z="cjs"),z||"esm"},v=q.createLogger({level:"debug",format:q.format.combine(q.format.colorize(),q.format.cli()),transports:[new q.transports.Console({})]});function pe(e){return e?typeof e!="string"?pe(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 Pe={"*, *::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"}},A=(...e)=>e.flat().reduce((t,s)=>s!=null&&s._current?{...t,...s._current}:{...t,...s},{}),O={externalModules:[],rcFile:void 0,destDir:void 0},de=e=>{if(O.externalModules.length>0)return O.externalModules;const s=u.readFileSync(e,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!s)return[];const n=s[1].split(",").map(i=>i.replace(/['"`]/g,"").trim());return O.externalModules=n,n},J=async e=>{if(O.destDir)return O.destDir;const t=await te(e),s=l.join(e,(t==null?void 0:t.saltygenDir)||"saltygen");return O.destDir=s,s},ye=["salty","css","styles","styled"],ge=(e=[])=>new RegExp(`\\.(${[...ye,...e].join("|")})\\.`),G=(e,t=[])=>ge(t).test(e),me=async e=>{if(O.rcFile)return O.rcFile;if(e==="/")throw new Error("Could not find .saltyrc.json file");const t=l.join(e,".saltyrc.json"),s=await ee.readFile(t,"utf-8").then(JSON.parse).catch(()=>{});return s?(O.rcFile=s,s):me(l.join(e,".."))},te=async e=>{var n,i;const t=await me(e),s=(n=t.projects)==null?void 0:n.find(a=>e.endsWith(a.dir||""));return s||((i=t.projects)==null?void 0:i.find(a=>a.dir===t.defaultProject))},De=async e=>{const t=await te(e),s=await J(e),n=l.join(e,(t==null?void 0:t.configDir)||"","salty.config.ts"),i=l.join(s,"salty.config.js"),a=await ue(e),c=de(n);await ie.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:i,format:a,external:c});const p=Date.now(),{config:r}=await import(`${i}?t=${p}`);return r},_e=async(e,t)=>{var Z,B;const s=await De(e),n={...s},i=new Set,a=(x,k=[])=>x?Object.entries(x).flatMap(([R,T])=>{if(!T)return;if(typeof T=="object")return a(T,[...k,R]);const K=pe(R),U=V(R),Q=[...k,K].join(".");i.add(`"${Q}"`);const X=[...k.map(V),U].join("-"),{result:Se}=ce(T);return`--${X}: ${Se};`}):[],c=x=>x?Object.entries(x).flatMap(([k,R])=>{const T=a(R);return k==="base"?T.join(""):`${k} { ${T.join("")} }`}):[],p=x=>x?Object.entries(x).flatMap(([k,R])=>Object.entries(R).flatMap(([T,K])=>{const U=a(K,[k]),Q=`.${k}-${T}, [data-${k}="${T}"]`,X=U.join("");return`${Q} { ${X} }`})):[],r=x=>({...x,responsive:void 0,conditional:void 0}),o=x=>t.variables.map(k=>x==="static"?r(k._current):k._current[x]),h=a(A(r(s.variables),o("static"))),m=c(A((Z=s.variables)==null?void 0:Z.responsive,o("responsive"))),y=p(A((B=s.variables)==null?void 0:B.conditional,o("conditional"))),j=await J(e),P=l.join(j,"css/_variables.css"),_=`:root { ${h.join("")} ${m.join("")} } ${y.join("")}`;u.writeFileSync(P,_);const C=l.join(j,"css/_global.css"),N=A(s.global,t.globalStyles),D=M(N,"");u.writeFileSync(C,`@layer global { ${D} }`);const b=l.join(j,"css/_reset.css"),f=s.reset==="none"?{}:typeof s.reset=="object"?s.reset:Pe,w=M(f,"");u.writeFileSync(b,`@layer reset { ${w} }`);const S=l.join(j,"css/_templates.css"),$=A(s.templates,t.templates),d=ae($),F=xe($);u.writeFileSync(S,d),n.templates=$;const g=l.join(j,"types/css-tokens.d.ts"),I=`
|
9
|
-
// Variable types
|
10
|
-
type VariableTokens = ${[...i].join("|")};
|
11
|
-
type PropertyValueToken = \`{\${VariableTokens}}\`;
|
12
|
-
|
13
|
-
// Template types
|
14
|
-
type TemplateTokens = {
|
15
|
-
${Object.entries(F).map(([x,k])=>`${x}?: ${k}`).join(`
|
16
|
-
`)}
|
17
|
-
}
|
18
|
-
`;u.writeFileSync(g,I);const L=l.join(j,"cache/config-cache.json");u.writeFileSync(L,JSON.stringify(n,null,2))},re=e=>e.replace(/styled\(([^"'`{,]+),/g,(t,s)=>{if(/^['"`]/.test(s))return t;const i=new RegExp(`import[^;]*${s}[,\\s{][^;]*from\\s?([^{};]+);`);if(!i.test(e))return t;const c=i.exec(e);if(c){const p=c.at(1);if(ye.some(o=>p==null?void 0:p.includes(o)))return t}return"styled('div',"}),se=async(e,t,s)=>{const n=W(t),i=l.join(s,"./temp");u.existsSync(i)||u.mkdirSync(i);const a=l.parse(t);let c=u.readFileSync(t,"utf8");c=re(c);const p=l.join(s,"js",n+".js"),r=await te(e),o=l.join(e,(r==null?void 0:r.configDir)||"","salty.config.ts"),h=de(o),m=await ue(e);await ie.build({stdin:{contents:c,sourcefile:a.base,resolveDir:a.dir,loader:"tsx"},minify:!1,treeShaking:!0,bundle:!0,outfile:p,format:m,target:["node20"],keepNames:!0,external:h,packages:"external",plugins:[{name:"test",setup:P=>{P.onLoad({filter:/.*\.css|salty|styles|styled\.ts/},_=>{const C=u.readFileSync(_.path,"utf8");return{contents:re(C),loader:"ts"}})}}]});const y=Date.now();return await import(`${p}?t=${y}`)},Te=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)},ne=async e=>{const t=await Te(e),s=await J(e),n=l.join(s,"salty.config.js"),i=Date.now(),{config:a}=await import(`${n}?t=${i}`);return A(a,t)},he=()=>{try{return process.env.NODE_ENV==="production"}catch{return!1}},Ee=async(e,t=he(),s=!0)=>{try{const n=Date.now();t?v.info("Generating CSS in production mode! 🔥"):v.info("Generating CSS in development mode! 🚀");const i=[],a=[],c=await J(e),p=l.join(c,"index.css");s&&(()=>{u.existsSync(c)&&je.execSync("rm -rf "+c),u.mkdirSync(c,{recursive:!0}),u.mkdirSync(l.join(c,"css")),u.mkdirSync(l.join(c,"types")),u.mkdirSync(l.join(c,"js")),u.mkdirSync(l.join(c,"cache"))})();const o={keyframes:[],mediaQueries:[],globalStyles:[],variables:[],templates:[],components:[],classNames:[]};async function h(f){const w=["node_modules","saltygen"],S=u.statSync(f);if(S.isDirectory()){const $=u.readdirSync(f);if(w.some(F=>f.includes(F)))return;await Promise.all($.map(F=>h(l.join(f,F))))}else if(S.isFile()&&G(f)){const d=await se(e,f,c);Object.entries(d).forEach(([F,g])=>{g.isKeyframes?o.keyframes.push({value:g,src:f,name:F}):g.isMedia?o.mediaQueries.push(g):g.isGlobalDefine?o.globalStyles.push(g):g.isDefineVariables?o.variables.push(g):g.isDefineTemplates?o.templates.push(g):g.isClassName?o.classNames.push({value:g.factory,src:f,name:F}):g.generator&&o.components.push({value:g.generator,src:f,name:F})})}}await h(e),await _e(e,o);const m=await ne(e);for(const f of o.keyframes){const{value:w}=f,S=`a_${w.animationName}.css`,$=`css/${S}`,d=l.join(c,$);i.push(S),u.writeFileSync(d,w.css)}const y={};for(const f of o.components){const{value:w,name:S,src:$}=f,d=w._withBuildContext({name:S,config:m,prod:t});a[d.priority]||(a[d.priority]=[]),a[d.priority].push(d.cssFileName);const F=`css/${d.cssFileName}`,g=l.join(c,F);u.writeFileSync(g,d.css),m.importStrategy==="component"&&(y[$]?y[$].push(d.cssFileName):y[$]=[d.cssFileName])}for(const f of o.classNames){const{value:w,src:S,name:$}=f,d=w._withBuildContext({name:$,prod:t});a[0].push(d.cssFileName);const F=`css/${d.cssFileName}`,g=l.join(c,F);u.writeFileSync(g,d.css),m.importStrategy==="component"&&(y[S]?y[S].push(d.cssFileName):y[S]=[d.cssFileName])}m.importStrategy==="component"&&Object.entries(y).forEach(([f,w])=>{const S=w.map(H=>`@import url('./${H}');`).join(`
|
19
|
-
`),$=W(f,6),d=l.parse(f),F=V(d.name),g=l.join(c,`css/f_${F}-${$}.css`);u.writeFileSync(g,S)});const j=i.map(f=>`@import url('./css/${f}');`).join(`
|
20
|
-
`);let N=`@layer reset, global, l0, l1, l2, l3, l4, l5, l6, l7, l8;
|
21
|
-
|
22
|
-
${["_variables.css","_reset.css","_global.css","_templates.css"].filter(f=>{try{return u.readFileSync(l.join(c,"css",f),"utf8").length>0}catch{return!1}}).map(f=>`@import url('./css/${f}');`).join(`
|
23
|
-
`)}
|
24
|
-
${j}`;if(m.importStrategy!=="component"){const f=a.reduce((w,S,$)=>{const d=S.reduce((I,L)=>{var k;const Z=l.join(c,"css",L),B=u.readFileSync(Z,"utf8"),x=((k=/.*-([^-]+)-\d+.css/.exec(L))==null?void 0:k.at(1))||W(Z,6);return I.includes(x)?I:`${I}
|
25
|
-
/*start:${x}*/
|
26
|
-
${B}
|
27
|
-
/*end:${x}*/
|
28
|
-
`},""),F=`l_${$}.css`,g=l.join(c,"css",F),H=`@layer l${$} { ${d}
|
29
|
-
}`;return u.writeFileSync(g,H),`${w}
|
30
|
-
@import url('./css/${F}');`},"");N+=f}u.writeFileSync(p,N);const b=Date.now()-n,E=b<200?"🔥":b<500?"🚀":b<1e3?"🎉":b<2e3?"🚗":b<5e3?"🤔":"🥴";v.info(`Generated CSS in ${b}ms! ${E}`)}catch(n){console.error(n)}},Oe=async(e,t)=>{try{const s=await J(e);if(G(t)){const i=[],a=await ne(e),c=await se(e,t,s);if(Object.entries(c).forEach(([p,r])=>{if(r.isKeyframes&&r.css){const j=`css/${`a_${r.animationName}.css`}`,P=l.join(s,j);u.writeFileSync(P,r.css);return}if(r.isClassName){const y=r.factory._withBuildContext({name:p});i[0].push(y.cssFileName);const j=`css/${y.cssFileName}`,P=l.join(s,j);u.writeFileSync(P,y.css)}if(!r.generator)return;const o=r.generator._withBuildContext({name:p,config:a}),h=`css/${o.cssFileName}`,m=l.join(s,h);u.writeFileSync(m,o.css),i[o.priority]||(i[o.priority]=[]),i[o.priority].push(o.cssFileName)}),a.importStrategy!=="component")i.forEach((p,r)=>{const o=`l_${r}.css`,h=l.join(s,"css",o);let m=u.readFileSync(h,"utf8");p.forEach(y=>{var C;const j=l.join(s,"css",y),P=((C=/.*-([^-]+)-\d+.css/.exec(y))==null?void 0:C.at(1))||W(j,6);if(!m.includes(P)){const N=u.readFileSync(j,"utf8"),D=`/*start:${P}*/
|
31
|
-
${N}
|
32
|
-
/*end:${P}*/
|
33
|
-
`;m=`${m.replace(/\}$/,"")}
|
34
|
-
${D}
|
35
|
-
}`}}),u.writeFileSync(h,m)});else{const p=i.flat().map(y=>`@import url('./${y}');`).join(`
|
36
|
-
`),r=W(t,6),o=l.parse(t),h=V(o.name),m=l.join(s,`css/f_${h}-${r}.css`);u.writeFileSync(m,p)}}}catch(s){console.error(s)}},Ve=async(e,t,s=he())=>{try{const n=await J(e);if(G(t)){const a=u.readFileSync(t,"utf8");a.replace(/^(?!export\s)const\s.*/gm,h=>`export ${h}`)!==a&&await ee.writeFile(t,a);const p=await ne(e),r=await se(e,t,n);let o=a;if(Object.entries(r).forEach(([h,m])=>{var F;if(m.isKeyframes||!m.generator)return;const y=m.generator._withBuildContext({name:h,config:p,prod:s}),j=new RegExp(`\\s${h}[=\\s]+[^()]+styled\\(([^,]+),`,"g").exec(a);if(!j)return console.error("Could not find the original declaration");const P=(F=j.at(1))==null?void 0:F.trim(),_=new RegExp(`\\s${h}[=\\s]+styled\\(`,"g").exec(o);if(!_)return console.error("Could not find the original declaration");const{index:C}=_;let N=!1;const D=setTimeout(()=>N=!0,5e3);let b=0,E=!1,f=0;for(;!E&&!N;){const g=o[C+b];g==="("&&f++,g===")"&&f--,f===0&&g===")"&&(E=!0),b>o.length&&(N=!0),b++}if(!N)clearTimeout(D);else throw new Error("Failed to find the end of the styled call and timed out");const w=C+b,S=o.slice(C,w),$=o,d=` ${h} = styled(${P}, "${y.classNames}", ${JSON.stringify(y.props)});`;o=o.replace(S,d),$===o&&console.error("Minimize file failed to change content",{name:h,tagName:P})}),p.importStrategy==="component"){const h=W(t,6),m=l.parse(t);o=`import '../../saltygen/css/${`f_${V(m.name)}-${h}.css`}';
|
37
|
-
${o}`}return o=o.replace("{ styled }","{ styledClient as styled }"),o=o.replace("@salty-css/react/styled","@salty-css/react/styled-client"),o}}catch(n){console.error("Error in minimizeFile:",n)}};exports.generateCss=Ee;exports.generateFile=Oe;exports.isSaltyFile=G;exports.minimizeFile=Ve;exports.saltyFileRegExp=ge;
|