html-minifier-next 1.4.0 → 1.4.2

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.
@@ -26526,6 +26526,8 @@
26526
26526
  var RE_DEC_NUMBER = /^\d*\.?\d*(?:e[+-]?\d*(?:\d\.?|\.?\d)\d*)?$/i;
26527
26527
  var RE_BIG_INT = /^(0[xob])?[0-9a-f]+n$/i;
26528
26528
 
26529
+ var RE_KEYWORD_RELATIONAL_OPERATORS = /in(?:stanceof)?/y;
26530
+
26529
26531
  var OPERATORS = makePredicate([
26530
26532
  "in",
26531
26533
  "instanceof",
@@ -26850,6 +26852,56 @@
26850
26852
  next();
26851
26853
  }
26852
26854
 
26855
+ function peek_next_token_start_or_newline() {
26856
+ var pos = S.pos;
26857
+ for (var in_multiline_comment = false; pos < S.text.length; ) {
26858
+ var ch = get_full_char(S.text, pos);
26859
+ if (NEWLINE_CHARS.has(ch)) {
26860
+ return { char: ch, pos: pos };
26861
+ } else if (in_multiline_comment) {
26862
+ if (ch == "*" && get_full_char(S.text, pos + 1) == "/") {
26863
+ pos += 2;
26864
+ in_multiline_comment = false;
26865
+ } else {
26866
+ pos++;
26867
+ }
26868
+ } else if (!WHITESPACE_CHARS.has(ch)) {
26869
+ if (ch == "/") {
26870
+ var next_ch = get_full_char(S.text, pos + 1);
26871
+ if (next_ch == "/") {
26872
+ pos = find_eol();
26873
+ return { char: get_full_char(S.text, pos), pos: pos };
26874
+ } else if (next_ch == "*") {
26875
+ in_multiline_comment = true;
26876
+ pos += 2;
26877
+ continue;
26878
+ }
26879
+ }
26880
+ return { char: ch, pos: pos };
26881
+ } else {
26882
+ pos++;
26883
+ }
26884
+ }
26885
+ return { char: null, pos: pos };
26886
+ }
26887
+
26888
+ function ch_starts_binding_identifier(ch, pos) {
26889
+ if (ch == "\\") {
26890
+ return true;
26891
+ } else if (is_identifier_start(ch)) {
26892
+ RE_KEYWORD_RELATIONAL_OPERATORS.lastIndex = pos;
26893
+ if (RE_KEYWORD_RELATIONAL_OPERATORS.test(S.text)) {
26894
+ var after = get_full_char(S.text, RE_KEYWORD_RELATIONAL_OPERATORS.lastIndex);
26895
+ if (!is_identifier_char(after) && after != "\\") {
26896
+ // "in" or "instanceof" are keywords, not binding identifiers
26897
+ return false;
26898
+ }
26899
+ }
26900
+ return true;
26901
+ }
26902
+ return false;
26903
+ }
26904
+
26853
26905
  function read_while(pred) {
26854
26906
  var ret = "", ch, i = 0;
26855
26907
  while ((ch = peek()) && pred(ch, i++))
@@ -27092,7 +27144,8 @@
27092
27144
  && (ch >= "a" && ch <= "z" || ch >= "A" && ch <= "Z")
27093
27145
  );
27094
27146
 
27095
- if (end > start + 1 && ch && ch !== "\\" && !is_identifier_char(ch)) {
27147
+ // 0x7F is very rare in actual code, so we compare it to "~" (0x7E)
27148
+ if (end > start + 1 && ch && ch !== "\\" && !is_identifier_char(ch) && ch <= "~") {
27096
27149
  S.pos += end - start;
27097
27150
  S.col += end - start;
27098
27151
  return S.text.slice(start, S.pos);
@@ -27353,6 +27406,9 @@
27353
27406
  return S.directives[directive] > 0;
27354
27407
  };
27355
27408
 
27409
+ next_token.peek_next_token_start_or_newline = peek_next_token_start_or_newline;
27410
+ next_token.ch_starts_binding_identifier = ch_starts_binding_identifier;
27411
+
27356
27412
  return next_token;
27357
27413
 
27358
27414
  }
@@ -27574,10 +27630,6 @@
27574
27630
  return simple_statement();
27575
27631
 
27576
27632
  case "name":
27577
- case "privatename":
27578
- if(is("privatename") && !S.in_class)
27579
- croak("Private field must be used in an enclosing class");
27580
-
27581
27633
  if (S.token.value == "async" && is_token(peek(), "keyword", "function")) {
27582
27634
  next();
27583
27635
  next();
@@ -27592,10 +27644,31 @@
27592
27644
  semicolon();
27593
27645
  return node;
27594
27646
  }
27647
+ if (S.token.value == "using" && is_token(peek(), "name") && !has_newline_before(peek())) {
27648
+ next();
27649
+ var node = using_();
27650
+ semicolon();
27651
+ return node;
27652
+ }
27653
+ if (S.token.value == "await" && can_await() && is_token(peek(), "name", "using") && !has_newline_before(peek())) {
27654
+ var next_next = S.input.peek_next_token_start_or_newline();
27655
+ if (S.input.ch_starts_binding_identifier(next_next.char, next_next.pos)) {
27656
+ next();
27657
+ // The "using" token will be consumed by the await_using_ function.
27658
+ var node = await_using_();
27659
+ semicolon();
27660
+ return node;
27661
+ }
27662
+ }
27595
27663
  return is_token(peek(), "punc", ":")
27596
27664
  ? labeled_statement()
27597
27665
  : simple_statement();
27598
27666
 
27667
+ case "privatename":
27668
+ if(!S.in_class)
27669
+ croak("Private field must be used in an enclosing class");
27670
+ return simple_statement();
27671
+
27599
27672
  case "punc":
27600
27673
  switch (S.token.value) {
27601
27674
  case "{":
@@ -27820,6 +27893,8 @@
27820
27893
  is("keyword", "var") ? (next(), var_(true)) :
27821
27894
  is("keyword", "let") ? (next(), let_(true)) :
27822
27895
  is("keyword", "const") ? (next(), const_(true)) :
27896
+ is("name", "using") && is_token(peek(), "name") && (peek().value != "of" || S.input.peek_next_token_start_or_newline().char == "=") ? (next(), using_(true)) :
27897
+ is("name", "await") && can_await() && is_token(peek(), "name", "using") ? (next(), await_using_(true)) :
27823
27898
  expression(true, true);
27824
27899
  var is_in = is("operator", "in");
27825
27900
  var is_of = is("name", "of");
@@ -27827,9 +27902,12 @@
27827
27902
  token_error(await_tok, for_await_error);
27828
27903
  }
27829
27904
  if (is_in || is_of) {
27830
- if (init instanceof AST_Definitions) {
27905
+ if (init instanceof AST_DefinitionsLike) {
27831
27906
  if (init.definitions.length > 1)
27832
27907
  token_error(init.start, "Only one variable declaration allowed in for..in loop");
27908
+ if (is_in && init instanceof AST_Using) {
27909
+ token_error(init.start, "Invalid using declaration in for..in loop");
27910
+ }
27833
27911
  } else if (!(is_assignable(init) || (init = to_destructuring(init)) instanceof AST_Destructuring)) {
27834
27912
  token_error(init.start, "Invalid left-hand side in for..in loop");
27835
27913
  }
@@ -27861,7 +27939,7 @@
27861
27939
  }
27862
27940
 
27863
27941
  function for_of(init, is_await) {
27864
- var lhs = init instanceof AST_Definitions ? init.definitions[0].name : null;
27942
+ var lhs = init instanceof AST_DefinitionsLike ? init.definitions[0].name : null;
27865
27943
  var obj = expression(true);
27866
27944
  expect(")");
27867
27945
  return new AST_ForOf({
@@ -28457,23 +28535,26 @@
28457
28535
  var sym_type =
28458
28536
  kind === "var" ? AST_SymbolVar :
28459
28537
  kind === "const" ? AST_SymbolConst :
28460
- kind === "let" ? AST_SymbolLet : null;
28538
+ kind === "let" ? AST_SymbolLet :
28539
+ kind === "using" ? AST_SymbolUsing :
28540
+ kind === "await using" ? AST_SymbolUsing : null;
28541
+ var def_type = kind === "using" || kind === "await using" ? AST_UsingDef : AST_VarDef;
28461
28542
  // var { a } = b
28462
28543
  if (is("punc", "{") || is("punc", "[")) {
28463
- def = new AST_VarDef({
28544
+ def = new def_type({
28464
28545
  start: S.token,
28465
28546
  name: binding_element(undefined, sym_type),
28466
28547
  value: is("operator", "=") ? (expect_token("operator", "="), expression(false, no_in)) : null,
28467
28548
  end: prev()
28468
28549
  });
28469
28550
  } else {
28470
- def = new AST_VarDef({
28551
+ def = new def_type({
28471
28552
  start : S.token,
28472
28553
  name : as_symbol(sym_type),
28473
28554
  value : is("operator", "=")
28474
28555
  ? (next(), expression(false, no_in))
28475
- : !no_in && kind === "const"
28476
- ? croak("Missing initializer in const declaration") : null,
28556
+ : !no_in && (kind === "const" || kind === "using" || kind === "await using")
28557
+ ? croak("Missing initializer in " + kind + " declaration") : null,
28477
28558
  end : prev()
28478
28559
  });
28479
28560
  if (def.name.name == "import") croak("Unexpected token: import");
@@ -28510,6 +28591,25 @@
28510
28591
  });
28511
28592
  };
28512
28593
 
28594
+ var using_ = function(no_in) {
28595
+ return new AST_Using({
28596
+ start : prev(),
28597
+ await : false,
28598
+ definitions : vardefs(no_in, "using"),
28599
+ end : prev()
28600
+ });
28601
+ };
28602
+
28603
+ var await_using_ = function(no_in) {
28604
+ // Assumption: When await_using_ is called, only the `await` token has been consumed.
28605
+ return new AST_Using({
28606
+ start : prev(),
28607
+ await : true,
28608
+ definitions : (next(), vardefs(no_in, "await using")),
28609
+ end : prev()
28610
+ });
28611
+ };
28612
+
28513
28613
  var new_ = function(allow_calls) {
28514
28614
  var start = S.token;
28515
28615
  expect_token("operator", "new");
@@ -28928,13 +29028,13 @@
28928
29028
  return name;
28929
29029
  };
28930
29030
 
29031
+ var is_private = prev().type === "privatename";
28931
29032
  const is_not_method_start = () =>
28932
- !is("punc", "(") && !is("punc", ",") && !is("punc", "}") && !is("punc", ";") && !is("operator", "=");
29033
+ !is("punc", "(") && !is("punc", ",") && !is("punc", "}") && !is("punc", ";") && !is("operator", "=") && !is_private;
28933
29034
 
28934
29035
  var is_async = false;
28935
29036
  var is_static = false;
28936
29037
  var is_generator = false;
28937
- var is_private = false;
28938
29038
  var accessor_type = null;
28939
29039
 
28940
29040
  if (is_class && name === "static" && is_not_method_start()) {
@@ -28957,7 +29057,7 @@
28957
29057
  accessor_type = name;
28958
29058
  name = as_property_name();
28959
29059
  }
28960
- if (prev().type === "privatename") {
29060
+ if (!is_private && prev().type === "privatename") {
28961
29061
  is_private = true;
28962
29062
  }
28963
29063
 
@@ -31186,7 +31286,7 @@
31186
31286
 
31187
31287
  /* -----[ VAR/CONST ]----- */
31188
31288
 
31189
- var AST_Definitions = DEFNODE("Definitions", "definitions", function AST_Definitions(props) {
31289
+ var AST_DefinitionsLike = DEFNODE("DefinitionsLike", "definitions", function AST_DefinitionsLike(props) {
31190
31290
  if (props) {
31191
31291
  this.definitions = props.definitions;
31192
31292
  this.start = props.start;
@@ -31195,9 +31295,9 @@
31195
31295
 
31196
31296
  this.flags = 0;
31197
31297
  }, {
31198
- $documentation: "Base class for `var` or `const` nodes (variable declarations/initializations)",
31298
+ $documentation: "Base class for variable definitions and `using`",
31199
31299
  $propdoc: {
31200
- definitions: "[AST_VarDef*] array of variable definitions"
31300
+ definitions: "[AST_VarDef*|AST_UsingDef*] array of variable definitions"
31201
31301
  },
31202
31302
  _walk: function(visitor) {
31203
31303
  return visitor._visit(this, function() {
@@ -31213,6 +31313,18 @@
31213
31313
  },
31214
31314
  }, AST_Statement);
31215
31315
 
31316
+ var AST_Definitions = DEFNODE("Definitions", null, function AST_Definitions(props) {
31317
+ if (props) {
31318
+ this.definitions = props.definitions;
31319
+ this.start = props.start;
31320
+ this.end = props.end;
31321
+ }
31322
+
31323
+ this.flags = 0;
31324
+ }, {
31325
+ $documentation: "Base class for `var` or `const` nodes (variable declarations/initializations)",
31326
+ }, AST_DefinitionsLike);
31327
+
31216
31328
  var AST_Var = DEFNODE("Var", null, function AST_Var(props) {
31217
31329
  if (props) {
31218
31330
  this.definitions = props.definitions;
@@ -31249,7 +31361,23 @@
31249
31361
  $documentation: "A `const` statement"
31250
31362
  }, AST_Definitions);
31251
31363
 
31252
- var AST_VarDef = DEFNODE("VarDef", "name value", function AST_VarDef(props) {
31364
+ var AST_Using = DEFNODE("Using", "await", function AST_Using(props) {
31365
+ if (props) {
31366
+ this.await = props.await;
31367
+ this.definitions = props.definitions;
31368
+ this.start = props.start;
31369
+ this.end = props.end;
31370
+ }
31371
+
31372
+ this.flags = 0;
31373
+ }, {
31374
+ $documentation: "A `using` statement",
31375
+ $propdoc: {
31376
+ await: "[boolean] Whether it's `await using`"
31377
+ },
31378
+ }, AST_DefinitionsLike);
31379
+
31380
+ var AST_VarDefLike = DEFNODE("VarDefLike", "name value", function AST_VarDefLike(props) {
31253
31381
  if (props) {
31254
31382
  this.name = props.name;
31255
31383
  this.value = props.value;
@@ -31259,9 +31387,9 @@
31259
31387
 
31260
31388
  this.flags = 0;
31261
31389
  }, {
31262
- $documentation: "A variable declaration; only appears in a AST_Definitions node",
31390
+ $documentation: "A name=value pair in a variable definition statement or `using`",
31263
31391
  $propdoc: {
31264
- name: "[AST_Destructuring|AST_SymbolConst|AST_SymbolLet|AST_SymbolVar] name of the variable",
31392
+ name: "[AST_Destructuring|AST_SymbolDeclaration] name of the variable",
31265
31393
  value: "[AST_Node?] initializer, or null of there's no initializer"
31266
31394
  },
31267
31395
  _walk: function(visitor) {
@@ -31276,13 +31404,39 @@
31276
31404
  },
31277
31405
  declarations_as_names() {
31278
31406
  if (this.name instanceof AST_SymbolDeclaration) {
31279
- return [this];
31407
+ return [this.name];
31280
31408
  } else {
31281
31409
  return this.name.all_symbols();
31282
31410
  }
31283
31411
  }
31284
31412
  });
31285
31413
 
31414
+ var AST_VarDef = DEFNODE("VarDef", null, function AST_VarDef(props) {
31415
+ if (props) {
31416
+ this.name = props.name;
31417
+ this.value = props.value;
31418
+ this.start = props.start;
31419
+ this.end = props.end;
31420
+ }
31421
+
31422
+ this.flags = 0;
31423
+ }, {
31424
+ $documentation: "A variable declaration; only appears in a AST_Definitions node",
31425
+ }, AST_VarDefLike);
31426
+
31427
+ var AST_UsingDef = DEFNODE("UsingDef", null, function AST_UsingDef(props) {
31428
+ if (props) {
31429
+ this.name = props.name;
31430
+ this.value = props.value;
31431
+ this.start = props.start;
31432
+ this.end = props.end;
31433
+ }
31434
+
31435
+ this.flags = 0;
31436
+ }, {
31437
+ $documentation: "Like VarDef but specific to AST_Using",
31438
+ }, AST_VarDefLike);
31439
+
31286
31440
  var AST_NameMapping = DEFNODE("NameMapping", "foreign_name name", function AST_NameMapping(props) {
31287
31441
  if (props) {
31288
31442
  this.foreign_name = props.foreign_name;
@@ -32378,6 +32532,21 @@
32378
32532
  $documentation: "A constant declaration"
32379
32533
  }, AST_SymbolBlockDeclaration);
32380
32534
 
32535
+ var AST_SymbolUsing = DEFNODE("SymbolUsing", null, function AST_SymbolUsing(props) {
32536
+ if (props) {
32537
+ this.init = props.init;
32538
+ this.scope = props.scope;
32539
+ this.name = props.name;
32540
+ this.thedef = props.thedef;
32541
+ this.start = props.start;
32542
+ this.end = props.end;
32543
+ }
32544
+
32545
+ this.flags = 0;
32546
+ }, {
32547
+ $documentation: "A `using` declaration"
32548
+ }, AST_SymbolBlockDeclaration);
32549
+
32381
32550
  var AST_SymbolLet = DEFNODE("SymbolLet", null, function AST_SymbolLet(props) {
32382
32551
  if (props) {
32383
32552
  this.init = props.init;
@@ -33224,11 +33393,11 @@
33224
33393
  self.body = MAP(self.body, tw);
33225
33394
  });
33226
33395
 
33227
- def_transform(AST_Definitions, function(self, tw) {
33396
+ def_transform(AST_DefinitionsLike, function(self, tw) {
33228
33397
  self.definitions = MAP(self.definitions, tw);
33229
33398
  });
33230
33399
 
33231
- def_transform(AST_VarDef, function(self, tw) {
33400
+ def_transform(AST_VarDefLike, function(self, tw) {
33232
33401
  self.name = self.name.transform(tw);
33233
33402
  if (self.value) self.value = self.value.transform(tw);
33234
33403
  });
@@ -33763,19 +33932,30 @@
33763
33932
 
33764
33933
  VariableDeclaration: function(M) {
33765
33934
  let decl_type;
33935
+ let defs_type = AST_VarDef;
33766
33936
  let sym_type;
33937
+ let await_using = false;
33767
33938
  if (M.kind === "const") {
33768
33939
  decl_type = AST_Const;
33769
33940
  sym_type = AST_SymbolConst;
33770
33941
  } else if (M.kind === "let") {
33771
33942
  decl_type = AST_Let;
33772
33943
  sym_type = AST_SymbolLet;
33944
+ } else if (M.kind === "using") {
33945
+ decl_type = AST_Using;
33946
+ defs_type = AST_UsingDef;
33947
+ sym_type = AST_SymbolUsing;
33948
+ } else if (M.kind === "await using") {
33949
+ decl_type = AST_Using;
33950
+ defs_type = AST_UsingDef;
33951
+ sym_type = AST_SymbolUsing;
33952
+ await_using = true;
33773
33953
  } else {
33774
33954
  decl_type = AST_Var;
33775
33955
  sym_type = AST_SymbolVar;
33776
33956
  }
33777
33957
  const definitions = M.declarations.map(M => {
33778
- return new AST_VarDef({
33958
+ return new defs_type({
33779
33959
  start: my_start_token(M),
33780
33960
  end: my_end_token(M),
33781
33961
  name: from_moz_pattern(M.id, sym_type),
@@ -33786,6 +33966,7 @@
33786
33966
  start : my_start_token(M),
33787
33967
  end : my_end_token(M),
33788
33968
  definitions : definitions,
33969
+ await : await_using,
33789
33970
  });
33790
33971
  },
33791
33972
 
@@ -34385,7 +34566,7 @@
34385
34566
  type: "DebuggerStatement"
34386
34567
  };
34387
34568
  });
34388
- def_to_moz(AST_VarDef, function To_Moz_VariableDeclarator(M) {
34569
+ def_to_moz(AST_VarDefLike, function To_Moz_VariableDeclarator(M) {
34389
34570
  return {
34390
34571
  type: "VariableDeclarator",
34391
34572
  id: to_moz(M.name),
@@ -34601,12 +34782,14 @@
34601
34782
  };
34602
34783
  });
34603
34784
 
34604
- def_to_moz(AST_Definitions, function To_Moz_VariableDeclaration(M) {
34785
+ def_to_moz(AST_DefinitionsLike, function To_Moz_VariableDeclaration(M) {
34605
34786
  return {
34606
34787
  type: "VariableDeclaration",
34607
34788
  kind:
34608
34789
  M instanceof AST_Const ? "const" :
34609
- M instanceof AST_Let ? "let" : "var",
34790
+ M instanceof AST_Let ? "let" :
34791
+ M instanceof AST_Using ? (M.await ? "await using" : "using") :
34792
+ "var",
34610
34793
  declarations: M.definitions.map(to_moz)
34611
34794
  };
34612
34795
  });
@@ -36277,7 +36460,7 @@
36277
36460
  return p instanceof AST_Call // (foo, bar)() or foo(1, (2, 3), 4)
36278
36461
  || p instanceof AST_Unary // !(foo, bar, baz)
36279
36462
  || p instanceof AST_Binary // 1 + (2, 3) + 4 ==> 8
36280
- || p instanceof AST_VarDef // var a = (1, 2), b = a + a; ==> b == 4
36463
+ || p instanceof AST_VarDefLike // var a = (1, 2), b = a + a; ==> b == 4
36281
36464
  || p instanceof AST_PropAccess // (1, {foo:2}).foo or (1, {foo:2})["foo"] ==> 2
36282
36465
  || p instanceof AST_Array // [ 1, (2, 3), 4 ] ==> [ 1, 3, 4 ]
36283
36466
  || p instanceof AST_ObjectProperty // { foo: (1, 2) }.foo ==> 2
@@ -36609,7 +36792,7 @@
36609
36792
  output.space();
36610
36793
  output.with_parens(function() {
36611
36794
  if (self.init) {
36612
- if (self.init instanceof AST_Definitions) {
36795
+ if (self.init instanceof AST_DefinitionsLike) {
36613
36796
  self.init.print(output);
36614
36797
  } else {
36615
36798
  parenthesize_for_noin(self.init, output, true);
@@ -36969,7 +37152,7 @@
36969
37152
  });
36970
37153
 
36971
37154
  /* -----[ var/const ]----- */
36972
- AST_Definitions.DEFMETHOD("_do_print", function(output, kind) {
37155
+ AST_DefinitionsLike.DEFMETHOD("_do_print", function(output, kind) {
36973
37156
  output.print(kind);
36974
37157
  output.space();
36975
37158
  this.definitions.forEach(function(def, i) {
@@ -36991,6 +37174,9 @@
36991
37174
  DEFPRINT(AST_Const, function(self, output) {
36992
37175
  self._do_print(output, "const");
36993
37176
  });
37177
+ DEFPRINT(AST_Using, function(self, output) {
37178
+ self._do_print(output, self.await ? "await using" : "using");
37179
+ });
36994
37180
  DEFPRINT(AST_Import, function(self, output) {
36995
37181
  output.print("import");
36996
37182
  output.space();
@@ -37158,7 +37344,7 @@
37158
37344
  node.print(output, parens);
37159
37345
  }
37160
37346
 
37161
- DEFPRINT(AST_VarDef, function(self, output) {
37347
+ DEFPRINT(AST_VarDefLike, function(self, output) {
37162
37348
  self.name.print(output);
37163
37349
  if (self.value) {
37164
37350
  output.space();
@@ -37634,7 +37820,7 @@
37634
37820
  } else {
37635
37821
  if (!stat || stat instanceof AST_EmptyStatement)
37636
37822
  output.force_semicolon();
37637
- else if (stat instanceof AST_Let || stat instanceof AST_Const || stat instanceof AST_Class)
37823
+ else if ((stat instanceof AST_DefinitionsLike && !(stat instanceof AST_Var)) || stat instanceof AST_Class)
37638
37824
  make_block(stat, output);
37639
37825
  else
37640
37826
  stat.print(output);
@@ -37714,7 +37900,7 @@
37714
37900
  AST_Class,
37715
37901
  AST_Constant,
37716
37902
  AST_Debugger,
37717
- AST_Definitions,
37903
+ AST_DefinitionsLike,
37718
37904
  AST_Directive,
37719
37905
  AST_Finally,
37720
37906
  AST_Jump,
@@ -37877,9 +38063,9 @@
37877
38063
 
37878
38064
  AST_Finally.prototype.shallow_cmp = pass_through;
37879
38065
 
37880
- AST_Definitions.prototype.shallow_cmp = pass_through;
38066
+ AST_DefinitionsLike.prototype.shallow_cmp = pass_through;
37881
38067
 
37882
- AST_VarDef.prototype.shallow_cmp = function(other) {
38068
+ AST_VarDefLike.prototype.shallow_cmp = function(other) {
37883
38069
  return this.value == null ? other.value == null : this.value === other.value;
37884
38070
  };
37885
38071
 
@@ -38249,6 +38435,7 @@
38249
38435
  node instanceof AST_SymbolVar
38250
38436
  || node instanceof AST_SymbolLet
38251
38437
  || node instanceof AST_SymbolConst
38438
+ || node instanceof AST_SymbolUsing
38252
38439
  || node instanceof AST_SymbolCatch
38253
38440
  ) {
38254
38441
  var def;
@@ -38262,7 +38449,7 @@
38262
38449
  if (node instanceof AST_SymbolBlockDeclaration) {
38263
38450
  return sym instanceof AST_SymbolLambda;
38264
38451
  }
38265
- return !(sym instanceof AST_SymbolLet || sym instanceof AST_SymbolConst);
38452
+ return !(sym instanceof AST_SymbolLet || sym instanceof AST_SymbolConst || sym instanceof AST_SymbolUsing);
38266
38453
  })) {
38267
38454
  js_error(
38268
38455
  `"${node.name}" is redeclared`,
@@ -39142,7 +39329,12 @@
39142
39329
  return 6 + list_overhead(this.definitions);
39143
39330
  };
39144
39331
 
39145
- AST_VarDef.prototype._size = function () {
39332
+ AST_Using.prototype._size = function () {
39333
+ const await_size = this.await ? 6 : 0;
39334
+ return await_size + 6 + list_overhead(this.definitions);
39335
+ };
39336
+
39337
+ AST_VarDefLike.prototype._size = function () {
39146
39338
  return this.value ? 1 : 0;
39147
39339
  };
39148
39340
 
@@ -39613,7 +39805,7 @@
39613
39805
  if (key instanceof AST_UnaryPrefix
39614
39806
  && key.operator == "void"
39615
39807
  && key.expression instanceof AST_Constant) {
39616
- return;
39808
+ return undefined;
39617
39809
  }
39618
39810
  return key;
39619
39811
  }
@@ -39723,6 +39915,7 @@
39723
39915
  node instanceof AST_Defun ||
39724
39916
  node instanceof AST_Let ||
39725
39917
  node instanceof AST_Const ||
39918
+ node instanceof AST_Using ||
39726
39919
  node instanceof AST_Export ||
39727
39920
  node instanceof AST_Import
39728
39921
  );
@@ -42482,7 +42675,7 @@
42482
42675
  parent instanceof AST_Assign && (parent.operator === "=" || parent.logical) && node === parent.right
42483
42676
  || parent instanceof AST_Call && (node !== parent.expression || parent instanceof AST_New)
42484
42677
  || parent instanceof AST_Exit && node === parent.value && node.scope !== d.scope
42485
- || parent instanceof AST_VarDef && node === parent.value
42678
+ || parent instanceof AST_VarDefLike && node === parent.value
42486
42679
  || parent instanceof AST_Yield && node === parent.value && node.scope !== d.scope
42487
42680
  ) {
42488
42681
  if (depth > 1 && !(value && value.is_constant_expression(scope))) depth = 1;
@@ -42865,7 +43058,7 @@
42865
43058
 
42866
43059
  // Refine `defun_first_read_map` to be as high as possible
42867
43060
  for (const [defun, defun_first_read] of defun_first_read_map) {
42868
- // Update all depdencies of `defun`
43061
+ // Update all dependencies of `defun`
42869
43062
  const queue = new Set(defun_dependencies_map.get(defun));
42870
43063
  for (const enclosed_defun of queue) {
42871
43064
  let enclosed_defun_first_read = defun_first_read_map.get(enclosed_defun);
@@ -43094,6 +43287,10 @@
43094
43287
  }
43095
43288
  });
43096
43289
 
43290
+ def_reduce_vars(AST_UsingDef, function() {
43291
+ suppress(this.name);
43292
+ });
43293
+
43097
43294
  def_reduce_vars(AST_While, function(tw, descend, compressor) {
43098
43295
  reset_block_variables(compressor, this);
43099
43296
  const saved_loop = tw.in_loop;
@@ -43302,6 +43499,7 @@
43302
43499
  if (node instanceof AST_Assign
43303
43500
  && (node.logical || node.operator != "=" && lhs.equivalent_to(node.left))
43304
43501
  || node instanceof AST_Await
43502
+ || node instanceof AST_Using
43305
43503
  || node instanceof AST_Call && lhs instanceof AST_PropAccess && lhs.equivalent_to(node.expression)
43306
43504
  ||
43307
43505
  (node instanceof AST_Call || node instanceof AST_PropAccess)
@@ -43400,6 +43598,7 @@
43400
43598
  && ((lvalues.has(node.name) && lvalues.get(node.name).modified) || side_effects && may_modify(node))
43401
43599
  || node instanceof AST_VarDef && node.value
43402
43600
  && (lvalues.has(node.name.name) || side_effects && may_modify(node.name))
43601
+ || node instanceof AST_Using
43403
43602
  || (sym = is_lhs(node.left, node))
43404
43603
  && (sym instanceof AST_PropAccess || lvalues.has(sym.name))
43405
43604
  || may_throw
@@ -43814,7 +44013,9 @@
43814
44013
  ? expr.left
43815
44014
  : expr.expression;
43816
44015
  return !is_ref_of(lhs, AST_SymbolConst)
43817
- && !is_ref_of(lhs, AST_SymbolLet) && lhs;
44016
+ && !is_ref_of(lhs, AST_SymbolLet)
44017
+ && !is_ref_of(lhs, AST_SymbolUsing)
44018
+ && lhs;
43818
44019
  }
43819
44020
  }
43820
44021
 
@@ -44149,7 +44350,7 @@
44149
44350
  return false;
44150
44351
  for (var j = i + 1, len = statements.length; j < len; j++) {
44151
44352
  var stat = statements[j];
44152
- if (stat instanceof AST_Const || stat instanceof AST_Let)
44353
+ if (stat instanceof AST_DefinitionsLike && !(stat instanceof AST_Var))
44153
44354
  return false;
44154
44355
  }
44155
44356
  var lct = ab instanceof AST_LoopControl ? compressor.loopcontrol_target(ab) : null;
@@ -44289,7 +44490,7 @@
44289
44490
  var line = block.body[i];
44290
44491
  if (line instanceof AST_Var && declarations_only(line)) {
44291
44492
  decls.push(line);
44292
- } else if (stat || line instanceof AST_Const || line instanceof AST_Let) {
44493
+ } else if (stat || line instanceof AST_DefinitionsLike && !(line instanceof AST_Var)) {
44293
44494
  return false;
44294
44495
  } else {
44295
44496
  stat = line;
@@ -44312,7 +44513,7 @@
44312
44513
  if (stat instanceof AST_Exit) {
44313
44514
  stat.value = cons_seq(stat.value || make_node(AST_Undefined, stat).transform(compressor));
44314
44515
  } else if (stat instanceof AST_For) {
44315
- if (!(stat.init instanceof AST_Definitions)) {
44516
+ if (!(stat.init instanceof AST_DefinitionsLike)) {
44316
44517
  const abort = walk(prev.body, node => {
44317
44518
  if (node instanceof AST_Scope)
44318
44519
  return true;
@@ -44332,7 +44533,7 @@
44332
44533
  }
44333
44534
  }
44334
44535
  } else if (stat instanceof AST_ForIn) {
44335
- if (!(stat.init instanceof AST_Const) && !(stat.init instanceof AST_Let)) {
44536
+ if (!(stat.init instanceof AST_DefinitionsLike) || stat.init instanceof AST_Var) {
44336
44537
  stat.object = cons_seq(stat.object);
44337
44538
  }
44338
44539
  } else if (stat instanceof AST_If) {
@@ -44449,6 +44650,12 @@
44449
44650
  statements[++j] = stat;
44450
44651
  defs = stat;
44451
44652
  }
44653
+ } else if (
44654
+ stat instanceof AST_Using
44655
+ && prev instanceof AST_Using
44656
+ && prev.await === stat.await
44657
+ ) {
44658
+ prev.definitions = prev.definitions.concat(stat.definitions);
44452
44659
  } else if (stat instanceof AST_Exit) {
44453
44660
  stat.value = extract_object_assignments(stat.value);
44454
44661
  } else if (stat instanceof AST_For) {
@@ -45739,6 +45946,7 @@
45739
45946
  return !(
45740
45947
  node instanceof AST_Const
45741
45948
  || node instanceof AST_Let
45949
+ || node instanceof AST_Using
45742
45950
  || node instanceof AST_Class
45743
45951
  );
45744
45952
  }
@@ -45917,6 +46125,7 @@
45917
46125
  let def;
45918
46126
  let value;
45919
46127
  if (sym.scope === self
46128
+ && !(sym instanceof AST_SymbolUsing)
45920
46129
  && (def = sym.definition()).escaped != 1
45921
46130
  && !def.assignments
45922
46131
  && !def.direct_access
@@ -59922,7 +60131,7 @@
59922
60131
  }
59923
60132
  }
59924
60133
 
59925
- // Regular Expressions for parsing tags and attributes
60134
+ // Regular expressions for parsing tags and attributes
59926
60135
  const singleAttrIdentifier = /([^\s"'<>/=]+)/;
59927
60136
  const singleAttrAssigns = [/=/];
59928
60137
  const singleAttrValues = [
@@ -59953,10 +60162,10 @@
59953
60162
  IS_REGEX_CAPTURING_BROKEN = g === '';
59954
60163
  });
59955
60164
 
59956
- // Empty Elements
60165
+ // Empty elements
59957
60166
  const empty = new CaseInsensitiveSet(['area', 'base', 'basefont', 'br', 'col', 'embed', 'frame', 'hr', 'img', 'input', 'isindex', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']);
59958
60167
 
59959
- // Inline Elements
60168
+ // Inline elements
59960
60169
  const inline = new CaseInsensitiveSet(['a', 'abbr', 'acronym', 'applet', 'b', 'basefont', 'bdo', 'big', 'br', 'button', 'cite', 'code', 'del', 'dfn', 'em', 'font', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'label', 'map', 'noscript', 'object', 'q', 's', 'samp', 'script', 'select', 'small', 'span', 'strike', 'strong', 'sub', 'sup', 'svg', 'textarea', 'tt', 'u', 'var']);
59961
60170
 
59962
60171
  // Elements that you can, intentionally, leave open
@@ -59966,10 +60175,10 @@
59966
60175
  // Attributes that have their values filled in disabled='disabled'
59967
60176
  const fillAttrs = new CaseInsensitiveSet(['checked', 'compact', 'declare', 'defer', 'disabled', 'ismap', 'multiple', 'nohref', 'noresize', 'noshade', 'nowrap', 'readonly', 'selected']);
59968
60177
 
59969
- // Special Elements (can contain anything)
60178
+ // Special elements (can contain anything)
59970
60179
  const special = new CaseInsensitiveSet(['script', 'style']);
59971
60180
 
59972
- // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
60181
+ // HTML5 elements https://html.spec.whatwg.org/multipage/indices.html#elements-3
59973
60182
  // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
59974
60183
  const nonPhrasing = new CaseInsensitiveSet(['address', 'article', 'aside', 'base', 'blockquote', 'body', 'caption', 'col', 'colgroup', 'dd', 'details', 'dialog', 'div', 'dl', 'dt', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'legend', 'li', 'menuitem', 'meta', 'ol', 'optgroup', 'option', 'param', 'rp', 'rt', 'source', 'style', 'summary', 'tbody', 'td', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul']);
59975
60184
 
@@ -60017,7 +60226,7 @@
60017
60226
  let last, prevTag, nextTag;
60018
60227
  while (html) {
60019
60228
  last = html;
60020
- // Make sure we're not in a script or style element
60229
+ // Make sure were not in a `script` or `style` element
60021
60230
  if (!lastTag || !special.has(lastTag)) {
60022
60231
  let textEnd = html.indexOf('<');
60023
60232
  if (textEnd === 0) {
@@ -60093,7 +60302,7 @@
60093
60302
  html = '';
60094
60303
  }
60095
60304
 
60096
- // next tag
60305
+ // Next tag
60097
60306
  let nextTagMatch = parseStartTag(html);
60098
60307
  if (nextTagMatch) {
60099
60308
  nextTag = nextTagMatch.tagName;
@@ -60206,9 +60415,9 @@
60206
60415
 
60207
60416
  const attrs = match.attrs.map(function (args) {
60208
60417
  let name, value, customOpen, customClose, customAssign, quote;
60209
- const ncp = 7; // number of captured parts, scalar
60418
+ const ncp = 7; // Number of captured parts, scalar
60210
60419
 
60211
- // hackish work around FF bug https://bugzilla.mozilla.org/show_bug.cgi?id=369778
60420
+ // Hackish workaround for FF bug https://bugzilla.mozilla.org/show_bug.cgi?id=369778
60212
60421
  if (IS_REGEX_CAPTURING_BROKEN && args[0].indexOf('""') === -1) {
60213
60422
  if (args[3] === '') { delete args[3]; }
60214
60423
  if (args[4] === '') { delete args[4]; }
@@ -60430,28 +60639,28 @@
60430
60639
  }
60431
60640
 
60432
60641
  if (collapseAll) {
60433
- // strip non space whitespace then compress spaces to one
60642
+ // Strip non-space whitespace then compress spaces to one
60434
60643
  str = collapseWhitespaceAll(str);
60435
60644
  }
60436
60645
 
60437
60646
  return lineBreakBefore + str + lineBreakAfter;
60438
60647
  }
60439
60648
 
60440
- // non-empty elements that will maintain whitespace around them
60441
- const inlineHtmlElements = ['a', 'abbr', 'acronym', 'b', 'bdi', 'bdo', 'big', 'button', 'cite', 'code', 'del', 'dfn', 'em', 'font', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'mark', 'math', 'meter', 'nobr', 'object', 'output', 'progress', 'q', 'rp', 'rt', 'rtc', 'ruby', 's', 'samp', 'select', 'small', 'span', 'strike', 'strong', 'sub', 'sup', 'svg', 'textarea', 'time', 'tt', 'u', 'var', 'wbr'];
60442
- // non-empty elements that will maintain whitespace within them
60443
- const inlineTextTags = new Set(['a', 'abbr', 'acronym', 'b', 'big', 'del', 'em', 'font', 'i', 'ins', 'kbd', 'mark', 'nobr', 'rp', 's', 'samp', 'small', 'span', 'strike', 'strong', 'sub', 'sup', 'time', 'tt', 'u', 'var']);
60444
- // self-closing elements that will maintain whitespace around them
60445
- const selfClosingInlineTags = new Set(['comment', 'img', 'input', 'wbr']);
60649
+ // Non-empty elements that will maintain whitespace around them
60650
+ const inlineElementsToKeepWhitespaceAround = ['a', 'abbr', 'acronym', 'b', 'bdi', 'bdo', 'big', 'button', 'cite', 'code', 'del', 'dfn', 'em', 'font', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'mark', 'math', 'meter', 'nobr', 'object', 'output', 'progress', 'q', 'rp', 'rt', 'rtc', 'ruby', 's', 'samp', 'select', 'small', 'span', 'strike', 'strong', 'sub', 'sup', 'svg', 'textarea', 'time', 'tt', 'u', 'var', 'wbr'];
60651
+ // Non-empty elements that will maintain whitespace within them
60652
+ const inlineElementsToKeepWhitespaceWithin = new Set(['a', 'abbr', 'acronym', 'b', 'big', 'del', 'em', 'font', 'i', 'ins', 'kbd', 'mark', 'nobr', 'rp', 's', 'samp', 'small', 'span', 'strike', 'strong', 'sub', 'sup', 'time', 'tt', 'u', 'var']);
60653
+ // Elements that will always maintain whitespace around them
60654
+ const inlineElementsToKeepWhitespace = new Set(['comment', 'img', 'input', 'wbr']);
60446
60655
 
60447
- function collapseWhitespaceSmart(str, prevTag, nextTag, options, inlineTags) {
60448
- let trimLeft = prevTag && !selfClosingInlineTags.has(prevTag);
60656
+ function collapseWhitespaceSmart(str, prevTag, nextTag, options, inlineElements, inlineTextSet) {
60657
+ let trimLeft = prevTag && !inlineElementsToKeepWhitespace.has(prevTag);
60449
60658
  if (trimLeft && !options.collapseInlineTagWhitespace) {
60450
- trimLeft = prevTag.charAt(0) === '/' ? !inlineTags.has(prevTag.slice(1)) : !inlineTextTags.has(prevTag);
60659
+ trimLeft = prevTag.charAt(0) === '/' ? !inlineElements.has(prevTag.slice(1)) : !inlineTextSet.has(prevTag);
60451
60660
  }
60452
- let trimRight = nextTag && !selfClosingInlineTags.has(nextTag);
60661
+ let trimRight = nextTag && !inlineElementsToKeepWhitespace.has(nextTag);
60453
60662
  if (trimRight && !options.collapseInlineTagWhitespace) {
60454
- trimRight = nextTag.charAt(0) === '/' ? !inlineTextTags.has(nextTag.slice(1)) : !inlineTags.has(nextTag);
60663
+ trimRight = nextTag.charAt(0) === '/' ? !inlineTextSet.has(nextTag.slice(1)) : !inlineElements.has(nextTag);
60455
60664
  }
60456
60665
  return collapseWhitespace(str, options, trimLeft, trimRight, prevTag && nextTag);
60457
60666
  }
@@ -60638,7 +60847,7 @@
60638
60847
  return attrName === 'srcset' && srcsetTags.has(tag);
60639
60848
  }
60640
60849
 
60641
- async function cleanAttributeValue(tag, attrName, attrValue, options, attrs) {
60850
+ async function cleanAttributeValue(tag, attrName, attrValue, options, attrs, minifyHTMLSelf) {
60642
60851
  if (isEventAttribute(attrName, options)) {
60643
60852
  attrValue = trimWhitespace(attrValue).replace(/^javascript:\s*/i, '');
60644
60853
  return options.minifyJS(attrValue, true);
@@ -60696,6 +60905,13 @@
60696
60905
  } else if (isMediaQuery(tag, attrs, attrName)) {
60697
60906
  attrValue = trimWhitespace(attrValue);
60698
60907
  return options.minifyCSS(attrValue, 'media');
60908
+ } else if (tag === 'iframe' && attrName === 'srcdoc') {
60909
+ // Recursively minify HTML content within srcdoc attribute
60910
+ // Fast-path: skip if nothing would change
60911
+ if (!shouldMinifyInnerHTML(options)) {
60912
+ return attrValue;
60913
+ }
60914
+ return minifyHTMLSelf(attrValue, options, true);
60699
60915
  }
60700
60916
  return attrValue;
60701
60917
  }
@@ -60773,7 +60989,7 @@
60773
60989
  // Tag omission rules from https://html.spec.whatwg.org/multipage/syntax.html#optional-tags
60774
60990
  // with the following deviations:
60775
60991
  // - retain <body> if followed by <noscript>
60776
- // - </rb>, </rt>, </rtc>, </rp> & </tfoot> follow https://www.w3.org/TR/html5/syntax.html#optional-tags
60992
+ // - </rb>, </rt>, </rtc>, </rp>, and </tfoot> follow https://www.w3.org/TR/html5/syntax.html#optional-tags
60777
60993
  // - retain all tags which are adjacent to non-standard HTML tags
60778
60994
  const optionalStartTags = new Set(['html', 'head', 'body', 'colgroup', 'tbody']);
60779
60995
  const optionalEndTags = new Set(['html', 'head', 'body', 'li', 'dt', 'dd', 'p', 'rb', 'rt', 'rtc', 'rp', 'optgroup', 'option', 'colgroup', 'caption', 'thead', 'tbody', 'tfoot', 'tr', 'td', 'th']);
@@ -60935,7 +61151,7 @@
60935
61151
  }
60936
61152
 
60937
61153
  if (attrValue) {
60938
- attrValue = await cleanAttributeValue(tag, attrName, attrValue, options, attrs);
61154
+ attrValue = await cleanAttributeValue(tag, attrName, attrValue, options, attrs, minifyHTML);
60939
61155
  }
60940
61156
 
60941
61157
  if (options.removeEmptyAttributes &&
@@ -60983,7 +61199,7 @@
60983
61199
  emittedAttrValue += ' ';
60984
61200
  }
60985
61201
  } else if (isLast && !hasUnarySlash && !/\/$/.test(attrValue)) {
60986
- // make sure trailing slash is not interpreted as HTML self-closing tag
61202
+ // Make sure trailing slash is not interpreted as HTML self-closing tag
60987
61203
  emittedAttrValue = attrValue;
60988
61204
  } else {
60989
61205
  emittedAttrValue = attrValue + ' ';
@@ -61010,6 +61226,17 @@
61010
61226
  return Promise.resolve(value);
61011
61227
  }
61012
61228
 
61229
+ function shouldMinifyInnerHTML(options) {
61230
+ return Boolean(
61231
+ options.collapseWhitespace ||
61232
+ options.removeComments ||
61233
+ options.removeOptionalTags ||
61234
+ options.minifyJS !== identity ||
61235
+ options.minifyCSS !== identityAsync ||
61236
+ options.minifyURLs !== identity
61237
+ );
61238
+ }
61239
+
61013
61240
  const processOptions = (inputOptions) => {
61014
61241
  const options = {
61015
61242
  name: function (name) {
@@ -61244,11 +61471,16 @@
61244
61471
  let uidIgnore;
61245
61472
  let uidAttr;
61246
61473
  let uidPattern;
61247
- let inlineTags = new Set([...inlineHtmlElements, ...(options.inlineCustomElements ?? [])]);
61248
-
61249
- // temporarily replace ignored chunks with comments,
61250
- // so that we don't have to worry what's there.
61251
- // for all we care there might be
61474
+ // Create inline tags/text sets with custom elements
61475
+ const customElementsInput = options.inlineCustomElements ?? [];
61476
+ const customElementsArr = Array.isArray(customElementsInput) ? customElementsInput : Array.from(customElementsInput);
61477
+ const normalizedCustomElements = customElementsArr.map(name => options.name(name));
61478
+ const inlineTextSet = new Set([...inlineElementsToKeepWhitespaceWithin, ...normalizedCustomElements]);
61479
+ const inlineElements = new Set([...inlineElementsToKeepWhitespaceAround, ...normalizedCustomElements]);
61480
+
61481
+ // Temporarily replace ignored chunks with comments,
61482
+ // so that we don’t have to worry what’s there.
61483
+ // For all we care there might be
61252
61484
  // completely-horribly-broken-alien-non-html-emoj-cthulhu-filled content
61253
61485
  value = value.replace(/<!-- htmlmin:ignore -->([\s\S]*?)<!-- htmlmin:ignore -->/g, function (match, group1) {
61254
61486
  if (!uidIgnore) {
@@ -61369,20 +61601,20 @@
61369
61601
  buffer.length = Math.max(0, index);
61370
61602
  }
61371
61603
 
61372
- // look for trailing whitespaces, bypass any inline tags
61604
+ // Look for trailing whitespaces, bypass any inline tags
61373
61605
  function trimTrailingWhitespace(index, nextTag) {
61374
61606
  for (let endTag = null; index >= 0 && _canTrimWhitespace(endTag); index--) {
61375
61607
  const str = buffer[index];
61376
61608
  const match = str.match(/^<\/([\w:-]+)>$/);
61377
61609
  if (match) {
61378
61610
  endTag = match[1];
61379
- } else if (/>$/.test(str) || (buffer[index] = collapseWhitespaceSmart(str, null, nextTag, options, inlineTags))) {
61611
+ } else if (/>$/.test(str) || (buffer[index] = collapseWhitespaceSmart(str, null, nextTag, options, inlineElements, inlineTextSet))) {
61380
61612
  break;
61381
61613
  }
61382
61614
  }
61383
61615
  }
61384
61616
 
61385
- // look for trailing whitespaces from previously processed text
61617
+ // Look for trailing whitespaces from previously processed text
61386
61618
  // which may not be trimmed due to a following comment or an empty
61387
61619
  // element which has now been removed
61388
61620
  function squashTrailingWhitespace(nextTag) {
@@ -61413,7 +61645,7 @@
61413
61645
  tag = options.name(tag);
61414
61646
  currentTag = tag;
61415
61647
  charsPrevTag = tag;
61416
- if (!inlineTextTags.has(tag)) {
61648
+ if (!inlineTextSet.has(tag)) {
61417
61649
  currentChars = '';
61418
61650
  }
61419
61651
  hasChars = false;
@@ -61431,7 +61663,7 @@
61431
61663
  removeStartTag();
61432
61664
  }
61433
61665
  optionalStartTag = '';
61434
- // end-tag-followed-by-start-tag omission rules
61666
+ // End-tag-followed-by-start-tag omission rules
61435
61667
  if (htmlTag && canRemovePrecedingTag(optionalEndTag, tag)) {
61436
61668
  removeEndTag();
61437
61669
  // <colgroup> cannot be omitted if preceding </colgroup> is omitted
@@ -61441,7 +61673,7 @@
61441
61673
  optionalEndTag = '';
61442
61674
  }
61443
61675
 
61444
- // set whitespace flags for nested tags (eg. <code> within a <pre>)
61676
+ // Set whitespace flags for nested tags (eg. <code> within a <pre>)
61445
61677
  if (options.collapseWhitespace) {
61446
61678
  if (!stackNoTrimWhitespace.length) {
61447
61679
  squashTrailingWhitespace(tag);
@@ -61477,7 +61709,7 @@
61477
61709
  buffer.push(' ');
61478
61710
  buffer.push.apply(buffer, parts);
61479
61711
  } else if (optional && optionalStartTags.has(tag)) {
61480
- // start tag must never be omitted if it has any attributes
61712
+ // Start tag must never be omitted if it has any attributes
61481
61713
  optionalStartTag = tag;
61482
61714
  }
61483
61715
 
@@ -61494,7 +61726,7 @@
61494
61726
  }
61495
61727
  tag = options.name(tag);
61496
61728
 
61497
- // check if current tag is in a whitespace stack
61729
+ // Check if current tag is in a whitespace stack
61498
61730
  if (options.collapseWhitespace) {
61499
61731
  if (stackNoTrimWhitespace.length) {
61500
61732
  if (tag === stackNoTrimWhitespace[stackNoTrimWhitespace.length - 1]) {
@@ -61532,7 +61764,7 @@
61532
61764
  }
61533
61765
 
61534
61766
  if (options.removeEmptyElements && isElementEmpty && canRemoveElement(tag, attrs)) {
61535
- // remove last "element" from buffer
61767
+ // Remove last element from buffer
61536
61768
  removeStartTag();
61537
61769
  optionalStartTag = '';
61538
61770
  optionalEndTag = '';
@@ -61543,7 +61775,7 @@
61543
61775
  buffer.push('</' + tag + '>');
61544
61776
  }
61545
61777
  charsPrevTag = '/' + tag;
61546
- if (!inlineTags.has(tag)) {
61778
+ if (!inlineElements.has(tag)) {
61547
61779
  currentChars = '';
61548
61780
  } else if (isElementEmpty) {
61549
61781
  currentChars += '|';
@@ -61582,12 +61814,12 @@
61582
61814
  }
61583
61815
  trimTrailingWhitespace(tagIndex - 1, 'br');
61584
61816
  }
61585
- } else if (inlineTextTags.has(prevTag.charAt(0) === '/' ? prevTag.slice(1) : prevTag)) {
61817
+ } else if (inlineTextSet.has(prevTag.charAt(0) === '/' ? prevTag.slice(1) : prevTag)) {
61586
61818
  text = collapseWhitespace(text, options, /(?:^|\s)$/.test(currentChars));
61587
61819
  }
61588
61820
  }
61589
61821
  if (prevTag || nextTag) {
61590
- text = collapseWhitespaceSmart(text, prevTag, nextTag, options, inlineTags);
61822
+ text = collapseWhitespaceSmart(text, prevTag, nextTag, options, inlineElements, inlineTextSet);
61591
61823
  } else {
61592
61824
  text = collapseWhitespace(text, options, true, true);
61593
61825
  }
@@ -61657,7 +61889,7 @@
61657
61889
  text = prefix + text + suffix;
61658
61890
  }
61659
61891
  if (options.removeOptionalTags && text) {
61660
- // preceding comments suppress tag omissions
61892
+ // Preceding comments suppress tag omissions
61661
61893
  optionalStartTag = '';
61662
61894
  optionalEndTag = '';
61663
61895
  }