@eslint/css-tree 3.2.0 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/lexer/Lexer.cjs +18 -2
- package/dist/csstree.esm.js +4 -4
- package/dist/csstree.js +5 -5
- package/dist/version.cjs +1 -1
- package/dist/version.js +1 -1
- package/lib/index.d.ts +190 -13
- package/lib/lexer/Lexer.js +18 -2
- package/package.json +1 -1
package/cjs/lexer/Lexer.cjs
CHANGED
|
@@ -67,6 +67,16 @@ function syntaxHasTopLevelCommaMultiplier(syntax) {
|
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
function valueHasEnv(tokens) {
|
|
71
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
72
|
+
if (tokens[i].value.toLowerCase() === 'env(') {
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
|
|
70
80
|
function buildMatchResult(matched, error, iterations) {
|
|
71
81
|
return {
|
|
72
82
|
matched,
|
|
@@ -84,6 +94,10 @@ function matchSyntax(lexer, syntax, value, useCssWideKeywords) {
|
|
|
84
94
|
return buildMatchResult(null, new Error('Matching for a tree with var() is not supported'));
|
|
85
95
|
}
|
|
86
96
|
|
|
97
|
+
if (valueHasEnv(tokens)) {
|
|
98
|
+
return buildMatchResult(null, new Error('Matching for a tree with env() is not supported'));
|
|
99
|
+
}
|
|
100
|
+
|
|
87
101
|
if (useCssWideKeywords) {
|
|
88
102
|
result = match.matchAsTree(tokens, lexer.cssWideKeywordsSyntax, lexer);
|
|
89
103
|
}
|
|
@@ -360,8 +374,10 @@ class Lexer {
|
|
|
360
374
|
return this.matchProperty(node.property, node.value);
|
|
361
375
|
}
|
|
362
376
|
matchProperty(propertyName, value) {
|
|
363
|
-
|
|
364
|
-
|
|
377
|
+
if (
|
|
378
|
+
!this.getProperty(propertyName) &&
|
|
379
|
+
names.property(propertyName).custom
|
|
380
|
+
) {
|
|
365
381
|
return buildMatchResult(null, new Error('Lexer matching doesn\'t applicable for custom properties'));
|
|
366
382
|
}
|
|
367
383
|
|