From 69b5f799f3d40947ce3b5bc851ee44d3caad5328 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Thu, 6 Jan 2022 20:49:10 +0900 Subject: [PATCH] fix(es/minifier): Disable inlining of expressions from `collapse_vars` (#3200) swc_ecma_minifier: - `collapse_vars`: Disable for member expressions. (Closes #2614) - `sequences`: Respect `inline_prevented`. --- .../swc/tests/fixture/issue-2614/input/.swcrc | 10 + .../tests/fixture/issue-2614/input/index.js | 7 + .../tests/fixture/issue-2614/output/index.js | 4 + ...rtNotAsPrimaryExpression_es5.2.minified.js | 2 +- ...rtNotAsPrimaryExpression_es5.2.minified.js | 2 +- ...tPatternWithNestedSpread_es5.2.minified.js | 4 +- ...odulekindWithES5Target12_es5.2.minified.js | 2 +- ...odulekindWithES5Target12_es5.2.minified.js | 2 +- ...xportsAndImports1-amd_es2015.2.minified.js | 2 +- .../exportsAndImports1-amd_es5.2.minified.js | 2 +- ...xportsAndImports1-es6_es2015.2.minified.js | 2 +- .../exportsAndImports1-es6_es5.2.minified.js | 2 +- .../exportsAndImports1_es2015.2.minified.js | 2 +- .../exportsAndImports1_es5.2.minified.js | 2 +- ...xportsAndImports3-amd_es2015.2.minified.js | 2 +- .../exportsAndImports3-amd_es5.2.minified.js | 2 +- ...xportsAndImports3-es6_es2015.2.minified.js | 2 +- .../exportsAndImports3-es6_es5.2.minified.js | 2 +- .../exportsAndImports3_es2015.2.minified.js | 2 +- .../exportsAndImports3_es5.2.minified.js | 2 +- ...ixinAbstractClasses.2_es2015.2.minified.js | 7 +- ...tesWithTypeArguments1_es2015.2.minified.js | 4 +- ...platesWithTypeArguments1_es5.2.minified.js | 4 +- .../typeofAnExportedType_es2015.2.minified.js | 2 +- .../typeofAnExportedType_es5.2.minified.js | 2 +- crates/swc_ecma_minifier/src/compress/mod.rs | 2 +- .../src/compress/optimize/collapse_vars.rs | 5 +- .../src/compress/optimize/mod.rs | 4 +- .../src/compress/optimize/sequences.rs | 8 + .../fixture/issues/2257/full/output.js | 2 +- .../compress/fixture/issues/2614/1/input.js | 7 + .../compress/fixture/issues/2614/1/output.js | 3 + .../issues/firebase-firestore/1/output.js | 220 +++++++++--------- .../fixture/issues/moment/1/output.js | 2 +- .../projects/output/jquery.mobile-1.4.2.js | 12 +- .../tests/projects/output/react-dom-17.0.2.js | 31 +-- .../drop-unused/assign_binding/output.js | 3 +- 37 files changed, 207 insertions(+), 168 deletions(-) create mode 100644 crates/swc/tests/fixture/issue-2614/input/.swcrc create mode 100644 crates/swc/tests/fixture/issue-2614/input/index.js create mode 100644 crates/swc/tests/fixture/issue-2614/output/index.js create mode 100644 crates/swc_ecma_minifier/tests/compress/fixture/issues/2614/1/input.js create mode 100644 crates/swc_ecma_minifier/tests/compress/fixture/issues/2614/1/output.js diff --git a/crates/swc/tests/fixture/issue-2614/input/.swcrc b/crates/swc/tests/fixture/issue-2614/input/.swcrc new file mode 100644 index 00000000000..3302c274e89 --- /dev/null +++ b/crates/swc/tests/fixture/issue-2614/input/.swcrc @@ -0,0 +1,10 @@ +{ + "jsc": { + "minify": { + "mangle": false, + "compress": true, + "toplevel": true, + "module": true + } + } +} \ No newline at end of file diff --git a/crates/swc/tests/fixture/issue-2614/input/index.js b/crates/swc/tests/fixture/issue-2614/input/index.js new file mode 100644 index 00000000000..c75489cb34b --- /dev/null +++ b/crates/swc/tests/fixture/issue-2614/input/index.js @@ -0,0 +1,7 @@ +expose(() => export_default); + +var foo = require("70jDX"); + +var Value; +Value = foo.default; +var export_default = Value; \ No newline at end of file diff --git a/crates/swc/tests/fixture/issue-2614/output/index.js b/crates/swc/tests/fixture/issue-2614/output/index.js new file mode 100644 index 00000000000..ed364a53382 --- /dev/null +++ b/crates/swc/tests/fixture/issue-2614/output/index.js @@ -0,0 +1,4 @@ +expose(function() { + return export_default; +}); +var export_default = require("70jDX").default; diff --git a/crates/swc/tests/tsc-references/amdImportNotAsPrimaryExpression_es5.2.minified.js b/crates/swc/tests/tsc-references/amdImportNotAsPrimaryExpression_es5.2.minified.js index 1f2f151f729..93e10575f68 100644 --- a/crates/swc/tests/tsc-references/amdImportNotAsPrimaryExpression_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/amdImportNotAsPrimaryExpression_es5.2.minified.js @@ -4,4 +4,4 @@ export var E1, E1, i, z, C1 = function() { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); }(this, C1), this.m1 = 42; }; -C1.s1 = !0, (E1 = E1 || (E1 = {}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C", require("./foo_0"); +C1.s1 = !0, E1 = E1 || (E1 = {}), E1[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C", require("./foo_0"); diff --git a/crates/swc/tests/tsc-references/commonJSImportNotAsPrimaryExpression_es5.2.minified.js b/crates/swc/tests/tsc-references/commonJSImportNotAsPrimaryExpression_es5.2.minified.js index 1f2f151f729..93e10575f68 100644 --- a/crates/swc/tests/tsc-references/commonJSImportNotAsPrimaryExpression_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/commonJSImportNotAsPrimaryExpression_es5.2.minified.js @@ -4,4 +4,4 @@ export var E1, E1, i, z, C1 = function() { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); }(this, C1), this.m1 = 42; }; -C1.s1 = !0, (E1 = E1 || (E1 = {}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C", require("./foo_0"); +C1.s1 = !0, E1 = E1 || (E1 = {}), E1[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C", require("./foo_0"); diff --git a/crates/swc/tests/tsc-references/destructuringObjectAssignmentPatternWithNestedSpread_es5.2.minified.js b/crates/swc/tests/tsc-references/destructuringObjectAssignmentPatternWithNestedSpread_es5.2.minified.js index db390f76461..bdea63ce43f 100644 --- a/crates/swc/tests/tsc-references/destructuringObjectAssignmentPatternWithNestedSpread_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringObjectAssignmentPatternWithNestedSpread_es5.2.minified.js @@ -1,4 +1,4 @@ -var _c; +var _c, d; (function(source, excluded) { if (null == source) return {}; var key, i, target = function(source, excluded) { @@ -18,4 +18,4 @@ var _c; } }).x, [ "a" -]), (void 0 === _c.x, _c.x).a; +]), (void 0 === (d = _c.x), d).a; diff --git a/crates/swc/tests/tsc-references/es6modulekindWithES5Target12_es5.2.minified.js b/crates/swc/tests/tsc-references/es6modulekindWithES5Target12_es5.2.minified.js index ab17ca4acad..097d5579278 100644 --- a/crates/swc/tests/tsc-references/es6modulekindWithES5Target12_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/es6modulekindWithES5Target12_es5.2.minified.js @@ -4,6 +4,6 @@ export var E, E, E, C = function() { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); }(this, C); }; -(C || (C = {})).x = 1, (E = E || (E = {}))[E.w = 1] = "w", (E = E || (E = {}))[E.x = 2] = "x", (E || (E = {})).y = 1, (E || (E = {})).z = 1, (N || (N = {})).x = 1; +(C || (C = {})).x = 1, E = E || (E = {}), E[E.w = 1] = "w", E = E || (E = {}), E[E.x = 2] = "x", (E || (E = {})).y = 1, (E || (E = {})).z = 1, (N || (N = {})).x = 1; export function F() {} (F || (F = {})).x = 1; diff --git a/crates/swc/tests/tsc-references/esnextmodulekindWithES5Target12_es5.2.minified.js b/crates/swc/tests/tsc-references/esnextmodulekindWithES5Target12_es5.2.minified.js index ab17ca4acad..097d5579278 100644 --- a/crates/swc/tests/tsc-references/esnextmodulekindWithES5Target12_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/esnextmodulekindWithES5Target12_es5.2.minified.js @@ -4,6 +4,6 @@ export var E, E, E, C = function() { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); }(this, C); }; -(C || (C = {})).x = 1, (E = E || (E = {}))[E.w = 1] = "w", (E = E || (E = {}))[E.x = 2] = "x", (E || (E = {})).y = 1, (E || (E = {})).z = 1, (N || (N = {})).x = 1; +(C || (C = {})).x = 1, E = E || (E = {}), E[E.w = 1] = "w", E = E || (E = {}), E[E.x = 2] = "x", (E || (E = {})).y = 1, (E || (E = {})).z = 1, (N || (N = {})).x = 1; export function F() {} (F || (F = {})).x = 1; diff --git a/crates/swc/tests/tsc-references/exportsAndImports1-amd_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports1-amd_es2015.2.minified.js index e46bf44ffe8..517ab972b2a 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports1-amd_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports1-amd_es2015.2.minified.js @@ -3,7 +3,7 @@ var E, D, E, D, M, v = 1; function f() {} class C { } -(E = E || (E = {}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D || (D = {}))[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { +E = E || (E = {}), E[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", D = D || (D = {}), D[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { var x; M1.x = x; })(M || (M = {})); diff --git a/crates/swc/tests/tsc-references/exportsAndImports1-amd_es5.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports1-amd_es5.2.minified.js index ecd598a7264..2833d3507d4 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports1-amd_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports1-amd_es5.2.minified.js @@ -7,7 +7,7 @@ var E, C = function() { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); }(this, C); }; -(E = E || (E = {}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D || (D = {}))[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { +E = E || (E = {}), E[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", D = D || (D = {}), D[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { var x; M1.x = x; })(M || (M = {})); diff --git a/crates/swc/tests/tsc-references/exportsAndImports1-es6_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports1-es6_es2015.2.minified.js index e46bf44ffe8..517ab972b2a 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports1-es6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports1-es6_es2015.2.minified.js @@ -3,7 +3,7 @@ var E, D, E, D, M, v = 1; function f() {} class C { } -(E = E || (E = {}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D || (D = {}))[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { +E = E || (E = {}), E[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", D = D || (D = {}), D[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { var x; M1.x = x; })(M || (M = {})); diff --git a/crates/swc/tests/tsc-references/exportsAndImports1-es6_es5.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports1-es6_es5.2.minified.js index ecd598a7264..2833d3507d4 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports1-es6_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports1-es6_es5.2.minified.js @@ -7,7 +7,7 @@ var E, C = function() { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); }(this, C); }; -(E = E || (E = {}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D || (D = {}))[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { +E = E || (E = {}), E[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", D = D || (D = {}), D[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { var x; M1.x = x; })(M || (M = {})); diff --git a/crates/swc/tests/tsc-references/exportsAndImports1_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports1_es2015.2.minified.js index e46bf44ffe8..517ab972b2a 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports1_es2015.2.minified.js @@ -3,7 +3,7 @@ var E, D, E, D, M, v = 1; function f() {} class C { } -(E = E || (E = {}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D || (D = {}))[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { +E = E || (E = {}), E[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", D = D || (D = {}), D[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { var x; M1.x = x; })(M || (M = {})); diff --git a/crates/swc/tests/tsc-references/exportsAndImports1_es5.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports1_es5.2.minified.js index ecd598a7264..2833d3507d4 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports1_es5.2.minified.js @@ -7,7 +7,7 @@ var E, C = function() { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); }(this, C); }; -(E = E || (E = {}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D || (D = {}))[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { +E = E || (E = {}), E[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", D = D || (D = {}), D[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { var x; M1.x = x; })(M || (M = {})); diff --git a/crates/swc/tests/tsc-references/exportsAndImports3-amd_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports3-amd_es2015.2.minified.js index bbd8fded0aa..7c02de1049c 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports3-amd_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports3-amd_es2015.2.minified.js @@ -3,7 +3,7 @@ export var E, D, E, D, M, v = 1; export function f() {} export class C { } -(E = E || (E = {}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D || (D = {}))[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { +E = E || (E = {}), E[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", D = D || (D = {}), D[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { var x; M1.x = x; })(M || (M = {})); diff --git a/crates/swc/tests/tsc-references/exportsAndImports3-amd_es5.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports3-amd_es5.2.minified.js index 9f9b9cd0e27..5508a28c2d6 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports3-amd_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports3-amd_es5.2.minified.js @@ -7,7 +7,7 @@ export var C = function() { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); }(this, C); }; -(E = E || (E = {}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D || (D = {}))[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { +E = E || (E = {}), E[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", D = D || (D = {}), D[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { var x; M1.x = x; })(M || (M = {})); diff --git a/crates/swc/tests/tsc-references/exportsAndImports3-es6_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports3-es6_es2015.2.minified.js index bbd8fded0aa..7c02de1049c 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports3-es6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports3-es6_es2015.2.minified.js @@ -3,7 +3,7 @@ export var E, D, E, D, M, v = 1; export function f() {} export class C { } -(E = E || (E = {}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D || (D = {}))[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { +E = E || (E = {}), E[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", D = D || (D = {}), D[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { var x; M1.x = x; })(M || (M = {})); diff --git a/crates/swc/tests/tsc-references/exportsAndImports3-es6_es5.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports3-es6_es5.2.minified.js index 9f9b9cd0e27..5508a28c2d6 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports3-es6_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports3-es6_es5.2.minified.js @@ -7,7 +7,7 @@ export var C = function() { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); }(this, C); }; -(E = E || (E = {}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D || (D = {}))[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { +E = E || (E = {}), E[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", D = D || (D = {}), D[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { var x; M1.x = x; })(M || (M = {})); diff --git a/crates/swc/tests/tsc-references/exportsAndImports3_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports3_es2015.2.minified.js index bbd8fded0aa..7c02de1049c 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports3_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports3_es2015.2.minified.js @@ -3,7 +3,7 @@ export var E, D, E, D, M, v = 1; export function f() {} export class C { } -(E = E || (E = {}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D || (D = {}))[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { +E = E || (E = {}), E[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", D = D || (D = {}), D[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { var x; M1.x = x; })(M || (M = {})); diff --git a/crates/swc/tests/tsc-references/exportsAndImports3_es5.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports3_es5.2.minified.js index 9f9b9cd0e27..5508a28c2d6 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports3_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports3_es5.2.minified.js @@ -7,7 +7,7 @@ export var C = function() { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); }(this, C); }; -(E = E || (E = {}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D || (D = {}))[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { +E = E || (E = {}), E[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", D = D || (D = {}), D[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", (function(M1) { var x; M1.x = x; })(M || (M = {})); diff --git a/crates/swc/tests/tsc-references/mixinAbstractClasses.2_es2015.2.minified.js b/crates/swc/tests/tsc-references/mixinAbstractClasses.2_es2015.2.minified.js index bc718902407..a5460caabbf 100644 --- a/crates/swc/tests/tsc-references/mixinAbstractClasses.2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/mixinAbstractClasses.2_es2015.2.minified.js @@ -1,5 +1,6 @@ -const MixedBase = class extends class { -} { +var baseClass; +const MixedBase = (baseClass = class { +}, class extends baseClass { mixinMethod() {} -}; +}); new MixedBase(); diff --git a/crates/swc/tests/tsc-references/taggedTemplatesWithTypeArguments1_es2015.2.minified.js b/crates/swc/tests/tsc-references/taggedTemplatesWithTypeArguments1_es2015.2.minified.js index e0dbfa2a86f..8250bcdc998 100644 --- a/crates/swc/tests/tsc-references/taggedTemplatesWithTypeArguments1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/taggedTemplatesWithTypeArguments1_es2015.2.minified.js @@ -41,5 +41,5 @@ export const b = g` `; export let c = obj.prop`${(input)=>_objectSpread({}, input) }`; -c.returnedObjProp.x, c.returnedObjProp.y, c.returnedObjProp.z, (c = obj.prop`${(input)=>_objectSpread({}, input) -}`).returnedObjProp.x, c.returnedObjProp.y, c.returnedObjProp.z; +c.returnedObjProp.x, c.returnedObjProp.y, c.returnedObjProp.z, c = obj.prop`${(input)=>_objectSpread({}, input) +}`, c.returnedObjProp.x, c.returnedObjProp.y, c.returnedObjProp.z; diff --git a/crates/swc/tests/tsc-references/taggedTemplatesWithTypeArguments1_es5.2.minified.js b/crates/swc/tests/tsc-references/taggedTemplatesWithTypeArguments1_es5.2.minified.js index 4a3c7c8af3e..3b8bd98695e 100644 --- a/crates/swc/tests/tsc-references/taggedTemplatesWithTypeArguments1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/taggedTemplatesWithTypeArguments1_es5.2.minified.js @@ -81,6 +81,6 @@ export var b = g(_templateObject1(), function(stuff) { export var c = obj.prop(_templateObject2(), function(input) { return _objectSpread({}, input); }); -c.returnedObjProp.x, c.returnedObjProp.y, c.returnedObjProp.z, (c = obj.prop(_templateObject3(), function(input) { +c.returnedObjProp.x, c.returnedObjProp.y, c.returnedObjProp.z, c = obj.prop(_templateObject3(), function(input) { return _objectSpread({}, input); -})).returnedObjProp.x, c.returnedObjProp.y, c.returnedObjProp.z; +}), c.returnedObjProp.x, c.returnedObjProp.y, c.returnedObjProp.z; diff --git a/crates/swc/tests/tsc-references/typeofAnExportedType_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeofAnExportedType_es2015.2.minified.js index 94b4382e033..221e7ea71f4 100644 --- a/crates/swc/tests/tsc-references/typeofAnExportedType_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typeofAnExportedType_es2015.2.minified.js @@ -8,7 +8,7 @@ export class C { (M = M1 || (M1 = {})).foo = "", M.C = class { }; export var Z = M1; -(E = E || (E = {}))[E.A = 0] = "A"; +E = E || (E = {}), E[E.A = 0] = "A"; function foo1() {} export { foo1 as foo }; (foo = foo1 || (foo1 = {})).y = 1, foo.C = class { diff --git a/crates/swc/tests/tsc-references/typeofAnExportedType_es5.2.minified.js b/crates/swc/tests/tsc-references/typeofAnExportedType_es5.2.minified.js index 0b7406d95d3..5755e46d0f7 100644 --- a/crates/swc/tests/tsc-references/typeofAnExportedType_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/typeofAnExportedType_es5.2.minified.js @@ -18,7 +18,7 @@ export var C = function() { M1.C = C1; }(M || (M = {})); export var Z = M; -(E = E || (E = {}))[E.A = 0] = "A"; +E = E || (E = {}), E[E.A = 0] = "A"; export function foo() {} !function(foo1) { foo1.y = 1; diff --git a/crates/swc_ecma_minifier/src/compress/mod.rs b/crates/swc_ecma_minifier/src/compress/mod.rs index 431f7ce7bd7..8e952ae48cc 100644 --- a/crates/swc_ecma_minifier/src/compress/mod.rs +++ b/crates/swc_ecma_minifier/src/compress/mod.rs @@ -371,7 +371,7 @@ where let mut visitor = optimizer( self.marks, self.options, - self.data.as_ref().unwrap(), + self.data.as_mut().unwrap(), self.mode, !self.dump_for_infinite_loop.is_empty(), ); diff --git a/crates/swc_ecma_minifier/src/compress/optimize/collapse_vars.rs b/crates/swc_ecma_minifier/src/compress/optimize/collapse_vars.rs index f78de7f8e9d..234110cb076 100644 --- a/crates/swc_ecma_minifier/src/compress/optimize/collapse_vars.rs +++ b/crates/swc_ecma_minifier/src/compress/optimize/collapse_vars.rs @@ -58,10 +58,7 @@ where let value = match &*assign.right { Expr::Lit(Lit::Str(s)) if s.value.len() > 3 => return, - Expr::Lit(..) - | Expr::Member(MemberExpr { - computed: false, .. - }) => assign.right.clone(), + Expr::Lit(..) => assign.right.clone(), _ => return, }; diff --git a/crates/swc_ecma_minifier/src/compress/optimize/mod.rs b/crates/swc_ecma_minifier/src/compress/optimize/mod.rs index 99c5581e4d1..02adfd2de28 100644 --- a/crates/swc_ecma_minifier/src/compress/optimize/mod.rs +++ b/crates/swc_ecma_minifier/src/compress/optimize/mod.rs @@ -51,7 +51,7 @@ mod util; pub(super) fn optimizer<'a, M>( marks: Marks, options: &'a CompressOptions, - data: &'a ProgramData, + data: &'a mut ProgramData, mode: &'a M, debug_infinite_loop: bool, ) -> impl 'a + VisitMut + Repeated @@ -209,7 +209,7 @@ struct Optimizer<'a, M> { /// /// This is calculated multiple time, but only once per one /// `visit_mut_module`. - data: Option<&'a ProgramData>, + data: Option<&'a mut ProgramData>, ctx: Ctx, /// In future: This will be used to `mark` node as done. done: Mark, diff --git a/crates/swc_ecma_minifier/src/compress/optimize/sequences.rs b/crates/swc_ecma_minifier/src/compress/optimize/sequences.rs index a71c0f3191e..46f17d69244 100644 --- a/crates/swc_ecma_minifier/src/compress/optimize/sequences.rs +++ b/crates/swc_ecma_minifier/src/compress/optimize/sequences.rs @@ -1331,6 +1331,10 @@ where .as_ref() .and_then(|data| data.vars.get(&left_id.to_id())) { + if usage.inline_prevented { + return Ok(false); + } + if usage.declared_as_fn_expr { tracing::trace!( "sequences: [X] Declared as fn expr ({}, {:?})", @@ -1364,6 +1368,10 @@ where if usage.reassigned || !usage.is_fn_local { return Ok(false); } + if usage.inline_prevented { + return Ok(false); + } + match &mut a.init { Some(v) => (left, v), None => { diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/issues/2257/full/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/issues/2257/full/output.js index 902fdd47ef9..9710b9c8dba 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/issues/2257/full/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/issues/2257/full/output.js @@ -12962,7 +12962,7 @@ return "object" == typeof f && null !== f ? f = vg(f) : (e = Ff(b) ? Df : M.current, d = b.contextTypes, f = (d = null != d) ? Ef(a, e) : Cf), b = new b(c, f), a.memoizedState = null !== b.state && void 0 !== b.state ? b.state : null, b.updater = Kg, a.stateNode = b, b._reactInternals = a, d && ((a = a.stateNode).__reactInternalMemoizedUnmaskedChildContext = e, a.__reactInternalMemoizedMaskedChildContext = f), b; } function Ng(a, b, c, d) { - b.state, "function" == typeof b.componentWillReceiveProps && b.componentWillReceiveProps(c, d), "function" == typeof b.UNSAFE_componentWillReceiveProps && b.UNSAFE_componentWillReceiveProps(c, d), b.state != b.state && Kg.enqueueReplaceState(b, b.state, null); + a = b.state, "function" == typeof b.componentWillReceiveProps && b.componentWillReceiveProps(c, d), "function" == typeof b.UNSAFE_componentWillReceiveProps && b.UNSAFE_componentWillReceiveProps(c, d), b.state !== a && Kg.enqueueReplaceState(b, b.state, null); } function Og(a, b, c, d) { var e = a.stateNode; diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/issues/2614/1/input.js b/crates/swc_ecma_minifier/tests/compress/fixture/issues/2614/1/input.js new file mode 100644 index 00000000000..c75489cb34b --- /dev/null +++ b/crates/swc_ecma_minifier/tests/compress/fixture/issues/2614/1/input.js @@ -0,0 +1,7 @@ +expose(() => export_default); + +var foo = require("70jDX"); + +var Value; +Value = foo.default; +var export_default = Value; \ No newline at end of file diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/issues/2614/1/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/issues/2614/1/output.js new file mode 100644 index 00000000000..3786c1d4899 --- /dev/null +++ b/crates/swc_ecma_minifier/tests/compress/fixture/issues/2614/1/output.js @@ -0,0 +1,3 @@ +expose(()=>export_default +); +var export_default = require("70jDX").default; diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/issues/firebase-firestore/1/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/issues/firebase-firestore/1/output.js index 953e4c36e0f..ad5c8c30b04 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/issues/firebase-firestore/1/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/issues/firebase-firestore/1/output.js @@ -464,7 +464,7 @@ return new _t(e5); } toBase64() { - return this.binaryString, btoa(this.binaryString); + return btoa(this.binaryString); } toUint8Array() { return (function(t) { @@ -5377,8 +5377,8 @@ return null; } Xo(t) { - var e; - return this.persistence, e = new cr, t.initialUser, this.N, new ar(this.persistence, e, t.initialUser, this.N); + var t220, e, n, s; + return t220 = this.persistence, e = new cr, n = t.initialUser, s = this.N, new ar(t220, e, n, s); } Jo(t) { return new Cr(xr.Ns, this.N); @@ -5391,28 +5391,28 @@ } } class Fc { - async initialize(t220, e) { - this.localStore || (this.localStore = t220.localStore, this.sharedClientState = t220.sharedClientState, this.datastore = this.createDatastore(e), this.remoteStore = this.createRemoteStore(e), this.eventManager = this.createEventManager(e), this.syncEngine = this.createSyncEngine(e, !t220.synchronizeTabs), this.sharedClientState.onlineStateHandler = (t)=>cc(this.syncEngine, t, 1) + async initialize(t221, e) { + this.localStore || (this.localStore = t221.localStore, this.sharedClientState = t221.sharedClientState, this.datastore = this.createDatastore(e), this.remoteStore = this.createRemoteStore(e), this.eventManager = this.createEventManager(e), this.syncEngine = this.createSyncEngine(e, !t221.synchronizeTabs), this.sharedClientState.onlineStateHandler = (t)=>cc(this.syncEngine, t, 1) , this.remoteStore.remoteSyncer.handleCredentialChange = Tc.bind(null, this.syncEngine), await Do(this.remoteStore, this.syncEngine.isPrimaryClient)); } createEventManager(t) { return new Lo; } createDatastore(t) { - var e, n; - const e125 = Yr(t.databaseInfo.databaseId), n47 = (t.databaseInfo, new zr(t.databaseInfo)); - return t.credentials, e = n47, n = e125, new no(t.credentials, e, n); + var s, t222, e, n; + const e125 = Yr(t.databaseInfo.databaseId), n47 = (s = t.databaseInfo, new zr(s)); + return t222 = t.credentials, e = n47, n = e125, new no(t222, e, n); } - createRemoteStore(t221) { - var i, r; - return this.localStore, this.datastore, t221.asyncQueue, i = (t)=>cc(this.syncEngine, t, 0) - , r = Qr.bt() ? new Qr : new jr, new io(this.localStore, this.datastore, t221.asyncQueue, i, r); + createRemoteStore(t223) { + var e, n, s, i, r; + return e = this.localStore, n = this.datastore, s = t223.asyncQueue, i = (t)=>cc(this.syncEngine, t, 0) + , r = Qr.bt() ? new Qr : new jr, new io(e, n, s, i, r); } - createSyncEngine(t222, e126) { + createSyncEngine(t224, e126) { return (function(t, e, n, s, i, r, o) { const c = new ec(t, e, n, s, i, r); return o && (c.Qo = !0), c; - })(this.localStore, this.remoteStore, this.eventManager, this.sharedClientState, t222.initialUser, t222.maxConcurrentLimboResolutions, e126); + })(this.localStore, this.remoteStore, this.eventManager, this.sharedClientState, t224.initialUser, t224.maxConcurrentLimboResolutions, e126); } terminate() { return (async function(t) { @@ -5441,8 +5441,8 @@ } } class Kc { - constructor(t223, e127, n48){ - this.credentials = t223, this.asyncQueue = e127, this.databaseInfo = n48, this.user = D.UNAUTHENTICATED, this.clientId = (class { + constructor(t225, e127, n48){ + this.credentials = t225, this.asyncQueue = e127, this.databaseInfo = n48, this.user = D.UNAUTHENTICATED, this.clientId = (class { static I() { const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", e = Math.floor(256 / t.length) * t.length; let n = ""; @@ -5486,28 +5486,28 @@ }), t.promise; } } - async function jc(t224, e) { - t224.asyncQueue.verifyOperationInProgress(), $("FirestoreClient", "Initializing OfflineComponentProvider"); - const n = await t224.getConfiguration(); + async function jc(t226, e) { + t226.asyncQueue.verifyOperationInProgress(), $("FirestoreClient", "Initializing OfflineComponentProvider"); + const n = await t226.getConfiguration(); await e.initialize(n); let s = n.initialUser; - t224.setCredentialChangeListener(async (t)=>{ + t226.setCredentialChangeListener(async (t)=>{ s.isEqual(t) || (await hr(e.localStore, t), s = t); - }), e.persistence.setDatabaseDeletedListener(()=>t224.terminate() - ), t224.offlineComponents = e; + }), e.persistence.setDatabaseDeletedListener(()=>t226.terminate() + ), t226.offlineComponents = e; } - async function Qc(t225, e128) { - t225.asyncQueue.verifyOperationInProgress(); - const n49 = await Wc(t225); + async function Qc(t227, e128) { + t227.asyncQueue.verifyOperationInProgress(); + const n49 = await Wc(t227); $("FirestoreClient", "Initializing OnlineComponentProvider"); - const s22 = await t225.getConfiguration(); - await e128.initialize(n49, s22), t225.setCredentialChangeListener((t226)=>(async function(t, e) { + const s22 = await t227.getConfiguration(); + await e128.initialize(n49, s22), t227.setCredentialChangeListener((t228)=>(async function(t, e) { const n = q(t); n.asyncQueue.verifyOperationInProgress(), $("RemoteStore", "RemoteStore received new credentials"); const s = wo(n); n.Wr.add(3), await oo(n), s && n.Hr.set("Unknown"), await n.remoteSyncer.handleCredentialChange(e), n.Wr.delete(3), await ro(n); - })(e128.remoteStore, t226) - ), t225.onlineComponents = e128; + })(e128.remoteStore, t228) + ), t227.onlineComponents = e128; } async function Wc(t) { return t.offlineComponents || ($("FirestoreClient", "Using default OfflineComponentProvider"), await jc(t, new kc)), t.offlineComponents; @@ -5547,8 +5547,8 @@ if ("object" == typeof t) { if (t instanceof Array) return "an array"; { - var t227; - const e = (t227 = t).constructor ? t227.constructor.name : null; + var t229; + const e = (t229 = t).constructor ? t229.constructor.name : null; return e ? `a custom ${e} object` : "an object"; } } @@ -5565,33 +5565,33 @@ return t; } class pa { - constructor(t228){ + constructor(t230){ var e129; - if (void 0 === t228.host) { - if (void 0 !== t228.ssl) throw new j(K.INVALID_ARGUMENT, "Can't provide ssl option if host option is not set"); + if (void 0 === t230.host) { + if (void 0 !== t230.ssl) throw new j(K.INVALID_ARGUMENT, "Can't provide ssl option if host option is not set"); this.host = "firestore.googleapis.com", this.ssl = !0; - } else this.host = t228.host, this.ssl = null === (e129 = t228.ssl) || void 0 === e129 || e129; - if (this.credentials = t228.credentials, this.ignoreUndefinedProperties = !!t228.ignoreUndefinedProperties, void 0 === t228.cacheSizeBytes) this.cacheSizeBytes = 41943040; + } else this.host = t230.host, this.ssl = null === (e129 = t230.ssl) || void 0 === e129 || e129; + if (this.credentials = t230.credentials, this.ignoreUndefinedProperties = !!t230.ignoreUndefinedProperties, void 0 === t230.cacheSizeBytes) this.cacheSizeBytes = 41943040; else { - if (-1 !== t228.cacheSizeBytes && t228.cacheSizeBytes < 1048576) throw new j(K.INVALID_ARGUMENT, "cacheSizeBytes must be at least 1048576"); - this.cacheSizeBytes = t228.cacheSizeBytes; + if (-1 !== t230.cacheSizeBytes && t230.cacheSizeBytes < 1048576) throw new j(K.INVALID_ARGUMENT, "cacheSizeBytes must be at least 1048576"); + this.cacheSizeBytes = t230.cacheSizeBytes; } - this.experimentalForceLongPolling = !!t228.experimentalForceLongPolling, this.experimentalAutoDetectLongPolling = !!t228.experimentalAutoDetectLongPolling, this.useFetchStreams = !!t228.useFetchStreams, (function(t, e, n, s) { + this.experimentalForceLongPolling = !!t230.experimentalForceLongPolling, this.experimentalAutoDetectLongPolling = !!t230.experimentalAutoDetectLongPolling, this.useFetchStreams = !!t230.useFetchStreams, (function(t, e, n, s) { if (!0 === e && !0 === s) throw new j(K.INVALID_ARGUMENT, `${t} and ${n} cannot be used together.`); - })("experimentalForceLongPolling", t228.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", t228.experimentalAutoDetectLongPolling); + })("experimentalForceLongPolling", t230.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", t230.experimentalAutoDetectLongPolling); } isEqual(t) { return this.host === t.host && this.ssl === t.ssl && this.credentials === t.credentials && this.cacheSizeBytes === t.cacheSizeBytes && this.experimentalForceLongPolling === t.experimentalForceLongPolling && this.experimentalAutoDetectLongPolling === t.experimentalAutoDetectLongPolling && this.ignoreUndefinedProperties === t.ignoreUndefinedProperties && this.useFetchStreams === t.useFetchStreams; } } class Ta { - constructor(t229, e){ - this._credentials = e, this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new pa({}), this._settingsFrozen = !1, t229 instanceof ha ? this._databaseId = t229 : (this._app = t229, this._databaseId = (function(t) { + constructor(t231, e){ + this._credentials = e, this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new pa({}), this._settingsFrozen = !1, t231 instanceof ha ? this._databaseId = t231 : (this._app = t231, this._databaseId = (function(t) { if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new j(K.INVALID_ARGUMENT, "\"projectId\" not provided in firebase.initializeApp."); return new ha(t.options.projectId); - })(t229)); + })(t231)); } get app() { if (!this._app) throw new j(K.FAILED_PRECONDITION, "Firestore was not initialized using the Firebase SDK. 'app' is not available"); @@ -5603,9 +5603,9 @@ get _terminated() { return void 0 !== this._terminateTask; } - _setSettings(t230) { + _setSettings(t232) { if (this._settingsFrozen) throw new j(K.FAILED_PRECONDITION, "Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object."); - this._settings = new pa(t230), void 0 !== t230.credentials && (this._credentials = (function(t) { + this._settings = new pa(t232), void 0 !== t232.credentials && (this._credentials = (function(t) { if (!t) return new G; switch(t.type){ case "gapi": @@ -5616,7 +5616,7 @@ default: throw new j(K.INVALID_ARGUMENT, "makeCredentialsProvider failed due to invalid credential type"); } - })(t230.credentials)); + })(t232.credentials)); } _getSettings() { return this._settings; @@ -5687,29 +5687,29 @@ return new Ra(this.firestore, t, this._path); } } - function ba(t231, e130, ...n50) { - if (t231 = (0, _firebase_util__WEBPACK_IMPORTED_MODULE_3__.m9)(t231), (function(t, e, n) { + function ba(t233, e130, ...n50) { + if (t233 = (0, _firebase_util__WEBPACK_IMPORTED_MODULE_3__.m9)(t233), (function(t, e, n) { if (!n) throw new j(K.INVALID_ARGUMENT, `Function ${t}() cannot be called with an empty ${e}.`); - })("collection", "path", e130), t231 instanceof Ta) { + })("collection", "path", e130), t233 instanceof Ta) { const s = ht.fromString(e130, ...n50); - return _a(s), new Ra(t231, null, s); + return _a(s), new Ra(t233, null, s); } { - if (!(t231 instanceof Ia || t231 instanceof Ra)) throw new j(K.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore"); - const s = t231._path.child(ht.fromString(e130, ...n50)); - return _a(s), new Ra(t231.firestore, null, s); + if (!(t233 instanceof Ia || t233 instanceof Ra)) throw new j(K.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore"); + const s = t233._path.child(ht.fromString(e130, ...n50)); + return _a(s), new Ra(t233.firestore, null, s); } } class ka extends Ta { - constructor(t232, e131){ - super(t232, e131), this.type = "firestore", this._queue = new class { + constructor(t234, e131){ + super(t234, e131), this.type = "firestore", this._queue = new class { constructor(){ this._c = Promise.resolve(), this.mc = [], this.gc = !1, this.yc = [], this.Tc = null, this.Ec = !1, this.Ic = !1, this.Ac = [], this.ar = new Xr(this, "async_queue_retry"), this.Rc = ()=>{ const t = Jr(); t && $("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.ar.tr(); }; - const t233 = Jr(); - t233 && "function" == typeof t233.addEventListener && t233.addEventListener("visibilitychange", this.Rc); + const t235 = Jr(); + t235 && "function" == typeof t235.addEventListener && t235.addEventListener("visibilitychange", this.Rc); } get isShuttingDown() { return this.gc; @@ -5750,21 +5750,21 @@ ); } } - Pc(t235) { - const e133 = this._c.then(()=>(this.Ec = !0, t235().catch((t)=>{ - var t234; + Pc(t237) { + const e133 = this._c.then(()=>(this.Ec = !0, t237().catch((t)=>{ + var t236; this.Tc = t, this.Ec = !1; let e; - const e132 = (e = (t234 = t).message || "", t234.stack && (e = t234.stack.includes(t234.message) ? t234.stack : t234.message + "\n" + t234.stack), e); + const e132 = (e = (t236 = t).message || "", t236.stack && (e = t236.stack.includes(t236.message) ? t236.stack : t236.message + "\n" + t236.stack), e); throw O("INTERNAL UNHANDLED ERROR: ", e132), t; }).then((t)=>(this.Ec = !1, t) )) ); return this._c = e133, e133; } - enqueueAfterDelay(t236, e, n) { - this.bc(), this.Ac.indexOf(t236) > -1 && (e = 0); - const s = xo.createAndSchedule(this, t236, e, n, (t)=>this.Vc(t) + enqueueAfterDelay(t238, e, n) { + this.bc(), this.Ac.indexOf(t238) > -1 && (e = 0); + const s = xo.createAndSchedule(this, t238, e, n, (t)=>this.Vc(t) ); return this.yc.push(s), s; } @@ -5781,10 +5781,10 @@ for (const e of this.yc)if (e.timerId === t) return !0; return !1; } - Cc(t237) { + Cc(t239) { return this.Sc().then(()=>{ for (const e134 of (this.yc.sort((t, e)=>t.targetTimeMs - e.targetTimeMs - ), this.yc))if (e134.skipDelay(), "all" !== t237 && e134.timerId === t237) break; + ), this.yc))if (e134.skipDelay(), "all" !== t239 && e134.timerId === t239) break; return this.Sc(); }); } @@ -5795,15 +5795,15 @@ const e = this.yc.indexOf(t); this.yc.splice(e, 1); } - }, this._persistenceKey = "name" in t232 ? t232.name : "[DEFAULT]"; + }, this._persistenceKey = "name" in t234 ? t234.name : "[DEFAULT]"; } _terminate() { return this._firestoreClient || Ma(this), this._firestoreClient.terminate(); } } function Ma(t) { - var e, e135, s; - const n = t._freezeSettings(), s23 = (t._databaseId, e135 = (null === (e = t._app) || void 0 === e ? void 0 : e.options.appId) || "", t._persistenceKey, s = n, new ua(t._databaseId, e135, t._persistenceKey, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams)); + var e, t240, e135, n, s; + const n51 = t._freezeSettings(), s23 = (t240 = t._databaseId, e135 = (null === (e = t._app) || void 0 === e ? void 0 : e.options.appId) || "", n = t._persistenceKey, s = n51, new ua(t240, e135, n, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams)); t._firestoreClient = new Kc(t._credentials, t._queue, s23); } class Ja { @@ -5822,8 +5822,8 @@ static fromBase64String(t) { try { return new Xa(_t.fromBase64String(t)); - } catch (t238) { - throw new j(K.INVALID_ARGUMENT, "Failed to construct data from Base64 string: " + t238); + } catch (t241) { + throw new j(K.INVALID_ARGUMENT, "Failed to construct data from Base64 string: " + t241); } } static fromUint8Array(t) { @@ -5954,16 +5954,16 @@ return t instanceof lu; } } - function yu(t239, e136) { - if (Tu(t239 = getModularInstance(t239))) return Eu("Unsupported field value:", e136, t239), pu(t239, e136); - if (t239 instanceof Za) return (function(t, e) { + function yu(t242, e136) { + if (Tu(t242 = getModularInstance(t242))) return Eu("Unsupported field value:", e136, t242), pu(t242, e136); + if (t242 instanceof Za) return (function(t, e) { if (!iu(e.kc)) throw e.Uc(`${t._methodName}() can only be used with update() and set()`); if (!e.path) throw e.Uc(`${t._methodName}() is not currently supported inside arrays`); const n = t._toFieldTransform(e); n && e.fieldTransforms.push(n); - })(t239, e136), null; - if (void 0 === t239 && e136.ignoreUndefinedProperties) return null; - if (e136.path && e136.fieldMask.push(e136.path), t239 instanceof Array) { + })(t242, e136), null; + if (void 0 === t242 && e136.ignoreUndefinedProperties) return null; + if (e136.path && e136.fieldMask.push(e136.path), t242 instanceof Array) { if (e136.settings.Fc && 4 !== e136.kc) throw e136.Uc("Nested arrays are not supported"); return (function(t, e) { const n = []; @@ -5979,14 +5979,14 @@ values: n } }; - })(t239, e136); + })(t242, e136); } return (function(t, e) { - var t240, e137; + var t243, e137; if (null === (t = getModularInstance(t))) return { nullValue: "NULL_VALUE" }; - if ("number" == typeof t) return t240 = e.N, bt(e137 = t) ? De(e137) : Se(t240, e137); + if ("number" == typeof t) return t243 = e.N, bt(e137 = t) ? De(e137) : Se(t243, e137); if ("boolean" == typeof t) return { booleanValue: t }; @@ -6022,11 +6022,11 @@ }; } throw e.Uc(`Unsupported field value: ${ma(t)}`); - })(t239, e136); + })(t242, e136); } - function pu(t241, e) { + function pu(t244, e) { const n = {}; - return at(t241) ? e.path && e.path.length > 0 && e.fieldMask.push(e.path) : ct(t241, (t, s)=>{ + return at(t244) ? e.path && e.path.length > 0 && e.fieldMask.push(e.path) : ct(t244, (t, s)=>{ const i = yu(s, e.Oc(t)); null != i && (n[t] = i); }), { @@ -6039,8 +6039,8 @@ return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof it || t instanceof tu || t instanceof Xa || t instanceof Ia || t instanceof Za); } function Eu(t, e, n) { - var t242; - if (!Tu(n) || "object" != typeof (t242 = n) || null === t242 || Object.getPrototypeOf(t242) !== Object.prototype && null !== Object.getPrototypeOf(t242)) { + var t245; + if (!Tu(n) || "object" != typeof (t245 = n) || null === t245 || Object.getPrototypeOf(t245) !== Object.prototype && null !== Object.getPrototypeOf(t245)) { const s = ma(n); throw "an object" === s ? e.Uc(t + " a custom object") : e.Uc(t + " " + s); } @@ -6087,7 +6087,7 @@ return super.data(); } } - function Su(t243, e138) { + function Su(t246, e138) { return "string" == typeof e138 ? (function(t, e, n) { if (e.search(Au) >= 0) throw bu(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`, t, !1, void 0, n); try { @@ -6095,7 +6095,7 @@ } catch (s) { throw bu(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t, !1, void 0, n); } - })(t243, e138) : e138 instanceof Ja ? e138._internalPath : e138._delegate._internalPath; + })(t246, e138) : e138 instanceof Ja ? e138._internalPath : e138._delegate._internalPath; } class Du { constructor(t, e){ @@ -6153,25 +6153,25 @@ t.call(e, new Nu(this._firestore, this._userDataWriter, n.key, n, new Du(this._snapshot.mutatedKeys.has(n.key), this._snapshot.fromCache), this.query.converter)); }); } - docChanges(t244 = {}) { - const e139 = !!t244.includeMetadataChanges; + docChanges(t247 = {}) { + const e139 = !!t247.includeMetadataChanges; if (e139 && this._snapshot.excludesMetadataChanges) throw new j(K.INVALID_ARGUMENT, "To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot()."); - return this._cachedChanges && this._cachedChangesIncludeMetadataChanges === e139 || (this._cachedChanges = (function(t245, e140) { - if (t245._snapshot.oldDocs.isEmpty()) { + return this._cachedChanges && this._cachedChangesIncludeMetadataChanges === e139 || (this._cachedChanges = (function(t248, e140) { + if (t248._snapshot.oldDocs.isEmpty()) { let e = 0; - return t245._snapshot.docChanges.map((n)=>({ + return t248._snapshot.docChanges.map((n)=>({ type: "added", - doc: new Nu(t245._firestore, t245._userDataWriter, n.doc.key, n.doc, new Du(t245._snapshot.mutatedKeys.has(n.doc.key), t245._snapshot.fromCache), t245.query.converter), + doc: new Nu(t248._firestore, t248._userDataWriter, n.doc.key, n.doc, new Du(t248._snapshot.mutatedKeys.has(n.doc.key), t248._snapshot.fromCache), t248.query.converter), oldIndex: -1, newIndex: e++ }) ); } { - let n = t245._snapshot.oldDocs; - return t245._snapshot.docChanges.filter((t)=>e140 || 3 !== t.type + let n = t248._snapshot.oldDocs; + return t248._snapshot.docChanges.filter((t)=>e140 || 3 !== t.type ).map((e)=>{ - const s = new Nu(t245._firestore, t245._userDataWriter, e.doc.key, e.doc, new Du(t245._snapshot.mutatedKeys.has(e.doc.key), t245._snapshot.fromCache), t245.query.converter); + const s = new Nu(t248._firestore, t248._userDataWriter, e.doc.key, e.doc, new Du(t248._snapshot.mutatedKeys.has(e.doc.key), t248._snapshot.fromCache), t248.query.converter); let i = -1, r = -1; return 0 !== e.type && (i = n.indexOf(e.doc.key), n = n.delete(e.doc.key)), 1 !== e.type && (r = (n = n.add(e.doc)).indexOf(e.doc.key)), { type: ku(e.type), @@ -6235,8 +6235,8 @@ convertGeoPoint(t) { return new tu(yt(t.latitude), yt(t.longitude)); } - convertArray(t246, e) { - return (t246.values || []).map((t)=>this.convertValue(t, e) + convertArray(t249, e) { + return (t249.values || []).map((t)=>this.convertValue(t, e) ); } convertServerTimestamp(t, e) { @@ -6273,32 +6273,32 @@ return new Ia(this.firestore, null, e); } } - function lh(t248) { - var t247; - t248 = ga(t248, Aa); - const e141 = ga(t248.firestore, ka), n51 = ((t247 = e141)._firestoreClient || Ma(t247), t247._firestoreClient.verifyNotTerminated(), t247._firestoreClient), s24 = new ah(e141); + function lh(t251) { + var t250; + t251 = ga(t251, Aa); + const e141 = ga(t251.firestore, ka), n52 = ((t250 = e141)._firestoreClient || Ma(t250), t250._firestoreClient.verifyNotTerminated(), t250._firestoreClient), s24 = new ah(e141); return (function(t) { if (me(t) && 0 === t.explicitOrderBy.length) throw new j(K.UNIMPLEMENTED, "limitToLast() queries require specifying at least one orderBy() clause"); - })(t248._query), (function(t249, e142, n52 = {}) { + })(t251._query), (function(t252, e142, n53 = {}) { const s25 = new Q; - return t249.asyncQueue.enqueueAndForget(async ()=>(function(t250, e, n53, s, i) { + return t252.asyncQueue.enqueueAndForget(async ()=>(function(t253, e, n54, s, i) { const r = new Lc({ next: (n)=>{ - e.enqueueAndForget(()=>Uo(t250, o) + e.enqueueAndForget(()=>Uo(t253, o) ), n.fromCache && "server" === s.source ? i.reject(new j(K.UNAVAILABLE, "Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to \"server\" to retrieve the cached documents.)")) : i.resolve(n); }, error: (t)=>i.reject(t) - }), o = new Qo(n53, r, { + }), o = new Qo(n54, r, { includeMetadataChanges: !0, fo: !0 }); - return Bo(t250, o); - })(await Xc(t249), t249.asyncQueue, e142, n52, s25) + return Bo(t253, o); + })(await Xc(t252), t252.asyncQueue, e142, n53, s25) ), s25.promise; - })(n51, t248._query).then((n)=>new xu(e141, s24, t248, n) + })(n52, t251._query).then((n)=>new xu(e141, s24, t251, n) ); } - !function(t251, e = !0) { + !function(t254, e = !0) { C = _firebase_app__WEBPACK_IMPORTED_MODULE_0__.Jn, (0, _firebase_app__WEBPACK_IMPORTED_MODULE_0__.Xd)(new _firebase_component__WEBPACK_IMPORTED_MODULE_1__.wA("firestore", (t, { options: n })=>{ const s = t.getProvider("app").getImmediate(), i = new ka(s, new H(t.getProvider("auth-internal"))); return n = Object.assign({ diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/issues/moment/1/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/issues/moment/1/output.js index d33f653433c..8f311b4f7d4 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/issues/moment/1/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/issues/moment/1/output.js @@ -751,7 +751,7 @@ } else config._isValid = !1; } function configFromRFC2822(config) { - var year, weekdayStr, parsedInput, config1, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr, result, parsedArray, match = rfc2822.exec((config._i, config._i.replace(/\([^)]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").replace(/^\s\s*/, "").replace(/\s\s*$/, ""))); + var year, weekdayStr, parsedInput, config1, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr, result, parsedArray, match = rfc2822.exec(config._i.replace(/\([^)]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").replace(/^\s\s*/, "").replace(/\s\s*$/, "")); if (match) { if (yearStr = match[4], monthStr = match[3], dayStr = match[2], hourStr = match[5], minuteStr = match[6], secondStr = match[7], result = [ (year = parseInt(yearStr, 10)) <= 49 ? 2000 + year : year <= 999 ? 1900 + year : year, diff --git a/crates/swc_ecma_minifier/tests/projects/output/jquery.mobile-1.4.2.js b/crates/swc_ecma_minifier/tests/projects/output/jquery.mobile-1.4.2.js index 8e443a41b89..3f61dd25afc 100644 --- a/crates/swc_ecma_minifier/tests/projects/output/jquery.mobile-1.4.2.js +++ b/crates/swc_ecma_minifier/tests/projects/output/jquery.mobile-1.4.2.js @@ -532,8 +532,8 @@ this.element.html($(this.defaultHtml).html()); }, show: function(theme, msgText, textonly) { - var message, loadSettings; - this.resetHtml(), "object" === $.type(theme) ? theme = (loadSettings = $.extend({}, this.options, theme)).theme : (loadSettings = this.options, theme = theme || loadSettings.theme), message = msgText || (!1 === loadSettings.text ? "" : loadSettings.text), $html.addClass("ui-loading"), loadSettings.textVisible, this.element.attr("class", loaderClass + " ui-corner-all ui-body-" + theme + " ui-loader-" + (loadSettings.textVisible || msgText || theme.text ? "verbose" : "default") + (loadSettings.textonly || textonly ? " ui-loader-textonly" : "")), loadSettings.html ? this.element.html(loadSettings.html) : this.element.find("h1").text(message), this.element.appendTo($.mobile.pageContainer), this.checkLoaderPosition(), this.window.bind("scroll", $.proxy(this.checkLoaderPosition, this)); + var textVisible, message, loadSettings; + this.resetHtml(), "object" === $.type(theme) ? theme = (loadSettings = $.extend({}, this.options, theme)).theme : (loadSettings = this.options, theme = theme || loadSettings.theme), message = msgText || (!1 === loadSettings.text ? "" : loadSettings.text), $html.addClass("ui-loading"), textVisible = loadSettings.textVisible, this.element.attr("class", loaderClass + " ui-corner-all ui-body-" + theme + " ui-loader-" + (textVisible || msgText || theme.text ? "verbose" : "default") + (loadSettings.textonly || textonly ? " ui-loader-textonly" : "")), loadSettings.html ? this.element.html(loadSettings.html) : this.element.find("h1").text(message), this.element.appendTo($.mobile.pageContainer), this.checkLoaderPosition(), this.window.bind("scroll", $.proxy(this.checkLoaderPosition, this)); }, hide: function() { $html.removeClass("ui-loading"), this.options.text && this.element.removeClass("ui-loader-fakefix"), $.mobile.window.unbind("scroll", this.fakeFixLoader), $.mobile.window.unbind("scroll", this.checkLoaderPosition); @@ -601,7 +601,7 @@ var v, uc_prop = prop.charAt(0).toUpperCase() + prop.substr(1), props = (prop + " " + vendors.join(uc_prop + " ") + uc_prop).split(" "); for(v in props)if (undefined !== fbCSS[props[v]]) return !0; } - var nokiaLTE7_3, w1, ua, platform, wkmatch, wkversion, ffmatch, ffversion, operammobilematch, omversion, link, fauxBase, base, supports, element, documentElement, getComputedStyle, ua1, fakeBody = $("").prependTo("html"), fbCSS = fakeBody[0].style, vendors = [ + var nokiaLTE7_3, w1, ua, platform, wkmatch, wkversion, ffmatch, ffversion, operammobilematch, omversion, rebase, fauxBase, base, supports, element, documentElement, getComputedStyle, ua1, fakeBody = $("").prependTo("html"), fbCSS = fakeBody[0].style, vendors = [ "Webkit", "Moz", "O" @@ -632,7 +632,7 @@ scrollTop: ("pageXOffset" in window1 || "scrollTop" in document1.documentElement || "scrollTop" in fakeBody[0]) && !("palmGetResource" in window1) && !operamini, dynamicBaseTag: (fauxBase = location.protocol + "//" + location.host + location.pathname + "ui-dir/", (base = $("head base")).length ? base.attr("href") : base = $("", { href: fauxBase - }).appendTo("head"), (link = $("").prependTo(fakeBody))[0].href, base[0].href = location.pathname, 0 === link[0].href.indexOf(fauxBase)), + }).appendTo("head"), rebase = $("").prependTo(fakeBody)[0].href, base[0].href = location.pathname, 0 === rebase.indexOf(fauxBase)), cssPointerEvents: (element = document1.createElement("x"), documentElement = document1.documentElement, getComputedStyle = window1.getComputedStyle, "pointerEvents" in element.style && (element.style.pointerEvents = "auto", element.style.pointerEvents = "x", documentElement.appendChild(element), supports = getComputedStyle && "auto" === getComputedStyle(element, "").pointerEvents, documentElement.removeChild(element), !!supports)), boundingRect: void 0 !== document1.createElement("div").getBoundingClientRect, inlineSVG: function() { @@ -2957,12 +2957,12 @@ this._prepareHeightUpdate(this.options.keyupTimeoutBuffer); }, _updateHeight: function() { - var paddingTop, paddingBottom, paddingHeight, borderTop, borderBottom, borderHeight, height, scrollTop = this.window.scrollTop(); + var paddingTop, paddingBottom, paddingHeight, scrollHeight, clientHeight, borderTop, borderBottom, borderHeight, height, scrollTop = this.window.scrollTop(); this.keyupTimeout = 0, "onpage" in this.element[0] || this.element.css({ height: 0, "min-height": 0, "max-height": 0 - }), this.element[0].scrollHeight, this.element[0].clientHeight, borderTop = parseFloat(this.element.css("border-top-width")), borderBottom = parseFloat(this.element.css("border-bottom-width")), borderHeight = borderTop + borderBottom, height = this.element[0].scrollHeight + borderHeight + 15, 0 === this.element[0].clientHeight && (paddingTop = parseFloat(this.element.css("padding-top")), paddingBottom = parseFloat(this.element.css("padding-bottom")), paddingHeight = paddingTop + paddingBottom, height += paddingHeight), this.element.css({ + }), scrollHeight = this.element[0].scrollHeight, clientHeight = this.element[0].clientHeight, borderTop = parseFloat(this.element.css("border-top-width")), borderBottom = parseFloat(this.element.css("border-bottom-width")), borderHeight = borderTop + borderBottom, height = scrollHeight + borderHeight + 15, 0 === clientHeight && (paddingTop = parseFloat(this.element.css("padding-top")), paddingBottom = parseFloat(this.element.css("padding-bottom")), paddingHeight = paddingTop + paddingBottom, height += paddingHeight), this.element.css({ height: height, "min-height": "", "max-height": "" diff --git a/crates/swc_ecma_minifier/tests/projects/output/react-dom-17.0.2.js b/crates/swc_ecma_minifier/tests/projects/output/react-dom-17.0.2.js index 358b23cbe2b..91161a6bf47 100644 --- a/crates/swc_ecma_minifier/tests/projects/output/react-dom-17.0.2.js +++ b/crates/swc_ecma_minifier/tests/projects/output/react-dom-17.0.2.js @@ -5,7 +5,7 @@ ], factory) : factory((global = global || self).ReactDOM = {}, global.React); }(this, function(exports, React) { "use strict"; - var devToolsConfig, prevLog, prevInfo, prevWarn, prevError, prevGroup, prevGroupCollapsed, prevGroupEnd, prefix1, componentFrameCache, didWarnValueDefaultValue$1, reusableSVGContainer, attemptUserBlockingHydration, attemptContinuousHydration, attemptHydrationAtCurrentPriority, attemptHydrationAtPriority, lastMovementX, lastMovementY, lastMouseEvent, warnedUnknownTags, suppressHydrationWarning, validatePropertiesInDevelopment, warnForTextDifference, warnForPropDifference, warnForExtraAttributes, warnForInvalidEventListener, canDiffStyleForHydrationWarning, normalizeMarkupForTextOrAttribute, normalizeHTML, SUPPRESS_HYDRATION_WARNING$1, fiberStack, warnedAboutMissingGetChildContext, rendererSigil, didWarnUpdateInsideUpdate, currentlyProcessingQueue, didWarnAboutStateAssignmentForComponent, didWarnAboutUninitializedState, didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate, didWarnAboutLegacyLifecyclesAndDerivedState, didWarnAboutUndefinedDerivedState, warnOnUndefinedDerivedState, warnOnInvalidCallback, didWarnAboutDirectlyAssigningPropsToState, didWarnAboutContextTypeAndContextTypes, didWarnAboutInvalidateContextType, didWarnAboutMaps, didWarnAboutGenerators, didWarnAboutStringRefs, ownerHasKeyUseWarning, ownerHasFunctionTypeWarning, rendererSigil$1, didWarnAboutMismatchedHooksForComponent, didWarnAboutUseOpaqueIdentifier, didWarnAboutBadClass, didWarnAboutModulePatternComponent, didWarnAboutContextTypeOnFunctionComponent, didWarnAboutGetDerivedStateOnFunctionComponent, didWarnAboutFunctionRefs, didWarnAboutReassigningProps, didWarnAboutRevealOrder, didWarnAboutTailOptions, appendAllChildren, updateHostContainer, updateHostComponent$1, updateHostText$1, beginWork$1, didWarnAboutUpdateInRenderForAnotherComponent, hasBadMapPolyfill, didWarnAboutNestedUpdates, didWarnAboutFindNodeInStrictMode, topLevelUpdateWarnings, ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + var devToolsConfig, findFiberByHostInstance, ReactCurrentDispatcher, prevLog, prevInfo, prevWarn, prevError, prevGroup, prevGroupCollapsed, prevGroupEnd, prefix1, componentFrameCache, didWarnValueDefaultValue$1, reusableSVGContainer, attemptUserBlockingHydration, attemptContinuousHydration, attemptHydrationAtCurrentPriority, attemptHydrationAtPriority, lastMovementX, lastMovementY, lastMouseEvent, warnedUnknownTags, suppressHydrationWarning, validatePropertiesInDevelopment, warnForTextDifference, warnForPropDifference, warnForExtraAttributes, warnForInvalidEventListener, canDiffStyleForHydrationWarning, normalizeMarkupForTextOrAttribute, normalizeHTML, SUPPRESS_HYDRATION_WARNING$1, fiberStack, warnedAboutMissingGetChildContext, rendererSigil, didWarnUpdateInsideUpdate, currentlyProcessingQueue, didWarnAboutStateAssignmentForComponent, didWarnAboutUninitializedState, didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate, didWarnAboutLegacyLifecyclesAndDerivedState, didWarnAboutUndefinedDerivedState, warnOnUndefinedDerivedState, warnOnInvalidCallback, didWarnAboutDirectlyAssigningPropsToState, didWarnAboutContextTypeAndContextTypes, didWarnAboutInvalidateContextType, didWarnAboutMaps, didWarnAboutGenerators, didWarnAboutStringRefs, ownerHasKeyUseWarning, ownerHasFunctionTypeWarning, rendererSigil$1, didWarnAboutMismatchedHooksForComponent, didWarnAboutUseOpaqueIdentifier, didWarnAboutBadClass, didWarnAboutModulePatternComponent, didWarnAboutContextTypeOnFunctionComponent, didWarnAboutGetDerivedStateOnFunctionComponent, didWarnAboutFunctionRefs, didWarnAboutReassigningProps, didWarnAboutRevealOrder, didWarnAboutTailOptions, appendAllChildren, updateHostContainer, updateHostComponent$1, updateHostText$1, beginWork$1, didWarnAboutUpdateInRenderForAnotherComponent, hasBadMapPolyfill, didWarnAboutNestedUpdates, didWarnAboutFindNodeInStrictMode, topLevelUpdateWarnings, ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; function warn(format) { for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++)args[_key - 1] = arguments[_key]; printWarning("warn", format, args); @@ -406,7 +406,7 @@ disabledDepth < 0 && error1("disabledDepth fell below zero. This is a bug in React. Please file an issue."); } disabledLog.__reactDisabledLog = !0; - var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; + var ReactCurrentDispatcher1 = ReactSharedInternals.ReactCurrentDispatcher; function describeBuiltInComponentFrame(name, source, ownerFn) { if (void 0 === prefix1) try { throw Error(); @@ -423,7 +423,7 @@ if (void 0 !== frame) return frame; reentry = !0; var previousPrepareStackTrace = Error.prepareStackTrace; - Error.prepareStackTrace = void 0, previousDispatcher = ReactCurrentDispatcher.current, ReactCurrentDispatcher.current = null, disableLogs(); + Error.prepareStackTrace = void 0, previousDispatcher = ReactCurrentDispatcher1.current, ReactCurrentDispatcher1.current = null, disableLogs(); try { if (construct) { var Fake = function() { @@ -469,7 +469,7 @@ } } } finally{ - reentry = !1, ReactCurrentDispatcher.current = previousDispatcher, reenableLogs(), Error.prepareStackTrace = previousPrepareStackTrace; + reentry = !1, ReactCurrentDispatcher1.current = previousDispatcher, reenableLogs(), Error.prepareStackTrace = previousPrepareStackTrace; } var name = fn ? fn.displayName || fn.name : "", syntheticFrame = name ? describeBuiltInComponentFrame(name) : ""; return "function" == typeof fn && componentFrameCache.set(fn, syntheticFrame), syntheticFrame; @@ -736,9 +736,9 @@ }), null == props.selected || didWarnSelectedSetOnOption || (error1("Use the `defaultValue` or `value` props on