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

@ -235,10 +235,12 @@ export function bootstrapModule<M>(
* Shortcut for ApplicationRef.bootstrap.
* Requires a platform to be created first.
*
* @experimental APIs related to application bootstrap are currently under review.
* @deprecated Use {@link bootstrapModuleFactory} instead.
*/
export function coreBootstrap<C>(
componentFactory: ComponentFactory<C>, injector: Injector): ComponentRef<C> {
let console = injector.get(Console);
console.warn('coreBootstrap is deprecated. Use bootstrapModuleFactory instead.');
var appRef: ApplicationRef = injector.get(ApplicationRef);
return appRef.bootstrap(componentFactory);
}
@ -248,10 +250,12 @@ export function coreBootstrap<C>(
* waits for asynchronous initializers and bootstraps the component.
* Requires a platform to be created first.
*
* @experimental APIs related to application bootstrap are currently under review.
* @deprecated Use {@link bootstrapModule} instead.
*/
export function coreLoadAndBootstrap(
componentType: Type, injector: Injector): Promise<ComponentRef<any>> {
let console = injector.get(Console);
console.warn('coreLoadAndBootstrap is deprecated. Use bootstrapModule instead.');
var appRef: ApplicationRef = injector.get(ApplicationRef);
return appRef.run(() => {
var componentResolver: ComponentResolver = injector.get(ComponentResolver);