@angular/compiler-cli 16.2.10 → 16.2.12
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/bundles/{chunk-WJOCH3Z7.js → chunk-IGDIWPM6.js} +8 -4
- package/bundles/{chunk-WJOCH3Z7.js.map → chunk-IGDIWPM6.js.map} +1 -1
- package/bundles/{chunk-CWD5WGIF.js → chunk-QRYLMBG3.js} +283 -358
- package/bundles/chunk-QRYLMBG3.js.map +6 -0
- package/bundles/{chunk-RM7DQTAJ.js → chunk-VPMZW5GS.js} +2 -2
- package/bundles/{chunk-TU4LAK6J.js → chunk-VZK5UEE7.js} +4 -4
- package/bundles/{chunk-LRT6BBZP.js → chunk-ZETVX4VH.js} +214 -144
- package/bundles/chunk-ZETVX4VH.js.map +6 -0
- package/bundles/index.js +4 -4
- package/bundles/linker/babel/index.js +2 -2
- package/bundles/linker/index.js +2 -2
- package/bundles/private/migrations.js +2 -2
- package/bundles/src/bin/ng_xi18n.js +4 -4
- package/bundles/src/bin/ngc.js +4 -4
- package/bundles_metadata.json +1 -1
- package/package.json +2 -2
- package/src/ngtsc/metadata/src/api.d.ts +1 -1
- package/src/ngtsc/translator/index.d.ts +1 -0
- package/src/ngtsc/typecheck/src/environment.d.ts +2 -2
- package/bundles/chunk-CWD5WGIF.js.map +0 -6
- package/bundles/chunk-LRT6BBZP.js.map +0 -6
- /package/bundles/{chunk-RM7DQTAJ.js.map → chunk-VPMZW5GS.js.map} +0 -0
- /package/bundles/{chunk-TU4LAK6J.js.map → chunk-VZK5UEE7.js.map} +0 -0
- /package/src/ngtsc/{typecheck → translator}/src/type_emitter.d.ts +0 -0
|
@@ -36,12 +36,14 @@ import {
|
|
|
36
36
|
aliasTransformFactory,
|
|
37
37
|
declarationTransformFactory,
|
|
38
38
|
ivyTransformFactory
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-IGDIWPM6.js";
|
|
40
40
|
import {
|
|
41
41
|
ImportManager,
|
|
42
|
+
TypeEmitter,
|
|
43
|
+
canEmitType,
|
|
42
44
|
translateExpression,
|
|
43
45
|
translateType
|
|
44
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-ZETVX4VH.js";
|
|
45
47
|
import {
|
|
46
48
|
AbsoluteModuleStrategy,
|
|
47
49
|
AliasStrategy,
|
|
@@ -132,7 +134,7 @@ function createCompilerHost({ options, tsHost = ts.createCompilerHost(options, t
|
|
|
132
134
|
|
|
133
135
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/program.mjs
|
|
134
136
|
import { HtmlParser, MessageBundle } from "@angular/compiler";
|
|
135
|
-
import
|
|
137
|
+
import ts31 from "typescript";
|
|
136
138
|
|
|
137
139
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/transformers/i18n.mjs
|
|
138
140
|
import { Xliff, Xliff2, Xmb } from "@angular/compiler";
|
|
@@ -237,7 +239,7 @@ function verifySupportedTypeScriptVersion() {
|
|
|
237
239
|
}
|
|
238
240
|
|
|
239
241
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/compiler.mjs
|
|
240
|
-
import
|
|
242
|
+
import ts29 from "typescript";
|
|
241
243
|
|
|
242
244
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/cycles/src/analyzer.mjs
|
|
243
245
|
var CycleAnalyzer = class {
|
|
@@ -2263,7 +2265,7 @@ var CompletionEngine = class {
|
|
|
2263
2265
|
};
|
|
2264
2266
|
|
|
2265
2267
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/context.mjs
|
|
2266
|
-
import
|
|
2268
|
+
import ts24 from "typescript";
|
|
2267
2269
|
|
|
2268
2270
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/dom.mjs
|
|
2269
2271
|
import { DomElementSchemaRegistry } from "@angular/compiler";
|
|
@@ -2320,7 +2322,7 @@ var RegistryDomSchemaChecker = class {
|
|
|
2320
2322
|
|
|
2321
2323
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/environment.mjs
|
|
2322
2324
|
import { ExpressionType, ExternalExpr, TypeModifier } from "@angular/compiler";
|
|
2323
|
-
import
|
|
2325
|
+
import ts17 from "typescript";
|
|
2324
2326
|
|
|
2325
2327
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/ts_util.mjs
|
|
2326
2328
|
import ts13 from "typescript";
|
|
@@ -2397,90 +2399,13 @@ function isAccessExpression(node) {
|
|
|
2397
2399
|
}
|
|
2398
2400
|
|
|
2399
2401
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.mjs
|
|
2400
|
-
import ts17 from "typescript";
|
|
2401
|
-
|
|
2402
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/tcb_util.mjs
|
|
2403
2402
|
import ts16 from "typescript";
|
|
2404
2403
|
|
|
2405
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/
|
|
2404
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/tcb_util.mjs
|
|
2406
2405
|
import ts15 from "typescript";
|
|
2407
2406
|
|
|
2408
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_emitter.mjs
|
|
2409
|
-
import ts14 from "typescript";
|
|
2410
|
-
var INELIGIBLE = {};
|
|
2411
|
-
function canEmitType(type, canEmit) {
|
|
2412
|
-
return canEmitTypeWorker(type);
|
|
2413
|
-
function canEmitTypeWorker(type2) {
|
|
2414
|
-
return visitNode(type2) !== INELIGIBLE;
|
|
2415
|
-
}
|
|
2416
|
-
function visitNode(node) {
|
|
2417
|
-
if (ts14.isImportTypeNode(node)) {
|
|
2418
|
-
return INELIGIBLE;
|
|
2419
|
-
}
|
|
2420
|
-
if (ts14.isTypeReferenceNode(node) && !canEmitTypeReference(node)) {
|
|
2421
|
-
return INELIGIBLE;
|
|
2422
|
-
} else {
|
|
2423
|
-
return ts14.forEachChild(node, visitNode);
|
|
2424
|
-
}
|
|
2425
|
-
}
|
|
2426
|
-
function canEmitTypeReference(type2) {
|
|
2427
|
-
if (!canEmit(type2)) {
|
|
2428
|
-
return false;
|
|
2429
|
-
}
|
|
2430
|
-
return type2.typeArguments === void 0 || type2.typeArguments.every(canEmitTypeWorker);
|
|
2431
|
-
}
|
|
2432
|
-
}
|
|
2433
|
-
var TypeEmitter = class {
|
|
2434
|
-
constructor(translator) {
|
|
2435
|
-
this.translator = translator;
|
|
2436
|
-
}
|
|
2437
|
-
emitType(type) {
|
|
2438
|
-
const typeReferenceTransformer = (context) => {
|
|
2439
|
-
const visitNode = (node) => {
|
|
2440
|
-
if (ts14.isImportTypeNode(node)) {
|
|
2441
|
-
throw new Error("Unable to emit import type");
|
|
2442
|
-
}
|
|
2443
|
-
if (ts14.isTypeReferenceNode(node)) {
|
|
2444
|
-
return this.emitTypeReference(node);
|
|
2445
|
-
} else if (ts14.isLiteralExpression(node)) {
|
|
2446
|
-
let clone;
|
|
2447
|
-
if (ts14.isStringLiteral(node)) {
|
|
2448
|
-
clone = ts14.factory.createStringLiteral(node.text);
|
|
2449
|
-
} else if (ts14.isNumericLiteral(node)) {
|
|
2450
|
-
clone = ts14.factory.createNumericLiteral(node.text);
|
|
2451
|
-
} else if (ts14.isBigIntLiteral(node)) {
|
|
2452
|
-
clone = ts14.factory.createBigIntLiteral(node.text);
|
|
2453
|
-
} else if (ts14.isNoSubstitutionTemplateLiteral(node)) {
|
|
2454
|
-
clone = ts14.factory.createNoSubstitutionTemplateLiteral(node.text, node.rawText);
|
|
2455
|
-
} else if (ts14.isRegularExpressionLiteral(node)) {
|
|
2456
|
-
clone = ts14.factory.createRegularExpressionLiteral(node.text);
|
|
2457
|
-
} else {
|
|
2458
|
-
throw new Error(`Unsupported literal kind ${ts14.SyntaxKind[node.kind]}`);
|
|
2459
|
-
}
|
|
2460
|
-
ts14.setTextRange(clone, { pos: -1, end: -1 });
|
|
2461
|
-
return clone;
|
|
2462
|
-
} else {
|
|
2463
|
-
return ts14.visitEachChild(node, visitNode, context);
|
|
2464
|
-
}
|
|
2465
|
-
};
|
|
2466
|
-
return (node) => ts14.visitNode(node, visitNode, ts14.isTypeNode);
|
|
2467
|
-
};
|
|
2468
|
-
return ts14.transform(type, [typeReferenceTransformer]).transformed[0];
|
|
2469
|
-
}
|
|
2470
|
-
emitTypeReference(type) {
|
|
2471
|
-
const translatedType = this.translator(type);
|
|
2472
|
-
if (translatedType === null) {
|
|
2473
|
-
throw new Error("Unable to emit an unresolved reference");
|
|
2474
|
-
}
|
|
2475
|
-
let typeArguments = void 0;
|
|
2476
|
-
if (type.typeArguments !== void 0) {
|
|
2477
|
-
typeArguments = ts14.factory.createNodeArray(type.typeArguments.map((typeArg) => this.emitType(typeArg)));
|
|
2478
|
-
}
|
|
2479
|
-
return ts14.factory.updateTypeReferenceNode(type, translatedType.typeName, typeArguments);
|
|
2480
|
-
}
|
|
2481
|
-
};
|
|
2482
|
-
|
|
2483
2407
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_parameter_emitter.mjs
|
|
2408
|
+
import ts14 from "typescript";
|
|
2484
2409
|
var TypeParameterEmitter = class {
|
|
2485
2410
|
constructor(typeParameters, reflector) {
|
|
2486
2411
|
this.typeParameters = typeParameters;
|
|
@@ -2517,11 +2442,11 @@ var TypeParameterEmitter = class {
|
|
|
2517
2442
|
return this.typeParameters.map((typeParam) => {
|
|
2518
2443
|
const constraint = typeParam.constraint !== void 0 ? emitter.emitType(typeParam.constraint) : void 0;
|
|
2519
2444
|
const defaultType = typeParam.default !== void 0 ? emitter.emitType(typeParam.default) : void 0;
|
|
2520
|
-
return
|
|
2445
|
+
return ts14.factory.updateTypeParameterDeclaration(typeParam, typeParam.modifiers, typeParam.name, constraint, defaultType);
|
|
2521
2446
|
});
|
|
2522
2447
|
}
|
|
2523
2448
|
resolveTypeReference(type) {
|
|
2524
|
-
const target =
|
|
2449
|
+
const target = ts14.isIdentifier(type.typeName) ? type.typeName : type.typeName.right;
|
|
2525
2450
|
const declaration = this.reflector.getDeclarationOfIdentifier(target);
|
|
2526
2451
|
if (declaration === null || declaration.node === null) {
|
|
2527
2452
|
return null;
|
|
@@ -2547,8 +2472,8 @@ var TypeParameterEmitter = class {
|
|
|
2547
2472
|
if (typeNode === null) {
|
|
2548
2473
|
return null;
|
|
2549
2474
|
}
|
|
2550
|
-
if (!
|
|
2551
|
-
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${
|
|
2475
|
+
if (!ts14.isTypeReferenceNode(typeNode)) {
|
|
2476
|
+
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${ts14.SyntaxKind[typeNode.kind]}.`);
|
|
2552
2477
|
}
|
|
2553
2478
|
return typeNode;
|
|
2554
2479
|
}
|
|
@@ -2590,14 +2515,14 @@ function getTemplateMapping(shimSf, position, resolver, isDiagnosticRequest) {
|
|
|
2590
2515
|
}
|
|
2591
2516
|
function findTypeCheckBlock(file, id, isDiagnosticRequest) {
|
|
2592
2517
|
for (const stmt of file.statements) {
|
|
2593
|
-
if (
|
|
2518
|
+
if (ts15.isFunctionDeclaration(stmt) && getTemplateId2(stmt, file, isDiagnosticRequest) === id) {
|
|
2594
2519
|
return stmt;
|
|
2595
2520
|
}
|
|
2596
2521
|
}
|
|
2597
2522
|
return null;
|
|
2598
2523
|
}
|
|
2599
2524
|
function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
|
|
2600
|
-
while (node !== void 0 && !
|
|
2525
|
+
while (node !== void 0 && !ts15.isFunctionDeclaration(node)) {
|
|
2601
2526
|
if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticsRequest) {
|
|
2602
2527
|
return null;
|
|
2603
2528
|
}
|
|
@@ -2614,7 +2539,7 @@ function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
|
|
|
2614
2539
|
return null;
|
|
2615
2540
|
}
|
|
2616
2541
|
function getTemplateId2(node, sourceFile, isDiagnosticRequest) {
|
|
2617
|
-
while (!
|
|
2542
|
+
while (!ts15.isFunctionDeclaration(node)) {
|
|
2618
2543
|
if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticRequest) {
|
|
2619
2544
|
return null;
|
|
2620
2545
|
}
|
|
@@ -2624,8 +2549,8 @@ function getTemplateId2(node, sourceFile, isDiagnosticRequest) {
|
|
|
2624
2549
|
}
|
|
2625
2550
|
}
|
|
2626
2551
|
const start = node.getFullStart();
|
|
2627
|
-
return
|
|
2628
|
-
if (kind !==
|
|
2552
|
+
return ts15.forEachLeadingCommentRange(sourceFile.text, start, (pos, end, kind) => {
|
|
2553
|
+
if (kind !== ts15.SyntaxKind.MultiLineCommentTrivia) {
|
|
2629
2554
|
return null;
|
|
2630
2555
|
}
|
|
2631
2556
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -2640,29 +2565,29 @@ function checkIfGenericTypeBoundsCanBeEmitted(node, reflector, env) {
|
|
|
2640
2565
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.mjs
|
|
2641
2566
|
function generateTypeCtorDeclarationFn(node, meta, nodeTypeRef, typeParams) {
|
|
2642
2567
|
const rawTypeArgs = typeParams !== void 0 ? generateGenericArgs(typeParams) : void 0;
|
|
2643
|
-
const rawType =
|
|
2568
|
+
const rawType = ts16.factory.createTypeReferenceNode(nodeTypeRef, rawTypeArgs);
|
|
2644
2569
|
const initParam = constructTypeCtorParameter(node, meta, rawType);
|
|
2645
2570
|
const typeParameters = typeParametersWithDefaultTypes(typeParams);
|
|
2646
2571
|
if (meta.body) {
|
|
2647
|
-
const fnType =
|
|
2572
|
+
const fnType = ts16.factory.createFunctionTypeNode(
|
|
2648
2573
|
typeParameters,
|
|
2649
2574
|
[initParam],
|
|
2650
2575
|
rawType
|
|
2651
2576
|
);
|
|
2652
|
-
const decl =
|
|
2577
|
+
const decl = ts16.factory.createVariableDeclaration(
|
|
2653
2578
|
meta.fnName,
|
|
2654
2579
|
void 0,
|
|
2655
2580
|
fnType,
|
|
2656
|
-
|
|
2581
|
+
ts16.factory.createNonNullExpression(ts16.factory.createNull())
|
|
2657
2582
|
);
|
|
2658
|
-
const declList =
|
|
2659
|
-
return
|
|
2583
|
+
const declList = ts16.factory.createVariableDeclarationList([decl], ts16.NodeFlags.Const);
|
|
2584
|
+
return ts16.factory.createVariableStatement(
|
|
2660
2585
|
void 0,
|
|
2661
2586
|
declList
|
|
2662
2587
|
);
|
|
2663
2588
|
} else {
|
|
2664
|
-
return
|
|
2665
|
-
[
|
|
2589
|
+
return ts16.factory.createFunctionDeclaration(
|
|
2590
|
+
[ts16.factory.createModifier(ts16.SyntaxKind.DeclareKeyword)],
|
|
2666
2591
|
void 0,
|
|
2667
2592
|
meta.fnName,
|
|
2668
2593
|
typeParameters,
|
|
@@ -2674,16 +2599,16 @@ function generateTypeCtorDeclarationFn(node, meta, nodeTypeRef, typeParams) {
|
|
|
2674
2599
|
}
|
|
2675
2600
|
function generateInlineTypeCtor(node, meta) {
|
|
2676
2601
|
const rawTypeArgs = node.typeParameters !== void 0 ? generateGenericArgs(node.typeParameters) : void 0;
|
|
2677
|
-
const rawType =
|
|
2602
|
+
const rawType = ts16.factory.createTypeReferenceNode(node.name, rawTypeArgs);
|
|
2678
2603
|
const initParam = constructTypeCtorParameter(node, meta, rawType);
|
|
2679
2604
|
let body = void 0;
|
|
2680
2605
|
if (meta.body) {
|
|
2681
|
-
body =
|
|
2682
|
-
|
|
2606
|
+
body = ts16.factory.createBlock([
|
|
2607
|
+
ts16.factory.createReturnStatement(ts16.factory.createNonNullExpression(ts16.factory.createNull()))
|
|
2683
2608
|
]);
|
|
2684
2609
|
}
|
|
2685
|
-
return
|
|
2686
|
-
[
|
|
2610
|
+
return ts16.factory.createMethodDeclaration(
|
|
2611
|
+
[ts16.factory.createModifier(ts16.SyntaxKind.StaticKeyword)],
|
|
2687
2612
|
void 0,
|
|
2688
2613
|
meta.fnName,
|
|
2689
2614
|
void 0,
|
|
@@ -2699,28 +2624,28 @@ function constructTypeCtorParameter(node, meta, rawType) {
|
|
|
2699
2624
|
const coercedKeys = [];
|
|
2700
2625
|
for (const { classPropertyName, transform } of meta.fields.inputs) {
|
|
2701
2626
|
if (!meta.coercedInputFields.has(classPropertyName)) {
|
|
2702
|
-
plainKeys.push(
|
|
2627
|
+
plainKeys.push(ts16.factory.createLiteralTypeNode(ts16.factory.createStringLiteral(classPropertyName)));
|
|
2703
2628
|
} else {
|
|
2704
|
-
coercedKeys.push(
|
|
2629
|
+
coercedKeys.push(ts16.factory.createPropertySignature(
|
|
2705
2630
|
void 0,
|
|
2706
2631
|
classPropertyName,
|
|
2707
2632
|
void 0,
|
|
2708
|
-
transform == null ? tsCreateTypeQueryForCoercedInput(rawType.typeName, classPropertyName) : transform.type
|
|
2633
|
+
transform == null ? tsCreateTypeQueryForCoercedInput(rawType.typeName, classPropertyName) : transform.type.node
|
|
2709
2634
|
));
|
|
2710
2635
|
}
|
|
2711
2636
|
}
|
|
2712
2637
|
if (plainKeys.length > 0) {
|
|
2713
|
-
const keyTypeUnion =
|
|
2714
|
-
initType =
|
|
2638
|
+
const keyTypeUnion = ts16.factory.createUnionTypeNode(plainKeys);
|
|
2639
|
+
initType = ts16.factory.createTypeReferenceNode("Pick", [rawType, keyTypeUnion]);
|
|
2715
2640
|
}
|
|
2716
2641
|
if (coercedKeys.length > 0) {
|
|
2717
|
-
const coercedLiteral =
|
|
2718
|
-
initType = initType !== null ?
|
|
2642
|
+
const coercedLiteral = ts16.factory.createTypeLiteralNode(coercedKeys);
|
|
2643
|
+
initType = initType !== null ? ts16.factory.createIntersectionTypeNode([initType, coercedLiteral]) : coercedLiteral;
|
|
2719
2644
|
}
|
|
2720
2645
|
if (initType === null) {
|
|
2721
|
-
initType =
|
|
2646
|
+
initType = ts16.factory.createTypeLiteralNode([]);
|
|
2722
2647
|
}
|
|
2723
|
-
return
|
|
2648
|
+
return ts16.factory.createParameterDeclaration(
|
|
2724
2649
|
void 0,
|
|
2725
2650
|
void 0,
|
|
2726
2651
|
"init",
|
|
@@ -2730,7 +2655,7 @@ function constructTypeCtorParameter(node, meta, rawType) {
|
|
|
2730
2655
|
);
|
|
2731
2656
|
}
|
|
2732
2657
|
function generateGenericArgs(params) {
|
|
2733
|
-
return params.map((param) =>
|
|
2658
|
+
return params.map((param) => ts16.factory.createTypeReferenceNode(param.name, void 0));
|
|
2734
2659
|
}
|
|
2735
2660
|
function requiresInlineTypeCtor(node, host, env) {
|
|
2736
2661
|
return !checkIfGenericTypeBoundsCanBeEmitted(node, host, env);
|
|
@@ -2741,7 +2666,7 @@ function typeParametersWithDefaultTypes(params) {
|
|
|
2741
2666
|
}
|
|
2742
2667
|
return params.map((param) => {
|
|
2743
2668
|
if (param.default === void 0) {
|
|
2744
|
-
return
|
|
2669
|
+
return ts16.factory.updateTypeParameterDeclaration(param, param.modifiers, param.name, param.constraint, ts16.factory.createKeywordTypeNode(ts16.SyntaxKind.AnyKeyword));
|
|
2745
2670
|
} else {
|
|
2746
2671
|
return param;
|
|
2747
2672
|
}
|
|
@@ -2773,13 +2698,13 @@ var Environment = class {
|
|
|
2773
2698
|
}
|
|
2774
2699
|
if (requiresInlineTypeCtor(node, this.reflector, this)) {
|
|
2775
2700
|
const ref = this.reference(dirRef);
|
|
2776
|
-
const typeCtorExpr =
|
|
2701
|
+
const typeCtorExpr = ts17.factory.createPropertyAccessExpression(ref, "ngTypeCtor");
|
|
2777
2702
|
this.typeCtors.set(node, typeCtorExpr);
|
|
2778
2703
|
return typeCtorExpr;
|
|
2779
2704
|
} else {
|
|
2780
2705
|
const fnName = `_ctor${this.nextIds.typeCtor++}`;
|
|
2781
2706
|
const nodeTypeRef = this.referenceType(dirRef);
|
|
2782
|
-
if (!
|
|
2707
|
+
if (!ts17.isTypeReferenceNode(nodeTypeRef)) {
|
|
2783
2708
|
throw new Error(`Expected TypeReferenceNode from reference to ${dirRef.debugName}`);
|
|
2784
2709
|
}
|
|
2785
2710
|
const meta = {
|
|
@@ -2794,7 +2719,7 @@ var Environment = class {
|
|
|
2794
2719
|
const typeParams = this.emitTypeParameters(node);
|
|
2795
2720
|
const typeCtor = generateTypeCtorDeclarationFn(node, meta, nodeTypeRef.typeName, typeParams);
|
|
2796
2721
|
this.typeCtorStatements.push(typeCtor);
|
|
2797
|
-
const fnId =
|
|
2722
|
+
const fnId = ts17.factory.createIdentifier(fnName);
|
|
2798
2723
|
this.typeCtors.set(node, fnId);
|
|
2799
2724
|
return fnId;
|
|
2800
2725
|
}
|
|
@@ -2804,7 +2729,7 @@ var Environment = class {
|
|
|
2804
2729
|
return this.pipeInsts.get(ref.node);
|
|
2805
2730
|
}
|
|
2806
2731
|
const pipeType = this.referenceType(ref);
|
|
2807
|
-
const pipeInstId =
|
|
2732
|
+
const pipeInstId = ts17.factory.createIdentifier(`_pipe${this.nextIds.pipeInst++}`);
|
|
2808
2733
|
this.pipeInstStatements.push(tsDeclareVariable(pipeInstId, pipeType));
|
|
2809
2734
|
this.pipeInsts.set(ref.node, pipeInstId);
|
|
2810
2735
|
return pipeInstId;
|
|
@@ -2844,7 +2769,7 @@ var Environment = class {
|
|
|
2844
2769
|
|
|
2845
2770
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/oob.mjs
|
|
2846
2771
|
import { TmplAstElement as TmplAstElement2 } from "@angular/compiler";
|
|
2847
|
-
import
|
|
2772
|
+
import ts18 from "typescript";
|
|
2848
2773
|
var OutOfBandDiagnosticRecorderImpl = class {
|
|
2849
2774
|
constructor(resolver) {
|
|
2850
2775
|
this.resolver = resolver;
|
|
@@ -2858,7 +2783,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
2858
2783
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
2859
2784
|
const value = ref.value.trim();
|
|
2860
2785
|
const errorMsg = `No directive found with exportAs '${value}'.`;
|
|
2861
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, ref.valueSpan || ref.sourceSpan,
|
|
2786
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, ref.valueSpan || ref.sourceSpan, ts18.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REFERENCE_TARGET), errorMsg));
|
|
2862
2787
|
}
|
|
2863
2788
|
missingPipe(templateId, ast) {
|
|
2864
2789
|
if (this.recordedPipes.has(ast)) {
|
|
@@ -2870,7 +2795,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
2870
2795
|
if (sourceSpan === null) {
|
|
2871
2796
|
throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${ast.name}'.`);
|
|
2872
2797
|
}
|
|
2873
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan,
|
|
2798
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts18.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_PIPE), errorMsg));
|
|
2874
2799
|
this.recordedPipes.add(ast);
|
|
2875
2800
|
}
|
|
2876
2801
|
illegalAssignmentToTemplateVar(templateId, assignment, target) {
|
|
@@ -2881,7 +2806,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
2881
2806
|
if (sourceSpan === null) {
|
|
2882
2807
|
throw new Error(`Assertion failure: no SourceLocation found for property binding.`);
|
|
2883
2808
|
}
|
|
2884
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan,
|
|
2809
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts18.DiagnosticCategory.Error, ngErrorCode(ErrorCode.WRITE_TO_READ_ONLY_VARIABLE), errorMsg, [{
|
|
2885
2810
|
text: `The variable ${assignment.name} is declared here.`,
|
|
2886
2811
|
start: ((_a = target.valueSpan) == null ? void 0 : _a.start.offset) || target.sourceSpan.start.offset,
|
|
2887
2812
|
end: ((_b = target.valueSpan) == null ? void 0 : _b.end.offset) || target.sourceSpan.end.offset,
|
|
@@ -2891,7 +2816,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
2891
2816
|
duplicateTemplateVar(templateId, variable, firstDecl) {
|
|
2892
2817
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
2893
2818
|
const errorMsg = `Cannot redeclare variable '${variable.name}' as it was previously declared elsewhere for the same template.`;
|
|
2894
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, variable.sourceSpan,
|
|
2819
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, variable.sourceSpan, ts18.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DUPLICATE_VARIABLE_DECLARATION), errorMsg, [{
|
|
2895
2820
|
text: `The variable '${firstDecl.name}' was first declared here.`,
|
|
2896
2821
|
start: firstDecl.sourceSpan.start.offset,
|
|
2897
2822
|
end: firstDecl.sourceSpan.end.offset,
|
|
@@ -2930,7 +2855,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
2930
2855
|
const message = `This structural directive supports advanced type inference, but the current compiler configuration prevents its usage. The variable ${varIdentification} will have type 'any' as a result.
|
|
2931
2856
|
|
|
2932
2857
|
Consider enabling the 'strictTemplates' option in your tsconfig.json for better type inference within this template.`;
|
|
2933
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, diagnosticVar.keySpan,
|
|
2858
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, diagnosticVar.keySpan, ts18.DiagnosticCategory.Suggestion, ngErrorCode(ErrorCode.SUGGEST_SUBOPTIMAL_TYPE_INFERENCE), message));
|
|
2934
2859
|
}
|
|
2935
2860
|
splitTwoWayBinding(templateId, input, output, inputConsumer, outputConsumer) {
|
|
2936
2861
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
@@ -2964,11 +2889,11 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
|
|
|
2964
2889
|
sourceFile: outputConsumer.name.getSourceFile()
|
|
2965
2890
|
});
|
|
2966
2891
|
}
|
|
2967
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, input.keySpan,
|
|
2892
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, input.keySpan, ts18.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SPLIT_TWO_WAY_BINDING), errorMsg, relatedMessages));
|
|
2968
2893
|
}
|
|
2969
2894
|
missingRequiredInputs(templateId, element, directiveName, isComponent, inputAliases) {
|
|
2970
2895
|
const message = `Required input${inputAliases.length === 1 ? "" : "s"} ${inputAliases.map((n) => `'${n}'`).join(", ")} from ${isComponent ? "component" : "directive"} ${directiveName} must be specified.`;
|
|
2971
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), element.startSourceSpan,
|
|
2896
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), element.startSourceSpan, ts18.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REQUIRED_INPUTS), message));
|
|
2972
2897
|
}
|
|
2973
2898
|
};
|
|
2974
2899
|
function makeInlineDiagnostic(templateId, code, node, messageText, relatedInformation) {
|
|
@@ -2980,7 +2905,7 @@ function makeInlineDiagnostic(templateId, code, node, messageText, relatedInform
|
|
|
2980
2905
|
}
|
|
2981
2906
|
|
|
2982
2907
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/shim.mjs
|
|
2983
|
-
import
|
|
2908
|
+
import ts19 from "typescript";
|
|
2984
2909
|
var TypeCheckShimGenerator = class {
|
|
2985
2910
|
constructor() {
|
|
2986
2911
|
this.extensionPrefix = "ngtypecheck";
|
|
@@ -2990,7 +2915,7 @@ var TypeCheckShimGenerator = class {
|
|
|
2990
2915
|
if (priorShimSf !== null) {
|
|
2991
2916
|
return priorShimSf;
|
|
2992
2917
|
}
|
|
2993
|
-
return
|
|
2918
|
+
return ts19.createSourceFile(genFilePath, "export const USED_FOR_NG_TYPE_CHECKING = true;", ts19.ScriptTarget.Latest, true, ts19.ScriptKind.TS);
|
|
2994
2919
|
}
|
|
2995
2920
|
static shimFor(fileName) {
|
|
2996
2921
|
return absoluteFrom(fileName.replace(/\.tsx?$/, ".ngtypecheck.ts"));
|
|
@@ -2999,16 +2924,16 @@ var TypeCheckShimGenerator = class {
|
|
|
2999
2924
|
|
|
3000
2925
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.mjs
|
|
3001
2926
|
import { BindingPipe, Call as Call2, DYNAMIC_TYPE, ImplicitReceiver as ImplicitReceiver4, PropertyRead as PropertyRead4, PropertyWrite as PropertyWrite3, SafeCall, SafePropertyRead as SafePropertyRead3, ThisReceiver, TmplAstBoundAttribute, TmplAstBoundText, TmplAstElement as TmplAstElement3, TmplAstIcu, TmplAstReference as TmplAstReference3, TmplAstTemplate as TmplAstTemplate2, TmplAstTextAttribute as TmplAstTextAttribute2, TmplAstVariable as TmplAstVariable2, TransplantedType } from "@angular/compiler";
|
|
3002
|
-
import
|
|
2927
|
+
import ts22 from "typescript";
|
|
3003
2928
|
|
|
3004
2929
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/diagnostics.mjs
|
|
3005
2930
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan3 } from "@angular/compiler";
|
|
3006
|
-
import
|
|
2931
|
+
import ts20 from "typescript";
|
|
3007
2932
|
function wrapForDiagnostics(expr) {
|
|
3008
|
-
return
|
|
2933
|
+
return ts20.factory.createParenthesizedExpression(expr);
|
|
3009
2934
|
}
|
|
3010
2935
|
function wrapForTypeChecker(expr) {
|
|
3011
|
-
return
|
|
2936
|
+
return ts20.factory.createParenthesizedExpression(expr);
|
|
3012
2937
|
}
|
|
3013
2938
|
function addParseSpanInfo(node, span) {
|
|
3014
2939
|
let commentText;
|
|
@@ -3017,10 +2942,10 @@ function addParseSpanInfo(node, span) {
|
|
|
3017
2942
|
} else {
|
|
3018
2943
|
commentText = `${span.start.offset},${span.end.offset}`;
|
|
3019
2944
|
}
|
|
3020
|
-
|
|
2945
|
+
ts20.addSyntheticTrailingComment(node, ts20.SyntaxKind.MultiLineCommentTrivia, commentText, false);
|
|
3021
2946
|
}
|
|
3022
2947
|
function addTemplateId(tcb, id) {
|
|
3023
|
-
|
|
2948
|
+
ts20.addSyntheticLeadingComment(tcb, ts20.SyntaxKind.MultiLineCommentTrivia, id, true);
|
|
3024
2949
|
}
|
|
3025
2950
|
function shouldReportDiagnostic(diagnostic) {
|
|
3026
2951
|
const { code } = diagnostic;
|
|
@@ -3049,32 +2974,32 @@ function translateDiagnostic(diagnostic, resolver) {
|
|
|
3049
2974
|
|
|
3050
2975
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/expression.mjs
|
|
3051
2976
|
import { ASTWithSource as ASTWithSource2, Call, EmptyExpr as EmptyExpr2, PropertyRead as PropertyRead3, SafeKeyedRead, SafePropertyRead as SafePropertyRead2 } from "@angular/compiler";
|
|
3052
|
-
import
|
|
3053
|
-
var NULL_AS_ANY =
|
|
3054
|
-
var UNDEFINED =
|
|
2977
|
+
import ts21 from "typescript";
|
|
2978
|
+
var NULL_AS_ANY = ts21.factory.createAsExpression(ts21.factory.createNull(), ts21.factory.createKeywordTypeNode(ts21.SyntaxKind.AnyKeyword));
|
|
2979
|
+
var UNDEFINED = ts21.factory.createIdentifier("undefined");
|
|
3055
2980
|
var UNARY_OPS = /* @__PURE__ */ new Map([
|
|
3056
|
-
["+",
|
|
3057
|
-
["-",
|
|
2981
|
+
["+", ts21.SyntaxKind.PlusToken],
|
|
2982
|
+
["-", ts21.SyntaxKind.MinusToken]
|
|
3058
2983
|
]);
|
|
3059
2984
|
var BINARY_OPS = /* @__PURE__ */ new Map([
|
|
3060
|
-
["+",
|
|
3061
|
-
["-",
|
|
3062
|
-
["<",
|
|
3063
|
-
[">",
|
|
3064
|
-
["<=",
|
|
3065
|
-
[">=",
|
|
3066
|
-
["==",
|
|
3067
|
-
["===",
|
|
3068
|
-
["*",
|
|
3069
|
-
["/",
|
|
3070
|
-
["%",
|
|
3071
|
-
["!=",
|
|
3072
|
-
["!==",
|
|
3073
|
-
["||",
|
|
3074
|
-
["&&",
|
|
3075
|
-
["&",
|
|
3076
|
-
["|",
|
|
3077
|
-
["??",
|
|
2985
|
+
["+", ts21.SyntaxKind.PlusToken],
|
|
2986
|
+
["-", ts21.SyntaxKind.MinusToken],
|
|
2987
|
+
["<", ts21.SyntaxKind.LessThanToken],
|
|
2988
|
+
[">", ts21.SyntaxKind.GreaterThanToken],
|
|
2989
|
+
["<=", ts21.SyntaxKind.LessThanEqualsToken],
|
|
2990
|
+
[">=", ts21.SyntaxKind.GreaterThanEqualsToken],
|
|
2991
|
+
["==", ts21.SyntaxKind.EqualsEqualsToken],
|
|
2992
|
+
["===", ts21.SyntaxKind.EqualsEqualsEqualsToken],
|
|
2993
|
+
["*", ts21.SyntaxKind.AsteriskToken],
|
|
2994
|
+
["/", ts21.SyntaxKind.SlashToken],
|
|
2995
|
+
["%", ts21.SyntaxKind.PercentToken],
|
|
2996
|
+
["!=", ts21.SyntaxKind.ExclamationEqualsToken],
|
|
2997
|
+
["!==", ts21.SyntaxKind.ExclamationEqualsEqualsToken],
|
|
2998
|
+
["||", ts21.SyntaxKind.BarBarToken],
|
|
2999
|
+
["&&", ts21.SyntaxKind.AmpersandAmpersandToken],
|
|
3000
|
+
["&", ts21.SyntaxKind.AmpersandToken],
|
|
3001
|
+
["|", ts21.SyntaxKind.BarToken],
|
|
3002
|
+
["??", ts21.SyntaxKind.QuestionQuestionToken]
|
|
3078
3003
|
]);
|
|
3079
3004
|
function astToTypescript(ast, maybeResolve, config) {
|
|
3080
3005
|
const translator = new AstTranslator(maybeResolve, config);
|
|
@@ -3090,7 +3015,7 @@ var AstTranslator = class {
|
|
|
3090
3015
|
ast = ast.ast;
|
|
3091
3016
|
}
|
|
3092
3017
|
if (ast instanceof EmptyExpr2) {
|
|
3093
|
-
const res =
|
|
3018
|
+
const res = ts21.factory.createIdentifier("undefined");
|
|
3094
3019
|
addParseSpanInfo(res, ast.sourceSpan);
|
|
3095
3020
|
return res;
|
|
3096
3021
|
}
|
|
@@ -3106,7 +3031,7 @@ var AstTranslator = class {
|
|
|
3106
3031
|
if (op === void 0) {
|
|
3107
3032
|
throw new Error(`Unsupported Unary.operator: ${ast.operator}`);
|
|
3108
3033
|
}
|
|
3109
|
-
const node = wrapForDiagnostics(
|
|
3034
|
+
const node = wrapForDiagnostics(ts21.factory.createPrefixUnaryExpression(op, expr));
|
|
3110
3035
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3111
3036
|
return node;
|
|
3112
3037
|
}
|
|
@@ -3117,13 +3042,13 @@ var AstTranslator = class {
|
|
|
3117
3042
|
if (op === void 0) {
|
|
3118
3043
|
throw new Error(`Unsupported Binary.operation: ${ast.operation}`);
|
|
3119
3044
|
}
|
|
3120
|
-
const node =
|
|
3045
|
+
const node = ts21.factory.createBinaryExpression(lhs, op, rhs);
|
|
3121
3046
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3122
3047
|
return node;
|
|
3123
3048
|
}
|
|
3124
3049
|
visitChain(ast) {
|
|
3125
3050
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
3126
|
-
const node = wrapForDiagnostics(
|
|
3051
|
+
const node = wrapForDiagnostics(ts21.factory.createCommaListExpression(elements));
|
|
3127
3052
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3128
3053
|
return node;
|
|
3129
3054
|
}
|
|
@@ -3131,7 +3056,7 @@ var AstTranslator = class {
|
|
|
3131
3056
|
const condExpr = this.translate(ast.condition);
|
|
3132
3057
|
const trueExpr = this.translate(ast.trueExp);
|
|
3133
3058
|
const falseExpr = wrapForTypeChecker(this.translate(ast.falseExp));
|
|
3134
|
-
const node =
|
|
3059
|
+
const node = ts21.factory.createParenthesizedExpression(ts21.factory.createConditionalExpression(condExpr, void 0, trueExpr, void 0, falseExpr));
|
|
3135
3060
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3136
3061
|
return node;
|
|
3137
3062
|
}
|
|
@@ -3142,26 +3067,26 @@ var AstTranslator = class {
|
|
|
3142
3067
|
throw new Error("Method not implemented.");
|
|
3143
3068
|
}
|
|
3144
3069
|
visitInterpolation(ast) {
|
|
3145
|
-
return ast.expressions.reduce((lhs, ast2) =>
|
|
3070
|
+
return ast.expressions.reduce((lhs, ast2) => ts21.factory.createBinaryExpression(lhs, ts21.SyntaxKind.PlusToken, wrapForTypeChecker(this.translate(ast2))), ts21.factory.createStringLiteral(""));
|
|
3146
3071
|
}
|
|
3147
3072
|
visitKeyedRead(ast) {
|
|
3148
3073
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3149
3074
|
const key = this.translate(ast.key);
|
|
3150
|
-
const node =
|
|
3075
|
+
const node = ts21.factory.createElementAccessExpression(receiver, key);
|
|
3151
3076
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3152
3077
|
return node;
|
|
3153
3078
|
}
|
|
3154
3079
|
visitKeyedWrite(ast) {
|
|
3155
3080
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3156
|
-
const left =
|
|
3081
|
+
const left = ts21.factory.createElementAccessExpression(receiver, this.translate(ast.key));
|
|
3157
3082
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
3158
|
-
const node = wrapForDiagnostics(
|
|
3083
|
+
const node = wrapForDiagnostics(ts21.factory.createBinaryExpression(left, ts21.SyntaxKind.EqualsToken, right));
|
|
3159
3084
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3160
3085
|
return node;
|
|
3161
3086
|
}
|
|
3162
3087
|
visitLiteralArray(ast) {
|
|
3163
3088
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
3164
|
-
const literal =
|
|
3089
|
+
const literal = ts21.factory.createArrayLiteralExpression(elements);
|
|
3165
3090
|
const node = this.config.strictLiteralTypes ? literal : tsCastToAny(literal);
|
|
3166
3091
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3167
3092
|
return node;
|
|
@@ -3169,9 +3094,9 @@ var AstTranslator = class {
|
|
|
3169
3094
|
visitLiteralMap(ast) {
|
|
3170
3095
|
const properties = ast.keys.map(({ key }, idx) => {
|
|
3171
3096
|
const value = this.translate(ast.values[idx]);
|
|
3172
|
-
return
|
|
3097
|
+
return ts21.factory.createPropertyAssignment(ts21.factory.createStringLiteral(key), value);
|
|
3173
3098
|
});
|
|
3174
|
-
const literal =
|
|
3099
|
+
const literal = ts21.factory.createObjectLiteralExpression(properties, true);
|
|
3175
3100
|
const node = this.config.strictLiteralTypes ? literal : tsCastToAny(literal);
|
|
3176
3101
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3177
3102
|
return node;
|
|
@@ -3179,15 +3104,15 @@ var AstTranslator = class {
|
|
|
3179
3104
|
visitLiteralPrimitive(ast) {
|
|
3180
3105
|
let node;
|
|
3181
3106
|
if (ast.value === void 0) {
|
|
3182
|
-
node =
|
|
3107
|
+
node = ts21.factory.createIdentifier("undefined");
|
|
3183
3108
|
} else if (ast.value === null) {
|
|
3184
|
-
node =
|
|
3109
|
+
node = ts21.factory.createNull();
|
|
3185
3110
|
} else if (typeof ast.value === "string") {
|
|
3186
|
-
node =
|
|
3111
|
+
node = ts21.factory.createStringLiteral(ast.value);
|
|
3187
3112
|
} else if (typeof ast.value === "number") {
|
|
3188
|
-
node =
|
|
3113
|
+
node = ts21.factory.createNumericLiteral(ast.value);
|
|
3189
3114
|
} else if (typeof ast.value === "boolean") {
|
|
3190
|
-
node = ast.value ?
|
|
3115
|
+
node = ast.value ? ts21.factory.createTrue() : ts21.factory.createFalse();
|
|
3191
3116
|
} else {
|
|
3192
3117
|
throw Error(`Unsupported AST value of type ${typeof ast.value}`);
|
|
3193
3118
|
}
|
|
@@ -3196,7 +3121,7 @@ var AstTranslator = class {
|
|
|
3196
3121
|
}
|
|
3197
3122
|
visitNonNullAssert(ast) {
|
|
3198
3123
|
const expr = wrapForDiagnostics(this.translate(ast.expression));
|
|
3199
|
-
const node =
|
|
3124
|
+
const node = ts21.factory.createNonNullExpression(expr);
|
|
3200
3125
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3201
3126
|
return node;
|
|
3202
3127
|
}
|
|
@@ -3205,13 +3130,13 @@ var AstTranslator = class {
|
|
|
3205
3130
|
}
|
|
3206
3131
|
visitPrefixNot(ast) {
|
|
3207
3132
|
const expression = wrapForDiagnostics(this.translate(ast.expression));
|
|
3208
|
-
const node =
|
|
3133
|
+
const node = ts21.factory.createLogicalNot(expression);
|
|
3209
3134
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3210
3135
|
return node;
|
|
3211
3136
|
}
|
|
3212
3137
|
visitPropertyRead(ast) {
|
|
3213
3138
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3214
|
-
const name =
|
|
3139
|
+
const name = ts21.factory.createPropertyAccessExpression(receiver, ast.name);
|
|
3215
3140
|
addParseSpanInfo(name, ast.nameSpan);
|
|
3216
3141
|
const node = wrapForDiagnostics(name);
|
|
3217
3142
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
@@ -3219,12 +3144,12 @@ var AstTranslator = class {
|
|
|
3219
3144
|
}
|
|
3220
3145
|
visitPropertyWrite(ast) {
|
|
3221
3146
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3222
|
-
const left =
|
|
3147
|
+
const left = ts21.factory.createPropertyAccessExpression(receiver, ast.name);
|
|
3223
3148
|
addParseSpanInfo(left, ast.nameSpan);
|
|
3224
3149
|
const leftWithPath = wrapForDiagnostics(left);
|
|
3225
3150
|
addParseSpanInfo(leftWithPath, ast.sourceSpan);
|
|
3226
3151
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
3227
|
-
const node = wrapForDiagnostics(
|
|
3152
|
+
const node = wrapForDiagnostics(ts21.factory.createBinaryExpression(leftWithPath, ts21.SyntaxKind.EqualsToken, right));
|
|
3228
3153
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3229
3154
|
return node;
|
|
3230
3155
|
}
|
|
@@ -3232,13 +3157,13 @@ var AstTranslator = class {
|
|
|
3232
3157
|
let node;
|
|
3233
3158
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3234
3159
|
if (this.config.strictSafeNavigationTypes) {
|
|
3235
|
-
const expr =
|
|
3160
|
+
const expr = ts21.factory.createPropertyAccessExpression(ts21.factory.createNonNullExpression(receiver), ast.name);
|
|
3236
3161
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
3237
|
-
node =
|
|
3162
|
+
node = ts21.factory.createParenthesizedExpression(ts21.factory.createConditionalExpression(NULL_AS_ANY, void 0, expr, void 0, UNDEFINED));
|
|
3238
3163
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3239
|
-
node =
|
|
3164
|
+
node = ts21.factory.createPropertyAccessExpression(tsCastToAny(receiver), ast.name);
|
|
3240
3165
|
} else {
|
|
3241
|
-
const expr =
|
|
3166
|
+
const expr = ts21.factory.createPropertyAccessExpression(ts21.factory.createNonNullExpression(receiver), ast.name);
|
|
3242
3167
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
3243
3168
|
node = tsCastToAny(expr);
|
|
3244
3169
|
}
|
|
@@ -3250,13 +3175,13 @@ var AstTranslator = class {
|
|
|
3250
3175
|
const key = this.translate(ast.key);
|
|
3251
3176
|
let node;
|
|
3252
3177
|
if (this.config.strictSafeNavigationTypes) {
|
|
3253
|
-
const expr =
|
|
3178
|
+
const expr = ts21.factory.createElementAccessExpression(ts21.factory.createNonNullExpression(receiver), key);
|
|
3254
3179
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
3255
|
-
node =
|
|
3180
|
+
node = ts21.factory.createParenthesizedExpression(ts21.factory.createConditionalExpression(NULL_AS_ANY, void 0, expr, void 0, UNDEFINED));
|
|
3256
3181
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3257
|
-
node =
|
|
3182
|
+
node = ts21.factory.createElementAccessExpression(tsCastToAny(receiver), key);
|
|
3258
3183
|
} else {
|
|
3259
|
-
const expr =
|
|
3184
|
+
const expr = ts21.factory.createElementAccessExpression(ts21.factory.createNonNullExpression(receiver), key);
|
|
3260
3185
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
3261
3186
|
node = tsCastToAny(expr);
|
|
3262
3187
|
}
|
|
@@ -3273,7 +3198,7 @@ var AstTranslator = class {
|
|
|
3273
3198
|
expr = resolved;
|
|
3274
3199
|
} else {
|
|
3275
3200
|
const propertyReceiver = wrapForDiagnostics(this.translate(receiver.receiver));
|
|
3276
|
-
expr =
|
|
3201
|
+
expr = ts21.factory.createPropertyAccessExpression(propertyReceiver, receiver.name);
|
|
3277
3202
|
addParseSpanInfo(expr, receiver.nameSpan);
|
|
3278
3203
|
}
|
|
3279
3204
|
} else {
|
|
@@ -3283,7 +3208,7 @@ var AstTranslator = class {
|
|
|
3283
3208
|
if (ast.receiver instanceof SafePropertyRead2 || ast.receiver instanceof SafeKeyedRead) {
|
|
3284
3209
|
node = this.convertToSafeCall(ast, expr, args);
|
|
3285
3210
|
} else {
|
|
3286
|
-
node =
|
|
3211
|
+
node = ts21.factory.createCallExpression(expr, void 0, args);
|
|
3287
3212
|
}
|
|
3288
3213
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3289
3214
|
return node;
|
|
@@ -3297,13 +3222,13 @@ var AstTranslator = class {
|
|
|
3297
3222
|
}
|
|
3298
3223
|
convertToSafeCall(ast, expr, args) {
|
|
3299
3224
|
if (this.config.strictSafeNavigationTypes) {
|
|
3300
|
-
const call =
|
|
3301
|
-
return
|
|
3225
|
+
const call = ts21.factory.createCallExpression(ts21.factory.createNonNullExpression(expr), void 0, args);
|
|
3226
|
+
return ts21.factory.createParenthesizedExpression(ts21.factory.createConditionalExpression(NULL_AS_ANY, void 0, call, void 0, UNDEFINED));
|
|
3302
3227
|
}
|
|
3303
3228
|
if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3304
|
-
return
|
|
3229
|
+
return ts21.factory.createCallExpression(tsCastToAny(expr), void 0, args);
|
|
3305
3230
|
}
|
|
3306
|
-
return tsCastToAny(
|
|
3231
|
+
return tsCastToAny(ts21.factory.createCallExpression(ts21.factory.createNonNullExpression(expr), void 0, args));
|
|
3307
3232
|
}
|
|
3308
3233
|
};
|
|
3309
3234
|
var _VeSafeLhsInferenceBugDetector = class {
|
|
@@ -3415,7 +3340,7 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
|
|
|
3415
3340
|
const tcb = new Context(env, domSchemaChecker, oobRecorder, meta.id, meta.boundTarget, meta.pipes, meta.schemas, meta.isStandalone);
|
|
3416
3341
|
const scope = Scope.forNodes(tcb, null, tcb.boundTarget.target.template, null);
|
|
3417
3342
|
const ctxRawType = env.referenceType(ref);
|
|
3418
|
-
if (!
|
|
3343
|
+
if (!ts22.isTypeReferenceNode(ctxRawType)) {
|
|
3419
3344
|
throw new Error(`Expected TypeReferenceNode when referencing the ctx param for ${ref.debugName}`);
|
|
3420
3345
|
}
|
|
3421
3346
|
let typeParameters = void 0;
|
|
@@ -3427,25 +3352,25 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
|
|
|
3427
3352
|
switch (genericContextBehavior) {
|
|
3428
3353
|
case TcbGenericContextBehavior.UseEmitter:
|
|
3429
3354
|
typeParameters = new TypeParameterEmitter(ref.node.typeParameters, env.reflector).emit((typeRef) => env.referenceType(typeRef));
|
|
3430
|
-
typeArguments = typeParameters.map((param) =>
|
|
3355
|
+
typeArguments = typeParameters.map((param) => ts22.factory.createTypeReferenceNode(param.name));
|
|
3431
3356
|
break;
|
|
3432
3357
|
case TcbGenericContextBehavior.CopyClassNodes:
|
|
3433
3358
|
typeParameters = [...ref.node.typeParameters];
|
|
3434
|
-
typeArguments = typeParameters.map((param) =>
|
|
3359
|
+
typeArguments = typeParameters.map((param) => ts22.factory.createTypeReferenceNode(param.name));
|
|
3435
3360
|
break;
|
|
3436
3361
|
case TcbGenericContextBehavior.FallbackToAny:
|
|
3437
|
-
typeArguments = ref.node.typeParameters.map(() =>
|
|
3362
|
+
typeArguments = ref.node.typeParameters.map(() => ts22.factory.createKeywordTypeNode(ts22.SyntaxKind.AnyKeyword));
|
|
3438
3363
|
break;
|
|
3439
3364
|
}
|
|
3440
3365
|
}
|
|
3441
3366
|
const paramList = [tcbThisParam(ctxRawType.typeName, typeArguments)];
|
|
3442
3367
|
const scopeStatements = scope.render();
|
|
3443
|
-
const innerBody =
|
|
3368
|
+
const innerBody = ts22.factory.createBlock([
|
|
3444
3369
|
...env.getPreludeStatements(),
|
|
3445
3370
|
...scopeStatements
|
|
3446
3371
|
]);
|
|
3447
|
-
const body =
|
|
3448
|
-
const fnDecl =
|
|
3372
|
+
const body = ts22.factory.createBlock([ts22.factory.createIfStatement(ts22.factory.createTrue(), innerBody, void 0)]);
|
|
3373
|
+
const fnDecl = ts22.factory.createFunctionDeclaration(
|
|
3449
3374
|
void 0,
|
|
3450
3375
|
void 0,
|
|
3451
3376
|
name,
|
|
@@ -3494,7 +3419,7 @@ var TcbVariableOp = class extends TcbOp {
|
|
|
3494
3419
|
execute() {
|
|
3495
3420
|
const ctx = this.scope.resolve(this.template);
|
|
3496
3421
|
const id = this.tcb.allocateId();
|
|
3497
|
-
const initializer =
|
|
3422
|
+
const initializer = ts22.factory.createPropertyAccessExpression(
|
|
3498
3423
|
ctx,
|
|
3499
3424
|
this.variable.value || "$implicit"
|
|
3500
3425
|
);
|
|
@@ -3520,7 +3445,7 @@ var TcbTemplateContextOp = class extends TcbOp {
|
|
|
3520
3445
|
}
|
|
3521
3446
|
execute() {
|
|
3522
3447
|
const ctx = this.tcb.allocateId();
|
|
3523
|
-
const type =
|
|
3448
|
+
const type = ts22.factory.createKeywordTypeNode(ts22.SyntaxKind.AnyKeyword);
|
|
3524
3449
|
this.scope.addStatement(tsDeclareVariable(ctx, type));
|
|
3525
3450
|
return ctx;
|
|
3526
3451
|
}
|
|
@@ -3573,16 +3498,16 @@ var TcbTemplateBodyOp = class extends TcbOp {
|
|
|
3573
3498
|
}
|
|
3574
3499
|
let guard = null;
|
|
3575
3500
|
if (directiveGuards.length > 0) {
|
|
3576
|
-
guard = directiveGuards.reduce((expr, dirGuard) =>
|
|
3501
|
+
guard = directiveGuards.reduce((expr, dirGuard) => ts22.factory.createBinaryExpression(expr, ts22.SyntaxKind.AmpersandAmpersandToken, dirGuard), directiveGuards.pop());
|
|
3577
3502
|
}
|
|
3578
3503
|
const tmplScope = Scope.forNodes(this.tcb, this.scope, this.template, guard);
|
|
3579
3504
|
const statements = tmplScope.render();
|
|
3580
3505
|
if (statements.length === 0) {
|
|
3581
3506
|
return null;
|
|
3582
3507
|
}
|
|
3583
|
-
let tmplBlock =
|
|
3508
|
+
let tmplBlock = ts22.factory.createBlock(statements);
|
|
3584
3509
|
if (guard !== null) {
|
|
3585
|
-
tmplBlock =
|
|
3510
|
+
tmplBlock = ts22.factory.createIfStatement(guard, tmplBlock);
|
|
3586
3511
|
}
|
|
3587
3512
|
this.scope.addStatement(tmplBlock);
|
|
3588
3513
|
return null;
|
|
@@ -3600,7 +3525,7 @@ var TcbTextInterpolationOp = class extends TcbOp {
|
|
|
3600
3525
|
}
|
|
3601
3526
|
execute() {
|
|
3602
3527
|
const expr = tcbExpression(this.binding.value, this.tcb, this.scope);
|
|
3603
|
-
this.scope.addStatement(
|
|
3528
|
+
this.scope.addStatement(ts22.factory.createExpressionStatement(expr));
|
|
3604
3529
|
return null;
|
|
3605
3530
|
}
|
|
3606
3531
|
};
|
|
@@ -3622,11 +3547,11 @@ var TcbDirectiveTypeOpBase = class extends TcbOp {
|
|
|
3622
3547
|
if (this.dir.isGeneric === false || dirRef.node.typeParameters === void 0) {
|
|
3623
3548
|
type = rawType;
|
|
3624
3549
|
} else {
|
|
3625
|
-
if (!
|
|
3550
|
+
if (!ts22.isTypeReferenceNode(rawType)) {
|
|
3626
3551
|
throw new Error(`Expected TypeReferenceNode when referencing the type for ${this.dir.ref.debugName}`);
|
|
3627
3552
|
}
|
|
3628
|
-
const typeArguments = dirRef.node.typeParameters.map(() =>
|
|
3629
|
-
type =
|
|
3553
|
+
const typeArguments = dirRef.node.typeParameters.map(() => ts22.factory.createKeywordTypeNode(ts22.SyntaxKind.AnyKeyword));
|
|
3554
|
+
type = ts22.factory.createTypeReferenceNode(rawType.typeName, typeArguments);
|
|
3630
3555
|
}
|
|
3631
3556
|
const id = this.tcb.allocateId();
|
|
3632
3557
|
addExpressionIdentifier(type, ExpressionIdentifier.DIRECTIVE);
|
|
@@ -3667,11 +3592,11 @@ var TcbReferenceOp = class extends TcbOp {
|
|
|
3667
3592
|
const id = this.tcb.allocateId();
|
|
3668
3593
|
let initializer = this.target instanceof TmplAstTemplate2 || this.target instanceof TmplAstElement3 ? this.scope.resolve(this.target) : this.scope.resolve(this.host, this.target);
|
|
3669
3594
|
if (this.target instanceof TmplAstElement3 && !this.tcb.env.config.checkTypeOfDomReferences || !this.tcb.env.config.checkTypeOfNonDomReferences) {
|
|
3670
|
-
initializer =
|
|
3595
|
+
initializer = ts22.factory.createAsExpression(initializer, ts22.factory.createKeywordTypeNode(ts22.SyntaxKind.AnyKeyword));
|
|
3671
3596
|
} else if (this.target instanceof TmplAstTemplate2) {
|
|
3672
|
-
initializer =
|
|
3673
|
-
initializer =
|
|
3674
|
-
initializer =
|
|
3597
|
+
initializer = ts22.factory.createAsExpression(initializer, ts22.factory.createKeywordTypeNode(ts22.SyntaxKind.AnyKeyword));
|
|
3598
|
+
initializer = ts22.factory.createAsExpression(initializer, this.tcb.env.referenceExternalType("@angular/core", "TemplateRef", [DYNAMIC_TYPE]));
|
|
3599
|
+
initializer = ts22.factory.createParenthesizedExpression(initializer);
|
|
3675
3600
|
}
|
|
3676
3601
|
addParseSpanInfo(initializer, this.node.sourceSpan);
|
|
3677
3602
|
addParseSpanInfo(id, this.node.keySpan);
|
|
@@ -3760,11 +3685,11 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
3760
3685
|
}
|
|
3761
3686
|
if (this.dir.coercedInputFields.has(fieldName)) {
|
|
3762
3687
|
let type;
|
|
3763
|
-
if (transformType) {
|
|
3688
|
+
if (transformType !== null) {
|
|
3764
3689
|
type = this.tcb.env.referenceTransplantedType(new TransplantedType(transformType));
|
|
3765
3690
|
} else {
|
|
3766
3691
|
const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
|
|
3767
|
-
if (!
|
|
3692
|
+
if (!ts22.isTypeReferenceNode(dirTypeRef)) {
|
|
3768
3693
|
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
3769
3694
|
}
|
|
3770
3695
|
type = tsCreateTypeQueryForCoercedInput(dirTypeRef.typeName, fieldName);
|
|
@@ -3780,10 +3705,10 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
3780
3705
|
}
|
|
3781
3706
|
const id = this.tcb.allocateId();
|
|
3782
3707
|
const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
|
|
3783
|
-
if (!
|
|
3708
|
+
if (!ts22.isTypeReferenceNode(dirTypeRef)) {
|
|
3784
3709
|
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
3785
3710
|
}
|
|
3786
|
-
const type =
|
|
3711
|
+
const type = ts22.factory.createIndexedAccessTypeNode(ts22.factory.createTypeQueryNode(dirId), ts22.factory.createLiteralTypeNode(ts22.factory.createStringLiteral(fieldName)));
|
|
3787
3712
|
const temp = tsDeclareVariable(id, type);
|
|
3788
3713
|
this.scope.addStatement(temp);
|
|
3789
3714
|
target = id;
|
|
@@ -3791,18 +3716,18 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
3791
3716
|
if (dirId === null) {
|
|
3792
3717
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
3793
3718
|
}
|
|
3794
|
-
target = this.dir.stringLiteralInputFields.has(fieldName) ?
|
|
3719
|
+
target = this.dir.stringLiteralInputFields.has(fieldName) ? ts22.factory.createElementAccessExpression(dirId, ts22.factory.createStringLiteral(fieldName)) : ts22.factory.createPropertyAccessExpression(dirId, ts22.factory.createIdentifier(fieldName));
|
|
3795
3720
|
}
|
|
3796
3721
|
if (attr.attribute.keySpan !== void 0) {
|
|
3797
3722
|
addParseSpanInfo(target, attr.attribute.keySpan);
|
|
3798
3723
|
}
|
|
3799
|
-
assignment =
|
|
3724
|
+
assignment = ts22.factory.createBinaryExpression(target, ts22.SyntaxKind.EqualsToken, assignment);
|
|
3800
3725
|
}
|
|
3801
3726
|
addParseSpanInfo(assignment, attr.attribute.sourceSpan);
|
|
3802
3727
|
if (!this.tcb.env.config.checkTypeOfAttributes && attr.attribute instanceof TmplAstTextAttribute2) {
|
|
3803
3728
|
markIgnoreDiagnostics(assignment);
|
|
3804
3729
|
}
|
|
3805
|
-
this.scope.addStatement(
|
|
3730
|
+
this.scope.addStatement(ts22.factory.createExpressionStatement(assignment));
|
|
3806
3731
|
}
|
|
3807
3732
|
this.checkRequiredInputs(seenRequiredInputs);
|
|
3808
3733
|
return null;
|
|
@@ -3833,7 +3758,7 @@ var TcbDirectiveCtorCircularFallbackOp = class extends TcbOp {
|
|
|
3833
3758
|
execute() {
|
|
3834
3759
|
const id = this.tcb.allocateId();
|
|
3835
3760
|
const typeCtor = this.tcb.env.typeCtorFor(this.dir);
|
|
3836
|
-
const circularPlaceholder =
|
|
3761
|
+
const circularPlaceholder = ts22.factory.createCallExpression(typeCtor, void 0, [ts22.factory.createNonNullExpression(ts22.factory.createNull())]);
|
|
3837
3762
|
this.scope.addStatement(tsCreateVariable(id, circularPlaceholder));
|
|
3838
3763
|
return id;
|
|
3839
3764
|
}
|
|
@@ -3901,15 +3826,15 @@ var TcbUnclaimedInputsOp = class extends TcbOp {
|
|
|
3901
3826
|
elId = this.scope.resolve(this.element);
|
|
3902
3827
|
}
|
|
3903
3828
|
const propertyName = (_a = ATTR_TO_PROP.get(binding.name)) != null ? _a : binding.name;
|
|
3904
|
-
const prop =
|
|
3905
|
-
const stmt =
|
|
3829
|
+
const prop = ts22.factory.createElementAccessExpression(elId, ts22.factory.createStringLiteral(propertyName));
|
|
3830
|
+
const stmt = ts22.factory.createBinaryExpression(prop, ts22.SyntaxKind.EqualsToken, wrapForDiagnostics(expr));
|
|
3906
3831
|
addParseSpanInfo(stmt, binding.sourceSpan);
|
|
3907
|
-
this.scope.addStatement(
|
|
3832
|
+
this.scope.addStatement(ts22.factory.createExpressionStatement(stmt));
|
|
3908
3833
|
} else {
|
|
3909
|
-
this.scope.addStatement(
|
|
3834
|
+
this.scope.addStatement(ts22.factory.createExpressionStatement(expr));
|
|
3910
3835
|
}
|
|
3911
3836
|
} else {
|
|
3912
|
-
this.scope.addStatement(
|
|
3837
|
+
this.scope.addStatement(ts22.factory.createExpressionStatement(expr));
|
|
3913
3838
|
}
|
|
3914
3839
|
}
|
|
3915
3840
|
return null;
|
|
@@ -3941,18 +3866,18 @@ var TcbDirectiveOutputsOp = class extends TcbOp {
|
|
|
3941
3866
|
if (dirId === null) {
|
|
3942
3867
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
3943
3868
|
}
|
|
3944
|
-
const outputField =
|
|
3869
|
+
const outputField = ts22.factory.createElementAccessExpression(dirId, ts22.factory.createStringLiteral(field));
|
|
3945
3870
|
addParseSpanInfo(outputField, output.keySpan);
|
|
3946
3871
|
if (this.tcb.env.config.checkTypeOfOutputEvents) {
|
|
3947
3872
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
3948
|
-
const subscribeFn =
|
|
3949
|
-
const call =
|
|
3873
|
+
const subscribeFn = ts22.factory.createPropertyAccessExpression(outputField, "subscribe");
|
|
3874
|
+
const call = ts22.factory.createCallExpression(subscribeFn, void 0, [handler]);
|
|
3950
3875
|
addParseSpanInfo(call, output.sourceSpan);
|
|
3951
|
-
this.scope.addStatement(
|
|
3876
|
+
this.scope.addStatement(ts22.factory.createExpressionStatement(call));
|
|
3952
3877
|
} else {
|
|
3953
|
-
this.scope.addStatement(
|
|
3878
|
+
this.scope.addStatement(ts22.factory.createExpressionStatement(outputField));
|
|
3954
3879
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
3955
|
-
this.scope.addStatement(
|
|
3880
|
+
this.scope.addStatement(ts22.factory.createExpressionStatement(handler));
|
|
3956
3881
|
}
|
|
3957
3882
|
ExpressionSemanticVisitor.visit(output.handler, this.tcb.id, this.tcb.boundTarget, this.tcb.oobRecorder);
|
|
3958
3883
|
}
|
|
@@ -3985,24 +3910,24 @@ var TcbUnclaimedOutputsOp = class extends TcbOp {
|
|
|
3985
3910
|
if (output.type === 1) {
|
|
3986
3911
|
const eventType = this.tcb.env.config.checkTypeOfAnimationEvents ? this.tcb.env.referenceExternalType("@angular/animations", "AnimationEvent") : 1;
|
|
3987
3912
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, eventType);
|
|
3988
|
-
this.scope.addStatement(
|
|
3913
|
+
this.scope.addStatement(ts22.factory.createExpressionStatement(handler));
|
|
3989
3914
|
} else if (this.tcb.env.config.checkTypeOfDomEvents) {
|
|
3990
3915
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
3991
3916
|
if (elId === null) {
|
|
3992
3917
|
elId = this.scope.resolve(this.element);
|
|
3993
3918
|
}
|
|
3994
|
-
const propertyAccess =
|
|
3919
|
+
const propertyAccess = ts22.factory.createPropertyAccessExpression(elId, "addEventListener");
|
|
3995
3920
|
addParseSpanInfo(propertyAccess, output.keySpan);
|
|
3996
|
-
const call =
|
|
3921
|
+
const call = ts22.factory.createCallExpression(
|
|
3997
3922
|
propertyAccess,
|
|
3998
3923
|
void 0,
|
|
3999
|
-
[
|
|
3924
|
+
[ts22.factory.createStringLiteral(output.name), handler]
|
|
4000
3925
|
);
|
|
4001
3926
|
addParseSpanInfo(call, output.sourceSpan);
|
|
4002
|
-
this.scope.addStatement(
|
|
3927
|
+
this.scope.addStatement(ts22.factory.createExpressionStatement(call));
|
|
4003
3928
|
} else {
|
|
4004
3929
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
4005
|
-
this.scope.addStatement(
|
|
3930
|
+
this.scope.addStatement(ts22.factory.createExpressionStatement(handler));
|
|
4006
3931
|
}
|
|
4007
3932
|
ExpressionSemanticVisitor.visit(output.handler, this.tcb.id, this.tcb.boundTarget, this.tcb.oobRecorder);
|
|
4008
3933
|
}
|
|
@@ -4016,15 +3941,15 @@ var TcbComponentContextCompletionOp = class extends TcbOp {
|
|
|
4016
3941
|
this.optional = false;
|
|
4017
3942
|
}
|
|
4018
3943
|
execute() {
|
|
4019
|
-
const ctx =
|
|
4020
|
-
const ctxDot =
|
|
3944
|
+
const ctx = ts22.factory.createThis();
|
|
3945
|
+
const ctxDot = ts22.factory.createPropertyAccessExpression(ctx, "");
|
|
4021
3946
|
markIgnoreDiagnostics(ctxDot);
|
|
4022
3947
|
addExpressionIdentifier(ctxDot, ExpressionIdentifier.COMPONENT_COMPLETION);
|
|
4023
|
-
this.scope.addStatement(
|
|
3948
|
+
this.scope.addStatement(ts22.factory.createExpressionStatement(ctxDot));
|
|
4024
3949
|
return null;
|
|
4025
3950
|
}
|
|
4026
3951
|
};
|
|
4027
|
-
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR =
|
|
3952
|
+
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR = ts22.factory.createNonNullExpression(ts22.factory.createNull());
|
|
4028
3953
|
var Context = class {
|
|
4029
3954
|
constructor(env, domSchemaChecker, oobRecorder, id, boundTarget, pipes, schemas, hostIsStandalone) {
|
|
4030
3955
|
this.env = env;
|
|
@@ -4038,7 +3963,7 @@ var Context = class {
|
|
|
4038
3963
|
this.nextId = 1;
|
|
4039
3964
|
}
|
|
4040
3965
|
allocateId() {
|
|
4041
|
-
return
|
|
3966
|
+
return ts22.factory.createIdentifier(`_t${this.nextId++}`);
|
|
4042
3967
|
}
|
|
4043
3968
|
getPipeByName(name) {
|
|
4044
3969
|
if (!this.pipes.has(name)) {
|
|
@@ -4091,16 +4016,16 @@ var Scope = class {
|
|
|
4091
4016
|
const res = this.resolveLocal(node, directive);
|
|
4092
4017
|
if (res !== null) {
|
|
4093
4018
|
let clone;
|
|
4094
|
-
if (
|
|
4095
|
-
clone =
|
|
4096
|
-
} else if (
|
|
4097
|
-
clone =
|
|
4019
|
+
if (ts22.isIdentifier(res)) {
|
|
4020
|
+
clone = ts22.factory.createIdentifier(res.text);
|
|
4021
|
+
} else if (ts22.isNonNullExpression(res)) {
|
|
4022
|
+
clone = ts22.factory.createNonNullExpression(res.expression);
|
|
4098
4023
|
} else {
|
|
4099
4024
|
throw new Error(`Could not resolve ${node} to an Identifier or a NonNullExpression`);
|
|
4100
4025
|
}
|
|
4101
|
-
|
|
4026
|
+
ts22.setOriginalNode(clone, res);
|
|
4102
4027
|
clone.parent = clone.parent;
|
|
4103
|
-
return
|
|
4028
|
+
return ts22.setSyntheticTrailingComments(clone, []);
|
|
4104
4029
|
} else if (this.parent !== null) {
|
|
4105
4030
|
return this.parent.resolve(node, directive);
|
|
4106
4031
|
} else {
|
|
@@ -4127,7 +4052,7 @@ var Scope = class {
|
|
|
4127
4052
|
} else if (parentGuards === null) {
|
|
4128
4053
|
return this.guard;
|
|
4129
4054
|
} else {
|
|
4130
|
-
return
|
|
4055
|
+
return ts22.factory.createBinaryExpression(parentGuards, ts22.SyntaxKind.AmpersandAmpersandToken, this.guard);
|
|
4131
4056
|
}
|
|
4132
4057
|
}
|
|
4133
4058
|
resolveLocal(ref, directive) {
|
|
@@ -4307,12 +4232,12 @@ var Scope = class {
|
|
|
4307
4232
|
}
|
|
4308
4233
|
};
|
|
4309
4234
|
function tcbThisParam(name, typeArguments) {
|
|
4310
|
-
return
|
|
4235
|
+
return ts22.factory.createParameterDeclaration(
|
|
4311
4236
|
void 0,
|
|
4312
4237
|
void 0,
|
|
4313
4238
|
"this",
|
|
4314
4239
|
void 0,
|
|
4315
|
-
|
|
4240
|
+
ts22.factory.createTypeReferenceNode(name, typeArguments),
|
|
4316
4241
|
void 0
|
|
4317
4242
|
);
|
|
4318
4243
|
}
|
|
@@ -4337,11 +4262,11 @@ var TcbExpressionTranslator = class {
|
|
|
4337
4262
|
return null;
|
|
4338
4263
|
}
|
|
4339
4264
|
const expr = this.translate(ast.value);
|
|
4340
|
-
const result =
|
|
4265
|
+
const result = ts22.factory.createParenthesizedExpression(ts22.factory.createBinaryExpression(target, ts22.SyntaxKind.EqualsToken, expr));
|
|
4341
4266
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
4342
4267
|
return result;
|
|
4343
4268
|
} else if (ast instanceof ImplicitReceiver4) {
|
|
4344
|
-
return
|
|
4269
|
+
return ts22.factory.createThis();
|
|
4345
4270
|
} else if (ast instanceof BindingPipe) {
|
|
4346
4271
|
const expr = this.translate(ast.exp);
|
|
4347
4272
|
const pipeRef = this.tcb.getPipeByName(ast.name);
|
|
@@ -4353,12 +4278,12 @@ var TcbExpressionTranslator = class {
|
|
|
4353
4278
|
pipe = this.tcb.env.pipeInst(pipeRef);
|
|
4354
4279
|
}
|
|
4355
4280
|
const args = ast.args.map((arg) => this.translate(arg));
|
|
4356
|
-
let methodAccess =
|
|
4281
|
+
let methodAccess = ts22.factory.createPropertyAccessExpression(pipe, "transform");
|
|
4357
4282
|
addParseSpanInfo(methodAccess, ast.nameSpan);
|
|
4358
4283
|
if (!this.tcb.env.config.checkTypeOfPipes) {
|
|
4359
|
-
methodAccess =
|
|
4284
|
+
methodAccess = ts22.factory.createAsExpression(methodAccess, ts22.factory.createKeywordTypeNode(ts22.SyntaxKind.AnyKeyword));
|
|
4360
4285
|
}
|
|
4361
|
-
const result =
|
|
4286
|
+
const result = ts22.factory.createCallExpression(
|
|
4362
4287
|
methodAccess,
|
|
4363
4288
|
void 0,
|
|
4364
4289
|
[expr, ...args]
|
|
@@ -4368,8 +4293,8 @@ var TcbExpressionTranslator = class {
|
|
|
4368
4293
|
} else if ((ast instanceof Call2 || ast instanceof SafeCall) && (ast.receiver instanceof PropertyRead4 || ast.receiver instanceof SafePropertyRead3)) {
|
|
4369
4294
|
if (ast.receiver.receiver instanceof ImplicitReceiver4 && !(ast.receiver.receiver instanceof ThisReceiver) && ast.receiver.name === "$any" && ast.args.length === 1) {
|
|
4370
4295
|
const expr = this.translate(ast.args[0]);
|
|
4371
|
-
const exprAsAny =
|
|
4372
|
-
const result =
|
|
4296
|
+
const exprAsAny = ts22.factory.createAsExpression(expr, ts22.factory.createKeywordTypeNode(ts22.SyntaxKind.AnyKeyword));
|
|
4297
|
+
const result = ts22.factory.createParenthesizedExpression(exprAsAny);
|
|
4373
4298
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
4374
4299
|
return result;
|
|
4375
4300
|
}
|
|
@@ -4380,7 +4305,7 @@ var TcbExpressionTranslator = class {
|
|
|
4380
4305
|
const method = wrapForDiagnostics(receiver);
|
|
4381
4306
|
addParseSpanInfo(method, ast.receiver.nameSpan);
|
|
4382
4307
|
const args = ast.args.map((arg) => this.translate(arg));
|
|
4383
|
-
const node =
|
|
4308
|
+
const node = ts22.factory.createCallExpression(method, void 0, args);
|
|
4384
4309
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
4385
4310
|
return node;
|
|
4386
4311
|
} else {
|
|
@@ -4400,20 +4325,20 @@ var TcbExpressionTranslator = class {
|
|
|
4400
4325
|
function tcbCallTypeCtor(dir, tcb, inputs) {
|
|
4401
4326
|
const typeCtor = tcb.env.typeCtorFor(dir);
|
|
4402
4327
|
const members = inputs.map((input) => {
|
|
4403
|
-
const propertyName =
|
|
4328
|
+
const propertyName = ts22.factory.createStringLiteral(input.field);
|
|
4404
4329
|
if (input.type === "binding") {
|
|
4405
4330
|
const expr = widenBinding(input.expression, tcb);
|
|
4406
|
-
const assignment =
|
|
4331
|
+
const assignment = ts22.factory.createPropertyAssignment(propertyName, wrapForDiagnostics(expr));
|
|
4407
4332
|
addParseSpanInfo(assignment, input.sourceSpan);
|
|
4408
4333
|
return assignment;
|
|
4409
4334
|
} else {
|
|
4410
|
-
return
|
|
4335
|
+
return ts22.factory.createPropertyAssignment(propertyName, NULL_AS_ANY);
|
|
4411
4336
|
}
|
|
4412
4337
|
});
|
|
4413
|
-
return
|
|
4338
|
+
return ts22.factory.createCallExpression(
|
|
4414
4339
|
typeCtor,
|
|
4415
4340
|
void 0,
|
|
4416
|
-
[
|
|
4341
|
+
[ts22.factory.createObjectLiteralExpression(members)]
|
|
4417
4342
|
);
|
|
4418
4343
|
}
|
|
4419
4344
|
function getBoundAttributes(directive, node) {
|
|
@@ -4448,17 +4373,17 @@ function translateInput(attr, tcb, scope) {
|
|
|
4448
4373
|
if (attr instanceof TmplAstBoundAttribute) {
|
|
4449
4374
|
return tcbExpression(attr.value, tcb, scope);
|
|
4450
4375
|
} else {
|
|
4451
|
-
return
|
|
4376
|
+
return ts22.factory.createStringLiteral(attr.value);
|
|
4452
4377
|
}
|
|
4453
4378
|
}
|
|
4454
4379
|
function widenBinding(expr, tcb) {
|
|
4455
4380
|
if (!tcb.env.config.checkTypeOfInputBindings) {
|
|
4456
4381
|
return tsCastToAny(expr);
|
|
4457
4382
|
} else if (!tcb.env.config.strictNullInputBindings) {
|
|
4458
|
-
if (
|
|
4383
|
+
if (ts22.isObjectLiteralExpression(expr) || ts22.isArrayLiteralExpression(expr)) {
|
|
4459
4384
|
return expr;
|
|
4460
4385
|
} else {
|
|
4461
|
-
return
|
|
4386
|
+
return ts22.factory.createNonNullExpression(expr);
|
|
4462
4387
|
}
|
|
4463
4388
|
} else {
|
|
4464
4389
|
return expr;
|
|
@@ -4471,16 +4396,16 @@ function tcbCreateEventHandler(event, tcb, scope, eventType) {
|
|
|
4471
4396
|
if (eventType === 0) {
|
|
4472
4397
|
eventParamType = void 0;
|
|
4473
4398
|
} else if (eventType === 1) {
|
|
4474
|
-
eventParamType =
|
|
4399
|
+
eventParamType = ts22.factory.createKeywordTypeNode(ts22.SyntaxKind.AnyKeyword);
|
|
4475
4400
|
} else {
|
|
4476
4401
|
eventParamType = eventType;
|
|
4477
4402
|
}
|
|
4478
4403
|
const guards = scope.guards();
|
|
4479
|
-
let body =
|
|
4404
|
+
let body = ts22.factory.createExpressionStatement(handler);
|
|
4480
4405
|
if (guards !== null) {
|
|
4481
|
-
body =
|
|
4406
|
+
body = ts22.factory.createIfStatement(guards, body);
|
|
4482
4407
|
}
|
|
4483
|
-
const eventParam =
|
|
4408
|
+
const eventParam = ts22.factory.createParameterDeclaration(
|
|
4484
4409
|
void 0,
|
|
4485
4410
|
void 0,
|
|
4486
4411
|
EVENT_PARAMETER,
|
|
@@ -4488,13 +4413,13 @@ function tcbCreateEventHandler(event, tcb, scope, eventType) {
|
|
|
4488
4413
|
eventParamType
|
|
4489
4414
|
);
|
|
4490
4415
|
addExpressionIdentifier(eventParam, ExpressionIdentifier.EVENT_PARAMETER);
|
|
4491
|
-
return
|
|
4416
|
+
return ts22.factory.createArrowFunction(
|
|
4492
4417
|
void 0,
|
|
4493
4418
|
void 0,
|
|
4494
4419
|
[eventParam],
|
|
4495
|
-
|
|
4420
|
+
ts22.factory.createKeywordTypeNode(ts22.SyntaxKind.AnyKeyword),
|
|
4496
4421
|
void 0,
|
|
4497
|
-
|
|
4422
|
+
ts22.factory.createBlock([body])
|
|
4498
4423
|
);
|
|
4499
4424
|
}
|
|
4500
4425
|
function tcbEventHandlerExpression(ast, tcb, scope) {
|
|
@@ -4523,7 +4448,7 @@ function isSplitTwoWayBinding(inputName, output, inputs, tcb) {
|
|
|
4523
4448
|
var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
|
|
4524
4449
|
resolve(ast) {
|
|
4525
4450
|
if (ast instanceof PropertyRead4 && ast.receiver instanceof ImplicitReceiver4 && !(ast.receiver instanceof ThisReceiver) && ast.name === EVENT_PARAMETER) {
|
|
4526
|
-
const event =
|
|
4451
|
+
const event = ts22.factory.createIdentifier(EVENT_PARAMETER);
|
|
4527
4452
|
addParseSpanInfo(event, ast.nameSpan);
|
|
4528
4453
|
return event;
|
|
4529
4454
|
}
|
|
@@ -4532,32 +4457,32 @@ var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
|
|
|
4532
4457
|
};
|
|
4533
4458
|
|
|
4534
4459
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_file.mjs
|
|
4535
|
-
import
|
|
4460
|
+
import ts23 from "typescript";
|
|
4536
4461
|
var TypeCheckFile = class extends Environment {
|
|
4537
4462
|
constructor(fileName, config, refEmitter, reflector, compilerHost) {
|
|
4538
|
-
super(config, new ImportManager(new NoopImportRewriter(), "i"), refEmitter, reflector,
|
|
4463
|
+
super(config, new ImportManager(new NoopImportRewriter(), "i"), refEmitter, reflector, ts23.createSourceFile(compilerHost.getCanonicalFileName(fileName), "", ts23.ScriptTarget.Latest, true));
|
|
4539
4464
|
this.fileName = fileName;
|
|
4540
4465
|
this.nextTcbId = 1;
|
|
4541
4466
|
this.tcbStatements = [];
|
|
4542
4467
|
}
|
|
4543
4468
|
addTypeCheckBlock(ref, meta, domSchemaChecker, oobRecorder, genericContextBehavior) {
|
|
4544
|
-
const fnId =
|
|
4469
|
+
const fnId = ts23.factory.createIdentifier(`_tcb${this.nextTcbId++}`);
|
|
4545
4470
|
const fn = generateTypeCheckBlock(this, ref, fnId, meta, domSchemaChecker, oobRecorder, genericContextBehavior);
|
|
4546
4471
|
this.tcbStatements.push(fn);
|
|
4547
4472
|
}
|
|
4548
4473
|
render(removeComments) {
|
|
4549
4474
|
let source = this.importManager.getAllImports(this.contextFile.fileName).map((i) => `import * as ${i.qualifier.text} from '${i.specifier}';`).join("\n") + "\n\n";
|
|
4550
|
-
const printer =
|
|
4475
|
+
const printer = ts23.createPrinter({ removeComments });
|
|
4551
4476
|
source += "\n";
|
|
4552
4477
|
for (const stmt of this.pipeInstStatements) {
|
|
4553
|
-
source += printer.printNode(
|
|
4478
|
+
source += printer.printNode(ts23.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
4554
4479
|
}
|
|
4555
4480
|
for (const stmt of this.typeCtorStatements) {
|
|
4556
|
-
source += printer.printNode(
|
|
4481
|
+
source += printer.printNode(ts23.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
4557
4482
|
}
|
|
4558
4483
|
source += "\n";
|
|
4559
4484
|
for (const stmt of this.tcbStatements) {
|
|
4560
|
-
source += printer.printNode(
|
|
4485
|
+
source += printer.printNode(ts23.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
4561
4486
|
}
|
|
4562
4487
|
source += "\nexport const IS_A_MODULE = true;\n";
|
|
4563
4488
|
return source;
|
|
@@ -4672,7 +4597,7 @@ var TypeCheckContextImpl = class {
|
|
|
4672
4597
|
const importManager = new ImportManager(new NoopImportRewriter(), "_i");
|
|
4673
4598
|
const ops = this.opMap.get(sf).sort(orderOps);
|
|
4674
4599
|
const textParts = splitStringAtPoints(sf.text, ops.map((op) => op.splitPoint));
|
|
4675
|
-
const printer =
|
|
4600
|
+
const printer = ts24.createPrinter({ omitTrailingSemicolon: true });
|
|
4676
4601
|
let code = textParts[0];
|
|
4677
4602
|
ops.forEach((op, idx) => {
|
|
4678
4603
|
const text = op.execute(importManager, sf, this.refEmitter, printer);
|
|
@@ -4753,7 +4678,7 @@ var TypeCheckContextImpl = class {
|
|
|
4753
4678
|
if (span.start.offset === span.end.offset) {
|
|
4754
4679
|
span.end.offset++;
|
|
4755
4680
|
}
|
|
4756
|
-
return makeTemplateDiagnostic(templateId, sourceMapping, span,
|
|
4681
|
+
return makeTemplateDiagnostic(templateId, sourceMapping, span, ts24.DiagnosticCategory.Error, ngErrorCode(ErrorCode.TEMPLATE_PARSE_ERROR), error.msg);
|
|
4757
4682
|
});
|
|
4758
4683
|
}
|
|
4759
4684
|
};
|
|
@@ -4771,9 +4696,9 @@ var InlineTcbOp = class {
|
|
|
4771
4696
|
}
|
|
4772
4697
|
execute(im, sf, refEmitter, printer) {
|
|
4773
4698
|
const env = new Environment(this.config, im, refEmitter, this.reflector, sf);
|
|
4774
|
-
const fnName =
|
|
4699
|
+
const fnName = ts24.factory.createIdentifier(`_tcb_${this.ref.node.pos}`);
|
|
4775
4700
|
const fn = generateTypeCheckBlock(env, this.ref, fnName, this.meta, this.domSchemaChecker, this.oobRecorder, TcbGenericContextBehavior.CopyClassNodes);
|
|
4776
|
-
return printer.printNode(
|
|
4701
|
+
return printer.printNode(ts24.EmitHint.Unspecified, fn, sf);
|
|
4777
4702
|
}
|
|
4778
4703
|
};
|
|
4779
4704
|
var TypeCtorOp = class {
|
|
@@ -4786,7 +4711,7 @@ var TypeCtorOp = class {
|
|
|
4786
4711
|
}
|
|
4787
4712
|
execute(im, sf, refEmitter, printer) {
|
|
4788
4713
|
const tcb = generateInlineTypeCtor(this.ref.node, this.meta);
|
|
4789
|
-
return printer.printNode(
|
|
4714
|
+
return printer.printNode(ts24.EmitHint.Unspecified, tcb, sf);
|
|
4790
4715
|
}
|
|
4791
4716
|
};
|
|
4792
4717
|
function orderOps(op1, op2) {
|
|
@@ -4901,7 +4826,7 @@ var TemplateSourceManager = class {
|
|
|
4901
4826
|
|
|
4902
4827
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/template_symbol_builder.mjs
|
|
4903
4828
|
import { AST, ASTWithSource as ASTWithSource3, BindingPipe as BindingPipe2, PropertyRead as PropertyRead5, PropertyWrite as PropertyWrite4, SafePropertyRead as SafePropertyRead4, TmplAstBoundAttribute as TmplAstBoundAttribute2, TmplAstBoundEvent, TmplAstElement as TmplAstElement4, TmplAstReference as TmplAstReference4, TmplAstTemplate as TmplAstTemplate3, TmplAstTextAttribute as TmplAstTextAttribute3, TmplAstVariable as TmplAstVariable3 } from "@angular/compiler";
|
|
4904
|
-
import
|
|
4829
|
+
import ts25 from "typescript";
|
|
4905
4830
|
var SymbolBuilder = class {
|
|
4906
4831
|
constructor(tcbPath, tcbIsShim, typeCheckBlock, templateData, componentScopeReader, getTypeChecker) {
|
|
4907
4832
|
this.tcbPath = tcbPath;
|
|
@@ -4945,7 +4870,7 @@ var SymbolBuilder = class {
|
|
|
4945
4870
|
getSymbolOfElement(element) {
|
|
4946
4871
|
var _a;
|
|
4947
4872
|
const elementSourceSpan = (_a = element.startSourceSpan) != null ? _a : element.sourceSpan;
|
|
4948
|
-
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: elementSourceSpan, filter:
|
|
4873
|
+
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: elementSourceSpan, filter: ts25.isVariableDeclaration });
|
|
4949
4874
|
if (node === null) {
|
|
4950
4875
|
return null;
|
|
4951
4876
|
}
|
|
@@ -4965,12 +4890,12 @@ var SymbolBuilder = class {
|
|
|
4965
4890
|
var _a;
|
|
4966
4891
|
const elementSourceSpan = (_a = element.startSourceSpan) != null ? _a : element.sourceSpan;
|
|
4967
4892
|
const tcbSourceFile = this.typeCheckBlock.getSourceFile();
|
|
4968
|
-
const isDirectiveDeclaration = (node) => (
|
|
4893
|
+
const isDirectiveDeclaration = (node) => (ts25.isTypeNode(node) || ts25.isIdentifier(node)) && ts25.isVariableDeclaration(node.parent) && hasExpressionIdentifier(tcbSourceFile, node, ExpressionIdentifier.DIRECTIVE);
|
|
4969
4894
|
const nodes = findAllMatchingNodes(this.typeCheckBlock, { withSpan: elementSourceSpan, filter: isDirectiveDeclaration });
|
|
4970
4895
|
const symbols = [];
|
|
4971
4896
|
for (const node of nodes) {
|
|
4972
4897
|
const symbol = this.getSymbolOfTsNode(node.parent);
|
|
4973
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
4898
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts25.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
4974
4899
|
continue;
|
|
4975
4900
|
}
|
|
4976
4901
|
const meta = this.getDirectiveMeta(element, symbol.tsSymbol.valueDeclaration);
|
|
@@ -4998,7 +4923,7 @@ var SymbolBuilder = class {
|
|
|
4998
4923
|
}
|
|
4999
4924
|
addHostDirectiveSymbols(host, hostDirectives, symbols) {
|
|
5000
4925
|
for (const current of hostDirectives) {
|
|
5001
|
-
if (!
|
|
4926
|
+
if (!ts25.isClassDeclaration(current.directive.node)) {
|
|
5002
4927
|
continue;
|
|
5003
4928
|
}
|
|
5004
4929
|
const symbol = this.getSymbolOfTsNode(current.directive.node);
|
|
@@ -5071,17 +4996,17 @@ var SymbolBuilder = class {
|
|
|
5071
4996
|
if (!isAccessExpression(n)) {
|
|
5072
4997
|
return false;
|
|
5073
4998
|
}
|
|
5074
|
-
if (
|
|
4999
|
+
if (ts25.isPropertyAccessExpression(n)) {
|
|
5075
5000
|
return n.name.getText() === expectedAccess;
|
|
5076
5001
|
} else {
|
|
5077
|
-
return
|
|
5002
|
+
return ts25.isStringLiteral(n.argumentExpression) && n.argumentExpression.text === expectedAccess;
|
|
5078
5003
|
}
|
|
5079
5004
|
}
|
|
5080
5005
|
const outputFieldAccesses = findAllMatchingNodes(this.typeCheckBlock, { withSpan: eventBinding.keySpan, filter });
|
|
5081
5006
|
const bindings = [];
|
|
5082
5007
|
for (const outputFieldAccess of outputFieldAccesses) {
|
|
5083
5008
|
if (consumer instanceof TmplAstTemplate3 || consumer instanceof TmplAstElement4) {
|
|
5084
|
-
if (!
|
|
5009
|
+
if (!ts25.isPropertyAccessExpression(outputFieldAccess)) {
|
|
5085
5010
|
continue;
|
|
5086
5011
|
}
|
|
5087
5012
|
const addEventListener = outputFieldAccess.name;
|
|
@@ -5104,7 +5029,7 @@ var SymbolBuilder = class {
|
|
|
5104
5029
|
}
|
|
5105
5030
|
});
|
|
5106
5031
|
} else {
|
|
5107
|
-
if (!
|
|
5032
|
+
if (!ts25.isElementAccessExpression(outputFieldAccess)) {
|
|
5108
5033
|
continue;
|
|
5109
5034
|
}
|
|
5110
5035
|
const tsSymbol = this.getTypeChecker().getSymbolAtLocation(outputFieldAccess.argumentExpression);
|
|
@@ -5177,7 +5102,7 @@ var SymbolBuilder = class {
|
|
|
5177
5102
|
return null;
|
|
5178
5103
|
}
|
|
5179
5104
|
const [declaration] = tsSymbol.declarations;
|
|
5180
|
-
if (!
|
|
5105
|
+
if (!ts25.isVariableDeclaration(declaration) || !hasExpressionIdentifier(
|
|
5181
5106
|
declaration.getSourceFile(),
|
|
5182
5107
|
(_a = declaration.type) != null ? _a : declaration.name,
|
|
5183
5108
|
ExpressionIdentifier.DIRECTIVE
|
|
@@ -5185,7 +5110,7 @@ var SymbolBuilder = class {
|
|
|
5185
5110
|
return null;
|
|
5186
5111
|
}
|
|
5187
5112
|
const symbol = this.getSymbolOfTsNode(declaration);
|
|
5188
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
5113
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts25.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
5189
5114
|
return null;
|
|
5190
5115
|
}
|
|
5191
5116
|
const ref = new Reference(symbol.tsSymbol.valueDeclaration);
|
|
@@ -5205,7 +5130,7 @@ var SymbolBuilder = class {
|
|
|
5205
5130
|
};
|
|
5206
5131
|
}
|
|
5207
5132
|
getSymbolOfVariable(variable) {
|
|
5208
|
-
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: variable.sourceSpan, filter:
|
|
5133
|
+
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: variable.sourceSpan, filter: ts25.isVariableDeclaration });
|
|
5209
5134
|
if (node === null || node.initializer === void 0) {
|
|
5210
5135
|
return null;
|
|
5211
5136
|
}
|
|
@@ -5228,11 +5153,11 @@ var SymbolBuilder = class {
|
|
|
5228
5153
|
}
|
|
5229
5154
|
getSymbolOfReference(ref) {
|
|
5230
5155
|
const target = this.templateData.boundTarget.getReferenceTarget(ref);
|
|
5231
|
-
let node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: ref.sourceSpan, filter:
|
|
5156
|
+
let node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: ref.sourceSpan, filter: ts25.isVariableDeclaration });
|
|
5232
5157
|
if (node === null || target === null || node.initializer === void 0) {
|
|
5233
5158
|
return null;
|
|
5234
5159
|
}
|
|
5235
|
-
const originalDeclaration =
|
|
5160
|
+
const originalDeclaration = ts25.isParenthesizedExpression(node.initializer) && ts25.isAsExpression(node.initializer.expression) ? this.getTypeChecker().getSymbolAtLocation(node.name) : this.getTypeChecker().getSymbolAtLocation(node.initializer);
|
|
5236
5161
|
if (originalDeclaration === void 0 || originalDeclaration.valueDeclaration === void 0) {
|
|
5237
5162
|
return null;
|
|
5238
5163
|
}
|
|
@@ -5256,7 +5181,7 @@ var SymbolBuilder = class {
|
|
|
5256
5181
|
referenceVarLocation: referenceVarTcbLocation
|
|
5257
5182
|
};
|
|
5258
5183
|
} else {
|
|
5259
|
-
if (!
|
|
5184
|
+
if (!ts25.isClassDeclaration(target.directive.ref.node)) {
|
|
5260
5185
|
return null;
|
|
5261
5186
|
}
|
|
5262
5187
|
return {
|
|
@@ -5271,7 +5196,7 @@ var SymbolBuilder = class {
|
|
|
5271
5196
|
}
|
|
5272
5197
|
}
|
|
5273
5198
|
getSymbolOfPipe(expression) {
|
|
5274
|
-
const methodAccess = findFirstMatchingNode(this.typeCheckBlock, { withSpan: expression.nameSpan, filter:
|
|
5199
|
+
const methodAccess = findFirstMatchingNode(this.typeCheckBlock, { withSpan: expression.nameSpan, filter: ts25.isPropertyAccessExpression });
|
|
5275
5200
|
if (methodAccess === null) {
|
|
5276
5201
|
return null;
|
|
5277
5202
|
}
|
|
@@ -5311,7 +5236,7 @@ var SymbolBuilder = class {
|
|
|
5311
5236
|
}
|
|
5312
5237
|
let node = null;
|
|
5313
5238
|
if (expression instanceof PropertyRead5) {
|
|
5314
|
-
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter:
|
|
5239
|
+
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter: ts25.isPropertyAccessExpression });
|
|
5315
5240
|
}
|
|
5316
5241
|
if (node === null) {
|
|
5317
5242
|
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter: anyNodeFilter });
|
|
@@ -5319,10 +5244,10 @@ var SymbolBuilder = class {
|
|
|
5319
5244
|
if (node === null) {
|
|
5320
5245
|
return null;
|
|
5321
5246
|
}
|
|
5322
|
-
while (
|
|
5247
|
+
while (ts25.isParenthesizedExpression(node)) {
|
|
5323
5248
|
node = node.expression;
|
|
5324
5249
|
}
|
|
5325
|
-
if (expression instanceof SafePropertyRead4 &&
|
|
5250
|
+
if (expression instanceof SafePropertyRead4 && ts25.isConditionalExpression(node)) {
|
|
5326
5251
|
const whenTrueSymbol = this.getSymbolOfTsNode(node.whenTrue);
|
|
5327
5252
|
if (whenTrueSymbol === null) {
|
|
5328
5253
|
return null;
|
|
@@ -5339,13 +5264,13 @@ var SymbolBuilder = class {
|
|
|
5339
5264
|
}
|
|
5340
5265
|
getSymbolOfTsNode(node) {
|
|
5341
5266
|
var _a;
|
|
5342
|
-
while (
|
|
5267
|
+
while (ts25.isParenthesizedExpression(node)) {
|
|
5343
5268
|
node = node.expression;
|
|
5344
5269
|
}
|
|
5345
5270
|
let tsSymbol;
|
|
5346
|
-
if (
|
|
5271
|
+
if (ts25.isPropertyAccessExpression(node)) {
|
|
5347
5272
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.name);
|
|
5348
|
-
} else if (
|
|
5273
|
+
} else if (ts25.isElementAccessExpression(node)) {
|
|
5349
5274
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.argumentExpression);
|
|
5350
5275
|
} else {
|
|
5351
5276
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node);
|
|
@@ -5363,13 +5288,13 @@ var SymbolBuilder = class {
|
|
|
5363
5288
|
};
|
|
5364
5289
|
}
|
|
5365
5290
|
getTcbPositionForNode(node) {
|
|
5366
|
-
if (
|
|
5291
|
+
if (ts25.isTypeReferenceNode(node)) {
|
|
5367
5292
|
return this.getTcbPositionForNode(node.typeName);
|
|
5368
|
-
} else if (
|
|
5293
|
+
} else if (ts25.isQualifiedName(node)) {
|
|
5369
5294
|
return node.right.getStart();
|
|
5370
|
-
} else if (
|
|
5295
|
+
} else if (ts25.isPropertyAccessExpression(node)) {
|
|
5371
5296
|
return node.name.getStart();
|
|
5372
|
-
} else if (
|
|
5297
|
+
} else if (ts25.isElementAccessExpression(node)) {
|
|
5373
5298
|
return node.argumentExpression.getStart();
|
|
5374
5299
|
} else {
|
|
5375
5300
|
return node.getStart();
|
|
@@ -6287,7 +6212,7 @@ var factory3 = {
|
|
|
6287
6212
|
|
|
6288
6213
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/nullish_coalescing_not_nullable/index.mjs
|
|
6289
6214
|
import { Binary } from "@angular/compiler";
|
|
6290
|
-
import
|
|
6215
|
+
import ts26 from "typescript";
|
|
6291
6216
|
var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
6292
6217
|
constructor() {
|
|
6293
6218
|
super(...arguments);
|
|
@@ -6301,7 +6226,7 @@ var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
6301
6226
|
return [];
|
|
6302
6227
|
}
|
|
6303
6228
|
const typeLeft = symbolLeft.tsType;
|
|
6304
|
-
if (typeLeft.flags & (
|
|
6229
|
+
if (typeLeft.flags & (ts26.TypeFlags.Any | ts26.TypeFlags.Unknown)) {
|
|
6305
6230
|
return [];
|
|
6306
6231
|
}
|
|
6307
6232
|
if (typeLeft.getNonNullableType() !== typeLeft)
|
|
@@ -6332,7 +6257,7 @@ var factory4 = {
|
|
|
6332
6257
|
|
|
6333
6258
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/optional_chain_not_nullable/index.mjs
|
|
6334
6259
|
import { SafeCall as SafeCall2, SafeKeyedRead as SafeKeyedRead2, SafePropertyRead as SafePropertyRead5 } from "@angular/compiler";
|
|
6335
|
-
import
|
|
6260
|
+
import ts27 from "typescript";
|
|
6336
6261
|
var OptionalChainNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
6337
6262
|
constructor() {
|
|
6338
6263
|
super(...arguments);
|
|
@@ -6346,7 +6271,7 @@ var OptionalChainNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
6346
6271
|
return [];
|
|
6347
6272
|
}
|
|
6348
6273
|
const typeLeft = symbolLeft.tsType;
|
|
6349
|
-
if (typeLeft.flags & (
|
|
6274
|
+
if (typeLeft.flags & (ts27.TypeFlags.Any | ts27.TypeFlags.Unknown)) {
|
|
6350
6275
|
return [];
|
|
6351
6276
|
}
|
|
6352
6277
|
if (typeLeft.getNonNullableType() !== typeLeft)
|
|
@@ -6440,7 +6365,7 @@ var factory7 = {
|
|
|
6440
6365
|
};
|
|
6441
6366
|
|
|
6442
6367
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/src/extended_template_checker.mjs
|
|
6443
|
-
import
|
|
6368
|
+
import ts28 from "typescript";
|
|
6444
6369
|
|
|
6445
6370
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/api/src/public_options.mjs
|
|
6446
6371
|
var DiagnosticCategoryLabel;
|
|
@@ -6489,9 +6414,9 @@ var ExtendedTemplateCheckerImpl = class {
|
|
|
6489
6414
|
function diagnosticLabelToCategory(label) {
|
|
6490
6415
|
switch (label) {
|
|
6491
6416
|
case DiagnosticCategoryLabel.Warning:
|
|
6492
|
-
return
|
|
6417
|
+
return ts28.DiagnosticCategory.Warning;
|
|
6493
6418
|
case DiagnosticCategoryLabel.Error:
|
|
6494
|
-
return
|
|
6419
|
+
return ts28.DiagnosticCategory.Error;
|
|
6495
6420
|
case DiagnosticCategoryLabel.Suppress:
|
|
6496
6421
|
return null;
|
|
6497
6422
|
default:
|
|
@@ -6605,7 +6530,7 @@ var NgCompiler = class {
|
|
|
6605
6530
|
this.currentProgram = inputProgram;
|
|
6606
6531
|
this.closureCompilerEnabled = !!this.options.annotateForClosureCompiler;
|
|
6607
6532
|
this.entryPoint = adapter.entryPoint !== null ? getSourceFileOrNull(inputProgram, adapter.entryPoint) : null;
|
|
6608
|
-
const moduleResolutionCache =
|
|
6533
|
+
const moduleResolutionCache = ts29.createModuleResolutionCache(
|
|
6609
6534
|
this.adapter.getCurrentDirectory(),
|
|
6610
6535
|
this.adapter.getCanonicalFileName.bind(this.adapter)
|
|
6611
6536
|
);
|
|
@@ -6649,7 +6574,7 @@ var NgCompiler = class {
|
|
|
6649
6574
|
}
|
|
6650
6575
|
for (const clazz of classesToUpdate) {
|
|
6651
6576
|
this.compilation.traitCompiler.updateResources(clazz);
|
|
6652
|
-
if (!
|
|
6577
|
+
if (!ts29.isClassDeclaration(clazz)) {
|
|
6653
6578
|
continue;
|
|
6654
6579
|
}
|
|
6655
6580
|
this.compilation.templateTypeChecker.invalidateClass(clazz);
|
|
@@ -7104,18 +7029,18 @@ function isAngularCorePackage(program) {
|
|
|
7104
7029
|
return false;
|
|
7105
7030
|
}
|
|
7106
7031
|
return r3Symbols.statements.some((stmt) => {
|
|
7107
|
-
if (!
|
|
7032
|
+
if (!ts29.isVariableStatement(stmt)) {
|
|
7108
7033
|
return false;
|
|
7109
7034
|
}
|
|
7110
|
-
const modifiers =
|
|
7111
|
-
if (modifiers === void 0 || !modifiers.some((mod) => mod.kind ===
|
|
7035
|
+
const modifiers = ts29.getModifiers(stmt);
|
|
7036
|
+
if (modifiers === void 0 || !modifiers.some((mod) => mod.kind === ts29.SyntaxKind.ExportKeyword)) {
|
|
7112
7037
|
return false;
|
|
7113
7038
|
}
|
|
7114
7039
|
return stmt.declarationList.declarations.some((decl) => {
|
|
7115
|
-
if (!
|
|
7040
|
+
if (!ts29.isIdentifier(decl.name) || decl.name.text !== "ITS_JUST_ANGULAR") {
|
|
7116
7041
|
return false;
|
|
7117
7042
|
}
|
|
7118
|
-
if (decl.initializer === void 0 || decl.initializer.kind !==
|
|
7043
|
+
if (decl.initializer === void 0 || decl.initializer.kind !== ts29.SyntaxKind.TrueKeyword) {
|
|
7119
7044
|
return false;
|
|
7120
7045
|
}
|
|
7121
7046
|
return true;
|
|
@@ -7129,7 +7054,7 @@ function* verifyCompatibleTypeCheckOptions(options) {
|
|
|
7129
7054
|
var _a, _b, _c;
|
|
7130
7055
|
if (options.fullTemplateTypeCheck === false && options.strictTemplates === true) {
|
|
7131
7056
|
yield makeConfigDiagnostic({
|
|
7132
|
-
category:
|
|
7057
|
+
category: ts29.DiagnosticCategory.Error,
|
|
7133
7058
|
code: ErrorCode.CONFIG_STRICT_TEMPLATES_IMPLIES_FULL_TEMPLATE_TYPECHECK,
|
|
7134
7059
|
messageText: `
|
|
7135
7060
|
Angular compiler option "strictTemplates" is enabled, however "fullTemplateTypeCheck" is disabled.
|
|
@@ -7148,7 +7073,7 @@ https://angular.io/guide/template-typecheck
|
|
|
7148
7073
|
}
|
|
7149
7074
|
if (options.extendedDiagnostics && options.strictTemplates === false) {
|
|
7150
7075
|
yield makeConfigDiagnostic({
|
|
7151
|
-
category:
|
|
7076
|
+
category: ts29.DiagnosticCategory.Error,
|
|
7152
7077
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_IMPLIES_STRICT_TEMPLATES,
|
|
7153
7078
|
messageText: `
|
|
7154
7079
|
Angular compiler option "extendedDiagnostics" is configured, however "strictTemplates" is disabled.
|
|
@@ -7165,7 +7090,7 @@ One of the following actions is required:
|
|
|
7165
7090
|
const defaultCategory = (_a = options.extendedDiagnostics) == null ? void 0 : _a.defaultCategory;
|
|
7166
7091
|
if (defaultCategory && !allowedCategoryLabels.includes(defaultCategory)) {
|
|
7167
7092
|
yield makeConfigDiagnostic({
|
|
7168
|
-
category:
|
|
7093
|
+
category: ts29.DiagnosticCategory.Error,
|
|
7169
7094
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
7170
7095
|
messageText: `
|
|
7171
7096
|
Angular compiler option "extendedDiagnostics.defaultCategory" has an unknown diagnostic category: "${defaultCategory}".
|
|
@@ -7179,7 +7104,7 @@ ${allowedCategoryLabels.join("\n")}
|
|
|
7179
7104
|
for (const [checkName, category] of Object.entries((_c = (_b = options.extendedDiagnostics) == null ? void 0 : _b.checks) != null ? _c : {})) {
|
|
7180
7105
|
if (!allExtendedDiagnosticNames.includes(checkName)) {
|
|
7181
7106
|
yield makeConfigDiagnostic({
|
|
7182
|
-
category:
|
|
7107
|
+
category: ts29.DiagnosticCategory.Error,
|
|
7183
7108
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CHECK,
|
|
7184
7109
|
messageText: `
|
|
7185
7110
|
Angular compiler option "extendedDiagnostics.checks" has an unknown check: "${checkName}".
|
|
@@ -7191,7 +7116,7 @@ ${allExtendedDiagnosticNames.join("\n")}
|
|
|
7191
7116
|
}
|
|
7192
7117
|
if (!allowedCategoryLabels.includes(category)) {
|
|
7193
7118
|
yield makeConfigDiagnostic({
|
|
7194
|
-
category:
|
|
7119
|
+
category: ts29.DiagnosticCategory.Error,
|
|
7195
7120
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
7196
7121
|
messageText: `
|
|
7197
7122
|
Angular compiler option "extendedDiagnostics.checks['${checkName}']" has an unknown diagnostic category: "${category}".
|
|
@@ -7221,7 +7146,7 @@ var ReferenceGraphAdapter = class {
|
|
|
7221
7146
|
for (const { node } of references) {
|
|
7222
7147
|
let sourceFile = node.getSourceFile();
|
|
7223
7148
|
if (sourceFile === void 0) {
|
|
7224
|
-
sourceFile =
|
|
7149
|
+
sourceFile = ts29.getOriginalNode(node).getSourceFile();
|
|
7225
7150
|
}
|
|
7226
7151
|
if (sourceFile === void 0 || !isDtsPath(sourceFile.fileName)) {
|
|
7227
7152
|
this.graph.add(source, node);
|
|
@@ -7260,7 +7185,7 @@ function versionMapFromProgram(program, driver) {
|
|
|
7260
7185
|
}
|
|
7261
7186
|
|
|
7262
7187
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/host.mjs
|
|
7263
|
-
import
|
|
7188
|
+
import ts30 from "typescript";
|
|
7264
7189
|
var DelegatingCompilerHost2 = class {
|
|
7265
7190
|
constructor(delegate) {
|
|
7266
7191
|
this.delegate = delegate;
|
|
@@ -7339,7 +7264,7 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
7339
7264
|
entryPoint = findFlatIndexEntryPoint(normalizedTsInputFiles);
|
|
7340
7265
|
if (entryPoint === null) {
|
|
7341
7266
|
diagnostics.push({
|
|
7342
|
-
category:
|
|
7267
|
+
category: ts30.DiagnosticCategory.Error,
|
|
7343
7268
|
code: ngErrorCode(ErrorCode.CONFIG_FLAT_MODULE_NO_INDEX),
|
|
7344
7269
|
file: void 0,
|
|
7345
7270
|
start: void 0,
|
|
@@ -7382,10 +7307,10 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
7382
7307
|
return this.fileNameToModuleName !== void 0 ? this : null;
|
|
7383
7308
|
}
|
|
7384
7309
|
createCachedResolveModuleNamesFunction() {
|
|
7385
|
-
const moduleResolutionCache =
|
|
7310
|
+
const moduleResolutionCache = ts30.createModuleResolutionCache(this.getCurrentDirectory(), this.getCanonicalFileName.bind(this));
|
|
7386
7311
|
return (moduleNames, containingFile, reusedNames, redirectedReference, options) => {
|
|
7387
7312
|
return moduleNames.map((moduleName) => {
|
|
7388
|
-
const module =
|
|
7313
|
+
const module = ts30.resolveModuleName(moduleName, containingFile, options, this, moduleResolutionCache, redirectedReference);
|
|
7389
7314
|
return module.resolvedModule;
|
|
7390
7315
|
});
|
|
7391
7316
|
};
|
|
@@ -7406,7 +7331,7 @@ var NgtscProgram = class {
|
|
|
7406
7331
|
if (reuseProgram !== void 0) {
|
|
7407
7332
|
retagAllTsFiles(reuseProgram);
|
|
7408
7333
|
}
|
|
7409
|
-
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () =>
|
|
7334
|
+
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () => ts31.createProgram(this.host.inputFiles, options, this.host, reuseProgram));
|
|
7410
7335
|
perfRecorder.phase(PerfPhase.Unaccounted);
|
|
7411
7336
|
perfRecorder.memory(PerfCheckpoint.TypeScriptProgramCreate);
|
|
7412
7337
|
this.host.postProgramCreationCleanup();
|
|
@@ -7616,16 +7541,16 @@ function createProgram({ rootNames, options, host, oldProgram }) {
|
|
|
7616
7541
|
}
|
|
7617
7542
|
|
|
7618
7543
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/perform_compile.mjs
|
|
7619
|
-
import
|
|
7544
|
+
import ts33 from "typescript";
|
|
7620
7545
|
|
|
7621
7546
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/transformers/util.mjs
|
|
7622
|
-
import
|
|
7547
|
+
import ts32 from "typescript";
|
|
7623
7548
|
function createMessageDiagnostic(messageText) {
|
|
7624
7549
|
return {
|
|
7625
7550
|
file: void 0,
|
|
7626
7551
|
start: void 0,
|
|
7627
7552
|
length: void 0,
|
|
7628
|
-
category:
|
|
7553
|
+
category: ts32.DiagnosticCategory.Message,
|
|
7629
7554
|
messageText,
|
|
7630
7555
|
code: DEFAULT_ERROR_CODE,
|
|
7631
7556
|
source: SOURCE
|
|
@@ -7634,13 +7559,13 @@ function createMessageDiagnostic(messageText) {
|
|
|
7634
7559
|
|
|
7635
7560
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/perform_compile.mjs
|
|
7636
7561
|
var defaultFormatHost = {
|
|
7637
|
-
getCurrentDirectory: () =>
|
|
7562
|
+
getCurrentDirectory: () => ts33.sys.getCurrentDirectory(),
|
|
7638
7563
|
getCanonicalFileName: (fileName) => fileName,
|
|
7639
|
-
getNewLine: () =>
|
|
7564
|
+
getNewLine: () => ts33.sys.newLine
|
|
7640
7565
|
};
|
|
7641
7566
|
function formatDiagnostics(diags, host = defaultFormatHost) {
|
|
7642
7567
|
if (diags && diags.length) {
|
|
7643
|
-
return diags.map((diagnostic) => replaceTsWithNgInErrors(
|
|
7568
|
+
return diags.map((diagnostic) => replaceTsWithNgInErrors(ts33.formatDiagnosticsWithColorAndContext([diagnostic], host))).join("");
|
|
7644
7569
|
} else {
|
|
7645
7570
|
return "";
|
|
7646
7571
|
}
|
|
@@ -7657,7 +7582,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7657
7582
|
var _a;
|
|
7658
7583
|
try {
|
|
7659
7584
|
const fs = getFileSystem();
|
|
7660
|
-
const readConfigFile = (configFile) =>
|
|
7585
|
+
const readConfigFile = (configFile) => ts33.readConfigFile(configFile, (file) => host.readFile(host.resolve(file)));
|
|
7661
7586
|
const readAngularCompilerOptions = (configFile, parentOptions = {}) => {
|
|
7662
7587
|
const { config: config2, error: error2 } = readConfigFile(configFile);
|
|
7663
7588
|
if (error2) {
|
|
@@ -7692,7 +7617,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7692
7617
|
...existingOptions
|
|
7693
7618
|
};
|
|
7694
7619
|
const parseConfigHost = createParseConfigHost(host, fs);
|
|
7695
|
-
const { options, errors, fileNames: rootNames, projectReferences } =
|
|
7620
|
+
const { options, errors, fileNames: rootNames, projectReferences } = ts33.parseJsonConfigFileContent(config, parseConfigHost, basePath, existingCompilerOptions, configFileName);
|
|
7696
7621
|
let emitFlags = EmitFlags.Default;
|
|
7697
7622
|
if (!(options.skipMetadataEmit || options.flatModuleOutFile)) {
|
|
7698
7623
|
emitFlags |= EmitFlags.Metadata;
|
|
@@ -7703,7 +7628,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7703
7628
|
return { project: projectFile, rootNames, projectReferences, options, errors, emitFlags };
|
|
7704
7629
|
} catch (e) {
|
|
7705
7630
|
const errors = [{
|
|
7706
|
-
category:
|
|
7631
|
+
category: ts33.DiagnosticCategory.Error,
|
|
7707
7632
|
messageText: (_a = e.stack) != null ? _a : e.message,
|
|
7708
7633
|
file: void 0,
|
|
7709
7634
|
start: void 0,
|
|
@@ -7717,7 +7642,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7717
7642
|
function createParseConfigHost(host, fs = getFileSystem()) {
|
|
7718
7643
|
return {
|
|
7719
7644
|
fileExists: host.exists.bind(host),
|
|
7720
|
-
readDirectory:
|
|
7645
|
+
readDirectory: ts33.sys.readDirectory,
|
|
7721
7646
|
readFile: host.readFile.bind(host),
|
|
7722
7647
|
useCaseSensitiveFileNames: fs.isCaseSensitive()
|
|
7723
7648
|
};
|
|
@@ -7737,7 +7662,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
|
7737
7662
|
}
|
|
7738
7663
|
} else {
|
|
7739
7664
|
const parseConfigHost = createParseConfigHost(host, fs);
|
|
7740
|
-
const { resolvedModule } =
|
|
7665
|
+
const { resolvedModule } = ts33.nodeModuleNameResolver(
|
|
7741
7666
|
extendsValue,
|
|
7742
7667
|
configFile,
|
|
7743
7668
|
{ moduleResolution: 2, resolveJsonModule: true },
|
|
@@ -7752,7 +7677,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
|
7752
7677
|
function exitCodeFromResult(diags) {
|
|
7753
7678
|
if (!diags)
|
|
7754
7679
|
return 0;
|
|
7755
|
-
if (diags.every((diag) => diag.category !==
|
|
7680
|
+
if (diags.every((diag) => diag.category !== ts33.DiagnosticCategory.Error)) {
|
|
7756
7681
|
return 0;
|
|
7757
7682
|
}
|
|
7758
7683
|
return diags.some((d) => d.source === "angular" && d.code === UNKNOWN_ERROR_CODE) ? 2 : 1;
|
|
@@ -7785,7 +7710,7 @@ function performCompilation({ rootNames, options, host, oldProgram, emitCallback
|
|
|
7785
7710
|
} catch (e) {
|
|
7786
7711
|
program = void 0;
|
|
7787
7712
|
allDiagnostics.push({
|
|
7788
|
-
category:
|
|
7713
|
+
category: ts33.DiagnosticCategory.Error,
|
|
7789
7714
|
messageText: (_a = e.stack) != null ? _a : e.message,
|
|
7790
7715
|
code: UNKNOWN_ERROR_CODE,
|
|
7791
7716
|
file: void 0,
|
|
@@ -7812,7 +7737,7 @@ function defaultGatherDiagnostics(program) {
|
|
|
7812
7737
|
return allDiagnostics;
|
|
7813
7738
|
}
|
|
7814
7739
|
function hasErrors(diags) {
|
|
7815
|
-
return diags.some((d) => d.category ===
|
|
7740
|
+
return diags.some((d) => d.category === ts33.DiagnosticCategory.Error);
|
|
7816
7741
|
}
|
|
7817
7742
|
|
|
7818
7743
|
export {
|
|
@@ -7846,4 +7771,4 @@ export {
|
|
|
7846
7771
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7847
7772
|
* found in the LICENSE file at https://angular.io/license
|
|
7848
7773
|
*/
|
|
7849
|
-
//# sourceMappingURL=chunk-
|
|
7774
|
+
//# sourceMappingURL=chunk-QRYLMBG3.js.map
|