@angular/compiler-cli 17.0.0-next.3 → 17.0.0-next.5
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-QYCH2357.js → chunk-7QICZXP3.js} +8 -8
- package/bundles/{chunk-BK7TBDB4.js → chunk-7QTF7U4J.js} +4 -4
- package/bundles/{chunk-PCMLSPQF.js → chunk-CSOLWS7O.js} +7 -7
- package/bundles/{chunk-EKTJ7622.js → chunk-GYHDNUIK.js} +7 -7
- package/bundles/{chunk-7PCPPTTO.js → chunk-HJOPJLIM.js} +5 -5
- package/bundles/{chunk-42ADUVYG.js → chunk-KV7WQARZ.js} +31 -31
- package/bundles/{chunk-JXVNXZIV.js → chunk-OADA63HC.js} +5 -5
- package/bundles/{chunk-I7GHEGCH.js → chunk-RVITQ7TS.js} +1033 -498
- package/bundles/chunk-RVITQ7TS.js.map +6 -0
- package/bundles/{chunk-LYJKWJUC.js → chunk-SBDNBITT.js} +3 -3
- package/bundles/{chunk-I2HNYMSV.js → chunk-TX6LIB73.js} +29 -27
- package/bundles/{chunk-I2HNYMSV.js.map → chunk-TX6LIB73.js.map} +1 -1
- package/bundles/{chunk-JZC4T2RR.js → chunk-UHYH6BYB.js} +1 -1
- package/bundles/{chunk-Y4VU3VP2.js → chunk-YWV5CDS7.js} +142 -101
- package/bundles/chunk-YWV5CDS7.js.map +6 -0
- 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/package.json +5 -5
- package/src/ngtsc/annotations/component/src/handler.d.ts +1 -1
- package/src/ngtsc/core/src/compiler.d.ts +10 -0
- package/src/ngtsc/diagnostics/src/error_code.d.ts +13 -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/program.d.ts +10 -0
- package/src/ngtsc/typecheck/src/oob.d.ts +6 -1
- package/src/ngtsc/typecheck/src/type_check_block.d.ts +5 -3
- package/bundles/chunk-I7GHEGCH.js.map +0 -6
- package/bundles/chunk-Y4VU3VP2.js.map +0 -6
- /package/bundles/{chunk-QYCH2357.js.map → chunk-7QICZXP3.js.map} +0 -0
- /package/bundles/{chunk-BK7TBDB4.js.map → chunk-7QTF7U4J.js.map} +0 -0
- /package/bundles/{chunk-PCMLSPQF.js.map → chunk-CSOLWS7O.js.map} +0 -0
- /package/bundles/{chunk-EKTJ7622.js.map → chunk-GYHDNUIK.js.map} +0 -0
- /package/bundles/{chunk-7PCPPTTO.js.map → chunk-HJOPJLIM.js.map} +0 -0
- /package/bundles/{chunk-42ADUVYG.js.map → chunk-KV7WQARZ.js.map} +0 -0
- /package/bundles/{chunk-JXVNXZIV.js.map → chunk-OADA63HC.js.map} +0 -0
- /package/bundles/{chunk-LYJKWJUC.js.map → chunk-SBDNBITT.js.map} +0 -0
- /package/bundles/{chunk-JZC4T2RR.js.map → chunk-UHYH6BYB.js.map} +0 -0
|
@@ -36,12 +36,12 @@ import {
|
|
|
36
36
|
aliasTransformFactory,
|
|
37
37
|
declarationTransformFactory,
|
|
38
38
|
ivyTransformFactory
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-YWV5CDS7.js";
|
|
40
40
|
import {
|
|
41
41
|
ImportManager,
|
|
42
42
|
translateExpression,
|
|
43
43
|
translateType
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-7QICZXP3.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-TX6LIB73.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-HJOPJLIM.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-CSOLWS7O.js";
|
|
104
104
|
|
|
105
|
-
// bazel-out/
|
|
105
|
+
// bazel-out/darwin_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-fastbuild/bin/packages/compiler-cli/src/typescript_support.mjs
|
|
189
224
|
import ts2 from "typescript";
|
|
190
225
|
|
|
191
|
-
// bazel-out/
|
|
226
|
+
// bazel-out/darwin_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/docs/src/extractor.mjs
|
|
529
|
+
import ts7 from "typescript";
|
|
530
|
+
|
|
531
|
+
// bazel-out/darwin_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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_arm64-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,19 @@ 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));
|
|
2997
3374
|
}
|
|
2998
3375
|
};
|
|
2999
3376
|
function makeInlineDiagnostic(templateId, code, node, messageText, relatedInformation) {
|
|
@@ -3004,8 +3381,8 @@ function makeInlineDiagnostic(templateId, code, node, messageText, relatedInform
|
|
|
3004
3381
|
};
|
|
3005
3382
|
}
|
|
3006
3383
|
|
|
3007
|
-
// bazel-out/
|
|
3008
|
-
import
|
|
3384
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/shim.mjs
|
|
3385
|
+
import ts24 from "typescript";
|
|
3009
3386
|
var TypeCheckShimGenerator = class {
|
|
3010
3387
|
constructor() {
|
|
3011
3388
|
this.extensionPrefix = "ngtypecheck";
|
|
@@ -3015,25 +3392,25 @@ var TypeCheckShimGenerator = class {
|
|
|
3015
3392
|
if (priorShimSf !== null) {
|
|
3016
3393
|
return priorShimSf;
|
|
3017
3394
|
}
|
|
3018
|
-
return
|
|
3395
|
+
return ts24.createSourceFile(genFilePath, "export const USED_FOR_NG_TYPE_CHECKING = true;", ts24.ScriptTarget.Latest, true, ts24.ScriptKind.TS);
|
|
3019
3396
|
}
|
|
3020
3397
|
static shimFor(fileName) {
|
|
3021
3398
|
return absoluteFrom(fileName.replace(/\.tsx?$/, ".ngtypecheck.ts"));
|
|
3022
3399
|
}
|
|
3023
3400
|
};
|
|
3024
3401
|
|
|
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
|
|
3402
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.mjs
|
|
3403
|
+
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";
|
|
3404
|
+
import ts27 from "typescript";
|
|
3028
3405
|
|
|
3029
|
-
// bazel-out/
|
|
3406
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/diagnostics.mjs
|
|
3030
3407
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan3 } from "@angular/compiler";
|
|
3031
|
-
import
|
|
3408
|
+
import ts25 from "typescript";
|
|
3032
3409
|
function wrapForDiagnostics(expr) {
|
|
3033
|
-
return
|
|
3410
|
+
return ts25.factory.createParenthesizedExpression(expr);
|
|
3034
3411
|
}
|
|
3035
3412
|
function wrapForTypeChecker(expr) {
|
|
3036
|
-
return
|
|
3413
|
+
return ts25.factory.createParenthesizedExpression(expr);
|
|
3037
3414
|
}
|
|
3038
3415
|
function addParseSpanInfo(node, span) {
|
|
3039
3416
|
let commentText;
|
|
@@ -3042,10 +3419,10 @@ function addParseSpanInfo(node, span) {
|
|
|
3042
3419
|
} else {
|
|
3043
3420
|
commentText = `${span.start.offset},${span.end.offset}`;
|
|
3044
3421
|
}
|
|
3045
|
-
|
|
3422
|
+
ts25.addSyntheticTrailingComment(node, ts25.SyntaxKind.MultiLineCommentTrivia, commentText, false);
|
|
3046
3423
|
}
|
|
3047
3424
|
function addTemplateId(tcb, id) {
|
|
3048
|
-
|
|
3425
|
+
ts25.addSyntheticLeadingComment(tcb, ts25.SyntaxKind.MultiLineCommentTrivia, id, true);
|
|
3049
3426
|
}
|
|
3050
3427
|
function shouldReportDiagnostic(diagnostic) {
|
|
3051
3428
|
const { code } = diagnostic;
|
|
@@ -3072,34 +3449,34 @@ function translateDiagnostic(diagnostic, resolver) {
|
|
|
3072
3449
|
return makeTemplateDiagnostic(sourceLocation.id, templateSourceMapping, span, diagnostic.category, diagnostic.code, diagnostic.messageText);
|
|
3073
3450
|
}
|
|
3074
3451
|
|
|
3075
|
-
// bazel-out/
|
|
3452
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/expression.mjs
|
|
3076
3453
|
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 =
|
|
3454
|
+
import ts26 from "typescript";
|
|
3455
|
+
var NULL_AS_ANY = ts26.factory.createAsExpression(ts26.factory.createNull(), ts26.factory.createKeywordTypeNode(ts26.SyntaxKind.AnyKeyword));
|
|
3456
|
+
var UNDEFINED = ts26.factory.createIdentifier("undefined");
|
|
3080
3457
|
var UNARY_OPS = /* @__PURE__ */ new Map([
|
|
3081
|
-
["+",
|
|
3082
|
-
["-",
|
|
3458
|
+
["+", ts26.SyntaxKind.PlusToken],
|
|
3459
|
+
["-", ts26.SyntaxKind.MinusToken]
|
|
3083
3460
|
]);
|
|
3084
3461
|
var BINARY_OPS = /* @__PURE__ */ new Map([
|
|
3085
|
-
["+",
|
|
3086
|
-
["-",
|
|
3087
|
-
["<",
|
|
3088
|
-
[">",
|
|
3089
|
-
["<=",
|
|
3090
|
-
[">=",
|
|
3091
|
-
["==",
|
|
3092
|
-
["===",
|
|
3093
|
-
["*",
|
|
3094
|
-
["/",
|
|
3095
|
-
["%",
|
|
3096
|
-
["!=",
|
|
3097
|
-
["!==",
|
|
3098
|
-
["||",
|
|
3099
|
-
["&&",
|
|
3100
|
-
["&",
|
|
3101
|
-
["|",
|
|
3102
|
-
["??",
|
|
3462
|
+
["+", ts26.SyntaxKind.PlusToken],
|
|
3463
|
+
["-", ts26.SyntaxKind.MinusToken],
|
|
3464
|
+
["<", ts26.SyntaxKind.LessThanToken],
|
|
3465
|
+
[">", ts26.SyntaxKind.GreaterThanToken],
|
|
3466
|
+
["<=", ts26.SyntaxKind.LessThanEqualsToken],
|
|
3467
|
+
[">=", ts26.SyntaxKind.GreaterThanEqualsToken],
|
|
3468
|
+
["==", ts26.SyntaxKind.EqualsEqualsToken],
|
|
3469
|
+
["===", ts26.SyntaxKind.EqualsEqualsEqualsToken],
|
|
3470
|
+
["*", ts26.SyntaxKind.AsteriskToken],
|
|
3471
|
+
["/", ts26.SyntaxKind.SlashToken],
|
|
3472
|
+
["%", ts26.SyntaxKind.PercentToken],
|
|
3473
|
+
["!=", ts26.SyntaxKind.ExclamationEqualsToken],
|
|
3474
|
+
["!==", ts26.SyntaxKind.ExclamationEqualsEqualsToken],
|
|
3475
|
+
["||", ts26.SyntaxKind.BarBarToken],
|
|
3476
|
+
["&&", ts26.SyntaxKind.AmpersandAmpersandToken],
|
|
3477
|
+
["&", ts26.SyntaxKind.AmpersandToken],
|
|
3478
|
+
["|", ts26.SyntaxKind.BarToken],
|
|
3479
|
+
["??", ts26.SyntaxKind.QuestionQuestionToken]
|
|
3103
3480
|
]);
|
|
3104
3481
|
function astToTypescript(ast, maybeResolve, config) {
|
|
3105
3482
|
const translator = new AstTranslator(maybeResolve, config);
|
|
@@ -3115,7 +3492,7 @@ var AstTranslator = class {
|
|
|
3115
3492
|
ast = ast.ast;
|
|
3116
3493
|
}
|
|
3117
3494
|
if (ast instanceof EmptyExpr2) {
|
|
3118
|
-
const res =
|
|
3495
|
+
const res = ts26.factory.createIdentifier("undefined");
|
|
3119
3496
|
addParseSpanInfo(res, ast.sourceSpan);
|
|
3120
3497
|
return res;
|
|
3121
3498
|
}
|
|
@@ -3131,7 +3508,7 @@ var AstTranslator = class {
|
|
|
3131
3508
|
if (op === void 0) {
|
|
3132
3509
|
throw new Error(`Unsupported Unary.operator: ${ast.operator}`);
|
|
3133
3510
|
}
|
|
3134
|
-
const node = wrapForDiagnostics(
|
|
3511
|
+
const node = wrapForDiagnostics(ts26.factory.createPrefixUnaryExpression(op, expr));
|
|
3135
3512
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3136
3513
|
return node;
|
|
3137
3514
|
}
|
|
@@ -3142,13 +3519,13 @@ var AstTranslator = class {
|
|
|
3142
3519
|
if (op === void 0) {
|
|
3143
3520
|
throw new Error(`Unsupported Binary.operation: ${ast.operation}`);
|
|
3144
3521
|
}
|
|
3145
|
-
const node =
|
|
3522
|
+
const node = ts26.factory.createBinaryExpression(lhs, op, rhs);
|
|
3146
3523
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3147
3524
|
return node;
|
|
3148
3525
|
}
|
|
3149
3526
|
visitChain(ast) {
|
|
3150
3527
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
3151
|
-
const node = wrapForDiagnostics(
|
|
3528
|
+
const node = wrapForDiagnostics(ts26.factory.createCommaListExpression(elements));
|
|
3152
3529
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3153
3530
|
return node;
|
|
3154
3531
|
}
|
|
@@ -3156,7 +3533,7 @@ var AstTranslator = class {
|
|
|
3156
3533
|
const condExpr = this.translate(ast.condition);
|
|
3157
3534
|
const trueExpr = this.translate(ast.trueExp);
|
|
3158
3535
|
const falseExpr = wrapForTypeChecker(this.translate(ast.falseExp));
|
|
3159
|
-
const node =
|
|
3536
|
+
const node = ts26.factory.createParenthesizedExpression(ts26.factory.createConditionalExpression(condExpr, void 0, trueExpr, void 0, falseExpr));
|
|
3160
3537
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3161
3538
|
return node;
|
|
3162
3539
|
}
|
|
@@ -3167,26 +3544,26 @@ var AstTranslator = class {
|
|
|
3167
3544
|
throw new Error("Method not implemented.");
|
|
3168
3545
|
}
|
|
3169
3546
|
visitInterpolation(ast) {
|
|
3170
|
-
return ast.expressions.reduce((lhs, ast2) =>
|
|
3547
|
+
return ast.expressions.reduce((lhs, ast2) => ts26.factory.createBinaryExpression(lhs, ts26.SyntaxKind.PlusToken, wrapForTypeChecker(this.translate(ast2))), ts26.factory.createStringLiteral(""));
|
|
3171
3548
|
}
|
|
3172
3549
|
visitKeyedRead(ast) {
|
|
3173
3550
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3174
3551
|
const key = this.translate(ast.key);
|
|
3175
|
-
const node =
|
|
3552
|
+
const node = ts26.factory.createElementAccessExpression(receiver, key);
|
|
3176
3553
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3177
3554
|
return node;
|
|
3178
3555
|
}
|
|
3179
3556
|
visitKeyedWrite(ast) {
|
|
3180
3557
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3181
|
-
const left =
|
|
3558
|
+
const left = ts26.factory.createElementAccessExpression(receiver, this.translate(ast.key));
|
|
3182
3559
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
3183
|
-
const node = wrapForDiagnostics(
|
|
3560
|
+
const node = wrapForDiagnostics(ts26.factory.createBinaryExpression(left, ts26.SyntaxKind.EqualsToken, right));
|
|
3184
3561
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3185
3562
|
return node;
|
|
3186
3563
|
}
|
|
3187
3564
|
visitLiteralArray(ast) {
|
|
3188
3565
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
3189
|
-
const literal =
|
|
3566
|
+
const literal = ts26.factory.createArrayLiteralExpression(elements);
|
|
3190
3567
|
const node = this.config.strictLiteralTypes ? literal : tsCastToAny(literal);
|
|
3191
3568
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3192
3569
|
return node;
|
|
@@ -3194,9 +3571,9 @@ var AstTranslator = class {
|
|
|
3194
3571
|
visitLiteralMap(ast) {
|
|
3195
3572
|
const properties = ast.keys.map(({ key }, idx) => {
|
|
3196
3573
|
const value = this.translate(ast.values[idx]);
|
|
3197
|
-
return
|
|
3574
|
+
return ts26.factory.createPropertyAssignment(ts26.factory.createStringLiteral(key), value);
|
|
3198
3575
|
});
|
|
3199
|
-
const literal =
|
|
3576
|
+
const literal = ts26.factory.createObjectLiteralExpression(properties, true);
|
|
3200
3577
|
const node = this.config.strictLiteralTypes ? literal : tsCastToAny(literal);
|
|
3201
3578
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3202
3579
|
return node;
|
|
@@ -3204,15 +3581,15 @@ var AstTranslator = class {
|
|
|
3204
3581
|
visitLiteralPrimitive(ast) {
|
|
3205
3582
|
let node;
|
|
3206
3583
|
if (ast.value === void 0) {
|
|
3207
|
-
node =
|
|
3584
|
+
node = ts26.factory.createIdentifier("undefined");
|
|
3208
3585
|
} else if (ast.value === null) {
|
|
3209
|
-
node =
|
|
3586
|
+
node = ts26.factory.createNull();
|
|
3210
3587
|
} else if (typeof ast.value === "string") {
|
|
3211
|
-
node =
|
|
3588
|
+
node = ts26.factory.createStringLiteral(ast.value);
|
|
3212
3589
|
} else if (typeof ast.value === "number") {
|
|
3213
|
-
node =
|
|
3590
|
+
node = ts26.factory.createNumericLiteral(ast.value);
|
|
3214
3591
|
} else if (typeof ast.value === "boolean") {
|
|
3215
|
-
node = ast.value ?
|
|
3592
|
+
node = ast.value ? ts26.factory.createTrue() : ts26.factory.createFalse();
|
|
3216
3593
|
} else {
|
|
3217
3594
|
throw Error(`Unsupported AST value of type ${typeof ast.value}`);
|
|
3218
3595
|
}
|
|
@@ -3221,7 +3598,7 @@ var AstTranslator = class {
|
|
|
3221
3598
|
}
|
|
3222
3599
|
visitNonNullAssert(ast) {
|
|
3223
3600
|
const expr = wrapForDiagnostics(this.translate(ast.expression));
|
|
3224
|
-
const node =
|
|
3601
|
+
const node = ts26.factory.createNonNullExpression(expr);
|
|
3225
3602
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3226
3603
|
return node;
|
|
3227
3604
|
}
|
|
@@ -3230,13 +3607,13 @@ var AstTranslator = class {
|
|
|
3230
3607
|
}
|
|
3231
3608
|
visitPrefixNot(ast) {
|
|
3232
3609
|
const expression = wrapForDiagnostics(this.translate(ast.expression));
|
|
3233
|
-
const node =
|
|
3610
|
+
const node = ts26.factory.createLogicalNot(expression);
|
|
3234
3611
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3235
3612
|
return node;
|
|
3236
3613
|
}
|
|
3237
3614
|
visitPropertyRead(ast) {
|
|
3238
3615
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3239
|
-
const name =
|
|
3616
|
+
const name = ts26.factory.createPropertyAccessExpression(receiver, ast.name);
|
|
3240
3617
|
addParseSpanInfo(name, ast.nameSpan);
|
|
3241
3618
|
const node = wrapForDiagnostics(name);
|
|
3242
3619
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
@@ -3244,12 +3621,12 @@ var AstTranslator = class {
|
|
|
3244
3621
|
}
|
|
3245
3622
|
visitPropertyWrite(ast) {
|
|
3246
3623
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3247
|
-
const left =
|
|
3624
|
+
const left = ts26.factory.createPropertyAccessExpression(receiver, ast.name);
|
|
3248
3625
|
addParseSpanInfo(left, ast.nameSpan);
|
|
3249
3626
|
const leftWithPath = wrapForDiagnostics(left);
|
|
3250
3627
|
addParseSpanInfo(leftWithPath, ast.sourceSpan);
|
|
3251
3628
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
3252
|
-
const node = wrapForDiagnostics(
|
|
3629
|
+
const node = wrapForDiagnostics(ts26.factory.createBinaryExpression(leftWithPath, ts26.SyntaxKind.EqualsToken, right));
|
|
3253
3630
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3254
3631
|
return node;
|
|
3255
3632
|
}
|
|
@@ -3257,13 +3634,13 @@ var AstTranslator = class {
|
|
|
3257
3634
|
let node;
|
|
3258
3635
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3259
3636
|
if (this.config.strictSafeNavigationTypes) {
|
|
3260
|
-
const expr =
|
|
3637
|
+
const expr = ts26.factory.createPropertyAccessExpression(ts26.factory.createNonNullExpression(receiver), ast.name);
|
|
3261
3638
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
3262
|
-
node =
|
|
3639
|
+
node = ts26.factory.createParenthesizedExpression(ts26.factory.createConditionalExpression(NULL_AS_ANY, void 0, expr, void 0, UNDEFINED));
|
|
3263
3640
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3264
|
-
node =
|
|
3641
|
+
node = ts26.factory.createPropertyAccessExpression(tsCastToAny(receiver), ast.name);
|
|
3265
3642
|
} else {
|
|
3266
|
-
const expr =
|
|
3643
|
+
const expr = ts26.factory.createPropertyAccessExpression(ts26.factory.createNonNullExpression(receiver), ast.name);
|
|
3267
3644
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
3268
3645
|
node = tsCastToAny(expr);
|
|
3269
3646
|
}
|
|
@@ -3275,13 +3652,13 @@ var AstTranslator = class {
|
|
|
3275
3652
|
const key = this.translate(ast.key);
|
|
3276
3653
|
let node;
|
|
3277
3654
|
if (this.config.strictSafeNavigationTypes) {
|
|
3278
|
-
const expr =
|
|
3655
|
+
const expr = ts26.factory.createElementAccessExpression(ts26.factory.createNonNullExpression(receiver), key);
|
|
3279
3656
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
3280
|
-
node =
|
|
3657
|
+
node = ts26.factory.createParenthesizedExpression(ts26.factory.createConditionalExpression(NULL_AS_ANY, void 0, expr, void 0, UNDEFINED));
|
|
3281
3658
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3282
|
-
node =
|
|
3659
|
+
node = ts26.factory.createElementAccessExpression(tsCastToAny(receiver), key);
|
|
3283
3660
|
} else {
|
|
3284
|
-
const expr =
|
|
3661
|
+
const expr = ts26.factory.createElementAccessExpression(ts26.factory.createNonNullExpression(receiver), key);
|
|
3285
3662
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
3286
3663
|
node = tsCastToAny(expr);
|
|
3287
3664
|
}
|
|
@@ -3298,7 +3675,7 @@ var AstTranslator = class {
|
|
|
3298
3675
|
expr = resolved;
|
|
3299
3676
|
} else {
|
|
3300
3677
|
const propertyReceiver = wrapForDiagnostics(this.translate(receiver.receiver));
|
|
3301
|
-
expr =
|
|
3678
|
+
expr = ts26.factory.createPropertyAccessExpression(propertyReceiver, receiver.name);
|
|
3302
3679
|
addParseSpanInfo(expr, receiver.nameSpan);
|
|
3303
3680
|
}
|
|
3304
3681
|
} else {
|
|
@@ -3308,7 +3685,7 @@ var AstTranslator = class {
|
|
|
3308
3685
|
if (ast.receiver instanceof SafePropertyRead2 || ast.receiver instanceof SafeKeyedRead) {
|
|
3309
3686
|
node = this.convertToSafeCall(ast, expr, args);
|
|
3310
3687
|
} else {
|
|
3311
|
-
node =
|
|
3688
|
+
node = ts26.factory.createCallExpression(expr, void 0, args);
|
|
3312
3689
|
}
|
|
3313
3690
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3314
3691
|
return node;
|
|
@@ -3322,13 +3699,13 @@ var AstTranslator = class {
|
|
|
3322
3699
|
}
|
|
3323
3700
|
convertToSafeCall(ast, expr, args) {
|
|
3324
3701
|
if (this.config.strictSafeNavigationTypes) {
|
|
3325
|
-
const call =
|
|
3326
|
-
return
|
|
3702
|
+
const call = ts26.factory.createCallExpression(ts26.factory.createNonNullExpression(expr), void 0, args);
|
|
3703
|
+
return ts26.factory.createParenthesizedExpression(ts26.factory.createConditionalExpression(NULL_AS_ANY, void 0, call, void 0, UNDEFINED));
|
|
3327
3704
|
}
|
|
3328
3705
|
if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3329
|
-
return
|
|
3706
|
+
return ts26.factory.createCallExpression(tsCastToAny(expr), void 0, args);
|
|
3330
3707
|
}
|
|
3331
|
-
return tsCastToAny(
|
|
3708
|
+
return tsCastToAny(ts26.factory.createCallExpression(ts26.factory.createNonNullExpression(expr), void 0, args));
|
|
3332
3709
|
}
|
|
3333
3710
|
};
|
|
3334
3711
|
var _VeSafeLhsInferenceBugDetector = class {
|
|
@@ -3405,7 +3782,7 @@ var VeSafeLhsInferenceBugDetector = _VeSafeLhsInferenceBugDetector;
|
|
|
3405
3782
|
_VeSafeLhsInferenceBugDetector.SINGLETON = new _VeSafeLhsInferenceBugDetector();
|
|
3406
3783
|
})();
|
|
3407
3784
|
|
|
3408
|
-
// bazel-out/
|
|
3785
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/template_semantics.mjs
|
|
3409
3786
|
import { ImplicitReceiver as ImplicitReceiver3, RecursiveAstVisitor as RecursiveAstVisitor2, TmplAstVariable } from "@angular/compiler";
|
|
3410
3787
|
var ExpressionSemanticVisitor = class extends RecursiveAstVisitor2 {
|
|
3411
3788
|
constructor(templateId, boundTarget, oob) {
|
|
@@ -3429,7 +3806,7 @@ var ExpressionSemanticVisitor = class extends RecursiveAstVisitor2 {
|
|
|
3429
3806
|
}
|
|
3430
3807
|
};
|
|
3431
3808
|
|
|
3432
|
-
// bazel-out/
|
|
3809
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.mjs
|
|
3433
3810
|
var TcbGenericContextBehavior;
|
|
3434
3811
|
(function(TcbGenericContextBehavior2) {
|
|
3435
3812
|
TcbGenericContextBehavior2[TcbGenericContextBehavior2["UseEmitter"] = 0] = "UseEmitter";
|
|
@@ -3440,7 +3817,7 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
|
|
|
3440
3817
|
const tcb = new Context(env, domSchemaChecker, oobRecorder, meta.id, meta.boundTarget, meta.pipes, meta.schemas, meta.isStandalone);
|
|
3441
3818
|
const scope = Scope.forNodes(tcb, null, tcb.boundTarget.target.template, null);
|
|
3442
3819
|
const ctxRawType = env.referenceType(ref);
|
|
3443
|
-
if (!
|
|
3820
|
+
if (!ts27.isTypeReferenceNode(ctxRawType)) {
|
|
3444
3821
|
throw new Error(`Expected TypeReferenceNode when referencing the ctx param for ${ref.debugName}`);
|
|
3445
3822
|
}
|
|
3446
3823
|
let typeParameters = void 0;
|
|
@@ -3452,25 +3829,25 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
|
|
|
3452
3829
|
switch (genericContextBehavior) {
|
|
3453
3830
|
case TcbGenericContextBehavior.UseEmitter:
|
|
3454
3831
|
typeParameters = new TypeParameterEmitter(ref.node.typeParameters, env.reflector).emit((typeRef) => env.referenceType(typeRef));
|
|
3455
|
-
typeArguments = typeParameters.map((param) =>
|
|
3832
|
+
typeArguments = typeParameters.map((param) => ts27.factory.createTypeReferenceNode(param.name));
|
|
3456
3833
|
break;
|
|
3457
3834
|
case TcbGenericContextBehavior.CopyClassNodes:
|
|
3458
3835
|
typeParameters = [...ref.node.typeParameters];
|
|
3459
|
-
typeArguments = typeParameters.map((param) =>
|
|
3836
|
+
typeArguments = typeParameters.map((param) => ts27.factory.createTypeReferenceNode(param.name));
|
|
3460
3837
|
break;
|
|
3461
3838
|
case TcbGenericContextBehavior.FallbackToAny:
|
|
3462
|
-
typeArguments = ref.node.typeParameters.map(() =>
|
|
3839
|
+
typeArguments = ref.node.typeParameters.map(() => ts27.factory.createKeywordTypeNode(ts27.SyntaxKind.AnyKeyword));
|
|
3463
3840
|
break;
|
|
3464
3841
|
}
|
|
3465
3842
|
}
|
|
3466
3843
|
const paramList = [tcbThisParam(ctxRawType.typeName, typeArguments)];
|
|
3467
3844
|
const scopeStatements = scope.render();
|
|
3468
|
-
const innerBody =
|
|
3845
|
+
const innerBody = ts27.factory.createBlock([
|
|
3469
3846
|
...env.getPreludeStatements(),
|
|
3470
3847
|
...scopeStatements
|
|
3471
3848
|
]);
|
|
3472
|
-
const body =
|
|
3473
|
-
const fnDecl =
|
|
3849
|
+
const body = ts27.factory.createBlock([ts27.factory.createIfStatement(ts27.factory.createTrue(), innerBody, void 0)]);
|
|
3850
|
+
const fnDecl = ts27.factory.createFunctionDeclaration(
|
|
3474
3851
|
void 0,
|
|
3475
3852
|
void 0,
|
|
3476
3853
|
name,
|
|
@@ -3505,7 +3882,7 @@ var TcbElementOp = class extends TcbOp {
|
|
|
3505
3882
|
return id;
|
|
3506
3883
|
}
|
|
3507
3884
|
};
|
|
3508
|
-
var
|
|
3885
|
+
var TcbTemplateVariableOp = class extends TcbOp {
|
|
3509
3886
|
constructor(tcb, scope, template, variable) {
|
|
3510
3887
|
super();
|
|
3511
3888
|
this.tcb = tcb;
|
|
@@ -3519,7 +3896,7 @@ var TcbVariableOp = class extends TcbOp {
|
|
|
3519
3896
|
execute() {
|
|
3520
3897
|
const ctx = this.scope.resolve(this.template);
|
|
3521
3898
|
const id = this.tcb.allocateId();
|
|
3522
|
-
const initializer =
|
|
3899
|
+
const initializer = ts27.factory.createPropertyAccessExpression(
|
|
3523
3900
|
ctx,
|
|
3524
3901
|
this.variable.value || "$implicit"
|
|
3525
3902
|
);
|
|
@@ -3545,7 +3922,7 @@ var TcbTemplateContextOp = class extends TcbOp {
|
|
|
3545
3922
|
}
|
|
3546
3923
|
execute() {
|
|
3547
3924
|
const ctx = this.tcb.allocateId();
|
|
3548
|
-
const type =
|
|
3925
|
+
const type = ts27.factory.createKeywordTypeNode(ts27.SyntaxKind.AnyKeyword);
|
|
3549
3926
|
this.scope.addStatement(tsDeclareVariable(ctx, type));
|
|
3550
3927
|
return ctx;
|
|
3551
3928
|
}
|
|
@@ -3598,16 +3975,16 @@ var TcbTemplateBodyOp = class extends TcbOp {
|
|
|
3598
3975
|
}
|
|
3599
3976
|
let guard = null;
|
|
3600
3977
|
if (directiveGuards.length > 0) {
|
|
3601
|
-
guard = directiveGuards.reduce((expr, dirGuard) =>
|
|
3978
|
+
guard = directiveGuards.reduce((expr, dirGuard) => ts27.factory.createBinaryExpression(expr, ts27.SyntaxKind.AmpersandAmpersandToken, dirGuard), directiveGuards.pop());
|
|
3602
3979
|
}
|
|
3603
3980
|
const tmplScope = Scope.forNodes(this.tcb, this.scope, this.template, guard);
|
|
3604
3981
|
const statements = tmplScope.render();
|
|
3605
3982
|
if (statements.length === 0) {
|
|
3606
3983
|
return null;
|
|
3607
3984
|
}
|
|
3608
|
-
let tmplBlock =
|
|
3985
|
+
let tmplBlock = ts27.factory.createBlock(statements);
|
|
3609
3986
|
if (guard !== null) {
|
|
3610
|
-
tmplBlock =
|
|
3987
|
+
tmplBlock = ts27.factory.createIfStatement(guard, tmplBlock);
|
|
3611
3988
|
}
|
|
3612
3989
|
this.scope.addStatement(tmplBlock);
|
|
3613
3990
|
return null;
|
|
@@ -3625,7 +4002,7 @@ var TcbExpressionOp = class extends TcbOp {
|
|
|
3625
4002
|
}
|
|
3626
4003
|
execute() {
|
|
3627
4004
|
const expr = tcbExpression(this.expression, this.tcb, this.scope);
|
|
3628
|
-
this.scope.addStatement(
|
|
4005
|
+
this.scope.addStatement(ts27.factory.createExpressionStatement(expr));
|
|
3629
4006
|
return null;
|
|
3630
4007
|
}
|
|
3631
4008
|
};
|
|
@@ -3647,11 +4024,11 @@ var TcbDirectiveTypeOpBase = class extends TcbOp {
|
|
|
3647
4024
|
if (this.dir.isGeneric === false || dirRef.node.typeParameters === void 0) {
|
|
3648
4025
|
type = rawType;
|
|
3649
4026
|
} else {
|
|
3650
|
-
if (!
|
|
4027
|
+
if (!ts27.isTypeReferenceNode(rawType)) {
|
|
3651
4028
|
throw new Error(`Expected TypeReferenceNode when referencing the type for ${this.dir.ref.debugName}`);
|
|
3652
4029
|
}
|
|
3653
|
-
const typeArguments = dirRef.node.typeParameters.map(() =>
|
|
3654
|
-
type =
|
|
4030
|
+
const typeArguments = dirRef.node.typeParameters.map(() => ts27.factory.createKeywordTypeNode(ts27.SyntaxKind.AnyKeyword));
|
|
4031
|
+
type = ts27.factory.createTypeReferenceNode(rawType.typeName, typeArguments);
|
|
3655
4032
|
}
|
|
3656
4033
|
const id = this.tcb.allocateId();
|
|
3657
4034
|
addExpressionIdentifier(type, ExpressionIdentifier.DIRECTIVE);
|
|
@@ -3692,11 +4069,11 @@ var TcbReferenceOp = class extends TcbOp {
|
|
|
3692
4069
|
const id = this.tcb.allocateId();
|
|
3693
4070
|
let initializer = this.target instanceof TmplAstTemplate2 || this.target instanceof TmplAstElement3 ? this.scope.resolve(this.target) : this.scope.resolve(this.host, this.target);
|
|
3694
4071
|
if (this.target instanceof TmplAstElement3 && !this.tcb.env.config.checkTypeOfDomReferences || !this.tcb.env.config.checkTypeOfNonDomReferences) {
|
|
3695
|
-
initializer =
|
|
4072
|
+
initializer = ts27.factory.createAsExpression(initializer, ts27.factory.createKeywordTypeNode(ts27.SyntaxKind.AnyKeyword));
|
|
3696
4073
|
} else if (this.target instanceof TmplAstTemplate2) {
|
|
3697
|
-
initializer =
|
|
3698
|
-
initializer =
|
|
3699
|
-
initializer =
|
|
4074
|
+
initializer = ts27.factory.createAsExpression(initializer, ts27.factory.createKeywordTypeNode(ts27.SyntaxKind.AnyKeyword));
|
|
4075
|
+
initializer = ts27.factory.createAsExpression(initializer, this.tcb.env.referenceExternalType("@angular/core", "TemplateRef", [DYNAMIC_TYPE]));
|
|
4076
|
+
initializer = ts27.factory.createParenthesizedExpression(initializer);
|
|
3700
4077
|
}
|
|
3701
4078
|
addParseSpanInfo(initializer, this.node.sourceSpan);
|
|
3702
4079
|
addParseSpanInfo(id, this.node.keySpan);
|
|
@@ -3789,7 +4166,7 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
3789
4166
|
type = this.tcb.env.referenceTransplantedType(new TransplantedType(transformType));
|
|
3790
4167
|
} else {
|
|
3791
4168
|
const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
|
|
3792
|
-
if (!
|
|
4169
|
+
if (!ts27.isTypeReferenceNode(dirTypeRef)) {
|
|
3793
4170
|
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
3794
4171
|
}
|
|
3795
4172
|
type = tsCreateTypeQueryForCoercedInput(dirTypeRef.typeName, fieldName);
|
|
@@ -3805,10 +4182,10 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
3805
4182
|
}
|
|
3806
4183
|
const id = this.tcb.allocateId();
|
|
3807
4184
|
const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
|
|
3808
|
-
if (!
|
|
4185
|
+
if (!ts27.isTypeReferenceNode(dirTypeRef)) {
|
|
3809
4186
|
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
3810
4187
|
}
|
|
3811
|
-
const type =
|
|
4188
|
+
const type = ts27.factory.createIndexedAccessTypeNode(ts27.factory.createTypeQueryNode(dirId), ts27.factory.createLiteralTypeNode(ts27.factory.createStringLiteral(fieldName)));
|
|
3812
4189
|
const temp = tsDeclareVariable(id, type);
|
|
3813
4190
|
this.scope.addStatement(temp);
|
|
3814
4191
|
target = id;
|
|
@@ -3816,18 +4193,18 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
3816
4193
|
if (dirId === null) {
|
|
3817
4194
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
3818
4195
|
}
|
|
3819
|
-
target = this.dir.stringLiteralInputFields.has(fieldName) ?
|
|
4196
|
+
target = this.dir.stringLiteralInputFields.has(fieldName) ? ts27.factory.createElementAccessExpression(dirId, ts27.factory.createStringLiteral(fieldName)) : ts27.factory.createPropertyAccessExpression(dirId, ts27.factory.createIdentifier(fieldName));
|
|
3820
4197
|
}
|
|
3821
4198
|
if (attr.attribute.keySpan !== void 0) {
|
|
3822
4199
|
addParseSpanInfo(target, attr.attribute.keySpan);
|
|
3823
4200
|
}
|
|
3824
|
-
assignment =
|
|
4201
|
+
assignment = ts27.factory.createBinaryExpression(target, ts27.SyntaxKind.EqualsToken, assignment);
|
|
3825
4202
|
}
|
|
3826
4203
|
addParseSpanInfo(assignment, attr.attribute.sourceSpan);
|
|
3827
4204
|
if (!this.tcb.env.config.checkTypeOfAttributes && attr.attribute instanceof TmplAstTextAttribute2) {
|
|
3828
4205
|
markIgnoreDiagnostics(assignment);
|
|
3829
4206
|
}
|
|
3830
|
-
this.scope.addStatement(
|
|
4207
|
+
this.scope.addStatement(ts27.factory.createExpressionStatement(assignment));
|
|
3831
4208
|
}
|
|
3832
4209
|
this.checkRequiredInputs(seenRequiredInputs);
|
|
3833
4210
|
return null;
|
|
@@ -3858,7 +4235,7 @@ var TcbDirectiveCtorCircularFallbackOp = class extends TcbOp {
|
|
|
3858
4235
|
execute() {
|
|
3859
4236
|
const id = this.tcb.allocateId();
|
|
3860
4237
|
const typeCtor = this.tcb.env.typeCtorFor(this.dir);
|
|
3861
|
-
const circularPlaceholder =
|
|
4238
|
+
const circularPlaceholder = ts27.factory.createCallExpression(typeCtor, void 0, [ts27.factory.createNonNullExpression(ts27.factory.createNull())]);
|
|
3862
4239
|
this.scope.addStatement(tsCreateVariable(id, circularPlaceholder));
|
|
3863
4240
|
return id;
|
|
3864
4241
|
}
|
|
@@ -3926,15 +4303,15 @@ var TcbUnclaimedInputsOp = class extends TcbOp {
|
|
|
3926
4303
|
elId = this.scope.resolve(this.element);
|
|
3927
4304
|
}
|
|
3928
4305
|
const propertyName = (_a = ATTR_TO_PROP.get(binding.name)) != null ? _a : binding.name;
|
|
3929
|
-
const prop =
|
|
3930
|
-
const stmt =
|
|
4306
|
+
const prop = ts27.factory.createElementAccessExpression(elId, ts27.factory.createStringLiteral(propertyName));
|
|
4307
|
+
const stmt = ts27.factory.createBinaryExpression(prop, ts27.SyntaxKind.EqualsToken, wrapForDiagnostics(expr));
|
|
3931
4308
|
addParseSpanInfo(stmt, binding.sourceSpan);
|
|
3932
|
-
this.scope.addStatement(
|
|
4309
|
+
this.scope.addStatement(ts27.factory.createExpressionStatement(stmt));
|
|
3933
4310
|
} else {
|
|
3934
|
-
this.scope.addStatement(
|
|
4311
|
+
this.scope.addStatement(ts27.factory.createExpressionStatement(expr));
|
|
3935
4312
|
}
|
|
3936
4313
|
} else {
|
|
3937
|
-
this.scope.addStatement(
|
|
4314
|
+
this.scope.addStatement(ts27.factory.createExpressionStatement(expr));
|
|
3938
4315
|
}
|
|
3939
4316
|
}
|
|
3940
4317
|
return null;
|
|
@@ -3966,18 +4343,18 @@ var TcbDirectiveOutputsOp = class extends TcbOp {
|
|
|
3966
4343
|
if (dirId === null) {
|
|
3967
4344
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
3968
4345
|
}
|
|
3969
|
-
const outputField =
|
|
4346
|
+
const outputField = ts27.factory.createElementAccessExpression(dirId, ts27.factory.createStringLiteral(field));
|
|
3970
4347
|
addParseSpanInfo(outputField, output.keySpan);
|
|
3971
4348
|
if (this.tcb.env.config.checkTypeOfOutputEvents) {
|
|
3972
4349
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
3973
|
-
const subscribeFn =
|
|
3974
|
-
const call =
|
|
4350
|
+
const subscribeFn = ts27.factory.createPropertyAccessExpression(outputField, "subscribe");
|
|
4351
|
+
const call = ts27.factory.createCallExpression(subscribeFn, void 0, [handler]);
|
|
3975
4352
|
addParseSpanInfo(call, output.sourceSpan);
|
|
3976
|
-
this.scope.addStatement(
|
|
4353
|
+
this.scope.addStatement(ts27.factory.createExpressionStatement(call));
|
|
3977
4354
|
} else {
|
|
3978
|
-
this.scope.addStatement(
|
|
4355
|
+
this.scope.addStatement(ts27.factory.createExpressionStatement(outputField));
|
|
3979
4356
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
3980
|
-
this.scope.addStatement(
|
|
4357
|
+
this.scope.addStatement(ts27.factory.createExpressionStatement(handler));
|
|
3981
4358
|
}
|
|
3982
4359
|
ExpressionSemanticVisitor.visit(output.handler, this.tcb.id, this.tcb.boundTarget, this.tcb.oobRecorder);
|
|
3983
4360
|
}
|
|
@@ -4010,24 +4387,24 @@ var TcbUnclaimedOutputsOp = class extends TcbOp {
|
|
|
4010
4387
|
if (output.type === 1) {
|
|
4011
4388
|
const eventType = this.tcb.env.config.checkTypeOfAnimationEvents ? this.tcb.env.referenceExternalType("@angular/animations", "AnimationEvent") : 1;
|
|
4012
4389
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, eventType);
|
|
4013
|
-
this.scope.addStatement(
|
|
4390
|
+
this.scope.addStatement(ts27.factory.createExpressionStatement(handler));
|
|
4014
4391
|
} else if (this.tcb.env.config.checkTypeOfDomEvents) {
|
|
4015
4392
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
4016
4393
|
if (elId === null) {
|
|
4017
4394
|
elId = this.scope.resolve(this.element);
|
|
4018
4395
|
}
|
|
4019
|
-
const propertyAccess =
|
|
4396
|
+
const propertyAccess = ts27.factory.createPropertyAccessExpression(elId, "addEventListener");
|
|
4020
4397
|
addParseSpanInfo(propertyAccess, output.keySpan);
|
|
4021
|
-
const call =
|
|
4398
|
+
const call = ts27.factory.createCallExpression(
|
|
4022
4399
|
propertyAccess,
|
|
4023
4400
|
void 0,
|
|
4024
|
-
[
|
|
4401
|
+
[ts27.factory.createStringLiteral(output.name), handler]
|
|
4025
4402
|
);
|
|
4026
4403
|
addParseSpanInfo(call, output.sourceSpan);
|
|
4027
|
-
this.scope.addStatement(
|
|
4404
|
+
this.scope.addStatement(ts27.factory.createExpressionStatement(call));
|
|
4028
4405
|
} else {
|
|
4029
4406
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
4030
|
-
this.scope.addStatement(
|
|
4407
|
+
this.scope.addStatement(ts27.factory.createExpressionStatement(handler));
|
|
4031
4408
|
}
|
|
4032
4409
|
ExpressionSemanticVisitor.visit(output.handler, this.tcb.id, this.tcb.boundTarget, this.tcb.oobRecorder);
|
|
4033
4410
|
}
|
|
@@ -4041,15 +4418,124 @@ var TcbComponentContextCompletionOp = class extends TcbOp {
|
|
|
4041
4418
|
this.optional = false;
|
|
4042
4419
|
}
|
|
4043
4420
|
execute() {
|
|
4044
|
-
const ctx =
|
|
4045
|
-
const ctxDot =
|
|
4421
|
+
const ctx = ts27.factory.createThis();
|
|
4422
|
+
const ctxDot = ts27.factory.createPropertyAccessExpression(ctx, "");
|
|
4046
4423
|
markIgnoreDiagnostics(ctxDot);
|
|
4047
4424
|
addExpressionIdentifier(ctxDot, ExpressionIdentifier.COMPONENT_COMPLETION);
|
|
4048
|
-
this.scope.addStatement(
|
|
4425
|
+
this.scope.addStatement(ts27.factory.createExpressionStatement(ctxDot));
|
|
4426
|
+
return null;
|
|
4427
|
+
}
|
|
4428
|
+
};
|
|
4429
|
+
var TcbBlockVariableOp = class extends TcbOp {
|
|
4430
|
+
constructor(tcb, scope, initializer, variable) {
|
|
4431
|
+
super();
|
|
4432
|
+
this.tcb = tcb;
|
|
4433
|
+
this.scope = scope;
|
|
4434
|
+
this.initializer = initializer;
|
|
4435
|
+
this.variable = variable;
|
|
4436
|
+
}
|
|
4437
|
+
get optional() {
|
|
4438
|
+
return false;
|
|
4439
|
+
}
|
|
4440
|
+
execute() {
|
|
4441
|
+
const id = this.tcb.allocateId();
|
|
4442
|
+
addParseSpanInfo(id, this.variable.keySpan);
|
|
4443
|
+
this.scope.addStatement(tsCreateVariable(id, this.initializer));
|
|
4444
|
+
return id;
|
|
4445
|
+
}
|
|
4446
|
+
};
|
|
4447
|
+
var TcbBlockImplicitVariableOp = class extends TcbOp {
|
|
4448
|
+
constructor(tcb, scope, type, variable) {
|
|
4449
|
+
super();
|
|
4450
|
+
this.tcb = tcb;
|
|
4451
|
+
this.scope = scope;
|
|
4452
|
+
this.type = type;
|
|
4453
|
+
this.variable = variable;
|
|
4454
|
+
}
|
|
4455
|
+
get optional() {
|
|
4456
|
+
return false;
|
|
4457
|
+
}
|
|
4458
|
+
execute() {
|
|
4459
|
+
const id = this.tcb.allocateId();
|
|
4460
|
+
addParseSpanInfo(id, this.variable.keySpan);
|
|
4461
|
+
this.scope.addStatement(tsDeclareVariable(id, this.type));
|
|
4462
|
+
return id;
|
|
4463
|
+
}
|
|
4464
|
+
};
|
|
4465
|
+
var TcbIfOp = class extends TcbOp {
|
|
4466
|
+
constructor(tcb, scope, block) {
|
|
4467
|
+
super();
|
|
4468
|
+
this.tcb = tcb;
|
|
4469
|
+
this.scope = scope;
|
|
4470
|
+
this.block = block;
|
|
4471
|
+
}
|
|
4472
|
+
get optional() {
|
|
4473
|
+
return false;
|
|
4474
|
+
}
|
|
4475
|
+
execute() {
|
|
4476
|
+
const root = this.generateBranch(0);
|
|
4477
|
+
root && this.scope.addStatement(root);
|
|
4049
4478
|
return null;
|
|
4050
4479
|
}
|
|
4480
|
+
generateBranch(index) {
|
|
4481
|
+
const branch = this.block.branches[index];
|
|
4482
|
+
if (!branch) {
|
|
4483
|
+
return void 0;
|
|
4484
|
+
}
|
|
4485
|
+
const branchScope = Scope.forNodes(this.tcb, this.scope, branch, null);
|
|
4486
|
+
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));
|
|
4487
|
+
}
|
|
4051
4488
|
};
|
|
4052
|
-
var
|
|
4489
|
+
var TcbSwitchOp = class extends TcbOp {
|
|
4490
|
+
constructor(tcb, scope, block) {
|
|
4491
|
+
super();
|
|
4492
|
+
this.tcb = tcb;
|
|
4493
|
+
this.scope = scope;
|
|
4494
|
+
this.block = block;
|
|
4495
|
+
}
|
|
4496
|
+
get optional() {
|
|
4497
|
+
return false;
|
|
4498
|
+
}
|
|
4499
|
+
execute() {
|
|
4500
|
+
const clauses = [];
|
|
4501
|
+
for (const current of this.block.cases) {
|
|
4502
|
+
const breakStatement = ts27.factory.createBreakStatement();
|
|
4503
|
+
const clauseScope = Scope.forNodes(this.tcb, this.scope, current.children, null);
|
|
4504
|
+
if (current.expression === null) {
|
|
4505
|
+
clauses.push(ts27.factory.createDefaultClause([...clauseScope.render(), breakStatement]));
|
|
4506
|
+
} else {
|
|
4507
|
+
clauses.push(ts27.factory.createCaseClause(tcbExpression(current.expression, this.tcb, clauseScope), [...clauseScope.render(), breakStatement]));
|
|
4508
|
+
}
|
|
4509
|
+
}
|
|
4510
|
+
this.scope.addStatement(ts27.factory.createSwitchStatement(tcbExpression(this.block.expression, this.tcb, this.scope), ts27.factory.createCaseBlock(clauses)));
|
|
4511
|
+
return null;
|
|
4512
|
+
}
|
|
4513
|
+
};
|
|
4514
|
+
var TcbForOfOp = class extends TcbOp {
|
|
4515
|
+
constructor(tcb, scope, block) {
|
|
4516
|
+
super();
|
|
4517
|
+
this.tcb = tcb;
|
|
4518
|
+
this.scope = scope;
|
|
4519
|
+
this.block = block;
|
|
4520
|
+
}
|
|
4521
|
+
get optional() {
|
|
4522
|
+
return false;
|
|
4523
|
+
}
|
|
4524
|
+
execute() {
|
|
4525
|
+
const loopScope = Scope.forNodes(this.tcb, this.scope, this.block, null);
|
|
4526
|
+
const initializer = ts27.factory.createVariableDeclarationList([ts27.factory.createVariableDeclaration(this.block.item.name)], ts27.NodeFlags.Const);
|
|
4527
|
+
const expression = tcbExpression(this.block.expression, this.tcb, loopScope);
|
|
4528
|
+
const trackTranslator = new TcbForLoopTrackTranslator(this.tcb, loopScope, this.block);
|
|
4529
|
+
const trackExpression = trackTranslator.translate(this.block.trackBy);
|
|
4530
|
+
const statements = [
|
|
4531
|
+
...loopScope.render(),
|
|
4532
|
+
ts27.factory.createExpressionStatement(trackExpression)
|
|
4533
|
+
];
|
|
4534
|
+
this.scope.addStatement(ts27.factory.createForOfStatement(void 0, initializer, expression, ts27.factory.createBlock(statements)));
|
|
4535
|
+
return null;
|
|
4536
|
+
}
|
|
4537
|
+
};
|
|
4538
|
+
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR = ts27.factory.createNonNullExpression(ts27.factory.createNull());
|
|
4053
4539
|
var Context = class {
|
|
4054
4540
|
constructor(env, domSchemaChecker, oobRecorder, id, boundTarget, pipes, schemas, hostIsStandalone) {
|
|
4055
4541
|
this.env = env;
|
|
@@ -4063,7 +4549,7 @@ var Context = class {
|
|
|
4063
4549
|
this.nextId = 1;
|
|
4064
4550
|
}
|
|
4065
4551
|
allocateId() {
|
|
4066
|
-
return
|
|
4552
|
+
return ts27.factory.createIdentifier(`_t${this.nextId++}`);
|
|
4067
4553
|
}
|
|
4068
4554
|
getPipeByName(name) {
|
|
4069
4555
|
if (!this.pipes.has(name)) {
|
|
@@ -4085,47 +4571,63 @@ var Scope = class {
|
|
|
4085
4571
|
this.varMap = /* @__PURE__ */ new Map();
|
|
4086
4572
|
this.statements = [];
|
|
4087
4573
|
}
|
|
4088
|
-
static forNodes(tcb, parent,
|
|
4574
|
+
static forNodes(tcb, parent, blockOrNodes, guard) {
|
|
4089
4575
|
const scope = new Scope(tcb, parent, guard);
|
|
4090
4576
|
if (parent === null && tcb.env.config.enableTemplateTypeChecker) {
|
|
4091
4577
|
scope.opQueue.push(new TcbComponentContextCompletionOp(scope));
|
|
4092
4578
|
}
|
|
4093
4579
|
let children;
|
|
4094
|
-
if (
|
|
4580
|
+
if (blockOrNodes instanceof TmplAstTemplate2) {
|
|
4095
4581
|
const varMap = /* @__PURE__ */ new Map();
|
|
4096
|
-
for (const v of
|
|
4582
|
+
for (const v of blockOrNodes.variables) {
|
|
4097
4583
|
if (!varMap.has(v.name)) {
|
|
4098
4584
|
varMap.set(v.name, v);
|
|
4099
4585
|
} else {
|
|
4100
4586
|
const firstDecl = varMap.get(v.name);
|
|
4101
4587
|
tcb.oobRecorder.duplicateTemplateVar(tcb.id, v, firstDecl);
|
|
4102
4588
|
}
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4589
|
+
this.registerVariable(scope, v, new TcbTemplateVariableOp(tcb, scope, blockOrNodes, v));
|
|
4590
|
+
}
|
|
4591
|
+
children = blockOrNodes.children;
|
|
4592
|
+
} else if (blockOrNodes instanceof TmplAstIfBlockBranch) {
|
|
4593
|
+
const { expression, expressionAlias } = blockOrNodes;
|
|
4594
|
+
if (expression !== null && expressionAlias !== null) {
|
|
4595
|
+
this.registerVariable(scope, expressionAlias, new TcbBlockVariableOp(tcb, scope, tcbExpression(expression, tcb, scope), expressionAlias));
|
|
4596
|
+
}
|
|
4597
|
+
children = blockOrNodes.children;
|
|
4598
|
+
} else if (blockOrNodes instanceof TmplAstForLoopBlock) {
|
|
4599
|
+
this.registerVariable(scope, blockOrNodes.item, new TcbBlockVariableOp(tcb, scope, ts27.factory.createIdentifier(blockOrNodes.item.name), blockOrNodes.item));
|
|
4600
|
+
for (const variable of Object.values(blockOrNodes.contextVariables)) {
|
|
4601
|
+
const type = ts27.factory.createKeywordTypeNode(ts27.SyntaxKind.NumberKeyword);
|
|
4602
|
+
this.registerVariable(scope, variable, new TcbBlockImplicitVariableOp(tcb, scope, type, variable));
|
|
4603
|
+
}
|
|
4604
|
+
children = blockOrNodes.children;
|
|
4107
4605
|
} else {
|
|
4108
|
-
children =
|
|
4606
|
+
children = blockOrNodes;
|
|
4109
4607
|
}
|
|
4110
4608
|
for (const node of children) {
|
|
4111
4609
|
scope.appendNode(node);
|
|
4112
4610
|
}
|
|
4113
4611
|
return scope;
|
|
4114
4612
|
}
|
|
4613
|
+
static registerVariable(scope, variable, op) {
|
|
4614
|
+
const opIndex = scope.opQueue.push(op) - 1;
|
|
4615
|
+
scope.varMap.set(variable, opIndex);
|
|
4616
|
+
}
|
|
4115
4617
|
resolve(node, directive) {
|
|
4116
4618
|
const res = this.resolveLocal(node, directive);
|
|
4117
4619
|
if (res !== null) {
|
|
4118
4620
|
let clone;
|
|
4119
|
-
if (
|
|
4120
|
-
clone =
|
|
4121
|
-
} else if (
|
|
4122
|
-
clone =
|
|
4621
|
+
if (ts27.isIdentifier(res)) {
|
|
4622
|
+
clone = ts27.factory.createIdentifier(res.text);
|
|
4623
|
+
} else if (ts27.isNonNullExpression(res)) {
|
|
4624
|
+
clone = ts27.factory.createNonNullExpression(res.expression);
|
|
4123
4625
|
} else {
|
|
4124
4626
|
throw new Error(`Could not resolve ${node} to an Identifier or a NonNullExpression`);
|
|
4125
4627
|
}
|
|
4126
|
-
|
|
4628
|
+
ts27.setOriginalNode(clone, res);
|
|
4127
4629
|
clone.parent = clone.parent;
|
|
4128
|
-
return
|
|
4630
|
+
return ts27.setSyntheticTrailingComments(clone, []);
|
|
4129
4631
|
} else if (this.parent !== null) {
|
|
4130
4632
|
return this.parent.resolve(node, directive);
|
|
4131
4633
|
} else {
|
|
@@ -4152,7 +4654,7 @@ var Scope = class {
|
|
|
4152
4654
|
} else if (parentGuards === null) {
|
|
4153
4655
|
return this.guard;
|
|
4154
4656
|
} else {
|
|
4155
|
-
return
|
|
4657
|
+
return ts27.factory.createBinaryExpression(parentGuards, ts27.SyntaxKind.AmpersandAmpersandToken, this.guard);
|
|
4156
4658
|
}
|
|
4157
4659
|
}
|
|
4158
4660
|
resolveLocal(ref, directive) {
|
|
@@ -4222,15 +4724,11 @@ var Scope = class {
|
|
|
4222
4724
|
node.loading !== null && this.appendChildren(node.loading);
|
|
4223
4725
|
node.error !== null && this.appendChildren(node.error);
|
|
4224
4726
|
} else if (node instanceof TmplAstIfBlock) {
|
|
4225
|
-
|
|
4226
|
-
this.appendChildren(branch);
|
|
4227
|
-
}
|
|
4727
|
+
this.opQueue.push(new TcbIfOp(this.tcb, this, node));
|
|
4228
4728
|
} else if (node instanceof TmplAstSwitchBlock) {
|
|
4229
|
-
|
|
4230
|
-
this.appendChildren(currentCase);
|
|
4231
|
-
}
|
|
4729
|
+
this.opQueue.push(new TcbSwitchOp(this.tcb, this, node));
|
|
4232
4730
|
} else if (node instanceof TmplAstForLoopBlock) {
|
|
4233
|
-
this.
|
|
4731
|
+
this.opQueue.push(new TcbForOfOp(this.tcb, this, node));
|
|
4234
4732
|
node.empty && this.appendChildren(node.empty);
|
|
4235
4733
|
} else if (node instanceof TmplAstBoundText) {
|
|
4236
4734
|
this.opQueue.push(new TcbExpressionOp(this.tcb, this, node.value));
|
|
@@ -4353,12 +4851,12 @@ var Scope = class {
|
|
|
4353
4851
|
}
|
|
4354
4852
|
};
|
|
4355
4853
|
function tcbThisParam(name, typeArguments) {
|
|
4356
|
-
return
|
|
4854
|
+
return ts27.factory.createParameterDeclaration(
|
|
4357
4855
|
void 0,
|
|
4358
4856
|
void 0,
|
|
4359
4857
|
"this",
|
|
4360
4858
|
void 0,
|
|
4361
|
-
|
|
4859
|
+
ts27.factory.createTypeReferenceNode(name, typeArguments),
|
|
4362
4860
|
void 0
|
|
4363
4861
|
);
|
|
4364
4862
|
}
|
|
@@ -4383,11 +4881,11 @@ var TcbExpressionTranslator = class {
|
|
|
4383
4881
|
return null;
|
|
4384
4882
|
}
|
|
4385
4883
|
const expr = this.translate(ast.value);
|
|
4386
|
-
const result =
|
|
4884
|
+
const result = ts27.factory.createParenthesizedExpression(ts27.factory.createBinaryExpression(target, ts27.SyntaxKind.EqualsToken, expr));
|
|
4387
4885
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
4388
4886
|
return result;
|
|
4389
4887
|
} else if (ast instanceof ImplicitReceiver4) {
|
|
4390
|
-
return
|
|
4888
|
+
return ts27.factory.createThis();
|
|
4391
4889
|
} else if (ast instanceof BindingPipe) {
|
|
4392
4890
|
const expr = this.translate(ast.exp);
|
|
4393
4891
|
const pipeRef = this.tcb.getPipeByName(ast.name);
|
|
@@ -4399,12 +4897,12 @@ var TcbExpressionTranslator = class {
|
|
|
4399
4897
|
pipe = this.tcb.env.pipeInst(pipeRef);
|
|
4400
4898
|
}
|
|
4401
4899
|
const args = ast.args.map((arg) => this.translate(arg));
|
|
4402
|
-
let methodAccess =
|
|
4900
|
+
let methodAccess = ts27.factory.createPropertyAccessExpression(pipe, "transform");
|
|
4403
4901
|
addParseSpanInfo(methodAccess, ast.nameSpan);
|
|
4404
4902
|
if (!this.tcb.env.config.checkTypeOfPipes) {
|
|
4405
|
-
methodAccess =
|
|
4903
|
+
methodAccess = ts27.factory.createAsExpression(methodAccess, ts27.factory.createKeywordTypeNode(ts27.SyntaxKind.AnyKeyword));
|
|
4406
4904
|
}
|
|
4407
|
-
const result =
|
|
4905
|
+
const result = ts27.factory.createCallExpression(
|
|
4408
4906
|
methodAccess,
|
|
4409
4907
|
void 0,
|
|
4410
4908
|
[expr, ...args]
|
|
@@ -4414,8 +4912,8 @@ var TcbExpressionTranslator = class {
|
|
|
4414
4912
|
} else if ((ast instanceof Call2 || ast instanceof SafeCall) && (ast.receiver instanceof PropertyRead4 || ast.receiver instanceof SafePropertyRead3)) {
|
|
4415
4913
|
if (ast.receiver.receiver instanceof ImplicitReceiver4 && !(ast.receiver.receiver instanceof ThisReceiver) && ast.receiver.name === "$any" && ast.args.length === 1) {
|
|
4416
4914
|
const expr = this.translate(ast.args[0]);
|
|
4417
|
-
const exprAsAny =
|
|
4418
|
-
const result =
|
|
4915
|
+
const exprAsAny = ts27.factory.createAsExpression(expr, ts27.factory.createKeywordTypeNode(ts27.SyntaxKind.AnyKeyword));
|
|
4916
|
+
const result = ts27.factory.createParenthesizedExpression(exprAsAny);
|
|
4419
4917
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
4420
4918
|
return result;
|
|
4421
4919
|
}
|
|
@@ -4426,7 +4924,7 @@ var TcbExpressionTranslator = class {
|
|
|
4426
4924
|
const method = wrapForDiagnostics(receiver);
|
|
4427
4925
|
addParseSpanInfo(method, ast.receiver.nameSpan);
|
|
4428
4926
|
const args = ast.args.map((arg) => this.translate(arg));
|
|
4429
|
-
const node =
|
|
4927
|
+
const node = ts27.factory.createCallExpression(method, void 0, args);
|
|
4430
4928
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
4431
4929
|
return node;
|
|
4432
4930
|
} else {
|
|
@@ -4446,20 +4944,20 @@ var TcbExpressionTranslator = class {
|
|
|
4446
4944
|
function tcbCallTypeCtor(dir, tcb, inputs) {
|
|
4447
4945
|
const typeCtor = tcb.env.typeCtorFor(dir);
|
|
4448
4946
|
const members = inputs.map((input) => {
|
|
4449
|
-
const propertyName =
|
|
4947
|
+
const propertyName = ts27.factory.createStringLiteral(input.field);
|
|
4450
4948
|
if (input.type === "binding") {
|
|
4451
4949
|
const expr = widenBinding(input.expression, tcb);
|
|
4452
|
-
const assignment =
|
|
4950
|
+
const assignment = ts27.factory.createPropertyAssignment(propertyName, wrapForDiagnostics(expr));
|
|
4453
4951
|
addParseSpanInfo(assignment, input.sourceSpan);
|
|
4454
4952
|
return assignment;
|
|
4455
4953
|
} else {
|
|
4456
|
-
return
|
|
4954
|
+
return ts27.factory.createPropertyAssignment(propertyName, NULL_AS_ANY);
|
|
4457
4955
|
}
|
|
4458
4956
|
});
|
|
4459
|
-
return
|
|
4957
|
+
return ts27.factory.createCallExpression(
|
|
4460
4958
|
typeCtor,
|
|
4461
4959
|
void 0,
|
|
4462
|
-
[
|
|
4960
|
+
[ts27.factory.createObjectLiteralExpression(members)]
|
|
4463
4961
|
);
|
|
4464
4962
|
}
|
|
4465
4963
|
function getBoundAttributes(directive, node) {
|
|
@@ -4494,17 +4992,17 @@ function translateInput(attr, tcb, scope) {
|
|
|
4494
4992
|
if (attr instanceof TmplAstBoundAttribute) {
|
|
4495
4993
|
return tcbExpression(attr.value, tcb, scope);
|
|
4496
4994
|
} else {
|
|
4497
|
-
return
|
|
4995
|
+
return ts27.factory.createStringLiteral(attr.value);
|
|
4498
4996
|
}
|
|
4499
4997
|
}
|
|
4500
4998
|
function widenBinding(expr, tcb) {
|
|
4501
4999
|
if (!tcb.env.config.checkTypeOfInputBindings) {
|
|
4502
5000
|
return tsCastToAny(expr);
|
|
4503
5001
|
} else if (!tcb.env.config.strictNullInputBindings) {
|
|
4504
|
-
if (
|
|
5002
|
+
if (ts27.isObjectLiteralExpression(expr) || ts27.isArrayLiteralExpression(expr)) {
|
|
4505
5003
|
return expr;
|
|
4506
5004
|
} else {
|
|
4507
|
-
return
|
|
5005
|
+
return ts27.factory.createNonNullExpression(expr);
|
|
4508
5006
|
}
|
|
4509
5007
|
} else {
|
|
4510
5008
|
return expr;
|
|
@@ -4517,16 +5015,16 @@ function tcbCreateEventHandler(event, tcb, scope, eventType) {
|
|
|
4517
5015
|
if (eventType === 0) {
|
|
4518
5016
|
eventParamType = void 0;
|
|
4519
5017
|
} else if (eventType === 1) {
|
|
4520
|
-
eventParamType =
|
|
5018
|
+
eventParamType = ts27.factory.createKeywordTypeNode(ts27.SyntaxKind.AnyKeyword);
|
|
4521
5019
|
} else {
|
|
4522
5020
|
eventParamType = eventType;
|
|
4523
5021
|
}
|
|
4524
5022
|
const guards = scope.guards();
|
|
4525
|
-
let body =
|
|
5023
|
+
let body = ts27.factory.createExpressionStatement(handler);
|
|
4526
5024
|
if (guards !== null) {
|
|
4527
|
-
body =
|
|
5025
|
+
body = ts27.factory.createIfStatement(guards, body);
|
|
4528
5026
|
}
|
|
4529
|
-
const eventParam =
|
|
5027
|
+
const eventParam = ts27.factory.createParameterDeclaration(
|
|
4530
5028
|
void 0,
|
|
4531
5029
|
void 0,
|
|
4532
5030
|
EVENT_PARAMETER,
|
|
@@ -4534,13 +5032,13 @@ function tcbCreateEventHandler(event, tcb, scope, eventType) {
|
|
|
4534
5032
|
eventParamType
|
|
4535
5033
|
);
|
|
4536
5034
|
addExpressionIdentifier(eventParam, ExpressionIdentifier.EVENT_PARAMETER);
|
|
4537
|
-
return
|
|
5035
|
+
return ts27.factory.createArrowFunction(
|
|
4538
5036
|
void 0,
|
|
4539
5037
|
void 0,
|
|
4540
5038
|
[eventParam],
|
|
4541
|
-
|
|
5039
|
+
ts27.factory.createKeywordTypeNode(ts27.SyntaxKind.AnyKeyword),
|
|
4542
5040
|
void 0,
|
|
4543
|
-
|
|
5041
|
+
ts27.factory.createBlock([body])
|
|
4544
5042
|
);
|
|
4545
5043
|
}
|
|
4546
5044
|
function tcbEventHandlerExpression(ast, tcb, scope) {
|
|
@@ -4569,41 +5067,56 @@ function isSplitTwoWayBinding(inputName, output, inputs, tcb) {
|
|
|
4569
5067
|
var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
|
|
4570
5068
|
resolve(ast) {
|
|
4571
5069
|
if (ast instanceof PropertyRead4 && ast.receiver instanceof ImplicitReceiver4 && !(ast.receiver instanceof ThisReceiver) && ast.name === EVENT_PARAMETER) {
|
|
4572
|
-
const event =
|
|
5070
|
+
const event = ts27.factory.createIdentifier(EVENT_PARAMETER);
|
|
4573
5071
|
addParseSpanInfo(event, ast.nameSpan);
|
|
4574
5072
|
return event;
|
|
4575
5073
|
}
|
|
4576
5074
|
return super.resolve(ast);
|
|
4577
5075
|
}
|
|
4578
5076
|
};
|
|
5077
|
+
var TcbForLoopTrackTranslator = class extends TcbExpressionTranslator {
|
|
5078
|
+
constructor(tcb, scope, block) {
|
|
5079
|
+
super(tcb, scope);
|
|
5080
|
+
this.block = block;
|
|
5081
|
+
}
|
|
5082
|
+
resolve(ast) {
|
|
5083
|
+
if (ast instanceof PropertyRead4 && ast.receiver instanceof ImplicitReceiver4) {
|
|
5084
|
+
const target = this.tcb.boundTarget.getExpressionTarget(ast);
|
|
5085
|
+
if (target !== null && target !== this.block.item && target !== this.block.contextVariables.$index) {
|
|
5086
|
+
this.tcb.oobRecorder.illegalForLoopTrackAccess(this.tcb.id, this.block, ast);
|
|
5087
|
+
}
|
|
5088
|
+
}
|
|
5089
|
+
return super.resolve(ast);
|
|
5090
|
+
}
|
|
5091
|
+
};
|
|
4579
5092
|
|
|
4580
|
-
// bazel-out/
|
|
4581
|
-
import
|
|
5093
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_file.mjs
|
|
5094
|
+
import ts28 from "typescript";
|
|
4582
5095
|
var TypeCheckFile = class extends Environment {
|
|
4583
5096
|
constructor(fileName, config, refEmitter, reflector, compilerHost) {
|
|
4584
|
-
super(config, new ImportManager(new NoopImportRewriter(), "i"), refEmitter, reflector,
|
|
5097
|
+
super(config, new ImportManager(new NoopImportRewriter(), "i"), refEmitter, reflector, ts28.createSourceFile(compilerHost.getCanonicalFileName(fileName), "", ts28.ScriptTarget.Latest, true));
|
|
4585
5098
|
this.fileName = fileName;
|
|
4586
5099
|
this.nextTcbId = 1;
|
|
4587
5100
|
this.tcbStatements = [];
|
|
4588
5101
|
}
|
|
4589
5102
|
addTypeCheckBlock(ref, meta, domSchemaChecker, oobRecorder, genericContextBehavior) {
|
|
4590
|
-
const fnId =
|
|
5103
|
+
const fnId = ts28.factory.createIdentifier(`_tcb${this.nextTcbId++}`);
|
|
4591
5104
|
const fn = generateTypeCheckBlock(this, ref, fnId, meta, domSchemaChecker, oobRecorder, genericContextBehavior);
|
|
4592
5105
|
this.tcbStatements.push(fn);
|
|
4593
5106
|
}
|
|
4594
5107
|
render(removeComments) {
|
|
4595
5108
|
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 =
|
|
5109
|
+
const printer = ts28.createPrinter({ removeComments });
|
|
4597
5110
|
source += "\n";
|
|
4598
5111
|
for (const stmt of this.pipeInstStatements) {
|
|
4599
|
-
source += printer.printNode(
|
|
5112
|
+
source += printer.printNode(ts28.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
4600
5113
|
}
|
|
4601
5114
|
for (const stmt of this.typeCtorStatements) {
|
|
4602
|
-
source += printer.printNode(
|
|
5115
|
+
source += printer.printNode(ts28.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
4603
5116
|
}
|
|
4604
5117
|
source += "\n";
|
|
4605
5118
|
for (const stmt of this.tcbStatements) {
|
|
4606
|
-
source += printer.printNode(
|
|
5119
|
+
source += printer.printNode(ts28.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
4607
5120
|
}
|
|
4608
5121
|
source += "\nexport const IS_A_MODULE = true;\n";
|
|
4609
5122
|
return source;
|
|
@@ -4613,7 +5126,7 @@ var TypeCheckFile = class extends Environment {
|
|
|
4613
5126
|
}
|
|
4614
5127
|
};
|
|
4615
5128
|
|
|
4616
|
-
// bazel-out/
|
|
5129
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/context.mjs
|
|
4617
5130
|
var InliningMode;
|
|
4618
5131
|
(function(InliningMode2) {
|
|
4619
5132
|
InliningMode2[InliningMode2["InlineOps"] = 0] = "InlineOps";
|
|
@@ -4718,7 +5231,7 @@ var TypeCheckContextImpl = class {
|
|
|
4718
5231
|
const importManager = new ImportManager(new NoopImportRewriter(), "_i");
|
|
4719
5232
|
const ops = this.opMap.get(sf).sort(orderOps);
|
|
4720
5233
|
const textParts = splitStringAtPoints(sf.text, ops.map((op) => op.splitPoint));
|
|
4721
|
-
const printer =
|
|
5234
|
+
const printer = ts29.createPrinter({ omitTrailingSemicolon: true });
|
|
4722
5235
|
let code = textParts[0];
|
|
4723
5236
|
ops.forEach((op, idx) => {
|
|
4724
5237
|
const text = op.execute(importManager, sf, this.refEmitter, printer);
|
|
@@ -4799,7 +5312,7 @@ var TypeCheckContextImpl = class {
|
|
|
4799
5312
|
if (span.start.offset === span.end.offset) {
|
|
4800
5313
|
span.end.offset++;
|
|
4801
5314
|
}
|
|
4802
|
-
return makeTemplateDiagnostic(templateId, sourceMapping, span,
|
|
5315
|
+
return makeTemplateDiagnostic(templateId, sourceMapping, span, ts29.DiagnosticCategory.Error, ngErrorCode(ErrorCode.TEMPLATE_PARSE_ERROR), error.msg);
|
|
4803
5316
|
});
|
|
4804
5317
|
}
|
|
4805
5318
|
};
|
|
@@ -4817,9 +5330,9 @@ var InlineTcbOp = class {
|
|
|
4817
5330
|
}
|
|
4818
5331
|
execute(im, sf, refEmitter, printer) {
|
|
4819
5332
|
const env = new Environment(this.config, im, refEmitter, this.reflector, sf);
|
|
4820
|
-
const fnName =
|
|
5333
|
+
const fnName = ts29.factory.createIdentifier(`_tcb_${this.ref.node.pos}`);
|
|
4821
5334
|
const fn = generateTypeCheckBlock(env, this.ref, fnName, this.meta, this.domSchemaChecker, this.oobRecorder, TcbGenericContextBehavior.CopyClassNodes);
|
|
4822
|
-
return printer.printNode(
|
|
5335
|
+
return printer.printNode(ts29.EmitHint.Unspecified, fn, sf);
|
|
4823
5336
|
}
|
|
4824
5337
|
};
|
|
4825
5338
|
var TypeCtorOp = class {
|
|
@@ -4832,7 +5345,7 @@ var TypeCtorOp = class {
|
|
|
4832
5345
|
}
|
|
4833
5346
|
execute(im, sf, refEmitter, printer) {
|
|
4834
5347
|
const tcb = generateInlineTypeCtor(this.ref.node, this.meta);
|
|
4835
|
-
return printer.printNode(
|
|
5348
|
+
return printer.printNode(ts29.EmitHint.Unspecified, tcb, sf);
|
|
4836
5349
|
}
|
|
4837
5350
|
};
|
|
4838
5351
|
function orderOps(op1, op2) {
|
|
@@ -4850,10 +5363,10 @@ function splitStringAtPoints(str, points) {
|
|
|
4850
5363
|
return splits;
|
|
4851
5364
|
}
|
|
4852
5365
|
|
|
4853
|
-
// bazel-out/
|
|
5366
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/source.mjs
|
|
4854
5367
|
import { ParseLocation, ParseSourceSpan } from "@angular/compiler";
|
|
4855
5368
|
|
|
4856
|
-
// bazel-out/
|
|
5369
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/line_mappings.mjs
|
|
4857
5370
|
var LF_CHAR = 10;
|
|
4858
5371
|
var CR_CHAR = 13;
|
|
4859
5372
|
var LINE_SEP_CHAR = 8232;
|
|
@@ -4894,7 +5407,7 @@ function findClosestLineStartPosition(linesMap, position, low = 0, high = linesM
|
|
|
4894
5407
|
return low - 1;
|
|
4895
5408
|
}
|
|
4896
5409
|
|
|
4897
|
-
// bazel-out/
|
|
5410
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/source.mjs
|
|
4898
5411
|
var TemplateSource = class {
|
|
4899
5412
|
constructor(mapping, file) {
|
|
4900
5413
|
this.mapping = mapping;
|
|
@@ -4945,9 +5458,9 @@ var TemplateSourceManager = class {
|
|
|
4945
5458
|
}
|
|
4946
5459
|
};
|
|
4947
5460
|
|
|
4948
|
-
// bazel-out/
|
|
5461
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/template_symbol_builder.mjs
|
|
4949
5462
|
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
|
|
5463
|
+
import ts30 from "typescript";
|
|
4951
5464
|
var SymbolBuilder = class {
|
|
4952
5465
|
constructor(tcbPath, tcbIsShim, typeCheckBlock, templateData, componentScopeReader, getTypeChecker) {
|
|
4953
5466
|
this.tcbPath = tcbPath;
|
|
@@ -4991,7 +5504,7 @@ var SymbolBuilder = class {
|
|
|
4991
5504
|
getSymbolOfElement(element) {
|
|
4992
5505
|
var _a;
|
|
4993
5506
|
const elementSourceSpan = (_a = element.startSourceSpan) != null ? _a : element.sourceSpan;
|
|
4994
|
-
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: elementSourceSpan, filter:
|
|
5507
|
+
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: elementSourceSpan, filter: ts30.isVariableDeclaration });
|
|
4995
5508
|
if (node === null) {
|
|
4996
5509
|
return null;
|
|
4997
5510
|
}
|
|
@@ -5011,12 +5524,12 @@ var SymbolBuilder = class {
|
|
|
5011
5524
|
var _a;
|
|
5012
5525
|
const elementSourceSpan = (_a = element.startSourceSpan) != null ? _a : element.sourceSpan;
|
|
5013
5526
|
const tcbSourceFile = this.typeCheckBlock.getSourceFile();
|
|
5014
|
-
const isDirectiveDeclaration = (node) => (
|
|
5527
|
+
const isDirectiveDeclaration = (node) => (ts30.isTypeNode(node) || ts30.isIdentifier(node)) && ts30.isVariableDeclaration(node.parent) && hasExpressionIdentifier(tcbSourceFile, node, ExpressionIdentifier.DIRECTIVE);
|
|
5015
5528
|
const nodes = findAllMatchingNodes(this.typeCheckBlock, { withSpan: elementSourceSpan, filter: isDirectiveDeclaration });
|
|
5016
5529
|
const symbols = [];
|
|
5017
5530
|
for (const node of nodes) {
|
|
5018
5531
|
const symbol = this.getSymbolOfTsNode(node.parent);
|
|
5019
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
5532
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts30.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
5020
5533
|
continue;
|
|
5021
5534
|
}
|
|
5022
5535
|
const meta = this.getDirectiveMeta(element, symbol.tsSymbol.valueDeclaration);
|
|
@@ -5044,7 +5557,7 @@ var SymbolBuilder = class {
|
|
|
5044
5557
|
}
|
|
5045
5558
|
addHostDirectiveSymbols(host, hostDirectives, symbols) {
|
|
5046
5559
|
for (const current of hostDirectives) {
|
|
5047
|
-
if (!
|
|
5560
|
+
if (!ts30.isClassDeclaration(current.directive.node)) {
|
|
5048
5561
|
continue;
|
|
5049
5562
|
}
|
|
5050
5563
|
const symbol = this.getSymbolOfTsNode(current.directive.node);
|
|
@@ -5117,17 +5630,17 @@ var SymbolBuilder = class {
|
|
|
5117
5630
|
if (!isAccessExpression(n)) {
|
|
5118
5631
|
return false;
|
|
5119
5632
|
}
|
|
5120
|
-
if (
|
|
5633
|
+
if (ts30.isPropertyAccessExpression(n)) {
|
|
5121
5634
|
return n.name.getText() === expectedAccess;
|
|
5122
5635
|
} else {
|
|
5123
|
-
return
|
|
5636
|
+
return ts30.isStringLiteral(n.argumentExpression) && n.argumentExpression.text === expectedAccess;
|
|
5124
5637
|
}
|
|
5125
5638
|
}
|
|
5126
5639
|
const outputFieldAccesses = findAllMatchingNodes(this.typeCheckBlock, { withSpan: eventBinding.keySpan, filter });
|
|
5127
5640
|
const bindings = [];
|
|
5128
5641
|
for (const outputFieldAccess of outputFieldAccesses) {
|
|
5129
5642
|
if (consumer instanceof TmplAstTemplate3 || consumer instanceof TmplAstElement4) {
|
|
5130
|
-
if (!
|
|
5643
|
+
if (!ts30.isPropertyAccessExpression(outputFieldAccess)) {
|
|
5131
5644
|
continue;
|
|
5132
5645
|
}
|
|
5133
5646
|
const addEventListener = outputFieldAccess.name;
|
|
@@ -5150,7 +5663,7 @@ var SymbolBuilder = class {
|
|
|
5150
5663
|
}
|
|
5151
5664
|
});
|
|
5152
5665
|
} else {
|
|
5153
|
-
if (!
|
|
5666
|
+
if (!ts30.isElementAccessExpression(outputFieldAccess)) {
|
|
5154
5667
|
continue;
|
|
5155
5668
|
}
|
|
5156
5669
|
const tsSymbol = this.getTypeChecker().getSymbolAtLocation(outputFieldAccess.argumentExpression);
|
|
@@ -5223,7 +5736,7 @@ var SymbolBuilder = class {
|
|
|
5223
5736
|
return null;
|
|
5224
5737
|
}
|
|
5225
5738
|
const [declaration] = tsSymbol.declarations;
|
|
5226
|
-
if (!
|
|
5739
|
+
if (!ts30.isVariableDeclaration(declaration) || !hasExpressionIdentifier(
|
|
5227
5740
|
declaration.getSourceFile(),
|
|
5228
5741
|
(_a = declaration.type) != null ? _a : declaration.name,
|
|
5229
5742
|
ExpressionIdentifier.DIRECTIVE
|
|
@@ -5231,7 +5744,7 @@ var SymbolBuilder = class {
|
|
|
5231
5744
|
return null;
|
|
5232
5745
|
}
|
|
5233
5746
|
const symbol = this.getSymbolOfTsNode(declaration);
|
|
5234
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
5747
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts30.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
5235
5748
|
return null;
|
|
5236
5749
|
}
|
|
5237
5750
|
const ref = new Reference(symbol.tsSymbol.valueDeclaration);
|
|
@@ -5251,7 +5764,7 @@ var SymbolBuilder = class {
|
|
|
5251
5764
|
};
|
|
5252
5765
|
}
|
|
5253
5766
|
getSymbolOfVariable(variable) {
|
|
5254
|
-
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: variable.sourceSpan, filter:
|
|
5767
|
+
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: variable.sourceSpan, filter: ts30.isVariableDeclaration });
|
|
5255
5768
|
if (node === null || node.initializer === void 0) {
|
|
5256
5769
|
return null;
|
|
5257
5770
|
}
|
|
@@ -5274,11 +5787,11 @@ var SymbolBuilder = class {
|
|
|
5274
5787
|
}
|
|
5275
5788
|
getSymbolOfReference(ref) {
|
|
5276
5789
|
const target = this.templateData.boundTarget.getReferenceTarget(ref);
|
|
5277
|
-
let node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: ref.sourceSpan, filter:
|
|
5790
|
+
let node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: ref.sourceSpan, filter: ts30.isVariableDeclaration });
|
|
5278
5791
|
if (node === null || target === null || node.initializer === void 0) {
|
|
5279
5792
|
return null;
|
|
5280
5793
|
}
|
|
5281
|
-
const originalDeclaration =
|
|
5794
|
+
const originalDeclaration = ts30.isParenthesizedExpression(node.initializer) && ts30.isAsExpression(node.initializer.expression) ? this.getTypeChecker().getSymbolAtLocation(node.name) : this.getTypeChecker().getSymbolAtLocation(node.initializer);
|
|
5282
5795
|
if (originalDeclaration === void 0 || originalDeclaration.valueDeclaration === void 0) {
|
|
5283
5796
|
return null;
|
|
5284
5797
|
}
|
|
@@ -5302,7 +5815,7 @@ var SymbolBuilder = class {
|
|
|
5302
5815
|
referenceVarLocation: referenceVarTcbLocation
|
|
5303
5816
|
};
|
|
5304
5817
|
} else {
|
|
5305
|
-
if (!
|
|
5818
|
+
if (!ts30.isClassDeclaration(target.directive.ref.node)) {
|
|
5306
5819
|
return null;
|
|
5307
5820
|
}
|
|
5308
5821
|
return {
|
|
@@ -5317,7 +5830,7 @@ var SymbolBuilder = class {
|
|
|
5317
5830
|
}
|
|
5318
5831
|
}
|
|
5319
5832
|
getSymbolOfPipe(expression) {
|
|
5320
|
-
const methodAccess = findFirstMatchingNode(this.typeCheckBlock, { withSpan: expression.nameSpan, filter:
|
|
5833
|
+
const methodAccess = findFirstMatchingNode(this.typeCheckBlock, { withSpan: expression.nameSpan, filter: ts30.isPropertyAccessExpression });
|
|
5321
5834
|
if (methodAccess === null) {
|
|
5322
5835
|
return null;
|
|
5323
5836
|
}
|
|
@@ -5357,7 +5870,7 @@ var SymbolBuilder = class {
|
|
|
5357
5870
|
}
|
|
5358
5871
|
let node = null;
|
|
5359
5872
|
if (expression instanceof PropertyRead5) {
|
|
5360
|
-
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter:
|
|
5873
|
+
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter: ts30.isPropertyAccessExpression });
|
|
5361
5874
|
}
|
|
5362
5875
|
if (node === null) {
|
|
5363
5876
|
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter: anyNodeFilter });
|
|
@@ -5365,10 +5878,10 @@ var SymbolBuilder = class {
|
|
|
5365
5878
|
if (node === null) {
|
|
5366
5879
|
return null;
|
|
5367
5880
|
}
|
|
5368
|
-
while (
|
|
5881
|
+
while (ts30.isParenthesizedExpression(node)) {
|
|
5369
5882
|
node = node.expression;
|
|
5370
5883
|
}
|
|
5371
|
-
if (expression instanceof SafePropertyRead4 &&
|
|
5884
|
+
if (expression instanceof SafePropertyRead4 && ts30.isConditionalExpression(node)) {
|
|
5372
5885
|
const whenTrueSymbol = this.getSymbolOfTsNode(node.whenTrue);
|
|
5373
5886
|
if (whenTrueSymbol === null) {
|
|
5374
5887
|
return null;
|
|
@@ -5385,13 +5898,13 @@ var SymbolBuilder = class {
|
|
|
5385
5898
|
}
|
|
5386
5899
|
getSymbolOfTsNode(node) {
|
|
5387
5900
|
var _a;
|
|
5388
|
-
while (
|
|
5901
|
+
while (ts30.isParenthesizedExpression(node)) {
|
|
5389
5902
|
node = node.expression;
|
|
5390
5903
|
}
|
|
5391
5904
|
let tsSymbol;
|
|
5392
|
-
if (
|
|
5905
|
+
if (ts30.isPropertyAccessExpression(node)) {
|
|
5393
5906
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.name);
|
|
5394
|
-
} else if (
|
|
5907
|
+
} else if (ts30.isElementAccessExpression(node)) {
|
|
5395
5908
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.argumentExpression);
|
|
5396
5909
|
} else {
|
|
5397
5910
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node);
|
|
@@ -5409,13 +5922,13 @@ var SymbolBuilder = class {
|
|
|
5409
5922
|
};
|
|
5410
5923
|
}
|
|
5411
5924
|
getTcbPositionForNode(node) {
|
|
5412
|
-
if (
|
|
5925
|
+
if (ts30.isTypeReferenceNode(node)) {
|
|
5413
5926
|
return this.getTcbPositionForNode(node.typeName);
|
|
5414
|
-
} else if (
|
|
5927
|
+
} else if (ts30.isQualifiedName(node)) {
|
|
5415
5928
|
return node.right.getStart();
|
|
5416
|
-
} else if (
|
|
5929
|
+
} else if (ts30.isPropertyAccessExpression(node)) {
|
|
5417
5930
|
return node.name.getStart();
|
|
5418
|
-
} else if (
|
|
5931
|
+
} else if (ts30.isElementAccessExpression(node)) {
|
|
5419
5932
|
return node.argumentExpression.getStart();
|
|
5420
5933
|
} else {
|
|
5421
5934
|
return node.getStart();
|
|
@@ -5429,7 +5942,7 @@ function sourceSpanEqual(a, b) {
|
|
|
5429
5942
|
return a.start.offset === b.start.offset && a.end.offset === b.end.offset;
|
|
5430
5943
|
}
|
|
5431
5944
|
|
|
5432
|
-
// bazel-out/
|
|
5945
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/checker.mjs
|
|
5433
5946
|
var REGISTRY2 = new DomElementSchemaRegistry2();
|
|
5434
5947
|
var TemplateTypeCheckerImpl = class {
|
|
5435
5948
|
constructor(originalProgram, programDriver, typeCheckAdapter, config, refEmitter, reflector, compilerHost, priorBuild, metaReader, localMetaReader, ngModuleIndex, componentScopeReader, typeCheckScopeRegistry, perf) {
|
|
@@ -6126,10 +6639,10 @@ var SingleShimTypeCheckingHost = class extends SingleFileTypeCheckingHost {
|
|
|
6126
6639
|
}
|
|
6127
6640
|
};
|
|
6128
6641
|
|
|
6129
|
-
// bazel-out/
|
|
6642
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/invalid_banana_in_box/index.mjs
|
|
6130
6643
|
import { TmplAstBoundEvent as TmplAstBoundEvent2 } from "@angular/compiler";
|
|
6131
6644
|
|
|
6132
|
-
// bazel-out/
|
|
6645
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/api/api.mjs
|
|
6133
6646
|
import { ASTWithSource as ASTWithSource4, RecursiveAstVisitor as RecursiveAstVisitor3, TmplAstBoundDeferredTrigger as TmplAstBoundDeferredTrigger2 } from "@angular/compiler";
|
|
6134
6647
|
var TemplateCheckWithVisitor = class {
|
|
6135
6648
|
run(ctx, component, template) {
|
|
@@ -6226,6 +6739,8 @@ var TemplateVisitor2 = class extends RecursiveAstVisitor3 {
|
|
|
6226
6739
|
}
|
|
6227
6740
|
visitForLoopBlock(block) {
|
|
6228
6741
|
var _a;
|
|
6742
|
+
block.item.visit(this);
|
|
6743
|
+
this.visitAllNodes(Object.values(block.contextVariables));
|
|
6229
6744
|
this.visitAst(block.expression);
|
|
6230
6745
|
this.visitAllNodes(block.children);
|
|
6231
6746
|
(_a = block.empty) == null ? void 0 : _a.visit(this);
|
|
@@ -6237,7 +6752,9 @@ var TemplateVisitor2 = class extends RecursiveAstVisitor3 {
|
|
|
6237
6752
|
this.visitAllNodes(block.branches);
|
|
6238
6753
|
}
|
|
6239
6754
|
visitIfBlockBranch(block) {
|
|
6755
|
+
var _a;
|
|
6240
6756
|
block.expression && this.visitAst(block.expression);
|
|
6757
|
+
(_a = block.expressionAlias) == null ? void 0 : _a.visit(this);
|
|
6241
6758
|
this.visitAllNodes(block.children);
|
|
6242
6759
|
}
|
|
6243
6760
|
getDiagnostics(template) {
|
|
@@ -6247,7 +6764,7 @@ var TemplateVisitor2 = class extends RecursiveAstVisitor3 {
|
|
|
6247
6764
|
}
|
|
6248
6765
|
};
|
|
6249
6766
|
|
|
6250
|
-
// bazel-out/
|
|
6767
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/invalid_banana_in_box/index.mjs
|
|
6251
6768
|
var InvalidBananaInBoxCheck = class extends TemplateCheckWithVisitor {
|
|
6252
6769
|
constructor() {
|
|
6253
6770
|
super(...arguments);
|
|
@@ -6272,7 +6789,7 @@ var factory = {
|
|
|
6272
6789
|
create: () => new InvalidBananaInBoxCheck()
|
|
6273
6790
|
};
|
|
6274
6791
|
|
|
6275
|
-
// bazel-out/
|
|
6792
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/missing_control_flow_directive/index.mjs
|
|
6276
6793
|
import { TmplAstTemplate as TmplAstTemplate4 } from "@angular/compiler";
|
|
6277
6794
|
var KNOWN_CONTROL_FLOW_DIRECTIVES = /* @__PURE__ */ new Map([
|
|
6278
6795
|
["ngIf", "NgIf"],
|
|
@@ -6317,7 +6834,7 @@ var factory2 = {
|
|
|
6317
6834
|
}
|
|
6318
6835
|
};
|
|
6319
6836
|
|
|
6320
|
-
// bazel-out/
|
|
6837
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/missing_ngforof_let/index.mjs
|
|
6321
6838
|
import { TmplAstTemplate as TmplAstTemplate5 } from "@angular/compiler";
|
|
6322
6839
|
var MissingNgForOfLetCheck = class extends TemplateCheckWithVisitor {
|
|
6323
6840
|
constructor() {
|
|
@@ -6350,9 +6867,9 @@ var factory3 = {
|
|
|
6350
6867
|
create: () => new MissingNgForOfLetCheck()
|
|
6351
6868
|
};
|
|
6352
6869
|
|
|
6353
|
-
// bazel-out/
|
|
6870
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/nullish_coalescing_not_nullable/index.mjs
|
|
6354
6871
|
import { Binary } from "@angular/compiler";
|
|
6355
|
-
import
|
|
6872
|
+
import ts31 from "typescript";
|
|
6356
6873
|
var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
6357
6874
|
constructor() {
|
|
6358
6875
|
super(...arguments);
|
|
@@ -6366,7 +6883,7 @@ var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
6366
6883
|
return [];
|
|
6367
6884
|
}
|
|
6368
6885
|
const typeLeft = symbolLeft.tsType;
|
|
6369
|
-
if (typeLeft.flags & (
|
|
6886
|
+
if (typeLeft.flags & (ts31.TypeFlags.Any | ts31.TypeFlags.Unknown)) {
|
|
6370
6887
|
return [];
|
|
6371
6888
|
}
|
|
6372
6889
|
if (typeLeft.getNonNullableType() !== typeLeft)
|
|
@@ -6395,9 +6912,9 @@ var factory4 = {
|
|
|
6395
6912
|
}
|
|
6396
6913
|
};
|
|
6397
6914
|
|
|
6398
|
-
// bazel-out/
|
|
6915
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/optional_chain_not_nullable/index.mjs
|
|
6399
6916
|
import { SafeCall as SafeCall2, SafeKeyedRead as SafeKeyedRead2, SafePropertyRead as SafePropertyRead5 } from "@angular/compiler";
|
|
6400
|
-
import
|
|
6917
|
+
import ts32 from "typescript";
|
|
6401
6918
|
var OptionalChainNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
6402
6919
|
constructor() {
|
|
6403
6920
|
super(...arguments);
|
|
@@ -6411,7 +6928,7 @@ var OptionalChainNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
6411
6928
|
return [];
|
|
6412
6929
|
}
|
|
6413
6930
|
const typeLeft = symbolLeft.tsType;
|
|
6414
|
-
if (typeLeft.flags & (
|
|
6931
|
+
if (typeLeft.flags & (ts32.TypeFlags.Any | ts32.TypeFlags.Unknown)) {
|
|
6415
6932
|
return [];
|
|
6416
6933
|
}
|
|
6417
6934
|
if (typeLeft.getNonNullableType() !== typeLeft)
|
|
@@ -6441,7 +6958,7 @@ var factory5 = {
|
|
|
6441
6958
|
}
|
|
6442
6959
|
};
|
|
6443
6960
|
|
|
6444
|
-
// bazel-out/
|
|
6961
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/suffix_not_supported/index.mjs
|
|
6445
6962
|
import { TmplAstBoundAttribute as TmplAstBoundAttribute3 } from "@angular/compiler";
|
|
6446
6963
|
var STYLE_SUFFIXES = ["px", "%", "em"];
|
|
6447
6964
|
var SuffixNotSupportedCheck = class extends TemplateCheckWithVisitor {
|
|
@@ -6465,7 +6982,7 @@ var factory6 = {
|
|
|
6465
6982
|
create: () => new SuffixNotSupportedCheck()
|
|
6466
6983
|
};
|
|
6467
6984
|
|
|
6468
|
-
// bazel-out/
|
|
6985
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/text_attribute_not_binding/index.mjs
|
|
6469
6986
|
import { TmplAstTextAttribute as TmplAstTextAttribute4 } from "@angular/compiler";
|
|
6470
6987
|
var TextAttributeNotBindingSpec = class extends TemplateCheckWithVisitor {
|
|
6471
6988
|
constructor() {
|
|
@@ -6504,10 +7021,10 @@ var factory7 = {
|
|
|
6504
7021
|
create: () => new TextAttributeNotBindingSpec()
|
|
6505
7022
|
};
|
|
6506
7023
|
|
|
6507
|
-
// bazel-out/
|
|
6508
|
-
import
|
|
7024
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/src/extended_template_checker.mjs
|
|
7025
|
+
import ts33 from "typescript";
|
|
6509
7026
|
|
|
6510
|
-
// bazel-out/
|
|
7027
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/api/src/public_options.mjs
|
|
6511
7028
|
var DiagnosticCategoryLabel;
|
|
6512
7029
|
(function(DiagnosticCategoryLabel2) {
|
|
6513
7030
|
DiagnosticCategoryLabel2["Warning"] = "warning";
|
|
@@ -6515,7 +7032,7 @@ var DiagnosticCategoryLabel;
|
|
|
6515
7032
|
DiagnosticCategoryLabel2["Suppress"] = "suppress";
|
|
6516
7033
|
})(DiagnosticCategoryLabel || (DiagnosticCategoryLabel = {}));
|
|
6517
7034
|
|
|
6518
|
-
// bazel-out/
|
|
7035
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/src/extended_template_checker.mjs
|
|
6519
7036
|
var ExtendedTemplateCheckerImpl = class {
|
|
6520
7037
|
constructor(templateTypeChecker, typeChecker, templateCheckFactories, options) {
|
|
6521
7038
|
var _a, _b, _c, _d, _e;
|
|
@@ -6554,9 +7071,9 @@ var ExtendedTemplateCheckerImpl = class {
|
|
|
6554
7071
|
function diagnosticLabelToCategory(label) {
|
|
6555
7072
|
switch (label) {
|
|
6556
7073
|
case DiagnosticCategoryLabel.Warning:
|
|
6557
|
-
return
|
|
7074
|
+
return ts33.DiagnosticCategory.Warning;
|
|
6558
7075
|
case DiagnosticCategoryLabel.Error:
|
|
6559
|
-
return
|
|
7076
|
+
return ts33.DiagnosticCategory.Error;
|
|
6560
7077
|
case DiagnosticCategoryLabel.Suppress:
|
|
6561
7078
|
return null;
|
|
6562
7079
|
default:
|
|
@@ -6568,7 +7085,7 @@ function assertNever(value) {
|
|
|
6568
7085
|
${value}`);
|
|
6569
7086
|
}
|
|
6570
7087
|
|
|
6571
|
-
// bazel-out/
|
|
7088
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/index.mjs
|
|
6572
7089
|
var ALL_DIAGNOSTIC_FACTORIES = [
|
|
6573
7090
|
factory,
|
|
6574
7091
|
factory4,
|
|
@@ -6579,7 +7096,7 @@ var ALL_DIAGNOSTIC_FACTORIES = [
|
|
|
6579
7096
|
factory6
|
|
6580
7097
|
];
|
|
6581
7098
|
|
|
6582
|
-
// bazel-out/
|
|
7099
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/compiler.mjs
|
|
6583
7100
|
var CompilationTicketKind;
|
|
6584
7101
|
(function(CompilationTicketKind2) {
|
|
6585
7102
|
CompilationTicketKind2[CompilationTicketKind2["Fresh"] = 0] = "Fresh";
|
|
@@ -6664,13 +7181,13 @@ var NgCompiler = class {
|
|
|
6664
7181
|
this.constructionDiagnostics = [];
|
|
6665
7182
|
this.nonTemplateDiagnostics = null;
|
|
6666
7183
|
this.delegatingPerfRecorder = new DelegatingPerfRecorder(this.perfRecorder);
|
|
6667
|
-
this.enableTemplateTypeChecker = enableTemplateTypeChecker || ((_a = options
|
|
6668
|
-
this.enabledBlockTypes = new Set((_b = options
|
|
7184
|
+
this.enableTemplateTypeChecker = enableTemplateTypeChecker || ((_a = options["_enableTemplateTypeChecker"]) != null ? _a : false);
|
|
7185
|
+
this.enabledBlockTypes = new Set((_b = options["_enabledBlockTypes"]) != null ? _b : []);
|
|
6669
7186
|
this.constructionDiagnostics.push(...this.adapter.constructionDiagnostics, ...verifyCompatibleTypeCheckOptions(this.options));
|
|
6670
7187
|
this.currentProgram = inputProgram;
|
|
6671
7188
|
this.closureCompilerEnabled = !!this.options.annotateForClosureCompiler;
|
|
6672
7189
|
this.entryPoint = adapter.entryPoint !== null ? getSourceFileOrNull(inputProgram, adapter.entryPoint) : null;
|
|
6673
|
-
const moduleResolutionCache =
|
|
7190
|
+
const moduleResolutionCache = ts34.createModuleResolutionCache(
|
|
6674
7191
|
this.adapter.getCurrentDirectory(),
|
|
6675
7192
|
this.adapter.getCanonicalFileName.bind(this.adapter)
|
|
6676
7193
|
);
|
|
@@ -6714,7 +7231,7 @@ var NgCompiler = class {
|
|
|
6714
7231
|
}
|
|
6715
7232
|
for (const clazz of classesToUpdate) {
|
|
6716
7233
|
this.compilation.traitCompiler.updateResources(clazz);
|
|
6717
|
-
if (!
|
|
7234
|
+
if (!ts34.isClassDeclaration(clazz)) {
|
|
6718
7235
|
continue;
|
|
6719
7236
|
}
|
|
6720
7237
|
this.compilation.templateTypeChecker.invalidateClass(clazz);
|
|
@@ -6866,6 +7383,18 @@ var NgCompiler = class {
|
|
|
6866
7383
|
compilation.traitCompiler.index(context);
|
|
6867
7384
|
return generateAnalysis(context);
|
|
6868
7385
|
}
|
|
7386
|
+
getApiDocumentation(entryPoint) {
|
|
7387
|
+
const compilation = this.ensureAnalyzed();
|
|
7388
|
+
const checker = this.inputProgram.getTypeChecker();
|
|
7389
|
+
const docsExtractor = new DocsExtractor(checker, compilation.metaReader);
|
|
7390
|
+
const entryPointSourceFile = this.inputProgram.getSourceFiles().find((sourceFile) => {
|
|
7391
|
+
return sourceFile.fileName.includes(entryPoint);
|
|
7392
|
+
});
|
|
7393
|
+
if (!entryPointSourceFile) {
|
|
7394
|
+
throw new Error(`Entry point "${entryPoint}" not found in program sources.`);
|
|
7395
|
+
}
|
|
7396
|
+
return docsExtractor.extractAll(entryPointSourceFile);
|
|
7397
|
+
}
|
|
6869
7398
|
xi18n(ctx) {
|
|
6870
7399
|
const compilation = this.ensureAnalyzed();
|
|
6871
7400
|
compilation.traitCompiler.xi18n(ctx);
|
|
@@ -7057,7 +7586,7 @@ var NgCompiler = class {
|
|
|
7057
7586
|
const reflector = new TypeScriptReflectionHost(checker);
|
|
7058
7587
|
let refEmitter;
|
|
7059
7588
|
let aliasingHost = null;
|
|
7060
|
-
if (this.adapter.unifiedModulesHost === null || !this.options
|
|
7589
|
+
if (this.adapter.unifiedModulesHost === null || !this.options["_useHostForImportGeneration"]) {
|
|
7061
7590
|
let localImportStrategy;
|
|
7062
7591
|
if (this.options.rootDir !== void 0 || this.options.rootDirs !== void 0 && this.options.rootDirs.length > 0) {
|
|
7063
7592
|
localImportStrategy = new LogicalProjectStrategy(reflector, new LogicalFileSystem([...this.adapter.rootDirs], this.adapter));
|
|
@@ -7124,8 +7653,8 @@ var NgCompiler = class {
|
|
|
7124
7653
|
}
|
|
7125
7654
|
const cycleHandlingStrategy = compilationMode === CompilationMode.FULL ? 0 : 1;
|
|
7126
7655
|
const strictCtorDeps = this.options.strictInjectionParameters || false;
|
|
7127
|
-
const supportJitMode = (_a = this.options
|
|
7128
|
-
const supportTestBed = (_b = this.options
|
|
7656
|
+
const supportJitMode = (_a = this.options["supportJitMode"]) != null ? _a : true;
|
|
7657
|
+
const supportTestBed = (_b = this.options["supportTestBed"]) != null ? _b : true;
|
|
7129
7658
|
if (supportTestBed === false && compilationMode === CompilationMode.PARTIAL) {
|
|
7130
7659
|
throw new Error('TestBed support ("supportTestBed" option) cannot be disabled in partial compilation mode.');
|
|
7131
7660
|
}
|
|
@@ -7169,18 +7698,18 @@ function isAngularCorePackage(program) {
|
|
|
7169
7698
|
return false;
|
|
7170
7699
|
}
|
|
7171
7700
|
return r3Symbols.statements.some((stmt) => {
|
|
7172
|
-
if (!
|
|
7701
|
+
if (!ts34.isVariableStatement(stmt)) {
|
|
7173
7702
|
return false;
|
|
7174
7703
|
}
|
|
7175
|
-
const modifiers =
|
|
7176
|
-
if (modifiers === void 0 || !modifiers.some((mod) => mod.kind ===
|
|
7704
|
+
const modifiers = ts34.getModifiers(stmt);
|
|
7705
|
+
if (modifiers === void 0 || !modifiers.some((mod) => mod.kind === ts34.SyntaxKind.ExportKeyword)) {
|
|
7177
7706
|
return false;
|
|
7178
7707
|
}
|
|
7179
7708
|
return stmt.declarationList.declarations.some((decl) => {
|
|
7180
|
-
if (!
|
|
7709
|
+
if (!ts34.isIdentifier(decl.name) || decl.name.text !== "ITS_JUST_ANGULAR") {
|
|
7181
7710
|
return false;
|
|
7182
7711
|
}
|
|
7183
|
-
if (decl.initializer === void 0 || decl.initializer.kind !==
|
|
7712
|
+
if (decl.initializer === void 0 || decl.initializer.kind !== ts34.SyntaxKind.TrueKeyword) {
|
|
7184
7713
|
return false;
|
|
7185
7714
|
}
|
|
7186
7715
|
return true;
|
|
@@ -7194,7 +7723,7 @@ function* verifyCompatibleTypeCheckOptions(options) {
|
|
|
7194
7723
|
var _a, _b, _c;
|
|
7195
7724
|
if (options.fullTemplateTypeCheck === false && options.strictTemplates === true) {
|
|
7196
7725
|
yield makeConfigDiagnostic({
|
|
7197
|
-
category:
|
|
7726
|
+
category: ts34.DiagnosticCategory.Error,
|
|
7198
7727
|
code: ErrorCode.CONFIG_STRICT_TEMPLATES_IMPLIES_FULL_TEMPLATE_TYPECHECK,
|
|
7199
7728
|
messageText: `
|
|
7200
7729
|
Angular compiler option "strictTemplates" is enabled, however "fullTemplateTypeCheck" is disabled.
|
|
@@ -7213,7 +7742,7 @@ https://angular.io/guide/template-typecheck
|
|
|
7213
7742
|
}
|
|
7214
7743
|
if (options.extendedDiagnostics && options.strictTemplates === false) {
|
|
7215
7744
|
yield makeConfigDiagnostic({
|
|
7216
|
-
category:
|
|
7745
|
+
category: ts34.DiagnosticCategory.Error,
|
|
7217
7746
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_IMPLIES_STRICT_TEMPLATES,
|
|
7218
7747
|
messageText: `
|
|
7219
7748
|
Angular compiler option "extendedDiagnostics" is configured, however "strictTemplates" is disabled.
|
|
@@ -7230,7 +7759,7 @@ One of the following actions is required:
|
|
|
7230
7759
|
const defaultCategory = (_a = options.extendedDiagnostics) == null ? void 0 : _a.defaultCategory;
|
|
7231
7760
|
if (defaultCategory && !allowedCategoryLabels.includes(defaultCategory)) {
|
|
7232
7761
|
yield makeConfigDiagnostic({
|
|
7233
|
-
category:
|
|
7762
|
+
category: ts34.DiagnosticCategory.Error,
|
|
7234
7763
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
7235
7764
|
messageText: `
|
|
7236
7765
|
Angular compiler option "extendedDiagnostics.defaultCategory" has an unknown diagnostic category: "${defaultCategory}".
|
|
@@ -7244,7 +7773,7 @@ ${allowedCategoryLabels.join("\n")}
|
|
|
7244
7773
|
for (const [checkName, category] of Object.entries((_c = (_b = options.extendedDiagnostics) == null ? void 0 : _b.checks) != null ? _c : {})) {
|
|
7245
7774
|
if (!allExtendedDiagnosticNames.includes(checkName)) {
|
|
7246
7775
|
yield makeConfigDiagnostic({
|
|
7247
|
-
category:
|
|
7776
|
+
category: ts34.DiagnosticCategory.Error,
|
|
7248
7777
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CHECK,
|
|
7249
7778
|
messageText: `
|
|
7250
7779
|
Angular compiler option "extendedDiagnostics.checks" has an unknown check: "${checkName}".
|
|
@@ -7256,7 +7785,7 @@ ${allExtendedDiagnosticNames.join("\n")}
|
|
|
7256
7785
|
}
|
|
7257
7786
|
if (!allowedCategoryLabels.includes(category)) {
|
|
7258
7787
|
yield makeConfigDiagnostic({
|
|
7259
|
-
category:
|
|
7788
|
+
category: ts34.DiagnosticCategory.Error,
|
|
7260
7789
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
7261
7790
|
messageText: `
|
|
7262
7791
|
Angular compiler option "extendedDiagnostics.checks['${checkName}']" has an unknown diagnostic category: "${category}".
|
|
@@ -7286,7 +7815,7 @@ var ReferenceGraphAdapter = class {
|
|
|
7286
7815
|
for (const { node } of references) {
|
|
7287
7816
|
let sourceFile = node.getSourceFile();
|
|
7288
7817
|
if (sourceFile === void 0) {
|
|
7289
|
-
sourceFile =
|
|
7818
|
+
sourceFile = ts34.getOriginalNode(node).getSourceFile();
|
|
7290
7819
|
}
|
|
7291
7820
|
if (sourceFile === void 0 || !isDtsPath(sourceFile.fileName)) {
|
|
7292
7821
|
this.graph.add(source, node);
|
|
@@ -7324,8 +7853,8 @@ function versionMapFromProgram(program, driver) {
|
|
|
7324
7853
|
return versions;
|
|
7325
7854
|
}
|
|
7326
7855
|
|
|
7327
|
-
// bazel-out/
|
|
7328
|
-
import
|
|
7856
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/host.mjs
|
|
7857
|
+
import ts35 from "typescript";
|
|
7329
7858
|
var DelegatingCompilerHost2 = class {
|
|
7330
7859
|
constructor(delegate) {
|
|
7331
7860
|
this.delegate = delegate;
|
|
@@ -7404,7 +7933,7 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
7404
7933
|
entryPoint = findFlatIndexEntryPoint(normalizedTsInputFiles);
|
|
7405
7934
|
if (entryPoint === null) {
|
|
7406
7935
|
diagnostics.push({
|
|
7407
|
-
category:
|
|
7936
|
+
category: ts35.DiagnosticCategory.Error,
|
|
7408
7937
|
code: ngErrorCode(ErrorCode.CONFIG_FLAT_MODULE_NO_INDEX),
|
|
7409
7938
|
file: void 0,
|
|
7410
7939
|
start: void 0,
|
|
@@ -7447,17 +7976,17 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
7447
7976
|
return this.fileNameToModuleName !== void 0 ? this : null;
|
|
7448
7977
|
}
|
|
7449
7978
|
createCachedResolveModuleNamesFunction() {
|
|
7450
|
-
const moduleResolutionCache =
|
|
7979
|
+
const moduleResolutionCache = ts35.createModuleResolutionCache(this.getCurrentDirectory(), this.getCanonicalFileName.bind(this));
|
|
7451
7980
|
return (moduleNames, containingFile, reusedNames, redirectedReference, options) => {
|
|
7452
7981
|
return moduleNames.map((moduleName) => {
|
|
7453
|
-
const module =
|
|
7982
|
+
const module = ts35.resolveModuleName(moduleName, containingFile, options, this, moduleResolutionCache, redirectedReference);
|
|
7454
7983
|
return module.resolvedModule;
|
|
7455
7984
|
});
|
|
7456
7985
|
};
|
|
7457
7986
|
}
|
|
7458
7987
|
};
|
|
7459
7988
|
|
|
7460
|
-
// bazel-out/
|
|
7989
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/program.mjs
|
|
7461
7990
|
var NgtscProgram = class {
|
|
7462
7991
|
constructor(rootNames, options, delegateHost, oldProgram) {
|
|
7463
7992
|
this.options = options;
|
|
@@ -7474,7 +8003,7 @@ var NgtscProgram = class {
|
|
|
7474
8003
|
if (reuseProgram !== void 0) {
|
|
7475
8004
|
retagAllTsFiles(reuseProgram);
|
|
7476
8005
|
}
|
|
7477
|
-
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () =>
|
|
8006
|
+
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () => ts36.createProgram(this.host.inputFiles, options, this.host, reuseProgram));
|
|
7478
8007
|
perfRecorder.phase(PerfPhase.Unaccounted);
|
|
7479
8008
|
perfRecorder.memory(PerfCheckpoint.TypeScriptProgramCreate);
|
|
7480
8009
|
this.host.postProgramCreationCleanup();
|
|
@@ -7664,6 +8193,9 @@ var NgtscProgram = class {
|
|
|
7664
8193
|
getIndexedComponents() {
|
|
7665
8194
|
return this.compiler.getIndexedComponents();
|
|
7666
8195
|
}
|
|
8196
|
+
getApiDocumentation(entryPoint) {
|
|
8197
|
+
return this.compiler.getApiDocumentation(entryPoint);
|
|
8198
|
+
}
|
|
7667
8199
|
getEmittedSourceFiles() {
|
|
7668
8200
|
throw new Error("Method not implemented.");
|
|
7669
8201
|
}
|
|
@@ -7681,37 +8213,37 @@ function mergeEmitResults(emitResults) {
|
|
|
7681
8213
|
return { diagnostics, emitSkipped, emittedFiles };
|
|
7682
8214
|
}
|
|
7683
8215
|
|
|
7684
|
-
// bazel-out/
|
|
8216
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/transformers/program.mjs
|
|
7685
8217
|
function createProgram({ rootNames, options, host, oldProgram }) {
|
|
7686
8218
|
return new NgtscProgram(rootNames, options, host, oldProgram);
|
|
7687
8219
|
}
|
|
7688
8220
|
|
|
7689
|
-
// bazel-out/
|
|
7690
|
-
import
|
|
8221
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/perform_compile.mjs
|
|
8222
|
+
import ts38 from "typescript";
|
|
7691
8223
|
|
|
7692
|
-
// bazel-out/
|
|
7693
|
-
import
|
|
8224
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/transformers/util.mjs
|
|
8225
|
+
import ts37 from "typescript";
|
|
7694
8226
|
function createMessageDiagnostic(messageText) {
|
|
7695
8227
|
return {
|
|
7696
8228
|
file: void 0,
|
|
7697
8229
|
start: void 0,
|
|
7698
8230
|
length: void 0,
|
|
7699
|
-
category:
|
|
8231
|
+
category: ts37.DiagnosticCategory.Message,
|
|
7700
8232
|
messageText,
|
|
7701
8233
|
code: DEFAULT_ERROR_CODE,
|
|
7702
8234
|
source: SOURCE
|
|
7703
8235
|
};
|
|
7704
8236
|
}
|
|
7705
8237
|
|
|
7706
|
-
// bazel-out/
|
|
8238
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/perform_compile.mjs
|
|
7707
8239
|
var defaultFormatHost = {
|
|
7708
|
-
getCurrentDirectory: () =>
|
|
8240
|
+
getCurrentDirectory: () => ts38.sys.getCurrentDirectory(),
|
|
7709
8241
|
getCanonicalFileName: (fileName) => fileName,
|
|
7710
|
-
getNewLine: () =>
|
|
8242
|
+
getNewLine: () => ts38.sys.newLine
|
|
7711
8243
|
};
|
|
7712
8244
|
function formatDiagnostics(diags, host = defaultFormatHost) {
|
|
7713
8245
|
if (diags && diags.length) {
|
|
7714
|
-
return diags.map((diagnostic) => replaceTsWithNgInErrors(
|
|
8246
|
+
return diags.map((diagnostic) => replaceTsWithNgInErrors(ts38.formatDiagnosticsWithColorAndContext([diagnostic], host))).join("");
|
|
7715
8247
|
} else {
|
|
7716
8248
|
return "";
|
|
7717
8249
|
}
|
|
@@ -7728,7 +8260,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7728
8260
|
var _a;
|
|
7729
8261
|
try {
|
|
7730
8262
|
const fs = getFileSystem();
|
|
7731
|
-
const readConfigFile = (configFile) =>
|
|
8263
|
+
const readConfigFile = (configFile) => ts38.readConfigFile(configFile, (file) => host.readFile(host.resolve(file)));
|
|
7732
8264
|
const readAngularCompilerOptions = (configFile, parentOptions = {}) => {
|
|
7733
8265
|
const { config: config2, error: error2 } = readConfigFile(configFile);
|
|
7734
8266
|
if (error2) {
|
|
@@ -7763,18 +8295,18 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7763
8295
|
...existingOptions
|
|
7764
8296
|
};
|
|
7765
8297
|
const parseConfigHost = createParseConfigHost(host, fs);
|
|
7766
|
-
const { options, errors, fileNames: rootNames, projectReferences } =
|
|
8298
|
+
const { options, errors, fileNames: rootNames, projectReferences } = ts38.parseJsonConfigFileContent(config, parseConfigHost, basePath, existingCompilerOptions, configFileName);
|
|
7767
8299
|
let emitFlags = EmitFlags.Default;
|
|
7768
|
-
if (!(options
|
|
8300
|
+
if (!(options["skipMetadataEmit"] || options["flatModuleOutFile"])) {
|
|
7769
8301
|
emitFlags |= EmitFlags.Metadata;
|
|
7770
8302
|
}
|
|
7771
|
-
if (options
|
|
8303
|
+
if (options["skipTemplateCodegen"]) {
|
|
7772
8304
|
emitFlags = emitFlags & ~EmitFlags.Codegen;
|
|
7773
8305
|
}
|
|
7774
8306
|
return { project: projectFile, rootNames, projectReferences, options, errors, emitFlags };
|
|
7775
8307
|
} catch (e) {
|
|
7776
8308
|
const errors = [{
|
|
7777
|
-
category:
|
|
8309
|
+
category: ts38.DiagnosticCategory.Error,
|
|
7778
8310
|
messageText: (_a = e.stack) != null ? _a : e.message,
|
|
7779
8311
|
file: void 0,
|
|
7780
8312
|
start: void 0,
|
|
@@ -7788,7 +8320,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7788
8320
|
function createParseConfigHost(host, fs = getFileSystem()) {
|
|
7789
8321
|
return {
|
|
7790
8322
|
fileExists: host.exists.bind(host),
|
|
7791
|
-
readDirectory:
|
|
8323
|
+
readDirectory: ts38.sys.readDirectory,
|
|
7792
8324
|
readFile: host.readFile.bind(host),
|
|
7793
8325
|
useCaseSensitiveFileNames: fs.isCaseSensitive()
|
|
7794
8326
|
};
|
|
@@ -7808,7 +8340,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
|
7808
8340
|
}
|
|
7809
8341
|
} else {
|
|
7810
8342
|
const parseConfigHost = createParseConfigHost(host, fs);
|
|
7811
|
-
const { resolvedModule } =
|
|
8343
|
+
const { resolvedModule } = ts38.nodeModuleNameResolver(
|
|
7812
8344
|
extendsValue,
|
|
7813
8345
|
configFile,
|
|
7814
8346
|
{ moduleResolution: 2, resolveJsonModule: true },
|
|
@@ -7823,7 +8355,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
|
7823
8355
|
function exitCodeFromResult(diags) {
|
|
7824
8356
|
if (!diags)
|
|
7825
8357
|
return 0;
|
|
7826
|
-
if (diags.every((diag) => diag.category !==
|
|
8358
|
+
if (diags.every((diag) => diag.category !== ts38.DiagnosticCategory.Error)) {
|
|
7827
8359
|
return 0;
|
|
7828
8360
|
}
|
|
7829
8361
|
return diags.some((d) => d.source === "angular" && d.code === UNKNOWN_ERROR_CODE) ? 2 : 1;
|
|
@@ -7856,7 +8388,7 @@ function performCompilation({ rootNames, options, host, oldProgram, emitCallback
|
|
|
7856
8388
|
} catch (e) {
|
|
7857
8389
|
program = void 0;
|
|
7858
8390
|
allDiagnostics.push({
|
|
7859
|
-
category:
|
|
8391
|
+
category: ts38.DiagnosticCategory.Error,
|
|
7860
8392
|
messageText: (_a = e.stack) != null ? _a : e.message,
|
|
7861
8393
|
code: UNKNOWN_ERROR_CODE,
|
|
7862
8394
|
file: void 0,
|
|
@@ -7883,7 +8415,7 @@ function defaultGatherDiagnostics(program) {
|
|
|
7883
8415
|
return allDiagnostics;
|
|
7884
8416
|
}
|
|
7885
8417
|
function hasErrors(diags) {
|
|
7886
|
-
return diags.some((d) => d.category ===
|
|
8418
|
+
return diags.some((d) => d.category === ts38.DiagnosticCategory.Error);
|
|
7887
8419
|
}
|
|
7888
8420
|
|
|
7889
8421
|
export {
|
|
@@ -7893,6 +8425,9 @@ export {
|
|
|
7893
8425
|
isTsDiagnostic,
|
|
7894
8426
|
EmitFlags,
|
|
7895
8427
|
createCompilerHost,
|
|
8428
|
+
EntryType,
|
|
8429
|
+
MemberType,
|
|
8430
|
+
MemberTags,
|
|
7896
8431
|
untagAllTsFiles,
|
|
7897
8432
|
TsCreateProgramDriver,
|
|
7898
8433
|
PatchedProgramIncrementalBuildStrategy,
|
|
@@ -7917,4 +8452,4 @@ export {
|
|
|
7917
8452
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7918
8453
|
* found in the LICENSE file at https://angular.io/license
|
|
7919
8454
|
*/
|
|
7920
|
-
//# sourceMappingURL=chunk-
|
|
8455
|
+
//# sourceMappingURL=chunk-RVITQ7TS.js.map
|