@angular-eslint/bundled-angular-compiler 19.1.1-alpha.0 → 19.1.1-alpha.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/dist/index.js +416 -148
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -141,11 +141,15 @@ __export(index_exports, {
|
|
|
141
141
|
SplitInterpolation: () => SplitInterpolation,
|
|
142
142
|
Statement: () => Statement,
|
|
143
143
|
StmtModifier: () => StmtModifier,
|
|
144
|
+
StringToken: () => StringToken,
|
|
145
|
+
StringTokenKind: () => StringTokenKind,
|
|
144
146
|
TagContentType: () => TagContentType,
|
|
145
|
-
|
|
147
|
+
TaggedTemplateLiteralExpr: () => TaggedTemplateLiteralExpr,
|
|
146
148
|
TemplateBindingParseResult: () => TemplateBindingParseResult,
|
|
147
149
|
TemplateLiteral: () => TemplateLiteral,
|
|
148
150
|
TemplateLiteralElement: () => TemplateLiteralElement,
|
|
151
|
+
TemplateLiteralElementExpr: () => TemplateLiteralElementExpr,
|
|
152
|
+
TemplateLiteralExpr: () => TemplateLiteralExpr,
|
|
149
153
|
Text: () => Text,
|
|
150
154
|
ThisReceiver: () => ThisReceiver,
|
|
151
155
|
TmplAstBlockNode: () => BlockNode,
|
|
@@ -265,7 +269,7 @@ __export(index_exports, {
|
|
|
265
269
|
});
|
|
266
270
|
module.exports = __toCommonJS(index_exports);
|
|
267
271
|
|
|
268
|
-
// ../../node_modules/.pnpm/@angular+compiler@19.
|
|
272
|
+
// ../../node_modules/.pnpm/@angular+compiler@19.2.0/node_modules/@angular/compiler/fesm2022/compiler.mjs
|
|
269
273
|
var _SELECTOR_REGEXP = new RegExp(
|
|
270
274
|
`(\\:not\\()|(([\\.\\#]?)[-\\w]+)|(?:\\[([-.\\w*\\\\$]+)(?:=(["']?)([^\\]"']*)\\5)?\\])|(\\))|(\\s*,\\s*)`,
|
|
271
275
|
// 8: ","
|
|
@@ -1432,9 +1436,9 @@ var InvokeFunctionExpr = class _InvokeFunctionExpr extends Expression {
|
|
|
1432
1436
|
return new _InvokeFunctionExpr(this.fn.clone(), this.args.map((arg) => arg.clone()), this.type, this.sourceSpan, this.pure);
|
|
1433
1437
|
}
|
|
1434
1438
|
};
|
|
1435
|
-
var
|
|
1439
|
+
var TaggedTemplateLiteralExpr = class _TaggedTemplateLiteralExpr extends Expression {
|
|
1436
1440
|
static {
|
|
1437
|
-
__name(this, "
|
|
1441
|
+
__name(this, "TaggedTemplateLiteralExpr");
|
|
1438
1442
|
}
|
|
1439
1443
|
tag;
|
|
1440
1444
|
template;
|
|
@@ -1444,16 +1448,16 @@ var TaggedTemplateExpr = class _TaggedTemplateExpr extends Expression {
|
|
|
1444
1448
|
this.template = template2;
|
|
1445
1449
|
}
|
|
1446
1450
|
isEquivalent(e) {
|
|
1447
|
-
return e instanceof
|
|
1451
|
+
return e instanceof _TaggedTemplateLiteralExpr && this.tag.isEquivalent(e.tag) && this.template.isEquivalent(e.template);
|
|
1448
1452
|
}
|
|
1449
1453
|
isConstant() {
|
|
1450
1454
|
return false;
|
|
1451
1455
|
}
|
|
1452
1456
|
visitExpression(visitor, context) {
|
|
1453
|
-
return visitor.
|
|
1457
|
+
return visitor.visitTaggedTemplateLiteralExpr(this, context);
|
|
1454
1458
|
}
|
|
1455
1459
|
clone() {
|
|
1456
|
-
return new
|
|
1460
|
+
return new _TaggedTemplateLiteralExpr(this.tag.clone(), this.template.clone(), this.type, this.sourceSpan);
|
|
1457
1461
|
}
|
|
1458
1462
|
};
|
|
1459
1463
|
var InstantiateExpr = class _InstantiateExpr extends Expression {
|
|
@@ -1502,34 +1506,52 @@ var LiteralExpr = class _LiteralExpr extends Expression {
|
|
|
1502
1506
|
return new _LiteralExpr(this.value, this.type, this.sourceSpan);
|
|
1503
1507
|
}
|
|
1504
1508
|
};
|
|
1505
|
-
var
|
|
1509
|
+
var TemplateLiteralExpr = class _TemplateLiteralExpr extends Expression {
|
|
1506
1510
|
static {
|
|
1507
|
-
__name(this, "
|
|
1511
|
+
__name(this, "TemplateLiteralExpr");
|
|
1508
1512
|
}
|
|
1509
1513
|
elements;
|
|
1510
1514
|
expressions;
|
|
1511
|
-
constructor(elements, expressions) {
|
|
1515
|
+
constructor(elements, expressions, sourceSpan) {
|
|
1516
|
+
super(null, sourceSpan);
|
|
1512
1517
|
this.elements = elements;
|
|
1513
1518
|
this.expressions = expressions;
|
|
1514
1519
|
}
|
|
1520
|
+
isEquivalent(e) {
|
|
1521
|
+
return e instanceof _TemplateLiteralExpr && areAllEquivalentPredicate(this.elements, e.elements, (a, b) => a.text === b.text) && areAllEquivalent(this.expressions, e.expressions);
|
|
1522
|
+
}
|
|
1523
|
+
isConstant() {
|
|
1524
|
+
return false;
|
|
1525
|
+
}
|
|
1526
|
+
visitExpression(visitor, context) {
|
|
1527
|
+
return visitor.visitTemplateLiteralExpr(this, context);
|
|
1528
|
+
}
|
|
1515
1529
|
clone() {
|
|
1516
|
-
return new
|
|
1530
|
+
return new _TemplateLiteralExpr(this.elements.map((el) => el.clone()), this.expressions.map((expr) => expr.clone()));
|
|
1517
1531
|
}
|
|
1518
1532
|
};
|
|
1519
|
-
var
|
|
1533
|
+
var TemplateLiteralElementExpr = class _TemplateLiteralElementExpr extends Expression {
|
|
1520
1534
|
static {
|
|
1521
|
-
__name(this, "
|
|
1535
|
+
__name(this, "TemplateLiteralElementExpr");
|
|
1522
1536
|
}
|
|
1523
1537
|
text;
|
|
1524
|
-
sourceSpan;
|
|
1525
1538
|
rawText;
|
|
1526
1539
|
constructor(text2, sourceSpan, rawText) {
|
|
1540
|
+
super(STRING_TYPE, sourceSpan);
|
|
1527
1541
|
this.text = text2;
|
|
1528
|
-
this.sourceSpan = sourceSpan;
|
|
1529
1542
|
this.rawText = rawText ?? sourceSpan?.toString() ?? escapeForTemplateLiteral(escapeSlashes(text2));
|
|
1530
1543
|
}
|
|
1544
|
+
visitExpression(visitor, context) {
|
|
1545
|
+
return visitor.visitTemplateLiteralElementExpr(this, context);
|
|
1546
|
+
}
|
|
1547
|
+
isEquivalent(e) {
|
|
1548
|
+
return e instanceof _TemplateLiteralElementExpr && e.text === this.text && e.rawText === this.rawText;
|
|
1549
|
+
}
|
|
1550
|
+
isConstant() {
|
|
1551
|
+
return true;
|
|
1552
|
+
}
|
|
1531
1553
|
clone() {
|
|
1532
|
-
return new
|
|
1554
|
+
return new _TemplateLiteralElementExpr(this.text, this.sourceSpan, this.rawText);
|
|
1533
1555
|
}
|
|
1534
1556
|
};
|
|
1535
1557
|
var LiteralPiece = class {
|
|
@@ -2281,9 +2303,9 @@ var RecursiveAstVisitor$1 = class {
|
|
|
2281
2303
|
this.visitAllExpressions(ast.args, context);
|
|
2282
2304
|
return this.visitExpression(ast, context);
|
|
2283
2305
|
}
|
|
2284
|
-
|
|
2306
|
+
visitTaggedTemplateLiteralExpr(ast, context) {
|
|
2285
2307
|
ast.tag.visitExpression(this, context);
|
|
2286
|
-
|
|
2308
|
+
ast.template.visitExpression(this, context);
|
|
2287
2309
|
return this.visitExpression(ast, context);
|
|
2288
2310
|
}
|
|
2289
2311
|
visitInstantiateExpr(ast, context) {
|
|
@@ -2355,6 +2377,14 @@ var RecursiveAstVisitor$1 = class {
|
|
|
2355
2377
|
this.visitAllExpressions(ast.parts, context);
|
|
2356
2378
|
return this.visitExpression(ast, context);
|
|
2357
2379
|
}
|
|
2380
|
+
visitTemplateLiteralExpr(ast, context) {
|
|
2381
|
+
this.visitAllExpressions(ast.elements, context);
|
|
2382
|
+
this.visitAllExpressions(ast.expressions, context);
|
|
2383
|
+
return this.visitExpression(ast, context);
|
|
2384
|
+
}
|
|
2385
|
+
visitTemplateLiteralElementExpr(ast, context) {
|
|
2386
|
+
return this.visitExpression(ast, context);
|
|
2387
|
+
}
|
|
2358
2388
|
visitAllExpressions(exprs, context) {
|
|
2359
2389
|
exprs.forEach((expr) => expr.visitExpression(this, context));
|
|
2360
2390
|
}
|
|
@@ -2453,7 +2483,7 @@ function ifStmt(condition, thenClause, elseClause, sourceSpan, leadingComments)
|
|
|
2453
2483
|
}
|
|
2454
2484
|
__name(ifStmt, "ifStmt");
|
|
2455
2485
|
function taggedTemplate(tag, template2, type, sourceSpan) {
|
|
2456
|
-
return new
|
|
2486
|
+
return new TaggedTemplateLiteralExpr(tag, template2, type, sourceSpan);
|
|
2457
2487
|
}
|
|
2458
2488
|
__name(taggedTemplate, "taggedTemplate");
|
|
2459
2489
|
function literal(value, type, sourceSpan) {
|
|
@@ -2536,11 +2566,11 @@ var output_ast = /* @__PURE__ */ Object.freeze({
|
|
|
2536
2566
|
WriteKeyExpr,
|
|
2537
2567
|
WritePropExpr,
|
|
2538
2568
|
InvokeFunctionExpr,
|
|
2539
|
-
|
|
2569
|
+
TaggedTemplateLiteralExpr,
|
|
2540
2570
|
InstantiateExpr,
|
|
2541
2571
|
LiteralExpr,
|
|
2542
|
-
|
|
2543
|
-
|
|
2572
|
+
TemplateLiteralExpr,
|
|
2573
|
+
TemplateLiteralElementExpr,
|
|
2544
2574
|
LiteralPiece,
|
|
2545
2575
|
PlaceholderPiece,
|
|
2546
2576
|
LocalizedString,
|
|
@@ -3275,10 +3305,6 @@ var Identifiers = class {
|
|
|
3275
3305
|
name: "\u0275\u0275HostDirectivesFeature",
|
|
3276
3306
|
moduleName: CORE
|
|
3277
3307
|
};
|
|
3278
|
-
static InputTransformsFeatureFeature = {
|
|
3279
|
-
name: "\u0275\u0275InputTransformsFeature",
|
|
3280
|
-
moduleName: CORE
|
|
3281
|
-
};
|
|
3282
3308
|
static ExternalStylesFeature = {
|
|
3283
3309
|
name: "\u0275\u0275ExternalStylesFeature",
|
|
3284
3310
|
moduleName: CORE
|
|
@@ -3819,16 +3845,26 @@ var AbstractEmitterVisitor = class {
|
|
|
3819
3845
|
ctx.print(expr, `)`);
|
|
3820
3846
|
return null;
|
|
3821
3847
|
}
|
|
3822
|
-
|
|
3848
|
+
visitTaggedTemplateLiteralExpr(expr, ctx) {
|
|
3823
3849
|
expr.tag.visitExpression(this, ctx);
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3850
|
+
expr.template.visitExpression(this, ctx);
|
|
3851
|
+
return null;
|
|
3852
|
+
}
|
|
3853
|
+
visitTemplateLiteralExpr(expr, ctx) {
|
|
3854
|
+
ctx.print(expr, "`");
|
|
3855
|
+
for (let i = 0; i < expr.elements.length; i++) {
|
|
3856
|
+
expr.elements[i].visitExpression(this, ctx);
|
|
3857
|
+
const expression = i < expr.expressions.length ? expr.expressions[i] : null;
|
|
3858
|
+
if (expression !== null) {
|
|
3859
|
+
ctx.print(expression, "${");
|
|
3860
|
+
expression.visitExpression(this, ctx);
|
|
3861
|
+
ctx.print(expression, "}");
|
|
3862
|
+
}
|
|
3829
3863
|
}
|
|
3830
3864
|
ctx.print(expr, "`");
|
|
3831
|
-
|
|
3865
|
+
}
|
|
3866
|
+
visitTemplateLiteralElementExpr(expr, ctx) {
|
|
3867
|
+
ctx.print(expr, expr.rawText);
|
|
3832
3868
|
}
|
|
3833
3869
|
visitWrappedNodeExpr(ast, ctx) {
|
|
3834
3870
|
throw new Error("Abstract emitter cannot visit WrappedNodeExpr.");
|
|
@@ -4695,6 +4731,34 @@ var SafeCall = class extends AST {
|
|
|
4695
4731
|
return visitor.visitSafeCall(this, context);
|
|
4696
4732
|
}
|
|
4697
4733
|
};
|
|
4734
|
+
var TemplateLiteral = class extends AST {
|
|
4735
|
+
static {
|
|
4736
|
+
__name(this, "TemplateLiteral");
|
|
4737
|
+
}
|
|
4738
|
+
elements;
|
|
4739
|
+
expressions;
|
|
4740
|
+
constructor(span, sourceSpan, elements, expressions) {
|
|
4741
|
+
super(span, sourceSpan);
|
|
4742
|
+
this.elements = elements;
|
|
4743
|
+
this.expressions = expressions;
|
|
4744
|
+
}
|
|
4745
|
+
visit(visitor, context) {
|
|
4746
|
+
return visitor.visitTemplateLiteral(this, context);
|
|
4747
|
+
}
|
|
4748
|
+
};
|
|
4749
|
+
var TemplateLiteralElement = class extends AST {
|
|
4750
|
+
static {
|
|
4751
|
+
__name(this, "TemplateLiteralElement");
|
|
4752
|
+
}
|
|
4753
|
+
text;
|
|
4754
|
+
constructor(span, sourceSpan, text2) {
|
|
4755
|
+
super(span, sourceSpan);
|
|
4756
|
+
this.text = text2;
|
|
4757
|
+
}
|
|
4758
|
+
visit(visitor, context) {
|
|
4759
|
+
return visitor.visitTemplateLiteralElement(this, context);
|
|
4760
|
+
}
|
|
4761
|
+
};
|
|
4698
4762
|
var AbsoluteSourceSpan = class {
|
|
4699
4763
|
static {
|
|
4700
4764
|
__name(this, "AbsoluteSourceSpan");
|
|
@@ -4853,6 +4917,17 @@ var RecursiveAstVisitor = class {
|
|
|
4853
4917
|
this.visit(ast.receiver, context);
|
|
4854
4918
|
this.visitAll(ast.args, context);
|
|
4855
4919
|
}
|
|
4920
|
+
visitTemplateLiteral(ast, context) {
|
|
4921
|
+
for (let i = 0; i < ast.elements.length; i++) {
|
|
4922
|
+
this.visit(ast.elements[i], context);
|
|
4923
|
+
const expression = i < ast.expressions.length ? ast.expressions[i] : null;
|
|
4924
|
+
if (expression !== null) {
|
|
4925
|
+
this.visit(expression, context);
|
|
4926
|
+
}
|
|
4927
|
+
}
|
|
4928
|
+
}
|
|
4929
|
+
visitTemplateLiteralElement(ast, context) {
|
|
4930
|
+
}
|
|
4856
4931
|
// This is not part of the AstVisitor interface, just a helper method
|
|
4857
4932
|
visitAll(asts, context) {
|
|
4858
4933
|
for (const ast of asts) {
|
|
@@ -6979,7 +7054,7 @@ var AbstractJsEmitterVisitor = class extends AbstractEmitterVisitor {
|
|
|
6979
7054
|
ctx.println(stmt, `;`);
|
|
6980
7055
|
return null;
|
|
6981
7056
|
}
|
|
6982
|
-
|
|
7057
|
+
visitTaggedTemplateLiteralExpr(ast, ctx) {
|
|
6983
7058
|
const elements = ast.template.elements;
|
|
6984
7059
|
ast.tag.visitExpression(this, ctx);
|
|
6985
7060
|
ctx.print(ast, `(${makeTemplateObjectPolyfill}(`);
|
|
@@ -6992,6 +7067,23 @@ var AbstractJsEmitterVisitor = class extends AbstractEmitterVisitor {
|
|
|
6992
7067
|
ctx.print(ast, ")");
|
|
6993
7068
|
return null;
|
|
6994
7069
|
}
|
|
7070
|
+
visitTemplateLiteralExpr(expr, ctx) {
|
|
7071
|
+
ctx.print(expr, "`");
|
|
7072
|
+
for (let i = 0; i < expr.elements.length; i++) {
|
|
7073
|
+
expr.elements[i].visitExpression(this, ctx);
|
|
7074
|
+
const expression = i < expr.expressions.length ? expr.expressions[i] : null;
|
|
7075
|
+
if (expression !== null) {
|
|
7076
|
+
ctx.print(expression, "${");
|
|
7077
|
+
expression.visitExpression(this, ctx);
|
|
7078
|
+
ctx.print(expression, "}");
|
|
7079
|
+
}
|
|
7080
|
+
}
|
|
7081
|
+
ctx.print(expr, "`");
|
|
7082
|
+
}
|
|
7083
|
+
visitTemplateLiteralElementExpr(expr, ctx) {
|
|
7084
|
+
ctx.print(expr, expr.rawText);
|
|
7085
|
+
return null;
|
|
7086
|
+
}
|
|
6995
7087
|
visitFunctionExpr(ast, ctx) {
|
|
6996
7088
|
ctx.print(ast, `function${ast.name ? " " + ast.name : ""}(`);
|
|
6997
7089
|
this._visitParams(ast.params, ctx);
|
|
@@ -9602,7 +9694,13 @@ function transformExpressionsInOp(op, transform2, flags) {
|
|
|
9602
9694
|
op.trustedValueFn = op.trustedValueFn && transformExpressionsInExpression(op.trustedValueFn, transform2, flags);
|
|
9603
9695
|
break;
|
|
9604
9696
|
case OpKind.RepeaterCreate:
|
|
9605
|
-
|
|
9697
|
+
if (op.trackByOps === null) {
|
|
9698
|
+
op.track = transformExpressionsInExpression(op.track, transform2, flags);
|
|
9699
|
+
} else {
|
|
9700
|
+
for (const innerOp of op.trackByOps) {
|
|
9701
|
+
transformExpressionsInOp(innerOp, transform2, flags | VisitorContextFlag.InChildOperation);
|
|
9702
|
+
}
|
|
9703
|
+
}
|
|
9606
9704
|
if (op.trackByFn !== null) {
|
|
9607
9705
|
op.trackByFn = transformExpressionsInExpression(op.trackByFn, transform2, flags);
|
|
9608
9706
|
}
|
|
@@ -9717,7 +9815,7 @@ function transformExpressionsInExpression(expr, transform2, flags) {
|
|
|
9717
9815
|
}
|
|
9718
9816
|
} else if (expr instanceof NotExpr) {
|
|
9719
9817
|
expr.condition = transformExpressionsInExpression(expr.condition, transform2, flags);
|
|
9720
|
-
} else if (expr instanceof
|
|
9818
|
+
} else if (expr instanceof TaggedTemplateLiteralExpr) {
|
|
9721
9819
|
expr.tag = transformExpressionsInExpression(expr.tag, transform2, flags);
|
|
9722
9820
|
expr.template.expressions = expr.template.expressions.map((e) => transformExpressionsInExpression(e, transform2, flags));
|
|
9723
9821
|
} else if (expr instanceof ArrowFunctionExpr) {
|
|
@@ -9729,6 +9827,10 @@ function transformExpressionsInExpression(expr, transform2, flags) {
|
|
|
9729
9827
|
expr.body = transformExpressionsInExpression(expr.body, transform2, flags);
|
|
9730
9828
|
}
|
|
9731
9829
|
} else if (expr instanceof WrappedNodeExpr) {
|
|
9830
|
+
} else if (expr instanceof TemplateLiteralExpr) {
|
|
9831
|
+
for (let i = 0; i < expr.expressions.length; i++) {
|
|
9832
|
+
expr.expressions[i] = transformExpressionsInExpression(expr.expressions[i], transform2, flags);
|
|
9833
|
+
}
|
|
9732
9834
|
} else if (expr instanceof ReadVarExpr || expr instanceof ExternalExpr || expr instanceof LiteralExpr) {
|
|
9733
9835
|
} else {
|
|
9734
9836
|
throw new Error(`Unhandled expression kind: ${expr.constructor.name}`);
|
|
@@ -10062,6 +10164,7 @@ function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, em
|
|
|
10062
10164
|
emptyView,
|
|
10063
10165
|
track,
|
|
10064
10166
|
trackByFn: null,
|
|
10167
|
+
trackByOps: null,
|
|
10065
10168
|
tag,
|
|
10066
10169
|
emptyTag,
|
|
10067
10170
|
emptyAttributes: null,
|
|
@@ -10539,6 +10642,10 @@ var CompilationUnit = class {
|
|
|
10539
10642
|
for (const listenerOp of op.handlerOps) {
|
|
10540
10643
|
yield listenerOp;
|
|
10541
10644
|
}
|
|
10645
|
+
} else if (op.kind === OpKind.RepeaterCreate && op.trackByOps !== null) {
|
|
10646
|
+
for (const trackOp of op.trackByOps) {
|
|
10647
|
+
yield trackOp;
|
|
10648
|
+
}
|
|
10542
10649
|
}
|
|
10543
10650
|
}
|
|
10544
10651
|
for (const op of this.update) {
|
|
@@ -11216,7 +11323,7 @@ var ElementAttributes = class {
|
|
|
11216
11323
|
if (!isStringLiteral(value)) {
|
|
11217
11324
|
throw Error("AssertionError: extracted attribute value should be string literal");
|
|
11218
11325
|
}
|
|
11219
|
-
array.push(taggedTemplate(trustedValueFn, new
|
|
11326
|
+
array.push(taggedTemplate(trustedValueFn, new TemplateLiteralExpr([new TemplateLiteralElementExpr(value.value)], []), void 0, value.sourceSpan));
|
|
11220
11327
|
} else {
|
|
11221
11328
|
array.push(value);
|
|
11222
11329
|
}
|
|
@@ -11968,6 +12075,9 @@ function recursivelyProcessView(view, parentScope) {
|
|
|
11968
12075
|
if (op.emptyView) {
|
|
11969
12076
|
recursivelyProcessView(view.job.views.get(op.emptyView), scope);
|
|
11970
12077
|
}
|
|
12078
|
+
if (op.trackByOps !== null) {
|
|
12079
|
+
op.trackByOps.prepend(generateVariablesInScopeForView(view, scope, false));
|
|
12080
|
+
}
|
|
11971
12081
|
break;
|
|
11972
12082
|
case OpKind.Listener:
|
|
11973
12083
|
case OpKind.TwoWayListener:
|
|
@@ -16342,6 +16452,12 @@ var TokenType;
|
|
|
16342
16452
|
TokenType2[TokenType2["Number"] = 6] = "Number";
|
|
16343
16453
|
TokenType2[TokenType2["Error"] = 7] = "Error";
|
|
16344
16454
|
})(TokenType || (TokenType = {}));
|
|
16455
|
+
var StringTokenKind;
|
|
16456
|
+
(function(StringTokenKind2) {
|
|
16457
|
+
StringTokenKind2[StringTokenKind2["Plain"] = 0] = "Plain";
|
|
16458
|
+
StringTokenKind2[StringTokenKind2["TemplateLiteralPart"] = 1] = "TemplateLiteralPart";
|
|
16459
|
+
StringTokenKind2[StringTokenKind2["TemplateLiteralEnd"] = 2] = "TemplateLiteralEnd";
|
|
16460
|
+
})(StringTokenKind || (StringTokenKind = {}));
|
|
16345
16461
|
var KEYWORDS = [
|
|
16346
16462
|
"var",
|
|
16347
16463
|
"let",
|
|
@@ -16360,14 +16476,7 @@ var Lexer = class {
|
|
|
16360
16476
|
__name(this, "Lexer");
|
|
16361
16477
|
}
|
|
16362
16478
|
tokenize(text2) {
|
|
16363
|
-
|
|
16364
|
-
const tokens = [];
|
|
16365
|
-
let token = scanner.scanToken();
|
|
16366
|
-
while (token != null) {
|
|
16367
|
-
tokens.push(token);
|
|
16368
|
-
token = scanner.scanToken();
|
|
16369
|
-
}
|
|
16370
|
-
return tokens;
|
|
16479
|
+
return new _Scanner(text2).scan();
|
|
16371
16480
|
}
|
|
16372
16481
|
};
|
|
16373
16482
|
var Token = class {
|
|
@@ -16387,55 +16496,67 @@ var Token = class {
|
|
|
16387
16496
|
this.strValue = strValue;
|
|
16388
16497
|
}
|
|
16389
16498
|
isCharacter(code) {
|
|
16390
|
-
return this.type
|
|
16499
|
+
return this.type === TokenType.Character && this.numValue === code;
|
|
16391
16500
|
}
|
|
16392
16501
|
isNumber() {
|
|
16393
|
-
return this.type
|
|
16502
|
+
return this.type === TokenType.Number;
|
|
16394
16503
|
}
|
|
16395
16504
|
isString() {
|
|
16396
|
-
return this.type
|
|
16505
|
+
return this.type === TokenType.String;
|
|
16397
16506
|
}
|
|
16398
16507
|
isOperator(operator) {
|
|
16399
|
-
return this.type
|
|
16508
|
+
return this.type === TokenType.Operator && this.strValue === operator;
|
|
16400
16509
|
}
|
|
16401
16510
|
isIdentifier() {
|
|
16402
|
-
return this.type
|
|
16511
|
+
return this.type === TokenType.Identifier;
|
|
16403
16512
|
}
|
|
16404
16513
|
isPrivateIdentifier() {
|
|
16405
|
-
return this.type
|
|
16514
|
+
return this.type === TokenType.PrivateIdentifier;
|
|
16406
16515
|
}
|
|
16407
16516
|
isKeyword() {
|
|
16408
|
-
return this.type
|
|
16517
|
+
return this.type === TokenType.Keyword;
|
|
16409
16518
|
}
|
|
16410
16519
|
isKeywordLet() {
|
|
16411
|
-
return this.type
|
|
16520
|
+
return this.type === TokenType.Keyword && this.strValue === "let";
|
|
16412
16521
|
}
|
|
16413
16522
|
isKeywordAs() {
|
|
16414
|
-
return this.type
|
|
16523
|
+
return this.type === TokenType.Keyword && this.strValue === "as";
|
|
16415
16524
|
}
|
|
16416
16525
|
isKeywordNull() {
|
|
16417
|
-
return this.type
|
|
16526
|
+
return this.type === TokenType.Keyword && this.strValue === "null";
|
|
16418
16527
|
}
|
|
16419
16528
|
isKeywordUndefined() {
|
|
16420
|
-
return this.type
|
|
16529
|
+
return this.type === TokenType.Keyword && this.strValue === "undefined";
|
|
16421
16530
|
}
|
|
16422
16531
|
isKeywordTrue() {
|
|
16423
|
-
return this.type
|
|
16532
|
+
return this.type === TokenType.Keyword && this.strValue === "true";
|
|
16424
16533
|
}
|
|
16425
16534
|
isKeywordFalse() {
|
|
16426
|
-
return this.type
|
|
16535
|
+
return this.type === TokenType.Keyword && this.strValue === "false";
|
|
16427
16536
|
}
|
|
16428
16537
|
isKeywordThis() {
|
|
16429
|
-
return this.type
|
|
16538
|
+
return this.type === TokenType.Keyword && this.strValue === "this";
|
|
16430
16539
|
}
|
|
16431
16540
|
isKeywordTypeof() {
|
|
16432
16541
|
return this.type === TokenType.Keyword && this.strValue === "typeof";
|
|
16433
16542
|
}
|
|
16434
16543
|
isError() {
|
|
16435
|
-
return this.type
|
|
16544
|
+
return this.type === TokenType.Error;
|
|
16436
16545
|
}
|
|
16437
16546
|
toNumber() {
|
|
16438
|
-
return this.type
|
|
16547
|
+
return this.type === TokenType.Number ? this.numValue : -1;
|
|
16548
|
+
}
|
|
16549
|
+
isTemplateLiteralPart() {
|
|
16550
|
+
return this.isString() && this.kind === StringTokenKind.TemplateLiteralPart;
|
|
16551
|
+
}
|
|
16552
|
+
isTemplateLiteralEnd() {
|
|
16553
|
+
return this.isString() && this.kind === StringTokenKind.TemplateLiteralEnd;
|
|
16554
|
+
}
|
|
16555
|
+
isTemplateLiteralInterpolationStart() {
|
|
16556
|
+
return this.isOperator("${");
|
|
16557
|
+
}
|
|
16558
|
+
isTemplateLiteralInterpolationEnd() {
|
|
16559
|
+
return this.isOperator("}");
|
|
16439
16560
|
}
|
|
16440
16561
|
toString() {
|
|
16441
16562
|
switch (this.type) {
|
|
@@ -16454,6 +16575,16 @@ var Token = class {
|
|
|
16454
16575
|
}
|
|
16455
16576
|
}
|
|
16456
16577
|
};
|
|
16578
|
+
var StringToken = class extends Token {
|
|
16579
|
+
static {
|
|
16580
|
+
__name(this, "StringToken");
|
|
16581
|
+
}
|
|
16582
|
+
kind;
|
|
16583
|
+
constructor(index, end, strValue, kind) {
|
|
16584
|
+
super(index, end, TokenType.String, 0, strValue);
|
|
16585
|
+
this.kind = kind;
|
|
16586
|
+
}
|
|
16587
|
+
};
|
|
16457
16588
|
function newCharacterToken(index, end, code) {
|
|
16458
16589
|
return new Token(index, end, TokenType.Character, code, String.fromCharCode(code));
|
|
16459
16590
|
}
|
|
@@ -16474,10 +16605,6 @@ function newOperatorToken(index, end, text2) {
|
|
|
16474
16605
|
return new Token(index, end, TokenType.Operator, 0, text2);
|
|
16475
16606
|
}
|
|
16476
16607
|
__name(newOperatorToken, "newOperatorToken");
|
|
16477
|
-
function newStringToken(index, end, text2) {
|
|
16478
|
-
return new Token(index, end, TokenType.String, 0, text2);
|
|
16479
|
-
}
|
|
16480
|
-
__name(newStringToken, "newStringToken");
|
|
16481
16608
|
function newNumberToken(index, end, n) {
|
|
16482
16609
|
return new Token(index, end, TokenType.Number, n, "");
|
|
16483
16610
|
}
|
|
@@ -16492,20 +16619,33 @@ var _Scanner = class {
|
|
|
16492
16619
|
__name(this, "_Scanner");
|
|
16493
16620
|
}
|
|
16494
16621
|
input;
|
|
16622
|
+
tokens = [];
|
|
16495
16623
|
length;
|
|
16496
16624
|
peek = 0;
|
|
16497
16625
|
index = -1;
|
|
16626
|
+
literalInterpolationDepth = 0;
|
|
16627
|
+
braceDepth = 0;
|
|
16498
16628
|
constructor(input) {
|
|
16499
16629
|
this.input = input;
|
|
16500
16630
|
this.length = input.length;
|
|
16501
16631
|
this.advance();
|
|
16502
16632
|
}
|
|
16633
|
+
scan() {
|
|
16634
|
+
let token = this.scanToken();
|
|
16635
|
+
while (token !== null) {
|
|
16636
|
+
this.tokens.push(token);
|
|
16637
|
+
token = this.scanToken();
|
|
16638
|
+
}
|
|
16639
|
+
return this.tokens;
|
|
16640
|
+
}
|
|
16503
16641
|
advance() {
|
|
16504
16642
|
this.peek = ++this.index >= this.length ? $EOF : this.input.charCodeAt(this.index);
|
|
16505
16643
|
}
|
|
16506
16644
|
scanToken() {
|
|
16507
|
-
const input = this.input
|
|
16508
|
-
|
|
16645
|
+
const input = this.input;
|
|
16646
|
+
const length = this.length;
|
|
16647
|
+
let peek = this.peek;
|
|
16648
|
+
let index = this.index;
|
|
16509
16649
|
while (peek <= $SPACE) {
|
|
16510
16650
|
if (++index >= length) {
|
|
16511
16651
|
peek = $EOF;
|
|
@@ -16519,10 +16659,12 @@ var _Scanner = class {
|
|
|
16519
16659
|
if (index >= length) {
|
|
16520
16660
|
return null;
|
|
16521
16661
|
}
|
|
16522
|
-
if (isIdentifierStart(peek))
|
|
16662
|
+
if (isIdentifierStart(peek)) {
|
|
16523
16663
|
return this.scanIdentifier();
|
|
16524
|
-
|
|
16664
|
+
}
|
|
16665
|
+
if (isDigit(peek)) {
|
|
16525
16666
|
return this.scanNumber(index);
|
|
16667
|
+
}
|
|
16526
16668
|
const start = index;
|
|
16527
16669
|
switch (peek) {
|
|
16528
16670
|
case $PERIOD:
|
|
@@ -16530,17 +16672,22 @@ var _Scanner = class {
|
|
|
16530
16672
|
return isDigit(this.peek) ? this.scanNumber(start) : newCharacterToken(start, this.index, $PERIOD);
|
|
16531
16673
|
case $LPAREN:
|
|
16532
16674
|
case $RPAREN:
|
|
16533
|
-
case $LBRACE:
|
|
16534
|
-
case $RBRACE:
|
|
16535
16675
|
case $LBRACKET:
|
|
16536
16676
|
case $RBRACKET:
|
|
16537
16677
|
case $COMMA:
|
|
16538
16678
|
case $COLON:
|
|
16539
16679
|
case $SEMICOLON:
|
|
16540
16680
|
return this.scanCharacter(start, peek);
|
|
16681
|
+
case $LBRACE:
|
|
16682
|
+
return this.scanOpenBrace(start, peek);
|
|
16683
|
+
case $RBRACE:
|
|
16684
|
+
return this.scanCloseBrace(start, peek);
|
|
16541
16685
|
case $SQ:
|
|
16542
16686
|
case $DQ:
|
|
16543
16687
|
return this.scanString();
|
|
16688
|
+
case $BT:
|
|
16689
|
+
this.advance();
|
|
16690
|
+
return this.scanTemplateLiteralPart(start);
|
|
16544
16691
|
case $HASH:
|
|
16545
16692
|
return this.scanPrivateIdentifier();
|
|
16546
16693
|
case $PLUS:
|
|
@@ -16578,6 +16725,21 @@ var _Scanner = class {
|
|
|
16578
16725
|
this.advance();
|
|
16579
16726
|
return newOperatorToken(start, this.index, str);
|
|
16580
16727
|
}
|
|
16728
|
+
scanOpenBrace(start, code) {
|
|
16729
|
+
this.braceDepth++;
|
|
16730
|
+
this.advance();
|
|
16731
|
+
return newCharacterToken(start, this.index, code);
|
|
16732
|
+
}
|
|
16733
|
+
scanCloseBrace(start, code) {
|
|
16734
|
+
this.advance();
|
|
16735
|
+
if (this.braceDepth === 0 && this.literalInterpolationDepth > 0) {
|
|
16736
|
+
this.literalInterpolationDepth--;
|
|
16737
|
+
this.tokens.push(newOperatorToken(start, this.index, "}"));
|
|
16738
|
+
return this.scanTemplateLiteralPart(this.index);
|
|
16739
|
+
}
|
|
16740
|
+
this.braceDepth--;
|
|
16741
|
+
return newCharacterToken(start, this.index, code);
|
|
16742
|
+
}
|
|
16581
16743
|
/**
|
|
16582
16744
|
* Tokenize a 2/3 char long operator
|
|
16583
16745
|
*
|
|
@@ -16662,24 +16824,11 @@ var _Scanner = class {
|
|
|
16662
16824
|
const input = this.input;
|
|
16663
16825
|
while (this.peek != quote) {
|
|
16664
16826
|
if (this.peek == $BACKSLASH) {
|
|
16665
|
-
|
|
16666
|
-
|
|
16667
|
-
|
|
16668
|
-
if (this.peek == $u) {
|
|
16669
|
-
const hex = input.substring(this.index + 1, this.index + 5);
|
|
16670
|
-
if (/^[0-9a-f]+$/i.test(hex)) {
|
|
16671
|
-
unescapedCode = parseInt(hex, 16);
|
|
16672
|
-
} else {
|
|
16673
|
-
return this.error(`Invalid unicode escape [\\u${hex}]`, 0);
|
|
16674
|
-
}
|
|
16675
|
-
for (let i = 0; i < 5; i++) {
|
|
16676
|
-
this.advance();
|
|
16677
|
-
}
|
|
16678
|
-
} else {
|
|
16679
|
-
unescapedCode = unescape(this.peek);
|
|
16680
|
-
this.advance();
|
|
16827
|
+
const result = this.scanStringBackslash(buffer, marker);
|
|
16828
|
+
if (typeof result !== "string") {
|
|
16829
|
+
return result;
|
|
16681
16830
|
}
|
|
16682
|
-
buffer
|
|
16831
|
+
buffer = result;
|
|
16683
16832
|
marker = this.index;
|
|
16684
16833
|
} else if (this.peek == $EOF) {
|
|
16685
16834
|
return this.error("Unterminated quote", 0);
|
|
@@ -16689,7 +16838,7 @@ var _Scanner = class {
|
|
|
16689
16838
|
}
|
|
16690
16839
|
const last = input.substring(marker, this.index);
|
|
16691
16840
|
this.advance();
|
|
16692
|
-
return
|
|
16841
|
+
return new StringToken(start, this.index, buffer + last, StringTokenKind.Plain);
|
|
16693
16842
|
}
|
|
16694
16843
|
scanQuestion(start) {
|
|
16695
16844
|
this.advance();
|
|
@@ -16700,10 +16849,61 @@ var _Scanner = class {
|
|
|
16700
16849
|
}
|
|
16701
16850
|
return newOperatorToken(start, this.index, str);
|
|
16702
16851
|
}
|
|
16852
|
+
scanTemplateLiteralPart(start) {
|
|
16853
|
+
let buffer = "";
|
|
16854
|
+
let marker = this.index;
|
|
16855
|
+
while (this.peek !== $BT) {
|
|
16856
|
+
if (this.peek === $BACKSLASH) {
|
|
16857
|
+
const result = this.scanStringBackslash(buffer, marker);
|
|
16858
|
+
if (typeof result !== "string") {
|
|
16859
|
+
return result;
|
|
16860
|
+
}
|
|
16861
|
+
buffer = result;
|
|
16862
|
+
marker = this.index;
|
|
16863
|
+
} else if (this.peek === $$) {
|
|
16864
|
+
const dollar = this.index;
|
|
16865
|
+
this.advance();
|
|
16866
|
+
if (this.peek === $LBRACE) {
|
|
16867
|
+
this.literalInterpolationDepth++;
|
|
16868
|
+
this.tokens.push(new StringToken(start, dollar, buffer + this.input.substring(marker, dollar), StringTokenKind.TemplateLiteralPart));
|
|
16869
|
+
this.advance();
|
|
16870
|
+
return newOperatorToken(dollar, this.index, this.input.substring(dollar, this.index));
|
|
16871
|
+
}
|
|
16872
|
+
} else if (this.peek === $EOF) {
|
|
16873
|
+
return this.error("Unterminated template literal", 0);
|
|
16874
|
+
} else {
|
|
16875
|
+
this.advance();
|
|
16876
|
+
}
|
|
16877
|
+
}
|
|
16878
|
+
const last = this.input.substring(marker, this.index);
|
|
16879
|
+
this.advance();
|
|
16880
|
+
return new StringToken(start, this.index, buffer + last, StringTokenKind.TemplateLiteralEnd);
|
|
16881
|
+
}
|
|
16703
16882
|
error(message, offset) {
|
|
16704
16883
|
const position = this.index + offset;
|
|
16705
16884
|
return newErrorToken(position, this.index, `Lexer Error: ${message} at column ${position} in expression [${this.input}]`);
|
|
16706
16885
|
}
|
|
16886
|
+
scanStringBackslash(buffer, marker) {
|
|
16887
|
+
buffer += this.input.substring(marker, this.index);
|
|
16888
|
+
let unescapedCode;
|
|
16889
|
+
this.advance();
|
|
16890
|
+
if (this.peek === $u) {
|
|
16891
|
+
const hex = this.input.substring(this.index + 1, this.index + 5);
|
|
16892
|
+
if (/^[0-9a-f]+$/i.test(hex)) {
|
|
16893
|
+
unescapedCode = parseInt(hex, 16);
|
|
16894
|
+
} else {
|
|
16895
|
+
return this.error(`Invalid unicode escape [\\u${hex}]`, 0);
|
|
16896
|
+
}
|
|
16897
|
+
for (let i = 0; i < 5; i++) {
|
|
16898
|
+
this.advance();
|
|
16899
|
+
}
|
|
16900
|
+
} else {
|
|
16901
|
+
unescapedCode = unescape(this.peek);
|
|
16902
|
+
this.advance();
|
|
16903
|
+
}
|
|
16904
|
+
buffer += String.fromCharCode(unescapedCode);
|
|
16905
|
+
return buffer;
|
|
16906
|
+
}
|
|
16707
16907
|
};
|
|
16708
16908
|
function isIdentifierStart(code) {
|
|
16709
16909
|
return $a <= code && code <= $z || $A <= code && code <= $Z || code == $_ || code == $$;
|
|
@@ -17469,7 +17669,11 @@ var _ParseAST = class {
|
|
|
17469
17669
|
const value = this.next.toNumber();
|
|
17470
17670
|
this.advance();
|
|
17471
17671
|
return new LiteralPrimitive(this.span(start), this.sourceSpan(start), value);
|
|
17472
|
-
} else if (this.next.
|
|
17672
|
+
} else if (this.next.isTemplateLiteralEnd()) {
|
|
17673
|
+
return this.parseNoInterpolationTemplateLiteral(start);
|
|
17674
|
+
} else if (this.next.isTemplateLiteralPart()) {
|
|
17675
|
+
return this.parseTemplateLiteral();
|
|
17676
|
+
} else if (this.next.isString() && this.next.kind === StringTokenKind.Plain) {
|
|
17473
17677
|
const literalValue = this.next.toString();
|
|
17474
17678
|
this.advance();
|
|
17475
17679
|
return new LiteralPrimitive(this.span(start), this.sourceSpan(start), literalValue);
|
|
@@ -17758,6 +17962,39 @@ var _ParseAST = class {
|
|
|
17758
17962
|
const sourceSpan = new AbsoluteSourceSpan(spanStart, this.currentAbsoluteOffset);
|
|
17759
17963
|
return new VariableBinding(sourceSpan, key, value);
|
|
17760
17964
|
}
|
|
17965
|
+
parseNoInterpolationTemplateLiteral(start) {
|
|
17966
|
+
const text2 = this.next.strValue;
|
|
17967
|
+
this.advance();
|
|
17968
|
+
const span = this.span(start);
|
|
17969
|
+
const sourceSpan = this.sourceSpan(start);
|
|
17970
|
+
return new TemplateLiteral(span, sourceSpan, [new TemplateLiteralElement(span, sourceSpan, text2)], []);
|
|
17971
|
+
}
|
|
17972
|
+
parseTemplateLiteral() {
|
|
17973
|
+
const start = this.inputIndex;
|
|
17974
|
+
const elements = [];
|
|
17975
|
+
const expressions = [];
|
|
17976
|
+
while (this.next !== EOF) {
|
|
17977
|
+
const token = this.next;
|
|
17978
|
+
if (token.isTemplateLiteralPart() || token.isTemplateLiteralEnd()) {
|
|
17979
|
+
elements.push(new TemplateLiteralElement(this.span(this.inputIndex), this.sourceSpan(this.inputIndex), token.strValue));
|
|
17980
|
+
this.advance();
|
|
17981
|
+
if (token.isTemplateLiteralEnd()) {
|
|
17982
|
+
break;
|
|
17983
|
+
}
|
|
17984
|
+
} else if (token.isTemplateLiteralInterpolationStart()) {
|
|
17985
|
+
this.advance();
|
|
17986
|
+
const expression = this.parsePipe();
|
|
17987
|
+
if (expression instanceof EmptyExpr$1) {
|
|
17988
|
+
this.error("Template literal interpolation cannot be empty");
|
|
17989
|
+
} else {
|
|
17990
|
+
expressions.push(expression);
|
|
17991
|
+
}
|
|
17992
|
+
} else {
|
|
17993
|
+
this.advance();
|
|
17994
|
+
}
|
|
17995
|
+
}
|
|
17996
|
+
return new TemplateLiteral(this.span(start), this.sourceSpan(start), elements, expressions);
|
|
17997
|
+
}
|
|
17761
17998
|
/**
|
|
17762
17999
|
* Consume the optional statement terminator: semicolon or comma.
|
|
17763
18000
|
*/
|
|
@@ -17952,6 +18189,20 @@ var SerializeExpressionVisitor = class {
|
|
|
17952
18189
|
visitASTWithSource(ast, context) {
|
|
17953
18190
|
return ast.ast.visit(this, context);
|
|
17954
18191
|
}
|
|
18192
|
+
visitTemplateLiteral(ast, context) {
|
|
18193
|
+
let result = "";
|
|
18194
|
+
for (let i = 0; i < ast.elements.length; i++) {
|
|
18195
|
+
result += ast.elements[i].visit(this, context);
|
|
18196
|
+
const expression = i < ast.expressions.length ? ast.expressions[i] : null;
|
|
18197
|
+
if (expression !== null) {
|
|
18198
|
+
result += "${" + expression.visit(this, context) + "}";
|
|
18199
|
+
}
|
|
18200
|
+
}
|
|
18201
|
+
return "`" + result + "`";
|
|
18202
|
+
}
|
|
18203
|
+
visitTemplateLiteralElement(ast, context) {
|
|
18204
|
+
return ast.text;
|
|
18205
|
+
}
|
|
17955
18206
|
};
|
|
17956
18207
|
function zip(left, right) {
|
|
17957
18208
|
if (left.length !== right.length)
|
|
@@ -21226,7 +21477,7 @@ function reifyCreateOperations(unit, ops) {
|
|
|
21226
21477
|
emptyDecls = emptyView.decls;
|
|
21227
21478
|
emptyVars = emptyView.vars;
|
|
21228
21479
|
}
|
|
21229
|
-
OpList.replace(op, repeaterCreate(op.handle.slot, repeaterView.fnName, op.decls, op.vars, op.tag, op.attributes, op
|
|
21480
|
+
OpList.replace(op, repeaterCreate(op.handle.slot, repeaterView.fnName, op.decls, op.vars, op.tag, op.attributes, reifyTrackBy(unit, op), op.usesComponentInstance, emptyViewFnName, emptyDecls, emptyVars, op.emptyTag, op.emptyAttributes, op.wholeSourceSpan));
|
|
21230
21481
|
break;
|
|
21231
21482
|
case OpKind.SourceLocation:
|
|
21232
21483
|
const locationsLiteral = literalArr(op.locations.map(({ targetSlot, offset, line, column }) => {
|
|
@@ -21400,6 +21651,8 @@ function reifyIrExpression(expr) {
|
|
|
21400
21651
|
return readContextLet(expr.targetSlot.slot);
|
|
21401
21652
|
case ExpressionKind.StoreLet:
|
|
21402
21653
|
return storeLet(expr.value, expr.sourceSpan);
|
|
21654
|
+
case ExpressionKind.TrackContext:
|
|
21655
|
+
return variable("this");
|
|
21403
21656
|
default:
|
|
21404
21657
|
throw new Error(`AssertionError: Unsupported reification of ir.Expression kind: ${ExpressionKind[expr.kind]}`);
|
|
21405
21658
|
}
|
|
@@ -21421,6 +21674,29 @@ function reifyListenerHandler(unit, name, handlerOps, consumesDollarEvent) {
|
|
|
21421
21674
|
return fn(params, handlerStmts, void 0, void 0, name);
|
|
21422
21675
|
}
|
|
21423
21676
|
__name(reifyListenerHandler, "reifyListenerHandler");
|
|
21677
|
+
function reifyTrackBy(unit, op) {
|
|
21678
|
+
if (op.trackByFn !== null) {
|
|
21679
|
+
return op.trackByFn;
|
|
21680
|
+
}
|
|
21681
|
+
const params = [new FnParam("$index"), new FnParam("$item")];
|
|
21682
|
+
let fn$1;
|
|
21683
|
+
if (op.trackByOps === null) {
|
|
21684
|
+
fn$1 = op.usesComponentInstance ? fn(params, [new ReturnStatement(op.track)]) : arrowFn(params, op.track);
|
|
21685
|
+
} else {
|
|
21686
|
+
reifyUpdateOperations(unit, op.trackByOps);
|
|
21687
|
+
const statements = [];
|
|
21688
|
+
for (const trackOp of op.trackByOps) {
|
|
21689
|
+
if (trackOp.kind !== OpKind.Statement) {
|
|
21690
|
+
throw new Error(`AssertionError: expected reified statements, but found op ${OpKind[trackOp.kind]}`);
|
|
21691
|
+
}
|
|
21692
|
+
statements.push(trackOp.statement);
|
|
21693
|
+
}
|
|
21694
|
+
fn$1 = op.usesComponentInstance || statements.length !== 1 || !(statements[0] instanceof ReturnStatement) ? fn(params, statements) : arrowFn(params, statements[0].value);
|
|
21695
|
+
}
|
|
21696
|
+
op.trackByFn = unit.job.pool.getSharedFunctionReference(fn$1, "_forTrack");
|
|
21697
|
+
return op.trackByFn;
|
|
21698
|
+
}
|
|
21699
|
+
__name(reifyTrackBy, "reifyTrackBy");
|
|
21424
21700
|
function removeEmptyBindings(job) {
|
|
21425
21701
|
for (const unit of job.units) {
|
|
21426
21702
|
for (const op of unit.update) {
|
|
@@ -21500,6 +21776,11 @@ function processLexicalScope$1(view, ops) {
|
|
|
21500
21776
|
case OpKind.TwoWayListener:
|
|
21501
21777
|
processLexicalScope$1(view, op.handlerOps);
|
|
21502
21778
|
break;
|
|
21779
|
+
case OpKind.RepeaterCreate:
|
|
21780
|
+
if (op.trackByOps !== null) {
|
|
21781
|
+
processLexicalScope$1(view, op.trackByOps);
|
|
21782
|
+
}
|
|
21783
|
+
break;
|
|
21503
21784
|
}
|
|
21504
21785
|
}
|
|
21505
21786
|
if (view === view.job.root) {
|
|
@@ -21821,6 +22102,11 @@ function processLexicalScope(unit, ops, savedView) {
|
|
|
21821
22102
|
case OpKind.TwoWayListener:
|
|
21822
22103
|
processLexicalScope(unit, op.handlerOps, savedView);
|
|
21823
22104
|
break;
|
|
22105
|
+
case OpKind.RepeaterCreate:
|
|
22106
|
+
if (op.trackByOps !== null) {
|
|
22107
|
+
processLexicalScope(unit, op.trackByOps, savedView);
|
|
22108
|
+
}
|
|
22109
|
+
break;
|
|
21824
22110
|
}
|
|
21825
22111
|
}
|
|
21826
22112
|
for (const op of ops) {
|
|
@@ -22091,6 +22377,8 @@ function generateTemporaries(ops) {
|
|
|
22091
22377
|
opCount++;
|
|
22092
22378
|
if (op.kind === OpKind.Listener || op.kind === OpKind.TwoWayListener) {
|
|
22093
22379
|
op.handlerOps.prepend(generateTemporaries(op.handlerOps));
|
|
22380
|
+
} else if (op.kind === OpKind.RepeaterCreate && op.trackByOps !== null) {
|
|
22381
|
+
op.trackByOps.prepend(generateTemporaries(op.trackByOps));
|
|
22094
22382
|
}
|
|
22095
22383
|
}
|
|
22096
22384
|
return generatedStatements;
|
|
@@ -22104,38 +22392,6 @@ function assignName(names, expr) {
|
|
|
22104
22392
|
expr.name = name;
|
|
22105
22393
|
}
|
|
22106
22394
|
__name(assignName, "assignName");
|
|
22107
|
-
function generateTrackFns(job) {
|
|
22108
|
-
for (const unit of job.units) {
|
|
22109
|
-
for (const op of unit.create) {
|
|
22110
|
-
if (op.kind !== OpKind.RepeaterCreate) {
|
|
22111
|
-
continue;
|
|
22112
|
-
}
|
|
22113
|
-
if (op.trackByFn !== null) {
|
|
22114
|
-
continue;
|
|
22115
|
-
}
|
|
22116
|
-
let usesComponentContext = false;
|
|
22117
|
-
op.track = transformExpressionsInExpression(op.track, (expr) => {
|
|
22118
|
-
if (expr instanceof PipeBindingExpr || expr instanceof PipeBindingVariadicExpr) {
|
|
22119
|
-
throw new Error(`Illegal State: Pipes are not allowed in this context`);
|
|
22120
|
-
}
|
|
22121
|
-
if (expr instanceof TrackContextExpr) {
|
|
22122
|
-
usesComponentContext = true;
|
|
22123
|
-
return variable("this");
|
|
22124
|
-
}
|
|
22125
|
-
return expr;
|
|
22126
|
-
}, VisitorContextFlag.None);
|
|
22127
|
-
let fn2;
|
|
22128
|
-
const fnParams = [new FnParam("$index"), new FnParam("$item")];
|
|
22129
|
-
if (usesComponentContext) {
|
|
22130
|
-
fn2 = new FunctionExpr(fnParams, [new ReturnStatement(op.track)]);
|
|
22131
|
-
} else {
|
|
22132
|
-
fn2 = arrowFn(fnParams, op.track);
|
|
22133
|
-
}
|
|
22134
|
-
op.trackByFn = job.pool.getSharedFunctionReference(fn2, "_forTrack");
|
|
22135
|
-
}
|
|
22136
|
-
}
|
|
22137
|
-
}
|
|
22138
|
-
__name(generateTrackFns, "generateTrackFns");
|
|
22139
22395
|
function optimizeTrackFns(job) {
|
|
22140
22396
|
for (const unit of job.units) {
|
|
22141
22397
|
for (const op of unit.create) {
|
|
@@ -22156,12 +22412,17 @@ function optimizeTrackFns(job) {
|
|
|
22156
22412
|
}
|
|
22157
22413
|
} else {
|
|
22158
22414
|
op.track = transformExpressionsInExpression(op.track, (expr) => {
|
|
22159
|
-
if (expr instanceof
|
|
22415
|
+
if (expr instanceof PipeBindingExpr || expr instanceof PipeBindingVariadicExpr) {
|
|
22416
|
+
throw new Error(`Illegal State: Pipes are not allowed in this context`);
|
|
22417
|
+
} else if (expr instanceof ContextExpr) {
|
|
22160
22418
|
op.usesComponentInstance = true;
|
|
22161
22419
|
return new TrackContextExpr(expr.view);
|
|
22162
22420
|
}
|
|
22163
22421
|
return expr;
|
|
22164
22422
|
}, VisitorContextFlag.None);
|
|
22423
|
+
const trackOpList = new OpList();
|
|
22424
|
+
trackOpList.push(createStatementOp(new ReturnStatement(op.track, op.track.sourceSpan)));
|
|
22425
|
+
op.trackByOps = trackOpList;
|
|
22165
22426
|
}
|
|
22166
22427
|
}
|
|
22167
22428
|
}
|
|
@@ -22328,6 +22589,8 @@ function optimizeVariables(job) {
|
|
|
22328
22589
|
for (const op of unit.create) {
|
|
22329
22590
|
if (op.kind === OpKind.Listener || op.kind === OpKind.TwoWayListener) {
|
|
22330
22591
|
inlineAlwaysInlineVariables(op.handlerOps);
|
|
22592
|
+
} else if (op.kind === OpKind.RepeaterCreate && op.trackByOps !== null) {
|
|
22593
|
+
inlineAlwaysInlineVariables(op.trackByOps);
|
|
22331
22594
|
}
|
|
22332
22595
|
}
|
|
22333
22596
|
optimizeVariablesInOpList(unit.create, job.compatibility);
|
|
@@ -22335,6 +22598,8 @@ function optimizeVariables(job) {
|
|
|
22335
22598
|
for (const op of unit.create) {
|
|
22336
22599
|
if (op.kind === OpKind.Listener || op.kind === OpKind.TwoWayListener) {
|
|
22337
22600
|
optimizeVariablesInOpList(op.handlerOps, job.compatibility);
|
|
22601
|
+
} else if (op.kind === OpKind.RepeaterCreate && op.trackByOps !== null) {
|
|
22602
|
+
optimizeVariablesInOpList(op.trackByOps, job.compatibility);
|
|
22338
22603
|
}
|
|
22339
22604
|
}
|
|
22340
22605
|
}
|
|
@@ -22733,7 +22998,6 @@ var phases = [
|
|
|
22733
22998
|
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nElementPlaceholders },
|
|
22734
22999
|
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nExpressionPlaceholders },
|
|
22735
23000
|
{ kind: CompilationJobKind.Tmpl, fn: extractI18nMessages },
|
|
22736
|
-
{ kind: CompilationJobKind.Tmpl, fn: generateTrackFns },
|
|
22737
23001
|
{ kind: CompilationJobKind.Tmpl, fn: collectI18nConsts },
|
|
22738
23002
|
{ kind: CompilationJobKind.Tmpl, fn: collectConstExpressions },
|
|
22739
23003
|
{ kind: CompilationJobKind.Both, fn: collectElementConsts },
|
|
@@ -23425,6 +23689,10 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
23425
23689
|
return not(convertAst(ast.expression, job, baseSourceSpan), convertSourceSpan(ast.span, baseSourceSpan));
|
|
23426
23690
|
} else if (ast instanceof TypeofExpression) {
|
|
23427
23691
|
return typeofExpr(convertAst(ast.expression, job, baseSourceSpan));
|
|
23692
|
+
} else if (ast instanceof TemplateLiteral) {
|
|
23693
|
+
return new TemplateLiteralExpr(ast.elements.map((el) => {
|
|
23694
|
+
return new TemplateLiteralElementExpr(el.text, convertSourceSpan(el.span, baseSourceSpan));
|
|
23695
|
+
}), ast.expressions.map((expr) => convertAst(expr, job, baseSourceSpan)), convertSourceSpan(ast.span, baseSourceSpan));
|
|
23428
23696
|
} else {
|
|
23429
23697
|
throw new Error(`Unhandled expression type "${ast.constructor.name}" in file "${baseSourceSpan?.start.file.url}"`);
|
|
23430
23698
|
}
|
|
@@ -25755,7 +26023,6 @@ function addFeatures(definitionMap, meta) {
|
|
|
25755
26023
|
const features = [];
|
|
25756
26024
|
const providers = meta.providers;
|
|
25757
26025
|
const viewProviders = meta.viewProviders;
|
|
25758
|
-
const inputKeys = Object.keys(meta.inputs);
|
|
25759
26026
|
if (providers || viewProviders) {
|
|
25760
26027
|
const args = [providers || new LiteralArrayExpr([])];
|
|
25761
26028
|
if (viewProviders) {
|
|
@@ -25763,12 +26030,6 @@ function addFeatures(definitionMap, meta) {
|
|
|
25763
26030
|
}
|
|
25764
26031
|
features.push(importExpr(Identifiers.ProvidersFeature).callFn(args));
|
|
25765
26032
|
}
|
|
25766
|
-
for (const key of inputKeys) {
|
|
25767
|
-
if (meta.inputs[key].transformFunction !== null) {
|
|
25768
|
-
features.push(importExpr(Identifiers.InputTransformsFeatureFeature));
|
|
25769
|
-
break;
|
|
25770
|
-
}
|
|
25771
|
-
}
|
|
25772
26033
|
if (meta.hostDirectives?.length) {
|
|
25773
26034
|
features.push(importExpr(Identifiers.HostDirectivesFeature).callFn([createHostDirectivesFeatureArg(meta.hostDirectives)]));
|
|
25774
26035
|
}
|
|
@@ -27615,7 +27876,7 @@ function publishFacade(global) {
|
|
|
27615
27876
|
ng.\u0275compilerFacade = new CompilerFacadeImpl();
|
|
27616
27877
|
}
|
|
27617
27878
|
__name(publishFacade, "publishFacade");
|
|
27618
|
-
var VERSION = new Version("19.
|
|
27879
|
+
var VERSION = new Version("19.2.0");
|
|
27619
27880
|
var CompilerConfig = class {
|
|
27620
27881
|
static {
|
|
27621
27882
|
__name(this, "CompilerConfig");
|
|
@@ -29323,11 +29584,10 @@ function compileClassDebugInfo(debugInfo) {
|
|
|
29323
29584
|
}
|
|
29324
29585
|
__name(compileClassDebugInfo, "compileClassDebugInfo");
|
|
29325
29586
|
function compileHmrInitializer(meta) {
|
|
29326
|
-
const id = encodeURIComponent(`${meta.filePath}@${meta.className}`);
|
|
29327
|
-
const urlPartial = `./@ng/component?c=${id}&t=`;
|
|
29328
29587
|
const moduleName = "m";
|
|
29329
29588
|
const dataName = "d";
|
|
29330
29589
|
const timestampName = "t";
|
|
29590
|
+
const idName = "id";
|
|
29331
29591
|
const importCallbackName = `${meta.className}_HmrLoad`;
|
|
29332
29592
|
const namespaces = meta.namespaceDependencies.map((dep) => {
|
|
29333
29593
|
return new ExternalExpr({ moduleName: dep.moduleName, name: null });
|
|
@@ -29337,10 +29597,12 @@ function compileHmrInitializer(meta) {
|
|
|
29337
29597
|
meta.type,
|
|
29338
29598
|
defaultRead,
|
|
29339
29599
|
literalArr(namespaces),
|
|
29340
|
-
literalArr(meta.localDependencies.map((l) => l.runtimeRepresentation))
|
|
29600
|
+
literalArr(meta.localDependencies.map((l) => l.runtimeRepresentation)),
|
|
29601
|
+
variable("import").prop("meta"),
|
|
29602
|
+
variable(idName)
|
|
29341
29603
|
]);
|
|
29342
29604
|
const replaceCallback = arrowFn([new FnParam(moduleName)], defaultRead.and(replaceCall));
|
|
29343
|
-
const urlValue = literal(
|
|
29605
|
+
const urlValue = literal(`./@ng/component?c=`).plus(variable(idName)).plus(literal("&t=")).plus(variable("encodeURIComponent").callFn([variable(timestampName)]));
|
|
29344
29606
|
const urlBase = variable("import").prop("meta").prop("url");
|
|
29345
29607
|
const urlHref = new InstantiateExpr(variable("URL"), [urlValue, urlBase]).prop("href");
|
|
29346
29608
|
const importCallback = new DeclareFunctionStmt(importCallbackName, [new FnParam(timestampName)], [
|
|
@@ -29349,11 +29611,13 @@ function compileHmrInitializer(meta) {
|
|
|
29349
29611
|
// programmatically avoid this warning in the future, this added comment can be removed here.
|
|
29350
29612
|
new DynamicImportExpr(urlHref, null, "@vite-ignore").prop("then").callFn([replaceCallback]).toStmt()
|
|
29351
29613
|
], null, StmtModifier.Final);
|
|
29352
|
-
const updateCallback = arrowFn([new FnParam(dataName)], variable(dataName).prop("id").identical(
|
|
29614
|
+
const updateCallback = arrowFn([new FnParam(dataName)], variable(dataName).prop("id").identical(variable(idName)).and(variable(importCallbackName).callFn([variable(dataName).prop("timestamp")])));
|
|
29353
29615
|
const initialCall = variable(importCallbackName).callFn([variable("Date").prop("now").callFn([])]);
|
|
29354
29616
|
const hotRead = variable("import").prop("meta").prop("hot");
|
|
29355
29617
|
const hotListener = hotRead.clone().prop("on").callFn([literal("angular:component-update"), updateCallback]);
|
|
29356
29618
|
return arrowFn([], [
|
|
29619
|
+
// const id = <id>;
|
|
29620
|
+
new DeclareVarStmt(idName, literal(encodeURIComponent(`${meta.filePath}@${meta.className}`)), null, StmtModifier.Final),
|
|
29357
29621
|
// function Cmp_HmrLoad() {...}.
|
|
29358
29622
|
importCallback,
|
|
29359
29623
|
// ngDevMode && Cmp_HmrLoad(Date.now());
|
|
@@ -29390,7 +29654,7 @@ var MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = "18.0.0";
|
|
|
29390
29654
|
function compileDeclareClassMetadata(metadata) {
|
|
29391
29655
|
const definitionMap = new DefinitionMap();
|
|
29392
29656
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
29393
|
-
definitionMap.set("version", literal("19.
|
|
29657
|
+
definitionMap.set("version", literal("19.2.0"));
|
|
29394
29658
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
29395
29659
|
definitionMap.set("type", metadata.type);
|
|
29396
29660
|
definitionMap.set("decorators", metadata.decorators);
|
|
@@ -29409,7 +29673,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
|
|
|
29409
29673
|
callbackReturnDefinitionMap.set("ctorParameters", metadata.ctorParameters ?? literal(null));
|
|
29410
29674
|
callbackReturnDefinitionMap.set("propDecorators", metadata.propDecorators ?? literal(null));
|
|
29411
29675
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
|
|
29412
|
-
definitionMap.set("version", literal("19.
|
|
29676
|
+
definitionMap.set("version", literal("19.2.0"));
|
|
29413
29677
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
29414
29678
|
definitionMap.set("type", metadata.type);
|
|
29415
29679
|
definitionMap.set("resolveDeferredDeps", compileComponentMetadataAsyncResolver(dependencies));
|
|
@@ -29478,7 +29742,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
29478
29742
|
const definitionMap = new DefinitionMap();
|
|
29479
29743
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
29480
29744
|
definitionMap.set("minVersion", literal(minVersion));
|
|
29481
|
-
definitionMap.set("version", literal("19.
|
|
29745
|
+
definitionMap.set("version", literal("19.2.0"));
|
|
29482
29746
|
definitionMap.set("type", meta.type.value);
|
|
29483
29747
|
if (meta.isStandalone !== void 0) {
|
|
29484
29748
|
definitionMap.set("isStandalone", literal(meta.isStandalone));
|
|
@@ -29806,7 +30070,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION$4 = "12.0.0";
|
|
|
29806
30070
|
function compileDeclareFactoryFunction(meta) {
|
|
29807
30071
|
const definitionMap = new DefinitionMap();
|
|
29808
30072
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
29809
|
-
definitionMap.set("version", literal("19.
|
|
30073
|
+
definitionMap.set("version", literal("19.2.0"));
|
|
29810
30074
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
29811
30075
|
definitionMap.set("type", meta.type.value);
|
|
29812
30076
|
definitionMap.set("deps", compileDependencies(meta.deps));
|
|
@@ -29829,7 +30093,7 @@ __name(compileDeclareInjectableFromMetadata, "compileDeclareInjectableFromMetada
|
|
|
29829
30093
|
function createInjectableDefinitionMap(meta) {
|
|
29830
30094
|
const definitionMap = new DefinitionMap();
|
|
29831
30095
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
29832
|
-
definitionMap.set("version", literal("19.
|
|
30096
|
+
definitionMap.set("version", literal("19.2.0"));
|
|
29833
30097
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
29834
30098
|
definitionMap.set("type", meta.type.value);
|
|
29835
30099
|
if (meta.providedIn !== void 0) {
|
|
@@ -29867,7 +30131,7 @@ __name(compileDeclareInjectorFromMetadata, "compileDeclareInjectorFromMetadata")
|
|
|
29867
30131
|
function createInjectorDefinitionMap(meta) {
|
|
29868
30132
|
const definitionMap = new DefinitionMap();
|
|
29869
30133
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
29870
|
-
definitionMap.set("version", literal("19.
|
|
30134
|
+
definitionMap.set("version", literal("19.2.0"));
|
|
29871
30135
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
29872
30136
|
definitionMap.set("type", meta.type.value);
|
|
29873
30137
|
definitionMap.set("providers", meta.providers);
|
|
@@ -29891,7 +30155,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
29891
30155
|
throw new Error("Invalid path! Local compilation mode should not get into the partial compilation path");
|
|
29892
30156
|
}
|
|
29893
30157
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
29894
|
-
definitionMap.set("version", literal("19.
|
|
30158
|
+
definitionMap.set("version", literal("19.2.0"));
|
|
29895
30159
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
29896
30160
|
definitionMap.set("type", meta.type.value);
|
|
29897
30161
|
if (meta.bootstrap.length > 0) {
|
|
@@ -29926,7 +30190,7 @@ __name(compileDeclarePipeFromMetadata, "compileDeclarePipeFromMetadata");
|
|
|
29926
30190
|
function createPipeDefinitionMap(meta) {
|
|
29927
30191
|
const definitionMap = new DefinitionMap();
|
|
29928
30192
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
29929
|
-
definitionMap.set("version", literal("19.
|
|
30193
|
+
definitionMap.set("version", literal("19.2.0"));
|
|
29930
30194
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
29931
30195
|
definitionMap.set("type", meta.type.value);
|
|
29932
30196
|
if (meta.isStandalone !== void 0) {
|
|
@@ -30062,11 +30326,15 @@ publishFacade(_global);
|
|
|
30062
30326
|
SplitInterpolation,
|
|
30063
30327
|
Statement,
|
|
30064
30328
|
StmtModifier,
|
|
30329
|
+
StringToken,
|
|
30330
|
+
StringTokenKind,
|
|
30065
30331
|
TagContentType,
|
|
30066
|
-
|
|
30332
|
+
TaggedTemplateLiteralExpr,
|
|
30067
30333
|
TemplateBindingParseResult,
|
|
30068
30334
|
TemplateLiteral,
|
|
30069
30335
|
TemplateLiteralElement,
|
|
30336
|
+
TemplateLiteralElementExpr,
|
|
30337
|
+
TemplateLiteralExpr,
|
|
30070
30338
|
Text,
|
|
30071
30339
|
ThisReceiver,
|
|
30072
30340
|
TmplAstBlockNode,
|
|
@@ -30188,7 +30456,7 @@ publishFacade(_global);
|
|
|
30188
30456
|
|
|
30189
30457
|
@angular/compiler/fesm2022/compiler.mjs:
|
|
30190
30458
|
(**
|
|
30191
|
-
* @license Angular v19.
|
|
30459
|
+
* @license Angular v19.2.0
|
|
30192
30460
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
30193
30461
|
* License: MIT
|
|
30194
30462
|
*)
|