@@ -23,9 +23,9 @@ export class RouterParserUtil {
23
23
private cleanModulesTree ;
24
24
private modulesWithRoutes = [ ] ;
25
25
private transformAngular8ImportSyntax =
26
- / ( [ ' " ] l o a d C h i l d r e n [ ' " ] : ) \( \) ( : [ ^ ) ] + ?) ? = > " i m p o r t \( ( \\ ' | ' | " ) ( [ ^ ' " ] + ?) ( \\ ' | ' | " ) \) \. t h e n \( \( ? \w + ?\) ? = > \S + ?\. ( [ ^ ) ] + ?) \) ( \\ ' | ' | " ) / g;
26
+ / ( [ ' " ] l o a d C h i l d r e n [ ' " ] : ) \( \) ( : [ ^ ) ] + ?) ? = > " i m p o r t \( ( \\ ' | ' | " | ` ) ( [ ^ ' " ] + ?) ( \\ ' | ' | " | ` ) \) \. t h e n \( \( ? \w + ?\) ? = > \S + ?\. ( [ ^ ) ] + ?) \) ( \\ ' | ' | " ) / g;
27
27
private transformAngular8ImportSyntaxAsyncAwait =
28
- / ( [ ' " ] l o a d C h i l d r e n [ ' " ] : ) \( \) ( : [ ^ ) ] + ?) ? = > \( " i m p o r t \( ( \\ ' | ' | " ) ( [ ^ ' " ] + ?) ( \\ ' | ' | " ) \) " \) \. [ ' " ] ( [ ^ ) ] + ?) [ ' " ] / g;
28
+ / ( [ ' " ] l o a d C h i l d r e n [ ' " ] : ) \( \) ( : [ ^ ) ] + ?) ? = > \( " i m p o r t \( ( \\ ' | ' | " | ` ) ( [ ^ ' " ] + ?) ( \\ ' | ' | " | ` ) \) " \) \. [ ' " ] ( [ ^ ) ] + ?) [ ' " ] / g;
29
29
30
30
private static instance : RouterParserUtil ;
31
31
private constructor ( ) { }
@@ -594,8 +594,7 @@ export class RouterParserUtil {
594
594
595
595
if ( foundWithAliasInImports ) {
596
596
if ( typeof searchedImport !== 'undefined' ) {
597
-
598
- const routePathIsBad = ( path ) => {
597
+ const routePathIsBad = path => {
599
598
return typeof ast . getSourceFile ( path ) == 'undefined' ;
600
599
} ;
601
600
@@ -604,7 +603,9 @@ export class RouterParserUtil {
604
603
if ( searchStrLen == 0 ) {
605
604
return [ ] ;
606
605
}
607
- var startIndex = 0 , index , indices = [ ] ;
606
+ var startIndex = 0 ,
607
+ index ,
608
+ indices = [ ] ;
608
609
if ( ! caseSensitive ) {
609
610
str = str . toLowerCase ( ) ;
610
611
searchStr = searchStr . toLowerCase ( ) ;
@@ -614,22 +615,28 @@ export class RouterParserUtil {
614
615
startIndex = index + searchStrLen ;
615
616
}
616
617
return indices ;
617
- }
618
+ } ;
618
619
619
620
const dirNamePath = path . dirname ( file . getFilePath ( ) ) ;
620
621
const searchedImportPath = searchedImport . getModuleSpecifierValue ( ) ;
621
622
const leadingFilePath = searchedImportPath . split ( '/' ) . shift ( ) ;
622
623
623
- let importPath = path . resolve ( dirNamePath + '/' + searchedImport . getModuleSpecifierValue ( ) + '.ts' ) ;
624
+ let importPath = path . resolve (
625
+ dirNamePath + '/' + searchedImport . getModuleSpecifierValue ( ) + '.ts'
626
+ ) ;
624
627
625
628
if ( routePathIsBad ( importPath ) ) {
626
629
let leadingIndices = getIndicesOf ( leadingFilePath , importPath , true ) ;
627
- if ( leadingIndices . length > 1 ) { // Nested route fixes
630
+ if ( leadingIndices . length > 1 ) {
631
+ // Nested route fixes
628
632
let startIndex = leadingIndices [ 0 ] ;
629
- let endIndex = leadingIndices [ leadingIndices . length - 1 ] ;
630
- importPath = importPath . slice ( 0 , startIndex ) + importPath . slice ( endIndex ) ;
631
- } else { // Top level route fixes
632
- importPath = path . dirname ( dirNamePath ) + '/' + searchedImportPath + '.ts' ;
633
+ let endIndex = leadingIndices [ leadingIndices . length - 1 ] ;
634
+ importPath =
635
+ importPath . slice ( 0 , startIndex ) + importPath . slice ( endIndex ) ;
636
+ } else {
637
+ // Top level route fixes
638
+ importPath =
639
+ path . dirname ( dirNamePath ) + '/' + searchedImportPath + '.ts' ;
633
640
}
634
641
}
635
642
const sourceFileImport =
0 commit comments