UNPKG

2.34 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright Google LLC 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.dev/license
7 */
8import ts from 'typescript';
9import { AbsoluteFsPath, ReadonlyFileSystem } from '../src/ngtsc/file_system';
10import * as api from './transformers/api';
11export declare function formatDiagnostics(diags: ReadonlyArray<ts.Diagnostic>, host?: ts.FormatDiagnosticsHost): string;
12/** Used to read configuration files. */
13export type ConfigurationHost = Pick<ReadonlyFileSystem, 'readFile' | 'exists' | 'lstat' | 'resolve' | 'join' | 'dirname' | 'extname' | 'pwd'>;
14export interface ParsedConfiguration {
15 project: string;
16 options: api.CompilerOptions;
17 rootNames: string[];
18 projectReferences?: readonly ts.ProjectReference[] | undefined;
19 emitFlags: api.EmitFlags;
20 errors: ts.Diagnostic[];
21}
22export declare function calcProjectFileAndBasePath(project: string, host?: ConfigurationHost): {
23 projectFile: AbsoluteFsPath;
24 basePath: AbsoluteFsPath;
25};
26export declare function readConfiguration(project: string, existingOptions?: api.CompilerOptions, host?: ConfigurationHost): ParsedConfiguration;
27export interface PerformCompilationResult {
28 diagnostics: ReadonlyArray<ts.Diagnostic>;
29 program?: api.Program;
30 emitResult?: ts.EmitResult;
31}
32export declare function exitCodeFromResult(diags: ReadonlyArray<ts.Diagnostic> | undefined): number;
33export declare function performCompilation<CbEmitRes extends ts.EmitResult = ts.EmitResult>({ rootNames, options, host, oldProgram, emitCallback, mergeEmitResultsCallback, gatherDiagnostics, customTransformers, emitFlags, forceEmit, modifiedResourceFiles, }: {
34 rootNames: string[];
35 options: api.CompilerOptions;
36 host?: api.CompilerHost;
37 oldProgram?: api.Program;
38 emitCallback?: api.TsEmitCallback<CbEmitRes>;
39 mergeEmitResultsCallback?: api.TsMergeEmitResultsCallback<CbEmitRes>;
40 gatherDiagnostics?: (program: api.Program) => ReadonlyArray<ts.Diagnostic>;
41 customTransformers?: api.CustomTransformers;
42 emitFlags?: api.EmitFlags;
43 forceEmit?: boolean;
44 modifiedResourceFiles?: Set<string> | null;
45}): PerformCompilationResult;
46export declare function defaultGatherDiagnostics(program: api.Program): ReadonlyArray<ts.Diagnostic>;