Make it as api so we can test it

This commit is contained in:
Sheetal Nandi
2019-03-26 13:37:51 -07:00
parent e28869d888
commit 021444a248
4 changed files with 118 additions and 49 deletions

View File

@@ -74,12 +74,7 @@ namespace ts {
// TODO(shkamat): update this after reworking ts build API
export function createCompilerHostWorker(options: CompilerOptions, setParentNodes?: boolean, system = sys): CompilerHost {
const existingDirectories = createMap<boolean>();
function getCanonicalFileName(fileName: string): string {
// if underlying system can distinguish between two files whose names differs only in cases then file name already in canonical form.
// otherwise use toLowerCase as a canonical form.
return system.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase();
}
const getCanonicalFileName = createGetCanonicalFileName(system.useCaseSensitiveFileNames);
function getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile | undefined {
let text: string | undefined;
try {