@salty-css/core 0.0.1-alpha.284 → 0.0.1-alpha.286
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/bin/main.cjs +4 -4
- package/bin/main.js +125 -125
- package/cache/resolve-dynamic-config-cache.cjs +1 -1
- package/cache/resolve-dynamic-config-cache.js +6 -8
- package/compiler/helpers.d.ts +1 -0
- package/compiler/index.cjs +1 -1
- package/compiler/index.d.ts +0 -1
- package/compiler/index.js +10 -10
- package/css/keyframes.cjs +1 -1
- package/css/keyframes.js +1 -1
- package/generators/index.cjs +1 -1
- package/generators/index.js +13 -13
- package/helpers-C1RIrlCB.js +10 -0
- package/helpers-DVANmpVz.cjs +1 -0
- package/{index-CR0k7PXM.js → index-6JCRY_wd.js} +126 -133
- package/index-Dg98Xd3x.cjs +41 -0
- package/package.json +1 -1
- package/parse-styles-DLPgVsVQ.js +154 -0
- package/parse-styles-DZYIEhB4.cjs +5 -0
- package/parsers/index.cjs +1 -1
- package/parsers/index.js +2 -2
- package/server/index.cjs +1 -1
- package/server/index.js +1 -1
- package/{should-restart-BFVRQc0_.cjs → should-restart-2eX-l4VO.cjs} +1 -1
- package/{should-restart-CR-ZEYLq.js → should-restart-YBRJU0GU.js} +1 -1
- package/index-BYrtB4JM.cjs +0 -41
- package/parse-styles-Bdgw_4ME.cjs +0 -5
- package/parse-styles-C1E6ETeH.js +0 -154
package/generators/index.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
var C = Object.defineProperty;
|
2
2
|
var x = (a, t, s) => t in a ? C(a, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : a[t] = s;
|
3
|
-
var
|
4
|
-
import { p as
|
3
|
+
var u = (a, t, s) => x(a, typeof t != "symbol" ? t + "" : t, s);
|
4
|
+
import { p as v } from "../parse-styles-DLPgVsVQ.js";
|
5
5
|
import { t as f, d as h } from "../dash-case-DBThphLm.js";
|
6
6
|
class y {
|
7
7
|
constructor(t) {
|
8
|
-
|
8
|
+
u(this, "buildContext", {});
|
9
9
|
this.params = t;
|
10
10
|
}
|
11
11
|
get priority() {
|
@@ -30,13 +30,13 @@ class y {
|
|
30
30
|
return t ? `cl_${h(t)}-${this.hash}.css` : `${this.hash}.css`;
|
31
31
|
}
|
32
32
|
get css() {
|
33
|
-
const { base: t = {}, variants: s = {}, compoundVariants: e = [] } = this.params, { config: i } = this.buildContext,
|
34
|
-
return
|
33
|
+
const { base: t = {}, variants: s = {}, compoundVariants: e = [] } = this.params, { config: i } = this.buildContext, o = { ...t, variants: s, compoundVariants: e };
|
34
|
+
return v(o, `.${this.cssClassName}`, i, this.isRoot);
|
35
35
|
}
|
36
36
|
getTemplateClasses(t = this.buildContext.config) {
|
37
37
|
if (!(t != null && t.templates) || !this.params.base || this.priority > 0) return [];
|
38
38
|
const s = Object.keys(t.templates);
|
39
|
-
return Object.entries(this.params.base).reduce((e, [i,
|
39
|
+
return Object.entries(this.params.base).reduce((e, [i, o]) => (s.includes(i) && e.push("t_" + f(h(`${i}-${o}`), 4)), e), []);
|
40
40
|
}
|
41
41
|
_withBuildContext(t) {
|
42
42
|
return this.buildContext = t, this;
|
@@ -56,17 +56,17 @@ class E extends y {
|
|
56
56
|
return this.params.priority ? this.params.priority : typeof this.tagName == "function" || typeof this.tagName == "object" ? (((t = this.tagName.generator) == null ? void 0 : t.priority) || 0) + 1 : 0;
|
57
57
|
}
|
58
58
|
get clientProps() {
|
59
|
-
const { element: t, variants: s = {}, compoundVariants: e = [], defaultVariants: i = {}, defaultProps:
|
60
|
-
const
|
61
|
-
|
59
|
+
const { element: t, variants: s = {}, compoundVariants: e = [], defaultVariants: i = {}, defaultProps: o = {}, passProps: p } = this.params, { callerName: b, isProduction: g } = this.buildContext, c = /* @__PURE__ */ new Set([]), d = (r) => {
|
60
|
+
const n = i[r];
|
61
|
+
n !== void 0 ? c.add(`${r}=${String(n)}`) : c.add(r);
|
62
62
|
};
|
63
63
|
Object.keys(s).forEach(d), e.map((r) => Object.keys(r).forEach(d));
|
64
64
|
const l = /* @__PURE__ */ new Set([]);
|
65
65
|
if (this.params.base) {
|
66
66
|
const r = JSON.stringify(this.params.base).match(/\{-?props\.([^}]+)\}/gi);
|
67
|
-
r && r.forEach((
|
68
|
-
const
|
69
|
-
|
67
|
+
r && r.forEach((n) => {
|
68
|
+
const m = n.replace(/\{(?:-)?props\.([^}]+)\}/gi, "$1"), N = h(m);
|
69
|
+
m && l.add(N);
|
70
70
|
});
|
71
71
|
}
|
72
72
|
return {
|
@@ -75,7 +75,7 @@ class E extends y {
|
|
75
75
|
variantKeys: [...c],
|
76
76
|
propValueKeys: [...l],
|
77
77
|
passProps: p,
|
78
|
-
defaultProps:
|
78
|
+
defaultProps: o,
|
79
79
|
attr: {
|
80
80
|
"data-component-name": g ? void 0 : b
|
81
81
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";const r=require("path");var t=typeof document<"u"?document.currentScript:null;const n=()=>{let{pathname:e}=new URL(typeof document>"u"?require("url").pathToFileURL(__filename).href:t&&t.tagName.toUpperCase()==="SCRIPT"&&t.src||new URL("helpers-DVANmpVz.cjs",document.baseURI).href);for(;/core\/?(src\/)?$/.test(e)===!1;)e=r.join(e,"../");return e};exports.getCorePackageRoot=n;
|
@@ -1,44 +1,45 @@
|
|
1
|
-
import * as
|
2
|
-
import { execSync as
|
3
|
-
import { t as I, d as
|
1
|
+
import * as St from "esbuild";
|
2
|
+
import { execSync as Vt } from "child_process";
|
3
|
+
import { t as I, d as A } from "./dash-case-DBThphLm.js";
|
4
4
|
import { join as i, parse as tt } from "path";
|
5
|
-
import { existsSync as ft,
|
6
|
-
import { readFile as
|
7
|
-
import { p as
|
8
|
-
import { parseTemplates as
|
9
|
-
import { createLogger as zt,
|
5
|
+
import { existsSync as ft, mkdirSync as G, statSync as Et, readdirSync as Ot, readFileSync as T, writeFileSync as C } from "fs";
|
6
|
+
import { readFile as Ct } from "fs/promises";
|
7
|
+
import { p as $t, a as Mt } from "./parse-styles-DLPgVsVQ.js";
|
8
|
+
import { parseTemplates as Rt, getTemplateTypes as Jt } from "./parsers/index.js";
|
9
|
+
import { createLogger as zt, transports as Wt, format as rt } from "winston";
|
10
10
|
import { mergeObjects as H, mergeFactories as Gt } from "./css/merge.js";
|
11
11
|
import { d as Ht } from "./define-templates-4A2yHcMF.js";
|
12
12
|
import lt from "typescript";
|
13
|
-
|
13
|
+
import { g as It } from "./helpers-C1RIrlCB.js";
|
14
|
+
const Ft = (t) => {
|
14
15
|
if (!t || t === "/") throw new Error("Could not find package.json file");
|
15
16
|
const e = i(t, "package.json");
|
16
|
-
return ft(e) ? e :
|
17
|
-
}, It = async (t) => {
|
18
|
-
const e = jt(t);
|
19
|
-
return await Pt(e, "utf-8").then(JSON.parse).catch(() => {
|
20
|
-
});
|
17
|
+
return ft(e) ? e : Ft(i(t, ".."));
|
21
18
|
}, Kt = async (t) => {
|
22
|
-
const e =
|
19
|
+
const e = Ft(t);
|
20
|
+
return await Ct(e, "utf-8").then(JSON.parse).catch(() => {
|
21
|
+
});
|
22
|
+
}, Qt = async (t) => {
|
23
|
+
const e = await Kt(t);
|
23
24
|
if (e)
|
24
25
|
return e.type;
|
25
26
|
};
|
26
27
|
let W;
|
27
|
-
const
|
28
|
+
const Pt = async (t) => {
|
28
29
|
if (W) return W;
|
29
|
-
const e = await
|
30
|
+
const e = await Qt(t);
|
30
31
|
return e === "module" ? W = "esm" : (e === "commonjs" || import.meta.url.endsWith(".cjs")) && (W = "cjs"), W || "esm";
|
31
32
|
}, Z = zt({
|
32
33
|
level: "debug",
|
33
34
|
format: rt.combine(rt.colorize(), rt.cli()),
|
34
35
|
transports: [new Wt.Console({})]
|
35
|
-
}),
|
36
|
+
}), me = (t) => {
|
36
37
|
Z.error(t);
|
37
38
|
};
|
38
|
-
function
|
39
|
-
return t ? typeof t != "string" ?
|
39
|
+
function jt(t) {
|
40
|
+
return t ? typeof t != "string" ? jt(String(t)) : t.replace(/[^\d\w]/g, ".") : "";
|
40
41
|
}
|
41
|
-
const
|
42
|
+
const Bt = {
|
42
43
|
/** Set box model to border-box */
|
43
44
|
"*, *::before, *::after": {
|
44
45
|
boxSizing: "border-box"
|
@@ -96,38 +97,33 @@ const Qt = {
|
|
96
97
|
d.forEachChild(o);
|
97
98
|
}
|
98
99
|
o(r);
|
99
|
-
}),
|
100
|
-
let { pathname: t } = new URL(import.meta.url);
|
101
|
-
for (; /core\/?(src\/)?$/.test(t) === !1; )
|
102
|
-
t = i(t, "../");
|
103
|
-
return t;
|
104
|
-
}, v = {
|
100
|
+
}), V = {
|
105
101
|
externalModules: [],
|
106
102
|
rcFile: void 0,
|
107
103
|
destDir: void 0
|
108
|
-
},
|
109
|
-
if (
|
110
|
-
const s =
|
104
|
+
}, Nt = (t) => {
|
105
|
+
if (V.externalModules.length > 0) return V.externalModules;
|
106
|
+
const s = T(t, "utf8").match(/externalModules:\s?\[(.*)\]/);
|
111
107
|
if (!s) return [];
|
112
108
|
const n = s[1].split(",").map((c) => c.replace(/['"`]/g, "").trim());
|
113
|
-
return
|
109
|
+
return V.externalModules = n, n;
|
114
110
|
}, J = async (t) => {
|
115
|
-
if (
|
111
|
+
if (V.destDir) return V.destDir;
|
116
112
|
const e = await pt(t), s = i(t, (e == null ? void 0 : e.saltygenDir) || "saltygen");
|
117
|
-
return
|
118
|
-
},
|
119
|
-
if (
|
113
|
+
return V.destDir = s, s;
|
114
|
+
}, xt = ["salty", "css", "styles", "styled"], qt = (t = []) => new RegExp(`\\.(${[...xt, ...t].join("|")})\\.`), mt = (t, e = []) => qt(e).test(t), Dt = async (t) => {
|
115
|
+
if (V.rcFile) return V.rcFile;
|
120
116
|
if (t === "/") throw new Error("Could not find .saltyrc.json file");
|
121
|
-
const e = i(t, ".saltyrc.json"), s = await
|
117
|
+
const e = i(t, ".saltyrc.json"), s = await Ct(e, "utf-8").then(JSON.parse).catch(() => {
|
122
118
|
});
|
123
|
-
return s ? (
|
119
|
+
return s ? (V.rcFile = s, s) : Dt(i(t, ".."));
|
124
120
|
}, pt = async (t) => {
|
125
121
|
var n, c;
|
126
|
-
const e = await
|
122
|
+
const e = await Dt(t), s = (n = e.projects) == null ? void 0 : n.find((r) => t.endsWith(r.dir || ""));
|
127
123
|
return s || ((c = e.projects) == null ? void 0 : c.find((r) => r.dir === e.defaultProject));
|
128
|
-
},
|
129
|
-
const e = await pt(t), s = await J(t), n = i(t, (e == null ? void 0 : e.configDir) || "", "salty.config.ts"), c = i(s, "salty.config.js"), r = await
|
130
|
-
await
|
124
|
+
}, At = async (t) => {
|
125
|
+
const e = await pt(t), s = await J(t), n = i(t, (e == null ? void 0 : e.configDir) || "", "salty.config.ts"), c = i(s, "salty.config.js"), r = await Pt(t), o = Nt(n);
|
126
|
+
await St.build({
|
131
127
|
entryPoints: [n],
|
132
128
|
minify: !0,
|
133
129
|
treeShaking: !0,
|
@@ -138,8 +134,8 @@ const Qt = {
|
|
138
134
|
});
|
139
135
|
const d = Date.now(), { config: w } = await import(`${c}?t=${d}`);
|
140
136
|
return { config: w, path: c };
|
141
|
-
},
|
142
|
-
var
|
137
|
+
}, Ut = async (t, e) => {
|
138
|
+
var yt, ht;
|
143
139
|
const s = await J(t), n = {
|
144
140
|
mediaQueries: [],
|
145
141
|
globalStyles: [],
|
@@ -148,58 +144,58 @@ const Qt = {
|
|
148
144
|
};
|
149
145
|
await Promise.all(
|
150
146
|
[...e].map(async (h) => {
|
151
|
-
const { contents: S, outputFilePath:
|
152
|
-
Object.entries(S).forEach(([
|
153
|
-
j.isMedia ? n.mediaQueries.push([
|
147
|
+
const { contents: S, outputFilePath: L } = await et(t, h, s);
|
148
|
+
Object.entries(S).forEach(([k, j]) => {
|
149
|
+
j.isMedia ? n.mediaQueries.push([k, j]) : j.isGlobalDefine ? n.globalStyles.push(j) : j.isDefineVariables ? n.variables.push(j) : j.isDefineTemplates && n.templates.push(j._setPath(`${k};;${L}`));
|
154
150
|
});
|
155
151
|
})
|
156
152
|
);
|
157
|
-
const { config: c, path: r } = await
|
153
|
+
const { config: c, path: r } = await At(t), o = { ...c }, { mediaQueries: d } = n;
|
158
154
|
o.mediaQueries = Object.fromEntries(d.map(([h, S]) => [`@${h}`, S]));
|
159
155
|
const w = d.map(([h]) => `'@${h}'`).join(" | "), p = /* @__PURE__ */ new Set(), a = async (h, S = []) => {
|
160
156
|
if (!h) return [];
|
161
|
-
const
|
162
|
-
const q = async (
|
163
|
-
if (!
|
164
|
-
if (
|
165
|
-
if (typeof
|
166
|
-
if (typeof
|
167
|
-
const at =
|
157
|
+
const L = Object.entries(h).map(async ([j, R]) => {
|
158
|
+
const q = async (v) => {
|
159
|
+
if (!v) return;
|
160
|
+
if (v instanceof Promise) return await q(await v);
|
161
|
+
if (typeof v == "function") return await q(await v());
|
162
|
+
if (typeof v == "object") return await a(v, [...S, j]);
|
163
|
+
const at = jt(j), it = A(j), ct = [...S, at].join(".");
|
168
164
|
p.add(`"${ct}"`);
|
169
|
-
const Y = [...S.map(
|
170
|
-
return
|
165
|
+
const Y = [...S.map(A), it].join("-"), wt = Mt(v);
|
166
|
+
return wt ? `--${Y}: ${wt.transformed};` : `--${Y}: ${v};`;
|
171
167
|
};
|
172
|
-
return await q(
|
168
|
+
return await q(R);
|
173
169
|
});
|
174
|
-
return (await Promise.all(
|
170
|
+
return (await Promise.all(L)).flat();
|
175
171
|
}, g = async (h) => {
|
176
172
|
if (!h) return [];
|
177
|
-
const S = Object.entries(h).map(async ([
|
178
|
-
const
|
179
|
-
return
|
173
|
+
const S = Object.entries(h).map(async ([k, j]) => {
|
174
|
+
const R = await a(j);
|
175
|
+
return k === "base" ? R.join("") : o.mediaQueries[k] ? `${o.mediaQueries[k]} { ${R.join("")} }` : `${k} { ${R.join("")} }`;
|
180
176
|
});
|
181
177
|
return (await Promise.all(S)).flat();
|
182
178
|
}, u = async (h) => {
|
183
179
|
if (!h) return [];
|
184
|
-
const S = Object.entries(h).map(async ([
|
185
|
-
const
|
186
|
-
const it = await a(at, [
|
180
|
+
const S = Object.entries(h).map(async ([k, j]) => {
|
181
|
+
const R = Object.entries(j).map(async ([v, at]) => {
|
182
|
+
const it = await a(at, [k]), ct = `.${k}-${v}, [data-${k}="${v}"]`, Y = it.join("");
|
187
183
|
return `${ct} { ${Y} }`;
|
188
184
|
});
|
189
|
-
return (await Promise.all(
|
185
|
+
return (await Promise.all(R)).flat();
|
190
186
|
});
|
191
187
|
return (await Promise.all(S)).flat();
|
192
|
-
}, y = (h) => ({ ...h, responsive: void 0, conditional: void 0 }), m = (h) => n.variables.map((S) => h === "static" ? y(S._current) : S._current[h]), F = H(y(c.variables), m("static")), x = await a(F),
|
188
|
+
}, y = (h) => ({ ...h, responsive: void 0, conditional: void 0 }), m = (h) => n.variables.map((S) => h === "static" ? y(S._current) : S._current[h]), F = H(y(c.variables), m("static")), x = await a(F), D = H((yt = c.variables) == null ? void 0 : yt.responsive, m("responsive")), E = await g(D), z = H((ht = c.variables) == null ? void 0 : ht.conditional, m("conditional")), U = await u(z), gt = i(s, "css/_variables.css"), O = `:root { ${x.join("")} ${E.join("")} } ${U.join("")}`;
|
193
189
|
C(gt, O), o.staticVariables = F;
|
194
|
-
const st = i(s, "css/_global.css"), f = H(c.global, n.globalStyles), $ = await
|
190
|
+
const st = i(s, "css/_global.css"), f = H(c.global, n.globalStyles), $ = await $t(f, "");
|
195
191
|
C(st, `@layer global { ${$} }`);
|
196
|
-
const b = i(s, "css/_reset.css"), P = c.reset === "none" ? {} : typeof c.reset == "object" ? c.reset :
|
192
|
+
const b = i(s, "css/_reset.css"), P = c.reset === "none" ? {} : typeof c.reset == "object" ? c.reset : Bt, N = await $t(P, "");
|
197
193
|
C(b, `@layer reset { ${N} }`);
|
198
|
-
const
|
199
|
-
C(
|
194
|
+
const _ = i(s, "css/_templates.css"), M = H(c.templates, n.templates), K = await Rt(M), Q = Jt(M);
|
195
|
+
C(_, `@layer templates { ${K} }`), o.templates = M;
|
200
196
|
const X = c.templates ? [Ht(c.templates)._setPath(`config;;${r}`)] : [], nt = Gt(n.templates, X);
|
201
197
|
o.templatePaths = Object.fromEntries(Object.entries(nt).map(([h, S]) => [h, S._path]));
|
202
|
-
const
|
198
|
+
const B = i(s, "types/css-tokens.d.ts"), kt = `
|
203
199
|
// Variable types
|
204
200
|
type VariableTokens = ${[...p].join("|")};
|
205
201
|
type PropertyValueToken = \`{\${VariableTokens}}\`;
|
@@ -213,26 +209,24 @@ const Qt = {
|
|
213
209
|
// Media query types
|
214
210
|
type MediaQueryKeys = ${w || "''"};
|
215
211
|
`;
|
216
|
-
C(
|
217
|
-
const
|
218
|
-
C(
|
219
|
-
const
|
220
|
-
|
221
|
-
|
222
|
-
console.log("Config cache secondary path", ht), C(ht, JSON.stringify(o, null, 2));
|
223
|
-
}, Ct = (t) => t.replace(/styled\(([^"'`{,]+),/g, (e, s) => {
|
212
|
+
C(B, kt);
|
213
|
+
const vt = i(s, "cache/config-cache.json");
|
214
|
+
C(vt, JSON.stringify(o, null, 2));
|
215
|
+
const Tt = It(), _t = i(Tt, "cache/config-cache.json");
|
216
|
+
C(_t, JSON.stringify(o, null, 2));
|
217
|
+
}, bt = (t) => t.replace(/styled\(([^"'`{,]+),/g, (e, s) => {
|
224
218
|
if (/^['"`]/.test(s)) return e;
|
225
219
|
const c = new RegExp(`import[^;]*${s}[,\\s{][^;]*from\\s?([^{};]+);`);
|
226
220
|
if (!c.test(t)) return e;
|
227
221
|
const o = c.exec(t);
|
228
222
|
if (o) {
|
229
223
|
const d = o.at(1);
|
230
|
-
if (
|
224
|
+
if (xt.some((p) => d == null ? void 0 : d.includes(p))) return e;
|
231
225
|
}
|
232
226
|
return "styled('div',";
|
233
227
|
}), Xt = (t, e) => {
|
234
228
|
try {
|
235
|
-
const s =
|
229
|
+
const s = T(i(e, "saltygen/cache/config-cache.json"), "utf8");
|
236
230
|
return s ? `globalThis.saltyConfig = ${s};
|
237
231
|
|
238
232
|
${t}` : `globalThis.saltyConfig = {};
|
@@ -245,10 +239,10 @@ ${t}`;
|
|
245
239
|
const n = I(e), c = i(s, "./temp");
|
246
240
|
ft(c) || G(c);
|
247
241
|
const r = tt(e);
|
248
|
-
let o =
|
249
|
-
o =
|
250
|
-
const d = i(s, "js", n + ".js"), w = await pt(t), p = i(t, (w == null ? void 0 : w.configDir) || "", "salty.config.ts"), a =
|
251
|
-
await
|
242
|
+
let o = T(e, "utf8");
|
243
|
+
o = bt(o), o = Xt(o, t);
|
244
|
+
const d = i(s, "js", n + ".js"), w = await pt(t), p = i(t, (w == null ? void 0 : w.configDir) || "", "salty.config.ts"), a = Nt(p), g = await Pt(t);
|
245
|
+
await St.build({
|
252
246
|
stdin: {
|
253
247
|
contents: o,
|
254
248
|
sourcefile: r.base,
|
@@ -269,8 +263,8 @@ ${t}`;
|
|
269
263
|
name: "test",
|
270
264
|
setup: (m) => {
|
271
265
|
m.onLoad({ filter: /.*\.css|salty|styles|styled\.ts/ }, (F) => {
|
272
|
-
const x =
|
273
|
-
return { contents:
|
266
|
+
const x = T(F.path, "utf8");
|
267
|
+
return { contents: bt(x), loader: "ts" };
|
274
268
|
});
|
275
269
|
}
|
276
270
|
}
|
@@ -279,7 +273,7 @@ ${t}`;
|
|
279
273
|
const u = Date.now();
|
280
274
|
return { contents: await import(`${d}?t=${u}`), outputFilePath: d };
|
281
275
|
}, Yt = async (t) => {
|
282
|
-
const e = await J(t), s = i(e, "cache/config-cache.json"), n =
|
276
|
+
const e = await J(t), s = i(e, "cache/config-cache.json"), n = T(s, "utf8");
|
283
277
|
if (!n) throw new Error("Could not find config cache file");
|
284
278
|
return JSON.parse(n);
|
285
279
|
}, ut = async (t) => {
|
@@ -291,13 +285,13 @@ ${t}`;
|
|
291
285
|
} catch {
|
292
286
|
return !1;
|
293
287
|
}
|
294
|
-
},
|
288
|
+
}, pe = async (t, e = dt(), s = !0) => {
|
295
289
|
try {
|
296
290
|
const n = Date.now();
|
297
291
|
e ? Z.info("Generating CSS in production mode! 🔥") : Z.info("Generating CSS in development mode! 🚀");
|
298
292
|
const c = [], r = [], o = await J(t), d = i(o, "index.css");
|
299
293
|
s && (() => {
|
300
|
-
ft(o) &&
|
294
|
+
ft(o) && Vt("rm -rf " + o), G(o, { recursive: !0 }), G(i(o, "css")), G(i(o, "types")), G(i(o, "js")), G(i(o, "cache"));
|
301
295
|
})();
|
302
296
|
const p = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
|
303
297
|
async function g(f) {
|
@@ -308,11 +302,11 @@ ${t}`;
|
|
308
302
|
await Promise.all(l.map((N) => g(i(f, N))));
|
309
303
|
} else if (b.isFile() && mt(f)) {
|
310
304
|
p.add(f);
|
311
|
-
const P =
|
305
|
+
const P = T(f, "utf8");
|
312
306
|
/define[\w\d]+\(/.test(P) && a.add(f);
|
313
307
|
}
|
314
308
|
}
|
315
|
-
await g(t), await
|
309
|
+
await g(t), await Ut(t, a);
|
316
310
|
const u = {
|
317
311
|
keyframes: [],
|
318
312
|
components: [],
|
@@ -355,8 +349,8 @@ ${t}`;
|
|
355
349
|
const P = await l.css;
|
356
350
|
if (!P) continue;
|
357
351
|
r[l.priority].push(l.cssFileName);
|
358
|
-
const N = `css/${l.cssFileName}`,
|
359
|
-
C(
|
352
|
+
const N = `css/${l.cssFileName}`, _ = i(o, N);
|
353
|
+
C(_, P), y.importStrategy === "component" && m[$].push(l.cssFileName);
|
360
354
|
}
|
361
355
|
for (const f of u.classNames) {
|
362
356
|
const { src: $, name: b } = f;
|
@@ -368,17 +362,17 @@ ${t}`;
|
|
368
362
|
}), P = await l.css;
|
369
363
|
if (!P) continue;
|
370
364
|
r[l.priority] || (r[l.priority] = []), r[l.priority].push(l.cssFileName);
|
371
|
-
const N = `css/${l.cssFileName}`,
|
372
|
-
C(
|
365
|
+
const N = `css/${l.cssFileName}`, _ = i(o, N);
|
366
|
+
C(_, P), y.importStrategy === "component" && m[$].push(l.cssFileName);
|
373
367
|
}
|
374
368
|
y.importStrategy === "component" && Object.entries(m).forEach(([f, $]) => {
|
375
|
-
const b = $.map((
|
376
|
-
`), l = I(f, 6), P = tt(f), N =
|
377
|
-
C(
|
369
|
+
const b = $.map((M) => `@import url('./${M}');`).join(`
|
370
|
+
`), l = I(f, 6), P = tt(f), N = A(P.name), _ = i(o, `css/f_${N}-${l}.css`);
|
371
|
+
C(_, b || "/* Empty file */");
|
378
372
|
});
|
379
373
|
const F = c.map((f) => `@import url('./css/${f}');`).join(`
|
380
374
|
`);
|
381
|
-
let
|
375
|
+
let U = `/*!
|
382
376
|
* Generated with Salty CSS (https://salty-css.dev)
|
383
377
|
* Do not edit this file directly
|
384
378
|
*/
|
@@ -386,7 +380,7 @@ ${t}`;
|
|
386
380
|
|
387
381
|
${["_variables.css", "_reset.css", "_global.css", "_templates.css"].filter((f) => {
|
388
382
|
try {
|
389
|
-
return
|
383
|
+
return T(i(o, "css", f), "utf8").length > 0;
|
390
384
|
} catch {
|
391
385
|
return !1;
|
392
386
|
}
|
@@ -399,26 +393,26 @@ ${F}`;
|
|
399
393
|
const f = r.reduce(($, b, l) => {
|
400
394
|
const P = b.reduce((K, Q) => {
|
401
395
|
var ot;
|
402
|
-
const X = i(o, "css", Q), nt =
|
403
|
-
return K.includes(
|
404
|
-
/*start:${
|
396
|
+
const X = i(o, "css", Q), nt = T(X, "utf8"), B = ((ot = /.*-([^-]+)-\d+.css/.exec(Q)) == null ? void 0 : ot.at(1)) || I(X, 6);
|
397
|
+
return K.includes(B) ? K : `${K}
|
398
|
+
/*start:${B}-${Q}*/
|
405
399
|
${nt}
|
406
|
-
/*end:${
|
400
|
+
/*end:${B}*/
|
407
401
|
`;
|
408
|
-
}, ""), N = `l_${l}.css`,
|
402
|
+
}, ""), N = `l_${l}.css`, _ = i(o, "css", N), M = `@layer l${l} { ${P}
|
409
403
|
}`;
|
410
|
-
return C(
|
404
|
+
return C(_, M), `${$}
|
411
405
|
@import url('./css/${N}');`;
|
412
406
|
}, "");
|
413
|
-
|
407
|
+
U += f;
|
414
408
|
}
|
415
|
-
C(d,
|
409
|
+
C(d, U);
|
416
410
|
const O = Date.now() - n, st = O < 200 ? "🔥" : O < 500 ? "🚀" : O < 1e3 ? "🎉" : O < 2e3 ? "🚗" : O < 5e3 ? "🤔" : "🥴";
|
417
411
|
Z.info(`Generated CSS in ${O}ms! ${st}`);
|
418
412
|
} catch (n) {
|
419
413
|
console.error(n);
|
420
414
|
}
|
421
|
-
},
|
415
|
+
}, ue = async (t, e, s = dt()) => {
|
422
416
|
try {
|
423
417
|
const n = await J(t);
|
424
418
|
if (mt(e)) {
|
@@ -437,8 +431,8 @@ ${nt}
|
|
437
431
|
}), F = await m.css;
|
438
432
|
if (!F) continue;
|
439
433
|
r[m.priority] || (r[m.priority] = []), r[m.priority].push(m.cssFileName);
|
440
|
-
const x = `css/${m.cssFileName}`,
|
441
|
-
C(
|
434
|
+
const x = `css/${m.cssFileName}`, D = i(n, x);
|
435
|
+
C(D, F);
|
442
436
|
continue;
|
443
437
|
}
|
444
438
|
if (!p.generator) continue;
|
@@ -454,12 +448,12 @@ ${nt}
|
|
454
448
|
if (o.importStrategy !== "component")
|
455
449
|
r.forEach((w, p) => {
|
456
450
|
const a = `l_${p}.css`, g = i(n, "css", a);
|
457
|
-
let u =
|
451
|
+
let u = T(g, "utf8");
|
458
452
|
w.forEach((y) => {
|
459
|
-
var
|
460
|
-
const m = i(n, "css", y), F = ((
|
453
|
+
var D;
|
454
|
+
const m = i(n, "css", y), F = ((D = /.*-([^-]+)-\d+.css/.exec(y)) == null ? void 0 : D.at(1)) || I(m, 6);
|
461
455
|
if (!u.includes(F)) {
|
462
|
-
const E =
|
456
|
+
const E = T(m, "utf8"), z = `/*start:${F}-${y}*/
|
463
457
|
${E}
|
464
458
|
/*end:${F}*/
|
465
459
|
`;
|
@@ -471,19 +465,19 @@ ${z}
|
|
471
465
|
});
|
472
466
|
else {
|
473
467
|
const w = r.flat().map((y) => `@import url('./${y}');`).join(`
|
474
|
-
`), p = I(e, 6), a = tt(e), g =
|
468
|
+
`), p = I(e, 6), a = tt(e), g = A(a.name), u = i(n, `css/f_${g}-${p}.css`);
|
475
469
|
C(u, w || "/* Empty file */");
|
476
470
|
}
|
477
471
|
}
|
478
472
|
} catch (n) {
|
479
473
|
console.error(n);
|
480
474
|
}
|
481
|
-
},
|
475
|
+
}, de = async (t, e, s = dt()) => {
|
482
476
|
var n, c;
|
483
477
|
try {
|
484
478
|
const r = await J(t);
|
485
479
|
if (mt(e)) {
|
486
|
-
const d =
|
480
|
+
const d = T(e, "utf8"), w = await ut(t), { contents: p } = await et(t, e, r);
|
487
481
|
let a = d;
|
488
482
|
for (const [g, u] of Object.entries(p)) {
|
489
483
|
if (u.isKeyframes || !u.generator) continue;
|
@@ -493,17 +487,17 @@ ${z}
|
|
493
487
|
config: w
|
494
488
|
}), [m, F] = await Lt(a, g), x = a.slice(m, F);
|
495
489
|
if (u.isClassName) {
|
496
|
-
const
|
497
|
-
a = a.replace(x, E),
|
490
|
+
const D = a, E = ` ${g} = className("${y.classNames}")`;
|
491
|
+
a = a.replace(x, E), D === a && console.error("Minimize file failed to change content", { name: g });
|
498
492
|
}
|
499
493
|
if (x.includes("styled")) {
|
500
|
-
const
|
501
|
-
a = a.replace(x, z), E === a && console.error("Minimize file failed to change content", { name: g, tagName:
|
494
|
+
const D = (c = (n = /styled\(([^,]+),/.exec(x)) == null ? void 0 : n.at(1)) == null ? void 0 : c.trim(), E = a, z = ` ${g} = styled(${D}, "${y.classNames}", ${JSON.stringify(y.clientProps)})`;
|
495
|
+
a = a.replace(x, z), E === a && console.error("Minimize file failed to change content", { name: g, tagName: D });
|
502
496
|
}
|
503
497
|
}
|
504
498
|
if (w.importStrategy === "component") {
|
505
499
|
const g = I(e, 6), u = tt(e);
|
506
|
-
a = `import '../../saltygen/css/${`f_${
|
500
|
+
a = `import '../../saltygen/css/${`f_${A(u.name)}-${g}.css`}';
|
507
501
|
${a}`;
|
508
502
|
}
|
509
503
|
return a = a.replace("@salty-css/react/class-name", "@salty-css/react/class-name-client"), a = a.replace("{ styled }", "{ styledClient as styled }"), a = a.replace("@salty-css/react/styled", "@salty-css/react/styled-client"), a;
|
@@ -513,15 +507,14 @@ ${a}`;
|
|
513
507
|
}
|
514
508
|
};
|
515
509
|
export {
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
Bt as g,
|
510
|
+
me as a,
|
511
|
+
ue as b,
|
512
|
+
qt as c,
|
513
|
+
Ut as d,
|
514
|
+
et as e,
|
515
|
+
pe as g,
|
523
516
|
mt as i,
|
524
517
|
Z as l,
|
525
|
-
|
526
|
-
|
518
|
+
de as m,
|
519
|
+
xt as s
|
527
520
|
};
|