@angular/compiler 14.0.0-next.13 → 14.0.0-next.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/src/compiler_facade_interface.mjs +7 -1
- package/esm2020/src/jit_compiler_facade.mjs +61 -25
- package/esm2020/src/render3/partial/api.mjs +1 -1
- package/esm2020/src/render3/partial/class_metadata.mjs +1 -1
- package/esm2020/src/render3/partial/component.mjs +27 -36
- package/esm2020/src/render3/partial/directive.mjs +5 -2
- package/esm2020/src/render3/partial/factory.mjs +1 -1
- package/esm2020/src/render3/partial/injectable.mjs +1 -1
- package/esm2020/src/render3/partial/injector.mjs +1 -1
- package/esm2020/src/render3/partial/ng_module.mjs +1 -1
- package/esm2020/src/render3/partial/pipe.mjs +5 -2
- package/esm2020/src/render3/r3_identifiers.mjs +2 -1
- package/esm2020/src/render3/r3_pipe_compiler.mjs +2 -1
- package/esm2020/src/render3/view/api.mjs +7 -2
- package/esm2020/src/render3/view/compiler.mjs +15 -15
- package/esm2020/src/render3/view/i18n/get_msg_utils.mjs +58 -5
- package/esm2020/src/render3/view/i18n/util.mjs +2 -2
- package/esm2020/src/render3/view/template.mjs +4 -4
- package/esm2020/src/version.mjs +1 -1
- package/fesm2015/compiler.mjs +183 -86
- package/fesm2015/compiler.mjs.map +1 -1
- package/fesm2015/testing.mjs +1 -1
- package/fesm2020/compiler.mjs +189 -97
- package/fesm2020/compiler.mjs.map +1 -1
- package/fesm2020/testing.mjs +1 -1
- package/package.json +2 -2
- package/src/compiler_facade_interface.d.ts +26 -11
- package/src/render3/partial/api.d.ts +25 -3
- package/src/render3/partial/component.d.ts +3 -3
- package/src/render3/r3_identifiers.d.ts +1 -0
- package/src/render3/view/api.d.ts +30 -16
- package/src/render3/view/compiler.d.ts +4 -4
- package/src/render3/view/i18n/get_msg_utils.d.ts +35 -1
- package/src/render3/view/i18n/util.d.ts +1 -1
package/fesm2020/testing.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/compiler",
|
|
3
|
-
"version": "14.0.0-next.
|
|
3
|
+
"version": "14.0.0-next.14",
|
|
4
4
|
"description": "Angular - the compiler library",
|
|
5
5
|
"author": "angular",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"tslib": "^2.3.0"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"@angular/core": "14.0.0-next.
|
|
14
|
+
"@angular/core": "14.0.0-next.14"
|
|
15
15
|
},
|
|
16
16
|
"peerDependenciesMeta": {
|
|
17
17
|
"@angular/core": {
|
|
@@ -143,8 +143,7 @@ export interface R3ComponentMetadataFacade extends R3DirectiveMetadataFacade {
|
|
|
143
143
|
template: string;
|
|
144
144
|
preserveWhitespaces: boolean;
|
|
145
145
|
animations: OpaqueValue[] | undefined;
|
|
146
|
-
|
|
147
|
-
directives: R3UsedDirectiveMetadata[];
|
|
146
|
+
declarations: R3TemplateDependencyFacade[];
|
|
148
147
|
styles: string[];
|
|
149
148
|
encapsulation: ViewEncapsulation;
|
|
150
149
|
viewProviders: Provider[] | null;
|
|
@@ -185,8 +184,9 @@ export interface R3DeclareComponentFacade extends R3DeclareDirectiveFacade {
|
|
|
185
184
|
template: string;
|
|
186
185
|
isInline?: boolean;
|
|
187
186
|
styles?: string[];
|
|
188
|
-
|
|
189
|
-
|
|
187
|
+
dependencies?: R3DeclareTemplateDependencyFacade[];
|
|
188
|
+
components?: R3DeclareDirectiveDependencyFacade[];
|
|
189
|
+
directives?: R3DeclareDirectiveDependencyFacade[];
|
|
190
190
|
pipes?: {
|
|
191
191
|
[pipeName: string]: OpaqueValue | (() => OpaqueValue);
|
|
192
192
|
};
|
|
@@ -197,19 +197,34 @@ export interface R3DeclareComponentFacade extends R3DeclareDirectiveFacade {
|
|
|
197
197
|
interpolation?: [string, string];
|
|
198
198
|
preserveWhitespaces?: boolean;
|
|
199
199
|
}
|
|
200
|
-
export
|
|
200
|
+
export declare type R3DeclareTemplateDependencyFacade = {
|
|
201
|
+
kind: string;
|
|
202
|
+
} & (R3DeclareDirectiveDependencyFacade | R3DeclarePipeDependencyFacade | R3DeclareNgModuleDependencyFacade);
|
|
203
|
+
export interface R3DeclareDirectiveDependencyFacade {
|
|
204
|
+
kind?: 'directive' | 'component';
|
|
201
205
|
selector: string;
|
|
202
206
|
type: OpaqueValue | (() => OpaqueValue);
|
|
203
207
|
inputs?: string[];
|
|
204
208
|
outputs?: string[];
|
|
205
209
|
exportAs?: string[];
|
|
206
210
|
}
|
|
207
|
-
export interface
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
211
|
+
export interface R3DeclarePipeDependencyFacade {
|
|
212
|
+
kind?: 'pipe';
|
|
213
|
+
name: string;
|
|
214
|
+
type: OpaqueValue | (() => OpaqueValue);
|
|
215
|
+
}
|
|
216
|
+
export interface R3DeclareNgModuleDependencyFacade {
|
|
217
|
+
kind: 'ngmodule';
|
|
218
|
+
type: OpaqueValue | (() => OpaqueValue);
|
|
219
|
+
}
|
|
220
|
+
export declare enum R3TemplateDependencyKind {
|
|
221
|
+
Directive = 0,
|
|
222
|
+
Pipe = 1,
|
|
223
|
+
NgModule = 2
|
|
224
|
+
}
|
|
225
|
+
export interface R3TemplateDependencyFacade {
|
|
226
|
+
kind: R3TemplateDependencyKind;
|
|
227
|
+
type: OpaqueValue | (() => OpaqueValue);
|
|
213
228
|
}
|
|
214
229
|
export interface R3FactoryDefMetadataFacade {
|
|
215
230
|
name: string;
|
|
@@ -136,14 +136,21 @@ export interface R3DeclareComponentMetadata extends R3DeclareDirectiveMetadata {
|
|
|
136
136
|
* the template to each directive specifically, if the runtime instructions
|
|
137
137
|
* support this.
|
|
138
138
|
*/
|
|
139
|
-
components?:
|
|
139
|
+
components?: R3DeclareDirectiveDependencyMetadata[];
|
|
140
140
|
/**
|
|
141
141
|
* List of directives which matched in the template, including sufficient
|
|
142
142
|
* metadata for each directive to attribute bindings and references within
|
|
143
143
|
* the template to each directive specifically, if the runtime instructions
|
|
144
144
|
* support this.
|
|
145
145
|
*/
|
|
146
|
-
directives?:
|
|
146
|
+
directives?: R3DeclareDirectiveDependencyMetadata[];
|
|
147
|
+
/**
|
|
148
|
+
* List of dependencies which matched in the template, including sufficient
|
|
149
|
+
* metadata for each directive/pipe to attribute bindings and references within
|
|
150
|
+
* the template to each directive specifically, if the runtime instructions
|
|
151
|
+
* support this.
|
|
152
|
+
*/
|
|
153
|
+
dependencies?: R3DeclareTemplateDependencyMetadata[];
|
|
147
154
|
/**
|
|
148
155
|
* A map of pipe names to an expression referencing the pipe type (possibly a forward reference
|
|
149
156
|
* wrapped in a `forwardRef` invocation) which are used in the template.
|
|
@@ -178,7 +185,9 @@ export interface R3DeclareComponentMetadata extends R3DeclareDirectiveMetadata {
|
|
|
178
185
|
*/
|
|
179
186
|
preserveWhitespaces?: boolean;
|
|
180
187
|
}
|
|
181
|
-
export
|
|
188
|
+
export declare type R3DeclareTemplateDependencyMetadata = R3DeclareDirectiveDependencyMetadata | R3DeclarePipeDependencyMetadata | R3DeclareNgModuleDependencyMetadata;
|
|
189
|
+
export interface R3DeclareDirectiveDependencyMetadata {
|
|
190
|
+
kind: 'directive' | 'component';
|
|
182
191
|
/**
|
|
183
192
|
* Selector of the directive.
|
|
184
193
|
*/
|
|
@@ -201,6 +210,19 @@ export interface R3DeclareUsedDirectiveMetadata {
|
|
|
201
210
|
*/
|
|
202
211
|
exportAs?: string[];
|
|
203
212
|
}
|
|
213
|
+
export interface R3DeclarePipeDependencyMetadata {
|
|
214
|
+
kind: 'pipe';
|
|
215
|
+
name: string;
|
|
216
|
+
/**
|
|
217
|
+
* Reference to the pipe class (possibly a forward reference wrapped in a `forwardRef`
|
|
218
|
+
* invocation).
|
|
219
|
+
*/
|
|
220
|
+
type: o.Expression | (() => o.Expression);
|
|
221
|
+
}
|
|
222
|
+
export interface R3DeclareNgModuleDependencyMetadata {
|
|
223
|
+
kind: 'ngmodule';
|
|
224
|
+
type: o.Expression | (() => o.Expression);
|
|
225
|
+
}
|
|
204
226
|
export interface R3DeclareQueryMetadata {
|
|
205
227
|
/**
|
|
206
228
|
* Name of the property on the class to update with query results.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as o from '../../output/output_ast';
|
|
2
2
|
import { R3CompiledExpression } from '../util';
|
|
3
|
-
import { R3ComponentMetadata } from '../view/api';
|
|
3
|
+
import { R3ComponentMetadata, R3TemplateDependencyMetadata } from '../view/api';
|
|
4
4
|
import { ParsedTemplate } from '../view/template';
|
|
5
5
|
import { DefinitionMap } from '../view/util';
|
|
6
6
|
import { R3DeclareComponentMetadata } from './api';
|
|
@@ -32,8 +32,8 @@ export interface DeclareComponentTemplateInfo {
|
|
|
32
32
|
/**
|
|
33
33
|
* Compile a component declaration defined by the `R3ComponentMetadata`.
|
|
34
34
|
*/
|
|
35
|
-
export declare function compileDeclareComponentFromMetadata(meta: R3ComponentMetadata
|
|
35
|
+
export declare function compileDeclareComponentFromMetadata(meta: R3ComponentMetadata<R3TemplateDependencyMetadata>, template: ParsedTemplate, additionalTemplateInfo: DeclareComponentTemplateInfo): R3CompiledExpression;
|
|
36
36
|
/**
|
|
37
37
|
* Gathers the declaration fields for a component into a `DefinitionMap`.
|
|
38
38
|
*/
|
|
39
|
-
export declare function createComponentDefinitionMap(meta: R3ComponentMetadata
|
|
39
|
+
export declare function createComponentDefinitionMap(meta: R3ComponentMetadata<R3TemplateDependencyMetadata>, template: ParsedTemplate, templateInfo: DeclareComponentTemplateInfo): DefinitionMap<R3DeclareComponentMetadata>;
|
|
@@ -168,6 +168,7 @@ export declare class Identifiers {
|
|
|
168
168
|
static NgOnChangesFeature: o.ExternalReference;
|
|
169
169
|
static InheritDefinitionFeature: o.ExternalReference;
|
|
170
170
|
static CopyDefinitionFeature: o.ExternalReference;
|
|
171
|
+
static StandaloneFeature: o.ExternalReference;
|
|
171
172
|
static ProvidersFeature: o.ExternalReference;
|
|
172
173
|
static listener: o.ExternalReference;
|
|
173
174
|
static getInheritedFactory: o.ExternalReference;
|
|
@@ -151,7 +151,7 @@ export declare const enum DeclarationListEmitMode {
|
|
|
151
151
|
/**
|
|
152
152
|
* Information needed to compile a component for the render3 runtime.
|
|
153
153
|
*/
|
|
154
|
-
export interface R3ComponentMetadata extends R3DirectiveMetadata {
|
|
154
|
+
export interface R3ComponentMetadata<DeclarationT extends R3TemplateDependency> extends R3DirectiveMetadata {
|
|
155
155
|
/**
|
|
156
156
|
* Information about the component's template.
|
|
157
157
|
*/
|
|
@@ -166,16 +166,7 @@ export interface R3ComponentMetadata extends R3DirectiveMetadata {
|
|
|
166
166
|
*/
|
|
167
167
|
ngContentSelectors: string[];
|
|
168
168
|
};
|
|
169
|
-
|
|
170
|
-
* A map of pipe names to an expression referencing the pipe type which are in the scope of the
|
|
171
|
-
* compilation.
|
|
172
|
-
*/
|
|
173
|
-
pipes: Map<string, o.Expression>;
|
|
174
|
-
/**
|
|
175
|
-
* A list of directive selectors and an expression referencing the directive type which are in the
|
|
176
|
-
* scope of the compilation.
|
|
177
|
-
*/
|
|
178
|
-
directives: R3UsedDirectiveMetadata[];
|
|
169
|
+
declarations: DeclarationT[];
|
|
179
170
|
/**
|
|
180
171
|
* Specifies how the 'directives' and/or `pipes` array, if generated, need to be emitted.
|
|
181
172
|
*/
|
|
@@ -221,15 +212,31 @@ export interface R3ComponentMetadata extends R3DirectiveMetadata {
|
|
|
221
212
|
*/
|
|
222
213
|
changeDetection?: ChangeDetectionStrategy;
|
|
223
214
|
}
|
|
215
|
+
export declare enum R3TemplateDependencyKind {
|
|
216
|
+
Directive = 0,
|
|
217
|
+
Pipe = 1,
|
|
218
|
+
NgModule = 2
|
|
219
|
+
}
|
|
224
220
|
/**
|
|
225
|
-
*
|
|
226
|
-
* facing information of the directive is stored here.
|
|
221
|
+
* A dependency that's used within a component template.
|
|
227
222
|
*/
|
|
228
|
-
export interface
|
|
223
|
+
export interface R3TemplateDependency {
|
|
224
|
+
kind: R3TemplateDependencyKind;
|
|
229
225
|
/**
|
|
230
|
-
* The type of the
|
|
226
|
+
* The type of the dependency as an expression.
|
|
231
227
|
*/
|
|
232
228
|
type: o.Expression;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* A dependency that's used within a component template
|
|
232
|
+
*/
|
|
233
|
+
export declare type R3TemplateDependencyMetadata = R3DirectiveDependencyMetadata | R3PipeDependencyMetadata | R3NgModuleDependencyMetadata;
|
|
234
|
+
/**
|
|
235
|
+
* Information about a directive that is used in a component template. Only the stable, public
|
|
236
|
+
* facing information of the directive is stored here.
|
|
237
|
+
*/
|
|
238
|
+
export interface R3DirectiveDependencyMetadata extends R3TemplateDependency {
|
|
239
|
+
kind: R3TemplateDependencyKind.Directive;
|
|
233
240
|
/**
|
|
234
241
|
* The selector of the directive.
|
|
235
242
|
*/
|
|
@@ -249,7 +256,14 @@ export interface R3UsedDirectiveMetadata {
|
|
|
249
256
|
/**
|
|
250
257
|
* If true then this directive is actually a component; otherwise it is not.
|
|
251
258
|
*/
|
|
252
|
-
isComponent
|
|
259
|
+
isComponent: boolean;
|
|
260
|
+
}
|
|
261
|
+
export interface R3PipeDependencyMetadata extends R3TemplateDependency {
|
|
262
|
+
kind: R3TemplateDependencyKind.Pipe;
|
|
263
|
+
name: string;
|
|
264
|
+
}
|
|
265
|
+
export interface R3NgModuleDependencyMetadata extends R3TemplateDependency {
|
|
266
|
+
kind: R3TemplateDependencyKind.NgModule;
|
|
253
267
|
}
|
|
254
268
|
/**
|
|
255
269
|
* Information needed to compile a query (view or content).
|
|
@@ -10,7 +10,7 @@ import * as o from '../../output/output_ast';
|
|
|
10
10
|
import { ParseError, ParseSourceSpan } from '../../parse_util';
|
|
11
11
|
import { BindingParser } from '../../template_parser/binding_parser';
|
|
12
12
|
import { R3CompiledExpression } from '../util';
|
|
13
|
-
import { R3ComponentMetadata, R3DirectiveMetadata } from './api';
|
|
13
|
+
import { R3ComponentMetadata, R3DirectiveMetadata, R3TemplateDependency } from './api';
|
|
14
14
|
/**
|
|
15
15
|
* Compile a directive for the render3 runtime as defined by the `R3DirectiveMetadata`.
|
|
16
16
|
*/
|
|
@@ -18,12 +18,12 @@ export declare function compileDirectiveFromMetadata(meta: R3DirectiveMetadata,
|
|
|
18
18
|
/**
|
|
19
19
|
* Compile a component for the render3 runtime as defined by the `R3ComponentMetadata`.
|
|
20
20
|
*/
|
|
21
|
-
export declare function compileComponentFromMetadata(meta: R3ComponentMetadata
|
|
21
|
+
export declare function compileComponentFromMetadata(meta: R3ComponentMetadata<R3TemplateDependency>, constantPool: ConstantPool, bindingParser: BindingParser): R3CompiledExpression;
|
|
22
22
|
/**
|
|
23
23
|
* Creates the type specification from the component meta. This type is inserted into .d.ts files
|
|
24
24
|
* to be consumed by upstream compilations.
|
|
25
25
|
*/
|
|
26
|
-
export declare function createComponentType(meta: R3ComponentMetadata): o.Type;
|
|
26
|
+
export declare function createComponentType(meta: R3ComponentMetadata<R3TemplateDependency>): o.Type;
|
|
27
27
|
/**
|
|
28
28
|
* A set of flags to be used with Queries.
|
|
29
29
|
*
|
|
@@ -51,7 +51,7 @@ export declare const enum QueryFlags {
|
|
|
51
51
|
*/
|
|
52
52
|
emitDistinctChangesOnly = 4
|
|
53
53
|
}
|
|
54
|
-
export declare function
|
|
54
|
+
export declare function createBaseDirectiveTypeParams(meta: R3DirectiveMetadata): o.Type[];
|
|
55
55
|
/**
|
|
56
56
|
* Creates the type specification from the directive meta. This type is inserted into .d.ts files
|
|
57
57
|
* to be consumed by upstream compilations.
|
|
@@ -7,7 +7,41 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as i18n from '../../../i18n/i18n_ast';
|
|
9
9
|
import * as o from '../../../output/output_ast';
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Generates a `goog.getMsg()` statement and reassignment. The template:
|
|
12
|
+
*
|
|
13
|
+
* ```html
|
|
14
|
+
* <div i18n>Sent from {{ sender }} to <span class="receiver">{{ receiver }}</span></div>
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* Generates:
|
|
18
|
+
*
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const MSG_FOO = goog.getMsg(
|
|
21
|
+
* // Message template.
|
|
22
|
+
* 'Sent from {$interpolation} to {$startTagSpan}{$interpolation_1}{$closeTagSpan}.',
|
|
23
|
+
* // Placeholder values, set to magic strings which get replaced by the Angular runtime.
|
|
24
|
+
* {
|
|
25
|
+
* 'interpolation': '\uFFFD0\uFFFD',
|
|
26
|
+
* 'startTagSpan': '\uFFFD1\uFFFD',
|
|
27
|
+
* 'interpolation_1': '\uFFFD2\uFFFD',
|
|
28
|
+
* 'closeTagSpan': '\uFFFD3\uFFFD',
|
|
29
|
+
* },
|
|
30
|
+
* // Options bag.
|
|
31
|
+
* {
|
|
32
|
+
* // Maps each placeholder to the original Angular source code which generates it's value.
|
|
33
|
+
* original_code: {
|
|
34
|
+
* 'interpolation': '{{ sender }}',
|
|
35
|
+
* 'startTagSpan': '<span class="receiver">',
|
|
36
|
+
* 'interploation_1': '{{ receiver }}',
|
|
37
|
+
* 'closeTagSpan': '</span>',
|
|
38
|
+
* },
|
|
39
|
+
* },
|
|
40
|
+
* );
|
|
41
|
+
* const I18N_0 = MSG_FOO;
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function createGoogleGetMsgStatements(variable: o.ReadVarExpr, message: i18n.Message, closureVar: o.ReadVarExpr, placeholderValues: {
|
|
11
45
|
[name: string]: o.Expression;
|
|
12
46
|
}): o.Statement[];
|
|
13
47
|
export declare function serializeI18nMessageForGetMsg(message: i18n.Message): string;
|
|
@@ -50,7 +50,7 @@ export declare function assembleBoundTextPlaceholders(meta: i18n.I18nMeta, bindi
|
|
|
50
50
|
* @param useCamelCase whether to camelCase the placeholder name when formatting.
|
|
51
51
|
* @returns A new map of formatted placeholder names to expressions.
|
|
52
52
|
*/
|
|
53
|
-
export declare function
|
|
53
|
+
export declare function formatI18nPlaceholderNamesInMap(params: {
|
|
54
54
|
[name: string]: o.Expression;
|
|
55
55
|
} | undefined, useCamelCase: boolean): {
|
|
56
56
|
[key: string]: o.Expression;
|