Skip to content

Commit 9931a1e

Browse files
committed
Modify all usages of file name lower casing to use custom lower casing method
1 parent 842e733 commit 9931a1e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/jsTyping/jsTyping.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
removeFileExtension,
2727
removeMinAndVersionNumbers,
2828
some,
29+
toFileNameLowerCase,
2930
TypeAcquisition,
3031
Version,
3132
versionMajorMinor,
@@ -313,8 +314,8 @@ export function discoverTypings(
313314
// packages. So that needs this dance here.
314315
const pathComponents = getPathComponents(normalizePath(manifestPath));
315316
const isScoped = pathComponents[pathComponents.length - 3][0] === "@";
316-
return isScoped && pathComponents[pathComponents.length - 4].toLowerCase() === modulesDirName || // `node_modules/@foo/bar`
317-
!isScoped && pathComponents[pathComponents.length - 3].toLowerCase() === modulesDirName; // `node_modules/foo`
317+
return isScoped && toFileNameLowerCase(pathComponents[pathComponents.length - 4]) === modulesDirName || // `node_modules/@foo/bar`
318+
!isScoped && toFileNameLowerCase(pathComponents[pathComponents.length - 3]) === modulesDirName; // `node_modules/foo`
318319
});
319320

320321
if (log) log(`Searching for typing names in ${packagesFolderPath}; all files: ${JSON.stringify(dependencyManifestNames)}`);
@@ -361,7 +362,7 @@ export function discoverTypings(
361362
const fromFileNames = mapDefined(fileNames, j => {
362363
if (!hasJSFileExtension(j)) return undefined;
363364

364-
const inferredTypingName = removeFileExtension(getBaseFileName(j.toLowerCase()));
365+
const inferredTypingName = removeFileExtension(toFileNameLowerCase(getBaseFileName(j)));
365366
const cleanedTypingName = removeMinAndVersionNumbers(inferredTypingName);
366367
return safeList.get(cleanedTypingName);
367368
});

src/services/shims.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ export class LanguageServiceShimHostAdapter implements LanguageServiceHost {
459459
if ("getTypeReferenceDirectiveResolutionsForFile" in this.shimHost) {
460460
this.resolveTypeReferenceDirectives = (typeDirectiveNames, containingFile) => {
461461
const typeDirectivesForFile = JSON.parse(this.shimHost.getTypeReferenceDirectiveResolutionsForFile!(containingFile)) as MapLike<ResolvedTypeReferenceDirective>; // TODO: GH#18217
462-
return map(typeDirectiveNames as (string | FileReference)[], name => getProperty(typeDirectivesForFile, isString(name) ? name : name.fileName.toLowerCase()));
462+
return map(typeDirectiveNames as (string | FileReference)[], name => getProperty(typeDirectivesForFile, isString(name) ? name : toFileNameLowerCase(name.fileName)));
463463
};
464464
}
465465
}

0 commit comments

Comments
 (0)