terser 5.38.0 → 5.38.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.
- package/CHANGELOG.md +4 -0
- package/dist/bundle.min.js +10 -1
- package/lib/compress/index.js +9 -1
- package/lib/parse.js +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/bundle.min.js
CHANGED
@@ -3286,6 +3286,7 @@ function parse($TEXT, options) {
|
|
3286
3286
|
return subscripts(call, true, is_chain);
|
3287
3287
|
}
|
3288
3288
|
|
3289
|
+
// Optional chain
|
3289
3290
|
if (is("punc", "?.")) {
|
3290
3291
|
next();
|
3291
3292
|
|
@@ -22137,7 +22138,15 @@ def_optimize(AST_Chain, function (self, compressor) {
|
|
22137
22138
|
}
|
22138
22139
|
return make_node(AST_Undefined, self);
|
22139
22140
|
}
|
22140
|
-
|
22141
|
+
if (
|
22142
|
+
self.expression instanceof AST_PropAccess
|
22143
|
+
|| self.expression instanceof AST_Call
|
22144
|
+
) {
|
22145
|
+
return self;
|
22146
|
+
} else {
|
22147
|
+
// Keep the AST valid, in case the child swapped itself
|
22148
|
+
return self.expression;
|
22149
|
+
}
|
22141
22150
|
});
|
22142
22151
|
|
22143
22152
|
def_optimize(AST_Dot, function(self, compressor) {
|
package/lib/compress/index.js
CHANGED
@@ -3674,7 +3674,15 @@ def_optimize(AST_Chain, function (self, compressor) {
|
|
3674
3674
|
}
|
3675
3675
|
return make_node(AST_Undefined, self);
|
3676
3676
|
}
|
3677
|
-
|
3677
|
+
if (
|
3678
|
+
self.expression instanceof AST_PropAccess
|
3679
|
+
|| self.expression instanceof AST_Call
|
3680
|
+
) {
|
3681
|
+
return self;
|
3682
|
+
} else {
|
3683
|
+
// Keep the AST valid, in case the child swapped itself
|
3684
|
+
return self.expression;
|
3685
|
+
}
|
3678
3686
|
});
|
3679
3687
|
|
3680
3688
|
def_optimize(AST_Dot, function(self, compressor) {
|
package/lib/parse.js
CHANGED