@angular/compiler 14.0.0-next.8 → 14.0.0-rc.1

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 (148) hide show
  1. package/esm2020/src/compiler.mjs +3 -2
  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 +74 -42
  7. package/esm2020/src/ml_parser/html_whitespaces.mjs +2 -2
  8. package/esm2020/src/ml_parser/lexer.mjs +36 -36
  9. package/esm2020/src/ml_parser/parser.mjs +41 -41
  10. package/esm2020/src/render3/partial/api.mjs +1 -1
  11. package/esm2020/src/render3/partial/class_metadata.mjs +1 -1
  12. package/esm2020/src/render3/partial/component.mjs +28 -37
  13. package/esm2020/src/render3/partial/directive.mjs +6 -3
  14. package/esm2020/src/render3/partial/factory.mjs +1 -1
  15. package/esm2020/src/render3/partial/injectable.mjs +1 -1
  16. package/esm2020/src/render3/partial/injector.mjs +1 -1
  17. package/esm2020/src/render3/partial/ng_module.mjs +3 -3
  18. package/esm2020/src/render3/partial/pipe.mjs +6 -3
  19. package/esm2020/src/render3/r3_ast.mjs +3 -3
  20. package/esm2020/src/render3/r3_factory.mjs +6 -6
  21. package/esm2020/src/render3/r3_identifiers.mjs +2 -1
  22. package/esm2020/src/render3/r3_pipe_compiler.mjs +5 -1
  23. package/esm2020/src/render3/util.mjs +4 -4
  24. package/esm2020/src/render3/view/api.mjs +7 -2
  25. package/esm2020/src/render3/view/compiler.mjs +45 -35
  26. package/esm2020/src/render3/view/i18n/get_msg_utils.mjs +58 -5
  27. package/esm2020/src/render3/view/i18n/meta.mjs +4 -4
  28. package/esm2020/src/render3/view/i18n/util.mjs +2 -2
  29. package/esm2020/src/render3/view/style_parser.mjs +19 -19
  30. package/esm2020/src/render3/view/styling_builder.mjs +6 -6
  31. package/esm2020/src/render3/view/template.mjs +25 -25
  32. package/esm2020/src/render3/view/util.mjs +14 -5
  33. package/esm2020/src/selector.mjs +8 -8
  34. package/esm2020/src/template_parser/binding_parser.mjs +8 -8
  35. package/esm2020/src/util.mjs +8 -8
  36. package/esm2020/src/version.mjs +1 -1
  37. package/fesm2015/compiler.mjs +416 -301
  38. package/fesm2015/compiler.mjs.map +1 -1
  39. package/fesm2015/testing.mjs +1 -1
  40. package/fesm2020/compiler.mjs +424 -314
  41. package/fesm2020/compiler.mjs.map +1 -1
  42. package/fesm2020/testing.mjs +1 -1
  43. package/index.d.ts +4964 -5
  44. package/package.json +3 -3
  45. package/testing/index.d.ts +22 -5
  46. package/compiler.d.ts +0 -8
  47. package/public_api.d.ts +0 -13
  48. package/src/assertions.d.ts +0 -8
  49. package/src/chars.d.ts +0 -75
  50. package/src/compiler.d.ts +0 -77
  51. package/src/compiler_facade_interface.d.ts +0 -284
  52. package/src/compiler_util/expression_converter.d.ts +0 -71
  53. package/src/config.d.ts +0 -25
  54. package/src/constant_pool.d.ts +0 -37
  55. package/src/core.d.ts +0 -216
  56. package/src/expression_parser/ast.d.ts +0 -440
  57. package/src/expression_parser/lexer.d.ts +0 -47
  58. package/src/expression_parser/parser.d.ts +0 -315
  59. package/src/i18n/big_integer.d.ts +0 -108
  60. package/src/i18n/digest.d.ts +0 -44
  61. package/src/i18n/extractor_merger.d.ts +0 -27
  62. package/src/i18n/i18n_ast.d.ts +0 -148
  63. package/src/i18n/i18n_html_parser.d.ts +0 -19
  64. package/src/i18n/i18n_parser.d.ts +0 -18
  65. package/src/i18n/index.d.ts +0 -15
  66. package/src/i18n/message_bundle.d.ts +0 -28
  67. package/src/i18n/parse_util.d.ts +0 -14
  68. package/src/i18n/serializers/placeholder.d.ts +0 -25
  69. package/src/i18n/serializers/serializer.d.ts +0 -46
  70. package/src/i18n/serializers/xliff.d.ts +0 -19
  71. package/src/i18n/serializers/xliff2.d.ts +0 -19
  72. package/src/i18n/serializers/xmb.d.ts +0 -22
  73. package/src/i18n/serializers/xml_helper.d.ts +0 -52
  74. package/src/i18n/serializers/xtb.d.ts +0 -20
  75. package/src/i18n/translation_bundle.d.ts +0 -27
  76. package/src/injectable_compiler_2.d.ts +0 -24
  77. package/src/jit_compiler_facade.d.ts +0 -46
  78. package/src/ml_parser/ast.d.ts +0 -89
  79. package/src/ml_parser/entities.d.ts +0 -9
  80. package/src/ml_parser/html_parser.d.ts +0 -13
  81. package/src/ml_parser/html_tags.d.ts +0 -33
  82. package/src/ml_parser/html_whitespaces.d.ts +0 -45
  83. package/src/ml_parser/icu_ast_expander.d.ts +0 -42
  84. package/src/ml_parser/interpolation_config.d.ts +0 -14
  85. package/src/ml_parser/lexer.d.ts +0 -114
  86. package/src/ml_parser/parser.d.ts +0 -26
  87. package/src/ml_parser/tags.d.ts +0 -29
  88. package/src/ml_parser/tokens.d.ts +0 -141
  89. package/src/ml_parser/xml_parser.d.ts +0 -13
  90. package/src/ml_parser/xml_tags.d.ts +0 -24
  91. package/src/output/abstract_emitter.d.ts +0 -66
  92. package/src/output/abstract_js_emitter.d.ts +0 -19
  93. package/src/output/map_util.d.ts +0 -18
  94. package/src/output/output_ast.d.ts +0 -575
  95. package/src/output/output_jit.d.ts +0 -73
  96. package/src/output/output_jit_trusted_types.d.ts +0 -43
  97. package/src/output/source_map.d.ts +0 -29
  98. package/src/parse_util.d.ts +0 -75
  99. package/src/render3/partial/api.d.ts +0 -441
  100. package/src/render3/partial/class_metadata.d.ts +0 -10
  101. package/src/render3/partial/component.d.ts +0 -39
  102. package/src/render3/partial/directive.d.ts +0 -13
  103. package/src/render3/partial/factory.d.ts +0 -3
  104. package/src/render3/partial/injectable.d.ts +0 -19
  105. package/src/render3/partial/injector.d.ts +0 -3
  106. package/src/render3/partial/ng_module.d.ts +0 -3
  107. package/src/render3/partial/pipe.d.ts +0 -12
  108. package/src/render3/partial/util.d.ts +0 -33
  109. package/src/render3/r3_ast.d.ts +0 -211
  110. package/src/render3/r3_class_metadata_compiler.d.ts +0 -35
  111. package/src/render3/r3_factory.d.ts +0 -94
  112. package/src/render3/r3_identifiers.d.ts +0 -182
  113. package/src/render3/r3_injector_compiler.d.ts +0 -18
  114. package/src/render3/r3_jit.d.ts +0 -22
  115. package/src/render3/r3_module_compiler.d.ts +0 -103
  116. package/src/render3/r3_pipe_compiler.d.ts +0 -50
  117. package/src/render3/r3_template_transform.d.ts +0 -24
  118. package/src/render3/util.d.ts +0 -94
  119. package/src/render3/view/api.d.ts +0 -328
  120. package/src/render3/view/compiler.d.ts +0 -86
  121. package/src/render3/view/i18n/context.d.ts +0 -68
  122. package/src/render3/view/i18n/get_msg_utils.d.ts +0 -13
  123. package/src/render3/view/i18n/icu_serializer.d.ts +0 -9
  124. package/src/render3/view/i18n/localize_utils.d.ts +0 -24
  125. package/src/render3/view/i18n/meta.d.ts +0 -78
  126. package/src/render3/view/i18n/util.d.ts +0 -78
  127. package/src/render3/view/style_parser.d.ts +0 -18
  128. package/src/render3/view/styling_builder.d.ts +0 -211
  129. package/src/render3/view/t2_api.d.ts +0 -152
  130. package/src/render3/view/t2_binder.d.ts +0 -57
  131. package/src/render3/view/template.d.ts +0 -450
  132. package/src/render3/view/util.d.ts +0 -94
  133. package/src/resource_loader.d.ts +0 -17
  134. package/src/schema/dom_element_schema_registry.d.ts +0 -45
  135. package/src/schema/dom_security_schema.d.ts +0 -11
  136. package/src/schema/element_schema_registry.d.ts +0 -29
  137. package/src/schema/trusted_types_sinks.d.ts +0 -15
  138. package/src/selector.d.ts +0 -105
  139. package/src/shadow_css.d.ts +0 -76
  140. package/src/style_url_resolver.d.ts +0 -8
  141. package/src/template_parser/binding_parser.d.ts +0 -91
  142. package/src/template_parser/template_preparser.d.ts +0 -24
  143. package/src/util.d.ts +0 -42
  144. package/src/version.d.ts +0 -14
  145. package/testing/package.json +0 -9
  146. package/testing/public_api.d.ts +0 -13
  147. package/testing/src/testing.d.ts +0 -23
  148. package/testing/testing.d.ts +0 -4
