@angular/compiler-cli 13.0.2 → 13.0.3
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/index.js +628 -673
- package/bundles/index.js.map +2 -2
- package/bundles/linker/babel/index.js +2 -2
- package/bundles/linker/babel/index.js.map +1 -1
- package/bundles/linker/index.js +2 -2
- package/bundles/linker/index.js.map +1 -1
- package/bundles/ngcc/index.js +886 -868
- package/bundles/ngcc/index.js.map +2 -2
- package/bundles/ngcc/main-ngcc.js +886 -868
- package/bundles/ngcc/main-ngcc.js.map +2 -2
- package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js +518 -500
- package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js.map +2 -2
- package/bundles/private/migrations.js +20 -0
- package/bundles/private/migrations.js.map +1 -1
- package/bundles/private/tooling.js +2 -2
- package/bundles/private/tooling.js.map +1 -1
- package/bundles/src/bin/ng_xi18n.js +638 -683
- package/bundles/src/bin/ng_xi18n.js.map +2 -2
- package/bundles/src/bin/ngc.js +638 -683
- package/bundles/src/bin/ngc.js.map +2 -2
- package/bundles_metadata.json +1 -1
- package/ngcc/src/host/delegating_host.d.ts +1 -2
- package/ngcc/src/host/esm2015_host.d.ts +1 -8
- package/ngcc/src/host/ngcc_host.d.ts +0 -13
- package/ngcc/src/host/umd_host.d.ts +3 -0
- package/ngcc/src/packages/build_marker.d.ts +1 -1
- package/ngcc/src/packages/transformer.d.ts +0 -2
- package/ngcc/src/rendering/esm_rendering_formatter.d.ts +1 -5
- package/ngcc/src/rendering/renderer.d.ts +2 -3
- package/ngcc/src/rendering/rendering_formatter.d.ts +0 -2
- package/ngcc/src/utils.d.ts +0 -7
- package/package.json +2 -2
- package/src/ngtsc/partial_evaluator/src/builtin.d.ts +5 -0
- package/ngcc/src/analysis/switch_marker_analyzer.d.ts +0 -35
- package/src/ngtsc/switch/index.d.ts +0 -9
- package/src/ngtsc/switch/src/switch.d.ts +0 -10
|
@@ -1237,18 +1237,6 @@ function isDefined(value) {
|
|
|
1237
1237
|
function getNameText(name) {
|
|
1238
1238
|
return ts8.isIdentifier(name) || ts8.isLiteralExpression(name) ? name.text : name.getText();
|
|
1239
1239
|
}
|
|
1240
|
-
function findAll(node, test) {
|
|
1241
|
-
const nodes = [];
|
|
1242
|
-
findAllVisitor(node);
|
|
1243
|
-
return nodes;
|
|
1244
|
-
function findAllVisitor(n) {
|
|
1245
|
-
if (test(n)) {
|
|
1246
|
-
nodes.push(n);
|
|
1247
|
-
} else {
|
|
1248
|
-
n.forEachChild((child) => findAllVisitor(child));
|
|
1249
|
-
}
|
|
1250
|
-
}
|
|
1251
|
-
}
|
|
1252
1240
|
function hasNameIdentifier(declaration) {
|
|
1253
1241
|
const namedDeclaration = declaration;
|
|
1254
1242
|
return namedDeclaration.name !== void 0 && ts8.isIdentifier(namedDeclaration.name);
|
|
@@ -1547,13 +1535,13 @@ import { DepGraph } from "dependency-graph";
|
|
|
1547
1535
|
import module2 from "module";
|
|
1548
1536
|
|
|
1549
1537
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/entry_point.mjs
|
|
1550
|
-
import
|
|
1538
|
+
import ts14 from "typescript";
|
|
1551
1539
|
|
|
1552
1540
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/host/umd_host.mjs
|
|
1553
|
-
import
|
|
1541
|
+
import ts13 from "typescript";
|
|
1554
1542
|
|
|
1555
1543
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/host/esm2015_host.mjs
|
|
1556
|
-
import
|
|
1544
|
+
import ts11 from "typescript";
|
|
1557
1545
|
|
|
1558
1546
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/analysis/util.mjs
|
|
1559
1547
|
function isWithinPackage(packagePath, filePath) {
|
|
@@ -1570,18 +1558,10 @@ var NoopDependencyTracker = class {
|
|
|
1570
1558
|
};
|
|
1571
1559
|
var NOOP_DEPENDENCY_TRACKER = new NoopDependencyTracker();
|
|
1572
1560
|
|
|
1573
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/host/ngcc_host.mjs
|
|
1574
|
-
import ts10 from "typescript";
|
|
1575
|
-
var PRE_R3_MARKER = "__PRE_R3__";
|
|
1576
|
-
var POST_R3_MARKER = "__POST_R3__";
|
|
1577
|
-
function isSwitchableVariableDeclaration(node) {
|
|
1578
|
-
return ts10.isVariableDeclaration(node) && !!node.initializer && ts10.isIdentifier(node.initializer) && node.initializer.text.endsWith(PRE_R3_MARKER);
|
|
1579
|
-
}
|
|
1580
|
-
|
|
1581
1561
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/host/utils.mjs
|
|
1582
|
-
import
|
|
1562
|
+
import ts10 from "typescript";
|
|
1583
1563
|
function stripParentheses(node) {
|
|
1584
|
-
return
|
|
1564
|
+
return ts10.isParenthesizedExpression(node) ? node.expression : node;
|
|
1585
1565
|
}
|
|
1586
1566
|
|
|
1587
1567
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/host/esm2015_host.mjs
|
|
@@ -1684,7 +1664,7 @@ ${declaration.getText()}`);
|
|
|
1684
1664
|
let declarationNode = superDeclaration.node;
|
|
1685
1665
|
if (isNamedVariableDeclaration(superDeclaration.node) && !isTopLevel(superDeclaration.node)) {
|
|
1686
1666
|
const variableValue = this.getVariableValue(superDeclaration.node);
|
|
1687
|
-
if (variableValue !== null &&
|
|
1667
|
+
if (variableValue !== null && ts11.isClassExpression(variableValue)) {
|
|
1688
1668
|
declarationNode = getContainingStatement(variableValue);
|
|
1689
1669
|
}
|
|
1690
1670
|
}
|
|
@@ -1697,7 +1677,7 @@ ${declaration.getText()}`);
|
|
|
1697
1677
|
if (aliasedIdentifier !== null) {
|
|
1698
1678
|
return this.getDeclarationOfIdentifier(aliasedIdentifier);
|
|
1699
1679
|
}
|
|
1700
|
-
if (isConcreteDeclaration(declaration) &&
|
|
1680
|
+
if (isConcreteDeclaration(declaration) && ts11.isVariableDeclaration(declaration.node)) {
|
|
1701
1681
|
const enumMembers = this.resolveEnumMembers(declaration.node);
|
|
1702
1682
|
if (enumMembers !== null) {
|
|
1703
1683
|
declaration.identity = { kind: 0, enumMembers };
|
|
@@ -1712,9 +1692,6 @@ ${declaration.getText()}`);
|
|
|
1712
1692
|
}
|
|
1713
1693
|
return Array.from(classDecorators);
|
|
1714
1694
|
}
|
|
1715
|
-
getSwitchableDeclarations(module7) {
|
|
1716
|
-
return module7.getText().indexOf(PRE_R3_MARKER) >= 0 ? findAll(module7, isSwitchableVariableDeclaration) : [];
|
|
1717
|
-
}
|
|
1718
1695
|
getVariableValue(declaration) {
|
|
1719
1696
|
const value = super.getVariableValue(declaration);
|
|
1720
1697
|
if (value) {
|
|
@@ -1722,16 +1699,16 @@ ${declaration.getText()}`);
|
|
|
1722
1699
|
}
|
|
1723
1700
|
const block = declaration.parent.parent.parent;
|
|
1724
1701
|
const symbol = this.checker.getSymbolAtLocation(declaration.name);
|
|
1725
|
-
if (symbol && (
|
|
1702
|
+
if (symbol && (ts11.isBlock(block) || ts11.isSourceFile(block))) {
|
|
1726
1703
|
const decorateCall = this.findDecoratedVariableValue(block, symbol);
|
|
1727
1704
|
const target = decorateCall && decorateCall.arguments[1];
|
|
1728
|
-
if (target &&
|
|
1705
|
+
if (target && ts11.isIdentifier(target)) {
|
|
1729
1706
|
const targetSymbol = this.checker.getSymbolAtLocation(target);
|
|
1730
1707
|
const targetDeclaration = targetSymbol && targetSymbol.valueDeclaration;
|
|
1731
1708
|
if (targetDeclaration) {
|
|
1732
|
-
if (
|
|
1709
|
+
if (ts11.isClassDeclaration(targetDeclaration) || ts11.isFunctionDeclaration(targetDeclaration)) {
|
|
1733
1710
|
return targetDeclaration.name || null;
|
|
1734
|
-
} else if (
|
|
1711
|
+
} else if (ts11.isVariableDeclaration(targetDeclaration)) {
|
|
1735
1712
|
let targetValue = targetDeclaration.initializer;
|
|
1736
1713
|
while (targetValue && isAssignment2(targetValue)) {
|
|
1737
1714
|
targetValue = targetValue.right;
|
|
@@ -1752,7 +1729,7 @@ ${declaration.getText()}`);
|
|
|
1752
1729
|
}
|
|
1753
1730
|
getGenericArityOfClass(clazz) {
|
|
1754
1731
|
const dtsDeclaration = this.getDtsDeclaration(clazz);
|
|
1755
|
-
if (dtsDeclaration &&
|
|
1732
|
+
if (dtsDeclaration && ts11.isClassDeclaration(dtsDeclaration)) {
|
|
1756
1733
|
return dtsDeclaration.typeParameters ? dtsDeclaration.typeParameters.length : 0;
|
|
1757
1734
|
}
|
|
1758
1735
|
return null;
|
|
@@ -1789,13 +1766,13 @@ ${declaration.getText()}`);
|
|
|
1789
1766
|
if (implementationStatement === null)
|
|
1790
1767
|
return last;
|
|
1791
1768
|
const container = implementationStatement.parent;
|
|
1792
|
-
if (
|
|
1793
|
-
const returnStatementIndex = container.statements.findIndex(
|
|
1769
|
+
if (ts11.isBlock(container)) {
|
|
1770
|
+
const returnStatementIndex = container.statements.findIndex(ts11.isReturnStatement);
|
|
1794
1771
|
if (returnStatementIndex === -1) {
|
|
1795
1772
|
throw new Error(`Compiled class wrapper IIFE does not have a return statement: ${classSymbol.name} in ${classSymbol.declaration.valueDeclaration.getSourceFile().fileName}`);
|
|
1796
1773
|
}
|
|
1797
1774
|
last = container.statements[returnStatementIndex - 1];
|
|
1798
|
-
} else if (
|
|
1775
|
+
} else if (ts11.isSourceFile(container)) {
|
|
1799
1776
|
if (implementation.exports !== void 0) {
|
|
1800
1777
|
implementation.exports.forEach((exportSymbol) => {
|
|
1801
1778
|
if (exportSymbol.valueDeclaration === void 0) {
|
|
@@ -1824,14 +1801,14 @@ ${declaration.getText()}`);
|
|
|
1824
1801
|
return decl;
|
|
1825
1802
|
}
|
|
1826
1803
|
addClassSymbolsFromStatement(classes, statement) {
|
|
1827
|
-
if (
|
|
1804
|
+
if (ts11.isVariableStatement(statement)) {
|
|
1828
1805
|
statement.declarationList.declarations.forEach((declaration) => {
|
|
1829
1806
|
const classSymbol = this.getClassSymbol(declaration);
|
|
1830
1807
|
if (classSymbol) {
|
|
1831
1808
|
classes.set(classSymbol.implementation, classSymbol);
|
|
1832
1809
|
}
|
|
1833
1810
|
});
|
|
1834
|
-
} else if (
|
|
1811
|
+
} else if (ts11.isClassDeclaration(statement)) {
|
|
1835
1812
|
const classSymbol = this.getClassSymbol(statement);
|
|
1836
1813
|
if (classSymbol) {
|
|
1837
1814
|
classes.set(classSymbol.implementation, classSymbol);
|
|
@@ -1862,7 +1839,7 @@ ${declaration.getText()}`);
|
|
|
1862
1839
|
}
|
|
1863
1840
|
getClassSymbolFromInnerDeclaration(declaration) {
|
|
1864
1841
|
let outerDeclaration = void 0;
|
|
1865
|
-
if (
|
|
1842
|
+
if (ts11.isClassExpression(declaration) && hasNameIdentifier(declaration)) {
|
|
1866
1843
|
outerDeclaration = getFarLeftHandSideOfAssignment(declaration);
|
|
1867
1844
|
if (outerDeclaration !== void 0 && !isTopLevel(outerDeclaration)) {
|
|
1868
1845
|
outerDeclaration = getContainingVariableDeclaration(outerDeclaration);
|
|
@@ -1904,7 +1881,7 @@ ${declaration.getText()}`);
|
|
|
1904
1881
|
return void 0;
|
|
1905
1882
|
}
|
|
1906
1883
|
const innerDeclaration = implementationSymbol.valueDeclaration;
|
|
1907
|
-
if (!
|
|
1884
|
+
if (!ts11.isClassExpression(innerDeclaration) && !ts11.isFunctionExpression(innerDeclaration)) {
|
|
1908
1885
|
return void 0;
|
|
1909
1886
|
}
|
|
1910
1887
|
const adjacentDeclaration = getFarLeftHandSideOfAssignment(innerDeclaration);
|
|
@@ -1937,7 +1914,7 @@ ${declaration.getText()}`);
|
|
|
1937
1914
|
}
|
|
1938
1915
|
}
|
|
1939
1916
|
preprocessStatement(statement) {
|
|
1940
|
-
if (!
|
|
1917
|
+
if (!ts11.isVariableStatement(statement)) {
|
|
1941
1918
|
return;
|
|
1942
1919
|
}
|
|
1943
1920
|
const declarations = statement.declarationList.declarations;
|
|
@@ -1946,7 +1923,7 @@ ${declaration.getText()}`);
|
|
|
1946
1923
|
}
|
|
1947
1924
|
const declaration = declarations[0];
|
|
1948
1925
|
const initializer = declaration.initializer;
|
|
1949
|
-
if (!
|
|
1926
|
+
if (!ts11.isIdentifier(declaration.name) || !initializer || !isAssignment2(initializer) || !ts11.isIdentifier(initializer.left) || !this.isClass(declaration)) {
|
|
1950
1927
|
return;
|
|
1951
1928
|
}
|
|
1952
1929
|
const aliasedIdentifier = initializer.left;
|
|
@@ -1963,11 +1940,11 @@ ${declaration.getText()}`);
|
|
|
1963
1940
|
if (!node) {
|
|
1964
1941
|
return null;
|
|
1965
1942
|
}
|
|
1966
|
-
if (
|
|
1943
|
+
if (ts11.isBinaryExpression(node) && node.operatorToken.kind === ts11.SyntaxKind.EqualsToken) {
|
|
1967
1944
|
const left = node.left;
|
|
1968
1945
|
const right = node.right;
|
|
1969
|
-
if (
|
|
1970
|
-
return
|
|
1946
|
+
if (ts11.isIdentifier(left) && this.checker.getSymbolAtLocation(left) === symbol) {
|
|
1947
|
+
return ts11.isCallExpression(right) && getCalleeName(right) === "__decorate" ? right : null;
|
|
1971
1948
|
}
|
|
1972
1949
|
return this.findDecoratedVariableValue(right, symbol);
|
|
1973
1950
|
}
|
|
@@ -2013,7 +1990,7 @@ ${declaration.getText()}`);
|
|
|
2013
1990
|
getClassDecoratorsFromStaticProperty(decoratorsSymbol) {
|
|
2014
1991
|
const decoratorsIdentifier = decoratorsSymbol.valueDeclaration;
|
|
2015
1992
|
if (decoratorsIdentifier && decoratorsIdentifier.parent) {
|
|
2016
|
-
if (
|
|
1993
|
+
if (ts11.isBinaryExpression(decoratorsIdentifier.parent) && decoratorsIdentifier.parent.operatorToken.kind === ts11.SyntaxKind.EqualsToken) {
|
|
2017
1994
|
const decoratorsArray = decoratorsIdentifier.parent.right;
|
|
2018
1995
|
return this.reflectDecorators(decoratorsArray).filter((decorator) => this.isFromCore(decorator));
|
|
2019
1996
|
}
|
|
@@ -2044,7 +2021,7 @@ ${declaration.getText()}`);
|
|
|
2044
2021
|
}
|
|
2045
2022
|
});
|
|
2046
2023
|
}
|
|
2047
|
-
if (
|
|
2024
|
+
if (ts11.isVariableDeclaration(symbol.declaration.valueDeclaration)) {
|
|
2048
2025
|
if (symbol.declaration.exports) {
|
|
2049
2026
|
symbol.declaration.exports.forEach((value, key) => {
|
|
2050
2027
|
const decorators = decoratorsMap.get(key);
|
|
@@ -2057,7 +2034,7 @@ ${declaration.getText()}`);
|
|
|
2057
2034
|
}
|
|
2058
2035
|
}
|
|
2059
2036
|
if (symbol.adjacent !== void 0) {
|
|
2060
|
-
if (
|
|
2037
|
+
if (ts11.isVariableDeclaration(symbol.adjacent.valueDeclaration)) {
|
|
2061
2038
|
if (symbol.adjacent.exports !== void 0) {
|
|
2062
2039
|
symbol.adjacent.exports.forEach((value, key) => {
|
|
2063
2040
|
const decorators = decoratorsMap.get(key);
|
|
@@ -2088,7 +2065,7 @@ ${declaration.getText()}`);
|
|
|
2088
2065
|
getMemberDecoratorsFromStaticProperty(decoratorsProperty) {
|
|
2089
2066
|
const memberDecorators = new Map();
|
|
2090
2067
|
const propDecoratorsMap = getPropertyValueFromSymbol(decoratorsProperty);
|
|
2091
|
-
if (propDecoratorsMap &&
|
|
2068
|
+
if (propDecoratorsMap && ts11.isObjectLiteralExpression(propDecoratorsMap)) {
|
|
2092
2069
|
const propertiesMap = reflectObjectLiteral(propDecoratorsMap);
|
|
2093
2070
|
propertiesMap.forEach((value, name) => {
|
|
2094
2071
|
const decorators = this.reflectDecorators(value).filter((decorator) => this.isFromCore(decorator));
|
|
@@ -2159,18 +2136,18 @@ ${declaration.getText()}`);
|
|
|
2159
2136
|
return { classDecorators, memberDecorators, constructorParamInfo };
|
|
2160
2137
|
}
|
|
2161
2138
|
reflectDecorateHelperEntry(expression) {
|
|
2162
|
-
if (!
|
|
2139
|
+
if (!ts11.isCallExpression(expression)) {
|
|
2163
2140
|
return null;
|
|
2164
2141
|
}
|
|
2165
2142
|
const call = expression;
|
|
2166
2143
|
const helperName = getCalleeName(call);
|
|
2167
2144
|
if (helperName === "__metadata") {
|
|
2168
2145
|
const key = call.arguments[0];
|
|
2169
|
-
if (key === void 0 || !
|
|
2146
|
+
if (key === void 0 || !ts11.isStringLiteral(key) || key.text !== "design:paramtypes") {
|
|
2170
2147
|
return null;
|
|
2171
2148
|
}
|
|
2172
2149
|
const value = call.arguments[1];
|
|
2173
|
-
if (value === void 0 || !
|
|
2150
|
+
if (value === void 0 || !ts11.isArrayLiteralExpression(value)) {
|
|
2174
2151
|
return null;
|
|
2175
2152
|
}
|
|
2176
2153
|
return {
|
|
@@ -2180,12 +2157,12 @@ ${declaration.getText()}`);
|
|
|
2180
2157
|
}
|
|
2181
2158
|
if (helperName === "__param") {
|
|
2182
2159
|
const indexArg = call.arguments[0];
|
|
2183
|
-
const index = indexArg &&
|
|
2160
|
+
const index = indexArg && ts11.isNumericLiteral(indexArg) ? parseInt(indexArg.text, 10) : NaN;
|
|
2184
2161
|
if (isNaN(index)) {
|
|
2185
2162
|
return null;
|
|
2186
2163
|
}
|
|
2187
2164
|
const decoratorCall = call.arguments[1];
|
|
2188
|
-
if (decoratorCall === void 0 || !
|
|
2165
|
+
if (decoratorCall === void 0 || !ts11.isCallExpression(decoratorCall)) {
|
|
2189
2166
|
return null;
|
|
2190
2167
|
}
|
|
2191
2168
|
const decorator2 = this.reflectDecoratorCall(decoratorCall);
|
|
@@ -2212,7 +2189,7 @@ ${declaration.getText()}`);
|
|
|
2212
2189
|
if (!isDecoratorIdentifier(decoratorExpression)) {
|
|
2213
2190
|
return null;
|
|
2214
2191
|
}
|
|
2215
|
-
const decoratorIdentifier =
|
|
2192
|
+
const decoratorIdentifier = ts11.isIdentifier(decoratorExpression) ? decoratorExpression : decoratorExpression.name;
|
|
2216
2193
|
return {
|
|
2217
2194
|
name: decoratorIdentifier.text,
|
|
2218
2195
|
identifier: decoratorExpression,
|
|
@@ -2222,12 +2199,12 @@ ${declaration.getText()}`);
|
|
|
2222
2199
|
};
|
|
2223
2200
|
}
|
|
2224
2201
|
getHelperCall(statement, helperNames) {
|
|
2225
|
-
if ((
|
|
2202
|
+
if ((ts11.isExpressionStatement(statement) || ts11.isReturnStatement(statement)) && statement.expression) {
|
|
2226
2203
|
let expression = statement.expression;
|
|
2227
2204
|
while (isAssignment2(expression)) {
|
|
2228
2205
|
expression = expression.right;
|
|
2229
2206
|
}
|
|
2230
|
-
if (
|
|
2207
|
+
if (ts11.isCallExpression(expression)) {
|
|
2231
2208
|
const calleeName = getCalleeName(expression);
|
|
2232
2209
|
if (calleeName !== null && helperNames.includes(calleeName)) {
|
|
2233
2210
|
return expression;
|
|
@@ -2238,14 +2215,14 @@ ${declaration.getText()}`);
|
|
|
2238
2215
|
}
|
|
2239
2216
|
reflectDecorators(decoratorsArray) {
|
|
2240
2217
|
const decorators = [];
|
|
2241
|
-
if (
|
|
2218
|
+
if (ts11.isArrayLiteralExpression(decoratorsArray)) {
|
|
2242
2219
|
decoratorsArray.elements.forEach((node) => {
|
|
2243
|
-
if (
|
|
2220
|
+
if (ts11.isObjectLiteralExpression(node)) {
|
|
2244
2221
|
const decorator = reflectObjectLiteral(node);
|
|
2245
2222
|
if (decorator.has("type")) {
|
|
2246
2223
|
let decoratorType = decorator.get("type");
|
|
2247
2224
|
if (isDecoratorIdentifier(decoratorType)) {
|
|
2248
|
-
const decoratorIdentifier =
|
|
2225
|
+
const decoratorIdentifier = ts11.isIdentifier(decoratorType) ? decoratorType : decoratorType.name;
|
|
2249
2226
|
decorators.push({
|
|
2250
2227
|
name: decoratorIdentifier.text,
|
|
2251
2228
|
identifier: decoratorType,
|
|
@@ -2261,10 +2238,10 @@ ${declaration.getText()}`);
|
|
|
2261
2238
|
return decorators;
|
|
2262
2239
|
}
|
|
2263
2240
|
reflectMembers(symbol, decorators, isStatic) {
|
|
2264
|
-
if (symbol.flags &
|
|
2241
|
+
if (symbol.flags & ts11.SymbolFlags.Accessor) {
|
|
2265
2242
|
const members = [];
|
|
2266
|
-
const setter = symbol.declarations && symbol.declarations.find(
|
|
2267
|
-
const getter = symbol.declarations && symbol.declarations.find(
|
|
2243
|
+
const setter = symbol.declarations && symbol.declarations.find(ts11.isSetAccessor);
|
|
2244
|
+
const getter = symbol.declarations && symbol.declarations.find(ts11.isGetAccessor);
|
|
2268
2245
|
const setterMember = setter && this.reflectMember(setter, ClassMemberKind.Setter, decorators, isStatic);
|
|
2269
2246
|
if (setterMember) {
|
|
2270
2247
|
members.push(setterMember);
|
|
@@ -2277,9 +2254,9 @@ ${declaration.getText()}`);
|
|
|
2277
2254
|
return members;
|
|
2278
2255
|
}
|
|
2279
2256
|
let kind = null;
|
|
2280
|
-
if (symbol.flags &
|
|
2257
|
+
if (symbol.flags & ts11.SymbolFlags.Method) {
|
|
2281
2258
|
kind = ClassMemberKind.Method;
|
|
2282
|
-
} else if (symbol.flags &
|
|
2259
|
+
} else if (symbol.flags & ts11.SymbolFlags.Property) {
|
|
2283
2260
|
kind = ClassMemberKind.Property;
|
|
2284
2261
|
}
|
|
2285
2262
|
const node = symbol.valueDeclaration || symbol.declarations && symbol.declarations[0];
|
|
@@ -2307,7 +2284,7 @@ ${declaration.getText()}`);
|
|
|
2307
2284
|
name = node.left.name.text;
|
|
2308
2285
|
value = node.right;
|
|
2309
2286
|
isStatic = false;
|
|
2310
|
-
} else if (
|
|
2287
|
+
} else if (ts11.isConstructorDeclaration(node)) {
|
|
2311
2288
|
kind = ClassMemberKind.Constructor;
|
|
2312
2289
|
name = "constructor";
|
|
2313
2290
|
isStatic = false;
|
|
@@ -2325,7 +2302,7 @@ ${declaration.getText()}`);
|
|
|
2325
2302
|
}
|
|
2326
2303
|
}
|
|
2327
2304
|
if (isStatic === void 0) {
|
|
2328
|
-
isStatic = node.modifiers !== void 0 && node.modifiers.some((mod) => mod.kind ===
|
|
2305
|
+
isStatic = node.modifiers !== void 0 && node.modifiers.some((mod) => mod.kind === ts11.SyntaxKind.StaticKeyword);
|
|
2329
2306
|
}
|
|
2330
2307
|
const type = node.type || null;
|
|
2331
2308
|
return {
|
|
@@ -2398,9 +2375,9 @@ ${declaration.getText()}`);
|
|
|
2398
2375
|
};
|
|
2399
2376
|
}
|
|
2400
2377
|
getImportOfExpression(expression) {
|
|
2401
|
-
if (
|
|
2378
|
+
if (ts11.isIdentifier(expression)) {
|
|
2402
2379
|
return this.getImportOfIdentifier(expression);
|
|
2403
|
-
} else if (
|
|
2380
|
+
} else if (ts11.isPropertyAccessExpression(expression) && ts11.isIdentifier(expression.name)) {
|
|
2404
2381
|
return this.getImportOfIdentifier(expression.name);
|
|
2405
2382
|
} else {
|
|
2406
2383
|
return null;
|
|
@@ -2409,10 +2386,10 @@ ${declaration.getText()}`);
|
|
|
2409
2386
|
getParamInfoFromStaticProperty(paramDecoratorsProperty) {
|
|
2410
2387
|
const paramDecorators = getPropertyValueFromSymbol(paramDecoratorsProperty);
|
|
2411
2388
|
if (paramDecorators) {
|
|
2412
|
-
const container =
|
|
2413
|
-
if (
|
|
2389
|
+
const container = ts11.isArrowFunction(paramDecorators) ? paramDecorators.body : paramDecorators;
|
|
2390
|
+
if (ts11.isArrayLiteralExpression(container)) {
|
|
2414
2391
|
const elements = container.elements;
|
|
2415
|
-
return elements.map((element) =>
|
|
2392
|
+
return elements.map((element) => ts11.isObjectLiteralExpression(element) ? reflectObjectLiteral(element) : null).map((paramInfo) => {
|
|
2416
2393
|
const typeExpression = paramInfo && paramInfo.has("type") ? paramInfo.get("type") : null;
|
|
2417
2394
|
const decoratorInfo = paramInfo && paramInfo.has("decorators") ? paramInfo.get("decorators") : null;
|
|
2418
2395
|
const decorators = decoratorInfo && this.reflectDecorators(decoratorInfo).filter((decorator) => this.isFromCore(decorator));
|
|
@@ -2433,7 +2410,7 @@ ${declaration.getText()}`);
|
|
|
2433
2410
|
return this.getModuleStatements(classNode.getSourceFile());
|
|
2434
2411
|
}
|
|
2435
2412
|
const statement = getContainingStatement(classNode);
|
|
2436
|
-
if (
|
|
2413
|
+
if (ts11.isBlock(statement.parent)) {
|
|
2437
2414
|
return Array.from(statement.parent.statements);
|
|
2438
2415
|
}
|
|
2439
2416
|
throw new Error(`Unable to find adjacent statements for ${classSymbol.name}`);
|
|
@@ -2474,7 +2451,7 @@ ${declaration.getText()}`);
|
|
|
2474
2451
|
if (moduleExports) {
|
|
2475
2452
|
moduleExports.forEach((exportedSymbol) => {
|
|
2476
2453
|
const name = exportedSymbol.name;
|
|
2477
|
-
if (exportedSymbol.flags &
|
|
2454
|
+
if (exportedSymbol.flags & ts11.SymbolFlags.Alias) {
|
|
2478
2455
|
exportedSymbol = checker.getAliasedSymbol(exportedSymbol);
|
|
2479
2456
|
}
|
|
2480
2457
|
const declaration = exportedSymbol.valueDeclaration;
|
|
@@ -2495,14 +2472,14 @@ ${declaration.getText()}`);
|
|
|
2495
2472
|
}
|
|
2496
2473
|
}
|
|
2497
2474
|
getDeclarationOfExpression(expression) {
|
|
2498
|
-
if (
|
|
2475
|
+
if (ts11.isIdentifier(expression)) {
|
|
2499
2476
|
return this.getDeclarationOfIdentifier(expression);
|
|
2500
2477
|
}
|
|
2501
|
-
if (!
|
|
2478
|
+
if (!ts11.isPropertyAccessExpression(expression) || !ts11.isIdentifier(expression.expression)) {
|
|
2502
2479
|
return null;
|
|
2503
2480
|
}
|
|
2504
2481
|
const namespaceDecl = this.getDeclarationOfIdentifier(expression.expression);
|
|
2505
|
-
if (!namespaceDecl || !
|
|
2482
|
+
if (!namespaceDecl || !ts11.isSourceFile(namespaceDecl.node)) {
|
|
2506
2483
|
return null;
|
|
2507
2484
|
}
|
|
2508
2485
|
const namespaceExports = this.getExportsOfModule(namespaceDecl.node);
|
|
@@ -2517,11 +2494,11 @@ ${declaration.getText()}`);
|
|
|
2517
2494
|
}
|
|
2518
2495
|
isJavaScriptObjectDeclaration(decl) {
|
|
2519
2496
|
const node = decl.node;
|
|
2520
|
-
if (!
|
|
2497
|
+
if (!ts11.isVariableDeclaration(node) || !ts11.isIdentifier(node.name) || node.name.text !== "Object" || node.type === void 0) {
|
|
2521
2498
|
return false;
|
|
2522
2499
|
}
|
|
2523
2500
|
const typeNode = node.type;
|
|
2524
|
-
if (!
|
|
2501
|
+
if (!ts11.isTypeReferenceNode(typeNode) || !ts11.isIdentifier(typeNode.typeName) || typeNode.typeName.text !== "ObjectConstructor") {
|
|
2525
2502
|
return false;
|
|
2526
2503
|
}
|
|
2527
2504
|
return this.src.program.isSourceFileDefaultLibrary(node.getSourceFile());
|
|
@@ -2530,22 +2507,22 @@ ${declaration.getText()}`);
|
|
|
2530
2507
|
if (declaration.initializer !== void 0)
|
|
2531
2508
|
return null;
|
|
2532
2509
|
const variableStmt = declaration.parent.parent;
|
|
2533
|
-
if (!
|
|
2510
|
+
if (!ts11.isVariableStatement(variableStmt))
|
|
2534
2511
|
return null;
|
|
2535
2512
|
const block = variableStmt.parent;
|
|
2536
|
-
if (!
|
|
2513
|
+
if (!ts11.isBlock(block) && !ts11.isSourceFile(block))
|
|
2537
2514
|
return null;
|
|
2538
2515
|
const declarationIndex = block.statements.findIndex((statement) => statement === variableStmt);
|
|
2539
2516
|
if (declarationIndex === -1 || declarationIndex === block.statements.length - 1)
|
|
2540
2517
|
return null;
|
|
2541
2518
|
const subsequentStmt = block.statements[declarationIndex + 1];
|
|
2542
|
-
if (!
|
|
2519
|
+
if (!ts11.isExpressionStatement(subsequentStmt))
|
|
2543
2520
|
return null;
|
|
2544
2521
|
const iife = stripParentheses(subsequentStmt.expression);
|
|
2545
|
-
if (!
|
|
2522
|
+
if (!ts11.isCallExpression(iife) || !isEnumDeclarationIife(iife))
|
|
2546
2523
|
return null;
|
|
2547
2524
|
const fn = stripParentheses(iife.expression);
|
|
2548
|
-
if (!
|
|
2525
|
+
if (!ts11.isFunctionExpression(fn))
|
|
2549
2526
|
return null;
|
|
2550
2527
|
return this.reflectEnumMembers(fn);
|
|
2551
2528
|
}
|
|
@@ -2553,7 +2530,7 @@ ${declaration.getText()}`);
|
|
|
2553
2530
|
if (fn.parameters.length !== 1)
|
|
2554
2531
|
return null;
|
|
2555
2532
|
const enumName = fn.parameters[0].name;
|
|
2556
|
-
if (!
|
|
2533
|
+
if (!ts11.isIdentifier(enumName))
|
|
2557
2534
|
return null;
|
|
2558
2535
|
const enumMembers = [];
|
|
2559
2536
|
for (const statement of fn.body.statements) {
|
|
@@ -2566,7 +2543,7 @@ ${declaration.getText()}`);
|
|
|
2566
2543
|
return enumMembers;
|
|
2567
2544
|
}
|
|
2568
2545
|
reflectEnumMember(enumName, statement) {
|
|
2569
|
-
if (!
|
|
2546
|
+
if (!ts11.isExpressionStatement(statement))
|
|
2570
2547
|
return null;
|
|
2571
2548
|
const expression = statement.expression;
|
|
2572
2549
|
if (!isEnumAssignment(enumName, expression)) {
|
|
@@ -2594,78 +2571,78 @@ function isEnumDeclarationIife(iife) {
|
|
|
2594
2571
|
if (iife.arguments.length !== 1)
|
|
2595
2572
|
return false;
|
|
2596
2573
|
const arg = iife.arguments[0];
|
|
2597
|
-
if (!
|
|
2574
|
+
if (!ts11.isBinaryExpression(arg) || arg.operatorToken.kind !== ts11.SyntaxKind.BarBarToken || !ts11.isParenthesizedExpression(arg.right)) {
|
|
2598
2575
|
return false;
|
|
2599
2576
|
}
|
|
2600
2577
|
const right = arg.right.expression;
|
|
2601
|
-
if (!
|
|
2578
|
+
if (!ts11.isBinaryExpression(right) || right.operatorToken.kind !== ts11.SyntaxKind.EqualsToken) {
|
|
2602
2579
|
return false;
|
|
2603
2580
|
}
|
|
2604
|
-
if (!
|
|
2581
|
+
if (!ts11.isObjectLiteralExpression(right.right) || right.right.properties.length !== 0) {
|
|
2605
2582
|
return false;
|
|
2606
2583
|
}
|
|
2607
2584
|
return true;
|
|
2608
2585
|
}
|
|
2609
2586
|
function isEnumAssignment(enumName, expression) {
|
|
2610
|
-
if (!
|
|
2587
|
+
if (!ts11.isBinaryExpression(expression) || expression.operatorToken.kind !== ts11.SyntaxKind.EqualsToken || !ts11.isElementAccessExpression(expression.left)) {
|
|
2611
2588
|
return false;
|
|
2612
2589
|
}
|
|
2613
2590
|
const enumIdentifier = expression.left.expression;
|
|
2614
|
-
return
|
|
2591
|
+
return ts11.isIdentifier(enumIdentifier) && enumIdentifier.text === enumName.text;
|
|
2615
2592
|
}
|
|
2616
2593
|
function reflectEnumAssignment(expression) {
|
|
2617
2594
|
const memberName = expression.left.argumentExpression;
|
|
2618
|
-
if (!
|
|
2595
|
+
if (!ts11.isPropertyName(memberName))
|
|
2619
2596
|
return null;
|
|
2620
2597
|
return { name: memberName, initializer: expression.right };
|
|
2621
2598
|
}
|
|
2622
2599
|
function isAssignmentStatement(statement) {
|
|
2623
|
-
return
|
|
2600
|
+
return ts11.isExpressionStatement(statement) && isAssignment2(statement.expression) && ts11.isIdentifier(statement.expression.left);
|
|
2624
2601
|
}
|
|
2625
2602
|
function getIifeBody(expression) {
|
|
2626
2603
|
const call = stripParentheses(expression);
|
|
2627
|
-
if (!
|
|
2604
|
+
if (!ts11.isCallExpression(call)) {
|
|
2628
2605
|
return void 0;
|
|
2629
2606
|
}
|
|
2630
2607
|
const fn = stripParentheses(call.expression);
|
|
2631
|
-
if (!
|
|
2608
|
+
if (!ts11.isFunctionExpression(fn) && !ts11.isArrowFunction(fn)) {
|
|
2632
2609
|
return void 0;
|
|
2633
2610
|
}
|
|
2634
2611
|
return fn.body;
|
|
2635
2612
|
}
|
|
2636
2613
|
function isAssignment2(node) {
|
|
2637
|
-
return
|
|
2614
|
+
return ts11.isBinaryExpression(node) && node.operatorToken.kind === ts11.SyntaxKind.EqualsToken;
|
|
2638
2615
|
}
|
|
2639
2616
|
function isClassDecorateCall(call, matches) {
|
|
2640
2617
|
const helperArgs = call.arguments[0];
|
|
2641
|
-
if (helperArgs === void 0 || !
|
|
2618
|
+
if (helperArgs === void 0 || !ts11.isArrayLiteralExpression(helperArgs)) {
|
|
2642
2619
|
return false;
|
|
2643
2620
|
}
|
|
2644
2621
|
const target = call.arguments[1];
|
|
2645
|
-
return target !== void 0 &&
|
|
2622
|
+
return target !== void 0 && ts11.isIdentifier(target) && matches(target);
|
|
2646
2623
|
}
|
|
2647
2624
|
function isMemberDecorateCall(call, matches) {
|
|
2648
2625
|
const helperArgs = call.arguments[0];
|
|
2649
|
-
if (helperArgs === void 0 || !
|
|
2626
|
+
if (helperArgs === void 0 || !ts11.isArrayLiteralExpression(helperArgs)) {
|
|
2650
2627
|
return false;
|
|
2651
2628
|
}
|
|
2652
2629
|
const target = call.arguments[1];
|
|
2653
|
-
if (target === void 0 || !
|
|
2630
|
+
if (target === void 0 || !ts11.isPropertyAccessExpression(target) || !ts11.isIdentifier(target.expression) || !matches(target.expression) || target.name.text !== "prototype") {
|
|
2654
2631
|
return false;
|
|
2655
2632
|
}
|
|
2656
2633
|
const memberName = call.arguments[2];
|
|
2657
|
-
return memberName !== void 0 &&
|
|
2634
|
+
return memberName !== void 0 && ts11.isStringLiteral(memberName);
|
|
2658
2635
|
}
|
|
2659
2636
|
function getPropertyValueFromSymbol(propSymbol) {
|
|
2660
2637
|
const propIdentifier = propSymbol.valueDeclaration;
|
|
2661
2638
|
const parent = propIdentifier && propIdentifier.parent;
|
|
2662
|
-
return parent &&
|
|
2639
|
+
return parent && ts11.isBinaryExpression(parent) ? parent.right : void 0;
|
|
2663
2640
|
}
|
|
2664
2641
|
function getCalleeName(call) {
|
|
2665
|
-
if (
|
|
2642
|
+
if (ts11.isIdentifier(call.expression)) {
|
|
2666
2643
|
return stripDollarSuffix(call.expression.text);
|
|
2667
2644
|
}
|
|
2668
|
-
if (
|
|
2645
|
+
if (ts11.isPropertyAccessExpression(call.expression)) {
|
|
2669
2646
|
return stripDollarSuffix(call.expression.name.text);
|
|
2670
2647
|
}
|
|
2671
2648
|
return null;
|
|
@@ -2681,25 +2658,25 @@ function skipClassAliases(node) {
|
|
|
2681
2658
|
return expression;
|
|
2682
2659
|
}
|
|
2683
2660
|
function getInnerClassDeclaration(expression) {
|
|
2684
|
-
if (
|
|
2661
|
+
if (ts11.isClassExpression(expression) && hasNameIdentifier(expression)) {
|
|
2685
2662
|
return expression;
|
|
2686
2663
|
}
|
|
2687
2664
|
const iifeBody = getIifeBody(expression);
|
|
2688
2665
|
if (iifeBody === void 0) {
|
|
2689
2666
|
return null;
|
|
2690
2667
|
}
|
|
2691
|
-
if (!
|
|
2692
|
-
return
|
|
2668
|
+
if (!ts11.isBlock(iifeBody)) {
|
|
2669
|
+
return ts11.isClassExpression(iifeBody) && isNamedDeclaration2(iifeBody) ? iifeBody : null;
|
|
2693
2670
|
} else {
|
|
2694
2671
|
for (const statement of iifeBody.statements) {
|
|
2695
2672
|
if (isNamedClassDeclaration(statement) || isNamedFunctionDeclaration(statement)) {
|
|
2696
2673
|
return statement;
|
|
2697
2674
|
}
|
|
2698
|
-
if (
|
|
2675
|
+
if (ts11.isVariableStatement(statement)) {
|
|
2699
2676
|
for (const declaration of statement.declarationList.declarations) {
|
|
2700
2677
|
if (isInitializedVariableClassDeclaration(declaration)) {
|
|
2701
2678
|
const expression2 = skipClassAliases(declaration);
|
|
2702
|
-
if (
|
|
2679
|
+
if (ts11.isClassExpression(expression2) && hasNameIdentifier(expression2)) {
|
|
2703
2680
|
return expression2;
|
|
2704
2681
|
}
|
|
2705
2682
|
}
|
|
@@ -2710,29 +2687,29 @@ function getInnerClassDeclaration(expression) {
|
|
|
2710
2687
|
return null;
|
|
2711
2688
|
}
|
|
2712
2689
|
function getDecoratorArgs(node) {
|
|
2713
|
-
const argsProperty = node.properties.filter(
|
|
2690
|
+
const argsProperty = node.properties.filter(ts11.isPropertyAssignment).find((property2) => getNameText(property2.name) === "args");
|
|
2714
2691
|
const argsExpression = argsProperty && argsProperty.initializer;
|
|
2715
|
-
return argsExpression &&
|
|
2692
|
+
return argsExpression && ts11.isArrayLiteralExpression(argsExpression) ? Array.from(argsExpression.elements) : [];
|
|
2716
2693
|
}
|
|
2717
2694
|
function isPropertyAccess(node) {
|
|
2718
|
-
return !!node.parent &&
|
|
2695
|
+
return !!node.parent && ts11.isBinaryExpression(node.parent) && ts11.isPropertyAccessExpression(node);
|
|
2719
2696
|
}
|
|
2720
2697
|
function isThisAssignment(node) {
|
|
2721
|
-
return
|
|
2698
|
+
return ts11.isBinaryExpression(node) && ts11.isPropertyAccessExpression(node.left) && node.left.expression.kind === ts11.SyntaxKind.ThisKeyword;
|
|
2722
2699
|
}
|
|
2723
2700
|
function isNamedDeclaration2(node) {
|
|
2724
2701
|
const anyNode = node;
|
|
2725
|
-
return !!anyNode.name &&
|
|
2702
|
+
return !!anyNode.name && ts11.isIdentifier(anyNode.name);
|
|
2726
2703
|
}
|
|
2727
2704
|
function isClassMemberType(node) {
|
|
2728
|
-
return (
|
|
2705
|
+
return (ts11.isClassElement(node) || isPropertyAccess(node) || ts11.isBinaryExpression(node)) && !ts11.isIndexSignatureDeclaration(node);
|
|
2729
2706
|
}
|
|
2730
2707
|
function getFarLeftHandSideOfAssignment(declaration) {
|
|
2731
2708
|
let node = declaration.parent;
|
|
2732
|
-
if (isAssignment2(node) &&
|
|
2709
|
+
if (isAssignment2(node) && ts11.isIdentifier(node.left)) {
|
|
2733
2710
|
node = node.parent;
|
|
2734
2711
|
}
|
|
2735
|
-
return
|
|
2712
|
+
return ts11.isVariableDeclaration(node) ? node : void 0;
|
|
2736
2713
|
}
|
|
2737
2714
|
function getContainingVariableDeclaration(node) {
|
|
2738
2715
|
node = node.parent;
|
|
@@ -2748,23 +2725,23 @@ function isSynthesizedConstructor(constructor) {
|
|
|
2748
2725
|
if (!constructor.body)
|
|
2749
2726
|
return false;
|
|
2750
2727
|
const firstStatement = constructor.body.statements[0];
|
|
2751
|
-
if (!firstStatement || !
|
|
2728
|
+
if (!firstStatement || !ts11.isExpressionStatement(firstStatement))
|
|
2752
2729
|
return false;
|
|
2753
2730
|
return isSynthesizedSuperCall(firstStatement.expression);
|
|
2754
2731
|
}
|
|
2755
2732
|
function isSynthesizedSuperCall(expression) {
|
|
2756
|
-
if (!
|
|
2733
|
+
if (!ts11.isCallExpression(expression))
|
|
2757
2734
|
return false;
|
|
2758
|
-
if (expression.expression.kind !==
|
|
2735
|
+
if (expression.expression.kind !== ts11.SyntaxKind.SuperKeyword)
|
|
2759
2736
|
return false;
|
|
2760
2737
|
if (expression.arguments.length !== 1)
|
|
2761
2738
|
return false;
|
|
2762
2739
|
const argument = expression.arguments[0];
|
|
2763
|
-
return
|
|
2740
|
+
return ts11.isSpreadElement(argument) && ts11.isIdentifier(argument.expression) && argument.expression.text === "arguments";
|
|
2764
2741
|
}
|
|
2765
2742
|
function getContainingStatement(node) {
|
|
2766
2743
|
while (node.parent) {
|
|
2767
|
-
if (
|
|
2744
|
+
if (ts11.isBlock(node.parent) || ts11.isSourceFile(node.parent)) {
|
|
2768
2745
|
break;
|
|
2769
2746
|
}
|
|
2770
2747
|
node = node.parent;
|
|
@@ -2784,30 +2761,30 @@ function getNonRootPackageFiles(bundle) {
|
|
|
2784
2761
|
}
|
|
2785
2762
|
function isTopLevel(node) {
|
|
2786
2763
|
while (node = node.parent) {
|
|
2787
|
-
if (
|
|
2764
|
+
if (ts11.isBlock(node)) {
|
|
2788
2765
|
return false;
|
|
2789
2766
|
}
|
|
2790
2767
|
}
|
|
2791
2768
|
return true;
|
|
2792
2769
|
}
|
|
2793
2770
|
function getOuterNodeFromInnerDeclaration(node) {
|
|
2794
|
-
if (!
|
|
2771
|
+
if (!ts11.isFunctionDeclaration(node) && !ts11.isClassDeclaration(node) && !ts11.isVariableStatement(node)) {
|
|
2795
2772
|
return null;
|
|
2796
2773
|
}
|
|
2797
2774
|
let outerNode = node.parent;
|
|
2798
|
-
if (!outerNode || !
|
|
2775
|
+
if (!outerNode || !ts11.isBlock(outerNode))
|
|
2799
2776
|
return null;
|
|
2800
2777
|
outerNode = outerNode.parent;
|
|
2801
|
-
if (!outerNode || !
|
|
2778
|
+
if (!outerNode || !ts11.isFunctionExpression(outerNode) && !ts11.isArrowFunction(outerNode)) {
|
|
2802
2779
|
return null;
|
|
2803
2780
|
}
|
|
2804
2781
|
outerNode = outerNode.parent;
|
|
2805
|
-
if (outerNode &&
|
|
2782
|
+
if (outerNode && ts11.isParenthesizedExpression(outerNode))
|
|
2806
2783
|
outerNode = outerNode.parent;
|
|
2807
|
-
if (!outerNode || !
|
|
2784
|
+
if (!outerNode || !ts11.isCallExpression(outerNode))
|
|
2808
2785
|
return null;
|
|
2809
2786
|
outerNode = outerNode.parent;
|
|
2810
|
-
if (outerNode &&
|
|
2787
|
+
if (outerNode && ts11.isParenthesizedExpression(outerNode))
|
|
2811
2788
|
outerNode = outerNode.parent;
|
|
2812
2789
|
while (isAssignment2(outerNode.parent)) {
|
|
2813
2790
|
outerNode = outerNode.parent;
|
|
@@ -2816,7 +2793,7 @@ function getOuterNodeFromInnerDeclaration(node) {
|
|
|
2816
2793
|
}
|
|
2817
2794
|
|
|
2818
2795
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/host/esm5_host.mjs
|
|
2819
|
-
import
|
|
2796
|
+
import ts12 from "typescript";
|
|
2820
2797
|
var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
2821
2798
|
getBaseClassExpression(clazz) {
|
|
2822
2799
|
const superBaseClassExpression = super.getBaseClassExpression(clazz);
|
|
@@ -2829,7 +2806,7 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
2829
2806
|
if (iife.parameters.length !== 1 || !isSuperIdentifier(iife.parameters[0].name)) {
|
|
2830
2807
|
return null;
|
|
2831
2808
|
}
|
|
2832
|
-
if (!
|
|
2809
|
+
if (!ts12.isCallExpression(iife.parent)) {
|
|
2833
2810
|
return null;
|
|
2834
2811
|
}
|
|
2835
2812
|
return iife.parent.arguments[0];
|
|
@@ -2850,14 +2827,14 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
2850
2827
|
if (declaration === null || declaration.node === null || declaration.known !== null) {
|
|
2851
2828
|
return declaration;
|
|
2852
2829
|
}
|
|
2853
|
-
if (!
|
|
2830
|
+
if (!ts12.isVariableDeclaration(declaration.node) || declaration.node.initializer !== void 0 || !ts12.isBlock(declaration.node.parent.parent.parent)) {
|
|
2854
2831
|
return declaration;
|
|
2855
2832
|
}
|
|
2856
2833
|
const block = declaration.node.parent.parent.parent;
|
|
2857
2834
|
const aliasSymbol = this.checker.getSymbolAtLocation(declaration.node.name);
|
|
2858
2835
|
for (let i = 0; i < block.statements.length; i++) {
|
|
2859
2836
|
const statement = block.statements[i];
|
|
2860
|
-
if (isAssignmentStatement(statement) &&
|
|
2837
|
+
if (isAssignmentStatement(statement) && ts12.isIdentifier(statement.expression.left) && ts12.isIdentifier(statement.expression.right) && this.checker.getSymbolAtLocation(statement.expression.left) === aliasSymbol) {
|
|
2861
2838
|
return this.getDeclarationOfIdentifier(statement.expression.right);
|
|
2862
2839
|
}
|
|
2863
2840
|
}
|
|
@@ -2901,7 +2878,7 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
2901
2878
|
}
|
|
2902
2879
|
getConstructorParameterDeclarations(classSymbol) {
|
|
2903
2880
|
const constructor = classSymbol.implementation.valueDeclaration;
|
|
2904
|
-
if (!
|
|
2881
|
+
if (!ts12.isFunctionDeclaration(constructor))
|
|
2905
2882
|
return null;
|
|
2906
2883
|
if (constructor.parameters.length > 0) {
|
|
2907
2884
|
return Array.from(constructor.parameters);
|
|
@@ -2915,7 +2892,7 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
2915
2892
|
const paramDecorators = getPropertyValueFromSymbol(paramDecoratorsProperty);
|
|
2916
2893
|
const returnStatement = getReturnStatement(paramDecorators);
|
|
2917
2894
|
const expression = returnStatement ? returnStatement.expression : paramDecorators;
|
|
2918
|
-
if (expression &&
|
|
2895
|
+
if (expression && ts12.isArrayLiteralExpression(expression)) {
|
|
2919
2896
|
const elements = expression.elements;
|
|
2920
2897
|
return elements.map(reflectArrayElement).map((paramInfo) => {
|
|
2921
2898
|
const typeExpression = paramInfo && paramInfo.has("type") ? paramInfo.get("type") : null;
|
|
@@ -2964,7 +2941,7 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
2964
2941
|
}
|
|
2965
2942
|
const members = super.reflectMembers(symbol, decorators, isStatic);
|
|
2966
2943
|
members && members.forEach((member) => {
|
|
2967
|
-
if (member && member.kind === ClassMemberKind.Method && member.isStatic && member.node &&
|
|
2944
|
+
if (member && member.kind === ClassMemberKind.Method && member.isStatic && member.node && ts12.isPropertyAccessExpression(member.node) && member.node.parent && ts12.isBinaryExpression(member.node.parent) && ts12.isFunctionExpression(member.node.parent.right)) {
|
|
2968
2945
|
member.implementation = member.node.parent.right;
|
|
2969
2946
|
}
|
|
2970
2947
|
});
|
|
@@ -2972,7 +2949,7 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
2972
2949
|
}
|
|
2973
2950
|
getStatementsForClass(classSymbol) {
|
|
2974
2951
|
const classDeclarationParent = classSymbol.implementation.valueDeclaration.parent;
|
|
2975
|
-
return
|
|
2952
|
+
return ts12.isBlock(classDeclarationParent) ? Array.from(classDeclarationParent.statements) : [];
|
|
2976
2953
|
}
|
|
2977
2954
|
isSynthesizedConstructor(constructor) {
|
|
2978
2955
|
if (!constructor.body)
|
|
@@ -2983,13 +2960,13 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
2983
2960
|
return this.isSynthesizedSuperThisAssignment(firstStatement) || this.isSynthesizedSuperReturnStatement(firstStatement);
|
|
2984
2961
|
}
|
|
2985
2962
|
isSynthesizedSuperThisAssignment(statement) {
|
|
2986
|
-
if (!
|
|
2963
|
+
if (!ts12.isVariableStatement(statement))
|
|
2987
2964
|
return false;
|
|
2988
2965
|
const variableDeclarations = statement.declarationList.declarations;
|
|
2989
2966
|
if (variableDeclarations.length !== 1)
|
|
2990
2967
|
return false;
|
|
2991
2968
|
const variableDeclaration = variableDeclarations[0];
|
|
2992
|
-
if (!
|
|
2969
|
+
if (!ts12.isIdentifier(variableDeclaration.name) || !variableDeclaration.name.text.startsWith("_this"))
|
|
2993
2970
|
return false;
|
|
2994
2971
|
const initializer = variableDeclaration.initializer;
|
|
2995
2972
|
if (!initializer)
|
|
@@ -2997,7 +2974,7 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
2997
2974
|
return this.isSynthesizedDefaultSuperCall(initializer);
|
|
2998
2975
|
}
|
|
2999
2976
|
isSynthesizedSuperReturnStatement(statement) {
|
|
3000
|
-
if (!
|
|
2977
|
+
if (!ts12.isReturnStatement(statement))
|
|
3001
2978
|
return false;
|
|
3002
2979
|
const expression = statement.expression;
|
|
3003
2980
|
if (!expression)
|
|
@@ -3005,29 +2982,29 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
3005
2982
|
return this.isSynthesizedDefaultSuperCall(expression);
|
|
3006
2983
|
}
|
|
3007
2984
|
isSynthesizedDefaultSuperCall(expression) {
|
|
3008
|
-
if (!isBinaryExpr(expression,
|
|
2985
|
+
if (!isBinaryExpr(expression, ts12.SyntaxKind.BarBarToken))
|
|
3009
2986
|
return false;
|
|
3010
|
-
if (expression.right.kind !==
|
|
2987
|
+
if (expression.right.kind !== ts12.SyntaxKind.ThisKeyword)
|
|
3011
2988
|
return false;
|
|
3012
2989
|
const left = expression.left;
|
|
3013
|
-
if (isBinaryExpr(left,
|
|
2990
|
+
if (isBinaryExpr(left, ts12.SyntaxKind.AmpersandAmpersandToken)) {
|
|
3014
2991
|
return isSuperNotNull(left.left) && this.isSuperApplyCall(left.right);
|
|
3015
2992
|
} else {
|
|
3016
2993
|
return this.isSuperApplyCall(left);
|
|
3017
2994
|
}
|
|
3018
2995
|
}
|
|
3019
2996
|
isSuperApplyCall(expression) {
|
|
3020
|
-
if (!
|
|
2997
|
+
if (!ts12.isCallExpression(expression) || expression.arguments.length !== 2)
|
|
3021
2998
|
return false;
|
|
3022
2999
|
const targetFn = expression.expression;
|
|
3023
|
-
if (!
|
|
3000
|
+
if (!ts12.isPropertyAccessExpression(targetFn))
|
|
3024
3001
|
return false;
|
|
3025
3002
|
if (!isSuperIdentifier(targetFn.expression))
|
|
3026
3003
|
return false;
|
|
3027
3004
|
if (targetFn.name.text !== "apply")
|
|
3028
3005
|
return false;
|
|
3029
3006
|
const thisArgument = expression.arguments[0];
|
|
3030
|
-
if (thisArgument.kind !==
|
|
3007
|
+
if (thisArgument.kind !== ts12.SyntaxKind.ThisKeyword)
|
|
3031
3008
|
return false;
|
|
3032
3009
|
const argumentsExpr = expression.arguments[1];
|
|
3033
3010
|
if (isArgumentsIdentifier(argumentsExpr)) {
|
|
@@ -3047,7 +3024,7 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
3047
3024
|
return false;
|
|
3048
3025
|
}
|
|
3049
3026
|
const firstArg = call.args[0];
|
|
3050
|
-
if (!
|
|
3027
|
+
if (!ts12.isArrayLiteralExpression(firstArg) || firstArg.elements.length !== 0) {
|
|
3051
3028
|
return false;
|
|
3052
3029
|
}
|
|
3053
3030
|
const secondArg = this.extractKnownHelperCall(call.args[1]);
|
|
@@ -3060,14 +3037,14 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
3060
3037
|
}
|
|
3061
3038
|
}
|
|
3062
3039
|
extractKnownHelperCall(expression) {
|
|
3063
|
-
if (!
|
|
3040
|
+
if (!ts12.isCallExpression(expression)) {
|
|
3064
3041
|
return null;
|
|
3065
3042
|
}
|
|
3066
3043
|
const receiverExpr = expression.expression;
|
|
3067
3044
|
let receiver = null;
|
|
3068
|
-
if (
|
|
3045
|
+
if (ts12.isIdentifier(receiverExpr)) {
|
|
3069
3046
|
receiver = this.getDeclarationOfIdentifier(receiverExpr);
|
|
3070
|
-
} else if (
|
|
3047
|
+
} else if (ts12.isPropertyAccessExpression(receiverExpr) && ts12.isIdentifier(receiverExpr.name)) {
|
|
3071
3048
|
receiver = this.getDeclarationOfIdentifier(receiverExpr.name);
|
|
3072
3049
|
}
|
|
3073
3050
|
if (receiver === null || receiver.known === null) {
|
|
@@ -3080,13 +3057,13 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
3080
3057
|
}
|
|
3081
3058
|
};
|
|
3082
3059
|
function getPropertyDefinition(node) {
|
|
3083
|
-
if (!
|
|
3060
|
+
if (!ts12.isCallExpression(node))
|
|
3084
3061
|
return null;
|
|
3085
3062
|
const fn = node.expression;
|
|
3086
|
-
if (!
|
|
3063
|
+
if (!ts12.isPropertyAccessExpression(fn) || !ts12.isIdentifier(fn.expression) || fn.expression.text !== "Object" || fn.name.text !== "defineProperty")
|
|
3087
3064
|
return null;
|
|
3088
3065
|
const descriptor = node.arguments[2];
|
|
3089
|
-
if (!descriptor || !
|
|
3066
|
+
if (!descriptor || !ts12.isObjectLiteralExpression(descriptor))
|
|
3090
3067
|
return null;
|
|
3091
3068
|
return {
|
|
3092
3069
|
setter: readPropertyFunctionExpression(descriptor, "set"),
|
|
@@ -3094,29 +3071,29 @@ function getPropertyDefinition(node) {
|
|
|
3094
3071
|
};
|
|
3095
3072
|
}
|
|
3096
3073
|
function readPropertyFunctionExpression(object, name) {
|
|
3097
|
-
const property2 = object.properties.find((p2) =>
|
|
3098
|
-
return property2 &&
|
|
3074
|
+
const property2 = object.properties.find((p2) => ts12.isPropertyAssignment(p2) && ts12.isIdentifier(p2.name) && p2.name.text === name);
|
|
3075
|
+
return property2 && ts12.isFunctionExpression(property2.initializer) && property2.initializer || null;
|
|
3099
3076
|
}
|
|
3100
3077
|
function getReturnStatement(declaration) {
|
|
3101
|
-
return declaration &&
|
|
3078
|
+
return declaration && ts12.isFunctionExpression(declaration) ? declaration.body.statements.find(ts12.isReturnStatement) : void 0;
|
|
3102
3079
|
}
|
|
3103
3080
|
function reflectArrayElement(element) {
|
|
3104
|
-
return
|
|
3081
|
+
return ts12.isObjectLiteralExpression(element) ? reflectObjectLiteral(element) : null;
|
|
3105
3082
|
}
|
|
3106
3083
|
function isArgumentsIdentifier(expression) {
|
|
3107
|
-
return
|
|
3084
|
+
return ts12.isIdentifier(expression) && expression.text === "arguments";
|
|
3108
3085
|
}
|
|
3109
3086
|
function isSuperNotNull(expression) {
|
|
3110
|
-
return isBinaryExpr(expression,
|
|
3087
|
+
return isBinaryExpr(expression, ts12.SyntaxKind.ExclamationEqualsEqualsToken) && isSuperIdentifier(expression.left);
|
|
3111
3088
|
}
|
|
3112
3089
|
function isBinaryExpr(expression, operator) {
|
|
3113
|
-
return
|
|
3090
|
+
return ts12.isBinaryExpression(expression) && expression.operatorToken.kind === operator;
|
|
3114
3091
|
}
|
|
3115
3092
|
function isSuperIdentifier(node) {
|
|
3116
|
-
return
|
|
3093
|
+
return ts12.isIdentifier(node) && node.text.startsWith("_super");
|
|
3117
3094
|
}
|
|
3118
3095
|
function captureParamInitializer(statement, parameters) {
|
|
3119
|
-
if (
|
|
3096
|
+
if (ts12.isIfStatement(statement) && isUndefinedComparison(statement.expression) && ts12.isBlock(statement.thenStatement) && statement.thenStatement.statements.length === 1) {
|
|
3120
3097
|
const ifStatementComparison = statement.expression;
|
|
3121
3098
|
const thenStatement = statement.thenStatement.statements[0];
|
|
3122
3099
|
if (isAssignmentStatement(thenStatement)) {
|
|
@@ -3134,7 +3111,7 @@ function captureParamInitializer(statement, parameters) {
|
|
|
3134
3111
|
return false;
|
|
3135
3112
|
}
|
|
3136
3113
|
function isUndefinedComparison(expression) {
|
|
3137
|
-
return
|
|
3114
|
+
return ts12.isBinaryExpression(expression) && expression.operatorToken.kind === ts12.SyntaxKind.EqualsEqualsEqualsToken && ts12.isVoidExpression(expression.right) && ts12.isIdentifier(expression.left);
|
|
3138
3115
|
}
|
|
3139
3116
|
function getIifeFn(classSymbol) {
|
|
3140
3117
|
if (classSymbol === void 0) {
|
|
@@ -3142,11 +3119,11 @@ function getIifeFn(classSymbol) {
|
|
|
3142
3119
|
}
|
|
3143
3120
|
const innerDeclaration = classSymbol.implementation.valueDeclaration;
|
|
3144
3121
|
const iifeBody = innerDeclaration.parent;
|
|
3145
|
-
if (!
|
|
3122
|
+
if (!ts12.isBlock(iifeBody)) {
|
|
3146
3123
|
return null;
|
|
3147
3124
|
}
|
|
3148
3125
|
const iifeWrapper = iifeBody.parent;
|
|
3149
|
-
return iifeWrapper &&
|
|
3126
|
+
return iifeWrapper && ts12.isFunctionExpression(iifeWrapper) ? iifeWrapper : null;
|
|
3150
3127
|
}
|
|
3151
3128
|
|
|
3152
3129
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/host/umd_host.mjs
|
|
@@ -3214,7 +3191,7 @@ var UmdReflectionHost = class extends Esm5ReflectionHost {
|
|
|
3214
3191
|
return void 0;
|
|
3215
3192
|
}
|
|
3216
3193
|
let initializer = skipAliases(declaration.parent.right);
|
|
3217
|
-
if (
|
|
3194
|
+
if (ts13.isIdentifier(initializer)) {
|
|
3218
3195
|
const implementation = this.getDeclarationOfIdentifier(initializer);
|
|
3219
3196
|
if (implementation !== null) {
|
|
3220
3197
|
const implementationSymbol = this.getClassSymbol(implementation.node);
|
|
@@ -3259,7 +3236,7 @@ var UmdReflectionHost = class extends Esm5ReflectionHost {
|
|
|
3259
3236
|
}
|
|
3260
3237
|
const declaration = statement.expression.left;
|
|
3261
3238
|
const initializer = statement.expression.right;
|
|
3262
|
-
if (!isAssignment2(initializer) || !
|
|
3239
|
+
if (!isAssignment2(initializer) || !ts13.isIdentifier(initializer.left) || !this.isClass(declaration)) {
|
|
3263
3240
|
return;
|
|
3264
3241
|
}
|
|
3265
3242
|
const aliasedIdentifier = initializer.left;
|
|
@@ -3330,11 +3307,11 @@ var UmdReflectionHost = class extends Esm5ReflectionHost {
|
|
|
3330
3307
|
}
|
|
3331
3308
|
extractUmdWildcardReexports(statement, containingFile) {
|
|
3332
3309
|
const reexportArg = statement.expression.arguments[0];
|
|
3333
|
-
const requireCall = isRequireCall(reexportArg) ? reexportArg :
|
|
3310
|
+
const requireCall = isRequireCall(reexportArg) ? reexportArg : ts13.isIdentifier(reexportArg) ? findRequireCallReference(reexportArg, this.checker) : null;
|
|
3334
3311
|
let importPath = null;
|
|
3335
3312
|
if (requireCall !== null) {
|
|
3336
3313
|
importPath = requireCall.arguments[0].text;
|
|
3337
|
-
} else if (
|
|
3314
|
+
} else if (ts13.isIdentifier(reexportArg)) {
|
|
3338
3315
|
const importParameter = this.findUmdImportParameter(reexportArg);
|
|
3339
3316
|
importPath = importParameter && this.getUmdImportPath(importParameter);
|
|
3340
3317
|
}
|
|
@@ -3379,7 +3356,7 @@ var UmdReflectionHost = class extends Esm5ReflectionHost {
|
|
|
3379
3356
|
findUmdImportParameter(id) {
|
|
3380
3357
|
const symbol = id && this.checker.getSymbolAtLocation(id) || null;
|
|
3381
3358
|
const declaration = symbol && symbol.valueDeclaration;
|
|
3382
|
-
return declaration &&
|
|
3359
|
+
return declaration && ts13.isParameter(declaration) ? declaration : null;
|
|
3383
3360
|
}
|
|
3384
3361
|
getUmdDeclaration(id) {
|
|
3385
3362
|
const nsIdentifier = findNamespaceOfIdentifier(id);
|
|
@@ -3388,7 +3365,7 @@ var UmdReflectionHost = class extends Esm5ReflectionHost {
|
|
|
3388
3365
|
}
|
|
3389
3366
|
if (nsIdentifier.parent.parent && isExportsAssignment(nsIdentifier.parent.parent)) {
|
|
3390
3367
|
const initializer = nsIdentifier.parent.parent.right;
|
|
3391
|
-
if (
|
|
3368
|
+
if (ts13.isIdentifier(initializer)) {
|
|
3392
3369
|
return this.getDeclarationOfIdentifier(initializer);
|
|
3393
3370
|
}
|
|
3394
3371
|
return this.detectKnownDeclaration({
|
|
@@ -3400,7 +3377,7 @@ var UmdReflectionHost = class extends Esm5ReflectionHost {
|
|
|
3400
3377
|
});
|
|
3401
3378
|
}
|
|
3402
3379
|
const moduleDeclaration = this.getUmdModuleDeclaration(nsIdentifier);
|
|
3403
|
-
if (moduleDeclaration === null || moduleDeclaration.node === null || !
|
|
3380
|
+
if (moduleDeclaration === null || moduleDeclaration.node === null || !ts13.isSourceFile(moduleDeclaration.node)) {
|
|
3404
3381
|
return null;
|
|
3405
3382
|
}
|
|
3406
3383
|
const moduleExports = this.getExportsOfModule(moduleDeclaration.node);
|
|
@@ -3418,8 +3395,8 @@ var UmdReflectionHost = class extends Esm5ReflectionHost {
|
|
|
3418
3395
|
if (!isExportsIdentifier(id)) {
|
|
3419
3396
|
return null;
|
|
3420
3397
|
}
|
|
3421
|
-
const exportsSymbol = this.checker.getSymbolsInScope(id,
|
|
3422
|
-
const node = (exportsSymbol == null ? void 0 : exportsSymbol.valueDeclaration) !== void 0 && !
|
|
3398
|
+
const exportsSymbol = this.checker.getSymbolsInScope(id, ts13.SymbolFlags.Variable).find((symbol) => symbol.name === "exports");
|
|
3399
|
+
const node = (exportsSymbol == null ? void 0 : exportsSymbol.valueDeclaration) !== void 0 && !ts13.isFunctionExpression(exportsSymbol.valueDeclaration.parent) ? exportsSymbol.valueDeclaration : id.getSourceFile();
|
|
3423
3400
|
return {
|
|
3424
3401
|
kind: 0,
|
|
3425
3402
|
node,
|
|
@@ -3475,7 +3452,7 @@ var UmdReflectionHost = class extends Esm5ReflectionHost {
|
|
|
3475
3452
|
const moduleInfo = this.compilerHost.resolveModuleNames([moduleName], containingFile.fileName, void 0, void 0, this.program.getCompilerOptions())[0];
|
|
3476
3453
|
return moduleInfo && this.program.getSourceFile(absoluteFrom(moduleInfo.resolvedFileName));
|
|
3477
3454
|
} else {
|
|
3478
|
-
const moduleInfo =
|
|
3455
|
+
const moduleInfo = ts13.resolveModuleName(moduleName, containingFile.fileName, this.program.getCompilerOptions(), this.compilerHost);
|
|
3479
3456
|
return moduleInfo.resolvedModule && this.program.getSourceFile(absoluteFrom(moduleInfo.resolvedModule.resolvedFileName));
|
|
3480
3457
|
}
|
|
3481
3458
|
}
|
|
@@ -3484,60 +3461,176 @@ function parseStatementForUmdModule(statement) {
|
|
|
3484
3461
|
const wrapper = getUmdWrapper(statement);
|
|
3485
3462
|
if (wrapper === null)
|
|
3486
3463
|
return null;
|
|
3487
|
-
const factoryFnParamIndex = wrapper.fn.parameters.findIndex((parameter) =>
|
|
3464
|
+
const factoryFnParamIndex = wrapper.fn.parameters.findIndex((parameter) => ts13.isIdentifier(parameter.name) && parameter.name.text === "factory");
|
|
3488
3465
|
if (factoryFnParamIndex === -1)
|
|
3489
3466
|
return null;
|
|
3490
3467
|
const factoryFn = stripParentheses(wrapper.call.arguments[factoryFnParamIndex]);
|
|
3491
|
-
if (!factoryFn || !
|
|
3468
|
+
if (!factoryFn || !ts13.isFunctionExpression(factoryFn))
|
|
3492
3469
|
return null;
|
|
3493
|
-
|
|
3470
|
+
let factoryCalls = null;
|
|
3471
|
+
return {
|
|
3472
|
+
wrapperFn: wrapper.fn,
|
|
3473
|
+
factoryFn,
|
|
3474
|
+
get factoryCalls() {
|
|
3475
|
+
if (factoryCalls === null) {
|
|
3476
|
+
factoryCalls = parseUmdWrapperFunction(this.wrapperFn);
|
|
3477
|
+
}
|
|
3478
|
+
return factoryCalls;
|
|
3479
|
+
}
|
|
3480
|
+
};
|
|
3494
3481
|
}
|
|
3495
3482
|
function getUmdWrapper(statement) {
|
|
3496
|
-
if (!
|
|
3483
|
+
if (!ts13.isExpressionStatement(statement))
|
|
3497
3484
|
return null;
|
|
3498
|
-
if (
|
|
3485
|
+
if (ts13.isParenthesizedExpression(statement.expression) && ts13.isCallExpression(statement.expression.expression) && ts13.isFunctionExpression(statement.expression.expression.expression)) {
|
|
3499
3486
|
const call = statement.expression.expression;
|
|
3500
3487
|
const fn = statement.expression.expression.expression;
|
|
3501
3488
|
return { call, fn };
|
|
3502
3489
|
}
|
|
3503
|
-
if (
|
|
3490
|
+
if (ts13.isCallExpression(statement.expression) && ts13.isParenthesizedExpression(statement.expression.expression) && ts13.isFunctionExpression(statement.expression.expression.expression)) {
|
|
3504
3491
|
const call = statement.expression;
|
|
3505
3492
|
const fn = statement.expression.expression.expression;
|
|
3506
3493
|
return { call, fn };
|
|
3507
3494
|
}
|
|
3508
3495
|
return null;
|
|
3509
3496
|
}
|
|
3510
|
-
function
|
|
3511
|
-
const
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3497
|
+
function parseUmdWrapperFunction(wrapperFn) {
|
|
3498
|
+
const stmt = wrapperFn.body.statements[0];
|
|
3499
|
+
let conditionalFactoryCalls;
|
|
3500
|
+
if (ts13.isExpressionStatement(stmt) && ts13.isConditionalExpression(stmt.expression)) {
|
|
3501
|
+
conditionalFactoryCalls = extractFactoryCallsFromConditionalExpression(stmt.expression);
|
|
3502
|
+
} else if (ts13.isIfStatement(stmt)) {
|
|
3503
|
+
conditionalFactoryCalls = extractFactoryCallsFromIfStatement(stmt);
|
|
3504
|
+
} else {
|
|
3505
|
+
throw new Error("UMD wrapper body is not in a supported format (expected a conditional expression or if statement):\n" + wrapperFn.body.getText());
|
|
3506
|
+
}
|
|
3507
|
+
const amdDefine = getAmdDefineCall(conditionalFactoryCalls);
|
|
3508
|
+
const commonJs = getCommonJsFactoryCall(conditionalFactoryCalls);
|
|
3509
|
+
const commonJs2 = getCommonJs2FactoryCall(conditionalFactoryCalls);
|
|
3510
|
+
const global = getGlobalFactoryCall(conditionalFactoryCalls);
|
|
3511
|
+
const cjsCallForImports = commonJs2 || commonJs;
|
|
3512
|
+
if (cjsCallForImports === null) {
|
|
3513
|
+
throw new Error("Unable to find a CommonJS or CommonJS2 factory call inside the UMD wrapper function:\n" + stmt.getText());
|
|
3514
|
+
}
|
|
3515
|
+
return { amdDefine, commonJs, commonJs2, global, cjsCallForImports };
|
|
3516
|
+
}
|
|
3517
|
+
function extractFactoryCallsFromConditionalExpression(node) {
|
|
3518
|
+
const factoryCalls = [];
|
|
3519
|
+
let currentNode = node;
|
|
3520
|
+
while (ts13.isConditionalExpression(currentNode)) {
|
|
3521
|
+
if (!ts13.isBinaryExpression(currentNode.condition)) {
|
|
3522
|
+
throw new Error("Condition inside UMD wrapper is not a binary expression:\n" + currentNode.condition.getText());
|
|
3523
|
+
}
|
|
3524
|
+
factoryCalls.push({
|
|
3525
|
+
condition: currentNode.condition,
|
|
3526
|
+
factoryCall: getFunctionCallFromExpression(currentNode.whenTrue)
|
|
3516
3527
|
});
|
|
3528
|
+
currentNode = currentNode.whenFalse;
|
|
3517
3529
|
}
|
|
3518
|
-
|
|
3530
|
+
factoryCalls.push({
|
|
3531
|
+
condition: null,
|
|
3532
|
+
factoryCall: getFunctionCallFromExpression(currentNode)
|
|
3533
|
+
});
|
|
3534
|
+
return factoryCalls;
|
|
3519
3535
|
}
|
|
3520
|
-
function
|
|
3521
|
-
const
|
|
3522
|
-
|
|
3523
|
-
|
|
3536
|
+
function extractFactoryCallsFromIfStatement(node) {
|
|
3537
|
+
const factoryCalls = [];
|
|
3538
|
+
let currentNode = node;
|
|
3539
|
+
while (currentNode && ts13.isIfStatement(currentNode)) {
|
|
3540
|
+
if (!ts13.isBinaryExpression(currentNode.expression)) {
|
|
3541
|
+
throw new Error("Condition inside UMD wrapper is not a binary expression:\n" + currentNode.expression.getText());
|
|
3542
|
+
}
|
|
3543
|
+
if (!ts13.isExpressionStatement(currentNode.thenStatement)) {
|
|
3544
|
+
throw new Error("Then-statement inside UMD wrapper is not an expression statement:\n" + currentNode.thenStatement.getText());
|
|
3545
|
+
}
|
|
3546
|
+
factoryCalls.push({
|
|
3547
|
+
condition: currentNode.expression,
|
|
3548
|
+
factoryCall: getFunctionCallFromExpression(currentNode.thenStatement.expression)
|
|
3549
|
+
});
|
|
3550
|
+
currentNode = currentNode.elseStatement;
|
|
3524
3551
|
}
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
function findModulePaths(node) {
|
|
3529
|
-
if (isRequireCall(node)) {
|
|
3530
|
-
const argument = node.arguments[0];
|
|
3531
|
-
if (ts14.isStringLiteral(argument)) {
|
|
3532
|
-
modulePaths.push(argument.text);
|
|
3533
|
-
}
|
|
3534
|
-
} else {
|
|
3535
|
-
node.forEachChild(findModulePaths);
|
|
3552
|
+
if (currentNode) {
|
|
3553
|
+
if (!ts13.isExpressionStatement(currentNode)) {
|
|
3554
|
+
throw new Error("Else-statement inside UMD wrapper is not an expression statement:\n" + currentNode.getText());
|
|
3536
3555
|
}
|
|
3556
|
+
factoryCalls.push({
|
|
3557
|
+
condition: null,
|
|
3558
|
+
factoryCall: getFunctionCallFromExpression(currentNode.expression)
|
|
3559
|
+
});
|
|
3560
|
+
}
|
|
3561
|
+
return factoryCalls;
|
|
3562
|
+
}
|
|
3563
|
+
function getFunctionCallFromExpression(node) {
|
|
3564
|
+
if (ts13.isParenthesizedExpression(node)) {
|
|
3565
|
+
return getFunctionCallFromExpression(node.expression);
|
|
3566
|
+
}
|
|
3567
|
+
if (ts13.isBinaryExpression(node) && [ts13.SyntaxKind.CommaToken, ts13.SyntaxKind.EqualsToken].includes(node.operatorToken.kind)) {
|
|
3568
|
+
return getFunctionCallFromExpression(node.right);
|
|
3569
|
+
}
|
|
3570
|
+
if (!ts13.isCallExpression(node)) {
|
|
3571
|
+
throw new Error("Expression inside UMD wrapper is not a call expression:\n" + node.getText());
|
|
3572
|
+
}
|
|
3573
|
+
return node;
|
|
3574
|
+
}
|
|
3575
|
+
function getAmdDefineCall(calls) {
|
|
3576
|
+
var _a;
|
|
3577
|
+
const amdConditionalCall = calls.find((call) => {
|
|
3578
|
+
var _a2;
|
|
3579
|
+
return ((_a2 = call.condition) == null ? void 0 : _a2.operatorToken.kind) === ts13.SyntaxKind.AmpersandAmpersandToken && oneOfBinaryConditions(call.condition, (exp) => isTypeOf(exp, "define")) && ts13.isIdentifier(call.factoryCall.expression) && call.factoryCall.expression.text === "define";
|
|
3580
|
+
});
|
|
3581
|
+
return (_a = amdConditionalCall == null ? void 0 : amdConditionalCall.factoryCall) != null ? _a : null;
|
|
3582
|
+
}
|
|
3583
|
+
function getCommonJsFactoryCall(calls) {
|
|
3584
|
+
var _a;
|
|
3585
|
+
const cjsConditionalCall = calls.find((call) => {
|
|
3586
|
+
var _a2;
|
|
3587
|
+
return ((_a2 = call.condition) == null ? void 0 : _a2.operatorToken.kind) === ts13.SyntaxKind.EqualsEqualsEqualsToken && isTypeOf(call.condition, "exports") && ts13.isIdentifier(call.factoryCall.expression) && call.factoryCall.expression.text === "factory";
|
|
3588
|
+
});
|
|
3589
|
+
return (_a = cjsConditionalCall == null ? void 0 : cjsConditionalCall.factoryCall) != null ? _a : null;
|
|
3590
|
+
}
|
|
3591
|
+
function getCommonJs2FactoryCall(calls) {
|
|
3592
|
+
var _a;
|
|
3593
|
+
const cjs2ConditionalCall = calls.find((call) => {
|
|
3594
|
+
var _a2;
|
|
3595
|
+
return ((_a2 = call.condition) == null ? void 0 : _a2.operatorToken.kind) === ts13.SyntaxKind.AmpersandAmpersandToken && oneOfBinaryConditions(call.condition, (exp) => isTypeOf(exp, "exports", "module")) && ts13.isIdentifier(call.factoryCall.expression) && call.factoryCall.expression.text === "factory";
|
|
3596
|
+
});
|
|
3597
|
+
return (_a = cjs2ConditionalCall == null ? void 0 : cjs2ConditionalCall.factoryCall) != null ? _a : null;
|
|
3598
|
+
}
|
|
3599
|
+
function getGlobalFactoryCall(calls) {
|
|
3600
|
+
var _a;
|
|
3601
|
+
const globalConditionalCall = calls.find((call) => call.condition === null);
|
|
3602
|
+
return (_a = globalConditionalCall == null ? void 0 : globalConditionalCall.factoryCall) != null ? _a : null;
|
|
3603
|
+
}
|
|
3604
|
+
function oneOfBinaryConditions(node, test) {
|
|
3605
|
+
return test(node.left) || test(node.right);
|
|
3606
|
+
}
|
|
3607
|
+
function isTypeOf(node, ...types) {
|
|
3608
|
+
return ts13.isBinaryExpression(node) && ts13.isTypeOfExpression(node.left) && ts13.isIdentifier(node.left.expression) && types.includes(node.left.expression.text);
|
|
3609
|
+
}
|
|
3610
|
+
function getImportsOfUmdModule(umdModule) {
|
|
3611
|
+
const imports = [];
|
|
3612
|
+
const cjsFactoryCall = umdModule.factoryCalls.cjsCallForImports;
|
|
3613
|
+
const depStartIndex = cjsFactoryCall.arguments.findIndex((arg) => isRequireCall(arg));
|
|
3614
|
+
if (depStartIndex !== -1) {
|
|
3615
|
+
for (let i = depStartIndex; i < umdModule.factoryFn.parameters.length; i++) {
|
|
3616
|
+
imports.push({
|
|
3617
|
+
parameter: umdModule.factoryFn.parameters[i],
|
|
3618
|
+
path: getRequiredModulePath(cjsFactoryCall, i)
|
|
3619
|
+
});
|
|
3620
|
+
}
|
|
3621
|
+
}
|
|
3622
|
+
return imports;
|
|
3623
|
+
}
|
|
3624
|
+
function getRequiredModulePath(cjsFactoryCall, paramIndex) {
|
|
3625
|
+
const requireCall = cjsFactoryCall.arguments[paramIndex];
|
|
3626
|
+
if (requireCall !== void 0 && !isRequireCall(requireCall)) {
|
|
3627
|
+
throw new Error(`Argument at index ${paramIndex} of UMD factory call is not a \`require\` call with a single string argument:
|
|
3628
|
+
` + cjsFactoryCall.getText());
|
|
3537
3629
|
}
|
|
3630
|
+
return requireCall.arguments[0].text;
|
|
3538
3631
|
}
|
|
3539
3632
|
function isExportsIdentifier(node) {
|
|
3540
|
-
return
|
|
3633
|
+
return ts13.isIdentifier(node) && node.text === "exports";
|
|
3541
3634
|
}
|
|
3542
3635
|
|
|
3543
3636
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/entry_point.mjs
|
|
@@ -3638,11 +3731,11 @@ function sniffModuleFormat(fs5, sourceFilePath) {
|
|
|
3638
3731
|
if (resolvedPath === null) {
|
|
3639
3732
|
return void 0;
|
|
3640
3733
|
}
|
|
3641
|
-
const sourceFile =
|
|
3734
|
+
const sourceFile = ts14.createSourceFile(sourceFilePath, fs5.readFile(resolvedPath), ts14.ScriptTarget.ES5);
|
|
3642
3735
|
if (sourceFile.statements.length === 0) {
|
|
3643
3736
|
return void 0;
|
|
3644
3737
|
}
|
|
3645
|
-
if (
|
|
3738
|
+
if (ts14.isExternalModule(sourceFile)) {
|
|
3646
3739
|
return "esm5";
|
|
3647
3740
|
} else if (parseStatementForUmdModule(sourceFile.statements[0]) !== null) {
|
|
3648
3741
|
return "umd";
|
|
@@ -3802,12 +3895,12 @@ var DependencyResolver = class {
|
|
|
3802
3895
|
};
|
|
3803
3896
|
|
|
3804
3897
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/dependencies/esm_dependency_host.mjs
|
|
3805
|
-
import
|
|
3898
|
+
import ts15 from "typescript";
|
|
3806
3899
|
var EsmDependencyHost = class extends DependencyHostBase {
|
|
3807
3900
|
constructor(fs5, moduleResolver, scanImportExpressions = true) {
|
|
3808
3901
|
super(fs5, moduleResolver);
|
|
3809
3902
|
this.scanImportExpressions = scanImportExpressions;
|
|
3810
|
-
this.scanner =
|
|
3903
|
+
this.scanner = ts15.createScanner(ts15.ScriptTarget.Latest, true);
|
|
3811
3904
|
}
|
|
3812
3905
|
canSkipFile(fileContents) {
|
|
3813
3906
|
return !hasImportOrReexportStatements(fileContents);
|
|
@@ -3815,29 +3908,29 @@ var EsmDependencyHost = class extends DependencyHostBase {
|
|
|
3815
3908
|
extractImports(file, fileContents) {
|
|
3816
3909
|
const imports = new Set();
|
|
3817
3910
|
const templateStack = [];
|
|
3818
|
-
let lastToken =
|
|
3819
|
-
let currentToken =
|
|
3911
|
+
let lastToken = ts15.SyntaxKind.Unknown;
|
|
3912
|
+
let currentToken = ts15.SyntaxKind.Unknown;
|
|
3820
3913
|
const stopAtIndex = findLastPossibleImportOrReexport(fileContents);
|
|
3821
3914
|
this.scanner.setText(fileContents);
|
|
3822
|
-
while ((currentToken = this.scanner.scan()) !==
|
|
3915
|
+
while ((currentToken = this.scanner.scan()) !== ts15.SyntaxKind.EndOfFileToken) {
|
|
3823
3916
|
if (this.scanner.getTokenPos() > stopAtIndex) {
|
|
3824
3917
|
break;
|
|
3825
3918
|
}
|
|
3826
3919
|
switch (currentToken) {
|
|
3827
|
-
case
|
|
3920
|
+
case ts15.SyntaxKind.TemplateHead:
|
|
3828
3921
|
templateStack.push(currentToken);
|
|
3829
3922
|
break;
|
|
3830
|
-
case
|
|
3923
|
+
case ts15.SyntaxKind.OpenBraceToken:
|
|
3831
3924
|
if (templateStack.length > 0) {
|
|
3832
3925
|
templateStack.push(currentToken);
|
|
3833
3926
|
}
|
|
3834
3927
|
break;
|
|
3835
|
-
case
|
|
3928
|
+
case ts15.SyntaxKind.CloseBraceToken:
|
|
3836
3929
|
if (templateStack.length > 0) {
|
|
3837
3930
|
const templateToken = templateStack[templateStack.length - 1];
|
|
3838
|
-
if (templateToken ===
|
|
3931
|
+
if (templateToken === ts15.SyntaxKind.TemplateHead) {
|
|
3839
3932
|
currentToken = this.scanner.reScanTemplateToken(false);
|
|
3840
|
-
if (currentToken ===
|
|
3933
|
+
if (currentToken === ts15.SyntaxKind.TemplateTail) {
|
|
3841
3934
|
templateStack.pop();
|
|
3842
3935
|
}
|
|
3843
3936
|
} else {
|
|
@@ -3845,19 +3938,19 @@ var EsmDependencyHost = class extends DependencyHostBase {
|
|
|
3845
3938
|
}
|
|
3846
3939
|
}
|
|
3847
3940
|
break;
|
|
3848
|
-
case
|
|
3849
|
-
case
|
|
3941
|
+
case ts15.SyntaxKind.SlashToken:
|
|
3942
|
+
case ts15.SyntaxKind.SlashEqualsToken:
|
|
3850
3943
|
if (canPrecedeARegex(lastToken)) {
|
|
3851
3944
|
currentToken = this.scanner.reScanSlashToken();
|
|
3852
3945
|
}
|
|
3853
3946
|
break;
|
|
3854
|
-
case
|
|
3947
|
+
case ts15.SyntaxKind.ImportKeyword:
|
|
3855
3948
|
const importPath = this.extractImportPath();
|
|
3856
3949
|
if (importPath !== null) {
|
|
3857
3950
|
imports.add(importPath);
|
|
3858
3951
|
}
|
|
3859
3952
|
break;
|
|
3860
|
-
case
|
|
3953
|
+
case ts15.SyntaxKind.ExportKeyword:
|
|
3861
3954
|
const reexportPath = this.extractReexportPath();
|
|
3862
3955
|
if (reexportPath !== null) {
|
|
3863
3956
|
imports.add(reexportPath);
|
|
@@ -3875,48 +3968,48 @@ var EsmDependencyHost = class extends DependencyHostBase {
|
|
|
3875
3968
|
return sideEffectImportPath;
|
|
3876
3969
|
}
|
|
3877
3970
|
let kind = this.scanner.getToken();
|
|
3878
|
-
if (kind ===
|
|
3971
|
+
if (kind === ts15.SyntaxKind.OpenParenToken) {
|
|
3879
3972
|
return this.scanImportExpressions ? this.tryStringLiteral() : null;
|
|
3880
3973
|
}
|
|
3881
|
-
if (kind ===
|
|
3974
|
+
if (kind === ts15.SyntaxKind.Identifier) {
|
|
3882
3975
|
kind = this.scanner.scan();
|
|
3883
|
-
if (kind ===
|
|
3976
|
+
if (kind === ts15.SyntaxKind.CommaToken) {
|
|
3884
3977
|
kind = this.scanner.scan();
|
|
3885
3978
|
}
|
|
3886
3979
|
}
|
|
3887
|
-
if (kind ===
|
|
3980
|
+
if (kind === ts15.SyntaxKind.AsteriskToken) {
|
|
3888
3981
|
kind = this.skipNamespacedClause();
|
|
3889
3982
|
if (kind === null) {
|
|
3890
3983
|
return null;
|
|
3891
3984
|
}
|
|
3892
|
-
} else if (kind ===
|
|
3985
|
+
} else if (kind === ts15.SyntaxKind.OpenBraceToken) {
|
|
3893
3986
|
kind = this.skipNamedClause();
|
|
3894
3987
|
}
|
|
3895
|
-
if (kind !==
|
|
3988
|
+
if (kind !== ts15.SyntaxKind.FromKeyword) {
|
|
3896
3989
|
return null;
|
|
3897
3990
|
}
|
|
3898
3991
|
return this.tryStringLiteral();
|
|
3899
3992
|
}
|
|
3900
3993
|
extractReexportPath() {
|
|
3901
3994
|
let token = this.scanner.scan();
|
|
3902
|
-
if (token ===
|
|
3995
|
+
if (token === ts15.SyntaxKind.AsteriskToken) {
|
|
3903
3996
|
token = this.skipNamespacedClause();
|
|
3904
3997
|
if (token === null) {
|
|
3905
3998
|
return null;
|
|
3906
3999
|
}
|
|
3907
|
-
} else if (token ===
|
|
4000
|
+
} else if (token === ts15.SyntaxKind.OpenBraceToken) {
|
|
3908
4001
|
token = this.skipNamedClause();
|
|
3909
4002
|
}
|
|
3910
|
-
if (token !==
|
|
4003
|
+
if (token !== ts15.SyntaxKind.FromKeyword) {
|
|
3911
4004
|
return null;
|
|
3912
4005
|
}
|
|
3913
4006
|
return this.tryStringLiteral();
|
|
3914
4007
|
}
|
|
3915
4008
|
skipNamespacedClause() {
|
|
3916
4009
|
let token = this.scanner.scan();
|
|
3917
|
-
if (token ===
|
|
4010
|
+
if (token === ts15.SyntaxKind.AsKeyword) {
|
|
3918
4011
|
token = this.scanner.scan();
|
|
3919
|
-
if (token !==
|
|
4012
|
+
if (token !== ts15.SyntaxKind.Identifier) {
|
|
3920
4013
|
return null;
|
|
3921
4014
|
}
|
|
3922
4015
|
token = this.scanner.scan();
|
|
@@ -3926,10 +4019,10 @@ var EsmDependencyHost = class extends DependencyHostBase {
|
|
|
3926
4019
|
skipNamedClause() {
|
|
3927
4020
|
let braceCount = 1;
|
|
3928
4021
|
let token = this.scanner.scan();
|
|
3929
|
-
while (braceCount > 0 && token !==
|
|
3930
|
-
if (token ===
|
|
4022
|
+
while (braceCount > 0 && token !== ts15.SyntaxKind.EndOfFileToken) {
|
|
4023
|
+
if (token === ts15.SyntaxKind.OpenBraceToken) {
|
|
3931
4024
|
braceCount++;
|
|
3932
|
-
} else if (token ===
|
|
4025
|
+
} else if (token === ts15.SyntaxKind.CloseBraceToken) {
|
|
3933
4026
|
braceCount--;
|
|
3934
4027
|
}
|
|
3935
4028
|
token = this.scanner.scan();
|
|
@@ -3937,7 +4030,7 @@ var EsmDependencyHost = class extends DependencyHostBase {
|
|
|
3937
4030
|
return token;
|
|
3938
4031
|
}
|
|
3939
4032
|
tryStringLiteral() {
|
|
3940
|
-
return this.scanner.scan() ===
|
|
4033
|
+
return this.scanner.scan() === ts15.SyntaxKind.StringLiteral ? this.scanner.getTokenValue() : null;
|
|
3941
4034
|
}
|
|
3942
4035
|
};
|
|
3943
4036
|
function hasImportOrReexportStatements(source) {
|
|
@@ -3948,19 +4041,19 @@ function findLastPossibleImportOrReexport(source) {
|
|
|
3948
4041
|
}
|
|
3949
4042
|
function canPrecedeARegex(kind) {
|
|
3950
4043
|
switch (kind) {
|
|
3951
|
-
case
|
|
3952
|
-
case
|
|
3953
|
-
case
|
|
3954
|
-
case
|
|
3955
|
-
case
|
|
3956
|
-
case
|
|
3957
|
-
case
|
|
3958
|
-
case
|
|
3959
|
-
case
|
|
3960
|
-
case
|
|
3961
|
-
case
|
|
3962
|
-
case
|
|
3963
|
-
case
|
|
4044
|
+
case ts15.SyntaxKind.Identifier:
|
|
4045
|
+
case ts15.SyntaxKind.StringLiteral:
|
|
4046
|
+
case ts15.SyntaxKind.NumericLiteral:
|
|
4047
|
+
case ts15.SyntaxKind.BigIntLiteral:
|
|
4048
|
+
case ts15.SyntaxKind.RegularExpressionLiteral:
|
|
4049
|
+
case ts15.SyntaxKind.ThisKeyword:
|
|
4050
|
+
case ts15.SyntaxKind.PlusPlusToken:
|
|
4051
|
+
case ts15.SyntaxKind.MinusMinusToken:
|
|
4052
|
+
case ts15.SyntaxKind.CloseParenToken:
|
|
4053
|
+
case ts15.SyntaxKind.CloseBracketToken:
|
|
4054
|
+
case ts15.SyntaxKind.CloseBraceToken:
|
|
4055
|
+
case ts15.SyntaxKind.TrueKeyword:
|
|
4056
|
+
case ts15.SyntaxKind.FalseKeyword:
|
|
3964
4057
|
return false;
|
|
3965
4058
|
default:
|
|
3966
4059
|
return true;
|
|
@@ -3978,13 +4071,13 @@ var DtsDependencyHost = class extends EsmDependencyHost {
|
|
|
3978
4071
|
};
|
|
3979
4072
|
|
|
3980
4073
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/dependencies/umd_dependency_host.mjs
|
|
3981
|
-
import
|
|
4074
|
+
import ts16 from "typescript";
|
|
3982
4075
|
var UmdDependencyHost = class extends DependencyHostBase {
|
|
3983
4076
|
canSkipFile(fileContents) {
|
|
3984
4077
|
return !hasRequireCalls(fileContents);
|
|
3985
4078
|
}
|
|
3986
4079
|
extractImports(file, fileContents) {
|
|
3987
|
-
const sf =
|
|
4080
|
+
const sf = ts16.createSourceFile(file, fileContents, ts16.ScriptTarget.ES2015, true, ts16.ScriptKind.JS);
|
|
3988
4081
|
if (sf.statements.length !== 1) {
|
|
3989
4082
|
return new Set();
|
|
3990
4083
|
}
|
|
@@ -4468,7 +4561,7 @@ var ProgramBasedEntryPointFinder = class extends TracingEntryPointFinder {
|
|
|
4468
4561
|
};
|
|
4469
4562
|
|
|
4470
4563
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/build_marker.mjs
|
|
4471
|
-
var NGCC_VERSION = "13.0.
|
|
4564
|
+
var NGCC_VERSION = "13.0.3";
|
|
4472
4565
|
function needsCleaning(packageJson) {
|
|
4473
4566
|
return Object.values(packageJson.__processed_by_ivy_ngcc__ || {}).some((value) => value !== NGCC_VERSION);
|
|
4474
4567
|
}
|
|
@@ -5238,7 +5331,7 @@ var ClusterExecutor = class {
|
|
|
5238
5331
|
};
|
|
5239
5332
|
|
|
5240
5333
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/execution/create_compile_function.mjs
|
|
5241
|
-
import
|
|
5334
|
+
import ts61 from "typescript";
|
|
5242
5335
|
|
|
5243
5336
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/error_code.mjs
|
|
5244
5337
|
var ErrorCode;
|
|
@@ -5303,7 +5396,7 @@ var COMPILER_ERRORS_WITH_GUIDES = new Set([
|
|
|
5303
5396
|
]);
|
|
5304
5397
|
|
|
5305
5398
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/error.mjs
|
|
5306
|
-
import
|
|
5399
|
+
import ts17 from "typescript";
|
|
5307
5400
|
|
|
5308
5401
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/util.mjs
|
|
5309
5402
|
var ERROR_CODE_MATCHER = /(\u001b\[\d+m ?)TS-99(\d+: ?\u001b\[\d+m)/g;
|
|
@@ -5328,11 +5421,11 @@ var FatalDiagnosticError = class {
|
|
|
5328
5421
|
}
|
|
5329
5422
|
};
|
|
5330
5423
|
function makeDiagnostic(code, node, messageText, relatedInformation) {
|
|
5331
|
-
node =
|
|
5424
|
+
node = ts17.getOriginalNode(node);
|
|
5332
5425
|
return {
|
|
5333
|
-
category:
|
|
5426
|
+
category: ts17.DiagnosticCategory.Error,
|
|
5334
5427
|
code: ngErrorCode(code),
|
|
5335
|
-
file:
|
|
5428
|
+
file: ts17.getOriginalNode(node).getSourceFile(),
|
|
5336
5429
|
start: node.getStart(void 0, false),
|
|
5337
5430
|
length: node.getWidth(),
|
|
5338
5431
|
messageText,
|
|
@@ -5340,9 +5433,9 @@ function makeDiagnostic(code, node, messageText, relatedInformation) {
|
|
|
5340
5433
|
};
|
|
5341
5434
|
}
|
|
5342
5435
|
function makeRelatedInformation(node, messageText) {
|
|
5343
|
-
node =
|
|
5436
|
+
node = ts17.getOriginalNode(node);
|
|
5344
5437
|
return {
|
|
5345
|
-
category:
|
|
5438
|
+
category: ts17.DiagnosticCategory.Message,
|
|
5346
5439
|
code: 0,
|
|
5347
5440
|
file: node.getSourceFile(),
|
|
5348
5441
|
start: node.getStart(),
|
|
@@ -5355,20 +5448,20 @@ function isFatalDiagnosticError(err) {
|
|
|
5355
5448
|
}
|
|
5356
5449
|
|
|
5357
5450
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/bundle_program.mjs
|
|
5358
|
-
import
|
|
5451
|
+
import ts19 from "typescript";
|
|
5359
5452
|
|
|
5360
5453
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/patch_ts_expando_initializer.mjs
|
|
5361
|
-
import
|
|
5454
|
+
import ts18 from "typescript";
|
|
5362
5455
|
function patchTsGetExpandoInitializer() {
|
|
5363
5456
|
if (isTs31778GetExpandoInitializerFixed()) {
|
|
5364
5457
|
return null;
|
|
5365
5458
|
}
|
|
5366
|
-
const originalGetExpandoInitializer =
|
|
5459
|
+
const originalGetExpandoInitializer = ts18.getExpandoInitializer;
|
|
5367
5460
|
if (originalGetExpandoInitializer === void 0) {
|
|
5368
5461
|
throw makeUnsupportedTypeScriptError();
|
|
5369
5462
|
}
|
|
5370
|
-
|
|
5371
|
-
if (
|
|
5463
|
+
ts18.getExpandoInitializer = (initializer, isPrototypeAssignment) => {
|
|
5464
|
+
if (ts18.isParenthesizedExpression(initializer) && ts18.isCallExpression(initializer.expression)) {
|
|
5372
5465
|
initializer = initializer.expression;
|
|
5373
5466
|
}
|
|
5374
5467
|
return originalGetExpandoInitializer(initializer, isPrototypeAssignment);
|
|
@@ -5377,7 +5470,7 @@ function patchTsGetExpandoInitializer() {
|
|
|
5377
5470
|
}
|
|
5378
5471
|
function restoreGetExpandoInitializer(originalGetExpandoInitializer) {
|
|
5379
5472
|
if (originalGetExpandoInitializer !== null) {
|
|
5380
|
-
|
|
5473
|
+
ts18.getExpandoInitializer = originalGetExpandoInitializer;
|
|
5381
5474
|
}
|
|
5382
5475
|
}
|
|
5383
5476
|
var ts31778FixedResult = null;
|
|
@@ -5408,7 +5501,7 @@ function checkIfExpandoPropertyIsPresent() {
|
|
|
5408
5501
|
}());
|
|
5409
5502
|
A.expando = true;
|
|
5410
5503
|
}());`;
|
|
5411
|
-
const sourceFile =
|
|
5504
|
+
const sourceFile = ts18.createSourceFile("test.js", sourceText, ts18.ScriptTarget.ES5, true, ts18.ScriptKind.JS);
|
|
5412
5505
|
const host = {
|
|
5413
5506
|
getSourceFile() {
|
|
5414
5507
|
return sourceFile;
|
|
@@ -5441,14 +5534,14 @@ function checkIfExpandoPropertyIsPresent() {
|
|
|
5441
5534
|
}
|
|
5442
5535
|
};
|
|
5443
5536
|
const options2 = { noResolve: true, noLib: true, noEmit: true, allowJs: true };
|
|
5444
|
-
const program =
|
|
5537
|
+
const program = ts18.createProgram(["test.js"], options2, host);
|
|
5445
5538
|
function visitor(node) {
|
|
5446
|
-
if (
|
|
5539
|
+
if (ts18.isVariableDeclaration(node) && hasNameIdentifier(node) && node.name.text === "A") {
|
|
5447
5540
|
return node;
|
|
5448
5541
|
}
|
|
5449
|
-
return
|
|
5542
|
+
return ts18.forEachChild(node, visitor);
|
|
5450
5543
|
}
|
|
5451
|
-
const declaration =
|
|
5544
|
+
const declaration = ts18.forEachChild(sourceFile, visitor);
|
|
5452
5545
|
if (declaration === void 0) {
|
|
5453
5546
|
throw new Error("Unable to find declaration of outer A");
|
|
5454
5547
|
}
|
|
@@ -5467,7 +5560,7 @@ function makeBundleProgram(fs5, isCore, pkg, path7, r3FileName, options2, host,
|
|
|
5467
5560
|
const r3SymbolsPath = isCore ? findR3SymbolsPath(fs5, fs5.dirname(path7), r3FileName) : null;
|
|
5468
5561
|
let rootPaths = r3SymbolsPath ? [path7, r3SymbolsPath, ...additionalFiles] : [path7, ...additionalFiles];
|
|
5469
5562
|
const originalGetExpandoInitializer = patchTsGetExpandoInitializer();
|
|
5470
|
-
const program =
|
|
5563
|
+
const program = ts19.createProgram(rootPaths, options2, host);
|
|
5471
5564
|
program.getTypeChecker();
|
|
5472
5565
|
restoreGetExpandoInitializer(originalGetExpandoInitializer);
|
|
5473
5566
|
const file = program.getSourceFile(path7);
|
|
@@ -5493,7 +5586,7 @@ function findR3SymbolsPath(fs5, directory, filename) {
|
|
|
5493
5586
|
}
|
|
5494
5587
|
|
|
5495
5588
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/ngcc_compiler_host.mjs
|
|
5496
|
-
import
|
|
5589
|
+
import ts20 from "typescript";
|
|
5497
5590
|
var NgccSourcesCompilerHost = class extends NgtscCompilerHost {
|
|
5498
5591
|
constructor(fs5, options2, cache, moduleResolutionCache, packagePath) {
|
|
5499
5592
|
super(fs5, options2);
|
|
@@ -5506,14 +5599,14 @@ var NgccSourcesCompilerHost = class extends NgtscCompilerHost {
|
|
|
5506
5599
|
}
|
|
5507
5600
|
resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference) {
|
|
5508
5601
|
return moduleNames.map((moduleName) => {
|
|
5509
|
-
const { resolvedModule } =
|
|
5510
|
-
if ((resolvedModule == null ? void 0 : resolvedModule.extension) ===
|
|
5602
|
+
const { resolvedModule } = ts20.resolveModuleName(moduleName, containingFile, this.options, this, this.moduleResolutionCache, redirectedReference);
|
|
5603
|
+
if ((resolvedModule == null ? void 0 : resolvedModule.extension) === ts20.Extension.Dts && containingFile.endsWith(".js") && isRelativePath(moduleName)) {
|
|
5511
5604
|
const jsFile = resolvedModule.resolvedFileName.replace(/\.d\.ts$/, ".js");
|
|
5512
5605
|
if (this.fileExists(jsFile)) {
|
|
5513
|
-
return __spreadProps(__spreadValues({}, resolvedModule), { resolvedFileName: jsFile, extension:
|
|
5606
|
+
return __spreadProps(__spreadValues({}, resolvedModule), { resolvedFileName: jsFile, extension: ts20.Extension.Js });
|
|
5514
5607
|
}
|
|
5515
5608
|
}
|
|
5516
|
-
if ((resolvedModule == null ? void 0 : resolvedModule.extension) ===
|
|
5609
|
+
if ((resolvedModule == null ? void 0 : resolvedModule.extension) === ts20.Extension.Js && !isWithinPackage(this.packagePath, this.fs.resolve(resolvedModule.resolvedFileName))) {
|
|
5517
5610
|
return void 0;
|
|
5518
5611
|
}
|
|
5519
5612
|
return resolvedModule;
|
|
@@ -5531,14 +5624,14 @@ var NgccDtsCompilerHost = class extends NgtscCompilerHost {
|
|
|
5531
5624
|
}
|
|
5532
5625
|
resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference) {
|
|
5533
5626
|
return moduleNames.map((moduleName) => {
|
|
5534
|
-
const { resolvedModule } =
|
|
5627
|
+
const { resolvedModule } = ts20.resolveModuleName(moduleName, containingFile, this.options, this, this.moduleResolutionCache, redirectedReference);
|
|
5535
5628
|
return resolvedModule;
|
|
5536
5629
|
});
|
|
5537
5630
|
}
|
|
5538
5631
|
};
|
|
5539
5632
|
|
|
5540
5633
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/source_file_cache.mjs
|
|
5541
|
-
import
|
|
5634
|
+
import ts21 from "typescript";
|
|
5542
5635
|
var SharedFileCache = class {
|
|
5543
5636
|
constructor(fs5) {
|
|
5544
5637
|
this.fs = fs5;
|
|
@@ -5560,7 +5653,7 @@ var SharedFileCache = class {
|
|
|
5560
5653
|
if (content === void 0) {
|
|
5561
5654
|
return void 0;
|
|
5562
5655
|
}
|
|
5563
|
-
const sf =
|
|
5656
|
+
const sf = ts21.createSourceFile(absPath, content, ts21.ScriptTarget.ES2015);
|
|
5564
5657
|
this.sfCache.set(absPath, sf);
|
|
5565
5658
|
}
|
|
5566
5659
|
return this.sfCache.get(absPath);
|
|
@@ -5571,7 +5664,7 @@ var SharedFileCache = class {
|
|
|
5571
5664
|
return void 0;
|
|
5572
5665
|
}
|
|
5573
5666
|
if (!this.sfCache.has(absPath) || this.sfCache.get(absPath).text !== content) {
|
|
5574
|
-
const sf =
|
|
5667
|
+
const sf = ts21.createSourceFile(absPath, content, ts21.ScriptTarget.ES2015);
|
|
5575
5668
|
this.sfCache.set(absPath, sf);
|
|
5576
5669
|
}
|
|
5577
5670
|
return this.sfCache.get(absPath);
|
|
@@ -5621,7 +5714,7 @@ var EntryPointFileCache = class {
|
|
|
5621
5714
|
if (content === void 0) {
|
|
5622
5715
|
return void 0;
|
|
5623
5716
|
}
|
|
5624
|
-
const sf =
|
|
5717
|
+
const sf = ts21.createSourceFile(fileName, content, languageVersion);
|
|
5625
5718
|
this.sfCache.set(absPath, sf);
|
|
5626
5719
|
return sf;
|
|
5627
5720
|
}
|
|
@@ -5633,7 +5726,7 @@ function readFile(absPath, fs5) {
|
|
|
5633
5726
|
return fs5.readFile(absPath);
|
|
5634
5727
|
}
|
|
5635
5728
|
function createModuleResolutionCache(fs5) {
|
|
5636
|
-
return
|
|
5729
|
+
return ts21.createModuleResolutionCache(fs5.pwd(), (fileName) => {
|
|
5637
5730
|
return fs5.isCaseSensitive() ? fileName : fileName.toLowerCase();
|
|
5638
5731
|
});
|
|
5639
5732
|
}
|
|
@@ -5680,24 +5773,24 @@ function computePotentialDtsFilesFromJsFiles(fs5, srcProgram, formatPath, typing
|
|
|
5680
5773
|
}
|
|
5681
5774
|
|
|
5682
5775
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/transformer.mjs
|
|
5683
|
-
import
|
|
5776
|
+
import ts60 from "typescript";
|
|
5684
5777
|
|
|
5685
5778
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/analysis/decoration_analyzer.mjs
|
|
5686
5779
|
import { ConstantPool as ConstantPool2 } from "@angular/compiler";
|
|
5687
5780
|
|
|
5688
5781
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/component.mjs
|
|
5689
5782
|
import { compileClassMetadata as compileClassMetadata3, compileComponentFromMetadata, compileDeclareClassMetadata as compileDeclareClassMetadata3, compileDeclareComponentFromMetadata, CssSelector, DEFAULT_INTERPOLATION_CONFIG, DomElementSchemaRegistry, ExternalExpr as ExternalExpr7, FactoryTarget as FactoryTarget3, InterpolationConfig, makeBindingParser as makeBindingParser2, ParseSourceFile as ParseSourceFile2, parseTemplate, R3TargetBinder, SelectorMatcher, ViewEncapsulation, WrappedNodeExpr as WrappedNodeExpr6 } from "@angular/compiler";
|
|
5690
|
-
import
|
|
5783
|
+
import ts45 from "typescript";
|
|
5691
5784
|
|
|
5692
5785
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/alias.mjs
|
|
5693
5786
|
import { ExternalExpr as ExternalExpr2 } from "@angular/compiler";
|
|
5694
5787
|
|
|
5695
5788
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/emitter.mjs
|
|
5696
5789
|
import { ExternalExpr, ExternalReference, WrappedNodeExpr } from "@angular/compiler";
|
|
5697
|
-
import
|
|
5790
|
+
import ts23 from "typescript";
|
|
5698
5791
|
|
|
5699
5792
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/find_export.mjs
|
|
5700
|
-
import
|
|
5793
|
+
import ts22 from "typescript";
|
|
5701
5794
|
function findExportedNameOfNode(target, file, reflector) {
|
|
5702
5795
|
const exports = reflector.getExportsOfModule(file);
|
|
5703
5796
|
if (exports === null) {
|
|
@@ -5777,9 +5870,9 @@ var AbsoluteModuleStrategy = class {
|
|
|
5777
5870
|
if (ref.bestGuessOwningModule === null) {
|
|
5778
5871
|
return null;
|
|
5779
5872
|
} else if (!isDeclaration(ref.node)) {
|
|
5780
|
-
throw new Error(`Debug assert: unable to import a Reference to non-declaration of type ${
|
|
5873
|
+
throw new Error(`Debug assert: unable to import a Reference to non-declaration of type ${ts23.SyntaxKind[ref.node.kind]}.`);
|
|
5781
5874
|
} else if ((importFlags & ImportFlags.AllowTypeImports) === 0 && isTypeDeclaration(ref.node)) {
|
|
5782
|
-
throw new Error(`Importing a type-only declaration of type ${
|
|
5875
|
+
throw new Error(`Importing a type-only declaration of type ${ts23.SyntaxKind[ref.node.kind]} in a value position is not allowed.`);
|
|
5783
5876
|
}
|
|
5784
5877
|
const { specifier, resolutionContext } = ref.bestGuessOwningModule;
|
|
5785
5878
|
const exports = this.getExportsOfModule(specifier, resolutionContext);
|
|
@@ -5945,7 +6038,7 @@ function validateAndRewriteCoreSymbol(name) {
|
|
|
5945
6038
|
}
|
|
5946
6039
|
|
|
5947
6040
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/default.mjs
|
|
5948
|
-
import
|
|
6041
|
+
import ts24 from "typescript";
|
|
5949
6042
|
var DefaultImportDeclaration = Symbol("DefaultImportDeclaration");
|
|
5950
6043
|
function attachDefaultImportDeclaration(expr, importDecl) {
|
|
5951
6044
|
expr[DefaultImportDeclaration] = importDecl;
|
|
@@ -6032,7 +6125,7 @@ var ModuleResolver2 = class {
|
|
|
6032
6125
|
};
|
|
6033
6126
|
|
|
6034
6127
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/semantic_graph/src/api.mjs
|
|
6035
|
-
import
|
|
6128
|
+
import ts25 from "typescript";
|
|
6036
6129
|
var SemanticSymbol = class {
|
|
6037
6130
|
constructor(decl) {
|
|
6038
6131
|
this.decl = decl;
|
|
@@ -6041,7 +6134,7 @@ var SemanticSymbol = class {
|
|
|
6041
6134
|
}
|
|
6042
6135
|
};
|
|
6043
6136
|
function getSymbolIdentifier(decl) {
|
|
6044
|
-
if (!
|
|
6137
|
+
if (!ts25.isSourceFile(decl.parent)) {
|
|
6045
6138
|
return null;
|
|
6046
6139
|
}
|
|
6047
6140
|
return decl.name.text;
|
|
@@ -6051,7 +6144,7 @@ function getSymbolIdentifier(decl) {
|
|
|
6051
6144
|
import { ExternalExpr as ExternalExpr3 } from "@angular/compiler";
|
|
6052
6145
|
|
|
6053
6146
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/semantic_graph/src/type_parameters.mjs
|
|
6054
|
-
import
|
|
6147
|
+
import ts26 from "typescript";
|
|
6055
6148
|
|
|
6056
6149
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/semantic_graph/src/util.mjs
|
|
6057
6150
|
function isSymbolEqual(a, b) {
|
|
@@ -6105,7 +6198,7 @@ function isSetEqual(a, b, equalityTester = referenceEquality) {
|
|
|
6105
6198
|
|
|
6106
6199
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/semantic_graph/src/type_parameters.mjs
|
|
6107
6200
|
function extractSemanticTypeParameters(node) {
|
|
6108
|
-
if (!
|
|
6201
|
+
if (!ts26.isClassDeclaration(node) || node.typeParameters === void 0) {
|
|
6109
6202
|
return null;
|
|
6110
6203
|
}
|
|
6111
6204
|
return node.typeParameters.map((typeParam) => ({ hasGenericTypeBound: typeParam.constraint !== void 0 }));
|
|
@@ -6131,7 +6224,7 @@ var MetaType;
|
|
|
6131
6224
|
})(MetaType || (MetaType = {}));
|
|
6132
6225
|
|
|
6133
6226
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/dts.mjs
|
|
6134
|
-
import
|
|
6227
|
+
import ts28 from "typescript";
|
|
6135
6228
|
|
|
6136
6229
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/property_mapping.mjs
|
|
6137
6230
|
var ClassPropertyMapping = class {
|
|
@@ -6210,13 +6303,13 @@ function reverseMapFromForwardMap(forwardMap) {
|
|
|
6210
6303
|
}
|
|
6211
6304
|
|
|
6212
6305
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/util.mjs
|
|
6213
|
-
import
|
|
6306
|
+
import ts27 from "typescript";
|
|
6214
6307
|
function extractReferencesFromType(checker, def, bestGuessOwningModule) {
|
|
6215
|
-
if (!
|
|
6308
|
+
if (!ts27.isTupleTypeNode(def)) {
|
|
6216
6309
|
return [];
|
|
6217
6310
|
}
|
|
6218
6311
|
return def.elements.map((element) => {
|
|
6219
|
-
if (!
|
|
6312
|
+
if (!ts27.isTypeQueryNode(element)) {
|
|
6220
6313
|
throw new Error(`Expected TypeQueryNode: ${nodeDebugInfo(element)}`);
|
|
6221
6314
|
}
|
|
6222
6315
|
const type = element.exprName;
|
|
@@ -6232,18 +6325,18 @@ function extractReferencesFromType(checker, def, bestGuessOwningModule) {
|
|
|
6232
6325
|
});
|
|
6233
6326
|
}
|
|
6234
6327
|
function readStringType(type) {
|
|
6235
|
-
if (!
|
|
6328
|
+
if (!ts27.isLiteralTypeNode(type) || !ts27.isStringLiteral(type.literal)) {
|
|
6236
6329
|
return null;
|
|
6237
6330
|
}
|
|
6238
6331
|
return type.literal.text;
|
|
6239
6332
|
}
|
|
6240
6333
|
function readStringMapType(type) {
|
|
6241
|
-
if (!
|
|
6334
|
+
if (!ts27.isTypeLiteralNode(type)) {
|
|
6242
6335
|
return {};
|
|
6243
6336
|
}
|
|
6244
6337
|
const obj = {};
|
|
6245
6338
|
type.members.forEach((member) => {
|
|
6246
|
-
if (!
|
|
6339
|
+
if (!ts27.isPropertySignature(member) || member.type === void 0 || member.name === void 0 || !ts27.isStringLiteral(member.name)) {
|
|
6247
6340
|
return;
|
|
6248
6341
|
}
|
|
6249
6342
|
const value = readStringType(member.type);
|
|
@@ -6255,12 +6348,12 @@ function readStringMapType(type) {
|
|
|
6255
6348
|
return obj;
|
|
6256
6349
|
}
|
|
6257
6350
|
function readStringArrayType(type) {
|
|
6258
|
-
if (!
|
|
6351
|
+
if (!ts27.isTupleTypeNode(type)) {
|
|
6259
6352
|
return [];
|
|
6260
6353
|
}
|
|
6261
6354
|
const res = [];
|
|
6262
6355
|
type.elements.forEach((el) => {
|
|
6263
|
-
if (!
|
|
6356
|
+
if (!ts27.isLiteralTypeNode(el) || !ts27.isStringLiteral(el.literal)) {
|
|
6264
6357
|
return;
|
|
6265
6358
|
}
|
|
6266
6359
|
res.push(el.literal.text);
|
|
@@ -6285,7 +6378,7 @@ function extractDirectiveTypeCheckMeta(node, inputs, reflector) {
|
|
|
6285
6378
|
if (isRestricted(field.node)) {
|
|
6286
6379
|
restrictedInputFields.add(classPropertyName);
|
|
6287
6380
|
}
|
|
6288
|
-
if (field.nameNode !== null &&
|
|
6381
|
+
if (field.nameNode !== null && ts27.isStringLiteral(field.nameNode)) {
|
|
6289
6382
|
stringLiteralInputFields.add(classPropertyName);
|
|
6290
6383
|
}
|
|
6291
6384
|
}
|
|
@@ -6304,7 +6397,7 @@ function isRestricted(node) {
|
|
|
6304
6397
|
if (node.modifiers === void 0) {
|
|
6305
6398
|
return false;
|
|
6306
6399
|
}
|
|
6307
|
-
return node.modifiers.some((modifier) => modifier.kind ===
|
|
6400
|
+
return node.modifiers.some((modifier) => modifier.kind === ts27.SyntaxKind.PrivateKeyword || modifier.kind === ts27.SyntaxKind.ProtectedKeyword || modifier.kind === ts27.SyntaxKind.ReadonlyKeyword);
|
|
6308
6401
|
}
|
|
6309
6402
|
function extractTemplateGuard(member) {
|
|
6310
6403
|
if (!member.name.startsWith("ngTemplateGuard_")) {
|
|
@@ -6313,7 +6406,7 @@ function extractTemplateGuard(member) {
|
|
|
6313
6406
|
const inputName = afterUnderscore(member.name);
|
|
6314
6407
|
if (member.kind === ClassMemberKind.Property) {
|
|
6315
6408
|
let type = null;
|
|
6316
|
-
if (member.type !== null &&
|
|
6409
|
+
if (member.type !== null && ts27.isLiteralTypeNode(member.type) && ts27.isStringLiteral(member.type.literal)) {
|
|
6317
6410
|
type = member.type.literal.text;
|
|
6318
6411
|
}
|
|
6319
6412
|
if (type !== "binding") {
|
|
@@ -6387,7 +6480,7 @@ var DtsMetadataReader = class {
|
|
|
6387
6480
|
const ngModuleDef = this.reflector.getMembersOfClass(clazz).find((member) => member.name === "\u0275mod" && member.isStatic);
|
|
6388
6481
|
if (ngModuleDef === void 0) {
|
|
6389
6482
|
return null;
|
|
6390
|
-
} else if (ngModuleDef.type === null || !
|
|
6483
|
+
} else if (ngModuleDef.type === null || !ts28.isTypeReferenceNode(ngModuleDef.type) || ngModuleDef.type.typeArguments === void 0 || ngModuleDef.type.typeArguments.length !== 4) {
|
|
6391
6484
|
return null;
|
|
6392
6485
|
}
|
|
6393
6486
|
const [_, declarationMetadata, importMetadata, exportMetadata] = ngModuleDef.type.typeArguments;
|
|
@@ -6405,7 +6498,7 @@ var DtsMetadataReader = class {
|
|
|
6405
6498
|
const def = this.reflector.getMembersOfClass(clazz).find((field) => field.isStatic && (field.name === "\u0275cmp" || field.name === "\u0275dir"));
|
|
6406
6499
|
if (def === void 0) {
|
|
6407
6500
|
return null;
|
|
6408
|
-
} else if (def.type === null || !
|
|
6501
|
+
} else if (def.type === null || !ts28.isTypeReferenceNode(def.type) || def.type.typeArguments === void 0 || def.type.typeArguments.length < 2) {
|
|
6409
6502
|
return null;
|
|
6410
6503
|
}
|
|
6411
6504
|
const isComponent = def.name === "\u0275cmp";
|
|
@@ -6435,11 +6528,11 @@ var DtsMetadataReader = class {
|
|
|
6435
6528
|
const def = this.reflector.getMembersOfClass(ref.node).find((field) => field.isStatic && field.name === "\u0275pipe");
|
|
6436
6529
|
if (def === void 0) {
|
|
6437
6530
|
return null;
|
|
6438
|
-
} else if (def.type === null || !
|
|
6531
|
+
} else if (def.type === null || !ts28.isTypeReferenceNode(def.type) || def.type.typeArguments === void 0 || def.type.typeArguments.length < 2) {
|
|
6439
6532
|
return null;
|
|
6440
6533
|
}
|
|
6441
6534
|
const type = def.type.typeArguments[1];
|
|
6442
|
-
if (!
|
|
6535
|
+
if (!ts28.isLiteralTypeNode(type) || !ts28.isStringLiteral(type.literal)) {
|
|
6443
6536
|
return null;
|
|
6444
6537
|
}
|
|
6445
6538
|
const name = type.literal.text;
|
|
@@ -6457,12 +6550,12 @@ function readBaseClass(clazz, checker, reflector) {
|
|
|
6457
6550
|
}
|
|
6458
6551
|
if (clazz.heritageClauses !== void 0) {
|
|
6459
6552
|
for (const clause of clazz.heritageClauses) {
|
|
6460
|
-
if (clause.token ===
|
|
6553
|
+
if (clause.token === ts28.SyntaxKind.ExtendsKeyword) {
|
|
6461
6554
|
const baseExpr = clause.types[0].expression;
|
|
6462
6555
|
let symbol = checker.getSymbolAtLocation(baseExpr);
|
|
6463
6556
|
if (symbol === void 0) {
|
|
6464
6557
|
return "dynamic";
|
|
6465
|
-
} else if (symbol.flags &
|
|
6558
|
+
} else if (symbol.flags & ts28.SymbolFlags.Alias) {
|
|
6466
6559
|
symbol = checker.getAliasedSymbol(symbol);
|
|
6467
6560
|
}
|
|
6468
6561
|
if (symbol.valueDeclaration !== void 0 && isNamedClassDeclaration(symbol.valueDeclaration)) {
|
|
@@ -6658,7 +6751,7 @@ var ResourceRegistry = class {
|
|
|
6658
6751
|
};
|
|
6659
6752
|
|
|
6660
6753
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/diagnostics.mjs
|
|
6661
|
-
import
|
|
6754
|
+
import ts29 from "typescript";
|
|
6662
6755
|
|
|
6663
6756
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/dynamic.mjs
|
|
6664
6757
|
var DynamicValue = class {
|
|
@@ -6879,21 +6972,21 @@ function getContainerNode(node) {
|
|
|
6879
6972
|
let currentNode = node;
|
|
6880
6973
|
while (currentNode !== void 0) {
|
|
6881
6974
|
switch (currentNode.kind) {
|
|
6882
|
-
case
|
|
6883
|
-
case
|
|
6884
|
-
case
|
|
6885
|
-
case
|
|
6886
|
-
case
|
|
6887
|
-
case
|
|
6888
|
-
case
|
|
6889
|
-
case
|
|
6890
|
-
case
|
|
6891
|
-
case
|
|
6892
|
-
case
|
|
6893
|
-
case
|
|
6894
|
-
case
|
|
6895
|
-
case
|
|
6896
|
-
case
|
|
6975
|
+
case ts29.SyntaxKind.ExpressionStatement:
|
|
6976
|
+
case ts29.SyntaxKind.VariableStatement:
|
|
6977
|
+
case ts29.SyntaxKind.ReturnStatement:
|
|
6978
|
+
case ts29.SyntaxKind.IfStatement:
|
|
6979
|
+
case ts29.SyntaxKind.SwitchStatement:
|
|
6980
|
+
case ts29.SyntaxKind.DoStatement:
|
|
6981
|
+
case ts29.SyntaxKind.WhileStatement:
|
|
6982
|
+
case ts29.SyntaxKind.ForStatement:
|
|
6983
|
+
case ts29.SyntaxKind.ForInStatement:
|
|
6984
|
+
case ts29.SyntaxKind.ForOfStatement:
|
|
6985
|
+
case ts29.SyntaxKind.ContinueStatement:
|
|
6986
|
+
case ts29.SyntaxKind.BreakStatement:
|
|
6987
|
+
case ts29.SyntaxKind.ThrowStatement:
|
|
6988
|
+
case ts29.SyntaxKind.ObjectBindingPattern:
|
|
6989
|
+
case ts29.SyntaxKind.ArrayBindingPattern:
|
|
6897
6990
|
return currentNode;
|
|
6898
6991
|
}
|
|
6899
6992
|
currentNode = currentNode.parent;
|
|
@@ -6902,7 +6995,7 @@ function getContainerNode(node) {
|
|
|
6902
6995
|
}
|
|
6903
6996
|
|
|
6904
6997
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/interpreter.mjs
|
|
6905
|
-
import
|
|
6998
|
+
import ts30 from "typescript";
|
|
6906
6999
|
|
|
6907
7000
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/builtin.mjs
|
|
6908
7001
|
var ArraySliceBuiltinFn = class extends KnownFn {
|
|
@@ -6937,6 +7030,24 @@ var ArrayConcatBuiltinFn = class extends KnownFn {
|
|
|
6937
7030
|
return result;
|
|
6938
7031
|
}
|
|
6939
7032
|
};
|
|
7033
|
+
var StringConcatBuiltinFn = class extends KnownFn {
|
|
7034
|
+
constructor(lhs) {
|
|
7035
|
+
super();
|
|
7036
|
+
this.lhs = lhs;
|
|
7037
|
+
}
|
|
7038
|
+
evaluate(node, args) {
|
|
7039
|
+
let result = this.lhs;
|
|
7040
|
+
for (const arg of args) {
|
|
7041
|
+
const resolved = arg instanceof EnumValue ? arg.resolved : arg;
|
|
7042
|
+
if (typeof resolved === "string" || typeof resolved === "number" || typeof resolved === "boolean" || resolved == null) {
|
|
7043
|
+
result = result.concat(resolved);
|
|
7044
|
+
} else {
|
|
7045
|
+
return DynamicValue.fromUnknown(node);
|
|
7046
|
+
}
|
|
7047
|
+
}
|
|
7048
|
+
return result;
|
|
7049
|
+
}
|
|
7050
|
+
};
|
|
6940
7051
|
var ObjectAssignBuiltinFn = class extends KnownFn {
|
|
6941
7052
|
evaluate(node, args) {
|
|
6942
7053
|
if (args.length === 0) {
|
|
@@ -7042,34 +7153,34 @@ function referenceBinaryOp(op) {
|
|
|
7042
7153
|
return { op, literal: false };
|
|
7043
7154
|
}
|
|
7044
7155
|
var BINARY_OPERATORS = new Map([
|
|
7045
|
-
[
|
|
7046
|
-
[
|
|
7047
|
-
[
|
|
7048
|
-
[
|
|
7049
|
-
[
|
|
7050
|
-
[
|
|
7051
|
-
[
|
|
7052
|
-
[
|
|
7053
|
-
[
|
|
7054
|
-
[
|
|
7055
|
-
[
|
|
7056
|
-
[
|
|
7057
|
-
[
|
|
7058
|
-
[
|
|
7059
|
-
[
|
|
7060
|
-
[
|
|
7061
|
-
[
|
|
7062
|
-
[
|
|
7063
|
-
[
|
|
7064
|
-
[
|
|
7065
|
-
[
|
|
7066
|
-
[
|
|
7156
|
+
[ts30.SyntaxKind.PlusToken, literalBinaryOp((a, b) => a + b)],
|
|
7157
|
+
[ts30.SyntaxKind.MinusToken, literalBinaryOp((a, b) => a - b)],
|
|
7158
|
+
[ts30.SyntaxKind.AsteriskToken, literalBinaryOp((a, b) => a * b)],
|
|
7159
|
+
[ts30.SyntaxKind.SlashToken, literalBinaryOp((a, b) => a / b)],
|
|
7160
|
+
[ts30.SyntaxKind.PercentToken, literalBinaryOp((a, b) => a % b)],
|
|
7161
|
+
[ts30.SyntaxKind.AmpersandToken, literalBinaryOp((a, b) => a & b)],
|
|
7162
|
+
[ts30.SyntaxKind.BarToken, literalBinaryOp((a, b) => a | b)],
|
|
7163
|
+
[ts30.SyntaxKind.CaretToken, literalBinaryOp((a, b) => a ^ b)],
|
|
7164
|
+
[ts30.SyntaxKind.LessThanToken, literalBinaryOp((a, b) => a < b)],
|
|
7165
|
+
[ts30.SyntaxKind.LessThanEqualsToken, literalBinaryOp((a, b) => a <= b)],
|
|
7166
|
+
[ts30.SyntaxKind.GreaterThanToken, literalBinaryOp((a, b) => a > b)],
|
|
7167
|
+
[ts30.SyntaxKind.GreaterThanEqualsToken, literalBinaryOp((a, b) => a >= b)],
|
|
7168
|
+
[ts30.SyntaxKind.EqualsEqualsToken, literalBinaryOp((a, b) => a == b)],
|
|
7169
|
+
[ts30.SyntaxKind.EqualsEqualsEqualsToken, literalBinaryOp((a, b) => a === b)],
|
|
7170
|
+
[ts30.SyntaxKind.ExclamationEqualsToken, literalBinaryOp((a, b) => a != b)],
|
|
7171
|
+
[ts30.SyntaxKind.ExclamationEqualsEqualsToken, literalBinaryOp((a, b) => a !== b)],
|
|
7172
|
+
[ts30.SyntaxKind.LessThanLessThanToken, literalBinaryOp((a, b) => a << b)],
|
|
7173
|
+
[ts30.SyntaxKind.GreaterThanGreaterThanToken, literalBinaryOp((a, b) => a >> b)],
|
|
7174
|
+
[ts30.SyntaxKind.GreaterThanGreaterThanGreaterThanToken, literalBinaryOp((a, b) => a >>> b)],
|
|
7175
|
+
[ts30.SyntaxKind.AsteriskAsteriskToken, literalBinaryOp((a, b) => Math.pow(a, b))],
|
|
7176
|
+
[ts30.SyntaxKind.AmpersandAmpersandToken, referenceBinaryOp((a, b) => a && b)],
|
|
7177
|
+
[ts30.SyntaxKind.BarBarToken, referenceBinaryOp((a, b) => a || b)]
|
|
7067
7178
|
]);
|
|
7068
7179
|
var UNARY_OPERATORS = new Map([
|
|
7069
|
-
[
|
|
7070
|
-
[
|
|
7071
|
-
[
|
|
7072
|
-
[
|
|
7180
|
+
[ts30.SyntaxKind.TildeToken, (a) => ~a],
|
|
7181
|
+
[ts30.SyntaxKind.MinusToken, (a) => -a],
|
|
7182
|
+
[ts30.SyntaxKind.PlusToken, (a) => +a],
|
|
7183
|
+
[ts30.SyntaxKind.ExclamationToken, (a) => !a]
|
|
7073
7184
|
]);
|
|
7074
7185
|
var StaticInterpreter = class {
|
|
7075
7186
|
constructor(host, checker, dependencyTracker) {
|
|
@@ -7082,43 +7193,43 @@ var StaticInterpreter = class {
|
|
|
7082
7193
|
}
|
|
7083
7194
|
visitExpression(node, context) {
|
|
7084
7195
|
let result;
|
|
7085
|
-
if (node.kind ===
|
|
7196
|
+
if (node.kind === ts30.SyntaxKind.TrueKeyword) {
|
|
7086
7197
|
return true;
|
|
7087
|
-
} else if (node.kind ===
|
|
7198
|
+
} else if (node.kind === ts30.SyntaxKind.FalseKeyword) {
|
|
7088
7199
|
return false;
|
|
7089
|
-
} else if (node.kind ===
|
|
7200
|
+
} else if (node.kind === ts30.SyntaxKind.NullKeyword) {
|
|
7090
7201
|
return null;
|
|
7091
|
-
} else if (
|
|
7202
|
+
} else if (ts30.isStringLiteral(node)) {
|
|
7092
7203
|
return node.text;
|
|
7093
|
-
} else if (
|
|
7204
|
+
} else if (ts30.isNoSubstitutionTemplateLiteral(node)) {
|
|
7094
7205
|
return node.text;
|
|
7095
|
-
} else if (
|
|
7206
|
+
} else if (ts30.isTemplateExpression(node)) {
|
|
7096
7207
|
result = this.visitTemplateExpression(node, context);
|
|
7097
|
-
} else if (
|
|
7208
|
+
} else if (ts30.isNumericLiteral(node)) {
|
|
7098
7209
|
return parseFloat(node.text);
|
|
7099
|
-
} else if (
|
|
7210
|
+
} else if (ts30.isObjectLiteralExpression(node)) {
|
|
7100
7211
|
result = this.visitObjectLiteralExpression(node, context);
|
|
7101
|
-
} else if (
|
|
7212
|
+
} else if (ts30.isIdentifier(node)) {
|
|
7102
7213
|
result = this.visitIdentifier(node, context);
|
|
7103
|
-
} else if (
|
|
7214
|
+
} else if (ts30.isPropertyAccessExpression(node)) {
|
|
7104
7215
|
result = this.visitPropertyAccessExpression(node, context);
|
|
7105
|
-
} else if (
|
|
7216
|
+
} else if (ts30.isCallExpression(node)) {
|
|
7106
7217
|
result = this.visitCallExpression(node, context);
|
|
7107
|
-
} else if (
|
|
7218
|
+
} else if (ts30.isConditionalExpression(node)) {
|
|
7108
7219
|
result = this.visitConditionalExpression(node, context);
|
|
7109
|
-
} else if (
|
|
7220
|
+
} else if (ts30.isPrefixUnaryExpression(node)) {
|
|
7110
7221
|
result = this.visitPrefixUnaryExpression(node, context);
|
|
7111
|
-
} else if (
|
|
7222
|
+
} else if (ts30.isBinaryExpression(node)) {
|
|
7112
7223
|
result = this.visitBinaryExpression(node, context);
|
|
7113
|
-
} else if (
|
|
7224
|
+
} else if (ts30.isArrayLiteralExpression(node)) {
|
|
7114
7225
|
result = this.visitArrayLiteralExpression(node, context);
|
|
7115
|
-
} else if (
|
|
7226
|
+
} else if (ts30.isParenthesizedExpression(node)) {
|
|
7116
7227
|
result = this.visitParenthesizedExpression(node, context);
|
|
7117
|
-
} else if (
|
|
7228
|
+
} else if (ts30.isElementAccessExpression(node)) {
|
|
7118
7229
|
result = this.visitElementAccessExpression(node, context);
|
|
7119
|
-
} else if (
|
|
7230
|
+
} else if (ts30.isAsExpression(node)) {
|
|
7120
7231
|
result = this.visitExpression(node.expression, context);
|
|
7121
|
-
} else if (
|
|
7232
|
+
} else if (ts30.isNonNullExpression(node)) {
|
|
7122
7233
|
result = this.visitExpression(node.expression, context);
|
|
7123
7234
|
} else if (this.host.isClass(node)) {
|
|
7124
7235
|
result = this.visitDeclaration(node, context);
|
|
@@ -7134,7 +7245,7 @@ var StaticInterpreter = class {
|
|
|
7134
7245
|
const array = [];
|
|
7135
7246
|
for (let i = 0; i < node.elements.length; i++) {
|
|
7136
7247
|
const element = node.elements[i];
|
|
7137
|
-
if (
|
|
7248
|
+
if (ts30.isSpreadElement(element)) {
|
|
7138
7249
|
array.push(...this.visitSpreadElement(element, context));
|
|
7139
7250
|
} else {
|
|
7140
7251
|
array.push(this.visitExpression(element, context));
|
|
@@ -7146,20 +7257,20 @@ var StaticInterpreter = class {
|
|
|
7146
7257
|
const map = new Map();
|
|
7147
7258
|
for (let i = 0; i < node.properties.length; i++) {
|
|
7148
7259
|
const property2 = node.properties[i];
|
|
7149
|
-
if (
|
|
7260
|
+
if (ts30.isPropertyAssignment(property2)) {
|
|
7150
7261
|
const name = this.stringNameFromPropertyName(property2.name, context);
|
|
7151
7262
|
if (name === void 0) {
|
|
7152
7263
|
return DynamicValue.fromDynamicInput(node, DynamicValue.fromDynamicString(property2.name));
|
|
7153
7264
|
}
|
|
7154
7265
|
map.set(name, this.visitExpression(property2.initializer, context));
|
|
7155
|
-
} else if (
|
|
7266
|
+
} else if (ts30.isShorthandPropertyAssignment(property2)) {
|
|
7156
7267
|
const symbol = this.checker.getShorthandAssignmentValueSymbol(property2);
|
|
7157
7268
|
if (symbol === void 0 || symbol.valueDeclaration === void 0) {
|
|
7158
7269
|
map.set(property2.name.text, DynamicValue.fromUnknown(property2));
|
|
7159
7270
|
} else {
|
|
7160
7271
|
map.set(property2.name.text, this.visitDeclaration(symbol.valueDeclaration, context));
|
|
7161
7272
|
}
|
|
7162
|
-
} else if (
|
|
7273
|
+
} else if (ts30.isSpreadAssignment(property2)) {
|
|
7163
7274
|
const spread = this.visitExpression(property2.expression, context);
|
|
7164
7275
|
if (spread instanceof DynamicValue) {
|
|
7165
7276
|
return DynamicValue.fromDynamicInput(node, spread);
|
|
@@ -7191,7 +7302,7 @@ var StaticInterpreter = class {
|
|
|
7191
7302
|
visitIdentifier(node, context) {
|
|
7192
7303
|
const decl = this.host.getDeclarationOfIdentifier(node);
|
|
7193
7304
|
if (decl === null) {
|
|
7194
|
-
if (node.originalKeywordKind ===
|
|
7305
|
+
if (node.originalKeywordKind === ts30.SyntaxKind.UndefinedKeyword) {
|
|
7195
7306
|
return void 0;
|
|
7196
7307
|
} else {
|
|
7197
7308
|
if (this.dependencyTracker !== null && this.host.getImportOfIdentifier(node) !== null) {
|
|
@@ -7222,17 +7333,17 @@ var StaticInterpreter = class {
|
|
|
7222
7333
|
}
|
|
7223
7334
|
if (this.host.isClass(node)) {
|
|
7224
7335
|
return this.getReference(node, context);
|
|
7225
|
-
} else if (
|
|
7336
|
+
} else if (ts30.isVariableDeclaration(node)) {
|
|
7226
7337
|
return this.visitVariableDeclaration(node, context);
|
|
7227
|
-
} else if (
|
|
7338
|
+
} else if (ts30.isParameter(node) && context.scope.has(node)) {
|
|
7228
7339
|
return context.scope.get(node);
|
|
7229
|
-
} else if (
|
|
7340
|
+
} else if (ts30.isExportAssignment(node)) {
|
|
7230
7341
|
return this.visitExpression(node.expression, context);
|
|
7231
|
-
} else if (
|
|
7342
|
+
} else if (ts30.isEnumDeclaration(node)) {
|
|
7232
7343
|
return this.visitEnumDeclaration(node, context);
|
|
7233
|
-
} else if (
|
|
7344
|
+
} else if (ts30.isSourceFile(node)) {
|
|
7234
7345
|
return this.visitSourceFile(node, context);
|
|
7235
|
-
} else if (
|
|
7346
|
+
} else if (ts30.isBindingElement(node)) {
|
|
7236
7347
|
return this.visitBindingElement(node, context);
|
|
7237
7348
|
} else {
|
|
7238
7349
|
return this.getReference(node, context);
|
|
@@ -7326,6 +7437,8 @@ var StaticInterpreter = class {
|
|
|
7326
7437
|
return DynamicValue.fromInvalidExpressionType(node, rhs);
|
|
7327
7438
|
}
|
|
7328
7439
|
return lhs[rhs];
|
|
7440
|
+
} else if (typeof lhs === "string" && rhs === "concat") {
|
|
7441
|
+
return new StringConcatBuiltinFn(lhs);
|
|
7329
7442
|
} else if (lhs instanceof Reference) {
|
|
7330
7443
|
const ref = lhs.node;
|
|
7331
7444
|
if (this.host.isClass(ref)) {
|
|
@@ -7406,7 +7519,7 @@ var StaticInterpreter = class {
|
|
|
7406
7519
|
visitFunctionBody(node, fn, context) {
|
|
7407
7520
|
if (fn.body === null) {
|
|
7408
7521
|
return DynamicValue.fromUnknown(node);
|
|
7409
|
-
} else if (fn.body.length !== 1 || !
|
|
7522
|
+
} else if (fn.body.length !== 1 || !ts30.isReturnStatement(fn.body[0])) {
|
|
7410
7523
|
return DynamicValue.fromComplexFunctionCall(node, fn);
|
|
7411
7524
|
}
|
|
7412
7525
|
const ret = fn.body[0];
|
|
@@ -7477,7 +7590,7 @@ var StaticInterpreter = class {
|
|
|
7477
7590
|
evaluateFunctionArguments(node, context) {
|
|
7478
7591
|
const args = [];
|
|
7479
7592
|
for (const arg of node.arguments) {
|
|
7480
|
-
if (
|
|
7593
|
+
if (ts30.isSpreadElement(arg)) {
|
|
7481
7594
|
args.push(...this.visitSpreadElement(arg, context));
|
|
7482
7595
|
} else {
|
|
7483
7596
|
args.push(this.visitExpression(arg, context));
|
|
@@ -7498,23 +7611,23 @@ var StaticInterpreter = class {
|
|
|
7498
7611
|
visitBindingElement(node, context) {
|
|
7499
7612
|
const path7 = [];
|
|
7500
7613
|
let closestDeclaration = node;
|
|
7501
|
-
while (
|
|
7502
|
-
if (
|
|
7614
|
+
while (ts30.isBindingElement(closestDeclaration) || ts30.isArrayBindingPattern(closestDeclaration) || ts30.isObjectBindingPattern(closestDeclaration)) {
|
|
7615
|
+
if (ts30.isBindingElement(closestDeclaration)) {
|
|
7503
7616
|
path7.unshift(closestDeclaration);
|
|
7504
7617
|
}
|
|
7505
7618
|
closestDeclaration = closestDeclaration.parent;
|
|
7506
7619
|
}
|
|
7507
|
-
if (!
|
|
7620
|
+
if (!ts30.isVariableDeclaration(closestDeclaration) || closestDeclaration.initializer === void 0) {
|
|
7508
7621
|
return DynamicValue.fromUnknown(node);
|
|
7509
7622
|
}
|
|
7510
7623
|
let value = this.visit(closestDeclaration.initializer, context);
|
|
7511
7624
|
for (const element of path7) {
|
|
7512
7625
|
let key;
|
|
7513
|
-
if (
|
|
7626
|
+
if (ts30.isArrayBindingPattern(element.parent)) {
|
|
7514
7627
|
key = element.parent.elements.indexOf(element);
|
|
7515
7628
|
} else {
|
|
7516
7629
|
const name = element.propertyName || element.name;
|
|
7517
|
-
if (
|
|
7630
|
+
if (ts30.isIdentifier(name)) {
|
|
7518
7631
|
key = name.text;
|
|
7519
7632
|
} else {
|
|
7520
7633
|
return DynamicValue.fromUnknown(element);
|
|
@@ -7528,9 +7641,9 @@ var StaticInterpreter = class {
|
|
|
7528
7641
|
return value;
|
|
7529
7642
|
}
|
|
7530
7643
|
stringNameFromPropertyName(node, context) {
|
|
7531
|
-
if (
|
|
7644
|
+
if (ts30.isIdentifier(node) || ts30.isStringLiteral(node) || ts30.isNumericLiteral(node)) {
|
|
7532
7645
|
return node.text;
|
|
7533
|
-
} else if (
|
|
7646
|
+
} else if (ts30.isComputedPropertyName(node)) {
|
|
7534
7647
|
const literal2 = this.visitExpression(node.expression, context);
|
|
7535
7648
|
return typeof literal2 === "string" ? literal2 : void 0;
|
|
7536
7649
|
} else {
|
|
@@ -7553,11 +7666,11 @@ var StaticInterpreter = class {
|
|
|
7553
7666
|
return new Reference(node, owningModule(context));
|
|
7554
7667
|
}
|
|
7555
7668
|
visitType(node, context) {
|
|
7556
|
-
if (
|
|
7669
|
+
if (ts30.isLiteralTypeNode(node)) {
|
|
7557
7670
|
return this.visitExpression(node.literal, context);
|
|
7558
|
-
} else if (
|
|
7671
|
+
} else if (ts30.isTupleTypeNode(node)) {
|
|
7559
7672
|
return this.visitTupleType(node, context);
|
|
7560
|
-
} else if (
|
|
7673
|
+
} else if (ts30.isNamedTupleMember(node)) {
|
|
7561
7674
|
return this.visitType(node.type, context);
|
|
7562
7675
|
}
|
|
7563
7676
|
return DynamicValue.fromDynamicType(node);
|
|
@@ -7571,7 +7684,7 @@ var StaticInterpreter = class {
|
|
|
7571
7684
|
}
|
|
7572
7685
|
};
|
|
7573
7686
|
function isFunctionOrMethodReference(ref) {
|
|
7574
|
-
return
|
|
7687
|
+
return ts30.isFunctionDeclaration(ref.node) || ts30.isMethodDeclaration(ref.node) || ts30.isFunctionExpression(ref.node);
|
|
7575
7688
|
}
|
|
7576
7689
|
function literal(value, reject) {
|
|
7577
7690
|
if (value instanceof EnumValue) {
|
|
@@ -7583,15 +7696,15 @@ function literal(value, reject) {
|
|
|
7583
7696
|
return reject(value);
|
|
7584
7697
|
}
|
|
7585
7698
|
function isVariableDeclarationDeclared(node) {
|
|
7586
|
-
if (node.parent === void 0 || !
|
|
7699
|
+
if (node.parent === void 0 || !ts30.isVariableDeclarationList(node.parent)) {
|
|
7587
7700
|
return false;
|
|
7588
7701
|
}
|
|
7589
7702
|
const declList = node.parent;
|
|
7590
|
-
if (declList.parent === void 0 || !
|
|
7703
|
+
if (declList.parent === void 0 || !ts30.isVariableStatement(declList.parent)) {
|
|
7591
7704
|
return false;
|
|
7592
7705
|
}
|
|
7593
7706
|
const varStmt = declList.parent;
|
|
7594
|
-
return varStmt.modifiers !== void 0 && varStmt.modifiers.some((mod) => mod.kind ===
|
|
7707
|
+
return varStmt.modifiers !== void 0 && varStmt.modifiers.some((mod) => mod.kind === ts30.SyntaxKind.DeclareKeyword);
|
|
7595
7708
|
}
|
|
7596
7709
|
var EMPTY = {};
|
|
7597
7710
|
function joinModuleContext(existing, node, decl) {
|
|
@@ -7740,10 +7853,10 @@ var HandlerFlags;
|
|
|
7740
7853
|
})(HandlerFlags || (HandlerFlags = {}));
|
|
7741
7854
|
|
|
7742
7855
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/alias.mjs
|
|
7743
|
-
import
|
|
7856
|
+
import ts31 from "typescript";
|
|
7744
7857
|
|
|
7745
7858
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/compilation.mjs
|
|
7746
|
-
import
|
|
7859
|
+
import ts32 from "typescript";
|
|
7747
7860
|
|
|
7748
7861
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/trait.mjs
|
|
7749
7862
|
var TraitState;
|
|
@@ -7848,7 +7961,7 @@ var TraitCompiler = class {
|
|
|
7848
7961
|
if (this.reflector.isClass(node)) {
|
|
7849
7962
|
this.analyzeClass(node, preanalyze ? promises : null);
|
|
7850
7963
|
}
|
|
7851
|
-
|
|
7964
|
+
ts32.forEachChild(node, visit2);
|
|
7852
7965
|
};
|
|
7853
7966
|
visit2(sf);
|
|
7854
7967
|
if (preanalyze && promises.length > 0) {
|
|
@@ -7959,7 +8072,7 @@ var TraitCompiler = class {
|
|
|
7959
8072
|
}
|
|
7960
8073
|
if (isPrimaryHandler && record.hasPrimaryHandler) {
|
|
7961
8074
|
record.metaDiagnostics = [{
|
|
7962
|
-
category:
|
|
8075
|
+
category: ts32.DiagnosticCategory.Error,
|
|
7963
8076
|
code: Number("-99" + ErrorCode.DECORATOR_COLLISION),
|
|
7964
8077
|
file: getSourceFile(clazz),
|
|
7965
8078
|
start: clazz.getStart(void 0, false),
|
|
@@ -8167,7 +8280,7 @@ var TraitCompiler = class {
|
|
|
8167
8280
|
}
|
|
8168
8281
|
}
|
|
8169
8282
|
compile(clazz, constantPool) {
|
|
8170
|
-
const original =
|
|
8283
|
+
const original = ts32.getOriginalNode(clazz);
|
|
8171
8284
|
if (!this.reflector.isClass(clazz) || !this.reflector.isClass(original) || !this.classes.has(original)) {
|
|
8172
8285
|
return null;
|
|
8173
8286
|
}
|
|
@@ -8198,7 +8311,7 @@ var TraitCompiler = class {
|
|
|
8198
8311
|
return res.length > 0 ? res : null;
|
|
8199
8312
|
}
|
|
8200
8313
|
decoratorsFor(node) {
|
|
8201
|
-
const original =
|
|
8314
|
+
const original = ts32.getOriginalNode(node);
|
|
8202
8315
|
if (!this.reflector.isClass(original) || !this.classes.has(original)) {
|
|
8203
8316
|
return [];
|
|
8204
8317
|
}
|
|
@@ -8208,7 +8321,7 @@ var TraitCompiler = class {
|
|
|
8208
8321
|
if (trait.state !== TraitState.Resolved) {
|
|
8209
8322
|
continue;
|
|
8210
8323
|
}
|
|
8211
|
-
if (trait.detected.trigger !== null &&
|
|
8324
|
+
if (trait.detected.trigger !== null && ts32.isDecorator(trait.detected.trigger)) {
|
|
8212
8325
|
decorators.push(trait.detected.trigger);
|
|
8213
8326
|
}
|
|
8214
8327
|
}
|
|
@@ -8238,7 +8351,7 @@ var TraitCompiler = class {
|
|
|
8238
8351
|
};
|
|
8239
8352
|
|
|
8240
8353
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/declaration.mjs
|
|
8241
|
-
import
|
|
8354
|
+
import ts37 from "typescript";
|
|
8242
8355
|
|
|
8243
8356
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/context.mjs
|
|
8244
8357
|
var Context = class {
|
|
@@ -8254,7 +8367,7 @@ var Context = class {
|
|
|
8254
8367
|
};
|
|
8255
8368
|
|
|
8256
8369
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/import_manager.mjs
|
|
8257
|
-
import
|
|
8370
|
+
import ts33 from "typescript";
|
|
8258
8371
|
var ImportManager = class {
|
|
8259
8372
|
constructor(rewriter = new NoopImportRewriter(), prefix = "i") {
|
|
8260
8373
|
this.rewriter = rewriter;
|
|
@@ -8264,7 +8377,7 @@ var ImportManager = class {
|
|
|
8264
8377
|
}
|
|
8265
8378
|
generateNamespaceImport(moduleName) {
|
|
8266
8379
|
if (!this.specifierToIdentifier.has(moduleName)) {
|
|
8267
|
-
this.specifierToIdentifier.set(moduleName,
|
|
8380
|
+
this.specifierToIdentifier.set(moduleName, ts33.createIdentifier(`${this.prefix}${this.nextIndex++}`));
|
|
8268
8381
|
}
|
|
8269
8382
|
return this.specifierToIdentifier.get(moduleName);
|
|
8270
8383
|
}
|
|
@@ -8537,7 +8650,7 @@ function createRange(span) {
|
|
|
8537
8650
|
import {
|
|
8538
8651
|
BuiltinTypeName
|
|
8539
8652
|
} from "@angular/compiler";
|
|
8540
|
-
import
|
|
8653
|
+
import ts34 from "typescript";
|
|
8541
8654
|
function translateType(type, imports) {
|
|
8542
8655
|
return type.visitType(new TypeTranslatorVisitor(imports), new Context(false));
|
|
8543
8656
|
}
|
|
@@ -8548,16 +8661,16 @@ var TypeTranslatorVisitor = class {
|
|
|
8548
8661
|
visitBuiltinType(type, context) {
|
|
8549
8662
|
switch (type.name) {
|
|
8550
8663
|
case BuiltinTypeName.Bool:
|
|
8551
|
-
return
|
|
8664
|
+
return ts34.createKeywordTypeNode(ts34.SyntaxKind.BooleanKeyword);
|
|
8552
8665
|
case BuiltinTypeName.Dynamic:
|
|
8553
|
-
return
|
|
8666
|
+
return ts34.createKeywordTypeNode(ts34.SyntaxKind.AnyKeyword);
|
|
8554
8667
|
case BuiltinTypeName.Int:
|
|
8555
8668
|
case BuiltinTypeName.Number:
|
|
8556
|
-
return
|
|
8669
|
+
return ts34.createKeywordTypeNode(ts34.SyntaxKind.NumberKeyword);
|
|
8557
8670
|
case BuiltinTypeName.String:
|
|
8558
|
-
return
|
|
8671
|
+
return ts34.createKeywordTypeNode(ts34.SyntaxKind.StringKeyword);
|
|
8559
8672
|
case BuiltinTypeName.None:
|
|
8560
|
-
return
|
|
8673
|
+
return ts34.createKeywordTypeNode(ts34.SyntaxKind.NeverKeyword);
|
|
8561
8674
|
default:
|
|
8562
8675
|
throw new Error(`Unsupported builtin type: ${BuiltinTypeName[type.name]}`);
|
|
8563
8676
|
}
|
|
@@ -8567,28 +8680,28 @@ var TypeTranslatorVisitor = class {
|
|
|
8567
8680
|
if (type.typeParams === null) {
|
|
8568
8681
|
return typeNode;
|
|
8569
8682
|
}
|
|
8570
|
-
if (!
|
|
8683
|
+
if (!ts34.isTypeReferenceNode(typeNode)) {
|
|
8571
8684
|
throw new Error("An ExpressionType with type arguments must translate into a TypeReferenceNode");
|
|
8572
8685
|
} else if (typeNode.typeArguments !== void 0) {
|
|
8573
8686
|
throw new Error(`An ExpressionType with type arguments cannot have multiple levels of type arguments`);
|
|
8574
8687
|
}
|
|
8575
8688
|
const typeArgs = type.typeParams.map((param) => this.translateType(param, context));
|
|
8576
|
-
return
|
|
8689
|
+
return ts34.createTypeReferenceNode(typeNode.typeName, typeArgs);
|
|
8577
8690
|
}
|
|
8578
8691
|
visitArrayType(type, context) {
|
|
8579
|
-
return
|
|
8692
|
+
return ts34.createArrayTypeNode(this.translateType(type.of, context));
|
|
8580
8693
|
}
|
|
8581
8694
|
visitMapType(type, context) {
|
|
8582
|
-
const parameter =
|
|
8583
|
-
const typeArgs = type.valueType !== null ? this.translateType(type.valueType, context) :
|
|
8584
|
-
const indexSignature =
|
|
8585
|
-
return
|
|
8695
|
+
const parameter = ts34.createParameter(void 0, void 0, void 0, "key", void 0, ts34.createKeywordTypeNode(ts34.SyntaxKind.StringKeyword));
|
|
8696
|
+
const typeArgs = type.valueType !== null ? this.translateType(type.valueType, context) : ts34.createKeywordTypeNode(ts34.SyntaxKind.UnknownKeyword);
|
|
8697
|
+
const indexSignature = ts34.createIndexSignature(void 0, void 0, [parameter], typeArgs);
|
|
8698
|
+
return ts34.createTypeLiteralNode([indexSignature]);
|
|
8586
8699
|
}
|
|
8587
8700
|
visitReadVarExpr(ast, context) {
|
|
8588
8701
|
if (ast.name === null) {
|
|
8589
8702
|
throw new Error(`ReadVarExpr with no variable name in type`);
|
|
8590
8703
|
}
|
|
8591
|
-
return
|
|
8704
|
+
return ts34.createTypeQueryNode(ts34.createIdentifier(ast.name));
|
|
8592
8705
|
}
|
|
8593
8706
|
visitWriteVarExpr(expr, context) {
|
|
8594
8707
|
throw new Error("Method not implemented.");
|
|
@@ -8610,15 +8723,15 @@ var TypeTranslatorVisitor = class {
|
|
|
8610
8723
|
}
|
|
8611
8724
|
visitLiteralExpr(ast, context) {
|
|
8612
8725
|
if (ast.value === null) {
|
|
8613
|
-
return
|
|
8726
|
+
return ts34.createLiteralTypeNode(ts34.createNull());
|
|
8614
8727
|
} else if (ast.value === void 0) {
|
|
8615
|
-
return
|
|
8728
|
+
return ts34.createKeywordTypeNode(ts34.SyntaxKind.UndefinedKeyword);
|
|
8616
8729
|
} else if (typeof ast.value === "boolean") {
|
|
8617
|
-
return
|
|
8730
|
+
return ts34.createLiteralTypeNode(ts34.createLiteral(ast.value));
|
|
8618
8731
|
} else if (typeof ast.value === "number") {
|
|
8619
|
-
return
|
|
8732
|
+
return ts34.createLiteralTypeNode(ts34.createLiteral(ast.value));
|
|
8620
8733
|
} else {
|
|
8621
|
-
return
|
|
8734
|
+
return ts34.createLiteralTypeNode(ts34.createLiteral(ast.value));
|
|
8622
8735
|
}
|
|
8623
8736
|
}
|
|
8624
8737
|
visitLocalizedString(ast, context) {
|
|
@@ -8629,10 +8742,10 @@ var TypeTranslatorVisitor = class {
|
|
|
8629
8742
|
throw new Error(`Import unknown module or symbol`);
|
|
8630
8743
|
}
|
|
8631
8744
|
const { moduleImport, symbol } = this.imports.generateNamedImport(ast.value.moduleName, ast.value.name);
|
|
8632
|
-
const symbolIdentifier =
|
|
8633
|
-
const typeName = moduleImport ?
|
|
8745
|
+
const symbolIdentifier = ts34.createIdentifier(symbol);
|
|
8746
|
+
const typeName = moduleImport ? ts34.createQualifiedName(moduleImport, symbolIdentifier) : symbolIdentifier;
|
|
8634
8747
|
const typeArguments = ast.typeParams !== null ? ast.typeParams.map((type) => this.translateType(type, context)) : void 0;
|
|
8635
|
-
return
|
|
8748
|
+
return ts34.createTypeReferenceNode(typeName, typeArguments);
|
|
8636
8749
|
}
|
|
8637
8750
|
visitConditionalExpr(ast, context) {
|
|
8638
8751
|
throw new Error("Method not implemented.");
|
|
@@ -8663,161 +8776,161 @@ var TypeTranslatorVisitor = class {
|
|
|
8663
8776
|
}
|
|
8664
8777
|
visitLiteralArrayExpr(ast, context) {
|
|
8665
8778
|
const values = ast.entries.map((expr) => this.translateExpression(expr, context));
|
|
8666
|
-
return
|
|
8779
|
+
return ts34.createTupleTypeNode(values);
|
|
8667
8780
|
}
|
|
8668
8781
|
visitLiteralMapExpr(ast, context) {
|
|
8669
8782
|
const entries = ast.entries.map((entry) => {
|
|
8670
8783
|
const { key, quoted } = entry;
|
|
8671
8784
|
const type = this.translateExpression(entry.value, context);
|
|
8672
|
-
return
|
|
8785
|
+
return ts34.createPropertySignature(void 0, quoted ? ts34.createStringLiteral(key) : key, void 0, type, void 0);
|
|
8673
8786
|
});
|
|
8674
|
-
return
|
|
8787
|
+
return ts34.createTypeLiteralNode(entries);
|
|
8675
8788
|
}
|
|
8676
8789
|
visitCommaExpr(ast, context) {
|
|
8677
8790
|
throw new Error("Method not implemented.");
|
|
8678
8791
|
}
|
|
8679
8792
|
visitWrappedNodeExpr(ast, context) {
|
|
8680
8793
|
const node = ast.node;
|
|
8681
|
-
if (
|
|
8682
|
-
return
|
|
8683
|
-
} else if (
|
|
8794
|
+
if (ts34.isEntityName(node)) {
|
|
8795
|
+
return ts34.createTypeReferenceNode(node, void 0);
|
|
8796
|
+
} else if (ts34.isTypeNode(node)) {
|
|
8684
8797
|
return node;
|
|
8685
|
-
} else if (
|
|
8686
|
-
return
|
|
8798
|
+
} else if (ts34.isLiteralExpression(node)) {
|
|
8799
|
+
return ts34.createLiteralTypeNode(node);
|
|
8687
8800
|
} else {
|
|
8688
|
-
throw new Error(`Unsupported WrappedNodeExpr in TypeTranslatorVisitor: ${
|
|
8801
|
+
throw new Error(`Unsupported WrappedNodeExpr in TypeTranslatorVisitor: ${ts34.SyntaxKind[node.kind]}`);
|
|
8689
8802
|
}
|
|
8690
8803
|
}
|
|
8691
8804
|
visitTypeofExpr(ast, context) {
|
|
8692
8805
|
const typeNode = this.translateExpression(ast.expr, context);
|
|
8693
|
-
if (!
|
|
8806
|
+
if (!ts34.isTypeReferenceNode(typeNode)) {
|
|
8694
8807
|
throw new Error(`The target of a typeof expression must be a type reference, but it was
|
|
8695
|
-
${
|
|
8808
|
+
${ts34.SyntaxKind[typeNode.kind]}`);
|
|
8696
8809
|
}
|
|
8697
|
-
return
|
|
8810
|
+
return ts34.createTypeQueryNode(typeNode.typeName);
|
|
8698
8811
|
}
|
|
8699
8812
|
translateType(type, context) {
|
|
8700
8813
|
const typeNode = type.visitType(this, context);
|
|
8701
|
-
if (!
|
|
8702
|
-
throw new Error(`A Type must translate to a TypeNode, but was ${
|
|
8814
|
+
if (!ts34.isTypeNode(typeNode)) {
|
|
8815
|
+
throw new Error(`A Type must translate to a TypeNode, but was ${ts34.SyntaxKind[typeNode.kind]}`);
|
|
8703
8816
|
}
|
|
8704
8817
|
return typeNode;
|
|
8705
8818
|
}
|
|
8706
8819
|
translateExpression(expr, context) {
|
|
8707
8820
|
const typeNode = expr.visitExpression(this, context);
|
|
8708
|
-
if (!
|
|
8709
|
-
throw new Error(`An Expression must translate to a TypeNode, but was ${
|
|
8821
|
+
if (!ts34.isTypeNode(typeNode)) {
|
|
8822
|
+
throw new Error(`An Expression must translate to a TypeNode, but was ${ts34.SyntaxKind[typeNode.kind]}`);
|
|
8710
8823
|
}
|
|
8711
8824
|
return typeNode;
|
|
8712
8825
|
}
|
|
8713
8826
|
};
|
|
8714
8827
|
|
|
8715
8828
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/typescript_ast_factory.mjs
|
|
8716
|
-
import
|
|
8829
|
+
import ts35 from "typescript";
|
|
8717
8830
|
var PureAnnotation;
|
|
8718
8831
|
(function(PureAnnotation2) {
|
|
8719
8832
|
PureAnnotation2["CLOSURE"] = "* @pureOrBreakMyCode ";
|
|
8720
8833
|
PureAnnotation2["TERSER"] = "@__PURE__";
|
|
8721
8834
|
})(PureAnnotation || (PureAnnotation = {}));
|
|
8722
8835
|
var UNARY_OPERATORS3 = {
|
|
8723
|
-
"+":
|
|
8724
|
-
"-":
|
|
8725
|
-
"!":
|
|
8836
|
+
"+": ts35.SyntaxKind.PlusToken,
|
|
8837
|
+
"-": ts35.SyntaxKind.MinusToken,
|
|
8838
|
+
"!": ts35.SyntaxKind.ExclamationToken
|
|
8726
8839
|
};
|
|
8727
8840
|
var BINARY_OPERATORS3 = {
|
|
8728
|
-
"&&":
|
|
8729
|
-
">":
|
|
8730
|
-
">=":
|
|
8731
|
-
"&":
|
|
8732
|
-
"/":
|
|
8733
|
-
"==":
|
|
8734
|
-
"===":
|
|
8735
|
-
"<":
|
|
8736
|
-
"<=":
|
|
8737
|
-
"-":
|
|
8738
|
-
"%":
|
|
8739
|
-
"*":
|
|
8740
|
-
"!=":
|
|
8741
|
-
"!==":
|
|
8742
|
-
"||":
|
|
8743
|
-
"+":
|
|
8744
|
-
"??":
|
|
8841
|
+
"&&": ts35.SyntaxKind.AmpersandAmpersandToken,
|
|
8842
|
+
">": ts35.SyntaxKind.GreaterThanToken,
|
|
8843
|
+
">=": ts35.SyntaxKind.GreaterThanEqualsToken,
|
|
8844
|
+
"&": ts35.SyntaxKind.AmpersandToken,
|
|
8845
|
+
"/": ts35.SyntaxKind.SlashToken,
|
|
8846
|
+
"==": ts35.SyntaxKind.EqualsEqualsToken,
|
|
8847
|
+
"===": ts35.SyntaxKind.EqualsEqualsEqualsToken,
|
|
8848
|
+
"<": ts35.SyntaxKind.LessThanToken,
|
|
8849
|
+
"<=": ts35.SyntaxKind.LessThanEqualsToken,
|
|
8850
|
+
"-": ts35.SyntaxKind.MinusToken,
|
|
8851
|
+
"%": ts35.SyntaxKind.PercentToken,
|
|
8852
|
+
"*": ts35.SyntaxKind.AsteriskToken,
|
|
8853
|
+
"!=": ts35.SyntaxKind.ExclamationEqualsToken,
|
|
8854
|
+
"!==": ts35.SyntaxKind.ExclamationEqualsEqualsToken,
|
|
8855
|
+
"||": ts35.SyntaxKind.BarBarToken,
|
|
8856
|
+
"+": ts35.SyntaxKind.PlusToken,
|
|
8857
|
+
"??": ts35.SyntaxKind.QuestionQuestionToken
|
|
8745
8858
|
};
|
|
8746
8859
|
var VAR_TYPES = {
|
|
8747
|
-
"const":
|
|
8748
|
-
"let":
|
|
8749
|
-
"var":
|
|
8860
|
+
"const": ts35.NodeFlags.Const,
|
|
8861
|
+
"let": ts35.NodeFlags.Let,
|
|
8862
|
+
"var": ts35.NodeFlags.None
|
|
8750
8863
|
};
|
|
8751
8864
|
var TypeScriptAstFactory = class {
|
|
8752
8865
|
constructor(annotateForClosureCompiler) {
|
|
8753
8866
|
this.annotateForClosureCompiler = annotateForClosureCompiler;
|
|
8754
8867
|
this.externalSourceFiles = new Map();
|
|
8755
8868
|
this.attachComments = attachComments;
|
|
8756
|
-
this.createArrayLiteral =
|
|
8757
|
-
this.createConditional =
|
|
8758
|
-
this.createElementAccess =
|
|
8759
|
-
this.createExpressionStatement =
|
|
8760
|
-
this.createIdentifier =
|
|
8761
|
-
this.createParenthesizedExpression =
|
|
8762
|
-
this.createPropertyAccess =
|
|
8763
|
-
this.createThrowStatement =
|
|
8764
|
-
this.createTypeOfExpression =
|
|
8869
|
+
this.createArrayLiteral = ts35.createArrayLiteral;
|
|
8870
|
+
this.createConditional = ts35.createConditional;
|
|
8871
|
+
this.createElementAccess = ts35.createElementAccess;
|
|
8872
|
+
this.createExpressionStatement = ts35.createExpressionStatement;
|
|
8873
|
+
this.createIdentifier = ts35.createIdentifier;
|
|
8874
|
+
this.createParenthesizedExpression = ts35.createParen;
|
|
8875
|
+
this.createPropertyAccess = ts35.createPropertyAccess;
|
|
8876
|
+
this.createThrowStatement = ts35.createThrow;
|
|
8877
|
+
this.createTypeOfExpression = ts35.createTypeOf;
|
|
8765
8878
|
}
|
|
8766
8879
|
createAssignment(target, value) {
|
|
8767
|
-
return
|
|
8880
|
+
return ts35.createBinary(target, ts35.SyntaxKind.EqualsToken, value);
|
|
8768
8881
|
}
|
|
8769
8882
|
createBinaryExpression(leftOperand, operator, rightOperand) {
|
|
8770
|
-
return
|
|
8883
|
+
return ts35.createBinary(leftOperand, BINARY_OPERATORS3[operator], rightOperand);
|
|
8771
8884
|
}
|
|
8772
8885
|
createBlock(body) {
|
|
8773
|
-
return
|
|
8886
|
+
return ts35.createBlock(body);
|
|
8774
8887
|
}
|
|
8775
8888
|
createCallExpression(callee, args, pure) {
|
|
8776
|
-
const call =
|
|
8889
|
+
const call = ts35.createCall(callee, void 0, args);
|
|
8777
8890
|
if (pure) {
|
|
8778
|
-
|
|
8891
|
+
ts35.addSyntheticLeadingComment(call, ts35.SyntaxKind.MultiLineCommentTrivia, this.annotateForClosureCompiler ? PureAnnotation.CLOSURE : PureAnnotation.TERSER, false);
|
|
8779
8892
|
}
|
|
8780
8893
|
return call;
|
|
8781
8894
|
}
|
|
8782
8895
|
createFunctionDeclaration(functionName, parameters, body) {
|
|
8783
|
-
if (!
|
|
8784
|
-
throw new Error(`Invalid syntax, expected a block, but got ${
|
|
8896
|
+
if (!ts35.isBlock(body)) {
|
|
8897
|
+
throw new Error(`Invalid syntax, expected a block, but got ${ts35.SyntaxKind[body.kind]}.`);
|
|
8785
8898
|
}
|
|
8786
|
-
return
|
|
8899
|
+
return ts35.createFunctionDeclaration(void 0, void 0, void 0, functionName, void 0, parameters.map((param) => ts35.createParameter(void 0, void 0, void 0, param)), void 0, body);
|
|
8787
8900
|
}
|
|
8788
8901
|
createFunctionExpression(functionName, parameters, body) {
|
|
8789
|
-
if (!
|
|
8790
|
-
throw new Error(`Invalid syntax, expected a block, but got ${
|
|
8902
|
+
if (!ts35.isBlock(body)) {
|
|
8903
|
+
throw new Error(`Invalid syntax, expected a block, but got ${ts35.SyntaxKind[body.kind]}.`);
|
|
8791
8904
|
}
|
|
8792
|
-
return
|
|
8905
|
+
return ts35.createFunctionExpression(void 0, void 0, functionName != null ? functionName : void 0, void 0, parameters.map((param) => ts35.createParameter(void 0, void 0, void 0, param)), void 0, body);
|
|
8793
8906
|
}
|
|
8794
8907
|
createIfStatement(condition, thenStatement, elseStatement) {
|
|
8795
|
-
return
|
|
8908
|
+
return ts35.createIf(condition, thenStatement, elseStatement != null ? elseStatement : void 0);
|
|
8796
8909
|
}
|
|
8797
8910
|
createLiteral(value) {
|
|
8798
8911
|
if (value === void 0) {
|
|
8799
|
-
return
|
|
8912
|
+
return ts35.createIdentifier("undefined");
|
|
8800
8913
|
} else if (value === null) {
|
|
8801
|
-
return
|
|
8914
|
+
return ts35.createNull();
|
|
8802
8915
|
} else {
|
|
8803
|
-
return
|
|
8916
|
+
return ts35.createLiteral(value);
|
|
8804
8917
|
}
|
|
8805
8918
|
}
|
|
8806
8919
|
createNewExpression(expression, args) {
|
|
8807
|
-
return
|
|
8920
|
+
return ts35.createNew(expression, void 0, args);
|
|
8808
8921
|
}
|
|
8809
8922
|
createObjectLiteral(properties) {
|
|
8810
|
-
return
|
|
8923
|
+
return ts35.createObjectLiteral(properties.map((prop) => ts35.createPropertyAssignment(prop.quoted ? ts35.createLiteral(prop.propertyName) : ts35.createIdentifier(prop.propertyName), prop.value)));
|
|
8811
8924
|
}
|
|
8812
8925
|
createReturnStatement(expression) {
|
|
8813
|
-
return
|
|
8926
|
+
return ts35.createReturn(expression != null ? expression : void 0);
|
|
8814
8927
|
}
|
|
8815
8928
|
createTaggedTemplate(tag, template) {
|
|
8816
8929
|
let templateLiteral;
|
|
8817
8930
|
const length = template.elements.length;
|
|
8818
8931
|
const head = template.elements[0];
|
|
8819
8932
|
if (length === 1) {
|
|
8820
|
-
templateLiteral =
|
|
8933
|
+
templateLiteral = ts35.createNoSubstitutionTemplateLiteral(head.cooked, head.raw);
|
|
8821
8934
|
} else {
|
|
8822
8935
|
const spans = [];
|
|
8823
8936
|
for (let i = 1; i < length - 1; i++) {
|
|
@@ -8826,7 +8939,7 @@ var TypeScriptAstFactory = class {
|
|
|
8826
8939
|
if (range !== null) {
|
|
8827
8940
|
this.setSourceMapRange(middle, range);
|
|
8828
8941
|
}
|
|
8829
|
-
spans.push(
|
|
8942
|
+
spans.push(ts35.createTemplateSpan(template.expressions[i - 1], middle));
|
|
8830
8943
|
}
|
|
8831
8944
|
const resolvedExpression = template.expressions[length - 2];
|
|
8832
8945
|
const templatePart = template.elements[length - 1];
|
|
@@ -8834,19 +8947,19 @@ var TypeScriptAstFactory = class {
|
|
|
8834
8947
|
if (templatePart.range !== null) {
|
|
8835
8948
|
this.setSourceMapRange(templateTail, templatePart.range);
|
|
8836
8949
|
}
|
|
8837
|
-
spans.push(
|
|
8838
|
-
templateLiteral =
|
|
8950
|
+
spans.push(ts35.createTemplateSpan(resolvedExpression, templateTail));
|
|
8951
|
+
templateLiteral = ts35.createTemplateExpression(ts35.createTemplateHead(head.cooked, head.raw), spans);
|
|
8839
8952
|
}
|
|
8840
8953
|
if (head.range !== null) {
|
|
8841
8954
|
this.setSourceMapRange(templateLiteral, head.range);
|
|
8842
8955
|
}
|
|
8843
|
-
return
|
|
8956
|
+
return ts35.createTaggedTemplate(tag, templateLiteral);
|
|
8844
8957
|
}
|
|
8845
8958
|
createUnaryExpression(operator, operand) {
|
|
8846
|
-
return
|
|
8959
|
+
return ts35.createPrefix(UNARY_OPERATORS3[operator], operand);
|
|
8847
8960
|
}
|
|
8848
8961
|
createVariableDeclaration(variableName, initializer, type) {
|
|
8849
|
-
return
|
|
8962
|
+
return ts35.createVariableStatement(void 0, ts35.createVariableDeclarationList([ts35.createVariableDeclaration(variableName, void 0, initializer != null ? initializer : void 0)], VAR_TYPES[type]));
|
|
8850
8963
|
}
|
|
8851
8964
|
setSourceMapRange(node, sourceMapRange) {
|
|
8852
8965
|
if (sourceMapRange === null) {
|
|
@@ -8854,31 +8967,31 @@ var TypeScriptAstFactory = class {
|
|
|
8854
8967
|
}
|
|
8855
8968
|
const url = sourceMapRange.url;
|
|
8856
8969
|
if (!this.externalSourceFiles.has(url)) {
|
|
8857
|
-
this.externalSourceFiles.set(url,
|
|
8970
|
+
this.externalSourceFiles.set(url, ts35.createSourceMapSource(url, sourceMapRange.content, (pos) => pos));
|
|
8858
8971
|
}
|
|
8859
8972
|
const source = this.externalSourceFiles.get(url);
|
|
8860
|
-
|
|
8973
|
+
ts35.setSourceMapRange(node, { pos: sourceMapRange.start.offset, end: sourceMapRange.end.offset, source });
|
|
8861
8974
|
return node;
|
|
8862
8975
|
}
|
|
8863
8976
|
};
|
|
8864
8977
|
function createTemplateMiddle(cooked, raw) {
|
|
8865
|
-
const node =
|
|
8866
|
-
node.kind =
|
|
8978
|
+
const node = ts35.createTemplateHead(cooked, raw);
|
|
8979
|
+
node.kind = ts35.SyntaxKind.TemplateMiddle;
|
|
8867
8980
|
return node;
|
|
8868
8981
|
}
|
|
8869
8982
|
function createTemplateTail(cooked, raw) {
|
|
8870
|
-
const node =
|
|
8871
|
-
node.kind =
|
|
8983
|
+
const node = ts35.createTemplateHead(cooked, raw);
|
|
8984
|
+
node.kind = ts35.SyntaxKind.TemplateTail;
|
|
8872
8985
|
return node;
|
|
8873
8986
|
}
|
|
8874
8987
|
function attachComments(statement, leadingComments) {
|
|
8875
8988
|
for (const comment of leadingComments) {
|
|
8876
|
-
const commentKind = comment.multiline ?
|
|
8989
|
+
const commentKind = comment.multiline ? ts35.SyntaxKind.MultiLineCommentTrivia : ts35.SyntaxKind.SingleLineCommentTrivia;
|
|
8877
8990
|
if (comment.multiline) {
|
|
8878
|
-
|
|
8991
|
+
ts35.addSyntheticLeadingComment(statement, commentKind, comment.toString(), comment.trailingNewline);
|
|
8879
8992
|
} else {
|
|
8880
8993
|
for (const line of comment.toString().split("\n")) {
|
|
8881
|
-
|
|
8994
|
+
ts35.addSyntheticLeadingComment(statement, commentKind, line, comment.trailingNewline);
|
|
8882
8995
|
}
|
|
8883
8996
|
}
|
|
8884
8997
|
}
|
|
@@ -8890,7 +9003,7 @@ function translateStatement(statement, imports, options2 = {}) {
|
|
|
8890
9003
|
}
|
|
8891
9004
|
|
|
8892
9005
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/utils.mjs
|
|
8893
|
-
import
|
|
9006
|
+
import ts36 from "typescript";
|
|
8894
9007
|
|
|
8895
9008
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/declaration.mjs
|
|
8896
9009
|
var DtsTransformRegistry = class {
|
|
@@ -8907,7 +9020,7 @@ var DtsTransformRegistry = class {
|
|
|
8907
9020
|
if (!sf.isDeclarationFile) {
|
|
8908
9021
|
return null;
|
|
8909
9022
|
}
|
|
8910
|
-
const originalSf =
|
|
9023
|
+
const originalSf = ts37.getOriginalNode(sf);
|
|
8911
9024
|
let transforms = null;
|
|
8912
9025
|
if (this.ivyDeclarationTransforms.has(originalSf)) {
|
|
8913
9026
|
transforms = [];
|
|
@@ -8924,41 +9037,41 @@ var IvyDeclarationDtsTransform = class {
|
|
|
8924
9037
|
this.declarationFields.set(decl, fields);
|
|
8925
9038
|
}
|
|
8926
9039
|
transformClass(clazz, members, imports) {
|
|
8927
|
-
const original =
|
|
9040
|
+
const original = ts37.getOriginalNode(clazz);
|
|
8928
9041
|
if (!this.declarationFields.has(original)) {
|
|
8929
9042
|
return clazz;
|
|
8930
9043
|
}
|
|
8931
9044
|
const fields = this.declarationFields.get(original);
|
|
8932
9045
|
const newMembers = fields.map((decl) => {
|
|
8933
|
-
const modifiers = [
|
|
9046
|
+
const modifiers = [ts37.createModifier(ts37.SyntaxKind.StaticKeyword)];
|
|
8934
9047
|
const typeRef = translateType(decl.type, imports);
|
|
8935
9048
|
markForEmitAsSingleLine(typeRef);
|
|
8936
|
-
return
|
|
9049
|
+
return ts37.createProperty(void 0, modifiers, decl.name, void 0, typeRef, void 0);
|
|
8937
9050
|
});
|
|
8938
|
-
return
|
|
9051
|
+
return ts37.updateClassDeclaration(clazz, clazz.decorators, clazz.modifiers, clazz.name, clazz.typeParameters, clazz.heritageClauses, [...members, ...newMembers]);
|
|
8939
9052
|
}
|
|
8940
9053
|
};
|
|
8941
9054
|
function markForEmitAsSingleLine(node) {
|
|
8942
|
-
|
|
8943
|
-
|
|
9055
|
+
ts37.setEmitFlags(node, ts37.EmitFlags.SingleLine);
|
|
9056
|
+
ts37.forEachChild(node, markForEmitAsSingleLine);
|
|
8944
9057
|
}
|
|
8945
9058
|
|
|
8946
9059
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/transform.mjs
|
|
8947
9060
|
import { ConstantPool } from "@angular/compiler";
|
|
8948
|
-
import
|
|
9061
|
+
import ts39 from "typescript";
|
|
8949
9062
|
|
|
8950
9063
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/util/src/visitor.mjs
|
|
8951
|
-
import
|
|
9064
|
+
import ts38 from "typescript";
|
|
8952
9065
|
|
|
8953
9066
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/transform.mjs
|
|
8954
9067
|
var NO_DECORATORS = new Set();
|
|
8955
9068
|
|
|
8956
9069
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/diagnostics.mjs
|
|
8957
|
-
import
|
|
9070
|
+
import ts41 from "typescript";
|
|
8958
9071
|
|
|
8959
9072
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/util.mjs
|
|
8960
9073
|
import { ExternalExpr as ExternalExpr4, LiteralExpr, ParseLocation, ParseSourceFile, ParseSourceSpan, ReadPropExpr, WrappedNodeExpr as WrappedNodeExpr2 } from "@angular/compiler";
|
|
8961
|
-
import
|
|
9074
|
+
import ts40 from "typescript";
|
|
8962
9075
|
function getConstructorDependencies(clazz, reflector, isCore) {
|
|
8963
9076
|
const deps = [];
|
|
8964
9077
|
const errors = [];
|
|
@@ -8995,10 +9108,10 @@ function getConstructorDependencies(clazz, reflector, isCore) {
|
|
|
8995
9108
|
}
|
|
8996
9109
|
const attributeName = dec.args[0];
|
|
8997
9110
|
token = new WrappedNodeExpr2(attributeName);
|
|
8998
|
-
if (
|
|
9111
|
+
if (ts40.isStringLiteralLike(attributeName)) {
|
|
8999
9112
|
attributeNameType = new LiteralExpr(attributeName.text);
|
|
9000
9113
|
} else {
|
|
9001
|
-
attributeNameType = new WrappedNodeExpr2(
|
|
9114
|
+
attributeNameType = new WrappedNodeExpr2(ts40.createKeywordTypeNode(ts40.SyntaxKind.UnknownKeyword));
|
|
9002
9115
|
}
|
|
9003
9116
|
} else {
|
|
9004
9117
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_UNEXPECTED, Decorator.nodeForError(dec), `Unexpected decorator ${name} on parameter.`);
|
|
@@ -9108,11 +9221,11 @@ function createUnsuitableInjectionTokenError(clazz, error2) {
|
|
|
9108
9221
|
}
|
|
9109
9222
|
const chain = {
|
|
9110
9223
|
messageText: `No suitable injection token for parameter '${param.name || index}' of class '${clazz.name.text}'.`,
|
|
9111
|
-
category:
|
|
9224
|
+
category: ts40.DiagnosticCategory.Error,
|
|
9112
9225
|
code: 0,
|
|
9113
9226
|
next: [{
|
|
9114
9227
|
messageText: chainMessage,
|
|
9115
|
-
category:
|
|
9228
|
+
category: ts40.DiagnosticCategory.Message,
|
|
9116
9229
|
code: 0
|
|
9117
9230
|
}]
|
|
9118
9231
|
};
|
|
@@ -9142,23 +9255,23 @@ function isAngularDecorator(decorator, name, isCore) {
|
|
|
9142
9255
|
return false;
|
|
9143
9256
|
}
|
|
9144
9257
|
function unwrapExpression(node) {
|
|
9145
|
-
while (
|
|
9258
|
+
while (ts40.isAsExpression(node) || ts40.isParenthesizedExpression(node)) {
|
|
9146
9259
|
node = node.expression;
|
|
9147
9260
|
}
|
|
9148
9261
|
return node;
|
|
9149
9262
|
}
|
|
9150
9263
|
function expandForwardRef(arg) {
|
|
9151
9264
|
arg = unwrapExpression(arg);
|
|
9152
|
-
if (!
|
|
9265
|
+
if (!ts40.isArrowFunction(arg) && !ts40.isFunctionExpression(arg)) {
|
|
9153
9266
|
return null;
|
|
9154
9267
|
}
|
|
9155
9268
|
const body = arg.body;
|
|
9156
|
-
if (
|
|
9269
|
+
if (ts40.isBlock(body)) {
|
|
9157
9270
|
if (body.statements.length !== 1) {
|
|
9158
9271
|
return null;
|
|
9159
9272
|
}
|
|
9160
9273
|
const stmt = body.statements[0];
|
|
9161
|
-
if (!
|
|
9274
|
+
if (!ts40.isReturnStatement(stmt) || stmt.expression === void 0) {
|
|
9162
9275
|
return null;
|
|
9163
9276
|
}
|
|
9164
9277
|
return stmt.expression;
|
|
@@ -9168,11 +9281,11 @@ function expandForwardRef(arg) {
|
|
|
9168
9281
|
}
|
|
9169
9282
|
function tryUnwrapForwardRef(node, reflector) {
|
|
9170
9283
|
node = unwrapExpression(node);
|
|
9171
|
-
if (!
|
|
9284
|
+
if (!ts40.isCallExpression(node) || node.arguments.length !== 1) {
|
|
9172
9285
|
return null;
|
|
9173
9286
|
}
|
|
9174
|
-
const fn =
|
|
9175
|
-
if (!
|
|
9287
|
+
const fn = ts40.isPropertyAccessExpression(node.expression) ? node.expression.name : node.expression;
|
|
9288
|
+
if (!ts40.isIdentifier(fn)) {
|
|
9176
9289
|
return null;
|
|
9177
9290
|
}
|
|
9178
9291
|
const expr = expandForwardRef(node.arguments[0]);
|
|
@@ -9204,7 +9317,7 @@ function combineResolvers(resolvers) {
|
|
|
9204
9317
|
}
|
|
9205
9318
|
function isExpressionForwardReference(expr, context, contextSource) {
|
|
9206
9319
|
if (isWrappedTsNodeExpr(expr)) {
|
|
9207
|
-
const node =
|
|
9320
|
+
const node = ts40.getOriginalNode(expr.node);
|
|
9208
9321
|
return node.getSourceFile() === contextSource && context.pos < node.pos;
|
|
9209
9322
|
} else {
|
|
9210
9323
|
return false;
|
|
@@ -9227,16 +9340,16 @@ function readBaseClass2(node, reflector, evaluator) {
|
|
|
9227
9340
|
}
|
|
9228
9341
|
var parensWrapperTransformerFactory = (context) => {
|
|
9229
9342
|
const visitor = (node) => {
|
|
9230
|
-
const visited =
|
|
9231
|
-
if (
|
|
9232
|
-
return
|
|
9343
|
+
const visited = ts40.visitEachChild(node, visitor, context);
|
|
9344
|
+
if (ts40.isArrowFunction(visited) || ts40.isFunctionExpression(visited)) {
|
|
9345
|
+
return ts40.createParen(visited);
|
|
9233
9346
|
}
|
|
9234
9347
|
return visited;
|
|
9235
9348
|
};
|
|
9236
|
-
return (node) =>
|
|
9349
|
+
return (node) => ts40.visitEachChild(node, visitor, context);
|
|
9237
9350
|
};
|
|
9238
9351
|
function wrapFunctionExpressionsInParens(expression) {
|
|
9239
|
-
return
|
|
9352
|
+
return ts40.transform(expression, [parensWrapperTransformerFactory]).transformed[0];
|
|
9240
9353
|
}
|
|
9241
9354
|
function makeDuplicateDeclarationError(node, data, kind) {
|
|
9242
9355
|
const context = [];
|
|
@@ -9334,11 +9447,11 @@ function createValueHasWrongTypeError(node, value, messageText) {
|
|
|
9334
9447
|
}
|
|
9335
9448
|
const chain = {
|
|
9336
9449
|
messageText,
|
|
9337
|
-
category:
|
|
9450
|
+
category: ts41.DiagnosticCategory.Error,
|
|
9338
9451
|
code: 0,
|
|
9339
9452
|
next: [{
|
|
9340
9453
|
messageText: chainedMessage,
|
|
9341
|
-
category:
|
|
9454
|
+
category: ts41.DiagnosticCategory.Message,
|
|
9342
9455
|
code: 0
|
|
9343
9456
|
}]
|
|
9344
9457
|
};
|
|
@@ -9414,7 +9527,7 @@ function getInheritedUndecoratedCtorDiagnostic(node, baseClass, reader) {
|
|
|
9414
9527
|
|
|
9415
9528
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/directive.mjs
|
|
9416
9529
|
import { compileClassMetadata, compileDeclareClassMetadata, compileDeclareDirectiveFromMetadata, compileDirectiveFromMetadata, createMayBeForwardRefExpression, emitDistinctChangesOnlyDefaultValue, ExternalExpr as ExternalExpr5, FactoryTarget, getSafePropertyAccessString, makeBindingParser, parseHostBindings, verifyHostBindings, WrappedNodeExpr as WrappedNodeExpr4 } from "@angular/compiler";
|
|
9417
|
-
import
|
|
9530
|
+
import ts43 from "typescript";
|
|
9418
9531
|
|
|
9419
9532
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/factory.mjs
|
|
9420
9533
|
import { compileDeclareFactoryFunction, compileFactoryFunction } from "@angular/compiler";
|
|
@@ -9429,7 +9542,7 @@ function compileDeclareFactory(metadata) {
|
|
|
9429
9542
|
|
|
9430
9543
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/metadata.mjs
|
|
9431
9544
|
import { FunctionExpr, LiteralArrayExpr, LiteralExpr as LiteralExpr2, literalMap, ReturnStatement, WrappedNodeExpr as WrappedNodeExpr3 } from "@angular/compiler";
|
|
9432
|
-
import
|
|
9545
|
+
import ts42 from "typescript";
|
|
9433
9546
|
function extractClassMetadata(clazz, reflection, isCore, annotateForClosureCompiler, angularDecoratorTransform = (dec) => dec) {
|
|
9434
9547
|
if (!reflection.isClass(clazz)) {
|
|
9435
9548
|
return null;
|
|
@@ -9443,7 +9556,7 @@ function extractClassMetadata(clazz, reflection, isCore, annotateForClosureCompi
|
|
|
9443
9556
|
if (ngClassDecorators.length === 0) {
|
|
9444
9557
|
return null;
|
|
9445
9558
|
}
|
|
9446
|
-
const metaDecorators = new WrappedNodeExpr3(
|
|
9559
|
+
const metaDecorators = new WrappedNodeExpr3(ts42.createArrayLiteral(ngClassDecorators));
|
|
9447
9560
|
let metaCtorParameters = null;
|
|
9448
9561
|
const classCtorParameters = reflection.getConstructorParameters(clazz);
|
|
9449
9562
|
if (classCtorParameters !== null) {
|
|
@@ -9463,7 +9576,7 @@ function extractClassMetadata(clazz, reflection, isCore, annotateForClosureCompi
|
|
|
9463
9576
|
return classMemberToMetadata((_a = member.nameNode) != null ? _a : member.name, member.decorators, isCore);
|
|
9464
9577
|
});
|
|
9465
9578
|
if (decoratedMembers.length > 0) {
|
|
9466
|
-
metaPropDecorators = new WrappedNodeExpr3(
|
|
9579
|
+
metaPropDecorators = new WrappedNodeExpr3(ts42.createObjectLiteral(decoratedMembers));
|
|
9467
9580
|
}
|
|
9468
9581
|
return {
|
|
9469
9582
|
type: new WrappedNodeExpr3(id),
|
|
@@ -9479,38 +9592,38 @@ function ctorParameterToMetadata(param, isCore) {
|
|
|
9479
9592
|
];
|
|
9480
9593
|
if (param.decorators !== null) {
|
|
9481
9594
|
const ngDecorators = param.decorators.filter((dec) => isAngularDecorator2(dec, isCore)).map((decorator) => decoratorToMetadata(decorator));
|
|
9482
|
-
const value = new WrappedNodeExpr3(
|
|
9595
|
+
const value = new WrappedNodeExpr3(ts42.createArrayLiteral(ngDecorators));
|
|
9483
9596
|
mapEntries.push({ key: "decorators", value, quoted: false });
|
|
9484
9597
|
}
|
|
9485
9598
|
return literalMap(mapEntries);
|
|
9486
9599
|
}
|
|
9487
9600
|
function classMemberToMetadata(name, decorators, isCore) {
|
|
9488
9601
|
const ngDecorators = decorators.filter((dec) => isAngularDecorator2(dec, isCore)).map((decorator) => decoratorToMetadata(decorator));
|
|
9489
|
-
const decoratorMeta =
|
|
9490
|
-
return
|
|
9602
|
+
const decoratorMeta = ts42.createArrayLiteral(ngDecorators);
|
|
9603
|
+
return ts42.createPropertyAssignment(name, decoratorMeta);
|
|
9491
9604
|
}
|
|
9492
9605
|
function decoratorToMetadata(decorator, wrapFunctionsInParens) {
|
|
9493
9606
|
if (decorator.identifier === null) {
|
|
9494
9607
|
throw new Error("Illegal state: synthesized decorator cannot be emitted in class metadata.");
|
|
9495
9608
|
}
|
|
9496
9609
|
const properties = [
|
|
9497
|
-
|
|
9610
|
+
ts42.createPropertyAssignment("type", ts42.getMutableClone(decorator.identifier))
|
|
9498
9611
|
];
|
|
9499
9612
|
if (decorator.args !== null && decorator.args.length > 0) {
|
|
9500
9613
|
const args = decorator.args.map((arg) => {
|
|
9501
|
-
const expr =
|
|
9614
|
+
const expr = ts42.getMutableClone(arg);
|
|
9502
9615
|
return wrapFunctionsInParens ? wrapFunctionExpressionsInParens(expr) : expr;
|
|
9503
9616
|
});
|
|
9504
|
-
properties.push(
|
|
9617
|
+
properties.push(ts42.createPropertyAssignment("args", ts42.createArrayLiteral(args)));
|
|
9505
9618
|
}
|
|
9506
|
-
return
|
|
9619
|
+
return ts42.createObjectLiteral(properties, true);
|
|
9507
9620
|
}
|
|
9508
9621
|
function isAngularDecorator2(decorator, isCore) {
|
|
9509
9622
|
return isCore || decorator.import !== null && decorator.import.from === "@angular/core";
|
|
9510
9623
|
}
|
|
9511
9624
|
function removeIdentifierReferences(node, name) {
|
|
9512
|
-
const result =
|
|
9513
|
-
return
|
|
9625
|
+
const result = ts42.transform(node, [(context) => (root) => ts42.visitNode(root, function walk(current) {
|
|
9626
|
+
return ts42.isIdentifier(current) && current.text === name ? ts42.createIdentifier(current.text) : ts42.visitEachChild(current, walk, context);
|
|
9514
9627
|
})]);
|
|
9515
9628
|
return result.transformed[0];
|
|
9516
9629
|
}
|
|
@@ -9735,7 +9848,7 @@ function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, isCore
|
|
|
9735
9848
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, Decorator.nodeForError(decorator), `Incorrect number of arguments to @${decorator.name} decorator`);
|
|
9736
9849
|
} else {
|
|
9737
9850
|
const meta = unwrapExpression(decorator.args[0]);
|
|
9738
|
-
if (!
|
|
9851
|
+
if (!ts43.isObjectLiteralExpression(meta)) {
|
|
9739
9852
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, `@${decorator.name} argument must be an object literal`);
|
|
9740
9853
|
}
|
|
9741
9854
|
directive = reflectObjectLiteral(meta);
|
|
@@ -9846,7 +9959,7 @@ function extractQueryMetadata(exprNode, name, args, propertyName, reflector, eva
|
|
|
9846
9959
|
let emitDistinctChangesOnly = emitDistinctChangesOnlyDefaultValue;
|
|
9847
9960
|
if (args.length === 2) {
|
|
9848
9961
|
const optionsExpr = unwrapExpression(args[1]);
|
|
9849
|
-
if (!
|
|
9962
|
+
if (!ts43.isObjectLiteralExpression(optionsExpr)) {
|
|
9850
9963
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, optionsExpr, `@${name} options must be an object literal`);
|
|
9851
9964
|
}
|
|
9852
9965
|
const options2 = reflectObjectLiteral(optionsExpr);
|
|
@@ -9891,16 +10004,16 @@ function extractQueryMetadata(exprNode, name, args, propertyName, reflector, eva
|
|
|
9891
10004
|
}
|
|
9892
10005
|
function extractQueriesFromDecorator(queryData, reflector, evaluator, isCore) {
|
|
9893
10006
|
const content = [], view = [];
|
|
9894
|
-
if (!
|
|
10007
|
+
if (!ts43.isObjectLiteralExpression(queryData)) {
|
|
9895
10008
|
throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, queryData, "Decorator queries metadata must be an object literal");
|
|
9896
10009
|
}
|
|
9897
10010
|
reflectObjectLiteral(queryData).forEach((queryExpr, propertyName) => {
|
|
9898
10011
|
queryExpr = unwrapExpression(queryExpr);
|
|
9899
|
-
if (!
|
|
10012
|
+
if (!ts43.isNewExpression(queryExpr)) {
|
|
9900
10013
|
throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, queryData, "Decorator query metadata must be an instance of a query type");
|
|
9901
10014
|
}
|
|
9902
|
-
const queryType =
|
|
9903
|
-
if (!
|
|
10015
|
+
const queryType = ts43.isPropertyAccessExpression(queryExpr.expression) ? queryExpr.expression.name : queryExpr.expression;
|
|
10016
|
+
if (!ts43.isIdentifier(queryType)) {
|
|
9904
10017
|
throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, queryData, "Decorator query metadata must be an instance of a query type");
|
|
9905
10018
|
}
|
|
9906
10019
|
const type = reflector.getImportOfIdentifier(queryType);
|
|
@@ -10079,7 +10192,7 @@ var QUERY_TYPES = new Set([
|
|
|
10079
10192
|
|
|
10080
10193
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/ng_module.mjs
|
|
10081
10194
|
import { compileClassMetadata as compileClassMetadata2, compileDeclareClassMetadata as compileDeclareClassMetadata2, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileInjector, compileNgModule, CUSTOM_ELEMENTS_SCHEMA, ExternalExpr as ExternalExpr6, FactoryTarget as FactoryTarget2, InvokeFunctionExpr, LiteralArrayExpr as LiteralArrayExpr2, NO_ERRORS_SCHEMA, R3Identifiers, WrappedNodeExpr as WrappedNodeExpr5 } from "@angular/compiler";
|
|
10082
|
-
import
|
|
10195
|
+
import ts44 from "typescript";
|
|
10083
10196
|
var NgModuleSymbol = class extends SemanticSymbol {
|
|
10084
10197
|
constructor() {
|
|
10085
10198
|
super(...arguments);
|
|
@@ -10162,8 +10275,8 @@ var NgModuleDecoratorHandler = class {
|
|
|
10162
10275
|
if (decorator.args === null || decorator.args.length > 1) {
|
|
10163
10276
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, Decorator.nodeForError(decorator), `Incorrect number of arguments to @NgModule decorator`);
|
|
10164
10277
|
}
|
|
10165
|
-
const meta = decorator.args.length === 1 ? unwrapExpression(decorator.args[0]) :
|
|
10166
|
-
if (!
|
|
10278
|
+
const meta = decorator.args.length === 1 ? unwrapExpression(decorator.args[0]) : ts44.createObjectLiteral([]);
|
|
10279
|
+
if (!ts44.isObjectLiteralExpression(meta)) {
|
|
10167
10280
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, "@NgModule argument must be an object literal");
|
|
10168
10281
|
}
|
|
10169
10282
|
const ngModule = reflectObjectLiteral(meta);
|
|
@@ -10442,10 +10555,10 @@ var NgModuleDecoratorHandler = class {
|
|
|
10442
10555
|
return type && (this._reflectModuleFromTypeParam(type, node) || this._reflectModuleFromLiteralType(type));
|
|
10443
10556
|
}
|
|
10444
10557
|
_reflectModuleFromTypeParam(type, node) {
|
|
10445
|
-
if (!
|
|
10558
|
+
if (!ts44.isTypeReferenceNode(type)) {
|
|
10446
10559
|
return null;
|
|
10447
10560
|
}
|
|
10448
|
-
const typeName = type && (
|
|
10561
|
+
const typeName = type && (ts44.isIdentifier(type.typeName) && type.typeName || ts44.isQualifiedName(type.typeName) && type.typeName.right) || null;
|
|
10449
10562
|
if (typeName === null) {
|
|
10450
10563
|
return null;
|
|
10451
10564
|
}
|
|
@@ -10457,7 +10570,7 @@ var NgModuleDecoratorHandler = class {
|
|
|
10457
10570
|
return null;
|
|
10458
10571
|
}
|
|
10459
10572
|
if (type.typeArguments === void 0 || type.typeArguments.length !== 1) {
|
|
10460
|
-
const parent =
|
|
10573
|
+
const parent = ts44.isMethodDeclaration(node) && ts44.isClassDeclaration(node.parent) ? node.parent : null;
|
|
10461
10574
|
const symbolName = (parent && parent.name ? parent.name.getText() + "." : "") + (node.name ? node.name.getText() : "anonymous");
|
|
10462
10575
|
throw new FatalDiagnosticError(ErrorCode.NGMODULE_MODULE_WITH_PROVIDERS_MISSING_GENERIC, type, `${symbolName} returns a ModuleWithProviders type without a generic type argument. Please add a generic type argument to the ModuleWithProviders type. If this occurrence is in library code you don't control, please contact the library authors.`);
|
|
10463
10576
|
}
|
|
@@ -10465,13 +10578,13 @@ var NgModuleDecoratorHandler = class {
|
|
|
10465
10578
|
return typeNodeToValueExpr(arg);
|
|
10466
10579
|
}
|
|
10467
10580
|
_reflectModuleFromLiteralType(type) {
|
|
10468
|
-
if (!
|
|
10581
|
+
if (!ts44.isIntersectionTypeNode(type)) {
|
|
10469
10582
|
return null;
|
|
10470
10583
|
}
|
|
10471
10584
|
for (const t of type.types) {
|
|
10472
|
-
if (
|
|
10585
|
+
if (ts44.isTypeLiteralNode(t)) {
|
|
10473
10586
|
for (const m of t.members) {
|
|
10474
|
-
const ngModuleType =
|
|
10587
|
+
const ngModuleType = ts44.isPropertySignature(m) && ts44.isIdentifier(m.name) && m.name.text === "ngModule" && m.type || null;
|
|
10475
10588
|
const ngModuleExpression = ngModuleType && typeNodeToValueExpr(ngModuleType);
|
|
10476
10589
|
if (ngModuleExpression) {
|
|
10477
10590
|
return ngModuleExpression;
|
|
@@ -10832,7 +10945,7 @@ var ComponentDecoratorHandler = class {
|
|
|
10832
10945
|
});
|
|
10833
10946
|
}
|
|
10834
10947
|
typeCheck(ctx, node, meta) {
|
|
10835
|
-
if (this.typeCheckScopeRegistry === null || !
|
|
10948
|
+
if (this.typeCheckScopeRegistry === null || !ts45.isClassDeclaration(node)) {
|
|
10836
10949
|
return;
|
|
10837
10950
|
}
|
|
10838
10951
|
if (meta.isPoisoned && !this.usePoisonedData) {
|
|
@@ -11041,17 +11154,17 @@ var ComponentDecoratorHandler = class {
|
|
|
11041
11154
|
const metadata = new Map(component);
|
|
11042
11155
|
if (metadata.has("templateUrl")) {
|
|
11043
11156
|
metadata.delete("templateUrl");
|
|
11044
|
-
metadata.set("template",
|
|
11157
|
+
metadata.set("template", ts45.createStringLiteral(template.content));
|
|
11045
11158
|
}
|
|
11046
11159
|
if (metadata.has("styleUrls")) {
|
|
11047
11160
|
metadata.delete("styleUrls");
|
|
11048
|
-
metadata.set("styles",
|
|
11161
|
+
metadata.set("styles", ts45.createArrayLiteral(styles.map((s) => ts45.createStringLiteral(s))));
|
|
11049
11162
|
}
|
|
11050
11163
|
const newMetadataFields = [];
|
|
11051
11164
|
for (const [name, value] of metadata.entries()) {
|
|
11052
|
-
newMetadataFields.push(
|
|
11165
|
+
newMetadataFields.push(ts45.createPropertyAssignment(name, value));
|
|
11053
11166
|
}
|
|
11054
|
-
return __spreadProps(__spreadValues({}, dec), { args: [
|
|
11167
|
+
return __spreadProps(__spreadValues({}, dec), { args: [ts45.createObjectLiteral(newMetadataFields)] });
|
|
11055
11168
|
}
|
|
11056
11169
|
_resolveLiteral(decorator) {
|
|
11057
11170
|
if (this.literalCache.has(decorator)) {
|
|
@@ -11061,7 +11174,7 @@ var ComponentDecoratorHandler = class {
|
|
|
11061
11174
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, Decorator.nodeForError(decorator), `Incorrect number of arguments to @Component decorator`);
|
|
11062
11175
|
}
|
|
11063
11176
|
const meta = unwrapExpression(decorator.args[0]);
|
|
11064
|
-
if (!
|
|
11177
|
+
if (!ts45.isObjectLiteralExpression(meta)) {
|
|
11065
11178
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, `Decorator argument must be literal.`);
|
|
11066
11179
|
}
|
|
11067
11180
|
this.literalCache.set(decorator, meta);
|
|
@@ -11088,9 +11201,9 @@ var ComponentDecoratorHandler = class {
|
|
|
11088
11201
|
}
|
|
11089
11202
|
_extractStyleUrlsFromExpression(styleUrlsExpr) {
|
|
11090
11203
|
const styleUrls = [];
|
|
11091
|
-
if (
|
|
11204
|
+
if (ts45.isArrayLiteralExpression(styleUrlsExpr)) {
|
|
11092
11205
|
for (const styleUrlExpr of styleUrlsExpr.elements) {
|
|
11093
|
-
if (
|
|
11206
|
+
if (ts45.isSpreadElement(styleUrlExpr)) {
|
|
11094
11207
|
styleUrls.push(...this._extractStyleUrlsFromExpression(styleUrlExpr.expression));
|
|
11095
11208
|
} else {
|
|
11096
11209
|
const styleUrl = this.evaluator.evaluate(styleUrlExpr);
|
|
@@ -11122,10 +11235,10 @@ var ComponentDecoratorHandler = class {
|
|
|
11122
11235
|
_extractStyleResources(component, containingFile) {
|
|
11123
11236
|
const styles = new Set();
|
|
11124
11237
|
function stringLiteralElements(array) {
|
|
11125
|
-
return array.elements.filter((e) =>
|
|
11238
|
+
return array.elements.filter((e) => ts45.isStringLiteralLike(e));
|
|
11126
11239
|
}
|
|
11127
11240
|
const styleUrlsExpr = component.get("styleUrls");
|
|
11128
|
-
if (styleUrlsExpr !== void 0 &&
|
|
11241
|
+
if (styleUrlsExpr !== void 0 && ts45.isArrayLiteralExpression(styleUrlsExpr)) {
|
|
11129
11242
|
for (const expression of stringLiteralElements(styleUrlsExpr)) {
|
|
11130
11243
|
try {
|
|
11131
11244
|
const resourceUrl = this.resourceLoader.resolve(expression.text, containingFile);
|
|
@@ -11135,7 +11248,7 @@ var ComponentDecoratorHandler = class {
|
|
|
11135
11248
|
}
|
|
11136
11249
|
}
|
|
11137
11250
|
const stylesExpr = component.get("styles");
|
|
11138
|
-
if (stylesExpr !== void 0 &&
|
|
11251
|
+
if (stylesExpr !== void 0 && ts45.isArrayLiteralExpression(stylesExpr)) {
|
|
11139
11252
|
for (const expression of stringLiteralElements(stylesExpr)) {
|
|
11140
11253
|
styles.add({ path: null, expression });
|
|
11141
11254
|
}
|
|
@@ -11180,7 +11293,7 @@ var ComponentDecoratorHandler = class {
|
|
|
11180
11293
|
let sourceMapping;
|
|
11181
11294
|
let escapedString = false;
|
|
11182
11295
|
let sourceMapUrl;
|
|
11183
|
-
if (
|
|
11296
|
+
if (ts45.isStringLiteral(template.expression) || ts45.isNoSubstitutionTemplateLiteral(template.expression)) {
|
|
11184
11297
|
sourceParseRange = getTemplateRange(template.expression);
|
|
11185
11298
|
sourceStr = template.expression.getSourceFile().text;
|
|
11186
11299
|
templateContent = template.expression.text;
|
|
@@ -11354,7 +11467,7 @@ var ComponentDecoratorHandler = class {
|
|
|
11354
11467
|
};
|
|
11355
11468
|
function getTemplateRange(templateExpr) {
|
|
11356
11469
|
const startPos = templateExpr.getStart() + 1;
|
|
11357
|
-
const { line, character } =
|
|
11470
|
+
const { line, character } = ts45.getLineAndCharacterOfPosition(templateExpr.getSourceFile(), startPos);
|
|
11358
11471
|
return {
|
|
11359
11472
|
startPos,
|
|
11360
11473
|
startLine: line,
|
|
@@ -11397,7 +11510,7 @@ function checkCustomElementSelectorForErrors(selector) {
|
|
|
11397
11510
|
|
|
11398
11511
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/injectable.mjs
|
|
11399
11512
|
import { compileClassMetadata as compileClassMetadata4, compileDeclareClassMetadata as compileDeclareClassMetadata4, compileDeclareInjectableFromMetadata, compileInjectable, createMayBeForwardRefExpression as createMayBeForwardRefExpression2, FactoryTarget as FactoryTarget4, LiteralExpr as LiteralExpr3, WrappedNodeExpr as WrappedNodeExpr7 } from "@angular/compiler";
|
|
11400
|
-
import
|
|
11513
|
+
import ts46 from "typescript";
|
|
11401
11514
|
var InjectableDecoratorHandler = class {
|
|
11402
11515
|
constructor(reflector, isCore, strictCtorDeps, injectableRegistry, perf, errorOnDuplicateProv = true) {
|
|
11403
11516
|
this.reflector = reflector;
|
|
@@ -11488,7 +11601,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
|
|
|
11488
11601
|
};
|
|
11489
11602
|
} else if (decorator.args.length === 1) {
|
|
11490
11603
|
const metaNode = decorator.args[0];
|
|
11491
|
-
if (!
|
|
11604
|
+
if (!ts46.isObjectLiteralExpression(metaNode)) {
|
|
11492
11605
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, metaNode, `@Injectable argument must be an object literal`);
|
|
11493
11606
|
}
|
|
11494
11607
|
const meta = reflectObjectLiteral(metaNode);
|
|
@@ -11496,7 +11609,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
|
|
|
11496
11609
|
let deps = void 0;
|
|
11497
11610
|
if ((meta.has("useClass") || meta.has("useFactory")) && meta.has("deps")) {
|
|
11498
11611
|
const depsExpr = meta.get("deps");
|
|
11499
|
-
if (!
|
|
11612
|
+
if (!ts46.isArrayLiteralExpression(depsExpr)) {
|
|
11500
11613
|
throw new FatalDiagnosticError(ErrorCode.VALUE_NOT_LITERAL, depsExpr, `@Injectable deps metadata must be an inline array`);
|
|
11501
11614
|
}
|
|
11502
11615
|
deps = depsExpr.elements.map((dep) => getDep(dep, reflector));
|
|
@@ -11578,12 +11691,12 @@ function getDep(dep, reflector) {
|
|
|
11578
11691
|
}
|
|
11579
11692
|
return true;
|
|
11580
11693
|
}
|
|
11581
|
-
if (
|
|
11694
|
+
if (ts46.isArrayLiteralExpression(dep)) {
|
|
11582
11695
|
dep.elements.forEach((el) => {
|
|
11583
11696
|
let isDecorator = false;
|
|
11584
|
-
if (
|
|
11697
|
+
if (ts46.isIdentifier(el)) {
|
|
11585
11698
|
isDecorator = maybeUpdateDecorator(el, reflector);
|
|
11586
|
-
} else if (
|
|
11699
|
+
} else if (ts46.isNewExpression(el) && ts46.isIdentifier(el.expression)) {
|
|
11587
11700
|
const token = el.arguments && el.arguments.length > 0 && el.arguments[0] || void 0;
|
|
11588
11701
|
isDecorator = maybeUpdateDecorator(el.expression, reflector, token);
|
|
11589
11702
|
}
|
|
@@ -11597,7 +11710,7 @@ function getDep(dep, reflector) {
|
|
|
11597
11710
|
|
|
11598
11711
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/pipe.mjs
|
|
11599
11712
|
import { compileClassMetadata as compileClassMetadata5, compileDeclareClassMetadata as compileDeclareClassMetadata5, compileDeclarePipeFromMetadata, compilePipeFromMetadata, FactoryTarget as FactoryTarget5, WrappedNodeExpr as WrappedNodeExpr8 } from "@angular/compiler";
|
|
11600
|
-
import
|
|
11713
|
+
import ts47 from "typescript";
|
|
11601
11714
|
var PipeSymbol = class extends SemanticSymbol {
|
|
11602
11715
|
constructor(decl, name) {
|
|
11603
11716
|
super(decl);
|
|
@@ -11652,7 +11765,7 @@ var PipeDecoratorHandler = class {
|
|
|
11652
11765
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, Decorator.nodeForError(decorator), "@Pipe must have exactly one argument");
|
|
11653
11766
|
}
|
|
11654
11767
|
const meta = unwrapExpression(decorator.args[0]);
|
|
11655
|
-
if (!
|
|
11768
|
+
if (!ts47.isObjectLiteralExpression(meta)) {
|
|
11656
11769
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, "@Pipe must have a literal argument");
|
|
11657
11770
|
}
|
|
11658
11771
|
const pipe = reflectObjectLiteral(meta);
|
|
@@ -11792,7 +11905,7 @@ var Cycle = class {
|
|
|
11792
11905
|
};
|
|
11793
11906
|
|
|
11794
11907
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/cycles/src/imports.mjs
|
|
11795
|
-
import
|
|
11908
|
+
import ts48 from "typescript";
|
|
11796
11909
|
var ImportGraph = class {
|
|
11797
11910
|
constructor(checker, perf) {
|
|
11798
11911
|
this.checker = checker;
|
|
@@ -11836,10 +11949,10 @@ var ImportGraph = class {
|
|
|
11836
11949
|
return this.perf.inPhase(PerfPhase.CycleDetection, () => {
|
|
11837
11950
|
const imports = new Set();
|
|
11838
11951
|
for (const stmt of sf.statements) {
|
|
11839
|
-
if (!
|
|
11952
|
+
if (!ts48.isImportDeclaration(stmt) && !ts48.isExportDeclaration(stmt) || stmt.moduleSpecifier === void 0) {
|
|
11840
11953
|
continue;
|
|
11841
11954
|
}
|
|
11842
|
-
if (
|
|
11955
|
+
if (ts48.isImportDeclaration(stmt) && stmt.importClause !== void 0 && stmt.importClause.isTypeOnly) {
|
|
11843
11956
|
continue;
|
|
11844
11957
|
}
|
|
11845
11958
|
const symbol = this.checker.getSymbolAtLocation(stmt.moduleSpecifier);
|
|
@@ -11847,7 +11960,7 @@ var ImportGraph = class {
|
|
|
11847
11960
|
continue;
|
|
11848
11961
|
}
|
|
11849
11962
|
const moduleFile = symbol.valueDeclaration;
|
|
11850
|
-
if (
|
|
11963
|
+
if (ts48.isSourceFile(moduleFile) && isLocalFile(moduleFile)) {
|
|
11851
11964
|
imports.add(moduleFile);
|
|
11852
11965
|
}
|
|
11853
11966
|
}
|
|
@@ -11962,7 +12075,7 @@ var MetadataDtsModuleScopeResolver = class {
|
|
|
11962
12075
|
|
|
11963
12076
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/local.mjs
|
|
11964
12077
|
import { ExternalExpr as ExternalExpr8 } from "@angular/compiler";
|
|
11965
|
-
import
|
|
12078
|
+
import ts49 from "typescript";
|
|
11966
12079
|
var LocalModuleScopeRegistry = class {
|
|
11967
12080
|
constructor(localReader, dependencyScopeReader, refEmitter, aliasingHost) {
|
|
11968
12081
|
this.localReader = localReader;
|
|
@@ -12163,7 +12276,7 @@ var LocalModuleScopeRegistry = class {
|
|
|
12163
12276
|
}
|
|
12164
12277
|
getExportedScope(ref, diagnostics, ownerForErrors, type) {
|
|
12165
12278
|
if (ref.node.getSourceFile().isDeclarationFile) {
|
|
12166
|
-
if (!
|
|
12279
|
+
if (!ts49.isClassDeclaration(ref.node)) {
|
|
12167
12280
|
const code = type === "import" ? ErrorCode.NGMODULE_INVALID_IMPORT : ErrorCode.NGMODULE_INVALID_EXPORT;
|
|
12168
12281
|
diagnostics.push(makeDiagnostic(code, identifierOfNode(ref.node) || ref.node, `Appears in the NgModule.${type}s of ${nodeNameForError(ownerForErrors)}, but could not be resolved to an NgModule`));
|
|
12169
12282
|
return "invalid";
|
|
@@ -12270,7 +12383,7 @@ function reexportCollision(module7, refA, refB) {
|
|
|
12270
12383
|
|
|
12271
12384
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/typecheck.mjs
|
|
12272
12385
|
import { CssSelector as CssSelector2, SelectorMatcher as SelectorMatcher2 } from "@angular/compiler";
|
|
12273
|
-
import
|
|
12386
|
+
import ts50 from "typescript";
|
|
12274
12387
|
var TypeCheckScopeRegistry = class {
|
|
12275
12388
|
constructor(scopeReader, metaReader) {
|
|
12276
12389
|
this.scopeReader = scopeReader;
|
|
@@ -12303,8 +12416,8 @@ var TypeCheckScopeRegistry = class {
|
|
|
12303
12416
|
}
|
|
12304
12417
|
}
|
|
12305
12418
|
for (const { name, ref } of scope.compilation.pipes) {
|
|
12306
|
-
if (!
|
|
12307
|
-
throw new Error(`Unexpected non-class declaration ${
|
|
12419
|
+
if (!ts50.isClassDeclaration(ref.node)) {
|
|
12420
|
+
throw new Error(`Unexpected non-class declaration ${ts50.SyntaxKind[ref.node.kind]} for pipe ${ref.debugName}`);
|
|
12308
12421
|
}
|
|
12309
12422
|
pipes.set(name, ref);
|
|
12310
12423
|
}
|
|
@@ -12330,7 +12443,7 @@ var TypeCheckScopeRegistry = class {
|
|
|
12330
12443
|
};
|
|
12331
12444
|
|
|
12332
12445
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/migrations/utils.mjs
|
|
12333
|
-
import
|
|
12446
|
+
import ts51 from "typescript";
|
|
12334
12447
|
function isClassDeclaration(clazz) {
|
|
12335
12448
|
return isNamedClassDeclaration(clazz) || isNamedFunctionDeclaration(clazz) || isNamedVariableDeclaration(clazz);
|
|
12336
12449
|
}
|
|
@@ -12355,7 +12468,7 @@ function createDirectiveDecorator(clazz, metadata) {
|
|
|
12355
12468
|
if (metadata.exportAs !== null) {
|
|
12356
12469
|
metaArgs.push(property("exportAs", metadata.exportAs.join(", ")));
|
|
12357
12470
|
}
|
|
12358
|
-
args.push(reifySourceFile(
|
|
12471
|
+
args.push(reifySourceFile(ts51.createObjectLiteral(metaArgs)));
|
|
12359
12472
|
}
|
|
12360
12473
|
return {
|
|
12361
12474
|
name: "Directive",
|
|
@@ -12383,7 +12496,7 @@ function createComponentDecorator(clazz, metadata) {
|
|
|
12383
12496
|
node: null,
|
|
12384
12497
|
synthesizedFor: clazz.name,
|
|
12385
12498
|
args: [
|
|
12386
|
-
reifySourceFile(
|
|
12499
|
+
reifySourceFile(ts51.createObjectLiteral(metaArgs))
|
|
12387
12500
|
]
|
|
12388
12501
|
};
|
|
12389
12502
|
}
|
|
@@ -12398,16 +12511,16 @@ function createInjectableDecorator(clazz) {
|
|
|
12398
12511
|
};
|
|
12399
12512
|
}
|
|
12400
12513
|
function property(name, value) {
|
|
12401
|
-
return
|
|
12514
|
+
return ts51.createPropertyAssignment(name, ts51.createStringLiteral(value));
|
|
12402
12515
|
}
|
|
12403
|
-
var EMPTY_SF =
|
|
12516
|
+
var EMPTY_SF = ts51.createSourceFile("(empty)", "", ts51.ScriptTarget.Latest);
|
|
12404
12517
|
function reifySourceFile(expr) {
|
|
12405
|
-
const printer =
|
|
12406
|
-
const exprText = printer.printNode(
|
|
12407
|
-
const sf =
|
|
12518
|
+
const printer = ts51.createPrinter();
|
|
12519
|
+
const exprText = printer.printNode(ts51.EmitHint.Unspecified, expr, EMPTY_SF);
|
|
12520
|
+
const sf = ts51.createSourceFile("(synthetic)", `const expr = ${exprText};`, ts51.ScriptTarget.Latest, true, ts51.ScriptKind.JS);
|
|
12408
12521
|
const stmt = sf.statements[0];
|
|
12409
|
-
if (!
|
|
12410
|
-
throw new Error(`Expected VariableStatement, got ${
|
|
12522
|
+
if (!ts51.isVariableStatement(stmt)) {
|
|
12523
|
+
throw new Error(`Expected VariableStatement, got ${ts51.SyntaxKind[stmt.kind]}`);
|
|
12411
12524
|
}
|
|
12412
12525
|
return stmt.declarationList.declarations[0].initializer;
|
|
12413
12526
|
}
|
|
@@ -12586,7 +12699,7 @@ function determineBaseClass(clazz, host) {
|
|
|
12586
12699
|
}
|
|
12587
12700
|
|
|
12588
12701
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/analysis/migration_host.mjs
|
|
12589
|
-
import
|
|
12702
|
+
import ts52 from "typescript";
|
|
12590
12703
|
var DefaultMigrationHost = class {
|
|
12591
12704
|
constructor(reflectionHost, metadata, evaluator, compiler, entryPointPath) {
|
|
12592
12705
|
this.reflectionHost = reflectionHost;
|
|
@@ -12617,14 +12730,14 @@ function createMigrationDiagnostic(diagnostic, source, decorator) {
|
|
|
12617
12730
|
const clone = __spreadValues({}, diagnostic);
|
|
12618
12731
|
const chain = [{
|
|
12619
12732
|
messageText: `Occurs for @${decorator.name} decorator inserted by an automatic migration`,
|
|
12620
|
-
category:
|
|
12733
|
+
category: ts52.DiagnosticCategory.Message,
|
|
12621
12734
|
code: 0
|
|
12622
12735
|
}];
|
|
12623
12736
|
if (decorator.args !== null) {
|
|
12624
12737
|
const args = decorator.args.map((arg) => arg.getText()).join(", ");
|
|
12625
12738
|
chain.push({
|
|
12626
12739
|
messageText: `@${decorator.name}(${args})`,
|
|
12627
|
-
category:
|
|
12740
|
+
category: ts52.DiagnosticCategory.Message,
|
|
12628
12741
|
code: 0
|
|
12629
12742
|
});
|
|
12630
12743
|
}
|
|
@@ -12850,7 +12963,7 @@ var DecorationAnalyzer = class {
|
|
|
12850
12963
|
};
|
|
12851
12964
|
|
|
12852
12965
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/analysis/module_with_providers_analyzer.mjs
|
|
12853
|
-
import
|
|
12966
|
+
import ts53 from "typescript";
|
|
12854
12967
|
var ModuleWithProvidersAnalyses = Map;
|
|
12855
12968
|
var ModuleWithProvidersAnalyzer = class {
|
|
12856
12969
|
constructor(host, typeChecker, referencesRegistry, processDts) {
|
|
@@ -12872,7 +12985,7 @@ var ModuleWithProvidersAnalyzer = class {
|
|
|
12872
12985
|
if (this.processDts) {
|
|
12873
12986
|
const dtsFn = this.getDtsModuleWithProvidersFunction(fn);
|
|
12874
12987
|
const dtsFnType = dtsFn.declaration.type;
|
|
12875
|
-
const typeParam = dtsFnType &&
|
|
12988
|
+
const typeParam = dtsFnType && ts53.isTypeReferenceNode(dtsFnType) && dtsFnType.typeArguments && dtsFnType.typeArguments[0] || null;
|
|
12876
12989
|
if (!typeParam || isAnyKeyword(typeParam)) {
|
|
12877
12990
|
const dtsFile = dtsFn.declaration.getSourceFile();
|
|
12878
12991
|
const analysis = analyses.has(dtsFile) ? analyses.get(dtsFile) : [];
|
|
@@ -12917,7 +13030,7 @@ var ModuleWithProvidersAnalyzer = class {
|
|
|
12917
13030
|
return infos;
|
|
12918
13031
|
}
|
|
12919
13032
|
parseForModuleWithProviders(name, node, implementation = node, container = null) {
|
|
12920
|
-
if (implementation === null || !
|
|
13033
|
+
if (implementation === null || !ts53.isFunctionDeclaration(implementation) && !ts53.isMethodDeclaration(implementation) && !ts53.isFunctionExpression(implementation)) {
|
|
12921
13034
|
return null;
|
|
12922
13035
|
}
|
|
12923
13036
|
const declaration = implementation;
|
|
@@ -12930,7 +13043,7 @@ var ModuleWithProvidersAnalyzer = class {
|
|
|
12930
13043
|
return null;
|
|
12931
13044
|
}
|
|
12932
13045
|
const lastStatement = body[body.length - 1];
|
|
12933
|
-
if (!
|
|
13046
|
+
if (!ts53.isReturnStatement(lastStatement) || lastStatement.expression === void 0) {
|
|
12934
13047
|
return null;
|
|
12935
13048
|
}
|
|
12936
13049
|
const result = this.evaluator.evaluate(lastStatement.expression);
|
|
@@ -12952,7 +13065,7 @@ var ModuleWithProvidersAnalyzer = class {
|
|
|
12952
13065
|
const containerClass = fn.container && this.host.getClassSymbol(fn.container);
|
|
12953
13066
|
if (containerClass) {
|
|
12954
13067
|
const dtsClass = this.host.getDtsDeclaration(containerClass.declaration.valueDeclaration);
|
|
12955
|
-
dtsFn = dtsClass &&
|
|
13068
|
+
dtsFn = dtsClass && ts53.isClassDeclaration(dtsClass) ? dtsClass.members.find((member) => ts53.isMethodDeclaration(member) && ts53.isIdentifier(member.name) && member.name.text === fn.name) : null;
|
|
12956
13069
|
} else {
|
|
12957
13070
|
dtsFn = this.host.getDtsDeclaration(fn.declaration);
|
|
12958
13071
|
}
|
|
@@ -12982,10 +13095,10 @@ var ModuleWithProvidersAnalyzer = class {
|
|
|
12982
13095
|
}
|
|
12983
13096
|
};
|
|
12984
13097
|
function isFunctionOrMethod(declaration) {
|
|
12985
|
-
return
|
|
13098
|
+
return ts53.isFunctionDeclaration(declaration) || ts53.isMethodDeclaration(declaration);
|
|
12986
13099
|
}
|
|
12987
13100
|
function isAnyKeyword(typeParam) {
|
|
12988
|
-
return typeParam.kind ===
|
|
13101
|
+
return typeParam.kind === ts53.SyntaxKind.AnyKeyword;
|
|
12989
13102
|
}
|
|
12990
13103
|
|
|
12991
13104
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/analysis/ngcc_references_registry.mjs
|
|
@@ -13050,27 +13163,8 @@ var PrivateDeclarationsAnalyzer = class {
|
|
|
13050
13163
|
}
|
|
13051
13164
|
};
|
|
13052
13165
|
|
|
13053
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/analysis/switch_marker_analyzer.mjs
|
|
13054
|
-
var SwitchMarkerAnalyses = Map;
|
|
13055
|
-
var SwitchMarkerAnalyzer = class {
|
|
13056
|
-
constructor(host, packagePath) {
|
|
13057
|
-
this.host = host;
|
|
13058
|
-
this.packagePath = packagePath;
|
|
13059
|
-
}
|
|
13060
|
-
analyzeProgram(program) {
|
|
13061
|
-
const analyzedFiles = new SwitchMarkerAnalyses();
|
|
13062
|
-
program.getSourceFiles().filter((sourceFile) => isWithinPackage(this.packagePath, absoluteFromSourceFile(sourceFile))).forEach((sourceFile) => {
|
|
13063
|
-
const declarations = this.host.getSwitchableDeclarations(sourceFile);
|
|
13064
|
-
if (declarations.length) {
|
|
13065
|
-
analyzedFiles.set(sourceFile, { sourceFile, declarations });
|
|
13066
|
-
}
|
|
13067
|
-
});
|
|
13068
|
-
return analyzedFiles;
|
|
13069
|
-
}
|
|
13070
|
-
};
|
|
13071
|
-
|
|
13072
13166
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/host/commonjs_host.mjs
|
|
13073
|
-
import
|
|
13167
|
+
import ts54 from "typescript";
|
|
13074
13168
|
var CommonJsReflectionHost = class extends Esm5ReflectionHost {
|
|
13075
13169
|
constructor(logger, isCore, src, dts = null) {
|
|
13076
13170
|
super(logger, isCore, src, dts);
|
|
@@ -13144,7 +13238,7 @@ var CommonJsReflectionHost = class extends Esm5ReflectionHost {
|
|
|
13144
13238
|
}
|
|
13145
13239
|
extractCommonJsWildcardReexports(statement, containingFile) {
|
|
13146
13240
|
const reexportArg = statement.expression.arguments[0];
|
|
13147
|
-
const requireCall = isRequireCall(reexportArg) ? reexportArg :
|
|
13241
|
+
const requireCall = isRequireCall(reexportArg) ? reexportArg : ts54.isIdentifier(reexportArg) ? findRequireCallReference(reexportArg, this.checker) : null;
|
|
13148
13242
|
if (requireCall === null) {
|
|
13149
13243
|
return [];
|
|
13150
13244
|
}
|
|
@@ -13227,7 +13321,7 @@ var CommonJsReflectionHost = class extends Esm5ReflectionHost {
|
|
|
13227
13321
|
const moduleInfo = this.compilerHost.resolveModuleNames([moduleName], containingFile.fileName, void 0, void 0, this.program.getCompilerOptions())[0];
|
|
13228
13322
|
return moduleInfo && this.program.getSourceFile(absoluteFrom(moduleInfo.resolvedFileName));
|
|
13229
13323
|
} else {
|
|
13230
|
-
const moduleInfo =
|
|
13324
|
+
const moduleInfo = ts54.resolveModuleName(moduleName, containingFile.fileName, this.program.getCompilerOptions(), this.compilerHost);
|
|
13231
13325
|
return moduleInfo.resolvedModule && this.program.getSourceFile(absoluteFrom(moduleInfo.resolvedModule.resolvedFileName));
|
|
13232
13326
|
}
|
|
13233
13327
|
}
|
|
@@ -13343,9 +13437,6 @@ var DelegatingReflectionHost = class {
|
|
|
13343
13437
|
getDecoratorsOfSymbol(symbol) {
|
|
13344
13438
|
return this.ngccHost.getDecoratorsOfSymbol(symbol);
|
|
13345
13439
|
}
|
|
13346
|
-
getSwitchableDeclarations(module7) {
|
|
13347
|
-
return this.ngccHost.getSwitchableDeclarations(module7);
|
|
13348
|
-
}
|
|
13349
13440
|
getEndOfClass(classSymbol) {
|
|
13350
13441
|
return this.ngccHost.getEndOfClass(classSymbol);
|
|
13351
13442
|
}
|
|
@@ -13358,13 +13449,13 @@ var DelegatingReflectionHost = class {
|
|
|
13358
13449
|
};
|
|
13359
13450
|
|
|
13360
13451
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/rendering/commonjs_rendering_formatter.mjs
|
|
13361
|
-
import
|
|
13452
|
+
import ts57 from "typescript";
|
|
13362
13453
|
|
|
13363
13454
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/rendering/esm5_rendering_formatter.mjs
|
|
13364
|
-
import
|
|
13455
|
+
import ts56 from "typescript";
|
|
13365
13456
|
|
|
13366
13457
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/rendering/esm_rendering_formatter.mjs
|
|
13367
|
-
import
|
|
13458
|
+
import ts55 from "typescript";
|
|
13368
13459
|
|
|
13369
13460
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/rendering/ngcc_import_rewriter.mjs
|
|
13370
13461
|
var NgccFlatImportRewriter = class {
|
|
@@ -13407,7 +13498,7 @@ var EsmRenderingFormatter = class {
|
|
|
13407
13498
|
this.fs = fs5;
|
|
13408
13499
|
this.host = host;
|
|
13409
13500
|
this.isCore = isCore;
|
|
13410
|
-
this.printer =
|
|
13501
|
+
this.printer = ts55.createPrinter({ newLine: ts55.NewLineKind.LineFeed });
|
|
13411
13502
|
}
|
|
13412
13503
|
addImports(output, imports, sf) {
|
|
13413
13504
|
if (imports.length === 0) {
|
|
@@ -13467,14 +13558,14 @@ export {${e.symbolName} as ${e.asAlias}} from '${e.fromModule}';`;
|
|
|
13467
13558
|
}
|
|
13468
13559
|
removeDecorators(output, decoratorsToRemove) {
|
|
13469
13560
|
decoratorsToRemove.forEach((nodesToRemove, containerNode) => {
|
|
13470
|
-
if (
|
|
13561
|
+
if (ts55.isArrayLiteralExpression(containerNode)) {
|
|
13471
13562
|
const items = containerNode.elements;
|
|
13472
13563
|
if (items.length === nodesToRemove.length) {
|
|
13473
13564
|
const statement = findStatement(containerNode);
|
|
13474
13565
|
if (statement) {
|
|
13475
|
-
if (
|
|
13566
|
+
if (ts55.isExpressionStatement(statement)) {
|
|
13476
13567
|
output.remove(statement.getFullStart(), statement.getEnd());
|
|
13477
|
-
} else if (
|
|
13568
|
+
} else if (ts55.isReturnStatement(statement) && statement.expression && isAssignment2(statement.expression)) {
|
|
13478
13569
|
const startOfRemoval = statement.expression.left.getEnd();
|
|
13479
13570
|
const endOfRemoval = getEndExceptSemicolon(statement);
|
|
13480
13571
|
output.remove(startOfRemoval, endOfRemoval);
|
|
@@ -13497,14 +13588,6 @@ export {${e.symbolName} as ${e.asAlias}} from '${e.fromModule}';`;
|
|
|
13497
13588
|
}
|
|
13498
13589
|
});
|
|
13499
13590
|
}
|
|
13500
|
-
rewriteSwitchableDeclarations(outputText, sourceFile, declarations) {
|
|
13501
|
-
declarations.forEach((declaration) => {
|
|
13502
|
-
const start = declaration.initializer.getStart();
|
|
13503
|
-
const end = declaration.initializer.getEnd();
|
|
13504
|
-
const replacement = declaration.initializer.text.replace(PRE_R3_MARKER, POST_R3_MARKER);
|
|
13505
|
-
outputText.overwrite(start, end, replacement);
|
|
13506
|
-
});
|
|
13507
|
-
}
|
|
13508
13591
|
addModuleWithProvidersParams(outputText, moduleWithProviders, importManager) {
|
|
13509
13592
|
moduleWithProviders.forEach((info) => {
|
|
13510
13593
|
const ngModuleName = info.ngModule.node.name.text;
|
|
@@ -13515,7 +13598,7 @@ export {${e.symbolName} as ${e.asAlias}} from '${e.fromModule}';`;
|
|
|
13515
13598
|
const importPath = info.ngModule.ownedByModuleGuess || (declarationFile !== ngModuleFile ? stripExtension3(relativeImport) : null);
|
|
13516
13599
|
const ngModule = generateImportString(importManager, importPath, ngModuleName);
|
|
13517
13600
|
if (info.declaration.type) {
|
|
13518
|
-
const typeName = info.declaration.type &&
|
|
13601
|
+
const typeName = info.declaration.type && ts55.isTypeReferenceNode(info.declaration.type) ? info.declaration.type.typeName : null;
|
|
13519
13602
|
if (this.isCoreModuleWithProvidersType(typeName)) {
|
|
13520
13603
|
outputText.overwrite(info.declaration.type.getStart(), info.declaration.type.getEnd(), `ModuleWithProviders<${ngModule}>`);
|
|
13521
13604
|
} else {
|
|
@@ -13524,32 +13607,32 @@ export {${e.symbolName} as ${e.asAlias}} from '${e.fromModule}';`;
|
|
|
13524
13607
|
}
|
|
13525
13608
|
} else {
|
|
13526
13609
|
const lastToken = info.declaration.getLastToken();
|
|
13527
|
-
const insertPoint = lastToken && lastToken.kind ===
|
|
13610
|
+
const insertPoint = lastToken && lastToken.kind === ts55.SyntaxKind.SemicolonToken ? lastToken.getStart() : info.declaration.getEnd();
|
|
13528
13611
|
outputText.appendLeft(insertPoint, `: ${generateImportString(importManager, "@angular/core", "ModuleWithProviders")}<${ngModule}>`);
|
|
13529
13612
|
}
|
|
13530
13613
|
});
|
|
13531
13614
|
}
|
|
13532
13615
|
printStatement(stmt, sourceFile, importManager) {
|
|
13533
13616
|
const node = translateStatement(stmt, importManager);
|
|
13534
|
-
const code = this.printer.printNode(
|
|
13617
|
+
const code = this.printer.printNode(ts55.EmitHint.Unspecified, node, sourceFile);
|
|
13535
13618
|
return code;
|
|
13536
13619
|
}
|
|
13537
13620
|
findEndOfImports(sf) {
|
|
13538
13621
|
for (const stmt of sf.statements) {
|
|
13539
|
-
if (!
|
|
13622
|
+
if (!ts55.isImportDeclaration(stmt) && !ts55.isImportEqualsDeclaration(stmt) && !ts55.isNamespaceImport(stmt)) {
|
|
13540
13623
|
return stmt.getStart();
|
|
13541
13624
|
}
|
|
13542
13625
|
}
|
|
13543
13626
|
return 0;
|
|
13544
13627
|
}
|
|
13545
13628
|
isCoreModuleWithProvidersType(typeName) {
|
|
13546
|
-
const id = typeName &&
|
|
13629
|
+
const id = typeName && ts55.isIdentifier(typeName) ? this.host.getImportOfIdentifier(typeName) : null;
|
|
13547
13630
|
return id && id.name === "ModuleWithProviders" && (this.isCore || id.from === "@angular/core");
|
|
13548
13631
|
}
|
|
13549
13632
|
};
|
|
13550
13633
|
function findStatement(node) {
|
|
13551
13634
|
while (node) {
|
|
13552
|
-
if (
|
|
13635
|
+
if (ts55.isExpressionStatement(node) || ts55.isReturnStatement(node)) {
|
|
13553
13636
|
return node;
|
|
13554
13637
|
}
|
|
13555
13638
|
node = node.parent;
|
|
@@ -13566,7 +13649,7 @@ function getNextSiblingInArray(node, array) {
|
|
|
13566
13649
|
}
|
|
13567
13650
|
function getEndExceptSemicolon(statement) {
|
|
13568
13651
|
const lastToken = statement.getLastToken();
|
|
13569
|
-
return lastToken && lastToken.kind ===
|
|
13652
|
+
return lastToken && lastToken.kind === ts55.SyntaxKind.SemicolonToken ? statement.getEnd() - 1 : statement.getEnd();
|
|
13570
13653
|
}
|
|
13571
13654
|
|
|
13572
13655
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/rendering/esm5_rendering_formatter.mjs
|
|
@@ -13580,10 +13663,10 @@ Expected an ES5 IIFE wrapped function. But got:
|
|
|
13580
13663
|
}
|
|
13581
13664
|
const declarationStatement = getContainingStatement(classSymbol.implementation.valueDeclaration);
|
|
13582
13665
|
const iifeBody = declarationStatement.parent;
|
|
13583
|
-
if (!iifeBody || !
|
|
13666
|
+
if (!iifeBody || !ts56.isBlock(iifeBody)) {
|
|
13584
13667
|
throw new Error(`Compiled class declaration is not inside an IIFE: ${compiledClass.name} in ${compiledClass.declaration.getSourceFile().fileName}`);
|
|
13585
13668
|
}
|
|
13586
|
-
const returnStatement = iifeBody.statements.find(
|
|
13669
|
+
const returnStatement = iifeBody.statements.find(ts56.isReturnStatement);
|
|
13587
13670
|
if (!returnStatement) {
|
|
13588
13671
|
throw new Error(`Compiled class wrapper IIFE does not have a return statement: ${compiledClass.name} in ${compiledClass.declaration.getSourceFile().fileName}`);
|
|
13589
13672
|
}
|
|
@@ -13592,7 +13675,7 @@ Expected an ES5 IIFE wrapped function. But got:
|
|
|
13592
13675
|
}
|
|
13593
13676
|
printStatement(stmt, sourceFile, importManager) {
|
|
13594
13677
|
const node = translateStatement(stmt, importManager, { downlevelTaggedTemplates: true, downlevelVariableDeclarations: true });
|
|
13595
|
-
const code = this.printer.printNode(
|
|
13678
|
+
const code = this.printer.printNode(ts56.EmitHint.Unspecified, node, sourceFile);
|
|
13596
13679
|
return code;
|
|
13597
13680
|
}
|
|
13598
13681
|
};
|
|
@@ -13634,10 +13717,10 @@ exports.${e.asAlias} = ${importNamespace}${namedImport.symbol};`;
|
|
|
13634
13717
|
}
|
|
13635
13718
|
findEndOfImports(sf) {
|
|
13636
13719
|
for (const statement of sf.statements) {
|
|
13637
|
-
if (
|
|
13720
|
+
if (ts57.isExpressionStatement(statement) && isRequireCall(statement.expression)) {
|
|
13638
13721
|
continue;
|
|
13639
13722
|
}
|
|
13640
|
-
const declarations =
|
|
13723
|
+
const declarations = ts57.isVariableStatement(statement) ? Array.from(statement.declarationList.declarations) : [];
|
|
13641
13724
|
if (declarations.some((d) => !d.initializer || !isRequireCall(d.initializer))) {
|
|
13642
13725
|
return statement.getStart();
|
|
13643
13726
|
}
|
|
@@ -13648,7 +13731,7 @@ exports.${e.asAlias} = ${importNamespace}${namedImport.symbol};`;
|
|
|
13648
13731
|
|
|
13649
13732
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/rendering/dts_renderer.mjs
|
|
13650
13733
|
import MagicString from "magic-string";
|
|
13651
|
-
import
|
|
13734
|
+
import ts58 from "typescript";
|
|
13652
13735
|
|
|
13653
13736
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/constants.mjs
|
|
13654
13737
|
var IMPORT_PREFIX = "\u0275ngcc";
|
|
@@ -14121,14 +14204,14 @@ var DtsRenderer = class {
|
|
|
14121
14204
|
}
|
|
14122
14205
|
renderDtsFile(dtsFile, renderInfo) {
|
|
14123
14206
|
const outputText = new MagicString(dtsFile.text);
|
|
14124
|
-
const printer =
|
|
14207
|
+
const printer = ts58.createPrinter();
|
|
14125
14208
|
const importManager = new ImportManager(getImportRewriter(this.bundle.dts.r3SymbolsFile, this.bundle.isCore, false), IMPORT_PREFIX);
|
|
14126
14209
|
renderInfo.classInfo.forEach((dtsClass) => {
|
|
14127
14210
|
const endOfClass = dtsClass.dtsDeclaration.getEnd();
|
|
14128
14211
|
dtsClass.compilation.forEach((declaration) => {
|
|
14129
14212
|
const type = translateType(declaration.type, importManager);
|
|
14130
14213
|
markForEmitAsSingleLine2(type);
|
|
14131
|
-
const typeStr = printer.printNode(
|
|
14214
|
+
const typeStr = printer.printNode(ts58.EmitHint.Unspecified, type, dtsFile);
|
|
14132
14215
|
const newStatement = ` static ${declaration.name}: ${typeStr};
|
|
14133
14216
|
`;
|
|
14134
14217
|
outputText.appendRight(endOfClass - 1, newStatement);
|
|
@@ -14188,8 +14271,8 @@ The simplest fix for this is to ensure that this class is exported from the pack
|
|
|
14188
14271
|
}
|
|
14189
14272
|
};
|
|
14190
14273
|
function markForEmitAsSingleLine2(node) {
|
|
14191
|
-
|
|
14192
|
-
|
|
14274
|
+
ts58.setEmitFlags(node, ts58.EmitFlags.SingleLine);
|
|
14275
|
+
ts58.forEachChild(node, markForEmitAsSingleLine2);
|
|
14193
14276
|
}
|
|
14194
14277
|
|
|
14195
14278
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/rendering/renderer.mjs
|
|
@@ -14209,23 +14292,19 @@ var Renderer = class {
|
|
|
14209
14292
|
this.bundle = bundle;
|
|
14210
14293
|
this.tsConfig = tsConfig;
|
|
14211
14294
|
}
|
|
14212
|
-
renderProgram(decorationAnalyses,
|
|
14295
|
+
renderProgram(decorationAnalyses, privateDeclarationsAnalyses) {
|
|
14213
14296
|
const renderedFiles = [];
|
|
14214
14297
|
this.bundle.src.program.getSourceFiles().forEach((sourceFile) => {
|
|
14215
|
-
if (decorationAnalyses.has(sourceFile) ||
|
|
14298
|
+
if (decorationAnalyses.has(sourceFile) || sourceFile === this.bundle.src.file) {
|
|
14216
14299
|
const compiledFile = decorationAnalyses.get(sourceFile);
|
|
14217
|
-
|
|
14218
|
-
renderedFiles.push(...this.renderFile(sourceFile, compiledFile, switchMarkerAnalysis, privateDeclarationsAnalyses));
|
|
14300
|
+
renderedFiles.push(...this.renderFile(sourceFile, compiledFile, privateDeclarationsAnalyses));
|
|
14219
14301
|
}
|
|
14220
14302
|
});
|
|
14221
14303
|
return renderedFiles;
|
|
14222
14304
|
}
|
|
14223
|
-
renderFile(sourceFile, compiledFile,
|
|
14305
|
+
renderFile(sourceFile, compiledFile, privateDeclarationsAnalyses) {
|
|
14224
14306
|
const isEntryPoint2 = sourceFile === this.bundle.src.file;
|
|
14225
14307
|
const outputText = new MagicString2(sourceFile.text);
|
|
14226
|
-
if (switchMarkerAnalysis) {
|
|
14227
|
-
this.srcFormatter.rewriteSwitchableDeclarations(outputText, switchMarkerAnalysis.sourceFile, switchMarkerAnalysis.declarations);
|
|
14228
|
-
}
|
|
14229
14308
|
const importManager = new ImportManager(getImportRewriter(this.bundle.src.r3SymbolsFile, this.bundle.isCore, this.bundle.isFlatCore), IMPORT_PREFIX);
|
|
14230
14309
|
if (compiledFile) {
|
|
14231
14310
|
const decoratorsToRemove = this.computeDecoratorsToRemove(compiledFile.compiledClasses);
|
|
@@ -14249,7 +14328,7 @@ var Renderer = class {
|
|
|
14249
14328
|
if (isEntryPoint2 || compiledFile) {
|
|
14250
14329
|
this.srcFormatter.addImports(outputText, importManager.getAllImports(sourceFile.fileName), sourceFile);
|
|
14251
14330
|
}
|
|
14252
|
-
if (compiledFile ||
|
|
14331
|
+
if (compiledFile || isEntryPoint2) {
|
|
14253
14332
|
return renderSourceAndMap(this.logger, this.fs, sourceFile, outputText);
|
|
14254
14333
|
} else {
|
|
14255
14334
|
return [];
|
|
@@ -14307,7 +14386,7 @@ function createAssignmentStatement(receiverName, propName, initializer, leadingC
|
|
|
14307
14386
|
}
|
|
14308
14387
|
|
|
14309
14388
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/rendering/umd_rendering_formatter.mjs
|
|
14310
|
-
import
|
|
14389
|
+
import ts59 from "typescript";
|
|
14311
14390
|
var UmdRenderingFormatter = class extends Esm5RenderingFormatter {
|
|
14312
14391
|
constructor(fs5, umdHost, isCore) {
|
|
14313
14392
|
super(fs5, umdHost, isCore);
|
|
@@ -14321,10 +14400,11 @@ var UmdRenderingFormatter = class extends Esm5RenderingFormatter {
|
|
|
14321
14400
|
if (!umdModule) {
|
|
14322
14401
|
return;
|
|
14323
14402
|
}
|
|
14324
|
-
const {
|
|
14325
|
-
renderCommonJsDependencies(output,
|
|
14326
|
-
|
|
14327
|
-
|
|
14403
|
+
const { factoryFn, factoryCalls } = umdModule;
|
|
14404
|
+
renderCommonJsDependencies(output, factoryCalls.commonJs, imports);
|
|
14405
|
+
renderCommonJsDependencies(output, factoryCalls.commonJs2, imports);
|
|
14406
|
+
renderAmdDependencies(output, factoryCalls.amdDefine, imports);
|
|
14407
|
+
renderGlobalDependencies(output, factoryCalls.global, imports);
|
|
14328
14408
|
renderFactoryParameters(output, factoryFn, imports);
|
|
14329
14409
|
}
|
|
14330
14410
|
addExports(output, entryPointBasePath, exports, importManager, file) {
|
|
@@ -14375,26 +14455,22 @@ exports.${e.asAlias} = ${importNamespace}${namedImport.symbol};`;
|
|
|
14375
14455
|
output.appendLeft(insertionPoint, "\n" + constants + "\n");
|
|
14376
14456
|
}
|
|
14377
14457
|
};
|
|
14378
|
-
function renderCommonJsDependencies(output,
|
|
14379
|
-
|
|
14380
|
-
if (!conditional) {
|
|
14458
|
+
function renderCommonJsDependencies(output, factoryCall, imports) {
|
|
14459
|
+
if (factoryCall === null) {
|
|
14381
14460
|
return;
|
|
14382
14461
|
}
|
|
14383
|
-
const factoryCall = conditional.whenTrue;
|
|
14384
14462
|
const injectionPoint = factoryCall.arguments.length > 0 ? factoryCall.arguments[0].getFullStart() : factoryCall.getEnd() - 1;
|
|
14385
14463
|
const importString = imports.map((i) => `require('${i.specifier}')`).join(",");
|
|
14386
14464
|
output.appendLeft(injectionPoint, importString + (factoryCall.arguments.length > 0 ? "," : ""));
|
|
14387
14465
|
}
|
|
14388
|
-
function renderAmdDependencies(output,
|
|
14389
|
-
|
|
14390
|
-
if (!conditional) {
|
|
14466
|
+
function renderAmdDependencies(output, amdDefineCall, imports) {
|
|
14467
|
+
if (amdDefineCall === null) {
|
|
14391
14468
|
return;
|
|
14392
14469
|
}
|
|
14393
|
-
const amdDefineCall = conditional.whenTrue;
|
|
14394
14470
|
const importString = imports.map((i) => `'${i.specifier}'`).join(",");
|
|
14395
14471
|
const factoryIndex = amdDefineCall.arguments.length - 1;
|
|
14396
14472
|
const dependencyArray = amdDefineCall.arguments[factoryIndex - 1];
|
|
14397
|
-
if (dependencyArray === void 0 || !
|
|
14473
|
+
if (dependencyArray === void 0 || !ts59.isArrayLiteralExpression(dependencyArray)) {
|
|
14398
14474
|
const injectionPoint = amdDefineCall.arguments[factoryIndex].getFullStart();
|
|
14399
14475
|
output.appendLeft(injectionPoint, `[${importString}],`);
|
|
14400
14476
|
} else {
|
|
@@ -14402,14 +14478,13 @@ function renderAmdDependencies(output, wrapperFunction, imports) {
|
|
|
14402
14478
|
output.appendLeft(injectionPoint, importString + (dependencyArray.elements.length > 0 ? "," : ""));
|
|
14403
14479
|
}
|
|
14404
14480
|
}
|
|
14405
|
-
function renderGlobalDependencies(output,
|
|
14406
|
-
|
|
14407
|
-
if (!globalFactoryCall) {
|
|
14481
|
+
function renderGlobalDependencies(output, factoryCall, imports) {
|
|
14482
|
+
if (factoryCall === null) {
|
|
14408
14483
|
return;
|
|
14409
14484
|
}
|
|
14410
|
-
const injectionPoint =
|
|
14485
|
+
const injectionPoint = factoryCall.arguments.length > 0 ? factoryCall.arguments[0].getFullStart() : factoryCall.getEnd() - 1;
|
|
14411
14486
|
const importString = imports.map((i) => `global.${getGlobalIdentifier(i)}`).join(",");
|
|
14412
|
-
output.appendLeft(injectionPoint, importString + (
|
|
14487
|
+
output.appendLeft(injectionPoint, importString + (factoryCall.arguments.length > 0 ? "," : ""));
|
|
14413
14488
|
}
|
|
14414
14489
|
function renderFactoryParameters(output, factoryFunction, imports) {
|
|
14415
14490
|
const parameters = factoryFunction.parameters;
|
|
@@ -14422,60 +14497,9 @@ function renderFactoryParameters(output, factoryFunction, imports) {
|
|
|
14422
14497
|
output.appendLeft(injectionPoint, parameterString);
|
|
14423
14498
|
}
|
|
14424
14499
|
}
|
|
14425
|
-
function isCommonJSConditional(value) {
|
|
14426
|
-
if (!ts60.isConditionalExpression(value)) {
|
|
14427
|
-
return false;
|
|
14428
|
-
}
|
|
14429
|
-
if (!ts60.isBinaryExpression(value.condition) || value.condition.operatorToken.kind !== ts60.SyntaxKind.AmpersandAmpersandToken) {
|
|
14430
|
-
return false;
|
|
14431
|
-
}
|
|
14432
|
-
if (!oneOfBinaryConditions(value.condition, (exp) => isTypeOf(exp, "exports", "module"))) {
|
|
14433
|
-
return false;
|
|
14434
|
-
}
|
|
14435
|
-
if (!ts60.isCallExpression(value.whenTrue) || !ts60.isIdentifier(value.whenTrue.expression)) {
|
|
14436
|
-
return false;
|
|
14437
|
-
}
|
|
14438
|
-
return value.whenTrue.expression.text === "factory";
|
|
14439
|
-
}
|
|
14440
|
-
function isAmdConditional(value) {
|
|
14441
|
-
if (!ts60.isConditionalExpression(value)) {
|
|
14442
|
-
return false;
|
|
14443
|
-
}
|
|
14444
|
-
if (!ts60.isBinaryExpression(value.condition) || value.condition.operatorToken.kind !== ts60.SyntaxKind.AmpersandAmpersandToken) {
|
|
14445
|
-
return false;
|
|
14446
|
-
}
|
|
14447
|
-
if (!oneOfBinaryConditions(value.condition, (exp) => isTypeOf(exp, "define"))) {
|
|
14448
|
-
return false;
|
|
14449
|
-
}
|
|
14450
|
-
if (!ts60.isCallExpression(value.whenTrue) || !ts60.isIdentifier(value.whenTrue.expression)) {
|
|
14451
|
-
return false;
|
|
14452
|
-
}
|
|
14453
|
-
return value.whenTrue.expression.text === "define";
|
|
14454
|
-
}
|
|
14455
|
-
function isGlobalFactoryCall(value) {
|
|
14456
|
-
if (ts60.isCallExpression(value) && !!value.parent) {
|
|
14457
|
-
value = isCommaExpression(value.parent) ? value.parent : value;
|
|
14458
|
-
value = ts60.isParenthesizedExpression(value.parent) ? value.parent : value;
|
|
14459
|
-
return !!value.parent && ts60.isConditionalExpression(value.parent) && value.parent.whenFalse === value;
|
|
14460
|
-
} else {
|
|
14461
|
-
return false;
|
|
14462
|
-
}
|
|
14463
|
-
}
|
|
14464
|
-
function isCommaExpression(value) {
|
|
14465
|
-
return ts60.isBinaryExpression(value) && value.operatorToken.kind === ts60.SyntaxKind.CommaToken;
|
|
14466
|
-
}
|
|
14467
14500
|
function getGlobalIdentifier(i) {
|
|
14468
14501
|
return i.specifier.replace(/^@angular\//, "ng.").replace(/^@/, "").replace(/\//g, ".").replace(/[-_]+(.?)/g, (_, c) => c.toUpperCase()).replace(/^./, (c) => c.toLowerCase());
|
|
14469
14502
|
}
|
|
14470
|
-
function find(node, test) {
|
|
14471
|
-
return test(node) ? node : node.forEachChild((child) => find(child, test));
|
|
14472
|
-
}
|
|
14473
|
-
function oneOfBinaryConditions(node, test) {
|
|
14474
|
-
return test(node.left) || test(node.right);
|
|
14475
|
-
}
|
|
14476
|
-
function isTypeOf(node, ...types) {
|
|
14477
|
-
return ts60.isBinaryExpression(node) && ts60.isTypeOfExpression(node.left) && ts60.isIdentifier(node.left.expression) && types.indexOf(node.left.expression.text) !== -1;
|
|
14478
|
-
}
|
|
14479
14503
|
|
|
14480
14504
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/transformer.mjs
|
|
14481
14505
|
var Transformer = class {
|
|
@@ -14488,7 +14512,7 @@ var Transformer = class {
|
|
|
14488
14512
|
const ngccReflectionHost = this.getHost(bundle);
|
|
14489
14513
|
const tsReflectionHost = new TypeScriptReflectionHost(bundle.src.program.getTypeChecker());
|
|
14490
14514
|
const reflectionHost = new DelegatingReflectionHost(tsReflectionHost, ngccReflectionHost);
|
|
14491
|
-
const { decorationAnalyses,
|
|
14515
|
+
const { decorationAnalyses, privateDeclarationsAnalyses, moduleWithProvidersAnalyses, diagnostics } = this.analyzeProgram(reflectionHost, bundle);
|
|
14492
14516
|
if (hasErrors(diagnostics)) {
|
|
14493
14517
|
return { success: false, diagnostics };
|
|
14494
14518
|
}
|
|
@@ -14496,7 +14520,7 @@ var Transformer = class {
|
|
|
14496
14520
|
if (bundle.dtsProcessing !== DtsProcessing.Only) {
|
|
14497
14521
|
const srcFormatter = this.getRenderingFormatter(ngccReflectionHost, bundle);
|
|
14498
14522
|
const renderer = new Renderer(reflectionHost, srcFormatter, this.fs, this.logger, bundle, this.tsConfig);
|
|
14499
|
-
renderedFiles = renderer.renderProgram(decorationAnalyses,
|
|
14523
|
+
renderedFiles = renderer.renderProgram(decorationAnalyses, privateDeclarationsAnalyses);
|
|
14500
14524
|
}
|
|
14501
14525
|
if (bundle.dts) {
|
|
14502
14526
|
const dtsFormatter = new EsmRenderingFormatter(this.fs, reflectionHost, bundle.isCore);
|
|
@@ -14539,8 +14563,6 @@ var Transformer = class {
|
|
|
14539
14563
|
}
|
|
14540
14564
|
analyzeProgram(reflectionHost, bundle) {
|
|
14541
14565
|
const referencesRegistry = new NgccReferencesRegistry(reflectionHost);
|
|
14542
|
-
const switchMarkerAnalyzer = new SwitchMarkerAnalyzer(reflectionHost, bundle.entryPoint.packagePath);
|
|
14543
|
-
const switchMarkerAnalyses = switchMarkerAnalyzer.analyzeProgram(bundle.src.program);
|
|
14544
14566
|
const diagnostics = [];
|
|
14545
14567
|
const decorationAnalyzer = new DecorationAnalyzer(this.fs, bundle, reflectionHost, referencesRegistry, (diagnostic) => diagnostics.push(diagnostic), this.tsConfig);
|
|
14546
14568
|
const decorationAnalyses = decorationAnalyzer.analyzeProgram();
|
|
@@ -14550,7 +14572,6 @@ var Transformer = class {
|
|
|
14550
14572
|
const privateDeclarationsAnalyses = privateDeclarationsAnalyzer.analyzeProgram(bundle.src.program);
|
|
14551
14573
|
return {
|
|
14552
14574
|
decorationAnalyses,
|
|
14553
|
-
switchMarkerAnalyses,
|
|
14554
14575
|
privateDeclarationsAnalyses,
|
|
14555
14576
|
moduleWithProvidersAnalyses,
|
|
14556
14577
|
diagnostics
|
|
@@ -14558,7 +14579,7 @@ var Transformer = class {
|
|
|
14558
14579
|
}
|
|
14559
14580
|
};
|
|
14560
14581
|
function hasErrors(diagnostics) {
|
|
14561
|
-
return diagnostics.some((d) => d.category ===
|
|
14582
|
+
return diagnostics.some((d) => d.category === ts60.DiagnosticCategory.Error);
|
|
14562
14583
|
}
|
|
14563
14584
|
|
|
14564
14585
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/execution/create_compile_function.mjs
|
|
@@ -14582,7 +14603,7 @@ function getCreateCompileFn(fileSystem, logger, fileWriter, enableI18nLegacyMess
|
|
|
14582
14603
|
const result = transformer.transform(bundle);
|
|
14583
14604
|
if (result.success) {
|
|
14584
14605
|
if (result.diagnostics.length > 0) {
|
|
14585
|
-
logger.warn(replaceTsWithNgInErrors(
|
|
14606
|
+
logger.warn(replaceTsWithNgInErrors(ts61.formatDiagnosticsWithColorAndContext(result.diagnostics, bundle.src.host)));
|
|
14586
14607
|
}
|
|
14587
14608
|
const writeBundle = () => {
|
|
14588
14609
|
fileWriter.writeBundle(bundle, result.transformedFiles, formatPropertiesToMarkAsProcessed);
|
|
@@ -14592,7 +14613,7 @@ function getCreateCompileFn(fileSystem, logger, fileWriter, enableI18nLegacyMess
|
|
|
14592
14613
|
const beforeWritingResult = beforeWritingFiles(result.transformedFiles);
|
|
14593
14614
|
return beforeWritingResult instanceof Promise ? beforeWritingResult.then(writeBundle) : writeBundle();
|
|
14594
14615
|
} else {
|
|
14595
|
-
const errors = replaceTsWithNgInErrors(
|
|
14616
|
+
const errors = replaceTsWithNgInErrors(ts61.formatDiagnosticsWithColorAndContext(result.diagnostics, bundle.src.host));
|
|
14596
14617
|
onTaskCompleted(task, 1, `compilation errors:
|
|
14597
14618
|
${errors}`);
|
|
14598
14619
|
}
|
|
@@ -14778,8 +14799,8 @@ var ConsoleLogger = class {
|
|
|
14778
14799
|
import module4 from "module";
|
|
14779
14800
|
function getLockFilePath(fs5) {
|
|
14780
14801
|
const requireFn = typeof __require !== "undefined" ? __require : module4.createRequire(__ESM_IMPORT_META_URL__);
|
|
14781
|
-
const ngccEntryPointFile = requireFn.resolve("@angular/compiler-cli/
|
|
14782
|
-
return fs5.resolve(ngccEntryPointFile, "
|
|
14802
|
+
const ngccEntryPointFile = requireFn.resolve("@angular/compiler-cli/package.json");
|
|
14803
|
+
return fs5.resolve(ngccEntryPointFile, "../../../.ngcc_lock_file");
|
|
14783
14804
|
}
|
|
14784
14805
|
|
|
14785
14806
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/locking/lock_file_with_child_process/util.mjs
|
|
@@ -14889,7 +14910,7 @@ import {
|
|
|
14889
14910
|
|
|
14890
14911
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/perform_compile.mjs
|
|
14891
14912
|
import { isSyntaxError as isSyntaxError2 } from "@angular/compiler";
|
|
14892
|
-
import
|
|
14913
|
+
import ts110 from "typescript";
|
|
14893
14914
|
|
|
14894
14915
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/api.mjs
|
|
14895
14916
|
var UNKNOWN_ERROR_CODE = 500;
|
|
@@ -14915,18 +14936,18 @@ import {
|
|
|
14915
14936
|
relative as relative4,
|
|
14916
14937
|
resolve as resolve3
|
|
14917
14938
|
} from "path";
|
|
14918
|
-
import
|
|
14939
|
+
import ts68 from "typescript";
|
|
14919
14940
|
|
|
14920
14941
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/metadata/collector.mjs
|
|
14921
|
-
import
|
|
14942
|
+
import ts64 from "typescript";
|
|
14922
14943
|
|
|
14923
14944
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/metadata/evaluator.mjs
|
|
14924
|
-
import
|
|
14925
|
-
var spreadElementSyntaxKind =
|
|
14926
|
-
var empty =
|
|
14945
|
+
import ts62 from "typescript";
|
|
14946
|
+
var spreadElementSyntaxKind = ts62.SyntaxKind.SpreadElement || ts62.SyntaxKind.SpreadElementExpression;
|
|
14947
|
+
var empty = ts62.createNodeArray();
|
|
14927
14948
|
|
|
14928
14949
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/metadata/symbols.mjs
|
|
14929
|
-
import
|
|
14950
|
+
import ts63 from "typescript";
|
|
14930
14951
|
|
|
14931
14952
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/metadata/bundle_index_host.mjs
|
|
14932
14953
|
import {
|
|
@@ -14935,7 +14956,7 @@ import {
|
|
|
14935
14956
|
join as join4,
|
|
14936
14957
|
normalize as normalize2
|
|
14937
14958
|
} from "path";
|
|
14938
|
-
import
|
|
14959
|
+
import ts66 from "typescript";
|
|
14939
14960
|
|
|
14940
14961
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/metadata/bundler.mjs
|
|
14941
14962
|
import {
|
|
@@ -14945,14 +14966,14 @@ import {
|
|
|
14945
14966
|
normalize,
|
|
14946
14967
|
sep
|
|
14947
14968
|
} from "path";
|
|
14948
|
-
import
|
|
14969
|
+
import ts65 from "typescript";
|
|
14949
14970
|
|
|
14950
14971
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/util.mjs
|
|
14951
14972
|
import { syntaxError } from "@angular/compiler";
|
|
14952
14973
|
import {
|
|
14953
14974
|
relative as relative3
|
|
14954
14975
|
} from "path";
|
|
14955
|
-
import
|
|
14976
|
+
import ts67 from "typescript";
|
|
14956
14977
|
|
|
14957
14978
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/program.mjs
|
|
14958
14979
|
import { core, createAotCompiler, getMissingNgModuleMetadataErrorData, getParseErrors, isFormattedError, isSyntaxError } from "@angular/compiler";
|
|
@@ -14960,19 +14981,19 @@ import {
|
|
|
14960
14981
|
readFileSync as readFileSync2
|
|
14961
14982
|
} from "fs";
|
|
14962
14983
|
import * as path6 from "path";
|
|
14963
|
-
import
|
|
14984
|
+
import ts109 from "typescript";
|
|
14964
14985
|
|
|
14965
14986
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/diagnostics/translate_diagnostics.mjs
|
|
14966
|
-
import
|
|
14987
|
+
import ts69 from "typescript";
|
|
14967
14988
|
|
|
14968
14989
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/compiler.mjs
|
|
14969
|
-
import
|
|
14990
|
+
import ts97 from "typescript";
|
|
14970
14991
|
|
|
14971
14992
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/entry_point/src/generator.mjs
|
|
14972
|
-
import
|
|
14993
|
+
import ts70 from "typescript";
|
|
14973
14994
|
|
|
14974
14995
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/entry_point/src/private_export_checker.mjs
|
|
14975
|
-
import
|
|
14996
|
+
import ts71 from "typescript";
|
|
14976
14997
|
|
|
14977
14998
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/program_driver/src/api.mjs
|
|
14978
14999
|
var NgOriginalFile = Symbol("NgOriginalFile");
|
|
@@ -14983,19 +15004,19 @@ var UpdateMode;
|
|
|
14983
15004
|
})(UpdateMode || (UpdateMode = {}));
|
|
14984
15005
|
|
|
14985
15006
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/program_driver/src/ts_create_program_driver.mjs
|
|
14986
|
-
import
|
|
15007
|
+
import ts75 from "typescript";
|
|
14987
15008
|
|
|
14988
15009
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/adapter.mjs
|
|
14989
|
-
import
|
|
15010
|
+
import ts72 from "typescript";
|
|
14990
15011
|
|
|
14991
15012
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/expando.mjs
|
|
14992
15013
|
var NgExtension = Symbol("NgExtension");
|
|
14993
15014
|
|
|
14994
15015
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/factory_generator.mjs
|
|
14995
|
-
import
|
|
15016
|
+
import ts73 from "typescript";
|
|
14996
15017
|
|
|
14997
15018
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/summary_generator.mjs
|
|
14998
|
-
import
|
|
15019
|
+
import ts74 from "typescript";
|
|
14999
15020
|
|
|
15000
15021
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/src/state.mjs
|
|
15001
15022
|
var IncrementalStateKind;
|
|
@@ -15034,13 +15055,10 @@ import { ParseSourceFile as ParseSourceFile3 } from "@angular/compiler";
|
|
|
15034
15055
|
import { ASTWithSource, ImplicitReceiver, RecursiveAstVisitor, TmplAstElement, TmplAstRecursiveVisitor, TmplAstReference, TmplAstTemplate } from "@angular/compiler";
|
|
15035
15056
|
|
|
15036
15057
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/resource/src/loader.mjs
|
|
15037
|
-
import
|
|
15058
|
+
import ts76 from "typescript";
|
|
15038
15059
|
var RESOURCE_MARKER = ".$ngresource$";
|
|
15039
15060
|
var RESOURCE_MARKER_TS = RESOURCE_MARKER + ".ts";
|
|
15040
15061
|
|
|
15041
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/switch/src/switch.mjs
|
|
15042
|
-
import ts78 from "typescript";
|
|
15043
|
-
|
|
15044
15062
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/checker.mjs
|
|
15045
15063
|
import { CssSelector as CssSelector3, DomElementSchemaRegistry as DomElementSchemaRegistry3 } from "@angular/compiler";
|
|
15046
15064
|
|
|
@@ -15075,7 +15093,7 @@ var SymbolKind;
|
|
|
15075
15093
|
})(SymbolKind || (SymbolKind = {}));
|
|
15076
15094
|
|
|
15077
15095
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/diagnostics/src/diagnostic.mjs
|
|
15078
|
-
import
|
|
15096
|
+
import ts77 from "typescript";
|
|
15079
15097
|
|
|
15080
15098
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/diagnostics/src/id.mjs
|
|
15081
15099
|
var TEMPLATE_ID = Symbol("ngTemplateId");
|
|
@@ -15083,11 +15101,11 @@ var NEXT_TEMPLATE_ID = Symbol("ngNextTemplateId");
|
|
|
15083
15101
|
|
|
15084
15102
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/completion.mjs
|
|
15085
15103
|
import { EmptyExpr, ImplicitReceiver as ImplicitReceiver2, PropertyRead, PropertyWrite, SafePropertyRead, TmplAstReference as TmplAstReference2, TmplAstTextAttribute } from "@angular/compiler";
|
|
15086
|
-
import
|
|
15104
|
+
import ts79 from "typescript";
|
|
15087
15105
|
|
|
15088
15106
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/comments.mjs
|
|
15089
15107
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan2 } from "@angular/compiler";
|
|
15090
|
-
import
|
|
15108
|
+
import ts78 from "typescript";
|
|
15091
15109
|
var CommentTriviaType;
|
|
15092
15110
|
(function(CommentTriviaType2) {
|
|
15093
15111
|
CommentTriviaType2["DIAGNOSTIC"] = "D";
|
|
@@ -15102,47 +15120,47 @@ var ExpressionIdentifier;
|
|
|
15102
15120
|
var IGNORE_FOR_DIAGNOSTICS_MARKER = `${CommentTriviaType.DIAGNOSTIC}:ignore`;
|
|
15103
15121
|
|
|
15104
15122
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/context.mjs
|
|
15105
|
-
import
|
|
15123
|
+
import ts93 from "typescript";
|
|
15106
15124
|
|
|
15107
15125
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/dom.mjs
|
|
15108
15126
|
import { DomElementSchemaRegistry as DomElementSchemaRegistry2 } from "@angular/compiler";
|
|
15109
|
-
import
|
|
15127
|
+
import ts80 from "typescript";
|
|
15110
15128
|
var REGISTRY = new DomElementSchemaRegistry2();
|
|
15111
15129
|
|
|
15112
15130
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/environment.mjs
|
|
15113
15131
|
import { ExpressionType, ExternalExpr as ExternalExpr9 } from "@angular/compiler";
|
|
15114
|
-
import
|
|
15132
|
+
import ts86 from "typescript";
|
|
15115
15133
|
|
|
15116
15134
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/ts_util.mjs
|
|
15117
|
-
import
|
|
15135
|
+
import ts81 from "typescript";
|
|
15118
15136
|
var SAFE_TO_CAST_WITHOUT_PARENS = new Set([
|
|
15119
|
-
|
|
15120
|
-
|
|
15121
|
-
|
|
15122
|
-
|
|
15123
|
-
|
|
15124
|
-
|
|
15125
|
-
|
|
15126
|
-
|
|
15127
|
-
|
|
15128
|
-
|
|
15129
|
-
|
|
15130
|
-
|
|
15131
|
-
|
|
15132
|
-
|
|
15137
|
+
ts81.SyntaxKind.ParenthesizedExpression,
|
|
15138
|
+
ts81.SyntaxKind.Identifier,
|
|
15139
|
+
ts81.SyntaxKind.CallExpression,
|
|
15140
|
+
ts81.SyntaxKind.NonNullExpression,
|
|
15141
|
+
ts81.SyntaxKind.ElementAccessExpression,
|
|
15142
|
+
ts81.SyntaxKind.PropertyAccessExpression,
|
|
15143
|
+
ts81.SyntaxKind.ArrayLiteralExpression,
|
|
15144
|
+
ts81.SyntaxKind.ObjectLiteralExpression,
|
|
15145
|
+
ts81.SyntaxKind.StringLiteral,
|
|
15146
|
+
ts81.SyntaxKind.NumericLiteral,
|
|
15147
|
+
ts81.SyntaxKind.TrueKeyword,
|
|
15148
|
+
ts81.SyntaxKind.FalseKeyword,
|
|
15149
|
+
ts81.SyntaxKind.NullKeyword,
|
|
15150
|
+
ts81.SyntaxKind.UndefinedKeyword
|
|
15133
15151
|
]);
|
|
15134
15152
|
|
|
15135
15153
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.mjs
|
|
15136
|
-
import
|
|
15154
|
+
import ts85 from "typescript";
|
|
15137
15155
|
|
|
15138
15156
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/tcb_util.mjs
|
|
15139
|
-
import
|
|
15157
|
+
import ts84 from "typescript";
|
|
15140
15158
|
|
|
15141
15159
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_parameter_emitter.mjs
|
|
15142
|
-
import
|
|
15160
|
+
import ts83 from "typescript";
|
|
15143
15161
|
|
|
15144
15162
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_emitter.mjs
|
|
15145
|
-
import
|
|
15163
|
+
import ts82 from "typescript";
|
|
15146
15164
|
|
|
15147
15165
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/tcb_util.mjs
|
|
15148
15166
|
var TcbInliningRequirement;
|
|
@@ -15154,47 +15172,47 @@ var TcbInliningRequirement;
|
|
|
15154
15172
|
|
|
15155
15173
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/oob.mjs
|
|
15156
15174
|
import { TmplAstElement as TmplAstElement2 } from "@angular/compiler";
|
|
15157
|
-
import
|
|
15175
|
+
import ts87 from "typescript";
|
|
15158
15176
|
|
|
15159
15177
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/shim.mjs
|
|
15160
|
-
import
|
|
15178
|
+
import ts88 from "typescript";
|
|
15161
15179
|
|
|
15162
15180
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.mjs
|
|
15163
15181
|
import { BindingPipe, Call as Call2, DYNAMIC_TYPE, ImplicitReceiver as ImplicitReceiver4, PropertyRead as PropertyRead2, PropertyWrite as PropertyWrite2, SafePropertyRead as SafePropertyRead3, ThisReceiver, TmplAstBoundAttribute, TmplAstBoundText, TmplAstElement as TmplAstElement3, TmplAstIcu, TmplAstReference as TmplAstReference3, TmplAstTemplate as TmplAstTemplate2, TmplAstTextAttribute as TmplAstTextAttribute2, TmplAstVariable as TmplAstVariable2 } from "@angular/compiler";
|
|
15164
|
-
import
|
|
15182
|
+
import ts91 from "typescript";
|
|
15165
15183
|
|
|
15166
15184
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/diagnostics.mjs
|
|
15167
15185
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan3 } from "@angular/compiler";
|
|
15168
|
-
import
|
|
15186
|
+
import ts89 from "typescript";
|
|
15169
15187
|
|
|
15170
15188
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/expression.mjs
|
|
15171
15189
|
import { ASTWithSource as ASTWithSource2, Call, EmptyExpr as EmptyExpr2, SafeKeyedRead, SafePropertyRead as SafePropertyRead2 } from "@angular/compiler";
|
|
15172
|
-
import
|
|
15173
|
-
var NULL_AS_ANY =
|
|
15174
|
-
var UNDEFINED =
|
|
15190
|
+
import ts90 from "typescript";
|
|
15191
|
+
var NULL_AS_ANY = ts90.createAsExpression(ts90.createNull(), ts90.createKeywordTypeNode(ts90.SyntaxKind.AnyKeyword));
|
|
15192
|
+
var UNDEFINED = ts90.createIdentifier("undefined");
|
|
15175
15193
|
var UNARY_OPS = new Map([
|
|
15176
|
-
["+",
|
|
15177
|
-
["-",
|
|
15194
|
+
["+", ts90.SyntaxKind.PlusToken],
|
|
15195
|
+
["-", ts90.SyntaxKind.MinusToken]
|
|
15178
15196
|
]);
|
|
15179
15197
|
var BINARY_OPS = new Map([
|
|
15180
|
-
["+",
|
|
15181
|
-
["-",
|
|
15182
|
-
["<",
|
|
15183
|
-
[">",
|
|
15184
|
-
["<=",
|
|
15185
|
-
[">=",
|
|
15186
|
-
["==",
|
|
15187
|
-
["===",
|
|
15188
|
-
["*",
|
|
15189
|
-
["/",
|
|
15190
|
-
["%",
|
|
15191
|
-
["!=",
|
|
15192
|
-
["!==",
|
|
15193
|
-
["||",
|
|
15194
|
-
["&&",
|
|
15195
|
-
["&",
|
|
15196
|
-
["|",
|
|
15197
|
-
["??",
|
|
15198
|
+
["+", ts90.SyntaxKind.PlusToken],
|
|
15199
|
+
["-", ts90.SyntaxKind.MinusToken],
|
|
15200
|
+
["<", ts90.SyntaxKind.LessThanToken],
|
|
15201
|
+
[">", ts90.SyntaxKind.GreaterThanToken],
|
|
15202
|
+
["<=", ts90.SyntaxKind.LessThanEqualsToken],
|
|
15203
|
+
[">=", ts90.SyntaxKind.GreaterThanEqualsToken],
|
|
15204
|
+
["==", ts90.SyntaxKind.EqualsEqualsToken],
|
|
15205
|
+
["===", ts90.SyntaxKind.EqualsEqualsEqualsToken],
|
|
15206
|
+
["*", ts90.SyntaxKind.AsteriskToken],
|
|
15207
|
+
["/", ts90.SyntaxKind.SlashToken],
|
|
15208
|
+
["%", ts90.SyntaxKind.PercentToken],
|
|
15209
|
+
["!=", ts90.SyntaxKind.ExclamationEqualsToken],
|
|
15210
|
+
["!==", ts90.SyntaxKind.ExclamationEqualsEqualsToken],
|
|
15211
|
+
["||", ts90.SyntaxKind.BarBarToken],
|
|
15212
|
+
["&&", ts90.SyntaxKind.AmpersandAmpersandToken],
|
|
15213
|
+
["&", ts90.SyntaxKind.AmpersandToken],
|
|
15214
|
+
["|", ts90.SyntaxKind.BarToken],
|
|
15215
|
+
["??", ts90.SyntaxKind.QuestionQuestionToken]
|
|
15198
15216
|
]);
|
|
15199
15217
|
var VeSafeLhsInferenceBugDetector = class {
|
|
15200
15218
|
static veWillInferAnyFor(ast) {
|
|
@@ -15277,10 +15295,10 @@ var TcbGenericContextBehavior;
|
|
|
15277
15295
|
TcbGenericContextBehavior2[TcbGenericContextBehavior2["CopyClassNodes"] = 1] = "CopyClassNodes";
|
|
15278
15296
|
TcbGenericContextBehavior2[TcbGenericContextBehavior2["FallbackToAny"] = 2] = "FallbackToAny";
|
|
15279
15297
|
})(TcbGenericContextBehavior || (TcbGenericContextBehavior = {}));
|
|
15280
|
-
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR =
|
|
15298
|
+
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR = ts91.createNonNullExpression(ts91.createNull());
|
|
15281
15299
|
|
|
15282
15300
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_file.mjs
|
|
15283
|
-
import
|
|
15301
|
+
import ts92 from "typescript";
|
|
15284
15302
|
|
|
15285
15303
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/context.mjs
|
|
15286
15304
|
var InliningMode;
|
|
@@ -15294,21 +15312,21 @@ import { ParseLocation as ParseLocation2, ParseSourceSpan as ParseSourceSpan2 }
|
|
|
15294
15312
|
|
|
15295
15313
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/template_symbol_builder.mjs
|
|
15296
15314
|
import { AST, ASTWithSource as ASTWithSource3, BindingPipe as BindingPipe2, PropertyRead as PropertyRead3, PropertyWrite as PropertyWrite3, SafePropertyRead as SafePropertyRead4, TmplAstBoundAttribute as TmplAstBoundAttribute2, TmplAstBoundEvent, TmplAstElement as TmplAstElement4, TmplAstReference as TmplAstReference4, TmplAstTemplate as TmplAstTemplate3, TmplAstTextAttribute as TmplAstTextAttribute3, TmplAstVariable as TmplAstVariable3 } from "@angular/compiler";
|
|
15297
|
-
import
|
|
15315
|
+
import ts94 from "typescript";
|
|
15298
15316
|
|
|
15299
15317
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/checker.mjs
|
|
15300
15318
|
var REGISTRY2 = new DomElementSchemaRegistry3();
|
|
15301
15319
|
|
|
15302
15320
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/invalid_banana_in_box/index.mjs
|
|
15303
15321
|
import { TmplAstBoundEvent as TmplAstBoundEvent2 } from "@angular/compiler";
|
|
15304
|
-
import
|
|
15322
|
+
import ts95 from "typescript";
|
|
15305
15323
|
|
|
15306
15324
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/api/api.mjs
|
|
15307
15325
|
import { ASTWithSource as ASTWithSource4, RecursiveAstVisitor as RecursiveAstVisitor3 } from "@angular/compiler";
|
|
15308
15326
|
|
|
15309
15327
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/nullish_coalescing_not_nullable/index.mjs
|
|
15310
15328
|
import { Binary } from "@angular/compiler";
|
|
15311
|
-
import
|
|
15329
|
+
import ts96 from "typescript";
|
|
15312
15330
|
|
|
15313
15331
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/compiler.mjs
|
|
15314
15332
|
var CompilationTicketKind;
|
|
@@ -15320,7 +15338,7 @@ var CompilationTicketKind;
|
|
|
15320
15338
|
|
|
15321
15339
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/program.mjs
|
|
15322
15340
|
import { HtmlParser, MessageBundle } from "@angular/compiler";
|
|
15323
|
-
import
|
|
15341
|
+
import ts100 from "typescript";
|
|
15324
15342
|
|
|
15325
15343
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/i18n.mjs
|
|
15326
15344
|
import { Xliff, Xliff2, Xmb } from "@angular/compiler";
|
|
@@ -15331,39 +15349,39 @@ import {
|
|
|
15331
15349
|
} from "path";
|
|
15332
15350
|
|
|
15333
15351
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/typescript_support.mjs
|
|
15334
|
-
import
|
|
15335
|
-
var tsVersion =
|
|
15352
|
+
import ts98 from "typescript";
|
|
15353
|
+
var tsVersion = ts98.version;
|
|
15336
15354
|
|
|
15337
15355
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/host.mjs
|
|
15338
|
-
import
|
|
15356
|
+
import ts99 from "typescript";
|
|
15339
15357
|
|
|
15340
15358
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/downlevel_decorators_transform/downlevel_decorators_transform.mjs
|
|
15341
|
-
import
|
|
15359
|
+
import ts102 from "typescript";
|
|
15342
15360
|
|
|
15343
15361
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/downlevel_decorators_transform/patch_alias_reference_resolution.mjs
|
|
15344
|
-
import
|
|
15362
|
+
import ts101 from "typescript";
|
|
15345
15363
|
var patchedReferencedAliasesSymbol = Symbol("patchedReferencedAliases");
|
|
15346
15364
|
|
|
15347
15365
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/inline_resources.mjs
|
|
15348
|
-
import
|
|
15366
|
+
import ts103 from "typescript";
|
|
15349
15367
|
|
|
15350
15368
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/lower_expressions.mjs
|
|
15351
15369
|
import { createLoweredSymbol, isLoweredSymbol } from "@angular/compiler";
|
|
15352
|
-
import
|
|
15370
|
+
import ts104 from "typescript";
|
|
15353
15371
|
|
|
15354
15372
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/metadata_cache.mjs
|
|
15355
|
-
import
|
|
15373
|
+
import ts105 from "typescript";
|
|
15356
15374
|
|
|
15357
15375
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/node_emitter_transform.mjs
|
|
15358
|
-
import
|
|
15376
|
+
import ts107 from "typescript";
|
|
15359
15377
|
|
|
15360
15378
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/node_emitter.mjs
|
|
15361
15379
|
import { BinaryOperator as BinaryOperator2, BuiltinMethod, BuiltinVar, ClassStmt, ExternalExpr as ExternalExpr10, Statement, StmtModifier as StmtModifier2, UnaryOperator as UnaryOperator2 } from "@angular/compiler";
|
|
15362
|
-
import
|
|
15380
|
+
import ts106 from "typescript";
|
|
15363
15381
|
|
|
15364
15382
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/r3_metadata_transform.mjs
|
|
15365
15383
|
import { ClassStmt as ClassStmt2, StmtModifier as StmtModifier3 } from "@angular/compiler";
|
|
15366
|
-
import
|
|
15384
|
+
import ts108 from "typescript";
|
|
15367
15385
|
|
|
15368
15386
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/program.mjs
|
|
15369
15387
|
var VE_DISABLED_MESSAGE = `
|
|
@@ -15392,7 +15410,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
15392
15410
|
var _a;
|
|
15393
15411
|
try {
|
|
15394
15412
|
const fs5 = getFileSystem();
|
|
15395
|
-
const readConfigFile = (configFile) =>
|
|
15413
|
+
const readConfigFile = (configFile) => ts110.readConfigFile(configFile, (file) => host.readFile(host.resolve(file)));
|
|
15396
15414
|
const readAngularCompilerOptions = (configFile, parentOptions = {}) => {
|
|
15397
15415
|
const { config: config2, error: error3 } = readConfigFile(configFile);
|
|
15398
15416
|
if (error3) {
|
|
@@ -15424,7 +15442,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
15424
15442
|
basePath
|
|
15425
15443
|
}, readAngularCompilerOptions(configFileName)), existingOptions);
|
|
15426
15444
|
const parseConfigHost = createParseConfigHost(host, fs5);
|
|
15427
|
-
const { options: options2, errors, fileNames: rootNames, projectReferences } =
|
|
15445
|
+
const { options: options2, errors, fileNames: rootNames, projectReferences } = ts110.parseJsonConfigFileContent(config, parseConfigHost, basePath, existingCompilerOptions, configFileName);
|
|
15428
15446
|
options2.enableIvy = !!((_a = options2.enableIvy) != null ? _a : true);
|
|
15429
15447
|
let emitFlags = EmitFlags.Default;
|
|
15430
15448
|
if (!(options2.skipMetadataEmit || options2.flatModuleOutFile)) {
|
|
@@ -15436,7 +15454,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
15436
15454
|
return { project: projectFile, rootNames, projectReferences, options: options2, errors, emitFlags };
|
|
15437
15455
|
} catch (e) {
|
|
15438
15456
|
const errors = [{
|
|
15439
|
-
category:
|
|
15457
|
+
category: ts110.DiagnosticCategory.Error,
|
|
15440
15458
|
messageText: e.stack,
|
|
15441
15459
|
file: void 0,
|
|
15442
15460
|
start: void 0,
|
|
@@ -15450,7 +15468,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
15450
15468
|
function createParseConfigHost(host, fs5 = getFileSystem()) {
|
|
15451
15469
|
return {
|
|
15452
15470
|
fileExists: host.exists.bind(host),
|
|
15453
|
-
readDirectory:
|
|
15471
|
+
readDirectory: ts110.sys.readDirectory,
|
|
15454
15472
|
readFile: host.readFile.bind(host),
|
|
15455
15473
|
useCaseSensitiveFileNames: fs5.isCaseSensitive()
|
|
15456
15474
|
};
|
|
@@ -15470,7 +15488,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs5) {
|
|
|
15470
15488
|
}
|
|
15471
15489
|
} else {
|
|
15472
15490
|
const parseConfigHost = createParseConfigHost(host, fs5);
|
|
15473
|
-
const { resolvedModule } =
|
|
15491
|
+
const { resolvedModule } = ts110.nodeModuleNameResolver(extendsValue, configFile, { moduleResolution: ts110.ModuleResolutionKind.NodeJs, resolveJsonModule: true }, parseConfigHost);
|
|
15474
15492
|
if (resolvedModule) {
|
|
15475
15493
|
return absoluteFrom(resolvedModule.resolvedFileName);
|
|
15476
15494
|
}
|