@eslint/css-tree 3.4.0 → 3.5.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.
package/dist/version.cjs CHANGED
@@ -1 +1 @@
1
- module.exports = "3.4.0";
1
+ module.exports = "3.5.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = "3.4.0";
1
+ export const version = "3.5.0";
@@ -1,13 +1,25 @@
1
1
  import {
2
2
  WhiteSpace,
3
3
  Comment,
4
+ Delim,
4
5
  Semicolon,
6
+ Hash,
7
+ Colon,
5
8
  AtKeyword,
9
+ LeftSquareBracket,
6
10
  LeftCurlyBracket,
7
11
  RightCurlyBracket
8
12
  } from '../../tokenizer/index.js';
9
13
 
10
14
  const AMPERSAND = 0x0026; // U+0026 AMPERSAND (&)
15
+ const DOT = 0x002E; // U+002E FULL STOP (.)
16
+ const STAR = 0x002A; // U+002A ASTERISK (*);
17
+
18
+ const selectorStarts = new Set([
19
+ AMPERSAND,
20
+ DOT,
21
+ STAR
22
+ ]);
11
23
 
12
24
  function consumeRaw() {
13
25
  return this.Raw(null, true);
@@ -32,6 +44,12 @@ function consumeDeclaration() {
32
44
  return node;
33
45
  }
34
46
 
47
+ function isSelectorStart() {
48
+ return this.tokenType === Delim && selectorStarts.has(this.source.charCodeAt(this.tokenStart)) ||
49
+ this.tokenType === Hash || this.tokenType === LeftSquareBracket ||
50
+ this.tokenType === Colon;
51
+ }
52
+
35
53
  export const name = 'Block';
36
54
  export const walkContext = 'block';
37
55
  export const structure = {
@@ -65,7 +83,7 @@ export function parse(isStyleBlock) {
65
83
  break;
66
84
 
67
85
  default:
68
- if (isStyleBlock && this.isDelim(AMPERSAND)) {
86
+ if (isStyleBlock && isSelectorStart.call(this)) {
69
87
  children.push(consumeRule.call(this));
70
88
  } else {
71
89
  children.push(consumer.call(this));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint/css-tree",
3
- "version": "3.4.0",
3
+ "version": "3.5.0",
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",