@angular/compiler-cli 17.3.0-next.0 → 17.3.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/{chunk-XLXSE3QH.js → chunk-6X7GQ6BQ.js} +214 -153
- package/bundles/{chunk-XLXSE3QH.js.map → chunk-6X7GQ6BQ.js.map} +3 -3
- package/bundles/{chunk-VPKIGOWE.js → chunk-E5DF5SRS.js} +4 -4
- package/bundles/{chunk-GWFFFWTW.js → chunk-FH3I22MY.js} +103 -69
- package/bundles/chunk-FH3I22MY.js.map +6 -0
- package/bundles/{chunk-JKNKVO7U.js → chunk-MNT5B5MH.js} +2 -2
- package/bundles/{chunk-NZQBYQYJ.js → chunk-Q4UHSSKO.js} +18 -18
- package/bundles/{chunk-NZQBYQYJ.js.map → chunk-Q4UHSSKO.js.map} +1 -1
- package/bundles/{chunk-OW77LBBK.js → chunk-WYZJV3LZ.js} +515 -484
- package/bundles/chunk-WYZJV3LZ.js.map +6 -0
- package/bundles/index.js +5 -5
- package/bundles/linker/babel/index.js +2 -2
- package/bundles/linker/index.js +2 -2
- package/bundles/private/migrations.js +2 -2
- package/bundles/private/tooling.js +3 -3
- package/bundles/src/bin/ng_xi18n.js +4 -4
- package/bundles/src/bin/ngc.js +4 -4
- package/bundles_metadata.json +1 -1
- package/linker/src/file_linker/partial_linkers/util.d.ts +2 -2
- package/package.json +3 -3
- package/src/ngtsc/annotations/component/src/handler.d.ts +3 -2
- package/src/ngtsc/annotations/directive/src/handler.d.ts +3 -2
- package/src/ngtsc/annotations/directive/src/initializer_functions.d.ts +10 -6
- package/src/ngtsc/annotations/directive/src/input_function.d.ts +2 -1
- package/src/ngtsc/annotations/directive/src/model_function.d.ts +2 -1
- package/src/ngtsc/annotations/directive/src/output_function.d.ts +2 -1
- package/src/ngtsc/annotations/directive/src/query_functions.d.ts +2 -1
- package/src/ngtsc/annotations/directive/src/shared.d.ts +2 -2
- package/src/ngtsc/core/src/feature_detection.d.ts +13 -0
- package/src/ngtsc/imports/index.d.ts +1 -0
- package/src/ngtsc/imports/src/imported_symbols_tracker.d.ts +37 -0
- package/src/ngtsc/reflection/index.d.ts +1 -1
- package/src/ngtsc/reflection/src/type_to_value.d.ts +1 -0
- package/src/transformers/jit_transforms/initializer_api_transforms/transform.d.ts +2 -1
- package/src/transformers/jit_transforms/initializer_api_transforms/transform_api.d.ts +3 -2
- package/bundles/chunk-GWFFFWTW.js.map +0 -6
- package/bundles/chunk-OW77LBBK.js.map +0 -6
- /package/bundles/{chunk-VPKIGOWE.js.map → chunk-E5DF5SRS.js.map} +0 -0
- /package/bundles/{chunk-JKNKVO7U.js.map → chunk-MNT5B5MH.js.map} +0 -0
|
@@ -1614,8 +1614,67 @@ var DeferredSymbolTracker = class {
|
|
|
1614
1614
|
}
|
|
1615
1615
|
};
|
|
1616
1616
|
|
|
1617
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/
|
|
1617
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/imported_symbols_tracker.mjs
|
|
1618
1618
|
import ts10 from "typescript";
|
|
1619
|
+
var ImportedSymbolsTracker = class {
|
|
1620
|
+
constructor() {
|
|
1621
|
+
this.fileToNamedImports = /* @__PURE__ */ new WeakMap();
|
|
1622
|
+
this.fileToNamespaceImports = /* @__PURE__ */ new WeakMap();
|
|
1623
|
+
}
|
|
1624
|
+
isPotentialReferenceToNamedImport(node, exportedName, moduleName) {
|
|
1625
|
+
const sourceFile = node.getSourceFile();
|
|
1626
|
+
this.scanImports(sourceFile);
|
|
1627
|
+
const fileImports = this.fileToNamedImports.get(sourceFile);
|
|
1628
|
+
const moduleImports = fileImports.get(moduleName);
|
|
1629
|
+
const symbolImports = moduleImports == null ? void 0 : moduleImports.get(exportedName);
|
|
1630
|
+
return symbolImports !== void 0 && symbolImports.has(node.text);
|
|
1631
|
+
}
|
|
1632
|
+
isPotentialReferenceToNamespaceImport(node, moduleName) {
|
|
1633
|
+
var _a, _b;
|
|
1634
|
+
const sourceFile = node.getSourceFile();
|
|
1635
|
+
this.scanImports(sourceFile);
|
|
1636
|
+
const namespaces = this.fileToNamespaceImports.get(sourceFile);
|
|
1637
|
+
return (_b = (_a = namespaces.get(moduleName)) == null ? void 0 : _a.has(node.text)) != null ? _b : false;
|
|
1638
|
+
}
|
|
1639
|
+
scanImports(sourceFile) {
|
|
1640
|
+
var _a, _b;
|
|
1641
|
+
if (this.fileToNamedImports.has(sourceFile) && this.fileToNamespaceImports.has(sourceFile)) {
|
|
1642
|
+
return;
|
|
1643
|
+
}
|
|
1644
|
+
const namedImports = /* @__PURE__ */ new Map();
|
|
1645
|
+
const namespaceImports = /* @__PURE__ */ new Map();
|
|
1646
|
+
this.fileToNamedImports.set(sourceFile, namedImports);
|
|
1647
|
+
this.fileToNamespaceImports.set(sourceFile, namespaceImports);
|
|
1648
|
+
for (const stmt of sourceFile.statements) {
|
|
1649
|
+
if (!ts10.isImportDeclaration(stmt) || !ts10.isStringLiteralLike(stmt.moduleSpecifier) || ((_a = stmt.importClause) == null ? void 0 : _a.namedBindings) === void 0) {
|
|
1650
|
+
continue;
|
|
1651
|
+
}
|
|
1652
|
+
const moduleName = stmt.moduleSpecifier.text;
|
|
1653
|
+
if (ts10.isNamespaceImport(stmt.importClause.namedBindings)) {
|
|
1654
|
+
if (!namespaceImports.has(moduleName)) {
|
|
1655
|
+
namespaceImports.set(moduleName, /* @__PURE__ */ new Set());
|
|
1656
|
+
}
|
|
1657
|
+
namespaceImports.get(moduleName).add(stmt.importClause.namedBindings.name.text);
|
|
1658
|
+
} else {
|
|
1659
|
+
for (const element of stmt.importClause.namedBindings.elements) {
|
|
1660
|
+
const localName = element.name.text;
|
|
1661
|
+
const exportedName = element.propertyName === void 0 ? localName : element.propertyName.text;
|
|
1662
|
+
if (!namedImports.has(moduleName)) {
|
|
1663
|
+
namedImports.set(moduleName, /* @__PURE__ */ new Map());
|
|
1664
|
+
}
|
|
1665
|
+
const localNames = namedImports.get(moduleName);
|
|
1666
|
+
if (!localNames.has(exportedName)) {
|
|
1667
|
+
localNames.set(exportedName, /* @__PURE__ */ new Set());
|
|
1668
|
+
}
|
|
1669
|
+
(_b = localNames.get(exportedName)) == null ? void 0 : _b.add(localName);
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
};
|
|
1675
|
+
|
|
1676
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/local_compilation_extra_imports_tracker.mjs
|
|
1677
|
+
import ts11 from "typescript";
|
|
1619
1678
|
var LocalCompilationExtraImportsTracker = class {
|
|
1620
1679
|
constructor(typeChecker) {
|
|
1621
1680
|
this.typeChecker = typeChecker;
|
|
@@ -1631,9 +1690,9 @@ var LocalCompilationExtraImportsTracker = class {
|
|
|
1631
1690
|
addGlobalImportFromIdentifier(node) {
|
|
1632
1691
|
var _a;
|
|
1633
1692
|
let identifier = null;
|
|
1634
|
-
if (
|
|
1693
|
+
if (ts11.isIdentifier(node)) {
|
|
1635
1694
|
identifier = node;
|
|
1636
|
-
} else if (
|
|
1695
|
+
} else if (ts11.isPropertyAccessExpression(node) && ts11.isIdentifier(node.expression)) {
|
|
1637
1696
|
identifier = node.expression;
|
|
1638
1697
|
}
|
|
1639
1698
|
if (identifier === null) {
|
|
@@ -1679,9 +1738,9 @@ var ModuleResolver = class {
|
|
|
1679
1738
|
};
|
|
1680
1739
|
|
|
1681
1740
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/import_manager.mjs
|
|
1682
|
-
import
|
|
1741
|
+
import ts12 from "typescript";
|
|
1683
1742
|
var ImportManager = class {
|
|
1684
|
-
constructor(rewriter = new NoopImportRewriter(), prefix = "i", factory =
|
|
1743
|
+
constructor(rewriter = new NoopImportRewriter(), prefix = "i", factory = ts12.factory) {
|
|
1685
1744
|
this.rewriter = rewriter;
|
|
1686
1745
|
this.prefix = prefix;
|
|
1687
1746
|
this.factory = factory;
|
|
@@ -1973,7 +2032,7 @@ function createRange(span) {
|
|
|
1973
2032
|
}
|
|
1974
2033
|
|
|
1975
2034
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/type_emitter.mjs
|
|
1976
|
-
import
|
|
2035
|
+
import ts13 from "typescript";
|
|
1977
2036
|
var INELIGIBLE = {};
|
|
1978
2037
|
function canEmitType(type, canEmit) {
|
|
1979
2038
|
return canEmitTypeWorker(type);
|
|
@@ -1981,13 +2040,13 @@ function canEmitType(type, canEmit) {
|
|
|
1981
2040
|
return visitNode(type2) !== INELIGIBLE;
|
|
1982
2041
|
}
|
|
1983
2042
|
function visitNode(node) {
|
|
1984
|
-
if (
|
|
2043
|
+
if (ts13.isImportTypeNode(node)) {
|
|
1985
2044
|
return INELIGIBLE;
|
|
1986
2045
|
}
|
|
1987
|
-
if (
|
|
2046
|
+
if (ts13.isTypeReferenceNode(node) && !canEmitTypeReference(node)) {
|
|
1988
2047
|
return INELIGIBLE;
|
|
1989
2048
|
} else {
|
|
1990
|
-
return
|
|
2049
|
+
return ts13.forEachChild(node, visitNode);
|
|
1991
2050
|
}
|
|
1992
2051
|
}
|
|
1993
2052
|
function canEmitTypeReference(type2) {
|
|
@@ -2004,35 +2063,35 @@ var TypeEmitter = class {
|
|
|
2004
2063
|
emitType(type) {
|
|
2005
2064
|
const typeReferenceTransformer = (context) => {
|
|
2006
2065
|
const visitNode = (node) => {
|
|
2007
|
-
if (
|
|
2066
|
+
if (ts13.isImportTypeNode(node)) {
|
|
2008
2067
|
throw new Error("Unable to emit import type");
|
|
2009
2068
|
}
|
|
2010
|
-
if (
|
|
2069
|
+
if (ts13.isTypeReferenceNode(node)) {
|
|
2011
2070
|
return this.emitTypeReference(node);
|
|
2012
|
-
} else if (
|
|
2071
|
+
} else if (ts13.isLiteralExpression(node)) {
|
|
2013
2072
|
let clone;
|
|
2014
|
-
if (
|
|
2015
|
-
clone =
|
|
2016
|
-
} else if (
|
|
2017
|
-
clone =
|
|
2018
|
-
} else if (
|
|
2019
|
-
clone =
|
|
2020
|
-
} else if (
|
|
2021
|
-
clone =
|
|
2022
|
-
} else if (
|
|
2023
|
-
clone =
|
|
2073
|
+
if (ts13.isStringLiteral(node)) {
|
|
2074
|
+
clone = ts13.factory.createStringLiteral(node.text);
|
|
2075
|
+
} else if (ts13.isNumericLiteral(node)) {
|
|
2076
|
+
clone = ts13.factory.createNumericLiteral(node.text);
|
|
2077
|
+
} else if (ts13.isBigIntLiteral(node)) {
|
|
2078
|
+
clone = ts13.factory.createBigIntLiteral(node.text);
|
|
2079
|
+
} else if (ts13.isNoSubstitutionTemplateLiteral(node)) {
|
|
2080
|
+
clone = ts13.factory.createNoSubstitutionTemplateLiteral(node.text, node.rawText);
|
|
2081
|
+
} else if (ts13.isRegularExpressionLiteral(node)) {
|
|
2082
|
+
clone = ts13.factory.createRegularExpressionLiteral(node.text);
|
|
2024
2083
|
} else {
|
|
2025
|
-
throw new Error(`Unsupported literal kind ${
|
|
2084
|
+
throw new Error(`Unsupported literal kind ${ts13.SyntaxKind[node.kind]}`);
|
|
2026
2085
|
}
|
|
2027
|
-
|
|
2086
|
+
ts13.setTextRange(clone, { pos: -1, end: -1 });
|
|
2028
2087
|
return clone;
|
|
2029
2088
|
} else {
|
|
2030
|
-
return
|
|
2089
|
+
return ts13.visitEachChild(node, visitNode, context);
|
|
2031
2090
|
}
|
|
2032
2091
|
};
|
|
2033
|
-
return (node) =>
|
|
2092
|
+
return (node) => ts13.visitNode(node, visitNode, ts13.isTypeNode);
|
|
2034
2093
|
};
|
|
2035
|
-
return
|
|
2094
|
+
return ts13.transform(type, [typeReferenceTransformer]).transformed[0];
|
|
2036
2095
|
}
|
|
2037
2096
|
emitTypeReference(type) {
|
|
2038
2097
|
const translatedType = this.translator(type);
|
|
@@ -2041,24 +2100,24 @@ var TypeEmitter = class {
|
|
|
2041
2100
|
}
|
|
2042
2101
|
let typeArguments = void 0;
|
|
2043
2102
|
if (type.typeArguments !== void 0) {
|
|
2044
|
-
typeArguments =
|
|
2103
|
+
typeArguments = ts13.factory.createNodeArray(type.typeArguments.map((typeArg) => this.emitType(typeArg)));
|
|
2045
2104
|
}
|
|
2046
|
-
return
|
|
2105
|
+
return ts13.factory.updateTypeReferenceNode(type, translatedType.typeName, typeArguments);
|
|
2047
2106
|
}
|
|
2048
2107
|
};
|
|
2049
2108
|
|
|
2050
2109
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/type_translator.mjs
|
|
2051
2110
|
import * as o2 from "@angular/compiler";
|
|
2052
|
-
import
|
|
2111
|
+
import ts15 from "typescript";
|
|
2053
2112
|
|
|
2054
2113
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/ts_util.mjs
|
|
2055
|
-
import
|
|
2114
|
+
import ts14 from "typescript";
|
|
2056
2115
|
function tsNumericExpression(value) {
|
|
2057
2116
|
if (value < 0) {
|
|
2058
|
-
const operand =
|
|
2059
|
-
return
|
|
2117
|
+
const operand = ts14.factory.createNumericLiteral(Math.abs(value));
|
|
2118
|
+
return ts14.factory.createPrefixUnaryExpression(ts14.SyntaxKind.MinusToken, operand);
|
|
2060
2119
|
}
|
|
2061
|
-
return
|
|
2120
|
+
return ts14.factory.createNumericLiteral(value);
|
|
2062
2121
|
}
|
|
2063
2122
|
|
|
2064
2123
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/type_translator.mjs
|
|
@@ -2075,16 +2134,16 @@ var TypeTranslatorVisitor = class {
|
|
|
2075
2134
|
visitBuiltinType(type, context) {
|
|
2076
2135
|
switch (type.name) {
|
|
2077
2136
|
case o2.BuiltinTypeName.Bool:
|
|
2078
|
-
return
|
|
2137
|
+
return ts15.factory.createKeywordTypeNode(ts15.SyntaxKind.BooleanKeyword);
|
|
2079
2138
|
case o2.BuiltinTypeName.Dynamic:
|
|
2080
|
-
return
|
|
2139
|
+
return ts15.factory.createKeywordTypeNode(ts15.SyntaxKind.AnyKeyword);
|
|
2081
2140
|
case o2.BuiltinTypeName.Int:
|
|
2082
2141
|
case o2.BuiltinTypeName.Number:
|
|
2083
|
-
return
|
|
2142
|
+
return ts15.factory.createKeywordTypeNode(ts15.SyntaxKind.NumberKeyword);
|
|
2084
2143
|
case o2.BuiltinTypeName.String:
|
|
2085
|
-
return
|
|
2144
|
+
return ts15.factory.createKeywordTypeNode(ts15.SyntaxKind.StringKeyword);
|
|
2086
2145
|
case o2.BuiltinTypeName.None:
|
|
2087
|
-
return
|
|
2146
|
+
return ts15.factory.createKeywordTypeNode(ts15.SyntaxKind.NeverKeyword);
|
|
2088
2147
|
default:
|
|
2089
2148
|
throw new Error(`Unsupported builtin type: ${o2.BuiltinTypeName[type.name]}`);
|
|
2090
2149
|
}
|
|
@@ -2094,26 +2153,26 @@ var TypeTranslatorVisitor = class {
|
|
|
2094
2153
|
if (type.typeParams === null) {
|
|
2095
2154
|
return typeNode;
|
|
2096
2155
|
}
|
|
2097
|
-
if (!
|
|
2156
|
+
if (!ts15.isTypeReferenceNode(typeNode)) {
|
|
2098
2157
|
throw new Error("An ExpressionType with type arguments must translate into a TypeReferenceNode");
|
|
2099
2158
|
} else if (typeNode.typeArguments !== void 0) {
|
|
2100
2159
|
throw new Error(`An ExpressionType with type arguments cannot have multiple levels of type arguments`);
|
|
2101
2160
|
}
|
|
2102
2161
|
const typeArgs = type.typeParams.map((param) => this.translateType(param, context));
|
|
2103
|
-
return
|
|
2162
|
+
return ts15.factory.createTypeReferenceNode(typeNode.typeName, typeArgs);
|
|
2104
2163
|
}
|
|
2105
2164
|
visitArrayType(type, context) {
|
|
2106
|
-
return
|
|
2165
|
+
return ts15.factory.createArrayTypeNode(this.translateType(type.of, context));
|
|
2107
2166
|
}
|
|
2108
2167
|
visitMapType(type, context) {
|
|
2109
|
-
const parameter =
|
|
2110
|
-
const typeArgs = type.valueType !== null ? this.translateType(type.valueType, context) :
|
|
2111
|
-
const indexSignature =
|
|
2112
|
-
return
|
|
2168
|
+
const parameter = ts15.factory.createParameterDeclaration(void 0, void 0, "key", void 0, ts15.factory.createKeywordTypeNode(ts15.SyntaxKind.StringKeyword));
|
|
2169
|
+
const typeArgs = type.valueType !== null ? this.translateType(type.valueType, context) : ts15.factory.createKeywordTypeNode(ts15.SyntaxKind.UnknownKeyword);
|
|
2170
|
+
const indexSignature = ts15.factory.createIndexSignature(void 0, [parameter], typeArgs);
|
|
2171
|
+
return ts15.factory.createTypeLiteralNode([indexSignature]);
|
|
2113
2172
|
}
|
|
2114
2173
|
visitTransplantedType(ast, context) {
|
|
2115
2174
|
const node = ast.type instanceof Reference ? ast.type.node : ast.type;
|
|
2116
|
-
if (!
|
|
2175
|
+
if (!ts15.isTypeNode(node)) {
|
|
2117
2176
|
throw new Error(`A TransplantedType must wrap a TypeNode`);
|
|
2118
2177
|
}
|
|
2119
2178
|
const viaModule = ast.type instanceof Reference ? ast.type.bestGuessOwningModule : null;
|
|
@@ -2124,7 +2183,7 @@ var TypeTranslatorVisitor = class {
|
|
|
2124
2183
|
if (ast.name === null) {
|
|
2125
2184
|
throw new Error(`ReadVarExpr with no variable name in type`);
|
|
2126
2185
|
}
|
|
2127
|
-
return
|
|
2186
|
+
return ts15.factory.createTypeQueryNode(ts15.factory.createIdentifier(ast.name));
|
|
2128
2187
|
}
|
|
2129
2188
|
visitWriteVarExpr(expr, context) {
|
|
2130
2189
|
throw new Error("Method not implemented.");
|
|
@@ -2146,15 +2205,15 @@ var TypeTranslatorVisitor = class {
|
|
|
2146
2205
|
}
|
|
2147
2206
|
visitLiteralExpr(ast, context) {
|
|
2148
2207
|
if (ast.value === null) {
|
|
2149
|
-
return
|
|
2208
|
+
return ts15.factory.createLiteralTypeNode(ts15.factory.createNull());
|
|
2150
2209
|
} else if (ast.value === void 0) {
|
|
2151
|
-
return
|
|
2210
|
+
return ts15.factory.createKeywordTypeNode(ts15.SyntaxKind.UndefinedKeyword);
|
|
2152
2211
|
} else if (typeof ast.value === "boolean") {
|
|
2153
|
-
return
|
|
2212
|
+
return ts15.factory.createLiteralTypeNode(ast.value ? ts15.factory.createTrue() : ts15.factory.createFalse());
|
|
2154
2213
|
} else if (typeof ast.value === "number") {
|
|
2155
|
-
return
|
|
2214
|
+
return ts15.factory.createLiteralTypeNode(tsNumericExpression(ast.value));
|
|
2156
2215
|
} else {
|
|
2157
|
-
return
|
|
2216
|
+
return ts15.factory.createLiteralTypeNode(ts15.factory.createStringLiteral(ast.value));
|
|
2158
2217
|
}
|
|
2159
2218
|
}
|
|
2160
2219
|
visitLocalizedString(ast, context) {
|
|
@@ -2165,10 +2224,10 @@ var TypeTranslatorVisitor = class {
|
|
|
2165
2224
|
throw new Error(`Import unknown module or symbol`);
|
|
2166
2225
|
}
|
|
2167
2226
|
const { moduleImport, symbol } = this.imports.generateNamedImport(ast.value.moduleName, ast.value.name);
|
|
2168
|
-
const symbolIdentifier =
|
|
2169
|
-
const typeName = moduleImport ?
|
|
2227
|
+
const symbolIdentifier = ts15.factory.createIdentifier(symbol);
|
|
2228
|
+
const typeName = moduleImport ? ts15.factory.createQualifiedName(moduleImport, symbolIdentifier) : symbolIdentifier;
|
|
2170
2229
|
const typeArguments = ast.typeParams !== null ? ast.typeParams.map((type) => this.translateType(type, context)) : void 0;
|
|
2171
|
-
return
|
|
2230
|
+
return ts15.factory.createTypeReferenceNode(typeName, typeArguments);
|
|
2172
2231
|
}
|
|
2173
2232
|
visitConditionalExpr(ast, context) {
|
|
2174
2233
|
throw new Error("Method not implemented.");
|
|
@@ -2199,60 +2258,60 @@ var TypeTranslatorVisitor = class {
|
|
|
2199
2258
|
}
|
|
2200
2259
|
visitLiteralArrayExpr(ast, context) {
|
|
2201
2260
|
const values = ast.entries.map((expr) => this.translateExpression(expr, context));
|
|
2202
|
-
return
|
|
2261
|
+
return ts15.factory.createTupleTypeNode(values);
|
|
2203
2262
|
}
|
|
2204
2263
|
visitLiteralMapExpr(ast, context) {
|
|
2205
2264
|
const entries = ast.entries.map((entry) => {
|
|
2206
2265
|
const { key, quoted } = entry;
|
|
2207
2266
|
const type = this.translateExpression(entry.value, context);
|
|
2208
|
-
return
|
|
2267
|
+
return ts15.factory.createPropertySignature(
|
|
2209
2268
|
void 0,
|
|
2210
|
-
quoted ?
|
|
2269
|
+
quoted ? ts15.factory.createStringLiteral(key) : key,
|
|
2211
2270
|
void 0,
|
|
2212
2271
|
type
|
|
2213
2272
|
);
|
|
2214
2273
|
});
|
|
2215
|
-
return
|
|
2274
|
+
return ts15.factory.createTypeLiteralNode(entries);
|
|
2216
2275
|
}
|
|
2217
2276
|
visitCommaExpr(ast, context) {
|
|
2218
2277
|
throw new Error("Method not implemented.");
|
|
2219
2278
|
}
|
|
2220
2279
|
visitWrappedNodeExpr(ast, context) {
|
|
2221
2280
|
const node = ast.node;
|
|
2222
|
-
if (
|
|
2223
|
-
return
|
|
2224
|
-
} else if (
|
|
2281
|
+
if (ts15.isEntityName(node)) {
|
|
2282
|
+
return ts15.factory.createTypeReferenceNode(node, void 0);
|
|
2283
|
+
} else if (ts15.isTypeNode(node)) {
|
|
2225
2284
|
return node;
|
|
2226
|
-
} else if (
|
|
2227
|
-
return
|
|
2285
|
+
} else if (ts15.isLiteralExpression(node)) {
|
|
2286
|
+
return ts15.factory.createLiteralTypeNode(node);
|
|
2228
2287
|
} else {
|
|
2229
|
-
throw new Error(`Unsupported WrappedNodeExpr in TypeTranslatorVisitor: ${
|
|
2288
|
+
throw new Error(`Unsupported WrappedNodeExpr in TypeTranslatorVisitor: ${ts15.SyntaxKind[node.kind]}`);
|
|
2230
2289
|
}
|
|
2231
2290
|
}
|
|
2232
2291
|
visitTypeofExpr(ast, context) {
|
|
2233
2292
|
const typeNode = this.translateExpression(ast.expr, context);
|
|
2234
|
-
if (!
|
|
2293
|
+
if (!ts15.isTypeReferenceNode(typeNode)) {
|
|
2235
2294
|
throw new Error(`The target of a typeof expression must be a type reference, but it was
|
|
2236
|
-
${
|
|
2295
|
+
${ts15.SyntaxKind[typeNode.kind]}`);
|
|
2237
2296
|
}
|
|
2238
|
-
return
|
|
2297
|
+
return ts15.factory.createTypeQueryNode(typeNode.typeName);
|
|
2239
2298
|
}
|
|
2240
2299
|
translateType(type, context) {
|
|
2241
2300
|
const typeNode = type.visitType(this, context);
|
|
2242
|
-
if (!
|
|
2243
|
-
throw new Error(`A Type must translate to a TypeNode, but was ${
|
|
2301
|
+
if (!ts15.isTypeNode(typeNode)) {
|
|
2302
|
+
throw new Error(`A Type must translate to a TypeNode, but was ${ts15.SyntaxKind[typeNode.kind]}`);
|
|
2244
2303
|
}
|
|
2245
2304
|
return typeNode;
|
|
2246
2305
|
}
|
|
2247
2306
|
translateExpression(expr, context) {
|
|
2248
2307
|
const typeNode = expr.visitExpression(this, context);
|
|
2249
|
-
if (!
|
|
2250
|
-
throw new Error(`An Expression must translate to a TypeNode, but was ${
|
|
2308
|
+
if (!ts15.isTypeNode(typeNode)) {
|
|
2309
|
+
throw new Error(`An Expression must translate to a TypeNode, but was ${ts15.SyntaxKind[typeNode.kind]}`);
|
|
2251
2310
|
}
|
|
2252
2311
|
return typeNode;
|
|
2253
2312
|
}
|
|
2254
2313
|
translateTypeReference(type, context, viaModule) {
|
|
2255
|
-
const target =
|
|
2314
|
+
const target = ts15.isIdentifier(type.typeName) ? type.typeName : type.typeName.right;
|
|
2256
2315
|
const declaration = this.reflector.getDeclarationOfIdentifier(target);
|
|
2257
2316
|
if (declaration === null) {
|
|
2258
2317
|
throw new Error(`Unable to statically determine the declaration file of type node ${target.text}`);
|
|
@@ -2268,79 +2327,79 @@ var TypeTranslatorVisitor = class {
|
|
|
2268
2327
|
const emittedType = this.refEmitter.emit(reference, this.contextFile, ImportFlags.NoAliasing | ImportFlags.AllowTypeImports | ImportFlags.AllowAmbientReferences);
|
|
2269
2328
|
assertSuccessfulReferenceEmit(emittedType, target, "type");
|
|
2270
2329
|
const typeNode = this.translateExpression(emittedType.expression, context);
|
|
2271
|
-
if (!
|
|
2272
|
-
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${
|
|
2330
|
+
if (!ts15.isTypeReferenceNode(typeNode)) {
|
|
2331
|
+
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${ts15.SyntaxKind[typeNode.kind]}.`);
|
|
2273
2332
|
}
|
|
2274
2333
|
return typeNode;
|
|
2275
2334
|
}
|
|
2276
2335
|
};
|
|
2277
2336
|
|
|
2278
2337
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/typescript_ast_factory.mjs
|
|
2279
|
-
import
|
|
2338
|
+
import ts16 from "typescript";
|
|
2280
2339
|
var PureAnnotation;
|
|
2281
2340
|
(function(PureAnnotation2) {
|
|
2282
2341
|
PureAnnotation2["CLOSURE"] = "* @pureOrBreakMyCode ";
|
|
2283
2342
|
PureAnnotation2["TERSER"] = "@__PURE__";
|
|
2284
2343
|
})(PureAnnotation || (PureAnnotation = {}));
|
|
2285
2344
|
var UNARY_OPERATORS2 = {
|
|
2286
|
-
"+":
|
|
2287
|
-
"-":
|
|
2288
|
-
"!":
|
|
2345
|
+
"+": ts16.SyntaxKind.PlusToken,
|
|
2346
|
+
"-": ts16.SyntaxKind.MinusToken,
|
|
2347
|
+
"!": ts16.SyntaxKind.ExclamationToken
|
|
2289
2348
|
};
|
|
2290
2349
|
var BINARY_OPERATORS2 = {
|
|
2291
|
-
"&&":
|
|
2292
|
-
">":
|
|
2293
|
-
">=":
|
|
2294
|
-
"&":
|
|
2295
|
-
"|":
|
|
2296
|
-
"/":
|
|
2297
|
-
"==":
|
|
2298
|
-
"===":
|
|
2299
|
-
"<":
|
|
2300
|
-
"<=":
|
|
2301
|
-
"-":
|
|
2302
|
-
"%":
|
|
2303
|
-
"*":
|
|
2304
|
-
"!=":
|
|
2305
|
-
"!==":
|
|
2306
|
-
"||":
|
|
2307
|
-
"+":
|
|
2308
|
-
"??":
|
|
2350
|
+
"&&": ts16.SyntaxKind.AmpersandAmpersandToken,
|
|
2351
|
+
">": ts16.SyntaxKind.GreaterThanToken,
|
|
2352
|
+
">=": ts16.SyntaxKind.GreaterThanEqualsToken,
|
|
2353
|
+
"&": ts16.SyntaxKind.AmpersandToken,
|
|
2354
|
+
"|": ts16.SyntaxKind.BarToken,
|
|
2355
|
+
"/": ts16.SyntaxKind.SlashToken,
|
|
2356
|
+
"==": ts16.SyntaxKind.EqualsEqualsToken,
|
|
2357
|
+
"===": ts16.SyntaxKind.EqualsEqualsEqualsToken,
|
|
2358
|
+
"<": ts16.SyntaxKind.LessThanToken,
|
|
2359
|
+
"<=": ts16.SyntaxKind.LessThanEqualsToken,
|
|
2360
|
+
"-": ts16.SyntaxKind.MinusToken,
|
|
2361
|
+
"%": ts16.SyntaxKind.PercentToken,
|
|
2362
|
+
"*": ts16.SyntaxKind.AsteriskToken,
|
|
2363
|
+
"!=": ts16.SyntaxKind.ExclamationEqualsToken,
|
|
2364
|
+
"!==": ts16.SyntaxKind.ExclamationEqualsEqualsToken,
|
|
2365
|
+
"||": ts16.SyntaxKind.BarBarToken,
|
|
2366
|
+
"+": ts16.SyntaxKind.PlusToken,
|
|
2367
|
+
"??": ts16.SyntaxKind.QuestionQuestionToken
|
|
2309
2368
|
};
|
|
2310
2369
|
var VAR_TYPES = {
|
|
2311
|
-
"const":
|
|
2312
|
-
"let":
|
|
2313
|
-
"var":
|
|
2370
|
+
"const": ts16.NodeFlags.Const,
|
|
2371
|
+
"let": ts16.NodeFlags.Let,
|
|
2372
|
+
"var": ts16.NodeFlags.None
|
|
2314
2373
|
};
|
|
2315
2374
|
var TypeScriptAstFactory = class {
|
|
2316
2375
|
constructor(annotateForClosureCompiler) {
|
|
2317
2376
|
this.annotateForClosureCompiler = annotateForClosureCompiler;
|
|
2318
2377
|
this.externalSourceFiles = /* @__PURE__ */ new Map();
|
|
2319
2378
|
this.attachComments = attachComments;
|
|
2320
|
-
this.createArrayLiteral =
|
|
2321
|
-
this.createElementAccess =
|
|
2322
|
-
this.createExpressionStatement =
|
|
2323
|
-
this.createIdentifier =
|
|
2324
|
-
this.createParenthesizedExpression =
|
|
2325
|
-
this.createPropertyAccess =
|
|
2326
|
-
this.createThrowStatement =
|
|
2327
|
-
this.createTypeOfExpression =
|
|
2379
|
+
this.createArrayLiteral = ts16.factory.createArrayLiteralExpression;
|
|
2380
|
+
this.createElementAccess = ts16.factory.createElementAccessExpression;
|
|
2381
|
+
this.createExpressionStatement = ts16.factory.createExpressionStatement;
|
|
2382
|
+
this.createIdentifier = ts16.factory.createIdentifier;
|
|
2383
|
+
this.createParenthesizedExpression = ts16.factory.createParenthesizedExpression;
|
|
2384
|
+
this.createPropertyAccess = ts16.factory.createPropertyAccessExpression;
|
|
2385
|
+
this.createThrowStatement = ts16.factory.createThrowStatement;
|
|
2386
|
+
this.createTypeOfExpression = ts16.factory.createTypeOfExpression;
|
|
2328
2387
|
}
|
|
2329
2388
|
createAssignment(target, value) {
|
|
2330
|
-
return
|
|
2389
|
+
return ts16.factory.createBinaryExpression(target, ts16.SyntaxKind.EqualsToken, value);
|
|
2331
2390
|
}
|
|
2332
2391
|
createBinaryExpression(leftOperand, operator, rightOperand) {
|
|
2333
|
-
return
|
|
2392
|
+
return ts16.factory.createBinaryExpression(leftOperand, BINARY_OPERATORS2[operator], rightOperand);
|
|
2334
2393
|
}
|
|
2335
2394
|
createBlock(body) {
|
|
2336
|
-
return
|
|
2395
|
+
return ts16.factory.createBlock(body);
|
|
2337
2396
|
}
|
|
2338
2397
|
createCallExpression(callee, args, pure) {
|
|
2339
|
-
const call =
|
|
2398
|
+
const call = ts16.factory.createCallExpression(callee, void 0, args);
|
|
2340
2399
|
if (pure) {
|
|
2341
|
-
|
|
2400
|
+
ts16.addSyntheticLeadingComment(
|
|
2342
2401
|
call,
|
|
2343
|
-
|
|
2402
|
+
ts16.SyntaxKind.MultiLineCommentTrivia,
|
|
2344
2403
|
this.annotateForClosureCompiler ? PureAnnotation.CLOSURE : PureAnnotation.TERSER,
|
|
2345
2404
|
false
|
|
2346
2405
|
);
|
|
@@ -2348,64 +2407,64 @@ var TypeScriptAstFactory = class {
|
|
|
2348
2407
|
return call;
|
|
2349
2408
|
}
|
|
2350
2409
|
createConditional(condition, whenTrue, whenFalse) {
|
|
2351
|
-
return
|
|
2410
|
+
return ts16.factory.createConditionalExpression(condition, void 0, whenTrue, void 0, whenFalse);
|
|
2352
2411
|
}
|
|
2353
2412
|
createDynamicImport(url) {
|
|
2354
|
-
return
|
|
2355
|
-
|
|
2413
|
+
return ts16.factory.createCallExpression(
|
|
2414
|
+
ts16.factory.createToken(ts16.SyntaxKind.ImportKeyword),
|
|
2356
2415
|
void 0,
|
|
2357
|
-
[
|
|
2416
|
+
[ts16.factory.createStringLiteral(url)]
|
|
2358
2417
|
);
|
|
2359
2418
|
}
|
|
2360
2419
|
createFunctionDeclaration(functionName, parameters, body) {
|
|
2361
|
-
if (!
|
|
2362
|
-
throw new Error(`Invalid syntax, expected a block, but got ${
|
|
2420
|
+
if (!ts16.isBlock(body)) {
|
|
2421
|
+
throw new Error(`Invalid syntax, expected a block, but got ${ts16.SyntaxKind[body.kind]}.`);
|
|
2363
2422
|
}
|
|
2364
|
-
return
|
|
2423
|
+
return ts16.factory.createFunctionDeclaration(void 0, void 0, functionName, void 0, parameters.map((param) => ts16.factory.createParameterDeclaration(void 0, void 0, param)), void 0, body);
|
|
2365
2424
|
}
|
|
2366
2425
|
createFunctionExpression(functionName, parameters, body) {
|
|
2367
|
-
if (!
|
|
2368
|
-
throw new Error(`Invalid syntax, expected a block, but got ${
|
|
2426
|
+
if (!ts16.isBlock(body)) {
|
|
2427
|
+
throw new Error(`Invalid syntax, expected a block, but got ${ts16.SyntaxKind[body.kind]}.`);
|
|
2369
2428
|
}
|
|
2370
|
-
return
|
|
2429
|
+
return ts16.factory.createFunctionExpression(void 0, void 0, functionName != null ? functionName : void 0, void 0, parameters.map((param) => ts16.factory.createParameterDeclaration(void 0, void 0, param)), void 0, body);
|
|
2371
2430
|
}
|
|
2372
2431
|
createArrowFunctionExpression(parameters, body) {
|
|
2373
|
-
if (
|
|
2374
|
-
throw new Error(`Invalid syntax, expected a block, but got ${
|
|
2432
|
+
if (ts16.isStatement(body) && !ts16.isBlock(body)) {
|
|
2433
|
+
throw new Error(`Invalid syntax, expected a block, but got ${ts16.SyntaxKind[body.kind]}.`);
|
|
2375
2434
|
}
|
|
2376
|
-
return
|
|
2435
|
+
return ts16.factory.createArrowFunction(void 0, void 0, parameters.map((param) => ts16.factory.createParameterDeclaration(void 0, void 0, param)), void 0, void 0, body);
|
|
2377
2436
|
}
|
|
2378
2437
|
createIfStatement(condition, thenStatement, elseStatement) {
|
|
2379
|
-
return
|
|
2438
|
+
return ts16.factory.createIfStatement(condition, thenStatement, elseStatement != null ? elseStatement : void 0);
|
|
2380
2439
|
}
|
|
2381
2440
|
createLiteral(value) {
|
|
2382
2441
|
if (value === void 0) {
|
|
2383
|
-
return
|
|
2442
|
+
return ts16.factory.createIdentifier("undefined");
|
|
2384
2443
|
} else if (value === null) {
|
|
2385
|
-
return
|
|
2444
|
+
return ts16.factory.createNull();
|
|
2386
2445
|
} else if (typeof value === "boolean") {
|
|
2387
|
-
return value ?
|
|
2446
|
+
return value ? ts16.factory.createTrue() : ts16.factory.createFalse();
|
|
2388
2447
|
} else if (typeof value === "number") {
|
|
2389
2448
|
return tsNumericExpression(value);
|
|
2390
2449
|
} else {
|
|
2391
|
-
return
|
|
2450
|
+
return ts16.factory.createStringLiteral(value);
|
|
2392
2451
|
}
|
|
2393
2452
|
}
|
|
2394
2453
|
createNewExpression(expression, args) {
|
|
2395
|
-
return
|
|
2454
|
+
return ts16.factory.createNewExpression(expression, void 0, args);
|
|
2396
2455
|
}
|
|
2397
2456
|
createObjectLiteral(properties) {
|
|
2398
|
-
return
|
|
2457
|
+
return ts16.factory.createObjectLiteralExpression(properties.map((prop) => ts16.factory.createPropertyAssignment(prop.quoted ? ts16.factory.createStringLiteral(prop.propertyName) : ts16.factory.createIdentifier(prop.propertyName), prop.value)));
|
|
2399
2458
|
}
|
|
2400
2459
|
createReturnStatement(expression) {
|
|
2401
|
-
return
|
|
2460
|
+
return ts16.factory.createReturnStatement(expression != null ? expression : void 0);
|
|
2402
2461
|
}
|
|
2403
2462
|
createTaggedTemplate(tag, template) {
|
|
2404
2463
|
let templateLiteral;
|
|
2405
2464
|
const length = template.elements.length;
|
|
2406
2465
|
const head = template.elements[0];
|
|
2407
2466
|
if (length === 1) {
|
|
2408
|
-
templateLiteral =
|
|
2467
|
+
templateLiteral = ts16.factory.createNoSubstitutionTemplateLiteral(head.cooked, head.raw);
|
|
2409
2468
|
} else {
|
|
2410
2469
|
const spans = [];
|
|
2411
2470
|
for (let i = 1; i < length - 1; i++) {
|
|
@@ -2414,7 +2473,7 @@ var TypeScriptAstFactory = class {
|
|
|
2414
2473
|
if (range !== null) {
|
|
2415
2474
|
this.setSourceMapRange(middle, range);
|
|
2416
2475
|
}
|
|
2417
|
-
spans.push(
|
|
2476
|
+
spans.push(ts16.factory.createTemplateSpan(template.expressions[i - 1], middle));
|
|
2418
2477
|
}
|
|
2419
2478
|
const resolvedExpression = template.expressions[length - 2];
|
|
2420
2479
|
const templatePart = template.elements[length - 1];
|
|
@@ -2422,19 +2481,19 @@ var TypeScriptAstFactory = class {
|
|
|
2422
2481
|
if (templatePart.range !== null) {
|
|
2423
2482
|
this.setSourceMapRange(templateTail, templatePart.range);
|
|
2424
2483
|
}
|
|
2425
|
-
spans.push(
|
|
2426
|
-
templateLiteral =
|
|
2484
|
+
spans.push(ts16.factory.createTemplateSpan(resolvedExpression, templateTail));
|
|
2485
|
+
templateLiteral = ts16.factory.createTemplateExpression(ts16.factory.createTemplateHead(head.cooked, head.raw), spans);
|
|
2427
2486
|
}
|
|
2428
2487
|
if (head.range !== null) {
|
|
2429
2488
|
this.setSourceMapRange(templateLiteral, head.range);
|
|
2430
2489
|
}
|
|
2431
|
-
return
|
|
2490
|
+
return ts16.factory.createTaggedTemplateExpression(tag, void 0, templateLiteral);
|
|
2432
2491
|
}
|
|
2433
2492
|
createUnaryExpression(operator, operand) {
|
|
2434
|
-
return
|
|
2493
|
+
return ts16.factory.createPrefixUnaryExpression(UNARY_OPERATORS2[operator], operand);
|
|
2435
2494
|
}
|
|
2436
2495
|
createVariableDeclaration(variableName, initializer, type) {
|
|
2437
|
-
return
|
|
2496
|
+
return ts16.factory.createVariableStatement(void 0, ts16.factory.createVariableDeclarationList([ts16.factory.createVariableDeclaration(variableName, void 0, void 0, initializer != null ? initializer : void 0)], VAR_TYPES[type]));
|
|
2438
2497
|
}
|
|
2439
2498
|
setSourceMapRange(node, sourceMapRange) {
|
|
2440
2499
|
if (sourceMapRange === null) {
|
|
@@ -2442,31 +2501,31 @@ var TypeScriptAstFactory = class {
|
|
|
2442
2501
|
}
|
|
2443
2502
|
const url = sourceMapRange.url;
|
|
2444
2503
|
if (!this.externalSourceFiles.has(url)) {
|
|
2445
|
-
this.externalSourceFiles.set(url,
|
|
2504
|
+
this.externalSourceFiles.set(url, ts16.createSourceMapSource(url, sourceMapRange.content, (pos) => pos));
|
|
2446
2505
|
}
|
|
2447
2506
|
const source = this.externalSourceFiles.get(url);
|
|
2448
|
-
|
|
2507
|
+
ts16.setSourceMapRange(node, { pos: sourceMapRange.start.offset, end: sourceMapRange.end.offset, source });
|
|
2449
2508
|
return node;
|
|
2450
2509
|
}
|
|
2451
2510
|
};
|
|
2452
2511
|
function createTemplateMiddle(cooked, raw) {
|
|
2453
|
-
const node =
|
|
2454
|
-
node.kind =
|
|
2512
|
+
const node = ts16.factory.createTemplateHead(cooked, raw);
|
|
2513
|
+
node.kind = ts16.SyntaxKind.TemplateMiddle;
|
|
2455
2514
|
return node;
|
|
2456
2515
|
}
|
|
2457
2516
|
function createTemplateTail(cooked, raw) {
|
|
2458
|
-
const node =
|
|
2459
|
-
node.kind =
|
|
2517
|
+
const node = ts16.factory.createTemplateHead(cooked, raw);
|
|
2518
|
+
node.kind = ts16.SyntaxKind.TemplateTail;
|
|
2460
2519
|
return node;
|
|
2461
2520
|
}
|
|
2462
2521
|
function attachComments(statement, leadingComments) {
|
|
2463
2522
|
for (const comment of leadingComments) {
|
|
2464
|
-
const commentKind = comment.multiline ?
|
|
2523
|
+
const commentKind = comment.multiline ? ts16.SyntaxKind.MultiLineCommentTrivia : ts16.SyntaxKind.SingleLineCommentTrivia;
|
|
2465
2524
|
if (comment.multiline) {
|
|
2466
|
-
|
|
2525
|
+
ts16.addSyntheticLeadingComment(statement, commentKind, comment.toString(), comment.trailingNewline);
|
|
2467
2526
|
} else {
|
|
2468
2527
|
for (const line of comment.toString().split("\n")) {
|
|
2469
|
-
|
|
2528
|
+
ts16.addSyntheticLeadingComment(statement, commentKind, line, comment.trailingNewline);
|
|
2470
2529
|
}
|
|
2471
2530
|
}
|
|
2472
2531
|
}
|
|
@@ -2531,12 +2590,14 @@ export {
|
|
|
2531
2590
|
ClassMemberKind,
|
|
2532
2591
|
AmbientImport,
|
|
2533
2592
|
typeNodeToValueExpr,
|
|
2593
|
+
entityNameToValue,
|
|
2534
2594
|
isNamedClassDeclaration,
|
|
2535
2595
|
TypeScriptReflectionHost,
|
|
2536
2596
|
reflectTypeEntityToDeclaration,
|
|
2537
2597
|
filterToMembersWithDecorator,
|
|
2538
2598
|
reflectObjectLiteral,
|
|
2539
2599
|
DeferredSymbolTracker,
|
|
2600
|
+
ImportedSymbolsTracker,
|
|
2540
2601
|
LocalCompilationExtraImportsTracker,
|
|
2541
2602
|
Reference,
|
|
2542
2603
|
ModuleResolver,
|
|
@@ -2563,4 +2624,4 @@ export {
|
|
|
2563
2624
|
* Use of this source code is governed by an MIT-style license that can be
|
|
2564
2625
|
* found in the LICENSE file at https://angular.io/license
|
|
2565
2626
|
*/
|
|
2566
|
-
//# sourceMappingURL=chunk-
|
|
2627
|
+
//# sourceMappingURL=chunk-6X7GQ6BQ.js.map
|