refactor(core): deprecate entryComponents (#33205)

With Ivy the `entryComponents` array isn't necessary anymore. These changes mark it as deprecated so that it can be removed in a future version.

PR Close #33205
This commit is contained in:
crisbeto 2019-10-18 20:48:37 +02:00 committed by Matias Niemelä
parent cb4f803238
commit 1799f621b7
5 changed files with 12 additions and 2 deletions

View File

@ -82,6 +82,8 @@ Tip: In the [API reference section](api) of this doc site, deprecated APIs are i
| [`wtfStartTimeRange`](api/core/wtfStartTimeRange) | none | v8 | See [Web Tracing Framework](#wtf) |
| [`wtfEndTimeRange`](api/core/wtfEndTimeRange) | none | v8 | See [Web Tracing Framework](#wtf) |
| [`wtfLeave`](api/core/wtfLeave) | none | v8 | See [Web Tracing Framework](#wtf) |
| [`entryComponents`](api/core/NgModule#entryComponents) | none | v9 | See [`entryComponents`](#entryComponents) |
| [`ANALYZE_FOR_ENTRY_COMPONENTS`](api/core/ANALYZE_FOR_ENTRY_COMPONENTS) | none | v9 | See [`ANALYZE_FOR_ENTRY_COMPONENTS`](#entryComponents) |
{@a forms}
@ -318,6 +320,10 @@ As of Angular version 8, all `platform-webworker` APIs are deprecated.
This includes both packages: `@angular/platform-webworker` and
`@angular/platform-webworker-dynamic`.
{@a entryComponents}
### `entryComponents` and `ANALYZE_FOR_ENTRY_COMPONENTS` no longer required
Previously, the `entryComponents` array in the `NgModule` definition was used to tell the compiler which components would be created and inserted dynamically. With Ivy, this isn't a requirement anymore and the `entryComponents` array can be removed from existing module declarations. The same applies to the `ANALYZE_FOR_ENTRY_COMPONENTS` injection token.
## Angular version 9 schematics

View File

@ -45,6 +45,7 @@ import {makePropDecorator} from '../util/decorators';
* ```
*
* @publicApi
* @deprecated Since 9.0.0. With Ivy, this property is no longer necessary.
*/
export const ANALYZE_FOR_ENTRY_COMPONENTS = new InjectionToken<any>('AnalyzeForEntryComponents');

View File

@ -542,6 +542,7 @@ export interface Component extends Directive {
* this component. For each component listed here,
* Angular creates a {@link ComponentFactory} and stores it in the
* {@link ComponentFactoryResolver}.
* @deprecated Since 9.0.0. With Ivy, this property is no longer necessary.
*/
entryComponents?: Array<Type<any>|any[]>;

View File

@ -265,6 +265,7 @@ export interface NgModule {
* using one of the imperative techniques, such as `ViewContainerRef.createComponent()`.
*
* @see [Entry Components](guide/entry-components)
* @deprecated Since 9.0.0. With Ivy, this property is no longer necessary.
*/
entryComponents?: Array<Type<any>|any[]>;

View File

@ -18,6 +18,7 @@ export interface AfterViewInit {
ngAfterViewInit(): void;
}
/** @deprecated */
export declare const ANALYZE_FOR_ENTRY_COMPONENTS: InjectionToken<any>;
export declare const APP_BOOTSTRAP_LISTENER: InjectionToken<((compRef: ComponentRef<any>) => void)[]>;
@ -116,7 +117,7 @@ export interface Component extends Directive {
animations?: any[];
changeDetection?: ChangeDetectionStrategy;
encapsulation?: ViewEncapsulation;
entryComponents?: Array<Type<any> | any[]>;
/** @deprecated */ entryComponents?: Array<Type<any> | any[]>;
interpolation?: [string, string];
moduleId?: string;
preserveWhitespaces?: boolean;
@ -581,7 +582,7 @@ export declare type NgIterable<T> = Array<T> | Iterable<T>;
export interface NgModule {
bootstrap?: Array<Type<any> | any[]>;
declarations?: Array<Type<any> | any[]>;
entryComponents?: Array<Type<any> | any[]>;
/** @deprecated */ entryComponents?: Array<Type<any> | any[]>;
exports?: Array<Type<any> | any[]>;
id?: string;
imports?: Array<Type<any> | ModuleWithProviders<{}> | any[]>;