@tbela99/css-parser 1.6.4 → 1.6.5

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/index.d.ts CHANGED
@@ -5217,6 +5217,12 @@ interface MinifyOptions {
5217
5217
  * Enable minification
5218
5218
  */
5219
5219
  minify?: boolean;
5220
+
5221
+ /**
5222
+ * enable ast minification
5223
+ */
5224
+ minifyAST?: boolean;
5225
+
5220
5226
  /**
5221
5227
  * Parse color tokens
5222
5228
  */
@@ -5294,7 +5300,8 @@ export declare type LoadResult =
5294
5300
  | Promise<ReadableStream<Uint8Array>>
5295
5301
  | ReadableStream<Uint8Array>
5296
5302
  | string
5297
- | Promise<string> | object;
5303
+ | Promise<string>
5304
+ | object;
5298
5305
 
5299
5306
  /**
5300
5307
  * CSS module parser options
@@ -5792,9 +5799,15 @@ export declare interface RenderOptions {
5792
5799
  src?: string;
5793
5800
 
5794
5801
  /**
5795
- * Minify css values.
5802
+ * strip comments and whitespace.
5796
5803
  */
5797
5804
  minify?: boolean;
5805
+
5806
+ /**
5807
+ * Minify values
5808
+ */
5809
+ minifyValues?: boolean;
5810
+
5798
5811
  /**
5799
5812
  * Pretty print css
5800
5813
  *
@@ -8,7 +8,7 @@ import { replaceNodeOrValue } from '../../parser/utils/token.js';
8
8
  class ComputeCalcExpressionFeature {
9
9
  accept = new Set([EnumToken.RuleNodeType, EnumToken.AtRuleNodeType]);
10
10
  get ordering() {
11
- return 1;
11
+ return 3;
12
12
  }
13
13
  get processMode() {
14
14
  return FeatureWalkMode.Post;
@@ -33,8 +33,20 @@ class ComputeCalcExpressionFeature {
33
33
  continue;
34
34
  }
35
35
  if (value.typ == EnumToken.BinaryExpressionTokenType) {
36
- // @ts-ignore
37
- replaceNodeOrValue(parent, value, evaluate([value]));
36
+ const result = evaluate([value]);
37
+ try {
38
+ // @ts-ignore
39
+ replaceNodeOrValue(parent, value, result);
40
+ }
41
+ catch (e) {
42
+ // @ts-ignore
43
+ if (Array.isArray(parent.chi)) {
44
+ // @ts-ignore
45
+ parent.chi.length = 0;
46
+ // @ts-ignore
47
+ parent.chi.push(...result);
48
+ }
49
+ }
38
50
  continue;
39
51
  }
40
52
  if (value != null && tokensfuncSet.has(value.typ)) {
@@ -52,7 +64,7 @@ class ComputeCalcExpressionFeature {
52
64
  ? value.val
53
65
  : value.chi;
54
66
  const values = evaluate(cp);
55
- // fix a + -b to a - b
67
+ // fix a + -b into a - b
56
68
  for (const { value, parent: p } of walkValues(values)) {
57
69
  if (value.typ === EnumToken.BinaryExpressionTokenType) {
58
70
  if (value.op === EnumToken.Add &&
@@ -174,7 +174,7 @@ function processNode(declarationNode, cache) {
174
174
  class ExpandIfFeature {
175
175
  accept = new Set([EnumToken.DeclarationNodeType]);
176
176
  get ordering() {
177
- return 4;
177
+ return 1;
178
178
  }
179
179
  get processMode() {
180
180
  return FeatureWalkMode.Pre;
@@ -57,10 +57,10 @@ function replace(node, variableScope) {
57
57
  class InlineCssVariablesFeature {
58
58
  accept = new Set([EnumToken.RuleNodeType, EnumToken.AtRuleNodeType]);
59
59
  get ordering() {
60
- return 0;
60
+ return 2;
61
61
  }
62
62
  get processMode() {
63
- return FeatureWalkMode.Pre;
63
+ return FeatureWalkMode.Post;
64
64
  }
65
65
  static register(options) {
66
66
  if (options.inlineCssVariables) {
@@ -109,7 +109,7 @@ function replaceAstNodes(tokens, root) {
109
109
  }
110
110
  class ComputePrefixFeature {
111
111
  get ordering() {
112
- return 2;
112
+ return 0;
113
113
  }
114
114
  get processMode() {
115
115
  return FeatureWalkMode.Pre;
@@ -9,7 +9,7 @@ class ComputeShorthandFeature {
9
9
  EnumToken.KeyframesRuleNodeType,
10
10
  ]);
11
11
  get ordering() {
12
- return 10;
12
+ return 5;
13
13
  }
14
14
  get processMode() {
15
15
  return FeatureWalkMode.Post;
@@ -28,7 +28,6 @@ class ComputeShorthandFeature {
28
28
  const j = ast.chi.length;
29
29
  let k = 0;
30
30
  let l;
31
- // let properties: PropertyList = new PropertyList(options);
32
31
  const rules = [];
33
32
  const declarations = [];
34
33
  // @ts-ignore
@@ -49,7 +48,6 @@ class ComputeShorthandFeature {
49
48
  if (node.typ == EnumToken.DeclarationNodeType) {
50
49
  for (let m = k; m <= l; m++) {
51
50
  declarations.push(ast.chi[m]);
52
- // properties.add(ast.chi![m]);
53
51
  }
54
52
  }
55
53
  else {
@@ -59,7 +57,6 @@ class ComputeShorthandFeature {
59
57
  }
60
58
  k = l;
61
59
  }
62
- // console.error([...new PropertyList(options).add(declarations)]);
63
60
  if (declarations.length > 0) {
64
61
  ast.chi.length = 0;
65
62
  // @ts-expect-error
@@ -12,7 +12,7 @@ class TransformCssFeature {
12
12
  EnumToken.KeyframesRuleNodeType,
13
13
  ]);
14
14
  get ordering() {
15
- return 3;
15
+ return 4;
16
16
  }
17
17
  get processMode() {
18
18
  return FeatureWalkMode.Post;
@@ -1,5 +1,5 @@
1
1
  import { equalsIgnoreCase } from '../../parser/utils/text.js';
2
- import { mathFuncs, LOCEND, LOCSTA, LOCSRCID } from '../../syntax/constants.js';
2
+ import { mathFuncs, PARENT, LOCEND, LOCSTA, LOCSRCID } from '../../syntax/constants.js';
3
3
  import { EnumToken } from '../types.js';
4
4
  import { rem, compute } from './math.js';
5
5
 
@@ -64,6 +64,7 @@ function evaluate(tokens) {
64
64
  [LOCSRCID]: nodes[0][LOCSRCID],
65
65
  [LOCSTA]: nodes[0][LOCSTA],
66
66
  [LOCEND]: nodes[0][LOCEND],
67
+ [PARENT]: nodes[0][PARENT],
67
68
  },
68
69
  ];
69
70
  }
@@ -86,6 +87,7 @@ function evaluate(tokens) {
86
87
  [LOCSRCID]: nodes[i][LOCSRCID],
87
88
  [LOCSTA]: nodes[i][LOCSTA],
88
89
  [LOCEND]: nodes[i + 1][LOCEND],
90
+ [PARENT]: nodes[i + 1][PARENT],
89
91
  };
90
92
  }
91
93
  else {
@@ -95,6 +97,7 @@ function evaluate(tokens) {
95
97
  [LOCSRCID]: nodes[i + 1][LOCSRCID],
96
98
  [LOCSTA]: nodes[i + 1][LOCSTA],
97
99
  [LOCEND]: nodes[i + 1][LOCEND],
100
+ [PARENT]: nodes[i + 1][PARENT],
98
101
  }, EnumToken.Mul);
99
102
  }
100
103
  i++;
@@ -115,12 +118,14 @@ function evaluate(tokens) {
115
118
  [LOCSRCID]: token[LOCSRCID],
116
119
  [LOCSTA]: token[LOCSTA],
117
120
  [LOCEND]: token[LOCEND],
121
+ [PARENT]: token[PARENT],
118
122
  }, {
119
123
  ...token,
120
124
  val: -token.val,
121
125
  [LOCSRCID]: token[LOCSRCID],
122
126
  [LOCSTA]: token[LOCSTA],
123
127
  [LOCEND]: token[LOCEND],
128
+ [PARENT]: token[PARENT],
124
129
  });
125
130
  return acc;
126
131
  }
@@ -131,6 +136,7 @@ function evaluate(tokens) {
131
136
  [LOCSRCID]: token[LOCSRCID],
132
137
  [LOCSTA]: token[LOCSTA],
133
138
  [LOCEND]: token[LOCEND],
139
+ [PARENT]: token[PARENT],
134
140
  });
135
141
  }
136
142
  acc.push(token);
@@ -152,6 +158,7 @@ function doEvaluate(l, r, op) {
152
158
  [LOCSRCID]: l[LOCSRCID],
153
159
  [LOCSTA]: l[LOCSTA],
154
160
  [LOCEND]: r?.[LOCEND] ?? l[LOCEND],
161
+ [PARENT]: l[PARENT],
155
162
  };
156
163
  if (!isScalarToken(l) || !isScalarToken(r) || (l.typ == r.typ && "unit" in l && "unit" in r && l.unit != r.unit)) {
157
164
  return defaultReturn;
@@ -224,6 +231,7 @@ function doEvaluate(l, r, op) {
224
231
  [LOCSRCID]: l[LOCSRCID],
225
232
  [LOCSTA]: l[LOCSTA],
226
233
  [LOCEND]: l[LOCEND],
234
+ [PARENT]: l[PARENT],
227
235
  },
228
236
  r: {
229
237
  typ: EnumToken.NumberTokenType,
@@ -231,6 +239,7 @@ function doEvaluate(l, r, op) {
231
239
  [LOCSRCID]: r[LOCSRCID],
232
240
  [LOCSTA]: r[LOCSTA],
233
241
  [LOCEND]: r[LOCEND],
242
+ [PARENT]: r[PARENT],
234
243
  },
235
244
  };
236
245
  }
@@ -243,6 +252,7 @@ function doEvaluate(l, r, op) {
243
252
  [LOCSRCID]: l[LOCSRCID],
244
253
  [LOCSTA]: l[LOCSTA],
245
254
  [LOCEND]: l[LOCEND],
255
+ [PARENT]: l[PARENT],
246
256
  },
247
257
  r: {
248
258
  typ: EnumToken.NumberTokenType,
@@ -250,6 +260,7 @@ function doEvaluate(l, r, op) {
250
260
  [LOCSRCID]: r[LOCSRCID],
251
261
  [LOCSTA]: r[LOCSTA],
252
262
  [LOCEND]: r[LOCEND],
263
+ [PARENT]: r[PARENT],
253
264
  },
254
265
  };
255
266
  }
@@ -276,6 +287,7 @@ function doEvaluate(l, r, op) {
276
287
  [LOCSRCID]: l[LOCSRCID],
277
288
  [LOCSTA]: l[LOCSTA],
278
289
  [LOCEND]: r?.[LOCEND] ?? l[LOCEND],
290
+ [PARENT]: l[PARENT],
279
291
  };
280
292
  if (token.typ == EnumToken.IdenTokenType) {
281
293
  // @ts-ignore
@@ -456,6 +468,7 @@ function evaluateFunc(token) {
456
468
  [LOCSRCID]: value[0][LOCSRCID],
457
469
  [LOCSTA]: value[0][LOCSTA],
458
470
  [LOCEND]: value[0][LOCEND],
471
+ [PARENT]: value[0][PARENT],
459
472
  }
460
473
  : {
461
474
  typ: token.val == "sign" ? EnumToken.NumberTokenType : value[0].typ,
@@ -463,6 +476,7 @@ function evaluateFunc(token) {
463
476
  [LOCSRCID]: value[0][LOCSRCID],
464
477
  [LOCSTA]: value[0][LOCSTA],
465
478
  [LOCEND]: value[0][LOCEND],
479
+ [PARENT]: value[0][PARENT],
466
480
  },
467
481
  ];
468
482
  }
@@ -485,6 +499,7 @@ function evaluateFunc(token) {
485
499
  [LOCSRCID]: token[LOCSRCID],
486
500
  [LOCSTA]: token[LOCSTA],
487
501
  [LOCEND]: token[LOCEND],
502
+ [PARENT]: token[PARENT],
488
503
  },
489
504
  ];
490
505
  }
@@ -558,6 +573,7 @@ function evaluateFunc(token) {
558
573
  [LOCSRCID]: token[LOCSRCID],
559
574
  [LOCSTA]: token[LOCSTA],
560
575
  [LOCEND]: token[LOCEND],
576
+ [PARENT]: token[PARENT],
561
577
  },
562
578
  ];
563
579
  }
@@ -572,6 +588,7 @@ function evaluateFunc(token) {
572
588
  [LOCSRCID]: token[LOCSRCID],
573
589
  [LOCSTA]: token[LOCSTA],
574
590
  [LOCEND]: token[LOCEND],
591
+ [PARENT]: token[PARENT],
575
592
  },
576
593
  ];
577
594
  }
@@ -582,6 +599,7 @@ function evaluateFunc(token) {
582
599
  [LOCSRCID]: token[LOCSRCID],
583
600
  [LOCSTA]: token[LOCSTA],
584
601
  [LOCEND]: token[LOCEND],
602
+ [PARENT]: token[PARENT],
585
603
  },
586
604
  ];
587
605
  }
@@ -621,6 +639,7 @@ function evaluateFunc(token) {
621
639
  [LOCSRCID]: token[LOCSRCID],
622
640
  [LOCSTA]: token[LOCSTA],
623
641
  [LOCEND]: token[LOCEND],
642
+ [PARENT]: token[PARENT],
624
643
  },
625
644
  ];
626
645
  }
@@ -663,6 +682,7 @@ function evaluateFunc(token) {
663
682
  [LOCSRCID]: token[LOCSRCID],
664
683
  [LOCSTA]: token[LOCSTA],
665
684
  [LOCEND]: token[LOCEND],
685
+ [PARENT]: token[PARENT],
666
686
  },
667
687
  ];
668
688
  }
@@ -690,6 +710,7 @@ function inlineExpression(token) {
690
710
  [LOCSRCID]: token[LOCSRCID],
691
711
  [LOCSTA]: token[LOCSTA],
692
712
  [LOCEND]: token[LOCEND],
713
+ [PARENT]: token[PARENT],
693
714
  });
694
715
  for (const child of inlineExpression(token.r)) {
695
716
  result.push(child);
@@ -769,6 +790,7 @@ function factorToken(token) {
769
790
  [LOCSRCID]: token[LOCSRCID],
770
791
  [LOCSTA]: token[LOCSTA],
771
792
  [LOCEND]: token[LOCEND],
793
+ [PARENT]: token[PARENT],
772
794
  };
773
795
  // @ts-ignore
774
796
  delete token.val;
@@ -810,6 +832,7 @@ function factor(tokens, ops) {
810
832
  [LOCSRCID]: tokens[i - 1][LOCSRCID],
811
833
  [LOCSTA]: tokens[i - 1][LOCSTA],
812
834
  [LOCEND]: tokens[i + 1][LOCEND],
835
+ [PARENT]: tokens[i + 1][PARENT],
813
836
  });
814
837
  i--;
815
838
  }
@@ -787,7 +787,8 @@ function doMinify(ast, options = {}, recursive = false, errors, nestingContent,
787
787
  previous = node;
788
788
  nodeIndex = i;
789
789
  }
790
- if (recursive && node != null && "chi" in node) {
790
+ // @ts-ignore
791
+ if (recursive && node != null && node.chi != null) {
791
792
  if (node.typ == EnumToken.KeyframesAtRuleNodeType ||
792
793
  !node.chi.some((n) => n.typ == EnumToken.DeclarationNodeType)) {
793
794
  if (!(node.typ == EnumToken.AtRuleNodeType && node.nam != "font-face")) {
@@ -10,6 +10,9 @@ import { objectHash } from '../utils/hash.js';
10
10
  import { equalsIgnoreCase } from '../utils/text.js';
11
11
 
12
12
  const config = getConfig();
13
+ /**
14
+ * Represents a list of property declarations, compute shorthand and remove duplicate declarations.
15
+ */
13
16
  class PropertyList {
14
17
  options = { removeDuplicateDeclarations: true, computeShorthand: true };
15
18
  declarations;
@@ -84,28 +87,35 @@ class PropertyList {
84
87
  // @ts-ignore
85
88
  shorthand = config.property[propertyName];
86
89
  }
87
- // console.error({shortHandType, propertyName, config: config.map[propertyName], map: config.map[shorthand].properties[propertyName]});
88
90
  // @ts-ignore
89
91
  if (shortHandType == "map") {
90
92
  let owner = this;
93
+ const mapName =
91
94
  // @ts-ignore
92
- const mapName = config.map[propertyName]?.map ?? config.map[shorthand]?.properties?.[propertyName]?.map;
95
+ config.map[propertyName]?.map ?? config.map[shorthand]?.properties?.[propertyName]?.map;
93
96
  if (typeof mapName === "string") {
94
97
  if (!this.declarations.has(mapName)) {
95
98
  // @ts-ignore
96
99
  this.declarations.set(mapName, new PropertyMap(config.map[mapName]));
97
100
  }
98
101
  owner = this.declarations.get(mapName);
99
- // console.error({mapName});
100
102
  }
101
- // @ts-ignore
102
- if (!owner.declarations.has(shorthand)) {
103
+ else if (!this.declarations.has(shorthand)) {
103
104
  // @ts-ignore
104
- owner.declarations.set(shorthand, new PropertyMap(config.map[shorthand]));
105
+ this.declarations.set(shorthand, new PropertyMap(config.map[shorthand]));
106
+ }
107
+ if (owner == this) {
108
+ // @ts-ignore
109
+ owner.declarations.get(shorthand).add(declaration);
110
+ }
111
+ else {
112
+ if (!owner.declarations.has(shorthand)) {
113
+ // @ts-ignore
114
+ owner.declarations.set(shorthand, new PropertyMap(config.map[shorthand]));
115
+ }
116
+ // @ts-ignore
117
+ owner.declarations.get(shorthand).add(declaration);
105
118
  }
106
- // console.error({propertyName,mapName, owned: owner == this});
107
- // @ts-ignore
108
- owner.declarations.get(shorthand).add(declaration);
109
119
  }
110
120
  // @ts-ignore
111
121
  else if (shortHandType == "set") {
@@ -192,7 +202,7 @@ class PropertyList {
192
202
  [Symbol.iterator]() {
193
203
  let iterator = this.declarations.values();
194
204
  const iterators = [];
195
- // console.error(this);
205
+ // @ts-ignore
196
206
  return {
197
207
  next() {
198
208
  let value = iterator.next();
@@ -10,8 +10,8 @@ import { cloneNode } from '../../ast/clone.js';
10
10
 
11
11
  const propertiesConfig = getConfig();
12
12
  class PropertyMap {
13
- config;
14
13
  declarations;
14
+ config;
15
15
  requiredCount;
16
16
  pattern;
17
17
  constructor(config) {
@@ -25,7 +25,7 @@ class PropertyMap {
25
25
  }
26
26
  add(declaration) {
27
27
  if (declaration.nam == this.config.shorthand) {
28
- this.declarations = new Map();
28
+ this.declarations.clear();
29
29
  this.declarations.set(declaration.nam, declaration);
30
30
  this.matchTypes(declaration);
31
31
  }
@@ -41,23 +41,17 @@ class PropertyMap {
41
41
  if (this.declarations.has(this.config.shorthand)) {
42
42
  const tokens = {};
43
43
  const values = [];
44
- // @ts-ignore
45
- this.declarations
46
- .get(this.config.shorthand)
47
- // @ts-ignore
48
- .val.slice()
49
- .reduce((acc, curr) => {
44
+ const val = [[]];
45
+ for (const curr of this.declarations.get(this.config.shorthand).val) { // @ts-ignore
50
46
  // @ts-ignore
51
47
  if (separator != null && separator.typ == curr.typ && separator.val == curr.val) {
52
- acc.push([]);
53
- return acc;
48
+ val.push([]);
49
+ continue;
54
50
  }
55
51
  // @ts-ignore
56
- acc.at(-1).push(curr);
57
- return acc;
58
- }, [[]])
59
- // @ts-ignore
60
- .reduce((acc, list, current) => {
52
+ val.at(-1).push(curr);
53
+ }
54
+ for (let current = 0; current < val.length; current++) {
61
55
  values.push(...this.pattern.reduce((acc, property) => {
62
56
  // let current: number = 0;
63
57
  const props = this.config.properties[property];
@@ -72,9 +66,7 @@ class PropertyMap {
72
66
  // @ts-ignore
73
67
  acc[i][PROPERTYNAME] == property ||
74
68
  matchType(acc[i], props)) {
75
- if ("prefix" in props &&
76
- props.previous != null &&
77
- !(props.previous in tokens)) {
69
+ if ("prefix" in props && props.previous != null && !(props.previous in tokens)) {
78
70
  return acc;
79
71
  }
80
72
  if (!(property in tokens)) {
@@ -139,9 +131,8 @@ class PropertyMap {
139
131
  }
140
132
  }
141
133
  return acc;
142
- }, list));
143
- return values;
144
- }, []);
134
+ }, val[current]));
135
+ }
145
136
  if (values.length == 0) {
146
137
  this.declarations = Object.entries(tokens).reduce((acc, curr) => {
147
138
  acc.set(curr[0], {
@@ -201,17 +192,40 @@ class PropertyMap {
201
192
  }
202
193
  if (hasMapping) {
203
194
  const mapped = {};
204
- for (const key of declarations.keys()) {
205
- const value = declarations.get(key);
195
+ let key;
196
+ for (const value of declarations.values()) {
197
+ key = value.nam;
206
198
  if (value instanceof PropertyMap) {
207
199
  for (const [k, v] of value.declarations) {
208
- mapped[k] = v;
200
+ if (k == value.config.shorthand) {
201
+ for (const [key, val] of Object.entries(value.config.properties)) {
202
+ mapped[key] = cloneNode(v);
203
+ for (let i = 0; i < v.val.length; i++) {
204
+ // @ts-ignore
205
+ if (key == v.val[i][PROPERTYNAME]) {
206
+ if (mapped[key].val.length > 0) {
207
+ mapped[key].val.push({
208
+ typ: EnumToken.WhitespaceTokenType,
209
+ });
210
+ }
211
+ mapped[key].val.push(v.val[i]);
212
+ }
213
+ }
214
+ if (mapped[key].val.length == 0) {
215
+ mapped[key].val.push(...parseString(value.config.properties[key].default[0]));
216
+ }
217
+ }
218
+ }
219
+ else {
220
+ mapped[k] = v;
221
+ }
209
222
  }
210
223
  }
211
224
  else {
212
225
  mapped[key] = value;
213
226
  }
214
227
  }
228
+ // console.error(mapped);
215
229
  if (patterns.length === Object.keys(mapped).length) {
216
230
  declarations = new Map();
217
231
  for (const key of patterns) {
@@ -667,8 +681,6 @@ class PropertyMap {
667
681
  }
668
682
  return acc;
669
683
  }, []);
670
- // console.error({hasMapping, shorthand: this.config.shorthand, requiredCount, isShorthand,
671
- // declarations: declarations.values(), values});
672
684
  if (this.config.mapping != null) {
673
685
  const val = values.reduce((acc, curr) => acc +
674
686
  renderValue(curr, {
@@ -705,6 +717,7 @@ class PropertyMap {
705
717
  }
706
718
  }
707
719
  const iterators = [];
720
+ // @ts-ignore
708
721
  return {
709
722
  // @ts-ignore
710
723
  next() {
@@ -475,6 +475,7 @@ function doParseSync(tokenizer, options = {}) {
475
475
  if (options.expandNestingRules) {
476
476
  options.nestingRules = false;
477
477
  }
478
+ options.minifyAST ??= options.minify;
478
479
  const startTime = performance.now();
479
480
  const errors = [];
480
481
  const stack = [];
@@ -854,7 +855,7 @@ function doParseSync(tokenizer, options = {}) {
854
855
  }
855
856
  }
856
857
  }
857
- if (options.minify) {
858
+ if (options.minifyAST) {
858
859
  if (ast.chi.length > 0) {
859
860
  let passes = options.pass ?? 1;
860
861
  while (passes--) {
@@ -1394,6 +1395,7 @@ async function doParse(iter, options = {}) {
1394
1395
  lenient: true,
1395
1396
  ...options,
1396
1397
  };
1398
+ options.minifyAST ??= options.minify;
1397
1399
  if (typeof options.validation !== "boolean") {
1398
1400
  options.validation = !!options.validation;
1399
1401
  }
@@ -1848,7 +1850,7 @@ async function doParse(iter, options = {}) {
1848
1850
  }
1849
1851
  }
1850
1852
  }
1851
- if (options.minify) {
1853
+ if (options.minifyAST) {
1852
1854
  if (ast.chi.length > 0) {
1853
1855
  let passes = options.pass ?? 1;
1854
1856
  while (passes--) {