terser 3.7.6 → 3.8.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.

Potentially problematic release.


This version of terser might be problematic. Click here for more details.

package/lib/minify.js CHANGED
@@ -246,7 +246,7 @@ function minify(files, options) {
246
246
  properties: 1e-3 * (timings.output - timings.properties),
247
247
  output: 1e-3 * (timings.end - timings.output),
248
248
  total: 1e-3 * (timings.end - timings.start)
249
- }
249
+ };
250
250
  }
251
251
  if (warnings.length) {
252
252
  result.warnings = warnings;
@@ -43,7 +43,7 @@
43
43
 
44
44
  "use strict";
45
45
 
46
- (function(){
46
+ (function() {
47
47
 
48
48
  var normalize_directives = function(body) {
49
49
  var in_directive = true;
@@ -260,7 +260,7 @@
260
260
  return new AST_Array({
261
261
  start : my_start_token(M),
262
262
  end : my_end_token(M),
263
- elements : M.elements.map(function(elem){
263
+ elements : M.elements.map(function(elem) {
264
264
  return elem === null ? new AST_Hole() : from_moz(elem);
265
265
  })
266
266
  });
@@ -269,12 +269,12 @@
269
269
  return new AST_Object({
270
270
  start : my_start_token(M),
271
271
  end : my_end_token(M),
272
- properties : M.properties.map(function(prop){
272
+ properties : M.properties.map(function(prop) {
273
273
  if (prop.type === "SpreadElement") {
274
274
  return from_moz(prop);
275
275
  }
276
276
  prop.type = "Property";
277
- return from_moz(prop)
277
+ return from_moz(prop);
278
278
  })
279
279
  });
280
280
  },
@@ -340,7 +340,7 @@
340
340
  imported_name: imported_name,
341
341
  imported_names : imported_names,
342
342
  module_name : from_moz(M.source)
343
- })
343
+ });
344
344
  },
345
345
  ExportAllDeclaration: function(M) {
346
346
  return new AST_Export({
@@ -364,7 +364,7 @@
364
364
  return new AST_NameMapping({
365
365
  foreign_name: from_moz(specifier.exported),
366
366
  name: from_moz(specifier.local)
367
- })
367
+ });
368
368
  }) : null,
369
369
  module_name: from_moz(M.source)
370
370
  });
@@ -476,7 +476,7 @@
476
476
  map("DoWhileStatement", AST_Do, "test>condition, body>body");
477
477
  map("ForStatement", AST_For, "init>init, test>condition, update>step, body>body");
478
478
  map("ForInStatement", AST_ForIn, "left>init, right>object, body>body");
479
- map("ForOfStatement", AST_ForOf, "left>init, right>object, body>body");
479
+ map("ForOfStatement", AST_ForOf, "left>init, right>object, body>body, await=await");
480
480
  map("AwaitExpression", AST_Await, "argument>expression");
481
481
  map("YieldExpression", AST_Yield, "argument>expression, delegate=is_star");
482
482
  map("DebuggerStatement", AST_Debugger);
@@ -543,12 +543,12 @@
543
543
  generator: M.is_generator,
544
544
  async: M.async,
545
545
  body: to_moz_scope("BlockStatement", M)
546
- }
546
+ };
547
547
  });
548
548
 
549
549
  def_to_moz(AST_Function, function To_Moz_FunctionExpression(M, parent) {
550
550
  var is_generator = parent.is_generator !== undefined ?
551
- parent.is_generator : M.is_generator
551
+ parent.is_generator : M.is_generator;
552
552
  return {
553
553
  type: "FunctionExpression",
554
554
  id: to_moz(M.name),
@@ -556,7 +556,7 @@
556
556
  generator: is_generator,
557
557
  async: M.async,
558
558
  body: to_moz_scope("BlockStatement", M)
559
- }
559
+ };
560
560
  });
561
561
 
562
562
  def_to_moz(AST_Arrow, function To_Moz_ArrowFunctionExpression(M) {
@@ -569,7 +569,7 @@
569
569
  params: M.argnames.map(to_moz),
570
570
  async: M.async,
571
571
  body: body
572
- }
572
+ };
573
573
  });
574
574
 
575
575
  def_to_moz(AST_Destructuring, function To_Moz_ObjectPattern(M) {
@@ -577,7 +577,7 @@
577
577
  return {
578
578
  type: "ArrayPattern",
579
579
  elements: M.names.map(to_moz)
580
- }
580
+ };
581
581
  }
582
582
  return {
583
583
  type: "ObjectPattern",
@@ -674,7 +674,7 @@
674
674
  local: to_moz(M.imported_name)
675
675
  });
676
676
  }
677
- if (M.imported_names && M.imported_names[0].foreign_name.name === '*') {
677
+ if (M.imported_names && M.imported_names[0].foreign_name.name === "*") {
678
678
  specifiers.push({
679
679
  type: "ImportNamespaceSpecifier",
680
680
  local: to_moz(M.imported_names[0].name)
@@ -692,7 +692,7 @@
692
692
  type: "ImportDeclaration",
693
693
  specifiers: specifiers,
694
694
  source: to_moz(M.module_name)
695
- }
695
+ };
696
696
  });
697
697
 
698
698
  def_to_moz(AST_Sequence, function To_Moz_SequenceExpression(M) {
@@ -832,7 +832,7 @@
832
832
  type: "ClassBody",
833
833
  body: M.properties.map(to_moz)
834
834
  }
835
- }
835
+ };
836
836
  });
837
837
 
