55 * Use of this source code is governed by an MIT-style license that can be
66 * found in the LICENSE file at https://angular.io/license
77 */
8- import { normalize } from '@angular-devkit/core' ;
8+ import { normalize , strings } from '@angular-devkit/core' ;
99import {
1010 Rule ,
1111 SchematicContext ,
@@ -22,7 +22,6 @@ import {
2222 url ,
2323} from '@angular-devkit/schematics' ;
2424import * as ts from 'typescript' ;
25- import * as stringUtils from '../strings' ;
2625import { addDeclarationToModule , addExportToModule } from '../utility/ast-utils' ;
2726import { InsertChange } from '../utility/change' ;
2827import { buildRelativePath , findModuleFromOptions } from '../utility/find-module' ;
@@ -44,11 +43,11 @@ function addDeclarationToNgModule(options: ComponentOptions): Rule {
4443 const source = ts . createSourceFile ( modulePath , sourceText , ts . ScriptTarget . Latest , true ) ;
4544
4645 const componentPath = `/${ options . sourceDir } /${ options . path } /`
47- + ( options . flat ? '' : stringUtils . dasherize ( options . name ) + '/' )
48- + stringUtils . dasherize ( options . name )
46+ + ( options . flat ? '' : strings . dasherize ( options . name ) + '/' )
47+ + strings . dasherize ( options . name )
4948 + '.component' ;
5049 const relativePath = buildRelativePath ( modulePath , componentPath ) ;
51- const classifiedName = stringUtils . classify ( `${ options . name } Component` ) ;
50+ const classifiedName = strings . classify ( `${ options . name } Component` ) ;
5251 const declarationChanges = addDeclarationToModule ( source ,
5352 modulePath ,
5453 classifiedName ,
@@ -73,7 +72,7 @@ function addDeclarationToNgModule(options: ComponentOptions): Rule {
7372
7473 const exportRecorder = host . beginUpdate ( modulePath ) ;
7574 const exportChanges = addExportToModule ( source , modulePath ,
76- stringUtils . classify ( `${ options . name } Component` ) ,
75+ strings . classify ( `${ options . name } Component` ) ,
7776 relativePath ) ;
7877
7978 for ( const change of exportChanges ) {
@@ -91,7 +90,7 @@ function addDeclarationToNgModule(options: ComponentOptions): Rule {
9190
9291
9392function buildSelector ( options : ComponentOptions ) {
94- let selector = stringUtils . dasherize ( options . name ) ;
93+ let selector = strings . dasherize ( options . name ) ;
9594 if ( options . prefix ) {
9695 selector = `${ options . prefix } -${ selector } ` ;
9796 }
@@ -116,7 +115,7 @@ export default function(options: ComponentOptions): Rule {
116115 options . inlineStyle ? filter ( path => ! path . endsWith ( '.__styleext__' ) ) : noop ( ) ,
117116 options . inlineTemplate ? filter ( path => ! path . endsWith ( '.html' ) ) : noop ( ) ,
118117 template ( {
119- ...stringUtils ,
118+ ...strings ,
120119 'if-flat' : ( s : string ) => options . flat ? '' : s ,
121120 ...options ,
122121 } ) ,
0 commit comments