terser 5.43.0 → 5.43.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 +5 -0
- package/dist/bundle.min.js +6 -3
- package/lib/compress/tighten-body.js +6 -3
- package/package.json +1 -1
- package/tools/terser.d.ts +1 -0
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v5.43.1
|
4
|
+
|
5
|
+
- Prevent niche optimizations that would move around block declarations
|
6
|
+
- Add `lhs_constants` to `CompressOptions` type (#1621)
|
7
|
+
|
3
8
|
## v5.43.0
|
4
9
|
|
5
10
|
- Do not wrap callbacks in parentheses (`wrap_func_args` format option is now false by default)
|
package/dist/bundle.min.js
CHANGED
@@ -17830,7 +17830,7 @@ function tighten_body(statements, compressor) {
|
|
17830
17830
|
stat = stat.clone();
|
17831
17831
|
stat.condition = stat.condition.negate(compressor);
|
17832
17832
|
stat.body = make_node(AST_BlockStatement, stat, {
|
17833
|
-
body: as_statement_array(stat.alternative).concat(
|
17833
|
+
body: as_statement_array(stat.alternative).concat(extract_defuns())
|
17834
17834
|
});
|
17835
17835
|
stat.alternative = make_node(AST_BlockStatement, stat, {
|
17836
17836
|
body: new_else
|
@@ -17850,7 +17850,7 @@ function tighten_body(statements, compressor) {
|
|
17850
17850
|
CHANGED = true;
|
17851
17851
|
stat = stat.clone();
|
17852
17852
|
stat.body = make_node(AST_BlockStatement, stat.body, {
|
17853
|
-
body: as_statement_array(stat.body).concat(
|
17853
|
+
body: as_statement_array(stat.body).concat(extract_defuns())
|
17854
17854
|
});
|
17855
17855
|
stat.alternative = make_node(AST_BlockStatement, stat.alternative, {
|
17856
17856
|
body: new_else
|
@@ -17955,7 +17955,7 @@ function tighten_body(statements, compressor) {
|
|
17955
17955
|
|| ab instanceof AST_Break && lct instanceof AST_BlockStatement && self === lct;
|
17956
17956
|
}
|
17957
17957
|
|
17958
|
-
function
|
17958
|
+
function extract_defuns() {
|
17959
17959
|
var tail = statements.slice(i + 1);
|
17960
17960
|
statements.length = i + 1;
|
17961
17961
|
return tail.filter(function (stat) {
|
@@ -17973,6 +17973,9 @@ function tighten_body(statements, compressor) {
|
|
17973
17973
|
return undefined;
|
17974
17974
|
}
|
17975
17975
|
body = body.slice(0, -1);
|
17976
|
+
if (!body.every(stat => can_be_evicted_from_block(stat))) {
|
17977
|
+
return undefined;
|
17978
|
+
}
|
17976
17979
|
if (ab.value) {
|
17977
17980
|
body.push(make_node(AST_SimpleStatement, ab.value, {
|
17978
17981
|
body: ab.value.expression
|
@@ -1031,7 +1031,7 @@ export function tighten_body(statements, compressor) {
|
|
1031
1031
|
stat = stat.clone();
|
1032
1032
|
stat.condition = stat.condition.negate(compressor);
|
1033
1033
|
stat.body = make_node(AST_BlockStatement, stat, {
|
1034
|
-
body: as_statement_array(stat.alternative).concat(
|
1034
|
+
body: as_statement_array(stat.alternative).concat(extract_defuns())
|
1035
1035
|
});
|
1036
1036
|
stat.alternative = make_node(AST_BlockStatement, stat, {
|
1037
1037
|
body: new_else
|
@@ -1051,7 +1051,7 @@ export function tighten_body(statements, compressor) {
|
|
1051
1051
|
CHANGED = true;
|
1052
1052
|
stat = stat.clone();
|
1053
1053
|
stat.body = make_node(AST_BlockStatement, stat.body, {
|
1054
|
-
body: as_statement_array(stat.body).concat(
|
1054
|
+
body: as_statement_array(stat.body).concat(extract_defuns())
|
1055
1055
|
});
|
1056
1056
|
stat.alternative = make_node(AST_BlockStatement, stat.alternative, {
|
1057
1057
|
body: new_else
|
@@ -1156,7 +1156,7 @@ export function tighten_body(statements, compressor) {
|
|
1156
1156
|
|| ab instanceof AST_Break && lct instanceof AST_BlockStatement && self === lct;
|
1157
1157
|
}
|
1158
1158
|
|
1159
|
-
function
|
1159
|
+
function extract_defuns() {
|
1160
1160
|
var tail = statements.slice(i + 1);
|
1161
1161
|
statements.length = i + 1;
|
1162
1162
|
return tail.filter(function (stat) {
|
@@ -1174,6 +1174,9 @@ export function tighten_body(statements, compressor) {
|
|
1174
1174
|
return undefined;
|
1175
1175
|
}
|
1176
1176
|
body = body.slice(0, -1);
|
1177
|
+
if (!body.every(stat => can_be_evicted_from_block(stat))) {
|
1178
|
+
return undefined;
|
1179
|
+
}
|
1177
1180
|
if (ab.value) {
|
1178
1181
|
body.push(make_node(AST_SimpleStatement, ab.value, {
|
1179
1182
|
body: ab.value.expression
|
package/package.json
CHANGED