refactor(core): deprecate coreBootstrap, PLATFORM_PIPES/DIRECTIVES providers and ComponentResolver

BREAKING CHANGE (deprecations)

- Instead of `coreBootstrap`, create an `@AppModule` and use `bootstrapModule`.
- Instead of `coreLoadAndBootstarp`, create an `@AppModule` and use `bootstrapModuleFactory`.
- Instead of `bootstrapWorkerApp`, create an `@AppModule` that includes the `WorkerAppModule` and use `bootstrapModule` with the `workerAppPlatform()`.
- Instead of `bootstrapWorkerUi`, create an @AppModule that includes the `WorkerUiModule` and use `bootstrapModule` with the `workerUiPlatform()` instead.
- Instead of `serverBootstrap`, create an @AppModule and use `bootstrapModule` with the `serverDynamicPlatform()` instead.
- Instead of `PLATFORM_PIPES` and `PLATFORM_DIRECTIVES`, provide platform directives/pipes via an `@AppModule`.
- Instead of `ComponentResolver`:
  - use `ComponentFactoryResolver` together with `@AppModule.precompile`/`@Component.precompile` or `ANALYZE_FOR_PRECOMPILE` provider for dynamic component creation.
  - use `AppModuleFactoryLoader` for lazy loading.
- Instead of `SystemJsComponentResolver`, create an `@AppModule` and use `SystemJsAppModuleLoader`.
- Instead of `SystemJsCmpFactoryResolver`, create an `@AppModule` and use `SystemJsAppModuleFactoryLoader`

Closes #9726
This commit is contained in:
Tobias Bosch
2016-07-08 13:40:54 -07:00
parent 245b0910ed
commit daa9da4047
20 changed files with 167 additions and 76 deletions

View File

@ -19,13 +19,17 @@ import {CachedXHR} from './src/xhr/xhr_cache';
import {XHRImpl} from './src/xhr/xhr_impl';
/**
* @experimental
* @deprecated The compiler providers are already included in the {@link CompilerFactory} that is
* contained the {@link browserDynamicPlatform}()`.
*/
export const BROWSER_APP_COMPILER_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [
COMPILER_PROVIDERS, {
provide: CompilerConfig,
useFactory: (platformDirectives: any[], platformPipes: any[]) => {
return new CompilerConfig({platformDirectives, platformPipes});
return new CompilerConfig({
deprecatedPlatformDirectives: platformDirectives,
deprecatedPlatformPipes: platformPipes
});
},
deps: [PLATFORM_DIRECTIVES, PLATFORM_PIPES]
},
@ -208,11 +212,15 @@ export function bootstrap<C>(
}
/**
* @experimental
* @deprecated Create an {@link AppModule} that includes the {@link WorkerUiModule} and use {@link
* bootstrapModule}
* with the {@link workerUiPlatform}() instead.
*/
export function bootstrapWorkerUi(
workerScriptUri: string,
customProviders?: Array<any /*Type | Provider | any[]*/>): Promise<ApplicationRef> {
console.warn(
'bootstrapWorkerUi is deprecated. Create an @AppModule that includes the `WorkerUiModule` and use `bootstrapModule` with the `workerUiPlatform()` instead.');
var app = ReflectiveInjector.resolveAndCreate(
[
WORKER_UI_APPLICATION_PROVIDERS, BROWSER_APP_COMPILER_PROVIDERS,
@ -227,13 +235,17 @@ export function bootstrapWorkerUi(
}
/**
* @experimental
* @deprecated The compiler providers are already included in the {@link CompilerFactory} that is
* contained the {@link workerAppPlatform}().
*/
const WORKER_APP_COMPILER_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [
COMPILER_PROVIDERS, {
provide: CompilerConfig,
useFactory: (platformDirectives: any[], platformPipes: any[]) => {
return new CompilerConfig({platformDirectives, platformPipes});
return new CompilerConfig({
deprecatedPlatformDirectives: platformDirectives,
deprecatedPlatformPipes: platformPipes
});
},
deps: [PLATFORM_DIRECTIVES, PLATFORM_PIPES]
},
@ -244,11 +256,15 @@ const WORKER_APP_COMPILER_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [
/**
* @experimental
* @deprecated Create an {@link AppModule} that includes the {@link WorkerAppModule} and use {@link
* bootstrapModule}
* with the {@link workerAppPlatform}() instead.
*/
export function bootstrapWorkerApp(
appComponentType: Type,
customProviders?: Array<any /*Type | Provider | any[]*/>): Promise<ComponentRef<any>> {
console.warn(
'bootstrapWorkerApp is deprecated. Create an @AppModule that includes the `WorkerAppModule` and use `bootstrapModule` with the `workerAppPlatform()` instead.');
var appInjector = ReflectiveInjector.resolveAndCreate(
[
WORKER_APP_APPLICATION_PROVIDERS, WORKER_APP_COMPILER_PROVIDERS,