mirror of
https://github.com/swc-project/swc.git
synced 2024-11-23 17:54:15 +03:00
fix(es/minifier): Skip exported vars while collapsing vars (#3928)
This commit is contained in:
parent
ce57482ac8
commit
cc564ff6c5
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eu
|
||||
|
||||
cargo profile instruments --release -t time --bench typescript --features concurrent,tracing/release_max_level_info $@
|
||||
cargo profile instruments --release -t time --bench typescript --features tracing/release_max_level_info $@
|
||||
# MINIFY=1 cargo profile instruments --release -t time --bench typescript --features concurrent,tracing/release_max_level_info $@
|
@ -1,4 +1,4 @@
|
||||
var E1;
|
||||
export var E1;
|
||||
!function(E1) {
|
||||
E1[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C";
|
||||
}(E1 || (E1 = {})), require("./foo_0").E1.A;
|
||||
|
@ -1,9 +1,10 @@
|
||||
var E1;
|
||||
export class C1 {
|
||||
constructor(){
|
||||
this.m1 = 42;
|
||||
}
|
||||
}
|
||||
C1.s1 = !0, function(E1) {
|
||||
C1.s1 = !0;
|
||||
export var E1;
|
||||
!function(E1) {
|
||||
E1[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C";
|
||||
}(E1 || (E1 = {})), require("./foo_0");
|
||||
|
@ -1,8 +1,10 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
export var E1, i, z, C1 = function() {
|
||||
export var i, z, C1 = function() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, C1), this.m1 = 42;
|
||||
};
|
||||
C1.s1 = !0, function(E1) {
|
||||
C1.s1 = !0;
|
||||
export var E1;
|
||||
!function(E1) {
|
||||
E1[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C";
|
||||
}(E1 || (E1 = {})), require("./foo_0");
|
||||
|
@ -1,7 +1,9 @@
|
||||
var AppType, AppStyle;
|
||||
export var AppType;
|
||||
!function(AppType) {
|
||||
AppType.HeaderDetail = "HeaderDetail", AppType.HeaderMultiDetail = "HeaderMultiDetail", AppType.AdvancedList = "AdvancedList", AppType.Standard = "Standard", AppType.Relationship = "Relationship", AppType.Report = "Report", AppType.Composite = "Composite", AppType.ListOnly = "ListOnly", AppType.ModuleSettings = "ModuleSettings";
|
||||
}(AppType || (AppType = {})), function(AppStyle) {
|
||||
}(AppType || (AppType = {}));
|
||||
export var AppStyle;
|
||||
!function(AppStyle) {
|
||||
AppStyle[AppStyle.Tree = 0] = "Tree", AppStyle[AppStyle.TreeEntity = 1] = "TreeEntity", AppStyle[AppStyle.Standard = 2] = "Standard", AppStyle[AppStyle.MiniApp = 3] = "MiniApp", AppStyle[AppStyle.PivotTable = 4] = "PivotTable";
|
||||
}(AppStyle || (AppStyle = {})), new Map([
|
||||
[
|
||||
|
@ -1,7 +1,9 @@
|
||||
var AppType, AppStyle;
|
||||
export var AppType;
|
||||
!function(AppType) {
|
||||
AppType.HeaderDetail = "HeaderDetail", AppType.HeaderMultiDetail = "HeaderMultiDetail", AppType.AdvancedList = "AdvancedList", AppType.Standard = "Standard", AppType.Relationship = "Relationship", AppType.Report = "Report", AppType.Composite = "Composite", AppType.ListOnly = "ListOnly", AppType.ModuleSettings = "ModuleSettings";
|
||||
}(AppType || (AppType = {})), function(AppStyle) {
|
||||
}(AppType || (AppType = {}));
|
||||
export var AppStyle;
|
||||
!function(AppStyle) {
|
||||
AppStyle[AppStyle.Tree = 0] = "Tree", AppStyle[AppStyle.TreeEntity = 1] = "TreeEntity", AppStyle[AppStyle.Standard = 2] = "Standard", AppStyle[AppStyle.MiniApp = 3] = "MiniApp", AppStyle[AppStyle.PivotTable = 4] = "PivotTable";
|
||||
}(AppStyle || (AppStyle = {})), new Map([
|
||||
[
|
||||
|
@ -1,5 +1,5 @@
|
||||
var M1;
|
||||
const foo2 = require("./foo2");
|
||||
export var M1;
|
||||
(M1 || (M1 = {})).C1 = class {
|
||||
constructor(){
|
||||
this.m1 = new foo2.M1.C1(), this.m1.y = 10, this.m1.x = 20;
|
||||
|
@ -1,5 +1,6 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
var M1, foo2 = require("./foo2");
|
||||
var foo2 = require("./foo2");
|
||||
export var M1;
|
||||
!function(M11) {
|
||||
var C1 = function() {
|
||||
"use strict";
|
||||
|
@ -1,9 +1,10 @@
|
||||
var E1;
|
||||
export class C1 {
|
||||
constructor(){
|
||||
this.m1 = 42;
|
||||
}
|
||||
}
|
||||
C1.s1 = !0, function(E1) {
|
||||
C1.s1 = !0;
|
||||
export var E1;
|
||||
!function(E1) {
|
||||
E1[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C";
|
||||
}(E1 || (E1 = {})), require("./foo_0");
|
||||
|
@ -1,8 +1,10 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
export var E1, i, z, C1 = function() {
|
||||
export var i, z, C1 = function() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, C1), this.m1 = 42;
|
||||
};
|
||||
C1.s1 = !0, function(E1) {
|
||||
C1.s1 = !0;
|
||||
export var E1;
|
||||
!function(E1) {
|
||||
E1[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C";
|
||||
}(E1 || (E1 = {})), require("./foo_0");
|
||||
|
@ -1,4 +1,5 @@
|
||||
var Foo, Bar, ns;
|
||||
var Bar, ns;
|
||||
export var Foo;
|
||||
!function(Foo) {
|
||||
Foo[Foo.A = 0] = "A", Foo[Foo.B = 1] = "B";
|
||||
}(Foo || (Foo = {})), function(Bar) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
var Foo, Bar, ns;
|
||||
var Bar, ns;
|
||||
export var Foo;
|
||||
!function(Foo) {
|
||||
Foo[Foo.A = 0] = "A", Foo[Foo.B = 1] = "B";
|
||||
}(Foo || (Foo = {})), function(Bar) {
|
||||
|
@ -1,8 +1,8 @@
|
||||
var Decl;
|
||||
import Entity from "m1";
|
||||
export default function Decl() {
|
||||
return 0;
|
||||
};
|
||||
!function(Decl) {
|
||||
Decl.x = 10, Decl.y = 20;
|
||||
export var Decl;
|
||||
!function(Decl1) {
|
||||
Decl1.x = 10, Decl1.y = 20;
|
||||
}(Decl || (Decl = {})), Entity(), Entity.x, Entity.y;
|
||||
|
@ -1,8 +1,8 @@
|
||||
var Decl;
|
||||
import Entity from "m1";
|
||||
export default function Decl() {
|
||||
return 0;
|
||||
};
|
||||
!function(Decl) {
|
||||
Decl.x = 10, Decl.y = 20;
|
||||
export var Decl;
|
||||
!function(Decl1) {
|
||||
Decl1.x = 10, Decl1.y = 20;
|
||||
}(Decl || (Decl = {})), Entity(), Entity.x, Entity.y;
|
||||
|
@ -1,10 +1,13 @@
|
||||
var E, N;
|
||||
export class C {
|
||||
}
|
||||
(C || (C = {})).x = 1, function(E) {
|
||||
(C || (C = {})).x = 1;
|
||||
export var E;
|
||||
!function(E) {
|
||||
E[E.w = 1] = "w";
|
||||
}(E || (E = {})), function(E) {
|
||||
E[E.x = 2] = "x";
|
||||
}(E || (E = {})), (E || (E = {})).y = 1, (E || (E = {})).z = 1, (N || (N = {})).x = 1;
|
||||
}(E || (E = {})), (E || (E = {})).y = 1, (E || (E = {})).z = 1;
|
||||
export var N;
|
||||
(N || (N = {})).x = 1;
|
||||
export function F() {}
|
||||
(F || (F = {})).x = 1;
|
||||
|
@ -1,14 +1,20 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
var C, E, E1, N, F, E2, N1, C1 = function() {
|
||||
var C, E, E1, N, F, C1 = function() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, C1);
|
||||
};
|
||||
export { E1 as E, E2 as E, N1 as N, C1 as C };
|
||||
C = C1 || (C1 = {}), C.x = 1, function(E2) {
|
||||
export { E1 as E, C1 as C };
|
||||
C = C1 || (C1 = {}), C.x = 1;
|
||||
var E2;
|
||||
export { E2 as E };
|
||||
!function(E2) {
|
||||
E2[E2.w = 1] = "w";
|
||||
}(E2 || (E2 = {})), function(E2) {
|
||||
E2[E2.x = 2] = "x";
|
||||
}(E2 || (E2 = {})), E = E2 || (E2 = {}), E.y = 1, E1 = E2 || (E2 = {}), E1.z = 1, N = N1 || (N1 = {}), N.x = 1;
|
||||
}(E2 || (E2 = {})), E = E2 || (E2 = {}), E.y = 1, E1 = E2 || (E2 = {}), E1.z = 1;
|
||||
var N1;
|
||||
export { N1 as N };
|
||||
N = N1 || (N1 = {}), N.x = 1;
|
||||
function F1() {}
|
||||
export { F1 as F };
|
||||
F = F1 || (F1 = {}), F.x = 1;
|
||||
|
@ -1,6 +1,8 @@
|
||||
var E1, E2;
|
||||
export var E1;
|
||||
!function(E1) {
|
||||
E1[E1.value1 = 0] = "value1";
|
||||
}(E1 || (E1 = {})), function(E2) {
|
||||
}(E1 || (E1 = {}));
|
||||
export var E2;
|
||||
!function(E2) {
|
||||
E2[E2.value1 = 0] = "value1";
|
||||
}(E2 || (E2 = {}));
|
||||
|
@ -1,6 +1,8 @@
|
||||
var E1, E2;
|
||||
export var E1;
|
||||
!function(E1) {
|
||||
E1[E1.value1 = 0] = "value1";
|
||||
}(E1 || (E1 = {})), function(E2) {
|
||||
}(E1 || (E1 = {}));
|
||||
export var E2;
|
||||
!function(E2) {
|
||||
E2[E2.value1 = 0] = "value1";
|
||||
}(E2 || (E2 = {}));
|
||||
|
@ -1,10 +1,13 @@
|
||||
var E, N;
|
||||
export class C {
|
||||
}
|
||||
(C || (C = {})).x = 1, function(E) {
|
||||
(C || (C = {})).x = 1;
|
||||
export var E;
|
||||
!function(E) {
|
||||
E[E.w = 1] = "w";
|
||||
}(E || (E = {})), function(E) {
|
||||
E[E.x = 2] = "x";
|
||||
}(E || (E = {})), (E || (E = {})).y = 1, (E || (E = {})).z = 1, (N || (N = {})).x = 1;
|
||||
}(E || (E = {})), (E || (E = {})).y = 1, (E || (E = {})).z = 1;
|
||||
export var N;
|
||||
(N || (N = {})).x = 1;
|
||||
export function F() {}
|
||||
(F || (F = {})).x = 1;
|
||||
|
@ -1,14 +1,20 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
var C, E, E1, N, F, E2, N1, C1 = function() {
|
||||
var C, E, E1, N, F, C1 = function() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, C1);
|
||||
};
|
||||
export { E1 as E, E2 as E, N1 as N, C1 as C };
|
||||
C = C1 || (C1 = {}), C.x = 1, function(E2) {
|
||||
export { E1 as E, C1 as C };
|
||||
C = C1 || (C1 = {}), C.x = 1;
|
||||
var E2;
|
||||
export { E2 as E };
|
||||
!function(E2) {
|
||||
E2[E2.w = 1] = "w";
|
||||
}(E2 || (E2 = {})), function(E2) {
|
||||
E2[E2.x = 2] = "x";
|
||||
}(E2 || (E2 = {})), E = E2 || (E2 = {}), E.y = 1, E1 = E2 || (E2 = {}), E1.z = 1, N = N1 || (N1 = {}), N.x = 1;
|
||||
}(E2 || (E2 = {})), E = E2 || (E2 = {}), E.y = 1, E1 = E2 || (E2 = {}), E1.z = 1;
|
||||
var N1;
|
||||
export { N1 as N };
|
||||
N = N1 || (N1 = {}), N.x = 1;
|
||||
function F1() {}
|
||||
export { F1 as F };
|
||||
F = F1 || (F1 = {}), F.x = 1;
|
||||
|
@ -1,6 +1,8 @@
|
||||
var E1, E2;
|
||||
export var E1;
|
||||
!function(E1) {
|
||||
E1[E1.value1 = 0] = "value1";
|
||||
}(E1 || (E1 = {})), function(E2) {
|
||||
}(E1 || (E1 = {}));
|
||||
export var E2;
|
||||
!function(E2) {
|
||||
E2[E2.value1 = 0] = "value1";
|
||||
}(E2 || (E2 = {}));
|
||||
|
@ -1,6 +1,8 @@
|
||||
var E1, E2;
|
||||
export var E1;
|
||||
!function(E1) {
|
||||
E1[E1.value1 = 0] = "value1";
|
||||
}(E1 || (E1 = {})), function(E2) {
|
||||
}(E1 || (E1 = {}));
|
||||
export var E2;
|
||||
!function(E2) {
|
||||
E2[E2.value1 = 0] = "value1";
|
||||
}(E2 || (E2 = {}));
|
||||
|
@ -1,13 +1,18 @@
|
||||
import { I1 as I, N1 as N, T1 as T } from "./t1";
|
||||
export var E, D, M, v = 1;
|
||||
export var v = 1;
|
||||
export function f() {}
|
||||
export class C {
|
||||
}
|
||||
export var E;
|
||||
!function(E) {
|
||||
E[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C";
|
||||
}(E || (E = {})), function(D) {
|
||||
}(E || (E = {}));
|
||||
export var D;
|
||||
!function(D) {
|
||||
D[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C";
|
||||
}(D || (D = {})), function(M1) {
|
||||
}(D || (D = {}));
|
||||
export var M;
|
||||
!function(M1) {
|
||||
var x;
|
||||
M1.x = x;
|
||||
}(M || (M = {}));
|
||||
|
@ -1,16 +1,21 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
import { I1 as I, N1 as N, T1 as T } from "./t1";
|
||||
export var E, D, M, v = 1;
|
||||
export var v = 1;
|
||||
export function f() {}
|
||||
export var C = function() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, C);
|
||||
};
|
||||
export var E;
|
||||
!function(E) {
|
||||
E[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C";
|
||||
}(E || (E = {})), function(D) {
|
||||
}(E || (E = {}));
|
||||
export var D;
|
||||
!function(D) {
|
||||
D[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C";
|
||||
}(D || (D = {})), function(M1) {
|
||||
}(D || (D = {}));
|
||||
export var M;
|
||||
!function(M1) {
|
||||
var x;
|
||||
M1.x = x;
|
||||
}(M || (M = {}));
|
||||
|
@ -1,13 +1,18 @@
|
||||
import { I1 as I, N1 as N, T1 as T } from "./t1";
|
||||
export var E, D, M, v = 1;
|
||||
export var v = 1;
|
||||
export function f() {}
|
||||
export class C {
|
||||
}
|
||||
export var E;
|
||||
!function(E) {
|
||||
E[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C";
|
||||
}(E || (E = {})), function(D) {
|
||||
}(E || (E = {}));
|
||||
export var D;
|
||||
!function(D) {
|
||||
D[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C";
|
||||
}(D || (D = {})), function(M1) {
|
||||
}(D || (D = {}));
|
||||
export var M;
|
||||
!function(M1) {
|
||||
var x;
|
||||
M1.x = x;
|
||||
}(M || (M = {}));
|
||||
|
@ -1,16 +1,21 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
import { I1 as I, N1 as N, T1 as T } from "./t1";
|
||||
export var E, D, M, v = 1;
|
||||
export var v = 1;
|
||||
export function f() {}
|
||||
export var C = function() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, C);
|
||||
};
|
||||
export var E;
|
||||
!function(E) {
|
||||
E[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C";
|
||||
}(E || (E = {})), function(D) {
|
||||
}(E || (E = {}));
|
||||
export var D;
|
||||
!function(D) {
|
||||
D[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C";
|
||||
}(D || (D = {})), function(M1) {
|
||||
}(D || (D = {}));
|
||||
export var M;
|
||||
!function(M1) {
|
||||
var x;
|
||||
M1.x = x;
|
||||
}(M || (M = {}));
|
||||
|
@ -1,13 +1,18 @@
|
||||
import { I1 as I, N1 as N, T1 as T } from "./t1";
|
||||
export var E, D, M, v = 1;
|
||||
export var v = 1;
|
||||
export function f() {}
|
||||
export class C {
|
||||
}
|
||||
export var E;
|
||||
!function(E) {
|
||||
E[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C";
|
||||
}(E || (E = {})), function(D) {
|
||||
}(E || (E = {}));
|
||||
export var D;
|
||||
!function(D) {
|
||||
D[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C";
|
||||
}(D || (D = {})), function(M1) {
|
||||
}(D || (D = {}));
|
||||
export var M;
|
||||
!function(M1) {
|
||||
var x;
|
||||
M1.x = x;
|
||||
}(M || (M = {}));
|
||||
|
@ -1,16 +1,21 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
import { I1 as I, N1 as N, T1 as T } from "./t1";
|
||||
export var E, D, M, v = 1;
|
||||
export var v = 1;
|
||||
export function f() {}
|
||||
export var C = function() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, C);
|
||||
};
|
||||
export var E;
|
||||
!function(E) {
|
||||
E[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C";
|
||||
}(E || (E = {})), function(D) {
|
||||
}(E || (E = {}));
|
||||
export var D;
|
||||
!function(D) {
|
||||
D[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C";
|
||||
}(D || (D = {})), function(M1) {
|
||||
}(D || (D = {}));
|
||||
export var M;
|
||||
!function(M1) {
|
||||
var x;
|
||||
M1.x = x;
|
||||
}(M || (M = {}));
|
||||
|
@ -1,8 +1,9 @@
|
||||
var C, K;
|
||||
var K;
|
||||
export default class {
|
||||
};
|
||||
export class A {
|
||||
}
|
||||
export var C;
|
||||
!function(C) {
|
||||
C[C.One = 0] = "One", C[C.Two = 1] = "Two";
|
||||
}(C || (C = {}));
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
var C, a, b, a, b, b, c, d, K, _default = function() {
|
||||
var a, b, a, b, b, c, d, K, _default = function() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, _default);
|
||||
};
|
||||
@ -7,6 +7,7 @@ export var A = function() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, A);
|
||||
};
|
||||
export var C;
|
||||
!function(C) {
|
||||
C[C.One = 0] = "One", C[C.Two = 1] = "Two";
|
||||
}(C || (C = {})), console.log(a, b), console.log(a, b);
|
||||
|
@ -1,18 +1,33 @@
|
||||
var B, C, DD, E, F, G, H, I, J, K, L;
|
||||
var C, DD;
|
||||
export var A;
|
||||
export var B;
|
||||
!function(B) {
|
||||
B[B.Member = 0] = "Member";
|
||||
}(B || (B = {}));
|
||||
export var E;
|
||||
export var F;
|
||||
export var G;
|
||||
!function(G) {
|
||||
G[G.A = 1] = "A", G[G.B = 2] = "B", G[G.C = 3] = "C";
|
||||
}(G || (G = {})), function(H) {
|
||||
}(G || (G = {}));
|
||||
export var H;
|
||||
!function(H) {
|
||||
H.A = "a", H.B = "b";
|
||||
}(H || (H = {})), function(I) {
|
||||
}(H || (H = {}));
|
||||
export var I;
|
||||
!function(I) {
|
||||
I.A = "a", I[I.B = 0] = "B", I[I.C = 1] = "C";
|
||||
}(I || (I = {})), function(J) {
|
||||
}(I || (I = {}));
|
||||
export var J;
|
||||
!function(J) {
|
||||
J[J.A = 1] = "A", J[J.B = 2] = "B", J[J.C = 3] = "C";
|
||||
}(J || (J = {})), function(K) {
|
||||
}(J || (J = {}));
|
||||
export var K;
|
||||
!function(K) {
|
||||
K[K.None = 0] = "None", K[K.A = 1] = "A", K[K.B = 2] = "B", K[K.C = 4] = "C", K[K.Mask = 7] = "Mask";
|
||||
}(K || (K = {})), function(L) {
|
||||
}(K || (K = {}));
|
||||
export var L;
|
||||
!function(L) {
|
||||
L[L.None = 0] = "None", L[L.A = 1] = "A", L[L.B = 2] = "B", L[L.C = 4] = "C", L[L.Mask = 7] = "Mask";
|
||||
}(L || (L = {}));
|
||||
export { C, DD as D, E as EE, F as FF };
|
||||
|
@ -1,18 +1,33 @@
|
||||
var B, C, DD, E, F, G, H, I, J, K, L;
|
||||
var C, DD;
|
||||
export var A;
|
||||
export var B;
|
||||
!function(B) {
|
||||
B[B.Member = 0] = "Member";
|
||||
}(B || (B = {}));
|
||||
export var E;
|
||||
export var F;
|
||||
export var G;
|
||||
!function(G) {
|
||||
G[G.A = 1] = "A", G[G.B = 2] = "B", G[G.C = 3] = "C";
|
||||
}(G || (G = {})), function(H) {
|
||||
}(G || (G = {}));
|
||||
export var H;
|
||||
!function(H) {
|
||||
H.A = "a", H.B = "b";
|
||||
}(H || (H = {})), function(I) {
|
||||
}(H || (H = {}));
|
||||
export var I;
|
||||
!function(I) {
|
||||
I.A = "a", I[I.B = 0] = "B", I[I.C = 1] = "C";
|
||||
}(I || (I = {})), function(J) {
|
||||
}(I || (I = {}));
|
||||
export var J;
|
||||
!function(J) {
|
||||
J[J.A = 1] = "A", J[J.B = 2] = "B", J[J.C = 3] = "C";
|
||||
}(J || (J = {})), function(K) {
|
||||
}(J || (J = {}));
|
||||
export var K;
|
||||
!function(K) {
|
||||
K[K.None = 0] = "None", K[K.A = 1] = "A", K[K.B = 2] = "B", K[K.C = 4] = "C", K[K.Mask = 7] = "Mask";
|
||||
}(K || (K = {})), function(L) {
|
||||
}(K || (K = {}));
|
||||
export var L;
|
||||
!function(L) {
|
||||
L[L.None = 0] = "None", L[L.A = 1] = "A", L[L.B = 2] = "B", L[L.C = 4] = "C", L[L.Mask = 7] = "Mask";
|
||||
}(L || (L = {}));
|
||||
export { C, DD as D, E as EE, F as FF };
|
||||
|
@ -1,4 +1,5 @@
|
||||
export var A, Something = 2;
|
||||
export var Something = 2;
|
||||
export var A;
|
||||
!function(A1) {
|
||||
A1.B || (A1.B = {}), new (require("fs")).Something();
|
||||
}(A || (A = {}));
|
||||
|
@ -1,8 +1,9 @@
|
||||
var M2, M21, foo = 42;
|
||||
export { M21 as M2 };
|
||||
export var M2, foo = 42;
|
||||
export function f() {
|
||||
return 42;
|
||||
}
|
||||
var M21;
|
||||
export { M21 as M2 };
|
||||
M2 = M21 || (M21 = {}), M2.x = !0;
|
||||
const foo0 = require("../foo_0"), foo1 = require("./test/foo_1"), foo2 = require("./.././test/foo_2");
|
||||
foo2.M2.x && foo0.foo + foo1.f();
|
||||
|
@ -1,8 +1,9 @@
|
||||
var M2, M21, foo = 42;
|
||||
export { M21 as M2 };
|
||||
export var M2, foo = 42;
|
||||
export function f() {
|
||||
return 42;
|
||||
}
|
||||
var M21;
|
||||
export { M21 as M2 };
|
||||
M2 = M21 || (M21 = {}), M2.x = !0;
|
||||
var foo0 = require("../foo_0"), foo1 = require("./test/foo_1"), foo2 = require("./.././test/foo_2");
|
||||
foo2.M2.x && foo0.foo + foo1.f();
|
||||
|
@ -1,3 +1,3 @@
|
||||
var types;
|
||||
export var types;
|
||||
(types || (types = {})).A = class {
|
||||
};
|
||||
|
@ -5,6 +5,7 @@ export var Reflect = function() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, Reflect);
|
||||
};
|
||||
export var Baz;
|
||||
var _class = function() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, _class);
|
||||
|
@ -1 +1,2 @@
|
||||
export var x;
|
||||
require("vs/foo").x;
|
||||
|
@ -1,6 +1,7 @@
|
||||
var foo;
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
import { React } from "./test";
|
||||
export var React;
|
||||
swcHelpers.extends({
|
||||
x: ""
|
||||
}, foo, {
|
||||
|
@ -1,6 +1,7 @@
|
||||
var foo;
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
import { React } from "./test";
|
||||
export var React;
|
||||
swcHelpers.extends({
|
||||
x: ""
|
||||
}, foo, {
|
||||
|
@ -1,2 +1,3 @@
|
||||
var var1;
|
||||
"string" == typeof var1 && var1.length;
|
||||
export var var2;
|
||||
|
@ -1,2 +1,3 @@
|
||||
var var1;
|
||||
"string" == typeof var1 && var1.length;
|
||||
export var var2;
|
||||
|
@ -1,11 +1,30 @@
|
||||
var M, E;
|
||||
function foo() {}
|
||||
export var r1;
|
||||
export var r2;
|
||||
export var c;
|
||||
export var r3;
|
||||
export var r4;
|
||||
export var r4b;
|
||||
export var i;
|
||||
export var r5;
|
||||
export var r5;
|
||||
!function(M1) {
|
||||
M1.foo = "", M1.C = class {
|
||||
};
|
||||
}(M || (M = {})), function(E) {
|
||||
}(M || (M = {}));
|
||||
export var r6;
|
||||
export var r7;
|
||||
export var r8;
|
||||
export var r9;
|
||||
!function(E) {
|
||||
E[E.A = 0] = "A";
|
||||
}(E || (E = {})), function(foo1) {
|
||||
}(E || (E = {}));
|
||||
export var r10;
|
||||
export var r11;
|
||||
export var r12;
|
||||
function foo() {}
|
||||
!function(foo1) {
|
||||
foo1.y = 1, foo1.C = class {
|
||||
};
|
||||
}(foo || (foo = {}));
|
||||
export var r13;
|
||||
|
@ -1,9 +1,17 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
export var r1;
|
||||
export var r2;
|
||||
var M, E, C = function() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, C);
|
||||
};
|
||||
function foo() {}
|
||||
export var c;
|
||||
export var r3;
|
||||
export var r4;
|
||||
export var r4b;
|
||||
export var i;
|
||||
export var r5;
|
||||
export var r5;
|
||||
!function(M1) {
|
||||
M1.foo = "";
|
||||
var C1 = function() {
|
||||
@ -11,9 +19,19 @@ function foo() {}
|
||||
swcHelpers.classCallCheck(this, C1);
|
||||
};
|
||||
M1.C = C1;
|
||||
}(M || (M = {})), function(E) {
|
||||
}(M || (M = {}));
|
||||
export var r6;
|
||||
export var r7;
|
||||
export var r8;
|
||||
export var r9;
|
||||
!function(E) {
|
||||
E[E.A = 0] = "A";
|
||||
}(E || (E = {})), function(foo1) {
|
||||
}(E || (E = {}));
|
||||
export var r10;
|
||||
export var r11;
|
||||
export var r12;
|
||||
function foo() {}
|
||||
!function(foo1) {
|
||||
foo1.y = 1;
|
||||
var C2 = function() {
|
||||
"use strict";
|
||||
@ -21,3 +39,4 @@ function foo() {}
|
||||
};
|
||||
foo1.C = C2;
|
||||
}(foo || (foo = {}));
|
||||
export var r13;
|
||||
|
@ -1,19 +1,38 @@
|
||||
export var r1, r2, c, c2, r3, r4, r4b, i, i2, r5, r5, M, r6, r7, r8, r9, E, r10, r11, r12, r13, x = 1;
|
||||
export var c2, i2, x = 1;
|
||||
export var r1;
|
||||
export var y = {
|
||||
foo: ""
|
||||
};
|
||||
export var r2;
|
||||
export class C {
|
||||
}
|
||||
export var c;
|
||||
export var r3;
|
||||
export var r4;
|
||||
export var r4b;
|
||||
export var i;
|
||||
export var r5;
|
||||
export var r5;
|
||||
export var M;
|
||||
!function(M1) {
|
||||
M1.foo = "", M1.C = class {
|
||||
};
|
||||
}(M || (M = {}));
|
||||
export var r6;
|
||||
export var r7;
|
||||
export var Z = M;
|
||||
export var r8;
|
||||
export var r9;
|
||||
export var E;
|
||||
!function(E) {
|
||||
E[E.A = 0] = "A";
|
||||
}(E || (E = {}));
|
||||
export var r10;
|
||||
export var r11;
|
||||
export var r12;
|
||||
export function foo() {}
|
||||
!function(foo1) {
|
||||
foo1.y = 1, foo1.C = class {
|
||||
};
|
||||
}(foo || (foo = {}));
|
||||
export var r13;
|
||||
|
@ -1,12 +1,22 @@
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
export var r1, r2, c, c2, r3, r4, r4b, i, i2, r5, r5, M, r6, r7, r8, r9, E, r10, r11, r12, r13, x = 1;
|
||||
export var c2, i2, x = 1;
|
||||
export var r1;
|
||||
export var y = {
|
||||
foo: ""
|
||||
};
|
||||
export var r2;
|
||||
export var C = function() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, C);
|
||||
};
|
||||
export var c;
|
||||
export var r3;
|
||||
export var r4;
|
||||
export var r4b;
|
||||
export var i;
|
||||
export var r5;
|
||||
export var r5;
|
||||
export var M;
|
||||
!function(M1) {
|
||||
M1.foo = "";
|
||||
var C1 = function() {
|
||||
@ -15,10 +25,18 @@ export var C = function() {
|
||||
};
|
||||
M1.C = C1;
|
||||
}(M || (M = {}));
|
||||
export var r6;
|
||||
export var r7;
|
||||
export var Z = M;
|
||||
export var r8;
|
||||
export var r9;
|
||||
export var E;
|
||||
!function(E) {
|
||||
E[E.A = 0] = "A";
|
||||
}(E || (E = {}));
|
||||
export var r10;
|
||||
export var r11;
|
||||
export var r12;
|
||||
export function foo() {}
|
||||
!function(foo1) {
|
||||
foo1.y = 1;
|
||||
@ -28,3 +46,4 @@ export function foo() {}
|
||||
};
|
||||
foo1.C = C2;
|
||||
}(foo || (foo = {}));
|
||||
export var r13;
|
||||
|
@ -287,6 +287,12 @@ impl Visit for VarWithOutInitCounter {
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_module_item(&mut self, s: &ModuleItem) {
|
||||
if let ModuleItem::Stmt(_) = s {
|
||||
s.visit_children_with(self);
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_var_decl_or_pat(&mut self, _: &VarDeclOrPat) {}
|
||||
}
|
||||
|
||||
@ -309,17 +315,8 @@ impl VisitMut for VarMover {
|
||||
fn visit_mut_function(&mut self, _: &mut Function) {}
|
||||
|
||||
fn visit_mut_module_item(&mut self, s: &mut ModuleItem) {
|
||||
s.visit_mut_children_with(self);
|
||||
|
||||
match s {
|
||||
ModuleItem::ModuleDecl(ModuleDecl::ExportDecl(ExportDecl {
|
||||
decl: Decl::Var(d),
|
||||
..
|
||||
})) if d.decls.is_empty() => {
|
||||
s.take();
|
||||
}
|
||||
|
||||
_ => {}
|
||||
if let ModuleItem::Stmt(_) = s {
|
||||
s.visit_mut_children_with(self);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,160 @@
|
||||
TestSnapshot {
|
||||
vars: [
|
||||
(
|
||||
(
|
||||
Atom('a' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: true,
|
||||
ref_count: 0,
|
||||
cond_init: false,
|
||||
declared: true,
|
||||
declared_count: 1,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 0,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: false,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: Some(
|
||||
"var",
|
||||
),
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
used_as_arg: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('b' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: true,
|
||||
ref_count: 0,
|
||||
cond_init: false,
|
||||
declared: true,
|
||||
declared_count: 1,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 0,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: false,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: Some(
|
||||
"var",
|
||||
),
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
used_as_arg: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('c' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 0,
|
||||
cond_init: false,
|
||||
declared: true,
|
||||
declared_count: 1,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 0,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: false,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: Some(
|
||||
"var",
|
||||
),
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
used_as_arg: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('d' type=inline),
|
||||
#1,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 0,
|
||||
cond_init: false,
|
||||
declared: true,
|
||||
declared_count: 1,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 0,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: false,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: Some(
|
||||
"var",
|
||||
),
|
||||
var_initialized: false,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
used_as_arg: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
],
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"collapse_vars": true
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
export var a;
|
||||
export var b;
|
||||
var c;
|
||||
var d;
|
@ -0,0 +1,3 @@
|
||||
var c, d;
|
||||
export var a;
|
||||
export var b;
|
Loading…
Reference in New Issue
Block a user