mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-26 03:19:10 -06:00
* Add API to get only the emited declarations output * Add nonModuleBuilder * Add basic tests for CompileOnSaveAffectedFileList API * Add API for compile single file * Avoid invoking project.languageService directly * Add API to query if compileOnSave is enabled for a project * Seperate check and emit signatures * Use Path type for internal file name matching and simplifying builder logic * Always return cascaded affected list * Correct the tsconfig file in compileOnSave tests Also move the CompileOnSave option out of compilerOptions * Reduce string to path conversion
34 lines
876 B
TypeScript
34 lines
876 B
TypeScript
/// <reference types="node" />
|
|
|
|
|
|
// TODO: extract services types
|
|
interface HostCancellationToken {
|
|
isCancellationRequested(): boolean;
|
|
}
|
|
|
|
import fs = require("fs");
|
|
|
|
function createCancellationToken(args: string[]): HostCancellationToken {
|
|
let cancellationPipeName: string;
|
|
for (let i = 0; i < args.length - 1; i++) {
|
|
if (args[i] === "--cancellationPipeName") {
|
|
cancellationPipeName = args[i + 1];
|
|
break;
|
|
}
|
|
}
|
|
if (!cancellationPipeName) {
|
|
return { isCancellationRequested: () => false };
|
|
}
|
|
return {
|
|
isCancellationRequested() {
|
|
try {
|
|
fs.statSync(cancellationPipeName);
|
|
return true;
|
|
}
|
|
catch (e) {
|
|
return false;
|
|
}
|
|
}
|
|
};
|
|
}
|
|
export = createCancellationToken; |