-
-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
91 changed files
with
1,158 additions
and
1,310 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/basic/actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
function foo() { | ||
var xxx = 1; | ||
if (xxx) { | ||
console.log(xxx); | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/basic/expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
function foo() { | ||
var a = 1; | ||
if (a) { | ||
console.log(a); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/classes/actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class A {} | ||
class B {} | ||
new A(); | ||
new B(); | ||
function a() { | ||
class A {} | ||
class B {} | ||
new A(); | ||
new B(); | ||
} |
10 changes: 10 additions & 0 deletions
10
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/classes/expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class A {} | ||
class B {} | ||
new A(); | ||
new B(); | ||
function a() { | ||
class a {} | ||
class b {} | ||
new a(); | ||
new b(); | ||
} |
8 changes: 8 additions & 0 deletions
8
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/closures-2/actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
function foo() { | ||
function bar(baz) { | ||
return function() { | ||
bam(); | ||
}; | ||
} | ||
function bam() {} | ||
} |
8 changes: 8 additions & 0 deletions
8
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/closures-2/expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
function foo() { | ||
function a(a) { | ||
return function () { | ||
b(); | ||
}; | ||
} | ||
function b() {} | ||
} |
9 changes: 9 additions & 0 deletions
9
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/closures/actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
function foo() { | ||
function bar() { | ||
var baz; | ||
if (baz) { | ||
bam(); | ||
} | ||
} | ||
function bam() {} | ||
} |
9 changes: 9 additions & 0 deletions
9
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/closures/expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
function foo() { | ||
function a() { | ||
var a; | ||
if (a) { | ||
b(); | ||
} | ||
} | ||
function b() {} | ||
} |
12 changes: 12 additions & 0 deletions
12
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/constant-violations-2/actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
!function() { | ||
var bar = 1; | ||
bar--; | ||
var bar = 10; | ||
foo(bar); | ||
function foo() { | ||
var foo = 10; | ||
foo++; | ||
var foo = 20; | ||
foo(foo); | ||
} | ||
}; |
12 changes: 12 additions & 0 deletions
12
...ges/babel-plugin-minify-mangle-names/__tests__/fixtures/constant-violations-2/expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
!function () { | ||
var b = 1; | ||
b--; | ||
var b = 10; | ||
a(b); | ||
function a() { | ||
var a = 10; | ||
a++; | ||
var a = 20; | ||
a(a); | ||
} | ||
}; |
5 changes: 5 additions & 0 deletions
5
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/constant-violations-3/actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
(function() { | ||
var foo = bar, | ||
foo = baz; | ||
foo; | ||
})(); |
5 changes: 5 additions & 0 deletions
5
...ges/babel-plugin-minify-mangle-names/__tests__/fixtures/constant-violations-3/expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
(function () { | ||
var a = bar, | ||
a = baz; | ||
a; | ||
})(); |
20 changes: 20 additions & 0 deletions
20
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/constant-violations-4/actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
function foo() { | ||
var x; | ||
x; | ||
x; | ||
{ | ||
var x; | ||
x; | ||
x; | ||
function y() { | ||
var x; | ||
x; | ||
x; | ||
{ | ||
var x; | ||
x; | ||
x; | ||
} | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...ges/babel-plugin-minify-mangle-names/__tests__/fixtures/constant-violations-4/expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
function foo() { | ||
var a; | ||
a; | ||
a; | ||
{ | ||
var a; | ||
a; | ||
a; | ||
function b() { | ||
var a; | ||
a; | ||
a; | ||
{ | ||
var a; | ||
a; | ||
a; | ||
} | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/constant-violations/actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
!function() { | ||
var foo = 1; | ||
foo++; | ||
var foo = 2; | ||
foo++; | ||
}; | ||
|
||
(function() { | ||
var x = y; | ||
x = z; | ||
x; | ||
})(); |
12 changes: 12 additions & 0 deletions
12
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/constant-violations/expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
!function () { | ||
var a = 1; | ||
a++; | ||
var a = 2; | ||
a++; | ||
}; | ||
|
||
(function () { | ||
var a = y; | ||
a = z; | ||
a; | ||
})(); |
12 changes: 12 additions & 0 deletions
12
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/deeply-nested/actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
function xoo() { | ||
function foo(zz, xx, yy) { | ||
function bar(zip, zap, zop) { | ||
return function(bar) { | ||
zap(); | ||
return function() { | ||
zip(); | ||
}; | ||
}; | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/deeply-nested/expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
function xoo() { | ||
function a(a, b, c) { | ||
function d(a, b, c) { | ||
return function (c) { | ||
b(); | ||
return function () { | ||
a(); | ||
}; | ||
}; | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/destructuring/actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// issue#326 | ||
function a() { | ||
let foo, bar, baz; | ||
({ foo, bar, baz } = {}); | ||
return { foo, bar, baz }; | ||
} | ||
// issue#369 | ||
function decodeMessage(message) { | ||
let namespace; | ||
let name; | ||
let value = null; | ||
|
||
[, namespace, name, value] = message.split(",") || []; | ||
console.log(name); | ||
} |
15 changes: 15 additions & 0 deletions
15
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/destructuring/expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// issue#326 | ||
function a() { | ||
let a, b, c; | ||
({ foo: a, bar: b, baz: c } = {}); | ||
return { foo: a, bar: b, baz: c }; | ||
} | ||
// issue#369 | ||
function decodeMessage(a) { | ||
let b; | ||
let c; | ||
let d = null; | ||
|
||
[, b, c, d] = a.split(",") || []; | ||
console.log(c); | ||
} |
10 changes: 10 additions & 0 deletions
10
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/eval-scope-ignore/actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
function foo() { | ||
var inScopeOuter = 1; | ||
(function() { | ||
var inScopeInner = 2; | ||
eval("..."); | ||
(function() { | ||
var outOfScope = 1; | ||
})(); | ||
})(); | ||
} |
10 changes: 10 additions & 0 deletions
10
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/eval-scope-ignore/expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
function foo() { | ||
var a = 1; | ||
(function () { | ||
var a = 2; | ||
eval("..."); | ||
(function () { | ||
var a = 1; | ||
})(); | ||
})(); | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/eval-scope-ignore/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"eval": true | ||
} |
10 changes: 10 additions & 0 deletions
10
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/eval-scope/actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
function foo() { | ||
var inScopeOuter = 1; | ||
(function() { | ||
var inScopeInner = 2; | ||
eval("inScopeInner + inScopeOuter"); | ||
(function() { | ||
var outOfScope = 1; | ||
})(); | ||
})(); | ||
} |
10 changes: 10 additions & 0 deletions
10
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/eval-scope/expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
function foo() { | ||
var inScopeOuter = 1; | ||
(function () { | ||
var inScopeInner = 2; | ||
eval("inScopeInner + inScopeOuter"); | ||
(function () { | ||
var a = 1; | ||
})(); | ||
})(); | ||
} |
8 changes: 8 additions & 0 deletions
8
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/fn-only-thunk/actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
function foo() { | ||
function xx(bar, baz) { | ||
if (1) { | ||
yy(bar, baz); | ||
} | ||
} | ||
function yy() {} | ||
} |
8 changes: 8 additions & 0 deletions
8
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/fn-only-thunk/expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
function foo() { | ||
function a(a, c) { | ||
if (1) { | ||
b(a, c); | ||
} | ||
} | ||
function b() {} | ||
} |
5 changes: 5 additions & 0 deletions
5
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/fn-params/actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
function foo(xxx) { | ||
if (xxx) { | ||
console.log(xxx); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/fn-params/expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
function foo(a) { | ||
if (a) { | ||
console.log(a); | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/global-conflicts/actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
function e() { | ||
function foo() { | ||
b = bar(); | ||
} | ||
function bar() {} | ||
} |
6 changes: 6 additions & 0 deletions
6
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/global-conflicts/expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
function e() { | ||
function a() { | ||
b = c(); | ||
} | ||
function c() {} | ||
} |
11 changes: 11 additions & 0 deletions
11
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/globals-2/actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class A {} | ||
class B extends A {} | ||
(function() { | ||
class C { | ||
constructor() { | ||
new A(); | ||
new B(); | ||
C; | ||
} | ||
} | ||
})(); |
11 changes: 11 additions & 0 deletions
11
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/globals-2/expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class A {} | ||
class B extends A {} | ||
(function () { | ||
class a { | ||
constructor() { | ||
new A(); | ||
new B(); | ||
a; | ||
} | ||
} | ||
})(); |
1 change: 1 addition & 0 deletions
1
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/globals/actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
var Foo = 1; |
1 change: 1 addition & 0 deletions
1
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/globals/expected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
var Foo = 1; |
13 changes: 13 additions & 0 deletions
13
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/hoisted/actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
(function() { | ||
function foo() { | ||
{ | ||
var baz = true; | ||
|
||
{ | ||
bar(); | ||
} | ||
} | ||
} | ||
|
||
function bar() {} | ||
})(); |
Oops, something went wrong.