@angular/compiler-cli 21.0.0-rc.0 → 21.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/{chunk-ZOZ6XVF3.js → chunk-5UJIUEKT.js} +220 -121
- package/bundles/{chunk-ZOLVJRLX.js → chunk-DBAV4W4V.js} +2 -2
- package/bundles/chunk-DT6FD4OE.js +1 -1
- package/bundles/{chunk-3CWKYDQ7.js → chunk-VBBJY6IR.js} +235 -20
- package/bundles/{chunk-HSIRUBJU.js → chunk-YVYYMXOI.js} +1 -1
- package/bundles/index.js +4 -4
- package/bundles/private/migrations.js +2 -2
- package/bundles/private/testing.js +1 -1
- package/bundles/private/tooling.js +1 -1
- package/bundles/src/bin/ng_xi18n.js +4 -4
- package/bundles/src/bin/ngc.js +4 -4
- package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
- package/package.json +2 -2
- package/src/ngtsc/diagnostics/src/error_code.d.ts +2 -0
- package/src/ngtsc/docs/src/entities.d.ts +7 -1
- package/src/ngtsc/docs/src/extractor.d.ts +6 -0
- package/src/ngtsc/docs/src/namespace_extractor.d.ts +15 -0
- package/src/ngtsc/docs/src/variable_extractor.d.ts +16 -0
- package/src/ngtsc/translator/src/translator.d.ts +1 -1
- package/src/ngtsc/typecheck/src/oob.d.ts +5 -0
|
@@ -87,7 +87,7 @@ import {
|
|
|
87
87
|
toUnredirectedSourceFile,
|
|
88
88
|
tryParseInitializerApi,
|
|
89
89
|
untagAllTsFiles
|
|
90
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-VBBJY6IR.js";
|
|
91
91
|
import {
|
|
92
92
|
LogicalFileSystem,
|
|
93
93
|
absoluteFromSourceFile,
|
|
@@ -114,6 +114,7 @@ var EntryType;
|
|
|
114
114
|
EntryType2["TypeAlias"] = "type_alias";
|
|
115
115
|
EntryType2["UndecoratedClass"] = "undecorated_class";
|
|
116
116
|
EntryType2["InitializerApiFunction"] = "initializer_api_function";
|
|
117
|
+
EntryType2["Namespace"] = "namespace";
|
|
117
118
|
})(EntryType || (EntryType = {}));
|
|
118
119
|
var MemberType;
|
|
119
120
|
(function(MemberType2) {
|
|
@@ -145,7 +146,7 @@ function isDocEntryWithSourceInfo(entry) {
|
|
|
145
146
|
}
|
|
146
147
|
|
|
147
148
|
// packages/compiler-cli/src/ngtsc/docs/src/extractor.js
|
|
148
|
-
import
|
|
149
|
+
import ts14 from "typescript";
|
|
149
150
|
|
|
150
151
|
// packages/compiler-cli/src/ngtsc/docs/src/class_extractor.js
|
|
151
152
|
import ts6 from "typescript";
|
|
@@ -979,31 +980,55 @@ function getEnumMemberValue(memberNode) {
|
|
|
979
980
|
return literal?.getText() ?? "";
|
|
980
981
|
}
|
|
981
982
|
|
|
982
|
-
// packages/compiler-cli/src/ngtsc/docs/src/
|
|
983
|
+
// packages/compiler-cli/src/ngtsc/docs/src/import_extractor.js
|
|
983
984
|
import ts11 from "typescript";
|
|
985
|
+
function getImportedSymbols(sourceFile) {
|
|
986
|
+
const importSpecifiers = /* @__PURE__ */ new Map();
|
|
987
|
+
function visit(node) {
|
|
988
|
+
if (ts11.isImportDeclaration(node)) {
|
|
989
|
+
let moduleSpecifier = node.moduleSpecifier.getText(sourceFile).replace(/['"]/g, "");
|
|
990
|
+
if (moduleSpecifier.startsWith("@angular/")) {
|
|
991
|
+
const namedBindings = node.importClause?.namedBindings;
|
|
992
|
+
if (namedBindings && ts11.isNamedImports(namedBindings)) {
|
|
993
|
+
namedBindings.elements.forEach((importSpecifier) => {
|
|
994
|
+
const importName = importSpecifier.name.text;
|
|
995
|
+
const importAlias = importSpecifier.propertyName ? importSpecifier.propertyName.text : void 0;
|
|
996
|
+
importSpecifiers.set(importAlias ?? importName, moduleSpecifier);
|
|
997
|
+
});
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
ts11.forEachChild(node, visit);
|
|
1002
|
+
}
|
|
1003
|
+
visit(sourceFile);
|
|
1004
|
+
return importSpecifiers;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
// packages/compiler-cli/src/ngtsc/docs/src/initializer_api_function_extractor.js
|
|
1008
|
+
import ts12 from "typescript";
|
|
984
1009
|
var initializerApiTag = "initializerApiFunction";
|
|
985
1010
|
function isInitializerApiFunction(node, typeChecker) {
|
|
986
|
-
if (
|
|
1011
|
+
if (ts12.isFunctionDeclaration(node) && node.name !== void 0 && node.body === void 0) {
|
|
987
1012
|
const implementation = findImplementationOfFunction(node, typeChecker);
|
|
988
1013
|
if (implementation !== void 0) {
|
|
989
1014
|
node = implementation;
|
|
990
1015
|
}
|
|
991
1016
|
}
|
|
992
|
-
if (!
|
|
1017
|
+
if (!ts12.isFunctionDeclaration(node) && !ts12.isVariableDeclaration(node)) {
|
|
993
1018
|
return false;
|
|
994
1019
|
}
|
|
995
|
-
let tagContainer =
|
|
1020
|
+
let tagContainer = ts12.isFunctionDeclaration(node) ? node : getContainerVariableStatement(node);
|
|
996
1021
|
if (tagContainer === null) {
|
|
997
1022
|
return false;
|
|
998
1023
|
}
|
|
999
|
-
const tags =
|
|
1024
|
+
const tags = ts12.getJSDocTags(tagContainer);
|
|
1000
1025
|
return tags.some((t) => t.tagName.text === initializerApiTag);
|
|
1001
1026
|
}
|
|
1002
1027
|
function extractInitializerApiFunction(node, typeChecker) {
|
|
1003
|
-
if (node.name === void 0 || !
|
|
1028
|
+
if (node.name === void 0 || !ts12.isIdentifier(node.name)) {
|
|
1004
1029
|
throw new Error(`Initializer API: Expected literal variable name.`);
|
|
1005
1030
|
}
|
|
1006
|
-
const container =
|
|
1031
|
+
const container = ts12.isFunctionDeclaration(node) ? node : getContainerVariableStatement(node);
|
|
1007
1032
|
if (container === null) {
|
|
1008
1033
|
throw new Error("Initializer API: Could not find container AST node of variable.");
|
|
1009
1034
|
}
|
|
@@ -1014,7 +1039,7 @@ function extractInitializerApiFunction(node, typeChecker) {
|
|
|
1014
1039
|
for (const property of type.getProperties()) {
|
|
1015
1040
|
const subName = property.getName();
|
|
1016
1041
|
const subDecl = property.getDeclarations()?.[0];
|
|
1017
|
-
if (subDecl === void 0 || !
|
|
1042
|
+
if (subDecl === void 0 || !ts12.isPropertySignature(subDecl)) {
|
|
1018
1043
|
throw new Error(`Initializer API: Could not resolve declaration of sub-property: ${name}.${subName}`);
|
|
1019
1044
|
}
|
|
1020
1045
|
const subType = typeChecker.getTypeAtLocation(subDecl);
|
|
@@ -1023,7 +1048,7 @@ function extractInitializerApiFunction(node, typeChecker) {
|
|
|
1023
1048
|
let jsdocTags;
|
|
1024
1049
|
let description;
|
|
1025
1050
|
let rawComment;
|
|
1026
|
-
if (
|
|
1051
|
+
if (ts12.isFunctionDeclaration(node)) {
|
|
1027
1052
|
const implementation = findImplementationOfFunction(node, typeChecker);
|
|
1028
1053
|
if (implementation === void 0) {
|
|
1029
1054
|
throw new Error(`Initializer API: Could not find implementation of function: ${name}`);
|
|
@@ -1071,10 +1096,10 @@ function extractInitializerApiFunction(node, typeChecker) {
|
|
|
1071
1096
|
};
|
|
1072
1097
|
}
|
|
1073
1098
|
function getContainerVariableStatement(node) {
|
|
1074
|
-
if (!
|
|
1099
|
+
if (!ts12.isVariableDeclarationList(node.parent)) {
|
|
1075
1100
|
return null;
|
|
1076
1101
|
}
|
|
1077
|
-
if (!
|
|
1102
|
+
if (!ts12.isVariableStatement(node.parent.parent)) {
|
|
1078
1103
|
return null;
|
|
1079
1104
|
}
|
|
1080
1105
|
return node.parent.parent;
|
|
@@ -1088,6 +1113,9 @@ function extractFunctionWithOverloads(name, type, typeChecker) {
|
|
|
1088
1113
|
};
|
|
1089
1114
|
}
|
|
1090
1115
|
|
|
1116
|
+
// packages/compiler-cli/src/ngtsc/docs/src/namespace_extractor.js
|
|
1117
|
+
import ts13 from "typescript";
|
|
1118
|
+
|
|
1091
1119
|
// packages/compiler-cli/src/ngtsc/docs/src/type_alias_extractor.js
|
|
1092
1120
|
function extractTypeAlias(declaration) {
|
|
1093
1121
|
return {
|
|
@@ -1101,28 +1129,46 @@ function extractTypeAlias(declaration) {
|
|
|
1101
1129
|
};
|
|
1102
1130
|
}
|
|
1103
1131
|
|
|
1104
|
-
// packages/compiler-cli/src/ngtsc/docs/src/
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1132
|
+
// packages/compiler-cli/src/ngtsc/docs/src/variable_extractor.js
|
|
1133
|
+
function extractFromVariableStatement(statement, typeChecker) {
|
|
1134
|
+
return statement.declarationList.declarations.map((declaration) => extractConstant(declaration, typeChecker));
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
// packages/compiler-cli/src/ngtsc/docs/src/namespace_extractor.js
|
|
1138
|
+
function extractNamespace(node, typeChecker) {
|
|
1139
|
+
const members = [];
|
|
1140
|
+
if (node.body && ts13.isModuleBlock(node.body)) {
|
|
1141
|
+
for (const statement of node.body.statements) {
|
|
1142
|
+
let entries = [];
|
|
1143
|
+
if (ts13.isInterfaceDeclaration(statement)) {
|
|
1144
|
+
entries.push(extractInterface(statement, typeChecker));
|
|
1145
|
+
} else if (ts13.isTypeAliasDeclaration(statement)) {
|
|
1146
|
+
entries.push(extractTypeAlias(statement));
|
|
1147
|
+
} else if (ts13.isFunctionDeclaration(statement)) {
|
|
1148
|
+
const name = statement.name?.getText();
|
|
1149
|
+
if (name) {
|
|
1150
|
+
entries.push(new FunctionExtractor(name, statement, typeChecker).extract());
|
|
1119
1151
|
}
|
|
1152
|
+
} else if (ts13.isVariableStatement(statement)) {
|
|
1153
|
+
entries.push(...extractFromVariableStatement(statement, typeChecker));
|
|
1154
|
+
}
|
|
1155
|
+
let isExported = false;
|
|
1156
|
+
if (ts13.canHaveModifiers(statement)) {
|
|
1157
|
+
isExported = (ts13.getModifiers(statement) ?? []).some((modifier) => modifier.kind === ts13.SyntaxKind.ExportKeyword);
|
|
1158
|
+
}
|
|
1159
|
+
if (isExported) {
|
|
1160
|
+
members.push(...entries);
|
|
1120
1161
|
}
|
|
1121
1162
|
}
|
|
1122
|
-
ts12.forEachChild(node, visit);
|
|
1123
1163
|
}
|
|
1124
|
-
|
|
1125
|
-
|
|
1164
|
+
return {
|
|
1165
|
+
name: node.name.getText(),
|
|
1166
|
+
entryType: EntryType.Namespace,
|
|
1167
|
+
description: extractJsDocDescription(node),
|
|
1168
|
+
rawComment: extractRawJsDoc(node),
|
|
1169
|
+
jsdocTags: extractJsDocTags(node),
|
|
1170
|
+
members
|
|
1171
|
+
};
|
|
1126
1172
|
}
|
|
1127
1173
|
|
|
1128
1174
|
// packages/compiler-cli/src/ngtsc/docs/src/extractor.js
|
|
@@ -1143,34 +1189,63 @@ var DocsExtractor = class {
|
|
|
1143
1189
|
const entries = [];
|
|
1144
1190
|
const symbols = /* @__PURE__ */ new Map();
|
|
1145
1191
|
const exportedDeclarations = this.getExportedDeclarations(sourceFile);
|
|
1146
|
-
|
|
1192
|
+
const groupedDeclarations = /* @__PURE__ */ new Map();
|
|
1193
|
+
for (const [exportName, declaration] of exportedDeclarations) {
|
|
1194
|
+
if (!groupedDeclarations.has(exportName)) {
|
|
1195
|
+
groupedDeclarations.set(exportName, []);
|
|
1196
|
+
}
|
|
1197
|
+
groupedDeclarations.get(exportName).push(declaration);
|
|
1198
|
+
}
|
|
1199
|
+
for (const [exportName, declarations] of groupedDeclarations.entries()) {
|
|
1147
1200
|
if (isAngularPrivateName(exportName)) {
|
|
1148
1201
|
continue;
|
|
1149
1202
|
}
|
|
1150
|
-
const entry = this.
|
|
1203
|
+
const entry = this.extractDeclarations(exportName, declarations);
|
|
1151
1204
|
if (entry && !isIgnoredDocEntry(entry)) {
|
|
1152
|
-
const realSourceFile =
|
|
1205
|
+
const realSourceFile = declarations[0].getSourceFile();
|
|
1153
1206
|
const importedSymbols = getImportedSymbols(realSourceFile);
|
|
1154
1207
|
importedSymbols.forEach((moduleName, symbolName) => {
|
|
1155
1208
|
if (symbolName.startsWith("\u0275") || privateModules.has(moduleName)) {
|
|
1156
1209
|
return;
|
|
1157
1210
|
}
|
|
1158
1211
|
if (symbols.has(symbolName) && symbols.get(symbolName) !== moduleName) {
|
|
1159
|
-
throw new Error(`
|
|
1212
|
+
throw new Error(`Ambiguous symbol \`${symbolName}\` exported by both ${symbols.get(symbolName)} & ${moduleName}`);
|
|
1160
1213
|
}
|
|
1161
1214
|
symbols.set(symbolName, moduleName);
|
|
1162
1215
|
});
|
|
1163
1216
|
entry.source = {
|
|
1164
1217
|
filePath: getRelativeFilePath(realSourceFile, rootDir),
|
|
1165
1218
|
// Start & End are off by 1
|
|
1166
|
-
startLine:
|
|
1167
|
-
endLine:
|
|
1219
|
+
startLine: ts14.getLineAndCharacterOfPosition(realSourceFile, declarations[0].getStart()).line + 1,
|
|
1220
|
+
endLine: ts14.getLineAndCharacterOfPosition(realSourceFile, declarations[0].getEnd()).line + 1
|
|
1168
1221
|
};
|
|
1169
1222
|
entries.push({ ...entry, name: exportName });
|
|
1170
1223
|
}
|
|
1171
1224
|
}
|
|
1172
1225
|
return { entries, symbols };
|
|
1173
1226
|
}
|
|
1227
|
+
/**
|
|
1228
|
+
* Extracts a documentation entry for a given set of declarations that are all exported under
|
|
1229
|
+
* the same name. This is used to combine entries, e.g. for a type and a namespace that are
|
|
1230
|
+
* exported under the same name.
|
|
1231
|
+
*/
|
|
1232
|
+
extractDeclarations(exportName, nodes) {
|
|
1233
|
+
const entries = nodes.map((node) => this.extractDeclaration(node));
|
|
1234
|
+
const decorator = entries.find((e) => e?.entryType === EntryType.Decorator);
|
|
1235
|
+
if (decorator) {
|
|
1236
|
+
return decorator;
|
|
1237
|
+
}
|
|
1238
|
+
const entry = entries[0];
|
|
1239
|
+
if (entries.length > 1) {
|
|
1240
|
+
const typeAlias = entries.find(isTypeAliasEntry);
|
|
1241
|
+
const namespace = entries.find(isNamespaceEntry);
|
|
1242
|
+
if (typeAlias && namespace) {
|
|
1243
|
+
typeAlias.members = namespace.members;
|
|
1244
|
+
return typeAlias;
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
return entry ?? null;
|
|
1248
|
+
}
|
|
1174
1249
|
/** Extract the doc entry for a single declaration. */
|
|
1175
1250
|
extractDeclaration(node) {
|
|
1176
1251
|
if (isNamedClassDeclaration(node)) {
|
|
@@ -1179,30 +1254,48 @@ var DocsExtractor = class {
|
|
|
1179
1254
|
if (isInitializerApiFunction(node, this.typeChecker)) {
|
|
1180
1255
|
return extractInitializerApiFunction(node, this.typeChecker);
|
|
1181
1256
|
}
|
|
1182
|
-
if (
|
|
1257
|
+
if (ts14.isInterfaceDeclaration(node) && !isIgnoredInterface(node)) {
|
|
1183
1258
|
return extractInterface(node, this.typeChecker);
|
|
1184
1259
|
}
|
|
1185
|
-
if (
|
|
1260
|
+
if (ts14.isFunctionDeclaration(node)) {
|
|
1186
1261
|
const functionExtractor = new FunctionExtractor(node.name.getText(), node, this.typeChecker);
|
|
1187
1262
|
return functionExtractor.extract();
|
|
1188
1263
|
}
|
|
1189
|
-
if (
|
|
1264
|
+
if (ts14.isVariableDeclaration(node) && !isSyntheticAngularConstant(node)) {
|
|
1190
1265
|
return isDecoratorDeclaration(node) ? extractorDecorator(node, this.typeChecker) : extractConstant(node, this.typeChecker);
|
|
1191
1266
|
}
|
|
1192
|
-
if (
|
|
1267
|
+
if (ts14.isTypeAliasDeclaration(node)) {
|
|
1193
1268
|
return extractTypeAlias(node);
|
|
1194
1269
|
}
|
|
1195
|
-
if (
|
|
1270
|
+
if (ts14.isEnumDeclaration(node)) {
|
|
1196
1271
|
return extractEnum(node, this.typeChecker);
|
|
1197
1272
|
}
|
|
1273
|
+
if (ts14.isModuleDeclaration(node)) {
|
|
1274
|
+
return extractNamespace(node, this.typeChecker);
|
|
1275
|
+
}
|
|
1198
1276
|
return null;
|
|
1199
1277
|
}
|
|
1200
1278
|
/** Gets the list of exported declarations for doc extraction. */
|
|
1201
1279
|
getExportedDeclarations(sourceFile) {
|
|
1202
|
-
const
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1280
|
+
const moduleSymbol = this.typeChecker.getSymbolAtLocation(sourceFile);
|
|
1281
|
+
if (!moduleSymbol) {
|
|
1282
|
+
return [];
|
|
1283
|
+
}
|
|
1284
|
+
const exportedSymbols = this.typeChecker.getExportsOfModule(moduleSymbol);
|
|
1285
|
+
const result = [];
|
|
1286
|
+
for (const symbol of exportedSymbols) {
|
|
1287
|
+
let declarations = symbol.getDeclarations();
|
|
1288
|
+
if (symbol.flags & ts14.SymbolFlags.Alias) {
|
|
1289
|
+
const aliasedSymbol = this.typeChecker.getAliasedSymbol(symbol);
|
|
1290
|
+
declarations = aliasedSymbol.getDeclarations();
|
|
1291
|
+
}
|
|
1292
|
+
if (declarations) {
|
|
1293
|
+
for (const declaration of declarations) {
|
|
1294
|
+
result.push([symbol.name, declaration]);
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
return result.sort(([, declarationA], [, declarationB]) => declarationA.pos - declarationB.pos);
|
|
1206
1299
|
}
|
|
1207
1300
|
};
|
|
1208
1301
|
function isIgnoredInterface(node) {
|
|
@@ -1220,6 +1313,12 @@ function getRelativeFilePath(sourceFile, rootDir) {
|
|
|
1220
1313
|
const relativePath = fullPath.replace(rootDir, "");
|
|
1221
1314
|
return relativePath;
|
|
1222
1315
|
}
|
|
1316
|
+
function isTypeAliasEntry(e) {
|
|
1317
|
+
return e?.entryType === EntryType.TypeAlias;
|
|
1318
|
+
}
|
|
1319
|
+
function isNamespaceEntry(e) {
|
|
1320
|
+
return e?.entryType === EntryType.Namespace;
|
|
1321
|
+
}
|
|
1223
1322
|
|
|
1224
1323
|
// packages/compiler-cli/src/ngtsc/core/api/src/public_options.js
|
|
1225
1324
|
var DiagnosticCategoryLabel;
|
|
@@ -1230,7 +1329,7 @@ var DiagnosticCategoryLabel;
|
|
|
1230
1329
|
})(DiagnosticCategoryLabel || (DiagnosticCategoryLabel = {}));
|
|
1231
1330
|
|
|
1232
1331
|
// packages/compiler-cli/src/ngtsc/core/src/compiler.js
|
|
1233
|
-
import
|
|
1332
|
+
import ts27 from "typescript";
|
|
1234
1333
|
|
|
1235
1334
|
// packages/compiler-cli/src/ngtsc/cycles/src/analyzer.js
|
|
1236
1335
|
var CycleAnalyzer = class {
|
|
@@ -1339,7 +1438,7 @@ var Cycle = class {
|
|
|
1339
1438
|
};
|
|
1340
1439
|
|
|
1341
1440
|
// packages/compiler-cli/src/ngtsc/cycles/src/imports.js
|
|
1342
|
-
import
|
|
1441
|
+
import ts15 from "typescript";
|
|
1343
1442
|
var ImportGraph = class {
|
|
1344
1443
|
checker;
|
|
1345
1444
|
perf;
|
|
@@ -1405,10 +1504,10 @@ var ImportGraph = class {
|
|
|
1405
1504
|
return this.perf.inPhase(PerfPhase.CycleDetection, () => {
|
|
1406
1505
|
const imports = /* @__PURE__ */ new Set();
|
|
1407
1506
|
for (const stmt of sf.statements) {
|
|
1408
|
-
if (!
|
|
1507
|
+
if (!ts15.isImportDeclaration(stmt) && !ts15.isExportDeclaration(stmt) || stmt.moduleSpecifier === void 0) {
|
|
1409
1508
|
continue;
|
|
1410
1509
|
}
|
|
1411
|
-
if (
|
|
1510
|
+
if (ts15.isImportDeclaration(stmt) && stmt.importClause !== void 0 && isTypeOnlyImportClause(stmt.importClause)) {
|
|
1412
1511
|
continue;
|
|
1413
1512
|
}
|
|
1414
1513
|
const symbol = this.checker.getSymbolAtLocation(stmt.moduleSpecifier);
|
|
@@ -1416,7 +1515,7 @@ var ImportGraph = class {
|
|
|
1416
1515
|
continue;
|
|
1417
1516
|
}
|
|
1418
1517
|
const moduleFile = symbol.valueDeclaration;
|
|
1419
|
-
if (
|
|
1518
|
+
if (ts15.isSourceFile(moduleFile) && isLocalFile(moduleFile)) {
|
|
1420
1519
|
imports.add(moduleFile);
|
|
1421
1520
|
}
|
|
1422
1521
|
}
|
|
@@ -1431,7 +1530,7 @@ function isTypeOnlyImportClause(node) {
|
|
|
1431
1530
|
if (node.isTypeOnly) {
|
|
1432
1531
|
return true;
|
|
1433
1532
|
}
|
|
1434
|
-
if (node.namedBindings !== void 0 &&
|
|
1533
|
+
if (node.namedBindings !== void 0 && ts15.isNamedImports(node.namedBindings) && node.namedBindings.elements.every((specifier) => specifier.isTypeOnly)) {
|
|
1435
1534
|
return true;
|
|
1436
1535
|
}
|
|
1437
1536
|
return false;
|
|
@@ -1459,7 +1558,7 @@ var Found = class {
|
|
|
1459
1558
|
};
|
|
1460
1559
|
|
|
1461
1560
|
// packages/compiler-cli/src/ngtsc/entry_point/src/generator.js
|
|
1462
|
-
import
|
|
1561
|
+
import ts16 from "typescript";
|
|
1463
1562
|
var FlatIndexGenerator = class {
|
|
1464
1563
|
entryPoint;
|
|
1465
1564
|
moduleName;
|
|
@@ -1478,7 +1577,7 @@ var FlatIndexGenerator = class {
|
|
|
1478
1577
|
|
|
1479
1578
|
export * from '${relativeEntryPoint}';
|
|
1480
1579
|
`;
|
|
1481
|
-
const genFile =
|
|
1580
|
+
const genFile = ts16.createSourceFile(this.flatIndexPath, contents, ts16.ScriptTarget.ES2015, true, ts16.ScriptKind.TS);
|
|
1482
1581
|
if (this.moduleName !== null) {
|
|
1483
1582
|
genFile.moduleName = this.moduleName;
|
|
1484
1583
|
}
|
|
@@ -1503,7 +1602,7 @@ function findFlatIndexEntryPoint(rootFiles) {
|
|
|
1503
1602
|
}
|
|
1504
1603
|
|
|
1505
1604
|
// packages/compiler-cli/src/ngtsc/entry_point/src/private_export_checker.js
|
|
1506
|
-
import
|
|
1605
|
+
import ts17 from "typescript";
|
|
1507
1606
|
function checkForPrivateExports(entryPoint, checker, refGraph) {
|
|
1508
1607
|
const diagnostics = [];
|
|
1509
1608
|
const topLevelExports = /* @__PURE__ */ new Set();
|
|
@@ -1513,7 +1612,7 @@ function checkForPrivateExports(entryPoint, checker, refGraph) {
|
|
|
1513
1612
|
}
|
|
1514
1613
|
const exportedSymbols = checker.getExportsOfModule(moduleSymbol);
|
|
1515
1614
|
exportedSymbols.forEach((symbol) => {
|
|
1516
|
-
if (symbol.flags &
|
|
1615
|
+
if (symbol.flags & ts17.SymbolFlags.Alias) {
|
|
1517
1616
|
symbol = checker.getAliasedSymbol(symbol);
|
|
1518
1617
|
}
|
|
1519
1618
|
const decl = symbol.valueDeclaration;
|
|
@@ -1537,7 +1636,7 @@ function checkForPrivateExports(entryPoint, checker, refGraph) {
|
|
|
1537
1636
|
visibleVia = transitivePath.map((seg) => getNameOfDeclaration(seg)).join(" -> ");
|
|
1538
1637
|
}
|
|
1539
1638
|
const diagnostic = {
|
|
1540
|
-
category:
|
|
1639
|
+
category: ts17.DiagnosticCategory.Error,
|
|
1541
1640
|
code: ngErrorCode(ErrorCode.SYMBOL_NOT_EXPORTED),
|
|
1542
1641
|
file: transitiveReference.getSourceFile(),
|
|
1543
1642
|
...getPosOfDeclaration(transitiveReference),
|
|
@@ -1557,7 +1656,7 @@ function getPosOfDeclaration(decl) {
|
|
|
1557
1656
|
};
|
|
1558
1657
|
}
|
|
1559
1658
|
function getIdentifierOfDeclaration(decl) {
|
|
1560
|
-
if ((
|
|
1659
|
+
if ((ts17.isClassDeclaration(decl) || ts17.isVariableDeclaration(decl) || ts17.isFunctionDeclaration(decl)) && decl.name !== void 0 && ts17.isIdentifier(decl.name)) {
|
|
1561
1660
|
return decl.name;
|
|
1562
1661
|
} else {
|
|
1563
1662
|
return null;
|
|
@@ -1569,13 +1668,13 @@ function getNameOfDeclaration(decl) {
|
|
|
1569
1668
|
}
|
|
1570
1669
|
function getDescriptorOfDeclaration(decl) {
|
|
1571
1670
|
switch (decl.kind) {
|
|
1572
|
-
case
|
|
1671
|
+
case ts17.SyntaxKind.ClassDeclaration:
|
|
1573
1672
|
return "class";
|
|
1574
|
-
case
|
|
1673
|
+
case ts17.SyntaxKind.FunctionDeclaration:
|
|
1575
1674
|
return "function";
|
|
1576
|
-
case
|
|
1675
|
+
case ts17.SyntaxKind.VariableDeclaration:
|
|
1577
1676
|
return "variable";
|
|
1578
|
-
case
|
|
1677
|
+
case ts17.SyntaxKind.EnumDeclaration:
|
|
1579
1678
|
return "enum";
|
|
1580
1679
|
default:
|
|
1581
1680
|
return "declaration";
|
|
@@ -2415,7 +2514,7 @@ var NgModuleIndexImpl = class {
|
|
|
2415
2514
|
};
|
|
2416
2515
|
|
|
2417
2516
|
// packages/compiler-cli/src/ngtsc/resource/src/loader.js
|
|
2418
|
-
import
|
|
2517
|
+
import ts18 from "typescript";
|
|
2419
2518
|
var CSS_PREPROCESSOR_EXT = /(\.scss|\.sass|\.less|\.styl)$/;
|
|
2420
2519
|
var RESOURCE_MARKER = ".$ngresource$";
|
|
2421
2520
|
var RESOURCE_MARKER_TS = RESOURCE_MARKER + ".ts";
|
|
@@ -2591,7 +2690,7 @@ var AdapterResourceLoader = class {
|
|
|
2591
2690
|
* for the file by setting up a module resolution for it that will fail.
|
|
2592
2691
|
*/
|
|
2593
2692
|
getResolvedCandidateLocations(url, fromFile) {
|
|
2594
|
-
const failedLookup =
|
|
2693
|
+
const failedLookup = ts18.resolveModuleName(url + RESOURCE_MARKER, fromFile, this.options, this.lookupResolutionHost);
|
|
2595
2694
|
if (failedLookup.failedLookupLocations === void 0) {
|
|
2596
2695
|
throw new Error(`Internal error: expected to find failedLookupLocations during resolution of resource '${url}' in context of ${fromFile}`);
|
|
2597
2696
|
}
|
|
@@ -2727,7 +2826,7 @@ var StandaloneComponentScopeReader = class {
|
|
|
2727
2826
|
import { ASTWithSource as ASTWithSource2, BindingType, Interpolation, PrefixNot, PropertyRead as PropertyRead2, TmplAstBoundAttribute, TmplAstElement as TmplAstElement2, TmplAstIfBlock, TmplAstSwitchBlock, TmplAstTemplate as TmplAstTemplate2 } from "@angular/compiler";
|
|
2728
2827
|
|
|
2729
2828
|
// packages/compiler-cli/src/ngtsc/typecheck/src/symbol_util.js
|
|
2730
|
-
import
|
|
2829
|
+
import ts19 from "typescript";
|
|
2731
2830
|
var SIGNAL_FNS = /* @__PURE__ */ new Set([
|
|
2732
2831
|
"WritableSignal",
|
|
2733
2832
|
"Signal",
|
|
@@ -2744,7 +2843,7 @@ function isSignalSymbol(symbol) {
|
|
|
2744
2843
|
const declarations = symbol.getDeclarations();
|
|
2745
2844
|
return declarations !== void 0 && declarations.some((decl) => {
|
|
2746
2845
|
const fileName = decl.getSourceFile().fileName;
|
|
2747
|
-
return (
|
|
2846
|
+
return (ts19.isInterfaceDeclaration(decl) || ts19.isTypeAliasDeclaration(decl)) && SIGNAL_FNS.has(decl.name.text) && (fileName.includes("@angular/core") || fileName.includes("angular2/rc/packages/core") || fileName.includes("bin/packages/core"));
|
|
2748
2847
|
});
|
|
2749
2848
|
}
|
|
2750
2849
|
|
|
@@ -3033,7 +3132,7 @@ var factory5 = {
|
|
|
3033
3132
|
|
|
3034
3133
|
// packages/compiler-cli/src/ngtsc/typecheck/extended/checks/nullish_coalescing_not_nullable/index.js
|
|
3035
3134
|
import { Binary } from "@angular/compiler";
|
|
3036
|
-
import
|
|
3135
|
+
import ts20 from "typescript";
|
|
3037
3136
|
var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
3038
3137
|
code = ErrorCode.NULLISH_COALESCING_NOT_NULLABLE;
|
|
3039
3138
|
visitNode(ctx, component, node) {
|
|
@@ -3044,7 +3143,7 @@ var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
3044
3143
|
return [];
|
|
3045
3144
|
}
|
|
3046
3145
|
const typeLeft = symbolLeft.tsType;
|
|
3047
|
-
if (typeLeft.flags & (
|
|
3146
|
+
if (typeLeft.flags & (ts20.TypeFlags.Any | ts20.TypeFlags.Unknown)) {
|
|
3048
3147
|
return [];
|
|
3049
3148
|
}
|
|
3050
3149
|
if (typeLeft.getNonNullableType() !== typeLeft)
|
|
@@ -3075,7 +3174,7 @@ var factory6 = {
|
|
|
3075
3174
|
|
|
3076
3175
|
// packages/compiler-cli/src/ngtsc/typecheck/extended/checks/optional_chain_not_nullable/index.js
|
|
3077
3176
|
import { KeyedRead, SafeCall, SafeKeyedRead, SafePropertyRead } from "@angular/compiler";
|
|
3078
|
-
import
|
|
3177
|
+
import ts21 from "typescript";
|
|
3079
3178
|
var OptionalChainNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
3080
3179
|
noUncheckedIndexedAccess;
|
|
3081
3180
|
code = ErrorCode.OPTIONAL_CHAIN_NOT_NULLABLE;
|
|
@@ -3095,7 +3194,7 @@ var OptionalChainNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
3095
3194
|
return [];
|
|
3096
3195
|
}
|
|
3097
3196
|
const typeLeft = symbolLeft.tsType;
|
|
3098
|
-
if (typeLeft.flags & (
|
|
3197
|
+
if (typeLeft.flags & (ts21.TypeFlags.Any | ts21.TypeFlags.Unknown)) {
|
|
3099
3198
|
return [];
|
|
3100
3199
|
}
|
|
3101
3200
|
if (typeLeft.getNonNullableType() !== typeLeft)
|
|
@@ -3465,7 +3564,7 @@ var factory16 = {
|
|
|
3465
3564
|
};
|
|
3466
3565
|
|
|
3467
3566
|
// packages/compiler-cli/src/ngtsc/typecheck/extended/src/extended_template_checker.js
|
|
3468
|
-
import
|
|
3567
|
+
import ts22 from "typescript";
|
|
3469
3568
|
var ExtendedTemplateCheckerImpl = class {
|
|
3470
3569
|
partialCtx;
|
|
3471
3570
|
templateChecks;
|
|
@@ -3507,9 +3606,9 @@ var ExtendedTemplateCheckerImpl = class {
|
|
|
3507
3606
|
function diagnosticLabelToCategory(label) {
|
|
3508
3607
|
switch (label) {
|
|
3509
3608
|
case DiagnosticCategoryLabel.Warning:
|
|
3510
|
-
return
|
|
3609
|
+
return ts22.DiagnosticCategory.Warning;
|
|
3511
3610
|
case DiagnosticCategoryLabel.Error:
|
|
3512
|
-
return
|
|
3611
|
+
return ts22.DiagnosticCategory.Error;
|
|
3513
3612
|
case DiagnosticCategoryLabel.Suppress:
|
|
3514
3613
|
return null;
|
|
3515
3614
|
default:
|
|
@@ -3548,7 +3647,7 @@ var SUPPORTED_DIAGNOSTIC_NAMES = /* @__PURE__ */ new Set([
|
|
|
3548
3647
|
|
|
3549
3648
|
// packages/compiler-cli/src/ngtsc/typecheck/template_semantics/src/template_semantics_checker.js
|
|
3550
3649
|
import { ASTWithSource as ASTWithSource5, ImplicitReceiver as ImplicitReceiver2, ParsedEventType as ParsedEventType2, PropertyRead as PropertyRead6, Binary as Binary3, RecursiveAstVisitor, TmplAstBoundEvent as TmplAstBoundEvent3, TmplAstLetDeclaration as TmplAstLetDeclaration2, TmplAstRecursiveVisitor, TmplAstVariable as TmplAstVariable2 } from "@angular/compiler";
|
|
3551
|
-
import
|
|
3650
|
+
import ts23 from "typescript";
|
|
3552
3651
|
var TemplateSemanticsCheckerImpl = class {
|
|
3553
3652
|
templateTypeChecker;
|
|
3554
3653
|
constructor(templateTypeChecker) {
|
|
@@ -3631,7 +3730,7 @@ var ExpressionsSemanticsVisitor = class extends RecursiveAstVisitor {
|
|
|
3631
3730
|
}
|
|
3632
3731
|
makeIllegalTemplateVarDiagnostic(target, expressionNode, errorMessage) {
|
|
3633
3732
|
const span = target instanceof TmplAstVariable2 ? target.valueSpan || target.sourceSpan : target.sourceSpan;
|
|
3634
|
-
return this.templateTypeChecker.makeTemplateDiagnostic(this.component, expressionNode.handlerSpan,
|
|
3733
|
+
return this.templateTypeChecker.makeTemplateDiagnostic(this.component, expressionNode.handlerSpan, ts23.DiagnosticCategory.Error, ngErrorCode(ErrorCode.WRITE_TO_READ_ONLY_VARIABLE), errorMessage, [
|
|
3635
3734
|
{
|
|
3636
3735
|
text: `'${target.name}' is declared here.`,
|
|
3637
3736
|
start: span.start.offset,
|
|
@@ -3646,7 +3745,7 @@ function unwrapAstWithSource(ast) {
|
|
|
3646
3745
|
}
|
|
3647
3746
|
|
|
3648
3747
|
// packages/compiler-cli/src/ngtsc/validation/src/rules/initializer_api_usage_rule.js
|
|
3649
|
-
import
|
|
3748
|
+
import ts24 from "typescript";
|
|
3650
3749
|
var APIS_TO_CHECK = [
|
|
3651
3750
|
INPUT_INITIALIZER_FN,
|
|
3652
3751
|
MODEL_INITIALIZER_FN,
|
|
@@ -3666,13 +3765,13 @@ var InitializerApiUsageRule = class {
|
|
|
3666
3765
|
});
|
|
3667
3766
|
}
|
|
3668
3767
|
checkNode(node) {
|
|
3669
|
-
if (!
|
|
3768
|
+
if (!ts24.isCallExpression(node)) {
|
|
3670
3769
|
return null;
|
|
3671
3770
|
}
|
|
3672
|
-
while (node.parent && (
|
|
3771
|
+
while (node.parent && (ts24.isParenthesizedExpression(node.parent) || ts24.isAsExpression(node.parent))) {
|
|
3673
3772
|
node = node.parent;
|
|
3674
3773
|
}
|
|
3675
|
-
if (!node.parent || !
|
|
3774
|
+
if (!node.parent || !ts24.isCallExpression(node)) {
|
|
3676
3775
|
return null;
|
|
3677
3776
|
}
|
|
3678
3777
|
const identifiedInitializer = tryParseInitializerApi(APIS_TO_CHECK, node, this.reflector, this.importedSymbolsTracker);
|
|
@@ -3680,12 +3779,12 @@ var InitializerApiUsageRule = class {
|
|
|
3680
3779
|
return null;
|
|
3681
3780
|
}
|
|
3682
3781
|
const functionName = identifiedInitializer.api.functionName + (identifiedInitializer.isRequired ? ".required" : "");
|
|
3683
|
-
if (
|
|
3782
|
+
if (ts24.isPropertyDeclaration(node.parent) && node.parent.initializer === node) {
|
|
3684
3783
|
let closestClass = node.parent;
|
|
3685
|
-
while (closestClass && !
|
|
3784
|
+
while (closestClass && !ts24.isClassDeclaration(closestClass)) {
|
|
3686
3785
|
closestClass = closestClass.parent;
|
|
3687
3786
|
}
|
|
3688
|
-
if (closestClass &&
|
|
3787
|
+
if (closestClass && ts24.isClassDeclaration(closestClass)) {
|
|
3689
3788
|
const decorators = this.reflector.getDecoratorsOfDeclaration(closestClass);
|
|
3690
3789
|
const isComponentOrDirective = decorators !== null && decorators.some((decorator) => {
|
|
3691
3790
|
return decorator.import?.from === "@angular/core" && (decorator.name === "Component" || decorator.name === "Directive");
|
|
@@ -3698,7 +3797,7 @@ var InitializerApiUsageRule = class {
|
|
|
3698
3797
|
};
|
|
3699
3798
|
|
|
3700
3799
|
// packages/compiler-cli/src/ngtsc/validation/src/rules/unused_standalone_imports_rule.js
|
|
3701
|
-
import
|
|
3800
|
+
import ts25 from "typescript";
|
|
3702
3801
|
var UnusedStandaloneImportsRule = class {
|
|
3703
3802
|
templateTypeChecker;
|
|
3704
3803
|
typeCheckingConfig;
|
|
@@ -3712,7 +3811,7 @@ var UnusedStandaloneImportsRule = class {
|
|
|
3712
3811
|
return this.typeCheckingConfig.unusedStandaloneImports !== "suppress" && (this.importedSymbolsTracker.hasNamedImport(sourceFile, "Component", "@angular/core") || this.importedSymbolsTracker.hasNamespaceImport(sourceFile, "@angular/core"));
|
|
3713
3812
|
}
|
|
3714
3813
|
checkNode(node) {
|
|
3715
|
-
if (!
|
|
3814
|
+
if (!ts25.isClassDeclaration(node)) {
|
|
3716
3815
|
return null;
|
|
3717
3816
|
}
|
|
3718
3817
|
const metadata = this.templateTypeChecker.getDirectiveMetadata(node);
|
|
@@ -3728,8 +3827,8 @@ var UnusedStandaloneImportsRule = class {
|
|
|
3728
3827
|
if (unused === null) {
|
|
3729
3828
|
return null;
|
|
3730
3829
|
}
|
|
3731
|
-
const propertyAssignment = closestNode(metadata.rawImports,
|
|
3732
|
-
const category = this.typeCheckingConfig.unusedStandaloneImports === "error" ?
|
|
3830
|
+
const propertyAssignment = closestNode(metadata.rawImports, ts25.isPropertyAssignment);
|
|
3831
|
+
const category = this.typeCheckingConfig.unusedStandaloneImports === "error" ? ts25.DiagnosticCategory.Error : ts25.DiagnosticCategory.Warning;
|
|
3733
3832
|
if (unused.length === metadata.imports.length && propertyAssignment !== null) {
|
|
3734
3833
|
return makeDiagnostic(ErrorCode.UNUSED_STANDALONE_IMPORTS, propertyAssignment.name, "All imports are unused", void 0, category);
|
|
3735
3834
|
}
|
|
@@ -3773,8 +3872,8 @@ var UnusedStandaloneImportsRule = class {
|
|
|
3773
3872
|
}
|
|
3774
3873
|
let current = reference.getIdentityIn(rawImports.getSourceFile());
|
|
3775
3874
|
while (current !== null) {
|
|
3776
|
-
if (
|
|
3777
|
-
return !!current.modifiers?.some((m) => m.kind ===
|
|
3875
|
+
if (ts25.isVariableStatement(current)) {
|
|
3876
|
+
return !!current.modifiers?.some((m) => m.kind === ts25.SyntaxKind.ExportKeyword);
|
|
3778
3877
|
}
|
|
3779
3878
|
current = current.parent ?? null;
|
|
3780
3879
|
}
|
|
@@ -3794,7 +3893,7 @@ function closestNode(start, predicate) {
|
|
|
3794
3893
|
}
|
|
3795
3894
|
|
|
3796
3895
|
// packages/compiler-cli/src/ngtsc/validation/src/rules/forbidden_required_initializer_invocation_rule.js
|
|
3797
|
-
import
|
|
3896
|
+
import ts26 from "typescript";
|
|
3798
3897
|
var APIS_TO_CHECK2 = [
|
|
3799
3898
|
INPUT_INITIALIZER_FN,
|
|
3800
3899
|
MODEL_INITIALIZER_FN,
|
|
@@ -3813,12 +3912,12 @@ var ForbiddenRequiredInitializersInvocationRule = class {
|
|
|
3813
3912
|
});
|
|
3814
3913
|
}
|
|
3815
3914
|
checkNode(node) {
|
|
3816
|
-
if (!
|
|
3915
|
+
if (!ts26.isClassDeclaration(node))
|
|
3817
3916
|
return null;
|
|
3818
|
-
const requiredInitializerDeclarations = node.members.filter((m) =>
|
|
3917
|
+
const requiredInitializerDeclarations = node.members.filter((m) => ts26.isPropertyDeclaration(m) && this.isPropDeclarationARequiredInitializer(m));
|
|
3819
3918
|
const diagnostics = [];
|
|
3820
3919
|
for (let decl of node.members) {
|
|
3821
|
-
if (!
|
|
3920
|
+
if (!ts26.isPropertyDeclaration(decl))
|
|
3822
3921
|
continue;
|
|
3823
3922
|
const initiallizerExpr = decl.initializer;
|
|
3824
3923
|
if (!initiallizerExpr)
|
|
@@ -3826,10 +3925,10 @@ var ForbiddenRequiredInitializersInvocationRule = class {
|
|
|
3826
3925
|
checkForbiddenInvocation(initiallizerExpr);
|
|
3827
3926
|
}
|
|
3828
3927
|
function checkForbiddenInvocation(node2) {
|
|
3829
|
-
if (
|
|
3928
|
+
if (ts26.isArrowFunction(node2) || ts26.isFunctionExpression(node2))
|
|
3830
3929
|
return;
|
|
3831
|
-
if (
|
|
3832
|
-
|
|
3930
|
+
if (ts26.isPropertyAccessExpression(node2) && node2.expression.kind === ts26.SyntaxKind.ThisKeyword && // With the following we make sure we only flag invoked required initializers
|
|
3931
|
+
ts26.isCallExpression(node2.parent) && node2.parent.expression === node2) {
|
|
3833
3932
|
const requiredProp = requiredInitializerDeclarations.find((prop) => prop.name.getText() === node2.name.getText());
|
|
3834
3933
|
if (requiredProp) {
|
|
3835
3934
|
const initializerFn = requiredProp.initializer.expression.expression.getText();
|
|
@@ -3854,7 +3953,7 @@ var ForbiddenRequiredInitializersInvocationRule = class {
|
|
|
3854
3953
|
}
|
|
3855
3954
|
};
|
|
3856
3955
|
function getConstructorFromClass(node) {
|
|
3857
|
-
return node.members.find((m) =>
|
|
3956
|
+
return node.members.find((m) => ts26.isConstructorDeclaration(m) && m.body !== void 0);
|
|
3858
3957
|
}
|
|
3859
3958
|
|
|
3860
3959
|
// packages/compiler-cli/src/ngtsc/validation/src/source_file_validator.js
|
|
@@ -4063,7 +4162,7 @@ var NgCompiler = class _NgCompiler {
|
|
|
4063
4162
|
this.currentProgram = inputProgram;
|
|
4064
4163
|
this.closureCompilerEnabled = !!this.options.annotateForClosureCompiler;
|
|
4065
4164
|
this.entryPoint = adapter.entryPoint !== null ? getSourceFileOrNull(inputProgram, adapter.entryPoint) : null;
|
|
4066
|
-
const moduleResolutionCache =
|
|
4165
|
+
const moduleResolutionCache = ts27.createModuleResolutionCache(
|
|
4067
4166
|
this.adapter.getCurrentDirectory(),
|
|
4068
4167
|
// doen't retain a reference to `this`, if other closures in the constructor here reference
|
|
4069
4168
|
// `this` internally then a closure created here would retain them. This can cause major
|
|
@@ -4111,7 +4210,7 @@ var NgCompiler = class _NgCompiler {
|
|
|
4111
4210
|
}
|
|
4112
4211
|
for (const clazz of classesToUpdate) {
|
|
4113
4212
|
this.compilation.traitCompiler.updateResources(clazz);
|
|
4114
|
-
if (!
|
|
4213
|
+
if (!ts27.isClassDeclaration(clazz)) {
|
|
4115
4214
|
continue;
|
|
4116
4215
|
}
|
|
4117
4216
|
this.compilation.templateTypeChecker.invalidateClass(clazz);
|
|
@@ -4321,12 +4420,12 @@ var NgCompiler = class _NgCompiler {
|
|
|
4321
4420
|
if (compilation.supportJitMode && compilation.jitDeclarationRegistry.jitDeclarations.size > 0) {
|
|
4322
4421
|
const { jitDeclarations } = compilation.jitDeclarationRegistry;
|
|
4323
4422
|
const jitDeclarationsArray = Array.from(jitDeclarations);
|
|
4324
|
-
const jitDeclarationOriginalNodes = new Set(jitDeclarationsArray.map((d) =>
|
|
4423
|
+
const jitDeclarationOriginalNodes = new Set(jitDeclarationsArray.map((d) => ts27.getOriginalNode(d)));
|
|
4325
4424
|
const sourceFilesWithJit = new Set(jitDeclarationsArray.map((d) => d.getSourceFile().fileName));
|
|
4326
4425
|
before.push((ctx) => {
|
|
4327
4426
|
const reflectionHost = new TypeScriptReflectionHost(this.inputProgram.getTypeChecker());
|
|
4328
4427
|
const jitTransform = angularJitApplicationTransform(this.inputProgram, compilation.isCore, (node) => {
|
|
4329
|
-
node =
|
|
4428
|
+
node = ts27.getOriginalNode(node, ts27.isClassDeclaration);
|
|
4330
4429
|
return reflectionHost.isClass(node) && jitDeclarationOriginalNodes.has(node);
|
|
4331
4430
|
})(ctx);
|
|
4332
4431
|
return (sourceFile) => {
|
|
@@ -4405,16 +4504,16 @@ var NgCompiler = class _NgCompiler {
|
|
|
4405
4504
|
return null;
|
|
4406
4505
|
}
|
|
4407
4506
|
const sourceFile = node.getSourceFile();
|
|
4408
|
-
const printer =
|
|
4409
|
-
const nodeText = printer.printNode(
|
|
4410
|
-
return
|
|
4507
|
+
const printer = ts27.createPrinter();
|
|
4508
|
+
const nodeText = printer.printNode(ts27.EmitHint.Unspecified, callback, sourceFile);
|
|
4509
|
+
return ts27.transpileModule(nodeText, {
|
|
4411
4510
|
compilerOptions: {
|
|
4412
4511
|
...this.options,
|
|
4413
4512
|
// Some module types can produce additional code (see #60795) whereas we need the
|
|
4414
4513
|
// HMR update module to use a native `export`. Override the `target` and `module`
|
|
4415
4514
|
// to ensure that it looks as expected.
|
|
4416
|
-
module:
|
|
4417
|
-
target:
|
|
4515
|
+
module: ts27.ModuleKind.ES2022,
|
|
4516
|
+
target: ts27.ScriptTarget.ES2022
|
|
4418
4517
|
},
|
|
4419
4518
|
fileName: sourceFile.fileName,
|
|
4420
4519
|
reportDiagnostics: false
|
|
@@ -4790,18 +4889,18 @@ function isAngularCorePackage(program) {
|
|
|
4790
4889
|
return false;
|
|
4791
4890
|
}
|
|
4792
4891
|
return r3Symbols.statements.some((stmt) => {
|
|
4793
|
-
if (!
|
|
4892
|
+
if (!ts27.isVariableStatement(stmt)) {
|
|
4794
4893
|
return false;
|
|
4795
4894
|
}
|
|
4796
|
-
const modifiers =
|
|
4797
|
-
if (modifiers === void 0 || !modifiers.some((mod) => mod.kind ===
|
|
4895
|
+
const modifiers = ts27.getModifiers(stmt);
|
|
4896
|
+
if (modifiers === void 0 || !modifiers.some((mod) => mod.kind === ts27.SyntaxKind.ExportKeyword)) {
|
|
4798
4897
|
return false;
|
|
4799
4898
|
}
|
|
4800
4899
|
return stmt.declarationList.declarations.some((decl) => {
|
|
4801
|
-
if (!
|
|
4900
|
+
if (!ts27.isIdentifier(decl.name) || decl.name.text !== "ITS_JUST_ANGULAR") {
|
|
4802
4901
|
return false;
|
|
4803
4902
|
}
|
|
4804
|
-
if (decl.initializer === void 0 || decl.initializer.kind !==
|
|
4903
|
+
if (decl.initializer === void 0 || decl.initializer.kind !== ts27.SyntaxKind.TrueKeyword) {
|
|
4805
4904
|
return false;
|
|
4806
4905
|
}
|
|
4807
4906
|
return true;
|
|
@@ -4814,7 +4913,7 @@ function getR3SymbolsFile(program) {
|
|
|
4814
4913
|
function* verifyCompatibleTypeCheckOptions(options) {
|
|
4815
4914
|
if (options.fullTemplateTypeCheck === false && options.strictTemplates === true) {
|
|
4816
4915
|
yield makeConfigDiagnostic({
|
|
4817
|
-
category:
|
|
4916
|
+
category: ts27.DiagnosticCategory.Error,
|
|
4818
4917
|
code: ErrorCode.CONFIG_STRICT_TEMPLATES_IMPLIES_FULL_TEMPLATE_TYPECHECK,
|
|
4819
4918
|
messageText: `
|
|
4820
4919
|
Angular compiler option "strictTemplates" is enabled, however "fullTemplateTypeCheck" is disabled.
|
|
@@ -4833,7 +4932,7 @@ https://angular.dev/tools/cli/template-typecheck
|
|
|
4833
4932
|
}
|
|
4834
4933
|
if (options.extendedDiagnostics && options.strictTemplates === false) {
|
|
4835
4934
|
yield makeConfigDiagnostic({
|
|
4836
|
-
category:
|
|
4935
|
+
category: ts27.DiagnosticCategory.Error,
|
|
4837
4936
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_IMPLIES_STRICT_TEMPLATES,
|
|
4838
4937
|
messageText: `
|
|
4839
4938
|
Angular compiler option "extendedDiagnostics" is configured, however "strictTemplates" is disabled.
|
|
@@ -4850,7 +4949,7 @@ One of the following actions is required:
|
|
|
4850
4949
|
const defaultCategory = options.extendedDiagnostics?.defaultCategory;
|
|
4851
4950
|
if (defaultCategory && !allowedCategoryLabels.includes(defaultCategory)) {
|
|
4852
4951
|
yield makeConfigDiagnostic({
|
|
4853
|
-
category:
|
|
4952
|
+
category: ts27.DiagnosticCategory.Error,
|
|
4854
4953
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
4855
4954
|
messageText: `
|
|
4856
4955
|
Angular compiler option "extendedDiagnostics.defaultCategory" has an unknown diagnostic category: "${defaultCategory}".
|
|
@@ -4863,7 +4962,7 @@ ${allowedCategoryLabels.join("\n")}
|
|
|
4863
4962
|
for (const [checkName, category] of Object.entries(options.extendedDiagnostics?.checks ?? {})) {
|
|
4864
4963
|
if (!SUPPORTED_DIAGNOSTIC_NAMES.has(checkName)) {
|
|
4865
4964
|
yield makeConfigDiagnostic({
|
|
4866
|
-
category:
|
|
4965
|
+
category: ts27.DiagnosticCategory.Error,
|
|
4867
4966
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CHECK,
|
|
4868
4967
|
messageText: `
|
|
4869
4968
|
Angular compiler option "extendedDiagnostics.checks" has an unknown check: "${checkName}".
|
|
@@ -4875,7 +4974,7 @@ ${Array.from(SUPPORTED_DIAGNOSTIC_NAMES).join("\n")}
|
|
|
4875
4974
|
}
|
|
4876
4975
|
if (!allowedCategoryLabels.includes(category)) {
|
|
4877
4976
|
yield makeConfigDiagnostic({
|
|
4878
|
-
category:
|
|
4977
|
+
category: ts27.DiagnosticCategory.Error,
|
|
4879
4978
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
4880
4979
|
messageText: `
|
|
4881
4980
|
Angular compiler option "extendedDiagnostics.checks['${checkName}']" has an unknown diagnostic category: "${category}".
|
|
@@ -4893,7 +4992,7 @@ function verifyEmitDeclarationOnly(options) {
|
|
|
4893
4992
|
}
|
|
4894
4993
|
return [
|
|
4895
4994
|
makeConfigDiagnostic({
|
|
4896
|
-
category:
|
|
4995
|
+
category: ts27.DiagnosticCategory.Error,
|
|
4897
4996
|
code: ErrorCode.CONFIG_EMIT_DECLARATION_ONLY_UNSUPPORTED,
|
|
4898
4997
|
messageText: 'TS compiler option "emitDeclarationOnly" is not supported.'
|
|
4899
4998
|
})
|
|
@@ -4918,7 +5017,7 @@ var ReferenceGraphAdapter = class {
|
|
|
4918
5017
|
for (const { node } of references) {
|
|
4919
5018
|
let sourceFile = node.getSourceFile();
|
|
4920
5019
|
if (sourceFile === void 0) {
|
|
4921
|
-
sourceFile =
|
|
5020
|
+
sourceFile = ts27.getOriginalNode(node).getSourceFile();
|
|
4922
5021
|
}
|
|
4923
5022
|
if (sourceFile === void 0 || !isDtsPath(sourceFile.fileName)) {
|
|
4924
5023
|
this.graph.add(source, node);
|
|
@@ -4959,7 +5058,7 @@ function versionMapFromProgram(program, driver) {
|
|
|
4959
5058
|
}
|
|
4960
5059
|
|
|
4961
5060
|
// packages/compiler-cli/src/ngtsc/core/src/host.js
|
|
4962
|
-
import
|
|
5061
|
+
import ts28 from "typescript";
|
|
4963
5062
|
var DelegatingCompilerHost = class {
|
|
4964
5063
|
delegate;
|
|
4965
5064
|
createHash;
|
|
@@ -5098,7 +5197,7 @@ var NgCompilerHost = class _NgCompilerHost extends DelegatingCompilerHost {
|
|
|
5098
5197
|
entryPoint = findFlatIndexEntryPoint(normalizedTsInputFiles);
|
|
5099
5198
|
if (entryPoint === null) {
|
|
5100
5199
|
diagnostics.push({
|
|
5101
|
-
category:
|
|
5200
|
+
category: ts28.DiagnosticCategory.Error,
|
|
5102
5201
|
code: ngErrorCode(ErrorCode.CONFIG_FLAT_MODULE_NO_INDEX),
|
|
5103
5202
|
file: void 0,
|
|
5104
5203
|
start: void 0,
|
|
@@ -5152,10 +5251,10 @@ var NgCompilerHost = class _NgCompilerHost extends DelegatingCompilerHost {
|
|
|
5152
5251
|
return this.fileNameToModuleName !== void 0 ? this : null;
|
|
5153
5252
|
}
|
|
5154
5253
|
createCachedResolveModuleNamesFunction() {
|
|
5155
|
-
const moduleResolutionCache =
|
|
5254
|
+
const moduleResolutionCache = ts28.createModuleResolutionCache(this.getCurrentDirectory(), this.getCanonicalFileName.bind(this));
|
|
5156
5255
|
return (moduleNames, containingFile, reusedNames, redirectedReference, options) => {
|
|
5157
5256
|
return moduleNames.map((moduleName) => {
|
|
5158
|
-
const module =
|
|
5257
|
+
const module = ts28.resolveModuleName(moduleName, containingFile, options, this, moduleResolutionCache, redirectedReference);
|
|
5159
5258
|
return module.resolvedModule;
|
|
5160
5259
|
});
|
|
5161
5260
|
};
|