@angular/compiler 14.0.0-next.7 → 14.0.0-rc.0

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.
Files changed (151) hide show
  1. package/esm2020/src/compiler.mjs +4 -3
  2. package/esm2020/src/compiler_facade_interface.mjs +7 -1
  3. package/esm2020/src/core.mjs +6 -6
  4. package/esm2020/src/expression_parser/parser.mjs +12 -12
  5. package/esm2020/src/i18n/i18n_parser.mjs +3 -3
  6. package/esm2020/src/jit_compiler_facade.mjs +76 -44
  7. package/esm2020/src/ml_parser/html_whitespaces.mjs +2 -2
  8. package/esm2020/src/ml_parser/lexer.mjs +37 -37
  9. package/esm2020/src/ml_parser/parser.mjs +41 -41
  10. package/esm2020/src/parse_util.mjs +2 -2
  11. package/esm2020/src/render3/partial/api.mjs +1 -1
  12. package/esm2020/src/render3/partial/class_metadata.mjs +1 -1
  13. package/esm2020/src/render3/partial/component.mjs +28 -37
  14. package/esm2020/src/render3/partial/directive.mjs +6 -3
  15. package/esm2020/src/render3/partial/factory.mjs +1 -1
  16. package/esm2020/src/render3/partial/injectable.mjs +1 -1
  17. package/esm2020/src/render3/partial/injector.mjs +1 -1
  18. package/esm2020/src/render3/partial/ng_module.mjs +3 -3
  19. package/esm2020/src/render3/partial/pipe.mjs +6 -3
  20. package/esm2020/src/render3/r3_ast.mjs +3 -3
  21. package/esm2020/src/render3/r3_factory.mjs +6 -6
  22. package/esm2020/src/render3/r3_identifiers.mjs +4 -1
  23. package/esm2020/src/render3/r3_module_compiler.mjs +45 -8
  24. package/esm2020/src/render3/r3_pipe_compiler.mjs +5 -1
  25. package/esm2020/src/render3/util.mjs +4 -4
  26. package/esm2020/src/render3/view/api.mjs +7 -2
  27. package/esm2020/src/render3/view/compiler.mjs +45 -35
  28. package/esm2020/src/render3/view/i18n/get_msg_utils.mjs +58 -5
  29. package/esm2020/src/render3/view/i18n/meta.mjs +4 -4
  30. package/esm2020/src/render3/view/i18n/util.mjs +2 -2
  31. package/esm2020/src/render3/view/style_parser.mjs +20 -20
  32. package/esm2020/src/render3/view/styling_builder.mjs +8 -8
  33. package/esm2020/src/render3/view/template.mjs +45 -32
  34. package/esm2020/src/render3/view/util.mjs +14 -5
  35. package/esm2020/src/selector.mjs +10 -10
  36. package/esm2020/src/shadow_css.mjs +2 -2
  37. package/esm2020/src/template_parser/binding_parser.mjs +9 -9
  38. package/esm2020/src/util.mjs +8 -8
  39. package/esm2020/src/version.mjs +1 -1
  40. package/fesm2015/compiler.mjs +492 -325
  41. package/fesm2015/compiler.mjs.map +1 -1
  42. package/fesm2015/testing.mjs +1 -1
  43. package/fesm2020/compiler.mjs +500 -338
  44. package/fesm2020/compiler.mjs.map +1 -1
  45. package/fesm2020/testing.mjs +1 -1
  46. package/index.d.ts +4964 -5
  47. package/package.json +3 -3
  48. package/testing/index.d.ts +22 -5
  49. package/compiler.d.ts +0 -8
  50. package/public_api.d.ts +0 -13
  51. package/src/assertions.d.ts +0 -8
  52. package/src/chars.d.ts +0 -75
  53. package/src/compiler.d.ts +0 -77
  54. package/src/compiler_facade_interface.d.ts +0 -284
  55. package/src/compiler_util/expression_converter.d.ts +0 -71
  56. package/src/config.d.ts +0 -25
  57. package/src/constant_pool.d.ts +0 -37
  58. package/src/core.d.ts +0 -216
  59. package/src/expression_parser/ast.d.ts +0 -440
  60. package/src/expression_parser/lexer.d.ts +0 -47
  61. package/src/expression_parser/parser.d.ts +0 -315
  62. package/src/i18n/big_integer.d.ts +0 -108
  63. package/src/i18n/digest.d.ts +0 -44
  64. package/src/i18n/extractor_merger.d.ts +0 -27
  65. package/src/i18n/i18n_ast.d.ts +0 -148
  66. package/src/i18n/i18n_html_parser.d.ts +0 -19
  67. package/src/i18n/i18n_parser.d.ts +0 -18
  68. package/src/i18n/index.d.ts +0 -15
  69. package/src/i18n/message_bundle.d.ts +0 -28
  70. package/src/i18n/parse_util.d.ts +0 -14
  71. package/src/i18n/serializers/placeholder.d.ts +0 -25
  72. package/src/i18n/serializers/serializer.d.ts +0 -46
  73. package/src/i18n/serializers/xliff.d.ts +0 -19
  74. package/src/i18n/serializers/xliff2.d.ts +0 -19
  75. package/src/i18n/serializers/xmb.d.ts +0 -22
  76. package/src/i18n/serializers/xml_helper.d.ts +0 -52
  77. package/src/i18n/serializers/xtb.d.ts +0 -20
  78. package/src/i18n/translation_bundle.d.ts +0 -27
  79. package/src/injectable_compiler_2.d.ts +0 -24
  80. package/src/jit_compiler_facade.d.ts +0 -46
  81. package/src/ml_parser/ast.d.ts +0 -89
  82. package/src/ml_parser/entities.d.ts +0 -9
  83. package/src/ml_parser/html_parser.d.ts +0 -13
  84. package/src/ml_parser/html_tags.d.ts +0 -33
  85. package/src/ml_parser/html_whitespaces.d.ts +0 -45
  86. package/src/ml_parser/icu_ast_expander.d.ts +0 -42
  87. package/src/ml_parser/interpolation_config.d.ts +0 -14
  88. package/src/ml_parser/lexer.d.ts +0 -114
  89. package/src/ml_parser/parser.d.ts +0 -26
  90. package/src/ml_parser/tags.d.ts +0 -29
  91. package/src/ml_parser/tokens.d.ts +0 -141
  92. package/src/ml_parser/xml_parser.d.ts +0 -13
  93. package/src/ml_parser/xml_tags.d.ts +0 -24
  94. package/src/output/abstract_emitter.d.ts +0 -66
  95. package/src/output/abstract_js_emitter.d.ts +0 -19
  96. package/src/output/map_util.d.ts +0 -18
  97. package/src/output/output_ast.d.ts +0 -575
  98. package/src/output/output_jit.d.ts +0 -73
  99. package/src/output/output_jit_trusted_types.d.ts +0 -43
  100. package/src/output/source_map.d.ts +0 -29
  101. package/src/parse_util.d.ts +0 -75
  102. package/src/render3/partial/api.d.ts +0 -441
  103. package/src/render3/partial/class_metadata.d.ts +0 -10
  104. package/src/render3/partial/component.d.ts +0 -39
  105. package/src/render3/partial/directive.d.ts +0 -13
  106. package/src/render3/partial/factory.d.ts +0 -3
  107. package/src/render3/partial/injectable.d.ts +0 -19
  108. package/src/render3/partial/injector.d.ts +0 -3
  109. package/src/render3/partial/ng_module.d.ts +0 -3
  110. package/src/render3/partial/pipe.d.ts +0 -12
  111. package/src/render3/partial/util.d.ts +0 -33
  112. package/src/render3/r3_ast.d.ts +0 -211
  113. package/src/render3/r3_class_metadata_compiler.d.ts +0 -35
  114. package/src/render3/r3_factory.d.ts +0 -94
  115. package/src/render3/r3_identifiers.d.ts +0 -180
  116. package/src/render3/r3_injector_compiler.d.ts +0 -18
  117. package/src/render3/r3_jit.d.ts +0 -22
  118. package/src/render3/r3_module_compiler.d.ts +0 -77
  119. package/src/render3/r3_pipe_compiler.d.ts +0 -50
  120. package/src/render3/r3_template_transform.d.ts +0 -24
  121. package/src/render3/util.d.ts +0 -94
  122. package/src/render3/view/api.d.ts +0 -328
  123. package/src/render3/view/compiler.d.ts +0 -86
  124. package/src/render3/view/i18n/context.d.ts +0 -68
  125. package/src/render3/view/i18n/get_msg_utils.d.ts +0 -13
  126. package/src/render3/view/i18n/icu_serializer.d.ts +0 -9
  127. package/src/render3/view/i18n/localize_utils.d.ts +0 -24
  128. package/src/render3/view/i18n/meta.d.ts +0 -78
  129. package/src/render3/view/i18n/util.d.ts +0 -78
  130. package/src/render3/view/style_parser.d.ts +0 -18
  131. package/src/render3/view/styling_builder.d.ts +0 -211
  132. package/src/render3/view/t2_api.d.ts +0 -152
  133. package/src/render3/view/t2_binder.d.ts +0 -57
  134. package/src/render3/view/template.d.ts +0 -450
  135. package/src/render3/view/util.d.ts +0 -94
  136. package/src/resource_loader.d.ts +0 -17
  137. package/src/schema/dom_element_schema_registry.d.ts +0 -45
  138. package/src/schema/dom_security_schema.d.ts +0 -11
  139. package/src/schema/element_schema_registry.d.ts +0 -29
  140. package/src/schema/trusted_types_sinks.d.ts +0 -15
  141. package/src/selector.d.ts +0 -105
  142. package/src/shadow_css.d.ts +0 -76
  143. package/src/style_url_resolver.d.ts +0 -8
  144. package/src/template_parser/binding_parser.d.ts +0 -91
  145. package/src/template_parser/template_preparser.d.ts +0 -24
  146. package/src/util.d.ts +0 -42
  147. package/src/version.d.ts +0 -14
  148. package/testing/package.json +0 -9
  149. package/testing/public_api.d.ts +0 -13
  150. package/testing/src/testing.d.ts +0 -23
  151. package/testing/testing.d.ts +0 -4
