terser 5.31.3 → 5.31.4
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 +3 -0
- package/dist/bundle.min.js +5 -2
- package/lib/ast.js +3 -0
- package/lib/compress/drop-side-effect-free.js +1 -1
- package/lib/compress/drop-unused.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/bundle.min.js
CHANGED
@@ -5905,6 +5905,9 @@ var AST_Class = DEFNODE("Class", "name extends properties", function AST_Class(p
|
|
5905
5905
|
}));
|
5906
5906
|
return found;
|
5907
5907
|
},
|
5908
|
+
body_has_side_effects(compressor) {
|
5909
|
+
return this.properties.some(prop => prop.has_side_effects(compressor));
|
5910
|
+
},
|
5908
5911
|
}, AST_Scope /* TODO a class might have a scope but it's not a scope */);
|
5909
5912
|
|
5910
5913
|
var AST_ClassProperty = DEFNODE("ClassProperty", "static quote", function AST_ClassProperty(props) {
|
@@ -14979,7 +14982,7 @@ def_drop_side_effect_free(AST_Arrow, return_null);
|
|
14979
14982
|
def_drop_side_effect_free(AST_Class, function (compressor) {
|
14980
14983
|
const with_effects = [];
|
14981
14984
|
|
14982
|
-
if (this.is_self_referential() && this.
|
14985
|
+
if (this.is_self_referential() && this.body_has_side_effects(compressor)) {
|
14983
14986
|
return this;
|
14984
14987
|
}
|
14985
14988
|
|
@@ -15287,7 +15290,7 @@ AST_Scope.DEFMETHOD("drop_unused", function(compressor) {
|
|
15287
15290
|
});
|
15288
15291
|
}
|
15289
15292
|
if (node === self) return;
|
15290
|
-
if (node instanceof AST_Class && node.
|
15293
|
+
if (node instanceof AST_Class && node.body_has_side_effects(compressor)) {
|
15291
15294
|
if (node.is_self_referential()) {
|
15292
15295
|
descend();
|
15293
15296
|
} else {
|
package/lib/ast.js
CHANGED
@@ -2289,6 +2289,9 @@ var AST_Class = DEFNODE("Class", "name extends properties", function AST_Class(p
|
|
2289
2289
|
}));
|
2290
2290
|
return found;
|
2291
2291
|
},
|
2292
|
+
body_has_side_effects(compressor) {
|
2293
|
+
return this.properties.some(prop => prop.has_side_effects(compressor));
|
2294
|
+
},
|
2292
2295
|
}, AST_Scope /* TODO a class might have a scope but it's not a scope */);
|
2293
2296
|
|
2294
2297
|
var AST_ClassProperty = DEFNODE("ClassProperty", "static quote", function AST_ClassProperty(props) {
|
@@ -156,7 +156,7 @@ def_drop_side_effect_free(AST_Arrow, return_null);
|
|
156
156
|
def_drop_side_effect_free(AST_Class, function (compressor) {
|
157
157
|
const with_effects = [];
|
158
158
|
|
159
|
-
if (this.is_self_referential() && this.
|
159
|
+
if (this.is_self_referential() && this.body_has_side_effects(compressor)) {
|
160
160
|
return this;
|
161
161
|
}
|
162
162
|
|
@@ -153,7 +153,7 @@ AST_Scope.DEFMETHOD("drop_unused", function(compressor) {
|
|
153
153
|
});
|
154
154
|
}
|
155
155
|
if (node === self) return;
|
156
|
-
if (node instanceof AST_Class && node.
|
156
|
+
if (node instanceof AST_Class && node.body_has_side_effects(compressor)) {
|
157
157
|
if (node.is_self_referential()) {
|
158
158
|
descend();
|
159
159
|
} else {
|