mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-07 14:34:35 -06:00
Merge branch 'master' into cacheHostResults
This commit is contained in:
commit
1f2d403f6d
@ -1051,14 +1051,6 @@ namespace ts {
|
||||
return buildErrors(syntaxDiagnostics, BuildResultFlags.SyntaxErrors, "Syntactic");
|
||||
}
|
||||
|
||||
// Don't emit .d.ts if there are decl file errors
|
||||
if (getEmitDeclarations(program.getCompilerOptions())) {
|
||||
const declDiagnostics = program.getDeclarationDiagnostics();
|
||||
if (declDiagnostics.length) {
|
||||
return buildErrors(declDiagnostics, BuildResultFlags.DeclarationEmitErrors, "Declaration file");
|
||||
}
|
||||
}
|
||||
|
||||
// Same as above but now for semantic diagnostics
|
||||
const semanticDiagnostics = program.getSemanticDiagnostics();
|
||||
if (semanticDiagnostics.length) {
|
||||
@ -1067,14 +1059,23 @@ namespace ts {
|
||||
|
||||
let newestDeclarationFileContentChangedTime = minimumDate;
|
||||
let anyDtsChanged = false;
|
||||
let emitDiagnostics: Diagnostic[] | undefined;
|
||||
const reportEmitDiagnostic = (d: Diagnostic) => (emitDiagnostics || (emitDiagnostics = [])).push(d);
|
||||
emitFilesAndReportErrors(program, reportEmitDiagnostic, writeFileName, /*reportSummary*/ undefined, (fileName, content, writeBom, onError) => {
|
||||
let declDiagnostics: Diagnostic[] | undefined;
|
||||
const reportDeclarationDiagnostics = (d: Diagnostic) => (declDiagnostics || (declDiagnostics = [])).push(d);
|
||||
const outputFiles: OutputFile[] = [];
|
||||
emitFilesAndReportErrors(program, reportDeclarationDiagnostics, writeFileName, /*reportSummary*/ undefined, (name, text, writeByteOrderMark) => outputFiles.push({ name, text, writeByteOrderMark }));
|
||||
// Don't emit .d.ts if there are decl file errors
|
||||
if (declDiagnostics) {
|
||||
return buildErrors(declDiagnostics, BuildResultFlags.DeclarationEmitErrors, "Declaration file");
|
||||
}
|
||||
|
||||
// Actual Emit
|
||||
const emitterDiagnostics = createDiagnosticCollection();
|
||||
outputFiles.forEach(({ name, text, writeByteOrderMark }) => {
|
||||
let priorChangeTime: Date | undefined;
|
||||
if (!anyDtsChanged && isDeclarationFile(fileName)) {
|
||||
if (!anyDtsChanged && isDeclarationFile(name)) {
|
||||
// Check for unchanged .d.ts files
|
||||
if (host.fileExists(fileName) && readFileWithCache(fileName) === content) {
|
||||
priorChangeTime = host.getModifiedTime(fileName);
|
||||
if (host.fileExists(name) && readFileWithCache(name) === text) {
|
||||
priorChangeTime = host.getModifiedTime(name);
|
||||
}
|
||||
else {
|
||||
resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
|
||||
@ -1082,14 +1083,15 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
host.writeFile(fileName, content, writeBom, onError, emptyArray);
|
||||
writeFile(host, emitterDiagnostics, name, text, writeByteOrderMark);
|
||||
if (priorChangeTime !== undefined) {
|
||||
newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime);
|
||||
unchangedOutputs.setValue(fileName, priorChangeTime);
|
||||
unchangedOutputs.setValue(name, priorChangeTime);
|
||||
}
|
||||
});
|
||||
|
||||
if (emitDiagnostics) {
|
||||
const emitDiagnostics = emitterDiagnostics.getDiagnostics();
|
||||
if (emitDiagnostics.length) {
|
||||
return buildErrors(emitDiagnostics, BuildResultFlags.EmitErrors, "Emit");
|
||||
}
|
||||
|
||||
|
||||
@ -3402,7 +3402,7 @@ namespace ts {
|
||||
return combinePaths(newDirPath, sourceFilePath);
|
||||
}
|
||||
|
||||
export function writeFile(host: EmitHost, diagnostics: DiagnosticCollection, fileName: string, data: string, writeByteOrderMark: boolean, sourceFiles?: ReadonlyArray<SourceFile>) {
|
||||
export function writeFile(host: { writeFile: WriteFileCallback; }, diagnostics: DiagnosticCollection, fileName: string, data: string, writeByteOrderMark: boolean, sourceFiles?: ReadonlyArray<SourceFile>) {
|
||||
host.writeFile(fileName, data, writeByteOrderMark, hostErrorMessage => {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage));
|
||||
}, sourceFiles);
|
||||
|
||||
@ -162,7 +162,6 @@ node_modules/bluebird/js/release/some.js(133,23): error TS2339: Property 'promis
|
||||
node_modules/bluebird/js/release/using.js(78,20): error TS2339: Property 'doDispose' does not exist on type 'Disposer'.
|
||||
node_modules/bluebird/js/release/using.js(97,23): error TS2339: Property 'data' does not exist on type 'FunctionDisposer'.
|
||||
node_modules/bluebird/js/release/using.js(223,15): error TS2350: Only a void function can be called with the 'new' keyword.
|
||||
node_modules/bluebird/js/release/util.js(251,28): error TS2554: Expected 0 arguments, but got 2.
|
||||
node_modules/bluebird/js/release/util.js(279,45): error TS2345: Argument of type 'PropertyDescriptor | { value: any; } | undefined' is not assignable to parameter of type 'PropertyDescriptor & ThisType<any>'.
|
||||
Type 'undefined' is not assignable to type 'PropertyDescriptor & ThisType<any>'.
|
||||
Type 'undefined' is not assignable to type 'PropertyDescriptor'.
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
Exit Code: 1
|
||||
Standard output:
|
||||
node_modules/follow-redirects/index.js(86,10): error TS2339: Property 'emit' does not exist on type 'RedirectableRequest'.
|
||||
node_modules/follow-redirects/index.js(87,10): error TS2339: Property 'abort' does not exist on type 'RedirectableRequest'.
|
||||
node_modules/follow-redirects/index.js(145,10): error TS2339: Property 'emit' does not exist on type 'RedirectableRequest'.
|
||||
node_modules/follow-redirects/index.js(211,12): error TS2339: Property 'emit' does not exist on type 'RedirectableRequest'.
|
||||
node_modules/follow-redirects/index.js(245,35): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
|
||||
node_modules/follow-redirects/index.js(97,10): error TS2339: Property 'emit' does not exist on type 'RedirectableRequest'.
|
||||
node_modules/follow-redirects/index.js(98,10): error TS2339: Property 'abort' does not exist on type 'RedirectableRequest'.
|
||||
node_modules/follow-redirects/index.js(156,10): error TS2339: Property 'emit' does not exist on type 'RedirectableRequest'.
|
||||
node_modules/follow-redirects/index.js(222,12): error TS2339: Property 'emit' does not exist on type 'RedirectableRequest'.
|
||||
node_modules/follow-redirects/index.js(256,35): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
|
||||
Type 'undefined' is not assignable to type 'string'.
|
||||
node_modules/follow-redirects/index.js(258,10): error TS2339: Property 'emit' does not exist on type 'RedirectableRequest'.
|
||||
node_modules/follow-redirects/index.js(269,10): error TS2339: Property 'emit' does not exist on type 'RedirectableRequest'.
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user