refactor(core): extract `DoBootstrap` to separate file. (#39621)

Extract `DoBootstrap` interface to a separate file to break circular dependency.

PR Close #39621
This commit is contained in:
Misko Hevery 2020-11-10 09:32:26 -08:00 committed by atscott
parent 8574c3000e
commit 621c34ddec
4 changed files with 2257 additions and 438 deletions

File diff suppressed because it is too large Load Diff

View File

@ -11,17 +11,12 @@
* to be used by the decorator versions of these annotations. * to be used by the decorator versions of these annotations.
*/ */
import {Attribute} from './di';
import {ContentChild, ContentChildren, Query, ViewChild, ViewChildren} from './metadata/di';
import {Component, Directive, HostBinding, HostListener, Input, Output, Pipe} from './metadata/directives';
import {DoBootstrap, ModuleWithProviders, NgModule} from './metadata/ng_module';
import {SchemaMetadata} from './metadata/schema';
import {ViewEncapsulation} from './metadata/view';
export {Attribute} from './di'; export {Attribute} from './di';
export {AfterContentChecked, AfterContentInit, AfterViewChecked, AfterViewInit, DoCheck, OnChanges, OnDestroy, OnInit} from './interface/lifecycle_hooks'; export {AfterContentChecked, AfterContentInit, AfterViewChecked, AfterViewInit, DoCheck, OnChanges, OnDestroy, OnInit} from './interface/lifecycle_hooks';
export {ANALYZE_FOR_ENTRY_COMPONENTS, ContentChild, ContentChildDecorator, ContentChildren, ContentChildrenDecorator, Query, ViewChild, ViewChildDecorator, ViewChildren, ViewChildrenDecorator} from './metadata/di'; export {ANALYZE_FOR_ENTRY_COMPONENTS, ContentChild, ContentChildDecorator, ContentChildren, ContentChildrenDecorator, Query, ViewChild, ViewChildDecorator, ViewChildren, ViewChildrenDecorator} from './metadata/di';
export {Component, ComponentDecorator, Directive, DirectiveDecorator, HostBinding, HostBindingDecorator, HostListener, HostListenerDecorator, Input, InputDecorator, Output, OutputDecorator, Pipe, PipeDecorator} from './metadata/directives'; export {Component, ComponentDecorator, Directive, DirectiveDecorator, HostBinding, HostBindingDecorator, HostListener, HostListenerDecorator, Input, InputDecorator, Output, OutputDecorator, Pipe, PipeDecorator} from './metadata/directives';
export {DoBootstrap, ModuleWithProviders, NgModule, NgModuleDecorator} from './metadata/ng_module'; export {DoBootstrap} from './metadata/do_boostrap';
export {ModuleWithProviders, NgModule, NgModuleDecorator} from './metadata/ng_module';
export {CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA, SchemaMetadata} from './metadata/schema'; export {CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA, SchemaMetadata} from './metadata/schema';
export {ViewEncapsulation} from './metadata/view'; export {ViewEncapsulation} from './metadata/view';

View File

@ -0,0 +1,34 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {ApplicationRef} from '../application_ref';
/**
* @description
* Hook for manual bootstrapping of the application instead of using bootstrap array in @NgModule
* annotation.
*
* Reference to the current application is provided as a parameter.
*
* See ["Bootstrapping"](guide/bootstrapping) and ["Entry components"](guide/entry-components).
*
* @usageNotes
* ```typescript
* class AppModule implements DoBootstrap {
* ngDoBootstrap(appRef: ApplicationRef) {
* appRef.bootstrap(AppComponent); // Or some other component
* }
* }
* ```
*
* @publicApi
*/
export interface DoBootstrap {
ngDoBootstrap(appRef: ApplicationRef): void;
}

View File

@ -6,7 +6,6 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
import {ApplicationRef} from '../application_ref';
import {InjectorType, ɵɵdefineInjector} from '../di/interface/defs'; import {InjectorType, ɵɵdefineInjector} from '../di/interface/defs';
import {Provider} from '../di/interface/provider'; import {Provider} from '../di/interface/provider';
import {convertInjectableProviderToFactory} from '../di/util'; import {convertInjectableProviderToFactory} from '../di/util';
@ -321,29 +320,6 @@ export const NgModule: NgModuleDecorator = makeDecorator(
*/ */
(type: Type<any>, meta: NgModule) => SWITCH_COMPILE_NGMODULE(type, meta)); (type: Type<any>, meta: NgModule) => SWITCH_COMPILE_NGMODULE(type, meta));
/**
* @description
* Hook for manual bootstrapping of the application instead of using bootstrap array in @NgModule
* annotation.
*
* Reference to the current application is provided as a parameter.
*
* See ["Bootstrapping"](guide/bootstrapping) and ["Entry components"](guide/entry-components).
*
* @usageNotes
* ```typescript
* class AppModule implements DoBootstrap {
* ngDoBootstrap(appRef: ApplicationRef) {
* appRef.bootstrap(AppComponent); // Or some other component
* }
* }
* ```
*
* @publicApi
*/
export interface DoBootstrap {
ngDoBootstrap(appRef: ApplicationRef): void;
}
function preR3NgModuleCompile(moduleType: Type<any>, metadata?: NgModule): void { function preR3NgModuleCompile(moduleType: Type<any>, metadata?: NgModule): void {
let imports = (metadata && metadata.imports) || []; let imports = (metadata && metadata.imports) || [];