@salty-css/core 0.0.1-alpha.16 → 0.0.1-alpha.160

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/bin-util.d.ts +1 -0
  4. package/bin/index.cjs +1 -8
  5. package/bin/index.js +2 -117
  6. package/bin/logger.d.ts +1 -0
  7. package/bin/main.cjs +11 -0
  8. package/bin/main.d.ts +1 -0
  9. package/bin/main.js +260 -0
  10. package/compiler/get-files.d.ts +3 -0
  11. package/compiler/index.cjs +1 -11
  12. package/compiler/index.d.ts +26 -4
  13. package/compiler/index.js +18 -172
  14. package/config/define-config.d.ts +1 -1
  15. package/config/index.cjs +1 -1
  16. package/config/index.d.ts +2 -1
  17. package/config/index.js +10 -2
  18. package/css/index.cjs +1 -1
  19. package/css/index.d.ts +4 -1
  20. package/css/index.js +121 -2
  21. package/css/keyframes.d.ts +22 -0
  22. package/css/media.d.ts +87 -0
  23. package/css/merge.d.ts +6 -0
  24. package/css/token.d.ts +1 -0
  25. package/{dash-case-DKzpenwY.cjs → dash-case-BJEkFEGQ.cjs} +1 -1
  26. package/{dash-case-DMQMcCO6.js → dash-case-DBThphLm.js} +2 -2
  27. package/factories/define-global-styles.d.ts +7 -0
  28. package/factories/define-variables.d.ts +15 -0
  29. package/factories/index.cjs +1 -0
  30. package/factories/index.d.ts +2 -0
  31. package/factories/index.js +27 -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-BixulVRN.js +397 -0
  39. package/index-C6uCnypW.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-BKvQLGeN.cjs +2 -0
  46. package/parse-templates-BdcpkXBG.js +27 -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 +11 -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,397 @@
