@angular/compiler-cli 17.3.0-next.0 → 17.3.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-XLXSE3QH.js → chunk-6X7GQ6BQ.js} +214 -153
- package/bundles/{chunk-XLXSE3QH.js.map → chunk-6X7GQ6BQ.js.map} +3 -3
- package/bundles/{chunk-VPKIGOWE.js → chunk-E5DF5SRS.js} +4 -4
- package/bundles/{chunk-GWFFFWTW.js → chunk-FH3I22MY.js} +103 -69
- package/bundles/chunk-FH3I22MY.js.map +6 -0
- package/bundles/{chunk-JKNKVO7U.js → chunk-MNT5B5MH.js} +2 -2
- package/bundles/{chunk-NZQBYQYJ.js → chunk-Q4UHSSKO.js} +18 -18
- package/bundles/{chunk-NZQBYQYJ.js.map → chunk-Q4UHSSKO.js.map} +1 -1
- package/bundles/{chunk-OW77LBBK.js → chunk-WYZJV3LZ.js} +515 -484
- package/bundles/chunk-WYZJV3LZ.js.map +6 -0
- package/bundles/index.js +5 -5
- package/bundles/linker/babel/index.js +2 -2
- package/bundles/linker/index.js +2 -2
- package/bundles/private/migrations.js +2 -2
- package/bundles/private/tooling.js +3 -3
- package/bundles/src/bin/ng_xi18n.js +4 -4
- package/bundles/src/bin/ngc.js +4 -4
- package/bundles_metadata.json +1 -1
- package/linker/src/file_linker/partial_linkers/util.d.ts +2 -2
- package/package.json +3 -3
- package/src/ngtsc/annotations/component/src/handler.d.ts +3 -2
- package/src/ngtsc/annotations/directive/src/handler.d.ts +3 -2
- package/src/ngtsc/annotations/directive/src/initializer_functions.d.ts +10 -6
- package/src/ngtsc/annotations/directive/src/input_function.d.ts +2 -1
- package/src/ngtsc/annotations/directive/src/model_function.d.ts +2 -1
- package/src/ngtsc/annotations/directive/src/output_function.d.ts +2 -1
- package/src/ngtsc/annotations/directive/src/query_functions.d.ts +2 -1
- package/src/ngtsc/annotations/directive/src/shared.d.ts +2 -2
- package/src/ngtsc/core/src/feature_detection.d.ts +13 -0
- package/src/ngtsc/imports/index.d.ts +1 -0
- package/src/ngtsc/imports/src/imported_symbols_tracker.d.ts +37 -0
- package/src/ngtsc/reflection/index.d.ts +1 -1
- package/src/ngtsc/reflection/src/type_to_value.d.ts +1 -0
- package/src/transformers/jit_transforms/initializer_api_transforms/transform.d.ts +2 -1
- package/src/transformers/jit_transforms/initializer_api_transforms/transform_api.d.ts +3 -2
- package/bundles/chunk-GWFFFWTW.js.map +0 -6
- package/bundles/chunk-OW77LBBK.js.map +0 -6
- /package/bundles/{chunk-VPKIGOWE.js.map → chunk-E5DF5SRS.js.map} +0 -0
- /package/bundles/{chunk-JKNKVO7U.js.map → chunk-MNT5B5MH.js.map} +0 -0
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
Reference,
|
|
13
13
|
assertSuccessfulReferenceEmit,
|
|
14
14
|
attachDefaultImportDeclaration,
|
|
15
|
+
entityNameToValue,
|
|
15
16
|
filterToMembersWithDecorator,
|
|
16
17
|
getDefaultImportDeclaration,
|
|
17
18
|
getSourceFile,
|
|
@@ -29,7 +30,7 @@ import {
|
|
|
29
30
|
translateStatement,
|
|
30
31
|
translateType,
|
|
31
32
|
typeNodeToValueExpr
|
|
32
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-6X7GQ6BQ.js";
|
|
33
34
|
import {
|
|
34
35
|
PerfEvent,
|
|
35
36
|
PerfPhase
|
|
@@ -40,6 +41,262 @@ import {
|
|
|
40
41
|
relative
|
|
41
42
|
} from "./chunk-75YFKYUJ.js";
|
|
42
43
|
|
|
44
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/util.mjs
|
|
45
|
+
import { ExternalExpr, ParseLocation, ParseSourceFile, ParseSourceSpan, ReadPropExpr, WrappedNodeExpr } from "@angular/compiler";
|
|
46
|
+
import ts from "typescript";
|
|
47
|
+
var CORE_MODULE = "@angular/core";
|
|
48
|
+
function valueReferenceToExpression(valueRef) {
|
|
49
|
+
if (valueRef.kind === 2) {
|
|
50
|
+
return null;
|
|
51
|
+
} else if (valueRef.kind === 0) {
|
|
52
|
+
const expr = new WrappedNodeExpr(valueRef.expression);
|
|
53
|
+
if (valueRef.defaultImportStatement !== null) {
|
|
54
|
+
attachDefaultImportDeclaration(expr, valueRef.defaultImportStatement);
|
|
55
|
+
}
|
|
56
|
+
return expr;
|
|
57
|
+
} else {
|
|
58
|
+
let importExpr = new ExternalExpr({ moduleName: valueRef.moduleName, name: valueRef.importedName });
|
|
59
|
+
if (valueRef.nestedPath !== null) {
|
|
60
|
+
for (const property of valueRef.nestedPath) {
|
|
61
|
+
importExpr = new ReadPropExpr(importExpr, property);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return importExpr;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function toR3Reference(origin, ref, context, refEmitter) {
|
|
68
|
+
const emittedValueRef = refEmitter.emit(ref, context);
|
|
69
|
+
assertSuccessfulReferenceEmit(emittedValueRef, origin, "class");
|
|
70
|
+
const emittedTypeRef = refEmitter.emit(ref, context, ImportFlags.ForceNewImport | ImportFlags.AllowTypeImports);
|
|
71
|
+
assertSuccessfulReferenceEmit(emittedTypeRef, origin, "class");
|
|
72
|
+
return {
|
|
73
|
+
value: emittedValueRef.expression,
|
|
74
|
+
type: emittedTypeRef.expression
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function isAngularCore(decorator) {
|
|
78
|
+
return decorator.import !== null && decorator.import.from === CORE_MODULE;
|
|
79
|
+
}
|
|
80
|
+
function isAngularCoreReference(reference, symbolName) {
|
|
81
|
+
return reference.ownedByModuleGuess === CORE_MODULE && reference.debugName === symbolName;
|
|
82
|
+
}
|
|
83
|
+
function findAngularDecorator(decorators, name, isCore) {
|
|
84
|
+
return decorators.find((decorator) => isAngularDecorator(decorator, name, isCore));
|
|
85
|
+
}
|
|
86
|
+
function isAngularDecorator(decorator, name, isCore) {
|
|
87
|
+
if (isCore) {
|
|
88
|
+
return decorator.name === name;
|
|
89
|
+
} else if (isAngularCore(decorator)) {
|
|
90
|
+
return decorator.import.name === name;
|
|
91
|
+
}
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
function getAngularDecorators(decorators, names, isCore) {
|
|
95
|
+
return decorators.filter((decorator) => {
|
|
96
|
+
var _a;
|
|
97
|
+
const name = isCore ? decorator.name : (_a = decorator.import) == null ? void 0 : _a.name;
|
|
98
|
+
if (name === void 0 || !names.includes(name)) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
return isCore || isAngularCore(decorator);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
function unwrapExpression(node) {
|
|
105
|
+
while (ts.isAsExpression(node) || ts.isParenthesizedExpression(node)) {
|
|
106
|
+
node = node.expression;
|
|
107
|
+
}
|
|
108
|
+
return node;
|
|
109
|
+
}
|
|
110
|
+
function expandForwardRef(arg) {
|
|
111
|
+
arg = unwrapExpression(arg);
|
|
112
|
+
if (!ts.isArrowFunction(arg) && !ts.isFunctionExpression(arg)) {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
const body = arg.body;
|
|
116
|
+
if (ts.isBlock(body)) {
|
|
117
|
+
if (body.statements.length !== 1) {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
const stmt = body.statements[0];
|
|
121
|
+
if (!ts.isReturnStatement(stmt) || stmt.expression === void 0) {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
return stmt.expression;
|
|
125
|
+
} else {
|
|
126
|
+
return body;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
function tryUnwrapForwardRef(node, reflector) {
|
|
130
|
+
node = unwrapExpression(node);
|
|
131
|
+
if (!ts.isCallExpression(node) || node.arguments.length !== 1) {
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
const fn = ts.isPropertyAccessExpression(node.expression) ? node.expression.name : node.expression;
|
|
135
|
+
if (!ts.isIdentifier(fn)) {
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
const expr = expandForwardRef(node.arguments[0]);
|
|
139
|
+
if (expr === null) {
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
const imp = reflector.getImportOfIdentifier(fn);
|
|
143
|
+
if (imp === null || imp.from !== "@angular/core" || imp.name !== "forwardRef") {
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
return expr;
|
|
147
|
+
}
|
|
148
|
+
var forwardRefResolver = (fn, callExpr, resolve, unresolvable) => {
|
|
149
|
+
if (!isAngularCoreReference(fn, "forwardRef") || callExpr.arguments.length !== 1) {
|
|
150
|
+
return unresolvable;
|
|
151
|
+
}
|
|
152
|
+
const expanded = expandForwardRef(callExpr.arguments[0]);
|
|
153
|
+
if (expanded !== null) {
|
|
154
|
+
return resolve(expanded);
|
|
155
|
+
} else {
|
|
156
|
+
return unresolvable;
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
function combineResolvers(resolvers) {
|
|
160
|
+
return (fn, callExpr, resolve, unresolvable) => {
|
|
161
|
+
for (const resolver of resolvers) {
|
|
162
|
+
const resolved = resolver(fn, callExpr, resolve, unresolvable);
|
|
163
|
+
if (resolved !== unresolvable) {
|
|
164
|
+
return resolved;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return unresolvable;
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
function isExpressionForwardReference(expr, context, contextSource) {
|
|
171
|
+
if (isWrappedTsNodeExpr(expr)) {
|
|
172
|
+
const node = ts.getOriginalNode(expr.node);
|
|
173
|
+
return node.getSourceFile() === contextSource && context.pos < node.pos;
|
|
174
|
+
} else {
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
function isWrappedTsNodeExpr(expr) {
|
|
179
|
+
return expr instanceof WrappedNodeExpr;
|
|
180
|
+
}
|
|
181
|
+
function readBaseClass(node, reflector, evaluator) {
|
|
182
|
+
const baseExpression = reflector.getBaseClassExpression(node);
|
|
183
|
+
if (baseExpression !== null) {
|
|
184
|
+
const baseClass = evaluator.evaluate(baseExpression);
|
|
185
|
+
if (baseClass instanceof Reference && reflector.isClass(baseClass.node)) {
|
|
186
|
+
return baseClass;
|
|
187
|
+
} else {
|
|
188
|
+
return "dynamic";
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
var parensWrapperTransformerFactory = (context) => {
|
|
194
|
+
const visitor = (node) => {
|
|
195
|
+
const visited = ts.visitEachChild(node, visitor, context);
|
|
196
|
+
if (ts.isArrowFunction(visited) || ts.isFunctionExpression(visited)) {
|
|
197
|
+
return ts.factory.createParenthesizedExpression(visited);
|
|
198
|
+
}
|
|
199
|
+
return visited;
|
|
200
|
+
};
|
|
201
|
+
return (node) => ts.visitEachChild(node, visitor, context);
|
|
202
|
+
};
|
|
203
|
+
function wrapFunctionExpressionsInParens(expression) {
|
|
204
|
+
return ts.transform(expression, [parensWrapperTransformerFactory]).transformed[0];
|
|
205
|
+
}
|
|
206
|
+
function resolveProvidersRequiringFactory(rawProviders, reflector, evaluator) {
|
|
207
|
+
const providers = /* @__PURE__ */ new Set();
|
|
208
|
+
const resolvedProviders = evaluator.evaluate(rawProviders);
|
|
209
|
+
if (!Array.isArray(resolvedProviders)) {
|
|
210
|
+
return providers;
|
|
211
|
+
}
|
|
212
|
+
resolvedProviders.forEach(function processProviders(provider) {
|
|
213
|
+
let tokenClass = null;
|
|
214
|
+
if (Array.isArray(provider)) {
|
|
215
|
+
provider.forEach(processProviders);
|
|
216
|
+
} else if (provider instanceof Reference) {
|
|
217
|
+
tokenClass = provider;
|
|
218
|
+
} else if (provider instanceof Map && provider.has("useClass") && !provider.has("deps")) {
|
|
219
|
+
const useExisting = provider.get("useClass");
|
|
220
|
+
if (useExisting instanceof Reference) {
|
|
221
|
+
tokenClass = useExisting;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
if (tokenClass !== null && !tokenClass.node.getSourceFile().isDeclarationFile && reflector.isClass(tokenClass.node)) {
|
|
225
|
+
const constructorParameters = reflector.getConstructorParameters(tokenClass.node);
|
|
226
|
+
if (constructorParameters !== null && constructorParameters.length > 0) {
|
|
227
|
+
providers.add(tokenClass);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
return providers;
|
|
232
|
+
}
|
|
233
|
+
function wrapTypeReference(reflector, clazz) {
|
|
234
|
+
const value = new WrappedNodeExpr(clazz.name);
|
|
235
|
+
const type = value;
|
|
236
|
+
return { value, type };
|
|
237
|
+
}
|
|
238
|
+
function createSourceSpan(node) {
|
|
239
|
+
const sf = node.getSourceFile();
|
|
240
|
+
const [startOffset, endOffset] = [node.getStart(), node.getEnd()];
|
|
241
|
+
const { line: startLine, character: startCol } = sf.getLineAndCharacterOfPosition(startOffset);
|
|
242
|
+
const { line: endLine, character: endCol } = sf.getLineAndCharacterOfPosition(endOffset);
|
|
243
|
+
const parseSf = new ParseSourceFile(sf.getFullText(), sf.fileName);
|
|
244
|
+
return new ParseSourceSpan(new ParseLocation(parseSf, startOffset, startLine + 1, startCol + 1), new ParseLocation(parseSf, endOffset, endLine + 1, endCol + 1));
|
|
245
|
+
}
|
|
246
|
+
function compileResults(fac, def, metadataStmt, propName, additionalFields, deferrableImports, debugInfo = null) {
|
|
247
|
+
const statements = def.statements;
|
|
248
|
+
if (metadataStmt !== null) {
|
|
249
|
+
statements.push(metadataStmt);
|
|
250
|
+
}
|
|
251
|
+
if (debugInfo !== null) {
|
|
252
|
+
statements.push(debugInfo);
|
|
253
|
+
}
|
|
254
|
+
const results = [
|
|
255
|
+
fac,
|
|
256
|
+
{
|
|
257
|
+
name: propName,
|
|
258
|
+
initializer: def.expression,
|
|
259
|
+
statements: def.statements,
|
|
260
|
+
type: def.type,
|
|
261
|
+
deferrableImports
|
|
262
|
+
}
|
|
263
|
+
];
|
|
264
|
+
if (additionalFields !== null) {
|
|
265
|
+
results.push(...additionalFields);
|
|
266
|
+
}
|
|
267
|
+
return results;
|
|
268
|
+
}
|
|
269
|
+
function toFactoryMetadata(meta, target) {
|
|
270
|
+
return {
|
|
271
|
+
name: meta.name,
|
|
272
|
+
type: meta.type,
|
|
273
|
+
typeArgumentCount: meta.typeArgumentCount,
|
|
274
|
+
deps: meta.deps,
|
|
275
|
+
target
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
function resolveImportedFile(moduleResolver, importedFile, expr, origin) {
|
|
279
|
+
if (importedFile !== "unknown") {
|
|
280
|
+
return importedFile;
|
|
281
|
+
}
|
|
282
|
+
if (!(expr instanceof ExternalExpr)) {
|
|
283
|
+
return null;
|
|
284
|
+
}
|
|
285
|
+
return moduleResolver.resolveModule(expr.value.moduleName, origin.fileName);
|
|
286
|
+
}
|
|
287
|
+
function getOriginNodeForDiagnostics(expr, container) {
|
|
288
|
+
const nodeSf = expr.getSourceFile();
|
|
289
|
+
const exprSf = container.getSourceFile();
|
|
290
|
+
if (nodeSf === exprSf && expr.pos >= container.pos && expr.end <= container.end) {
|
|
291
|
+
return expr;
|
|
292
|
+
} else {
|
|
293
|
+
return container;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
function isAbstractClassDeclaration(clazz) {
|
|
297
|
+
return ts.canHaveModifiers(clazz) && clazz.modifiers !== void 0 ? clazz.modifiers.some((mod) => mod.kind === ts.SyntaxKind.AbstractKeyword) : false;
|
|
298
|
+
}
|
|
299
|
+
|
|
43
300
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/dynamic.mjs
|
|
44
301
|
var DynamicValue = class {
|
|
45
302
|
constructor(node, reason, code) {
|
|
@@ -131,7 +388,7 @@ var DynamicValue = class {
|
|
|
131
388
|
};
|
|
132
389
|
|
|
133
390
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/interpreter.mjs
|
|
134
|
-
import
|
|
391
|
+
import ts2 from "typescript";
|
|
135
392
|
|
|
136
393
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/result.mjs
|
|
137
394
|
var ResolvedModule = class {
|
|
@@ -230,34 +487,34 @@ function referenceBinaryOp(op) {
|
|
|
230
487
|
return { op, literal: false };
|
|
231
488
|
}
|
|
232
489
|
var BINARY_OPERATORS = /* @__PURE__ */ new Map([
|
|
233
|
-
[
|
|
234
|
-
[
|
|
235
|
-
[
|
|
236
|
-
[
|
|
237
|
-
[
|
|
238
|
-
[
|
|
239
|
-
[
|
|
240
|
-
[
|
|
241
|
-
[
|
|
242
|
-
[
|
|
243
|
-
[
|
|
244
|
-
[
|
|
245
|
-
[
|
|
246
|
-
[
|
|
247
|
-
[
|
|
248
|
-
[
|
|
249
|
-
[
|
|
250
|
-
[
|
|
251
|
-
[
|
|
252
|
-
[
|
|
253
|
-
[
|
|
254
|
-
[
|
|
490
|
+
[ts2.SyntaxKind.PlusToken, literalBinaryOp((a, b) => a + b)],
|
|
491
|
+
[ts2.SyntaxKind.MinusToken, literalBinaryOp((a, b) => a - b)],
|
|
492
|
+
[ts2.SyntaxKind.AsteriskToken, literalBinaryOp((a, b) => a * b)],
|
|
493
|
+
[ts2.SyntaxKind.SlashToken, literalBinaryOp((a, b) => a / b)],
|
|
494
|
+
[ts2.SyntaxKind.PercentToken, literalBinaryOp((a, b) => a % b)],
|
|
495
|
+
[ts2.SyntaxKind.AmpersandToken, literalBinaryOp((a, b) => a & b)],
|
|
496
|
+
[ts2.SyntaxKind.BarToken, literalBinaryOp((a, b) => a | b)],
|
|
497
|
+
[ts2.SyntaxKind.CaretToken, literalBinaryOp((a, b) => a ^ b)],
|
|
498
|
+
[ts2.SyntaxKind.LessThanToken, literalBinaryOp((a, b) => a < b)],
|
|
499
|
+
[ts2.SyntaxKind.LessThanEqualsToken, literalBinaryOp((a, b) => a <= b)],
|
|
500
|
+
[ts2.SyntaxKind.GreaterThanToken, literalBinaryOp((a, b) => a > b)],
|
|
501
|
+
[ts2.SyntaxKind.GreaterThanEqualsToken, literalBinaryOp((a, b) => a >= b)],
|
|
502
|
+
[ts2.SyntaxKind.EqualsEqualsToken, literalBinaryOp((a, b) => a == b)],
|
|
503
|
+
[ts2.SyntaxKind.EqualsEqualsEqualsToken, literalBinaryOp((a, b) => a === b)],
|
|
504
|
+
[ts2.SyntaxKind.ExclamationEqualsToken, literalBinaryOp((a, b) => a != b)],
|
|
505
|
+
[ts2.SyntaxKind.ExclamationEqualsEqualsToken, literalBinaryOp((a, b) => a !== b)],
|
|
506
|
+
[ts2.SyntaxKind.LessThanLessThanToken, literalBinaryOp((a, b) => a << b)],
|
|
507
|
+
[ts2.SyntaxKind.GreaterThanGreaterThanToken, literalBinaryOp((a, b) => a >> b)],
|
|
508
|
+
[ts2.SyntaxKind.GreaterThanGreaterThanGreaterThanToken, literalBinaryOp((a, b) => a >>> b)],
|
|
509
|
+
[ts2.SyntaxKind.AsteriskAsteriskToken, literalBinaryOp((a, b) => Math.pow(a, b))],
|
|
510
|
+
[ts2.SyntaxKind.AmpersandAmpersandToken, referenceBinaryOp((a, b) => a && b)],
|
|
511
|
+
[ts2.SyntaxKind.BarBarToken, referenceBinaryOp((a, b) => a || b)]
|
|
255
512
|
]);
|
|
256
513
|
var UNARY_OPERATORS = /* @__PURE__ */ new Map([
|
|
257
|
-
[
|
|
258
|
-
[
|
|
259
|
-
[
|
|
260
|
-
[
|
|
514
|
+
[ts2.SyntaxKind.TildeToken, (a) => ~a],
|
|
515
|
+
[ts2.SyntaxKind.MinusToken, (a) => -a],
|
|
516
|
+
[ts2.SyntaxKind.PlusToken, (a) => +a],
|
|
517
|
+
[ts2.SyntaxKind.ExclamationToken, (a) => !a]
|
|
261
518
|
]);
|
|
262
519
|
var StaticInterpreter = class {
|
|
263
520
|
constructor(host, checker, dependencyTracker) {
|
|
@@ -270,43 +527,43 @@ var StaticInterpreter = class {
|
|
|
270
527
|
}
|
|
271
528
|
visitExpression(node, context) {
|
|
272
529
|
let result;
|
|
273
|
-
if (node.kind ===
|
|
530
|
+
if (node.kind === ts2.SyntaxKind.TrueKeyword) {
|
|
274
531
|
return true;
|
|
275
|
-
} else if (node.kind ===
|
|
532
|
+
} else if (node.kind === ts2.SyntaxKind.FalseKeyword) {
|
|
276
533
|
return false;
|
|
277
|
-
} else if (node.kind ===
|
|
534
|
+
} else if (node.kind === ts2.SyntaxKind.NullKeyword) {
|
|
278
535
|
return null;
|
|
279
|
-
} else if (
|
|
536
|
+
} else if (ts2.isStringLiteral(node)) {
|
|
280
537
|
return node.text;
|
|
281
|
-
} else if (
|
|
538
|
+
} else if (ts2.isNoSubstitutionTemplateLiteral(node)) {
|
|
282
539
|
return node.text;
|
|
283
|
-
} else if (
|
|
540
|
+
} else if (ts2.isTemplateExpression(node)) {
|
|
284
541
|
result = this.visitTemplateExpression(node, context);
|
|
285
|
-
} else if (
|
|
542
|
+
} else if (ts2.isNumericLiteral(node)) {
|
|
286
543
|
return parseFloat(node.text);
|
|
287
|
-
} else if (
|
|
544
|
+
} else if (ts2.isObjectLiteralExpression(node)) {
|
|
288
545
|
result = this.visitObjectLiteralExpression(node, context);
|
|
289
|
-
} else if (
|
|
546
|
+
} else if (ts2.isIdentifier(node)) {
|
|
290
547
|
result = this.visitIdentifier(node, context);
|
|
291
|
-
} else if (
|
|
548
|
+
} else if (ts2.isPropertyAccessExpression(node)) {
|
|
292
549
|
result = this.visitPropertyAccessExpression(node, context);
|
|
293
|
-
} else if (
|
|
550
|
+
} else if (ts2.isCallExpression(node)) {
|
|
294
551
|
result = this.visitCallExpression(node, context);
|
|
295
|
-
} else if (
|
|
552
|
+
} else if (ts2.isConditionalExpression(node)) {
|
|
296
553
|
result = this.visitConditionalExpression(node, context);
|
|
297
|
-
} else if (
|
|
554
|
+
} else if (ts2.isPrefixUnaryExpression(node)) {
|
|
298
555
|
result = this.visitPrefixUnaryExpression(node, context);
|
|
299
|
-
} else if (
|
|
556
|
+
} else if (ts2.isBinaryExpression(node)) {
|
|
300
557
|
result = this.visitBinaryExpression(node, context);
|
|
301
|
-
} else if (
|
|
558
|
+
} else if (ts2.isArrayLiteralExpression(node)) {
|
|
302
559
|
result = this.visitArrayLiteralExpression(node, context);
|
|
303
|
-
} else if (
|
|
560
|
+
} else if (ts2.isParenthesizedExpression(node)) {
|
|
304
561
|
result = this.visitParenthesizedExpression(node, context);
|
|
305
|
-
} else if (
|
|
562
|
+
} else if (ts2.isElementAccessExpression(node)) {
|
|
306
563
|
result = this.visitElementAccessExpression(node, context);
|
|
307
|
-
} else if (
|
|
564
|
+
} else if (ts2.isAsExpression(node)) {
|
|
308
565
|
result = this.visitExpression(node.expression, context);
|
|
309
|
-
} else if (
|
|
566
|
+
} else if (ts2.isNonNullExpression(node)) {
|
|
310
567
|
result = this.visitExpression(node.expression, context);
|
|
311
568
|
} else if (this.host.isClass(node)) {
|
|
312
569
|
result = this.visitDeclaration(node, context);
|
|
@@ -322,7 +579,7 @@ var StaticInterpreter = class {
|
|
|
322
579
|
const array = [];
|
|
323
580
|
for (let i = 0; i < node.elements.length; i++) {
|
|
324
581
|
const element = node.elements[i];
|
|
325
|
-
if (
|
|
582
|
+
if (ts2.isSpreadElement(element)) {
|
|
326
583
|
array.push(...this.visitSpreadElement(element, context));
|
|
327
584
|
} else {
|
|
328
585
|
array.push(this.visitExpression(element, context));
|
|
@@ -334,20 +591,20 @@ var StaticInterpreter = class {
|
|
|
334
591
|
const map = /* @__PURE__ */ new Map();
|
|
335
592
|
for (let i = 0; i < node.properties.length; i++) {
|
|
336
593
|
const property = node.properties[i];
|
|
337
|
-
if (
|
|
594
|
+
if (ts2.isPropertyAssignment(property)) {
|
|
338
595
|
const name = this.stringNameFromPropertyName(property.name, context);
|
|
339
596
|
if (name === void 0) {
|
|
340
597
|
return DynamicValue.fromDynamicInput(node, DynamicValue.fromDynamicString(property.name));
|
|
341
598
|
}
|
|
342
599
|
map.set(name, this.visitExpression(property.initializer, context));
|
|
343
|
-
} else if (
|
|
600
|
+
} else if (ts2.isShorthandPropertyAssignment(property)) {
|
|
344
601
|
const symbol = this.checker.getShorthandAssignmentValueSymbol(property);
|
|
345
602
|
if (symbol === void 0 || symbol.valueDeclaration === void 0) {
|
|
346
603
|
map.set(property.name.text, DynamicValue.fromUnknown(property));
|
|
347
604
|
} else {
|
|
348
605
|
map.set(property.name.text, this.visitDeclaration(symbol.valueDeclaration, context));
|
|
349
606
|
}
|
|
350
|
-
} else if (
|
|
607
|
+
} else if (ts2.isSpreadAssignment(property)) {
|
|
351
608
|
const spread = this.visitExpression(property.expression, context);
|
|
352
609
|
if (spread instanceof DynamicValue) {
|
|
353
610
|
return DynamicValue.fromDynamicInput(node, spread);
|
|
@@ -379,7 +636,7 @@ var StaticInterpreter = class {
|
|
|
379
636
|
visitIdentifier(node, context) {
|
|
380
637
|
const decl = this.host.getDeclarationOfIdentifier(node);
|
|
381
638
|
if (decl === null) {
|
|
382
|
-
if (
|
|
639
|
+
if (ts2.identifierToKeywordKind(node) === ts2.SyntaxKind.UndefinedKeyword) {
|
|
383
640
|
return void 0;
|
|
384
641
|
} else {
|
|
385
642
|
if (this.dependencyTracker !== null && this.host.getImportOfIdentifier(node) !== null) {
|
|
@@ -405,17 +662,17 @@ var StaticInterpreter = class {
|
|
|
405
662
|
}
|
|
406
663
|
if (this.host.isClass(node)) {
|
|
407
664
|
return this.getReference(node, context);
|
|
408
|
-
} else if (
|
|
665
|
+
} else if (ts2.isVariableDeclaration(node)) {
|
|
409
666
|
return this.visitVariableDeclaration(node, context);
|
|
410
|
-
} else if (
|
|
667
|
+
} else if (ts2.isParameter(node) && context.scope.has(node)) {
|
|
411
668
|
return context.scope.get(node);
|
|
412
|
-
} else if (
|
|
669
|
+
} else if (ts2.isExportAssignment(node)) {
|
|
413
670
|
return this.visitExpression(node.expression, context);
|
|
414
|
-
} else if (
|
|
671
|
+
} else if (ts2.isEnumDeclaration(node)) {
|
|
415
672
|
return this.visitEnumDeclaration(node, context);
|
|
416
|
-
} else if (
|
|
673
|
+
} else if (ts2.isSourceFile(node)) {
|
|
417
674
|
return this.visitSourceFile(node, context);
|
|
418
|
-
} else if (
|
|
675
|
+
} else if (ts2.isBindingElement(node)) {
|
|
419
676
|
return this.visitBindingElement(node, context);
|
|
420
677
|
} else {
|
|
421
678
|
return this.getReference(node, context);
|
|
@@ -583,7 +840,7 @@ var StaticInterpreter = class {
|
|
|
583
840
|
visitFunctionBody(node, fn, context) {
|
|
584
841
|
if (fn.body === null) {
|
|
585
842
|
return DynamicValue.fromUnknown(node);
|
|
586
|
-
} else if (fn.body.length !== 1 || !
|
|
843
|
+
} else if (fn.body.length !== 1 || !ts2.isReturnStatement(fn.body[0])) {
|
|
587
844
|
return DynamicValue.fromComplexFunctionCall(node, fn);
|
|
588
845
|
}
|
|
589
846
|
const ret = fn.body[0];
|
|
@@ -654,7 +911,7 @@ var StaticInterpreter = class {
|
|
|
654
911
|
evaluateFunctionArguments(node, context) {
|
|
655
912
|
const args = [];
|
|
656
913
|
for (const arg of node.arguments) {
|
|
657
|
-
if (
|
|
914
|
+
if (ts2.isSpreadElement(arg)) {
|
|
658
915
|
args.push(...this.visitSpreadElement(arg, context));
|
|
659
916
|
} else {
|
|
660
917
|
args.push(this.visitExpression(arg, context));
|
|
@@ -675,23 +932,23 @@ var StaticInterpreter = class {
|
|
|
675
932
|
visitBindingElement(node, context) {
|
|
676
933
|
const path2 = [];
|
|
677
934
|
let closestDeclaration = node;
|
|
678
|
-
while (
|
|
679
|
-
if (
|
|
935
|
+
while (ts2.isBindingElement(closestDeclaration) || ts2.isArrayBindingPattern(closestDeclaration) || ts2.isObjectBindingPattern(closestDeclaration)) {
|
|
936
|
+
if (ts2.isBindingElement(closestDeclaration)) {
|
|
680
937
|
path2.unshift(closestDeclaration);
|
|
681
938
|
}
|
|
682
939
|
closestDeclaration = closestDeclaration.parent;
|
|
683
940
|
}
|
|
684
|
-
if (!
|
|
941
|
+
if (!ts2.isVariableDeclaration(closestDeclaration) || closestDeclaration.initializer === void 0) {
|
|
685
942
|
return DynamicValue.fromUnknown(node);
|
|
686
943
|
}
|
|
687
944
|
let value = this.visit(closestDeclaration.initializer, context);
|
|
688
945
|
for (const element of path2) {
|
|
689
946
|
let key;
|
|
690
|
-
if (
|
|
947
|
+
if (ts2.isArrayBindingPattern(element.parent)) {
|
|
691
948
|
key = element.parent.elements.indexOf(element);
|
|
692
949
|
} else {
|
|
693
950
|
const name = element.propertyName || element.name;
|
|
694
|
-
if (
|
|
951
|
+
if (ts2.isIdentifier(name)) {
|
|
695
952
|
key = name.text;
|
|
696
953
|
} else {
|
|
697
954
|
return DynamicValue.fromUnknown(element);
|
|
@@ -705,9 +962,9 @@ var StaticInterpreter = class {
|
|
|
705
962
|
return value;
|
|
706
963
|
}
|
|
707
964
|
stringNameFromPropertyName(node, context) {
|
|
708
|
-
if (
|
|
965
|
+
if (ts2.isIdentifier(node) || ts2.isStringLiteral(node) || ts2.isNumericLiteral(node)) {
|
|
709
966
|
return node.text;
|
|
710
|
-
} else if (
|
|
967
|
+
} else if (ts2.isComputedPropertyName(node)) {
|
|
711
968
|
const literal3 = this.visitExpression(node.expression, context);
|
|
712
969
|
return typeof literal3 === "string" ? literal3 : void 0;
|
|
713
970
|
} else {
|
|
@@ -718,15 +975,15 @@ var StaticInterpreter = class {
|
|
|
718
975
|
return new Reference(node, owningModule(context));
|
|
719
976
|
}
|
|
720
977
|
visitType(node, context) {
|
|
721
|
-
if (
|
|
978
|
+
if (ts2.isLiteralTypeNode(node)) {
|
|
722
979
|
return this.visitExpression(node.literal, context);
|
|
723
|
-
} else if (
|
|
980
|
+
} else if (ts2.isTupleTypeNode(node)) {
|
|
724
981
|
return this.visitTupleType(node, context);
|
|
725
|
-
} else if (
|
|
982
|
+
} else if (ts2.isNamedTupleMember(node)) {
|
|
726
983
|
return this.visitType(node.type, context);
|
|
727
|
-
} else if (
|
|
984
|
+
} else if (ts2.isTypeOperatorNode(node) && node.operator === ts2.SyntaxKind.ReadonlyKeyword) {
|
|
728
985
|
return this.visitType(node.type, context);
|
|
729
|
-
} else if (
|
|
986
|
+
} else if (ts2.isTypeQueryNode(node)) {
|
|
730
987
|
return this.visitTypeQuery(node, context);
|
|
731
988
|
}
|
|
732
989
|
return DynamicValue.fromDynamicType(node);
|
|
@@ -739,7 +996,7 @@ var StaticInterpreter = class {
|
|
|
739
996
|
return res;
|
|
740
997
|
}
|
|
741
998
|
visitTypeQuery(node, context) {
|
|
742
|
-
if (!
|
|
999
|
+
if (!ts2.isIdentifier(node.exprName)) {
|
|
743
1000
|
return DynamicValue.fromUnknown(node);
|
|
744
1001
|
}
|
|
745
1002
|
const decl = this.host.getDeclarationOfIdentifier(node.exprName);
|
|
@@ -751,7 +1008,7 @@ var StaticInterpreter = class {
|
|
|
751
1008
|
}
|
|
752
1009
|
};
|
|
753
1010
|
function isFunctionOrMethodReference(ref) {
|
|
754
|
-
return
|
|
1011
|
+
return ts2.isFunctionDeclaration(ref.node) || ts2.isMethodDeclaration(ref.node) || ts2.isFunctionExpression(ref.node);
|
|
755
1012
|
}
|
|
756
1013
|
function literal(value, reject) {
|
|
757
1014
|
if (value instanceof EnumValue) {
|
|
@@ -763,16 +1020,16 @@ function literal(value, reject) {
|
|
|
763
1020
|
return reject(value);
|
|
764
1021
|
}
|
|
765
1022
|
function isVariableDeclarationDeclared(node) {
|
|
766
|
-
if (node.parent === void 0 || !
|
|
1023
|
+
if (node.parent === void 0 || !ts2.isVariableDeclarationList(node.parent)) {
|
|
767
1024
|
return false;
|
|
768
1025
|
}
|
|
769
1026
|
const declList = node.parent;
|
|
770
|
-
if (declList.parent === void 0 || !
|
|
1027
|
+
if (declList.parent === void 0 || !ts2.isVariableStatement(declList.parent)) {
|
|
771
1028
|
return false;
|
|
772
1029
|
}
|
|
773
1030
|
const varStmt = declList.parent;
|
|
774
|
-
const modifiers =
|
|
775
|
-
return modifiers !== void 0 && modifiers.some((mod) => mod.kind ===
|
|
1031
|
+
const modifiers = ts2.getModifiers(varStmt);
|
|
1032
|
+
return modifiers !== void 0 && modifiers.some((mod) => mod.kind === ts2.SyntaxKind.DeclareKeyword);
|
|
776
1033
|
}
|
|
777
1034
|
var EMPTY = {};
|
|
778
1035
|
function joinModuleContext(existing, node, decl) {
|
|
@@ -821,7 +1078,7 @@ var PartialEvaluator = class {
|
|
|
821
1078
|
};
|
|
822
1079
|
|
|
823
1080
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/diagnostics.mjs
|
|
824
|
-
import
|
|
1081
|
+
import ts3 from "typescript";
|
|
825
1082
|
function describeResolvedType(value, maxDepth = 1) {
|
|
826
1083
|
var _a, _b;
|
|
827
1084
|
if (value === null) {
|
|
@@ -848,362 +1105,106 @@ function describeResolvedType(value, maxDepth = 1) {
|
|
|
848
1105
|
if (maxDepth === 0) {
|
|
849
1106
|
return "Array";
|
|
850
1107
|
}
|
|
851
|
-
return `[${value.map((v) => describeResolvedType(v, maxDepth - 1)).join(", ")}]`;
|
|
852
|
-
} else if (value instanceof DynamicValue) {
|
|
853
|
-
return "(not statically analyzable)";
|
|
854
|
-
} else if (value instanceof KnownFn) {
|
|
855
|
-
return "Function";
|
|
856
|
-
} else {
|
|
857
|
-
return "unknown";
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
function quoteKey(key) {
|
|
861
|
-
if (/^[a-z0-9_]+$/i.test(key)) {
|
|
862
|
-
return key;
|
|
863
|
-
} else {
|
|
864
|
-
return `'${key.replace(/'/g, "\\'")}'`;
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
function traceDynamicValue(node, value) {
|
|
868
|
-
return value.accept(new TraceDynamicValueVisitor(node));
|
|
869
|
-
}
|
|
870
|
-
var TraceDynamicValueVisitor = class {
|
|
871
|
-
constructor(node) {
|
|
872
|
-
this.node = node;
|
|
873
|
-
this.currentContainerNode = null;
|
|
874
|
-
}
|
|
875
|
-
visitDynamicInput(value) {
|
|
876
|
-
const trace = value.reason.accept(this);
|
|
877
|
-
if (this.shouldTrace(value.node)) {
|
|
878
|
-
const info = makeRelatedInformation(value.node, "Unable to evaluate this expression statically.");
|
|
879
|
-
trace.unshift(info);
|
|
880
|
-
}
|
|
881
|
-
return trace;
|
|
882
|
-
}
|
|
883
|
-
visitSyntheticInput(value) {
|
|
884
|
-
return [makeRelatedInformation(value.node, "Unable to evaluate this expression further.")];
|
|
885
|
-
}
|
|
886
|
-
visitDynamicString(value) {
|
|
887
|
-
return [makeRelatedInformation(value.node, "A string value could not be determined statically.")];
|
|
888
|
-
}
|
|
889
|
-
visitExternalReference(value) {
|
|
890
|
-
const name = value.reason.debugName;
|
|
891
|
-
const description = name !== null ? `'${name}'` : "an anonymous declaration";
|
|
892
|
-
return [makeRelatedInformation(value.node, `A value for ${description} cannot be determined statically, as it is an external declaration.`)];
|
|
893
|
-
}
|
|
894
|
-
visitComplexFunctionCall(value) {
|
|
895
|
-
return [
|
|
896
|
-
makeRelatedInformation(value.node, "Unable to evaluate function call of complex function. A function must have exactly one return statement."),
|
|
897
|
-
makeRelatedInformation(value.reason.node, "Function is declared here.")
|
|
898
|
-
];
|
|
899
|
-
}
|
|
900
|
-
visitInvalidExpressionType(value) {
|
|
901
|
-
return [makeRelatedInformation(value.node, "Unable to evaluate an invalid expression.")];
|
|
902
|
-
}
|
|
903
|
-
visitUnknown(value) {
|
|
904
|
-
return [makeRelatedInformation(value.node, "Unable to evaluate statically.")];
|
|
905
|
-
}
|
|
906
|
-
visitUnknownIdentifier(value) {
|
|
907
|
-
return [makeRelatedInformation(value.node, "Unknown reference.")];
|
|
908
|
-
}
|
|
909
|
-
visitDynamicType(value) {
|
|
910
|
-
return [makeRelatedInformation(value.node, "Dynamic type.")];
|
|
911
|
-
}
|
|
912
|
-
visitUnsupportedSyntax(value) {
|
|
913
|
-
return [makeRelatedInformation(value.node, "This syntax is not supported.")];
|
|
914
|
-
}
|
|
915
|
-
shouldTrace(node) {
|
|
916
|
-
if (node === this.node) {
|
|
917
|
-
return false;
|
|
918
|
-
}
|
|
919
|
-
const container = getContainerNode(node);
|
|
920
|
-
if (container === this.currentContainerNode) {
|
|
921
|
-
return false;
|
|
922
|
-
}
|
|
923
|
-
this.currentContainerNode = container;
|
|
924
|
-
return true;
|
|
925
|
-
}
|
|
926
|
-
};
|
|
927
|
-
function getContainerNode(node) {
|
|
928
|
-
let currentNode = node;
|
|
929
|
-
while (currentNode !== void 0) {
|
|
930
|
-
switch (currentNode.kind) {
|
|
931
|
-
case ts2.SyntaxKind.ExpressionStatement:
|
|
932
|
-
case ts2.SyntaxKind.VariableStatement:
|
|
933
|
-
case ts2.SyntaxKind.ReturnStatement:
|
|
934
|
-
case ts2.SyntaxKind.IfStatement:
|
|
935
|
-
case ts2.SyntaxKind.SwitchStatement:
|
|
936
|
-
case ts2.SyntaxKind.DoStatement:
|
|
937
|
-
case ts2.SyntaxKind.WhileStatement:
|
|
938
|
-
case ts2.SyntaxKind.ForStatement:
|
|
939
|
-
case ts2.SyntaxKind.ForInStatement:
|
|
940
|
-
case ts2.SyntaxKind.ForOfStatement:
|
|
941
|
-
case ts2.SyntaxKind.ContinueStatement:
|
|
942
|
-
case ts2.SyntaxKind.BreakStatement:
|
|
943
|
-
case ts2.SyntaxKind.ThrowStatement:
|
|
944
|
-
case ts2.SyntaxKind.ObjectBindingPattern:
|
|
945
|
-
case ts2.SyntaxKind.ArrayBindingPattern:
|
|
946
|
-
return currentNode;
|
|
947
|
-
}
|
|
948
|
-
currentNode = currentNode.parent;
|
|
949
|
-
}
|
|
950
|
-
return node.getSourceFile();
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/util.mjs
|
|
954
|
-
import { ExternalExpr, ParseLocation, ParseSourceFile, ParseSourceSpan, ReadPropExpr, WrappedNodeExpr } from "@angular/compiler";
|
|
955
|
-
import ts3 from "typescript";
|
|
956
|
-
var CORE_MODULE = "@angular/core";
|
|
957
|
-
function valueReferenceToExpression(valueRef) {
|
|
958
|
-
if (valueRef.kind === 2) {
|
|
959
|
-
return null;
|
|
960
|
-
} else if (valueRef.kind === 0) {
|
|
961
|
-
const expr = new WrappedNodeExpr(valueRef.expression);
|
|
962
|
-
if (valueRef.defaultImportStatement !== null) {
|
|
963
|
-
attachDefaultImportDeclaration(expr, valueRef.defaultImportStatement);
|
|
964
|
-
}
|
|
965
|
-
return expr;
|
|
966
|
-
} else {
|
|
967
|
-
let importExpr = new ExternalExpr({ moduleName: valueRef.moduleName, name: valueRef.importedName });
|
|
968
|
-
if (valueRef.nestedPath !== null) {
|
|
969
|
-
for (const property of valueRef.nestedPath) {
|
|
970
|
-
importExpr = new ReadPropExpr(importExpr, property);
|
|
971
|
-
}
|
|
972
|
-
}
|
|
973
|
-
return importExpr;
|
|
974
|
-
}
|
|
975
|
-
}
|
|
976
|
-
function toR3Reference(origin, ref, context, refEmitter) {
|
|
977
|
-
const emittedValueRef = refEmitter.emit(ref, context);
|
|
978
|
-
assertSuccessfulReferenceEmit(emittedValueRef, origin, "class");
|
|
979
|
-
const emittedTypeRef = refEmitter.emit(ref, context, ImportFlags.ForceNewImport | ImportFlags.AllowTypeImports);
|
|
980
|
-
assertSuccessfulReferenceEmit(emittedTypeRef, origin, "class");
|
|
981
|
-
return {
|
|
982
|
-
value: emittedValueRef.expression,
|
|
983
|
-
type: emittedTypeRef.expression
|
|
984
|
-
};
|
|
985
|
-
}
|
|
986
|
-
function isAngularCore(decorator) {
|
|
987
|
-
return decorator.import !== null && decorator.import.from === CORE_MODULE;
|
|
988
|
-
}
|
|
989
|
-
function isAngularCoreReference(reference, symbolName) {
|
|
990
|
-
return reference.ownedByModuleGuess === CORE_MODULE && reference.debugName === symbolName;
|
|
991
|
-
}
|
|
992
|
-
function findAngularDecorator(decorators, name, isCore) {
|
|
993
|
-
return decorators.find((decorator) => isAngularDecorator(decorator, name, isCore));
|
|
994
|
-
}
|
|
995
|
-
function isAngularDecorator(decorator, name, isCore) {
|
|
996
|
-
if (isCore) {
|
|
997
|
-
return decorator.name === name;
|
|
998
|
-
} else if (isAngularCore(decorator)) {
|
|
999
|
-
return decorator.import.name === name;
|
|
1000
|
-
}
|
|
1001
|
-
return false;
|
|
1002
|
-
}
|
|
1003
|
-
function getAngularDecorators(decorators, names, isCore) {
|
|
1004
|
-
return decorators.filter((decorator) => {
|
|
1005
|
-
var _a;
|
|
1006
|
-
const name = isCore ? decorator.name : (_a = decorator.import) == null ? void 0 : _a.name;
|
|
1007
|
-
if (name === void 0 || !names.includes(name)) {
|
|
1008
|
-
return false;
|
|
1009
|
-
}
|
|
1010
|
-
return isCore || isAngularCore(decorator);
|
|
1011
|
-
});
|
|
1108
|
+
return `[${value.map((v) => describeResolvedType(v, maxDepth - 1)).join(", ")}]`;
|
|
1109
|
+
} else if (value instanceof DynamicValue) {
|
|
1110
|
+
return "(not statically analyzable)";
|
|
1111
|
+
} else if (value instanceof KnownFn) {
|
|
1112
|
+
return "Function";
|
|
1113
|
+
} else {
|
|
1114
|
+
return "unknown";
|
|
1115
|
+
}
|
|
1012
1116
|
}
|
|
1013
|
-
function
|
|
1014
|
-
|
|
1015
|
-
|
|
1117
|
+
function quoteKey(key) {
|
|
1118
|
+
if (/^[a-z0-9_]+$/i.test(key)) {
|
|
1119
|
+
return key;
|
|
1120
|
+
} else {
|
|
1121
|
+
return `'${key.replace(/'/g, "\\'")}'`;
|
|
1016
1122
|
}
|
|
1017
|
-
return node;
|
|
1018
1123
|
}
|
|
1019
|
-
function
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1124
|
+
function traceDynamicValue(node, value) {
|
|
1125
|
+
return value.accept(new TraceDynamicValueVisitor(node));
|
|
1126
|
+
}
|
|
1127
|
+
var TraceDynamicValueVisitor = class {
|
|
1128
|
+
constructor(node) {
|
|
1129
|
+
this.node = node;
|
|
1130
|
+
this.currentContainerNode = null;
|
|
1023
1131
|
}
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
if (
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
const stmt = body.statements[0];
|
|
1030
|
-
if (!ts3.isReturnStatement(stmt) || stmt.expression === void 0) {
|
|
1031
|
-
return null;
|
|
1132
|
+
visitDynamicInput(value) {
|
|
1133
|
+
const trace = value.reason.accept(this);
|
|
1134
|
+
if (this.shouldTrace(value.node)) {
|
|
1135
|
+
const info = makeRelatedInformation(value.node, "Unable to evaluate this expression statically.");
|
|
1136
|
+
trace.unshift(info);
|
|
1032
1137
|
}
|
|
1033
|
-
return
|
|
1034
|
-
} else {
|
|
1035
|
-
return body;
|
|
1138
|
+
return trace;
|
|
1036
1139
|
}
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
node = unwrapExpression(node);
|
|
1040
|
-
if (!ts3.isCallExpression(node) || node.arguments.length !== 1) {
|
|
1041
|
-
return null;
|
|
1140
|
+
visitSyntheticInput(value) {
|
|
1141
|
+
return [makeRelatedInformation(value.node, "Unable to evaluate this expression further.")];
|
|
1042
1142
|
}
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
return null;
|
|
1143
|
+
visitDynamicString(value) {
|
|
1144
|
+
return [makeRelatedInformation(value.node, "A string value could not be determined statically.")];
|
|
1046
1145
|
}
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1146
|
+
visitExternalReference(value) {
|
|
1147
|
+
const name = value.reason.debugName;
|
|
1148
|
+
const description = name !== null ? `'${name}'` : "an anonymous declaration";
|
|
1149
|
+
return [makeRelatedInformation(value.node, `A value for ${description} cannot be determined statically, as it is an external declaration.`)];
|
|
1050
1150
|
}
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1151
|
+
visitComplexFunctionCall(value) {
|
|
1152
|
+
return [
|
|
1153
|
+
makeRelatedInformation(value.node, "Unable to evaluate function call of complex function. A function must have exactly one return statement."),
|
|
1154
|
+
makeRelatedInformation(value.reason.node, "Function is declared here.")
|
|
1155
|
+
];
|
|
1054
1156
|
}
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
var forwardRefResolver = (fn, callExpr, resolve, unresolvable) => {
|
|
1058
|
-
if (!isAngularCoreReference(fn, "forwardRef") || callExpr.arguments.length !== 1) {
|
|
1059
|
-
return unresolvable;
|
|
1157
|
+
visitInvalidExpressionType(value) {
|
|
1158
|
+
return [makeRelatedInformation(value.node, "Unable to evaluate an invalid expression.")];
|
|
1060
1159
|
}
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
return resolve(expanded);
|
|
1064
|
-
} else {
|
|
1065
|
-
return unresolvable;
|
|
1160
|
+
visitUnknown(value) {
|
|
1161
|
+
return [makeRelatedInformation(value.node, "Unable to evaluate statically.")];
|
|
1066
1162
|
}
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
return (fn, callExpr, resolve, unresolvable) => {
|
|
1070
|
-
for (const resolver of resolvers) {
|
|
1071
|
-
const resolved = resolver(fn, callExpr, resolve, unresolvable);
|
|
1072
|
-
if (resolved !== unresolvable) {
|
|
1073
|
-
return resolved;
|
|
1074
|
-
}
|
|
1075
|
-
}
|
|
1076
|
-
return unresolvable;
|
|
1077
|
-
};
|
|
1078
|
-
}
|
|
1079
|
-
function isExpressionForwardReference(expr, context, contextSource) {
|
|
1080
|
-
if (isWrappedTsNodeExpr(expr)) {
|
|
1081
|
-
const node = ts3.getOriginalNode(expr.node);
|
|
1082
|
-
return node.getSourceFile() === contextSource && context.pos < node.pos;
|
|
1083
|
-
} else {
|
|
1084
|
-
return false;
|
|
1163
|
+
visitUnknownIdentifier(value) {
|
|
1164
|
+
return [makeRelatedInformation(value.node, "Unknown reference.")];
|
|
1085
1165
|
}
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
return expr instanceof WrappedNodeExpr;
|
|
1089
|
-
}
|
|
1090
|
-
function readBaseClass(node, reflector, evaluator) {
|
|
1091
|
-
const baseExpression = reflector.getBaseClassExpression(node);
|
|
1092
|
-
if (baseExpression !== null) {
|
|
1093
|
-
const baseClass = evaluator.evaluate(baseExpression);
|
|
1094
|
-
if (baseClass instanceof Reference && reflector.isClass(baseClass.node)) {
|
|
1095
|
-
return baseClass;
|
|
1096
|
-
} else {
|
|
1097
|
-
return "dynamic";
|
|
1098
|
-
}
|
|
1166
|
+
visitDynamicType(value) {
|
|
1167
|
+
return [makeRelatedInformation(value.node, "Dynamic type.")];
|
|
1099
1168
|
}
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
var parensWrapperTransformerFactory = (context) => {
|
|
1103
|
-
const visitor = (node) => {
|
|
1104
|
-
const visited = ts3.visitEachChild(node, visitor, context);
|
|
1105
|
-
if (ts3.isArrowFunction(visited) || ts3.isFunctionExpression(visited)) {
|
|
1106
|
-
return ts3.factory.createParenthesizedExpression(visited);
|
|
1107
|
-
}
|
|
1108
|
-
return visited;
|
|
1109
|
-
};
|
|
1110
|
-
return (node) => ts3.visitEachChild(node, visitor, context);
|
|
1111
|
-
};
|
|
1112
|
-
function wrapFunctionExpressionsInParens(expression) {
|
|
1113
|
-
return ts3.transform(expression, [parensWrapperTransformerFactory]).transformed[0];
|
|
1114
|
-
}
|
|
1115
|
-
function resolveProvidersRequiringFactory(rawProviders, reflector, evaluator) {
|
|
1116
|
-
const providers = /* @__PURE__ */ new Set();
|
|
1117
|
-
const resolvedProviders = evaluator.evaluate(rawProviders);
|
|
1118
|
-
if (!Array.isArray(resolvedProviders)) {
|
|
1119
|
-
return providers;
|
|
1169
|
+
visitUnsupportedSyntax(value) {
|
|
1170
|
+
return [makeRelatedInformation(value.node, "This syntax is not supported.")];
|
|
1120
1171
|
}
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
provider.forEach(processProviders);
|
|
1125
|
-
} else if (provider instanceof Reference) {
|
|
1126
|
-
tokenClass = provider;
|
|
1127
|
-
} else if (provider instanceof Map && provider.has("useClass") && !provider.has("deps")) {
|
|
1128
|
-
const useExisting = provider.get("useClass");
|
|
1129
|
-
if (useExisting instanceof Reference) {
|
|
1130
|
-
tokenClass = useExisting;
|
|
1131
|
-
}
|
|
1172
|
+
shouldTrace(node) {
|
|
1173
|
+
if (node === this.node) {
|
|
1174
|
+
return false;
|
|
1132
1175
|
}
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
providers.add(tokenClass);
|
|
1137
|
-
}
|
|
1176
|
+
const container = getContainerNode(node);
|
|
1177
|
+
if (container === this.currentContainerNode) {
|
|
1178
|
+
return false;
|
|
1138
1179
|
}
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
}
|
|
1142
|
-
function wrapTypeReference(reflector, clazz) {
|
|
1143
|
-
const value = new WrappedNodeExpr(clazz.name);
|
|
1144
|
-
const type = value;
|
|
1145
|
-
return { value, type };
|
|
1146
|
-
}
|
|
1147
|
-
function createSourceSpan(node) {
|
|
1148
|
-
const sf = node.getSourceFile();
|
|
1149
|
-
const [startOffset, endOffset] = [node.getStart(), node.getEnd()];
|
|
1150
|
-
const { line: startLine, character: startCol } = sf.getLineAndCharacterOfPosition(startOffset);
|
|
1151
|
-
const { line: endLine, character: endCol } = sf.getLineAndCharacterOfPosition(endOffset);
|
|
1152
|
-
const parseSf = new ParseSourceFile(sf.getFullText(), sf.fileName);
|
|
1153
|
-
return new ParseSourceSpan(new ParseLocation(parseSf, startOffset, startLine + 1, startCol + 1), new ParseLocation(parseSf, endOffset, endLine + 1, endCol + 1));
|
|
1154
|
-
}
|
|
1155
|
-
function compileResults(fac, def, metadataStmt, propName, additionalFields, deferrableImports, debugInfo = null) {
|
|
1156
|
-
const statements = def.statements;
|
|
1157
|
-
if (metadataStmt !== null) {
|
|
1158
|
-
statements.push(metadataStmt);
|
|
1159
|
-
}
|
|
1160
|
-
if (debugInfo !== null) {
|
|
1161
|
-
statements.push(debugInfo);
|
|
1180
|
+
this.currentContainerNode = container;
|
|
1181
|
+
return true;
|
|
1162
1182
|
}
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1183
|
+
};
|
|
1184
|
+
function getContainerNode(node) {
|
|
1185
|
+
let currentNode = node;
|
|
1186
|
+
while (currentNode !== void 0) {
|
|
1187
|
+
switch (currentNode.kind) {
|
|
1188
|
+
case ts3.SyntaxKind.ExpressionStatement:
|
|
1189
|
+
case ts3.SyntaxKind.VariableStatement:
|
|
1190
|
+
case ts3.SyntaxKind.ReturnStatement:
|
|
1191
|
+
case ts3.SyntaxKind.IfStatement:
|
|
1192
|
+
case ts3.SyntaxKind.SwitchStatement:
|
|
1193
|
+
case ts3.SyntaxKind.DoStatement:
|
|
1194
|
+
case ts3.SyntaxKind.WhileStatement:
|
|
1195
|
+
case ts3.SyntaxKind.ForStatement:
|
|
1196
|
+
case ts3.SyntaxKind.ForInStatement:
|
|
1197
|
+
case ts3.SyntaxKind.ForOfStatement:
|
|
1198
|
+
case ts3.SyntaxKind.ContinueStatement:
|
|
1199
|
+
case ts3.SyntaxKind.BreakStatement:
|
|
1200
|
+
case ts3.SyntaxKind.ThrowStatement:
|
|
1201
|
+
case ts3.SyntaxKind.ObjectBindingPattern:
|
|
1202
|
+
case ts3.SyntaxKind.ArrayBindingPattern:
|
|
1203
|
+
return currentNode;
|
|
1171
1204
|
}
|
|
1172
|
-
|
|
1173
|
-
if (additionalFields !== null) {
|
|
1174
|
-
results.push(...additionalFields);
|
|
1175
|
-
}
|
|
1176
|
-
return results;
|
|
1177
|
-
}
|
|
1178
|
-
function toFactoryMetadata(meta, target) {
|
|
1179
|
-
return {
|
|
1180
|
-
name: meta.name,
|
|
1181
|
-
type: meta.type,
|
|
1182
|
-
typeArgumentCount: meta.typeArgumentCount,
|
|
1183
|
-
deps: meta.deps,
|
|
1184
|
-
target
|
|
1185
|
-
};
|
|
1186
|
-
}
|
|
1187
|
-
function resolveImportedFile(moduleResolver, importedFile, expr, origin) {
|
|
1188
|
-
if (importedFile !== "unknown") {
|
|
1189
|
-
return importedFile;
|
|
1190
|
-
}
|
|
1191
|
-
if (!(expr instanceof ExternalExpr)) {
|
|
1192
|
-
return null;
|
|
1193
|
-
}
|
|
1194
|
-
return moduleResolver.resolveModule(expr.value.moduleName, origin.fileName);
|
|
1195
|
-
}
|
|
1196
|
-
function getOriginNodeForDiagnostics(expr, container) {
|
|
1197
|
-
const nodeSf = expr.getSourceFile();
|
|
1198
|
-
const exprSf = container.getSourceFile();
|
|
1199
|
-
if (nodeSf === exprSf && expr.pos >= container.pos && expr.end <= container.end) {
|
|
1200
|
-
return expr;
|
|
1201
|
-
} else {
|
|
1202
|
-
return container;
|
|
1205
|
+
currentNode = currentNode.parent;
|
|
1203
1206
|
}
|
|
1204
|
-
|
|
1205
|
-
function isAbstractClassDeclaration(clazz) {
|
|
1206
|
-
return ts3.canHaveModifiers(clazz) && clazz.modifiers !== void 0 ? clazz.modifiers.some((mod) => mod.kind === ts3.SyntaxKind.AbstractKeyword) : false;
|
|
1207
|
+
return node.getSourceFile();
|
|
1207
1208
|
}
|
|
1208
1209
|
|
|
1209
1210
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/di.mjs
|
|
@@ -4436,57 +4437,71 @@ import ts23 from "typescript";
|
|
|
4436
4437
|
|
|
4437
4438
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/initializer_functions.mjs
|
|
4438
4439
|
import ts20 from "typescript";
|
|
4439
|
-
function tryParseInitializerApiMember(
|
|
4440
|
+
function tryParseInitializerApiMember(functions, member, reflector, importTracker) {
|
|
4440
4441
|
if (member.value === null || !ts20.isCallExpression(member.value)) {
|
|
4441
4442
|
return null;
|
|
4442
4443
|
}
|
|
4443
4444
|
const call = member.value;
|
|
4444
|
-
|
|
4445
|
-
if (
|
|
4445
|
+
const staticResult = parseTopLevelCall(call, functions, importTracker) || parseTopLevelRequiredCall(call, functions, importTracker) || parseTopLevelCallFromNamespace(call, functions, importTracker);
|
|
4446
|
+
if (staticResult === null) {
|
|
4446
4447
|
return null;
|
|
4447
4448
|
}
|
|
4448
|
-
|
|
4449
|
-
if (
|
|
4450
|
-
if (!isReferenceToInitializerApiFunction(apiName, target, isCore, reflector)) {
|
|
4451
|
-
return null;
|
|
4452
|
-
}
|
|
4453
|
-
return { apiName, call, isRequired: false };
|
|
4454
|
-
}
|
|
4455
|
-
if (target.text !== "required" || !ts20.isPropertyAccessExpression(call.expression)) {
|
|
4449
|
+
const resolvedImport = reflector.getImportOfIdentifier(staticResult.apiReference);
|
|
4450
|
+
if (resolvedImport === null || staticResult.api.functionName !== resolvedImport.name || staticResult.api.owningModule !== resolvedImport.from) {
|
|
4456
4451
|
return null;
|
|
4457
4452
|
}
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4453
|
+
return {
|
|
4454
|
+
api: staticResult.api,
|
|
4455
|
+
call,
|
|
4456
|
+
isRequired: staticResult.isRequired
|
|
4457
|
+
};
|
|
4458
|
+
}
|
|
4459
|
+
function parseTopLevelCall(call, functions, importTracker) {
|
|
4460
|
+
const node = call.expression;
|
|
4461
|
+
if (!ts20.isIdentifier(node)) {
|
|
4461
4462
|
return null;
|
|
4462
4463
|
}
|
|
4463
|
-
|
|
4464
|
-
if (
|
|
4464
|
+
const matchingApi = functions.find((fn) => importTracker.isPotentialReferenceToNamedImport(node, fn.functionName, fn.owningModule));
|
|
4465
|
+
if (matchingApi === void 0) {
|
|
4465
4466
|
return null;
|
|
4466
4467
|
}
|
|
4467
|
-
return {
|
|
4468
|
-
apiName,
|
|
4469
|
-
call,
|
|
4470
|
-
isRequired: true
|
|
4471
|
-
};
|
|
4468
|
+
return { api: matchingApi, apiReference: node, isRequired: false };
|
|
4472
4469
|
}
|
|
4473
|
-
function
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
return node;
|
|
4470
|
+
function parseTopLevelRequiredCall(call, functions, importTracker) {
|
|
4471
|
+
const node = call.expression;
|
|
4472
|
+
if (!ts20.isPropertyAccessExpression(node) || !ts20.isIdentifier(node.expression) || node.name.text !== "required") {
|
|
4473
|
+
return null;
|
|
4478
4474
|
}
|
|
4479
|
-
|
|
4475
|
+
const expression = node.expression;
|
|
4476
|
+
const matchingApi = functions.find((fn) => importTracker.isPotentialReferenceToNamedImport(expression, fn.functionName, fn.owningModule));
|
|
4477
|
+
if (matchingApi === void 0) {
|
|
4478
|
+
return null;
|
|
4479
|
+
}
|
|
4480
|
+
return { api: matchingApi, apiReference: expression, isRequired: true };
|
|
4480
4481
|
}
|
|
4481
|
-
function
|
|
4482
|
-
|
|
4483
|
-
if (
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4482
|
+
function parseTopLevelCallFromNamespace(call, functions, importTracker) {
|
|
4483
|
+
const node = call.expression;
|
|
4484
|
+
if (!ts20.isPropertyAccessExpression(node)) {
|
|
4485
|
+
return null;
|
|
4486
|
+
}
|
|
4487
|
+
let apiReference = null;
|
|
4488
|
+
let matchingApi = void 0;
|
|
4489
|
+
let isRequired = false;
|
|
4490
|
+
if (ts20.isIdentifier(node.expression) && ts20.isIdentifier(node.name)) {
|
|
4491
|
+
const namespaceRef = node.expression;
|
|
4492
|
+
apiReference = node.name;
|
|
4493
|
+
matchingApi = functions.find((fn) => node.name.text === fn.functionName && importTracker.isPotentialReferenceToNamespaceImport(namespaceRef, fn.owningModule));
|
|
4494
|
+
} else if (ts20.isPropertyAccessExpression(node.expression) && ts20.isIdentifier(node.expression.expression) && ts20.isIdentifier(node.expression.name) && node.name.text === "required") {
|
|
4495
|
+
const potentialName = node.expression.name.text;
|
|
4496
|
+
const namespaceRef = node.expression.expression;
|
|
4497
|
+
apiReference = node.expression.name;
|
|
4498
|
+
matchingApi = functions.find((fn) => fn.functionName === potentialName && importTracker.isPotentialReferenceToNamespaceImport(namespaceRef, fn.owningModule));
|
|
4499
|
+
isRequired = true;
|
|
4500
|
+
}
|
|
4501
|
+
if (matchingApi === void 0 || apiReference === null) {
|
|
4502
|
+
return null;
|
|
4488
4503
|
}
|
|
4489
|
-
return
|
|
4504
|
+
return { api: matchingApi, apiReference, isRequired };
|
|
4490
4505
|
}
|
|
4491
4506
|
|
|
4492
4507
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/input_output_parse_options.mjs
|
|
@@ -4508,9 +4523,9 @@ function parseAndValidateInputAndOutputOptions(optionsNode) {
|
|
|
4508
4523
|
}
|
|
4509
4524
|
|
|
4510
4525
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/input_function.mjs
|
|
4511
|
-
function tryParseSignalInputMapping(member, reflector,
|
|
4526
|
+
function tryParseSignalInputMapping(member, reflector, importTracker) {
|
|
4512
4527
|
var _a;
|
|
4513
|
-
const signalInput = tryParseInitializerApiMember(["input"], member, reflector,
|
|
4528
|
+
const signalInput = tryParseInitializerApiMember([{ functionName: "input", owningModule: "@angular/core" }], member, reflector, importTracker);
|
|
4514
4529
|
if (signalInput === null) {
|
|
4515
4530
|
return null;
|
|
4516
4531
|
}
|
|
@@ -4527,9 +4542,9 @@ function tryParseSignalInputMapping(member, reflector, isCore) {
|
|
|
4527
4542
|
}
|
|
4528
4543
|
|
|
4529
4544
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/model_function.mjs
|
|
4530
|
-
function tryParseSignalModelMapping(member, reflector,
|
|
4545
|
+
function tryParseSignalModelMapping(member, reflector, importTracker) {
|
|
4531
4546
|
var _a;
|
|
4532
|
-
const model = tryParseInitializerApiMember(["model"], member, reflector,
|
|
4547
|
+
const model = tryParseInitializerApiMember([{ functionName: "model", owningModule: "@angular/core" }], member, reflector, importTracker);
|
|
4533
4548
|
if (model === null) {
|
|
4534
4549
|
return null;
|
|
4535
4550
|
}
|
|
@@ -4555,16 +4570,19 @@ function tryParseSignalModelMapping(member, reflector, isCore) {
|
|
|
4555
4570
|
}
|
|
4556
4571
|
|
|
4557
4572
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/output_function.mjs
|
|
4558
|
-
function tryParseInitializerBasedOutput(member, reflector,
|
|
4573
|
+
function tryParseInitializerBasedOutput(member, reflector, importTracker) {
|
|
4559
4574
|
var _a;
|
|
4560
|
-
const output = tryParseInitializerApiMember([
|
|
4575
|
+
const output = tryParseInitializerApiMember([
|
|
4576
|
+
{ functionName: "output", owningModule: "@angular/core" },
|
|
4577
|
+
{ functionName: "outputFromObservable", owningModule: "@angular/core/rxjs-interop" }
|
|
4578
|
+
], member, reflector, importTracker);
|
|
4561
4579
|
if (output === null) {
|
|
4562
4580
|
return null;
|
|
4563
4581
|
}
|
|
4564
4582
|
if (output.isRequired) {
|
|
4565
4583
|
throw new FatalDiagnosticError(ErrorCode.INITIALIZER_API_NO_REQUIRED_FUNCTION, output.call, `Output does not support ".required()".`);
|
|
4566
4584
|
}
|
|
4567
|
-
const optionsNode = output.call.arguments[0];
|
|
4585
|
+
const optionsNode = output.api.functionName === "output" ? output.call.arguments[0] : output.call.arguments[1];
|
|
4568
4586
|
const options = optionsNode !== void 0 ? parseAndValidateInputAndOutputOptions(optionsNode) : null;
|
|
4569
4587
|
const classPropertyName = member.name;
|
|
4570
4588
|
return {
|
|
@@ -4582,12 +4600,14 @@ import { createMayBeForwardRefExpression, outputAst as o } from "@angular/compil
|
|
|
4582
4600
|
import ts22 from "typescript";
|
|
4583
4601
|
var queryFunctionNames = ["viewChild", "viewChildren", "contentChild", "contentChildren"];
|
|
4584
4602
|
var defaultDescendantsValue = (type) => type !== "contentChildren";
|
|
4585
|
-
function tryParseSignalQueryFromInitializer(member, reflector,
|
|
4586
|
-
const
|
|
4603
|
+
function tryParseSignalQueryFromInitializer(member, reflector, importTracker) {
|
|
4604
|
+
const initializerFns = queryFunctionNames.map((fnName) => ({ functionName: fnName, owningModule: "@angular/core" }));
|
|
4605
|
+
const query = tryParseInitializerApiMember(initializerFns, member, reflector, importTracker);
|
|
4587
4606
|
if (query === null) {
|
|
4588
4607
|
return null;
|
|
4589
4608
|
}
|
|
4590
|
-
const
|
|
4609
|
+
const { functionName } = query.api;
|
|
4610
|
+
const isSingleQuery = functionName === "viewChild" || functionName === "contentChild";
|
|
4591
4611
|
const predicateNode = query.call.arguments[0];
|
|
4592
4612
|
if (predicateNode === void 0) {
|
|
4593
4613
|
throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, query.call, "No locator specified.");
|
|
@@ -4598,9 +4618,9 @@ function tryParseSignalQueryFromInitializer(member, reflector, isCore) {
|
|
|
4598
4618
|
}
|
|
4599
4619
|
const options = optionsNode && reflectObjectLiteral(optionsNode);
|
|
4600
4620
|
const read = (options == null ? void 0 : options.has("read")) ? parseReadOption(options.get("read")) : null;
|
|
4601
|
-
const descendants = (options == null ? void 0 : options.has("descendants")) ? parseDescendantsOption(options.get("descendants")) : defaultDescendantsValue(
|
|
4621
|
+
const descendants = (options == null ? void 0 : options.has("descendants")) ? parseDescendantsOption(options.get("descendants")) : defaultDescendantsValue(functionName);
|
|
4602
4622
|
return {
|
|
4603
|
-
name:
|
|
4623
|
+
name: functionName,
|
|
4604
4624
|
call: query.call,
|
|
4605
4625
|
metadata: {
|
|
4606
4626
|
isSignal: true,
|
|
@@ -4625,6 +4645,9 @@ function parseLocator(expression, reflector) {
|
|
|
4625
4645
|
return createMayBeForwardRefExpression(new o.WrappedNodeExpr(expression), unwrappedExpression !== null ? 2 : 0);
|
|
4626
4646
|
}
|
|
4627
4647
|
function parseReadOption(value) {
|
|
4648
|
+
if (ts22.isExpressionWithTypeArguments(value) || ts22.isParenthesizedExpression(value) || ts22.isAsExpression(value)) {
|
|
4649
|
+
return parseReadOption(value.expression);
|
|
4650
|
+
}
|
|
4628
4651
|
if (ts22.isPropertyAccessExpression(value) && ts22.isIdentifier(value.expression) || ts22.isIdentifier(value)) {
|
|
4629
4652
|
return new o.WrappedNodeExpr(value);
|
|
4630
4653
|
}
|
|
@@ -4643,7 +4666,7 @@ function parseDescendantsOption(value) {
|
|
|
4643
4666
|
var EMPTY_OBJECT = {};
|
|
4644
4667
|
var queryDecoratorNames = ["ViewChild", "ViewChildren", "ContentChild", "ContentChildren"];
|
|
4645
4668
|
var QUERY_TYPES = new Set(queryDecoratorNames);
|
|
4646
|
-
function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, refEmitter, referencesRegistry, isCore, annotateForClosureCompiler, compilationMode, defaultSelector, useTemplatePipeline) {
|
|
4669
|
+
function extractDirectiveMetadata(clazz, decorator, reflector, importTracker, evaluator, refEmitter, referencesRegistry, isCore, annotateForClosureCompiler, compilationMode, defaultSelector, useTemplatePipeline) {
|
|
4647
4670
|
let directive;
|
|
4648
4671
|
if (decorator.args === null || decorator.args.length === 0) {
|
|
4649
4672
|
directive = /* @__PURE__ */ new Map();
|
|
@@ -4663,12 +4686,12 @@ function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, refEmi
|
|
|
4663
4686
|
const decoratedElements = members.filter((member) => !member.isStatic && member.decorators !== null);
|
|
4664
4687
|
const coreModule = isCore ? void 0 : "@angular/core";
|
|
4665
4688
|
const inputsFromMeta = parseInputsArray(clazz, directive, evaluator, reflector, refEmitter, compilationMode);
|
|
4666
|
-
const inputsFromFields = parseInputFields(clazz, members, evaluator, reflector, refEmitter, isCore, compilationMode, inputsFromMeta, decorator);
|
|
4689
|
+
const inputsFromFields = parseInputFields(clazz, members, evaluator, reflector, importTracker, refEmitter, isCore, compilationMode, inputsFromMeta, decorator);
|
|
4667
4690
|
const inputs = ClassPropertyMapping.fromMappedObject({ ...inputsFromMeta, ...inputsFromFields });
|
|
4668
4691
|
const outputsFromMeta = parseOutputsArray(directive, evaluator);
|
|
4669
|
-
const outputsFromFields = parseOutputFields(clazz, decorator, members, isCore, reflector, evaluator, outputsFromMeta);
|
|
4692
|
+
const outputsFromFields = parseOutputFields(clazz, decorator, members, isCore, reflector, importTracker, evaluator, outputsFromMeta);
|
|
4670
4693
|
const outputs = ClassPropertyMapping.fromMappedObject({ ...outputsFromMeta, ...outputsFromFields });
|
|
4671
|
-
const { viewQueries, contentQueries } = parseQueriesOfClassFields(members, reflector, evaluator, isCore);
|
|
4694
|
+
const { viewQueries, contentQueries } = parseQueriesOfClassFields(members, reflector, importTracker, evaluator, isCore);
|
|
4672
4695
|
if (directive.has("queries")) {
|
|
4673
4696
|
const signalQueryFields = new Set([...viewQueries, ...contentQueries].filter((q) => q.isSignal).map((q) => q.propertyName));
|
|
4674
4697
|
const queriesFromDecorator = extractQueriesFromDecorator(directive.get("queries"), reflector, evaluator, isCore);
|
|
@@ -5077,11 +5100,11 @@ function tryGetDecoratorOnMember(member, decoratorName, isCore) {
|
|
|
5077
5100
|
}
|
|
5078
5101
|
return null;
|
|
5079
5102
|
}
|
|
5080
|
-
function tryParseInputFieldMapping(clazz, member, evaluator, reflector, isCore, refEmitter, compilationMode) {
|
|
5103
|
+
function tryParseInputFieldMapping(clazz, member, evaluator, reflector, importTracker, isCore, refEmitter, compilationMode) {
|
|
5081
5104
|
const classPropertyName = member.name;
|
|
5082
5105
|
const decorator = tryGetDecoratorOnMember(member, "Input", isCore);
|
|
5083
|
-
const signalInputMapping = tryParseSignalInputMapping(member, reflector,
|
|
5084
|
-
const modelInputMapping = tryParseSignalModelMapping(member, reflector,
|
|
5106
|
+
const signalInputMapping = tryParseSignalInputMapping(member, reflector, importTracker);
|
|
5107
|
+
const modelInputMapping = tryParseSignalModelMapping(member, reflector, importTracker);
|
|
5085
5108
|
if (decorator !== null && signalInputMapping !== null) {
|
|
5086
5109
|
throw new FatalDiagnosticError(ErrorCode.INITIALIZER_API_WITH_DISALLOWED_DECORATOR, decorator.node, `Using @Input with a signal input is not allowed.`);
|
|
5087
5110
|
}
|
|
@@ -5129,12 +5152,12 @@ function tryParseInputFieldMapping(clazz, member, evaluator, reflector, isCore,
|
|
|
5129
5152
|
}
|
|
5130
5153
|
return null;
|
|
5131
5154
|
}
|
|
5132
|
-
function parseInputFields(clazz, members, evaluator, reflector, refEmitter, isCore, compilationMode, inputsFromClassDecorator, classDecorator) {
|
|
5155
|
+
function parseInputFields(clazz, members, evaluator, reflector, importTracker, refEmitter, isCore, compilationMode, inputsFromClassDecorator, classDecorator) {
|
|
5133
5156
|
var _a, _b;
|
|
5134
5157
|
const inputs = {};
|
|
5135
5158
|
for (const member of members) {
|
|
5136
5159
|
const classPropertyName = member.name;
|
|
5137
|
-
const inputMapping = tryParseInputFieldMapping(clazz, member, evaluator, reflector, isCore, refEmitter, compilationMode);
|
|
5160
|
+
const inputMapping = tryParseInputFieldMapping(clazz, member, evaluator, reflector, importTracker, isCore, refEmitter, compilationMode);
|
|
5138
5161
|
if (inputMapping === null) {
|
|
5139
5162
|
continue;
|
|
5140
5163
|
}
|
|
@@ -5214,7 +5237,7 @@ function assertEmittableInputType(type, contextFile, reflector, refEmitter) {
|
|
|
5214
5237
|
node.forEachChild(walk);
|
|
5215
5238
|
})(type);
|
|
5216
5239
|
}
|
|
5217
|
-
function parseQueriesOfClassFields(members, reflector, evaluator, isCore) {
|
|
5240
|
+
function parseQueriesOfClassFields(members, reflector, importTracker, evaluator, isCore) {
|
|
5218
5241
|
var _a;
|
|
5219
5242
|
const viewQueries = [];
|
|
5220
5243
|
const contentQueries = [];
|
|
@@ -5224,7 +5247,7 @@ function parseQueriesOfClassFields(members, reflector, evaluator, isCore) {
|
|
|
5224
5247
|
const decoratorContentChildren = [];
|
|
5225
5248
|
for (const member of members) {
|
|
5226
5249
|
const decoratorQuery = tryGetQueryFromFieldDecorator(member, reflector, evaluator, isCore);
|
|
5227
|
-
const signalQuery = tryParseSignalQueryFromInitializer(member, reflector,
|
|
5250
|
+
const signalQuery = tryParseSignalQueryFromInitializer(member, reflector, importTracker);
|
|
5228
5251
|
if (decoratorQuery !== null && signalQuery !== null) {
|
|
5229
5252
|
throw new FatalDiagnosticError(ErrorCode.INITIALIZER_API_WITH_DISALLOWED_DECORATOR, decoratorQuery.decorator.node, `Using @${decoratorQuery.name} with a signal-based query is not allowed.`);
|
|
5230
5253
|
}
|
|
@@ -5269,13 +5292,13 @@ function parseOutputsArray(directive, evaluator) {
|
|
|
5269
5292
|
const metaValues = parseFieldStringArrayValue(directive, "outputs", evaluator);
|
|
5270
5293
|
return metaValues ? parseMappingStringArray(metaValues) : EMPTY_OBJECT;
|
|
5271
5294
|
}
|
|
5272
|
-
function parseOutputFields(clazz, classDecorator, members, isCore, reflector, evaluator, outputsFromMeta) {
|
|
5295
|
+
function parseOutputFields(clazz, classDecorator, members, isCore, reflector, importTracker, evaluator, outputsFromMeta) {
|
|
5273
5296
|
var _a, _b, _c;
|
|
5274
5297
|
const outputs = {};
|
|
5275
5298
|
for (const member of members) {
|
|
5276
5299
|
const decoratorOutput = tryParseDecoratorOutput(member, evaluator, isCore);
|
|
5277
|
-
const initializerOutput = tryParseInitializerBasedOutput(member, reflector,
|
|
5278
|
-
const modelMapping = tryParseSignalModelMapping(member, reflector,
|
|
5300
|
+
const initializerOutput = tryParseInitializerBasedOutput(member, reflector, importTracker);
|
|
5301
|
+
const modelMapping = tryParseSignalModelMapping(member, reflector, importTracker);
|
|
5279
5302
|
if (decoratorOutput !== null && initializerOutput !== null) {
|
|
5280
5303
|
throw new FatalDiagnosticError(ErrorCode.INITIALIZER_API_WITH_DISALLOWED_DECORATOR, decoratorOutput.decorator.node, `Using "@Output" with "output()" is not allowed.`);
|
|
5281
5304
|
}
|
|
@@ -5537,7 +5560,7 @@ var LIFECYCLE_HOOKS = /* @__PURE__ */ new Set([
|
|
|
5537
5560
|
"ngAfterContentChecked"
|
|
5538
5561
|
]);
|
|
5539
5562
|
var DirectiveDecoratorHandler = class {
|
|
5540
|
-
constructor(reflector, evaluator, metaRegistry, scopeRegistry, metaReader, injectableRegistry, refEmitter, referencesRegistry, isCore, strictCtorDeps, semanticDepGraphUpdater, annotateForClosureCompiler, perf, includeClassMetadata, compilationMode, useTemplatePipeline, generateExtraImportsInLocalMode) {
|
|
5563
|
+
constructor(reflector, evaluator, metaRegistry, scopeRegistry, metaReader, injectableRegistry, refEmitter, referencesRegistry, isCore, strictCtorDeps, semanticDepGraphUpdater, annotateForClosureCompiler, perf, importTracker, includeClassMetadata, compilationMode, useTemplatePipeline, generateExtraImportsInLocalMode) {
|
|
5541
5564
|
this.reflector = reflector;
|
|
5542
5565
|
this.evaluator = evaluator;
|
|
5543
5566
|
this.metaRegistry = metaRegistry;
|
|
@@ -5551,6 +5574,7 @@ var DirectiveDecoratorHandler = class {
|
|
|
5551
5574
|
this.semanticDepGraphUpdater = semanticDepGraphUpdater;
|
|
5552
5575
|
this.annotateForClosureCompiler = annotateForClosureCompiler;
|
|
5553
5576
|
this.perf = perf;
|
|
5577
|
+
this.importTracker = importTracker;
|
|
5554
5578
|
this.includeClassMetadata = includeClassMetadata;
|
|
5555
5579
|
this.compilationMode = compilationMode;
|
|
5556
5580
|
this.useTemplatePipeline = useTemplatePipeline;
|
|
@@ -5580,6 +5604,7 @@ var DirectiveDecoratorHandler = class {
|
|
|
5580
5604
|
node,
|
|
5581
5605
|
decorator,
|
|
5582
5606
|
this.reflector,
|
|
5607
|
+
this.importTracker,
|
|
5583
5608
|
this.evaluator,
|
|
5584
5609
|
this.refEmitter,
|
|
5585
5610
|
this.referencesRegistry,
|
|
@@ -5746,7 +5771,12 @@ function createModuleWithProvidersResolver(reflector, isCore) {
|
|
|
5746
5771
|
if (ts24.isTypeLiteralNode(t)) {
|
|
5747
5772
|
for (const m of t.members) {
|
|
5748
5773
|
const ngModuleType = ts24.isPropertySignature(m) && ts24.isIdentifier(m.name) && m.name.text === "ngModule" && m.type || null;
|
|
5749
|
-
|
|
5774
|
+
let ngModuleExpression = null;
|
|
5775
|
+
if (ngModuleType !== null && ts24.isTypeQueryNode(ngModuleType)) {
|
|
5776
|
+
ngModuleExpression = entityNameToValue(ngModuleType.exprName);
|
|
5777
|
+
} else if (ngModuleType !== null) {
|
|
5778
|
+
ngModuleExpression = typeNodeToValueExpr(ngModuleType);
|
|
5779
|
+
}
|
|
5750
5780
|
if (ngModuleExpression) {
|
|
5751
5781
|
return ngModuleExpression;
|
|
5752
5782
|
}
|
|
@@ -6881,7 +6911,7 @@ var EMPTY_ARRAY2 = [];
|
|
|
6881
6911
|
var isUsedDirective = (decl) => decl.kind === R3TemplateDependencyKind.Directive;
|
|
6882
6912
|
var isUsedPipe = (decl) => decl.kind === R3TemplateDependencyKind.Pipe;
|
|
6883
6913
|
var ComponentDecoratorHandler = class {
|
|
6884
|
-
constructor(reflector, evaluator, metaRegistry, metaReader, scopeReader, dtsScopeReader, scopeRegistry, typeCheckScopeRegistry, resourceRegistry, isCore, strictCtorDeps, resourceLoader, rootDirs, defaultPreserveWhitespaces, i18nUseExternalIds, enableI18nLegacyMessageIdFormat, usePoisonedData, i18nNormalizeLineEndingsInICUs, moduleResolver, cycleAnalyzer, cycleHandlingStrategy, refEmitter, referencesRegistry, depTracker, injectableRegistry, semanticDepGraphUpdater, annotateForClosureCompiler, perf, hostDirectivesResolver, includeClassMetadata, compilationMode, deferredSymbolTracker, forbidOrphanRendering, enableBlockSyntax, useTemplatePipeline, localCompilationExtraImportsTracker) {
|
|
6914
|
+
constructor(reflector, evaluator, metaRegistry, metaReader, scopeReader, dtsScopeReader, scopeRegistry, typeCheckScopeRegistry, resourceRegistry, isCore, strictCtorDeps, resourceLoader, rootDirs, defaultPreserveWhitespaces, i18nUseExternalIds, enableI18nLegacyMessageIdFormat, usePoisonedData, i18nNormalizeLineEndingsInICUs, moduleResolver, cycleAnalyzer, cycleHandlingStrategy, refEmitter, referencesRegistry, depTracker, injectableRegistry, semanticDepGraphUpdater, annotateForClosureCompiler, perf, hostDirectivesResolver, importTracker, includeClassMetadata, compilationMode, deferredSymbolTracker, forbidOrphanRendering, enableBlockSyntax, useTemplatePipeline, localCompilationExtraImportsTracker) {
|
|
6885
6915
|
this.reflector = reflector;
|
|
6886
6916
|
this.evaluator = evaluator;
|
|
6887
6917
|
this.metaRegistry = metaRegistry;
|
|
@@ -6911,6 +6941,7 @@ var ComponentDecoratorHandler = class {
|
|
|
6911
6941
|
this.annotateForClosureCompiler = annotateForClosureCompiler;
|
|
6912
6942
|
this.perf = perf;
|
|
6913
6943
|
this.hostDirectivesResolver = hostDirectivesResolver;
|
|
6944
|
+
this.importTracker = importTracker;
|
|
6914
6945
|
this.includeClassMetadata = includeClassMetadata;
|
|
6915
6946
|
this.compilationMode = compilationMode;
|
|
6916
6947
|
this.deferredSymbolTracker = deferredSymbolTracker;
|
|
@@ -6994,7 +7025,7 @@ var ComponentDecoratorHandler = class {
|
|
|
6994
7025
|
this.literalCache.delete(decorator);
|
|
6995
7026
|
let diagnostics;
|
|
6996
7027
|
let isPoisoned = false;
|
|
6997
|
-
const directiveResult = extractDirectiveMetadata(node, decorator, this.reflector, this.evaluator, this.refEmitter, this.referencesRegistry, this.isCore, this.annotateForClosureCompiler, this.compilationMode, this.elementSchemaRegistry.getDefaultComponentElementName(), this.useTemplatePipeline);
|
|
7028
|
+
const directiveResult = extractDirectiveMetadata(node, decorator, this.reflector, this.importTracker, this.evaluator, this.refEmitter, this.referencesRegistry, this.isCore, this.annotateForClosureCompiler, this.compilationMode, this.elementSchemaRegistry.getDefaultComponentElementName(), this.useTemplatePipeline);
|
|
6998
7029
|
if (directiveResult === void 0) {
|
|
6999
7030
|
return {};
|
|
7000
7031
|
}
|
|
@@ -8262,9 +8293,6 @@ var PipeDecoratorHandler = class {
|
|
|
8262
8293
|
};
|
|
8263
8294
|
|
|
8264
8295
|
export {
|
|
8265
|
-
DynamicValue,
|
|
8266
|
-
StaticInterpreter,
|
|
8267
|
-
PartialEvaluator,
|
|
8268
8296
|
isAngularDecorator,
|
|
8269
8297
|
getAngularDecorators,
|
|
8270
8298
|
forwardRefResolver,
|
|
@@ -8277,6 +8305,9 @@ export {
|
|
|
8277
8305
|
ResourceRegistry,
|
|
8278
8306
|
ExportedProviderStatusResolver,
|
|
8279
8307
|
HostDirectivesResolver,
|
|
8308
|
+
DynamicValue,
|
|
8309
|
+
StaticInterpreter,
|
|
8310
|
+
PartialEvaluator,
|
|
8280
8311
|
CompilationMode,
|
|
8281
8312
|
aliasTransformFactory,
|
|
8282
8313
|
TraitCompiler,
|
|
@@ -8317,4 +8348,4 @@ export {
|
|
|
8317
8348
|
* Use of this source code is governed by an MIT-style license that can be
|
|
8318
8349
|
* found in the LICENSE file at https://angular.io/license
|
|
8319
8350
|
*/
|
|
8320
|
-
//# sourceMappingURL=chunk-
|
|
8351
|
+
//# sourceMappingURL=chunk-WYZJV3LZ.js.map
|