@salty-css/core 0.0.1-alpha.30 → 0.0.1-alpha.301

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 (118) hide show
  1. package/.saltyrc.schema.json +48 -0
  2. package/README.md +469 -26
  3. package/bin/index.cjs +3 -1
  4. package/bin/index.js +2 -2
  5. package/bin/main.cjs +445 -8
  6. package/bin/main.js +424 -121
  7. package/cache/resolve-dynamic-config-cache.cjs +13 -0
  8. package/cache/resolve-dynamic-config-cache.d.ts +1 -0
  9. package/cache/resolve-dynamic-config-cache.js +13 -0
  10. package/compiler/get-files.d.ts +3 -0
  11. package/compiler/get-function-range.d.ts +1 -0
  12. package/compiler/helpers.d.ts +2 -0
  13. package/compiler/index.cjs +774 -11
  14. package/compiler/index.d.ts +22 -11
  15. package/compiler/index.js +735 -153
  16. package/config/define-config.d.ts +1 -1
  17. package/config/index.cjs +16 -1
  18. package/config/index.d.ts +2 -1
  19. package/config/index.js +14 -2
  20. package/css/index.cjs +12 -1
  21. package/css/index.d.ts +4 -1
  22. package/css/index.js +10 -2
  23. package/css/keyframes.cjs +49 -0
  24. package/css/keyframes.d.ts +22 -0
  25. package/css/keyframes.js +49 -0
  26. package/css/media.cjs +93 -0
  27. package/css/media.d.ts +87 -0
  28. package/css/media.js +93 -0
  29. package/css/merge.cjs +15 -0
  30. package/css/merge.d.ts +7 -0
  31. package/css/merge.js +15 -0
  32. package/css/token.cjs +4 -0
  33. package/css/token.d.ts +1 -0
  34. package/css/token.js +4 -0
  35. package/dash-case-Cz8wwE9a.cjs +32 -0
  36. package/dash-case-NMk0mXyT.js +33 -0
  37. package/define-templates-CVhhgPnd.js +60 -0
  38. package/define-templates-Deq1aCbN.cjs +59 -0
  39. package/factories/define-global-styles.d.ts +7 -0
  40. package/factories/define-media-query.d.ts +8 -0
  41. package/factories/define-templates.d.ts +27 -0
  42. package/factories/define-variables.d.ts +12 -0
  43. package/factories/index.cjs +37 -0
  44. package/factories/index.d.ts +4 -0
  45. package/factories/index.js +37 -0
  46. package/generators/class-name-generator.d.ts +6 -0
  47. package/generators/index.cjs +121 -0
  48. package/generators/index.d.ts +2 -0
  49. package/generators/index.js +121 -0
  50. package/generators/styled-generator.d.ts +20 -0
  51. package/generators/styles-generator.d.ts +22 -0
  52. package/helpers/color.d.ts +18 -0
  53. package/helpers/index.cjs +53 -0
  54. package/helpers/index.d.ts +2 -0
  55. package/helpers/index.js +53 -0
  56. package/helpers/viewport-clamp.d.ts +9 -0
  57. package/helpers-DM2fbDDz.js +18 -0
  58. package/helpers-wv74jTRI.cjs +18 -0
  59. package/index-ByR0nfaf.cjs +4 -0
  60. package/index-DKz1QXqs.js +4 -0
  61. package/package.json +54 -6
  62. package/parse-styles-CqBQc3eQ.js +232 -0
  63. package/parse-styles-D-p_guRO.cjs +231 -0
  64. package/parsers/index.cjs +57 -0
  65. package/parsers/index.d.ts +5 -0
  66. package/parsers/index.js +58 -0
  67. package/parsers/parse-modifiers.d.ts +3 -0
  68. package/parsers/parse-styles.d.ts +13 -0
  69. package/parsers/parse-templates.d.ts +4 -0
  70. package/parsers/parse-tokens.d.ts +3 -0
  71. package/parsers/parser-types.d.ts +8 -0
  72. package/parsers/property-name-check.d.ts +1 -0
  73. package/parsers/unit-check.d.ts +7 -0
  74. package/pascal-case-By_l58S-.cjs +7 -0
  75. package/pascal-case-F3Usi5Wf.js +8 -0
  76. package/{react-styled-file-CGVf5n1B.js → react-styled-file-B99mwk0w.js} +2 -2
  77. package/react-styled-file-U02jek-B.cjs +11 -0
  78. package/react-vanilla-file-Bj6XC8GS.cjs +18 -0
  79. package/react-vanilla-file-D9px70iK.js +18 -0
  80. package/salty.config-DjosWdPw.js +4 -0
  81. package/salty.config-cqavVm2t.cjs +4 -0
  82. package/server/index.cjs +4 -0
  83. package/server/index.d.ts +1 -0
  84. package/server/index.js +4 -0
  85. package/server/should-restart.d.ts +1 -0
  86. package/should-restart-5jI-bzz0.js +18 -0
  87. package/should-restart-DoaGoD5T.cjs +17 -0
  88. package/templates/salty-reset.d.ts +2 -0
  89. package/types/cli-types.d.ts +10 -0
  90. package/types/config-types.d.ts +85 -0
  91. package/types/index.d.ts +57 -23
  92. package/util/dot-case.d.ts +1 -0
  93. package/util/index.cjs +13 -1
  94. package/util/index.js +10 -8
  95. package/util/module-type.d.ts +1 -0
  96. package/viewport-clamp-CEmzmcSj.cjs +10 -0
  97. package/viewport-clamp-K553uXu3.js +11 -0
  98. package/config/config-types.d.ts +0 -59
  99. package/dash-case-DKzpenwY.cjs +0 -1
  100. package/dash-case-DMQMcCO6.js +0 -19
  101. package/generator/index.cjs +0 -1
  102. package/generator/index.d.ts +0 -1
  103. package/generator/index.js +0 -61
  104. package/generator/parse-modifiers.d.ts +0 -3
  105. package/generator/parse-styles.d.ts +0 -2
  106. package/generator/parse-templates.d.ts +0 -2
  107. package/generator/parse-tokens.d.ts +0 -2
  108. package/generator/parser-types.d.ts +0 -4
  109. package/generator/style-generator.d.ts +0 -28
  110. package/index-84Wroia-.cjs +0 -1
  111. package/index-D_732b92.js +0 -4
  112. package/parse-templates-D4p3pgQR.js +0 -92
  113. package/parse-templates-W0YfTmOT.cjs +0 -8
  114. package/pascal-case-BQpR5PdN.js +0 -6
  115. package/pascal-case-iWoaJWwT.cjs +0 -1
  116. package/react-styled-file-Dkubsz-U.cjs +0 -8
  117. package/salty.config-BupieCfE.cjs +0 -6
  118. package/salty.config-D9ANEDiH.js +0 -9
