@salty-css/core 0.1.0-alpha.9 → 0.1.0-refactor-add-additional-paths-to-config-cache.0

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 (44) hide show
  1. package/bin/confirm-install.d.ts +34 -0
  2. package/bin/context.d.ts +3 -0
  3. package/bin/integrations/index.d.ts +11 -3
  4. package/bin/integrations/types.d.ts +14 -2
  5. package/bin/main.cjs +197 -95
  6. package/bin/main.js +151 -49
  7. package/cache/resolve-dynamic-config-cache.cjs +64 -16
  8. package/cache/resolve-dynamic-config-cache.d.ts +20 -1
  9. package/cache/resolve-dynamic-config-cache.js +65 -17
  10. package/{class-name-generator-YeSQe_Ik.js → class-name-generator-CMWY5KTJ.js} +1 -1
  11. package/{class-name-generator-B2Pb2obX.cjs → class-name-generator-DB5aQwC_.cjs} +1 -1
  12. package/compiler/copy-config-cache.cjs +39 -0
  13. package/compiler/copy-config-cache.d.ts +17 -0
  14. package/compiler/copy-config-cache.js +39 -0
  15. package/compiler/salty-compiler.cjs +22 -21
  16. package/compiler/salty-compiler.d.ts +11 -1
  17. package/compiler/salty-compiler.js +20 -19
  18. package/css/dynamic-styles.cjs +21 -8
  19. package/css/dynamic-styles.d.ts +39 -0
  20. package/css/dynamic-styles.js +22 -9
  21. package/css/index.cjs +1 -0
  22. package/css/index.js +2 -1
  23. package/css/keyframes.cjs +1 -1
  24. package/css/keyframes.js +1 -1
  25. package/generators/index.cjs +1 -1
  26. package/generators/index.js +2 -2
  27. package/instances/classname-instance.cjs +1 -1
  28. package/instances/classname-instance.js +1 -1
  29. package/logger-7xz0pyAz.cjs +12 -0
  30. package/logger-hHmCwThj.js +13 -0
  31. package/package.json +5 -1
  32. package/{parse-styles-CA3TP5n1.cjs → parse-styles-C54MOrPg.cjs} +106 -7
  33. package/{parse-styles-BTIoYnBr.js → parse-styles-CLMTHo2H.js} +107 -8
  34. package/parsers/index.cjs +2 -1
  35. package/parsers/index.d.ts +1 -0
  36. package/parsers/index.js +4 -3
  37. package/parsers/parser-regexes.d.ts +3 -0
  38. package/parsers/strict.d.ts +2 -0
  39. package/runtime/index.cjs +1 -1
  40. package/runtime/index.js +1 -1
  41. package/{salty.config-cqavVm2t.cjs → salty.config-DogY_sSQ.cjs} +1 -1
  42. package/salty.config-GV37Q-D2.js +4 -0
  43. package/types/config-types.d.ts +9 -0
  44. package/salty.config-DjosWdPw.js +0 -4
