Repository navigation
Expand file tree
/
Copy pathangular-compilation.ts
More file actions
74 lines (62 loc) · 1.96 KB
/
Copy pathangular-compilation.ts
File metadata and controls
74 lines (62 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import type { PartialMessage } from 'esbuild';
import type { AngularHostOptions } from '../angular-host';
import type { CompilerOptionOverrides } from './compiler-options';
export interface EmitFileResult {
filename: string;
contents: string;
dependencies?: readonly string[];
}
export interface FileTransformResult {
contents: string;
watchFiles?: readonly string[];
}
export interface AngularCompilationOptions {
allowJs?: boolean;
declarationMap?: boolean;
isolatedModules?: boolean;
sourceMap?: boolean;
inlineSourceMap?: boolean;
_useTypeScriptTranspilation?: boolean;
[key: string]: unknown;
}
export interface AngularCompilationResult {
compilerOptions: AngularCompilationOptions;
referencedFiles: readonly string[];
externalStylesheets?: ReadonlyMap<string, string>;
templateUpdates?: ReadonlyMap<string, string>;
componentResourcesDependencies?: ReadonlyMap<string, readonly string[]>;
warnings?: readonly PartialMessage[];
}
export enum DiagnosticModes {
None = 0,
Option = 1 << 0,
Syntactic = 1 << 1,
Semantic = 1 << 2,
All = Option | Syntactic | Semantic,
}
export abstract class AngularCompilation {
abstract initialize(
tsconfig: string,
hostOptions: AngularHostOptions,
compilerOptionOverrides?: CompilerOptionOverrides,
buildType?: 'application' | 'library',
): Promise<AngularCompilationResult>;
emitAffectedFiles(): Iterable<EmitFileResult> | Promise<Iterable<EmitFileResult>> {
return [];
}
transformFile?(filename: string, content: string): Promise<FileTransformResult | null>;
async diagnoseFiles(
modes?: DiagnosticModes,
): Promise<{ errors?: PartialMessage[]; warnings?: PartialMessage[] }> {
return {};
}
update?(files: Set<string>): Promise<void>;
close?(): Promise<void>;
}