@angular/compiler-cli 17.3.0-next.0 → 17.3.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/{chunk-NZQBYQYJ.js → chunk-2CAUFIKU.js} +18 -18
- package/bundles/{chunk-NZQBYQYJ.js.map → chunk-2CAUFIKU.js.map} +1 -1
- package/bundles/{chunk-GWFFFWTW.js → chunk-5A5Y7O22.js} +103 -69
- package/bundles/chunk-5A5Y7O22.js.map +6 -0
- package/bundles/{chunk-XLXSE3QH.js → chunk-7VU7HCQZ.js} +213 -153
- package/bundles/{chunk-XLXSE3QH.js.map → chunk-7VU7HCQZ.js.map} +3 -3
- package/bundles/{chunk-JKNKVO7U.js → chunk-FPKC3HSK.js} +2 -2
- package/bundles/{chunk-VPKIGOWE.js → chunk-IIZOI4XA.js} +4 -4
- package/bundles/{chunk-OW77LBBK.js → chunk-YVYW546M.js} +487 -483
- package/bundles/chunk-YVYW546M.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 +2 -3
- 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/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-JKNKVO7U.js.map → chunk-FPKC3HSK.js.map} +0 -0
- /package/bundles/{chunk-VPKIGOWE.js.map → chunk-IIZOI4XA.js.map} +0 -0
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
translateStatement,
|
|
30
30
|
translateType,
|
|
31
31
|
typeNodeToValueExpr
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-7VU7HCQZ.js";
|
|
33
33
|
import {
|
|
34
34
|
PerfEvent,
|
|
35
35
|
PerfPhase
|
|
@@ -40,6 +40,262 @@ import {
|
|
|
40
40
|
relative
|
|
41
41
|
} from "./chunk-75YFKYUJ.js";
|
|
42
42
|
|
|
43
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/util.mjs
|
|
44
|
+
import { ExternalExpr, ParseLocation, ParseSourceFile, ParseSourceSpan, ReadPropExpr, WrappedNodeExpr } from "@angular/compiler";
|
|
45
|
+
import ts from "typescript";
|
|
46
|
+
var CORE_MODULE = "@angular/core";
|
|
47
|
+
function valueReferenceToExpression(valueRef) {
|
|
48
|
+
if (valueRef.kind === 2) {
|
|
49
|
+
return null;
|
|
50
|
+
} else if (valueRef.kind === 0) {
|
|
51
|
+
const expr = new WrappedNodeExpr(valueRef.expression);
|
|
52
|
+
if (valueRef.defaultImportStatement !== null) {
|
|
53
|
+
attachDefaultImportDeclaration(expr, valueRef.defaultImportStatement);
|
|
54
|
+
}
|
|
55
|
+
return expr;
|
|
56
|
+
} else {
|
|
57
|
+
let importExpr = new ExternalExpr({ moduleName: valueRef.moduleName, name: valueRef.importedName });
|
|
58
|
+
if (valueRef.nestedPath !== null) {
|
|
59
|
+
for (const property of valueRef.nestedPath) {
|
|
60
|
+
importExpr = new ReadPropExpr(importExpr, property);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return importExpr;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function toR3Reference(origin, ref, context, refEmitter) {
|
|
67
|
+
const emittedValueRef = refEmitter.emit(ref, context);
|
|
68
|
+
assertSuccessfulReferenceEmit(emittedValueRef, origin, "class");
|
|
69
|
+
const emittedTypeRef = refEmitter.emit(ref, context, ImportFlags.ForceNewImport | ImportFlags.AllowTypeImports);
|
|
70
|
+
assertSuccessfulReferenceEmit(emittedTypeRef, origin, "class");
|
|
71
|
+
return {
|
|
72
|
+
value: emittedValueRef.expression,
|
|
73
|
+
type: emittedTypeRef.expression
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function isAngularCore(decorator) {
|
|
77
|
+
return decorator.import !== null && decorator.import.from === CORE_MODULE;
|
|
78
|
+
}
|
|
79
|
+
function isAngularCoreReference(reference, symbolName) {
|
|
80
|
+
return reference.ownedByModuleGuess === CORE_MODULE && reference.debugName === symbolName;
|
|
81
|
+
}
|
|
82
|
+
function findAngularDecorator(decorators, name, isCore) {
|
|
83
|
+
return decorators.find((decorator) => isAngularDecorator(decorator, name, isCore));
|
|
84
|
+
}
|
|
85
|
+
function isAngularDecorator(decorator, name, isCore) {
|
|
86
|
+
if (isCore) {
|
|
87
|
+
return decorator.name === name;
|
|
88
|
+
} else if (isAngularCore(decorator)) {
|
|
89
|
+
return decorator.import.name === name;
|
|
90
|
+
}
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
function getAngularDecorators(decorators, names, isCore) {
|
|
94
|
+
return decorators.filter((decorator) => {
|
|
95
|
+
var _a;
|
|
96
|
+
const name = isCore ? decorator.name : (_a = decorator.import) == null ? void 0 : _a.name;
|
|
97
|
+
if (name === void 0 || !names.includes(name)) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
return isCore || isAngularCore(decorator);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
function unwrapExpression(node) {
|
|
104
|
+
while (ts.isAsExpression(node) || ts.isParenthesizedExpression(node)) {
|
|
105
|
+
node = node.expression;
|
|
106
|
+
}
|
|
107
|
+
return node;
|
|
108
|
+
}
|
|
109
|
+
function expandForwardRef(arg) {
|
|
110
|
+
arg = unwrapExpression(arg);
|
|
111
|
+
if (!ts.isArrowFunction(arg) && !ts.isFunctionExpression(arg)) {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
const body = arg.body;
|
|
115
|
+
if (ts.isBlock(body)) {
|
|
116
|
+
if (body.statements.length !== 1) {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
const stmt = body.statements[0];
|
|
120
|
+
if (!ts.isReturnStatement(stmt) || stmt.expression === void 0) {
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
return stmt.expression;
|
|
124
|
+
} else {
|
|
125
|
+
return body;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function tryUnwrapForwardRef(node, reflector) {
|
|
129
|
+
node = unwrapExpression(node);
|
|
130
|
+
if (!ts.isCallExpression(node) || node.arguments.length !== 1) {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
const fn = ts.isPropertyAccessExpression(node.expression) ? node.expression.name : node.expression;
|
|
134
|
+
if (!ts.isIdentifier(fn)) {
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
const expr = expandForwardRef(node.arguments[0]);
|
|
138
|
+
if (expr === null) {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
const imp = reflector.getImportOfIdentifier(fn);
|
|
142
|
+
if (imp === null || imp.from !== "@angular/core" || imp.name !== "forwardRef") {
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
return expr;
|
|
146
|
+
}
|
|
147
|
+
var forwardRefResolver = (fn, callExpr, resolve, unresolvable) => {
|
|
148
|
+
if (!isAngularCoreReference(fn, "forwardRef") || callExpr.arguments.length !== 1) {
|
|
149
|
+
return unresolvable;
|
|
150
|
+
}
|
|
151
|
+
const expanded = expandForwardRef(callExpr.arguments[0]);
|
|
152
|
+
if (expanded !== null) {
|
|
153
|
+
return resolve(expanded);
|
|
154
|
+
} else {
|
|
155
|
+
return unresolvable;
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
function combineResolvers(resolvers) {
|
|
159
|
+
return (fn, callExpr, resolve, unresolvable) => {
|
|
160
|
+
for (const resolver of resolvers) {
|
|
161
|
+
const resolved = resolver(fn, callExpr, resolve, unresolvable);
|
|
162
|
+
if (resolved !== unresolvable) {
|
|
163
|
+
return resolved;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return unresolvable;
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
function isExpressionForwardReference(expr, context, contextSource) {
|
|
170
|
+
if (isWrappedTsNodeExpr(expr)) {
|
|
171
|
+
const node = ts.getOriginalNode(expr.node);
|
|
172
|
+
return node.getSourceFile() === contextSource && context.pos < node.pos;
|
|
173
|
+
} else {
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
function isWrappedTsNodeExpr(expr) {
|
|
178
|
+
return expr instanceof WrappedNodeExpr;
|
|
179
|
+
}
|
|
180
|
+
function readBaseClass(node, reflector, evaluator) {
|
|
181
|
+
const baseExpression = reflector.getBaseClassExpression(node);
|
|
182
|
+
if (baseExpression !== null) {
|
|
183
|
+
const baseClass = evaluator.evaluate(baseExpression);
|
|
184
|
+
if (baseClass instanceof Reference && reflector.isClass(baseClass.node)) {
|
|
185
|
+
return baseClass;
|
|
186
|
+
} else {
|
|
187
|
+
return "dynamic";
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
var parensWrapperTransformerFactory = (context) => {
|
|
193
|
+
const visitor = (node) => {
|
|
194
|
+
const visited = ts.visitEachChild(node, visitor, context);
|
|
195
|
+
if (ts.isArrowFunction(visited) || ts.isFunctionExpression(visited)) {
|
|
196
|
+
return ts.factory.createParenthesizedExpression(visited);
|
|
197
|
+
}
|
|
198
|
+
return visited;
|
|
199
|
+
};
|
|
200
|
+
return (node) => ts.visitEachChild(node, visitor, context);
|
|
201
|
+
};
|
|
202
|
+
function wrapFunctionExpressionsInParens(expression) {
|
|
203
|
+
return ts.transform(expression, [parensWrapperTransformerFactory]).transformed[0];
|
|
204
|
+
}
|
|
205
|
+
function resolveProvidersRequiringFactory(rawProviders, reflector, evaluator) {
|
|
206
|
+
const providers = /* @__PURE__ */ new Set();
|
|
207
|
+
const resolvedProviders = evaluator.evaluate(rawProviders);
|
|
208
|
+
if (!Array.isArray(resolvedProviders)) {
|
|
209
|
+
return providers;
|
|
210
|
+
}
|
|
211
|
+
resolvedProviders.forEach(function processProviders(provider) {
|
|
212
|
+
let tokenClass = null;
|
|
213
|
+
if (Array.isArray(provider)) {
|
|
214
|
+
provider.forEach(processProviders);
|
|
215
|
+
} else if (provider instanceof Reference) {
|
|
216
|
+
tokenClass = provider;
|
|
217
|
+
} else if (provider instanceof Map && provider.has("useClass") && !provider.has("deps")) {
|
|
218
|
+
const useExisting = provider.get("useClass");
|
|
219
|
+
if (useExisting instanceof Reference) {
|
|
220
|
+
tokenClass = useExisting;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
if (tokenClass !== null && !tokenClass.node.getSourceFile().isDeclarationFile && reflector.isClass(tokenClass.node)) {
|
|
224
|
+
const constructorParameters = reflector.getConstructorParameters(tokenClass.node);
|
|
225
|
+
if (constructorParameters !== null && constructorParameters.length > 0) {
|
|
226
|
+
providers.add(tokenClass);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
return providers;
|
|
231
|
+
}
|
|
232
|
+
function wrapTypeReference(reflector, clazz) {
|
|
233
|
+
const value = new WrappedNodeExpr(clazz.name);
|
|
234
|
+
const type = value;
|
|
235
|
+
return { value, type };
|
|
236
|
+
}
|
|
237
|
+
function createSourceSpan(node) {
|
|
238
|
+
const sf = node.getSourceFile();
|
|
239
|
+
const [startOffset, endOffset] = [node.getStart(), node.getEnd()];
|
|
240
|
+
const { line: startLine, character: startCol } = sf.getLineAndCharacterOfPosition(startOffset);
|
|
241
|
+
const { line: endLine, character: endCol } = sf.getLineAndCharacterOfPosition(endOffset);
|
|
242
|
+
const parseSf = new ParseSourceFile(sf.getFullText(), sf.fileName);
|
|
243
|
+
return new ParseSourceSpan(new ParseLocation(parseSf, startOffset, startLine + 1, startCol + 1), new ParseLocation(parseSf, endOffset, endLine + 1, endCol + 1));
|
|
244
|
+
}
|
|
245
|
+
function compileResults(fac, def, metadataStmt, propName, additionalFields, deferrableImports, debugInfo = null) {
|
|
246
|
+
const statements = def.statements;
|
|
247
|
+
if (metadataStmt !== null) {
|
|
248
|
+
statements.push(metadataStmt);
|
|
249
|
+
}
|
|
250
|
+
if (debugInfo !== null) {
|
|
251
|
+
statements.push(debugInfo);
|
|
252
|
+
}
|
|
253
|
+
const results = [
|
|
254
|
+
fac,
|
|
255
|
+
{
|
|
256
|
+
name: propName,
|
|
257
|
+
initializer: def.expression,
|
|
258
|
+
statements: def.statements,
|
|
259
|
+
type: def.type,
|
|
260
|
+
deferrableImports
|
|
261
|
+
}
|
|
262
|
+
];
|
|
263
|
+
if (additionalFields !== null) {
|
|
264
|
+
results.push(...additionalFields);
|
|
265
|
+
}
|
|
266
|
+
return results;
|
|
267
|
+
}
|
|
268
|
+
function toFactoryMetadata(meta, target) {
|
|
269
|
+
return {
|
|
270
|
+
name: meta.name,
|
|
271
|
+
type: meta.type,
|
|
272
|
+
typeArgumentCount: meta.typeArgumentCount,
|
|
273
|
+
deps: meta.deps,
|
|
274
|
+
target
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
function resolveImportedFile(moduleResolver, importedFile, expr, origin) {
|
|
278
|
+
if (importedFile !== "unknown") {
|
|
279
|
+
return importedFile;
|
|
280
|
+
}
|
|
281
|
+
if (!(expr instanceof ExternalExpr)) {
|
|
282
|
+
return null;
|
|
283
|
+
}
|
|
284
|
+
return moduleResolver.resolveModule(expr.value.moduleName, origin.fileName);
|
|
285
|
+
}
|
|
286
|
+
function getOriginNodeForDiagnostics(expr, container) {
|
|
287
|
+
const nodeSf = expr.getSourceFile();
|
|
288
|
+
const exprSf = container.getSourceFile();
|
|
289
|
+
if (nodeSf === exprSf && expr.pos >= container.pos && expr.end <= container.end) {
|
|
290
|
+
return expr;
|
|
291
|
+
} else {
|
|
292
|
+
return container;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
function isAbstractClassDeclaration(clazz) {
|
|
296
|
+
return ts.canHaveModifiers(clazz) && clazz.modifiers !== void 0 ? clazz.modifiers.some((mod) => mod.kind === ts.SyntaxKind.AbstractKeyword) : false;
|
|
297
|
+
}
|
|
298
|
+
|
|
43
299
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/dynamic.mjs
|
|
44
300
|
var DynamicValue = class {
|
|
45
301
|
constructor(node, reason, code) {
|
|
@@ -131,7 +387,7 @@ var DynamicValue = class {
|
|
|
131
387
|
};
|
|
132
388
|
|
|
133
389
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/interpreter.mjs
|
|
134
|
-
import
|
|
390
|
+
import ts2 from "typescript";
|
|
135
391
|
|
|
136
392
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/result.mjs
|
|
137
393
|
var ResolvedModule = class {
|
|
@@ -230,34 +486,34 @@ function referenceBinaryOp(op) {
|
|
|
230
486
|
return { op, literal: false };
|
|
231
487
|
}
|
|
232
488
|
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
|
-
[
|
|
489
|
+
[ts2.SyntaxKind.PlusToken, literalBinaryOp((a, b) => a + b)],
|
|
490
|
+
[ts2.SyntaxKind.MinusToken, literalBinaryOp((a, b) => a - b)],
|
|
491
|
+
[ts2.SyntaxKind.AsteriskToken, literalBinaryOp((a, b) => a * b)],
|
|
492
|
+
[ts2.SyntaxKind.SlashToken, literalBinaryOp((a, b) => a / b)],
|
|
493
|
+
[ts2.SyntaxKind.PercentToken, literalBinaryOp((a, b) => a % b)],
|
|
494
|
+
[ts2.SyntaxKind.AmpersandToken, literalBinaryOp((a, b) => a & b)],
|
|
495
|
+
[ts2.SyntaxKind.BarToken, literalBinaryOp((a, b) => a | b)],
|
|
496
|
+
[ts2.SyntaxKind.CaretToken, literalBinaryOp((a, b) => a ^ b)],
|
|
497
|
+
[ts2.SyntaxKind.LessThanToken, literalBinaryOp((a, b) => a < b)],
|
|
498
|
+
[ts2.SyntaxKind.LessThanEqualsToken, literalBinaryOp((a, b) => a <= b)],
|
|
499
|
+
[ts2.SyntaxKind.GreaterThanToken, literalBinaryOp((a, b) => a > b)],
|
|
500
|
+
[ts2.SyntaxKind.GreaterThanEqualsToken, literalBinaryOp((a, b) => a >= b)],
|
|
501
|
+
[ts2.SyntaxKind.EqualsEqualsToken, literalBinaryOp((a, b) => a == b)],
|
|
502
|
+
[ts2.SyntaxKind.EqualsEqualsEqualsToken, literalBinaryOp((a, b) => a === b)],
|
|
503
|
+
[ts2.SyntaxKind.ExclamationEqualsToken, literalBinaryOp((a, b) => a != b)],
|
|
504
|
+
[ts2.SyntaxKind.ExclamationEqualsEqualsToken, literalBinaryOp((a, b) => a !== b)],
|
|
505
|
+
[ts2.SyntaxKind.LessThanLessThanToken, literalBinaryOp((a, b) => a << b)],
|
|
506
|
+
[ts2.SyntaxKind.GreaterThanGreaterThanToken, literalBinaryOp((a, b) => a >> b)],
|
|
507
|
+
[ts2.SyntaxKind.GreaterThanGreaterThanGreaterThanToken, literalBinaryOp((a, b) => a >>> b)],
|
|
508
|
+
[ts2.SyntaxKind.AsteriskAsteriskToken, literalBinaryOp((a, b) => Math.pow(a, b))],
|
|
509
|
+
[ts2.SyntaxKind.AmpersandAmpersandToken, referenceBinaryOp((a, b) => a && b)],
|
|
510
|
+
[ts2.SyntaxKind.BarBarToken, referenceBinaryOp((a, b) => a || b)]
|
|
255
511
|
]);
|
|
256
512
|
var UNARY_OPERATORS = /* @__PURE__ */ new Map([
|
|
257
|
-
[
|
|
258
|
-
[
|
|
259
|
-
[
|
|
260
|
-
[
|
|
513
|
+
[ts2.SyntaxKind.TildeToken, (a) => ~a],
|
|
514
|
+
[ts2.SyntaxKind.MinusToken, (a) => -a],
|
|
515
|
+
[ts2.SyntaxKind.PlusToken, (a) => +a],
|
|
516
|
+
[ts2.SyntaxKind.ExclamationToken, (a) => !a]
|
|
261
517
|
]);
|
|
262
518
|
var StaticInterpreter = class {
|
|
263
519
|
constructor(host, checker, dependencyTracker) {
|
|
@@ -270,43 +526,43 @@ var StaticInterpreter = class {
|
|
|
270
526
|
}
|
|
271
527
|
visitExpression(node, context) {
|
|
272
528
|
let result;
|
|
273
|
-
if (node.kind ===
|
|
529
|
+
if (node.kind === ts2.SyntaxKind.TrueKeyword) {
|
|
274
530
|
return true;
|
|
275
|
-
} else if (node.kind ===
|
|
531
|
+
} else if (node.kind === ts2.SyntaxKind.FalseKeyword) {
|
|
276
532
|
return false;
|
|
277
|
-
} else if (node.kind ===
|
|
533
|
+
} else if (node.kind === ts2.SyntaxKind.NullKeyword) {
|
|
278
534
|
return null;
|
|
279
|
-
} else if (
|
|
535
|
+
} else if (ts2.isStringLiteral(node)) {
|
|
280
536
|
return node.text;
|
|
281
|
-
} else if (
|
|
537
|
+
} else if (ts2.isNoSubstitutionTemplateLiteral(node)) {
|
|
282
538
|
return node.text;
|
|
283
|
-
} else if (
|
|
539
|
+
} else if (ts2.isTemplateExpression(node)) {
|
|
284
540
|
result = this.visitTemplateExpression(node, context);
|
|
285
|
-
} else if (
|
|
541
|
+
} else if (ts2.isNumericLiteral(node)) {
|
|
286
542
|
return parseFloat(node.text);
|
|
287
|
-
} else if (
|
|
543
|
+
} else if (ts2.isObjectLiteralExpression(node)) {
|
|
288
544
|
result = this.visitObjectLiteralExpression(node, context);
|
|
289
|
-
} else if (
|
|
545
|
+
} else if (ts2.isIdentifier(node)) {
|
|
290
546
|
result = this.visitIdentifier(node, context);
|
|
291
|
-
} else if (
|
|
547
|
+
} else if (ts2.isPropertyAccessExpression(node)) {
|
|
292
548
|
result = this.visitPropertyAccessExpression(node, context);
|
|
293
|
-
} else if (
|
|
549
|
+
} else if (ts2.isCallExpression(node)) {
|
|
294
550
|
result = this.visitCallExpression(node, context);
|
|
295
|
-
} else if (
|
|
551
|
+
} else if (ts2.isConditionalExpression(node)) {
|
|
296
552
|
result = this.visitConditionalExpression(node, context);
|
|
297
|
-
} else if (
|
|
553
|
+
} else if (ts2.isPrefixUnaryExpression(node)) {
|
|
298
554
|
result = this.visitPrefixUnaryExpression(node, context);
|
|
299
|
-
} else if (
|
|
555
|
+
} else if (ts2.isBinaryExpression(node)) {
|
|
300
556
|
result = this.visitBinaryExpression(node, context);
|
|
301
|
-
} else if (
|
|
557
|
+
} else if (ts2.isArrayLiteralExpression(node)) {
|
|
302
558
|
result = this.visitArrayLiteralExpression(node, context);
|
|
303
|
-
} else if (
|
|
559
|
+
} else if (ts2.isParenthesizedExpression(node)) {
|
|
304
560
|
result = this.visitParenthesizedExpression(node, context);
|
|
305
|
-
} else if (
|
|
561
|
+
} else if (ts2.isElementAccessExpression(node)) {
|
|
306
562
|
result = this.visitElementAccessExpression(node, context);
|
|
307
|
-
} else if (
|
|
563
|
+
} else if (ts2.isAsExpression(node)) {
|
|
308
564
|
result = this.visitExpression(node.expression, context);
|
|
309
|
-
} else if (
|
|
565
|
+
} else if (ts2.isNonNullExpression(node)) {
|
|
310
566
|
result = this.visitExpression(node.expression, context);
|
|
311
567
|
} else if (this.host.isClass(node)) {
|
|
312
568
|
result = this.visitDeclaration(node, context);
|
|
@@ -322,7 +578,7 @@ var StaticInterpreter = class {
|
|
|
322
578
|
const array = [];
|
|
323
579
|
for (let i = 0; i < node.elements.length; i++) {
|
|
324
580
|
const element = node.elements[i];
|
|
325
|
-
if (
|
|
581
|
+
if (ts2.isSpreadElement(element)) {
|
|
326
582
|
array.push(...this.visitSpreadElement(element, context));
|
|
327
583
|
} else {
|
|
328
584
|
array.push(this.visitExpression(element, context));
|
|
@@ -334,20 +590,20 @@ var StaticInterpreter = class {
|
|
|
334
590
|
const map = /* @__PURE__ */ new Map();
|
|
335
591
|
for (let i = 0; i < node.properties.length; i++) {
|
|
336
592
|
const property = node.properties[i];
|
|
337
|
-
if (
|
|
593
|
+
if (ts2.isPropertyAssignment(property)) {
|
|
338
594
|
const name = this.stringNameFromPropertyName(property.name, context);
|
|
339
595
|
if (name === void 0) {
|
|
340
596
|
return DynamicValue.fromDynamicInput(node, DynamicValue.fromDynamicString(property.name));
|
|
341
597
|
}
|
|
342
598
|
map.set(name, this.visitExpression(property.initializer, context));
|
|
343
|
-
} else if (
|
|
599
|
+
} else if (ts2.isShorthandPropertyAssignment(property)) {
|
|
344
600
|
const symbol = this.checker.getShorthandAssignmentValueSymbol(property);
|
|
345
601
|
if (symbol === void 0 || symbol.valueDeclaration === void 0) {
|
|
346
602
|
map.set(property.name.text, DynamicValue.fromUnknown(property));
|
|
347
603
|
} else {
|
|
348
604
|
map.set(property.name.text, this.visitDeclaration(symbol.valueDeclaration, context));
|
|
349
605
|
}
|
|
350
|
-
} else if (
|
|
606
|
+
} else if (ts2.isSpreadAssignment(property)) {
|
|
351
607
|
const spread = this.visitExpression(property.expression, context);
|
|
352
608
|
if (spread instanceof DynamicValue) {
|
|
353
609
|
return DynamicValue.fromDynamicInput(node, spread);
|
|
@@ -379,7 +635,7 @@ var StaticInterpreter = class {
|
|
|
379
635
|
visitIdentifier(node, context) {
|
|
380
636
|
const decl = this.host.getDeclarationOfIdentifier(node);
|
|
381
637
|
if (decl === null) {
|
|
382
|
-
if (
|
|
638
|
+
if (ts2.identifierToKeywordKind(node) === ts2.SyntaxKind.UndefinedKeyword) {
|
|
383
639
|
return void 0;
|
|
384
640
|
} else {
|
|
385
641
|
if (this.dependencyTracker !== null && this.host.getImportOfIdentifier(node) !== null) {
|
|
@@ -405,17 +661,17 @@ var StaticInterpreter = class {
|
|
|
405
661
|
}
|
|
406
662
|
if (this.host.isClass(node)) {
|
|
407
663
|
return this.getReference(node, context);
|
|
408
|
-
} else if (
|
|
664
|
+
} else if (ts2.isVariableDeclaration(node)) {
|
|
409
665
|
return this.visitVariableDeclaration(node, context);
|
|
410
|
-
} else if (
|
|
666
|
+
} else if (ts2.isParameter(node) && context.scope.has(node)) {
|
|
411
667
|
return context.scope.get(node);
|
|
412
|
-
} else if (
|
|
668
|
+
} else if (ts2.isExportAssignment(node)) {
|
|
413
669
|
return this.visitExpression(node.expression, context);
|
|
414
|
-
} else if (
|
|
670
|
+
} else if (ts2.isEnumDeclaration(node)) {
|
|
415
671
|
return this.visitEnumDeclaration(node, context);
|
|
416
|
-
} else if (
|
|
672
|
+
} else if (ts2.isSourceFile(node)) {
|
|
417
673
|
return this.visitSourceFile(node, context);
|
|
418
|
-
} else if (
|
|
674
|
+
} else if (ts2.isBindingElement(node)) {
|
|
419
675
|
return this.visitBindingElement(node, context);
|
|
420
676
|
} else {
|
|
421
677
|
return this.getReference(node, context);
|
|
@@ -583,7 +839,7 @@ var StaticInterpreter = class {
|
|
|
583
839
|
visitFunctionBody(node, fn, context) {
|
|
584
840
|
if (fn.body === null) {
|
|
585
841
|
return DynamicValue.fromUnknown(node);
|
|
586
|
-
} else if (fn.body.length !== 1 || !
|
|
842
|
+
} else if (fn.body.length !== 1 || !ts2.isReturnStatement(fn.body[0])) {
|
|
587
843
|
return DynamicValue.fromComplexFunctionCall(node, fn);
|
|
588
844
|
}
|
|
589
845
|
const ret = fn.body[0];
|
|
@@ -654,7 +910,7 @@ var StaticInterpreter = class {
|
|
|
654
910
|
evaluateFunctionArguments(node, context) {
|
|
655
911
|
const args = [];
|
|
656
912
|
for (const arg of node.arguments) {
|
|
657
|
-
if (
|
|
913
|
+
if (ts2.isSpreadElement(arg)) {
|
|
658
914
|
args.push(...this.visitSpreadElement(arg, context));
|
|
659
915
|
} else {
|
|
660
916
|
args.push(this.visitExpression(arg, context));
|
|
@@ -675,23 +931,23 @@ var StaticInterpreter = class {
|
|
|
675
931
|
visitBindingElement(node, context) {
|
|
676
932
|
const path2 = [];
|
|
677
933
|
let closestDeclaration = node;
|
|
678
|
-
while (
|
|
679
|
-
if (
|
|
934
|
+
while (ts2.isBindingElement(closestDeclaration) || ts2.isArrayBindingPattern(closestDeclaration) || ts2.isObjectBindingPattern(closestDeclaration)) {
|
|
935
|
+
if (ts2.isBindingElement(closestDeclaration)) {
|
|
680
936
|
path2.unshift(closestDeclaration);
|
|
681
937
|
}
|
|
682
938
|
closestDeclaration = closestDeclaration.parent;
|
|
683
939
|
}
|
|
684
|
-
if (!
|
|
940
|
+
if (!ts2.isVariableDeclaration(closestDeclaration) || closestDeclaration.initializer === void 0) {
|
|
685
941
|
return DynamicValue.fromUnknown(node);
|
|
686
942
|
}
|
|
687
943
|
let value = this.visit(closestDeclaration.initializer, context);
|
|
688
944
|
for (const element of path2) {
|
|
689
945
|
let key;
|
|
690
|
-
if (
|
|
946
|
+
if (ts2.isArrayBindingPattern(element.parent)) {
|
|
691
947
|
key = element.parent.elements.indexOf(element);
|
|
692
948
|
} else {
|
|
693
949
|
const name = element.propertyName || element.name;
|
|
694
|
-
if (
|
|
950
|
+
if (ts2.isIdentifier(name)) {
|
|
695
951
|
key = name.text;
|
|
696
952
|
} else {
|
|
697
953
|
return DynamicValue.fromUnknown(element);
|
|
@@ -705,9 +961,9 @@ var StaticInterpreter = class {
|
|
|
705
961
|
return value;
|
|
706
962
|
}
|
|
707
963
|
stringNameFromPropertyName(node, context) {
|
|
708
|
-
if (
|
|
964
|
+
if (ts2.isIdentifier(node) || ts2.isStringLiteral(node) || ts2.isNumericLiteral(node)) {
|
|
709
965
|
return node.text;
|
|
710
|
-
} else if (
|
|
966
|
+
} else if (ts2.isComputedPropertyName(node)) {
|
|
711
967
|
const literal3 = this.visitExpression(node.expression, context);
|
|
712
968
|
return typeof literal3 === "string" ? literal3 : void 0;
|
|
713
969
|
} else {
|
|
@@ -718,15 +974,15 @@ var StaticInterpreter = class {
|
|
|
718
974
|
return new Reference(node, owningModule(context));
|
|
719
975
|
}
|
|
720
976
|
visitType(node, context) {
|
|
721
|
-
if (
|
|
977
|
+
if (ts2.isLiteralTypeNode(node)) {
|
|
722
978
|
return this.visitExpression(node.literal, context);
|
|
723
|
-
} else if (
|
|
979
|
+
} else if (ts2.isTupleTypeNode(node)) {
|
|
724
980
|
return this.visitTupleType(node, context);
|
|
725
|
-
} else if (
|
|
981
|
+
} else if (ts2.isNamedTupleMember(node)) {
|
|
726
982
|
return this.visitType(node.type, context);
|
|
727
|
-
} else if (
|
|
983
|
+
} else if (ts2.isTypeOperatorNode(node) && node.operator === ts2.SyntaxKind.ReadonlyKeyword) {
|
|
728
984
|
return this.visitType(node.type, context);
|
|
729
|
-
} else if (
|
|
985
|
+
} else if (ts2.isTypeQueryNode(node)) {
|
|
730
986
|
return this.visitTypeQuery(node, context);
|
|
731
987
|
}
|
|
732
988
|
return DynamicValue.fromDynamicType(node);
|
|
@@ -739,7 +995,7 @@ var StaticInterpreter = class {
|
|
|
739
995
|
return res;
|
|
740
996
|
}
|
|
741
997
|
visitTypeQuery(node, context) {
|
|
742
|
-
if (!
|
|
998
|
+
if (!ts2.isIdentifier(node.exprName)) {
|
|
743
999
|
return DynamicValue.fromUnknown(node);
|
|
744
1000
|
}
|
|
745
1001
|
const decl = this.host.getDeclarationOfIdentifier(node.exprName);
|
|
@@ -751,7 +1007,7 @@ var StaticInterpreter = class {
|
|
|
751
1007
|
}
|
|
752
1008
|
};
|
|
753
1009
|
function isFunctionOrMethodReference(ref) {
|
|
754
|
-
return
|
|
1010
|
+
return ts2.isFunctionDeclaration(ref.node) || ts2.isMethodDeclaration(ref.node) || ts2.isFunctionExpression(ref.node);
|
|
755
1011
|
}
|
|
756
1012
|
function literal(value, reject) {
|
|
757
1013
|
if (value instanceof EnumValue) {
|
|
@@ -763,16 +1019,16 @@ function literal(value, reject) {
|
|
|
763
1019
|
return reject(value);
|
|
764
1020
|
}
|
|
765
1021
|
function isVariableDeclarationDeclared(node) {
|
|
766
|
-
if (node.parent === void 0 || !
|
|
1022
|
+
if (node.parent === void 0 || !ts2.isVariableDeclarationList(node.parent)) {
|
|
767
1023
|
return false;
|
|
768
1024
|
}
|
|
769
1025
|
const declList = node.parent;
|
|
770
|
-
if (declList.parent === void 0 || !
|
|
1026
|
+
if (declList.parent === void 0 || !ts2.isVariableStatement(declList.parent)) {
|
|
771
1027
|
return false;
|
|
772
1028
|
}
|
|
773
1029
|
const varStmt = declList.parent;
|
|
774
|
-
const modifiers =
|
|
775
|
-
return modifiers !== void 0 && modifiers.some((mod) => mod.kind ===
|
|
1030
|
+
const modifiers = ts2.getModifiers(varStmt);
|
|
1031
|
+
return modifiers !== void 0 && modifiers.some((mod) => mod.kind === ts2.SyntaxKind.DeclareKeyword);
|
|
776
1032
|
}
|
|
777
1033
|
var EMPTY = {};
|
|
778
1034
|
function joinModuleContext(existing, node, decl) {
|
|
@@ -821,7 +1077,7 @@ var PartialEvaluator = class {
|
|
|
821
1077
|
};
|
|
822
1078
|
|
|
823
1079
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/diagnostics.mjs
|
|
824
|
-
import
|
|
1080
|
+
import ts3 from "typescript";
|
|
825
1081
|
function describeResolvedType(value, maxDepth = 1) {
|
|
826
1082
|
var _a, _b;
|
|
827
1083
|
if (value === null) {
|
|
@@ -844,366 +1100,110 @@ function describeResolvedType(value, maxDepth = 1) {
|
|
|
844
1100
|
return (_a = value.enumRef.debugName) != null ? _a : "(anonymous)";
|
|
845
1101
|
} else if (value instanceof Reference) {
|
|
846
1102
|
return (_b = value.debugName) != null ? _b : "(anonymous)";
|
|
847
|
-
} else if (Array.isArray(value)) {
|
|
848
|
-
if (maxDepth === 0) {
|
|
849
|
-
return "Array";
|
|
850
|
-
}
|
|
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;
|
|
1103
|
+
} else if (Array.isArray(value)) {
|
|
1104
|
+
if (maxDepth === 0) {
|
|
1105
|
+
return "Array";
|
|
1009
1106
|
}
|
|
1010
|
-
return
|
|
1011
|
-
})
|
|
1107
|
+
return `[${value.map((v) => describeResolvedType(v, maxDepth - 1)).join(", ")}]`;
|
|
1108
|
+
} else if (value instanceof DynamicValue) {
|
|
1109
|
+
return "(not statically analyzable)";
|
|
1110
|
+
} else if (value instanceof KnownFn) {
|
|
1111
|
+
return "Function";
|
|
1112
|
+
} else {
|
|
1113
|
+
return "unknown";
|
|
1114
|
+
}
|
|
1012
1115
|
}
|
|
1013
|
-
function
|
|
1014
|
-
|
|
1015
|
-
|
|
1116
|
+
function quoteKey(key) {
|
|
1117
|
+
if (/^[a-z0-9_]+$/i.test(key)) {
|
|
1118
|
+
return key;
|
|
1119
|
+
} else {
|
|
1120
|
+
return `'${key.replace(/'/g, "\\'")}'`;
|
|
1016
1121
|
}
|
|
1017
|
-
return node;
|
|
1018
1122
|
}
|
|
1019
|
-
function
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1123
|
+
function traceDynamicValue(node, value) {
|
|
1124
|
+
return value.accept(new TraceDynamicValueVisitor(node));
|
|
1125
|
+
}
|
|
1126
|
+
var TraceDynamicValueVisitor = class {
|
|
1127
|
+
constructor(node) {
|
|
1128
|
+
this.node = node;
|
|
1129
|
+
this.currentContainerNode = null;
|
|
1023
1130
|
}
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
if (
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
const stmt = body.statements[0];
|
|
1030
|
-
if (!ts3.isReturnStatement(stmt) || stmt.expression === void 0) {
|
|
1031
|
-
return null;
|
|
1131
|
+
visitDynamicInput(value) {
|
|
1132
|
+
const trace = value.reason.accept(this);
|
|
1133
|
+
if (this.shouldTrace(value.node)) {
|
|
1134
|
+
const info = makeRelatedInformation(value.node, "Unable to evaluate this expression statically.");
|
|
1135
|
+
trace.unshift(info);
|
|
1032
1136
|
}
|
|
1033
|
-
return
|
|
1034
|
-
} else {
|
|
1035
|
-
return body;
|
|
1137
|
+
return trace;
|
|
1036
1138
|
}
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
node = unwrapExpression(node);
|
|
1040
|
-
if (!ts3.isCallExpression(node) || node.arguments.length !== 1) {
|
|
1041
|
-
return null;
|
|
1139
|
+
visitSyntheticInput(value) {
|
|
1140
|
+
return [makeRelatedInformation(value.node, "Unable to evaluate this expression further.")];
|
|
1042
1141
|
}
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
return null;
|
|
1142
|
+
visitDynamicString(value) {
|
|
1143
|
+
return [makeRelatedInformation(value.node, "A string value could not be determined statically.")];
|
|
1046
1144
|
}
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1145
|
+
visitExternalReference(value) {
|
|
1146
|
+
const name = value.reason.debugName;
|
|
1147
|
+
const description = name !== null ? `'${name}'` : "an anonymous declaration";
|
|
1148
|
+
return [makeRelatedInformation(value.node, `A value for ${description} cannot be determined statically, as it is an external declaration.`)];
|
|
1050
1149
|
}
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1150
|
+
visitComplexFunctionCall(value) {
|
|
1151
|
+
return [
|
|
1152
|
+
makeRelatedInformation(value.node, "Unable to evaluate function call of complex function. A function must have exactly one return statement."),
|
|
1153
|
+
makeRelatedInformation(value.reason.node, "Function is declared here.")
|
|
1154
|
+
];
|
|
1054
1155
|
}
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
var forwardRefResolver = (fn, callExpr, resolve, unresolvable) => {
|
|
1058
|
-
if (!isAngularCoreReference(fn, "forwardRef") || callExpr.arguments.length !== 1) {
|
|
1059
|
-
return unresolvable;
|
|
1156
|
+
visitInvalidExpressionType(value) {
|
|
1157
|
+
return [makeRelatedInformation(value.node, "Unable to evaluate an invalid expression.")];
|
|
1060
1158
|
}
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
return resolve(expanded);
|
|
1064
|
-
} else {
|
|
1065
|
-
return unresolvable;
|
|
1159
|
+
visitUnknown(value) {
|
|
1160
|
+
return [makeRelatedInformation(value.node, "Unable to evaluate statically.")];
|
|
1066
1161
|
}
|
|
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;
|
|
1162
|
+
visitUnknownIdentifier(value) {
|
|
1163
|
+
return [makeRelatedInformation(value.node, "Unknown reference.")];
|
|
1085
1164
|
}
|
|
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
|
-
}
|
|
1165
|
+
visitDynamicType(value) {
|
|
1166
|
+
return [makeRelatedInformation(value.node, "Dynamic type.")];
|
|
1099
1167
|
}
|
|
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;
|
|
1168
|
+
visitUnsupportedSyntax(value) {
|
|
1169
|
+
return [makeRelatedInformation(value.node, "This syntax is not supported.")];
|
|
1120
1170
|
}
|
|
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
|
-
}
|
|
1171
|
+
shouldTrace(node) {
|
|
1172
|
+
if (node === this.node) {
|
|
1173
|
+
return false;
|
|
1132
1174
|
}
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
providers.add(tokenClass);
|
|
1137
|
-
}
|
|
1175
|
+
const container = getContainerNode(node);
|
|
1176
|
+
if (container === this.currentContainerNode) {
|
|
1177
|
+
return false;
|
|
1138
1178
|
}
|
|
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);
|
|
1179
|
+
this.currentContainerNode = container;
|
|
1180
|
+
return true;
|
|
1162
1181
|
}
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1182
|
+
};
|
|
1183
|
+
function getContainerNode(node) {
|
|
1184
|
+
let currentNode = node;
|
|
1185
|
+
while (currentNode !== void 0) {
|
|
1186
|
+
switch (currentNode.kind) {
|
|
1187
|
+
case ts3.SyntaxKind.ExpressionStatement:
|
|
1188
|
+
case ts3.SyntaxKind.VariableStatement:
|
|
1189
|
+
case ts3.SyntaxKind.ReturnStatement:
|
|
1190
|
+
case ts3.SyntaxKind.IfStatement:
|
|
1191
|
+
case ts3.SyntaxKind.SwitchStatement:
|
|
1192
|
+
case ts3.SyntaxKind.DoStatement:
|
|
1193
|
+
case ts3.SyntaxKind.WhileStatement:
|
|
1194
|
+
case ts3.SyntaxKind.ForStatement:
|
|
1195
|
+
case ts3.SyntaxKind.ForInStatement:
|
|
1196
|
+
case ts3.SyntaxKind.ForOfStatement:
|
|
1197
|
+
case ts3.SyntaxKind.ContinueStatement:
|
|
1198
|
+
case ts3.SyntaxKind.BreakStatement:
|
|
1199
|
+
case ts3.SyntaxKind.ThrowStatement:
|
|
1200
|
+
case ts3.SyntaxKind.ObjectBindingPattern:
|
|
1201
|
+
case ts3.SyntaxKind.ArrayBindingPattern:
|
|
1202
|
+
return currentNode;
|
|
1171
1203
|
}
|
|
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;
|
|
1204
|
+
currentNode = currentNode.parent;
|
|
1203
1205
|
}
|
|
1204
|
-
|
|
1205
|
-
function isAbstractClassDeclaration(clazz) {
|
|
1206
|
-
return ts3.canHaveModifiers(clazz) && clazz.modifiers !== void 0 ? clazz.modifiers.some((mod) => mod.kind === ts3.SyntaxKind.AbstractKeyword) : false;
|
|
1206
|
+
return node.getSourceFile();
|
|
1207
1207
|
}
|
|
1208
1208
|
|
|
1209
1209
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/di.mjs
|
|
@@ -4436,57 +4436,58 @@ import ts23 from "typescript";
|
|
|
4436
4436
|
|
|
4437
4437
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/initializer_functions.mjs
|
|
4438
4438
|
import ts20 from "typescript";
|
|
4439
|
-
function tryParseInitializerApiMember(fnNames, member, reflector,
|
|
4439
|
+
function tryParseInitializerApiMember(fnNames, member, reflector, importTracker) {
|
|
4440
4440
|
if (member.value === null || !ts20.isCallExpression(member.value)) {
|
|
4441
4441
|
return null;
|
|
4442
4442
|
}
|
|
4443
4443
|
const call = member.value;
|
|
4444
|
-
|
|
4445
|
-
if (
|
|
4446
|
-
return null;
|
|
4447
|
-
}
|
|
4448
|
-
let apiName = fnNames.find((n) => n === target.text);
|
|
4449
|
-
if (apiName !== void 0) {
|
|
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)) {
|
|
4444
|
+
const staticResult = parseTopLevelCall(call, fnNames, importTracker) || parseTopLevelRequiredCall(call, fnNames, importTracker) || parseTopLevelCallFromNamespace(call, fnNames, importTracker);
|
|
4445
|
+
if (staticResult === null) {
|
|
4456
4446
|
return null;
|
|
4457
4447
|
}
|
|
4458
|
-
const
|
|
4459
|
-
|
|
4460
|
-
if (target === null) {
|
|
4461
|
-
return null;
|
|
4462
|
-
}
|
|
4463
|
-
apiName = fnNames.find((n) => n === target.text);
|
|
4464
|
-
if (apiName === void 0 || !isReferenceToInitializerApiFunction(apiName, target, isCore, reflector)) {
|
|
4448
|
+
const resolvedImport = reflector.getImportOfIdentifier(staticResult.node);
|
|
4449
|
+
if (resolvedImport === null || !fnNames.includes(resolvedImport.name)) {
|
|
4465
4450
|
return null;
|
|
4466
4451
|
}
|
|
4467
4452
|
return {
|
|
4468
|
-
apiName,
|
|
4469
4453
|
call,
|
|
4470
|
-
isRequired:
|
|
4454
|
+
isRequired: staticResult.isRequired,
|
|
4455
|
+
apiName: resolvedImport.name
|
|
4471
4456
|
};
|
|
4472
4457
|
}
|
|
4473
|
-
function
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
return node;
|
|
4458
|
+
function parseTopLevelCall(call, fnNames, importTracker) {
|
|
4459
|
+
const node = call.expression;
|
|
4460
|
+
if (!ts20.isIdentifier(node)) {
|
|
4461
|
+
return null;
|
|
4478
4462
|
}
|
|
4479
|
-
return null;
|
|
4463
|
+
return fnNames.some((name) => importTracker.isPotentialReferenceToNamedImport(node, name, CORE_MODULE)) ? { node, isRequired: false } : null;
|
|
4480
4464
|
}
|
|
4481
|
-
function
|
|
4482
|
-
|
|
4483
|
-
if (
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4465
|
+
function parseTopLevelRequiredCall(call, fnNames, importTracker) {
|
|
4466
|
+
const node = call.expression;
|
|
4467
|
+
if (!ts20.isPropertyAccessExpression(node) || !ts20.isIdentifier(node.expression) || node.name.text !== "required") {
|
|
4468
|
+
return null;
|
|
4469
|
+
}
|
|
4470
|
+
const expression = node.expression;
|
|
4471
|
+
const matchesCoreApi = fnNames.some((name) => importTracker.isPotentialReferenceToNamedImport(expression, name, CORE_MODULE));
|
|
4472
|
+
return matchesCoreApi ? { node: expression, isRequired: true } : null;
|
|
4473
|
+
}
|
|
4474
|
+
function parseTopLevelCallFromNamespace(call, fnNames, importTracker) {
|
|
4475
|
+
const node = call.expression;
|
|
4476
|
+
if (!ts20.isPropertyAccessExpression(node)) {
|
|
4477
|
+
return null;
|
|
4478
|
+
}
|
|
4479
|
+
let apiReference = null;
|
|
4480
|
+
let isRequired = false;
|
|
4481
|
+
if (ts20.isIdentifier(node.expression) && ts20.isIdentifier(node.name) && importTracker.isPotentialReferenceToNamespaceImport(node.expression, CORE_MODULE)) {
|
|
4482
|
+
apiReference = node.name;
|
|
4483
|
+
} else if (ts20.isPropertyAccessExpression(node.expression) && ts20.isIdentifier(node.expression.expression) && ts20.isIdentifier(node.expression.name) && importTracker.isPotentialReferenceToNamespaceImport(node.expression.expression, CORE_MODULE) && node.name.text === "required") {
|
|
4484
|
+
apiReference = node.expression.name;
|
|
4485
|
+
isRequired = true;
|
|
4488
4486
|
}
|
|
4489
|
-
|
|
4487
|
+
if (apiReference === null || !fnNames.includes(apiReference.text)) {
|
|
4488
|
+
return null;
|
|
4489
|
+
}
|
|
4490
|
+
return { node: apiReference, isRequired };
|
|
4490
4491
|
}
|
|
4491
4492
|
|
|
4492
4493
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/input_output_parse_options.mjs
|
|
@@ -4508,9 +4509,9 @@ function parseAndValidateInputAndOutputOptions(optionsNode) {
|
|
|
4508
4509
|
}
|
|
4509
4510
|
|
|
4510
4511
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/input_function.mjs
|
|
4511
|
-
function tryParseSignalInputMapping(member, reflector,
|
|
4512
|
+
function tryParseSignalInputMapping(member, reflector, importTracker) {
|
|
4512
4513
|
var _a;
|
|
4513
|
-
const signalInput = tryParseInitializerApiMember(["input"], member, reflector,
|
|
4514
|
+
const signalInput = tryParseInitializerApiMember(["input"], member, reflector, importTracker);
|
|
4514
4515
|
if (signalInput === null) {
|
|
4515
4516
|
return null;
|
|
4516
4517
|
}
|
|
@@ -4527,9 +4528,9 @@ function tryParseSignalInputMapping(member, reflector, isCore) {
|
|
|
4527
4528
|
}
|
|
4528
4529
|
|
|
4529
4530
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/model_function.mjs
|
|
4530
|
-
function tryParseSignalModelMapping(member, reflector,
|
|
4531
|
+
function tryParseSignalModelMapping(member, reflector, importTracker) {
|
|
4531
4532
|
var _a;
|
|
4532
|
-
const model = tryParseInitializerApiMember(["model"], member, reflector,
|
|
4533
|
+
const model = tryParseInitializerApiMember(["model"], member, reflector, importTracker);
|
|
4533
4534
|
if (model === null) {
|
|
4534
4535
|
return null;
|
|
4535
4536
|
}
|
|
@@ -4555,9 +4556,9 @@ function tryParseSignalModelMapping(member, reflector, isCore) {
|
|
|
4555
4556
|
}
|
|
4556
4557
|
|
|
4557
4558
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/output_function.mjs
|
|
4558
|
-
function tryParseInitializerBasedOutput(member, reflector,
|
|
4559
|
+
function tryParseInitializerBasedOutput(member, reflector, importTracker) {
|
|
4559
4560
|
var _a;
|
|
4560
|
-
const output = tryParseInitializerApiMember(["output", "\u0275output"], member, reflector,
|
|
4561
|
+
const output = tryParseInitializerApiMember(["output", "\u0275output"], member, reflector, importTracker);
|
|
4561
4562
|
if (output === null) {
|
|
4562
4563
|
return null;
|
|
4563
4564
|
}
|
|
@@ -4582,8 +4583,8 @@ import { createMayBeForwardRefExpression, outputAst as o } from "@angular/compil
|
|
|
4582
4583
|
import ts22 from "typescript";
|
|
4583
4584
|
var queryFunctionNames = ["viewChild", "viewChildren", "contentChild", "contentChildren"];
|
|
4584
4585
|
var defaultDescendantsValue = (type) => type !== "contentChildren";
|
|
4585
|
-
function tryParseSignalQueryFromInitializer(member, reflector,
|
|
4586
|
-
const query = tryParseInitializerApiMember(queryFunctionNames, member, reflector,
|
|
4586
|
+
function tryParseSignalQueryFromInitializer(member, reflector, importTracker) {
|
|
4587
|
+
const query = tryParseInitializerApiMember(queryFunctionNames, member, reflector, importTracker);
|
|
4587
4588
|
if (query === null) {
|
|
4588
4589
|
return null;
|
|
4589
4590
|
}
|
|
@@ -4643,7 +4644,7 @@ function parseDescendantsOption(value) {
|
|
|
4643
4644
|
var EMPTY_OBJECT = {};
|
|
4644
4645
|
var queryDecoratorNames = ["ViewChild", "ViewChildren", "ContentChild", "ContentChildren"];
|
|
4645
4646
|
var QUERY_TYPES = new Set(queryDecoratorNames);
|
|
4646
|
-
function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, refEmitter, referencesRegistry, isCore, annotateForClosureCompiler, compilationMode, defaultSelector, useTemplatePipeline) {
|
|
4647
|
+
function extractDirectiveMetadata(clazz, decorator, reflector, importTracker, evaluator, refEmitter, referencesRegistry, isCore, annotateForClosureCompiler, compilationMode, defaultSelector, useTemplatePipeline) {
|
|
4647
4648
|
let directive;
|
|
4648
4649
|
if (decorator.args === null || decorator.args.length === 0) {
|
|
4649
4650
|
directive = /* @__PURE__ */ new Map();
|
|
@@ -4663,12 +4664,12 @@ function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, refEmi
|
|
|
4663
4664
|
const decoratedElements = members.filter((member) => !member.isStatic && member.decorators !== null);
|
|
4664
4665
|
const coreModule = isCore ? void 0 : "@angular/core";
|
|
4665
4666
|
const inputsFromMeta = parseInputsArray(clazz, directive, evaluator, reflector, refEmitter, compilationMode);
|
|
4666
|
-
const inputsFromFields = parseInputFields(clazz, members, evaluator, reflector, refEmitter, isCore, compilationMode, inputsFromMeta, decorator);
|
|
4667
|
+
const inputsFromFields = parseInputFields(clazz, members, evaluator, reflector, importTracker, refEmitter, isCore, compilationMode, inputsFromMeta, decorator);
|
|
4667
4668
|
const inputs = ClassPropertyMapping.fromMappedObject({ ...inputsFromMeta, ...inputsFromFields });
|
|
4668
4669
|
const outputsFromMeta = parseOutputsArray(directive, evaluator);
|
|
4669
|
-
const outputsFromFields = parseOutputFields(clazz, decorator, members, isCore, reflector, evaluator, outputsFromMeta);
|
|
4670
|
+
const outputsFromFields = parseOutputFields(clazz, decorator, members, isCore, reflector, importTracker, evaluator, outputsFromMeta);
|
|
4670
4671
|
const outputs = ClassPropertyMapping.fromMappedObject({ ...outputsFromMeta, ...outputsFromFields });
|
|
4671
|
-
const { viewQueries, contentQueries } = parseQueriesOfClassFields(members, reflector, evaluator, isCore);
|
|
4672
|
+
const { viewQueries, contentQueries } = parseQueriesOfClassFields(members, reflector, importTracker, evaluator, isCore);
|
|
4672
4673
|
if (directive.has("queries")) {
|
|
4673
4674
|
const signalQueryFields = new Set([...viewQueries, ...contentQueries].filter((q) => q.isSignal).map((q) => q.propertyName));
|
|
4674
4675
|
const queriesFromDecorator = extractQueriesFromDecorator(directive.get("queries"), reflector, evaluator, isCore);
|
|
@@ -5077,11 +5078,11 @@ function tryGetDecoratorOnMember(member, decoratorName, isCore) {
|
|
|
5077
5078
|
}
|
|
5078
5079
|
return null;
|
|
5079
5080
|
}
|
|
5080
|
-
function tryParseInputFieldMapping(clazz, member, evaluator, reflector, isCore, refEmitter, compilationMode) {
|
|
5081
|
+
function tryParseInputFieldMapping(clazz, member, evaluator, reflector, importTracker, isCore, refEmitter, compilationMode) {
|
|
5081
5082
|
const classPropertyName = member.name;
|
|
5082
5083
|
const decorator = tryGetDecoratorOnMember(member, "Input", isCore);
|
|
5083
|
-
const signalInputMapping = tryParseSignalInputMapping(member, reflector,
|
|
5084
|
-
const modelInputMapping = tryParseSignalModelMapping(member, reflector,
|
|
5084
|
+
const signalInputMapping = tryParseSignalInputMapping(member, reflector, importTracker);
|
|
5085
|
+
const modelInputMapping = tryParseSignalModelMapping(member, reflector, importTracker);
|
|
5085
5086
|
if (decorator !== null && signalInputMapping !== null) {
|
|
5086
5087
|
throw new FatalDiagnosticError(ErrorCode.INITIALIZER_API_WITH_DISALLOWED_DECORATOR, decorator.node, `Using @Input with a signal input is not allowed.`);
|
|
5087
5088
|
}
|
|
@@ -5129,12 +5130,12 @@ function tryParseInputFieldMapping(clazz, member, evaluator, reflector, isCore,
|
|
|
5129
5130
|
}
|
|
5130
5131
|
return null;
|
|
5131
5132
|
}
|
|
5132
|
-
function parseInputFields(clazz, members, evaluator, reflector, refEmitter, isCore, compilationMode, inputsFromClassDecorator, classDecorator) {
|
|
5133
|
+
function parseInputFields(clazz, members, evaluator, reflector, importTracker, refEmitter, isCore, compilationMode, inputsFromClassDecorator, classDecorator) {
|
|
5133
5134
|
var _a, _b;
|
|
5134
5135
|
const inputs = {};
|
|
5135
5136
|
for (const member of members) {
|
|
5136
5137
|
const classPropertyName = member.name;
|
|
5137
|
-
const inputMapping = tryParseInputFieldMapping(clazz, member, evaluator, reflector, isCore, refEmitter, compilationMode);
|
|
5138
|
+
const inputMapping = tryParseInputFieldMapping(clazz, member, evaluator, reflector, importTracker, isCore, refEmitter, compilationMode);
|
|
5138
5139
|
if (inputMapping === null) {
|
|
5139
5140
|
continue;
|
|
5140
5141
|
}
|
|
@@ -5214,7 +5215,7 @@ function assertEmittableInputType(type, contextFile, reflector, refEmitter) {
|
|
|
5214
5215
|
node.forEachChild(walk);
|
|
5215
5216
|
})(type);
|
|
5216
5217
|
}
|
|
5217
|
-
function parseQueriesOfClassFields(members, reflector, evaluator, isCore) {
|
|
5218
|
+
function parseQueriesOfClassFields(members, reflector, importTracker, evaluator, isCore) {
|
|
5218
5219
|
var _a;
|
|
5219
5220
|
const viewQueries = [];
|
|
5220
5221
|
const contentQueries = [];
|
|
@@ -5224,7 +5225,7 @@ function parseQueriesOfClassFields(members, reflector, evaluator, isCore) {
|
|
|
5224
5225
|
const decoratorContentChildren = [];
|
|
5225
5226
|
for (const member of members) {
|
|
5226
5227
|
const decoratorQuery = tryGetQueryFromFieldDecorator(member, reflector, evaluator, isCore);
|
|
5227
|
-
const signalQuery = tryParseSignalQueryFromInitializer(member, reflector,
|
|
5228
|
+
const signalQuery = tryParseSignalQueryFromInitializer(member, reflector, importTracker);
|
|
5228
5229
|
if (decoratorQuery !== null && signalQuery !== null) {
|
|
5229
5230
|
throw new FatalDiagnosticError(ErrorCode.INITIALIZER_API_WITH_DISALLOWED_DECORATOR, decoratorQuery.decorator.node, `Using @${decoratorQuery.name} with a signal-based query is not allowed.`);
|
|
5230
5231
|
}
|
|
@@ -5269,13 +5270,13 @@ function parseOutputsArray(directive, evaluator) {
|
|
|
5269
5270
|
const metaValues = parseFieldStringArrayValue(directive, "outputs", evaluator);
|
|
5270
5271
|
return metaValues ? parseMappingStringArray(metaValues) : EMPTY_OBJECT;
|
|
5271
5272
|
}
|
|
5272
|
-
function parseOutputFields(clazz, classDecorator, members, isCore, reflector, evaluator, outputsFromMeta) {
|
|
5273
|
+
function parseOutputFields(clazz, classDecorator, members, isCore, reflector, importTracker, evaluator, outputsFromMeta) {
|
|
5273
5274
|
var _a, _b, _c;
|
|
5274
5275
|
const outputs = {};
|
|
5275
5276
|
for (const member of members) {
|
|
5276
5277
|
const decoratorOutput = tryParseDecoratorOutput(member, evaluator, isCore);
|
|
5277
|
-
const initializerOutput = tryParseInitializerBasedOutput(member, reflector,
|
|
5278
|
-
const modelMapping = tryParseSignalModelMapping(member, reflector,
|
|
5278
|
+
const initializerOutput = tryParseInitializerBasedOutput(member, reflector, importTracker);
|
|
5279
|
+
const modelMapping = tryParseSignalModelMapping(member, reflector, importTracker);
|
|
5279
5280
|
if (decoratorOutput !== null && initializerOutput !== null) {
|
|
5280
5281
|
throw new FatalDiagnosticError(ErrorCode.INITIALIZER_API_WITH_DISALLOWED_DECORATOR, decoratorOutput.decorator.node, `Using "@Output" with "output()" is not allowed.`);
|
|
5281
5282
|
}
|
|
@@ -5537,7 +5538,7 @@ var LIFECYCLE_HOOKS = /* @__PURE__ */ new Set([
|
|
|
5537
5538
|
"ngAfterContentChecked"
|
|
5538
5539
|
]);
|
|
5539
5540
|
var DirectiveDecoratorHandler = class {
|
|
5540
|
-
constructor(reflector, evaluator, metaRegistry, scopeRegistry, metaReader, injectableRegistry, refEmitter, referencesRegistry, isCore, strictCtorDeps, semanticDepGraphUpdater, annotateForClosureCompiler, perf, includeClassMetadata, compilationMode, useTemplatePipeline, generateExtraImportsInLocalMode) {
|
|
5541
|
+
constructor(reflector, evaluator, metaRegistry, scopeRegistry, metaReader, injectableRegistry, refEmitter, referencesRegistry, isCore, strictCtorDeps, semanticDepGraphUpdater, annotateForClosureCompiler, perf, importTracker, includeClassMetadata, compilationMode, useTemplatePipeline, generateExtraImportsInLocalMode) {
|
|
5541
5542
|
this.reflector = reflector;
|
|
5542
5543
|
this.evaluator = evaluator;
|
|
5543
5544
|
this.metaRegistry = metaRegistry;
|
|
@@ -5551,6 +5552,7 @@ var DirectiveDecoratorHandler = class {
|
|
|
5551
5552
|
this.semanticDepGraphUpdater = semanticDepGraphUpdater;
|
|
5552
5553
|
this.annotateForClosureCompiler = annotateForClosureCompiler;
|
|
5553
5554
|
this.perf = perf;
|
|
5555
|
+
this.importTracker = importTracker;
|
|
5554
5556
|
this.includeClassMetadata = includeClassMetadata;
|
|
5555
5557
|
this.compilationMode = compilationMode;
|
|
5556
5558
|
this.useTemplatePipeline = useTemplatePipeline;
|
|
@@ -5580,6 +5582,7 @@ var DirectiveDecoratorHandler = class {
|
|
|
5580
5582
|
node,
|
|
5581
5583
|
decorator,
|
|
5582
5584
|
this.reflector,
|
|
5585
|
+
this.importTracker,
|
|
5583
5586
|
this.evaluator,
|
|
5584
5587
|
this.refEmitter,
|
|
5585
5588
|
this.referencesRegistry,
|
|
@@ -6881,7 +6884,7 @@ var EMPTY_ARRAY2 = [];
|
|
|
6881
6884
|
var isUsedDirective = (decl) => decl.kind === R3TemplateDependencyKind.Directive;
|
|
6882
6885
|
var isUsedPipe = (decl) => decl.kind === R3TemplateDependencyKind.Pipe;
|
|
6883
6886
|
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) {
|
|
6887
|
+
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
6888
|
this.reflector = reflector;
|
|
6886
6889
|
this.evaluator = evaluator;
|
|
6887
6890
|
this.metaRegistry = metaRegistry;
|
|
@@ -6911,6 +6914,7 @@ var ComponentDecoratorHandler = class {
|
|
|
6911
6914
|
this.annotateForClosureCompiler = annotateForClosureCompiler;
|
|
6912
6915
|
this.perf = perf;
|
|
6913
6916
|
this.hostDirectivesResolver = hostDirectivesResolver;
|
|
6917
|
+
this.importTracker = importTracker;
|
|
6914
6918
|
this.includeClassMetadata = includeClassMetadata;
|
|
6915
6919
|
this.compilationMode = compilationMode;
|
|
6916
6920
|
this.deferredSymbolTracker = deferredSymbolTracker;
|
|
@@ -6994,7 +6998,7 @@ var ComponentDecoratorHandler = class {
|
|
|
6994
6998
|
this.literalCache.delete(decorator);
|
|
6995
6999
|
let diagnostics;
|
|
6996
7000
|
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);
|
|
7001
|
+
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
7002
|
if (directiveResult === void 0) {
|
|
6999
7003
|
return {};
|
|
7000
7004
|
}
|
|
@@ -8262,9 +8266,6 @@ var PipeDecoratorHandler = class {
|
|
|
8262
8266
|
};
|
|
8263
8267
|
|
|
8264
8268
|
export {
|
|
8265
|
-
DynamicValue,
|
|
8266
|
-
StaticInterpreter,
|
|
8267
|
-
PartialEvaluator,
|
|
8268
8269
|
isAngularDecorator,
|
|
8269
8270
|
getAngularDecorators,
|
|
8270
8271
|
forwardRefResolver,
|
|
@@ -8277,6 +8278,9 @@ export {
|
|
|
8277
8278
|
ResourceRegistry,
|
|
8278
8279
|
ExportedProviderStatusResolver,
|
|
8279
8280
|
HostDirectivesResolver,
|
|
8281
|
+
DynamicValue,
|
|
8282
|
+
StaticInterpreter,
|
|
8283
|
+
PartialEvaluator,
|
|
8280
8284
|
CompilationMode,
|
|
8281
8285
|
aliasTransformFactory,
|
|
8282
8286
|
TraitCompiler,
|
|
@@ -8317,4 +8321,4 @@ export {
|
|
|
8317
8321
|
* Use of this source code is governed by an MIT-style license that can be
|
|
8318
8322
|
* found in the LICENSE file at https://angular.io/license
|
|
8319
8323
|
*/
|
|
8320
|
-
//# sourceMappingURL=chunk-
|
|
8324
|
+
//# sourceMappingURL=chunk-YVYW546M.js.map
|