@tbela99/css-parser 2.2.0 → 2.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.
Files changed (118) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +24 -9
  3. package/dist/{lib/ast → ast}/arena-node.js +1 -1
  4. package/dist/{lib/ast → ast}/arena.js +1 -1
  5. package/dist/{lib/ast → ast}/cache.js +39 -23
  6. package/dist/{lib/ast → ast}/features/calc.js +1 -1
  7. package/dist/{lib/ast → ast}/features/if.js +1 -1
  8. package/dist/ast/features/index.d.ts +7 -0
  9. package/dist/{lib/ast → ast}/features/index.js +1 -1
  10. package/dist/{lib/ast → ast}/features/inlinecssvariables.js +1 -1
  11. package/dist/{lib/ast → ast}/features/mixin.js +1 -1
  12. package/dist/{lib/ast → ast}/features/prefix.js +1 -1
  13. package/dist/{lib/ast → ast}/features/shorthand.js +1 -1
  14. package/dist/{lib/ast → ast}/features/transform.js +1 -1
  15. package/dist/{lib/ast → ast}/features/type.js +1 -1
  16. package/dist/{lib/ast → ast}/math/expression.js +1 -1
  17. package/dist/{lib/ast → ast}/math/math.js +1 -1
  18. package/dist/{lib/ast → ast}/minify.js +1 -1
  19. package/dist/{lib/ast → ast}/mixins/custom-function.js +1 -1
  20. package/dist/{lib/ast → ast}/mixins/utils.js +1 -1
  21. package/dist/{lib/ast → ast}/mixins/variables.js +1 -1
  22. package/dist/{lib/ast → ast}/strings.js +5 -1
  23. package/dist/{lib/ast → ast}/transform/compute.js +1 -1
  24. package/dist/{lib/ast → ast}/transform/matrix.js +1 -1
  25. package/dist/{lib/ast → ast}/transform/minify.js +1 -1
  26. package/dist/{lib/ast → ast}/transform/perspective.js +1 -1
  27. package/dist/{lib/ast → ast}/transform/rotate.js +1 -1
  28. package/dist/{lib/ast → ast}/transform/scale.js +1 -1
  29. package/dist/{lib/ast → ast}/transform/skew.js +1 -1
  30. package/dist/{lib/ast → ast}/transform/translate.js +1 -1
  31. package/dist/{lib/ast → ast}/transform/utils.js +1 -1
  32. package/dist/{lib/ast → ast}/types.js +1 -1
  33. package/dist/{lib/ast → ast}/walk.js +1 -1
  34. package/dist/data/properties.json.js +1 -1
  35. package/dist/data/validation.json.js +26 -20
  36. package/dist/{lib/fs → fs}/resolve.js +1 -1
  37. package/dist/index-umd-web.js +2770 -128
  38. package/dist/index.d.ts +21 -4
  39. package/dist/node.js +21 -21
  40. package/dist/{lib/parser → parser}/declaration/list.js +1 -1
  41. package/dist/{lib/parser → parser}/declaration/map.js +1 -1
  42. package/dist/{lib/parser → parser}/declaration/set.js +1 -1
  43. package/dist/{lib/parser → parser}/input.js +1 -1
  44. package/dist/{lib/parser → parser}/linesmap.js +1 -1
  45. package/dist/{lib/parser → parser}/parse.js +20 -21
  46. package/dist/{lib/parser → parser}/source.js +2 -2
  47. package/dist/{lib/parser → parser}/tokenize.js +1 -1
  48. package/dist/{lib/parser → parser}/utils/angle.js +1 -1
  49. package/dist/{lib/parser → parser}/utils/at-rule-container.js +1 -1
  50. package/dist/{lib/parser → parser}/utils/at-rule-font-feature-values.js +1 -1
  51. package/dist/{lib/parser → parser}/utils/at-rule-generic.js +1 -1
  52. package/dist/{lib/parser → parser}/utils/at-rule-import.js +1 -1
  53. package/dist/{lib/parser → parser}/utils/at-rule-media.js +1 -1
  54. package/dist/{lib/parser → parser}/utils/at-rule-support.js +1 -1
  55. package/dist/{lib/parser → parser}/utils/at-rule-when-else.js +1 -1
  56. package/dist/{lib/parser → parser}/utils/at-rule.js +1 -1
  57. package/dist/{lib/parser → parser}/utils/base64.js +1 -1
  58. package/dist/{lib/parser → parser}/utils/cache.js +1 -1
  59. package/dist/{lib/parser → parser}/utils/canonical.js +1 -1
  60. package/dist/{lib/parser → parser}/utils/codes.js +1 -1
  61. package/dist/{lib/parser → parser}/utils/config.js +2 -2
  62. package/dist/{lib/parser → parser}/utils/declaration.js +1 -1
  63. package/dist/{lib/parser → parser}/utils/eq.js +1 -1
  64. package/dist/{lib/parser → parser}/utils/hash.js +1 -1
  65. package/dist/{lib/parser → parser}/utils/selector.js +38 -28
  66. package/dist/{lib/parser → parser}/utils/text.js +1 -1
  67. package/dist/{lib/parser → parser}/utils/token.js +1 -1
  68. package/dist/{lib/parser → parser}/utils/type.js +1 -1
  69. package/dist/{lib/printer/sourcemap → printer}/lib/codec.js +1 -1
  70. package/dist/{lib/printer → printer}/render.js +184 -23
  71. package/dist/{lib/printer → printer}/result.js +16 -3
  72. package/dist/{lib/printer/sourcemap → printer}/sourcemap.js +3 -2
  73. package/dist/{lib/printer → printer}/writer.js +1 -1
  74. package/dist/{lib/syntax → syntax}/color/a98rgb.js +1 -1
  75. package/dist/{lib/syntax → syntax}/color/alpha.js +1 -1
  76. package/dist/{lib/syntax → syntax}/color/cmyk.js +1 -1
  77. package/dist/{lib/syntax → syntax}/color/color-mix.js +1 -1
  78. package/dist/{lib/syntax → syntax}/color/color.js +1 -1
  79. package/dist/{lib/syntax → syntax}/color/hex.js +1 -1
  80. package/dist/{lib/syntax → syntax}/color/hsl.js +1 -1
  81. package/dist/{lib/syntax → syntax}/color/hwb.js +1 -1
  82. package/dist/{lib/syntax → syntax}/color/lab.js +1 -1
  83. package/dist/{lib/syntax → syntax}/color/lch.js +1 -1
  84. package/dist/{lib/syntax → syntax}/color/oklab.js +1 -1
  85. package/dist/{lib/syntax → syntax}/color/oklch.js +1 -1
  86. package/dist/{lib/syntax → syntax}/color/p3.js +1 -1
  87. package/dist/{lib/syntax → syntax}/color/prophotorgb.js +1 -1
  88. package/dist/{lib/syntax → syntax}/color/rec2020.js +1 -1
  89. package/dist/{lib/syntax → syntax}/color/relative-color.js +1 -1
  90. package/dist/{lib/syntax → syntax}/color/rgb.js +1 -1
  91. package/dist/{lib/syntax → syntax}/color/srgb.js +1 -1
  92. package/dist/{lib/syntax → syntax}/color/utils/color-type.js +1 -1
  93. package/dist/{lib/syntax → syntax}/color/utils/colorspace.js +1 -1
  94. package/dist/{lib/syntax → syntax}/color/utils/components.js +1 -1
  95. package/dist/{lib/syntax → syntax}/color/utils/distance.js +1 -1
  96. package/dist/{lib/syntax → syntax}/color/utils/make-color.js +1 -1
  97. package/dist/{lib/syntax → syntax}/color/utils/matrix.js +1 -1
  98. package/dist/{lib/syntax → syntax}/color/xyz.js +1 -1
  99. package/dist/{lib/syntax → syntax}/color/xyzd50.js +1 -1
  100. package/dist/{lib/syntax → syntax}/constants.js +2 -2
  101. package/dist/{lib/syntax → syntax}/syntax.js +1 -1
  102. package/dist/types.js +1 -1
  103. package/dist/utils/sync.js +3 -3
  104. package/dist/validation/compiled/builtins.js +32 -0
  105. package/dist/validation/compiled/runtime.js +705 -0
  106. package/dist/validation/compiled/syntaxes.js +1620 -0
  107. package/dist/{lib/validation → validation}/config.js +41 -7
  108. package/dist/{lib/validation → validation}/first.js +6 -3
  109. package/dist/{lib/validation → validation}/match.js +87 -14
  110. package/dist/{lib/validation → validation}/parser/parse.js +1 -1
  111. package/dist/{lib/validation → validation}/parser/typedef.js +1 -1
  112. package/dist/{lib/validation → validation}/utils/list.js +1 -1
  113. package/dist/version.js +2 -2
  114. package/dist/web.js +23 -23
  115. package/package.json +4 -2
  116. package/dist/types.d.ts +0 -21
  117. package/dist/utils/sync.d.ts +0 -16
  118. package/dist/version.d.ts +0 -4
