-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preserve rendered class names (#4674)
* Preserve class declaration names * Preserve class expression names * Slightly improve code
- Loading branch information
1 parent
11d425b
commit 46e1eaa
Showing
30 changed files
with
147 additions
and
37 deletions.
There are no files selected for viewing
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
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
4 changes: 2 additions & 2 deletions
4
test/chunking-form/samples/circular-entry-points/_expected/amd/generated-main1.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
4 changes: 2 additions & 2 deletions
4
test/chunking-form/samples/circular-entry-points/_expected/cjs/generated-main1.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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
'use strict'; | ||
|
||
class C$1 { | ||
let C$1 = class C { | ||
fn (num) { | ||
console.log(num - p); | ||
} | ||
} | ||
}; | ||
|
||
var p$1 = 43; | ||
|
||
|
4 changes: 2 additions & 2 deletions
4
test/chunking-form/samples/circular-entry-points/_expected/es/generated-main1.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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
class C$1 { | ||
let C$1 = class C { | ||
fn (num) { | ||
console.log(num - p); | ||
} | ||
} | ||
}; | ||
|
||
var p$1 = 43; | ||
|
||
|
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
4 changes: 2 additions & 2 deletions
4
test/chunking-form/samples/circular-entry-points2/_expected/amd/main2.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
4 changes: 2 additions & 2 deletions
4
test/chunking-form/samples/circular-entry-points2/_expected/cjs/main2.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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
'use strict'; | ||
|
||
class C$1 { | ||
let C$1 = class C { | ||
fn (num) { | ||
console.log(num - p); | ||
} | ||
} | ||
}; | ||
|
||
var p$1 = 43; | ||
|
||
|
4 changes: 2 additions & 2 deletions
4
test/chunking-form/samples/circular-entry-points2/_expected/es/main2.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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
class C$1 { | ||
let C$1 = class C { | ||
fn (num) { | ||
console.log(num - p); | ||
} | ||
} | ||
}; | ||
|
||
var p$1 = 43; | ||
|
||
|
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
4 changes: 2 additions & 2 deletions
4
test/chunking-form/samples/circular-entry-points3/_expected/amd/generated-main1.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
4 changes: 2 additions & 2 deletions
4
test/chunking-form/samples/circular-entry-points3/_expected/cjs/generated-main1.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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
'use strict'; | ||
|
||
class C$1 { | ||
let C$1 = class C { | ||
fn (num) { | ||
console.log(num - p); | ||
} | ||
} | ||
}; | ||
|
||
var p$1 = 43; | ||
|
||
|
4 changes: 2 additions & 2 deletions
4
test/chunking-form/samples/circular-entry-points3/_expected/es/generated-main1.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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
class C$1 { | ||
let C$1 = class C { | ||
fn (num) { | ||
console.log(num - p); | ||
} | ||
} | ||
}; | ||
|
||
var p$1 = 43; | ||
|
||
|
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
4 changes: 4 additions & 0 deletions
4
test/form/samples/exported-class-declaration-conflict/_config.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,4 @@ | ||
module.exports = { | ||
description: 'handles exporting class declarations with name conflicts in SystemJS', | ||
options: { output: { name: 'bundle' } } | ||
}; |
10 changes: 10 additions & 0 deletions
10
test/form/samples/exported-class-declaration-conflict/_expected/amd.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 @@ | ||
define(['exports'], (function (exports) { 'use strict'; | ||
|
||
let Foo$1 = class Foo {}; | ||
|
||
class Foo {} | ||
|
||
exports.First = Foo$1; | ||
exports.Second = Foo; | ||
|
||
})); |
8 changes: 8 additions & 0 deletions
8
test/form/samples/exported-class-declaration-conflict/_expected/cjs.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 @@ | ||
'use strict'; | ||
|
||
let Foo$1 = class Foo {}; | ||
|
||
class Foo {} | ||
|
||
exports.First = Foo$1; | ||
exports.Second = Foo; |
5 changes: 5 additions & 0 deletions
5
test/form/samples/exported-class-declaration-conflict/_expected/es.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 @@ | ||
let Foo$1 = class Foo {}; | ||
|
||
class Foo {} | ||
|
||
export { Foo$1 as First, Foo as Second }; |
13 changes: 13 additions & 0 deletions
13
test/form/samples/exported-class-declaration-conflict/_expected/iife.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 @@ | ||
var bundle = (function (exports) { | ||
'use strict'; | ||
|
||
let Foo$1 = class Foo {}; | ||
|
||
class Foo {} | ||
|
||
exports.First = Foo$1; | ||
exports.Second = Foo; | ||
|
||
return exports; | ||
|
||
})({}); |
12 changes: 12 additions & 0 deletions
12
test/form/samples/exported-class-declaration-conflict/_expected/system.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 @@ | ||
System.register('bundle', [], (function (exports) { | ||
'use strict'; | ||
return { | ||
execute: (function () { | ||
|
||
let Foo$1 = class Foo {}; exports('First', Foo$1); | ||
|
||
class Foo {} exports('Second', Foo); | ||
|
||
}) | ||
}; | ||
})); |
14 changes: 14 additions & 0 deletions
14
test/form/samples/exported-class-declaration-conflict/_expected/umd.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,14 @@ | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.bundle = {})); | ||
})(this, (function (exports) { 'use strict'; | ||
|
||
let Foo$1 = class Foo {}; | ||
|
||
class Foo {} | ||
|
||
exports.First = Foo$1; | ||
exports.Second = Foo; | ||
|
||
})); |
2 changes: 2 additions & 0 deletions
2
test/form/samples/exported-class-declaration-conflict/first.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,2 @@ | ||
class Foo {} | ||
export { Foo }; |
2 changes: 2 additions & 0 deletions
2
test/form/samples/exported-class-declaration-conflict/main.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,2 @@ | ||
export { Foo as First } from './first'; | ||
export { Foo as Second } from './second'; |
2 changes: 2 additions & 0 deletions
2
test/form/samples/exported-class-declaration-conflict/second.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,2 @@ | ||
class Foo {} | ||
export { Foo }; |
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 @@ | ||
module.exports = { | ||
description: 'preserves class names even if the class is renamed' | ||
}; |
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 @@ | ||
class foo {} | ||
|
||
assert.strictEqual(foo.name, 'foo'); |
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 @@ | ||
class foo {} | ||
|
||
assert.strictEqual(foo.name, 'foo'); |
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 @@ | ||
let foo = class {}; | ||
|
||
assert.strictEqual(foo.name, 'foo'); |
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 @@ | ||
let foo = class {}; | ||
|
||
assert.strictEqual(foo.name, 'foo'); |
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,4 @@ | ||
import './expression1'; | ||
import './declaration1'; | ||
import './expression2'; | ||
import './declaration2'; |