terser 5.29.0 → 5.29.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## v5.29.2
4
+ - Make sure 'computed_props' creates string keys
5
+ - Take into account the evaluated size when inlining
6
+
7
+ ## v5.29.1
8
+ - fix optimisation of all-bits mask check
9
+
3
10
  ## v5.29.0
4
11
  - Re-releases previously reverted 5.28.0
5
12
  - Fix crash while optimizing some bitwise ops
@@ -17971,7 +17971,7 @@ function inline_into_symbolref(self, compressor) {
17971
17971
  let overhead = 0;
17972
17972
  if (compressor.option("unused") && !compressor.exposed(def)) {
17973
17973
  overhead =
17974
- (name_length + 2 + replace_size) /
17974
+ (name_length + 2 + fixed.size(compressor)) /
17975
17975
  (def.references.length - def.assignments);
17976
17976
  }
17977
17977
 
@@ -20549,7 +20549,7 @@ def_optimize(AST_Binary, function(self, compressor) {
20549
20549
  operator: "~",
20550
20550
  expression: x
20551
20551
  })
20552
- }), self.operator[0] === "=");
20552
+ }), self.operator[0] === "!");
20553
20553
 
20554
20554
  return best_of(compressor, optimized, self);
20555
20555
  }
@@ -22163,21 +22163,23 @@ function lift_key(self, compressor) {
22163
22163
  if (!(self.key instanceof AST_Constant)) return self;
22164
22164
  // allow certain acceptable props as not all AST_Constants are true constants
22165
22165
  if (self.key instanceof AST_String || self.key instanceof AST_Number) {
22166
- if (self.key.value === "__proto__") return self;
22167
- if (self.key.value == "constructor"
22166
+ const key = self.key.value.toString();
22167
+
22168
+ if (key === "__proto__") return self;
22169
+ if (key == "constructor"
22168
22170
  && compressor.parent() instanceof AST_Class) return self;
22169
22171
  if (self instanceof AST_ObjectKeyVal) {
22170
22172
  self.quote = self.key.quote;
22171
- self.key = self.key.value;
22173
+ self.key = key;
22172
22174
  } else if (self instanceof AST_ClassProperty) {
22173
22175
  self.quote = self.key.quote;
22174
22176
  self.key = make_node(AST_SymbolClassProperty, self.key, {
22175
- name: self.key.value
22177
+ name: key,
22176
22178
  });
22177
22179
  } else {
22178
22180
  self.quote = self.key.quote;
22179
22181
  self.key = make_node(AST_SymbolMethod, self.key, {
22180
- name: self.key.value
22182
+ name: key,
22181
22183
  });
22182
22184
  }
22183
22185
  }
@@ -2310,7 +2310,7 @@ def_optimize(AST_Binary, function(self, compressor) {
2310
2310
  operator: "~",
2311
2311
  expression: x
2312
2312
  })
2313
- }), self.operator[0] === "=");
2313
+ }), self.operator[0] === "!");
2314
2314
 
2315
2315
  return best_of(compressor, optimized, self);
2316
2316
  }
@@ -3924,21 +3924,23 @@ function lift_key(self, compressor) {
3924
3924
  if (!(self.key instanceof AST_Constant)) return self;
3925
3925
  // allow certain acceptable props as not all AST_Constants are true constants
3926
3926
  if (self.key instanceof AST_String || self.key instanceof AST_Number) {
3927
- if (self.key.value === "__proto__") return self;
3928
- if (self.key.value == "constructor"
3927
+ const key = self.key.value.toString();
3928
+
3929
+ if (key === "__proto__") return self;
3930
+ if (key == "constructor"
3929
3931
  && compressor.parent() instanceof AST_Class) return self;
3930
3932
  if (self instanceof AST_ObjectKeyVal) {
3931
3933
  self.quote = self.key.quote;
3932
- self.key = self.key.value;
3934
+ self.key = key;
3933
3935
  } else if (self instanceof AST_ClassProperty) {
3934
3936
  self.quote = self.key.quote;
3935
3937
  self.key = make_node(AST_SymbolClassProperty, self.key, {
3936
- name: self.key.value
3938
+ name: key,
3937
3939
  });
3938
3940
  } else {
3939
3941
  self.quote = self.key.quote;
3940
3942
  self.key = make_node(AST_SymbolMethod, self.key, {
3941
- name: self.key.value
3943
+ name: key,
3942
3944
  });
3943
3945
  }
3944
3946
  }
@@ -302,7 +302,7 @@ export function inline_into_symbolref(self, compressor) {
302
302
  let overhead = 0;
303
303
  if (compressor.option("unused") && !compressor.exposed(def)) {
304
304
  overhead =
305
- (name_length + 2 + replace_size) /
305
+ (name_length + 2 + fixed.size(compressor)) /
306
306
  (def.references.length - def.assignments);
307
307
  }
308
308
 
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "homepage": "https://terser.org",
5
5
  "author": "Mihai Bazon <mihai.bazon@gmail.com> (http://lisperator.net/)",
6
6
  "license": "BSD-2-Clause",
7
- "version": "5.29.0",
7
+ "version": "5.29.2",
8
8
  "engines": {
9
9
  "node": ">=10"
10
10
  },