@angular/compiler-cli 15.0.0-next.5 → 15.0.0-next.6
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-YEQI6VDV.js → chunk-2LFNJ4YC.js} +45 -20
- package/bundles/chunk-2LFNJ4YC.js.map +6 -0
- package/bundles/{chunk-TF2TR2WS.js → chunk-EQ7NIVSK.js} +2 -1
- package/bundles/chunk-EQ7NIVSK.js.map +6 -0
- package/bundles/{chunk-7YHMCUJT.js → chunk-F526PAOI.js} +1 -4
- package/bundles/chunk-F526PAOI.js.map +6 -0
- package/bundles/{chunk-UZLFREET.js → chunk-GQT3DC2W.js} +3 -3
- package/bundles/{chunk-UZLFREET.js.map → chunk-GQT3DC2W.js.map} +0 -0
- package/bundles/{chunk-FHVSPC32.js → chunk-JH56H6IJ.js} +4 -4
- package/bundles/{chunk-FHVSPC32.js.map → chunk-JH56H6IJ.js.map} +0 -0
- package/bundles/{chunk-LBWAABMF.js → chunk-MYEONJ6Z.js} +3 -3
- package/bundles/{chunk-LBWAABMF.js.map → chunk-MYEONJ6Z.js.map} +0 -0
- package/bundles/{chunk-2RROWOZG.js → chunk-OZI3NCRJ.js} +10 -10
- package/bundles/{chunk-2RROWOZG.js.map → chunk-OZI3NCRJ.js.map} +1 -1
- package/bundles/{chunk-VSAO3EZ7.js → chunk-R4GD76QD.js} +957 -888
- package/bundles/chunk-R4GD76QD.js.map +6 -0
- package/bundles/{chunk-OZM4WUIW.js → chunk-XOVG7LXX.js} +2 -2
- package/bundles/{chunk-OZM4WUIW.js.map → chunk-XOVG7LXX.js.map} +0 -0
- package/bundles/{chunk-XDX5RDY5.js → chunk-ZXBCBXWY.js} +2 -2
- package/bundles/{chunk-XDX5RDY5.js.map → chunk-ZXBCBXWY.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 +4 -4
- package/src/ngtsc/annotations/common/index.d.ts +1 -0
- package/src/ngtsc/annotations/common/src/diagnostics.d.ts +11 -3
- package/src/ngtsc/annotations/common/src/injectable_registry.d.ts +25 -0
- package/src/ngtsc/annotations/common/src/util.d.ts +1 -0
- package/src/ngtsc/annotations/component/src/handler.d.ts +4 -3
- package/src/ngtsc/annotations/directive/src/handler.d.ts +4 -2
- package/src/ngtsc/annotations/ng_module/src/handler.d.ts +2 -2
- package/src/ngtsc/annotations/src/injectable.d.ts +7 -4
- package/src/ngtsc/annotations/src/pipe.d.ts +2 -1
- package/src/ngtsc/diagnostics/src/error_code.d.ts +5 -0
- package/src/ngtsc/metadata/index.d.ts +2 -2
- package/src/ngtsc/metadata/src/registry.d.ts +1 -12
- package/src/ngtsc/ts_compatibility/src/ts_cross_version_utils.d.ts +0 -9
- package/src/ngtsc/typecheck/api/checker.d.ts +5 -1
- package/src/ngtsc/typecheck/api/scope.d.ts +16 -0
- package/src/ngtsc/typecheck/src/checker.d.ts +2 -1
- package/bundles/chunk-7YHMCUJT.js.map +0 -6
- package/bundles/chunk-TF2TR2WS.js.map +0 -6
- package/bundles/chunk-VSAO3EZ7.js.map +0 -6
- package/bundles/chunk-YEQI6VDV.js.map +0 -6
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
reflectObjectLiteral,
|
|
14
14
|
reflectTypeEntityToDeclaration,
|
|
15
15
|
typeNodeToValueExpr
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-ZXBCBXWY.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-EQ7NIVSK.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-F526PAOI.js";
|
|
50
50
|
import {
|
|
51
51
|
absoluteFrom,
|
|
52
52
|
absoluteFromSourceFile,
|
|
@@ -292,6 +292,9 @@ function getOriginNodeForDiagnostics(expr, container) {
|
|
|
292
292
|
return container;
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
|
+
function isAbstractClassDeclaration(clazz) {
|
|
296
|
+
return clazz.modifiers !== void 0 && clazz.modifiers.some((mod) => mod.kind === ts.SyntaxKind.AbstractKeyword);
|
|
297
|
+
}
|
|
295
298
|
|
|
296
299
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/dynamic.mjs
|
|
297
300
|
var DynamicValue = class {
|
|
@@ -1494,7 +1497,8 @@ function createValueHasWrongTypeError(node, value, messageText) {
|
|
|
1494
1497
|
function getProviderDiagnostics(providerClasses, providersDeclaration, registry) {
|
|
1495
1498
|
const diagnostics = [];
|
|
1496
1499
|
for (const provider of providerClasses) {
|
|
1497
|
-
|
|
1500
|
+
const injectableMeta = registry.getInjectableMeta(provider.node);
|
|
1501
|
+
if (injectableMeta !== null) {
|
|
1498
1502
|
continue;
|
|
1499
1503
|
}
|
|
1500
1504
|
const contextNode = provider.getOriginForDiagnostics(providersDeclaration);
|
|
@@ -1505,7 +1509,7 @@ Either add the @Injectable() decorator to '${provider.node.name.text}', or confi
|
|
|
1505
1509
|
}
|
|
1506
1510
|
return diagnostics;
|
|
1507
1511
|
}
|
|
1508
|
-
function getDirectiveDiagnostics(node,
|
|
1512
|
+
function getDirectiveDiagnostics(node, injectableRegistry, evaluator, reflector, scopeRegistry, strictInjectionParameters, kind) {
|
|
1509
1513
|
let diagnostics = [];
|
|
1510
1514
|
const addDiagnostics = (more) => {
|
|
1511
1515
|
if (more === null) {
|
|
@@ -1522,7 +1526,7 @@ function getDirectiveDiagnostics(node, reader, evaluator, reflector, scopeRegist
|
|
|
1522
1526
|
if (duplicateDeclarations !== null) {
|
|
1523
1527
|
addDiagnostics(makeDuplicateDeclarationError(node, duplicateDeclarations, kind));
|
|
1524
1528
|
}
|
|
1525
|
-
addDiagnostics(
|
|
1529
|
+
addDiagnostics(checkInheritanceOfInjectable(node, injectableRegistry, reflector, evaluator, strictInjectionParameters, kind));
|
|
1526
1530
|
return diagnostics;
|
|
1527
1531
|
}
|
|
1528
1532
|
function validateHostDirectives(origin, hostDirectives, metaReader) {
|
|
@@ -1545,7 +1549,20 @@ function validateHostDirectives(origin, hostDirectives, metaReader) {
|
|
|
1545
1549
|
function getUndecoratedClassWithAngularFeaturesDiagnostic(node) {
|
|
1546
1550
|
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.`);
|
|
1547
1551
|
}
|
|
1548
|
-
function
|
|
1552
|
+
function checkInheritanceOfInjectable(node, injectableRegistry, reflector, evaluator, strictInjectionParameters, kind) {
|
|
1553
|
+
const classWithCtor = findInheritedCtor(node, injectableRegistry, reflector, evaluator);
|
|
1554
|
+
if (classWithCtor === null || classWithCtor.isCtorValid) {
|
|
1555
|
+
return null;
|
|
1556
|
+
}
|
|
1557
|
+
if (!classWithCtor.isDecorated) {
|
|
1558
|
+
return getInheritedUndecoratedCtorDiagnostic(node, classWithCtor.ref, kind);
|
|
1559
|
+
}
|
|
1560
|
+
if (!strictInjectionParameters || isAbstractClassDeclaration(node)) {
|
|
1561
|
+
return null;
|
|
1562
|
+
}
|
|
1563
|
+
return getInheritedInvalidCtorDiagnostic(node, classWithCtor.ref, kind);
|
|
1564
|
+
}
|
|
1565
|
+
function findInheritedCtor(node, injectableRegistry, reflector, evaluator) {
|
|
1549
1566
|
if (!reflector.isClass(node) || reflector.getConstructorParameters(node) !== null) {
|
|
1550
1567
|
return null;
|
|
1551
1568
|
}
|
|
@@ -1554,26 +1571,37 @@ function checkInheritanceOfDirective(node, reader, reflector, evaluator) {
|
|
|
1554
1571
|
if (baseClass === "dynamic") {
|
|
1555
1572
|
return null;
|
|
1556
1573
|
}
|
|
1557
|
-
const
|
|
1558
|
-
if (
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1574
|
+
const injectableMeta = injectableRegistry.getInjectableMeta(baseClass.node);
|
|
1575
|
+
if (injectableMeta !== null) {
|
|
1576
|
+
if (injectableMeta.ctorDeps !== null) {
|
|
1577
|
+
return {
|
|
1578
|
+
ref: baseClass,
|
|
1579
|
+
isCtorValid: injectableMeta.ctorDeps !== "invalid",
|
|
1580
|
+
isDecorated: true
|
|
1581
|
+
};
|
|
1582
|
+
}
|
|
1583
|
+
} else {
|
|
1584
|
+
const baseClassConstructorParams = reflector.getConstructorParameters(baseClass.node);
|
|
1585
|
+
if (baseClassConstructorParams !== null) {
|
|
1586
|
+
return {
|
|
1587
|
+
ref: baseClass,
|
|
1588
|
+
isCtorValid: baseClassConstructorParams.length === 0,
|
|
1589
|
+
isDecorated: false
|
|
1590
|
+
};
|
|
1591
|
+
}
|
|
1567
1592
|
}
|
|
1568
|
-
baseClass =
|
|
1593
|
+
baseClass = readBaseClass(baseClass.node, reflector, evaluator);
|
|
1569
1594
|
}
|
|
1570
1595
|
return null;
|
|
1571
1596
|
}
|
|
1572
|
-
function
|
|
1573
|
-
const
|
|
1574
|
-
|
|
1597
|
+
function getInheritedInvalidCtorDiagnostic(node, baseClass, kind) {
|
|
1598
|
+
const baseClassName = baseClass.debugName;
|
|
1599
|
+
return makeDiagnostic(ErrorCode.INJECTABLE_INHERITS_INVALID_CONSTRUCTOR, node.name, `The ${kind.toLowerCase()} ${node.name.text} inherits its constructor from ${baseClassName}, but the latter has a constructor parameter that is not compatible with dependency injection. Either add an explicit constructor to ${node.name.text} or change ${baseClassName}'s constructor to use parameters that are valid for DI.`);
|
|
1600
|
+
}
|
|
1601
|
+
function getInheritedUndecoratedCtorDiagnostic(node, baseClass, kind) {
|
|
1575
1602
|
const baseClassName = baseClass.debugName;
|
|
1576
|
-
|
|
1603
|
+
const baseNeedsDecorator = kind === "Component" || kind === "Directive" ? "Directive" : "Injectable";
|
|
1604
|
+
return makeDiagnostic(ErrorCode.DIRECTIVE_INHERITS_UNDECORATED_CTOR, node.name, `The ${kind.toLowerCase()} ${node.name.text} inherits its constructor from ${baseClassName}, but the latter does not have an Angular decorator of its own. Dependency injection will not be able to resolve the parameters of ${baseClassName}'s constructor. Either add a @${baseNeedsDecorator} decorator to ${baseClassName}, or add an explicit constructor to ${node.name.text}.`);
|
|
1577
1605
|
}
|
|
1578
1606
|
|
|
1579
1607
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/evaluation.mjs
|
|
@@ -1620,1013 +1648,1027 @@ function compileDeclareFactory(metadata) {
|
|
|
1620
1648
|
return { name: "\u0275fac", initializer: res.expression, statements: res.statements, type: res.type };
|
|
1621
1649
|
}
|
|
1622
1650
|
|
|
1623
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1651
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/api.mjs
|
|
1652
|
+
var MetaKind;
|
|
1653
|
+
(function(MetaKind2) {
|
|
1654
|
+
MetaKind2[MetaKind2["Directive"] = 0] = "Directive";
|
|
1655
|
+
MetaKind2[MetaKind2["Pipe"] = 1] = "Pipe";
|
|
1656
|
+
MetaKind2[MetaKind2["NgModule"] = 2] = "NgModule";
|
|
1657
|
+
})(MetaKind || (MetaKind = {}));
|
|
1658
|
+
var MatchSource;
|
|
1659
|
+
(function(MatchSource2) {
|
|
1660
|
+
MatchSource2[MatchSource2["Selector"] = 0] = "Selector";
|
|
1661
|
+
MatchSource2[MatchSource2["HostDirective"] = 1] = "HostDirective";
|
|
1662
|
+
})(MatchSource || (MatchSource = {}));
|
|
1663
|
+
|
|
1664
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/dts.mjs
|
|
1665
|
+
import ts8 from "typescript";
|
|
1666
|
+
|
|
1667
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/property_mapping.mjs
|
|
1668
|
+
var ClassPropertyMapping = class {
|
|
1669
|
+
constructor(forwardMap) {
|
|
1670
|
+
this.forwardMap = forwardMap;
|
|
1671
|
+
this.reverseMap = reverseMapFromForwardMap(forwardMap);
|
|
1634
1672
|
}
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
return null;
|
|
1673
|
+
static empty() {
|
|
1674
|
+
return new ClassPropertyMapping(/* @__PURE__ */ new Map());
|
|
1638
1675
|
}
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1676
|
+
static fromMappedObject(obj) {
|
|
1677
|
+
const forwardMap = /* @__PURE__ */ new Map();
|
|
1678
|
+
for (const classPropertyName of Object.keys(obj)) {
|
|
1679
|
+
const value = obj[classPropertyName];
|
|
1680
|
+
const bindingPropertyName = Array.isArray(value) ? value[0] : value;
|
|
1681
|
+
const inputOrOutput = { classPropertyName, bindingPropertyName };
|
|
1682
|
+
forwardMap.set(classPropertyName, inputOrOutput);
|
|
1683
|
+
}
|
|
1684
|
+
return new ClassPropertyMapping(forwardMap);
|
|
1647
1685
|
}
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1686
|
+
static merge(a, b) {
|
|
1687
|
+
const forwardMap = new Map(a.forwardMap.entries());
|
|
1688
|
+
for (const [classPropertyName, inputOrOutput] of b.forwardMap) {
|
|
1689
|
+
forwardMap.set(classPropertyName, inputOrOutput);
|
|
1690
|
+
}
|
|
1691
|
+
return new ClassPropertyMapping(forwardMap);
|
|
1653
1692
|
}
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
return classMemberToMetadata((_a = member.nameNode) != null ? _a : member.name, member.decorators, isCore);
|
|
1657
|
-
});
|
|
1658
|
-
if (decoratedMembers.length > 0) {
|
|
1659
|
-
metaPropDecorators = new WrappedNodeExpr3(ts7.factory.createObjectLiteralExpression(decoratedMembers));
|
|
1693
|
+
get classPropertyNames() {
|
|
1694
|
+
return Array.from(this.forwardMap.keys());
|
|
1660
1695
|
}
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
decorators: metaDecorators,
|
|
1664
|
-
ctorParameters: metaCtorParameters,
|
|
1665
|
-
propDecorators: metaPropDecorators
|
|
1666
|
-
};
|
|
1667
|
-
}
|
|
1668
|
-
function ctorParameterToMetadata(param, isCore) {
|
|
1669
|
-
const type = param.typeValueReference.kind !== 2 ? valueReferenceToExpression(param.typeValueReference) : new LiteralExpr2(void 0);
|
|
1670
|
-
const mapEntries = [
|
|
1671
|
-
{ key: "type", value: type, quoted: false }
|
|
1672
|
-
];
|
|
1673
|
-
if (param.decorators !== null) {
|
|
1674
|
-
const ngDecorators = param.decorators.filter((dec) => isAngularDecorator2(dec, isCore)).map((decorator) => decoratorToMetadata(decorator));
|
|
1675
|
-
const value = new WrappedNodeExpr3(ts7.factory.createArrayLiteralExpression(ngDecorators));
|
|
1676
|
-
mapEntries.push({ key: "decorators", value, quoted: false });
|
|
1696
|
+
get propertyNames() {
|
|
1697
|
+
return Array.from(this.reverseMap.keys());
|
|
1677
1698
|
}
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
function classMemberToMetadata(name, decorators, isCore) {
|
|
1681
|
-
const ngDecorators = decorators.filter((dec) => isAngularDecorator2(dec, isCore)).map((decorator) => decoratorToMetadata(decorator));
|
|
1682
|
-
const decoratorMeta = ts7.factory.createArrayLiteralExpression(ngDecorators);
|
|
1683
|
-
return ts7.factory.createPropertyAssignment(name, decoratorMeta);
|
|
1684
|
-
}
|
|
1685
|
-
function decoratorToMetadata(decorator, wrapFunctionsInParens) {
|
|
1686
|
-
if (decorator.identifier === null) {
|
|
1687
|
-
throw new Error("Illegal state: synthesized decorator cannot be emitted in class metadata.");
|
|
1699
|
+
hasBindingPropertyName(propertyName) {
|
|
1700
|
+
return this.reverseMap.has(propertyName);
|
|
1688
1701
|
}
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
];
|
|
1692
|
-
if (decorator.args !== null && decorator.args.length > 0) {
|
|
1693
|
-
const args = decorator.args.map((arg) => {
|
|
1694
|
-
return wrapFunctionsInParens ? wrapFunctionExpressionsInParens(arg) : arg;
|
|
1695
|
-
});
|
|
1696
|
-
properties.push(ts7.factory.createPropertyAssignment("args", ts7.factory.createArrayLiteralExpression(args)));
|
|
1702
|
+
getByBindingPropertyName(propertyName) {
|
|
1703
|
+
return this.reverseMap.has(propertyName) ? this.reverseMap.get(propertyName) : null;
|
|
1697
1704
|
}
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
function isAngularDecorator2(decorator, isCore) {
|
|
1701
|
-
return isCore || decorator.import !== null && decorator.import.from === "@angular/core";
|
|
1702
|
-
}
|
|
1703
|
-
function removeIdentifierReferences(node, name) {
|
|
1704
|
-
const result = ts7.transform(node, [(context) => (root) => ts7.visitNode(root, function walk(current) {
|
|
1705
|
-
return ts7.isIdentifier(current) && current.text === name ? ts7.factory.createIdentifier(current.text) : ts7.visitEachChild(current, walk, context);
|
|
1706
|
-
})]);
|
|
1707
|
-
return result.transformed[0];
|
|
1708
|
-
}
|
|
1709
|
-
|
|
1710
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/references_registry.mjs
|
|
1711
|
-
var NoopReferencesRegistry = class {
|
|
1712
|
-
add(source, ...references) {
|
|
1705
|
+
getByClassPropertyName(classPropertyName) {
|
|
1706
|
+
return this.forwardMap.has(classPropertyName) ? this.forwardMap.get(classPropertyName) : null;
|
|
1713
1707
|
}
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
const result = evaluator.evaluate(rawExpr);
|
|
1721
|
-
if (!Array.isArray(result)) {
|
|
1722
|
-
throw createValueHasWrongTypeError(rawExpr, result, `${context}.schemas must be an array`);
|
|
1708
|
+
toDirectMappedObject() {
|
|
1709
|
+
const obj = {};
|
|
1710
|
+
for (const [classPropertyName, inputOrOutput] of this.forwardMap) {
|
|
1711
|
+
obj[classPropertyName] = inputOrOutput.bindingPropertyName;
|
|
1712
|
+
}
|
|
1713
|
+
return obj;
|
|
1723
1714
|
}
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1715
|
+
toJointMappedObject() {
|
|
1716
|
+
const obj = {};
|
|
1717
|
+
for (const [classPropertyName, inputOrOutput] of this.forwardMap) {
|
|
1718
|
+
if (inputOrOutput.bindingPropertyName === classPropertyName) {
|
|
1719
|
+
obj[classPropertyName] = inputOrOutput.bindingPropertyName;
|
|
1720
|
+
} else {
|
|
1721
|
+
obj[classPropertyName] = [inputOrOutput.bindingPropertyName, classPropertyName];
|
|
1722
|
+
}
|
|
1727
1723
|
}
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1724
|
+
return obj;
|
|
1725
|
+
}
|
|
1726
|
+
*[Symbol.iterator]() {
|
|
1727
|
+
for (const [classPropertyName, inputOrOutput] of this.forwardMap.entries()) {
|
|
1728
|
+
yield [classPropertyName, inputOrOutput.bindingPropertyName];
|
|
1731
1729
|
}
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
default:
|
|
1740
|
-
throw createValueHasWrongTypeError(rawExpr, schemaRef, `'${schemaRef.debugName}' is not a valid ${context} schema`);
|
|
1730
|
+
}
|
|
1731
|
+
};
|
|
1732
|
+
function reverseMapFromForwardMap(forwardMap) {
|
|
1733
|
+
const reverseMap = /* @__PURE__ */ new Map();
|
|
1734
|
+
for (const [_, inputOrOutput] of forwardMap) {
|
|
1735
|
+
if (!reverseMap.has(inputOrOutput.bindingPropertyName)) {
|
|
1736
|
+
reverseMap.set(inputOrOutput.bindingPropertyName, []);
|
|
1741
1737
|
}
|
|
1738
|
+
reverseMap.get(inputOrOutput.bindingPropertyName).push(inputOrOutput);
|
|
1742
1739
|
}
|
|
1743
|
-
return
|
|
1740
|
+
return reverseMap;
|
|
1744
1741
|
}
|
|
1745
1742
|
|
|
1746
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/
|
|
1747
|
-
import
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
import ts8 from "typescript";
|
|
1752
|
-
var SemanticSymbol = class {
|
|
1753
|
-
constructor(decl) {
|
|
1754
|
-
this.decl = decl;
|
|
1755
|
-
this.path = absoluteFromSourceFile(decl.getSourceFile());
|
|
1756
|
-
this.identifier = getSymbolIdentifier(decl);
|
|
1757
|
-
}
|
|
1758
|
-
};
|
|
1759
|
-
function getSymbolIdentifier(decl) {
|
|
1760
|
-
if (!ts8.isSourceFile(decl.parent)) {
|
|
1761
|
-
return null;
|
|
1743
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/util.mjs
|
|
1744
|
+
import ts7 from "typescript";
|
|
1745
|
+
function extractReferencesFromType(checker, def, bestGuessOwningModule) {
|
|
1746
|
+
if (!ts7.isTupleTypeNode(def)) {
|
|
1747
|
+
return [];
|
|
1762
1748
|
}
|
|
1763
|
-
return
|
|
1749
|
+
return def.elements.map((element) => {
|
|
1750
|
+
if (!ts7.isTypeQueryNode(element)) {
|
|
1751
|
+
throw new Error(`Expected TypeQueryNode: ${nodeDebugInfo(element)}`);
|
|
1752
|
+
}
|
|
1753
|
+
return extraReferenceFromTypeQuery(checker, element, def, bestGuessOwningModule);
|
|
1754
|
+
});
|
|
1764
1755
|
}
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
return false;
|
|
1756
|
+
function extraReferenceFromTypeQuery(checker, typeNode, origin, bestGuessOwningModule) {
|
|
1757
|
+
const type = typeNode.exprName;
|
|
1758
|
+
const { node, from } = reflectTypeEntityToDeclaration(type, checker);
|
|
1759
|
+
if (!isNamedClassDeclaration(node)) {
|
|
1760
|
+
throw new Error(`Expected named ClassDeclaration: ${nodeDebugInfo(node)}`);
|
|
1771
1761
|
}
|
|
1772
|
-
|
|
1773
|
-
return
|
|
1762
|
+
if (from !== null && !from.startsWith(".")) {
|
|
1763
|
+
return new Reference(node, { specifier: from, resolutionContext: origin.getSourceFile().fileName });
|
|
1774
1764
|
}
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1765
|
+
return new Reference(node, bestGuessOwningModule);
|
|
1766
|
+
}
|
|
1767
|
+
function readBooleanType(type) {
|
|
1768
|
+
if (!ts7.isLiteralTypeNode(type)) {
|
|
1769
|
+
return null;
|
|
1780
1770
|
}
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
}
|
|
1771
|
+
switch (type.literal.kind) {
|
|
1772
|
+
case ts7.SyntaxKind.TrueKeyword:
|
|
1773
|
+
return true;
|
|
1774
|
+
case ts7.SyntaxKind.FalseKeyword:
|
|
1775
|
+
return false;
|
|
1776
|
+
default:
|
|
1777
|
+
return null;
|
|
1789
1778
|
}
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
}
|
|
1795
|
-
return previousSymbol;
|
|
1779
|
+
}
|
|
1780
|
+
function readStringType(type) {
|
|
1781
|
+
if (!ts7.isLiteralTypeNode(type) || !ts7.isStringLiteral(type.literal)) {
|
|
1782
|
+
return null;
|
|
1796
1783
|
}
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
if (!file.has(identifier)) {
|
|
1803
|
-
return null;
|
|
1804
|
-
}
|
|
1805
|
-
return file.get(identifier);
|
|
1784
|
+
return type.literal.text;
|
|
1785
|
+
}
|
|
1786
|
+
function readMapType(type, valueTransform) {
|
|
1787
|
+
if (!ts7.isTypeLiteralNode(type)) {
|
|
1788
|
+
return {};
|
|
1806
1789
|
}
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1790
|
+
const obj = {};
|
|
1791
|
+
type.members.forEach((member) => {
|
|
1792
|
+
if (!ts7.isPropertySignature(member) || member.type === void 0 || member.name === void 0 || !ts7.isStringLiteral(member.name) && !ts7.isIdentifier(member.name)) {
|
|
1793
|
+
return;
|
|
1810
1794
|
}
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
var SemanticDepGraphUpdater = class {
|
|
1815
|
-
constructor(priorGraph) {
|
|
1816
|
-
this.priorGraph = priorGraph;
|
|
1817
|
-
this.newGraph = new SemanticDepGraph();
|
|
1818
|
-
this.opaqueSymbols = /* @__PURE__ */ new Map();
|
|
1819
|
-
}
|
|
1820
|
-
registerSymbol(symbol) {
|
|
1821
|
-
this.newGraph.registerSymbol(symbol);
|
|
1822
|
-
}
|
|
1823
|
-
finalize() {
|
|
1824
|
-
if (this.priorGraph === null) {
|
|
1825
|
-
return {
|
|
1826
|
-
needsEmit: /* @__PURE__ */ new Set(),
|
|
1827
|
-
needsTypeCheckEmit: /* @__PURE__ */ new Set(),
|
|
1828
|
-
newGraph: this.newGraph
|
|
1829
|
-
};
|
|
1795
|
+
const value = valueTransform(member.type);
|
|
1796
|
+
if (value === null) {
|
|
1797
|
+
return null;
|
|
1830
1798
|
}
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1799
|
+
obj[member.name.text] = value;
|
|
1800
|
+
});
|
|
1801
|
+
return obj;
|
|
1802
|
+
}
|
|
1803
|
+
function readStringArrayType(type) {
|
|
1804
|
+
if (!ts7.isTupleTypeNode(type)) {
|
|
1805
|
+
return [];
|
|
1838
1806
|
}
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
if (previousSymbol === null || symbol.isPublicApiAffected(previousSymbol)) {
|
|
1844
|
-
isPublicApiAffected.add(symbol);
|
|
1845
|
-
}
|
|
1807
|
+
const res = [];
|
|
1808
|
+
type.elements.forEach((el) => {
|
|
1809
|
+
if (!ts7.isLiteralTypeNode(el) || !ts7.isStringLiteral(el.literal)) {
|
|
1810
|
+
return;
|
|
1846
1811
|
}
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1812
|
+
res.push(el.literal.text);
|
|
1813
|
+
});
|
|
1814
|
+
return res;
|
|
1815
|
+
}
|
|
1816
|
+
function extractDirectiveTypeCheckMeta(node, inputs, reflector) {
|
|
1817
|
+
const members = reflector.getMembersOfClass(node);
|
|
1818
|
+
const staticMembers = members.filter((member) => member.isStatic);
|
|
1819
|
+
const ngTemplateGuards = staticMembers.map(extractTemplateGuard).filter((guard) => guard !== null);
|
|
1820
|
+
const hasNgTemplateContextGuard = staticMembers.some((member) => member.kind === ClassMemberKind.Method && member.name === "ngTemplateContextGuard");
|
|
1821
|
+
const coercedInputFields = new Set(staticMembers.map(extractCoercedInput).filter((inputName) => inputName !== null));
|
|
1822
|
+
const restrictedInputFields = /* @__PURE__ */ new Set();
|
|
1823
|
+
const stringLiteralInputFields = /* @__PURE__ */ new Set();
|
|
1824
|
+
const undeclaredInputFields = /* @__PURE__ */ new Set();
|
|
1825
|
+
for (const classPropertyName of inputs.classPropertyNames) {
|
|
1826
|
+
const field = members.find((member) => member.name === classPropertyName);
|
|
1827
|
+
if (field === void 0 || field.node === null) {
|
|
1828
|
+
undeclaredInputFields.add(classPropertyName);
|
|
1829
|
+
continue;
|
|
1856
1830
|
}
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
determineInvalidatedTypeCheckFiles(priorGraph) {
|
|
1860
|
-
const isTypeCheckApiAffected = /* @__PURE__ */ new Set();
|
|
1861
|
-
for (const symbol of this.newGraph.symbolByDecl.values()) {
|
|
1862
|
-
const previousSymbol = priorGraph.getEquivalentSymbol(symbol);
|
|
1863
|
-
if (previousSymbol === null || symbol.isTypeCheckApiAffected(previousSymbol)) {
|
|
1864
|
-
isTypeCheckApiAffected.add(symbol);
|
|
1865
|
-
}
|
|
1831
|
+
if (isRestricted(field.node)) {
|
|
1832
|
+
restrictedInputFields.add(classPropertyName);
|
|
1866
1833
|
}
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
if (symbol.isTypeCheckBlockAffected === void 0) {
|
|
1870
|
-
continue;
|
|
1871
|
-
}
|
|
1872
|
-
const previousSymbol = priorGraph.getEquivalentSymbol(symbol);
|
|
1873
|
-
if (previousSymbol === null || symbol.isTypeCheckBlockAffected(previousSymbol, isTypeCheckApiAffected)) {
|
|
1874
|
-
needsTypeCheckEmit.add(symbol.path);
|
|
1875
|
-
}
|
|
1834
|
+
if (field.nameNode !== null && ts7.isStringLiteral(field.nameNode)) {
|
|
1835
|
+
stringLiteralInputFields.add(classPropertyName);
|
|
1876
1836
|
}
|
|
1877
|
-
return needsTypeCheckEmit;
|
|
1878
1837
|
}
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1838
|
+
const arity = reflector.getGenericArityOfClass(node);
|
|
1839
|
+
return {
|
|
1840
|
+
hasNgTemplateContextGuard,
|
|
1841
|
+
ngTemplateGuards,
|
|
1842
|
+
coercedInputFields,
|
|
1843
|
+
restrictedInputFields,
|
|
1844
|
+
stringLiteralInputFields,
|
|
1845
|
+
undeclaredInputFields,
|
|
1846
|
+
isGeneric: arity !== null && arity > 0
|
|
1847
|
+
};
|
|
1848
|
+
}
|
|
1849
|
+
function isRestricted(node) {
|
|
1850
|
+
const modifiers = getModifiers(node);
|
|
1851
|
+
return modifiers !== void 0 && modifiers.some(({ kind }) => {
|
|
1852
|
+
return kind === ts7.SyntaxKind.PrivateKeyword || kind === ts7.SyntaxKind.ProtectedKeyword || kind === ts7.SyntaxKind.ReadonlyKeyword;
|
|
1853
|
+
});
|
|
1854
|
+
}
|
|
1855
|
+
function extractTemplateGuard(member) {
|
|
1856
|
+
if (!member.name.startsWith("ngTemplateGuard_")) {
|
|
1857
|
+
return null;
|
|
1884
1858
|
}
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1859
|
+
const inputName = afterUnderscore(member.name);
|
|
1860
|
+
if (member.kind === ClassMemberKind.Property) {
|
|
1861
|
+
let type = null;
|
|
1862
|
+
if (member.type !== null && ts7.isLiteralTypeNode(member.type) && ts7.isStringLiteral(member.type.literal)) {
|
|
1863
|
+
type = member.type.literal.text;
|
|
1889
1864
|
}
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
getOpaqueSymbol(decl) {
|
|
1893
|
-
if (this.opaqueSymbols.has(decl)) {
|
|
1894
|
-
return this.opaqueSymbols.get(decl);
|
|
1865
|
+
if (type !== "binding") {
|
|
1866
|
+
return null;
|
|
1895
1867
|
}
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
return
|
|
1899
|
-
}
|
|
1900
|
-
};
|
|
1901
|
-
function getImportPath(expr) {
|
|
1902
|
-
if (expr instanceof ExternalExpr2) {
|
|
1903
|
-
return `${expr.value.moduleName}$${expr.value.name}`;
|
|
1868
|
+
return { inputName, type };
|
|
1869
|
+
} else if (member.kind === ClassMemberKind.Method) {
|
|
1870
|
+
return { inputName, type: "invocation" };
|
|
1904
1871
|
} else {
|
|
1905
1872
|
return null;
|
|
1906
1873
|
}
|
|
1907
1874
|
}
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/semantic_graph/src/util.mjs
|
|
1913
|
-
function isSymbolEqual(a, b) {
|
|
1914
|
-
if (a.decl === b.decl) {
|
|
1915
|
-
return true;
|
|
1916
|
-
}
|
|
1917
|
-
if (a.identifier === null || b.identifier === null) {
|
|
1918
|
-
return false;
|
|
1919
|
-
}
|
|
1920
|
-
return a.path === b.path && a.identifier === b.identifier;
|
|
1921
|
-
}
|
|
1922
|
-
function isReferenceEqual(a, b) {
|
|
1923
|
-
if (!isSymbolEqual(a.symbol, b.symbol)) {
|
|
1924
|
-
return false;
|
|
1925
|
-
}
|
|
1926
|
-
return a.importPath === b.importPath;
|
|
1927
|
-
}
|
|
1928
|
-
function referenceEquality(a, b) {
|
|
1929
|
-
return a === b;
|
|
1930
|
-
}
|
|
1931
|
-
function isArrayEqual(a, b, equalityTester = referenceEquality) {
|
|
1932
|
-
if (a === null || b === null) {
|
|
1933
|
-
return a === b;
|
|
1934
|
-
}
|
|
1935
|
-
if (a.length !== b.length) {
|
|
1936
|
-
return false;
|
|
1875
|
+
function extractCoercedInput(member) {
|
|
1876
|
+
if (member.kind !== ClassMemberKind.Property || !member.name.startsWith("ngAcceptInputType_")) {
|
|
1877
|
+
return null;
|
|
1937
1878
|
}
|
|
1938
|
-
return
|
|
1879
|
+
return afterUnderscore(member.name);
|
|
1939
1880
|
}
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
}
|
|
1944
|
-
if (a.size !== b.size) {
|
|
1945
|
-
return false;
|
|
1881
|
+
var CompoundMetadataReader = class {
|
|
1882
|
+
constructor(readers) {
|
|
1883
|
+
this.readers = readers;
|
|
1946
1884
|
}
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
if (
|
|
1951
|
-
|
|
1952
|
-
break;
|
|
1885
|
+
getDirectiveMetadata(node) {
|
|
1886
|
+
for (const reader of this.readers) {
|
|
1887
|
+
const meta = reader.getDirectiveMetadata(node);
|
|
1888
|
+
if (meta !== null) {
|
|
1889
|
+
return meta;
|
|
1953
1890
|
}
|
|
1954
1891
|
}
|
|
1955
|
-
|
|
1956
|
-
|
|
1892
|
+
return null;
|
|
1893
|
+
}
|
|
1894
|
+
getNgModuleMetadata(node) {
|
|
1895
|
+
for (const reader of this.readers) {
|
|
1896
|
+
const meta = reader.getNgModuleMetadata(node);
|
|
1897
|
+
if (meta !== null) {
|
|
1898
|
+
return meta;
|
|
1899
|
+
}
|
|
1957
1900
|
}
|
|
1901
|
+
return null;
|
|
1958
1902
|
}
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1903
|
+
getPipeMetadata(node) {
|
|
1904
|
+
for (const reader of this.readers) {
|
|
1905
|
+
const meta = reader.getPipeMetadata(node);
|
|
1906
|
+
if (meta !== null) {
|
|
1907
|
+
return meta;
|
|
1908
|
+
}
|
|
1909
|
+
}
|
|
1965
1910
|
return null;
|
|
1966
1911
|
}
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
if (
|
|
1971
|
-
|
|
1912
|
+
};
|
|
1913
|
+
function afterUnderscore(str) {
|
|
1914
|
+
const pos = str.indexOf("_");
|
|
1915
|
+
if (pos === -1) {
|
|
1916
|
+
throw new Error(`Expected '${str}' to contain '_'`);
|
|
1972
1917
|
}
|
|
1973
|
-
|
|
1974
|
-
return false;
|
|
1975
|
-
}
|
|
1976
|
-
return true;
|
|
1918
|
+
return str.slice(pos + 1);
|
|
1977
1919
|
}
|
|
1978
|
-
function
|
|
1979
|
-
|
|
1920
|
+
function hasInjectableFields(clazz, host) {
|
|
1921
|
+
const members = host.getMembersOfClass(clazz);
|
|
1922
|
+
return members.some(({ isStatic, name }) => isStatic && (name === "\u0275prov" || name === "\u0275fac"));
|
|
1980
1923
|
}
|
|
1981
1924
|
|
|
1982
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/api.mjs
|
|
1983
|
-
var MetaKind;
|
|
1984
|
-
(function(MetaKind2) {
|
|
1985
|
-
MetaKind2[MetaKind2["Directive"] = 0] = "Directive";
|
|
1986
|
-
MetaKind2[MetaKind2["Pipe"] = 1] = "Pipe";
|
|
1987
|
-
MetaKind2[MetaKind2["NgModule"] = 2] = "NgModule";
|
|
1988
|
-
})(MetaKind || (MetaKind = {}));
|
|
1989
|
-
var MatchSource;
|
|
1990
|
-
(function(MatchSource2) {
|
|
1991
|
-
MatchSource2[MatchSource2["Selector"] = 0] = "Selector";
|
|
1992
|
-
MatchSource2[MatchSource2["HostDirective"] = 1] = "HostDirective";
|
|
1993
|
-
})(MatchSource || (MatchSource = {}));
|
|
1994
|
-
|
|
1995
1925
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/dts.mjs
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
constructor(forwardMap) {
|
|
2001
|
-
this.forwardMap = forwardMap;
|
|
2002
|
-
this.reverseMap = reverseMapFromForwardMap(forwardMap);
|
|
1926
|
+
var DtsMetadataReader = class {
|
|
1927
|
+
constructor(checker, reflector) {
|
|
1928
|
+
this.checker = checker;
|
|
1929
|
+
this.reflector = reflector;
|
|
2003
1930
|
}
|
|
2004
|
-
|
|
2005
|
-
|
|
1931
|
+
getNgModuleMetadata(ref) {
|
|
1932
|
+
const clazz = ref.node;
|
|
1933
|
+
const ngModuleDef = this.reflector.getMembersOfClass(clazz).find((member) => member.name === "\u0275mod" && member.isStatic);
|
|
1934
|
+
if (ngModuleDef === void 0) {
|
|
1935
|
+
return null;
|
|
1936
|
+
} else if (ngModuleDef.type === null || !ts8.isTypeReferenceNode(ngModuleDef.type) || ngModuleDef.type.typeArguments === void 0 || ngModuleDef.type.typeArguments.length !== 4) {
|
|
1937
|
+
return null;
|
|
1938
|
+
}
|
|
1939
|
+
const [_, declarationMetadata, importMetadata, exportMetadata] = ngModuleDef.type.typeArguments;
|
|
1940
|
+
return {
|
|
1941
|
+
kind: MetaKind.NgModule,
|
|
1942
|
+
ref,
|
|
1943
|
+
declarations: extractReferencesFromType(this.checker, declarationMetadata, ref.bestGuessOwningModule),
|
|
1944
|
+
exports: extractReferencesFromType(this.checker, exportMetadata, ref.bestGuessOwningModule),
|
|
1945
|
+
imports: extractReferencesFromType(this.checker, importMetadata, ref.bestGuessOwningModule),
|
|
1946
|
+
schemas: [],
|
|
1947
|
+
rawDeclarations: null,
|
|
1948
|
+
rawImports: null,
|
|
1949
|
+
rawExports: null,
|
|
1950
|
+
decorator: null
|
|
1951
|
+
};
|
|
2006
1952
|
}
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
1953
|
+
getDirectiveMetadata(ref) {
|
|
1954
|
+
var _a;
|
|
1955
|
+
const clazz = ref.node;
|
|
1956
|
+
const def = this.reflector.getMembersOfClass(clazz).find((field) => field.isStatic && (field.name === "\u0275cmp" || field.name === "\u0275dir"));
|
|
1957
|
+
if (def === void 0) {
|
|
1958
|
+
return null;
|
|
1959
|
+
} else if (def.type === null || !ts8.isTypeReferenceNode(def.type) || def.type.typeArguments === void 0 || def.type.typeArguments.length < 2) {
|
|
1960
|
+
return null;
|
|
2014
1961
|
}
|
|
2015
|
-
|
|
1962
|
+
const isComponent = def.name === "\u0275cmp";
|
|
1963
|
+
const ctorParams = this.reflector.getConstructorParameters(clazz);
|
|
1964
|
+
const isStructural = !isComponent && ctorParams !== null && ctorParams.some((param) => {
|
|
1965
|
+
return param.typeValueReference.kind === 1 && param.typeValueReference.moduleName === "@angular/core" && param.typeValueReference.importedName === "TemplateRef";
|
|
1966
|
+
});
|
|
1967
|
+
const isStandalone = def.type.typeArguments.length > 7 && ((_a = readBooleanType(def.type.typeArguments[7])) != null ? _a : false);
|
|
1968
|
+
const inputs = ClassPropertyMapping.fromMappedObject(readMapType(def.type.typeArguments[3], readStringType));
|
|
1969
|
+
const outputs = ClassPropertyMapping.fromMappedObject(readMapType(def.type.typeArguments[4], readStringType));
|
|
1970
|
+
const hostDirectives = def.type.typeArguments.length > 8 ? readHostDirectivesType(this.checker, def.type.typeArguments[8], ref.bestGuessOwningModule) : null;
|
|
1971
|
+
return {
|
|
1972
|
+
kind: MetaKind.Directive,
|
|
1973
|
+
matchSource: MatchSource.Selector,
|
|
1974
|
+
ref,
|
|
1975
|
+
name: clazz.name.text,
|
|
1976
|
+
isComponent,
|
|
1977
|
+
selector: readStringType(def.type.typeArguments[1]),
|
|
1978
|
+
exportAs: readStringArrayType(def.type.typeArguments[2]),
|
|
1979
|
+
inputs,
|
|
1980
|
+
outputs,
|
|
1981
|
+
hostDirectives,
|
|
1982
|
+
queries: readStringArrayType(def.type.typeArguments[5]),
|
|
1983
|
+
...extractDirectiveTypeCheckMeta(clazz, inputs, this.reflector),
|
|
1984
|
+
baseClass: readBaseClass2(clazz, this.checker, this.reflector),
|
|
1985
|
+
isPoisoned: false,
|
|
1986
|
+
isStructural,
|
|
1987
|
+
animationTriggerNames: null,
|
|
1988
|
+
isStandalone,
|
|
1989
|
+
imports: null,
|
|
1990
|
+
schemas: null,
|
|
1991
|
+
decorator: null
|
|
1992
|
+
};
|
|
2016
1993
|
}
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
1994
|
+
getPipeMetadata(ref) {
|
|
1995
|
+
var _a;
|
|
1996
|
+
const def = this.reflector.getMembersOfClass(ref.node).find((field) => field.isStatic && field.name === "\u0275pipe");
|
|
1997
|
+
if (def === void 0) {
|
|
1998
|
+
return null;
|
|
1999
|
+
} else if (def.type === null || !ts8.isTypeReferenceNode(def.type) || def.type.typeArguments === void 0 || def.type.typeArguments.length < 2) {
|
|
2000
|
+
return null;
|
|
2021
2001
|
}
|
|
2022
|
-
|
|
2002
|
+
const type = def.type.typeArguments[1];
|
|
2003
|
+
if (!ts8.isLiteralTypeNode(type) || !ts8.isStringLiteral(type.literal)) {
|
|
2004
|
+
return null;
|
|
2005
|
+
}
|
|
2006
|
+
const name = type.literal.text;
|
|
2007
|
+
const isStandalone = def.type.typeArguments.length > 2 && ((_a = readBooleanType(def.type.typeArguments[2])) != null ? _a : false);
|
|
2008
|
+
return {
|
|
2009
|
+
kind: MetaKind.Pipe,
|
|
2010
|
+
ref,
|
|
2011
|
+
name,
|
|
2012
|
+
nameExpr: null,
|
|
2013
|
+
isStandalone,
|
|
2014
|
+
decorator: null
|
|
2015
|
+
};
|
|
2023
2016
|
}
|
|
2024
|
-
|
|
2025
|
-
|
|
2017
|
+
};
|
|
2018
|
+
function readBaseClass2(clazz, checker, reflector) {
|
|
2019
|
+
if (!isNamedClassDeclaration(clazz)) {
|
|
2020
|
+
return reflector.hasBaseClass(clazz) ? "dynamic" : null;
|
|
2026
2021
|
}
|
|
2027
|
-
|
|
2028
|
-
|
|
2022
|
+
if (clazz.heritageClauses !== void 0) {
|
|
2023
|
+
for (const clause of clazz.heritageClauses) {
|
|
2024
|
+
if (clause.token === ts8.SyntaxKind.ExtendsKeyword) {
|
|
2025
|
+
const baseExpr = clause.types[0].expression;
|
|
2026
|
+
let symbol = checker.getSymbolAtLocation(baseExpr);
|
|
2027
|
+
if (symbol === void 0) {
|
|
2028
|
+
return "dynamic";
|
|
2029
|
+
} else if (symbol.flags & ts8.SymbolFlags.Alias) {
|
|
2030
|
+
symbol = checker.getAliasedSymbol(symbol);
|
|
2031
|
+
}
|
|
2032
|
+
if (symbol.valueDeclaration !== void 0 && isNamedClassDeclaration(symbol.valueDeclaration)) {
|
|
2033
|
+
return new Reference(symbol.valueDeclaration);
|
|
2034
|
+
} else {
|
|
2035
|
+
return "dynamic";
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2029
2039
|
}
|
|
2030
|
-
|
|
2031
|
-
|
|
2040
|
+
return null;
|
|
2041
|
+
}
|
|
2042
|
+
function readHostDirectivesType(checker, type, bestGuessOwningModule) {
|
|
2043
|
+
if (!ts8.isTupleTypeNode(type) || type.elements.length === 0) {
|
|
2044
|
+
return null;
|
|
2032
2045
|
}
|
|
2033
|
-
|
|
2034
|
-
|
|
2046
|
+
const result = [];
|
|
2047
|
+
for (const hostDirectiveType of type.elements) {
|
|
2048
|
+
const { directive, inputs, outputs } = readMapType(hostDirectiveType, (type2) => type2);
|
|
2049
|
+
if (directive) {
|
|
2050
|
+
if (!ts8.isTypeQueryNode(directive)) {
|
|
2051
|
+
throw new Error(`Expected TypeQueryNode: ${nodeDebugInfo(directive)}`);
|
|
2052
|
+
}
|
|
2053
|
+
result.push({
|
|
2054
|
+
directive: extraReferenceFromTypeQuery(checker, directive, type, bestGuessOwningModule),
|
|
2055
|
+
isForwardReference: false,
|
|
2056
|
+
inputs: readMapType(inputs, readStringType),
|
|
2057
|
+
outputs: readMapType(outputs, readStringType)
|
|
2058
|
+
});
|
|
2059
|
+
}
|
|
2035
2060
|
}
|
|
2036
|
-
|
|
2037
|
-
|
|
2061
|
+
return result.length > 0 ? result : null;
|
|
2062
|
+
}
|
|
2063
|
+
|
|
2064
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/inheritance.mjs
|
|
2065
|
+
function flattenInheritedDirectiveMetadata(reader, dir) {
|
|
2066
|
+
const topMeta = reader.getDirectiveMetadata(dir);
|
|
2067
|
+
if (topMeta === null) {
|
|
2068
|
+
throw new Error(`Metadata not found for directive: ${dir.debugName}`);
|
|
2038
2069
|
}
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
for (const [classPropertyName, inputOrOutput] of this.forwardMap) {
|
|
2042
|
-
obj[classPropertyName] = inputOrOutput.bindingPropertyName;
|
|
2043
|
-
}
|
|
2044
|
-
return obj;
|
|
2070
|
+
if (topMeta.baseClass === null) {
|
|
2071
|
+
return topMeta;
|
|
2045
2072
|
}
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2073
|
+
const coercedInputFields = /* @__PURE__ */ new Set();
|
|
2074
|
+
const undeclaredInputFields = /* @__PURE__ */ new Set();
|
|
2075
|
+
const restrictedInputFields = /* @__PURE__ */ new Set();
|
|
2076
|
+
const stringLiteralInputFields = /* @__PURE__ */ new Set();
|
|
2077
|
+
let isDynamic = false;
|
|
2078
|
+
let inputs = ClassPropertyMapping.empty();
|
|
2079
|
+
let outputs = ClassPropertyMapping.empty();
|
|
2080
|
+
let isStructural = false;
|
|
2081
|
+
const addMetadata = (meta) => {
|
|
2082
|
+
if (meta.baseClass === "dynamic") {
|
|
2083
|
+
isDynamic = true;
|
|
2084
|
+
} else if (meta.baseClass !== null) {
|
|
2085
|
+
const baseMeta = reader.getDirectiveMetadata(meta.baseClass);
|
|
2086
|
+
if (baseMeta !== null) {
|
|
2087
|
+
addMetadata(baseMeta);
|
|
2051
2088
|
} else {
|
|
2052
|
-
|
|
2089
|
+
isDynamic = true;
|
|
2053
2090
|
}
|
|
2054
2091
|
}
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
for (const
|
|
2059
|
-
|
|
2092
|
+
isStructural = isStructural || meta.isStructural;
|
|
2093
|
+
inputs = ClassPropertyMapping.merge(inputs, meta.inputs);
|
|
2094
|
+
outputs = ClassPropertyMapping.merge(outputs, meta.outputs);
|
|
2095
|
+
for (const coercedInputField of meta.coercedInputFields) {
|
|
2096
|
+
coercedInputFields.add(coercedInputField);
|
|
2060
2097
|
}
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
function reverseMapFromForwardMap(forwardMap) {
|
|
2064
|
-
const reverseMap = /* @__PURE__ */ new Map();
|
|
2065
|
-
for (const [_, inputOrOutput] of forwardMap) {
|
|
2066
|
-
if (!reverseMap.has(inputOrOutput.bindingPropertyName)) {
|
|
2067
|
-
reverseMap.set(inputOrOutput.bindingPropertyName, []);
|
|
2098
|
+
for (const undeclaredInputField of meta.undeclaredInputFields) {
|
|
2099
|
+
undeclaredInputFields.add(undeclaredInputField);
|
|
2068
2100
|
}
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2101
|
+
for (const restrictedInputField of meta.restrictedInputFields) {
|
|
2102
|
+
restrictedInputFields.add(restrictedInputField);
|
|
2103
|
+
}
|
|
2104
|
+
for (const field of meta.stringLiteralInputFields) {
|
|
2105
|
+
stringLiteralInputFields.add(field);
|
|
2106
|
+
}
|
|
2107
|
+
};
|
|
2108
|
+
addMetadata(topMeta);
|
|
2109
|
+
return {
|
|
2110
|
+
...topMeta,
|
|
2111
|
+
inputs,
|
|
2112
|
+
outputs,
|
|
2113
|
+
coercedInputFields,
|
|
2114
|
+
undeclaredInputFields,
|
|
2115
|
+
restrictedInputFields,
|
|
2116
|
+
stringLiteralInputFields,
|
|
2117
|
+
baseClass: isDynamic ? "dynamic" : null,
|
|
2118
|
+
isStructural
|
|
2119
|
+
};
|
|
2072
2120
|
}
|
|
2073
2121
|
|
|
2074
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2122
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/registry.mjs
|
|
2123
|
+
var LocalMetadataRegistry = class {
|
|
2124
|
+
constructor() {
|
|
2125
|
+
this.directives = /* @__PURE__ */ new Map();
|
|
2126
|
+
this.ngModules = /* @__PURE__ */ new Map();
|
|
2127
|
+
this.pipes = /* @__PURE__ */ new Map();
|
|
2079
2128
|
}
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
throw new Error(`Expected TypeQueryNode: ${nodeDebugInfo(element)}`);
|
|
2083
|
-
}
|
|
2084
|
-
return extraReferenceFromTypeQuery(checker, element, def, bestGuessOwningModule);
|
|
2085
|
-
});
|
|
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)}`);
|
|
2129
|
+
getDirectiveMetadata(ref) {
|
|
2130
|
+
return this.directives.has(ref.node) ? this.directives.get(ref.node) : null;
|
|
2092
2131
|
}
|
|
2093
|
-
|
|
2094
|
-
return
|
|
2132
|
+
getNgModuleMetadata(ref) {
|
|
2133
|
+
return this.ngModules.has(ref.node) ? this.ngModules.get(ref.node) : null;
|
|
2095
2134
|
}
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
function readBooleanType(type) {
|
|
2099
|
-
if (!ts10.isLiteralTypeNode(type)) {
|
|
2100
|
-
return null;
|
|
2135
|
+
getPipeMetadata(ref) {
|
|
2136
|
+
return this.pipes.has(ref.node) ? this.pipes.get(ref.node) : null;
|
|
2101
2137
|
}
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
return true;
|
|
2105
|
-
case ts10.SyntaxKind.FalseKeyword:
|
|
2106
|
-
return false;
|
|
2107
|
-
default:
|
|
2108
|
-
return null;
|
|
2138
|
+
registerDirectiveMetadata(meta) {
|
|
2139
|
+
this.directives.set(meta.ref.node, meta);
|
|
2109
2140
|
}
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
if (!ts10.isLiteralTypeNode(type) || !ts10.isStringLiteral(type.literal)) {
|
|
2113
|
-
return null;
|
|
2141
|
+
registerNgModuleMetadata(meta) {
|
|
2142
|
+
this.ngModules.set(meta.ref.node, meta);
|
|
2114
2143
|
}
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
function readMapType(type, valueTransform) {
|
|
2118
|
-
if (!ts10.isTypeLiteralNode(type)) {
|
|
2119
|
-
return {};
|
|
2144
|
+
registerPipeMetadata(meta) {
|
|
2145
|
+
this.pipes.set(meta.ref.node, meta);
|
|
2120
2146
|
}
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
if (!ts10.isPropertySignature(member) || member.type === void 0 || member.name === void 0 || !ts10.isStringLiteral(member.name) && !ts10.isIdentifier(member.name)) {
|
|
2124
|
-
return;
|
|
2125
|
-
}
|
|
2126
|
-
const value = valueTransform(member.type);
|
|
2127
|
-
if (value === null) {
|
|
2128
|
-
return null;
|
|
2129
|
-
}
|
|
2130
|
-
obj[member.name.text] = value;
|
|
2131
|
-
});
|
|
2132
|
-
return obj;
|
|
2133
|
-
}
|
|
2134
|
-
function readStringArrayType(type) {
|
|
2135
|
-
if (!ts10.isTupleTypeNode(type)) {
|
|
2136
|
-
return [];
|
|
2147
|
+
getKnownDirectives() {
|
|
2148
|
+
return this.directives.keys();
|
|
2137
2149
|
}
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
}
|
|
2147
|
-
function extractDirectiveTypeCheckMeta(node, inputs, reflector) {
|
|
2148
|
-
const members = reflector.getMembersOfClass(node);
|
|
2149
|
-
const staticMembers = members.filter((member) => member.isStatic);
|
|
2150
|
-
const ngTemplateGuards = staticMembers.map(extractTemplateGuard).filter((guard) => guard !== null);
|
|
2151
|
-
const hasNgTemplateContextGuard = staticMembers.some((member) => member.kind === ClassMemberKind.Method && member.name === "ngTemplateContextGuard");
|
|
2152
|
-
const coercedInputFields = new Set(staticMembers.map(extractCoercedInput).filter((inputName) => inputName !== null));
|
|
2153
|
-
const restrictedInputFields = /* @__PURE__ */ new Set();
|
|
2154
|
-
const stringLiteralInputFields = /* @__PURE__ */ new Set();
|
|
2155
|
-
const undeclaredInputFields = /* @__PURE__ */ new Set();
|
|
2156
|
-
for (const classPropertyName of inputs.classPropertyNames) {
|
|
2157
|
-
const field = members.find((member) => member.name === classPropertyName);
|
|
2158
|
-
if (field === void 0 || field.node === null) {
|
|
2159
|
-
undeclaredInputFields.add(classPropertyName);
|
|
2160
|
-
continue;
|
|
2150
|
+
};
|
|
2151
|
+
var CompoundMetadataRegistry = class {
|
|
2152
|
+
constructor(registries) {
|
|
2153
|
+
this.registries = registries;
|
|
2154
|
+
}
|
|
2155
|
+
registerDirectiveMetadata(meta) {
|
|
2156
|
+
for (const registry of this.registries) {
|
|
2157
|
+
registry.registerDirectiveMetadata(meta);
|
|
2161
2158
|
}
|
|
2162
|
-
|
|
2163
|
-
|
|
2159
|
+
}
|
|
2160
|
+
registerNgModuleMetadata(meta) {
|
|
2161
|
+
for (const registry of this.registries) {
|
|
2162
|
+
registry.registerNgModuleMetadata(meta);
|
|
2164
2163
|
}
|
|
2165
|
-
|
|
2166
|
-
|
|
2164
|
+
}
|
|
2165
|
+
registerPipeMetadata(meta) {
|
|
2166
|
+
for (const registry of this.registries) {
|
|
2167
|
+
registry.registerPipeMetadata(meta);
|
|
2167
2168
|
}
|
|
2168
2169
|
}
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
};
|
|
2179
|
-
}
|
|
2180
|
-
function isRestricted(node) {
|
|
2181
|
-
const modifiers = getModifiers(node);
|
|
2182
|
-
return modifiers !== void 0 && modifiers.some(({ kind }) => {
|
|
2183
|
-
return kind === ts10.SyntaxKind.PrivateKeyword || kind === ts10.SyntaxKind.ProtectedKeyword || kind === ts10.SyntaxKind.ReadonlyKeyword;
|
|
2184
|
-
});
|
|
2185
|
-
}
|
|
2186
|
-
function extractTemplateGuard(member) {
|
|
2187
|
-
if (!member.name.startsWith("ngTemplateGuard_")) {
|
|
2188
|
-
return null;
|
|
2170
|
+
};
|
|
2171
|
+
|
|
2172
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/resource_registry.mjs
|
|
2173
|
+
var ResourceRegistry = class {
|
|
2174
|
+
constructor() {
|
|
2175
|
+
this.externalTemplateToComponentsMap = /* @__PURE__ */ new Map();
|
|
2176
|
+
this.componentToTemplateMap = /* @__PURE__ */ new Map();
|
|
2177
|
+
this.componentToStylesMap = /* @__PURE__ */ new Map();
|
|
2178
|
+
this.externalStyleToComponentsMap = /* @__PURE__ */ new Map();
|
|
2189
2179
|
}
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
if (member.type !== null && ts10.isLiteralTypeNode(member.type) && ts10.isStringLiteral(member.type.literal)) {
|
|
2194
|
-
type = member.type.literal.text;
|
|
2180
|
+
getComponentsWithTemplate(template) {
|
|
2181
|
+
if (!this.externalTemplateToComponentsMap.has(template)) {
|
|
2182
|
+
return /* @__PURE__ */ new Set();
|
|
2195
2183
|
}
|
|
2196
|
-
|
|
2197
|
-
|
|
2184
|
+
return this.externalTemplateToComponentsMap.get(template);
|
|
2185
|
+
}
|
|
2186
|
+
registerResources(resources, component) {
|
|
2187
|
+
if (resources.template !== null) {
|
|
2188
|
+
this.registerTemplate(resources.template, component);
|
|
2189
|
+
}
|
|
2190
|
+
for (const style of resources.styles) {
|
|
2191
|
+
this.registerStyle(style, component);
|
|
2198
2192
|
}
|
|
2199
|
-
return { inputName, type };
|
|
2200
|
-
} else if (member.kind === ClassMemberKind.Method) {
|
|
2201
|
-
return { inputName, type: "invocation" };
|
|
2202
|
-
} else {
|
|
2203
|
-
return null;
|
|
2204
2193
|
}
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2194
|
+
registerTemplate(templateResource, component) {
|
|
2195
|
+
const { path } = templateResource;
|
|
2196
|
+
if (path !== null) {
|
|
2197
|
+
if (!this.externalTemplateToComponentsMap.has(path)) {
|
|
2198
|
+
this.externalTemplateToComponentsMap.set(path, /* @__PURE__ */ new Set());
|
|
2199
|
+
}
|
|
2200
|
+
this.externalTemplateToComponentsMap.get(path).add(component);
|
|
2201
|
+
}
|
|
2202
|
+
this.componentToTemplateMap.set(component, templateResource);
|
|
2209
2203
|
}
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
this.
|
|
2204
|
+
getTemplate(component) {
|
|
2205
|
+
if (!this.componentToTemplateMap.has(component)) {
|
|
2206
|
+
return null;
|
|
2207
|
+
}
|
|
2208
|
+
return this.componentToTemplateMap.get(component);
|
|
2215
2209
|
}
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2210
|
+
registerStyle(styleResource, component) {
|
|
2211
|
+
const { path } = styleResource;
|
|
2212
|
+
if (!this.componentToStylesMap.has(component)) {
|
|
2213
|
+
this.componentToStylesMap.set(component, /* @__PURE__ */ new Set());
|
|
2214
|
+
}
|
|
2215
|
+
if (path !== null) {
|
|
2216
|
+
if (!this.externalStyleToComponentsMap.has(path)) {
|
|
2217
|
+
this.externalStyleToComponentsMap.set(path, /* @__PURE__ */ new Set());
|
|
2221
2218
|
}
|
|
2219
|
+
this.externalStyleToComponentsMap.get(path).add(component);
|
|
2222
2220
|
}
|
|
2223
|
-
|
|
2221
|
+
this.componentToStylesMap.get(component).add(styleResource);
|
|
2224
2222
|
}
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
if (meta !== null) {
|
|
2229
|
-
return meta;
|
|
2230
|
-
}
|
|
2223
|
+
getStyles(component) {
|
|
2224
|
+
if (!this.componentToStylesMap.has(component)) {
|
|
2225
|
+
return /* @__PURE__ */ new Set();
|
|
2231
2226
|
}
|
|
2232
|
-
return
|
|
2227
|
+
return this.componentToStylesMap.get(component);
|
|
2233
2228
|
}
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
if (meta !== null) {
|
|
2238
|
-
return meta;
|
|
2239
|
-
}
|
|
2229
|
+
getComponentsWithStyle(styleUrl) {
|
|
2230
|
+
if (!this.externalStyleToComponentsMap.has(styleUrl)) {
|
|
2231
|
+
return /* @__PURE__ */ new Set();
|
|
2240
2232
|
}
|
|
2241
|
-
return
|
|
2233
|
+
return this.externalStyleToComponentsMap.get(styleUrl);
|
|
2242
2234
|
}
|
|
2243
2235
|
};
|
|
2244
|
-
function afterUnderscore(str) {
|
|
2245
|
-
const pos = str.indexOf("_");
|
|
2246
|
-
if (pos === -1) {
|
|
2247
|
-
throw new Error(`Expected '${str}' to contain '_'`);
|
|
2248
|
-
}
|
|
2249
|
-
return str.slice(pos + 1);
|
|
2250
|
-
}
|
|
2251
|
-
function hasInjectableFields(clazz, host) {
|
|
2252
|
-
const members = host.getMembersOfClass(clazz);
|
|
2253
|
-
return members.some(({ isStatic, name }) => isStatic && (name === "\u0275prov" || name === "\u0275fac"));
|
|
2254
|
-
}
|
|
2255
2236
|
|
|
2256
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/
|
|
2257
|
-
var
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
this.
|
|
2237
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/host_directives_resolver.mjs
|
|
2238
|
+
var EMPTY_ARRAY = [];
|
|
2239
|
+
var HostDirectivesResolver = class {
|
|
2240
|
+
constructor(metaReader) {
|
|
2241
|
+
this.metaReader = metaReader;
|
|
2242
|
+
this.cache = /* @__PURE__ */ new Map();
|
|
2261
2243
|
}
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
if (ngModuleDef === void 0) {
|
|
2266
|
-
return null;
|
|
2267
|
-
} else if (ngModuleDef.type === null || !ts11.isTypeReferenceNode(ngModuleDef.type) || ngModuleDef.type.typeArguments === void 0 || ngModuleDef.type.typeArguments.length !== 4) {
|
|
2268
|
-
return null;
|
|
2244
|
+
resolve(metadata) {
|
|
2245
|
+
if (this.cache.has(metadata.ref.node)) {
|
|
2246
|
+
return this.cache.get(metadata.ref.node);
|
|
2269
2247
|
}
|
|
2270
|
-
const
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
ref,
|
|
2274
|
-
declarations: extractReferencesFromType(this.checker, declarationMetadata, ref.bestGuessOwningModule),
|
|
2275
|
-
exports: extractReferencesFromType(this.checker, exportMetadata, ref.bestGuessOwningModule),
|
|
2276
|
-
imports: extractReferencesFromType(this.checker, importMetadata, ref.bestGuessOwningModule),
|
|
2277
|
-
schemas: [],
|
|
2278
|
-
rawDeclarations: null,
|
|
2279
|
-
rawImports: null,
|
|
2280
|
-
rawExports: null,
|
|
2281
|
-
decorator: null
|
|
2282
|
-
};
|
|
2248
|
+
const results = metadata.hostDirectives && metadata.hostDirectives.length > 0 ? this.walkHostDirectives(metadata.hostDirectives, []) : EMPTY_ARRAY;
|
|
2249
|
+
this.cache.set(metadata.ref.node, results);
|
|
2250
|
+
return results;
|
|
2283
2251
|
}
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2252
|
+
walkHostDirectives(directives, results) {
|
|
2253
|
+
for (const current of directives) {
|
|
2254
|
+
const hostMeta = flattenInheritedDirectiveMetadata(this.metaReader, current.directive);
|
|
2255
|
+
if (hostMeta === null) {
|
|
2256
|
+
throw new Error(`Could not resolve host directive metadata of ${current.directive.debugName}`);
|
|
2257
|
+
}
|
|
2258
|
+
if (hostMeta.hostDirectives) {
|
|
2259
|
+
this.walkHostDirectives(hostMeta.hostDirectives, results);
|
|
2260
|
+
}
|
|
2261
|
+
results.push({
|
|
2262
|
+
...hostMeta,
|
|
2263
|
+
matchSource: MatchSource.HostDirective,
|
|
2264
|
+
inputs: this.filterMappings(hostMeta.inputs, current.inputs),
|
|
2265
|
+
outputs: this.filterMappings(hostMeta.outputs, current.outputs)
|
|
2266
|
+
});
|
|
2292
2267
|
}
|
|
2293
|
-
|
|
2294
|
-
const ctorParams = this.reflector.getConstructorParameters(clazz);
|
|
2295
|
-
const isStructural = !isComponent && ctorParams !== null && ctorParams.some((param) => {
|
|
2296
|
-
return param.typeValueReference.kind === 1 && param.typeValueReference.moduleName === "@angular/core" && param.typeValueReference.importedName === "TemplateRef";
|
|
2297
|
-
});
|
|
2298
|
-
const isStandalone = def.type.typeArguments.length > 7 && ((_a = readBooleanType(def.type.typeArguments[7])) != null ? _a : false);
|
|
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;
|
|
2302
|
-
return {
|
|
2303
|
-
kind: MetaKind.Directive,
|
|
2304
|
-
matchSource: MatchSource.Selector,
|
|
2305
|
-
ref,
|
|
2306
|
-
name: clazz.name.text,
|
|
2307
|
-
isComponent,
|
|
2308
|
-
selector: readStringType(def.type.typeArguments[1]),
|
|
2309
|
-
exportAs: readStringArrayType(def.type.typeArguments[2]),
|
|
2310
|
-
inputs,
|
|
2311
|
-
outputs,
|
|
2312
|
-
hostDirectives,
|
|
2313
|
-
queries: readStringArrayType(def.type.typeArguments[5]),
|
|
2314
|
-
...extractDirectiveTypeCheckMeta(clazz, inputs, this.reflector),
|
|
2315
|
-
baseClass: readBaseClass2(clazz, this.checker, this.reflector),
|
|
2316
|
-
isPoisoned: false,
|
|
2317
|
-
isStructural,
|
|
2318
|
-
animationTriggerNames: null,
|
|
2319
|
-
isStandalone,
|
|
2320
|
-
imports: null,
|
|
2321
|
-
schemas: null,
|
|
2322
|
-
decorator: null
|
|
2323
|
-
};
|
|
2268
|
+
return results;
|
|
2324
2269
|
}
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2270
|
+
filterMappings(source, allowedProperties) {
|
|
2271
|
+
const result = {};
|
|
2272
|
+
if (allowedProperties !== null) {
|
|
2273
|
+
for (const publicName in allowedProperties) {
|
|
2274
|
+
if (allowedProperties.hasOwnProperty(publicName)) {
|
|
2275
|
+
const bindings = source.getByBindingPropertyName(publicName);
|
|
2276
|
+
if (bindings !== null) {
|
|
2277
|
+
for (const binding of bindings) {
|
|
2278
|
+
result[binding.classPropertyName] = allowedProperties[publicName];
|
|
2279
|
+
}
|
|
2280
|
+
}
|
|
2281
|
+
}
|
|
2282
|
+
}
|
|
2332
2283
|
}
|
|
2333
|
-
|
|
2334
|
-
|
|
2284
|
+
return ClassPropertyMapping.fromMappedObject(result);
|
|
2285
|
+
}
|
|
2286
|
+
};
|
|
2287
|
+
|
|
2288
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/injectable_registry.mjs
|
|
2289
|
+
var InjectableClassRegistry = class {
|
|
2290
|
+
constructor(host, isCore) {
|
|
2291
|
+
this.host = host;
|
|
2292
|
+
this.isCore = isCore;
|
|
2293
|
+
this.classes = /* @__PURE__ */ new Map();
|
|
2294
|
+
}
|
|
2295
|
+
registerInjectable(declaration, meta) {
|
|
2296
|
+
this.classes.set(declaration, meta);
|
|
2297
|
+
}
|
|
2298
|
+
getInjectableMeta(declaration) {
|
|
2299
|
+
if (this.classes.has(declaration)) {
|
|
2300
|
+
return this.classes.get(declaration);
|
|
2301
|
+
}
|
|
2302
|
+
if (!hasInjectableFields(declaration, this.host)) {
|
|
2335
2303
|
return null;
|
|
2336
2304
|
}
|
|
2337
|
-
const
|
|
2338
|
-
const
|
|
2339
|
-
|
|
2340
|
-
kind: MetaKind.Pipe,
|
|
2341
|
-
ref,
|
|
2342
|
-
name,
|
|
2343
|
-
nameExpr: null,
|
|
2344
|
-
isStandalone,
|
|
2345
|
-
decorator: null
|
|
2305
|
+
const ctorDeps = getConstructorDependencies(declaration, this.host, this.isCore);
|
|
2306
|
+
const meta = {
|
|
2307
|
+
ctorDeps: unwrapConstructorDependencies(ctorDeps)
|
|
2346
2308
|
};
|
|
2309
|
+
this.classes.set(declaration, meta);
|
|
2310
|
+
return meta;
|
|
2311
|
+
}
|
|
2312
|
+
};
|
|
2313
|
+
|
|
2314
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/metadata.mjs
|
|
2315
|
+
import { FunctionExpr, LiteralArrayExpr, LiteralExpr as LiteralExpr2, literalMap, ReturnStatement, WrappedNodeExpr as WrappedNodeExpr3 } from "@angular/compiler";
|
|
2316
|
+
import ts9 from "typescript";
|
|
2317
|
+
function extractClassMetadata(clazz, reflection, isCore, annotateForClosureCompiler, angularDecoratorTransform = (dec) => dec) {
|
|
2318
|
+
if (!reflection.isClass(clazz)) {
|
|
2319
|
+
return null;
|
|
2320
|
+
}
|
|
2321
|
+
const id = reflection.getAdjacentNameOfClass(clazz);
|
|
2322
|
+
const classDecorators = reflection.getDecoratorsOfDeclaration(clazz);
|
|
2323
|
+
if (classDecorators === null) {
|
|
2324
|
+
return null;
|
|
2325
|
+
}
|
|
2326
|
+
const ngClassDecorators = classDecorators.filter((dec) => isAngularDecorator2(dec, isCore)).map((decorator) => decoratorToMetadata(angularDecoratorTransform(decorator), annotateForClosureCompiler)).map((decorator) => removeIdentifierReferences(decorator, id.text));
|
|
2327
|
+
if (ngClassDecorators.length === 0) {
|
|
2328
|
+
return null;
|
|
2329
|
+
}
|
|
2330
|
+
const metaDecorators = new WrappedNodeExpr3(ts9.factory.createArrayLiteralExpression(ngClassDecorators));
|
|
2331
|
+
let metaCtorParameters = null;
|
|
2332
|
+
const classCtorParameters = reflection.getConstructorParameters(clazz);
|
|
2333
|
+
if (classCtorParameters !== null) {
|
|
2334
|
+
const ctorParameters = classCtorParameters.map((param) => ctorParameterToMetadata(param, isCore));
|
|
2335
|
+
metaCtorParameters = new FunctionExpr([], [
|
|
2336
|
+
new ReturnStatement(new LiteralArrayExpr(ctorParameters))
|
|
2337
|
+
]);
|
|
2347
2338
|
}
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2339
|
+
let metaPropDecorators = null;
|
|
2340
|
+
const classMembers = reflection.getMembersOfClass(clazz).filter((member) => !member.isStatic && member.decorators !== null && member.decorators.length > 0);
|
|
2341
|
+
const duplicateDecoratedMemberNames = classMembers.map((member) => member.name).filter((name, i, arr) => arr.indexOf(name) < i);
|
|
2342
|
+
if (duplicateDecoratedMemberNames.length > 0) {
|
|
2343
|
+
throw new Error(`Duplicate decorated properties found on class '${clazz.name.text}': ` + duplicateDecoratedMemberNames.join(", "));
|
|
2352
2344
|
}
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
return "dynamic";
|
|
2360
|
-
} else if (symbol.flags & ts11.SymbolFlags.Alias) {
|
|
2361
|
-
symbol = checker.getAliasedSymbol(symbol);
|
|
2362
|
-
}
|
|
2363
|
-
if (symbol.valueDeclaration !== void 0 && isNamedClassDeclaration(symbol.valueDeclaration)) {
|
|
2364
|
-
return new Reference(symbol.valueDeclaration);
|
|
2365
|
-
} else {
|
|
2366
|
-
return "dynamic";
|
|
2367
|
-
}
|
|
2368
|
-
}
|
|
2369
|
-
}
|
|
2345
|
+
const decoratedMembers = classMembers.map((member) => {
|
|
2346
|
+
var _a;
|
|
2347
|
+
return classMemberToMetadata((_a = member.nameNode) != null ? _a : member.name, member.decorators, isCore);
|
|
2348
|
+
});
|
|
2349
|
+
if (decoratedMembers.length > 0) {
|
|
2350
|
+
metaPropDecorators = new WrappedNodeExpr3(ts9.factory.createObjectLiteralExpression(decoratedMembers));
|
|
2370
2351
|
}
|
|
2371
|
-
return
|
|
2352
|
+
return {
|
|
2353
|
+
type: new WrappedNodeExpr3(id),
|
|
2354
|
+
decorators: metaDecorators,
|
|
2355
|
+
ctorParameters: metaCtorParameters,
|
|
2356
|
+
propDecorators: metaPropDecorators
|
|
2357
|
+
};
|
|
2372
2358
|
}
|
|
2373
|
-
function
|
|
2374
|
-
|
|
2375
|
-
|
|
2359
|
+
function ctorParameterToMetadata(param, isCore) {
|
|
2360
|
+
const type = param.typeValueReference.kind !== 2 ? valueReferenceToExpression(param.typeValueReference) : new LiteralExpr2(void 0);
|
|
2361
|
+
const mapEntries = [
|
|
2362
|
+
{ key: "type", value: type, quoted: false }
|
|
2363
|
+
];
|
|
2364
|
+
if (param.decorators !== null) {
|
|
2365
|
+
const ngDecorators = param.decorators.filter((dec) => isAngularDecorator2(dec, isCore)).map((decorator) => decoratorToMetadata(decorator));
|
|
2366
|
+
const value = new WrappedNodeExpr3(ts9.factory.createArrayLiteralExpression(ngDecorators));
|
|
2367
|
+
mapEntries.push({ key: "decorators", value, quoted: false });
|
|
2376
2368
|
}
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
inputs: readMapType(inputs, readStringType),
|
|
2388
|
-
outputs: readMapType(outputs, readStringType)
|
|
2389
|
-
});
|
|
2390
|
-
}
|
|
2369
|
+
return literalMap(mapEntries);
|
|
2370
|
+
}
|
|
2371
|
+
function classMemberToMetadata(name, decorators, isCore) {
|
|
2372
|
+
const ngDecorators = decorators.filter((dec) => isAngularDecorator2(dec, isCore)).map((decorator) => decoratorToMetadata(decorator));
|
|
2373
|
+
const decoratorMeta = ts9.factory.createArrayLiteralExpression(ngDecorators);
|
|
2374
|
+
return ts9.factory.createPropertyAssignment(name, decoratorMeta);
|
|
2375
|
+
}
|
|
2376
|
+
function decoratorToMetadata(decorator, wrapFunctionsInParens) {
|
|
2377
|
+
if (decorator.identifier === null) {
|
|
2378
|
+
throw new Error("Illegal state: synthesized decorator cannot be emitted in class metadata.");
|
|
2391
2379
|
}
|
|
2392
|
-
|
|
2380
|
+
const properties = [
|
|
2381
|
+
ts9.factory.createPropertyAssignment("type", decorator.identifier)
|
|
2382
|
+
];
|
|
2383
|
+
if (decorator.args !== null && decorator.args.length > 0) {
|
|
2384
|
+
const args = decorator.args.map((arg) => {
|
|
2385
|
+
return wrapFunctionsInParens ? wrapFunctionExpressionsInParens(arg) : arg;
|
|
2386
|
+
});
|
|
2387
|
+
properties.push(ts9.factory.createPropertyAssignment("args", ts9.factory.createArrayLiteralExpression(args)));
|
|
2388
|
+
}
|
|
2389
|
+
return ts9.factory.createObjectLiteralExpression(properties, true);
|
|
2390
|
+
}
|
|
2391
|
+
function isAngularDecorator2(decorator, isCore) {
|
|
2392
|
+
return isCore || decorator.import !== null && decorator.import.from === "@angular/core";
|
|
2393
|
+
}
|
|
2394
|
+
function removeIdentifierReferences(node, name) {
|
|
2395
|
+
const result = ts9.transform(node, [(context) => (root) => ts9.visitNode(root, function walk(current) {
|
|
2396
|
+
return ts9.isIdentifier(current) && current.text === name ? ts9.factory.createIdentifier(current.text) : ts9.visitEachChild(current, walk, context);
|
|
2397
|
+
})]);
|
|
2398
|
+
return result.transformed[0];
|
|
2393
2399
|
}
|
|
2394
2400
|
|
|
2395
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
if (topMeta === null) {
|
|
2399
|
-
throw new Error(`Metadata not found for directive: ${dir.debugName}`);
|
|
2401
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/references_registry.mjs
|
|
2402
|
+
var NoopReferencesRegistry = class {
|
|
2403
|
+
add(source, ...references) {
|
|
2400
2404
|
}
|
|
2401
|
-
|
|
2402
|
-
|
|
2405
|
+
};
|
|
2406
|
+
|
|
2407
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/schema.mjs
|
|
2408
|
+
import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA } from "@angular/compiler";
|
|
2409
|
+
function extractSchemas(rawExpr, evaluator, context) {
|
|
2410
|
+
const schemas = [];
|
|
2411
|
+
const result = evaluator.evaluate(rawExpr);
|
|
2412
|
+
if (!Array.isArray(result)) {
|
|
2413
|
+
throw createValueHasWrongTypeError(rawExpr, result, `${context}.schemas must be an array`);
|
|
2403
2414
|
}
|
|
2404
|
-
const
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
const stringLiteralInputFields = /* @__PURE__ */ new Set();
|
|
2408
|
-
let isDynamic = false;
|
|
2409
|
-
let inputs = ClassPropertyMapping.empty();
|
|
2410
|
-
let outputs = ClassPropertyMapping.empty();
|
|
2411
|
-
let isStructural = false;
|
|
2412
|
-
const addMetadata = (meta) => {
|
|
2413
|
-
if (meta.baseClass === "dynamic") {
|
|
2414
|
-
isDynamic = true;
|
|
2415
|
-
} else if (meta.baseClass !== null) {
|
|
2416
|
-
const baseMeta = reader.getDirectiveMetadata(meta.baseClass);
|
|
2417
|
-
if (baseMeta !== null) {
|
|
2418
|
-
addMetadata(baseMeta);
|
|
2419
|
-
} else {
|
|
2420
|
-
isDynamic = true;
|
|
2421
|
-
}
|
|
2422
|
-
}
|
|
2423
|
-
isStructural = isStructural || meta.isStructural;
|
|
2424
|
-
inputs = ClassPropertyMapping.merge(inputs, meta.inputs);
|
|
2425
|
-
outputs = ClassPropertyMapping.merge(outputs, meta.outputs);
|
|
2426
|
-
for (const coercedInputField of meta.coercedInputFields) {
|
|
2427
|
-
coercedInputFields.add(coercedInputField);
|
|
2428
|
-
}
|
|
2429
|
-
for (const undeclaredInputField of meta.undeclaredInputFields) {
|
|
2430
|
-
undeclaredInputFields.add(undeclaredInputField);
|
|
2415
|
+
for (const schemaRef of result) {
|
|
2416
|
+
if (!(schemaRef instanceof Reference)) {
|
|
2417
|
+
throw createValueHasWrongTypeError(rawExpr, result, `${context}.schemas must be an array of schemas`);
|
|
2431
2418
|
}
|
|
2432
|
-
|
|
2433
|
-
|
|
2419
|
+
const id = schemaRef.getIdentityIn(schemaRef.node.getSourceFile());
|
|
2420
|
+
if (id === null || schemaRef.ownedByModuleGuess !== "@angular/core") {
|
|
2421
|
+
throw createValueHasWrongTypeError(rawExpr, result, `${context}.schemas must be an array of schemas`);
|
|
2434
2422
|
}
|
|
2435
|
-
|
|
2436
|
-
|
|
2423
|
+
switch (id.text) {
|
|
2424
|
+
case "CUSTOM_ELEMENTS_SCHEMA":
|
|
2425
|
+
schemas.push(CUSTOM_ELEMENTS_SCHEMA);
|
|
2426
|
+
break;
|
|
2427
|
+
case "NO_ERRORS_SCHEMA":
|
|
2428
|
+
schemas.push(NO_ERRORS_SCHEMA);
|
|
2429
|
+
break;
|
|
2430
|
+
default:
|
|
2431
|
+
throw createValueHasWrongTypeError(rawExpr, schemaRef, `'${schemaRef.debugName}' is not a valid ${context} schema`);
|
|
2437
2432
|
}
|
|
2438
|
-
}
|
|
2439
|
-
|
|
2440
|
-
return {
|
|
2441
|
-
...topMeta,
|
|
2442
|
-
inputs,
|
|
2443
|
-
outputs,
|
|
2444
|
-
coercedInputFields,
|
|
2445
|
-
undeclaredInputFields,
|
|
2446
|
-
restrictedInputFields,
|
|
2447
|
-
stringLiteralInputFields,
|
|
2448
|
-
baseClass: isDynamic ? "dynamic" : null,
|
|
2449
|
-
isStructural
|
|
2450
|
-
};
|
|
2433
|
+
}
|
|
2434
|
+
return schemas;
|
|
2451
2435
|
}
|
|
2452
2436
|
|
|
2453
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
return this.ngModules.has(ref.node) ? this.ngModules.get(ref.node) : null;
|
|
2465
|
-
}
|
|
2466
|
-
getPipeMetadata(ref) {
|
|
2467
|
-
return this.pipes.has(ref.node) ? this.pipes.get(ref.node) : null;
|
|
2468
|
-
}
|
|
2469
|
-
registerDirectiveMetadata(meta) {
|
|
2470
|
-
this.directives.set(meta.ref.node, meta);
|
|
2437
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/handler.mjs
|
|
2438
|
+
import { compileClassMetadata as compileClassMetadata3, compileComponentFromMetadata, compileDeclareClassMetadata as compileDeclareClassMetadata3, compileDeclareComponentFromMetadata, CssSelector as CssSelector2, DEFAULT_INTERPOLATION_CONFIG as DEFAULT_INTERPOLATION_CONFIG2, DomElementSchemaRegistry, FactoryTarget as FactoryTarget3, makeBindingParser as makeBindingParser2, R3TargetBinder, R3TemplateDependencyKind, SelectorMatcher as SelectorMatcher2, ViewEncapsulation, WrappedNodeExpr as WrappedNodeExpr7 } from "@angular/compiler";
|
|
2439
|
+
import ts24 from "typescript";
|
|
2440
|
+
|
|
2441
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/semantic_graph/src/api.mjs
|
|
2442
|
+
import ts10 from "typescript";
|
|
2443
|
+
var SemanticSymbol = class {
|
|
2444
|
+
constructor(decl) {
|
|
2445
|
+
this.decl = decl;
|
|
2446
|
+
this.path = absoluteFromSourceFile(decl.getSourceFile());
|
|
2447
|
+
this.identifier = getSymbolIdentifier(decl);
|
|
2471
2448
|
}
|
|
2472
|
-
|
|
2473
|
-
|
|
2449
|
+
};
|
|
2450
|
+
function getSymbolIdentifier(decl) {
|
|
2451
|
+
if (!ts10.isSourceFile(decl.parent)) {
|
|
2452
|
+
return null;
|
|
2474
2453
|
}
|
|
2475
|
-
|
|
2476
|
-
|
|
2454
|
+
return decl.name.text;
|
|
2455
|
+
}
|
|
2456
|
+
|
|
2457
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/semantic_graph/src/graph.mjs
|
|
2458
|
+
import { ExternalExpr as ExternalExpr2 } from "@angular/compiler";
|
|
2459
|
+
var OpaqueSymbol = class extends SemanticSymbol {
|
|
2460
|
+
isPublicApiAffected() {
|
|
2461
|
+
return false;
|
|
2477
2462
|
}
|
|
2478
|
-
|
|
2479
|
-
return
|
|
2463
|
+
isTypeCheckApiAffected() {
|
|
2464
|
+
return false;
|
|
2480
2465
|
}
|
|
2481
2466
|
};
|
|
2482
|
-
var
|
|
2483
|
-
constructor(
|
|
2484
|
-
this.
|
|
2467
|
+
var SemanticDepGraph = class {
|
|
2468
|
+
constructor() {
|
|
2469
|
+
this.files = /* @__PURE__ */ new Map();
|
|
2470
|
+
this.symbolByDecl = /* @__PURE__ */ new Map();
|
|
2485
2471
|
}
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2472
|
+
registerSymbol(symbol) {
|
|
2473
|
+
this.symbolByDecl.set(symbol.decl, symbol);
|
|
2474
|
+
if (symbol.identifier !== null) {
|
|
2475
|
+
if (!this.files.has(symbol.path)) {
|
|
2476
|
+
this.files.set(symbol.path, /* @__PURE__ */ new Map());
|
|
2477
|
+
}
|
|
2478
|
+
this.files.get(symbol.path).set(symbol.identifier, symbol);
|
|
2489
2479
|
}
|
|
2490
2480
|
}
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2481
|
+
getEquivalentSymbol(symbol) {
|
|
2482
|
+
let previousSymbol = this.getSymbolByDecl(symbol.decl);
|
|
2483
|
+
if (previousSymbol === null && symbol.identifier !== null) {
|
|
2484
|
+
previousSymbol = this.getSymbolByName(symbol.path, symbol.identifier);
|
|
2494
2485
|
}
|
|
2486
|
+
return previousSymbol;
|
|
2495
2487
|
}
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2488
|
+
getSymbolByName(path, identifier) {
|
|
2489
|
+
if (!this.files.has(path)) {
|
|
2490
|
+
return null;
|
|
2499
2491
|
}
|
|
2492
|
+
const file = this.files.get(path);
|
|
2493
|
+
if (!file.has(identifier)) {
|
|
2494
|
+
return null;
|
|
2495
|
+
}
|
|
2496
|
+
return file.get(identifier);
|
|
2500
2497
|
}
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
this.
|
|
2506
|
-
}
|
|
2507
|
-
registerInjectable(declaration) {
|
|
2508
|
-
this.classes.add(declaration);
|
|
2509
|
-
}
|
|
2510
|
-
isInjectable(declaration) {
|
|
2511
|
-
return this.classes.has(declaration) || hasInjectableFields(declaration, this.host);
|
|
2498
|
+
getSymbolByDecl(decl) {
|
|
2499
|
+
if (!this.symbolByDecl.has(decl)) {
|
|
2500
|
+
return null;
|
|
2501
|
+
}
|
|
2502
|
+
return this.symbolByDecl.get(decl);
|
|
2512
2503
|
}
|
|
2513
2504
|
};
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
this.
|
|
2519
|
-
this.componentToTemplateMap = /* @__PURE__ */ new Map();
|
|
2520
|
-
this.componentToStylesMap = /* @__PURE__ */ new Map();
|
|
2521
|
-
this.externalStyleToComponentsMap = /* @__PURE__ */ new Map();
|
|
2505
|
+
var SemanticDepGraphUpdater = class {
|
|
2506
|
+
constructor(priorGraph) {
|
|
2507
|
+
this.priorGraph = priorGraph;
|
|
2508
|
+
this.newGraph = new SemanticDepGraph();
|
|
2509
|
+
this.opaqueSymbols = /* @__PURE__ */ new Map();
|
|
2522
2510
|
}
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
return /* @__PURE__ */ new Set();
|
|
2526
|
-
}
|
|
2527
|
-
return this.externalTemplateToComponentsMap.get(template);
|
|
2511
|
+
registerSymbol(symbol) {
|
|
2512
|
+
this.newGraph.registerSymbol(symbol);
|
|
2528
2513
|
}
|
|
2529
|
-
|
|
2530
|
-
if (
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2514
|
+
finalize() {
|
|
2515
|
+
if (this.priorGraph === null) {
|
|
2516
|
+
return {
|
|
2517
|
+
needsEmit: /* @__PURE__ */ new Set(),
|
|
2518
|
+
needsTypeCheckEmit: /* @__PURE__ */ new Set(),
|
|
2519
|
+
newGraph: this.newGraph
|
|
2520
|
+
};
|
|
2535
2521
|
}
|
|
2522
|
+
const needsEmit = this.determineInvalidatedFiles(this.priorGraph);
|
|
2523
|
+
const needsTypeCheckEmit = this.determineInvalidatedTypeCheckFiles(this.priorGraph);
|
|
2524
|
+
return {
|
|
2525
|
+
needsEmit,
|
|
2526
|
+
needsTypeCheckEmit,
|
|
2527
|
+
newGraph: this.newGraph
|
|
2528
|
+
};
|
|
2536
2529
|
}
|
|
2537
|
-
|
|
2538
|
-
const
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2530
|
+
determineInvalidatedFiles(priorGraph) {
|
|
2531
|
+
const isPublicApiAffected = /* @__PURE__ */ new Set();
|
|
2532
|
+
for (const symbol of this.newGraph.symbolByDecl.values()) {
|
|
2533
|
+
const previousSymbol = priorGraph.getEquivalentSymbol(symbol);
|
|
2534
|
+
if (previousSymbol === null || symbol.isPublicApiAffected(previousSymbol)) {
|
|
2535
|
+
isPublicApiAffected.add(symbol);
|
|
2542
2536
|
}
|
|
2543
|
-
this.externalTemplateToComponentsMap.get(path).add(component);
|
|
2544
2537
|
}
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2538
|
+
const needsEmit = /* @__PURE__ */ new Set();
|
|
2539
|
+
for (const symbol of this.newGraph.symbolByDecl.values()) {
|
|
2540
|
+
if (symbol.isEmitAffected === void 0) {
|
|
2541
|
+
continue;
|
|
2542
|
+
}
|
|
2543
|
+
const previousSymbol = priorGraph.getEquivalentSymbol(symbol);
|
|
2544
|
+
if (previousSymbol === null || symbol.isEmitAffected(previousSymbol, isPublicApiAffected)) {
|
|
2545
|
+
needsEmit.add(symbol.path);
|
|
2546
|
+
}
|
|
2550
2547
|
}
|
|
2551
|
-
return
|
|
2548
|
+
return needsEmit;
|
|
2552
2549
|
}
|
|
2553
|
-
|
|
2554
|
-
const
|
|
2555
|
-
|
|
2556
|
-
|
|
2550
|
+
determineInvalidatedTypeCheckFiles(priorGraph) {
|
|
2551
|
+
const isTypeCheckApiAffected = /* @__PURE__ */ new Set();
|
|
2552
|
+
for (const symbol of this.newGraph.symbolByDecl.values()) {
|
|
2553
|
+
const previousSymbol = priorGraph.getEquivalentSymbol(symbol);
|
|
2554
|
+
if (previousSymbol === null || symbol.isTypeCheckApiAffected(previousSymbol)) {
|
|
2555
|
+
isTypeCheckApiAffected.add(symbol);
|
|
2556
|
+
}
|
|
2557
2557
|
}
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2558
|
+
const needsTypeCheckEmit = /* @__PURE__ */ new Set();
|
|
2559
|
+
for (const symbol of this.newGraph.symbolByDecl.values()) {
|
|
2560
|
+
if (symbol.isTypeCheckBlockAffected === void 0) {
|
|
2561
|
+
continue;
|
|
2562
|
+
}
|
|
2563
|
+
const previousSymbol = priorGraph.getEquivalentSymbol(symbol);
|
|
2564
|
+
if (previousSymbol === null || symbol.isTypeCheckBlockAffected(previousSymbol, isTypeCheckApiAffected)) {
|
|
2565
|
+
needsTypeCheckEmit.add(symbol.path);
|
|
2561
2566
|
}
|
|
2562
|
-
this.externalStyleToComponentsMap.get(path).add(component);
|
|
2563
2567
|
}
|
|
2564
|
-
|
|
2568
|
+
return needsTypeCheckEmit;
|
|
2565
2569
|
}
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2570
|
+
getSemanticReference(decl, expr) {
|
|
2571
|
+
return {
|
|
2572
|
+
symbol: this.getSymbol(decl),
|
|
2573
|
+
importPath: getImportPath(expr)
|
|
2574
|
+
};
|
|
2575
|
+
}
|
|
2576
|
+
getSymbol(decl) {
|
|
2577
|
+
const symbol = this.newGraph.getSymbolByDecl(decl);
|
|
2578
|
+
if (symbol === null) {
|
|
2579
|
+
return this.getOpaqueSymbol(decl);
|
|
2569
2580
|
}
|
|
2570
|
-
return
|
|
2581
|
+
return symbol;
|
|
2571
2582
|
}
|
|
2572
|
-
|
|
2573
|
-
if (
|
|
2574
|
-
return
|
|
2583
|
+
getOpaqueSymbol(decl) {
|
|
2584
|
+
if (this.opaqueSymbols.has(decl)) {
|
|
2585
|
+
return this.opaqueSymbols.get(decl);
|
|
2575
2586
|
}
|
|
2576
|
-
|
|
2587
|
+
const symbol = new OpaqueSymbol(decl);
|
|
2588
|
+
this.opaqueSymbols.set(decl, symbol);
|
|
2589
|
+
return symbol;
|
|
2577
2590
|
}
|
|
2578
2591
|
};
|
|
2592
|
+
function getImportPath(expr) {
|
|
2593
|
+
if (expr instanceof ExternalExpr2) {
|
|
2594
|
+
return `${expr.value.moduleName}$${expr.value.name}`;
|
|
2595
|
+
} else {
|
|
2596
|
+
return null;
|
|
2597
|
+
}
|
|
2598
|
+
}
|
|
2579
2599
|
|
|
2580
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2600
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/semantic_graph/src/type_parameters.mjs
|
|
2601
|
+
import ts11 from "typescript";
|
|
2602
|
+
|
|
2603
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/semantic_graph/src/util.mjs
|
|
2604
|
+
function isSymbolEqual(a, b) {
|
|
2605
|
+
if (a.decl === b.decl) {
|
|
2606
|
+
return true;
|
|
2586
2607
|
}
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
return this.cache.get(metadata.ref.node);
|
|
2590
|
-
}
|
|
2591
|
-
const results = metadata.hostDirectives && metadata.hostDirectives.length > 0 ? this.walkHostDirectives(metadata.hostDirectives, []) : EMPTY_ARRAY;
|
|
2592
|
-
this.cache.set(metadata.ref.node, results);
|
|
2593
|
-
return results;
|
|
2608
|
+
if (a.identifier === null || b.identifier === null) {
|
|
2609
|
+
return false;
|
|
2594
2610
|
}
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
}
|
|
2601
|
-
if (hostMeta.hostDirectives) {
|
|
2602
|
-
this.walkHostDirectives(hostMeta.hostDirectives, results);
|
|
2603
|
-
}
|
|
2604
|
-
results.push({
|
|
2605
|
-
...hostMeta,
|
|
2606
|
-
matchSource: MatchSource.HostDirective,
|
|
2607
|
-
inputs: this.filterMappings(hostMeta.inputs, current.inputs),
|
|
2608
|
-
outputs: this.filterMappings(hostMeta.outputs, current.outputs)
|
|
2609
|
-
});
|
|
2610
|
-
}
|
|
2611
|
-
return results;
|
|
2611
|
+
return a.path === b.path && a.identifier === b.identifier;
|
|
2612
|
+
}
|
|
2613
|
+
function isReferenceEqual(a, b) {
|
|
2614
|
+
if (!isSymbolEqual(a.symbol, b.symbol)) {
|
|
2615
|
+
return false;
|
|
2612
2616
|
}
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2617
|
+
return a.importPath === b.importPath;
|
|
2618
|
+
}
|
|
2619
|
+
function referenceEquality(a, b) {
|
|
2620
|
+
return a === b;
|
|
2621
|
+
}
|
|
2622
|
+
function isArrayEqual(a, b, equalityTester = referenceEquality) {
|
|
2623
|
+
if (a === null || b === null) {
|
|
2624
|
+
return a === b;
|
|
2625
|
+
}
|
|
2626
|
+
if (a.length !== b.length) {
|
|
2627
|
+
return false;
|
|
2628
|
+
}
|
|
2629
|
+
return !a.some((item, index) => !equalityTester(item, b[index]));
|
|
2630
|
+
}
|
|
2631
|
+
function isSetEqual(a, b, equalityTester = referenceEquality) {
|
|
2632
|
+
if (a === null || b === null) {
|
|
2633
|
+
return a === b;
|
|
2634
|
+
}
|
|
2635
|
+
if (a.size !== b.size) {
|
|
2636
|
+
return false;
|
|
2637
|
+
}
|
|
2638
|
+
for (const itemA of a) {
|
|
2639
|
+
let found = false;
|
|
2640
|
+
for (const itemB of b) {
|
|
2641
|
+
if (equalityTester(itemA, itemB)) {
|
|
2642
|
+
found = true;
|
|
2643
|
+
break;
|
|
2625
2644
|
}
|
|
2626
2645
|
}
|
|
2627
|
-
|
|
2646
|
+
if (!found) {
|
|
2647
|
+
return false;
|
|
2648
|
+
}
|
|
2628
2649
|
}
|
|
2629
|
-
|
|
2650
|
+
return true;
|
|
2651
|
+
}
|
|
2652
|
+
|
|
2653
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/semantic_graph/src/type_parameters.mjs
|
|
2654
|
+
function extractSemanticTypeParameters(node) {
|
|
2655
|
+
if (!ts11.isClassDeclaration(node) || node.typeParameters === void 0) {
|
|
2656
|
+
return null;
|
|
2657
|
+
}
|
|
2658
|
+
return node.typeParameters.map((typeParam) => ({ hasGenericTypeBound: typeParam.constraint !== void 0 }));
|
|
2659
|
+
}
|
|
2660
|
+
function areTypeParametersEqual(current, previous) {
|
|
2661
|
+
if (!isArrayEqual(current, previous, isTypeParameterEqual)) {
|
|
2662
|
+
return false;
|
|
2663
|
+
}
|
|
2664
|
+
if (current !== null && current.some((typeParam) => typeParam.hasGenericTypeBound)) {
|
|
2665
|
+
return false;
|
|
2666
|
+
}
|
|
2667
|
+
return true;
|
|
2668
|
+
}
|
|
2669
|
+
function isTypeParameterEqual(a, b) {
|
|
2670
|
+
return a.hasGenericTypeBound === b.hasGenericTypeBound;
|
|
2671
|
+
}
|
|
2630
2672
|
|
|
2631
2673
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/api.mjs
|
|
2632
2674
|
var ComponentScopeKind;
|
|
@@ -4627,7 +4669,7 @@ var LIFECYCLE_HOOKS = /* @__PURE__ */ new Set([
|
|
|
4627
4669
|
"ngAfterContentChecked"
|
|
4628
4670
|
]);
|
|
4629
4671
|
var DirectiveDecoratorHandler = class {
|
|
4630
|
-
constructor(reflector, evaluator, metaRegistry, scopeRegistry, metaReader, injectableRegistry, refEmitter, isCore, semanticDepGraphUpdater, annotateForClosureCompiler, compileUndecoratedClassesWithAngularFeatures, perf) {
|
|
4672
|
+
constructor(reflector, evaluator, metaRegistry, scopeRegistry, metaReader, injectableRegistry, refEmitter, isCore, strictCtorDeps, semanticDepGraphUpdater, annotateForClosureCompiler, compileUndecoratedClassesWithAngularFeatures, perf) {
|
|
4631
4673
|
this.reflector = reflector;
|
|
4632
4674
|
this.evaluator = evaluator;
|
|
4633
4675
|
this.metaRegistry = metaRegistry;
|
|
@@ -4636,6 +4678,7 @@ var DirectiveDecoratorHandler = class {
|
|
|
4636
4678
|
this.injectableRegistry = injectableRegistry;
|
|
4637
4679
|
this.refEmitter = refEmitter;
|
|
4638
4680
|
this.isCore = isCore;
|
|
4681
|
+
this.strictCtorDeps = strictCtorDeps;
|
|
4639
4682
|
this.semanticDepGraphUpdater = semanticDepGraphUpdater;
|
|
4640
4683
|
this.annotateForClosureCompiler = annotateForClosureCompiler;
|
|
4641
4684
|
this.compileUndecoratedClassesWithAngularFeatures = compileUndecoratedClassesWithAngularFeatures;
|
|
@@ -4715,7 +4758,9 @@ var DirectiveDecoratorHandler = class {
|
|
|
4715
4758
|
schemas: null,
|
|
4716
4759
|
decorator: analysis.decorator
|
|
4717
4760
|
});
|
|
4718
|
-
this.injectableRegistry.registerInjectable(node
|
|
4761
|
+
this.injectableRegistry.registerInjectable(node, {
|
|
4762
|
+
ctorDeps: analysis.meta.deps
|
|
4763
|
+
});
|
|
4719
4764
|
}
|
|
4720
4765
|
resolve(node, analysis, symbol) {
|
|
4721
4766
|
if (this.semanticDepGraphUpdater !== null && analysis.baseClass instanceof Reference) {
|
|
@@ -4726,7 +4771,7 @@ var DirectiveDecoratorHandler = class {
|
|
|
4726
4771
|
const providerDiagnostics = getProviderDiagnostics(analysis.providersRequiringFactory, analysis.meta.providers.node, this.injectableRegistry);
|
|
4727
4772
|
diagnostics.push(...providerDiagnostics);
|
|
4728
4773
|
}
|
|
4729
|
-
const directiveDiagnostics = getDirectiveDiagnostics(node, this.
|
|
4774
|
+
const directiveDiagnostics = getDirectiveDiagnostics(node, this.injectableRegistry, this.evaluator, this.reflector, this.scopeRegistry, this.strictCtorDeps, "Directive");
|
|
4730
4775
|
if (directiveDiagnostics !== null) {
|
|
4731
4776
|
diagnostics.push(...directiveDiagnostics);
|
|
4732
4777
|
}
|
|
@@ -5116,7 +5161,9 @@ var NgModuleDecoratorHandler = class {
|
|
|
5116
5161
|
name: analysis.factorySymbolName
|
|
5117
5162
|
});
|
|
5118
5163
|
}
|
|
5119
|
-
this.injectableRegistry.registerInjectable(node
|
|
5164
|
+
this.injectableRegistry.registerInjectable(node, {
|
|
5165
|
+
ctorDeps: analysis.fac.deps
|
|
5166
|
+
});
|
|
5120
5167
|
}
|
|
5121
5168
|
resolve(node, analysis) {
|
|
5122
5169
|
const scope = this.scopeRegistry.getScopeOfModule(node);
|
|
@@ -5734,7 +5781,7 @@ var animationTriggerResolver = (fn, node, resolve, unresolvable) => {
|
|
|
5734
5781
|
function validateAndFlattenComponentImports(imports, expr) {
|
|
5735
5782
|
const flattened = [];
|
|
5736
5783
|
if (!Array.isArray(imports)) {
|
|
5737
|
-
const error = createValueHasWrongTypeError(expr, imports, `'imports' must be an array of components, directives, pipes, or NgModules
|
|
5784
|
+
const error = createValueHasWrongTypeError(expr, imports, `'imports' must be an array of components, directives, pipes, or NgModules.`).toDiagnostic();
|
|
5738
5785
|
return {
|
|
5739
5786
|
imports: [],
|
|
5740
5787
|
diagnostics: [error]
|
|
@@ -5750,7 +5797,7 @@ function validateAndFlattenComponentImports(imports, expr) {
|
|
|
5750
5797
|
if (isNamedClassDeclaration(ref.node)) {
|
|
5751
5798
|
flattened.push(ref);
|
|
5752
5799
|
} else {
|
|
5753
|
-
diagnostics.push(createValueHasWrongTypeError(ref.getOriginForDiagnostics(expr), ref, `'imports' must be an array of components, directives, pipes, or NgModules
|
|
5800
|
+
diagnostics.push(createValueHasWrongTypeError(ref.getOriginForDiagnostics(expr), ref, `'imports' must be an array of components, directives, pipes, or NgModules.`).toDiagnostic());
|
|
5754
5801
|
}
|
|
5755
5802
|
} else if (isLikelyModuleWithProviders(ref)) {
|
|
5756
5803
|
let origin = expr;
|
|
@@ -5759,7 +5806,7 @@ function validateAndFlattenComponentImports(imports, expr) {
|
|
|
5759
5806
|
}
|
|
5760
5807
|
diagnostics.push(makeDiagnostic(ErrorCode.COMPONENT_UNKNOWN_IMPORT, origin, `'imports' contains a ModuleWithProviders value, likely the result of a 'Module.forRoot()'-style call. These calls are not used to configure components and are not valid in standalone component imports - consider importing them in the application bootstrap instead.`));
|
|
5761
5808
|
} else {
|
|
5762
|
-
diagnostics.push(createValueHasWrongTypeError(expr, imports, `'imports' must be an array of components, directives, pipes, or NgModules
|
|
5809
|
+
diagnostics.push(createValueHasWrongTypeError(expr, imports, `'imports' must be an array of components, directives, pipes, or NgModules.`).toDiagnostic());
|
|
5763
5810
|
}
|
|
5764
5811
|
}
|
|
5765
5812
|
return { imports: flattened, diagnostics };
|
|
@@ -5777,7 +5824,7 @@ function isLikelyModuleWithProviders(value) {
|
|
|
5777
5824
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/handler.mjs
|
|
5778
5825
|
var EMPTY_ARRAY2 = [];
|
|
5779
5826
|
var ComponentDecoratorHandler = class {
|
|
5780
|
-
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) {
|
|
5827
|
+
constructor(reflector, evaluator, metaRegistry, metaReader, scopeReader, dtsScopeReader, scopeRegistry, typeCheckScopeRegistry, resourceRegistry, isCore, strictCtorDeps, resourceLoader, rootDirs, defaultPreserveWhitespaces, i18nUseExternalIds, enableI18nLegacyMessageIdFormat, usePoisonedData, i18nNormalizeLineEndingsInICUs, moduleResolver, cycleAnalyzer, cycleHandlingStrategy, refEmitter, depTracker, injectableRegistry, semanticDepGraphUpdater, annotateForClosureCompiler, perf, hostDirectivesResolver) {
|
|
5781
5828
|
this.reflector = reflector;
|
|
5782
5829
|
this.evaluator = evaluator;
|
|
5783
5830
|
this.metaRegistry = metaRegistry;
|
|
@@ -5788,6 +5835,7 @@ var ComponentDecoratorHandler = class {
|
|
|
5788
5835
|
this.typeCheckScopeRegistry = typeCheckScopeRegistry;
|
|
5789
5836
|
this.resourceRegistry = resourceRegistry;
|
|
5790
5837
|
this.isCore = isCore;
|
|
5838
|
+
this.strictCtorDeps = strictCtorDeps;
|
|
5791
5839
|
this.resourceLoader = resourceLoader;
|
|
5792
5840
|
this.rootDirs = rootDirs;
|
|
5793
5841
|
this.defaultPreserveWhitespaces = defaultPreserveWhitespaces;
|
|
@@ -6097,7 +6145,9 @@ var ComponentDecoratorHandler = class {
|
|
|
6097
6145
|
decorator: analysis.decorator
|
|
6098
6146
|
});
|
|
6099
6147
|
this.resourceRegistry.registerResources(analysis.resources, node);
|
|
6100
|
-
this.injectableRegistry.registerInjectable(node
|
|
6148
|
+
this.injectableRegistry.registerInjectable(node, {
|
|
6149
|
+
ctorDeps: analysis.meta.deps
|
|
6150
|
+
});
|
|
6101
6151
|
}
|
|
6102
6152
|
index(context, node, analysis) {
|
|
6103
6153
|
if (analysis.isPoisoned && !this.usePoisonedData) {
|
|
@@ -6304,7 +6354,7 @@ var ComponentDecoratorHandler = class {
|
|
|
6304
6354
|
const viewProviderDiagnostics = getProviderDiagnostics(analysis.viewProvidersRequiringFactory, analysis.meta.viewProviders.node, this.injectableRegistry);
|
|
6305
6355
|
diagnostics.push(...viewProviderDiagnostics);
|
|
6306
6356
|
}
|
|
6307
|
-
const directiveDiagnostics = getDirectiveDiagnostics(node, this.
|
|
6357
|
+
const directiveDiagnostics = getDirectiveDiagnostics(node, this.injectableRegistry, this.evaluator, this.reflector, this.scopeRegistry, this.strictCtorDeps, "Component");
|
|
6308
6358
|
if (directiveDiagnostics !== null) {
|
|
6309
6359
|
diagnostics.push(...directiveDiagnostics);
|
|
6310
6360
|
}
|
|
@@ -6419,8 +6469,9 @@ function validateStandaloneImports(importRefs, importExpr, metaReader, scopeRead
|
|
|
6419
6469
|
import { compileClassMetadata as compileClassMetadata4, compileDeclareClassMetadata as compileDeclareClassMetadata4, compileDeclareInjectableFromMetadata, compileInjectable, createMayBeForwardRefExpression as createMayBeForwardRefExpression2, FactoryTarget as FactoryTarget4, LiteralExpr as LiteralExpr3, WrappedNodeExpr as WrappedNodeExpr8 } from "@angular/compiler";
|
|
6420
6470
|
import ts25 from "typescript";
|
|
6421
6471
|
var InjectableDecoratorHandler = class {
|
|
6422
|
-
constructor(reflector, isCore, strictCtorDeps, injectableRegistry, perf, errorOnDuplicateProv = true) {
|
|
6472
|
+
constructor(reflector, evaluator, isCore, strictCtorDeps, injectableRegistry, perf, errorOnDuplicateProv = true) {
|
|
6423
6473
|
this.reflector = reflector;
|
|
6474
|
+
this.evaluator = evaluator;
|
|
6424
6475
|
this.isCore = isCore;
|
|
6425
6476
|
this.strictCtorDeps = strictCtorDeps;
|
|
6426
6477
|
this.injectableRegistry = injectableRegistry;
|
|
@@ -6460,8 +6511,21 @@ var InjectableDecoratorHandler = class {
|
|
|
6460
6511
|
symbol() {
|
|
6461
6512
|
return null;
|
|
6462
6513
|
}
|
|
6463
|
-
register(node) {
|
|
6464
|
-
this.injectableRegistry.registerInjectable(node
|
|
6514
|
+
register(node, analysis) {
|
|
6515
|
+
this.injectableRegistry.registerInjectable(node, {
|
|
6516
|
+
ctorDeps: analysis.ctorDeps
|
|
6517
|
+
});
|
|
6518
|
+
}
|
|
6519
|
+
resolve(node, analysis, symbol) {
|
|
6520
|
+
if (requiresValidCtor(analysis.meta)) {
|
|
6521
|
+
const diagnostic = checkInheritanceOfInjectable(node, this.injectableRegistry, this.reflector, this.evaluator, this.strictCtorDeps, "Injectable");
|
|
6522
|
+
if (diagnostic !== null) {
|
|
6523
|
+
return {
|
|
6524
|
+
diagnostics: [diagnostic]
|
|
6525
|
+
};
|
|
6526
|
+
}
|
|
6527
|
+
}
|
|
6528
|
+
return {};
|
|
6465
6529
|
}
|
|
6466
6530
|
compileFull(node, analysis) {
|
|
6467
6531
|
return this.compile(compileNgFactoryDefField, (meta) => compileInjectable(meta, false), compileClassMetadata4, node, analysis);
|
|
@@ -6548,7 +6612,7 @@ function extractInjectableCtorDeps(clazz, meta, decorator, reflector, isCore, st
|
|
|
6548
6612
|
}
|
|
6549
6613
|
let ctorDeps = null;
|
|
6550
6614
|
if (decorator.args.length === 0) {
|
|
6551
|
-
if (strictCtorDeps) {
|
|
6615
|
+
if (strictCtorDeps && !isAbstractClassDeclaration(clazz)) {
|
|
6552
6616
|
ctorDeps = getValidConstructorDependencies(clazz, reflector, isCore);
|
|
6553
6617
|
} else {
|
|
6554
6618
|
ctorDeps = unwrapConstructorDependencies(getConstructorDependencies(clazz, reflector, isCore));
|
|
@@ -6556,7 +6620,7 @@ function extractInjectableCtorDeps(clazz, meta, decorator, reflector, isCore, st
|
|
|
6556
6620
|
return ctorDeps;
|
|
6557
6621
|
} else if (decorator.args.length === 1) {
|
|
6558
6622
|
const rawCtorDeps = getConstructorDependencies(clazz, reflector, isCore);
|
|
6559
|
-
if (strictCtorDeps &&
|
|
6623
|
+
if (strictCtorDeps && !isAbstractClassDeclaration(clazz) && requiresValidCtor(meta)) {
|
|
6560
6624
|
ctorDeps = validateConstructorDependencies(clazz, rawCtorDeps);
|
|
6561
6625
|
} else {
|
|
6562
6626
|
ctorDeps = unwrapConstructorDependencies(rawCtorDeps);
|
|
@@ -6564,6 +6628,9 @@ function extractInjectableCtorDeps(clazz, meta, decorator, reflector, isCore, st
|
|
|
6564
6628
|
}
|
|
6565
6629
|
return ctorDeps;
|
|
6566
6630
|
}
|
|
6631
|
+
function requiresValidCtor(meta) {
|
|
6632
|
+
return meta.useValue === void 0 && meta.useExisting === void 0 && meta.useClass === void 0 && meta.useFactory === void 0;
|
|
6633
|
+
}
|
|
6567
6634
|
function getDep(dep, reflector) {
|
|
6568
6635
|
const meta = {
|
|
6569
6636
|
token: new WrappedNodeExpr8(dep),
|
|
@@ -6734,7 +6801,9 @@ var PipeDecoratorHandler = class {
|
|
|
6734
6801
|
isStandalone: analysis.meta.isStandalone,
|
|
6735
6802
|
decorator: analysis.decorator
|
|
6736
6803
|
});
|
|
6737
|
-
this.injectableRegistry.registerInjectable(node
|
|
6804
|
+
this.injectableRegistry.registerInjectable(node, {
|
|
6805
|
+
ctorDeps: analysis.meta.deps
|
|
6806
|
+
});
|
|
6738
6807
|
}
|
|
6739
6808
|
resolve(node) {
|
|
6740
6809
|
const duplicateDeclData = this.scopeRegistry.getDuplicateDeclarations(node);
|
|
@@ -6765,16 +6834,16 @@ export {
|
|
|
6765
6834
|
DynamicValue,
|
|
6766
6835
|
StaticInterpreter,
|
|
6767
6836
|
PartialEvaluator,
|
|
6768
|
-
NoopReferencesRegistry,
|
|
6769
|
-
SemanticDepGraphUpdater,
|
|
6770
6837
|
MetaKind,
|
|
6771
6838
|
CompoundMetadataReader,
|
|
6772
6839
|
DtsMetadataReader,
|
|
6773
6840
|
LocalMetadataRegistry,
|
|
6774
6841
|
CompoundMetadataRegistry,
|
|
6775
|
-
InjectableClassRegistry,
|
|
6776
6842
|
ResourceRegistry,
|
|
6777
6843
|
HostDirectivesResolver,
|
|
6844
|
+
InjectableClassRegistry,
|
|
6845
|
+
NoopReferencesRegistry,
|
|
6846
|
+
SemanticDepGraphUpdater,
|
|
6778
6847
|
ComponentScopeKind,
|
|
6779
6848
|
CompoundComponentScopeReader,
|
|
6780
6849
|
MetadataDtsModuleScopeResolver,
|
|
@@ -6808,4 +6877,4 @@ export {
|
|
|
6808
6877
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6809
6878
|
* found in the LICENSE file at https://angular.io/license
|
|
6810
6879
|
*/
|
|
6811
|
-
//# sourceMappingURL=chunk-
|
|
6880
|
+
//# sourceMappingURL=chunk-R4GD76QD.js.map
|