@angular/compiler-cli 16.0.0-next.6 → 16.0.0-next.7
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-2YPKXLLJ.js → chunk-5B7NBQNN.js} +2 -2
- package/bundles/{chunk-IWRMD5BL.js → chunk-BC53B7EF.js} +2 -2
- package/bundles/{chunk-2AZVA7MW.js → chunk-EPXSTYJI.js} +4 -4
- package/bundles/{chunk-2AZVA7MW.js.map → chunk-EPXSTYJI.js.map} +1 -1
- package/bundles/{chunk-2IU4GAMV.js → chunk-OKYKHPES.js} +3 -10
- package/bundles/chunk-OKYKHPES.js.map +6 -0
- package/bundles/{chunk-KOHNFJR2.js → chunk-QELUO2L4.js} +41 -198
- package/bundles/chunk-QELUO2L4.js.map +6 -0
- package/bundles/{chunk-HROZN3TD.js → chunk-TCPBYER2.js} +3 -42
- package/bundles/chunk-TCPBYER2.js.map +6 -0
- package/bundles/index.js +5 -5
- package/bundles/linker/babel/index.js +1 -1
- package/bundles/linker/index.js +1 -1
- package/bundles/private/migrations.js +2 -2
- package/bundles/private/tooling.js +2 -2
- package/bundles/src/bin/ng_xi18n.js +4 -4
- package/bundles/src/bin/ngc.js +4 -4
- package/bundles_metadata.json +1 -1
- package/package.json +2 -2
- package/src/ngtsc/annotations/common/src/references_registry.d.ts +1 -3
- package/src/ngtsc/annotations/common/src/util.d.ts +2 -2
- package/src/ngtsc/annotations/directive/src/handler.d.ts +1 -2
- package/src/ngtsc/partial_evaluator/src/builtin.d.ts +0 -3
- package/src/ngtsc/partial_evaluator/src/interpreter.d.ts +0 -2
- package/src/ngtsc/reflection/src/host.d.ts +13 -178
- package/src/ngtsc/reflection/src/typescript.d.ts +0 -3
- package/src/ngtsc/transform/src/compilation.d.ts +5 -6
- package/bundles/chunk-2IU4GAMV.js.map +0 -6
- package/bundles/chunk-HROZN3TD.js.map +0 -6
- package/bundles/chunk-KOHNFJR2.js.map +0 -6
- package/src/ngtsc/partial_evaluator/src/known_declaration.d.ts +0 -18
- package/src/ngtsc/partial_evaluator/src/ts_helpers.d.ts +0 -21
- /package/bundles/{chunk-2YPKXLLJ.js.map → chunk-5B7NBQNN.js.map} +0 -0
- /package/bundles/{chunk-IWRMD5BL.js.map → chunk-BC53B7EF.js.map} +0 -0
|
@@ -4,15 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
ClassMemberKind,
|
|
7
|
-
Decorator,
|
|
8
|
-
KnownDeclaration,
|
|
9
7
|
filterToMembersWithDecorator,
|
|
10
|
-
isConcreteDeclaration,
|
|
11
8
|
isNamedClassDeclaration,
|
|
12
9
|
reflectObjectLiteral,
|
|
13
10
|
reflectTypeEntityToDeclaration,
|
|
14
11
|
typeNodeToValueExpr
|
|
15
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-TCPBYER2.js";
|
|
16
13
|
import {
|
|
17
14
|
ImportManager,
|
|
18
15
|
translateExpression,
|
|
@@ -68,10 +65,10 @@ function valueReferenceToExpression(valueRef) {
|
|
|
68
65
|
return importExpr;
|
|
69
66
|
}
|
|
70
67
|
}
|
|
71
|
-
function toR3Reference(origin,
|
|
72
|
-
const emittedValueRef = refEmitter.emit(
|
|
68
|
+
function toR3Reference(origin, ref, context, refEmitter) {
|
|
69
|
+
const emittedValueRef = refEmitter.emit(ref, context);
|
|
73
70
|
assertSuccessfulReferenceEmit(emittedValueRef, origin, "class");
|
|
74
|
-
const emittedTypeRef = refEmitter.emit(
|
|
71
|
+
const emittedTypeRef = refEmitter.emit(ref, context, ImportFlags.ForceNewImport | ImportFlags.AllowTypeImports);
|
|
75
72
|
assertSuccessfulReferenceEmit(emittedTypeRef, origin, "class");
|
|
76
73
|
return {
|
|
77
74
|
value: emittedValueRef.expression,
|
|
@@ -225,9 +222,8 @@ function resolveProvidersRequiringFactory(rawProviders, reflector, evaluator) {
|
|
|
225
222
|
return providers;
|
|
226
223
|
}
|
|
227
224
|
function wrapTypeReference(reflector, clazz) {
|
|
228
|
-
const dtsClass = reflector.getDtsDeclaration(clazz);
|
|
229
225
|
const value = new WrappedNodeExpr(clazz.name);
|
|
230
|
-
const type =
|
|
226
|
+
const type = value;
|
|
231
227
|
return { value, type };
|
|
232
228
|
}
|
|
233
229
|
function createSourceSpan(node) {
|
|
@@ -257,7 +253,6 @@ function toFactoryMetadata(meta, target) {
|
|
|
257
253
|
return {
|
|
258
254
|
name: meta.name,
|
|
259
255
|
type: meta.type,
|
|
260
|
-
internalType: meta.internalType,
|
|
261
256
|
typeArgumentCount: meta.typeArgumentCount,
|
|
262
257
|
deps: meta.deps,
|
|
263
258
|
target
|
|
@@ -459,102 +454,6 @@ var StringConcatBuiltinFn = class extends KnownFn {
|
|
|
459
454
|
return result;
|
|
460
455
|
}
|
|
461
456
|
};
|
|
462
|
-
var ObjectAssignBuiltinFn = class extends KnownFn {
|
|
463
|
-
evaluate(node, args) {
|
|
464
|
-
if (args.length === 0) {
|
|
465
|
-
return DynamicValue.fromUnsupportedSyntax(node);
|
|
466
|
-
}
|
|
467
|
-
for (const arg of args) {
|
|
468
|
-
if (arg instanceof DynamicValue) {
|
|
469
|
-
return DynamicValue.fromDynamicInput(node, arg);
|
|
470
|
-
} else if (!(arg instanceof Map)) {
|
|
471
|
-
return DynamicValue.fromUnsupportedSyntax(node);
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
const [target, ...sources] = args;
|
|
475
|
-
for (const source of sources) {
|
|
476
|
-
source.forEach((value, key) => target.set(key, value));
|
|
477
|
-
}
|
|
478
|
-
return target;
|
|
479
|
-
}
|
|
480
|
-
};
|
|
481
|
-
|
|
482
|
-
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/ts_helpers.mjs
|
|
483
|
-
var AssignHelperFn = class extends ObjectAssignBuiltinFn {
|
|
484
|
-
};
|
|
485
|
-
var SpreadHelperFn = class extends KnownFn {
|
|
486
|
-
evaluate(node, args) {
|
|
487
|
-
const result = [];
|
|
488
|
-
for (const arg of args) {
|
|
489
|
-
if (arg instanceof DynamicValue) {
|
|
490
|
-
result.push(DynamicValue.fromDynamicInput(node, arg));
|
|
491
|
-
} else if (Array.isArray(arg)) {
|
|
492
|
-
result.push(...arg);
|
|
493
|
-
} else {
|
|
494
|
-
result.push(arg);
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
return result;
|
|
498
|
-
}
|
|
499
|
-
};
|
|
500
|
-
var SpreadArrayHelperFn = class extends KnownFn {
|
|
501
|
-
evaluate(node, args) {
|
|
502
|
-
if (args.length !== 2 && args.length !== 3) {
|
|
503
|
-
return DynamicValue.fromUnknown(node);
|
|
504
|
-
}
|
|
505
|
-
const [to, from] = args;
|
|
506
|
-
if (to instanceof DynamicValue) {
|
|
507
|
-
return DynamicValue.fromDynamicInput(node, to);
|
|
508
|
-
} else if (from instanceof DynamicValue) {
|
|
509
|
-
return DynamicValue.fromDynamicInput(node, from);
|
|
510
|
-
}
|
|
511
|
-
if (!Array.isArray(to)) {
|
|
512
|
-
return DynamicValue.fromInvalidExpressionType(node, to);
|
|
513
|
-
} else if (!Array.isArray(from)) {
|
|
514
|
-
return DynamicValue.fromInvalidExpressionType(node, from);
|
|
515
|
-
}
|
|
516
|
-
return to.concat(from);
|
|
517
|
-
}
|
|
518
|
-
};
|
|
519
|
-
var ReadHelperFn = class extends KnownFn {
|
|
520
|
-
evaluate(node, args) {
|
|
521
|
-
if (args.length !== 1) {
|
|
522
|
-
return DynamicValue.fromUnknown(node);
|
|
523
|
-
}
|
|
524
|
-
const [value] = args;
|
|
525
|
-
if (value instanceof DynamicValue) {
|
|
526
|
-
return DynamicValue.fromDynamicInput(node, value);
|
|
527
|
-
}
|
|
528
|
-
if (!Array.isArray(value)) {
|
|
529
|
-
return DynamicValue.fromInvalidExpressionType(node, value);
|
|
530
|
-
}
|
|
531
|
-
return value;
|
|
532
|
-
}
|
|
533
|
-
};
|
|
534
|
-
|
|
535
|
-
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/known_declaration.mjs
|
|
536
|
-
var jsGlobalObjectValue = /* @__PURE__ */ new Map([["assign", new ObjectAssignBuiltinFn()]]);
|
|
537
|
-
var assignTsHelperFn = new AssignHelperFn();
|
|
538
|
-
var spreadTsHelperFn = new SpreadHelperFn();
|
|
539
|
-
var spreadArrayTsHelperFn = new SpreadArrayHelperFn();
|
|
540
|
-
var readTsHelperFn = new ReadHelperFn();
|
|
541
|
-
function resolveKnownDeclaration(decl) {
|
|
542
|
-
switch (decl) {
|
|
543
|
-
case KnownDeclaration.JsGlobalObject:
|
|
544
|
-
return jsGlobalObjectValue;
|
|
545
|
-
case KnownDeclaration.TsHelperAssign:
|
|
546
|
-
return assignTsHelperFn;
|
|
547
|
-
case KnownDeclaration.TsHelperSpread:
|
|
548
|
-
case KnownDeclaration.TsHelperSpreadArrays:
|
|
549
|
-
return spreadTsHelperFn;
|
|
550
|
-
case KnownDeclaration.TsHelperSpreadArray:
|
|
551
|
-
return spreadArrayTsHelperFn;
|
|
552
|
-
case KnownDeclaration.TsHelperRead:
|
|
553
|
-
return readTsHelperFn;
|
|
554
|
-
default:
|
|
555
|
-
throw new Error(`Cannot resolve known declaration. Received: ${KnownDeclaration[decl]}.`);
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
457
|
|
|
559
458
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/synthetic.mjs
|
|
560
459
|
var SyntheticValue = class {
|
|
@@ -729,13 +628,8 @@ var StaticInterpreter = class {
|
|
|
729
628
|
return DynamicValue.fromUnknownIdentifier(node);
|
|
730
629
|
}
|
|
731
630
|
}
|
|
732
|
-
if (decl.known !== null) {
|
|
733
|
-
return resolveKnownDeclaration(decl.known);
|
|
734
|
-
} else if (isConcreteDeclaration(decl) && decl.identity !== null && decl.identity.kind === 0) {
|
|
735
|
-
return this.getResolvedEnum(decl.node, decl.identity.enumMembers, context);
|
|
736
|
-
}
|
|
737
631
|
const declContext = { ...context, ...joinModuleContext(context, node, decl) };
|
|
738
|
-
const result = this.
|
|
632
|
+
const result = this.visitDeclaration(decl.node, declContext);
|
|
739
633
|
if (result instanceof Reference) {
|
|
740
634
|
if (!result.synthetic) {
|
|
741
635
|
result.addIdentifier(node);
|
|
@@ -823,19 +717,13 @@ var StaticInterpreter = class {
|
|
|
823
717
|
return DynamicValue.fromUnknown(node);
|
|
824
718
|
}
|
|
825
719
|
return new ResolvedModule(declarations, (decl) => {
|
|
826
|
-
if (decl.known !== null) {
|
|
827
|
-
return resolveKnownDeclaration(decl.known);
|
|
828
|
-
}
|
|
829
720
|
const declContext = {
|
|
830
721
|
...context,
|
|
831
722
|
...joinModuleContext(context, node, decl)
|
|
832
723
|
};
|
|
833
|
-
return this.
|
|
724
|
+
return this.visitDeclaration(decl.node, declContext);
|
|
834
725
|
});
|
|
835
726
|
}
|
|
836
|
-
visitAmbiguousDeclaration(decl, declContext) {
|
|
837
|
-
return decl.kind === 1 && decl.implementation !== void 0 && !isDeclaration(decl.implementation) ? this.visitExpression(decl.implementation, declContext) : this.visitDeclaration(decl.node, declContext);
|
|
838
|
-
}
|
|
839
727
|
accessHelper(node, lhs, rhs, context) {
|
|
840
728
|
const strIndex = `${rhs}`;
|
|
841
729
|
if (lhs instanceof Map) {
|
|
@@ -1066,18 +954,6 @@ var StaticInterpreter = class {
|
|
|
1066
954
|
return void 0;
|
|
1067
955
|
}
|
|
1068
956
|
}
|
|
1069
|
-
getResolvedEnum(node, enumMembers, context) {
|
|
1070
|
-
const enumRef = this.getReference(node, context);
|
|
1071
|
-
const map = /* @__PURE__ */ new Map();
|
|
1072
|
-
enumMembers.forEach((member) => {
|
|
1073
|
-
const name = this.stringNameFromPropertyName(member.name, context);
|
|
1074
|
-
if (name !== void 0) {
|
|
1075
|
-
const resolved = this.visit(member.initializer, context);
|
|
1076
|
-
map.set(name, new EnumValue(enumRef, name, resolved));
|
|
1077
|
-
}
|
|
1078
|
-
});
|
|
1079
|
-
return map;
|
|
1080
|
-
}
|
|
1081
957
|
getReference(node, context) {
|
|
1082
958
|
return new Reference(node, owningModule(context));
|
|
1083
959
|
}
|
|
@@ -1111,7 +987,7 @@ var StaticInterpreter = class {
|
|
|
1111
987
|
return DynamicValue.fromUnknownIdentifier(node.exprName);
|
|
1112
988
|
}
|
|
1113
989
|
const declContext = { ...context, ...joinModuleContext(context, node, decl) };
|
|
1114
|
-
return this.
|
|
990
|
+
return this.visitDeclaration(decl.node, declContext);
|
|
1115
991
|
}
|
|
1116
992
|
};
|
|
1117
993
|
function isFunctionOrMethodReference(ref) {
|
|
@@ -1336,7 +1212,7 @@ function getConstructorDependencies(clazz, reflector, isCore) {
|
|
|
1336
1212
|
const name = isCore || dec.import === null ? dec.name : dec.import.name;
|
|
1337
1213
|
if (name === "Inject") {
|
|
1338
1214
|
if (dec.args === null || dec.args.length !== 1) {
|
|
1339
|
-
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG,
|
|
1215
|
+
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, dec.node, `Unexpected number of arguments to @Inject().`);
|
|
1340
1216
|
}
|
|
1341
1217
|
token = new WrappedNodeExpr2(dec.args[0]);
|
|
1342
1218
|
} else if (name === "Optional") {
|
|
@@ -1349,7 +1225,7 @@ function getConstructorDependencies(clazz, reflector, isCore) {
|
|
|
1349
1225
|
host = true;
|
|
1350
1226
|
} else if (name === "Attribute") {
|
|
1351
1227
|
if (dec.args === null || dec.args.length !== 1) {
|
|
1352
|
-
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG,
|
|
1228
|
+
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, dec.node, `Unexpected number of arguments to @Attribute().`);
|
|
1353
1229
|
}
|
|
1354
1230
|
const attributeName = dec.args[0];
|
|
1355
1231
|
token = new WrappedNodeExpr2(attributeName);
|
|
@@ -1359,7 +1235,7 @@ function getConstructorDependencies(clazz, reflector, isCore) {
|
|
|
1359
1235
|
attributeNameType = new WrappedNodeExpr2(ts4.factory.createKeywordTypeNode(ts4.SyntaxKind.UnknownKeyword));
|
|
1360
1236
|
}
|
|
1361
1237
|
} else {
|
|
1362
|
-
throw new FatalDiagnosticError(ErrorCode.DECORATOR_UNEXPECTED,
|
|
1238
|
+
throw new FatalDiagnosticError(ErrorCode.DECORATOR_UNEXPECTED, dec.node, `Unexpected decorator ${name} on parameter.`);
|
|
1363
1239
|
}
|
|
1364
1240
|
});
|
|
1365
1241
|
if (token === null) {
|
|
@@ -2365,7 +2241,7 @@ function resolveLiteral(decorator, literalCache) {
|
|
|
2365
2241
|
return literalCache.get(decorator);
|
|
2366
2242
|
}
|
|
2367
2243
|
if (decorator.args === null || decorator.args.length !== 1) {
|
|
2368
|
-
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG,
|
|
2244
|
+
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, decorator.node, `Incorrect number of arguments to @${decorator.name} decorator`);
|
|
2369
2245
|
}
|
|
2370
2246
|
const meta = unwrapExpression(decorator.args[0]);
|
|
2371
2247
|
if (!ts8.isObjectLiteralExpression(meta)) {
|
|
@@ -2419,7 +2295,7 @@ function extractClassMetadata(clazz, reflection, isCore, annotateForClosureCompi
|
|
|
2419
2295
|
if (!reflection.isClass(clazz)) {
|
|
2420
2296
|
return null;
|
|
2421
2297
|
}
|
|
2422
|
-
const id =
|
|
2298
|
+
const id = clazz.name;
|
|
2423
2299
|
const classDecorators = reflection.getDecoratorsOfDeclaration(clazz);
|
|
2424
2300
|
if (classDecorators === null) {
|
|
2425
2301
|
return null;
|
|
@@ -3210,9 +3086,9 @@ function invalidRef(decl, rawExpr, type) {
|
|
|
3210
3086
|
const annotationType = type === "import" ? "@NgModule" : "Angular";
|
|
3211
3087
|
relatedMessage = `Is it missing an ${annotationType} annotation?`;
|
|
3212
3088
|
} else if (sf.fileName.indexOf("node_modules") !== -1) {
|
|
3213
|
-
relatedMessage = `This likely means that the library${library} which declares ${decl.debugName}
|
|
3089
|
+
relatedMessage = `This likely means that the library${library} which declares ${decl.debugName} is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.`;
|
|
3214
3090
|
} else {
|
|
3215
|
-
relatedMessage = `This likely means that the dependency${library} which declares ${decl.debugName}
|
|
3091
|
+
relatedMessage = `This likely means that the dependency${library} which declares ${decl.debugName} is not compatible with Angular Ivy.`;
|
|
3216
3092
|
}
|
|
3217
3093
|
return makeDiagnostic(code, getDiagnosticNode(decl, rawExpr), message, [makeRelatedInformation(decl.node.name, relatedMessage)]);
|
|
3218
3094
|
}
|
|
@@ -3481,16 +3357,6 @@ var TraitCompiler = class {
|
|
|
3481
3357
|
return null;
|
|
3482
3358
|
}
|
|
3483
3359
|
}
|
|
3484
|
-
recordsFor(sf) {
|
|
3485
|
-
if (!this.fileToClasses.has(sf)) {
|
|
3486
|
-
return null;
|
|
3487
|
-
}
|
|
3488
|
-
const records = [];
|
|
3489
|
-
for (const clazz of this.fileToClasses.get(sf)) {
|
|
3490
|
-
records.push(this.classes.get(clazz));
|
|
3491
|
-
}
|
|
3492
|
-
return records;
|
|
3493
|
-
}
|
|
3494
3360
|
getAnalyzedRecords() {
|
|
3495
3361
|
const result = /* @__PURE__ */ new Map();
|
|
3496
3362
|
for (const [sf, classes] of this.fileToClasses) {
|
|
@@ -4332,7 +4198,7 @@ function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, refEmi
|
|
|
4332
4198
|
if (decorator === null || decorator.args === null || decorator.args.length === 0) {
|
|
4333
4199
|
directive = /* @__PURE__ */ new Map();
|
|
4334
4200
|
} else if (decorator.args.length !== 1) {
|
|
4335
|
-
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG,
|
|
4201
|
+
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, decorator.node, `Incorrect number of arguments to @${decorator.name} decorator`);
|
|
4336
4202
|
} else {
|
|
4337
4203
|
const meta = unwrapExpression(decorator.args[0]);
|
|
4338
4204
|
if (!ts20.isObjectLiteralExpression(meta)) {
|
|
@@ -4402,7 +4268,6 @@ function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, refEmi
|
|
|
4402
4268
|
const usesInheritance = reflector.hasBaseClass(clazz);
|
|
4403
4269
|
const sourceFile = clazz.getSourceFile();
|
|
4404
4270
|
const type = wrapTypeReference(reflector, clazz);
|
|
4405
|
-
const internalType = new WrappedNodeExpr4(reflector.getInternalNameOfClass(clazz));
|
|
4406
4271
|
const rawHostDirectives = directive.get("hostDirectives") || null;
|
|
4407
4272
|
const hostDirectives = rawHostDirectives === null ? null : extractHostDirectives(rawHostDirectives, evaluator);
|
|
4408
4273
|
const metadata = {
|
|
@@ -4419,7 +4284,6 @@ function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, refEmi
|
|
|
4419
4284
|
selector,
|
|
4420
4285
|
fullInheritance: !!(flags & HandlerFlags.FULL_INHERITANCE),
|
|
4421
4286
|
type,
|
|
4422
|
-
internalType,
|
|
4423
4287
|
typeArgumentCount: reflector.getGenericArityOfClass(clazz) || 0,
|
|
4424
4288
|
typeSourceSpan: createSourceSpan(clazz.name),
|
|
4425
4289
|
usesInheritance,
|
|
@@ -4517,11 +4381,11 @@ function extractHostBindings(members, evaluator, coreModule, metadata) {
|
|
|
4517
4381
|
let hostPropertyName = member.name;
|
|
4518
4382
|
if (decorator.args !== null && decorator.args.length > 0) {
|
|
4519
4383
|
if (decorator.args.length !== 1) {
|
|
4520
|
-
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG,
|
|
4384
|
+
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, decorator.node, `@HostBinding can have at most one argument, got ${decorator.args.length} argument(s)`);
|
|
4521
4385
|
}
|
|
4522
4386
|
const resolved = evaluator.evaluate(decorator.args[0]);
|
|
4523
4387
|
if (typeof resolved !== "string") {
|
|
4524
|
-
throw createValueHasWrongTypeError(
|
|
4388
|
+
throw createValueHasWrongTypeError(decorator.node, resolved, `@HostBinding's argument must be a string`);
|
|
4525
4389
|
}
|
|
4526
4390
|
hostPropertyName = resolved;
|
|
4527
4391
|
}
|
|
@@ -4607,7 +4471,7 @@ function isStringArrayOrDie(value, name, node) {
|
|
|
4607
4471
|
function queriesFromFields(fields, reflector, evaluator) {
|
|
4608
4472
|
return fields.map(({ member, decorators }) => {
|
|
4609
4473
|
const decorator = decorators[0];
|
|
4610
|
-
const node = member.node ||
|
|
4474
|
+
const node = member.node || decorator.node;
|
|
4611
4475
|
if (member.decorators.some((v) => v.name === "Input")) {
|
|
4612
4476
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_COLLISION, node, "Cannot combine @Input decorators with query decorators");
|
|
4613
4477
|
}
|
|
@@ -4641,7 +4505,7 @@ function parseDecoratedFields(fields, evaluator, callback) {
|
|
|
4641
4505
|
const fieldName = field.member.name;
|
|
4642
4506
|
for (const decorator of field.decorators) {
|
|
4643
4507
|
if (decorator.args != null && decorator.args.length > 1) {
|
|
4644
|
-
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG,
|
|
4508
|
+
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, decorator.node, `@${decorator.name} can have at most one argument, got ${decorator.args.length} argument(s)`);
|
|
4645
4509
|
}
|
|
4646
4510
|
const value = decorator.args != null && decorator.args.length > 0 ? evaluator.evaluate(decorator.args[0]) : null;
|
|
4647
4511
|
callback(fieldName, value, decorator);
|
|
@@ -4695,7 +4559,7 @@ function parseInputFields(inputMembers, evaluator) {
|
|
|
4695
4559
|
bindingPropertyName = typeof aliasInConfig === "string" ? aliasInConfig : classPropertyName;
|
|
4696
4560
|
required = options.get("required") === true;
|
|
4697
4561
|
} else {
|
|
4698
|
-
throw createValueHasWrongTypeError(
|
|
4562
|
+
throw createValueHasWrongTypeError(decorator.node, options, `@${decorator.name} decorator argument must resolve to a string or an object literal`);
|
|
4699
4563
|
}
|
|
4700
4564
|
inputs[classPropertyName] = { bindingPropertyName, classPropertyName, required };
|
|
4701
4565
|
});
|
|
@@ -4709,7 +4573,7 @@ function parseOutputFields(outputMembers, evaluator) {
|
|
|
4709
4573
|
const outputs = {};
|
|
4710
4574
|
parseDecoratedFields(outputMembers, evaluator, (fieldName, bindingPropertyName, decorator) => {
|
|
4711
4575
|
if (bindingPropertyName != null && typeof bindingPropertyName !== "string") {
|
|
4712
|
-
throw createValueHasWrongTypeError(
|
|
4576
|
+
throw createValueHasWrongTypeError(decorator.node, bindingPropertyName, `@${decorator.name} decorator argument must resolve to a string`);
|
|
4713
4577
|
}
|
|
4714
4578
|
outputs[fieldName] = bindingPropertyName != null ? bindingPropertyName : fieldName;
|
|
4715
4579
|
});
|
|
@@ -4781,7 +4645,7 @@ function parseHostDirectivesMapping(field, resolvedValue, classReference, source
|
|
|
4781
4645
|
}
|
|
4782
4646
|
function toHostDirectiveMetadata(hostDirective, context, refEmitter) {
|
|
4783
4647
|
return {
|
|
4784
|
-
directive: toR3Reference(hostDirective.directive.node, hostDirective.directive,
|
|
4648
|
+
directive: toR3Reference(hostDirective.directive.node, hostDirective.directive, context, refEmitter),
|
|
4785
4649
|
isForwardReference: hostDirective.isForwardReference,
|
|
4786
4650
|
inputs: hostDirective.inputs || null,
|
|
4787
4651
|
outputs: hostDirective.outputs || null
|
|
@@ -4890,7 +4754,7 @@ var LIFECYCLE_HOOKS = /* @__PURE__ */ new Set([
|
|
|
4890
4754
|
"ngAfterContentChecked"
|
|
4891
4755
|
]);
|
|
4892
4756
|
var DirectiveDecoratorHandler = class {
|
|
4893
|
-
constructor(reflector, evaluator, metaRegistry, scopeRegistry, metaReader, injectableRegistry, refEmitter, isCore, strictCtorDeps, semanticDepGraphUpdater, annotateForClosureCompiler,
|
|
4757
|
+
constructor(reflector, evaluator, metaRegistry, scopeRegistry, metaReader, injectableRegistry, refEmitter, isCore, strictCtorDeps, semanticDepGraphUpdater, annotateForClosureCompiler, perf) {
|
|
4894
4758
|
this.reflector = reflector;
|
|
4895
4759
|
this.evaluator = evaluator;
|
|
4896
4760
|
this.metaRegistry = metaRegistry;
|
|
@@ -4902,7 +4766,6 @@ var DirectiveDecoratorHandler = class {
|
|
|
4902
4766
|
this.strictCtorDeps = strictCtorDeps;
|
|
4903
4767
|
this.semanticDepGraphUpdater = semanticDepGraphUpdater;
|
|
4904
4768
|
this.annotateForClosureCompiler = annotateForClosureCompiler;
|
|
4905
|
-
this.compileUndecoratedClassesWithAngularFeatures = compileUndecoratedClassesWithAngularFeatures;
|
|
4906
4769
|
this.perf = perf;
|
|
4907
4770
|
this.precedence = HandlerPrecedence.PRIMARY;
|
|
4908
4771
|
this.name = DirectiveDecoratorHandler.name;
|
|
@@ -4918,7 +4781,7 @@ var DirectiveDecoratorHandler = class {
|
|
|
4918
4781
|
}
|
|
4919
4782
|
analyze(node, decorator, flags = HandlerFlags.NONE) {
|
|
4920
4783
|
var _a;
|
|
4921
|
-
if (
|
|
4784
|
+
if (decorator === null) {
|
|
4922
4785
|
if (this.isCore) {
|
|
4923
4786
|
return {};
|
|
4924
4787
|
}
|
|
@@ -5180,7 +5043,7 @@ var NgModuleDecoratorHandler = class {
|
|
|
5180
5043
|
this.perf.eventCount(PerfEvent.AnalyzeNgModule);
|
|
5181
5044
|
const name = node.name.text;
|
|
5182
5045
|
if (decorator.args === null || decorator.args.length > 1) {
|
|
5183
|
-
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG,
|
|
5046
|
+
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, decorator.node, `Incorrect number of arguments to @NgModule decorator`);
|
|
5184
5047
|
}
|
|
5185
5048
|
const meta = decorator.args.length === 1 ? unwrapExpression(decorator.args[0]) : ts22.factory.createObjectLiteralExpression([]);
|
|
5186
5049
|
if (!ts22.isObjectLiteralExpression(meta)) {
|
|
@@ -5251,33 +5114,24 @@ var NgModuleDecoratorHandler = class {
|
|
|
5251
5114
|
}
|
|
5252
5115
|
}
|
|
5253
5116
|
const valueContext = node.getSourceFile();
|
|
5254
|
-
let typeContext = valueContext;
|
|
5255
|
-
const typeNode = this.reflector.getDtsDeclaration(node);
|
|
5256
|
-
if (typeNode !== null) {
|
|
5257
|
-
typeContext = typeNode.getSourceFile();
|
|
5258
|
-
}
|
|
5259
5117
|
const exportedNodes = new Set(exportRefs.map((ref) => ref.node));
|
|
5260
5118
|
const declarations = [];
|
|
5261
5119
|
const exportedDeclarations = [];
|
|
5262
|
-
const bootstrap = bootstrapRefs.map((bootstrap2) => this._toR3Reference(bootstrap2.getOriginForDiagnostics(meta, node.name), bootstrap2, valueContext
|
|
5120
|
+
const bootstrap = bootstrapRefs.map((bootstrap2) => this._toR3Reference(bootstrap2.getOriginForDiagnostics(meta, node.name), bootstrap2, valueContext));
|
|
5263
5121
|
for (const ref of declarationRefs) {
|
|
5264
|
-
const decl = this._toR3Reference(ref.getOriginForDiagnostics(meta, node.name), ref, valueContext
|
|
5122
|
+
const decl = this._toR3Reference(ref.getOriginForDiagnostics(meta, node.name), ref, valueContext);
|
|
5265
5123
|
declarations.push(decl);
|
|
5266
5124
|
if (exportedNodes.has(ref.node)) {
|
|
5267
5125
|
exportedDeclarations.push(decl.type);
|
|
5268
5126
|
}
|
|
5269
5127
|
}
|
|
5270
|
-
const imports = importRefs.map((imp) => this._toR3Reference(imp.getOriginForDiagnostics(meta, node.name), imp, valueContext
|
|
5271
|
-
const exports = exportRefs.map((exp) => this._toR3Reference(exp.getOriginForDiagnostics(meta, node.name), exp, valueContext
|
|
5128
|
+
const imports = importRefs.map((imp) => this._toR3Reference(imp.getOriginForDiagnostics(meta, node.name), imp, valueContext));
|
|
5129
|
+
const exports = exportRefs.map((exp) => this._toR3Reference(exp.getOriginForDiagnostics(meta, node.name), exp, valueContext));
|
|
5272
5130
|
const isForwardReference = (ref) => isExpressionForwardReference(ref.value, node.name, valueContext);
|
|
5273
5131
|
const containsForwardDecls = bootstrap.some(isForwardReference) || declarations.some(isForwardReference) || imports.some(isForwardReference) || exports.some(isForwardReference);
|
|
5274
5132
|
const type = wrapTypeReference(this.reflector, node);
|
|
5275
|
-
const internalType = new WrappedNodeExpr6(this.reflector.getInternalNameOfClass(node));
|
|
5276
|
-
const adjacentType = new WrappedNodeExpr6(this.reflector.getAdjacentNameOfClass(node));
|
|
5277
5133
|
const ngModuleMetadata = {
|
|
5278
5134
|
type,
|
|
5279
|
-
internalType,
|
|
5280
|
-
adjacentType,
|
|
5281
5135
|
bootstrap,
|
|
5282
5136
|
declarations,
|
|
5283
5137
|
publicDeclarationTypes: this.onlyPublishPublicTypings ? exportedDeclarations : null,
|
|
@@ -5324,13 +5178,11 @@ var NgModuleDecoratorHandler = class {
|
|
|
5324
5178
|
const injectorMetadata = {
|
|
5325
5179
|
name,
|
|
5326
5180
|
type,
|
|
5327
|
-
internalType,
|
|
5328
5181
|
providers: wrappedProviders
|
|
5329
5182
|
};
|
|
5330
5183
|
const factoryMetadata = {
|
|
5331
5184
|
name,
|
|
5332
5185
|
type,
|
|
5333
|
-
internalType,
|
|
5334
5186
|
typeArgumentCount: 0,
|
|
5335
5187
|
deps: getValidConstructorDependencies(node, this.reflector, this.isCore),
|
|
5336
5188
|
target: FactoryTarget2.NgModule
|
|
@@ -5529,16 +5381,11 @@ var NgModuleDecoratorHandler = class {
|
|
|
5529
5381
|
];
|
|
5530
5382
|
return res;
|
|
5531
5383
|
}
|
|
5532
|
-
_toR3Reference(origin, valueRef, valueContext
|
|
5384
|
+
_toR3Reference(origin, valueRef, valueContext) {
|
|
5533
5385
|
if (valueRef.hasOwningModuleGuess) {
|
|
5534
|
-
return toR3Reference(origin, valueRef,
|
|
5386
|
+
return toR3Reference(origin, valueRef, valueContext, this.refEmitter);
|
|
5535
5387
|
} else {
|
|
5536
|
-
|
|
5537
|
-
let typeNode = this.reflector.getDtsDeclaration(typeRef.node);
|
|
5538
|
-
if (typeNode !== null && isNamedClassDeclaration(typeNode)) {
|
|
5539
|
-
typeRef = new Reference(typeNode);
|
|
5540
|
-
}
|
|
5541
|
-
return toR3Reference(origin, valueRef, typeRef, valueContext, typeContext, this.refEmitter);
|
|
5388
|
+
return toR3Reference(origin, valueRef, valueContext, this.refEmitter);
|
|
5542
5389
|
}
|
|
5543
5390
|
}
|
|
5544
5391
|
isClassDeclarationReference(ref) {
|
|
@@ -5774,7 +5621,7 @@ function parseTemplateDeclaration(node, decorator, component, containingFile, ev
|
|
|
5774
5621
|
resolvedTemplateUrl: containingFile
|
|
5775
5622
|
};
|
|
5776
5623
|
} else {
|
|
5777
|
-
throw new FatalDiagnosticError(ErrorCode.COMPONENT_MISSING_TEMPLATE,
|
|
5624
|
+
throw new FatalDiagnosticError(ErrorCode.COMPONENT_MISSING_TEMPLATE, decorator.node, "component is missing a template");
|
|
5778
5625
|
}
|
|
5779
5626
|
}
|
|
5780
5627
|
function preloadAndParseTemplate(evaluator, resourceLoader, depTracker, preanalyzeTemplateCache, node, decorator, component, containingFile, defaultPreserveWhitespaces, options) {
|
|
@@ -6788,17 +6635,15 @@ var InjectableDecoratorHandler = class {
|
|
|
6788
6635
|
function extractInjectableMetadata(clazz, decorator, reflector) {
|
|
6789
6636
|
const name = clazz.name.text;
|
|
6790
6637
|
const type = wrapTypeReference(reflector, clazz);
|
|
6791
|
-
const internalType = new WrappedNodeExpr8(reflector.getInternalNameOfClass(clazz));
|
|
6792
6638
|
const typeArgumentCount = reflector.getGenericArityOfClass(clazz) || 0;
|
|
6793
6639
|
if (decorator.args === null) {
|
|
6794
|
-
throw new FatalDiagnosticError(ErrorCode.DECORATOR_NOT_CALLED,
|
|
6640
|
+
throw new FatalDiagnosticError(ErrorCode.DECORATOR_NOT_CALLED, decorator.node, "@Injectable must be called");
|
|
6795
6641
|
}
|
|
6796
6642
|
if (decorator.args.length === 0) {
|
|
6797
6643
|
return {
|
|
6798
6644
|
name,
|
|
6799
6645
|
type,
|
|
6800
6646
|
typeArgumentCount,
|
|
6801
|
-
internalType,
|
|
6802
6647
|
providedIn: createMayBeForwardRefExpression2(new LiteralExpr3(null), 0)
|
|
6803
6648
|
};
|
|
6804
6649
|
} else if (decorator.args.length === 1) {
|
|
@@ -6816,7 +6661,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
|
|
|
6816
6661
|
}
|
|
6817
6662
|
deps = depsExpr.elements.map((dep) => getDep(dep, reflector));
|
|
6818
6663
|
}
|
|
6819
|
-
const result = { name, type, typeArgumentCount,
|
|
6664
|
+
const result = { name, type, typeArgumentCount, providedIn };
|
|
6820
6665
|
if (meta.has("useValue")) {
|
|
6821
6666
|
result.useValue = getProviderExpression(meta.get("useValue"), reflector);
|
|
6822
6667
|
} else if (meta.has("useExisting")) {
|
|
@@ -6839,7 +6684,7 @@ function getProviderExpression(expression, reflector) {
|
|
|
6839
6684
|
}
|
|
6840
6685
|
function extractInjectableCtorDeps(clazz, meta, decorator, reflector, isCore, strictCtorDeps) {
|
|
6841
6686
|
if (decorator.args === null) {
|
|
6842
|
-
throw new FatalDiagnosticError(ErrorCode.DECORATOR_NOT_CALLED,
|
|
6687
|
+
throw new FatalDiagnosticError(ErrorCode.DECORATOR_NOT_CALLED, decorator.node, "@Injectable must be called");
|
|
6843
6688
|
}
|
|
6844
6689
|
let ctorDeps = null;
|
|
6845
6690
|
if (decorator.args.length === 0) {
|
|
@@ -6914,7 +6759,7 @@ function getDep(dep, reflector) {
|
|
|
6914
6759
|
}
|
|
6915
6760
|
|
|
6916
6761
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/pipe.mjs
|
|
6917
|
-
import { compileClassMetadata as compileClassMetadata5, compileDeclareClassMetadata as compileDeclareClassMetadata5, compileDeclarePipeFromMetadata, compilePipeFromMetadata, FactoryTarget as FactoryTarget5
|
|
6762
|
+
import { compileClassMetadata as compileClassMetadata5, compileDeclareClassMetadata as compileDeclareClassMetadata5, compileDeclarePipeFromMetadata, compilePipeFromMetadata, FactoryTarget as FactoryTarget5 } from "@angular/compiler";
|
|
6918
6763
|
import ts26 from "typescript";
|
|
6919
6764
|
var PipeSymbol = class extends SemanticSymbol {
|
|
6920
6765
|
constructor(decl, name) {
|
|
@@ -6963,12 +6808,11 @@ var PipeDecoratorHandler = class {
|
|
|
6963
6808
|
this.perf.eventCount(PerfEvent.AnalyzePipe);
|
|
6964
6809
|
const name = clazz.name.text;
|
|
6965
6810
|
const type = wrapTypeReference(this.reflector, clazz);
|
|
6966
|
-
const internalType = new WrappedNodeExpr9(this.reflector.getInternalNameOfClass(clazz));
|
|
6967
6811
|
if (decorator.args === null) {
|
|
6968
|
-
throw new FatalDiagnosticError(ErrorCode.DECORATOR_NOT_CALLED,
|
|
6812
|
+
throw new FatalDiagnosticError(ErrorCode.DECORATOR_NOT_CALLED, decorator.node, `@Pipe must be called`);
|
|
6969
6813
|
}
|
|
6970
6814
|
if (decorator.args.length !== 1) {
|
|
6971
|
-
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG,
|
|
6815
|
+
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, decorator.node, "@Pipe must have exactly one argument");
|
|
6972
6816
|
}
|
|
6973
6817
|
const meta = unwrapExpression(decorator.args[0]);
|
|
6974
6818
|
if (!ts26.isObjectLiteralExpression(meta)) {
|
|
@@ -7006,7 +6850,6 @@ var PipeDecoratorHandler = class {
|
|
|
7006
6850
|
meta: {
|
|
7007
6851
|
name,
|
|
7008
6852
|
type,
|
|
7009
|
-
internalType,
|
|
7010
6853
|
typeArgumentCount: this.reflector.getGenericArityOfClass(clazz) || 0,
|
|
7011
6854
|
pipeName,
|
|
7012
6855
|
deps: getValidConstructorDependencies(clazz, this.reflector, this.isCore),
|
|
@@ -7152,4 +6995,4 @@ export {
|
|
|
7152
6995
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7153
6996
|
* found in the LICENSE file at https://angular.io/license
|
|
7154
6997
|
*/
|
|
7155
|
-
//# sourceMappingURL=chunk-
|
|
6998
|
+
//# sourceMappingURL=chunk-QELUO2L4.js.map
|