@@ -1484,24 +1484,25 @@ export function resolveModuleName(moduleName: string, containingFile: string, co
14841484 if ( redirectedReference ) {
14851485 projectDir = getDirectoryPath ( redirectedReference . sourceFile . fileName ) ;
14861486 options = redirectedReference . commandLine . options ;
1487- } else {
1487+ }
1488+ else {
14881489 projectDir = getDirectoryPath ( containingFile ) ;
14891490 options = compilerOptions ;
14901491 }
14911492
14921493 let currentDir = projectDir ;
14931494 let packageJsonInfo : PackageJsonInfoCacheEntry | undefined ;
14941495 while ( currentDir ) {
1495- const packageJsonPath = combinePaths ( currentDir , "package.json" ) ;
1496- packageJsonInfo = cache ?. getPackageJsonInfo ( packageJsonPath ) ;
1497- if ( isPackageJsonInfo ( packageJsonInfo ) ) break ;
1498- const parent = getDirectoryPath ( currentDir ) ;
1499- if ( parent === currentDir ) break ;
1500- currentDir = parent ;
1496+ const packageJsonPath = combinePaths ( currentDir , "package.json" ) ;
1497+ packageJsonInfo = cache ?. getPackageJsonInfo ( packageJsonPath ) ;
1498+ if ( isPackageJsonInfo ( packageJsonInfo ) ) break ;
1499+ const parent = getDirectoryPath ( currentDir ) ;
1500+ if ( parent === currentDir ) break ;
1501+ currentDir = parent ;
15011502 }
15021503
15031504 if ( isPackageJsonInfo ( packageJsonInfo ) && packageJsonInfo . contents . packageJsonContent . name === moduleName ) {
1504- if ( options ) {
1505+ if ( options ) {
15051506 let outputDts : string | undefined ;
15061507 if ( options . outFile ) {
15071508 outputDts = changeAnyExtension ( options . outFile , ".d.ts" ) ;
@@ -1510,16 +1511,16 @@ export function resolveModuleName(moduleName: string, containingFile: string, co
15101511 const getCanonicalFileName = createGetCanonicalFileName (
15111512 typeof host . useCaseSensitiveFileNames === "function"
15121513 ? host . useCaseSensitiveFileNames ( )
1513- : host . useCaseSensitiveFileNames ?? true
1514+ : host . useCaseSensitiveFileNames ?? true ,
15141515 ) ;
15151516
15161517 let rootDir = options . rootDir ;
15171518 if ( ! rootDir && redirectedReference ) {
1518- rootDir = getCommonSourceDirectory (
1519+ rootDir = getCommonSourceDirectory (
15191520 options ,
15201521 ( ) => redirectedReference . commandLine . fileNames ,
15211522 host . getCurrentDirectory ? host . getCurrentDirectory ( ) : "" ,
1522- getCanonicalFileName
1523+ getCanonicalFileName ,
15231524 ) ;
15241525 }
15251526
@@ -1533,7 +1534,7 @@ export function resolveModuleName(moduleName: string, containingFile: string, co
15331534 result . resolvedModule . resolvedFileName = outputDts ;
15341535 result . resolvedModule . extension = Extension . Dts ;
15351536 }
1536- }
1537+ }
15371538 }
15381539 }
15391540 }
0 commit comments