Commit 7cc4a8d
authored
Wrap classes with decorators or static properties in an IIFE, even for ES2015+ (microsoft#32011)
* Always wrap classes with decorators or static properties in an IIFE
Currently only script targets less than or equal to ES5 will wrap classes. However, the wrapping is also crucial to file size optimizations for ES2015+ as well. Without the IIFE wrapper, minification tools do not elide the class. This is due to references to the class being present within the downlevelled decorator and static property code.
This change represents the full completion of issue microsoft#15857
* Accept new baselines1 parent 1d6bb8b commit 7cc4a8dCopy full SHA for 7cc4a8d
73 files changed
+1,286-967Lines changed: 1286 additions & 967 deletions
File tree
Expand file treeCollapse file tree
Open diff view settings
Filter options
- src/compiler/transformers
- tests/baselines/reference
- transformApi
- tscWatch/programUpdates
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Expand file treeCollapse file tree
Open diff view settings
Collapse file
src/compiler/transformers/ts.ts
Copy file name to clipboardExpand all lines: src/compiler/transformers/ts.ts+8-4Lines changed: 8 additions & 4 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
23 | 23 | |
24 | 24 | |
25 | 25 | |
26 | | - |
27 | 26 | |
28 | 27 | |
29 | 28 | |
30 | | - |
| 29 | + |
31 | 30 | |
32 | 31 | |
33 | 32 | |
| ||
590 | 589 | |
591 | 590 | |
592 | 591 | |
593 | | - |
594 | 592 | |
595 | 593 | |
596 | 594 | |
| ||
661 | 659 | |
662 | 660 | |
663 | 661 | |
| 662 | + |
| 663 | + |
| 664 | + |
| 665 | + |
| 666 | + |
| 667 | + |
664 | 668 | |
665 | 669 | |
666 | 670 | |
| ||
669 | 673 | |
670 | 674 | |
671 | 675 | |
672 | | - |
| 676 | + |
673 | 677 | |
674 | 678 | |
675 | 679 | |
|
Collapse file
tests/baselines/reference/awaitAndYieldInProperty.js
Copy file name to clipboardExpand all lines: tests/baselines/reference/awaitAndYieldInProperty.js+22-18Lines changed: 22 additions & 18 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
19 | 19 | |
20 | 20 | |
21 | 21 | |
22 | | - |
23 | | - |
24 | | - |
25 | | - |
26 | | - |
27 | | - |
28 | | - |
29 | | - |
30 | | - |
31 | | - |
32 | | - |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
33 | 26 | |
34 | 27 | |
35 | 28 | |
36 | 29 | |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
37 | 41 | |
38 | | - |
39 | | - |
40 | | - |
41 | | - |
42 | | - |
43 | | - |
44 | | - |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
45 | 49 | |
Collapse file
tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInItself.js
Copy file name to clipboardExpand all lines: tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInItself.js+6-3Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
4 | 4 | |
5 | 5 | |
6 | 6 | |
7 | | - |
8 | | - |
9 | | - |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
Collapse file
tests/baselines/reference/computedPropertyNames12_ES6.js
Copy file name to clipboardExpand all lines: tests/baselines/reference/computedPropertyNames12_ES6.js+12-9Lines changed: 12 additions & 9 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
17 | 17 | |
18 | 18 | |
19 | 19 | |
20 | | - |
21 | 20 | |
22 | 21 | |
23 | 22 | |
24 | | - |
25 | | - |
26 | | - |
27 | | - |
28 | | - |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
29 | 31 | |
30 | | - |
31 | | - |
32 | | - |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
Collapse file
tests/baselines/reference/computedPropertyNamesWithStaticProperty.js
Copy file name to clipboardExpand all lines: tests/baselines/reference/computedPropertyNamesWithStaticProperty.js+12-9Lines changed: 12 additions & 9 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
11 | 11 | |
12 | 12 | |
13 | 13 | |
14 | | - |
15 | | - |
16 | | - |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
17 | 23 | |
18 | | - |
19 | | - |
20 | | - |
21 | | - |
22 | | - |
23 | | - |
| 24 | + |
| 25 | + |
| 26 | + |
Collapse file
tests/baselines/reference/decoratedClassExportsCommonJS1.js
Copy file name to clipboardExpand all lines: tests/baselines/reference/decoratedClassExportsCommonJS1.js+10-7Lines changed: 10 additions & 7 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
14 | 14 | |
15 | 15 | |
16 | 16 | |
17 | | - |
18 | 17 | |
19 | | - |
20 | | - |
21 | | - |
22 | | - |
23 | | - |
24 | | - |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
25 | 28 | |
Collapse file
tests/baselines/reference/decoratedClassExportsCommonJS2.js
Copy file name to clipboardExpand all lines: tests/baselines/reference/decoratedClassExportsCommonJS2.js+9-6Lines changed: 9 additions & 6 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
12 | 12 | |
13 | 13 | |
14 | 14 | |
15 | | - |
16 | 15 | |
17 | | - |
18 | | - |
19 | | - |
20 | | - |
21 | | - |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
22 | 25 | |
Collapse file
tests/baselines/reference/decoratedClassExportsSystem1.js
Copy file name to clipboardExpand all lines: tests/baselines/reference/decoratedClassExportsSystem1.js+11-7Lines changed: 11 additions & 7 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
16 | 16 | |
17 | 17 | |
18 | 18 | |
19 | | - |
| 19 | + |
20 | 20 | |
21 | 21 | |
22 | 22 | |
23 | 23 | |
24 | | - |
25 | | - |
26 | | - |
27 | | - |
28 | | - |
29 | | - |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
30 | 34 | |
31 | 35 | |
32 | 36 | |
|
Collapse file
tests/baselines/reference/decoratedClassExportsSystem2.js
Copy file name to clipboardExpand all lines: tests/baselines/reference/decoratedClassExportsSystem2.js+10-6Lines changed: 10 additions & 6 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
13 | 13 | |
14 | 14 | |
15 | 15 | |
16 | | - |
| 16 | + |
17 | 17 | |
18 | 18 | |
19 | 19 | |
20 | 20 | |
21 | | - |
22 | | - |
23 | | - |
24 | | - |
25 | | - |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
26 | 30 | |
27 | 31 | |
28 | 32 | |
|
Collapse file
tests/baselines/reference/decoratedClassFromExternalModule.js
Copy file name to clipboardExpand all lines: tests/baselines/reference/decoratedClassFromExternalModule.js+8-5Lines changed: 8 additions & 5 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
17 | 17 | |
18 | 18 | |
19 | 19 | |
20 | | - |
21 | | - |
22 | | - |
23 | | - |
24 | | - |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
25 | 28 | |
26 | 29 | |
0 commit comments