@eslint/css-tree 3.5.1 → 3.5.3
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/csstree.esm.js +1 -1
- package/dist/csstree.js +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.js +1 -1
- package/lib/data.d.ts +11 -0
- package/lib/index.d.ts +27 -20
- package/package.json +3 -2
package/dist/version.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = "3.5.
|
|
1
|
+
module.exports = "3.5.3";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "3.5.
|
|
1
|
+
export const version = "3.5.3";
|
package/lib/data.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Type definitions for @eslint/css-tree/definition-syntax-data
|
|
3
|
+
* @author Nicholas C. Zakas
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { SyntaxConfig } from "./index.js";
|
|
7
|
+
|
|
8
|
+
export type DefaultSyntaxConfig = Pick<SyntaxConfig, "atrules" | "types" | "properties">;
|
|
9
|
+
|
|
10
|
+
declare const defaultConfig: DefaultSyntaxConfig;
|
|
11
|
+
export default defaultConfig;
|
package/lib/index.d.ts
CHANGED
|
@@ -522,7 +522,7 @@ export class List<TData> {
|
|
|
522
522
|
|
|
523
523
|
export interface CssNodeCommon {
|
|
524
524
|
type: string;
|
|
525
|
-
loc?: CssLocationRange |
|
|
525
|
+
loc?: CssLocationRange | null;
|
|
526
526
|
}
|
|
527
527
|
|
|
528
528
|
export interface AnPlusB extends CssNodeCommon {
|
|
@@ -1608,6 +1608,14 @@ export interface ParseFunction {
|
|
|
1608
1608
|
*/
|
|
1609
1609
|
export const parse: ParseFunction;
|
|
1610
1610
|
|
|
1611
|
+
/**
|
|
1612
|
+
* Represents a function that reads a sequence of CSS tokens and returns a list of nodes.
|
|
1613
|
+
*
|
|
1614
|
+
* @param recognizer - A recognizer instance to determine node boundaries.
|
|
1615
|
+
* @returns A list of parsed nodes.
|
|
1616
|
+
*/
|
|
1617
|
+
export type ReadSequenceFunction = (this: ParserContext, recognizer: Recognizer) => List<CssNode>;
|
|
1618
|
+
|
|
1611
1619
|
// ----------------------------------------------------------
|
|
1612
1620
|
// Generator
|
|
1613
1621
|
// https://github.com/csstree/csstree/tree/master/lib/generator
|
|
@@ -2415,12 +2423,11 @@ export interface LexerMatchResult {
|
|
|
2415
2423
|
|
|
2416
2424
|
type ConsumerFunction = (this: ParserContext, ...args: unknown[]) => CssNode;
|
|
2417
2425
|
|
|
2418
|
-
// https://github.com/csstree/csstree/tree/master/lib/syntax/scope
|
|
2419
2426
|
/**
|
|
2420
2427
|
* Recognizer is responsible for identifying specific patterns or constructs within the CSS syntax.
|
|
2421
2428
|
* It provides methods to interpret and handle these constructs during parsing.
|
|
2429
|
+
* @see https://github.com/csstree/csstree/blob/master/lib/syntax/scope
|
|
2422
2430
|
*/
|
|
2423
|
-
// FIXME
|
|
2424
2431
|
interface Recognizer {
|
|
2425
2432
|
/**
|
|
2426
2433
|
* Retrieves a node based on the provided parsing context.
|
|
@@ -2428,16 +2435,19 @@ interface Recognizer {
|
|
|
2428
2435
|
* @param context - The parsing context, which contains relevant state and configuration for the parser.
|
|
2429
2436
|
* @returns A function that, when executed, produces a `CssNode`.
|
|
2430
2437
|
*/
|
|
2431
|
-
getNode(
|
|
2438
|
+
getNode(this: ParserContext): CssNode;
|
|
2432
2439
|
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2440
|
+
/**
|
|
2441
|
+
* Handles whitespace between CSS selectors during parsing.
|
|
2442
|
+
* Ensures that whitespace is correctly interpreted as a descendant combinator.
|
|
2443
|
+
*
|
|
2444
|
+
* @param next - The next node or token in the parsing sequence.
|
|
2445
|
+
* @param children - The list of parsed nodes, which will be modified to include a `Combinator` node if applicable.
|
|
2446
|
+
*/
|
|
2447
|
+
onWhitespace?(this: ParserContext, next: CssNode | null, children: List<CssNode>): void;
|
|
2448
|
+
|
|
2449
|
+
// any number of other properties
|
|
2450
|
+
[key:string]: any;
|
|
2441
2451
|
}
|
|
2442
2452
|
|
|
2443
2453
|
/**
|
|
@@ -2468,11 +2478,8 @@ interface Parser {
|
|
|
2468
2478
|
|
|
2469
2479
|
/**
|
|
2470
2480
|
* Reads a sequence of CSS nodes based on the provided recognizer.
|
|
2471
|
-
*
|
|
2472
|
-
* @param recognizer - A recognizer instance to determine node boundaries.
|
|
2473
|
-
* @returns A list of parsed `CssNode` objects.
|
|
2474
2481
|
*/
|
|
2475
|
-
readSequence
|
|
2482
|
+
readSequence: ReadSequenceFunction;
|
|
2476
2483
|
|
|
2477
2484
|
/**
|
|
2478
2485
|
* Consumes input until the end of a balance context is reached.
|
|
@@ -2705,7 +2712,7 @@ interface StructureDefinition {
|
|
|
2705
2712
|
interface NodeSyntaxConfig<T extends CssNodeCommon = CssNodeCommon> {
|
|
2706
2713
|
name: string;
|
|
2707
2714
|
structure: StructureDefinition;
|
|
2708
|
-
parse(this: ParserContext): T;
|
|
2715
|
+
parse(this: ParserContext, ...args:Array<unknown>): T;
|
|
2709
2716
|
generate(this: ParserContext, node: T): void;
|
|
2710
2717
|
walkContext?: string;
|
|
2711
2718
|
}
|
|
@@ -2732,11 +2739,11 @@ export interface SyntaxConfig<T extends CssNodeCommon = CssNodeCommon> {
|
|
|
2732
2739
|
types: Record<string, string>;
|
|
2733
2740
|
properties: Record<string, string>;
|
|
2734
2741
|
atrules: Record<string, AtruleSyntax>;
|
|
2735
|
-
node: Record<string, NodeSyntaxConfig<T
|
|
2742
|
+
node: Record<string, Partial<NodeSyntaxConfig<T>>>;
|
|
2736
2743
|
atrule: Record<string, { parse: ConsumerFunction; }>;
|
|
2737
2744
|
pseudo: Record<string, { parse: ConsumerFunction; }>;
|
|
2738
|
-
scope: Record<string, Recognizer
|
|
2739
|
-
features: Record<string, Recognizer
|
|
2745
|
+
scope: Record<string, Partial<Recognizer>>;
|
|
2746
|
+
features: Record<string, Partial<Recognizer>>;
|
|
2740
2747
|
parseContext: ParseContext;
|
|
2741
2748
|
tokenize: TokenizeFunction;
|
|
2742
2749
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint/css-tree",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.3",
|
|
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",
|
|
@@ -67,7 +67,8 @@
|
|
|
67
67
|
},
|
|
68
68
|
"./definition-syntax-data": {
|
|
69
69
|
"import": "./lib/data.js",
|
|
70
|
-
"require": "./cjs/data.cjs"
|
|
70
|
+
"require": "./cjs/data.cjs",
|
|
71
|
+
"types": "./lib/data.d.ts"
|
|
71
72
|
},
|
|
72
73
|
"./definition-syntax-data-patch": {
|
|
73
74
|
"import": "./lib/data-patch.js",
|