@@ -1,315 +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 { InterpolationConfig } from '../ml_parser/interpolation_config';
9
- import { InterpolatedAttributeToken, InterpolatedTextToken } from '../ml_parser/tokens';
10
- import { AbsoluteSourceSpan, AST, ASTWithSource, BindingPipe, LiteralMap, ParserError, ParseSpan, TemplateBinding, TemplateBindingIdentifier } from './ast';
11
- import { Lexer, Token } from './lexer';
12
- export interface InterpolationPiece {
13
- text: string;
14
- start: number;
15
- end: number;
16
- }
17
- export declare class SplitInterpolation {
18
- strings: InterpolationPiece[];
19
- expressions: InterpolationPiece[];
20
- offsets: number[];
21
- constructor(strings: InterpolationPiece[], expressions: InterpolationPiece[], offsets: number[]);
22
- }
23
- export declare class TemplateBindingParseResult {
24
- templateBindings: TemplateBinding[];
25
- warnings: string[];
26
- errors: ParserError[];
27
- constructor(templateBindings: TemplateBinding[], warnings: string[], errors: ParserError[]);
28
- }
29
- /**
30
- * Represents the possible parse modes to be used as a bitmask.
31
- */
32
- export declare const enum ParseFlags {
33
- None = 0,
34
- /**
35
- * Whether an output binding is being parsed.
36
- */
37
- Action = 1,
38
- /**
39
- * Whether an assignment event is being parsed, i.e. an expression originating from
40
- * two-way-binding aka banana-in-a-box syntax.
41
- */
42
- AssignmentEvent = 2
43
- }
44
- export declare class Parser {
45
- private _lexer;
46
- private errors;
47
- constructor(_lexer: Lexer);
48
- parseAction(input: string, isAssignmentEvent: boolean, location: string, absoluteOffset: number, interpolationConfig?: InterpolationConfig): ASTWithSource;
49
- parseBinding(input: string, location: string, absoluteOffset: number, interpolationConfig?: InterpolationConfig): ASTWithSource;
50
- private checkSimpleExpression;
51
- parseSimpleBinding(input: string, location: string, absoluteOffset: number, interpolationConfig?: InterpolationConfig): ASTWithSource;
52
- private _reportError;
53
- private _parseBindingAst;
54
- /**
55
- * Parse microsyntax template expression and return a list of bindings or
56
- * parsing errors in case the given expression is invalid.
57
- *
58
- * For example,
59
- * ```
60
- * <div *ngFor="let item of items">
61
- * ^ ^ absoluteValueOffset for `templateValue`
62
- * absoluteKeyOffset for `templateKey`
63
- * ```
64
- * contains three bindings:
65
- * 1. ngFor -> null
66
- * 2. item -> NgForOfContext.$implicit
67
- * 3. ngForOf -> items
68
- *
69
- * This is apparent from the de-sugared template:
70
- * ```
71
- * <ng-template ngFor let-item [ngForOf]="items">
72
- * ```
73
- *
74
- * @param templateKey name of directive, without the * prefix. For example: ngIf, ngFor
75
- * @param templateValue RHS of the microsyntax attribute
76
- * @param templateUrl template filename if it's external, component filename if it's inline
77
- * @param absoluteKeyOffset start of the `templateKey`
78
- * @param absoluteValueOffset start of the `templateValue`
79
- */
80
- parseTemplateBindings(templateKey: string, templateValue: string, templateUrl: string, absoluteKeyOffset: number, absoluteValueOffset: number): TemplateBindingParseResult;
81
- parseInterpolation(input: string, location: string, absoluteOffset: number, interpolatedTokens: InterpolatedAttributeToken[] | InterpolatedTextToken[] | null, interpolationConfig?: InterpolationConfig): ASTWithSource | null;
82
- /**
83
- * Similar to `parseInterpolation`, but treats the provided string as a single expression
84
- * element that would normally appear within the interpolation prefix and suffix (`{{` and `}}`).
85
- * This is used for parsing the switch expression in ICUs.
86
- */
87
- parseInterpolationExpression(expression: string, location: string, absoluteOffset: number): ASTWithSource;
88
- private createInterpolationAst;
89
- /**
90
- * Splits a string of text into "raw" text segments and expressions present in interpolations in
91
- * the string.
92
- * Returns `null` if there are no interpolations, otherwise a
93
- * `SplitInterpolation` with splits that look like
94
- * <raw text> <expression> <raw text> ... <raw text> <expression> <raw text>
95
- */
96
- splitInterpolation(input: string, location: string, interpolatedTokens: InterpolatedAttributeToken[] | InterpolatedTextToken[] | null, interpolationConfig?: InterpolationConfig): SplitInterpolation;
97
- wrapLiteralPrimitive(input: string | null, location: string, absoluteOffset: number): ASTWithSource;
98
- private _stripComments;
99
- private _commentStart;
100
- private _checkNoInterpolation;
101
- /**
102
- * Finds the index of the end of an interpolation expression
103
- * while ignoring comments and quoted content.
104
- */
105
- private _getInterpolationEndIndex;
106
- /**
107
- * Generator used to iterate over the character indexes of a string that are outside of quotes.
108
- * @param input String to loop through.
109
- * @param start Index within the string at which to start.
110
- */
111
- private _forEachUnquotedChar;
112
- }
113
- export declare class _ParseAST {
114
- input: string;
115
- location: string;
116
- absoluteOffset: number;
117
- tokens: Token[];
118
- parseFlags: ParseFlags;
119
- private errors;
120
- private offset;
121
- private rparensExpected;
122
- private rbracketsExpected;
123
- private rbracesExpected;
124
- private context;
125
- private sourceSpanCache;
126
- index: number;
127
- constructor(input: string, location: string, absoluteOffset: number, tokens: Token[], parseFlags: ParseFlags, errors: ParserError[], offset: number);
128
- peek(offset: number): Token;
129
- get next(): Token;
130
- /** Whether all the parser input has been processed. */
131
- get atEOF(): boolean;
132
- /**
133
- * Index of the next token to be processed, or the end of the last token if all have been
134
- * processed.
135
- */
136
- get inputIndex(): number;
137
- /**
138
- * End index of the last processed token, or the start of the first token if none have been
139
- * processed.
140
- */
141
- get currentEndIndex(): number;
142
- /**
143
- * Returns the absolute offset of the start of the current token.
144
- */
145
- get currentAbsoluteOffset(): number;
146
- /**
147
- * Retrieve a `ParseSpan` from `start` to the current position (or to `artificialEndIndex` if
148
- * provided).
149
- *
150
- * @param start Position from which the `ParseSpan` will start.
151
- * @param artificialEndIndex Optional ending index to be used if provided (and if greater than the
152
- * natural ending index)
153
- */
154
- span(start: number, artificialEndIndex?: number): ParseSpan;
155
- sourceSpan(start: number, artificialEndIndex?: number): AbsoluteSourceSpan;
156
- advance(): void;
157
- /**
158
- * Executes a callback in the provided context.
159
- */
160
- private withContext;
161
- consumeOptionalCharacter(code: number): boolean;
162
- peekKeywordLet(): boolean;
163
- peekKeywordAs(): boolean;
164
- /**
165
- * Consumes an expected character, otherwise emits an error about the missing expected character
166
- * and skips over the token stream until reaching a recoverable point.
167
- *
168
- * See `this.error` and `this.skip` for more details.
169
- */
170
- expectCharacter(code: number): void;
171
- consumeOptionalOperator(op: string): boolean;
172
- expectOperator(operator: string): void;
173
- prettyPrintToken(tok: Token): string;
174
- expectIdentifierOrKeyword(): string | null;
175
- expectIdentifierOrKeywordOrString(): string;
176
- parseChain(): AST;
177
- parsePipe(): AST;
178
- parseExpression(): AST;
179
- parseConditional(): AST;
180
- parseLogicalOr(): AST;
181
- parseLogicalAnd(): AST;
182
- parseNullishCoalescing(): AST;
183
- parseEquality(): AST;
184
- parseRelational(): AST;
185
- parseAdditive(): AST;
186
- parseMultiplicative(): AST;
187
- parsePrefix(): AST;
188
- parseCallChain(): AST;
189
- parsePrimary(): AST;
190
- parseExpressionList(terminator: number): AST[];
191
- parseLiteralMap(): LiteralMap;
192
- parseAccessMember(readReceiver: AST, start: number, isSafe: boolean): AST;
193
- parseCall(receiver: AST, start: number, isSafe: boolean): AST;
194
- private consumeOptionalAssignment;
195
- parseCallArguments(): BindingPipe[];
196
- /**
197
- * Parses an identifier, a keyword, a string with an optional `-` in between,
198
- * and returns the string along with its absolute source span.
199
- */
200
- expectTemplateBindingKey(): TemplateBindingIdentifier;
201
- /**
202
- * Parse microsyntax template expression and return a list of bindings or
203
- * parsing errors in case the given expression is invalid.
204
- *
205
- * For example,
206
- * ```
207
- * <div *ngFor="let item of items; index as i; trackBy: func">
208
- * ```
209
- * contains five bindings:
210
- * 1. ngFor -> null
211
- * 2. item -> NgForOfContext.$implicit
212
- * 3. ngForOf -> items
213
- * 4. i -> NgForOfContext.index
214
- * 5. ngForTrackBy -> func
215
- *
216
- * For a full description of the microsyntax grammar, see
217
- * https://gist.github.com/mhevery/d3530294cff2e4a1b3fe15ff75d08855
218
- *
219
- * @param templateKey name of the microsyntax directive, like ngIf, ngFor,
220
- * without the *, along with its absolute span.
221
- */
222
- parseTemplateBindings(templateKey: TemplateBindingIdentifier): TemplateBindingParseResult;
223
- parseKeyedReadOrWrite(receiver: AST, start: number, isSafe: boolean): AST;
224
- /**
225
- * Parse a directive keyword, followed by a mandatory expression.
226
- * For example, "of items", "trackBy: func".
227
- * The bindings are: ngForOf -> items, ngForTrackBy -> func
228
- * There could be an optional "as" binding that follows the expression.
229
- * For example,
230
- * ```
231
- * *ngFor="let item of items | slice:0:1 as collection".
232
- * ^^ ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^
233
- * keyword bound target optional 'as' binding
234
- * ```
235
- *
236
- * @param key binding key, for example, ngFor, ngIf, ngForOf, along with its
237
- * absolute span.
238
- */
239
- private parseDirectiveKeywordBindings;
240
- /**
241
- * Return the expression AST for the bound target of a directive keyword
242
- * binding. For example,
243
- * ```
244
- * *ngIf="condition | pipe"
245
- * ^^^^^^^^^^^^^^^^ bound target for "ngIf"
246
- * *ngFor="let item of items"
247
- * ^^^^^ bound target for "ngForOf"
248
- * ```
249
- */
250
- private getDirectiveBoundTarget;
251
- /**
252
- * Return the binding for a variable declared using `as`. Note that the order
253
- * of the key-value pair in this declaration is reversed. For example,
254
- * ```
255
- * *ngFor="let item of items; index as i"
256
- * ^^^^^ ^
257
- * value key
258
- * ```
259
- *
260
- * @param value name of the value in the declaration, "ngIf" in the example
261
- * above, along with its absolute span.
262
- */
263
- private parseAsBinding;
264
- /**
265
- * Return the binding for a variable declared using `let`. For example,
266
- * ```
267
- * *ngFor="let item of items; let i=index;"
268
- * ^^^^^^^^ ^^^^^^^^^^^
269
- * ```
270
- * In the first binding, `item` is bound to `NgForOfContext.$implicit`.
271
- * In the second binding, `i` is bound to `NgForOfContext.index`.
272
- */
273
- private parseLetBinding;
274
- /**
275
- * Consume the optional statement terminator: semicolon or comma.
276
- */
277
- private consumeStatementTerminator;
278
- /**
279
- * Records an error and skips over the token stream until reaching a recoverable point. See
280
- * `this.skip` for more details on token skipping.
281
- */
282
- error(message: string, index?: number | null): void;
283
- private locationText;
284
- /**
285
- * Records an error for an unexpected private identifier being discovered.
286
- * @param token Token representing a private identifier.
287
- * @param extraMessage Optional additional message being appended to the error.
288
- */
289
- private _reportErrorForPrivateIdentifier;
290
- /**
291
- * Error recovery should skip tokens until it encounters a recovery point.
292
- *
293
- * The following are treated as unconditional recovery points:
294
- * - end of input
295
- * - ';' (parseChain() is always the root production, and it expects a ';')
296
- * - '|' (since pipes may be chained and each pipe expression may be treated independently)
297
- *
298
- * The following are conditional recovery points:
299
- * - ')', '}', ']' if one of calling productions is expecting one of these symbols
300
- * - This allows skip() to recover from errors such as '(a.) + 1' allowing more of the AST to
301
- * be retained (it doesn't skip any tokens as the ')' is retained because of the '(' begins
302
- * an '(' <expr> ')' production).
303
- * The recovery points of grouping symbols must be conditional as they must be skipped if
304
- * none of the calling productions are not expecting the closing token else we will never
305
- * make progress in the case of an extraneous group closing symbol (such as a stray ')').
306
- * That is, we skip a closing symbol if we are not in a grouping production.
307
- * - '=' in a `Writable` context
308
- * - In this context, we are able to recover after seeing the `=` operator, which
309
- * signals the presence of an independent rvalue expression following the `=` operator.
310
- *
311
- * If a production expects one of these token it increments the corresponding nesting count,
312
- * and then decrements it just prior to checking if the token is in the input.
313
- */
314
- private skip;
315
- }
@@ -1,108 +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
- * Represents a big integer using a buffer of its individual digits, with the least significant
10
- * digit stored at the beginning of the array (little endian).
11
- *
12
- * For performance reasons, each instance is mutable. The addition operation can be done in-place
13
- * to reduce memory pressure of allocation for the digits array.
14
- */
15
- export declare class BigInteger {
16
- private readonly digits;
17
- static zero(): BigInteger;
18
- static one(): BigInteger;
19
- /**
20
- * Creates a big integer using its individual digits in little endian storage.
21
- */
22
- private constructor();
23
- /**
24
- * Creates a clone of this instance.
25
- */
26
- clone(): BigInteger;
27
- /**
28
- * Returns a new big integer with the sum of `this` and `other` as its value. This does not mutate
29
- * `this` but instead returns a new instance, unlike `addToSelf`.
30
- */
31
- add(other: BigInteger): BigInteger;
32
- /**
33
- * Adds `other` to the instance itself, thereby mutating its value.
34
- */
35
- addToSelf(other: BigInteger): void;
36
- /**
37
- * Builds the decimal string representation of the big integer. As this is stored in
38
- * little endian, the digits are concatenated in reverse order.
39
- */
40
- toString(): string;
41
- }
42
- /**
43
- * Represents a big integer which is optimized for multiplication operations, as its power-of-twos
44
- * are memoized. See `multiplyBy()` for details on the multiplication algorithm.
45
- */
46
- export declare class BigIntForMultiplication {
47
- /**
48
- * Stores all memoized power-of-twos, where each index represents `this.number * 2^index`.
49
- */
50
- private readonly powerOfTwos;
51
- constructor(value: BigInteger);
52
- /**
53
- * Returns the big integer itself.
54
- */
55
- getValue(): BigInteger;
56
- /**
57
- * Computes the value for `num * b`, where `num` is a JS number and `b` is a big integer. The
58
- * value for `b` is represented by a storage model that is optimized for this computation.
59
- *
60
- * This operation is implemented in N(log2(num)) by continuous halving of the number, where the
61
- * least-significant bit (LSB) is tested in each iteration. If the bit is set, the bit's index is
62
- * used as exponent into the power-of-two multiplication of `b`.
63
- *
64
- * As an example, consider the multiplication num=42, b=1337. In binary 42 is 0b00101010 and the
65
- * algorithm unrolls into the following iterations:
66
- *
67
- * Iteration | num | LSB | b * 2^iter | Add? | product
68
- * -----------|------------|------|------------|------|--------
69
- * 0 | 0b00101010 | 0 | 1337 | No | 0
70
- * 1 | 0b00010101 | 1 | 2674 | Yes | 2674
71
- * 2 | 0b00001010 | 0 | 5348 | No | 2674
72
- * 3 | 0b00000101 | 1 | 10696 | Yes | 13370
73
- * 4 | 0b00000010 | 0 | 21392 | No | 13370
74
- * 5 | 0b00000001 | 1 | 42784 | Yes | 56154
75
- * 6 | 0b00000000 | 0 | 85568 | No | 56154
76
- *
77
- * The computed product of 56154 is indeed the correct result.
78
- *
79
- * The `BigIntForMultiplication` representation for a big integer provides memoized access to the
80
- * power-of-two values to reduce the workload in computing those values.
81
- */
82
- multiplyBy(num: number): BigInteger;
83
- /**
84
- * See `multiplyBy()` for details. This function allows for the computed product to be added
85
- * directly to the provided result big integer.
86
- */
87
- multiplyByAndAddTo(num: number, result: BigInteger): void;
88
- /**
89
- * Computes and memoizes the big integer value for `this.number * 2^exponent`.
90
- */
91
- private getMultipliedByPowerOfTwo;
92
- }
93
- /**
94
- * Represents an exponentiation operation for the provided base, of which exponents are computed and
95
- * memoized. The results are represented by a `BigIntForMultiplication` which is tailored for
96
- * multiplication operations by memoizing the power-of-twos. This effectively results in a matrix
97
- * representation that is lazily computed upon request.
98
- */
99
- export declare class BigIntExponentiation {
100
- private readonly base;
101
- private readonly exponents;
102
- constructor(base: number);
103
- /**
104
- * Compute the value for `this.base^exponent`, resulting in a big integer that is optimized for
105
- * further multiplication operations.
106
- */
107
- toThePowerOf(exponent: number): BigIntForMultiplication;
108
- }
@@ -1,44 +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 * as i18n from './i18n_ast';
9
- /**
10
- * Return the message id or compute it using the XLIFF1 digest.
11
- */
12
- export declare function digest(message: i18n.Message): string;
13
- /**
14
- * Compute the message id using the XLIFF1 digest.
15
- */
16
- export declare function computeDigest(message: i18n.Message): string;
17
- /**
18
- * Return the message id or compute it using the XLIFF2/XMB/$localize digest.
19
- */
20
- export declare function decimalDigest(message: i18n.Message): string;
21
- /**
22
- * Compute the message id using the XLIFF2/XMB/$localize digest.
23
- */
24
- export declare function computeDecimalDigest(message: i18n.Message): string;
25
- export declare function serializeNodes(nodes: i18n.Node[]): string[];
26
- /**
27
- * Compute the SHA1 of the given string
28
- *
29
- * see https://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf
30
- *
31
- * WARNING: this function has not been designed not tested with security in mind.
32
- * DO NOT USE IT IN A SECURITY SENSITIVE CONTEXT.
33
- */
34
- export declare function sha1(str: string): string;
35
- /**
36
- * Compute the fingerprint of the given string
37
- *
38
- * The output is 64 bit number encoded as a decimal string
39
- *
40
- * based on:
41
- * https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/GoogleJsMessageIdGenerator.java
42
- */
43
- export declare function fingerprint(str: string): [number, number];
44
- export declare function computeMsgId(msg: string, meaning?: string): string;
@@ -1,27 +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 * as html from '../ml_parser/ast';
9
- import { InterpolationConfig } from '../ml_parser/interpolation_config';
10
- import { ParseTreeResult } from '../ml_parser/parser';
11
- import * as i18n from './i18n_ast';
12
- import { I18nError } from './parse_util';
13
- import { TranslationBundle } from './translation_bundle';
14
- /**
15
- * Extract translatable messages from an html AST
16
- */
17
- export declare function extractMessages(nodes: html.Node[], interpolationConfig: InterpolationConfig, implicitTags: string[], implicitAttrs: {
18
- [k: string]: string[];
19
- }): ExtractionResult;
20
- export declare function mergeTranslations(nodes: html.Node[], translations: TranslationBundle, interpolationConfig: InterpolationConfig, implicitTags: string[], implicitAttrs: {
21
- [k: string]: string[];
22
- }): ParseTreeResult;
23
- export declare class ExtractionResult {
24
- messages: i18n.Message[];
25
- errors: I18nError[];
26
- constructor(messages: i18n.Message[], errors: I18nError[]);
27
- }
@@ -1,148 +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 { ParseSourceSpan } from '../parse_util';
9
- /**
10
- * Describes the text contents of a placeholder as it appears in an ICU expression, including its
11
- * source span information.
12
- */
13
- export interface MessagePlaceholder {
14
- /** The text contents of the placeholder */
15
- text: string;
16
- /** The source span of the placeholder */
17
- sourceSpan: ParseSourceSpan;
18
- }
19
- export declare class Message {
20
- nodes: Node[];
21
- placeholders: {
22
- [phName: string]: MessagePlaceholder;
23
- };
24
- placeholderToMessage: {
25
- [phName: string]: Message;
26
- };
27
- meaning: string;
28
- description: string;
29
- customId: string;
30
- sources: MessageSpan[];
31
- id: string;
32
- /** The ids to use if there are no custom id and if `i18nLegacyMessageIdFormat` is not empty */
33
- legacyIds: string[];
34
- messageString: string;
35
- /**
36
- * @param nodes message AST
37
- * @param placeholders maps placeholder names to static content and their source spans
38
- * @param placeholderToMessage maps placeholder names to messages (used for nested ICU messages)
39
- * @param meaning
40
- * @param description
41
- * @param customId
42
- */
43
- constructor(nodes: Node[], placeholders: {
44
- [phName: string]: MessagePlaceholder;
45
- }, placeholderToMessage: {
46
- [phName: string]: Message;
47
- }, meaning: string, description: string, customId: string);
48
- }
49
- export interface MessageSpan {
50
- filePath: string;
51
- startLine: number;
52
- startCol: number;
53
- endLine: number;
54
- endCol: number;
55
- }
56
- export interface Node {
57
- sourceSpan: ParseSourceSpan;
58
- visit(visitor: Visitor, context?: any): any;
59
- }
60
- export declare class Text implements Node {
61
- value: string;
62
- sourceSpan: ParseSourceSpan;
63
- constructor(value: string, sourceSpan: ParseSourceSpan);
64
- visit(visitor: Visitor, context?: any): any;
65
- }
66
- export declare class Container implements Node {
67
- children: Node[];
68
- sourceSpan: ParseSourceSpan;
69
- constructor(children: Node[], sourceSpan: ParseSourceSpan);
70
- visit(visitor: Visitor, context?: any): any;
71
- }
72
- export declare class Icu implements Node {
73
- expression: string;
74
- type: string;
75
- cases: {
76
- [k: string]: Node;
77
- };
78
- sourceSpan: ParseSourceSpan;
79
- expressionPlaceholder: string;
80
- constructor(expression: string, type: string, cases: {
81
- [k: string]: Node;
82
- }, sourceSpan: ParseSourceSpan);
83
- visit(visitor: Visitor, context?: any): any;
84
- }
85
- export declare class TagPlaceholder implements Node {
86
- tag: string;
87
- attrs: {
88
- [k: string]: string;
89
- };
90
- startName: string;
91
- closeName: string;
92
- children: Node[];
93
- isVoid: boolean;
94
- sourceSpan: ParseSourceSpan;
95
- startSourceSpan: ParseSourceSpan | null;
96
- endSourceSpan: ParseSourceSpan | null;
97
- constructor(tag: string, attrs: {
98
- [k: string]: string;
99
- }, startName: string, closeName: string, children: Node[], isVoid: boolean, sourceSpan: ParseSourceSpan, startSourceSpan: ParseSourceSpan | null, endSourceSpan: ParseSourceSpan | null);
100
- visit(visitor: Visitor, context?: any): any;
101
- }
102
- export declare class Placeholder implements Node {
103
- value: string;
104
- name: string;
105
- sourceSpan: ParseSourceSpan;
106
- constructor(value: string, name: string, sourceSpan: ParseSourceSpan);
107
- visit(visitor: Visitor, context?: any): any;
108
- }
109
- export declare class IcuPlaceholder implements Node {
110
- value: Icu;
111
- name: string;
112
- sourceSpan: ParseSourceSpan;
113
- /** Used to capture a message computed from a previous processing pass (see `setI18nRefs()`). */
114
- previousMessage?: Message;
115
- constructor(value: Icu, name: string, sourceSpan: ParseSourceSpan);
116
- visit(visitor: Visitor, context?: any): any;
117
- }
118
- /**
119
- * Each HTML node that is affect by an i18n tag will also have an `i18n` property that is of type
120
- * `I18nMeta`.
121
- * This information is either a `Message`, which indicates it is the root of an i18n message, or a
122
- * `Node`, which indicates is it part of a containing `Message`.
123
- */
124
- export declare type I18nMeta = Message | Node;
125
- export interface Visitor {
126
- visitText(text: Text, context?: any): any;
127
- visitContainer(container: Container, context?: any): any;
128
- visitIcu(icu: Icu, context?: any): any;
129
- visitTagPlaceholder(ph: TagPlaceholder, context?: any): any;
130
- visitPlaceholder(ph: Placeholder, context?: any): any;
131
- visitIcuPlaceholder(ph: IcuPlaceholder, context?: any): any;
132
- }
133
- export declare class CloneVisitor implements Visitor {
134
- visitText(text: Text, context?: any): Text;
135
- visitContainer(container: Container, context?: any): Container;
136
- visitIcu(icu: Icu, context?: any): Icu;
137
- visitTagPlaceholder(ph: TagPlaceholder, context?: any): TagPlaceholder;
138
- visitPlaceholder(ph: Placeholder, context?: any): Placeholder;
139
- visitIcuPlaceholder(ph: IcuPlaceholder, context?: any): IcuPlaceholder;
140
- }
141
- export declare class RecurseVisitor implements Visitor {
142
- visitText(text: Text, context?: any): any;
143
- visitContainer(container: Container, context?: any): any;
144
- visitIcu(icu: Icu, context?: any): any;
145
- visitTagPlaceholder(ph: TagPlaceholder, context?: any): any;
146
- visitPlaceholder(ph: Placeholder, context?: any): any;
147
- visitIcuPlaceholder(ph: IcuPlaceholder, context?: any): any;
148
- }
@@ -1,19 +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 { MissingTranslationStrategy } from '../core';
9
- import { HtmlParser } from '../ml_parser/html_parser';
10
- import { TokenizeOptions } from '../ml_parser/lexer';
11
- import { ParseTreeResult } from '../ml_parser/parser';
12
- import { Console } from '../util';
13
- export declare class I18NHtmlParser implements HtmlParser {
14
- private _htmlParser;
15
- getTagDefinition: any;
16
- private _translationBundle;
17
- constructor(_htmlParser: HtmlParser, translations?: string, translationsFormat?: string, missingTranslation?: MissingTranslationStrategy, console?: Console);
18
- parse(source: string, url: string, options?: TokenizeOptions): ParseTreeResult;
19
- }
@@ -1,18 +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 * as html from '../ml_parser/ast';
9
- import { InterpolationConfig } from '../ml_parser/interpolation_config';
10
- import * as i18n from './i18n_ast';
11
- export declare type VisitNodeFn = (html: html.Node, i18n: i18n.Node) => i18n.Node;
12
- export interface I18nMessageFactory {
13
- (nodes: html.Node[], meaning: string | undefined, description: string | undefined, customId: string | undefined, visitNodeFn?: VisitNodeFn): i18n.Message;
14
- }
15
- /**
16
- * Returns a function converting html nodes to an i18n Message given an interpolationConfig
17
- */
18
- export declare function createI18nMessageFactory(interpolationConfig: InterpolationConfig): I18nMessageFactory;