838
838
  def_to_moz(AST_NewTarget, function To_Moz_MetaProperty(M) {
@@ -865,7 +865,7 @@
865
865
 
866
866
  def_to_moz(AST_RegExp, function To_Moz_RegExpLiteral(M) {
867
867
  var pattern = M.value.source;
868
- var flags = M.value.toString().match(/[gimuy]*$/)[0];
868
+ var flags = M.value.toString().match(/[gimuys]*$/)[0];
869
869
  return {
870
870
  type: "Literal",
871
871
  value: new RegExp(pattern, flags),
@@ -879,7 +879,7 @@
879
879
 
880
880
  def_to_moz(AST_Constant, function To_Moz_Literal(M) {
881
881
  var value = M.value;
882
- if (typeof value === 'number' && (value < 0 || (value === 0 && 1 / value < 0))) {
882
+ if (typeof value === "number" && (value < 0 || (value === 0 && 1 / value < 0))) {
883
883
  return {
884
884
  type: "UnaryExpression",
885
885
  operator: "-",
@@ -907,7 +907,7 @@
907
907
 
908
908
  AST_Boolean.DEFMETHOD("to_mozilla_ast", AST_Constant.prototype.to_mozilla_ast);
909
909
  AST_Null.DEFMETHOD("to_mozilla_ast", AST_Constant.prototype.to_mozilla_ast);
910
- AST_Hole.DEFMETHOD("to_mozilla_ast", function To_Moz_ArrayHole() { return null });
910
+ AST_Hole.DEFMETHOD("to_mozilla_ast", function To_Moz_ArrayHole() { return null; });
911
911
 
912
912
  AST_Block.DEFMETHOD("to_mozilla_ast", AST_BlockStatement.prototype.to_mozilla_ast);
913
913
  AST_Lambda.DEFMETHOD("to_mozilla_ast", AST_Function.prototype.to_mozilla_ast);
@@ -933,7 +933,7 @@
933
933
  endpos : range ? range[0] : moznode.start,
934
934
  raw : raw_token(moznode),
935
935
  });
936
- };
936
+ }
937
937
 
938
938
  function my_end_token(moznode) {
939
939
  var loc = moznode.loc, end = loc && loc.end;
@@ -948,7 +948,7 @@
948
948
  endpos : range ? range[1] : moznode.end,
949
949
  raw : raw_token(moznode),
950
950
  });
951
- };
951
+ }
952
952
 
953
953
  function map(moztype, mytype, propmap) {
954
954
  var moz_to_me = "function From_Moz_" + moztype + "(M){\n";
@@ -960,7 +960,7 @@
960
960
  me_to_moz += "return {\n" +
961
961
  "type: " + JSON.stringify(moztype);
962
962
 
963
- if (propmap) propmap.split(/\s*,\s*/).forEach(function(prop){
963
+ if (propmap) propmap.split(/\s*,\s*/).forEach(function(prop) {
964
964
  var m = /([a-z0-9$_]+)(=|@|>|%)([a-z0-9$_]+)/i.exec(prop);
965
965
  if (!m) throw new Error("Can't understand property map: " + prop);
966
966
  var moz = m[1], how = m[2], my = m[3];
@@ -1003,7 +1003,7 @@
1003
1003
  );
1004
1004
  MOZ_TO_ME[moztype] = moz_to_me;
1005
1005
  def_to_moz(mytype, me_to_moz);
1006
- };
1006
+ }
1007
1007
 
1008
1008
  var FROM_MOZ_STACK = null;
1009
1009
 
@@ -1012,9 +1012,9 @@
1012
1012
  var ret = node != null ? MOZ_TO_ME[node.type](node) : null;
1013
1013
  FROM_MOZ_STACK.pop();
1014
1014
  return ret;
1015
- };
1015
+ }
1016
1016
 
1017
- AST_Node.from_mozilla_ast = function(node){
1017
+ AST_Node.from_mozilla_ast = function(node) {
1018
1018
  var save_stack = FROM_MOZ_STACK;
1019
1019
  FROM_MOZ_STACK = [];
1020
1020
  var ast = from_moz(node);
@@ -1038,13 +1038,13 @@
1038
1038
  }
1039
1039
  }
1040
1040
  return moznode;
1041
- };
1041
+ }
1042
1042
 
1043
1043
  function def_to_moz(mytype, handler) {
1044
1044
  mytype.DEFMETHOD("to_mozilla_ast", function(parent) {
1045
1045
  return set_moz_loc(this, handler(this, parent));
1046
1046
  });
1047
- };
1047
+ }
1048
1048
 
1049
1049
  var TO_MOZ_STACK = null;
1050
1050
 
@@ -1054,8 +1054,8 @@
1054
1054
  var ast = node != null ? node.to_mozilla_ast(TO_MOZ_STACK[TO_MOZ_STACK.length - 2]) : null;
1055
1055
  TO_MOZ_STACK.pop();
1056
1056
  if (TO_MOZ_STACK.length === 0) { TO_MOZ_STACK = null; }
1057
- return ast
1058
- };
1057
+ return ast;
1058
+ }
1059
1059
 
1060
1060
  function to_moz_in_destructuring() {
1061
1061
  var i = TO_MOZ_STACK.length;
@@ -1065,14 +1065,14 @@
1065
1065
  }
1066
1066
  }
1067
1067
  return false;
1068
- };
1068
+ }
1069
1069
 
1070
1070
  function to_moz_block(node) {
1071
1071
  return {
1072
1072
  type: "BlockStatement",
1073
1073
  body: node.body.map(to_moz)
1074
1074
  };
1075
- };
1075
+ }
1076
1076
 
1077
1077
  function to_moz_scope(type, node) {
1078
1078
  var body = node.body.map(to_moz);
@@ -1083,5 +1083,5 @@
1083
1083
  type: type,
1084
1084
  body: body
1085
1085
  };
1086
- };
1086
+ }
1087
1087
  })();