@angular/compiler-cli 17.3.1 → 17.3.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-WCD6LVCP.js → chunk-2WQIUGOU.js} +7 -7
- package/bundles/{chunk-R4KQI5XI.js → chunk-64JBPJBS.js} +5 -5
- package/bundles/{chunk-F2QV65AH.js → chunk-7YTU3VQO.js} +5 -5
- package/bundles/{chunk-OXIOYWLB.js → chunk-ETISX7AF.js} +69 -67
- package/bundles/{chunk-OXIOYWLB.js.map → chunk-ETISX7AF.js.map} +1 -1
- package/bundles/{chunk-VH6EDOMC.js → chunk-GY5NSBQT.js} +2137 -957
- package/bundles/chunk-GY5NSBQT.js.map +6 -0
- package/bundles/{chunk-3ESFLGKJ.js → chunk-JO46TGKL.js} +329 -308
- package/bundles/chunk-JO46TGKL.js.map +6 -0
- package/bundles/{chunk-SBDNBITT.js → chunk-LYJKWJUC.js} +3 -3
- package/bundles/{chunk-75YFKYUJ.js → chunk-UM6JO3VZ.js} +7 -7
- package/bundles/{chunk-E5DF5SRS.js → chunk-VHZA6E42.js} +43 -43
- package/bundles/chunk-VHZA6E42.js.map +6 -0
- package/bundles/{chunk-YUMIYLNL.js → chunk-XIYC7KSQ.js} +5 -5
- package/bundles/{chunk-6X7GQ6BQ.js → chunk-XZRJJDCL.js} +627 -281
- package/bundles/chunk-XZRJJDCL.js.map +6 -0
- package/bundles/index.js +14 -12
- package/bundles/index.js.map +1 -1
- package/bundles/linker/babel/index.js +12 -12
- package/bundles/linker/index.js +4 -4
- 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 +5 -5
- package/bundles/private/tooling.js +5 -5
- package/bundles/src/bin/ng_xi18n.js +10 -10
- package/bundles/src/bin/ngc.js +8 -8
- package/bundles_metadata.json +1 -1
- package/index.d.ts +1 -0
- package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
- package/linker/src/file_linker/translator.d.ts +2 -2
- package/linker/src/linker_import_generator.d.ts +5 -5
- package/package.json +2 -2
- package/src/ngtsc/annotations/directive/index.d.ts +1 -0
- package/src/ngtsc/annotations/directive/src/initializer_function_access.d.ts +17 -0
- package/src/ngtsc/annotations/directive/src/initializer_functions.d.ts +10 -6
- package/src/ngtsc/annotations/directive/src/input_function.d.ts +1 -1
- package/src/ngtsc/annotations/directive/src/model_function.d.ts +1 -1
- package/src/ngtsc/annotations/directive/src/output_function.d.ts +1 -1
- package/src/ngtsc/annotations/directive/src/query_functions.d.ts +1 -1
- package/src/ngtsc/annotations/index.d.ts +1 -1
- package/src/ngtsc/diagnostics/src/error_code.d.ts +5 -0
- package/src/ngtsc/docs/src/entities.d.ts +36 -1
- package/src/ngtsc/docs/src/function_extractor.d.ts +3 -2
- package/src/ngtsc/docs/src/initializer_api_function_extractor.d.ts +24 -0
- package/src/ngtsc/imports/index.d.ts +1 -1
- package/src/ngtsc/imports/src/core.d.ts +0 -9
- package/src/ngtsc/imports/src/patch_alias_reference_resolution.d.ts +3 -1
- package/src/ngtsc/reflection/src/host.d.ts +13 -3
- package/src/ngtsc/reflection/src/typescript.d.ts +8 -1
- package/src/ngtsc/reflection/src/util.d.ts +6 -1
- package/src/ngtsc/transform/index.d.ts +0 -1
- package/src/ngtsc/transform/src/declaration.d.ts +1 -1
- package/src/ngtsc/translator/index.d.ts +2 -2
- package/src/ngtsc/translator/src/api/import_generator.d.ts +22 -10
- package/src/ngtsc/translator/src/import_manager/check_unique_identifier_name.d.ts +13 -0
- package/src/ngtsc/translator/src/import_manager/import_manager.d.ts +94 -0
- package/src/ngtsc/translator/src/import_manager/import_typescript_transform.d.ts +17 -0
- package/src/ngtsc/translator/src/import_manager/reuse_generated_imports.d.ts +32 -0
- package/src/ngtsc/translator/src/import_manager/reuse_source_file_imports.d.ts +38 -0
- package/src/ngtsc/translator/src/translator.d.ts +3 -2
- package/src/ngtsc/translator/src/type_translator.d.ts +1 -1
- package/src/ngtsc/translator/src/typescript_translator.d.ts +2 -2
- package/src/ngtsc/typecheck/src/reference_emit_environment.d.ts +1 -1
- package/src/ngtsc/typecheck/src/ts_util.d.ts +0 -2
- package/src/transformers/jit_transforms/initializer_api_transforms/transform_api.d.ts +4 -4
- package/bundles/chunk-3ESFLGKJ.js.map +0 -6
- package/bundles/chunk-6X7GQ6BQ.js.map +0 -6
- package/bundles/chunk-E5DF5SRS.js.map +0 -6
- package/bundles/chunk-VH6EDOMC.js.map +0 -6
- package/src/ngtsc/transform/src/utils.d.ts +0 -15
- package/src/ngtsc/translator/src/import_manager.d.ts +0 -47
- /package/bundles/{chunk-WCD6LVCP.js.map → chunk-2WQIUGOU.js.map} +0 -0
- /package/bundles/{chunk-R4KQI5XI.js.map → chunk-64JBPJBS.js.map} +0 -0
- /package/bundles/{chunk-F2QV65AH.js.map → chunk-7YTU3VQO.js.map} +0 -0
- /package/bundles/{chunk-SBDNBITT.js.map → chunk-LYJKWJUC.js.map} +0 -0
- /package/bundles/{chunk-75YFKYUJ.js.map → chunk-UM6JO3VZ.js.map} +0 -0
- /package/bundles/{chunk-YUMIYLNL.js.map → chunk-XIYC7KSQ.js.map} +0 -0
|
@@ -12,12 +12,12 @@ import {
|
|
|
12
12
|
resolve,
|
|
13
13
|
stripExtension,
|
|
14
14
|
toRelativeImport
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-UM6JO3VZ.js";
|
|
16
16
|
|
|
17
|
-
// bazel-out/
|
|
17
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/error.mjs
|
|
18
18
|
import ts from "typescript";
|
|
19
19
|
|
|
20
|
-
// bazel-out/
|
|
20
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/error_code.mjs
|
|
21
21
|
var ErrorCode;
|
|
22
22
|
(function(ErrorCode2) {
|
|
23
23
|
ErrorCode2[ErrorCode2["DECORATOR_ARG_NOT_LITERAL"] = 1001] = "DECORATOR_ARG_NOT_LITERAL";
|
|
@@ -30,6 +30,7 @@ var ErrorCode;
|
|
|
30
30
|
ErrorCode2[ErrorCode2["INITIALIZER_API_WITH_DISALLOWED_DECORATOR"] = 1050] = "INITIALIZER_API_WITH_DISALLOWED_DECORATOR";
|
|
31
31
|
ErrorCode2[ErrorCode2["INITIALIZER_API_DECORATOR_METADATA_COLLISION"] = 1051] = "INITIALIZER_API_DECORATOR_METADATA_COLLISION";
|
|
32
32
|
ErrorCode2[ErrorCode2["INITIALIZER_API_NO_REQUIRED_FUNCTION"] = 1052] = "INITIALIZER_API_NO_REQUIRED_FUNCTION";
|
|
33
|
+
ErrorCode2[ErrorCode2["INITIALIZER_API_DISALLOWED_MEMBER_VISIBILITY"] = 1053] = "INITIALIZER_API_DISALLOWED_MEMBER_VISIBILITY";
|
|
33
34
|
ErrorCode2[ErrorCode2["INCORRECTLY_DECLARED_ON_STATIC_MEMBER"] = 1100] = "INCORRECTLY_DECLARED_ON_STATIC_MEMBER";
|
|
34
35
|
ErrorCode2[ErrorCode2["COMPONENT_MISSING_TEMPLATE"] = 2001] = "COMPONENT_MISSING_TEMPLATE";
|
|
35
36
|
ErrorCode2[ErrorCode2["PIPE_MISSING_NAME"] = 2002] = "PIPE_MISSING_NAME";
|
|
@@ -105,7 +106,7 @@ var ErrorCode;
|
|
|
105
106
|
ErrorCode2[ErrorCode2["LOCAL_COMPILATION_UNSUPPORTED_EXPRESSION"] = 11003] = "LOCAL_COMPILATION_UNSUPPORTED_EXPRESSION";
|
|
106
107
|
})(ErrorCode || (ErrorCode = {}));
|
|
107
108
|
|
|
108
|
-
// bazel-out/
|
|
109
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/util.mjs
|
|
109
110
|
var ERROR_CODE_MATCHER = /(\u001b\[\d+m ?)TS-99(\d+: ?\u001b\[\d+m)/g;
|
|
110
111
|
function replaceTsWithNgInErrors(errors) {
|
|
111
112
|
return errors.replace(ERROR_CODE_MATCHER, "$1NG$2");
|
|
@@ -114,15 +115,15 @@ function ngErrorCode(code) {
|
|
|
114
115
|
return parseInt("-99" + code);
|
|
115
116
|
}
|
|
116
117
|
|
|
117
|
-
// bazel-out/
|
|
118
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/error.mjs
|
|
118
119
|
var FatalDiagnosticError = class extends Error {
|
|
119
120
|
constructor(code, node, diagnosticMessage, relatedInformation) {
|
|
120
|
-
super(`FatalDiagnosticError
|
|
121
|
+
super(`FatalDiagnosticError: Code: ${code}, Message: ${ts.flattenDiagnosticMessageText(diagnosticMessage, "\n")}`);
|
|
121
122
|
this.code = code;
|
|
122
123
|
this.node = node;
|
|
123
124
|
this.diagnosticMessage = diagnosticMessage;
|
|
124
125
|
this.relatedInformation = relatedInformation;
|
|
125
|
-
this.message =
|
|
126
|
+
this.message = this.message;
|
|
126
127
|
this._isFatalDiagnosticError = true;
|
|
127
128
|
Object.setPrototypeOf(this, new.target.prototype);
|
|
128
129
|
}
|
|
@@ -179,7 +180,7 @@ function isLocalCompilationDiagnostics(diagnostic) {
|
|
|
179
180
|
return diagnostic.code === ngErrorCode(ErrorCode.LOCAL_COMPILATION_UNRESOLVED_CONST) || diagnostic.code === ngErrorCode(ErrorCode.LOCAL_COMPILATION_UNSUPPORTED_EXPRESSION);
|
|
180
181
|
}
|
|
181
182
|
|
|
182
|
-
// bazel-out/
|
|
183
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/docs.mjs
|
|
183
184
|
var COMPILER_ERRORS_WITH_GUIDES = /* @__PURE__ */ new Set([
|
|
184
185
|
ErrorCode.DECORATOR_ARG_NOT_LITERAL,
|
|
185
186
|
ErrorCode.IMPORT_CYCLE_DETECTED,
|
|
@@ -191,10 +192,10 @@ var COMPILER_ERRORS_WITH_GUIDES = /* @__PURE__ */ new Set([
|
|
|
191
192
|
ErrorCode.WARN_NGMODULE_ID_UNNECESSARY
|
|
192
193
|
]);
|
|
193
194
|
|
|
194
|
-
// bazel-out/
|
|
195
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/error_details_base_url.mjs
|
|
195
196
|
var ERROR_DETAILS_PAGE_BASE_URL = "https://angular.io/errors";
|
|
196
197
|
|
|
197
|
-
// bazel-out/
|
|
198
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/extended_template_diagnostic_name.mjs
|
|
198
199
|
var ExtendedTemplateDiagnosticName;
|
|
199
200
|
(function(ExtendedTemplateDiagnosticName2) {
|
|
200
201
|
ExtendedTemplateDiagnosticName2["INVALID_BANANA_IN_BOX"] = "invalidBananaInBox";
|
|
@@ -209,10 +210,10 @@ var ExtendedTemplateDiagnosticName;
|
|
|
209
210
|
ExtendedTemplateDiagnosticName2["CONTROL_FLOW_PREVENTING_CONTENT_PROJECTION"] = "controlFlowPreventingContentProjection";
|
|
210
211
|
})(ExtendedTemplateDiagnosticName || (ExtendedTemplateDiagnosticName = {}));
|
|
211
212
|
|
|
212
|
-
// bazel-out/
|
|
213
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/typescript.mjs
|
|
213
214
|
import ts5 from "typescript";
|
|
214
215
|
|
|
215
|
-
// bazel-out/
|
|
216
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/host.mjs
|
|
216
217
|
import ts2 from "typescript";
|
|
217
218
|
function isDecoratorIdentifier(exp) {
|
|
218
219
|
return ts2.isIdentifier(exp) || ts2.isPropertyAccessExpression(exp) && ts2.isIdentifier(exp.expression) && ts2.isIdentifier(exp.name);
|
|
@@ -225,9 +226,17 @@ var ClassMemberKind;
|
|
|
225
226
|
ClassMemberKind2[ClassMemberKind2["Property"] = 3] = "Property";
|
|
226
227
|
ClassMemberKind2[ClassMemberKind2["Method"] = 4] = "Method";
|
|
227
228
|
})(ClassMemberKind || (ClassMemberKind = {}));
|
|
229
|
+
var ClassMemberAccessLevel;
|
|
230
|
+
(function(ClassMemberAccessLevel2) {
|
|
231
|
+
ClassMemberAccessLevel2[ClassMemberAccessLevel2["PublicWritable"] = 0] = "PublicWritable";
|
|
232
|
+
ClassMemberAccessLevel2[ClassMemberAccessLevel2["PublicReadonly"] = 1] = "PublicReadonly";
|
|
233
|
+
ClassMemberAccessLevel2[ClassMemberAccessLevel2["Protected"] = 2] = "Protected";
|
|
234
|
+
ClassMemberAccessLevel2[ClassMemberAccessLevel2["Private"] = 3] = "Private";
|
|
235
|
+
ClassMemberAccessLevel2[ClassMemberAccessLevel2["EcmaScriptPrivate"] = 4] = "EcmaScriptPrivate";
|
|
236
|
+
})(ClassMemberAccessLevel || (ClassMemberAccessLevel = {}));
|
|
228
237
|
var AmbientImport = {};
|
|
229
238
|
|
|
230
|
-
// bazel-out/
|
|
239
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/type_to_value.mjs
|
|
231
240
|
import ts3 from "typescript";
|
|
232
241
|
function typeToValue(typeNode, checker, isLocalCompilation) {
|
|
233
242
|
var _a, _b;
|
|
@@ -400,7 +409,7 @@ function extractModuleName(node) {
|
|
|
400
409
|
return node.moduleSpecifier.text;
|
|
401
410
|
}
|
|
402
411
|
|
|
403
|
-
// bazel-out/
|
|
412
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/util.mjs
|
|
404
413
|
import ts4 from "typescript";
|
|
405
414
|
function isNamedClassDeclaration(node) {
|
|
406
415
|
return ts4.isClassDeclaration(node) && isIdentifier(node.name);
|
|
@@ -408,8 +417,23 @@ function isNamedClassDeclaration(node) {
|
|
|
408
417
|
function isIdentifier(node) {
|
|
409
418
|
return node !== void 0 && ts4.isIdentifier(node);
|
|
410
419
|
}
|
|
420
|
+
function classMemberAccessLevelToString(level) {
|
|
421
|
+
switch (level) {
|
|
422
|
+
case ClassMemberAccessLevel.EcmaScriptPrivate:
|
|
423
|
+
return "ES private";
|
|
424
|
+
case ClassMemberAccessLevel.Private:
|
|
425
|
+
return "private";
|
|
426
|
+
case ClassMemberAccessLevel.Protected:
|
|
427
|
+
return "protected";
|
|
428
|
+
case ClassMemberAccessLevel.PublicReadonly:
|
|
429
|
+
return "public readonly";
|
|
430
|
+
case ClassMemberAccessLevel.PublicWritable:
|
|
431
|
+
default:
|
|
432
|
+
return "public";
|
|
433
|
+
}
|
|
434
|
+
}
|
|
411
435
|
|
|
412
|
-
// bazel-out/
|
|
436
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/typescript.mjs
|
|
413
437
|
var TypeScriptReflectionHost = class {
|
|
414
438
|
constructor(checker, isLocalCompilation = false) {
|
|
415
439
|
this.checker = checker;
|
|
@@ -421,7 +445,16 @@ var TypeScriptReflectionHost = class {
|
|
|
421
445
|
}
|
|
422
446
|
getMembersOfClass(clazz) {
|
|
423
447
|
const tsClazz = castDeclarationToClassOrDie(clazz);
|
|
424
|
-
return tsClazz.members.map((member) =>
|
|
448
|
+
return tsClazz.members.map((member) => {
|
|
449
|
+
const result = reflectClassMember(member);
|
|
450
|
+
if (result === null) {
|
|
451
|
+
return null;
|
|
452
|
+
}
|
|
453
|
+
return {
|
|
454
|
+
...result,
|
|
455
|
+
decorators: this.getDecoratorsOfDeclaration(member)
|
|
456
|
+
};
|
|
457
|
+
}).filter((member) => member !== null);
|
|
425
458
|
}
|
|
426
459
|
getConstructorParameters(clazz) {
|
|
427
460
|
const tsClazz = castDeclarationToClassOrDie(clazz);
|
|
@@ -656,51 +689,6 @@ var TypeScriptReflectionHost = class {
|
|
|
656
689
|
args
|
|
657
690
|
};
|
|
658
691
|
}
|
|
659
|
-
_reflectMember(node) {
|
|
660
|
-
let kind = null;
|
|
661
|
-
let value = null;
|
|
662
|
-
let name = null;
|
|
663
|
-
let nameNode = null;
|
|
664
|
-
if (ts5.isPropertyDeclaration(node)) {
|
|
665
|
-
kind = ClassMemberKind.Property;
|
|
666
|
-
value = node.initializer || null;
|
|
667
|
-
} else if (ts5.isGetAccessorDeclaration(node)) {
|
|
668
|
-
kind = ClassMemberKind.Getter;
|
|
669
|
-
} else if (ts5.isSetAccessorDeclaration(node)) {
|
|
670
|
-
kind = ClassMemberKind.Setter;
|
|
671
|
-
} else if (ts5.isMethodDeclaration(node)) {
|
|
672
|
-
kind = ClassMemberKind.Method;
|
|
673
|
-
} else if (ts5.isConstructorDeclaration(node)) {
|
|
674
|
-
kind = ClassMemberKind.Constructor;
|
|
675
|
-
} else {
|
|
676
|
-
return null;
|
|
677
|
-
}
|
|
678
|
-
if (ts5.isConstructorDeclaration(node)) {
|
|
679
|
-
name = "constructor";
|
|
680
|
-
} else if (ts5.isIdentifier(node.name)) {
|
|
681
|
-
name = node.name.text;
|
|
682
|
-
nameNode = node.name;
|
|
683
|
-
} else if (ts5.isStringLiteral(node.name)) {
|
|
684
|
-
name = node.name.text;
|
|
685
|
-
nameNode = node.name;
|
|
686
|
-
} else {
|
|
687
|
-
return null;
|
|
688
|
-
}
|
|
689
|
-
const decorators = this.getDecoratorsOfDeclaration(node);
|
|
690
|
-
const modifiers = ts5.getModifiers(node);
|
|
691
|
-
const isStatic = modifiers !== void 0 && modifiers.some((mod) => mod.kind === ts5.SyntaxKind.StaticKeyword);
|
|
692
|
-
return {
|
|
693
|
-
node,
|
|
694
|
-
implementation: node,
|
|
695
|
-
kind,
|
|
696
|
-
type: node.type || null,
|
|
697
|
-
name,
|
|
698
|
-
nameNode,
|
|
699
|
-
decorators,
|
|
700
|
-
value,
|
|
701
|
-
isStatic
|
|
702
|
-
};
|
|
703
|
-
}
|
|
704
692
|
getLocalExportedDeclarationsOfSourceFile(file) {
|
|
705
693
|
const cacheSf = file;
|
|
706
694
|
if (cacheSf[LocalExportedDeclarations] !== void 0) {
|
|
@@ -792,6 +780,83 @@ function filterToMembersWithDecorator(members, name, module) {
|
|
|
792
780
|
return { member, decorators };
|
|
793
781
|
}).filter((value) => value !== null);
|
|
794
782
|
}
|
|
783
|
+
function extractModifiersOfMember(node) {
|
|
784
|
+
const modifiers = ts5.getModifiers(node);
|
|
785
|
+
let isStatic = false;
|
|
786
|
+
let isReadonly = false;
|
|
787
|
+
let accessLevel = ClassMemberAccessLevel.PublicWritable;
|
|
788
|
+
if (modifiers !== void 0) {
|
|
789
|
+
for (const modifier of modifiers) {
|
|
790
|
+
switch (modifier.kind) {
|
|
791
|
+
case ts5.SyntaxKind.StaticKeyword:
|
|
792
|
+
isStatic = true;
|
|
793
|
+
break;
|
|
794
|
+
case ts5.SyntaxKind.PrivateKeyword:
|
|
795
|
+
accessLevel = ClassMemberAccessLevel.Private;
|
|
796
|
+
break;
|
|
797
|
+
case ts5.SyntaxKind.ProtectedKeyword:
|
|
798
|
+
accessLevel = ClassMemberAccessLevel.Protected;
|
|
799
|
+
break;
|
|
800
|
+
case ts5.SyntaxKind.ReadonlyKeyword:
|
|
801
|
+
isReadonly = true;
|
|
802
|
+
break;
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
if (isReadonly && accessLevel === ClassMemberAccessLevel.PublicWritable) {
|
|
807
|
+
accessLevel = ClassMemberAccessLevel.PublicReadonly;
|
|
808
|
+
}
|
|
809
|
+
if (node.name !== void 0 && ts5.isPrivateIdentifier(node.name)) {
|
|
810
|
+
accessLevel = ClassMemberAccessLevel.EcmaScriptPrivate;
|
|
811
|
+
}
|
|
812
|
+
return { accessLevel, isStatic };
|
|
813
|
+
}
|
|
814
|
+
function reflectClassMember(node) {
|
|
815
|
+
let kind = null;
|
|
816
|
+
let value = null;
|
|
817
|
+
let name = null;
|
|
818
|
+
let nameNode = null;
|
|
819
|
+
if (ts5.isPropertyDeclaration(node)) {
|
|
820
|
+
kind = ClassMemberKind.Property;
|
|
821
|
+
value = node.initializer || null;
|
|
822
|
+
} else if (ts5.isGetAccessorDeclaration(node)) {
|
|
823
|
+
kind = ClassMemberKind.Getter;
|
|
824
|
+
} else if (ts5.isSetAccessorDeclaration(node)) {
|
|
825
|
+
kind = ClassMemberKind.Setter;
|
|
826
|
+
} else if (ts5.isMethodDeclaration(node)) {
|
|
827
|
+
kind = ClassMemberKind.Method;
|
|
828
|
+
} else if (ts5.isConstructorDeclaration(node)) {
|
|
829
|
+
kind = ClassMemberKind.Constructor;
|
|
830
|
+
} else {
|
|
831
|
+
return null;
|
|
832
|
+
}
|
|
833
|
+
if (ts5.isConstructorDeclaration(node)) {
|
|
834
|
+
name = "constructor";
|
|
835
|
+
} else if (ts5.isIdentifier(node.name)) {
|
|
836
|
+
name = node.name.text;
|
|
837
|
+
nameNode = node.name;
|
|
838
|
+
} else if (ts5.isStringLiteral(node.name)) {
|
|
839
|
+
name = node.name.text;
|
|
840
|
+
nameNode = node.name;
|
|
841
|
+
} else if (ts5.isPrivateIdentifier(node.name)) {
|
|
842
|
+
name = node.name.text;
|
|
843
|
+
nameNode = node.name;
|
|
844
|
+
} else {
|
|
845
|
+
return null;
|
|
846
|
+
}
|
|
847
|
+
const { accessLevel, isStatic } = extractModifiersOfMember(node);
|
|
848
|
+
return {
|
|
849
|
+
node,
|
|
850
|
+
implementation: node,
|
|
851
|
+
kind,
|
|
852
|
+
type: node.type || null,
|
|
853
|
+
accessLevel,
|
|
854
|
+
name,
|
|
855
|
+
nameNode,
|
|
856
|
+
value,
|
|
857
|
+
isStatic
|
|
858
|
+
};
|
|
859
|
+
}
|
|
795
860
|
function reflectObjectLiteral(node) {
|
|
796
861
|
const map = /* @__PURE__ */ new Map();
|
|
797
862
|
node.properties.forEach((prop) => {
|
|
@@ -856,7 +921,7 @@ function getExportedName(decl, originalId) {
|
|
|
856
921
|
}
|
|
857
922
|
var LocalExportedDeclarations = Symbol("LocalExportedDeclarations");
|
|
858
923
|
|
|
859
|
-
// bazel-out/
|
|
924
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/util/src/typescript.mjs
|
|
860
925
|
import ts6 from "typescript";
|
|
861
926
|
var TS = /\.tsx?$/i;
|
|
862
927
|
var D_TS = /\.d\.ts$/i;
|
|
@@ -957,7 +1022,7 @@ function toUnredirectedSourceFile(sf) {
|
|
|
957
1022
|
return redirectInfo.unredirected;
|
|
958
1023
|
}
|
|
959
1024
|
|
|
960
|
-
// bazel-out/
|
|
1025
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/references.mjs
|
|
961
1026
|
var Reference = class {
|
|
962
1027
|
constructor(node, bestGuessOwningModule = null) {
|
|
963
1028
|
this.node = node;
|
|
@@ -1026,14 +1091,14 @@ var Reference = class {
|
|
|
1026
1091
|
}
|
|
1027
1092
|
};
|
|
1028
1093
|
|
|
1029
|
-
// bazel-out/
|
|
1094
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/alias.mjs
|
|
1030
1095
|
import { ExternalExpr as ExternalExpr2 } from "@angular/compiler";
|
|
1031
1096
|
|
|
1032
|
-
// bazel-out/
|
|
1097
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/emitter.mjs
|
|
1033
1098
|
import { ExternalExpr, ExternalReference, WrappedNodeExpr } from "@angular/compiler";
|
|
1034
1099
|
import ts7 from "typescript";
|
|
1035
1100
|
|
|
1036
|
-
// bazel-out/
|
|
1101
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/find_export.mjs
|
|
1037
1102
|
function findExportedNameOfNode(target, file, reflector) {
|
|
1038
1103
|
const exports = reflector.getExportsOfModule(file);
|
|
1039
1104
|
if (exports === null) {
|
|
@@ -1053,7 +1118,7 @@ function findExportedNameOfNode(target, file, reflector) {
|
|
|
1053
1118
|
return foundExportName;
|
|
1054
1119
|
}
|
|
1055
1120
|
|
|
1056
|
-
// bazel-out/
|
|
1121
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/emitter.mjs
|
|
1057
1122
|
var ImportFlags;
|
|
1058
1123
|
(function(ImportFlags2) {
|
|
1059
1124
|
ImportFlags2[ImportFlags2["None"] = 0] = "None";
|
|
@@ -1282,7 +1347,7 @@ var UnifiedModulesStrategy = class {
|
|
|
1282
1347
|
}
|
|
1283
1348
|
};
|
|
1284
1349
|
|
|
1285
|
-
// bazel-out/
|
|
1350
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/alias.mjs
|
|
1286
1351
|
var CHARS_TO_ESCAPE = /[^a-zA-Z0-9/_]/g;
|
|
1287
1352
|
var UnifiedModulesAliasingHost = class {
|
|
1288
1353
|
constructor(unifiedModulesHost) {
|
|
@@ -1349,7 +1414,7 @@ var AliasStrategy = class {
|
|
|
1349
1414
|
}
|
|
1350
1415
|
};
|
|
1351
1416
|
|
|
1352
|
-
// bazel-out/
|
|
1417
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/util/src/path.mjs
|
|
1353
1418
|
function relativePathBetween(from, to) {
|
|
1354
1419
|
const relativePath = stripExtension(relative(dirname(resolve(from)), resolve(to)));
|
|
1355
1420
|
return relativePath !== "" ? toRelativeImport(relativePath) : null;
|
|
@@ -1358,11 +1423,8 @@ function normalizeSeparators(path) {
|
|
|
1358
1423
|
return path.replace(/\\/g, "/");
|
|
1359
1424
|
}
|
|
1360
1425
|
|
|
1361
|
-
// bazel-out/
|
|
1426
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/core.mjs
|
|
1362
1427
|
var NoopImportRewriter = class {
|
|
1363
|
-
shouldImportSymbol(symbol, specifier) {
|
|
1364
|
-
return true;
|
|
1365
|
-
}
|
|
1366
1428
|
rewriteSymbol(symbol, specifier) {
|
|
1367
1429
|
return symbol;
|
|
1368
1430
|
}
|
|
@@ -1390,9 +1452,6 @@ var R3SymbolsImportRewriter = class {
|
|
|
1390
1452
|
constructor(r3SymbolsPath) {
|
|
1391
1453
|
this.r3SymbolsPath = r3SymbolsPath;
|
|
1392
1454
|
}
|
|
1393
|
-
shouldImportSymbol(symbol, specifier) {
|
|
1394
|
-
return true;
|
|
1395
|
-
}
|
|
1396
1455
|
rewriteSymbol(symbol, specifier) {
|
|
1397
1456
|
if (specifier !== CORE_MODULE) {
|
|
1398
1457
|
return symbol;
|
|
@@ -1417,7 +1476,7 @@ function validateAndRewriteCoreSymbol(name) {
|
|
|
1417
1476
|
return CORE_SUPPORTED_SYMBOLS.get(name);
|
|
1418
1477
|
}
|
|
1419
1478
|
|
|
1420
|
-
// bazel-out/
|
|
1479
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/patch_alias_reference_resolution.mjs
|
|
1421
1480
|
import ts8 from "typescript";
|
|
1422
1481
|
var patchedReferencedAliasesSymbol = Symbol("patchedReferencedAliases");
|
|
1423
1482
|
function loadIsReferencedAliasDeclarationPatch(context) {
|
|
@@ -1452,7 +1511,7 @@ function throwIncompatibleTransformationContextError() {
|
|
|
1452
1511
|
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.");
|
|
1453
1512
|
}
|
|
1454
1513
|
|
|
1455
|
-
// bazel-out/
|
|
1514
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/default.mjs
|
|
1456
1515
|
var DefaultImportDeclaration = Symbol("DefaultImportDeclaration");
|
|
1457
1516
|
function attachDefaultImportDeclaration(expr, importDecl) {
|
|
1458
1517
|
expr[DefaultImportDeclaration] = importDecl;
|
|
@@ -1493,7 +1552,7 @@ var DefaultImportTracker = class {
|
|
|
1493
1552
|
}
|
|
1494
1553
|
};
|
|
1495
1554
|
|
|
1496
|
-
// bazel-out/
|
|
1555
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/deferred_symbol_tracker.mjs
|
|
1497
1556
|
import ts9 from "typescript";
|
|
1498
1557
|
var AssumeEager = "AssumeEager";
|
|
1499
1558
|
var DeferredSymbolTracker = class {
|
|
@@ -1614,7 +1673,7 @@ var DeferredSymbolTracker = class {
|
|
|
1614
1673
|
}
|
|
1615
1674
|
};
|
|
1616
1675
|
|
|
1617
|
-
// bazel-out/
|
|
1676
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/imported_symbols_tracker.mjs
|
|
1618
1677
|
import ts10 from "typescript";
|
|
1619
1678
|
var ImportedSymbolsTracker = class {
|
|
1620
1679
|
constructor() {
|
|
@@ -1673,7 +1732,7 @@ var ImportedSymbolsTracker = class {
|
|
|
1673
1732
|
}
|
|
1674
1733
|
};
|
|
1675
1734
|
|
|
1676
|
-
// bazel-out/
|
|
1735
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/local_compilation_extra_imports_tracker.mjs
|
|
1677
1736
|
import ts11 from "typescript";
|
|
1678
1737
|
var LocalCompilationExtraImportsTracker = class {
|
|
1679
1738
|
constructor(typeChecker) {
|
|
@@ -1720,7 +1779,7 @@ function removeQuotations(s) {
|
|
|
1720
1779
|
return s.substring(1, s.length - 1).trim();
|
|
1721
1780
|
}
|
|
1722
1781
|
|
|
1723
|
-
// bazel-out/
|
|
1782
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/resolver.mjs
|
|
1724
1783
|
var ModuleResolver = class {
|
|
1725
1784
|
constructor(program, compilerOptions, host, moduleResolutionCache) {
|
|
1726
1785
|
this.program = program;
|
|
@@ -1737,49 +1796,322 @@ var ModuleResolver = class {
|
|
|
1737
1796
|
}
|
|
1738
1797
|
};
|
|
1739
1798
|
|
|
1740
|
-
// bazel-out/
|
|
1799
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/import_manager/import_manager.mjs
|
|
1800
|
+
import ts16 from "typescript";
|
|
1801
|
+
|
|
1802
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/import_manager/check_unique_identifier_name.mjs
|
|
1741
1803
|
import ts12 from "typescript";
|
|
1804
|
+
function createGenerateUniqueIdentifierHelper() {
|
|
1805
|
+
const generatedIdentifiers = /* @__PURE__ */ new Set();
|
|
1806
|
+
return (sourceFile, symbolName) => {
|
|
1807
|
+
const sf = sourceFile;
|
|
1808
|
+
if (sf.identifiers === void 0) {
|
|
1809
|
+
throw new Error("Source file unexpectedly lacks map of parsed `identifiers`.");
|
|
1810
|
+
}
|
|
1811
|
+
const isUniqueIdentifier = (name2) => !sf.identifiers.has(name2) && !generatedIdentifiers.has(name2);
|
|
1812
|
+
if (isUniqueIdentifier(symbolName)) {
|
|
1813
|
+
generatedIdentifiers.add(symbolName);
|
|
1814
|
+
return null;
|
|
1815
|
+
}
|
|
1816
|
+
let name = null;
|
|
1817
|
+
let counter = 1;
|
|
1818
|
+
do {
|
|
1819
|
+
name = `${symbolName}_${counter++}`;
|
|
1820
|
+
} while (!isUniqueIdentifier(name));
|
|
1821
|
+
generatedIdentifiers.add(name);
|
|
1822
|
+
return ts12.factory.createUniqueName(name, ts12.GeneratedIdentifierFlags.Optimistic);
|
|
1823
|
+
};
|
|
1824
|
+
}
|
|
1825
|
+
|
|
1826
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/import_manager/import_typescript_transform.mjs
|
|
1827
|
+
import ts13 from "typescript";
|
|
1828
|
+
function createTsTransformForImportManager(manager, extraStatementsForFiles) {
|
|
1829
|
+
return (ctx) => {
|
|
1830
|
+
const { affectedFiles, newImports, updatedImports, reusedOriginalAliasDeclarations } = manager.finalize();
|
|
1831
|
+
if (reusedOriginalAliasDeclarations.size > 0) {
|
|
1832
|
+
const referencedAliasDeclarations = loadIsReferencedAliasDeclarationPatch(ctx);
|
|
1833
|
+
reusedOriginalAliasDeclarations.forEach((aliasDecl) => referencedAliasDeclarations.add(aliasDecl));
|
|
1834
|
+
}
|
|
1835
|
+
if (extraStatementsForFiles !== void 0) {
|
|
1836
|
+
for (const [fileName, statements] of extraStatementsForFiles.entries()) {
|
|
1837
|
+
if (statements.length > 0) {
|
|
1838
|
+
affectedFiles.add(fileName);
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
const visitStatement = (node) => {
|
|
1843
|
+
if (!ts13.isImportDeclaration(node) || node.importClause === void 0 || !ts13.isImportClause(node.importClause)) {
|
|
1844
|
+
return node;
|
|
1845
|
+
}
|
|
1846
|
+
const clause = node.importClause;
|
|
1847
|
+
if (clause.namedBindings === void 0 || !ts13.isNamedImports(clause.namedBindings) || !updatedImports.has(clause.namedBindings)) {
|
|
1848
|
+
return node;
|
|
1849
|
+
}
|
|
1850
|
+
const newClause = ctx.factory.updateImportClause(clause, clause.isTypeOnly, clause.name, updatedImports.get(clause.namedBindings));
|
|
1851
|
+
const newImport = ctx.factory.updateImportDeclaration(node, node.modifiers, newClause, node.moduleSpecifier, node.attributes);
|
|
1852
|
+
ts13.setOriginalNode(newImport, { importClause: newClause, kind: newImport.kind });
|
|
1853
|
+
return newImport;
|
|
1854
|
+
};
|
|
1855
|
+
return (sourceFile) => {
|
|
1856
|
+
var _a, _b;
|
|
1857
|
+
if (!affectedFiles.has(sourceFile.fileName)) {
|
|
1858
|
+
return sourceFile;
|
|
1859
|
+
}
|
|
1860
|
+
sourceFile = ts13.visitEachChild(sourceFile, visitStatement, ctx);
|
|
1861
|
+
const extraStatements = (_a = extraStatementsForFiles == null ? void 0 : extraStatementsForFiles.get(sourceFile.fileName)) != null ? _a : [];
|
|
1862
|
+
const existingImports = [];
|
|
1863
|
+
const body = [];
|
|
1864
|
+
for (const statement of sourceFile.statements) {
|
|
1865
|
+
if (isImportStatement(statement)) {
|
|
1866
|
+
existingImports.push(statement);
|
|
1867
|
+
} else {
|
|
1868
|
+
body.push(statement);
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1871
|
+
return ctx.factory.updateSourceFile(sourceFile, [
|
|
1872
|
+
...existingImports,
|
|
1873
|
+
...(_b = newImports.get(sourceFile.fileName)) != null ? _b : [],
|
|
1874
|
+
...extraStatements,
|
|
1875
|
+
...body
|
|
1876
|
+
], sourceFile.isDeclarationFile, sourceFile.referencedFiles, sourceFile.typeReferenceDirectives, sourceFile.hasNoDefaultLib, sourceFile.libReferenceDirectives);
|
|
1877
|
+
};
|
|
1878
|
+
};
|
|
1879
|
+
}
|
|
1880
|
+
function isImportStatement(stmt) {
|
|
1881
|
+
return ts13.isImportDeclaration(stmt) || ts13.isImportEqualsDeclaration(stmt) || ts13.isNamespaceImport(stmt);
|
|
1882
|
+
}
|
|
1883
|
+
|
|
1884
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/import_manager/reuse_generated_imports.mjs
|
|
1885
|
+
import ts14 from "typescript";
|
|
1886
|
+
function attemptToReuseGeneratedImports(tracker, request) {
|
|
1887
|
+
const requestHash = hashImportRequest(request);
|
|
1888
|
+
const existingExactImport = tracker.directReuseCache.get(requestHash);
|
|
1889
|
+
if (existingExactImport !== void 0) {
|
|
1890
|
+
return existingExactImport;
|
|
1891
|
+
}
|
|
1892
|
+
const potentialNamespaceImport = tracker.namespaceImportReuseCache.get(request.exportModuleSpecifier);
|
|
1893
|
+
if (potentialNamespaceImport === void 0) {
|
|
1894
|
+
return null;
|
|
1895
|
+
}
|
|
1896
|
+
if (request.exportSymbolName === null) {
|
|
1897
|
+
return potentialNamespaceImport;
|
|
1898
|
+
}
|
|
1899
|
+
return [potentialNamespaceImport, ts14.factory.createIdentifier(request.exportSymbolName)];
|
|
1900
|
+
}
|
|
1901
|
+
function captureGeneratedImport(request, tracker, referenceNode) {
|
|
1902
|
+
tracker.directReuseCache.set(hashImportRequest(request), referenceNode);
|
|
1903
|
+
if (request.exportSymbolName === null && !Array.isArray(referenceNode)) {
|
|
1904
|
+
tracker.namespaceImportReuseCache.set(request.exportModuleSpecifier, referenceNode);
|
|
1905
|
+
}
|
|
1906
|
+
}
|
|
1907
|
+
function hashImportRequest(req) {
|
|
1908
|
+
return `${req.requestedFile.fileName}:${req.exportModuleSpecifier}:${req.exportSymbolName}`;
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/import_manager/reuse_source_file_imports.mjs
|
|
1912
|
+
import ts15 from "typescript";
|
|
1913
|
+
function attemptToReuseExistingSourceFileImports(tracker, sourceFile, request) {
|
|
1914
|
+
let candidateImportToBeUpdated = null;
|
|
1915
|
+
for (let i = sourceFile.statements.length - 1; i >= 0; i--) {
|
|
1916
|
+
const statement = sourceFile.statements[i];
|
|
1917
|
+
if (!ts15.isImportDeclaration(statement) || !ts15.isStringLiteral(statement.moduleSpecifier)) {
|
|
1918
|
+
continue;
|
|
1919
|
+
}
|
|
1920
|
+
if (!statement.importClause || statement.importClause.isTypeOnly) {
|
|
1921
|
+
continue;
|
|
1922
|
+
}
|
|
1923
|
+
const moduleSpecifier = statement.moduleSpecifier.text;
|
|
1924
|
+
if (moduleSpecifier !== request.exportModuleSpecifier) {
|
|
1925
|
+
continue;
|
|
1926
|
+
}
|
|
1927
|
+
if (statement.importClause.namedBindings) {
|
|
1928
|
+
const namedBindings = statement.importClause.namedBindings;
|
|
1929
|
+
if (ts15.isNamespaceImport(namedBindings)) {
|
|
1930
|
+
tracker.reusedAliasDeclarations.add(namedBindings);
|
|
1931
|
+
if (request.exportSymbolName === null) {
|
|
1932
|
+
return namedBindings.name;
|
|
1933
|
+
}
|
|
1934
|
+
return [namedBindings.name, ts15.factory.createIdentifier(request.exportSymbolName)];
|
|
1935
|
+
}
|
|
1936
|
+
if (ts15.isNamedImports(namedBindings) && request.exportSymbolName !== null) {
|
|
1937
|
+
const existingElement = namedBindings.elements.find((e) => {
|
|
1938
|
+
return !e.isTypeOnly && (e.propertyName ? e.propertyName.text === request.exportSymbolName : e.name.text === request.exportSymbolName);
|
|
1939
|
+
});
|
|
1940
|
+
if (existingElement !== void 0) {
|
|
1941
|
+
tracker.reusedAliasDeclarations.add(existingElement);
|
|
1942
|
+
return existingElement.name;
|
|
1943
|
+
}
|
|
1944
|
+
candidateImportToBeUpdated = statement;
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
}
|
|
1948
|
+
if (candidateImportToBeUpdated === null || request.exportSymbolName === null) {
|
|
1949
|
+
return null;
|
|
1950
|
+
}
|
|
1951
|
+
if (!tracker.updatedImports.has(candidateImportToBeUpdated)) {
|
|
1952
|
+
tracker.updatedImports.set(candidateImportToBeUpdated, []);
|
|
1953
|
+
}
|
|
1954
|
+
const symbolsToBeImported = tracker.updatedImports.get(candidateImportToBeUpdated);
|
|
1955
|
+
const propertyName = ts15.factory.createIdentifier(request.exportSymbolName);
|
|
1956
|
+
const fileUniqueAlias = tracker.generateUniqueIdentifier(sourceFile, request.exportSymbolName);
|
|
1957
|
+
symbolsToBeImported.push({
|
|
1958
|
+
propertyName,
|
|
1959
|
+
fileUniqueAlias
|
|
1960
|
+
});
|
|
1961
|
+
return fileUniqueAlias != null ? fileUniqueAlias : propertyName;
|
|
1962
|
+
}
|
|
1963
|
+
|
|
1964
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/import_manager/import_manager.mjs
|
|
1965
|
+
var presetImportManagerForceNamespaceImports = {
|
|
1966
|
+
disableOriginalSourceFileReuse: true,
|
|
1967
|
+
forceGenerateNamespacesForNewImports: true
|
|
1968
|
+
};
|
|
1742
1969
|
var ImportManager = class {
|
|
1743
|
-
constructor(
|
|
1744
|
-
|
|
1745
|
-
this.
|
|
1746
|
-
this.
|
|
1747
|
-
this.
|
|
1748
|
-
this.
|
|
1970
|
+
constructor(_config = {}) {
|
|
1971
|
+
var _a;
|
|
1972
|
+
this._config = _config;
|
|
1973
|
+
this.newImports = /* @__PURE__ */ new Map();
|
|
1974
|
+
this.nextUniqueIndex = 0;
|
|
1975
|
+
this.config = {
|
|
1976
|
+
shouldUseSingleQuotes: () => false,
|
|
1977
|
+
rewriter: null,
|
|
1978
|
+
disableOriginalSourceFileReuse: false,
|
|
1979
|
+
forceGenerateNamespacesForNewImports: false,
|
|
1980
|
+
namespaceImportPrefix: "i",
|
|
1981
|
+
generateUniqueIdentifier: (_a = this._config.generateUniqueIdentifier) != null ? _a : createGenerateUniqueIdentifierHelper(),
|
|
1982
|
+
...this._config
|
|
1983
|
+
};
|
|
1984
|
+
this.reuseSourceFileImportsTracker = {
|
|
1985
|
+
generateUniqueIdentifier: this.config.generateUniqueIdentifier,
|
|
1986
|
+
reusedAliasDeclarations: /* @__PURE__ */ new Set(),
|
|
1987
|
+
updatedImports: /* @__PURE__ */ new Map()
|
|
1988
|
+
};
|
|
1989
|
+
this.reuseGeneratedImportsTracker = {
|
|
1990
|
+
directReuseCache: /* @__PURE__ */ new Map(),
|
|
1991
|
+
namespaceImportReuseCache: /* @__PURE__ */ new Map()
|
|
1992
|
+
};
|
|
1749
1993
|
}
|
|
1750
|
-
|
|
1751
|
-
if (
|
|
1752
|
-
this.
|
|
1994
|
+
addSideEffectImport(requestedFile, moduleSpecifier) {
|
|
1995
|
+
if (this.config.rewriter !== null) {
|
|
1996
|
+
moduleSpecifier = this.config.rewriter.rewriteSpecifier(moduleSpecifier, requestedFile.fileName);
|
|
1753
1997
|
}
|
|
1754
|
-
|
|
1998
|
+
this._getNewImportsTrackerForFile(requestedFile).sideEffectImports.add(moduleSpecifier);
|
|
1755
1999
|
}
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
2000
|
+
addImport(request) {
|
|
2001
|
+
if (this.config.rewriter !== null) {
|
|
2002
|
+
if (request.exportSymbolName !== null) {
|
|
2003
|
+
request.exportSymbolName = this.config.rewriter.rewriteSymbol(request.exportSymbolName, request.exportModuleSpecifier);
|
|
2004
|
+
}
|
|
2005
|
+
request.exportModuleSpecifier = this.config.rewriter.rewriteSpecifier(request.exportModuleSpecifier, request.requestedFile.fileName);
|
|
2006
|
+
}
|
|
2007
|
+
const previousGeneratedImportRef = attemptToReuseGeneratedImports(this.reuseGeneratedImportsTracker, request);
|
|
2008
|
+
if (previousGeneratedImportRef !== null) {
|
|
2009
|
+
return createImportReference(!!request.asTypeReference, previousGeneratedImportRef);
|
|
1760
2010
|
}
|
|
1761
|
-
const
|
|
1762
|
-
|
|
2011
|
+
const resultImportRef = this._generateNewImport(request);
|
|
2012
|
+
captureGeneratedImport(request, this.reuseGeneratedImportsTracker, resultImportRef);
|
|
2013
|
+
return createImportReference(!!request.asTypeReference, resultImportRef);
|
|
1763
2014
|
}
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
2015
|
+
_generateNewImport(request) {
|
|
2016
|
+
var _a;
|
|
2017
|
+
const { requestedFile: sourceFile } = request;
|
|
2018
|
+
const disableOriginalSourceFileReuse = this.config.disableOriginalSourceFileReuse;
|
|
2019
|
+
const forceGenerateNamespacesForNewImports = this.config.forceGenerateNamespacesForNewImports;
|
|
2020
|
+
if (!disableOriginalSourceFileReuse) {
|
|
2021
|
+
const reuseResult = attemptToReuseExistingSourceFileImports(this.reuseSourceFileImportsTracker, sourceFile, request);
|
|
2022
|
+
if (reuseResult !== null) {
|
|
2023
|
+
return reuseResult;
|
|
2024
|
+
}
|
|
1767
2025
|
}
|
|
2026
|
+
const { namedImports, namespaceImports } = this._getNewImportsTrackerForFile(sourceFile);
|
|
2027
|
+
if (request.exportSymbolName === null || forceGenerateNamespacesForNewImports) {
|
|
2028
|
+
const namespaceImportName = `${this.config.namespaceImportPrefix}${this.nextUniqueIndex++}`;
|
|
2029
|
+
const namespaceImport2 = ts16.factory.createNamespaceImport((_a = this.config.generateUniqueIdentifier(sourceFile, namespaceImportName)) != null ? _a : ts16.factory.createIdentifier(namespaceImportName));
|
|
2030
|
+
namespaceImports.set(request.exportModuleSpecifier, namespaceImport2);
|
|
2031
|
+
captureGeneratedImport({ ...request, exportSymbolName: null }, this.reuseGeneratedImportsTracker, namespaceImport2.name);
|
|
2032
|
+
if (request.exportSymbolName !== null) {
|
|
2033
|
+
return [namespaceImport2.name, ts16.factory.createIdentifier(request.exportSymbolName)];
|
|
2034
|
+
}
|
|
2035
|
+
return namespaceImport2.name;
|
|
2036
|
+
}
|
|
2037
|
+
if (!namedImports.has(request.exportModuleSpecifier)) {
|
|
2038
|
+
namedImports.set(request.exportModuleSpecifier, []);
|
|
2039
|
+
}
|
|
2040
|
+
const exportSymbolName = ts16.factory.createIdentifier(request.exportSymbolName);
|
|
2041
|
+
const fileUniqueName = this.config.generateUniqueIdentifier(sourceFile, request.exportSymbolName);
|
|
2042
|
+
const needsAlias = fileUniqueName !== null;
|
|
2043
|
+
const specifierName = needsAlias ? fileUniqueName : exportSymbolName;
|
|
2044
|
+
namedImports.get(request.exportModuleSpecifier).push(ts16.factory.createImportSpecifier(false, needsAlias ? exportSymbolName : void 0, specifierName));
|
|
2045
|
+
return specifierName;
|
|
2046
|
+
}
|
|
2047
|
+
finalize() {
|
|
2048
|
+
const affectedFiles = /* @__PURE__ */ new Set();
|
|
2049
|
+
const updatedImportsResult = /* @__PURE__ */ new Map();
|
|
2050
|
+
const newImportsResult = /* @__PURE__ */ new Map();
|
|
2051
|
+
const addNewImport = (fileName, importDecl) => {
|
|
2052
|
+
affectedFiles.add(fileName);
|
|
2053
|
+
if (newImportsResult.has(fileName)) {
|
|
2054
|
+
newImportsResult.get(fileName).push(importDecl);
|
|
2055
|
+
} else {
|
|
2056
|
+
newImportsResult.set(fileName, [importDecl]);
|
|
2057
|
+
}
|
|
2058
|
+
};
|
|
2059
|
+
this.reuseSourceFileImportsTracker.updatedImports.forEach((expressions, importDecl) => {
|
|
2060
|
+
const namedBindings = importDecl.importClause.namedBindings;
|
|
2061
|
+
const newNamedBindings = ts16.factory.updateNamedImports(namedBindings, namedBindings.elements.concat(expressions.map(({ propertyName, fileUniqueAlias }) => ts16.factory.createImportSpecifier(false, fileUniqueAlias !== null ? propertyName : void 0, fileUniqueAlias != null ? fileUniqueAlias : propertyName))));
|
|
2062
|
+
affectedFiles.add(importDecl.getSourceFile().fileName);
|
|
2063
|
+
updatedImportsResult.set(namedBindings, newNamedBindings);
|
|
2064
|
+
});
|
|
2065
|
+
this.newImports.forEach(({ namedImports, namespaceImports, sideEffectImports }, sourceFile) => {
|
|
2066
|
+
const useSingleQuotes = this.config.shouldUseSingleQuotes(sourceFile);
|
|
2067
|
+
const fileName = sourceFile.fileName;
|
|
2068
|
+
sideEffectImports.forEach((moduleName) => {
|
|
2069
|
+
addNewImport(fileName, ts16.factory.createImportDeclaration(void 0, void 0, ts16.factory.createStringLiteral(moduleName)));
|
|
2070
|
+
});
|
|
2071
|
+
namespaceImports.forEach((namespaceImport2, moduleName) => {
|
|
2072
|
+
const newImport = ts16.factory.createImportDeclaration(void 0, ts16.factory.createImportClause(false, void 0, namespaceImport2), ts16.factory.createStringLiteral(moduleName, useSingleQuotes));
|
|
2073
|
+
ts16.setOriginalNode(namespaceImport2.name, newImport);
|
|
2074
|
+
addNewImport(fileName, newImport);
|
|
2075
|
+
});
|
|
2076
|
+
namedImports.forEach((specifiers, moduleName) => {
|
|
2077
|
+
const newImport = ts16.factory.createImportDeclaration(void 0, ts16.factory.createImportClause(false, void 0, ts16.factory.createNamedImports(specifiers)), ts16.factory.createStringLiteral(moduleName, useSingleQuotes));
|
|
2078
|
+
addNewImport(fileName, newImport);
|
|
2079
|
+
});
|
|
2080
|
+
});
|
|
2081
|
+
return {
|
|
2082
|
+
affectedFiles,
|
|
2083
|
+
newImports: newImportsResult,
|
|
2084
|
+
updatedImports: updatedImportsResult,
|
|
2085
|
+
reusedOriginalAliasDeclarations: this.reuseSourceFileImportsTracker.reusedAliasDeclarations
|
|
2086
|
+
};
|
|
2087
|
+
}
|
|
2088
|
+
toTsTransform(extraStatementsMap) {
|
|
2089
|
+
return createTsTransformForImportManager(this, extraStatementsMap);
|
|
1768
2090
|
}
|
|
1769
|
-
|
|
1770
|
-
const
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
2091
|
+
transformTsFile(ctx, file, extraStatementsAfterImports) {
|
|
2092
|
+
const extraStatementsMap = extraStatementsAfterImports ? /* @__PURE__ */ new Map([[file.fileName, extraStatementsAfterImports]]) : void 0;
|
|
2093
|
+
return this.toTsTransform(extraStatementsMap)(ctx)(file);
|
|
2094
|
+
}
|
|
2095
|
+
_getNewImportsTrackerForFile(file) {
|
|
2096
|
+
if (!this.newImports.has(file)) {
|
|
2097
|
+
this.newImports.set(file, {
|
|
2098
|
+
namespaceImports: /* @__PURE__ */ new Map(),
|
|
2099
|
+
namedImports: /* @__PURE__ */ new Map(),
|
|
2100
|
+
sideEffectImports: /* @__PURE__ */ new Set()
|
|
1776
2101
|
});
|
|
1777
2102
|
}
|
|
1778
|
-
return
|
|
2103
|
+
return this.newImports.get(file);
|
|
1779
2104
|
}
|
|
1780
2105
|
};
|
|
2106
|
+
function createImportReference(asTypeReference, ref) {
|
|
2107
|
+
if (asTypeReference) {
|
|
2108
|
+
return Array.isArray(ref) ? ts16.factory.createQualifiedName(ref[0], ref[1]) : ref;
|
|
2109
|
+
} else {
|
|
2110
|
+
return Array.isArray(ref) ? ts16.factory.createPropertyAccessExpression(ref[0], ref[1]) : ref;
|
|
2111
|
+
}
|
|
2112
|
+
}
|
|
1781
2113
|
|
|
1782
|
-
// bazel-out/
|
|
2114
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/context.mjs
|
|
1783
2115
|
var Context = class {
|
|
1784
2116
|
constructor(isStatement) {
|
|
1785
2117
|
this.isStatement = isStatement;
|
|
@@ -1792,7 +2124,7 @@ var Context = class {
|
|
|
1792
2124
|
}
|
|
1793
2125
|
};
|
|
1794
2126
|
|
|
1795
|
-
// bazel-out/
|
|
2127
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/translator.mjs
|
|
1796
2128
|
import * as o from "@angular/compiler";
|
|
1797
2129
|
var UNARY_OPERATORS = /* @__PURE__ */ new Map([
|
|
1798
2130
|
[o.UnaryOperator.Minus, "-"],
|
|
@@ -1819,9 +2151,10 @@ var BINARY_OPERATORS = /* @__PURE__ */ new Map([
|
|
|
1819
2151
|
[o.BinaryOperator.NullishCoalesce, "??"]
|
|
1820
2152
|
]);
|
|
1821
2153
|
var ExpressionTranslatorVisitor = class {
|
|
1822
|
-
constructor(factory, imports, options) {
|
|
2154
|
+
constructor(factory, imports, contextFile, options) {
|
|
1823
2155
|
this.factory = factory;
|
|
1824
2156
|
this.imports = imports;
|
|
2157
|
+
this.contextFile = contextFile;
|
|
1825
2158
|
this.downlevelTaggedTemplates = options.downlevelTaggedTemplates === true;
|
|
1826
2159
|
this.downlevelVariableDeclarations = options.downlevelVariableDeclarations === true;
|
|
1827
2160
|
this.recordWrappedNode = options.recordWrappedNode || (() => {
|
|
@@ -1900,8 +2233,11 @@ var ExpressionTranslatorVisitor = class {
|
|
|
1900
2233
|
return this.downlevelTaggedTemplates ? this.createES5TaggedTemplateFunctionCall(tag, template) : this.factory.createTaggedTemplate(tag, template);
|
|
1901
2234
|
}
|
|
1902
2235
|
createES5TaggedTemplateFunctionCall(tagHandler, { elements, expressions }) {
|
|
1903
|
-
const
|
|
1904
|
-
|
|
2236
|
+
const __makeTemplateObjectHelper = this.imports.addImport({
|
|
2237
|
+
exportModuleSpecifier: "tslib",
|
|
2238
|
+
exportSymbolName: "__makeTemplateObject",
|
|
2239
|
+
requestedFile: this.contextFile
|
|
2240
|
+
});
|
|
1905
2241
|
const cooked = [];
|
|
1906
2242
|
const raw = [];
|
|
1907
2243
|
for (const element of elements) {
|
|
@@ -1924,15 +2260,18 @@ var ExpressionTranslatorVisitor = class {
|
|
|
1924
2260
|
if (ast.value.moduleName === null) {
|
|
1925
2261
|
throw new Error("Invalid import without name nor moduleName");
|
|
1926
2262
|
}
|
|
1927
|
-
return this.imports.
|
|
2263
|
+
return this.imports.addImport({
|
|
2264
|
+
exportModuleSpecifier: ast.value.moduleName,
|
|
2265
|
+
exportSymbolName: null,
|
|
2266
|
+
requestedFile: this.contextFile
|
|
2267
|
+
});
|
|
1928
2268
|
}
|
|
1929
2269
|
if (ast.value.moduleName !== null) {
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
}
|
|
2270
|
+
return this.imports.addImport({
|
|
2271
|
+
exportModuleSpecifier: ast.value.moduleName,
|
|
2272
|
+
exportSymbolName: ast.value.name,
|
|
2273
|
+
requestedFile: this.contextFile
|
|
2274
|
+
});
|
|
1936
2275
|
} else {
|
|
1937
2276
|
return this.factory.createIdentifier(ast.value.name);
|
|
1938
2277
|
}
|
|
@@ -2031,8 +2370,8 @@ function createRange(span) {
|
|
|
2031
2370
|
};
|
|
2032
2371
|
}
|
|
2033
2372
|
|
|
2034
|
-
// bazel-out/
|
|
2035
|
-
import
|
|
2373
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/type_emitter.mjs
|
|
2374
|
+
import ts17 from "typescript";
|
|
2036
2375
|
var INELIGIBLE = {};
|
|
2037
2376
|
function canEmitType(type, canEmit) {
|
|
2038
2377
|
return canEmitTypeWorker(type);
|
|
@@ -2040,13 +2379,13 @@ function canEmitType(type, canEmit) {
|
|
|
2040
2379
|
return visitNode(type2) !== INELIGIBLE;
|
|
2041
2380
|
}
|
|
2042
2381
|
function visitNode(node) {
|
|
2043
|
-
if (
|
|
2382
|
+
if (ts17.isImportTypeNode(node)) {
|
|
2044
2383
|
return INELIGIBLE;
|
|
2045
2384
|
}
|
|
2046
|
-
if (
|
|
2385
|
+
if (ts17.isTypeReferenceNode(node) && !canEmitTypeReference(node)) {
|
|
2047
2386
|
return INELIGIBLE;
|
|
2048
2387
|
} else {
|
|
2049
|
-
return
|
|
2388
|
+
return ts17.forEachChild(node, visitNode);
|
|
2050
2389
|
}
|
|
2051
2390
|
}
|
|
2052
2391
|
function canEmitTypeReference(type2) {
|
|
@@ -2063,35 +2402,35 @@ var TypeEmitter = class {
|
|
|
2063
2402
|
emitType(type) {
|
|
2064
2403
|
const typeReferenceTransformer = (context) => {
|
|
2065
2404
|
const visitNode = (node) => {
|
|
2066
|
-
if (
|
|
2405
|
+
if (ts17.isImportTypeNode(node)) {
|
|
2067
2406
|
throw new Error("Unable to emit import type");
|
|
2068
2407
|
}
|
|
2069
|
-
if (
|
|
2408
|
+
if (ts17.isTypeReferenceNode(node)) {
|
|
2070
2409
|
return this.emitTypeReference(node);
|
|
2071
|
-
} else if (
|
|
2410
|
+
} else if (ts17.isLiteralExpression(node)) {
|
|
2072
2411
|
let clone;
|
|
2073
|
-
if (
|
|
2074
|
-
clone =
|
|
2075
|
-
} else if (
|
|
2076
|
-
clone =
|
|
2077
|
-
} else if (
|
|
2078
|
-
clone =
|
|
2079
|
-
} else if (
|
|
2080
|
-
clone =
|
|
2081
|
-
} else if (
|
|
2082
|
-
clone =
|
|
2412
|
+
if (ts17.isStringLiteral(node)) {
|
|
2413
|
+
clone = ts17.factory.createStringLiteral(node.text);
|
|
2414
|
+
} else if (ts17.isNumericLiteral(node)) {
|
|
2415
|
+
clone = ts17.factory.createNumericLiteral(node.text);
|
|
2416
|
+
} else if (ts17.isBigIntLiteral(node)) {
|
|
2417
|
+
clone = ts17.factory.createBigIntLiteral(node.text);
|
|
2418
|
+
} else if (ts17.isNoSubstitutionTemplateLiteral(node)) {
|
|
2419
|
+
clone = ts17.factory.createNoSubstitutionTemplateLiteral(node.text, node.rawText);
|
|
2420
|
+
} else if (ts17.isRegularExpressionLiteral(node)) {
|
|
2421
|
+
clone = ts17.factory.createRegularExpressionLiteral(node.text);
|
|
2083
2422
|
} else {
|
|
2084
|
-
throw new Error(`Unsupported literal kind ${
|
|
2423
|
+
throw new Error(`Unsupported literal kind ${ts17.SyntaxKind[node.kind]}`);
|
|
2085
2424
|
}
|
|
2086
|
-
|
|
2425
|
+
ts17.setTextRange(clone, { pos: -1, end: -1 });
|
|
2087
2426
|
return clone;
|
|
2088
2427
|
} else {
|
|
2089
|
-
return
|
|
2428
|
+
return ts17.visitEachChild(node, visitNode, context);
|
|
2090
2429
|
}
|
|
2091
2430
|
};
|
|
2092
|
-
return (node) =>
|
|
2431
|
+
return (node) => ts17.visitNode(node, visitNode, ts17.isTypeNode);
|
|
2093
2432
|
};
|
|
2094
|
-
return
|
|
2433
|
+
return ts17.transform(type, [typeReferenceTransformer]).transformed[0];
|
|
2095
2434
|
}
|
|
2096
2435
|
emitTypeReference(type) {
|
|
2097
2436
|
const translatedType = this.translator(type);
|
|
@@ -2100,27 +2439,27 @@ var TypeEmitter = class {
|
|
|
2100
2439
|
}
|
|
2101
2440
|
let typeArguments = void 0;
|
|
2102
2441
|
if (type.typeArguments !== void 0) {
|
|
2103
|
-
typeArguments =
|
|
2442
|
+
typeArguments = ts17.factory.createNodeArray(type.typeArguments.map((typeArg) => this.emitType(typeArg)));
|
|
2104
2443
|
}
|
|
2105
|
-
return
|
|
2444
|
+
return ts17.factory.updateTypeReferenceNode(type, translatedType.typeName, typeArguments);
|
|
2106
2445
|
}
|
|
2107
2446
|
};
|
|
2108
2447
|
|
|
2109
|
-
// bazel-out/
|
|
2448
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/type_translator.mjs
|
|
2110
2449
|
import * as o2 from "@angular/compiler";
|
|
2111
|
-
import
|
|
2450
|
+
import ts19 from "typescript";
|
|
2112
2451
|
|
|
2113
|
-
// bazel-out/
|
|
2114
|
-
import
|
|
2452
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/ts_util.mjs
|
|
2453
|
+
import ts18 from "typescript";
|
|
2115
2454
|
function tsNumericExpression(value) {
|
|
2116
2455
|
if (value < 0) {
|
|
2117
|
-
const operand =
|
|
2118
|
-
return
|
|
2456
|
+
const operand = ts18.factory.createNumericLiteral(Math.abs(value));
|
|
2457
|
+
return ts18.factory.createPrefixUnaryExpression(ts18.SyntaxKind.MinusToken, operand);
|
|
2119
2458
|
}
|
|
2120
|
-
return
|
|
2459
|
+
return ts18.factory.createNumericLiteral(value);
|
|
2121
2460
|
}
|
|
2122
2461
|
|
|
2123
|
-
// bazel-out/
|
|
2462
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/type_translator.mjs
|
|
2124
2463
|
function translateType(type, contextFile, reflector, refEmitter, imports) {
|
|
2125
2464
|
return type.visitType(new TypeTranslatorVisitor(imports, contextFile, reflector, refEmitter), new Context(false));
|
|
2126
2465
|
}
|
|
@@ -2134,16 +2473,16 @@ var TypeTranslatorVisitor = class {
|
|
|
2134
2473
|
visitBuiltinType(type, context) {
|
|
2135
2474
|
switch (type.name) {
|
|
2136
2475
|
case o2.BuiltinTypeName.Bool:
|
|
2137
|
-
return
|
|
2476
|
+
return ts19.factory.createKeywordTypeNode(ts19.SyntaxKind.BooleanKeyword);
|
|
2138
2477
|
case o2.BuiltinTypeName.Dynamic:
|
|
2139
|
-
return
|
|
2478
|
+
return ts19.factory.createKeywordTypeNode(ts19.SyntaxKind.AnyKeyword);
|
|
2140
2479
|
case o2.BuiltinTypeName.Int:
|
|
2141
2480
|
case o2.BuiltinTypeName.Number:
|
|
2142
|
-
return
|
|
2481
|
+
return ts19.factory.createKeywordTypeNode(ts19.SyntaxKind.NumberKeyword);
|
|
2143
2482
|
case o2.BuiltinTypeName.String:
|
|
2144
|
-
return
|
|
2483
|
+
return ts19.factory.createKeywordTypeNode(ts19.SyntaxKind.StringKeyword);
|
|
2145
2484
|
case o2.BuiltinTypeName.None:
|
|
2146
|
-
return
|
|
2485
|
+
return ts19.factory.createKeywordTypeNode(ts19.SyntaxKind.NeverKeyword);
|
|
2147
2486
|
default:
|
|
2148
2487
|
throw new Error(`Unsupported builtin type: ${o2.BuiltinTypeName[type.name]}`);
|
|
2149
2488
|
}
|
|
@@ -2153,26 +2492,26 @@ var TypeTranslatorVisitor = class {
|
|
|
2153
2492
|
if (type.typeParams === null) {
|
|
2154
2493
|
return typeNode;
|
|
2155
2494
|
}
|
|
2156
|
-
if (!
|
|
2495
|
+
if (!ts19.isTypeReferenceNode(typeNode)) {
|
|
2157
2496
|
throw new Error("An ExpressionType with type arguments must translate into a TypeReferenceNode");
|
|
2158
2497
|
} else if (typeNode.typeArguments !== void 0) {
|
|
2159
2498
|
throw new Error(`An ExpressionType with type arguments cannot have multiple levels of type arguments`);
|
|
2160
2499
|
}
|
|
2161
2500
|
const typeArgs = type.typeParams.map((param) => this.translateType(param, context));
|
|
2162
|
-
return
|
|
2501
|
+
return ts19.factory.createTypeReferenceNode(typeNode.typeName, typeArgs);
|
|
2163
2502
|
}
|
|
2164
2503
|
visitArrayType(type, context) {
|
|
2165
|
-
return
|
|
2504
|
+
return ts19.factory.createArrayTypeNode(this.translateType(type.of, context));
|
|
2166
2505
|
}
|
|
2167
2506
|
visitMapType(type, context) {
|
|
2168
|
-
const parameter =
|
|
2169
|
-
const typeArgs = type.valueType !== null ? this.translateType(type.valueType, context) :
|
|
2170
|
-
const indexSignature =
|
|
2171
|
-
return
|
|
2507
|
+
const parameter = ts19.factory.createParameterDeclaration(void 0, void 0, "key", void 0, ts19.factory.createKeywordTypeNode(ts19.SyntaxKind.StringKeyword));
|
|
2508
|
+
const typeArgs = type.valueType !== null ? this.translateType(type.valueType, context) : ts19.factory.createKeywordTypeNode(ts19.SyntaxKind.UnknownKeyword);
|
|
2509
|
+
const indexSignature = ts19.factory.createIndexSignature(void 0, [parameter], typeArgs);
|
|
2510
|
+
return ts19.factory.createTypeLiteralNode([indexSignature]);
|
|
2172
2511
|
}
|
|
2173
2512
|
visitTransplantedType(ast, context) {
|
|
2174
2513
|
const node = ast.type instanceof Reference ? ast.type.node : ast.type;
|
|
2175
|
-
if (!
|
|
2514
|
+
if (!ts19.isTypeNode(node)) {
|
|
2176
2515
|
throw new Error(`A TransplantedType must wrap a TypeNode`);
|
|
2177
2516
|
}
|
|
2178
2517
|
const viaModule = ast.type instanceof Reference ? ast.type.bestGuessOwningModule : null;
|
|
@@ -2183,7 +2522,7 @@ var TypeTranslatorVisitor = class {
|
|
|
2183
2522
|
if (ast.name === null) {
|
|
2184
2523
|
throw new Error(`ReadVarExpr with no variable name in type`);
|
|
2185
2524
|
}
|
|
2186
|
-
return
|
|
2525
|
+
return ts19.factory.createTypeQueryNode(ts19.factory.createIdentifier(ast.name));
|
|
2187
2526
|
}
|
|
2188
2527
|
visitWriteVarExpr(expr, context) {
|
|
2189
2528
|
throw new Error("Method not implemented.");
|
|
@@ -2205,15 +2544,15 @@ var TypeTranslatorVisitor = class {
|
|
|
2205
2544
|
}
|
|
2206
2545
|
visitLiteralExpr(ast, context) {
|
|
2207
2546
|
if (ast.value === null) {
|
|
2208
|
-
return
|
|
2547
|
+
return ts19.factory.createLiteralTypeNode(ts19.factory.createNull());
|
|
2209
2548
|
} else if (ast.value === void 0) {
|
|
2210
|
-
return
|
|
2549
|
+
return ts19.factory.createKeywordTypeNode(ts19.SyntaxKind.UndefinedKeyword);
|
|
2211
2550
|
} else if (typeof ast.value === "boolean") {
|
|
2212
|
-
return
|
|
2551
|
+
return ts19.factory.createLiteralTypeNode(ast.value ? ts19.factory.createTrue() : ts19.factory.createFalse());
|
|
2213
2552
|
} else if (typeof ast.value === "number") {
|
|
2214
|
-
return
|
|
2553
|
+
return ts19.factory.createLiteralTypeNode(tsNumericExpression(ast.value));
|
|
2215
2554
|
} else {
|
|
2216
|
-
return
|
|
2555
|
+
return ts19.factory.createLiteralTypeNode(ts19.factory.createStringLiteral(ast.value));
|
|
2217
2556
|
}
|
|
2218
2557
|
}
|
|
2219
2558
|
visitLocalizedString(ast, context) {
|
|
@@ -2223,11 +2562,14 @@ var TypeTranslatorVisitor = class {
|
|
|
2223
2562
|
if (ast.value.moduleName === null || ast.value.name === null) {
|
|
2224
2563
|
throw new Error(`Import unknown module or symbol`);
|
|
2225
2564
|
}
|
|
2226
|
-
const
|
|
2227
|
-
|
|
2228
|
-
|
|
2565
|
+
const typeName = this.imports.addImport({
|
|
2566
|
+
exportModuleSpecifier: ast.value.moduleName,
|
|
2567
|
+
exportSymbolName: ast.value.name,
|
|
2568
|
+
requestedFile: this.contextFile,
|
|
2569
|
+
asTypeReference: true
|
|
2570
|
+
});
|
|
2229
2571
|
const typeArguments = ast.typeParams !== null ? ast.typeParams.map((type) => this.translateType(type, context)) : void 0;
|
|
2230
|
-
return
|
|
2572
|
+
return ts19.factory.createTypeReferenceNode(typeName, typeArguments);
|
|
2231
2573
|
}
|
|
2232
2574
|
visitConditionalExpr(ast, context) {
|
|
2233
2575
|
throw new Error("Method not implemented.");
|
|
@@ -2258,60 +2600,60 @@ var TypeTranslatorVisitor = class {
|
|
|
2258
2600
|
}
|
|
2259
2601
|
visitLiteralArrayExpr(ast, context) {
|
|
2260
2602
|
const values = ast.entries.map((expr) => this.translateExpression(expr, context));
|
|
2261
|
-
return
|
|
2603
|
+
return ts19.factory.createTupleTypeNode(values);
|
|
2262
2604
|
}
|
|
2263
2605
|
visitLiteralMapExpr(ast, context) {
|
|
2264
2606
|
const entries = ast.entries.map((entry) => {
|
|
2265
2607
|
const { key, quoted } = entry;
|
|
2266
2608
|
const type = this.translateExpression(entry.value, context);
|
|
2267
|
-
return
|
|
2609
|
+
return ts19.factory.createPropertySignature(
|
|
2268
2610
|
void 0,
|
|
2269
|
-
quoted ?
|
|
2611
|
+
quoted ? ts19.factory.createStringLiteral(key) : key,
|
|
2270
2612
|
void 0,
|
|
2271
2613
|
type
|
|
2272
2614
|
);
|
|
2273
2615
|
});
|
|
2274
|
-
return
|
|
2616
|
+
return ts19.factory.createTypeLiteralNode(entries);
|
|
2275
2617
|
}
|
|
2276
2618
|
visitCommaExpr(ast, context) {
|
|
2277
2619
|
throw new Error("Method not implemented.");
|
|
2278
2620
|
}
|
|
2279
2621
|
visitWrappedNodeExpr(ast, context) {
|
|
2280
2622
|
const node = ast.node;
|
|
2281
|
-
if (
|
|
2282
|
-
return
|
|
2283
|
-
} else if (
|
|
2623
|
+
if (ts19.isEntityName(node)) {
|
|
2624
|
+
return ts19.factory.createTypeReferenceNode(node, void 0);
|
|
2625
|
+
} else if (ts19.isTypeNode(node)) {
|
|
2284
2626
|
return node;
|
|
2285
|
-
} else if (
|
|
2286
|
-
return
|
|
2627
|
+
} else if (ts19.isLiteralExpression(node)) {
|
|
2628
|
+
return ts19.factory.createLiteralTypeNode(node);
|
|
2287
2629
|
} else {
|
|
2288
|
-
throw new Error(`Unsupported WrappedNodeExpr in TypeTranslatorVisitor: ${
|
|
2630
|
+
throw new Error(`Unsupported WrappedNodeExpr in TypeTranslatorVisitor: ${ts19.SyntaxKind[node.kind]}`);
|
|
2289
2631
|
}
|
|
2290
2632
|
}
|
|
2291
2633
|
visitTypeofExpr(ast, context) {
|
|
2292
2634
|
const typeNode = this.translateExpression(ast.expr, context);
|
|
2293
|
-
if (!
|
|
2635
|
+
if (!ts19.isTypeReferenceNode(typeNode)) {
|
|
2294
2636
|
throw new Error(`The target of a typeof expression must be a type reference, but it was
|
|
2295
|
-
${
|
|
2637
|
+
${ts19.SyntaxKind[typeNode.kind]}`);
|
|
2296
2638
|
}
|
|
2297
|
-
return
|
|
2639
|
+
return ts19.factory.createTypeQueryNode(typeNode.typeName);
|
|
2298
2640
|
}
|
|
2299
2641
|
translateType(type, context) {
|
|
2300
2642
|
const typeNode = type.visitType(this, context);
|
|
2301
|
-
if (!
|
|
2302
|
-
throw new Error(`A Type must translate to a TypeNode, but was ${
|
|
2643
|
+
if (!ts19.isTypeNode(typeNode)) {
|
|
2644
|
+
throw new Error(`A Type must translate to a TypeNode, but was ${ts19.SyntaxKind[typeNode.kind]}`);
|
|
2303
2645
|
}
|
|
2304
2646
|
return typeNode;
|
|
2305
2647
|
}
|
|
2306
2648
|
translateExpression(expr, context) {
|
|
2307
2649
|
const typeNode = expr.visitExpression(this, context);
|
|
2308
|
-
if (!
|
|
2309
|
-
throw new Error(`An Expression must translate to a TypeNode, but was ${
|
|
2650
|
+
if (!ts19.isTypeNode(typeNode)) {
|
|
2651
|
+
throw new Error(`An Expression must translate to a TypeNode, but was ${ts19.SyntaxKind[typeNode.kind]}`);
|
|
2310
2652
|
}
|
|
2311
2653
|
return typeNode;
|
|
2312
2654
|
}
|
|
2313
2655
|
translateTypeReference(type, context, viaModule) {
|
|
2314
|
-
const target =
|
|
2656
|
+
const target = ts19.isIdentifier(type.typeName) ? type.typeName : type.typeName.right;
|
|
2315
2657
|
const declaration = this.reflector.getDeclarationOfIdentifier(target);
|
|
2316
2658
|
if (declaration === null) {
|
|
2317
2659
|
throw new Error(`Unable to statically determine the declaration file of type node ${target.text}`);
|
|
@@ -2327,79 +2669,79 @@ var TypeTranslatorVisitor = class {
|
|
|
2327
2669
|
const emittedType = this.refEmitter.emit(reference, this.contextFile, ImportFlags.NoAliasing | ImportFlags.AllowTypeImports | ImportFlags.AllowAmbientReferences);
|
|
2328
2670
|
assertSuccessfulReferenceEmit(emittedType, target, "type");
|
|
2329
2671
|
const typeNode = this.translateExpression(emittedType.expression, context);
|
|
2330
|
-
if (!
|
|
2331
|
-
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${
|
|
2672
|
+
if (!ts19.isTypeReferenceNode(typeNode)) {
|
|
2673
|
+
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${ts19.SyntaxKind[typeNode.kind]}.`);
|
|
2332
2674
|
}
|
|
2333
2675
|
return typeNode;
|
|
2334
2676
|
}
|
|
2335
2677
|
};
|
|
2336
2678
|
|
|
2337
|
-
// bazel-out/
|
|
2338
|
-
import
|
|
2679
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/typescript_ast_factory.mjs
|
|
2680
|
+
import ts20 from "typescript";
|
|
2339
2681
|
var PureAnnotation;
|
|
2340
2682
|
(function(PureAnnotation2) {
|
|
2341
2683
|
PureAnnotation2["CLOSURE"] = "* @pureOrBreakMyCode ";
|
|
2342
2684
|
PureAnnotation2["TERSER"] = "@__PURE__";
|
|
2343
2685
|
})(PureAnnotation || (PureAnnotation = {}));
|
|
2344
2686
|
var UNARY_OPERATORS2 = {
|
|
2345
|
-
"+":
|
|
2346
|
-
"-":
|
|
2347
|
-
"!":
|
|
2687
|
+
"+": ts20.SyntaxKind.PlusToken,
|
|
2688
|
+
"-": ts20.SyntaxKind.MinusToken,
|
|
2689
|
+
"!": ts20.SyntaxKind.ExclamationToken
|
|
2348
2690
|
};
|
|
2349
2691
|
var BINARY_OPERATORS2 = {
|
|
2350
|
-
"&&":
|
|
2351
|
-
">":
|
|
2352
|
-
">=":
|
|
2353
|
-
"&":
|
|
2354
|
-
"|":
|
|
2355
|
-
"/":
|
|
2356
|
-
"==":
|
|
2357
|
-
"===":
|
|
2358
|
-
"<":
|
|
2359
|
-
"<=":
|
|
2360
|
-
"-":
|
|
2361
|
-
"%":
|
|
2362
|
-
"*":
|
|
2363
|
-
"!=":
|
|
2364
|
-
"!==":
|
|
2365
|
-
"||":
|
|
2366
|
-
"+":
|
|
2367
|
-
"??":
|
|
2692
|
+
"&&": ts20.SyntaxKind.AmpersandAmpersandToken,
|
|
2693
|
+
">": ts20.SyntaxKind.GreaterThanToken,
|
|
2694
|
+
">=": ts20.SyntaxKind.GreaterThanEqualsToken,
|
|
2695
|
+
"&": ts20.SyntaxKind.AmpersandToken,
|
|
2696
|
+
"|": ts20.SyntaxKind.BarToken,
|
|
2697
|
+
"/": ts20.SyntaxKind.SlashToken,
|
|
2698
|
+
"==": ts20.SyntaxKind.EqualsEqualsToken,
|
|
2699
|
+
"===": ts20.SyntaxKind.EqualsEqualsEqualsToken,
|
|
2700
|
+
"<": ts20.SyntaxKind.LessThanToken,
|
|
2701
|
+
"<=": ts20.SyntaxKind.LessThanEqualsToken,
|
|
2702
|
+
"-": ts20.SyntaxKind.MinusToken,
|
|
2703
|
+
"%": ts20.SyntaxKind.PercentToken,
|
|
2704
|
+
"*": ts20.SyntaxKind.AsteriskToken,
|
|
2705
|
+
"!=": ts20.SyntaxKind.ExclamationEqualsToken,
|
|
2706
|
+
"!==": ts20.SyntaxKind.ExclamationEqualsEqualsToken,
|
|
2707
|
+
"||": ts20.SyntaxKind.BarBarToken,
|
|
2708
|
+
"+": ts20.SyntaxKind.PlusToken,
|
|
2709
|
+
"??": ts20.SyntaxKind.QuestionQuestionToken
|
|
2368
2710
|
};
|
|
2369
2711
|
var VAR_TYPES = {
|
|
2370
|
-
"const":
|
|
2371
|
-
"let":
|
|
2372
|
-
"var":
|
|
2712
|
+
"const": ts20.NodeFlags.Const,
|
|
2713
|
+
"let": ts20.NodeFlags.Let,
|
|
2714
|
+
"var": ts20.NodeFlags.None
|
|
2373
2715
|
};
|
|
2374
2716
|
var TypeScriptAstFactory = class {
|
|
2375
2717
|
constructor(annotateForClosureCompiler) {
|
|
2376
2718
|
this.annotateForClosureCompiler = annotateForClosureCompiler;
|
|
2377
2719
|
this.externalSourceFiles = /* @__PURE__ */ new Map();
|
|
2378
2720
|
this.attachComments = attachComments;
|
|
2379
|
-
this.createArrayLiteral =
|
|
2380
|
-
this.createElementAccess =
|
|
2381
|
-
this.createExpressionStatement =
|
|
2382
|
-
this.createIdentifier =
|
|
2383
|
-
this.createParenthesizedExpression =
|
|
2384
|
-
this.createPropertyAccess =
|
|
2385
|
-
this.createThrowStatement =
|
|
2386
|
-
this.createTypeOfExpression =
|
|
2721
|
+
this.createArrayLiteral = ts20.factory.createArrayLiteralExpression;
|
|
2722
|
+
this.createElementAccess = ts20.factory.createElementAccessExpression;
|
|
2723
|
+
this.createExpressionStatement = ts20.factory.createExpressionStatement;
|
|
2724
|
+
this.createIdentifier = ts20.factory.createIdentifier;
|
|
2725
|
+
this.createParenthesizedExpression = ts20.factory.createParenthesizedExpression;
|
|
2726
|
+
this.createPropertyAccess = ts20.factory.createPropertyAccessExpression;
|
|
2727
|
+
this.createThrowStatement = ts20.factory.createThrowStatement;
|
|
2728
|
+
this.createTypeOfExpression = ts20.factory.createTypeOfExpression;
|
|
2387
2729
|
}
|
|
2388
2730
|
createAssignment(target, value) {
|
|
2389
|
-
return
|
|
2731
|
+
return ts20.factory.createBinaryExpression(target, ts20.SyntaxKind.EqualsToken, value);
|
|
2390
2732
|
}
|
|
2391
2733
|
createBinaryExpression(leftOperand, operator, rightOperand) {
|
|
2392
|
-
return
|
|
2734
|
+
return ts20.factory.createBinaryExpression(leftOperand, BINARY_OPERATORS2[operator], rightOperand);
|
|
2393
2735
|
}
|
|
2394
2736
|
createBlock(body) {
|
|
2395
|
-
return
|
|
2737
|
+
return ts20.factory.createBlock(body);
|
|
2396
2738
|
}
|
|
2397
2739
|
createCallExpression(callee, args, pure) {
|
|
2398
|
-
const call =
|
|
2740
|
+
const call = ts20.factory.createCallExpression(callee, void 0, args);
|
|
2399
2741
|
if (pure) {
|
|
2400
|
-
|
|
2742
|
+
ts20.addSyntheticLeadingComment(
|
|
2401
2743
|
call,
|
|
2402
|
-
|
|
2744
|
+
ts20.SyntaxKind.MultiLineCommentTrivia,
|
|
2403
2745
|
this.annotateForClosureCompiler ? PureAnnotation.CLOSURE : PureAnnotation.TERSER,
|
|
2404
2746
|
false
|
|
2405
2747
|
);
|
|
@@ -2407,64 +2749,64 @@ var TypeScriptAstFactory = class {
|
|
|
2407
2749
|
return call;
|
|
2408
2750
|
}
|
|
2409
2751
|
createConditional(condition, whenTrue, whenFalse) {
|
|
2410
|
-
return
|
|
2752
|
+
return ts20.factory.createConditionalExpression(condition, void 0, whenTrue, void 0, whenFalse);
|
|
2411
2753
|
}
|
|
2412
2754
|
createDynamicImport(url) {
|
|
2413
|
-
return
|
|
2414
|
-
|
|
2755
|
+
return ts20.factory.createCallExpression(
|
|
2756
|
+
ts20.factory.createToken(ts20.SyntaxKind.ImportKeyword),
|
|
2415
2757
|
void 0,
|
|
2416
|
-
[
|
|
2758
|
+
[ts20.factory.createStringLiteral(url)]
|
|
2417
2759
|
);
|
|
2418
2760
|
}
|
|
2419
2761
|
createFunctionDeclaration(functionName, parameters, body) {
|
|
2420
|
-
if (!
|
|
2421
|
-
throw new Error(`Invalid syntax, expected a block, but got ${
|
|
2762
|
+
if (!ts20.isBlock(body)) {
|
|
2763
|
+
throw new Error(`Invalid syntax, expected a block, but got ${ts20.SyntaxKind[body.kind]}.`);
|
|
2422
2764
|
}
|
|
2423
|
-
return
|
|
2765
|
+
return ts20.factory.createFunctionDeclaration(void 0, void 0, functionName, void 0, parameters.map((param) => ts20.factory.createParameterDeclaration(void 0, void 0, param)), void 0, body);
|
|
2424
2766
|
}
|
|
2425
2767
|
createFunctionExpression(functionName, parameters, body) {
|
|
2426
|
-
if (!
|
|
2427
|
-
throw new Error(`Invalid syntax, expected a block, but got ${
|
|
2768
|
+
if (!ts20.isBlock(body)) {
|
|
2769
|
+
throw new Error(`Invalid syntax, expected a block, but got ${ts20.SyntaxKind[body.kind]}.`);
|
|
2428
2770
|
}
|
|
2429
|
-
return
|
|
2771
|
+
return ts20.factory.createFunctionExpression(void 0, void 0, functionName != null ? functionName : void 0, void 0, parameters.map((param) => ts20.factory.createParameterDeclaration(void 0, void 0, param)), void 0, body);
|
|
2430
2772
|
}
|
|
2431
2773
|
createArrowFunctionExpression(parameters, body) {
|
|
2432
|
-
if (
|
|
2433
|
-
throw new Error(`Invalid syntax, expected a block, but got ${
|
|
2774
|
+
if (ts20.isStatement(body) && !ts20.isBlock(body)) {
|
|
2775
|
+
throw new Error(`Invalid syntax, expected a block, but got ${ts20.SyntaxKind[body.kind]}.`);
|
|
2434
2776
|
}
|
|
2435
|
-
return
|
|
2777
|
+
return ts20.factory.createArrowFunction(void 0, void 0, parameters.map((param) => ts20.factory.createParameterDeclaration(void 0, void 0, param)), void 0, void 0, body);
|
|
2436
2778
|
}
|
|
2437
2779
|
createIfStatement(condition, thenStatement, elseStatement) {
|
|
2438
|
-
return
|
|
2780
|
+
return ts20.factory.createIfStatement(condition, thenStatement, elseStatement != null ? elseStatement : void 0);
|
|
2439
2781
|
}
|
|
2440
2782
|
createLiteral(value) {
|
|
2441
2783
|
if (value === void 0) {
|
|
2442
|
-
return
|
|
2784
|
+
return ts20.factory.createIdentifier("undefined");
|
|
2443
2785
|
} else if (value === null) {
|
|
2444
|
-
return
|
|
2786
|
+
return ts20.factory.createNull();
|
|
2445
2787
|
} else if (typeof value === "boolean") {
|
|
2446
|
-
return value ?
|
|
2788
|
+
return value ? ts20.factory.createTrue() : ts20.factory.createFalse();
|
|
2447
2789
|
} else if (typeof value === "number") {
|
|
2448
2790
|
return tsNumericExpression(value);
|
|
2449
2791
|
} else {
|
|
2450
|
-
return
|
|
2792
|
+
return ts20.factory.createStringLiteral(value);
|
|
2451
2793
|
}
|
|
2452
2794
|
}
|
|
2453
2795
|
createNewExpression(expression, args) {
|
|
2454
|
-
return
|
|
2796
|
+
return ts20.factory.createNewExpression(expression, void 0, args);
|
|
2455
2797
|
}
|
|
2456
2798
|
createObjectLiteral(properties) {
|
|
2457
|
-
return
|
|
2799
|
+
return ts20.factory.createObjectLiteralExpression(properties.map((prop) => ts20.factory.createPropertyAssignment(prop.quoted ? ts20.factory.createStringLiteral(prop.propertyName) : ts20.factory.createIdentifier(prop.propertyName), prop.value)));
|
|
2458
2800
|
}
|
|
2459
2801
|
createReturnStatement(expression) {
|
|
2460
|
-
return
|
|
2802
|
+
return ts20.factory.createReturnStatement(expression != null ? expression : void 0);
|
|
2461
2803
|
}
|
|
2462
2804
|
createTaggedTemplate(tag, template) {
|
|
2463
2805
|
let templateLiteral;
|
|
2464
2806
|
const length = template.elements.length;
|
|
2465
2807
|
const head = template.elements[0];
|
|
2466
2808
|
if (length === 1) {
|
|
2467
|
-
templateLiteral =
|
|
2809
|
+
templateLiteral = ts20.factory.createNoSubstitutionTemplateLiteral(head.cooked, head.raw);
|
|
2468
2810
|
} else {
|
|
2469
2811
|
const spans = [];
|
|
2470
2812
|
for (let i = 1; i < length - 1; i++) {
|
|
@@ -2473,7 +2815,7 @@ var TypeScriptAstFactory = class {
|
|
|
2473
2815
|
if (range !== null) {
|
|
2474
2816
|
this.setSourceMapRange(middle, range);
|
|
2475
2817
|
}
|
|
2476
|
-
spans.push(
|
|
2818
|
+
spans.push(ts20.factory.createTemplateSpan(template.expressions[i - 1], middle));
|
|
2477
2819
|
}
|
|
2478
2820
|
const resolvedExpression = template.expressions[length - 2];
|
|
2479
2821
|
const templatePart = template.elements[length - 1];
|
|
@@ -2481,19 +2823,19 @@ var TypeScriptAstFactory = class {
|
|
|
2481
2823
|
if (templatePart.range !== null) {
|
|
2482
2824
|
this.setSourceMapRange(templateTail, templatePart.range);
|
|
2483
2825
|
}
|
|
2484
|
-
spans.push(
|
|
2485
|
-
templateLiteral =
|
|
2826
|
+
spans.push(ts20.factory.createTemplateSpan(resolvedExpression, templateTail));
|
|
2827
|
+
templateLiteral = ts20.factory.createTemplateExpression(ts20.factory.createTemplateHead(head.cooked, head.raw), spans);
|
|
2486
2828
|
}
|
|
2487
2829
|
if (head.range !== null) {
|
|
2488
2830
|
this.setSourceMapRange(templateLiteral, head.range);
|
|
2489
2831
|
}
|
|
2490
|
-
return
|
|
2832
|
+
return ts20.factory.createTaggedTemplateExpression(tag, void 0, templateLiteral);
|
|
2491
2833
|
}
|
|
2492
2834
|
createUnaryExpression(operator, operand) {
|
|
2493
|
-
return
|
|
2835
|
+
return ts20.factory.createPrefixUnaryExpression(UNARY_OPERATORS2[operator], operand);
|
|
2494
2836
|
}
|
|
2495
2837
|
createVariableDeclaration(variableName, initializer, type) {
|
|
2496
|
-
return
|
|
2838
|
+
return ts20.factory.createVariableStatement(void 0, ts20.factory.createVariableDeclarationList([ts20.factory.createVariableDeclaration(variableName, void 0, void 0, initializer != null ? initializer : void 0)], VAR_TYPES[type]));
|
|
2497
2839
|
}
|
|
2498
2840
|
setSourceMapRange(node, sourceMapRange) {
|
|
2499
2841
|
if (sourceMapRange === null) {
|
|
@@ -2501,42 +2843,42 @@ var TypeScriptAstFactory = class {
|
|
|
2501
2843
|
}
|
|
2502
2844
|
const url = sourceMapRange.url;
|
|
2503
2845
|
if (!this.externalSourceFiles.has(url)) {
|
|
2504
|
-
this.externalSourceFiles.set(url,
|
|
2846
|
+
this.externalSourceFiles.set(url, ts20.createSourceMapSource(url, sourceMapRange.content, (pos) => pos));
|
|
2505
2847
|
}
|
|
2506
2848
|
const source = this.externalSourceFiles.get(url);
|
|
2507
|
-
|
|
2849
|
+
ts20.setSourceMapRange(node, { pos: sourceMapRange.start.offset, end: sourceMapRange.end.offset, source });
|
|
2508
2850
|
return node;
|
|
2509
2851
|
}
|
|
2510
2852
|
};
|
|
2511
2853
|
function createTemplateMiddle(cooked, raw) {
|
|
2512
|
-
const node =
|
|
2513
|
-
node.kind =
|
|
2854
|
+
const node = ts20.factory.createTemplateHead(cooked, raw);
|
|
2855
|
+
node.kind = ts20.SyntaxKind.TemplateMiddle;
|
|
2514
2856
|
return node;
|
|
2515
2857
|
}
|
|
2516
2858
|
function createTemplateTail(cooked, raw) {
|
|
2517
|
-
const node =
|
|
2518
|
-
node.kind =
|
|
2859
|
+
const node = ts20.factory.createTemplateHead(cooked, raw);
|
|
2860
|
+
node.kind = ts20.SyntaxKind.TemplateTail;
|
|
2519
2861
|
return node;
|
|
2520
2862
|
}
|
|
2521
2863
|
function attachComments(statement, leadingComments) {
|
|
2522
2864
|
for (const comment of leadingComments) {
|
|
2523
|
-
const commentKind = comment.multiline ?
|
|
2865
|
+
const commentKind = comment.multiline ? ts20.SyntaxKind.MultiLineCommentTrivia : ts20.SyntaxKind.SingleLineCommentTrivia;
|
|
2524
2866
|
if (comment.multiline) {
|
|
2525
|
-
|
|
2867
|
+
ts20.addSyntheticLeadingComment(statement, commentKind, comment.toString(), comment.trailingNewline);
|
|
2526
2868
|
} else {
|
|
2527
2869
|
for (const line of comment.toString().split("\n")) {
|
|
2528
|
-
|
|
2870
|
+
ts20.addSyntheticLeadingComment(statement, commentKind, line, comment.trailingNewline);
|
|
2529
2871
|
}
|
|
2530
2872
|
}
|
|
2531
2873
|
}
|
|
2532
2874
|
}
|
|
2533
2875
|
|
|
2534
|
-
// bazel-out/
|
|
2535
|
-
function translateExpression(expression, imports, options = {}) {
|
|
2536
|
-
return expression.visitExpression(new ExpressionTranslatorVisitor(new TypeScriptAstFactory(options.annotateForClosureCompiler === true), imports, options), new Context(false));
|
|
2876
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/typescript_translator.mjs
|
|
2877
|
+
function translateExpression(contextFile, expression, imports, options = {}) {
|
|
2878
|
+
return expression.visitExpression(new ExpressionTranslatorVisitor(new TypeScriptAstFactory(options.annotateForClosureCompiler === true), imports, contextFile, options), new Context(false));
|
|
2537
2879
|
}
|
|
2538
|
-
function translateStatement(statement, imports, options = {}) {
|
|
2539
|
-
return statement.visitStatement(new ExpressionTranslatorVisitor(new TypeScriptAstFactory(options.annotateForClosureCompiler === true), imports, options), new Context(true));
|
|
2880
|
+
function translateStatement(contextFile, statement, imports, options = {}) {
|
|
2881
|
+
return statement.visitStatement(new ExpressionTranslatorVisitor(new TypeScriptAstFactory(options.annotateForClosureCompiler === true), imports, contextFile, options), new Context(true));
|
|
2540
2882
|
}
|
|
2541
2883
|
|
|
2542
2884
|
export {
|
|
@@ -2588,13 +2930,16 @@ export {
|
|
|
2588
2930
|
getDefaultImportDeclaration,
|
|
2589
2931
|
DefaultImportTracker,
|
|
2590
2932
|
ClassMemberKind,
|
|
2933
|
+
ClassMemberAccessLevel,
|
|
2591
2934
|
AmbientImport,
|
|
2592
2935
|
typeNodeToValueExpr,
|
|
2593
2936
|
entityNameToValue,
|
|
2594
2937
|
isNamedClassDeclaration,
|
|
2938
|
+
classMemberAccessLevelToString,
|
|
2595
2939
|
TypeScriptReflectionHost,
|
|
2596
2940
|
reflectTypeEntityToDeclaration,
|
|
2597
2941
|
filterToMembersWithDecorator,
|
|
2942
|
+
reflectClassMember,
|
|
2598
2943
|
reflectObjectLiteral,
|
|
2599
2944
|
DeferredSymbolTracker,
|
|
2600
2945
|
ImportedSymbolsTracker,
|
|
@@ -2602,6 +2947,7 @@ export {
|
|
|
2602
2947
|
Reference,
|
|
2603
2948
|
ModuleResolver,
|
|
2604
2949
|
Context,
|
|
2950
|
+
presetImportManagerForceNamespaceImports,
|
|
2605
2951
|
ImportManager,
|
|
2606
2952
|
ExpressionTranslatorVisitor,
|
|
2607
2953
|
canEmitType,
|
|
@@ -2624,4 +2970,4 @@ export {
|
|
|
2624
2970
|
* Use of this source code is governed by an MIT-style license that can be
|
|
2625
2971
|
* found in the LICENSE file at https://angular.io/license
|
|
2626
2972
|
*/
|
|
2627
|
-
//# sourceMappingURL=chunk-
|
|
2973
|
+
//# sourceMappingURL=chunk-XZRJJDCL.js.map
|