@eslint/css-tree 3.6.7 → 3.6.8

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.6.7";
1
+ module.exports = "3.6.8";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = "3.6.7";
1
+ export const version = "3.6.8";
@@ -8,7 +8,9 @@ import {
8
8
  LeftSquareBracket,
9
9
  Colon,
10
10
  Ident,
11
- RightCurlyBracket
11
+ RightCurlyBracket,
12
+ LeftCurlyBracket,
13
+ Comma
12
14
  } from '../../tokenizer/index.js';
13
15
 
14
16
  const AMPERSAND = 0x0026; // U+0026 AMPERSAND (&)
@@ -38,12 +40,17 @@ function isElementSelectorStart() {
38
40
 
39
41
  const nextTokenType = this.lookupTypeNonSC(1);
40
42
 
41
- // Simple case: if next token is not colon, semicolon, or closing brace, it's likely a selector
42
- if (nextTokenType !== Colon && nextTokenType !== Semicolon && nextTokenType !== RightCurlyBracket) {
43
+ // If next token is a left curly bracket, it's definitely a selector (e.g., "div { ... }")
44
+ if (nextTokenType === LeftCurlyBracket) {
43
45
  return true;
44
46
  }
45
47
 
46
- // Special handling for colon case - could be pseudo-class/pseudo-element
48
+ // If next token is semicolon, comma, or closing brace, it's definitely a declaration
49
+ if (nextTokenType === Semicolon || nextTokenType === Comma || nextTokenType === RightCurlyBracket) {
50
+ return false;
51
+ }
52
+
53
+ // Special handling for colon case - could be pseudo-class/pseudo-element or property
47
54
  if (nextTokenType === Colon) {
48
55
  // Look ahead further to see what follows the colon
49
56
  const afterColonType = this.lookupTypeNonSC(2);
@@ -52,12 +59,19 @@ function isElementSelectorStart() {
52
59
  // check what comes after that
53
60
  if (afterColonType === Ident) {
54
61
  const afterPseudoType = this.lookupTypeNonSC(3);
55
- // If it's followed by { or other selector tokens, it's a selector
56
- // If it's followed by ; or } or EOF, it's not a selector (property)
57
- return afterPseudoType !== Semicolon && afterPseudoType !== RightCurlyBracket && afterPseudoType !== 0; // 0 is EOF
62
+ // If it's followed by {, it's definitely a selector (e.g., "div:hover { ... }")
63
+ if (afterPseudoType === LeftCurlyBracket) {
64
+ return true;
65
+ }
66
+ // Otherwise, it's a property (e.g., "transition: opacity 1s")
67
+ return false;
58
68
  }
69
+ // If after colon there's not an identifier, it's a property
70
+ return false;
59
71
  }
60
72
 
73
+ // For other token types (dimensions, numbers, strings, etc.), assume it's a declaration
74
+ // This handles cases like multi-value properties
61
75
  return false;
62
76
  }
63
77
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint/css-tree",
3
- "version": "3.6.7",
3
+ "version": "3.6.8",
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",