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AAM,IAAI,iCAAa,CACrB,oCAAoC;gBAClC,yDAA2B,CAAC,iBAAiB,CAAC,yBAAyB,CAAC,CAC3E,CAAC;SACH;QAED,OAAO,eAAe,CAAC;IACzB,CAAC;CACF;AAx5BD,wCAw5BC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as ts from 'typescript';\nimport { InternalError } from '@rushstack/node-core-library';\n\nimport { TypeScriptHelpers } from './TypeScriptHelpers';\nimport { AstSymbol } from './AstSymbol';\nimport { AstImport, type IAstImportOptions, AstImportKind } from './AstImport';\nimport { AstModule, AstModuleExportInfo } from './AstModule';\nimport { TypeScriptInternals } from './TypeScriptInternals';\nimport { SourceFileLocationFormatter } from './SourceFileLocationFormatter';\nimport type { IFetchAstSymbolOptions } from './AstSymbolTable';\nimport type { AstEntity } from './AstEntity';\nimport { AstNamespaceImport } from './AstNamespaceImport';\nimport { SyntaxHelpers } from './SyntaxHelpers';\n\n/**\n * Exposes the minimal APIs from AstSymbolTable that are needed by ExportAnalyzer.\n *\n * In particular, we want ExportAnalyzer to be able to call AstSymbolTable._fetchAstSymbol() even though it\n * is a very private API that should not be exposed to any other components.\n */\nexport interface IAstSymbolTable {\n fetchAstSymbol(options: IFetchAstSymbolOptions): AstSymbol | undefined;\n\n analyze(astEntity: AstEntity): void;\n}\n\n/**\n * Used with ExportAnalyzer.fetchAstModuleBySourceFile() to provide contextual information about how the source file\n * was imported.\n */\ninterface IAstModuleReference {\n /**\n * For example, if we are following a statement like `import { X } from 'some-package'`, this will be the\n * string `\"some-package\"`.\n */\n moduleSpecifier: string;\n\n /**\n * For example, if we are following a statement like `import { X } from 'some-package'`, this will be the\n * symbol for `X`.\n */\n moduleSpecifierSymbol: ts.Symbol;\n}\n\n/**\n * The ExportAnalyzer is an internal part of AstSymbolTable that has been moved out into its own source file\n * because it is a complex and mostly self-contained algorithm.\n *\n * Its job is to build up AstModule objects by crawling import statements to discover where declarations come from.\n * This is conceptually the same as the compiler's own TypeChecker.getExportsOfModule(), except that when\n * ExportAnalyzer encounters a declaration that was imported from an external package, it remembers how it was imported\n * (i.e. the AstImport object). Today the compiler API does not expose this information, which is crucial for\n * generating .d.ts rollups.\n */\nexport class ExportAnalyzer {\n private readonly _program: ts.Program;\n private readonly _typeChecker: ts.TypeChecker;\n private readonly _bundledPackageNames: ReadonlySet;\n private readonly _astSymbolTable: IAstSymbolTable;\n\n private readonly _astModulesByModuleSymbol: Map = new Map();\n\n // Used with isImportableAmbientSourceFile()\n private readonly _importableAmbientSourceFiles: Set = new Set();\n\n private readonly _astImportsByKey: Map = new Map();\n private readonly _astNamespaceImportByModule: Map = new Map();\n\n public constructor(\n program: ts.Program,\n typeChecker: ts.TypeChecker,\n bundledPackageNames: ReadonlySet,\n astSymbolTable: IAstSymbolTable\n ) {\n this._program = program;\n this._typeChecker = typeChecker;\n this._bundledPackageNames = bundledPackageNames;\n this._astSymbolTable = astSymbolTable;\n }\n\n /**\n * For a given source file, this analyzes all of its exports and produces an AstModule object.\n *\n * @param moduleReference - contextual information about the import statement that took us to this source file.\n * or `undefined` if this source file is the initial entry point\n * @param isExternal - whether the given `moduleReference` is external.\n */\n public fetchAstModuleFromSourceFile(\n sourceFile: ts.SourceFile,\n moduleReference: IAstModuleReference | undefined,\n isExternal: boolean\n ): AstModule {\n const moduleSymbol: ts.Symbol = this._getModuleSymbolFromSourceFile(sourceFile, moduleReference);\n\n // Don't traverse into a module that we already processed before:\n // The compiler allows m1 to have \"export * from 'm2'\" and \"export * from 'm3'\",\n // even if m2 and m3 both have \"export * from 'm4'\".\n let astModule: AstModule | undefined = this._astModulesByModuleSymbol.get(moduleSymbol);\n if (!astModule) {\n // (If moduleReference === undefined, then this is the entry point of the local project being analyzed.)\n const externalModulePath: string | undefined =\n moduleReference !== undefined && isExternal ? moduleReference.moduleSpecifier : undefined;\n\n astModule = new AstModule({ sourceFile, moduleSymbol, externalModulePath });\n\n this._astModulesByModuleSymbol.set(moduleSymbol, astModule);\n\n if (astModule.isExternal) {\n // It's an external package, so do the special simplified analysis that doesn't crawl into referenced modules\n for (const exportedSymbol of this._typeChecker.getExportsOfModule(moduleSymbol)) {\n if (externalModulePath === undefined) {\n throw new InternalError(\n 'Failed assertion: externalModulePath=undefined but astModule.isExternal=true'\n );\n }\n\n const followedSymbol: ts.Symbol = TypeScriptHelpers.followAliases(\n exportedSymbol,\n this._typeChecker\n );\n\n // Ignore virtual symbols that don't have any declarations\n const arbitraryDeclaration: ts.Declaration | undefined =\n TypeScriptHelpers.tryGetADeclaration(followedSymbol);\n if (arbitraryDeclaration) {\n const astSymbol: AstSymbol | undefined = this._astSymbolTable.fetchAstSymbol({\n followedSymbol: followedSymbol,\n isExternal: astModule.isExternal,\n includeNominalAnalysis: true,\n addIfMissing: true\n });\n\n if (!astSymbol) {\n throw new Error(\n `Unsupported export ${JSON.stringify(exportedSymbol.name)}:\\n` +\n SourceFileLocationFormatter.formatDeclaration(arbitraryDeclaration)\n );\n }\n\n astModule.cachedExportedEntities.set(exportedSymbol.name, astSymbol);\n }\n }\n } else {\n // The module is part of the local project, so do the full analysis\n\n if (moduleSymbol.exports) {\n // The \"export * from 'module-name';\" declarations are all attached to a single virtual symbol\n // whose name is InternalSymbolName.ExportStar\n const exportStarSymbol: ts.Symbol | undefined = moduleSymbol.exports.get(\n ts.InternalSymbolName.ExportStar\n );\n if (exportStarSymbol) {\n for (const exportStarDeclaration of exportStarSymbol.getDeclarations() || []) {\n if (ts.isExportDeclaration(exportStarDeclaration)) {\n const starExportedModule: AstModule | undefined = this._fetchSpecifierAstModule(\n exportStarDeclaration,\n exportStarSymbol\n );\n\n if (starExportedModule !== undefined) {\n astModule.starExportedModules.add(starExportedModule);\n }\n } else {\n // Ignore ExportDeclaration nodes that don't match the expected pattern\n // TODO: Should we report a warning?\n }\n }\n }\n }\n }\n }\n\n return astModule;\n }\n\n /**\n * Retrieves the symbol for the module corresponding to the ts.SourceFile that is being imported/exported.\n *\n * @remarks\n * The `module` keyword can be used to declare multiple TypeScript modules inside a single source file.\n * (This is a deprecated construct and mainly used for typings such as `@types/node`.) In this situation,\n * `moduleReference` helps us to fish out the correct module symbol.\n */\n private _getModuleSymbolFromSourceFile(\n sourceFile: ts.SourceFile,\n moduleReference: IAstModuleReference | undefined\n ): ts.Symbol {\n const moduleSymbol: ts.Symbol | undefined = TypeScriptInternals.tryGetSymbolForDeclaration(\n sourceFile,\n this._typeChecker\n );\n if (moduleSymbol !== undefined) {\n // This is the normal case. The SourceFile acts is a module and has a symbol.\n return moduleSymbol;\n }\n\n if (moduleReference !== undefined) {\n // But there is also an elaborate case where the source file contains one or more \"module\" declarations,\n // and our moduleReference took us to one of those.\n\n // eslint-disable-next-line no-bitwise\n if ((moduleReference.moduleSpecifierSymbol.flags & ts.SymbolFlags.Alias) !== 0) {\n // Follow the import/export declaration to one hop the exported item inside the target module\n let followedSymbol: ts.Symbol | undefined = TypeScriptInternals.getImmediateAliasedSymbol(\n moduleReference.moduleSpecifierSymbol,\n this._typeChecker\n );\n\n if (followedSymbol === undefined) {\n // This is a workaround for a compiler bug where getImmediateAliasedSymbol() sometimes returns undefined\n followedSymbol = this._typeChecker.getAliasedSymbol(moduleReference.moduleSpecifierSymbol);\n }\n\n if (followedSymbol !== undefined && followedSymbol !== moduleReference.moduleSpecifierSymbol) {\n // The parent of the exported symbol will be the module that we're importing from\n const parent: ts.Symbol | undefined = TypeScriptInternals.getSymbolParent(followedSymbol);\n if (parent !== undefined) {\n // Make sure the thing we found is a module\n // eslint-disable-next-line no-bitwise\n if ((parent.flags & ts.SymbolFlags.ValueModule) !== 0) {\n // Record that that this is an ambient module that can also be imported from\n this._importableAmbientSourceFiles.add(sourceFile);\n return parent;\n }\n }\n }\n }\n }\n\n throw new InternalError('Unable to determine module for: ' + sourceFile.fileName);\n }\n\n /**\n * Implementation of {@link AstSymbolTable.fetchAstModuleExportInfo}.\n */\n public fetchAstModuleExportInfo(entryPointAstModule: AstModule): AstModuleExportInfo {\n if (entryPointAstModule.isExternal) {\n throw new Error('fetchAstModuleExportInfo() is not supported for external modules');\n }\n\n if (entryPointAstModule.astModuleExportInfo === undefined) {\n const astModuleExportInfo: AstModuleExportInfo = new AstModuleExportInfo();\n\n this._collectAllExportsRecursive(astModuleExportInfo, entryPointAstModule, new Set());\n\n entryPointAstModule.astModuleExportInfo = astModuleExportInfo;\n }\n return entryPointAstModule.astModuleExportInfo;\n }\n\n /**\n * Returns true if the module specifier refers to an external package. Ignores packages listed in the\n * \"bundledPackages\" setting from the api-extractor.json config file.\n */\n private _isExternalModulePath(\n importOrExportDeclaration: ts.ImportDeclaration | ts.ExportDeclaration | ts.ImportTypeNode,\n moduleSpecifier: string\n ): boolean {\n const specifier: ts.TypeNode | ts.Expression | undefined = ts.isImportTypeNode(importOrExportDeclaration)\n ? importOrExportDeclaration.argument\n : importOrExportDeclaration.moduleSpecifier;\n const mode: ts.ModuleKind.CommonJS | ts.ModuleKind.ESNext | undefined =\n specifier && ts.isStringLiteralLike(specifier)\n ? TypeScriptInternals.getModeForUsageLocation(importOrExportDeclaration.getSourceFile(), specifier)\n : undefined;\n\n const resolvedModule: ts.ResolvedModuleFull | undefined = TypeScriptInternals.getResolvedModule(\n this._program,\n importOrExportDeclaration.getSourceFile(),\n moduleSpecifier,\n mode\n );\n\n if (resolvedModule === undefined) {\n // The TS compiler API `getResolvedModule` cannot resolve ambient modules. Thus, to match API Extractor's\n // previous behavior, simply treat all ambient modules as external. This bug is tracked by\n // https://github.com/microsoft/rushstack/issues/3335.\n return true;\n }\n\n // Either something like `jquery` or `@microsoft/api-extractor`.\n const packageName: string | undefined = resolvedModule.packageId?.name;\n if (packageName !== undefined && this._bundledPackageNames.has(packageName)) {\n return false;\n }\n\n if (resolvedModule.isExternalLibraryImport === undefined) {\n // This presumably means the compiler couldn't figure out whether the module was external, but we're not\n // sure how this can happen.\n throw new InternalError(\n `Cannot determine whether the module ${JSON.stringify(moduleSpecifier)} is external\\n` +\n SourceFileLocationFormatter.formatDeclaration(importOrExportDeclaration)\n );\n }\n\n return resolvedModule.isExternalLibraryImport;\n }\n\n /**\n * Returns true if when we analyzed sourceFile, we found that it contains an \"export=\" statement that allows\n * it to behave /either/ as an ambient module /or/ as a regular importable module. In this case,\n * `AstSymbolTable._fetchAstSymbol()` will analyze its symbols even though `TypeScriptHelpers.isAmbient()`\n * returns true.\n */\n public isImportableAmbientSourceFile(sourceFile: ts.SourceFile): boolean {\n return this._importableAmbientSourceFiles.has(sourceFile);\n }\n\n private _collectAllExportsRecursive(\n astModuleExportInfo: AstModuleExportInfo,\n astModule: AstModule,\n visitedAstModules: Set\n ): void {\n if (visitedAstModules.has(astModule)) {\n return;\n }\n visitedAstModules.add(astModule);\n\n if (astModule.isExternal) {\n astModuleExportInfo.starExportedExternalModules.add(astModule);\n } else {\n // Fetch each of the explicit exports for this module\n if (astModule.moduleSymbol.exports) {\n astModule.moduleSymbol.exports.forEach((exportSymbol, exportName) => {\n switch (exportName) {\n case ts.InternalSymbolName.ExportStar:\n case ts.InternalSymbolName.ExportEquals:\n break;\n default:\n // Don't collect the \"export default\" symbol unless this is the entry point module\n if (exportName !== ts.InternalSymbolName.Default || visitedAstModules.size === 1) {\n if (!astModuleExportInfo.exportedLocalEntities.has(exportSymbol.name)) {\n const astEntity: AstEntity = this._getExportOfAstModule(exportSymbol.name, astModule);\n\n if (astEntity instanceof AstSymbol && !astEntity.isExternal) {\n this._astSymbolTable.analyze(astEntity);\n }\n\n if (astEntity instanceof AstNamespaceImport && !astEntity.astModule.isExternal) {\n this._astSymbolTable.analyze(astEntity);\n }\n\n astModuleExportInfo.exportedLocalEntities.set(exportSymbol.name, astEntity);\n }\n }\n break;\n }\n });\n }\n\n for (const starExportedModule of astModule.starExportedModules) {\n this._collectAllExportsRecursive(astModuleExportInfo, starExportedModule, visitedAstModules);\n }\n }\n }\n\n /**\n * For a given symbol (which was encountered in the specified sourceFile), this fetches the AstEntity that it\n * refers to. For example, if a particular interface describes the return value of a function, this API can help\n * us determine a TSDoc declaration reference for that symbol (if the symbol is exported).\n */\n public fetchReferencedAstEntity(\n symbol: ts.Symbol,\n referringModuleIsExternal: boolean\n ): AstEntity | undefined {\n // eslint-disable-next-line no-bitwise\n if ((symbol.flags & ts.SymbolFlags.FunctionScopedVariable) !== 0) {\n // If a symbol refers back to part of its own definition, don't follow that rabbit hole\n // Example:\n //\n // function f(x: number): typeof x {\n // return 123;\n // }\n return undefined;\n }\n\n let current: ts.Symbol = symbol;\n\n if (referringModuleIsExternal) {\n current = TypeScriptHelpers.followAliases(symbol, this._typeChecker);\n } else {\n for (;;) {\n // Is this symbol an import/export that we need to follow to find the real declaration?\n for (const declaration of current.declarations || []) {\n let matchedAstEntity: AstEntity | undefined;\n matchedAstEntity = this._tryMatchExportDeclaration(declaration, current);\n if (matchedAstEntity !== undefined) {\n return matchedAstEntity;\n }\n matchedAstEntity = this._tryMatchImportDeclaration(declaration, current);\n if (matchedAstEntity !== undefined) {\n return matchedAstEntity;\n }\n }\n\n // eslint-disable-next-line no-bitwise\n if (!(current.flags & ts.SymbolFlags.Alias)) {\n break;\n }\n\n const currentAlias: ts.Symbol = TypeScriptInternals.getImmediateAliasedSymbol(\n current,\n this._typeChecker\n );\n // Stop if we reach the end of the chain\n if (!currentAlias || currentAlias === current) {\n break;\n }\n\n current = currentAlias;\n }\n }\n\n // Otherwise, assume it is a normal declaration\n const astSymbol: AstSymbol | undefined = this._astSymbolTable.fetchAstSymbol({\n followedSymbol: current,\n isExternal: referringModuleIsExternal,\n includeNominalAnalysis: false,\n addIfMissing: true\n });\n\n return astSymbol;\n }\n\n public fetchReferencedAstEntityFromImportTypeNode(\n node: ts.ImportTypeNode,\n referringModuleIsExternal: boolean\n ): AstEntity | undefined {\n const externalModulePath: string | undefined = this._tryGetExternalModulePath(node);\n\n if (externalModulePath) {\n let exportName: string;\n if (node.qualifier) {\n // Example input:\n // import('api-extractor-lib1-test').Lib1GenericType\n //\n // Extracted qualifier:\n // Lib1GenericType\n exportName = node.qualifier.getText().trim();\n } else {\n // Example input:\n // import('api-extractor-lib1-test')\n //\n // Extracted qualifier:\n // apiExtractorLib1Test\n\n exportName = SyntaxHelpers.makeCamelCaseIdentifier(externalModulePath);\n }\n\n return this._fetchAstImport(undefined, {\n importKind: AstImportKind.ImportType,\n exportName: exportName,\n modulePath: externalModulePath,\n isTypeOnly: false\n });\n }\n\n // Internal reference: AstSymbol\n const rightMostToken: ts.Identifier | ts.ImportTypeNode = node.qualifier\n ? node.qualifier.kind === ts.SyntaxKind.QualifiedName\n ? node.qualifier.right\n : node.qualifier\n : node;\n\n // There is no symbol property in a ImportTypeNode, obtain the associated export symbol\n const exportSymbol: ts.Symbol | undefined = this._typeChecker.getSymbolAtLocation(rightMostToken);\n if (!exportSymbol) {\n throw new InternalError(\n `Symbol not found for identifier: ${node.getText()}\\n` +\n SourceFileLocationFormatter.formatDeclaration(node)\n );\n }\n\n let followedSymbol: ts.Symbol = exportSymbol;\n for (;;) {\n const referencedAstEntity: AstEntity | undefined = this.fetchReferencedAstEntity(\n followedSymbol,\n referringModuleIsExternal\n );\n\n if (referencedAstEntity) {\n return referencedAstEntity;\n }\n\n const followedSymbolNode: ts.Node | ts.ImportTypeNode | undefined =\n followedSymbol.declarations && (followedSymbol.declarations[0] as ts.Node | undefined);\n\n if (followedSymbolNode && followedSymbolNode.kind === ts.SyntaxKind.ImportType) {\n return this.fetchReferencedAstEntityFromImportTypeNode(\n followedSymbolNode as ts.ImportTypeNode,\n referringModuleIsExternal\n );\n }\n\n // eslint-disable-next-line no-bitwise\n if (!(followedSymbol.flags & ts.SymbolFlags.Alias)) {\n break;\n }\n\n const currentAlias: ts.Symbol = this._typeChecker.getAliasedSymbol(followedSymbol);\n if (!currentAlias || currentAlias === followedSymbol) {\n break;\n }\n\n followedSymbol = currentAlias;\n }\n\n const astSymbol: AstSymbol | undefined = this._astSymbolTable.fetchAstSymbol({\n followedSymbol: followedSymbol,\n isExternal: referringModuleIsExternal,\n includeNominalAnalysis: false,\n addIfMissing: true\n });\n\n return astSymbol;\n }\n\n private _tryMatchExportDeclaration(\n declaration: ts.Declaration,\n declarationSymbol: ts.Symbol\n ): AstEntity | undefined {\n const exportDeclaration: ts.ExportDeclaration | undefined =\n TypeScriptHelpers.findFirstParent(declaration, ts.SyntaxKind.ExportDeclaration);\n\n if (exportDeclaration) {\n let exportName: string | undefined = undefined;\n\n if (declaration.kind === ts.SyntaxKind.ExportSpecifier) {\n // EXAMPLE:\n // \"export { A } from './file-a';\"\n //\n // ExportDeclaration:\n // ExportKeyword: pre=[export] sep=[ ]\n // NamedExports:\n // FirstPunctuation: pre=[{] sep=[ ]\n // SyntaxList:\n // ExportSpecifier: <------------- declaration\n // Identifier: pre=[A] sep=[ ]\n // CloseBraceToken: pre=[}] sep=[ ]\n // FromKeyword: pre=[from] sep=[ ]\n // StringLiteral: pre=['./file-a']\n // SemicolonToken: pre=[;]\n\n // Example: \" ExportName as RenamedName\"\n const exportSpecifier: ts.ExportSpecifier = declaration as ts.ExportSpecifier;\n exportName = (exportSpecifier.propertyName || exportSpecifier.name).getText().trim();\n } else if (declaration.kind === ts.SyntaxKind.NamespaceExport) {\n // EXAMPLE:\n // \"export * as theLib from 'the-lib';\"\n //\n // ExportDeclaration:\n // ExportKeyword: pre=[export] sep=[ ]\n // NamespaceExport:\n // AsteriskToken: pre=[*] sep=[ ]\n // AsKeyword: pre=[as] sep=[ ]\n // Identifier: pre=[theLib] sep=[ ]\n // FromKeyword: pre=[from] sep=[ ]\n // StringLiteral: pre=['the-lib']\n // SemicolonToken: pre=[;]\n\n // Issue tracking this feature: https://github.com/microsoft/rushstack/issues/2780\n throw new Error(\n `The \"export * as ___\" syntax is not supported yet; as a workaround,` +\n ` use \"import * as ___\" with a separate \"export { ___ }\" declaration\\n` +\n SourceFileLocationFormatter.formatDeclaration(declaration)\n );\n } else {\n throw new InternalError(\n `Unimplemented export declaration kind: ${declaration.getText()}\\n` +\n SourceFileLocationFormatter.formatDeclaration(declaration)\n );\n }\n\n // Ignore \"export { A }\" without a module specifier\n if (exportDeclaration.moduleSpecifier) {\n const externalModulePath: string | undefined = this._tryGetExternalModulePath(exportDeclaration);\n\n if (externalModulePath !== undefined) {\n return this._fetchAstImport(declarationSymbol, {\n importKind: AstImportKind.NamedImport,\n modulePath: externalModulePath,\n exportName: exportName,\n isTypeOnly: false\n });\n }\n\n return this._getExportOfSpecifierAstModule(exportName, exportDeclaration, declarationSymbol);\n }\n }\n\n return undefined;\n }\n\n private _tryMatchImportDeclaration(\n declaration: ts.Declaration,\n declarationSymbol: ts.Symbol\n ): AstEntity | undefined {\n const importDeclaration: ts.ImportDeclaration | undefined =\n TypeScriptHelpers.findFirstParent(declaration, ts.SyntaxKind.ImportDeclaration);\n\n if (importDeclaration) {\n const externalModulePath: string | undefined = this._tryGetExternalModulePath(importDeclaration);\n\n if (declaration.kind === ts.SyntaxKind.NamespaceImport) {\n // EXAMPLE:\n // \"import * as theLib from 'the-lib';\"\n //\n // ImportDeclaration:\n // ImportKeyword: pre=[import] sep=[ ]\n // ImportClause:\n // NamespaceImport: <------------- declaration\n // AsteriskToken: pre=[*] sep=[ ]\n // AsKeyword: pre=[as] sep=[ ]\n // Identifier: pre=[theLib] sep=[ ]\n // FromKeyword: pre=[from] sep=[ ]\n // StringLiteral: pre=['the-lib']\n // SemicolonToken: pre=[;]\n\n if (externalModulePath === undefined) {\n const astModule: AstModule = this._fetchSpecifierAstModule(importDeclaration, declarationSymbol);\n let namespaceImport: AstNamespaceImport | undefined =\n this._astNamespaceImportByModule.get(astModule);\n if (namespaceImport === undefined) {\n namespaceImport = new AstNamespaceImport({\n namespaceName: declarationSymbol.name,\n astModule: astModule,\n declaration: declaration,\n symbol: declarationSymbol\n });\n this._astNamespaceImportByModule.set(astModule, namespaceImport);\n }\n return namespaceImport;\n }\n\n // Here importSymbol=undefined because {@inheritDoc} and such are not going to work correctly for\n // a package or source file.\n return this._fetchAstImport(undefined, {\n importKind: AstImportKind.StarImport,\n exportName: declarationSymbol.name,\n modulePath: externalModulePath,\n isTypeOnly: ExportAnalyzer._getIsTypeOnly(importDeclaration)\n });\n }\n\n if (declaration.kind === ts.SyntaxKind.ImportSpecifier) {\n // EXAMPLE:\n // \"import { A, B } from 'the-lib';\"\n //\n // ImportDeclaration:\n // ImportKeyword: pre=[import] sep=[ ]\n // ImportClause:\n // NamedImports:\n // FirstPunctuation: pre=[{] sep=[ ]\n // SyntaxList:\n // ImportSpecifier: <------------- declaration\n // Identifier: pre=[A]\n // CommaToken: pre=[,] sep=[ ]\n // ImportSpecifier:\n // Identifier: pre=[B] sep=[ ]\n // CloseBraceToken: pre=[}] sep=[ ]\n // FromKeyword: pre=[from] sep=[ ]\n // StringLiteral: pre=['the-lib']\n // SemicolonToken: pre=[;]\n\n // Example: \" ExportName as RenamedName\"\n const importSpecifier: ts.ImportSpecifier = declaration as ts.ImportSpecifier;\n const exportName: string = (importSpecifier.propertyName || importSpecifier.name).getText().trim();\n\n if (externalModulePath !== undefined) {\n return this._fetchAstImport(declarationSymbol, {\n importKind: AstImportKind.NamedImport,\n modulePath: externalModulePath,\n exportName: exportName,\n isTypeOnly: ExportAnalyzer._getIsTypeOnly(importDeclaration)\n });\n }\n\n return this._getExportOfSpecifierAstModule(exportName, importDeclaration, declarationSymbol);\n } else if (declaration.kind === ts.SyntaxKind.ImportClause) {\n // EXAMPLE:\n // \"import A, { B } from './A';\"\n //\n // ImportDeclaration:\n // ImportKeyword: pre=[import] sep=[ ]\n // ImportClause: <------------- declaration (referring to A)\n // Identifier: pre=[A]\n // CommaToken: pre=[,] sep=[ ]\n // NamedImports:\n // FirstPunctuation: pre=[{] sep=[ ]\n // SyntaxList:\n // ImportSpecifier:\n // Identifier: pre=[B] sep=[ ]\n // CloseBraceToken: pre=[}] sep=[ ]\n // FromKeyword: pre=[from] sep=[ ]\n // StringLiteral: pre=['./A']\n // SemicolonToken: pre=[;]\n\n const importClause: ts.ImportClause = declaration as ts.ImportClause;\n const exportName: string = importClause.name\n ? importClause.name.getText().trim()\n : ts.InternalSymbolName.Default;\n\n if (externalModulePath !== undefined) {\n return this._fetchAstImport(declarationSymbol, {\n importKind: AstImportKind.DefaultImport,\n modulePath: externalModulePath,\n exportName,\n isTypeOnly: ExportAnalyzer._getIsTypeOnly(importDeclaration)\n });\n }\n\n return this._getExportOfSpecifierAstModule(\n ts.InternalSymbolName.Default,\n importDeclaration,\n declarationSymbol\n );\n } else {\n throw new InternalError(\n `Unimplemented import declaration kind: ${declaration.getText()}\\n` +\n SourceFileLocationFormatter.formatDeclaration(declaration)\n );\n }\n }\n\n if (ts.isImportEqualsDeclaration(declaration)) {\n // EXAMPLE:\n // import myLib = require('my-lib');\n //\n // ImportEqualsDeclaration:\n // ImportKeyword: pre=[import] sep=[ ]\n // Identifier: pre=[myLib] sep=[ ]\n // FirstAssignment: pre=[=] sep=[ ]\n // ExternalModuleReference:\n // RequireKeyword: pre=[require]\n // OpenParenToken: pre=[(]\n // StringLiteral: pre=['my-lib']\n // CloseParenToken: pre=[)]\n // SemicolonToken: pre=[;]\n if (ts.isExternalModuleReference(declaration.moduleReference)) {\n if (ts.isStringLiteralLike(declaration.moduleReference.expression)) {\n const variableName: string = TypeScriptInternals.getTextOfIdentifierOrLiteral(declaration.name);\n const externalModuleName: string = TypeScriptInternals.getTextOfIdentifierOrLiteral(\n declaration.moduleReference.expression\n );\n\n return this._fetchAstImport(declarationSymbol, {\n importKind: AstImportKind.EqualsImport,\n modulePath: externalModuleName,\n exportName: variableName,\n isTypeOnly: false\n });\n }\n }\n }\n\n return undefined;\n }\n\n private static _getIsTypeOnly(importDeclaration: ts.ImportDeclaration): boolean {\n if (importDeclaration.importClause) {\n return !!importDeclaration.importClause.isTypeOnly;\n }\n return false;\n }\n\n private _getExportOfSpecifierAstModule(\n exportName: string,\n importOrExportDeclaration: ts.ImportDeclaration | ts.ExportDeclaration,\n exportSymbol: ts.Symbol\n ): AstEntity {\n const specifierAstModule: AstModule = this._fetchSpecifierAstModule(\n importOrExportDeclaration,\n exportSymbol\n );\n const astEntity: AstEntity = this._getExportOfAstModule(exportName, specifierAstModule);\n return astEntity;\n }\n\n private _getExportOfAstModule(exportName: string, astModule: AstModule): AstEntity {\n const visitedAstModules: Set = new Set();\n const astEntity: AstEntity | undefined = this._tryGetExportOfAstModule(\n exportName,\n astModule,\n visitedAstModules\n );\n if (astEntity === undefined) {\n throw new InternalError(\n `Unable to analyze the export ${JSON.stringify(exportName)} in\\n` + astModule.sourceFile.fileName\n );\n }\n return astEntity;\n }\n\n /**\n * Implementation of {@link AstSymbolTable.tryGetExportOfAstModule}.\n */\n public tryGetExportOfAstModule(exportName: string, astModule: AstModule): AstEntity | undefined {\n const visitedAstModules: Set = new Set();\n return this._tryGetExportOfAstModule(exportName, astModule, visitedAstModules);\n }\n\n private _tryGetExportOfAstModule(\n exportName: string,\n astModule: AstModule,\n visitedAstModules: Set\n ): AstEntity | undefined {\n if (visitedAstModules.has(astModule)) {\n return undefined;\n }\n visitedAstModules.add(astModule);\n\n let astEntity: AstEntity | undefined = astModule.cachedExportedEntities.get(exportName);\n if (astEntity !== undefined) {\n return astEntity;\n }\n\n // Try the explicit exports\n const escapedExportName: ts.__String = ts.escapeLeadingUnderscores(exportName);\n if (astModule.moduleSymbol.exports) {\n const exportSymbol: ts.Symbol | undefined = astModule.moduleSymbol.exports.get(escapedExportName);\n if (exportSymbol) {\n astEntity = this.fetchReferencedAstEntity(exportSymbol, astModule.isExternal);\n\n if (astEntity !== undefined) {\n astModule.cachedExportedEntities.set(exportName, astEntity); // cache for next time\n return astEntity;\n }\n }\n }\n\n // Try each of the star imports\n for (const starExportedModule of astModule.starExportedModules) {\n astEntity = this._tryGetExportOfAstModule(exportName, starExportedModule, visitedAstModules);\n\n if (astEntity !== undefined) {\n if (starExportedModule.externalModulePath !== undefined) {\n // This entity was obtained from an external module, so return an AstImport instead\n const astSymbol: AstSymbol = astEntity as AstSymbol;\n return this._fetchAstImport(astSymbol.followedSymbol, {\n importKind: AstImportKind.NamedImport,\n modulePath: starExportedModule.externalModulePath,\n exportName: exportName,\n isTypeOnly: false\n });\n }\n\n return astEntity;\n }\n }\n\n return undefined;\n }\n\n private _tryGetExternalModulePath(\n importOrExportDeclaration: ts.ImportDeclaration | ts.ExportDeclaration | ts.ImportTypeNode\n ): string | undefined {\n const moduleSpecifier: string = this._getModuleSpecifier(importOrExportDeclaration);\n if (this._isExternalModulePath(importOrExportDeclaration, moduleSpecifier)) {\n return moduleSpecifier;\n }\n\n return undefined;\n }\n\n /**\n * Given an ImportDeclaration of the form `export { X } from \"___\";`, this interprets the module specifier (`\"___\"`)\n * and fetches the corresponding AstModule object.\n */\n private _fetchSpecifierAstModule(\n importOrExportDeclaration: ts.ImportDeclaration | ts.ExportDeclaration,\n exportSymbol: ts.Symbol\n ): AstModule {\n const moduleSpecifier: string = this._getModuleSpecifier(importOrExportDeclaration);\n const mode: ts.ModuleKind.CommonJS | ts.ModuleKind.ESNext | undefined =\n importOrExportDeclaration.moduleSpecifier &&\n ts.isStringLiteralLike(importOrExportDeclaration.moduleSpecifier)\n ? TypeScriptInternals.getModeForUsageLocation(\n importOrExportDeclaration.getSourceFile(),\n importOrExportDeclaration.moduleSpecifier\n )\n : undefined;\n const resolvedModule: ts.ResolvedModuleFull | undefined = TypeScriptInternals.getResolvedModule(\n this._program,\n importOrExportDeclaration.getSourceFile(),\n moduleSpecifier,\n mode\n );\n\n if (resolvedModule === undefined) {\n // Encountered in https://github.com/microsoft/rushstack/issues/1914.\n //\n // It's also possible for this to occur with ambient modules. However, in practice this doesn't happen\n // as API Extractor treats all ambient modules as external per the logic in `_isExternalModulePath`, and\n // thus this code path is never reached for ambient modules.\n throw new InternalError(\n `getResolvedModule() could not resolve module name ${JSON.stringify(moduleSpecifier)}\\n` +\n SourceFileLocationFormatter.formatDeclaration(importOrExportDeclaration)\n );\n }\n\n // Map the filename back to the corresponding SourceFile. This circuitous approach is needed because\n // we have no way to access the compiler's internal resolveExternalModuleName() function\n const moduleSourceFile: ts.SourceFile | undefined = this._program.getSourceFile(\n resolvedModule.resolvedFileName\n );\n if (!moduleSourceFile) {\n // This should not happen, since getResolvedModule() specifically looks up names that the compiler\n // found in export declarations for this source file\n throw new InternalError(\n `getSourceFile() failed to locate ${JSON.stringify(resolvedModule.resolvedFileName)}\\n` +\n SourceFileLocationFormatter.formatDeclaration(importOrExportDeclaration)\n );\n }\n\n const isExternal: boolean = this._isExternalModulePath(importOrExportDeclaration, moduleSpecifier);\n const moduleReference: IAstModuleReference = {\n moduleSpecifier: moduleSpecifier,\n moduleSpecifierSymbol: exportSymbol\n };\n const specifierAstModule: AstModule = this.fetchAstModuleFromSourceFile(\n moduleSourceFile,\n moduleReference,\n isExternal\n );\n\n return specifierAstModule;\n }\n\n private _fetchAstImport(importSymbol: ts.Symbol | undefined, options: IAstImportOptions): AstImport {\n const key: string = AstImport.getKey(options);\n\n let astImport: AstImport | undefined = this._astImportsByKey.get(key);\n\n if (!astImport) {\n astImport = new AstImport(options);\n this._astImportsByKey.set(key, astImport);\n\n if (importSymbol) {\n const followedSymbol: ts.Symbol = TypeScriptHelpers.followAliases(importSymbol, this._typeChecker);\n\n astImport.astSymbol = this._astSymbolTable.fetchAstSymbol({\n followedSymbol: followedSymbol,\n isExternal: true,\n includeNominalAnalysis: false,\n addIfMissing: true\n });\n }\n } else {\n // If we encounter at least one import that does not use the type-only form,\n // then the .d.ts rollup will NOT use \"import type\".\n if (!options.isTypeOnly) {\n astImport.isTypeOnlyEverywhere = false;\n }\n }\n\n return astImport;\n }\n\n private _getModuleSpecifier(\n importOrExportDeclaration: ts.ImportDeclaration | ts.ExportDeclaration | ts.ImportTypeNode\n ): string {\n // The name of the module, which could be like \"./SomeLocalFile' or like 'external-package/entry/point'\n const moduleSpecifier: string | undefined =\n TypeScriptHelpers.getModuleSpecifier(importOrExportDeclaration);\n\n if (!moduleSpecifier) {\n throw new InternalError(\n 'Unable to parse module specifier\\n' +\n SourceFileLocationFormatter.formatDeclaration(importOrExportDeclaration)\n );\n }\n\n return moduleSpecifier;\n }\n}\n"]}