@@ -84,9 +84,14 @@ export function getDeepLinkData(appNgModuleFilePath: string, fileCache: FileCach
84
84
}
85
85
86
86
export function filterTypescriptFilesForDeepLinks ( fileCache : FileCache ) : File [ ] {
87
+ return fileCache . getAll ( ) . filter ( file => isDeepLinkingFile ( file . path ) ) ;
88
+ }
89
+
90
+ export function isDeepLinkingFile ( filePath : string ) {
87
91
const deepLinksDir = getStringPropertyValue ( Constants . ENV_VAR_DEEPLINKS_DIR ) ;
88
92
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 ;
90
95
}
91
96
92
97
export function getNgModulePathFromCorrespondingPage ( filePath : string ) {
@@ -390,7 +395,7 @@ export function purgeDeepLinkDecoratorTSTransformImpl(transformContext: Transfor
390
395
const diffDecorators : Decorator [ ] = [ ] ;
391
396
for ( const decorator of classDeclaration . decorators || [ ] ) {
392
397
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 ) {
394
399
hasDeepLinkDecorator = true ;
395
400
} else {
396
401
diffDecorators . push ( decorator ) ;
@@ -425,7 +430,7 @@ export function purgeDeepLinkDecoratorTSTransformImpl(transformContext: Transfor
425
430
const importSpecifiers : ImportSpecifier [ ] = [ ] ;
426
431
( importDeclaration . importClause . namedBindings as NamedImports ) . elements . forEach ( ( importSpecifier : ImportSpecifier ) => {
427
432
428
- if ( importSpecifier . name . escapedText !== DEEPLINK_DECORATOR_TEXT ) {
433
+ if ( importSpecifier . name . text !== DEEPLINK_DECORATOR_TEXT ) {
429
434
importSpecifiers . push ( importSpecifier ) ;
430
435
}
431
436
} ) ;
@@ -441,7 +446,6 @@ export function purgeDeepLinkDecoratorTSTransformImpl(transformContext: Transfor
441
446
) ;
442
447
}
443
448
444
-
445
449
return importDeclaration ;
446
450
}
447
451
@@ -473,7 +477,7 @@ export function purgeDeepLinkDecorator(inputText: string): string {
473
477
for ( const classDeclaration of classDeclarations ) {
474
478
for ( const decorator of classDeclaration . decorators || [ ] ) {
475
479
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 ) {
477
481
toRemove . push ( decorator ) ;
478
482
}
479
483
}
@@ -502,10 +506,10 @@ export function purgeDeepLinkImport(inputText: string): string {
502
506
const namedImportStrings : string [ ] = [ ] ;
503
507
( importDeclaration . importClause . namedBindings as NamedImports ) . elements . forEach ( ( importSpecifier : ImportSpecifier ) => {
504
508
505
- if ( importSpecifier . name . escapedText === DEEPLINK_DECORATOR_TEXT ) {
509
+ if ( importSpecifier . name . text === DEEPLINK_DECORATOR_TEXT ) {
506
510
decoratorIsImported = true ;
507
511
} else {
508
- namedImportStrings . push ( importSpecifier . name . escapedText as string ) ;
512
+ namedImportStrings . push ( importSpecifier . name . text as string ) ;
509
513
}
510
514
} ) ;
511
515
@@ -530,14 +534,14 @@ export function purgeDeepLinkImport(inputText: string): string {
530
534
531
535
export function getInjectDeepLinkConfigTypescriptTransform ( ) {
532
536
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 ) ) ;
534
538
return injectDeepLinkConfigTypescriptTransform ( deepLinkString , appNgModulePath ) ;
535
539
}
536
540
537
541
export function injectDeepLinkConfigTypescriptTransform ( deepLinkString : string , appNgModuleFilePath : string ) : TransformerFactory < SourceFile > {
538
542
539
543
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 ) {
541
545
542
546
// okay cool, we have the ng module
543
547
let functionCall = getIonicModuleForRootCall ( decorator ) ;
0 commit comments