terser 5.30.4 → 5.31.0

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.
@@ -3758,7 +3758,7 @@ def_optimize(AST_Array, function(self, compressor) {
3758
3758
  return self;
3759
3759
  });
3760
3760
 
3761
- function inline_object_prop_spread(props, compressor) {
3761
+ function inline_object_prop_spread(props) {
3762
3762
  for (var i = 0; i < props.length; i++) {
3763
3763
  var prop = props[i];
3764
3764
  if (prop instanceof AST_Expansion) {
@@ -3770,15 +3770,14 @@ function inline_object_prop_spread(props, compressor) {
3770
3770
  props.splice(i, 1, ...expr.properties);
3771
3771
  // Step back one, as the property at i is now new.
3772
3772
  i--;
3773
- } else if (expr instanceof AST_Constant
3774
- && !(expr instanceof AST_String)) {
3773
+ } else if ((
3774
+ // `expr.is_constant()` returns `false` for `AST_RegExp`, so need both.
3775
+ expr instanceof AST_Constant
3776
+ || expr.is_constant()
3777
+ ) && !(expr instanceof AST_String)) {
3775
3778
  // Unlike array-like spread, in object spread, spreading a
3776
3779
  // non-iterable value silently does nothing; it is thus safe
3777
- // to remove. AST_String is the only iterable AST_Constant.
3778
- props.splice(i, 1);
3779
- i--;
3780
- } else if (is_nullish(expr, compressor)) {
3781
- // Likewise, null and undefined can be silently removed.
3780
+ // to remove. AST_String is the only iterable constant.
3782
3781
  props.splice(i, 1);
3783
3782
  i--;
3784
3783
  }
@@ -3791,7 +3790,7 @@ def_optimize(AST_Object, function(self, compressor) {
3791
3790
  if (optimized !== self) {
3792
3791
  return optimized;
3793
3792
  }
3794
- inline_object_prop_spread(self.properties, compressor);
3793
+ inline_object_prop_spread(self.properties);
3795
3794
  return self;
3796
3795
  });
3797
3796
 
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.30.4",
7
+ "version": "5.31.0",
8
8
  "engines": {
9
9
  "node": ">=10"
10
10
  },