@salty-css/core 0.0.1-alpha.18 → 0.0.1-alpha.180

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