@angular/core 16.0.0-next.0 → 16.0.0-next.2
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/esm2020/src/application_config.mjs +21 -0
- package/esm2020/src/application_init.mjs +23 -31
- package/esm2020/src/application_module.mjs +3 -2
- package/esm2020/src/application_ref.mjs +35 -33
- package/esm2020/src/application_tokens.mjs +2 -13
- package/esm2020/src/change_detection/change_detection.mjs +2 -2
- package/esm2020/src/change_detection/change_detector_ref.mjs +3 -2
- package/esm2020/src/change_detection/constants.mjs +1 -49
- package/esm2020/src/change_detection/differs/iterable_differs.mjs +3 -2
- package/esm2020/src/change_detection/differs/keyvalue_differs.mjs +3 -2
- package/esm2020/src/console.mjs +3 -2
- package/esm2020/src/core.mjs +4 -3
- package/esm2020/src/core_private_export.mjs +6 -7
- package/esm2020/src/core_render3_private_export.mjs +3 -1
- package/esm2020/src/debug/debug_node.mjs +1 -5
- package/esm2020/src/di/injector.mjs +3 -2
- package/esm2020/src/di/r3_injector.mjs +5 -1
- package/esm2020/src/di/reflective_injector.mjs +3 -2
- package/esm2020/src/hydration/annotate.mjs +140 -0
- package/esm2020/src/hydration/api.mjs +120 -0
- package/esm2020/src/hydration/error_handling.mjs +29 -0
- package/esm2020/src/hydration/interfaces.mjs +10 -0
- package/esm2020/src/hydration/node_lookup_utils.mjs +75 -0
- package/esm2020/src/hydration/skip_hydration.mjs +34 -0
- package/esm2020/src/hydration/tokens.mjs +25 -0
- package/esm2020/src/hydration/utils.mjs +131 -0
- package/esm2020/src/linker/compiler.mjs +3 -2
- package/esm2020/src/linker/component_factory_resolver.mjs +3 -2
- package/esm2020/src/linker/destroy_ref.mjs +41 -0
- package/esm2020/src/linker/element_ref.mjs +3 -2
- package/esm2020/src/linker/query_list.mjs +6 -7
- package/esm2020/src/linker/template_ref.mjs +6 -5
- package/esm2020/src/linker/view_container_ref.mjs +3 -2
- package/esm2020/src/linker.mjs +2 -1
- package/esm2020/src/render/api.mjs +3 -2
- package/esm2020/src/render3/component_ref.mjs +16 -9
- package/esm2020/src/render3/features/standalone_feature.mjs +1 -1
- package/esm2020/src/render3/fields.mjs +10 -1
- package/esm2020/src/render3/hooks.mjs +3 -2
- package/esm2020/src/render3/i18n/i18n_util.mjs +3 -3
- package/esm2020/src/render3/instructions/element.mjs +56 -13
- package/esm2020/src/render3/instructions/element_container.mjs +54 -9
- package/esm2020/src/render3/instructions/listener.mjs +3 -3
- package/esm2020/src/render3/instructions/shared.mjs +40 -24
- package/esm2020/src/render3/instructions/template.mjs +2 -2
- package/esm2020/src/render3/instructions/text.mjs +36 -5
- package/esm2020/src/render3/interfaces/definition.mjs +1 -1
- package/esm2020/src/render3/interfaces/node.mjs +1 -1
- package/esm2020/src/render3/interfaces/renderer_dom.mjs +1 -1
- package/esm2020/src/render3/interfaces/view.mjs +4 -2
- package/esm2020/src/render3/jit/directive.mjs +1 -2
- package/esm2020/src/render3/node_manipulation.mjs +25 -14
- package/esm2020/src/render3/state.mjs +45 -1
- package/esm2020/src/render3/util/view_utils.mjs +11 -2
- package/esm2020/src/render3/view_ref.mjs +4 -3
- package/esm2020/src/sanitization/sanitizer.mjs +3 -2
- package/esm2020/src/testability/testability.mjs +5 -3
- package/esm2020/src/transfer_state.mjs +153 -0
- package/esm2020/src/util/iterable.mjs +6 -7
- package/esm2020/src/util/lang.mjs +1 -11
- package/esm2020/src/util/ng_dev_mode.mjs +3 -1
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/testing/src/logger.mjs +6 -5
- package/esm2020/testing/src/ng_zone_mock.mjs +6 -5
- package/esm2020/testing/src/test_bed.mjs +3 -2
- package/fesm2015/core.mjs +1076 -297
- package/fesm2015/core.mjs.map +1 -1
- package/fesm2015/testing.mjs +747 -159
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2020/core.mjs +1066 -295
- package/fesm2020/core.mjs.map +1 -1
- package/fesm2020/testing.mjs +741 -159
- package/fesm2020/testing.mjs.map +1 -1
- package/index.d.ts +290 -87
- package/package.json +3 -3
- package/schematics/migrations/router-link-with-href/bundle.js.map +2 -2
- package/schematics/ng-generate/standalone-migration/bundle.js +1044 -1024
- package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
- package/testing/index.d.ts +1 -1
- package/esm2020/src/util/symbol.mjs +0 -30
|
@@ -16111,7 +16111,7 @@ function publishFacade(global2) {
|
|
|
16111
16111
|
}
|
|
16112
16112
|
|
|
16113
16113
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/version.mjs
|
|
16114
|
-
var VERSION2 = new Version("16.0.0-next.
|
|
16114
|
+
var VERSION2 = new Version("16.0.0-next.2");
|
|
16115
16115
|
|
|
16116
16116
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
|
|
16117
16117
|
var _I18N_ATTR = "i18n";
|
|
@@ -17426,7 +17426,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION = "12.0.0";
|
|
|
17426
17426
|
function compileDeclareClassMetadata(metadata) {
|
|
17427
17427
|
const definitionMap = new DefinitionMap();
|
|
17428
17428
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
17429
|
-
definitionMap.set("version", literal("16.0.0-next.
|
|
17429
|
+
definitionMap.set("version", literal("16.0.0-next.2"));
|
|
17430
17430
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
17431
17431
|
definitionMap.set("type", metadata.type);
|
|
17432
17432
|
definitionMap.set("decorators", metadata.decorators);
|
|
@@ -17495,7 +17495,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
17495
17495
|
var _a;
|
|
17496
17496
|
const definitionMap = new DefinitionMap();
|
|
17497
17497
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION2));
|
|
17498
|
-
definitionMap.set("version", literal("16.0.0-next.
|
|
17498
|
+
definitionMap.set("version", literal("16.0.0-next.2"));
|
|
17499
17499
|
definitionMap.set("type", meta.internalType);
|
|
17500
17500
|
if (meta.isStandalone) {
|
|
17501
17501
|
definitionMap.set("isStandalone", literal(meta.isStandalone));
|
|
@@ -17677,7 +17677,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION3 = "12.0.0";
|
|
|
17677
17677
|
function compileDeclareFactoryFunction(meta) {
|
|
17678
17678
|
const definitionMap = new DefinitionMap();
|
|
17679
17679
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION3));
|
|
17680
|
-
definitionMap.set("version", literal("16.0.0-next.
|
|
17680
|
+
definitionMap.set("version", literal("16.0.0-next.2"));
|
|
17681
17681
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
17682
17682
|
definitionMap.set("type", meta.internalType);
|
|
17683
17683
|
definitionMap.set("deps", compileDependencies(meta.deps));
|
|
@@ -17700,7 +17700,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
17700
17700
|
function createInjectableDefinitionMap(meta) {
|
|
17701
17701
|
const definitionMap = new DefinitionMap();
|
|
17702
17702
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION4));
|
|
17703
|
-
definitionMap.set("version", literal("16.0.0-next.
|
|
17703
|
+
definitionMap.set("version", literal("16.0.0-next.2"));
|
|
17704
17704
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
17705
17705
|
definitionMap.set("type", meta.internalType);
|
|
17706
17706
|
if (meta.providedIn !== void 0) {
|
|
@@ -17738,7 +17738,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
17738
17738
|
function createInjectorDefinitionMap(meta) {
|
|
17739
17739
|
const definitionMap = new DefinitionMap();
|
|
17740
17740
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION5));
|
|
17741
|
-
definitionMap.set("version", literal("16.0.0-next.
|
|
17741
|
+
definitionMap.set("version", literal("16.0.0-next.2"));
|
|
17742
17742
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
17743
17743
|
definitionMap.set("type", meta.internalType);
|
|
17744
17744
|
definitionMap.set("providers", meta.providers);
|
|
@@ -17759,7 +17759,7 @@ function compileDeclareNgModuleFromMetadata(meta) {
|
|
|
17759
17759
|
function createNgModuleDefinitionMap(meta) {
|
|
17760
17760
|
const definitionMap = new DefinitionMap();
|
|
17761
17761
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION6));
|
|
17762
|
-
definitionMap.set("version", literal("16.0.0-next.
|
|
17762
|
+
definitionMap.set("version", literal("16.0.0-next.2"));
|
|
17763
17763
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
17764
17764
|
definitionMap.set("type", meta.internalType);
|
|
17765
17765
|
if (meta.bootstrap.length > 0) {
|
|
@@ -17794,7 +17794,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
17794
17794
|
function createPipeDefinitionMap(meta) {
|
|
17795
17795
|
const definitionMap = new DefinitionMap();
|
|
17796
17796
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION7));
|
|
17797
|
-
definitionMap.set("version", literal("16.0.0-next.
|
|
17797
|
+
definitionMap.set("version", literal("16.0.0-next.2"));
|
|
17798
17798
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
17799
17799
|
definitionMap.set("type", meta.internalType);
|
|
17800
17800
|
if (meta.isStandalone) {
|
|
@@ -17811,7 +17811,7 @@ function createPipeDefinitionMap(meta) {
|
|
|
17811
17811
|
publishFacade(_global);
|
|
17812
17812
|
|
|
17813
17813
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/version.mjs
|
|
17814
|
-
var VERSION3 = new Version("16.0.0-next.
|
|
17814
|
+
var VERSION3 = new Version("16.0.0-next.2");
|
|
17815
17815
|
|
|
17816
17816
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/transformers/api.mjs
|
|
17817
17817
|
var EmitFlags;
|
|
@@ -17829,7 +17829,7 @@ var EmitFlags;
|
|
|
17829
17829
|
var import_typescript2 = __toESM(require("typescript"), 1);
|
|
17830
17830
|
|
|
17831
17831
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/program.mjs
|
|
17832
|
-
var
|
|
17832
|
+
var import_typescript94 = __toESM(require("typescript"), 1);
|
|
17833
17833
|
|
|
17834
17834
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/transformers/i18n.mjs
|
|
17835
17835
|
var path = __toESM(require("path"), 1);
|
|
@@ -17920,8 +17920,8 @@ function compareVersions(v1, v2) {
|
|
|
17920
17920
|
}
|
|
17921
17921
|
|
|
17922
17922
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/typescript_support.mjs
|
|
17923
|
-
var MIN_TS_VERSION = "4.
|
|
17924
|
-
var MAX_TS_VERSION = "5.
|
|
17923
|
+
var MIN_TS_VERSION = "4.9.3";
|
|
17924
|
+
var MAX_TS_VERSION = "5.1.0";
|
|
17925
17925
|
var tsVersion = import_typescript3.default.version;
|
|
17926
17926
|
function checkVersion(version, minVersion, maxVersion) {
|
|
17927
17927
|
if (compareVersions(version, minVersion) < 0 || compareVersions(version, maxVersion) >= 0) {
|
|
@@ -17933,7 +17933,7 @@ function verifySupportedTypeScriptVersion() {
|
|
|
17933
17933
|
}
|
|
17934
17934
|
|
|
17935
17935
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/compiler.mjs
|
|
17936
|
-
var
|
|
17936
|
+
var import_typescript90 = __toESM(require("typescript"), 1);
|
|
17937
17937
|
|
|
17938
17938
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/di.mjs
|
|
17939
17939
|
var import_typescript19 = __toESM(require("typescript"), 1);
|
|
@@ -19615,7 +19615,7 @@ function getOriginNodeForDiagnostics(expr, container) {
|
|
|
19615
19615
|
}
|
|
19616
19616
|
}
|
|
19617
19617
|
function isAbstractClassDeclaration(clazz) {
|
|
19618
|
-
return clazz.modifiers !== void 0
|
|
19618
|
+
return import_typescript18.default.canHaveModifiers(clazz) && clazz.modifiers !== void 0 ? clazz.modifiers.some((mod) => mod.kind === import_typescript18.default.SyntaxKind.AbstractKeyword) : false;
|
|
19619
19619
|
}
|
|
19620
19620
|
|
|
19621
19621
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/di.mjs
|
|
@@ -21799,7 +21799,7 @@ function extractSchemas(rawExpr, evaluator, context) {
|
|
|
21799
21799
|
}
|
|
21800
21800
|
|
|
21801
21801
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/handler.mjs
|
|
21802
|
-
var
|
|
21802
|
+
var import_typescript51 = __toESM(require("typescript"), 1);
|
|
21803
21803
|
|
|
21804
21804
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/semantic_graph/src/api.mjs
|
|
21805
21805
|
var import_typescript31 = __toESM(require("typescript"), 1);
|
|
@@ -23303,7 +23303,7 @@ function containsErrors(diagnostics) {
|
|
|
23303
23303
|
}
|
|
23304
23304
|
|
|
23305
23305
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/declaration.mjs
|
|
23306
|
-
var
|
|
23306
|
+
var import_typescript43 = __toESM(require("typescript"), 1);
|
|
23307
23307
|
|
|
23308
23308
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/context.mjs
|
|
23309
23309
|
var Context = class {
|
|
@@ -23586,39 +23586,7 @@ function createRange(span) {
|
|
|
23586
23586
|
}
|
|
23587
23587
|
|
|
23588
23588
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/type_translator.mjs
|
|
23589
|
-
var import_typescript41 = __toESM(require("typescript"), 1);
|
|
23590
|
-
|
|
23591
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/ts_compatibility/src/ts_cross_version_utils.mjs
|
|
23592
23589
|
var import_typescript40 = __toESM(require("typescript"), 1);
|
|
23593
|
-
var IS_AFTER_TS_49 = isAfterVersion(4, 9);
|
|
23594
|
-
var createParameterDeclaration = IS_AFTER_TS_49 ? import_typescript40.default.factory.createParameterDeclaration : (modifiers, dotDotDotToken, name, questionToken, type, initializer) => import_typescript40.default.factory.createParameterDeclaration(...splitModifiers(modifiers), dotDotDotToken, name, questionToken, type, initializer);
|
|
23595
|
-
var createImportDeclaration = IS_AFTER_TS_49 ? import_typescript40.default.factory.createImportDeclaration : (modifiers, importClause, moduleSpecifier, assertClause) => import_typescript40.default.factory.createImportDeclaration(void 0, modifiers, importClause, moduleSpecifier, assertClause);
|
|
23596
|
-
var createFunctionDeclaration = IS_AFTER_TS_49 ? import_typescript40.default.factory.createFunctionDeclaration : (modifiers, asteriskToken, name, typeParameters, parameters, type, body) => import_typescript40.default.factory.createFunctionDeclaration(...splitModifiers(modifiers), asteriskToken, name, typeParameters, parameters, type, body);
|
|
23597
|
-
var createIndexSignature = IS_AFTER_TS_49 ? import_typescript40.default.factory.createIndexSignature : (modifiers, parameters, type) => import_typescript40.default.factory.createIndexSignature(modifiers, parameters, type);
|
|
23598
|
-
function splitModifiers(allModifiers) {
|
|
23599
|
-
if (!allModifiers) {
|
|
23600
|
-
return [void 0, void 0];
|
|
23601
|
-
}
|
|
23602
|
-
const decorators = [];
|
|
23603
|
-
const modifiers = [];
|
|
23604
|
-
for (const current of allModifiers) {
|
|
23605
|
-
if (import_typescript40.default.isDecorator(current)) {
|
|
23606
|
-
decorators.push(current);
|
|
23607
|
-
} else {
|
|
23608
|
-
modifiers.push(current);
|
|
23609
|
-
}
|
|
23610
|
-
}
|
|
23611
|
-
return [decorators.length ? decorators : void 0, modifiers.length ? modifiers : void 0];
|
|
23612
|
-
}
|
|
23613
|
-
function isAfterVersion(targetMajor, targetMinor) {
|
|
23614
|
-
const [major, minor] = import_typescript40.default.versionMajorMinor.split(".").map((part) => parseInt(part));
|
|
23615
|
-
if (major < targetMajor) {
|
|
23616
|
-
return false;
|
|
23617
|
-
}
|
|
23618
|
-
return major === targetMajor ? minor >= targetMinor : true;
|
|
23619
|
-
}
|
|
23620
|
-
|
|
23621
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/type_translator.mjs
|
|
23622
23590
|
function translateType(type, imports) {
|
|
23623
23591
|
return type.visitType(new TypeTranslatorVisitor(imports), new Context(false));
|
|
23624
23592
|
}
|
|
@@ -23629,16 +23597,16 @@ var TypeTranslatorVisitor = class {
|
|
|
23629
23597
|
visitBuiltinType(type, context) {
|
|
23630
23598
|
switch (type.name) {
|
|
23631
23599
|
case BuiltinTypeName.Bool:
|
|
23632
|
-
return
|
|
23600
|
+
return import_typescript40.default.factory.createKeywordTypeNode(import_typescript40.default.SyntaxKind.BooleanKeyword);
|
|
23633
23601
|
case BuiltinTypeName.Dynamic:
|
|
23634
|
-
return
|
|
23602
|
+
return import_typescript40.default.factory.createKeywordTypeNode(import_typescript40.default.SyntaxKind.AnyKeyword);
|
|
23635
23603
|
case BuiltinTypeName.Int:
|
|
23636
23604
|
case BuiltinTypeName.Number:
|
|
23637
|
-
return
|
|
23605
|
+
return import_typescript40.default.factory.createKeywordTypeNode(import_typescript40.default.SyntaxKind.NumberKeyword);
|
|
23638
23606
|
case BuiltinTypeName.String:
|
|
23639
|
-
return
|
|
23607
|
+
return import_typescript40.default.factory.createKeywordTypeNode(import_typescript40.default.SyntaxKind.StringKeyword);
|
|
23640
23608
|
case BuiltinTypeName.None:
|
|
23641
|
-
return
|
|
23609
|
+
return import_typescript40.default.factory.createKeywordTypeNode(import_typescript40.default.SyntaxKind.NeverKeyword);
|
|
23642
23610
|
default:
|
|
23643
23611
|
throw new Error(`Unsupported builtin type: ${BuiltinTypeName[type.name]}`);
|
|
23644
23612
|
}
|
|
@@ -23648,28 +23616,28 @@ var TypeTranslatorVisitor = class {
|
|
|
23648
23616
|
if (type.typeParams === null) {
|
|
23649
23617
|
return typeNode;
|
|
23650
23618
|
}
|
|
23651
|
-
if (!
|
|
23619
|
+
if (!import_typescript40.default.isTypeReferenceNode(typeNode)) {
|
|
23652
23620
|
throw new Error("An ExpressionType with type arguments must translate into a TypeReferenceNode");
|
|
23653
23621
|
} else if (typeNode.typeArguments !== void 0) {
|
|
23654
23622
|
throw new Error(`An ExpressionType with type arguments cannot have multiple levels of type arguments`);
|
|
23655
23623
|
}
|
|
23656
23624
|
const typeArgs = type.typeParams.map((param) => this.translateType(param, context));
|
|
23657
|
-
return
|
|
23625
|
+
return import_typescript40.default.factory.createTypeReferenceNode(typeNode.typeName, typeArgs);
|
|
23658
23626
|
}
|
|
23659
23627
|
visitArrayType(type, context) {
|
|
23660
|
-
return
|
|
23628
|
+
return import_typescript40.default.factory.createArrayTypeNode(this.translateType(type.of, context));
|
|
23661
23629
|
}
|
|
23662
23630
|
visitMapType(type, context) {
|
|
23663
|
-
const parameter = createParameterDeclaration(void 0, void 0, "key", void 0,
|
|
23664
|
-
const typeArgs = type.valueType !== null ? this.translateType(type.valueType, context) :
|
|
23665
|
-
const indexSignature = createIndexSignature(void 0, [parameter], typeArgs);
|
|
23666
|
-
return
|
|
23631
|
+
const parameter = import_typescript40.default.factory.createParameterDeclaration(void 0, void 0, "key", void 0, import_typescript40.default.factory.createKeywordTypeNode(import_typescript40.default.SyntaxKind.StringKeyword));
|
|
23632
|
+
const typeArgs = type.valueType !== null ? this.translateType(type.valueType, context) : import_typescript40.default.factory.createKeywordTypeNode(import_typescript40.default.SyntaxKind.UnknownKeyword);
|
|
23633
|
+
const indexSignature = import_typescript40.default.factory.createIndexSignature(void 0, [parameter], typeArgs);
|
|
23634
|
+
return import_typescript40.default.factory.createTypeLiteralNode([indexSignature]);
|
|
23667
23635
|
}
|
|
23668
23636
|
visitReadVarExpr(ast, context) {
|
|
23669
23637
|
if (ast.name === null) {
|
|
23670
23638
|
throw new Error(`ReadVarExpr with no variable name in type`);
|
|
23671
23639
|
}
|
|
23672
|
-
return
|
|
23640
|
+
return import_typescript40.default.factory.createTypeQueryNode(import_typescript40.default.factory.createIdentifier(ast.name));
|
|
23673
23641
|
}
|
|
23674
23642
|
visitWriteVarExpr(expr, context) {
|
|
23675
23643
|
throw new Error("Method not implemented.");
|
|
@@ -23691,15 +23659,15 @@ var TypeTranslatorVisitor = class {
|
|
|
23691
23659
|
}
|
|
23692
23660
|
visitLiteralExpr(ast, context) {
|
|
23693
23661
|
if (ast.value === null) {
|
|
23694
|
-
return
|
|
23662
|
+
return import_typescript40.default.factory.createLiteralTypeNode(import_typescript40.default.factory.createNull());
|
|
23695
23663
|
} else if (ast.value === void 0) {
|
|
23696
|
-
return
|
|
23664
|
+
return import_typescript40.default.factory.createKeywordTypeNode(import_typescript40.default.SyntaxKind.UndefinedKeyword);
|
|
23697
23665
|
} else if (typeof ast.value === "boolean") {
|
|
23698
|
-
return
|
|
23666
|
+
return import_typescript40.default.factory.createLiteralTypeNode(ast.value ? import_typescript40.default.factory.createTrue() : import_typescript40.default.factory.createFalse());
|
|
23699
23667
|
} else if (typeof ast.value === "number") {
|
|
23700
|
-
return
|
|
23668
|
+
return import_typescript40.default.factory.createLiteralTypeNode(import_typescript40.default.factory.createNumericLiteral(ast.value));
|
|
23701
23669
|
} else {
|
|
23702
|
-
return
|
|
23670
|
+
return import_typescript40.default.factory.createLiteralTypeNode(import_typescript40.default.factory.createStringLiteral(ast.value));
|
|
23703
23671
|
}
|
|
23704
23672
|
}
|
|
23705
23673
|
visitLocalizedString(ast, context) {
|
|
@@ -23710,10 +23678,10 @@ var TypeTranslatorVisitor = class {
|
|
|
23710
23678
|
throw new Error(`Import unknown module or symbol`);
|
|
23711
23679
|
}
|
|
23712
23680
|
const { moduleImport, symbol } = this.imports.generateNamedImport(ast.value.moduleName, ast.value.name);
|
|
23713
|
-
const symbolIdentifier =
|
|
23714
|
-
const typeName = moduleImport ?
|
|
23681
|
+
const symbolIdentifier = import_typescript40.default.factory.createIdentifier(symbol);
|
|
23682
|
+
const typeName = moduleImport ? import_typescript40.default.factory.createQualifiedName(moduleImport, symbolIdentifier) : symbolIdentifier;
|
|
23715
23683
|
const typeArguments = ast.typeParams !== null ? ast.typeParams.map((type) => this.translateType(type, context)) : void 0;
|
|
23716
|
-
return
|
|
23684
|
+
return import_typescript40.default.factory.createTypeReferenceNode(typeName, typeArguments);
|
|
23717
23685
|
}
|
|
23718
23686
|
visitConditionalExpr(ast, context) {
|
|
23719
23687
|
throw new Error("Method not implemented.");
|
|
@@ -23738,125 +23706,125 @@ var TypeTranslatorVisitor = class {
|
|
|
23738
23706
|
}
|
|
23739
23707
|
visitLiteralArrayExpr(ast, context) {
|
|
23740
23708
|
const values = ast.entries.map((expr) => this.translateExpression(expr, context));
|
|
23741
|
-
return
|
|
23709
|
+
return import_typescript40.default.factory.createTupleTypeNode(values);
|
|
23742
23710
|
}
|
|
23743
23711
|
visitLiteralMapExpr(ast, context) {
|
|
23744
23712
|
const entries = ast.entries.map((entry) => {
|
|
23745
23713
|
const { key, quoted } = entry;
|
|
23746
23714
|
const type = this.translateExpression(entry.value, context);
|
|
23747
|
-
return
|
|
23715
|
+
return import_typescript40.default.factory.createPropertySignature(
|
|
23748
23716
|
void 0,
|
|
23749
|
-
quoted ?
|
|
23717
|
+
quoted ? import_typescript40.default.factory.createStringLiteral(key) : key,
|
|
23750
23718
|
void 0,
|
|
23751
23719
|
type
|
|
23752
23720
|
);
|
|
23753
23721
|
});
|
|
23754
|
-
return
|
|
23722
|
+
return import_typescript40.default.factory.createTypeLiteralNode(entries);
|
|
23755
23723
|
}
|
|
23756
23724
|
visitCommaExpr(ast, context) {
|
|
23757
23725
|
throw new Error("Method not implemented.");
|
|
23758
23726
|
}
|
|
23759
23727
|
visitWrappedNodeExpr(ast, context) {
|
|
23760
23728
|
const node = ast.node;
|
|
23761
|
-
if (
|
|
23762
|
-
return
|
|
23763
|
-
} else if (
|
|
23729
|
+
if (import_typescript40.default.isEntityName(node)) {
|
|
23730
|
+
return import_typescript40.default.factory.createTypeReferenceNode(node, void 0);
|
|
23731
|
+
} else if (import_typescript40.default.isTypeNode(node)) {
|
|
23764
23732
|
return node;
|
|
23765
|
-
} else if (
|
|
23766
|
-
return
|
|
23733
|
+
} else if (import_typescript40.default.isLiteralExpression(node)) {
|
|
23734
|
+
return import_typescript40.default.factory.createLiteralTypeNode(node);
|
|
23767
23735
|
} else {
|
|
23768
|
-
throw new Error(`Unsupported WrappedNodeExpr in TypeTranslatorVisitor: ${
|
|
23736
|
+
throw new Error(`Unsupported WrappedNodeExpr in TypeTranslatorVisitor: ${import_typescript40.default.SyntaxKind[node.kind]}`);
|
|
23769
23737
|
}
|
|
23770
23738
|
}
|
|
23771
23739
|
visitTypeofExpr(ast, context) {
|
|
23772
23740
|
const typeNode = this.translateExpression(ast.expr, context);
|
|
23773
|
-
if (!
|
|
23741
|
+
if (!import_typescript40.default.isTypeReferenceNode(typeNode)) {
|
|
23774
23742
|
throw new Error(`The target of a typeof expression must be a type reference, but it was
|
|
23775
|
-
${
|
|
23743
|
+
${import_typescript40.default.SyntaxKind[typeNode.kind]}`);
|
|
23776
23744
|
}
|
|
23777
|
-
return
|
|
23745
|
+
return import_typescript40.default.factory.createTypeQueryNode(typeNode.typeName);
|
|
23778
23746
|
}
|
|
23779
23747
|
translateType(type, context) {
|
|
23780
23748
|
const typeNode = type.visitType(this, context);
|
|
23781
|
-
if (!
|
|
23782
|
-
throw new Error(`A Type must translate to a TypeNode, but was ${
|
|
23749
|
+
if (!import_typescript40.default.isTypeNode(typeNode)) {
|
|
23750
|
+
throw new Error(`A Type must translate to a TypeNode, but was ${import_typescript40.default.SyntaxKind[typeNode.kind]}`);
|
|
23783
23751
|
}
|
|
23784
23752
|
return typeNode;
|
|
23785
23753
|
}
|
|
23786
23754
|
translateExpression(expr, context) {
|
|
23787
23755
|
const typeNode = expr.visitExpression(this, context);
|
|
23788
|
-
if (!
|
|
23789
|
-
throw new Error(`An Expression must translate to a TypeNode, but was ${
|
|
23756
|
+
if (!import_typescript40.default.isTypeNode(typeNode)) {
|
|
23757
|
+
throw new Error(`An Expression must translate to a TypeNode, but was ${import_typescript40.default.SyntaxKind[typeNode.kind]}`);
|
|
23790
23758
|
}
|
|
23791
23759
|
return typeNode;
|
|
23792
23760
|
}
|
|
23793
23761
|
};
|
|
23794
23762
|
|
|
23795
23763
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/typescript_ast_factory.mjs
|
|
23796
|
-
var
|
|
23764
|
+
var import_typescript41 = __toESM(require("typescript"), 1);
|
|
23797
23765
|
var PureAnnotation;
|
|
23798
23766
|
(function(PureAnnotation2) {
|
|
23799
23767
|
PureAnnotation2["CLOSURE"] = "* @pureOrBreakMyCode ";
|
|
23800
23768
|
PureAnnotation2["TERSER"] = "@__PURE__";
|
|
23801
23769
|
})(PureAnnotation || (PureAnnotation = {}));
|
|
23802
23770
|
var UNARY_OPERATORS3 = {
|
|
23803
|
-
"+":
|
|
23804
|
-
"-":
|
|
23805
|
-
"!":
|
|
23771
|
+
"+": import_typescript41.default.SyntaxKind.PlusToken,
|
|
23772
|
+
"-": import_typescript41.default.SyntaxKind.MinusToken,
|
|
23773
|
+
"!": import_typescript41.default.SyntaxKind.ExclamationToken
|
|
23806
23774
|
};
|
|
23807
23775
|
var BINARY_OPERATORS3 = {
|
|
23808
|
-
"&&":
|
|
23809
|
-
">":
|
|
23810
|
-
">=":
|
|
23811
|
-
"&":
|
|
23812
|
-
"/":
|
|
23813
|
-
"==":
|
|
23814
|
-
"===":
|
|
23815
|
-
"<":
|
|
23816
|
-
"<=":
|
|
23817
|
-
"-":
|
|
23818
|
-
"%":
|
|
23819
|
-
"*":
|
|
23820
|
-
"!=":
|
|
23821
|
-
"!==":
|
|
23822
|
-
"||":
|
|
23823
|
-
"+":
|
|
23824
|
-
"??":
|
|
23776
|
+
"&&": import_typescript41.default.SyntaxKind.AmpersandAmpersandToken,
|
|
23777
|
+
">": import_typescript41.default.SyntaxKind.GreaterThanToken,
|
|
23778
|
+
">=": import_typescript41.default.SyntaxKind.GreaterThanEqualsToken,
|
|
23779
|
+
"&": import_typescript41.default.SyntaxKind.AmpersandToken,
|
|
23780
|
+
"/": import_typescript41.default.SyntaxKind.SlashToken,
|
|
23781
|
+
"==": import_typescript41.default.SyntaxKind.EqualsEqualsToken,
|
|
23782
|
+
"===": import_typescript41.default.SyntaxKind.EqualsEqualsEqualsToken,
|
|
23783
|
+
"<": import_typescript41.default.SyntaxKind.LessThanToken,
|
|
23784
|
+
"<=": import_typescript41.default.SyntaxKind.LessThanEqualsToken,
|
|
23785
|
+
"-": import_typescript41.default.SyntaxKind.MinusToken,
|
|
23786
|
+
"%": import_typescript41.default.SyntaxKind.PercentToken,
|
|
23787
|
+
"*": import_typescript41.default.SyntaxKind.AsteriskToken,
|
|
23788
|
+
"!=": import_typescript41.default.SyntaxKind.ExclamationEqualsToken,
|
|
23789
|
+
"!==": import_typescript41.default.SyntaxKind.ExclamationEqualsEqualsToken,
|
|
23790
|
+
"||": import_typescript41.default.SyntaxKind.BarBarToken,
|
|
23791
|
+
"+": import_typescript41.default.SyntaxKind.PlusToken,
|
|
23792
|
+
"??": import_typescript41.default.SyntaxKind.QuestionQuestionToken
|
|
23825
23793
|
};
|
|
23826
23794
|
var VAR_TYPES = {
|
|
23827
|
-
"const":
|
|
23828
|
-
"let":
|
|
23829
|
-
"var":
|
|
23795
|
+
"const": import_typescript41.default.NodeFlags.Const,
|
|
23796
|
+
"let": import_typescript41.default.NodeFlags.Let,
|
|
23797
|
+
"var": import_typescript41.default.NodeFlags.None
|
|
23830
23798
|
};
|
|
23831
23799
|
var TypeScriptAstFactory = class {
|
|
23832
23800
|
constructor(annotateForClosureCompiler) {
|
|
23833
23801
|
this.annotateForClosureCompiler = annotateForClosureCompiler;
|
|
23834
23802
|
this.externalSourceFiles = /* @__PURE__ */ new Map();
|
|
23835
23803
|
this.attachComments = attachComments;
|
|
23836
|
-
this.createArrayLiteral =
|
|
23837
|
-
this.createElementAccess =
|
|
23838
|
-
this.createExpressionStatement =
|
|
23839
|
-
this.createIdentifier =
|
|
23840
|
-
this.createParenthesizedExpression =
|
|
23841
|
-
this.createPropertyAccess =
|
|
23842
|
-
this.createThrowStatement =
|
|
23843
|
-
this.createTypeOfExpression =
|
|
23804
|
+
this.createArrayLiteral = import_typescript41.default.factory.createArrayLiteralExpression;
|
|
23805
|
+
this.createElementAccess = import_typescript41.default.factory.createElementAccessExpression;
|
|
23806
|
+
this.createExpressionStatement = import_typescript41.default.factory.createExpressionStatement;
|
|
23807
|
+
this.createIdentifier = import_typescript41.default.factory.createIdentifier;
|
|
23808
|
+
this.createParenthesizedExpression = import_typescript41.default.factory.createParenthesizedExpression;
|
|
23809
|
+
this.createPropertyAccess = import_typescript41.default.factory.createPropertyAccessExpression;
|
|
23810
|
+
this.createThrowStatement = import_typescript41.default.factory.createThrowStatement;
|
|
23811
|
+
this.createTypeOfExpression = import_typescript41.default.factory.createTypeOfExpression;
|
|
23844
23812
|
}
|
|
23845
23813
|
createAssignment(target, value) {
|
|
23846
|
-
return
|
|
23814
|
+
return import_typescript41.default.factory.createBinaryExpression(target, import_typescript41.default.SyntaxKind.EqualsToken, value);
|
|
23847
23815
|
}
|
|
23848
23816
|
createBinaryExpression(leftOperand, operator, rightOperand) {
|
|
23849
|
-
return
|
|
23817
|
+
return import_typescript41.default.factory.createBinaryExpression(leftOperand, BINARY_OPERATORS3[operator], rightOperand);
|
|
23850
23818
|
}
|
|
23851
23819
|
createBlock(body) {
|
|
23852
|
-
return
|
|
23820
|
+
return import_typescript41.default.factory.createBlock(body);
|
|
23853
23821
|
}
|
|
23854
23822
|
createCallExpression(callee, args, pure) {
|
|
23855
|
-
const call =
|
|
23823
|
+
const call = import_typescript41.default.factory.createCallExpression(callee, void 0, args);
|
|
23856
23824
|
if (pure) {
|
|
23857
|
-
|
|
23825
|
+
import_typescript41.default.addSyntheticLeadingComment(
|
|
23858
23826
|
call,
|
|
23859
|
-
|
|
23827
|
+
import_typescript41.default.SyntaxKind.MultiLineCommentTrivia,
|
|
23860
23828
|
this.annotateForClosureCompiler ? PureAnnotation.CLOSURE : PureAnnotation.TERSER,
|
|
23861
23829
|
false
|
|
23862
23830
|
);
|
|
@@ -23864,51 +23832,51 @@ var TypeScriptAstFactory = class {
|
|
|
23864
23832
|
return call;
|
|
23865
23833
|
}
|
|
23866
23834
|
createConditional(condition, whenTrue, whenFalse) {
|
|
23867
|
-
return
|
|
23835
|
+
return import_typescript41.default.factory.createConditionalExpression(condition, void 0, whenTrue, void 0, whenFalse);
|
|
23868
23836
|
}
|
|
23869
23837
|
createFunctionDeclaration(functionName, parameters, body) {
|
|
23870
|
-
if (!
|
|
23871
|
-
throw new Error(`Invalid syntax, expected a block, but got ${
|
|
23838
|
+
if (!import_typescript41.default.isBlock(body)) {
|
|
23839
|
+
throw new Error(`Invalid syntax, expected a block, but got ${import_typescript41.default.SyntaxKind[body.kind]}.`);
|
|
23872
23840
|
}
|
|
23873
|
-
return createFunctionDeclaration(void 0, void 0, functionName, void 0, parameters.map((param) => createParameterDeclaration(void 0, void 0, param)), void 0, body);
|
|
23841
|
+
return import_typescript41.default.factory.createFunctionDeclaration(void 0, void 0, functionName, void 0, parameters.map((param) => import_typescript41.default.factory.createParameterDeclaration(void 0, void 0, param)), void 0, body);
|
|
23874
23842
|
}
|
|
23875
23843
|
createFunctionExpression(functionName, parameters, body) {
|
|
23876
|
-
if (!
|
|
23877
|
-
throw new Error(`Invalid syntax, expected a block, but got ${
|
|
23844
|
+
if (!import_typescript41.default.isBlock(body)) {
|
|
23845
|
+
throw new Error(`Invalid syntax, expected a block, but got ${import_typescript41.default.SyntaxKind[body.kind]}.`);
|
|
23878
23846
|
}
|
|
23879
|
-
return
|
|
23847
|
+
return import_typescript41.default.factory.createFunctionExpression(void 0, void 0, functionName != null ? functionName : void 0, void 0, parameters.map((param) => import_typescript41.default.factory.createParameterDeclaration(void 0, void 0, param)), void 0, body);
|
|
23880
23848
|
}
|
|
23881
23849
|
createIfStatement(condition, thenStatement, elseStatement) {
|
|
23882
|
-
return
|
|
23850
|
+
return import_typescript41.default.factory.createIfStatement(condition, thenStatement, elseStatement != null ? elseStatement : void 0);
|
|
23883
23851
|
}
|
|
23884
23852
|
createLiteral(value) {
|
|
23885
23853
|
if (value === void 0) {
|
|
23886
|
-
return
|
|
23854
|
+
return import_typescript41.default.factory.createIdentifier("undefined");
|
|
23887
23855
|
} else if (value === null) {
|
|
23888
|
-
return
|
|
23856
|
+
return import_typescript41.default.factory.createNull();
|
|
23889
23857
|
} else if (typeof value === "boolean") {
|
|
23890
|
-
return value ?
|
|
23858
|
+
return value ? import_typescript41.default.factory.createTrue() : import_typescript41.default.factory.createFalse();
|
|
23891
23859
|
} else if (typeof value === "number") {
|
|
23892
|
-
return
|
|
23860
|
+
return import_typescript41.default.factory.createNumericLiteral(value);
|
|
23893
23861
|
} else {
|
|
23894
|
-
return
|
|
23862
|
+
return import_typescript41.default.factory.createStringLiteral(value);
|
|
23895
23863
|
}
|
|
23896
23864
|
}
|
|
23897
23865
|
createNewExpression(expression, args) {
|
|
23898
|
-
return
|
|
23866
|
+
return import_typescript41.default.factory.createNewExpression(expression, void 0, args);
|
|
23899
23867
|
}
|
|
23900
23868
|
createObjectLiteral(properties) {
|
|
23901
|
-
return
|
|
23869
|
+
return import_typescript41.default.factory.createObjectLiteralExpression(properties.map((prop) => import_typescript41.default.factory.createPropertyAssignment(prop.quoted ? import_typescript41.default.factory.createStringLiteral(prop.propertyName) : import_typescript41.default.factory.createIdentifier(prop.propertyName), prop.value)));
|
|
23902
23870
|
}
|
|
23903
23871
|
createReturnStatement(expression) {
|
|
23904
|
-
return
|
|
23872
|
+
return import_typescript41.default.factory.createReturnStatement(expression != null ? expression : void 0);
|
|
23905
23873
|
}
|
|
23906
23874
|
createTaggedTemplate(tag, template) {
|
|
23907
23875
|
let templateLiteral;
|
|
23908
23876
|
const length = template.elements.length;
|
|
23909
23877
|
const head = template.elements[0];
|
|
23910
23878
|
if (length === 1) {
|
|
23911
|
-
templateLiteral =
|
|
23879
|
+
templateLiteral = import_typescript41.default.factory.createNoSubstitutionTemplateLiteral(head.cooked, head.raw);
|
|
23912
23880
|
} else {
|
|
23913
23881
|
const spans = [];
|
|
23914
23882
|
for (let i = 1; i < length - 1; i++) {
|
|
@@ -23917,7 +23885,7 @@ var TypeScriptAstFactory = class {
|
|
|
23917
23885
|
if (range !== null) {
|
|
23918
23886
|
this.setSourceMapRange(middle, range);
|
|
23919
23887
|
}
|
|
23920
|
-
spans.push(
|
|
23888
|
+
spans.push(import_typescript41.default.factory.createTemplateSpan(template.expressions[i - 1], middle));
|
|
23921
23889
|
}
|
|
23922
23890
|
const resolvedExpression = template.expressions[length - 2];
|
|
23923
23891
|
const templatePart = template.elements[length - 1];
|
|
@@ -23925,19 +23893,19 @@ var TypeScriptAstFactory = class {
|
|
|
23925
23893
|
if (templatePart.range !== null) {
|
|
23926
23894
|
this.setSourceMapRange(templateTail, templatePart.range);
|
|
23927
23895
|
}
|
|
23928
|
-
spans.push(
|
|
23929
|
-
templateLiteral =
|
|
23896
|
+
spans.push(import_typescript41.default.factory.createTemplateSpan(resolvedExpression, templateTail));
|
|
23897
|
+
templateLiteral = import_typescript41.default.factory.createTemplateExpression(import_typescript41.default.factory.createTemplateHead(head.cooked, head.raw), spans);
|
|
23930
23898
|
}
|
|
23931
23899
|
if (head.range !== null) {
|
|
23932
23900
|
this.setSourceMapRange(templateLiteral, head.range);
|
|
23933
23901
|
}
|
|
23934
|
-
return
|
|
23902
|
+
return import_typescript41.default.factory.createTaggedTemplateExpression(tag, void 0, templateLiteral);
|
|
23935
23903
|
}
|
|
23936
23904
|
createUnaryExpression(operator, operand) {
|
|
23937
|
-
return
|
|
23905
|
+
return import_typescript41.default.factory.createPrefixUnaryExpression(UNARY_OPERATORS3[operator], operand);
|
|
23938
23906
|
}
|
|
23939
23907
|
createVariableDeclaration(variableName, initializer, type) {
|
|
23940
|
-
return
|
|
23908
|
+
return import_typescript41.default.factory.createVariableStatement(void 0, import_typescript41.default.factory.createVariableDeclarationList([import_typescript41.default.factory.createVariableDeclaration(variableName, void 0, void 0, initializer != null ? initializer : void 0)], VAR_TYPES[type]));
|
|
23941
23909
|
}
|
|
23942
23910
|
setSourceMapRange(node, sourceMapRange) {
|
|
23943
23911
|
if (sourceMapRange === null) {
|
|
@@ -23945,31 +23913,31 @@ var TypeScriptAstFactory = class {
|
|
|
23945
23913
|
}
|
|
23946
23914
|
const url = sourceMapRange.url;
|
|
23947
23915
|
if (!this.externalSourceFiles.has(url)) {
|
|
23948
|
-
this.externalSourceFiles.set(url,
|
|
23916
|
+
this.externalSourceFiles.set(url, import_typescript41.default.createSourceMapSource(url, sourceMapRange.content, (pos) => pos));
|
|
23949
23917
|
}
|
|
23950
23918
|
const source = this.externalSourceFiles.get(url);
|
|
23951
|
-
|
|
23919
|
+
import_typescript41.default.setSourceMapRange(node, { pos: sourceMapRange.start.offset, end: sourceMapRange.end.offset, source });
|
|
23952
23920
|
return node;
|
|
23953
23921
|
}
|
|
23954
23922
|
};
|
|
23955
23923
|
function createTemplateMiddle(cooked, raw) {
|
|
23956
|
-
const node =
|
|
23957
|
-
node.kind =
|
|
23924
|
+
const node = import_typescript41.default.factory.createTemplateHead(cooked, raw);
|
|
23925
|
+
node.kind = import_typescript41.default.SyntaxKind.TemplateMiddle;
|
|
23958
23926
|
return node;
|
|
23959
23927
|
}
|
|
23960
23928
|
function createTemplateTail(cooked, raw) {
|
|
23961
|
-
const node =
|
|
23962
|
-
node.kind =
|
|
23929
|
+
const node = import_typescript41.default.factory.createTemplateHead(cooked, raw);
|
|
23930
|
+
node.kind = import_typescript41.default.SyntaxKind.TemplateTail;
|
|
23963
23931
|
return node;
|
|
23964
23932
|
}
|
|
23965
23933
|
function attachComments(statement, leadingComments) {
|
|
23966
23934
|
for (const comment of leadingComments) {
|
|
23967
|
-
const commentKind = comment.multiline ?
|
|
23935
|
+
const commentKind = comment.multiline ? import_typescript41.default.SyntaxKind.MultiLineCommentTrivia : import_typescript41.default.SyntaxKind.SingleLineCommentTrivia;
|
|
23968
23936
|
if (comment.multiline) {
|
|
23969
|
-
|
|
23937
|
+
import_typescript41.default.addSyntheticLeadingComment(statement, commentKind, comment.toString(), comment.trailingNewline);
|
|
23970
23938
|
} else {
|
|
23971
23939
|
for (const line of comment.toString().split("\n")) {
|
|
23972
|
-
|
|
23940
|
+
import_typescript41.default.addSyntheticLeadingComment(statement, commentKind, line, comment.trailingNewline);
|
|
23973
23941
|
}
|
|
23974
23942
|
}
|
|
23975
23943
|
}
|
|
@@ -23984,28 +23952,28 @@ function translateStatement(statement, imports, options = {}) {
|
|
|
23984
23952
|
}
|
|
23985
23953
|
|
|
23986
23954
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/utils.mjs
|
|
23987
|
-
var
|
|
23955
|
+
var import_typescript42 = __toESM(require("typescript"), 1);
|
|
23988
23956
|
function addImports(importManager, sf, extraStatements = []) {
|
|
23989
23957
|
const addedImports = importManager.getAllImports(sf.fileName).map((i) => {
|
|
23990
|
-
const qualifier =
|
|
23991
|
-
const importClause =
|
|
23958
|
+
const qualifier = import_typescript42.default.factory.createIdentifier(i.qualifier.text);
|
|
23959
|
+
const importClause = import_typescript42.default.factory.createImportClause(
|
|
23992
23960
|
false,
|
|
23993
23961
|
void 0,
|
|
23994
|
-
|
|
23962
|
+
import_typescript42.default.factory.createNamespaceImport(qualifier)
|
|
23995
23963
|
);
|
|
23996
|
-
const decl = createImportDeclaration(
|
|
23964
|
+
const decl = import_typescript42.default.factory.createImportDeclaration(
|
|
23997
23965
|
void 0,
|
|
23998
23966
|
importClause,
|
|
23999
|
-
|
|
23967
|
+
import_typescript42.default.factory.createStringLiteral(i.specifier)
|
|
24000
23968
|
);
|
|
24001
|
-
|
|
23969
|
+
import_typescript42.default.setOriginalNode(i.qualifier, decl);
|
|
24002
23970
|
return decl;
|
|
24003
23971
|
});
|
|
24004
23972
|
const existingImports = sf.statements.filter((stmt) => isImportStatement(stmt));
|
|
24005
23973
|
const body = sf.statements.filter((stmt) => !isImportStatement(stmt));
|
|
24006
23974
|
if (addedImports.length > 0) {
|
|
24007
|
-
const fileoverviewAnchorStmt =
|
|
24008
|
-
return
|
|
23975
|
+
const fileoverviewAnchorStmt = import_typescript42.default.factory.createNotEmittedStatement(sf);
|
|
23976
|
+
return import_typescript42.default.factory.updateSourceFile(sf, import_typescript42.default.factory.createNodeArray([
|
|
24009
23977
|
fileoverviewAnchorStmt,
|
|
24010
23978
|
...existingImports,
|
|
24011
23979
|
...addedImports,
|
|
@@ -24016,7 +23984,7 @@ function addImports(importManager, sf, extraStatements = []) {
|
|
|
24016
23984
|
return sf;
|
|
24017
23985
|
}
|
|
24018
23986
|
function isImportStatement(stmt) {
|
|
24019
|
-
return
|
|
23987
|
+
return import_typescript42.default.isImportDeclaration(stmt) || import_typescript42.default.isImportEqualsDeclaration(stmt) || import_typescript42.default.isNamespaceImport(stmt);
|
|
24020
23988
|
}
|
|
24021
23989
|
|
|
24022
23990
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/declaration.mjs
|
|
@@ -24034,7 +24002,7 @@ var DtsTransformRegistry = class {
|
|
|
24034
24002
|
if (!sf.isDeclarationFile) {
|
|
24035
24003
|
return null;
|
|
24036
24004
|
}
|
|
24037
|
-
const originalSf =
|
|
24005
|
+
const originalSf = import_typescript43.default.getOriginalNode(sf);
|
|
24038
24006
|
let transforms = null;
|
|
24039
24007
|
if (this.ivyDeclarationTransforms.has(originalSf)) {
|
|
24040
24008
|
transforms = [];
|
|
@@ -24047,7 +24015,7 @@ function declarationTransformFactory(transformRegistry, importRewriter, importPr
|
|
|
24047
24015
|
return (context) => {
|
|
24048
24016
|
const transformer = new DtsTransformer(context, importRewriter, importPrefix);
|
|
24049
24017
|
return (fileOrBundle) => {
|
|
24050
|
-
if (
|
|
24018
|
+
if (import_typescript43.default.isBundle(fileOrBundle)) {
|
|
24051
24019
|
return fileOrBundle;
|
|
24052
24020
|
}
|
|
24053
24021
|
const transforms = transformRegistry.getAllTransforms(fileOrBundle);
|
|
@@ -24067,15 +24035,15 @@ var DtsTransformer = class {
|
|
|
24067
24035
|
transform(sf, transforms) {
|
|
24068
24036
|
const imports = new ImportManager(this.importRewriter, this.importPrefix);
|
|
24069
24037
|
const visitor = (node) => {
|
|
24070
|
-
if (
|
|
24038
|
+
if (import_typescript43.default.isClassDeclaration(node)) {
|
|
24071
24039
|
return this.transformClassDeclaration(node, transforms, imports);
|
|
24072
|
-
} else if (
|
|
24040
|
+
} else if (import_typescript43.default.isFunctionDeclaration(node)) {
|
|
24073
24041
|
return this.transformFunctionDeclaration(node, transforms, imports);
|
|
24074
24042
|
} else {
|
|
24075
|
-
return
|
|
24043
|
+
return import_typescript43.default.visitEachChild(node, visitor, this.ctx);
|
|
24076
24044
|
}
|
|
24077
24045
|
};
|
|
24078
|
-
sf =
|
|
24046
|
+
sf = import_typescript43.default.visitNode(sf, visitor, import_typescript43.default.isSourceFile) || sf;
|
|
24079
24047
|
return addImports(imports, sf);
|
|
24080
24048
|
}
|
|
24081
24049
|
transformClassDeclaration(clazz, transforms, imports) {
|
|
@@ -24103,7 +24071,7 @@ var DtsTransformer = class {
|
|
|
24103
24071
|
}
|
|
24104
24072
|
}
|
|
24105
24073
|
if (elementsChanged && clazz === newClazz) {
|
|
24106
|
-
newClazz =
|
|
24074
|
+
newClazz = import_typescript43.default.factory.updateClassDeclaration(
|
|
24107
24075
|
clazz,
|
|
24108
24076
|
clazz.modifiers,
|
|
24109
24077
|
clazz.name,
|
|
@@ -24132,16 +24100,16 @@ var IvyDeclarationDtsTransform = class {
|
|
|
24132
24100
|
this.declarationFields.set(decl, fields);
|
|
24133
24101
|
}
|
|
24134
24102
|
transformClass(clazz, members, imports) {
|
|
24135
|
-
const original =
|
|
24103
|
+
const original = import_typescript43.default.getOriginalNode(clazz);
|
|
24136
24104
|
if (!this.declarationFields.has(original)) {
|
|
24137
24105
|
return clazz;
|
|
24138
24106
|
}
|
|
24139
24107
|
const fields = this.declarationFields.get(original);
|
|
24140
24108
|
const newMembers = fields.map((decl) => {
|
|
24141
|
-
const modifiers = [
|
|
24109
|
+
const modifiers = [import_typescript43.default.factory.createModifier(import_typescript43.default.SyntaxKind.StaticKeyword)];
|
|
24142
24110
|
const typeRef = translateType(decl.type, imports);
|
|
24143
24111
|
markForEmitAsSingleLine(typeRef);
|
|
24144
|
-
return
|
|
24112
|
+
return import_typescript43.default.factory.createPropertyDeclaration(
|
|
24145
24113
|
modifiers,
|
|
24146
24114
|
decl.name,
|
|
24147
24115
|
void 0,
|
|
@@ -24149,7 +24117,7 @@ var IvyDeclarationDtsTransform = class {
|
|
|
24149
24117
|
void 0
|
|
24150
24118
|
);
|
|
24151
24119
|
});
|
|
24152
|
-
return
|
|
24120
|
+
return import_typescript43.default.factory.updateClassDeclaration(
|
|
24153
24121
|
clazz,
|
|
24154
24122
|
clazz.modifiers,
|
|
24155
24123
|
clazz.name,
|
|
@@ -24160,15 +24128,15 @@ var IvyDeclarationDtsTransform = class {
|
|
|
24160
24128
|
}
|
|
24161
24129
|
};
|
|
24162
24130
|
function markForEmitAsSingleLine(node) {
|
|
24163
|
-
|
|
24164
|
-
|
|
24131
|
+
import_typescript43.default.setEmitFlags(node, import_typescript43.default.EmitFlags.SingleLine);
|
|
24132
|
+
import_typescript43.default.forEachChild(node, markForEmitAsSingleLine);
|
|
24165
24133
|
}
|
|
24166
24134
|
|
|
24167
24135
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/transform.mjs
|
|
24168
|
-
var
|
|
24136
|
+
var import_typescript45 = __toESM(require("typescript"), 1);
|
|
24169
24137
|
|
|
24170
24138
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/util/src/visitor.mjs
|
|
24171
|
-
var
|
|
24139
|
+
var import_typescript44 = __toESM(require("typescript"), 1);
|
|
24172
24140
|
function visit(node, visitor, context) {
|
|
24173
24141
|
return visitor._visit(node, context);
|
|
24174
24142
|
}
|
|
@@ -24192,13 +24160,13 @@ var Visitor = class {
|
|
|
24192
24160
|
}
|
|
24193
24161
|
_visit(node, context) {
|
|
24194
24162
|
let visitedNode = null;
|
|
24195
|
-
node =
|
|
24196
|
-
if (
|
|
24163
|
+
node = import_typescript44.default.visitEachChild(node, (child) => this._visit(child, context), context);
|
|
24164
|
+
if (import_typescript44.default.isClassDeclaration(node)) {
|
|
24197
24165
|
visitedNode = this._visitListEntryNode(node, (node2) => this.visitClassDeclaration(node2));
|
|
24198
24166
|
} else {
|
|
24199
24167
|
visitedNode = this.visitOtherNode(node);
|
|
24200
24168
|
}
|
|
24201
|
-
if (
|
|
24169
|
+
if (import_typescript44.default.isBlock(visitedNode) || import_typescript44.default.isSourceFile(visitedNode)) {
|
|
24202
24170
|
visitedNode = this._maybeProcessStatements(visitedNode);
|
|
24203
24171
|
}
|
|
24204
24172
|
return visitedNode;
|
|
@@ -24219,11 +24187,11 @@ var Visitor = class {
|
|
|
24219
24187
|
this._after.delete(stmt);
|
|
24220
24188
|
}
|
|
24221
24189
|
});
|
|
24222
|
-
const statementsArray =
|
|
24223
|
-
if (
|
|
24224
|
-
return
|
|
24190
|
+
const statementsArray = import_typescript44.default.factory.createNodeArray(newStatements, node.statements.hasTrailingComma);
|
|
24191
|
+
if (import_typescript44.default.isBlock(node)) {
|
|
24192
|
+
return import_typescript44.default.factory.updateBlock(node, statementsArray);
|
|
24225
24193
|
} else {
|
|
24226
|
-
return
|
|
24194
|
+
return import_typescript44.default.factory.updateSourceFile(node, statementsArray, node.isDeclarationFile, node.referencedFiles, node.typeReferenceDirectives, node.hasNoDefaultLib, node.libReferenceDirectives);
|
|
24227
24195
|
}
|
|
24228
24196
|
}
|
|
24229
24197
|
};
|
|
@@ -24277,11 +24245,11 @@ var IvyTransformationVisitor = class extends Visitor {
|
|
|
24277
24245
|
const members = [...node.members];
|
|
24278
24246
|
for (const field of this.classCompilationMap.get(node)) {
|
|
24279
24247
|
const exprNode = translateExpression(field.initializer, this.importManager, translateOptions);
|
|
24280
|
-
const property =
|
|
24248
|
+
const property = import_typescript45.default.factory.createPropertyDeclaration([import_typescript45.default.factory.createToken(import_typescript45.default.SyntaxKind.StaticKeyword)], field.name, void 0, void 0, exprNode);
|
|
24281
24249
|
if (this.isClosureCompilerEnabled) {
|
|
24282
|
-
|
|
24250
|
+
import_typescript45.default.addSyntheticLeadingComment(
|
|
24283
24251
|
property,
|
|
24284
|
-
|
|
24252
|
+
import_typescript45.default.SyntaxKind.MultiLineCommentTrivia,
|
|
24285
24253
|
"* @nocollapse ",
|
|
24286
24254
|
false
|
|
24287
24255
|
);
|
|
@@ -24289,13 +24257,13 @@ var IvyTransformationVisitor = class extends Visitor {
|
|
|
24289
24257
|
field.statements.map((stmt) => translateStatement(stmt, this.importManager, translateOptions)).forEach((stmt) => statements.push(stmt));
|
|
24290
24258
|
members.push(property);
|
|
24291
24259
|
}
|
|
24292
|
-
const filteredDecorators = maybeFilterDecorator(
|
|
24293
|
-
const nodeModifiers =
|
|
24260
|
+
const filteredDecorators = maybeFilterDecorator(import_typescript45.default.getDecorators(node), this.compilation.decoratorsFor(node));
|
|
24261
|
+
const nodeModifiers = import_typescript45.default.getModifiers(node);
|
|
24294
24262
|
let updatedModifiers;
|
|
24295
24263
|
if ((filteredDecorators == null ? void 0 : filteredDecorators.length) || (nodeModifiers == null ? void 0 : nodeModifiers.length)) {
|
|
24296
24264
|
updatedModifiers = [...filteredDecorators || [], ...nodeModifiers || []];
|
|
24297
24265
|
}
|
|
24298
|
-
node =
|
|
24266
|
+
node = import_typescript45.default.factory.updateClassDeclaration(
|
|
24299
24267
|
node,
|
|
24300
24268
|
updatedModifiers,
|
|
24301
24269
|
node.name,
|
|
@@ -24318,7 +24286,7 @@ var IvyTransformationVisitor = class extends Visitor {
|
|
|
24318
24286
|
}
|
|
24319
24287
|
}
|
|
24320
24288
|
_nonCoreDecoratorsOnly(node) {
|
|
24321
|
-
const decorators =
|
|
24289
|
+
const decorators = import_typescript45.default.getDecorators(node);
|
|
24322
24290
|
if (decorators === void 0) {
|
|
24323
24291
|
return void 0;
|
|
24324
24292
|
}
|
|
@@ -24335,22 +24303,22 @@ var IvyTransformationVisitor = class extends Visitor {
|
|
|
24335
24303
|
return nodeArrayFromDecoratorsArray(filtered);
|
|
24336
24304
|
}
|
|
24337
24305
|
_stripAngularDecorators(node) {
|
|
24338
|
-
const modifiers =
|
|
24339
|
-
const nonCoreDecorators =
|
|
24306
|
+
const modifiers = import_typescript45.default.canHaveModifiers(node) ? import_typescript45.default.getModifiers(node) : void 0;
|
|
24307
|
+
const nonCoreDecorators = import_typescript45.default.canHaveDecorators(node) ? this._nonCoreDecoratorsOnly(node) : void 0;
|
|
24340
24308
|
const combinedModifiers = [...nonCoreDecorators || [], ...modifiers || []];
|
|
24341
|
-
if (
|
|
24342
|
-
node =
|
|
24343
|
-
} else if (
|
|
24344
|
-
node =
|
|
24345
|
-
} else if (
|
|
24346
|
-
node =
|
|
24347
|
-
} else if (
|
|
24348
|
-
node =
|
|
24349
|
-
} else if (
|
|
24350
|
-
node =
|
|
24351
|
-
} else if (
|
|
24309
|
+
if (import_typescript45.default.isParameter(node)) {
|
|
24310
|
+
node = import_typescript45.default.factory.updateParameterDeclaration(node, combinedModifiers, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer);
|
|
24311
|
+
} else if (import_typescript45.default.isMethodDeclaration(node)) {
|
|
24312
|
+
node = import_typescript45.default.factory.updateMethodDeclaration(node, combinedModifiers, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body);
|
|
24313
|
+
} else if (import_typescript45.default.isPropertyDeclaration(node)) {
|
|
24314
|
+
node = import_typescript45.default.factory.updatePropertyDeclaration(node, combinedModifiers, node.name, node.questionToken, node.type, node.initializer);
|
|
24315
|
+
} else if (import_typescript45.default.isGetAccessor(node)) {
|
|
24316
|
+
node = import_typescript45.default.factory.updateGetAccessorDeclaration(node, combinedModifiers, node.name, node.parameters, node.type, node.body);
|
|
24317
|
+
} else if (import_typescript45.default.isSetAccessor(node)) {
|
|
24318
|
+
node = import_typescript45.default.factory.updateSetAccessorDeclaration(node, combinedModifiers, node.name, node.parameters, node.body);
|
|
24319
|
+
} else if (import_typescript45.default.isConstructorDeclaration(node)) {
|
|
24352
24320
|
const parameters = node.parameters.map((param) => this._stripAngularDecorators(param));
|
|
24353
|
-
node =
|
|
24321
|
+
node = import_typescript45.default.factory.updateConstructorDeclaration(node, modifiers, parameters, node.body);
|
|
24354
24322
|
}
|
|
24355
24323
|
return node;
|
|
24356
24324
|
}
|
|
@@ -24362,7 +24330,7 @@ function transformIvySourceFile(compilation, context, reflector, importRewriter,
|
|
|
24362
24330
|
visit(file, compilationVisitor, context);
|
|
24363
24331
|
const transformationVisitor = new IvyTransformationVisitor(compilation, compilationVisitor.classCompilationMap, reflector, importManager, recordWrappedNode, isClosureCompilerEnabled, isCore);
|
|
24364
24332
|
let sf = visit(file, transformationVisitor, context);
|
|
24365
|
-
const downlevelTranslatedCode = getLocalizeCompileTarget(context) <
|
|
24333
|
+
const downlevelTranslatedCode = getLocalizeCompileTarget(context) < import_typescript45.default.ScriptTarget.ES2015;
|
|
24366
24334
|
const constants = constantPool.statements.map((stmt) => translateStatement(stmt, importManager, {
|
|
24367
24335
|
recordWrappedNode,
|
|
24368
24336
|
downlevelTaggedTemplates: downlevelTranslatedCode,
|
|
@@ -24377,17 +24345,17 @@ function transformIvySourceFile(compilation, context, reflector, importRewriter,
|
|
|
24377
24345
|
return sf;
|
|
24378
24346
|
}
|
|
24379
24347
|
function getLocalizeCompileTarget(context) {
|
|
24380
|
-
const target = context.getCompilerOptions().target ||
|
|
24381
|
-
return target !==
|
|
24348
|
+
const target = context.getCompilerOptions().target || import_typescript45.default.ScriptTarget.ES2015;
|
|
24349
|
+
return target !== import_typescript45.default.ScriptTarget.JSON ? target : import_typescript45.default.ScriptTarget.ES2015;
|
|
24382
24350
|
}
|
|
24383
24351
|
function getFileOverviewComment(statements) {
|
|
24384
24352
|
if (statements.length > 0) {
|
|
24385
24353
|
const host = statements[0];
|
|
24386
24354
|
let trailing = false;
|
|
24387
|
-
let comments =
|
|
24355
|
+
let comments = import_typescript45.default.getSyntheticLeadingComments(host);
|
|
24388
24356
|
if (!comments || comments.length === 0) {
|
|
24389
24357
|
trailing = true;
|
|
24390
|
-
comments =
|
|
24358
|
+
comments = import_typescript45.default.getSyntheticTrailingComments(host);
|
|
24391
24359
|
}
|
|
24392
24360
|
if (comments && comments.length > 0 && CLOSURE_FILE_OVERVIEW_REGEXP.test(comments[0].text)) {
|
|
24393
24361
|
return { comments, host, trailing };
|
|
@@ -24399,22 +24367,22 @@ function setFileOverviewComment(sf, fileoverview) {
|
|
|
24399
24367
|
const { comments, host, trailing } = fileoverview;
|
|
24400
24368
|
if (sf.statements.length > 0 && host !== sf.statements[0]) {
|
|
24401
24369
|
if (trailing) {
|
|
24402
|
-
|
|
24370
|
+
import_typescript45.default.setSyntheticTrailingComments(host, void 0);
|
|
24403
24371
|
} else {
|
|
24404
|
-
|
|
24372
|
+
import_typescript45.default.setSyntheticLeadingComments(host, void 0);
|
|
24405
24373
|
}
|
|
24406
|
-
|
|
24374
|
+
import_typescript45.default.setSyntheticLeadingComments(sf.statements[0], comments);
|
|
24407
24375
|
}
|
|
24408
24376
|
}
|
|
24409
24377
|
function maybeFilterDecorator(decorators, toRemove) {
|
|
24410
24378
|
if (decorators === void 0) {
|
|
24411
24379
|
return void 0;
|
|
24412
24380
|
}
|
|
24413
|
-
const filtered = decorators.filter((dec) => toRemove.find((decToRemove) =>
|
|
24381
|
+
const filtered = decorators.filter((dec) => toRemove.find((decToRemove) => import_typescript45.default.getOriginalNode(dec) === decToRemove) === void 0);
|
|
24414
24382
|
if (filtered.length === 0) {
|
|
24415
24383
|
return void 0;
|
|
24416
24384
|
}
|
|
24417
|
-
return
|
|
24385
|
+
return import_typescript45.default.factory.createNodeArray(filtered);
|
|
24418
24386
|
}
|
|
24419
24387
|
function isFromAngularCore(decorator) {
|
|
24420
24388
|
return decorator.import !== null && decorator.import.from === "@angular/core";
|
|
@@ -24428,7 +24396,7 @@ function createRecorderFn(defaultImportTracker) {
|
|
|
24428
24396
|
};
|
|
24429
24397
|
}
|
|
24430
24398
|
function nodeArrayFromDecoratorsArray(decorators) {
|
|
24431
|
-
const array =
|
|
24399
|
+
const array = import_typescript45.default.factory.createNodeArray(decorators);
|
|
24432
24400
|
if (array.length > 0) {
|
|
24433
24401
|
array.pos = decorators[0].pos;
|
|
24434
24402
|
array.end = decorators[decorators.length - 1].end;
|
|
@@ -24437,7 +24405,7 @@ function nodeArrayFromDecoratorsArray(decorators) {
|
|
|
24437
24405
|
}
|
|
24438
24406
|
|
|
24439
24407
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/shared.mjs
|
|
24440
|
-
var
|
|
24408
|
+
var import_typescript46 = __toESM(require("typescript"), 1);
|
|
24441
24409
|
var EMPTY_OBJECT = {};
|
|
24442
24410
|
var QUERY_TYPES = /* @__PURE__ */ new Set([
|
|
24443
24411
|
"ContentChild",
|
|
@@ -24453,7 +24421,7 @@ function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, refEmi
|
|
|
24453
24421
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, Decorator.nodeForError(decorator), `Incorrect number of arguments to @${decorator.name} decorator`);
|
|
24454
24422
|
} else {
|
|
24455
24423
|
const meta = unwrapExpression(decorator.args[0]);
|
|
24456
|
-
if (!
|
|
24424
|
+
if (!import_typescript46.default.isObjectLiteralExpression(meta)) {
|
|
24457
24425
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, `@${decorator.name} argument must be an object literal`);
|
|
24458
24426
|
}
|
|
24459
24427
|
directive = reflectObjectLiteral(meta);
|
|
@@ -24580,7 +24548,7 @@ function extractQueryMetadata(exprNode, name, args, propertyName, reflector, eva
|
|
|
24580
24548
|
let emitDistinctChangesOnly = emitDistinctChangesOnlyDefaultValue;
|
|
24581
24549
|
if (args.length === 2) {
|
|
24582
24550
|
const optionsExpr = unwrapExpression(args[1]);
|
|
24583
|
-
if (!
|
|
24551
|
+
if (!import_typescript46.default.isObjectLiteralExpression(optionsExpr)) {
|
|
24584
24552
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, optionsExpr, `@${name} options must be an object literal`);
|
|
24585
24553
|
}
|
|
24586
24554
|
const options = reflectObjectLiteral(optionsExpr);
|
|
@@ -24675,16 +24643,16 @@ function extractHostBindings2(members, evaluator, coreModule, metadata) {
|
|
|
24675
24643
|
}
|
|
24676
24644
|
function extractQueriesFromDecorator(queryData, reflector, evaluator, isCore) {
|
|
24677
24645
|
const content = [], view = [];
|
|
24678
|
-
if (!
|
|
24646
|
+
if (!import_typescript46.default.isObjectLiteralExpression(queryData)) {
|
|
24679
24647
|
throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, queryData, "Decorator queries metadata must be an object literal");
|
|
24680
24648
|
}
|
|
24681
24649
|
reflectObjectLiteral(queryData).forEach((queryExpr, propertyName) => {
|
|
24682
24650
|
queryExpr = unwrapExpression(queryExpr);
|
|
24683
|
-
if (!
|
|
24651
|
+
if (!import_typescript46.default.isNewExpression(queryExpr)) {
|
|
24684
24652
|
throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, queryData, "Decorator query metadata must be an instance of a query type");
|
|
24685
24653
|
}
|
|
24686
|
-
const queryType =
|
|
24687
|
-
if (!
|
|
24654
|
+
const queryType = import_typescript46.default.isPropertyAccessExpression(queryExpr.expression) ? queryExpr.expression.name : queryExpr.expression;
|
|
24655
|
+
if (!import_typescript46.default.isIdentifier(queryType)) {
|
|
24688
24656
|
throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, queryData, "Decorator query metadata must be an instance of a query type");
|
|
24689
24657
|
}
|
|
24690
24658
|
const type = reflector.getImportOfIdentifier(queryType);
|
|
@@ -25089,16 +25057,16 @@ var DirectiveDecoratorHandler = class {
|
|
|
25089
25057
|
};
|
|
25090
25058
|
|
|
25091
25059
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/ng_module/src/handler.mjs
|
|
25092
|
-
var
|
|
25060
|
+
var import_typescript48 = __toESM(require("typescript"), 1);
|
|
25093
25061
|
|
|
25094
25062
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/ng_module/src/module_with_providers.mjs
|
|
25095
|
-
var
|
|
25063
|
+
var import_typescript47 = __toESM(require("typescript"), 1);
|
|
25096
25064
|
function createModuleWithProvidersResolver(reflector, isCore) {
|
|
25097
25065
|
function _reflectModuleFromTypeParam(type, node) {
|
|
25098
|
-
if (!
|
|
25066
|
+
if (!import_typescript47.default.isTypeReferenceNode(type)) {
|
|
25099
25067
|
return null;
|
|
25100
25068
|
}
|
|
25101
|
-
const typeName = type && (
|
|
25069
|
+
const typeName = type && (import_typescript47.default.isIdentifier(type.typeName) && type.typeName || import_typescript47.default.isQualifiedName(type.typeName) && type.typeName.right) || null;
|
|
25102
25070
|
if (typeName === null) {
|
|
25103
25071
|
return null;
|
|
25104
25072
|
}
|
|
@@ -25110,7 +25078,7 @@ function createModuleWithProvidersResolver(reflector, isCore) {
|
|
|
25110
25078
|
return null;
|
|
25111
25079
|
}
|
|
25112
25080
|
if (type.typeArguments === void 0 || type.typeArguments.length !== 1) {
|
|
25113
|
-
const parent =
|
|
25081
|
+
const parent = import_typescript47.default.isMethodDeclaration(node) && import_typescript47.default.isClassDeclaration(node.parent) ? node.parent : null;
|
|
25114
25082
|
const symbolName = (parent && parent.name ? parent.name.getText() + "." : "") + (node.name ? node.name.getText() : "anonymous");
|
|
25115
25083
|
throw new FatalDiagnosticError(ErrorCode.NGMODULE_MODULE_WITH_PROVIDERS_MISSING_GENERIC, type, `${symbolName} returns a ModuleWithProviders type without a generic type argument. Please add a generic type argument to the ModuleWithProviders type. If this occurrence is in library code you don't control, please contact the library authors.`);
|
|
25116
25084
|
}
|
|
@@ -25118,13 +25086,13 @@ function createModuleWithProvidersResolver(reflector, isCore) {
|
|
|
25118
25086
|
return typeNodeToValueExpr(arg);
|
|
25119
25087
|
}
|
|
25120
25088
|
function _reflectModuleFromLiteralType(type) {
|
|
25121
|
-
if (!
|
|
25089
|
+
if (!import_typescript47.default.isIntersectionTypeNode(type)) {
|
|
25122
25090
|
return null;
|
|
25123
25091
|
}
|
|
25124
25092
|
for (const t of type.types) {
|
|
25125
|
-
if (
|
|
25093
|
+
if (import_typescript47.default.isTypeLiteralNode(t)) {
|
|
25126
25094
|
for (const m of t.members) {
|
|
25127
|
-
const ngModuleType =
|
|
25095
|
+
const ngModuleType = import_typescript47.default.isPropertySignature(m) && import_typescript47.default.isIdentifier(m.name) && m.name.text === "ngModule" && m.type || null;
|
|
25128
25096
|
const ngModuleExpression = ngModuleType && typeNodeToValueExpr(ngModuleType);
|
|
25129
25097
|
if (ngModuleExpression) {
|
|
25130
25098
|
return ngModuleExpression;
|
|
@@ -25242,8 +25210,8 @@ var NgModuleDecoratorHandler = class {
|
|
|
25242
25210
|
if (decorator.args === null || decorator.args.length > 1) {
|
|
25243
25211
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, Decorator.nodeForError(decorator), `Incorrect number of arguments to @NgModule decorator`);
|
|
25244
25212
|
}
|
|
25245
|
-
const meta = decorator.args.length === 1 ? unwrapExpression(decorator.args[0]) :
|
|
25246
|
-
if (!
|
|
25213
|
+
const meta = decorator.args.length === 1 ? unwrapExpression(decorator.args[0]) : import_typescript48.default.factory.createObjectLiteralExpression([]);
|
|
25214
|
+
if (!import_typescript48.default.isObjectLiteralExpression(meta)) {
|
|
25247
25215
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, "@NgModule argument must be an object literal");
|
|
25248
25216
|
}
|
|
25249
25217
|
const ngModule = reflectObjectLiteral(meta);
|
|
@@ -25306,7 +25274,7 @@ var NgModuleDecoratorHandler = class {
|
|
|
25306
25274
|
id = new WrappedNodeExpr(idExpr);
|
|
25307
25275
|
} else {
|
|
25308
25276
|
const diag = makeDiagnostic(ErrorCode.WARN_NGMODULE_ID_UNNECESSARY, idExpr, `Using 'module.id' for NgModule.id is a common anti-pattern that is ignored by the Angular compiler.`);
|
|
25309
|
-
diag.category =
|
|
25277
|
+
diag.category = import_typescript48.default.DiagnosticCategory.Warning;
|
|
25310
25278
|
diagnostics.push(diag);
|
|
25311
25279
|
}
|
|
25312
25280
|
}
|
|
@@ -25351,16 +25319,16 @@ var NgModuleDecoratorHandler = class {
|
|
|
25351
25319
|
};
|
|
25352
25320
|
const rawProviders = ngModule.has("providers") ? ngModule.get("providers") : null;
|
|
25353
25321
|
let wrappedProviders = null;
|
|
25354
|
-
if (rawProviders !== null && (!
|
|
25322
|
+
if (rawProviders !== null && (!import_typescript48.default.isArrayLiteralExpression(rawProviders) || rawProviders.elements.length > 0)) {
|
|
25355
25323
|
wrappedProviders = new WrappedNodeExpr(this.annotateForClosureCompiler ? wrapFunctionExpressionsInParens(rawProviders) : rawProviders);
|
|
25356
25324
|
}
|
|
25357
25325
|
const topLevelImports = [];
|
|
25358
25326
|
if (ngModule.has("imports")) {
|
|
25359
25327
|
const rawImports2 = unwrapExpression(ngModule.get("imports"));
|
|
25360
25328
|
let topLevelExpressions = [];
|
|
25361
|
-
if (
|
|
25329
|
+
if (import_typescript48.default.isArrayLiteralExpression(rawImports2)) {
|
|
25362
25330
|
for (const element of rawImports2.elements) {
|
|
25363
|
-
if (
|
|
25331
|
+
if (import_typescript48.default.isSpreadElement(element)) {
|
|
25364
25332
|
topLevelExpressions.push(element.expression);
|
|
25365
25333
|
continue;
|
|
25366
25334
|
}
|
|
@@ -25642,7 +25610,7 @@ function isNgModule(node, compilation) {
|
|
|
25642
25610
|
return !compilation.dependencies.some((dep) => dep.ref.node === node);
|
|
25643
25611
|
}
|
|
25644
25612
|
function isModuleIdExpression(expr) {
|
|
25645
|
-
return
|
|
25613
|
+
return import_typescript48.default.isPropertyAccessExpression(expr) && import_typescript48.default.isIdentifier(expr.expression) && expr.expression.text === "module" && expr.name.text === "id";
|
|
25646
25614
|
}
|
|
25647
25615
|
function makeStandaloneBootstrapDiagnostic(ngModuleClass, bootstrappedClassRef, rawBootstrapExpr) {
|
|
25648
25616
|
const componentClassName = bootstrappedClassRef.node.name.text;
|
|
@@ -25678,7 +25646,7 @@ function checkCustomElementSelectorForErrors(selector) {
|
|
|
25678
25646
|
}
|
|
25679
25647
|
|
|
25680
25648
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/resources.mjs
|
|
25681
|
-
var
|
|
25649
|
+
var import_typescript50 = __toESM(require("typescript"), 1);
|
|
25682
25650
|
function getTemplateDeclarationNodeForError(declaration) {
|
|
25683
25651
|
switch (declaration.isInline) {
|
|
25684
25652
|
case true:
|
|
@@ -25695,7 +25663,7 @@ function extractTemplate(node, template, evaluator, depTracker, resourceLoader,
|
|
|
25695
25663
|
let sourceMapping;
|
|
25696
25664
|
let escapedString = false;
|
|
25697
25665
|
let sourceMapUrl;
|
|
25698
|
-
if (
|
|
25666
|
+
if (import_typescript50.default.isStringLiteral(template.expression) || import_typescript50.default.isNoSubstitutionTemplateLiteral(template.expression)) {
|
|
25699
25667
|
sourceParseRange = getTemplateRange(template.expression);
|
|
25700
25668
|
sourceStr = template.expression.getSourceFile().text;
|
|
25701
25669
|
templateContent = template.expression.text;
|
|
@@ -25777,7 +25745,7 @@ function parseExtractedTemplate(template, sourceStr, sourceParseRange, escapedSt
|
|
|
25777
25745
|
file: new ParseSourceFile(sourceStr, sourceMapUrl != null ? sourceMapUrl : "")
|
|
25778
25746
|
});
|
|
25779
25747
|
}
|
|
25780
|
-
function parseTemplateDeclaration(decorator, component, containingFile, evaluator, resourceLoader, defaultPreserveWhitespaces) {
|
|
25748
|
+
function parseTemplateDeclaration(node, decorator, component, containingFile, evaluator, depTracker, resourceLoader, defaultPreserveWhitespaces) {
|
|
25781
25749
|
let preserveWhitespaces = defaultPreserveWhitespaces;
|
|
25782
25750
|
if (component.has("preserveWhitespaces")) {
|
|
25783
25751
|
const expr = component.get("preserveWhitespaces");
|
|
@@ -25813,6 +25781,9 @@ function parseTemplateDeclaration(decorator, component, containingFile, evaluato
|
|
|
25813
25781
|
resolvedTemplateUrl: resourceUrl
|
|
25814
25782
|
};
|
|
25815
25783
|
} catch (e) {
|
|
25784
|
+
if (depTracker !== null) {
|
|
25785
|
+
depTracker.recordDependencyAnalysisFailure(node.getSourceFile());
|
|
25786
|
+
}
|
|
25816
25787
|
throw makeResourceNotFoundError(templateUrl, templateUrlExpr, 0);
|
|
25817
25788
|
}
|
|
25818
25789
|
} else if (component.has("template")) {
|
|
@@ -25840,7 +25811,7 @@ function preloadAndParseTemplate(evaluator, resourceLoader, depTracker, preanaly
|
|
|
25840
25811
|
const templatePromise = resourceLoader.preload(resourceUrl, { type: "template", containingFile });
|
|
25841
25812
|
if (templatePromise !== void 0) {
|
|
25842
25813
|
return templatePromise.then(() => {
|
|
25843
|
-
const templateDecl = parseTemplateDeclaration(decorator, component, containingFile, evaluator, resourceLoader, defaultPreserveWhitespaces);
|
|
25814
|
+
const templateDecl = parseTemplateDeclaration(node, decorator, component, containingFile, evaluator, depTracker, resourceLoader, defaultPreserveWhitespaces);
|
|
25844
25815
|
const template = extractTemplate(node, templateDecl, evaluator, depTracker, resourceLoader, options);
|
|
25845
25816
|
preanalyzeTemplateCache.set(node, template);
|
|
25846
25817
|
return template;
|
|
@@ -25849,10 +25820,13 @@ function preloadAndParseTemplate(evaluator, resourceLoader, depTracker, preanaly
|
|
|
25849
25820
|
return Promise.resolve(null);
|
|
25850
25821
|
}
|
|
25851
25822
|
} catch (e) {
|
|
25823
|
+
if (depTracker !== null) {
|
|
25824
|
+
depTracker.recordDependencyAnalysisFailure(node.getSourceFile());
|
|
25825
|
+
}
|
|
25852
25826
|
throw makeResourceNotFoundError(templateUrl, templateUrlExpr, 0);
|
|
25853
25827
|
}
|
|
25854
25828
|
} else {
|
|
25855
|
-
const templateDecl = parseTemplateDeclaration(decorator, component, containingFile, evaluator, resourceLoader, defaultPreserveWhitespaces);
|
|
25829
|
+
const templateDecl = parseTemplateDeclaration(node, decorator, component, containingFile, evaluator, depTracker, resourceLoader, defaultPreserveWhitespaces);
|
|
25856
25830
|
const template = extractTemplate(node, templateDecl, evaluator, depTracker, resourceLoader, options);
|
|
25857
25831
|
preanalyzeTemplateCache.set(node, template);
|
|
25858
25832
|
return Promise.resolve(template);
|
|
@@ -25860,7 +25834,7 @@ function preloadAndParseTemplate(evaluator, resourceLoader, depTracker, preanaly
|
|
|
25860
25834
|
}
|
|
25861
25835
|
function getTemplateRange(templateExpr) {
|
|
25862
25836
|
const startPos = templateExpr.getStart() + 1;
|
|
25863
|
-
const { line, character } =
|
|
25837
|
+
const { line, character } = import_typescript50.default.getLineAndCharacterOfPosition(templateExpr.getSourceFile(), startPos);
|
|
25864
25838
|
return {
|
|
25865
25839
|
startPos,
|
|
25866
25840
|
startLine: line,
|
|
@@ -25893,7 +25867,7 @@ function transformDecoratorResources(dec, component, styles, template) {
|
|
|
25893
25867
|
const metadata = new Map(component);
|
|
25894
25868
|
if (metadata.has("templateUrl")) {
|
|
25895
25869
|
metadata.delete("templateUrl");
|
|
25896
|
-
metadata.set("template",
|
|
25870
|
+
metadata.set("template", import_typescript50.default.factory.createStringLiteral(template.content));
|
|
25897
25871
|
}
|
|
25898
25872
|
if (metadata.has("styleUrls") || metadata.has("styles")) {
|
|
25899
25873
|
metadata.delete("styles");
|
|
@@ -25901,20 +25875,20 @@ function transformDecoratorResources(dec, component, styles, template) {
|
|
|
25901
25875
|
if (styles.length > 0) {
|
|
25902
25876
|
const styleNodes = styles.reduce((result, style) => {
|
|
25903
25877
|
if (style.trim().length > 0) {
|
|
25904
|
-
result.push(
|
|
25878
|
+
result.push(import_typescript50.default.factory.createStringLiteral(style));
|
|
25905
25879
|
}
|
|
25906
25880
|
return result;
|
|
25907
25881
|
}, []);
|
|
25908
25882
|
if (styleNodes.length > 0) {
|
|
25909
|
-
metadata.set("styles",
|
|
25883
|
+
metadata.set("styles", import_typescript50.default.factory.createArrayLiteralExpression(styleNodes));
|
|
25910
25884
|
}
|
|
25911
25885
|
}
|
|
25912
25886
|
}
|
|
25913
25887
|
const newMetadataFields = [];
|
|
25914
25888
|
for (const [name, value] of metadata.entries()) {
|
|
25915
|
-
newMetadataFields.push(
|
|
25889
|
+
newMetadataFields.push(import_typescript50.default.factory.createPropertyAssignment(name, value));
|
|
25916
25890
|
}
|
|
25917
|
-
return __spreadProps(__spreadValues({}, dec), { args: [
|
|
25891
|
+
return __spreadProps(__spreadValues({}, dec), { args: [import_typescript50.default.factory.createObjectLiteralExpression(newMetadataFields)] });
|
|
25918
25892
|
}
|
|
25919
25893
|
function extractComponentStyleUrls(evaluator, component) {
|
|
25920
25894
|
if (!component.has("styleUrls")) {
|
|
@@ -25924,9 +25898,9 @@ function extractComponentStyleUrls(evaluator, component) {
|
|
|
25924
25898
|
}
|
|
25925
25899
|
function extractStyleUrlsFromExpression(evaluator, styleUrlsExpr) {
|
|
25926
25900
|
const styleUrls = [];
|
|
25927
|
-
if (
|
|
25901
|
+
if (import_typescript50.default.isArrayLiteralExpression(styleUrlsExpr)) {
|
|
25928
25902
|
for (const styleUrlExpr of styleUrlsExpr.elements) {
|
|
25929
|
-
if (
|
|
25903
|
+
if (import_typescript50.default.isSpreadElement(styleUrlExpr)) {
|
|
25930
25904
|
styleUrls.push(...extractStyleUrlsFromExpression(evaluator, styleUrlExpr.expression));
|
|
25931
25905
|
} else {
|
|
25932
25906
|
const styleUrl = evaluator.evaluate(styleUrlExpr);
|
|
@@ -25958,10 +25932,10 @@ function extractStyleUrlsFromExpression(evaluator, styleUrlsExpr) {
|
|
|
25958
25932
|
function extractStyleResources(resourceLoader, component, containingFile) {
|
|
25959
25933
|
const styles = /* @__PURE__ */ new Set();
|
|
25960
25934
|
function stringLiteralElements(array) {
|
|
25961
|
-
return array.elements.filter((e) =>
|
|
25935
|
+
return array.elements.filter((e) => import_typescript50.default.isStringLiteralLike(e));
|
|
25962
25936
|
}
|
|
25963
25937
|
const styleUrlsExpr = component.get("styleUrls");
|
|
25964
|
-
if (styleUrlsExpr !== void 0 &&
|
|
25938
|
+
if (styleUrlsExpr !== void 0 && import_typescript50.default.isArrayLiteralExpression(styleUrlsExpr)) {
|
|
25965
25939
|
for (const expression of stringLiteralElements(styleUrlsExpr)) {
|
|
25966
25940
|
try {
|
|
25967
25941
|
const resourceUrl = resourceLoader.resolve(expression.text, containingFile);
|
|
@@ -25971,7 +25945,7 @@ function extractStyleResources(resourceLoader, component, containingFile) {
|
|
|
25971
25945
|
}
|
|
25972
25946
|
}
|
|
25973
25947
|
const stylesExpr = component.get("styles");
|
|
25974
|
-
if (stylesExpr !== void 0 &&
|
|
25948
|
+
if (stylesExpr !== void 0 && import_typescript50.default.isArrayLiteralExpression(stylesExpr)) {
|
|
25975
25949
|
for (const expression of stringLiteralElements(stylesExpr)) {
|
|
25976
25950
|
styles.add({ path: null, expression });
|
|
25977
25951
|
}
|
|
@@ -26282,7 +26256,7 @@ var ComponentDecoratorHandler = class {
|
|
|
26282
26256
|
this.preanalyzeTemplateCache.delete(node);
|
|
26283
26257
|
template = preanalyzed;
|
|
26284
26258
|
} else {
|
|
26285
|
-
const templateDecl = parseTemplateDeclaration(decorator, component, containingFile, this.evaluator, this.resourceLoader, this.defaultPreserveWhitespaces);
|
|
26259
|
+
const templateDecl = parseTemplateDeclaration(node, decorator, component, containingFile, this.evaluator, this.depTracker, this.resourceLoader, this.defaultPreserveWhitespaces);
|
|
26286
26260
|
template = extractTemplate(node, templateDecl, this.evaluator, this.depTracker, this.resourceLoader, {
|
|
26287
26261
|
enableI18nLegacyMessageIdFormat: this.enableI18nLegacyMessageIdFormat,
|
|
26288
26262
|
i18nNormalizeLineEndingsInICUs: this.i18nNormalizeLineEndingsInICUs,
|
|
@@ -26308,6 +26282,9 @@ var ComponentDecoratorHandler = class {
|
|
|
26308
26282
|
this.depTracker.addResourceDependency(node.getSourceFile(), absoluteFrom(resourceUrl));
|
|
26309
26283
|
}
|
|
26310
26284
|
} catch (e) {
|
|
26285
|
+
if (this.depTracker !== null) {
|
|
26286
|
+
this.depTracker.recordDependencyAnalysisFailure(node.getSourceFile());
|
|
26287
|
+
}
|
|
26311
26288
|
if (diagnostics === void 0) {
|
|
26312
26289
|
diagnostics = [];
|
|
26313
26290
|
}
|
|
@@ -26455,7 +26432,7 @@ var ComponentDecoratorHandler = class {
|
|
|
26455
26432
|
});
|
|
26456
26433
|
}
|
|
26457
26434
|
typeCheck(ctx, node, meta) {
|
|
26458
|
-
if (this.typeCheckScopeRegistry === null || !
|
|
26435
|
+
if (this.typeCheckScopeRegistry === null || !import_typescript51.default.isClassDeclaration(node)) {
|
|
26459
26436
|
return;
|
|
26460
26437
|
}
|
|
26461
26438
|
if (meta.isPoisoned && !this.usePoisonedData) {
|
|
@@ -26741,7 +26718,7 @@ function validateStandaloneImports(importRefs, importExpr2, metaReader, scopeRea
|
|
|
26741
26718
|
}
|
|
26742
26719
|
|
|
26743
26720
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/injectable.mjs
|
|
26744
|
-
var
|
|
26721
|
+
var import_typescript53 = __toESM(require("typescript"), 1);
|
|
26745
26722
|
var InjectableDecoratorHandler = class {
|
|
26746
26723
|
constructor(reflector, evaluator, isCore, strictCtorDeps, injectableRegistry, perf, errorOnDuplicateProv = true) {
|
|
26747
26724
|
this.reflector = reflector;
|
|
@@ -26846,7 +26823,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
|
|
|
26846
26823
|
};
|
|
26847
26824
|
} else if (decorator.args.length === 1) {
|
|
26848
26825
|
const metaNode = decorator.args[0];
|
|
26849
|
-
if (!
|
|
26826
|
+
if (!import_typescript53.default.isObjectLiteralExpression(metaNode)) {
|
|
26850
26827
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, metaNode, `@Injectable argument must be an object literal`);
|
|
26851
26828
|
}
|
|
26852
26829
|
const meta = reflectObjectLiteral(metaNode);
|
|
@@ -26854,7 +26831,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
|
|
|
26854
26831
|
let deps = void 0;
|
|
26855
26832
|
if ((meta.has("useClass") || meta.has("useFactory")) && meta.has("deps")) {
|
|
26856
26833
|
const depsExpr = meta.get("deps");
|
|
26857
|
-
if (!
|
|
26834
|
+
if (!import_typescript53.default.isArrayLiteralExpression(depsExpr)) {
|
|
26858
26835
|
throw new FatalDiagnosticError(ErrorCode.VALUE_NOT_LITERAL, depsExpr, `@Injectable deps metadata must be an inline array`);
|
|
26859
26836
|
}
|
|
26860
26837
|
deps = depsExpr.elements.map((dep) => getDep(dep, reflector));
|
|
@@ -26939,12 +26916,12 @@ function getDep(dep, reflector) {
|
|
|
26939
26916
|
}
|
|
26940
26917
|
return true;
|
|
26941
26918
|
}
|
|
26942
|
-
if (
|
|
26919
|
+
if (import_typescript53.default.isArrayLiteralExpression(dep)) {
|
|
26943
26920
|
dep.elements.forEach((el) => {
|
|
26944
26921
|
let isDecorator = false;
|
|
26945
|
-
if (
|
|
26922
|
+
if (import_typescript53.default.isIdentifier(el)) {
|
|
26946
26923
|
isDecorator = maybeUpdateDecorator(el, reflector);
|
|
26947
|
-
} else if (
|
|
26924
|
+
} else if (import_typescript53.default.isNewExpression(el) && import_typescript53.default.isIdentifier(el.expression)) {
|
|
26948
26925
|
const token = el.arguments && el.arguments.length > 0 && el.arguments[0] || void 0;
|
|
26949
26926
|
isDecorator = maybeUpdateDecorator(el.expression, reflector, token);
|
|
26950
26927
|
}
|
|
@@ -26957,7 +26934,7 @@ function getDep(dep, reflector) {
|
|
|
26957
26934
|
}
|
|
26958
26935
|
|
|
26959
26936
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/pipe.mjs
|
|
26960
|
-
var
|
|
26937
|
+
var import_typescript54 = __toESM(require("typescript"), 1);
|
|
26961
26938
|
var PipeSymbol = class extends SemanticSymbol {
|
|
26962
26939
|
constructor(decl, name) {
|
|
26963
26940
|
super(decl);
|
|
@@ -27013,7 +26990,7 @@ var PipeDecoratorHandler = class {
|
|
|
27013
26990
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, Decorator.nodeForError(decorator), "@Pipe must have exactly one argument");
|
|
27014
26991
|
}
|
|
27015
26992
|
const meta = unwrapExpression(decorator.args[0]);
|
|
27016
|
-
if (!
|
|
26993
|
+
if (!import_typescript54.default.isObjectLiteralExpression(meta)) {
|
|
27017
26994
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, "@Pipe must have a literal argument");
|
|
27018
26995
|
}
|
|
27019
26996
|
const pipe = reflectObjectLiteral(meta);
|
|
@@ -27173,7 +27150,7 @@ var Cycle = class {
|
|
|
27173
27150
|
};
|
|
27174
27151
|
|
|
27175
27152
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/cycles/src/imports.mjs
|
|
27176
|
-
var
|
|
27153
|
+
var import_typescript55 = __toESM(require("typescript"), 1);
|
|
27177
27154
|
var ImportGraph = class {
|
|
27178
27155
|
constructor(checker, perf) {
|
|
27179
27156
|
this.checker = checker;
|
|
@@ -27217,10 +27194,10 @@ var ImportGraph = class {
|
|
|
27217
27194
|
return this.perf.inPhase(PerfPhase.CycleDetection, () => {
|
|
27218
27195
|
const imports = /* @__PURE__ */ new Set();
|
|
27219
27196
|
for (const stmt of sf.statements) {
|
|
27220
|
-
if (!
|
|
27197
|
+
if (!import_typescript55.default.isImportDeclaration(stmt) && !import_typescript55.default.isExportDeclaration(stmt) || stmt.moduleSpecifier === void 0) {
|
|
27221
27198
|
continue;
|
|
27222
27199
|
}
|
|
27223
|
-
if (
|
|
27200
|
+
if (import_typescript55.default.isImportDeclaration(stmt) && stmt.importClause !== void 0 && isTypeOnlyImportClause(stmt.importClause)) {
|
|
27224
27201
|
continue;
|
|
27225
27202
|
}
|
|
27226
27203
|
const symbol = this.checker.getSymbolAtLocation(stmt.moduleSpecifier);
|
|
@@ -27228,7 +27205,7 @@ var ImportGraph = class {
|
|
|
27228
27205
|
continue;
|
|
27229
27206
|
}
|
|
27230
27207
|
const moduleFile = symbol.valueDeclaration;
|
|
27231
|
-
if (
|
|
27208
|
+
if (import_typescript55.default.isSourceFile(moduleFile) && isLocalFile(moduleFile)) {
|
|
27232
27209
|
imports.add(moduleFile);
|
|
27233
27210
|
}
|
|
27234
27211
|
}
|
|
@@ -27243,7 +27220,7 @@ function isTypeOnlyImportClause(node) {
|
|
|
27243
27220
|
if (node.isTypeOnly) {
|
|
27244
27221
|
return true;
|
|
27245
27222
|
}
|
|
27246
|
-
if (node.namedBindings !== void 0 &&
|
|
27223
|
+
if (node.namedBindings !== void 0 && import_typescript55.default.isNamedImports(node.namedBindings) && node.namedBindings.elements.every((specifier) => specifier.isTypeOnly)) {
|
|
27247
27224
|
return true;
|
|
27248
27225
|
}
|
|
27249
27226
|
return false;
|
|
@@ -27265,7 +27242,7 @@ var Found = class {
|
|
|
27265
27242
|
};
|
|
27266
27243
|
|
|
27267
27244
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/entry_point/src/generator.mjs
|
|
27268
|
-
var
|
|
27245
|
+
var import_typescript56 = __toESM(require("typescript"), 1);
|
|
27269
27246
|
var FlatIndexGenerator = class {
|
|
27270
27247
|
constructor(entryPoint, relativeFlatIndexPath, moduleName) {
|
|
27271
27248
|
this.entryPoint = entryPoint;
|
|
@@ -27281,7 +27258,7 @@ var FlatIndexGenerator = class {
|
|
|
27281
27258
|
|
|
27282
27259
|
export * from '${relativeEntryPoint}';
|
|
27283
27260
|
`;
|
|
27284
|
-
const genFile =
|
|
27261
|
+
const genFile = import_typescript56.default.createSourceFile(this.flatIndexPath, contents, import_typescript56.default.ScriptTarget.ES2015, true, import_typescript56.default.ScriptKind.TS);
|
|
27285
27262
|
if (this.moduleName !== null) {
|
|
27286
27263
|
genFile.moduleName = this.moduleName;
|
|
27287
27264
|
}
|
|
@@ -27306,7 +27283,7 @@ function findFlatIndexEntryPoint(rootFiles) {
|
|
|
27306
27283
|
}
|
|
27307
27284
|
|
|
27308
27285
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/entry_point/src/private_export_checker.mjs
|
|
27309
|
-
var
|
|
27286
|
+
var import_typescript58 = __toESM(require("typescript"), 1);
|
|
27310
27287
|
function checkForPrivateExports(entryPoint, checker, refGraph) {
|
|
27311
27288
|
const diagnostics = [];
|
|
27312
27289
|
const topLevelExports = /* @__PURE__ */ new Set();
|
|
@@ -27316,7 +27293,7 @@ function checkForPrivateExports(entryPoint, checker, refGraph) {
|
|
|
27316
27293
|
}
|
|
27317
27294
|
const exportedSymbols = checker.getExportsOfModule(moduleSymbol);
|
|
27318
27295
|
exportedSymbols.forEach((symbol) => {
|
|
27319
|
-
if (symbol.flags &
|
|
27296
|
+
if (symbol.flags & import_typescript58.default.SymbolFlags.Alias) {
|
|
27320
27297
|
symbol = checker.getAliasedSymbol(symbol);
|
|
27321
27298
|
}
|
|
27322
27299
|
const decl = symbol.valueDeclaration;
|
|
@@ -27340,7 +27317,7 @@ function checkForPrivateExports(entryPoint, checker, refGraph) {
|
|
|
27340
27317
|
visibleVia = transitivePath.map((seg) => getNameOfDeclaration(seg)).join(" -> ");
|
|
27341
27318
|
}
|
|
27342
27319
|
const diagnostic = __spreadProps(__spreadValues({
|
|
27343
|
-
category:
|
|
27320
|
+
category: import_typescript58.default.DiagnosticCategory.Error,
|
|
27344
27321
|
code: ngErrorCode(ErrorCode.SYMBOL_NOT_EXPORTED),
|
|
27345
27322
|
file: transitiveReference.getSourceFile()
|
|
27346
27323
|
}, getPosOfDeclaration(transitiveReference)), {
|
|
@@ -27360,7 +27337,7 @@ function getPosOfDeclaration(decl) {
|
|
|
27360
27337
|
};
|
|
27361
27338
|
}
|
|
27362
27339
|
function getIdentifierOfDeclaration(decl) {
|
|
27363
|
-
if ((
|
|
27340
|
+
if ((import_typescript58.default.isClassDeclaration(decl) || import_typescript58.default.isVariableDeclaration(decl) || import_typescript58.default.isFunctionDeclaration(decl)) && decl.name !== void 0 && import_typescript58.default.isIdentifier(decl.name)) {
|
|
27364
27341
|
return decl.name;
|
|
27365
27342
|
} else {
|
|
27366
27343
|
return null;
|
|
@@ -27372,13 +27349,13 @@ function getNameOfDeclaration(decl) {
|
|
|
27372
27349
|
}
|
|
27373
27350
|
function getDescriptorOfDeclaration(decl) {
|
|
27374
27351
|
switch (decl.kind) {
|
|
27375
|
-
case
|
|
27352
|
+
case import_typescript58.default.SyntaxKind.ClassDeclaration:
|
|
27376
27353
|
return "class";
|
|
27377
|
-
case
|
|
27354
|
+
case import_typescript58.default.SyntaxKind.FunctionDeclaration:
|
|
27378
27355
|
return "function";
|
|
27379
|
-
case
|
|
27356
|
+
case import_typescript58.default.SyntaxKind.VariableDeclaration:
|
|
27380
27357
|
return "variable";
|
|
27381
|
-
case
|
|
27358
|
+
case import_typescript58.default.SyntaxKind.EnumDeclaration:
|
|
27382
27359
|
return "enum";
|
|
27383
27360
|
default:
|
|
27384
27361
|
return "declaration";
|
|
@@ -27448,10 +27425,10 @@ var UpdateMode;
|
|
|
27448
27425
|
})(UpdateMode || (UpdateMode = {}));
|
|
27449
27426
|
|
|
27450
27427
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/program_driver/src/ts_create_program_driver.mjs
|
|
27451
|
-
var
|
|
27428
|
+
var import_typescript62 = __toESM(require("typescript"), 1);
|
|
27452
27429
|
|
|
27453
27430
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/adapter.mjs
|
|
27454
|
-
var
|
|
27431
|
+
var import_typescript59 = __toESM(require("typescript"), 1);
|
|
27455
27432
|
|
|
27456
27433
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/expando.mjs
|
|
27457
27434
|
var NgExtension = Symbol("NgExtension");
|
|
@@ -27582,10 +27559,10 @@ var ShimAdapter = class {
|
|
|
27582
27559
|
}
|
|
27583
27560
|
const prefix = match[1];
|
|
27584
27561
|
let baseFileName = absoluteFrom(prefix + ".ts");
|
|
27585
|
-
let inputFile = this.delegate.getSourceFile(baseFileName,
|
|
27562
|
+
let inputFile = this.delegate.getSourceFile(baseFileName, import_typescript59.default.ScriptTarget.Latest);
|
|
27586
27563
|
if (inputFile === void 0) {
|
|
27587
27564
|
baseFileName = absoluteFrom(prefix + ".tsx");
|
|
27588
|
-
inputFile = this.delegate.getSourceFile(baseFileName,
|
|
27565
|
+
inputFile = this.delegate.getSourceFile(baseFileName, import_typescript59.default.ScriptTarget.Latest);
|
|
27589
27566
|
}
|
|
27590
27567
|
if (inputFile === void 0 || isShim(inputFile)) {
|
|
27591
27568
|
return void 0;
|
|
@@ -27673,6 +27650,8 @@ var DelegatingCompilerHost = class {
|
|
|
27673
27650
|
this.useCaseSensitiveFileNames = this.delegateMethod("useCaseSensitiveFileNames");
|
|
27674
27651
|
this.getModuleResolutionCache = this.delegateMethod("getModuleResolutionCache");
|
|
27675
27652
|
this.hasInvalidatedResolutions = this.delegateMethod("hasInvalidatedResolutions");
|
|
27653
|
+
this.resolveModuleNameLiterals = this.delegateMethod("resolveModuleNameLiterals");
|
|
27654
|
+
this.resolveTypeReferenceDirectiveReferences = this.delegateMethod("resolveTypeReferenceDirectiveReferences");
|
|
27676
27655
|
}
|
|
27677
27656
|
delegateMethod(name) {
|
|
27678
27657
|
return this.delegate[name] !== void 0 ? this.delegate[name].bind(this.delegate) : void 0;
|
|
@@ -27738,7 +27717,7 @@ var TsCreateProgramDriver = class {
|
|
|
27738
27717
|
this.sfMap.clear();
|
|
27739
27718
|
}
|
|
27740
27719
|
for (const [filePath, { newText, originalFile }] of contents.entries()) {
|
|
27741
|
-
const sf =
|
|
27720
|
+
const sf = import_typescript62.default.createSourceFile(filePath, newText, import_typescript62.default.ScriptTarget.Latest, true);
|
|
27742
27721
|
if (originalFile !== null) {
|
|
27743
27722
|
sf[NgOriginalFile] = originalFile;
|
|
27744
27723
|
}
|
|
@@ -27747,7 +27726,7 @@ var TsCreateProgramDriver = class {
|
|
|
27747
27726
|
const host = new UpdatedProgramHost(this.sfMap, this.originalProgram, this.originalHost, this.shimExtensionPrefixes);
|
|
27748
27727
|
const oldProgram = this.program;
|
|
27749
27728
|
retagAllTsFiles(oldProgram);
|
|
27750
|
-
this.program =
|
|
27729
|
+
this.program = import_typescript62.default.createProgram({
|
|
27751
27730
|
host,
|
|
27752
27731
|
rootNames: this.program.getRootFileNames(),
|
|
27753
27732
|
options: this.options,
|
|
@@ -28446,7 +28425,7 @@ var NgModuleIndexImpl = class {
|
|
|
28446
28425
|
};
|
|
28447
28426
|
|
|
28448
28427
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/resource/src/loader.mjs
|
|
28449
|
-
var
|
|
28428
|
+
var import_typescript65 = __toESM(require("typescript"), 1);
|
|
28450
28429
|
var CSS_PREPROCESSOR_EXT = /(\.scss|\.sass|\.less|\.styl)$/;
|
|
28451
28430
|
var RESOURCE_MARKER = ".$ngresource$";
|
|
28452
28431
|
var RESOURCE_MARKER_TS = RESOURCE_MARKER + ".ts";
|
|
@@ -28558,7 +28537,7 @@ var AdapterResourceLoader = class {
|
|
|
28558
28537
|
return this.adapter.rootDirs.map((rootDir) => join(rootDir, segment));
|
|
28559
28538
|
}
|
|
28560
28539
|
getResolvedCandidateLocations(url, fromFile) {
|
|
28561
|
-
const failedLookup =
|
|
28540
|
+
const failedLookup = import_typescript65.default.resolveModuleName(url + RESOURCE_MARKER, fromFile, this.options, this.lookupResolutionHost);
|
|
28562
28541
|
if (failedLookup.failedLookupLocations === void 0) {
|
|
28563
28542
|
throw new Error(`Internal error: expected to find failedLookupLocations during resolution of resource '${url}' in context of ${fromFile}`);
|
|
28564
28543
|
}
|
|
@@ -28714,7 +28693,7 @@ var SymbolKind;
|
|
|
28714
28693
|
})(SymbolKind || (SymbolKind = {}));
|
|
28715
28694
|
|
|
28716
28695
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/diagnostics/src/diagnostic.mjs
|
|
28717
|
-
var
|
|
28696
|
+
var import_typescript66 = __toESM(require("typescript"), 1);
|
|
28718
28697
|
function makeTemplateDiagnostic(templateId, mapping, span, category, code, messageText, relatedMessages) {
|
|
28719
28698
|
var _a;
|
|
28720
28699
|
if (mapping.type === "direct") {
|
|
@@ -28723,7 +28702,7 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
28723
28702
|
relatedInformation = [];
|
|
28724
28703
|
for (const relatedMessage of relatedMessages) {
|
|
28725
28704
|
relatedInformation.push({
|
|
28726
|
-
category:
|
|
28705
|
+
category: import_typescript66.default.DiagnosticCategory.Message,
|
|
28727
28706
|
code: 0,
|
|
28728
28707
|
file: relatedMessage.sourceFile,
|
|
28729
28708
|
start: relatedMessage.start,
|
|
@@ -28752,7 +28731,7 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
28752
28731
|
if (relatedMessages !== void 0) {
|
|
28753
28732
|
for (const relatedMessage of relatedMessages) {
|
|
28754
28733
|
relatedInformation.push({
|
|
28755
|
-
category:
|
|
28734
|
+
category: import_typescript66.default.DiagnosticCategory.Message,
|
|
28756
28735
|
code: 0,
|
|
28757
28736
|
file: relatedMessage.sourceFile,
|
|
28758
28737
|
start: relatedMessage.start,
|
|
@@ -28782,7 +28761,7 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
28782
28761
|
};
|
|
28783
28762
|
}
|
|
28784
28763
|
relatedInformation.push({
|
|
28785
|
-
category:
|
|
28764
|
+
category: import_typescript66.default.DiagnosticCategory.Message,
|
|
28786
28765
|
code: 0,
|
|
28787
28766
|
file: componentSf,
|
|
28788
28767
|
start: mapping.node.getStart(),
|
|
@@ -28817,7 +28796,7 @@ function parseTemplateAsSourceFile(fileName, template) {
|
|
|
28817
28796
|
if (parseTemplateAsSourceFileForTest !== null) {
|
|
28818
28797
|
return parseTemplateAsSourceFileForTest(fileName, template);
|
|
28819
28798
|
}
|
|
28820
|
-
return
|
|
28799
|
+
return import_typescript66.default.createSourceFile(fileName, template, import_typescript66.default.ScriptTarget.Latest, false, import_typescript66.default.ScriptKind.JSX);
|
|
28821
28800
|
}
|
|
28822
28801
|
|
|
28823
28802
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/diagnostics/src/id.mjs
|
|
@@ -28838,14 +28817,14 @@ function allocateTemplateId(sf) {
|
|
|
28838
28817
|
}
|
|
28839
28818
|
|
|
28840
28819
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/completion.mjs
|
|
28841
|
-
var
|
|
28820
|
+
var import_typescript68 = __toESM(require("typescript"), 1);
|
|
28842
28821
|
|
|
28843
28822
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/comments.mjs
|
|
28844
|
-
var
|
|
28823
|
+
var import_typescript67 = __toESM(require("typescript"), 1);
|
|
28845
28824
|
var parseSpanComment = /^(\d+),(\d+)$/;
|
|
28846
28825
|
function readSpanComment(node, sourceFile = node.getSourceFile()) {
|
|
28847
|
-
return
|
|
28848
|
-
if (kind !==
|
|
28826
|
+
return import_typescript67.default.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
28827
|
+
if (kind !== import_typescript67.default.SyntaxKind.MultiLineCommentTrivia) {
|
|
28849
28828
|
return null;
|
|
28850
28829
|
}
|
|
28851
28830
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -28868,25 +28847,25 @@ var ExpressionIdentifier;
|
|
|
28868
28847
|
ExpressionIdentifier2["EVENT_PARAMETER"] = "EP";
|
|
28869
28848
|
})(ExpressionIdentifier || (ExpressionIdentifier = {}));
|
|
28870
28849
|
function addExpressionIdentifier(node, identifier) {
|
|
28871
|
-
|
|
28850
|
+
import_typescript67.default.addSyntheticTrailingComment(
|
|
28872
28851
|
node,
|
|
28873
|
-
|
|
28852
|
+
import_typescript67.default.SyntaxKind.MultiLineCommentTrivia,
|
|
28874
28853
|
`${CommentTriviaType.EXPRESSION_TYPE_IDENTIFIER}:${identifier}`,
|
|
28875
28854
|
false
|
|
28876
28855
|
);
|
|
28877
28856
|
}
|
|
28878
28857
|
var IGNORE_FOR_DIAGNOSTICS_MARKER = `${CommentTriviaType.DIAGNOSTIC}:ignore`;
|
|
28879
28858
|
function markIgnoreDiagnostics(node) {
|
|
28880
|
-
|
|
28859
|
+
import_typescript67.default.addSyntheticTrailingComment(
|
|
28881
28860
|
node,
|
|
28882
|
-
|
|
28861
|
+
import_typescript67.default.SyntaxKind.MultiLineCommentTrivia,
|
|
28883
28862
|
IGNORE_FOR_DIAGNOSTICS_MARKER,
|
|
28884
28863
|
false
|
|
28885
28864
|
);
|
|
28886
28865
|
}
|
|
28887
28866
|
function hasIgnoreForDiagnosticsMarker(node, sourceFile) {
|
|
28888
|
-
return
|
|
28889
|
-
if (kind !==
|
|
28867
|
+
return import_typescript67.default.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
28868
|
+
if (kind !== import_typescript67.default.SyntaxKind.MultiLineCommentTrivia) {
|
|
28890
28869
|
return null;
|
|
28891
28870
|
}
|
|
28892
28871
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -28960,8 +28939,8 @@ function findAllMatchingNodes(tcb, opts) {
|
|
|
28960
28939
|
return results;
|
|
28961
28940
|
}
|
|
28962
28941
|
function hasExpressionIdentifier(sourceFile, node, identifier) {
|
|
28963
|
-
return
|
|
28964
|
-
if (kind !==
|
|
28942
|
+
return import_typescript67.default.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
28943
|
+
if (kind !== import_typescript67.default.SyntaxKind.MultiLineCommentTrivia) {
|
|
28965
28944
|
return false;
|
|
28966
28945
|
}
|
|
28967
28946
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -28979,7 +28958,7 @@ var CompletionEngine = class {
|
|
|
28979
28958
|
this.templateContextCache = /* @__PURE__ */ new Map();
|
|
28980
28959
|
this.expressionCompletionCache = /* @__PURE__ */ new Map();
|
|
28981
28960
|
const globalRead = findFirstMatchingNode(this.tcb, {
|
|
28982
|
-
filter:
|
|
28961
|
+
filter: import_typescript68.default.isPropertyAccessExpression,
|
|
28983
28962
|
withExpressionIdentifier: ExpressionIdentifier.COMPONENT_COMPLETION
|
|
28984
28963
|
});
|
|
28985
28964
|
if (globalRead !== null) {
|
|
@@ -29003,7 +28982,7 @@ var CompletionEngine = class {
|
|
|
29003
28982
|
let nodeContext = null;
|
|
29004
28983
|
if (node instanceof EmptyExpr) {
|
|
29005
28984
|
const nodeLocation = findFirstMatchingNode(this.tcb, {
|
|
29006
|
-
filter:
|
|
28985
|
+
filter: import_typescript68.default.isIdentifier,
|
|
29007
28986
|
withSpan: node.sourceSpan
|
|
29008
28987
|
});
|
|
29009
28988
|
if (nodeLocation !== null) {
|
|
@@ -29016,7 +28995,7 @@ var CompletionEngine = class {
|
|
|
29016
28995
|
}
|
|
29017
28996
|
if (node instanceof PropertyRead && node.receiver instanceof ImplicitReceiver) {
|
|
29018
28997
|
const nodeLocation = findFirstMatchingNode(this.tcb, {
|
|
29019
|
-
filter:
|
|
28998
|
+
filter: import_typescript68.default.isPropertyAccessExpression,
|
|
29020
28999
|
withSpan: node.sourceSpan
|
|
29021
29000
|
});
|
|
29022
29001
|
if (nodeLocation) {
|
|
@@ -29040,21 +29019,21 @@ var CompletionEngine = class {
|
|
|
29040
29019
|
let tsExpr = null;
|
|
29041
29020
|
if (expr instanceof PropertyRead || expr instanceof PropertyWrite) {
|
|
29042
29021
|
tsExpr = findFirstMatchingNode(this.tcb, {
|
|
29043
|
-
filter:
|
|
29022
|
+
filter: import_typescript68.default.isPropertyAccessExpression,
|
|
29044
29023
|
withSpan: expr.nameSpan
|
|
29045
29024
|
});
|
|
29046
29025
|
} else if (expr instanceof SafePropertyRead) {
|
|
29047
29026
|
const ternaryExpr = findFirstMatchingNode(this.tcb, {
|
|
29048
|
-
filter:
|
|
29027
|
+
filter: import_typescript68.default.isParenthesizedExpression,
|
|
29049
29028
|
withSpan: expr.sourceSpan
|
|
29050
29029
|
});
|
|
29051
|
-
if (ternaryExpr === null || !
|
|
29030
|
+
if (ternaryExpr === null || !import_typescript68.default.isConditionalExpression(ternaryExpr.expression)) {
|
|
29052
29031
|
return null;
|
|
29053
29032
|
}
|
|
29054
29033
|
const whenTrue = ternaryExpr.expression.whenTrue;
|
|
29055
|
-
if (
|
|
29034
|
+
if (import_typescript68.default.isPropertyAccessExpression(whenTrue)) {
|
|
29056
29035
|
tsExpr = whenTrue;
|
|
29057
|
-
} else if (
|
|
29036
|
+
} else if (import_typescript68.default.isCallExpression(whenTrue) && import_typescript68.default.isPropertyAccessExpression(whenTrue.expression)) {
|
|
29058
29037
|
tsExpr = whenTrue.expression;
|
|
29059
29038
|
}
|
|
29060
29039
|
}
|
|
@@ -29076,15 +29055,15 @@ var CompletionEngine = class {
|
|
|
29076
29055
|
let tsExpr = null;
|
|
29077
29056
|
if (expr instanceof TextAttribute) {
|
|
29078
29057
|
const strNode = findFirstMatchingNode(this.tcb, {
|
|
29079
|
-
filter:
|
|
29058
|
+
filter: import_typescript68.default.isParenthesizedExpression,
|
|
29080
29059
|
withSpan: expr.sourceSpan
|
|
29081
29060
|
});
|
|
29082
|
-
if (strNode !== null &&
|
|
29061
|
+
if (strNode !== null && import_typescript68.default.isStringLiteral(strNode.expression)) {
|
|
29083
29062
|
tsExpr = strNode.expression;
|
|
29084
29063
|
}
|
|
29085
29064
|
} else {
|
|
29086
29065
|
tsExpr = findFirstMatchingNode(this.tcb, {
|
|
29087
|
-
filter: (n) =>
|
|
29066
|
+
filter: (n) => import_typescript68.default.isStringLiteral(n) || import_typescript68.default.isNumericLiteral(n),
|
|
29088
29067
|
withSpan: expr.sourceSpan
|
|
29089
29068
|
});
|
|
29090
29069
|
}
|
|
@@ -29092,7 +29071,7 @@ var CompletionEngine = class {
|
|
|
29092
29071
|
return null;
|
|
29093
29072
|
}
|
|
29094
29073
|
let positionInShimFile = tsExpr.getEnd();
|
|
29095
|
-
if (
|
|
29074
|
+
if (import_typescript68.default.isStringLiteral(tsExpr)) {
|
|
29096
29075
|
positionInShimFile -= 1;
|
|
29097
29076
|
}
|
|
29098
29077
|
const res = {
|
|
@@ -29127,10 +29106,10 @@ var CompletionEngine = class {
|
|
|
29127
29106
|
};
|
|
29128
29107
|
|
|
29129
29108
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/context.mjs
|
|
29130
|
-
var
|
|
29109
|
+
var import_typescript83 = __toESM(require("typescript"), 1);
|
|
29131
29110
|
|
|
29132
29111
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/dom.mjs
|
|
29133
|
-
var
|
|
29112
|
+
var import_typescript69 = __toESM(require("typescript"), 1);
|
|
29134
29113
|
var REGISTRY = new DomElementSchemaRegistry();
|
|
29135
29114
|
var REMOVE_XHTML_REGEX = /^:xhtml:/;
|
|
29136
29115
|
var RegistryDomSchemaChecker = class {
|
|
@@ -29155,7 +29134,7 @@ var RegistryDomSchemaChecker = class {
|
|
|
29155
29134
|
} else {
|
|
29156
29135
|
errorMsg += `2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas2} of this component.`;
|
|
29157
29136
|
}
|
|
29158
|
-
const diag = makeTemplateDiagnostic(id, mapping, element.startSourceSpan,
|
|
29137
|
+
const diag = makeTemplateDiagnostic(id, mapping, element.startSourceSpan, import_typescript69.default.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ELEMENT), errorMsg);
|
|
29159
29138
|
this._diagnostics.push(diag);
|
|
29160
29139
|
}
|
|
29161
29140
|
}
|
|
@@ -29175,100 +29154,100 @@ var RegistryDomSchemaChecker = class {
|
|
|
29175
29154
|
2. If '${element.name}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas2} of this component to suppress this message.
|
|
29176
29155
|
3. To allow any property add 'NO_ERRORS_SCHEMA' to the ${schemas2} of this component.`;
|
|
29177
29156
|
}
|
|
29178
|
-
const diag = makeTemplateDiagnostic(id, mapping, span,
|
|
29157
|
+
const diag = makeTemplateDiagnostic(id, mapping, span, import_typescript69.default.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ATTRIBUTE), errorMsg);
|
|
29179
29158
|
this._diagnostics.push(diag);
|
|
29180
29159
|
}
|
|
29181
29160
|
}
|
|
29182
29161
|
};
|
|
29183
29162
|
|
|
29184
29163
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/environment.mjs
|
|
29185
|
-
var
|
|
29164
|
+
var import_typescript76 = __toESM(require("typescript"), 1);
|
|
29186
29165
|
|
|
29187
29166
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/ts_util.mjs
|
|
29188
|
-
var
|
|
29167
|
+
var import_typescript70 = __toESM(require("typescript"), 1);
|
|
29189
29168
|
var SAFE_TO_CAST_WITHOUT_PARENS = /* @__PURE__ */ new Set([
|
|
29190
|
-
|
|
29191
|
-
|
|
29192
|
-
|
|
29193
|
-
|
|
29194
|
-
|
|
29195
|
-
|
|
29196
|
-
|
|
29197
|
-
|
|
29198
|
-
|
|
29199
|
-
|
|
29200
|
-
|
|
29201
|
-
|
|
29202
|
-
|
|
29203
|
-
|
|
29169
|
+
import_typescript70.default.SyntaxKind.ParenthesizedExpression,
|
|
29170
|
+
import_typescript70.default.SyntaxKind.Identifier,
|
|
29171
|
+
import_typescript70.default.SyntaxKind.CallExpression,
|
|
29172
|
+
import_typescript70.default.SyntaxKind.NonNullExpression,
|
|
29173
|
+
import_typescript70.default.SyntaxKind.ElementAccessExpression,
|
|
29174
|
+
import_typescript70.default.SyntaxKind.PropertyAccessExpression,
|
|
29175
|
+
import_typescript70.default.SyntaxKind.ArrayLiteralExpression,
|
|
29176
|
+
import_typescript70.default.SyntaxKind.ObjectLiteralExpression,
|
|
29177
|
+
import_typescript70.default.SyntaxKind.StringLiteral,
|
|
29178
|
+
import_typescript70.default.SyntaxKind.NumericLiteral,
|
|
29179
|
+
import_typescript70.default.SyntaxKind.TrueKeyword,
|
|
29180
|
+
import_typescript70.default.SyntaxKind.FalseKeyword,
|
|
29181
|
+
import_typescript70.default.SyntaxKind.NullKeyword,
|
|
29182
|
+
import_typescript70.default.SyntaxKind.UndefinedKeyword
|
|
29204
29183
|
]);
|
|
29205
29184
|
function tsCastToAny(expr) {
|
|
29206
29185
|
if (!SAFE_TO_CAST_WITHOUT_PARENS.has(expr.kind)) {
|
|
29207
|
-
expr =
|
|
29186
|
+
expr = import_typescript70.default.factory.createParenthesizedExpression(expr);
|
|
29208
29187
|
}
|
|
29209
|
-
return
|
|
29188
|
+
return import_typescript70.default.factory.createParenthesizedExpression(import_typescript70.default.factory.createAsExpression(expr, import_typescript70.default.factory.createKeywordTypeNode(import_typescript70.default.SyntaxKind.AnyKeyword)));
|
|
29210
29189
|
}
|
|
29211
29190
|
function tsCreateElement(tagName) {
|
|
29212
|
-
const createElement =
|
|
29213
|
-
|
|
29191
|
+
const createElement = import_typescript70.default.factory.createPropertyAccessExpression(
|
|
29192
|
+
import_typescript70.default.factory.createIdentifier("document"),
|
|
29214
29193
|
"createElement"
|
|
29215
29194
|
);
|
|
29216
|
-
return
|
|
29195
|
+
return import_typescript70.default.factory.createCallExpression(
|
|
29217
29196
|
createElement,
|
|
29218
29197
|
void 0,
|
|
29219
|
-
[
|
|
29198
|
+
[import_typescript70.default.factory.createStringLiteral(tagName)]
|
|
29220
29199
|
);
|
|
29221
29200
|
}
|
|
29222
29201
|
function tsDeclareVariable(id, type) {
|
|
29223
|
-
const decl =
|
|
29202
|
+
const decl = import_typescript70.default.factory.createVariableDeclaration(
|
|
29224
29203
|
id,
|
|
29225
29204
|
void 0,
|
|
29226
29205
|
type,
|
|
29227
|
-
|
|
29206
|
+
import_typescript70.default.factory.createNonNullExpression(import_typescript70.default.factory.createNull())
|
|
29228
29207
|
);
|
|
29229
|
-
return
|
|
29208
|
+
return import_typescript70.default.factory.createVariableStatement(
|
|
29230
29209
|
void 0,
|
|
29231
29210
|
[decl]
|
|
29232
29211
|
);
|
|
29233
29212
|
}
|
|
29234
29213
|
function tsCreateTypeQueryForCoercedInput(typeName, coercedInputName) {
|
|
29235
|
-
return
|
|
29214
|
+
return import_typescript70.default.factory.createTypeQueryNode(import_typescript70.default.factory.createQualifiedName(typeName, `ngAcceptInputType_${coercedInputName}`));
|
|
29236
29215
|
}
|
|
29237
29216
|
function tsCreateVariable(id, initializer) {
|
|
29238
|
-
const decl =
|
|
29217
|
+
const decl = import_typescript70.default.factory.createVariableDeclaration(
|
|
29239
29218
|
id,
|
|
29240
29219
|
void 0,
|
|
29241
29220
|
void 0,
|
|
29242
29221
|
initializer
|
|
29243
29222
|
);
|
|
29244
|
-
return
|
|
29223
|
+
return import_typescript70.default.factory.createVariableStatement(
|
|
29245
29224
|
void 0,
|
|
29246
29225
|
[decl]
|
|
29247
29226
|
);
|
|
29248
29227
|
}
|
|
29249
29228
|
function tsCallMethod(receiver, methodName, args = []) {
|
|
29250
|
-
const methodAccess =
|
|
29251
|
-
return
|
|
29229
|
+
const methodAccess = import_typescript70.default.factory.createPropertyAccessExpression(receiver, methodName);
|
|
29230
|
+
return import_typescript70.default.factory.createCallExpression(
|
|
29252
29231
|
methodAccess,
|
|
29253
29232
|
void 0,
|
|
29254
29233
|
args
|
|
29255
29234
|
);
|
|
29256
29235
|
}
|
|
29257
29236
|
function isAccessExpression(node) {
|
|
29258
|
-
return
|
|
29237
|
+
return import_typescript70.default.isPropertyAccessExpression(node) || import_typescript70.default.isElementAccessExpression(node);
|
|
29259
29238
|
}
|
|
29260
29239
|
|
|
29261
29240
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.mjs
|
|
29262
|
-
var
|
|
29241
|
+
var import_typescript75 = __toESM(require("typescript"), 1);
|
|
29263
29242
|
|
|
29264
29243
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/tcb_util.mjs
|
|
29265
|
-
var
|
|
29244
|
+
var import_typescript73 = __toESM(require("typescript"), 1);
|
|
29266
29245
|
|
|
29267
29246
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_parameter_emitter.mjs
|
|
29268
|
-
var
|
|
29247
|
+
var import_typescript72 = __toESM(require("typescript"), 1);
|
|
29269
29248
|
|
|
29270
29249
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_emitter.mjs
|
|
29271
|
-
var
|
|
29250
|
+
var import_typescript71 = __toESM(require("typescript"), 1);
|
|
29272
29251
|
var INELIGIBLE = {};
|
|
29273
29252
|
function canEmitType(type, canEmit) {
|
|
29274
29253
|
return canEmitTypeWorker(type);
|
|
@@ -29276,13 +29255,13 @@ function canEmitType(type, canEmit) {
|
|
|
29276
29255
|
return visitNode(type2) !== INELIGIBLE;
|
|
29277
29256
|
}
|
|
29278
29257
|
function visitNode(node) {
|
|
29279
|
-
if (
|
|
29258
|
+
if (import_typescript71.default.isImportTypeNode(node)) {
|
|
29280
29259
|
return INELIGIBLE;
|
|
29281
29260
|
}
|
|
29282
|
-
if (
|
|
29261
|
+
if (import_typescript71.default.isTypeReferenceNode(node) && !canEmitTypeReference(node)) {
|
|
29283
29262
|
return INELIGIBLE;
|
|
29284
29263
|
} else {
|
|
29285
|
-
return
|
|
29264
|
+
return import_typescript71.default.forEachChild(node, visitNode);
|
|
29286
29265
|
}
|
|
29287
29266
|
}
|
|
29288
29267
|
function canEmitTypeReference(type2) {
|
|
@@ -29299,35 +29278,35 @@ var TypeEmitter = class {
|
|
|
29299
29278
|
emitType(type) {
|
|
29300
29279
|
const typeReferenceTransformer = (context) => {
|
|
29301
29280
|
const visitNode = (node) => {
|
|
29302
|
-
if (
|
|
29281
|
+
if (import_typescript71.default.isImportTypeNode(node)) {
|
|
29303
29282
|
throw new Error("Unable to emit import type");
|
|
29304
29283
|
}
|
|
29305
|
-
if (
|
|
29284
|
+
if (import_typescript71.default.isTypeReferenceNode(node)) {
|
|
29306
29285
|
return this.emitTypeReference(node);
|
|
29307
|
-
} else if (
|
|
29286
|
+
} else if (import_typescript71.default.isLiteralExpression(node)) {
|
|
29308
29287
|
let clone;
|
|
29309
|
-
if (
|
|
29310
|
-
clone =
|
|
29311
|
-
} else if (
|
|
29312
|
-
clone =
|
|
29313
|
-
} else if (
|
|
29314
|
-
clone =
|
|
29315
|
-
} else if (
|
|
29316
|
-
clone =
|
|
29317
|
-
} else if (
|
|
29318
|
-
clone =
|
|
29288
|
+
if (import_typescript71.default.isStringLiteral(node)) {
|
|
29289
|
+
clone = import_typescript71.default.factory.createStringLiteral(node.text);
|
|
29290
|
+
} else if (import_typescript71.default.isNumericLiteral(node)) {
|
|
29291
|
+
clone = import_typescript71.default.factory.createNumericLiteral(node.text);
|
|
29292
|
+
} else if (import_typescript71.default.isBigIntLiteral(node)) {
|
|
29293
|
+
clone = import_typescript71.default.factory.createBigIntLiteral(node.text);
|
|
29294
|
+
} else if (import_typescript71.default.isNoSubstitutionTemplateLiteral(node)) {
|
|
29295
|
+
clone = import_typescript71.default.factory.createNoSubstitutionTemplateLiteral(node.text, node.rawText);
|
|
29296
|
+
} else if (import_typescript71.default.isRegularExpressionLiteral(node)) {
|
|
29297
|
+
clone = import_typescript71.default.factory.createRegularExpressionLiteral(node.text);
|
|
29319
29298
|
} else {
|
|
29320
|
-
throw new Error(`Unsupported literal kind ${
|
|
29299
|
+
throw new Error(`Unsupported literal kind ${import_typescript71.default.SyntaxKind[node.kind]}`);
|
|
29321
29300
|
}
|
|
29322
|
-
|
|
29301
|
+
import_typescript71.default.setTextRange(clone, { pos: -1, end: -1 });
|
|
29323
29302
|
return clone;
|
|
29324
29303
|
} else {
|
|
29325
|
-
return
|
|
29304
|
+
return import_typescript71.default.visitEachChild(node, visitNode, context);
|
|
29326
29305
|
}
|
|
29327
29306
|
};
|
|
29328
|
-
return (node) =>
|
|
29307
|
+
return (node) => import_typescript71.default.visitNode(node, visitNode, import_typescript71.default.isTypeNode);
|
|
29329
29308
|
};
|
|
29330
|
-
return
|
|
29309
|
+
return import_typescript71.default.transform(type, [typeReferenceTransformer]).transformed[0];
|
|
29331
29310
|
}
|
|
29332
29311
|
emitTypeReference(type) {
|
|
29333
29312
|
const translatedType = this.translator(type);
|
|
@@ -29336,9 +29315,9 @@ var TypeEmitter = class {
|
|
|
29336
29315
|
}
|
|
29337
29316
|
let typeArguments = void 0;
|
|
29338
29317
|
if (type.typeArguments !== void 0) {
|
|
29339
|
-
typeArguments =
|
|
29318
|
+
typeArguments = import_typescript71.default.factory.createNodeArray(type.typeArguments.map((typeArg) => this.emitType(typeArg)));
|
|
29340
29319
|
}
|
|
29341
|
-
return
|
|
29320
|
+
return import_typescript71.default.factory.updateTypeReferenceNode(type, translatedType.typeName, typeArguments);
|
|
29342
29321
|
}
|
|
29343
29322
|
};
|
|
29344
29323
|
|
|
@@ -29379,11 +29358,11 @@ var TypeParameterEmitter = class {
|
|
|
29379
29358
|
return this.typeParameters.map((typeParam) => {
|
|
29380
29359
|
const constraint = typeParam.constraint !== void 0 ? emitter.emitType(typeParam.constraint) : void 0;
|
|
29381
29360
|
const defaultType = typeParam.default !== void 0 ? emitter.emitType(typeParam.default) : void 0;
|
|
29382
|
-
return
|
|
29361
|
+
return import_typescript72.default.factory.updateTypeParameterDeclaration(typeParam, typeParam.modifiers, typeParam.name, constraint, defaultType);
|
|
29383
29362
|
});
|
|
29384
29363
|
}
|
|
29385
29364
|
resolveTypeReference(type) {
|
|
29386
|
-
const target =
|
|
29365
|
+
const target = import_typescript72.default.isIdentifier(type.typeName) ? type.typeName : type.typeName.right;
|
|
29387
29366
|
const declaration = this.reflector.getDeclarationOfIdentifier(target);
|
|
29388
29367
|
if (declaration === null || declaration.node === null) {
|
|
29389
29368
|
return null;
|
|
@@ -29409,8 +29388,8 @@ var TypeParameterEmitter = class {
|
|
|
29409
29388
|
if (typeNode === null) {
|
|
29410
29389
|
return null;
|
|
29411
29390
|
}
|
|
29412
|
-
if (!
|
|
29413
|
-
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${
|
|
29391
|
+
if (!import_typescript72.default.isTypeReferenceNode(typeNode)) {
|
|
29392
|
+
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${import_typescript72.default.SyntaxKind[typeNode.kind]}.`);
|
|
29414
29393
|
}
|
|
29415
29394
|
return typeNode;
|
|
29416
29395
|
}
|
|
@@ -29452,14 +29431,14 @@ function getTemplateMapping(shimSf, position, resolver, isDiagnosticRequest) {
|
|
|
29452
29431
|
}
|
|
29453
29432
|
function findTypeCheckBlock(file, id, isDiagnosticRequest) {
|
|
29454
29433
|
for (const stmt of file.statements) {
|
|
29455
|
-
if (
|
|
29434
|
+
if (import_typescript73.default.isFunctionDeclaration(stmt) && getTemplateId2(stmt, file, isDiagnosticRequest) === id) {
|
|
29456
29435
|
return stmt;
|
|
29457
29436
|
}
|
|
29458
29437
|
}
|
|
29459
29438
|
return null;
|
|
29460
29439
|
}
|
|
29461
29440
|
function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
|
|
29462
|
-
while (node !== void 0 && !
|
|
29441
|
+
while (node !== void 0 && !import_typescript73.default.isFunctionDeclaration(node)) {
|
|
29463
29442
|
if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticsRequest) {
|
|
29464
29443
|
return null;
|
|
29465
29444
|
}
|
|
@@ -29476,7 +29455,7 @@ function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
|
|
|
29476
29455
|
return null;
|
|
29477
29456
|
}
|
|
29478
29457
|
function getTemplateId2(node, sourceFile, isDiagnosticRequest) {
|
|
29479
|
-
while (!
|
|
29458
|
+
while (!import_typescript73.default.isFunctionDeclaration(node)) {
|
|
29480
29459
|
if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticRequest) {
|
|
29481
29460
|
return null;
|
|
29482
29461
|
}
|
|
@@ -29486,8 +29465,8 @@ function getTemplateId2(node, sourceFile, isDiagnosticRequest) {
|
|
|
29486
29465
|
}
|
|
29487
29466
|
}
|
|
29488
29467
|
const start = node.getFullStart();
|
|
29489
|
-
return
|
|
29490
|
-
if (kind !==
|
|
29468
|
+
return import_typescript73.default.forEachLeadingCommentRange(sourceFile.text, start, (pos, end, kind) => {
|
|
29469
|
+
if (kind !== import_typescript73.default.SyntaxKind.MultiLineCommentTrivia) {
|
|
29491
29470
|
return null;
|
|
29492
29471
|
}
|
|
29493
29472
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -29502,29 +29481,29 @@ function checkIfGenericTypeBoundsCanBeEmitted(node, reflector, env) {
|
|
|
29502
29481
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.mjs
|
|
29503
29482
|
function generateTypeCtorDeclarationFn(node, meta, nodeTypeRef, typeParams) {
|
|
29504
29483
|
const rawTypeArgs = typeParams !== void 0 ? generateGenericArgs(typeParams) : void 0;
|
|
29505
|
-
const rawType =
|
|
29484
|
+
const rawType = import_typescript75.default.factory.createTypeReferenceNode(nodeTypeRef, rawTypeArgs);
|
|
29506
29485
|
const initParam = constructTypeCtorParameter(node, meta, rawType);
|
|
29507
29486
|
const typeParameters = typeParametersWithDefaultTypes(typeParams);
|
|
29508
29487
|
if (meta.body) {
|
|
29509
|
-
const fnType =
|
|
29488
|
+
const fnType = import_typescript75.default.factory.createFunctionTypeNode(
|
|
29510
29489
|
typeParameters,
|
|
29511
29490
|
[initParam],
|
|
29512
29491
|
rawType
|
|
29513
29492
|
);
|
|
29514
|
-
const decl =
|
|
29493
|
+
const decl = import_typescript75.default.factory.createVariableDeclaration(
|
|
29515
29494
|
meta.fnName,
|
|
29516
29495
|
void 0,
|
|
29517
29496
|
fnType,
|
|
29518
|
-
|
|
29497
|
+
import_typescript75.default.factory.createNonNullExpression(import_typescript75.default.factory.createNull())
|
|
29519
29498
|
);
|
|
29520
|
-
const declList =
|
|
29521
|
-
return
|
|
29499
|
+
const declList = import_typescript75.default.factory.createVariableDeclarationList([decl], import_typescript75.default.NodeFlags.Const);
|
|
29500
|
+
return import_typescript75.default.factory.createVariableStatement(
|
|
29522
29501
|
void 0,
|
|
29523
29502
|
declList
|
|
29524
29503
|
);
|
|
29525
29504
|
} else {
|
|
29526
|
-
return createFunctionDeclaration(
|
|
29527
|
-
[
|
|
29505
|
+
return import_typescript75.default.factory.createFunctionDeclaration(
|
|
29506
|
+
[import_typescript75.default.factory.createModifier(import_typescript75.default.SyntaxKind.DeclareKeyword)],
|
|
29528
29507
|
void 0,
|
|
29529
29508
|
meta.fnName,
|
|
29530
29509
|
typeParameters,
|
|
@@ -29536,16 +29515,16 @@ function generateTypeCtorDeclarationFn(node, meta, nodeTypeRef, typeParams) {
|
|
|
29536
29515
|
}
|
|
29537
29516
|
function generateInlineTypeCtor(node, meta) {
|
|
29538
29517
|
const rawTypeArgs = node.typeParameters !== void 0 ? generateGenericArgs(node.typeParameters) : void 0;
|
|
29539
|
-
const rawType =
|
|
29518
|
+
const rawType = import_typescript75.default.factory.createTypeReferenceNode(node.name, rawTypeArgs);
|
|
29540
29519
|
const initParam = constructTypeCtorParameter(node, meta, rawType);
|
|
29541
29520
|
let body = void 0;
|
|
29542
29521
|
if (meta.body) {
|
|
29543
|
-
body =
|
|
29544
|
-
|
|
29522
|
+
body = import_typescript75.default.factory.createBlock([
|
|
29523
|
+
import_typescript75.default.factory.createReturnStatement(import_typescript75.default.factory.createNonNullExpression(import_typescript75.default.factory.createNull()))
|
|
29545
29524
|
]);
|
|
29546
29525
|
}
|
|
29547
|
-
return
|
|
29548
|
-
[
|
|
29526
|
+
return import_typescript75.default.factory.createMethodDeclaration(
|
|
29527
|
+
[import_typescript75.default.factory.createModifier(import_typescript75.default.SyntaxKind.StaticKeyword)],
|
|
29549
29528
|
void 0,
|
|
29550
29529
|
meta.fnName,
|
|
29551
29530
|
void 0,
|
|
@@ -29562,9 +29541,9 @@ function constructTypeCtorParameter(node, meta, rawType) {
|
|
|
29562
29541
|
const coercedKeys = [];
|
|
29563
29542
|
for (const key of keys) {
|
|
29564
29543
|
if (!meta.coercedInputFields.has(key)) {
|
|
29565
|
-
plainKeys.push(
|
|
29544
|
+
plainKeys.push(import_typescript75.default.factory.createLiteralTypeNode(import_typescript75.default.factory.createStringLiteral(key)));
|
|
29566
29545
|
} else {
|
|
29567
|
-
coercedKeys.push(
|
|
29546
|
+
coercedKeys.push(import_typescript75.default.factory.createPropertySignature(
|
|
29568
29547
|
void 0,
|
|
29569
29548
|
key,
|
|
29570
29549
|
void 0,
|
|
@@ -29573,17 +29552,17 @@ function constructTypeCtorParameter(node, meta, rawType) {
|
|
|
29573
29552
|
}
|
|
29574
29553
|
}
|
|
29575
29554
|
if (plainKeys.length > 0) {
|
|
29576
|
-
const keyTypeUnion =
|
|
29577
|
-
initType =
|
|
29555
|
+
const keyTypeUnion = import_typescript75.default.factory.createUnionTypeNode(plainKeys);
|
|
29556
|
+
initType = import_typescript75.default.factory.createTypeReferenceNode("Pick", [rawType, keyTypeUnion]);
|
|
29578
29557
|
}
|
|
29579
29558
|
if (coercedKeys.length > 0) {
|
|
29580
|
-
const coercedLiteral =
|
|
29581
|
-
initType = initType !== null ?
|
|
29559
|
+
const coercedLiteral = import_typescript75.default.factory.createTypeLiteralNode(coercedKeys);
|
|
29560
|
+
initType = initType !== null ? import_typescript75.default.factory.createIntersectionTypeNode([initType, coercedLiteral]) : coercedLiteral;
|
|
29582
29561
|
}
|
|
29583
29562
|
if (initType === null) {
|
|
29584
|
-
initType =
|
|
29563
|
+
initType = import_typescript75.default.factory.createTypeLiteralNode([]);
|
|
29585
29564
|
}
|
|
29586
|
-
return createParameterDeclaration(
|
|
29565
|
+
return import_typescript75.default.factory.createParameterDeclaration(
|
|
29587
29566
|
void 0,
|
|
29588
29567
|
void 0,
|
|
29589
29568
|
"init",
|
|
@@ -29593,7 +29572,7 @@ function constructTypeCtorParameter(node, meta, rawType) {
|
|
|
29593
29572
|
);
|
|
29594
29573
|
}
|
|
29595
29574
|
function generateGenericArgs(params) {
|
|
29596
|
-
return params.map((param) =>
|
|
29575
|
+
return params.map((param) => import_typescript75.default.factory.createTypeReferenceNode(param.name, void 0));
|
|
29597
29576
|
}
|
|
29598
29577
|
function requiresInlineTypeCtor(node, host, env) {
|
|
29599
29578
|
return !checkIfGenericTypeBoundsCanBeEmitted(node, host, env);
|
|
@@ -29604,7 +29583,7 @@ function typeParametersWithDefaultTypes(params) {
|
|
|
29604
29583
|
}
|
|
29605
29584
|
return params.map((param) => {
|
|
29606
29585
|
if (param.default === void 0) {
|
|
29607
|
-
return
|
|
29586
|
+
return import_typescript75.default.factory.updateTypeParameterDeclaration(param, param.modifiers, param.name, param.constraint, import_typescript75.default.factory.createKeywordTypeNode(import_typescript75.default.SyntaxKind.AnyKeyword));
|
|
29608
29587
|
} else {
|
|
29609
29588
|
return param;
|
|
29610
29589
|
}
|
|
@@ -29636,13 +29615,13 @@ var Environment = class {
|
|
|
29636
29615
|
}
|
|
29637
29616
|
if (requiresInlineTypeCtor(node, this.reflector, this)) {
|
|
29638
29617
|
const ref = this.reference(dirRef);
|
|
29639
|
-
const typeCtorExpr =
|
|
29618
|
+
const typeCtorExpr = import_typescript76.default.factory.createPropertyAccessExpression(ref, "ngTypeCtor");
|
|
29640
29619
|
this.typeCtors.set(node, typeCtorExpr);
|
|
29641
29620
|
return typeCtorExpr;
|
|
29642
29621
|
} else {
|
|
29643
29622
|
const fnName = `_ctor${this.nextIds.typeCtor++}`;
|
|
29644
29623
|
const nodeTypeRef = this.referenceType(dirRef);
|
|
29645
|
-
if (!
|
|
29624
|
+
if (!import_typescript76.default.isTypeReferenceNode(nodeTypeRef)) {
|
|
29646
29625
|
throw new Error(`Expected TypeReferenceNode from reference to ${dirRef.debugName}`);
|
|
29647
29626
|
}
|
|
29648
29627
|
const meta = {
|
|
@@ -29658,7 +29637,7 @@ var Environment = class {
|
|
|
29658
29637
|
const typeParams = this.emitTypeParameters(node);
|
|
29659
29638
|
const typeCtor = generateTypeCtorDeclarationFn(node, meta, nodeTypeRef.typeName, typeParams);
|
|
29660
29639
|
this.typeCtorStatements.push(typeCtor);
|
|
29661
|
-
const fnId =
|
|
29640
|
+
const fnId = import_typescript76.default.factory.createIdentifier(fnName);
|
|
29662
29641
|
this.typeCtors.set(node, fnId);
|
|
29663
29642
|
return fnId;
|
|
29664
29643
|
}
|
|
@@ -29668,7 +29647,7 @@ var Environment = class {
|
|
|
29668
29647
|
return this.pipeInsts.get(ref.node);
|
|
29669
29648
|
}
|
|
29670
29649
|
const pipeType = this.referenceType(ref);
|
|
29671
|
-
const pipeInstId =
|
|
29650
|
+
const pipeInstId = import_typescript76.default.factory.createIdentifier(`_pipe${this.nextIds.pipeInst++}`);
|
|
29672
29651
|
this.pipeInstStatements.push(tsDeclareVariable(pipeInstId, pipeType));
|
|
29673
29652
|
this.pipeInsts.set(ref.node, pipeInstId);
|
|
29674
29653
|
return pipeInstId;
|
|
@@ -29704,7 +29683,7 @@ var Environment = class {
|
|
|
29704
29683
|
};
|
|
29705
29684
|
|
|
29706
29685
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/oob.mjs
|
|
29707
|
-
var
|
|
29686
|
+
var import_typescript77 = __toESM(require("typescript"), 1);
|
|
29708
29687
|
var OutOfBandDiagnosticRecorderImpl = class {
|
|
29709
29688
|
constructor(resolver) {
|
|
29710
29689
|
this.resolver = resolver;
|
|
@@ -29718,7 +29697,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
29718
29697
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
29719
29698
|
const value = ref.value.trim();
|
|
29720
29699
|
const errorMsg = `No directive found with exportAs '${value}'.`;
|
|
29721
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, ref.valueSpan || ref.sourceSpan,
|
|
29700
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, ref.valueSpan || ref.sourceSpan, import_typescript77.default.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REFERENCE_TARGET), errorMsg));
|
|
29722
29701
|
}
|
|
29723
29702
|
missingPipe(templateId, ast) {
|
|
29724
29703
|
if (this.recordedPipes.has(ast)) {
|
|
@@ -29730,7 +29709,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
29730
29709
|
if (sourceSpan === null) {
|
|
29731
29710
|
throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${ast.name}'.`);
|
|
29732
29711
|
}
|
|
29733
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan,
|
|
29712
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, import_typescript77.default.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_PIPE), errorMsg));
|
|
29734
29713
|
this.recordedPipes.add(ast);
|
|
29735
29714
|
}
|
|
29736
29715
|
illegalAssignmentToTemplateVar(templateId, assignment, target) {
|
|
@@ -29741,7 +29720,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
29741
29720
|
if (sourceSpan === null) {
|
|
29742
29721
|
throw new Error(`Assertion failure: no SourceLocation found for property binding.`);
|
|
29743
29722
|
}
|
|
29744
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan,
|
|
29723
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, import_typescript77.default.DiagnosticCategory.Error, ngErrorCode(ErrorCode.WRITE_TO_READ_ONLY_VARIABLE), errorMsg, [{
|
|
29745
29724
|
text: `The variable ${assignment.name} is declared here.`,
|
|
29746
29725
|
start: ((_a = target.valueSpan) == null ? void 0 : _a.start.offset) || target.sourceSpan.start.offset,
|
|
29747
29726
|
end: ((_b = target.valueSpan) == null ? void 0 : _b.end.offset) || target.sourceSpan.end.offset,
|
|
@@ -29751,7 +29730,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
29751
29730
|
duplicateTemplateVar(templateId, variable2, firstDecl) {
|
|
29752
29731
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
29753
29732
|
const errorMsg = `Cannot redeclare variable '${variable2.name}' as it was previously declared elsewhere for the same template.`;
|
|
29754
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, variable2.sourceSpan,
|
|
29733
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, variable2.sourceSpan, import_typescript77.default.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DUPLICATE_VARIABLE_DECLARATION), errorMsg, [{
|
|
29755
29734
|
text: `The variable '${firstDecl.name}' was first declared here.`,
|
|
29756
29735
|
start: firstDecl.sourceSpan.start.offset,
|
|
29757
29736
|
end: firstDecl.sourceSpan.end.offset,
|
|
@@ -29790,7 +29769,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
29790
29769
|
const message = `This structural directive supports advanced type inference, but the current compiler configuration prevents its usage. The variable ${varIdentification} will have type 'any' as a result.
|
|
29791
29770
|
|
|
29792
29771
|
Consider enabling the 'strictTemplates' option in your tsconfig.json for better type inference within this template.`;
|
|
29793
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, diagnosticVar.keySpan,
|
|
29772
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, diagnosticVar.keySpan, import_typescript77.default.DiagnosticCategory.Suggestion, ngErrorCode(ErrorCode.SUGGEST_SUBOPTIMAL_TYPE_INFERENCE), message));
|
|
29794
29773
|
}
|
|
29795
29774
|
splitTwoWayBinding(templateId, input, output, inputConsumer, outputConsumer) {
|
|
29796
29775
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
@@ -29824,7 +29803,7 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
|
|
|
29824
29803
|
sourceFile: outputConsumer.name.getSourceFile()
|
|
29825
29804
|
});
|
|
29826
29805
|
}
|
|
29827
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, input.keySpan,
|
|
29806
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, input.keySpan, import_typescript77.default.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SPLIT_TWO_WAY_BINDING), errorMsg, relatedMessages));
|
|
29828
29807
|
}
|
|
29829
29808
|
};
|
|
29830
29809
|
function makeInlineDiagnostic(templateId, code, node, messageText, relatedInformation) {
|
|
@@ -29835,7 +29814,7 @@ function makeInlineDiagnostic(templateId, code, node, messageText, relatedInform
|
|
|
29835
29814
|
}
|
|
29836
29815
|
|
|
29837
29816
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/shim.mjs
|
|
29838
|
-
var
|
|
29817
|
+
var import_typescript78 = __toESM(require("typescript"), 1);
|
|
29839
29818
|
var TypeCheckShimGenerator = class {
|
|
29840
29819
|
constructor() {
|
|
29841
29820
|
this.extensionPrefix = "ngtypecheck";
|
|
@@ -29845,7 +29824,7 @@ var TypeCheckShimGenerator = class {
|
|
|
29845
29824
|
if (priorShimSf !== null) {
|
|
29846
29825
|
return priorShimSf;
|
|
29847
29826
|
}
|
|
29848
|
-
return
|
|
29827
|
+
return import_typescript78.default.createSourceFile(genFilePath, "export const USED_FOR_NG_TYPE_CHECKING = true;", import_typescript78.default.ScriptTarget.Latest, true, import_typescript78.default.ScriptKind.TS);
|
|
29849
29828
|
}
|
|
29850
29829
|
static shimFor(fileName) {
|
|
29851
29830
|
return absoluteFrom(fileName.replace(/\.tsx?$/, ".ngtypecheck.ts"));
|
|
@@ -29853,15 +29832,15 @@ var TypeCheckShimGenerator = class {
|
|
|
29853
29832
|
};
|
|
29854
29833
|
|
|
29855
29834
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.mjs
|
|
29856
|
-
var
|
|
29835
|
+
var import_typescript81 = __toESM(require("typescript"), 1);
|
|
29857
29836
|
|
|
29858
29837
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/diagnostics.mjs
|
|
29859
|
-
var
|
|
29838
|
+
var import_typescript79 = __toESM(require("typescript"), 1);
|
|
29860
29839
|
function wrapForDiagnostics(expr) {
|
|
29861
|
-
return
|
|
29840
|
+
return import_typescript79.default.factory.createParenthesizedExpression(expr);
|
|
29862
29841
|
}
|
|
29863
29842
|
function wrapForTypeChecker(expr) {
|
|
29864
|
-
return
|
|
29843
|
+
return import_typescript79.default.factory.createParenthesizedExpression(expr);
|
|
29865
29844
|
}
|
|
29866
29845
|
function addParseSpanInfo(node, span) {
|
|
29867
29846
|
let commentText;
|
|
@@ -29870,10 +29849,10 @@ function addParseSpanInfo(node, span) {
|
|
|
29870
29849
|
} else {
|
|
29871
29850
|
commentText = `${span.start.offset},${span.end.offset}`;
|
|
29872
29851
|
}
|
|
29873
|
-
|
|
29852
|
+
import_typescript79.default.addSyntheticTrailingComment(node, import_typescript79.default.SyntaxKind.MultiLineCommentTrivia, commentText, false);
|
|
29874
29853
|
}
|
|
29875
29854
|
function addTemplateId(tcb, id) {
|
|
29876
|
-
|
|
29855
|
+
import_typescript79.default.addSyntheticLeadingComment(tcb, import_typescript79.default.SyntaxKind.MultiLineCommentTrivia, id, true);
|
|
29877
29856
|
}
|
|
29878
29857
|
function shouldReportDiagnostic(diagnostic) {
|
|
29879
29858
|
const { code } = diagnostic;
|
|
@@ -29901,32 +29880,32 @@ function translateDiagnostic(diagnostic, resolver) {
|
|
|
29901
29880
|
}
|
|
29902
29881
|
|
|
29903
29882
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/expression.mjs
|
|
29904
|
-
var
|
|
29905
|
-
var NULL_AS_ANY =
|
|
29906
|
-
var UNDEFINED =
|
|
29883
|
+
var import_typescript80 = __toESM(require("typescript"), 1);
|
|
29884
|
+
var NULL_AS_ANY = import_typescript80.default.factory.createAsExpression(import_typescript80.default.factory.createNull(), import_typescript80.default.factory.createKeywordTypeNode(import_typescript80.default.SyntaxKind.AnyKeyword));
|
|
29885
|
+
var UNDEFINED = import_typescript80.default.factory.createIdentifier("undefined");
|
|
29907
29886
|
var UNARY_OPS = /* @__PURE__ */ new Map([
|
|
29908
|
-
["+",
|
|
29909
|
-
["-",
|
|
29887
|
+
["+", import_typescript80.default.SyntaxKind.PlusToken],
|
|
29888
|
+
["-", import_typescript80.default.SyntaxKind.MinusToken]
|
|
29910
29889
|
]);
|
|
29911
29890
|
var BINARY_OPS = /* @__PURE__ */ new Map([
|
|
29912
|
-
["+",
|
|
29913
|
-
["-",
|
|
29914
|
-
["<",
|
|
29915
|
-
[">",
|
|
29916
|
-
["<=",
|
|
29917
|
-
[">=",
|
|
29918
|
-
["==",
|
|
29919
|
-
["===",
|
|
29920
|
-
["*",
|
|
29921
|
-
["/",
|
|
29922
|
-
["%",
|
|
29923
|
-
["!=",
|
|
29924
|
-
["!==",
|
|
29925
|
-
["||",
|
|
29926
|
-
["&&",
|
|
29927
|
-
["&",
|
|
29928
|
-
["|",
|
|
29929
|
-
["??",
|
|
29891
|
+
["+", import_typescript80.default.SyntaxKind.PlusToken],
|
|
29892
|
+
["-", import_typescript80.default.SyntaxKind.MinusToken],
|
|
29893
|
+
["<", import_typescript80.default.SyntaxKind.LessThanToken],
|
|
29894
|
+
[">", import_typescript80.default.SyntaxKind.GreaterThanToken],
|
|
29895
|
+
["<=", import_typescript80.default.SyntaxKind.LessThanEqualsToken],
|
|
29896
|
+
[">=", import_typescript80.default.SyntaxKind.GreaterThanEqualsToken],
|
|
29897
|
+
["==", import_typescript80.default.SyntaxKind.EqualsEqualsToken],
|
|
29898
|
+
["===", import_typescript80.default.SyntaxKind.EqualsEqualsEqualsToken],
|
|
29899
|
+
["*", import_typescript80.default.SyntaxKind.AsteriskToken],
|
|
29900
|
+
["/", import_typescript80.default.SyntaxKind.SlashToken],
|
|
29901
|
+
["%", import_typescript80.default.SyntaxKind.PercentToken],
|
|
29902
|
+
["!=", import_typescript80.default.SyntaxKind.ExclamationEqualsToken],
|
|
29903
|
+
["!==", import_typescript80.default.SyntaxKind.ExclamationEqualsEqualsToken],
|
|
29904
|
+
["||", import_typescript80.default.SyntaxKind.BarBarToken],
|
|
29905
|
+
["&&", import_typescript80.default.SyntaxKind.AmpersandAmpersandToken],
|
|
29906
|
+
["&", import_typescript80.default.SyntaxKind.AmpersandToken],
|
|
29907
|
+
["|", import_typescript80.default.SyntaxKind.BarToken],
|
|
29908
|
+
["??", import_typescript80.default.SyntaxKind.QuestionQuestionToken]
|
|
29930
29909
|
]);
|
|
29931
29910
|
function astToTypescript(ast, maybeResolve, config) {
|
|
29932
29911
|
const translator = new AstTranslator(maybeResolve, config);
|
|
@@ -29942,7 +29921,7 @@ var AstTranslator = class {
|
|
|
29942
29921
|
ast = ast.ast;
|
|
29943
29922
|
}
|
|
29944
29923
|
if (ast instanceof EmptyExpr) {
|
|
29945
|
-
const res =
|
|
29924
|
+
const res = import_typescript80.default.factory.createIdentifier("undefined");
|
|
29946
29925
|
addParseSpanInfo(res, ast.sourceSpan);
|
|
29947
29926
|
return res;
|
|
29948
29927
|
}
|
|
@@ -29958,7 +29937,7 @@ var AstTranslator = class {
|
|
|
29958
29937
|
if (op === void 0) {
|
|
29959
29938
|
throw new Error(`Unsupported Unary.operator: ${ast.operator}`);
|
|
29960
29939
|
}
|
|
29961
|
-
const node = wrapForDiagnostics(
|
|
29940
|
+
const node = wrapForDiagnostics(import_typescript80.default.factory.createPrefixUnaryExpression(op, expr));
|
|
29962
29941
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
29963
29942
|
return node;
|
|
29964
29943
|
}
|
|
@@ -29969,13 +29948,13 @@ var AstTranslator = class {
|
|
|
29969
29948
|
if (op === void 0) {
|
|
29970
29949
|
throw new Error(`Unsupported Binary.operation: ${ast.operation}`);
|
|
29971
29950
|
}
|
|
29972
|
-
const node =
|
|
29951
|
+
const node = import_typescript80.default.factory.createBinaryExpression(lhs, op, rhs);
|
|
29973
29952
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
29974
29953
|
return node;
|
|
29975
29954
|
}
|
|
29976
29955
|
visitChain(ast) {
|
|
29977
29956
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
29978
|
-
const node = wrapForDiagnostics(
|
|
29957
|
+
const node = wrapForDiagnostics(import_typescript80.default.factory.createCommaListExpression(elements));
|
|
29979
29958
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
29980
29959
|
return node;
|
|
29981
29960
|
}
|
|
@@ -29983,7 +29962,7 @@ var AstTranslator = class {
|
|
|
29983
29962
|
const condExpr = this.translate(ast.condition);
|
|
29984
29963
|
const trueExpr = this.translate(ast.trueExp);
|
|
29985
29964
|
const falseExpr = wrapForTypeChecker(this.translate(ast.falseExp));
|
|
29986
|
-
const node =
|
|
29965
|
+
const node = import_typescript80.default.factory.createParenthesizedExpression(import_typescript80.default.factory.createConditionalExpression(condExpr, void 0, trueExpr, void 0, falseExpr));
|
|
29987
29966
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
29988
29967
|
return node;
|
|
29989
29968
|
}
|
|
@@ -29994,26 +29973,26 @@ var AstTranslator = class {
|
|
|
29994
29973
|
throw new Error("Method not implemented.");
|
|
29995
29974
|
}
|
|
29996
29975
|
visitInterpolation(ast) {
|
|
29997
|
-
return ast.expressions.reduce((lhs, ast2) =>
|
|
29976
|
+
return ast.expressions.reduce((lhs, ast2) => import_typescript80.default.factory.createBinaryExpression(lhs, import_typescript80.default.SyntaxKind.PlusToken, wrapForTypeChecker(this.translate(ast2))), import_typescript80.default.factory.createStringLiteral(""));
|
|
29998
29977
|
}
|
|
29999
29978
|
visitKeyedRead(ast) {
|
|
30000
29979
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
30001
29980
|
const key = this.translate(ast.key);
|
|
30002
|
-
const node =
|
|
29981
|
+
const node = import_typescript80.default.factory.createElementAccessExpression(receiver, key);
|
|
30003
29982
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
30004
29983
|
return node;
|
|
30005
29984
|
}
|
|
30006
29985
|
visitKeyedWrite(ast) {
|
|
30007
29986
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
30008
|
-
const left =
|
|
29987
|
+
const left = import_typescript80.default.factory.createElementAccessExpression(receiver, this.translate(ast.key));
|
|
30009
29988
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
30010
|
-
const node = wrapForDiagnostics(
|
|
29989
|
+
const node = wrapForDiagnostics(import_typescript80.default.factory.createBinaryExpression(left, import_typescript80.default.SyntaxKind.EqualsToken, right));
|
|
30011
29990
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
30012
29991
|
return node;
|
|
30013
29992
|
}
|
|
30014
29993
|
visitLiteralArray(ast) {
|
|
30015
29994
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
30016
|
-
const literal3 =
|
|
29995
|
+
const literal3 = import_typescript80.default.factory.createArrayLiteralExpression(elements);
|
|
30017
29996
|
const node = this.config.strictLiteralTypes ? literal3 : tsCastToAny(literal3);
|
|
30018
29997
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
30019
29998
|
return node;
|
|
@@ -30021,9 +30000,9 @@ var AstTranslator = class {
|
|
|
30021
30000
|
visitLiteralMap(ast) {
|
|
30022
30001
|
const properties = ast.keys.map(({ key }, idx) => {
|
|
30023
30002
|
const value = this.translate(ast.values[idx]);
|
|
30024
|
-
return
|
|
30003
|
+
return import_typescript80.default.factory.createPropertyAssignment(import_typescript80.default.factory.createStringLiteral(key), value);
|
|
30025
30004
|
});
|
|
30026
|
-
const literal3 =
|
|
30005
|
+
const literal3 = import_typescript80.default.factory.createObjectLiteralExpression(properties, true);
|
|
30027
30006
|
const node = this.config.strictLiteralTypes ? literal3 : tsCastToAny(literal3);
|
|
30028
30007
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
30029
30008
|
return node;
|
|
@@ -30031,15 +30010,15 @@ var AstTranslator = class {
|
|
|
30031
30010
|
visitLiteralPrimitive(ast) {
|
|
30032
30011
|
let node;
|
|
30033
30012
|
if (ast.value === void 0) {
|
|
30034
|
-
node =
|
|
30013
|
+
node = import_typescript80.default.factory.createIdentifier("undefined");
|
|
30035
30014
|
} else if (ast.value === null) {
|
|
30036
|
-
node =
|
|
30015
|
+
node = import_typescript80.default.factory.createNull();
|
|
30037
30016
|
} else if (typeof ast.value === "string") {
|
|
30038
|
-
node =
|
|
30017
|
+
node = import_typescript80.default.factory.createStringLiteral(ast.value);
|
|
30039
30018
|
} else if (typeof ast.value === "number") {
|
|
30040
|
-
node =
|
|
30019
|
+
node = import_typescript80.default.factory.createNumericLiteral(ast.value);
|
|
30041
30020
|
} else if (typeof ast.value === "boolean") {
|
|
30042
|
-
node = ast.value ?
|
|
30021
|
+
node = ast.value ? import_typescript80.default.factory.createTrue() : import_typescript80.default.factory.createFalse();
|
|
30043
30022
|
} else {
|
|
30044
30023
|
throw Error(`Unsupported AST value of type ${typeof ast.value}`);
|
|
30045
30024
|
}
|
|
@@ -30048,7 +30027,7 @@ var AstTranslator = class {
|
|
|
30048
30027
|
}
|
|
30049
30028
|
visitNonNullAssert(ast) {
|
|
30050
30029
|
const expr = wrapForDiagnostics(this.translate(ast.expression));
|
|
30051
|
-
const node =
|
|
30030
|
+
const node = import_typescript80.default.factory.createNonNullExpression(expr);
|
|
30052
30031
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
30053
30032
|
return node;
|
|
30054
30033
|
}
|
|
@@ -30057,13 +30036,13 @@ var AstTranslator = class {
|
|
|
30057
30036
|
}
|
|
30058
30037
|
visitPrefixNot(ast) {
|
|
30059
30038
|
const expression = wrapForDiagnostics(this.translate(ast.expression));
|
|
30060
|
-
const node =
|
|
30039
|
+
const node = import_typescript80.default.factory.createLogicalNot(expression);
|
|
30061
30040
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
30062
30041
|
return node;
|
|
30063
30042
|
}
|
|
30064
30043
|
visitPropertyRead(ast) {
|
|
30065
30044
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
30066
|
-
const name =
|
|
30045
|
+
const name = import_typescript80.default.factory.createPropertyAccessExpression(receiver, ast.name);
|
|
30067
30046
|
addParseSpanInfo(name, ast.nameSpan);
|
|
30068
30047
|
const node = wrapForDiagnostics(name);
|
|
30069
30048
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
@@ -30071,12 +30050,12 @@ var AstTranslator = class {
|
|
|
30071
30050
|
}
|
|
30072
30051
|
visitPropertyWrite(ast) {
|
|
30073
30052
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
30074
|
-
const left =
|
|
30053
|
+
const left = import_typescript80.default.factory.createPropertyAccessExpression(receiver, ast.name);
|
|
30075
30054
|
addParseSpanInfo(left, ast.nameSpan);
|
|
30076
30055
|
const leftWithPath = wrapForDiagnostics(left);
|
|
30077
30056
|
addParseSpanInfo(leftWithPath, ast.sourceSpan);
|
|
30078
30057
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
30079
|
-
const node = wrapForDiagnostics(
|
|
30058
|
+
const node = wrapForDiagnostics(import_typescript80.default.factory.createBinaryExpression(leftWithPath, import_typescript80.default.SyntaxKind.EqualsToken, right));
|
|
30080
30059
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
30081
30060
|
return node;
|
|
30082
30061
|
}
|
|
@@ -30084,13 +30063,13 @@ var AstTranslator = class {
|
|
|
30084
30063
|
let node;
|
|
30085
30064
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
30086
30065
|
if (this.config.strictSafeNavigationTypes) {
|
|
30087
|
-
const expr =
|
|
30066
|
+
const expr = import_typescript80.default.factory.createPropertyAccessExpression(import_typescript80.default.factory.createNonNullExpression(receiver), ast.name);
|
|
30088
30067
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
30089
|
-
node =
|
|
30068
|
+
node = import_typescript80.default.factory.createParenthesizedExpression(import_typescript80.default.factory.createConditionalExpression(NULL_AS_ANY, void 0, expr, void 0, UNDEFINED));
|
|
30090
30069
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
30091
|
-
node =
|
|
30070
|
+
node = import_typescript80.default.factory.createPropertyAccessExpression(tsCastToAny(receiver), ast.name);
|
|
30092
30071
|
} else {
|
|
30093
|
-
const expr =
|
|
30072
|
+
const expr = import_typescript80.default.factory.createPropertyAccessExpression(import_typescript80.default.factory.createNonNullExpression(receiver), ast.name);
|
|
30094
30073
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
30095
30074
|
node = tsCastToAny(expr);
|
|
30096
30075
|
}
|
|
@@ -30102,13 +30081,13 @@ var AstTranslator = class {
|
|
|
30102
30081
|
const key = this.translate(ast.key);
|
|
30103
30082
|
let node;
|
|
30104
30083
|
if (this.config.strictSafeNavigationTypes) {
|
|
30105
|
-
const expr =
|
|
30084
|
+
const expr = import_typescript80.default.factory.createElementAccessExpression(import_typescript80.default.factory.createNonNullExpression(receiver), key);
|
|
30106
30085
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
30107
|
-
node =
|
|
30086
|
+
node = import_typescript80.default.factory.createParenthesizedExpression(import_typescript80.default.factory.createConditionalExpression(NULL_AS_ANY, void 0, expr, void 0, UNDEFINED));
|
|
30108
30087
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
30109
|
-
node =
|
|
30088
|
+
node = import_typescript80.default.factory.createElementAccessExpression(tsCastToAny(receiver), key);
|
|
30110
30089
|
} else {
|
|
30111
|
-
const expr =
|
|
30090
|
+
const expr = import_typescript80.default.factory.createElementAccessExpression(import_typescript80.default.factory.createNonNullExpression(receiver), key);
|
|
30112
30091
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
30113
30092
|
node = tsCastToAny(expr);
|
|
30114
30093
|
}
|
|
@@ -30125,7 +30104,7 @@ var AstTranslator = class {
|
|
|
30125
30104
|
expr = resolved;
|
|
30126
30105
|
} else {
|
|
30127
30106
|
const propertyReceiver = wrapForDiagnostics(this.translate(receiver.receiver));
|
|
30128
|
-
expr =
|
|
30107
|
+
expr = import_typescript80.default.factory.createPropertyAccessExpression(propertyReceiver, receiver.name);
|
|
30129
30108
|
addParseSpanInfo(expr, receiver.nameSpan);
|
|
30130
30109
|
}
|
|
30131
30110
|
} else {
|
|
@@ -30135,7 +30114,7 @@ var AstTranslator = class {
|
|
|
30135
30114
|
if (ast.receiver instanceof SafePropertyRead || ast.receiver instanceof SafeKeyedRead) {
|
|
30136
30115
|
node = this.convertToSafeCall(ast, expr, args);
|
|
30137
30116
|
} else {
|
|
30138
|
-
node =
|
|
30117
|
+
node = import_typescript80.default.factory.createCallExpression(expr, void 0, args);
|
|
30139
30118
|
}
|
|
30140
30119
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
30141
30120
|
return node;
|
|
@@ -30149,13 +30128,13 @@ var AstTranslator = class {
|
|
|
30149
30128
|
}
|
|
30150
30129
|
convertToSafeCall(ast, expr, args) {
|
|
30151
30130
|
if (this.config.strictSafeNavigationTypes) {
|
|
30152
|
-
const call =
|
|
30153
|
-
return
|
|
30131
|
+
const call = import_typescript80.default.factory.createCallExpression(import_typescript80.default.factory.createNonNullExpression(expr), void 0, args);
|
|
30132
|
+
return import_typescript80.default.factory.createParenthesizedExpression(import_typescript80.default.factory.createConditionalExpression(NULL_AS_ANY, void 0, call, void 0, UNDEFINED));
|
|
30154
30133
|
}
|
|
30155
30134
|
if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
30156
|
-
return
|
|
30135
|
+
return import_typescript80.default.factory.createCallExpression(tsCastToAny(expr), void 0, args);
|
|
30157
30136
|
}
|
|
30158
|
-
return tsCastToAny(
|
|
30137
|
+
return tsCastToAny(import_typescript80.default.factory.createCallExpression(import_typescript80.default.factory.createNonNullExpression(expr), void 0, args));
|
|
30159
30138
|
}
|
|
30160
30139
|
};
|
|
30161
30140
|
var VeSafeLhsInferenceBugDetector = class {
|
|
@@ -30263,7 +30242,7 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
|
|
|
30263
30242
|
const tcb = new Context2(env, domSchemaChecker, oobRecorder, meta.id, meta.boundTarget, meta.pipes, meta.schemas, meta.isStandalone);
|
|
30264
30243
|
const scope = Scope2.forNodes(tcb, null, tcb.boundTarget.target.template, null);
|
|
30265
30244
|
const ctxRawType = env.referenceType(ref);
|
|
30266
|
-
if (!
|
|
30245
|
+
if (!import_typescript81.default.isTypeReferenceNode(ctxRawType)) {
|
|
30267
30246
|
throw new Error(`Expected TypeReferenceNode when referencing the ctx param for ${ref.debugName}`);
|
|
30268
30247
|
}
|
|
30269
30248
|
let typeParameters = void 0;
|
|
@@ -30275,25 +30254,25 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
|
|
|
30275
30254
|
switch (genericContextBehavior) {
|
|
30276
30255
|
case TcbGenericContextBehavior.UseEmitter:
|
|
30277
30256
|
typeParameters = new TypeParameterEmitter(ref.node.typeParameters, env.reflector).emit((typeRef) => env.referenceType(typeRef));
|
|
30278
|
-
typeArguments = typeParameters.map((param) =>
|
|
30257
|
+
typeArguments = typeParameters.map((param) => import_typescript81.default.factory.createTypeReferenceNode(param.name));
|
|
30279
30258
|
break;
|
|
30280
30259
|
case TcbGenericContextBehavior.CopyClassNodes:
|
|
30281
30260
|
typeParameters = [...ref.node.typeParameters];
|
|
30282
|
-
typeArguments = typeParameters.map((param) =>
|
|
30261
|
+
typeArguments = typeParameters.map((param) => import_typescript81.default.factory.createTypeReferenceNode(param.name));
|
|
30283
30262
|
break;
|
|
30284
30263
|
case TcbGenericContextBehavior.FallbackToAny:
|
|
30285
|
-
typeArguments = ref.node.typeParameters.map(() =>
|
|
30264
|
+
typeArguments = ref.node.typeParameters.map(() => import_typescript81.default.factory.createKeywordTypeNode(import_typescript81.default.SyntaxKind.AnyKeyword));
|
|
30286
30265
|
break;
|
|
30287
30266
|
}
|
|
30288
30267
|
}
|
|
30289
30268
|
const paramList = [tcbThisParam(ctxRawType.typeName, typeArguments)];
|
|
30290
30269
|
const scopeStatements = scope.render();
|
|
30291
|
-
const innerBody =
|
|
30270
|
+
const innerBody = import_typescript81.default.factory.createBlock([
|
|
30292
30271
|
...env.getPreludeStatements(),
|
|
30293
30272
|
...scopeStatements
|
|
30294
30273
|
]);
|
|
30295
|
-
const body =
|
|
30296
|
-
const fnDecl = createFunctionDeclaration(
|
|
30274
|
+
const body = import_typescript81.default.factory.createBlock([import_typescript81.default.factory.createIfStatement(import_typescript81.default.factory.createTrue(), innerBody, void 0)]);
|
|
30275
|
+
const fnDecl = import_typescript81.default.factory.createFunctionDeclaration(
|
|
30297
30276
|
void 0,
|
|
30298
30277
|
void 0,
|
|
30299
30278
|
name,
|
|
@@ -30342,7 +30321,7 @@ var TcbVariableOp = class extends TcbOp {
|
|
|
30342
30321
|
execute() {
|
|
30343
30322
|
const ctx = this.scope.resolve(this.template);
|
|
30344
30323
|
const id = this.tcb.allocateId();
|
|
30345
|
-
const initializer =
|
|
30324
|
+
const initializer = import_typescript81.default.factory.createPropertyAccessExpression(
|
|
30346
30325
|
ctx,
|
|
30347
30326
|
this.variable.value || "$implicit"
|
|
30348
30327
|
);
|
|
@@ -30368,7 +30347,7 @@ var TcbTemplateContextOp = class extends TcbOp {
|
|
|
30368
30347
|
}
|
|
30369
30348
|
execute() {
|
|
30370
30349
|
const ctx = this.tcb.allocateId();
|
|
30371
|
-
const type =
|
|
30350
|
+
const type = import_typescript81.default.factory.createKeywordTypeNode(import_typescript81.default.SyntaxKind.AnyKeyword);
|
|
30372
30351
|
this.scope.addStatement(tsDeclareVariable(ctx, type));
|
|
30373
30352
|
return ctx;
|
|
30374
30353
|
}
|
|
@@ -30421,16 +30400,16 @@ var TcbTemplateBodyOp = class extends TcbOp {
|
|
|
30421
30400
|
}
|
|
30422
30401
|
let guard = null;
|
|
30423
30402
|
if (directiveGuards.length > 0) {
|
|
30424
|
-
guard = directiveGuards.reduce((expr, dirGuard) =>
|
|
30403
|
+
guard = directiveGuards.reduce((expr, dirGuard) => import_typescript81.default.factory.createBinaryExpression(expr, import_typescript81.default.SyntaxKind.AmpersandAmpersandToken, dirGuard), directiveGuards.pop());
|
|
30425
30404
|
}
|
|
30426
30405
|
const tmplScope = Scope2.forNodes(this.tcb, this.scope, this.template, guard);
|
|
30427
30406
|
const statements = tmplScope.render();
|
|
30428
30407
|
if (statements.length === 0) {
|
|
30429
30408
|
return null;
|
|
30430
30409
|
}
|
|
30431
|
-
let tmplBlock =
|
|
30410
|
+
let tmplBlock = import_typescript81.default.factory.createBlock(statements);
|
|
30432
30411
|
if (guard !== null) {
|
|
30433
|
-
tmplBlock =
|
|
30412
|
+
tmplBlock = import_typescript81.default.factory.createIfStatement(guard, tmplBlock);
|
|
30434
30413
|
}
|
|
30435
30414
|
this.scope.addStatement(tmplBlock);
|
|
30436
30415
|
return null;
|
|
@@ -30448,7 +30427,7 @@ var TcbTextInterpolationOp = class extends TcbOp {
|
|
|
30448
30427
|
}
|
|
30449
30428
|
execute() {
|
|
30450
30429
|
const expr = tcbExpression(this.binding.value, this.tcb, this.scope);
|
|
30451
|
-
this.scope.addStatement(
|
|
30430
|
+
this.scope.addStatement(import_typescript81.default.factory.createExpressionStatement(expr));
|
|
30452
30431
|
return null;
|
|
30453
30432
|
}
|
|
30454
30433
|
};
|
|
@@ -30470,11 +30449,11 @@ var TcbDirectiveTypeOpBase = class extends TcbOp {
|
|
|
30470
30449
|
if (this.dir.isGeneric === false || dirRef.node.typeParameters === void 0) {
|
|
30471
30450
|
type = rawType;
|
|
30472
30451
|
} else {
|
|
30473
|
-
if (!
|
|
30452
|
+
if (!import_typescript81.default.isTypeReferenceNode(rawType)) {
|
|
30474
30453
|
throw new Error(`Expected TypeReferenceNode when referencing the type for ${this.dir.ref.debugName}`);
|
|
30475
30454
|
}
|
|
30476
|
-
const typeArguments = dirRef.node.typeParameters.map(() =>
|
|
30477
|
-
type =
|
|
30455
|
+
const typeArguments = dirRef.node.typeParameters.map(() => import_typescript81.default.factory.createKeywordTypeNode(import_typescript81.default.SyntaxKind.AnyKeyword));
|
|
30456
|
+
type = import_typescript81.default.factory.createTypeReferenceNode(rawType.typeName, typeArguments);
|
|
30478
30457
|
}
|
|
30479
30458
|
const id = this.tcb.allocateId();
|
|
30480
30459
|
addExpressionIdentifier(type, ExpressionIdentifier.DIRECTIVE);
|
|
@@ -30515,11 +30494,11 @@ var TcbReferenceOp = class extends TcbOp {
|
|
|
30515
30494
|
const id = this.tcb.allocateId();
|
|
30516
30495
|
let initializer = this.target instanceof Template || this.target instanceof Element ? this.scope.resolve(this.target) : this.scope.resolve(this.host, this.target);
|
|
30517
30496
|
if (this.target instanceof Element && !this.tcb.env.config.checkTypeOfDomReferences || !this.tcb.env.config.checkTypeOfNonDomReferences) {
|
|
30518
|
-
initializer =
|
|
30497
|
+
initializer = import_typescript81.default.factory.createAsExpression(initializer, import_typescript81.default.factory.createKeywordTypeNode(import_typescript81.default.SyntaxKind.AnyKeyword));
|
|
30519
30498
|
} else if (this.target instanceof Template) {
|
|
30520
|
-
initializer =
|
|
30521
|
-
initializer =
|
|
30522
|
-
initializer =
|
|
30499
|
+
initializer = import_typescript81.default.factory.createAsExpression(initializer, import_typescript81.default.factory.createKeywordTypeNode(import_typescript81.default.SyntaxKind.AnyKeyword));
|
|
30500
|
+
initializer = import_typescript81.default.factory.createAsExpression(initializer, this.tcb.env.referenceExternalType("@angular/core", "TemplateRef", [DYNAMIC_TYPE]));
|
|
30501
|
+
initializer = import_typescript81.default.factory.createParenthesizedExpression(initializer);
|
|
30523
30502
|
}
|
|
30524
30503
|
addParseSpanInfo(initializer, this.node.sourceSpan);
|
|
30525
30504
|
addParseSpanInfo(id, this.node.keySpan);
|
|
@@ -30609,7 +30588,7 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
30609
30588
|
let target;
|
|
30610
30589
|
if (this.dir.coercedInputFields.has(fieldName)) {
|
|
30611
30590
|
const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
|
|
30612
|
-
if (!
|
|
30591
|
+
if (!import_typescript81.default.isTypeReferenceNode(dirTypeRef)) {
|
|
30613
30592
|
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
30614
30593
|
}
|
|
30615
30594
|
const id = this.tcb.allocateId();
|
|
@@ -30624,10 +30603,10 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
30624
30603
|
}
|
|
30625
30604
|
const id = this.tcb.allocateId();
|
|
30626
30605
|
const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
|
|
30627
|
-
if (!
|
|
30606
|
+
if (!import_typescript81.default.isTypeReferenceNode(dirTypeRef)) {
|
|
30628
30607
|
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
30629
30608
|
}
|
|
30630
|
-
const type =
|
|
30609
|
+
const type = import_typescript81.default.factory.createIndexedAccessTypeNode(import_typescript81.default.factory.createTypeQueryNode(dirId), import_typescript81.default.factory.createLiteralTypeNode(import_typescript81.default.factory.createStringLiteral(fieldName)));
|
|
30631
30610
|
const temp = tsDeclareVariable(id, type);
|
|
30632
30611
|
this.scope.addStatement(temp);
|
|
30633
30612
|
target = id;
|
|
@@ -30635,18 +30614,18 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
30635
30614
|
if (dirId === null) {
|
|
30636
30615
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
30637
30616
|
}
|
|
30638
|
-
target = this.dir.stringLiteralInputFields.has(fieldName) ?
|
|
30617
|
+
target = this.dir.stringLiteralInputFields.has(fieldName) ? import_typescript81.default.factory.createElementAccessExpression(dirId, import_typescript81.default.factory.createStringLiteral(fieldName)) : import_typescript81.default.factory.createPropertyAccessExpression(dirId, import_typescript81.default.factory.createIdentifier(fieldName));
|
|
30639
30618
|
}
|
|
30640
30619
|
if (input.attribute.keySpan !== void 0) {
|
|
30641
30620
|
addParseSpanInfo(target, input.attribute.keySpan);
|
|
30642
30621
|
}
|
|
30643
|
-
assignment =
|
|
30622
|
+
assignment = import_typescript81.default.factory.createBinaryExpression(target, import_typescript81.default.SyntaxKind.EqualsToken, assignment);
|
|
30644
30623
|
}
|
|
30645
30624
|
addParseSpanInfo(assignment, input.attribute.sourceSpan);
|
|
30646
30625
|
if (!this.tcb.env.config.checkTypeOfAttributes && input.attribute instanceof TextAttribute) {
|
|
30647
30626
|
markIgnoreDiagnostics(assignment);
|
|
30648
30627
|
}
|
|
30649
|
-
this.scope.addStatement(
|
|
30628
|
+
this.scope.addStatement(import_typescript81.default.factory.createExpressionStatement(assignment));
|
|
30650
30629
|
}
|
|
30651
30630
|
return null;
|
|
30652
30631
|
}
|
|
@@ -30665,7 +30644,7 @@ var TcbDirectiveCtorCircularFallbackOp = class extends TcbOp {
|
|
|
30665
30644
|
execute() {
|
|
30666
30645
|
const id = this.tcb.allocateId();
|
|
30667
30646
|
const typeCtor = this.tcb.env.typeCtorFor(this.dir);
|
|
30668
|
-
const circularPlaceholder =
|
|
30647
|
+
const circularPlaceholder = import_typescript81.default.factory.createCallExpression(typeCtor, void 0, [import_typescript81.default.factory.createNonNullExpression(import_typescript81.default.factory.createNull())]);
|
|
30669
30648
|
this.scope.addStatement(tsCreateVariable(id, circularPlaceholder));
|
|
30670
30649
|
return id;
|
|
30671
30650
|
}
|
|
@@ -30733,15 +30712,15 @@ var TcbUnclaimedInputsOp = class extends TcbOp {
|
|
|
30733
30712
|
elId = this.scope.resolve(this.element);
|
|
30734
30713
|
}
|
|
30735
30714
|
const propertyName = (_a = ATTR_TO_PROP.get(binding.name)) != null ? _a : binding.name;
|
|
30736
|
-
const prop =
|
|
30737
|
-
const stmt =
|
|
30715
|
+
const prop = import_typescript81.default.factory.createElementAccessExpression(elId, import_typescript81.default.factory.createStringLiteral(propertyName));
|
|
30716
|
+
const stmt = import_typescript81.default.factory.createBinaryExpression(prop, import_typescript81.default.SyntaxKind.EqualsToken, wrapForDiagnostics(expr));
|
|
30738
30717
|
addParseSpanInfo(stmt, binding.sourceSpan);
|
|
30739
|
-
this.scope.addStatement(
|
|
30718
|
+
this.scope.addStatement(import_typescript81.default.factory.createExpressionStatement(stmt));
|
|
30740
30719
|
} else {
|
|
30741
|
-
this.scope.addStatement(
|
|
30720
|
+
this.scope.addStatement(import_typescript81.default.factory.createExpressionStatement(expr));
|
|
30742
30721
|
}
|
|
30743
30722
|
} else {
|
|
30744
|
-
this.scope.addStatement(
|
|
30723
|
+
this.scope.addStatement(import_typescript81.default.factory.createExpressionStatement(expr));
|
|
30745
30724
|
}
|
|
30746
30725
|
}
|
|
30747
30726
|
return null;
|
|
@@ -30773,18 +30752,18 @@ var TcbDirectiveOutputsOp = class extends TcbOp {
|
|
|
30773
30752
|
if (dirId === null) {
|
|
30774
30753
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
30775
30754
|
}
|
|
30776
|
-
const outputField =
|
|
30755
|
+
const outputField = import_typescript81.default.factory.createElementAccessExpression(dirId, import_typescript81.default.factory.createStringLiteral(field));
|
|
30777
30756
|
addParseSpanInfo(outputField, output.keySpan);
|
|
30778
30757
|
if (this.tcb.env.config.checkTypeOfOutputEvents) {
|
|
30779
30758
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
30780
|
-
const subscribeFn =
|
|
30781
|
-
const call =
|
|
30759
|
+
const subscribeFn = import_typescript81.default.factory.createPropertyAccessExpression(outputField, "subscribe");
|
|
30760
|
+
const call = import_typescript81.default.factory.createCallExpression(subscribeFn, void 0, [handler]);
|
|
30782
30761
|
addParseSpanInfo(call, output.sourceSpan);
|
|
30783
|
-
this.scope.addStatement(
|
|
30762
|
+
this.scope.addStatement(import_typescript81.default.factory.createExpressionStatement(call));
|
|
30784
30763
|
} else {
|
|
30785
|
-
this.scope.addStatement(
|
|
30764
|
+
this.scope.addStatement(import_typescript81.default.factory.createExpressionStatement(outputField));
|
|
30786
30765
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
30787
|
-
this.scope.addStatement(
|
|
30766
|
+
this.scope.addStatement(import_typescript81.default.factory.createExpressionStatement(handler));
|
|
30788
30767
|
}
|
|
30789
30768
|
ExpressionSemanticVisitor.visit(output.handler, this.tcb.id, this.tcb.boundTarget, this.tcb.oobRecorder);
|
|
30790
30769
|
}
|
|
@@ -30817,24 +30796,24 @@ var TcbUnclaimedOutputsOp = class extends TcbOp {
|
|
|
30817
30796
|
if (output.type === 1) {
|
|
30818
30797
|
const eventType = this.tcb.env.config.checkTypeOfAnimationEvents ? this.tcb.env.referenceExternalType("@angular/animations", "AnimationEvent") : 1;
|
|
30819
30798
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, eventType);
|
|
30820
|
-
this.scope.addStatement(
|
|
30799
|
+
this.scope.addStatement(import_typescript81.default.factory.createExpressionStatement(handler));
|
|
30821
30800
|
} else if (this.tcb.env.config.checkTypeOfDomEvents) {
|
|
30822
30801
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
30823
30802
|
if (elId === null) {
|
|
30824
30803
|
elId = this.scope.resolve(this.element);
|
|
30825
30804
|
}
|
|
30826
|
-
const propertyAccess =
|
|
30805
|
+
const propertyAccess = import_typescript81.default.factory.createPropertyAccessExpression(elId, "addEventListener");
|
|
30827
30806
|
addParseSpanInfo(propertyAccess, output.keySpan);
|
|
30828
|
-
const call =
|
|
30807
|
+
const call = import_typescript81.default.factory.createCallExpression(
|
|
30829
30808
|
propertyAccess,
|
|
30830
30809
|
void 0,
|
|
30831
|
-
[
|
|
30810
|
+
[import_typescript81.default.factory.createStringLiteral(output.name), handler]
|
|
30832
30811
|
);
|
|
30833
30812
|
addParseSpanInfo(call, output.sourceSpan);
|
|
30834
|
-
this.scope.addStatement(
|
|
30813
|
+
this.scope.addStatement(import_typescript81.default.factory.createExpressionStatement(call));
|
|
30835
30814
|
} else {
|
|
30836
30815
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
30837
|
-
this.scope.addStatement(
|
|
30816
|
+
this.scope.addStatement(import_typescript81.default.factory.createExpressionStatement(handler));
|
|
30838
30817
|
}
|
|
30839
30818
|
ExpressionSemanticVisitor.visit(output.handler, this.tcb.id, this.tcb.boundTarget, this.tcb.oobRecorder);
|
|
30840
30819
|
}
|
|
@@ -30848,15 +30827,15 @@ var TcbComponentContextCompletionOp = class extends TcbOp {
|
|
|
30848
30827
|
this.optional = false;
|
|
30849
30828
|
}
|
|
30850
30829
|
execute() {
|
|
30851
|
-
const ctx =
|
|
30852
|
-
const ctxDot =
|
|
30830
|
+
const ctx = import_typescript81.default.factory.createThis();
|
|
30831
|
+
const ctxDot = import_typescript81.default.factory.createPropertyAccessExpression(ctx, "");
|
|
30853
30832
|
markIgnoreDiagnostics(ctxDot);
|
|
30854
30833
|
addExpressionIdentifier(ctxDot, ExpressionIdentifier.COMPONENT_COMPLETION);
|
|
30855
|
-
this.scope.addStatement(
|
|
30834
|
+
this.scope.addStatement(import_typescript81.default.factory.createExpressionStatement(ctxDot));
|
|
30856
30835
|
return null;
|
|
30857
30836
|
}
|
|
30858
30837
|
};
|
|
30859
|
-
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR =
|
|
30838
|
+
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR = import_typescript81.default.factory.createNonNullExpression(import_typescript81.default.factory.createNull());
|
|
30860
30839
|
var Context2 = class {
|
|
30861
30840
|
constructor(env, domSchemaChecker, oobRecorder, id, boundTarget, pipes, schemas, hostIsStandalone) {
|
|
30862
30841
|
this.env = env;
|
|
@@ -30870,7 +30849,7 @@ var Context2 = class {
|
|
|
30870
30849
|
this.nextId = 1;
|
|
30871
30850
|
}
|
|
30872
30851
|
allocateId() {
|
|
30873
|
-
return
|
|
30852
|
+
return import_typescript81.default.factory.createIdentifier(`_t${this.nextId++}`);
|
|
30874
30853
|
}
|
|
30875
30854
|
getPipeByName(name) {
|
|
30876
30855
|
if (!this.pipes.has(name)) {
|
|
@@ -30923,16 +30902,16 @@ var Scope2 = class {
|
|
|
30923
30902
|
const res = this.resolveLocal(node, directive);
|
|
30924
30903
|
if (res !== null) {
|
|
30925
30904
|
let clone;
|
|
30926
|
-
if (
|
|
30927
|
-
clone =
|
|
30928
|
-
} else if (
|
|
30929
|
-
clone =
|
|
30905
|
+
if (import_typescript81.default.isIdentifier(res)) {
|
|
30906
|
+
clone = import_typescript81.default.factory.createIdentifier(res.text);
|
|
30907
|
+
} else if (import_typescript81.default.isNonNullExpression(res)) {
|
|
30908
|
+
clone = import_typescript81.default.factory.createNonNullExpression(res.expression);
|
|
30930
30909
|
} else {
|
|
30931
30910
|
throw new Error(`Could not resolve ${node} to an Identifier or a NonNullExpression`);
|
|
30932
30911
|
}
|
|
30933
|
-
|
|
30912
|
+
import_typescript81.default.setOriginalNode(clone, res);
|
|
30934
30913
|
clone.parent = clone.parent;
|
|
30935
|
-
return
|
|
30914
|
+
return import_typescript81.default.setSyntheticTrailingComments(clone, []);
|
|
30936
30915
|
} else if (this.parent !== null) {
|
|
30937
30916
|
return this.parent.resolve(node, directive);
|
|
30938
30917
|
} else {
|
|
@@ -30959,7 +30938,7 @@ var Scope2 = class {
|
|
|
30959
30938
|
} else if (parentGuards === null) {
|
|
30960
30939
|
return this.guard;
|
|
30961
30940
|
} else {
|
|
30962
|
-
return
|
|
30941
|
+
return import_typescript81.default.factory.createBinaryExpression(parentGuards, import_typescript81.default.SyntaxKind.AmpersandAmpersandToken, this.guard);
|
|
30963
30942
|
}
|
|
30964
30943
|
}
|
|
30965
30944
|
resolveLocal(ref, directive) {
|
|
@@ -31139,12 +31118,12 @@ var Scope2 = class {
|
|
|
31139
31118
|
}
|
|
31140
31119
|
};
|
|
31141
31120
|
function tcbThisParam(name, typeArguments) {
|
|
31142
|
-
return createParameterDeclaration(
|
|
31121
|
+
return import_typescript81.default.factory.createParameterDeclaration(
|
|
31143
31122
|
void 0,
|
|
31144
31123
|
void 0,
|
|
31145
31124
|
"this",
|
|
31146
31125
|
void 0,
|
|
31147
|
-
|
|
31126
|
+
import_typescript81.default.factory.createTypeReferenceNode(name, typeArguments),
|
|
31148
31127
|
void 0
|
|
31149
31128
|
);
|
|
31150
31129
|
}
|
|
@@ -31169,11 +31148,11 @@ var TcbExpressionTranslator = class {
|
|
|
31169
31148
|
return null;
|
|
31170
31149
|
}
|
|
31171
31150
|
const expr = this.translate(ast.value);
|
|
31172
|
-
const result =
|
|
31151
|
+
const result = import_typescript81.default.factory.createParenthesizedExpression(import_typescript81.default.factory.createBinaryExpression(target, import_typescript81.default.SyntaxKind.EqualsToken, expr));
|
|
31173
31152
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
31174
31153
|
return result;
|
|
31175
31154
|
} else if (ast instanceof ImplicitReceiver) {
|
|
31176
|
-
return
|
|
31155
|
+
return import_typescript81.default.factory.createThis();
|
|
31177
31156
|
} else if (ast instanceof BindingPipe) {
|
|
31178
31157
|
const expr = this.translate(ast.exp);
|
|
31179
31158
|
const pipeRef = this.tcb.getPipeByName(ast.name);
|
|
@@ -31185,12 +31164,12 @@ var TcbExpressionTranslator = class {
|
|
|
31185
31164
|
pipe = this.tcb.env.pipeInst(pipeRef);
|
|
31186
31165
|
}
|
|
31187
31166
|
const args = ast.args.map((arg) => this.translate(arg));
|
|
31188
|
-
let methodAccess =
|
|
31167
|
+
let methodAccess = import_typescript81.default.factory.createPropertyAccessExpression(pipe, "transform");
|
|
31189
31168
|
addParseSpanInfo(methodAccess, ast.nameSpan);
|
|
31190
31169
|
if (!this.tcb.env.config.checkTypeOfPipes) {
|
|
31191
|
-
methodAccess =
|
|
31170
|
+
methodAccess = import_typescript81.default.factory.createAsExpression(methodAccess, import_typescript81.default.factory.createKeywordTypeNode(import_typescript81.default.SyntaxKind.AnyKeyword));
|
|
31192
31171
|
}
|
|
31193
|
-
const result =
|
|
31172
|
+
const result = import_typescript81.default.factory.createCallExpression(
|
|
31194
31173
|
methodAccess,
|
|
31195
31174
|
void 0,
|
|
31196
31175
|
[expr, ...args]
|
|
@@ -31200,8 +31179,8 @@ var TcbExpressionTranslator = class {
|
|
|
31200
31179
|
} else if ((ast instanceof Call || ast instanceof SafeCall) && (ast.receiver instanceof PropertyRead || ast.receiver instanceof SafePropertyRead)) {
|
|
31201
31180
|
if (ast.receiver.receiver instanceof ImplicitReceiver && !(ast.receiver.receiver instanceof ThisReceiver) && ast.receiver.name === "$any" && ast.args.length === 1) {
|
|
31202
31181
|
const expr = this.translate(ast.args[0]);
|
|
31203
|
-
const exprAsAny =
|
|
31204
|
-
const result =
|
|
31182
|
+
const exprAsAny = import_typescript81.default.factory.createAsExpression(expr, import_typescript81.default.factory.createKeywordTypeNode(import_typescript81.default.SyntaxKind.AnyKeyword));
|
|
31183
|
+
const result = import_typescript81.default.factory.createParenthesizedExpression(exprAsAny);
|
|
31205
31184
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
31206
31185
|
return result;
|
|
31207
31186
|
}
|
|
@@ -31212,7 +31191,7 @@ var TcbExpressionTranslator = class {
|
|
|
31212
31191
|
const method = wrapForDiagnostics(receiver);
|
|
31213
31192
|
addParseSpanInfo(method, ast.receiver.nameSpan);
|
|
31214
31193
|
const args = ast.args.map((arg) => this.translate(arg));
|
|
31215
|
-
const node =
|
|
31194
|
+
const node = import_typescript81.default.factory.createCallExpression(method, void 0, args);
|
|
31216
31195
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
31217
31196
|
return node;
|
|
31218
31197
|
} else {
|
|
@@ -31232,20 +31211,20 @@ var TcbExpressionTranslator = class {
|
|
|
31232
31211
|
function tcbCallTypeCtor(dir, tcb, inputs) {
|
|
31233
31212
|
const typeCtor = tcb.env.typeCtorFor(dir);
|
|
31234
31213
|
const members = inputs.map((input) => {
|
|
31235
|
-
const propertyName =
|
|
31214
|
+
const propertyName = import_typescript81.default.factory.createStringLiteral(input.field);
|
|
31236
31215
|
if (input.type === "binding") {
|
|
31237
31216
|
const expr = widenBinding(input.expression, tcb);
|
|
31238
|
-
const assignment =
|
|
31217
|
+
const assignment = import_typescript81.default.factory.createPropertyAssignment(propertyName, wrapForDiagnostics(expr));
|
|
31239
31218
|
addParseSpanInfo(assignment, input.sourceSpan);
|
|
31240
31219
|
return assignment;
|
|
31241
31220
|
} else {
|
|
31242
|
-
return
|
|
31221
|
+
return import_typescript81.default.factory.createPropertyAssignment(propertyName, NULL_AS_ANY);
|
|
31243
31222
|
}
|
|
31244
31223
|
});
|
|
31245
|
-
return
|
|
31224
|
+
return import_typescript81.default.factory.createCallExpression(
|
|
31246
31225
|
typeCtor,
|
|
31247
31226
|
void 0,
|
|
31248
|
-
[
|
|
31227
|
+
[import_typescript81.default.factory.createObjectLiteralExpression(members)]
|
|
31249
31228
|
);
|
|
31250
31229
|
}
|
|
31251
31230
|
function getBoundInputs(directive, node, tcb) {
|
|
@@ -31272,17 +31251,17 @@ function translateInput(attr, tcb, scope) {
|
|
|
31272
31251
|
if (attr instanceof BoundAttribute) {
|
|
31273
31252
|
return tcbExpression(attr.value, tcb, scope);
|
|
31274
31253
|
} else {
|
|
31275
|
-
return
|
|
31254
|
+
return import_typescript81.default.factory.createStringLiteral(attr.value);
|
|
31276
31255
|
}
|
|
31277
31256
|
}
|
|
31278
31257
|
function widenBinding(expr, tcb) {
|
|
31279
31258
|
if (!tcb.env.config.checkTypeOfInputBindings) {
|
|
31280
31259
|
return tsCastToAny(expr);
|
|
31281
31260
|
} else if (!tcb.env.config.strictNullInputBindings) {
|
|
31282
|
-
if (
|
|
31261
|
+
if (import_typescript81.default.isObjectLiteralExpression(expr) || import_typescript81.default.isArrayLiteralExpression(expr)) {
|
|
31283
31262
|
return expr;
|
|
31284
31263
|
} else {
|
|
31285
|
-
return
|
|
31264
|
+
return import_typescript81.default.factory.createNonNullExpression(expr);
|
|
31286
31265
|
}
|
|
31287
31266
|
} else {
|
|
31288
31267
|
return expr;
|
|
@@ -31295,16 +31274,16 @@ function tcbCreateEventHandler(event, tcb, scope, eventType) {
|
|
|
31295
31274
|
if (eventType === 0) {
|
|
31296
31275
|
eventParamType = void 0;
|
|
31297
31276
|
} else if (eventType === 1) {
|
|
31298
|
-
eventParamType =
|
|
31277
|
+
eventParamType = import_typescript81.default.factory.createKeywordTypeNode(import_typescript81.default.SyntaxKind.AnyKeyword);
|
|
31299
31278
|
} else {
|
|
31300
31279
|
eventParamType = eventType;
|
|
31301
31280
|
}
|
|
31302
31281
|
const guards = scope.guards();
|
|
31303
|
-
let body =
|
|
31282
|
+
let body = import_typescript81.default.factory.createExpressionStatement(handler);
|
|
31304
31283
|
if (guards !== null) {
|
|
31305
|
-
body =
|
|
31284
|
+
body = import_typescript81.default.factory.createIfStatement(guards, body);
|
|
31306
31285
|
}
|
|
31307
|
-
const eventParam = createParameterDeclaration(
|
|
31286
|
+
const eventParam = import_typescript81.default.factory.createParameterDeclaration(
|
|
31308
31287
|
void 0,
|
|
31309
31288
|
void 0,
|
|
31310
31289
|
EVENT_PARAMETER,
|
|
@@ -31312,13 +31291,13 @@ function tcbCreateEventHandler(event, tcb, scope, eventType) {
|
|
|
31312
31291
|
eventParamType
|
|
31313
31292
|
);
|
|
31314
31293
|
addExpressionIdentifier(eventParam, ExpressionIdentifier.EVENT_PARAMETER);
|
|
31315
|
-
return
|
|
31294
|
+
return import_typescript81.default.factory.createArrowFunction(
|
|
31316
31295
|
void 0,
|
|
31317
31296
|
void 0,
|
|
31318
31297
|
[eventParam],
|
|
31319
|
-
|
|
31298
|
+
import_typescript81.default.factory.createKeywordTypeNode(import_typescript81.default.SyntaxKind.AnyKeyword),
|
|
31320
31299
|
void 0,
|
|
31321
|
-
|
|
31300
|
+
import_typescript81.default.factory.createBlock([body])
|
|
31322
31301
|
);
|
|
31323
31302
|
}
|
|
31324
31303
|
function tcbEventHandlerExpression(ast, tcb, scope) {
|
|
@@ -31347,7 +31326,7 @@ function isSplitTwoWayBinding(inputName, output, inputs, tcb) {
|
|
|
31347
31326
|
var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
|
|
31348
31327
|
resolve(ast) {
|
|
31349
31328
|
if (ast instanceof PropertyRead && ast.receiver instanceof ImplicitReceiver && !(ast.receiver instanceof ThisReceiver) && ast.name === EVENT_PARAMETER) {
|
|
31350
|
-
const event =
|
|
31329
|
+
const event = import_typescript81.default.factory.createIdentifier(EVENT_PARAMETER);
|
|
31351
31330
|
addParseSpanInfo(event, ast.nameSpan);
|
|
31352
31331
|
return event;
|
|
31353
31332
|
}
|
|
@@ -31356,32 +31335,32 @@ var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
|
|
|
31356
31335
|
};
|
|
31357
31336
|
|
|
31358
31337
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_file.mjs
|
|
31359
|
-
var
|
|
31338
|
+
var import_typescript82 = __toESM(require("typescript"), 1);
|
|
31360
31339
|
var TypeCheckFile = class extends Environment {
|
|
31361
31340
|
constructor(fileName, config, refEmitter, reflector, compilerHost) {
|
|
31362
|
-
super(config, new ImportManager(new NoopImportRewriter(), "i"), refEmitter, reflector,
|
|
31341
|
+
super(config, new ImportManager(new NoopImportRewriter(), "i"), refEmitter, reflector, import_typescript82.default.createSourceFile(compilerHost.getCanonicalFileName(fileName), "", import_typescript82.default.ScriptTarget.Latest, true));
|
|
31363
31342
|
this.fileName = fileName;
|
|
31364
31343
|
this.nextTcbId = 1;
|
|
31365
31344
|
this.tcbStatements = [];
|
|
31366
31345
|
}
|
|
31367
31346
|
addTypeCheckBlock(ref, meta, domSchemaChecker, oobRecorder, genericContextBehavior) {
|
|
31368
|
-
const fnId =
|
|
31347
|
+
const fnId = import_typescript82.default.factory.createIdentifier(`_tcb${this.nextTcbId++}`);
|
|
31369
31348
|
const fn2 = generateTypeCheckBlock(this, ref, fnId, meta, domSchemaChecker, oobRecorder, genericContextBehavior);
|
|
31370
31349
|
this.tcbStatements.push(fn2);
|
|
31371
31350
|
}
|
|
31372
31351
|
render(removeComments) {
|
|
31373
31352
|
let source = this.importManager.getAllImports(this.contextFile.fileName).map((i) => `import * as ${i.qualifier.text} from '${i.specifier}';`).join("\n") + "\n\n";
|
|
31374
|
-
const printer =
|
|
31353
|
+
const printer = import_typescript82.default.createPrinter({ removeComments });
|
|
31375
31354
|
source += "\n";
|
|
31376
31355
|
for (const stmt of this.pipeInstStatements) {
|
|
31377
|
-
source += printer.printNode(
|
|
31356
|
+
source += printer.printNode(import_typescript82.default.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
31378
31357
|
}
|
|
31379
31358
|
for (const stmt of this.typeCtorStatements) {
|
|
31380
|
-
source += printer.printNode(
|
|
31359
|
+
source += printer.printNode(import_typescript82.default.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
31381
31360
|
}
|
|
31382
31361
|
source += "\n";
|
|
31383
31362
|
for (const stmt of this.tcbStatements) {
|
|
31384
|
-
source += printer.printNode(
|
|
31363
|
+
source += printer.printNode(import_typescript82.default.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
31385
31364
|
}
|
|
31386
31365
|
source += "\nexport const IS_A_MODULE = true;\n";
|
|
31387
31366
|
return source;
|
|
@@ -31497,7 +31476,7 @@ var TypeCheckContextImpl = class {
|
|
|
31497
31476
|
const importManager = new ImportManager(new NoopImportRewriter(), "_i");
|
|
31498
31477
|
const ops = this.opMap.get(sf).sort(orderOps);
|
|
31499
31478
|
const textParts = splitStringAtPoints(sf.text, ops.map((op) => op.splitPoint));
|
|
31500
|
-
const printer =
|
|
31479
|
+
const printer = import_typescript83.default.createPrinter({ omitTrailingSemicolon: true });
|
|
31501
31480
|
let code = textParts[0];
|
|
31502
31481
|
ops.forEach((op, idx) => {
|
|
31503
31482
|
const text = op.execute(importManager, sf, this.refEmitter, printer);
|
|
@@ -31578,7 +31557,7 @@ var TypeCheckContextImpl = class {
|
|
|
31578
31557
|
if (span.start.offset === span.end.offset) {
|
|
31579
31558
|
span.end.offset++;
|
|
31580
31559
|
}
|
|
31581
|
-
return makeTemplateDiagnostic(templateId, sourceMapping, span,
|
|
31560
|
+
return makeTemplateDiagnostic(templateId, sourceMapping, span, import_typescript83.default.DiagnosticCategory.Error, ngErrorCode(ErrorCode.TEMPLATE_PARSE_ERROR), error2.msg);
|
|
31582
31561
|
});
|
|
31583
31562
|
}
|
|
31584
31563
|
};
|
|
@@ -31596,9 +31575,9 @@ var InlineTcbOp = class {
|
|
|
31596
31575
|
}
|
|
31597
31576
|
execute(im, sf, refEmitter, printer) {
|
|
31598
31577
|
const env = new Environment(this.config, im, refEmitter, this.reflector, sf);
|
|
31599
|
-
const fnName =
|
|
31578
|
+
const fnName = import_typescript83.default.factory.createIdentifier(`_tcb_${this.ref.node.pos}`);
|
|
31600
31579
|
const fn2 = generateTypeCheckBlock(env, this.ref, fnName, this.meta, this.domSchemaChecker, this.oobRecorder, TcbGenericContextBehavior.CopyClassNodes);
|
|
31601
|
-
return printer.printNode(
|
|
31580
|
+
return printer.printNode(import_typescript83.default.EmitHint.Unspecified, fn2, sf);
|
|
31602
31581
|
}
|
|
31603
31582
|
};
|
|
31604
31583
|
var TypeCtorOp = class {
|
|
@@ -31611,7 +31590,7 @@ var TypeCtorOp = class {
|
|
|
31611
31590
|
}
|
|
31612
31591
|
execute(im, sf, refEmitter, printer) {
|
|
31613
31592
|
const tcb = generateInlineTypeCtor(this.ref.node, this.meta);
|
|
31614
|
-
return printer.printNode(
|
|
31593
|
+
return printer.printNode(import_typescript83.default.EmitHint.Unspecified, tcb, sf);
|
|
31615
31594
|
}
|
|
31616
31595
|
};
|
|
31617
31596
|
function orderOps(op1, op2) {
|
|
@@ -31722,7 +31701,7 @@ var TemplateSourceManager = class {
|
|
|
31722
31701
|
};
|
|
31723
31702
|
|
|
31724
31703
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/template_symbol_builder.mjs
|
|
31725
|
-
var
|
|
31704
|
+
var import_typescript84 = __toESM(require("typescript"), 1);
|
|
31726
31705
|
var SymbolBuilder = class {
|
|
31727
31706
|
constructor(tcbPath, tcbIsShim, typeCheckBlock, templateData, componentScopeReader, getTypeChecker) {
|
|
31728
31707
|
this.tcbPath = tcbPath;
|
|
@@ -31766,7 +31745,7 @@ var SymbolBuilder = class {
|
|
|
31766
31745
|
getSymbolOfElement(element) {
|
|
31767
31746
|
var _a;
|
|
31768
31747
|
const elementSourceSpan = (_a = element.startSourceSpan) != null ? _a : element.sourceSpan;
|
|
31769
|
-
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: elementSourceSpan, filter:
|
|
31748
|
+
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: elementSourceSpan, filter: import_typescript84.default.isVariableDeclaration });
|
|
31770
31749
|
if (node === null) {
|
|
31771
31750
|
return null;
|
|
31772
31751
|
}
|
|
@@ -31785,12 +31764,12 @@ var SymbolBuilder = class {
|
|
|
31785
31764
|
var _a;
|
|
31786
31765
|
const elementSourceSpan = (_a = element.startSourceSpan) != null ? _a : element.sourceSpan;
|
|
31787
31766
|
const tcbSourceFile = this.typeCheckBlock.getSourceFile();
|
|
31788
|
-
const isDirectiveDeclaration = (node) => (
|
|
31767
|
+
const isDirectiveDeclaration = (node) => (import_typescript84.default.isTypeNode(node) || import_typescript84.default.isIdentifier(node)) && import_typescript84.default.isVariableDeclaration(node.parent) && hasExpressionIdentifier(tcbSourceFile, node, ExpressionIdentifier.DIRECTIVE);
|
|
31789
31768
|
const nodes = findAllMatchingNodes(this.typeCheckBlock, { withSpan: elementSourceSpan, filter: isDirectiveDeclaration });
|
|
31790
31769
|
const symbols = [];
|
|
31791
31770
|
for (const node of nodes) {
|
|
31792
31771
|
const symbol = this.getSymbolOfTsNode(node.parent);
|
|
31793
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
31772
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !import_typescript84.default.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
31794
31773
|
continue;
|
|
31795
31774
|
}
|
|
31796
31775
|
const meta = this.getDirectiveMeta(element, symbol.tsSymbol.valueDeclaration);
|
|
@@ -31817,7 +31796,7 @@ var SymbolBuilder = class {
|
|
|
31817
31796
|
}
|
|
31818
31797
|
addHostDirectiveSymbols(host, hostDirectives, symbols) {
|
|
31819
31798
|
for (const current of hostDirectives) {
|
|
31820
|
-
if (!
|
|
31799
|
+
if (!import_typescript84.default.isClassDeclaration(current.directive.node)) {
|
|
31821
31800
|
continue;
|
|
31822
31801
|
}
|
|
31823
31802
|
const symbol = this.getSymbolOfTsNode(current.directive.node);
|
|
@@ -31889,17 +31868,17 @@ var SymbolBuilder = class {
|
|
|
31889
31868
|
if (!isAccessExpression(n)) {
|
|
31890
31869
|
return false;
|
|
31891
31870
|
}
|
|
31892
|
-
if (
|
|
31871
|
+
if (import_typescript84.default.isPropertyAccessExpression(n)) {
|
|
31893
31872
|
return n.name.getText() === expectedAccess;
|
|
31894
31873
|
} else {
|
|
31895
|
-
return
|
|
31874
|
+
return import_typescript84.default.isStringLiteral(n.argumentExpression) && n.argumentExpression.text === expectedAccess;
|
|
31896
31875
|
}
|
|
31897
31876
|
}
|
|
31898
31877
|
const outputFieldAccesses = findAllMatchingNodes(this.typeCheckBlock, { withSpan: eventBinding.keySpan, filter });
|
|
31899
31878
|
const bindings = [];
|
|
31900
31879
|
for (const outputFieldAccess of outputFieldAccesses) {
|
|
31901
31880
|
if (consumer instanceof Template || consumer instanceof Element) {
|
|
31902
|
-
if (!
|
|
31881
|
+
if (!import_typescript84.default.isPropertyAccessExpression(outputFieldAccess)) {
|
|
31903
31882
|
continue;
|
|
31904
31883
|
}
|
|
31905
31884
|
const addEventListener = outputFieldAccess.name;
|
|
@@ -31922,7 +31901,7 @@ var SymbolBuilder = class {
|
|
|
31922
31901
|
}
|
|
31923
31902
|
});
|
|
31924
31903
|
} else {
|
|
31925
|
-
if (!
|
|
31904
|
+
if (!import_typescript84.default.isElementAccessExpression(outputFieldAccess)) {
|
|
31926
31905
|
continue;
|
|
31927
31906
|
}
|
|
31928
31907
|
const tsSymbol = this.getTypeChecker().getSymbolAtLocation(outputFieldAccess.argumentExpression);
|
|
@@ -31994,7 +31973,7 @@ var SymbolBuilder = class {
|
|
|
31994
31973
|
return null;
|
|
31995
31974
|
}
|
|
31996
31975
|
const [declaration] = tsSymbol.declarations;
|
|
31997
|
-
if (!
|
|
31976
|
+
if (!import_typescript84.default.isVariableDeclaration(declaration) || !hasExpressionIdentifier(
|
|
31998
31977
|
declaration.getSourceFile(),
|
|
31999
31978
|
(_a = declaration.type) != null ? _a : declaration.name,
|
|
32000
31979
|
ExpressionIdentifier.DIRECTIVE
|
|
@@ -32002,7 +31981,7 @@ var SymbolBuilder = class {
|
|
|
32002
31981
|
return null;
|
|
32003
31982
|
}
|
|
32004
31983
|
const symbol = this.getSymbolOfTsNode(declaration);
|
|
32005
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
31984
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !import_typescript84.default.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
32006
31985
|
return null;
|
|
32007
31986
|
}
|
|
32008
31987
|
const ref = new Reference2(symbol.tsSymbol.valueDeclaration);
|
|
@@ -32022,7 +32001,7 @@ var SymbolBuilder = class {
|
|
|
32022
32001
|
};
|
|
32023
32002
|
}
|
|
32024
32003
|
getSymbolOfVariable(variable2) {
|
|
32025
|
-
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: variable2.sourceSpan, filter:
|
|
32004
|
+
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: variable2.sourceSpan, filter: import_typescript84.default.isVariableDeclaration });
|
|
32026
32005
|
if (node === null || node.initializer === void 0) {
|
|
32027
32006
|
return null;
|
|
32028
32007
|
}
|
|
@@ -32045,11 +32024,11 @@ var SymbolBuilder = class {
|
|
|
32045
32024
|
}
|
|
32046
32025
|
getSymbolOfReference(ref) {
|
|
32047
32026
|
const target = this.templateData.boundTarget.getReferenceTarget(ref);
|
|
32048
|
-
let node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: ref.sourceSpan, filter:
|
|
32027
|
+
let node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: ref.sourceSpan, filter: import_typescript84.default.isVariableDeclaration });
|
|
32049
32028
|
if (node === null || target === null || node.initializer === void 0) {
|
|
32050
32029
|
return null;
|
|
32051
32030
|
}
|
|
32052
|
-
const originalDeclaration =
|
|
32031
|
+
const originalDeclaration = import_typescript84.default.isParenthesizedExpression(node.initializer) && import_typescript84.default.isAsExpression(node.initializer.expression) ? this.getTypeChecker().getSymbolAtLocation(node.name) : this.getTypeChecker().getSymbolAtLocation(node.initializer);
|
|
32053
32032
|
if (originalDeclaration === void 0 || originalDeclaration.valueDeclaration === void 0) {
|
|
32054
32033
|
return null;
|
|
32055
32034
|
}
|
|
@@ -32073,7 +32052,7 @@ var SymbolBuilder = class {
|
|
|
32073
32052
|
referenceVarLocation: referenceVarTcbLocation
|
|
32074
32053
|
};
|
|
32075
32054
|
} else {
|
|
32076
|
-
if (!
|
|
32055
|
+
if (!import_typescript84.default.isClassDeclaration(target.directive.ref.node)) {
|
|
32077
32056
|
return null;
|
|
32078
32057
|
}
|
|
32079
32058
|
return {
|
|
@@ -32088,7 +32067,7 @@ var SymbolBuilder = class {
|
|
|
32088
32067
|
}
|
|
32089
32068
|
}
|
|
32090
32069
|
getSymbolOfPipe(expression) {
|
|
32091
|
-
const methodAccess = findFirstMatchingNode(this.typeCheckBlock, { withSpan: expression.nameSpan, filter:
|
|
32070
|
+
const methodAccess = findFirstMatchingNode(this.typeCheckBlock, { withSpan: expression.nameSpan, filter: import_typescript84.default.isPropertyAccessExpression });
|
|
32092
32071
|
if (methodAccess === null) {
|
|
32093
32072
|
return null;
|
|
32094
32073
|
}
|
|
@@ -32127,7 +32106,7 @@ var SymbolBuilder = class {
|
|
|
32127
32106
|
}
|
|
32128
32107
|
let node = null;
|
|
32129
32108
|
if (expression instanceof PropertyRead) {
|
|
32130
|
-
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter:
|
|
32109
|
+
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter: import_typescript84.default.isPropertyAccessExpression });
|
|
32131
32110
|
}
|
|
32132
32111
|
if (node === null) {
|
|
32133
32112
|
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter: anyNodeFilter });
|
|
@@ -32135,10 +32114,10 @@ var SymbolBuilder = class {
|
|
|
32135
32114
|
if (node === null) {
|
|
32136
32115
|
return null;
|
|
32137
32116
|
}
|
|
32138
|
-
while (
|
|
32117
|
+
while (import_typescript84.default.isParenthesizedExpression(node)) {
|
|
32139
32118
|
node = node.expression;
|
|
32140
32119
|
}
|
|
32141
|
-
if (expression instanceof SafePropertyRead &&
|
|
32120
|
+
if (expression instanceof SafePropertyRead && import_typescript84.default.isConditionalExpression(node)) {
|
|
32142
32121
|
const whenTrueSymbol = this.getSymbolOfTsNode(node.whenTrue);
|
|
32143
32122
|
if (whenTrueSymbol === null) {
|
|
32144
32123
|
return null;
|
|
@@ -32154,13 +32133,13 @@ var SymbolBuilder = class {
|
|
|
32154
32133
|
}
|
|
32155
32134
|
getSymbolOfTsNode(node) {
|
|
32156
32135
|
var _a;
|
|
32157
|
-
while (
|
|
32136
|
+
while (import_typescript84.default.isParenthesizedExpression(node)) {
|
|
32158
32137
|
node = node.expression;
|
|
32159
32138
|
}
|
|
32160
32139
|
let tsSymbol;
|
|
32161
|
-
if (
|
|
32140
|
+
if (import_typescript84.default.isPropertyAccessExpression(node)) {
|
|
32162
32141
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.name);
|
|
32163
|
-
} else if (
|
|
32142
|
+
} else if (import_typescript84.default.isElementAccessExpression(node)) {
|
|
32164
32143
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.argumentExpression);
|
|
32165
32144
|
} else {
|
|
32166
32145
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node);
|
|
@@ -32178,13 +32157,13 @@ var SymbolBuilder = class {
|
|
|
32178
32157
|
};
|
|
32179
32158
|
}
|
|
32180
32159
|
getTcbPositionForNode(node) {
|
|
32181
|
-
if (
|
|
32160
|
+
if (import_typescript84.default.isTypeReferenceNode(node)) {
|
|
32182
32161
|
return this.getTcbPositionForNode(node.typeName);
|
|
32183
|
-
} else if (
|
|
32162
|
+
} else if (import_typescript84.default.isQualifiedName(node)) {
|
|
32184
32163
|
return node.right.getStart();
|
|
32185
|
-
} else if (
|
|
32164
|
+
} else if (import_typescript84.default.isPropertyAccessExpression(node)) {
|
|
32186
32165
|
return node.name.getStart();
|
|
32187
|
-
} else if (
|
|
32166
|
+
} else if (import_typescript84.default.isElementAccessExpression(node)) {
|
|
32188
32167
|
return node.argumentExpression.getStart();
|
|
32189
32168
|
} else {
|
|
32190
32169
|
return node.getStart();
|
|
@@ -33069,7 +33048,7 @@ var factory3 = {
|
|
|
33069
33048
|
};
|
|
33070
33049
|
|
|
33071
33050
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/nullish_coalescing_not_nullable/index.mjs
|
|
33072
|
-
var
|
|
33051
|
+
var import_typescript87 = __toESM(require("typescript"), 1);
|
|
33073
33052
|
var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
33074
33053
|
constructor() {
|
|
33075
33054
|
super(...arguments);
|
|
@@ -33083,7 +33062,7 @@ var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
33083
33062
|
return [];
|
|
33084
33063
|
}
|
|
33085
33064
|
const typeLeft = symbolLeft.tsType;
|
|
33086
|
-
if (typeLeft.flags & (
|
|
33065
|
+
if (typeLeft.flags & (import_typescript87.default.TypeFlags.Any | import_typescript87.default.TypeFlags.Unknown)) {
|
|
33087
33066
|
return [];
|
|
33088
33067
|
}
|
|
33089
33068
|
if (typeLeft.getNonNullableType() !== typeLeft)
|
|
@@ -33113,7 +33092,7 @@ var factory4 = {
|
|
|
33113
33092
|
};
|
|
33114
33093
|
|
|
33115
33094
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/optional_chain_not_nullable/index.mjs
|
|
33116
|
-
var
|
|
33095
|
+
var import_typescript88 = __toESM(require("typescript"), 1);
|
|
33117
33096
|
var OptionalChainNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
33118
33097
|
constructor() {
|
|
33119
33098
|
super(...arguments);
|
|
@@ -33127,7 +33106,7 @@ var OptionalChainNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
33127
33106
|
return [];
|
|
33128
33107
|
}
|
|
33129
33108
|
const typeLeft = symbolLeft.tsType;
|
|
33130
|
-
if (typeLeft.flags & (
|
|
33109
|
+
if (typeLeft.flags & (import_typescript88.default.TypeFlags.Any | import_typescript88.default.TypeFlags.Unknown)) {
|
|
33131
33110
|
return [];
|
|
33132
33111
|
}
|
|
33133
33112
|
if (typeLeft.getNonNullableType() !== typeLeft)
|
|
@@ -33219,7 +33198,7 @@ var factory7 = {
|
|
|
33219
33198
|
};
|
|
33220
33199
|
|
|
33221
33200
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/src/extended_template_checker.mjs
|
|
33222
|
-
var
|
|
33201
|
+
var import_typescript89 = __toESM(require("typescript"), 1);
|
|
33223
33202
|
|
|
33224
33203
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/api/src/public_options.mjs
|
|
33225
33204
|
var DiagnosticCategoryLabel;
|
|
@@ -33267,9 +33246,9 @@ var ExtendedTemplateCheckerImpl = class {
|
|
|
33267
33246
|
function diagnosticLabelToCategory(label) {
|
|
33268
33247
|
switch (label) {
|
|
33269
33248
|
case DiagnosticCategoryLabel.Warning:
|
|
33270
|
-
return
|
|
33249
|
+
return import_typescript89.default.DiagnosticCategory.Warning;
|
|
33271
33250
|
case DiagnosticCategoryLabel.Error:
|
|
33272
|
-
return
|
|
33251
|
+
return import_typescript89.default.DiagnosticCategory.Error;
|
|
33273
33252
|
case DiagnosticCategoryLabel.Suppress:
|
|
33274
33253
|
return null;
|
|
33275
33254
|
default:
|
|
@@ -33365,7 +33344,7 @@ var NgCompiler = class {
|
|
|
33365
33344
|
this.currentProgram = inputProgram;
|
|
33366
33345
|
this.closureCompilerEnabled = !!this.options.annotateForClosureCompiler;
|
|
33367
33346
|
this.entryPoint = adapter.entryPoint !== null ? getSourceFileOrNull(inputProgram, adapter.entryPoint) : null;
|
|
33368
|
-
const moduleResolutionCache =
|
|
33347
|
+
const moduleResolutionCache = import_typescript90.default.createModuleResolutionCache(
|
|
33369
33348
|
this.adapter.getCurrentDirectory(),
|
|
33370
33349
|
this.adapter.getCanonicalFileName.bind(this.adapter)
|
|
33371
33350
|
);
|
|
@@ -33412,7 +33391,7 @@ var NgCompiler = class {
|
|
|
33412
33391
|
}
|
|
33413
33392
|
for (const clazz of classesToUpdate) {
|
|
33414
33393
|
this.compilation.traitCompiler.updateResources(clazz);
|
|
33415
|
-
if (!
|
|
33394
|
+
if (!import_typescript90.default.isClassDeclaration(clazz)) {
|
|
33416
33395
|
continue;
|
|
33417
33396
|
}
|
|
33418
33397
|
this.compilation.templateTypeChecker.invalidateClass(clazz);
|
|
@@ -33824,18 +33803,18 @@ function isAngularCorePackage(program) {
|
|
|
33824
33803
|
return false;
|
|
33825
33804
|
}
|
|
33826
33805
|
return r3Symbols.statements.some((stmt) => {
|
|
33827
|
-
if (!
|
|
33806
|
+
if (!import_typescript90.default.isVariableStatement(stmt)) {
|
|
33828
33807
|
return false;
|
|
33829
33808
|
}
|
|
33830
|
-
const modifiers =
|
|
33831
|
-
if (modifiers === void 0 || !modifiers.some((mod) => mod.kind ===
|
|
33809
|
+
const modifiers = import_typescript90.default.getModifiers(stmt);
|
|
33810
|
+
if (modifiers === void 0 || !modifiers.some((mod) => mod.kind === import_typescript90.default.SyntaxKind.ExportKeyword)) {
|
|
33832
33811
|
return false;
|
|
33833
33812
|
}
|
|
33834
33813
|
return stmt.declarationList.declarations.some((decl) => {
|
|
33835
|
-
if (!
|
|
33814
|
+
if (!import_typescript90.default.isIdentifier(decl.name) || decl.name.text !== "ITS_JUST_ANGULAR") {
|
|
33836
33815
|
return false;
|
|
33837
33816
|
}
|
|
33838
|
-
if (decl.initializer === void 0 || decl.initializer.kind !==
|
|
33817
|
+
if (decl.initializer === void 0 || decl.initializer.kind !== import_typescript90.default.SyntaxKind.TrueKeyword) {
|
|
33839
33818
|
return false;
|
|
33840
33819
|
}
|
|
33841
33820
|
return true;
|
|
@@ -33849,7 +33828,7 @@ function* verifyCompatibleTypeCheckOptions(options) {
|
|
|
33849
33828
|
var _a, _b, _c;
|
|
33850
33829
|
if (options.fullTemplateTypeCheck === false && options.strictTemplates === true) {
|
|
33851
33830
|
yield makeConfigDiagnostic({
|
|
33852
|
-
category:
|
|
33831
|
+
category: import_typescript90.default.DiagnosticCategory.Error,
|
|
33853
33832
|
code: ErrorCode.CONFIG_STRICT_TEMPLATES_IMPLIES_FULL_TEMPLATE_TYPECHECK,
|
|
33854
33833
|
messageText: `
|
|
33855
33834
|
Angular compiler option "strictTemplates" is enabled, however "fullTemplateTypeCheck" is disabled.
|
|
@@ -33868,7 +33847,7 @@ https://angular.io/guide/template-typecheck
|
|
|
33868
33847
|
}
|
|
33869
33848
|
if (options.extendedDiagnostics && options.strictTemplates === false) {
|
|
33870
33849
|
yield makeConfigDiagnostic({
|
|
33871
|
-
category:
|
|
33850
|
+
category: import_typescript90.default.DiagnosticCategory.Error,
|
|
33872
33851
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_IMPLIES_STRICT_TEMPLATES,
|
|
33873
33852
|
messageText: `
|
|
33874
33853
|
Angular compiler option "extendedDiagnostics" is configured, however "strictTemplates" is disabled.
|
|
@@ -33885,7 +33864,7 @@ One of the following actions is required:
|
|
|
33885
33864
|
const defaultCategory = (_a = options.extendedDiagnostics) == null ? void 0 : _a.defaultCategory;
|
|
33886
33865
|
if (defaultCategory && !allowedCategoryLabels.includes(defaultCategory)) {
|
|
33887
33866
|
yield makeConfigDiagnostic({
|
|
33888
|
-
category:
|
|
33867
|
+
category: import_typescript90.default.DiagnosticCategory.Error,
|
|
33889
33868
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
33890
33869
|
messageText: `
|
|
33891
33870
|
Angular compiler option "extendedDiagnostics.defaultCategory" has an unknown diagnostic category: "${defaultCategory}".
|
|
@@ -33899,7 +33878,7 @@ ${allowedCategoryLabels.join("\n")}
|
|
|
33899
33878
|
for (const [checkName, category] of Object.entries((_c = (_b = options.extendedDiagnostics) == null ? void 0 : _b.checks) != null ? _c : {})) {
|
|
33900
33879
|
if (!allExtendedDiagnosticNames.includes(checkName)) {
|
|
33901
33880
|
yield makeConfigDiagnostic({
|
|
33902
|
-
category:
|
|
33881
|
+
category: import_typescript90.default.DiagnosticCategory.Error,
|
|
33903
33882
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CHECK,
|
|
33904
33883
|
messageText: `
|
|
33905
33884
|
Angular compiler option "extendedDiagnostics.checks" has an unknown check: "${checkName}".
|
|
@@ -33911,7 +33890,7 @@ ${allExtendedDiagnosticNames.join("\n")}
|
|
|
33911
33890
|
}
|
|
33912
33891
|
if (!allowedCategoryLabels.includes(category)) {
|
|
33913
33892
|
yield makeConfigDiagnostic({
|
|
33914
|
-
category:
|
|
33893
|
+
category: import_typescript90.default.DiagnosticCategory.Error,
|
|
33915
33894
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
33916
33895
|
messageText: `
|
|
33917
33896
|
Angular compiler option "extendedDiagnostics.checks['${checkName}']" has an unknown diagnostic category: "${category}".
|
|
@@ -33941,7 +33920,7 @@ var ReferenceGraphAdapter = class {
|
|
|
33941
33920
|
for (const { node } of references) {
|
|
33942
33921
|
let sourceFile = node.getSourceFile();
|
|
33943
33922
|
if (sourceFile === void 0) {
|
|
33944
|
-
sourceFile =
|
|
33923
|
+
sourceFile = import_typescript90.default.getOriginalNode(node).getSourceFile();
|
|
33945
33924
|
}
|
|
33946
33925
|
if (sourceFile === void 0 || !isDtsPath(sourceFile.fileName)) {
|
|
33947
33926
|
this.graph.add(source, node);
|
|
@@ -33980,7 +33959,7 @@ function versionMapFromProgram(program, driver) {
|
|
|
33980
33959
|
}
|
|
33981
33960
|
|
|
33982
33961
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/host.mjs
|
|
33983
|
-
var
|
|
33962
|
+
var import_typescript92 = __toESM(require("typescript"), 1);
|
|
33984
33963
|
var DelegatingCompilerHost2 = class {
|
|
33985
33964
|
constructor(delegate) {
|
|
33986
33965
|
this.delegate = delegate;
|
|
@@ -34011,6 +33990,8 @@ var DelegatingCompilerHost2 = class {
|
|
|
34011
33990
|
this.writeFile = this.delegateMethod("writeFile");
|
|
34012
33991
|
this.getModuleResolutionCache = this.delegateMethod("getModuleResolutionCache");
|
|
34013
33992
|
this.hasInvalidatedResolutions = this.delegateMethod("hasInvalidatedResolutions");
|
|
33993
|
+
this.resolveModuleNameLiterals = this.delegateMethod("resolveModuleNameLiterals");
|
|
33994
|
+
this.resolveTypeReferenceDirectiveReferences = this.delegateMethod("resolveTypeReferenceDirectiveReferences");
|
|
34014
33995
|
}
|
|
34015
33996
|
delegateMethod(name) {
|
|
34016
33997
|
return this.delegate[name] !== void 0 ? this.delegate[name].bind(this.delegate) : void 0;
|
|
@@ -34057,7 +34038,7 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
34057
34038
|
entryPoint = findFlatIndexEntryPoint(normalizedTsInputFiles);
|
|
34058
34039
|
if (entryPoint === null) {
|
|
34059
34040
|
diagnostics.push({
|
|
34060
|
-
category:
|
|
34041
|
+
category: import_typescript92.default.DiagnosticCategory.Error,
|
|
34061
34042
|
code: ngErrorCode(ErrorCode.CONFIG_FLAT_MODULE_NO_INDEX),
|
|
34062
34043
|
file: void 0,
|
|
34063
34044
|
start: void 0,
|
|
@@ -34100,10 +34081,10 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
34100
34081
|
return this.fileNameToModuleName !== void 0 ? this : null;
|
|
34101
34082
|
}
|
|
34102
34083
|
createCachedResolveModuleNamesFunction() {
|
|
34103
|
-
const moduleResolutionCache =
|
|
34084
|
+
const moduleResolutionCache = import_typescript92.default.createModuleResolutionCache(this.getCurrentDirectory(), this.getCanonicalFileName.bind(this));
|
|
34104
34085
|
return (moduleNames, containingFile, reusedNames, redirectedReference, options) => {
|
|
34105
34086
|
return moduleNames.map((moduleName) => {
|
|
34106
|
-
const module3 =
|
|
34087
|
+
const module3 = import_typescript92.default.resolveModuleName(moduleName, containingFile, options, this, moduleResolutionCache, redirectedReference);
|
|
34107
34088
|
return module3.resolvedModule;
|
|
34108
34089
|
});
|
|
34109
34090
|
};
|
|
@@ -34124,7 +34105,7 @@ var NgtscProgram = class {
|
|
|
34124
34105
|
if (reuseProgram !== void 0) {
|
|
34125
34106
|
retagAllTsFiles(reuseProgram);
|
|
34126
34107
|
}
|
|
34127
|
-
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () =>
|
|
34108
|
+
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () => import_typescript94.default.createProgram(this.host.inputFiles, options, this.host, reuseProgram));
|
|
34128
34109
|
perfRecorder.phase(PerfPhase.Unaccounted);
|
|
34129
34110
|
perfRecorder.memory(PerfCheckpoint.TypeScriptProgramCreate);
|
|
34130
34111
|
this.host.postProgramCreationCleanup();
|
|
@@ -34334,13 +34315,13 @@ function createProgram({ rootNames, options, host, oldProgram }) {
|
|
|
34334
34315
|
}
|
|
34335
34316
|
|
|
34336
34317
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/perform_compile.mjs
|
|
34337
|
-
var
|
|
34318
|
+
var import_typescript96 = __toESM(require("typescript"), 1);
|
|
34338
34319
|
|
|
34339
34320
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/transformers/util.mjs
|
|
34340
|
-
var
|
|
34321
|
+
var import_typescript95 = __toESM(require("typescript"), 1);
|
|
34341
34322
|
|
|
34342
34323
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/transformers/downlevel_decorators_transform/downlevel_decorators_transform.mjs
|
|
34343
|
-
var
|
|
34324
|
+
var import_typescript97 = __toESM(require("typescript"), 1);
|
|
34344
34325
|
|
|
34345
34326
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/private/tooling.mjs
|
|
34346
34327
|
var GLOBAL_DEFS_FOR_TERSER = {
|
|
@@ -34377,332 +34358,118 @@ var import_fs2 = require("fs");
|
|
|
34377
34358
|
var import_path8 = require("path");
|
|
34378
34359
|
var import_typescript110 = __toESM(require("typescript"), 1);
|
|
34379
34360
|
|
|
34380
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/
|
|
34381
|
-
var
|
|
34382
|
-
|
|
34383
|
-
|
|
34384
|
-
|
|
34385
|
-
|
|
34386
|
-
|
|
34387
|
-
|
|
34388
|
-
|
|
34389
|
-
|
|
34390
|
-
|
|
34391
|
-
|
|
34392
|
-
|
|
34393
|
-
|
|
34394
|
-
|
|
34395
|
-
|
|
34396
|
-
|
|
34397
|
-
|
|
34398
|
-
|
|
34399
|
-
|
|
34400
|
-
|
|
34361
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/change_tracker.mjs
|
|
34362
|
+
var import_typescript99 = __toESM(require("typescript"), 1);
|
|
34363
|
+
|
|
34364
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/import_manager.mjs
|
|
34365
|
+
var import_path4 = require("path");
|
|
34366
|
+
var import_typescript98 = __toESM(require("typescript"), 1);
|
|
34367
|
+
var ImportManager2 = class {
|
|
34368
|
+
constructor(getUpdateRecorder, printer) {
|
|
34369
|
+
this.getUpdateRecorder = getUpdateRecorder;
|
|
34370
|
+
this.printer = printer;
|
|
34371
|
+
this.updatedImports = /* @__PURE__ */ new Map();
|
|
34372
|
+
this.usedIdentifierNames = /* @__PURE__ */ new Map();
|
|
34373
|
+
this.newImports = /* @__PURE__ */ new Map();
|
|
34374
|
+
this.quoteStyles = {};
|
|
34375
|
+
this.importCache = [];
|
|
34376
|
+
}
|
|
34377
|
+
addImportToSourceFile(sourceFile, symbolName, moduleName, alias = null, typeImport = false) {
|
|
34378
|
+
const sourceDir = (0, import_path4.dirname)(sourceFile.fileName);
|
|
34379
|
+
let importStartIndex = 0;
|
|
34380
|
+
let existingImport = null;
|
|
34381
|
+
const cachedImport = this.importCache.find((c) => c.sourceFile === sourceFile && c.symbolName === symbolName && c.moduleName === moduleName && c.alias === alias);
|
|
34382
|
+
if (cachedImport) {
|
|
34383
|
+
return cachedImport.identifier;
|
|
34384
|
+
}
|
|
34385
|
+
for (let i = sourceFile.statements.length - 1; i >= 0; i--) {
|
|
34386
|
+
const statement = sourceFile.statements[i];
|
|
34387
|
+
if (!import_typescript98.default.isImportDeclaration(statement) || !import_typescript98.default.isStringLiteral(statement.moduleSpecifier) || !statement.importClause) {
|
|
34388
|
+
continue;
|
|
34389
|
+
}
|
|
34390
|
+
if (importStartIndex === 0) {
|
|
34391
|
+
importStartIndex = this._getEndPositionOfNode(statement);
|
|
34392
|
+
}
|
|
34393
|
+
const moduleSpecifier = statement.moduleSpecifier.text;
|
|
34394
|
+
if (moduleSpecifier.startsWith(".") && (0, import_path4.resolve)(sourceDir, moduleSpecifier) !== (0, import_path4.resolve)(sourceDir, moduleName) || moduleSpecifier !== moduleName) {
|
|
34395
|
+
continue;
|
|
34396
|
+
}
|
|
34397
|
+
if (statement.importClause.namedBindings) {
|
|
34398
|
+
const namedBindings = statement.importClause.namedBindings;
|
|
34399
|
+
if (import_typescript98.default.isNamespaceImport(namedBindings) && !typeImport) {
|
|
34400
|
+
return import_typescript98.default.factory.createPropertyAccessExpression(import_typescript98.default.factory.createIdentifier(namedBindings.name.text), import_typescript98.default.factory.createIdentifier(alias || symbolName || "default"));
|
|
34401
|
+
} else if (import_typescript98.default.isNamedImports(namedBindings) && symbolName) {
|
|
34402
|
+
const existingElement = namedBindings.elements.find((e) => {
|
|
34403
|
+
if (alias) {
|
|
34404
|
+
return e.propertyName && e.name.text === alias && e.propertyName.text === symbolName;
|
|
34405
|
+
}
|
|
34406
|
+
return e.propertyName ? e.propertyName.text === symbolName : e.name.text === symbolName;
|
|
34407
|
+
});
|
|
34408
|
+
if (existingElement) {
|
|
34409
|
+
return import_typescript98.default.factory.createIdentifier(existingElement.name.text);
|
|
34401
34410
|
}
|
|
34411
|
+
existingImport = statement;
|
|
34402
34412
|
}
|
|
34413
|
+
} else if (statement.importClause.name && !symbolName) {
|
|
34414
|
+
return import_typescript98.default.factory.createIdentifier(statement.importClause.name.text);
|
|
34403
34415
|
}
|
|
34404
34416
|
}
|
|
34405
|
-
|
|
34406
|
-
|
|
34407
|
-
|
|
34408
|
-
|
|
34409
|
-
|
|
34410
|
-
}
|
|
34411
|
-
function* allTargetOptions(target) {
|
|
34412
|
-
if (target.options) {
|
|
34413
|
-
yield [void 0, target.options];
|
|
34414
|
-
}
|
|
34415
|
-
if (!target.configurations) {
|
|
34416
|
-
return;
|
|
34417
|
-
}
|
|
34418
|
-
for (const [name, options] of Object.entries(target.configurations)) {
|
|
34419
|
-
if (options) {
|
|
34420
|
-
yield [name, options];
|
|
34417
|
+
if (existingImport) {
|
|
34418
|
+
const { propertyName, name } = this._getImportParts(sourceFile, symbolName, alias);
|
|
34419
|
+
this.updatedImports.set(existingImport, (this.updatedImports.get(existingImport) || []).concat({ propertyName, importName: name }));
|
|
34420
|
+
this.importCache.push({ sourceFile, moduleName, symbolName, alias, identifier: name });
|
|
34421
|
+
return name;
|
|
34421
34422
|
}
|
|
34422
|
-
|
|
34423
|
-
|
|
34424
|
-
|
|
34425
|
-
|
|
34426
|
-
|
|
34427
|
-
|
|
34428
|
-
const data = tree.read(path3);
|
|
34429
|
-
if (!data) {
|
|
34430
|
-
throw new Error("File not found.");
|
|
34431
|
-
}
|
|
34432
|
-
return import_core13.virtualFs.fileBufferToString(data);
|
|
34433
|
-
});
|
|
34434
|
-
},
|
|
34435
|
-
writeFile(path3, data) {
|
|
34436
|
-
return __async(this, null, function* () {
|
|
34437
|
-
return tree.overwrite(path3, data);
|
|
34423
|
+
let identifier = null;
|
|
34424
|
+
if (!this.newImports.has(sourceFile)) {
|
|
34425
|
+
this.newImports.set(sourceFile, {
|
|
34426
|
+
importStartIndex,
|
|
34427
|
+
defaultImports: /* @__PURE__ */ new Map(),
|
|
34428
|
+
namedImports: /* @__PURE__ */ new Map()
|
|
34438
34429
|
});
|
|
34439
|
-
}
|
|
34440
|
-
|
|
34441
|
-
|
|
34442
|
-
|
|
34430
|
+
}
|
|
34431
|
+
if (symbolName) {
|
|
34432
|
+
const { propertyName, name } = this._getImportParts(sourceFile, symbolName, alias);
|
|
34433
|
+
const importMap = this.newImports.get(sourceFile).namedImports;
|
|
34434
|
+
identifier = name;
|
|
34435
|
+
if (!importMap.has(moduleName)) {
|
|
34436
|
+
importMap.set(moduleName, []);
|
|
34437
|
+
}
|
|
34438
|
+
importMap.get(moduleName).push(import_typescript98.default.factory.createImportSpecifier(false, propertyName, name));
|
|
34439
|
+
} else {
|
|
34440
|
+
const importMap = this.newImports.get(sourceFile).defaultImports;
|
|
34441
|
+
identifier = this._getUniqueIdentifier(sourceFile, "defaultExport");
|
|
34442
|
+
importMap.set(moduleName, identifier);
|
|
34443
|
+
}
|
|
34444
|
+
this.importCache.push({ sourceFile, symbolName, moduleName, alias, identifier });
|
|
34445
|
+
return identifier;
|
|
34446
|
+
}
|
|
34447
|
+
recordChanges() {
|
|
34448
|
+
this.updatedImports.forEach((expressions, importDecl) => {
|
|
34449
|
+
const sourceFile = importDecl.getSourceFile();
|
|
34450
|
+
const recorder = this.getUpdateRecorder(sourceFile);
|
|
34451
|
+
const namedBindings = importDecl.importClause.namedBindings;
|
|
34452
|
+
const newNamedBindings = import_typescript98.default.factory.updateNamedImports(namedBindings, namedBindings.elements.concat(expressions.map(({ propertyName, importName }) => import_typescript98.default.factory.createImportSpecifier(false, propertyName, importName))));
|
|
34453
|
+
const newNamedBindingsText = this.printer.printNode(import_typescript98.default.EmitHint.Unspecified, newNamedBindings, sourceFile);
|
|
34454
|
+
recorder.updateExistingImport(namedBindings, newNamedBindingsText);
|
|
34455
|
+
});
|
|
34456
|
+
this.newImports.forEach(({ importStartIndex, defaultImports, namedImports }, sourceFile) => {
|
|
34457
|
+
const recorder = this.getUpdateRecorder(sourceFile);
|
|
34458
|
+
const useSingleQuotes = this._getQuoteStyle(sourceFile) === 0;
|
|
34459
|
+
defaultImports.forEach((identifier, moduleName) => {
|
|
34460
|
+
const newImport = import_typescript98.default.factory.createImportDeclaration(void 0, import_typescript98.default.factory.createImportClause(false, identifier, void 0), import_typescript98.default.factory.createStringLiteral(moduleName, useSingleQuotes));
|
|
34461
|
+
recorder.addNewImport(importStartIndex, this._getNewImportText(importStartIndex, newImport, sourceFile));
|
|
34443
34462
|
});
|
|
34444
|
-
|
|
34445
|
-
|
|
34446
|
-
|
|
34447
|
-
return tree.exists(path3);
|
|
34463
|
+
namedImports.forEach((specifiers, moduleName) => {
|
|
34464
|
+
const newImport = import_typescript98.default.factory.createImportDeclaration(void 0, import_typescript98.default.factory.createImportClause(false, void 0, import_typescript98.default.factory.createNamedImports(specifiers)), import_typescript98.default.factory.createStringLiteral(moduleName, useSingleQuotes));
|
|
34465
|
+
recorder.addNewImport(importStartIndex, this._getNewImportText(importStartIndex, newImport, sourceFile));
|
|
34448
34466
|
});
|
|
34449
|
-
}
|
|
34450
|
-
}
|
|
34451
|
-
|
|
34452
|
-
|
|
34453
|
-
|
|
34454
|
-
|
|
34455
|
-
const { workspace } = yield import_core13.workspaces.readWorkspace("/", host);
|
|
34456
|
-
return workspace;
|
|
34457
|
-
});
|
|
34458
|
-
}
|
|
34459
|
-
|
|
34460
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/compiler_host.mjs
|
|
34461
|
-
var import_path4 = require("path");
|
|
34462
|
-
var import_typescript100 = __toESM(require("typescript"), 1);
|
|
34463
|
-
|
|
34464
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/parse_tsconfig.mjs
|
|
34465
|
-
var path2 = __toESM(require("path"), 1);
|
|
34466
|
-
var import_typescript99 = __toESM(require("typescript"), 1);
|
|
34467
|
-
function parseTsconfigFile(tsconfigPath, basePath) {
|
|
34468
|
-
const { config } = import_typescript99.default.readConfigFile(tsconfigPath, import_typescript99.default.sys.readFile);
|
|
34469
|
-
const parseConfigHost = {
|
|
34470
|
-
useCaseSensitiveFileNames: import_typescript99.default.sys.useCaseSensitiveFileNames,
|
|
34471
|
-
fileExists: import_typescript99.default.sys.fileExists,
|
|
34472
|
-
readDirectory: import_typescript99.default.sys.readDirectory,
|
|
34473
|
-
readFile: import_typescript99.default.sys.readFile
|
|
34474
|
-
};
|
|
34475
|
-
if (!path2.isAbsolute(basePath)) {
|
|
34476
|
-
throw Error("Unexpected relative base path has been specified.");
|
|
34477
|
-
}
|
|
34478
|
-
return import_typescript99.default.parseJsonConfigFileContent(config, parseConfigHost, basePath, {});
|
|
34479
|
-
}
|
|
34480
|
-
|
|
34481
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/compiler_host.mjs
|
|
34482
|
-
function createProgramOptions(tree, tsconfigPath, basePath, fakeFileRead, additionalFiles, optionOverrides) {
|
|
34483
|
-
tsconfigPath = (0, import_path4.resolve)(basePath, tsconfigPath);
|
|
34484
|
-
const parsed = parseTsconfigFile(tsconfigPath, (0, import_path4.dirname)(tsconfigPath));
|
|
34485
|
-
const options = optionOverrides ? __spreadValues(__spreadValues({}, parsed.options), optionOverrides) : parsed.options;
|
|
34486
|
-
const host = createMigrationCompilerHost(tree, options, basePath, fakeFileRead);
|
|
34487
|
-
return { rootNames: parsed.fileNames.concat(additionalFiles || []), options, host };
|
|
34488
|
-
}
|
|
34489
|
-
function createMigrationCompilerHost(tree, options, basePath, fakeRead) {
|
|
34490
|
-
const host = import_typescript100.default.createCompilerHost(options, true);
|
|
34491
|
-
const defaultReadFile = host.readFile;
|
|
34492
|
-
host.readFile = (fileName) => {
|
|
34493
|
-
var _a;
|
|
34494
|
-
const treeRelativePath = (0, import_path4.relative)(basePath, fileName);
|
|
34495
|
-
let result = fakeRead == null ? void 0 : fakeRead(treeRelativePath);
|
|
34496
|
-
if (typeof result !== "string") {
|
|
34497
|
-
result = treeRelativePath.startsWith("..") ? defaultReadFile.call(host, fileName) : (_a = tree.read(treeRelativePath)) == null ? void 0 : _a.toString();
|
|
34498
|
-
}
|
|
34499
|
-
return typeof result === "string" ? result.replace(/^\uFEFF/, "") : void 0;
|
|
34500
|
-
};
|
|
34501
|
-
return host;
|
|
34502
|
-
}
|
|
34503
|
-
function canMigrateFile(basePath, sourceFile, program) {
|
|
34504
|
-
if (sourceFile.fileName.endsWith(".ngtypecheck.ts") || sourceFile.isDeclarationFile || program.isSourceFileFromExternalLibrary(sourceFile)) {
|
|
34505
|
-
return false;
|
|
34506
|
-
}
|
|
34507
|
-
return !(0, import_path4.relative)(basePath, sourceFile.fileName).startsWith("..");
|
|
34508
|
-
}
|
|
34509
|
-
|
|
34510
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/standalone-migration/prune-modules.mjs
|
|
34511
|
-
var import_typescript106 = __toESM(require("typescript"), 1);
|
|
34512
|
-
|
|
34513
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/decorators.mjs
|
|
34514
|
-
var import_typescript102 = __toESM(require("typescript"), 1);
|
|
34515
|
-
|
|
34516
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/imports.mjs
|
|
34517
|
-
var import_typescript101 = __toESM(require("typescript"), 1);
|
|
34518
|
-
function getImportOfIdentifier(typeChecker, node) {
|
|
34519
|
-
const symbol = typeChecker.getSymbolAtLocation(node);
|
|
34520
|
-
if (!symbol || symbol.declarations === void 0 || !symbol.declarations.length) {
|
|
34521
|
-
return null;
|
|
34522
|
-
}
|
|
34523
|
-
const decl = symbol.declarations[0];
|
|
34524
|
-
if (!import_typescript101.default.isImportSpecifier(decl)) {
|
|
34525
|
-
return null;
|
|
34526
|
-
}
|
|
34527
|
-
const importDecl = decl.parent.parent.parent;
|
|
34528
|
-
if (!import_typescript101.default.isStringLiteral(importDecl.moduleSpecifier)) {
|
|
34529
|
-
return null;
|
|
34530
|
-
}
|
|
34531
|
-
return {
|
|
34532
|
-
name: decl.propertyName ? decl.propertyName.text : decl.name.text,
|
|
34533
|
-
importModule: importDecl.moduleSpecifier.text,
|
|
34534
|
-
node: importDecl
|
|
34535
|
-
};
|
|
34536
|
-
}
|
|
34537
|
-
function getImportSpecifier(sourceFile, moduleName, specifierName) {
|
|
34538
|
-
var _a;
|
|
34539
|
-
for (const node of sourceFile.statements) {
|
|
34540
|
-
if (import_typescript101.default.isImportDeclaration(node) && import_typescript101.default.isStringLiteral(node.moduleSpecifier)) {
|
|
34541
|
-
const isMatch = typeof moduleName === "string" ? node.moduleSpecifier.text === moduleName : moduleName.test(node.moduleSpecifier.text);
|
|
34542
|
-
const namedBindings = (_a = node.importClause) == null ? void 0 : _a.namedBindings;
|
|
34543
|
-
if (isMatch && namedBindings && import_typescript101.default.isNamedImports(namedBindings)) {
|
|
34544
|
-
const match = findImportSpecifier(namedBindings.elements, specifierName);
|
|
34545
|
-
if (match) {
|
|
34546
|
-
return match;
|
|
34547
|
-
}
|
|
34548
|
-
}
|
|
34549
|
-
}
|
|
34550
|
-
}
|
|
34551
|
-
return null;
|
|
34552
|
-
}
|
|
34553
|
-
function findImportSpecifier(nodes, specifierName) {
|
|
34554
|
-
return nodes.find((element) => {
|
|
34555
|
-
const { name, propertyName } = element;
|
|
34556
|
-
return propertyName ? propertyName.text === specifierName : name.text === specifierName;
|
|
34557
|
-
});
|
|
34558
|
-
}
|
|
34559
|
-
|
|
34560
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/decorators.mjs
|
|
34561
|
-
function getCallDecoratorImport(typeChecker, decorator) {
|
|
34562
|
-
if (!import_typescript102.default.isCallExpression(decorator.expression) || !import_typescript102.default.isIdentifier(decorator.expression.expression)) {
|
|
34563
|
-
return null;
|
|
34564
|
-
}
|
|
34565
|
-
const identifier = decorator.expression.expression;
|
|
34566
|
-
return getImportOfIdentifier(typeChecker, identifier);
|
|
34567
|
-
}
|
|
34568
|
-
|
|
34569
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/ng_decorators.mjs
|
|
34570
|
-
function getAngularDecorators(typeChecker, decorators) {
|
|
34571
|
-
return decorators.map((node) => ({ node, importData: getCallDecoratorImport(typeChecker, node) })).filter(({ importData }) => importData && importData.importModule.startsWith("@angular/")).map(({ node, importData }) => ({
|
|
34572
|
-
node,
|
|
34573
|
-
name: importData.name,
|
|
34574
|
-
moduleName: importData.importModule,
|
|
34575
|
-
importNode: importData.node
|
|
34576
|
-
}));
|
|
34577
|
-
}
|
|
34578
|
-
|
|
34579
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/nodes.mjs
|
|
34580
|
-
var import_typescript103 = __toESM(require("typescript"), 1);
|
|
34581
|
-
function closestNode(node, predicate) {
|
|
34582
|
-
let current = node.parent;
|
|
34583
|
-
while (current && !import_typescript103.default.isSourceFile(current)) {
|
|
34584
|
-
if (predicate(current)) {
|
|
34585
|
-
return current;
|
|
34586
|
-
}
|
|
34587
|
-
current = current.parent;
|
|
34588
|
-
}
|
|
34589
|
-
return null;
|
|
34590
|
-
}
|
|
34591
|
-
|
|
34592
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/standalone-migration/util.mjs
|
|
34593
|
-
var import_path6 = require("path");
|
|
34594
|
-
var import_typescript105 = __toESM(require("typescript"), 1);
|
|
34595
|
-
|
|
34596
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/import_manager.mjs
|
|
34597
|
-
var import_path5 = require("path");
|
|
34598
|
-
var import_typescript104 = __toESM(require("typescript"), 1);
|
|
34599
|
-
var IS_AFTER_TS_492 = isAfterVersion2(4, 9);
|
|
34600
|
-
var ImportManager2 = class {
|
|
34601
|
-
constructor(getUpdateRecorder, printer) {
|
|
34602
|
-
this.getUpdateRecorder = getUpdateRecorder;
|
|
34603
|
-
this.printer = printer;
|
|
34604
|
-
this.updatedImports = /* @__PURE__ */ new Map();
|
|
34605
|
-
this.usedIdentifierNames = /* @__PURE__ */ new Map();
|
|
34606
|
-
this.newImports = /* @__PURE__ */ new Map();
|
|
34607
|
-
this.quoteStyles = {};
|
|
34608
|
-
this.importCache = [];
|
|
34609
|
-
}
|
|
34610
|
-
addImportToSourceFile(sourceFile, symbolName, moduleName, alias = null, typeImport = false) {
|
|
34611
|
-
const sourceDir = (0, import_path5.dirname)(sourceFile.fileName);
|
|
34612
|
-
let importStartIndex = 0;
|
|
34613
|
-
let existingImport = null;
|
|
34614
|
-
const cachedImport = this.importCache.find((c) => c.sourceFile === sourceFile && c.symbolName === symbolName && c.moduleName === moduleName && c.alias === alias);
|
|
34615
|
-
if (cachedImport) {
|
|
34616
|
-
return cachedImport.identifier;
|
|
34617
|
-
}
|
|
34618
|
-
for (let i = sourceFile.statements.length - 1; i >= 0; i--) {
|
|
34619
|
-
const statement = sourceFile.statements[i];
|
|
34620
|
-
if (!import_typescript104.default.isImportDeclaration(statement) || !import_typescript104.default.isStringLiteral(statement.moduleSpecifier) || !statement.importClause) {
|
|
34621
|
-
continue;
|
|
34622
|
-
}
|
|
34623
|
-
if (importStartIndex === 0) {
|
|
34624
|
-
importStartIndex = this._getEndPositionOfNode(statement);
|
|
34625
|
-
}
|
|
34626
|
-
const moduleSpecifier = statement.moduleSpecifier.text;
|
|
34627
|
-
if (moduleSpecifier.startsWith(".") && (0, import_path5.resolve)(sourceDir, moduleSpecifier) !== (0, import_path5.resolve)(sourceDir, moduleName) || moduleSpecifier !== moduleName) {
|
|
34628
|
-
continue;
|
|
34629
|
-
}
|
|
34630
|
-
if (statement.importClause.namedBindings) {
|
|
34631
|
-
const namedBindings = statement.importClause.namedBindings;
|
|
34632
|
-
if (import_typescript104.default.isNamespaceImport(namedBindings) && !typeImport) {
|
|
34633
|
-
return import_typescript104.default.factory.createPropertyAccessExpression(import_typescript104.default.factory.createIdentifier(namedBindings.name.text), import_typescript104.default.factory.createIdentifier(alias || symbolName || "default"));
|
|
34634
|
-
} else if (import_typescript104.default.isNamedImports(namedBindings) && symbolName) {
|
|
34635
|
-
const existingElement = namedBindings.elements.find((e) => {
|
|
34636
|
-
if (alias) {
|
|
34637
|
-
return e.propertyName && e.name.text === alias && e.propertyName.text === symbolName;
|
|
34638
|
-
}
|
|
34639
|
-
return e.propertyName ? e.propertyName.text === symbolName : e.name.text === symbolName;
|
|
34640
|
-
});
|
|
34641
|
-
if (existingElement) {
|
|
34642
|
-
return import_typescript104.default.factory.createIdentifier(existingElement.name.text);
|
|
34643
|
-
}
|
|
34644
|
-
existingImport = statement;
|
|
34645
|
-
}
|
|
34646
|
-
} else if (statement.importClause.name && !symbolName) {
|
|
34647
|
-
return import_typescript104.default.factory.createIdentifier(statement.importClause.name.text);
|
|
34648
|
-
}
|
|
34649
|
-
}
|
|
34650
|
-
if (existingImport) {
|
|
34651
|
-
const { propertyName, name } = this._getImportParts(sourceFile, symbolName, alias);
|
|
34652
|
-
this.updatedImports.set(existingImport, (this.updatedImports.get(existingImport) || []).concat({ propertyName, importName: name }));
|
|
34653
|
-
this.importCache.push({ sourceFile, moduleName, symbolName, alias, identifier: name });
|
|
34654
|
-
return name;
|
|
34655
|
-
}
|
|
34656
|
-
let identifier = null;
|
|
34657
|
-
if (!this.newImports.has(sourceFile)) {
|
|
34658
|
-
this.newImports.set(sourceFile, {
|
|
34659
|
-
importStartIndex,
|
|
34660
|
-
defaultImports: /* @__PURE__ */ new Map(),
|
|
34661
|
-
namedImports: /* @__PURE__ */ new Map()
|
|
34662
|
-
});
|
|
34663
|
-
}
|
|
34664
|
-
if (symbolName) {
|
|
34665
|
-
const { propertyName, name } = this._getImportParts(sourceFile, symbolName, alias);
|
|
34666
|
-
const importMap = this.newImports.get(sourceFile).namedImports;
|
|
34667
|
-
identifier = name;
|
|
34668
|
-
if (!importMap.has(moduleName)) {
|
|
34669
|
-
importMap.set(moduleName, []);
|
|
34670
|
-
}
|
|
34671
|
-
importMap.get(moduleName).push(import_typescript104.default.factory.createImportSpecifier(false, propertyName, name));
|
|
34672
|
-
} else {
|
|
34673
|
-
const importMap = this.newImports.get(sourceFile).defaultImports;
|
|
34674
|
-
identifier = this._getUniqueIdentifier(sourceFile, "defaultExport");
|
|
34675
|
-
importMap.set(moduleName, identifier);
|
|
34676
|
-
}
|
|
34677
|
-
this.importCache.push({ sourceFile, symbolName, moduleName, alias, identifier });
|
|
34678
|
-
return identifier;
|
|
34679
|
-
}
|
|
34680
|
-
recordChanges() {
|
|
34681
|
-
this.updatedImports.forEach((expressions, importDecl) => {
|
|
34682
|
-
const sourceFile = importDecl.getSourceFile();
|
|
34683
|
-
const recorder = this.getUpdateRecorder(sourceFile);
|
|
34684
|
-
const namedBindings = importDecl.importClause.namedBindings;
|
|
34685
|
-
const newNamedBindings = import_typescript104.default.factory.updateNamedImports(namedBindings, namedBindings.elements.concat(expressions.map(({ propertyName, importName }) => import_typescript104.default.factory.createImportSpecifier(false, propertyName, importName))));
|
|
34686
|
-
const newNamedBindingsText = this.printer.printNode(import_typescript104.default.EmitHint.Unspecified, newNamedBindings, sourceFile);
|
|
34687
|
-
recorder.updateExistingImport(namedBindings, newNamedBindingsText);
|
|
34688
|
-
});
|
|
34689
|
-
this.newImports.forEach(({ importStartIndex, defaultImports, namedImports }, sourceFile) => {
|
|
34690
|
-
const recorder = this.getUpdateRecorder(sourceFile);
|
|
34691
|
-
const useSingleQuotes = this._getQuoteStyle(sourceFile) === 0;
|
|
34692
|
-
defaultImports.forEach((identifier, moduleName) => {
|
|
34693
|
-
const newImport = createImportDeclaration2(void 0, import_typescript104.default.factory.createImportClause(false, identifier, void 0), import_typescript104.default.factory.createStringLiteral(moduleName, useSingleQuotes));
|
|
34694
|
-
recorder.addNewImport(importStartIndex, this._getNewImportText(importStartIndex, newImport, sourceFile));
|
|
34695
|
-
});
|
|
34696
|
-
namedImports.forEach((specifiers, moduleName) => {
|
|
34697
|
-
const newImport = createImportDeclaration2(void 0, import_typescript104.default.factory.createImportClause(false, void 0, import_typescript104.default.factory.createNamedImports(specifiers)), import_typescript104.default.factory.createStringLiteral(moduleName, useSingleQuotes));
|
|
34698
|
-
recorder.addNewImport(importStartIndex, this._getNewImportText(importStartIndex, newImport, sourceFile));
|
|
34699
|
-
});
|
|
34700
|
-
});
|
|
34701
|
-
}
|
|
34702
|
-
_getUniqueIdentifier(sourceFile, baseName) {
|
|
34703
|
-
if (this.isUniqueIdentifierName(sourceFile, baseName)) {
|
|
34704
|
-
this._recordUsedIdentifier(sourceFile, baseName);
|
|
34705
|
-
return import_typescript104.default.factory.createIdentifier(baseName);
|
|
34467
|
+
});
|
|
34468
|
+
}
|
|
34469
|
+
_getUniqueIdentifier(sourceFile, baseName) {
|
|
34470
|
+
if (this.isUniqueIdentifierName(sourceFile, baseName)) {
|
|
34471
|
+
this._recordUsedIdentifier(sourceFile, baseName);
|
|
34472
|
+
return import_typescript98.default.factory.createIdentifier(baseName);
|
|
34706
34473
|
}
|
|
34707
34474
|
let name = null;
|
|
34708
34475
|
let counter = 1;
|
|
@@ -34710,7 +34477,7 @@ var ImportManager2 = class {
|
|
|
34710
34477
|
name = `${baseName}_${counter++}`;
|
|
34711
34478
|
} while (!this.isUniqueIdentifierName(sourceFile, name));
|
|
34712
34479
|
this._recordUsedIdentifier(sourceFile, name);
|
|
34713
|
-
return
|
|
34480
|
+
return import_typescript98.default.factory.createIdentifier(name);
|
|
34714
34481
|
}
|
|
34715
34482
|
isUniqueIdentifierName(sourceFile, name) {
|
|
34716
34483
|
if (this.usedIdentifierNames.has(sourceFile) && this.usedIdentifierNames.get(sourceFile).indexOf(name) !== -1) {
|
|
@@ -34719,7 +34486,7 @@ var ImportManager2 = class {
|
|
|
34719
34486
|
const nodeQueue = [sourceFile];
|
|
34720
34487
|
while (nodeQueue.length) {
|
|
34721
34488
|
const node = nodeQueue.shift();
|
|
34722
|
-
if (
|
|
34489
|
+
if (import_typescript98.default.isIdentifier(node) && node.text === name && (!import_typescript98.default.isImportSpecifier(node.parent) || node.parent.propertyName !== node)) {
|
|
34723
34490
|
return false;
|
|
34724
34491
|
}
|
|
34725
34492
|
nodeQueue.push(...node.getChildren());
|
|
@@ -34731,21 +34498,21 @@ var ImportManager2 = class {
|
|
|
34731
34498
|
}
|
|
34732
34499
|
_getEndPositionOfNode(node) {
|
|
34733
34500
|
const nodeEndPos = node.getEnd();
|
|
34734
|
-
const commentRanges =
|
|
34501
|
+
const commentRanges = import_typescript98.default.getTrailingCommentRanges(node.getSourceFile().text, nodeEndPos);
|
|
34735
34502
|
if (!commentRanges || !commentRanges.length) {
|
|
34736
34503
|
return nodeEndPos;
|
|
34737
34504
|
}
|
|
34738
34505
|
return commentRanges[commentRanges.length - 1].end;
|
|
34739
34506
|
}
|
|
34740
34507
|
_getNewImportText(importStartIndex, newImport, sourceFile) {
|
|
34741
|
-
const text = this.printer.printNode(
|
|
34508
|
+
const text = this.printer.printNode(import_typescript98.default.EmitHint.Unspecified, newImport, sourceFile);
|
|
34742
34509
|
return importStartIndex === 0 ? `${text}
|
|
34743
34510
|
` : `
|
|
34744
34511
|
${text}`;
|
|
34745
34512
|
}
|
|
34746
34513
|
_getImportParts(sourceFile, symbolName, alias) {
|
|
34747
|
-
const symbolIdentifier =
|
|
34748
|
-
const aliasIdentifier = alias ?
|
|
34514
|
+
const symbolIdentifier = import_typescript98.default.factory.createIdentifier(symbolName);
|
|
34515
|
+
const aliasIdentifier = alias ? import_typescript98.default.factory.createIdentifier(alias) : null;
|
|
34749
34516
|
const generatedUniqueIdentifier = this._getUniqueIdentifier(sourceFile, alias || symbolName);
|
|
34750
34517
|
const needsGeneratedUniqueName = generatedUniqueIdentifier.text !== (alias || symbolName);
|
|
34751
34518
|
let propertyName;
|
|
@@ -34765,7 +34532,7 @@ ${text}`;
|
|
|
34765
34532
|
if (!this.quoteStyles.hasOwnProperty(sourceFile.fileName)) {
|
|
34766
34533
|
let quoteStyle;
|
|
34767
34534
|
for (const statement of sourceFile.statements) {
|
|
34768
|
-
if (
|
|
34535
|
+
if (import_typescript98.default.isImportDeclaration(statement) && import_typescript98.default.isStringLiteralLike(statement.moduleSpecifier)) {
|
|
34769
34536
|
quoteStyle = statement.moduleSpecifier.getText().trim().startsWith('"') ? 1 : 0;
|
|
34770
34537
|
break;
|
|
34771
34538
|
}
|
|
@@ -34775,18 +34542,8 @@ ${text}`;
|
|
|
34775
34542
|
return this.quoteStyles[sourceFile.fileName];
|
|
34776
34543
|
}
|
|
34777
34544
|
};
|
|
34778
|
-
function createImportDeclaration2(modifiers, importClause, moduleSpecifier, assertClause) {
|
|
34779
|
-
return IS_AFTER_TS_492 ? import_typescript104.default.factory.createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause) : import_typescript104.default.factory.createImportDeclaration(void 0, modifiers, importClause, moduleSpecifier, assertClause);
|
|
34780
|
-
}
|
|
34781
|
-
function isAfterVersion2(targetMajor, targetMinor) {
|
|
34782
|
-
const [major, minor] = import_typescript104.default.versionMajorMinor.split(".").map((part) => parseInt(part));
|
|
34783
|
-
if (major < targetMajor) {
|
|
34784
|
-
return false;
|
|
34785
|
-
}
|
|
34786
|
-
return major === targetMajor ? minor >= targetMinor : true;
|
|
34787
|
-
}
|
|
34788
34545
|
|
|
34789
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/
|
|
34546
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/change_tracker.mjs
|
|
34790
34547
|
var ChangeTracker = class {
|
|
34791
34548
|
constructor(_printer, _importRemapper) {
|
|
34792
34549
|
this._printer = _printer;
|
|
@@ -34803,7 +34560,7 @@ var ChangeTracker = class {
|
|
|
34803
34560
|
replaceText(sourceFile, start, removeLength, text) {
|
|
34804
34561
|
this._trackChange(sourceFile, { start, removeLength, text });
|
|
34805
34562
|
}
|
|
34806
|
-
replaceNode(oldNode, newNode, emitHint =
|
|
34563
|
+
replaceNode(oldNode, newNode, emitHint = import_typescript99.default.EmitHint.Unspecified, sourceFileWhenPrinting) {
|
|
34807
34564
|
const sourceFile = oldNode.getSourceFile();
|
|
34808
34565
|
this.replaceText(sourceFile, oldNode.getStart(), oldNode.getWidth(), this._printer.printNode(emitHint, newNode, sourceFileWhenPrinting || sourceFile));
|
|
34809
34566
|
}
|
|
@@ -34812,7 +34569,7 @@ var ChangeTracker = class {
|
|
|
34812
34569
|
}
|
|
34813
34570
|
addImport(sourceFile, symbolName, moduleName, alias = null) {
|
|
34814
34571
|
if (this._importRemapper) {
|
|
34815
|
-
moduleName = this._importRemapper(moduleName);
|
|
34572
|
+
moduleName = this._importRemapper(moduleName, sourceFile.fileName);
|
|
34816
34573
|
}
|
|
34817
34574
|
moduleName = normalizePath(moduleName);
|
|
34818
34575
|
return this._importManager.addImportToSourceFile(sourceFile, symbolName, moduleName, alias);
|
|
@@ -34835,6 +34592,225 @@ var ChangeTracker = class {
|
|
|
34835
34592
|
}
|
|
34836
34593
|
}
|
|
34837
34594
|
};
|
|
34595
|
+
function normalizePath(path3) {
|
|
34596
|
+
return path3.replace(/\\/g, "/");
|
|
34597
|
+
}
|
|
34598
|
+
|
|
34599
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/project_tsconfig_paths.mjs
|
|
34600
|
+
var import_core13 = require("@angular-devkit/core");
|
|
34601
|
+
function getProjectTsConfigPaths(tree) {
|
|
34602
|
+
return __async(this, null, function* () {
|
|
34603
|
+
const buildPaths = /* @__PURE__ */ new Set();
|
|
34604
|
+
const testPaths = /* @__PURE__ */ new Set();
|
|
34605
|
+
const workspace = yield getWorkspace(tree);
|
|
34606
|
+
for (const [, project] of workspace.projects) {
|
|
34607
|
+
for (const [name, target] of project.targets) {
|
|
34608
|
+
if (name !== "build" && name !== "test") {
|
|
34609
|
+
continue;
|
|
34610
|
+
}
|
|
34611
|
+
for (const [, options] of allTargetOptions(target)) {
|
|
34612
|
+
const tsConfig = options.tsConfig;
|
|
34613
|
+
if (typeof tsConfig !== "string" || !tree.exists(tsConfig)) {
|
|
34614
|
+
continue;
|
|
34615
|
+
}
|
|
34616
|
+
if (name === "build") {
|
|
34617
|
+
buildPaths.add((0, import_core13.normalize)(tsConfig));
|
|
34618
|
+
} else {
|
|
34619
|
+
testPaths.add((0, import_core13.normalize)(tsConfig));
|
|
34620
|
+
}
|
|
34621
|
+
}
|
|
34622
|
+
}
|
|
34623
|
+
}
|
|
34624
|
+
return {
|
|
34625
|
+
buildPaths: [...buildPaths],
|
|
34626
|
+
testPaths: [...testPaths]
|
|
34627
|
+
};
|
|
34628
|
+
});
|
|
34629
|
+
}
|
|
34630
|
+
function* allTargetOptions(target) {
|
|
34631
|
+
if (target.options) {
|
|
34632
|
+
yield [void 0, target.options];
|
|
34633
|
+
}
|
|
34634
|
+
if (!target.configurations) {
|
|
34635
|
+
return;
|
|
34636
|
+
}
|
|
34637
|
+
for (const [name, options] of Object.entries(target.configurations)) {
|
|
34638
|
+
if (options) {
|
|
34639
|
+
yield [name, options];
|
|
34640
|
+
}
|
|
34641
|
+
}
|
|
34642
|
+
}
|
|
34643
|
+
function createHost(tree) {
|
|
34644
|
+
return {
|
|
34645
|
+
readFile(path3) {
|
|
34646
|
+
return __async(this, null, function* () {
|
|
34647
|
+
const data = tree.read(path3);
|
|
34648
|
+
if (!data) {
|
|
34649
|
+
throw new Error("File not found.");
|
|
34650
|
+
}
|
|
34651
|
+
return import_core13.virtualFs.fileBufferToString(data);
|
|
34652
|
+
});
|
|
34653
|
+
},
|
|
34654
|
+
writeFile(path3, data) {
|
|
34655
|
+
return __async(this, null, function* () {
|
|
34656
|
+
return tree.overwrite(path3, data);
|
|
34657
|
+
});
|
|
34658
|
+
},
|
|
34659
|
+
isDirectory(path3) {
|
|
34660
|
+
return __async(this, null, function* () {
|
|
34661
|
+
return !tree.exists(path3) && tree.getDir(path3).subfiles.length > 0;
|
|
34662
|
+
});
|
|
34663
|
+
},
|
|
34664
|
+
isFile(path3) {
|
|
34665
|
+
return __async(this, null, function* () {
|
|
34666
|
+
return tree.exists(path3);
|
|
34667
|
+
});
|
|
34668
|
+
}
|
|
34669
|
+
};
|
|
34670
|
+
}
|
|
34671
|
+
function getWorkspace(tree) {
|
|
34672
|
+
return __async(this, null, function* () {
|
|
34673
|
+
const host = createHost(tree);
|
|
34674
|
+
const { workspace } = yield import_core13.workspaces.readWorkspace("/", host);
|
|
34675
|
+
return workspace;
|
|
34676
|
+
});
|
|
34677
|
+
}
|
|
34678
|
+
|
|
34679
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/compiler_host.mjs
|
|
34680
|
+
var import_path5 = require("path");
|
|
34681
|
+
var import_typescript101 = __toESM(require("typescript"), 1);
|
|
34682
|
+
|
|
34683
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/parse_tsconfig.mjs
|
|
34684
|
+
var path2 = __toESM(require("path"), 1);
|
|
34685
|
+
var import_typescript100 = __toESM(require("typescript"), 1);
|
|
34686
|
+
function parseTsconfigFile(tsconfigPath, basePath) {
|
|
34687
|
+
const { config } = import_typescript100.default.readConfigFile(tsconfigPath, import_typescript100.default.sys.readFile);
|
|
34688
|
+
const parseConfigHost = {
|
|
34689
|
+
useCaseSensitiveFileNames: import_typescript100.default.sys.useCaseSensitiveFileNames,
|
|
34690
|
+
fileExists: import_typescript100.default.sys.fileExists,
|
|
34691
|
+
readDirectory: import_typescript100.default.sys.readDirectory,
|
|
34692
|
+
readFile: import_typescript100.default.sys.readFile
|
|
34693
|
+
};
|
|
34694
|
+
if (!path2.isAbsolute(basePath)) {
|
|
34695
|
+
throw Error("Unexpected relative base path has been specified.");
|
|
34696
|
+
}
|
|
34697
|
+
return import_typescript100.default.parseJsonConfigFileContent(config, parseConfigHost, basePath, {});
|
|
34698
|
+
}
|
|
34699
|
+
|
|
34700
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/compiler_host.mjs
|
|
34701
|
+
function createProgramOptions(tree, tsconfigPath, basePath, fakeFileRead, additionalFiles, optionOverrides) {
|
|
34702
|
+
tsconfigPath = (0, import_path5.resolve)(basePath, tsconfigPath);
|
|
34703
|
+
const parsed = parseTsconfigFile(tsconfigPath, (0, import_path5.dirname)(tsconfigPath));
|
|
34704
|
+
const options = optionOverrides ? __spreadValues(__spreadValues({}, parsed.options), optionOverrides) : parsed.options;
|
|
34705
|
+
const host = createMigrationCompilerHost(tree, options, basePath, fakeFileRead);
|
|
34706
|
+
return { rootNames: parsed.fileNames.concat(additionalFiles || []), options, host };
|
|
34707
|
+
}
|
|
34708
|
+
function createMigrationCompilerHost(tree, options, basePath, fakeRead) {
|
|
34709
|
+
const host = import_typescript101.default.createCompilerHost(options, true);
|
|
34710
|
+
const defaultReadFile = host.readFile;
|
|
34711
|
+
host.readFile = (fileName) => {
|
|
34712
|
+
var _a;
|
|
34713
|
+
const treeRelativePath = (0, import_path5.relative)(basePath, fileName);
|
|
34714
|
+
let result = fakeRead == null ? void 0 : fakeRead(treeRelativePath);
|
|
34715
|
+
if (typeof result !== "string") {
|
|
34716
|
+
result = treeRelativePath.startsWith("..") ? defaultReadFile.call(host, fileName) : (_a = tree.read(treeRelativePath)) == null ? void 0 : _a.toString();
|
|
34717
|
+
}
|
|
34718
|
+
return typeof result === "string" ? result.replace(/^\uFEFF/, "") : void 0;
|
|
34719
|
+
};
|
|
34720
|
+
return host;
|
|
34721
|
+
}
|
|
34722
|
+
function canMigrateFile(basePath, sourceFile, program) {
|
|
34723
|
+
if (sourceFile.fileName.endsWith(".ngtypecheck.ts") || sourceFile.isDeclarationFile || program.isSourceFileFromExternalLibrary(sourceFile)) {
|
|
34724
|
+
return false;
|
|
34725
|
+
}
|
|
34726
|
+
return !(0, import_path5.relative)(basePath, sourceFile.fileName).startsWith("..");
|
|
34727
|
+
}
|
|
34728
|
+
|
|
34729
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/standalone-migration/prune-modules.mjs
|
|
34730
|
+
var import_typescript106 = __toESM(require("typescript"), 1);
|
|
34731
|
+
|
|
34732
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/decorators.mjs
|
|
34733
|
+
var import_typescript103 = __toESM(require("typescript"), 1);
|
|
34734
|
+
|
|
34735
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/imports.mjs
|
|
34736
|
+
var import_typescript102 = __toESM(require("typescript"), 1);
|
|
34737
|
+
function getImportOfIdentifier(typeChecker, node) {
|
|
34738
|
+
const symbol = typeChecker.getSymbolAtLocation(node);
|
|
34739
|
+
if (!symbol || symbol.declarations === void 0 || !symbol.declarations.length) {
|
|
34740
|
+
return null;
|
|
34741
|
+
}
|
|
34742
|
+
const decl = symbol.declarations[0];
|
|
34743
|
+
if (!import_typescript102.default.isImportSpecifier(decl)) {
|
|
34744
|
+
return null;
|
|
34745
|
+
}
|
|
34746
|
+
const importDecl = decl.parent.parent.parent;
|
|
34747
|
+
if (!import_typescript102.default.isStringLiteral(importDecl.moduleSpecifier)) {
|
|
34748
|
+
return null;
|
|
34749
|
+
}
|
|
34750
|
+
return {
|
|
34751
|
+
name: decl.propertyName ? decl.propertyName.text : decl.name.text,
|
|
34752
|
+
importModule: importDecl.moduleSpecifier.text,
|
|
34753
|
+
node: importDecl
|
|
34754
|
+
};
|
|
34755
|
+
}
|
|
34756
|
+
function getImportSpecifier(sourceFile, moduleName, specifierName) {
|
|
34757
|
+
var _a;
|
|
34758
|
+
for (const node of sourceFile.statements) {
|
|
34759
|
+
if (import_typescript102.default.isImportDeclaration(node) && import_typescript102.default.isStringLiteral(node.moduleSpecifier)) {
|
|
34760
|
+
const isMatch = typeof moduleName === "string" ? node.moduleSpecifier.text === moduleName : moduleName.test(node.moduleSpecifier.text);
|
|
34761
|
+
const namedBindings = (_a = node.importClause) == null ? void 0 : _a.namedBindings;
|
|
34762
|
+
if (isMatch && namedBindings && import_typescript102.default.isNamedImports(namedBindings)) {
|
|
34763
|
+
const match = findImportSpecifier(namedBindings.elements, specifierName);
|
|
34764
|
+
if (match) {
|
|
34765
|
+
return match;
|
|
34766
|
+
}
|
|
34767
|
+
}
|
|
34768
|
+
}
|
|
34769
|
+
}
|
|
34770
|
+
return null;
|
|
34771
|
+
}
|
|
34772
|
+
function findImportSpecifier(nodes, specifierName) {
|
|
34773
|
+
return nodes.find((element) => {
|
|
34774
|
+
const { name, propertyName } = element;
|
|
34775
|
+
return propertyName ? propertyName.text === specifierName : name.text === specifierName;
|
|
34776
|
+
});
|
|
34777
|
+
}
|
|
34778
|
+
|
|
34779
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/decorators.mjs
|
|
34780
|
+
function getCallDecoratorImport(typeChecker, decorator) {
|
|
34781
|
+
if (!import_typescript103.default.isCallExpression(decorator.expression) || !import_typescript103.default.isIdentifier(decorator.expression.expression)) {
|
|
34782
|
+
return null;
|
|
34783
|
+
}
|
|
34784
|
+
const identifier = decorator.expression.expression;
|
|
34785
|
+
return getImportOfIdentifier(typeChecker, identifier);
|
|
34786
|
+
}
|
|
34787
|
+
|
|
34788
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/ng_decorators.mjs
|
|
34789
|
+
function getAngularDecorators(typeChecker, decorators) {
|
|
34790
|
+
return decorators.map((node) => ({ node, importData: getCallDecoratorImport(typeChecker, node) })).filter(({ importData }) => importData && importData.importModule.startsWith("@angular/")).map(({ node, importData }) => ({
|
|
34791
|
+
node,
|
|
34792
|
+
name: importData.name,
|
|
34793
|
+
moduleName: importData.importModule,
|
|
34794
|
+
importNode: importData.node
|
|
34795
|
+
}));
|
|
34796
|
+
}
|
|
34797
|
+
|
|
34798
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/nodes.mjs
|
|
34799
|
+
var import_typescript104 = __toESM(require("typescript"), 1);
|
|
34800
|
+
function closestNode(node, predicate) {
|
|
34801
|
+
let current = node.parent;
|
|
34802
|
+
while (current && !import_typescript104.default.isSourceFile(current)) {
|
|
34803
|
+
if (predicate(current)) {
|
|
34804
|
+
return current;
|
|
34805
|
+
}
|
|
34806
|
+
current = current.parent;
|
|
34807
|
+
}
|
|
34808
|
+
return null;
|
|
34809
|
+
}
|
|
34810
|
+
|
|
34811
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/standalone-migration/util.mjs
|
|
34812
|
+
var import_path6 = require("path");
|
|
34813
|
+
var import_typescript105 = __toESM(require("typescript"), 1);
|
|
34838
34814
|
var UniqueItemTracker = class {
|
|
34839
34815
|
constructor() {
|
|
34840
34816
|
this._nodes = /* @__PURE__ */ new Map();
|
|
@@ -34847,6 +34823,9 @@ var UniqueItemTracker = class {
|
|
|
34847
34823
|
this._nodes.set(key, /* @__PURE__ */ new Set([item]));
|
|
34848
34824
|
}
|
|
34849
34825
|
}
|
|
34826
|
+
get(key) {
|
|
34827
|
+
return this._nodes.get(key);
|
|
34828
|
+
}
|
|
34850
34829
|
getEntries() {
|
|
34851
34830
|
return this._nodes.entries();
|
|
34852
34831
|
}
|
|
@@ -34978,9 +34957,6 @@ function getRelativeImportPath(fromFile, toFile) {
|
|
|
34978
34957
|
}
|
|
34979
34958
|
return normalizePath(path3);
|
|
34980
34959
|
}
|
|
34981
|
-
function normalizePath(path3) {
|
|
34982
|
-
return path3.replace(/\\/g, "/");
|
|
34983
|
-
}
|
|
34984
34960
|
function knownInternalAliasRemapper(imports) {
|
|
34985
34961
|
return imports.map((current) => current.moduleSpecifier === "@angular/common" && current.symbolName === "NgForOf" ? __spreadProps(__spreadValues({}, current), { symbolName: "NgFor" }) : current);
|
|
34986
34962
|
}
|
|
@@ -35006,19 +34982,28 @@ function isClassReferenceInAngularModule(node, className, moduleName, typeChecke
|
|
|
35006
34982
|
function pruneNgModules(program, host, basePath, rootFileNames, sourceFiles, printer, importRemapper, referenceLookupExcludedFiles) {
|
|
35007
34983
|
const filesToRemove = /* @__PURE__ */ new Set();
|
|
35008
34984
|
const tracker = new ChangeTracker(printer, importRemapper);
|
|
35009
|
-
const
|
|
34985
|
+
const tsProgram = program.getTsProgram();
|
|
34986
|
+
const typeChecker = tsProgram.getTypeChecker();
|
|
35010
34987
|
const referenceResolver = new ReferenceResolver(program, host, rootFileNames, basePath, referenceLookupExcludedFiles);
|
|
35011
34988
|
const removalLocations = {
|
|
35012
34989
|
arrays: new UniqueItemTracker(),
|
|
35013
34990
|
imports: new UniqueItemTracker(),
|
|
35014
34991
|
exports: new UniqueItemTracker(),
|
|
35015
|
-
classes: /* @__PURE__ */ new Set(),
|
|
35016
34992
|
unknown: /* @__PURE__ */ new Set()
|
|
35017
34993
|
};
|
|
34994
|
+
const classesToRemove = /* @__PURE__ */ new Set();
|
|
34995
|
+
const barrelExports = new UniqueItemTracker();
|
|
34996
|
+
const nodesToRemove = /* @__PURE__ */ new Set();
|
|
35018
34997
|
sourceFiles.forEach(function walk(node) {
|
|
34998
|
+
var _a, _b;
|
|
35019
34999
|
if (import_typescript106.default.isClassDeclaration(node) && canRemoveClass(node, typeChecker)) {
|
|
35020
35000
|
collectRemovalLocations(node, removalLocations, referenceResolver, program);
|
|
35021
|
-
|
|
35001
|
+
classesToRemove.add(node);
|
|
35002
|
+
} else if (import_typescript106.default.isExportDeclaration(node) && !node.exportClause && node.moduleSpecifier && import_typescript106.default.isStringLiteralLike(node.moduleSpecifier) && node.moduleSpecifier.text.startsWith(".")) {
|
|
35003
|
+
const exportedSourceFile = (_b = (_a = typeChecker.getSymbolAtLocation(node.moduleSpecifier)) == null ? void 0 : _a.valueDeclaration) == null ? void 0 : _b.getSourceFile();
|
|
35004
|
+
if (exportedSourceFile) {
|
|
35005
|
+
barrelExports.track(exportedSourceFile, node);
|
|
35006
|
+
}
|
|
35022
35007
|
}
|
|
35023
35008
|
node.forEachChild(walk);
|
|
35024
35009
|
});
|
|
@@ -35026,9 +35011,22 @@ function pruneNgModules(program, host, basePath, rootFileNames, sourceFiles, pri
|
|
|
35026
35011
|
removeImportReferences(removalLocations.imports, tracker);
|
|
35027
35012
|
removeExportReferences(removalLocations.exports, tracker);
|
|
35028
35013
|
addRemovalTodos(removalLocations.unknown, tracker);
|
|
35029
|
-
|
|
35014
|
+
(function trackNodesToRemove(nodes) {
|
|
35015
|
+
for (const node of nodes) {
|
|
35016
|
+
const sourceFile = node.getSourceFile();
|
|
35017
|
+
if (!filesToRemove.has(sourceFile) && canRemoveFile(sourceFile, nodes)) {
|
|
35018
|
+
const barrelExportsForFile = barrelExports.get(sourceFile);
|
|
35019
|
+
nodesToRemove.add(node);
|
|
35020
|
+
filesToRemove.add(sourceFile);
|
|
35021
|
+
barrelExportsForFile && trackNodesToRemove(barrelExportsForFile);
|
|
35022
|
+
} else {
|
|
35023
|
+
nodesToRemove.add(node);
|
|
35024
|
+
}
|
|
35025
|
+
}
|
|
35026
|
+
})(classesToRemove);
|
|
35027
|
+
for (const node of nodesToRemove) {
|
|
35030
35028
|
const sourceFile = node.getSourceFile();
|
|
35031
|
-
if (!filesToRemove.has(sourceFile) && canRemoveFile(sourceFile,
|
|
35029
|
+
if (!filesToRemove.has(sourceFile) && canRemoveFile(sourceFile, nodesToRemove)) {
|
|
35032
35030
|
filesToRemove.add(sourceFile);
|
|
35033
35031
|
} else {
|
|
35034
35032
|
tracker.removeNode(node);
|
|
@@ -35141,13 +35139,13 @@ function canRemoveClass(node, typeChecker) {
|
|
|
35141
35139
|
function isNonEmptyNgModuleProperty(node) {
|
|
35142
35140
|
return import_typescript106.default.isPropertyAssignment(node) && import_typescript106.default.isIdentifier(node.name) && import_typescript106.default.isArrayLiteralExpression(node.initializer) && node.initializer.elements.length > 0;
|
|
35143
35141
|
}
|
|
35144
|
-
function canRemoveFile(sourceFile,
|
|
35142
|
+
function canRemoveFile(sourceFile, nodesToBeRemoved) {
|
|
35145
35143
|
var _a;
|
|
35146
35144
|
for (const node of sourceFile.statements) {
|
|
35147
|
-
if (import_typescript106.default.isImportDeclaration(node) ||
|
|
35145
|
+
if (import_typescript106.default.isImportDeclaration(node) || nodesToBeRemoved.has(node)) {
|
|
35148
35146
|
continue;
|
|
35149
35147
|
}
|
|
35150
|
-
if (import_typescript106.default.canHaveModifiers(node) && ((_a = import_typescript106.default.getModifiers(node)) == null ? void 0 : _a.some((m) => m.kind === import_typescript106.default.SyntaxKind.ExportKeyword))) {
|
|
35148
|
+
if (import_typescript106.default.isExportDeclaration(node) || import_typescript106.default.canHaveModifiers(node) && ((_a = import_typescript106.default.getModifiers(node)) == null ? void 0 : _a.some((m) => m.kind === import_typescript106.default.SyntaxKind.ExportKeyword))) {
|
|
35151
35149
|
return false;
|
|
35152
35150
|
}
|
|
35153
35151
|
}
|
|
@@ -35199,9 +35197,9 @@ function isReferenceToImport(typeChecker, node, importSpecifier) {
|
|
|
35199
35197
|
function toStandalone(sourceFiles, program, printer, fileImportRemapper, componentImportRemapper) {
|
|
35200
35198
|
const templateTypeChecker = program.compiler.getTemplateTypeChecker();
|
|
35201
35199
|
const typeChecker = program.getTsProgram().getTypeChecker();
|
|
35202
|
-
const modulesToMigrate =
|
|
35203
|
-
const testObjectsToMigrate =
|
|
35204
|
-
const declarations =
|
|
35200
|
+
const modulesToMigrate = /* @__PURE__ */ new Set();
|
|
35201
|
+
const testObjectsToMigrate = /* @__PURE__ */ new Set();
|
|
35202
|
+
const declarations = /* @__PURE__ */ new Set();
|
|
35205
35203
|
const tracker = new ChangeTracker(printer, fileImportRemapper);
|
|
35206
35204
|
for (const sourceFile of sourceFiles) {
|
|
35207
35205
|
const modules = findNgModuleClassesToMigrate(sourceFile, typeChecker);
|
|
@@ -35210,11 +35208,11 @@ function toStandalone(sourceFiles, program, printer, fileImportRemapper, compone
|
|
|
35210
35208
|
const allModuleDeclarations = extractDeclarationsFromModule(module3, templateTypeChecker);
|
|
35211
35209
|
const unbootstrappedDeclarations = filterNonBootstrappedDeclarations(allModuleDeclarations, module3, templateTypeChecker, typeChecker);
|
|
35212
35210
|
if (unbootstrappedDeclarations.length > 0) {
|
|
35213
|
-
modulesToMigrate.
|
|
35214
|
-
declarations.
|
|
35211
|
+
modulesToMigrate.add(module3);
|
|
35212
|
+
unbootstrappedDeclarations.forEach((decl) => declarations.add(decl));
|
|
35215
35213
|
}
|
|
35216
35214
|
}
|
|
35217
|
-
testObjectsToMigrate.
|
|
35215
|
+
testObjects.forEach((obj) => testObjectsToMigrate.add(obj));
|
|
35218
35216
|
}
|
|
35219
35217
|
for (const declaration of declarations) {
|
|
35220
35218
|
convertNgModuleDeclarationToStandalone(declaration, declarations, tracker, templateTypeChecker, componentImportRemapper);
|
|
@@ -35225,46 +35223,46 @@ function toStandalone(sourceFiles, program, printer, fileImportRemapper, compone
|
|
|
35225
35223
|
migrateTestDeclarations(testObjectsToMigrate, declarations, tracker, templateTypeChecker, typeChecker);
|
|
35226
35224
|
return tracker.recordChanges();
|
|
35227
35225
|
}
|
|
35228
|
-
function convertNgModuleDeclarationToStandalone(
|
|
35229
|
-
const directiveMeta = typeChecker.getDirectiveMetadata(
|
|
35226
|
+
function convertNgModuleDeclarationToStandalone(decl, allDeclarations, tracker, typeChecker, importRemapper) {
|
|
35227
|
+
const directiveMeta = typeChecker.getDirectiveMetadata(decl);
|
|
35230
35228
|
if (directiveMeta && directiveMeta.decorator && !directiveMeta.isStandalone) {
|
|
35231
35229
|
let decorator = addStandaloneToDecorator(directiveMeta.decorator);
|
|
35232
35230
|
if (directiveMeta.isComponent) {
|
|
35233
|
-
const importsToAdd = getComponentImportExpressions(
|
|
35231
|
+
const importsToAdd = getComponentImportExpressions(decl, allDeclarations, tracker, typeChecker, importRemapper);
|
|
35234
35232
|
if (importsToAdd.length > 0) {
|
|
35235
35233
|
decorator = addPropertyToAngularDecorator(decorator, import_typescript108.default.factory.createPropertyAssignment("imports", import_typescript108.default.factory.createArrayLiteralExpression(importsToAdd)));
|
|
35236
35234
|
}
|
|
35237
35235
|
}
|
|
35238
35236
|
tracker.replaceNode(directiveMeta.decorator, decorator);
|
|
35239
35237
|
} else {
|
|
35240
|
-
const pipeMeta = typeChecker.getPipeMetadata(
|
|
35238
|
+
const pipeMeta = typeChecker.getPipeMetadata(decl);
|
|
35241
35239
|
if (pipeMeta && pipeMeta.decorator && !pipeMeta.isStandalone) {
|
|
35242
35240
|
tracker.replaceNode(pipeMeta.decorator, addStandaloneToDecorator(pipeMeta.decorator));
|
|
35243
35241
|
}
|
|
35244
35242
|
}
|
|
35245
35243
|
}
|
|
35246
|
-
function getComponentImportExpressions(
|
|
35247
|
-
const templateDependencies = findTemplateDependencies(
|
|
35248
|
-
const usedDependenciesInMigration = new Set(templateDependencies.filter((dep) => allDeclarations.
|
|
35244
|
+
function getComponentImportExpressions(decl, allDeclarations, tracker, typeChecker, importRemapper) {
|
|
35245
|
+
const templateDependencies = findTemplateDependencies(decl, typeChecker);
|
|
35246
|
+
const usedDependenciesInMigration = new Set(templateDependencies.filter((dep) => allDeclarations.has(dep.node)));
|
|
35249
35247
|
const imports = [];
|
|
35250
35248
|
const seenImports = /* @__PURE__ */ new Set();
|
|
35251
35249
|
const resolvedDependencies = [];
|
|
35252
35250
|
for (const dep of templateDependencies) {
|
|
35253
|
-
const importLocation = findImportLocation(dep,
|
|
35251
|
+
const importLocation = findImportLocation(dep, decl, usedDependenciesInMigration.has(dep) ? PotentialImportMode.ForceDirect : PotentialImportMode.Normal, typeChecker);
|
|
35254
35252
|
if (importLocation && !seenImports.has(importLocation.symbolName)) {
|
|
35255
35253
|
seenImports.add(importLocation.symbolName);
|
|
35256
35254
|
resolvedDependencies.push(importLocation);
|
|
35257
35255
|
}
|
|
35258
35256
|
}
|
|
35259
|
-
const processedDependencies = importRemapper ? importRemapper(resolvedDependencies,
|
|
35257
|
+
const processedDependencies = importRemapper ? importRemapper(resolvedDependencies, decl) : resolvedDependencies;
|
|
35260
35258
|
for (const importLocation of processedDependencies) {
|
|
35261
35259
|
if (importLocation.moduleSpecifier) {
|
|
35262
|
-
const identifier = tracker.addImport(
|
|
35260
|
+
const identifier = tracker.addImport(decl.getSourceFile(), importLocation.symbolName, importLocation.moduleSpecifier);
|
|
35263
35261
|
imports.push(identifier);
|
|
35264
35262
|
} else {
|
|
35265
35263
|
const identifier = import_typescript108.default.factory.createIdentifier(importLocation.symbolName);
|
|
35266
35264
|
if (importLocation.isForwardReference) {
|
|
35267
|
-
const forwardRefExpression = tracker.addImport(
|
|
35265
|
+
const forwardRefExpression = tracker.addImport(decl.getSourceFile(), "forwardRef", "@angular/core");
|
|
35268
35266
|
const arrowFunction = import_typescript108.default.factory.createArrowFunction(void 0, void 0, [], void 0, void 0, identifier);
|
|
35269
35267
|
imports.push(import_typescript108.default.factory.createCallExpression(forwardRefExpression, void 0, [arrowFunction]));
|
|
35270
35268
|
} else {
|
|
@@ -35279,7 +35277,7 @@ function migrateNgModuleClass(node, allDeclarations, tracker, typeChecker, templ
|
|
|
35279
35277
|
const decorator = (_a = templateTypeChecker.getNgModuleMetadata(node)) == null ? void 0 : _a.decorator;
|
|
35280
35278
|
const metadata = decorator ? extractMetadataLiteral(decorator) : null;
|
|
35281
35279
|
if (metadata) {
|
|
35282
|
-
moveDeclarationsToImports(metadata, allDeclarations
|
|
35280
|
+
moveDeclarationsToImports(metadata, allDeclarations, typeChecker, templateTypeChecker, tracker);
|
|
35283
35281
|
}
|
|
35284
35282
|
}
|
|
35285
35283
|
function moveDeclarationsToImports(literal3, allDeclarations, typeChecker, templateTypeChecker, tracker) {
|
|
@@ -35358,7 +35356,7 @@ function isNamedPropertyAssignment(node) {
|
|
|
35358
35356
|
return import_typescript108.default.isPropertyAssignment(node) && node.name && import_typescript108.default.isIdentifier(node.name);
|
|
35359
35357
|
}
|
|
35360
35358
|
function findImportLocation(target, inComponent, importMode, typeChecker) {
|
|
35361
|
-
const importLocations = typeChecker.getPotentialImportsFor(target, inComponent
|
|
35359
|
+
const importLocations = typeChecker.getPotentialImportsFor(target, inComponent, importMode);
|
|
35362
35360
|
let firstSameFileImport = null;
|
|
35363
35361
|
let firstModuleImport = null;
|
|
35364
35362
|
for (const location of importLocations) {
|
|
@@ -35412,10 +35410,10 @@ function findTestObjectsToMigrate(sourceFile, typeChecker) {
|
|
|
35412
35410
|
}
|
|
35413
35411
|
return testObjects;
|
|
35414
35412
|
}
|
|
35415
|
-
function findTemplateDependencies(
|
|
35413
|
+
function findTemplateDependencies(decl, typeChecker) {
|
|
35416
35414
|
const results = [];
|
|
35417
|
-
const usedDirectives = typeChecker.getUsedDirectives(
|
|
35418
|
-
const usedPipes = typeChecker.getUsedPipes(
|
|
35415
|
+
const usedDirectives = typeChecker.getUsedDirectives(decl);
|
|
35416
|
+
const usedPipes = typeChecker.getUsedPipes(decl);
|
|
35419
35417
|
if (usedDirectives !== null) {
|
|
35420
35418
|
for (const dir of usedDirectives) {
|
|
35421
35419
|
if (import_typescript108.default.isClassDeclaration(dir.ref.node)) {
|
|
@@ -35424,7 +35422,7 @@ function findTemplateDependencies(ref, typeChecker) {
|
|
|
35424
35422
|
}
|
|
35425
35423
|
}
|
|
35426
35424
|
if (usedPipes !== null) {
|
|
35427
|
-
const potentialPipes = typeChecker.getPotentialPipes(
|
|
35425
|
+
const potentialPipes = typeChecker.getPotentialPipes(decl);
|
|
35428
35426
|
for (const pipe of potentialPipes) {
|
|
35429
35427
|
if (import_typescript108.default.isClassDeclaration(pipe.ref.node) && usedPipes.some((current) => pipe.name === current)) {
|
|
35430
35428
|
results.push(pipe.ref);
|
|
@@ -35452,27 +35450,27 @@ function filterNonBootstrappedDeclarations(declarations, ngModule, templateTypeC
|
|
|
35452
35450
|
return [];
|
|
35453
35451
|
}
|
|
35454
35452
|
}
|
|
35455
|
-
return declarations.filter((ref) => !bootstrappedClasses.has(ref
|
|
35453
|
+
return declarations.filter((ref) => !bootstrappedClasses.has(ref));
|
|
35456
35454
|
}
|
|
35457
35455
|
function extractDeclarationsFromModule(ngModule, templateTypeChecker) {
|
|
35458
35456
|
const metadata = templateTypeChecker.getNgModuleMetadata(ngModule);
|
|
35459
|
-
return metadata ? metadata.declarations.filter((decl) => import_typescript108.default.isClassDeclaration(decl.node)) : [];
|
|
35457
|
+
return metadata ? metadata.declarations.filter((decl) => import_typescript108.default.isClassDeclaration(decl.node)).map((decl) => decl.node) : [];
|
|
35460
35458
|
}
|
|
35461
35459
|
function migrateTestDeclarations(testObjects, declarationsOutsideOfTestFiles, tracker, templateTypeChecker, typeChecker) {
|
|
35462
35460
|
const { decorators, componentImports } = analyzeTestingModules(testObjects, typeChecker);
|
|
35463
|
-
const allDeclarations = declarationsOutsideOfTestFiles
|
|
35461
|
+
const allDeclarations = new Set(declarationsOutsideOfTestFiles);
|
|
35464
35462
|
for (const decorator of decorators) {
|
|
35465
35463
|
const closestClass = closestNode(decorator.node, import_typescript108.default.isClassDeclaration);
|
|
35466
35464
|
if (decorator.name === "Pipe" || decorator.name === "Directive") {
|
|
35467
35465
|
tracker.replaceNode(decorator.node, addStandaloneToDecorator(decorator.node));
|
|
35468
35466
|
if (closestClass) {
|
|
35469
|
-
allDeclarations.
|
|
35467
|
+
allDeclarations.add(closestClass);
|
|
35470
35468
|
}
|
|
35471
35469
|
} else if (decorator.name === "Component") {
|
|
35472
35470
|
const newDecorator = addStandaloneToDecorator(decorator.node);
|
|
35473
35471
|
const importsToAdd = componentImports.get(decorator.node);
|
|
35474
35472
|
if (closestClass) {
|
|
35475
|
-
allDeclarations.
|
|
35473
|
+
allDeclarations.add(closestClass);
|
|
35476
35474
|
}
|
|
35477
35475
|
if (importsToAdd && importsToAdd.size > 0) {
|
|
35478
35476
|
tracker.replaceNode(decorator.node, addPropertyToAngularDecorator(newDecorator, import_typescript108.default.factory.createPropertyAssignment("imports", import_typescript108.default.factory.createArrayLiteralExpression(Array.from(importsToAdd)))));
|
|
@@ -35536,7 +35534,7 @@ function extractMetadataLiteral(decorator) {
|
|
|
35536
35534
|
return import_typescript108.default.isCallExpression(decorator.expression) && decorator.expression.arguments.length === 1 && import_typescript108.default.isObjectLiteralExpression(decorator.expression.arguments[0]) ? decorator.expression.arguments[0] : null;
|
|
35537
35535
|
}
|
|
35538
35536
|
function isStandaloneDeclaration(node, declarationsInMigration, templateTypeChecker) {
|
|
35539
|
-
if (declarationsInMigration.
|
|
35537
|
+
if (declarationsInMigration.has(node)) {
|
|
35540
35538
|
return true;
|
|
35541
35539
|
}
|
|
35542
35540
|
const metadata = templateTypeChecker.getDirectiveMetadata(node) || templateTypeChecker.getPipeMetadata(node);
|
|
@@ -35550,8 +35548,9 @@ function toStandaloneBootstrap(program, host, basePath, rootFileNames, sourceFil
|
|
|
35550
35548
|
const templateTypeChecker = program.compiler.getTemplateTypeChecker();
|
|
35551
35549
|
const referenceResolver = new ReferenceResolver(program, host, rootFileNames, basePath, referenceLookupExcludedFiles);
|
|
35552
35550
|
const bootstrapCalls = [];
|
|
35553
|
-
const testObjects =
|
|
35554
|
-
const allDeclarations =
|
|
35551
|
+
const testObjects = /* @__PURE__ */ new Set();
|
|
35552
|
+
const allDeclarations = /* @__PURE__ */ new Set();
|
|
35553
|
+
const additionalProviders = hasImport(program, rootFileNames, "protractor") ? /* @__PURE__ */ new Map([["provideProtractorTestingSupport", "@angular/platform-browser"]]) : null;
|
|
35555
35554
|
for (const sourceFile of sourceFiles) {
|
|
35556
35555
|
sourceFile.forEachChild(function walk(node) {
|
|
35557
35556
|
if (import_typescript109.default.isCallExpression(node) && import_typescript109.default.isPropertyAccessExpression(node.expression) && node.expression.name.text === "bootstrapModule" && isClassReferenceInAngularModule(node.expression, "PlatformRef", "core", typeChecker)) {
|
|
@@ -35562,11 +35561,11 @@ function toStandaloneBootstrap(program, host, basePath, rootFileNames, sourceFil
|
|
|
35562
35561
|
}
|
|
35563
35562
|
node.forEachChild(walk);
|
|
35564
35563
|
});
|
|
35565
|
-
|
|
35564
|
+
findTestObjectsToMigrate(sourceFile, typeChecker).forEach((obj) => testObjects.add(obj));
|
|
35566
35565
|
}
|
|
35567
35566
|
for (const call of bootstrapCalls) {
|
|
35568
|
-
|
|
35569
|
-
migrateBootstrapCall(call, tracker, referenceResolver, typeChecker, printer);
|
|
35567
|
+
call.declarations.forEach((decl) => allDeclarations.add(decl));
|
|
35568
|
+
migrateBootstrapCall(call, tracker, additionalProviders, referenceResolver, typeChecker, printer);
|
|
35570
35569
|
}
|
|
35571
35570
|
for (const declaration of allDeclarations) {
|
|
35572
35571
|
convertNgModuleDeclarationToStandalone(declaration, allDeclarations, tracker, templateTypeChecker, componentImportRemapper);
|
|
@@ -35603,7 +35602,7 @@ function analyzeBootstrapCall(call, typeChecker, templateTypeChecker) {
|
|
|
35603
35602
|
}
|
|
35604
35603
|
return null;
|
|
35605
35604
|
}
|
|
35606
|
-
function migrateBootstrapCall(analysis, tracker, referenceResolver, typeChecker, printer) {
|
|
35605
|
+
function migrateBootstrapCall(analysis, tracker, additionalProviders, referenceResolver, typeChecker, printer) {
|
|
35607
35606
|
const sourceFile = analysis.call.getSourceFile();
|
|
35608
35607
|
const moduleSourceFile = analysis.metadata.getSourceFile();
|
|
35609
35608
|
const providers = findLiteralProperty(analysis.metadata, "providers");
|
|
@@ -35627,6 +35626,11 @@ function migrateBootstrapCall(analysis, tracker, referenceResolver, typeChecker,
|
|
|
35627
35626
|
nodeLookup = nodeLookup || getNodeLookup(moduleSourceFile);
|
|
35628
35627
|
migrateImportsForBootstrapCall(sourceFile, imports, nodeLookup, moduleImportsInNewCall, providersInNewCall, tracker, nodesToCopy, referenceResolver, typeChecker);
|
|
35629
35628
|
}
|
|
35629
|
+
if (additionalProviders) {
|
|
35630
|
+
additionalProviders.forEach((moduleSpecifier, name) => {
|
|
35631
|
+
providersInNewCall.push(import_typescript109.default.factory.createCallExpression(tracker.addImport(sourceFile, name, moduleSpecifier), void 0, void 0));
|
|
35632
|
+
});
|
|
35633
|
+
}
|
|
35630
35634
|
if (nodesToCopy.size > 0) {
|
|
35631
35635
|
let text = "\n\n";
|
|
35632
35636
|
nodesToCopy.forEach((node) => {
|
|
@@ -35896,6 +35900,22 @@ function getLastImportEnd(sourceFile) {
|
|
|
35896
35900
|
}
|
|
35897
35901
|
return index;
|
|
35898
35902
|
}
|
|
35903
|
+
function hasImport(program, rootFileNames, moduleName) {
|
|
35904
|
+
const tsProgram = program.getTsProgram();
|
|
35905
|
+
const deepImportStart = moduleName + "/";
|
|
35906
|
+
for (const fileName of rootFileNames) {
|
|
35907
|
+
const sourceFile = tsProgram.getSourceFile(fileName);
|
|
35908
|
+
if (!sourceFile) {
|
|
35909
|
+
continue;
|
|
35910
|
+
}
|
|
35911
|
+
for (const statement of sourceFile.statements) {
|
|
35912
|
+
if (import_typescript109.default.isImportDeclaration(statement) && import_typescript109.default.isStringLiteralLike(statement.moduleSpecifier) && (statement.moduleSpecifier.text === moduleName || statement.moduleSpecifier.text.startsWith(deepImportStart))) {
|
|
35913
|
+
return true;
|
|
35914
|
+
}
|
|
35915
|
+
}
|
|
35916
|
+
}
|
|
35917
|
+
return false;
|
|
35918
|
+
}
|
|
35899
35919
|
|
|
35900
35920
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/standalone-migration/index.mjs
|
|
35901
35921
|
var MigrationMode;
|