@eslint/css-tree 4.1.0 → 4.1.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/README.md +1 -1
- package/cjs/syntax/atrule/import.cjs +3 -2
- package/cjs/syntax/config/parser.cjs +26 -1
- package/cjs/syntax/node/AtKeyword.cjs +29 -0
- package/cjs/syntax/node/Condition.cjs +6 -1
- package/cjs/syntax/node/FeatureFunction.cjs +3 -1
- package/cjs/syntax/node/index-generate.cjs +2 -0
- package/cjs/syntax/node/index-parse.cjs +2 -0
- package/cjs/syntax/node/index.cjs +2 -0
- package/data/patch.json +30 -0
- package/dist/csstree.esm.js +8 -8
- package/dist/csstree.js +8 -8
- package/dist/data.cjs +10 -1
- package/dist/data.js +10 -1
- package/dist/version.cjs +1 -1
- package/dist/version.js +1 -1
- package/lib/index.d.ts +9 -2
- package/lib/syntax/atrule/import.js +5 -3
- package/lib/syntax/config/parser.js +30 -2
- package/lib/syntax/node/AtKeyword.js +22 -0
- package/lib/syntax/node/Condition.js +6 -1
- package/lib/syntax/node/FeatureFunction.js +3 -1
- package/lib/syntax/node/index-generate.js +1 -0
- package/lib/syntax/node/index-parse.js +1 -0
- package/lib/syntax/node/index.js +1 -0
- package/package.json +2 -2
package/dist/data.cjs
CHANGED
|
@@ -427,7 +427,7 @@ module.exports = {
|
|
|
427
427
|
"superellipse()": "superellipse( [<number>|infinity|-infinity] )",
|
|
428
428
|
"supports-condition": "not <supports-in-parens>|<supports-in-parens> [and <supports-in-parens>]*|<supports-in-parens> [or <supports-in-parens>]*",
|
|
429
429
|
"supports-decl": "( <declaration> )",
|
|
430
|
-
"supports-feature": "<supports-
|
|
430
|
+
"supports-feature": "<supports-selector-fn>|<supports-font-tech-fn>|<supports-font-format-fn>|<supports-at-rule-fn>|<supports-named-feature-fn>|<supports-env-fn>|<supports-decl>",
|
|
431
431
|
"supports-in-parens": "( <supports-condition> )|<supports-feature>|<general-enclosed>",
|
|
432
432
|
"supports-selector-fn": "selector( <complex-selector> )",
|
|
433
433
|
"symbol": "<string>|<image>|<custom-ident>",
|
|
@@ -498,6 +498,10 @@ module.exports = {
|
|
|
498
498
|
"bottom": "<length>|auto",
|
|
499
499
|
"generic-voice": "[<age>? <gender> <integer>?]",
|
|
500
500
|
"gender": "male|female|neutral",
|
|
501
|
+
"font-features-tech": "features-opentype|features-aat|features-graphite",
|
|
502
|
+
"font-format": "<string>|collection|embedded-opentype|opentype|svg|truetype|woff|woff2",
|
|
503
|
+
"font-tech": "<font-features-tech>|<color-font-tech>|variations|palettes|incremental",
|
|
504
|
+
"color-font-tech": "color-COLRv0|color-COLRv1|color-SVG|color-sbix|color-CBDT",
|
|
501
505
|
"generic-script-specific": "generic( kai )|generic( fangsong )|generic( nastaliq )",
|
|
502
506
|
"-non-standard-generic-family": "-apple-system|BlinkMacSystemFont",
|
|
503
507
|
"intrinsic-size-keyword": "min-content|max-content|fit-content",
|
|
@@ -557,6 +561,11 @@ module.exports = {
|
|
|
557
561
|
"alpha()": "alpha( [from <color>] [/ [<alpha-value>|none]]? )",
|
|
558
562
|
"xyz-space": "xyz|xyz-d50|xyz-d65",
|
|
559
563
|
"style-condition": "not <style-in-parens>|<style-in-parens> [[and <style-in-parens>]*|[or <style-in-parens>]*]",
|
|
564
|
+
"supports-font-tech-fn": "font-tech( <font-tech> )",
|
|
565
|
+
"supports-font-format-fn": "font-format( <font-format> )",
|
|
566
|
+
"supports-at-rule-fn": "at-rule( <at-keyword-token> )",
|
|
567
|
+
"supports-named-feature-fn": "named-feature( <ident> )",
|
|
568
|
+
"supports-env-fn": "env( <ident> )",
|
|
560
569
|
"-non-standard-display": "-ms-inline-flexbox|-ms-grid|-ms-inline-grid|-webkit-flex|-webkit-inline-flex|-webkit-box|-webkit-inline-box|-moz-inline-stack|-moz-box|-moz-inline-box",
|
|
561
570
|
"inset-area": "[[left|center|right|span-left|span-right|x-start|x-end|span-x-start|span-x-end|x-self-start|x-self-end|span-x-self-start|span-x-self-end|span-all]||[top|center|bottom|span-top|span-bottom|y-start|y-end|span-y-start|span-y-end|y-self-start|y-self-end|span-y-self-start|span-y-self-end|span-all]|[block-start|center|block-end|span-block-start|span-block-end|span-all]||[inline-start|center|inline-end|span-inline-start|span-inline-end|span-all]|[self-block-start|self-block-end|span-self-block-start|span-self-block-end|span-all]||[self-inline-start|self-inline-end|span-self-inline-start|span-self-inline-end|span-all]|[start|center|end|span-start|span-end|span-all]{1,2}|[self-start|center|self-end|span-self-start|span-self-end|span-all]{1,2}]",
|
|
562
571
|
"syntax": "'*'|<syntax-component> [<syntax-combinator> <syntax-component>]*|<syntax-string>",
|
package/dist/data.js
CHANGED
|
@@ -427,7 +427,7 @@ export default {
|
|
|
427
427
|
"superellipse()": "superellipse( [<number>|infinity|-infinity] )",
|
|
428
428
|
"supports-condition": "not <supports-in-parens>|<supports-in-parens> [and <supports-in-parens>]*|<supports-in-parens> [or <supports-in-parens>]*",
|
|
429
429
|
"supports-decl": "( <declaration> )",
|
|
430
|
-
"supports-feature": "<supports-
|
|
430
|
+
"supports-feature": "<supports-selector-fn>|<supports-font-tech-fn>|<supports-font-format-fn>|<supports-at-rule-fn>|<supports-named-feature-fn>|<supports-env-fn>|<supports-decl>",
|
|
431
431
|
"supports-in-parens": "( <supports-condition> )|<supports-feature>|<general-enclosed>",
|
|
432
432
|
"supports-selector-fn": "selector( <complex-selector> )",
|
|
433
433
|
"symbol": "<string>|<image>|<custom-ident>",
|
|
@@ -498,6 +498,10 @@ export default {
|
|
|
498
498
|
"bottom": "<length>|auto",
|
|
499
499
|
"generic-voice": "[<age>? <gender> <integer>?]",
|
|
500
500
|
"gender": "male|female|neutral",
|
|
501
|
+
"font-features-tech": "features-opentype|features-aat|features-graphite",
|
|
502
|
+
"font-format": "<string>|collection|embedded-opentype|opentype|svg|truetype|woff|woff2",
|
|
503
|
+
"font-tech": "<font-features-tech>|<color-font-tech>|variations|palettes|incremental",
|
|
504
|
+
"color-font-tech": "color-COLRv0|color-COLRv1|color-SVG|color-sbix|color-CBDT",
|
|
501
505
|
"generic-script-specific": "generic( kai )|generic( fangsong )|generic( nastaliq )",
|
|
502
506
|
"-non-standard-generic-family": "-apple-system|BlinkMacSystemFont",
|
|
503
507
|
"intrinsic-size-keyword": "min-content|max-content|fit-content",
|
|
@@ -557,6 +561,11 @@ export default {
|
|
|
557
561
|
"alpha()": "alpha( [from <color>] [/ [<alpha-value>|none]]? )",
|
|
558
562
|
"xyz-space": "xyz|xyz-d50|xyz-d65",
|
|
559
563
|
"style-condition": "not <style-in-parens>|<style-in-parens> [[and <style-in-parens>]*|[or <style-in-parens>]*]",
|
|
564
|
+
"supports-font-tech-fn": "font-tech( <font-tech> )",
|
|
565
|
+
"supports-font-format-fn": "font-format( <font-format> )",
|
|
566
|
+
"supports-at-rule-fn": "at-rule( <at-keyword-token> )",
|
|
567
|
+
"supports-named-feature-fn": "named-feature( <ident> )",
|
|
568
|
+
"supports-env-fn": "env( <ident> )",
|
|
560
569
|
"-non-standard-display": "-ms-inline-flexbox|-ms-grid|-ms-inline-grid|-webkit-flex|-webkit-inline-flex|-webkit-box|-webkit-inline-box|-moz-inline-stack|-moz-box|-moz-inline-box",
|
|
561
570
|
"inset-area": "[[left|center|right|span-left|span-right|x-start|x-end|span-x-start|span-x-end|x-self-start|x-self-end|span-x-self-start|span-x-self-end|span-all]||[top|center|bottom|span-top|span-bottom|y-start|y-end|span-y-start|span-y-end|y-self-start|y-self-end|span-y-self-start|span-y-self-end|span-all]|[block-start|center|block-end|span-block-start|span-block-end|span-all]||[inline-start|center|inline-end|span-inline-start|span-inline-end|span-all]|[self-block-start|self-block-end|span-self-block-start|span-self-block-end|span-all]||[self-inline-start|self-inline-end|span-self-inline-start|span-self-inline-end|span-all]|[start|center|end|span-start|span-end|span-all]{1,2}|[self-start|center|self-end|span-self-start|span-self-end|span-all]{1,2}]",
|
|
562
571
|
"syntax": "'*'|<syntax-component> [<syntax-combinator> <syntax-component>]*|<syntax-string>",
|
package/dist/version.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = "4.1.
|
|
1
|
+
module.exports = "4.1.1";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "4.1.
|
|
1
|
+
export const version = "4.1.1";
|
package/lib/index.d.ts
CHANGED
|
@@ -547,6 +547,11 @@ export interface AnPlusB extends CssNodeCommon {
|
|
|
547
547
|
b: string | null;
|
|
548
548
|
}
|
|
549
549
|
|
|
550
|
+
export interface AtKeyword extends CssNodeCommon {
|
|
551
|
+
type: "AtKeyword";
|
|
552
|
+
name: string;
|
|
553
|
+
}
|
|
554
|
+
|
|
550
555
|
export interface Atrule extends CssNodeCommon {
|
|
551
556
|
type: "Atrule";
|
|
552
557
|
name: string;
|
|
@@ -665,14 +670,14 @@ export interface FeatureFunction extends CssNodeCommon {
|
|
|
665
670
|
type: "FeatureFunction";
|
|
666
671
|
feature: string;
|
|
667
672
|
kind: string;
|
|
668
|
-
value: Declaration | Selector;
|
|
673
|
+
value: AtKeyword | Declaration | Identifier | Raw | Selector | StringNode;
|
|
669
674
|
}
|
|
670
675
|
|
|
671
676
|
export interface FeatureFunctionPlain extends CssNodeCommon {
|
|
672
677
|
type: "FeatureFunction";
|
|
673
678
|
feature: string;
|
|
674
679
|
kind: string;
|
|
675
|
-
value: DeclarationPlain | SelectorPlain;
|
|
680
|
+
value: AtKeyword | DeclarationPlain | Identifier | Raw | SelectorPlain | StringNode;
|
|
676
681
|
}
|
|
677
682
|
|
|
678
683
|
export interface FeatureRange extends CssNodeCommon {
|
|
@@ -892,6 +897,7 @@ export interface WhiteSpace extends CssNodeCommon {
|
|
|
892
897
|
/* IMPORTANT! If you update this, also update `CssNodePlain` */
|
|
893
898
|
export type CssNode =
|
|
894
899
|
| AnPlusB
|
|
900
|
+
| AtKeyword
|
|
895
901
|
| Atrule
|
|
896
902
|
| AtrulePrelude
|
|
897
903
|
| AttributeSelector
|
|
@@ -943,6 +949,7 @@ export type CssNode =
|
|
|
943
949
|
/* IMPORTANT! If you update this, also update `CssNode` */
|
|
944
950
|
export type CssNodePlain =
|
|
945
951
|
| AnPlusB
|
|
952
|
+
| AtKeyword
|
|
946
953
|
| AtrulePlain
|
|
947
954
|
| AtrulePreludePlain
|
|
948
955
|
| AttributeSelector
|
|
@@ -4,7 +4,8 @@ import {
|
|
|
4
4
|
Url,
|
|
5
5
|
Function as FunctionToken,
|
|
6
6
|
LeftParenthesis,
|
|
7
|
-
RightParenthesis
|
|
7
|
+
RightParenthesis,
|
|
8
|
+
Colon
|
|
8
9
|
} from '../../tokenizer/index.js';
|
|
9
10
|
|
|
10
11
|
function parseWithFallback(parse, fallback) {
|
|
@@ -42,8 +43,9 @@ const parseFunctions = {
|
|
|
42
43
|
const children = this.createList();
|
|
43
44
|
const node = parseWithFallback.call(
|
|
44
45
|
this,
|
|
45
|
-
this.
|
|
46
|
-
|
|
46
|
+
this.tokenType === Ident && this.lookupTypeNonSC(1) === Colon
|
|
47
|
+
? this.Declaration
|
|
48
|
+
: () => this.Condition('supports')
|
|
47
49
|
);
|
|
48
50
|
|
|
49
51
|
if (node.type !== 'Raw' || node.value !== '') {
|
|
@@ -2,7 +2,28 @@ import * as scope from '../scope/index.js';
|
|
|
2
2
|
import atrule from '../atrule/index.js';
|
|
3
3
|
import pseudo from '../pseudo/index.js';
|
|
4
4
|
import * as node from '../node/index-parse.js';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
Ident,
|
|
7
|
+
String as StringToken,
|
|
8
|
+
tokenize
|
|
9
|
+
} from '../../tokenizer/index.js';
|
|
10
|
+
|
|
11
|
+
function identifier() {
|
|
12
|
+
return this.Identifier();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function fontFormat() {
|
|
16
|
+
switch (this.tokenType) {
|
|
17
|
+
case Ident:
|
|
18
|
+
return this.Identifier();
|
|
19
|
+
|
|
20
|
+
case StringToken:
|
|
21
|
+
return this.String();
|
|
22
|
+
|
|
23
|
+
default:
|
|
24
|
+
this.error('Identifier or string is expected');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
6
27
|
|
|
7
28
|
export default {
|
|
8
29
|
parseContext: {
|
|
@@ -31,7 +52,14 @@ export default {
|
|
|
31
52
|
supports: {
|
|
32
53
|
selector() {
|
|
33
54
|
return this.Selector();
|
|
34
|
-
}
|
|
55
|
+
},
|
|
56
|
+
'font-tech': identifier,
|
|
57
|
+
'font-format': fontFormat,
|
|
58
|
+
'at-rule'() {
|
|
59
|
+
return this.AtKeyword();
|
|
60
|
+
},
|
|
61
|
+
'named-feature': identifier,
|
|
62
|
+
env: identifier
|
|
35
63
|
},
|
|
36
64
|
container: {
|
|
37
65
|
style() {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AtKeyword as AtKeywordToken } from '../../tokenizer/index.js';
|
|
2
|
+
|
|
3
|
+
export const name = 'AtKeyword';
|
|
4
|
+
export const structure = {
|
|
5
|
+
name: String
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export function parse() {
|
|
9
|
+
const start = this.tokenStart;
|
|
10
|
+
|
|
11
|
+
this.eat(AtKeywordToken);
|
|
12
|
+
|
|
13
|
+
return {
|
|
14
|
+
type: 'AtKeyword',
|
|
15
|
+
loc: this.getLocation(start, this.tokenStart),
|
|
16
|
+
name: this.substrToCursor(start + 1)
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function generate(node) {
|
|
21
|
+
this.token(AtKeywordToken, '@' + node.name);
|
|
22
|
+
}
|
|
@@ -36,7 +36,12 @@ const parentheses = {
|
|
|
36
36
|
media: featureOrRange,
|
|
37
37
|
container: featureOrRange,
|
|
38
38
|
supports() {
|
|
39
|
-
|
|
39
|
+
if (this.lookupTypeNonSC(1) === Ident &&
|
|
40
|
+
this.lookupTypeNonSC(2) === Colon) {
|
|
41
|
+
return this.SupportsDeclaration();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return null;
|
|
40
45
|
}
|
|
41
46
|
};
|
|
42
47
|
|
|
@@ -7,7 +7,7 @@ export const name = 'FeatureFunction';
|
|
|
7
7
|
export const structure = {
|
|
8
8
|
kind: String,
|
|
9
9
|
feature: String,
|
|
10
|
-
value: ['Declaration', 'Selector']
|
|
10
|
+
value: ['Declaration', 'Selector', 'Identifier', 'String', 'AtKeyword', 'Raw']
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
function getFeatureParser(kind, name) {
|
|
@@ -33,6 +33,8 @@ export function parse(kind = 'unknown') {
|
|
|
33
33
|
const startValueToken = this.tokenIndex;
|
|
34
34
|
const value = valueParser.call(this);
|
|
35
35
|
|
|
36
|
+
this.skipSC();
|
|
37
|
+
|
|
36
38
|
if (this.eof === false &&
|
|
37
39
|
this.isBalanceEdge(startValueToken) === false) {
|
|
38
40
|
this.error();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { generate as AnPlusB } from './AnPlusB.js';
|
|
2
|
+
export { generate as AtKeyword } from './AtKeyword.js';
|
|
2
3
|
export { generate as Atrule } from './Atrule.js';
|
|
3
4
|
export { generate as AtrulePrelude } from './AtrulePrelude.js';
|
|
4
5
|
export { generate as AttributeSelector } from './AttributeSelector.js';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { parse as AnPlusB } from './AnPlusB.js';
|
|
2
|
+
export { parse as AtKeyword } from './AtKeyword.js';
|
|
2
3
|
export { parse as Atrule } from './Atrule.js';
|
|
3
4
|
export { parse as AtrulePrelude } from './AtrulePrelude.js';
|
|
4
5
|
export { parse as AttributeSelector } from './AttributeSelector.js';
|
package/lib/syntax/node/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint/css-tree",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.1",
|
|
4
4
|
"description": "A tool set for CSS: fast detailed parser (CSS → AST), walker (AST traversal), generator (AST → CSS) and lexer (validation and matching) based on specs and browser implementations",
|
|
5
5
|
"author": "Roman Dvornov <rdvornov@gmail.com> (https://github.com/lahmatiy)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"test:types": "tsc -p tests/types/tsconfig.json"
|
|
108
108
|
},
|
|
109
109
|
"dependencies": {
|
|
110
|
-
"mdn-data": "2.
|
|
110
|
+
"mdn-data": "2.35.0",
|
|
111
111
|
"source-map-js": "^1.2.1"
|
|
112
112
|
},
|
|
113
113
|
"devDependencies": {
|