@@ -84,9 +84,14 @@ export function getDeepLinkData(appNgModuleFilePath: string, fileCache: FileCach
8484}
8585
8686export function filterTypescriptFilesForDeepLinks ( fileCache : FileCache ) : File [ ] {
87+ return fileCache . getAll ( ) . filter ( file => isDeepLinkingFile ( file . path ) ) ;
88+ }
89+
90+ export function isDeepLinkingFile ( filePath : string ) {
8791 const deepLinksDir = getStringPropertyValue ( Constants . ENV_VAR_DEEPLINKS_DIR ) ;
8892 const moduleSuffix = getStringPropertyValue ( Constants . ENV_NG_MODULE_FILE_NAME_SUFFIX ) ;
89- return fileCache . getAll ( ) . filter ( file => extname ( file . path ) === '.ts' && file . path . indexOf ( moduleSuffix ) === - 1 && file . path . indexOf ( deepLinksDir ) >= 0 ) ;
93+ const result = extname ( filePath ) === '.ts' && filePath . indexOf ( moduleSuffix ) === - 1 && filePath . indexOf ( deepLinksDir ) >= 0 ;
94+ return result ;
9095}
9196
9297export function getNgModulePathFromCorrespondingPage ( filePath : string ) {
@@ -390,7 +395,7 @@ export function purgeDeepLinkDecoratorTSTransformImpl(transformContext: Transfor
390395 const diffDecorators : Decorator [ ] = [ ] ;
391396 for ( const decorator of classDeclaration . decorators || [ ] ) {
392397 if ( decorator . expression && ( decorator . expression as CallExpression ) . expression
393- && ( ( decorator . expression as CallExpression ) . expression as Identifier ) . escapedText === DEEPLINK_DECORATOR_TEXT ) {
398+ && ( ( decorator . expression as CallExpression ) . expression as Identifier ) . text === DEEPLINK_DECORATOR_TEXT ) {
394399 hasDeepLinkDecorator = true ;
395400 } else {
396401 diffDecorators . push ( decorator ) ;
@@ -425,7 +430,7 @@ export function purgeDeepLinkDecoratorTSTransformImpl(transformContext: Transfor
425430 const importSpecifiers : ImportSpecifier [ ] = [ ] ;
426431 ( importDeclaration . importClause . namedBindings as NamedImports ) . elements . forEach ( ( importSpecifier : ImportSpecifier ) => {
427432
428- if ( importSpecifier . name . escapedText !== DEEPLINK_DECORATOR_TEXT ) {
433+ if ( importSpecifier . name . text !== DEEPLINK_DECORATOR_TEXT ) {
429434 importSpecifiers . push ( importSpecifier ) ;
430435 }
431436 } ) ;
@@ -441,7 +446,6 @@ export function purgeDeepLinkDecoratorTSTransformImpl(transformContext: Transfor
441446 ) ;
442447 }
443448
444-
445449 return importDeclaration ;
446450 }
447451
@@ -473,7 +477,7 @@ export function purgeDeepLinkDecorator(inputText: string): string {
473477 for ( const classDeclaration of classDeclarations ) {
474478 for ( const decorator of classDeclaration . decorators || [ ] ) {
475479 if ( decorator . expression && ( decorator . expression as CallExpression ) . expression
476- && ( ( decorator . expression as CallExpression ) . expression as Identifier ) . escapedText === DEEPLINK_DECORATOR_TEXT ) {
480+ && ( ( decorator . expression as CallExpression ) . expression as Identifier ) . text === DEEPLINK_DECORATOR_TEXT ) {
477481 toRemove . push ( decorator ) ;
478482 }
479483 }
@@ -502,10 +506,10 @@ export function purgeDeepLinkImport(inputText: string): string {
502506 const namedImportStrings : string [ ] = [ ] ;
503507 ( importDeclaration . importClause . namedBindings as NamedImports ) . elements . forEach ( ( importSpecifier : ImportSpecifier ) => {
504508
505- if ( importSpecifier . name . escapedText === DEEPLINK_DECORATOR_TEXT ) {
509+ if ( importSpecifier . name . text === DEEPLINK_DECORATOR_TEXT ) {
506510 decoratorIsImported = true ;
507511 } else {
508- namedImportStrings . push ( importSpecifier . name . escapedText as string ) ;
512+ namedImportStrings . push ( importSpecifier . name . text as string ) ;
509513 }
510514 } ) ;
511515
@@ -530,14 +534,14 @@ export function purgeDeepLinkImport(inputText: string): string {
530534
531535export function getInjectDeepLinkConfigTypescriptTransform ( ) {
532536 const deepLinkString = convertDeepLinkConfigEntriesToString ( getParsedDeepLinkConfig ( ) ) ;
533- const appNgModulePath = getStringPropertyValue ( Constants . ENV_APP_NG_MODULE_PATH ) ;
537+ const appNgModulePath = toUnixPath ( getStringPropertyValue ( Constants . ENV_APP_NG_MODULE_PATH ) ) ;
534538 return injectDeepLinkConfigTypescriptTransform ( deepLinkString , appNgModulePath ) ;
535539}
536540
537541export function injectDeepLinkConfigTypescriptTransform ( deepLinkString : string , appNgModuleFilePath : string ) : TransformerFactory < SourceFile > {
538542
539543 function visitDecoratorNode ( decorator : Decorator , sourceFile : SourceFile ) : Decorator {
540- if ( decorator . expression && ( decorator . expression as CallExpression ) . expression && ( ( decorator . expression as CallExpression ) . expression as Identifier ) . escapedText === NG_MODULE_DECORATOR_TEXT ) {
544+ if ( decorator . expression && ( decorator . expression as CallExpression ) . expression && ( ( decorator . expression as CallExpression ) . expression as Identifier ) . text === NG_MODULE_DECORATOR_TEXT ) {
541545
542546 // okay cool, we have the ng module
543547 let functionCall = getIonicModuleForRootCall ( decorator ) ;
0 commit comments