perf(core): Make PlatformLocation tree-shakable (#32154)

Convert `PlatformLocation` into a tree-shakable provider.

PR Close #32154
This commit is contained in:
Misko Hevery
2019-08-22 19:24:00 -07:00
parent 77c382ccba
commit 1537791f06
29 changed files with 307 additions and 297 deletions

View File

@ -7,7 +7,7 @@
*/
import {CommonModule, DOCUMENT, ViewportScroller, ɵNullViewportScroller as NullViewportScroller, ɵPLATFORM_WORKER_APP_ID as PLATFORM_WORKER_APP_ID} from '@angular/common';
import {APP_INITIALIZER, ApplicationModule, ErrorHandler, NgModule, NgZone, PLATFORM_ID, PlatformRef, RendererFactory2, RootRenderer, StaticProvider, createPlatformFactory, platformCore, ɵAPP_ROOT as APP_ROOT} from '@angular/core';
import {APP_INITIALIZER, ApplicationModule, ErrorHandler, NgModule, NgZone, PLATFORM_ID, PlatformRef, RendererFactory2, StaticProvider, createPlatformFactory, platformCore, ɵINJECTOR_SCOPE as INJECTOR_SCOPE} from '@angular/core';
import {ɵBROWSER_SANITIZATION_PROVIDERS as BROWSER_SANITIZATION_PROVIDERS} from '@angular/platform-browser';
import {ON_WEB_WORKER} from './web_workers/shared/api';
@ -20,14 +20,13 @@ import {ServiceMessageBrokerFactory} from './web_workers/shared/service_message_
import {WebWorkerRendererFactory2} from './web_workers/worker/renderer';
import {WorkerDomAdapter} from './web_workers/worker/worker_adapter';
/**
* @publicApi
* @deprecated platform-webworker is deprecated in Angular and will be removed in version 10
*/
export const platformWorkerApp = createPlatformFactory(
platformCore, 'workerApp', [{provide: PLATFORM_ID, useValue: PLATFORM_WORKER_APP_ID}]);
export const platformWorkerApp: (extraProviders?: StaticProvider[] | undefined) => PlatformRef =
createPlatformFactory(
platformCore, 'workerApp', [{provide: PLATFORM_ID, useValue: PLATFORM_WORKER_APP_ID}]);
export function errorHandler(): ErrorHandler {
return new ErrorHandler();
@ -62,7 +61,7 @@ export function setupWebWorker(): void {
@NgModule({
providers: [
BROWSER_SANITIZATION_PROVIDERS,
{provide: APP_ROOT, useValue: true},
{provide: INJECTOR_SCOPE, useValue: 'root'},
Serializer,
{provide: DOCUMENT, useValue: null},
ClientMessageBrokerFactory,