@angular/compiler-cli 14.0.0-next.0 → 14.0.0-next.11
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-7PY7XEFH.js → chunk-2IMT6JFI.js} +2 -2
- package/bundles/chunk-2IMT6JFI.js.map +6 -0
- package/bundles/{chunk-OFPFDCGQ.js → chunk-DNXEJI2I.js} +3 -3
- package/bundles/chunk-DNXEJI2I.js.map +6 -0
- package/bundles/{chunk-XDGI7TS4.js → chunk-ESNS3BVQ.js} +503 -890
- package/bundles/chunk-ESNS3BVQ.js.map +6 -0
- package/bundles/{chunk-5CHRTEXL.js → chunk-FDAHGRSF.js} +7 -7
- package/bundles/chunk-FDAHGRSF.js.map +6 -0
- package/bundles/{chunk-UESD6FVI.js → chunk-FJDIFR5C.js} +49 -42
- package/bundles/chunk-FJDIFR5C.js.map +6 -0
- package/bundles/{chunk-WQ3TNYTD.js → chunk-GMSUYBZP.js} +8 -11
- package/bundles/{chunk-WQ3TNYTD.js.map → chunk-GMSUYBZP.js.map} +0 -0
- package/bundles/{chunk-XHMJ6POQ.js → chunk-LQLIHXU2.js} +19 -19
- package/bundles/chunk-LQLIHXU2.js.map +6 -0
- package/bundles/{chunk-SKBLJA43.js → chunk-LX5Q27EF.js} +5 -5
- package/bundles/chunk-LX5Q27EF.js.map +6 -0
- package/bundles/{chunk-O4XVCXRT.js → chunk-OLGEBPBY.js} +3 -3
- package/bundles/chunk-OLGEBPBY.js.map +6 -0
- package/bundles/{chunk-QDWL7SZJ.js → chunk-R3C7RFJ4.js} +1 -1
- package/bundles/chunk-R3C7RFJ4.js.map +6 -0
- package/bundles/{chunk-GLCRIILX.js → chunk-R4NY3TJC.js} +1 -1
- package/bundles/chunk-R4NY3TJC.js.map +6 -0
- package/bundles/{chunk-LMCFGUUV.js → chunk-RYXFJXXN.js} +2596 -1838
- package/bundles/chunk-RYXFJXXN.js.map +6 -0
- package/bundles/{chunk-676MI6WZ.js → chunk-T7MYRXIE.js} +7 -7
- package/bundles/chunk-T7MYRXIE.js.map +6 -0
- package/bundles/{chunk-QBU7RUKB.js → chunk-UMDDHI5B.js} +80 -68
- package/bundles/chunk-UMDDHI5B.js.map +6 -0
- package/bundles/{chunk-A5PL3TE6.js → chunk-W6KM7BUM.js} +32 -32
- package/bundles/chunk-W6KM7BUM.js.map +6 -0
- package/bundles/{chunk-ADHVDA4A.js → chunk-WGBFSDVQ.js} +3 -3
- package/bundles/chunk-WGBFSDVQ.js.map +6 -0
- package/bundles/index.js +10 -10
- package/bundles/index.js.map +1 -1
- package/bundles/linker/babel/index.js +12 -12
- package/bundles/linker/babel/index.js.map +1 -1
- package/bundles/linker/index.js +5 -5
- package/bundles/ngcc/index.js +12 -12
- package/bundles/ngcc/index.js.map +1 -1
- package/bundles/ngcc/main-ngcc.js +13 -13
- package/bundles/ngcc/main-ngcc.js.map +1 -1
- package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js +11 -11
- package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js.map +1 -1
- package/bundles/ngcc/src/locking/lock_file_with_child_process/ngcc_lock_unlocker.js +4 -4
- package/bundles/ngcc/src/locking/lock_file_with_child_process/ngcc_lock_unlocker.js.map +1 -1
- package/bundles/private/bazel.js +2 -2
- package/bundles/private/localize.js +4 -4
- package/bundles/private/migrations.js +6 -6
- package/bundles/private/tooling.js +3 -3
- package/bundles/src/bin/ng_xi18n.js +8 -8
- package/bundles/src/bin/ng_xi18n.js.map +1 -1
- package/bundles/src/bin/ngc.js +8 -8
- package/bundles/src/bin/ngc.js.map +1 -1
- package/bundles_metadata.json +1 -1
- package/linker/babel/src/babel_core.d.ts +1 -0
- package/linker/babel/src/babel_declaration_scope.d.ts +1 -1
- package/linker/src/file_linker/emit_scopes/emit_scope.d.ts +7 -3
- package/linker/src/file_linker/emit_scopes/{iife_emit_scope.d.ts → local_emit_scope.d.ts} +7 -11
- package/linker/src/file_linker/partial_linkers/partial_class_metadata_linker_1.d.ts +3 -3
- package/linker/src/file_linker/partial_linkers/partial_component_linker_1.d.ts +3 -3
- package/linker/src/file_linker/partial_linkers/partial_directive_linker_1.d.ts +3 -3
- package/linker/src/file_linker/partial_linkers/partial_factory_linker_1.d.ts +3 -3
- package/linker/src/file_linker/partial_linkers/partial_injectable_linker_1.d.ts +3 -3
- package/linker/src/file_linker/partial_linkers/partial_injector_linker_1.d.ts +3 -3
- package/linker/src/file_linker/partial_linkers/partial_linker.d.ts +8 -1
- package/linker/src/file_linker/partial_linkers/partial_ng_module_linker_1.d.ts +4 -4
- package/linker/src/file_linker/partial_linkers/partial_pipe_linker_1.d.ts +3 -3
- package/ngcc/src/packages/build_marker.d.ts +1 -1
- package/package.json +6 -7
- package/private/babel.d.ts +42 -0
- package/src/ngtsc/annotations/common/index.d.ts +16 -0
- package/src/ngtsc/annotations/{src → common/src}/api.d.ts +1 -1
- package/src/ngtsc/annotations/common/src/di.d.ts +38 -0
- package/src/ngtsc/annotations/{src → common/src}/diagnostics.d.ts +15 -7
- package/src/ngtsc/annotations/common/src/evaluation.d.ts +18 -0
- package/src/ngtsc/annotations/{src → common/src}/factory.d.ts +2 -2
- package/src/ngtsc/annotations/{src → common/src}/metadata.d.ts +2 -2
- package/src/ngtsc/annotations/{src → common/src}/references_registry.d.ts +3 -3
- package/src/ngtsc/annotations/{src → common/src}/util.d.ts +7 -43
- package/src/ngtsc/annotations/component/index.d.ts +9 -0
- package/src/ngtsc/annotations/component/src/diagnostics.d.ts +20 -0
- package/src/ngtsc/annotations/component/src/handler.d.ts +92 -0
- package/src/ngtsc/annotations/component/src/metadata.d.ts +61 -0
- package/src/ngtsc/annotations/component/src/resources.d.ts +123 -0
- package/src/ngtsc/annotations/component/src/scope.d.ts +20 -0
- package/src/ngtsc/annotations/component/src/symbol.d.ts +20 -0
- package/src/ngtsc/annotations/component/src/util.d.ts +26 -0
- package/src/ngtsc/annotations/directive/index.d.ts +11 -0
- package/src/ngtsc/annotations/directive/src/handler.d.ts +59 -0
- package/src/ngtsc/annotations/directive/src/shared.d.ts +30 -0
- package/src/ngtsc/annotations/directive/src/symbol.d.ts +27 -0
- package/src/ngtsc/annotations/index.d.ts +4 -6
- package/src/ngtsc/annotations/ng_module/index.d.ts +9 -0
- package/src/ngtsc/annotations/{src/ng_module.d.ts → ng_module/src/handler.d.ts} +13 -11
- package/src/ngtsc/core/api/src/options.d.ts +0 -4
- package/src/ngtsc/diagnostics/src/error_code.d.ts +23 -0
- package/src/ngtsc/imports/src/emitter.d.ts +16 -2
- package/src/ngtsc/indexer/src/api.d.ts +1 -0
- package/src/ngtsc/indexer/src/template.d.ts +4 -1
- package/src/ngtsc/metadata/src/api.d.ts +19 -0
- package/src/ngtsc/scope/index.d.ts +4 -3
- package/src/ngtsc/scope/src/api.d.ts +21 -5
- package/src/ngtsc/scope/src/component_scope.d.ts +1 -15
- package/src/ngtsc/scope/src/local.d.ts +4 -11
- package/src/ngtsc/scope/src/typecheck.d.ts +1 -1
- package/src/ngtsc/scope/src/util.d.ts +14 -0
- package/src/ngtsc/shims/api.d.ts +0 -1
- package/src/ngtsc/translator/src/typescript_ast_factory.d.ts +1 -4
- package/src/ngtsc/tsc_plugin.d.ts +1 -1
- package/src/ngtsc/typecheck/api/checker.d.ts +6 -6
- package/src/ngtsc/typecheck/api/completion.d.ts +3 -3
- package/src/ngtsc/typecheck/api/symbols.d.ts +23 -16
- package/src/ngtsc/typecheck/src/checker.d.ts +5 -4
- package/src/ngtsc/typecheck/src/completion.d.ts +6 -5
- package/src/ngtsc/typecheck/src/diagnostics.d.ts +6 -5
- package/src/ngtsc/typecheck/src/template_symbol_builder.d.ts +4 -3
- package/src/ngtsc/util/src/typescript.d.ts +0 -5
- package/bundles/chunk-5CHRTEXL.js.map +0 -6
- package/bundles/chunk-676MI6WZ.js.map +0 -6
- package/bundles/chunk-7PY7XEFH.js.map +0 -6
- package/bundles/chunk-A5PL3TE6.js.map +0 -6
- package/bundles/chunk-ADHVDA4A.js.map +0 -6
- package/bundles/chunk-GLCRIILX.js.map +0 -6
- package/bundles/chunk-LMCFGUUV.js.map +0 -6
- package/bundles/chunk-O4XVCXRT.js.map +0 -6
- package/bundles/chunk-OFPFDCGQ.js.map +0 -6
- package/bundles/chunk-QBU7RUKB.js.map +0 -6
- package/bundles/chunk-QDWL7SZJ.js.map +0 -6
- package/bundles/chunk-SKBLJA43.js.map +0 -6
- package/bundles/chunk-UESD6FVI.js.map +0 -6
- package/bundles/chunk-XDGI7TS4.js.map +0 -6
- package/bundles/chunk-XHMJ6POQ.js.map +0 -6
- package/src/ngtsc/annotations/src/component.d.ts +0 -246
- package/src/ngtsc/annotations/src/directive.d.ts +0 -99
|
@@ -15,6 +15,8 @@ import {
|
|
|
15
15
|
InjectableClassRegistry,
|
|
16
16
|
InjectableDecoratorHandler,
|
|
17
17
|
LocalMetadataRegistry,
|
|
18
|
+
LocalModuleScopeRegistry,
|
|
19
|
+
MetadataDtsModuleScopeResolver,
|
|
18
20
|
NgModuleDecoratorHandler,
|
|
19
21
|
NoopReferencesRegistry,
|
|
20
22
|
PartialEvaluator,
|
|
@@ -25,20 +27,20 @@ import {
|
|
|
25
27
|
ShimReferenceTagger,
|
|
26
28
|
SummaryGenerator,
|
|
27
29
|
TraitCompiler,
|
|
30
|
+
TypeCheckScopeRegistry,
|
|
28
31
|
aliasTransformFactory,
|
|
29
32
|
copyFileShimData,
|
|
30
33
|
declarationTransformFactory,
|
|
31
|
-
flattenInheritedDirectiveMetadata,
|
|
32
34
|
generatedFactoryTransform,
|
|
33
35
|
isShim,
|
|
34
36
|
ivyTransformFactory,
|
|
35
37
|
retagAllTsFiles,
|
|
36
38
|
untagAllTsFiles
|
|
37
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-RYXFJXXN.js";
|
|
38
40
|
import {
|
|
39
41
|
TypeScriptReflectionHost,
|
|
40
42
|
isNamedClassDeclaration
|
|
41
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-2IMT6JFI.js";
|
|
42
44
|
import {
|
|
43
45
|
AbsoluteModuleStrategy,
|
|
44
46
|
AliasStrategy,
|
|
@@ -64,7 +66,6 @@ import {
|
|
|
64
66
|
getRootDirs,
|
|
65
67
|
getSourceFileOrNull,
|
|
66
68
|
getTokenAtPosition,
|
|
67
|
-
identifierOfNode,
|
|
68
69
|
isAssignment,
|
|
69
70
|
isDtsPath,
|
|
70
71
|
isNonDeclarationTsPath,
|
|
@@ -72,14 +73,13 @@ import {
|
|
|
72
73
|
makeDiagnostic,
|
|
73
74
|
makeRelatedInformation,
|
|
74
75
|
ngErrorCode,
|
|
75
|
-
nodeNameForError,
|
|
76
76
|
normalizeSeparators,
|
|
77
77
|
relativePathBetween,
|
|
78
78
|
replaceTsWithNgInErrors,
|
|
79
79
|
toUnredirectedSourceFile,
|
|
80
80
|
translateExpression,
|
|
81
81
|
translateType
|
|
82
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-UMDDHI5B.js";
|
|
83
83
|
import {
|
|
84
84
|
LogicalFileSystem,
|
|
85
85
|
absoluteFrom,
|
|
@@ -89,18 +89,18 @@ import {
|
|
|
89
89
|
getSourceFileOrError,
|
|
90
90
|
join,
|
|
91
91
|
resolve
|
|
92
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-T7MYRXIE.js";
|
|
93
93
|
import {
|
|
94
94
|
ActivePerfRecorder,
|
|
95
95
|
DelegatingPerfRecorder,
|
|
96
96
|
PerfCheckpoint,
|
|
97
97
|
PerfEvent,
|
|
98
98
|
PerfPhase
|
|
99
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-R4NY3TJC.js";
|
|
100
100
|
import {
|
|
101
101
|
__spreadProps,
|
|
102
102
|
__spreadValues
|
|
103
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-GMSUYBZP.js";
|
|
104
104
|
|
|
105
105
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/api.mjs
|
|
106
106
|
var DEFAULT_ERROR_CODE = 100;
|
|
@@ -162,7 +162,7 @@ var SymbolKind;
|
|
|
162
162
|
|
|
163
163
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/program.mjs
|
|
164
164
|
import { HtmlParser, MessageBundle } from "@angular/compiler";
|
|
165
|
-
import
|
|
165
|
+
import ts30 from "typescript";
|
|
166
166
|
|
|
167
167
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/i18n.mjs
|
|
168
168
|
import { Xliff, Xliff2, Xmb } from "@angular/compiler";
|
|
@@ -254,8 +254,8 @@ function compareVersions(v1, v2) {
|
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/typescript_support.mjs
|
|
257
|
-
var MIN_TS_VERSION = "4.
|
|
258
|
-
var MAX_TS_VERSION = "4.
|
|
257
|
+
var MIN_TS_VERSION = "4.6.2";
|
|
258
|
+
var MAX_TS_VERSION = "4.7.0";
|
|
259
259
|
var tsVersion = ts2.version;
|
|
260
260
|
function checkVersion(version, minVersion, maxVersion) {
|
|
261
261
|
if (compareVersions(version, minVersion) < 0 || compareVersions(version, maxVersion) >= 0) {
|
|
@@ -267,7 +267,7 @@ function verifySupportedTypeScriptVersion() {
|
|
|
267
267
|
}
|
|
268
268
|
|
|
269
269
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/compiler.mjs
|
|
270
|
-
import
|
|
270
|
+
import ts28 from "typescript";
|
|
271
271
|
|
|
272
272
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/cycles/src/analyzer.mjs
|
|
273
273
|
var CycleAnalyzer = class {
|
|
@@ -1079,11 +1079,12 @@ var ExpressionVisitor = class extends RecursiveAstVisitor {
|
|
|
1079
1079
|
this.boundTemplate = boundTemplate;
|
|
1080
1080
|
this.targetToIdentifier = targetToIdentifier;
|
|
1081
1081
|
this.identifiers = [];
|
|
1082
|
+
this.errors = [];
|
|
1082
1083
|
}
|
|
1083
1084
|
static getIdentifiers(ast, source, absoluteOffset, boundTemplate, targetToIdentifier) {
|
|
1084
1085
|
const visitor = new ExpressionVisitor(source, absoluteOffset, boundTemplate, targetToIdentifier);
|
|
1085
1086
|
visitor.visit(ast);
|
|
1086
|
-
return visitor.identifiers;
|
|
1087
|
+
return { identifiers: visitor.identifiers, errors: visitor.errors };
|
|
1087
1088
|
}
|
|
1088
1089
|
visit(ast) {
|
|
1089
1090
|
ast.visit(this);
|
|
@@ -1105,7 +1106,8 @@ var ExpressionVisitor = class extends RecursiveAstVisitor {
|
|
|
1105
1106
|
identifierStart = ast.nameSpan.start - this.absoluteOffset;
|
|
1106
1107
|
}
|
|
1107
1108
|
if (!this.expressionStr.substring(identifierStart).startsWith(ast.name)) {
|
|
1108
|
-
|
|
1109
|
+
this.errors.push(new Error(`Impossible state: "${ast.name}" not found in "${this.expressionStr}" at location ${identifierStart}`));
|
|
1110
|
+
return;
|
|
1109
1111
|
}
|
|
1110
1112
|
const absoluteStart = this.absoluteOffset + identifierStart;
|
|
1111
1113
|
const span = new AbsoluteSourceSpan(absoluteStart, absoluteStart + ast.name.length);
|
|
@@ -1125,6 +1127,7 @@ var TemplateVisitor = class extends TmplAstRecursiveVisitor {
|
|
|
1125
1127
|
super();
|
|
1126
1128
|
this.boundTemplate = boundTemplate;
|
|
1127
1129
|
this.identifiers = /* @__PURE__ */ new Set();
|
|
1130
|
+
this.errors = [];
|
|
1128
1131
|
this.targetIdentifierCache = /* @__PURE__ */ new Map();
|
|
1129
1132
|
this.elementAndTemplateIdentifierCache = /* @__PURE__ */ new Map();
|
|
1130
1133
|
}
|
|
@@ -1136,7 +1139,9 @@ var TemplateVisitor = class extends TmplAstRecursiveVisitor {
|
|
|
1136
1139
|
}
|
|
1137
1140
|
visitElement(element) {
|
|
1138
1141
|
const elementIdentifier = this.elementOrTemplateToIdentifier(element);
|
|
1139
|
-
|
|
1142
|
+
if (elementIdentifier !== null) {
|
|
1143
|
+
this.identifiers.add(elementIdentifier);
|
|
1144
|
+
}
|
|
1140
1145
|
this.visitAll(element.references);
|
|
1141
1146
|
this.visitAll(element.inputs);
|
|
1142
1147
|
this.visitAll(element.attributes);
|
|
@@ -1145,7 +1150,9 @@ var TemplateVisitor = class extends TmplAstRecursiveVisitor {
|
|
|
1145
1150
|
}
|
|
1146
1151
|
visitTemplate(template) {
|
|
1147
1152
|
const templateIdentifier = this.elementOrTemplateToIdentifier(template);
|
|
1148
|
-
|
|
1153
|
+
if (templateIdentifier !== null) {
|
|
1154
|
+
this.identifiers.add(templateIdentifier);
|
|
1155
|
+
}
|
|
1149
1156
|
this.visitAll(template.variables);
|
|
1150
1157
|
this.visitAll(template.attributes);
|
|
1151
1158
|
this.visitAll(template.templateAttrs);
|
|
@@ -1156,8 +1163,9 @@ var TemplateVisitor = class extends TmplAstRecursiveVisitor {
|
|
|
1156
1163
|
if (attribute.valueSpan === void 0) {
|
|
1157
1164
|
return;
|
|
1158
1165
|
}
|
|
1159
|
-
const identifiers = ExpressionVisitor.getIdentifiers(attribute.value, attribute.valueSpan.toString(), attribute.valueSpan.start.offset, this.boundTemplate, this.targetToIdentifier.bind(this));
|
|
1166
|
+
const { identifiers, errors } = ExpressionVisitor.getIdentifiers(attribute.value, attribute.valueSpan.toString(), attribute.valueSpan.start.offset, this.boundTemplate, this.targetToIdentifier.bind(this));
|
|
1160
1167
|
identifiers.forEach((id) => this.identifiers.add(id));
|
|
1168
|
+
this.errors.push(...errors);
|
|
1161
1169
|
}
|
|
1162
1170
|
visitBoundEvent(attribute) {
|
|
1163
1171
|
this.visitExpression(attribute.handler);
|
|
@@ -1167,10 +1175,16 @@ var TemplateVisitor = class extends TmplAstRecursiveVisitor {
|
|
|
1167
1175
|
}
|
|
1168
1176
|
visitReference(reference) {
|
|
1169
1177
|
const referenceIdentifer = this.targetToIdentifier(reference);
|
|
1178
|
+
if (referenceIdentifer === null) {
|
|
1179
|
+
return;
|
|
1180
|
+
}
|
|
1170
1181
|
this.identifiers.add(referenceIdentifer);
|
|
1171
1182
|
}
|
|
1172
1183
|
visitVariable(variable) {
|
|
1173
1184
|
const variableIdentifier = this.targetToIdentifier(variable);
|
|
1185
|
+
if (variableIdentifier === null) {
|
|
1186
|
+
return;
|
|
1187
|
+
}
|
|
1174
1188
|
this.identifiers.add(variableIdentifier);
|
|
1175
1189
|
}
|
|
1176
1190
|
elementOrTemplateToIdentifier(node) {
|
|
@@ -1192,6 +1206,9 @@ var TemplateVisitor = class extends TmplAstRecursiveVisitor {
|
|
|
1192
1206
|
}
|
|
1193
1207
|
const sourceSpan = node.startSourceSpan;
|
|
1194
1208
|
const start = this.getStartLocation(name, sourceSpan);
|
|
1209
|
+
if (start === null) {
|
|
1210
|
+
return null;
|
|
1211
|
+
}
|
|
1195
1212
|
const absoluteSpan = new AbsoluteSourceSpan(start, start + name.length);
|
|
1196
1213
|
const attributes = node.attributes.map(({ name: name2, sourceSpan: sourceSpan2 }) => {
|
|
1197
1214
|
return {
|
|
@@ -1222,23 +1239,30 @@ var TemplateVisitor = class extends TmplAstRecursiveVisitor {
|
|
|
1222
1239
|
}
|
|
1223
1240
|
const { name, sourceSpan } = node;
|
|
1224
1241
|
const start = this.getStartLocation(name, sourceSpan);
|
|
1242
|
+
if (start === null) {
|
|
1243
|
+
return null;
|
|
1244
|
+
}
|
|
1225
1245
|
const span = new AbsoluteSourceSpan(start, start + name.length);
|
|
1226
1246
|
let identifier;
|
|
1227
1247
|
if (node instanceof TmplAstReference) {
|
|
1228
1248
|
const refTarget = this.boundTemplate.getReferenceTarget(node);
|
|
1229
1249
|
let target = null;
|
|
1230
1250
|
if (refTarget) {
|
|
1251
|
+
let node2 = null;
|
|
1252
|
+
let directive = null;
|
|
1231
1253
|
if (refTarget instanceof TmplAstElement || refTarget instanceof TmplAstTemplate) {
|
|
1232
|
-
|
|
1233
|
-
node: this.elementOrTemplateToIdentifier(refTarget),
|
|
1234
|
-
directive: null
|
|
1235
|
-
};
|
|
1254
|
+
node2 = this.elementOrTemplateToIdentifier(refTarget);
|
|
1236
1255
|
} else {
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1256
|
+
node2 = this.elementOrTemplateToIdentifier(refTarget.node);
|
|
1257
|
+
directive = refTarget.directive.ref.node;
|
|
1258
|
+
}
|
|
1259
|
+
if (node2 === null) {
|
|
1260
|
+
return null;
|
|
1241
1261
|
}
|
|
1262
|
+
target = {
|
|
1263
|
+
node: node2,
|
|
1264
|
+
directive
|
|
1265
|
+
};
|
|
1242
1266
|
}
|
|
1243
1267
|
identifier = {
|
|
1244
1268
|
name,
|
|
@@ -1259,7 +1283,8 @@ var TemplateVisitor = class extends TmplAstRecursiveVisitor {
|
|
|
1259
1283
|
getStartLocation(name, context) {
|
|
1260
1284
|
const localStr = context.toString();
|
|
1261
1285
|
if (!localStr.includes(name)) {
|
|
1262
|
-
|
|
1286
|
+
this.errors.push(new Error(`Impossible state: "${name}" not found in "${localStr}"`));
|
|
1287
|
+
return null;
|
|
1263
1288
|
}
|
|
1264
1289
|
return context.start.offset + localStr.indexOf(name);
|
|
1265
1290
|
}
|
|
@@ -1267,8 +1292,9 @@ var TemplateVisitor = class extends TmplAstRecursiveVisitor {
|
|
|
1267
1292
|
if (ast instanceof ASTWithSource && ast.source !== null) {
|
|
1268
1293
|
const targetToIdentifier = this.targetToIdentifier.bind(this);
|
|
1269
1294
|
const absoluteOffset = ast.sourceSpan.start;
|
|
1270
|
-
const identifiers = ExpressionVisitor.getIdentifiers(ast, ast.source, absoluteOffset, this.boundTemplate, targetToIdentifier);
|
|
1295
|
+
const { identifiers, errors } = ExpressionVisitor.getIdentifiers(ast, ast.source, absoluteOffset, this.boundTemplate, targetToIdentifier);
|
|
1271
1296
|
identifiers.forEach((id) => this.identifiers.add(id));
|
|
1297
|
+
this.errors.push(...errors);
|
|
1272
1298
|
}
|
|
1273
1299
|
}
|
|
1274
1300
|
};
|
|
@@ -1277,7 +1303,7 @@ function getTemplateIdentifiers(boundTemplate) {
|
|
|
1277
1303
|
if (boundTemplate.target.template !== void 0) {
|
|
1278
1304
|
visitor.visitAll(boundTemplate.target.template);
|
|
1279
1305
|
}
|
|
1280
|
-
return visitor.identifiers;
|
|
1306
|
+
return { identifiers: visitor.identifiers, errors: visitor.errors };
|
|
1281
1307
|
}
|
|
1282
1308
|
|
|
1283
1309
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/indexer/src/transform.mjs
|
|
@@ -1299,16 +1325,18 @@ function generateAnalysis(context) {
|
|
|
1299
1325
|
} else {
|
|
1300
1326
|
templateFile = templateMeta.file;
|
|
1301
1327
|
}
|
|
1328
|
+
const { identifiers, errors } = getTemplateIdentifiers(boundTemplate);
|
|
1302
1329
|
analysis.set(declaration, {
|
|
1303
1330
|
name,
|
|
1304
1331
|
selector,
|
|
1305
1332
|
file: componentFile,
|
|
1306
1333
|
template: {
|
|
1307
|
-
identifiers
|
|
1334
|
+
identifiers,
|
|
1308
1335
|
usedComponents,
|
|
1309
1336
|
isInline: templateMeta.isInline,
|
|
1310
1337
|
file: templateFile
|
|
1311
|
-
}
|
|
1338
|
+
},
|
|
1339
|
+
errors
|
|
1312
1340
|
});
|
|
1313
1341
|
});
|
|
1314
1342
|
return analysis;
|
|
@@ -1460,468 +1488,11 @@ function createLookupResolutionHost(adapter) {
|
|
|
1460
1488
|
};
|
|
1461
1489
|
}
|
|
1462
1490
|
|
|
1463
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/dependency.mjs
|
|
1464
|
-
var MetadataDtsModuleScopeResolver = class {
|
|
1465
|
-
constructor(dtsMetaReader, aliasingHost) {
|
|
1466
|
-
this.dtsMetaReader = dtsMetaReader;
|
|
1467
|
-
this.aliasingHost = aliasingHost;
|
|
1468
|
-
this.cache = /* @__PURE__ */ new Map();
|
|
1469
|
-
}
|
|
1470
|
-
resolve(ref) {
|
|
1471
|
-
const clazz = ref.node;
|
|
1472
|
-
const sourceFile = clazz.getSourceFile();
|
|
1473
|
-
if (!sourceFile.isDeclarationFile) {
|
|
1474
|
-
throw new Error(`Debug error: DtsModuleScopeResolver.read(${ref.debugName} from ${sourceFile.fileName}), but not a .d.ts file`);
|
|
1475
|
-
}
|
|
1476
|
-
if (this.cache.has(clazz)) {
|
|
1477
|
-
return this.cache.get(clazz);
|
|
1478
|
-
}
|
|
1479
|
-
const directives = [];
|
|
1480
|
-
const pipes = [];
|
|
1481
|
-
const ngModules = /* @__PURE__ */ new Set([clazz]);
|
|
1482
|
-
const meta = this.dtsMetaReader.getNgModuleMetadata(ref);
|
|
1483
|
-
if (meta === null) {
|
|
1484
|
-
this.cache.set(clazz, null);
|
|
1485
|
-
return null;
|
|
1486
|
-
}
|
|
1487
|
-
const declarations = /* @__PURE__ */ new Set();
|
|
1488
|
-
for (const declRef of meta.declarations) {
|
|
1489
|
-
declarations.add(declRef.node);
|
|
1490
|
-
}
|
|
1491
|
-
for (const exportRef of meta.exports) {
|
|
1492
|
-
const directive = this.dtsMetaReader.getDirectiveMetadata(exportRef);
|
|
1493
|
-
if (directive !== null) {
|
|
1494
|
-
const isReExport = !declarations.has(exportRef.node);
|
|
1495
|
-
directives.push(this.maybeAlias(directive, sourceFile, isReExport));
|
|
1496
|
-
continue;
|
|
1497
|
-
}
|
|
1498
|
-
const pipe = this.dtsMetaReader.getPipeMetadata(exportRef);
|
|
1499
|
-
if (pipe !== null) {
|
|
1500
|
-
const isReExport = !declarations.has(exportRef.node);
|
|
1501
|
-
pipes.push(this.maybeAlias(pipe, sourceFile, isReExport));
|
|
1502
|
-
continue;
|
|
1503
|
-
}
|
|
1504
|
-
const exportScope2 = this.resolve(exportRef);
|
|
1505
|
-
if (exportScope2 !== null) {
|
|
1506
|
-
if (this.aliasingHost === null) {
|
|
1507
|
-
directives.push(...exportScope2.exported.directives);
|
|
1508
|
-
pipes.push(...exportScope2.exported.pipes);
|
|
1509
|
-
} else {
|
|
1510
|
-
for (const directive2 of exportScope2.exported.directives) {
|
|
1511
|
-
directives.push(this.maybeAlias(directive2, sourceFile, true));
|
|
1512
|
-
}
|
|
1513
|
-
for (const pipe2 of exportScope2.exported.pipes) {
|
|
1514
|
-
pipes.push(this.maybeAlias(pipe2, sourceFile, true));
|
|
1515
|
-
}
|
|
1516
|
-
for (const ngModule of exportScope2.exported.ngModules) {
|
|
1517
|
-
ngModules.add(ngModule);
|
|
1518
|
-
}
|
|
1519
|
-
}
|
|
1520
|
-
}
|
|
1521
|
-
continue;
|
|
1522
|
-
}
|
|
1523
|
-
const exportScope = {
|
|
1524
|
-
exported: {
|
|
1525
|
-
directives,
|
|
1526
|
-
pipes,
|
|
1527
|
-
ngModules: Array.from(ngModules),
|
|
1528
|
-
isPoisoned: false
|
|
1529
|
-
}
|
|
1530
|
-
};
|
|
1531
|
-
this.cache.set(clazz, exportScope);
|
|
1532
|
-
return exportScope;
|
|
1533
|
-
}
|
|
1534
|
-
maybeAlias(dirOrPipe, maybeAliasFrom, isReExport) {
|
|
1535
|
-
const ref = dirOrPipe.ref;
|
|
1536
|
-
if (this.aliasingHost === null || ref.node.getSourceFile() === maybeAliasFrom) {
|
|
1537
|
-
return dirOrPipe;
|
|
1538
|
-
}
|
|
1539
|
-
const alias = this.aliasingHost.getAliasIn(ref.node, maybeAliasFrom, isReExport);
|
|
1540
|
-
if (alias === null) {
|
|
1541
|
-
return dirOrPipe;
|
|
1542
|
-
}
|
|
1543
|
-
return __spreadProps(__spreadValues({}, dirOrPipe), {
|
|
1544
|
-
ref: ref.cloneWithAlias(alias)
|
|
1545
|
-
});
|
|
1546
|
-
}
|
|
1547
|
-
};
|
|
1548
|
-
|
|
1549
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/local.mjs
|
|
1550
|
-
import { ExternalExpr } from "@angular/compiler";
|
|
1551
|
-
import ts8 from "typescript";
|
|
1552
|
-
var LocalModuleScopeRegistry = class {
|
|
1553
|
-
constructor(localReader, dependencyScopeReader, refEmitter, aliasingHost) {
|
|
1554
|
-
this.localReader = localReader;
|
|
1555
|
-
this.dependencyScopeReader = dependencyScopeReader;
|
|
1556
|
-
this.refEmitter = refEmitter;
|
|
1557
|
-
this.aliasingHost = aliasingHost;
|
|
1558
|
-
this.sealed = false;
|
|
1559
|
-
this.declarationToModule = /* @__PURE__ */ new Map();
|
|
1560
|
-
this.duplicateDeclarations = /* @__PURE__ */ new Map();
|
|
1561
|
-
this.moduleToRef = /* @__PURE__ */ new Map();
|
|
1562
|
-
this.cache = /* @__PURE__ */ new Map();
|
|
1563
|
-
this.remoteScoping = /* @__PURE__ */ new Map();
|
|
1564
|
-
this.scopeErrors = /* @__PURE__ */ new Map();
|
|
1565
|
-
this.modulesWithStructuralErrors = /* @__PURE__ */ new Set();
|
|
1566
|
-
}
|
|
1567
|
-
registerNgModuleMetadata(data) {
|
|
1568
|
-
this.assertCollecting();
|
|
1569
|
-
const ngModule = data.ref.node;
|
|
1570
|
-
this.moduleToRef.set(data.ref.node, data.ref);
|
|
1571
|
-
for (const decl of data.declarations) {
|
|
1572
|
-
this.registerDeclarationOfModule(ngModule, decl, data.rawDeclarations);
|
|
1573
|
-
}
|
|
1574
|
-
}
|
|
1575
|
-
registerDirectiveMetadata(directive) {
|
|
1576
|
-
}
|
|
1577
|
-
registerPipeMetadata(pipe) {
|
|
1578
|
-
}
|
|
1579
|
-
getScopeForComponent(clazz) {
|
|
1580
|
-
const scope = !this.declarationToModule.has(clazz) ? null : this.getScopeOfModule(this.declarationToModule.get(clazz).ngModule);
|
|
1581
|
-
return scope;
|
|
1582
|
-
}
|
|
1583
|
-
getDuplicateDeclarations(node) {
|
|
1584
|
-
if (!this.duplicateDeclarations.has(node)) {
|
|
1585
|
-
return null;
|
|
1586
|
-
}
|
|
1587
|
-
return Array.from(this.duplicateDeclarations.get(node).values());
|
|
1588
|
-
}
|
|
1589
|
-
getScopeOfModule(clazz) {
|
|
1590
|
-
return this.moduleToRef.has(clazz) ? this.getScopeOfModuleReference(this.moduleToRef.get(clazz)) : null;
|
|
1591
|
-
}
|
|
1592
|
-
getDiagnosticsOfModule(clazz) {
|
|
1593
|
-
this.getScopeOfModule(clazz);
|
|
1594
|
-
if (this.scopeErrors.has(clazz)) {
|
|
1595
|
-
return this.scopeErrors.get(clazz);
|
|
1596
|
-
} else {
|
|
1597
|
-
return null;
|
|
1598
|
-
}
|
|
1599
|
-
}
|
|
1600
|
-
registerDeclarationOfModule(ngModule, decl, rawDeclarations) {
|
|
1601
|
-
const declData = {
|
|
1602
|
-
ngModule,
|
|
1603
|
-
ref: decl,
|
|
1604
|
-
rawDeclarations
|
|
1605
|
-
};
|
|
1606
|
-
if (this.duplicateDeclarations.has(decl.node)) {
|
|
1607
|
-
this.duplicateDeclarations.get(decl.node).set(ngModule, declData);
|
|
1608
|
-
} else if (this.declarationToModule.has(decl.node) && this.declarationToModule.get(decl.node).ngModule !== ngModule) {
|
|
1609
|
-
const duplicateDeclMap = /* @__PURE__ */ new Map();
|
|
1610
|
-
const firstDeclData = this.declarationToModule.get(decl.node);
|
|
1611
|
-
this.modulesWithStructuralErrors.add(firstDeclData.ngModule);
|
|
1612
|
-
this.modulesWithStructuralErrors.add(ngModule);
|
|
1613
|
-
duplicateDeclMap.set(firstDeclData.ngModule, firstDeclData);
|
|
1614
|
-
duplicateDeclMap.set(ngModule, declData);
|
|
1615
|
-
this.duplicateDeclarations.set(decl.node, duplicateDeclMap);
|
|
1616
|
-
this.declarationToModule.delete(decl.node);
|
|
1617
|
-
} else {
|
|
1618
|
-
this.declarationToModule.set(decl.node, declData);
|
|
1619
|
-
}
|
|
1620
|
-
}
|
|
1621
|
-
getScopeOfModuleReference(ref) {
|
|
1622
|
-
if (this.cache.has(ref.node)) {
|
|
1623
|
-
return this.cache.get(ref.node);
|
|
1624
|
-
}
|
|
1625
|
-
this.sealed = true;
|
|
1626
|
-
const ngModule = this.localReader.getNgModuleMetadata(ref);
|
|
1627
|
-
if (ngModule === null) {
|
|
1628
|
-
this.cache.set(ref.node, null);
|
|
1629
|
-
return null;
|
|
1630
|
-
}
|
|
1631
|
-
const compilationModules = /* @__PURE__ */ new Set([ngModule.ref.node]);
|
|
1632
|
-
const exportedModules = /* @__PURE__ */ new Set([ngModule.ref.node]);
|
|
1633
|
-
const diagnostics = [];
|
|
1634
|
-
const compilationDirectives = /* @__PURE__ */ new Map();
|
|
1635
|
-
const compilationPipes = /* @__PURE__ */ new Map();
|
|
1636
|
-
const declared = /* @__PURE__ */ new Set();
|
|
1637
|
-
const exportDirectives = /* @__PURE__ */ new Map();
|
|
1638
|
-
const exportPipes = /* @__PURE__ */ new Map();
|
|
1639
|
-
let isPoisoned = false;
|
|
1640
|
-
if (this.modulesWithStructuralErrors.has(ngModule.ref.node)) {
|
|
1641
|
-
isPoisoned = true;
|
|
1642
|
-
}
|
|
1643
|
-
for (const decl of ngModule.imports) {
|
|
1644
|
-
const importScope = this.getExportedScope(decl, diagnostics, ref.node, "import");
|
|
1645
|
-
if (importScope === null) {
|
|
1646
|
-
diagnostics.push(invalidRef(ref.node, decl, "import"));
|
|
1647
|
-
isPoisoned = true;
|
|
1648
|
-
continue;
|
|
1649
|
-
} else if (importScope === "invalid" || importScope.exported.isPoisoned) {
|
|
1650
|
-
diagnostics.push(invalidTransitiveNgModuleRef(ref.node, decl, "import"));
|
|
1651
|
-
isPoisoned = true;
|
|
1652
|
-
if (importScope === "invalid") {
|
|
1653
|
-
continue;
|
|
1654
|
-
}
|
|
1655
|
-
}
|
|
1656
|
-
for (const directive of importScope.exported.directives) {
|
|
1657
|
-
compilationDirectives.set(directive.ref.node, directive);
|
|
1658
|
-
}
|
|
1659
|
-
for (const pipe of importScope.exported.pipes) {
|
|
1660
|
-
compilationPipes.set(pipe.ref.node, pipe);
|
|
1661
|
-
}
|
|
1662
|
-
for (const importedModule of importScope.exported.ngModules) {
|
|
1663
|
-
compilationModules.add(importedModule);
|
|
1664
|
-
}
|
|
1665
|
-
}
|
|
1666
|
-
for (const decl of ngModule.declarations) {
|
|
1667
|
-
const directive = this.localReader.getDirectiveMetadata(decl);
|
|
1668
|
-
const pipe = this.localReader.getPipeMetadata(decl);
|
|
1669
|
-
if (directive !== null) {
|
|
1670
|
-
compilationDirectives.set(decl.node, __spreadProps(__spreadValues({}, directive), { ref: decl }));
|
|
1671
|
-
if (directive.isPoisoned) {
|
|
1672
|
-
isPoisoned = true;
|
|
1673
|
-
}
|
|
1674
|
-
} else if (pipe !== null) {
|
|
1675
|
-
compilationPipes.set(decl.node, __spreadProps(__spreadValues({}, pipe), { ref: decl }));
|
|
1676
|
-
} else {
|
|
1677
|
-
const errorNode = decl.getOriginForDiagnostics(ngModule.rawDeclarations);
|
|
1678
|
-
diagnostics.push(makeDiagnostic(ErrorCode.NGMODULE_INVALID_DECLARATION, errorNode, `The class '${decl.node.name.text}' is listed in the declarations of the NgModule '${ngModule.ref.node.name.text}', but is not a directive, a component, or a pipe. Either remove it from the NgModule's declarations, or add an appropriate Angular decorator.`, [makeRelatedInformation(decl.node.name, `'${decl.node.name.text}' is declared here.`)]));
|
|
1679
|
-
isPoisoned = true;
|
|
1680
|
-
continue;
|
|
1681
|
-
}
|
|
1682
|
-
declared.add(decl.node);
|
|
1683
|
-
}
|
|
1684
|
-
for (const decl of ngModule.exports) {
|
|
1685
|
-
const exportScope = this.getExportedScope(decl, diagnostics, ref.node, "export");
|
|
1686
|
-
if (exportScope === "invalid" || exportScope !== null && exportScope.exported.isPoisoned) {
|
|
1687
|
-
diagnostics.push(invalidTransitiveNgModuleRef(ref.node, decl, "export"));
|
|
1688
|
-
isPoisoned = true;
|
|
1689
|
-
if (exportScope === "invalid") {
|
|
1690
|
-
continue;
|
|
1691
|
-
}
|
|
1692
|
-
} else if (exportScope !== null) {
|
|
1693
|
-
for (const directive of exportScope.exported.directives) {
|
|
1694
|
-
exportDirectives.set(directive.ref.node, directive);
|
|
1695
|
-
}
|
|
1696
|
-
for (const pipe of exportScope.exported.pipes) {
|
|
1697
|
-
exportPipes.set(pipe.ref.node, pipe);
|
|
1698
|
-
}
|
|
1699
|
-
for (const exportedModule of exportScope.exported.ngModules) {
|
|
1700
|
-
exportedModules.add(exportedModule);
|
|
1701
|
-
}
|
|
1702
|
-
} else if (compilationDirectives.has(decl.node)) {
|
|
1703
|
-
const directive = compilationDirectives.get(decl.node);
|
|
1704
|
-
exportDirectives.set(decl.node, directive);
|
|
1705
|
-
} else if (compilationPipes.has(decl.node)) {
|
|
1706
|
-
const pipe = compilationPipes.get(decl.node);
|
|
1707
|
-
exportPipes.set(decl.node, pipe);
|
|
1708
|
-
} else {
|
|
1709
|
-
if (this.localReader.getDirectiveMetadata(decl) !== null || this.localReader.getPipeMetadata(decl) !== null) {
|
|
1710
|
-
diagnostics.push(invalidReexport(ref.node, decl));
|
|
1711
|
-
} else {
|
|
1712
|
-
diagnostics.push(invalidRef(ref.node, decl, "export"));
|
|
1713
|
-
}
|
|
1714
|
-
isPoisoned = true;
|
|
1715
|
-
continue;
|
|
1716
|
-
}
|
|
1717
|
-
}
|
|
1718
|
-
const exported = {
|
|
1719
|
-
directives: Array.from(exportDirectives.values()),
|
|
1720
|
-
pipes: Array.from(exportPipes.values()),
|
|
1721
|
-
ngModules: Array.from(exportedModules),
|
|
1722
|
-
isPoisoned
|
|
1723
|
-
};
|
|
1724
|
-
const reexports = this.getReexports(ngModule, ref, declared, exported, diagnostics);
|
|
1725
|
-
const scope = {
|
|
1726
|
-
ngModule: ngModule.ref.node,
|
|
1727
|
-
compilation: {
|
|
1728
|
-
directives: Array.from(compilationDirectives.values()),
|
|
1729
|
-
pipes: Array.from(compilationPipes.values()),
|
|
1730
|
-
ngModules: Array.from(compilationModules),
|
|
1731
|
-
isPoisoned
|
|
1732
|
-
},
|
|
1733
|
-
exported,
|
|
1734
|
-
reexports,
|
|
1735
|
-
schemas: ngModule.schemas
|
|
1736
|
-
};
|
|
1737
|
-
if (diagnostics.length > 0) {
|
|
1738
|
-
this.scopeErrors.set(ref.node, diagnostics);
|
|
1739
|
-
this.modulesWithStructuralErrors.add(ref.node);
|
|
1740
|
-
}
|
|
1741
|
-
this.cache.set(ref.node, scope);
|
|
1742
|
-
return scope;
|
|
1743
|
-
}
|
|
1744
|
-
getRemoteScope(node) {
|
|
1745
|
-
return this.remoteScoping.has(node) ? this.remoteScoping.get(node) : null;
|
|
1746
|
-
}
|
|
1747
|
-
setComponentRemoteScope(node, directives, pipes) {
|
|
1748
|
-
this.remoteScoping.set(node, { directives, pipes });
|
|
1749
|
-
}
|
|
1750
|
-
getExportedScope(ref, diagnostics, ownerForErrors, type) {
|
|
1751
|
-
if (ref.node.getSourceFile().isDeclarationFile) {
|
|
1752
|
-
if (!ts8.isClassDeclaration(ref.node)) {
|
|
1753
|
-
const code = type === "import" ? ErrorCode.NGMODULE_INVALID_IMPORT : ErrorCode.NGMODULE_INVALID_EXPORT;
|
|
1754
|
-
diagnostics.push(makeDiagnostic(code, identifierOfNode(ref.node) || ref.node, `Appears in the NgModule.${type}s of ${nodeNameForError(ownerForErrors)}, but could not be resolved to an NgModule`));
|
|
1755
|
-
return "invalid";
|
|
1756
|
-
}
|
|
1757
|
-
return this.dependencyScopeReader.resolve(ref);
|
|
1758
|
-
} else {
|
|
1759
|
-
return this.getScopeOfModuleReference(ref);
|
|
1760
|
-
}
|
|
1761
|
-
}
|
|
1762
|
-
getReexports(ngModule, ref, declared, exported, diagnostics) {
|
|
1763
|
-
let reexports = null;
|
|
1764
|
-
const sourceFile = ref.node.getSourceFile();
|
|
1765
|
-
if (this.aliasingHost === null) {
|
|
1766
|
-
return null;
|
|
1767
|
-
}
|
|
1768
|
-
reexports = [];
|
|
1769
|
-
const reexportMap = /* @__PURE__ */ new Map();
|
|
1770
|
-
const ngModuleRef = ref;
|
|
1771
|
-
const addReexport = (exportRef) => {
|
|
1772
|
-
if (exportRef.node.getSourceFile() === sourceFile) {
|
|
1773
|
-
return;
|
|
1774
|
-
}
|
|
1775
|
-
const isReExport = !declared.has(exportRef.node);
|
|
1776
|
-
const exportName = this.aliasingHost.maybeAliasSymbolAs(exportRef, sourceFile, ngModule.ref.node.name.text, isReExport);
|
|
1777
|
-
if (exportName === null) {
|
|
1778
|
-
return;
|
|
1779
|
-
}
|
|
1780
|
-
if (!reexportMap.has(exportName)) {
|
|
1781
|
-
if (exportRef.alias && exportRef.alias instanceof ExternalExpr) {
|
|
1782
|
-
reexports.push({
|
|
1783
|
-
fromModule: exportRef.alias.value.moduleName,
|
|
1784
|
-
symbolName: exportRef.alias.value.name,
|
|
1785
|
-
asAlias: exportName
|
|
1786
|
-
});
|
|
1787
|
-
} else {
|
|
1788
|
-
const emittedRef = this.refEmitter.emit(exportRef.cloneWithNoIdentifiers(), sourceFile);
|
|
1789
|
-
assertSuccessfulReferenceEmit(emittedRef, ngModuleRef.node.name, "class");
|
|
1790
|
-
const expr = emittedRef.expression;
|
|
1791
|
-
if (!(expr instanceof ExternalExpr) || expr.value.moduleName === null || expr.value.name === null) {
|
|
1792
|
-
throw new Error("Expected ExternalExpr");
|
|
1793
|
-
}
|
|
1794
|
-
reexports.push({
|
|
1795
|
-
fromModule: expr.value.moduleName,
|
|
1796
|
-
symbolName: expr.value.name,
|
|
1797
|
-
asAlias: exportName
|
|
1798
|
-
});
|
|
1799
|
-
}
|
|
1800
|
-
reexportMap.set(exportName, exportRef);
|
|
1801
|
-
} else {
|
|
1802
|
-
const prevRef = reexportMap.get(exportName);
|
|
1803
|
-
diagnostics.push(reexportCollision(ngModuleRef.node, prevRef, exportRef));
|
|
1804
|
-
}
|
|
1805
|
-
};
|
|
1806
|
-
for (const { ref: ref2 } of exported.directives) {
|
|
1807
|
-
addReexport(ref2);
|
|
1808
|
-
}
|
|
1809
|
-
for (const { ref: ref2 } of exported.pipes) {
|
|
1810
|
-
addReexport(ref2);
|
|
1811
|
-
}
|
|
1812
|
-
return reexports;
|
|
1813
|
-
}
|
|
1814
|
-
assertCollecting() {
|
|
1815
|
-
if (this.sealed) {
|
|
1816
|
-
throw new Error(`Assertion: LocalModuleScopeRegistry is not COLLECTING`);
|
|
1817
|
-
}
|
|
1818
|
-
}
|
|
1819
|
-
};
|
|
1820
|
-
function invalidRef(clazz, decl, type) {
|
|
1821
|
-
const code = type === "import" ? ErrorCode.NGMODULE_INVALID_IMPORT : ErrorCode.NGMODULE_INVALID_EXPORT;
|
|
1822
|
-
const resolveTarget = type === "import" ? "NgModule" : "NgModule, Component, Directive, or Pipe";
|
|
1823
|
-
let message = `Appears in the NgModule.${type}s of ${nodeNameForError(clazz)}, but could not be resolved to an ${resolveTarget} class.
|
|
1824
|
-
|
|
1825
|
-
`;
|
|
1826
|
-
const library = decl.ownedByModuleGuess !== null ? ` (${decl.ownedByModuleGuess})` : "";
|
|
1827
|
-
const sf = decl.node.getSourceFile();
|
|
1828
|
-
if (!sf.isDeclarationFile) {
|
|
1829
|
-
const annotationType = type === "import" ? "@NgModule" : "Angular";
|
|
1830
|
-
message += `Is it missing an ${annotationType} annotation?`;
|
|
1831
|
-
} else if (sf.fileName.indexOf("node_modules") !== -1) {
|
|
1832
|
-
message += `This likely means that the library${library} which declares ${decl.debugName} has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.`;
|
|
1833
|
-
} else {
|
|
1834
|
-
message += `This likely means that the dependency${library} which declares ${decl.debugName} has not been processed correctly by ngcc.`;
|
|
1835
|
-
}
|
|
1836
|
-
return makeDiagnostic(code, identifierOfNode(decl.node) || decl.node, message);
|
|
1837
|
-
}
|
|
1838
|
-
function invalidTransitiveNgModuleRef(clazz, decl, type) {
|
|
1839
|
-
const code = type === "import" ? ErrorCode.NGMODULE_INVALID_IMPORT : ErrorCode.NGMODULE_INVALID_EXPORT;
|
|
1840
|
-
return makeDiagnostic(code, identifierOfNode(decl.node) || decl.node, `Appears in the NgModule.${type}s of ${nodeNameForError(clazz)}, but itself has errors`);
|
|
1841
|
-
}
|
|
1842
|
-
function invalidReexport(clazz, decl) {
|
|
1843
|
-
return makeDiagnostic(ErrorCode.NGMODULE_INVALID_REEXPORT, identifierOfNode(decl.node) || decl.node, `Present in the NgModule.exports of ${nodeNameForError(clazz)} but neither declared nor imported`);
|
|
1844
|
-
}
|
|
1845
|
-
function reexportCollision(module, refA, refB) {
|
|
1846
|
-
const childMessageText = `This directive/pipe is part of the exports of '${module.name.text}' and shares the same name as another exported directive/pipe.`;
|
|
1847
|
-
return makeDiagnostic(ErrorCode.NGMODULE_REEXPORT_NAME_COLLISION, module.name, `
|
|
1848
|
-
There was a name collision between two classes named '${refA.node.name.text}', which are both part of the exports of '${module.name.text}'.
|
|
1849
|
-
|
|
1850
|
-
Angular generates re-exports of an NgModule's exported directives/pipes from the module's source file in certain cases, using the declared name of the class. If two classes of the same name are exported, this automatic naming does not work.
|
|
1851
|
-
|
|
1852
|
-
To fix this problem please re-export one or both classes directly from this file.
|
|
1853
|
-
`.trim(), [
|
|
1854
|
-
makeRelatedInformation(refA.node.name, childMessageText),
|
|
1855
|
-
makeRelatedInformation(refB.node.name, childMessageText)
|
|
1856
|
-
]);
|
|
1857
|
-
}
|
|
1858
|
-
|
|
1859
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/typecheck.mjs
|
|
1860
|
-
import { CssSelector, SelectorMatcher } from "@angular/compiler";
|
|
1861
|
-
import ts9 from "typescript";
|
|
1862
|
-
var TypeCheckScopeRegistry = class {
|
|
1863
|
-
constructor(scopeReader, metaReader) {
|
|
1864
|
-
this.scopeReader = scopeReader;
|
|
1865
|
-
this.metaReader = metaReader;
|
|
1866
|
-
this.flattenedDirectiveMetaCache = /* @__PURE__ */ new Map();
|
|
1867
|
-
this.scopeCache = /* @__PURE__ */ new Map();
|
|
1868
|
-
}
|
|
1869
|
-
getTypeCheckScope(node) {
|
|
1870
|
-
const matcher = new SelectorMatcher();
|
|
1871
|
-
const directives = [];
|
|
1872
|
-
const pipes = /* @__PURE__ */ new Map();
|
|
1873
|
-
const scope = this.scopeReader.getScopeForComponent(node);
|
|
1874
|
-
if (scope === null) {
|
|
1875
|
-
return {
|
|
1876
|
-
matcher,
|
|
1877
|
-
directives,
|
|
1878
|
-
pipes,
|
|
1879
|
-
schemas: [],
|
|
1880
|
-
isPoisoned: false
|
|
1881
|
-
};
|
|
1882
|
-
}
|
|
1883
|
-
if (this.scopeCache.has(scope.ngModule)) {
|
|
1884
|
-
return this.scopeCache.get(scope.ngModule);
|
|
1885
|
-
}
|
|
1886
|
-
for (const meta of scope.compilation.directives) {
|
|
1887
|
-
if (meta.selector !== null) {
|
|
1888
|
-
const extMeta = this.getTypeCheckDirectiveMetadata(meta.ref);
|
|
1889
|
-
matcher.addSelectables(CssSelector.parse(meta.selector), extMeta);
|
|
1890
|
-
directives.push(extMeta);
|
|
1891
|
-
}
|
|
1892
|
-
}
|
|
1893
|
-
for (const { name, ref } of scope.compilation.pipes) {
|
|
1894
|
-
if (!ts9.isClassDeclaration(ref.node)) {
|
|
1895
|
-
throw new Error(`Unexpected non-class declaration ${ts9.SyntaxKind[ref.node.kind]} for pipe ${ref.debugName}`);
|
|
1896
|
-
}
|
|
1897
|
-
pipes.set(name, ref);
|
|
1898
|
-
}
|
|
1899
|
-
const typeCheckScope = {
|
|
1900
|
-
matcher,
|
|
1901
|
-
directives,
|
|
1902
|
-
pipes,
|
|
1903
|
-
schemas: scope.schemas,
|
|
1904
|
-
isPoisoned: scope.compilation.isPoisoned || scope.exported.isPoisoned
|
|
1905
|
-
};
|
|
1906
|
-
this.scopeCache.set(scope.ngModule, typeCheckScope);
|
|
1907
|
-
return typeCheckScope;
|
|
1908
|
-
}
|
|
1909
|
-
getTypeCheckDirectiveMetadata(ref) {
|
|
1910
|
-
const clazz = ref.node;
|
|
1911
|
-
if (this.flattenedDirectiveMetaCache.has(clazz)) {
|
|
1912
|
-
return this.flattenedDirectiveMetaCache.get(clazz);
|
|
1913
|
-
}
|
|
1914
|
-
const meta = flattenInheritedDirectiveMetadata(this.metaReader, ref);
|
|
1915
|
-
this.flattenedDirectiveMetaCache.set(clazz, meta);
|
|
1916
|
-
return meta;
|
|
1917
|
-
}
|
|
1918
|
-
};
|
|
1919
|
-
|
|
1920
1491
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/checker.mjs
|
|
1921
|
-
import { CssSelector
|
|
1492
|
+
import { CssSelector, DomElementSchemaRegistry as DomElementSchemaRegistry2 } from "@angular/compiler";
|
|
1922
1493
|
|
|
1923
1494
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/diagnostics/src/diagnostic.mjs
|
|
1924
|
-
import
|
|
1495
|
+
import ts8 from "typescript";
|
|
1925
1496
|
function makeTemplateDiagnostic(templateId, mapping, span, category, code, messageText, relatedMessages) {
|
|
1926
1497
|
if (mapping.type === "direct") {
|
|
1927
1498
|
let relatedInformation = void 0;
|
|
@@ -1929,7 +1500,7 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
1929
1500
|
relatedInformation = [];
|
|
1930
1501
|
for (const relatedMessage of relatedMessages) {
|
|
1931
1502
|
relatedInformation.push({
|
|
1932
|
-
category:
|
|
1503
|
+
category: ts8.DiagnosticCategory.Message,
|
|
1933
1504
|
code: 0,
|
|
1934
1505
|
file: relatedMessage.sourceFile,
|
|
1935
1506
|
start: relatedMessage.start,
|
|
@@ -1954,12 +1525,12 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
1954
1525
|
const componentSf = mapping.componentClass.getSourceFile();
|
|
1955
1526
|
const componentName = mapping.componentClass.name.text;
|
|
1956
1527
|
const fileName = mapping.type === "indirect" ? `${componentSf.fileName} (${componentName} template)` : mapping.templateUrl;
|
|
1957
|
-
const sf =
|
|
1528
|
+
const sf = ts8.createSourceFile(fileName, mapping.template, ts8.ScriptTarget.Latest, false, ts8.ScriptKind.JSX);
|
|
1958
1529
|
let relatedInformation = [];
|
|
1959
1530
|
if (relatedMessages !== void 0) {
|
|
1960
1531
|
for (const relatedMessage of relatedMessages) {
|
|
1961
1532
|
relatedInformation.push({
|
|
1962
|
-
category:
|
|
1533
|
+
category: ts8.DiagnosticCategory.Message,
|
|
1963
1534
|
code: 0,
|
|
1964
1535
|
file: relatedMessage.sourceFile,
|
|
1965
1536
|
start: relatedMessage.start,
|
|
@@ -1969,7 +1540,7 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
1969
1540
|
}
|
|
1970
1541
|
}
|
|
1971
1542
|
relatedInformation.push({
|
|
1972
|
-
category:
|
|
1543
|
+
category: ts8.DiagnosticCategory.Message,
|
|
1973
1544
|
code: 0,
|
|
1974
1545
|
file: componentSf,
|
|
1975
1546
|
start: mapping.node.getStart(),
|
|
@@ -2012,15 +1583,15 @@ function allocateTemplateId(sf) {
|
|
|
2012
1583
|
|
|
2013
1584
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/completion.mjs
|
|
2014
1585
|
import { EmptyExpr, ImplicitReceiver as ImplicitReceiver2, PropertyRead as PropertyRead2, PropertyWrite as PropertyWrite2, SafePropertyRead, TmplAstReference as TmplAstReference2, TmplAstTextAttribute } from "@angular/compiler";
|
|
2015
|
-
import
|
|
1586
|
+
import ts10 from "typescript";
|
|
2016
1587
|
|
|
2017
1588
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/comments.mjs
|
|
2018
1589
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan2 } from "@angular/compiler";
|
|
2019
|
-
import
|
|
1590
|
+
import ts9 from "typescript";
|
|
2020
1591
|
var parseSpanComment = /^(\d+),(\d+)$/;
|
|
2021
1592
|
function readSpanComment(node, sourceFile = node.getSourceFile()) {
|
|
2022
|
-
return
|
|
2023
|
-
if (kind !==
|
|
1593
|
+
return ts9.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
1594
|
+
if (kind !== ts9.SyntaxKind.MultiLineCommentTrivia) {
|
|
2024
1595
|
return null;
|
|
2025
1596
|
}
|
|
2026
1597
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -2043,15 +1614,15 @@ var ExpressionIdentifier;
|
|
|
2043
1614
|
ExpressionIdentifier2["EVENT_PARAMETER"] = "EP";
|
|
2044
1615
|
})(ExpressionIdentifier || (ExpressionIdentifier = {}));
|
|
2045
1616
|
function addExpressionIdentifier(node, identifier) {
|
|
2046
|
-
|
|
1617
|
+
ts9.addSyntheticTrailingComment(node, ts9.SyntaxKind.MultiLineCommentTrivia, `${CommentTriviaType.EXPRESSION_TYPE_IDENTIFIER}:${identifier}`, false);
|
|
2047
1618
|
}
|
|
2048
1619
|
var IGNORE_FOR_DIAGNOSTICS_MARKER = `${CommentTriviaType.DIAGNOSTIC}:ignore`;
|
|
2049
1620
|
function markIgnoreDiagnostics(node) {
|
|
2050
|
-
|
|
1621
|
+
ts9.addSyntheticTrailingComment(node, ts9.SyntaxKind.MultiLineCommentTrivia, IGNORE_FOR_DIAGNOSTICS_MARKER, false);
|
|
2051
1622
|
}
|
|
2052
1623
|
function hasIgnoreForDiagnosticsMarker(node, sourceFile) {
|
|
2053
|
-
return
|
|
2054
|
-
if (kind !==
|
|
1624
|
+
return ts9.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
1625
|
+
if (kind !== ts9.SyntaxKind.MultiLineCommentTrivia) {
|
|
2055
1626
|
return null;
|
|
2056
1627
|
}
|
|
2057
1628
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -2125,8 +1696,8 @@ function findAllMatchingNodes(tcb, opts) {
|
|
|
2125
1696
|
return results;
|
|
2126
1697
|
}
|
|
2127
1698
|
function hasExpressionIdentifier(sourceFile, node, identifier) {
|
|
2128
|
-
return
|
|
2129
|
-
if (kind !==
|
|
1699
|
+
return ts9.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
1700
|
+
if (kind !== ts9.SyntaxKind.MultiLineCommentTrivia) {
|
|
2130
1701
|
return false;
|
|
2131
1702
|
}
|
|
2132
1703
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -2136,20 +1707,22 @@ function hasExpressionIdentifier(sourceFile, node, identifier) {
|
|
|
2136
1707
|
|
|
2137
1708
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/completion.mjs
|
|
2138
1709
|
var CompletionEngine = class {
|
|
2139
|
-
constructor(tcb, data,
|
|
1710
|
+
constructor(tcb, data, tcbPath, tcbIsShim) {
|
|
2140
1711
|
this.tcb = tcb;
|
|
2141
1712
|
this.data = data;
|
|
2142
|
-
this.
|
|
1713
|
+
this.tcbPath = tcbPath;
|
|
1714
|
+
this.tcbIsShim = tcbIsShim;
|
|
2143
1715
|
this.templateContextCache = /* @__PURE__ */ new Map();
|
|
2144
1716
|
this.expressionCompletionCache = /* @__PURE__ */ new Map();
|
|
2145
1717
|
const globalRead = findFirstMatchingNode(this.tcb, {
|
|
2146
|
-
filter:
|
|
1718
|
+
filter: ts10.isPropertyAccessExpression,
|
|
2147
1719
|
withExpressionIdentifier: ExpressionIdentifier.COMPONENT_COMPLETION
|
|
2148
1720
|
});
|
|
2149
1721
|
if (globalRead !== null) {
|
|
2150
1722
|
this.componentContext = {
|
|
2151
|
-
|
|
2152
|
-
|
|
1723
|
+
tcbPath: this.tcbPath,
|
|
1724
|
+
isShimFile: this.tcbIsShim,
|
|
1725
|
+
positionInFile: globalRead.name.getStart()
|
|
2153
1726
|
};
|
|
2154
1727
|
} else {
|
|
2155
1728
|
this.componentContext = null;
|
|
@@ -2166,25 +1739,27 @@ var CompletionEngine = class {
|
|
|
2166
1739
|
let nodeContext = null;
|
|
2167
1740
|
if (node instanceof EmptyExpr) {
|
|
2168
1741
|
const nodeLocation = findFirstMatchingNode(this.tcb, {
|
|
2169
|
-
filter:
|
|
1742
|
+
filter: ts10.isIdentifier,
|
|
2170
1743
|
withSpan: node.sourceSpan
|
|
2171
1744
|
});
|
|
2172
1745
|
if (nodeLocation !== null) {
|
|
2173
1746
|
nodeContext = {
|
|
2174
|
-
|
|
2175
|
-
|
|
1747
|
+
tcbPath: this.tcbPath,
|
|
1748
|
+
isShimFile: this.tcbIsShim,
|
|
1749
|
+
positionInFile: nodeLocation.getStart()
|
|
2176
1750
|
};
|
|
2177
1751
|
}
|
|
2178
1752
|
}
|
|
2179
1753
|
if (node instanceof PropertyRead2 && node.receiver instanceof ImplicitReceiver2) {
|
|
2180
1754
|
const nodeLocation = findFirstMatchingNode(this.tcb, {
|
|
2181
|
-
filter:
|
|
1755
|
+
filter: ts10.isPropertyAccessExpression,
|
|
2182
1756
|
withSpan: node.sourceSpan
|
|
2183
1757
|
});
|
|
2184
1758
|
if (nodeLocation) {
|
|
2185
1759
|
nodeContext = {
|
|
2186
|
-
|
|
2187
|
-
|
|
1760
|
+
tcbPath: this.tcbPath,
|
|
1761
|
+
isShimFile: this.tcbIsShim,
|
|
1762
|
+
positionInFile: nodeLocation.getStart()
|
|
2188
1763
|
};
|
|
2189
1764
|
}
|
|
2190
1765
|
}
|
|
@@ -2201,21 +1776,21 @@ var CompletionEngine = class {
|
|
|
2201
1776
|
let tsExpr = null;
|
|
2202
1777
|
if (expr instanceof PropertyRead2 || expr instanceof PropertyWrite2) {
|
|
2203
1778
|
tsExpr = findFirstMatchingNode(this.tcb, {
|
|
2204
|
-
filter:
|
|
1779
|
+
filter: ts10.isPropertyAccessExpression,
|
|
2205
1780
|
withSpan: expr.nameSpan
|
|
2206
1781
|
});
|
|
2207
1782
|
} else if (expr instanceof SafePropertyRead) {
|
|
2208
1783
|
const ternaryExpr = findFirstMatchingNode(this.tcb, {
|
|
2209
|
-
filter:
|
|
1784
|
+
filter: ts10.isParenthesizedExpression,
|
|
2210
1785
|
withSpan: expr.sourceSpan
|
|
2211
1786
|
});
|
|
2212
|
-
if (ternaryExpr === null || !
|
|
1787
|
+
if (ternaryExpr === null || !ts10.isConditionalExpression(ternaryExpr.expression)) {
|
|
2213
1788
|
return null;
|
|
2214
1789
|
}
|
|
2215
1790
|
const whenTrue = ternaryExpr.expression.whenTrue;
|
|
2216
|
-
if (
|
|
1791
|
+
if (ts10.isPropertyAccessExpression(whenTrue)) {
|
|
2217
1792
|
tsExpr = whenTrue;
|
|
2218
|
-
} else if (
|
|
1793
|
+
} else if (ts10.isCallExpression(whenTrue) && ts10.isPropertyAccessExpression(whenTrue.expression)) {
|
|
2219
1794
|
tsExpr = whenTrue.expression;
|
|
2220
1795
|
}
|
|
2221
1796
|
}
|
|
@@ -2223,8 +1798,9 @@ var CompletionEngine = class {
|
|
|
2223
1798
|
return null;
|
|
2224
1799
|
}
|
|
2225
1800
|
const res = {
|
|
2226
|
-
|
|
2227
|
-
|
|
1801
|
+
tcbPath: this.tcbPath,
|
|
1802
|
+
isShimFile: this.tcbIsShim,
|
|
1803
|
+
positionInFile: tsExpr.name.getEnd()
|
|
2228
1804
|
};
|
|
2229
1805
|
this.expressionCompletionCache.set(expr, res);
|
|
2230
1806
|
return res;
|
|
@@ -2236,15 +1812,15 @@ var CompletionEngine = class {
|
|
|
2236
1812
|
let tsExpr = null;
|
|
2237
1813
|
if (expr instanceof TmplAstTextAttribute) {
|
|
2238
1814
|
const strNode = findFirstMatchingNode(this.tcb, {
|
|
2239
|
-
filter:
|
|
1815
|
+
filter: ts10.isParenthesizedExpression,
|
|
2240
1816
|
withSpan: expr.sourceSpan
|
|
2241
1817
|
});
|
|
2242
|
-
if (strNode !== null &&
|
|
1818
|
+
if (strNode !== null && ts10.isStringLiteral(strNode.expression)) {
|
|
2243
1819
|
tsExpr = strNode.expression;
|
|
2244
1820
|
}
|
|
2245
1821
|
} else {
|
|
2246
1822
|
tsExpr = findFirstMatchingNode(this.tcb, {
|
|
2247
|
-
filter: (n) =>
|
|
1823
|
+
filter: (n) => ts10.isStringLiteral(n) || ts10.isNumericLiteral(n),
|
|
2248
1824
|
withSpan: expr.sourceSpan
|
|
2249
1825
|
});
|
|
2250
1826
|
}
|
|
@@ -2252,12 +1828,13 @@ var CompletionEngine = class {
|
|
|
2252
1828
|
return null;
|
|
2253
1829
|
}
|
|
2254
1830
|
let positionInShimFile = tsExpr.getEnd();
|
|
2255
|
-
if (
|
|
1831
|
+
if (ts10.isStringLiteral(tsExpr)) {
|
|
2256
1832
|
positionInShimFile -= 1;
|
|
2257
1833
|
}
|
|
2258
1834
|
const res = {
|
|
2259
|
-
|
|
2260
|
-
|
|
1835
|
+
tcbPath: this.tcbPath,
|
|
1836
|
+
isShimFile: this.tcbIsShim,
|
|
1837
|
+
positionInFile: positionInShimFile
|
|
2261
1838
|
};
|
|
2262
1839
|
this.expressionCompletionCache.set(expr, res);
|
|
2263
1840
|
return res;
|
|
@@ -2286,11 +1863,11 @@ var CompletionEngine = class {
|
|
|
2286
1863
|
};
|
|
2287
1864
|
|
|
2288
1865
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/context.mjs
|
|
2289
|
-
import
|
|
1866
|
+
import ts24 from "typescript";
|
|
2290
1867
|
|
|
2291
1868
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/dom.mjs
|
|
2292
1869
|
import { DomElementSchemaRegistry } from "@angular/compiler";
|
|
2293
|
-
import
|
|
1870
|
+
import ts11 from "typescript";
|
|
2294
1871
|
var REGISTRY = new DomElementSchemaRegistry();
|
|
2295
1872
|
var REMOVE_XHTML_REGEX = /^:xhtml:/;
|
|
2296
1873
|
var RegistryDomSchemaChecker = class {
|
|
@@ -2314,7 +1891,7 @@ var RegistryDomSchemaChecker = class {
|
|
|
2314
1891
|
} else {
|
|
2315
1892
|
errorMsg += `2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.`;
|
|
2316
1893
|
}
|
|
2317
|
-
const diag = makeTemplateDiagnostic(id, mapping, element.startSourceSpan,
|
|
1894
|
+
const diag = makeTemplateDiagnostic(id, mapping, element.startSourceSpan, ts11.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ELEMENT), errorMsg);
|
|
2318
1895
|
this._diagnostics.push(diag);
|
|
2319
1896
|
}
|
|
2320
1897
|
}
|
|
@@ -2332,70 +1909,70 @@ var RegistryDomSchemaChecker = class {
|
|
|
2332
1909
|
2. If '${element.name}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
|
|
2333
1910
|
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.`;
|
|
2334
1911
|
}
|
|
2335
|
-
const diag = makeTemplateDiagnostic(id, mapping, span,
|
|
1912
|
+
const diag = makeTemplateDiagnostic(id, mapping, span, ts11.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ATTRIBUTE), errorMsg);
|
|
2336
1913
|
this._diagnostics.push(diag);
|
|
2337
1914
|
}
|
|
2338
1915
|
}
|
|
2339
1916
|
};
|
|
2340
1917
|
|
|
2341
1918
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/environment.mjs
|
|
2342
|
-
import { ExpressionType, ExternalExpr
|
|
2343
|
-
import
|
|
1919
|
+
import { ExpressionType, ExternalExpr, TypeModifier } from "@angular/compiler";
|
|
1920
|
+
import ts17 from "typescript";
|
|
2344
1921
|
|
|
2345
1922
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/ts_util.mjs
|
|
2346
|
-
import
|
|
1923
|
+
import ts12 from "typescript";
|
|
2347
1924
|
var SAFE_TO_CAST_WITHOUT_PARENS = /* @__PURE__ */ new Set([
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
1925
|
+
ts12.SyntaxKind.ParenthesizedExpression,
|
|
1926
|
+
ts12.SyntaxKind.Identifier,
|
|
1927
|
+
ts12.SyntaxKind.CallExpression,
|
|
1928
|
+
ts12.SyntaxKind.NonNullExpression,
|
|
1929
|
+
ts12.SyntaxKind.ElementAccessExpression,
|
|
1930
|
+
ts12.SyntaxKind.PropertyAccessExpression,
|
|
1931
|
+
ts12.SyntaxKind.ArrayLiteralExpression,
|
|
1932
|
+
ts12.SyntaxKind.ObjectLiteralExpression,
|
|
1933
|
+
ts12.SyntaxKind.StringLiteral,
|
|
1934
|
+
ts12.SyntaxKind.NumericLiteral,
|
|
1935
|
+
ts12.SyntaxKind.TrueKeyword,
|
|
1936
|
+
ts12.SyntaxKind.FalseKeyword,
|
|
1937
|
+
ts12.SyntaxKind.NullKeyword,
|
|
1938
|
+
ts12.SyntaxKind.UndefinedKeyword
|
|
2362
1939
|
]);
|
|
2363
1940
|
function tsCastToAny(expr) {
|
|
2364
1941
|
if (!SAFE_TO_CAST_WITHOUT_PARENS.has(expr.kind)) {
|
|
2365
|
-
expr =
|
|
1942
|
+
expr = ts12.factory.createParenthesizedExpression(expr);
|
|
2366
1943
|
}
|
|
2367
|
-
return
|
|
1944
|
+
return ts12.factory.createParenthesizedExpression(ts12.factory.createAsExpression(expr, ts12.factory.createKeywordTypeNode(ts12.SyntaxKind.AnyKeyword)));
|
|
2368
1945
|
}
|
|
2369
1946
|
function tsCreateElement(tagName) {
|
|
2370
|
-
const createElement =
|
|
2371
|
-
return
|
|
1947
|
+
const createElement = ts12.factory.createPropertyAccessExpression(ts12.factory.createIdentifier("document"), "createElement");
|
|
1948
|
+
return ts12.factory.createCallExpression(createElement, void 0, [ts12.factory.createStringLiteral(tagName)]);
|
|
2372
1949
|
}
|
|
2373
1950
|
function tsDeclareVariable(id, type) {
|
|
2374
|
-
const decl =
|
|
2375
|
-
return
|
|
1951
|
+
const decl = ts12.factory.createVariableDeclaration(id, void 0, type, ts12.factory.createNonNullExpression(ts12.factory.createNull()));
|
|
1952
|
+
return ts12.factory.createVariableStatement(void 0, [decl]);
|
|
2376
1953
|
}
|
|
2377
1954
|
function tsCreateTypeQueryForCoercedInput(typeName, coercedInputName) {
|
|
2378
|
-
return
|
|
1955
|
+
return ts12.factory.createTypeQueryNode(ts12.factory.createQualifiedName(typeName, `ngAcceptInputType_${coercedInputName}`));
|
|
2379
1956
|
}
|
|
2380
1957
|
function tsCreateVariable(id, initializer) {
|
|
2381
|
-
const decl =
|
|
2382
|
-
return
|
|
1958
|
+
const decl = ts12.factory.createVariableDeclaration(id, void 0, void 0, initializer);
|
|
1959
|
+
return ts12.factory.createVariableStatement(void 0, [decl]);
|
|
2383
1960
|
}
|
|
2384
1961
|
function tsCallMethod(receiver, methodName, args = []) {
|
|
2385
|
-
const methodAccess =
|
|
2386
|
-
return
|
|
1962
|
+
const methodAccess = ts12.factory.createPropertyAccessExpression(receiver, methodName);
|
|
1963
|
+
return ts12.factory.createCallExpression(methodAccess, void 0, args);
|
|
2387
1964
|
}
|
|
2388
1965
|
function checkIfClassIsExported(node) {
|
|
2389
|
-
if (node.modifiers !== void 0 && node.modifiers.some((mod) => mod.kind ===
|
|
1966
|
+
if (node.modifiers !== void 0 && node.modifiers.some((mod) => mod.kind === ts12.SyntaxKind.ExportKeyword)) {
|
|
2390
1967
|
return true;
|
|
2391
|
-
} else if (node.parent !== void 0 &&
|
|
1968
|
+
} else if (node.parent !== void 0 && ts12.isSourceFile(node.parent) && checkIfFileHasExport(node.parent, node.name.text)) {
|
|
2392
1969
|
return true;
|
|
2393
1970
|
}
|
|
2394
1971
|
return false;
|
|
2395
1972
|
}
|
|
2396
1973
|
function checkIfFileHasExport(sf, name) {
|
|
2397
1974
|
for (const stmt of sf.statements) {
|
|
2398
|
-
if (
|
|
1975
|
+
if (ts12.isExportDeclaration(stmt) && stmt.exportClause !== void 0 && ts12.isNamedExports(stmt.exportClause)) {
|
|
2399
1976
|
for (const element of stmt.exportClause.elements) {
|
|
2400
1977
|
if (element.propertyName === void 0 && element.name.text === name) {
|
|
2401
1978
|
return true;
|
|
@@ -2408,20 +1985,20 @@ function checkIfFileHasExport(sf, name) {
|
|
|
2408
1985
|
return false;
|
|
2409
1986
|
}
|
|
2410
1987
|
function isAccessExpression(node) {
|
|
2411
|
-
return
|
|
1988
|
+
return ts12.isPropertyAccessExpression(node) || ts12.isElementAccessExpression(node);
|
|
2412
1989
|
}
|
|
2413
1990
|
|
|
2414
1991
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.mjs
|
|
2415
|
-
import
|
|
1992
|
+
import ts16 from "typescript";
|
|
2416
1993
|
|
|
2417
1994
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/tcb_util.mjs
|
|
2418
|
-
import
|
|
1995
|
+
import ts15 from "typescript";
|
|
2419
1996
|
|
|
2420
1997
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_parameter_emitter.mjs
|
|
2421
|
-
import
|
|
1998
|
+
import ts14 from "typescript";
|
|
2422
1999
|
|
|
2423
2000
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_emitter.mjs
|
|
2424
|
-
import
|
|
2001
|
+
import ts13 from "typescript";
|
|
2425
2002
|
var INELIGIBLE = {};
|
|
2426
2003
|
function canEmitType(type, canEmit) {
|
|
2427
2004
|
return canEmitTypeWorker(type);
|
|
@@ -2429,13 +2006,13 @@ function canEmitType(type, canEmit) {
|
|
|
2429
2006
|
return visitNode(type2) !== INELIGIBLE;
|
|
2430
2007
|
}
|
|
2431
2008
|
function visitNode(node) {
|
|
2432
|
-
if (
|
|
2009
|
+
if (ts13.isImportTypeNode(node)) {
|
|
2433
2010
|
return INELIGIBLE;
|
|
2434
2011
|
}
|
|
2435
|
-
if (
|
|
2012
|
+
if (ts13.isTypeReferenceNode(node) && !canEmitTypeReference(node)) {
|
|
2436
2013
|
return INELIGIBLE;
|
|
2437
2014
|
} else {
|
|
2438
|
-
return
|
|
2015
|
+
return ts13.forEachChild(node, visitNode);
|
|
2439
2016
|
}
|
|
2440
2017
|
}
|
|
2441
2018
|
function canEmitTypeReference(type2) {
|
|
@@ -2452,22 +2029,22 @@ var TypeEmitter = class {
|
|
|
2452
2029
|
emitType(type) {
|
|
2453
2030
|
const typeReferenceTransformer = (context) => {
|
|
2454
2031
|
const visitNode = (node) => {
|
|
2455
|
-
if (
|
|
2032
|
+
if (ts13.isImportTypeNode(node)) {
|
|
2456
2033
|
throw new Error("Unable to emit import type");
|
|
2457
2034
|
}
|
|
2458
|
-
if (
|
|
2035
|
+
if (ts13.isTypeReferenceNode(node)) {
|
|
2459
2036
|
return this.emitTypeReference(node);
|
|
2460
|
-
} else if (
|
|
2461
|
-
const clone =
|
|
2462
|
-
|
|
2037
|
+
} else if (ts13.isLiteralExpression(node)) {
|
|
2038
|
+
const clone = ts13.getMutableClone(node);
|
|
2039
|
+
ts13.setTextRange(clone, { pos: -1, end: -1 });
|
|
2463
2040
|
return clone;
|
|
2464
2041
|
} else {
|
|
2465
|
-
return
|
|
2042
|
+
return ts13.visitEachChild(node, visitNode, context);
|
|
2466
2043
|
}
|
|
2467
2044
|
};
|
|
2468
|
-
return (node) =>
|
|
2045
|
+
return (node) => ts13.visitNode(node, visitNode);
|
|
2469
2046
|
};
|
|
2470
|
-
return
|
|
2047
|
+
return ts13.transform(type, [typeReferenceTransformer]).transformed[0];
|
|
2471
2048
|
}
|
|
2472
2049
|
emitTypeReference(type) {
|
|
2473
2050
|
const translatedType = this.translator(type);
|
|
@@ -2476,9 +2053,9 @@ var TypeEmitter = class {
|
|
|
2476
2053
|
}
|
|
2477
2054
|
let typeArguments = void 0;
|
|
2478
2055
|
if (type.typeArguments !== void 0) {
|
|
2479
|
-
typeArguments =
|
|
2056
|
+
typeArguments = ts13.factory.createNodeArray(type.typeArguments.map((typeArg) => this.emitType(typeArg)));
|
|
2480
2057
|
}
|
|
2481
|
-
return
|
|
2058
|
+
return ts13.factory.updateTypeReferenceNode(type, translatedType.typeName, typeArguments);
|
|
2482
2059
|
}
|
|
2483
2060
|
};
|
|
2484
2061
|
|
|
@@ -2519,11 +2096,11 @@ var TypeParameterEmitter = class {
|
|
|
2519
2096
|
return this.typeParameters.map((typeParam) => {
|
|
2520
2097
|
const constraint = typeParam.constraint !== void 0 ? emitter.emitType(typeParam.constraint) : void 0;
|
|
2521
2098
|
const defaultType = typeParam.default !== void 0 ? emitter.emitType(typeParam.default) : void 0;
|
|
2522
|
-
return
|
|
2099
|
+
return ts14.factory.updateTypeParameterDeclaration(typeParam, typeParam.name, constraint, defaultType);
|
|
2523
2100
|
});
|
|
2524
2101
|
}
|
|
2525
2102
|
resolveTypeReference(type) {
|
|
2526
|
-
const target =
|
|
2103
|
+
const target = ts14.isIdentifier(type.typeName) ? type.typeName : type.typeName.right;
|
|
2527
2104
|
const declaration = this.reflector.getDeclarationOfIdentifier(target);
|
|
2528
2105
|
if (declaration === null || declaration.node === null) {
|
|
2529
2106
|
return null;
|
|
@@ -2549,8 +2126,8 @@ var TypeParameterEmitter = class {
|
|
|
2549
2126
|
if (typeNode === null) {
|
|
2550
2127
|
return null;
|
|
2551
2128
|
}
|
|
2552
|
-
if (!
|
|
2553
|
-
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${
|
|
2129
|
+
if (!ts14.isTypeReferenceNode(typeNode)) {
|
|
2130
|
+
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${ts14.SyntaxKind[typeNode.kind]}.`);
|
|
2554
2131
|
}
|
|
2555
2132
|
return typeNode;
|
|
2556
2133
|
}
|
|
@@ -2592,14 +2169,14 @@ function getTemplateMapping(shimSf, position, resolver, isDiagnosticRequest) {
|
|
|
2592
2169
|
}
|
|
2593
2170
|
function findTypeCheckBlock(file, id, isDiagnosticRequest) {
|
|
2594
2171
|
for (const stmt of file.statements) {
|
|
2595
|
-
if (
|
|
2172
|
+
if (ts15.isFunctionDeclaration(stmt) && getTemplateId2(stmt, file, isDiagnosticRequest) === id) {
|
|
2596
2173
|
return stmt;
|
|
2597
2174
|
}
|
|
2598
2175
|
}
|
|
2599
2176
|
return null;
|
|
2600
2177
|
}
|
|
2601
2178
|
function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
|
|
2602
|
-
while (node !== void 0 && !
|
|
2179
|
+
while (node !== void 0 && !ts15.isFunctionDeclaration(node)) {
|
|
2603
2180
|
if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticsRequest) {
|
|
2604
2181
|
return null;
|
|
2605
2182
|
}
|
|
@@ -2616,7 +2193,7 @@ function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
|
|
|
2616
2193
|
return null;
|
|
2617
2194
|
}
|
|
2618
2195
|
function getTemplateId2(node, sourceFile, isDiagnosticRequest) {
|
|
2619
|
-
while (!
|
|
2196
|
+
while (!ts15.isFunctionDeclaration(node)) {
|
|
2620
2197
|
if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticRequest) {
|
|
2621
2198
|
return null;
|
|
2622
2199
|
}
|
|
@@ -2626,8 +2203,8 @@ function getTemplateId2(node, sourceFile, isDiagnosticRequest) {
|
|
|
2626
2203
|
}
|
|
2627
2204
|
}
|
|
2628
2205
|
const start = node.getFullStart();
|
|
2629
|
-
return
|
|
2630
|
-
if (kind !==
|
|
2206
|
+
return ts15.forEachLeadingCommentRange(sourceFile.text, start, (pos, end, kind) => {
|
|
2207
|
+
if (kind !== ts15.SyntaxKind.MultiLineCommentTrivia) {
|
|
2631
2208
|
return null;
|
|
2632
2209
|
}
|
|
2633
2210
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -2642,29 +2219,29 @@ function checkIfGenericTypeBoundsCanBeEmitted(node, reflector, env) {
|
|
|
2642
2219
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.mjs
|
|
2643
2220
|
function generateTypeCtorDeclarationFn(node, meta, nodeTypeRef, typeParams) {
|
|
2644
2221
|
const rawTypeArgs = typeParams !== void 0 ? generateGenericArgs(typeParams) : void 0;
|
|
2645
|
-
const rawType =
|
|
2222
|
+
const rawType = ts16.factory.createTypeReferenceNode(nodeTypeRef, rawTypeArgs);
|
|
2646
2223
|
const initParam = constructTypeCtorParameter(node, meta, rawType);
|
|
2647
2224
|
const typeParameters = typeParametersWithDefaultTypes(typeParams);
|
|
2648
2225
|
if (meta.body) {
|
|
2649
|
-
const fnType =
|
|
2650
|
-
const decl =
|
|
2651
|
-
const declList =
|
|
2652
|
-
return
|
|
2226
|
+
const fnType = ts16.factory.createFunctionTypeNode(typeParameters, [initParam], rawType);
|
|
2227
|
+
const decl = ts16.factory.createVariableDeclaration(meta.fnName, void 0, fnType, ts16.factory.createNonNullExpression(ts16.factory.createNull()));
|
|
2228
|
+
const declList = ts16.factory.createVariableDeclarationList([decl], ts16.NodeFlags.Const);
|
|
2229
|
+
return ts16.factory.createVariableStatement(void 0, declList);
|
|
2653
2230
|
} else {
|
|
2654
|
-
return
|
|
2231
|
+
return ts16.factory.createFunctionDeclaration(void 0, [ts16.factory.createModifier(ts16.SyntaxKind.DeclareKeyword)], void 0, meta.fnName, typeParameters, [initParam], rawType, void 0);
|
|
2655
2232
|
}
|
|
2656
2233
|
}
|
|
2657
2234
|
function generateInlineTypeCtor(node, meta) {
|
|
2658
2235
|
const rawTypeArgs = node.typeParameters !== void 0 ? generateGenericArgs(node.typeParameters) : void 0;
|
|
2659
|
-
const rawType =
|
|
2236
|
+
const rawType = ts16.factory.createTypeReferenceNode(node.name, rawTypeArgs);
|
|
2660
2237
|
const initParam = constructTypeCtorParameter(node, meta, rawType);
|
|
2661
2238
|
let body = void 0;
|
|
2662
2239
|
if (meta.body) {
|
|
2663
|
-
body =
|
|
2664
|
-
|
|
2240
|
+
body = ts16.factory.createBlock([
|
|
2241
|
+
ts16.factory.createReturnStatement(ts16.factory.createNonNullExpression(ts16.factory.createNull()))
|
|
2665
2242
|
]);
|
|
2666
2243
|
}
|
|
2667
|
-
return
|
|
2244
|
+
return ts16.factory.createMethodDeclaration(void 0, [ts16.factory.createModifier(ts16.SyntaxKind.StaticKeyword)], void 0, meta.fnName, void 0, typeParametersWithDefaultTypes(node.typeParameters), [initParam], rawType, body);
|
|
2668
2245
|
}
|
|
2669
2246
|
function constructTypeCtorParameter(node, meta, rawType) {
|
|
2670
2247
|
let initType = null;
|
|
@@ -2673,26 +2250,26 @@ function constructTypeCtorParameter(node, meta, rawType) {
|
|
|
2673
2250
|
const coercedKeys = [];
|
|
2674
2251
|
for (const key of keys) {
|
|
2675
2252
|
if (!meta.coercedInputFields.has(key)) {
|
|
2676
|
-
plainKeys.push(
|
|
2253
|
+
plainKeys.push(ts16.factory.createLiteralTypeNode(ts16.factory.createStringLiteral(key)));
|
|
2677
2254
|
} else {
|
|
2678
|
-
coercedKeys.push(
|
|
2255
|
+
coercedKeys.push(ts16.factory.createPropertySignature(void 0, key, void 0, tsCreateTypeQueryForCoercedInput(rawType.typeName, key)));
|
|
2679
2256
|
}
|
|
2680
2257
|
}
|
|
2681
2258
|
if (plainKeys.length > 0) {
|
|
2682
|
-
const keyTypeUnion =
|
|
2683
|
-
initType =
|
|
2259
|
+
const keyTypeUnion = ts16.factory.createUnionTypeNode(plainKeys);
|
|
2260
|
+
initType = ts16.factory.createTypeReferenceNode("Pick", [rawType, keyTypeUnion]);
|
|
2684
2261
|
}
|
|
2685
2262
|
if (coercedKeys.length > 0) {
|
|
2686
|
-
const coercedLiteral =
|
|
2687
|
-
initType = initType !== null ?
|
|
2263
|
+
const coercedLiteral = ts16.factory.createTypeLiteralNode(coercedKeys);
|
|
2264
|
+
initType = initType !== null ? ts16.factory.createIntersectionTypeNode([initType, coercedLiteral]) : coercedLiteral;
|
|
2688
2265
|
}
|
|
2689
2266
|
if (initType === null) {
|
|
2690
|
-
initType =
|
|
2267
|
+
initType = ts16.factory.createTypeLiteralNode([]);
|
|
2691
2268
|
}
|
|
2692
|
-
return
|
|
2269
|
+
return ts16.factory.createParameterDeclaration(void 0, void 0, void 0, "init", void 0, initType, void 0);
|
|
2693
2270
|
}
|
|
2694
2271
|
function generateGenericArgs(params) {
|
|
2695
|
-
return params.map((param) =>
|
|
2272
|
+
return params.map((param) => ts16.factory.createTypeReferenceNode(param.name, void 0));
|
|
2696
2273
|
}
|
|
2697
2274
|
function requiresInlineTypeCtor(node, host, env) {
|
|
2698
2275
|
return !checkIfGenericTypeBoundsCanBeEmitted(node, host, env);
|
|
@@ -2703,7 +2280,7 @@ function typeParametersWithDefaultTypes(params) {
|
|
|
2703
2280
|
}
|
|
2704
2281
|
return params.map((param) => {
|
|
2705
2282
|
if (param.default === void 0) {
|
|
2706
|
-
return
|
|
2283
|
+
return ts16.factory.updateTypeParameterDeclaration(param, param.name, param.constraint, ts16.factory.createKeywordTypeNode(ts16.SyntaxKind.AnyKeyword));
|
|
2707
2284
|
} else {
|
|
2708
2285
|
return param;
|
|
2709
2286
|
}
|
|
@@ -2735,13 +2312,13 @@ var Environment = class {
|
|
|
2735
2312
|
}
|
|
2736
2313
|
if (requiresInlineTypeCtor(node, this.reflector, this)) {
|
|
2737
2314
|
const ref = this.reference(dirRef);
|
|
2738
|
-
const typeCtorExpr =
|
|
2315
|
+
const typeCtorExpr = ts17.factory.createPropertyAccessExpression(ref, "ngTypeCtor");
|
|
2739
2316
|
this.typeCtors.set(node, typeCtorExpr);
|
|
2740
2317
|
return typeCtorExpr;
|
|
2741
2318
|
} else {
|
|
2742
2319
|
const fnName = `_ctor${this.nextIds.typeCtor++}`;
|
|
2743
2320
|
const nodeTypeRef = this.referenceType(dirRef);
|
|
2744
|
-
if (!
|
|
2321
|
+
if (!ts17.isTypeReferenceNode(nodeTypeRef)) {
|
|
2745
2322
|
throw new Error(`Expected TypeReferenceNode from reference to ${dirRef.debugName}`);
|
|
2746
2323
|
}
|
|
2747
2324
|
const meta = {
|
|
@@ -2757,7 +2334,7 @@ var Environment = class {
|
|
|
2757
2334
|
const typeParams = this.emitTypeParameters(node);
|
|
2758
2335
|
const typeCtor = generateTypeCtorDeclarationFn(node, meta, nodeTypeRef.typeName, typeParams);
|
|
2759
2336
|
this.typeCtorStatements.push(typeCtor);
|
|
2760
|
-
const fnId =
|
|
2337
|
+
const fnId = ts17.factory.createIdentifier(fnName);
|
|
2761
2338
|
this.typeCtors.set(node, fnId);
|
|
2762
2339
|
return fnId;
|
|
2763
2340
|
}
|
|
@@ -2767,7 +2344,7 @@ var Environment = class {
|
|
|
2767
2344
|
return this.pipeInsts.get(ref.node);
|
|
2768
2345
|
}
|
|
2769
2346
|
const pipeType = this.referenceType(ref);
|
|
2770
|
-
const pipeInstId =
|
|
2347
|
+
const pipeInstId = ts17.factory.createIdentifier(`_pipe${this.nextIds.pipeInst++}`);
|
|
2771
2348
|
this.pipeInstStatements.push(tsDeclareVariable(pipeInstId, pipeType));
|
|
2772
2349
|
this.pipeInsts.set(ref.node, pipeInstId);
|
|
2773
2350
|
return pipeInstId;
|
|
@@ -2778,11 +2355,11 @@ var Environment = class {
|
|
|
2778
2355
|
return translateExpression(ngExpr.expression, this.importManager);
|
|
2779
2356
|
}
|
|
2780
2357
|
canReferenceType(ref) {
|
|
2781
|
-
const result = this.refEmitter.emit(ref, this.contextFile, ImportFlags.NoAliasing | ImportFlags.AllowTypeImports);
|
|
2358
|
+
const result = this.refEmitter.emit(ref, this.contextFile, ImportFlags.NoAliasing | ImportFlags.AllowTypeImports | ImportFlags.AllowRelativeDtsImports);
|
|
2782
2359
|
return result.kind === 0;
|
|
2783
2360
|
}
|
|
2784
2361
|
referenceType(ref) {
|
|
2785
|
-
const ngExpr = this.refEmitter.emit(ref, this.contextFile, ImportFlags.NoAliasing | ImportFlags.AllowTypeImports);
|
|
2362
|
+
const ngExpr = this.refEmitter.emit(ref, this.contextFile, ImportFlags.NoAliasing | ImportFlags.AllowTypeImports | ImportFlags.AllowRelativeDtsImports);
|
|
2786
2363
|
assertSuccessfulReferenceEmit(ngExpr, this.contextFile, "symbol");
|
|
2787
2364
|
return translateType(new ExpressionType(ngExpr.expression), this.importManager);
|
|
2788
2365
|
}
|
|
@@ -2791,7 +2368,7 @@ var Environment = class {
|
|
|
2791
2368
|
return emitter.emit((ref) => this.referenceType(ref));
|
|
2792
2369
|
}
|
|
2793
2370
|
referenceExternalType(moduleName, name, typeParams) {
|
|
2794
|
-
const external = new
|
|
2371
|
+
const external = new ExternalExpr({ moduleName, name });
|
|
2795
2372
|
return translateType(new ExpressionType(external, TypeModifier.None, typeParams), this.importManager);
|
|
2796
2373
|
}
|
|
2797
2374
|
getPreludeStatements() {
|
|
@@ -2804,7 +2381,7 @@ var Environment = class {
|
|
|
2804
2381
|
|
|
2805
2382
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/oob.mjs
|
|
2806
2383
|
import { TmplAstElement as TmplAstElement2 } from "@angular/compiler";
|
|
2807
|
-
import
|
|
2384
|
+
import ts18 from "typescript";
|
|
2808
2385
|
var OutOfBandDiagnosticRecorderImpl = class {
|
|
2809
2386
|
constructor(resolver) {
|
|
2810
2387
|
this.resolver = resolver;
|
|
@@ -2818,7 +2395,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
2818
2395
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
2819
2396
|
const value = ref.value.trim();
|
|
2820
2397
|
const errorMsg = `No directive found with exportAs '${value}'.`;
|
|
2821
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, ref.valueSpan || ref.sourceSpan,
|
|
2398
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, ref.valueSpan || ref.sourceSpan, ts18.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REFERENCE_TARGET), errorMsg));
|
|
2822
2399
|
}
|
|
2823
2400
|
missingPipe(templateId, ast) {
|
|
2824
2401
|
if (this.recordedPipes.has(ast)) {
|
|
@@ -2830,7 +2407,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
2830
2407
|
if (sourceSpan === null) {
|
|
2831
2408
|
throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${ast.name}'.`);
|
|
2832
2409
|
}
|
|
2833
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan,
|
|
2410
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts18.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_PIPE), errorMsg));
|
|
2834
2411
|
this.recordedPipes.add(ast);
|
|
2835
2412
|
}
|
|
2836
2413
|
illegalAssignmentToTemplateVar(templateId, assignment, target) {
|
|
@@ -2841,7 +2418,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
2841
2418
|
if (sourceSpan === null) {
|
|
2842
2419
|
throw new Error(`Assertion failure: no SourceLocation found for property binding.`);
|
|
2843
2420
|
}
|
|
2844
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan,
|
|
2421
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts18.DiagnosticCategory.Error, ngErrorCode(ErrorCode.WRITE_TO_READ_ONLY_VARIABLE), errorMsg, [{
|
|
2845
2422
|
text: `The variable ${assignment.name} is declared here.`,
|
|
2846
2423
|
start: ((_a = target.valueSpan) == null ? void 0 : _a.start.offset) || target.sourceSpan.start.offset,
|
|
2847
2424
|
end: ((_b = target.valueSpan) == null ? void 0 : _b.end.offset) || target.sourceSpan.end.offset,
|
|
@@ -2851,7 +2428,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
2851
2428
|
duplicateTemplateVar(templateId, variable, firstDecl) {
|
|
2852
2429
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
2853
2430
|
const errorMsg = `Cannot redeclare variable '${variable.name}' as it was previously declared elsewhere for the same template.`;
|
|
2854
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, variable.sourceSpan,
|
|
2431
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, variable.sourceSpan, ts18.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DUPLICATE_VARIABLE_DECLARATION), errorMsg, [{
|
|
2855
2432
|
text: `The variable '${firstDecl.name}' was first declared here.`,
|
|
2856
2433
|
start: firstDecl.sourceSpan.start.offset,
|
|
2857
2434
|
end: firstDecl.sourceSpan.end.offset,
|
|
@@ -2890,7 +2467,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
2890
2467
|
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.
|
|
2891
2468
|
|
|
2892
2469
|
Consider enabling the 'strictTemplates' option in your tsconfig.json for better type inference within this template.`;
|
|
2893
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, diagnosticVar.keySpan,
|
|
2470
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, diagnosticVar.keySpan, ts18.DiagnosticCategory.Suggestion, ngErrorCode(ErrorCode.SUGGEST_SUBOPTIMAL_TYPE_INFERENCE), message));
|
|
2894
2471
|
}
|
|
2895
2472
|
splitTwoWayBinding(templateId, input, output, inputConsumer, outputConsumer) {
|
|
2896
2473
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
@@ -2924,7 +2501,7 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
|
|
|
2924
2501
|
sourceFile: outputConsumer.name.getSourceFile()
|
|
2925
2502
|
});
|
|
2926
2503
|
}
|
|
2927
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, input.keySpan,
|
|
2504
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, input.keySpan, ts18.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SPLIT_TWO_WAY_BINDING), errorMsg, relatedMessages));
|
|
2928
2505
|
}
|
|
2929
2506
|
};
|
|
2930
2507
|
function makeInlineDiagnostic(templateId, code, node, messageText, relatedInformation) {
|
|
@@ -2935,7 +2512,7 @@ function makeInlineDiagnostic(templateId, code, node, messageText, relatedInform
|
|
|
2935
2512
|
}
|
|
2936
2513
|
|
|
2937
2514
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/shim.mjs
|
|
2938
|
-
import
|
|
2515
|
+
import ts19 from "typescript";
|
|
2939
2516
|
var TypeCheckShimGenerator = class {
|
|
2940
2517
|
constructor() {
|
|
2941
2518
|
this.extensionPrefix = "ngtypecheck";
|
|
@@ -2945,7 +2522,7 @@ var TypeCheckShimGenerator = class {
|
|
|
2945
2522
|
if (priorShimSf !== null) {
|
|
2946
2523
|
return priorShimSf;
|
|
2947
2524
|
}
|
|
2948
|
-
return
|
|
2525
|
+
return ts19.createSourceFile(genFilePath, "export const USED_FOR_NG_TYPE_CHECKING = true;", ts19.ScriptTarget.Latest, true, ts19.ScriptKind.TS);
|
|
2949
2526
|
}
|
|
2950
2527
|
static shimFor(fileName) {
|
|
2951
2528
|
return absoluteFrom(fileName.replace(/\.tsx?$/, ".ngtypecheck.ts"));
|
|
@@ -2954,16 +2531,16 @@ var TypeCheckShimGenerator = class {
|
|
|
2954
2531
|
|
|
2955
2532
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.mjs
|
|
2956
2533
|
import { BindingPipe, Call as Call2, DYNAMIC_TYPE, ImplicitReceiver as ImplicitReceiver4, PropertyRead as PropertyRead4, PropertyWrite as PropertyWrite3, SafeCall, SafePropertyRead as SafePropertyRead3, ThisReceiver, TmplAstBoundAttribute, TmplAstBoundText, TmplAstElement as TmplAstElement3, TmplAstIcu, TmplAstReference as TmplAstReference3, TmplAstTemplate as TmplAstTemplate2, TmplAstTextAttribute as TmplAstTextAttribute2, TmplAstVariable as TmplAstVariable2 } from "@angular/compiler";
|
|
2957
|
-
import
|
|
2534
|
+
import ts22 from "typescript";
|
|
2958
2535
|
|
|
2959
2536
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/diagnostics.mjs
|
|
2960
2537
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan3 } from "@angular/compiler";
|
|
2961
|
-
import
|
|
2538
|
+
import ts20 from "typescript";
|
|
2962
2539
|
function wrapForDiagnostics(expr) {
|
|
2963
|
-
return
|
|
2540
|
+
return ts20.factory.createParenthesizedExpression(expr);
|
|
2964
2541
|
}
|
|
2965
2542
|
function wrapForTypeChecker(expr) {
|
|
2966
|
-
return
|
|
2543
|
+
return ts20.factory.createParenthesizedExpression(expr);
|
|
2967
2544
|
}
|
|
2968
2545
|
function addParseSpanInfo(node, span) {
|
|
2969
2546
|
let commentText;
|
|
@@ -2972,10 +2549,10 @@ function addParseSpanInfo(node, span) {
|
|
|
2972
2549
|
} else {
|
|
2973
2550
|
commentText = `${span.start.offset},${span.end.offset}`;
|
|
2974
2551
|
}
|
|
2975
|
-
|
|
2552
|
+
ts20.addSyntheticTrailingComment(node, ts20.SyntaxKind.MultiLineCommentTrivia, commentText, false);
|
|
2976
2553
|
}
|
|
2977
2554
|
function addTemplateId(tcb, id) {
|
|
2978
|
-
|
|
2555
|
+
ts20.addSyntheticLeadingComment(tcb, ts20.SyntaxKind.MultiLineCommentTrivia, id, true);
|
|
2979
2556
|
}
|
|
2980
2557
|
function shouldReportDiagnostic(diagnostic) {
|
|
2981
2558
|
const { code } = diagnostic;
|
|
@@ -3004,32 +2581,32 @@ function translateDiagnostic(diagnostic, resolver) {
|
|
|
3004
2581
|
|
|
3005
2582
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/expression.mjs
|
|
3006
2583
|
import { ASTWithSource as ASTWithSource2, Call, EmptyExpr as EmptyExpr2, PropertyRead as PropertyRead3, SafeKeyedRead, SafePropertyRead as SafePropertyRead2 } from "@angular/compiler";
|
|
3007
|
-
import
|
|
3008
|
-
var NULL_AS_ANY =
|
|
3009
|
-
var UNDEFINED =
|
|
2584
|
+
import ts21 from "typescript";
|
|
2585
|
+
var NULL_AS_ANY = ts21.factory.createAsExpression(ts21.factory.createNull(), ts21.factory.createKeywordTypeNode(ts21.SyntaxKind.AnyKeyword));
|
|
2586
|
+
var UNDEFINED = ts21.factory.createIdentifier("undefined");
|
|
3010
2587
|
var UNARY_OPS = /* @__PURE__ */ new Map([
|
|
3011
|
-
["+",
|
|
3012
|
-
["-",
|
|
2588
|
+
["+", ts21.SyntaxKind.PlusToken],
|
|
2589
|
+
["-", ts21.SyntaxKind.MinusToken]
|
|
3013
2590
|
]);
|
|
3014
2591
|
var BINARY_OPS = /* @__PURE__ */ new Map([
|
|
3015
|
-
["+",
|
|
3016
|
-
["-",
|
|
3017
|
-
["<",
|
|
3018
|
-
[">",
|
|
3019
|
-
["<=",
|
|
3020
|
-
[">=",
|
|
3021
|
-
["==",
|
|
3022
|
-
["===",
|
|
3023
|
-
["*",
|
|
3024
|
-
["/",
|
|
3025
|
-
["%",
|
|
3026
|
-
["!=",
|
|
3027
|
-
["!==",
|
|
3028
|
-
["||",
|
|
3029
|
-
["&&",
|
|
3030
|
-
["&",
|
|
3031
|
-
["|",
|
|
3032
|
-
["??",
|
|
2592
|
+
["+", ts21.SyntaxKind.PlusToken],
|
|
2593
|
+
["-", ts21.SyntaxKind.MinusToken],
|
|
2594
|
+
["<", ts21.SyntaxKind.LessThanToken],
|
|
2595
|
+
[">", ts21.SyntaxKind.GreaterThanToken],
|
|
2596
|
+
["<=", ts21.SyntaxKind.LessThanEqualsToken],
|
|
2597
|
+
[">=", ts21.SyntaxKind.GreaterThanEqualsToken],
|
|
2598
|
+
["==", ts21.SyntaxKind.EqualsEqualsToken],
|
|
2599
|
+
["===", ts21.SyntaxKind.EqualsEqualsEqualsToken],
|
|
2600
|
+
["*", ts21.SyntaxKind.AsteriskToken],
|
|
2601
|
+
["/", ts21.SyntaxKind.SlashToken],
|
|
2602
|
+
["%", ts21.SyntaxKind.PercentToken],
|
|
2603
|
+
["!=", ts21.SyntaxKind.ExclamationEqualsToken],
|
|
2604
|
+
["!==", ts21.SyntaxKind.ExclamationEqualsEqualsToken],
|
|
2605
|
+
["||", ts21.SyntaxKind.BarBarToken],
|
|
2606
|
+
["&&", ts21.SyntaxKind.AmpersandAmpersandToken],
|
|
2607
|
+
["&", ts21.SyntaxKind.AmpersandToken],
|
|
2608
|
+
["|", ts21.SyntaxKind.BarToken],
|
|
2609
|
+
["??", ts21.SyntaxKind.QuestionQuestionToken]
|
|
3033
2610
|
]);
|
|
3034
2611
|
function astToTypescript(ast, maybeResolve, config) {
|
|
3035
2612
|
const translator = new AstTranslator(maybeResolve, config);
|
|
@@ -3045,7 +2622,7 @@ var AstTranslator = class {
|
|
|
3045
2622
|
ast = ast.ast;
|
|
3046
2623
|
}
|
|
3047
2624
|
if (ast instanceof EmptyExpr2) {
|
|
3048
|
-
const res =
|
|
2625
|
+
const res = ts21.factory.createIdentifier("undefined");
|
|
3049
2626
|
addParseSpanInfo(res, ast.sourceSpan);
|
|
3050
2627
|
return res;
|
|
3051
2628
|
}
|
|
@@ -3061,7 +2638,7 @@ var AstTranslator = class {
|
|
|
3061
2638
|
if (op === void 0) {
|
|
3062
2639
|
throw new Error(`Unsupported Unary.operator: ${ast.operator}`);
|
|
3063
2640
|
}
|
|
3064
|
-
const node = wrapForDiagnostics(
|
|
2641
|
+
const node = wrapForDiagnostics(ts21.factory.createPrefixUnaryExpression(op, expr));
|
|
3065
2642
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3066
2643
|
return node;
|
|
3067
2644
|
}
|
|
@@ -3072,13 +2649,13 @@ var AstTranslator = class {
|
|
|
3072
2649
|
if (op === void 0) {
|
|
3073
2650
|
throw new Error(`Unsupported Binary.operation: ${ast.operation}`);
|
|
3074
2651
|
}
|
|
3075
|
-
const node =
|
|
2652
|
+
const node = ts21.factory.createBinaryExpression(lhs, op, rhs);
|
|
3076
2653
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3077
2654
|
return node;
|
|
3078
2655
|
}
|
|
3079
2656
|
visitChain(ast) {
|
|
3080
2657
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
3081
|
-
const node = wrapForDiagnostics(
|
|
2658
|
+
const node = wrapForDiagnostics(ts21.factory.createCommaListExpression(elements));
|
|
3082
2659
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3083
2660
|
return node;
|
|
3084
2661
|
}
|
|
@@ -3086,7 +2663,7 @@ var AstTranslator = class {
|
|
|
3086
2663
|
const condExpr = this.translate(ast.condition);
|
|
3087
2664
|
const trueExpr = this.translate(ast.trueExp);
|
|
3088
2665
|
const falseExpr = wrapForTypeChecker(this.translate(ast.falseExp));
|
|
3089
|
-
const node =
|
|
2666
|
+
const node = ts21.factory.createParenthesizedExpression(ts21.factory.createConditionalExpression(condExpr, void 0, trueExpr, void 0, falseExpr));
|
|
3090
2667
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3091
2668
|
return node;
|
|
3092
2669
|
}
|
|
@@ -3097,26 +2674,26 @@ var AstTranslator = class {
|
|
|
3097
2674
|
throw new Error("Method not implemented.");
|
|
3098
2675
|
}
|
|
3099
2676
|
visitInterpolation(ast) {
|
|
3100
|
-
return ast.expressions.reduce((lhs, ast2) =>
|
|
2677
|
+
return ast.expressions.reduce((lhs, ast2) => ts21.factory.createBinaryExpression(lhs, ts21.SyntaxKind.PlusToken, wrapForTypeChecker(this.translate(ast2))), ts21.factory.createStringLiteral(""));
|
|
3101
2678
|
}
|
|
3102
2679
|
visitKeyedRead(ast) {
|
|
3103
2680
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3104
2681
|
const key = this.translate(ast.key);
|
|
3105
|
-
const node =
|
|
2682
|
+
const node = ts21.factory.createElementAccessExpression(receiver, key);
|
|
3106
2683
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3107
2684
|
return node;
|
|
3108
2685
|
}
|
|
3109
2686
|
visitKeyedWrite(ast) {
|
|
3110
2687
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3111
|
-
const left =
|
|
2688
|
+
const left = ts21.factory.createElementAccessExpression(receiver, this.translate(ast.key));
|
|
3112
2689
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
3113
|
-
const node = wrapForDiagnostics(
|
|
2690
|
+
const node = wrapForDiagnostics(ts21.factory.createBinaryExpression(left, ts21.SyntaxKind.EqualsToken, right));
|
|
3114
2691
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3115
2692
|
return node;
|
|
3116
2693
|
}
|
|
3117
2694
|
visitLiteralArray(ast) {
|
|
3118
2695
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
3119
|
-
const literal =
|
|
2696
|
+
const literal = ts21.factory.createArrayLiteralExpression(elements);
|
|
3120
2697
|
const node = this.config.strictLiteralTypes ? literal : tsCastToAny(literal);
|
|
3121
2698
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3122
2699
|
return node;
|
|
@@ -3124,9 +2701,9 @@ var AstTranslator = class {
|
|
|
3124
2701
|
visitLiteralMap(ast) {
|
|
3125
2702
|
const properties = ast.keys.map(({ key }, idx) => {
|
|
3126
2703
|
const value = this.translate(ast.values[idx]);
|
|
3127
|
-
return
|
|
2704
|
+
return ts21.factory.createPropertyAssignment(ts21.factory.createStringLiteral(key), value);
|
|
3128
2705
|
});
|
|
3129
|
-
const literal =
|
|
2706
|
+
const literal = ts21.factory.createObjectLiteralExpression(properties, true);
|
|
3130
2707
|
const node = this.config.strictLiteralTypes ? literal : tsCastToAny(literal);
|
|
3131
2708
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3132
2709
|
return node;
|
|
@@ -3134,18 +2711,24 @@ var AstTranslator = class {
|
|
|
3134
2711
|
visitLiteralPrimitive(ast) {
|
|
3135
2712
|
let node;
|
|
3136
2713
|
if (ast.value === void 0) {
|
|
3137
|
-
node =
|
|
2714
|
+
node = ts21.factory.createIdentifier("undefined");
|
|
3138
2715
|
} else if (ast.value === null) {
|
|
3139
|
-
node =
|
|
2716
|
+
node = ts21.factory.createNull();
|
|
2717
|
+
} else if (typeof ast.value === "string") {
|
|
2718
|
+
node = ts21.factory.createStringLiteral(ast.value);
|
|
2719
|
+
} else if (typeof ast.value === "number") {
|
|
2720
|
+
node = ts21.factory.createNumericLiteral(ast.value);
|
|
2721
|
+
} else if (typeof ast.value === "boolean") {
|
|
2722
|
+
node = ast.value ? ts21.factory.createTrue() : ts21.factory.createFalse();
|
|
3140
2723
|
} else {
|
|
3141
|
-
|
|
2724
|
+
throw Error(`Unsupported AST value of type ${typeof ast.value}`);
|
|
3142
2725
|
}
|
|
3143
2726
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3144
2727
|
return node;
|
|
3145
2728
|
}
|
|
3146
2729
|
visitNonNullAssert(ast) {
|
|
3147
2730
|
const expr = wrapForDiagnostics(this.translate(ast.expression));
|
|
3148
|
-
const node =
|
|
2731
|
+
const node = ts21.factory.createNonNullExpression(expr);
|
|
3149
2732
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3150
2733
|
return node;
|
|
3151
2734
|
}
|
|
@@ -3154,13 +2737,13 @@ var AstTranslator = class {
|
|
|
3154
2737
|
}
|
|
3155
2738
|
visitPrefixNot(ast) {
|
|
3156
2739
|
const expression = wrapForDiagnostics(this.translate(ast.expression));
|
|
3157
|
-
const node =
|
|
2740
|
+
const node = ts21.factory.createLogicalNot(expression);
|
|
3158
2741
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3159
2742
|
return node;
|
|
3160
2743
|
}
|
|
3161
2744
|
visitPropertyRead(ast) {
|
|
3162
2745
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3163
|
-
const name =
|
|
2746
|
+
const name = ts21.factory.createPropertyAccessExpression(receiver, ast.name);
|
|
3164
2747
|
addParseSpanInfo(name, ast.nameSpan);
|
|
3165
2748
|
const node = wrapForDiagnostics(name);
|
|
3166
2749
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
@@ -3168,29 +2751,26 @@ var AstTranslator = class {
|
|
|
3168
2751
|
}
|
|
3169
2752
|
visitPropertyWrite(ast) {
|
|
3170
2753
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3171
|
-
const left =
|
|
2754
|
+
const left = ts21.factory.createPropertyAccessExpression(receiver, ast.name);
|
|
3172
2755
|
addParseSpanInfo(left, ast.nameSpan);
|
|
3173
2756
|
const leftWithPath = wrapForDiagnostics(left);
|
|
3174
2757
|
addParseSpanInfo(leftWithPath, ast.sourceSpan);
|
|
3175
2758
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
3176
|
-
const node = wrapForDiagnostics(
|
|
2759
|
+
const node = wrapForDiagnostics(ts21.factory.createBinaryExpression(leftWithPath, ts21.SyntaxKind.EqualsToken, right));
|
|
3177
2760
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3178
2761
|
return node;
|
|
3179
2762
|
}
|
|
3180
|
-
visitQuote(ast) {
|
|
3181
|
-
return NULL_AS_ANY;
|
|
3182
|
-
}
|
|
3183
2763
|
visitSafePropertyRead(ast) {
|
|
3184
2764
|
let node;
|
|
3185
2765
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3186
2766
|
if (this.config.strictSafeNavigationTypes) {
|
|
3187
|
-
const expr =
|
|
2767
|
+
const expr = ts21.factory.createPropertyAccessExpression(ts21.factory.createNonNullExpression(receiver), ast.name);
|
|
3188
2768
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
3189
|
-
node =
|
|
2769
|
+
node = ts21.factory.createParenthesizedExpression(ts21.factory.createConditionalExpression(NULL_AS_ANY, void 0, expr, void 0, UNDEFINED));
|
|
3190
2770
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3191
|
-
node =
|
|
2771
|
+
node = ts21.factory.createPropertyAccessExpression(tsCastToAny(receiver), ast.name);
|
|
3192
2772
|
} else {
|
|
3193
|
-
const expr =
|
|
2773
|
+
const expr = ts21.factory.createPropertyAccessExpression(ts21.factory.createNonNullExpression(receiver), ast.name);
|
|
3194
2774
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
3195
2775
|
node = tsCastToAny(expr);
|
|
3196
2776
|
}
|
|
@@ -3202,13 +2782,13 @@ var AstTranslator = class {
|
|
|
3202
2782
|
const key = this.translate(ast.key);
|
|
3203
2783
|
let node;
|
|
3204
2784
|
if (this.config.strictSafeNavigationTypes) {
|
|
3205
|
-
const expr =
|
|
2785
|
+
const expr = ts21.factory.createElementAccessExpression(ts21.factory.createNonNullExpression(receiver), key);
|
|
3206
2786
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
3207
|
-
node =
|
|
2787
|
+
node = ts21.factory.createParenthesizedExpression(ts21.factory.createConditionalExpression(NULL_AS_ANY, void 0, expr, void 0, UNDEFINED));
|
|
3208
2788
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3209
|
-
node =
|
|
2789
|
+
node = ts21.factory.createElementAccessExpression(tsCastToAny(receiver), key);
|
|
3210
2790
|
} else {
|
|
3211
|
-
const expr =
|
|
2791
|
+
const expr = ts21.factory.createElementAccessExpression(ts21.factory.createNonNullExpression(receiver), key);
|
|
3212
2792
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
3213
2793
|
node = tsCastToAny(expr);
|
|
3214
2794
|
}
|
|
@@ -3225,7 +2805,7 @@ var AstTranslator = class {
|
|
|
3225
2805
|
expr = resolved;
|
|
3226
2806
|
} else {
|
|
3227
2807
|
const propertyReceiver = wrapForDiagnostics(this.translate(receiver.receiver));
|
|
3228
|
-
expr =
|
|
2808
|
+
expr = ts21.factory.createPropertyAccessExpression(propertyReceiver, receiver.name);
|
|
3229
2809
|
addParseSpanInfo(expr, receiver.nameSpan);
|
|
3230
2810
|
}
|
|
3231
2811
|
} else {
|
|
@@ -3235,7 +2815,7 @@ var AstTranslator = class {
|
|
|
3235
2815
|
if (ast.receiver instanceof SafePropertyRead2 || ast.receiver instanceof SafeKeyedRead) {
|
|
3236
2816
|
node = this.convertToSafeCall(ast, expr, args);
|
|
3237
2817
|
} else {
|
|
3238
|
-
node =
|
|
2818
|
+
node = ts21.factory.createCallExpression(expr, void 0, args);
|
|
3239
2819
|
}
|
|
3240
2820
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3241
2821
|
return node;
|
|
@@ -3249,13 +2829,13 @@ var AstTranslator = class {
|
|
|
3249
2829
|
}
|
|
3250
2830
|
convertToSafeCall(ast, expr, args) {
|
|
3251
2831
|
if (this.config.strictSafeNavigationTypes) {
|
|
3252
|
-
const call =
|
|
3253
|
-
return
|
|
2832
|
+
const call = ts21.factory.createCallExpression(ts21.factory.createNonNullExpression(expr), void 0, args);
|
|
2833
|
+
return ts21.factory.createParenthesizedExpression(ts21.factory.createConditionalExpression(NULL_AS_ANY, void 0, call, void 0, UNDEFINED));
|
|
3254
2834
|
}
|
|
3255
2835
|
if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3256
|
-
return
|
|
2836
|
+
return ts21.factory.createCallExpression(tsCastToAny(expr), void 0, args);
|
|
3257
2837
|
}
|
|
3258
|
-
return tsCastToAny(
|
|
2838
|
+
return tsCastToAny(ts21.factory.createCallExpression(ts21.factory.createNonNullExpression(expr), void 0, args));
|
|
3259
2839
|
}
|
|
3260
2840
|
};
|
|
3261
2841
|
var VeSafeLhsInferenceBugDetector = class {
|
|
@@ -3320,9 +2900,6 @@ var VeSafeLhsInferenceBugDetector = class {
|
|
|
3320
2900
|
visitPropertyWrite(ast) {
|
|
3321
2901
|
return false;
|
|
3322
2902
|
}
|
|
3323
|
-
visitQuote(ast) {
|
|
3324
|
-
return false;
|
|
3325
|
-
}
|
|
3326
2903
|
visitSafePropertyRead(ast) {
|
|
3327
2904
|
return false;
|
|
3328
2905
|
}
|
|
@@ -3367,7 +2944,7 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
|
|
|
3367
2944
|
const tcb = new Context(env, domSchemaChecker, oobRecorder, meta.id, meta.boundTarget, meta.pipes, meta.schemas);
|
|
3368
2945
|
const scope = Scope.forNodes(tcb, null, tcb.boundTarget.target.template, null);
|
|
3369
2946
|
const ctxRawType = env.referenceType(ref);
|
|
3370
|
-
if (!
|
|
2947
|
+
if (!ts22.isTypeReferenceNode(ctxRawType)) {
|
|
3371
2948
|
throw new Error(`Expected TypeReferenceNode when referencing the ctx param for ${ref.debugName}`);
|
|
3372
2949
|
}
|
|
3373
2950
|
let typeParameters = void 0;
|
|
@@ -3379,25 +2956,25 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
|
|
|
3379
2956
|
switch (genericContextBehavior) {
|
|
3380
2957
|
case TcbGenericContextBehavior.UseEmitter:
|
|
3381
2958
|
typeParameters = new TypeParameterEmitter(ref.node.typeParameters, env.reflector).emit((typeRef) => env.referenceType(typeRef));
|
|
3382
|
-
typeArguments = typeParameters.map((param) =>
|
|
2959
|
+
typeArguments = typeParameters.map((param) => ts22.factory.createTypeReferenceNode(param.name));
|
|
3383
2960
|
break;
|
|
3384
2961
|
case TcbGenericContextBehavior.CopyClassNodes:
|
|
3385
2962
|
typeParameters = [...ref.node.typeParameters];
|
|
3386
|
-
typeArguments = typeParameters.map((param) =>
|
|
2963
|
+
typeArguments = typeParameters.map((param) => ts22.factory.createTypeReferenceNode(param.name));
|
|
3387
2964
|
break;
|
|
3388
2965
|
case TcbGenericContextBehavior.FallbackToAny:
|
|
3389
|
-
typeArguments = ref.node.typeParameters.map(() =>
|
|
2966
|
+
typeArguments = ref.node.typeParameters.map(() => ts22.factory.createKeywordTypeNode(ts22.SyntaxKind.AnyKeyword));
|
|
3390
2967
|
break;
|
|
3391
2968
|
}
|
|
3392
2969
|
}
|
|
3393
2970
|
const paramList = [tcbCtxParam(ref.node, ctxRawType.typeName, typeArguments)];
|
|
3394
2971
|
const scopeStatements = scope.render();
|
|
3395
|
-
const innerBody =
|
|
2972
|
+
const innerBody = ts22.factory.createBlock([
|
|
3396
2973
|
...env.getPreludeStatements(),
|
|
3397
2974
|
...scopeStatements
|
|
3398
2975
|
]);
|
|
3399
|
-
const body =
|
|
3400
|
-
const fnDecl =
|
|
2976
|
+
const body = ts22.factory.createBlock([ts22.factory.createIfStatement(ts22.factory.createTrue(), innerBody, void 0)]);
|
|
2977
|
+
const fnDecl = ts22.factory.createFunctionDeclaration(void 0, void 0, void 0, name, env.config.useContextGenericType ? typeParameters : void 0, paramList, void 0, body);
|
|
3401
2978
|
addTemplateId(fnDecl, meta.id);
|
|
3402
2979
|
return fnDecl;
|
|
3403
2980
|
}
|
|
@@ -3438,7 +3015,7 @@ var TcbVariableOp = class extends TcbOp {
|
|
|
3438
3015
|
execute() {
|
|
3439
3016
|
const ctx = this.scope.resolve(this.template);
|
|
3440
3017
|
const id = this.tcb.allocateId();
|
|
3441
|
-
const initializer =
|
|
3018
|
+
const initializer = ts22.factory.createPropertyAccessExpression(ctx, this.variable.value || "$implicit");
|
|
3442
3019
|
addParseSpanInfo(id, this.variable.keySpan);
|
|
3443
3020
|
let variable;
|
|
3444
3021
|
if (this.variable.valueSpan !== void 0) {
|
|
@@ -3461,7 +3038,7 @@ var TcbTemplateContextOp = class extends TcbOp {
|
|
|
3461
3038
|
}
|
|
3462
3039
|
execute() {
|
|
3463
3040
|
const ctx = this.tcb.allocateId();
|
|
3464
|
-
const type =
|
|
3041
|
+
const type = ts22.factory.createKeywordTypeNode(ts22.SyntaxKind.AnyKeyword);
|
|
3465
3042
|
this.scope.addStatement(tsDeclareVariable(ctx, type));
|
|
3466
3043
|
return ctx;
|
|
3467
3044
|
}
|
|
@@ -3514,16 +3091,16 @@ var TcbTemplateBodyOp = class extends TcbOp {
|
|
|
3514
3091
|
}
|
|
3515
3092
|
let guard = null;
|
|
3516
3093
|
if (directiveGuards.length > 0) {
|
|
3517
|
-
guard = directiveGuards.reduce((expr, dirGuard) =>
|
|
3094
|
+
guard = directiveGuards.reduce((expr, dirGuard) => ts22.factory.createBinaryExpression(expr, ts22.SyntaxKind.AmpersandAmpersandToken, dirGuard), directiveGuards.pop());
|
|
3518
3095
|
}
|
|
3519
3096
|
const tmplScope = Scope.forNodes(this.tcb, this.scope, this.template, guard);
|
|
3520
3097
|
const statements = tmplScope.render();
|
|
3521
3098
|
if (statements.length === 0) {
|
|
3522
3099
|
return null;
|
|
3523
3100
|
}
|
|
3524
|
-
let tmplBlock =
|
|
3101
|
+
let tmplBlock = ts22.factory.createBlock(statements);
|
|
3525
3102
|
if (guard !== null) {
|
|
3526
|
-
tmplBlock =
|
|
3103
|
+
tmplBlock = ts22.factory.createIfStatement(guard, tmplBlock);
|
|
3527
3104
|
}
|
|
3528
3105
|
this.scope.addStatement(tmplBlock);
|
|
3529
3106
|
return null;
|
|
@@ -3541,7 +3118,7 @@ var TcbTextInterpolationOp = class extends TcbOp {
|
|
|
3541
3118
|
}
|
|
3542
3119
|
execute() {
|
|
3543
3120
|
const expr = tcbExpression(this.binding.value, this.tcb, this.scope);
|
|
3544
|
-
this.scope.addStatement(
|
|
3121
|
+
this.scope.addStatement(ts22.factory.createExpressionStatement(expr));
|
|
3545
3122
|
return null;
|
|
3546
3123
|
}
|
|
3547
3124
|
};
|
|
@@ -3563,11 +3140,11 @@ var TcbDirectiveTypeOpBase = class extends TcbOp {
|
|
|
3563
3140
|
if (this.dir.isGeneric === false || dirRef.node.typeParameters === void 0) {
|
|
3564
3141
|
type = rawType;
|
|
3565
3142
|
} else {
|
|
3566
|
-
if (!
|
|
3143
|
+
if (!ts22.isTypeReferenceNode(rawType)) {
|
|
3567
3144
|
throw new Error(`Expected TypeReferenceNode when referencing the type for ${this.dir.ref.debugName}`);
|
|
3568
3145
|
}
|
|
3569
|
-
const typeArguments = dirRef.node.typeParameters.map(() =>
|
|
3570
|
-
type =
|
|
3146
|
+
const typeArguments = dirRef.node.typeParameters.map(() => ts22.factory.createKeywordTypeNode(ts22.SyntaxKind.AnyKeyword));
|
|
3147
|
+
type = ts22.factory.createTypeReferenceNode(rawType.typeName, typeArguments);
|
|
3571
3148
|
}
|
|
3572
3149
|
const id = this.tcb.allocateId();
|
|
3573
3150
|
addExpressionIdentifier(type, ExpressionIdentifier.DIRECTIVE);
|
|
@@ -3608,11 +3185,11 @@ var TcbReferenceOp = class extends TcbOp {
|
|
|
3608
3185
|
const id = this.tcb.allocateId();
|
|
3609
3186
|
let initializer = this.target instanceof TmplAstTemplate2 || this.target instanceof TmplAstElement3 ? this.scope.resolve(this.target) : this.scope.resolve(this.host, this.target);
|
|
3610
3187
|
if (this.target instanceof TmplAstElement3 && !this.tcb.env.config.checkTypeOfDomReferences || !this.tcb.env.config.checkTypeOfNonDomReferences) {
|
|
3611
|
-
initializer =
|
|
3188
|
+
initializer = ts22.factory.createAsExpression(initializer, ts22.factory.createKeywordTypeNode(ts22.SyntaxKind.AnyKeyword));
|
|
3612
3189
|
} else if (this.target instanceof TmplAstTemplate2) {
|
|
3613
|
-
initializer =
|
|
3614
|
-
initializer =
|
|
3615
|
-
initializer =
|
|
3190
|
+
initializer = ts22.factory.createAsExpression(initializer, ts22.factory.createKeywordTypeNode(ts22.SyntaxKind.AnyKeyword));
|
|
3191
|
+
initializer = ts22.factory.createAsExpression(initializer, this.tcb.env.referenceExternalType("@angular/core", "TemplateRef", [DYNAMIC_TYPE]));
|
|
3192
|
+
initializer = ts22.factory.createParenthesizedExpression(initializer);
|
|
3616
3193
|
}
|
|
3617
3194
|
addParseSpanInfo(initializer, this.node.sourceSpan);
|
|
3618
3195
|
addParseSpanInfo(id, this.node.keySpan);
|
|
@@ -3702,7 +3279,7 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
3702
3279
|
let target;
|
|
3703
3280
|
if (this.dir.coercedInputFields.has(fieldName)) {
|
|
3704
3281
|
const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
|
|
3705
|
-
if (!
|
|
3282
|
+
if (!ts22.isTypeReferenceNode(dirTypeRef)) {
|
|
3706
3283
|
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
3707
3284
|
}
|
|
3708
3285
|
const id = this.tcb.allocateId();
|
|
@@ -3717,10 +3294,10 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
3717
3294
|
}
|
|
3718
3295
|
const id = this.tcb.allocateId();
|
|
3719
3296
|
const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
|
|
3720
|
-
if (!
|
|
3297
|
+
if (!ts22.isTypeReferenceNode(dirTypeRef)) {
|
|
3721
3298
|
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
3722
3299
|
}
|
|
3723
|
-
const type =
|
|
3300
|
+
const type = ts22.factory.createIndexedAccessTypeNode(ts22.factory.createTypeQueryNode(dirId), ts22.factory.createLiteralTypeNode(ts22.factory.createStringLiteral(fieldName)));
|
|
3724
3301
|
const temp = tsDeclareVariable(id, type);
|
|
3725
3302
|
this.scope.addStatement(temp);
|
|
3726
3303
|
target = id;
|
|
@@ -3728,18 +3305,18 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
3728
3305
|
if (dirId === null) {
|
|
3729
3306
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
3730
3307
|
}
|
|
3731
|
-
target = this.dir.stringLiteralInputFields.has(fieldName) ?
|
|
3308
|
+
target = this.dir.stringLiteralInputFields.has(fieldName) ? ts22.factory.createElementAccessExpression(dirId, ts22.factory.createStringLiteral(fieldName)) : ts22.factory.createPropertyAccessExpression(dirId, ts22.factory.createIdentifier(fieldName));
|
|
3732
3309
|
}
|
|
3733
3310
|
if (input.attribute.keySpan !== void 0) {
|
|
3734
3311
|
addParseSpanInfo(target, input.attribute.keySpan);
|
|
3735
3312
|
}
|
|
3736
|
-
assignment =
|
|
3313
|
+
assignment = ts22.factory.createBinaryExpression(target, ts22.SyntaxKind.EqualsToken, assignment);
|
|
3737
3314
|
}
|
|
3738
3315
|
addParseSpanInfo(assignment, input.attribute.sourceSpan);
|
|
3739
3316
|
if (!this.tcb.env.config.checkTypeOfAttributes && input.attribute instanceof TmplAstTextAttribute2) {
|
|
3740
3317
|
markIgnoreDiagnostics(assignment);
|
|
3741
3318
|
}
|
|
3742
|
-
this.scope.addStatement(
|
|
3319
|
+
this.scope.addStatement(ts22.factory.createExpressionStatement(assignment));
|
|
3743
3320
|
}
|
|
3744
3321
|
return null;
|
|
3745
3322
|
}
|
|
@@ -3758,7 +3335,7 @@ var TcbDirectiveCtorCircularFallbackOp = class extends TcbOp {
|
|
|
3758
3335
|
execute() {
|
|
3759
3336
|
const id = this.tcb.allocateId();
|
|
3760
3337
|
const typeCtor = this.tcb.env.typeCtorFor(this.dir);
|
|
3761
|
-
const circularPlaceholder =
|
|
3338
|
+
const circularPlaceholder = ts22.factory.createCallExpression(typeCtor, void 0, [ts22.factory.createNonNullExpression(ts22.factory.createNull())]);
|
|
3762
3339
|
this.scope.addStatement(tsCreateVariable(id, circularPlaceholder));
|
|
3763
3340
|
return id;
|
|
3764
3341
|
}
|
|
@@ -3824,15 +3401,15 @@ var TcbUnclaimedInputsOp = class extends TcbOp {
|
|
|
3824
3401
|
elId = this.scope.resolve(this.element);
|
|
3825
3402
|
}
|
|
3826
3403
|
const propertyName = ATTR_TO_PROP[binding.name] || binding.name;
|
|
3827
|
-
const prop =
|
|
3828
|
-
const stmt =
|
|
3404
|
+
const prop = ts22.factory.createElementAccessExpression(elId, ts22.factory.createStringLiteral(propertyName));
|
|
3405
|
+
const stmt = ts22.factory.createBinaryExpression(prop, ts22.SyntaxKind.EqualsToken, wrapForDiagnostics(expr));
|
|
3829
3406
|
addParseSpanInfo(stmt, binding.sourceSpan);
|
|
3830
|
-
this.scope.addStatement(
|
|
3407
|
+
this.scope.addStatement(ts22.factory.createExpressionStatement(stmt));
|
|
3831
3408
|
} else {
|
|
3832
|
-
this.scope.addStatement(
|
|
3409
|
+
this.scope.addStatement(ts22.factory.createExpressionStatement(expr));
|
|
3833
3410
|
}
|
|
3834
3411
|
} else {
|
|
3835
|
-
this.scope.addStatement(
|
|
3412
|
+
this.scope.addStatement(ts22.factory.createExpressionStatement(expr));
|
|
3836
3413
|
}
|
|
3837
3414
|
}
|
|
3838
3415
|
return null;
|
|
@@ -3864,18 +3441,18 @@ var TcbDirectiveOutputsOp = class extends TcbOp {
|
|
|
3864
3441
|
if (dirId === null) {
|
|
3865
3442
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
3866
3443
|
}
|
|
3867
|
-
const outputField =
|
|
3444
|
+
const outputField = ts22.factory.createElementAccessExpression(dirId, ts22.factory.createStringLiteral(field));
|
|
3868
3445
|
addParseSpanInfo(outputField, output.keySpan);
|
|
3869
3446
|
if (this.tcb.env.config.checkTypeOfOutputEvents) {
|
|
3870
3447
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
3871
|
-
const subscribeFn =
|
|
3872
|
-
const call =
|
|
3448
|
+
const subscribeFn = ts22.factory.createPropertyAccessExpression(outputField, "subscribe");
|
|
3449
|
+
const call = ts22.factory.createCallExpression(subscribeFn, void 0, [handler]);
|
|
3873
3450
|
addParseSpanInfo(call, output.sourceSpan);
|
|
3874
|
-
this.scope.addStatement(
|
|
3451
|
+
this.scope.addStatement(ts22.factory.createExpressionStatement(call));
|
|
3875
3452
|
} else {
|
|
3876
|
-
this.scope.addStatement(
|
|
3453
|
+
this.scope.addStatement(ts22.factory.createExpressionStatement(outputField));
|
|
3877
3454
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
3878
|
-
this.scope.addStatement(
|
|
3455
|
+
this.scope.addStatement(ts22.factory.createExpressionStatement(handler));
|
|
3879
3456
|
}
|
|
3880
3457
|
ExpressionSemanticVisitor.visit(output.handler, this.tcb.id, this.tcb.boundTarget, this.tcb.oobRecorder);
|
|
3881
3458
|
}
|
|
@@ -3908,20 +3485,20 @@ var TcbUnclaimedOutputsOp = class extends TcbOp {
|
|
|
3908
3485
|
if (output.type === 1) {
|
|
3909
3486
|
const eventType = this.tcb.env.config.checkTypeOfAnimationEvents ? this.tcb.env.referenceExternalType("@angular/animations", "AnimationEvent") : 1;
|
|
3910
3487
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, eventType);
|
|
3911
|
-
this.scope.addStatement(
|
|
3488
|
+
this.scope.addStatement(ts22.factory.createExpressionStatement(handler));
|
|
3912
3489
|
} else if (this.tcb.env.config.checkTypeOfDomEvents) {
|
|
3913
3490
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
3914
3491
|
if (elId === null) {
|
|
3915
3492
|
elId = this.scope.resolve(this.element);
|
|
3916
3493
|
}
|
|
3917
|
-
const propertyAccess =
|
|
3494
|
+
const propertyAccess = ts22.factory.createPropertyAccessExpression(elId, "addEventListener");
|
|
3918
3495
|
addParseSpanInfo(propertyAccess, output.keySpan);
|
|
3919
|
-
const call =
|
|
3496
|
+
const call = ts22.factory.createCallExpression(propertyAccess, void 0, [ts22.factory.createStringLiteral(output.name), handler]);
|
|
3920
3497
|
addParseSpanInfo(call, output.sourceSpan);
|
|
3921
|
-
this.scope.addStatement(
|
|
3498
|
+
this.scope.addStatement(ts22.factory.createExpressionStatement(call));
|
|
3922
3499
|
} else {
|
|
3923
3500
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
3924
|
-
this.scope.addStatement(
|
|
3501
|
+
this.scope.addStatement(ts22.factory.createExpressionStatement(handler));
|
|
3925
3502
|
}
|
|
3926
3503
|
ExpressionSemanticVisitor.visit(output.handler, this.tcb.id, this.tcb.boundTarget, this.tcb.oobRecorder);
|
|
3927
3504
|
}
|
|
@@ -3935,15 +3512,15 @@ var TcbComponentContextCompletionOp = class extends TcbOp {
|
|
|
3935
3512
|
this.optional = false;
|
|
3936
3513
|
}
|
|
3937
3514
|
execute() {
|
|
3938
|
-
const ctx =
|
|
3939
|
-
const ctxDot =
|
|
3515
|
+
const ctx = ts22.factory.createIdentifier("ctx");
|
|
3516
|
+
const ctxDot = ts22.factory.createPropertyAccessExpression(ctx, "");
|
|
3940
3517
|
markIgnoreDiagnostics(ctxDot);
|
|
3941
3518
|
addExpressionIdentifier(ctxDot, ExpressionIdentifier.COMPONENT_COMPLETION);
|
|
3942
|
-
this.scope.addStatement(
|
|
3519
|
+
this.scope.addStatement(ts22.factory.createExpressionStatement(ctxDot));
|
|
3943
3520
|
return null;
|
|
3944
3521
|
}
|
|
3945
3522
|
};
|
|
3946
|
-
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR =
|
|
3523
|
+
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR = ts22.factory.createNonNullExpression(ts22.factory.createNull());
|
|
3947
3524
|
var Context = class {
|
|
3948
3525
|
constructor(env, domSchemaChecker, oobRecorder, id, boundTarget, pipes, schemas) {
|
|
3949
3526
|
this.env = env;
|
|
@@ -3956,7 +3533,7 @@ var Context = class {
|
|
|
3956
3533
|
this.nextId = 1;
|
|
3957
3534
|
}
|
|
3958
3535
|
allocateId() {
|
|
3959
|
-
return
|
|
3536
|
+
return ts22.factory.createIdentifier(`_t${this.nextId++}`);
|
|
3960
3537
|
}
|
|
3961
3538
|
getPipeByName(name) {
|
|
3962
3539
|
if (!this.pipes.has(name)) {
|
|
@@ -4008,8 +3585,8 @@ var Scope = class {
|
|
|
4008
3585
|
resolve(node, directive) {
|
|
4009
3586
|
const res = this.resolveLocal(node, directive);
|
|
4010
3587
|
if (res !== null) {
|
|
4011
|
-
const clone =
|
|
4012
|
-
|
|
3588
|
+
const clone = ts22.getMutableClone(res);
|
|
3589
|
+
ts22.setSyntheticTrailingComments(clone, []);
|
|
4013
3590
|
return clone;
|
|
4014
3591
|
} else if (this.parent !== null) {
|
|
4015
3592
|
return this.parent.resolve(node, directive);
|
|
@@ -4037,7 +3614,7 @@ var Scope = class {
|
|
|
4037
3614
|
} else if (parentGuards === null) {
|
|
4038
3615
|
return this.guard;
|
|
4039
3616
|
} else {
|
|
4040
|
-
return
|
|
3617
|
+
return ts22.factory.createBinaryExpression(parentGuards, ts22.SyntaxKind.AmpersandAmpersandToken, this.guard);
|
|
4041
3618
|
}
|
|
4042
3619
|
}
|
|
4043
3620
|
resolveLocal(ref, directive) {
|
|
@@ -4217,8 +3794,8 @@ var Scope = class {
|
|
|
4217
3794
|
}
|
|
4218
3795
|
};
|
|
4219
3796
|
function tcbCtxParam(node, name, typeArguments) {
|
|
4220
|
-
const type =
|
|
4221
|
-
return
|
|
3797
|
+
const type = ts22.factory.createTypeReferenceNode(name, typeArguments);
|
|
3798
|
+
return ts22.factory.createParameterDeclaration(void 0, void 0, void 0, "ctx", void 0, type, void 0);
|
|
4222
3799
|
}
|
|
4223
3800
|
function tcbExpression(ast, tcb, scope) {
|
|
4224
3801
|
const translator = new TcbExpressionTranslator(tcb, scope);
|
|
@@ -4241,11 +3818,11 @@ var TcbExpressionTranslator = class {
|
|
|
4241
3818
|
return null;
|
|
4242
3819
|
}
|
|
4243
3820
|
const expr = this.translate(ast.value);
|
|
4244
|
-
const result =
|
|
3821
|
+
const result = ts22.factory.createParenthesizedExpression(ts22.factory.createBinaryExpression(target, ts22.SyntaxKind.EqualsToken, expr));
|
|
4245
3822
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
4246
3823
|
return result;
|
|
4247
3824
|
} else if (ast instanceof ImplicitReceiver4) {
|
|
4248
|
-
return
|
|
3825
|
+
return ts22.factory.createIdentifier("ctx");
|
|
4249
3826
|
} else if (ast instanceof BindingPipe) {
|
|
4250
3827
|
const expr = this.translate(ast.exp);
|
|
4251
3828
|
const pipeRef = this.tcb.getPipeByName(ast.name);
|
|
@@ -4257,19 +3834,19 @@ var TcbExpressionTranslator = class {
|
|
|
4257
3834
|
pipe = this.tcb.env.pipeInst(pipeRef);
|
|
4258
3835
|
}
|
|
4259
3836
|
const args = ast.args.map((arg) => this.translate(arg));
|
|
4260
|
-
let methodAccess =
|
|
3837
|
+
let methodAccess = ts22.factory.createPropertyAccessExpression(pipe, "transform");
|
|
4261
3838
|
addParseSpanInfo(methodAccess, ast.nameSpan);
|
|
4262
3839
|
if (!this.tcb.env.config.checkTypeOfPipes) {
|
|
4263
|
-
methodAccess =
|
|
3840
|
+
methodAccess = ts22.factory.createAsExpression(methodAccess, ts22.factory.createKeywordTypeNode(ts22.SyntaxKind.AnyKeyword));
|
|
4264
3841
|
}
|
|
4265
|
-
const result =
|
|
3842
|
+
const result = ts22.factory.createCallExpression(methodAccess, void 0, [expr, ...args]);
|
|
4266
3843
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
4267
3844
|
return result;
|
|
4268
3845
|
} else if ((ast instanceof Call2 || ast instanceof SafeCall) && (ast.receiver instanceof PropertyRead4 || ast.receiver instanceof SafePropertyRead3)) {
|
|
4269
3846
|
if (ast.receiver.receiver instanceof ImplicitReceiver4 && !(ast.receiver.receiver instanceof ThisReceiver) && ast.receiver.name === "$any" && ast.args.length === 1) {
|
|
4270
3847
|
const expr = this.translate(ast.args[0]);
|
|
4271
|
-
const exprAsAny =
|
|
4272
|
-
const result =
|
|
3848
|
+
const exprAsAny = ts22.factory.createAsExpression(expr, ts22.factory.createKeywordTypeNode(ts22.SyntaxKind.AnyKeyword));
|
|
3849
|
+
const result = ts22.factory.createParenthesizedExpression(exprAsAny);
|
|
4273
3850
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
4274
3851
|
return result;
|
|
4275
3852
|
}
|
|
@@ -4280,7 +3857,7 @@ var TcbExpressionTranslator = class {
|
|
|
4280
3857
|
const method = wrapForDiagnostics(receiver);
|
|
4281
3858
|
addParseSpanInfo(method, ast.receiver.nameSpan);
|
|
4282
3859
|
const args = ast.args.map((arg) => this.translate(arg));
|
|
4283
|
-
const node =
|
|
3860
|
+
const node = ts22.factory.createCallExpression(method, void 0, args);
|
|
4284
3861
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
4285
3862
|
return node;
|
|
4286
3863
|
} else {
|
|
@@ -4300,17 +3877,17 @@ var TcbExpressionTranslator = class {
|
|
|
4300
3877
|
function tcbCallTypeCtor(dir, tcb, inputs) {
|
|
4301
3878
|
const typeCtor = tcb.env.typeCtorFor(dir);
|
|
4302
3879
|
const members = inputs.map((input) => {
|
|
4303
|
-
const propertyName =
|
|
3880
|
+
const propertyName = ts22.factory.createStringLiteral(input.field);
|
|
4304
3881
|
if (input.type === "binding") {
|
|
4305
3882
|
const expr = widenBinding(input.expression, tcb);
|
|
4306
|
-
const assignment =
|
|
3883
|
+
const assignment = ts22.factory.createPropertyAssignment(propertyName, wrapForDiagnostics(expr));
|
|
4307
3884
|
addParseSpanInfo(assignment, input.sourceSpan);
|
|
4308
3885
|
return assignment;
|
|
4309
3886
|
} else {
|
|
4310
|
-
return
|
|
3887
|
+
return ts22.factory.createPropertyAssignment(propertyName, NULL_AS_ANY);
|
|
4311
3888
|
}
|
|
4312
3889
|
});
|
|
4313
|
-
return
|
|
3890
|
+
return ts22.factory.createCallExpression(typeCtor, void 0, [ts22.factory.createObjectLiteralExpression(members)]);
|
|
4314
3891
|
}
|
|
4315
3892
|
function getBoundInputs(directive, node, tcb) {
|
|
4316
3893
|
const boundInputs = [];
|
|
@@ -4336,17 +3913,17 @@ function translateInput(attr, tcb, scope) {
|
|
|
4336
3913
|
if (attr instanceof TmplAstBoundAttribute) {
|
|
4337
3914
|
return tcbExpression(attr.value, tcb, scope);
|
|
4338
3915
|
} else {
|
|
4339
|
-
return
|
|
3916
|
+
return ts22.factory.createStringLiteral(attr.value);
|
|
4340
3917
|
}
|
|
4341
3918
|
}
|
|
4342
3919
|
function widenBinding(expr, tcb) {
|
|
4343
3920
|
if (!tcb.env.config.checkTypeOfInputBindings) {
|
|
4344
3921
|
return tsCastToAny(expr);
|
|
4345
3922
|
} else if (!tcb.env.config.strictNullInputBindings) {
|
|
4346
|
-
if (
|
|
3923
|
+
if (ts22.isObjectLiteralExpression(expr) || ts22.isArrayLiteralExpression(expr)) {
|
|
4347
3924
|
return expr;
|
|
4348
3925
|
} else {
|
|
4349
|
-
return
|
|
3926
|
+
return ts22.factory.createNonNullExpression(expr);
|
|
4350
3927
|
}
|
|
4351
3928
|
} else {
|
|
4352
3929
|
return expr;
|
|
@@ -4359,18 +3936,18 @@ function tcbCreateEventHandler(event, tcb, scope, eventType) {
|
|
|
4359
3936
|
if (eventType === 0) {
|
|
4360
3937
|
eventParamType = void 0;
|
|
4361
3938
|
} else if (eventType === 1) {
|
|
4362
|
-
eventParamType =
|
|
3939
|
+
eventParamType = ts22.factory.createKeywordTypeNode(ts22.SyntaxKind.AnyKeyword);
|
|
4363
3940
|
} else {
|
|
4364
3941
|
eventParamType = eventType;
|
|
4365
3942
|
}
|
|
4366
3943
|
const guards = scope.guards();
|
|
4367
|
-
let body =
|
|
3944
|
+
let body = ts22.factory.createExpressionStatement(handler);
|
|
4368
3945
|
if (guards !== null) {
|
|
4369
|
-
body =
|
|
3946
|
+
body = ts22.factory.createIfStatement(guards, body);
|
|
4370
3947
|
}
|
|
4371
|
-
const eventParam =
|
|
3948
|
+
const eventParam = ts22.factory.createParameterDeclaration(void 0, void 0, void 0, EVENT_PARAMETER, void 0, eventParamType);
|
|
4372
3949
|
addExpressionIdentifier(eventParam, ExpressionIdentifier.EVENT_PARAMETER);
|
|
4373
|
-
return
|
|
3950
|
+
return ts22.factory.createFunctionExpression(void 0, void 0, void 0, void 0, [eventParam], ts22.factory.createKeywordTypeNode(ts22.SyntaxKind.AnyKeyword), ts22.factory.createBlock([body]));
|
|
4374
3951
|
}
|
|
4375
3952
|
function tcbEventHandlerExpression(ast, tcb, scope) {
|
|
4376
3953
|
const translator = new TcbEventHandlerTranslator(tcb, scope);
|
|
@@ -4398,7 +3975,7 @@ function isSplitTwoWayBinding(inputName, output, inputs, tcb) {
|
|
|
4398
3975
|
var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
|
|
4399
3976
|
resolve(ast) {
|
|
4400
3977
|
if (ast instanceof PropertyRead4 && ast.receiver instanceof ImplicitReceiver4 && !(ast.receiver instanceof ThisReceiver) && ast.name === EVENT_PARAMETER) {
|
|
4401
|
-
const event =
|
|
3978
|
+
const event = ts22.factory.createIdentifier(EVENT_PARAMETER);
|
|
4402
3979
|
addParseSpanInfo(event, ast.nameSpan);
|
|
4403
3980
|
return event;
|
|
4404
3981
|
}
|
|
@@ -4407,32 +3984,32 @@ var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
|
|
|
4407
3984
|
};
|
|
4408
3985
|
|
|
4409
3986
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_file.mjs
|
|
4410
|
-
import
|
|
3987
|
+
import ts23 from "typescript";
|
|
4411
3988
|
var TypeCheckFile = class extends Environment {
|
|
4412
3989
|
constructor(fileName, config, refEmitter, reflector, compilerHost) {
|
|
4413
|
-
super(config, new ImportManager(new NoopImportRewriter(), "i"), refEmitter, reflector,
|
|
3990
|
+
super(config, new ImportManager(new NoopImportRewriter(), "i"), refEmitter, reflector, ts23.createSourceFile(compilerHost.getCanonicalFileName(fileName), "", ts23.ScriptTarget.Latest, true));
|
|
4414
3991
|
this.fileName = fileName;
|
|
4415
3992
|
this.nextTcbId = 1;
|
|
4416
3993
|
this.tcbStatements = [];
|
|
4417
3994
|
}
|
|
4418
3995
|
addTypeCheckBlock(ref, meta, domSchemaChecker, oobRecorder, genericContextBehavior) {
|
|
4419
|
-
const fnId =
|
|
3996
|
+
const fnId = ts23.factory.createIdentifier(`_tcb${this.nextTcbId++}`);
|
|
4420
3997
|
const fn = generateTypeCheckBlock(this, ref, fnId, meta, domSchemaChecker, oobRecorder, genericContextBehavior);
|
|
4421
3998
|
this.tcbStatements.push(fn);
|
|
4422
3999
|
}
|
|
4423
4000
|
render(removeComments) {
|
|
4424
4001
|
let source = this.importManager.getAllImports(this.contextFile.fileName).map((i) => `import * as ${i.qualifier.text} from '${i.specifier}';`).join("\n") + "\n\n";
|
|
4425
|
-
const printer =
|
|
4002
|
+
const printer = ts23.createPrinter({ removeComments });
|
|
4426
4003
|
source += "\n";
|
|
4427
4004
|
for (const stmt of this.pipeInstStatements) {
|
|
4428
|
-
source += printer.printNode(
|
|
4005
|
+
source += printer.printNode(ts23.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
4429
4006
|
}
|
|
4430
4007
|
for (const stmt of this.typeCtorStatements) {
|
|
4431
|
-
source += printer.printNode(
|
|
4008
|
+
source += printer.printNode(ts23.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
4432
4009
|
}
|
|
4433
4010
|
source += "\n";
|
|
4434
4011
|
for (const stmt of this.tcbStatements) {
|
|
4435
|
-
source += printer.printNode(
|
|
4012
|
+
source += printer.printNode(ts23.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
4436
4013
|
}
|
|
4437
4014
|
source += "\nexport const IS_A_MODULE = true;\n";
|
|
4438
4015
|
return source;
|
|
@@ -4540,7 +4117,7 @@ var TypeCheckContextImpl = class {
|
|
|
4540
4117
|
const importManager = new ImportManager(new NoopImportRewriter(), "_i");
|
|
4541
4118
|
const ops = this.opMap.get(sf).sort(orderOps);
|
|
4542
4119
|
const textParts = splitStringAtPoints(sf.text, ops.map((op) => op.splitPoint));
|
|
4543
|
-
const printer =
|
|
4120
|
+
const printer = ts24.createPrinter({ omitTrailingSemicolon: true });
|
|
4544
4121
|
let code = textParts[0];
|
|
4545
4122
|
ops.forEach((op, idx) => {
|
|
4546
4123
|
const text = op.execute(importManager, sf, this.refEmitter, printer);
|
|
@@ -4621,7 +4198,7 @@ var TypeCheckContextImpl = class {
|
|
|
4621
4198
|
if (span.start.offset === span.end.offset) {
|
|
4622
4199
|
span.end.offset++;
|
|
4623
4200
|
}
|
|
4624
|
-
return makeTemplateDiagnostic(templateId, sourceMapping, span,
|
|
4201
|
+
return makeTemplateDiagnostic(templateId, sourceMapping, span, ts24.DiagnosticCategory.Error, ngErrorCode(ErrorCode.TEMPLATE_PARSE_ERROR), error.msg);
|
|
4625
4202
|
});
|
|
4626
4203
|
}
|
|
4627
4204
|
};
|
|
@@ -4639,9 +4216,9 @@ var InlineTcbOp = class {
|
|
|
4639
4216
|
}
|
|
4640
4217
|
execute(im, sf, refEmitter, printer) {
|
|
4641
4218
|
const env = new Environment(this.config, im, refEmitter, this.reflector, sf);
|
|
4642
|
-
const fnName =
|
|
4219
|
+
const fnName = ts24.factory.createIdentifier(`_tcb_${this.ref.node.pos}`);
|
|
4643
4220
|
const fn = generateTypeCheckBlock(env, this.ref, fnName, this.meta, this.domSchemaChecker, this.oobRecorder, TcbGenericContextBehavior.CopyClassNodes);
|
|
4644
|
-
return printer.printNode(
|
|
4221
|
+
return printer.printNode(ts24.EmitHint.Unspecified, fn, sf);
|
|
4645
4222
|
}
|
|
4646
4223
|
};
|
|
4647
4224
|
var TypeCtorOp = class {
|
|
@@ -4654,7 +4231,7 @@ var TypeCtorOp = class {
|
|
|
4654
4231
|
}
|
|
4655
4232
|
execute(im, sf, refEmitter, printer) {
|
|
4656
4233
|
const tcb = generateInlineTypeCtor(this.ref.node, this.meta);
|
|
4657
|
-
return printer.printNode(
|
|
4234
|
+
return printer.printNode(ts24.EmitHint.Unspecified, tcb, sf);
|
|
4658
4235
|
}
|
|
4659
4236
|
};
|
|
4660
4237
|
function orderOps(op1, op2) {
|
|
@@ -4769,10 +4346,11 @@ var TemplateSourceManager = class {
|
|
|
4769
4346
|
|
|
4770
4347
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/template_symbol_builder.mjs
|
|
4771
4348
|
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";
|
|
4772
|
-
import
|
|
4349
|
+
import ts25 from "typescript";
|
|
4773
4350
|
var SymbolBuilder = class {
|
|
4774
|
-
constructor(
|
|
4775
|
-
this.
|
|
4351
|
+
constructor(tcbPath, tcbIsShim, typeCheckBlock, templateData, componentScopeReader, getTypeChecker) {
|
|
4352
|
+
this.tcbPath = tcbPath;
|
|
4353
|
+
this.tcbIsShim = tcbIsShim;
|
|
4776
4354
|
this.typeCheckBlock = typeCheckBlock;
|
|
4777
4355
|
this.templateData = templateData;
|
|
4778
4356
|
this.componentScopeReader = componentScopeReader;
|
|
@@ -4812,7 +4390,7 @@ var SymbolBuilder = class {
|
|
|
4812
4390
|
getSymbolOfElement(element) {
|
|
4813
4391
|
var _a;
|
|
4814
4392
|
const elementSourceSpan = (_a = element.startSourceSpan) != null ? _a : element.sourceSpan;
|
|
4815
|
-
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: elementSourceSpan, filter:
|
|
4393
|
+
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: elementSourceSpan, filter: ts25.isVariableDeclaration });
|
|
4816
4394
|
if (node === null) {
|
|
4817
4395
|
return null;
|
|
4818
4396
|
}
|
|
@@ -4831,12 +4409,12 @@ var SymbolBuilder = class {
|
|
|
4831
4409
|
var _a;
|
|
4832
4410
|
const elementSourceSpan = (_a = element.startSourceSpan) != null ? _a : element.sourceSpan;
|
|
4833
4411
|
const tcbSourceFile = this.typeCheckBlock.getSourceFile();
|
|
4834
|
-
const isDirectiveDeclaration = (node) => (
|
|
4412
|
+
const isDirectiveDeclaration = (node) => (ts25.isTypeNode(node) || ts25.isIdentifier(node)) && ts25.isVariableDeclaration(node.parent) && hasExpressionIdentifier(tcbSourceFile, node, ExpressionIdentifier.DIRECTIVE);
|
|
4835
4413
|
const nodes = findAllMatchingNodes(this.typeCheckBlock, { withSpan: elementSourceSpan, filter: isDirectiveDeclaration });
|
|
4836
4414
|
return nodes.map((node) => {
|
|
4837
4415
|
var _a2;
|
|
4838
4416
|
const symbol = this.getSymbolOfTsNode(node.parent);
|
|
4839
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
4417
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts25.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
4840
4418
|
return null;
|
|
4841
4419
|
}
|
|
4842
4420
|
const meta = this.getDirectiveMeta(element, symbol.tsSymbol.valueDeclaration);
|
|
@@ -4905,23 +4483,23 @@ var SymbolBuilder = class {
|
|
|
4905
4483
|
if (!isAccessExpression(n)) {
|
|
4906
4484
|
return false;
|
|
4907
4485
|
}
|
|
4908
|
-
if (
|
|
4486
|
+
if (ts25.isPropertyAccessExpression(n)) {
|
|
4909
4487
|
return n.name.getText() === expectedAccess;
|
|
4910
4488
|
} else {
|
|
4911
|
-
return
|
|
4489
|
+
return ts25.isStringLiteral(n.argumentExpression) && n.argumentExpression.text === expectedAccess;
|
|
4912
4490
|
}
|
|
4913
4491
|
}
|
|
4914
4492
|
const outputFieldAccesses = findAllMatchingNodes(this.typeCheckBlock, { withSpan: eventBinding.keySpan, filter });
|
|
4915
4493
|
const bindings = [];
|
|
4916
4494
|
for (const outputFieldAccess of outputFieldAccesses) {
|
|
4917
4495
|
if (consumer instanceof TmplAstTemplate3 || consumer instanceof TmplAstElement4) {
|
|
4918
|
-
if (!
|
|
4496
|
+
if (!ts25.isPropertyAccessExpression(outputFieldAccess)) {
|
|
4919
4497
|
continue;
|
|
4920
4498
|
}
|
|
4921
4499
|
const addEventListener = outputFieldAccess.name;
|
|
4922
4500
|
const tsSymbol = this.getTypeChecker().getSymbolAtLocation(addEventListener);
|
|
4923
4501
|
const tsType = this.getTypeChecker().getTypeAtLocation(addEventListener);
|
|
4924
|
-
const
|
|
4502
|
+
const positionInFile = this.getTcbPositionForNode(addEventListener);
|
|
4925
4503
|
const target = this.getSymbol(consumer);
|
|
4926
4504
|
if (target === null || tsSymbol === void 0) {
|
|
4927
4505
|
continue;
|
|
@@ -4931,10 +4509,14 @@ var SymbolBuilder = class {
|
|
|
4931
4509
|
tsSymbol,
|
|
4932
4510
|
tsType,
|
|
4933
4511
|
target,
|
|
4934
|
-
|
|
4512
|
+
tcbLocation: {
|
|
4513
|
+
tcbPath: this.tcbPath,
|
|
4514
|
+
isShimFile: this.tcbIsShim,
|
|
4515
|
+
positionInFile
|
|
4516
|
+
}
|
|
4935
4517
|
});
|
|
4936
4518
|
} else {
|
|
4937
|
-
if (!
|
|
4519
|
+
if (!ts25.isElementAccessExpression(outputFieldAccess)) {
|
|
4938
4520
|
continue;
|
|
4939
4521
|
}
|
|
4940
4522
|
const tsSymbol = this.getTypeChecker().getSymbolAtLocation(outputFieldAccess.argumentExpression);
|
|
@@ -4945,14 +4527,18 @@ var SymbolBuilder = class {
|
|
|
4945
4527
|
if (target === null) {
|
|
4946
4528
|
continue;
|
|
4947
4529
|
}
|
|
4948
|
-
const
|
|
4530
|
+
const positionInFile = this.getTcbPositionForNode(outputFieldAccess);
|
|
4949
4531
|
const tsType = this.getTypeChecker().getTypeAtLocation(outputFieldAccess);
|
|
4950
4532
|
bindings.push({
|
|
4951
4533
|
kind: SymbolKind.Binding,
|
|
4952
4534
|
tsSymbol,
|
|
4953
4535
|
tsType,
|
|
4954
4536
|
target,
|
|
4955
|
-
|
|
4537
|
+
tcbLocation: {
|
|
4538
|
+
tcbPath: this.tcbPath,
|
|
4539
|
+
isShimFile: this.tcbIsShim,
|
|
4540
|
+
positionInFile
|
|
4541
|
+
}
|
|
4956
4542
|
});
|
|
4957
4543
|
}
|
|
4958
4544
|
}
|
|
@@ -5002,11 +4588,11 @@ var SymbolBuilder = class {
|
|
|
5002
4588
|
return null;
|
|
5003
4589
|
}
|
|
5004
4590
|
const [declaration] = tsSymbol.declarations;
|
|
5005
|
-
if (!
|
|
4591
|
+
if (!ts25.isVariableDeclaration(declaration) || !hasExpressionIdentifier(declaration.getSourceFile(), (_a = declaration.type) != null ? _a : declaration.name, ExpressionIdentifier.DIRECTIVE)) {
|
|
5006
4592
|
return null;
|
|
5007
4593
|
}
|
|
5008
4594
|
const symbol = this.getSymbolOfTsNode(declaration);
|
|
5009
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
4595
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts25.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
5010
4596
|
return null;
|
|
5011
4597
|
}
|
|
5012
4598
|
const ngModule = this.getDirectiveModule(symbol.tsSymbol.valueDeclaration);
|
|
@@ -5014,7 +4600,7 @@ var SymbolBuilder = class {
|
|
|
5014
4600
|
kind: SymbolKind.Directive,
|
|
5015
4601
|
tsSymbol: symbol.tsSymbol,
|
|
5016
4602
|
tsType: symbol.tsType,
|
|
5017
|
-
|
|
4603
|
+
tcbLocation: symbol.tcbLocation,
|
|
5018
4604
|
isComponent,
|
|
5019
4605
|
isStructural,
|
|
5020
4606
|
selector,
|
|
@@ -5022,7 +4608,7 @@ var SymbolBuilder = class {
|
|
|
5022
4608
|
};
|
|
5023
4609
|
}
|
|
5024
4610
|
getSymbolOfVariable(variable) {
|
|
5025
|
-
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: variable.sourceSpan, filter:
|
|
4611
|
+
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: variable.sourceSpan, filter: ts25.isVariableDeclaration });
|
|
5026
4612
|
if (node === null || node.initializer === void 0) {
|
|
5027
4613
|
return null;
|
|
5028
4614
|
}
|
|
@@ -5033,22 +4619,23 @@ var SymbolBuilder = class {
|
|
|
5033
4619
|
return {
|
|
5034
4620
|
tsType: expressionSymbol.tsType,
|
|
5035
4621
|
tsSymbol: expressionSymbol.tsSymbol,
|
|
5036
|
-
initializerLocation: expressionSymbol.
|
|
4622
|
+
initializerLocation: expressionSymbol.tcbLocation,
|
|
5037
4623
|
kind: SymbolKind.Variable,
|
|
5038
4624
|
declaration: variable,
|
|
5039
4625
|
localVarLocation: {
|
|
5040
|
-
|
|
5041
|
-
|
|
4626
|
+
tcbPath: this.tcbPath,
|
|
4627
|
+
isShimFile: this.tcbIsShim,
|
|
4628
|
+
positionInFile: this.getTcbPositionForNode(node.name)
|
|
5042
4629
|
}
|
|
5043
4630
|
};
|
|
5044
4631
|
}
|
|
5045
4632
|
getSymbolOfReference(ref) {
|
|
5046
4633
|
const target = this.templateData.boundTarget.getReferenceTarget(ref);
|
|
5047
|
-
let node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: ref.sourceSpan, filter:
|
|
4634
|
+
let node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: ref.sourceSpan, filter: ts25.isVariableDeclaration });
|
|
5048
4635
|
if (node === null || target === null || node.initializer === void 0) {
|
|
5049
4636
|
return null;
|
|
5050
4637
|
}
|
|
5051
|
-
const originalDeclaration =
|
|
4638
|
+
const originalDeclaration = ts25.isParenthesizedExpression(node.initializer) && ts25.isAsExpression(node.initializer.expression) ? this.getTypeChecker().getSymbolAtLocation(node.name) : this.getTypeChecker().getSymbolAtLocation(node.initializer);
|
|
5052
4639
|
if (originalDeclaration === void 0 || originalDeclaration.valueDeclaration === void 0) {
|
|
5053
4640
|
return null;
|
|
5054
4641
|
}
|
|
@@ -5056,9 +4643,10 @@ var SymbolBuilder = class {
|
|
|
5056
4643
|
if (symbol === null || symbol.tsSymbol === null) {
|
|
5057
4644
|
return null;
|
|
5058
4645
|
}
|
|
5059
|
-
const
|
|
5060
|
-
|
|
5061
|
-
|
|
4646
|
+
const referenceVarTcbLocation = {
|
|
4647
|
+
tcbPath: this.tcbPath,
|
|
4648
|
+
isShimFile: this.tcbIsShim,
|
|
4649
|
+
positionInFile: this.getTcbPositionForNode(node)
|
|
5062
4650
|
};
|
|
5063
4651
|
if (target instanceof TmplAstTemplate3 || target instanceof TmplAstElement4) {
|
|
5064
4652
|
return {
|
|
@@ -5067,11 +4655,11 @@ var SymbolBuilder = class {
|
|
|
5067
4655
|
tsType: symbol.tsType,
|
|
5068
4656
|
target,
|
|
5069
4657
|
declaration: ref,
|
|
5070
|
-
targetLocation: symbol.
|
|
5071
|
-
referenceVarLocation:
|
|
4658
|
+
targetLocation: symbol.tcbLocation,
|
|
4659
|
+
referenceVarLocation: referenceVarTcbLocation
|
|
5072
4660
|
};
|
|
5073
4661
|
} else {
|
|
5074
|
-
if (!
|
|
4662
|
+
if (!ts25.isClassDeclaration(target.directive.ref.node)) {
|
|
5075
4663
|
return null;
|
|
5076
4664
|
}
|
|
5077
4665
|
return {
|
|
@@ -5080,13 +4668,13 @@ var SymbolBuilder = class {
|
|
|
5080
4668
|
tsType: symbol.tsType,
|
|
5081
4669
|
declaration: ref,
|
|
5082
4670
|
target: target.directive.ref.node,
|
|
5083
|
-
targetLocation: symbol.
|
|
5084
|
-
referenceVarLocation:
|
|
4671
|
+
targetLocation: symbol.tcbLocation,
|
|
4672
|
+
referenceVarLocation: referenceVarTcbLocation
|
|
5085
4673
|
};
|
|
5086
4674
|
}
|
|
5087
4675
|
}
|
|
5088
4676
|
getSymbolOfPipe(expression) {
|
|
5089
|
-
const methodAccess = findFirstMatchingNode(this.typeCheckBlock, { withSpan: expression.nameSpan, filter:
|
|
4677
|
+
const methodAccess = findFirstMatchingNode(this.typeCheckBlock, { withSpan: expression.nameSpan, filter: ts25.isPropertyAccessExpression });
|
|
5090
4678
|
if (methodAccess === null) {
|
|
5091
4679
|
return null;
|
|
5092
4680
|
}
|
|
@@ -5125,7 +4713,7 @@ var SymbolBuilder = class {
|
|
|
5125
4713
|
}
|
|
5126
4714
|
let node = null;
|
|
5127
4715
|
if (expression instanceof PropertyRead5) {
|
|
5128
|
-
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter:
|
|
4716
|
+
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter: ts25.isPropertyAccessExpression });
|
|
5129
4717
|
}
|
|
5130
4718
|
if (node === null) {
|
|
5131
4719
|
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter: anyNodeFilter });
|
|
@@ -5133,10 +4721,10 @@ var SymbolBuilder = class {
|
|
|
5133
4721
|
if (node === null) {
|
|
5134
4722
|
return null;
|
|
5135
4723
|
}
|
|
5136
|
-
while (
|
|
4724
|
+
while (ts25.isParenthesizedExpression(node)) {
|
|
5137
4725
|
node = node.expression;
|
|
5138
4726
|
}
|
|
5139
|
-
if (expression instanceof SafePropertyRead4 &&
|
|
4727
|
+
if (expression instanceof SafePropertyRead4 && ts25.isConditionalExpression(node)) {
|
|
5140
4728
|
const whenTrueSymbol = this.getSymbolOfTsNode(node.whenTrue);
|
|
5141
4729
|
if (whenTrueSymbol === null) {
|
|
5142
4730
|
return null;
|
|
@@ -5152,33 +4740,37 @@ var SymbolBuilder = class {
|
|
|
5152
4740
|
}
|
|
5153
4741
|
getSymbolOfTsNode(node) {
|
|
5154
4742
|
var _a;
|
|
5155
|
-
while (
|
|
4743
|
+
while (ts25.isParenthesizedExpression(node)) {
|
|
5156
4744
|
node = node.expression;
|
|
5157
4745
|
}
|
|
5158
4746
|
let tsSymbol;
|
|
5159
|
-
if (
|
|
4747
|
+
if (ts25.isPropertyAccessExpression(node)) {
|
|
5160
4748
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.name);
|
|
5161
|
-
} else if (
|
|
4749
|
+
} else if (ts25.isElementAccessExpression(node)) {
|
|
5162
4750
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.argumentExpression);
|
|
5163
4751
|
} else {
|
|
5164
4752
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node);
|
|
5165
4753
|
}
|
|
5166
|
-
const
|
|
4754
|
+
const positionInFile = this.getTcbPositionForNode(node);
|
|
5167
4755
|
const type = this.getTypeChecker().getTypeAtLocation(node);
|
|
5168
4756
|
return {
|
|
5169
4757
|
tsSymbol: (_a = tsSymbol != null ? tsSymbol : type.symbol) != null ? _a : null,
|
|
5170
4758
|
tsType: type,
|
|
5171
|
-
|
|
4759
|
+
tcbLocation: {
|
|
4760
|
+
tcbPath: this.tcbPath,
|
|
4761
|
+
isShimFile: this.tcbIsShim,
|
|
4762
|
+
positionInFile
|
|
4763
|
+
}
|
|
5172
4764
|
};
|
|
5173
4765
|
}
|
|
5174
|
-
|
|
5175
|
-
if (
|
|
5176
|
-
return this.
|
|
5177
|
-
} else if (
|
|
4766
|
+
getTcbPositionForNode(node) {
|
|
4767
|
+
if (ts25.isTypeReferenceNode(node)) {
|
|
4768
|
+
return this.getTcbPositionForNode(node.typeName);
|
|
4769
|
+
} else if (ts25.isQualifiedName(node)) {
|
|
5178
4770
|
return node.right.getStart();
|
|
5179
|
-
} else if (
|
|
4771
|
+
} else if (ts25.isPropertyAccessExpression(node)) {
|
|
5180
4772
|
return node.name.getStart();
|
|
5181
|
-
} else if (
|
|
4773
|
+
} else if (ts25.isElementAccessExpression(node)) {
|
|
5182
4774
|
return node.argumentExpression.getStart();
|
|
5183
4775
|
} else {
|
|
5184
4776
|
return node.getStart();
|
|
@@ -5228,7 +4820,7 @@ var TemplateTypeCheckerImpl = class {
|
|
|
5228
4820
|
const shimPath = TypeCheckShimGenerator.shimFor(sfPath);
|
|
5229
4821
|
const fileRecord = this.getFileData(sfPath);
|
|
5230
4822
|
if (!fileRecord.shimData.has(shimPath)) {
|
|
5231
|
-
return { data: null, tcb: null, shimPath };
|
|
4823
|
+
return { data: null, tcb: null, tcbPath: shimPath, tcbIsShim: true };
|
|
5232
4824
|
}
|
|
5233
4825
|
const templateId = fileRecord.sourceManager.getTemplateId(component);
|
|
5234
4826
|
const shimRecord = fileRecord.shimData.get(shimPath);
|
|
@@ -5239,19 +4831,38 @@ var TemplateTypeCheckerImpl = class {
|
|
|
5239
4831
|
throw new Error(`Error: no shim file in program: ${shimPath}`);
|
|
5240
4832
|
}
|
|
5241
4833
|
let tcb = findTypeCheckBlock(shimSf, id, false);
|
|
4834
|
+
let tcbPath = shimPath;
|
|
5242
4835
|
if (tcb === null) {
|
|
5243
4836
|
const inlineSf = getSourceFileOrError(program, sfPath);
|
|
5244
4837
|
tcb = findTypeCheckBlock(inlineSf, id, false);
|
|
4838
|
+
if (tcb !== null) {
|
|
4839
|
+
tcbPath = sfPath;
|
|
4840
|
+
}
|
|
5245
4841
|
}
|
|
5246
4842
|
let data = null;
|
|
5247
4843
|
if (shimRecord.templates.has(templateId)) {
|
|
5248
4844
|
data = shimRecord.templates.get(templateId);
|
|
5249
4845
|
}
|
|
5250
|
-
return { data, tcb, shimPath };
|
|
4846
|
+
return { data, tcb, tcbPath, tcbIsShim: tcbPath === shimPath };
|
|
5251
4847
|
}
|
|
5252
4848
|
isTrackedTypeCheckFile(filePath) {
|
|
5253
4849
|
return this.getFileAndShimRecordsForPath(filePath) !== null;
|
|
5254
4850
|
}
|
|
4851
|
+
getFileRecordForTcbLocation({ tcbPath, isShimFile }) {
|
|
4852
|
+
if (!isShimFile) {
|
|
4853
|
+
if (this.state.has(tcbPath)) {
|
|
4854
|
+
return this.state.get(tcbPath);
|
|
4855
|
+
} else {
|
|
4856
|
+
return null;
|
|
4857
|
+
}
|
|
4858
|
+
}
|
|
4859
|
+
const records = this.getFileAndShimRecordsForPath(tcbPath);
|
|
4860
|
+
if (records !== null) {
|
|
4861
|
+
return records.fileRecord;
|
|
4862
|
+
} else {
|
|
4863
|
+
return null;
|
|
4864
|
+
}
|
|
4865
|
+
}
|
|
5255
4866
|
getFileAndShimRecordsForPath(shimPath) {
|
|
5256
4867
|
for (const fileRecord of this.state.values()) {
|
|
5257
4868
|
if (fileRecord.shimData.has(shimPath)) {
|
|
@@ -5260,17 +4871,16 @@ var TemplateTypeCheckerImpl = class {
|
|
|
5260
4871
|
}
|
|
5261
4872
|
return null;
|
|
5262
4873
|
}
|
|
5263
|
-
|
|
5264
|
-
const
|
|
5265
|
-
if (
|
|
4874
|
+
getTemplateMappingAtTcbLocation(tcbLocation) {
|
|
4875
|
+
const fileRecord = this.getFileRecordForTcbLocation(tcbLocation);
|
|
4876
|
+
if (fileRecord === null) {
|
|
5266
4877
|
return null;
|
|
5267
4878
|
}
|
|
5268
|
-
const
|
|
5269
|
-
const shimSf = this.programDriver.getProgram().getSourceFile(absoluteFrom(shimPath));
|
|
4879
|
+
const shimSf = this.programDriver.getProgram().getSourceFile(tcbLocation.tcbPath);
|
|
5270
4880
|
if (shimSf === void 0) {
|
|
5271
4881
|
return null;
|
|
5272
4882
|
}
|
|
5273
|
-
return getTemplateMapping(shimSf,
|
|
4883
|
+
return getTemplateMapping(shimSf, tcbLocation.positionInFile, fileRecord.sourceManager, false);
|
|
5274
4884
|
}
|
|
5275
4885
|
generateAllTypeCheckBlocks() {
|
|
5276
4886
|
this.ensureAllShimsForAllFiles();
|
|
@@ -5382,11 +4992,11 @@ var TemplateTypeCheckerImpl = class {
|
|
|
5382
4992
|
if (this.completionCache.has(component)) {
|
|
5383
4993
|
return this.completionCache.get(component);
|
|
5384
4994
|
}
|
|
5385
|
-
const { tcb, data,
|
|
4995
|
+
const { tcb, data, tcbPath, tcbIsShim } = this.getLatestComponentState(component);
|
|
5386
4996
|
if (tcb === null || data === null) {
|
|
5387
4997
|
return null;
|
|
5388
4998
|
}
|
|
5389
|
-
const engine = new CompletionEngine(tcb, data,
|
|
4999
|
+
const engine = new CompletionEngine(tcb, data, tcbPath, tcbIsShim);
|
|
5390
5000
|
this.completionCache.set(component, engine);
|
|
5391
5001
|
return engine;
|
|
5392
5002
|
}
|
|
@@ -5510,11 +5120,11 @@ var TemplateTypeCheckerImpl = class {
|
|
|
5510
5120
|
if (this.symbolBuilderCache.has(component)) {
|
|
5511
5121
|
return this.symbolBuilderCache.get(component);
|
|
5512
5122
|
}
|
|
5513
|
-
const { tcb, data,
|
|
5123
|
+
const { tcb, data, tcbPath, tcbIsShim } = this.getLatestComponentState(component);
|
|
5514
5124
|
if (tcb === null || data === null) {
|
|
5515
5125
|
return null;
|
|
5516
5126
|
}
|
|
5517
|
-
const builder = new SymbolBuilder(
|
|
5127
|
+
const builder = new SymbolBuilder(tcbPath, tcbIsShim, tcb, data, this.componentScopeReader, () => this.programDriver.getProgram().getTypeChecker());
|
|
5518
5128
|
this.symbolBuilderCache.set(component, builder);
|
|
5519
5129
|
return builder;
|
|
5520
5130
|
}
|
|
@@ -5549,7 +5159,7 @@ var TemplateTypeCheckerImpl = class {
|
|
|
5549
5159
|
const scope = this.getScopeData(component);
|
|
5550
5160
|
if (scope !== null) {
|
|
5551
5161
|
for (const directive of scope.directives) {
|
|
5552
|
-
for (const selector of
|
|
5162
|
+
for (const selector of CssSelector.parse(directive.selector)) {
|
|
5553
5163
|
if (selector.element === null || tagMap.has(selector.element)) {
|
|
5554
5164
|
continue;
|
|
5555
5165
|
}
|
|
@@ -5815,6 +5425,7 @@ var factory = {
|
|
|
5815
5425
|
|
|
5816
5426
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/nullish_coalescing_not_nullable/index.mjs
|
|
5817
5427
|
import { Binary } from "@angular/compiler";
|
|
5428
|
+
import ts26 from "typescript";
|
|
5818
5429
|
var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
5819
5430
|
constructor() {
|
|
5820
5431
|
super(...arguments);
|
|
@@ -5828,14 +5439,20 @@ var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
5828
5439
|
return [];
|
|
5829
5440
|
}
|
|
5830
5441
|
const typeLeft = symbolLeft.tsType;
|
|
5442
|
+
if (typeLeft.flags & (ts26.TypeFlags.Any | ts26.TypeFlags.Unknown)) {
|
|
5443
|
+
return [];
|
|
5444
|
+
}
|
|
5831
5445
|
if (typeLeft.getNonNullableType() !== typeLeft)
|
|
5832
5446
|
return [];
|
|
5833
5447
|
const symbol = ctx.templateTypeChecker.getSymbolOfNode(node, component);
|
|
5834
5448
|
if (symbol.kind !== SymbolKind.Expression) {
|
|
5835
5449
|
return [];
|
|
5836
5450
|
}
|
|
5837
|
-
const
|
|
5838
|
-
|
|
5451
|
+
const templateMapping = ctx.templateTypeChecker.getTemplateMappingAtTcbLocation(symbol.tcbLocation);
|
|
5452
|
+
if (templateMapping === null) {
|
|
5453
|
+
return [];
|
|
5454
|
+
}
|
|
5455
|
+
const diagnostic = ctx.makeTemplateDiagnostic(templateMapping.span, `The left side of this nullish coalescing operation does not include 'null' or 'undefined' in its type, therefore the '??' operator can be safely removed.`);
|
|
5839
5456
|
return [diagnostic];
|
|
5840
5457
|
}
|
|
5841
5458
|
};
|
|
@@ -5843,7 +5460,8 @@ var factory2 = {
|
|
|
5843
5460
|
code: ErrorCode.NULLISH_COALESCING_NOT_NULLABLE,
|
|
5844
5461
|
name: ExtendedTemplateDiagnosticName.NULLISH_COALESCING_NOT_NULLABLE,
|
|
5845
5462
|
create: (options) => {
|
|
5846
|
-
|
|
5463
|
+
const strictNullChecks = options.strictNullChecks === void 0 ? !!options.strict : !!options.strictNullChecks;
|
|
5464
|
+
if (!strictNullChecks) {
|
|
5847
5465
|
return null;
|
|
5848
5466
|
}
|
|
5849
5467
|
return new NullishCoalescingNotNullableCheck();
|
|
@@ -5851,7 +5469,7 @@ var factory2 = {
|
|
|
5851
5469
|
};
|
|
5852
5470
|
|
|
5853
5471
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/src/extended_template_checker.mjs
|
|
5854
|
-
import
|
|
5472
|
+
import ts27 from "typescript";
|
|
5855
5473
|
|
|
5856
5474
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/api/src/public_options.mjs
|
|
5857
5475
|
var DiagnosticCategoryLabel;
|
|
@@ -5899,9 +5517,9 @@ var ExtendedTemplateCheckerImpl = class {
|
|
|
5899
5517
|
function diagnosticLabelToCategory(label) {
|
|
5900
5518
|
switch (label) {
|
|
5901
5519
|
case DiagnosticCategoryLabel.Warning:
|
|
5902
|
-
return
|
|
5520
|
+
return ts27.DiagnosticCategory.Warning;
|
|
5903
5521
|
case DiagnosticCategoryLabel.Error:
|
|
5904
|
-
return
|
|
5522
|
+
return ts27.DiagnosticCategory.Error;
|
|
5905
5523
|
case DiagnosticCategoryLabel.Suppress:
|
|
5906
5524
|
return null;
|
|
5907
5525
|
default:
|
|
@@ -5992,14 +5610,11 @@ var NgCompiler = class {
|
|
|
5992
5610
|
this.constructionDiagnostics = [];
|
|
5993
5611
|
this.nonTemplateDiagnostics = null;
|
|
5994
5612
|
this.delegatingPerfRecorder = new DelegatingPerfRecorder(this.perfRecorder);
|
|
5995
|
-
if (this.options._extendedTemplateDiagnostics === true && this.options.strictTemplates === false) {
|
|
5996
|
-
throw new Error("The '_extendedTemplateDiagnostics' option requires 'strictTemplates' to also be enabled.");
|
|
5997
|
-
}
|
|
5998
5613
|
this.constructionDiagnostics.push(...this.adapter.constructionDiagnostics, ...verifyCompatibleTypeCheckOptions(this.options));
|
|
5999
5614
|
this.currentProgram = inputProgram;
|
|
6000
5615
|
this.closureCompilerEnabled = !!this.options.annotateForClosureCompiler;
|
|
6001
5616
|
this.entryPoint = adapter.entryPoint !== null ? getSourceFileOrNull(inputProgram, adapter.entryPoint) : null;
|
|
6002
|
-
const moduleResolutionCache =
|
|
5617
|
+
const moduleResolutionCache = ts28.createModuleResolutionCache(this.adapter.getCurrentDirectory(), this.adapter.getCanonicalFileName.bind(this.adapter));
|
|
6003
5618
|
this.moduleResolver = new ModuleResolver(inputProgram, this.options, this.adapter, moduleResolutionCache);
|
|
6004
5619
|
this.resourceManager = new AdapterResourceLoader(adapter, this.options);
|
|
6005
5620
|
this.cycleAnalyzer = new CycleAnalyzer(new ImportGraph(inputProgram.getTypeChecker(), this.delegatingPerfRecorder));
|
|
@@ -6055,7 +5670,7 @@ var NgCompiler = class {
|
|
|
6055
5670
|
}
|
|
6056
5671
|
for (const clazz of classesToUpdate) {
|
|
6057
5672
|
this.compilation.traitCompiler.updateResources(clazz);
|
|
6058
|
-
if (!
|
|
5673
|
+
if (!ts28.isClassDeclaration(clazz)) {
|
|
6059
5674
|
continue;
|
|
6060
5675
|
}
|
|
6061
5676
|
this.compilation.templateTypeChecker.invalidateClass(clazz);
|
|
@@ -6406,12 +6021,12 @@ var NgCompiler = class {
|
|
|
6406
6021
|
const localMetaRegistry = new LocalMetadataRegistry();
|
|
6407
6022
|
const localMetaReader = localMetaRegistry;
|
|
6408
6023
|
const depScopeReader = new MetadataDtsModuleScopeResolver(dtsReader, aliasingHost);
|
|
6409
|
-
const
|
|
6024
|
+
const metaReader = new CompoundMetadataReader([localMetaReader, dtsReader]);
|
|
6025
|
+
const scopeRegistry = new LocalModuleScopeRegistry(localMetaReader, metaReader, depScopeReader, refEmitter, aliasingHost);
|
|
6410
6026
|
const scopeReader = scopeRegistry;
|
|
6411
6027
|
const semanticDepGraphUpdater = this.incrementalCompilation.semanticDepGraphUpdater;
|
|
6412
6028
|
const metaRegistry = new CompoundMetadataRegistry([localMetaRegistry, scopeRegistry]);
|
|
6413
6029
|
const injectableRegistry = new InjectableClassRegistry(reflector);
|
|
6414
|
-
const metaReader = new CompoundMetadataReader([localMetaReader, dtsReader]);
|
|
6415
6030
|
const typeCheckScopeRegistry = new TypeCheckScopeRegistry(scopeReader, metaReader);
|
|
6416
6031
|
let referencesRegistry;
|
|
6417
6032
|
let exportReferenceGraph = null;
|
|
@@ -6427,7 +6042,7 @@ var NgCompiler = class {
|
|
|
6427
6042
|
const compilationMode = this.options.compilationMode === "partial" && !isCore ? CompilationMode.PARTIAL : CompilationMode.FULL;
|
|
6428
6043
|
const cycleHandlingStrategy = compilationMode === CompilationMode.FULL ? 0 : 1;
|
|
6429
6044
|
const handlers = [
|
|
6430
|
-
new ComponentDecoratorHandler(reflector, evaluator, metaRegistry, metaReader, scopeReader, scopeRegistry, typeCheckScopeRegistry, resourceRegistry, isCore, this.resourceManager, this.adapter.rootDirs, this.options.preserveWhitespaces || false, this.options.i18nUseExternalIds !== false, this.options.enableI18nLegacyMessageIdFormat !== false, this.usePoisonedData, this.options.i18nNormalizeLineEndingsInICUs, this.moduleResolver, this.cycleAnalyzer, cycleHandlingStrategy, refEmitter, this.incrementalCompilation.depGraph, injectableRegistry, semanticDepGraphUpdater, this.closureCompilerEnabled, this.delegatingPerfRecorder),
|
|
6045
|
+
new ComponentDecoratorHandler(reflector, evaluator, metaRegistry, metaReader, scopeReader, depScopeReader, scopeRegistry, typeCheckScopeRegistry, resourceRegistry, isCore, this.resourceManager, this.adapter.rootDirs, this.options.preserveWhitespaces || false, this.options.i18nUseExternalIds !== false, this.options.enableI18nLegacyMessageIdFormat !== false, this.usePoisonedData, this.options.i18nNormalizeLineEndingsInICUs === true, this.moduleResolver, this.cycleAnalyzer, cycleHandlingStrategy, refEmitter, this.incrementalCompilation.depGraph, injectableRegistry, semanticDepGraphUpdater, this.closureCompilerEnabled, this.delegatingPerfRecorder),
|
|
6431
6046
|
new DirectiveDecoratorHandler(reflector, evaluator, metaRegistry, scopeRegistry, metaReader, injectableRegistry, isCore, semanticDepGraphUpdater, this.closureCompilerEnabled, false, this.delegatingPerfRecorder),
|
|
6432
6047
|
new PipeDecoratorHandler(reflector, evaluator, metaRegistry, scopeRegistry, injectableRegistry, isCore, this.delegatingPerfRecorder),
|
|
6433
6048
|
new InjectableDecoratorHandler(reflector, isCore, this.options.strictInjectionParameters || false, injectableRegistry, this.delegatingPerfRecorder),
|
|
@@ -6463,17 +6078,17 @@ function isAngularCorePackage(program) {
|
|
|
6463
6078
|
return false;
|
|
6464
6079
|
}
|
|
6465
6080
|
return r3Symbols.statements.some((stmt) => {
|
|
6466
|
-
if (!
|
|
6081
|
+
if (!ts28.isVariableStatement(stmt)) {
|
|
6467
6082
|
return false;
|
|
6468
6083
|
}
|
|
6469
|
-
if (stmt.modifiers === void 0 || !stmt.modifiers.some((mod) => mod.kind ===
|
|
6084
|
+
if (stmt.modifiers === void 0 || !stmt.modifiers.some((mod) => mod.kind === ts28.SyntaxKind.ExportKeyword)) {
|
|
6470
6085
|
return false;
|
|
6471
6086
|
}
|
|
6472
6087
|
return stmt.declarationList.declarations.some((decl) => {
|
|
6473
|
-
if (!
|
|
6088
|
+
if (!ts28.isIdentifier(decl.name) || decl.name.text !== "ITS_JUST_ANGULAR") {
|
|
6474
6089
|
return false;
|
|
6475
6090
|
}
|
|
6476
|
-
if (decl.initializer === void 0 || decl.initializer.kind !==
|
|
6091
|
+
if (decl.initializer === void 0 || decl.initializer.kind !== ts28.SyntaxKind.TrueKeyword) {
|
|
6477
6092
|
return false;
|
|
6478
6093
|
}
|
|
6479
6094
|
return true;
|
|
@@ -6487,7 +6102,7 @@ function* verifyCompatibleTypeCheckOptions(options) {
|
|
|
6487
6102
|
var _a, _b, _c;
|
|
6488
6103
|
if (options.fullTemplateTypeCheck === false && options.strictTemplates === true) {
|
|
6489
6104
|
yield makeConfigDiagnostic({
|
|
6490
|
-
category:
|
|
6105
|
+
category: ts28.DiagnosticCategory.Error,
|
|
6491
6106
|
code: ErrorCode.CONFIG_STRICT_TEMPLATES_IMPLIES_FULL_TEMPLATE_TYPECHECK,
|
|
6492
6107
|
messageText: `
|
|
6493
6108
|
Angular compiler option "strictTemplates" is enabled, however "fullTemplateTypeCheck" is disabled.
|
|
@@ -6506,7 +6121,7 @@ https://angular.io/guide/template-typecheck
|
|
|
6506
6121
|
}
|
|
6507
6122
|
if (options.extendedDiagnostics && options.strictTemplates === false) {
|
|
6508
6123
|
yield makeConfigDiagnostic({
|
|
6509
|
-
category:
|
|
6124
|
+
category: ts28.DiagnosticCategory.Error,
|
|
6510
6125
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_IMPLIES_STRICT_TEMPLATES,
|
|
6511
6126
|
messageText: `
|
|
6512
6127
|
Angular compiler option "extendedDiagnostics" is configured, however "strictTemplates" is disabled.
|
|
@@ -6523,7 +6138,7 @@ One of the following actions is required:
|
|
|
6523
6138
|
const defaultCategory = (_a = options.extendedDiagnostics) == null ? void 0 : _a.defaultCategory;
|
|
6524
6139
|
if (defaultCategory && !allowedCategoryLabels.includes(defaultCategory)) {
|
|
6525
6140
|
yield makeConfigDiagnostic({
|
|
6526
|
-
category:
|
|
6141
|
+
category: ts28.DiagnosticCategory.Error,
|
|
6527
6142
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
6528
6143
|
messageText: `
|
|
6529
6144
|
Angular compiler option "extendedDiagnostics.defaultCategory" has an unknown diagnostic category: "${defaultCategory}".
|
|
@@ -6537,7 +6152,7 @@ ${allowedCategoryLabels.join("\n")}
|
|
|
6537
6152
|
for (const [checkName, category] of Object.entries((_c = (_b = options.extendedDiagnostics) == null ? void 0 : _b.checks) != null ? _c : {})) {
|
|
6538
6153
|
if (!allExtendedDiagnosticNames.includes(checkName)) {
|
|
6539
6154
|
yield makeConfigDiagnostic({
|
|
6540
|
-
category:
|
|
6155
|
+
category: ts28.DiagnosticCategory.Error,
|
|
6541
6156
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CHECK,
|
|
6542
6157
|
messageText: `
|
|
6543
6158
|
Angular compiler option "extendedDiagnostics.checks" has an unknown check: "${checkName}".
|
|
@@ -6549,7 +6164,7 @@ ${allExtendedDiagnosticNames.join("\n")}
|
|
|
6549
6164
|
}
|
|
6550
6165
|
if (!allowedCategoryLabels.includes(category)) {
|
|
6551
6166
|
yield makeConfigDiagnostic({
|
|
6552
|
-
category:
|
|
6167
|
+
category: ts28.DiagnosticCategory.Error,
|
|
6553
6168
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
6554
6169
|
messageText: `
|
|
6555
6170
|
Angular compiler option "extendedDiagnostics.checks['${checkName}']" has an unknown diagnostic category: "${category}".
|
|
@@ -6579,7 +6194,7 @@ var ReferenceGraphAdapter = class {
|
|
|
6579
6194
|
for (const { node } of references) {
|
|
6580
6195
|
let sourceFile = node.getSourceFile();
|
|
6581
6196
|
if (sourceFile === void 0) {
|
|
6582
|
-
sourceFile =
|
|
6197
|
+
sourceFile = ts28.getOriginalNode(node).getSourceFile();
|
|
6583
6198
|
}
|
|
6584
6199
|
if (sourceFile === void 0 || !isDtsPath(sourceFile.fileName)) {
|
|
6585
6200
|
this.graph.add(source, node);
|
|
@@ -6618,7 +6233,7 @@ function versionMapFromProgram(program, driver) {
|
|
|
6618
6233
|
}
|
|
6619
6234
|
|
|
6620
6235
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/host.mjs
|
|
6621
|
-
import
|
|
6236
|
+
import ts29 from "typescript";
|
|
6622
6237
|
var DelegatingCompilerHost2 = class {
|
|
6623
6238
|
constructor(delegate) {
|
|
6624
6239
|
this.delegate = delegate;
|
|
@@ -6708,7 +6323,7 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
6708
6323
|
entryPoint = findFlatIndexEntryPoint(normalizedTsInputFiles);
|
|
6709
6324
|
if (entryPoint === null) {
|
|
6710
6325
|
diagnostics.push({
|
|
6711
|
-
category:
|
|
6326
|
+
category: ts29.DiagnosticCategory.Error,
|
|
6712
6327
|
code: ngErrorCode(ErrorCode.CONFIG_FLAT_MODULE_NO_INDEX),
|
|
6713
6328
|
file: void 0,
|
|
6714
6329
|
start: void 0,
|
|
@@ -6748,10 +6363,10 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
6748
6363
|
return this.fileNameToModuleName !== void 0 ? this : null;
|
|
6749
6364
|
}
|
|
6750
6365
|
createCachedResolveModuleNamesFunction() {
|
|
6751
|
-
const moduleResolutionCache =
|
|
6366
|
+
const moduleResolutionCache = ts29.createModuleResolutionCache(this.getCurrentDirectory(), this.getCanonicalFileName.bind(this));
|
|
6752
6367
|
return (moduleNames, containingFile, reusedNames, redirectedReference, options) => {
|
|
6753
6368
|
return moduleNames.map((moduleName) => {
|
|
6754
|
-
const module =
|
|
6369
|
+
const module = ts29.resolveModuleName(moduleName, containingFile, options, this, moduleResolutionCache, redirectedReference);
|
|
6755
6370
|
return module.resolvedModule;
|
|
6756
6371
|
});
|
|
6757
6372
|
};
|
|
@@ -6772,7 +6387,7 @@ var NgtscProgram = class {
|
|
|
6772
6387
|
if (reuseProgram !== void 0) {
|
|
6773
6388
|
retagAllTsFiles(reuseProgram);
|
|
6774
6389
|
}
|
|
6775
|
-
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () =>
|
|
6390
|
+
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () => ts30.createProgram(this.host.inputFiles, options, this.host, reuseProgram));
|
|
6776
6391
|
perfRecorder.phase(PerfPhase.Unaccounted);
|
|
6777
6392
|
perfRecorder.memory(PerfCheckpoint.TypeScriptProgramCreate);
|
|
6778
6393
|
this.host.postProgramCreationCleanup();
|
|
@@ -6971,17 +6586,17 @@ function createProgram({ rootNames, options, host, oldProgram }) {
|
|
|
6971
6586
|
}
|
|
6972
6587
|
|
|
6973
6588
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/perform_compile.mjs
|
|
6974
|
-
import
|
|
6589
|
+
import ts32 from "typescript";
|
|
6975
6590
|
|
|
6976
6591
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/util.mjs
|
|
6977
|
-
import
|
|
6592
|
+
import ts31 from "typescript";
|
|
6978
6593
|
var GENERATED_FILES = /(.*?)\.(ngfactory|shim\.ngstyle|ngstyle|ngsummary)\.(js|d\.ts|ts)$/;
|
|
6979
6594
|
function createMessageDiagnostic(messageText) {
|
|
6980
6595
|
return {
|
|
6981
6596
|
file: void 0,
|
|
6982
6597
|
start: void 0,
|
|
6983
6598
|
length: void 0,
|
|
6984
|
-
category:
|
|
6599
|
+
category: ts31.DiagnosticCategory.Message,
|
|
6985
6600
|
messageText,
|
|
6986
6601
|
code: DEFAULT_ERROR_CODE,
|
|
6987
6602
|
source: SOURCE
|
|
@@ -6990,13 +6605,13 @@ function createMessageDiagnostic(messageText) {
|
|
|
6990
6605
|
|
|
6991
6606
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/perform_compile.mjs
|
|
6992
6607
|
var defaultFormatHost = {
|
|
6993
|
-
getCurrentDirectory: () =>
|
|
6608
|
+
getCurrentDirectory: () => ts32.sys.getCurrentDirectory(),
|
|
6994
6609
|
getCanonicalFileName: (fileName) => fileName,
|
|
6995
|
-
getNewLine: () =>
|
|
6610
|
+
getNewLine: () => ts32.sys.newLine
|
|
6996
6611
|
};
|
|
6997
6612
|
function formatDiagnostics(diags, host = defaultFormatHost) {
|
|
6998
6613
|
if (diags && diags.length) {
|
|
6999
|
-
return diags.map((diagnostic) => replaceTsWithNgInErrors(
|
|
6614
|
+
return diags.map((diagnostic) => replaceTsWithNgInErrors(ts32.formatDiagnosticsWithColorAndContext([diagnostic], host))).join("");
|
|
7000
6615
|
} else {
|
|
7001
6616
|
return "";
|
|
7002
6617
|
}
|
|
@@ -7010,10 +6625,10 @@ function calcProjectFileAndBasePath(project, host = getFileSystem()) {
|
|
|
7010
6625
|
return { projectFile, basePath };
|
|
7011
6626
|
}
|
|
7012
6627
|
function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
7013
|
-
var _a;
|
|
6628
|
+
var _a, _b;
|
|
7014
6629
|
try {
|
|
7015
6630
|
const fs = getFileSystem();
|
|
7016
|
-
const readConfigFile = (configFile) =>
|
|
6631
|
+
const readConfigFile = (configFile) => ts32.readConfigFile(configFile, (file) => host.readFile(host.resolve(file)));
|
|
7017
6632
|
const readAngularCompilerOptions = (configFile, parentOptions = {}) => {
|
|
7018
6633
|
const { config: config2, error: error2 } = readConfigFile(configFile);
|
|
7019
6634
|
if (error2) {
|
|
@@ -7045,7 +6660,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7045
6660
|
basePath
|
|
7046
6661
|
}, readAngularCompilerOptions(configFileName)), existingOptions);
|
|
7047
6662
|
const parseConfigHost = createParseConfigHost(host, fs);
|
|
7048
|
-
const { options, errors, fileNames: rootNames, projectReferences } =
|
|
6663
|
+
const { options, errors, fileNames: rootNames, projectReferences } = ts32.parseJsonConfigFileContent(config, parseConfigHost, basePath, existingCompilerOptions, configFileName);
|
|
7049
6664
|
options.enableIvy = !!((_a = options.enableIvy) != null ? _a : true);
|
|
7050
6665
|
let emitFlags = EmitFlags.Default;
|
|
7051
6666
|
if (!(options.skipMetadataEmit || options.flatModuleOutFile)) {
|
|
@@ -7057,8 +6672,8 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7057
6672
|
return { project: projectFile, rootNames, projectReferences, options, errors, emitFlags };
|
|
7058
6673
|
} catch (e) {
|
|
7059
6674
|
const errors = [{
|
|
7060
|
-
category:
|
|
7061
|
-
messageText: e.stack,
|
|
6675
|
+
category: ts32.DiagnosticCategory.Error,
|
|
6676
|
+
messageText: (_b = e.stack) != null ? _b : e.message,
|
|
7062
6677
|
file: void 0,
|
|
7063
6678
|
start: void 0,
|
|
7064
6679
|
length: void 0,
|
|
@@ -7071,7 +6686,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
7071
6686
|
function createParseConfigHost(host, fs = getFileSystem()) {
|
|
7072
6687
|
return {
|
|
7073
6688
|
fileExists: host.exists.bind(host),
|
|
7074
|
-
readDirectory:
|
|
6689
|
+
readDirectory: ts32.sys.readDirectory,
|
|
7075
6690
|
readFile: host.readFile.bind(host),
|
|
7076
6691
|
useCaseSensitiveFileNames: fs.isCaseSensitive()
|
|
7077
6692
|
};
|
|
@@ -7091,7 +6706,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
|
7091
6706
|
}
|
|
7092
6707
|
} else {
|
|
7093
6708
|
const parseConfigHost = createParseConfigHost(host, fs);
|
|
7094
|
-
const { resolvedModule } =
|
|
6709
|
+
const { resolvedModule } = ts32.nodeModuleNameResolver(extendsValue, configFile, { moduleResolution: ts32.ModuleResolutionKind.NodeJs, resolveJsonModule: true }, parseConfigHost);
|
|
7095
6710
|
if (resolvedModule) {
|
|
7096
6711
|
return absoluteFrom(resolvedModule.resolvedFileName);
|
|
7097
6712
|
}
|
|
@@ -7101,12 +6716,13 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
|
7101
6716
|
function exitCodeFromResult(diags) {
|
|
7102
6717
|
if (!diags)
|
|
7103
6718
|
return 0;
|
|
7104
|
-
if (diags.every((diag) => diag.category !==
|
|
6719
|
+
if (diags.every((diag) => diag.category !== ts32.DiagnosticCategory.Error)) {
|
|
7105
6720
|
return 0;
|
|
7106
6721
|
}
|
|
7107
6722
|
return diags.some((d) => d.source === "angular" && d.code === UNKNOWN_ERROR_CODE) ? 2 : 1;
|
|
7108
6723
|
}
|
|
7109
6724
|
function performCompilation({ rootNames, options, host, oldProgram, emitCallback, mergeEmitResultsCallback, gatherDiagnostics = defaultGatherDiagnostics, customTransformers, emitFlags = EmitFlags.Default, modifiedResourceFiles = null }) {
|
|
6725
|
+
var _a;
|
|
7110
6726
|
let program;
|
|
7111
6727
|
let emitResult;
|
|
7112
6728
|
let allDiagnostics = [];
|
|
@@ -7133,8 +6749,8 @@ function performCompilation({ rootNames, options, host, oldProgram, emitCallback
|
|
|
7133
6749
|
} catch (e) {
|
|
7134
6750
|
program = void 0;
|
|
7135
6751
|
allDiagnostics.push({
|
|
7136
|
-
category:
|
|
7137
|
-
messageText: e.stack,
|
|
6752
|
+
category: ts32.DiagnosticCategory.Error,
|
|
6753
|
+
messageText: (_a = e.stack) != null ? _a : e.message,
|
|
7138
6754
|
code: UNKNOWN_ERROR_CODE,
|
|
7139
6755
|
file: void 0,
|
|
7140
6756
|
start: void 0,
|
|
@@ -7160,7 +6776,7 @@ function defaultGatherDiagnostics(program) {
|
|
|
7160
6776
|
return allDiagnostics;
|
|
7161
6777
|
}
|
|
7162
6778
|
function hasErrors(diags) {
|
|
7163
|
-
return diags.some((d) => d.category ===
|
|
6779
|
+
return diags.some((d) => d.category === ts32.DiagnosticCategory.Error);
|
|
7164
6780
|
}
|
|
7165
6781
|
|
|
7166
6782
|
export {
|
|
@@ -7174,9 +6790,6 @@ export {
|
|
|
7174
6790
|
ImportGraph,
|
|
7175
6791
|
TsCreateProgramDriver,
|
|
7176
6792
|
PatchedProgramIncrementalBuildStrategy,
|
|
7177
|
-
MetadataDtsModuleScopeResolver,
|
|
7178
|
-
LocalModuleScopeRegistry,
|
|
7179
|
-
TypeCheckScopeRegistry,
|
|
7180
6793
|
OptimizeFor,
|
|
7181
6794
|
freshCompilationTicket,
|
|
7182
6795
|
incrementalFromStateTicket,
|
|
@@ -7200,4 +6813,4 @@ export {
|
|
|
7200
6813
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7201
6814
|
* found in the LICENSE file at https://angular.io/license
|
|
7202
6815
|
*/
|
|
7203
|
-
//# sourceMappingURL=chunk-
|
|
6816
|
+
//# sourceMappingURL=chunk-ESNS3BVQ.js.map
|