Skip to content

Commit

Permalink
perf(common): make NgLocalization token tree-shakable (angular#45118)
Browse files Browse the repository at this point in the history
This commit updates the `NgLocalization` token to become tree-shakable (vs using a direct reference to that token in the `providers` section of the `CommonModule`). The `NgLocalization` token is used for apps that use i18n and for other apps it would be excluded from the bundle.

PR Close angular#45118
  • Loading branch information
AndrewKushnir authored and josmar-crwdstffng committed Apr 8, 2022
1 parent 61283d8 commit fab2492
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 110 deletions.
2 changes: 1 addition & 1 deletion goldens/size-tracking/aio-payloads.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"master": {
"uncompressed": {
"runtime": 4343,
"main": 450179,
"main": 449672,
"polyfills": 33869,
"styles": 70416,
"light-theme": 77582,
Expand Down
8 changes: 4 additions & 4 deletions goldens/size-tracking/integration-payloads.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"master": {
"uncompressed": {
"runtime": 1083,
"main": 126218,
"main": 124515,
"polyfills": 33824
}
}
Expand Down Expand Up @@ -42,7 +42,7 @@
"master": {
"uncompressed": {
"runtime": 2835,
"main": 233348,
"main": 232814,
"polyfills": 33842,
"src_app_lazy_lazy_module_ts": 795
}
Expand All @@ -52,7 +52,7 @@
"master": {
"uncompressed": {
"runtime": 1063,
"main": 158556,
"main": 156042,
"polyfills": 33804
}
}
Expand All @@ -61,7 +61,7 @@
"master": {
"uncompressed": {
"runtime": 1070,
"main": 158300,
"main": 155753,
"polyfills": 33814
}
}
Expand Down
39 changes: 6 additions & 33 deletions packages/core/test/bundling/animations/bundle.golden_symbols.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,6 @@
{
"name": "CommonModule"
},
{
"name": "Compiler"
},
{
"name": "ComponentFactory"
},
Expand Down Expand Up @@ -242,18 +239,12 @@
{
"name": "LEAVE_TOKEN_REGEX"
},
{
"name": "LOCALE_DATA"
},
{
"name": "LOCALE_ID2"
},
{
"name": "LifecycleHooksFeature"
},
{
"name": "LocaleDataIndex"
},
{
"name": "MODIFIER_KEYS"
},
Expand Down Expand Up @@ -326,15 +317,6 @@
{
"name": "NULL_REMOVED_QUERIED_STATE"
},
{
"name": "NgLocaleLocalization"
},
{
"name": "NgLocalization"
},
{
"name": "NgModuleFactory2"
},
{
"name": "NgModuleRef"
},
Expand Down Expand Up @@ -377,9 +359,6 @@
{
"name": "PlatformRef"
},
{
"name": "Plural"
},
{
"name": "R3Injector"
},
Expand All @@ -404,9 +383,6 @@
{
"name": "RuntimeError"
},
{
"name": "SCHEDULER"
},
{
"name": "SELF_TOKEN_REGEX"
},
Expand Down Expand Up @@ -656,6 +632,9 @@
{
"name": "collectNativeNodes"
},
{
"name": "compileNgModuleFactory"
},
{
"name": "computeStaticStyling"
},
Expand Down Expand Up @@ -857,9 +836,6 @@
{
"name": "getLViewParent"
},
{
"name": "getLocaleData"
},
{
"name": "getNativeByTNode"
},
Expand Down Expand Up @@ -1088,9 +1064,6 @@
{
"name": "listenOnPlayer"
},
{
"name": "locale_en_default"
},
{
"name": "lookupTokenUsingModuleInjector"
},
Expand Down Expand Up @@ -1355,9 +1328,6 @@
{
"name": "transition"
},
{
"name": "u"
},
{
"name": "uniqueIdCounter"
},
Expand Down Expand Up @@ -1406,6 +1376,9 @@
{
"name": "ɵɵelement"
},
{
"name": "ɵɵelementEnd"
},
{
"name": "ɵɵelementStart"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,18 +224,12 @@
{
"name": "KeyEventsPlugin"
},
{
"name": "LOCALE_DATA"
},
{
"name": "LOCALE_ID2"
},
{
"name": "LifecycleHooksFeature"
},
{
"name": "LocaleDataIndex"
},
{
"name": "MODIFIER_KEYS"
},
Expand Down Expand Up @@ -329,12 +323,6 @@
{
"name": "NgForOf"
},
{
"name": "NgLocaleLocalization"
},
{
"name": "NgLocalization"
},
{
"name": "NgModuleFactory2"
},
Expand Down Expand Up @@ -377,9 +365,6 @@
{
"name": "PlatformRef"
},
{
"name": "Plural"
},
{
"name": "R3Injector"
},
Expand Down Expand Up @@ -911,9 +896,6 @@
{
"name": "getLViewParent"
},
{
"name": "getLocaleData"
},
{
"name": "getNativeByTNode"
},
Expand Down Expand Up @@ -1205,9 +1187,6 @@
{
"name": "leaveViewLight"
},
{
"name": "locale_en_default"
},
{
"name": "lookupTokenUsingModuleInjector"
},
Expand Down Expand Up @@ -1517,9 +1496,6 @@
{
"name": "trackByIdentity"
},
{
"name": "u"
},
{
"name": "uniqueIdCounter"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,18 +212,12 @@
{
"name": "KeyEventsPlugin"
},
{
"name": "LOCALE_DATA"
},
{
"name": "LOCALE_ID2"
},
{
"name": "LifecycleHooksFeature"
},
{
"name": "LocaleDataIndex"
},
{
"name": "MODIFIER_KEYS"
},
Expand Down Expand Up @@ -317,12 +311,6 @@
{
"name": "NgForm"
},
{
"name": "NgLocaleLocalization"
},
{
"name": "NgLocalization"
},
{
"name": "NgModel"
},
Expand Down Expand Up @@ -371,9 +359,6 @@
{
"name": "PlatformRef"
},
{
"name": "Plural"
},
{
"name": "R3Injector"
},
Expand Down Expand Up @@ -875,9 +860,6 @@
{
"name": "getLViewParent"
},
{
"name": "getLocaleData"
},
{
"name": "getNativeByTNode"
},
Expand Down Expand Up @@ -1166,9 +1148,6 @@
{
"name": "leaveViewLight"
},
{
"name": "locale_en_default"
},
{
"name": "lookupTokenUsingModuleInjector"
},
Expand Down Expand Up @@ -1496,9 +1475,6 @@
{
"name": "trackByIdentity"
},
{
"name": "u"
},
{
"name": "uniqueIdCounter"
},
Expand Down
24 changes: 0 additions & 24 deletions packages/core/test/bundling/router/bundle.golden_symbols.json
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,6 @@
{
"name": "KeyEventsPlugin"
},
{
"name": "LOCALE_DATA"
},
{
"name": "LOCALE_ID2"
},
Expand All @@ -275,9 +272,6 @@
{
"name": "LoadedRouterConfig"
},
{
"name": "LocaleDataIndex"
},
{
"name": "Location"
},
Expand Down Expand Up @@ -371,12 +365,6 @@
{
"name": "NavigationStart"
},
{
"name": "NgLocaleLocalization"
},
{
"name": "NgLocalization"
},
{
"name": "NgModuleFactory"
},
Expand Down Expand Up @@ -443,9 +431,6 @@
{
"name": "PlatformRef"
},
{
"name": "Plural"
},
{
"name": "Position"
},
Expand Down Expand Up @@ -1223,9 +1208,6 @@
{
"name": "getLViewParent"
},
{
"name": "getLocaleData"
},
{
"name": "getNativeByTNode"
},
Expand Down Expand Up @@ -1520,9 +1502,6 @@
{
"name": "leaveViewLight"
},
{
"name": "locale_en_default"
},
{
"name": "locateDirectiveOrProvider"
},
Expand Down Expand Up @@ -1895,9 +1874,6 @@
{
"name": "tree"
},
{
"name": "u"
},
{
"name": "uniqueIdCounter"
},
Expand Down

0 comments on commit fab2492

Please sign in to comment.