terser 3.10.12 → 3.10.13

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/compress.js CHANGED
@@ -5748,6 +5748,19 @@ merge(Compressor.prototype, {
5748
5748
  return node;
5749
5749
  }
5750
5750
 
5751
+ function within_array_or_object_literal(compressor) {
5752
+ var node, level = 0;
5753
+ while (node = compressor.parent(level++)) {
5754
+ if (node instanceof AST_Statement) return false;
5755
+ if (node instanceof AST_Array
5756
+ || node instanceof AST_ObjectKeyVal
5757
+ || node instanceof AST_Object) {
5758
+ return true;
5759
+ }
5760
+ }
5761
+ return false;
5762
+ }
5763
+
5751
5764
  OPT(AST_SymbolRef, function(self, compressor) {
5752
5765
  if (!compressor.option("ie8")
5753
5766
  && is_undeclared_ref(self)
@@ -5779,7 +5792,8 @@ merge(Compressor.prototype, {
5779
5792
  } else if (d.scope !== self.scope
5780
5793
  && (!compressor.option("reduce_funcs") && fixed instanceof AST_Lambda
5781
5794
  || d.escaped == 1
5782
- || fixed.inlined)) {
5795
+ || fixed.inlined
5796
+ || within_array_or_object_literal(compressor))) {
5783
5797
  single_use = false;
5784
5798
  } else if (recursive_ref(compressor, d)) {
5785
5799
  single_use = false;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "homepage": "https://github.com/fabiosantoscode/terser",
5
5
  "author": "Mihai Bazon <mihai.bazon@gmail.com> (http://lisperator.net/)",
6
6
  "license": "BSD-2-Clause",
7
- "version": "3.10.12",
7
+ "version": "3.10.13",
8
8
  "engines": {
9
9
  "node": ">=0.8.0"
10
10
  },