@@ -2,13 +2,13 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
8
  import { getAngle, convertColor } from '../syntax/color/color.js';
9
9
  import { reduceHexValue } from '../syntax/color/hex.js';
10
10
  import { EnumToken, ColorType, EnumAstNodeStatus } from '../ast/types.js';
11
- import { SourceMap } from './sourcemap/sourcemap.js';
11
+ import { SourceMap } from './sourcemap.js';
12
12
  import { pseudoElements, anglePrecision, urlTokenMatcher, isFunctionType } from '../syntax/constants.js';
13
13
  import { minifyNumber, toPrecisionAngle, toPrecisionValue, reducegradientBackgroundPosition, reduceConicColorStops, reduceColorStops, parseColor, isWhiteSpace } from '../syntax/syntax.js';
14
14
  import { equalsIgnoreCase } from '../parser/utils/text.js';
@@ -228,6 +228,10 @@ function resolveRenderOptions(options) {
228
228
  *
229
229
  * @internal
230
230
  */
231
+ /**
232
+ * `CSS_PARSER_CHECK_SIZE`: the computed sizes are checked against the rendered sizes (tests)
233
+ */
234
+ const checkSize = globalThis.process?.env?.CSS_PARSER_CHECK_SIZE != null;
231
235
  class NodeRenderer {
232
236
  /**
233
237
  * An instance is kept alive: the hidden class of the instances would otherwise be collected by a full garbage
@@ -303,11 +307,17 @@ class NodeRenderer {
303
307
  if (!this.direct) {
304
308
  return RenderResult.codeLength(doRender(arena, node, this.options, null, this.cache.memo));
305
309
  }
306
- // the output is not kept: the buffer is reused
307
- const writer = this.writer;
308
- writer.reset();
309
- renderAstNode(arena, node, this.resolved, null, this.location, null, this.errors, this.reducer, this.cache, writer, 0, this.indents);
310
- return writer.codeLength;
310
+ // the size is computed from the sizes of the parts: the node is not rendered
311
+ const size = nodeSize(arena, node, this.resolved, this.reducer, this.cache, 0) >> 1;
312
+ if (checkSize) {
313
+ const writer = this.writer;
314
+ writer.reset();
315
+ renderAstNode(arena, node, this.resolved, null, this.location, null, this.errors, this.reducer, this.cache, writer, 0, this.indents);
316
+ if (size !== writer.codeLength) {
317
+ throw new Error(`computed size of node ${node} (${size}) differs from its rendered size (${writer.codeLength})`);
318
+ }
319
+ }
320
+ return size;
311
321
  }
312
322
  }
313
323
  /**
@@ -943,15 +953,38 @@ function renderDeclaration(arena, node, options, cache, reducer) {
943
953
  return rendered;
944
954
  }
945
955
  /**
946
- * write a declaration of a block: `name:value`, without the semicolon. identical declarations (same name, same value
947
- * tokens) are rendered and encoded once per render: the bytes written first are copied
956
+ * the rendered value of a declaration (without the name): rendered once per structure, see {@link RenderMemo}
948
957
  * @param arena
949
958
  * @param node declaration
950
959
  * @param options
951
960
  * @param cache
952
961
  * @param reducer
953
- * @param writer
962
+ * @param slot the memo slot of the declaration when it has been looked up, -1 otherwise
954
963
  */
964
+ function declarationValue(arena, node, options, cache, reducer, slot = -1) {
965
+ const memo = getRenderMemo(cache, options);
966
+ if (memo !== null) {
967
+ if (slot === -1) {
968
+ // the name is part of the key
969
+ slot = memo.declarations.list(arena, arena.firstToken[node], arena.name[node]);
970
+ }
971
+ const value = memo.values[slot];
972
+ if (value !== undefined) {
973
+ return value;
974
+ }
975
+ }
976
+ if (options.minifyValues && isUnminifiedDeclaration(arena, node)) {
977
+ // override options to avoid minifying values for custom properties
978
+ options = { ...options, minifyValues: false };
979
+ // override the reducer
980
+ reducer = createReducer(arena, options, cache);
981
+ }
982
+ const value = renderDeclarationValue(arena, node, options.minifyValues, reducer).trimEnd();
983
+ if (memo !== null) {
984
+ memo.values[slot] = value;
985
+ }
986
+ return value;
987
+ }
955
988
  function writeDeclaration(arena, node, options, cache, reducer, writer) {
956
989
  const memo = getRenderMemo(cache, options);
957
990
  let slot = -1;
@@ -968,19 +1001,7 @@ function writeDeclaration(arena, node, options, cache, reducer, writer) {
968
1001
  const start = writer.length;
969
1002
  const extra = writer.extra;
970
1003
  // the rendered value of an identical declaration, rendered to another buffer (see NodeRenderer)
971
- let value = memo === null ? undefined : memo.values[slot];
972
- if (value === undefined) {
973
- if (options.minifyValues && isUnminifiedDeclaration(arena, node)) {
974
- // override options to avoid minifying values for custom properties
975
- options = { ...options, minifyValues: false };
976
- // override the reducer
977
- reducer = createReducer(arena, options, cache);
978
- }
979
- value = renderDeclarationValue(arena, node, options.minifyValues, reducer).trimEnd();
980
- if (memo !== null) {
981
- memo.values[slot] = value;
982
- }
983
- }
1004
+ const value = declarationValue(arena, node, options, cache, reducer, slot);
984
1005
  // the parts are written directly: `name`, `:`, `indent`, `value`. the name is copied from the string table
985
1006
  writeString(arena, arena.name[node], writer);
986
1007
  writer.writeByte(0x3a);
@@ -992,6 +1013,146 @@ function writeDeclaration(arena, node, options, cache, reducer, writer) {
992
1013
  memo.locate(slot, writer, start, extra);
993
1014
  }
994
1015
  }
1016
+ /**
1017
+ * the size of a rendered node, computed without rendering it: the declarations are measured from their rendered values
1018
+ * (rendered once per structure, see {@link declarationValue}), the layout follows {@link renderAstNode} (no source
1019
+ * map). the result is `size * 2 + 1` when the output ends with a semicolon, `size * 2` otherwise (0 when the node
1020
+ * renders nothing): no object is allocated
1021
+ * @param arena
1022
+ * @param data
1023
+ * @param options
1024
+ * @param reducer
1025
+ * @param cache
1026
+ * @param level
1027
+ */
1028
+ function nodeSize(arena, data, options, reducer, cache, level) {
1029
+ const optIndent = options.indent;
1030
+ const newLine = options.newLine;
1031
+ const indentLength = optIndent.length * level;
1032
+ const typ = arena.dataTypes[data];
1033
+ switch (typ) {
1034
+ case EnumToken.DeclarationNodeType: {
1035
+ const value = declarationValue(arena, data, options, cache, reducer);
1036
+ return ((arena.stringLength(arena.name[data]) + 1 + optIndent.length + value.length) * 2 +
1037
+ (value.endsWith(";") ? 1 : 0));
1038
+ }
1039
+ case EnumToken.CommentNodeType:
1040
+ case EnumToken.CDOCOMMNodeType: {
1041
+ const id = arena.stringValue[data];
1042
+ if (arena.stringStartsWith(id, "/*# sourceMappingURL=")) {
1043
+ return 0;
1044
+ }
1045
+ if (!options.removeComments || (options.preserveLicense && arena.stringStartsWith(id, "/*!"))) {
1046
+ const length = arena.stringLength(id);
1047
+ return length * 2 + (length > 0 && arena.stringCodeAt(id, length - 1) === 0x3b ? 1 : 0);
1048
+ }
1049
+ return 0;
1050
+ }
1051
+ case EnumToken.StyleSheetNodeType: {
1052
+ let size = 0;
1053
+ let empty = true;
1054
+ let last = 0;
1055
+ for (let node = arena.firstChild[data]; node !== 0; node = arena.nextSibling[node]) {
1056
+ const child = nodeSize(arena, node, options, reducer, cache, level);
1057
+ if (child >= 2) {
1058
+ if (!empty) {
1059
+ size += newLine.length;
1060
+ }
1061
+ size += child >> 1;
1062
+ empty = false;
1063
+ last = child & 1;
1064
+ }
1065
+ }
1066
+ return size * 2 + last;
1067
+ }
1068
+ case EnumToken.AtRuleNodeType:
1069
+ case EnumToken.RuleNodeType:
1070
+ case EnumToken.KeyframesRuleNodeType:
1071
+ case EnumToken.KeyframesAtRuleNodeType: {
1072
+ const isAtRule = typ === EnumToken.AtRuleNodeType || typ === EnumToken.KeyframesAtRuleNodeType;
1073
+ const nameId = arena.name[data];
1074
+ const valueId = arena.stringValue[data];
1075
+ let size = 0;
1076
+ if (indentLength > 0 && newLine !== "") {
1077
+ size += newLine.length;
1078
+ }
1079
+ size += indentLength;
1080
+ if (isAtRule) {
1081
+ size += 1 + arena.stringLength(nameId);
1082
+ if (arena.stringLength(valueId) > 0) {
1083
+ size += (optIndent || " ").length + arena.stringLength(valueId);
1084
+ }
1085
+ if (!(arena.flags[data] & EnumAstNodeStatus.HasChildren)) {
1086
+ return (size + 1) * 2 + 1;
1087
+ }
1088
+ }
1089
+ else {
1090
+ size += arena.stringLength(nameId);
1091
+ }
1092
+ size += optIndent.length + 1;
1093
+ const indentSubLength = optIndent.length * (level + 1);
1094
+ let body = 0;
1095
+ let semicolon = false;
1096
+ for (let node = arena.firstChild[data]; node !== 0; node = arena.nextSibling[node]) {
1097
+ const nodeType = arena.dataTypes[node];
1098
+ if (nodeType === EnumToken.DeclarationNodeType) {
1099
+ body +=
1100
+ (semicolon ? 1 : 0) +
1101
+ newLine.length +
1102
+ indentSubLength +
1103
+ (nodeSize(arena, node, options, reducer, cache, level + 1) >> 1);
1104
+ semicolon = true;
1105
+ }
1106
+ else if (nodeType === EnumToken.CommentNodeType) {
1107
+ const commentId = arena.stringValue[node];
1108
+ if (options.removeComments && (!options.preserveLicense || !arena.stringStartsWith(commentId, "/*!"))) {
1109
+ continue;
1110
+ }
1111
+ const length = arena.stringLength(commentId);
1112
+ if (length > 0) {
1113
+ body += (semicolon ? 1 : 0) + newLine.length + indentSubLength + length;
1114
+ // a trailing semicolon is removed: it is written before the next node
1115
+ semicolon = arena.stringCodeAt(commentId, length - 1) === 0x3b;
1116
+ if (semicolon) {
1117
+ body--;
1118
+ }
1119
+ }
1120
+ }
1121
+ else {
1122
+ const child = nodeSize(arena, node, options, reducer, cache, level + 1);
1123
+ if (child >= 2) {
1124
+ body += (semicolon ? 1 : 0) + (child >> 1);
1125
+ switch (nodeType) {
1126
+ case EnumToken.AtRuleNodeType:
1127
+ case EnumToken.KeyframesAtRuleNodeType:
1128
+ semicolon = !(arena.flags[node] & EnumAstNodeStatus.HasChildren);
1129
+ break;
1130
+ case EnumToken.RuleNodeType:
1131
+ case EnumToken.KeyframesRuleNodeType:
1132
+ semicolon = false;
1133
+ break;
1134
+ default:
1135
+ semicolon = (child & 1) === 1;
1136
+ }
1137
+ if (semicolon) {
1138
+ body--;
1139
+ }
1140
+ }
1141
+ }
1142
+ }
1143
+ if (options.removeEmpty &&
1144
+ body === 0 &&
1145
+ !(typ === EnumToken.AtRuleNodeType &&
1146
+ (arena.stringEquals(nameId, "apply") ||
1147
+ arena.stringEquals(nameId, "mixin") ||
1148
+ arena.stringEquals(nameId, "function")))) {
1149
+ return 0;
1150
+ }
1151
+ return (size + body + newLine.length + indentLength + 1) * 2;
1152
+ }
1153
+ }
1154
+ return 0;
1155
+ }
995
1156
  /**
996
1157
  * render the value tokens of a declaration with the reducer. with minifyValues, the whitespace that is not needed is
997
1158
  * skipped like {@link filterValues} does, without copying the tokens into an array: the whitespace before
@@ -2,7 +2,7 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
8
  /**
@@ -37,7 +37,16 @@ class RenderResult {
37
37
  */
38
38
  static shape = new RenderResult(new Uint8Array(0), [], { total: "0ms" });
39
39
  /**
40
- * Rendered CSS, encoded as UTF-8
40
+ * Rendered CSS, encoded as UTF-8: the output of the render, no conversion. Use it to write the css to a file or to
41
+ * the network, or to send it to another thread without a copy:
42
+ *
43
+ * ```ts
44
+ * self.postMessage(result.write, [result.write.buffer]);
45
+ * ```
46
+ *
47
+ * It is a view of the first bytes of a larger buffer (`write.buffer`): without a transfer, `postMessage()` copies
48
+ * the whole buffer, send `write.slice()` to copy only the css. See
49
+ * [Zero copy between threads](../../files/usage.md#zero-copy-between-threads).
41
50
  */
42
51
  write;
43
52
  /**
@@ -84,7 +93,11 @@ class RenderResult {
84
93
  return result.#codeLength >= 0 ? result.#codeLength : result.code.length;
85
94
  }
86
95
  /**
87
- * Rendered CSS. The bytes of {@link RenderResult.write} are decoded the first time the property is read
96
+ * Rendered CSS. The bytes of {@link RenderResult.write} are decoded the first time the property is read, the
97
+ * string is kept for the next reads: no string is created when it is not read.
98
+ *
99
+ * It is a getter, not a property of the object: `postMessage()` and `structuredClone()` do not send it, and it is
100
+ * an empty string when it is read for the first time after {@link RenderResult.write} was transferred.
88
101
  */
89
102
  get code() {
90
103
  if (this.#code === null) {
@@ -2,10 +2,10 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
- import { toBase64 } from '../../parser/utils/base64.js';
8
+ import { toBase64 } from '../parser/utils/base64.js';
9
9
  import { decode, encode } from './lib/codec.js';
10
10
 
11
11
  /**
@@ -116,6 +116,7 @@ class SourceMap {
116
116
  this.sourcesContent = sourcemaps.sourcesContent?.slice() ?? [];
117
117
  const decodedMappings = sourcemaps.mappings
118
118
  .split(";")
119
+ // @ts-ignore
119
120
  .map((mapping) => mapping.split(",").map((mapping) => decode(mapping)));
120
121
  this.line = decodedMappings.length - 1;
121
122
  for (let index = 0; index < decodedMappings.length; index++) {
@@ -2,7 +2,7 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
8
  /**
@@ -2,7 +2,7 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
8
  import { xyz2srgb } from './srgb.js';
@@ -2,7 +2,7 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
8
  import { ColorType, EnumToken } from '../../ast/types.js';
@@ -2,7 +2,7 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
8
  import { EnumToken, ColorType } from '../../ast/types.js';
@@ -2,7 +2,7 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
8
  import { EnumToken, ColorType, EnumAstNodeStatus } from '../../ast/types.js';
@@ -2,7 +2,7 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
8
  import { ColorType, EnumToken } from '../../ast/types.js';
@@ -2,7 +2,7 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
8
  import { EnumToken, ColorType } from '../../ast/types.js';
@@ -2,7 +2,7 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
8
  import { color2srgbvalues, getNumber } from './color.js';
@@ -2,7 +2,7 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
8
  import { getColorComponents } from './utils/components.js';
@@ -2,7 +2,7 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
8
  import { e, k, D50 } from '../constants.js';
@@ -2,7 +2,7 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
8
  import { getColorComponents } from './utils/components.js';
@@ -2,7 +2,7 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
8
  import { getColorComponents } from './utils/components.js';
@@ -2,7 +2,7 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
8
  import { getColorComponents } from './utils/components.js';
@@ -2,7 +2,7 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
8
  import { lsrgb2srgbvalues, xyz2srgb, srgb2lsrgbvalues } from './srgb.js';
@@ -2,7 +2,7 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
8
  import { XYZ_D65_to_D50, xyzd502srgb } from './xyzd50.js';
@@ -2,7 +2,7 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
8
  import { xyz2srgb } from './srgb.js';
@@ -2,7 +2,7 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
8
  import { convertColor, getNumber } from './color.js';
@@ -2,7 +2,7 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
8
  import { color2srgbvalues, minmax } from './color.js';
@@ -2,7 +2,7 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
8
  import { getColorComponents } from './utils/components.js';
@@ -2,7 +2,7 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
8
  import { ColorType } from '../../../ast/types.js';
@@ -2,7 +2,7 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
8
  import { equalsIgnoreCase } from '../../../parser/utils/text.js';
@@ -2,7 +2,7 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
8
  import { ColorType, EnumToken } from '../../../ast/types.js';
@@ -2,7 +2,7 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
8
  import { convertColor } from '../color.js';
@@ -2,7 +2,7 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
8
  import { EnumToken, ColorType } from '../../../ast/types.js';
@@ -2,7 +2,7 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
8
  // from https://www.w3.org/TR/css-color-4/multiply-matrices.js
@@ -2,7 +2,7 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
8
  import { multiplyMatrices } from './utils/matrix.js';
@@ -2,7 +2,7 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
8
  import { lsrgb2srgbvalues } from './srgb.js';
@@ -2,11 +2,11 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
8
  import { EnumToken } from '../ast/types.js';
9
- import config from '../../data/validation.json.js';
9
+ import config from '../data/validation.json.js';
10
10
 
11
11
  /**
12
12
  * Used by the validation parser
@@ -2,7 +2,7 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
8
  import { TokenField } from '../ast/arena.js';
package/dist/types.js CHANGED
@@ -2,7 +2,7 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
8
  /**
@@ -2,11 +2,11 @@
2
2
  CSS parser, minifier and validator for node, deno, bun and the browser
3
3
 
4
4
  Author(s): Thierry Bela
5
- Version: 2.2.0
5
+ Version: 2.3.1
6
6
  License: MIT
7
7
  */
8
- import { EnumToken } from '../lib/ast/types.js';
9
- import { dirname } from '../lib/fs/resolve.js';
8
+ import { EnumToken } from '../ast/types.js';
9
+ import { dirname } from '../fs/resolve.js';
10
10
  import { ResponseType } from '../types.js';
11
11
 
12
12
  /**