terser 5.36.0 → 5.38.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.
- package/CHANGELOG.md +10 -0
- package/README.md +2 -5
- package/dist/bundle.min.js +330 -27
- package/lib/compress/evaluate.js +7 -2
- package/lib/compress/index.js +6 -4
- package/lib/parse.js +1 -0
- package/package.json +1 -1
- package/tools/domprops.js +316 -21
- package/tools/props.html +3 -1
package/lib/compress/evaluate.js
CHANGED
@@ -117,8 +117,13 @@ AST_Node.DEFMETHOD("is_constant", function () {
|
|
117
117
|
return !(this instanceof AST_RegExp);
|
118
118
|
} else {
|
119
119
|
return this instanceof AST_UnaryPrefix
|
120
|
-
&& this.
|
121
|
-
&&
|
120
|
+
&& unaryPrefix.has(this.operator)
|
121
|
+
&& (
|
122
|
+
// `this.expression` may be an `AST_RegExp`,
|
123
|
+
// so not only `.is_constant()`.
|
124
|
+
this.expression instanceof AST_Constant
|
125
|
+
|| this.expression.is_constant()
|
126
|
+
);
|
122
127
|
}
|
123
128
|
});
|
124
129
|
|
package/lib/compress/index.js
CHANGED
@@ -524,17 +524,19 @@ AST_Toplevel.DEFMETHOD("drop_console", function(options) {
|
|
524
524
|
return;
|
525
525
|
}
|
526
526
|
|
527
|
-
if (isArray && !options.includes(exp.property)) {
|
528
|
-
return;
|
529
|
-
}
|
530
|
-
|
531
527
|
var name = exp.expression;
|
528
|
+
var property = exp.property;
|
532
529
|
var depth = 2;
|
533
530
|
while (name.expression) {
|
531
|
+
property = name.property;
|
534
532
|
name = name.expression;
|
535
533
|
depth++;
|
536
534
|
}
|
537
535
|
|
536
|
+
if (isArray && !options.includes(property)) {
|
537
|
+
return;
|
538
|
+
}
|
539
|
+
|
538
540
|
if (is_undeclared_ref(name) && name.name == "console") {
|
539
541
|
if (
|
540
542
|
depth === 3
|
package/lib/parse.js
CHANGED