@angular/compiler-cli 14.2.0 → 15.0.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/{chunk-NDIOQ2EH.js → chunk-4CS5WLPD.js} +35 -12
- package/bundles/chunk-4CS5WLPD.js.map +6 -0
- package/bundles/{chunk-CLRZAXXE.js → chunk-DM4TYSFG.js} +9 -2
- package/bundles/chunk-DM4TYSFG.js.map +6 -0
- package/bundles/{chunk-XR6BVLNN.js → chunk-IKKP4LXM.js} +4 -1
- package/bundles/chunk-IKKP4LXM.js.map +6 -0
- package/bundles/{chunk-3GWIAJ6N.js → chunk-JN4TT3OU.js} +27 -17
- package/bundles/chunk-JN4TT3OU.js.map +6 -0
- package/bundles/{chunk-DEPZI7L5.js → chunk-KUSEWNLW.js} +27 -5
- package/bundles/chunk-KUSEWNLW.js.map +6 -0
- package/bundles/{chunk-NJ2FQOJT.js → chunk-MOE5WKIA.js} +5 -3
- package/bundles/chunk-MOE5WKIA.js.map +6 -0
- package/bundles/{chunk-J6AVV3MN.js → chunk-MQGVI6KC.js} +225 -52
- package/bundles/chunk-MQGVI6KC.js.map +6 -0
- package/bundles/{chunk-I4BG3CAN.js → chunk-MT76GVED.js} +11 -9
- package/bundles/chunk-MT76GVED.js.map +6 -0
- package/bundles/{chunk-DGTSPJIN.js → chunk-PLV54QMQ.js} +3 -3
- package/bundles/{chunk-DGTSPJIN.js.map → chunk-PLV54QMQ.js.map} +0 -0
- package/bundles/{chunk-TTIGAMYZ.js → chunk-TR3BZDPT.js} +2 -2
- package/bundles/{chunk-TTIGAMYZ.js.map → chunk-TR3BZDPT.js.map} +0 -0
- package/bundles/index.js +7 -7
- package/bundles/linker/babel/index.js +3 -3
- package/bundles/linker/index.js +3 -3
- package/bundles/ngcc/index.js +7 -7
- package/bundles/ngcc/main-ngcc.js +7 -7
- package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js +6 -6
- package/bundles/private/migrations.js +4 -4
- package/bundles/private/tooling.js +3 -3
- package/bundles/src/bin/ng_xi18n.js +6 -6
- package/bundles/src/bin/ngc.js +6 -6
- package/bundles_metadata.json +1 -1
- package/ngcc/src/analysis/decoration_analyzer.d.ts +2 -1
- package/ngcc/src/packages/build_marker.d.ts +1 -1
- package/package.json +2 -2
- package/src/ngtsc/annotations/common/src/diagnostics.d.ts +2 -1
- package/src/ngtsc/annotations/component/src/handler.d.ts +3 -2
- package/src/ngtsc/annotations/component/src/metadata.d.ts +5 -1
- package/src/ngtsc/annotations/directive/src/handler.d.ts +6 -3
- package/src/ngtsc/annotations/directive/src/shared.d.ts +5 -2
- package/src/ngtsc/diagnostics/src/error_code.d.ts +12 -0
- package/src/ngtsc/metadata/index.d.ts +1 -0
- package/src/ngtsc/metadata/src/api.d.ts +28 -0
- package/src/ngtsc/metadata/src/host_directives_resolver.d.ts +28 -0
- package/src/ngtsc/metadata/src/util.d.ts +3 -2
- package/src/ngtsc/scope/src/typecheck.d.ts +4 -3
- package/src/ngtsc/ts_compatibility/src/ts_cross_version_utils.d.ts +36 -2
- package/src/ngtsc/typecheck/src/type_check_block.d.ts +1 -1
- package/bundles/chunk-3GWIAJ6N.js.map +0 -6
- package/bundles/chunk-CLRZAXXE.js.map +0 -6
- package/bundles/chunk-DEPZI7L5.js.map +0 -6
- package/bundles/chunk-I4BG3CAN.js.map +0 -6
- package/bundles/chunk-J6AVV3MN.js.map +0 -6
- package/bundles/chunk-NDIOQ2EH.js.map +0 -6
- package/bundles/chunk-NJ2FQOJT.js.map +0 -6
- package/bundles/chunk-XR6BVLNN.js.map +0 -6
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
reflectObjectLiteral,
|
|
14
14
|
reflectTypeEntityToDeclaration,
|
|
15
15
|
typeNodeToValueExpr
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-MOE5WKIA.js";
|
|
17
17
|
import {
|
|
18
18
|
ErrorCode,
|
|
19
19
|
FatalDiagnosticError,
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
translateExpression,
|
|
34
34
|
translateStatement,
|
|
35
35
|
translateType
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-IKKP4LXM.js";
|
|
37
37
|
import {
|
|
38
38
|
combineModifiers,
|
|
39
39
|
createPropertyDeclaration,
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
updateParameterDeclaration,
|
|
47
47
|
updatePropertyDeclaration,
|
|
48
48
|
updateSetAccessorDeclaration
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-DM4TYSFG.js";
|
|
50
50
|
import {
|
|
51
51
|
absoluteFrom,
|
|
52
52
|
absoluteFromSourceFile,
|
|
@@ -1525,6 +1525,23 @@ function getDirectiveDiagnostics(node, reader, evaluator, reflector, scopeRegist
|
|
|
1525
1525
|
addDiagnostics(checkInheritanceOfDirective(node, reader, reflector, evaluator));
|
|
1526
1526
|
return diagnostics;
|
|
1527
1527
|
}
|
|
1528
|
+
function validateHostDirectives(origin, hostDirectives, metaReader) {
|
|
1529
|
+
const diagnostics = [];
|
|
1530
|
+
for (const current of hostDirectives) {
|
|
1531
|
+
const hostMeta = metaReader.getDirectiveMetadata(current.directive);
|
|
1532
|
+
if (hostMeta === null) {
|
|
1533
|
+
diagnostics.push(makeDiagnostic(ErrorCode.HOST_DIRECTIVE_INVALID, current.directive.getOriginForDiagnostics(origin), `${current.directive.debugName} must be a standalone directive to be used as a host directive`));
|
|
1534
|
+
continue;
|
|
1535
|
+
}
|
|
1536
|
+
if (!hostMeta.isStandalone) {
|
|
1537
|
+
diagnostics.push(makeDiagnostic(ErrorCode.HOST_DIRECTIVE_NOT_STANDALONE, current.directive.getOriginForDiagnostics(origin), `Host directive ${hostMeta.name} must be standalone`));
|
|
1538
|
+
}
|
|
1539
|
+
if (hostMeta.isComponent) {
|
|
1540
|
+
diagnostics.push(makeDiagnostic(ErrorCode.HOST_DIRECTIVE_COMPONENT, current.directive.getOriginForDiagnostics(origin), `Host directive ${hostMeta.name} cannot be a component`));
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
return diagnostics;
|
|
1544
|
+
}
|
|
1528
1545
|
function getUndecoratedClassWithAngularFeaturesDiagnostic(node) {
|
|
1529
1546
|
return makeDiagnostic(ErrorCode.UNDECORATED_CLASS_USING_ANGULAR_FEATURES, node.name, `Class is using Angular features but is not decorated. Please add an explicit Angular decorator.`);
|
|
1530
1547
|
}
|
|
@@ -1670,12 +1687,11 @@ function decoratorToMetadata(decorator, wrapFunctionsInParens) {
|
|
|
1670
1687
|
throw new Error("Illegal state: synthesized decorator cannot be emitted in class metadata.");
|
|
1671
1688
|
}
|
|
1672
1689
|
const properties = [
|
|
1673
|
-
ts7.factory.createPropertyAssignment("type",
|
|
1690
|
+
ts7.factory.createPropertyAssignment("type", decorator.identifier)
|
|
1674
1691
|
];
|
|
1675
1692
|
if (decorator.args !== null && decorator.args.length > 0) {
|
|
1676
1693
|
const args = decorator.args.map((arg) => {
|
|
1677
|
-
|
|
1678
|
-
return wrapFunctionsInParens ? wrapFunctionExpressionsInParens(expr) : expr;
|
|
1694
|
+
return wrapFunctionsInParens ? wrapFunctionExpressionsInParens(arg) : arg;
|
|
1679
1695
|
});
|
|
1680
1696
|
properties.push(ts7.factory.createPropertyAssignment("args", ts7.factory.createArrayLiteralExpression(args)));
|
|
1681
1697
|
}
|
|
@@ -1970,6 +1986,11 @@ var MetaKind;
|
|
|
1970
1986
|
MetaKind2[MetaKind2["Pipe"] = 1] = "Pipe";
|
|
1971
1987
|
MetaKind2[MetaKind2["NgModule"] = 2] = "NgModule";
|
|
1972
1988
|
})(MetaKind || (MetaKind = {}));
|
|
1989
|
+
var MatchSource;
|
|
1990
|
+
(function(MatchSource2) {
|
|
1991
|
+
MatchSource2[MatchSource2["Selector"] = 0] = "Selector";
|
|
1992
|
+
MatchSource2[MatchSource2["HostDirective"] = 1] = "HostDirective";
|
|
1993
|
+
})(MatchSource || (MatchSource = {}));
|
|
1973
1994
|
|
|
1974
1995
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/dts.mjs
|
|
1975
1996
|
import ts11 from "typescript";
|
|
@@ -2060,18 +2081,20 @@ function extractReferencesFromType(checker, def, bestGuessOwningModule) {
|
|
|
2060
2081
|
if (!ts10.isTypeQueryNode(element)) {
|
|
2061
2082
|
throw new Error(`Expected TypeQueryNode: ${nodeDebugInfo(element)}`);
|
|
2062
2083
|
}
|
|
2063
|
-
|
|
2064
|
-
const { node, from } = reflectTypeEntityToDeclaration(type, checker);
|
|
2065
|
-
if (!isNamedClassDeclaration(node)) {
|
|
2066
|
-
throw new Error(`Expected named ClassDeclaration: ${nodeDebugInfo(node)}`);
|
|
2067
|
-
}
|
|
2068
|
-
if (from !== null && !from.startsWith(".")) {
|
|
2069
|
-
return new Reference(node, { specifier: from, resolutionContext: def.getSourceFile().fileName });
|
|
2070
|
-
} else {
|
|
2071
|
-
return new Reference(node, bestGuessOwningModule);
|
|
2072
|
-
}
|
|
2084
|
+
return extraReferenceFromTypeQuery(checker, element, def, bestGuessOwningModule);
|
|
2073
2085
|
});
|
|
2074
2086
|
}
|
|
2087
|
+
function extraReferenceFromTypeQuery(checker, typeNode, origin, bestGuessOwningModule) {
|
|
2088
|
+
const type = typeNode.exprName;
|
|
2089
|
+
const { node, from } = reflectTypeEntityToDeclaration(type, checker);
|
|
2090
|
+
if (!isNamedClassDeclaration(node)) {
|
|
2091
|
+
throw new Error(`Expected named ClassDeclaration: ${nodeDebugInfo(node)}`);
|
|
2092
|
+
}
|
|
2093
|
+
if (from !== null && !from.startsWith(".")) {
|
|
2094
|
+
return new Reference(node, { specifier: from, resolutionContext: origin.getSourceFile().fileName });
|
|
2095
|
+
}
|
|
2096
|
+
return new Reference(node, bestGuessOwningModule);
|
|
2097
|
+
}
|
|
2075
2098
|
function readBooleanType(type) {
|
|
2076
2099
|
if (!ts10.isLiteralTypeNode(type)) {
|
|
2077
2100
|
return null;
|
|
@@ -2091,16 +2114,16 @@ function readStringType(type) {
|
|
|
2091
2114
|
}
|
|
2092
2115
|
return type.literal.text;
|
|
2093
2116
|
}
|
|
2094
|
-
function
|
|
2117
|
+
function readMapType(type, valueTransform) {
|
|
2095
2118
|
if (!ts10.isTypeLiteralNode(type)) {
|
|
2096
2119
|
return {};
|
|
2097
2120
|
}
|
|
2098
2121
|
const obj = {};
|
|
2099
2122
|
type.members.forEach((member) => {
|
|
2100
|
-
if (!ts10.isPropertySignature(member) || member.type === void 0 || member.name === void 0 || !ts10.isStringLiteral(member.name)) {
|
|
2123
|
+
if (!ts10.isPropertySignature(member) || member.type === void 0 || member.name === void 0 || !ts10.isStringLiteral(member.name) && !ts10.isIdentifier(member.name)) {
|
|
2101
2124
|
return;
|
|
2102
2125
|
}
|
|
2103
|
-
const value =
|
|
2126
|
+
const value = valueTransform(member.type);
|
|
2104
2127
|
if (value === null) {
|
|
2105
2128
|
return null;
|
|
2106
2129
|
}
|
|
@@ -2273,10 +2296,12 @@ var DtsMetadataReader = class {
|
|
|
2273
2296
|
return param.typeValueReference.kind === 1 && param.typeValueReference.moduleName === "@angular/core" && param.typeValueReference.importedName === "TemplateRef";
|
|
2274
2297
|
});
|
|
2275
2298
|
const isStandalone = def.type.typeArguments.length > 7 && ((_a = readBooleanType(def.type.typeArguments[7])) != null ? _a : false);
|
|
2276
|
-
const inputs = ClassPropertyMapping.fromMappedObject(
|
|
2277
|
-
const outputs = ClassPropertyMapping.fromMappedObject(
|
|
2299
|
+
const inputs = ClassPropertyMapping.fromMappedObject(readMapType(def.type.typeArguments[3], readStringType));
|
|
2300
|
+
const outputs = ClassPropertyMapping.fromMappedObject(readMapType(def.type.typeArguments[4], readStringType));
|
|
2301
|
+
const hostDirectives = def.type.typeArguments.length > 8 ? readHostDirectivesType(this.checker, def.type.typeArguments[8], ref.bestGuessOwningModule) : null;
|
|
2278
2302
|
return {
|
|
2279
2303
|
kind: MetaKind.Directive,
|
|
2304
|
+
matchSource: MatchSource.Selector,
|
|
2280
2305
|
ref,
|
|
2281
2306
|
name: clazz.name.text,
|
|
2282
2307
|
isComponent,
|
|
@@ -2284,6 +2309,7 @@ var DtsMetadataReader = class {
|
|
|
2284
2309
|
exportAs: readStringArrayType(def.type.typeArguments[2]),
|
|
2285
2310
|
inputs,
|
|
2286
2311
|
outputs,
|
|
2312
|
+
hostDirectives,
|
|
2287
2313
|
queries: readStringArrayType(def.type.typeArguments[5]),
|
|
2288
2314
|
...extractDirectiveTypeCheckMeta(clazz, inputs, this.reflector),
|
|
2289
2315
|
baseClass: readBaseClass2(clazz, this.checker, this.reflector),
|
|
@@ -2344,6 +2370,27 @@ function readBaseClass2(clazz, checker, reflector) {
|
|
|
2344
2370
|
}
|
|
2345
2371
|
return null;
|
|
2346
2372
|
}
|
|
2373
|
+
function readHostDirectivesType(checker, type, bestGuessOwningModule) {
|
|
2374
|
+
if (!ts11.isTupleTypeNode(type) || type.elements.length === 0) {
|
|
2375
|
+
return null;
|
|
2376
|
+
}
|
|
2377
|
+
const result = [];
|
|
2378
|
+
for (const hostDirectiveType of type.elements) {
|
|
2379
|
+
const { directive, inputs, outputs } = readMapType(hostDirectiveType, (type2) => type2);
|
|
2380
|
+
if (directive) {
|
|
2381
|
+
if (!ts11.isTypeQueryNode(directive)) {
|
|
2382
|
+
throw new Error(`Expected TypeQueryNode: ${nodeDebugInfo(directive)}`);
|
|
2383
|
+
}
|
|
2384
|
+
result.push({
|
|
2385
|
+
directive: extraReferenceFromTypeQuery(checker, directive, type, bestGuessOwningModule),
|
|
2386
|
+
isForwardReference: false,
|
|
2387
|
+
inputs: readMapType(inputs, readStringType),
|
|
2388
|
+
outputs: readMapType(outputs, readStringType)
|
|
2389
|
+
});
|
|
2390
|
+
}
|
|
2391
|
+
}
|
|
2392
|
+
return result.length > 0 ? result : null;
|
|
2393
|
+
}
|
|
2347
2394
|
|
|
2348
2395
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/inheritance.mjs
|
|
2349
2396
|
function flattenInheritedDirectiveMetadata(reader, dir) {
|
|
@@ -2527,6 +2574,57 @@ var ResourceRegistry = class {
|
|
|
2527
2574
|
}
|
|
2528
2575
|
};
|
|
2529
2576
|
|
|
2577
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/host_directives_resolver.mjs
|
|
2578
|
+
var EMPTY_ARRAY = [];
|
|
2579
|
+
var HostDirectivesResolver = class {
|
|
2580
|
+
constructor(metaReader) {
|
|
2581
|
+
this.metaReader = metaReader;
|
|
2582
|
+
this.cache = /* @__PURE__ */ new Map();
|
|
2583
|
+
}
|
|
2584
|
+
resolve(metadata) {
|
|
2585
|
+
if (this.cache.has(metadata.ref.node)) {
|
|
2586
|
+
return this.cache.get(metadata.ref.node);
|
|
2587
|
+
}
|
|
2588
|
+
const results = metadata.hostDirectives && metadata.hostDirectives.length > 0 ? this.walkHostDirectives(metadata.hostDirectives, []) : EMPTY_ARRAY;
|
|
2589
|
+
this.cache.set(metadata.ref.node, results);
|
|
2590
|
+
return results;
|
|
2591
|
+
}
|
|
2592
|
+
walkHostDirectives(directives, results) {
|
|
2593
|
+
for (const current of directives) {
|
|
2594
|
+
const hostMeta = flattenInheritedDirectiveMetadata(this.metaReader, current.directive);
|
|
2595
|
+
if (hostMeta === null) {
|
|
2596
|
+
throw new Error(`Could not resolve host directive metadata of ${current.directive.debugName}`);
|
|
2597
|
+
}
|
|
2598
|
+
if (hostMeta.hostDirectives) {
|
|
2599
|
+
this.walkHostDirectives(hostMeta.hostDirectives, results);
|
|
2600
|
+
}
|
|
2601
|
+
results.push({
|
|
2602
|
+
...hostMeta,
|
|
2603
|
+
matchSource: MatchSource.HostDirective,
|
|
2604
|
+
inputs: this.filterMappings(hostMeta.inputs, current.inputs),
|
|
2605
|
+
outputs: this.filterMappings(hostMeta.outputs, current.outputs)
|
|
2606
|
+
});
|
|
2607
|
+
}
|
|
2608
|
+
return results;
|
|
2609
|
+
}
|
|
2610
|
+
filterMappings(source, allowedProperties) {
|
|
2611
|
+
const result = {};
|
|
2612
|
+
if (allowedProperties !== null) {
|
|
2613
|
+
for (const publicName in allowedProperties) {
|
|
2614
|
+
if (allowedProperties.hasOwnProperty(publicName)) {
|
|
2615
|
+
const bindings = source.getByBindingPropertyName(publicName);
|
|
2616
|
+
if (bindings !== null) {
|
|
2617
|
+
for (const binding of bindings) {
|
|
2618
|
+
result[binding.classPropertyName] = allowedProperties[publicName];
|
|
2619
|
+
}
|
|
2620
|
+
}
|
|
2621
|
+
}
|
|
2622
|
+
}
|
|
2623
|
+
}
|
|
2624
|
+
return ClassPropertyMapping.fromMappedObject(result);
|
|
2625
|
+
}
|
|
2626
|
+
};
|
|
2627
|
+
|
|
2530
2628
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/api.mjs
|
|
2531
2629
|
var ComponentScopeKind;
|
|
2532
2630
|
(function(ComponentScopeKind2) {
|
|
@@ -3005,9 +3103,10 @@ function reexportCollision(module, refA, refB) {
|
|
|
3005
3103
|
import { CssSelector, SelectorMatcher } from "@angular/compiler";
|
|
3006
3104
|
import ts13 from "typescript";
|
|
3007
3105
|
var TypeCheckScopeRegistry = class {
|
|
3008
|
-
constructor(scopeReader, metaReader) {
|
|
3106
|
+
constructor(scopeReader, metaReader, hostDirectivesResolver) {
|
|
3009
3107
|
this.scopeReader = scopeReader;
|
|
3010
3108
|
this.metaReader = metaReader;
|
|
3109
|
+
this.hostDirectivesResolver = hostDirectivesResolver;
|
|
3011
3110
|
this.flattenedDirectiveMetaCache = /* @__PURE__ */ new Map();
|
|
3012
3111
|
this.scopeCache = /* @__PURE__ */ new Map();
|
|
3013
3112
|
}
|
|
@@ -3033,7 +3132,7 @@ var TypeCheckScopeRegistry = class {
|
|
|
3033
3132
|
for (const meta of dependencies) {
|
|
3034
3133
|
if (meta.kind === MetaKind.Directive && meta.selector !== null) {
|
|
3035
3134
|
const extMeta = this.getTypeCheckDirectiveMetadata(meta.ref);
|
|
3036
|
-
matcher.addSelectables(CssSelector.parse(meta.selector), extMeta);
|
|
3135
|
+
matcher.addSelectables(CssSelector.parse(meta.selector), [...this.hostDirectivesResolver.resolve(extMeta), extMeta]);
|
|
3037
3136
|
directives.push(extMeta);
|
|
3038
3137
|
} else if (meta.kind === MetaKind.Pipe) {
|
|
3039
3138
|
if (!ts13.isClassDeclaration(meta.ref.node)) {
|
|
@@ -3792,7 +3891,7 @@ var Visitor = class {
|
|
|
3792
3891
|
} else {
|
|
3793
3892
|
visitedNode = this.visitOtherNode(node);
|
|
3794
3893
|
}
|
|
3795
|
-
if (
|
|
3894
|
+
if (ts18.isBlock(visitedNode) || ts18.isSourceFile(visitedNode)) {
|
|
3796
3895
|
visitedNode = this._maybeProcessStatements(visitedNode);
|
|
3797
3896
|
}
|
|
3798
3897
|
return visitedNode;
|
|
@@ -3801,9 +3900,8 @@ var Visitor = class {
|
|
|
3801
3900
|
if (node.statements.every((stmt) => !this._before.has(stmt) && !this._after.has(stmt))) {
|
|
3802
3901
|
return node;
|
|
3803
3902
|
}
|
|
3804
|
-
const clone = ts18.getMutableClone(node);
|
|
3805
3903
|
const newStatements = [];
|
|
3806
|
-
|
|
3904
|
+
node.statements.forEach((stmt) => {
|
|
3807
3905
|
if (this._before.has(stmt)) {
|
|
3808
3906
|
newStatements.push(...this._before.get(stmt));
|
|
3809
3907
|
this._before.delete(stmt);
|
|
@@ -3814,14 +3912,14 @@ var Visitor = class {
|
|
|
3814
3912
|
this._after.delete(stmt);
|
|
3815
3913
|
}
|
|
3816
3914
|
});
|
|
3817
|
-
|
|
3818
|
-
|
|
3915
|
+
const statementsArray = ts18.factory.createNodeArray(newStatements, node.statements.hasTrailingComma);
|
|
3916
|
+
if (ts18.isBlock(node)) {
|
|
3917
|
+
return ts18.factory.updateBlock(node, statementsArray);
|
|
3918
|
+
} else {
|
|
3919
|
+
return ts18.factory.updateSourceFile(node, statementsArray, node.isDeclarationFile, node.referencedFiles, node.typeReferenceDirectives, node.hasNoDefaultLib, node.libReferenceDirectives);
|
|
3920
|
+
}
|
|
3819
3921
|
}
|
|
3820
3922
|
};
|
|
3821
|
-
function hasStatements(node) {
|
|
3822
|
-
const block = node;
|
|
3823
|
-
return block.statements !== void 0 && Array.isArray(block.statements);
|
|
3824
|
-
}
|
|
3825
3923
|
|
|
3826
3924
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/transform.mjs
|
|
3827
3925
|
var NO_DECORATORS = /* @__PURE__ */ new Set();
|
|
@@ -4024,7 +4122,7 @@ var QUERY_TYPES = /* @__PURE__ */ new Set([
|
|
|
4024
4122
|
"ViewChild",
|
|
4025
4123
|
"ViewChildren"
|
|
4026
4124
|
]);
|
|
4027
|
-
function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, isCore, flags, annotateForClosureCompiler, defaultSelector = null) {
|
|
4125
|
+
function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, refEmitter, isCore, flags, annotateForClosureCompiler, defaultSelector = null) {
|
|
4028
4126
|
let directive;
|
|
4029
4127
|
if (decorator === null || decorator.args === null || decorator.args.length === 0) {
|
|
4030
4128
|
directive = /* @__PURE__ */ new Map();
|
|
@@ -4095,10 +4193,13 @@ function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, isCore
|
|
|
4095
4193
|
isStandalone = resolved;
|
|
4096
4194
|
}
|
|
4097
4195
|
const usesInheritance = reflector.hasBaseClass(clazz);
|
|
4196
|
+
const sourceFile = clazz.getSourceFile();
|
|
4098
4197
|
const type = wrapTypeReference(reflector, clazz);
|
|
4099
4198
|
const internalType = new WrappedNodeExpr4(reflector.getInternalNameOfClass(clazz));
|
|
4100
4199
|
const inputs = ClassPropertyMapping.fromMappedObject({ ...inputsFromMeta, ...inputsFromFields });
|
|
4101
4200
|
const outputs = ClassPropertyMapping.fromMappedObject({ ...outputsFromMeta, ...outputsFromFields });
|
|
4201
|
+
const rawHostDirectives = directive.get("hostDirectives") || null;
|
|
4202
|
+
const hostDirectives = rawHostDirectives === null ? null : extractHostDirectives(rawHostDirectives, evaluator);
|
|
4102
4203
|
const metadata = {
|
|
4103
4204
|
name: clazz.name.text,
|
|
4104
4205
|
deps: ctorDeps,
|
|
@@ -4119,14 +4220,17 @@ function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, isCore
|
|
|
4119
4220
|
usesInheritance,
|
|
4120
4221
|
exportAs,
|
|
4121
4222
|
providers,
|
|
4122
|
-
isStandalone
|
|
4223
|
+
isStandalone,
|
|
4224
|
+
hostDirectives: (hostDirectives == null ? void 0 : hostDirectives.map((hostDir) => toHostDirectiveMetadata(hostDir, sourceFile, refEmitter))) || null
|
|
4123
4225
|
};
|
|
4124
4226
|
return {
|
|
4125
4227
|
decorator: directive,
|
|
4126
4228
|
metadata,
|
|
4127
4229
|
inputs,
|
|
4128
4230
|
outputs,
|
|
4129
|
-
isStructural
|
|
4231
|
+
isStructural,
|
|
4232
|
+
hostDirectives,
|
|
4233
|
+
rawHostDirectives
|
|
4130
4234
|
};
|
|
4131
4235
|
}
|
|
4132
4236
|
function extractQueryMetadata(exprNode, name, args, propertyName, reflector, evaluator) {
|
|
@@ -4315,12 +4419,15 @@ function isPropertyTypeMember(member) {
|
|
|
4315
4419
|
}
|
|
4316
4420
|
function parseFieldToPropertyMapping(directive, field, evaluator) {
|
|
4317
4421
|
const metaValues = parseFieldArrayValue(directive, field, evaluator);
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
return
|
|
4322
|
-
|
|
4323
|
-
|
|
4422
|
+
return metaValues ? parseInputOutputMappingArray(metaValues) : EMPTY_OBJECT;
|
|
4423
|
+
}
|
|
4424
|
+
function parseInputOutputMappingArray(values) {
|
|
4425
|
+
return values.reduce((results, value) => {
|
|
4426
|
+
if (typeof value !== "string") {
|
|
4427
|
+
throw new Error("Mapping value must be a string");
|
|
4428
|
+
}
|
|
4429
|
+
const [field, property] = value.split(":", 2).map((str) => str.trim());
|
|
4430
|
+
results[field] = property || field;
|
|
4324
4431
|
return results;
|
|
4325
4432
|
}, {});
|
|
4326
4433
|
}
|
|
@@ -4377,6 +4484,46 @@ function evaluateHostExpressionBindings(hostExpr, evaluator) {
|
|
|
4377
4484
|
}
|
|
4378
4485
|
return bindings;
|
|
4379
4486
|
}
|
|
4487
|
+
function extractHostDirectives(rawHostDirectives, evaluator) {
|
|
4488
|
+
const resolved = evaluator.evaluate(rawHostDirectives, forwardRefResolver);
|
|
4489
|
+
if (!Array.isArray(resolved)) {
|
|
4490
|
+
throw createValueHasWrongTypeError(rawHostDirectives, resolved, "hostDirectives must be an array");
|
|
4491
|
+
}
|
|
4492
|
+
return resolved.map((value) => {
|
|
4493
|
+
const hostReference = value instanceof Map ? value.get("directive") : value;
|
|
4494
|
+
if (!(hostReference instanceof Reference)) {
|
|
4495
|
+
throw createValueHasWrongTypeError(rawHostDirectives, hostReference, "Host directive must be a reference");
|
|
4496
|
+
}
|
|
4497
|
+
if (!isNamedClassDeclaration(hostReference.node)) {
|
|
4498
|
+
throw createValueHasWrongTypeError(rawHostDirectives, hostReference, "Host directive reference must be a class");
|
|
4499
|
+
}
|
|
4500
|
+
const meta = {
|
|
4501
|
+
directive: hostReference,
|
|
4502
|
+
isForwardReference: hostReference.synthetic,
|
|
4503
|
+
inputs: parseHostDirectivesMapping("inputs", value, hostReference.node, rawHostDirectives),
|
|
4504
|
+
outputs: parseHostDirectivesMapping("outputs", value, hostReference.node, rawHostDirectives)
|
|
4505
|
+
};
|
|
4506
|
+
return meta;
|
|
4507
|
+
});
|
|
4508
|
+
}
|
|
4509
|
+
function parseHostDirectivesMapping(field, resolvedValue, classReference, sourceExpression) {
|
|
4510
|
+
if (resolvedValue instanceof Map && resolvedValue.has(field)) {
|
|
4511
|
+
const nameForErrors = `@Directive.hostDirectives.${classReference.name.text}.${field}`;
|
|
4512
|
+
const rawInputs = resolvedValue.get(field);
|
|
4513
|
+
if (isStringArrayOrDie(rawInputs, nameForErrors, sourceExpression)) {
|
|
4514
|
+
return parseInputOutputMappingArray(rawInputs);
|
|
4515
|
+
}
|
|
4516
|
+
}
|
|
4517
|
+
return null;
|
|
4518
|
+
}
|
|
4519
|
+
function toHostDirectiveMetadata(hostDirective, context, refEmitter) {
|
|
4520
|
+
return {
|
|
4521
|
+
directive: toR3Reference(hostDirective.directive.node, hostDirective.directive, hostDirective.directive, context, context, refEmitter),
|
|
4522
|
+
isForwardReference: hostDirective.isForwardReference,
|
|
4523
|
+
inputs: hostDirective.inputs || null,
|
|
4524
|
+
outputs: hostDirective.outputs || null
|
|
4525
|
+
};
|
|
4526
|
+
}
|
|
4380
4527
|
|
|
4381
4528
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/symbol.mjs
|
|
4382
4529
|
var DirectiveSymbol = class extends SemanticSymbol {
|
|
@@ -4477,13 +4624,14 @@ var LIFECYCLE_HOOKS = /* @__PURE__ */ new Set([
|
|
|
4477
4624
|
"ngAfterContentChecked"
|
|
4478
4625
|
]);
|
|
4479
4626
|
var DirectiveDecoratorHandler = class {
|
|
4480
|
-
constructor(reflector, evaluator, metaRegistry, scopeRegistry, metaReader, injectableRegistry, isCore, semanticDepGraphUpdater, annotateForClosureCompiler, compileUndecoratedClassesWithAngularFeatures, perf) {
|
|
4627
|
+
constructor(reflector, evaluator, metaRegistry, scopeRegistry, metaReader, injectableRegistry, refEmitter, isCore, semanticDepGraphUpdater, annotateForClosureCompiler, compileUndecoratedClassesWithAngularFeatures, perf) {
|
|
4481
4628
|
this.reflector = reflector;
|
|
4482
4629
|
this.evaluator = evaluator;
|
|
4483
4630
|
this.metaRegistry = metaRegistry;
|
|
4484
4631
|
this.scopeRegistry = scopeRegistry;
|
|
4485
4632
|
this.metaReader = metaReader;
|
|
4486
4633
|
this.injectableRegistry = injectableRegistry;
|
|
4634
|
+
this.refEmitter = refEmitter;
|
|
4487
4635
|
this.isCore = isCore;
|
|
4488
4636
|
this.semanticDepGraphUpdater = semanticDepGraphUpdater;
|
|
4489
4637
|
this.annotateForClosureCompiler = annotateForClosureCompiler;
|
|
@@ -4510,7 +4658,7 @@ var DirectiveDecoratorHandler = class {
|
|
|
4510
4658
|
return { diagnostics: [getUndecoratedClassWithAngularFeaturesDiagnostic(node)] };
|
|
4511
4659
|
}
|
|
4512
4660
|
this.perf.eventCount(PerfEvent.AnalyzeDirective);
|
|
4513
|
-
const directiveResult = extractDirectiveMetadata(node, decorator, this.reflector, this.evaluator, this.isCore, flags, this.annotateForClosureCompiler);
|
|
4661
|
+
const directiveResult = extractDirectiveMetadata(node, decorator, this.reflector, this.evaluator, this.refEmitter, this.isCore, flags, this.annotateForClosureCompiler);
|
|
4514
4662
|
if (directiveResult === void 0) {
|
|
4515
4663
|
return {};
|
|
4516
4664
|
}
|
|
@@ -4524,6 +4672,8 @@ var DirectiveDecoratorHandler = class {
|
|
|
4524
4672
|
inputs: directiveResult.inputs,
|
|
4525
4673
|
outputs: directiveResult.outputs,
|
|
4526
4674
|
meta: analysis,
|
|
4675
|
+
hostDirectives: directiveResult.hostDirectives,
|
|
4676
|
+
rawHostDirectives: directiveResult.rawHostDirectives,
|
|
4527
4677
|
classMetadata: extractClassMetadata(node, this.reflector, this.isCore, this.annotateForClosureCompiler),
|
|
4528
4678
|
baseClass: readBaseClass(node, this.reflector, this.evaluator),
|
|
4529
4679
|
typeCheckMeta: extractDirectiveTypeCheckMeta(node, directiveResult.inputs, this.reflector),
|
|
@@ -4542,6 +4692,7 @@ var DirectiveDecoratorHandler = class {
|
|
|
4542
4692
|
const ref = new Reference(node);
|
|
4543
4693
|
this.metaRegistry.registerDirectiveMetadata({
|
|
4544
4694
|
kind: MetaKind.Directive,
|
|
4695
|
+
matchSource: MatchSource.Selector,
|
|
4545
4696
|
ref,
|
|
4546
4697
|
name: node.name.text,
|
|
4547
4698
|
selector: analysis.meta.selector,
|
|
@@ -4551,6 +4702,7 @@ var DirectiveDecoratorHandler = class {
|
|
|
4551
4702
|
queries: analysis.meta.queries.map((query) => query.propertyName),
|
|
4552
4703
|
isComponent: false,
|
|
4553
4704
|
baseClass: analysis.baseClass,
|
|
4705
|
+
hostDirectives: analysis.hostDirectives,
|
|
4554
4706
|
...analysis.typeCheckMeta,
|
|
4555
4707
|
isPoisoned: analysis.isPoisoned,
|
|
4556
4708
|
isStructural: analysis.isStructural,
|
|
@@ -4575,6 +4727,10 @@ var DirectiveDecoratorHandler = class {
|
|
|
4575
4727
|
if (directiveDiagnostics !== null) {
|
|
4576
4728
|
diagnostics.push(...directiveDiagnostics);
|
|
4577
4729
|
}
|
|
4730
|
+
const hostDirectivesDiagnotics = analysis.hostDirectives && analysis.rawHostDirectives ? validateHostDirectives(analysis.rawHostDirectives, analysis.hostDirectives, this.metaReader) : null;
|
|
4731
|
+
if (hostDirectivesDiagnotics !== null) {
|
|
4732
|
+
diagnostics.push(...hostDirectivesDiagnotics);
|
|
4733
|
+
}
|
|
4578
4734
|
return { diagnostics: diagnostics.length > 0 ? diagnostics : void 0 };
|
|
4579
4735
|
}
|
|
4580
4736
|
compileFull(node, analysis, resolution, pool) {
|
|
@@ -5616,9 +5772,9 @@ function isLikelyModuleWithProviders(value) {
|
|
|
5616
5772
|
}
|
|
5617
5773
|
|
|
5618
5774
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/handler.mjs
|
|
5619
|
-
var
|
|
5775
|
+
var EMPTY_ARRAY2 = [];
|
|
5620
5776
|
var ComponentDecoratorHandler = class {
|
|
5621
|
-
constructor(reflector, evaluator, metaRegistry, metaReader, scopeReader, dtsScopeReader, scopeRegistry, typeCheckScopeRegistry, resourceRegistry, isCore, resourceLoader, rootDirs, defaultPreserveWhitespaces, i18nUseExternalIds, enableI18nLegacyMessageIdFormat, usePoisonedData, i18nNormalizeLineEndingsInICUs, moduleResolver, cycleAnalyzer, cycleHandlingStrategy, refEmitter, depTracker, injectableRegistry, semanticDepGraphUpdater, annotateForClosureCompiler, perf) {
|
|
5777
|
+
constructor(reflector, evaluator, metaRegistry, metaReader, scopeReader, dtsScopeReader, scopeRegistry, typeCheckScopeRegistry, resourceRegistry, isCore, resourceLoader, rootDirs, defaultPreserveWhitespaces, i18nUseExternalIds, enableI18nLegacyMessageIdFormat, usePoisonedData, i18nNormalizeLineEndingsInICUs, moduleResolver, cycleAnalyzer, cycleHandlingStrategy, refEmitter, depTracker, injectableRegistry, semanticDepGraphUpdater, annotateForClosureCompiler, perf, hostDirectivesResolver) {
|
|
5622
5778
|
this.reflector = reflector;
|
|
5623
5779
|
this.evaluator = evaluator;
|
|
5624
5780
|
this.metaRegistry = metaRegistry;
|
|
@@ -5645,6 +5801,7 @@ var ComponentDecoratorHandler = class {
|
|
|
5645
5801
|
this.semanticDepGraphUpdater = semanticDepGraphUpdater;
|
|
5646
5802
|
this.annotateForClosureCompiler = annotateForClosureCompiler;
|
|
5647
5803
|
this.perf = perf;
|
|
5804
|
+
this.hostDirectivesResolver = hostDirectivesResolver;
|
|
5648
5805
|
this.literalCache = /* @__PURE__ */ new Map();
|
|
5649
5806
|
this.elementSchemaRegistry = new DomElementSchemaRegistry();
|
|
5650
5807
|
this.preanalyzeTemplateCache = /* @__PURE__ */ new Map();
|
|
@@ -5720,11 +5877,11 @@ var ComponentDecoratorHandler = class {
|
|
|
5720
5877
|
this.literalCache.delete(decorator);
|
|
5721
5878
|
let diagnostics;
|
|
5722
5879
|
let isPoisoned = false;
|
|
5723
|
-
const directiveResult = extractDirectiveMetadata(node, decorator, this.reflector, this.evaluator, this.isCore, flags, this.annotateForClosureCompiler, this.elementSchemaRegistry.getDefaultComponentElementName());
|
|
5880
|
+
const directiveResult = extractDirectiveMetadata(node, decorator, this.reflector, this.evaluator, this.refEmitter, this.isCore, flags, this.annotateForClosureCompiler, this.elementSchemaRegistry.getDefaultComponentElementName());
|
|
5724
5881
|
if (directiveResult === void 0) {
|
|
5725
5882
|
return {};
|
|
5726
5883
|
}
|
|
5727
|
-
const { decorator: component, metadata, inputs, outputs } = directiveResult;
|
|
5884
|
+
const { decorator: component, metadata, inputs, outputs, hostDirectives, rawHostDirectives } = directiveResult;
|
|
5728
5885
|
const encapsulation = (_a = resolveEnumValue(this.evaluator, component, "encapsulation", "ViewEncapsulation")) != null ? _a : ViewEncapsulation.Emulated;
|
|
5729
5886
|
const changeDetection = resolveEnumValue(this.evaluator, component, "changeDetection", "ChangeDetectionStrategy");
|
|
5730
5887
|
let animations = null;
|
|
@@ -5867,6 +6024,8 @@ var ComponentDecoratorHandler = class {
|
|
|
5867
6024
|
baseClass: readBaseClass(node, this.reflector, this.evaluator),
|
|
5868
6025
|
inputs,
|
|
5869
6026
|
outputs,
|
|
6027
|
+
hostDirectives,
|
|
6028
|
+
rawHostDirectives,
|
|
5870
6029
|
meta: {
|
|
5871
6030
|
...metadata,
|
|
5872
6031
|
template: {
|
|
@@ -5914,6 +6073,7 @@ var ComponentDecoratorHandler = class {
|
|
|
5914
6073
|
const ref = new Reference(node);
|
|
5915
6074
|
this.metaRegistry.registerDirectiveMetadata({
|
|
5916
6075
|
kind: MetaKind.Directive,
|
|
6076
|
+
matchSource: MatchSource.Selector,
|
|
5917
6077
|
ref,
|
|
5918
6078
|
name: node.name.text,
|
|
5919
6079
|
selector: analysis.meta.selector,
|
|
@@ -5923,6 +6083,7 @@ var ComponentDecoratorHandler = class {
|
|
|
5923
6083
|
queries: analysis.meta.queries.map((query) => query.propertyName),
|
|
5924
6084
|
isComponent: true,
|
|
5925
6085
|
baseClass: analysis.baseClass,
|
|
6086
|
+
hostDirectives: analysis.hostDirectives,
|
|
5926
6087
|
...analysis.typeCheckMeta,
|
|
5927
6088
|
isPoisoned: analysis.isPoisoned,
|
|
5928
6089
|
isStructural: false,
|
|
@@ -5949,7 +6110,7 @@ var ComponentDecoratorHandler = class {
|
|
|
5949
6110
|
}
|
|
5950
6111
|
for (const dep of dependencies) {
|
|
5951
6112
|
if (dep.kind === MetaKind.Directive && dep.selector !== null) {
|
|
5952
|
-
matcher.addSelectables(CssSelector2.parse(dep.selector), dep);
|
|
6113
|
+
matcher.addSelectables(CssSelector2.parse(dep.selector), [...this.hostDirectivesResolver.resolve(dep), dep]);
|
|
5953
6114
|
}
|
|
5954
6115
|
}
|
|
5955
6116
|
}
|
|
@@ -5992,7 +6153,7 @@ var ComponentDecoratorHandler = class {
|
|
|
5992
6153
|
const context = getSourceFile(node);
|
|
5993
6154
|
const metadata = analysis.meta;
|
|
5994
6155
|
const data = {
|
|
5995
|
-
declarations:
|
|
6156
|
+
declarations: EMPTY_ARRAY2,
|
|
5996
6157
|
declarationListEmitMode: 0
|
|
5997
6158
|
};
|
|
5998
6159
|
const diagnostics = [];
|
|
@@ -6003,7 +6164,7 @@ var ComponentDecoratorHandler = class {
|
|
|
6003
6164
|
const dependencies = scope.kind === ComponentScopeKind.NgModule ? scope.compilation.dependencies : scope.dependencies;
|
|
6004
6165
|
for (const dep of dependencies) {
|
|
6005
6166
|
if (dep.kind === MetaKind.Directive && dep.selector !== null) {
|
|
6006
|
-
matcher.addSelectables(CssSelector2.parse(dep.selector), dep);
|
|
6167
|
+
matcher.addSelectables(CssSelector2.parse(dep.selector), [dep]);
|
|
6007
6168
|
} else if (dep.kind === MetaKind.Pipe) {
|
|
6008
6169
|
pipes.set(dep.name, dep);
|
|
6009
6170
|
}
|
|
@@ -6029,7 +6190,7 @@ var ComponentDecoratorHandler = class {
|
|
|
6029
6190
|
seen.add(dep.ref.node);
|
|
6030
6191
|
switch (dep.kind) {
|
|
6031
6192
|
case MetaKind.Directive:
|
|
6032
|
-
if (!used.has(dep.ref.node)) {
|
|
6193
|
+
if (!used.has(dep.ref.node) || dep.matchSource !== MatchSource.Selector) {
|
|
6033
6194
|
continue;
|
|
6034
6195
|
}
|
|
6035
6196
|
const dirType = this.refEmitter.emit(dep.ref, context);
|
|
@@ -6144,6 +6305,10 @@ var ComponentDecoratorHandler = class {
|
|
|
6144
6305
|
if (directiveDiagnostics !== null) {
|
|
6145
6306
|
diagnostics.push(...directiveDiagnostics);
|
|
6146
6307
|
}
|
|
6308
|
+
const hostDirectivesDiagnotics = analysis.hostDirectives && analysis.rawHostDirectives ? validateHostDirectives(analysis.rawHostDirectives, analysis.hostDirectives, this.metaReader) : null;
|
|
6309
|
+
if (hostDirectivesDiagnotics !== null) {
|
|
6310
|
+
diagnostics.push(...hostDirectivesDiagnotics);
|
|
6311
|
+
}
|
|
6147
6312
|
if (diagnostics.length > 0) {
|
|
6148
6313
|
return { diagnostics };
|
|
6149
6314
|
}
|
|
@@ -6606,6 +6771,7 @@ export {
|
|
|
6606
6771
|
CompoundMetadataRegistry,
|
|
6607
6772
|
InjectableClassRegistry,
|
|
6608
6773
|
ResourceRegistry,
|
|
6774
|
+
HostDirectivesResolver,
|
|
6609
6775
|
ComponentScopeKind,
|
|
6610
6776
|
CompoundComponentScopeReader,
|
|
6611
6777
|
MetadataDtsModuleScopeResolver,
|
|
@@ -6625,6 +6791,13 @@ export {
|
|
|
6625
6791
|
InjectableDecoratorHandler,
|
|
6626
6792
|
PipeDecoratorHandler
|
|
6627
6793
|
};
|
|
6794
|
+
/*!
|
|
6795
|
+
* @license
|
|
6796
|
+
* Copyright Google LLC All Rights Reserved.
|
|
6797
|
+
*
|
|
6798
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6799
|
+
* found in the LICENSE file at https://angular.io/license
|
|
6800
|
+
*/
|
|
6628
6801
|
/**
|
|
6629
6802
|
* @license
|
|
6630
6803
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -6632,4 +6805,4 @@ export {
|
|
|
6632
6805
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6633
6806
|
* found in the LICENSE file at https://angular.io/license
|
|
6634
6807
|
*/
|
|
6635
|
-
//# sourceMappingURL=chunk-
|
|
6808
|
+
//# sourceMappingURL=chunk-MQGVI6KC.js.map
|