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