diff --git a/packages/schematics/angular/component/index.ts b/packages/schematics/angular/component/index.ts index b6220a803e25..0505fb1fd4e2 100644 --- a/packages/schematics/angular/component/index.ts +++ b/packages/schematics/angular/component/index.ts @@ -22,11 +22,7 @@ import { url, } from '@angular-devkit/schematics'; import * as ts from '../third_party/github.com/Microsoft/TypeScript/lib/typescript'; -import { - addDeclarationToModule, - addEntryComponentToModule, - addExportToModule, -} from '../utility/ast-utils'; +import { addDeclarationToModule, addExportToModule } from '../utility/ast-utils'; import { InsertChange } from '../utility/change'; import { buildRelativePath, findModuleFromOptions } from '../utility/find-module'; import { applyLintFix } from '../utility/lint-fix'; @@ -93,25 +89,6 @@ function addDeclarationToNgModule(options: ComponentOptions): Rule { host.commitUpdate(exportRecorder); } - if (options.entryComponent) { - // Need to refresh the AST because we overwrote the file in the host. - const source = readIntoSourceFile(host, modulePath); - - const entryComponentRecorder = host.beginUpdate(modulePath); - const entryComponentChanges = addEntryComponentToModule( - source, modulePath, - strings.classify(options.name) + strings.classify(options.type), - relativePath); - - for (const change of entryComponentChanges) { - if (change instanceof InsertChange) { - entryComponentRecorder.insertLeft(change.pos, change.toAdd); - } - } - host.commitUpdate(entryComponentRecorder); - } - - return host; }; } diff --git a/packages/schematics/angular/component/index_spec.ts b/packages/schematics/angular/component/index_spec.ts index 3cfd659fd329..fa6e76b3628f 100644 --- a/packages/schematics/angular/component/index_spec.ts +++ b/packages/schematics/angular/component/index_spec.ts @@ -148,14 +148,6 @@ describe('Component Schematic', () => { expect(appModuleContent).toMatch(/exports: \[\n(\s*) FooComponent\n\1\]/); }); - it('should set the entry component', async () => { - const options = { ...defaultOptions, entryComponent: true }; - - const tree = await schematicRunner.runSchematicAsync('component', options, appTree).toPromise(); - const appModuleContent = tree.readContent('/projects/bar/src/app/app.module.ts'); - expect(appModuleContent).toMatch(/entryComponents: \[\n(\s*) FooComponent\n\1\]/); - }); - it('should import into a specified module', async () => { const options = { ...defaultOptions, module: 'app.module.ts' }; diff --git a/packages/schematics/angular/component/schema.json b/packages/schematics/angular/component/schema.json index 6218ecd4352a..772b2d7b8748 100644 --- a/packages/schematics/angular/component/schema.json +++ b/packages/schematics/angular/component/schema.json @@ -132,12 +132,6 @@ "description": "The declaring NgModule exports this component.", "x-user-analytics": 19 }, - "entryComponent": { - "type": "boolean", - "default": false, - "description": "The new component is the entry component of the declaring NgModule.", - "x-deprecated": "Since version 9.0.0 with Ivy, entryComponents is no longer necessary." - }, "lintFix": { "type": "boolean", "description": "Apply lint fixes after generating the component.", diff --git a/packages/schematics/angular/utility/ast-utils.ts b/packages/schematics/angular/utility/ast-utils.ts index 63fe5d43603f..f77495bacdd7 100644 --- a/packages/schematics/angular/utility/ast-utils.ts +++ b/packages/schematics/angular/utility/ast-utils.ts @@ -488,19 +488,6 @@ export function addBootstrapToModule(source: ts.SourceFile, return addSymbolToNgModuleMetadata(source, modulePath, 'bootstrap', classifiedName, importPath); } -/** - * Custom function to insert an entryComponent into NgModule. It also imports it. - * @deprecated - Since version 9.0.0 with Ivy, entryComponents is no longer necessary. - */ -export function addEntryComponentToModule(source: ts.SourceFile, - modulePath: string, classifiedName: string, - importPath: string): Change[] { - return addSymbolToNgModuleMetadata( - source, modulePath, - 'entryComponents', classifiedName, importPath, - ); -} - /** * Determine if an import already exists. */