chore: remove module aware bootstrap API (#10543)
This API was introduced post RC4, but needs to be removed before RC5 as we have decided against it.
This commit is contained in:
parent
a415613457
commit
d4cceff0ef
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {XHR, analyzeAppProvidersForDeprecatedConfiguration, platformCoreDynamic} from '@angular/compiler';
|
import {XHR, analyzeAppProvidersForDeprecatedConfiguration, platformCoreDynamic} from '@angular/compiler';
|
||||||
import {ApplicationRef, COMPILER_OPTIONS, Compiler, CompilerFactory, CompilerOptions, ComponentRef, ComponentResolver, ExceptionHandler, NgModule, NgModuleRef, OpaqueToken, PLATFORM_DIRECTIVES, PLATFORM_INITIALIZER, PLATFORM_PIPES, PlatformRef, ReflectiveInjector, SchemaMetadata, Type, assertPlatform, createPlatform, createPlatformFactory, getPlatform, isDevMode} from '@angular/core';
|
import {ApplicationRef, COMPILER_OPTIONS, CUSTOM_ELEMENTS_SCHEMA, Compiler, CompilerFactory, CompilerOptions, ComponentRef, ComponentResolver, ExceptionHandler, NgModule, NgModuleRef, OpaqueToken, PLATFORM_DIRECTIVES, PLATFORM_INITIALIZER, PLATFORM_PIPES, PlatformRef, ReflectiveInjector, SchemaMetadata, Type, assertPlatform, createPlatform, createPlatformFactory, getPlatform, isDevMode} from '@angular/core';
|
||||||
import {BROWSER_PLATFORM_PROVIDERS, BrowserModule, WORKER_APP_PLATFORM_PROVIDERS, WORKER_SCRIPT, WorkerAppModule, platformBrowser, platformWorkerApp, platformWorkerUi} from '@angular/platform-browser';
|
import {BROWSER_PLATFORM_PROVIDERS, BrowserModule, WORKER_APP_PLATFORM_PROVIDERS, WORKER_SCRIPT, WorkerAppModule, platformBrowser, platformWorkerApp, platformWorkerUi} from '@angular/platform-browser';
|
||||||
|
|
||||||
import {Console} from './core_private';
|
import {Console} from './core_private';
|
||||||
|
@ -116,61 +116,29 @@ export const browserDynamicPlatform = platformBrowserDynamic;
|
||||||
*
|
*
|
||||||
* Returns a `Promise` of {@link ComponentRef}.
|
* Returns a `Promise` of {@link ComponentRef}.
|
||||||
*
|
*
|
||||||
* @experimental This api cannot be used with the offline compiler and thus is still subject to
|
* @deprecated This api cannot be used with the offline compiler. Use
|
||||||
* change.
|
* `PlatformRef.boostrapModule()` instead.
|
||||||
*/
|
*/
|
||||||
// Note: We are using typescript overloads here to have 2 function signatures!
|
// Note: We are using typescript overloads here to have 2 function signatures!
|
||||||
export function bootstrap<C>(
|
export function bootstrap<C>(
|
||||||
appComponentType: ConcreteType<C>,
|
appComponentType: ConcreteType<C>,
|
||||||
customProviders?: Array<any /*Type | Provider | any[]*/>): Promise<ComponentRef<C>>;
|
customProviders?: Array<any /*Type | Provider | any[]*/>): Promise<ComponentRef<C>> {
|
||||||
export function bootstrap<C>(
|
|
||||||
appComponentType: ConcreteType<C>,
|
|
||||||
{providers, imports, declarations, entryComponents, schemas, compilerOptions}?: {
|
|
||||||
providers?: Array<any /*Type | Provider | any[]*/>,
|
|
||||||
declarations?: any[],
|
|
||||||
imports?: any[],
|
|
||||||
entryComponents?: any[],
|
|
||||||
schemas?: Array<SchemaMetadata|any[]>,
|
|
||||||
compilerOptions?: CompilerOptions
|
|
||||||
}): Promise<ComponentRef<C>>;
|
|
||||||
export function bootstrap<C>(
|
|
||||||
appComponentType: ConcreteType<C>,
|
|
||||||
customProvidersOrDynamicModule?: Array<any /*Type | Provider | any[]*/>| {
|
|
||||||
providers: Array<any /*Type | Provider | any[]*/>,
|
|
||||||
declarations?: any[],
|
|
||||||
imports: any[],
|
|
||||||
entryComponents: any[], schemas?: Array<SchemaMetadata|any[]>,
|
|
||||||
compilerOptions: CompilerOptions
|
|
||||||
}): Promise<ComponentRef<C>> {
|
|
||||||
let compilerOptions: CompilerOptions;
|
let compilerOptions: CompilerOptions;
|
||||||
let providers: any[] = [];
|
|
||||||
let declarations: any[] = [];
|
let declarations: any[] = [];
|
||||||
let imports: any[] = [];
|
|
||||||
let entryComponents: any[] = [];
|
let entryComponents: any[] = [];
|
||||||
let deprecationMessages: string[] = [];
|
let deprecationMessages: string[] = [];
|
||||||
let schemas: any[] = [];
|
const deprecatedConfiguration = analyzeAppProvidersForDeprecatedConfiguration(customProviders);
|
||||||
if (customProvidersOrDynamicModule instanceof Array) {
|
declarations = deprecatedConfiguration.moduleDeclarations.concat(declarations);
|
||||||
providers = customProvidersOrDynamicModule;
|
compilerOptions = deprecatedConfiguration.compilerOptions;
|
||||||
const deprecatedConfiguration = analyzeAppProvidersForDeprecatedConfiguration(providers);
|
deprecationMessages = deprecatedConfiguration.deprecationMessages;
|
||||||
declarations = deprecatedConfiguration.moduleDeclarations.concat(declarations);
|
|
||||||
compilerOptions = deprecatedConfiguration.compilerOptions;
|
|
||||||
deprecationMessages = deprecatedConfiguration.deprecationMessages;
|
|
||||||
} else if (customProvidersOrDynamicModule) {
|
|
||||||
providers = normalizeArray(customProvidersOrDynamicModule.providers);
|
|
||||||
declarations = normalizeArray(customProvidersOrDynamicModule.declarations);
|
|
||||||
imports = normalizeArray(customProvidersOrDynamicModule.imports);
|
|
||||||
entryComponents = normalizeArray(customProvidersOrDynamicModule.entryComponents);
|
|
||||||
schemas = normalizeArray(customProvidersOrDynamicModule.schemas);
|
|
||||||
compilerOptions = customProvidersOrDynamicModule.compilerOptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
providers: providers,
|
providers: customProviders,
|
||||||
declarations: declarations.concat([appComponentType]),
|
declarations: declarations.concat([appComponentType]),
|
||||||
imports: [BrowserModule, imports],
|
imports: [BrowserModule],
|
||||||
entryComponents: entryComponents,
|
entryComponents: entryComponents,
|
||||||
bootstrap: [appComponentType],
|
bootstrap: [appComponentType],
|
||||||
schemas: schemas
|
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||||
})
|
})
|
||||||
class DynamicModule {
|
class DynamicModule {
|
||||||
}
|
}
|
||||||
|
|
|
@ -333,10 +333,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should allow to pass schemas', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
it('should allow to pass schemas', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||||
bootstrap(HelloCmpUsingCustomElement, {
|
bootstrap(HelloCmpUsingCustomElement, testProviders).then((compRef) => {
|
||||||
providers: testProviders,
|
|
||||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
|
||||||
}).then((compRef) => {
|
|
||||||
expect(el).toHaveText('hello world!');
|
expect(el).toHaveText('hello world!');
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,16 +6,21 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {HashLocationStrategy, LocationStrategy} from '@angular/common';
|
import {NgModule} from '@angular/core';
|
||||||
import {bootstrap} from '@angular/platform-browser-dynamic';
|
import {BrowserModule} from '@angular/platform-browser';
|
||||||
|
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
|
||||||
import {RouterModule} from '@angular/router';
|
import {RouterModule} from '@angular/router';
|
||||||
|
|
||||||
import {DbService, DraftsCmp, InboxApp, InboxCmp, ROUTER_CONFIG} from './app/inbox-app';
|
import {DbService, DraftsCmp, InboxApp, InboxCmp, ROUTER_CONFIG} from './app/inbox-app';
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
bootstrap(InboxApp, {
|
@NgModule({
|
||||||
providers: [DbService],
|
providers: [DbService],
|
||||||
declarations: [InboxCmp, DraftsCmp],
|
declarations: [InboxCmp, DraftsCmp, InboxApp],
|
||||||
imports: [RouterModule.forRoot(ROUTER_CONFIG, {useHash: true})]
|
imports: [RouterModule.forRoot(ROUTER_CONFIG, {useHash: true}), BrowserModule],
|
||||||
});
|
bootstrap: [InboxApp]
|
||||||
|
})
|
||||||
|
class RoutingExampleModule {
|
||||||
|
}
|
||||||
|
platformBrowserDynamic().bootstrapModule(RoutingExampleModule);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/** @experimental */
|
/** @deprecated */
|
||||||
export declare function bootstrap<C>(appComponentType: ConcreteType<C>, customProviders?: Array<any>): Promise<ComponentRef<C>>;
|
export declare function bootstrap<C>(appComponentType: ConcreteType<C>, customProviders?: Array<any>): Promise<ComponentRef<C>>;
|
||||||
|
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
|
|
Loading…
Reference in New Issue