-
Notifications
You must be signed in to change notification settings - Fork 24.8k
/
compiler_facade_interface.ts
314 lines (279 loc) Β· 8.6 KB
/
compiler_facade_interface.ts
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
/**
* @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.io/license
*/
/**
* A set of interfaces which are shared between `@angular/core` and `@angular/compiler` to allow
* for late binding of `@angular/compiler` for JIT purposes.
*
* This file has two copies. Please ensure that they are in sync:
* - packages/compiler/src/compiler_facade_interface.ts (main)
* - packages/core/src/compiler/compiler_facade_interface.ts (replica)
*
* Please ensure that the two files are in sync using this command:
* ```
* cp packages/compiler/src/compiler_facade_interface.ts \
* packages/core/src/compiler/compiler_facade_interface.ts
* ```
*/
export interface ExportedCompilerFacade {
Ι΅compilerFacade: CompilerFacade;
}
export interface CompilerFacade {
compilePipe(angularCoreEnv: CoreEnvironment, sourceMapUrl: string, meta: R3PipeMetadataFacade):
any;
compilePipeDeclaration(
angularCoreEnv: CoreEnvironment, sourceMapUrl: string, declaration: R3DeclarePipeFacade): any;
compileInjectable(
angularCoreEnv: CoreEnvironment, sourceMapUrl: string, meta: R3InjectableMetadataFacade): any;
compileInjectableDeclaration(
angularCoreEnv: CoreEnvironment, sourceMapUrl: string, meta: R3DeclareInjectableFacade): any;
compileInjector(
angularCoreEnv: CoreEnvironment, sourceMapUrl: string, meta: R3InjectorMetadataFacade): any;
compileInjectorDeclaration(
angularCoreEnv: CoreEnvironment, sourceMapUrl: string,
declaration: R3DeclareInjectorFacade): any;
compileNgModule(
angularCoreEnv: CoreEnvironment, sourceMapUrl: string, meta: R3NgModuleMetadataFacade): any;
compileNgModuleDeclaration(
angularCoreEnv: CoreEnvironment, sourceMapUrl: string,
declaration: R3DeclareNgModuleFacade): any;
compileDirective(
angularCoreEnv: CoreEnvironment, sourceMapUrl: string, meta: R3DirectiveMetadataFacade): any;
compileDirectiveDeclaration(
angularCoreEnv: CoreEnvironment, sourceMapUrl: string,
declaration: R3DeclareDirectiveFacade): any;
compileComponent(
angularCoreEnv: CoreEnvironment, sourceMapUrl: string, meta: R3ComponentMetadataFacade): any;
compileComponentDeclaration(
angularCoreEnv: CoreEnvironment, sourceMapUrl: string,
declaration: R3DeclareComponentFacade): any;
compileFactory(
angularCoreEnv: CoreEnvironment, sourceMapUrl: string, meta: R3FactoryDefMetadataFacade): any;
compileFactoryDeclaration(
angularCoreEnv: CoreEnvironment, sourceMapUrl: string, meta: R3DeclareFactoryFacade): any;
createParseSourceSpan(kind: string, typeName: string, sourceUrl: string): ParseSourceSpan;
FactoryTarget: typeof FactoryTarget;
// Note that we do not use `{new(): ResourceLoader}` here because
// the resource loader class is abstract and not constructable.
ResourceLoader: Function&{prototype: ResourceLoader};
}
export interface CoreEnvironment {
[name: string]: Function;
}
export type ResourceLoader = {
get(url: string): Promise<string>|string;
};
export type StringMap = {
[key: string]: string;
};
export type StringMapWithRename = {
[key: string]: string|[string, string];
};
export type Provider = unknown;
export type Type = Function;
export type OpaqueValue = unknown;
export enum FactoryTarget {
Directive = 0,
Component = 1,
Injectable = 2,
Pipe = 3,
NgModule = 4,
}
export interface R3DependencyMetadataFacade {
token: OpaqueValue;
attribute: string|null;
host: boolean;
optional: boolean;
self: boolean;
skipSelf: boolean;
}
export interface R3DeclareDependencyMetadataFacade {
token: OpaqueValue;
attribute?: boolean;
host?: boolean;
optional?: boolean;
self?: boolean;
skipSelf?: boolean;
}
export interface R3PipeMetadataFacade {
name: string;
type: Type;
pipeName: string;
pure: boolean;
}
export interface R3InjectableMetadataFacade {
name: string;
type: Type;
typeArgumentCount: number;
providedIn?: Type|'root'|'platform'|'any'|null;
useClass?: OpaqueValue;
useFactory?: OpaqueValue;
useExisting?: OpaqueValue;
useValue?: OpaqueValue;
deps?: R3DependencyMetadataFacade[];
}
export interface R3NgModuleMetadataFacade {
type: Type;
bootstrap: Function[];
declarations: Function[];
imports: Function[];
exports: Function[];
schemas: {name: string}[]|null;
id: string|null;
}
export interface R3InjectorMetadataFacade {
name: string;
type: Type;
providers: Provider[];
imports: OpaqueValue[];
}
export interface R3DirectiveMetadataFacade {
name: string;
type: Type;
typeSourceSpan: ParseSourceSpan;
selector: string|null;
queries: R3QueryMetadataFacade[];
host: {[key: string]: string};
propMetadata: {[key: string]: OpaqueValue[]};
lifecycle: {usesOnChanges: boolean;};
inputs: string[];
outputs: string[];
usesInheritance: boolean;
exportAs: string[]|null;
providers: Provider[]|null;
viewQueries: R3QueryMetadataFacade[];
}
export interface R3ComponentMetadataFacade extends R3DirectiveMetadataFacade {
template: string;
preserveWhitespaces: boolean;
animations: OpaqueValue[]|undefined;
pipes: Map<string, any>;
directives: R3UsedDirectiveMetadata[];
styles: string[];
encapsulation: ViewEncapsulation;
viewProviders: Provider[]|null;
interpolation?: [string, string];
changeDetection?: ChangeDetectionStrategy;
}
export interface R3DeclareDirectiveFacade {
selector?: string;
type: Type;
inputs?: {[classPropertyName: string]: string|[string, string]};
outputs?: {[classPropertyName: string]: string};
host?: {
attributes?: {[key: string]: OpaqueValue};
listeners?: {[key: string]: string};
properties?: {[key: string]: string};
classAttribute?: string;
styleAttribute?: string;
};
queries?: R3DeclareQueryMetadataFacade[];
viewQueries?: R3DeclareQueryMetadataFacade[];
providers?: OpaqueValue;
exportAs?: string[];
usesInheritance?: boolean;
usesOnChanges?: boolean;
}
export interface R3DeclareComponentFacade extends R3DeclareDirectiveFacade {
template: string;
isInline?: boolean;
styles?: string[];
components?: R3DeclareUsedDirectiveFacade[];
directives?: R3DeclareUsedDirectiveFacade[];
pipes?: {[pipeName: string]: OpaqueValue|(() => OpaqueValue)};
viewProviders?: OpaqueValue;
animations?: OpaqueValue;
changeDetection?: ChangeDetectionStrategy;
encapsulation?: ViewEncapsulation;
interpolation?: [string, string];
preserveWhitespaces?: boolean;
}
export interface R3DeclareUsedDirectiveFacade {
selector: string;
type: OpaqueValue|(() => OpaqueValue);
inputs?: string[];
outputs?: string[];
exportAs?: string[];
}
export interface R3UsedDirectiveMetadata {
selector: string;
inputs: string[];
outputs: string[];
exportAs: string[]|null;
type: any;
}
export interface R3FactoryDefMetadataFacade {
name: string;
type: Type;
typeArgumentCount: number;
deps: R3DependencyMetadataFacade[]|null;
target: FactoryTarget;
}
export interface R3DeclareFactoryFacade {
type: Type;
deps: R3DeclareDependencyMetadataFacade[]|'invalid'|null;
target: FactoryTarget;
}
export interface R3DeclareInjectableFacade {
type: Type;
providedIn?: Type|'root'|'platform'|'any'|null;
useClass?: OpaqueValue;
useFactory?: OpaqueValue;
useExisting?: OpaqueValue;
useValue?: OpaqueValue;
deps?: R3DeclareDependencyMetadataFacade[];
}
export enum ViewEncapsulation {
Emulated = 0,
// Historically the 1 value was for `Native` encapsulation which has been removed as of v11.
None = 2,
ShadowDom = 3
}
export type ChangeDetectionStrategy = number;
export interface R3QueryMetadataFacade {
propertyName: string;
first: boolean;
predicate: OpaqueValue|string[];
descendants: boolean;
emitDistinctChangesOnly: boolean;
read: OpaqueValue|null;
static: boolean;
}
export interface R3DeclareQueryMetadataFacade {
propertyName: string;
first?: boolean;
predicate: OpaqueValue|string[];
descendants?: boolean;
read?: OpaqueValue;
static?: boolean;
emitDistinctChangesOnly?: boolean;
}
export interface R3DeclareInjectorFacade {
type: Type;
imports?: OpaqueValue[];
providers?: OpaqueValue[];
}
export interface R3DeclareNgModuleFacade {
type: Type;
bootstrap?: OpaqueValue[]|(() => OpaqueValue[]);
declarations?: OpaqueValue[]|(() => OpaqueValue[]);
imports?: OpaqueValue[]|(() => OpaqueValue[]);
exports?: OpaqueValue[]|(() => OpaqueValue[]);
schemas?: OpaqueValue[];
id?: OpaqueValue;
}
export interface R3DeclarePipeFacade {
type: Type;
name: string;
pure?: boolean;
}
export interface ParseSourceSpan {
start: any;
end: any;
details: any;
fullStart: any;
}