package/compiler/index.js CHANGED
@@ -1,174 +1,756 @@
1
- import * as I from "esbuild";
2
- import { execSync as H } from "child_process";
3
- import { t as T, d as R } from "../dash-case-DMQMcCO6.js";
4
- import { join as o } from "path";
5
- import { writeFileSync as $, existsSync as K, mkdirSync as V, statSync as z, readdirSync as G, readFileSync as M } from "fs";
6
- import { writeFile as J } from "fs/promises";
7
- import { p as q, a as A, b as L } from "../parse-templates-D4p3pgQR.js";
8
- const N = (s) => o(s, "./saltygen"), U = ["salty", "css", "styles", "styled"], W = (s = []) => new RegExp(`\\.(${[...U, ...s].join("|")})\\.`), v = (s, e = []) => W(e).test(s), X = async (s) => {
9
- const e = N(s), n = o(s, "salty.config.ts"), t = o(e, "salty.config.js");
10
- await I.build({
11
- entryPoints: [n],
12
- minify: !0,
13
- treeShaking: !0,
14
- bundle: !0,
15
- outfile: t,
16
- format: "esm",
17
- external: ["react"]
1
+ import * as esbuild from "esbuild";
2
+ import { execSync } from "child_process";
3
+ import { Script } from "vm";
4
+ import { t as toHash, d as dashCase } from "../dash-case-NMk0mXyT.js";
5
+ import { join, parse } from "path";
6
+ import { existsSync, mkdirSync, statSync, readdirSync, readFileSync, writeFileSync } from "fs";
7
+ import { readFile } from "fs/promises";
8
+ import { p as parseAndJoinStyles, a as parseVariableTokens } from "../parse-styles-CqBQc3eQ.js";
9
+ import { parseTemplates, getTemplateTypes } from "../parsers/index.js";
10
+ import { createLogger, transports, format } from "winston";
11
+ import { mergeObjects, mergeFactories } from "../css/merge.js";
12
+ import { d as defineTemplates } from "../define-templates-CVhhgPnd.js";
13
+ import ts from "typescript";
14
+ import { r as resolveExportValue, g as getCorePackageRoot } from "../helpers-DM2fbDDz.js";
15
+ const getPackageJsonPath = (dirname) => {
16
+ if (!dirname || dirname === "/") throw new Error("Could not find package.json file");
17
+ const packageJsonPath = join(dirname, "package.json");
18
+ if (!existsSync(packageJsonPath)) return getPackageJsonPath(join(dirname, ".."));
19
+ return packageJsonPath;
20
+ };
21
+ const getPackageJson = async (dirname) => {
22
+ const packageJsonPath = getPackageJsonPath(dirname);
23
+ const packageJsonContent = await readFile(packageJsonPath, "utf-8").then(JSON.parse).catch(() => void 0);
24
+ return packageJsonContent;
25
+ };
26
+ const readPackageJsonModule = async (dirname) => {
27
+ const packageJsonContent = await getPackageJson(dirname);
28
+ if (!packageJsonContent) return void 0;
29
+ return packageJsonContent.type;
30
+ };
31
+ let cachedModuleType;
32
+ const detectCurrentModuleType = async (dirname) => {
33
+ if (cachedModuleType) return cachedModuleType;
34
+ const packageJsonModule = await readPackageJsonModule(dirname);
35
+ if (packageJsonModule === "module") cachedModuleType = "esm";
36
+ else if (packageJsonModule === "commonjs") cachedModuleType = "cjs";
37
+ else if (import.meta.url.endsWith(".cjs")) cachedModuleType = "cjs";
38
+ return cachedModuleType || "esm";
39
+ };
40
+ const logger = createLogger({
41
+ level: "debug",
42
+ format: format.combine(format.colorize(), format.cli()),
43
+ transports: [new transports.Console({})]
44
+ });
45
+ const logError = (message) => {
46
+ logger.error(message);
47
+ };
48
+ function dotCase(str) {
49
+ if (!str) return "";
50
+ if (typeof str !== "string") return dotCase(String(str));
51
+ return str.replace(/[^\d\w]/g, ".");
52
+ }
53
+ const saltyReset = {
54
+ /** Set box model to border-box */
55
+ "*, *::before, *::after": {
56
+ boxSizing: "border-box"
57
+ },
58
+ /** Remove default margin and padding */
59
+ "*": {
60
+ margin: 0
61
+ },
62
+ /** Remove adjust font properties */
63
+ html: {
64
+ lineHeight: 1.15,
65
+ textSizeAdjust: "100%",
66
+ WebkitFontSmoothing: "antialiased"
67
+ },
68
+ /** Make media elements responsive */
69
+ "img, picture, video, canvas, svg": {
70
+ display: "block",
71
+ maxWidth: "100%"
72
+ },
73
+ /** Avoid overflow of text */
74
+ "p, h1, h2, h3, h4, h5, h6": {
75
+ overflowWrap: "break-word"
76
+ },
77
+ /** Improve text wrapping */
78
+ p: {
79
+ textWrap: "pretty"
80
+ },
81
+ "h1, h2, h3, h4, h5, h6": {
82
+ textWrap: "balance"
83
+ },
84
+ /** Improve link color */
85
+ a: {
86
+ color: "currentColor"
87
+ },
88
+ /** Improve button line height */
89
+ button: {
90
+ lineHeight: "1em",
91
+ color: "currentColor"
92
+ },
93
+ /** Improve form elements */
94
+ "input, optgroup, select, textarea": {
95
+ fontFamily: "inherit",
96
+ fontSize: "100%",
97
+ lineHeight: "1.15em"
98
+ }
99
+ };
100
+ const getFunctionRange = (contents, name) => {
101
+ return new Promise((resolve, reject) => {
102
+ const timeout = setTimeout(() => {
103
+ reject(new Error("Timeout"));
104
+ }, 100);
105
+ const sourceFile = ts.createSourceFile("temp.ts", contents, ts.ScriptTarget.Latest, true);
106
+ function visit(node) {
107
+ if (ts.isVariableDeclaration(node) && node.name.getText() === name) {
108
+ const start = node.getStart();
109
+ const end = node.getEnd();
110
+ clearTimeout(timeout);
111
+ resolve([start, end]);
112
+ }
113
+ node.forEachChild(visit);
114
+ }
115
+ visit(sourceFile);
18
116
  });
19
- const c = Date.now(), { config: S } = await import(`${t}?t=${c}`);
20
- return S;
21
- }, Y = async (s) => {
22
- const e = await X(s), n = /* @__PURE__ */ new Set(), t = (u, l = []) => u ? Object.entries(u).flatMap(([p, r]) => {
23
- if (!r) return;
24
- if (typeof r == "object") return t(r, [...l, p]);
25
- const x = [...l, p].join(".");
26
- n.add(`"${x}"`);
27
- const C = [...l.map(R), R(p)].join("-"), { result: D } = L(r);
28
- return `--${C}: ${D};`;
29
- }) : [], c = (u) => u ? Object.entries(u).flatMap(([l, p]) => {
30
- const r = t(p);
31
- return l === "base" ? r.join("") : `${l} { ${r.join("")} }`;
32
- }) : [], S = (u) => u ? Object.entries(u).flatMap(([l, p]) => Object.entries(p).flatMap(([r, x]) => {
33
- const C = t(x, [l]), D = `.${l}-${r}, [data-${l}="${r}"]`, P = C.join("");
34
- return `${D} { ${P} }`;
35
- })) : [], d = t(e.variables), w = c(e.responsiveVariables), a = S(e.conditionalVariables), b = N(s), f = o(b, "css/variables.css"), i = `:root { ${d.join("")} ${w.join("")} } ${a.join("")}`;
36
- $(f, i);
37
- const y = o(b, "types/css-tokens.d.ts"), m = `type VariableTokens = ${[...n].join("|")}; type PropertyValueToken = \`{\${VariableTokens}}\``;
38
- $(y, m);
39
- const g = o(b, "css/global.css"), F = q(e.global, "");
40
- $(g, F);
41
- const j = o(b, "css/templates.css"), k = A(e.templates);
42
- $(j, k);
43
- }, E = async (s, e) => {
44
- const n = T(s), t = o(e, "js", n + ".js");
45
- await I.build({
46
- entryPoints: [s],
47
- minify: !0,
48
- treeShaking: !0,
49
- bundle: !0,
50
- outfile: t,
51
- format: "esm",
52
- target: ["es2022"],
53
- keepNames: !0,
54
- external: ["react"]
117
+ };
118
+ const cache = {
119
+ externalModules: [],
120
+ rcFile: void 0,
121
+ destDir: void 0
122
+ };
123
+ const getExternalModules = (coreConfigPath) => {
124
+ if (cache.externalModules.length > 0) return cache.externalModules;
125
+ const content = readFileSync(coreConfigPath, "utf8");
126
+ const match = content.match(/externalModules:\s?\[(.*)\]/);
127
+ if (!match) return [];
128
+ const externalModules = match[1].split(",").map((d) => d.replace(/['"`]/g, "").trim());
129
+ cache.externalModules = externalModules;
130
+ return externalModules;
131
+ };
132
+ const getDestDir = async (dirname) => {
133
+ if (cache.destDir) return cache.destDir;
134
+ const projectConfig = await getRCProjectConfig(dirname);
135
+ const destDir = join(dirname, (projectConfig == null ? void 0 : projectConfig.saltygenDir) || "saltygen");
136
+ cache.destDir = destDir;
137
+ return destDir;
138
+ };
139
+ const saltyFileExtensions = ["salty", "css", "styles", "styled"];
140
+ const saltyFileRegExp = (additional = []) => new RegExp(`\\.(${[...saltyFileExtensions, ...additional].join("|")})\\.`);
141
+ const isSaltyFile = (file, additional = []) => saltyFileRegExp(additional).test(file);
142
+ const readRCFile = async (currentDir) => {
143
+ if (cache.rcFile) return cache.rcFile;
144
+ if (currentDir === "/") throw new Error("Could not find .saltyrc.json file");
145
+ const rcPath = join(currentDir, ".saltyrc.json");
146
+ const rcContent = await readFile(rcPath, "utf-8").then(JSON.parse).catch(() => void 0);
147
+ if (!rcContent) return readRCFile(join(currentDir, ".."));
148
+ cache.rcFile = rcContent;
149
+ return rcContent;
150
+ };
151
+ const getRCProjectConfig = async (dirname) => {
152
+ var _a, _b;
153
+ const rcFile = await readRCFile(dirname);
154
+ const projectConfig = (_a = rcFile.projects) == null ? void 0 : _a.find((project) => dirname.endsWith(project.dir || ""));
155
+ if (!projectConfig) return (_b = rcFile.projects) == null ? void 0 : _b.find((project) => project.dir === rcFile.defaultProject);
156
+ return projectConfig;
157
+ };
158
+ const generateConfig = async (dirname) => {
159
+ const rcProject = await getRCProjectConfig(dirname);
160
+ const destDir = await getDestDir(dirname);
161
+ const coreConfigPath = join(dirname, (rcProject == null ? void 0 : rcProject.configDir) || "", "salty.config.ts");
162
+ const coreConfigDest = join(destDir, "salty.config.js");
163
+ await detectCurrentModuleType(dirname);
164
+ const externalModules = getExternalModules(coreConfigPath);
165
+ await esbuild.build({
166
+ entryPoints: [coreConfigPath],
167
+ minify: true,
168
+ treeShaking: true,
169
+ bundle: true,
170
+ outfile: coreConfigDest,
171
+ format: "cjs",
172
+ external: externalModules
55
173
  });
56
- const c = Date.now();
57
- return await import(`${t}?t=${c}`);
58
- }, O = async (s) => {
59
- const e = N(s), n = o(e, "salty.config.js"), { config: t } = await import(n);
60
- return t;
61
- }, ot = async (s) => {
174
+ const raw = await readFile(coreConfigDest, "utf8");
175
+ const scriptReal = new Script(raw);
176
+ const context = { module: { exports: {} } };
177
+ scriptReal.runInNewContext(context);
178
+ const { config } = context.module.exports;
179
+ return {
180
+ config,
181
+ path: coreConfigDest
182
+ };
183
+ };
184
+ const generateConfigStyles = async (dirname, configFiles) => {
185
+ var _a, _b;
186
+ const destDir = await getDestDir(dirname);
187
+ const generationResults = {
188
+ mediaQueries: [],
189
+ globalStyles: [],
190
+ variables: [],
191
+ templates: []
192
+ };
193
+ await Promise.all(
194
+ [...configFiles].map(async (src) => {
195
+ const { contents, outputFilePath } = await compileSaltyFile(dirname, src, destDir);
196
+ Object.entries(contents).forEach(([name, value]) => {
197
+ if (value.isMedia) generationResults.mediaQueries.push([name, value]);
198
+ else if (value.isGlobalDefine) generationResults.globalStyles.push(value);
199
+ else if (value.isDefineVariables) generationResults.variables.push(value);
200
+ else if (value.isDefineTemplates) generationResults.templates.push(value._setPath(`${name};;${outputFilePath}`));
201
+ });
202
+ })
203
+ );
204
+ const { config, path: configPath } = await generateConfig(dirname);
205
+ const configCacheContent = { ...config };
206
+ const { mediaQueries } = generationResults;
207
+ configCacheContent.mediaQueries = Object.fromEntries(mediaQueries.map(([name, value]) => [`@${name}`, value]));
208
+ const mediaQueryKeys = mediaQueries.map(([name]) => `'@${name}'`).join(" | ");
209
+ const variableTokens = /* @__PURE__ */ new Set();
210
+ const parseVariables = async (obj, path = []) => {
211
+ if (!obj) return [];
212
+ const promises = Object.entries(obj).map(async ([key, value]) => {
213
+ const parseVariable = async (value2) => {
214
+ if (!value2) return void 0;
215
+ if (value2 instanceof Promise) return await parseVariable(await value2);
216
+ if (typeof value2 === "function") return await parseVariable(await value2());
217
+ if (typeof value2 === "object") return await parseVariables(value2, [...path, key]);
218
+ const dottedKey = dotCase(key);
219
+ const dashedKey = dashCase(key);
220
+ const tsName = [...path, dottedKey].join(".");
221
+ variableTokens.add(`"${tsName}"`);
222
+ const cssName = [...path.map(dashCase), dashedKey].join("-");
223
+ const result = parseVariableTokens(value2);
224
+ if (!result) return `--${cssName}: ${value2};`;
225
+ return `--${cssName}: ${result.transformed};`;
226
+ };
227
+ return await parseVariable(value);
228
+ });
229
+ const results = await Promise.all(promises);
230
+ return results.flat();
231
+ };
232
+ const parseResponsiveVariables = async (obj) => {
233
+ if (!obj) return [];
234
+ const promises = Object.entries(obj).map(async ([mediaQuery, values]) => {
235
+ const variables = await parseVariables(values);
236
+ if (mediaQuery === "base") return variables.join("");
237
+ if (configCacheContent.mediaQueries[mediaQuery]) {
238
+ const mediaQueryValue = configCacheContent.mediaQueries[mediaQuery];
239
+ return `${mediaQueryValue} { ${variables.join("")} }`;
240
+ }
241
+ return `${mediaQuery} { ${variables.join("")} }`;
242
+ });
243
+ const results = await Promise.all(promises);
244
+ return results.flat();
245
+ };
246
+ const parseConditionalVariables = async (obj) => {
247
+ if (!obj) return [];
248
+ const promises = Object.entries(obj).map(async ([property, conditions]) => {
249
+ const promises2 = Object.entries(conditions).map(async ([condition, values]) => {
250
+ const variables = await parseVariables(values, [property]);
251
+ const conditionScope = `.${property}-${condition}, [data-${property}="${condition}"]`;
252
+ const combined = variables.join("");
253
+ return `${conditionScope} { ${combined} }`;
254
+ });
255
+ const result = await Promise.all(promises2);
256
+ return result.flat();
257
+ });
258
+ const results = await Promise.all(promises);
259
+ return results.flat();
260
+ };
261
+ const getStaticVariables = (variables = {}) => {
262
+ return { ...variables, responsive: void 0, conditional: void 0 };
263
+ };
264
+ const getGeneratedVariables = (type) => {
265
+ return generationResults.variables.map((factory) => {
266
+ if (type === "static") return getStaticVariables(factory._current);
267
+ return factory._current[type];
268
+ });
269
+ };
270
+ const _staticVariables = mergeObjects(getStaticVariables(config.variables), getGeneratedVariables("static"));
271
+ const staticVariables = await parseVariables(_staticVariables);
272
+ const _responsiveVariables = mergeObjects((_a = config.variables) == null ? void 0 : _a.responsive, getGeneratedVariables("responsive"));
273
+ const responsiveVariables = await parseResponsiveVariables(_responsiveVariables);
274
+ const _conditionalVariables = mergeObjects((_b = config.variables) == null ? void 0 : _b.conditional, getGeneratedVariables("conditional"));
275
+ const conditionalVariables = await parseConditionalVariables(_conditionalVariables);
276
+ const variablesPath = join(destDir, "css/_variables.css");
277
+ const variablesCss = `:root { ${staticVariables.join("")} ${responsiveVariables.join("")} } ${conditionalVariables.join("")}`;
278
+ writeFileSync(variablesPath, variablesCss);
279
+ configCacheContent.staticVariables = _staticVariables;
280
+ const globalStylesPath = join(destDir, "css/_global.css");
281
+ const mergedGlobalStyles = mergeObjects(config.global, generationResults.globalStyles);
282
+ const globalStylesString = await parseAndJoinStyles(mergedGlobalStyles, "");
283
+ writeFileSync(globalStylesPath, `@layer global { ${globalStylesString} }`);
284
+ const resetStylesPath = join(destDir, "css/_reset.css");
285
+ const getResetStyles = () => {
286
+ if (config.reset === "none") return {};
287
+ if (typeof config.reset === "object") return config.reset;
288
+ return saltyReset;
289
+ };
290
+ const resetStyles = getResetStyles();
291
+ const resetStylesString = await parseAndJoinStyles(resetStyles, "");
292
+ writeFileSync(resetStylesPath, `@layer reset { ${resetStylesString} }`);
293
+ const templateStylesPath = join(destDir, "css/_templates.css");
294
+ const templates = mergeObjects(config.templates, generationResults.templates);
295
+ const templateStylesString = await parseTemplates(templates);
296
+ const templateTokens = getTemplateTypes(templates);
297
+ writeFileSync(templateStylesPath, `@layer templates { ${templateStylesString} }`);
298
+ configCacheContent.templates = templates;
299
+ const configTemplateFactories = config.templates ? [defineTemplates(config.templates)._setPath(`config;;${configPath}`)] : [];
300
+ const templateFactories = mergeFactories(generationResults.templates, configTemplateFactories);
301
+ configCacheContent.templatePaths = Object.fromEntries(Object.entries(templateFactories).map(([key, faktory]) => [key, faktory._path]));
302
+ const tsTokensPath = join(destDir, "types/css-tokens.d.ts");
303
+ const tsVariableTokens = [...variableTokens].join("|");
304
+ const tsTokensTypes = `
305
+ // Variable types
306
+ type VariableTokens = ${tsVariableTokens || `''`};
307
+ type PropertyValueToken = \`{\${VariableTokens}}\`;
308
+
309
+ // Template types
310
+ type TemplateTokens = {
311
+ ${Object.entries(templateTokens).map(([key, value]) => `${key}?: ${value}`).join("\n")}
312
+ }
313
+
314
+ // Media query types
315
+ type MediaQueryKeys = ${mediaQueryKeys || `''`};
316
+ `;
317
+ writeFileSync(tsTokensPath, tsTokensTypes);
318
+ const configCachePath = join(destDir, "cache/config-cache.json");
319
+ writeFileSync(configCachePath, JSON.stringify(configCacheContent, null, 2));
320
+ const corePackageRoot = getCorePackageRoot();
321
+ const configCacheSecondaryPath = join(corePackageRoot, "cache/config-cache.json");
322
+ writeFileSync(configCacheSecondaryPath, JSON.stringify(configCacheContent, null, 2));
323
+ };
324
+ const replaceStyledTag = (currentFile) => {
325
+ return currentFile.replace(/styled\(([^"'`{,]+),/g, (match, tag) => {
326
+ const isString = /^['"`]/.test(tag);
327
+ if (isString) return match;
328
+ const isImportedRegExp = new RegExp(`import[^;]*${tag}[,\\s{][^;]*from\\s?([^{};]+);`);
329
+ const isImported = isImportedRegExp.test(currentFile);
330
+ if (!isImported) return match;
331
+ const importResult = isImportedRegExp.exec(currentFile);
332
+ if (importResult) {
333
+ const importPath = importResult.at(1);
334
+ const isSaltyImport = saltyFileExtensions.some((ext) => importPath == null ? void 0 : importPath.includes(ext));
335
+ if (isSaltyImport) return match;
336
+ }
337
+ return "styled('div',";
338
+ });
339
+ };
340
+ const addConfigCache = (currentFile, dirname) => {
341
+ try {
342
+ const saltyCachedConfig = readFileSync(join(dirname, "saltygen/cache/config-cache.json"), "utf8");
343
+ if (!saltyCachedConfig) return `globalThis.saltyConfig = {};
344
+
345
+ ${currentFile}`;
346
+ return `globalThis.saltyConfig = ${saltyCachedConfig};
347
+
348
+ ${currentFile}`;
349
+ } catch {
350
+ return currentFile;
351
+ }
352
+ };
353
+ const compileSaltyFile = async (dirname, sourceFilePath, outputDirectory) => {
354
+ const hashedName = toHash(sourceFilePath);
355
+ const tempDir = join(outputDirectory, "./temp");
356
+ if (!existsSync(tempDir)) mkdirSync(tempDir);
357
+ const parsed = parse(sourceFilePath);
358
+ let currentFile = readFileSync(sourceFilePath, "utf8");
359
+ currentFile = replaceStyledTag(currentFile);
360
+ currentFile = addConfigCache(currentFile, dirname);
361
+ const outputFilePath = join(outputDirectory, "js", hashedName + ".js");
362
+ const rcProject = await getRCProjectConfig(dirname);
363
+ const coreConfigPath = join(dirname, (rcProject == null ? void 0 : rcProject.configDir) || "", "salty.config.ts");
364
+ const externalModules = getExternalModules(coreConfigPath);
365
+ await detectCurrentModuleType(dirname);
366
+ await esbuild.build({
367
+ stdin: {
368
+ contents: currentFile,
369
+ sourcefile: parsed.base,
370
+ resolveDir: parsed.dir,
371
+ loader: "tsx"
372
+ },
373
+ minify: false,
374
+ treeShaking: true,
375
+ bundle: true,
376
+ outfile: outputFilePath,
377
+ format: "cjs",
378
+ target: ["node20"],
379
+ keepNames: true,
380
+ external: externalModules,
381
+ packages: "external",
382
+ plugins: [
383
+ {
384
+ name: "test",
385
+ setup: (build) => {
386
+ build.onLoad({ filter: /.*\.css|salty|styles|styled\.ts/ }, (args) => {
387
+ const original = readFileSync(args.path, "utf8");
388
+ const modified = replaceStyledTag(original);
389
+ return { contents: modified, loader: "ts" };
390
+ });
391
+ }
392
+ }
393
+ ]
394
+ });
395
+ const context = { module: { exports: {} } };
396
+ const raw = await readFile(outputFilePath, "utf8");
397
+ new Script(raw).runInNewContext(context);
398
+ return {
399
+ contents: context.module.exports,
400
+ outputFilePath
401
+ };
402
+ };
403
+ const getConfigCache = async (dirname) => {
404
+ const destDir = await getDestDir(dirname);
405
+ const coreConfigDest = join(destDir, "cache/config-cache.json");
406
+ const contents = readFileSync(coreConfigDest, "utf8");
407
+ if (!contents) throw new Error("Could not find config cache file");
408
+ return JSON.parse(contents);
409
+ };
410
+ const getConfig = async (dirname) => {
411
+ const cached = await getConfigCache(dirname);
412
+ const destDir = await getDestDir(dirname);
413
+ const coreConfigDest = join(destDir, "salty.config.js");
414
+ const context = { module: { exports: {} } };
415
+ const raw = await readFile(coreConfigDest, "utf8");
416
+ new Script(raw).runInNewContext(context);
417
+ const { config } = context.module.exports;
418
+ return mergeObjects(config, cached);
419
+ };
420
+ const isProduction = () => {
421
+ try {
422
+ return process.env["NODE_ENV"] === "production";
423
+ } catch {
424
+ return false;
425
+ }
426
+ };
427
+ const generateCss = async (dirname, prod = isProduction(), clean = true) => {
62
428
  try {
63
- const e = [], n = [], t = N(s), c = o(t, "index.css");
64
- (() => {
65
- K(t) && H("rm -rf " + t), V(t), V(o(t, "css")), V(o(t, "types"));
66
- })(), await Y(s);
67
- const d = await O(s);
68
- async function w(i, y) {
69
- const h = z(i);
70
- if (h.isDirectory()) {
71
- const m = G(i);
72
- await Promise.all(m.map((g) => w(o(i, g), o(y, g))));
73
- } else if (h.isFile() && v(i)) {
74
- const g = await E(i, t), F = [];
75
- Object.entries(g).forEach(([l, p]) => {
76
- if (p.isKeyframes && p.css) {
77
- const P = `${p.animationName}.css`, _ = `css/${P}`, B = o(t, _);
78
- e.push(P), $(B, p.css);
79
- return;
429
+ const start = Date.now();
430
+ if (prod) logger.info("Generating CSS in production mode! 🔥");
431
+ else logger.info("Generating CSS in development mode! 🚀");
432
+ const globalCssFiles = [];
433
+ const cssFiles = [];
434
+ const destDir = await getDestDir(dirname);
435
+ const cssFile = join(destDir, "index.css");
436
+ const clearDistDir = () => {
437
+ if (existsSync(destDir)) execSync("rm -rf " + destDir);
438
+ mkdirSync(destDir, { recursive: true });
439
+ mkdirSync(join(destDir, "css"));
440
+ mkdirSync(join(destDir, "types"));
441
+ mkdirSync(join(destDir, "js"));
442
+ mkdirSync(join(destDir, "cache"));
443
+ };
444
+ if (clean) clearDistDir();
445
+ const files = /* @__PURE__ */ new Set();
446
+ const configFiles = /* @__PURE__ */ new Set();
447
+ async function collectFiles(src) {
448
+ const foldersToSkip = ["node_modules", "saltygen"];
449
+ const stats = statSync(src);
450
+ if (stats.isDirectory()) {
451
+ const files2 = readdirSync(src);
452
+ const shouldSkip = foldersToSkip.some((folder) => src.includes(folder));
453
+ if (shouldSkip) return;
454
+ await Promise.all(files2.map((file) => collectFiles(join(src, file))));
455
+ } else if (stats.isFile()) {
456
+ const validFile = isSaltyFile(src);
457
+ if (validFile) {
458
+ files.add(src);
459
+ const contents = readFileSync(src, "utf8");
460
+ const hasDefineFunction = /define[\w\d]+\(/.test(contents);
461
+ if (hasDefineFunction) configFiles.add(src);
462
+ }
463
+ }
464
+ }
465
+ await collectFiles(dirname);
466
+ await generateConfigStyles(dirname, configFiles);
467
+ const generationResults = {
468
+ keyframes: [],
469
+ components: [],
470
+ classNames: []
471
+ };
472
+ await Promise.all(
473
+ [...files].map(async (src) => {
474
+ const { contents } = await compileSaltyFile(dirname, src, destDir);
475
+ for (let [name, value] of Object.entries(contents)) {
476
+ const resolved = await resolveExportValue(value, 1);
477
+ if (resolved.isKeyframes) {
478
+ generationResults.keyframes.push({
479
+ value: resolved,
480
+ src,
481
+ name
482
+ });
483
+ } else if (resolved.isClassName) {
484
+ generationResults.classNames.push({
485
+ ...value,
486
+ src,
487
+ name
488
+ });
489
+ } else if (resolved.generator) {
490
+ generationResults.components.push({
491
+ ...value,
492
+ src,
493
+ name
494
+ });
80
495
  }
81
- if (!p.generator) return;
82
- const r = p.generator._withBuildContext({
83
- name: l,
84
- config: d
85
- }), x = `${r.hash}-${r.priority}.css`;
86
- n[r.priority] || (n[r.priority] = []), n[r.priority].push(x), F.push(x);
87
- const C = `css/${x}`, D = o(t, C);
88
- $(D, r.css);
89
- });
90
- const j = F.map((l) => `@import url('./${l}');`).join(`
91
- `), k = T(i, 6), u = o(t, `css/${k}.css`);
92
- $(u, j);
496
+ }
497
+ })
498
+ );
499
+ const config = await getConfig(dirname);
500
+ for (const keyframes of generationResults.keyframes) {
501
+ const { value } = keyframes;
502
+ const fileName = `a_${value.animationName}.css`;
503
+ const filePath = `css/${fileName}`;
504
+ const cssPath = join(destDir, filePath);
505
+ globalCssFiles.push(fileName);
506
+ writeFileSync(cssPath, value.css);
507
+ }
508
+ const localCssFiles = {};
509
+ for (const componentResult of generationResults.components) {
510
+ const { src, name } = componentResult;
511
+ if (!localCssFiles[src]) localCssFiles[src] = [];
512
+ const generator = componentResult.generator._withBuildContext({
513
+ callerName: name,
514
+ isProduction: prod,
515
+ config
516
+ });
517
+ if (!cssFiles[generator.priority]) cssFiles[generator.priority] = [];
518
+ const styles = await generator.css;
519
+ if (!styles) continue;
520
+ cssFiles[generator.priority].push(generator.cssFileName);
521
+ const filePath = `css/${generator.cssFileName}`;
522
+ const cssPath = join(destDir, filePath);
523
+ writeFileSync(cssPath, styles);
524
+ if (config.importStrategy === "component") {
525
+ localCssFiles[src].push(generator.cssFileName);
93
526
  }
94
527
  }
95
- await w(s, t);
96
- const a = e.map((i) => `@import url('./css/${i}');`).join(`
97
- `);
98
- let f = `@layer l0, l1, l2, l3, l4, l5, l6, l7, l8;
528
+ for (const classNameResult of generationResults.classNames) {
529
+ const { src, name } = classNameResult;
530
+ if (!localCssFiles[src]) localCssFiles[src] = [];
531
+ const generator = classNameResult.generator._withBuildContext({
532
+ callerName: name,
533
+ isProduction: prod,
534
+ config
535
+ });
536
+ const styles = await generator.css;
537
+ if (!styles) continue;
538
+ if (!cssFiles[generator.priority]) cssFiles[generator.priority] = [];
539
+ cssFiles[generator.priority].push(generator.cssFileName);
540
+ const filePath = `css/${generator.cssFileName}`;
541
+ const cssPath = join(destDir, filePath);
542
+ writeFileSync(cssPath, styles);
543
+ if (config.importStrategy === "component") {
544
+ localCssFiles[src].push(generator.cssFileName);
545
+ }
546
+ }
547
+ if (config.importStrategy === "component") {
548
+ Object.entries(localCssFiles).forEach(([src, localCssFile]) => {
549
+ const cssContent2 = localCssFile.map((file) => `@import url('./${file}');`).join("\n");
550
+ const hashName = toHash(src, 6);
551
+ const parsedPath = parse(src);
552
+ const dasherized = dashCase(parsedPath.name);
553
+ const cssFile2 = join(destDir, `css/f_${dasherized}-${hashName}.css`);
554
+ writeFileSync(cssFile2, cssContent2 || `/* Empty file */`);
555
+ });
556
+ }
557
+ const otherGlobalCssFiles = globalCssFiles.map((file) => `@import url('./css/${file}');`).join("\n");
558
+ const globalCssFilenames = ["_variables.css", "_reset.css", "_global.css", "_templates.css"];
559
+ const importsWithData = globalCssFilenames.filter((file) => {
560
+ try {
561
+ const data = readFileSync(join(destDir, "css", file), "utf8");
562
+ return data.length > 0;
563
+ } catch {
564
+ return false;
565
+ }
566
+ });
567
+ const globalImports = importsWithData.map((file) => `@import url('./css/${file}');`);
568
+ const generatorText = "/*!\n * Generated with Salty CSS (https://salty-css.dev)\n * Do not edit this file directly\n */\n";
569
+ let cssContent = `${generatorText}@layer reset, global, templates, l0, l1, l2, l3, l4, l5, l6, l7, l8;
99
570
 
100
- ${["@import url('./css/variables.css');", "@import url('./css/global.css');", "@import url('./css/templates.css');"].join(`
101
- `)}
102
- ${a}`;
103
- if (d.importStrategy !== "component") {
104
- const i = n.flat().map((y) => `@import url('./css/${y}');`).join(`
105
- `);
106
- f += i;
571
+ ${globalImports.join(
572
+ "\n"
573
+ )}
574
+ ${otherGlobalCssFiles}`;
575
+ if (config.importStrategy !== "component") {
576
+ const mergedContent = cssFiles.reduce((acc, val, layer) => {
577
+ const layerContent = val.reduce((layerAcc, file) => {
578
+ var _a;
579
+ const filepath = join(destDir, "css", file);
580
+ const css = readFileSync(filepath, "utf8");
581
+ const filepathHash = ((_a = /.*-([^-]+)-\d+.css/.exec(file)) == null ? void 0 : _a.at(1)) || toHash(filepath, 6);
582
+ if (layerAcc.includes(filepathHash)) return layerAcc;
583
+ return `${layerAcc}
584
+ /*start:${filepathHash}-${file}*/
585
+ ${css}
586
+ /*end:${filepathHash}*/
587
+ `;
588
+ }, "");
589
+ const layerFileName = `l_${layer}.css`;
590
+ const layerFilePath = join(destDir, "css", layerFileName);
591
+ const layerContentWithLayer = `@layer l${layer} { ${layerContent}
592
+ }`;
593
+ writeFileSync(layerFilePath, layerContentWithLayer);
594
+ return `${acc}
595
+ @import url('./css/${layerFileName}');`;
596
+ }, "");
597
+ cssContent += mergedContent;
107
598
  }
108
- $(c, f);
599
+ writeFileSync(cssFile, cssContent);
600
+ const end = Date.now();
601
+ const time = end - start;
602
+ const emoji = time < 200 ? "🔥" : time < 500 ? "🚀" : time < 1e3 ? "🎉" : time < 2e3 ? "🚗" : time < 5e3 ? "🤔" : "🥴";
603
+ logger.info(`Generated CSS in ${time}ms! ${emoji}`);
109
604
  } catch (e) {
110
605
  console.error(e);
111
606
  }
112
- }, it = async (s, e) => {
607
+ };
608
+ const generateFile = async (dirname, file, prod = isProduction()) => {
113
609
  try {
114
- const n = [], t = o(s, "./saltygen"), c = o(t, "index.css");
115
- if (v(e)) {
116
- const d = await O(s), w = await E(e, t);
117
- Object.entries(w).forEach(([y, h]) => {
118
- if (!h.generator) return;
119
- const m = h.generator._withBuildContext({
120
- name: y,
121
- config: d
122
- }), g = `${m.hash}-${m.priority}.css`, F = `css/${g}`, j = o(t, F);
123
- n.push(g), $(j, m.css);
124
- });
125
- const a = M(c, "utf8").split(`
126
- `), b = n.map((y) => `@import url('../saltygen/css/${y}');`), i = [.../* @__PURE__ */ new Set([...a, ...b])].join(`
127
- `);
128
- $(c, i);
610
+ const destDir = await getDestDir(dirname);
611
+ const validFile = isSaltyFile(file);
612
+ if (validFile) {
613
+ const cssFiles = [];
614
+ const config = await getConfig(dirname);
615
+ const { contents } = await compileSaltyFile(dirname, file, destDir);
616
+ for (const [name, value] of Object.entries(contents)) {
617
+ const resolved = await resolveExportValue(value, 1);
618
+ if (resolved.isKeyframes && resolved.css) {
619
+ const fileName = `a_${resolved.animationName}.css`;
620
+ const filePath2 = `css/${fileName}`;
621
+ const cssPath2 = join(destDir, filePath2);
622
+ writeFileSync(cssPath2, await resolved.css);
623
+ continue;
624
+ }
625
+ if (resolved.isClassName) {
626
+ const generator2 = resolved.generator._withBuildContext({
627
+ callerName: name,
628
+ isProduction: prod,
629
+ config
630
+ });
631
+ const styles2 = await generator2.css;
632
+ if (!styles2) continue;
633
+ if (!cssFiles[generator2.priority]) cssFiles[generator2.priority] = [];
634
+ cssFiles[generator2.priority].push(generator2.cssFileName);
635
+ const filePath2 = `css/${generator2.cssFileName}`;
636
+ const cssPath2 = join(destDir, filePath2);
637
+ writeFileSync(cssPath2, styles2);
638
+ continue;
639
+ }
640
+ if (!resolved.generator) continue;
641
+ const generator = resolved.generator._withBuildContext({
642
+ callerName: name,
643
+ isProduction: prod,
644
+ config
645
+ });
646
+ const styles = await generator.css;
647
+ if (!styles) continue;
648
+ const filePath = `css/${generator.cssFileName}`;
649
+ const cssPath = join(destDir, filePath);
650
+ writeFileSync(cssPath, styles);
651
+ if (!cssFiles[generator.priority]) cssFiles[generator.priority] = [];
652
+ cssFiles[generator.priority].push(generator.cssFileName);
653
+ }
654
+ if (config.importStrategy !== "component") {
655
+ cssFiles.forEach((val, layer) => {
656
+ const layerFileName = `l_${layer}.css`;
657
+ const layerFilePath = join(destDir, "css", layerFileName);
658
+ let currentLayerFileContent = readFileSync(layerFilePath, "utf8");
659
+ val.forEach((file2) => {
660
+ var _a;
661
+ const filepath = join(destDir, "css", file2);
662
+ const filepathHash = ((_a = /.*-([^-]+)-\d+.css/.exec(file2)) == null ? void 0 : _a.at(1)) || toHash(filepath, 6);
663
+ const found = currentLayerFileContent.includes(filepathHash);
664
+ if (!found) {
665
+ const css = readFileSync(filepath, "utf8");
666
+ const newContent = `/*start:${filepathHash}-${file2}*/
667
+ ${css}
668
+ /*end:${filepathHash}*/
669
+ `;
670
+ currentLayerFileContent = `${currentLayerFileContent.replace(/\}$/, "")}
671
+ ${newContent}
672
+ }`;
673
+ }
674
+ });
675
+ writeFileSync(layerFilePath, currentLayerFileContent);
676
+ });
677
+ } else {
678
+ const cssContent = cssFiles.flat().map((file2) => `@import url('./${file2}');`).join("\n");
679
+ const hashName = toHash(file, 6);
680
+ const parsedPath = parse(file);
681
+ const dasherized = dashCase(parsedPath.name);
682
+ const cssFile = join(destDir, `css/f_${dasherized}-${hashName}.css`);
683
+ writeFileSync(cssFile, cssContent || `/* Empty file */`);
684
+ }
129
685
  }
130
- } catch (n) {
131
- console.error(n);
686
+ } catch (e) {
687
+ console.error(e);
132
688
  }
133
- }, rt = async (s, e) => {
689
+ };
690
+ const minimizeFile = async (dirname, file, prod = isProduction()) => {
691
+ var _a, _b;
134
692
  try {
135
- const n = o(s, "./saltygen");
136
- if (v(e)) {
137
- const c = M(e, "utf8");
138
- c.replace(/^(?!export\s)const\s.*/gm, (f) => `export ${f}`) !== c && await J(e, c);
139
- const d = await O(s), w = await E(e, n);
140
- let a = c;
141
- Object.entries(w).forEach(([f, i]) => {
142
- var j;
143
- if (i.isKeyframes) {
144
- console.log("value", i);
145
- return;
693
+ const destDir = await getDestDir(dirname);
694
+ const validFile = isSaltyFile(file);
695
+ if (validFile) {
696
+ const original = readFileSync(file, "utf8");
697
+ const config = await getConfig(dirname);
698
+ const { contents } = await compileSaltyFile(dirname, file, destDir);
699
+ let current = original;
700
+ for (const [name, value] of Object.entries(contents)) {
701
+ const resolved = await resolveExportValue(value, 1);
702
+ if (resolved.isKeyframes) continue;
703
+ if (!resolved.generator) continue;
704
+ const generator = resolved.generator._withBuildContext({
705
+ callerName: name,
706
+ isProduction: prod,
707
+ config
708
+ });
709
+ const [start, end] = await getFunctionRange(current, name);
710
+ const range = current.slice(start, end);
711
+ if (resolved.isClassName) {
712
+ const copy = current;
713
+ const clientVersion = ` ${name} = className("${generator.classNames}")`;
714
+ current = current.replace(range, clientVersion);
715
+ if (copy === current) console.error("Minimize file failed to change content", { name });
146
716
  }
147
- if (!i.generator) return;
148
- const y = i.generator._withBuildContext({
149
- name: f,
150
- config: d
151
- }), h = new RegExp(`${f}[=\\s]+[^()]+styled\\(([^,]+),`, "g").exec(c);
152
- if (!h)
153
- return console.error("Could not find the original declaration");
154
- const m = (j = h.at(1)) == null ? void 0 : j.trim(), g = `${f} = styled(${m}, "${y.classNames}", "${y._callerName}", ${JSON.stringify(y.props)});`, F = new RegExp(`${f}[=\\s]+[^()]+styled\\(([^,]+),[^;]+;`, "g");
155
- a = a.replace(F, g);
156
- });
157
- const b = T(e, 6);
158
- return d.importStrategy === "component" && (a = `import '../../saltygen/css/${b}.css';
159
- ${a}`), a = a.replace("{ styled }", "{ styledClient as styled }"), a = a.replace("@salty-css/react/styled", "@salty-css/react/styled-client"), a;
717
+ if (range.includes("styled")) {
718
+ const tagName = (_b = (_a = /styled\(([^,]+),/.exec(range)) == null ? void 0 : _a.at(1)) == null ? void 0 : _b.trim();
719
+ const copy = current;
720
+ const clientVersion = ` ${name} = styled(${tagName}, "${generator.classNames}", ${JSON.stringify(generator.clientProps)})`;
721
+ current = current.replace(range, clientVersion);
722
+ if (copy === current) console.error("Minimize file failed to change content", { name, tagName });
723
+ }
724
+ }
725
+ if (config.importStrategy === "component") {
726
+ const fileHash = toHash(file, 6);
727
+ const parsed = parse(file);
728
+ const dasherized = dashCase(parsed.name);
729
+ const cssFileName = `f_${dasherized}-${fileHash}.css`;
730
+ current = `import '../../saltygen/css/${cssFileName}';
731
+ ${current}`;
732
+ }
733
+ current = current.replace(`@salty-css/react/class-name`, `@salty-css/react/class-name-client`);
734
+ current = current.replace(`{ styled }`, `{ styledClient as styled }`);
735
+ current = current.replace(`@salty-css/react/styled`, `@salty-css/react/styled-client`);
736
+ return current;
160
737
  }
161
- } catch (n) {
162
- console.error(n);
738
+ } catch (e) {
739
+ console.error("Error in minimizeFile:", e);
163
740
  }
741
+ return void 0;
164
742
  };
165
743
  export {
166
- E as compileSaltyFile,
167
- Y as generateConfigStyles,
168
- ot as generateCss,
169
- it as generateFile,
170
- v as isSaltyFile,
171
- rt as minimizeFile,
172
- U as saltyFileExtensions,
173
- W as saltyFileRegExp
744
+ logError as a,
745
+ compileSaltyFile,
746
+ generateConfigStyles,
747
+ generateCss,
748
+ generateFile,
749
+ getConfig,
750
+ getDestDir,
751
+ isSaltyFile,
752
+ logger as l,
753
+ minimizeFile,
754
+ saltyFileExtensions,
755
+ saltyFileRegExp
174
756
  };