cleanup(platform): removed webworker and server deprecated apis (#10745)

This commit is contained in:
Victor Savkin
2016-08-15 13:44:01 -07:00
committed by vikerman
parent 73c0a9daaf
commit 60b10134df
29 changed files with 94 additions and 438 deletions

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
export {BROWSER_APP_PROVIDERS, BROWSER_PLATFORM_PROVIDERS, BROWSER_SANITIZATION_PROVIDERS, BrowserModule, browserPlatform, platformBrowser} from './src/browser';
export {BROWSER_SANITIZATION_PROVIDERS, BrowserModule, platformBrowser} from './src/browser';
export {BrowserPlatformLocation} from './src/browser/location/browser_platform_location';
export {Title} from './src/browser/title';
export {disableDebugTools, enableDebugTools} from './src/browser/tools/tools';

View File

@ -7,7 +7,7 @@
*/
import {CommonModule, PlatformLocation} from '@angular/common';
import {ApplicationModule, ExceptionHandler, NgModule, NgModuleFactory, NgModuleRef, NgZone, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, RootRenderer, SanitizationService, Testability, assertPlatform, createPlatform, createPlatformFactory, getPlatform, isDevMode, platformCore} from '@angular/core';
import {ApplicationModule, ExceptionHandler, NgModule, NgModuleFactory, NgModuleRef, NgZone, OpaqueToken, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, RootRenderer, SanitizationService, Testability, assertPlatform, createPlatform, createPlatformFactory, getPlatform, isDevMode, platformCore} from '@angular/core';
import {wtfInit} from '../core_private';
import {AnimationDriver} from '../src/dom/animation_driver';
@ -33,17 +33,6 @@ export const INTERNAL_BROWSER_PLATFORM_PROVIDERS: Array<any /*Type | Provider |
{provide: PlatformLocation, useClass: BrowserPlatformLocation}
];
/**
* A set of providers to initialize the Angular platform in a web browser.
*
* Used automatically by `bootstrap`, or can be passed to `platform`.
*
* @deprecated Use `platformBrowser()` or create a custom platform factory via
* `createPlatformFactory(platformBrowser, ...)`
*/
export const BROWSER_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
[PLATFORM_COMMON_PROVIDERS, INTERNAL_BROWSER_PLATFORM_PROVIDERS];
/**
* @security Replacing built-in sanitization providers exposes the application to XSS risks.
* Attacker-controlled data introduced by an unsanitized provider could expose your
@ -55,30 +44,12 @@ export const BROWSER_SANITIZATION_PROVIDERS: Array<any> = [
{provide: DomSanitizationService, useClass: DomSanitizationServiceImpl},
];
/**
* A set of providers to initialize an Angular application in a web browser.
*
* Used automatically by `bootstrap`, or can be passed to {@link PlatformRef
* PlatformRef.application}.
*
* @deprecated Create a module that includes `BrowserModule` instead. This is empty for backwards
* compatibility,
* as all of our bootstrap methods add a module implicitly, i.e. keeping this filled would add the
* providers 2x.
*/
export const BROWSER_APP_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [];
/**
* @experimental API related to bootstrapping are still under review.
*/
export const platformBrowser =
createPlatformFactory(platformCore, 'browser', INTERNAL_BROWSER_PLATFORM_PROVIDERS);
/**
* @deprecated Use {@link platformBrowser} instead
*/
export const browserPlatform = platformBrowser;
export function initDomAdapter() {
BrowserDomAdapter.makeCurrent();
wtfInit();

View File

@ -7,7 +7,7 @@
*/
import {CommonModule} from '@angular/common';
import {APP_INITIALIZER, ApplicationModule, ExceptionHandler, NgModule, NgZone, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PlatformRef, ReflectiveInjector, RootRenderer, assertPlatform, createPlatform, createPlatformFactory, getPlatform, platformCore} from '@angular/core';
import {APP_INITIALIZER, ApplicationModule, ExceptionHandler, NgModule, NgZone, OpaqueToken, PlatformRef, ReflectiveInjector, RootRenderer, assertPlatform, createPlatform, createPlatformFactory, getPlatform, platformCore} from '@angular/core';
import {BROWSER_SANITIZATION_PROVIDERS} from './browser';
import {isBlank, print} from './facade/lang';
@ -28,31 +28,11 @@ class PrintLogger {
logGroupEnd() {}
}
/**
* @deprecated Use `platformWorkerApp()` or create a custom platform factory via
* `createPlatformFactory(platformWorkerApp, ...)`
*/
export const WORKER_APP_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
PLATFORM_COMMON_PROVIDERS;
/**
* @deprecated Create a module that includes `WorkerAppModule` instead. This is empty for backwards
* compatibility,
* as all of our bootstrap methods add a module implicitly, i.e. keeping this filled would add the
* providers 2x.
*/
export const WORKER_APP_APPLICATION_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [];
/**
* @experimental
*/
export const platformWorkerApp = createPlatformFactory(platformCore, 'workerApp');
/**
* @deprecated Use {@link platformWorkerApp} instead
*/
export const workerAppPlatform = platformWorkerApp;
function _exceptionHandler(): ExceptionHandler {
return new ExceptionHandler(new PrintLogger());
}

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import {BaseException, ExceptionHandler, Injectable, Injector, NgZone, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, RootRenderer, Testability, assertPlatform, createPlatform, createPlatformFactory, getPlatform, isDevMode, platformCore} from '@angular/core';
import {BaseException, ExceptionHandler, Injectable, Injector, NgZone, OpaqueToken, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, RootRenderer, Testability, assertPlatform, createPlatform, createPlatformFactory, getPlatform, isDevMode, platformCore} from '@angular/core';
import {wtfInit} from '../core_private';
@ -105,18 +105,6 @@ export const _WORKER_UI_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*
{provide: MessageBus, useFactory: messageBusFactory, deps: [WebWorkerInstance]}
];
/**
* * @deprecated Use `platformWorkerUi()` or create a custom platform factory via
* `createPlatformFactory(platformWorkerUi, ...)`
*/
export const WORKER_UI_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
[PLATFORM_COMMON_PROVIDERS, _WORKER_UI_PLATFORM_PROVIDERS];
/**
* @deprecated Worker UI only has a platform but no application
*/
export const WORKER_UI_APPLICATION_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [];
function initializeGenericWorkerRenderer(injector: Injector) {
var bus = injector.get(MessageBus);
let zone = injector.get(NgZone);
@ -157,12 +145,6 @@ function initWebWorkerRenderPlatform(injector: Injector): () => void {
export const platformWorkerUi =
createPlatformFactory(platformCore, 'workerUi', _WORKER_UI_PLATFORM_PROVIDERS);
/**
* @deprecated Use {@link platformWorkerUi} instead
*/
export const workerUiPlatform = platformWorkerUi;
function _exceptionHandler(): ExceptionHandler {
return new ExceptionHandler(getDOM());
}

View File

@ -7,7 +7,7 @@
*/
import {XHR} from '@angular/compiler';
import {APP_INITIALIZER, CUSTOM_ELEMENTS_SCHEMA, Component, Directive, ExceptionHandler, Inject, Input, NgModule, OnDestroy, PLATFORM_DIRECTIVES, PLATFORM_INITIALIZER, PLATFORM_PIPES, Pipe, ReflectiveInjector, createPlatform, createPlatformFactory, provide} from '@angular/core';
import {APP_INITIALIZER, CUSTOM_ELEMENTS_SCHEMA, Component, Directive, ExceptionHandler, Inject, Input, NgModule, OnDestroy, PLATFORM_INITIALIZER, Pipe, ReflectiveInjector, createPlatform, createPlatformFactory, provide} from '@angular/core';
import {ApplicationRef, destroyPlatform} from '@angular/core/src/application_ref';
import {Console} from '@angular/core/src/console';
import {ComponentRef} from '@angular/core/src/linker/component_factory';
@ -311,27 +311,6 @@ export function main() {
});
}));
// Note: This will soon be deprecated as bootstrap creates a separate injector for the compiler,
// i.e. such providers needs to go into that injecotr (when calling `browserCompiler`);
it('should still allow to provide platform directives/pipes via the regular providers',
inject([Console, AsyncTestCompleter], (console: DummyConsole, async: AsyncTestCompleter) => {
bootstrap(HelloCmpUsingPlatformDirectiveAndPipe, testProviders.concat([
{provide: PLATFORM_DIRECTIVES, useValue: [SomeDirective]},
{provide: PLATFORM_PIPES, useValue: [SomePipe]}
])).then((compRef) => {
let compFixture = new ComponentFixture(compRef, null, null);
compFixture.detectChanges();
expect(compFixture.debugElement.children[0].properties['title'])
.toBe('transformed someValue');
expect(compilerConsole.warnings).toEqual([
`The PLATFORM_DIRECTIVES provider and CompilerConfig.platformDirectives is deprecated. Add the directives to an NgModule instead! (Directives: ${stringify(SomeDirective)})`,
`The PLATFORM_PIPES provider and CompilerConfig.platformPipes is deprecated. Add the pipes to an NgModule instead! (Pipes: ${stringify(SomePipe)})`
]);
async.done();
});
}));
it('should allow to pass schemas', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
bootstrap(HelloCmpUsingCustomElement, testProviders).then((compRef) => {
expect(el).toHaveText('hello world!');

View File

@ -7,7 +7,7 @@
*/
import {LocationStrategy} from '@angular/common';
import {APP_ID, NgModule, NgZone, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, assertPlatform, createPlatform, createPlatformFactory, getPlatform, platformCore} from '@angular/core';
import {APP_ID, NgModule, NgZone, OpaqueToken, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, assertPlatform, createPlatform, createPlatformFactory, getPlatform, platformCore} from '@angular/core';
import {BrowserModule} from '../src/browser';
import {BrowserDomAdapter} from '../src/browser/browser_adapter';