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