1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 | import { ParseSourceSpan } from '@angular/compiler';
|
23 | import * as ts from 'typescript';
|
24 | export interface Diagnostic {
|
25 | messageText: string;
|
26 | span?: ParseSourceSpan;
|
27 | category: ts.DiagnosticCategory;
|
28 | code: number;
|
29 | source: 'angular';
|
30 | }
|
31 | export interface CompilerOptions extends ts.CompilerOptions {
|
32 | basePath?: string;
|
33 | skipMetadataEmit?: boolean;
|
34 | strictMetadataEmit?: boolean;
|
35 | skipTemplateCodegen?: boolean;
|
36 | flatModuleOutFile?: string;
|
37 | flatModuleId?: string;
|
38 | generateCodeForLibraries?: boolean;
|
39 | annotateForClosureCompiler?: boolean;
|
40 | annotationsAs?: 'decorators' | 'static fields';
|
41 | trace?: boolean;
|
42 | disableExpressionLowering?: boolean;
|
43 | i18nOutLocale?: string;
|
44 | i18nOutFormat?: string;
|
45 | i18nOutFile?: string;
|
46 | i18nInFormat?: string;
|
47 | i18nInLocale?: string;
|
48 | i18nInFile?: string;
|
49 | i18nInMissingTranslations?: 'error' | 'warning' | 'ignore';
|
50 | preserveWhitespaces?: boolean;
|
51 | disableTypeScriptVersionCheck?: boolean;
|
52 | }
|
53 | export interface CompilerHost extends ts.CompilerHost {
|
54 | moduleNameToFileName?(moduleName: string, containingFile?: string): string | null;
|
55 | fileNameToModuleName?(importedFilePath: string, containingFilePath: string): string;
|
56 | resourceNameToFileName?(resourceName: string, containingFilePath: string): string | null;
|
57 | toSummaryFileName?(fileName: string, referringSrcFileName: string): string;
|
58 | fromSummaryFileName?(fileName: string, referringLibFileName: string): string;
|
59 | readResource?(fileName: string): Promise<string> | string;
|
60 | }
|
61 | export declare enum EmitFlags {
|
62 | DTS = 1,
|
63 | JS = 2,
|
64 | Metadata = 4,
|
65 | I18nBundle = 8,
|
66 | Codegen = 16,
|
67 | Default = 19,
|
68 | All = 31,
|
69 | }
|
70 | export interface CustomTransformers {
|
71 | beforeTs?: ts.TransformerFactory<ts.SourceFile>[];
|
72 | afterTs?: ts.TransformerFactory<ts.SourceFile>[];
|
73 | }
|
74 | export interface TsEmitArguments {
|
75 | program: ts.Program;
|
76 | host: CompilerHost;
|
77 | options: CompilerOptions;
|
78 | targetSourceFile?: ts.SourceFile;
|
79 | writeFile?: ts.WriteFileCallback;
|
80 | cancellationToken?: ts.CancellationToken;
|
81 | emitOnlyDtsFiles?: boolean;
|
82 | customTransformers?: ts.CustomTransformers;
|
83 | }
|
84 | export interface TsEmitCallback {
|
85 | (args: TsEmitArguments): ts.EmitResult;
|
86 | }
|
87 | export interface LazyRoute {
|
88 | module: {
|
89 | name: string;
|
90 | filePath: string;
|
91 | };
|
92 | route: string;
|
93 | referencedModule: {
|
94 | name: string;
|
95 | filePath: string;
|
96 | };
|
97 | }
|
98 | export interface Program {
|
99 | getTsProgram(): ts.Program;
|
100 | getTsOptionDiagnostics(cancellationToken?: ts.CancellationToken): ReadonlyArray<ts.Diagnostic>;
|
101 | getNgOptionDiagnostics(cancellationToken?: ts.CancellationToken): ReadonlyArray<Diagnostic>;
|
102 | getTsSyntacticDiagnostics(sourceFile?: ts.SourceFile, cancellationToken?: ts.CancellationToken): ReadonlyArray<ts.Diagnostic>;
|
103 | getNgStructuralDiagnostics(cancellationToken?: ts.CancellationToken): ReadonlyArray<Diagnostic>;
|
104 | getTsSemanticDiagnostics(sourceFile?: ts.SourceFile, cancellationToken?: ts.CancellationToken): ReadonlyArray<ts.Diagnostic>;
|
105 | getNgSemanticDiagnostics(fileName?: string, cancellationToken?: ts.CancellationToken): ReadonlyArray<Diagnostic>;
|
106 | loadNgStructureAsync(): Promise<void>;
|
107 | listLazyRoutes(entryRoute?: string): LazyRoute[];
|
108 | emit({emitFlags, cancellationToken, customTransformers, emitCallback}: {
|
109 | emitFlags?: EmitFlags;
|
110 | cancellationToken?: ts.CancellationToken;
|
111 | customTransformers?: CustomTransformers;
|
112 | emitCallback?: TsEmitCallback;
|
113 | }): ts.EmitResult;
|
114 | }
|
115 | export declare function createProgram({rootNames, options, host, oldProgram}: {
|
116 | rootNames: string[];
|
117 | options: CompilerOptions;
|
118 | host: CompilerHost;
|
119 | oldProgram?: Program;
|
120 | }): Program;
|
121 | export declare function createCompilerHost({options, tsHost}: {
|
122 | options: CompilerOptions;
|
123 | tsHost?: ts.CompilerHost;
|
124 | }): CompilerHost;
|
125 | export declare type Diagnostics = ReadonlyArray<ts.Diagnostic | Diagnostic>;
|
126 | export declare function formatDiagnostics(diags: Diagnostics): string;
|