@tbela99/css-parser 1.6.3 → 1.6.4
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/CHANGELOG.md +13 -0
- package/README.md +8 -8
- package/dist/{lib/data → data}/properties.json.js +296 -29
- package/dist/{lib/data → data}/validation.json.js +6 -0
- package/dist/index-umd-web.js +676 -459
- package/dist/index.cjs +676 -459
- package/dist/index.d.ts +9 -4
- package/dist/lib/ast/expand.js +1 -1
- package/dist/lib/ast/features/if.js +1 -1
- package/dist/lib/ast/features/inlinecssvariables.js +1 -1
- package/dist/lib/ast/features/prefix.js +1 -1
- package/dist/lib/ast/features/shorthand.js +10 -5
- package/dist/lib/ast/features/transform.js +1 -1
- package/dist/lib/ast/minify.js +1 -1
- package/dist/lib/ast/transform/utils.js +2 -2
- package/dist/lib/ast/walk.js +108 -90
- package/dist/lib/parser/declaration/list.js +19 -26
- package/dist/lib/parser/declaration/map.js +152 -33
- package/dist/lib/parser/parse.js +7 -7
- package/dist/lib/parser/source.js +2 -2
- package/dist/lib/parser/utils/config.js +1 -1
- package/dist/lib/parser/utils/declaration.js +0 -18
- package/dist/lib/parser/utils/hash.js +10 -5
- package/dist/lib/parser/utils/selector.js +1 -1
- package/dist/lib/{renderer → printer}/render.js +15 -15
- package/dist/lib/syntax/color/lch.js +0 -1
- package/dist/lib/syntax/color/oklch.js +0 -1
- package/dist/lib/syntax/color/xyzd50.js +0 -17
- package/dist/lib/syntax/constants.js +1 -1
- package/dist/lib/validation/config.js +5 -33
- package/dist/lib/validation/match.js +50 -180
- package/dist/node.js +3 -3
- package/dist/web.js +3 -3
- package/package.json +2 -2
- /package/dist/lib/{renderer → printer}/sourcemap/lib/codec.js +0 -0
- /package/dist/lib/{renderer → printer}/sourcemap/sourcemap.js +0 -0
|
@@ -10,6 +10,20 @@ import { parseTokens } from '../parser/parse.js';
|
|
|
10
10
|
const config = getSyntaxConfig();
|
|
11
11
|
// @ts-expect-error
|
|
12
12
|
const allValues = config.declarations.all.syntax.split(/[\s|]+/g);
|
|
13
|
+
const selectorNodeTypes = [
|
|
14
|
+
EnumToken.CommaTokenType,
|
|
15
|
+
EnumToken.ColumnCombinatorTokenType,
|
|
16
|
+
EnumToken.ChildCombinatorTokenType,
|
|
17
|
+
EnumToken.NextSiblingCombinatorTokenType,
|
|
18
|
+
EnumToken.SubsequentSiblingCombinatorTokenType,
|
|
19
|
+
];
|
|
20
|
+
const trimWhitespaceBefore = selectorNodeTypes.concat(EnumToken.DelimTokenType, EnumToken.DashMatchTokenType, EnumToken.IncludeMatchTokenType, EnumToken.ContainMatchTokenType, EnumToken.StartMatchTokenType, EnumToken.EndMatchTokenType, EnumToken.AttrEndTokenType);
|
|
21
|
+
const trimWhitespaceAfter = selectorNodeTypes.concat(EnumToken.DelimTokenType, EnumToken.DashMatchTokenType, EnumToken.IncludeMatchTokenType, EnumToken.ContainMatchTokenType, EnumToken.StartMatchTokenType, EnumToken.EndMatchTokenType, EnumToken.AttrStartTokenType);
|
|
22
|
+
const selectorEnumMap = new Map([
|
|
23
|
+
[EnumToken.Tilda, EnumToken.SubsequentSiblingCombinatorTokenType],
|
|
24
|
+
[EnumToken.GtTokenType, EnumToken.ChildCombinatorTokenType],
|
|
25
|
+
]);
|
|
26
|
+
const propertyKeywordValues = new Map();
|
|
13
27
|
/**
|
|
14
28
|
* @type {Array.<EnumToken>}
|
|
15
29
|
*/
|
|
@@ -233,24 +247,6 @@ function createValidationContext(tokens) {
|
|
|
233
247
|
getRemainingTokens() {
|
|
234
248
|
return this.tokens.slice(this.index + 1);
|
|
235
249
|
},
|
|
236
|
-
// last() {
|
|
237
|
-
// let index: number = this.tokens.length - 1;
|
|
238
|
-
// let token: Token = this.tokens[index];
|
|
239
|
-
// while (
|
|
240
|
-
// (this.index >= 0 && token?.typ === EnumToken.WhitespaceTokenType) ||
|
|
241
|
-
// token?.typ === EnumToken.CommentTokenType ||
|
|
242
|
-
// token?.typ === EnumToken.CDOCOMMTokenType ||
|
|
243
|
-
// token?.typ === EnumToken.InvalidCommentTokenType ||
|
|
244
|
-
// token?.typ === EnumToken.BadCommentTokenType ||
|
|
245
|
-
// token?.typ === EnumToken.BadStringTokenType
|
|
246
|
-
// ) {
|
|
247
|
-
// token = this.tokens[--index];
|
|
248
|
-
// if (token == null) {
|
|
249
|
-
// break;
|
|
250
|
-
// }
|
|
251
|
-
// }
|
|
252
|
-
// return token;
|
|
253
|
-
// },
|
|
254
250
|
end() {
|
|
255
251
|
this.index = this.tokens.length + 1;
|
|
256
252
|
return this;
|
|
@@ -310,19 +306,6 @@ function createValidationContext(tokens) {
|
|
|
310
306
|
function matchSelectorSyntax(stream, errors, options, nested = true) {
|
|
311
307
|
const stack = [];
|
|
312
308
|
const tokens = [];
|
|
313
|
-
const nodes = [
|
|
314
|
-
EnumToken.CommaTokenType,
|
|
315
|
-
EnumToken.ColumnCombinatorTokenType,
|
|
316
|
-
EnumToken.ChildCombinatorTokenType,
|
|
317
|
-
EnumToken.NextSiblingCombinatorTokenType,
|
|
318
|
-
EnumToken.SubsequentSiblingCombinatorTokenType,
|
|
319
|
-
];
|
|
320
|
-
const trimWhitespaceBefore = nodes.concat(EnumToken.DelimTokenType, EnumToken.DashMatchTokenType, EnumToken.IncludeMatchTokenType, EnumToken.ContainMatchTokenType, EnumToken.StartMatchTokenType, EnumToken.EndMatchTokenType, EnumToken.AttrEndTokenType);
|
|
321
|
-
const trimWhitespaceAfter = nodes.concat(EnumToken.DelimTokenType, EnumToken.DashMatchTokenType, EnumToken.IncludeMatchTokenType, EnumToken.ContainMatchTokenType, EnumToken.StartMatchTokenType, EnumToken.EndMatchTokenType, EnumToken.AttrStartTokenType);
|
|
322
|
-
const enumMap = new Map([
|
|
323
|
-
[EnumToken.Tilda, EnumToken.SubsequentSiblingCombinatorTokenType],
|
|
324
|
-
[EnumToken.GtTokenType, EnumToken.ChildCombinatorTokenType],
|
|
325
|
-
]);
|
|
326
309
|
let token;
|
|
327
310
|
let i = 0;
|
|
328
311
|
let success = true;
|
|
@@ -362,15 +345,15 @@ function matchSelectorSyntax(stream, errors, options, nested = true) {
|
|
|
362
345
|
}
|
|
363
346
|
tokens.push(token);
|
|
364
347
|
if (tokensfuncDefMap.has(token.typ)) {
|
|
365
|
-
if (stack.length > 0 &&
|
|
348
|
+
if (stack.length > 0 && selectorNodeTypes.includes(stack.at(-1).typ)) {
|
|
366
349
|
stack.pop();
|
|
367
350
|
}
|
|
368
351
|
stack.push(token);
|
|
369
352
|
continue;
|
|
370
353
|
}
|
|
371
354
|
if (stack.length > 0 &&
|
|
372
|
-
|
|
373
|
-
!
|
|
355
|
+
selectorNodeTypes.includes(stack.at(-1).typ) &&
|
|
356
|
+
!selectorNodeTypes.includes(token.typ) &&
|
|
374
357
|
token.typ !== EnumToken.WhitespaceTokenType &&
|
|
375
358
|
token.typ !== EnumToken.CommentTokenType &&
|
|
376
359
|
token.typ !== EnumToken.CDOCOMMTokenType) {
|
|
@@ -416,7 +399,7 @@ function matchSelectorSyntax(stream, errors, options, nested = true) {
|
|
|
416
399
|
break;
|
|
417
400
|
case EnumToken.Tilda:
|
|
418
401
|
case EnumToken.GtTokenType:
|
|
419
|
-
Object.assign(token, { typ:
|
|
402
|
+
Object.assign(token, { typ: selectorEnumMap.get(token.typ) });
|
|
420
403
|
case EnumToken.ColumnCombinatorTokenType:
|
|
421
404
|
case EnumToken.ChildCombinatorTokenType:
|
|
422
405
|
case EnumToken.UniversalSelectorTokenType:
|
|
@@ -429,7 +412,7 @@ function matchSelectorSyntax(stream, errors, options, nested = true) {
|
|
|
429
412
|
if (stack.length > 0 && stack.at(-1)?.typ === EnumToken.UniversalSelectorTokenType) {
|
|
430
413
|
stack.pop();
|
|
431
414
|
}
|
|
432
|
-
if (stack.length > 0 &&
|
|
415
|
+
if (stack.length > 0 && selectorNodeTypes.includes(stack.at(-1)?.typ)) {
|
|
433
416
|
return {
|
|
434
417
|
success: false,
|
|
435
418
|
errors: [
|
|
@@ -539,106 +522,10 @@ function matchSelectorSyntax(stream, errors, options, nested = true) {
|
|
|
539
522
|
};
|
|
540
523
|
}
|
|
541
524
|
slice.shift();
|
|
542
|
-
// if (slice.length > 0) {
|
|
543
|
-
// return {
|
|
544
|
-
// success: false,
|
|
545
|
-
// errors: [
|
|
546
|
-
// {
|
|
547
|
-
// action: "drop",
|
|
548
|
-
// message: `Unexpected token ${EnumToken[slice[0].typ]} at ${slice[0][LOC]!.src}:${slice[0][LOCSTA].lin}:${
|
|
549
|
-
// slice[0][LOCSTA].col
|
|
550
|
-
// }`,
|
|
551
|
-
// node: slice[0],
|
|
552
|
-
// location: slice[0][LOC],
|
|
553
|
-
// },
|
|
554
|
-
// ],
|
|
555
|
-
// };
|
|
556
|
-
// }
|
|
557
525
|
stack.pop();
|
|
558
526
|
break;
|
|
559
527
|
}
|
|
560
|
-
// case EnumToken.ColonTokenType:
|
|
561
|
-
// if (stream[i + 1]?.typ === EnumToken.IdenTokenType) {
|
|
562
|
-
// Object.assign(token, {
|
|
563
|
-
// typ:
|
|
564
|
-
// (stream[i + 1] as IdentToken).val === "page"
|
|
565
|
-
// ? EnumToken.PseudoPageTokenType
|
|
566
|
-
// : pseudoElements.includes((token as PseudoElementToken).val)
|
|
567
|
-
// ? EnumToken.PseudoElementTokenType
|
|
568
|
-
// : EnumToken.PseudoClassTokenType,
|
|
569
|
-
// val: ":" + (stream[i + 1] as IdentToken).val,
|
|
570
|
-
// });
|
|
571
|
-
// token[LOC]!.end = stream[++i][LOC]!.end;
|
|
572
|
-
// break;
|
|
573
|
-
// } else if (stream[i + 1]?.typ === EnumToken.FunctionTokenDefType) {
|
|
574
|
-
// Object.assign(token, {
|
|
575
|
-
// typ: EnumToken.PseudoClassFunctionTokenDefType,
|
|
576
|
-
// val: ":" + (stream[i + 1] as IdentToken).val,
|
|
577
|
-
// });
|
|
578
|
-
// token[LOC]!.end = stream[++i][LOC]!.end;
|
|
579
|
-
// stack.push(token);
|
|
580
|
-
// break;
|
|
581
|
-
// }
|
|
582
|
-
// return {
|
|
583
|
-
// success: false,
|
|
584
|
-
// errors: [
|
|
585
|
-
// {
|
|
586
|
-
// action: "drop",
|
|
587
|
-
// message: `Unexpected token ${EnumToken[token.typ]} at ${token[LOC]!.src}:${token[LOCSTA].lin}:${
|
|
588
|
-
// token[LOCSTA].col
|
|
589
|
-
// }`,
|
|
590
|
-
// node: token,
|
|
591
|
-
// location: token[LOC],
|
|
592
|
-
// },
|
|
593
|
-
// ],
|
|
594
|
-
// };
|
|
595
|
-
// case EnumToken.DoubleColonTokenType:
|
|
596
|
-
// if (stream[i + 1]?.typ === EnumToken.IdenTokenType) {
|
|
597
|
-
// Object.assign(token, {
|
|
598
|
-
// typ:
|
|
599
|
-
// (stream[i + 1] as IdentToken).val === "page"
|
|
600
|
-
// ? EnumToken.PseudoPageTokenType
|
|
601
|
-
// : EnumToken.PseudoElementTokenType,
|
|
602
|
-
// val: "::" + (stream[i + 1] as IdentToken).val,
|
|
603
|
-
// });
|
|
604
|
-
// token[LOC]!.end = stream[++i][LOC]!.end;
|
|
605
|
-
// break;
|
|
606
|
-
// } else if (stream[i + 1]?.typ === EnumToken.FunctionTokenDefType) {
|
|
607
|
-
// Object.assign(token, {
|
|
608
|
-
// typ: EnumToken.PseudoClassFunctionTokenDefType,
|
|
609
|
-
// val: "::" + (stream[i + 1] as IdentToken).val,
|
|
610
|
-
// });
|
|
611
|
-
// token[LOC]!.end = stream[++i][LOC]!.end;
|
|
612
|
-
// stack.push(token);
|
|
613
|
-
// break;
|
|
614
|
-
// }
|
|
615
|
-
// return {
|
|
616
|
-
// success: false,
|
|
617
|
-
// errors: [
|
|
618
|
-
// {
|
|
619
|
-
// action: "drop",
|
|
620
|
-
// message: `Unexpected token ${EnumToken[token.typ]} at ${token[LOC]!.src}:${token[LOCSTA].lin}:${
|
|
621
|
-
// token[LOCSTA].col
|
|
622
|
-
// }`,
|
|
623
|
-
// node: token,
|
|
624
|
-
// location: token[LOC],
|
|
625
|
-
// },
|
|
626
|
-
// ],
|
|
627
|
-
// };
|
|
628
528
|
case EnumToken.StartParensTokenType:
|
|
629
|
-
// if (
|
|
630
|
-
// tokens.at(-2)?.typ === EnumToken.PseudoClassTokenType ||
|
|
631
|
-
// tokens.at(-2)?.typ === EnumToken.PseudoElementTokenType
|
|
632
|
-
// ) {
|
|
633
|
-
// stack.push(
|
|
634
|
-
// Object.assign(tokens.at(-2) as Token, {
|
|
635
|
-
// typ: EnumToken.PseudoClassFunctionTokenDefType,
|
|
636
|
-
// chi: [],
|
|
637
|
-
// }),
|
|
638
|
-
// );
|
|
639
|
-
// // tokens.pop();
|
|
640
|
-
// break;
|
|
641
|
-
// }
|
|
642
529
|
return {
|
|
643
530
|
success: false,
|
|
644
531
|
errors: [
|
|
@@ -658,19 +545,6 @@ function matchSelectorSyntax(stream, errors, options, nested = true) {
|
|
|
658
545
|
if (stack.at(-1)?.typ === EnumToken.PseudoClassFunctionTokenDefType ||
|
|
659
546
|
stack.at(-1)?.typ === EnumToken.PseudoElementTokenType) {
|
|
660
547
|
const token = stack.at(-1);
|
|
661
|
-
// if (!((stack.at(-1) as PseudoClassFunctionToken).val + "()" in config.selectors)) {
|
|
662
|
-
// return {
|
|
663
|
-
// errors: [
|
|
664
|
-
// {
|
|
665
|
-
// action: "drop",
|
|
666
|
-
// message: `Unknown class element ${(token as PseudoElementToken).val}`,
|
|
667
|
-
// node: token,
|
|
668
|
-
// location: token[LOC]!,
|
|
669
|
-
// },
|
|
670
|
-
// ],
|
|
671
|
-
// success: false,
|
|
672
|
-
// };
|
|
673
|
-
// }
|
|
674
548
|
const index = tokens.indexOf(token);
|
|
675
549
|
const result = matchAllSyntaxes(getParsedSyntax(ValidationSyntaxGroupEnum.Selectors, token.val + "()")?.[0]?.chi ?? [], createValidationContext(tokens.slice(index + 1, tokens.length - 1)), options);
|
|
676
550
|
if (!result.success) {
|
|
@@ -810,6 +684,7 @@ function matchListSyntax(syntax, context, options) {
|
|
|
810
684
|
let tmpResult;
|
|
811
685
|
let count = 0;
|
|
812
686
|
let range;
|
|
687
|
+
let done = false;
|
|
813
688
|
success = false;
|
|
814
689
|
do {
|
|
815
690
|
range = context.peekRange(EnumToken.CommaTokenType, EnumToken.CommaTokenType, 1);
|
|
@@ -825,12 +700,9 @@ function matchListSyntax(syntax, context, options) {
|
|
|
825
700
|
else {
|
|
826
701
|
context.update(range.at(-1));
|
|
827
702
|
}
|
|
828
|
-
|
|
829
|
-
// context.end();
|
|
830
|
-
break;
|
|
831
|
-
}
|
|
703
|
+
done = context.done();
|
|
832
704
|
}
|
|
833
|
-
} while (tmpResult.success && !
|
|
705
|
+
} while (tmpResult.success && !done);
|
|
834
706
|
return result == null
|
|
835
707
|
? {
|
|
836
708
|
success: false,
|
|
@@ -868,6 +740,9 @@ function matchOccurenceSyntax(syntax, context, options) {
|
|
|
868
740
|
context.end();
|
|
869
741
|
break;
|
|
870
742
|
}
|
|
743
|
+
if (tmpResult.context.index === context.index) {
|
|
744
|
+
break;
|
|
745
|
+
}
|
|
871
746
|
context.update(tmpResult.context.current());
|
|
872
747
|
if (match?.max?.val != null && Number.isFinite(match?.max?.val) && count === match.max.val) {
|
|
873
748
|
break;
|
|
@@ -913,7 +788,6 @@ function matchSyntax(syntaxes, context, options) {
|
|
|
913
788
|
errors: [],
|
|
914
789
|
};
|
|
915
790
|
}
|
|
916
|
-
syntaxes = syntaxes.slice();
|
|
917
791
|
let i = -1;
|
|
918
792
|
let success = false;
|
|
919
793
|
let token = null;
|
|
@@ -1245,21 +1119,19 @@ function matchSyntax(syntaxes, context, options) {
|
|
|
1245
1119
|
case ValidationTokenEnum.PipeToken:
|
|
1246
1120
|
{
|
|
1247
1121
|
result = null;
|
|
1248
|
-
const results = [];
|
|
1249
1122
|
let tmp = null;
|
|
1250
1123
|
for (const syntax of syntaxes[i].chi) {
|
|
1251
1124
|
tmp = matchSyntax(syntax, context.slice(), options);
|
|
1252
1125
|
if (tmp.success) {
|
|
1253
|
-
|
|
1126
|
+
if (result == null || tmp.context.index >= result.context.index) {
|
|
1127
|
+
result = tmp;
|
|
1128
|
+
}
|
|
1254
1129
|
if (tmp.context.done()) {
|
|
1255
1130
|
context.end();
|
|
1256
1131
|
return { ...tmp, context, syntaxToken: syntaxes[i + 1] };
|
|
1257
1132
|
}
|
|
1258
1133
|
}
|
|
1259
1134
|
}
|
|
1260
|
-
if (results.length > 0) {
|
|
1261
|
-
result = results.reduce((a, b) => (a.context.index > b.context.index ? a : b));
|
|
1262
|
-
}
|
|
1263
1135
|
if (result?.success) {
|
|
1264
1136
|
success = true;
|
|
1265
1137
|
options.visited.get(token).delete(syntaxes[i]);
|
|
@@ -1621,7 +1493,8 @@ function matchAmpersandSyntax(syntax, context, options) {
|
|
|
1621
1493
|
*/
|
|
1622
1494
|
function matchProperty(property, context, options) {
|
|
1623
1495
|
let success = false;
|
|
1624
|
-
|
|
1496
|
+
const token = context.peek();
|
|
1497
|
+
let t = token?.typ;
|
|
1625
1498
|
let checkCalc = (t == EnumToken.MathFunctionTokenDefType || t == EnumToken.MathFunctionTokenType) &&
|
|
1626
1499
|
[
|
|
1627
1500
|
"number",
|
|
@@ -1636,19 +1509,19 @@ function matchProperty(property, context, options) {
|
|
|
1636
1509
|
"calc-product",
|
|
1637
1510
|
].includes(property.val);
|
|
1638
1511
|
if (checkCalc && !["number", "zero", "integer", "percentage", "length-percentage"].includes(property.val)) {
|
|
1639
|
-
checkCalc =
|
|
1512
|
+
checkCalc = token.val === "calc";
|
|
1640
1513
|
}
|
|
1641
1514
|
if (checkCalc) {
|
|
1642
1515
|
let result;
|
|
1643
|
-
const syntax = getParsedSyntax(ValidationSyntaxGroupEnum.Syntaxes,
|
|
1516
|
+
const syntax = getParsedSyntax(ValidationSyntaxGroupEnum.Syntaxes, token.val + "()")?.[0]?.chi;
|
|
1644
1517
|
if (t === EnumToken.MathFunctionTokenType) {
|
|
1645
|
-
result = matchSyntax(syntax, createValidationContext(
|
|
1518
|
+
result = matchSyntax(syntax, createValidationContext(token.chi), options);
|
|
1646
1519
|
if (result.success && result.context.done()) {
|
|
1647
1520
|
context.next();
|
|
1648
1521
|
return {
|
|
1649
1522
|
success: true,
|
|
1650
1523
|
valid: true,
|
|
1651
|
-
token:
|
|
1524
|
+
token: token,
|
|
1652
1525
|
context,
|
|
1653
1526
|
syntaxToken: null,
|
|
1654
1527
|
errors: [],
|
|
@@ -1822,13 +1695,16 @@ function matchProperty(property, context, options) {
|
|
|
1822
1695
|
case "display-outside":
|
|
1823
1696
|
case "display-legacy":
|
|
1824
1697
|
case "content-position":
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
config.syntaxes[property.val].syntax
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1698
|
+
{
|
|
1699
|
+
let values = propertyKeywordValues.get(property.val);
|
|
1700
|
+
if (values == null) {
|
|
1701
|
+
values = new Set(config.syntaxes[property.val].syntax.split(/[\s|]+/));
|
|
1702
|
+
propertyKeywordValues.set(property.val, values);
|
|
1703
|
+
}
|
|
1704
|
+
success =
|
|
1705
|
+
token?.typ == EnumToken.IdenTokenType && values.has(token.val.toLowerCase());
|
|
1706
|
+
break;
|
|
1707
|
+
}
|
|
1832
1708
|
case "mf-name":
|
|
1833
1709
|
{
|
|
1834
1710
|
const token = context.peek();
|
|
@@ -1849,9 +1725,9 @@ function matchProperty(property, context, options) {
|
|
|
1849
1725
|
case "counter-name":
|
|
1850
1726
|
case "counter-style-name":
|
|
1851
1727
|
success =
|
|
1852
|
-
|
|
1853
|
-
if (success &&
|
|
1854
|
-
const val =
|
|
1728
|
+
token?.typ == EnumToken.IdenTokenType || token?.typ == EnumToken.DashedIdenTokenType;
|
|
1729
|
+
if (success && token?.typ === EnumToken.IdenTokenType) {
|
|
1730
|
+
const val = token.val.toLowerCase();
|
|
1855
1731
|
success = "none" !== val && !allValues.includes(val);
|
|
1856
1732
|
}
|
|
1857
1733
|
break;
|
|
@@ -2365,7 +2241,6 @@ function matchRepeatableSyntax(syntax, context, options) {
|
|
|
2365
2241
|
let result = null;
|
|
2366
2242
|
let tmpResult;
|
|
2367
2243
|
let success = !!isRepeatable;
|
|
2368
|
-
// let index: number = context.index;
|
|
2369
2244
|
do {
|
|
2370
2245
|
tmpResult = matchSyntax([rest], context.slice(), options);
|
|
2371
2246
|
if (tmpResult.success) {
|
|
@@ -2375,15 +2250,10 @@ function matchRepeatableSyntax(syntax, context, options) {
|
|
|
2375
2250
|
context.end();
|
|
2376
2251
|
break;
|
|
2377
2252
|
}
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2253
|
+
if (tmpResult.context.index === context.index) {
|
|
2254
|
+
break;
|
|
2255
|
+
}
|
|
2381
2256
|
context.update(result.context.current());
|
|
2382
|
-
// }
|
|
2383
|
-
// if (index === context.index) {
|
|
2384
|
-
// break;
|
|
2385
|
-
// }
|
|
2386
|
-
// index = context.index;
|
|
2387
2257
|
}
|
|
2388
2258
|
} while (tmpResult.success && !context.done());
|
|
2389
2259
|
return {
|
package/dist/node.js
CHANGED
|
@@ -4,8 +4,8 @@ import { createReadStream } from 'node:fs';
|
|
|
4
4
|
import { lstat, readFile } from 'node:fs/promises';
|
|
5
5
|
import { doParse, doParseSync } from './lib/parser/parse.js';
|
|
6
6
|
export { parseDeclarations, parseString } from './lib/parser/parse.js';
|
|
7
|
-
import { doRender } from './lib/
|
|
8
|
-
export { renderValue as renderToken } from './lib/
|
|
7
|
+
import { doRender } from './lib/printer/render.js';
|
|
8
|
+
export { renderValue as renderToken } from './lib/printer/render.js';
|
|
9
9
|
import { ModuleScopeEnumOptions } from './lib/ast/types.js';
|
|
10
10
|
export { ColorType, EnumAstNodeStatus, EnumToken, ModuleCaseTransformEnum, ValidationLevel } from './lib/ast/types.js';
|
|
11
11
|
import { Tokenizer } from './lib/parser/tokenize.js';
|
|
@@ -23,7 +23,7 @@ export { isOkLabClose, okLabDistance } from './lib/syntax/color/utils/distance.j
|
|
|
23
23
|
export { find, findAll, findByValue, findLast } from './lib/ast/find.js';
|
|
24
24
|
export { cloneNode } from './lib/ast/clone.js';
|
|
25
25
|
export { replaceNodeOrValue } from './lib/parser/utils/token.js';
|
|
26
|
-
export { SourceMap } from './lib/
|
|
26
|
+
export { SourceMap } from './lib/printer/sourcemap/sourcemap.js';
|
|
27
27
|
export { FeatureWalkMode } from './lib/ast/features/type.js';
|
|
28
28
|
export { getNodeProperty, setNodeProperty } from './lib/ast/node.js';
|
|
29
29
|
|
package/dist/web.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { doParse, doParseSync } from './lib/parser/parse.js';
|
|
2
2
|
export { parseDeclarations, parseString } from './lib/parser/parse.js';
|
|
3
|
-
import { doRender } from './lib/
|
|
4
|
-
export { renderValue as renderToken } from './lib/
|
|
3
|
+
import { doRender } from './lib/printer/render.js';
|
|
4
|
+
export { renderValue as renderToken } from './lib/printer/render.js';
|
|
5
5
|
import { ModuleScopeEnumOptions } from './lib/ast/types.js';
|
|
6
6
|
export { ColorType, EnumAstNodeStatus, EnumToken, ModuleCaseTransformEnum, ValidationLevel } from './lib/ast/types.js';
|
|
7
7
|
import { Tokenizer } from './lib/parser/tokenize.js';
|
|
@@ -17,7 +17,7 @@ export { isOkLabClose, okLabDistance } from './lib/syntax/color/utils/distance.j
|
|
|
17
17
|
export { find, findAll, findByValue, findLast } from './lib/ast/find.js';
|
|
18
18
|
export { cloneNode } from './lib/ast/clone.js';
|
|
19
19
|
export { replaceNodeOrValue } from './lib/parser/utils/token.js';
|
|
20
|
-
export { SourceMap } from './lib/
|
|
20
|
+
export { SourceMap } from './lib/printer/sourcemap/sourcemap.js';
|
|
21
21
|
export { FeatureWalkMode } from './lib/ast/features/type.js';
|
|
22
22
|
export { getNodeProperty, setNodeProperty } from './lib/ast/node.js';
|
|
23
23
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tbela99/css-parser",
|
|
3
3
|
"description": "CSS parser, minifier and validator for node and the browser",
|
|
4
|
-
"version": "1.6.
|
|
4
|
+
"version": "1.6.4",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/node.js",
|
|
7
7
|
"./node": "./dist/node.js",
|
|
@@ -88,4 +88,4 @@
|
|
|
88
88
|
"chai-as-promised": "^8.0.2"
|
|
89
89
|
},
|
|
90
90
|
"sideEffects": false
|
|
91
|
-
}
|
|
91
|
+
}
|
|
File without changes
|
|
File without changes
|