@@ -21,7 +21,7 @@ const parseValueTokens = (tokenNames) => (value) => {
21
21
  const hasToken = /\{[^{}]+\}/g.test(value);
22
22
  if (!hasToken) return void 0;
23
23
  const transformed = value.replace(/\{([^{}]+)\}/g, (...args) => {
24
- const variable = dashCase.dashCase(args[1].replaceAll(".", "-"));
24
+ const variable = dashCase.dashCase(args[1].trim().replaceAll(".", "-"));
25
25
  if (tokenNames && !tokenNames.includes(variable)) console.warn(`Token ${variable} might not exist`);
26
26
  if (variable.startsWith("-")) return `-${variable}`;
27
27
  return `var(--${variable})`;
@@ -75,22 +75,44 @@ const addUnit = (key, value, config) => {
75
75
  return `${value}`;
76
76
  };
77
77
  const vendorPrefixes = ["Webkit", "Moz", "ms", "O"];
78
+ const isVendorPrefixed = (key) => {
79
+ return vendorPrefixes.some((prefix) => {
80
+ if (!key.startsWith(prefix)) return false;
81
+ const next = key.charAt(prefix.length);
82
+ return next >= "A" && next <= "Z";
83
+ });
84
+ };
78
85
  const propertyNameCheck = (key) => {
79
86
  if (key.startsWith("-")) return key;
80
- if (vendorPrefixes.some((prefix) => key.startsWith(prefix))) return `-${dashCase.dashCase(key)}`;
87
+ if (isVendorPrefixed(key)) return `-${dashCase.dashCase(key)}`;
81
88
  return dashCase.dashCase(key);
82
89
  };
90
+ const reportParserIssue = (strict, message) => {
91
+ if (strict === true) throw new Error(`[salty-css] ${message}`);
92
+ if (strict === "warn") console.warn(`[salty-css] ${message}`);
93
+ };
94
+ const pseudoTypoRegex = /^&(hover|focus(-(visible|within))?|active|visited|checked|disabled|enabled|empty|target|first-child|last-child|first-of-type|last-of-type|placeholder|placeholder-shown|root)\b/;
95
+ const templateLiteralLeftoverRegex = /\$\{[^}]+\}/;
96
+ const bareAtRuleRegex = /^@(media|supports|container|layer)\s*$/;
83
97
  const parseStyles = async (styles, currentScope = "", config, omitTemplates = false) => {
84
98
  if (!styles) throw new Error("No styles provided to parseStyles function!");
85
99
  const cssStyles = /* @__PURE__ */ new Set();
86
100
  const entries = Object.entries(styles);
101
+ const strict = config == null ? void 0 : config.strict;
87
102
  const processStyleEntry = async ([key, value]) => {
88
103
  var _a, _b;
89
104
  const _key = key.trim().replace(/^\?+/g, "");
90
105
  const propertyName = propertyNameCheck(_key);
91
106
  const toString = (val, eol = ";") => `${propertyName}:${val}${eol}`;
92
107
  const context = { scope: currentScope, config };
93
- if (typeof value === "function") return processStyleEntry([key, value(context)]);
108
+ if (typeof value === "function") {
109
+ try {
110
+ return await processStyleEntry([key, value(context)]);
111
+ } catch (error) {
112
+ reportParserIssue(strict, `Function value for "${_key}" threw: ${(error == null ? void 0 : error.message) ?? error}`);
113
+ return void 0;
114
+ }
115
+ }
94
116
  if (value instanceof Promise) return processStyleEntry([key, await value]);
95
117
  if ((config == null ? void 0 : config.templates) && ((_a = config.templatePaths) == null ? void 0 : _a[_key])) {
96
118
  try {
@@ -124,6 +146,11 @@ const parseStyles = async (styles, currentScope = "", config, omitTemplates = fa
124
146
  console.warn(`Template "${_key}" with path of "${value}" was not found in config!`);
125
147
  return void 0;
126
148
  }
149
+ const isVariantArrayKey = _key === "compoundVariants" || _key === "anyOfVariants";
150
+ if (!isVariantArrayKey && Array.isArray(value)) {
151
+ if (value.length === 0) return void 0;
152
+ return processStyleEntry([key, value.join(", ")]);
153
+ }
127
154
  if (typeof value === "object") {
128
155
  if (!value) return void 0;
129
156
  if (value.isColor) return toString(value.toString());
@@ -160,31 +187,62 @@ const parseStyles = async (styles, currentScope = "", config, omitTemplates = fa
160
187
  return `.${prop}-${val}`;
161
188
  });
162
189
  const scope2 = `${currentScope}:where(${scopes.join(", ")})`;
163
- console.log(`Union variant scope: ${scope2}`);
164
190
  const results2 = await parseStyles(css2, scope2, config);
165
191
  results2.forEach((res) => cssStyles.add(res));
166
192
  }
167
193
  return void 0;
168
194
  }
169
195
  if (_key.startsWith("@")) {
196
+ if (bareAtRuleRegex.test(_key)) reportParserIssue(strict, `At-rule "${_key}" is missing its condition (e.g. "@media (min-width: 600px)").`);
170
197
  const mediaQuery = ((_b = config == null ? void 0 : config.mediaQueries) == null ? void 0 : _b[_key]) || _key;
171
198
  const results2 = await parseAndJoinStyles(value, currentScope, config);
172
199
  const query = `${mediaQuery} { ${results2} }`;
173
200
  cssStyles.add(query);
174
201
  return void 0;
175
202
  }
176
- const scope = key.includes("&") ? _key.replaceAll("&", currentScope) : _key.startsWith(":") ? `${currentScope}${_key}` : `${currentScope} ${_key}`;
203
+ if (Object.keys(value).length === 0) return void 0;
204
+ if (pseudoTypoRegex.test(_key)) {
205
+ reportParserIssue(strict, `Selector "${_key}" looks like a missing-colon typo (did you mean "&:${_key.slice(1)}"?).`);
206
+ }
207
+ const scope = combineSelectors(currentScope, _key);
177
208
  const results = await parseStyles(value, scope, config);
178
209
  results.forEach((result) => cssStyles.add(result));
179
210
  return void 0;
180
211
  }
212
+ if (_key.startsWith("$")) {
213
+ reportParserIssue(strict, `Property key "${_key}" looks like a SCSS variable — Salty does not support those.`);
214
+ return void 0;
215
+ }
216
+ if (_key.includes(":")) {
217
+ reportParserIssue(strict, `Property key "${_key}" contains a colon — did you accidentally paste a whole declaration as a key?`);
218
+ return void 0;
219
+ }
220
+ if (value === void 0 || value === null) {
221
+ reportParserIssue(strict, `Property "${_key}" has a ${value === void 0 ? "undefined" : "null"} value — skipping.`);
222
+ return void 0;
223
+ }
224
+ if (typeof value === "boolean") {
225
+ reportParserIssue(strict, `Property "${_key}" has a boolean value (${value}) — skipping.`);
226
+ return void 0;
227
+ }
228
+ if (value === "") return void 0;
181
229
  if (typeof value === "number") {
230
+ if (!Number.isFinite(value)) {
231
+ reportParserIssue(strict, `Property "${_key}" has a non-finite numeric value (${value}) — skipping.`);
232
+ return void 0;
233
+ }
182
234
  const withUnit = addUnit(propertyName, value, config);
183
235
  return toString(withUnit);
184
236
  }
185
237
  if (typeof value !== "string") {
186
- if ("toString" in value) value = value.toString();
187
- else throw new Error(`Invalid value type for property ${propertyName}`);
238
+ if (value && typeof value === "object" && "toString" in value) value = value.toString();
239
+ else {
240
+ reportParserIssue(strict, `Property "${_key}" has an unsupported value type (${typeof value}) — skipping.`);
241
+ return void 0;
242
+ }
243
+ }
244
+ if (typeof value === "string" && templateLiteralLeftoverRegex.test(value)) {
245
+ reportParserIssue(strict, `Property "${_key}" value "${value}" contains an unresolved \`\${...}\` — did you forget to interpolate?`);
188
246
  }
189
247
  return toString(value);
190
248
  };
@@ -224,8 +282,49 @@ const parseAndJoinStyles = async (styles, currentClass, config, omitTemplates =
224
282
  const css = await parseStyles(styles, currentClass, config, omitTemplates);
225
283
  return css.join("\n");
226
284
  };
285
+ const splitTopLevelCommas = (selector) => {
286
+ const parts = [];
287
+ let depth = 0;
288
+ let buf = "";
289
+ for (const ch of selector) {
290
+ if (ch === "(" || ch === "[") depth++;
291
+ else if (ch === ")" || ch === "]") depth = Math.max(0, depth - 1);
292
+ if (ch === "," && depth === 0) {
293
+ const trimmed2 = buf.trim();
294
+ if (trimmed2) parts.push(trimmed2);
295
+ buf = "";
296
+ } else {
297
+ buf += ch;
298
+ }
299
+ }
300
+ const trimmed = buf.trim();
301
+ if (trimmed) parts.push(trimmed);
302
+ return parts;
303
+ };
304
+ const joinSelector = (parent, child) => {
305
+ if (child.includes("&")) return child.replaceAll("&", parent);
306
+ if (child.startsWith(":")) return `${parent}${child}`;
307
+ return `${parent} ${child}`;
308
+ };
309
+ const combineSelectors = (currentScope, key) => {
310
+ if (!currentScope) return key;
311
+ const parents = splitTopLevelCommas(currentScope);
312
+ const children = splitTopLevelCommas(key);
313
+ if (!children.length) return currentScope;
314
+ if (parents.length <= 1 && children.length <= 1) {
315
+ return joinSelector(parents[0] ?? currentScope, children[0]);
316
+ }
317
+ const combos = [];
318
+ for (const p of parents) {
319
+ for (const c of children) {
320
+ combos.push(joinSelector(p, c));
321
+ }
322
+ }
323
+ return combos.join(", ");
324
+ };
227
325
  exports.parseAndJoinStyles = parseAndJoinStyles;
228
326
  exports.parseStyles = parseStyles;
229
327
  exports.parseValueModifiers = parseValueModifiers;
230
328
  exports.parseValueTokens = parseValueTokens;
231
329
  exports.parseVariableTokens = parseVariableTokens;
330
+ exports.reportParserIssue = reportParserIssue;
@@ -20,7 +20,7 @@ const parseValueTokens = (tokenNames) => (value) => {
20
20
  const hasToken = /\{[^{}]+\}/g.test(value);
21
21
  if (!hasToken) return void 0;
22
22
  const transformed = value.replace(/\{([^{}]+)\}/g, (...args) => {
23
- const variable = dashCase(args[1].replaceAll(".", "-"));
23
+ const variable = dashCase(args[1].trim().replaceAll(".", "-"));
24
24
  if (tokenNames && !tokenNames.includes(variable)) console.warn(`Token ${variable} might not exist`);
25
25
  if (variable.startsWith("-")) return `-${variable}`;
26
26
  return `var(--${variable})`;
@@ -74,22 +74,44 @@ const addUnit = (key, value, config) => {
74
74
  return `${value}`;
75
75
  };
76
76
  const vendorPrefixes = ["Webkit", "Moz", "ms", "O"];
77
+ const isVendorPrefixed = (key) => {
78
+ return vendorPrefixes.some((prefix) => {
79
+ if (!key.startsWith(prefix)) return false;
80
+ const next = key.charAt(prefix.length);
81
+ return next >= "A" && next <= "Z";
82
+ });
83
+ };
77
84
  const propertyNameCheck = (key) => {
78
85
  if (key.startsWith("-")) return key;
79
- if (vendorPrefixes.some((prefix) => key.startsWith(prefix))) return `-${dashCase(key)}`;
86
+ if (isVendorPrefixed(key)) return `-${dashCase(key)}`;
80
87
  return dashCase(key);
81
88
  };
89
+ const reportParserIssue = (strict, message) => {
90
+ if (strict === true) throw new Error(`[salty-css] ${message}`);
91
+ if (strict === "warn") console.warn(`[salty-css] ${message}`);
92
+ };
93
+ const pseudoTypoRegex = /^&(hover|focus(-(visible|within))?|active|visited|checked|disabled|enabled|empty|target|first-child|last-child|first-of-type|last-of-type|placeholder|placeholder-shown|root)\b/;
94
+ const templateLiteralLeftoverRegex = /\$\{[^}]+\}/;
95
+ const bareAtRuleRegex = /^@(media|supports|container|layer)\s*$/;
82
96
  const parseStyles = async (styles, currentScope = "", config, omitTemplates = false) => {
83
97
  if (!styles) throw new Error("No styles provided to parseStyles function!");
84
98
  const cssStyles = /* @__PURE__ */ new Set();
85
99
  const entries = Object.entries(styles);
100
+ const strict = config == null ? void 0 : config.strict;
86
101
  const processStyleEntry = async ([key, value]) => {
87
102
  var _a, _b;
88
103
  const _key = key.trim().replace(/^\?+/g, "");
89
104
  const propertyName = propertyNameCheck(_key);
90
105
  const toString = (val, eol = ";") => `${propertyName}:${val}${eol}`;
91
106
  const context = { scope: currentScope, config };
92
- if (typeof value === "function") return processStyleEntry([key, value(context)]);
107
+ if (typeof value === "function") {
108
+ try {
109
+ return await processStyleEntry([key, value(context)]);
110
+ } catch (error) {
111
+ reportParserIssue(strict, `Function value for "${_key}" threw: ${(error == null ? void 0 : error.message) ?? error}`);
112
+ return void 0;
113
+ }
114
+ }
93
115
  if (value instanceof Promise) return processStyleEntry([key, await value]);
94
116
  if ((config == null ? void 0 : config.templates) && ((_a = config.templatePaths) == null ? void 0 : _a[_key])) {
95
117
  try {
@@ -123,6 +145,11 @@ const parseStyles = async (styles, currentScope = "", config, omitTemplates = fa
123
145
  console.warn(`Template "${_key}" with path of "${value}" was not found in config!`);
124
146
  return void 0;
125
147
  }
148
+ const isVariantArrayKey = _key === "compoundVariants" || _key === "anyOfVariants";
149
+ if (!isVariantArrayKey && Array.isArray(value)) {
150
+ if (value.length === 0) return void 0;
151
+ return processStyleEntry([key, value.join(", ")]);
152
+ }
126
153
  if (typeof value === "object") {
127
154
  if (!value) return void 0;
128
155
  if (value.isColor) return toString(value.toString());
@@ -159,31 +186,62 @@ const parseStyles = async (styles, currentScope = "", config, omitTemplates = fa
159
186
  return `.${prop}-${val}`;
160
187
  });
161
188
  const scope2 = `${currentScope}:where(${scopes.join(", ")})`;
162
- console.log(`Union variant scope: ${scope2}`);
163
189
  const results2 = await parseStyles(css2, scope2, config);
164
190
  results2.forEach((res) => cssStyles.add(res));
165
191
  }
166
192
  return void 0;
167
193
  }
168
194
  if (_key.startsWith("@")) {
195
+ if (bareAtRuleRegex.test(_key)) reportParserIssue(strict, `At-rule "${_key}" is missing its condition (e.g. "@media (min-width: 600px)").`);
169
196
  const mediaQuery = ((_b = config == null ? void 0 : config.mediaQueries) == null ? void 0 : _b[_key]) || _key;
170
197
  const results2 = await parseAndJoinStyles(value, currentScope, config);
171
198
  const query = `${mediaQuery} { ${results2} }`;
172
199
  cssStyles.add(query);
173
200
  return void 0;
174
201
  }
175
- const scope = key.includes("&") ? _key.replaceAll("&", currentScope) : _key.startsWith(":") ? `${currentScope}${_key}` : `${currentScope} ${_key}`;
202
+ if (Object.keys(value).length === 0) return void 0;
203
+ if (pseudoTypoRegex.test(_key)) {
204
+ reportParserIssue(strict, `Selector "${_key}" looks like a missing-colon typo (did you mean "&:${_key.slice(1)}"?).`);
205
+ }
206
+ const scope = combineSelectors(currentScope, _key);
176
207
  const results = await parseStyles(value, scope, config);
177
208
  results.forEach((result) => cssStyles.add(result));
178
209
  return void 0;
179
210
  }
211
+ if (_key.startsWith("$")) {
212
+ reportParserIssue(strict, `Property key "${_key}" looks like a SCSS variable — Salty does not support those.`);
213
+ return void 0;
214
+ }
215
+ if (_key.includes(":")) {
216
+ reportParserIssue(strict, `Property key "${_key}" contains a colon — did you accidentally paste a whole declaration as a key?`);
217
+ return void 0;
218
+ }
219
+ if (value === void 0 || value === null) {
220
+ reportParserIssue(strict, `Property "${_key}" has a ${value === void 0 ? "undefined" : "null"} value — skipping.`);
221
+ return void 0;
222
+ }
223
+ if (typeof value === "boolean") {
224
+ reportParserIssue(strict, `Property "${_key}" has a boolean value (${value}) — skipping.`);
225
+ return void 0;
226
+ }
227
+ if (value === "") return void 0;
180
228
  if (typeof value === "number") {
229
+ if (!Number.isFinite(value)) {
230
+ reportParserIssue(strict, `Property "${_key}" has a non-finite numeric value (${value}) — skipping.`);
231
+ return void 0;
232
+ }
181
233
  const withUnit = addUnit(propertyName, value, config);
182
234
  return toString(withUnit);
183
235
  }
184
236
  if (typeof value !== "string") {
185
- if ("toString" in value) value = value.toString();
186
- else throw new Error(`Invalid value type for property ${propertyName}`);
237
+ if (value && typeof value === "object" && "toString" in value) value = value.toString();
238
+ else {
239
+ reportParserIssue(strict, `Property "${_key}" has an unsupported value type (${typeof value}) — skipping.`);
240
+ return void 0;
241
+ }
242
+ }
243
+ if (typeof value === "string" && templateLiteralLeftoverRegex.test(value)) {
244
+ reportParserIssue(strict, `Property "${_key}" value "${value}" contains an unresolved \`\${...}\` — did you forget to interpolate?`);
187
245
  }
188
246
  return toString(value);
189
247
  };
@@ -223,10 +281,51 @@ const parseAndJoinStyles = async (styles, currentClass, config, omitTemplates =
223
281
  const css = await parseStyles(styles, currentClass, config, omitTemplates);
224
282
  return css.join("\n");
225
283
  };
284
+ const splitTopLevelCommas = (selector) => {
285
+ const parts = [];
286
+ let depth = 0;
287
+ let buf = "";
288
+ for (const ch of selector) {
289
+ if (ch === "(" || ch === "[") depth++;
290
+ else if (ch === ")" || ch === "]") depth = Math.max(0, depth - 1);
291
+ if (ch === "," && depth === 0) {
292
+ const trimmed2 = buf.trim();
293
+ if (trimmed2) parts.push(trimmed2);
294
+ buf = "";
295
+ } else {
296
+ buf += ch;
297
+ }
298
+ }
299
+ const trimmed = buf.trim();
300
+ if (trimmed) parts.push(trimmed);
301
+ return parts;
302
+ };
303
+ const joinSelector = (parent, child) => {
304
+ if (child.includes("&")) return child.replaceAll("&", parent);
305
+ if (child.startsWith(":")) return `${parent}${child}`;
306
+ return `${parent} ${child}`;
307
+ };
308
+ const combineSelectors = (currentScope, key) => {
309
+ if (!currentScope) return key;
310
+ const parents = splitTopLevelCommas(currentScope);
311
+ const children = splitTopLevelCommas(key);
312
+ if (!children.length) return currentScope;
313
+ if (parents.length <= 1 && children.length <= 1) {
314
+ return joinSelector(parents[0] ?? currentScope, children[0]);
315
+ }
316
+ const combos = [];
317
+ for (const p of parents) {
318
+ for (const c of children) {
319
+ combos.push(joinSelector(p, c));
320
+ }
321
+ }
322
+ return combos.join(", ");
323
+ };
226
324
  export {
227
325
  parseStyles as a,
228
326
  parseVariableTokens as b,
229
327
  parseValueModifiers as c,
230
328
  parseValueTokens as d,
231
- parseAndJoinStyles as p
329
+ parseAndJoinStyles as p,
330
+ reportParserIssue as r
232
331
  };
package/parsers/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const parseStyles = require("../parse-styles-CA3TP5n1.cjs");
3
+ const parseStyles = require("../parse-styles-C54MOrPg.cjs");
4
4
  const dashCase = require("../dash-case-DIwKaYgE.cjs");
5
5
  const toHash = require("../to-hash-C05Y906F.cjs");
6
6
  const parseTemplates = async (obj, path = []) => {
@@ -52,6 +52,7 @@ exports.parseStyles = parseStyles.parseStyles;
52
52
  exports.parseValueModifiers = parseStyles.parseValueModifiers;
53
53
  exports.parseValueTokens = parseStyles.parseValueTokens;
54
54
  exports.parseVariableTokens = parseStyles.parseVariableTokens;
55
+ exports.reportParserIssue = parseStyles.reportParserIssue;
55
56
  exports.getTemplateKeys = getTemplateKeys;
56
57
  exports.getTemplateTokens = getTemplateTokens;
57
58
  exports.getTemplateTypes = getTemplateTypes;
@@ -3,3 +3,4 @@ export * from './parse-styles';
3
3
  export * from './parse-templates';
4
4
  export * from './parse-tokens';
5
5
  export * from './parser-types';
6
+ export * from './strict';
package/parsers/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { p as parseAndJoinStyles } from "../parse-styles-BTIoYnBr.js";
2
- import { a, c, d, b } from "../parse-styles-BTIoYnBr.js";
1
+ import { p as parseAndJoinStyles } from "../parse-styles-CLMTHo2H.js";
2
+ import { a, c, d, b, r } from "../parse-styles-CLMTHo2H.js";
3
3
  import { d as dashCase } from "../dash-case-DblXvymC.js";
4
4
  import { t as toHash } from "../to-hash-DAN2LcHK.js";
5
5
  const parseTemplates = async (obj, path = []) => {
@@ -55,5 +55,6 @@ export {
55
55
  parseTemplates,
56
56
  c as parseValueModifiers,
57
57
  d as parseValueTokens,
58
- b as parseVariableTokens
58
+ b as parseVariableTokens,
59
+ r as reportParserIssue
59
60
  };
@@ -0,0 +1,3 @@
1
+ export declare const pseudoTypoRegex: RegExp;
2
+ export declare const templateLiteralLeftoverRegex: RegExp;
3
+ export declare const bareAtRuleRegex: RegExp;
@@ -0,0 +1,2 @@
1
+ export type StrictMode = boolean | 'warn' | undefined;
2
+ export declare const reportParserIssue: (strict: StrictMode, message: string) => void;
package/runtime/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const parseStyles = require("../parse-styles-CA3TP5n1.cjs");
3
+ const parseStyles = require("../parse-styles-C54MOrPg.cjs");
4
4
  const defineRuntime = (config) => {
5
5
  const getDynamicStylesCss = async (styles, scope) => {
6
6
  const parsed = await parseStyles.parseStyles(styles, scope, config);
package/runtime/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as parseStyles } from "../parse-styles-BTIoYnBr.js";
1
+ import { a as parseStyles } from "../parse-styles-CLMTHo2H.js";
2
2
  const defineRuntime = (config) => {
3
3
  const getDynamicStylesCss = async (styles, scope) => {
4
4
  const parsed = await parseStyles(styles, scope, config);
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const salty_config = "import { defineConfig } from '@salty-css/core/config';\n\nexport const config = defineConfig({\n // Add your custom config here\n externalModules: ['react', 'react-dom']\n});\n";
3
+ const salty_config = "import { defineConfig } from '@salty-css/core/config';\n\nexport const config = defineConfig({\n strict: true,\n externalModules: ['react', 'react-dom']\n});\n";
4
4
  exports.default = salty_config;
@@ -0,0 +1,4 @@
1
+ const salty_config = "import { defineConfig } from '@salty-css/core/config';\n\nexport const config = defineConfig({\n strict: true,\n externalModules: ['react', 'react-dom']\n});\n";
2
+ export {
3
+ salty_config as default
4
+ };
@@ -68,6 +68,14 @@ export interface SaltyConfig {
68
68
  * Define modules that should not be bundled when generating the css file. This improves the performance of the css generation and can help with issues relared to external packages being imported in an environment that does not support them.
69
69
  */
70
70
  externalModules?: ('react' | 'react-dom' | OrString)[];
71
+ /**
72
+ * Controls how the parser reacts to suspicious or malformed input
73
+ * (typos, invalid value types, malformed selectors, etc.).
74
+ * - `true` — throw on issues (recommended for new projects)
75
+ * - `'warn'` — log a warning and continue
76
+ * - `false` / undefined — silent, behave like prior versions
77
+ */
78
+ strict?: boolean | 'warn';
71
79
  /**
72
80
  * default unit for px based properties when providing a number value. Default is 'px'.
73
81
  */
@@ -78,6 +86,7 @@ export interface CachedConfig {
78
86
  staticVariables: Record<string, any>;
79
87
  mediaQueries: Record<string, string>;
80
88
  modifiers?: CssModifiers;
89
+ strict?: boolean | 'warn';
81
90
  templatePaths: {
82
91
  [key: string]: string;
83
92
  };
@@ -1,4 +0,0 @@
1
- const salty_config = "import { defineConfig } from '@salty-css/core/config';\n\nexport const config = defineConfig({\n // Add your custom config here\n externalModules: ['react', 'react-dom']\n});\n";
2
- export {
3
- salty_config as default
4
- };