@angular/core 19.1.5 → 19.2.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/core.mjs +690 -649
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +1 -1
- package/fesm2022/primitives/signals.mjs +1 -1
- package/fesm2022/rxjs-interop.mjs +28 -23
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/testing.mjs +4 -4
- package/index.d.ts +82 -25
- package/package.json +1 -1
- package/primitives/event-dispatch/index.d.ts +1 -1
- package/primitives/signals/index.d.ts +1 -1
- package/rxjs-interop/index.d.ts +14 -4
- package/schematics/bundles/{apply_import_manager-57619f3c.js → apply_import_manager-5ea49df9.js} +3 -3
- package/schematics/bundles/{checker-ce908760.js → checker-78667e44.js} +391 -99
- package/schematics/bundles/cleanup-unused-imports.js +5 -5
- package/schematics/bundles/{compiler_host-33b24174.js → compiler_host-b22de7db.js} +2 -2
- package/schematics/bundles/control-flow-migration.js +3 -3
- package/schematics/bundles/explicit-standalone-flag.js +3 -3
- package/schematics/bundles/imports-31a38653.js +1 -1
- package/schematics/bundles/{index-d6e51169.js → index-3e744c38.js} +4 -4
- package/schematics/bundles/{index-59a1204f.js → index-de135c2f.js} +4 -4
- package/schematics/bundles/inject-migration.js +3 -3
- package/schematics/bundles/leading_space-6e7a8ec6.js +1 -1
- package/schematics/bundles/{migrate_ts_type_references-2c37e645.js → migrate_ts_type_references-60e2a469.js} +5 -5
- package/schematics/bundles/nodes-88c2157f.js +1 -1
- package/schematics/bundles/output-migration.js +5 -5
- package/schematics/bundles/pending-tasks.js +3 -3
- package/schematics/bundles/{program-5512058c.js → program-b0d98952.js} +26 -100
- package/schematics/bundles/project_tsconfig_paths-6c9cde78.js +1 -1
- package/schematics/bundles/provide-initializer.js +3 -3
- package/schematics/bundles/route-lazy-loading.js +3 -3
- package/schematics/bundles/signal-input-migration.js +6 -6
- package/schematics/bundles/signal-queries-migration.js +6 -6
- package/schematics/bundles/signals.js +6 -6
- package/schematics/bundles/standalone-migration.js +5 -5
- package/testing/index.d.ts +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.1
|
|
3
|
+
* @license Angular v19.2.0-next.1
|
|
4
4
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -1197,7 +1197,7 @@ class InvokeFunctionExpr extends Expression {
|
|
|
1197
1197
|
return new InvokeFunctionExpr(this.fn.clone(), this.args.map((arg) => arg.clone()), this.type, this.sourceSpan, this.pure);
|
|
1198
1198
|
}
|
|
1199
1199
|
}
|
|
1200
|
-
class
|
|
1200
|
+
class TaggedTemplateLiteralExpr extends Expression {
|
|
1201
1201
|
tag;
|
|
1202
1202
|
template;
|
|
1203
1203
|
constructor(tag, template, type, sourceSpan) {
|
|
@@ -1206,19 +1206,18 @@ class TaggedTemplateExpr extends Expression {
|
|
|
1206
1206
|
this.template = template;
|
|
1207
1207
|
}
|
|
1208
1208
|
isEquivalent(e) {
|
|
1209
|
-
return (e instanceof
|
|
1209
|
+
return (e instanceof TaggedTemplateLiteralExpr &&
|
|
1210
1210
|
this.tag.isEquivalent(e.tag) &&
|
|
1211
|
-
|
|
1212
|
-
areAllEquivalent(this.template.expressions, e.template.expressions));
|
|
1211
|
+
this.template.isEquivalent(e.template));
|
|
1213
1212
|
}
|
|
1214
1213
|
isConstant() {
|
|
1215
1214
|
return false;
|
|
1216
1215
|
}
|
|
1217
1216
|
visitExpression(visitor, context) {
|
|
1218
|
-
return visitor.
|
|
1217
|
+
return visitor.visitTaggedTemplateLiteralExpr(this, context);
|
|
1219
1218
|
}
|
|
1220
1219
|
clone() {
|
|
1221
|
-
return new
|
|
1220
|
+
return new TaggedTemplateLiteralExpr(this.tag.clone(), this.template.clone(), this.type, this.sourceSpan);
|
|
1222
1221
|
}
|
|
1223
1222
|
}
|
|
1224
1223
|
class InstantiateExpr extends Expression {
|
|
@@ -1263,24 +1262,35 @@ class LiteralExpr extends Expression {
|
|
|
1263
1262
|
return new LiteralExpr(this.value, this.type, this.sourceSpan);
|
|
1264
1263
|
}
|
|
1265
1264
|
}
|
|
1266
|
-
class
|
|
1265
|
+
class TemplateLiteralExpr extends Expression {
|
|
1267
1266
|
elements;
|
|
1268
1267
|
expressions;
|
|
1269
|
-
constructor(elements, expressions) {
|
|
1268
|
+
constructor(elements, expressions, sourceSpan) {
|
|
1269
|
+
super(null, sourceSpan);
|
|
1270
1270
|
this.elements = elements;
|
|
1271
1271
|
this.expressions = expressions;
|
|
1272
1272
|
}
|
|
1273
|
+
isEquivalent(e) {
|
|
1274
|
+
return (e instanceof TemplateLiteralExpr &&
|
|
1275
|
+
areAllEquivalentPredicate(this.elements, e.elements, (a, b) => a.text === b.text) &&
|
|
1276
|
+
areAllEquivalent(this.expressions, e.expressions));
|
|
1277
|
+
}
|
|
1278
|
+
isConstant() {
|
|
1279
|
+
return false;
|
|
1280
|
+
}
|
|
1281
|
+
visitExpression(visitor, context) {
|
|
1282
|
+
return visitor.visitTemplateLiteralExpr(this, context);
|
|
1283
|
+
}
|
|
1273
1284
|
clone() {
|
|
1274
|
-
return new
|
|
1285
|
+
return new TemplateLiteralExpr(this.elements.map((el) => el.clone()), this.expressions.map((expr) => expr.clone()));
|
|
1275
1286
|
}
|
|
1276
1287
|
}
|
|
1277
|
-
class
|
|
1288
|
+
class TemplateLiteralElementExpr extends Expression {
|
|
1278
1289
|
text;
|
|
1279
|
-
sourceSpan;
|
|
1280
1290
|
rawText;
|
|
1281
1291
|
constructor(text, sourceSpan, rawText) {
|
|
1292
|
+
super(STRING_TYPE, sourceSpan);
|
|
1282
1293
|
this.text = text;
|
|
1283
|
-
this.sourceSpan = sourceSpan;
|
|
1284
1294
|
// If `rawText` is not provided, try to extract the raw string from its
|
|
1285
1295
|
// associated `sourceSpan`. If that is also not available, "fake" the raw
|
|
1286
1296
|
// string instead by escaping the following control sequences:
|
|
@@ -1290,8 +1300,17 @@ class TemplateLiteralElement {
|
|
|
1290
1300
|
this.rawText =
|
|
1291
1301
|
rawText ?? sourceSpan?.toString() ?? escapeForTemplateLiteral(escapeSlashes(text));
|
|
1292
1302
|
}
|
|
1303
|
+
visitExpression(visitor, context) {
|
|
1304
|
+
return visitor.visitTemplateLiteralElementExpr(this, context);
|
|
1305
|
+
}
|
|
1306
|
+
isEquivalent(e) {
|
|
1307
|
+
return (e instanceof TemplateLiteralElementExpr && e.text === this.text && e.rawText === this.rawText);
|
|
1308
|
+
}
|
|
1309
|
+
isConstant() {
|
|
1310
|
+
return true;
|
|
1311
|
+
}
|
|
1293
1312
|
clone() {
|
|
1294
|
-
return new
|
|
1313
|
+
return new TemplateLiteralElementExpr(this.text, this.sourceSpan, this.rawText);
|
|
1295
1314
|
}
|
|
1296
1315
|
}
|
|
1297
1316
|
class LiteralPiece {
|
|
@@ -1973,9 +1992,9 @@ class RecursiveAstVisitor$1 {
|
|
|
1973
1992
|
this.visitAllExpressions(ast.args, context);
|
|
1974
1993
|
return this.visitExpression(ast, context);
|
|
1975
1994
|
}
|
|
1976
|
-
|
|
1995
|
+
visitTaggedTemplateLiteralExpr(ast, context) {
|
|
1977
1996
|
ast.tag.visitExpression(this, context);
|
|
1978
|
-
|
|
1997
|
+
ast.template.visitExpression(this, context);
|
|
1979
1998
|
return this.visitExpression(ast, context);
|
|
1980
1999
|
}
|
|
1981
2000
|
visitInstantiateExpr(ast, context) {
|
|
@@ -2050,6 +2069,14 @@ class RecursiveAstVisitor$1 {
|
|
|
2050
2069
|
this.visitAllExpressions(ast.parts, context);
|
|
2051
2070
|
return this.visitExpression(ast, context);
|
|
2052
2071
|
}
|
|
2072
|
+
visitTemplateLiteralExpr(ast, context) {
|
|
2073
|
+
this.visitAllExpressions(ast.elements, context);
|
|
2074
|
+
this.visitAllExpressions(ast.expressions, context);
|
|
2075
|
+
return this.visitExpression(ast, context);
|
|
2076
|
+
}
|
|
2077
|
+
visitTemplateLiteralElementExpr(ast, context) {
|
|
2078
|
+
return this.visitExpression(ast, context);
|
|
2079
|
+
}
|
|
2053
2080
|
visitAllExpressions(exprs, context) {
|
|
2054
2081
|
exprs.forEach((expr) => expr.visitExpression(this, context));
|
|
2055
2082
|
}
|
|
@@ -2127,7 +2154,7 @@ function ifStmt(condition, thenClause, elseClause, sourceSpan, leadingComments)
|
|
|
2127
2154
|
return new IfStmt(condition, thenClause, elseClause, sourceSpan, leadingComments);
|
|
2128
2155
|
}
|
|
2129
2156
|
function taggedTemplate(tag, template, type, sourceSpan) {
|
|
2130
|
-
return new
|
|
2157
|
+
return new TaggedTemplateLiteralExpr(tag, template, type, sourceSpan);
|
|
2131
2158
|
}
|
|
2132
2159
|
function literal$1(value, type, sourceSpan) {
|
|
2133
2160
|
return new LiteralExpr(value, type, sourceSpan);
|
|
@@ -3465,16 +3492,26 @@ class AbstractEmitterVisitor {
|
|
|
3465
3492
|
ctx.print(expr, `)`);
|
|
3466
3493
|
return null;
|
|
3467
3494
|
}
|
|
3468
|
-
|
|
3495
|
+
visitTaggedTemplateLiteralExpr(expr, ctx) {
|
|
3469
3496
|
expr.tag.visitExpression(this, ctx);
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3497
|
+
expr.template.visitExpression(this, ctx);
|
|
3498
|
+
return null;
|
|
3499
|
+
}
|
|
3500
|
+
visitTemplateLiteralExpr(expr, ctx) {
|
|
3501
|
+
ctx.print(expr, '`');
|
|
3502
|
+
for (let i = 0; i < expr.elements.length; i++) {
|
|
3503
|
+
expr.elements[i].visitExpression(this, ctx);
|
|
3504
|
+
const expression = i < expr.expressions.length ? expr.expressions[i] : null;
|
|
3505
|
+
if (expression !== null) {
|
|
3506
|
+
ctx.print(expression, '${');
|
|
3507
|
+
expression.visitExpression(this, ctx);
|
|
3508
|
+
ctx.print(expression, '}');
|
|
3509
|
+
}
|
|
3475
3510
|
}
|
|
3476
3511
|
ctx.print(expr, '`');
|
|
3477
|
-
|
|
3512
|
+
}
|
|
3513
|
+
visitTemplateLiteralElementExpr(expr, ctx) {
|
|
3514
|
+
ctx.print(expr, expr.rawText);
|
|
3478
3515
|
}
|
|
3479
3516
|
visitWrappedNodeExpr(ast, ctx) {
|
|
3480
3517
|
throw new Error('Abstract emitter cannot visit WrappedNodeExpr.');
|
|
@@ -4326,6 +4363,28 @@ class SafeCall extends AST {
|
|
|
4326
4363
|
return visitor.visitSafeCall(this, context);
|
|
4327
4364
|
}
|
|
4328
4365
|
}
|
|
4366
|
+
class TemplateLiteral extends AST {
|
|
4367
|
+
elements;
|
|
4368
|
+
expressions;
|
|
4369
|
+
constructor(span, sourceSpan, elements, expressions) {
|
|
4370
|
+
super(span, sourceSpan);
|
|
4371
|
+
this.elements = elements;
|
|
4372
|
+
this.expressions = expressions;
|
|
4373
|
+
}
|
|
4374
|
+
visit(visitor, context) {
|
|
4375
|
+
return visitor.visitTemplateLiteral(this, context);
|
|
4376
|
+
}
|
|
4377
|
+
}
|
|
4378
|
+
class TemplateLiteralElement extends AST {
|
|
4379
|
+
text;
|
|
4380
|
+
constructor(span, sourceSpan, text) {
|
|
4381
|
+
super(span, sourceSpan);
|
|
4382
|
+
this.text = text;
|
|
4383
|
+
}
|
|
4384
|
+
visit(visitor, context) {
|
|
4385
|
+
return visitor.visitTemplateLiteralElement(this, context);
|
|
4386
|
+
}
|
|
4387
|
+
}
|
|
4329
4388
|
/**
|
|
4330
4389
|
* Records the absolute position of a text span in a source file, where `start` and `end` are the
|
|
4331
4390
|
* starting and ending byte offsets, respectively, of the text span in a source file.
|
|
@@ -4473,6 +4532,18 @@ class RecursiveAstVisitor {
|
|
|
4473
4532
|
this.visit(ast.receiver, context);
|
|
4474
4533
|
this.visitAll(ast.args, context);
|
|
4475
4534
|
}
|
|
4535
|
+
visitTemplateLiteral(ast, context) {
|
|
4536
|
+
// Iterate in the declaration order. Note that there will
|
|
4537
|
+
// always be one expression less than the number of elements.
|
|
4538
|
+
for (let i = 0; i < ast.elements.length; i++) {
|
|
4539
|
+
this.visit(ast.elements[i], context);
|
|
4540
|
+
const expression = i < ast.expressions.length ? ast.expressions[i] : null;
|
|
4541
|
+
if (expression !== null) {
|
|
4542
|
+
this.visit(expression, context);
|
|
4543
|
+
}
|
|
4544
|
+
}
|
|
4545
|
+
}
|
|
4546
|
+
visitTemplateLiteralElement(ast, context) { }
|
|
4476
4547
|
// This is not part of the AstVisitor interface, just a helper method
|
|
4477
4548
|
visitAll(asts, context) {
|
|
4478
4549
|
for (const ast of asts) {
|
|
@@ -6570,7 +6641,7 @@ class AbstractJsEmitterVisitor extends AbstractEmitterVisitor {
|
|
|
6570
6641
|
ctx.println(stmt, `;`);
|
|
6571
6642
|
return null;
|
|
6572
6643
|
}
|
|
6573
|
-
|
|
6644
|
+
visitTaggedTemplateLiteralExpr(ast, ctx) {
|
|
6574
6645
|
// The following convoluted piece of code is effectively the downlevelled equivalent of
|
|
6575
6646
|
// ```
|
|
6576
6647
|
// tag`...`
|
|
@@ -6591,6 +6662,23 @@ class AbstractJsEmitterVisitor extends AbstractEmitterVisitor {
|
|
|
6591
6662
|
ctx.print(ast, ')');
|
|
6592
6663
|
return null;
|
|
6593
6664
|
}
|
|
6665
|
+
visitTemplateLiteralExpr(expr, ctx) {
|
|
6666
|
+
ctx.print(expr, '`');
|
|
6667
|
+
for (let i = 0; i < expr.elements.length; i++) {
|
|
6668
|
+
expr.elements[i].visitExpression(this, ctx);
|
|
6669
|
+
const expression = i < expr.expressions.length ? expr.expressions[i] : null;
|
|
6670
|
+
if (expression !== null) {
|
|
6671
|
+
ctx.print(expression, '${');
|
|
6672
|
+
expression.visitExpression(this, ctx);
|
|
6673
|
+
ctx.print(expression, '}');
|
|
6674
|
+
}
|
|
6675
|
+
}
|
|
6676
|
+
ctx.print(expr, '`');
|
|
6677
|
+
}
|
|
6678
|
+
visitTemplateLiteralElementExpr(expr, ctx) {
|
|
6679
|
+
ctx.print(expr, expr.rawText);
|
|
6680
|
+
return null;
|
|
6681
|
+
}
|
|
6594
6682
|
visitFunctionExpr(ast, ctx) {
|
|
6595
6683
|
ctx.print(ast, `function${ast.name ? ' ' + ast.name : ''}(`);
|
|
6596
6684
|
this._visitParams(ast.params, ctx);
|
|
@@ -10166,7 +10254,7 @@ function transformExpressionsInExpression(expr, transform, flags) {
|
|
|
10166
10254
|
else if (expr instanceof NotExpr) {
|
|
10167
10255
|
expr.condition = transformExpressionsInExpression(expr.condition, transform, flags);
|
|
10168
10256
|
}
|
|
10169
|
-
else if (expr instanceof
|
|
10257
|
+
else if (expr instanceof TaggedTemplateLiteralExpr) {
|
|
10170
10258
|
expr.tag = transformExpressionsInExpression(expr.tag, transform, flags);
|
|
10171
10259
|
expr.template.expressions = expr.template.expressions.map((e) => transformExpressionsInExpression(e, transform, flags));
|
|
10172
10260
|
}
|
|
@@ -10181,6 +10269,11 @@ function transformExpressionsInExpression(expr, transform, flags) {
|
|
|
10181
10269
|
}
|
|
10182
10270
|
}
|
|
10183
10271
|
else if (expr instanceof WrappedNodeExpr) ;
|
|
10272
|
+
else if (expr instanceof TemplateLiteralExpr) {
|
|
10273
|
+
for (let i = 0; i < expr.expressions.length; i++) {
|
|
10274
|
+
expr.expressions[i] = transformExpressionsInExpression(expr.expressions[i], transform, flags);
|
|
10275
|
+
}
|
|
10276
|
+
}
|
|
10184
10277
|
else if (expr instanceof ReadVarExpr ||
|
|
10185
10278
|
expr instanceof ExternalExpr ||
|
|
10186
10279
|
expr instanceof LiteralExpr) ;
|
|
@@ -11833,7 +11926,7 @@ class ElementAttributes {
|
|
|
11833
11926
|
if (!isStringLiteral(value)) {
|
|
11834
11927
|
throw Error('AssertionError: extracted attribute value should be string literal');
|
|
11835
11928
|
}
|
|
11836
|
-
array.push(taggedTemplate(trustedValueFn, new
|
|
11929
|
+
array.push(taggedTemplate(trustedValueFn, new TemplateLiteralExpr([new TemplateLiteralElementExpr(value.value)], []), undefined, value.sourceSpan));
|
|
11837
11930
|
}
|
|
11838
11931
|
else {
|
|
11839
11932
|
array.push(value);
|
|
@@ -17324,6 +17417,12 @@ var TokenType;
|
|
|
17324
17417
|
TokenType[TokenType["Number"] = 6] = "Number";
|
|
17325
17418
|
TokenType[TokenType["Error"] = 7] = "Error";
|
|
17326
17419
|
})(TokenType || (TokenType = {}));
|
|
17420
|
+
var StringTokenKind;
|
|
17421
|
+
(function (StringTokenKind) {
|
|
17422
|
+
StringTokenKind[StringTokenKind["Plain"] = 0] = "Plain";
|
|
17423
|
+
StringTokenKind[StringTokenKind["TemplateLiteralPart"] = 1] = "TemplateLiteralPart";
|
|
17424
|
+
StringTokenKind[StringTokenKind["TemplateLiteralEnd"] = 2] = "TemplateLiteralEnd";
|
|
17425
|
+
})(StringTokenKind || (StringTokenKind = {}));
|
|
17327
17426
|
const KEYWORDS = [
|
|
17328
17427
|
'var',
|
|
17329
17428
|
'let',
|
|
@@ -17339,14 +17438,7 @@ const KEYWORDS = [
|
|
|
17339
17438
|
];
|
|
17340
17439
|
class Lexer {
|
|
17341
17440
|
tokenize(text) {
|
|
17342
|
-
|
|
17343
|
-
const tokens = [];
|
|
17344
|
-
let token = scanner.scanToken();
|
|
17345
|
-
while (token != null) {
|
|
17346
|
-
tokens.push(token);
|
|
17347
|
-
token = scanner.scanToken();
|
|
17348
|
-
}
|
|
17349
|
-
return tokens;
|
|
17441
|
+
return new _Scanner(text).scan();
|
|
17350
17442
|
}
|
|
17351
17443
|
}
|
|
17352
17444
|
class Token {
|
|
@@ -17363,55 +17455,67 @@ class Token {
|
|
|
17363
17455
|
this.strValue = strValue;
|
|
17364
17456
|
}
|
|
17365
17457
|
isCharacter(code) {
|
|
17366
|
-
return this.type
|
|
17458
|
+
return this.type === TokenType.Character && this.numValue === code;
|
|
17367
17459
|
}
|
|
17368
17460
|
isNumber() {
|
|
17369
|
-
return this.type
|
|
17461
|
+
return this.type === TokenType.Number;
|
|
17370
17462
|
}
|
|
17371
17463
|
isString() {
|
|
17372
|
-
return this.type
|
|
17464
|
+
return this.type === TokenType.String;
|
|
17373
17465
|
}
|
|
17374
17466
|
isOperator(operator) {
|
|
17375
|
-
return this.type
|
|
17467
|
+
return this.type === TokenType.Operator && this.strValue === operator;
|
|
17376
17468
|
}
|
|
17377
17469
|
isIdentifier() {
|
|
17378
|
-
return this.type
|
|
17470
|
+
return this.type === TokenType.Identifier;
|
|
17379
17471
|
}
|
|
17380
17472
|
isPrivateIdentifier() {
|
|
17381
|
-
return this.type
|
|
17473
|
+
return this.type === TokenType.PrivateIdentifier;
|
|
17382
17474
|
}
|
|
17383
17475
|
isKeyword() {
|
|
17384
|
-
return this.type
|
|
17476
|
+
return this.type === TokenType.Keyword;
|
|
17385
17477
|
}
|
|
17386
17478
|
isKeywordLet() {
|
|
17387
|
-
return this.type
|
|
17479
|
+
return this.type === TokenType.Keyword && this.strValue === 'let';
|
|
17388
17480
|
}
|
|
17389
17481
|
isKeywordAs() {
|
|
17390
|
-
return this.type
|
|
17482
|
+
return this.type === TokenType.Keyword && this.strValue === 'as';
|
|
17391
17483
|
}
|
|
17392
17484
|
isKeywordNull() {
|
|
17393
|
-
return this.type
|
|
17485
|
+
return this.type === TokenType.Keyword && this.strValue === 'null';
|
|
17394
17486
|
}
|
|
17395
17487
|
isKeywordUndefined() {
|
|
17396
|
-
return this.type
|
|
17488
|
+
return this.type === TokenType.Keyword && this.strValue === 'undefined';
|
|
17397
17489
|
}
|
|
17398
17490
|
isKeywordTrue() {
|
|
17399
|
-
return this.type
|
|
17491
|
+
return this.type === TokenType.Keyword && this.strValue === 'true';
|
|
17400
17492
|
}
|
|
17401
17493
|
isKeywordFalse() {
|
|
17402
|
-
return this.type
|
|
17494
|
+
return this.type === TokenType.Keyword && this.strValue === 'false';
|
|
17403
17495
|
}
|
|
17404
17496
|
isKeywordThis() {
|
|
17405
|
-
return this.type
|
|
17497
|
+
return this.type === TokenType.Keyword && this.strValue === 'this';
|
|
17406
17498
|
}
|
|
17407
17499
|
isKeywordTypeof() {
|
|
17408
17500
|
return this.type === TokenType.Keyword && this.strValue === 'typeof';
|
|
17409
17501
|
}
|
|
17410
17502
|
isError() {
|
|
17411
|
-
return this.type
|
|
17503
|
+
return this.type === TokenType.Error;
|
|
17412
17504
|
}
|
|
17413
17505
|
toNumber() {
|
|
17414
|
-
return this.type
|
|
17506
|
+
return this.type === TokenType.Number ? this.numValue : -1;
|
|
17507
|
+
}
|
|
17508
|
+
isTemplateLiteralPart() {
|
|
17509
|
+
return this.isString() && this.kind === StringTokenKind.TemplateLiteralPart;
|
|
17510
|
+
}
|
|
17511
|
+
isTemplateLiteralEnd() {
|
|
17512
|
+
return this.isString() && this.kind === StringTokenKind.TemplateLiteralEnd;
|
|
17513
|
+
}
|
|
17514
|
+
isTemplateLiteralInterpolationStart() {
|
|
17515
|
+
return this.isOperator('${');
|
|
17516
|
+
}
|
|
17517
|
+
isTemplateLiteralInterpolationEnd() {
|
|
17518
|
+
return this.isOperator('}');
|
|
17415
17519
|
}
|
|
17416
17520
|
toString() {
|
|
17417
17521
|
switch (this.type) {
|
|
@@ -17430,6 +17534,13 @@ class Token {
|
|
|
17430
17534
|
}
|
|
17431
17535
|
}
|
|
17432
17536
|
}
|
|
17537
|
+
class StringToken extends Token {
|
|
17538
|
+
kind;
|
|
17539
|
+
constructor(index, end, strValue, kind) {
|
|
17540
|
+
super(index, end, TokenType.String, 0, strValue);
|
|
17541
|
+
this.kind = kind;
|
|
17542
|
+
}
|
|
17543
|
+
}
|
|
17433
17544
|
function newCharacterToken(index, end, code) {
|
|
17434
17545
|
return new Token(index, end, TokenType.Character, code, String.fromCharCode(code));
|
|
17435
17546
|
}
|
|
@@ -17445,9 +17556,6 @@ function newKeywordToken(index, end, text) {
|
|
|
17445
17556
|
function newOperatorToken(index, end, text) {
|
|
17446
17557
|
return new Token(index, end, TokenType.Operator, 0, text);
|
|
17447
17558
|
}
|
|
17448
|
-
function newStringToken(index, end, text) {
|
|
17449
|
-
return new Token(index, end, TokenType.String, 0, text);
|
|
17450
|
-
}
|
|
17451
17559
|
function newNumberToken(index, end, n) {
|
|
17452
17560
|
return new Token(index, end, TokenType.Number, n, '');
|
|
17453
17561
|
}
|
|
@@ -17457,20 +17565,33 @@ function newErrorToken(index, end, message) {
|
|
|
17457
17565
|
const EOF = new Token(-1, -1, TokenType.Character, 0, '');
|
|
17458
17566
|
class _Scanner {
|
|
17459
17567
|
input;
|
|
17568
|
+
tokens = [];
|
|
17460
17569
|
length;
|
|
17461
17570
|
peek = 0;
|
|
17462
17571
|
index = -1;
|
|
17572
|
+
literalInterpolationDepth = 0;
|
|
17573
|
+
braceDepth = 0;
|
|
17463
17574
|
constructor(input) {
|
|
17464
17575
|
this.input = input;
|
|
17465
17576
|
this.length = input.length;
|
|
17466
17577
|
this.advance();
|
|
17467
17578
|
}
|
|
17579
|
+
scan() {
|
|
17580
|
+
let token = this.scanToken();
|
|
17581
|
+
while (token !== null) {
|
|
17582
|
+
this.tokens.push(token);
|
|
17583
|
+
token = this.scanToken();
|
|
17584
|
+
}
|
|
17585
|
+
return this.tokens;
|
|
17586
|
+
}
|
|
17468
17587
|
advance() {
|
|
17469
17588
|
this.peek = ++this.index >= this.length ? $EOF : this.input.charCodeAt(this.index);
|
|
17470
17589
|
}
|
|
17471
17590
|
scanToken() {
|
|
17472
|
-
const input = this.input
|
|
17473
|
-
|
|
17591
|
+
const input = this.input;
|
|
17592
|
+
const length = this.length;
|
|
17593
|
+
let peek = this.peek;
|
|
17594
|
+
let index = this.index;
|
|
17474
17595
|
// Skip whitespace.
|
|
17475
17596
|
while (peek <= $SPACE) {
|
|
17476
17597
|
if (++index >= length) {
|
|
@@ -17487,10 +17608,12 @@ class _Scanner {
|
|
|
17487
17608
|
return null;
|
|
17488
17609
|
}
|
|
17489
17610
|
// Handle identifiers and numbers.
|
|
17490
|
-
if (isIdentifierStart(peek))
|
|
17611
|
+
if (isIdentifierStart(peek)) {
|
|
17491
17612
|
return this.scanIdentifier();
|
|
17492
|
-
|
|
17613
|
+
}
|
|
17614
|
+
if (isDigit(peek)) {
|
|
17493
17615
|
return this.scanNumber(index);
|
|
17616
|
+
}
|
|
17494
17617
|
const start = index;
|
|
17495
17618
|
switch (peek) {
|
|
17496
17619
|
case $PERIOD:
|
|
@@ -17500,17 +17623,22 @@ class _Scanner {
|
|
|
17500
17623
|
: newCharacterToken(start, this.index, $PERIOD);
|
|
17501
17624
|
case $LPAREN:
|
|
17502
17625
|
case $RPAREN:
|
|
17503
|
-
case $LBRACE:
|
|
17504
|
-
case $RBRACE:
|
|
17505
17626
|
case $LBRACKET:
|
|
17506
17627
|
case $RBRACKET:
|
|
17507
17628
|
case $COMMA:
|
|
17508
17629
|
case $COLON:
|
|
17509
17630
|
case $SEMICOLON:
|
|
17510
17631
|
return this.scanCharacter(start, peek);
|
|
17632
|
+
case $LBRACE:
|
|
17633
|
+
return this.scanOpenBrace(start, peek);
|
|
17634
|
+
case $RBRACE:
|
|
17635
|
+
return this.scanCloseBrace(start, peek);
|
|
17511
17636
|
case $SQ:
|
|
17512
17637
|
case $DQ:
|
|
17513
17638
|
return this.scanString();
|
|
17639
|
+
case $BT:
|
|
17640
|
+
this.advance();
|
|
17641
|
+
return this.scanTemplateLiteralPart(start);
|
|
17514
17642
|
case $HASH:
|
|
17515
17643
|
return this.scanPrivateIdentifier();
|
|
17516
17644
|
case $PLUS:
|
|
@@ -17548,6 +17676,21 @@ class _Scanner {
|
|
|
17548
17676
|
this.advance();
|
|
17549
17677
|
return newOperatorToken(start, this.index, str);
|
|
17550
17678
|
}
|
|
17679
|
+
scanOpenBrace(start, code) {
|
|
17680
|
+
this.braceDepth++;
|
|
17681
|
+
this.advance();
|
|
17682
|
+
return newCharacterToken(start, this.index, code);
|
|
17683
|
+
}
|
|
17684
|
+
scanCloseBrace(start, code) {
|
|
17685
|
+
this.advance();
|
|
17686
|
+
if (this.braceDepth === 0 && this.literalInterpolationDepth > 0) {
|
|
17687
|
+
this.literalInterpolationDepth--;
|
|
17688
|
+
this.tokens.push(newOperatorToken(start, this.index, '}'));
|
|
17689
|
+
return this.scanTemplateLiteralPart(this.index);
|
|
17690
|
+
}
|
|
17691
|
+
this.braceDepth--;
|
|
17692
|
+
return newCharacterToken(start, this.index, code);
|
|
17693
|
+
}
|
|
17551
17694
|
/**
|
|
17552
17695
|
* Tokenize a 2/3 char long operator
|
|
17553
17696
|
*
|
|
@@ -17643,28 +17786,11 @@ class _Scanner {
|
|
|
17643
17786
|
const input = this.input;
|
|
17644
17787
|
while (this.peek != quote) {
|
|
17645
17788
|
if (this.peek == $BACKSLASH) {
|
|
17646
|
-
|
|
17647
|
-
|
|
17648
|
-
|
|
17649
|
-
// @ts-expect-error see microsoft/TypeScript#9998
|
|
17650
|
-
if (this.peek == $u) {
|
|
17651
|
-
// 4 character hex code for unicode character.
|
|
17652
|
-
const hex = input.substring(this.index + 1, this.index + 5);
|
|
17653
|
-
if (/^[0-9a-f]+$/i.test(hex)) {
|
|
17654
|
-
unescapedCode = parseInt(hex, 16);
|
|
17655
|
-
}
|
|
17656
|
-
else {
|
|
17657
|
-
return this.error(`Invalid unicode escape [\\u${hex}]`, 0);
|
|
17658
|
-
}
|
|
17659
|
-
for (let i = 0; i < 5; i++) {
|
|
17660
|
-
this.advance();
|
|
17661
|
-
}
|
|
17662
|
-
}
|
|
17663
|
-
else {
|
|
17664
|
-
unescapedCode = unescape$1(this.peek);
|
|
17665
|
-
this.advance();
|
|
17789
|
+
const result = this.scanStringBackslash(buffer, marker);
|
|
17790
|
+
if (typeof result !== 'string') {
|
|
17791
|
+
return result; // Error
|
|
17666
17792
|
}
|
|
17667
|
-
buffer
|
|
17793
|
+
buffer = result;
|
|
17668
17794
|
marker = this.index;
|
|
17669
17795
|
}
|
|
17670
17796
|
else if (this.peek == $EOF) {
|
|
@@ -17676,7 +17802,7 @@ class _Scanner {
|
|
|
17676
17802
|
}
|
|
17677
17803
|
const last = input.substring(marker, this.index);
|
|
17678
17804
|
this.advance(); // Skip terminating quote.
|
|
17679
|
-
return
|
|
17805
|
+
return new StringToken(start, this.index, buffer + last, StringTokenKind.Plain);
|
|
17680
17806
|
}
|
|
17681
17807
|
scanQuestion(start) {
|
|
17682
17808
|
this.advance();
|
|
@@ -17688,10 +17814,68 @@ class _Scanner {
|
|
|
17688
17814
|
}
|
|
17689
17815
|
return newOperatorToken(start, this.index, str);
|
|
17690
17816
|
}
|
|
17817
|
+
scanTemplateLiteralPart(start) {
|
|
17818
|
+
let buffer = '';
|
|
17819
|
+
let marker = this.index;
|
|
17820
|
+
while (this.peek !== $BT) {
|
|
17821
|
+
if (this.peek === $BACKSLASH) {
|
|
17822
|
+
const result = this.scanStringBackslash(buffer, marker);
|
|
17823
|
+
if (typeof result !== 'string') {
|
|
17824
|
+
return result; // Error
|
|
17825
|
+
}
|
|
17826
|
+
buffer = result;
|
|
17827
|
+
marker = this.index;
|
|
17828
|
+
}
|
|
17829
|
+
else if (this.peek === $$) {
|
|
17830
|
+
const dollar = this.index;
|
|
17831
|
+
this.advance();
|
|
17832
|
+
// @ts-expect-error
|
|
17833
|
+
if (this.peek === $LBRACE) {
|
|
17834
|
+
this.literalInterpolationDepth++;
|
|
17835
|
+
this.tokens.push(new StringToken(start, dollar, buffer + this.input.substring(marker, dollar), StringTokenKind.TemplateLiteralPart));
|
|
17836
|
+
this.advance();
|
|
17837
|
+
return newOperatorToken(dollar, this.index, this.input.substring(dollar, this.index));
|
|
17838
|
+
}
|
|
17839
|
+
}
|
|
17840
|
+
else if (this.peek === $EOF) {
|
|
17841
|
+
return this.error('Unterminated template literal', 0);
|
|
17842
|
+
}
|
|
17843
|
+
else {
|
|
17844
|
+
this.advance();
|
|
17845
|
+
}
|
|
17846
|
+
}
|
|
17847
|
+
const last = this.input.substring(marker, this.index);
|
|
17848
|
+
this.advance();
|
|
17849
|
+
return new StringToken(start, this.index, buffer + last, StringTokenKind.TemplateLiteralEnd);
|
|
17850
|
+
}
|
|
17691
17851
|
error(message, offset) {
|
|
17692
17852
|
const position = this.index + offset;
|
|
17693
17853
|
return newErrorToken(position, this.index, `Lexer Error: ${message} at column ${position} in expression [${this.input}]`);
|
|
17694
17854
|
}
|
|
17855
|
+
scanStringBackslash(buffer, marker) {
|
|
17856
|
+
buffer += this.input.substring(marker, this.index);
|
|
17857
|
+
let unescapedCode;
|
|
17858
|
+
this.advance();
|
|
17859
|
+
if (this.peek === $u) {
|
|
17860
|
+
// 4 character hex code for unicode character.
|
|
17861
|
+
const hex = this.input.substring(this.index + 1, this.index + 5);
|
|
17862
|
+
if (/^[0-9a-f]+$/i.test(hex)) {
|
|
17863
|
+
unescapedCode = parseInt(hex, 16);
|
|
17864
|
+
}
|
|
17865
|
+
else {
|
|
17866
|
+
return this.error(`Invalid unicode escape [\\u${hex}]`, 0);
|
|
17867
|
+
}
|
|
17868
|
+
for (let i = 0; i < 5; i++) {
|
|
17869
|
+
this.advance();
|
|
17870
|
+
}
|
|
17871
|
+
}
|
|
17872
|
+
else {
|
|
17873
|
+
unescapedCode = unescape$1(this.peek);
|
|
17874
|
+
this.advance();
|
|
17875
|
+
}
|
|
17876
|
+
buffer += String.fromCharCode(unescapedCode);
|
|
17877
|
+
return buffer;
|
|
17878
|
+
}
|
|
17695
17879
|
}
|
|
17696
17880
|
function isIdentifierStart(code) {
|
|
17697
17881
|
return (($a <= code && code <= $z) ||
|
|
@@ -18519,7 +18703,13 @@ class _ParseAST {
|
|
|
18519
18703
|
this.advance();
|
|
18520
18704
|
return new LiteralPrimitive(this.span(start), this.sourceSpan(start), value);
|
|
18521
18705
|
}
|
|
18522
|
-
else if (this.next.
|
|
18706
|
+
else if (this.next.isTemplateLiteralEnd()) {
|
|
18707
|
+
return this.parseNoInterpolationTemplateLiteral(start);
|
|
18708
|
+
}
|
|
18709
|
+
else if (this.next.isTemplateLiteralPart()) {
|
|
18710
|
+
return this.parseTemplateLiteral();
|
|
18711
|
+
}
|
|
18712
|
+
else if (this.next.isString() && this.next.kind === StringTokenKind.Plain) {
|
|
18523
18713
|
const literalValue = this.next.toString();
|
|
18524
18714
|
this.advance();
|
|
18525
18715
|
return new LiteralPrimitive(this.span(start), this.sourceSpan(start), literalValue);
|
|
@@ -18844,6 +19034,42 @@ class _ParseAST {
|
|
|
18844
19034
|
const sourceSpan = new AbsoluteSourceSpan(spanStart, this.currentAbsoluteOffset);
|
|
18845
19035
|
return new VariableBinding(sourceSpan, key, value);
|
|
18846
19036
|
}
|
|
19037
|
+
parseNoInterpolationTemplateLiteral(start) {
|
|
19038
|
+
const text = this.next.strValue;
|
|
19039
|
+
this.advance();
|
|
19040
|
+
const span = this.span(start);
|
|
19041
|
+
const sourceSpan = this.sourceSpan(start);
|
|
19042
|
+
return new TemplateLiteral(span, sourceSpan, [new TemplateLiteralElement(span, sourceSpan, text)], []);
|
|
19043
|
+
}
|
|
19044
|
+
parseTemplateLiteral() {
|
|
19045
|
+
const start = this.inputIndex;
|
|
19046
|
+
const elements = [];
|
|
19047
|
+
const expressions = [];
|
|
19048
|
+
while (this.next !== EOF) {
|
|
19049
|
+
const token = this.next;
|
|
19050
|
+
if (token.isTemplateLiteralPart() || token.isTemplateLiteralEnd()) {
|
|
19051
|
+
elements.push(new TemplateLiteralElement(this.span(this.inputIndex), this.sourceSpan(this.inputIndex), token.strValue));
|
|
19052
|
+
this.advance();
|
|
19053
|
+
if (token.isTemplateLiteralEnd()) {
|
|
19054
|
+
break;
|
|
19055
|
+
}
|
|
19056
|
+
}
|
|
19057
|
+
else if (token.isTemplateLiteralInterpolationStart()) {
|
|
19058
|
+
this.advance();
|
|
19059
|
+
const expression = this.parsePipe();
|
|
19060
|
+
if (expression instanceof EmptyExpr$1) {
|
|
19061
|
+
this.error('Template literal interpolation cannot be empty');
|
|
19062
|
+
}
|
|
19063
|
+
else {
|
|
19064
|
+
expressions.push(expression);
|
|
19065
|
+
}
|
|
19066
|
+
}
|
|
19067
|
+
else {
|
|
19068
|
+
this.advance();
|
|
19069
|
+
}
|
|
19070
|
+
}
|
|
19071
|
+
return new TemplateLiteral(this.span(start), this.sourceSpan(start), elements, expressions);
|
|
19072
|
+
}
|
|
18847
19073
|
/**
|
|
18848
19074
|
* Consume the optional statement terminator: semicolon or comma.
|
|
18849
19075
|
*/
|
|
@@ -19062,6 +19288,20 @@ class SerializeExpressionVisitor {
|
|
|
19062
19288
|
visitASTWithSource(ast, context) {
|
|
19063
19289
|
return ast.ast.visit(this, context);
|
|
19064
19290
|
}
|
|
19291
|
+
visitTemplateLiteral(ast, context) {
|
|
19292
|
+
let result = '';
|
|
19293
|
+
for (let i = 0; i < ast.elements.length; i++) {
|
|
19294
|
+
result += ast.elements[i].visit(this, context);
|
|
19295
|
+
const expression = i < ast.expressions.length ? ast.expressions[i] : null;
|
|
19296
|
+
if (expression !== null) {
|
|
19297
|
+
result += '${' + expression.visit(this, context) + '}';
|
|
19298
|
+
}
|
|
19299
|
+
}
|
|
19300
|
+
return '`' + result + '`';
|
|
19301
|
+
}
|
|
19302
|
+
visitTemplateLiteralElement(ast, context) {
|
|
19303
|
+
return ast.text;
|
|
19304
|
+
}
|
|
19065
19305
|
}
|
|
19066
19306
|
/** Zips the two input arrays into a single array of pairs of elements at the same index. */
|
|
19067
19307
|
function zip(left, right) {
|
|
@@ -25705,6 +25945,11 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
25705
25945
|
else if (ast instanceof TypeofExpression) {
|
|
25706
25946
|
return typeofExpr(convertAst(ast.expression, job, baseSourceSpan));
|
|
25707
25947
|
}
|
|
25948
|
+
else if (ast instanceof TemplateLiteral) {
|
|
25949
|
+
return new TemplateLiteralExpr(ast.elements.map((el) => {
|
|
25950
|
+
return new TemplateLiteralElementExpr(el.text, convertSourceSpan(el.span, baseSourceSpan));
|
|
25951
|
+
}), ast.expressions.map((expr) => convertAst(expr, job, baseSourceSpan)), convertSourceSpan(ast.span, baseSourceSpan));
|
|
25952
|
+
}
|
|
25708
25953
|
else {
|
|
25709
25954
|
throw new Error(`Unhandled expression type "${ast.constructor.name}" in file "${baseSourceSpan?.start.file.url}"`);
|
|
25710
25955
|
}
|
|
@@ -30451,7 +30696,7 @@ function publishFacade(global) {
|
|
|
30451
30696
|
* @description
|
|
30452
30697
|
* Entry point for all public APIs of the compiler package.
|
|
30453
30698
|
*/
|
|
30454
|
-
new Version('19.1
|
|
30699
|
+
new Version('19.2.0-next.1');
|
|
30455
30700
|
|
|
30456
30701
|
const _I18N_ATTR = 'i18n';
|
|
30457
30702
|
const _I18N_ATTR_PREFIX = 'i18n-';
|
|
@@ -31859,7 +32104,7 @@ class NodeJSPathManipulation {
|
|
|
31859
32104
|
// G3-ESM-MARKER: G3 uses CommonJS, but externally everything in ESM.
|
|
31860
32105
|
// CommonJS/ESM interop for determining the current file name and containing dir.
|
|
31861
32106
|
const isCommonJS = typeof __filename !== 'undefined';
|
|
31862
|
-
const currentFileUrl = isCommonJS ? null : (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT' && document.currentScript.src || new URL('checker-
|
|
32107
|
+
const currentFileUrl = isCommonJS ? null : (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT' && document.currentScript.src || new URL('checker-78667e44.js', document.baseURI).href));
|
|
31863
32108
|
const currentFileName = isCommonJS ? __filename : url.fileURLToPath(currentFileUrl);
|
|
31864
32109
|
/**
|
|
31865
32110
|
* A wrapper around the Node.js file-system that supports readonly operations and path manipulation.
|
|
@@ -34910,10 +35155,10 @@ class StaticInterpreter {
|
|
|
34910
35155
|
visitEnumDeclaration(node, context) {
|
|
34911
35156
|
const enumRef = this.getReference(node, context);
|
|
34912
35157
|
const map = new Map();
|
|
34913
|
-
node.members.forEach((member
|
|
35158
|
+
node.members.forEach((member) => {
|
|
34914
35159
|
const name = this.stringNameFromPropertyName(member.name, context);
|
|
34915
35160
|
if (name !== undefined) {
|
|
34916
|
-
const resolved = member.initializer
|
|
35161
|
+
const resolved = member.initializer && this.visit(member.initializer, context);
|
|
34917
35162
|
map.set(name, new EnumValue(enumRef, name, resolved));
|
|
34918
35163
|
}
|
|
34919
35164
|
});
|
|
@@ -36413,15 +36658,11 @@ class ExpressionTranslatorVisitor {
|
|
|
36413
36658
|
visitInvokeFunctionExpr(ast, context) {
|
|
36414
36659
|
return this.setSourceMapRange(this.factory.createCallExpression(ast.fn.visitExpression(this, context), ast.args.map((arg) => arg.visitExpression(this, context)), ast.pure), ast.sourceSpan);
|
|
36415
36660
|
}
|
|
36416
|
-
|
|
36417
|
-
return this.setSourceMapRange(this.createTaggedTemplateExpression(ast.tag.visitExpression(this, context),
|
|
36418
|
-
|
|
36419
|
-
|
|
36420
|
-
|
|
36421
|
-
range: e.sourceSpan ?? ast.sourceSpan,
|
|
36422
|
-
})),
|
|
36423
|
-
expressions: ast.template.expressions.map((e) => e.visitExpression(this, context)),
|
|
36424
|
-
}), ast.sourceSpan);
|
|
36661
|
+
visitTaggedTemplateLiteralExpr(ast, context) {
|
|
36662
|
+
return this.setSourceMapRange(this.createTaggedTemplateExpression(ast.tag.visitExpression(this, context), this.getTemplateLiteralFromAst(ast.template, context)), ast.sourceSpan);
|
|
36663
|
+
}
|
|
36664
|
+
visitTemplateLiteralExpr(ast, context) {
|
|
36665
|
+
return this.setSourceMapRange(this.factory.createTemplateLiteral(this.getTemplateLiteralFromAst(ast, context)), ast.sourceSpan);
|
|
36425
36666
|
}
|
|
36426
36667
|
visitInstantiateExpr(ast, context) {
|
|
36427
36668
|
return this.factory.createNewExpression(ast.classExpr.visitExpression(this, context), ast.args.map((arg) => arg.visitExpression(this, context)));
|
|
@@ -36587,6 +36828,9 @@ class ExpressionTranslatorVisitor {
|
|
|
36587
36828
|
visitCommaExpr(ast, context) {
|
|
36588
36829
|
throw new Error('Method not implemented.');
|
|
36589
36830
|
}
|
|
36831
|
+
visitTemplateLiteralElementExpr(ast, context) {
|
|
36832
|
+
throw new Error('Method not implemented');
|
|
36833
|
+
}
|
|
36590
36834
|
visitWrappedNodeExpr(ast, _context) {
|
|
36591
36835
|
this.recordWrappedNode(ast);
|
|
36592
36836
|
return ast.node;
|
|
@@ -36614,6 +36858,16 @@ class ExpressionTranslatorVisitor {
|
|
|
36614
36858
|
}
|
|
36615
36859
|
return statement;
|
|
36616
36860
|
}
|
|
36861
|
+
getTemplateLiteralFromAst(ast, context) {
|
|
36862
|
+
return {
|
|
36863
|
+
elements: ast.elements.map((e) => createTemplateElement({
|
|
36864
|
+
cooked: e.text,
|
|
36865
|
+
raw: e.rawText,
|
|
36866
|
+
range: e.sourceSpan ?? ast.sourceSpan,
|
|
36867
|
+
})),
|
|
36868
|
+
expressions: ast.expressions.map((e) => e.visitExpression(this, context)),
|
|
36869
|
+
};
|
|
36870
|
+
}
|
|
36617
36871
|
}
|
|
36618
36872
|
/**
|
|
36619
36873
|
* Convert a cooked-raw string object into one that can be used by the AST factories.
|
|
@@ -36884,7 +37138,13 @@ class TypeTranslatorVisitor {
|
|
|
36884
37138
|
visitInvokeFunctionExpr(ast, context) {
|
|
36885
37139
|
throw new Error('Method not implemented.');
|
|
36886
37140
|
}
|
|
36887
|
-
|
|
37141
|
+
visitTaggedTemplateLiteralExpr(ast, context) {
|
|
37142
|
+
throw new Error('Method not implemented.');
|
|
37143
|
+
}
|
|
37144
|
+
visitTemplateLiteralExpr(ast, context) {
|
|
37145
|
+
throw new Error('Method not implemented.');
|
|
37146
|
+
}
|
|
37147
|
+
visitTemplateLiteralElementExpr(ast, context) {
|
|
36888
37148
|
throw new Error('Method not implemented.');
|
|
36889
37149
|
}
|
|
36890
37150
|
visitInstantiateExpr(ast, context) {
|
|
@@ -37166,6 +37426,9 @@ class TypeScriptAstFactory {
|
|
|
37166
37426
|
return ts__default["default"].factory.createReturnStatement(expression ?? undefined);
|
|
37167
37427
|
}
|
|
37168
37428
|
createTaggedTemplate(tag, template) {
|
|
37429
|
+
return ts__default["default"].factory.createTaggedTemplateExpression(tag, undefined, this.createTemplateLiteral(template));
|
|
37430
|
+
}
|
|
37431
|
+
createTemplateLiteral(template) {
|
|
37169
37432
|
let templateLiteral;
|
|
37170
37433
|
const length = template.elements.length;
|
|
37171
37434
|
const head = template.elements[0];
|
|
@@ -37197,7 +37460,7 @@ class TypeScriptAstFactory {
|
|
|
37197
37460
|
if (head.range !== null) {
|
|
37198
37461
|
this.setSourceMapRange(templateLiteral, head.range);
|
|
37199
37462
|
}
|
|
37200
|
-
return
|
|
37463
|
+
return templateLiteral;
|
|
37201
37464
|
}
|
|
37202
37465
|
createThrowStatement = ts__default["default"].factory.createThrowStatement;
|
|
37203
37466
|
createTypeOfExpression = ts__default["default"].factory.createTypeOfExpression;
|
|
@@ -41241,6 +41504,30 @@ class AstTranslator {
|
|
|
41241
41504
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
41242
41505
|
return node;
|
|
41243
41506
|
}
|
|
41507
|
+
visitTemplateLiteral(ast) {
|
|
41508
|
+
const length = ast.elements.length;
|
|
41509
|
+
const head = ast.elements[0];
|
|
41510
|
+
let result;
|
|
41511
|
+
if (length === 1) {
|
|
41512
|
+
result = ts__default["default"].factory.createNoSubstitutionTemplateLiteral(head.text);
|
|
41513
|
+
}
|
|
41514
|
+
else {
|
|
41515
|
+
const spans = [];
|
|
41516
|
+
const tailIndex = length - 1;
|
|
41517
|
+
for (let i = 1; i < tailIndex; i++) {
|
|
41518
|
+
const middle = ts__default["default"].factory.createTemplateMiddle(ast.elements[i].text);
|
|
41519
|
+
spans.push(ts__default["default"].factory.createTemplateSpan(this.translate(ast.expressions[i - 1]), middle));
|
|
41520
|
+
}
|
|
41521
|
+
const resolvedExpression = this.translate(ast.expressions[tailIndex - 1]);
|
|
41522
|
+
const templateTail = ts__default["default"].factory.createTemplateTail(ast.elements[tailIndex].text);
|
|
41523
|
+
spans.push(ts__default["default"].factory.createTemplateSpan(resolvedExpression, templateTail));
|
|
41524
|
+
result = ts__default["default"].factory.createTemplateExpression(ts__default["default"].factory.createTemplateHead(head.text), spans);
|
|
41525
|
+
}
|
|
41526
|
+
return result;
|
|
41527
|
+
}
|
|
41528
|
+
visitTemplateLiteralElement(ast, context) {
|
|
41529
|
+
throw new Error('Method not implemented');
|
|
41530
|
+
}
|
|
41244
41531
|
convertToSafeCall(ast, expr, args) {
|
|
41245
41532
|
if (this.config.strictSafeNavigationTypes) {
|
|
41246
41533
|
// "a?.method(...)" becomes (0 as any ? a!.method(...) : undefined)
|
|
@@ -41340,6 +41627,12 @@ class VeSafeLhsInferenceBugDetector {
|
|
|
41340
41627
|
visitSafeKeyedRead(ast) {
|
|
41341
41628
|
return false;
|
|
41342
41629
|
}
|
|
41630
|
+
visitTemplateLiteral(ast, context) {
|
|
41631
|
+
return false;
|
|
41632
|
+
}
|
|
41633
|
+
visitTemplateLiteralElement(ast, context) {
|
|
41634
|
+
return false;
|
|
41635
|
+
}
|
|
41343
41636
|
}
|
|
41344
41637
|
|
|
41345
41638
|
/**
|
|
@@ -46046,7 +46339,6 @@ exports.PropertyRead = PropertyRead;
|
|
|
46046
46339
|
exports.PropertyWrite = PropertyWrite;
|
|
46047
46340
|
exports.QUERY_INITIALIZER_FNS = QUERY_INITIALIZER_FNS;
|
|
46048
46341
|
exports.R3TargetBinder = R3TargetBinder;
|
|
46049
|
-
exports.ReadVarExpr = ReadVarExpr;
|
|
46050
46342
|
exports.RecursiveAstVisitor = RecursiveAstVisitor$1;
|
|
46051
46343
|
exports.RecursiveAstVisitor$1 = RecursiveAstVisitor;
|
|
46052
46344
|
exports.RecursiveVisitor = RecursiveVisitor;
|