@@ -1,450 +0,0 @@
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.io/license
7
- */
8
- import { LocalResolver } from '../../compiler_util/expression_converter';
9
- import { ConstantPool } from '../../constant_pool';
10
- import * as core from '../../core';
11
- import { AST, AstMemoryEfficientTransformer, BindingPipe, LiteralArray, LiteralMap } from '../../expression_parser/ast';
12
- import * as i18n from '../../i18n/i18n_ast';
13
- import { InterpolationConfig } from '../../ml_parser/interpolation_config';
14
- import { LexerRange } from '../../ml_parser/lexer';
15
- import * as o from '../../output/output_ast';
16
- import { ParseError } from '../../parse_util';
17
- import { CssSelector } from '../../selector';
18
- import { BindingParser } from '../../template_parser/binding_parser';
19
- import * as t from '../r3_ast';
20
- import { I18nContext } from './i18n/context';
21
- import { invalid } from './util';
22
- export declare const LEADING_TRIVIA_CHARS: string[];
23
- export declare function renderFlagCheckIfStmt(flags: core.RenderFlags, statements: o.Statement[]): o.IfStmt;
24
- export declare function prepareEventListenerParameters(eventAst: t.BoundEvent, handlerName?: string | null, scope?: BindingScope | null): o.Expression[];
25
- export interface ComponentDefConsts {
26
- /**
27
- * When a constant requires some pre-processing (e.g. i18n translation block that includes
28
- * goog.getMsg and $localize calls), the `prepareStatements` section contains corresponding
29
- * statements.
30
- */
31
- prepareStatements: o.Statement[];
32
- /**
33
- * Actual expressions that represent constants.
34
- */
35
- constExpressions: o.Expression[];
36
- /**
37
- * Cache to avoid generating duplicated i18n translation blocks.
38
- */
39
- i18nVarRefsCache: Map<i18n.I18nMeta, o.ReadVarExpr>;
40
- }
41
- export declare class TemplateDefinitionBuilder implements t.Visitor<void>, LocalResolver {
42
- private constantPool;
43
- private level;
44
- private contextName;
45
- private i18nContext;
46
- private templateIndex;
47
- private templateName;
48
- private _namespace;
49
- private i18nUseExternalIds;
50
- private _constants;
51
- private _dataIndex;
52
- private _bindingContext;
53
- private _prefixCode;
54
- /**
55
- * List of callbacks to generate creation mode instructions. We store them here as we process
56
- * the template so bindings in listeners are resolved only once all nodes have been visited.
57
- * This ensures all local refs and context variables are available for matching.
58
- */
59
- private _creationCodeFns;
60
- /**
61
- * List of callbacks to generate update mode instructions. We store them here as we process
62
- * the template so bindings are resolved only once all nodes have been visited. This ensures
63
- * all local refs and context variables are available for matching.
64
- */
65
- private _updateCodeFns;
66
- /** Index of the currently-selected node. */
67
- private _currentIndex;
68
- /** Temporary variable declarations generated from visiting pipes, literals, etc. */
69
- private _tempVariables;
70
- /**
71
- * List of callbacks to build nested templates. Nested templates must not be visited until
72
- * after the parent template has finished visiting all of its nodes. This ensures that all
73
- * local ref bindings in nested templates are able to find local ref values if the refs
74
- * are defined after the template declaration.
75
- */
76
- private _nestedTemplateFns;
77
- /**
78
- * This scope contains local variables declared in the update mode block of the template.
79
- * (e.g. refs and context vars in bindings)
80
- */
81
- private _bindingScope;
82
- private _valueConverter;
83
- private i18n;
84
- private _pureFunctionSlots;
85
- private _bindingSlots;
86
- private fileBasedI18nSuffix;
87
- private _ngContentReservedSlots;
88
- private _ngContentSelectorsOffset;
89
- private _implicitReceiverExpr;
90
- constructor(constantPool: ConstantPool, parentBindingScope: BindingScope, level: number, contextName: string | null, i18nContext: I18nContext | null, templateIndex: number | null, templateName: string | null, _namespace: o.ExternalReference, relativeContextFilePath: string, i18nUseExternalIds: boolean, _constants?: ComponentDefConsts);
91
- buildTemplateFunction(nodes: t.Node[], variables: t.Variable[], ngContentSelectorsOffset?: number, i18n?: i18n.I18nMeta): o.FunctionExpr;
92
- getLocal(name: string): o.Expression | null;
93
- notifyImplicitReceiverUse(): void;
94
- maybeRestoreView(): void;
95
- private i18nTranslate;
96
- private registerContextVariables;
97
- private i18nAppendBindings;
98
- private i18nBindProps;
99
- private i18nGenerateMainBlockVar;
100
- private i18nGenerateClosureVar;
101
- private i18nUpdateRef;
102
- private i18nStart;
103
- private i18nEnd;
104
- private i18nAttributesInstruction;
105
- private getNamespaceInstruction;
106
- private addNamespaceInstruction;
107
- /**
108
- * Adds an update instruction for an interpolated property or attribute, such as
109
- * `prop="{{value}}"` or `attr.title="{{value}}"`
110
- */
111
- private interpolatedUpdateInstruction;
112
- visitContent(ngContent: t.Content): void;
113
- visitElement(element: t.Element): void;
114
- visitTemplate(template: t.Template): void;
115
- readonly visitReference: typeof invalid;
116
- readonly visitVariable: typeof invalid;
117
- readonly visitTextAttribute: typeof invalid;
118
- readonly visitBoundAttribute: typeof invalid;
119
- readonly visitBoundEvent: typeof invalid;
120
- visitBoundText(text: t.BoundText): void;
121
- visitText(text: t.Text): void;
122
- visitIcu(icu: t.Icu): null;
123
- private allocateDataSlot;
124
- getConstCount(): number;
125
- getVarCount(): number;
126
- getConsts(): ComponentDefConsts;
127
- getNgContentSelectors(): o.Expression | null;
128
- private bindingContext;
129
- private templatePropertyBindings;
130
- private instructionFn;
131
- private processStylingUpdateInstruction;
132
- private creationInstruction;
133
- private updateInstructionWithAdvance;
134
- private updateInstruction;
135
- private addAdvanceInstructionIfNecessary;
136
- private allocatePureFunctionSlots;
137
- private allocateBindingSlots;
138
- /**
139
- * Gets an expression that refers to the implicit receiver. The implicit
140
- * receiver is always the root level context.
141
- */
142
- private getImplicitReceiverExpr;
143
- private convertPropertyBinding;
144
- /**
145
- * Gets a list of argument expressions to pass to an update instruction expression. Also updates
146
- * the temp variables state with temp variables that were identified as needing to be created
147
- * while visiting the arguments.
148
- * @param value The original expression we will be resolving an arguments list from.
149
- */
150
- private getUpdateInstructionArguments;
151
- /**
152
- * Prepares all attribute expression values for the `TAttributes` array.
153
- *
154
- * The purpose of this function is to properly construct an attributes array that
155
- * is passed into the `elementStart` (or just `element`) functions. Because there
156
- * are many different types of attributes, the array needs to be constructed in a
157
- * special way so that `elementStart` can properly evaluate them.
158
- *
159
- * The format looks like this:
160
- *
161
- * ```
162
- * attrs = [prop, value, prop2, value2,
163
- * PROJECT_AS, selector,
164
- * CLASSES, class1, class2,
165
- * STYLES, style1, value1, style2, value2,
166
- * BINDINGS, name1, name2, name3,
167
- * TEMPLATE, name4, name5, name6,
168
- * I18N, name7, name8, ...]
169
- * ```
170
- *
171
- * Note that this function will fully ignore all synthetic (@foo) attribute values
172
- * because those values are intended to always be generated as property instructions.
173
- */
174
- private getAttributeExpressions;
175
- private addToConsts;
176
- private addAttrsToConsts;
177
- private prepareRefsArray;
178
- private prepareListenerParameter;
179
- }
180
- export declare class ValueConverter extends AstMemoryEfficientTransformer {
181
- private constantPool;
182
- private allocateSlot;
183
- private allocatePureFunctionSlots;
184
- private definePipe;
185
- private _pipeBindExprs;
186
- constructor(constantPool: ConstantPool, allocateSlot: () => number, allocatePureFunctionSlots: (numSlots: number) => number, definePipe: (name: string, localName: string, slot: number, value: o.Expression) => void);
187
- visitPipe(pipe: BindingPipe, context: any): AST;
188
- updatePipeSlotOffsets(bindingSlots: number): void;
189
- visitLiteralArray(array: LiteralArray, context: any): AST;
190
- visitLiteralMap(map: LiteralMap, context: any): AST;
191
- }
192
- /**
193
- * Function which is executed whenever a variable is referenced for the first time in a given
194
- * scope.
195
- *
196
- * It is expected that the function creates the `const localName = expression`; statement.
197
- */
198
- export declare type DeclareLocalVarCallback = (scope: BindingScope, relativeLevel: number) => o.Statement[];
199
- /**
200
- * This is used when one refers to variable such as: 'let abc = nextContext(2).$implicit`.
201
- * - key to the map is the string literal `"abc"`.
202
- * - value `retrievalLevel` is the level from which this value can be retrieved, which is 2 levels
203
- * up in example.
204
- * - value `lhs` is the left hand side which is an AST representing `abc`.
205
- * - value `declareLocalCallback` is a callback that is invoked when declaring the local.
206
- * - value `declare` is true if this value needs to be declared.
207
- * - value `localRef` is true if we are storing a local reference
208
- * - value `priority` dictates the sorting priority of this var declaration compared
209
- * to other var declarations on the same retrieval level. For example, if there is a
210
- * context variable and a local ref accessing the same parent view, the context var
211
- * declaration should always come before the local ref declaration.
212
- */
213
- declare type BindingData = {
214
- retrievalLevel: number;
215
- lhs: o.Expression;
216
- declareLocalCallback?: DeclareLocalVarCallback;
217
- declare: boolean;
218
- priority: number;
219
- };
220
- export declare class BindingScope implements LocalResolver {
221
- bindingLevel: number;
222
- private parent;
223
- globals?: Set<string> | undefined;
224
- /** Keeps a map from local variables to their BindingData. */
225
- private map;
226
- private referenceNameIndex;
227
- private restoreViewVariable;
228
- private usesRestoredViewContext;
229
- static createRootScope(): BindingScope;
230
- private constructor();
231
- get(name: string): o.Expression | null;
232
- /**
233
- * Create a local variable for later reference.
234
- *
235
- * @param retrievalLevel The level from which this value can be retrieved
236
- * @param name Name of the variable.
237
- * @param lhs AST representing the left hand side of the `let lhs = rhs;`.
238
- * @param priority The sorting priority of this var
239
- * @param declareLocalCallback The callback to invoke when declaring this local var
240
- * @param localRef Whether or not this is a local ref
241
- */
242
- set(retrievalLevel: number, name: string, lhs: o.Expression, priority?: number, declareLocalCallback?: DeclareLocalVarCallback, localRef?: true): BindingScope;
243
- getLocal(name: string): (o.Expression | null);
244
- notifyImplicitReceiverUse(): void;
245
- nestedScope(level: number, globals?: Set<string>): BindingScope;
246
- /**
247
- * Gets or creates a shared context variable and returns its expression. Note that
248
- * this does not mean that the shared variable will be declared. Variables in the
249
- * binding scope will be only declared if they are used.
250
- */
251
- getOrCreateSharedContextVar(retrievalLevel: number): o.ReadVarExpr;
252
- getSharedContextName(retrievalLevel: number): o.ReadVarExpr | null;
253
- maybeGenerateSharedContextVar(value: BindingData): void;
254
- generateSharedContextVar(retrievalLevel: number): void;
255
- getComponentProperty(name: string): o.Expression;
256
- maybeRestoreView(): void;
257
- restoreViewStatement(): o.Statement[];
258
- viewSnapshotStatements(): o.Statement[];
259
- isListenerScope(): boolean | null;
260
- variableDeclarations(): o.Statement[];
261
- freshReferenceName(): string;
262
- hasRestoreViewVariable(): boolean;
263
- notifyRestoredViewContextUse(): void;
264
- }
265
- /**
266
- * Creates a `CssSelector` given a tag name and a map of attributes
267
- */
268
- export declare function createCssSelector(elementName: string, attributes: {
269
- [name: string]: string;
270
- }): CssSelector;
271
- /**
272
- * Options that can be used to modify how a template is parsed by `parseTemplate()`.
273
- */
274
- export interface ParseTemplateOptions {
275
- /**
276
- * Include whitespace nodes in the parsed output.
277
- */
278
- preserveWhitespaces?: boolean;
279
- /**
280
- * Preserve original line endings instead of normalizing '\r\n' endings to '\n'.
281
- */
282
- preserveLineEndings?: boolean;
283
- /**
284
- * How to parse interpolation markers.
285
- */
286
- interpolationConfig?: InterpolationConfig;
287
- /**
288
- * The start and end point of the text to parse within the `source` string.
289
- * The entire `source` string is parsed if this is not provided.
290
- * */
291
- range?: LexerRange;
292
- /**
293
- * If this text is stored in a JavaScript string, then we have to deal with escape sequences.
294
- *
295
- * **Example 1:**
296
- *
297
- * ```
298
- * "abc\"def\nghi"
299
- * ```
300
- *
301
- * - The `\"` must be converted to `"`.
302
- * - The `\n` must be converted to a new line character in a token,
303
- * but it should not increment the current line for source mapping.
304
- *
305
- * **Example 2:**
306
- *
307
- * ```
308
- * "abc\
309
- * def"
310
- * ```
311
- *
312
- * The line continuation (`\` followed by a newline) should be removed from a token
313
- * but the new line should increment the current line for source mapping.
314
- */
315
- escapedString?: boolean;
316
- /**
317
- * An array of characters that should be considered as leading trivia.
318
- * Leading trivia are characters that are not important to the developer, and so should not be
319
- * included in source-map segments. A common example is whitespace.
320
- */
321
- leadingTriviaChars?: string[];
322
- /**
323
- * Render `$localize` message ids with additional legacy message ids.
324
- *
325
- * This option defaults to `true` but in the future the defaul will be flipped.
326
- *
327
- * For now set this option to false if you have migrated the translation files to use the new
328
- * `$localize` message id format and you are not using compile time translation merging.
329
- */
330
- enableI18nLegacyMessageIdFormat?: boolean;
331
- /**
332
- * If this text is stored in an external template (e.g. via `templateUrl`) then we need to decide
333
- * whether or not to normalize the line-endings (from `\r\n` to `\n`) when processing ICU
334
- * expressions.
335
- *
336
- * If `true` then we will normalize ICU expression line endings.
337
- * The default is `false`, but this will be switched in a future major release.
338
- */
339
- i18nNormalizeLineEndingsInICUs?: boolean;
340
- /**
341
- * Whether to always attempt to convert the parsed HTML AST to an R3 AST, despite HTML or i18n
342
- * Meta parse errors.
343
- *
344
- *
345
- * This option is useful in the context of the language service, where we want to get as much
346
- * information as possible, despite any errors in the HTML. As an example, a user may be adding
347
- * a new tag and expecting autocomplete on that tag. In this scenario, the HTML is in an errored
348
- * state, as there is an incomplete open tag. However, we're still able to convert the HTML AST
349
- * nodes to R3 AST nodes in order to provide information for the language service.
350
- *
351
- * Note that even when `true` the HTML parse and i18n errors are still appended to the errors
352
- * output, but this is done after converting the HTML AST to R3 AST.
353
- */
354
- alwaysAttemptHtmlToR3AstConversion?: boolean;
355
- /**
356
- * Include HTML Comment nodes in a top-level comments array on the returned R3 AST.
357
- *
358
- * This option is required by tooling that needs to know the location of comment nodes within the
359
- * AST. A concrete example is @angular-eslint which requires this in order to enable
360
- * "eslint-disable" comments within HTML templates, which then allows users to turn off specific
361
- * rules on a case by case basis, instead of for their whole project within a configuration file.
362
- */
363
- collectCommentNodes?: boolean;
364
- }
365
- /**
366
- * Parse a template into render3 `Node`s and additional metadata, with no other dependencies.
367
- *
368
- * @param template text of the template to parse
369
- * @param templateUrl URL to use for source mapping of the parsed template
370
- * @param options options to modify how the template is parsed
371
- */
372
- export declare function parseTemplate(template: string, templateUrl: string, options?: ParseTemplateOptions): ParsedTemplate;
373
- /**
374
- * Construct a `BindingParser` with a default configuration.
375
- */
376
- export declare function makeBindingParser(interpolationConfig?: InterpolationConfig): BindingParser;
377
- export declare function resolveSanitizationFn(context: core.SecurityContext, isAttribute?: boolean): o.ExternalExpr | null;
378
- /**
379
- * Generate statements that define a given translation message.
380
- *
381
- * ```
382
- * var I18N_1;
383
- * if (typeof ngI18nClosureMode !== undefined && ngI18nClosureMode) {
384
- * var MSG_EXTERNAL_XXX = goog.getMsg(
385
- * "Some message with {$interpolation}!",
386
- * { "interpolation": "\uFFFD0\uFFFD" }
387
- * );
388
- * I18N_1 = MSG_EXTERNAL_XXX;
389
- * }
390
- * else {
391
- * I18N_1 = $localize`Some message with ${'\uFFFD0\uFFFD'}!`;
392
- * }
393
- * ```
394
- *
395
- * @param message The original i18n AST message node
396
- * @param variable The variable that will be assigned the translation, e.g. `I18N_1`.
397
- * @param closureVar The variable for Closure `goog.getMsg` calls, e.g. `MSG_EXTERNAL_XXX`.
398
- * @param params Object mapping placeholder names to their values (e.g.
399
- * `{ "interpolation": "\uFFFD0\uFFFD" }`).
400
- * @param transformFn Optional transformation function that will be applied to the translation (e.g.
401
- * post-processing).
402
- * @returns An array of statements that defined a given translation.
403
- */
404
- export declare function getTranslationDeclStmts(message: i18n.Message, variable: o.ReadVarExpr, closureVar: o.ReadVarExpr, params?: {
405
- [name: string]: o.Expression;
406
- }, transformFn?: (raw: o.ReadVarExpr) => o.Expression): o.Statement[];
407
- /**
408
- * Information about the template which was extracted during parsing.
409
- *
410
- * This contains the actual parsed template as well as any metadata collected during its parsing,
411
- * some of which might be useful for re-parsing the template with different options.
412
- */
413
- export interface ParsedTemplate {
414
- /**
415
- * Include whitespace nodes in the parsed output.
416
- */
417
- preserveWhitespaces?: boolean;
418
- /**
419
- * How to parse interpolation markers.
420
- */
421
- interpolationConfig?: InterpolationConfig;
422
- /**
423
- * Any errors from parsing the template the first time.
424
- *
425
- * `null` if there are no errors. Otherwise, the array of errors is guaranteed to be non-empty.
426
- */
427
- errors: ParseError[] | null;
428
- /**
429
- * The template AST, parsed from the template.
430
- */
431
- nodes: t.Node[];
432
- /**
433
- * Any styleUrls extracted from the metadata.
434
- */
435
- styleUrls: string[];
436
- /**
437
- * Any inline styles extracted from the metadata.
438
- */
439
- styles: string[];
440
- /**
441
- * Any ng-content selectors extracted from the template.
442
- */
443
- ngContentSelectors: string[];
444
- /**
445
- * Any R3 Comment Nodes extracted from the template when the `collectCommentNodes` parse template
446
- * option is enabled.
447
- */
448
- commentNodes?: t.Comment[];
449
- }
450
- export {};
@@ -1,94 +0,0 @@
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.io/license
7
- */
8
- import { ConstantPool } from '../../constant_pool';
9
- import { Interpolation } from '../../expression_parser/ast';
10
- import * as o from '../../output/output_ast';
11
- import { ParseSourceSpan } from '../../parse_util';
12
- import * as t from '../r3_ast';
13
- import { R3QueryMetadata } from './api';
14
- /** Name of the temporary to use during data binding */
15
- export declare const TEMPORARY_NAME = "_t";
16
- /** Name of the context parameter passed into a template function */
17
- export declare const CONTEXT_NAME = "ctx";
18
- /** Name of the RenderFlag passed into a template function */
19
- export declare const RENDER_FLAGS = "rf";
20
- /** The prefix reference variables */
21
- export declare const REFERENCE_PREFIX = "_r";
22
- /** The name of the implicit context reference */
23
- export declare const IMPLICIT_REFERENCE = "$implicit";
24
- /** Non bindable attribute name **/
25
- export declare const NON_BINDABLE_ATTR = "ngNonBindable";
26
- /** Name for the variable keeping track of the context returned by `ɵɵrestoreView`. */
27
- export declare const RESTORED_VIEW_CONTEXT_NAME = "restoredCtx";
28
- /**
29
- * Possible types that can be used to generate the parameters of an instruction call.
30
- * If the parameters are a function, the function will be invoked at the time the instruction
31
- * is generated.
32
- */
33
- export declare type InstructionParams = (o.Expression | o.Expression[]) | (() => (o.Expression | o.Expression[]));
34
- /** Necessary information to generate a call to an instruction function. */
35
- export interface Instruction {
36
- span: ParseSourceSpan | null;
37
- reference: o.ExternalReference;
38
- paramsOrFn?: InstructionParams;
39
- }
40
- /** Generates a call to a single instruction. */
41
- export declare function invokeInstruction(span: ParseSourceSpan | null, reference: o.ExternalReference, params: o.Expression[]): o.Expression;
42
- /**
43
- * Creates an allocator for a temporary variable.
44
- *
45
- * A variable declaration is added to the statements the first time the allocator is invoked.
46
- */
47
- export declare function temporaryAllocator(statements: o.Statement[], name: string): () => o.ReadVarExpr;
48
- export declare function invalid<T>(this: t.Visitor, arg: o.Expression | o.Statement | t.Node): never;
49
- export declare function asLiteral(value: any): o.Expression;
50
- export declare function conditionallyCreateMapObjectLiteral(keys: {
51
- [key: string]: string | string[];
52
- }, keepDeclared?: boolean): o.Expression | null;
53
- /**
54
- * Remove trailing null nodes as they are implied.
55
- */
56
- export declare function trimTrailingNulls(parameters: o.Expression[]): o.Expression[];
57
- export declare function getQueryPredicate(query: R3QueryMetadata, constantPool: ConstantPool): o.Expression;
58
- /**
59
- * A representation for an object literal used during codegen of definition objects. The generic
60
- * type `T` allows to reference a documented type of the generated structure, such that the
61
- * property names that are set can be resolved to their documented declaration.
62
- */
63
- export declare class DefinitionMap<T = any> {
64
- values: {
65
- key: string;
66
- quoted: boolean;
67
- value: o.Expression;
68
- }[];
69
- set(key: keyof T, value: o.Expression | null): void;
70
- toLiteralMap(): o.LiteralMapExpr;
71
- }
72
- /**
73
- * Extract a map of properties to values for a given element or template node, which can be used
74
- * by the directive matching machinery.
75
- *
76
- * @param elOrTpl the element or template in question
77
- * @return an object set up for directive matching. For attributes on the element/template, this
78
- * object maps a property name to its (static) value. For any bindings, this map simply maps the
79
- * property name to an empty string.
80
- */
81
- export declare function getAttrsForDirectiveMatching(elOrTpl: t.Element | t.Template): {
82
- [name: string]: string;
83
- };
84
- /**
85
- * Gets the number of arguments expected to be passed to a generated instruction in the case of
86
- * interpolation instructions.
87
- * @param interpolation An interpolation ast
88
- */
89
- export declare function getInterpolationArgsLength(interpolation: Interpolation): number;
90
- /**
91
- * Generates the final instruction call statements based on the passed in configuration.
92
- * Will try to chain instructions as much as possible, if chaining is supported.
93
- */
94
- export declare function getInstructionStatements(instructions: Instruction[]): o.Statement[];
@@ -1,17 +0,0 @@
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.io/license
7
- */
8
- /**
9
- * An interface for retrieving documents by URL that the compiler uses to
10
- * load templates.
11
- *
12
- * This is an abstract class, rather than an interface, so that it can be used
13
- * as injection token.
14
- */
15
- export declare abstract class ResourceLoader {
16
- abstract get(url: string): Promise<string> | string;
17
- }
@@ -1,45 +0,0 @@
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.io/license
7
- */
8
- import { SchemaMetadata, SecurityContext } from '../core';
9
- import { ElementSchemaRegistry } from './element_schema_registry';
10
- export declare class DomElementSchemaRegistry extends ElementSchemaRegistry {
11
- private _schema;
12
- private _eventSchema;
13
- constructor();
14
- hasProperty(tagName: string, propName: string, schemaMetas: SchemaMetadata[]): boolean;
15
- hasElement(tagName: string, schemaMetas: SchemaMetadata[]): boolean;
16
- /**
17
- * securityContext returns the security context for the given property on the given DOM tag.
18
- *
19
- * Tag and property name are statically known and cannot change at runtime, i.e. it is not
20
- * possible to bind a value into a changing attribute or tag name.
21
- *
22
- * The filtering is based on a list of allowed tags|attributes. All attributes in the schema
23
- * above are assumed to have the 'NONE' security context, i.e. that they are safe inert
24
- * string values. Only specific well known attack vectors are assigned their appropriate context.
25
- */
26
- securityContext(tagName: string, propName: string, isAttribute: boolean): SecurityContext;
27
- getMappedPropName(propName: string): string;
28
- getDefaultComponentElementName(): string;
29
- validateProperty(name: string): {
30
- error: boolean;
31
- msg?: string;
32
- };
33
- validateAttribute(name: string): {
34
- error: boolean;
35
- msg?: string;
36
- };
37
- allKnownElementNames(): string[];
38
- allKnownAttributesOfElement(tagName: string): string[];
39
- allKnownEventsOfElement(tagName: string): string[];
40
- normalizeAnimationStyleProperty(propName: string): string;
41
- normalizeAnimationStyleValue(camelCaseProp: string, userProvidedProp: string, val: string | number): {
42
- error: string;
43
- value: string;
44
- };
45
- }
@@ -1,11 +0,0 @@
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.io/license
7
- */
8
- import { SecurityContext } from '../core';
9
- export declare function SECURITY_SCHEMA(): {
10
- [k: string]: SecurityContext;
11
- };
@@ -1,29 +0,0 @@
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.io/license
7
- */
8
- import { SchemaMetadata, SecurityContext } from '../core';
9
- export declare abstract class ElementSchemaRegistry {
10
- abstract hasProperty(tagName: string, propName: string, schemaMetas: SchemaMetadata[]): boolean;
11
- abstract hasElement(tagName: string, schemaMetas: SchemaMetadata[]): boolean;
12
- abstract securityContext(elementName: string, propName: string, isAttribute: boolean): SecurityContext;
13
- abstract allKnownElementNames(): string[];
14
- abstract getMappedPropName(propName: string): string;
15
- abstract getDefaultComponentElementName(): string;
16
- abstract validateProperty(name: string): {
17
- error: boolean;
18
- msg?: string;
19
- };
20
- abstract validateAttribute(name: string): {
21
- error: boolean;
22
- msg?: string;
23
- };
24
- abstract normalizeAnimationStyleProperty(propName: string): string;
25
- abstract normalizeAnimationStyleValue(camelCaseProp: string, userProvidedProp: string, val: string | number): {
26
- error: string;
27
- value: string;
28
- };
29
- }
@@ -1,15 +0,0 @@
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.io/license
7
- */
8
- /**
9
- * isTrustedTypesSink returns true if the given property on the given DOM tag is a Trusted Types
10
- * sink. In that case, use `ElementSchemaRegistry.securityContext` to determine which particular
11
- * Trusted Type is required for values passed to the sink:
12
- * - SecurityContext.HTML corresponds to TrustedHTML
13
- * - SecurityContext.RESOURCE_URL corresponds to TrustedScriptURL
14
- */
15
- export declare function isTrustedTypesSink(tagName: string, propName: string): boolean;