@angular/compiler-cli 17.0.0-next.4 → 17.0.0-next.6
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-JZC4T2RR.js → chunk-3O3O4L34.js} +1 -1
- package/bundles/{chunk-KC52PQKJ.js → chunk-6MV5LVGW.js} +146 -102
- package/bundles/chunk-6MV5LVGW.js.map +6 -0
- package/bundles/{chunk-T6QD5I2A.js → chunk-7HFK25CM.js} +29 -27
- package/bundles/{chunk-T6QD5I2A.js.map → chunk-7HFK25CM.js.map} +1 -1
- package/bundles/{chunk-UYFEPQRA.js → chunk-7YXJWQNF.js} +1071 -497
- package/bundles/chunk-7YXJWQNF.js.map +6 -0
- package/bundles/{chunk-LYJKWJUC.js → chunk-CF2CT7RQ.js} +3 -3
- package/bundles/{chunk-EJSJTIHK.js → chunk-DQ4T2KWL.js} +8 -8
- package/bundles/{chunk-AIIYON4K.js → chunk-HICXNP7M.js} +52 -33
- package/bundles/chunk-HICXNP7M.js.map +6 -0
- package/bundles/{chunk-EKTJ7622.js → chunk-OULZQUKT.js} +7 -7
- package/bundles/{chunk-WPCCXY7F.js → chunk-T6QZTHEE.js} +5 -5
- package/bundles/{chunk-7PCPPTTO.js → chunk-URH5LEAG.js} +5 -5
- package/bundles/{chunk-PCMLSPQF.js → chunk-W653LDC7.js} +7 -7
- package/bundles/{chunk-VISOZQNG.js → chunk-YPVFT2MR.js} +4 -4
- package/bundles/index.js +19 -13
- package/bundles/index.js.map +1 -1
- package/bundles/linker/babel/index.js +13 -13
- package/bundles/linker/index.js +5 -5
- package/bundles/ngcc/index.js +1 -1
- package/bundles/private/bazel.js +1 -1
- package/bundles/private/localize.js +3 -3
- package/bundles/private/migrations.js +6 -6
- package/bundles/private/tooling.js +4 -4
- package/bundles/src/bin/ng_xi18n.js +11 -11
- package/bundles/src/bin/ngc.js +9 -9
- package/bundles_metadata.json +1 -1
- package/index.d.ts +1 -0
- package/linker/src/file_linker/partial_linkers/partial_component_linker_1.d.ts +2 -0
- package/package.json +5 -5
- package/src/ngtsc/annotations/common/src/evaluation.d.ts +8 -0
- package/src/ngtsc/annotations/component/src/handler.d.ts +2 -0
- package/src/ngtsc/core/src/compiler.d.ts +10 -0
- package/src/ngtsc/diagnostics/src/error_code.d.ts +24 -0
- package/src/ngtsc/docs/index.d.ts +9 -0
- package/src/ngtsc/docs/src/class_extractor.d.ts +13 -0
- package/src/ngtsc/docs/src/constant_extractor.d.ts +13 -0
- package/src/ngtsc/docs/src/entities.d.ts +107 -0
- package/src/ngtsc/docs/src/enum_extractor.d.ts +11 -0
- package/src/ngtsc/docs/src/extractor.d.ts +26 -0
- package/src/ngtsc/docs/src/function_extractor.d.ts +16 -0
- package/src/ngtsc/docs/src/jsdoc_extractor.d.ts +21 -0
- package/src/ngtsc/docs/src/type_extractor.d.ts +10 -0
- package/src/ngtsc/imports/src/deferred_symbol_tracker.d.ts +1 -1
- package/src/ngtsc/program.d.ts +10 -0
- package/src/ngtsc/typecheck/src/oob.d.ts +11 -1
- package/src/ngtsc/typecheck/src/type_check_block.d.ts +8 -3
- package/bundles/chunk-AIIYON4K.js.map +0 -6
- package/bundles/chunk-KC52PQKJ.js.map +0 -6
- package/bundles/chunk-UYFEPQRA.js.map +0 -6
- /package/bundles/{chunk-JZC4T2RR.js.map → chunk-3O3O4L34.js.map} +0 -0
- /package/bundles/{chunk-LYJKWJUC.js.map → chunk-CF2CT7RQ.js.map} +0 -0
- /package/bundles/{chunk-EJSJTIHK.js.map → chunk-DQ4T2KWL.js.map} +0 -0
- /package/bundles/{chunk-EKTJ7622.js.map → chunk-OULZQUKT.js.map} +0 -0
- /package/bundles/{chunk-WPCCXY7F.js.map → chunk-T6QZTHEE.js.map} +0 -0
- /package/bundles/{chunk-7PCPPTTO.js.map → chunk-URH5LEAG.js.map} +0 -0
- /package/bundles/{chunk-PCMLSPQF.js.map → chunk-W653LDC7.js.map} +0 -0
- /package/bundles/{chunk-VISOZQNG.js.map → chunk-YPVFT2MR.js.map} +0 -0
|
@@ -36,12 +36,12 @@ import {
|
|
|
36
36
|
aliasTransformFactory,
|
|
37
37
|
declarationTransformFactory,
|
|
38
38
|
ivyTransformFactory
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-6MV5LVGW.js";
|
|
40
40
|
import {
|
|
41
41
|
ImportManager,
|
|
42
42
|
translateExpression,
|
|
43
43
|
translateType
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-DQ4T2KWL.js";
|
|
45
45
|
import {
|
|
46
46
|
AbsoluteModuleStrategy,
|
|
47
47
|
AliasStrategy,
|
|
@@ -83,14 +83,14 @@ import {
|
|
|
83
83
|
relativePathBetween,
|
|
84
84
|
replaceTsWithNgInErrors,
|
|
85
85
|
toUnredirectedSourceFile
|
|
86
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-7HFK25CM.js";
|
|
87
87
|
import {
|
|
88
88
|
ActivePerfRecorder,
|
|
89
89
|
DelegatingPerfRecorder,
|
|
90
90
|
PerfCheckpoint,
|
|
91
91
|
PerfEvent,
|
|
92
92
|
PerfPhase
|
|
93
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-URH5LEAG.js";
|
|
94
94
|
import {
|
|
95
95
|
LogicalFileSystem,
|
|
96
96
|
absoluteFrom,
|
|
@@ -100,9 +100,9 @@ import {
|
|
|
100
100
|
getSourceFileOrError,
|
|
101
101
|
join,
|
|
102
102
|
resolve
|
|
103
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-W653LDC7.js";
|
|
104
104
|
|
|
105
|
-
// bazel-out/
|
|
105
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/transformers/api.mjs
|
|
106
106
|
var DEFAULT_ERROR_CODE = 100;
|
|
107
107
|
var UNKNOWN_ERROR_CODE = 500;
|
|
108
108
|
var SOURCE = "angular";
|
|
@@ -120,7 +120,7 @@ var EmitFlags;
|
|
|
120
120
|
EmitFlags2[EmitFlags2["All"] = 31] = "All";
|
|
121
121
|
})(EmitFlags || (EmitFlags = {}));
|
|
122
122
|
|
|
123
|
-
// bazel-out/
|
|
123
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/transformers/compiler_host.mjs
|
|
124
124
|
import ts from "typescript";
|
|
125
125
|
var wrapHostForTest = null;
|
|
126
126
|
function createCompilerHost({ options, tsHost = ts.createCompilerHost(options, true) }) {
|
|
@@ -130,11 +130,46 @@ function createCompilerHost({ options, tsHost = ts.createCompilerHost(options, t
|
|
|
130
130
|
return tsHost;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
// bazel-out/
|
|
133
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/entities.mjs
|
|
134
|
+
var EntryType;
|
|
135
|
+
(function(EntryType2) {
|
|
136
|
+
EntryType2["Block"] = "Block";
|
|
137
|
+
EntryType2["Component"] = "component";
|
|
138
|
+
EntryType2["Constant"] = "constant";
|
|
139
|
+
EntryType2["Decorator"] = "decorator";
|
|
140
|
+
EntryType2["Directive"] = "directive";
|
|
141
|
+
EntryType2["Element"] = "element";
|
|
142
|
+
EntryType2["Enum"] = "enum";
|
|
143
|
+
EntryType2["Function"] = "function";
|
|
144
|
+
EntryType2["Interface"] = "interface";
|
|
145
|
+
EntryType2["NgModule"] = "ng_module";
|
|
146
|
+
EntryType2["Pipe"] = "pipe";
|
|
147
|
+
EntryType2["TypeAlias"] = "type_alias";
|
|
148
|
+
EntryType2["UndecoratedClass"] = "undecorated_class";
|
|
149
|
+
})(EntryType || (EntryType = {}));
|
|
150
|
+
var MemberType;
|
|
151
|
+
(function(MemberType2) {
|
|
152
|
+
MemberType2["Property"] = "property";
|
|
153
|
+
MemberType2["Method"] = "method";
|
|
154
|
+
MemberType2["Getter"] = "getter";
|
|
155
|
+
MemberType2["Setter"] = "setter";
|
|
156
|
+
MemberType2["EnumItem"] = "enum_item";
|
|
157
|
+
})(MemberType || (MemberType = {}));
|
|
158
|
+
var MemberTags;
|
|
159
|
+
(function(MemberTags2) {
|
|
160
|
+
MemberTags2["Static"] = "static";
|
|
161
|
+
MemberTags2["Readonly"] = "readonly";
|
|
162
|
+
MemberTags2["Protected"] = "protected";
|
|
163
|
+
MemberTags2["Optional"] = "optional";
|
|
164
|
+
MemberTags2["Input"] = "input";
|
|
165
|
+
MemberTags2["Output"] = "output";
|
|
166
|
+
})(MemberTags || (MemberTags = {}));
|
|
167
|
+
|
|
168
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/program.mjs
|
|
134
169
|
import { HtmlParser, MessageBundle } from "@angular/compiler";
|
|
135
|
-
import
|
|
170
|
+
import ts36 from "typescript";
|
|
136
171
|
|
|
137
|
-
// bazel-out/
|
|
172
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/transformers/i18n.mjs
|
|
138
173
|
import { Xliff, Xliff2, Xmb } from "@angular/compiler";
|
|
139
174
|
import * as path from "path";
|
|
140
175
|
function i18nGetExtension(formatName) {
|
|
@@ -185,10 +220,10 @@ function getPathNormalizer(basePath) {
|
|
|
185
220
|
};
|
|
186
221
|
}
|
|
187
222
|
|
|
188
|
-
// bazel-out/
|
|
223
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/typescript_support.mjs
|
|
189
224
|
import ts2 from "typescript";
|
|
190
225
|
|
|
191
|
-
// bazel-out/
|
|
226
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/version_helpers.mjs
|
|
192
227
|
function toNumbers(value) {
|
|
193
228
|
const suffixIndex = value.lastIndexOf("-");
|
|
194
229
|
return value.slice(0, suffixIndex === -1 ? value.length : suffixIndex).split(".").map((segment) => {
|
|
@@ -223,8 +258,8 @@ function compareVersions(v1, v2) {
|
|
|
223
258
|
return compareNumbers(toNumbers(v1), toNumbers(v2));
|
|
224
259
|
}
|
|
225
260
|
|
|
226
|
-
// bazel-out/
|
|
227
|
-
var MIN_TS_VERSION = "
|
|
261
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/typescript_support.mjs
|
|
262
|
+
var MIN_TS_VERSION = "5.2.0";
|
|
228
263
|
var MAX_TS_VERSION = "5.3.0";
|
|
229
264
|
var tsVersion = ts2.version;
|
|
230
265
|
function checkVersion(version, minVersion, maxVersion) {
|
|
@@ -236,10 +271,10 @@ function verifySupportedTypeScriptVersion() {
|
|
|
236
271
|
checkVersion(tsVersion, MIN_TS_VERSION, MAX_TS_VERSION);
|
|
237
272
|
}
|
|
238
273
|
|
|
239
|
-
// bazel-out/
|
|
240
|
-
import
|
|
274
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/compiler.mjs
|
|
275
|
+
import ts34 from "typescript";
|
|
241
276
|
|
|
242
|
-
// bazel-out/
|
|
277
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/cycles/src/analyzer.mjs
|
|
243
278
|
var CycleAnalyzer = class {
|
|
244
279
|
constructor(importGraph) {
|
|
245
280
|
this.importGraph = importGraph;
|
|
@@ -310,7 +345,7 @@ var Cycle = class {
|
|
|
310
345
|
}
|
|
311
346
|
};
|
|
312
347
|
|
|
313
|
-
// bazel-out/
|
|
348
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/cycles/src/imports.mjs
|
|
314
349
|
import ts3 from "typescript";
|
|
315
350
|
var ImportGraph = class {
|
|
316
351
|
constructor(checker, perf) {
|
|
@@ -402,8 +437,338 @@ var Found = class {
|
|
|
402
437
|
}
|
|
403
438
|
};
|
|
404
439
|
|
|
405
|
-
// bazel-out/
|
|
440
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/jsdoc_extractor.mjs
|
|
406
441
|
import ts4 from "typescript";
|
|
442
|
+
function extractJsDocTags(node) {
|
|
443
|
+
return ts4.getJSDocTags(node).map((t) => {
|
|
444
|
+
var _a;
|
|
445
|
+
return {
|
|
446
|
+
name: t.tagName.getText(),
|
|
447
|
+
comment: (_a = ts4.getTextOfJSDocComment(t.comment)) != null ? _a : ""
|
|
448
|
+
};
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
function extractJsDocDescription(node) {
|
|
452
|
+
var _a, _b;
|
|
453
|
+
const commentOrTag = ts4.getJSDocCommentsAndTags(node).find((d) => {
|
|
454
|
+
return ts4.isJSDoc(d) || ts4.isJSDocParameterTag(d);
|
|
455
|
+
});
|
|
456
|
+
const comment = (_a = commentOrTag == null ? void 0 : commentOrTag.comment) != null ? _a : "";
|
|
457
|
+
return typeof comment === "string" ? comment : (_b = ts4.getTextOfJSDocComment(comment)) != null ? _b : "";
|
|
458
|
+
}
|
|
459
|
+
function extractRawJsDoc(node) {
|
|
460
|
+
var _a, _b;
|
|
461
|
+
return (_b = (_a = ts4.getJSDocCommentsAndTags(node).find(ts4.isJSDoc)) == null ? void 0 : _a.getFullText()) != null ? _b : "";
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/type_extractor.mjs
|
|
465
|
+
function extractResolvedTypeString(node, checker) {
|
|
466
|
+
return checker.typeToString(checker.getTypeAtLocation(node));
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/enum_extractor.mjs
|
|
470
|
+
import ts5 from "typescript";
|
|
471
|
+
function extractEnum(declaration, typeChecker) {
|
|
472
|
+
return {
|
|
473
|
+
name: declaration.name.getText(),
|
|
474
|
+
entryType: EntryType.Enum,
|
|
475
|
+
members: extractEnumMembers(declaration, typeChecker),
|
|
476
|
+
rawComment: extractRawJsDoc(declaration),
|
|
477
|
+
description: extractJsDocDescription(declaration),
|
|
478
|
+
jsdocTags: extractJsDocTags(declaration)
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
function extractEnumMembers(declaration, checker) {
|
|
482
|
+
return declaration.members.map((member) => ({
|
|
483
|
+
name: member.name.getText(),
|
|
484
|
+
type: extractResolvedTypeString(member, checker),
|
|
485
|
+
value: getEnumMemberValue(member),
|
|
486
|
+
memberType: MemberType.EnumItem,
|
|
487
|
+
jsdocTags: extractJsDocTags(member),
|
|
488
|
+
description: extractJsDocDescription(member),
|
|
489
|
+
memberTags: []
|
|
490
|
+
}));
|
|
491
|
+
}
|
|
492
|
+
function getEnumMemberValue(memberNode) {
|
|
493
|
+
var _a;
|
|
494
|
+
const literal = memberNode.getChildren().find((n) => ts5.isNumericLiteral(n) || ts5.isStringLiteral(n));
|
|
495
|
+
return (_a = literal == null ? void 0 : literal.getText()) != null ? _a : "";
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/function_extractor.mjs
|
|
499
|
+
var FunctionExtractor = class {
|
|
500
|
+
constructor(declaration, typeChecker) {
|
|
501
|
+
this.declaration = declaration;
|
|
502
|
+
this.typeChecker = typeChecker;
|
|
503
|
+
}
|
|
504
|
+
extract() {
|
|
505
|
+
const signature = this.typeChecker.getSignatureFromDeclaration(this.declaration);
|
|
506
|
+
const returnType = signature ? this.typeChecker.typeToString(this.typeChecker.getReturnTypeOfSignature(signature)) : "unknown";
|
|
507
|
+
return {
|
|
508
|
+
params: this.extractAllParams(this.declaration.parameters),
|
|
509
|
+
name: this.declaration.name.getText(),
|
|
510
|
+
returnType,
|
|
511
|
+
entryType: EntryType.Function,
|
|
512
|
+
description: extractJsDocDescription(this.declaration),
|
|
513
|
+
jsdocTags: extractJsDocTags(this.declaration),
|
|
514
|
+
rawComment: extractRawJsDoc(this.declaration)
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
extractAllParams(params) {
|
|
518
|
+
return params.map((param) => ({
|
|
519
|
+
name: param.name.getText(),
|
|
520
|
+
description: extractJsDocDescription(param),
|
|
521
|
+
type: extractResolvedTypeString(param, this.typeChecker),
|
|
522
|
+
isOptional: !!(param.questionToken || param.initializer),
|
|
523
|
+
isRestParam: !!param.dotDotDotToken
|
|
524
|
+
}));
|
|
525
|
+
}
|
|
526
|
+
};
|
|
527
|
+
|
|
528
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/extractor.mjs
|
|
529
|
+
import ts7 from "typescript";
|
|
530
|
+
|
|
531
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/class_extractor.mjs
|
|
532
|
+
import ts6 from "typescript";
|
|
533
|
+
var ClassExtractor = class {
|
|
534
|
+
constructor(declaration, reference, typeChecker) {
|
|
535
|
+
this.declaration = declaration;
|
|
536
|
+
this.reference = reference;
|
|
537
|
+
this.typeChecker = typeChecker;
|
|
538
|
+
}
|
|
539
|
+
extract() {
|
|
540
|
+
return {
|
|
541
|
+
name: this.declaration.name.text,
|
|
542
|
+
entryType: EntryType.UndecoratedClass,
|
|
543
|
+
members: this.extractAllClassMembers(this.declaration),
|
|
544
|
+
description: extractJsDocDescription(this.declaration),
|
|
545
|
+
jsdocTags: extractJsDocTags(this.declaration),
|
|
546
|
+
rawComment: extractRawJsDoc(this.declaration)
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
extractAllClassMembers(classDeclaration) {
|
|
550
|
+
const members = [];
|
|
551
|
+
for (const member of classDeclaration.members) {
|
|
552
|
+
if (this.isMemberExcluded(member))
|
|
553
|
+
continue;
|
|
554
|
+
const memberEntry = this.extractClassMember(member);
|
|
555
|
+
if (memberEntry) {
|
|
556
|
+
members.push(memberEntry);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
return members;
|
|
560
|
+
}
|
|
561
|
+
extractClassMember(memberDeclaration) {
|
|
562
|
+
if (ts6.isMethodDeclaration(memberDeclaration)) {
|
|
563
|
+
return this.extractMethod(memberDeclaration);
|
|
564
|
+
} else if (ts6.isPropertyDeclaration(memberDeclaration)) {
|
|
565
|
+
return this.extractClassProperty(memberDeclaration);
|
|
566
|
+
} else if (ts6.isAccessor(memberDeclaration)) {
|
|
567
|
+
return this.extractGetterSetter(memberDeclaration);
|
|
568
|
+
}
|
|
569
|
+
return void 0;
|
|
570
|
+
}
|
|
571
|
+
extractMethod(methodDeclaration) {
|
|
572
|
+
const functionExtractor = new FunctionExtractor(methodDeclaration, this.typeChecker);
|
|
573
|
+
return {
|
|
574
|
+
...functionExtractor.extract(),
|
|
575
|
+
memberType: MemberType.Method,
|
|
576
|
+
memberTags: this.getMemberTags(methodDeclaration)
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
extractClassProperty(propertyDeclaration) {
|
|
580
|
+
return {
|
|
581
|
+
name: propertyDeclaration.name.getText(),
|
|
582
|
+
type: extractResolvedTypeString(propertyDeclaration, this.typeChecker),
|
|
583
|
+
memberType: MemberType.Property,
|
|
584
|
+
memberTags: this.getMemberTags(propertyDeclaration),
|
|
585
|
+
description: extractJsDocDescription(propertyDeclaration),
|
|
586
|
+
jsdocTags: extractJsDocTags(propertyDeclaration)
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
extractGetterSetter(accessor) {
|
|
590
|
+
return {
|
|
591
|
+
...this.extractClassProperty(accessor),
|
|
592
|
+
memberType: ts6.isGetAccessor(accessor) ? MemberType.Getter : MemberType.Setter
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
getMemberTags(member) {
|
|
596
|
+
var _a;
|
|
597
|
+
const tags = this.getMemberTagsFromModifiers((_a = member.modifiers) != null ? _a : []);
|
|
598
|
+
if (member.questionToken) {
|
|
599
|
+
tags.push(MemberTags.Optional);
|
|
600
|
+
}
|
|
601
|
+
return tags;
|
|
602
|
+
}
|
|
603
|
+
getMemberTagsFromModifiers(mods) {
|
|
604
|
+
const tags = [];
|
|
605
|
+
for (const mod of mods) {
|
|
606
|
+
const tag = this.getTagForMemberModifier(mod);
|
|
607
|
+
if (tag)
|
|
608
|
+
tags.push(tag);
|
|
609
|
+
}
|
|
610
|
+
return tags;
|
|
611
|
+
}
|
|
612
|
+
getTagForMemberModifier(mod) {
|
|
613
|
+
switch (mod.kind) {
|
|
614
|
+
case ts6.SyntaxKind.StaticKeyword:
|
|
615
|
+
return MemberTags.Static;
|
|
616
|
+
case ts6.SyntaxKind.ReadonlyKeyword:
|
|
617
|
+
return MemberTags.Readonly;
|
|
618
|
+
case ts6.SyntaxKind.ProtectedKeyword:
|
|
619
|
+
return MemberTags.Protected;
|
|
620
|
+
default:
|
|
621
|
+
return void 0;
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
isMemberExcluded(member) {
|
|
625
|
+
var _a;
|
|
626
|
+
return !member.name || !this.isDocumentableMember(member) || !!((_a = member.modifiers) == null ? void 0 : _a.some((mod) => mod.kind === ts6.SyntaxKind.PrivateKeyword));
|
|
627
|
+
}
|
|
628
|
+
isDocumentableMember(member) {
|
|
629
|
+
return ts6.isMethodDeclaration(member) || ts6.isPropertyDeclaration(member) || ts6.isAccessor(member);
|
|
630
|
+
}
|
|
631
|
+
};
|
|
632
|
+
var DirectiveExtractor = class extends ClassExtractor {
|
|
633
|
+
constructor(declaration, reference, metadata, checker) {
|
|
634
|
+
super(declaration, reference, checker);
|
|
635
|
+
this.metadata = metadata;
|
|
636
|
+
}
|
|
637
|
+
extract() {
|
|
638
|
+
var _a, _b;
|
|
639
|
+
return {
|
|
640
|
+
...super.extract(),
|
|
641
|
+
isStandalone: this.metadata.isStandalone,
|
|
642
|
+
selector: (_a = this.metadata.selector) != null ? _a : "",
|
|
643
|
+
exportAs: (_b = this.metadata.exportAs) != null ? _b : [],
|
|
644
|
+
entryType: this.metadata.isComponent ? EntryType.Component : EntryType.Directive
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
extractClassProperty(propertyDeclaration) {
|
|
648
|
+
const entry = super.extractClassProperty(propertyDeclaration);
|
|
649
|
+
const inputMetadata = this.getInputMetadata(propertyDeclaration);
|
|
650
|
+
if (inputMetadata) {
|
|
651
|
+
entry.memberTags.push(MemberTags.Input);
|
|
652
|
+
entry.inputAlias = inputMetadata.bindingPropertyName;
|
|
653
|
+
}
|
|
654
|
+
const outputMetadata = this.getOutputMetadata(propertyDeclaration);
|
|
655
|
+
if (outputMetadata) {
|
|
656
|
+
entry.memberTags.push(MemberTags.Output);
|
|
657
|
+
entry.outputAlias = outputMetadata.bindingPropertyName;
|
|
658
|
+
}
|
|
659
|
+
return entry;
|
|
660
|
+
}
|
|
661
|
+
getInputMetadata(prop) {
|
|
662
|
+
var _a, _b;
|
|
663
|
+
const propName = prop.name.getText();
|
|
664
|
+
return (_b = (_a = this.metadata.inputs) == null ? void 0 : _a.getByClassPropertyName(propName)) != null ? _b : void 0;
|
|
665
|
+
}
|
|
666
|
+
getOutputMetadata(prop) {
|
|
667
|
+
var _a, _b, _c;
|
|
668
|
+
const propName = prop.name.getText();
|
|
669
|
+
return (_c = (_b = (_a = this.metadata) == null ? void 0 : _a.outputs) == null ? void 0 : _b.getByClassPropertyName(propName)) != null ? _c : void 0;
|
|
670
|
+
}
|
|
671
|
+
};
|
|
672
|
+
var PipeExtractor = class extends ClassExtractor {
|
|
673
|
+
constructor(declaration, reference, metadata, typeChecker) {
|
|
674
|
+
super(declaration, reference, typeChecker);
|
|
675
|
+
this.metadata = metadata;
|
|
676
|
+
}
|
|
677
|
+
extract() {
|
|
678
|
+
return {
|
|
679
|
+
...super.extract(),
|
|
680
|
+
pipeName: this.metadata.name,
|
|
681
|
+
entryType: EntryType.Pipe,
|
|
682
|
+
isStandalone: this.metadata.isStandalone
|
|
683
|
+
};
|
|
684
|
+
}
|
|
685
|
+
};
|
|
686
|
+
var NgModuleExtractor = class extends ClassExtractor {
|
|
687
|
+
constructor(declaration, reference, metadata, typeChecker) {
|
|
688
|
+
super(declaration, reference, typeChecker);
|
|
689
|
+
this.metadata = metadata;
|
|
690
|
+
}
|
|
691
|
+
extract() {
|
|
692
|
+
return {
|
|
693
|
+
...super.extract(),
|
|
694
|
+
entryType: EntryType.NgModule
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
};
|
|
698
|
+
function extractClass(classDeclaration, metadataReader, typeChecker) {
|
|
699
|
+
const ref = new Reference(classDeclaration);
|
|
700
|
+
let extractor;
|
|
701
|
+
let directiveMetadata = metadataReader.getDirectiveMetadata(ref);
|
|
702
|
+
let pipeMetadata = metadataReader.getPipeMetadata(ref);
|
|
703
|
+
let ngModuleMetadata = metadataReader.getNgModuleMetadata(ref);
|
|
704
|
+
if (directiveMetadata) {
|
|
705
|
+
extractor = new DirectiveExtractor(classDeclaration, ref, directiveMetadata, typeChecker);
|
|
706
|
+
} else if (pipeMetadata) {
|
|
707
|
+
extractor = new PipeExtractor(classDeclaration, ref, pipeMetadata, typeChecker);
|
|
708
|
+
} else if (ngModuleMetadata) {
|
|
709
|
+
extractor = new NgModuleExtractor(classDeclaration, ref, ngModuleMetadata, typeChecker);
|
|
710
|
+
} else {
|
|
711
|
+
extractor = new ClassExtractor(classDeclaration, ref, typeChecker);
|
|
712
|
+
}
|
|
713
|
+
return extractor.extract();
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/constant_extractor.mjs
|
|
717
|
+
function extractConstant(declaration, typeChecker) {
|
|
718
|
+
const resolvedType = typeChecker.getBaseTypeOfLiteralType(typeChecker.getTypeAtLocation(declaration));
|
|
719
|
+
const variableStatement = declaration.parent.parent;
|
|
720
|
+
const rawComment = extractRawJsDoc(declaration.parent.parent);
|
|
721
|
+
return {
|
|
722
|
+
name: declaration.name.getText(),
|
|
723
|
+
type: typeChecker.typeToString(resolvedType),
|
|
724
|
+
entryType: EntryType.Constant,
|
|
725
|
+
rawComment,
|
|
726
|
+
description: extractJsDocDescription(declaration),
|
|
727
|
+
jsdocTags: extractJsDocTags(declaration)
|
|
728
|
+
};
|
|
729
|
+
}
|
|
730
|
+
function isSyntheticAngularConstant(declaration) {
|
|
731
|
+
return declaration.name.getText() === "USED_FOR_NG_TYPE_CHECKING";
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/extractor.mjs
|
|
735
|
+
var DocsExtractor = class {
|
|
736
|
+
constructor(typeChecker, metadataReader) {
|
|
737
|
+
this.typeChecker = typeChecker;
|
|
738
|
+
this.metadataReader = metadataReader;
|
|
739
|
+
}
|
|
740
|
+
extractAll(sourceFile) {
|
|
741
|
+
var _a;
|
|
742
|
+
const entries = [];
|
|
743
|
+
const reflector = new TypeScriptReflectionHost(this.typeChecker);
|
|
744
|
+
const exportedDeclarationMap = reflector.getExportsOfModule(sourceFile);
|
|
745
|
+
const exportedDeclarations = Array.from((_a = exportedDeclarationMap == null ? void 0 : exportedDeclarationMap.entries()) != null ? _a : []).map(([exportName, declaration]) => [exportName, declaration.node]).sort(([a, declarationA], [b, declarationB]) => declarationA.pos - declarationB.pos);
|
|
746
|
+
for (const [exportName, node] of exportedDeclarations) {
|
|
747
|
+
let entry = void 0;
|
|
748
|
+
if (isNamedClassDeclaration(node)) {
|
|
749
|
+
entry = extractClass(node, this.metadataReader, this.typeChecker);
|
|
750
|
+
}
|
|
751
|
+
if (ts7.isFunctionDeclaration(node)) {
|
|
752
|
+
const functionExtractor = new FunctionExtractor(node, this.typeChecker);
|
|
753
|
+
entry = functionExtractor.extract();
|
|
754
|
+
}
|
|
755
|
+
if (ts7.isVariableDeclaration(node) && !isSyntheticAngularConstant(node)) {
|
|
756
|
+
entry = extractConstant(node, this.typeChecker);
|
|
757
|
+
}
|
|
758
|
+
if (ts7.isEnumDeclaration(node)) {
|
|
759
|
+
entry = extractEnum(node, this.typeChecker);
|
|
760
|
+
}
|
|
761
|
+
if (entry) {
|
|
762
|
+
entry.name = exportName;
|
|
763
|
+
entries.push(entry);
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
return entries;
|
|
767
|
+
}
|
|
768
|
+
};
|
|
769
|
+
|
|
770
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/entry_point/src/generator.mjs
|
|
771
|
+
import ts8 from "typescript";
|
|
407
772
|
var FlatIndexGenerator = class {
|
|
408
773
|
constructor(entryPoint, relativeFlatIndexPath, moduleName) {
|
|
409
774
|
this.entryPoint = entryPoint;
|
|
@@ -419,7 +784,7 @@ var FlatIndexGenerator = class {
|
|
|
419
784
|
|
|
420
785
|
export * from '${relativeEntryPoint}';
|
|
421
786
|
`;
|
|
422
|
-
const genFile =
|
|
787
|
+
const genFile = ts8.createSourceFile(this.flatIndexPath, contents, ts8.ScriptTarget.ES2015, true, ts8.ScriptKind.TS);
|
|
423
788
|
if (this.moduleName !== null) {
|
|
424
789
|
genFile.moduleName = this.moduleName;
|
|
425
790
|
}
|
|
@@ -427,7 +792,7 @@ export * from '${relativeEntryPoint}';
|
|
|
427
792
|
}
|
|
428
793
|
};
|
|
429
794
|
|
|
430
|
-
// bazel-out/
|
|
795
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/entry_point/src/logic.mjs
|
|
431
796
|
function findFlatIndexEntryPoint(rootFiles) {
|
|
432
797
|
const tsFiles = rootFiles.filter((file) => isNonDeclarationTsPath(file));
|
|
433
798
|
let resolvedEntryPoint = null;
|
|
@@ -443,8 +808,8 @@ function findFlatIndexEntryPoint(rootFiles) {
|
|
|
443
808
|
return resolvedEntryPoint;
|
|
444
809
|
}
|
|
445
810
|
|
|
446
|
-
// bazel-out/
|
|
447
|
-
import
|
|
811
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/entry_point/src/private_export_checker.mjs
|
|
812
|
+
import ts9 from "typescript";
|
|
448
813
|
function checkForPrivateExports(entryPoint, checker, refGraph) {
|
|
449
814
|
const diagnostics = [];
|
|
450
815
|
const topLevelExports = /* @__PURE__ */ new Set();
|
|
@@ -454,7 +819,7 @@ function checkForPrivateExports(entryPoint, checker, refGraph) {
|
|
|
454
819
|
}
|
|
455
820
|
const exportedSymbols = checker.getExportsOfModule(moduleSymbol);
|
|
456
821
|
exportedSymbols.forEach((symbol) => {
|
|
457
|
-
if (symbol.flags &
|
|
822
|
+
if (symbol.flags & ts9.SymbolFlags.Alias) {
|
|
458
823
|
symbol = checker.getAliasedSymbol(symbol);
|
|
459
824
|
}
|
|
460
825
|
const decl = symbol.valueDeclaration;
|
|
@@ -478,7 +843,7 @@ function checkForPrivateExports(entryPoint, checker, refGraph) {
|
|
|
478
843
|
visibleVia = transitivePath.map((seg) => getNameOfDeclaration(seg)).join(" -> ");
|
|
479
844
|
}
|
|
480
845
|
const diagnostic = {
|
|
481
|
-
category:
|
|
846
|
+
category: ts9.DiagnosticCategory.Error,
|
|
482
847
|
code: ngErrorCode(ErrorCode.SYMBOL_NOT_EXPORTED),
|
|
483
848
|
file: transitiveReference.getSourceFile(),
|
|
484
849
|
...getPosOfDeclaration(transitiveReference),
|
|
@@ -498,7 +863,7 @@ function getPosOfDeclaration(decl) {
|
|
|
498
863
|
};
|
|
499
864
|
}
|
|
500
865
|
function getIdentifierOfDeclaration(decl) {
|
|
501
|
-
if ((
|
|
866
|
+
if ((ts9.isClassDeclaration(decl) || ts9.isVariableDeclaration(decl) || ts9.isFunctionDeclaration(decl)) && decl.name !== void 0 && ts9.isIdentifier(decl.name)) {
|
|
502
867
|
return decl.name;
|
|
503
868
|
} else {
|
|
504
869
|
return null;
|
|
@@ -510,20 +875,20 @@ function getNameOfDeclaration(decl) {
|
|
|
510
875
|
}
|
|
511
876
|
function getDescriptorOfDeclaration(decl) {
|
|
512
877
|
switch (decl.kind) {
|
|
513
|
-
case
|
|
878
|
+
case ts9.SyntaxKind.ClassDeclaration:
|
|
514
879
|
return "class";
|
|
515
|
-
case
|
|
880
|
+
case ts9.SyntaxKind.FunctionDeclaration:
|
|
516
881
|
return "function";
|
|
517
|
-
case
|
|
882
|
+
case ts9.SyntaxKind.VariableDeclaration:
|
|
518
883
|
return "variable";
|
|
519
|
-
case
|
|
884
|
+
case ts9.SyntaxKind.EnumDeclaration:
|
|
520
885
|
return "enum";
|
|
521
886
|
default:
|
|
522
887
|
return "declaration";
|
|
523
888
|
}
|
|
524
889
|
}
|
|
525
890
|
|
|
526
|
-
// bazel-out/
|
|
891
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/entry_point/src/reference_graph.mjs
|
|
527
892
|
var ReferenceGraph = class {
|
|
528
893
|
constructor() {
|
|
529
894
|
this.references = /* @__PURE__ */ new Map();
|
|
@@ -577,7 +942,7 @@ var ReferenceGraph = class {
|
|
|
577
942
|
}
|
|
578
943
|
};
|
|
579
944
|
|
|
580
|
-
// bazel-out/
|
|
945
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/program_driver/src/api.mjs
|
|
581
946
|
var NgOriginalFile = Symbol("NgOriginalFile");
|
|
582
947
|
var UpdateMode;
|
|
583
948
|
(function(UpdateMode2) {
|
|
@@ -585,13 +950,13 @@ var UpdateMode;
|
|
|
585
950
|
UpdateMode2[UpdateMode2["Incremental"] = 1] = "Incremental";
|
|
586
951
|
})(UpdateMode || (UpdateMode = {}));
|
|
587
952
|
|
|
588
|
-
// bazel-out/
|
|
589
|
-
import
|
|
953
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/program_driver/src/ts_create_program_driver.mjs
|
|
954
|
+
import ts11 from "typescript";
|
|
590
955
|
|
|
591
|
-
// bazel-out/
|
|
592
|
-
import
|
|
956
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/adapter.mjs
|
|
957
|
+
import ts10 from "typescript";
|
|
593
958
|
|
|
594
|
-
// bazel-out/
|
|
959
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/expando.mjs
|
|
595
960
|
var NgExtension = Symbol("NgExtension");
|
|
596
961
|
function isExtended(sf) {
|
|
597
962
|
return sf[NgExtension] !== void 0;
|
|
@@ -651,13 +1016,13 @@ function retagTsFile(sf) {
|
|
|
651
1016
|
}
|
|
652
1017
|
}
|
|
653
1018
|
|
|
654
|
-
// bazel-out/
|
|
1019
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/util.mjs
|
|
655
1020
|
var TS_EXTENSIONS = /\.tsx?$/i;
|
|
656
1021
|
function makeShimFileName(fileName, suffix) {
|
|
657
1022
|
return absoluteFrom(fileName.replace(TS_EXTENSIONS, suffix));
|
|
658
1023
|
}
|
|
659
1024
|
|
|
660
|
-
// bazel-out/
|
|
1025
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/adapter.mjs
|
|
661
1026
|
var ShimAdapter = class {
|
|
662
1027
|
constructor(delegate, tsRootFiles, topLevelGenerators, perFileGenerators, oldProgram) {
|
|
663
1028
|
this.delegate = delegate;
|
|
@@ -720,10 +1085,10 @@ var ShimAdapter = class {
|
|
|
720
1085
|
}
|
|
721
1086
|
const prefix = match[1];
|
|
722
1087
|
let baseFileName = absoluteFrom(prefix + ".ts");
|
|
723
|
-
let inputFile = this.delegate.getSourceFile(baseFileName,
|
|
1088
|
+
let inputFile = this.delegate.getSourceFile(baseFileName, ts10.ScriptTarget.Latest);
|
|
724
1089
|
if (inputFile === void 0) {
|
|
725
1090
|
baseFileName = absoluteFrom(prefix + ".tsx");
|
|
726
|
-
inputFile = this.delegate.getSourceFile(baseFileName,
|
|
1091
|
+
inputFile = this.delegate.getSourceFile(baseFileName, ts10.ScriptTarget.Latest);
|
|
727
1092
|
}
|
|
728
1093
|
if (inputFile === void 0 || isShim(inputFile)) {
|
|
729
1094
|
return void 0;
|
|
@@ -752,7 +1117,7 @@ var ShimAdapter = class {
|
|
|
752
1117
|
}
|
|
753
1118
|
};
|
|
754
1119
|
|
|
755
|
-
// bazel-out/
|
|
1120
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/reference_tagger.mjs
|
|
756
1121
|
var ShimReferenceTagger = class {
|
|
757
1122
|
constructor(shimExtensions) {
|
|
758
1123
|
this.tagged = /* @__PURE__ */ new Set();
|
|
@@ -786,7 +1151,7 @@ var ShimReferenceTagger = class {
|
|
|
786
1151
|
}
|
|
787
1152
|
};
|
|
788
1153
|
|
|
789
|
-
// bazel-out/
|
|
1154
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/program_driver/src/ts_create_program_driver.mjs
|
|
790
1155
|
var DelegatingCompilerHost = class {
|
|
791
1156
|
constructor(delegate) {
|
|
792
1157
|
this.delegate = delegate;
|
|
@@ -878,7 +1243,7 @@ var TsCreateProgramDriver = class {
|
|
|
878
1243
|
this.sfMap.clear();
|
|
879
1244
|
}
|
|
880
1245
|
for (const [filePath, { newText, originalFile }] of contents.entries()) {
|
|
881
|
-
const sf =
|
|
1246
|
+
const sf = ts11.createSourceFile(filePath, newText, ts11.ScriptTarget.Latest, true);
|
|
882
1247
|
if (originalFile !== null) {
|
|
883
1248
|
sf[NgOriginalFile] = originalFile;
|
|
884
1249
|
}
|
|
@@ -887,7 +1252,7 @@ var TsCreateProgramDriver = class {
|
|
|
887
1252
|
const host = new UpdatedProgramHost(this.sfMap, this.originalProgram, this.originalHost, this.shimExtensionPrefixes);
|
|
888
1253
|
const oldProgram = this.program;
|
|
889
1254
|
retagAllTsFiles(oldProgram);
|
|
890
|
-
this.program =
|
|
1255
|
+
this.program = ts11.createProgram({
|
|
891
1256
|
host,
|
|
892
1257
|
rootNames: this.program.getRootFileNames(),
|
|
893
1258
|
options: this.options,
|
|
@@ -899,7 +1264,7 @@ var TsCreateProgramDriver = class {
|
|
|
899
1264
|
}
|
|
900
1265
|
};
|
|
901
1266
|
|
|
902
|
-
// bazel-out/
|
|
1267
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/src/dependency_tracking.mjs
|
|
903
1268
|
var FileDependencyGraph = class {
|
|
904
1269
|
constructor() {
|
|
905
1270
|
this.nodes = /* @__PURE__ */ new Map();
|
|
@@ -966,7 +1331,7 @@ function isLogicallyChanged(sf, node, changedTsPaths, deletedTsPaths, changedRes
|
|
|
966
1331
|
return false;
|
|
967
1332
|
}
|
|
968
1333
|
|
|
969
|
-
// bazel-out/
|
|
1334
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/src/state.mjs
|
|
970
1335
|
var IncrementalStateKind;
|
|
971
1336
|
(function(IncrementalStateKind2) {
|
|
972
1337
|
IncrementalStateKind2[IncrementalStateKind2["Fresh"] = 0] = "Fresh";
|
|
@@ -974,7 +1339,7 @@ var IncrementalStateKind;
|
|
|
974
1339
|
IncrementalStateKind2[IncrementalStateKind2["Analyzed"] = 2] = "Analyzed";
|
|
975
1340
|
})(IncrementalStateKind || (IncrementalStateKind = {}));
|
|
976
1341
|
|
|
977
|
-
// bazel-out/
|
|
1342
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/src/incremental.mjs
|
|
978
1343
|
var PhaseKind;
|
|
979
1344
|
(function(PhaseKind2) {
|
|
980
1345
|
PhaseKind2[PhaseKind2["Analysis"] = 0] = "Analysis";
|
|
@@ -1175,7 +1540,7 @@ function toOriginalSourceFile(sf) {
|
|
|
1175
1540
|
}
|
|
1176
1541
|
}
|
|
1177
1542
|
|
|
1178
|
-
// bazel-out/
|
|
1543
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/src/strategy.mjs
|
|
1179
1544
|
var TrackedIncrementalBuildStrategy = class {
|
|
1180
1545
|
constructor() {
|
|
1181
1546
|
this.state = null;
|
|
@@ -1211,7 +1576,7 @@ var PatchedProgramIncrementalBuildStrategy = class {
|
|
|
1211
1576
|
};
|
|
1212
1577
|
var SYM_INCREMENTAL_STATE = Symbol("NgIncrementalState");
|
|
1213
1578
|
|
|
1214
|
-
// bazel-out/
|
|
1579
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/indexer/src/api.mjs
|
|
1215
1580
|
var IdentifierKind;
|
|
1216
1581
|
(function(IdentifierKind2) {
|
|
1217
1582
|
IdentifierKind2[IdentifierKind2["Property"] = 0] = "Property";
|
|
@@ -1229,7 +1594,7 @@ var AbsoluteSourceSpan = class {
|
|
|
1229
1594
|
}
|
|
1230
1595
|
};
|
|
1231
1596
|
|
|
1232
|
-
// bazel-out/
|
|
1597
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/indexer/src/context.mjs
|
|
1233
1598
|
var IndexingContext = class {
|
|
1234
1599
|
constructor() {
|
|
1235
1600
|
this.components = /* @__PURE__ */ new Set();
|
|
@@ -1239,10 +1604,10 @@ var IndexingContext = class {
|
|
|
1239
1604
|
}
|
|
1240
1605
|
};
|
|
1241
1606
|
|
|
1242
|
-
// bazel-out/
|
|
1607
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/indexer/src/transform.mjs
|
|
1243
1608
|
import { ParseSourceFile } from "@angular/compiler";
|
|
1244
1609
|
|
|
1245
|
-
// bazel-out/
|
|
1610
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/indexer/src/template.mjs
|
|
1246
1611
|
import { ASTWithSource, ImplicitReceiver, PropertyRead, PropertyWrite, RecursiveAstVisitor, TmplAstBoundDeferredTrigger, TmplAstElement, TmplAstRecursiveVisitor, TmplAstReference, TmplAstTemplate } from "@angular/compiler";
|
|
1247
1612
|
var ExpressionVisitor = class extends RecursiveAstVisitor {
|
|
1248
1613
|
constructor(expressionStr, absoluteOffset, boundTemplate, targetToIdentifier) {
|
|
@@ -1387,6 +1752,8 @@ var TemplateVisitor = class extends TmplAstRecursiveVisitor {
|
|
|
1387
1752
|
}
|
|
1388
1753
|
visitForLoopBlock(block) {
|
|
1389
1754
|
var _a;
|
|
1755
|
+
block.item.visit(this);
|
|
1756
|
+
this.visitAll(Object.values(block.contextVariables));
|
|
1390
1757
|
this.visitExpression(block.expression);
|
|
1391
1758
|
this.visitAll(block.children);
|
|
1392
1759
|
(_a = block.empty) == null ? void 0 : _a.visit(this);
|
|
@@ -1398,7 +1765,9 @@ var TemplateVisitor = class extends TmplAstRecursiveVisitor {
|
|
|
1398
1765
|
this.visitAll(block.branches);
|
|
1399
1766
|
}
|
|
1400
1767
|
visitIfBlockBranch(block) {
|
|
1768
|
+
var _a;
|
|
1401
1769
|
block.expression && this.visitExpression(block.expression);
|
|
1770
|
+
(_a = block.expressionAlias) == null ? void 0 : _a.visit(this);
|
|
1402
1771
|
this.visitAll(block.children);
|
|
1403
1772
|
}
|
|
1404
1773
|
elementOrTemplateToIdentifier(node) {
|
|
@@ -1520,7 +1889,7 @@ function getTemplateIdentifiers(boundTemplate) {
|
|
|
1520
1889
|
return { identifiers: visitor.identifiers, errors: visitor.errors };
|
|
1521
1890
|
}
|
|
1522
1891
|
|
|
1523
|
-
// bazel-out/
|
|
1892
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/indexer/src/transform.mjs
|
|
1524
1893
|
function generateAnalysis(context) {
|
|
1525
1894
|
const analysis = /* @__PURE__ */ new Map();
|
|
1526
1895
|
context.components.forEach(({ declaration, selector, boundTemplate, templateMeta }) => {
|
|
@@ -1556,7 +1925,7 @@ function generateAnalysis(context) {
|
|
|
1556
1925
|
return analysis;
|
|
1557
1926
|
}
|
|
1558
1927
|
|
|
1559
|
-
// bazel-out/
|
|
1928
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/ng_module_index.mjs
|
|
1560
1929
|
var NgModuleIndexImpl = class {
|
|
1561
1930
|
constructor(metaReader, localReader) {
|
|
1562
1931
|
this.metaReader = metaReader;
|
|
@@ -1645,8 +2014,8 @@ var NgModuleIndexImpl = class {
|
|
|
1645
2014
|
}
|
|
1646
2015
|
};
|
|
1647
2016
|
|
|
1648
|
-
// bazel-out/
|
|
1649
|
-
import
|
|
2017
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/resource/src/loader.mjs
|
|
2018
|
+
import ts12 from "typescript";
|
|
1650
2019
|
var CSS_PREPROCESSOR_EXT = /(\.scss|\.sass|\.less|\.styl)$/;
|
|
1651
2020
|
var RESOURCE_MARKER = ".$ngresource$";
|
|
1652
2021
|
var RESOURCE_MARKER_TS = RESOURCE_MARKER + ".ts";
|
|
@@ -1756,7 +2125,7 @@ var AdapterResourceLoader = class {
|
|
|
1756
2125
|
return this.adapter.rootDirs.map((rootDir) => join(rootDir, segment));
|
|
1757
2126
|
}
|
|
1758
2127
|
getResolvedCandidateLocations(url, fromFile) {
|
|
1759
|
-
const failedLookup =
|
|
2128
|
+
const failedLookup = ts12.resolveModuleName(url + RESOURCE_MARKER, fromFile, this.options, this.lookupResolutionHost);
|
|
1760
2129
|
if (failedLookup.failedLookupLocations === void 0) {
|
|
1761
2130
|
throw new Error(`Internal error: expected to find failedLookupLocations during resolution of resource '${url}' in context of ${fromFile}`);
|
|
1762
2131
|
}
|
|
@@ -1791,7 +2160,7 @@ function createLookupResolutionHost(adapter) {
|
|
|
1791
2160
|
};
|
|
1792
2161
|
}
|
|
1793
2162
|
|
|
1794
|
-
// bazel-out/
|
|
2163
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/standalone.mjs
|
|
1795
2164
|
var StandaloneComponentScopeReader = class {
|
|
1796
2165
|
constructor(metaReader, localModuleReader, dtsModuleReader) {
|
|
1797
2166
|
this.metaReader = metaReader;
|
|
@@ -1869,11 +2238,11 @@ var StandaloneComponentScopeReader = class {
|
|
|
1869
2238
|
}
|
|
1870
2239
|
};
|
|
1871
2240
|
|
|
1872
|
-
// bazel-out/
|
|
2241
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/checker.mjs
|
|
1873
2242
|
import { CssSelector, DomElementSchemaRegistry as DomElementSchemaRegistry2, ExternalExpr as ExternalExpr2, WrappedNodeExpr } from "@angular/compiler";
|
|
1874
2243
|
|
|
1875
|
-
// bazel-out/
|
|
1876
|
-
import
|
|
2244
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/diagnostics/src/diagnostic.mjs
|
|
2245
|
+
import ts13 from "typescript";
|
|
1877
2246
|
function makeTemplateDiagnostic(templateId, mapping, span, category, code, messageText, relatedMessages) {
|
|
1878
2247
|
var _a;
|
|
1879
2248
|
if (mapping.type === "direct") {
|
|
@@ -1882,7 +2251,7 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
1882
2251
|
relatedInformation = [];
|
|
1883
2252
|
for (const relatedMessage of relatedMessages) {
|
|
1884
2253
|
relatedInformation.push({
|
|
1885
|
-
category:
|
|
2254
|
+
category: ts13.DiagnosticCategory.Message,
|
|
1886
2255
|
code: 0,
|
|
1887
2256
|
file: relatedMessage.sourceFile,
|
|
1888
2257
|
start: relatedMessage.start,
|
|
@@ -1911,7 +2280,7 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
1911
2280
|
if (relatedMessages !== void 0) {
|
|
1912
2281
|
for (const relatedMessage of relatedMessages) {
|
|
1913
2282
|
relatedInformation.push({
|
|
1914
|
-
category:
|
|
2283
|
+
category: ts13.DiagnosticCategory.Message,
|
|
1915
2284
|
code: 0,
|
|
1916
2285
|
file: relatedMessage.sourceFile,
|
|
1917
2286
|
start: relatedMessage.start,
|
|
@@ -1941,7 +2310,7 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
1941
2310
|
};
|
|
1942
2311
|
}
|
|
1943
2312
|
relatedInformation.push({
|
|
1944
|
-
category:
|
|
2313
|
+
category: ts13.DiagnosticCategory.Message,
|
|
1945
2314
|
code: 0,
|
|
1946
2315
|
file: componentSf,
|
|
1947
2316
|
start: mapping.node.getStart(),
|
|
@@ -1976,10 +2345,10 @@ function parseTemplateAsSourceFile(fileName, template) {
|
|
|
1976
2345
|
if (parseTemplateAsSourceFileForTest !== null) {
|
|
1977
2346
|
return parseTemplateAsSourceFileForTest(fileName, template);
|
|
1978
2347
|
}
|
|
1979
|
-
return
|
|
2348
|
+
return ts13.createSourceFile(fileName, template, ts13.ScriptTarget.Latest, false, ts13.ScriptKind.JSX);
|
|
1980
2349
|
}
|
|
1981
2350
|
|
|
1982
|
-
// bazel-out/
|
|
2351
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/diagnostics/src/id.mjs
|
|
1983
2352
|
var TEMPLATE_ID = Symbol("ngTemplateId");
|
|
1984
2353
|
var NEXT_TEMPLATE_ID = Symbol("ngNextTemplateId");
|
|
1985
2354
|
function getTemplateId(clazz) {
|
|
@@ -1996,17 +2365,17 @@ function allocateTemplateId(sf) {
|
|
|
1996
2365
|
return `tcb${sf[NEXT_TEMPLATE_ID]++}`;
|
|
1997
2366
|
}
|
|
1998
2367
|
|
|
1999
|
-
// bazel-out/
|
|
2368
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/completion.mjs
|
|
2000
2369
|
import { EmptyExpr, ImplicitReceiver as ImplicitReceiver2, PropertyRead as PropertyRead2, PropertyWrite as PropertyWrite2, SafePropertyRead, TmplAstReference as TmplAstReference2, TmplAstTextAttribute } from "@angular/compiler";
|
|
2001
|
-
import
|
|
2370
|
+
import ts15 from "typescript";
|
|
2002
2371
|
|
|
2003
|
-
// bazel-out/
|
|
2372
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/comments.mjs
|
|
2004
2373
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan2 } from "@angular/compiler";
|
|
2005
|
-
import
|
|
2374
|
+
import ts14 from "typescript";
|
|
2006
2375
|
var parseSpanComment = /^(\d+),(\d+)$/;
|
|
2007
2376
|
function readSpanComment(node, sourceFile = node.getSourceFile()) {
|
|
2008
|
-
return
|
|
2009
|
-
if (kind !==
|
|
2377
|
+
return ts14.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
2378
|
+
if (kind !== ts14.SyntaxKind.MultiLineCommentTrivia) {
|
|
2010
2379
|
return null;
|
|
2011
2380
|
}
|
|
2012
2381
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -2029,25 +2398,25 @@ var ExpressionIdentifier;
|
|
|
2029
2398
|
ExpressionIdentifier2["EVENT_PARAMETER"] = "EP";
|
|
2030
2399
|
})(ExpressionIdentifier || (ExpressionIdentifier = {}));
|
|
2031
2400
|
function addExpressionIdentifier(node, identifier) {
|
|
2032
|
-
|
|
2401
|
+
ts14.addSyntheticTrailingComment(
|
|
2033
2402
|
node,
|
|
2034
|
-
|
|
2403
|
+
ts14.SyntaxKind.MultiLineCommentTrivia,
|
|
2035
2404
|
`${CommentTriviaType.EXPRESSION_TYPE_IDENTIFIER}:${identifier}`,
|
|
2036
2405
|
false
|
|
2037
2406
|
);
|
|
2038
2407
|
}
|
|
2039
2408
|
var IGNORE_FOR_DIAGNOSTICS_MARKER = `${CommentTriviaType.DIAGNOSTIC}:ignore`;
|
|
2040
2409
|
function markIgnoreDiagnostics(node) {
|
|
2041
|
-
|
|
2410
|
+
ts14.addSyntheticTrailingComment(
|
|
2042
2411
|
node,
|
|
2043
|
-
|
|
2412
|
+
ts14.SyntaxKind.MultiLineCommentTrivia,
|
|
2044
2413
|
IGNORE_FOR_DIAGNOSTICS_MARKER,
|
|
2045
2414
|
false
|
|
2046
2415
|
);
|
|
2047
2416
|
}
|
|
2048
2417
|
function hasIgnoreForDiagnosticsMarker(node, sourceFile) {
|
|
2049
|
-
return
|
|
2050
|
-
if (kind !==
|
|
2418
|
+
return ts14.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
2419
|
+
if (kind !== ts14.SyntaxKind.MultiLineCommentTrivia) {
|
|
2051
2420
|
return null;
|
|
2052
2421
|
}
|
|
2053
2422
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -2121,8 +2490,8 @@ function findAllMatchingNodes(tcb, opts) {
|
|
|
2121
2490
|
return results;
|
|
2122
2491
|
}
|
|
2123
2492
|
function hasExpressionIdentifier(sourceFile, node, identifier) {
|
|
2124
|
-
return
|
|
2125
|
-
if (kind !==
|
|
2493
|
+
return ts14.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
2494
|
+
if (kind !== ts14.SyntaxKind.MultiLineCommentTrivia) {
|
|
2126
2495
|
return false;
|
|
2127
2496
|
}
|
|
2128
2497
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -2130,7 +2499,7 @@ function hasExpressionIdentifier(sourceFile, node, identifier) {
|
|
|
2130
2499
|
}) || false;
|
|
2131
2500
|
}
|
|
2132
2501
|
|
|
2133
|
-
// bazel-out/
|
|
2502
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/completion.mjs
|
|
2134
2503
|
var CompletionEngine = class {
|
|
2135
2504
|
constructor(tcb, data, tcbPath, tcbIsShim) {
|
|
2136
2505
|
this.tcb = tcb;
|
|
@@ -2140,7 +2509,7 @@ var CompletionEngine = class {
|
|
|
2140
2509
|
this.templateContextCache = /* @__PURE__ */ new Map();
|
|
2141
2510
|
this.expressionCompletionCache = /* @__PURE__ */ new Map();
|
|
2142
2511
|
const globalRead = findFirstMatchingNode(this.tcb, {
|
|
2143
|
-
filter:
|
|
2512
|
+
filter: ts15.isPropertyAccessExpression,
|
|
2144
2513
|
withExpressionIdentifier: ExpressionIdentifier.COMPONENT_COMPLETION
|
|
2145
2514
|
});
|
|
2146
2515
|
if (globalRead !== null) {
|
|
@@ -2164,7 +2533,7 @@ var CompletionEngine = class {
|
|
|
2164
2533
|
let nodeContext = null;
|
|
2165
2534
|
if (node instanceof EmptyExpr) {
|
|
2166
2535
|
const nodeLocation = findFirstMatchingNode(this.tcb, {
|
|
2167
|
-
filter:
|
|
2536
|
+
filter: ts15.isIdentifier,
|
|
2168
2537
|
withSpan: node.sourceSpan
|
|
2169
2538
|
});
|
|
2170
2539
|
if (nodeLocation !== null) {
|
|
@@ -2177,7 +2546,7 @@ var CompletionEngine = class {
|
|
|
2177
2546
|
}
|
|
2178
2547
|
if (node instanceof PropertyRead2 && node.receiver instanceof ImplicitReceiver2) {
|
|
2179
2548
|
const nodeLocation = findFirstMatchingNode(this.tcb, {
|
|
2180
|
-
filter:
|
|
2549
|
+
filter: ts15.isPropertyAccessExpression,
|
|
2181
2550
|
withSpan: node.sourceSpan
|
|
2182
2551
|
});
|
|
2183
2552
|
if (nodeLocation) {
|
|
@@ -2201,21 +2570,21 @@ var CompletionEngine = class {
|
|
|
2201
2570
|
let tsExpr = null;
|
|
2202
2571
|
if (expr instanceof PropertyRead2 || expr instanceof PropertyWrite2) {
|
|
2203
2572
|
tsExpr = findFirstMatchingNode(this.tcb, {
|
|
2204
|
-
filter:
|
|
2573
|
+
filter: ts15.isPropertyAccessExpression,
|
|
2205
2574
|
withSpan: expr.nameSpan
|
|
2206
2575
|
});
|
|
2207
2576
|
} else if (expr instanceof SafePropertyRead) {
|
|
2208
2577
|
const ternaryExpr = findFirstMatchingNode(this.tcb, {
|
|
2209
|
-
filter:
|
|
2578
|
+
filter: ts15.isParenthesizedExpression,
|
|
2210
2579
|
withSpan: expr.sourceSpan
|
|
2211
2580
|
});
|
|
2212
|
-
if (ternaryExpr === null || !
|
|
2581
|
+
if (ternaryExpr === null || !ts15.isConditionalExpression(ternaryExpr.expression)) {
|
|
2213
2582
|
return null;
|
|
2214
2583
|
}
|
|
2215
2584
|
const whenTrue = ternaryExpr.expression.whenTrue;
|
|
2216
|
-
if (
|
|
2585
|
+
if (ts15.isPropertyAccessExpression(whenTrue)) {
|
|
2217
2586
|
tsExpr = whenTrue;
|
|
2218
|
-
} else if (
|
|
2587
|
+
} else if (ts15.isCallExpression(whenTrue) && ts15.isPropertyAccessExpression(whenTrue.expression)) {
|
|
2219
2588
|
tsExpr = whenTrue.expression;
|
|
2220
2589
|
}
|
|
2221
2590
|
}
|
|
@@ -2237,15 +2606,15 @@ var CompletionEngine = class {
|
|
|
2237
2606
|
let tsExpr = null;
|
|
2238
2607
|
if (expr instanceof TmplAstTextAttribute) {
|
|
2239
2608
|
const strNode = findFirstMatchingNode(this.tcb, {
|
|
2240
|
-
filter:
|
|
2609
|
+
filter: ts15.isParenthesizedExpression,
|
|
2241
2610
|
withSpan: expr.sourceSpan
|
|
2242
2611
|
});
|
|
2243
|
-
if (strNode !== null &&
|
|
2612
|
+
if (strNode !== null && ts15.isStringLiteral(strNode.expression)) {
|
|
2244
2613
|
tsExpr = strNode.expression;
|
|
2245
2614
|
}
|
|
2246
2615
|
} else {
|
|
2247
2616
|
tsExpr = findFirstMatchingNode(this.tcb, {
|
|
2248
|
-
filter: (n) =>
|
|
2617
|
+
filter: (n) => ts15.isStringLiteral(n) || ts15.isNumericLiteral(n),
|
|
2249
2618
|
withSpan: expr.sourceSpan
|
|
2250
2619
|
});
|
|
2251
2620
|
}
|
|
@@ -2253,7 +2622,7 @@ var CompletionEngine = class {
|
|
|
2253
2622
|
return null;
|
|
2254
2623
|
}
|
|
2255
2624
|
let positionInShimFile = tsExpr.getEnd();
|
|
2256
|
-
if (
|
|
2625
|
+
if (ts15.isStringLiteral(tsExpr)) {
|
|
2257
2626
|
positionInShimFile -= 1;
|
|
2258
2627
|
}
|
|
2259
2628
|
const res = {
|
|
@@ -2269,7 +2638,7 @@ var CompletionEngine = class {
|
|
|
2269
2638
|
return this.templateContextCache.get(context);
|
|
2270
2639
|
}
|
|
2271
2640
|
const templateContext = /* @__PURE__ */ new Map();
|
|
2272
|
-
for (const node of this.data.boundTarget.
|
|
2641
|
+
for (const node of this.data.boundTarget.getEntitiesInScope(context)) {
|
|
2273
2642
|
if (node instanceof TmplAstReference2) {
|
|
2274
2643
|
templateContext.set(node.name, {
|
|
2275
2644
|
kind: CompletionKind.Reference,
|
|
@@ -2287,12 +2656,12 @@ var CompletionEngine = class {
|
|
|
2287
2656
|
}
|
|
2288
2657
|
};
|
|
2289
2658
|
|
|
2290
|
-
// bazel-out/
|
|
2291
|
-
import
|
|
2659
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/context.mjs
|
|
2660
|
+
import ts29 from "typescript";
|
|
2292
2661
|
|
|
2293
|
-
// bazel-out/
|
|
2662
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/dom.mjs
|
|
2294
2663
|
import { DomElementSchemaRegistry } from "@angular/compiler";
|
|
2295
|
-
import
|
|
2664
|
+
import ts16 from "typescript";
|
|
2296
2665
|
var REGISTRY = new DomElementSchemaRegistry();
|
|
2297
2666
|
var REMOVE_XHTML_REGEX = /^:xhtml:/;
|
|
2298
2667
|
var RegistryDomSchemaChecker = class {
|
|
@@ -2317,7 +2686,7 @@ var RegistryDomSchemaChecker = class {
|
|
|
2317
2686
|
} else {
|
|
2318
2687
|
errorMsg += `2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas2} of this component.`;
|
|
2319
2688
|
}
|
|
2320
|
-
const diag = makeTemplateDiagnostic(id, mapping, element.startSourceSpan,
|
|
2689
|
+
const diag = makeTemplateDiagnostic(id, mapping, element.startSourceSpan, ts16.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ELEMENT), errorMsg);
|
|
2321
2690
|
this._diagnostics.push(diag);
|
|
2322
2691
|
}
|
|
2323
2692
|
}
|
|
@@ -2337,101 +2706,101 @@ var RegistryDomSchemaChecker = class {
|
|
|
2337
2706
|
2. If '${element.name}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas2} of this component to suppress this message.
|
|
2338
2707
|
3. To allow any property add 'NO_ERRORS_SCHEMA' to the ${schemas2} of this component.`;
|
|
2339
2708
|
}
|
|
2340
|
-
const diag = makeTemplateDiagnostic(id, mapping, span,
|
|
2709
|
+
const diag = makeTemplateDiagnostic(id, mapping, span, ts16.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ATTRIBUTE), errorMsg);
|
|
2341
2710
|
this._diagnostics.push(diag);
|
|
2342
2711
|
}
|
|
2343
2712
|
}
|
|
2344
2713
|
};
|
|
2345
2714
|
|
|
2346
|
-
// bazel-out/
|
|
2715
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/environment.mjs
|
|
2347
2716
|
import { ExpressionType, ExternalExpr, TypeModifier } from "@angular/compiler";
|
|
2348
|
-
import
|
|
2717
|
+
import ts22 from "typescript";
|
|
2349
2718
|
|
|
2350
|
-
// bazel-out/
|
|
2351
|
-
import
|
|
2719
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/ts_util.mjs
|
|
2720
|
+
import ts17 from "typescript";
|
|
2352
2721
|
var SAFE_TO_CAST_WITHOUT_PARENS = /* @__PURE__ */ new Set([
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2722
|
+
ts17.SyntaxKind.ParenthesizedExpression,
|
|
2723
|
+
ts17.SyntaxKind.Identifier,
|
|
2724
|
+
ts17.SyntaxKind.CallExpression,
|
|
2725
|
+
ts17.SyntaxKind.NonNullExpression,
|
|
2726
|
+
ts17.SyntaxKind.ElementAccessExpression,
|
|
2727
|
+
ts17.SyntaxKind.PropertyAccessExpression,
|
|
2728
|
+
ts17.SyntaxKind.ArrayLiteralExpression,
|
|
2729
|
+
ts17.SyntaxKind.ObjectLiteralExpression,
|
|
2730
|
+
ts17.SyntaxKind.StringLiteral,
|
|
2731
|
+
ts17.SyntaxKind.NumericLiteral,
|
|
2732
|
+
ts17.SyntaxKind.TrueKeyword,
|
|
2733
|
+
ts17.SyntaxKind.FalseKeyword,
|
|
2734
|
+
ts17.SyntaxKind.NullKeyword,
|
|
2735
|
+
ts17.SyntaxKind.UndefinedKeyword
|
|
2367
2736
|
]);
|
|
2368
2737
|
function tsCastToAny(expr) {
|
|
2369
2738
|
if (!SAFE_TO_CAST_WITHOUT_PARENS.has(expr.kind)) {
|
|
2370
|
-
expr =
|
|
2739
|
+
expr = ts17.factory.createParenthesizedExpression(expr);
|
|
2371
2740
|
}
|
|
2372
|
-
return
|
|
2741
|
+
return ts17.factory.createParenthesizedExpression(ts17.factory.createAsExpression(expr, ts17.factory.createKeywordTypeNode(ts17.SyntaxKind.AnyKeyword)));
|
|
2373
2742
|
}
|
|
2374
2743
|
function tsCreateElement(tagName) {
|
|
2375
|
-
const createElement =
|
|
2376
|
-
|
|
2744
|
+
const createElement = ts17.factory.createPropertyAccessExpression(
|
|
2745
|
+
ts17.factory.createIdentifier("document"),
|
|
2377
2746
|
"createElement"
|
|
2378
2747
|
);
|
|
2379
|
-
return
|
|
2748
|
+
return ts17.factory.createCallExpression(
|
|
2380
2749
|
createElement,
|
|
2381
2750
|
void 0,
|
|
2382
|
-
[
|
|
2751
|
+
[ts17.factory.createStringLiteral(tagName)]
|
|
2383
2752
|
);
|
|
2384
2753
|
}
|
|
2385
2754
|
function tsDeclareVariable(id, type) {
|
|
2386
|
-
const decl =
|
|
2755
|
+
const decl = ts17.factory.createVariableDeclaration(
|
|
2387
2756
|
id,
|
|
2388
2757
|
void 0,
|
|
2389
2758
|
type,
|
|
2390
|
-
|
|
2759
|
+
ts17.factory.createNonNullExpression(ts17.factory.createNull())
|
|
2391
2760
|
);
|
|
2392
|
-
return
|
|
2761
|
+
return ts17.factory.createVariableStatement(
|
|
2393
2762
|
void 0,
|
|
2394
2763
|
[decl]
|
|
2395
2764
|
);
|
|
2396
2765
|
}
|
|
2397
2766
|
function tsCreateTypeQueryForCoercedInput(typeName, coercedInputName) {
|
|
2398
|
-
return
|
|
2767
|
+
return ts17.factory.createTypeQueryNode(ts17.factory.createQualifiedName(typeName, `ngAcceptInputType_${coercedInputName}`));
|
|
2399
2768
|
}
|
|
2400
2769
|
function tsCreateVariable(id, initializer) {
|
|
2401
|
-
const decl =
|
|
2770
|
+
const decl = ts17.factory.createVariableDeclaration(
|
|
2402
2771
|
id,
|
|
2403
2772
|
void 0,
|
|
2404
2773
|
void 0,
|
|
2405
2774
|
initializer
|
|
2406
2775
|
);
|
|
2407
|
-
return
|
|
2776
|
+
return ts17.factory.createVariableStatement(
|
|
2408
2777
|
void 0,
|
|
2409
2778
|
[decl]
|
|
2410
2779
|
);
|
|
2411
2780
|
}
|
|
2412
2781
|
function tsCallMethod(receiver, methodName, args = []) {
|
|
2413
|
-
const methodAccess =
|
|
2414
|
-
return
|
|
2782
|
+
const methodAccess = ts17.factory.createPropertyAccessExpression(receiver, methodName);
|
|
2783
|
+
return ts17.factory.createCallExpression(
|
|
2415
2784
|
methodAccess,
|
|
2416
2785
|
void 0,
|
|
2417
2786
|
args
|
|
2418
2787
|
);
|
|
2419
2788
|
}
|
|
2420
2789
|
function isAccessExpression(node) {
|
|
2421
|
-
return
|
|
2790
|
+
return ts17.isPropertyAccessExpression(node) || ts17.isElementAccessExpression(node);
|
|
2422
2791
|
}
|
|
2423
2792
|
|
|
2424
|
-
// bazel-out/
|
|
2425
|
-
import
|
|
2793
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.mjs
|
|
2794
|
+
import ts21 from "typescript";
|
|
2426
2795
|
|
|
2427
|
-
// bazel-out/
|
|
2428
|
-
import
|
|
2796
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/tcb_util.mjs
|
|
2797
|
+
import ts20 from "typescript";
|
|
2429
2798
|
|
|
2430
|
-
// bazel-out/
|
|
2431
|
-
import
|
|
2799
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_parameter_emitter.mjs
|
|
2800
|
+
import ts19 from "typescript";
|
|
2432
2801
|
|
|
2433
|
-
// bazel-out/
|
|
2434
|
-
import
|
|
2802
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_emitter.mjs
|
|
2803
|
+
import ts18 from "typescript";
|
|
2435
2804
|
var INELIGIBLE = {};
|
|
2436
2805
|
function canEmitType(type, canEmit) {
|
|
2437
2806
|
return canEmitTypeWorker(type);
|
|
@@ -2439,13 +2808,13 @@ function canEmitType(type, canEmit) {
|
|
|
2439
2808
|
return visitNode(type2) !== INELIGIBLE;
|
|
2440
2809
|
}
|
|
2441
2810
|
function visitNode(node) {
|
|
2442
|
-
if (
|
|
2811
|
+
if (ts18.isImportTypeNode(node)) {
|
|
2443
2812
|
return INELIGIBLE;
|
|
2444
2813
|
}
|
|
2445
|
-
if (
|
|
2814
|
+
if (ts18.isTypeReferenceNode(node) && !canEmitTypeReference(node)) {
|
|
2446
2815
|
return INELIGIBLE;
|
|
2447
2816
|
} else {
|
|
2448
|
-
return
|
|
2817
|
+
return ts18.forEachChild(node, visitNode);
|
|
2449
2818
|
}
|
|
2450
2819
|
}
|
|
2451
2820
|
function canEmitTypeReference(type2) {
|
|
@@ -2462,35 +2831,35 @@ var TypeEmitter = class {
|
|
|
2462
2831
|
emitType(type) {
|
|
2463
2832
|
const typeReferenceTransformer = (context) => {
|
|
2464
2833
|
const visitNode = (node) => {
|
|
2465
|
-
if (
|
|
2834
|
+
if (ts18.isImportTypeNode(node)) {
|
|
2466
2835
|
throw new Error("Unable to emit import type");
|
|
2467
2836
|
}
|
|
2468
|
-
if (
|
|
2837
|
+
if (ts18.isTypeReferenceNode(node)) {
|
|
2469
2838
|
return this.emitTypeReference(node);
|
|
2470
|
-
} else if (
|
|
2839
|
+
} else if (ts18.isLiteralExpression(node)) {
|
|
2471
2840
|
let clone;
|
|
2472
|
-
if (
|
|
2473
|
-
clone =
|
|
2474
|
-
} else if (
|
|
2475
|
-
clone =
|
|
2476
|
-
} else if (
|
|
2477
|
-
clone =
|
|
2478
|
-
} else if (
|
|
2479
|
-
clone =
|
|
2480
|
-
} else if (
|
|
2481
|
-
clone =
|
|
2841
|
+
if (ts18.isStringLiteral(node)) {
|
|
2842
|
+
clone = ts18.factory.createStringLiteral(node.text);
|
|
2843
|
+
} else if (ts18.isNumericLiteral(node)) {
|
|
2844
|
+
clone = ts18.factory.createNumericLiteral(node.text);
|
|
2845
|
+
} else if (ts18.isBigIntLiteral(node)) {
|
|
2846
|
+
clone = ts18.factory.createBigIntLiteral(node.text);
|
|
2847
|
+
} else if (ts18.isNoSubstitutionTemplateLiteral(node)) {
|
|
2848
|
+
clone = ts18.factory.createNoSubstitutionTemplateLiteral(node.text, node.rawText);
|
|
2849
|
+
} else if (ts18.isRegularExpressionLiteral(node)) {
|
|
2850
|
+
clone = ts18.factory.createRegularExpressionLiteral(node.text);
|
|
2482
2851
|
} else {
|
|
2483
|
-
throw new Error(`Unsupported literal kind ${
|
|
2852
|
+
throw new Error(`Unsupported literal kind ${ts18.SyntaxKind[node.kind]}`);
|
|
2484
2853
|
}
|
|
2485
|
-
|
|
2854
|
+
ts18.setTextRange(clone, { pos: -1, end: -1 });
|
|
2486
2855
|
return clone;
|
|
2487
2856
|
} else {
|
|
2488
|
-
return
|
|
2857
|
+
return ts18.visitEachChild(node, visitNode, context);
|
|
2489
2858
|
}
|
|
2490
2859
|
};
|
|
2491
|
-
return (node) =>
|
|
2860
|
+
return (node) => ts18.visitNode(node, visitNode, ts18.isTypeNode);
|
|
2492
2861
|
};
|
|
2493
|
-
return
|
|
2862
|
+
return ts18.transform(type, [typeReferenceTransformer]).transformed[0];
|
|
2494
2863
|
}
|
|
2495
2864
|
emitTypeReference(type) {
|
|
2496
2865
|
const translatedType = this.translator(type);
|
|
@@ -2499,13 +2868,13 @@ var TypeEmitter = class {
|
|
|
2499
2868
|
}
|
|
2500
2869
|
let typeArguments = void 0;
|
|
2501
2870
|
if (type.typeArguments !== void 0) {
|
|
2502
|
-
typeArguments =
|
|
2871
|
+
typeArguments = ts18.factory.createNodeArray(type.typeArguments.map((typeArg) => this.emitType(typeArg)));
|
|
2503
2872
|
}
|
|
2504
|
-
return
|
|
2873
|
+
return ts18.factory.updateTypeReferenceNode(type, translatedType.typeName, typeArguments);
|
|
2505
2874
|
}
|
|
2506
2875
|
};
|
|
2507
2876
|
|
|
2508
|
-
// bazel-out/
|
|
2877
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_parameter_emitter.mjs
|
|
2509
2878
|
var TypeParameterEmitter = class {
|
|
2510
2879
|
constructor(typeParameters, reflector) {
|
|
2511
2880
|
this.typeParameters = typeParameters;
|
|
@@ -2542,11 +2911,11 @@ var TypeParameterEmitter = class {
|
|
|
2542
2911
|
return this.typeParameters.map((typeParam) => {
|
|
2543
2912
|
const constraint = typeParam.constraint !== void 0 ? emitter.emitType(typeParam.constraint) : void 0;
|
|
2544
2913
|
const defaultType = typeParam.default !== void 0 ? emitter.emitType(typeParam.default) : void 0;
|
|
2545
|
-
return
|
|
2914
|
+
return ts19.factory.updateTypeParameterDeclaration(typeParam, typeParam.modifiers, typeParam.name, constraint, defaultType);
|
|
2546
2915
|
});
|
|
2547
2916
|
}
|
|
2548
2917
|
resolveTypeReference(type) {
|
|
2549
|
-
const target =
|
|
2918
|
+
const target = ts19.isIdentifier(type.typeName) ? type.typeName : type.typeName.right;
|
|
2550
2919
|
const declaration = this.reflector.getDeclarationOfIdentifier(target);
|
|
2551
2920
|
if (declaration === null || declaration.node === null) {
|
|
2552
2921
|
return null;
|
|
@@ -2572,8 +2941,8 @@ var TypeParameterEmitter = class {
|
|
|
2572
2941
|
if (typeNode === null) {
|
|
2573
2942
|
return null;
|
|
2574
2943
|
}
|
|
2575
|
-
if (!
|
|
2576
|
-
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${
|
|
2944
|
+
if (!ts19.isTypeReferenceNode(typeNode)) {
|
|
2945
|
+
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${ts19.SyntaxKind[typeNode.kind]}.`);
|
|
2577
2946
|
}
|
|
2578
2947
|
return typeNode;
|
|
2579
2948
|
}
|
|
@@ -2582,7 +2951,7 @@ var TypeParameterEmitter = class {
|
|
|
2582
2951
|
}
|
|
2583
2952
|
};
|
|
2584
2953
|
|
|
2585
|
-
// bazel-out/
|
|
2954
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/tcb_util.mjs
|
|
2586
2955
|
var TcbInliningRequirement;
|
|
2587
2956
|
(function(TcbInliningRequirement2) {
|
|
2588
2957
|
TcbInliningRequirement2[TcbInliningRequirement2["MustInline"] = 0] = "MustInline";
|
|
@@ -2615,14 +2984,14 @@ function getTemplateMapping(shimSf, position, resolver, isDiagnosticRequest) {
|
|
|
2615
2984
|
}
|
|
2616
2985
|
function findTypeCheckBlock(file, id, isDiagnosticRequest) {
|
|
2617
2986
|
for (const stmt of file.statements) {
|
|
2618
|
-
if (
|
|
2987
|
+
if (ts20.isFunctionDeclaration(stmt) && getTemplateId2(stmt, file, isDiagnosticRequest) === id) {
|
|
2619
2988
|
return stmt;
|
|
2620
2989
|
}
|
|
2621
2990
|
}
|
|
2622
2991
|
return null;
|
|
2623
2992
|
}
|
|
2624
2993
|
function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
|
|
2625
|
-
while (node !== void 0 && !
|
|
2994
|
+
while (node !== void 0 && !ts20.isFunctionDeclaration(node)) {
|
|
2626
2995
|
if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticsRequest) {
|
|
2627
2996
|
return null;
|
|
2628
2997
|
}
|
|
@@ -2639,7 +3008,7 @@ function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
|
|
|
2639
3008
|
return null;
|
|
2640
3009
|
}
|
|
2641
3010
|
function getTemplateId2(node, sourceFile, isDiagnosticRequest) {
|
|
2642
|
-
while (!
|
|
3011
|
+
while (!ts20.isFunctionDeclaration(node)) {
|
|
2643
3012
|
if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticRequest) {
|
|
2644
3013
|
return null;
|
|
2645
3014
|
}
|
|
@@ -2649,8 +3018,8 @@ function getTemplateId2(node, sourceFile, isDiagnosticRequest) {
|
|
|
2649
3018
|
}
|
|
2650
3019
|
}
|
|
2651
3020
|
const start = node.getFullStart();
|
|
2652
|
-
return
|
|
2653
|
-
if (kind !==
|
|
3021
|
+
return ts20.forEachLeadingCommentRange(sourceFile.text, start, (pos, end, kind) => {
|
|
3022
|
+
if (kind !== ts20.SyntaxKind.MultiLineCommentTrivia) {
|
|
2654
3023
|
return null;
|
|
2655
3024
|
}
|
|
2656
3025
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -2662,32 +3031,32 @@ function checkIfGenericTypeBoundsCanBeEmitted(node, reflector, env) {
|
|
|
2662
3031
|
return emitter.canEmit((ref) => env.canReferenceType(ref));
|
|
2663
3032
|
}
|
|
2664
3033
|
|
|
2665
|
-
// bazel-out/
|
|
3034
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.mjs
|
|
2666
3035
|
function generateTypeCtorDeclarationFn(node, meta, nodeTypeRef, typeParams) {
|
|
2667
3036
|
const rawTypeArgs = typeParams !== void 0 ? generateGenericArgs(typeParams) : void 0;
|
|
2668
|
-
const rawType =
|
|
3037
|
+
const rawType = ts21.factory.createTypeReferenceNode(nodeTypeRef, rawTypeArgs);
|
|
2669
3038
|
const initParam = constructTypeCtorParameter(node, meta, rawType);
|
|
2670
3039
|
const typeParameters = typeParametersWithDefaultTypes(typeParams);
|
|
2671
3040
|
if (meta.body) {
|
|
2672
|
-
const fnType =
|
|
3041
|
+
const fnType = ts21.factory.createFunctionTypeNode(
|
|
2673
3042
|
typeParameters,
|
|
2674
3043
|
[initParam],
|
|
2675
3044
|
rawType
|
|
2676
3045
|
);
|
|
2677
|
-
const decl =
|
|
3046
|
+
const decl = ts21.factory.createVariableDeclaration(
|
|
2678
3047
|
meta.fnName,
|
|
2679
3048
|
void 0,
|
|
2680
3049
|
fnType,
|
|
2681
|
-
|
|
3050
|
+
ts21.factory.createNonNullExpression(ts21.factory.createNull())
|
|
2682
3051
|
);
|
|
2683
|
-
const declList =
|
|
2684
|
-
return
|
|
3052
|
+
const declList = ts21.factory.createVariableDeclarationList([decl], ts21.NodeFlags.Const);
|
|
3053
|
+
return ts21.factory.createVariableStatement(
|
|
2685
3054
|
void 0,
|
|
2686
3055
|
declList
|
|
2687
3056
|
);
|
|
2688
3057
|
} else {
|
|
2689
|
-
return
|
|
2690
|
-
[
|
|
3058
|
+
return ts21.factory.createFunctionDeclaration(
|
|
3059
|
+
[ts21.factory.createModifier(ts21.SyntaxKind.DeclareKeyword)],
|
|
2691
3060
|
void 0,
|
|
2692
3061
|
meta.fnName,
|
|
2693
3062
|
typeParameters,
|
|
@@ -2699,16 +3068,16 @@ function generateTypeCtorDeclarationFn(node, meta, nodeTypeRef, typeParams) {
|
|
|
2699
3068
|
}
|
|
2700
3069
|
function generateInlineTypeCtor(node, meta) {
|
|
2701
3070
|
const rawTypeArgs = node.typeParameters !== void 0 ? generateGenericArgs(node.typeParameters) : void 0;
|
|
2702
|
-
const rawType =
|
|
3071
|
+
const rawType = ts21.factory.createTypeReferenceNode(node.name, rawTypeArgs);
|
|
2703
3072
|
const initParam = constructTypeCtorParameter(node, meta, rawType);
|
|
2704
3073
|
let body = void 0;
|
|
2705
3074
|
if (meta.body) {
|
|
2706
|
-
body =
|
|
2707
|
-
|
|
3075
|
+
body = ts21.factory.createBlock([
|
|
3076
|
+
ts21.factory.createReturnStatement(ts21.factory.createNonNullExpression(ts21.factory.createNull()))
|
|
2708
3077
|
]);
|
|
2709
3078
|
}
|
|
2710
|
-
return
|
|
2711
|
-
[
|
|
3079
|
+
return ts21.factory.createMethodDeclaration(
|
|
3080
|
+
[ts21.factory.createModifier(ts21.SyntaxKind.StaticKeyword)],
|
|
2712
3081
|
void 0,
|
|
2713
3082
|
meta.fnName,
|
|
2714
3083
|
void 0,
|
|
@@ -2724,9 +3093,9 @@ function constructTypeCtorParameter(node, meta, rawType) {
|
|
|
2724
3093
|
const coercedKeys = [];
|
|
2725
3094
|
for (const { classPropertyName, transform } of meta.fields.inputs) {
|
|
2726
3095
|
if (!meta.coercedInputFields.has(classPropertyName)) {
|
|
2727
|
-
plainKeys.push(
|
|
3096
|
+
plainKeys.push(ts21.factory.createLiteralTypeNode(ts21.factory.createStringLiteral(classPropertyName)));
|
|
2728
3097
|
} else {
|
|
2729
|
-
coercedKeys.push(
|
|
3098
|
+
coercedKeys.push(ts21.factory.createPropertySignature(
|
|
2730
3099
|
void 0,
|
|
2731
3100
|
classPropertyName,
|
|
2732
3101
|
void 0,
|
|
@@ -2735,17 +3104,17 @@ function constructTypeCtorParameter(node, meta, rawType) {
|
|
|
2735
3104
|
}
|
|
2736
3105
|
}
|
|
2737
3106
|
if (plainKeys.length > 0) {
|
|
2738
|
-
const keyTypeUnion =
|
|
2739
|
-
initType =
|
|
3107
|
+
const keyTypeUnion = ts21.factory.createUnionTypeNode(plainKeys);
|
|
3108
|
+
initType = ts21.factory.createTypeReferenceNode("Pick", [rawType, keyTypeUnion]);
|
|
2740
3109
|
}
|
|
2741
3110
|
if (coercedKeys.length > 0) {
|
|
2742
|
-
const coercedLiteral =
|
|
2743
|
-
initType = initType !== null ?
|
|
3111
|
+
const coercedLiteral = ts21.factory.createTypeLiteralNode(coercedKeys);
|
|
3112
|
+
initType = initType !== null ? ts21.factory.createIntersectionTypeNode([initType, coercedLiteral]) : coercedLiteral;
|
|
2744
3113
|
}
|
|
2745
3114
|
if (initType === null) {
|
|
2746
|
-
initType =
|
|
3115
|
+
initType = ts21.factory.createTypeLiteralNode([]);
|
|
2747
3116
|
}
|
|
2748
|
-
return
|
|
3117
|
+
return ts21.factory.createParameterDeclaration(
|
|
2749
3118
|
void 0,
|
|
2750
3119
|
void 0,
|
|
2751
3120
|
"init",
|
|
@@ -2755,7 +3124,7 @@ function constructTypeCtorParameter(node, meta, rawType) {
|
|
|
2755
3124
|
);
|
|
2756
3125
|
}
|
|
2757
3126
|
function generateGenericArgs(params) {
|
|
2758
|
-
return params.map((param) =>
|
|
3127
|
+
return params.map((param) => ts21.factory.createTypeReferenceNode(param.name, void 0));
|
|
2759
3128
|
}
|
|
2760
3129
|
function requiresInlineTypeCtor(node, host, env) {
|
|
2761
3130
|
return !checkIfGenericTypeBoundsCanBeEmitted(node, host, env);
|
|
@@ -2766,14 +3135,14 @@ function typeParametersWithDefaultTypes(params) {
|
|
|
2766
3135
|
}
|
|
2767
3136
|
return params.map((param) => {
|
|
2768
3137
|
if (param.default === void 0) {
|
|
2769
|
-
return
|
|
3138
|
+
return ts21.factory.updateTypeParameterDeclaration(param, param.modifiers, param.name, param.constraint, ts21.factory.createKeywordTypeNode(ts21.SyntaxKind.AnyKeyword));
|
|
2770
3139
|
} else {
|
|
2771
3140
|
return param;
|
|
2772
3141
|
}
|
|
2773
3142
|
});
|
|
2774
3143
|
}
|
|
2775
3144
|
|
|
2776
|
-
// bazel-out/
|
|
3145
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/environment.mjs
|
|
2777
3146
|
var Environment = class {
|
|
2778
3147
|
constructor(config, importManager, refEmitter, reflector, contextFile) {
|
|
2779
3148
|
this.config = config;
|
|
@@ -2798,13 +3167,13 @@ var Environment = class {
|
|
|
2798
3167
|
}
|
|
2799
3168
|
if (requiresInlineTypeCtor(node, this.reflector, this)) {
|
|
2800
3169
|
const ref = this.reference(dirRef);
|
|
2801
|
-
const typeCtorExpr =
|
|
3170
|
+
const typeCtorExpr = ts22.factory.createPropertyAccessExpression(ref, "ngTypeCtor");
|
|
2802
3171
|
this.typeCtors.set(node, typeCtorExpr);
|
|
2803
3172
|
return typeCtorExpr;
|
|
2804
3173
|
} else {
|
|
2805
3174
|
const fnName = `_ctor${this.nextIds.typeCtor++}`;
|
|
2806
3175
|
const nodeTypeRef = this.referenceType(dirRef);
|
|
2807
|
-
if (!
|
|
3176
|
+
if (!ts22.isTypeReferenceNode(nodeTypeRef)) {
|
|
2808
3177
|
throw new Error(`Expected TypeReferenceNode from reference to ${dirRef.debugName}`);
|
|
2809
3178
|
}
|
|
2810
3179
|
const meta = {
|
|
@@ -2819,7 +3188,7 @@ var Environment = class {
|
|
|
2819
3188
|
const typeParams = this.emitTypeParameters(node);
|
|
2820
3189
|
const typeCtor = generateTypeCtorDeclarationFn(node, meta, nodeTypeRef.typeName, typeParams);
|
|
2821
3190
|
this.typeCtorStatements.push(typeCtor);
|
|
2822
|
-
const fnId =
|
|
3191
|
+
const fnId = ts22.factory.createIdentifier(fnName);
|
|
2823
3192
|
this.typeCtors.set(node, fnId);
|
|
2824
3193
|
return fnId;
|
|
2825
3194
|
}
|
|
@@ -2829,7 +3198,7 @@ var Environment = class {
|
|
|
2829
3198
|
return this.pipeInsts.get(ref.node);
|
|
2830
3199
|
}
|
|
2831
3200
|
const pipeType = this.referenceType(ref);
|
|
2832
|
-
const pipeInstId =
|
|
3201
|
+
const pipeInstId = ts22.factory.createIdentifier(`_pipe${this.nextIds.pipeInst++}`);
|
|
2833
3202
|
this.pipeInstStatements.push(tsDeclareVariable(pipeInstId, pipeType));
|
|
2834
3203
|
this.pipeInsts.set(ref.node, pipeInstId);
|
|
2835
3204
|
return pipeInstId;
|
|
@@ -2867,9 +3236,9 @@ var Environment = class {
|
|
|
2867
3236
|
}
|
|
2868
3237
|
};
|
|
2869
3238
|
|
|
2870
|
-
// bazel-out/
|
|
3239
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/oob.mjs
|
|
2871
3240
|
import { TmplAstElement as TmplAstElement2 } from "@angular/compiler";
|
|
2872
|
-
import
|
|
3241
|
+
import ts23 from "typescript";
|
|
2873
3242
|
var OutOfBandDiagnosticRecorderImpl = class {
|
|
2874
3243
|
constructor(resolver) {
|
|
2875
3244
|
this.resolver = resolver;
|
|
@@ -2883,7 +3252,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
2883
3252
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
2884
3253
|
const value = ref.value.trim();
|
|
2885
3254
|
const errorMsg = `No directive found with exportAs '${value}'.`;
|
|
2886
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, ref.valueSpan || ref.sourceSpan,
|
|
3255
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, ref.valueSpan || ref.sourceSpan, ts23.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REFERENCE_TARGET), errorMsg));
|
|
2887
3256
|
}
|
|
2888
3257
|
missingPipe(templateId, ast) {
|
|
2889
3258
|
if (this.recordedPipes.has(ast)) {
|
|
@@ -2895,7 +3264,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
2895
3264
|
if (sourceSpan === null) {
|
|
2896
3265
|
throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${ast.name}'.`);
|
|
2897
3266
|
}
|
|
2898
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan,
|
|
3267
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts23.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_PIPE), errorMsg));
|
|
2899
3268
|
this.recordedPipes.add(ast);
|
|
2900
3269
|
}
|
|
2901
3270
|
illegalAssignmentToTemplateVar(templateId, assignment, target) {
|
|
@@ -2906,7 +3275,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
2906
3275
|
if (sourceSpan === null) {
|
|
2907
3276
|
throw new Error(`Assertion failure: no SourceLocation found for property binding.`);
|
|
2908
3277
|
}
|
|
2909
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan,
|
|
3278
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts23.DiagnosticCategory.Error, ngErrorCode(ErrorCode.WRITE_TO_READ_ONLY_VARIABLE), errorMsg, [{
|
|
2910
3279
|
text: `The variable ${assignment.name} is declared here.`,
|
|
2911
3280
|
start: ((_a = target.valueSpan) == null ? void 0 : _a.start.offset) || target.sourceSpan.start.offset,
|
|
2912
3281
|
end: ((_b = target.valueSpan) == null ? void 0 : _b.end.offset) || target.sourceSpan.end.offset,
|
|
@@ -2916,7 +3285,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
2916
3285
|
duplicateTemplateVar(templateId, variable, firstDecl) {
|
|
2917
3286
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
2918
3287
|
const errorMsg = `Cannot redeclare variable '${variable.name}' as it was previously declared elsewhere for the same template.`;
|
|
2919
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, variable.sourceSpan,
|
|
3288
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, variable.sourceSpan, ts23.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DUPLICATE_VARIABLE_DECLARATION), errorMsg, [{
|
|
2920
3289
|
text: `The variable '${firstDecl.name}' was first declared here.`,
|
|
2921
3290
|
start: firstDecl.sourceSpan.start.offset,
|
|
2922
3291
|
end: firstDecl.sourceSpan.end.offset,
|
|
@@ -2955,7 +3324,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
2955
3324
|
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.
|
|
2956
3325
|
|
|
2957
3326
|
Consider enabling the 'strictTemplates' option in your tsconfig.json for better type inference within this template.`;
|
|
2958
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, diagnosticVar.keySpan,
|
|
3327
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, diagnosticVar.keySpan, ts23.DiagnosticCategory.Suggestion, ngErrorCode(ErrorCode.SUGGEST_SUBOPTIMAL_TYPE_INFERENCE), message));
|
|
2959
3328
|
}
|
|
2960
3329
|
splitTwoWayBinding(templateId, input, output, inputConsumer, outputConsumer) {
|
|
2961
3330
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
@@ -2989,11 +3358,30 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
|
|
|
2989
3358
|
sourceFile: outputConsumer.name.getSourceFile()
|
|
2990
3359
|
});
|
|
2991
3360
|
}
|
|
2992
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, input.keySpan,
|
|
3361
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, input.keySpan, ts23.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SPLIT_TWO_WAY_BINDING), errorMsg, relatedMessages));
|
|
2993
3362
|
}
|
|
2994
3363
|
missingRequiredInputs(templateId, element, directiveName, isComponent, inputAliases) {
|
|
2995
3364
|
const message = `Required input${inputAliases.length === 1 ? "" : "s"} ${inputAliases.map((n) => `'${n}'`).join(", ")} from ${isComponent ? "component" : "directive"} ${directiveName} must be specified.`;
|
|
2996
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), element.startSourceSpan,
|
|
3365
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), element.startSourceSpan, ts23.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REQUIRED_INPUTS), message));
|
|
3366
|
+
}
|
|
3367
|
+
illegalForLoopTrackAccess(templateId, block, access) {
|
|
3368
|
+
const sourceSpan = this.resolver.toParseSourceSpan(templateId, access.sourceSpan);
|
|
3369
|
+
if (sourceSpan === null) {
|
|
3370
|
+
throw new Error(`Assertion failure: no SourceLocation found for property read.`);
|
|
3371
|
+
}
|
|
3372
|
+
const message = `Cannot access '${access.name}' inside of a track expression. Only '${block.item.name}', '${block.contextVariables.$index.name}' and properties on the containing component are available to this expression.`;
|
|
3373
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), sourceSpan, ts23.DiagnosticCategory.Error, ngErrorCode(ErrorCode.ILLEGAL_FOR_LOOP_TRACK_ACCESS), message));
|
|
3374
|
+
}
|
|
3375
|
+
inaccessibleDeferredTriggerElement(templateId, trigger) {
|
|
3376
|
+
let message;
|
|
3377
|
+
if (trigger.reference === null) {
|
|
3378
|
+
message = `Trigger cannot find reference. Make sure that the @defer block has a @placeholder with at least one root element node.`;
|
|
3379
|
+
} else {
|
|
3380
|
+
message = `Trigger cannot find reference "${trigger.reference}".
|
|
3381
|
+
Check that an element with #${trigger.reference} exists in the same template and it's accessible from the @defer block.
|
|
3382
|
+
Deferred blocks can only access triggers in same view, a parent embedded view or the root view of the @placeholder block.`;
|
|
3383
|
+
}
|
|
3384
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), trigger.sourceSpan, ts23.DiagnosticCategory.Error, ngErrorCode(ErrorCode.INACCESSIBLE_DEFERRED_TRIGGER_ELEMENT), message));
|
|
2997
3385
|
}
|
|
2998
3386
|
};
|
|
2999
3387
|
function makeInlineDiagnostic(templateId, code, node, messageText, relatedInformation) {
|
|
@@ -3004,8 +3392,8 @@ function makeInlineDiagnostic(templateId, code, node, messageText, relatedInform
|
|
|
3004
3392
|
};
|
|
3005
3393
|
}
|
|
3006
3394
|
|
|
3007
|
-
// bazel-out/
|
|
3008
|
-
import
|
|
3395
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/shim.mjs
|
|
3396
|
+
import ts24 from "typescript";
|
|
3009
3397
|
var TypeCheckShimGenerator = class {
|
|
3010
3398
|
constructor() {
|
|
3011
3399
|
this.extensionPrefix = "ngtypecheck";
|
|
@@ -3015,25 +3403,25 @@ var TypeCheckShimGenerator = class {
|
|
|
3015
3403
|
if (priorShimSf !== null) {
|
|
3016
3404
|
return priorShimSf;
|
|
3017
3405
|
}
|
|
3018
|
-
return
|
|
3406
|
+
return ts24.createSourceFile(genFilePath, "export const USED_FOR_NG_TYPE_CHECKING = true;", ts24.ScriptTarget.Latest, true, ts24.ScriptKind.TS);
|
|
3019
3407
|
}
|
|
3020
3408
|
static shimFor(fileName) {
|
|
3021
3409
|
return absoluteFrom(fileName.replace(/\.tsx?$/, ".ngtypecheck.ts"));
|
|
3022
3410
|
}
|
|
3023
3411
|
};
|
|
3024
3412
|
|
|
3025
|
-
// bazel-out/
|
|
3026
|
-
import { BindingPipe, Call as Call2, DYNAMIC_TYPE, ImplicitReceiver as ImplicitReceiver4, PropertyRead as PropertyRead4, PropertyWrite as PropertyWrite3, SafeCall, SafePropertyRead as SafePropertyRead3, ThisReceiver, TmplAstBoundAttribute, TmplAstBoundText, TmplAstDeferredBlock, TmplAstElement as TmplAstElement3, TmplAstForLoopBlock, TmplAstIcu, TmplAstIfBlock, TmplAstReference as TmplAstReference3, TmplAstSwitchBlock, TmplAstTemplate as TmplAstTemplate2, TmplAstTextAttribute as TmplAstTextAttribute2, TmplAstVariable as TmplAstVariable2, TransplantedType } from "@angular/compiler";
|
|
3027
|
-
import
|
|
3413
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.mjs
|
|
3414
|
+
import { BindingPipe, Call as Call2, DYNAMIC_TYPE, ImplicitReceiver as ImplicitReceiver4, PropertyRead as PropertyRead4, PropertyWrite as PropertyWrite3, SafeCall, SafePropertyRead as SafePropertyRead3, ThisReceiver, TmplAstBoundAttribute, TmplAstBoundText, TmplAstDeferredBlock, TmplAstElement as TmplAstElement3, TmplAstForLoopBlock, TmplAstIcu, TmplAstIfBlock, TmplAstIfBlockBranch, TmplAstReference as TmplAstReference3, TmplAstSwitchBlock, TmplAstTemplate as TmplAstTemplate2, TmplAstTextAttribute as TmplAstTextAttribute2, TmplAstVariable as TmplAstVariable2, TransplantedType } from "@angular/compiler";
|
|
3415
|
+
import ts27 from "typescript";
|
|
3028
3416
|
|
|
3029
|
-
// bazel-out/
|
|
3417
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/diagnostics.mjs
|
|
3030
3418
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan3 } from "@angular/compiler";
|
|
3031
|
-
import
|
|
3419
|
+
import ts25 from "typescript";
|
|
3032
3420
|
function wrapForDiagnostics(expr) {
|
|
3033
|
-
return
|
|
3421
|
+
return ts25.factory.createParenthesizedExpression(expr);
|
|
3034
3422
|
}
|
|
3035
3423
|
function wrapForTypeChecker(expr) {
|
|
3036
|
-
return
|
|
3424
|
+
return ts25.factory.createParenthesizedExpression(expr);
|
|
3037
3425
|
}
|
|
3038
3426
|
function addParseSpanInfo(node, span) {
|
|
3039
3427
|
let commentText;
|
|
@@ -3042,10 +3430,10 @@ function addParseSpanInfo(node, span) {
|
|
|
3042
3430
|
} else {
|
|
3043
3431
|
commentText = `${span.start.offset},${span.end.offset}`;
|
|
3044
3432
|
}
|
|
3045
|
-
|
|
3433
|
+
ts25.addSyntheticTrailingComment(node, ts25.SyntaxKind.MultiLineCommentTrivia, commentText, false);
|
|
3046
3434
|
}
|
|
3047
3435
|
function addTemplateId(tcb, id) {
|
|
3048
|
-
|
|
3436
|
+
ts25.addSyntheticLeadingComment(tcb, ts25.SyntaxKind.MultiLineCommentTrivia, id, true);
|
|
3049
3437
|
}
|
|
3050
3438
|
function shouldReportDiagnostic(diagnostic) {
|
|
3051
3439
|
const { code } = diagnostic;
|
|
@@ -3072,34 +3460,34 @@ function translateDiagnostic(diagnostic, resolver) {
|
|
|
3072
3460
|
return makeTemplateDiagnostic(sourceLocation.id, templateSourceMapping, span, diagnostic.category, diagnostic.code, diagnostic.messageText);
|
|
3073
3461
|
}
|
|
3074
3462
|
|
|
3075
|
-
// bazel-out/
|
|
3463
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/expression.mjs
|
|
3076
3464
|
import { ASTWithSource as ASTWithSource2, Call, EmptyExpr as EmptyExpr2, PropertyRead as PropertyRead3, SafeKeyedRead, SafePropertyRead as SafePropertyRead2 } from "@angular/compiler";
|
|
3077
|
-
import
|
|
3078
|
-
var NULL_AS_ANY =
|
|
3079
|
-
var UNDEFINED =
|
|
3465
|
+
import ts26 from "typescript";
|
|
3466
|
+
var NULL_AS_ANY = ts26.factory.createAsExpression(ts26.factory.createNull(), ts26.factory.createKeywordTypeNode(ts26.SyntaxKind.AnyKeyword));
|
|
3467
|
+
var UNDEFINED = ts26.factory.createIdentifier("undefined");
|
|
3080
3468
|
var UNARY_OPS = /* @__PURE__ */ new Map([
|
|
3081
|
-
["+",
|
|
3082
|
-
["-",
|
|
3469
|
+
["+", ts26.SyntaxKind.PlusToken],
|
|
3470
|
+
["-", ts26.SyntaxKind.MinusToken]
|
|
3083
3471
|
]);
|
|
3084
3472
|
var BINARY_OPS = /* @__PURE__ */ new Map([
|
|
3085
|
-
["+",
|
|
3086
|
-
["-",
|
|
3087
|
-
["<",
|
|
3088
|
-
[">",
|
|
3089
|
-
["<=",
|
|
3090
|
-
[">=",
|
|
3091
|
-
["==",
|
|
3092
|
-
["===",
|
|
3093
|
-
["*",
|
|
3094
|
-
["/",
|
|
3095
|
-
["%",
|
|
3096
|
-
["!=",
|
|
3097
|
-
["!==",
|
|
3098
|
-
["||",
|
|
3099
|
-
["&&",
|
|
3100
|
-
["&",
|
|
3101
|
-
["|",
|
|
3102
|
-
["??",
|
|
3473
|
+
["+", ts26.SyntaxKind.PlusToken],
|
|
3474
|
+
["-", ts26.SyntaxKind.MinusToken],
|
|
3475
|
+
["<", ts26.SyntaxKind.LessThanToken],
|
|
3476
|
+
[">", ts26.SyntaxKind.GreaterThanToken],
|
|
3477
|
+
["<=", ts26.SyntaxKind.LessThanEqualsToken],
|
|
3478
|
+
[">=", ts26.SyntaxKind.GreaterThanEqualsToken],
|
|
3479
|
+
["==", ts26.SyntaxKind.EqualsEqualsToken],
|
|
3480
|
+
["===", ts26.SyntaxKind.EqualsEqualsEqualsToken],
|
|
3481
|
+
["*", ts26.SyntaxKind.AsteriskToken],
|
|
3482
|
+
["/", ts26.SyntaxKind.SlashToken],
|
|
3483
|
+
["%", ts26.SyntaxKind.PercentToken],
|
|
3484
|
+
["!=", ts26.SyntaxKind.ExclamationEqualsToken],
|
|
3485
|
+
["!==", ts26.SyntaxKind.ExclamationEqualsEqualsToken],
|
|
3486
|
+
["||", ts26.SyntaxKind.BarBarToken],
|
|
3487
|
+
["&&", ts26.SyntaxKind.AmpersandAmpersandToken],
|
|
3488
|
+
["&", ts26.SyntaxKind.AmpersandToken],
|
|
3489
|
+
["|", ts26.SyntaxKind.BarToken],
|
|
3490
|
+
["??", ts26.SyntaxKind.QuestionQuestionToken]
|
|
3103
3491
|
]);
|
|
3104
3492
|
function astToTypescript(ast, maybeResolve, config) {
|
|
3105
3493
|
const translator = new AstTranslator(maybeResolve, config);
|
|
@@ -3115,7 +3503,7 @@ var AstTranslator = class {
|
|
|
3115
3503
|
ast = ast.ast;
|
|
3116
3504
|
}
|
|
3117
3505
|
if (ast instanceof EmptyExpr2) {
|
|
3118
|
-
const res =
|
|
3506
|
+
const res = ts26.factory.createIdentifier("undefined");
|
|
3119
3507
|
addParseSpanInfo(res, ast.sourceSpan);
|
|
3120
3508
|
return res;
|
|
3121
3509
|
}
|
|
@@ -3131,7 +3519,7 @@ var AstTranslator = class {
|
|
|
3131
3519
|
if (op === void 0) {
|
|
3132
3520
|
throw new Error(`Unsupported Unary.operator: ${ast.operator}`);
|
|
3133
3521
|
}
|
|
3134
|
-
const node = wrapForDiagnostics(
|
|
3522
|
+
const node = wrapForDiagnostics(ts26.factory.createPrefixUnaryExpression(op, expr));
|
|
3135
3523
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3136
3524
|
return node;
|
|
3137
3525
|
}
|
|
@@ -3142,13 +3530,13 @@ var AstTranslator = class {
|
|
|
3142
3530
|
if (op === void 0) {
|
|
3143
3531
|
throw new Error(`Unsupported Binary.operation: ${ast.operation}`);
|
|
3144
3532
|
}
|
|
3145
|
-
const node =
|
|
3533
|
+
const node = ts26.factory.createBinaryExpression(lhs, op, rhs);
|
|
3146
3534
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3147
3535
|
return node;
|
|
3148
3536
|
}
|
|
3149
3537
|
visitChain(ast) {
|
|
3150
3538
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
3151
|
-
const node = wrapForDiagnostics(
|
|
3539
|
+
const node = wrapForDiagnostics(ts26.factory.createCommaListExpression(elements));
|
|
3152
3540
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3153
3541
|
return node;
|
|
3154
3542
|
}
|
|
@@ -3156,7 +3544,7 @@ var AstTranslator = class {
|
|
|
3156
3544
|
const condExpr = this.translate(ast.condition);
|
|
3157
3545
|
const trueExpr = this.translate(ast.trueExp);
|
|
3158
3546
|
const falseExpr = wrapForTypeChecker(this.translate(ast.falseExp));
|
|
3159
|
-
const node =
|
|
3547
|
+
const node = ts26.factory.createParenthesizedExpression(ts26.factory.createConditionalExpression(condExpr, void 0, trueExpr, void 0, falseExpr));
|
|
3160
3548
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3161
3549
|
return node;
|
|
3162
3550
|
}
|
|
@@ -3167,26 +3555,26 @@ var AstTranslator = class {
|
|
|
3167
3555
|
throw new Error("Method not implemented.");
|
|
3168
3556
|
}
|
|
3169
3557
|
visitInterpolation(ast) {
|
|
3170
|
-
return ast.expressions.reduce((lhs, ast2) =>
|
|
3558
|
+
return ast.expressions.reduce((lhs, ast2) => ts26.factory.createBinaryExpression(lhs, ts26.SyntaxKind.PlusToken, wrapForTypeChecker(this.translate(ast2))), ts26.factory.createStringLiteral(""));
|
|
3171
3559
|
}
|
|
3172
3560
|
visitKeyedRead(ast) {
|
|
3173
3561
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3174
3562
|
const key = this.translate(ast.key);
|
|
3175
|
-
const node =
|
|
3563
|
+
const node = ts26.factory.createElementAccessExpression(receiver, key);
|
|
3176
3564
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3177
3565
|
return node;
|
|
3178
3566
|
}
|
|
3179
3567
|
visitKeyedWrite(ast) {
|
|
3180
3568
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3181
|
-
const left =
|
|
3569
|
+
const left = ts26.factory.createElementAccessExpression(receiver, this.translate(ast.key));
|
|
3182
3570
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
3183
|
-
const node = wrapForDiagnostics(
|
|
3571
|
+
const node = wrapForDiagnostics(ts26.factory.createBinaryExpression(left, ts26.SyntaxKind.EqualsToken, right));
|
|
3184
3572
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3185
3573
|
return node;
|
|
3186
3574
|
}
|
|
3187
3575
|
visitLiteralArray(ast) {
|
|
3188
3576
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
3189
|
-
const literal =
|
|
3577
|
+
const literal = ts26.factory.createArrayLiteralExpression(elements);
|
|
3190
3578
|
const node = this.config.strictLiteralTypes ? literal : tsCastToAny(literal);
|
|
3191
3579
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3192
3580
|
return node;
|
|
@@ -3194,9 +3582,9 @@ var AstTranslator = class {
|
|
|
3194
3582
|
visitLiteralMap(ast) {
|
|
3195
3583
|
const properties = ast.keys.map(({ key }, idx) => {
|
|
3196
3584
|
const value = this.translate(ast.values[idx]);
|
|
3197
|
-
return
|
|
3585
|
+
return ts26.factory.createPropertyAssignment(ts26.factory.createStringLiteral(key), value);
|
|
3198
3586
|
});
|
|
3199
|
-
const literal =
|
|
3587
|
+
const literal = ts26.factory.createObjectLiteralExpression(properties, true);
|
|
3200
3588
|
const node = this.config.strictLiteralTypes ? literal : tsCastToAny(literal);
|
|
3201
3589
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3202
3590
|
return node;
|
|
@@ -3204,15 +3592,15 @@ var AstTranslator = class {
|
|
|
3204
3592
|
visitLiteralPrimitive(ast) {
|
|
3205
3593
|
let node;
|
|
3206
3594
|
if (ast.value === void 0) {
|
|
3207
|
-
node =
|
|
3595
|
+
node = ts26.factory.createIdentifier("undefined");
|
|
3208
3596
|
} else if (ast.value === null) {
|
|
3209
|
-
node =
|
|
3597
|
+
node = ts26.factory.createNull();
|
|
3210
3598
|
} else if (typeof ast.value === "string") {
|
|
3211
|
-
node =
|
|
3599
|
+
node = ts26.factory.createStringLiteral(ast.value);
|
|
3212
3600
|
} else if (typeof ast.value === "number") {
|
|
3213
|
-
node =
|
|
3601
|
+
node = ts26.factory.createNumericLiteral(ast.value);
|
|
3214
3602
|
} else if (typeof ast.value === "boolean") {
|
|
3215
|
-
node = ast.value ?
|
|
3603
|
+
node = ast.value ? ts26.factory.createTrue() : ts26.factory.createFalse();
|
|
3216
3604
|
} else {
|
|
3217
3605
|
throw Error(`Unsupported AST value of type ${typeof ast.value}`);
|
|
3218
3606
|
}
|
|
@@ -3221,7 +3609,7 @@ var AstTranslator = class {
|
|
|
3221
3609
|
}
|
|
3222
3610
|
visitNonNullAssert(ast) {
|
|
3223
3611
|
const expr = wrapForDiagnostics(this.translate(ast.expression));
|
|
3224
|
-
const node =
|
|
3612
|
+
const node = ts26.factory.createNonNullExpression(expr);
|
|
3225
3613
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3226
3614
|
return node;
|
|
3227
3615
|
}
|
|
@@ -3230,13 +3618,13 @@ var AstTranslator = class {
|
|
|
3230
3618
|
}
|
|
3231
3619
|
visitPrefixNot(ast) {
|
|
3232
3620
|
const expression = wrapForDiagnostics(this.translate(ast.expression));
|
|
3233
|
-
const node =
|
|
3621
|
+
const node = ts26.factory.createLogicalNot(expression);
|
|
3234
3622
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3235
3623
|
return node;
|
|
3236
3624
|
}
|
|
3237
3625
|
visitPropertyRead(ast) {
|
|
3238
3626
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3239
|
-
const name =
|
|
3627
|
+
const name = ts26.factory.createPropertyAccessExpression(receiver, ast.name);
|
|
3240
3628
|
addParseSpanInfo(name, ast.nameSpan);
|
|
3241
3629
|
const node = wrapForDiagnostics(name);
|
|
3242
3630
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
@@ -3244,12 +3632,12 @@ var AstTranslator = class {
|
|
|
3244
3632
|
}
|
|
3245
3633
|
visitPropertyWrite(ast) {
|
|
3246
3634
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3247
|
-
const left =
|
|
3635
|
+
const left = ts26.factory.createPropertyAccessExpression(receiver, ast.name);
|
|
3248
3636
|
addParseSpanInfo(left, ast.nameSpan);
|
|
3249
3637
|
const leftWithPath = wrapForDiagnostics(left);
|
|
3250
3638
|
addParseSpanInfo(leftWithPath, ast.sourceSpan);
|
|
3251
3639
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
3252
|
-
const node = wrapForDiagnostics(
|
|
3640
|
+
const node = wrapForDiagnostics(ts26.factory.createBinaryExpression(leftWithPath, ts26.SyntaxKind.EqualsToken, right));
|
|
3253
3641
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3254
3642
|
return node;
|
|
3255
3643
|
}
|
|
@@ -3257,13 +3645,13 @@ var AstTranslator = class {
|
|
|
3257
3645
|
let node;
|
|
3258
3646
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3259
3647
|
if (this.config.strictSafeNavigationTypes) {
|
|
3260
|
-
const expr =
|
|
3648
|
+
const expr = ts26.factory.createPropertyAccessExpression(ts26.factory.createNonNullExpression(receiver), ast.name);
|
|
3261
3649
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
3262
|
-
node =
|
|
3650
|
+
node = ts26.factory.createParenthesizedExpression(ts26.factory.createConditionalExpression(NULL_AS_ANY, void 0, expr, void 0, UNDEFINED));
|
|
3263
3651
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3264
|
-
node =
|
|
3652
|
+
node = ts26.factory.createPropertyAccessExpression(tsCastToAny(receiver), ast.name);
|
|
3265
3653
|
} else {
|
|
3266
|
-
const expr =
|
|
3654
|
+
const expr = ts26.factory.createPropertyAccessExpression(ts26.factory.createNonNullExpression(receiver), ast.name);
|
|
3267
3655
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
3268
3656
|
node = tsCastToAny(expr);
|
|
3269
3657
|
}
|
|
@@ -3275,13 +3663,13 @@ var AstTranslator = class {
|
|
|
3275
3663
|
const key = this.translate(ast.key);
|
|
3276
3664
|
let node;
|
|
3277
3665
|
if (this.config.strictSafeNavigationTypes) {
|
|
3278
|
-
const expr =
|
|
3666
|
+
const expr = ts26.factory.createElementAccessExpression(ts26.factory.createNonNullExpression(receiver), key);
|
|
3279
3667
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
3280
|
-
node =
|
|
3668
|
+
node = ts26.factory.createParenthesizedExpression(ts26.factory.createConditionalExpression(NULL_AS_ANY, void 0, expr, void 0, UNDEFINED));
|
|
3281
3669
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3282
|
-
node =
|
|
3670
|
+
node = ts26.factory.createElementAccessExpression(tsCastToAny(receiver), key);
|
|
3283
3671
|
} else {
|
|
3284
|
-
const expr =
|
|
3672
|
+
const expr = ts26.factory.createElementAccessExpression(ts26.factory.createNonNullExpression(receiver), key);
|
|
3285
3673
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
3286
3674
|
node = tsCastToAny(expr);
|
|
3287
3675
|
}
|
|
@@ -3298,7 +3686,7 @@ var AstTranslator = class {
|
|
|
3298
3686
|
expr = resolved;
|
|
3299
3687
|
} else {
|
|
3300
3688
|
const propertyReceiver = wrapForDiagnostics(this.translate(receiver.receiver));
|
|
3301
|
-
expr =
|
|
3689
|
+
expr = ts26.factory.createPropertyAccessExpression(propertyReceiver, receiver.name);
|
|
3302
3690
|
addParseSpanInfo(expr, receiver.nameSpan);
|
|
3303
3691
|
}
|
|
3304
3692
|
} else {
|
|
@@ -3308,7 +3696,7 @@ var AstTranslator = class {
|
|
|
3308
3696
|
if (ast.receiver instanceof SafePropertyRead2 || ast.receiver instanceof SafeKeyedRead) {
|
|
3309
3697
|
node = this.convertToSafeCall(ast, expr, args);
|
|
3310
3698
|
} else {
|
|
3311
|
-
node =
|
|
3699
|
+
node = ts26.factory.createCallExpression(expr, void 0, args);
|
|
3312
3700
|
}
|
|
3313
3701
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3314
3702
|
return node;
|
|
@@ -3322,13 +3710,13 @@ var AstTranslator = class {
|
|
|
3322
3710
|
}
|
|
3323
3711
|
convertToSafeCall(ast, expr, args) {
|
|
3324
3712
|
if (this.config.strictSafeNavigationTypes) {
|
|
3325
|
-
const call =
|
|
3326
|
-
return
|
|
3713
|
+
const call = ts26.factory.createCallExpression(ts26.factory.createNonNullExpression(expr), void 0, args);
|
|
3714
|
+
return ts26.factory.createParenthesizedExpression(ts26.factory.createConditionalExpression(NULL_AS_ANY, void 0, call, void 0, UNDEFINED));
|
|
3327
3715
|
}
|
|
3328
3716
|
if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3329
|
-
return
|
|
3717
|
+
return ts26.factory.createCallExpression(tsCastToAny(expr), void 0, args);
|
|
3330
3718
|
}
|
|
3331
|
-
return tsCastToAny(
|
|
3719
|
+
return tsCastToAny(ts26.factory.createCallExpression(ts26.factory.createNonNullExpression(expr), void 0, args));
|
|
3332
3720
|
}
|
|
3333
3721
|
};
|
|
3334
3722
|
var _VeSafeLhsInferenceBugDetector = class {
|
|
@@ -3405,7 +3793,7 @@ var VeSafeLhsInferenceBugDetector = _VeSafeLhsInferenceBugDetector;
|
|
|
3405
3793
|
_VeSafeLhsInferenceBugDetector.SINGLETON = new _VeSafeLhsInferenceBugDetector();
|
|
3406
3794
|
})();
|
|
3407
3795
|
|
|
3408
|
-
// bazel-out/
|
|
3796
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/template_semantics.mjs
|
|
3409
3797
|
import { ImplicitReceiver as ImplicitReceiver3, RecursiveAstVisitor as RecursiveAstVisitor2, TmplAstVariable } from "@angular/compiler";
|
|
3410
3798
|
var ExpressionSemanticVisitor = class extends RecursiveAstVisitor2 {
|
|
3411
3799
|
constructor(templateId, boundTarget, oob) {
|
|
@@ -3429,7 +3817,7 @@ var ExpressionSemanticVisitor = class extends RecursiveAstVisitor2 {
|
|
|
3429
3817
|
}
|
|
3430
3818
|
};
|
|
3431
3819
|
|
|
3432
|
-
// bazel-out/
|
|
3820
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.mjs
|
|
3433
3821
|
var TcbGenericContextBehavior;
|
|
3434
3822
|
(function(TcbGenericContextBehavior2) {
|
|
3435
3823
|
TcbGenericContextBehavior2[TcbGenericContextBehavior2["UseEmitter"] = 0] = "UseEmitter";
|
|
@@ -3440,7 +3828,7 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
|
|
|
3440
3828
|
const tcb = new Context(env, domSchemaChecker, oobRecorder, meta.id, meta.boundTarget, meta.pipes, meta.schemas, meta.isStandalone);
|
|
3441
3829
|
const scope = Scope.forNodes(tcb, null, tcb.boundTarget.target.template, null);
|
|
3442
3830
|
const ctxRawType = env.referenceType(ref);
|
|
3443
|
-
if (!
|
|
3831
|
+
if (!ts27.isTypeReferenceNode(ctxRawType)) {
|
|
3444
3832
|
throw new Error(`Expected TypeReferenceNode when referencing the ctx param for ${ref.debugName}`);
|
|
3445
3833
|
}
|
|
3446
3834
|
let typeParameters = void 0;
|
|
@@ -3452,25 +3840,25 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
|
|
|
3452
3840
|
switch (genericContextBehavior) {
|
|
3453
3841
|
case TcbGenericContextBehavior.UseEmitter:
|
|
3454
3842
|
typeParameters = new TypeParameterEmitter(ref.node.typeParameters, env.reflector).emit((typeRef) => env.referenceType(typeRef));
|
|
3455
|
-
typeArguments = typeParameters.map((param) =>
|
|
3843
|
+
typeArguments = typeParameters.map((param) => ts27.factory.createTypeReferenceNode(param.name));
|
|
3456
3844
|
break;
|
|
3457
3845
|
case TcbGenericContextBehavior.CopyClassNodes:
|
|
3458
3846
|
typeParameters = [...ref.node.typeParameters];
|
|
3459
|
-
typeArguments = typeParameters.map((param) =>
|
|
3847
|
+
typeArguments = typeParameters.map((param) => ts27.factory.createTypeReferenceNode(param.name));
|
|
3460
3848
|
break;
|
|
3461
3849
|
case TcbGenericContextBehavior.FallbackToAny:
|
|
3462
|
-
typeArguments = ref.node.typeParameters.map(() =>
|
|
3850
|
+
typeArguments = ref.node.typeParameters.map(() => ts27.factory.createKeywordTypeNode(ts27.SyntaxKind.AnyKeyword));
|
|
3463
3851
|
break;
|
|
3464
3852
|
}
|
|
3465
3853
|
}
|
|
3466
3854
|
const paramList = [tcbThisParam(ctxRawType.typeName, typeArguments)];
|
|
3467
3855
|
const scopeStatements = scope.render();
|
|
3468
|
-
const innerBody =
|
|
3856
|
+
const innerBody = ts27.factory.createBlock([
|
|
3469
3857
|
...env.getPreludeStatements(),
|
|
3470
3858
|
...scopeStatements
|
|
3471
3859
|
]);
|
|
3472
|
-
const body =
|
|
3473
|
-
const fnDecl =
|
|
3860
|
+
const body = ts27.factory.createBlock([ts27.factory.createIfStatement(ts27.factory.createTrue(), innerBody, void 0)]);
|
|
3861
|
+
const fnDecl = ts27.factory.createFunctionDeclaration(
|
|
3474
3862
|
void 0,
|
|
3475
3863
|
void 0,
|
|
3476
3864
|
name,
|
|
@@ -3505,7 +3893,7 @@ var TcbElementOp = class extends TcbOp {
|
|
|
3505
3893
|
return id;
|
|
3506
3894
|
}
|
|
3507
3895
|
};
|
|
3508
|
-
var
|
|
3896
|
+
var TcbTemplateVariableOp = class extends TcbOp {
|
|
3509
3897
|
constructor(tcb, scope, template, variable) {
|
|
3510
3898
|
super();
|
|
3511
3899
|
this.tcb = tcb;
|
|
@@ -3519,7 +3907,7 @@ var TcbVariableOp = class extends TcbOp {
|
|
|
3519
3907
|
execute() {
|
|
3520
3908
|
const ctx = this.scope.resolve(this.template);
|
|
3521
3909
|
const id = this.tcb.allocateId();
|
|
3522
|
-
const initializer =
|
|
3910
|
+
const initializer = ts27.factory.createPropertyAccessExpression(
|
|
3523
3911
|
ctx,
|
|
3524
3912
|
this.variable.value || "$implicit"
|
|
3525
3913
|
);
|
|
@@ -3545,7 +3933,7 @@ var TcbTemplateContextOp = class extends TcbOp {
|
|
|
3545
3933
|
}
|
|
3546
3934
|
execute() {
|
|
3547
3935
|
const ctx = this.tcb.allocateId();
|
|
3548
|
-
const type =
|
|
3936
|
+
const type = ts27.factory.createKeywordTypeNode(ts27.SyntaxKind.AnyKeyword);
|
|
3549
3937
|
this.scope.addStatement(tsDeclareVariable(ctx, type));
|
|
3550
3938
|
return ctx;
|
|
3551
3939
|
}
|
|
@@ -3598,16 +3986,16 @@ var TcbTemplateBodyOp = class extends TcbOp {
|
|
|
3598
3986
|
}
|
|
3599
3987
|
let guard = null;
|
|
3600
3988
|
if (directiveGuards.length > 0) {
|
|
3601
|
-
guard = directiveGuards.reduce((expr, dirGuard) =>
|
|
3989
|
+
guard = directiveGuards.reduce((expr, dirGuard) => ts27.factory.createBinaryExpression(expr, ts27.SyntaxKind.AmpersandAmpersandToken, dirGuard), directiveGuards.pop());
|
|
3602
3990
|
}
|
|
3603
3991
|
const tmplScope = Scope.forNodes(this.tcb, this.scope, this.template, guard);
|
|
3604
3992
|
const statements = tmplScope.render();
|
|
3605
3993
|
if (statements.length === 0) {
|
|
3606
3994
|
return null;
|
|
3607
3995
|
}
|
|
3608
|
-
let tmplBlock =
|
|
3996
|
+
let tmplBlock = ts27.factory.createBlock(statements);
|
|
3609
3997
|
if (guard !== null) {
|
|
3610
|
-
tmplBlock =
|
|
3998
|
+
tmplBlock = ts27.factory.createIfStatement(guard, tmplBlock);
|
|
3611
3999
|
}
|
|
3612
4000
|
this.scope.addStatement(tmplBlock);
|
|
3613
4001
|
return null;
|
|
@@ -3625,7 +4013,7 @@ var TcbExpressionOp = class extends TcbOp {
|
|
|
3625
4013
|
}
|
|
3626
4014
|
execute() {
|
|
3627
4015
|
const expr = tcbExpression(this.expression, this.tcb, this.scope);
|
|
3628
|
-
this.scope.addStatement(
|
|
4016
|
+
this.scope.addStatement(ts27.factory.createExpressionStatement(expr));
|
|
3629
4017
|
return null;
|
|
3630
4018
|
}
|
|
3631
4019
|
};
|
|
@@ -3647,11 +4035,11 @@ var TcbDirectiveTypeOpBase = class extends TcbOp {
|
|
|
3647
4035
|
if (this.dir.isGeneric === false || dirRef.node.typeParameters === void 0) {
|
|
3648
4036
|
type = rawType;
|
|
3649
4037
|
} else {
|
|
3650
|
-
if (!
|
|
4038
|
+
if (!ts27.isTypeReferenceNode(rawType)) {
|
|
3651
4039
|
throw new Error(`Expected TypeReferenceNode when referencing the type for ${this.dir.ref.debugName}`);
|
|
3652
4040
|
}
|
|
3653
|
-
const typeArguments = dirRef.node.typeParameters.map(() =>
|
|
3654
|
-
type =
|
|
4041
|
+
const typeArguments = dirRef.node.typeParameters.map(() => ts27.factory.createKeywordTypeNode(ts27.SyntaxKind.AnyKeyword));
|
|
4042
|
+
type = ts27.factory.createTypeReferenceNode(rawType.typeName, typeArguments);
|
|
3655
4043
|
}
|
|
3656
4044
|
const id = this.tcb.allocateId();
|
|
3657
4045
|
addExpressionIdentifier(type, ExpressionIdentifier.DIRECTIVE);
|
|
@@ -3692,11 +4080,11 @@ var TcbReferenceOp = class extends TcbOp {
|
|
|
3692
4080
|
const id = this.tcb.allocateId();
|
|
3693
4081
|
let initializer = this.target instanceof TmplAstTemplate2 || this.target instanceof TmplAstElement3 ? this.scope.resolve(this.target) : this.scope.resolve(this.host, this.target);
|
|
3694
4082
|
if (this.target instanceof TmplAstElement3 && !this.tcb.env.config.checkTypeOfDomReferences || !this.tcb.env.config.checkTypeOfNonDomReferences) {
|
|
3695
|
-
initializer =
|
|
4083
|
+
initializer = ts27.factory.createAsExpression(initializer, ts27.factory.createKeywordTypeNode(ts27.SyntaxKind.AnyKeyword));
|
|
3696
4084
|
} else if (this.target instanceof TmplAstTemplate2) {
|
|
3697
|
-
initializer =
|
|
3698
|
-
initializer =
|
|
3699
|
-
initializer =
|
|
4085
|
+
initializer = ts27.factory.createAsExpression(initializer, ts27.factory.createKeywordTypeNode(ts27.SyntaxKind.AnyKeyword));
|
|
4086
|
+
initializer = ts27.factory.createAsExpression(initializer, this.tcb.env.referenceExternalType("@angular/core", "TemplateRef", [DYNAMIC_TYPE]));
|
|
4087
|
+
initializer = ts27.factory.createParenthesizedExpression(initializer);
|
|
3700
4088
|
}
|
|
3701
4089
|
addParseSpanInfo(initializer, this.node.sourceSpan);
|
|
3702
4090
|
addParseSpanInfo(id, this.node.keySpan);
|
|
@@ -3789,7 +4177,7 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
3789
4177
|
type = this.tcb.env.referenceTransplantedType(new TransplantedType(transformType));
|
|
3790
4178
|
} else {
|
|
3791
4179
|
const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
|
|
3792
|
-
if (!
|
|
4180
|
+
if (!ts27.isTypeReferenceNode(dirTypeRef)) {
|
|
3793
4181
|
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
3794
4182
|
}
|
|
3795
4183
|
type = tsCreateTypeQueryForCoercedInput(dirTypeRef.typeName, fieldName);
|
|
@@ -3805,10 +4193,10 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
3805
4193
|
}
|
|
3806
4194
|
const id = this.tcb.allocateId();
|
|
3807
4195
|
const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
|
|
3808
|
-
if (!
|
|
4196
|
+
if (!ts27.isTypeReferenceNode(dirTypeRef)) {
|
|
3809
4197
|
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
3810
4198
|
}
|
|
3811
|
-
const type =
|
|
4199
|
+
const type = ts27.factory.createIndexedAccessTypeNode(ts27.factory.createTypeQueryNode(dirId), ts27.factory.createLiteralTypeNode(ts27.factory.createStringLiteral(fieldName)));
|
|
3812
4200
|
const temp = tsDeclareVariable(id, type);
|
|
3813
4201
|
this.scope.addStatement(temp);
|
|
3814
4202
|
target = id;
|
|
@@ -3816,18 +4204,18 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
3816
4204
|
if (dirId === null) {
|
|
3817
4205
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
3818
4206
|
}
|
|
3819
|
-
target = this.dir.stringLiteralInputFields.has(fieldName) ?
|
|
4207
|
+
target = this.dir.stringLiteralInputFields.has(fieldName) ? ts27.factory.createElementAccessExpression(dirId, ts27.factory.createStringLiteral(fieldName)) : ts27.factory.createPropertyAccessExpression(dirId, ts27.factory.createIdentifier(fieldName));
|
|
3820
4208
|
}
|
|
3821
4209
|
if (attr.attribute.keySpan !== void 0) {
|
|
3822
4210
|
addParseSpanInfo(target, attr.attribute.keySpan);
|
|
3823
4211
|
}
|
|
3824
|
-
assignment =
|
|
4212
|
+
assignment = ts27.factory.createBinaryExpression(target, ts27.SyntaxKind.EqualsToken, assignment);
|
|
3825
4213
|
}
|
|
3826
4214
|
addParseSpanInfo(assignment, attr.attribute.sourceSpan);
|
|
3827
4215
|
if (!this.tcb.env.config.checkTypeOfAttributes && attr.attribute instanceof TmplAstTextAttribute2) {
|
|
3828
4216
|
markIgnoreDiagnostics(assignment);
|
|
3829
4217
|
}
|
|
3830
|
-
this.scope.addStatement(
|
|
4218
|
+
this.scope.addStatement(ts27.factory.createExpressionStatement(assignment));
|
|
3831
4219
|
}
|
|
3832
4220
|
this.checkRequiredInputs(seenRequiredInputs);
|
|
3833
4221
|
return null;
|
|
@@ -3858,7 +4246,7 @@ var TcbDirectiveCtorCircularFallbackOp = class extends TcbOp {
|
|
|
3858
4246
|
execute() {
|
|
3859
4247
|
const id = this.tcb.allocateId();
|
|
3860
4248
|
const typeCtor = this.tcb.env.typeCtorFor(this.dir);
|
|
3861
|
-
const circularPlaceholder =
|
|
4249
|
+
const circularPlaceholder = ts27.factory.createCallExpression(typeCtor, void 0, [ts27.factory.createNonNullExpression(ts27.factory.createNull())]);
|
|
3862
4250
|
this.scope.addStatement(tsCreateVariable(id, circularPlaceholder));
|
|
3863
4251
|
return id;
|
|
3864
4252
|
}
|
|
@@ -3926,15 +4314,15 @@ var TcbUnclaimedInputsOp = class extends TcbOp {
|
|
|
3926
4314
|
elId = this.scope.resolve(this.element);
|
|
3927
4315
|
}
|
|
3928
4316
|
const propertyName = (_a = ATTR_TO_PROP.get(binding.name)) != null ? _a : binding.name;
|
|
3929
|
-
const prop =
|
|
3930
|
-
const stmt =
|
|
4317
|
+
const prop = ts27.factory.createElementAccessExpression(elId, ts27.factory.createStringLiteral(propertyName));
|
|
4318
|
+
const stmt = ts27.factory.createBinaryExpression(prop, ts27.SyntaxKind.EqualsToken, wrapForDiagnostics(expr));
|
|
3931
4319
|
addParseSpanInfo(stmt, binding.sourceSpan);
|
|
3932
|
-
this.scope.addStatement(
|
|
4320
|
+
this.scope.addStatement(ts27.factory.createExpressionStatement(stmt));
|
|
3933
4321
|
} else {
|
|
3934
|
-
this.scope.addStatement(
|
|
4322
|
+
this.scope.addStatement(ts27.factory.createExpressionStatement(expr));
|
|
3935
4323
|
}
|
|
3936
4324
|
} else {
|
|
3937
|
-
this.scope.addStatement(
|
|
4325
|
+
this.scope.addStatement(ts27.factory.createExpressionStatement(expr));
|
|
3938
4326
|
}
|
|
3939
4327
|
}
|
|
3940
4328
|
return null;
|
|
@@ -3966,18 +4354,18 @@ var TcbDirectiveOutputsOp = class extends TcbOp {
|
|
|
3966
4354
|
if (dirId === null) {
|
|
3967
4355
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
3968
4356
|
}
|
|
3969
|
-
const outputField =
|
|
4357
|
+
const outputField = ts27.factory.createElementAccessExpression(dirId, ts27.factory.createStringLiteral(field));
|
|
3970
4358
|
addParseSpanInfo(outputField, output.keySpan);
|
|
3971
4359
|
if (this.tcb.env.config.checkTypeOfOutputEvents) {
|
|
3972
4360
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
3973
|
-
const subscribeFn =
|
|
3974
|
-
const call =
|
|
4361
|
+
const subscribeFn = ts27.factory.createPropertyAccessExpression(outputField, "subscribe");
|
|
4362
|
+
const call = ts27.factory.createCallExpression(subscribeFn, void 0, [handler]);
|
|
3975
4363
|
addParseSpanInfo(call, output.sourceSpan);
|
|
3976
|
-
this.scope.addStatement(
|
|
4364
|
+
this.scope.addStatement(ts27.factory.createExpressionStatement(call));
|
|
3977
4365
|
} else {
|
|
3978
|
-
this.scope.addStatement(
|
|
4366
|
+
this.scope.addStatement(ts27.factory.createExpressionStatement(outputField));
|
|
3979
4367
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
3980
|
-
this.scope.addStatement(
|
|
4368
|
+
this.scope.addStatement(ts27.factory.createExpressionStatement(handler));
|
|
3981
4369
|
}
|
|
3982
4370
|
ExpressionSemanticVisitor.visit(output.handler, this.tcb.id, this.tcb.boundTarget, this.tcb.oobRecorder);
|
|
3983
4371
|
}
|
|
@@ -4010,24 +4398,24 @@ var TcbUnclaimedOutputsOp = class extends TcbOp {
|
|
|
4010
4398
|
if (output.type === 1) {
|
|
4011
4399
|
const eventType = this.tcb.env.config.checkTypeOfAnimationEvents ? this.tcb.env.referenceExternalType("@angular/animations", "AnimationEvent") : 1;
|
|
4012
4400
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, eventType);
|
|
4013
|
-
this.scope.addStatement(
|
|
4401
|
+
this.scope.addStatement(ts27.factory.createExpressionStatement(handler));
|
|
4014
4402
|
} else if (this.tcb.env.config.checkTypeOfDomEvents) {
|
|
4015
4403
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
4016
4404
|
if (elId === null) {
|
|
4017
4405
|
elId = this.scope.resolve(this.element);
|
|
4018
4406
|
}
|
|
4019
|
-
const propertyAccess =
|
|
4407
|
+
const propertyAccess = ts27.factory.createPropertyAccessExpression(elId, "addEventListener");
|
|
4020
4408
|
addParseSpanInfo(propertyAccess, output.keySpan);
|
|
4021
|
-
const call =
|
|
4409
|
+
const call = ts27.factory.createCallExpression(
|
|
4022
4410
|
propertyAccess,
|
|
4023
4411
|
void 0,
|
|
4024
|
-
[
|
|
4412
|
+
[ts27.factory.createStringLiteral(output.name), handler]
|
|
4025
4413
|
);
|
|
4026
4414
|
addParseSpanInfo(call, output.sourceSpan);
|
|
4027
|
-
this.scope.addStatement(
|
|
4415
|
+
this.scope.addStatement(ts27.factory.createExpressionStatement(call));
|
|
4028
4416
|
} else {
|
|
4029
4417
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
4030
|
-
this.scope.addStatement(
|
|
4418
|
+
this.scope.addStatement(ts27.factory.createExpressionStatement(handler));
|
|
4031
4419
|
}
|
|
4032
4420
|
ExpressionSemanticVisitor.visit(output.handler, this.tcb.id, this.tcb.boundTarget, this.tcb.oobRecorder);
|
|
4033
4421
|
}
|
|
@@ -4041,15 +4429,124 @@ var TcbComponentContextCompletionOp = class extends TcbOp {
|
|
|
4041
4429
|
this.optional = false;
|
|
4042
4430
|
}
|
|
4043
4431
|
execute() {
|
|
4044
|
-
const ctx =
|
|
4045
|
-
const ctxDot =
|
|
4432
|
+
const ctx = ts27.factory.createThis();
|
|
4433
|
+
const ctxDot = ts27.factory.createPropertyAccessExpression(ctx, "");
|
|
4046
4434
|
markIgnoreDiagnostics(ctxDot);
|
|
4047
4435
|
addExpressionIdentifier(ctxDot, ExpressionIdentifier.COMPONENT_COMPLETION);
|
|
4048
|
-
this.scope.addStatement(
|
|
4436
|
+
this.scope.addStatement(ts27.factory.createExpressionStatement(ctxDot));
|
|
4437
|
+
return null;
|
|
4438
|
+
}
|
|
4439
|
+
};
|
|
4440
|
+
var TcbBlockVariableOp = class extends TcbOp {
|
|
4441
|
+
constructor(tcb, scope, initializer, variable) {
|
|
4442
|
+
super();
|
|
4443
|
+
this.tcb = tcb;
|
|
4444
|
+
this.scope = scope;
|
|
4445
|
+
this.initializer = initializer;
|
|
4446
|
+
this.variable = variable;
|
|
4447
|
+
}
|
|
4448
|
+
get optional() {
|
|
4449
|
+
return false;
|
|
4450
|
+
}
|
|
4451
|
+
execute() {
|
|
4452
|
+
const id = this.tcb.allocateId();
|
|
4453
|
+
addParseSpanInfo(id, this.variable.keySpan);
|
|
4454
|
+
this.scope.addStatement(tsCreateVariable(id, this.initializer));
|
|
4455
|
+
return id;
|
|
4456
|
+
}
|
|
4457
|
+
};
|
|
4458
|
+
var TcbBlockImplicitVariableOp = class extends TcbOp {
|
|
4459
|
+
constructor(tcb, scope, type, variable) {
|
|
4460
|
+
super();
|
|
4461
|
+
this.tcb = tcb;
|
|
4462
|
+
this.scope = scope;
|
|
4463
|
+
this.type = type;
|
|
4464
|
+
this.variable = variable;
|
|
4465
|
+
}
|
|
4466
|
+
get optional() {
|
|
4467
|
+
return false;
|
|
4468
|
+
}
|
|
4469
|
+
execute() {
|
|
4470
|
+
const id = this.tcb.allocateId();
|
|
4471
|
+
addParseSpanInfo(id, this.variable.keySpan);
|
|
4472
|
+
this.scope.addStatement(tsDeclareVariable(id, this.type));
|
|
4473
|
+
return id;
|
|
4474
|
+
}
|
|
4475
|
+
};
|
|
4476
|
+
var TcbIfOp = class extends TcbOp {
|
|
4477
|
+
constructor(tcb, scope, block) {
|
|
4478
|
+
super();
|
|
4479
|
+
this.tcb = tcb;
|
|
4480
|
+
this.scope = scope;
|
|
4481
|
+
this.block = block;
|
|
4482
|
+
}
|
|
4483
|
+
get optional() {
|
|
4484
|
+
return false;
|
|
4485
|
+
}
|
|
4486
|
+
execute() {
|
|
4487
|
+
const root = this.generateBranch(0);
|
|
4488
|
+
root && this.scope.addStatement(root);
|
|
4049
4489
|
return null;
|
|
4050
4490
|
}
|
|
4491
|
+
generateBranch(index) {
|
|
4492
|
+
const branch = this.block.branches[index];
|
|
4493
|
+
if (!branch) {
|
|
4494
|
+
return void 0;
|
|
4495
|
+
}
|
|
4496
|
+
const branchScope = Scope.forNodes(this.tcb, this.scope, branch, null);
|
|
4497
|
+
return branch.expression === null ? ts27.factory.createBlock(branchScope.render()) : ts27.factory.createIfStatement(tcbExpression(branch.expression, this.tcb, branchScope), ts27.factory.createBlock(branchScope.render()), this.generateBranch(index + 1));
|
|
4498
|
+
}
|
|
4051
4499
|
};
|
|
4052
|
-
var
|
|
4500
|
+
var TcbSwitchOp = class extends TcbOp {
|
|
4501
|
+
constructor(tcb, scope, block) {
|
|
4502
|
+
super();
|
|
4503
|
+
this.tcb = tcb;
|
|
4504
|
+
this.scope = scope;
|
|
4505
|
+
this.block = block;
|
|
4506
|
+
}
|
|
4507
|
+
get optional() {
|
|
4508
|
+
return false;
|
|
4509
|
+
}
|
|
4510
|
+
execute() {
|
|
4511
|
+
const clauses = [];
|
|
4512
|
+
for (const current of this.block.cases) {
|
|
4513
|
+
const breakStatement = ts27.factory.createBreakStatement();
|
|
4514
|
+
const clauseScope = Scope.forNodes(this.tcb, this.scope, current.children, null);
|
|
4515
|
+
if (current.expression === null) {
|
|
4516
|
+
clauses.push(ts27.factory.createDefaultClause([...clauseScope.render(), breakStatement]));
|
|
4517
|
+
} else {
|
|
4518
|
+
clauses.push(ts27.factory.createCaseClause(tcbExpression(current.expression, this.tcb, clauseScope), [...clauseScope.render(), breakStatement]));
|
|
4519
|
+
}
|
|
4520
|
+
}
|
|
4521
|
+
this.scope.addStatement(ts27.factory.createSwitchStatement(tcbExpression(this.block.expression, this.tcb, this.scope), ts27.factory.createCaseBlock(clauses)));
|
|
4522
|
+
return null;
|
|
4523
|
+
}
|
|
4524
|
+
};
|
|
4525
|
+
var TcbForOfOp = class extends TcbOp {
|
|
4526
|
+
constructor(tcb, scope, block) {
|
|
4527
|
+
super();
|
|
4528
|
+
this.tcb = tcb;
|
|
4529
|
+
this.scope = scope;
|
|
4530
|
+
this.block = block;
|
|
4531
|
+
}
|
|
4532
|
+
get optional() {
|
|
4533
|
+
return false;
|
|
4534
|
+
}
|
|
4535
|
+
execute() {
|
|
4536
|
+
const loopScope = Scope.forNodes(this.tcb, this.scope, this.block, null);
|
|
4537
|
+
const initializer = ts27.factory.createVariableDeclarationList([ts27.factory.createVariableDeclaration(this.block.item.name)], ts27.NodeFlags.Const);
|
|
4538
|
+
const expression = tcbExpression(this.block.expression, this.tcb, loopScope);
|
|
4539
|
+
const trackTranslator = new TcbForLoopTrackTranslator(this.tcb, loopScope, this.block);
|
|
4540
|
+
const trackExpression = trackTranslator.translate(this.block.trackBy);
|
|
4541
|
+
const statements = [
|
|
4542
|
+
...loopScope.render(),
|
|
4543
|
+
ts27.factory.createExpressionStatement(trackExpression)
|
|
4544
|
+
];
|
|
4545
|
+
this.scope.addStatement(ts27.factory.createForOfStatement(void 0, initializer, expression, ts27.factory.createBlock(statements)));
|
|
4546
|
+
return null;
|
|
4547
|
+
}
|
|
4548
|
+
};
|
|
4549
|
+
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR = ts27.factory.createNonNullExpression(ts27.factory.createNull());
|
|
4053
4550
|
var Context = class {
|
|
4054
4551
|
constructor(env, domSchemaChecker, oobRecorder, id, boundTarget, pipes, schemas, hostIsStandalone) {
|
|
4055
4552
|
this.env = env;
|
|
@@ -4063,7 +4560,7 @@ var Context = class {
|
|
|
4063
4560
|
this.nextId = 1;
|
|
4064
4561
|
}
|
|
4065
4562
|
allocateId() {
|
|
4066
|
-
return
|
|
4563
|
+
return ts27.factory.createIdentifier(`_t${this.nextId++}`);
|
|
4067
4564
|
}
|
|
4068
4565
|
getPipeByName(name) {
|
|
4069
4566
|
if (!this.pipes.has(name)) {
|
|
@@ -4085,47 +4582,63 @@ var Scope = class {
|
|
|
4085
4582
|
this.varMap = /* @__PURE__ */ new Map();
|
|
4086
4583
|
this.statements = [];
|
|
4087
4584
|
}
|
|
4088
|
-
static forNodes(tcb, parent,
|
|
4585
|
+
static forNodes(tcb, parent, blockOrNodes, guard) {
|
|
4089
4586
|
const scope = new Scope(tcb, parent, guard);
|
|
4090
4587
|
if (parent === null && tcb.env.config.enableTemplateTypeChecker) {
|
|
4091
4588
|
scope.opQueue.push(new TcbComponentContextCompletionOp(scope));
|
|
4092
4589
|
}
|
|
4093
4590
|
let children;
|
|
4094
|
-
if (
|
|
4591
|
+
if (blockOrNodes instanceof TmplAstTemplate2) {
|
|
4095
4592
|
const varMap = /* @__PURE__ */ new Map();
|
|
4096
|
-
for (const v of
|
|
4593
|
+
for (const v of blockOrNodes.variables) {
|
|
4097
4594
|
if (!varMap.has(v.name)) {
|
|
4098
4595
|
varMap.set(v.name, v);
|
|
4099
4596
|
} else {
|
|
4100
4597
|
const firstDecl = varMap.get(v.name);
|
|
4101
4598
|
tcb.oobRecorder.duplicateTemplateVar(tcb.id, v, firstDecl);
|
|
4102
4599
|
}
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4600
|
+
this.registerVariable(scope, v, new TcbTemplateVariableOp(tcb, scope, blockOrNodes, v));
|
|
4601
|
+
}
|
|
4602
|
+
children = blockOrNodes.children;
|
|
4603
|
+
} else if (blockOrNodes instanceof TmplAstIfBlockBranch) {
|
|
4604
|
+
const { expression, expressionAlias } = blockOrNodes;
|
|
4605
|
+
if (expression !== null && expressionAlias !== null) {
|
|
4606
|
+
this.registerVariable(scope, expressionAlias, new TcbBlockVariableOp(tcb, scope, tcbExpression(expression, tcb, scope), expressionAlias));
|
|
4607
|
+
}
|
|
4608
|
+
children = blockOrNodes.children;
|
|
4609
|
+
} else if (blockOrNodes instanceof TmplAstForLoopBlock) {
|
|
4610
|
+
this.registerVariable(scope, blockOrNodes.item, new TcbBlockVariableOp(tcb, scope, ts27.factory.createIdentifier(blockOrNodes.item.name), blockOrNodes.item));
|
|
4611
|
+
for (const variable of Object.values(blockOrNodes.contextVariables)) {
|
|
4612
|
+
const type = ts27.factory.createKeywordTypeNode(ts27.SyntaxKind.NumberKeyword);
|
|
4613
|
+
this.registerVariable(scope, variable, new TcbBlockImplicitVariableOp(tcb, scope, type, variable));
|
|
4614
|
+
}
|
|
4615
|
+
children = blockOrNodes.children;
|
|
4107
4616
|
} else {
|
|
4108
|
-
children =
|
|
4617
|
+
children = blockOrNodes;
|
|
4109
4618
|
}
|
|
4110
4619
|
for (const node of children) {
|
|
4111
4620
|
scope.appendNode(node);
|
|
4112
4621
|
}
|
|
4113
4622
|
return scope;
|
|
4114
4623
|
}
|
|
4624
|
+
static registerVariable(scope, variable, op) {
|
|
4625
|
+
const opIndex = scope.opQueue.push(op) - 1;
|
|
4626
|
+
scope.varMap.set(variable, opIndex);
|
|
4627
|
+
}
|
|
4115
4628
|
resolve(node, directive) {
|
|
4116
4629
|
const res = this.resolveLocal(node, directive);
|
|
4117
4630
|
if (res !== null) {
|
|
4118
4631
|
let clone;
|
|
4119
|
-
if (
|
|
4120
|
-
clone =
|
|
4121
|
-
} else if (
|
|
4122
|
-
clone =
|
|
4632
|
+
if (ts27.isIdentifier(res)) {
|
|
4633
|
+
clone = ts27.factory.createIdentifier(res.text);
|
|
4634
|
+
} else if (ts27.isNonNullExpression(res)) {
|
|
4635
|
+
clone = ts27.factory.createNonNullExpression(res.expression);
|
|
4123
4636
|
} else {
|
|
4124
4637
|
throw new Error(`Could not resolve ${node} to an Identifier or a NonNullExpression`);
|
|
4125
4638
|
}
|
|
4126
|
-
|
|
4639
|
+
ts27.setOriginalNode(clone, res);
|
|
4127
4640
|
clone.parent = clone.parent;
|
|
4128
|
-
return
|
|
4641
|
+
return ts27.setSyntheticTrailingComments(clone, []);
|
|
4129
4642
|
} else if (this.parent !== null) {
|
|
4130
4643
|
return this.parent.resolve(node, directive);
|
|
4131
4644
|
} else {
|
|
@@ -4152,7 +4665,7 @@ var Scope = class {
|
|
|
4152
4665
|
} else if (parentGuards === null) {
|
|
4153
4666
|
return this.guard;
|
|
4154
4667
|
} else {
|
|
4155
|
-
return
|
|
4668
|
+
return ts27.factory.createBinaryExpression(parentGuards, ts27.SyntaxKind.AmpersandAmpersandToken, this.guard);
|
|
4156
4669
|
}
|
|
4157
4670
|
}
|
|
4158
4671
|
resolveLocal(ref, directive) {
|
|
@@ -4215,22 +4728,13 @@ var Scope = class {
|
|
|
4215
4728
|
}
|
|
4216
4729
|
this.checkAndAppendReferencesOfNode(node);
|
|
4217
4730
|
} else if (node instanceof TmplAstDeferredBlock) {
|
|
4218
|
-
|
|
4219
|
-
node.prefetchTriggers.when !== void 0 && this.opQueue.push(new TcbExpressionOp(this.tcb, this, node.prefetchTriggers.when.value));
|
|
4220
|
-
this.appendChildren(node);
|
|
4221
|
-
node.placeholder !== null && this.appendChildren(node.placeholder);
|
|
4222
|
-
node.loading !== null && this.appendChildren(node.loading);
|
|
4223
|
-
node.error !== null && this.appendChildren(node.error);
|
|
4731
|
+
this.appendDeferredBlock(node);
|
|
4224
4732
|
} else if (node instanceof TmplAstIfBlock) {
|
|
4225
|
-
|
|
4226
|
-
this.appendChildren(branch);
|
|
4227
|
-
}
|
|
4733
|
+
this.opQueue.push(new TcbIfOp(this.tcb, this, node));
|
|
4228
4734
|
} else if (node instanceof TmplAstSwitchBlock) {
|
|
4229
|
-
|
|
4230
|
-
this.appendChildren(currentCase);
|
|
4231
|
-
}
|
|
4735
|
+
this.opQueue.push(new TcbSwitchOp(this.tcb, this, node));
|
|
4232
4736
|
} else if (node instanceof TmplAstForLoopBlock) {
|
|
4233
|
-
this.
|
|
4737
|
+
this.opQueue.push(new TcbForOfOp(this.tcb, this, node));
|
|
4234
4738
|
node.empty && this.appendChildren(node.empty);
|
|
4235
4739
|
} else if (node instanceof TmplAstBoundText) {
|
|
4236
4740
|
this.opQueue.push(new TcbExpressionOp(this.tcb, this, node.value));
|
|
@@ -4351,14 +4855,47 @@ var Scope = class {
|
|
|
4351
4855
|
}
|
|
4352
4856
|
}
|
|
4353
4857
|
}
|
|
4858
|
+
appendDeferredBlock(block) {
|
|
4859
|
+
this.appendDeferredTriggers(block, block.triggers);
|
|
4860
|
+
this.appendDeferredTriggers(block, block.prefetchTriggers);
|
|
4861
|
+
this.appendChildren(block);
|
|
4862
|
+
if (block.placeholder !== null) {
|
|
4863
|
+
this.appendChildren(block.placeholder);
|
|
4864
|
+
}
|
|
4865
|
+
if (block.loading !== null) {
|
|
4866
|
+
this.appendChildren(block.loading);
|
|
4867
|
+
}
|
|
4868
|
+
if (block.error !== null) {
|
|
4869
|
+
this.appendChildren(block.error);
|
|
4870
|
+
}
|
|
4871
|
+
}
|
|
4872
|
+
appendDeferredTriggers(block, triggers) {
|
|
4873
|
+
if (triggers.when !== void 0) {
|
|
4874
|
+
this.opQueue.push(new TcbExpressionOp(this.tcb, this, triggers.when.value));
|
|
4875
|
+
}
|
|
4876
|
+
if (triggers.hover !== void 0) {
|
|
4877
|
+
this.appendReferenceBasedDeferredTrigger(block, triggers.hover);
|
|
4878
|
+
}
|
|
4879
|
+
if (triggers.interaction !== void 0) {
|
|
4880
|
+
this.appendReferenceBasedDeferredTrigger(block, triggers.interaction);
|
|
4881
|
+
}
|
|
4882
|
+
if (triggers.viewport !== void 0) {
|
|
4883
|
+
this.appendReferenceBasedDeferredTrigger(block, triggers.viewport);
|
|
4884
|
+
}
|
|
4885
|
+
}
|
|
4886
|
+
appendReferenceBasedDeferredTrigger(block, trigger) {
|
|
4887
|
+
if (this.tcb.boundTarget.getDeferredTriggerTarget(block, trigger) === null) {
|
|
4888
|
+
this.tcb.oobRecorder.inaccessibleDeferredTriggerElement(this.tcb.id, trigger);
|
|
4889
|
+
}
|
|
4890
|
+
}
|
|
4354
4891
|
};
|
|
4355
4892
|
function tcbThisParam(name, typeArguments) {
|
|
4356
|
-
return
|
|
4893
|
+
return ts27.factory.createParameterDeclaration(
|
|
4357
4894
|
void 0,
|
|
4358
4895
|
void 0,
|
|
4359
4896
|
"this",
|
|
4360
4897
|
void 0,
|
|
4361
|
-
|
|
4898
|
+
ts27.factory.createTypeReferenceNode(name, typeArguments),
|
|
4362
4899
|
void 0
|
|
4363
4900
|
);
|
|
4364
4901
|
}
|
|
@@ -4383,11 +4920,11 @@ var TcbExpressionTranslator = class {
|
|
|
4383
4920
|
return null;
|
|
4384
4921
|
}
|
|
4385
4922
|
const expr = this.translate(ast.value);
|
|
4386
|
-
const result =
|
|
4923
|
+
const result = ts27.factory.createParenthesizedExpression(ts27.factory.createBinaryExpression(target, ts27.SyntaxKind.EqualsToken, expr));
|
|
4387
4924
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
4388
4925
|
return result;
|
|
4389
4926
|
} else if (ast instanceof ImplicitReceiver4) {
|
|
4390
|
-
return
|
|
4927
|
+
return ts27.factory.createThis();
|
|
4391
4928
|
} else if (ast instanceof BindingPipe) {
|
|
4392
4929
|
const expr = this.translate(ast.exp);
|
|
4393
4930
|
const pipeRef = this.tcb.getPipeByName(ast.name);
|
|
@@ -4399,12 +4936,12 @@ var TcbExpressionTranslator = class {
|
|
|
4399
4936
|
pipe = this.tcb.env.pipeInst(pipeRef);
|
|
4400
4937
|
}
|
|
4401
4938
|
const args = ast.args.map((arg) => this.translate(arg));
|
|
4402
|
-
let methodAccess =
|
|
4939
|
+
let methodAccess = ts27.factory.createPropertyAccessExpression(pipe, "transform");
|
|
4403
4940
|
addParseSpanInfo(methodAccess, ast.nameSpan);
|
|
4404
4941
|
if (!this.tcb.env.config.checkTypeOfPipes) {
|
|
4405
|
-
methodAccess =
|
|
4942
|
+
methodAccess = ts27.factory.createAsExpression(methodAccess, ts27.factory.createKeywordTypeNode(ts27.SyntaxKind.AnyKeyword));
|
|
4406
4943
|
}
|
|
4407
|
-
const result =
|
|
4944
|
+
const result = ts27.factory.createCallExpression(
|
|
4408
4945
|
methodAccess,
|
|
4409
4946
|
void 0,
|
|
4410
4947
|
[expr, ...args]
|
|
@@ -4414,8 +4951,8 @@ var TcbExpressionTranslator = class {
|
|
|
4414
4951
|
} else if ((ast instanceof Call2 || ast instanceof SafeCall) && (ast.receiver instanceof PropertyRead4 || ast.receiver instanceof SafePropertyRead3)) {
|
|
4415
4952
|
if (ast.receiver.receiver instanceof ImplicitReceiver4 && !(ast.receiver.receiver instanceof ThisReceiver) && ast.receiver.name === "$any" && ast.args.length === 1) {
|
|
4416
4953
|
const expr = this.translate(ast.args[0]);
|
|
4417
|
-
const exprAsAny =
|
|
4418
|
-
const result =
|
|
4954
|
+
const exprAsAny = ts27.factory.createAsExpression(expr, ts27.factory.createKeywordTypeNode(ts27.SyntaxKind.AnyKeyword));
|
|
4955
|
+
const result = ts27.factory.createParenthesizedExpression(exprAsAny);
|
|
4419
4956
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
4420
4957
|
return result;
|
|
4421
4958
|
}
|
|
@@ -4426,7 +4963,7 @@ var TcbExpressionTranslator = class {
|
|
|
4426
4963
|
const method = wrapForDiagnostics(receiver);
|
|
4427
4964
|
addParseSpanInfo(method, ast.receiver.nameSpan);
|
|
4428
4965
|
const args = ast.args.map((arg) => this.translate(arg));
|
|
4429
|
-
const node =
|
|
4966
|
+
const node = ts27.factory.createCallExpression(method, void 0, args);
|
|
4430
4967
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
4431
4968
|
return node;
|
|
4432
4969
|
} else {
|
|
@@ -4446,20 +4983,20 @@ var TcbExpressionTranslator = class {
|
|
|
4446
4983
|
function tcbCallTypeCtor(dir, tcb, inputs) {
|
|
4447
4984
|
const typeCtor = tcb.env.typeCtorFor(dir);
|
|
4448
4985
|
const members = inputs.map((input) => {
|
|
4449
|
-
const propertyName =
|
|
4986
|
+
const propertyName = ts27.factory.createStringLiteral(input.field);
|
|
4450
4987
|
if (input.type === "binding") {
|
|
4451
4988
|
const expr = widenBinding(input.expression, tcb);
|
|
4452
|
-
const assignment =
|
|
4989
|
+
const assignment = ts27.factory.createPropertyAssignment(propertyName, wrapForDiagnostics(expr));
|
|
4453
4990
|
addParseSpanInfo(assignment, input.sourceSpan);
|
|
4454
4991
|
return assignment;
|
|
4455
4992
|
} else {
|
|
4456
|
-
return
|
|
4993
|
+
return ts27.factory.createPropertyAssignment(propertyName, NULL_AS_ANY);
|
|
4457
4994
|
}
|
|
4458
4995
|
});
|
|
4459
|
-
return
|
|
4996
|
+
return ts27.factory.createCallExpression(
|
|
4460
4997
|
typeCtor,
|
|
4461
4998
|
void 0,
|
|
4462
|
-
[
|
|
4999
|
+
[ts27.factory.createObjectLiteralExpression(members)]
|
|
4463
5000
|
);
|
|
4464
5001
|
}
|
|
4465
5002
|
function getBoundAttributes(directive, node) {
|
|
@@ -4494,17 +5031,17 @@ function translateInput(attr, tcb, scope) {
|
|
|
4494
5031
|
if (attr instanceof TmplAstBoundAttribute) {
|
|
4495
5032
|
return tcbExpression(attr.value, tcb, scope);
|
|
4496
5033
|
} else {
|
|
4497
|
-
return
|
|
5034
|
+
return ts27.factory.createStringLiteral(attr.value);
|
|
4498
5035
|
}
|
|
4499
5036
|
}
|
|
4500
5037
|
function widenBinding(expr, tcb) {
|
|
4501
5038
|
if (!tcb.env.config.checkTypeOfInputBindings) {
|
|
4502
5039
|
return tsCastToAny(expr);
|
|
4503
5040
|
} else if (!tcb.env.config.strictNullInputBindings) {
|
|
4504
|
-
if (
|
|
5041
|
+
if (ts27.isObjectLiteralExpression(expr) || ts27.isArrayLiteralExpression(expr)) {
|
|
4505
5042
|
return expr;
|
|
4506
5043
|
} else {
|
|
4507
|
-
return
|
|
5044
|
+
return ts27.factory.createNonNullExpression(expr);
|
|
4508
5045
|
}
|
|
4509
5046
|
} else {
|
|
4510
5047
|
return expr;
|
|
@@ -4517,16 +5054,16 @@ function tcbCreateEventHandler(event, tcb, scope, eventType) {
|
|
|
4517
5054
|
if (eventType === 0) {
|
|
4518
5055
|
eventParamType = void 0;
|
|
4519
5056
|
} else if (eventType === 1) {
|
|
4520
|
-
eventParamType =
|
|
5057
|
+
eventParamType = ts27.factory.createKeywordTypeNode(ts27.SyntaxKind.AnyKeyword);
|
|
4521
5058
|
} else {
|
|
4522
5059
|
eventParamType = eventType;
|
|
4523
5060
|
}
|
|
4524
5061
|
const guards = scope.guards();
|
|
4525
|
-
let body =
|
|
5062
|
+
let body = ts27.factory.createExpressionStatement(handler);
|
|
4526
5063
|
if (guards !== null) {
|
|
4527
|
-
body =
|
|
5064
|
+
body = ts27.factory.createIfStatement(guards, body);
|
|
4528
5065
|
}
|
|
4529
|
-
const eventParam =
|
|
5066
|
+
const eventParam = ts27.factory.createParameterDeclaration(
|
|
4530
5067
|
void 0,
|
|
4531
5068
|
void 0,
|
|
4532
5069
|
EVENT_PARAMETER,
|
|
@@ -4534,13 +5071,13 @@ function tcbCreateEventHandler(event, tcb, scope, eventType) {
|
|
|
4534
5071
|
eventParamType
|
|
4535
5072
|
);
|
|
4536
5073
|
addExpressionIdentifier(eventParam, ExpressionIdentifier.EVENT_PARAMETER);
|
|
4537
|
-
return
|
|
5074
|
+
return ts27.factory.createArrowFunction(
|
|
4538
5075
|
void 0,
|
|
4539
5076
|
void 0,
|
|
4540
5077
|
[eventParam],
|
|
4541
|
-
|
|
5078
|
+
ts27.factory.createKeywordTypeNode(ts27.SyntaxKind.AnyKeyword),
|
|
4542
5079
|
void 0,
|
|
4543
|
-
|
|
5080
|
+
ts27.factory.createBlock([body])
|
|
4544
5081
|
);
|
|
4545
5082
|
}
|
|
4546
5083
|
function tcbEventHandlerExpression(ast, tcb, scope) {
|
|
@@ -4569,41 +5106,56 @@ function isSplitTwoWayBinding(inputName, output, inputs, tcb) {
|
|
|
4569
5106
|
var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
|
|
4570
5107
|
resolve(ast) {
|
|
4571
5108
|
if (ast instanceof PropertyRead4 && ast.receiver instanceof ImplicitReceiver4 && !(ast.receiver instanceof ThisReceiver) && ast.name === EVENT_PARAMETER) {
|
|
4572
|
-
const event =
|
|
5109
|
+
const event = ts27.factory.createIdentifier(EVENT_PARAMETER);
|
|
4573
5110
|
addParseSpanInfo(event, ast.nameSpan);
|
|
4574
5111
|
return event;
|
|
4575
5112
|
}
|
|
4576
5113
|
return super.resolve(ast);
|
|
4577
5114
|
}
|
|
4578
5115
|
};
|
|
5116
|
+
var TcbForLoopTrackTranslator = class extends TcbExpressionTranslator {
|
|
5117
|
+
constructor(tcb, scope, block) {
|
|
5118
|
+
super(tcb, scope);
|
|
5119
|
+
this.block = block;
|
|
5120
|
+
}
|
|
5121
|
+
resolve(ast) {
|
|
5122
|
+
if (ast instanceof PropertyRead4 && ast.receiver instanceof ImplicitReceiver4) {
|
|
5123
|
+
const target = this.tcb.boundTarget.getExpressionTarget(ast);
|
|
5124
|
+
if (target !== null && target !== this.block.item && target !== this.block.contextVariables.$index) {
|
|
5125
|
+
this.tcb.oobRecorder.illegalForLoopTrackAccess(this.tcb.id, this.block, ast);
|
|
5126
|
+
}
|
|
5127
|
+
}
|
|
5128
|
+
return super.resolve(ast);
|
|
5129
|
+
}
|
|
5130
|
+
};
|
|
4579
5131
|
|
|
4580
|
-
// bazel-out/
|
|
4581
|
-
import
|
|
5132
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_file.mjs
|
|
5133
|
+
import ts28 from "typescript";
|
|
4582
5134
|
var TypeCheckFile = class extends Environment {
|
|
4583
5135
|
constructor(fileName, config, refEmitter, reflector, compilerHost) {
|
|
4584
|
-
super(config, new ImportManager(new NoopImportRewriter(), "i"), refEmitter, reflector,
|
|
5136
|
+
super(config, new ImportManager(new NoopImportRewriter(), "i"), refEmitter, reflector, ts28.createSourceFile(compilerHost.getCanonicalFileName(fileName), "", ts28.ScriptTarget.Latest, true));
|
|
4585
5137
|
this.fileName = fileName;
|
|
4586
5138
|
this.nextTcbId = 1;
|
|
4587
5139
|
this.tcbStatements = [];
|
|
4588
5140
|
}
|
|
4589
5141
|
addTypeCheckBlock(ref, meta, domSchemaChecker, oobRecorder, genericContextBehavior) {
|
|
4590
|
-
const fnId =
|
|
5142
|
+
const fnId = ts28.factory.createIdentifier(`_tcb${this.nextTcbId++}`);
|
|
4591
5143
|
const fn = generateTypeCheckBlock(this, ref, fnId, meta, domSchemaChecker, oobRecorder, genericContextBehavior);
|
|
4592
5144
|
this.tcbStatements.push(fn);
|
|
4593
5145
|
}
|
|
4594
5146
|
render(removeComments) {
|
|
4595
5147
|
let source = this.importManager.getAllImports(this.contextFile.fileName).map((i) => `import * as ${i.qualifier.text} from '${i.specifier}';`).join("\n") + "\n\n";
|
|
4596
|
-
const printer =
|
|
5148
|
+
const printer = ts28.createPrinter({ removeComments });
|
|
4597
5149
|
source += "\n";
|
|
4598
5150
|
for (const stmt of this.pipeInstStatements) {
|
|
4599
|
-
source += printer.printNode(
|
|
5151
|
+
source += printer.printNode(ts28.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
4600
5152
|
}
|
|
4601
5153
|
for (const stmt of this.typeCtorStatements) {
|
|
4602
|
-
source += printer.printNode(
|
|
5154
|
+
source += printer.printNode(ts28.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
4603
5155
|
}
|
|
4604
5156
|
source += "\n";
|
|
4605
5157
|
for (const stmt of this.tcbStatements) {
|
|
4606
|
-
source += printer.printNode(
|
|
5158
|
+
source += printer.printNode(ts28.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
4607
5159
|
}
|
|
4608
5160
|
source += "\nexport const IS_A_MODULE = true;\n";
|
|
4609
5161
|
return source;
|
|
@@ -4613,7 +5165,7 @@ var TypeCheckFile = class extends Environment {
|
|
|
4613
5165
|
}
|
|
4614
5166
|
};
|
|
4615
5167
|
|
|
4616
|
-
// bazel-out/
|
|
5168
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/context.mjs
|
|
4617
5169
|
var InliningMode;
|
|
4618
5170
|
(function(InliningMode2) {
|
|
4619
5171
|
InliningMode2[InliningMode2["InlineOps"] = 0] = "InlineOps";
|
|
@@ -4718,7 +5270,7 @@ var TypeCheckContextImpl = class {
|
|
|
4718
5270
|
const importManager = new ImportManager(new NoopImportRewriter(), "_i");
|
|
4719
5271
|
const ops = this.opMap.get(sf).sort(orderOps);
|
|
4720
5272
|
const textParts = splitStringAtPoints(sf.text, ops.map((op) => op.splitPoint));
|
|
4721
|
-
const printer =
|
|
5273
|
+
const printer = ts29.createPrinter({ omitTrailingSemicolon: true });
|
|
4722
5274
|
let code = textParts[0];
|
|
4723
5275
|
ops.forEach((op, idx) => {
|
|
4724
5276
|
const text = op.execute(importManager, sf, this.refEmitter, printer);
|
|
@@ -4799,7 +5351,7 @@ var TypeCheckContextImpl = class {
|
|
|
4799
5351
|
if (span.start.offset === span.end.offset) {
|
|
4800
5352
|
span.end.offset++;
|
|
4801
5353
|
}
|
|
4802
|
-
return makeTemplateDiagnostic(templateId, sourceMapping, span,
|
|
5354
|
+
return makeTemplateDiagnostic(templateId, sourceMapping, span, ts29.DiagnosticCategory.Error, ngErrorCode(ErrorCode.TEMPLATE_PARSE_ERROR), error.msg);
|
|
4803
5355
|
});
|
|
4804
5356
|
}
|
|
4805
5357
|
};
|
|
@@ -4817,9 +5369,9 @@ var InlineTcbOp = class {
|
|
|
4817
5369
|
}
|
|
4818
5370
|
execute(im, sf, refEmitter, printer) {
|
|
4819
5371
|
const env = new Environment(this.config, im, refEmitter, this.reflector, sf);
|
|
4820
|
-
const fnName =
|
|
5372
|
+
const fnName = ts29.factory.createIdentifier(`_tcb_${this.ref.node.pos}`);
|
|
4821
5373
|
const fn = generateTypeCheckBlock(env, this.ref, fnName, this.meta, this.domSchemaChecker, this.oobRecorder, TcbGenericContextBehavior.CopyClassNodes);
|
|
4822
|
-
return printer.printNode(
|
|
5374
|
+
return printer.printNode(ts29.EmitHint.Unspecified, fn, sf);
|
|
4823
5375
|
}
|
|
4824
5376
|
};
|
|
4825
5377
|
var TypeCtorOp = class {
|
|
@@ -4832,7 +5384,7 @@ var TypeCtorOp = class {
|
|
|
4832
5384
|
}
|
|
4833
5385
|
execute(im, sf, refEmitter, printer) {
|
|
4834
5386
|
const tcb = generateInlineTypeCtor(this.ref.node, this.meta);
|
|
4835
|
-
return printer.printNode(
|
|
5387
|
+
return printer.printNode(ts29.EmitHint.Unspecified, tcb, sf);
|
|
4836
5388
|
}
|
|
4837
5389
|
};
|
|
4838
5390
|
function orderOps(op1, op2) {
|
|
@@ -4850,10 +5402,10 @@ function splitStringAtPoints(str, points) {
|
|
|
4850
5402
|
return splits;
|
|
4851
5403
|
}
|
|
4852
5404
|
|
|
4853
|
-
// bazel-out/
|
|
5405
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/source.mjs
|
|
4854
5406
|
import { ParseLocation, ParseSourceSpan } from "@angular/compiler";
|
|
4855
5407
|
|
|
4856
|
-
// bazel-out/
|
|
5408
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/line_mappings.mjs
|
|
4857
5409
|
var LF_CHAR = 10;
|
|
4858
5410
|
var CR_CHAR = 13;
|
|
4859
5411
|
var LINE_SEP_CHAR = 8232;
|
|
@@ -4894,7 +5446,7 @@ function findClosestLineStartPosition(linesMap, position, low = 0, high = linesM
|
|
|
4894
5446
|
return low - 1;
|
|
4895
5447
|
}
|
|
4896
5448
|
|
|
4897
|
-
// bazel-out/
|
|
5449
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/source.mjs
|
|
4898
5450
|
var TemplateSource = class {
|
|
4899
5451
|
constructor(mapping, file) {
|
|
4900
5452
|
this.mapping = mapping;
|
|
@@ -4945,9 +5497,9 @@ var TemplateSourceManager = class {
|
|
|
4945
5497
|
}
|
|
4946
5498
|
};
|
|
4947
5499
|
|
|
4948
|
-
// bazel-out/
|
|
5500
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/template_symbol_builder.mjs
|
|
4949
5501
|
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";
|
|
4950
|
-
import
|
|
5502
|
+
import ts30 from "typescript";
|
|
4951
5503
|
var SymbolBuilder = class {
|
|
4952
5504
|
constructor(tcbPath, tcbIsShim, typeCheckBlock, templateData, componentScopeReader, getTypeChecker) {
|
|
4953
5505
|
this.tcbPath = tcbPath;
|
|
@@ -4991,7 +5543,7 @@ var SymbolBuilder = class {
|
|
|
4991
5543
|
getSymbolOfElement(element) {
|
|
4992
5544
|
var _a;
|
|
4993
5545
|
const elementSourceSpan = (_a = element.startSourceSpan) != null ? _a : element.sourceSpan;
|
|
4994
|
-
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: elementSourceSpan, filter:
|
|
5546
|
+
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: elementSourceSpan, filter: ts30.isVariableDeclaration });
|
|
4995
5547
|
if (node === null) {
|
|
4996
5548
|
return null;
|
|
4997
5549
|
}
|
|
@@ -5011,12 +5563,12 @@ var SymbolBuilder = class {
|
|
|
5011
5563
|
var _a;
|
|
5012
5564
|
const elementSourceSpan = (_a = element.startSourceSpan) != null ? _a : element.sourceSpan;
|
|
5013
5565
|
const tcbSourceFile = this.typeCheckBlock.getSourceFile();
|
|
5014
|
-
const isDirectiveDeclaration = (node) => (
|
|
5566
|
+
const isDirectiveDeclaration = (node) => (ts30.isTypeNode(node) || ts30.isIdentifier(node)) && ts30.isVariableDeclaration(node.parent) && hasExpressionIdentifier(tcbSourceFile, node, ExpressionIdentifier.DIRECTIVE);
|
|
5015
5567
|
const nodes = findAllMatchingNodes(this.typeCheckBlock, { withSpan: elementSourceSpan, filter: isDirectiveDeclaration });
|
|
5016
5568
|
const symbols = [];
|
|
5017
5569
|
for (const node of nodes) {
|
|
5018
5570
|
const symbol = this.getSymbolOfTsNode(node.parent);
|
|
5019
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
5571
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts30.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
5020
5572
|
continue;
|
|
5021
5573
|
}
|
|
5022
5574
|
const meta = this.getDirectiveMeta(element, symbol.tsSymbol.valueDeclaration);
|
|
@@ -5044,7 +5596,7 @@ var SymbolBuilder = class {
|
|
|
5044
5596
|
}
|
|
5045
5597
|
addHostDirectiveSymbols(host, hostDirectives, symbols) {
|
|
5046
5598
|
for (const current of hostDirectives) {
|
|
5047
|
-
if (!
|
|
5599
|
+
if (!ts30.isClassDeclaration(current.directive.node)) {
|
|
5048
5600
|
continue;
|
|
5049
5601
|
}
|
|
5050
5602
|
const symbol = this.getSymbolOfTsNode(current.directive.node);
|
|
@@ -5117,17 +5669,17 @@ var SymbolBuilder = class {
|
|
|
5117
5669
|
if (!isAccessExpression(n)) {
|
|
5118
5670
|
return false;
|
|
5119
5671
|
}
|
|
5120
|
-
if (
|
|
5672
|
+
if (ts30.isPropertyAccessExpression(n)) {
|
|
5121
5673
|
return n.name.getText() === expectedAccess;
|
|
5122
5674
|
} else {
|
|
5123
|
-
return
|
|
5675
|
+
return ts30.isStringLiteral(n.argumentExpression) && n.argumentExpression.text === expectedAccess;
|
|
5124
5676
|
}
|
|
5125
5677
|
}
|
|
5126
5678
|
const outputFieldAccesses = findAllMatchingNodes(this.typeCheckBlock, { withSpan: eventBinding.keySpan, filter });
|
|
5127
5679
|
const bindings = [];
|
|
5128
5680
|
for (const outputFieldAccess of outputFieldAccesses) {
|
|
5129
5681
|
if (consumer instanceof TmplAstTemplate3 || consumer instanceof TmplAstElement4) {
|
|
5130
|
-
if (!
|
|
5682
|
+
if (!ts30.isPropertyAccessExpression(outputFieldAccess)) {
|
|
5131
5683
|
continue;
|
|
5132
5684
|
}
|
|
5133
5685
|
const addEventListener = outputFieldAccess.name;
|
|
@@ -5150,7 +5702,7 @@ var SymbolBuilder = class {
|
|
|
5150
5702
|
}
|
|
5151
5703
|
});
|
|
5152
5704
|
} else {
|
|
5153
|
-
if (!
|
|
5705
|
+
if (!ts30.isElementAccessExpression(outputFieldAccess)) {
|
|
5154
5706
|
continue;
|
|
5155
5707
|
}
|
|
5156
5708
|
const tsSymbol = this.getTypeChecker().getSymbolAtLocation(outputFieldAccess.argumentExpression);
|
|
@@ -5223,7 +5775,7 @@ var SymbolBuilder = class {
|
|
|
5223
5775
|
return null;
|
|
5224
5776
|
}
|
|
5225
5777
|
const [declaration] = tsSymbol.declarations;
|
|
5226
|
-
if (!
|
|
5778
|
+
if (!ts30.isVariableDeclaration(declaration) || !hasExpressionIdentifier(
|
|
5227
5779
|
declaration.getSourceFile(),
|
|
5228
5780
|
(_a = declaration.type) != null ? _a : declaration.name,
|
|
5229
5781
|
ExpressionIdentifier.DIRECTIVE
|
|
@@ -5231,7 +5783,7 @@ var SymbolBuilder = class {
|
|
|
5231
5783
|
return null;
|
|
5232
5784
|
}
|
|
5233
5785
|
const symbol = this.getSymbolOfTsNode(declaration);
|
|
5234
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
5786
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts30.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
5235
5787
|
return null;
|
|
5236
5788
|
}
|
|
5237
5789
|
const ref = new Reference(symbol.tsSymbol.valueDeclaration);
|
|
@@ -5251,7 +5803,7 @@ var SymbolBuilder = class {
|
|
|
5251
5803
|
};
|
|
5252
5804
|
}
|
|
5253
5805
|
getSymbolOfVariable(variable) {
|
|
5254
|
-
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: variable.sourceSpan, filter:
|
|
5806
|
+
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: variable.sourceSpan, filter: ts30.isVariableDeclaration });
|
|
5255
5807
|
if (node === null || node.initializer === void 0) {
|
|
5256
5808
|
return null;
|
|
5257
5809
|
}
|
|
@@ -5274,11 +5826,11 @@ var SymbolBuilder = class {
|
|
|
5274
5826
|
}
|
|
5275
5827
|
getSymbolOfReference(ref) {
|
|
5276
5828
|
const target = this.templateData.boundTarget.getReferenceTarget(ref);
|
|
5277
|
-
let node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: ref.sourceSpan, filter:
|
|
5829
|
+
let node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: ref.sourceSpan, filter: ts30.isVariableDeclaration });
|
|
5278
5830
|
if (node === null || target === null || node.initializer === void 0) {
|
|
5279
5831
|
return null;
|
|
5280
5832
|
}
|
|
5281
|
-
const originalDeclaration =
|
|
5833
|
+
const originalDeclaration = ts30.isParenthesizedExpression(node.initializer) && ts30.isAsExpression(node.initializer.expression) ? this.getTypeChecker().getSymbolAtLocation(node.name) : this.getTypeChecker().getSymbolAtLocation(node.initializer);
|
|
5282
5834
|
if (originalDeclaration === void 0 || originalDeclaration.valueDeclaration === void 0) {
|
|
5283
5835
|
return null;
|
|
5284
5836
|
}
|
|
@@ -5302,7 +5854,7 @@ var SymbolBuilder = class {
|
|
|
5302
5854
|
referenceVarLocation: referenceVarTcbLocation
|
|
5303
5855
|
};
|
|
5304
5856
|
} else {
|
|
5305
|
-
if (!
|
|
5857
|
+
if (!ts30.isClassDeclaration(target.directive.ref.node)) {
|
|
5306
5858
|
return null;
|
|
5307
5859
|
}
|
|
5308
5860
|
return {
|
|
@@ -5317,7 +5869,7 @@ var SymbolBuilder = class {
|
|
|
5317
5869
|
}
|
|
5318
5870
|
}
|
|
5319
5871
|
getSymbolOfPipe(expression) {
|
|
5320
|
-
const methodAccess = findFirstMatchingNode(this.typeCheckBlock, { withSpan: expression.nameSpan, filter:
|
|
5872
|
+
const methodAccess = findFirstMatchingNode(this.typeCheckBlock, { withSpan: expression.nameSpan, filter: ts30.isPropertyAccessExpression });
|
|
5321
5873
|
if (methodAccess === null) {
|
|
5322
5874
|
return null;
|
|
5323
5875
|
}
|
|
@@ -5357,7 +5909,7 @@ var SymbolBuilder = class {
|
|
|
5357
5909
|
}
|
|
5358
5910
|
let node = null;
|
|
5359
5911
|
if (expression instanceof PropertyRead5) {
|
|
5360
|
-
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter:
|
|
5912
|
+
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter: ts30.isPropertyAccessExpression });
|
|
5361
5913
|
}
|
|
5362
5914
|
if (node === null) {
|
|
5363
5915
|
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter: anyNodeFilter });
|
|
@@ -5365,10 +5917,10 @@ var SymbolBuilder = class {
|
|
|
5365
5917
|
if (node === null) {
|
|
5366
5918
|
return null;
|
|
5367
5919
|
}
|
|
5368
|
-
while (
|
|
5920
|
+
while (ts30.isParenthesizedExpression(node)) {
|
|
5369
5921
|
node = node.expression;
|
|
5370
5922
|
}
|
|
5371
|
-
if (expression instanceof SafePropertyRead4 &&
|
|
5923
|
+
if (expression instanceof SafePropertyRead4 && ts30.isConditionalExpression(node)) {
|
|
5372
5924
|
const whenTrueSymbol = this.getSymbolOfTsNode(node.whenTrue);
|
|
5373
5925
|
if (whenTrueSymbol === null) {
|
|
5374
5926
|
return null;
|
|
@@ -5385,13 +5937,13 @@ var SymbolBuilder = class {
|
|
|
5385
5937
|
}
|
|
5386
5938
|
getSymbolOfTsNode(node) {
|
|
5387
5939
|
var _a;
|
|
5388
|
-
while (
|
|
5940
|
+
while (ts30.isParenthesizedExpression(node)) {
|
|
5389
5941
|
node = node.expression;
|
|
5390
5942
|
}
|
|
5391
5943
|
let tsSymbol;
|
|
5392
|
-
if (
|
|
5944
|
+
if (ts30.isPropertyAccessExpression(node)) {
|
|
5393
5945
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.name);
|
|
5394
|
-
} else if (
|
|
5946
|
+
} else if (ts30.isElementAccessExpression(node)) {
|
|
5395
5947
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.argumentExpression);
|
|
5396
5948
|
} else {
|
|
5397
5949
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node);
|
|
@@ -5409,13 +5961,13 @@ var SymbolBuilder = class {
|
|
|
5409
5961
|
};
|
|
5410
5962
|
}
|
|
5411
5963
|
getTcbPositionForNode(node) {
|
|
5412
|
-
if (
|
|
5964
|
+
if (ts30.isTypeReferenceNode(node)) {
|
|
5413
5965
|
return this.getTcbPositionForNode(node.typeName);
|
|
5414
|
-
} else if (
|
|
5966
|
+
} else if (ts30.isQualifiedName(node)) {
|
|
5415
5967
|
return node.right.getStart();
|
|
5416
|
-
} else if (
|
|
5968
|
+
} else if (ts30.isPropertyAccessExpression(node)) {
|
|
5417
5969
|
return node.name.getStart();
|
|
5418
|
-
} else if (
|
|
5970
|
+
} else if (ts30.isElementAccessExpression(node)) {
|
|
5419
5971
|
return node.argumentExpression.getStart();
|
|
5420
5972
|
} else {
|
|
5421
5973
|
return node.getStart();
|
|
@@ -5429,7 +5981,7 @@ function sourceSpanEqual(a, b) {
|
|
|
5429
5981
|
return a.start.offset === b.start.offset && a.end.offset === b.end.offset;
|
|
5430
5982
|
}
|
|
5431
5983
|
|
|
5432
|
-
// bazel-out/
|
|
5984
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/checker.mjs
|
|
5433
5985
|
var REGISTRY2 = new DomElementSchemaRegistry2();
|
|
5434
5986
|
var TemplateTypeCheckerImpl = class {
|
|
5435
5987
|
constructor(originalProgram, programDriver, typeCheckAdapter, config, refEmitter, reflector, compilerHost, priorBuild, metaReader, localMetaReader, ngModuleIndex, componentScopeReader, typeCheckScopeRegistry, perf) {
|
|
@@ -6126,10 +6678,10 @@ var SingleShimTypeCheckingHost = class extends SingleFileTypeCheckingHost {
|
|
|
6126
6678
|
}
|
|
6127
6679
|
};
|
|
6128
6680
|
|
|
6129
|
-
// bazel-out/
|
|
6681
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/invalid_banana_in_box/index.mjs
|
|
6130
6682
|
import { TmplAstBoundEvent as TmplAstBoundEvent2 } from "@angular/compiler";
|
|
6131
6683
|
|
|
6132
|
-
// bazel-out/
|
|
6684
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/api/api.mjs
|
|
6133
6685
|
import { ASTWithSource as ASTWithSource4, RecursiveAstVisitor as RecursiveAstVisitor3, TmplAstBoundDeferredTrigger as TmplAstBoundDeferredTrigger2 } from "@angular/compiler";
|
|
6134
6686
|
var TemplateCheckWithVisitor = class {
|
|
6135
6687
|
run(ctx, component, template) {
|
|
@@ -6226,6 +6778,8 @@ var TemplateVisitor2 = class extends RecursiveAstVisitor3 {
|
|
|
6226
6778
|
}
|
|
6227
6779
|
visitForLoopBlock(block) {
|
|
6228
6780
|
var _a;
|
|
6781
|
+
block.item.visit(this);
|
|
6782
|
+
this.visitAllNodes(Object.values(block.contextVariables));
|
|
6229
6783
|
this.visitAst(block.expression);
|
|
6230
6784
|
this.visitAllNodes(block.children);
|
|
6231
6785
|
(_a = block.empty) == null ? void 0 : _a.visit(this);
|
|
@@ -6237,7 +6791,9 @@ var TemplateVisitor2 = class extends RecursiveAstVisitor3 {
|
|
|
6237
6791
|
this.visitAllNodes(block.branches);
|
|
6238
6792
|
}
|
|
6239
6793
|
visitIfBlockBranch(block) {
|
|
6794
|
+
var _a;
|
|
6240
6795
|
block.expression && this.visitAst(block.expression);
|
|
6796
|
+
(_a = block.expressionAlias) == null ? void 0 : _a.visit(this);
|
|
6241
6797
|
this.visitAllNodes(block.children);
|
|
6242
6798
|
}
|
|
6243
6799
|
getDiagnostics(template) {
|
|
@@ -6247,7 +6803,7 @@ var TemplateVisitor2 = class extends RecursiveAstVisitor3 {
|
|
|
6247
6803
|
}
|
|
6248
6804
|
};
|
|
6249
6805
|
|
|
6250
|
-
// bazel-out/
|
|
6806
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/invalid_banana_in_box/index.mjs
|
|
6251
6807
|
var InvalidBananaInBoxCheck = class extends TemplateCheckWithVisitor {
|
|
6252
6808
|
constructor() {
|
|
6253
6809
|
super(...arguments);
|
|
@@ -6272,7 +6828,7 @@ var factory = {
|
|
|
6272
6828
|
create: () => new InvalidBananaInBoxCheck()
|
|
6273
6829
|
};
|
|
6274
6830
|
|
|
6275
|
-
// bazel-out/
|
|
6831
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/missing_control_flow_directive/index.mjs
|
|
6276
6832
|
import { TmplAstTemplate as TmplAstTemplate4 } from "@angular/compiler";
|
|
6277
6833
|
var KNOWN_CONTROL_FLOW_DIRECTIVES = /* @__PURE__ */ new Map([
|
|
6278
6834
|
["ngIf", "NgIf"],
|
|
@@ -6317,7 +6873,7 @@ var factory2 = {
|
|
|
6317
6873
|
}
|
|
6318
6874
|
};
|
|
6319
6875
|
|
|
6320
|
-
// bazel-out/
|
|
6876
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/missing_ngforof_let/index.mjs
|
|
6321
6877
|
import { TmplAstTemplate as TmplAstTemplate5 } from "@angular/compiler";
|
|
6322
6878
|
var MissingNgForOfLetCheck = class extends TemplateCheckWithVisitor {
|
|
6323
6879
|
constructor() {
|
|
@@ -6350,9 +6906,9 @@ var factory3 = {
|
|
|
6350
6906
|
create: () => new MissingNgForOfLetCheck()
|
|
6351
6907
|
};
|
|
6352
6908
|
|
|
6353
|
-
// bazel-out/
|
|
6909
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/nullish_coalescing_not_nullable/index.mjs
|
|
6354
6910
|
import { Binary } from "@angular/compiler";
|
|
6355
|
-
import
|
|
6911
|
+
import ts31 from "typescript";
|
|
6356
6912
|
var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
6357
6913
|
constructor() {
|
|
6358
6914
|
super(...arguments);
|
|
@@ -6366,7 +6922,7 @@ var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
6366
6922
|
return [];
|
|
6367
6923
|
}
|
|
6368
6924
|
const typeLeft = symbolLeft.tsType;
|
|
6369
|
-
if (typeLeft.flags & (
|
|
6925
|
+
if (typeLeft.flags & (ts31.TypeFlags.Any | ts31.TypeFlags.Unknown)) {
|
|
6370
6926
|
return [];
|
|
6371
6927
|
}
|
|
6372
6928
|
if (typeLeft.getNonNullableType() !== typeLeft)
|
|
@@ -6395,9 +6951,9 @@ var factory4 = {
|
|
|
6395
6951
|
}
|
|
6396
6952
|
};
|
|
6397
6953
|
|
|
6398
|
-
// bazel-out/
|
|
6954
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/optional_chain_not_nullable/index.mjs
|
|
6399
6955
|
import { SafeCall as SafeCall2, SafeKeyedRead as SafeKeyedRead2, SafePropertyRead as SafePropertyRead5 } from "@angular/compiler";
|
|
6400
|
-
import
|
|
6956
|
+
import ts32 from "typescript";
|
|
6401
6957
|
var OptionalChainNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
6402
6958
|
constructor() {
|
|
6403
6959
|
super(...arguments);
|
|
@@ -6411,7 +6967,7 @@ var OptionalChainNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
6411
6967
|
return [];
|
|
6412
6968
|
}
|
|
6413
6969
|
const typeLeft = symbolLeft.tsType;
|
|
6414
|
-
if (typeLeft.flags & (
|
|
6970
|
+
if (typeLeft.flags & (ts32.TypeFlags.Any | ts32.TypeFlags.Unknown)) {
|
|
6415
6971
|
return [];
|
|
6416
6972
|
}
|
|
6417
6973
|
if (typeLeft.getNonNullableType() !== typeLeft)
|
|
@@ -6441,7 +6997,7 @@ var factory5 = {
|
|
|
6441
6997
|
}
|
|
6442
6998
|
};
|
|
6443
6999
|
|
|
6444
|
-
// bazel-out/
|
|
7000
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/suffix_not_supported/index.mjs
|
|
6445
7001
|
import { TmplAstBoundAttribute as TmplAstBoundAttribute3 } from "@angular/compiler";
|
|
6446
7002
|
var STYLE_SUFFIXES = ["px", "%", "em"];
|
|
6447
7003
|
var SuffixNotSupportedCheck = class extends TemplateCheckWithVisitor {
|
|
@@ -6465,7 +7021,7 @@ var factory6 = {
|
|
|
6465
7021
|
create: () => new SuffixNotSupportedCheck()
|
|
6466
7022
|
};
|
|
6467
7023
|
|
|
6468
|
-
// bazel-out/
|
|
7024
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/text_attribute_not_binding/index.mjs
|
|
6469
7025
|
import { TmplAstTextAttribute as TmplAstTextAttribute4 } from "@angular/compiler";
|
|
6470
7026
|
var TextAttributeNotBindingSpec = class extends TemplateCheckWithVisitor {
|
|
6471
7027
|
constructor() {
|
|
@@ -6504,10 +7060,10 @@ var factory7 = {
|
|
|
6504
7060
|
create: () => new TextAttributeNotBindingSpec()
|
|
6505
7061
|
};
|
|
6506
7062
|
|
|
6507
|
-
// bazel-out/
|
|
6508
|
-
import
|
|
7063
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/src/extended_template_checker.mjs
|
|
7064
|
+
import ts33 from "typescript";
|
|
6509
7065
|
|
|
6510
|
-
// bazel-out/
|
|
7066
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/api/src/public_options.mjs
|
|
6511
7067
|
var DiagnosticCategoryLabel;
|
|
6512
7068
|
(function(DiagnosticCategoryLabel2) {
|
|
6513
7069
|
DiagnosticCategoryLabel2["Warning"] = "warning";
|
|
@@ -6515,7 +7071,7 @@ var DiagnosticCategoryLabel;
|
|
|
6515
7071
|
DiagnosticCategoryLabel2["Suppress"] = "suppress";
|
|
6516
7072
|
})(DiagnosticCategoryLabel || (DiagnosticCategoryLabel = {}));
|
|
6517
7073
|
|
|
6518
|
-
// bazel-out/
|
|
7074
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/src/extended_template_checker.mjs
|
|
6519
7075
|
var ExtendedTemplateCheckerImpl = class {
|
|
6520
7076
|
constructor(templateTypeChecker, typeChecker, templateCheckFactories, options) {
|
|
6521
7077
|
var _a, _b, _c, _d, _e;
|
|
@@ -6554,9 +7110,9 @@ var ExtendedTemplateCheckerImpl = class {
|
|
|
6554
7110
|
function diagnosticLabelToCategory(label) {
|
|
6555
7111
|
switch (label) {
|
|
6556
7112
|
case DiagnosticCategoryLabel.Warning:
|
|
6557
|
-
return
|
|
7113
|
+
return ts33.DiagnosticCategory.Warning;
|
|
6558
7114
|
case DiagnosticCategoryLabel.Error:
|
|
6559
|
-
return
|
|
7115
|
+
return ts33.DiagnosticCategory.Error;
|
|
6560
7116
|
case DiagnosticCategoryLabel.Suppress:
|
|
6561
7117
|
return null;
|
|
6562
7118
|
default:
|
|
@@ -6568,7 +7124,7 @@ function assertNever(value) {
|
|
|
6568
7124
|
${value}`);
|
|
6569
7125
|
}
|
|
6570
7126
|
|
|
6571
|
-
// bazel-out/
|
|
7127
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/index.mjs
|
|
6572
7128
|
var ALL_DIAGNOSTIC_FACTORIES = [
|
|
6573
7129
|
factory,
|
|
6574
7130
|
factory4,
|
|
@@ -6579,7 +7135,7 @@ var ALL_DIAGNOSTIC_FACTORIES = [
|
|
|
6579
7135
|
factory6
|
|
6580
7136
|
];
|
|
6581
7137
|
|
|
6582
|
-
// bazel-out/
|
|
7138
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/compiler.mjs
|
|
6583
7139
|
var CompilationTicketKind;
|
|
6584
7140
|
(function(CompilationTicketKind2) {
|
|
6585
7141
|
CompilationTicketKind2[CompilationTicketKind2["Fresh"] = 0] = "Fresh";
|
|
@@ -6670,7 +7226,7 @@ var NgCompiler = class {
|
|
|
6670
7226
|
this.currentProgram = inputProgram;
|
|
6671
7227
|
this.closureCompilerEnabled = !!this.options.annotateForClosureCompiler;
|
|
6672
7228
|
this.entryPoint = adapter.entryPoint !== null ? getSourceFileOrNull(inputProgram, adapter.entryPoint) : null;
|
|
6673
|
-
const moduleResolutionCache =
|
|
7229
|
+
const moduleResolutionCache = ts34.createModuleResolutionCache(
|
|
6674
7230
|
this.adapter.getCurrentDirectory(),
|
|
6675
7231
|
this.adapter.getCanonicalFileName.bind(this.adapter)
|
|
6676
7232
|
);
|
|
@@ -6714,7 +7270,7 @@ var NgCompiler = class {
|
|
|
6714
7270
|
}
|
|
6715
7271
|
for (const clazz of classesToUpdate) {
|
|
6716
7272
|
this.compilation.traitCompiler.updateResources(clazz);
|
|
6717
|
-
if (!
|
|
7273
|
+
if (!ts34.isClassDeclaration(clazz)) {
|
|
6718
7274
|
continue;
|
|
6719
7275
|
}
|
|
6720
7276
|
this.compilation.templateTypeChecker.invalidateClass(clazz);
|
|
@@ -6866,6 +7422,18 @@ var NgCompiler = class {
|
|
|
6866
7422
|
compilation.traitCompiler.index(context);
|
|
6867
7423
|
return generateAnalysis(context);
|
|
6868
7424
|
}
|
|
7425
|
+
getApiDocumentation(entryPoint) {
|
|
7426
|
+
const compilation = this.ensureAnalyzed();
|
|
7427
|
+
const checker = this.inputProgram.getTypeChecker();
|
|
7428
|
+
const docsExtractor = new DocsExtractor(checker, compilation.metaReader);
|
|
7429
|
+
const entryPointSourceFile = this.inputProgram.getSourceFiles().find((sourceFile) => {
|
|
7430
|
+
return sourceFile.fileName.includes(entryPoint);
|
|
7431
|
+
});
|
|
7432
|
+
if (!entryPointSourceFile) {
|
|
7433
|
+
throw new Error(`Entry point "${entryPoint}" not found in program sources.`);
|
|
7434
|
+
}
|
|
7435
|
+
return docsExtractor.extractAll(entryPointSourceFile);
|
|
7436
|
+
}
|
|
6869
7437
|
xi18n(ctx) {
|
|
6870
7438
|
const compilation = this.ensureAnalyzed();
|
|
6871
7439
|
compilation.traitCompiler.xi18n(ctx);
|
|
@@ -7169,18 +7737,18 @@ function isAngularCorePackage(program) {
|
|
|
7169
7737
|
return false;
|
|
7170
7738
|
}
|
|
7171
7739
|
return r3Symbols.statements.some((stmt) => {
|
|
7172
|
-
if (!
|
|
7740
|
+
if (!ts34.isVariableStatement(stmt)) {
|
|
7173
7741
|
return false;
|
|
7174
7742
|
}
|
|
7175
|
-
const modifiers =
|
|
7176
|
-
if (modifiers === void 0 || !modifiers.some((mod) => mod.kind ===
|
|
7743
|
+
const modifiers = ts34.getModifiers(stmt);
|
|
7744
|
+
if (modifiers === void 0 || !modifiers.some((mod) => mod.kind === ts34.SyntaxKind.ExportKeyword)) {
|
|
7177
7745
|
return false;
|
|
7178
7746
|
}
|
|
7179
7747
|
return stmt.declarationList.declarations.some((decl) => {
|
|
7180
|
-
if (!
|
|
7748
|
+
if (!ts34.isIdentifier(decl.name) || decl.name.text !== "ITS_JUST_ANGULAR") {
|
|
7181
7749
|
return false;
|
|
7182
7750
|
}
|
|
7183
|
-
if (decl.initializer === void 0 || decl.initializer.kind !==
|
|
7751
|
+
if (decl.initializer === void 0 || decl.initializer.kind !== ts34.SyntaxKind.TrueKeyword) {
|
|
7184
7752
|
return false;
|
|
7185
7753
|
}
|
|
7186
7754
|
return true;
|
|
@@ -7194,7 +7762,7 @@ function* verifyCompatibleTypeCheckOptions(options) {
|
|
|
7194
7762
|
var _a, _b, _c;
|
|
7195
7763
|
if (options.fullTemplateTypeCheck === false && options.strictTemplates === true) {
|
|
7196
7764
|
yield makeConfigDiagnostic({
|
|
7197
|
-
category:
|
|
7765
|
+
category: ts34.DiagnosticCategory.Error,
|
|
7198
7766
|
code: ErrorCode.CONFIG_STRICT_TEMPLATES_IMPLIES_FULL_TEMPLATE_TYPECHECK,
|
|
7199
7767
|
messageText: `
|
|
7200
7768
|
Angular compiler option "strictTemplates" is enabled, however "fullTemplateTypeCheck" is disabled.
|
|
@@ -7213,7 +7781,7 @@ https://angular.io/guide/template-typecheck
|
|
|
7213
7781
|
}
|
|
7214
7782
|
if (options.extendedDiagnostics && options.strictTemplates === false) {
|
|
7215
7783
|
yield makeConfigDiagnostic({
|
|
7216
|
-
category:
|
|
7784
|
+
category: ts34.DiagnosticCategory.Error,
|
|
7217
7785
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_IMPLIES_STRICT_TEMPLATES,
|
|
7218
7786
|
messageText: `
|
|
7219
7787
|
Angular compiler option "extendedDiagnostics" is configured, however "strictTemplates" is disabled.
|
|
@@ -7230,7 +7798,7 @@ One of the following actions is required:
|
|
|
7230
7798
|
const defaultCategory = (_a = options.extendedDiagnostics) == null ? void 0 : _a.defaultCategory;
|
|
7231
7799
|
if (defaultCategory && !allowedCategoryLabels.includes(defaultCategory)) {
|
|
7232
7800
|
yield makeConfigDiagnostic({
|
|
7233
|
-
category:
|
|
7801
|
+
category: ts34.DiagnosticCategory.Error,
|
|
7234
7802
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
7235
7803
|
messageText: `
|
|
7236
7804
|
Angular compiler option "extendedDiagnostics.defaultCategory" has an unknown diagnostic category: "${defaultCategory}".
|
|
@@ -7244,7 +7812,7 @@ ${allowedCategoryLabels.join("\n")}
|
|
|
7244
7812
|
for (const [checkName, category] of Object.entries((_c = (_b = options.extendedDiagnostics) == null ? void 0 : _b.checks) != null ? _c : {})) {
|
|
7245
7813
|
if (!allExtendedDiagnosticNames.includes(checkName)) {
|
|
7246
7814
|
yield makeConfigDiagnostic({
|
|
7247
|
-
category:
|
|
7815
|
+
category: ts34.DiagnosticCategory.Error,
|
|
7248
7816
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CHECK,
|
|
7249
7817
|
messageText: `
|
|
7250
7818
|
Angular compiler option "extendedDiagnostics.checks" has an unknown check: "${checkName}".
|
|
@@ -7256,7 +7824,7 @@ ${allExtendedDiagnosticNames.join("\n")}
|
|
|
7256
7824
|
}
|
|
7257
7825
|
if (!allowedCategoryLabels.includes(category)) {
|
|
7258
7826
|
yield makeConfigDiagnostic({
|
|
7259
|
-
category:
|
|
7827
|
+
category: ts34.DiagnosticCategory.Error,
|
|
7260
7828
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
7261
7829
|
messageText: `
|
|
7262
7830
|
Angular compiler option "extendedDiagnostics.checks['${checkName}']" has an unknown diagnostic category: "${category}".
|
|
@@ -7286,7 +7854,7 @@ var ReferenceGraphAdapter = class {
|
|
|
7286
7854
|
for (const { node } of references) {
|
|
7287
7855
|
let sourceFile = node.getSourceFile();
|
|
7288
7856
|
if (sourceFile === void 0) {
|
|
7289
|
-
sourceFile =
|
|
7857
|
+
sourceFile = ts34.getOriginalNode(node).getSourceFile();
|
|
7290
7858
|
}
|
|
7291
7859
|
if (sourceFile === void 0 || !isDtsPath(sourceFile.fileName)) {
|
|
7292
7860
|
this.graph.add(source, node);
|
|
@@ -7324,8 +7892,8 @@ function versionMapFromProgram(program, driver) {
|
|
|
7324
7892
|
return versions;
|
|
7325
7893
|
}
|
|
7326
7894
|
|
|
7327
|
-
// bazel-out/
|
|
7328
|
-
import
|
|
7895
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/host.mjs
|
|
7896
|
+
import ts35 from "typescript";
|
|
7329
7897
|
var DelegatingCompilerHost2 = class {
|
|
7330
7898
|
constructor(delegate) {
|
|
7331
7899
|
this.delegate = delegate;
|
|
@@ -7404,7 +7972,7 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
7404
7972
|
entryPoint = findFlatIndexEntryPoint(normalizedTsInputFiles);
|
|
7405
7973
|
if (entryPoint === null) {
|
|
7406
7974
|
diagnostics.push({
|
|
7407
|
-
category:
|
|
7975
|
+
category: ts35.DiagnosticCategory.Error,
|
|
7408
7976
|
code: ngErrorCode(ErrorCode.CONFIG_FLAT_MODULE_NO_INDEX),
|
|
7409
7977
|
file: void 0,
|
|
7410
7978
|
start: void 0,
|
|
@@ -7447,17 +8015,17 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
7447
8015
|
return this.fileNameToModuleName !== void 0 ? this : null;
|
|
7448
8016
|
}
|
|
7449
8017
|
createCachedResolveModuleNamesFunction() {
|
|
7450
|
-
const moduleResolutionCache =
|
|
8018
|
+
const moduleResolutionCache = ts35.createModuleResolutionCache(this.getCurrentDirectory(), this.getCanonicalFileName.bind(this));
|
|
7451
8019
|
return (moduleNames, containingFile, reusedNames, redirectedReference, options) => {
|
|
7452
8020
|
return moduleNames.map((moduleName) => {
|
|
7453
|
-
const module =
|
|
8021
|
+
const module = ts35.resolveModuleName(moduleName, containingFile, options, this, moduleResolutionCache, redirectedReference);
|
|
7454
8022
|
return module.resolvedModule;
|
|
7455
8023
|
});
|
|
7456
8024
|
};
|
|
7457
8025
|
}
|
|
7458
8026
|
};
|
|
7459
8027
|
|
|
7460
|
-
// bazel-out/
|
|
8028
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/program.mjs
|
|
7461
8029
|
var NgtscProgram = class {
|
|
7462
8030
|
constructor(rootNames, options, delegateHost, oldProgram) {
|
|
7463
8031
|
this.options = options;
|
|
@@ -7474,7 +8042,7 @@ var NgtscProgram = class {
|
|
|
7474
8042
|
if (reuseProgram !== void 0) {
|
|
7475
8043
|
retagAllTsFiles(reuseProgram);
|
|
7476
8044
|
}
|
|
7477
|
-
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () =>
|
|
8045
|
+
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () => ts36.createProgram(this.host.inputFiles, options, this.host, reuseProgram));
|
|
7478
8046
|
perfRecorder.phase(PerfPhase.Unaccounted);
|
|
7479
8047
|
perfRecorder.memory(PerfCheckpoint.TypeScriptProgramCreate);
|
|
7480
8048
|
this.host.postProgramCreationCleanup();
|
|
@@ -7664,6 +8232,9 @@ var NgtscProgram = class {
|
|
|
7664
8232
|
getIndexedComponents() {
|
|
7665
8233
|
return this.compiler.getIndexedComponents();
|
|
7666
8234
|
}
|
|
8235
|
+
getApiDocumentation(entryPoint) {
|
|
8236
|
+
return this.compiler.getApiDocumentation(entryPoint);
|
|
8237
|
+
}
|
|
7667
8238
|
getEmittedSourceFiles() {
|
|
7668
8239
|
throw new Error("Method not implemented.");
|
|
7669
8240
|
}
|
|
@@ -7681,37 +8252,37 @@ function mergeEmitResults(emitResults) {
|
|
|
7681
8252
|
return { diagnostics, emitSkipped, emittedFiles };
|
|
7682
8253
|
}
|
|
7683
8254
|
|
|
7684
|
-
// bazel-out/
|
|
8255
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/transformers/program.mjs
|
|
7685
8256
|
function createProgram({ rootNames, options, host, oldProgram }) {
|
|
7686
8257
|
return new NgtscProgram(rootNames, options, host, oldProgram);
|
|
7687
8258
|
}
|
|
7688
8259
|
|
|
7689
|
-
// bazel-out/
|
|
7690
|
-
import
|
|
8260
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/perform_compile.mjs
|
|
8261
|
+
import ts38 from "typescript";
|
|
7691
8262
|
|
|
7692
|
-
// bazel-out/
|
|
7693
|
-
import
|
|
8263
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/transformers/util.mjs
|
|
8264
|
+
import ts37 from "typescript";
|
|
7694
8265
|
function createMessageDiagnostic(messageText) {
|
|
7695
8266
|
return {
|
|
7696
8267
|
file: void 0,
|
|
7697
8268
|
start: void 0,
|
|
7698
8269
|
length: void 0,
|
|
7699
|
-
category:
|
|
8270
|
+
category: ts37.DiagnosticCategory.Message,
|
|
7700
8271
|
messageText,
|
|
7701
8272
|
code: DEFAULT_ERROR_CODE,
|
|
7702
8273
|
source: SOURCE
|
|
7703
8274
|
};
|
|
7704
8275
|
}
|
|
7705
8276
|
|
|
7706
|
-
// bazel-out/
|
|
8277
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/perform_compile.mjs
|
|
7707
8278
|
var defaultFormatHost = {
|
|
7708
|
-
getCurrentDirectory: () =>
|
|
8279
|
+
getCurrentDirectory: () => ts38.sys.getCurrentDirectory(),
|
|
7709
8280
|
getCanonicalFileName: (fileName) => fileName,
|
|
7710
|
-
getNewLine: () =>
|
|
8281
|
+
getNewLine: () => ts38.sys.newLine
|
|
7711
8282
|
};
|
|
7712
8283
|
function formatDiagnostics(diags, host = defaultFormatHost) {
|
|
7713
8284
|
if (diags && diags.length) {
|
|
7714
|
-
return diags.map((diagnostic) => replaceTsWithNgInErrors(
|
|
8285
|
+
return diags.map((diagnostic) => replaceTsWithNgInErrors(ts38.formatDiagnosticsWithColorAndContext([diagnostic], host))).join("");
|
|
7715
8286
|
} else {
|
|
7716
8287
|
return "";
|
|
7717
8288
|
}
|
|
@@ -7728,7 +8299,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7728
8299
|
var _a;
|
|
7729
8300
|
try {
|
|
7730
8301
|
const fs = getFileSystem();
|
|
7731
|
-
const readConfigFile = (configFile) =>
|
|
8302
|
+
const readConfigFile = (configFile) => ts38.readConfigFile(configFile, (file) => host.readFile(host.resolve(file)));
|
|
7732
8303
|
const readAngularCompilerOptions = (configFile, parentOptions = {}) => {
|
|
7733
8304
|
const { config: config2, error: error2 } = readConfigFile(configFile);
|
|
7734
8305
|
if (error2) {
|
|
@@ -7763,7 +8334,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7763
8334
|
...existingOptions
|
|
7764
8335
|
};
|
|
7765
8336
|
const parseConfigHost = createParseConfigHost(host, fs);
|
|
7766
|
-
const { options, errors, fileNames: rootNames, projectReferences } =
|
|
8337
|
+
const { options, errors, fileNames: rootNames, projectReferences } = ts38.parseJsonConfigFileContent(config, parseConfigHost, basePath, existingCompilerOptions, configFileName);
|
|
7767
8338
|
let emitFlags = EmitFlags.Default;
|
|
7768
8339
|
if (!(options["skipMetadataEmit"] || options["flatModuleOutFile"])) {
|
|
7769
8340
|
emitFlags |= EmitFlags.Metadata;
|
|
@@ -7774,7 +8345,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7774
8345
|
return { project: projectFile, rootNames, projectReferences, options, errors, emitFlags };
|
|
7775
8346
|
} catch (e) {
|
|
7776
8347
|
const errors = [{
|
|
7777
|
-
category:
|
|
8348
|
+
category: ts38.DiagnosticCategory.Error,
|
|
7778
8349
|
messageText: (_a = e.stack) != null ? _a : e.message,
|
|
7779
8350
|
file: void 0,
|
|
7780
8351
|
start: void 0,
|
|
@@ -7788,7 +8359,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7788
8359
|
function createParseConfigHost(host, fs = getFileSystem()) {
|
|
7789
8360
|
return {
|
|
7790
8361
|
fileExists: host.exists.bind(host),
|
|
7791
|
-
readDirectory:
|
|
8362
|
+
readDirectory: ts38.sys.readDirectory,
|
|
7792
8363
|
readFile: host.readFile.bind(host),
|
|
7793
8364
|
useCaseSensitiveFileNames: fs.isCaseSensitive()
|
|
7794
8365
|
};
|
|
@@ -7808,7 +8379,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
|
7808
8379
|
}
|
|
7809
8380
|
} else {
|
|
7810
8381
|
const parseConfigHost = createParseConfigHost(host, fs);
|
|
7811
|
-
const { resolvedModule } =
|
|
8382
|
+
const { resolvedModule } = ts38.nodeModuleNameResolver(
|
|
7812
8383
|
extendsValue,
|
|
7813
8384
|
configFile,
|
|
7814
8385
|
{ moduleResolution: 2, resolveJsonModule: true },
|
|
@@ -7823,7 +8394,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
|
7823
8394
|
function exitCodeFromResult(diags) {
|
|
7824
8395
|
if (!diags)
|
|
7825
8396
|
return 0;
|
|
7826
|
-
if (diags.every((diag) => diag.category !==
|
|
8397
|
+
if (diags.every((diag) => diag.category !== ts38.DiagnosticCategory.Error)) {
|
|
7827
8398
|
return 0;
|
|
7828
8399
|
}
|
|
7829
8400
|
return diags.some((d) => d.source === "angular" && d.code === UNKNOWN_ERROR_CODE) ? 2 : 1;
|
|
@@ -7856,7 +8427,7 @@ function performCompilation({ rootNames, options, host, oldProgram, emitCallback
|
|
|
7856
8427
|
} catch (e) {
|
|
7857
8428
|
program = void 0;
|
|
7858
8429
|
allDiagnostics.push({
|
|
7859
|
-
category:
|
|
8430
|
+
category: ts38.DiagnosticCategory.Error,
|
|
7860
8431
|
messageText: (_a = e.stack) != null ? _a : e.message,
|
|
7861
8432
|
code: UNKNOWN_ERROR_CODE,
|
|
7862
8433
|
file: void 0,
|
|
@@ -7883,7 +8454,7 @@ function defaultGatherDiagnostics(program) {
|
|
|
7883
8454
|
return allDiagnostics;
|
|
7884
8455
|
}
|
|
7885
8456
|
function hasErrors(diags) {
|
|
7886
|
-
return diags.some((d) => d.category ===
|
|
8457
|
+
return diags.some((d) => d.category === ts38.DiagnosticCategory.Error);
|
|
7887
8458
|
}
|
|
7888
8459
|
|
|
7889
8460
|
export {
|
|
@@ -7893,6 +8464,9 @@ export {
|
|
|
7893
8464
|
isTsDiagnostic,
|
|
7894
8465
|
EmitFlags,
|
|
7895
8466
|
createCompilerHost,
|
|
8467
|
+
EntryType,
|
|
8468
|
+
MemberType,
|
|
8469
|
+
MemberTags,
|
|
7896
8470
|
untagAllTsFiles,
|
|
7897
8471
|
TsCreateProgramDriver,
|
|
7898
8472
|
PatchedProgramIncrementalBuildStrategy,
|
|
@@ -7917,4 +8491,4 @@ export {
|
|
|
7917
8491
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7918
8492
|
* found in the LICENSE file at https://angular.io/license
|
|
7919
8493
|
*/
|
|
7920
|
-
//# sourceMappingURL=chunk-
|
|
8494
|
+
//# sourceMappingURL=chunk-7YXJWQNF.js.map
|