@angular/compiler-cli 16.2.0-next.4 → 16.2.0-rc.0
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-GRJYX2PA.js → chunk-5GPIY4NW.js} +5 -5
- package/bundles/{chunk-WF3L5COT.js → chunk-CS2FNZXR.js} +774 -47
- package/bundles/chunk-CS2FNZXR.js.map +6 -0
- package/bundles/{chunk-TBUSSXUA.js → chunk-EC5K6QPP.js} +7 -7
- package/bundles/{chunk-SJLWUYXS.js → chunk-EMPTJWPY.js} +5 -7
- package/bundles/chunk-EMPTJWPY.js.map +6 -0
- package/bundles/{chunk-EKTJ7622.js → chunk-GYHDNUIK.js} +7 -7
- package/bundles/{chunk-7PCPPTTO.js → chunk-HJOPJLIM.js} +5 -5
- package/bundles/{chunk-IPC76KA7.js → chunk-LRT6BBZP.js} +8 -8
- package/bundles/{chunk-E72KZKRK.js → chunk-NFCNUCPF.js} +97 -97
- package/bundles/chunk-NFCNUCPF.js.map +6 -0
- package/bundles/{chunk-YZ3WOD5G.js → chunk-NYVNWJZI.js} +207 -111
- package/bundles/chunk-NYVNWJZI.js.map +6 -0
- package/bundles/{chunk-LYJKWJUC.js → chunk-SBDNBITT.js} +3 -3
- package/bundles/{chunk-DKWZY2MH.js → chunk-TU4LAK6J.js} +33 -31
- package/bundles/{chunk-DKWZY2MH.js.map → chunk-TU4LAK6J.js.map} +1 -1
- package/bundles/chunk-UHYH6BYB.js +12 -0
- package/bundles/chunk-UHYH6BYB.js.map +6 -0
- package/bundles/index.js +13 -13
- package/bundles/linker/babel/index.js +13 -13
- package/bundles/linker/index.js +5 -5
- package/bundles/ngcc/index.js +1 -1
- package/bundles/private/bazel.js +1 -1
- package/bundles/private/localize.js +3 -3
- package/bundles/private/migrations.js +7 -8
- package/bundles/private/tooling.js +4 -4
- package/bundles/src/bin/ng_xi18n.js +11 -11
- package/bundles/src/bin/ngc.js +9 -9
- package/bundles_metadata.json +1 -1
- package/package.json +2 -2
- package/src/ngtsc/annotations/component/src/handler.d.ts +8 -2
- package/src/ngtsc/annotations/component/src/metadata.d.ts +1 -1
- package/src/ngtsc/imports/index.d.ts +1 -0
- package/src/ngtsc/imports/src/deferred_symbol_tracker.d.ts +47 -0
- package/src/ngtsc/reflection/src/host.d.ts +4 -0
- package/src/ngtsc/reflection/src/typescript.d.ts +5 -0
- package/bundles/chunk-E72KZKRK.js.map +0 -6
- package/bundles/chunk-NIK4FIWB.js +0 -643
- package/bundles/chunk-NIK4FIWB.js.map +0 -6
- package/bundles/chunk-SJLWUYXS.js.map +0 -6
- package/bundles/chunk-WF3L5COT.js.map +0 -6
- package/bundles/chunk-YZ3WOD5G.js.map +0 -6
- /package/bundles/{chunk-GRJYX2PA.js.map → chunk-5GPIY4NW.js.map} +0 -0
- /package/bundles/{chunk-TBUSSXUA.js.map → chunk-EC5K6QPP.js.map} +0 -0
- /package/bundles/{chunk-EKTJ7622.js.map → chunk-GYHDNUIK.js.map} +0 -0
- /package/bundles/{chunk-7PCPPTTO.js.map → chunk-HJOPJLIM.js.map} +0 -0
- /package/bundles/{chunk-IPC76KA7.js.map → chunk-LRT6BBZP.js.map} +0 -0
- /package/bundles/{chunk-LYJKWJUC.js.map → chunk-SBDNBITT.js.map} +0 -0
|
@@ -12,10 +12,636 @@ import {
|
|
|
12
12
|
resolve,
|
|
13
13
|
stripExtension,
|
|
14
14
|
toRelativeImport
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-EC5K6QPP.js";
|
|
16
16
|
|
|
17
|
-
// bazel-out/
|
|
17
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/typescript.mjs
|
|
18
|
+
import ts4 from "typescript";
|
|
19
|
+
|
|
20
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/host.mjs
|
|
18
21
|
import ts from "typescript";
|
|
22
|
+
function isDecoratorIdentifier(exp) {
|
|
23
|
+
return ts.isIdentifier(exp) || ts.isPropertyAccessExpression(exp) && ts.isIdentifier(exp.expression) && ts.isIdentifier(exp.name);
|
|
24
|
+
}
|
|
25
|
+
var ClassMemberKind;
|
|
26
|
+
(function(ClassMemberKind2) {
|
|
27
|
+
ClassMemberKind2[ClassMemberKind2["Constructor"] = 0] = "Constructor";
|
|
28
|
+
ClassMemberKind2[ClassMemberKind2["Getter"] = 1] = "Getter";
|
|
29
|
+
ClassMemberKind2[ClassMemberKind2["Setter"] = 2] = "Setter";
|
|
30
|
+
ClassMemberKind2[ClassMemberKind2["Property"] = 3] = "Property";
|
|
31
|
+
ClassMemberKind2[ClassMemberKind2["Method"] = 4] = "Method";
|
|
32
|
+
})(ClassMemberKind || (ClassMemberKind = {}));
|
|
33
|
+
|
|
34
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/type_to_value.mjs
|
|
35
|
+
import ts2 from "typescript";
|
|
36
|
+
function typeToValue(typeNode, checker) {
|
|
37
|
+
if (typeNode === null) {
|
|
38
|
+
return missingType();
|
|
39
|
+
}
|
|
40
|
+
if (!ts2.isTypeReferenceNode(typeNode)) {
|
|
41
|
+
return unsupportedType(typeNode);
|
|
42
|
+
}
|
|
43
|
+
const symbols = resolveTypeSymbols(typeNode, checker);
|
|
44
|
+
if (symbols === null) {
|
|
45
|
+
return unknownReference(typeNode);
|
|
46
|
+
}
|
|
47
|
+
const { local, decl } = symbols;
|
|
48
|
+
if (decl.valueDeclaration === void 0 || decl.flags & ts2.SymbolFlags.ConstEnum) {
|
|
49
|
+
let typeOnlyDecl = null;
|
|
50
|
+
if (decl.declarations !== void 0 && decl.declarations.length > 0) {
|
|
51
|
+
typeOnlyDecl = decl.declarations[0];
|
|
52
|
+
}
|
|
53
|
+
return noValueDeclaration(typeNode, typeOnlyDecl);
|
|
54
|
+
}
|
|
55
|
+
const firstDecl = local.declarations && local.declarations[0];
|
|
56
|
+
if (firstDecl !== void 0) {
|
|
57
|
+
if (ts2.isImportClause(firstDecl) && firstDecl.name !== void 0) {
|
|
58
|
+
if (firstDecl.isTypeOnly) {
|
|
59
|
+
return typeOnlyImport(typeNode, firstDecl);
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
kind: 0,
|
|
63
|
+
expression: firstDecl.name,
|
|
64
|
+
defaultImportStatement: firstDecl.parent
|
|
65
|
+
};
|
|
66
|
+
} else if (ts2.isImportSpecifier(firstDecl)) {
|
|
67
|
+
if (firstDecl.isTypeOnly) {
|
|
68
|
+
return typeOnlyImport(typeNode, firstDecl);
|
|
69
|
+
}
|
|
70
|
+
if (firstDecl.parent.parent.isTypeOnly) {
|
|
71
|
+
return typeOnlyImport(typeNode, firstDecl.parent.parent);
|
|
72
|
+
}
|
|
73
|
+
const importedName = (firstDecl.propertyName || firstDecl.name).text;
|
|
74
|
+
const [_localName, ...nestedPath] = symbols.symbolNames;
|
|
75
|
+
const moduleName = extractModuleName(firstDecl.parent.parent.parent);
|
|
76
|
+
return {
|
|
77
|
+
kind: 1,
|
|
78
|
+
valueDeclaration: decl.valueDeclaration,
|
|
79
|
+
moduleName,
|
|
80
|
+
importedName,
|
|
81
|
+
nestedPath
|
|
82
|
+
};
|
|
83
|
+
} else if (ts2.isNamespaceImport(firstDecl)) {
|
|
84
|
+
if (firstDecl.parent.isTypeOnly) {
|
|
85
|
+
return typeOnlyImport(typeNode, firstDecl.parent);
|
|
86
|
+
}
|
|
87
|
+
if (symbols.symbolNames.length === 1) {
|
|
88
|
+
return namespaceImport(typeNode, firstDecl.parent);
|
|
89
|
+
}
|
|
90
|
+
const [_ns, importedName, ...nestedPath] = symbols.symbolNames;
|
|
91
|
+
const moduleName = extractModuleName(firstDecl.parent.parent);
|
|
92
|
+
return {
|
|
93
|
+
kind: 1,
|
|
94
|
+
valueDeclaration: decl.valueDeclaration,
|
|
95
|
+
moduleName,
|
|
96
|
+
importedName,
|
|
97
|
+
nestedPath
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
const expression = typeNodeToValueExpr(typeNode);
|
|
102
|
+
if (expression !== null) {
|
|
103
|
+
return {
|
|
104
|
+
kind: 0,
|
|
105
|
+
expression,
|
|
106
|
+
defaultImportStatement: null
|
|
107
|
+
};
|
|
108
|
+
} else {
|
|
109
|
+
return unsupportedType(typeNode);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function unsupportedType(typeNode) {
|
|
113
|
+
return {
|
|
114
|
+
kind: 2,
|
|
115
|
+
reason: { kind: 5, typeNode }
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function noValueDeclaration(typeNode, decl) {
|
|
119
|
+
return {
|
|
120
|
+
kind: 2,
|
|
121
|
+
reason: { kind: 1, typeNode, decl }
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function typeOnlyImport(typeNode, node) {
|
|
125
|
+
return {
|
|
126
|
+
kind: 2,
|
|
127
|
+
reason: { kind: 2, typeNode, node }
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function unknownReference(typeNode) {
|
|
131
|
+
return {
|
|
132
|
+
kind: 2,
|
|
133
|
+
reason: { kind: 3, typeNode }
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function namespaceImport(typeNode, importClause) {
|
|
137
|
+
return {
|
|
138
|
+
kind: 2,
|
|
139
|
+
reason: { kind: 4, typeNode, importClause }
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
function missingType() {
|
|
143
|
+
return {
|
|
144
|
+
kind: 2,
|
|
145
|
+
reason: { kind: 0 }
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function typeNodeToValueExpr(node) {
|
|
149
|
+
if (ts2.isTypeReferenceNode(node)) {
|
|
150
|
+
return entityNameToValue(node.typeName);
|
|
151
|
+
} else {
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function resolveTypeSymbols(typeRef, checker) {
|
|
156
|
+
const typeName = typeRef.typeName;
|
|
157
|
+
const typeRefSymbol = checker.getSymbolAtLocation(typeName);
|
|
158
|
+
if (typeRefSymbol === void 0) {
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
let local = typeRefSymbol;
|
|
162
|
+
let leftMost = typeName;
|
|
163
|
+
const symbolNames = [];
|
|
164
|
+
while (ts2.isQualifiedName(leftMost)) {
|
|
165
|
+
symbolNames.unshift(leftMost.right.text);
|
|
166
|
+
leftMost = leftMost.left;
|
|
167
|
+
}
|
|
168
|
+
symbolNames.unshift(leftMost.text);
|
|
169
|
+
if (leftMost !== typeName) {
|
|
170
|
+
const localTmp = checker.getSymbolAtLocation(leftMost);
|
|
171
|
+
if (localTmp !== void 0) {
|
|
172
|
+
local = localTmp;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
let decl = typeRefSymbol;
|
|
176
|
+
if (typeRefSymbol.flags & ts2.SymbolFlags.Alias) {
|
|
177
|
+
decl = checker.getAliasedSymbol(typeRefSymbol);
|
|
178
|
+
}
|
|
179
|
+
return { local, decl, symbolNames };
|
|
180
|
+
}
|
|
181
|
+
function entityNameToValue(node) {
|
|
182
|
+
if (ts2.isQualifiedName(node)) {
|
|
183
|
+
const left = entityNameToValue(node.left);
|
|
184
|
+
return left !== null ? ts2.factory.createPropertyAccessExpression(left, node.right) : null;
|
|
185
|
+
} else if (ts2.isIdentifier(node)) {
|
|
186
|
+
const clone = ts2.setOriginalNode(ts2.factory.createIdentifier(node.text), node);
|
|
187
|
+
clone.parent = node.parent;
|
|
188
|
+
return clone;
|
|
189
|
+
} else {
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
function extractModuleName(node) {
|
|
194
|
+
if (!ts2.isStringLiteral(node.moduleSpecifier)) {
|
|
195
|
+
throw new Error("not a module specifier");
|
|
196
|
+
}
|
|
197
|
+
return node.moduleSpecifier.text;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/util.mjs
|
|
201
|
+
import ts3 from "typescript";
|
|
202
|
+
function isNamedClassDeclaration(node) {
|
|
203
|
+
return ts3.isClassDeclaration(node) && isIdentifier(node.name);
|
|
204
|
+
}
|
|
205
|
+
function isIdentifier(node) {
|
|
206
|
+
return node !== void 0 && ts3.isIdentifier(node);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/typescript.mjs
|
|
210
|
+
var TypeScriptReflectionHost = class {
|
|
211
|
+
constructor(checker) {
|
|
212
|
+
this.checker = checker;
|
|
213
|
+
}
|
|
214
|
+
getDecoratorsOfDeclaration(declaration) {
|
|
215
|
+
const decorators = ts4.canHaveDecorators(declaration) ? ts4.getDecorators(declaration) : void 0;
|
|
216
|
+
return decorators !== void 0 && decorators.length ? decorators.map((decorator) => this._reflectDecorator(decorator)).filter((dec) => dec !== null) : null;
|
|
217
|
+
}
|
|
218
|
+
getMembersOfClass(clazz) {
|
|
219
|
+
const tsClazz = castDeclarationToClassOrDie(clazz);
|
|
220
|
+
return tsClazz.members.map((member) => this._reflectMember(member)).filter((member) => member !== null);
|
|
221
|
+
}
|
|
222
|
+
getConstructorParameters(clazz) {
|
|
223
|
+
const tsClazz = castDeclarationToClassOrDie(clazz);
|
|
224
|
+
const isDeclaration2 = tsClazz.getSourceFile().isDeclarationFile;
|
|
225
|
+
const ctor = tsClazz.members.find((member) => ts4.isConstructorDeclaration(member) && (isDeclaration2 || member.body !== void 0));
|
|
226
|
+
if (ctor === void 0) {
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
return ctor.parameters.map((node) => {
|
|
230
|
+
const name = parameterName(node.name);
|
|
231
|
+
const decorators = this.getDecoratorsOfDeclaration(node);
|
|
232
|
+
let originalTypeNode = node.type || null;
|
|
233
|
+
let typeNode = originalTypeNode;
|
|
234
|
+
if (typeNode && ts4.isUnionTypeNode(typeNode)) {
|
|
235
|
+
let childTypeNodes = typeNode.types.filter((childTypeNode) => !(ts4.isLiteralTypeNode(childTypeNode) && childTypeNode.literal.kind === ts4.SyntaxKind.NullKeyword));
|
|
236
|
+
if (childTypeNodes.length === 1) {
|
|
237
|
+
typeNode = childTypeNodes[0];
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
const typeValueReference = typeToValue(typeNode, this.checker);
|
|
241
|
+
return {
|
|
242
|
+
name,
|
|
243
|
+
nameNode: node.name,
|
|
244
|
+
typeValueReference,
|
|
245
|
+
typeNode: originalTypeNode,
|
|
246
|
+
decorators
|
|
247
|
+
};
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
getImportOfIdentifier(id) {
|
|
251
|
+
const directImport = this.getDirectImportOfIdentifier(id);
|
|
252
|
+
if (directImport !== null) {
|
|
253
|
+
return directImport;
|
|
254
|
+
} else if (ts4.isQualifiedName(id.parent) && id.parent.right === id) {
|
|
255
|
+
return this.getImportOfNamespacedIdentifier(id, getQualifiedNameRoot(id.parent));
|
|
256
|
+
} else if (ts4.isPropertyAccessExpression(id.parent) && id.parent.name === id) {
|
|
257
|
+
return this.getImportOfNamespacedIdentifier(id, getFarLeftIdentifier(id.parent));
|
|
258
|
+
} else {
|
|
259
|
+
return null;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
getExportsOfModule(node) {
|
|
263
|
+
if (!ts4.isSourceFile(node)) {
|
|
264
|
+
throw new Error(`getExportsOfModule() called on non-SourceFile in TS code`);
|
|
265
|
+
}
|
|
266
|
+
const symbol = this.checker.getSymbolAtLocation(node);
|
|
267
|
+
if (symbol === void 0) {
|
|
268
|
+
return null;
|
|
269
|
+
}
|
|
270
|
+
const map = /* @__PURE__ */ new Map();
|
|
271
|
+
this.checker.getExportsOfModule(symbol).forEach((exportSymbol) => {
|
|
272
|
+
const decl = this.getDeclarationOfSymbol(exportSymbol, null);
|
|
273
|
+
if (decl !== null) {
|
|
274
|
+
map.set(exportSymbol.name, decl);
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
return map;
|
|
278
|
+
}
|
|
279
|
+
isClass(node) {
|
|
280
|
+
return isNamedClassDeclaration(node);
|
|
281
|
+
}
|
|
282
|
+
hasBaseClass(clazz) {
|
|
283
|
+
return this.getBaseClassExpression(clazz) !== null;
|
|
284
|
+
}
|
|
285
|
+
getBaseClassExpression(clazz) {
|
|
286
|
+
if (!(ts4.isClassDeclaration(clazz) || ts4.isClassExpression(clazz)) || clazz.heritageClauses === void 0) {
|
|
287
|
+
return null;
|
|
288
|
+
}
|
|
289
|
+
const extendsClause = clazz.heritageClauses.find((clause) => clause.token === ts4.SyntaxKind.ExtendsKeyword);
|
|
290
|
+
if (extendsClause === void 0) {
|
|
291
|
+
return null;
|
|
292
|
+
}
|
|
293
|
+
const extendsType = extendsClause.types[0];
|
|
294
|
+
if (extendsType === void 0) {
|
|
295
|
+
return null;
|
|
296
|
+
}
|
|
297
|
+
return extendsType.expression;
|
|
298
|
+
}
|
|
299
|
+
getDeclarationOfIdentifier(id) {
|
|
300
|
+
let symbol = this.checker.getSymbolAtLocation(id);
|
|
301
|
+
if (symbol === void 0) {
|
|
302
|
+
return null;
|
|
303
|
+
}
|
|
304
|
+
return this.getDeclarationOfSymbol(symbol, id);
|
|
305
|
+
}
|
|
306
|
+
getDefinitionOfFunction(node) {
|
|
307
|
+
if (!ts4.isFunctionDeclaration(node) && !ts4.isMethodDeclaration(node) && !ts4.isFunctionExpression(node) && !ts4.isArrowFunction(node)) {
|
|
308
|
+
return null;
|
|
309
|
+
}
|
|
310
|
+
let body = null;
|
|
311
|
+
if (node.body !== void 0) {
|
|
312
|
+
body = ts4.isBlock(node.body) ? Array.from(node.body.statements) : [ts4.factory.createReturnStatement(node.body)];
|
|
313
|
+
}
|
|
314
|
+
const type = this.checker.getTypeAtLocation(node);
|
|
315
|
+
const signatures = this.checker.getSignaturesOfType(type, ts4.SignatureKind.Call);
|
|
316
|
+
return {
|
|
317
|
+
node,
|
|
318
|
+
body,
|
|
319
|
+
signatureCount: signatures.length,
|
|
320
|
+
typeParameters: node.typeParameters === void 0 ? null : Array.from(node.typeParameters),
|
|
321
|
+
parameters: node.parameters.map((param) => {
|
|
322
|
+
const name = parameterName(param.name);
|
|
323
|
+
const initializer = param.initializer || null;
|
|
324
|
+
return { name, node: param, initializer, type: param.type || null };
|
|
325
|
+
})
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
getGenericArityOfClass(clazz) {
|
|
329
|
+
if (!ts4.isClassDeclaration(clazz)) {
|
|
330
|
+
return null;
|
|
331
|
+
}
|
|
332
|
+
return clazz.typeParameters !== void 0 ? clazz.typeParameters.length : 0;
|
|
333
|
+
}
|
|
334
|
+
getVariableValue(declaration) {
|
|
335
|
+
return declaration.initializer || null;
|
|
336
|
+
}
|
|
337
|
+
isStaticallyExported(decl) {
|
|
338
|
+
let topLevel = decl;
|
|
339
|
+
if (ts4.isVariableDeclaration(decl) && ts4.isVariableDeclarationList(decl.parent)) {
|
|
340
|
+
topLevel = decl.parent.parent;
|
|
341
|
+
}
|
|
342
|
+
const modifiers = ts4.canHaveModifiers(topLevel) ? ts4.getModifiers(topLevel) : void 0;
|
|
343
|
+
if (modifiers !== void 0 && modifiers.some((modifier) => modifier.kind === ts4.SyntaxKind.ExportKeyword)) {
|
|
344
|
+
return true;
|
|
345
|
+
}
|
|
346
|
+
if (topLevel.parent === void 0 || !ts4.isSourceFile(topLevel.parent)) {
|
|
347
|
+
return false;
|
|
348
|
+
}
|
|
349
|
+
const localExports = this.getLocalExportedDeclarationsOfSourceFile(decl.getSourceFile());
|
|
350
|
+
return localExports.has(decl);
|
|
351
|
+
}
|
|
352
|
+
getDirectImportOfIdentifier(id) {
|
|
353
|
+
const symbol = this.checker.getSymbolAtLocation(id);
|
|
354
|
+
if (symbol === void 0 || symbol.declarations === void 0 || symbol.declarations.length !== 1) {
|
|
355
|
+
return null;
|
|
356
|
+
}
|
|
357
|
+
const decl = symbol.declarations[0];
|
|
358
|
+
const importDecl = getContainingImportDeclaration(decl);
|
|
359
|
+
if (importDecl === null) {
|
|
360
|
+
return null;
|
|
361
|
+
}
|
|
362
|
+
if (!ts4.isStringLiteral(importDecl.moduleSpecifier)) {
|
|
363
|
+
return null;
|
|
364
|
+
}
|
|
365
|
+
return {
|
|
366
|
+
from: importDecl.moduleSpecifier.text,
|
|
367
|
+
name: getExportedName(decl, id),
|
|
368
|
+
node: importDecl
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
getImportOfNamespacedIdentifier(id, namespaceIdentifier) {
|
|
372
|
+
if (namespaceIdentifier === null) {
|
|
373
|
+
return null;
|
|
374
|
+
}
|
|
375
|
+
const namespaceSymbol = this.checker.getSymbolAtLocation(namespaceIdentifier);
|
|
376
|
+
if (!namespaceSymbol || namespaceSymbol.declarations === void 0) {
|
|
377
|
+
return null;
|
|
378
|
+
}
|
|
379
|
+
const declaration = namespaceSymbol.declarations.length === 1 ? namespaceSymbol.declarations[0] : null;
|
|
380
|
+
if (!declaration) {
|
|
381
|
+
return null;
|
|
382
|
+
}
|
|
383
|
+
const namespaceDeclaration = ts4.isNamespaceImport(declaration) ? declaration : null;
|
|
384
|
+
if (!namespaceDeclaration) {
|
|
385
|
+
return null;
|
|
386
|
+
}
|
|
387
|
+
const importDeclaration = namespaceDeclaration.parent.parent;
|
|
388
|
+
if (!ts4.isStringLiteral(importDeclaration.moduleSpecifier)) {
|
|
389
|
+
return null;
|
|
390
|
+
}
|
|
391
|
+
return {
|
|
392
|
+
from: importDeclaration.moduleSpecifier.text,
|
|
393
|
+
name: id.text,
|
|
394
|
+
node: namespaceDeclaration.parent.parent
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
getDeclarationOfSymbol(symbol, originalId) {
|
|
398
|
+
let valueDeclaration = void 0;
|
|
399
|
+
if (symbol.valueDeclaration !== void 0) {
|
|
400
|
+
valueDeclaration = symbol.valueDeclaration;
|
|
401
|
+
} else if (symbol.declarations !== void 0 && symbol.declarations.length > 0) {
|
|
402
|
+
valueDeclaration = symbol.declarations[0];
|
|
403
|
+
}
|
|
404
|
+
if (valueDeclaration !== void 0 && ts4.isShorthandPropertyAssignment(valueDeclaration)) {
|
|
405
|
+
const shorthandSymbol = this.checker.getShorthandAssignmentValueSymbol(valueDeclaration);
|
|
406
|
+
if (shorthandSymbol === void 0) {
|
|
407
|
+
return null;
|
|
408
|
+
}
|
|
409
|
+
return this.getDeclarationOfSymbol(shorthandSymbol, originalId);
|
|
410
|
+
} else if (valueDeclaration !== void 0 && ts4.isExportSpecifier(valueDeclaration)) {
|
|
411
|
+
const targetSymbol = this.checker.getExportSpecifierLocalTargetSymbol(valueDeclaration);
|
|
412
|
+
if (targetSymbol === void 0) {
|
|
413
|
+
return null;
|
|
414
|
+
}
|
|
415
|
+
return this.getDeclarationOfSymbol(targetSymbol, originalId);
|
|
416
|
+
}
|
|
417
|
+
const importInfo = originalId && this.getImportOfIdentifier(originalId);
|
|
418
|
+
const viaModule = importInfo !== null && importInfo.from !== null && !importInfo.from.startsWith(".") ? importInfo.from : null;
|
|
419
|
+
while (symbol.flags & ts4.SymbolFlags.Alias) {
|
|
420
|
+
symbol = this.checker.getAliasedSymbol(symbol);
|
|
421
|
+
}
|
|
422
|
+
if (symbol.valueDeclaration !== void 0) {
|
|
423
|
+
return {
|
|
424
|
+
node: symbol.valueDeclaration,
|
|
425
|
+
viaModule
|
|
426
|
+
};
|
|
427
|
+
} else if (symbol.declarations !== void 0 && symbol.declarations.length > 0) {
|
|
428
|
+
return {
|
|
429
|
+
node: symbol.declarations[0],
|
|
430
|
+
viaModule
|
|
431
|
+
};
|
|
432
|
+
} else {
|
|
433
|
+
return null;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
_reflectDecorator(node) {
|
|
437
|
+
let decoratorExpr = node.expression;
|
|
438
|
+
let args = null;
|
|
439
|
+
if (ts4.isCallExpression(decoratorExpr)) {
|
|
440
|
+
args = Array.from(decoratorExpr.arguments);
|
|
441
|
+
decoratorExpr = decoratorExpr.expression;
|
|
442
|
+
}
|
|
443
|
+
if (!isDecoratorIdentifier(decoratorExpr)) {
|
|
444
|
+
return null;
|
|
445
|
+
}
|
|
446
|
+
const decoratorIdentifier = ts4.isIdentifier(decoratorExpr) ? decoratorExpr : decoratorExpr.name;
|
|
447
|
+
const importDecl = this.getImportOfIdentifier(decoratorIdentifier);
|
|
448
|
+
return {
|
|
449
|
+
name: decoratorIdentifier.text,
|
|
450
|
+
identifier: decoratorExpr,
|
|
451
|
+
import: importDecl,
|
|
452
|
+
node,
|
|
453
|
+
args
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
_reflectMember(node) {
|
|
457
|
+
let kind = null;
|
|
458
|
+
let value = null;
|
|
459
|
+
let name = null;
|
|
460
|
+
let nameNode = null;
|
|
461
|
+
if (ts4.isPropertyDeclaration(node)) {
|
|
462
|
+
kind = ClassMemberKind.Property;
|
|
463
|
+
value = node.initializer || null;
|
|
464
|
+
} else if (ts4.isGetAccessorDeclaration(node)) {
|
|
465
|
+
kind = ClassMemberKind.Getter;
|
|
466
|
+
} else if (ts4.isSetAccessorDeclaration(node)) {
|
|
467
|
+
kind = ClassMemberKind.Setter;
|
|
468
|
+
} else if (ts4.isMethodDeclaration(node)) {
|
|
469
|
+
kind = ClassMemberKind.Method;
|
|
470
|
+
} else if (ts4.isConstructorDeclaration(node)) {
|
|
471
|
+
kind = ClassMemberKind.Constructor;
|
|
472
|
+
} else {
|
|
473
|
+
return null;
|
|
474
|
+
}
|
|
475
|
+
if (ts4.isConstructorDeclaration(node)) {
|
|
476
|
+
name = "constructor";
|
|
477
|
+
} else if (ts4.isIdentifier(node.name)) {
|
|
478
|
+
name = node.name.text;
|
|
479
|
+
nameNode = node.name;
|
|
480
|
+
} else if (ts4.isStringLiteral(node.name)) {
|
|
481
|
+
name = node.name.text;
|
|
482
|
+
nameNode = node.name;
|
|
483
|
+
} else {
|
|
484
|
+
return null;
|
|
485
|
+
}
|
|
486
|
+
const decorators = this.getDecoratorsOfDeclaration(node);
|
|
487
|
+
const modifiers = ts4.getModifiers(node);
|
|
488
|
+
const isStatic = modifiers !== void 0 && modifiers.some((mod) => mod.kind === ts4.SyntaxKind.StaticKeyword);
|
|
489
|
+
return {
|
|
490
|
+
node,
|
|
491
|
+
implementation: node,
|
|
492
|
+
kind,
|
|
493
|
+
type: node.type || null,
|
|
494
|
+
name,
|
|
495
|
+
nameNode,
|
|
496
|
+
decorators,
|
|
497
|
+
value,
|
|
498
|
+
isStatic
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
getLocalExportedDeclarationsOfSourceFile(file) {
|
|
502
|
+
const cacheSf = file;
|
|
503
|
+
if (cacheSf[LocalExportedDeclarations] !== void 0) {
|
|
504
|
+
return cacheSf[LocalExportedDeclarations];
|
|
505
|
+
}
|
|
506
|
+
const exportSet = /* @__PURE__ */ new Set();
|
|
507
|
+
cacheSf[LocalExportedDeclarations] = exportSet;
|
|
508
|
+
const sfSymbol = this.checker.getSymbolAtLocation(cacheSf);
|
|
509
|
+
if (sfSymbol === void 0 || sfSymbol.exports === void 0) {
|
|
510
|
+
return exportSet;
|
|
511
|
+
}
|
|
512
|
+
const iter = sfSymbol.exports.values();
|
|
513
|
+
let item = iter.next();
|
|
514
|
+
while (item.done !== true) {
|
|
515
|
+
let exportedSymbol = item.value;
|
|
516
|
+
if (exportedSymbol.flags & ts4.SymbolFlags.Alias) {
|
|
517
|
+
exportedSymbol = this.checker.getAliasedSymbol(exportedSymbol);
|
|
518
|
+
}
|
|
519
|
+
if (exportedSymbol.valueDeclaration !== void 0 && exportedSymbol.valueDeclaration.getSourceFile() === file) {
|
|
520
|
+
exportSet.add(exportedSymbol.valueDeclaration);
|
|
521
|
+
}
|
|
522
|
+
item = iter.next();
|
|
523
|
+
}
|
|
524
|
+
return exportSet;
|
|
525
|
+
}
|
|
526
|
+
};
|
|
527
|
+
function reflectTypeEntityToDeclaration(type, checker) {
|
|
528
|
+
let realSymbol = checker.getSymbolAtLocation(type);
|
|
529
|
+
if (realSymbol === void 0) {
|
|
530
|
+
throw new Error(`Cannot resolve type entity ${type.getText()} to symbol`);
|
|
531
|
+
}
|
|
532
|
+
while (realSymbol.flags & ts4.SymbolFlags.Alias) {
|
|
533
|
+
realSymbol = checker.getAliasedSymbol(realSymbol);
|
|
534
|
+
}
|
|
535
|
+
let node = null;
|
|
536
|
+
if (realSymbol.valueDeclaration !== void 0) {
|
|
537
|
+
node = realSymbol.valueDeclaration;
|
|
538
|
+
} else if (realSymbol.declarations !== void 0 && realSymbol.declarations.length === 1) {
|
|
539
|
+
node = realSymbol.declarations[0];
|
|
540
|
+
} else {
|
|
541
|
+
throw new Error(`Cannot resolve type entity symbol to declaration`);
|
|
542
|
+
}
|
|
543
|
+
if (ts4.isQualifiedName(type)) {
|
|
544
|
+
if (!ts4.isIdentifier(type.left)) {
|
|
545
|
+
throw new Error(`Cannot handle qualified name with non-identifier lhs`);
|
|
546
|
+
}
|
|
547
|
+
const symbol = checker.getSymbolAtLocation(type.left);
|
|
548
|
+
if (symbol === void 0 || symbol.declarations === void 0 || symbol.declarations.length !== 1) {
|
|
549
|
+
throw new Error(`Cannot resolve qualified type entity lhs to symbol`);
|
|
550
|
+
}
|
|
551
|
+
const decl = symbol.declarations[0];
|
|
552
|
+
if (ts4.isNamespaceImport(decl)) {
|
|
553
|
+
const clause = decl.parent;
|
|
554
|
+
const importDecl = clause.parent;
|
|
555
|
+
if (!ts4.isStringLiteral(importDecl.moduleSpecifier)) {
|
|
556
|
+
throw new Error(`Module specifier is not a string`);
|
|
557
|
+
}
|
|
558
|
+
return { node, from: importDecl.moduleSpecifier.text };
|
|
559
|
+
} else if (ts4.isModuleDeclaration(decl)) {
|
|
560
|
+
return { node, from: null };
|
|
561
|
+
} else {
|
|
562
|
+
throw new Error(`Unknown import type?`);
|
|
563
|
+
}
|
|
564
|
+
} else {
|
|
565
|
+
return { node, from: null };
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
function filterToMembersWithDecorator(members, name, module) {
|
|
569
|
+
return members.filter((member) => !member.isStatic).map((member) => {
|
|
570
|
+
if (member.decorators === null) {
|
|
571
|
+
return null;
|
|
572
|
+
}
|
|
573
|
+
const decorators = member.decorators.filter((dec) => {
|
|
574
|
+
if (dec.import !== null) {
|
|
575
|
+
return dec.import.name === name && (module === void 0 || dec.import.from === module);
|
|
576
|
+
} else {
|
|
577
|
+
return dec.name === name && module === void 0;
|
|
578
|
+
}
|
|
579
|
+
});
|
|
580
|
+
if (decorators.length === 0) {
|
|
581
|
+
return null;
|
|
582
|
+
}
|
|
583
|
+
return { member, decorators };
|
|
584
|
+
}).filter((value) => value !== null);
|
|
585
|
+
}
|
|
586
|
+
function reflectObjectLiteral(node) {
|
|
587
|
+
const map = /* @__PURE__ */ new Map();
|
|
588
|
+
node.properties.forEach((prop) => {
|
|
589
|
+
if (ts4.isPropertyAssignment(prop)) {
|
|
590
|
+
const name = propertyNameToString(prop.name);
|
|
591
|
+
if (name === null) {
|
|
592
|
+
return;
|
|
593
|
+
}
|
|
594
|
+
map.set(name, prop.initializer);
|
|
595
|
+
} else if (ts4.isShorthandPropertyAssignment(prop)) {
|
|
596
|
+
map.set(prop.name.text, prop.name);
|
|
597
|
+
} else {
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
});
|
|
601
|
+
return map;
|
|
602
|
+
}
|
|
603
|
+
function castDeclarationToClassOrDie(declaration) {
|
|
604
|
+
if (!ts4.isClassDeclaration(declaration)) {
|
|
605
|
+
throw new Error(`Reflecting on a ${ts4.SyntaxKind[declaration.kind]} instead of a ClassDeclaration.`);
|
|
606
|
+
}
|
|
607
|
+
return declaration;
|
|
608
|
+
}
|
|
609
|
+
function parameterName(name) {
|
|
610
|
+
if (ts4.isIdentifier(name)) {
|
|
611
|
+
return name.text;
|
|
612
|
+
} else {
|
|
613
|
+
return null;
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
function propertyNameToString(node) {
|
|
617
|
+
if (ts4.isIdentifier(node) || ts4.isStringLiteral(node) || ts4.isNumericLiteral(node)) {
|
|
618
|
+
return node.text;
|
|
619
|
+
} else {
|
|
620
|
+
return null;
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
function getQualifiedNameRoot(qualifiedName) {
|
|
624
|
+
while (ts4.isQualifiedName(qualifiedName.left)) {
|
|
625
|
+
qualifiedName = qualifiedName.left;
|
|
626
|
+
}
|
|
627
|
+
return ts4.isIdentifier(qualifiedName.left) ? qualifiedName.left : null;
|
|
628
|
+
}
|
|
629
|
+
function getFarLeftIdentifier(propertyAccess) {
|
|
630
|
+
while (ts4.isPropertyAccessExpression(propertyAccess.expression)) {
|
|
631
|
+
propertyAccess = propertyAccess.expression;
|
|
632
|
+
}
|
|
633
|
+
return ts4.isIdentifier(propertyAccess.expression) ? propertyAccess.expression : null;
|
|
634
|
+
}
|
|
635
|
+
function getContainingImportDeclaration(node) {
|
|
636
|
+
return ts4.isImportSpecifier(node) ? node.parent.parent.parent : ts4.isNamespaceImport(node) ? node.parent.parent : null;
|
|
637
|
+
}
|
|
638
|
+
function getExportedName(decl, originalId) {
|
|
639
|
+
return ts4.isImportSpecifier(decl) ? (decl.propertyName !== void 0 ? decl.propertyName : decl.name).text : originalId.text;
|
|
640
|
+
}
|
|
641
|
+
var LocalExportedDeclarations = Symbol("LocalExportedDeclarations");
|
|
642
|
+
|
|
643
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/util/src/typescript.mjs
|
|
644
|
+
import ts5 from "typescript";
|
|
19
645
|
var TS = /\.tsx?$/i;
|
|
20
646
|
var D_TS = /\.d\.ts$/i;
|
|
21
647
|
function isSymbolWithValueDeclaration(symbol) {
|
|
@@ -30,31 +656,31 @@ function isNonDeclarationTsPath(filePath) {
|
|
|
30
656
|
function isFromDtsFile(node) {
|
|
31
657
|
let sf = node.getSourceFile();
|
|
32
658
|
if (sf === void 0) {
|
|
33
|
-
sf =
|
|
659
|
+
sf = ts5.getOriginalNode(node).getSourceFile();
|
|
34
660
|
}
|
|
35
661
|
return sf !== void 0 && sf.isDeclarationFile;
|
|
36
662
|
}
|
|
37
663
|
function nodeNameForError(node) {
|
|
38
|
-
if (node.name !== void 0 &&
|
|
664
|
+
if (node.name !== void 0 && ts5.isIdentifier(node.name)) {
|
|
39
665
|
return node.name.text;
|
|
40
666
|
} else {
|
|
41
|
-
const kind =
|
|
42
|
-
const { line, character } =
|
|
667
|
+
const kind = ts5.SyntaxKind[node.kind];
|
|
668
|
+
const { line, character } = ts5.getLineAndCharacterOfPosition(node.getSourceFile(), node.getStart());
|
|
43
669
|
return `${kind}@${line}:${character}`;
|
|
44
670
|
}
|
|
45
671
|
}
|
|
46
672
|
function getSourceFile(node) {
|
|
47
673
|
const directSf = node.getSourceFile();
|
|
48
|
-
return directSf !== void 0 ? directSf :
|
|
674
|
+
return directSf !== void 0 ? directSf : ts5.getOriginalNode(node).getSourceFile();
|
|
49
675
|
}
|
|
50
676
|
function getSourceFileOrNull(program, fileName) {
|
|
51
677
|
return program.getSourceFile(fileName) || null;
|
|
52
678
|
}
|
|
53
679
|
function getTokenAtPosition(sf, pos) {
|
|
54
|
-
return
|
|
680
|
+
return ts5.getTokenAtPosition(sf, pos);
|
|
55
681
|
}
|
|
56
682
|
function identifierOfNode(decl) {
|
|
57
|
-
if (decl.name !== void 0 &&
|
|
683
|
+
if (decl.name !== void 0 && ts5.isIdentifier(decl.name)) {
|
|
58
684
|
return decl.name;
|
|
59
685
|
} else {
|
|
60
686
|
return null;
|
|
@@ -64,14 +690,14 @@ function isDeclaration(node) {
|
|
|
64
690
|
return isValueDeclaration(node) || isTypeDeclaration(node);
|
|
65
691
|
}
|
|
66
692
|
function isValueDeclaration(node) {
|
|
67
|
-
return
|
|
693
|
+
return ts5.isClassDeclaration(node) || ts5.isFunctionDeclaration(node) || ts5.isVariableDeclaration(node);
|
|
68
694
|
}
|
|
69
695
|
function isTypeDeclaration(node) {
|
|
70
|
-
return
|
|
696
|
+
return ts5.isEnumDeclaration(node) || ts5.isTypeAliasDeclaration(node) || ts5.isInterfaceDeclaration(node);
|
|
71
697
|
}
|
|
72
698
|
function isNamedDeclaration(node) {
|
|
73
699
|
const namedNode = node;
|
|
74
|
-
return namedNode.name !== void 0 &&
|
|
700
|
+
return namedNode.name !== void 0 && ts5.isIdentifier(namedNode.name);
|
|
75
701
|
}
|
|
76
702
|
function getRootDirs(host, options) {
|
|
77
703
|
const rootDirs = [];
|
|
@@ -88,8 +714,8 @@ function getRootDirs(host, options) {
|
|
|
88
714
|
}
|
|
89
715
|
function nodeDebugInfo(node) {
|
|
90
716
|
const sf = getSourceFile(node);
|
|
91
|
-
const { line, character } =
|
|
92
|
-
return `[${sf.fileName}: ${
|
|
717
|
+
const { line, character } = ts5.getLineAndCharacterOfPosition(sf, node.pos);
|
|
718
|
+
return `[${sf.fileName}: ${ts5.SyntaxKind[node.kind]} @ ${line}:${character}]`;
|
|
93
719
|
}
|
|
94
720
|
function resolveModuleName(moduleName, containingFile, compilerOptions, compilerHost, moduleResolutionCache) {
|
|
95
721
|
if (compilerHost.resolveModuleNames) {
|
|
@@ -101,11 +727,11 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, compiler
|
|
|
101
727
|
compilerOptions
|
|
102
728
|
)[0];
|
|
103
729
|
} else {
|
|
104
|
-
return
|
|
730
|
+
return ts5.resolveModuleName(moduleName, containingFile, compilerOptions, compilerHost, moduleResolutionCache !== null ? moduleResolutionCache : void 0).resolvedModule;
|
|
105
731
|
}
|
|
106
732
|
}
|
|
107
733
|
function isAssignment(node) {
|
|
108
|
-
return
|
|
734
|
+
return ts5.isBinaryExpression(node) && node.operatorToken.kind === ts5.SyntaxKind.EqualsToken;
|
|
109
735
|
}
|
|
110
736
|
function toUnredirectedSourceFile(sf) {
|
|
111
737
|
const redirectInfo = sf.redirectInfo;
|
|
@@ -115,7 +741,7 @@ function toUnredirectedSourceFile(sf) {
|
|
|
115
741
|
return redirectInfo.unredirected;
|
|
116
742
|
}
|
|
117
743
|
|
|
118
|
-
// bazel-out/
|
|
744
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/references.mjs
|
|
119
745
|
var Reference = class {
|
|
120
746
|
constructor(node, bestGuessOwningModule = null) {
|
|
121
747
|
this.node = node;
|
|
@@ -178,14 +804,14 @@ var Reference = class {
|
|
|
178
804
|
}
|
|
179
805
|
};
|
|
180
806
|
|
|
181
|
-
// bazel-out/
|
|
807
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/alias.mjs
|
|
182
808
|
import { ExternalExpr as ExternalExpr2 } from "@angular/compiler";
|
|
183
809
|
|
|
184
|
-
// bazel-out/
|
|
810
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/emitter.mjs
|
|
185
811
|
import { ExternalExpr, ExternalReference, WrappedNodeExpr } from "@angular/compiler";
|
|
186
|
-
import
|
|
812
|
+
import ts7 from "typescript";
|
|
187
813
|
|
|
188
|
-
// bazel-out/
|
|
814
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/error_code.mjs
|
|
189
815
|
var ErrorCode;
|
|
190
816
|
(function(ErrorCode2) {
|
|
191
817
|
ErrorCode2[ErrorCode2["DECORATOR_ARG_NOT_LITERAL"] = 1001] = "DECORATOR_ARG_NOT_LITERAL";
|
|
@@ -259,7 +885,7 @@ var ErrorCode;
|
|
|
259
885
|
ErrorCode2[ErrorCode2["SUGGEST_SUBOPTIMAL_TYPE_INFERENCE"] = 10002] = "SUGGEST_SUBOPTIMAL_TYPE_INFERENCE";
|
|
260
886
|
})(ErrorCode || (ErrorCode = {}));
|
|
261
887
|
|
|
262
|
-
// bazel-out/
|
|
888
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/docs.mjs
|
|
263
889
|
var COMPILER_ERRORS_WITH_GUIDES = /* @__PURE__ */ new Set([
|
|
264
890
|
ErrorCode.DECORATOR_ARG_NOT_LITERAL,
|
|
265
891
|
ErrorCode.IMPORT_CYCLE_DETECTED,
|
|
@@ -271,10 +897,10 @@ var COMPILER_ERRORS_WITH_GUIDES = /* @__PURE__ */ new Set([
|
|
|
271
897
|
ErrorCode.WARN_NGMODULE_ID_UNNECESSARY
|
|
272
898
|
]);
|
|
273
899
|
|
|
274
|
-
// bazel-out/
|
|
275
|
-
import
|
|
900
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/error.mjs
|
|
901
|
+
import ts6 from "typescript";
|
|
276
902
|
|
|
277
|
-
// bazel-out/
|
|
903
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/util.mjs
|
|
278
904
|
var ERROR_CODE_MATCHER = /(\u001b\[\d+m ?)TS-99(\d+: ?\u001b\[\d+m)/g;
|
|
279
905
|
function replaceTsWithNgInErrors(errors) {
|
|
280
906
|
return errors.replace(ERROR_CODE_MATCHER, "$1NG$2");
|
|
@@ -283,7 +909,7 @@ function ngErrorCode(code) {
|
|
|
283
909
|
return parseInt("-99" + code);
|
|
284
910
|
}
|
|
285
911
|
|
|
286
|
-
// bazel-out/
|
|
912
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/error.mjs
|
|
287
913
|
var FatalDiagnosticError = class {
|
|
288
914
|
constructor(code, node, message, relatedInformation) {
|
|
289
915
|
this.code = code;
|
|
@@ -297,11 +923,11 @@ var FatalDiagnosticError = class {
|
|
|
297
923
|
}
|
|
298
924
|
};
|
|
299
925
|
function makeDiagnostic(code, node, messageText, relatedInformation) {
|
|
300
|
-
node =
|
|
926
|
+
node = ts6.getOriginalNode(node);
|
|
301
927
|
return {
|
|
302
|
-
category:
|
|
928
|
+
category: ts6.DiagnosticCategory.Error,
|
|
303
929
|
code: ngErrorCode(code),
|
|
304
|
-
file:
|
|
930
|
+
file: ts6.getOriginalNode(node).getSourceFile(),
|
|
305
931
|
start: node.getStart(void 0, false),
|
|
306
932
|
length: node.getWidth(),
|
|
307
933
|
messageText,
|
|
@@ -310,16 +936,16 @@ function makeDiagnostic(code, node, messageText, relatedInformation) {
|
|
|
310
936
|
}
|
|
311
937
|
function makeDiagnosticChain(messageText, next) {
|
|
312
938
|
return {
|
|
313
|
-
category:
|
|
939
|
+
category: ts6.DiagnosticCategory.Message,
|
|
314
940
|
code: 0,
|
|
315
941
|
messageText,
|
|
316
942
|
next
|
|
317
943
|
};
|
|
318
944
|
}
|
|
319
945
|
function makeRelatedInformation(node, messageText) {
|
|
320
|
-
node =
|
|
946
|
+
node = ts6.getOriginalNode(node);
|
|
321
947
|
return {
|
|
322
|
-
category:
|
|
948
|
+
category: ts6.DiagnosticCategory.Message,
|
|
323
949
|
code: 0,
|
|
324
950
|
file: node.getSourceFile(),
|
|
325
951
|
start: node.getStart(),
|
|
@@ -339,10 +965,10 @@ function addDiagnosticChain(messageText, add) {
|
|
|
339
965
|
return messageText;
|
|
340
966
|
}
|
|
341
967
|
|
|
342
|
-
// bazel-out/
|
|
968
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/error_details_base_url.mjs
|
|
343
969
|
var ERROR_DETAILS_PAGE_BASE_URL = "https://angular.io/errors";
|
|
344
970
|
|
|
345
|
-
// bazel-out/
|
|
971
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/extended_template_diagnostic_name.mjs
|
|
346
972
|
var ExtendedTemplateDiagnosticName;
|
|
347
973
|
(function(ExtendedTemplateDiagnosticName2) {
|
|
348
974
|
ExtendedTemplateDiagnosticName2["INVALID_BANANA_IN_BOX"] = "invalidBananaInBox";
|
|
@@ -355,7 +981,7 @@ var ExtendedTemplateDiagnosticName;
|
|
|
355
981
|
ExtendedTemplateDiagnosticName2["SKIP_HYDRATION_NOT_STATIC"] = "skipHydrationNotStatic";
|
|
356
982
|
})(ExtendedTemplateDiagnosticName || (ExtendedTemplateDiagnosticName = {}));
|
|
357
983
|
|
|
358
|
-
// bazel-out/
|
|
984
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/find_export.mjs
|
|
359
985
|
function findExportedNameOfNode(target, file, reflector) {
|
|
360
986
|
const exports = reflector.getExportsOfModule(file);
|
|
361
987
|
if (exports === null) {
|
|
@@ -375,7 +1001,7 @@ function findExportedNameOfNode(target, file, reflector) {
|
|
|
375
1001
|
return foundExportName;
|
|
376
1002
|
}
|
|
377
1003
|
|
|
378
|
-
// bazel-out/
|
|
1004
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/emitter.mjs
|
|
379
1005
|
var ImportFlags;
|
|
380
1006
|
(function(ImportFlags2) {
|
|
381
1007
|
ImportFlags2[ImportFlags2["None"] = 0] = "None";
|
|
@@ -447,9 +1073,9 @@ var AbsoluteModuleStrategy = class {
|
|
|
447
1073
|
if (ref.bestGuessOwningModule === null) {
|
|
448
1074
|
return null;
|
|
449
1075
|
} else if (!isDeclaration(ref.node)) {
|
|
450
|
-
throw new Error(`Debug assert: unable to import a Reference to non-declaration of type ${
|
|
1076
|
+
throw new Error(`Debug assert: unable to import a Reference to non-declaration of type ${ts7.SyntaxKind[ref.node.kind]}.`);
|
|
451
1077
|
} else if ((importFlags & ImportFlags.AllowTypeImports) === 0 && isTypeDeclaration(ref.node)) {
|
|
452
|
-
throw new Error(`Importing a type-only declaration of type ${
|
|
1078
|
+
throw new Error(`Importing a type-only declaration of type ${ts7.SyntaxKind[ref.node.kind]} in a value position is not allowed.`);
|
|
453
1079
|
}
|
|
454
1080
|
const { specifier, resolutionContext } = ref.bestGuessOwningModule;
|
|
455
1081
|
const exports = this.getExportsOfModule(specifier, resolutionContext);
|
|
@@ -591,7 +1217,7 @@ var UnifiedModulesStrategy = class {
|
|
|
591
1217
|
}
|
|
592
1218
|
};
|
|
593
1219
|
|
|
594
|
-
// bazel-out/
|
|
1220
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/alias.mjs
|
|
595
1221
|
var CHARS_TO_ESCAPE = /[^a-zA-Z0-9/_]/g;
|
|
596
1222
|
var UnifiedModulesAliasingHost = class {
|
|
597
1223
|
constructor(unifiedModulesHost) {
|
|
@@ -658,7 +1284,7 @@ var AliasStrategy = class {
|
|
|
658
1284
|
}
|
|
659
1285
|
};
|
|
660
1286
|
|
|
661
|
-
// bazel-out/
|
|
1287
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/util/src/path.mjs
|
|
662
1288
|
function relativePathBetween(from, to) {
|
|
663
1289
|
const relativePath = stripExtension(relative(dirname(resolve(from)), resolve(to)));
|
|
664
1290
|
return relativePath !== "" ? toRelativeImport(relativePath) : null;
|
|
@@ -667,7 +1293,7 @@ function normalizeSeparators(path) {
|
|
|
667
1293
|
return path.replace(/\\/g, "/");
|
|
668
1294
|
}
|
|
669
1295
|
|
|
670
|
-
// bazel-out/
|
|
1296
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/core.mjs
|
|
671
1297
|
var NoopImportRewriter = class {
|
|
672
1298
|
shouldImportSymbol(symbol, specifier) {
|
|
673
1299
|
return true;
|
|
@@ -725,8 +1351,8 @@ function validateAndRewriteCoreSymbol(name) {
|
|
|
725
1351
|
return CORE_SUPPORTED_SYMBOLS.get(name);
|
|
726
1352
|
}
|
|
727
1353
|
|
|
728
|
-
// bazel-out/
|
|
729
|
-
import
|
|
1354
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/patch_alias_reference_resolution.mjs
|
|
1355
|
+
import ts8 from "typescript";
|
|
730
1356
|
var patchedReferencedAliasesSymbol = Symbol("patchedReferencedAliases");
|
|
731
1357
|
function loadIsReferencedAliasDeclarationPatch(context) {
|
|
732
1358
|
if (!isTransformationContextWithEmitResolver(context)) {
|
|
@@ -751,7 +1377,7 @@ function loadIsReferencedAliasDeclarationPatch(context) {
|
|
|
751
1377
|
return emitResolver[patchedReferencedAliasesSymbol] = referencedAliases;
|
|
752
1378
|
}
|
|
753
1379
|
function isAliasImportDeclaration(node) {
|
|
754
|
-
return
|
|
1380
|
+
return ts8.isImportSpecifier(node) || ts8.isNamespaceImport(node) || ts8.isImportClause(node);
|
|
755
1381
|
}
|
|
756
1382
|
function isTransformationContextWithEmitResolver(context) {
|
|
757
1383
|
return context.getEmitResolver !== void 0;
|
|
@@ -760,7 +1386,7 @@ function throwIncompatibleTransformationContextError() {
|
|
|
760
1386
|
throw Error("Angular compiler is incompatible with this version of the TypeScript compiler.\n\nIf you recently updated TypeScript and this issue surfaces now, consider downgrading.\n\nPlease report an issue on the Angular repositories when this issue surfaces and you are using a supposedly compatible TypeScript version.");
|
|
761
1387
|
}
|
|
762
1388
|
|
|
763
|
-
// bazel-out/
|
|
1389
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/default.mjs
|
|
764
1390
|
var DefaultImportDeclaration = Symbol("DefaultImportDeclaration");
|
|
765
1391
|
function attachDefaultImportDeclaration(expr, importDecl) {
|
|
766
1392
|
expr[DefaultImportDeclaration] = importDecl;
|
|
@@ -801,7 +1427,100 @@ var DefaultImportTracker = class {
|
|
|
801
1427
|
}
|
|
802
1428
|
};
|
|
803
1429
|
|
|
804
|
-
// bazel-out/
|
|
1430
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/deferred_symbol_tracker.mjs
|
|
1431
|
+
import ts9 from "typescript";
|
|
1432
|
+
var AssumeEager = "AssumeEager";
|
|
1433
|
+
var DeferredSymbolTracker = class {
|
|
1434
|
+
constructor(typeChecker) {
|
|
1435
|
+
this.typeChecker = typeChecker;
|
|
1436
|
+
this.imports = /* @__PURE__ */ new Map();
|
|
1437
|
+
}
|
|
1438
|
+
extractImportedSymbols(importDecl) {
|
|
1439
|
+
const symbolMap = /* @__PURE__ */ new Map();
|
|
1440
|
+
if (importDecl.importClause === void 0) {
|
|
1441
|
+
throw new Error(`Provided import declaration doesn't have any symbols.`);
|
|
1442
|
+
}
|
|
1443
|
+
if (importDecl.importClause.namedBindings !== void 0) {
|
|
1444
|
+
const bindings = importDecl.importClause.namedBindings;
|
|
1445
|
+
if (ts9.isNamedImports(bindings)) {
|
|
1446
|
+
for (const element of bindings.elements) {
|
|
1447
|
+
symbolMap.set(element.name.text, AssumeEager);
|
|
1448
|
+
}
|
|
1449
|
+
} else {
|
|
1450
|
+
symbolMap.set(bindings.name.text, AssumeEager);
|
|
1451
|
+
}
|
|
1452
|
+
} else if (importDecl.importClause.name !== void 0) {
|
|
1453
|
+
symbolMap.set(importDecl.importClause.name.text, AssumeEager);
|
|
1454
|
+
} else {
|
|
1455
|
+
throw new Error("Unrecognized import structure.");
|
|
1456
|
+
}
|
|
1457
|
+
return symbolMap;
|
|
1458
|
+
}
|
|
1459
|
+
markAsDeferrableCandidate(identifier, importDecl) {
|
|
1460
|
+
if (!this.imports.has(importDecl)) {
|
|
1461
|
+
const symbolMap2 = this.extractImportedSymbols(importDecl);
|
|
1462
|
+
this.imports.set(importDecl, symbolMap2);
|
|
1463
|
+
}
|
|
1464
|
+
const symbolMap = this.imports.get(importDecl);
|
|
1465
|
+
if (!symbolMap.has(identifier.text)) {
|
|
1466
|
+
throw new Error(`The '${identifier.text}' identifier doesn't belong to the provided import declaration.`);
|
|
1467
|
+
}
|
|
1468
|
+
if (symbolMap.get(identifier.text) === AssumeEager) {
|
|
1469
|
+
symbolMap.set(identifier.text, this.lookupIdentifiersInSourceFile(identifier.text, importDecl));
|
|
1470
|
+
}
|
|
1471
|
+
const identifiers = symbolMap.get(identifier.text);
|
|
1472
|
+
identifiers.delete(identifier);
|
|
1473
|
+
}
|
|
1474
|
+
canDefer(importDecl) {
|
|
1475
|
+
if (!this.imports.has(importDecl)) {
|
|
1476
|
+
return false;
|
|
1477
|
+
}
|
|
1478
|
+
const symbolsMap = this.imports.get(importDecl);
|
|
1479
|
+
for (const [symbol, refs] of symbolsMap) {
|
|
1480
|
+
if (refs === AssumeEager || refs.size > 0) {
|
|
1481
|
+
return false;
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
return true;
|
|
1485
|
+
}
|
|
1486
|
+
getDeferrableImportDecls() {
|
|
1487
|
+
const deferrableDecls = /* @__PURE__ */ new Set();
|
|
1488
|
+
for (const [importDecl] of this.imports) {
|
|
1489
|
+
if (this.canDefer(importDecl)) {
|
|
1490
|
+
deferrableDecls.add(importDecl);
|
|
1491
|
+
}
|
|
1492
|
+
}
|
|
1493
|
+
return deferrableDecls;
|
|
1494
|
+
}
|
|
1495
|
+
lookupIdentifiersInSourceFile(name, importDecl) {
|
|
1496
|
+
const results = /* @__PURE__ */ new Set();
|
|
1497
|
+
const visit = (node) => {
|
|
1498
|
+
if (node === importDecl) {
|
|
1499
|
+
return;
|
|
1500
|
+
}
|
|
1501
|
+
if (ts9.isIdentifier(node) && node.text === name) {
|
|
1502
|
+
const sym = this.typeChecker.getSymbolAtLocation(node);
|
|
1503
|
+
if (sym === void 0) {
|
|
1504
|
+
return;
|
|
1505
|
+
}
|
|
1506
|
+
if (sym.declarations === void 0 || sym.declarations.length === 0) {
|
|
1507
|
+
return;
|
|
1508
|
+
}
|
|
1509
|
+
const importClause = sym.declarations[0];
|
|
1510
|
+
const decl = getContainingImportDeclaration(importClause);
|
|
1511
|
+
if (decl !== importDecl) {
|
|
1512
|
+
return;
|
|
1513
|
+
}
|
|
1514
|
+
results.add(node);
|
|
1515
|
+
}
|
|
1516
|
+
ts9.forEachChild(node, visit);
|
|
1517
|
+
};
|
|
1518
|
+
visit(importDecl.getSourceFile());
|
|
1519
|
+
return results;
|
|
1520
|
+
}
|
|
1521
|
+
};
|
|
1522
|
+
|
|
1523
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/resolver.mjs
|
|
805
1524
|
var ModuleResolver = class {
|
|
806
1525
|
constructor(program, compilerOptions, host, moduleResolutionCache) {
|
|
807
1526
|
this.program = program;
|
|
@@ -864,6 +1583,14 @@ export {
|
|
|
864
1583
|
attachDefaultImportDeclaration,
|
|
865
1584
|
getDefaultImportDeclaration,
|
|
866
1585
|
DefaultImportTracker,
|
|
1586
|
+
ClassMemberKind,
|
|
1587
|
+
typeNodeToValueExpr,
|
|
1588
|
+
isNamedClassDeclaration,
|
|
1589
|
+
TypeScriptReflectionHost,
|
|
1590
|
+
reflectTypeEntityToDeclaration,
|
|
1591
|
+
filterToMembersWithDecorator,
|
|
1592
|
+
reflectObjectLiteral,
|
|
1593
|
+
DeferredSymbolTracker,
|
|
867
1594
|
Reference,
|
|
868
1595
|
ModuleResolver
|
|
869
1596
|
};
|
|
@@ -874,4 +1601,4 @@ export {
|
|
|
874
1601
|
* Use of this source code is governed by an MIT-style license that can be
|
|
875
1602
|
* found in the LICENSE file at https://angular.io/license
|
|
876
1603
|
*/
|
|
877
|
-
//# sourceMappingURL=chunk-
|
|
1604
|
+
//# sourceMappingURL=chunk-CS2FNZXR.js.map
|