@angular/compiler 20.0.0-next.1 → 20.0.0-next.2
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/fesm2022/compiler.mjs +295 -360
- package/fesm2022/compiler.mjs.map +1 -1
- package/index.d.ts +4289 -4673
- package/package.json +5 -3
package/fesm2022/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v20.0.0-next.
|
|
2
|
+
* @license Angular v20.0.0-next.2
|
|
3
3
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -399,6 +399,10 @@ class SelectorContext {
|
|
|
399
399
|
}
|
|
400
400
|
|
|
401
401
|
// Attention:
|
|
402
|
+
// This file duplicates types and values from @angular/core
|
|
403
|
+
// so that we are able to make @angular/compiler independent of @angular/core.
|
|
404
|
+
// This is important to prevent a build cycle, as @angular/core needs to
|
|
405
|
+
// be compiled with the compiler.
|
|
402
406
|
// Stores the default value of `emitDistinctChangesOnly` when the `emitDistinctChangesOnly` is not
|
|
403
407
|
// explicitly set.
|
|
404
408
|
const emitDistinctChangesOnlyDefaultValue = true;
|
|
@@ -484,15 +488,15 @@ function parseSelectorToR3Selector(selector) {
|
|
|
484
488
|
|
|
485
489
|
var core = /*#__PURE__*/Object.freeze({
|
|
486
490
|
__proto__: null,
|
|
487
|
-
|
|
488
|
-
get ViewEncapsulation () { return ViewEncapsulation; },
|
|
491
|
+
CUSTOM_ELEMENTS_SCHEMA: CUSTOM_ELEMENTS_SCHEMA,
|
|
489
492
|
get ChangeDetectionStrategy () { return ChangeDetectionStrategy; },
|
|
490
493
|
get InputFlags () { return InputFlags; },
|
|
491
|
-
|
|
494
|
+
get MissingTranslationStrategy () { return MissingTranslationStrategy; },
|
|
492
495
|
NO_ERRORS_SCHEMA: NO_ERRORS_SCHEMA,
|
|
493
|
-
Type: Type$1,
|
|
494
496
|
get SecurityContext () { return SecurityContext; },
|
|
495
|
-
|
|
497
|
+
Type: Type$1,
|
|
498
|
+
get ViewEncapsulation () { return ViewEncapsulation; },
|
|
499
|
+
emitDistinctChangesOnlyDefaultValue: emitDistinctChangesOnlyDefaultValue,
|
|
496
500
|
parseSelectorToR3Selector: parseSelectorToR3Selector
|
|
497
501
|
});
|
|
498
502
|
|
|
@@ -663,7 +667,7 @@ function fingerprint(str) {
|
|
|
663
667
|
let lo = hash32(view, utf8.length, 102072);
|
|
664
668
|
if (hi == 0 && (lo == 0 || lo == 1)) {
|
|
665
669
|
hi = hi ^ 0x130f9bef;
|
|
666
|
-
lo = lo ^ -
|
|
670
|
+
lo = lo ^ -1801410264;
|
|
667
671
|
}
|
|
668
672
|
return (BigInt.asUintN(32, BigInt(hi)) << BigInt(32)) | BigInt.asUintN(32, BigInt(lo));
|
|
669
673
|
}
|
|
@@ -1993,7 +1997,7 @@ class IfStmt extends Statement {
|
|
|
1993
1997
|
return visitor.visitIfStmt(this, context);
|
|
1994
1998
|
}
|
|
1995
1999
|
}
|
|
1996
|
-
|
|
2000
|
+
let RecursiveAstVisitor$1 = class RecursiveAstVisitor {
|
|
1997
2001
|
visitType(ast, context) {
|
|
1998
2002
|
return ast;
|
|
1999
2003
|
}
|
|
@@ -2184,7 +2188,7 @@ class RecursiveAstVisitor$1 {
|
|
|
2184
2188
|
visitAllStatements(stmts, context) {
|
|
2185
2189
|
stmts.forEach((stmt) => stmt.visitStatement(this, context));
|
|
2186
2190
|
}
|
|
2187
|
-
}
|
|
2191
|
+
};
|
|
2188
2192
|
function leadingComment(text, multiline = false, trailingNewline = true) {
|
|
2189
2193
|
return new LeadingComment(text, multiline, trailingNewline);
|
|
2190
2194
|
}
|
|
@@ -2279,91 +2283,91 @@ function serializeTags(tags) {
|
|
|
2279
2283
|
|
|
2280
2284
|
var output_ast = /*#__PURE__*/Object.freeze({
|
|
2281
2285
|
__proto__: null,
|
|
2282
|
-
get TypeModifier () { return TypeModifier; },
|
|
2283
|
-
Type: Type,
|
|
2284
|
-
get BuiltinTypeName () { return BuiltinTypeName; },
|
|
2285
|
-
BuiltinType: BuiltinType,
|
|
2286
|
-
ExpressionType: ExpressionType,
|
|
2287
2286
|
ArrayType: ArrayType,
|
|
2288
|
-
|
|
2289
|
-
TransplantedType: TransplantedType,
|
|
2290
|
-
DYNAMIC_TYPE: DYNAMIC_TYPE,
|
|
2291
|
-
INFERRED_TYPE: INFERRED_TYPE,
|
|
2287
|
+
ArrowFunctionExpr: ArrowFunctionExpr,
|
|
2292
2288
|
BOOL_TYPE: BOOL_TYPE,
|
|
2293
|
-
INT_TYPE: INT_TYPE,
|
|
2294
|
-
NUMBER_TYPE: NUMBER_TYPE,
|
|
2295
|
-
STRING_TYPE: STRING_TYPE,
|
|
2296
|
-
FUNCTION_TYPE: FUNCTION_TYPE,
|
|
2297
|
-
NONE_TYPE: NONE_TYPE,
|
|
2298
|
-
get UnaryOperator () { return UnaryOperator; },
|
|
2299
2289
|
get BinaryOperator () { return BinaryOperator; },
|
|
2300
|
-
|
|
2301
|
-
|
|
2290
|
+
BinaryOperatorExpr: BinaryOperatorExpr,
|
|
2291
|
+
BuiltinType: BuiltinType,
|
|
2292
|
+
get BuiltinTypeName () { return BuiltinTypeName; },
|
|
2293
|
+
CommaExpr: CommaExpr,
|
|
2294
|
+
ConditionalExpr: ConditionalExpr,
|
|
2295
|
+
DYNAMIC_TYPE: DYNAMIC_TYPE,
|
|
2296
|
+
DeclareFunctionStmt: DeclareFunctionStmt,
|
|
2297
|
+
DeclareVarStmt: DeclareVarStmt,
|
|
2298
|
+
DynamicImportExpr: DynamicImportExpr,
|
|
2302
2299
|
Expression: Expression,
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
VoidExpr: VoidExpr,
|
|
2306
|
-
WrappedNodeExpr: WrappedNodeExpr,
|
|
2307
|
-
WriteVarExpr: WriteVarExpr,
|
|
2308
|
-
WriteKeyExpr: WriteKeyExpr,
|
|
2309
|
-
WritePropExpr: WritePropExpr,
|
|
2310
|
-
InvokeFunctionExpr: InvokeFunctionExpr,
|
|
2311
|
-
TaggedTemplateLiteralExpr: TaggedTemplateLiteralExpr,
|
|
2312
|
-
InstantiateExpr: InstantiateExpr,
|
|
2313
|
-
LiteralExpr: LiteralExpr,
|
|
2314
|
-
TemplateLiteralExpr: TemplateLiteralExpr,
|
|
2315
|
-
TemplateLiteralElementExpr: TemplateLiteralElementExpr,
|
|
2316
|
-
LiteralPiece: LiteralPiece,
|
|
2317
|
-
PlaceholderPiece: PlaceholderPiece,
|
|
2318
|
-
LocalizedString: LocalizedString,
|
|
2300
|
+
ExpressionStatement: ExpressionStatement,
|
|
2301
|
+
ExpressionType: ExpressionType,
|
|
2319
2302
|
ExternalExpr: ExternalExpr,
|
|
2320
2303
|
ExternalReference: ExternalReference,
|
|
2321
|
-
|
|
2322
|
-
DynamicImportExpr: DynamicImportExpr,
|
|
2323
|
-
NotExpr: NotExpr,
|
|
2304
|
+
FUNCTION_TYPE: FUNCTION_TYPE,
|
|
2324
2305
|
FnParam: FnParam,
|
|
2325
2306
|
FunctionExpr: FunctionExpr,
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2307
|
+
INFERRED_TYPE: INFERRED_TYPE,
|
|
2308
|
+
INT_TYPE: INT_TYPE,
|
|
2309
|
+
IfStmt: IfStmt,
|
|
2310
|
+
InstantiateExpr: InstantiateExpr,
|
|
2311
|
+
InvokeFunctionExpr: InvokeFunctionExpr,
|
|
2312
|
+
JSDocComment: JSDocComment,
|
|
2313
|
+
LeadingComment: LeadingComment,
|
|
2332
2314
|
LiteralArrayExpr: LiteralArrayExpr,
|
|
2315
|
+
LiteralExpr: LiteralExpr,
|
|
2333
2316
|
LiteralMapEntry: LiteralMapEntry,
|
|
2334
2317
|
LiteralMapExpr: LiteralMapExpr,
|
|
2335
|
-
|
|
2318
|
+
LiteralPiece: LiteralPiece,
|
|
2319
|
+
LocalizedString: LocalizedString,
|
|
2320
|
+
MapType: MapType,
|
|
2321
|
+
NONE_TYPE: NONE_TYPE,
|
|
2336
2322
|
NULL_EXPR: NULL_EXPR,
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
ExpressionStatement: ExpressionStatement,
|
|
2345
|
-
ReturnStatement: ReturnStatement,
|
|
2346
|
-
IfStmt: IfStmt,
|
|
2323
|
+
NUMBER_TYPE: NUMBER_TYPE,
|
|
2324
|
+
NotExpr: NotExpr,
|
|
2325
|
+
ParenthesizedExpr: ParenthesizedExpr,
|
|
2326
|
+
PlaceholderPiece: PlaceholderPiece,
|
|
2327
|
+
ReadKeyExpr: ReadKeyExpr,
|
|
2328
|
+
ReadPropExpr: ReadPropExpr,
|
|
2329
|
+
ReadVarExpr: ReadVarExpr,
|
|
2347
2330
|
RecursiveAstVisitor: RecursiveAstVisitor$1,
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2331
|
+
ReturnStatement: ReturnStatement,
|
|
2332
|
+
STRING_TYPE: STRING_TYPE,
|
|
2333
|
+
Statement: Statement,
|
|
2334
|
+
get StmtModifier () { return StmtModifier; },
|
|
2335
|
+
TYPED_NULL_EXPR: TYPED_NULL_EXPR,
|
|
2336
|
+
TaggedTemplateLiteralExpr: TaggedTemplateLiteralExpr,
|
|
2337
|
+
TemplateLiteralElementExpr: TemplateLiteralElementExpr,
|
|
2338
|
+
TemplateLiteralExpr: TemplateLiteralExpr,
|
|
2339
|
+
TransplantedType: TransplantedType,
|
|
2340
|
+
Type: Type,
|
|
2341
|
+
get TypeModifier () { return TypeModifier; },
|
|
2342
|
+
TypeofExpr: TypeofExpr,
|
|
2343
|
+
get UnaryOperator () { return UnaryOperator; },
|
|
2344
|
+
UnaryOperatorExpr: UnaryOperatorExpr,
|
|
2345
|
+
VoidExpr: VoidExpr,
|
|
2346
|
+
WrappedNodeExpr: WrappedNodeExpr,
|
|
2347
|
+
WriteKeyExpr: WriteKeyExpr,
|
|
2348
|
+
WritePropExpr: WritePropExpr,
|
|
2349
|
+
WriteVarExpr: WriteVarExpr,
|
|
2350
|
+
areAllEquivalent: areAllEquivalent,
|
|
2351
|
+
arrowFn: arrowFn,
|
|
2352
|
+
expressionType: expressionType,
|
|
2353
|
+
fn: fn,
|
|
2354
|
+
ifStmt: ifStmt,
|
|
2351
2355
|
importExpr: importExpr,
|
|
2352
2356
|
importType: importType,
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2357
|
+
isNull: isNull,
|
|
2358
|
+
jsDocComment: jsDocComment,
|
|
2359
|
+
leadingComment: leadingComment,
|
|
2360
|
+
literal: literal,
|
|
2356
2361
|
literalArr: literalArr,
|
|
2357
2362
|
literalMap: literalMap,
|
|
2358
|
-
|
|
2363
|
+
localizedString: localizedString,
|
|
2359
2364
|
not: not,
|
|
2360
|
-
|
|
2361
|
-
arrowFn: arrowFn,
|
|
2362
|
-
ifStmt: ifStmt,
|
|
2365
|
+
nullSafeIsEquivalent: nullSafeIsEquivalent,
|
|
2363
2366
|
taggedTemplate: taggedTemplate,
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
+
transplantedType: transplantedType,
|
|
2368
|
+
typeofExpr: typeofExpr,
|
|
2369
|
+
unary: unary,
|
|
2370
|
+
variable: variable
|
|
2367
2371
|
});
|
|
2368
2372
|
|
|
2369
2373
|
const CONSTANT_PREFIX = '_c';
|
|
@@ -3167,13 +3171,6 @@ function _splitAt(input, character, defaultValues) {
|
|
|
3167
3171
|
function noUndefined(val) {
|
|
3168
3172
|
return val === undefined ? null : val;
|
|
3169
3173
|
}
|
|
3170
|
-
function error(msg) {
|
|
3171
|
-
throw new Error(`Internal Error: ${msg}`);
|
|
3172
|
-
}
|
|
3173
|
-
// Escape characters that have a special meaning in Regular Expressions
|
|
3174
|
-
function escapeRegExp(s) {
|
|
3175
|
-
return s.replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
|
|
3176
|
-
}
|
|
3177
3174
|
function utf8Encode(str) {
|
|
3178
3175
|
let encoded = [];
|
|
3179
3176
|
for (let index = 0; index < str.length; index++) {
|
|
@@ -3244,29 +3241,6 @@ class Version {
|
|
|
3244
3241
|
}
|
|
3245
3242
|
}
|
|
3246
3243
|
const _global = globalThis;
|
|
3247
|
-
function newArray(size, value) {
|
|
3248
|
-
const list = [];
|
|
3249
|
-
for (let i = 0; i < size; i++) {
|
|
3250
|
-
list.push(value);
|
|
3251
|
-
}
|
|
3252
|
-
return list;
|
|
3253
|
-
}
|
|
3254
|
-
/**
|
|
3255
|
-
* Partitions a given array into 2 arrays, based on a boolean value returned by the condition
|
|
3256
|
-
* function.
|
|
3257
|
-
*
|
|
3258
|
-
* @param arr Input array that should be partitioned
|
|
3259
|
-
* @param conditionFn Condition function that is called for each item in a given array and returns a
|
|
3260
|
-
* boolean value.
|
|
3261
|
-
*/
|
|
3262
|
-
function partitionArray(arr, conditionFn) {
|
|
3263
|
-
const truthy = [];
|
|
3264
|
-
const falsy = [];
|
|
3265
|
-
for (const item of arr) {
|
|
3266
|
-
(conditionFn(item) ? truthy : falsy).push(item);
|
|
3267
|
-
}
|
|
3268
|
-
return [truthy, falsy];
|
|
3269
|
-
}
|
|
3270
3244
|
const V1_TO_18 = /^([1-9]|1[0-8])\./;
|
|
3271
3245
|
function getJitStandaloneDefaultForVersion(version) {
|
|
3272
3246
|
if (version.startsWith('0.')) {
|
|
@@ -3981,20 +3955,10 @@ function typeWithParameters(type, numParams) {
|
|
|
3981
3955
|
}
|
|
3982
3956
|
return expressionType(type, undefined, params);
|
|
3983
3957
|
}
|
|
3984
|
-
const ANIMATE_SYMBOL_PREFIX = '@';
|
|
3985
|
-
function prepareSyntheticPropertyName(name) {
|
|
3986
|
-
return `${ANIMATE_SYMBOL_PREFIX}${name}`;
|
|
3987
|
-
}
|
|
3988
|
-
function prepareSyntheticListenerName(name, phase) {
|
|
3989
|
-
return `${ANIMATE_SYMBOL_PREFIX}${name}.${phase}`;
|
|
3990
|
-
}
|
|
3991
3958
|
function getSafePropertyAccessString(accessor, name) {
|
|
3992
3959
|
const escapedName = escapeIdentifier(name, false, false);
|
|
3993
3960
|
return escapedName !== name ? `${accessor}[${escapedName}]` : `${accessor}.${name}`;
|
|
3994
3961
|
}
|
|
3995
|
-
function prepareSyntheticListenerFunctionName(name, phase) {
|
|
3996
|
-
return `animation_${name}_${phase}`;
|
|
3997
|
-
}
|
|
3998
3962
|
function jitOnlyGuardedExpression(expr) {
|
|
3999
3963
|
return guardedExpression('ngJitMode', expr);
|
|
4000
3964
|
}
|
|
@@ -4292,11 +4256,11 @@ class ASTWithName extends AST {
|
|
|
4292
4256
|
this.nameSpan = nameSpan;
|
|
4293
4257
|
}
|
|
4294
4258
|
}
|
|
4295
|
-
|
|
4259
|
+
let EmptyExpr$1 = class EmptyExpr extends AST {
|
|
4296
4260
|
visit(visitor, context = null) {
|
|
4297
4261
|
// do nothing
|
|
4298
4262
|
}
|
|
4299
|
-
}
|
|
4263
|
+
};
|
|
4300
4264
|
class ImplicitReceiver extends AST {
|
|
4301
4265
|
visit(visitor, context = null) {
|
|
4302
4266
|
return visitor.visitImplicitReceiver(this, context);
|
|
@@ -4464,7 +4428,7 @@ class LiteralMap extends AST {
|
|
|
4464
4428
|
return visitor.visitLiteralMap(this, context);
|
|
4465
4429
|
}
|
|
4466
4430
|
}
|
|
4467
|
-
|
|
4431
|
+
let Interpolation$1 = class Interpolation extends AST {
|
|
4468
4432
|
strings;
|
|
4469
4433
|
expressions;
|
|
4470
4434
|
constructor(span, sourceSpan, strings, expressions) {
|
|
@@ -4475,7 +4439,7 @@ class Interpolation$1 extends AST {
|
|
|
4475
4439
|
visit(visitor, context = null) {
|
|
4476
4440
|
return visitor.visitInterpolation(this, context);
|
|
4477
4441
|
}
|
|
4478
|
-
}
|
|
4442
|
+
};
|
|
4479
4443
|
class Binary extends AST {
|
|
4480
4444
|
operation;
|
|
4481
4445
|
left;
|
|
@@ -4633,6 +4597,16 @@ class TemplateLiteralElement extends AST {
|
|
|
4633
4597
|
return visitor.visitTemplateLiteralElement(this, context);
|
|
4634
4598
|
}
|
|
4635
4599
|
}
|
|
4600
|
+
class ParenthesizedExpression extends AST {
|
|
4601
|
+
expression;
|
|
4602
|
+
constructor(span, sourceSpan, expression) {
|
|
4603
|
+
super(span, sourceSpan);
|
|
4604
|
+
this.expression = expression;
|
|
4605
|
+
}
|
|
4606
|
+
visit(visitor, context) {
|
|
4607
|
+
return visitor.visitParenthesizedExpression(this, context);
|
|
4608
|
+
}
|
|
4609
|
+
}
|
|
4636
4610
|
/**
|
|
4637
4611
|
* Records the absolute position of a text span in a source file, where `start` and `end` are the
|
|
4638
4612
|
* starting and ending byte offsets, respectively, of the text span in a source file.
|
|
@@ -4799,6 +4773,9 @@ class RecursiveAstVisitor {
|
|
|
4799
4773
|
this.visit(ast.tag, context);
|
|
4800
4774
|
this.visit(ast.template, context);
|
|
4801
4775
|
}
|
|
4776
|
+
visitParenthesizedExpression(ast, context) {
|
|
4777
|
+
this.visit(ast.expression, context);
|
|
4778
|
+
}
|
|
4802
4779
|
// This is not part of the AstVisitor interface, just a helper method
|
|
4803
4780
|
visitAll(asts, context) {
|
|
4804
4781
|
for (const ast of asts) {
|
|
@@ -4960,7 +4937,7 @@ function mergeNsAndName(prefix, localName) {
|
|
|
4960
4937
|
* the top-level of the R3 AST, and only if `Render3ParseOptions['collectCommentNodes']`
|
|
4961
4938
|
* is true.
|
|
4962
4939
|
*/
|
|
4963
|
-
|
|
4940
|
+
let Comment$1 = class Comment {
|
|
4964
4941
|
value;
|
|
4965
4942
|
sourceSpan;
|
|
4966
4943
|
constructor(value, sourceSpan) {
|
|
@@ -4970,8 +4947,8 @@ class Comment$1 {
|
|
|
4970
4947
|
visit(_visitor) {
|
|
4971
4948
|
throw new Error('visit() not implemented for Comment');
|
|
4972
4949
|
}
|
|
4973
|
-
}
|
|
4974
|
-
|
|
4950
|
+
};
|
|
4951
|
+
let Text$3 = class Text {
|
|
4975
4952
|
value;
|
|
4976
4953
|
sourceSpan;
|
|
4977
4954
|
constructor(value, sourceSpan) {
|
|
@@ -4981,7 +4958,7 @@ class Text$3 {
|
|
|
4981
4958
|
visit(visitor) {
|
|
4982
4959
|
return visitor.visitText(this);
|
|
4983
4960
|
}
|
|
4984
|
-
}
|
|
4961
|
+
};
|
|
4985
4962
|
class BoundText {
|
|
4986
4963
|
value;
|
|
4987
4964
|
sourceSpan;
|
|
@@ -5082,7 +5059,7 @@ class BoundEvent {
|
|
|
5082
5059
|
return visitor.visitBoundEvent(this);
|
|
5083
5060
|
}
|
|
5084
5061
|
}
|
|
5085
|
-
|
|
5062
|
+
let Element$1 = class Element {
|
|
5086
5063
|
name;
|
|
5087
5064
|
attributes;
|
|
5088
5065
|
inputs;
|
|
@@ -5108,7 +5085,7 @@ class Element$1 {
|
|
|
5108
5085
|
visit(visitor) {
|
|
5109
5086
|
return visitor.visitElement(this);
|
|
5110
5087
|
}
|
|
5111
|
-
}
|
|
5088
|
+
};
|
|
5112
5089
|
class DeferredTrigger {
|
|
5113
5090
|
nameSpan;
|
|
5114
5091
|
sourceSpan;
|
|
@@ -5379,7 +5356,7 @@ class UnknownBlock {
|
|
|
5379
5356
|
return visitor.visitUnknownBlock(this);
|
|
5380
5357
|
}
|
|
5381
5358
|
}
|
|
5382
|
-
|
|
5359
|
+
let LetDeclaration$1 = class LetDeclaration {
|
|
5383
5360
|
name;
|
|
5384
5361
|
value;
|
|
5385
5362
|
sourceSpan;
|
|
@@ -5395,7 +5372,7 @@ class LetDeclaration$1 {
|
|
|
5395
5372
|
visit(visitor) {
|
|
5396
5373
|
return visitor.visitLetDeclaration(this);
|
|
5397
5374
|
}
|
|
5398
|
-
}
|
|
5375
|
+
};
|
|
5399
5376
|
class Template {
|
|
5400
5377
|
tagName;
|
|
5401
5378
|
attributes;
|
|
@@ -5484,7 +5461,7 @@ class Reference {
|
|
|
5484
5461
|
return visitor.visitReference(this);
|
|
5485
5462
|
}
|
|
5486
5463
|
}
|
|
5487
|
-
|
|
5464
|
+
let Icu$1 = class Icu {
|
|
5488
5465
|
vars;
|
|
5489
5466
|
placeholders;
|
|
5490
5467
|
sourceSpan;
|
|
@@ -5498,8 +5475,8 @@ class Icu$1 {
|
|
|
5498
5475
|
visit(visitor) {
|
|
5499
5476
|
return visitor.visitIcu(this);
|
|
5500
5477
|
}
|
|
5501
|
-
}
|
|
5502
|
-
|
|
5478
|
+
};
|
|
5479
|
+
let RecursiveVisitor$1 = class RecursiveVisitor {
|
|
5503
5480
|
visitElement(element) {
|
|
5504
5481
|
visitAll$1(this, element.attributes);
|
|
5505
5482
|
visitAll$1(this, element.inputs);
|
|
@@ -5563,7 +5540,7 @@ class RecursiveVisitor$1 {
|
|
|
5563
5540
|
visitDeferredTrigger(trigger) { }
|
|
5564
5541
|
visitUnknownBlock(block) { }
|
|
5565
5542
|
visitLetDeclaration(decl) { }
|
|
5566
|
-
}
|
|
5543
|
+
};
|
|
5567
5544
|
function visitAll$1(visitor, nodes) {
|
|
5568
5545
|
const result = [];
|
|
5569
5546
|
if (visitor.visit) {
|
|
@@ -5627,7 +5604,7 @@ class Message {
|
|
|
5627
5604
|
}
|
|
5628
5605
|
}
|
|
5629
5606
|
}
|
|
5630
|
-
|
|
5607
|
+
let Text$2 = class Text {
|
|
5631
5608
|
value;
|
|
5632
5609
|
sourceSpan;
|
|
5633
5610
|
constructor(value, sourceSpan) {
|
|
@@ -5637,7 +5614,7 @@ class Text$2 {
|
|
|
5637
5614
|
visit(visitor, context) {
|
|
5638
5615
|
return visitor.visitText(this, context);
|
|
5639
5616
|
}
|
|
5640
|
-
}
|
|
5617
|
+
};
|
|
5641
5618
|
// TODO(vicb): do we really need this node (vs an array) ?
|
|
5642
5619
|
class Container {
|
|
5643
5620
|
children;
|
|
@@ -5900,7 +5877,7 @@ class SimplePlaceholderMapper extends RecurseVisitor {
|
|
|
5900
5877
|
}
|
|
5901
5878
|
}
|
|
5902
5879
|
|
|
5903
|
-
|
|
5880
|
+
let _Visitor$2 = class _Visitor {
|
|
5904
5881
|
visitTag(tag) {
|
|
5905
5882
|
const strAttrs = this._serializeAttributes(tag.attrs);
|
|
5906
5883
|
if (tag.children.length == 0) {
|
|
@@ -5924,7 +5901,7 @@ class _Visitor$2 {
|
|
|
5924
5901
|
visitDoctype(doctype) {
|
|
5925
5902
|
return `<!DOCTYPE ${doctype.rootTag} [\n${doctype.dtd}\n]>`;
|
|
5926
5903
|
}
|
|
5927
|
-
}
|
|
5904
|
+
};
|
|
5928
5905
|
const _visitor = new _Visitor$2();
|
|
5929
5906
|
function serialize$1(nodes) {
|
|
5930
5907
|
return nodes.map((node) => node.visit(_visitor)).join('');
|
|
@@ -5966,7 +5943,7 @@ class Tag {
|
|
|
5966
5943
|
return visitor.visitTag(this);
|
|
5967
5944
|
}
|
|
5968
5945
|
}
|
|
5969
|
-
|
|
5946
|
+
let Text$1 = class Text {
|
|
5970
5947
|
value;
|
|
5971
5948
|
constructor(unescapedValue) {
|
|
5972
5949
|
this.value = escapeXml(unescapedValue);
|
|
@@ -5974,7 +5951,7 @@ class Text$1 {
|
|
|
5974
5951
|
visit(visitor) {
|
|
5975
5952
|
return visitor.visitText(this);
|
|
5976
5953
|
}
|
|
5977
|
-
}
|
|
5954
|
+
};
|
|
5978
5955
|
class CR extends Text$1 {
|
|
5979
5956
|
constructor(ws = 0) {
|
|
5980
5957
|
super(`\n${new Array(ws + 1).join(' ')}`);
|
|
@@ -6066,7 +6043,7 @@ class Xmb extends Serializer {
|
|
|
6066
6043
|
return new SimplePlaceholderMapper(message, toPublicName);
|
|
6067
6044
|
}
|
|
6068
6045
|
}
|
|
6069
|
-
|
|
6046
|
+
let _Visitor$1 = class _Visitor {
|
|
6070
6047
|
visitText(text, context) {
|
|
6071
6048
|
return [new Text$1(text.value)];
|
|
6072
6049
|
}
|
|
@@ -6140,7 +6117,7 @@ class _Visitor$1 {
|
|
|
6140
6117
|
serialize(nodes) {
|
|
6141
6118
|
return [].concat(...nodes.map((node) => node.visit(this)));
|
|
6142
6119
|
}
|
|
6143
|
-
}
|
|
6120
|
+
};
|
|
6144
6121
|
function digest(message) {
|
|
6145
6122
|
return decimalDigest(message);
|
|
6146
6123
|
}
|
|
@@ -6184,13 +6161,6 @@ function hasI18nAttrs(element) {
|
|
|
6184
6161
|
function icuFromI18nMessage(message) {
|
|
6185
6162
|
return message.nodes[0];
|
|
6186
6163
|
}
|
|
6187
|
-
function placeholdersToParams(placeholders) {
|
|
6188
|
-
const params = {};
|
|
6189
|
-
placeholders.forEach((values, key) => {
|
|
6190
|
-
params[key] = literal(values.length > 1 ? `[${values.join('|')}]` : values[0]);
|
|
6191
|
-
});
|
|
6192
|
-
return params;
|
|
6193
|
-
}
|
|
6194
6164
|
/**
|
|
6195
6165
|
* Format the placeholder names in a map of placeholders to expressions.
|
|
6196
6166
|
*
|
|
@@ -6268,9 +6238,6 @@ function temporaryAllocator(pushStatement, name) {
|
|
|
6268
6238
|
return temp;
|
|
6269
6239
|
};
|
|
6270
6240
|
}
|
|
6271
|
-
function invalid(arg) {
|
|
6272
|
-
throw new Error(`Invalid state: Visitor ${this.constructor.name} doesn't handle ${arg.constructor.name}`);
|
|
6273
|
-
}
|
|
6274
6241
|
function asLiteral(value) {
|
|
6275
6242
|
if (Array.isArray(value)) {
|
|
6276
6243
|
return literalArr(value.map(asLiteral));
|
|
@@ -6638,8 +6605,6 @@ const $LBRACE = 123;
|
|
|
6638
6605
|
const $BAR = 124;
|
|
6639
6606
|
const $RBRACE = 125;
|
|
6640
6607
|
const $NBSP = 160;
|
|
6641
|
-
const $PIPE = 124;
|
|
6642
|
-
const $TILDA = 126;
|
|
6643
6608
|
const $AT = 64;
|
|
6644
6609
|
const $BT = 96;
|
|
6645
6610
|
function isWhitespace(code) {
|
|
@@ -7352,9 +7317,7 @@ function compileNgModule(meta) {
|
|
|
7352
7317
|
statements.push(setNgModuleScopeCall);
|
|
7353
7318
|
}
|
|
7354
7319
|
}
|
|
7355
|
-
else
|
|
7356
|
-
// Selector scope emit was not requested, so skip it.
|
|
7357
|
-
}
|
|
7320
|
+
else ;
|
|
7358
7321
|
if (meta.schemas !== null && meta.schemas.length > 0) {
|
|
7359
7322
|
definitionMap.set('schemas', literalArr(meta.schemas.map((ref) => ref.value)));
|
|
7360
7323
|
}
|
|
@@ -10547,9 +10510,7 @@ function transformExpressionsInExpression(expr, transform, flags) {
|
|
|
10547
10510
|
expr.body = transformExpressionsInExpression(expr.body, transform, flags);
|
|
10548
10511
|
}
|
|
10549
10512
|
}
|
|
10550
|
-
else if (expr instanceof WrappedNodeExpr)
|
|
10551
|
-
// TODO: Do we need to transform any TS nodes nested inside of this expression?
|
|
10552
|
-
}
|
|
10513
|
+
else if (expr instanceof WrappedNodeExpr) ;
|
|
10553
10514
|
else if (expr instanceof TemplateLiteralExpr) {
|
|
10554
10515
|
for (let i = 0; i < expr.expressions.length; i++) {
|
|
10555
10516
|
expr.expressions[i] = transformExpressionsInExpression(expr.expressions[i], transform, flags);
|
|
@@ -10560,9 +10521,7 @@ function transformExpressionsInExpression(expr, transform, flags) {
|
|
|
10560
10521
|
}
|
|
10561
10522
|
else if (expr instanceof ReadVarExpr ||
|
|
10562
10523
|
expr instanceof ExternalExpr ||
|
|
10563
|
-
expr instanceof LiteralExpr)
|
|
10564
|
-
// No action for these types.
|
|
10565
|
-
}
|
|
10524
|
+
expr instanceof LiteralExpr) ;
|
|
10566
10525
|
else {
|
|
10567
10526
|
throw new Error(`Unhandled expression kind: ${expr.constructor.name}`);
|
|
10568
10527
|
}
|
|
@@ -12465,11 +12424,6 @@ function deduplicateTextBindings(job) {
|
|
|
12465
12424
|
OpList.remove(op);
|
|
12466
12425
|
}
|
|
12467
12426
|
}
|
|
12468
|
-
else {
|
|
12469
|
-
// TODO: Determine the correct behavior. It would probably make sense to merge multiple
|
|
12470
|
-
// style and class attributes. Alternatively we could just throw an error, as HTML
|
|
12471
|
-
// doesn't permit duplicate attributes.
|
|
12472
|
-
}
|
|
12473
12427
|
}
|
|
12474
12428
|
seenForElement.add(op.name);
|
|
12475
12429
|
seen.set(op.target, seenForElement);
|
|
@@ -12600,9 +12554,9 @@ function resolveDeferTargetNames(job) {
|
|
|
12600
12554
|
}
|
|
12601
12555
|
}
|
|
12602
12556
|
}
|
|
12603
|
-
|
|
12557
|
+
let Scope$1 = class Scope {
|
|
12604
12558
|
targets = new Map();
|
|
12605
|
-
}
|
|
12559
|
+
};
|
|
12606
12560
|
|
|
12607
12561
|
const REPLACEMENTS = new Map([
|
|
12608
12562
|
[OpKind.ElementEnd, [OpKind.ElementStart, OpKind.Element]],
|
|
@@ -12658,14 +12612,6 @@ function expandSafeReads(job) {
|
|
|
12658
12612
|
}
|
|
12659
12613
|
}
|
|
12660
12614
|
}
|
|
12661
|
-
// A lookup set of all the expression kinds that require a temporary variable to be generated.
|
|
12662
|
-
const requiresTemporary = [
|
|
12663
|
-
InvokeFunctionExpr,
|
|
12664
|
-
LiteralArrayExpr,
|
|
12665
|
-
LiteralMapExpr,
|
|
12666
|
-
SafeInvokeFunctionExpr,
|
|
12667
|
-
PipeBindingExpr,
|
|
12668
|
-
].map((e) => e.constructor.name);
|
|
12669
12615
|
function needsTemporaryInSafeAccess(e) {
|
|
12670
12616
|
// TODO: We probably want to use an expression visitor to recursively visit all descendents.
|
|
12671
12617
|
// However, that would potentially do a lot of extra work (because it cannot short circuit), so we
|
|
@@ -12693,6 +12639,9 @@ function needsTemporaryInSafeAccess(e) {
|
|
|
12693
12639
|
else if (e instanceof ReadKeyExpr) {
|
|
12694
12640
|
return needsTemporaryInSafeAccess(e.receiver) || needsTemporaryInSafeAccess(e.index);
|
|
12695
12641
|
}
|
|
12642
|
+
else if (e instanceof ParenthesizedExpr) {
|
|
12643
|
+
return needsTemporaryInSafeAccess(e.expr);
|
|
12644
|
+
}
|
|
12696
12645
|
// TODO: Switch to a method which is exhaustive of newly added expression subtypes.
|
|
12697
12646
|
return (e instanceof InvokeFunctionExpr ||
|
|
12698
12647
|
e instanceof LiteralArrayExpr ||
|
|
@@ -12823,7 +12772,7 @@ function ternaryTransform(e) {
|
|
|
12823
12772
|
if (!(e instanceof SafeTernaryExpr)) {
|
|
12824
12773
|
return e;
|
|
12825
12774
|
}
|
|
12826
|
-
return new ConditionalExpr(new BinaryOperatorExpr(BinaryOperator.Equals, e.guard, NULL_EXPR), NULL_EXPR, e.expr);
|
|
12775
|
+
return new ParenthesizedExpr(new ConditionalExpr(new BinaryOperatorExpr(BinaryOperator.Equals, e.guard, NULL_EXPR), NULL_EXPR, e.expr));
|
|
12827
12776
|
}
|
|
12828
12777
|
|
|
12829
12778
|
/**
|
|
@@ -12937,7 +12886,7 @@ function createI18nMessage(job, context, messagePlaceholder) {
|
|
|
12937
12886
|
let formattedParams = formatParams(context.params);
|
|
12938
12887
|
const formattedPostprocessingParams = formatParams(context.postprocessingParams);
|
|
12939
12888
|
let needsPostprocessing = [...context.params.values()].some((v) => v.length > 1);
|
|
12940
|
-
return createI18nMessageOp(job.allocateXrefId(), context.xref, context.i18nBlock, context.message,
|
|
12889
|
+
return createI18nMessageOp(job.allocateXrefId(), context.xref, context.i18nBlock, context.message, null, formattedParams, formattedPostprocessingParams, needsPostprocessing);
|
|
12941
12890
|
}
|
|
12942
12891
|
/**
|
|
12943
12892
|
* Formats an ICU placeholder into a single string with expression placeholders.
|
|
@@ -13409,9 +13358,6 @@ function parseProperty(name) {
|
|
|
13409
13358
|
return { property, suffix };
|
|
13410
13359
|
}
|
|
13411
13360
|
|
|
13412
|
-
function mapEntry(key, value) {
|
|
13413
|
-
return { key, value, quoted: false };
|
|
13414
|
-
}
|
|
13415
13361
|
function mapLiteral(obj, quoted = false) {
|
|
13416
13362
|
return literalMap(Object.keys(obj).map((key) => ({
|
|
13417
13363
|
key,
|
|
@@ -17031,7 +16977,7 @@ class ParseTreeResult {
|
|
|
17031
16977
|
this.errors = errors;
|
|
17032
16978
|
}
|
|
17033
16979
|
}
|
|
17034
|
-
|
|
16980
|
+
let Parser$1 = class Parser {
|
|
17035
16981
|
getTagDefinition;
|
|
17036
16982
|
constructor(getTagDefinition) {
|
|
17037
16983
|
this.getTagDefinition = getTagDefinition;
|
|
@@ -17042,7 +16988,7 @@ class Parser$1 {
|
|
|
17042
16988
|
parser.build();
|
|
17043
16989
|
return new ParseTreeResult(parser.rootNodes, tokenizeResult.errors.concat(parser.errors));
|
|
17044
16990
|
}
|
|
17045
|
-
}
|
|
16991
|
+
};
|
|
17046
16992
|
class _TreeBuilder {
|
|
17047
16993
|
tokens;
|
|
17048
16994
|
getTagDefinition;
|
|
@@ -17723,9 +17669,6 @@ function transformTextToken({ type, parts, sourceSpan }, transform) {
|
|
|
17723
17669
|
function processWhitespace(text) {
|
|
17724
17670
|
return replaceNgsp(text).replace(WS_REPLACE_REGEXP, ' ');
|
|
17725
17671
|
}
|
|
17726
|
-
function removeWhitespaces(htmlAstWithErrors, preserveSignificantWhitespace) {
|
|
17727
|
-
return new ParseTreeResult(visitAllWithSiblings(new WhitespaceVisitor(preserveSignificantWhitespace), htmlAstWithErrors.rootNodes), htmlAstWithErrors.errors);
|
|
17728
|
-
}
|
|
17729
17672
|
function visitAllWithSiblings(visitor, nodes) {
|
|
17730
17673
|
const result = [];
|
|
17731
17674
|
nodes.forEach((ast, i) => {
|
|
@@ -18078,9 +18021,7 @@ class _Scanner {
|
|
|
18078
18021
|
let hasSeparators = false;
|
|
18079
18022
|
this.advance(); // Skip initial digit.
|
|
18080
18023
|
while (true) {
|
|
18081
|
-
if (isDigit(this.peek))
|
|
18082
|
-
// Do nothing.
|
|
18083
|
-
}
|
|
18024
|
+
if (isDigit(this.peek)) ;
|
|
18084
18025
|
else if (this.peek === $_) {
|
|
18085
18026
|
// Separators are only valid when they're surrounded by digits. E.g. `1_0_1` is
|
|
18086
18027
|
// valid while `_101` and `101_` are not. The separator can't be next to the decimal
|
|
@@ -18554,7 +18495,6 @@ class _ParseAST {
|
|
|
18554
18495
|
parseFlags;
|
|
18555
18496
|
errors;
|
|
18556
18497
|
offset;
|
|
18557
|
-
lastUnary = null;
|
|
18558
18498
|
rparensExpected = 0;
|
|
18559
18499
|
rbracketsExpected = 0;
|
|
18560
18500
|
rbracesExpected = 0;
|
|
@@ -18945,7 +18885,10 @@ class _ParseAST {
|
|
|
18945
18885
|
// This aligns with Javascript semantics which require any unary operator preceeding the
|
|
18946
18886
|
// exponentiation operation to be explicitly grouped as either applying to the base or result
|
|
18947
18887
|
// of the exponentiation operation.
|
|
18948
|
-
if (result
|
|
18888
|
+
if (result instanceof Unary ||
|
|
18889
|
+
result instanceof PrefixNot ||
|
|
18890
|
+
result instanceof TypeofExpression ||
|
|
18891
|
+
result instanceof VoidExpression) {
|
|
18949
18892
|
this.error('Unary operator used immediately before exponentiation expression. Parenthesis must be used to disambiguate operator precedence');
|
|
18950
18893
|
}
|
|
18951
18894
|
this.advance();
|
|
@@ -18963,28 +18906,28 @@ class _ParseAST {
|
|
|
18963
18906
|
case '+':
|
|
18964
18907
|
this.advance();
|
|
18965
18908
|
result = this.parsePrefix();
|
|
18966
|
-
return
|
|
18909
|
+
return Unary.createPlus(this.span(start), this.sourceSpan(start), result);
|
|
18967
18910
|
case '-':
|
|
18968
18911
|
this.advance();
|
|
18969
18912
|
result = this.parsePrefix();
|
|
18970
|
-
return
|
|
18913
|
+
return Unary.createMinus(this.span(start), this.sourceSpan(start), result);
|
|
18971
18914
|
case '!':
|
|
18972
18915
|
this.advance();
|
|
18973
18916
|
result = this.parsePrefix();
|
|
18974
|
-
return
|
|
18917
|
+
return new PrefixNot(this.span(start), this.sourceSpan(start), result);
|
|
18975
18918
|
}
|
|
18976
18919
|
}
|
|
18977
18920
|
else if (this.next.isKeywordTypeof()) {
|
|
18978
18921
|
this.advance();
|
|
18979
18922
|
const start = this.inputIndex;
|
|
18980
18923
|
let result = this.parsePrefix();
|
|
18981
|
-
return
|
|
18924
|
+
return new TypeofExpression(this.span(start), this.sourceSpan(start), result);
|
|
18982
18925
|
}
|
|
18983
18926
|
else if (this.next.isKeywordVoid()) {
|
|
18984
18927
|
this.advance();
|
|
18985
18928
|
const start = this.inputIndex;
|
|
18986
18929
|
let result = this.parsePrefix();
|
|
18987
|
-
return
|
|
18930
|
+
return new VoidExpression(this.span(start), this.sourceSpan(start), result);
|
|
18988
18931
|
}
|
|
18989
18932
|
return this.parseCallChain();
|
|
18990
18933
|
}
|
|
@@ -19031,9 +18974,8 @@ class _ParseAST {
|
|
|
19031
18974
|
this.rparensExpected++;
|
|
19032
18975
|
const result = this.parsePipe();
|
|
19033
18976
|
this.rparensExpected--;
|
|
19034
|
-
this.lastUnary = null;
|
|
19035
18977
|
this.expectCharacter($RPAREN);
|
|
19036
|
-
return result;
|
|
18978
|
+
return new ParenthesizedExpression(this.span(start), this.sourceSpan(start), result);
|
|
19037
18979
|
}
|
|
19038
18980
|
else if (this.next.isKeywordNull()) {
|
|
19039
18981
|
this.advance();
|
|
@@ -19410,9 +19352,10 @@ class _ParseAST {
|
|
|
19410
19352
|
}
|
|
19411
19353
|
parseNoInterpolationTemplateLiteral() {
|
|
19412
19354
|
const text = this.next.strValue;
|
|
19355
|
+
const start = this.inputIndex;
|
|
19413
19356
|
this.advance();
|
|
19414
|
-
const span = this.span(
|
|
19415
|
-
const sourceSpan = this.sourceSpan(
|
|
19357
|
+
const span = this.span(start);
|
|
19358
|
+
const sourceSpan = this.sourceSpan(start);
|
|
19416
19359
|
return new TemplateLiteral(span, sourceSpan, [new TemplateLiteralElement(span, sourceSpan, text)], []);
|
|
19417
19360
|
}
|
|
19418
19361
|
parseTaggedTemplateLiteral(tag, start) {
|
|
@@ -19426,8 +19369,9 @@ class _ParseAST {
|
|
|
19426
19369
|
while (this.next !== EOF) {
|
|
19427
19370
|
const token = this.next;
|
|
19428
19371
|
if (token.isTemplateLiteralPart() || token.isTemplateLiteralEnd()) {
|
|
19429
|
-
|
|
19372
|
+
const partStart = this.inputIndex;
|
|
19430
19373
|
this.advance();
|
|
19374
|
+
elements.push(new TemplateLiteralElement(this.span(partStart), this.sourceSpan(partStart), token.strValue));
|
|
19431
19375
|
if (token.isTemplateLiteralEnd()) {
|
|
19432
19376
|
break;
|
|
19433
19377
|
}
|
|
@@ -19686,6 +19630,9 @@ class SerializeExpressionVisitor {
|
|
|
19686
19630
|
visitTaggedTemplateLiteral(ast, context) {
|
|
19687
19631
|
return ast.tag.visit(this, context) + ast.template.visit(this, context);
|
|
19688
19632
|
}
|
|
19633
|
+
visitParenthesizedExpression(ast, context) {
|
|
19634
|
+
return '(' + ast.expression.visit(this, context) + ')';
|
|
19635
|
+
}
|
|
19689
19636
|
}
|
|
19690
19637
|
/** Zips the two input arrays into a single array of pairs of elements at the same index. */
|
|
19691
19638
|
function zip(left, right) {
|
|
@@ -23237,7 +23184,17 @@ const PURE_FUNCTION_CONFIG = {
|
|
|
23237
23184
|
mapping: (n) => n,
|
|
23238
23185
|
};
|
|
23239
23186
|
function callVariadicInstructionExpr(config, baseArgs, interpolationArgs, extraArgs, sourceSpan) {
|
|
23187
|
+
// mapping need to be done before potentially dropping the last interpolation argument
|
|
23240
23188
|
const n = config.mapping(interpolationArgs.length);
|
|
23189
|
+
// In the case the interpolation instruction ends with a empty string we drop it
|
|
23190
|
+
// And the runtime will take care of it.
|
|
23191
|
+
const lastInterpolationArg = interpolationArgs.at(-1);
|
|
23192
|
+
if (extraArgs.length === 0 &&
|
|
23193
|
+
interpolationArgs.length > 1 &&
|
|
23194
|
+
lastInterpolationArg instanceof LiteralExpr &&
|
|
23195
|
+
lastInterpolationArg.value === '') {
|
|
23196
|
+
interpolationArgs.pop();
|
|
23197
|
+
}
|
|
23241
23198
|
if (n < config.constant.length) {
|
|
23242
23199
|
// Constant calling pattern.
|
|
23243
23200
|
return importExpr(config.constant[n])
|
|
@@ -23278,31 +23235,6 @@ function reify(job) {
|
|
|
23278
23235
|
reifyUpdateOperations(unit, unit.update);
|
|
23279
23236
|
}
|
|
23280
23237
|
}
|
|
23281
|
-
/**
|
|
23282
|
-
* This function can be used a sanity check -- it walks every expression in the const pool, and
|
|
23283
|
-
* every expression reachable from an op, and makes sure that there are no IR expressions
|
|
23284
|
-
* left. This is nice to use for debugging mysterious failures where an IR expression cannot be
|
|
23285
|
-
* output from the output AST code.
|
|
23286
|
-
*/
|
|
23287
|
-
function ensureNoIrForDebug(job) {
|
|
23288
|
-
for (const stmt of job.pool.statements) {
|
|
23289
|
-
transformExpressionsInStatement(stmt, (expr) => {
|
|
23290
|
-
if (isIrExpression(expr)) {
|
|
23291
|
-
throw new Error(`AssertionError: IR expression found during reify: ${ExpressionKind[expr.kind]}`);
|
|
23292
|
-
}
|
|
23293
|
-
return expr;
|
|
23294
|
-
}, VisitorContextFlag.None);
|
|
23295
|
-
}
|
|
23296
|
-
for (const unit of job.units) {
|
|
23297
|
-
for (const op of unit.ops()) {
|
|
23298
|
-
visitExpressionsInOp(op, (expr) => {
|
|
23299
|
-
if (isIrExpression(expr)) {
|
|
23300
|
-
throw new Error(`AssertionError: IR expression found during reify: ${ExpressionKind[expr.kind]}`);
|
|
23301
|
-
}
|
|
23302
|
-
});
|
|
23303
|
-
}
|
|
23304
|
-
}
|
|
23305
|
-
}
|
|
23306
23238
|
function reifyCreateOperations(unit, ops) {
|
|
23307
23239
|
for (const op of ops) {
|
|
23308
23240
|
transformExpressionsInOp(op, reifyIrExpression, VisitorContextFlag.None);
|
|
@@ -23830,57 +23762,6 @@ function removeUnusedI18nAttributesOps(job) {
|
|
|
23830
23762
|
}
|
|
23831
23763
|
}
|
|
23832
23764
|
|
|
23833
|
-
// TODO: create AST for parentheses when parsing, then we can remove the unnecessary ones instead of
|
|
23834
|
-
// adding them out of thin air. This should simplify the parsing and give us valid spans for the
|
|
23835
|
-
// parentheses.
|
|
23836
|
-
/**
|
|
23837
|
-
* In some cases we need to add parentheses to expressions for them to be considered valid
|
|
23838
|
-
* JavaScript. This phase adds parentheses to cover such cases. Currently these cases are:
|
|
23839
|
-
*
|
|
23840
|
-
* 1. Unary operators in the base of an exponentiation expression. For example, `-2 ** 3` is not
|
|
23841
|
-
* valid JavaScript, but `(-2) ** 3` is.
|
|
23842
|
-
* 2. When mixing nullish coalescing (`??`) and logical and/or operators (`&&`, `||`), we need to
|
|
23843
|
-
* add parentheses. For example, `a ?? b && c` is not valid JavaScript, but `a ?? (b && c)` is.
|
|
23844
|
-
* 3. Safe property access that has been down-leveled into a ternary expression needs parentheses
|
|
23845
|
-
* when used with nullish coalescing.
|
|
23846
|
-
*/
|
|
23847
|
-
function requiredParentheses(job) {
|
|
23848
|
-
for (const unit of job.units) {
|
|
23849
|
-
for (const op of unit.ops()) {
|
|
23850
|
-
transformExpressionsInOp(op, (expr) => {
|
|
23851
|
-
if (expr instanceof BinaryOperatorExpr) {
|
|
23852
|
-
switch (expr.operator) {
|
|
23853
|
-
case BinaryOperator.Exponentiation:
|
|
23854
|
-
parenthesizeExponentiation(expr);
|
|
23855
|
-
break;
|
|
23856
|
-
case BinaryOperator.NullishCoalesce:
|
|
23857
|
-
parenthesizeNullishCoalescing(expr);
|
|
23858
|
-
break;
|
|
23859
|
-
}
|
|
23860
|
-
}
|
|
23861
|
-
return expr;
|
|
23862
|
-
}, VisitorContextFlag.None);
|
|
23863
|
-
}
|
|
23864
|
-
}
|
|
23865
|
-
}
|
|
23866
|
-
function parenthesizeExponentiation(expr) {
|
|
23867
|
-
if (expr.lhs instanceof UnaryOperatorExpr) {
|
|
23868
|
-
expr.lhs = new ParenthesizedExpr(expr.lhs);
|
|
23869
|
-
}
|
|
23870
|
-
}
|
|
23871
|
-
function parenthesizeNullishCoalescing(expr) {
|
|
23872
|
-
if (isLogicalAndOr(expr.lhs) || expr.lhs instanceof ConditionalExpr) {
|
|
23873
|
-
expr.lhs = new ParenthesizedExpr(expr.lhs);
|
|
23874
|
-
}
|
|
23875
|
-
if (isLogicalAndOr(expr.rhs) || expr.rhs instanceof ConditionalExpr) {
|
|
23876
|
-
expr.rhs = new ParenthesizedExpr(expr.rhs);
|
|
23877
|
-
}
|
|
23878
|
-
}
|
|
23879
|
-
function isLogicalAndOr(expr) {
|
|
23880
|
-
return (expr instanceof BinaryOperatorExpr &&
|
|
23881
|
-
(expr.operator === BinaryOperator.And || expr.operator === BinaryOperator.Or));
|
|
23882
|
-
}
|
|
23883
|
-
|
|
23884
23765
|
/**
|
|
23885
23766
|
* Resolves `ir.ContextExpr` expressions (which represent embedded view or component contexts) to
|
|
23886
23767
|
* either the `ctx` parameter to component functions (for the current view context) or to variables
|
|
@@ -24679,6 +24560,73 @@ function optimizeStoreLet(job) {
|
|
|
24679
24560
|
}
|
|
24680
24561
|
}
|
|
24681
24562
|
|
|
24563
|
+
/**
|
|
24564
|
+
* In most cases we can drop user added parentheses from expressions. However, in some cases
|
|
24565
|
+
* parentheses are needed for the expression to be considered valid JavaScript or for Typescript to
|
|
24566
|
+
* generate the correct output. This phases strips all parentheses except in the following
|
|
24567
|
+
* siturations where they are required:
|
|
24568
|
+
*
|
|
24569
|
+
* 1. Unary operators in the base of an exponentiation expression. For example, `-2 ** 3` is not
|
|
24570
|
+
* valid JavaScript, but `(-2) ** 3` is.
|
|
24571
|
+
* 2. When mixing nullish coalescing (`??`) and logical and/or operators (`&&`, `||`), we need
|
|
24572
|
+
* parentheses. For example, `a ?? b && c` is not valid JavaScript, but `a ?? (b && c)` is.
|
|
24573
|
+
* 3. Ternary expression used as an operand for nullish coalescing. Typescript generates incorrect
|
|
24574
|
+
* code if the parentheses are missing. For example when `(a ? b : c) ?? d` is translated to
|
|
24575
|
+
* typescript AST, the parentheses node is removed, and then the remaining AST is printed, it
|
|
24576
|
+
* incorrectly prints `a ? b : c ?? d`. This is different from how it handles the same situation
|
|
24577
|
+
* with `||` and `&&` where it prints the parentheses even if they are not present in the AST.
|
|
24578
|
+
*/
|
|
24579
|
+
function stripNonrequiredParentheses(job) {
|
|
24580
|
+
// Check which parentheses are required.
|
|
24581
|
+
const requiredParens = new Set();
|
|
24582
|
+
for (const unit of job.units) {
|
|
24583
|
+
for (const op of unit.ops()) {
|
|
24584
|
+
visitExpressionsInOp(op, (expr) => {
|
|
24585
|
+
if (expr instanceof BinaryOperatorExpr) {
|
|
24586
|
+
switch (expr.operator) {
|
|
24587
|
+
case BinaryOperator.Exponentiation:
|
|
24588
|
+
checkExponentiationParens(expr, requiredParens);
|
|
24589
|
+
break;
|
|
24590
|
+
case BinaryOperator.NullishCoalesce:
|
|
24591
|
+
checkNullishCoalescingParens(expr, requiredParens);
|
|
24592
|
+
break;
|
|
24593
|
+
}
|
|
24594
|
+
}
|
|
24595
|
+
});
|
|
24596
|
+
}
|
|
24597
|
+
}
|
|
24598
|
+
// Remove any non-required parentheses.
|
|
24599
|
+
for (const unit of job.units) {
|
|
24600
|
+
for (const op of unit.ops()) {
|
|
24601
|
+
transformExpressionsInOp(op, (expr) => {
|
|
24602
|
+
if (expr instanceof ParenthesizedExpr) {
|
|
24603
|
+
return requiredParens.has(expr) ? expr : expr.expr;
|
|
24604
|
+
}
|
|
24605
|
+
return expr;
|
|
24606
|
+
}, VisitorContextFlag.None);
|
|
24607
|
+
}
|
|
24608
|
+
}
|
|
24609
|
+
}
|
|
24610
|
+
function checkExponentiationParens(expr, requiredParens) {
|
|
24611
|
+
if (expr.lhs instanceof ParenthesizedExpr && expr.lhs.expr instanceof UnaryOperatorExpr) {
|
|
24612
|
+
requiredParens.add(expr.lhs);
|
|
24613
|
+
}
|
|
24614
|
+
}
|
|
24615
|
+
function checkNullishCoalescingParens(expr, requiredParens) {
|
|
24616
|
+
if (expr.lhs instanceof ParenthesizedExpr &&
|
|
24617
|
+
(isLogicalAndOr(expr.lhs.expr) || expr.lhs.expr instanceof ConditionalExpr)) {
|
|
24618
|
+
requiredParens.add(expr.lhs);
|
|
24619
|
+
}
|
|
24620
|
+
if (expr.rhs instanceof ParenthesizedExpr &&
|
|
24621
|
+
(isLogicalAndOr(expr.rhs.expr) || expr.rhs.expr instanceof ConditionalExpr)) {
|
|
24622
|
+
requiredParens.add(expr.rhs);
|
|
24623
|
+
}
|
|
24624
|
+
}
|
|
24625
|
+
function isLogicalAndOr(expr) {
|
|
24626
|
+
return (expr instanceof BinaryOperatorExpr &&
|
|
24627
|
+
(expr.operator === BinaryOperator.And || expr.operator === BinaryOperator.Or));
|
|
24628
|
+
}
|
|
24629
|
+
|
|
24682
24630
|
/**
|
|
24683
24631
|
* Transforms special-case bindings with 'style' or 'class' in their names. Must run before the
|
|
24684
24632
|
* main binding specialization pass.
|
|
@@ -25587,7 +25535,7 @@ const phases = [
|
|
|
25587
25535
|
{ kind: CompilationJobKind.Both, fn: resolveSanitizers },
|
|
25588
25536
|
{ kind: CompilationJobKind.Tmpl, fn: liftLocalRefs },
|
|
25589
25537
|
{ kind: CompilationJobKind.Both, fn: expandSafeReads },
|
|
25590
|
-
{ kind: CompilationJobKind.Both, fn:
|
|
25538
|
+
{ kind: CompilationJobKind.Both, fn: stripNonrequiredParentheses },
|
|
25591
25539
|
{ kind: CompilationJobKind.Both, fn: generateTemporaryVariables },
|
|
25592
25540
|
{ kind: CompilationJobKind.Both, fn: optimizeVariables },
|
|
25593
25541
|
{ kind: CompilationJobKind.Both, fn: optimizeStoreLet },
|
|
@@ -26386,6 +26334,9 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
26386
26334
|
else if (ast instanceof TaggedTemplateLiteral) {
|
|
26387
26335
|
return new TaggedTemplateLiteralExpr(convertAst(ast.tag, job, baseSourceSpan), convertTemplateLiteral(ast.template, job, baseSourceSpan), undefined, convertSourceSpan(ast.span, baseSourceSpan));
|
|
26388
26336
|
}
|
|
26337
|
+
else if (ast instanceof ParenthesizedExpression) {
|
|
26338
|
+
return new ParenthesizedExpr(convertAst(ast.expression, job, baseSourceSpan), undefined, convertSourceSpan(ast.span, baseSourceSpan));
|
|
26339
|
+
}
|
|
26389
26340
|
else {
|
|
26390
26341
|
throw new Error(`Unhandled expression type "${ast.constructor.name}" in file "${baseSourceSpan?.start.file.url}"`);
|
|
26391
26342
|
}
|
|
@@ -26398,10 +26349,10 @@ function convertTemplateLiteral(ast, job, baseSourceSpan) {
|
|
|
26398
26349
|
function convertAstWithInterpolation(job, value, i18nMeta, sourceSpan) {
|
|
26399
26350
|
let expression;
|
|
26400
26351
|
if (value instanceof Interpolation$1) {
|
|
26401
|
-
expression = new Interpolation(value.strings, value.expressions.map((e) => convertAst(e, job,
|
|
26352
|
+
expression = new Interpolation(value.strings, value.expressions.map((e) => convertAst(e, job, null)), Object.keys(asMessage(i18nMeta)?.placeholders ?? {}));
|
|
26402
26353
|
}
|
|
26403
26354
|
else if (value instanceof AST) {
|
|
26404
|
-
expression = convertAst(value, job,
|
|
26355
|
+
expression = convertAst(value, job, null);
|
|
26405
26356
|
}
|
|
26406
26357
|
else {
|
|
26407
26358
|
expression = literal(value);
|
|
@@ -26779,12 +26730,6 @@ function ingestControlFlowInsertionPoint(unit, xref, node) {
|
|
|
26779
26730
|
* internal tooling as well.
|
|
26780
26731
|
*/
|
|
26781
26732
|
let ENABLE_TEMPLATE_SOURCE_LOCATIONS = false;
|
|
26782
|
-
/**
|
|
26783
|
-
* Utility function to enable source locations. Intended to be used **only** inside unit tests.
|
|
26784
|
-
*/
|
|
26785
|
-
function setEnableTemplateSourceLocations(value) {
|
|
26786
|
-
ENABLE_TEMPLATE_SOURCE_LOCATIONS = value;
|
|
26787
|
-
}
|
|
26788
26733
|
/** Gets whether template source locations are enabled. */
|
|
26789
26734
|
function getTemplateSourceLocationsEnabled() {
|
|
26790
26735
|
return ENABLE_TEMPLATE_SOURCE_LOCATIONS;
|
|
@@ -27381,15 +27326,6 @@ class BindingParser {
|
|
|
27381
27326
|
return false;
|
|
27382
27327
|
}
|
|
27383
27328
|
}
|
|
27384
|
-
class PipeCollector extends RecursiveAstVisitor {
|
|
27385
|
-
pipes = new Map();
|
|
27386
|
-
visitPipe(ast, context) {
|
|
27387
|
-
this.pipes.set(ast.name, ast);
|
|
27388
|
-
ast.exp.visit(this);
|
|
27389
|
-
this.visitAll(ast.args, context);
|
|
27390
|
-
return null;
|
|
27391
|
-
}
|
|
27392
|
-
}
|
|
27393
27329
|
function isAnimationLabel(name) {
|
|
27394
27330
|
return name[0] == '@';
|
|
27395
27331
|
}
|
|
@@ -29726,23 +29662,35 @@ class R3TargetBinder {
|
|
|
29726
29662
|
*/
|
|
29727
29663
|
bind(target) {
|
|
29728
29664
|
if (!target.template) {
|
|
29729
|
-
|
|
29730
|
-
|
|
29731
|
-
|
|
29732
|
-
|
|
29733
|
-
|
|
29734
|
-
const
|
|
29735
|
-
|
|
29736
|
-
const
|
|
29737
|
-
|
|
29738
|
-
|
|
29739
|
-
|
|
29740
|
-
|
|
29741
|
-
|
|
29742
|
-
|
|
29743
|
-
|
|
29744
|
-
|
|
29745
|
-
|
|
29665
|
+
throw new Error('Empty bound targets are not supported');
|
|
29666
|
+
}
|
|
29667
|
+
const directives = new Map();
|
|
29668
|
+
const eagerDirectives = [];
|
|
29669
|
+
const bindings = new Map();
|
|
29670
|
+
const references = new Map();
|
|
29671
|
+
const scopedNodeEntities = new Map();
|
|
29672
|
+
const expressions = new Map();
|
|
29673
|
+
const symbols = new Map();
|
|
29674
|
+
const nestingLevel = new Map();
|
|
29675
|
+
const usedPipes = new Set();
|
|
29676
|
+
const eagerPipes = new Set();
|
|
29677
|
+
const deferBlocks = [];
|
|
29678
|
+
if (target.template) {
|
|
29679
|
+
// First, parse the template into a `Scope` structure. This operation captures the syntactic
|
|
29680
|
+
// scopes in the template and makes them available for later use.
|
|
29681
|
+
const scope = Scope.apply(target.template);
|
|
29682
|
+
// Use the `Scope` to extract the entities present at every level of the template.
|
|
29683
|
+
extractScopedNodeEntities(scope, scopedNodeEntities);
|
|
29684
|
+
// Next, perform directive matching on the template using the `DirectiveBinder`. This returns:
|
|
29685
|
+
// - directives: Map of nodes (elements & ng-templates) to the directives on them.
|
|
29686
|
+
// - bindings: Map of inputs, outputs, and attributes to the directive/element that claims
|
|
29687
|
+
// them. TODO(alxhub): handle multiple directives claiming an input/output/etc.
|
|
29688
|
+
// - references: Map of #references to their targets.
|
|
29689
|
+
DirectiveBinder.apply(target.template, this.directiveMatcher, directives, eagerDirectives, bindings, references);
|
|
29690
|
+
// Finally, run the TemplateBinder to bind references, variables, and other entities within the
|
|
29691
|
+
// template. This extracts all the metadata that doesn't depend on directive matching.
|
|
29692
|
+
TemplateBinder.applyWithScope(target.template, scope, expressions, symbols, nestingLevel, usedPipes, eagerPipes, deferBlocks);
|
|
29693
|
+
}
|
|
29746
29694
|
return new R3BoundTarget(target, directives, eagerDirectives, bindings, references, expressions, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, deferBlocks);
|
|
29747
29695
|
}
|
|
29748
29696
|
}
|
|
@@ -29969,14 +29917,9 @@ class DirectiveBinder {
|
|
|
29969
29917
|
* map which resolves #references (`Reference`s) within the template to the named directive or
|
|
29970
29918
|
* template node.
|
|
29971
29919
|
*/
|
|
29972
|
-
static apply(template, selectorMatcher) {
|
|
29973
|
-
const directives = new Map();
|
|
29974
|
-
const bindings = new Map();
|
|
29975
|
-
const references = new Map();
|
|
29976
|
-
const eagerDirectives = [];
|
|
29920
|
+
static apply(template, selectorMatcher, directives, eagerDirectives, bindings, references) {
|
|
29977
29921
|
const matcher = new DirectiveBinder(selectorMatcher, directives, eagerDirectives, bindings, references);
|
|
29978
29922
|
matcher.ingest(template);
|
|
29979
|
-
return { directives, eagerDirectives, bindings, references };
|
|
29980
29923
|
}
|
|
29981
29924
|
ingest(template) {
|
|
29982
29925
|
template.forEach((node) => node.visit(this));
|
|
@@ -30161,18 +30104,11 @@ class TemplateBinder extends RecursiveAstVisitor {
|
|
|
30161
30104
|
* nesting level (how many levels deep within the template structure the `Template` is), starting
|
|
30162
30105
|
* at 1.
|
|
30163
30106
|
*/
|
|
30164
|
-
static applyWithScope(nodes, scope) {
|
|
30165
|
-
const expressions = new Map();
|
|
30166
|
-
const symbols = new Map();
|
|
30167
|
-
const nestingLevel = new Map();
|
|
30168
|
-
const usedPipes = new Set();
|
|
30169
|
-
const eagerPipes = new Set();
|
|
30107
|
+
static applyWithScope(nodes, scope, expressions, symbols, nestingLevel, usedPipes, eagerPipes, deferBlocks) {
|
|
30170
30108
|
const template = nodes instanceof Template ? nodes : null;
|
|
30171
|
-
const deferBlocks = [];
|
|
30172
30109
|
// The top-level template has nesting level 0.
|
|
30173
30110
|
const binder = new TemplateBinder(expressions, symbols, usedPipes, eagerPipes, deferBlocks, nestingLevel, scope, template, 0);
|
|
30174
30111
|
binder.ingest(nodes);
|
|
30175
|
-
return { expressions, symbols, nestingLevel, usedPipes, eagerPipes, deferBlocks };
|
|
30176
30112
|
}
|
|
30177
30113
|
ingest(nodeOrNodes) {
|
|
30178
30114
|
if (nodeOrNodes instanceof Template) {
|
|
@@ -30522,7 +30458,7 @@ class R3BoundTarget {
|
|
|
30522
30458
|
return this.referenceTargetToElement(target.node);
|
|
30523
30459
|
}
|
|
30524
30460
|
}
|
|
30525
|
-
function extractScopedNodeEntities(rootScope) {
|
|
30461
|
+
function extractScopedNodeEntities(rootScope, templateEntities) {
|
|
30526
30462
|
const entityMap = new Map();
|
|
30527
30463
|
function extractScopeEntities(scope) {
|
|
30528
30464
|
if (entityMap.has(scope.rootNode)) {
|
|
@@ -30547,11 +30483,9 @@ function extractScopedNodeEntities(rootScope) {
|
|
|
30547
30483
|
}
|
|
30548
30484
|
extractScopeEntities(scope);
|
|
30549
30485
|
}
|
|
30550
|
-
const templateEntities = new Map();
|
|
30551
30486
|
for (const [template, entities] of entityMap) {
|
|
30552
30487
|
templateEntities.set(template, new Set(entities.values()));
|
|
30553
30488
|
}
|
|
30554
|
-
return templateEntities;
|
|
30555
30489
|
}
|
|
30556
30490
|
|
|
30557
30491
|
/**
|
|
@@ -30574,10 +30508,8 @@ class CompilerFacadeImpl {
|
|
|
30574
30508
|
}
|
|
30575
30509
|
compilePipe(angularCoreEnv, sourceMapUrl, facade) {
|
|
30576
30510
|
const metadata = {
|
|
30577
|
-
name: facade.name,
|
|
30578
30511
|
type: wrapReference(facade.type),
|
|
30579
30512
|
typeArgumentCount: 0,
|
|
30580
|
-
deps: null,
|
|
30581
30513
|
pipeName: facade.pipeName,
|
|
30582
30514
|
pure: facade.pure,
|
|
30583
30515
|
isStandalone: facade.isStandalone,
|
|
@@ -30622,7 +30554,6 @@ class CompilerFacadeImpl {
|
|
|
30622
30554
|
}
|
|
30623
30555
|
compileInjector(angularCoreEnv, sourceMapUrl, facade) {
|
|
30624
30556
|
const meta = {
|
|
30625
|
-
name: facade.name,
|
|
30626
30557
|
type: wrapReference(facade.type),
|
|
30627
30558
|
providers: facade.providers && facade.providers.length > 0
|
|
30628
30559
|
? new WrappedNodeExpr(facade.providers)
|
|
@@ -31821,7 +31752,7 @@ class Xliff extends Serializer {
|
|
|
31821
31752
|
return digest$1(message);
|
|
31822
31753
|
}
|
|
31823
31754
|
}
|
|
31824
|
-
|
|
31755
|
+
let _WriteVisitor$1 = class _WriteVisitor {
|
|
31825
31756
|
visitText(text, context) {
|
|
31826
31757
|
return [new Text$1(text.value)];
|
|
31827
31758
|
}
|
|
@@ -31880,7 +31811,7 @@ class _WriteVisitor$1 {
|
|
|
31880
31811
|
serialize(nodes) {
|
|
31881
31812
|
return [].concat(...nodes.map((node) => node.visit(this)));
|
|
31882
31813
|
}
|
|
31883
|
-
}
|
|
31814
|
+
};
|
|
31884
31815
|
// TODO(vicb): add error management (structure)
|
|
31885
31816
|
// Extract messages as xml nodes from the xliff file
|
|
31886
31817
|
class XliffParser {
|
|
@@ -31963,7 +31894,7 @@ class XliffParser {
|
|
|
31963
31894
|
}
|
|
31964
31895
|
}
|
|
31965
31896
|
// Convert ml nodes (xliff syntax) to i18n nodes
|
|
31966
|
-
|
|
31897
|
+
let XmlToI18n$2 = class XmlToI18n {
|
|
31967
31898
|
// using non-null assertion because it's re(set) by convert()
|
|
31968
31899
|
_errors;
|
|
31969
31900
|
convert(message, url) {
|
|
@@ -32016,7 +31947,7 @@ class XmlToI18n$2 {
|
|
|
32016
31947
|
_addError(node, message) {
|
|
32017
31948
|
this._errors.push(new I18nError(node.sourceSpan, message));
|
|
32018
31949
|
}
|
|
32019
|
-
}
|
|
31950
|
+
};
|
|
32020
31951
|
function getCtypeForTag(tag) {
|
|
32021
31952
|
switch (tag.toLowerCase()) {
|
|
32022
31953
|
case 'br':
|
|
@@ -32278,7 +32209,7 @@ class Xliff2Parser {
|
|
|
32278
32209
|
}
|
|
32279
32210
|
}
|
|
32280
32211
|
// Convert ml nodes (xliff syntax) to i18n nodes
|
|
32281
|
-
|
|
32212
|
+
let XmlToI18n$1 = class XmlToI18n {
|
|
32282
32213
|
// using non-null assertion because re(set) by convert()
|
|
32283
32214
|
_errors;
|
|
32284
32215
|
convert(message, url) {
|
|
@@ -32348,7 +32279,7 @@ class XmlToI18n$1 {
|
|
|
32348
32279
|
_addError(node, message) {
|
|
32349
32280
|
this._errors.push(new I18nError(node.sourceSpan, message));
|
|
32350
32281
|
}
|
|
32351
|
-
}
|
|
32282
|
+
};
|
|
32352
32283
|
function getTypeForTag(tag) {
|
|
32353
32284
|
switch (tag.toLowerCase()) {
|
|
32354
32285
|
case 'br':
|
|
@@ -32950,7 +32881,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
|
|
|
32950
32881
|
function compileDeclareClassMetadata(metadata) {
|
|
32951
32882
|
const definitionMap = new DefinitionMap();
|
|
32952
32883
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
32953
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
32884
|
+
definitionMap.set('version', literal('20.0.0-next.2'));
|
|
32954
32885
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32955
32886
|
definitionMap.set('type', metadata.type);
|
|
32956
32887
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -32968,7 +32899,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
|
|
|
32968
32899
|
callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
|
|
32969
32900
|
callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
|
|
32970
32901
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
|
|
32971
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
32902
|
+
definitionMap.set('version', literal('20.0.0-next.2'));
|
|
32972
32903
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32973
32904
|
definitionMap.set('type', metadata.type);
|
|
32974
32905
|
definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
|
|
@@ -33063,7 +32994,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
33063
32994
|
const definitionMap = new DefinitionMap();
|
|
33064
32995
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
33065
32996
|
definitionMap.set('minVersion', literal(minVersion));
|
|
33066
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
32997
|
+
definitionMap.set('version', literal('20.0.0-next.2'));
|
|
33067
32998
|
// e.g. `type: MyDirective`
|
|
33068
32999
|
definitionMap.set('type', meta.type.value);
|
|
33069
33000
|
if (meta.isStandalone !== undefined) {
|
|
@@ -33164,9 +33095,6 @@ function compileQuery(query) {
|
|
|
33164
33095
|
// Therefore we explicitly emit the field, and explicitly place it only when it's `false`.
|
|
33165
33096
|
meta.set('emitDistinctChangesOnly', literal(false));
|
|
33166
33097
|
}
|
|
33167
|
-
else {
|
|
33168
|
-
// The linker will assume that an absent `emitDistinctChangesOnly` flag is by default `true`.
|
|
33169
|
-
}
|
|
33170
33098
|
if (query.descendants) {
|
|
33171
33099
|
meta.set('descendants', literal(true));
|
|
33172
33100
|
}
|
|
@@ -33482,7 +33410,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
33482
33410
|
function compileDeclareFactoryFunction(meta) {
|
|
33483
33411
|
const definitionMap = new DefinitionMap();
|
|
33484
33412
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
33485
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33413
|
+
definitionMap.set('version', literal('20.0.0-next.2'));
|
|
33486
33414
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33487
33415
|
definitionMap.set('type', meta.type.value);
|
|
33488
33416
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -33517,7 +33445,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
33517
33445
|
function createInjectableDefinitionMap(meta) {
|
|
33518
33446
|
const definitionMap = new DefinitionMap();
|
|
33519
33447
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
33520
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33448
|
+
definitionMap.set('version', literal('20.0.0-next.2'));
|
|
33521
33449
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33522
33450
|
definitionMap.set('type', meta.type.value);
|
|
33523
33451
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -33568,7 +33496,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
33568
33496
|
function createInjectorDefinitionMap(meta) {
|
|
33569
33497
|
const definitionMap = new DefinitionMap();
|
|
33570
33498
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
33571
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33499
|
+
definitionMap.set('version', literal('20.0.0-next.2'));
|
|
33572
33500
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33573
33501
|
definitionMap.set('type', meta.type.value);
|
|
33574
33502
|
definitionMap.set('providers', meta.providers);
|
|
@@ -33601,7 +33529,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
33601
33529
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
33602
33530
|
}
|
|
33603
33531
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
33604
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33532
|
+
definitionMap.set('version', literal('20.0.0-next.2'));
|
|
33605
33533
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33606
33534
|
definitionMap.set('type', meta.type.value);
|
|
33607
33535
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -33652,7 +33580,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
33652
33580
|
function createPipeDefinitionMap(meta) {
|
|
33653
33581
|
const definitionMap = new DefinitionMap();
|
|
33654
33582
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
33655
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33583
|
+
definitionMap.set('version', literal('20.0.0-next.2'));
|
|
33656
33584
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33657
33585
|
// e.g. `type: MyPipe`
|
|
33658
33586
|
definitionMap.set('type', meta.type.value);
|
|
@@ -33810,24 +33738,31 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
|
|
|
33810
33738
|
* @description
|
|
33811
33739
|
* Entry point for all public APIs of the compiler package.
|
|
33812
33740
|
*/
|
|
33813
|
-
const VERSION = new Version('20.0.0-next.
|
|
33741
|
+
const VERSION = new Version('20.0.0-next.2');
|
|
33814
33742
|
|
|
33815
33743
|
//////////////////////////////////////
|
|
33816
|
-
//
|
|
33817
|
-
//
|
|
33818
|
-
|
|
33819
|
-
publishFacade(_global);
|
|
33820
|
-
|
|
33744
|
+
// THIS FILE HAS GLOBAL SIDE EFFECT //
|
|
33745
|
+
// (see bottom of file) //
|
|
33746
|
+
//////////////////////////////////////
|
|
33821
33747
|
/**
|
|
33822
33748
|
* @module
|
|
33823
33749
|
* @description
|
|
33824
|
-
* Entry point for all
|
|
33750
|
+
* Entry point for all APIs of the compiler package.
|
|
33751
|
+
*
|
|
33752
|
+
* <div class="callout is-critical">
|
|
33753
|
+
* <header>Unstable APIs</header>
|
|
33754
|
+
* <p>
|
|
33755
|
+
* All compiler apis are currently considered experimental and private!
|
|
33756
|
+
* </p>
|
|
33757
|
+
* <p>
|
|
33758
|
+
* We expect the APIs in this package to keep on changing. Do not rely on them.
|
|
33759
|
+
* </p>
|
|
33760
|
+
* </div>
|
|
33825
33761
|
*/
|
|
33826
33762
|
// This file only reexports content of the `src` folder. Keep it that way.
|
|
33763
|
+
// This function call has a global side effects and publishes the compiler into global namespace for
|
|
33764
|
+
// the late binding of the Compiler to the @angular/core for jit compilation.
|
|
33765
|
+
publishFacade(_global);
|
|
33827
33766
|
|
|
33828
|
-
|
|
33829
|
-
|
|
33830
|
-
// This file is not used to build this module. It is only used during editing
|
|
33831
|
-
|
|
33832
|
-
export { AST, ASTWithName, ASTWithSource, AbsoluteSourceSpan, ArrayType, ArrowFunctionExpr, Attribute, Binary, BinaryOperator, BinaryOperatorExpr, BindingPipe, BindingType, Block, BlockParameter, BoundElementProperty, BuiltinType, BuiltinTypeName, CUSTOM_ELEMENTS_SCHEMA, Call, Chain, ChangeDetectionStrategy, CommaExpr, Comment, CompilerConfig, Conditional, ConditionalExpr, ConstantPool, CssSelector, DEFAULT_INTERPOLATION_CONFIG, DYNAMIC_TYPE, DeclareFunctionStmt, DeclareVarStmt, DomElementSchemaRegistry, DynamicImportExpr, EOF, Element, ElementSchemaRegistry, EmitterVisitorContext, EmptyExpr$1 as EmptyExpr, Expansion, ExpansionCase, Expression, ExpressionBinding, ExpressionStatement, ExpressionType, ExternalExpr, ExternalReference, FactoryTarget$1 as FactoryTarget, FunctionExpr, HtmlParser, HtmlTagDefinition, I18NHtmlParser, IfStmt, ImplicitReceiver, InstantiateExpr, Interpolation$1 as Interpolation, InterpolationConfig, InvokeFunctionExpr, JSDocComment, JitEvaluator, KeyedRead, KeyedWrite, LeadingComment, LetDeclaration, Lexer, LiteralArray, LiteralArrayExpr, LiteralExpr, LiteralMap, LiteralMapExpr, LiteralPrimitive, LocalizedString, MapType, MessageBundle, NONE_TYPE, NO_ERRORS_SCHEMA, NodeWithI18n, NonNullAssert, NotExpr, ParenthesizedExpr, ParseError, ParseErrorLevel, ParseLocation, ParseSourceFile, ParseSourceSpan, ParseSpan, ParseTreeResult, ParsedEvent, ParsedEventType, ParsedProperty, ParsedPropertyType, ParsedVariable, Parser, ParserError, PrefixNot, PropertyRead, PropertyWrite, R3BoundTarget, Identifiers as R3Identifiers, R3NgModuleMetadataKind, R3SelectorScopeMode, R3TargetBinder, R3TemplateDependencyKind, ReadKeyExpr, ReadPropExpr, ReadVarExpr, RecursiveAstVisitor, RecursiveVisitor, ResourceLoader, ReturnStatement, STRING_TYPE, SafeCall, SafeKeyedRead, SafePropertyRead, SelectorContext, SelectorListContext, SelectorMatcher, Serializer, SplitInterpolation, Statement, StmtModifier, StringToken, StringTokenKind, TagContentType, TaggedTemplateLiteral, TaggedTemplateLiteralExpr, TemplateBindingParseResult, TemplateLiteral, TemplateLiteralElement, TemplateLiteralElementExpr, TemplateLiteralExpr, Text, ThisReceiver, BlockNode as TmplAstBlockNode, BoundAttribute as TmplAstBoundAttribute, BoundDeferredTrigger as TmplAstBoundDeferredTrigger, BoundEvent as TmplAstBoundEvent, BoundText as TmplAstBoundText, Content as TmplAstContent, DeferredBlock as TmplAstDeferredBlock, DeferredBlockError as TmplAstDeferredBlockError, DeferredBlockLoading as TmplAstDeferredBlockLoading, DeferredBlockPlaceholder as TmplAstDeferredBlockPlaceholder, DeferredTrigger as TmplAstDeferredTrigger, Element$1 as TmplAstElement, ForLoopBlock as TmplAstForLoopBlock, ForLoopBlockEmpty as TmplAstForLoopBlockEmpty, HoverDeferredTrigger as TmplAstHoverDeferredTrigger, Icu$1 as TmplAstIcu, IdleDeferredTrigger as TmplAstIdleDeferredTrigger, IfBlock as TmplAstIfBlock, IfBlockBranch as TmplAstIfBlockBranch, ImmediateDeferredTrigger as TmplAstImmediateDeferredTrigger, InteractionDeferredTrigger as TmplAstInteractionDeferredTrigger, LetDeclaration$1 as TmplAstLetDeclaration, NeverDeferredTrigger as TmplAstNeverDeferredTrigger, RecursiveVisitor$1 as TmplAstRecursiveVisitor, Reference as TmplAstReference, SwitchBlock as TmplAstSwitchBlock, SwitchBlockCase as TmplAstSwitchBlockCase, Template as TmplAstTemplate, Text$3 as TmplAstText, TextAttribute as TmplAstTextAttribute, TimerDeferredTrigger as TmplAstTimerDeferredTrigger, UnknownBlock as TmplAstUnknownBlock, Variable as TmplAstVariable, ViewportDeferredTrigger as TmplAstViewportDeferredTrigger, Token, TokenType, TransplantedType, TreeError, Type, TypeModifier, TypeofExpr, TypeofExpression, Unary, UnaryOperator, UnaryOperatorExpr, VERSION, VariableBinding, Version, ViewEncapsulation, VoidExpr, VoidExpression, WrappedNodeExpr, WriteKeyExpr, WritePropExpr, WriteVarExpr, Xliff, Xliff2, Xmb, XmlParser, Xtb, compileClassDebugInfo, compileClassMetadata, compileComponentClassMetadata, compileComponentDeclareClassMetadata, compileComponentFromMetadata, compileDeclareClassMetadata, compileDeclareComponentFromMetadata, compileDeclareDirectiveFromMetadata, compileDeclareFactoryFunction, compileDeclareInjectableFromMetadata, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileDeclarePipeFromMetadata, compileDeferResolverFunction, compileDirectiveFromMetadata, compileFactoryFunction, compileHmrInitializer, compileHmrUpdateCallback, compileInjectable, compileInjector, compileNgModule, compileOpaqueAsyncClassMetadata, compilePipeFromMetadata, computeMsgId, core, createCssSelectorFromNode, createInjectableType, createMayBeForwardRefExpression, devOnlyGuardedExpression, emitDistinctChangesOnlyDefaultValue, encapsulateStyle, findMatchingDirectivesAndPipes, getHtmlTagDefinition, getNsPrefix, getSafePropertyAccessString, identifierName, isNgContainer, isNgContent, isNgTemplate, jsDocComment, leadingComment, literal, literalMap, makeBindingParser, mergeNsAndName, output_ast as outputAst, parseHostBindings, parseTemplate, preserveWhitespacesDefault, publishFacade, r3JitTypeSourceSpan, sanitizeIdentifier, splitNsName, visitAll$1 as tmplAstVisitAll, verifyHostBindings, visitAll };
|
|
33767
|
+
export { AST, ASTWithName, ASTWithSource, AbsoluteSourceSpan, ArrayType, ArrowFunctionExpr, Attribute, Binary, BinaryOperator, BinaryOperatorExpr, BindingPipe, BindingType, Block, BlockParameter, BoundElementProperty, BuiltinType, BuiltinTypeName, CUSTOM_ELEMENTS_SCHEMA, Call, Chain, ChangeDetectionStrategy, CommaExpr, Comment, CompilerConfig, Conditional, ConditionalExpr, ConstantPool, CssSelector, DEFAULT_INTERPOLATION_CONFIG, DYNAMIC_TYPE, DeclareFunctionStmt, DeclareVarStmt, DomElementSchemaRegistry, DynamicImportExpr, EOF, Element, ElementSchemaRegistry, EmitterVisitorContext, EmptyExpr$1 as EmptyExpr, Expansion, ExpansionCase, Expression, ExpressionBinding, ExpressionStatement, ExpressionType, ExternalExpr, ExternalReference, FactoryTarget$1 as FactoryTarget, FunctionExpr, HtmlParser, HtmlTagDefinition, I18NHtmlParser, IfStmt, ImplicitReceiver, InstantiateExpr, Interpolation$1 as Interpolation, InterpolationConfig, InvokeFunctionExpr, JSDocComment, JitEvaluator, KeyedRead, KeyedWrite, LeadingComment, LetDeclaration, Lexer, LiteralArray, LiteralArrayExpr, LiteralExpr, LiteralMap, LiteralMapExpr, LiteralPrimitive, LocalizedString, MapType, MessageBundle, NONE_TYPE, NO_ERRORS_SCHEMA, NodeWithI18n, NonNullAssert, NotExpr, ParenthesizedExpr, ParenthesizedExpression, ParseError, ParseErrorLevel, ParseLocation, ParseSourceFile, ParseSourceSpan, ParseSpan, ParseTreeResult, ParsedEvent, ParsedEventType, ParsedProperty, ParsedPropertyType, ParsedVariable, Parser, ParserError, PrefixNot, PropertyRead, PropertyWrite, R3BoundTarget, Identifiers as R3Identifiers, R3NgModuleMetadataKind, R3SelectorScopeMode, R3TargetBinder, R3TemplateDependencyKind, ReadKeyExpr, ReadPropExpr, ReadVarExpr, RecursiveAstVisitor, RecursiveVisitor, ResourceLoader, ReturnStatement, STRING_TYPE, SafeCall, SafeKeyedRead, SafePropertyRead, SelectorContext, SelectorListContext, SelectorMatcher, Serializer, SplitInterpolation, Statement, StmtModifier, StringToken, StringTokenKind, TagContentType, TaggedTemplateLiteral, TaggedTemplateLiteralExpr, TemplateBindingParseResult, TemplateLiteral, TemplateLiteralElement, TemplateLiteralElementExpr, TemplateLiteralExpr, Text, ThisReceiver, BlockNode as TmplAstBlockNode, BoundAttribute as TmplAstBoundAttribute, BoundDeferredTrigger as TmplAstBoundDeferredTrigger, BoundEvent as TmplAstBoundEvent, BoundText as TmplAstBoundText, Content as TmplAstContent, DeferredBlock as TmplAstDeferredBlock, DeferredBlockError as TmplAstDeferredBlockError, DeferredBlockLoading as TmplAstDeferredBlockLoading, DeferredBlockPlaceholder as TmplAstDeferredBlockPlaceholder, DeferredTrigger as TmplAstDeferredTrigger, Element$1 as TmplAstElement, ForLoopBlock as TmplAstForLoopBlock, ForLoopBlockEmpty as TmplAstForLoopBlockEmpty, HoverDeferredTrigger as TmplAstHoverDeferredTrigger, Icu$1 as TmplAstIcu, IdleDeferredTrigger as TmplAstIdleDeferredTrigger, IfBlock as TmplAstIfBlock, IfBlockBranch as TmplAstIfBlockBranch, ImmediateDeferredTrigger as TmplAstImmediateDeferredTrigger, InteractionDeferredTrigger as TmplAstInteractionDeferredTrigger, LetDeclaration$1 as TmplAstLetDeclaration, NeverDeferredTrigger as TmplAstNeverDeferredTrigger, RecursiveVisitor$1 as TmplAstRecursiveVisitor, Reference as TmplAstReference, SwitchBlock as TmplAstSwitchBlock, SwitchBlockCase as TmplAstSwitchBlockCase, Template as TmplAstTemplate, Text$3 as TmplAstText, TextAttribute as TmplAstTextAttribute, TimerDeferredTrigger as TmplAstTimerDeferredTrigger, UnknownBlock as TmplAstUnknownBlock, Variable as TmplAstVariable, ViewportDeferredTrigger as TmplAstViewportDeferredTrigger, Token, TokenType, TransplantedType, TreeError, Type, TypeModifier, TypeofExpr, TypeofExpression, Unary, UnaryOperator, UnaryOperatorExpr, VERSION, VariableBinding, Version, ViewEncapsulation, VoidExpr, VoidExpression, WrappedNodeExpr, WriteKeyExpr, WritePropExpr, WriteVarExpr, Xliff, Xliff2, Xmb, XmlParser, Xtb, compileClassDebugInfo, compileClassMetadata, compileComponentClassMetadata, compileComponentDeclareClassMetadata, compileComponentFromMetadata, compileDeclareClassMetadata, compileDeclareComponentFromMetadata, compileDeclareDirectiveFromMetadata, compileDeclareFactoryFunction, compileDeclareInjectableFromMetadata, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileDeclarePipeFromMetadata, compileDeferResolverFunction, compileDirectiveFromMetadata, compileFactoryFunction, compileHmrInitializer, compileHmrUpdateCallback, compileInjectable, compileInjector, compileNgModule, compileOpaqueAsyncClassMetadata, compilePipeFromMetadata, computeMsgId, core, createCssSelectorFromNode, createInjectableType, createMayBeForwardRefExpression, devOnlyGuardedExpression, emitDistinctChangesOnlyDefaultValue, encapsulateStyle, findMatchingDirectivesAndPipes, getHtmlTagDefinition, getNsPrefix, getSafePropertyAccessString, identifierName, isNgContainer, isNgContent, isNgTemplate, jsDocComment, leadingComment, literal, literalMap, makeBindingParser, mergeNsAndName, output_ast as outputAst, parseHostBindings, parseTemplate, preserveWhitespacesDefault, publishFacade, r3JitTypeSourceSpan, sanitizeIdentifier, splitNsName, visitAll$1 as tmplAstVisitAll, verifyHostBindings, visitAll };
|
|
33833
33768
|
//# sourceMappingURL=compiler.mjs.map
|