Merge pull request #25202 from RyanCavanaugh/addChakraAPIs

Add Chakra APIs for tsc.exe --build
This commit is contained in:
Ryan Cavanaugh 2018-06-26 09:29:25 -07:00 committed by GitHub
commit e38aad8b79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View file

@ -508,6 +508,9 @@ namespace ts {
echo(s: string): void;
quit(exitCode?: number): void;
fileExists(path: string): boolean;
deleteFile(path: string): boolean;
getModifiedTime(path: string): Date;
setModifiedTime(path: string, time: Date): void;
directoryExists(path: string): boolean;
createDirectory(path: string): void;
resolvePath(path: string): string;
@ -1135,6 +1138,9 @@ namespace ts {
},
resolvePath: ChakraHost.resolvePath,
fileExists: ChakraHost.fileExists,
deleteFile: ChakraHost.deleteFile,
getModifiedTime: ChakraHost.getModifiedTime,
setModifiedTime: ChakraHost.setModifiedTime,
directoryExists: ChakraHost.directoryExists,
createDirectory: ChakraHost.createDirectory,
getExecutingFilePath: () => ChakraHost.executingFile,

View file

@ -19,9 +19,13 @@ namespace ts {
}
}
function defaultIsPretty() {
return !!sys.writeOutputIsTTY && sys.writeOutputIsTTY();
}
function shouldBePretty(options: CompilerOptions) {
if (typeof options.pretty === "undefined") {
return !!sys.writeOutputIsTTY && sys.writeOutputIsTTY();
return defaultIsPretty();
}
return options.pretty;
}
@ -50,7 +54,7 @@ namespace ts {
export function executeCommandLine(args: string[]): void {
if (args.length > 0 && ((args[0].toLowerCase() === "--build") || (args[0].toLowerCase() === "-b"))) {
const reportDiag = createDiagnosticReporter(sys, /*pretty*/ true);
const reportDiag = createDiagnosticReporter(sys, defaultIsPretty());
const report = (message: DiagnosticMessage, ...args: string[]) => reportDiag(createCompilerDiagnostic(message, ...args));
const buildHost: BuildHost = {
error: report,