UNPKG

2.36 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright Google Inc. All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8/// <amd-module name="@angular/compiler-cli/src/perform_compile" />
9import { Position } from '@angular/compiler';
10import * as ts from 'typescript';
11import * as api from './transformers/api';
12export declare type Diagnostics = ReadonlyArray<ts.Diagnostic | api.Diagnostic>;
13export declare function filterErrorsAndWarnings(diagnostics: Diagnostics): Diagnostics;
14export declare function formatDiagnosticPosition(position: Position, host?: ts.FormatDiagnosticsHost): string;
15export declare function flattenDiagnosticMessageChain(chain: api.DiagnosticMessageChain, host?: ts.FormatDiagnosticsHost): string;
16export declare function formatDiagnostic(diagnostic: api.Diagnostic, host?: ts.FormatDiagnosticsHost): string;
17export declare function formatDiagnostics(diags: Diagnostics, host?: ts.FormatDiagnosticsHost): string;
18export interface ParsedConfiguration {
19 project: string;
20 options: api.CompilerOptions;
21 rootNames: string[];
22 emitFlags: api.EmitFlags;
23 errors: Diagnostics;
24}
25export declare function calcProjectFileAndBasePath(project: string): {
26 projectFile: string;
27 basePath: string;
28};
29export declare function createNgCompilerOptions(basePath: string, config: any, tsOptions: ts.CompilerOptions): api.CompilerOptions;
30export declare function readConfiguration(project: string, existingOptions?: ts.CompilerOptions): ParsedConfiguration;
31export interface PerformCompilationResult {
32 diagnostics: Diagnostics;
33 program?: api.Program;
34 emitResult?: ts.EmitResult;
35}
36export declare function exitCodeFromResult(diags: Diagnostics | undefined): number;
37export declare function performCompilation({ rootNames, options, host, oldProgram, emitCallback, mergeEmitResultsCallback, gatherDiagnostics, customTransformers, emitFlags }: {
38 rootNames: string[];
39 options: api.CompilerOptions;
40 host?: api.CompilerHost;
41 oldProgram?: api.Program;
42 emitCallback?: api.TsEmitCallback;
43 mergeEmitResultsCallback?: api.TsMergeEmitResultsCallback;
44 gatherDiagnostics?: (program: api.Program) => Diagnostics;
45 customTransformers?: api.CustomTransformers;
46 emitFlags?: api.EmitFlags;
47}): PerformCompilationResult;