perf(compiler): only emit changed files for incremental compilation
For now, we always create all generated files, but diff them before we pass them to TypeScript. For the user files, we compare the programs and only emit changed TypeScript files. This also adds more diagnostic messages if the `—diagnostics` flag is passed to the command line.
This commit is contained in:

committed by
Alex Rickabaugh

parent
b0868915ae
commit
745b59f49c
@ -19,9 +19,11 @@ import {ParseSourceSpan} from '@angular/compiler';
|
||||
import * as ts from 'typescript';
|
||||
|
||||
import {formatDiagnostics as formatDiagnosticsOrig} from './perform_compile';
|
||||
import {Program as ProgramOrig} from './transformers/api';
|
||||
import {createCompilerHost as createCompilerOrig} from './transformers/compiler_host';
|
||||
import {createProgram as createProgramOrig} from './transformers/program';
|
||||
|
||||
|
||||
// Interfaces from ./transformers/api;
|
||||
export interface Diagnostic {
|
||||
messageText: string;
|
||||
@ -92,12 +94,6 @@ export interface TsEmitArguments {
|
||||
|
||||
export interface TsEmitCallback { (args: TsEmitArguments): ts.EmitResult; }
|
||||
|
||||
export interface LibrarySummary {
|
||||
fileName: string;
|
||||
text: string;
|
||||
sourceFile?: ts.SourceFile;
|
||||
}
|
||||
|
||||
export interface Program {
|
||||
getTsProgram(): ts.Program;
|
||||
getTsOptionDiagnostics(cancellationToken?: ts.CancellationToken): ts.Diagnostic[];
|
||||
@ -116,7 +112,6 @@ export interface Program {
|
||||
customTransformers?: CustomTransformers,
|
||||
emitCallback?: TsEmitCallback
|
||||
}): ts.EmitResult;
|
||||
getLibrarySummaries(): LibrarySummary[];
|
||||
}
|
||||
|
||||
// Wrapper for createProgram.
|
||||
@ -124,7 +119,7 @@ export function createProgram(
|
||||
{rootNames, options, host, oldProgram}:
|
||||
{rootNames: string[], options: CompilerOptions, host: CompilerHost, oldProgram?: Program}):
|
||||
Program {
|
||||
return createProgramOrig({rootNames, options, host, oldProgram});
|
||||
return createProgramOrig({rootNames, options, host, oldProgram: oldProgram as ProgramOrig});
|
||||
}
|
||||
|
||||
// Wrapper for createCompilerHost.
|
||||
|
Reference in New Issue
Block a user