@angular/compiler-cli 17.1.0-next.5 → 17.1.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-EFMKZSXJ.js → chunk-3WRR7A6G.js} +876 -34
- package/bundles/chunk-3WRR7A6G.js.map +6 -0
- package/bundles/{chunk-BLWWEEEL.js → chunk-5KZ4IU2X.js} +5 -5
- package/bundles/{chunk-SBDNBITT.js → chunk-CF2CT7RQ.js} +3 -3
- package/bundles/{chunk-U4EFDEE4.js → chunk-GM44CTB7.js} +497 -320
- package/bundles/chunk-GM44CTB7.js.map +6 -0
- package/bundles/{chunk-QPMYDNZG.js → chunk-I3M5LXMW.js} +7 -7
- package/bundles/{chunk-R4KQI5XI.js → chunk-JOIB3454.js} +5 -5
- package/bundles/{chunk-YGXKICXB.js → chunk-MLI2QFE3.js} +94 -11
- package/bundles/chunk-MLI2QFE3.js.map +6 -0
- package/bundles/{chunk-OZXTEOXW.js → chunk-P34DHQ65.js} +50 -30
- package/bundles/chunk-P34DHQ65.js.map +6 -0
- package/bundles/chunk-TGR3NXO6.js +62 -0
- package/bundles/chunk-TGR3NXO6.js.map +6 -0
- package/bundles/{chunk-WCD6LVCP.js → chunk-WMUBJYYX.js} +7 -7
- package/bundles/{chunk-N5SJSJNW.js → chunk-YFIBJR5K.js} +203 -149
- package/bundles/chunk-YFIBJR5K.js.map +6 -0
- package/bundles/index.js +14 -12
- package/bundles/index.js.map +1 -1
- package/bundles/linker/babel/index.js +15 -13
- package/bundles/linker/babel/index.js.map +1 -1
- package/bundles/linker/index.js +4 -5
- package/bundles/ngcc/index.js +1 -1
- package/bundles/private/bazel.js +1 -1
- package/bundles/private/localize.js +3 -3
- package/bundles/private/migrations.js +8 -7
- package/bundles/private/tooling.js +7 -3
- package/bundles/src/bin/ng_xi18n.js +10 -10
- package/bundles/src/bin/ngc.js +8 -8
- package/bundles_metadata.json +1 -1
- package/linker/babel/src/ast/babel_ast_host.d.ts +1 -0
- package/linker/src/ast/ast_host.d.ts +4 -0
- package/linker/src/ast/ast_value.d.ts +8 -1
- package/linker/src/ast/typescript/typescript_ast_host.d.ts +1 -0
- package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
- package/package.json +2 -2
- package/private/tooling.d.ts +22 -6
- package/src/ngtsc/annotations/component/src/handler.d.ts +21 -1
- package/src/ngtsc/annotations/component/src/metadata.d.ts +7 -1
- package/src/ngtsc/annotations/component/src/util.d.ts +1 -1
- package/src/ngtsc/annotations/directive/index.d.ts +1 -0
- package/src/ngtsc/annotations/directive/src/handler.d.ts +1 -1
- package/src/ngtsc/annotations/directive/src/input_function.d.ts +4 -13
- package/src/ngtsc/annotations/directive/src/shared.d.ts +2 -2
- package/src/ngtsc/annotations/index.d.ts +2 -2
- package/src/ngtsc/annotations/src/injectable.d.ts +1 -1
- package/src/ngtsc/core/api/src/public_options.d.ts +10 -0
- package/src/ngtsc/diagnostics/src/error_code.d.ts +26 -0
- package/src/ngtsc/imports/src/deferred_symbol_tracker.d.ts +16 -2
- package/src/ngtsc/metadata/src/api.d.ts +11 -0
- package/src/ngtsc/scope/src/api.d.ts +1 -0
- package/src/ngtsc/scope/src/typecheck.d.ts +3 -3
- package/src/ngtsc/scope/src/util.d.ts +1 -0
- package/src/ngtsc/transform/index.d.ts +1 -0
- package/src/ngtsc/transform/src/api.d.ts +1 -1
- package/src/ngtsc/transform/src/utils.d.ts +1 -1
- package/src/ngtsc/translator/src/api/ast_factory.d.ts +1 -1
- package/src/ngtsc/translator/src/import_manager.d.ts +2 -1
- package/src/ngtsc/typecheck/api/api.d.ts +3 -2
- package/src/ngtsc/typecheck/api/context.d.ts +2 -1
- package/src/ngtsc/typecheck/src/context.d.ts +2 -1
- package/src/ngtsc/typecheck/src/oob.d.ts +20 -0
- package/src/ngtsc/typecheck/src/tcb_util.d.ts +1 -1
- package/src/ngtsc/typecheck/src/type_check_block.d.ts +3 -2
- package/src/transformers/{downlevel_decorators_transform → jit_transforms}/index.d.ts +1 -0
- package/src/transformers/jit_transforms/signal_inputs_metadata_transform.d.ts +21 -0
- package/bundles/chunk-EFMKZSXJ.js.map +0 -6
- package/bundles/chunk-MFE4YVWE.js +0 -831
- package/bundles/chunk-MFE4YVWE.js.map +0 -6
- package/bundles/chunk-N5SJSJNW.js.map +0 -6
- package/bundles/chunk-OZXTEOXW.js.map +0 -6
- package/bundles/chunk-U4EFDEE4.js.map +0 -6
- package/bundles/chunk-YGXKICXB.js.map +0 -6
- /package/bundles/{chunk-BLWWEEEL.js.map → chunk-5KZ4IU2X.js.map} +0 -0
- /package/bundles/{chunk-SBDNBITT.js.map → chunk-CF2CT7RQ.js.map} +0 -0
- /package/bundles/{chunk-QPMYDNZG.js.map → chunk-I3M5LXMW.js.map} +0 -0
- /package/bundles/{chunk-R4KQI5XI.js.map → chunk-JOIB3454.js.map} +0 -0
- /package/bundles/{chunk-WCD6LVCP.js.map → chunk-WMUBJYYX.js.map} +0 -0
- /package/src/transformers/{downlevel_decorators_transform → jit_transforms}/downlevel_decorators_transform.d.ts +0 -0
|
@@ -12,12 +12,12 @@ import {
|
|
|
12
12
|
resolve,
|
|
13
13
|
stripExtension,
|
|
14
14
|
toRelativeImport
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-I3M5LXMW.js";
|
|
16
16
|
|
|
17
|
-
// bazel-out/
|
|
17
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/typescript.mjs
|
|
18
18
|
import ts4 from "typescript";
|
|
19
19
|
|
|
20
|
-
// bazel-out/
|
|
20
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/host.mjs
|
|
21
21
|
import ts from "typescript";
|
|
22
22
|
function isDecoratorIdentifier(exp) {
|
|
23
23
|
return ts.isIdentifier(exp) || ts.isPropertyAccessExpression(exp) && ts.isIdentifier(exp.expression) && ts.isIdentifier(exp.name);
|
|
@@ -32,7 +32,7 @@ var ClassMemberKind;
|
|
|
32
32
|
})(ClassMemberKind || (ClassMemberKind = {}));
|
|
33
33
|
var AmbientImport = {};
|
|
34
34
|
|
|
35
|
-
// bazel-out/
|
|
35
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/type_to_value.mjs
|
|
36
36
|
import ts2 from "typescript";
|
|
37
37
|
function typeToValue(typeNode, checker, isLocalCompilation) {
|
|
38
38
|
var _a, _b;
|
|
@@ -205,7 +205,7 @@ function extractModuleName(node) {
|
|
|
205
205
|
return node.moduleSpecifier.text;
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
-
// bazel-out/
|
|
208
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/util.mjs
|
|
209
209
|
import ts3 from "typescript";
|
|
210
210
|
function isNamedClassDeclaration(node) {
|
|
211
211
|
return ts3.isClassDeclaration(node) && isIdentifier(node.name);
|
|
@@ -214,7 +214,7 @@ function isIdentifier(node) {
|
|
|
214
214
|
return node !== void 0 && ts3.isIdentifier(node);
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
// bazel-out/
|
|
217
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/typescript.mjs
|
|
218
218
|
var TypeScriptReflectionHost = class {
|
|
219
219
|
constructor(checker, isLocalCompilation = false) {
|
|
220
220
|
this.checker = checker;
|
|
@@ -654,7 +654,7 @@ function getExportedName(decl, originalId) {
|
|
|
654
654
|
}
|
|
655
655
|
var LocalExportedDeclarations = Symbol("LocalExportedDeclarations");
|
|
656
656
|
|
|
657
|
-
// bazel-out/
|
|
657
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/util/src/typescript.mjs
|
|
658
658
|
import ts5 from "typescript";
|
|
659
659
|
var TS = /\.tsx?$/i;
|
|
660
660
|
var D_TS = /\.d\.ts$/i;
|
|
@@ -755,7 +755,7 @@ function toUnredirectedSourceFile(sf) {
|
|
|
755
755
|
return redirectInfo.unredirected;
|
|
756
756
|
}
|
|
757
757
|
|
|
758
|
-
// bazel-out/
|
|
758
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/references.mjs
|
|
759
759
|
var Reference = class {
|
|
760
760
|
constructor(node, bestGuessOwningModule = null) {
|
|
761
761
|
this.node = node;
|
|
@@ -824,14 +824,14 @@ var Reference = class {
|
|
|
824
824
|
}
|
|
825
825
|
};
|
|
826
826
|
|
|
827
|
-
// bazel-out/
|
|
827
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/alias.mjs
|
|
828
828
|
import { ExternalExpr as ExternalExpr2 } from "@angular/compiler";
|
|
829
829
|
|
|
830
|
-
// bazel-out/
|
|
830
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/emitter.mjs
|
|
831
831
|
import { ExternalExpr, ExternalReference, WrappedNodeExpr } from "@angular/compiler";
|
|
832
832
|
import ts7 from "typescript";
|
|
833
833
|
|
|
834
|
-
// bazel-out/
|
|
834
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/error_code.mjs
|
|
835
835
|
var ErrorCode;
|
|
836
836
|
(function(ErrorCode2) {
|
|
837
837
|
ErrorCode2[ErrorCode2["DECORATOR_ARG_NOT_LITERAL"] = 1001] = "DECORATOR_ARG_NOT_LITERAL";
|
|
@@ -841,6 +841,9 @@ var ErrorCode;
|
|
|
841
841
|
ErrorCode2[ErrorCode2["DECORATOR_COLLISION"] = 1006] = "DECORATOR_COLLISION";
|
|
842
842
|
ErrorCode2[ErrorCode2["VALUE_HAS_WRONG_TYPE"] = 1010] = "VALUE_HAS_WRONG_TYPE";
|
|
843
843
|
ErrorCode2[ErrorCode2["VALUE_NOT_LITERAL"] = 1011] = "VALUE_NOT_LITERAL";
|
|
844
|
+
ErrorCode2[ErrorCode2["SIGNAL_INPUT_AND_DISALLOWED_DECORATOR"] = 1050] = "SIGNAL_INPUT_AND_DISALLOWED_DECORATOR";
|
|
845
|
+
ErrorCode2[ErrorCode2["SIGNAL_INPUT_AND_INPUTS_ARRAY_COLLISION"] = 1051] = "SIGNAL_INPUT_AND_INPUTS_ARRAY_COLLISION";
|
|
846
|
+
ErrorCode2[ErrorCode2["INPUT_DECLARED_ON_STATIC_MEMBER"] = 1100] = "INPUT_DECLARED_ON_STATIC_MEMBER";
|
|
844
847
|
ErrorCode2[ErrorCode2["COMPONENT_MISSING_TEMPLATE"] = 2001] = "COMPONENT_MISSING_TEMPLATE";
|
|
845
848
|
ErrorCode2[ErrorCode2["PIPE_MISSING_NAME"] = 2002] = "PIPE_MISSING_NAME";
|
|
846
849
|
ErrorCode2[ErrorCode2["PARAM_MISSING_TOKEN"] = 2003] = "PARAM_MISSING_TOKEN";
|
|
@@ -862,6 +865,7 @@ var ErrorCode;
|
|
|
862
865
|
ErrorCode2[ErrorCode2["HOST_DIRECTIVE_MISSING_REQUIRED_BINDING"] = 2019] = "HOST_DIRECTIVE_MISSING_REQUIRED_BINDING";
|
|
863
866
|
ErrorCode2[ErrorCode2["CONFLICTING_INPUT_TRANSFORM"] = 2020] = "CONFLICTING_INPUT_TRANSFORM";
|
|
864
867
|
ErrorCode2[ErrorCode2["COMPONENT_INVALID_STYLE_URLS"] = 2021] = "COMPONENT_INVALID_STYLE_URLS";
|
|
868
|
+
ErrorCode2[ErrorCode2["COMPONENT_UNKNOWN_DEFERRED_IMPORT"] = 2022] = "COMPONENT_UNKNOWN_DEFERRED_IMPORT";
|
|
865
869
|
ErrorCode2[ErrorCode2["SYMBOL_NOT_EXPORTED"] = 3001] = "SYMBOL_NOT_EXPORTED";
|
|
866
870
|
ErrorCode2[ErrorCode2["IMPORT_CYCLE_DETECTED"] = 3003] = "IMPORT_CYCLE_DETECTED";
|
|
867
871
|
ErrorCode2[ErrorCode2["IMPORT_GENERATION_FAILURE"] = 3004] = "IMPORT_GENERATION_FAILURE";
|
|
@@ -893,6 +897,9 @@ var ErrorCode;
|
|
|
893
897
|
ErrorCode2[ErrorCode2["ILLEGAL_FOR_LOOP_TRACK_ACCESS"] = 8009] = "ILLEGAL_FOR_LOOP_TRACK_ACCESS";
|
|
894
898
|
ErrorCode2[ErrorCode2["INACCESSIBLE_DEFERRED_TRIGGER_ELEMENT"] = 8010] = "INACCESSIBLE_DEFERRED_TRIGGER_ELEMENT";
|
|
895
899
|
ErrorCode2[ErrorCode2["CONTROL_FLOW_PREVENTING_CONTENT_PROJECTION"] = 8011] = "CONTROL_FLOW_PREVENTING_CONTENT_PROJECTION";
|
|
900
|
+
ErrorCode2[ErrorCode2["DEFERRED_PIPE_USED_EAGERLY"] = 8012] = "DEFERRED_PIPE_USED_EAGERLY";
|
|
901
|
+
ErrorCode2[ErrorCode2["DEFERRED_DIRECTIVE_USED_EAGERLY"] = 8013] = "DEFERRED_DIRECTIVE_USED_EAGERLY";
|
|
902
|
+
ErrorCode2[ErrorCode2["DEFERRED_DEPENDENCY_IMPORTED_EAGERLY"] = 8014] = "DEFERRED_DEPENDENCY_IMPORTED_EAGERLY";
|
|
896
903
|
ErrorCode2[ErrorCode2["INVALID_BANANA_IN_BOX"] = 8101] = "INVALID_BANANA_IN_BOX";
|
|
897
904
|
ErrorCode2[ErrorCode2["NULLISH_COALESCING_NOT_NULLABLE"] = 8102] = "NULLISH_COALESCING_NOT_NULLABLE";
|
|
898
905
|
ErrorCode2[ErrorCode2["MISSING_CONTROL_FLOW_DIRECTIVE"] = 8103] = "MISSING_CONTROL_FLOW_DIRECTIVE";
|
|
@@ -911,7 +918,7 @@ var ErrorCode;
|
|
|
911
918
|
ErrorCode2[ErrorCode2["LOCAL_COMPILATION_IMPORTED_STYLES_STRING"] = 11002] = "LOCAL_COMPILATION_IMPORTED_STYLES_STRING";
|
|
912
919
|
})(ErrorCode || (ErrorCode = {}));
|
|
913
920
|
|
|
914
|
-
// bazel-out/
|
|
921
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/docs.mjs
|
|
915
922
|
var COMPILER_ERRORS_WITH_GUIDES = /* @__PURE__ */ new Set([
|
|
916
923
|
ErrorCode.DECORATOR_ARG_NOT_LITERAL,
|
|
917
924
|
ErrorCode.IMPORT_CYCLE_DETECTED,
|
|
@@ -923,10 +930,10 @@ var COMPILER_ERRORS_WITH_GUIDES = /* @__PURE__ */ new Set([
|
|
|
923
930
|
ErrorCode.WARN_NGMODULE_ID_UNNECESSARY
|
|
924
931
|
]);
|
|
925
932
|
|
|
926
|
-
// bazel-out/
|
|
933
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/error.mjs
|
|
927
934
|
import ts6 from "typescript";
|
|
928
935
|
|
|
929
|
-
// bazel-out/
|
|
936
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/util.mjs
|
|
930
937
|
var ERROR_CODE_MATCHER = /(\u001b\[\d+m ?)TS-99(\d+: ?\u001b\[\d+m)/g;
|
|
931
938
|
function replaceTsWithNgInErrors(errors) {
|
|
932
939
|
return errors.replace(ERROR_CODE_MATCHER, "$1NG$2");
|
|
@@ -935,7 +942,7 @@ function ngErrorCode(code) {
|
|
|
935
942
|
return parseInt("-99" + code);
|
|
936
943
|
}
|
|
937
944
|
|
|
938
|
-
// bazel-out/
|
|
945
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/error.mjs
|
|
939
946
|
var FatalDiagnosticError = class {
|
|
940
947
|
constructor(code, node, message, relatedInformation) {
|
|
941
948
|
this.code = code;
|
|
@@ -991,10 +998,10 @@ function addDiagnosticChain(messageText, add) {
|
|
|
991
998
|
return messageText;
|
|
992
999
|
}
|
|
993
1000
|
|
|
994
|
-
// bazel-out/
|
|
1001
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/error_details_base_url.mjs
|
|
995
1002
|
var ERROR_DETAILS_PAGE_BASE_URL = "https://angular.io/errors";
|
|
996
1003
|
|
|
997
|
-
// bazel-out/
|
|
1004
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/extended_template_diagnostic_name.mjs
|
|
998
1005
|
var ExtendedTemplateDiagnosticName;
|
|
999
1006
|
(function(ExtendedTemplateDiagnosticName2) {
|
|
1000
1007
|
ExtendedTemplateDiagnosticName2["INVALID_BANANA_IN_BOX"] = "invalidBananaInBox";
|
|
@@ -1009,7 +1016,7 @@ var ExtendedTemplateDiagnosticName;
|
|
|
1009
1016
|
ExtendedTemplateDiagnosticName2["CONTROL_FLOW_PREVENTING_CONTENT_PROJECTION"] = "controlFlowPreventingContentProjection";
|
|
1010
1017
|
})(ExtendedTemplateDiagnosticName || (ExtendedTemplateDiagnosticName = {}));
|
|
1011
1018
|
|
|
1012
|
-
// bazel-out/
|
|
1019
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/find_export.mjs
|
|
1013
1020
|
function findExportedNameOfNode(target, file, reflector) {
|
|
1014
1021
|
const exports = reflector.getExportsOfModule(file);
|
|
1015
1022
|
if (exports === null) {
|
|
@@ -1029,7 +1036,7 @@ function findExportedNameOfNode(target, file, reflector) {
|
|
|
1029
1036
|
return foundExportName;
|
|
1030
1037
|
}
|
|
1031
1038
|
|
|
1032
|
-
// bazel-out/
|
|
1039
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/emitter.mjs
|
|
1033
1040
|
var ImportFlags;
|
|
1034
1041
|
(function(ImportFlags2) {
|
|
1035
1042
|
ImportFlags2[ImportFlags2["None"] = 0] = "None";
|
|
@@ -1258,7 +1265,7 @@ var UnifiedModulesStrategy = class {
|
|
|
1258
1265
|
}
|
|
1259
1266
|
};
|
|
1260
1267
|
|
|
1261
|
-
// bazel-out/
|
|
1268
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/alias.mjs
|
|
1262
1269
|
var CHARS_TO_ESCAPE = /[^a-zA-Z0-9/_]/g;
|
|
1263
1270
|
var UnifiedModulesAliasingHost = class {
|
|
1264
1271
|
constructor(unifiedModulesHost) {
|
|
@@ -1325,7 +1332,7 @@ var AliasStrategy = class {
|
|
|
1325
1332
|
}
|
|
1326
1333
|
};
|
|
1327
1334
|
|
|
1328
|
-
// bazel-out/
|
|
1335
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/util/src/path.mjs
|
|
1329
1336
|
function relativePathBetween(from, to) {
|
|
1330
1337
|
const relativePath = stripExtension(relative(dirname(resolve(from)), resolve(to)));
|
|
1331
1338
|
return relativePath !== "" ? toRelativeImport(relativePath) : null;
|
|
@@ -1334,7 +1341,7 @@ function normalizeSeparators(path) {
|
|
|
1334
1341
|
return path.replace(/\\/g, "/");
|
|
1335
1342
|
}
|
|
1336
1343
|
|
|
1337
|
-
// bazel-out/
|
|
1344
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/core.mjs
|
|
1338
1345
|
var NoopImportRewriter = class {
|
|
1339
1346
|
shouldImportSymbol(symbol, specifier) {
|
|
1340
1347
|
return true;
|
|
@@ -1393,7 +1400,7 @@ function validateAndRewriteCoreSymbol(name) {
|
|
|
1393
1400
|
return CORE_SUPPORTED_SYMBOLS.get(name);
|
|
1394
1401
|
}
|
|
1395
1402
|
|
|
1396
|
-
// bazel-out/
|
|
1403
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/patch_alias_reference_resolution.mjs
|
|
1397
1404
|
import ts8 from "typescript";
|
|
1398
1405
|
var patchedReferencedAliasesSymbol = Symbol("patchedReferencedAliases");
|
|
1399
1406
|
function loadIsReferencedAliasDeclarationPatch(context) {
|
|
@@ -1428,7 +1435,7 @@ function throwIncompatibleTransformationContextError() {
|
|
|
1428
1435
|
throw Error("Angular compiler is incompatible with this version of the TypeScript compiler.\n\nIf you recently updated TypeScript and this issue surfaces now, consider downgrading.\n\nPlease report an issue on the Angular repositories when this issue surfaces and you are using a supposedly compatible TypeScript version.");
|
|
1429
1436
|
}
|
|
1430
1437
|
|
|
1431
|
-
// bazel-out/
|
|
1438
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/default.mjs
|
|
1432
1439
|
var DefaultImportDeclaration = Symbol("DefaultImportDeclaration");
|
|
1433
1440
|
function attachDefaultImportDeclaration(expr, importDecl) {
|
|
1434
1441
|
expr[DefaultImportDeclaration] = importDecl;
|
|
@@ -1469,13 +1476,15 @@ var DefaultImportTracker = class {
|
|
|
1469
1476
|
}
|
|
1470
1477
|
};
|
|
1471
1478
|
|
|
1472
|
-
// bazel-out/
|
|
1479
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/deferred_symbol_tracker.mjs
|
|
1473
1480
|
import ts9 from "typescript";
|
|
1474
1481
|
var AssumeEager = "AssumeEager";
|
|
1475
1482
|
var DeferredSymbolTracker = class {
|
|
1476
|
-
constructor(typeChecker) {
|
|
1483
|
+
constructor(typeChecker, onlyExplicitDeferDependencyImports) {
|
|
1477
1484
|
this.typeChecker = typeChecker;
|
|
1485
|
+
this.onlyExplicitDeferDependencyImports = onlyExplicitDeferDependencyImports;
|
|
1478
1486
|
this.imports = /* @__PURE__ */ new Map();
|
|
1487
|
+
this.explicitlyDeferredImports = /* @__PURE__ */ new Map();
|
|
1479
1488
|
}
|
|
1480
1489
|
extractImportedSymbols(importDecl) {
|
|
1481
1490
|
const symbolMap = /* @__PURE__ */ new Map();
|
|
@@ -1503,12 +1512,33 @@ var DeferredSymbolTracker = class {
|
|
|
1503
1512
|
}
|
|
1504
1513
|
return symbolMap;
|
|
1505
1514
|
}
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1515
|
+
getNonRemovableDeferredImports(sourceFile, classDecl) {
|
|
1516
|
+
var _a;
|
|
1517
|
+
const affectedImports = [];
|
|
1518
|
+
const importDecls = (_a = this.explicitlyDeferredImports.get(classDecl)) != null ? _a : [];
|
|
1519
|
+
for (const importDecl of importDecls) {
|
|
1520
|
+
if (importDecl.getSourceFile() === sourceFile && !this.canDefer(importDecl)) {
|
|
1521
|
+
affectedImports.push(importDecl);
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1524
|
+
return affectedImports;
|
|
1525
|
+
}
|
|
1526
|
+
markAsDeferrableCandidate(identifier, importDecl, componentClassDecl, isExplicitlyDeferred) {
|
|
1527
|
+
if (this.onlyExplicitDeferDependencyImports && !isExplicitlyDeferred) {
|
|
1528
|
+
return;
|
|
1529
|
+
}
|
|
1530
|
+
if (isExplicitlyDeferred) {
|
|
1531
|
+
if (this.explicitlyDeferredImports.has(componentClassDecl)) {
|
|
1532
|
+
this.explicitlyDeferredImports.get(componentClassDecl).push(importDecl);
|
|
1533
|
+
} else {
|
|
1534
|
+
this.explicitlyDeferredImports.set(componentClassDecl, [importDecl]);
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
let symbolMap = this.imports.get(importDecl);
|
|
1538
|
+
if (!symbolMap) {
|
|
1539
|
+
symbolMap = this.extractImportedSymbols(importDecl);
|
|
1540
|
+
this.imports.set(importDecl, symbolMap);
|
|
1510
1541
|
}
|
|
1511
|
-
const symbolMap = this.imports.get(importDecl);
|
|
1512
1542
|
if (!symbolMap.has(identifier.text)) {
|
|
1513
1543
|
throw new Error(`The '${identifier.text}' identifier doesn't belong to the provided import declaration.`);
|
|
1514
1544
|
}
|
|
@@ -1567,7 +1597,7 @@ var DeferredSymbolTracker = class {
|
|
|
1567
1597
|
}
|
|
1568
1598
|
};
|
|
1569
1599
|
|
|
1570
|
-
// bazel-out/
|
|
1600
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/resolver.mjs
|
|
1571
1601
|
var ModuleResolver = class {
|
|
1572
1602
|
constructor(program, compilerOptions, host, moduleResolutionCache) {
|
|
1573
1603
|
this.program = program;
|
|
@@ -1584,6 +1614,803 @@ var ModuleResolver = class {
|
|
|
1584
1614
|
}
|
|
1585
1615
|
};
|
|
1586
1616
|
|
|
1617
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/import_manager.mjs
|
|
1618
|
+
import ts10 from "typescript";
|
|
1619
|
+
var ImportManager = class {
|
|
1620
|
+
constructor(rewriter = new NoopImportRewriter(), prefix = "i", factory = ts10.factory) {
|
|
1621
|
+
this.rewriter = rewriter;
|
|
1622
|
+
this.prefix = prefix;
|
|
1623
|
+
this.factory = factory;
|
|
1624
|
+
this.specifierToIdentifier = /* @__PURE__ */ new Map();
|
|
1625
|
+
this.nextIndex = 0;
|
|
1626
|
+
}
|
|
1627
|
+
generateNamespaceImport(moduleName) {
|
|
1628
|
+
if (!this.specifierToIdentifier.has(moduleName)) {
|
|
1629
|
+
this.specifierToIdentifier.set(moduleName, this.factory.createIdentifier(`${this.prefix}${this.nextIndex++}`));
|
|
1630
|
+
}
|
|
1631
|
+
return this.specifierToIdentifier.get(moduleName);
|
|
1632
|
+
}
|
|
1633
|
+
generateNamedImport(moduleName, originalSymbol) {
|
|
1634
|
+
const symbol = this.rewriter.rewriteSymbol(originalSymbol, moduleName);
|
|
1635
|
+
if (!this.rewriter.shouldImportSymbol(symbol, moduleName)) {
|
|
1636
|
+
return { moduleImport: null, symbol };
|
|
1637
|
+
}
|
|
1638
|
+
const moduleImport = this.generateNamespaceImport(moduleName);
|
|
1639
|
+
return { moduleImport, symbol };
|
|
1640
|
+
}
|
|
1641
|
+
getAllImports(contextPath) {
|
|
1642
|
+
const imports = [];
|
|
1643
|
+
for (const [originalSpecifier, qualifier] of this.specifierToIdentifier) {
|
|
1644
|
+
const specifier = this.rewriter.rewriteSpecifier(originalSpecifier, contextPath);
|
|
1645
|
+
imports.push({
|
|
1646
|
+
specifier,
|
|
1647
|
+
qualifier
|
|
1648
|
+
});
|
|
1649
|
+
}
|
|
1650
|
+
return imports;
|
|
1651
|
+
}
|
|
1652
|
+
};
|
|
1653
|
+
|
|
1654
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/context.mjs
|
|
1655
|
+
var Context = class {
|
|
1656
|
+
constructor(isStatement) {
|
|
1657
|
+
this.isStatement = isStatement;
|
|
1658
|
+
}
|
|
1659
|
+
get withExpressionMode() {
|
|
1660
|
+
return this.isStatement ? new Context(false) : this;
|
|
1661
|
+
}
|
|
1662
|
+
get withStatementMode() {
|
|
1663
|
+
return !this.isStatement ? new Context(true) : this;
|
|
1664
|
+
}
|
|
1665
|
+
};
|
|
1666
|
+
|
|
1667
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/translator.mjs
|
|
1668
|
+
import * as o from "@angular/compiler";
|
|
1669
|
+
var UNARY_OPERATORS = /* @__PURE__ */ new Map([
|
|
1670
|
+
[o.UnaryOperator.Minus, "-"],
|
|
1671
|
+
[o.UnaryOperator.Plus, "+"]
|
|
1672
|
+
]);
|
|
1673
|
+
var BINARY_OPERATORS = /* @__PURE__ */ new Map([
|
|
1674
|
+
[o.BinaryOperator.And, "&&"],
|
|
1675
|
+
[o.BinaryOperator.Bigger, ">"],
|
|
1676
|
+
[o.BinaryOperator.BiggerEquals, ">="],
|
|
1677
|
+
[o.BinaryOperator.BitwiseAnd, "&"],
|
|
1678
|
+
[o.BinaryOperator.BitwiseOr, "|"],
|
|
1679
|
+
[o.BinaryOperator.Divide, "/"],
|
|
1680
|
+
[o.BinaryOperator.Equals, "=="],
|
|
1681
|
+
[o.BinaryOperator.Identical, "==="],
|
|
1682
|
+
[o.BinaryOperator.Lower, "<"],
|
|
1683
|
+
[o.BinaryOperator.LowerEquals, "<="],
|
|
1684
|
+
[o.BinaryOperator.Minus, "-"],
|
|
1685
|
+
[o.BinaryOperator.Modulo, "%"],
|
|
1686
|
+
[o.BinaryOperator.Multiply, "*"],
|
|
1687
|
+
[o.BinaryOperator.NotEquals, "!="],
|
|
1688
|
+
[o.BinaryOperator.NotIdentical, "!=="],
|
|
1689
|
+
[o.BinaryOperator.Or, "||"],
|
|
1690
|
+
[o.BinaryOperator.Plus, "+"],
|
|
1691
|
+
[o.BinaryOperator.NullishCoalesce, "??"]
|
|
1692
|
+
]);
|
|
1693
|
+
var ExpressionTranslatorVisitor = class {
|
|
1694
|
+
constructor(factory, imports, options) {
|
|
1695
|
+
this.factory = factory;
|
|
1696
|
+
this.imports = imports;
|
|
1697
|
+
this.downlevelTaggedTemplates = options.downlevelTaggedTemplates === true;
|
|
1698
|
+
this.downlevelVariableDeclarations = options.downlevelVariableDeclarations === true;
|
|
1699
|
+
this.recordWrappedNode = options.recordWrappedNode || (() => {
|
|
1700
|
+
});
|
|
1701
|
+
}
|
|
1702
|
+
visitDeclareVarStmt(stmt, context) {
|
|
1703
|
+
var _a;
|
|
1704
|
+
const varType = this.downlevelVariableDeclarations ? "var" : stmt.hasModifier(o.StmtModifier.Final) ? "const" : "let";
|
|
1705
|
+
return this.attachComments(this.factory.createVariableDeclaration(stmt.name, (_a = stmt.value) == null ? void 0 : _a.visitExpression(this, context.withExpressionMode), varType), stmt.leadingComments);
|
|
1706
|
+
}
|
|
1707
|
+
visitDeclareFunctionStmt(stmt, context) {
|
|
1708
|
+
return this.attachComments(this.factory.createFunctionDeclaration(stmt.name, stmt.params.map((param) => param.name), this.factory.createBlock(this.visitStatements(stmt.statements, context.withStatementMode))), stmt.leadingComments);
|
|
1709
|
+
}
|
|
1710
|
+
visitExpressionStmt(stmt, context) {
|
|
1711
|
+
return this.attachComments(this.factory.createExpressionStatement(stmt.expr.visitExpression(this, context.withStatementMode)), stmt.leadingComments);
|
|
1712
|
+
}
|
|
1713
|
+
visitReturnStmt(stmt, context) {
|
|
1714
|
+
return this.attachComments(this.factory.createReturnStatement(stmt.value.visitExpression(this, context.withExpressionMode)), stmt.leadingComments);
|
|
1715
|
+
}
|
|
1716
|
+
visitIfStmt(stmt, context) {
|
|
1717
|
+
return this.attachComments(this.factory.createIfStatement(stmt.condition.visitExpression(this, context), this.factory.createBlock(this.visitStatements(stmt.trueCase, context.withStatementMode)), stmt.falseCase.length > 0 ? this.factory.createBlock(this.visitStatements(stmt.falseCase, context.withStatementMode)) : null), stmt.leadingComments);
|
|
1718
|
+
}
|
|
1719
|
+
visitReadVarExpr(ast, _context) {
|
|
1720
|
+
const identifier = this.factory.createIdentifier(ast.name);
|
|
1721
|
+
this.setSourceMapRange(identifier, ast.sourceSpan);
|
|
1722
|
+
return identifier;
|
|
1723
|
+
}
|
|
1724
|
+
visitWriteVarExpr(expr, context) {
|
|
1725
|
+
const assignment = this.factory.createAssignment(this.setSourceMapRange(this.factory.createIdentifier(expr.name), expr.sourceSpan), expr.value.visitExpression(this, context));
|
|
1726
|
+
return context.isStatement ? assignment : this.factory.createParenthesizedExpression(assignment);
|
|
1727
|
+
}
|
|
1728
|
+
visitWriteKeyExpr(expr, context) {
|
|
1729
|
+
const exprContext = context.withExpressionMode;
|
|
1730
|
+
const target = this.factory.createElementAccess(expr.receiver.visitExpression(this, exprContext), expr.index.visitExpression(this, exprContext));
|
|
1731
|
+
const assignment = this.factory.createAssignment(target, expr.value.visitExpression(this, exprContext));
|
|
1732
|
+
return context.isStatement ? assignment : this.factory.createParenthesizedExpression(assignment);
|
|
1733
|
+
}
|
|
1734
|
+
visitWritePropExpr(expr, context) {
|
|
1735
|
+
const target = this.factory.createPropertyAccess(expr.receiver.visitExpression(this, context), expr.name);
|
|
1736
|
+
return this.factory.createAssignment(target, expr.value.visitExpression(this, context));
|
|
1737
|
+
}
|
|
1738
|
+
visitInvokeFunctionExpr(ast, context) {
|
|
1739
|
+
return this.setSourceMapRange(this.factory.createCallExpression(ast.fn.visitExpression(this, context), ast.args.map((arg) => arg.visitExpression(this, context)), ast.pure), ast.sourceSpan);
|
|
1740
|
+
}
|
|
1741
|
+
visitTaggedTemplateExpr(ast, context) {
|
|
1742
|
+
return this.setSourceMapRange(this.createTaggedTemplateExpression(ast.tag.visitExpression(this, context), {
|
|
1743
|
+
elements: ast.template.elements.map((e) => {
|
|
1744
|
+
var _a;
|
|
1745
|
+
return createTemplateElement({
|
|
1746
|
+
cooked: e.text,
|
|
1747
|
+
raw: e.rawText,
|
|
1748
|
+
range: (_a = e.sourceSpan) != null ? _a : ast.sourceSpan
|
|
1749
|
+
});
|
|
1750
|
+
}),
|
|
1751
|
+
expressions: ast.template.expressions.map((e) => e.visitExpression(this, context))
|
|
1752
|
+
}), ast.sourceSpan);
|
|
1753
|
+
}
|
|
1754
|
+
visitInstantiateExpr(ast, context) {
|
|
1755
|
+
return this.factory.createNewExpression(ast.classExpr.visitExpression(this, context), ast.args.map((arg) => arg.visitExpression(this, context)));
|
|
1756
|
+
}
|
|
1757
|
+
visitLiteralExpr(ast, _context) {
|
|
1758
|
+
return this.setSourceMapRange(this.factory.createLiteral(ast.value), ast.sourceSpan);
|
|
1759
|
+
}
|
|
1760
|
+
visitLocalizedString(ast, context) {
|
|
1761
|
+
const elements = [createTemplateElement(ast.serializeI18nHead())];
|
|
1762
|
+
const expressions = [];
|
|
1763
|
+
for (let i = 0; i < ast.expressions.length; i++) {
|
|
1764
|
+
const placeholder = this.setSourceMapRange(ast.expressions[i].visitExpression(this, context), ast.getPlaceholderSourceSpan(i));
|
|
1765
|
+
expressions.push(placeholder);
|
|
1766
|
+
elements.push(createTemplateElement(ast.serializeI18nTemplatePart(i + 1)));
|
|
1767
|
+
}
|
|
1768
|
+
const localizeTag = this.factory.createIdentifier("$localize");
|
|
1769
|
+
return this.setSourceMapRange(this.createTaggedTemplateExpression(localizeTag, { elements, expressions }), ast.sourceSpan);
|
|
1770
|
+
}
|
|
1771
|
+
createTaggedTemplateExpression(tag, template) {
|
|
1772
|
+
return this.downlevelTaggedTemplates ? this.createES5TaggedTemplateFunctionCall(tag, template) : this.factory.createTaggedTemplate(tag, template);
|
|
1773
|
+
}
|
|
1774
|
+
createES5TaggedTemplateFunctionCall(tagHandler, { elements, expressions }) {
|
|
1775
|
+
const { moduleImport, symbol } = this.imports.generateNamedImport("tslib", "__makeTemplateObject");
|
|
1776
|
+
const __makeTemplateObjectHelper = moduleImport === null ? this.factory.createIdentifier(symbol) : this.factory.createPropertyAccess(moduleImport, symbol);
|
|
1777
|
+
const cooked = [];
|
|
1778
|
+
const raw = [];
|
|
1779
|
+
for (const element of elements) {
|
|
1780
|
+
cooked.push(this.factory.setSourceMapRange(this.factory.createLiteral(element.cooked), element.range));
|
|
1781
|
+
raw.push(this.factory.setSourceMapRange(this.factory.createLiteral(element.raw), element.range));
|
|
1782
|
+
}
|
|
1783
|
+
const templateHelperCall = this.factory.createCallExpression(
|
|
1784
|
+
__makeTemplateObjectHelper,
|
|
1785
|
+
[this.factory.createArrayLiteral(cooked), this.factory.createArrayLiteral(raw)],
|
|
1786
|
+
false
|
|
1787
|
+
);
|
|
1788
|
+
return this.factory.createCallExpression(
|
|
1789
|
+
tagHandler,
|
|
1790
|
+
[templateHelperCall, ...expressions],
|
|
1791
|
+
false
|
|
1792
|
+
);
|
|
1793
|
+
}
|
|
1794
|
+
visitExternalExpr(ast, _context) {
|
|
1795
|
+
if (ast.value.name === null) {
|
|
1796
|
+
if (ast.value.moduleName === null) {
|
|
1797
|
+
throw new Error("Invalid import without name nor moduleName");
|
|
1798
|
+
}
|
|
1799
|
+
return this.imports.generateNamespaceImport(ast.value.moduleName);
|
|
1800
|
+
}
|
|
1801
|
+
if (ast.value.moduleName !== null) {
|
|
1802
|
+
const { moduleImport, symbol } = this.imports.generateNamedImport(ast.value.moduleName, ast.value.name);
|
|
1803
|
+
if (moduleImport === null) {
|
|
1804
|
+
return this.factory.createIdentifier(symbol);
|
|
1805
|
+
} else {
|
|
1806
|
+
return this.factory.createPropertyAccess(moduleImport, symbol);
|
|
1807
|
+
}
|
|
1808
|
+
} else {
|
|
1809
|
+
return this.factory.createIdentifier(ast.value.name);
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1812
|
+
visitConditionalExpr(ast, context) {
|
|
1813
|
+
let cond = ast.condition.visitExpression(this, context);
|
|
1814
|
+
if (ast.condition instanceof o.ConditionalExpr) {
|
|
1815
|
+
cond = this.factory.createParenthesizedExpression(cond);
|
|
1816
|
+
}
|
|
1817
|
+
return this.factory.createConditional(cond, ast.trueCase.visitExpression(this, context), ast.falseCase.visitExpression(this, context));
|
|
1818
|
+
}
|
|
1819
|
+
visitDynamicImportExpr(ast, context) {
|
|
1820
|
+
return this.factory.createDynamicImport(ast.url);
|
|
1821
|
+
}
|
|
1822
|
+
visitNotExpr(ast, context) {
|
|
1823
|
+
return this.factory.createUnaryExpression("!", ast.condition.visitExpression(this, context));
|
|
1824
|
+
}
|
|
1825
|
+
visitFunctionExpr(ast, context) {
|
|
1826
|
+
var _a;
|
|
1827
|
+
return this.factory.createFunctionExpression((_a = ast.name) != null ? _a : null, ast.params.map((param) => param.name), this.factory.createBlock(this.visitStatements(ast.statements, context)));
|
|
1828
|
+
}
|
|
1829
|
+
visitArrowFunctionExpr(ast, context) {
|
|
1830
|
+
return this.factory.createArrowFunctionExpression(ast.params.map((param) => param.name), Array.isArray(ast.body) ? this.factory.createBlock(this.visitStatements(ast.body, context)) : ast.body.visitExpression(this, context));
|
|
1831
|
+
}
|
|
1832
|
+
visitBinaryOperatorExpr(ast, context) {
|
|
1833
|
+
if (!BINARY_OPERATORS.has(ast.operator)) {
|
|
1834
|
+
throw new Error(`Unknown binary operator: ${o.BinaryOperator[ast.operator]}`);
|
|
1835
|
+
}
|
|
1836
|
+
return this.factory.createBinaryExpression(ast.lhs.visitExpression(this, context), BINARY_OPERATORS.get(ast.operator), ast.rhs.visitExpression(this, context));
|
|
1837
|
+
}
|
|
1838
|
+
visitReadPropExpr(ast, context) {
|
|
1839
|
+
return this.factory.createPropertyAccess(ast.receiver.visitExpression(this, context), ast.name);
|
|
1840
|
+
}
|
|
1841
|
+
visitReadKeyExpr(ast, context) {
|
|
1842
|
+
return this.factory.createElementAccess(ast.receiver.visitExpression(this, context), ast.index.visitExpression(this, context));
|
|
1843
|
+
}
|
|
1844
|
+
visitLiteralArrayExpr(ast, context) {
|
|
1845
|
+
return this.factory.createArrayLiteral(ast.entries.map((expr) => this.setSourceMapRange(expr.visitExpression(this, context), ast.sourceSpan)));
|
|
1846
|
+
}
|
|
1847
|
+
visitLiteralMapExpr(ast, context) {
|
|
1848
|
+
const properties = ast.entries.map((entry) => {
|
|
1849
|
+
return {
|
|
1850
|
+
propertyName: entry.key,
|
|
1851
|
+
quoted: entry.quoted,
|
|
1852
|
+
value: entry.value.visitExpression(this, context)
|
|
1853
|
+
};
|
|
1854
|
+
});
|
|
1855
|
+
return this.setSourceMapRange(this.factory.createObjectLiteral(properties), ast.sourceSpan);
|
|
1856
|
+
}
|
|
1857
|
+
visitCommaExpr(ast, context) {
|
|
1858
|
+
throw new Error("Method not implemented.");
|
|
1859
|
+
}
|
|
1860
|
+
visitWrappedNodeExpr(ast, _context) {
|
|
1861
|
+
this.recordWrappedNode(ast);
|
|
1862
|
+
return ast.node;
|
|
1863
|
+
}
|
|
1864
|
+
visitTypeofExpr(ast, context) {
|
|
1865
|
+
return this.factory.createTypeOfExpression(ast.expr.visitExpression(this, context));
|
|
1866
|
+
}
|
|
1867
|
+
visitUnaryOperatorExpr(ast, context) {
|
|
1868
|
+
if (!UNARY_OPERATORS.has(ast.operator)) {
|
|
1869
|
+
throw new Error(`Unknown unary operator: ${o.UnaryOperator[ast.operator]}`);
|
|
1870
|
+
}
|
|
1871
|
+
return this.factory.createUnaryExpression(UNARY_OPERATORS.get(ast.operator), ast.expr.visitExpression(this, context));
|
|
1872
|
+
}
|
|
1873
|
+
visitStatements(statements, context) {
|
|
1874
|
+
return statements.map((stmt) => stmt.visitStatement(this, context)).filter((stmt) => stmt !== void 0);
|
|
1875
|
+
}
|
|
1876
|
+
setSourceMapRange(ast, span) {
|
|
1877
|
+
return this.factory.setSourceMapRange(ast, createRange(span));
|
|
1878
|
+
}
|
|
1879
|
+
attachComments(statement, leadingComments) {
|
|
1880
|
+
if (leadingComments !== void 0) {
|
|
1881
|
+
this.factory.attachComments(statement, leadingComments);
|
|
1882
|
+
}
|
|
1883
|
+
return statement;
|
|
1884
|
+
}
|
|
1885
|
+
};
|
|
1886
|
+
function createTemplateElement({ cooked, raw, range }) {
|
|
1887
|
+
return { cooked, raw, range: createRange(range) };
|
|
1888
|
+
}
|
|
1889
|
+
function createRange(span) {
|
|
1890
|
+
if (span === null) {
|
|
1891
|
+
return null;
|
|
1892
|
+
}
|
|
1893
|
+
const { start, end } = span;
|
|
1894
|
+
const { url, content } = start.file;
|
|
1895
|
+
if (!url) {
|
|
1896
|
+
return null;
|
|
1897
|
+
}
|
|
1898
|
+
return {
|
|
1899
|
+
url,
|
|
1900
|
+
content,
|
|
1901
|
+
start: { offset: start.offset, line: start.line, column: start.col },
|
|
1902
|
+
end: { offset: end.offset, line: end.line, column: end.col }
|
|
1903
|
+
};
|
|
1904
|
+
}
|
|
1905
|
+
|
|
1906
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/type_emitter.mjs
|
|
1907
|
+
import ts11 from "typescript";
|
|
1908
|
+
var INELIGIBLE = {};
|
|
1909
|
+
function canEmitType(type, canEmit) {
|
|
1910
|
+
return canEmitTypeWorker(type);
|
|
1911
|
+
function canEmitTypeWorker(type2) {
|
|
1912
|
+
return visitNode(type2) !== INELIGIBLE;
|
|
1913
|
+
}
|
|
1914
|
+
function visitNode(node) {
|
|
1915
|
+
if (ts11.isImportTypeNode(node)) {
|
|
1916
|
+
return INELIGIBLE;
|
|
1917
|
+
}
|
|
1918
|
+
if (ts11.isTypeReferenceNode(node) && !canEmitTypeReference(node)) {
|
|
1919
|
+
return INELIGIBLE;
|
|
1920
|
+
} else {
|
|
1921
|
+
return ts11.forEachChild(node, visitNode);
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
function canEmitTypeReference(type2) {
|
|
1925
|
+
if (!canEmit(type2)) {
|
|
1926
|
+
return false;
|
|
1927
|
+
}
|
|
1928
|
+
return type2.typeArguments === void 0 || type2.typeArguments.every(canEmitTypeWorker);
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
var TypeEmitter = class {
|
|
1932
|
+
constructor(translator) {
|
|
1933
|
+
this.translator = translator;
|
|
1934
|
+
}
|
|
1935
|
+
emitType(type) {
|
|
1936
|
+
const typeReferenceTransformer = (context) => {
|
|
1937
|
+
const visitNode = (node) => {
|
|
1938
|
+
if (ts11.isImportTypeNode(node)) {
|
|
1939
|
+
throw new Error("Unable to emit import type");
|
|
1940
|
+
}
|
|
1941
|
+
if (ts11.isTypeReferenceNode(node)) {
|
|
1942
|
+
return this.emitTypeReference(node);
|
|
1943
|
+
} else if (ts11.isLiteralExpression(node)) {
|
|
1944
|
+
let clone;
|
|
1945
|
+
if (ts11.isStringLiteral(node)) {
|
|
1946
|
+
clone = ts11.factory.createStringLiteral(node.text);
|
|
1947
|
+
} else if (ts11.isNumericLiteral(node)) {
|
|
1948
|
+
clone = ts11.factory.createNumericLiteral(node.text);
|
|
1949
|
+
} else if (ts11.isBigIntLiteral(node)) {
|
|
1950
|
+
clone = ts11.factory.createBigIntLiteral(node.text);
|
|
1951
|
+
} else if (ts11.isNoSubstitutionTemplateLiteral(node)) {
|
|
1952
|
+
clone = ts11.factory.createNoSubstitutionTemplateLiteral(node.text, node.rawText);
|
|
1953
|
+
} else if (ts11.isRegularExpressionLiteral(node)) {
|
|
1954
|
+
clone = ts11.factory.createRegularExpressionLiteral(node.text);
|
|
1955
|
+
} else {
|
|
1956
|
+
throw new Error(`Unsupported literal kind ${ts11.SyntaxKind[node.kind]}`);
|
|
1957
|
+
}
|
|
1958
|
+
ts11.setTextRange(clone, { pos: -1, end: -1 });
|
|
1959
|
+
return clone;
|
|
1960
|
+
} else {
|
|
1961
|
+
return ts11.visitEachChild(node, visitNode, context);
|
|
1962
|
+
}
|
|
1963
|
+
};
|
|
1964
|
+
return (node) => ts11.visitNode(node, visitNode, ts11.isTypeNode);
|
|
1965
|
+
};
|
|
1966
|
+
return ts11.transform(type, [typeReferenceTransformer]).transformed[0];
|
|
1967
|
+
}
|
|
1968
|
+
emitTypeReference(type) {
|
|
1969
|
+
const translatedType = this.translator(type);
|
|
1970
|
+
if (translatedType === null) {
|
|
1971
|
+
throw new Error("Unable to emit an unresolved reference");
|
|
1972
|
+
}
|
|
1973
|
+
let typeArguments = void 0;
|
|
1974
|
+
if (type.typeArguments !== void 0) {
|
|
1975
|
+
typeArguments = ts11.factory.createNodeArray(type.typeArguments.map((typeArg) => this.emitType(typeArg)));
|
|
1976
|
+
}
|
|
1977
|
+
return ts11.factory.updateTypeReferenceNode(type, translatedType.typeName, typeArguments);
|
|
1978
|
+
}
|
|
1979
|
+
};
|
|
1980
|
+
|
|
1981
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/type_translator.mjs
|
|
1982
|
+
import * as o2 from "@angular/compiler";
|
|
1983
|
+
import ts13 from "typescript";
|
|
1984
|
+
|
|
1985
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/ts_util.mjs
|
|
1986
|
+
import ts12 from "typescript";
|
|
1987
|
+
function tsNumericExpression(value) {
|
|
1988
|
+
if (value < 0) {
|
|
1989
|
+
const operand = ts12.factory.createNumericLiteral(Math.abs(value));
|
|
1990
|
+
return ts12.factory.createPrefixUnaryExpression(ts12.SyntaxKind.MinusToken, operand);
|
|
1991
|
+
}
|
|
1992
|
+
return ts12.factory.createNumericLiteral(value);
|
|
1993
|
+
}
|
|
1994
|
+
|
|
1995
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/type_translator.mjs
|
|
1996
|
+
function translateType(type, contextFile, reflector, refEmitter, imports) {
|
|
1997
|
+
return type.visitType(new TypeTranslatorVisitor(imports, contextFile, reflector, refEmitter), new Context(false));
|
|
1998
|
+
}
|
|
1999
|
+
var TypeTranslatorVisitor = class {
|
|
2000
|
+
constructor(imports, contextFile, reflector, refEmitter) {
|
|
2001
|
+
this.imports = imports;
|
|
2002
|
+
this.contextFile = contextFile;
|
|
2003
|
+
this.reflector = reflector;
|
|
2004
|
+
this.refEmitter = refEmitter;
|
|
2005
|
+
}
|
|
2006
|
+
visitBuiltinType(type, context) {
|
|
2007
|
+
switch (type.name) {
|
|
2008
|
+
case o2.BuiltinTypeName.Bool:
|
|
2009
|
+
return ts13.factory.createKeywordTypeNode(ts13.SyntaxKind.BooleanKeyword);
|
|
2010
|
+
case o2.BuiltinTypeName.Dynamic:
|
|
2011
|
+
return ts13.factory.createKeywordTypeNode(ts13.SyntaxKind.AnyKeyword);
|
|
2012
|
+
case o2.BuiltinTypeName.Int:
|
|
2013
|
+
case o2.BuiltinTypeName.Number:
|
|
2014
|
+
return ts13.factory.createKeywordTypeNode(ts13.SyntaxKind.NumberKeyword);
|
|
2015
|
+
case o2.BuiltinTypeName.String:
|
|
2016
|
+
return ts13.factory.createKeywordTypeNode(ts13.SyntaxKind.StringKeyword);
|
|
2017
|
+
case o2.BuiltinTypeName.None:
|
|
2018
|
+
return ts13.factory.createKeywordTypeNode(ts13.SyntaxKind.NeverKeyword);
|
|
2019
|
+
default:
|
|
2020
|
+
throw new Error(`Unsupported builtin type: ${o2.BuiltinTypeName[type.name]}`);
|
|
2021
|
+
}
|
|
2022
|
+
}
|
|
2023
|
+
visitExpressionType(type, context) {
|
|
2024
|
+
const typeNode = this.translateExpression(type.value, context);
|
|
2025
|
+
if (type.typeParams === null) {
|
|
2026
|
+
return typeNode;
|
|
2027
|
+
}
|
|
2028
|
+
if (!ts13.isTypeReferenceNode(typeNode)) {
|
|
2029
|
+
throw new Error("An ExpressionType with type arguments must translate into a TypeReferenceNode");
|
|
2030
|
+
} else if (typeNode.typeArguments !== void 0) {
|
|
2031
|
+
throw new Error(`An ExpressionType with type arguments cannot have multiple levels of type arguments`);
|
|
2032
|
+
}
|
|
2033
|
+
const typeArgs = type.typeParams.map((param) => this.translateType(param, context));
|
|
2034
|
+
return ts13.factory.createTypeReferenceNode(typeNode.typeName, typeArgs);
|
|
2035
|
+
}
|
|
2036
|
+
visitArrayType(type, context) {
|
|
2037
|
+
return ts13.factory.createArrayTypeNode(this.translateType(type.of, context));
|
|
2038
|
+
}
|
|
2039
|
+
visitMapType(type, context) {
|
|
2040
|
+
const parameter = ts13.factory.createParameterDeclaration(void 0, void 0, "key", void 0, ts13.factory.createKeywordTypeNode(ts13.SyntaxKind.StringKeyword));
|
|
2041
|
+
const typeArgs = type.valueType !== null ? this.translateType(type.valueType, context) : ts13.factory.createKeywordTypeNode(ts13.SyntaxKind.UnknownKeyword);
|
|
2042
|
+
const indexSignature = ts13.factory.createIndexSignature(void 0, [parameter], typeArgs);
|
|
2043
|
+
return ts13.factory.createTypeLiteralNode([indexSignature]);
|
|
2044
|
+
}
|
|
2045
|
+
visitTransplantedType(ast, context) {
|
|
2046
|
+
const node = ast.type instanceof Reference ? ast.type.node : ast.type;
|
|
2047
|
+
if (!ts13.isTypeNode(node)) {
|
|
2048
|
+
throw new Error(`A TransplantedType must wrap a TypeNode`);
|
|
2049
|
+
}
|
|
2050
|
+
const viaModule = ast.type instanceof Reference ? ast.type.bestGuessOwningModule : null;
|
|
2051
|
+
const emitter = new TypeEmitter((typeRef) => this.translateTypeReference(typeRef, context, viaModule));
|
|
2052
|
+
return emitter.emitType(node);
|
|
2053
|
+
}
|
|
2054
|
+
visitReadVarExpr(ast, context) {
|
|
2055
|
+
if (ast.name === null) {
|
|
2056
|
+
throw new Error(`ReadVarExpr with no variable name in type`);
|
|
2057
|
+
}
|
|
2058
|
+
return ts13.factory.createTypeQueryNode(ts13.factory.createIdentifier(ast.name));
|
|
2059
|
+
}
|
|
2060
|
+
visitWriteVarExpr(expr, context) {
|
|
2061
|
+
throw new Error("Method not implemented.");
|
|
2062
|
+
}
|
|
2063
|
+
visitWriteKeyExpr(expr, context) {
|
|
2064
|
+
throw new Error("Method not implemented.");
|
|
2065
|
+
}
|
|
2066
|
+
visitWritePropExpr(expr, context) {
|
|
2067
|
+
throw new Error("Method not implemented.");
|
|
2068
|
+
}
|
|
2069
|
+
visitInvokeFunctionExpr(ast, context) {
|
|
2070
|
+
throw new Error("Method not implemented.");
|
|
2071
|
+
}
|
|
2072
|
+
visitTaggedTemplateExpr(ast, context) {
|
|
2073
|
+
throw new Error("Method not implemented.");
|
|
2074
|
+
}
|
|
2075
|
+
visitInstantiateExpr(ast, context) {
|
|
2076
|
+
throw new Error("Method not implemented.");
|
|
2077
|
+
}
|
|
2078
|
+
visitLiteralExpr(ast, context) {
|
|
2079
|
+
if (ast.value === null) {
|
|
2080
|
+
return ts13.factory.createLiteralTypeNode(ts13.factory.createNull());
|
|
2081
|
+
} else if (ast.value === void 0) {
|
|
2082
|
+
return ts13.factory.createKeywordTypeNode(ts13.SyntaxKind.UndefinedKeyword);
|
|
2083
|
+
} else if (typeof ast.value === "boolean") {
|
|
2084
|
+
return ts13.factory.createLiteralTypeNode(ast.value ? ts13.factory.createTrue() : ts13.factory.createFalse());
|
|
2085
|
+
} else if (typeof ast.value === "number") {
|
|
2086
|
+
return ts13.factory.createLiteralTypeNode(tsNumericExpression(ast.value));
|
|
2087
|
+
} else {
|
|
2088
|
+
return ts13.factory.createLiteralTypeNode(ts13.factory.createStringLiteral(ast.value));
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2091
|
+
visitLocalizedString(ast, context) {
|
|
2092
|
+
throw new Error("Method not implemented.");
|
|
2093
|
+
}
|
|
2094
|
+
visitExternalExpr(ast, context) {
|
|
2095
|
+
if (ast.value.moduleName === null || ast.value.name === null) {
|
|
2096
|
+
throw new Error(`Import unknown module or symbol`);
|
|
2097
|
+
}
|
|
2098
|
+
const { moduleImport, symbol } = this.imports.generateNamedImport(ast.value.moduleName, ast.value.name);
|
|
2099
|
+
const symbolIdentifier = ts13.factory.createIdentifier(symbol);
|
|
2100
|
+
const typeName = moduleImport ? ts13.factory.createQualifiedName(moduleImport, symbolIdentifier) : symbolIdentifier;
|
|
2101
|
+
const typeArguments = ast.typeParams !== null ? ast.typeParams.map((type) => this.translateType(type, context)) : void 0;
|
|
2102
|
+
return ts13.factory.createTypeReferenceNode(typeName, typeArguments);
|
|
2103
|
+
}
|
|
2104
|
+
visitConditionalExpr(ast, context) {
|
|
2105
|
+
throw new Error("Method not implemented.");
|
|
2106
|
+
}
|
|
2107
|
+
visitDynamicImportExpr(ast, context) {
|
|
2108
|
+
throw new Error("Method not implemented.");
|
|
2109
|
+
}
|
|
2110
|
+
visitNotExpr(ast, context) {
|
|
2111
|
+
throw new Error("Method not implemented.");
|
|
2112
|
+
}
|
|
2113
|
+
visitFunctionExpr(ast, context) {
|
|
2114
|
+
throw new Error("Method not implemented.");
|
|
2115
|
+
}
|
|
2116
|
+
visitArrowFunctionExpr(ast, context) {
|
|
2117
|
+
throw new Error("Method not implemented.");
|
|
2118
|
+
}
|
|
2119
|
+
visitUnaryOperatorExpr(ast, context) {
|
|
2120
|
+
throw new Error("Method not implemented.");
|
|
2121
|
+
}
|
|
2122
|
+
visitBinaryOperatorExpr(ast, context) {
|
|
2123
|
+
throw new Error("Method not implemented.");
|
|
2124
|
+
}
|
|
2125
|
+
visitReadPropExpr(ast, context) {
|
|
2126
|
+
throw new Error("Method not implemented.");
|
|
2127
|
+
}
|
|
2128
|
+
visitReadKeyExpr(ast, context) {
|
|
2129
|
+
throw new Error("Method not implemented.");
|
|
2130
|
+
}
|
|
2131
|
+
visitLiteralArrayExpr(ast, context) {
|
|
2132
|
+
const values = ast.entries.map((expr) => this.translateExpression(expr, context));
|
|
2133
|
+
return ts13.factory.createTupleTypeNode(values);
|
|
2134
|
+
}
|
|
2135
|
+
visitLiteralMapExpr(ast, context) {
|
|
2136
|
+
const entries = ast.entries.map((entry) => {
|
|
2137
|
+
const { key, quoted } = entry;
|
|
2138
|
+
const type = this.translateExpression(entry.value, context);
|
|
2139
|
+
return ts13.factory.createPropertySignature(
|
|
2140
|
+
void 0,
|
|
2141
|
+
quoted ? ts13.factory.createStringLiteral(key) : key,
|
|
2142
|
+
void 0,
|
|
2143
|
+
type
|
|
2144
|
+
);
|
|
2145
|
+
});
|
|
2146
|
+
return ts13.factory.createTypeLiteralNode(entries);
|
|
2147
|
+
}
|
|
2148
|
+
visitCommaExpr(ast, context) {
|
|
2149
|
+
throw new Error("Method not implemented.");
|
|
2150
|
+
}
|
|
2151
|
+
visitWrappedNodeExpr(ast, context) {
|
|
2152
|
+
const node = ast.node;
|
|
2153
|
+
if (ts13.isEntityName(node)) {
|
|
2154
|
+
return ts13.factory.createTypeReferenceNode(node, void 0);
|
|
2155
|
+
} else if (ts13.isTypeNode(node)) {
|
|
2156
|
+
return node;
|
|
2157
|
+
} else if (ts13.isLiteralExpression(node)) {
|
|
2158
|
+
return ts13.factory.createLiteralTypeNode(node);
|
|
2159
|
+
} else {
|
|
2160
|
+
throw new Error(`Unsupported WrappedNodeExpr in TypeTranslatorVisitor: ${ts13.SyntaxKind[node.kind]}`);
|
|
2161
|
+
}
|
|
2162
|
+
}
|
|
2163
|
+
visitTypeofExpr(ast, context) {
|
|
2164
|
+
const typeNode = this.translateExpression(ast.expr, context);
|
|
2165
|
+
if (!ts13.isTypeReferenceNode(typeNode)) {
|
|
2166
|
+
throw new Error(`The target of a typeof expression must be a type reference, but it was
|
|
2167
|
+
${ts13.SyntaxKind[typeNode.kind]}`);
|
|
2168
|
+
}
|
|
2169
|
+
return ts13.factory.createTypeQueryNode(typeNode.typeName);
|
|
2170
|
+
}
|
|
2171
|
+
translateType(type, context) {
|
|
2172
|
+
const typeNode = type.visitType(this, context);
|
|
2173
|
+
if (!ts13.isTypeNode(typeNode)) {
|
|
2174
|
+
throw new Error(`A Type must translate to a TypeNode, but was ${ts13.SyntaxKind[typeNode.kind]}`);
|
|
2175
|
+
}
|
|
2176
|
+
return typeNode;
|
|
2177
|
+
}
|
|
2178
|
+
translateExpression(expr, context) {
|
|
2179
|
+
const typeNode = expr.visitExpression(this, context);
|
|
2180
|
+
if (!ts13.isTypeNode(typeNode)) {
|
|
2181
|
+
throw new Error(`An Expression must translate to a TypeNode, but was ${ts13.SyntaxKind[typeNode.kind]}`);
|
|
2182
|
+
}
|
|
2183
|
+
return typeNode;
|
|
2184
|
+
}
|
|
2185
|
+
translateTypeReference(type, context, viaModule) {
|
|
2186
|
+
const target = ts13.isIdentifier(type.typeName) ? type.typeName : type.typeName.right;
|
|
2187
|
+
const declaration = this.reflector.getDeclarationOfIdentifier(target);
|
|
2188
|
+
if (declaration === null) {
|
|
2189
|
+
throw new Error(`Unable to statically determine the declaration file of type node ${target.text}`);
|
|
2190
|
+
}
|
|
2191
|
+
let owningModule = viaModule;
|
|
2192
|
+
if (typeof declaration.viaModule === "string") {
|
|
2193
|
+
owningModule = {
|
|
2194
|
+
specifier: declaration.viaModule,
|
|
2195
|
+
resolutionContext: type.getSourceFile().fileName
|
|
2196
|
+
};
|
|
2197
|
+
}
|
|
2198
|
+
const reference = new Reference(declaration.node, declaration.viaModule === AmbientImport ? AmbientImport : owningModule);
|
|
2199
|
+
const emittedType = this.refEmitter.emit(reference, this.contextFile, ImportFlags.NoAliasing | ImportFlags.AllowTypeImports | ImportFlags.AllowAmbientReferences);
|
|
2200
|
+
assertSuccessfulReferenceEmit(emittedType, target, "type");
|
|
2201
|
+
const typeNode = this.translateExpression(emittedType.expression, context);
|
|
2202
|
+
if (!ts13.isTypeReferenceNode(typeNode)) {
|
|
2203
|
+
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${ts13.SyntaxKind[typeNode.kind]}.`);
|
|
2204
|
+
}
|
|
2205
|
+
return typeNode;
|
|
2206
|
+
}
|
|
2207
|
+
};
|
|
2208
|
+
|
|
2209
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/typescript_ast_factory.mjs
|
|
2210
|
+
import ts14 from "typescript";
|
|
2211
|
+
var PureAnnotation;
|
|
2212
|
+
(function(PureAnnotation2) {
|
|
2213
|
+
PureAnnotation2["CLOSURE"] = "* @pureOrBreakMyCode ";
|
|
2214
|
+
PureAnnotation2["TERSER"] = "@__PURE__";
|
|
2215
|
+
})(PureAnnotation || (PureAnnotation = {}));
|
|
2216
|
+
var UNARY_OPERATORS2 = {
|
|
2217
|
+
"+": ts14.SyntaxKind.PlusToken,
|
|
2218
|
+
"-": ts14.SyntaxKind.MinusToken,
|
|
2219
|
+
"!": ts14.SyntaxKind.ExclamationToken
|
|
2220
|
+
};
|
|
2221
|
+
var BINARY_OPERATORS2 = {
|
|
2222
|
+
"&&": ts14.SyntaxKind.AmpersandAmpersandToken,
|
|
2223
|
+
">": ts14.SyntaxKind.GreaterThanToken,
|
|
2224
|
+
">=": ts14.SyntaxKind.GreaterThanEqualsToken,
|
|
2225
|
+
"&": ts14.SyntaxKind.AmpersandToken,
|
|
2226
|
+
"|": ts14.SyntaxKind.BarToken,
|
|
2227
|
+
"/": ts14.SyntaxKind.SlashToken,
|
|
2228
|
+
"==": ts14.SyntaxKind.EqualsEqualsToken,
|
|
2229
|
+
"===": ts14.SyntaxKind.EqualsEqualsEqualsToken,
|
|
2230
|
+
"<": ts14.SyntaxKind.LessThanToken,
|
|
2231
|
+
"<=": ts14.SyntaxKind.LessThanEqualsToken,
|
|
2232
|
+
"-": ts14.SyntaxKind.MinusToken,
|
|
2233
|
+
"%": ts14.SyntaxKind.PercentToken,
|
|
2234
|
+
"*": ts14.SyntaxKind.AsteriskToken,
|
|
2235
|
+
"!=": ts14.SyntaxKind.ExclamationEqualsToken,
|
|
2236
|
+
"!==": ts14.SyntaxKind.ExclamationEqualsEqualsToken,
|
|
2237
|
+
"||": ts14.SyntaxKind.BarBarToken,
|
|
2238
|
+
"+": ts14.SyntaxKind.PlusToken,
|
|
2239
|
+
"??": ts14.SyntaxKind.QuestionQuestionToken
|
|
2240
|
+
};
|
|
2241
|
+
var VAR_TYPES = {
|
|
2242
|
+
"const": ts14.NodeFlags.Const,
|
|
2243
|
+
"let": ts14.NodeFlags.Let,
|
|
2244
|
+
"var": ts14.NodeFlags.None
|
|
2245
|
+
};
|
|
2246
|
+
var TypeScriptAstFactory = class {
|
|
2247
|
+
constructor(annotateForClosureCompiler) {
|
|
2248
|
+
this.annotateForClosureCompiler = annotateForClosureCompiler;
|
|
2249
|
+
this.externalSourceFiles = /* @__PURE__ */ new Map();
|
|
2250
|
+
this.attachComments = attachComments;
|
|
2251
|
+
this.createArrayLiteral = ts14.factory.createArrayLiteralExpression;
|
|
2252
|
+
this.createElementAccess = ts14.factory.createElementAccessExpression;
|
|
2253
|
+
this.createExpressionStatement = ts14.factory.createExpressionStatement;
|
|
2254
|
+
this.createIdentifier = ts14.factory.createIdentifier;
|
|
2255
|
+
this.createParenthesizedExpression = ts14.factory.createParenthesizedExpression;
|
|
2256
|
+
this.createPropertyAccess = ts14.factory.createPropertyAccessExpression;
|
|
2257
|
+
this.createThrowStatement = ts14.factory.createThrowStatement;
|
|
2258
|
+
this.createTypeOfExpression = ts14.factory.createTypeOfExpression;
|
|
2259
|
+
}
|
|
2260
|
+
createAssignment(target, value) {
|
|
2261
|
+
return ts14.factory.createBinaryExpression(target, ts14.SyntaxKind.EqualsToken, value);
|
|
2262
|
+
}
|
|
2263
|
+
createBinaryExpression(leftOperand, operator, rightOperand) {
|
|
2264
|
+
return ts14.factory.createBinaryExpression(leftOperand, BINARY_OPERATORS2[operator], rightOperand);
|
|
2265
|
+
}
|
|
2266
|
+
createBlock(body) {
|
|
2267
|
+
return ts14.factory.createBlock(body);
|
|
2268
|
+
}
|
|
2269
|
+
createCallExpression(callee, args, pure) {
|
|
2270
|
+
const call = ts14.factory.createCallExpression(callee, void 0, args);
|
|
2271
|
+
if (pure) {
|
|
2272
|
+
ts14.addSyntheticLeadingComment(
|
|
2273
|
+
call,
|
|
2274
|
+
ts14.SyntaxKind.MultiLineCommentTrivia,
|
|
2275
|
+
this.annotateForClosureCompiler ? PureAnnotation.CLOSURE : PureAnnotation.TERSER,
|
|
2276
|
+
false
|
|
2277
|
+
);
|
|
2278
|
+
}
|
|
2279
|
+
return call;
|
|
2280
|
+
}
|
|
2281
|
+
createConditional(condition, whenTrue, whenFalse) {
|
|
2282
|
+
return ts14.factory.createConditionalExpression(condition, void 0, whenTrue, void 0, whenFalse);
|
|
2283
|
+
}
|
|
2284
|
+
createDynamicImport(url) {
|
|
2285
|
+
return ts14.factory.createCallExpression(
|
|
2286
|
+
ts14.factory.createToken(ts14.SyntaxKind.ImportKeyword),
|
|
2287
|
+
void 0,
|
|
2288
|
+
[ts14.factory.createStringLiteral(url)]
|
|
2289
|
+
);
|
|
2290
|
+
}
|
|
2291
|
+
createFunctionDeclaration(functionName, parameters, body) {
|
|
2292
|
+
if (!ts14.isBlock(body)) {
|
|
2293
|
+
throw new Error(`Invalid syntax, expected a block, but got ${ts14.SyntaxKind[body.kind]}.`);
|
|
2294
|
+
}
|
|
2295
|
+
return ts14.factory.createFunctionDeclaration(void 0, void 0, functionName, void 0, parameters.map((param) => ts14.factory.createParameterDeclaration(void 0, void 0, param)), void 0, body);
|
|
2296
|
+
}
|
|
2297
|
+
createFunctionExpression(functionName, parameters, body) {
|
|
2298
|
+
if (!ts14.isBlock(body)) {
|
|
2299
|
+
throw new Error(`Invalid syntax, expected a block, but got ${ts14.SyntaxKind[body.kind]}.`);
|
|
2300
|
+
}
|
|
2301
|
+
return ts14.factory.createFunctionExpression(void 0, void 0, functionName != null ? functionName : void 0, void 0, parameters.map((param) => ts14.factory.createParameterDeclaration(void 0, void 0, param)), void 0, body);
|
|
2302
|
+
}
|
|
2303
|
+
createArrowFunctionExpression(parameters, body) {
|
|
2304
|
+
if (ts14.isStatement(body) && !ts14.isBlock(body)) {
|
|
2305
|
+
throw new Error(`Invalid syntax, expected a block, but got ${ts14.SyntaxKind[body.kind]}.`);
|
|
2306
|
+
}
|
|
2307
|
+
return ts14.factory.createArrowFunction(void 0, void 0, parameters.map((param) => ts14.factory.createParameterDeclaration(void 0, void 0, param)), void 0, void 0, body);
|
|
2308
|
+
}
|
|
2309
|
+
createIfStatement(condition, thenStatement, elseStatement) {
|
|
2310
|
+
return ts14.factory.createIfStatement(condition, thenStatement, elseStatement != null ? elseStatement : void 0);
|
|
2311
|
+
}
|
|
2312
|
+
createLiteral(value) {
|
|
2313
|
+
if (value === void 0) {
|
|
2314
|
+
return ts14.factory.createIdentifier("undefined");
|
|
2315
|
+
} else if (value === null) {
|
|
2316
|
+
return ts14.factory.createNull();
|
|
2317
|
+
} else if (typeof value === "boolean") {
|
|
2318
|
+
return value ? ts14.factory.createTrue() : ts14.factory.createFalse();
|
|
2319
|
+
} else if (typeof value === "number") {
|
|
2320
|
+
return tsNumericExpression(value);
|
|
2321
|
+
} else {
|
|
2322
|
+
return ts14.factory.createStringLiteral(value);
|
|
2323
|
+
}
|
|
2324
|
+
}
|
|
2325
|
+
createNewExpression(expression, args) {
|
|
2326
|
+
return ts14.factory.createNewExpression(expression, void 0, args);
|
|
2327
|
+
}
|
|
2328
|
+
createObjectLiteral(properties) {
|
|
2329
|
+
return ts14.factory.createObjectLiteralExpression(properties.map((prop) => ts14.factory.createPropertyAssignment(prop.quoted ? ts14.factory.createStringLiteral(prop.propertyName) : ts14.factory.createIdentifier(prop.propertyName), prop.value)));
|
|
2330
|
+
}
|
|
2331
|
+
createReturnStatement(expression) {
|
|
2332
|
+
return ts14.factory.createReturnStatement(expression != null ? expression : void 0);
|
|
2333
|
+
}
|
|
2334
|
+
createTaggedTemplate(tag, template) {
|
|
2335
|
+
let templateLiteral;
|
|
2336
|
+
const length = template.elements.length;
|
|
2337
|
+
const head = template.elements[0];
|
|
2338
|
+
if (length === 1) {
|
|
2339
|
+
templateLiteral = ts14.factory.createNoSubstitutionTemplateLiteral(head.cooked, head.raw);
|
|
2340
|
+
} else {
|
|
2341
|
+
const spans = [];
|
|
2342
|
+
for (let i = 1; i < length - 1; i++) {
|
|
2343
|
+
const { cooked, raw, range } = template.elements[i];
|
|
2344
|
+
const middle = createTemplateMiddle(cooked, raw);
|
|
2345
|
+
if (range !== null) {
|
|
2346
|
+
this.setSourceMapRange(middle, range);
|
|
2347
|
+
}
|
|
2348
|
+
spans.push(ts14.factory.createTemplateSpan(template.expressions[i - 1], middle));
|
|
2349
|
+
}
|
|
2350
|
+
const resolvedExpression = template.expressions[length - 2];
|
|
2351
|
+
const templatePart = template.elements[length - 1];
|
|
2352
|
+
const templateTail = createTemplateTail(templatePart.cooked, templatePart.raw);
|
|
2353
|
+
if (templatePart.range !== null) {
|
|
2354
|
+
this.setSourceMapRange(templateTail, templatePart.range);
|
|
2355
|
+
}
|
|
2356
|
+
spans.push(ts14.factory.createTemplateSpan(resolvedExpression, templateTail));
|
|
2357
|
+
templateLiteral = ts14.factory.createTemplateExpression(ts14.factory.createTemplateHead(head.cooked, head.raw), spans);
|
|
2358
|
+
}
|
|
2359
|
+
if (head.range !== null) {
|
|
2360
|
+
this.setSourceMapRange(templateLiteral, head.range);
|
|
2361
|
+
}
|
|
2362
|
+
return ts14.factory.createTaggedTemplateExpression(tag, void 0, templateLiteral);
|
|
2363
|
+
}
|
|
2364
|
+
createUnaryExpression(operator, operand) {
|
|
2365
|
+
return ts14.factory.createPrefixUnaryExpression(UNARY_OPERATORS2[operator], operand);
|
|
2366
|
+
}
|
|
2367
|
+
createVariableDeclaration(variableName, initializer, type) {
|
|
2368
|
+
return ts14.factory.createVariableStatement(void 0, ts14.factory.createVariableDeclarationList([ts14.factory.createVariableDeclaration(variableName, void 0, void 0, initializer != null ? initializer : void 0)], VAR_TYPES[type]));
|
|
2369
|
+
}
|
|
2370
|
+
setSourceMapRange(node, sourceMapRange) {
|
|
2371
|
+
if (sourceMapRange === null) {
|
|
2372
|
+
return node;
|
|
2373
|
+
}
|
|
2374
|
+
const url = sourceMapRange.url;
|
|
2375
|
+
if (!this.externalSourceFiles.has(url)) {
|
|
2376
|
+
this.externalSourceFiles.set(url, ts14.createSourceMapSource(url, sourceMapRange.content, (pos) => pos));
|
|
2377
|
+
}
|
|
2378
|
+
const source = this.externalSourceFiles.get(url);
|
|
2379
|
+
ts14.setSourceMapRange(node, { pos: sourceMapRange.start.offset, end: sourceMapRange.end.offset, source });
|
|
2380
|
+
return node;
|
|
2381
|
+
}
|
|
2382
|
+
};
|
|
2383
|
+
function createTemplateMiddle(cooked, raw) {
|
|
2384
|
+
const node = ts14.factory.createTemplateHead(cooked, raw);
|
|
2385
|
+
node.kind = ts14.SyntaxKind.TemplateMiddle;
|
|
2386
|
+
return node;
|
|
2387
|
+
}
|
|
2388
|
+
function createTemplateTail(cooked, raw) {
|
|
2389
|
+
const node = ts14.factory.createTemplateHead(cooked, raw);
|
|
2390
|
+
node.kind = ts14.SyntaxKind.TemplateTail;
|
|
2391
|
+
return node;
|
|
2392
|
+
}
|
|
2393
|
+
function attachComments(statement, leadingComments) {
|
|
2394
|
+
for (const comment of leadingComments) {
|
|
2395
|
+
const commentKind = comment.multiline ? ts14.SyntaxKind.MultiLineCommentTrivia : ts14.SyntaxKind.SingleLineCommentTrivia;
|
|
2396
|
+
if (comment.multiline) {
|
|
2397
|
+
ts14.addSyntheticLeadingComment(statement, commentKind, comment.toString(), comment.trailingNewline);
|
|
2398
|
+
} else {
|
|
2399
|
+
for (const line of comment.toString().split("\n")) {
|
|
2400
|
+
ts14.addSyntheticLeadingComment(statement, commentKind, line, comment.trailingNewline);
|
|
2401
|
+
}
|
|
2402
|
+
}
|
|
2403
|
+
}
|
|
2404
|
+
}
|
|
2405
|
+
|
|
2406
|
+
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/typescript_translator.mjs
|
|
2407
|
+
function translateExpression(expression, imports, options = {}) {
|
|
2408
|
+
return expression.visitExpression(new ExpressionTranslatorVisitor(new TypeScriptAstFactory(options.annotateForClosureCompiler === true), imports, options), new Context(false));
|
|
2409
|
+
}
|
|
2410
|
+
function translateStatement(statement, imports, options = {}) {
|
|
2411
|
+
return statement.visitStatement(new ExpressionTranslatorVisitor(new TypeScriptAstFactory(options.annotateForClosureCompiler === true), imports, options), new Context(true));
|
|
2412
|
+
}
|
|
2413
|
+
|
|
1587
2414
|
export {
|
|
1588
2415
|
ErrorCode,
|
|
1589
2416
|
COMPILER_ERRORS_WITH_GUIDES,
|
|
@@ -1640,8 +2467,23 @@ export {
|
|
|
1640
2467
|
reflectObjectLiteral,
|
|
1641
2468
|
DeferredSymbolTracker,
|
|
1642
2469
|
Reference,
|
|
1643
|
-
ModuleResolver
|
|
2470
|
+
ModuleResolver,
|
|
2471
|
+
Context,
|
|
2472
|
+
ImportManager,
|
|
2473
|
+
ExpressionTranslatorVisitor,
|
|
2474
|
+
canEmitType,
|
|
2475
|
+
TypeEmitter,
|
|
2476
|
+
translateType,
|
|
2477
|
+
translateExpression,
|
|
2478
|
+
translateStatement
|
|
1644
2479
|
};
|
|
2480
|
+
/*!
|
|
2481
|
+
* @license
|
|
2482
|
+
* Copyright Google LLC All Rights Reserved.
|
|
2483
|
+
*
|
|
2484
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
2485
|
+
* found in the LICENSE file at https://angular.io/license
|
|
2486
|
+
*/
|
|
1645
2487
|
/**
|
|
1646
2488
|
* @license
|
|
1647
2489
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -1649,4 +2491,4 @@ export {
|
|
|
1649
2491
|
* Use of this source code is governed by an MIT-style license that can be
|
|
1650
2492
|
* found in the LICENSE file at https://angular.io/license
|
|
1651
2493
|
*/
|
|
1652
|
-
//# sourceMappingURL=chunk-
|
|
2494
|
+
//# sourceMappingURL=chunk-3WRR7A6G.js.map
|