UNPKG

@angular/compiler-cli

Version:
1,253 lines (1,234 loc) • 131 kB
import {createRequire as __cjsCompatRequire} from 'module'; const require = __cjsCompatRequire(import.meta.url); import { LogicalProjectPath, absoluteFrom, absoluteFromSourceFile, dirname, getFileSystem, relative, resolve, stripExtension, toRelativeImport } from "./chunk-37JMVF7H.js"; // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/error_code.mjs var ErrorCode; (function(ErrorCode2) { ErrorCode2[ErrorCode2["DECORATOR_ARG_NOT_LITERAL"] = 1001] = "DECORATOR_ARG_NOT_LITERAL"; ErrorCode2[ErrorCode2["DECORATOR_ARITY_WRONG"] = 1002] = "DECORATOR_ARITY_WRONG"; ErrorCode2[ErrorCode2["DECORATOR_NOT_CALLED"] = 1003] = "DECORATOR_NOT_CALLED"; ErrorCode2[ErrorCode2["DECORATOR_UNEXPECTED"] = 1005] = "DECORATOR_UNEXPECTED"; ErrorCode2[ErrorCode2["DECORATOR_COLLISION"] = 1006] = "DECORATOR_COLLISION"; ErrorCode2[ErrorCode2["VALUE_HAS_WRONG_TYPE"] = 1010] = "VALUE_HAS_WRONG_TYPE"; ErrorCode2[ErrorCode2["VALUE_NOT_LITERAL"] = 1011] = "VALUE_NOT_LITERAL"; ErrorCode2[ErrorCode2["DUPLICATE_DECORATED_PROPERTIES"] = 1012] = "DUPLICATE_DECORATED_PROPERTIES"; ErrorCode2[ErrorCode2["INITIALIZER_API_WITH_DISALLOWED_DECORATOR"] = 1050] = "INITIALIZER_API_WITH_DISALLOWED_DECORATOR"; ErrorCode2[ErrorCode2["INITIALIZER_API_DECORATOR_METADATA_COLLISION"] = 1051] = "INITIALIZER_API_DECORATOR_METADATA_COLLISION"; ErrorCode2[ErrorCode2["INITIALIZER_API_NO_REQUIRED_FUNCTION"] = 1052] = "INITIALIZER_API_NO_REQUIRED_FUNCTION"; ErrorCode2[ErrorCode2["INITIALIZER_API_DISALLOWED_MEMBER_VISIBILITY"] = 1053] = "INITIALIZER_API_DISALLOWED_MEMBER_VISIBILITY"; ErrorCode2[ErrorCode2["INCORRECTLY_DECLARED_ON_STATIC_MEMBER"] = 1100] = "INCORRECTLY_DECLARED_ON_STATIC_MEMBER"; ErrorCode2[ErrorCode2["COMPONENT_MISSING_TEMPLATE"] = 2001] = "COMPONENT_MISSING_TEMPLATE"; ErrorCode2[ErrorCode2["PIPE_MISSING_NAME"] = 2002] = "PIPE_MISSING_NAME"; ErrorCode2[ErrorCode2["PARAM_MISSING_TOKEN"] = 2003] = "PARAM_MISSING_TOKEN"; ErrorCode2[ErrorCode2["DIRECTIVE_MISSING_SELECTOR"] = 2004] = "DIRECTIVE_MISSING_SELECTOR"; ErrorCode2[ErrorCode2["UNDECORATED_PROVIDER"] = 2005] = "UNDECORATED_PROVIDER"; ErrorCode2[ErrorCode2["DIRECTIVE_INHERITS_UNDECORATED_CTOR"] = 2006] = "DIRECTIVE_INHERITS_UNDECORATED_CTOR"; ErrorCode2[ErrorCode2["UNDECORATED_CLASS_USING_ANGULAR_FEATURES"] = 2007] = "UNDECORATED_CLASS_USING_ANGULAR_FEATURES"; ErrorCode2[ErrorCode2["COMPONENT_RESOURCE_NOT_FOUND"] = 2008] = "COMPONENT_RESOURCE_NOT_FOUND"; ErrorCode2[ErrorCode2["COMPONENT_INVALID_SHADOW_DOM_SELECTOR"] = 2009] = "COMPONENT_INVALID_SHADOW_DOM_SELECTOR"; ErrorCode2[ErrorCode2["COMPONENT_NOT_STANDALONE"] = 2010] = "COMPONENT_NOT_STANDALONE"; ErrorCode2[ErrorCode2["COMPONENT_IMPORT_NOT_STANDALONE"] = 2011] = "COMPONENT_IMPORT_NOT_STANDALONE"; ErrorCode2[ErrorCode2["COMPONENT_UNKNOWN_IMPORT"] = 2012] = "COMPONENT_UNKNOWN_IMPORT"; ErrorCode2[ErrorCode2["HOST_DIRECTIVE_INVALID"] = 2013] = "HOST_DIRECTIVE_INVALID"; ErrorCode2[ErrorCode2["HOST_DIRECTIVE_NOT_STANDALONE"] = 2014] = "HOST_DIRECTIVE_NOT_STANDALONE"; ErrorCode2[ErrorCode2["HOST_DIRECTIVE_COMPONENT"] = 2015] = "HOST_DIRECTIVE_COMPONENT"; ErrorCode2[ErrorCode2["INJECTABLE_INHERITS_INVALID_CONSTRUCTOR"] = 2016] = "INJECTABLE_INHERITS_INVALID_CONSTRUCTOR"; ErrorCode2[ErrorCode2["HOST_DIRECTIVE_UNDEFINED_BINDING"] = 2017] = "HOST_DIRECTIVE_UNDEFINED_BINDING"; ErrorCode2[ErrorCode2["HOST_DIRECTIVE_CONFLICTING_ALIAS"] = 2018] = "HOST_DIRECTIVE_CONFLICTING_ALIAS"; ErrorCode2[ErrorCode2["HOST_DIRECTIVE_MISSING_REQUIRED_BINDING"] = 2019] = "HOST_DIRECTIVE_MISSING_REQUIRED_BINDING"; ErrorCode2[ErrorCode2["CONFLICTING_INPUT_TRANSFORM"] = 2020] = "CONFLICTING_INPUT_TRANSFORM"; ErrorCode2[ErrorCode2["COMPONENT_INVALID_STYLE_URLS"] = 2021] = "COMPONENT_INVALID_STYLE_URLS"; ErrorCode2[ErrorCode2["COMPONENT_UNKNOWN_DEFERRED_IMPORT"] = 2022] = "COMPONENT_UNKNOWN_DEFERRED_IMPORT"; ErrorCode2[ErrorCode2["NON_STANDALONE_NOT_ALLOWED"] = 2023] = "NON_STANDALONE_NOT_ALLOWED"; ErrorCode2[ErrorCode2["SYMBOL_NOT_EXPORTED"] = 3001] = "SYMBOL_NOT_EXPORTED"; ErrorCode2[ErrorCode2["IMPORT_CYCLE_DETECTED"] = 3003] = "IMPORT_CYCLE_DETECTED"; ErrorCode2[ErrorCode2["IMPORT_GENERATION_FAILURE"] = 3004] = "IMPORT_GENERATION_FAILURE"; ErrorCode2[ErrorCode2["CONFIG_FLAT_MODULE_NO_INDEX"] = 4001] = "CONFIG_FLAT_MODULE_NO_INDEX"; ErrorCode2[ErrorCode2["CONFIG_STRICT_TEMPLATES_IMPLIES_FULL_TEMPLATE_TYPECHECK"] = 4002] = "CONFIG_STRICT_TEMPLATES_IMPLIES_FULL_TEMPLATE_TYPECHECK"; ErrorCode2[ErrorCode2["CONFIG_EXTENDED_DIAGNOSTICS_IMPLIES_STRICT_TEMPLATES"] = 4003] = "CONFIG_EXTENDED_DIAGNOSTICS_IMPLIES_STRICT_TEMPLATES"; ErrorCode2[ErrorCode2["CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL"] = 4004] = "CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL"; ErrorCode2[ErrorCode2["CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CHECK"] = 4005] = "CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CHECK"; ErrorCode2[ErrorCode2["HOST_BINDING_PARSE_ERROR"] = 5001] = "HOST_BINDING_PARSE_ERROR"; ErrorCode2[ErrorCode2["TEMPLATE_PARSE_ERROR"] = 5002] = "TEMPLATE_PARSE_ERROR"; ErrorCode2[ErrorCode2["NGMODULE_INVALID_DECLARATION"] = 6001] = "NGMODULE_INVALID_DECLARATION"; ErrorCode2[ErrorCode2["NGMODULE_INVALID_IMPORT"] = 6002] = "NGMODULE_INVALID_IMPORT"; ErrorCode2[ErrorCode2["NGMODULE_INVALID_EXPORT"] = 6003] = "NGMODULE_INVALID_EXPORT"; ErrorCode2[ErrorCode2["NGMODULE_INVALID_REEXPORT"] = 6004] = "NGMODULE_INVALID_REEXPORT"; ErrorCode2[ErrorCode2["NGMODULE_MODULE_WITH_PROVIDERS_MISSING_GENERIC"] = 6005] = "NGMODULE_MODULE_WITH_PROVIDERS_MISSING_GENERIC"; ErrorCode2[ErrorCode2["NGMODULE_REEXPORT_NAME_COLLISION"] = 6006] = "NGMODULE_REEXPORT_NAME_COLLISION"; ErrorCode2[ErrorCode2["NGMODULE_DECLARATION_NOT_UNIQUE"] = 6007] = "NGMODULE_DECLARATION_NOT_UNIQUE"; ErrorCode2[ErrorCode2["NGMODULE_DECLARATION_IS_STANDALONE"] = 6008] = "NGMODULE_DECLARATION_IS_STANDALONE"; ErrorCode2[ErrorCode2["NGMODULE_BOOTSTRAP_IS_STANDALONE"] = 6009] = "NGMODULE_BOOTSTRAP_IS_STANDALONE"; ErrorCode2[ErrorCode2["WARN_NGMODULE_ID_UNNECESSARY"] = 6100] = "WARN_NGMODULE_ID_UNNECESSARY"; ErrorCode2[ErrorCode2["SCHEMA_INVALID_ELEMENT"] = 8001] = "SCHEMA_INVALID_ELEMENT"; ErrorCode2[ErrorCode2["SCHEMA_INVALID_ATTRIBUTE"] = 8002] = "SCHEMA_INVALID_ATTRIBUTE"; ErrorCode2[ErrorCode2["MISSING_REFERENCE_TARGET"] = 8003] = "MISSING_REFERENCE_TARGET"; ErrorCode2[ErrorCode2["MISSING_PIPE"] = 8004] = "MISSING_PIPE"; ErrorCode2[ErrorCode2["WRITE_TO_READ_ONLY_VARIABLE"] = 8005] = "WRITE_TO_READ_ONLY_VARIABLE"; ErrorCode2[ErrorCode2["DUPLICATE_VARIABLE_DECLARATION"] = 8006] = "DUPLICATE_VARIABLE_DECLARATION"; ErrorCode2[ErrorCode2["SPLIT_TWO_WAY_BINDING"] = 8007] = "SPLIT_TWO_WAY_BINDING"; ErrorCode2[ErrorCode2["MISSING_REQUIRED_INPUTS"] = 8008] = "MISSING_REQUIRED_INPUTS"; ErrorCode2[ErrorCode2["ILLEGAL_FOR_LOOP_TRACK_ACCESS"] = 8009] = "ILLEGAL_FOR_LOOP_TRACK_ACCESS"; ErrorCode2[ErrorCode2["INACCESSIBLE_DEFERRED_TRIGGER_ELEMENT"] = 8010] = "INACCESSIBLE_DEFERRED_TRIGGER_ELEMENT"; ErrorCode2[ErrorCode2["CONTROL_FLOW_PREVENTING_CONTENT_PROJECTION"] = 8011] = "CONTROL_FLOW_PREVENTING_CONTENT_PROJECTION"; ErrorCode2[ErrorCode2["DEFERRED_PIPE_USED_EAGERLY"] = 8012] = "DEFERRED_PIPE_USED_EAGERLY"; ErrorCode2[ErrorCode2["DEFERRED_DIRECTIVE_USED_EAGERLY"] = 8013] = "DEFERRED_DIRECTIVE_USED_EAGERLY"; ErrorCode2[ErrorCode2["DEFERRED_DEPENDENCY_IMPORTED_EAGERLY"] = 8014] = "DEFERRED_DEPENDENCY_IMPORTED_EAGERLY"; ErrorCode2[ErrorCode2["ILLEGAL_LET_WRITE"] = 8015] = "ILLEGAL_LET_WRITE"; ErrorCode2[ErrorCode2["LET_USED_BEFORE_DEFINITION"] = 8016] = "LET_USED_BEFORE_DEFINITION"; ErrorCode2[ErrorCode2["CONFLICTING_LET_DECLARATION"] = 8017] = "CONFLICTING_LET_DECLARATION"; ErrorCode2[ErrorCode2["INVALID_BANANA_IN_BOX"] = 8101] = "INVALID_BANANA_IN_BOX"; ErrorCode2[ErrorCode2["NULLISH_COALESCING_NOT_NULLABLE"] = 8102] = "NULLISH_COALESCING_NOT_NULLABLE"; ErrorCode2[ErrorCode2["MISSING_CONTROL_FLOW_DIRECTIVE"] = 8103] = "MISSING_CONTROL_FLOW_DIRECTIVE"; ErrorCode2[ErrorCode2["TEXT_ATTRIBUTE_NOT_BINDING"] = 8104] = "TEXT_ATTRIBUTE_NOT_BINDING"; ErrorCode2[ErrorCode2["MISSING_NGFOROF_LET"] = 8105] = "MISSING_NGFOROF_LET"; ErrorCode2[ErrorCode2["SUFFIX_NOT_SUPPORTED"] = 8106] = "SUFFIX_NOT_SUPPORTED"; ErrorCode2[ErrorCode2["OPTIONAL_CHAIN_NOT_NULLABLE"] = 8107] = "OPTIONAL_CHAIN_NOT_NULLABLE"; ErrorCode2[ErrorCode2["SKIP_HYDRATION_NOT_STATIC"] = 8108] = "SKIP_HYDRATION_NOT_STATIC"; ErrorCode2[ErrorCode2["INTERPOLATED_SIGNAL_NOT_INVOKED"] = 8109] = "INTERPOLATED_SIGNAL_NOT_INVOKED"; ErrorCode2[ErrorCode2["UNSUPPORTED_INITIALIZER_API_USAGE"] = 8110] = "UNSUPPORTED_INITIALIZER_API_USAGE"; ErrorCode2[ErrorCode2["UNINVOKED_FUNCTION_IN_EVENT_BINDING"] = 8111] = "UNINVOKED_FUNCTION_IN_EVENT_BINDING"; ErrorCode2[ErrorCode2["UNUSED_LET_DECLARATION"] = 8112] = "UNUSED_LET_DECLARATION"; ErrorCode2[ErrorCode2["UNUSED_STANDALONE_IMPORTS"] = 8113] = "UNUSED_STANDALONE_IMPORTS"; ErrorCode2[ErrorCode2["INLINE_TCB_REQUIRED"] = 8900] = "INLINE_TCB_REQUIRED"; ErrorCode2[ErrorCode2["INLINE_TYPE_CTOR_REQUIRED"] = 8901] = "INLINE_TYPE_CTOR_REQUIRED"; ErrorCode2[ErrorCode2["INJECTABLE_DUPLICATE_PROV"] = 9001] = "INJECTABLE_DUPLICATE_PROV"; ErrorCode2[ErrorCode2["SUGGEST_STRICT_TEMPLATES"] = 10001] = "SUGGEST_STRICT_TEMPLATES"; ErrorCode2[ErrorCode2["SUGGEST_SUBOPTIMAL_TYPE_INFERENCE"] = 10002] = "SUGGEST_SUBOPTIMAL_TYPE_INFERENCE"; ErrorCode2[ErrorCode2["LOCAL_COMPILATION_UNRESOLVED_CONST"] = 11001] = "LOCAL_COMPILATION_UNRESOLVED_CONST"; ErrorCode2[ErrorCode2["LOCAL_COMPILATION_UNSUPPORTED_EXPRESSION"] = 11003] = "LOCAL_COMPILATION_UNSUPPORTED_EXPRESSION"; })(ErrorCode || (ErrorCode = {})); // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/util.mjs var ERROR_CODE_MATCHER = /(\u001b\[\d+m ?)TS-99(\d+: ?\u001b\[\d+m)/g; function replaceTsWithNgInErrors(errors) { return errors.replace(ERROR_CODE_MATCHER, "$1NG$2"); } function ngErrorCode(code) { return parseInt("-99" + code); } // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/error.mjs import ts from "typescript"; var FatalDiagnosticError = class extends Error { code; node; diagnosticMessage; relatedInformation; constructor(code, node, diagnosticMessage, relatedInformation) { super(`FatalDiagnosticError: Code: ${code}, Message: ${ts.flattenDiagnosticMessageText(diagnosticMessage, "\n")}`); this.code = code; this.node = node; this.diagnosticMessage = diagnosticMessage; this.relatedInformation = relatedInformation; Object.setPrototypeOf(this, new.target.prototype); } _isFatalDiagnosticError = true; toDiagnostic() { return makeDiagnostic(this.code, this.node, this.diagnosticMessage, this.relatedInformation); } }; function makeDiagnostic(code, node, messageText, relatedInformation, category = ts.DiagnosticCategory.Error) { node = ts.getOriginalNode(node); return { category, code: ngErrorCode(code), file: ts.getOriginalNode(node).getSourceFile(), start: node.getStart(void 0, false), length: node.getWidth(), messageText, relatedInformation }; } function makeDiagnosticChain(messageText, next) { return { category: ts.DiagnosticCategory.Message, code: 0, messageText, next }; } function makeRelatedInformation(node, messageText) { node = ts.getOriginalNode(node); return { category: ts.DiagnosticCategory.Message, code: 0, file: node.getSourceFile(), start: node.getStart(), length: node.getWidth(), messageText }; } function addDiagnosticChain(messageText, add) { if (typeof messageText === "string") { return makeDiagnosticChain(messageText, add); } if (messageText.next === void 0) { messageText.next = add; } else { messageText.next.push(...add); } return messageText; } function isFatalDiagnosticError(err) { return err._isFatalDiagnosticError === true; } function isLocalCompilationDiagnostics(diagnostic) { return diagnostic.code === ngErrorCode(ErrorCode.LOCAL_COMPILATION_UNRESOLVED_CONST) || diagnostic.code === ngErrorCode(ErrorCode.LOCAL_COMPILATION_UNSUPPORTED_EXPRESSION); } // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/docs.mjs var COMPILER_ERRORS_WITH_GUIDES = /* @__PURE__ */ new Set([ ErrorCode.DECORATOR_ARG_NOT_LITERAL, ErrorCode.IMPORT_CYCLE_DETECTED, ErrorCode.PARAM_MISSING_TOKEN, ErrorCode.SCHEMA_INVALID_ELEMENT, ErrorCode.SCHEMA_INVALID_ATTRIBUTE, ErrorCode.MISSING_REFERENCE_TARGET, ErrorCode.COMPONENT_INVALID_SHADOW_DOM_SELECTOR, ErrorCode.WARN_NGMODULE_ID_UNNECESSARY ]); // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/error_details_base_url.mjs var ERROR_DETAILS_PAGE_BASE_URL = "https://angular.dev/errors"; // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/extended_template_diagnostic_name.mjs var ExtendedTemplateDiagnosticName; (function(ExtendedTemplateDiagnosticName2) { ExtendedTemplateDiagnosticName2["INVALID_BANANA_IN_BOX"] = "invalidBananaInBox"; ExtendedTemplateDiagnosticName2["NULLISH_COALESCING_NOT_NULLABLE"] = "nullishCoalescingNotNullable"; ExtendedTemplateDiagnosticName2["OPTIONAL_CHAIN_NOT_NULLABLE"] = "optionalChainNotNullable"; ExtendedTemplateDiagnosticName2["MISSING_CONTROL_FLOW_DIRECTIVE"] = "missingControlFlowDirective"; ExtendedTemplateDiagnosticName2["TEXT_ATTRIBUTE_NOT_BINDING"] = "textAttributeNotBinding"; ExtendedTemplateDiagnosticName2["UNINVOKED_FUNCTION_IN_EVENT_BINDING"] = "uninvokedFunctionInEventBinding"; ExtendedTemplateDiagnosticName2["MISSING_NGFOROF_LET"] = "missingNgForOfLet"; ExtendedTemplateDiagnosticName2["SUFFIX_NOT_SUPPORTED"] = "suffixNotSupported"; ExtendedTemplateDiagnosticName2["SKIP_HYDRATION_NOT_STATIC"] = "skipHydrationNotStatic"; ExtendedTemplateDiagnosticName2["INTERPOLATED_SIGNAL_NOT_INVOKED"] = "interpolatedSignalNotInvoked"; ExtendedTemplateDiagnosticName2["CONTROL_FLOW_PREVENTING_CONTENT_PROJECTION"] = "controlFlowPreventingContentProjection"; ExtendedTemplateDiagnosticName2["UNUSED_LET_DECLARATION"] = "unusedLetDeclaration"; ExtendedTemplateDiagnosticName2["UNUSED_STANDALONE_IMPORTS"] = "unusedStandaloneImports"; })(ExtendedTemplateDiagnosticName || (ExtendedTemplateDiagnosticName = {})); // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/typescript.mjs import ts5 from "typescript"; // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/host.mjs import ts2 from "typescript"; function isDecoratorIdentifier(exp) { return ts2.isIdentifier(exp) || ts2.isPropertyAccessExpression(exp) && ts2.isIdentifier(exp.expression) && ts2.isIdentifier(exp.name); } var ClassMemberKind; (function(ClassMemberKind2) { ClassMemberKind2[ClassMemberKind2["Constructor"] = 0] = "Constructor"; ClassMemberKind2[ClassMemberKind2["Getter"] = 1] = "Getter"; ClassMemberKind2[ClassMemberKind2["Setter"] = 2] = "Setter"; ClassMemberKind2[ClassMemberKind2["Property"] = 3] = "Property"; ClassMemberKind2[ClassMemberKind2["Method"] = 4] = "Method"; })(ClassMemberKind || (ClassMemberKind = {})); var ClassMemberAccessLevel; (function(ClassMemberAccessLevel2) { ClassMemberAccessLevel2[ClassMemberAccessLevel2["PublicWritable"] = 0] = "PublicWritable"; ClassMemberAccessLevel2[ClassMemberAccessLevel2["PublicReadonly"] = 1] = "PublicReadonly"; ClassMemberAccessLevel2[ClassMemberAccessLevel2["Protected"] = 2] = "Protected"; ClassMemberAccessLevel2[ClassMemberAccessLevel2["Private"] = 3] = "Private"; ClassMemberAccessLevel2[ClassMemberAccessLevel2["EcmaScriptPrivate"] = 4] = "EcmaScriptPrivate"; })(ClassMemberAccessLevel || (ClassMemberAccessLevel = {})); var AmbientImport = {}; // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/type_to_value.mjs import ts3 from "typescript"; function typeToValue(typeNode, checker, isLocalCompilation) { var _a, _b; if (typeNode === null) { return missingType(); } if (!ts3.isTypeReferenceNode(typeNode)) { return unsupportedType(typeNode); } const symbols = resolveTypeSymbols(typeNode, checker); if (symbols === null) { return unknownReference(typeNode); } const { local, decl } = symbols; if (decl.valueDeclaration === void 0 || decl.flags & ts3.SymbolFlags.ConstEnum) { let typeOnlyDecl = null; if (decl.declarations !== void 0 && decl.declarations.length > 0) { typeOnlyDecl = decl.declarations[0]; } if (!isLocalCompilation || typeOnlyDecl && [ ts3.SyntaxKind.TypeParameter, ts3.SyntaxKind.TypeAliasDeclaration, ts3.SyntaxKind.InterfaceDeclaration ].includes(typeOnlyDecl.kind)) { return noValueDeclaration(typeNode, typeOnlyDecl); } } const firstDecl = local.declarations && local.declarations[0]; if (firstDecl !== void 0) { if (ts3.isImportClause(firstDecl) && firstDecl.name !== void 0) { if (firstDecl.isTypeOnly) { return typeOnlyImport(typeNode, firstDecl); } if (!ts3.isImportDeclaration(firstDecl.parent)) { return unsupportedType(typeNode); } return { kind: 0, expression: firstDecl.name, defaultImportStatement: firstDecl.parent }; } else if (ts3.isImportSpecifier(firstDecl)) { if (firstDecl.isTypeOnly) { return typeOnlyImport(typeNode, firstDecl); } if (firstDecl.parent.parent.isTypeOnly) { return typeOnlyImport(typeNode, firstDecl.parent.parent); } const importedName = (firstDecl.propertyName || firstDecl.name).text; const [_localName, ...nestedPath] = symbols.symbolNames; const importDeclaration = firstDecl.parent.parent.parent; if (!ts3.isImportDeclaration(importDeclaration)) { return unsupportedType(typeNode); } const moduleName = extractModuleName(importDeclaration); return { kind: 1, valueDeclaration: (_a = decl.valueDeclaration) != null ? _a : null, moduleName, importedName, nestedPath }; } else if (ts3.isNamespaceImport(firstDecl)) { if (firstDecl.parent.isTypeOnly) { return typeOnlyImport(typeNode, firstDecl.parent); } if (symbols.symbolNames.length === 1) { return namespaceImport(typeNode, firstDecl.parent); } const [_ns, importedName, ...nestedPath] = symbols.symbolNames; const importDeclaration = firstDecl.parent.parent; if (!ts3.isImportDeclaration(importDeclaration)) { return unsupportedType(typeNode); } const moduleName = extractModuleName(importDeclaration); return { kind: 1, valueDeclaration: (_b = decl.valueDeclaration) != null ? _b : null, moduleName, importedName, nestedPath }; } } const expression = typeNodeToValueExpr(typeNode); if (expression !== null) { return { kind: 0, expression, defaultImportStatement: null }; } else { return unsupportedType(typeNode); } } function unsupportedType(typeNode) { return { kind: 2, reason: { kind: 5, typeNode } }; } function noValueDeclaration(typeNode, decl) { return { kind: 2, reason: { kind: 1, typeNode, decl } }; } function typeOnlyImport(typeNode, node) { return { kind: 2, reason: { kind: 2, typeNode, node } }; } function unknownReference(typeNode) { return { kind: 2, reason: { kind: 3, typeNode } }; } function namespaceImport(typeNode, importClause) { return { kind: 2, reason: { kind: 4, typeNode, importClause } }; } function missingType() { return { kind: 2, reason: { kind: 0 } }; } function typeNodeToValueExpr(node) { if (ts3.isTypeReferenceNode(node)) { return entityNameToValue(node.typeName); } else { return null; } } function resolveTypeSymbols(typeRef, checker) { const typeName = typeRef.typeName; const typeRefSymbol = checker.getSymbolAtLocation(typeName); if (typeRefSymbol === void 0) { return null; } let local = typeRefSymbol; let leftMost = typeName; const symbolNames = []; while (ts3.isQualifiedName(leftMost)) { symbolNames.unshift(leftMost.right.text); leftMost = leftMost.left; } symbolNames.unshift(leftMost.text); if (leftMost !== typeName) { const localTmp = checker.getSymbolAtLocation(leftMost); if (localTmp !== void 0) { local = localTmp; } } let decl = typeRefSymbol; if (typeRefSymbol.flags & ts3.SymbolFlags.Alias) { decl = checker.getAliasedSymbol(typeRefSymbol); } return { local, decl, symbolNames }; } function entityNameToValue(node) { if (ts3.isQualifiedName(node)) { const left = entityNameToValue(node.left); return left !== null ? ts3.factory.createPropertyAccessExpression(left, node.right) : null; } else if (ts3.isIdentifier(node)) { const clone = ts3.setOriginalNode(ts3.factory.createIdentifier(node.text), node); clone.parent = node.parent; return clone; } else { return null; } } function extractModuleName(node) { if (!ts3.isStringLiteral(node.moduleSpecifier)) { throw new Error("not a module specifier"); } return node.moduleSpecifier.text; } // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/util.mjs import ts4 from "typescript"; function isNamedClassDeclaration(node) { return ts4.isClassDeclaration(node) && isIdentifier(node.name); } function isIdentifier(node) { return node !== void 0 && ts4.isIdentifier(node); } function classMemberAccessLevelToString(level) { switch (level) { case ClassMemberAccessLevel.EcmaScriptPrivate: return "ES private"; case ClassMemberAccessLevel.Private: return "private"; case ClassMemberAccessLevel.Protected: return "protected"; case ClassMemberAccessLevel.PublicReadonly: return "public readonly"; case ClassMemberAccessLevel.PublicWritable: default: return "public"; } } // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/typescript.mjs var TypeScriptReflectionHost = class { checker; isLocalCompilation; skipPrivateValueDeclarationTypes; constructor(checker, isLocalCompilation = false, skipPrivateValueDeclarationTypes = false) { this.checker = checker; this.isLocalCompilation = isLocalCompilation; this.skipPrivateValueDeclarationTypes = skipPrivateValueDeclarationTypes; } getDecoratorsOfDeclaration(declaration) { const decorators = ts5.canHaveDecorators(declaration) ? ts5.getDecorators(declaration) : void 0; return decorators !== void 0 && decorators.length ? decorators.map((decorator) => this._reflectDecorator(decorator)).filter((dec) => dec !== null) : null; } getMembersOfClass(clazz) { const tsClazz = castDeclarationToClassOrDie(clazz); return tsClazz.members.map((member) => { const result = reflectClassMember(member); if (result === null) { return null; } return { ...result, decorators: this.getDecoratorsOfDeclaration(member) }; }).filter((member) => member !== null); } getConstructorParameters(clazz) { const tsClazz = castDeclarationToClassOrDie(clazz); const isDeclaration2 = tsClazz.getSourceFile().isDeclarationFile; const ctor = tsClazz.members.find((member) => ts5.isConstructorDeclaration(member) && (isDeclaration2 || member.body !== void 0)); if (ctor === void 0) { return null; } return ctor.parameters.map((node) => { const name = parameterName(node.name); const decorators = this.getDecoratorsOfDeclaration(node); let originalTypeNode = node.type || null; let typeNode = originalTypeNode; if (typeNode && ts5.isUnionTypeNode(typeNode)) { let childTypeNodes = typeNode.types.filter((childTypeNode) => !(ts5.isLiteralTypeNode(childTypeNode) && childTypeNode.literal.kind === ts5.SyntaxKind.NullKeyword)); if (childTypeNodes.length === 1) { typeNode = childTypeNodes[0]; } } const typeValueReference = typeToValue(typeNode, this.checker, this.isLocalCompilation); return { name, nameNode: node.name, typeValueReference, typeNode: originalTypeNode, decorators }; }); } getImportOfIdentifier(id) { const directImport = this.getDirectImportOfIdentifier(id); if (directImport !== null) { return directImport; } else if (ts5.isQualifiedName(id.parent) && id.parent.right === id) { return this.getImportOfNamespacedIdentifier(id, getQualifiedNameRoot(id.parent)); } else if (ts5.isPropertyAccessExpression(id.parent) && id.parent.name === id) { return this.getImportOfNamespacedIdentifier(id, getFarLeftIdentifier(id.parent)); } else { return null; } } getExportsOfModule(node) { if (!ts5.isSourceFile(node)) { throw new Error(`getExportsOfModule() called on non-SourceFile in TS code`); } const symbol = this.checker.getSymbolAtLocation(node); if (symbol === void 0) { return null; } const map = /* @__PURE__ */ new Map(); this.checker.getExportsOfModule(symbol).forEach((exportSymbol) => { const decl = this.getDeclarationOfSymbol(exportSymbol, null); if (decl !== null) { map.set(exportSymbol.name, decl); } }); return map; } isClass(node) { return isNamedClassDeclaration(node); } hasBaseClass(clazz) { return this.getBaseClassExpression(clazz) !== null; } getBaseClassExpression(clazz) { if (!(ts5.isClassDeclaration(clazz) || ts5.isClassExpression(clazz)) || clazz.heritageClauses === void 0) { return null; } const extendsClause = clazz.heritageClauses.find((clause) => clause.token === ts5.SyntaxKind.ExtendsKeyword); if (extendsClause === void 0) { return null; } const extendsType = extendsClause.types[0]; if (extendsType === void 0) { return null; } return extendsType.expression; } getDeclarationOfIdentifier(id) { let symbol = this.checker.getSymbolAtLocation(id); if (symbol === void 0) { return null; } return this.getDeclarationOfSymbol(symbol, id); } getDefinitionOfFunction(node) { if (!ts5.isFunctionDeclaration(node) && !ts5.isMethodDeclaration(node) && !ts5.isFunctionExpression(node) && !ts5.isArrowFunction(node)) { return null; } let body = null; if (node.body !== void 0) { body = ts5.isBlock(node.body) ? Array.from(node.body.statements) : [ts5.factory.createReturnStatement(node.body)]; } const type = this.checker.getTypeAtLocation(node); const signatures = this.checker.getSignaturesOfType(type, ts5.SignatureKind.Call); return { node, body, signatureCount: signatures.length, typeParameters: node.typeParameters === void 0 ? null : Array.from(node.typeParameters), parameters: node.parameters.map((param) => { const name = parameterName(param.name); const initializer = param.initializer || null; return { name, node: param, initializer, type: param.type || null }; }) }; } getGenericArityOfClass(clazz) { if (!ts5.isClassDeclaration(clazz)) { return null; } return clazz.typeParameters !== void 0 ? clazz.typeParameters.length : 0; } getVariableValue(declaration) { return declaration.initializer || null; } isStaticallyExported(decl) { let topLevel = decl; if (ts5.isVariableDeclaration(decl) && ts5.isVariableDeclarationList(decl.parent)) { topLevel = decl.parent.parent; } const modifiers = ts5.canHaveModifiers(topLevel) ? ts5.getModifiers(topLevel) : void 0; if (modifiers !== void 0 && modifiers.some((modifier) => modifier.kind === ts5.SyntaxKind.ExportKeyword)) { return true; } if (topLevel.parent === void 0 || !ts5.isSourceFile(topLevel.parent)) { return false; } const localExports = this.getLocalExportedDeclarationsOfSourceFile(decl.getSourceFile()); return localExports.has(decl); } getDirectImportOfIdentifier(id) { const symbol = this.checker.getSymbolAtLocation(id); if (symbol === void 0 || symbol.declarations === void 0 || symbol.declarations.length !== 1) { return null; } const decl = symbol.declarations[0]; const importDecl = getContainingImportDeclaration(decl); if (importDecl === null) { return null; } if (!ts5.isStringLiteral(importDecl.moduleSpecifier)) { return null; } return { from: importDecl.moduleSpecifier.text, name: getExportedName(decl, id), node: importDecl }; } getImportOfNamespacedIdentifier(id, namespaceIdentifier) { if (namespaceIdentifier === null) { return null; } const namespaceSymbol = this.checker.getSymbolAtLocation(namespaceIdentifier); if (!namespaceSymbol || namespaceSymbol.declarations === void 0) { return null; } const declaration = namespaceSymbol.declarations.length === 1 ? namespaceSymbol.declarations[0] : null; if (!declaration) { return null; } const namespaceDeclaration = ts5.isNamespaceImport(declaration) ? declaration : null; if (!namespaceDeclaration) { return null; } const importDeclaration = namespaceDeclaration.parent.parent; if (!ts5.isImportDeclaration(importDeclaration) || !ts5.isStringLiteral(importDeclaration.moduleSpecifier)) { return null; } return { from: importDeclaration.moduleSpecifier.text, name: id.text, node: importDeclaration }; } getDeclarationOfSymbol(symbol, originalId) { let valueDeclaration = void 0; if (symbol.valueDeclaration !== void 0) { valueDeclaration = symbol.valueDeclaration; } else if (symbol.declarations !== void 0 && symbol.declarations.length > 0) { valueDeclaration = symbol.declarations[0]; } if (valueDeclaration !== void 0 && ts5.isShorthandPropertyAssignment(valueDeclaration)) { const shorthandSymbol = this.checker.getShorthandAssignmentValueSymbol(valueDeclaration); if (shorthandSymbol === void 0) { return null; } return this.getDeclarationOfSymbol(shorthandSymbol, originalId); } else if (valueDeclaration !== void 0 && ts5.isExportSpecifier(valueDeclaration)) { const targetSymbol = this.checker.getExportSpecifierLocalTargetSymbol(valueDeclaration); if (targetSymbol === void 0) { return null; } return this.getDeclarationOfSymbol(targetSymbol, originalId); } const importInfo = originalId && this.getImportOfIdentifier(originalId); while (symbol.flags & ts5.SymbolFlags.Alias) { symbol = this.checker.getAliasedSymbol(symbol); } if (symbol.valueDeclaration !== void 0 && (!this.skipPrivateValueDeclarationTypes || !isPrivateSymbol(this.checker, symbol))) { return { node: symbol.valueDeclaration, viaModule: this._viaModule(symbol.valueDeclaration, originalId, importInfo) }; } else if (symbol.declarations !== void 0 && symbol.declarations.length > 0) { return { node: symbol.declarations[0], viaModule: this._viaModule(symbol.declarations[0], originalId, importInfo) }; } else { return null; } } _reflectDecorator(node) { let decoratorExpr = node.expression; let args = null; if (ts5.isCallExpression(decoratorExpr)) { args = Array.from(decoratorExpr.arguments); decoratorExpr = decoratorExpr.expression; } if (!isDecoratorIdentifier(decoratorExpr)) { return null; } const decoratorIdentifier = ts5.isIdentifier(decoratorExpr) ? decoratorExpr : decoratorExpr.name; const importDecl = this.getImportOfIdentifier(decoratorIdentifier); return { name: decoratorIdentifier.text, identifier: decoratorExpr, import: importDecl, node, args }; } getLocalExportedDeclarationsOfSourceFile(file) { const cacheSf = file; if (cacheSf[LocalExportedDeclarations] !== void 0) { return cacheSf[LocalExportedDeclarations]; } const exportSet = /* @__PURE__ */ new Set(); cacheSf[LocalExportedDeclarations] = exportSet; const sfSymbol = this.checker.getSymbolAtLocation(cacheSf); if (sfSymbol === void 0 || sfSymbol.exports === void 0) { return exportSet; } const iter = sfSymbol.exports.values(); let item = iter.next(); while (item.done !== true) { let exportedSymbol = item.value; if (exportedSymbol.flags & ts5.SymbolFlags.Alias) { exportedSymbol = this.checker.getAliasedSymbol(exportedSymbol); } if (exportedSymbol.valueDeclaration !== void 0 && exportedSymbol.valueDeclaration.getSourceFile() === file) { exportSet.add(exportedSymbol.valueDeclaration); } item = iter.next(); } return exportSet; } _viaModule(declaration, originalId, importInfo) { if (importInfo === null && originalId !== null && declaration.getSourceFile() !== originalId.getSourceFile()) { return AmbientImport; } return importInfo !== null && importInfo.from !== null && !importInfo.from.startsWith(".") ? importInfo.from : null; } }; var TypeEntityToDeclarationError = class extends Error { constructor(message) { super(message); Object.setPrototypeOf(this, new.target.prototype); } }; function reflectTypeEntityToDeclaration(type, checker) { let realSymbol = checker.getSymbolAtLocation(type); if (realSymbol === void 0) { throw new TypeEntityToDeclarationError(`Cannot resolve type entity ${type.getText()} to symbol`); } while (realSymbol.flags & ts5.SymbolFlags.Alias) { realSymbol = checker.getAliasedSymbol(realSymbol); } let node = null; if (realSymbol.valueDeclaration !== void 0) { node = realSymbol.valueDeclaration; } else if (realSymbol.declarations !== void 0 && realSymbol.declarations.length === 1) { node = realSymbol.declarations[0]; } else { throw new TypeEntityToDeclarationError(`Cannot resolve type entity symbol to declaration`); } if (ts5.isQualifiedName(type)) { if (!ts5.isIdentifier(type.left)) { throw new TypeEntityToDeclarationError(`Cannot handle qualified name with non-identifier lhs`); } const symbol = checker.getSymbolAtLocation(type.left); if (symbol === void 0 || symbol.declarations === void 0 || symbol.declarations.length !== 1) { throw new TypeEntityToDeclarationError(`Cannot resolve qualified type entity lhs to symbol`); } const decl = symbol.declarations[0]; if (ts5.isNamespaceImport(decl)) { const clause = decl.parent; const importDecl = clause.parent; if (!ts5.isStringLiteral(importDecl.moduleSpecifier)) { throw new TypeEntityToDeclarationError(`Module specifier is not a string`); } return { node, from: importDecl.moduleSpecifier.text }; } else if (ts5.isModuleDeclaration(decl)) { return { node, from: null }; } else { throw new TypeEntityToDeclarationError(`Unknown import type?`); } } else { return { node, from: null }; } } function filterToMembersWithDecorator(members, name, module) { return members.filter((member) => !member.isStatic).map((member) => { if (member.decorators === null) { return null; } const decorators = member.decorators.filter((dec) => { if (dec.import !== null) { return dec.import.name === name && (module === void 0 || dec.import.from === module); } else { return dec.name === name && module === void 0; } }); if (decorators.length === 0) { return null; } return { member, decorators }; }).filter((value) => value !== null); } function extractModifiersOfMember(node) { const modifiers = ts5.getModifiers(node); let isStatic = false; let isReadonly = false; let accessLevel = ClassMemberAccessLevel.PublicWritable; if (modifiers !== void 0) { for (const modifier of modifiers) { switch (modifier.kind) { case ts5.SyntaxKind.StaticKeyword: isStatic = true; break; case ts5.SyntaxKind.PrivateKeyword: accessLevel = ClassMemberAccessLevel.Private; break; case ts5.SyntaxKind.ProtectedKeyword: accessLevel = ClassMemberAccessLevel.Protected; break; case ts5.SyntaxKind.ReadonlyKeyword: isReadonly = true; break; } } } if (isReadonly && accessLevel === ClassMemberAccessLevel.PublicWritable) { accessLevel = ClassMemberAccessLevel.PublicReadonly; } if (node.name !== void 0 && ts5.isPrivateIdentifier(node.name)) { accessLevel = ClassMemberAccessLevel.EcmaScriptPrivate; } return { accessLevel, isStatic }; } function reflectClassMember(node) { let kind = null; let value = null; let name = null; let nameNode = null; if (ts5.isPropertyDeclaration(node)) { kind = ClassMemberKind.Property; value = node.initializer || null; } else if (ts5.isGetAccessorDeclaration(node)) { kind = ClassMemberKind.Getter; } else if (ts5.isSetAccessorDeclaration(node)) { kind = ClassMemberKind.Setter; } else if (ts5.isMethodDeclaration(node)) { kind = ClassMemberKind.Method; } else if (ts5.isConstructorDeclaration(node)) { kind = ClassMemberKind.Constructor; } else { return null; } if (ts5.isConstructorDeclaration(node)) { name = "constructor"; } else if (ts5.isIdentifier(node.name)) { name = node.name.text; nameNode = node.name; } else if (ts5.isStringLiteral(node.name)) { name = node.name.text; nameNode = node.name; } else if (ts5.isPrivateIdentifier(node.name)) { name = node.name.text; nameNode = node.name; } else { return null; } const { accessLevel, isStatic } = extractModifiersOfMember(node); return { node, implementation: node, kind, type: node.type || null, accessLevel, name, nameNode, value, isStatic }; } function reflectObjectLiteral(node) { const map = /* @__PURE__ */ new Map(); node.properties.forEach((prop) => { if (ts5.isPropertyAssignment(prop)) { const name = propertyNameToString(prop.name); if (name === null) { return; } map.set(name, prop.initializer); } else if (ts5.isShorthandPropertyAssignment(prop)) { map.set(prop.name.text, prop.name); } else { return; } }); return map; } function castDeclarationToClassOrDie(declaration) { if (!ts5.isClassDeclaration(declaration)) { throw new Error(`Reflecting on a ${ts5.SyntaxKind[declaration.kind]} instead of a ClassDeclaration.`); } return declaration; } function parameterName(name) { if (ts5.isIdentifier(name)) { return name.text; } else { return null; } } function propertyNameToString(node) { if (ts5.isIdentifier(node) || ts5.isStringLiteral(node) || ts5.isNumericLiteral(node)) { return node.text; } else { return null; } } function isPrivateSymbol(typeChecker, symbol) { var _a; if (symbol.valueDeclaration !== void 0) { const symbolType = typeChecker.getTypeOfSymbolAtLocation(symbol, symbol.valueDeclaration); return ((_a = symbolType == null ? void 0 : symbolType.symbol) == null ? void 0 : _a.name.startsWith("\u0275")) === true; } return false; } function getQualifiedNameRoot(qualifiedName) { while (ts5.isQualifiedName(qualifiedName.left)) { qualifiedName = qualifiedName.left; } return ts5.isIdentifier(qualifiedName.left) ? qualifiedName.left : null; } function getFarLeftIdentifier(propertyAccess) { while (ts5.isPropertyAccessExpression(propertyAccess.expression)) { propertyAccess = propertyAccess.expression; } return ts5.isIdentifier(propertyAccess.expression) ? propertyAccess.expression : null; } function getContainingImportDeclaration(node) { let parent = node.parent; while (parent && !ts5.isSourceFile(parent)) { if (ts5.isImportDeclaration(parent)) { return parent; } parent = parent.parent; } return null; } function getExportedName(decl, originalId) { return ts5.isImportSpecifier(decl) ? (decl.propertyName !== void 0 ? decl.propertyName : decl.name).text : originalId.text; } var LocalExportedDeclarations = Symbol("LocalExportedDeclarations"); // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/util/src/typescript.mjs import ts6 from "typescript"; var TS = /\.tsx?$/i; var D_TS = /\.d\.ts$/i; function isSymbolWithValueDeclaration(symbol) { return symbol != null && symbol.valueDeclaration !== void 0 && symbol.declarations !== void 0; } function isDtsPath(filePath) { return D_TS.test(filePath); } function isNonDeclarationTsPath(filePath) { return TS.test(filePath) && !D_TS.test(filePath); } function isFromDtsFile(node) { let sf = node.getSourceFile(); if (sf === void 0) { sf = ts6.getOriginalNode(node).getSourceFile(); } return sf !== void 0 && sf.isDeclarationFile; } function nodeNameForError(node) { if (node.name !== void 0 && ts6.isIdentifier(node.name)) { return node.name.text; } else { const kind = ts6.SyntaxKind[node.kind]; const { line, character } = ts6.getLineAndCharacterOfPosition(node.getSourceFile(), node.getStart()); return `${kind}@${line}:${character}`; } } function getSourceFile(node) { const directSf = node.getSourceFile(); return directSf !== void 0 ? directSf : ts6.getOriginalNode(node).getSourceFile(); } function getSourceFileOrNull(program, fileName) { return program.getSourceFile(fileName) || null; } function getTokenAtPosition(sf, pos) { return ts6.getTokenAtPosition(sf, pos); } function identifierOfNode(decl) { if (decl.name !== void 0 && ts6.isIdentifier(decl.name)) { return decl.name; } else { return null; } } function isDeclaration(node) { return isValueDeclaration(node) || isTypeDeclaration(node); } function isValueDeclaration(node) { return ts6.isClassDeclaration(node) || ts6.isFunctionDeclaration(node) || ts6.isVariableDeclaration(node); } function isTypeDeclaration(node) { return ts6.isEnumDeclaration(node) || ts6.isTypeAliasDeclaration(node) || ts6.isInterfaceDeclaration(node); } function isNamedDeclaration(node) { const namedNode = node; return namedNode.name !== void 0 && ts6.isIdentifier(namedNode.name); } function getRootDirs(host, options) { const rootDirs = []; const cwd = host.getCurrentDirectory(); const fs = getFileSystem(); if (options.rootDirs !== void 0) { rootDirs.push(...options.rootDirs); } else if (options.rootDir !== void 0) { rootDirs.push(options.rootDir); } else { rootDirs.push(cwd); } return rootDirs.map((rootDir) => fs.resolve(cwd, host.getCanonicalFileName(rootDir))); } function nodeDebugInfo(node) { const sf = getSourceFile(node); const { line, character } = ts6.getLineAndCharacterOfPosition(sf, node.pos); return `[${sf.fileName}: ${ts6.SyntaxKind[node.kind]} @ ${line}:${character}]`; } function resolveModuleName(moduleName, containingFile, compilerOptions, compilerHost, moduleResolutionCache) { if (compilerHost.resolveModuleNames) { return compilerHost.resolveModuleNames( [moduleName], containingFile, void 0, void 0, compilerOptions )[0]; } else { return ts6.resolveModuleName(moduleName, containingFile, compilerOptions, compilerHost, moduleResolutionCache !== null ? moduleResolutionCache : void 0).resolvedModule; } } function isAssignment(node) { return ts6.isBinaryExpression(node) && node.operatorToken.kind === ts6.SyntaxKind.EqualsToken; } function toUnredirectedSourceFile(sf) { const redirectInfo = sf.redirectInfo; if (redirectInfo === void 0) { return sf; } return redirectInfo.unredirected; } // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/references.mjs var Reference = class { node; bestGuessOwningModule; identifiers = []; synthetic = false; _alias = null; isAmbient; constructor(node, bestGuessOwningModule = null) { this.node = node; if (bestGuessOwningModule === AmbientImport) { this.isAmbient = true; this.bestGuessOwningModule = null; } else { this.isAmbient = false; this.bestGuessOwningModule = bestGuessOwningModule; } const id = identifierOfNode(node); if (id !== null) { this.identifiers.push(id); } } get ownedByModuleGuess() { if (this.bestGuessOwningModule !== null) { return this.bestGuessOwningModule.specifier; } else { return null; } } get hasOwningModuleGuess() { return this.bestGuessOwningModule !== null; } get debugName() { const id = identifierOfNode(this.node); return id !== null ? id.text : null; } get alias() { return this._alias; } addIdentifier(identifier) { this.identifiers.push(identifier); } getIdentityIn(context) { return this.identifiers.find((id) => id.getSourceFile() === context) || null; } getIdentityInExpression(expr) { const sf = expr.getSourceFile(); return this.identifiers.find((id) => { if (id.getSourceFile() !== sf) { return false; } return id.pos >= expr.pos && id.end <= expr.end; }) || null; } getOriginForDiagnostics(container, fallback = container) { const id = this.getIdentityInExpression(container); return id !== null ? id : fallback; } cloneWithAlias(alias) { const ref = new Reference(this.node, this.isAmbient ? AmbientImport : this.bestGuessOwningModule); ref.identifiers = [...this.identifiers]; ref._alias = alias; return ref; } cloneWithNoIdentifiers() { const ref = new Reference(this.node, this.isAmbient ? AmbientImport : this.bestGuessOwningModule); ref._alias = this._alias; ref.identifiers = []; return ref; } }; // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/alias.mjs import { ExternalExpr as ExternalExpr2 } from "@angular/compiler"; // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/emitter.mjs import { ExternalExpr, ExternalReference, WrappedNodeExpr } from "@angular/compiler"; import ts7 from "typescript"; // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/find_export.mjs function findExportedNameOfNode(target, file, reflector) { const exports = reflector.getExportsOfModule(file); if (exports === null) { return null; } const declaredName = isNamedDeclaration(target) ? target.name.text : null; let foundExportName = null; for (const [exportName, declaration] of exports) { if (declaration.node !== target) { continue; } if (exportName === declaredName) { return exportName; } foundExportName = exportName; } return foundExportName; } // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/emitter.mjs var ImportFlags; (function(ImportFlags2) { ImportFlags2[ImportFlags2["None"] = 0] = "None"; ImportFlags2[ImportFlags2["ForceNewImport"] = 1] = "ForceNewImport"; ImportFlags2[ImportFlags2["NoAliasing"] = 2] = "NoAliasing"; ImportFlags2[ImportFlags2["AllowTypeImports"] = 4] = "AllowTypeImports"; ImportFlags2[ImportFlags2["AllowRelativeDtsImports"] = 8] = "AllowRelativeDtsImports"; ImportFlags2[ImportFlags2["AllowAmbientReferences"] = 16] = "AllowAmbientReferences"; })(ImportFlags || (ImportFlags = {})); var ReferenceEmitKind; (function(ReferenceEmitKind2) { ReferenceEmitKind2[ReferenceEmitKind2["Success"] = 0] = "Success"; ReferenceEmitKind2[ReferenceEmitKind2["Failed"] = 1] = "Failed"; })(ReferenceEmitKind || (ReferenceEmitKind = {})); function assertSuccessfulReferenceEmit(result, origin, typeKind) { if (result.kind === ReferenceEmitKind.Success) { return; } const message = makeDiagnosticChain(`Unable to import ${typeKind} ${nodeNameForError(result.ref.node)}.`, [makeDiagnosticChain(result.reason)]); throw new FatalDiagnosticError(ErrorCode.IMPORT_GENERATION_FAILURE, origin, message, [ makeRelatedInformation(result.ref.node, `The ${typeKind} is declared here.`) ]); } var ReferenceEmitter = class { strategies; constructor(strategies) { this.strategies = strategies; } emit(ref, context, importFlags = ImportFlags.None) { for (const strategy of this.strategies) { const emitted = strategy.emit(ref, context, importFlags); if (emitted !== null) { return emitted; } } return { kind: ReferenceEmitKind.Failed, ref, context, reason: `Unable to write a reference to ${nodeNameForError(ref.node)}.` }; } }; var LocalIdentifierStrategy = class { emit(ref, context, importFlags) { const refSf = getSourceFile(ref.node); if (importFlags & ImportFlags.ForceNewImport && refSf !== context) { return null; } if (!isDeclaration(ref.node) && refSf === context) { return { kind: ReferenceEmitKind.Success, expression: new WrappedNodeExpr(ref.node), importedFile: null }; } if (ref.isAmbient && importFlags & ImportFlags.AllowAmbientReferences) { const identifier2 = identifierOfNode(ref.node); if (identifier2 !== null) { return { kind: ReferenceEmitKind.Success, expression: new WrappedNodeExpr(identifier2), importedFile: null }; } else { return null; } } const identifier = ref.getIdentityIn(context); if (identifier !== null) { return { kind: ReferenceEmitKind.Success, expression: new WrappedNodeExpr(identifier), importedFile: null }; } else { return null; } } }; var AbsoluteModuleStrategy = class { program; checker; moduleResolver; reflectionHost; moduleExportsCache = /* @__PURE__ */ new Map(); constructor(program, checker, moduleResolver, reflectionH