1
+ import * as te from "esbuild";
2
+ import { execSync as pe } from "child_process";
3
+ import { t as W, d as B } from "./dash-case-DBThphLm.js";
4
+ import { join as a, parse as Z } from "path";
5
+ import { existsSync as A, writeFileSync as k, mkdirSync as G, readFileSync as M, statSync as de, readdirSync as ue } from "fs";
6
+ import { readFile as se, writeFile as me } from "fs/promises";
7
+ import { p as Y, a as ge } from "./parse-styles-DrLhKtqW.js";
8
+ import { p as ye, a as he } from "./parse-templates-BdcpkXBG.js";
9
+ import { createLogger as be, format as L, transports as $e } from "winston";
10
+ import { m as I } from "./merge-BVm9us1A.js";
11
+ const ne = (e) => {
12
+ if (!e || e === "/") throw new Error("Could not find package.json file");
13
+ const t = a(e, "package.json");
14
+ return A(t) ? t : ne(a(e, ".."));
15
+ }, we = async (e) => {
16
+ const t = ne(e);
17
+ return await se(t, "utf-8").then(JSON.parse).catch(() => {
18
+ });
19
+ }, Se = async (e) => {
20
+ const t = await we(e);
21
+ if (t)
22
+ return t.type;
23
+ };
24
+ let O;
25
+ const oe = async (e) => {
26
+ if (O) return O;
27
+ const t = await Se(e);
28
+ return t === "module" ? O = "esm" : (t === "commonjs" || import.meta.url.endsWith(".cjs")) && (O = "cjs"), O || "esm";
29
+ }, H = be({
30
+ level: "debug",
31
+ format: L.combine(L.colorize(), L.cli()),
32
+ transports: [new $e.Console({})]
33
+ }), ve = (e) => {
34
+ H.error(e);
35
+ };
36
+ function re(e) {
37
+ return e ? typeof e != "string" ? re(String(e)) : e.replace(/[\s-]/g, ".").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g, (t, s) => (s > 0 ? "." : "") + t.toLowerCase()) : "";
38
+ }
39
+ const Ce = {
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
+ }, ae = (e) => {
90
+ if (E.externalModules.length > 0) return E.externalModules;
91
+ const s = M(e, "utf8").match(/externalModules:\s?\[(.*)\]/);
92
+ if (!s) return [];
93
+ const f = s[1].split(",").map((r) => r.replace(/['"`]/g, "").trim());
94
+ return E.externalModules = f, f;
95
+ }, J = async (e) => {
96
+ if (E.destDir) return E.destDir;
97
+ const t = await q(e), s = a(e, (t == null ? void 0 : t.saltygenDir) || "saltygen");
98
+ return E.destDir = s, s;
99
+ }, ie = ["salty", "css", "styles", "styled"], Fe = (e = []) => new RegExp(`\\.(${[...ie, ...e].join("|")})\\.`), Q = (e, t = []) => Fe(t).test(e), ce = async (e) => {
100
+ if (E.rcFile) return E.rcFile;
101
+ if (e === "/") throw new Error("Could not find .saltyrc.json file");
102
+ const t = a(e, ".saltyrc.json"), s = await se(t, "utf-8").then(JSON.parse).catch(() => {
103
+ });
104
+ return s ? (E.rcFile = s, s) : ce(a(e, ".."));
105
+ }, q = async (e) => {
106
+ var f, r;
107
+ const t = await ce(e), s = (f = t.projects) == null ? void 0 : f.find((n) => e.endsWith(n.dir || ""));
108
+ return s || ((r = t.projects) == null ? void 0 : r.find((n) => n.dir === t.defaultProject));
109
+ }, xe = async (e) => {
110
+ const t = await q(e), s = await J(e), f = a(e, (t == null ? void 0 : t.configDir) || "", "salty.config.ts"), r = a(s, "salty.config.js"), n = await oe(e), w = ae(f);
111
+ await te.build({
112
+ entryPoints: [f],
113
+ minify: !0,
114
+ treeShaking: !0,
115
+ bundle: !0,
116
+ outfile: r,
117
+ format: n,
118
+ external: w
119
+ });
120
+ const m = Date.now(), { config: i } = await import(`${r}?t=${m}`);
121
+ return i;
122
+ }, je = async (e, t) => {
123
+ const s = await xe(e), f = /* @__PURE__ */ new Set(), r = (g, y = []) => g ? Object.entries(g).flatMap(([T, j]) => {
124
+ if (!j) return;
125
+ if (typeof j == "object") return r(j, [...y, T]);
126
+ const z = re(T), v = B(T), R = [...y, z].join(".");
127
+ f.add(`"${R}"`);
128
+ const K = [...y.map(B), v].join("-"), { result: fe } = ge(j);
129
+ return `--${K}: ${fe};`;
130
+ }) : [], n = (g) => g ? Object.entries(g).flatMap(([y, T]) => {
131
+ const j = r(T);
132
+ return y === "base" ? j.join("") : `${y} { ${j.join("")} }`;
133
+ }) : [], w = (g) => g ? Object.entries(g).flatMap(([y, T]) => Object.entries(T).flatMap(([j, z]) => {
134
+ const v = r(z, [y]), R = `.${y}-${j}, [data-${y}="${j}"]`, K = v.join("");
135
+ return `${R} { ${K} }`;
136
+ })) : [], m = (g) => t.variables.map((y) => y._current[g]), i = r(I(s.variables, m("variables"))), o = n(I(s.responsiveVariables, m("responsiveVariables"))), p = w(I(s.conditionalVariables, m("conditionalVariables"))), l = await J(e), C = a(l, "css/_variables.css"), D = `:root { ${i.join("")} ${o.join("")} } ${p.join("")}`;
137
+ k(C, D);
138
+ const F = a(l, "css/_global.css"), V = I(s.global, t.globalStyles), x = Y(V, "");
139
+ k(F, `@layer global { ${x} }`);
140
+ const P = a(l, "css/_reset.css"), _ = s.reset === "none" ? {} : typeof s.reset == "object" ? s.reset : Ce, c = Y(_, "");
141
+ k(P, `@layer reset { ${c} }`);
142
+ const h = a(l, "css/_templates.css"), S = ye(s.templates), b = he(s.templates);
143
+ k(h, S);
144
+ const d = a(l, "types/css-tokens.d.ts"), u = `
145
+ // Variable types
146
+ type VariableTokens = ${[...f].join("|")};
147
+ type PropertyValueToken = \`{\${VariableTokens}}\`;
148
+
149
+ // Template types
150
+ type TemplateTokens = {
151
+ ${Object.entries(b).map(([g, y]) => `${g}?: ${y}`).join(`
152
+ `)}
153
+ }
154
+ `;
155
+ k(d, u);
156
+ }, ee = (e) => e.replace(/styled\(([^"'`{,]+),/g, (t, s) => {
157
+ if (/^['"`]/.test(s)) return t;
158
+ const r = new RegExp(`import[^;]*${s}[,\\s{][^;]*from\\s?([^{};]+);`);
159
+ if (!r.test(e)) return t;
160
+ const w = r.exec(e);
161
+ if (w) {
162
+ const m = w.at(1);
163
+ if (ie.some((o) => m == null ? void 0 : m.includes(o))) return t;
164
+ }
165
+ return "styled('div',";
166
+ }), U = async (e, t, s) => {
167
+ const f = W(t), r = a(s, "./temp");
168
+ A(r) || G(r);
169
+ const n = Z(t);
170
+ let w = M(t, "utf8");
171
+ w = ee(w);
172
+ const m = a(s, "js", f + ".js"), i = await q(e), o = a(e, (i == null ? void 0 : i.configDir) || "", "salty.config.ts"), p = ae(o), l = await oe(e);
173
+ await te.build({
174
+ stdin: {
175
+ contents: w,
176
+ sourcefile: n.base,
177
+ resolveDir: n.dir,
178
+ loader: "tsx"
179
+ },
180
+ minify: !1,
181
+ treeShaking: !0,
182
+ bundle: !0,
183
+ outfile: m,
184
+ format: l,
185
+ target: ["node20"],
186
+ keepNames: !0,
187
+ external: p,
188
+ packages: "external",
189
+ plugins: [
190
+ {
191
+ name: "test",
192
+ setup: (F) => {
193
+ F.onLoad({ filter: /.*\.css|salty|styles|styled\.ts/ }, (V) => {
194
+ const x = M(V.path, "utf8");
195
+ return { contents: ee(x), loader: "ts" };
196
+ });
197
+ }
198
+ }
199
+ ]
200
+ });
201
+ const C = Date.now();
202
+ return await import(`${m}?t=${C}`);
203
+ }, X = async (e) => {
204
+ const t = await J(e), s = a(t, "salty.config.js"), f = Date.now(), { config: r } = await import(`${s}?t=${f}`);
205
+ return r;
206
+ }, le = () => {
207
+ try {
208
+ return process.env.NODE_ENV === "production";
209
+ } catch {
210
+ return !1;
211
+ }
212
+ }, Re = async (e, t = le()) => {
213
+ try {
214
+ const s = Date.now();
215
+ t ? H.info("Generating CSS in production mode! 🔥") : H.info("Generating CSS in development mode! 🚀");
216
+ const f = [], r = [], n = await J(e), w = a(n, "index.css");
217
+ (() => {
218
+ A(n) && pe("rm -rf " + n), G(n, { recursive: !0 }), G(a(n, "css")), G(a(n, "types"));
219
+ })();
220
+ const i = {
221
+ keyframes: [],
222
+ mediaQueries: [],
223
+ globalStyles: [],
224
+ variables: [],
225
+ components: []
226
+ };
227
+ async function o(c) {
228
+ const h = ["node_modules", "saltygen"], S = de(c);
229
+ if (S.isDirectory()) {
230
+ const b = ue(c);
231
+ if (h.some(($) => c.includes($))) return;
232
+ await Promise.all(b.map(($) => o(a(c, $))));
233
+ } else if (S.isFile() && Q(c)) {
234
+ const d = await U(e, c, n);
235
+ Object.entries(d).forEach(([$, u]) => {
236
+ u.isKeyframes ? i.keyframes.push({
237
+ value: u,
238
+ src: c,
239
+ name: $
240
+ }) : u.isMedia ? i.mediaQueries.push(u) : u.isGlobalDefine ? i.globalStyles.push(u) : u.isDefineVariables ? i.variables.push(u) : u.generator && i.components.push({
241
+ value: u.generator,
242
+ src: c,
243
+ name: $
244
+ });
245
+ });
246
+ }
247
+ }
248
+ await o(e), await je(e, i);
249
+ const p = await X(e);
250
+ for (const c of i.keyframes) {
251
+ const { value: h } = c, S = `a_${h.animationName}.css`, b = `css/${S}`, d = a(n, b);
252
+ f.push(S), k(d, h.css);
253
+ }
254
+ const l = {};
255
+ for (const c of i.components) {
256
+ const { value: h, name: S, src: b } = c, d = h._withBuildContext({
257
+ name: S,
258
+ config: p,
259
+ prod: t
260
+ });
261
+ r[d.priority] || (r[d.priority] = []), r[d.priority].push(d.cssFileName), p.importStrategy === "component" && (l[b] ? l[b].push(d.cssFileName) : l[b] = [d.cssFileName]);
262
+ const $ = `css/${d.cssFileName}`, u = a(n, $);
263
+ k(u, d.css);
264
+ }
265
+ p.importStrategy === "component" && Object.entries(l).forEach(([c, h]) => {
266
+ const S = h.map((g) => `@import url('./${g}');`).join(`
267
+ `), b = W(c, 6), d = Z(c), $ = B(d.name), u = a(n, `css/f_${$}-${b}.css`);
268
+ k(u, S);
269
+ });
270
+ const C = f.map((c) => `@import url('./css/${c}');`).join(`
271
+ `);
272
+ let x = `@layer reset, global, l0, l1, l2, l3, l4, l5, l6, l7, l8;
273
+
274
+ ${["_variables.css", "_reset.css", "_global.css", "_templates.css"].filter((c) => {
275
+ try {
276
+ return M(a(n, "css", c), "utf8").length > 0;
277
+ } catch {
278
+ return !1;
279
+ }
280
+ }).map((c) => `@import url('./css/${c}');`).join(`
281
+ `)}
282
+ ${C}`;
283
+ if (p.importStrategy !== "component") {
284
+ const c = r.reduce((h, S, b) => {
285
+ const d = S.reduce((y, T) => {
286
+ var R;
287
+ const j = a(n, "css", T), z = M(j, "utf8"), v = ((R = /.*-([^-]+)-\d+.css/.exec(T)) == null ? void 0 : R.at(1)) || W(j, 6);
288
+ return y.includes(v) ? y : `${y}
289
+ /*start:${v}*/
290
+ ${z}
291
+ /*end:${v}*/
292
+ `;
293
+ }, ""), $ = `l_${b}.css`, u = a(n, "css", $), g = `@layer l${b} { ${d}
294
+ }`;
295
+ return k(u, g), `${h}
296
+ @import url('./css/${$}');`;
297
+ }, "");
298
+ x += c;
299
+ }
300
+ k(w, x);
301
+ const N = Date.now() - s, _ = N < 200 ? "🔥" : N < 500 ? "🚀" : N < 1e3 ? "🎉" : N < 2e3 ? "🚗" : N < 5e3 ? "🤔" : "🥴";
302
+ H.info(`Generated CSS in ${N}ms! ${_}`);
303
+ } catch (s) {
304
+ console.error(s);
305
+ }
306
+ }, Oe = async (e, t) => {
307
+ try {
308
+ const s = await J(e);
309
+ if (Q(t)) {
310
+ const r = [], n = await X(e), w = await U(e, t, s);
311
+ Object.entries(w).forEach(([m, i]) => {
312
+ if (i.isKeyframes && i.css) {
313
+ const D = `css/${`a_${i.animationName}.css`}`, F = a(s, D);
314
+ k(F, i.css);
315
+ return;
316
+ }
317
+ if (!i.generator) return;
318
+ const o = i.generator._withBuildContext({
319
+ name: m,
320
+ config: n
321
+ }), p = `css/${o.cssFileName}`, l = a(s, p);
322
+ k(l, o.css), r[o.priority] || (r[o.priority] = []), r[o.priority].push(o.cssFileName);
323
+ }), n.importStrategy !== "component" && r.forEach((m, i) => {
324
+ const o = `l_${i}.css`, p = a(s, "css", o);
325
+ let l = M(p, "utf8");
326
+ m.forEach((C) => {
327
+ var x;
328
+ const D = a(s, "css", C), F = ((x = /.*-([^-]+)-\d+.css/.exec(C)) == null ? void 0 : x.at(1)) || W(D, 6);
329
+ if (!l.includes(F)) {
330
+ const P = M(D, "utf8"), N = `/*start:${F}*/
331
+ ${P}
332
+ /*end:${F}*/
333
+ `;
334
+ l = `${l.replace(/\}$/, "")}
335
+ ${N}
336
+ }`;
337
+ }
338
+ }), k(p, l);
339
+ });
340
+ }
341
+ } catch (s) {
342
+ console.error(s);
343
+ }
344
+ }, Je = async (e, t, s = le()) => {
345
+ try {
346
+ const f = await J(e);
347
+ if (Q(t)) {
348
+ const n = M(t, "utf8");
349
+ n.replace(/^(?!export\s)const\s.*/gm, (p) => `export ${p}`) !== n && await me(t, n);
350
+ const m = await X(e), i = await U(e, t, f);
351
+ let o = n;
352
+ if (Object.entries(i).forEach(([p, l]) => {
353
+ var u;
354
+ if (l.isKeyframes || !l.generator) return;
355
+ const C = l.generator._withBuildContext({
356
+ name: p,
357
+ config: m,
358
+ prod: s
359
+ }), D = new RegExp(`\\s${p}[=\\s]+[^()]+styled\\(([^,]+),`, "g").exec(n);
360
+ if (!D) return console.error("Could not find the original declaration");
361
+ const F = (u = D.at(1)) == null ? void 0 : u.trim(), V = new RegExp(`\\s${p}[=\\s]+styled\\(`, "g").exec(o);
362
+ if (!V) return console.error("Could not find the original declaration");
363
+ const { index: x } = V;
364
+ let P = !1;
365
+ const N = setTimeout(() => P = !0, 5e3);
366
+ let _ = 0, c = !1, h = 0;
367
+ for (; !c && !P; ) {
368
+ const g = o[x + _];
369
+ g === "(" && h++, g === ")" && h--, h === 0 && g === ")" && (c = !0), _ > o.length && (P = !0), _++;
370
+ }
371
+ if (!P) clearTimeout(N);
372
+ else throw new Error("Failed to find the end of the styled call and timed out");
373
+ const S = x + _, b = o.slice(x, S), d = o, $ = ` ${p} = styled(${F}, "${C.classNames}", ${JSON.stringify(C.props)});`;
374
+ o = o.replace(b, $), d === o && console.error("Minimize file failed to change content", { name: p, tagName: F });
375
+ }), m.importStrategy === "component") {
376
+ const p = W(t, 6), l = Z(t);
377
+ o = `import '../../saltygen/css/${`f_${B(l.name)}-${p}.css`}';
378
+ ${o}`;
379
+ }
380
+ return o = o.replace("{ styled }", "{ styledClient as styled }"), o = o.replace("@salty-css/react/styled", "@salty-css/react/styled-client"), o;
381
+ }
382
+ } catch (f) {
383
+ console.error("Error in minimizeFile:", f);
384
+ }
385
+ };
386
+ export {
387
+ ve as a,
388
+ Fe as b,
389
+ je as c,
390
+ U as d,
391
+ Oe as e,
392
+ Re as g,
393
+ Q as i,
394
+ H as l,
395
+ Je as m,
396
+ ie as s
397
+ };
@@ -0,0 +1,29 @@
1
+ "use strict";const fe=require("esbuild"),de=require("child_process"),_=require("./dash-case-BJEkFEGQ.cjs"),r=require("path"),a=require("fs"),Z=require("fs/promises"),B=require("./parse-styles-3zK35muR.cjs"),X=require("./parse-templates-BKvQLGeN.cjs"),q=require("winston"),I=require("./merge-DxGoJDHv.cjs");var K=typeof document<"u"?document.currentScript:null;function ue(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const f=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,f.get?f:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const ee=ue(fe),te=e=>{if(!e||e==="/")throw new Error("Could not find package.json file");const t=r.join(e,"package.json");return a.existsSync(t)?t:te(r.join(e,".."))},pe=async e=>{const t=te(e);return await Z.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},ye=async e=>{const t=await pe(e);if(t)return t.type};let O;const se=async e=>{if(O)return O;const t=await ye(e);return t==="module"?O="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:K&&K.tagName.toUpperCase()==="SCRIPT"&&K.src||new URL("index-C6uCnypW.cjs",document.baseURI).href).endsWith(".cjs"))&&(O="cjs"),O||"esm"},H=q.createLogger({level:"debug",format:q.format.combine(q.format.colorize(),q.format.cli()),transports:[new q.transports.Console({})]}),ge=e=>{H.error(e)};function ne(e){return e?typeof e!="string"?ne(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 me={"*, *::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},oe=e=>{if(E.externalModules.length>0)return E.externalModules;const s=a.readFileSync(e,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!s)return[];const f=s[1].split(",").map(i=>i.replace(/['"`]/g,"").trim());return E.externalModules=f,f},z=async e=>{if(E.destDir)return E.destDir;const t=await U(e),s=r.join(e,(t==null?void 0:t.saltygenDir)||"saltygen");return E.destDir=s,s},A=["salty","css","styles","styled"],re=(e=[])=>new RegExp(`\\.(${[...A,...e].join("|")})\\.`),W=(e,t=[])=>re(t).test(e),ie=async e=>{if(E.rcFile)return E.rcFile;if(e==="/")throw new Error("Could not find .saltyrc.json file");const t=r.join(e,".saltyrc.json"),s=await Z.readFile(t,"utf-8").then(JSON.parse).catch(()=>{});return s?(E.rcFile=s,s):ie(r.join(e,".."))},U=async e=>{var f,i;const t=await ie(e),s=(f=t.projects)==null?void 0:f.find(n=>e.endsWith(n.dir||""));return s||((i=t.projects)==null?void 0:i.find(n=>n.dir===t.defaultProject))},he=async e=>{const t=await U(e),s=await z(e),f=r.join(e,(t==null?void 0:t.configDir)||"","salty.config.ts"),i=r.join(s,"salty.config.js"),n=await se(e),F=oe(f);await ee.build({entryPoints:[f],minify:!0,treeShaking:!0,bundle:!0,outfile:i,format:n,external:F});const g=Date.now(),{config:c}=await import(`${i}?t=${g}`);return c},ae=async(e,t)=>{const s=await he(e),f=new Set,i=(m,h=[])=>m?Object.entries(m).flatMap(([T,k])=>{if(!k)return;if(typeof k=="object")return i(k,[...h,T]);const J=ne(T),v=_.dashCase(T),R=[...h,J].join(".");f.add(`"${R}"`);const L=[...h.map(_.dashCase),v].join("-"),{result:le}=B.parseValueTokens(k);return`--${L}: ${le};`}):[],n=m=>m?Object.entries(m).flatMap(([h,T])=>{const k=i(T);return h==="base"?k.join(""):`${h} { ${k.join("")} }`}):[],F=m=>m?Object.entries(m).flatMap(([h,T])=>Object.entries(T).flatMap(([k,J])=>{const v=i(J,[h]),R=`.${h}-${k}, [data-${h}="${k}"]`,L=v.join("");return`${R} { ${L} }`})):[],g=m=>t.variables.map(h=>h._current[m]),c=i(I.mergeStyles(s.variables,g("variables"))),o=n(I.mergeStyles(s.responsiveVariables,g("responsiveVariables"))),u=F(I.mergeStyles(s.conditionalVariables,g("conditionalVariables"))),d=await z(e),$=r.join(d,"css/_variables.css"),D=`:root { ${c.join("")} ${o.join("")} } ${u.join("")}`;a.writeFileSync($,D);const C=r.join(d,"css/_global.css"),M=I.mergeStyles(s.global,t.globalStyles),x=B.parseStyles(M,"");a.writeFileSync(C,`@layer global { ${x} }`);const N=r.join(d,"css/_reset.css"),V=s.reset==="none"?{}:typeof s.reset=="object"?s.reset:me,l=B.parseStyles(V,"");a.writeFileSync(N,`@layer reset { ${l} }`);const S=r.join(d,"css/_templates.css"),j=X.parseTemplates(s.templates),b=X.getTemplateTypes(s.templates);a.writeFileSync(S,j);const p=r.join(d,"types/css-tokens.d.ts"),y=`
2
+ // Variable types
3
+ type VariableTokens = ${[...f].join("|")};
4
+ type PropertyValueToken = \`{\${VariableTokens}}\`;
5
+
6
+ // Template types
7
+ type TemplateTokens = {
8
+ ${Object.entries(b).map(([m,h])=>`${m}?: ${h}`).join(`
9
+ `)}
10
+ }
11
+ `;a.writeFileSync(p,y)},Y=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 F=i.exec(e);if(F){const g=F.at(1);if(A.some(o=>g==null?void 0:g.includes(o)))return t}return"styled('div',"}),G=async(e,t,s)=>{const f=_.toHash(t),i=r.join(s,"./temp");a.existsSync(i)||a.mkdirSync(i);const n=r.parse(t);let F=a.readFileSync(t,"utf8");F=Y(F);const g=r.join(s,"js",f+".js"),c=await U(e),o=r.join(e,(c==null?void 0:c.configDir)||"","salty.config.ts"),u=oe(o),d=await se(e);await ee.build({stdin:{contents:F,sourcefile:n.base,resolveDir:n.dir,loader:"tsx"},minify:!1,treeShaking:!0,bundle:!0,outfile:g,format:d,target:["node20"],keepNames:!0,external:u,packages:"external",plugins:[{name:"test",setup:C=>{C.onLoad({filter:/.*\.css|salty|styles|styled\.ts/},M=>{const x=a.readFileSync(M.path,"utf8");return{contents:Y(x),loader:"ts"}})}}]});const $=Date.now();return await import(`${g}?t=${$}`)},Q=async e=>{const t=await z(e),s=r.join(t,"salty.config.js"),f=Date.now(),{config:i}=await import(`${s}?t=${f}`);return i},ce=()=>{try{return process.env.NODE_ENV==="production"}catch{return!1}},Se=async(e,t=ce())=>{try{const s=Date.now();t?H.info("Generating CSS in production mode! 🔥"):H.info("Generating CSS in development mode! 🚀");const f=[],i=[],n=await z(e),F=r.join(n,"index.css");(()=>{a.existsSync(n)&&de.execSync("rm -rf "+n),a.mkdirSync(n,{recursive:!0}),a.mkdirSync(r.join(n,"css")),a.mkdirSync(r.join(n,"types"))})();const c={keyframes:[],mediaQueries:[],globalStyles:[],variables:[],components:[]};async function o(l){const S=["node_modules","saltygen"],j=a.statSync(l);if(j.isDirectory()){const b=a.readdirSync(l);if(S.some(w=>l.includes(w)))return;await Promise.all(b.map(w=>o(r.join(l,w))))}else if(j.isFile()&&W(l)){const p=await G(e,l,n);Object.entries(p).forEach(([w,y])=>{y.isKeyframes?c.keyframes.push({value:y,src:l,name:w}):y.isMedia?c.mediaQueries.push(y):y.isGlobalDefine?c.globalStyles.push(y):y.isDefineVariables?c.variables.push(y):y.generator&&c.components.push({value:y.generator,src:l,name:w})})}}await o(e),await ae(e,c);const u=await Q(e);for(const l of c.keyframes){const{value:S}=l,j=`a_${S.animationName}.css`,b=`css/${j}`,p=r.join(n,b);f.push(j),a.writeFileSync(p,S.css)}const d={};for(const l of c.components){const{value:S,name:j,src:b}=l,p=S._withBuildContext({name:j,config:u,prod:t});i[p.priority]||(i[p.priority]=[]),i[p.priority].push(p.cssFileName),u.importStrategy==="component"&&(d[b]?d[b].push(p.cssFileName):d[b]=[p.cssFileName]);const w=`css/${p.cssFileName}`,y=r.join(n,w);a.writeFileSync(y,p.css)}u.importStrategy==="component"&&Object.entries(d).forEach(([l,S])=>{const j=S.map(m=>`@import url('./${m}');`).join(`
12
+ `),b=_.toHash(l,6),p=r.parse(l),w=_.dashCase(p.name),y=r.join(n,`css/f_${w}-${b}.css`);a.writeFileSync(y,j)});const $=f.map(l=>`@import url('./css/${l}');`).join(`
13
+ `);let x=`@layer reset, global, l0, l1, l2, l3, l4, l5, l6, l7, l8;
14
+
15
+ ${["_variables.css","_reset.css","_global.css","_templates.css"].filter(l=>{try{return a.readFileSync(r.join(n,"css",l),"utf8").length>0}catch{return!1}}).map(l=>`@import url('./css/${l}');`).join(`
16
+ `)}
17
+ ${$}`;if(u.importStrategy!=="component"){const l=i.reduce((S,j,b)=>{const p=j.reduce((h,T)=>{var R;const k=r.join(n,"css",T),J=a.readFileSync(k,"utf8"),v=((R=/.*-([^-]+)-\d+.css/.exec(T))==null?void 0:R.at(1))||_.toHash(k,6);return h.includes(v)?h:`${h}
18
+ /*start:${v}*/
19
+ ${J}
20
+ /*end:${v}*/
21
+ `},""),w=`l_${b}.css`,y=r.join(n,"css",w),m=`@layer l${b} { ${p}
22
+ }`;return a.writeFileSync(y,m),`${S}
23
+ @import url('./css/${w}');`},"");x+=l}a.writeFileSync(F,x);const P=Date.now()-s,V=P<200?"🔥":P<500?"🚀":P<1e3?"🎉":P<2e3?"🚗":P<5e3?"🤔":"🥴";H.info(`Generated CSS in ${P}ms! ${V}`)}catch(s){console.error(s)}},be=async(e,t)=>{try{const s=await z(e);if(W(t)){const i=[],n=await Q(e),F=await G(e,t,s);Object.entries(F).forEach(([g,c])=>{if(c.isKeyframes&&c.css){const D=`css/${`a_${c.animationName}.css`}`,C=r.join(s,D);a.writeFileSync(C,c.css);return}if(!c.generator)return;const o=c.generator._withBuildContext({name:g,config:n}),u=`css/${o.cssFileName}`,d=r.join(s,u);a.writeFileSync(d,o.css),i[o.priority]||(i[o.priority]=[]),i[o.priority].push(o.cssFileName)}),n.importStrategy!=="component"&&i.forEach((g,c)=>{const o=`l_${c}.css`,u=r.join(s,"css",o);let d=a.readFileSync(u,"utf8");g.forEach($=>{var x;const D=r.join(s,"css",$),C=((x=/.*-([^-]+)-\d+.css/.exec($))==null?void 0:x.at(1))||_.toHash(D,6);if(!d.includes(C)){const N=a.readFileSync(D,"utf8"),P=`/*start:${C}*/
24
+ ${N}
25
+ /*end:${C}*/
26
+ `;d=`${d.replace(/\}$/,"")}
27
+ ${P}
28
+ }`}}),a.writeFileSync(u,d)})}}catch(s){console.error(s)}},we=async(e,t,s=ce())=>{try{const f=await z(e);if(W(t)){const n=a.readFileSync(t,"utf8");n.replace(/^(?!export\s)const\s.*/gm,u=>`export ${u}`)!==n&&await Z.writeFile(t,n);const g=await Q(e),c=await G(e,t,f);let o=n;if(Object.entries(c).forEach(([u,d])=>{var y;if(d.isKeyframes||!d.generator)return;const $=d.generator._withBuildContext({name:u,config:g,prod:s}),D=new RegExp(`\\s${u}[=\\s]+[^()]+styled\\(([^,]+),`,"g").exec(n);if(!D)return console.error("Could not find the original declaration");const C=(y=D.at(1))==null?void 0:y.trim(),M=new RegExp(`\\s${u}[=\\s]+styled\\(`,"g").exec(o);if(!M)return console.error("Could not find the original declaration");const{index:x}=M;let N=!1;const P=setTimeout(()=>N=!0,5e3);let V=0,l=!1,S=0;for(;!l&&!N;){const m=o[x+V];m==="("&&S++,m===")"&&S--,S===0&&m===")"&&(l=!0),V>o.length&&(N=!0),V++}if(!N)clearTimeout(P);else throw new Error("Failed to find the end of the styled call and timed out");const j=x+V,b=o.slice(x,j),p=o,w=` ${u} = styled(${C}, "${$.classNames}", ${JSON.stringify($.props)});`;o=o.replace(b,w),p===o&&console.error("Minimize file failed to change content",{name:u,tagName:C})}),g.importStrategy==="component"){const u=_.toHash(t,6),d=r.parse(t);o=`import '../../saltygen/css/${`f_${_.dashCase(d.name)}-${u}.css`}';
29
+ ${o}`}return o=o.replace("{ styled }","{ styledClient as styled }"),o=o.replace("@salty-css/react/styled","@salty-css/react/styled-client"),o}}catch(f){console.error("Error in minimizeFile:",f)}};exports.compileSaltyFile=G;exports.generateConfigStyles=ae;exports.generateCss=Se;exports.generateFile=be;exports.isSaltyFile=W;exports.logError=ge;exports.logger=H;exports.minimizeFile=we;exports.saltyFileExtensions=A;exports.saltyFileRegExp=re;
@@ -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.16",
3
+ "version": "0.0.1-alpha.160",
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,2 @@
1
+ "use strict";const a=require("./dash-case-BJEkFEGQ.cjs"),f=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 p=n.trim(),u=o(c,[...t,p]);s.push(u)}else r[n]=c}),Object.keys(r).length){const n=t.map(a.dashCase).join("-"),c=f.parseStyles(r,`.${n}`);s.push(c)}return s.join(`
2
+ `)},y=e=>Object.keys(e),l=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=y;exports.getTemplateTypes=l;exports.parseTemplates=o;
@@ -0,0 +1,27 @@
1
+ import { d as p } from "./dash-case-DBThphLm.js";
2
+ import { p as a } from "./parse-styles-DrLhKtqW.js";
3
+ const u = (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 = u(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 = a(r, `.${n}`);
15
+ s.push(o);
16
+ }
17
+ return s.join(`
18
+ `);
19
+ }, y = (e) => Object.keys(e), b = (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
+ y as g,
26
+ u as p
27
+ };
@@ -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 {
@@ -1,6 +1,7 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=`import { defineConfig } from '@salty-css/core/config';
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=`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
- `;exports.default=o;
7
+ `;exports.default=e;