refactor(compiler): make PLATFORM_PIPES
/ PLATFORM_DIRECTIVES
an option on CompilerConfig
This aligns the configuration of platform pipes / directives with offline compilation. BREAKING CHANGE: - `PLATFORM_PIPES` and `PLATFORM_DIRECTIVES` now are fields on `CompilerConfig`. Instead of providing a binding to these tokens, provide a binding for `CompilerConfig` instead.
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import {COMMON_DIRECTIVES, COMMON_PIPES, FORM_PROVIDERS, PlatformLocation} from '@angular/common';
|
||||
import {COMPILER_PROVIDERS, XHR} from '@angular/compiler';
|
||||
import {APPLICATION_COMMON_PROVIDERS, ComponentRef, ExceptionHandler, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PLATFORM_DIRECTIVES, PLATFORM_INITIALIZER, PLATFORM_PIPES, PlatformRef, ReflectiveInjector, RootRenderer, Testability, Type, assertPlatform, coreLoadAndBootstrap, createPlatform, getPlatform} from '@angular/core';
|
||||
import {COMPILER_PROVIDERS, CompilerConfig, XHR} from '@angular/compiler';
|
||||
import {APPLICATION_COMMON_PROVIDERS, ComponentRef, ExceptionHandler, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, RootRenderer, Testability, Type, assertPlatform, coreLoadAndBootstrap, createPlatform, getPlatform} from '@angular/core';
|
||||
|
||||
import {AnimationDriver, NoOpAnimationDriver, ReflectionCapabilities, SanitizationService, reflector, wtfInit} from '../core_private';
|
||||
import {WebAnimationsDriver} from '../src/dom/web_animations_driver';
|
||||
@ -17,7 +17,7 @@ import {EVENT_MANAGER_PLUGINS, EventManager} from './dom/events/event_manager';
|
||||
import {HAMMER_GESTURE_CONFIG, HammerGestureConfig, HammerGesturesPlugin} from './dom/events/hammer_gestures';
|
||||
import {KeyEventsPlugin} from './dom/events/key_events';
|
||||
import {DomSharedStylesHost, SharedStylesHost} from './dom/shared_styles_host';
|
||||
import {isBlank, isPresent} from './facade/lang';
|
||||
import {assertionsEnabled, isBlank, isPresent} from './facade/lang';
|
||||
import {DomSanitizationService, DomSanitizationServiceImpl} from './security/dom_sanitization_service';
|
||||
import {CachedXHR} from './xhr/xhr_cache';
|
||||
import {XHRImpl} from './xhr/xhr_impl';
|
||||
@ -50,8 +50,6 @@ export const BROWSER_SANITIZATION_PROVIDERS: Array<any> = [
|
||||
*/
|
||||
export const BROWSER_APP_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [
|
||||
APPLICATION_COMMON_PROVIDERS, FORM_PROVIDERS, BROWSER_SANITIZATION_PROVIDERS,
|
||||
{provide: PLATFORM_PIPES, useValue: COMMON_PIPES, multi: true},
|
||||
{provide: PLATFORM_DIRECTIVES, useValue: COMMON_DIRECTIVES, multi: true},
|
||||
{provide: ExceptionHandler, useFactory: _exceptionHandler, deps: []},
|
||||
{provide: DOCUMENT, useFactory: _document, deps: []},
|
||||
{provide: EVENT_MANAGER_PLUGINS, useClass: DomEventsPlugin, multi: true},
|
||||
@ -65,8 +63,14 @@ export const BROWSER_APP_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [
|
||||
Testability, EventManager, ELEMENT_PROBE_PROVIDERS
|
||||
];
|
||||
|
||||
function _createCompilerConfig() {
|
||||
return new CompilerConfig(
|
||||
assertionsEnabled(), false, true, null, null, COMMON_DIRECTIVES, COMMON_PIPES);
|
||||
}
|
||||
|
||||
export const BROWSER_APP_COMPILER_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [
|
||||
COMPILER_PROVIDERS,
|
||||
{provide: CompilerConfig, useFactory: _createCompilerConfig, deps: []},
|
||||
{provide: XHR, useClass: XHRImpl},
|
||||
];
|
||||
|
||||
|
Reference in New Issue
Block a user