terser 5.30.1 → 5.30.2
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 +16 -0
- package/lib/compress/index.js +11 -0
- package/lib/compress/inline.js +4 -0
- package/lib/compress/tighten-body.js +3 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v5.30.2
|
4
|
+
- Avoid optimizations inside computed keys, because they can cause js-engine-specific bugs.
|
5
|
+
|
3
6
|
## v5.30.1
|
4
7
|
- Removed useless `\` escapes for non-ascii characters
|
5
8
|
- Make modern identifier characters quoted for older environments (#1512)
|
package/dist/bundle.min.js
CHANGED
@@ -16560,6 +16560,7 @@ function tighten_body(statements, compressor) {
|
|
16560
16560
|
|| node instanceof AST_SymbolRef
|
16561
16561
|
&& parent instanceof AST_Call
|
16562
16562
|
&& has_annotation(parent, _NOINLINE)
|
16563
|
+
|| node instanceof AST_ObjectProperty && node.key instanceof AST_Node
|
16563
16564
|
) {
|
16564
16565
|
abort = true;
|
16565
16566
|
return node;
|
@@ -17842,6 +17843,8 @@ function is_const_symbol_short_than_init_value(def, fixed_value) {
|
|
17842
17843
|
}
|
17843
17844
|
|
17844
17845
|
function inline_into_symbolref(self, compressor) {
|
17846
|
+
if (compressor.in_computed_key()) return self;
|
17847
|
+
|
17845
17848
|
const parent = compressor.parent();
|
17846
17849
|
const def = self.definition();
|
17847
17850
|
const nearest_scope = compressor.find_scope();
|
@@ -17991,6 +17994,8 @@ function inline_into_symbolref(self, compressor) {
|
|
17991
17994
|
}
|
17992
17995
|
|
17993
17996
|
function inline_into_call(self, compressor) {
|
17997
|
+
if (compressor.in_computed_key()) return self;
|
17998
|
+
|
17994
17999
|
var exp = self.expression;
|
17995
18000
|
var fn = exp;
|
17996
18001
|
var simple_args = self.args.every((arg) => !(arg instanceof AST_Expansion));
|
@@ -18646,6 +18651,17 @@ class Compressor extends TreeWalker {
|
|
18646
18651
|
}
|
18647
18652
|
}
|
18648
18653
|
|
18654
|
+
in_computed_key() {
|
18655
|
+
if (!this.option("evaluate")) return false;
|
18656
|
+
var self = this.self();
|
18657
|
+
for (var i = 0, p; p = this.parent(i); i++) {
|
18658
|
+
if (p instanceof AST_ObjectProperty && p.key === self) {
|
18659
|
+
return true;
|
18660
|
+
}
|
18661
|
+
}
|
18662
|
+
return false;
|
18663
|
+
}
|
18664
|
+
|
18649
18665
|
get_toplevel() {
|
18650
18666
|
return this._toplevel;
|
18651
18667
|
}
|
package/lib/compress/index.js
CHANGED
@@ -401,6 +401,17 @@ class Compressor extends TreeWalker {
|
|
401
401
|
}
|
402
402
|
}
|
403
403
|
|
404
|
+
in_computed_key() {
|
405
|
+
if (!this.option("evaluate")) return false;
|
406
|
+
var self = this.self();
|
407
|
+
for (var i = 0, p; p = this.parent(i); i++) {
|
408
|
+
if (p instanceof AST_ObjectProperty && p.key === self) {
|
409
|
+
return true;
|
410
|
+
}
|
411
|
+
}
|
412
|
+
return false;
|
413
|
+
}
|
414
|
+
|
404
415
|
get_toplevel() {
|
405
416
|
return this._toplevel;
|
406
417
|
}
|
package/lib/compress/inline.js
CHANGED
@@ -167,6 +167,8 @@ function is_const_symbol_short_than_init_value(def, fixed_value) {
|
|
167
167
|
}
|
168
168
|
|
169
169
|
export function inline_into_symbolref(self, compressor) {
|
170
|
+
if (compressor.in_computed_key()) return self;
|
171
|
+
|
170
172
|
const parent = compressor.parent();
|
171
173
|
const def = self.definition();
|
172
174
|
const nearest_scope = compressor.find_scope();
|
@@ -316,6 +318,8 @@ export function inline_into_symbolref(self, compressor) {
|
|
316
318
|
}
|
317
319
|
|
318
320
|
export function inline_into_call(self, compressor) {
|
321
|
+
if (compressor.in_computed_key()) return self;
|
322
|
+
|
319
323
|
var exp = self.expression;
|
320
324
|
var fn = exp;
|
321
325
|
var simple_args = self.args.every((arg) => !(arg instanceof AST_Expansion));
|
@@ -82,6 +82,7 @@ import {
|
|
82
82
|
AST_Number,
|
83
83
|
AST_Object,
|
84
84
|
AST_ObjectKeyVal,
|
85
|
+
AST_ObjectProperty,
|
85
86
|
AST_PropAccess,
|
86
87
|
AST_RegExp,
|
87
88
|
AST_Return,
|
@@ -116,7 +117,7 @@ import {
|
|
116
117
|
walk,
|
117
118
|
walk_abort,
|
118
119
|
|
119
|
-
_NOINLINE
|
120
|
+
_NOINLINE,
|
120
121
|
} from "../ast.js";
|
121
122
|
import {
|
122
123
|
make_node,
|
@@ -328,6 +329,7 @@ export function tighten_body(statements, compressor) {
|
|
328
329
|
|| node instanceof AST_SymbolRef
|
329
330
|
&& parent instanceof AST_Call
|
330
331
|
&& has_annotation(parent, _NOINLINE)
|
332
|
+
|| node instanceof AST_ObjectProperty && node.key instanceof AST_Node
|
331
333
|
) {
|
332
334
|
abort = true;
|
333
335
|
return node;
|