@eslint/css-tree 3.3.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/dist/version.cjs CHANGED
@@ -1 +1 @@
1
- module.exports = "3.3.0";
1
+ module.exports = "3.3.1";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = "3.3.0";
1
+ export const version = "3.3.1";
package/lib/index.d.ts CHANGED
@@ -1382,27 +1382,46 @@ export class OffsetToLocation {
1382
1382
  * Represents an error that occurs during CSS parsing. Extends the standard `SyntaxError`
1383
1383
  * to include additional details about the parsing error.
1384
1384
  */
1385
+
1386
+ /**
1387
+ * Represents a syntax error while parsing CSS code. In the actual code,
1388
+ * this is called `SyntaxError`, but that clashes with the global `SyntaxError` class.
1389
+ * This isn't exported separately but rather as a member of the `parse` function.
1390
+ */
1385
1391
  export interface SyntaxParseError extends SyntaxError {
1392
+
1386
1393
  /**
1387
- * The original input string that caused the error.
1394
+ * The source code where the error occurred.
1388
1395
  */
1389
- input: string;
1396
+ source: string;
1390
1397
 
1391
1398
  /**
1392
- * The character offset in the input string where the error occurred.
1399
+ * The character offset in the source code where the error occurred.
1393
1400
  */
1394
1401
  offset: number;
1395
1402
 
1396
1403
  /**
1397
- * The raw error message without formatting.
1404
+ * The line number (1-indexed) in the source code where the error occurred.
1398
1405
  */
1399
- rawMessage: string;
1406
+ line: number;
1400
1407
 
1401
1408
  /**
1402
- * The formatted error message, including contextual information such as
1403
- * the location in the input string.
1409
+ * The column number (1-indexed) in the source code where the error occurred.
1404
1410
  */
1405
- formattedMessage: string;
1411
+ column: number;
1412
+
1413
+ /**
1414
+ * The source code fragment around the error, including a specified number of extra lines.
1415
+ * @param extraLines The number of extra lines to include in the fragment.
1416
+ * @return A string containing the source code fragment around the error.
1417
+ * This fragment includes the error line and the specified number of lines before and after it.
1418
+ */
1419
+ sourceFragment(extraLines: number): string;
1420
+
1421
+ /**
1422
+ * The error message formatted with the source fragment.
1423
+ */
1424
+ readonly formattedMessage: string;
1406
1425
  }
1407
1426
 
1408
1427
  /**
@@ -1506,6 +1525,18 @@ export interface ParseOptions {
1506
1525
  parseCustomProperty?: boolean | undefined;
1507
1526
  }
1508
1527
 
1528
+ /**
1529
+ * Creates a new instance of a parse error.
1530
+ * @param message The error message describing the syntax error.
1531
+ * @param source The source code where the error occurred.
1532
+ * @param offset The character offset in the source code where the error occurred.
1533
+ * @param line The line number (1-indexed) in the source code where the error occurred.
1534
+ * @param column The column number (1-indexed) in the source code where the error occurred.
1535
+ * @param baseLine The base line number (1-indexed) for the error, used for relative positioning.
1536
+ * @param baseColumn The base column number (1-indexed) for the error, used for relative positioning.
1537
+ */
1538
+ export type SyntaxErrorCreator = (message: string, source: string, offset: number, line: number, column: number, baseLine?: number, baseColumn?: number) => SyntaxParseError;
1539
+
1509
1540
  /**
1510
1541
  * A function that parses a CSS string into an abstract syntax tree (AST).
1511
1542
  */
@@ -1523,7 +1554,7 @@ export interface ParseFunction {
1523
1554
  /**
1524
1555
  * The error class used for parsing errors.
1525
1556
  */
1526
- SyntaxError: typeof CSSSyntaxError;
1557
+ SyntaxError: SyntaxErrorCreator;
1527
1558
 
1528
1559
  /**
1529
1560
  * The configuration used by the parser.
@@ -2266,59 +2297,6 @@ export const url: {
2266
2297
  // https://github.com/csstree/csstree/blob/master/lib/lexer/Lexer.js
2267
2298
  // ----------------------------------------------------------
2268
2299
 
2269
- /**
2270
- * Represents a syntax error while parsing CSS code. In the actual code,
2271
- * this is called `SyntaxError`, but that clashes with the global `SyntaxError` class.
2272
- * This isn't exported separately but rather as a member of the `parse` function.
2273
- */
2274
- declare class CSSSyntaxError extends SyntaxError {
2275
-
2276
- /**
2277
- * Creates a new instance
2278
- * @param message The error message describing the syntax error.
2279
- * @param source The source code where the error occurred.
2280
- * @param offset The character offset in the source code where the error occurred.
2281
- * @param line The line number (1-indexed) in the source code where the error occurred.
2282
- * @param column The column number (1-indexed) in the source code where the error occurred.
2283
- * @param baseLine The base line number (1-indexed) for the error, used for relative positioning.
2284
- * @param baseColumn The base column number (1-indexed) for the error, used for relative positioning.
2285
- */
2286
- constructor(message: string, source: string, offset: number, line: number, column: number, baseLine?: number, baseColumn?: number);
2287
-
2288
- /**
2289
- * The source code where the error occurred.
2290
- */
2291
- source: string;
2292
-
2293
- /**
2294
- * The character offset in the source code where the error occurred.
2295
- */
2296
- offset: number;
2297
-
2298
- /**
2299
- * The line number (1-indexed) in the source code where the error occurred.
2300
- */
2301
- line: number;
2302
-
2303
- /**
2304
- * The column number (1-indexed) in the source code where the error occurred.
2305
- */
2306
- column: number;
2307
-
2308
- /**
2309
- * The source code fragment around the error, including a specified number of extra lines.
2310
- * @param extraLines The number of extra lines to include in the fragment.
2311
- * @return A string containing the source code fragment around the error.
2312
- * This fragment includes the error line and the specified number of lines before and after it.
2313
- */
2314
- sourceFragment(extraLines: number): string;
2315
-
2316
- /**
2317
- * The error message formatted with the source fragment.
2318
- */
2319
- readonly formattedMessage: string;
2320
- }
2321
-
2322
2300
  /**
2323
2301
  * Represents an error that occurs during the syntax matching process.
2324
2302
  * Extends the standard `SyntaxError` with additional properties specific to CSS parsing.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint/css-tree",
3
- "version": "3.3.0",
3
+ "version": "3.3.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",