@microsoft/api-extractor 7.29.5 → 7.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/rollup.d.ts +26 -2
  2. package/lib/api/ExtractorConfig.d.ts +4 -0
  3. package/lib/api/ExtractorConfig.d.ts.map +1 -1
  4. package/lib/api/ExtractorConfig.js +8 -0
  5. package/lib/api/ExtractorConfig.js.map +1 -1
  6. package/lib/api/ExtractorMessageId.d.ts +1 -1
  7. package/lib/api/ExtractorMessageId.js.map +1 -1
  8. package/lib/api/IConfigFile.d.ts +21 -1
  9. package/lib/api/IConfigFile.d.ts.map +1 -1
  10. package/lib/api/IConfigFile.js.map +1 -1
  11. package/lib/collector/Collector.d.ts +1 -1
  12. package/lib/collector/Collector.d.ts.map +1 -1
  13. package/lib/collector/Collector.js +43 -32
  14. package/lib/collector/Collector.js.map +1 -1
  15. package/lib/collector/CollectorEntity.d.ts +70 -28
  16. package/lib/collector/CollectorEntity.d.ts.map +1 -1
  17. package/lib/collector/CollectorEntity.js +95 -30
  18. package/lib/collector/CollectorEntity.js.map +1 -1
  19. package/lib/enhancers/DocCommentEnhancer.d.ts.map +1 -1
  20. package/lib/enhancers/DocCommentEnhancer.js +3 -1
  21. package/lib/enhancers/DocCommentEnhancer.js.map +1 -1
  22. package/lib/enhancers/ValidationEnhancer.d.ts.map +1 -1
  23. package/lib/enhancers/ValidationEnhancer.js +7 -5
  24. package/lib/enhancers/ValidationEnhancer.js.map +1 -1
  25. package/lib/generators/ApiModelGenerator.d.ts +2 -1
  26. package/lib/generators/ApiModelGenerator.d.ts.map +1 -1
  27. package/lib/generators/ApiModelGenerator.js +41 -17
  28. package/lib/generators/ApiModelGenerator.js.map +1 -1
  29. package/lib/generators/ApiReportGenerator.js +2 -2
  30. package/lib/generators/ApiReportGenerator.js.map +1 -1
  31. package/lib/generators/DeclarationReferenceGenerator.d.ts +4 -8
  32. package/lib/generators/DeclarationReferenceGenerator.d.ts.map +1 -1
  33. package/lib/generators/DeclarationReferenceGenerator.js +50 -67
  34. package/lib/generators/DeclarationReferenceGenerator.js.map +1 -1
  35. package/lib/schemas/api-extractor-defaults.json +4 -2
  36. package/lib/schemas/api-extractor-template.json +24 -5
  37. package/lib/schemas/api-extractor.schema.json +11 -1
  38. package/package.json +3 -4
@@ -1 +1 @@
1
- {"version":3,"file":"ApiReportGenerator.js","sourceRoot":"","sources":["../../src/generators/ApiReportGenerator.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,+CAAiC;AACjC,oEAAmE;AACnE,wEAA4D;AAE5D,sDAAmD;AACnD,qEAAkE;AAClE,2CAAwC;AAExC,+DAA4D;AAE5D,qDAAkD;AAClD,qDAAkD;AAElD,qDAAkD;AAClD,qDAAkD;AAClD,uEAAoE;AAGpE,yFAAsF;AAEtF,MAAa,kBAAkB;IAG7B;;;;;;OAMG;IACI,MAAM,CAAC,4BAA4B,CACxC,iBAAyB,EACzB,mBAA2B;QAE3B,wCAAwC;QACxC,MAAM,gBAAgB,GAAW,iBAAiB,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QAC1E,MAAM,kBAAkB,GAAW,mBAAmB,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QAC9E,OAAO,gBAAgB,KAAK,kBAAkB,CAAC;IACjD,CAAC;IAEM,MAAM,CAAC,yBAAyB,CAAC,SAAoB;QAC1D,MAAM,MAAM,GAAmB,IAAI,+BAAc,EAAE,CAAC;QACpD,MAAM,CAAC,iBAAiB,GAAG,IAAI,CAAC;QAEhC,MAAM,CAAC,SAAS,CACd;YACE,2BAA2B,SAAS,CAAC,cAAc,CAAC,IAAI,GAAG;YAC3D,EAAE;YACF,mGAAmG;YACnG,EAAE;SACH,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;QAEF,0DAA0D;QAC1D,MAA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ENSE in the project root for license information.\n\nimport * as ts from 'typescript';\nimport { Text, InternalError } from '@rushstack/node-core-library';\nimport { ReleaseTag } from '@microsoft/api-extractor-model';\n\nimport { Collector } from '../collector/Collector';\nimport { TypeScriptHelpers } from '../analyzer/TypeScriptHelpers';\nimport { Span } from '../analyzer/Span';\nimport { CollectorEntity } from '../collector/CollectorEntity';\nimport { AstDeclaration } from '../analyzer/AstDeclaration';\nimport { ApiItemMetadata } from '../collector/ApiItemMetadata';\nimport { AstImport } from '../analyzer/AstImport';\nimport { AstSymbol } from '../analyzer/AstSymbol';\nimport { ExtractorMessage } from '../api/ExtractorMessage';\nimport { IndentedWriter } from './IndentedWriter';\nimport { DtsEmitHelpers } from './DtsEmitHelpers';\nimport { AstNamespaceImport } from '../analyzer/AstNamespaceImport';\nimport { AstEntity } from '../analyzer/AstEntity';\nimport { AstModuleExportInfo } from '../analyzer/AstModule';\nimport { SourceFileLocationFormatter } from '../analyzer/SourceFileLocationFormatter';\n\nexport class ApiReportGenerator {\n private static _trimSpacesRegExp: RegExp = / +$/gm;\n\n /**\n * Compares the contents of two API files that were created using ApiFileGenerator,\n * and returns true if they are equivalent. Note that these files are not normally edited\n * by a human; the \"equivalence\" comparison here is intended to ignore spurious changes that\n * might be introduced by a tool, e.g. Git newline normalization or an editor that strips\n * whitespace when saving.\n */\n public static areEquivalentApiFileContents(\n actualFileContent: string,\n expectedFileContent: string\n ): boolean {\n // NOTE: \"\\s\" also matches \"\\r\" and \"\\n\"\n const normalizedActual: string = actualFileContent.replace(/[\\s]+/g, ' ');\n const normalizedExpected: string = expectedFileContent.replace(/[\\s]+/g, ' ');\n return normalizedActual === normalizedExpected;\n }\n\n public static generateReviewFileContent(collector: Collector): string {\n const writer: IndentedWriter = new IndentedWriter();\n writer.trimLeadingSpaces = true;\n\n writer.writeLine(\n [\n `## API Report File for \"${collector.workingPackage.name}\"`,\n ``,\n `> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).`,\n ``\n ].join('\\n')\n );\n\n // Write the opening delimiter for the Markdown code fence\n writer.writeLine('```ts\\n');\n\n // Emit the triple slash directives\n for (const typeDirectiveReference of Array.from(collector.dtsTypeReferenceDirectives).sort()) {\n // https://github.com/microsoft/TypeScript/blob/611ebc7aadd7a44a4c0447698bfda9222a78cb66/src/compiler/declarationEmitter.ts#L162\n writer.writeLine(`/// <reference types=\"${typeDirectiveReference}\" />`);\n }\n for (const libDirectiveReference of Array.from(collector.dtsLibReferenceDirectives).sort()) {\n writer.writeLine(`/// <reference lib=\"${libDirectiveReference}\" />`);\n }\n writer.ensureSkippedLine();\n\n // Emit the imports\n for (const entity of collector.entities) {\n if (entity.astEntity instanceof AstImport) {\n DtsEmitHelpers.emitImport(writer, entity, entity.astEntity);\n }\n }\n writer.ensureSkippedLine();\n\n // Emit the regular declarations\n for (const entity of collector.entities) {\n const astEntity: AstEntity = entity.astEntity;\n if (entity.consumable) {\n // First, collect the list of export names for this symbol. When reporting messages with\n // ExtractorMessage.properties.exportName, this will enable us to emit the warning comments alongside\n // the associated export statement.\n interface IExportToEmit {\n readonly exportName: string;\n readonly associatedMessages: ExtractorMessage[];\n }\n const exportsToEmit: Map<string, IExportToEmit> = new Map<string, IExportToEmit>();\n\n for (const exportName of entity.exportNames) {\n if (!entity.shouldInlineExport) {\n exportsToEmit.set(exportName, { exportName, associatedMessages: [] });\n }\n }\n\n if (astEntity instanceof AstSymbol) {\n // Emit all the declarations for this entity\n for (const astDeclaration of astEntity.astDeclarations || []) {\n // Get the messages associated with this declaration\n const fetchedMessages: ExtractorMessage[] =\n collector.messageRouter.fetchAssociatedMessagesForReviewFile(astDeclaration);\n\n // Peel off the messages associated with an export statement and store them\n // in IExportToEmit.associatedMessages (to be processed later). The remaining messages will\n // added to messagesToReport, to be emitted next to the declaration instead of the export statement.\n const messagesToReport: ExtractorMessage[] = [];\n for (const message of fetchedMessages) {\n if (message.properties.exportName) {\n const exportToEmit: IExportToEmit | undefined = exportsToEmit.get(\n message.properties.exportName\n );\n if (exportToEmit) {\n exportToEmit.associatedMessages.push(message);\n continue;\n }\n }\n messagesToReport.push(message);\n }\n\n writer.ensureSkippedLine();\n writer.write(ApiReportGenerator._getAedocSynopsis(collector, astDeclaration, messagesToReport));\n\n const span: Span = new Span(astDeclaration.declaration);\n\n const apiItemMetadata: ApiItemMetadata = collector.fetchApiItemMetadata(astDeclaration);\n if (apiItemMetadata.isPreapproved) {\n ApiReportGenerator._modifySpanForPreapproved(span);\n } else {\n ApiReportGenerator._modifySpan(collector, span, entity, astDeclaration, false);\n }\n\n span.writeModifiedText(writer);\n writer.ensureNewLine();\n }\n }\n\n if (astEntity instanceof AstNamespaceImport) {\n const astModuleExportInfo: AstModuleExportInfo = astEntity.fetchAstModuleExportInfo(collector);\n\n if (entity.nameForEmit === undefined) {\n // This should never happen\n throw new InternalError('referencedEntry.nameForEmit is undefined');\n }\n\n if (astModuleExportInfo.starExportedExternalModules.size > 0) {\n // We could support this, but we would need to find a way to safely represent it.\n throw new Error(\n `The ${entity.nameForEmit} namespace import includes a start export, which is not supported:\\n` +\n SourceFileLocationFormatter.formatDeclaration(astEntity.declaration)\n );\n }\n\n // Emit a synthetic declaration for the namespace. It will look like this:\n //\n // declare namespace example {\n // export {\n // f1,\n // f2\n // }\n // }\n //\n // Note that we do not try to relocate f1()/f2() to be inside the namespace because other type\n // signatures may reference them directly (without using the namespace qualifier).\n\n writer.ensureSkippedLine();\n writer.writeLine(`declare namespace ${entity.nameForEmit} {`);\n\n // all local exports of local imported module are just references to top-level declarations\n writer.increaseIndent();\n writer.writeLine('export {');\n writer.increaseIndent();\n\n const exportClauses: string[] = [];\n for (const [exportedName, exportedEntity] of astModuleExportInfo.exportedLocalEntities) {\n const collectorEntity: CollectorEntity | undefined =\n collector.tryGetCollectorEntity(exportedEntity);\n if (collectorEntity === undefined) {\n // This should never happen\n // top-level exports of local imported module should be added as collector entities before\n throw new InternalError(\n `Cannot find collector entity for ${entity.nameForEmit}.${exportedEntity.localName}`\n );\n }\n\n if (collectorEntity.nameForEmit === exportedName) {\n exportClauses.push(collectorEntity.nameForEmit);\n } else {\n exportClauses.push(`${collectorEntity.nameForEmit} as ${exportedName}`);\n }\n }\n writer.writeLine(exportClauses.join(',\\n'));\n\n writer.decreaseIndent();\n writer.writeLine('}'); // end of \"export { ... }\"\n writer.decreaseIndent();\n writer.writeLine('}'); // end of \"declare namespace { ... }\"\n }\n\n // Now emit the export statements for this entity.\n for (const exportToEmit of exportsToEmit.values()) {\n // Write any associated messages\n if (exportToEmit.associatedMessages.length > 0) {\n writer.ensureSkippedLine();\n for (const message of exportToEmit.associatedMessages) {\n ApiReportGenerator._writeLineAsComments(\n writer,\n 'Warning: ' + message.formatMessageWithoutLocation()\n );\n }\n }\n\n DtsEmitHelpers.emitNamedExport(writer, exportToEmit.exportName, entity);\n }\n writer.ensureSkippedLine();\n }\n }\n\n DtsEmitHelpers.emitStarExports(writer, collector);\n\n // Write the unassociated warnings at the bottom of the file\n const unassociatedMessages: ExtractorMessage[] =\n collector.messageRouter.fetchUnassociatedMessagesForReviewFile();\n if (unassociatedMessages.length > 0) {\n writer.ensureSkippedLine();\n ApiReportGenerator._writeLineAsComments(writer, 'Warnings were encountered during analysis:');\n ApiReportGenerator._writeLineAsComments(writer, '');\n for (const unassociatedMessage of unassociatedMessages) {\n ApiReportGenerator._writeLineAsComments(\n writer,\n unassociatedMessage.formatMessageWithLocation(collector.workingPackage.packageFolder)\n );\n }\n }\n\n if (collector.workingPackage.tsdocComment === undefined) {\n writer.ensureSkippedLine();\n ApiReportGenerator._writeLineAsComments(writer, '(No @packageDocumentation comment for this package)');\n }\n\n // Write the closing delimiter for the Markdown code fence\n writer.ensureSkippedLine();\n writer.writeLine('```');\n\n // Remove any trailing spaces\n return writer.toString().replace(ApiReportGenerator._trimSpacesRegExp, '');\n }\n\n /**\n * Before writing out a declaration, _modifySpan() applies various fixups to make it nice.\n */\n private static _modifySpan(\n collector: Collector,\n span: Span,\n entity: CollectorEntity,\n astDeclaration: AstDeclaration,\n insideTypeLiteral: boolean\n ): void {\n // Should we process this declaration at all?\n // eslint-disable-next-line no-bitwise\n if ((astDeclaration.modifierFlags & ts.ModifierFlags.Private) !== 0) {\n span.modification.skipAll();\n return;\n }\n\n const previousSpan: Span | undefined = span.previousSibling;\n\n let recurseChildren: boolean = true;\n let sortChildren: boolean = false;\n\n switch (span.kind) {\n case ts.SyntaxKind.JSDocComment:\n span.modification.skipAll();\n // For now, we don't transform JSDoc comment nodes at all\n recurseChildren = false;\n break;\n\n case ts.SyntaxKind.ExportKeyword:\n case ts.SyntaxKind.DefaultKeyword:\n case ts.SyntaxKind.DeclareKeyword:\n // Delete any explicit \"export\" or \"declare\" keywords -- we will re-add them below\n span.modification.skipAll();\n break;\n\n case ts.SyntaxKind.InterfaceKeyword:\n case ts.SyntaxKind.ClassKeyword:\n case ts.SyntaxKind.EnumKeyword:\n case ts.SyntaxKind.NamespaceKeyword:\n case ts.SyntaxKind.ModuleKeyword:\n case ts.SyntaxKind.TypeKeyword:\n case ts.SyntaxKind.FunctionKeyword:\n // Replace the stuff we possibly deleted above\n let replacedModifiers: string = '';\n\n if (entity.shouldInlineExport) {\n replacedModifiers = 'export ' + replacedModifiers;\n }\n\n if (previousSpan && previousSpan.kind === ts.SyntaxKind.SyntaxList) {\n // If there is a previous span of type SyntaxList, then apply it before any other modifiers\n // (e.g. \"abstract\") that appear there.\n previousSpan.modification.prefix = replacedModifiers + previousSpan.modification.prefix;\n } else {\n // Otherwise just stick it in front of this span\n span.modification.prefix = replacedModifiers + span.modification.prefix;\n }\n break;\n\n case ts.SyntaxKind.SyntaxList:\n if (span.parent) {\n if (AstDeclaration.isSupportedSyntaxKind(span.parent.kind)) {\n // If the immediate parent is an API declaration, and the immediate children are API declarations,\n // then sort the children alphabetically\n sortChildren = true;\n } else if (span.parent.kind === ts.SyntaxKind.ModuleBlock) {\n // Namespaces are special because their chain goes ModuleDeclaration -> ModuleBlock -> SyntaxList\n sortChildren = true;\n }\n }\n break;\n\n case ts.SyntaxKind.VariableDeclaration:\n if (!span.parent) {\n // The VariableDeclaration node is part of a VariableDeclarationList, however\n // the Entry.followedSymbol points to the VariableDeclaration part because\n // multiple definitions might share the same VariableDeclarationList.\n //\n // Since we are emitting a separate declaration for each one, we need to look upwards\n // in the ts.Node tree and write a copy of the enclosing VariableDeclarationList\n // content (e.g. \"var\" from \"var x=1, y=2\").\n const list: ts.VariableDeclarationList | undefined = TypeScriptHelpers.matchAncestor(span.node, [\n ts.SyntaxKind.VariableDeclarationList,\n ts.SyntaxKind.VariableDeclaration\n ]);\n if (!list) {\n // This should not happen unless the compiler API changes somehow\n throw new InternalError('Unsupported variable declaration');\n }\n const listPrefix: string = list\n .getSourceFile()\n .text.substring(list.getStart(), list.declarations[0].getStart());\n span.modification.prefix = listPrefix + span.modification.prefix;\n span.modification.suffix = ';';\n\n if (entity.shouldInlineExport) {\n span.modification.prefix = 'export ' + span.modification.prefix;\n }\n }\n break;\n\n case ts.SyntaxKind.Identifier:\n const referencedEntity: CollectorEntity | undefined = collector.tryGetEntityForNode(\n span.node as ts.Identifier\n );\n\n if (referencedEntity) {\n if (!referencedEntity.nameForEmit) {\n // This should never happen\n throw new InternalError('referencedEntry.nameForEmit is undefined');\n }\n\n span.modification.prefix = referencedEntity.nameForEmit;\n // For debugging:\n // span.modification.prefix += '/*R=FIX*/';\n } else {\n // For debugging:\n // span.modification.prefix += '/*R=KEEP*/';\n }\n\n break;\n\n case ts.SyntaxKind.TypeLiteral:\n insideTypeLiteral = true;\n break;\n\n case ts.SyntaxKind.ImportType:\n DtsEmitHelpers.modifyImportTypeSpan(\n collector,\n span,\n astDeclaration,\n (childSpan, childAstDeclaration) => {\n ApiReportGenerator._modifySpan(\n collector,\n childSpan,\n entity,\n childAstDeclaration,\n insideTypeLiteral\n );\n }\n );\n break;\n }\n\n if (recurseChildren) {\n for (const child of span.children) {\n let childAstDeclaration: AstDeclaration = astDeclaration;\n\n if (AstDeclaration.isSupportedSyntaxKind(child.kind)) {\n childAstDeclaration = collector.astSymbolTable.getChildAstDeclarationByNode(\n child.node,\n astDeclaration\n );\n\n if (sortChildren) {\n span.modification.sortChildren = true;\n child.modification.sortKey = Collector.getSortKeyIgnoringUnderscore(\n childAstDeclaration.astSymbol.localName\n );\n }\n\n if (!insideTypeLiteral) {\n const messagesToReport: ExtractorMessage[] =\n collector.messageRouter.fetchAssociatedMessagesForReviewFile(childAstDeclaration);\n const aedocSynopsis: string = ApiReportGenerator._getAedocSynopsis(\n collector,\n childAstDeclaration,\n messagesToReport\n );\n\n child.modification.prefix = aedocSynopsis + child.modification.prefix;\n }\n }\n\n ApiReportGenerator._modifySpan(collector, child, entity, childAstDeclaration, insideTypeLiteral);\n }\n }\n }\n\n /**\n * For declarations marked as `@preapproved`, this is used instead of _modifySpan().\n */\n private static _modifySpanForPreapproved(span: Span): void {\n // Match something like this:\n //\n // ClassDeclaration:\n // SyntaxList:\n // ExportKeyword: pre=[export] sep=[ ]\n // DeclareKeyword: pre=[declare] sep=[ ]\n // ClassKeyword: pre=[class] sep=[ ]\n // Identifier: pre=[_PreapprovedClass] sep=[ ]\n // FirstPunctuation: pre=[{] sep=[\\n\\n ]\n // SyntaxList:\n // ...\n // CloseBraceToken: pre=[}]\n //\n // or this:\n // ModuleDeclaration:\n // SyntaxList:\n // ExportKeyword: pre=[export] sep=[ ]\n // DeclareKeyword: pre=[declare] sep=[ ]\n // NamespaceKeyword: pre=[namespace] sep=[ ]\n // Identifier: pre=[_PreapprovedNamespace] sep=[ ]\n // ModuleBlock:\n // FirstPunctuation: pre=[{] sep=[\\n\\n ]\n // SyntaxList:\n // ...\n // CloseBraceToken: pre=[}]\n //\n // And reduce it to something like this:\n //\n // // @internal (undocumented)\n // class _PreapprovedClass { /* (preapproved) */ }\n //\n\n let skipRest: boolean = false;\n for (const child of span.children) {\n if (skipRest || child.kind === ts.SyntaxKind.SyntaxList || child.kind === ts.SyntaxKind.JSDocComment) {\n child.modification.skipAll();\n }\n if (child.kind === ts.SyntaxKind.Identifier) {\n skipRest = true;\n child.modification.omitSeparatorAfter = true;\n child.modification.suffix = ' { /* (preapproved) */ }';\n }\n }\n }\n\n /**\n * Writes a synopsis of the AEDoc comments, which indicates the release tag,\n * whether the item has been documented, and any warnings that were detected\n * by the analysis.\n */\n private static _getAedocSynopsis(\n collector: Collector,\n astDeclaration: AstDeclaration,\n messagesToReport: ExtractorMessage[]\n ): string {\n const writer: IndentedWriter = new IndentedWriter();\n\n for (const message of messagesToReport) {\n ApiReportGenerator._writeLineAsComments(writer, 'Warning: ' + message.formatMessageWithoutLocation());\n }\n\n if (!collector.isAncillaryDeclaration(astDeclaration)) {\n const footerParts: string[] = [];\n const apiItemMetadata: ApiItemMetadata = collector.fetchApiItemMetadata(astDeclaration);\n if (!apiItemMetadata.releaseTagSameAsParent) {\n if (apiItemMetadata.effectiveReleaseTag !== ReleaseTag.None) {\n footerParts.push(ReleaseTag.getTagName(apiItemMetadata.effectiveReleaseTag));\n }\n }\n\n if (apiItemMetadata.isSealed) {\n footerParts.push('@sealed');\n }\n\n if (apiItemMetadata.isVirtual) {\n footerParts.push('@virtual');\n }\n\n if (apiItemMetadata.isOverride) {\n footerParts.push('@override');\n }\n\n if (apiItemMetadata.isEventProperty) {\n footerParts.push('@eventProperty');\n }\n\n if (apiItemMetadata.tsdocComment) {\n if (apiItemMetadata.tsdocComment.deprecatedBlock) {\n footerParts.push('@deprecated');\n }\n }\n\n if (apiItemMetadata.needsDocumentation) {\n footerParts.push('(undocumented)');\n }\n\n if (footerParts.length > 0) {\n if (messagesToReport.length > 0) {\n ApiReportGenerator._writeLineAsComments(writer, ''); // skip a line after the warnings\n }\n\n ApiReportGenerator._writeLineAsComments(writer, footerParts.join(' '));\n }\n }\n\n return writer.toString();\n }\n\n private static _writeLineAsComments(writer: IndentedWriter, line: string): void {\n const lines: string[] = Text.convertToLf(line).split('\\n');\n for (const realLine of lines) {\n writer.write('// ');\n writer.write(realLine);\n writer.writeLine();\n }\n }\n}\n"]}
1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CAAC,YAAY,EAAE;gBAChC,IAAI,eAAe,CAAC,YAAY,CAAC,eAAe,EAAE;oBAChD,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;iBACjC;aACF;YAED,IAAI,eAAe,CAAC,kBAAkB,EAAE;gBACtC,WAAW,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;aACpC;YAED,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC1B,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE;oBAC/B,kBAAkB,CAAC,oBAAoB,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,iCAAiC;iBACvF;gBAED,kBAAkB,CAAC,oBAAoB,CAAC,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;aACxE;SACF;QAED,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;IAEO,MAAM,CAAC,oBAAoB,CAAC,MAAsB,EAAE,IAAY;QACtE,MAAM,KAAK,GAAa,wBAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC3D,KAAK,MAAM,QAAQ,IAAI,KAAK,EAAE;YAC5B,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YACvB,MAAM,CAAC,SAAS,EAAE,CAAC;SACpB;IACH,CAAC;;AA5gBH,gDA6gBC;AA5gBgB,oCAAiB,GAAW,OAAO,CAAC","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 { Text, InternalError } from '@rushstack/node-core-library';\nimport { ReleaseTag } from '@microsoft/api-extractor-model';\n\nimport { Collector } from '../collector/Collector';\nimport { TypeScriptHelpers } from '../analyzer/TypeScriptHelpers';\nimport { Span } from '../analyzer/Span';\nimport { CollectorEntity } from '../collector/CollectorEntity';\nimport { AstDeclaration } from '../analyzer/AstDeclaration';\nimport { ApiItemMetadata } from '../collector/ApiItemMetadata';\nimport { AstImport } from '../analyzer/AstImport';\nimport { AstSymbol } from '../analyzer/AstSymbol';\nimport { ExtractorMessage } from '../api/ExtractorMessage';\nimport { IndentedWriter } from './IndentedWriter';\nimport { DtsEmitHelpers } from './DtsEmitHelpers';\nimport { AstNamespaceImport } from '../analyzer/AstNamespaceImport';\nimport { AstEntity } from '../analyzer/AstEntity';\nimport { AstModuleExportInfo } from '../analyzer/AstModule';\nimport { SourceFileLocationFormatter } from '../analyzer/SourceFileLocationFormatter';\n\nexport class ApiReportGenerator {\n private static _trimSpacesRegExp: RegExp = / +$/gm;\n\n /**\n * Compares the contents of two API files that were created using ApiFileGenerator,\n * and returns true if they are equivalent. Note that these files are not normally edited\n * by a human; the \"equivalence\" comparison here is intended to ignore spurious changes that\n * might be introduced by a tool, e.g. Git newline normalization or an editor that strips\n * whitespace when saving.\n */\n public static areEquivalentApiFileContents(\n actualFileContent: string,\n expectedFileContent: string\n ): boolean {\n // NOTE: \"\\s\" also matches \"\\r\" and \"\\n\"\n const normalizedActual: string = actualFileContent.replace(/[\\s]+/g, ' ');\n const normalizedExpected: string = expectedFileContent.replace(/[\\s]+/g, ' ');\n return normalizedActual === normalizedExpected;\n }\n\n public static generateReviewFileContent(collector: Collector): string {\n const writer: IndentedWriter = new IndentedWriter();\n writer.trimLeadingSpaces = true;\n\n writer.writeLine(\n [\n `## API Report File for \"${collector.workingPackage.name}\"`,\n ``,\n `> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).`,\n ``\n ].join('\\n')\n );\n\n // Write the opening delimiter for the Markdown code fence\n writer.writeLine('```ts\\n');\n\n // Emit the triple slash directives\n for (const typeDirectiveReference of Array.from(collector.dtsTypeReferenceDirectives).sort()) {\n // https://github.com/microsoft/TypeScript/blob/611ebc7aadd7a44a4c0447698bfda9222a78cb66/src/compiler/declarationEmitter.ts#L162\n writer.writeLine(`/// <reference types=\"${typeDirectiveReference}\" />`);\n }\n for (const libDirectiveReference of Array.from(collector.dtsLibReferenceDirectives).sort()) {\n writer.writeLine(`/// <reference lib=\"${libDirectiveReference}\" />`);\n }\n writer.ensureSkippedLine();\n\n // Emit the imports\n for (const entity of collector.entities) {\n if (entity.astEntity instanceof AstImport) {\n DtsEmitHelpers.emitImport(writer, entity, entity.astEntity);\n }\n }\n writer.ensureSkippedLine();\n\n // Emit the regular declarations\n for (const entity of collector.entities) {\n const astEntity: AstEntity = entity.astEntity;\n if (entity.consumable || collector.extractorConfig.apiReportIncludeForgottenExports) {\n // First, collect the list of export names for this symbol. When reporting messages with\n // ExtractorMessage.properties.exportName, this will enable us to emit the warning comments alongside\n // the associated export statement.\n interface IExportToEmit {\n readonly exportName: string;\n readonly associatedMessages: ExtractorMessage[];\n }\n const exportsToEmit: Map<string, IExportToEmit> = new Map<string, IExportToEmit>();\n\n for (const exportName of entity.exportNames) {\n if (!entity.shouldInlineExport) {\n exportsToEmit.set(exportName, { exportName, associatedMessages: [] });\n }\n }\n\n if (astEntity instanceof AstSymbol) {\n // Emit all the declarations for this entity\n for (const astDeclaration of astEntity.astDeclarations || []) {\n // Get the messages associated with this declaration\n const fetchedMessages: ExtractorMessage[] =\n collector.messageRouter.fetchAssociatedMessagesForReviewFile(astDeclaration);\n\n // Peel off the messages associated with an export statement and store them\n // in IExportToEmit.associatedMessages (to be processed later). The remaining messages will\n // added to messagesToReport, to be emitted next to the declaration instead of the export statement.\n const messagesToReport: ExtractorMessage[] = [];\n for (const message of fetchedMessages) {\n if (message.properties.exportName) {\n const exportToEmit: IExportToEmit | undefined = exportsToEmit.get(\n message.properties.exportName\n );\n if (exportToEmit) {\n exportToEmit.associatedMessages.push(message);\n continue;\n }\n }\n messagesToReport.push(message);\n }\n\n writer.ensureSkippedLine();\n writer.write(ApiReportGenerator._getAedocSynopsis(collector, astDeclaration, messagesToReport));\n\n const span: Span = new Span(astDeclaration.declaration);\n\n const apiItemMetadata: ApiItemMetadata = collector.fetchApiItemMetadata(astDeclaration);\n if (apiItemMetadata.isPreapproved) {\n ApiReportGenerator._modifySpanForPreapproved(span);\n } else {\n ApiReportGenerator._modifySpan(collector, span, entity, astDeclaration, false);\n }\n\n span.writeModifiedText(writer);\n writer.ensureNewLine();\n }\n }\n\n if (astEntity instanceof AstNamespaceImport) {\n const astModuleExportInfo: AstModuleExportInfo = astEntity.fetchAstModuleExportInfo(collector);\n\n if (entity.nameForEmit === undefined) {\n // This should never happen\n throw new InternalError('referencedEntry.nameForEmit is undefined');\n }\n\n if (astModuleExportInfo.starExportedExternalModules.size > 0) {\n // We could support this, but we would need to find a way to safely represent it.\n throw new Error(\n `The ${entity.nameForEmit} namespace import includes a star export, which is not supported:\\n` +\n SourceFileLocationFormatter.formatDeclaration(astEntity.declaration)\n );\n }\n\n // Emit a synthetic declaration for the namespace. It will look like this:\n //\n // declare namespace example {\n // export {\n // f1,\n // f2\n // }\n // }\n //\n // Note that we do not try to relocate f1()/f2() to be inside the namespace because other type\n // signatures may reference them directly (without using the namespace qualifier).\n\n writer.ensureSkippedLine();\n writer.writeLine(`declare namespace ${entity.nameForEmit} {`);\n\n // all local exports of local imported module are just references to top-level declarations\n writer.increaseIndent();\n writer.writeLine('export {');\n writer.increaseIndent();\n\n const exportClauses: string[] = [];\n for (const [exportedName, exportedEntity] of astModuleExportInfo.exportedLocalEntities) {\n const collectorEntity: CollectorEntity | undefined =\n collector.tryGetCollectorEntity(exportedEntity);\n if (collectorEntity === undefined) {\n // This should never happen\n // top-level exports of local imported module should be added as collector entities before\n throw new InternalError(\n `Cannot find collector entity for ${entity.nameForEmit}.${exportedEntity.localName}`\n );\n }\n\n if (collectorEntity.nameForEmit === exportedName) {\n exportClauses.push(collectorEntity.nameForEmit);\n } else {\n exportClauses.push(`${collectorEntity.nameForEmit} as ${exportedName}`);\n }\n }\n writer.writeLine(exportClauses.join(',\\n'));\n\n writer.decreaseIndent();\n writer.writeLine('}'); // end of \"export { ... }\"\n writer.decreaseIndent();\n writer.writeLine('}'); // end of \"declare namespace { ... }\"\n }\n\n // Now emit the export statements for this entity.\n for (const exportToEmit of exportsToEmit.values()) {\n // Write any associated messages\n if (exportToEmit.associatedMessages.length > 0) {\n writer.ensureSkippedLine();\n for (const message of exportToEmit.associatedMessages) {\n ApiReportGenerator._writeLineAsComments(\n writer,\n 'Warning: ' + message.formatMessageWithoutLocation()\n );\n }\n }\n\n DtsEmitHelpers.emitNamedExport(writer, exportToEmit.exportName, entity);\n }\n writer.ensureSkippedLine();\n }\n }\n\n DtsEmitHelpers.emitStarExports(writer, collector);\n\n // Write the unassociated warnings at the bottom of the file\n const unassociatedMessages: ExtractorMessage[] =\n collector.messageRouter.fetchUnassociatedMessagesForReviewFile();\n if (unassociatedMessages.length > 0) {\n writer.ensureSkippedLine();\n ApiReportGenerator._writeLineAsComments(writer, 'Warnings were encountered during analysis:');\n ApiReportGenerator._writeLineAsComments(writer, '');\n for (const unassociatedMessage of unassociatedMessages) {\n ApiReportGenerator._writeLineAsComments(\n writer,\n unassociatedMessage.formatMessageWithLocation(collector.workingPackage.packageFolder)\n );\n }\n }\n\n if (collector.workingPackage.tsdocComment === undefined) {\n writer.ensureSkippedLine();\n ApiReportGenerator._writeLineAsComments(writer, '(No @packageDocumentation comment for this package)');\n }\n\n // Write the closing delimiter for the Markdown code fence\n writer.ensureSkippedLine();\n writer.writeLine('```');\n\n // Remove any trailing spaces\n return writer.toString().replace(ApiReportGenerator._trimSpacesRegExp, '');\n }\n\n /**\n * Before writing out a declaration, _modifySpan() applies various fixups to make it nice.\n */\n private static _modifySpan(\n collector: Collector,\n span: Span,\n entity: CollectorEntity,\n astDeclaration: AstDeclaration,\n insideTypeLiteral: boolean\n ): void {\n // Should we process this declaration at all?\n // eslint-disable-next-line no-bitwise\n if ((astDeclaration.modifierFlags & ts.ModifierFlags.Private) !== 0) {\n span.modification.skipAll();\n return;\n }\n\n const previousSpan: Span | undefined = span.previousSibling;\n\n let recurseChildren: boolean = true;\n let sortChildren: boolean = false;\n\n switch (span.kind) {\n case ts.SyntaxKind.JSDocComment:\n span.modification.skipAll();\n // For now, we don't transform JSDoc comment nodes at all\n recurseChildren = false;\n break;\n\n case ts.SyntaxKind.ExportKeyword:\n case ts.SyntaxKind.DefaultKeyword:\n case ts.SyntaxKind.DeclareKeyword:\n // Delete any explicit \"export\" or \"declare\" keywords -- we will re-add them below\n span.modification.skipAll();\n break;\n\n case ts.SyntaxKind.InterfaceKeyword:\n case ts.SyntaxKind.ClassKeyword:\n case ts.SyntaxKind.EnumKeyword:\n case ts.SyntaxKind.NamespaceKeyword:\n case ts.SyntaxKind.ModuleKeyword:\n case ts.SyntaxKind.TypeKeyword:\n case ts.SyntaxKind.FunctionKeyword:\n // Replace the stuff we possibly deleted above\n let replacedModifiers: string = '';\n\n if (entity.shouldInlineExport) {\n replacedModifiers = 'export ' + replacedModifiers;\n }\n\n if (previousSpan && previousSpan.kind === ts.SyntaxKind.SyntaxList) {\n // If there is a previous span of type SyntaxList, then apply it before any other modifiers\n // (e.g. \"abstract\") that appear there.\n previousSpan.modification.prefix = replacedModifiers + previousSpan.modification.prefix;\n } else {\n // Otherwise just stick it in front of this span\n span.modification.prefix = replacedModifiers + span.modification.prefix;\n }\n break;\n\n case ts.SyntaxKind.SyntaxList:\n if (span.parent) {\n if (AstDeclaration.isSupportedSyntaxKind(span.parent.kind)) {\n // If the immediate parent is an API declaration, and the immediate children are API declarations,\n // then sort the children alphabetically\n sortChildren = true;\n } else if (span.parent.kind === ts.SyntaxKind.ModuleBlock) {\n // Namespaces are special because their chain goes ModuleDeclaration -> ModuleBlock -> SyntaxList\n sortChildren = true;\n }\n }\n break;\n\n case ts.SyntaxKind.VariableDeclaration:\n if (!span.parent) {\n // The VariableDeclaration node is part of a VariableDeclarationList, however\n // the Entry.followedSymbol points to the VariableDeclaration part because\n // multiple definitions might share the same VariableDeclarationList.\n //\n // Since we are emitting a separate declaration for each one, we need to look upwards\n // in the ts.Node tree and write a copy of the enclosing VariableDeclarationList\n // content (e.g. \"var\" from \"var x=1, y=2\").\n const list: ts.VariableDeclarationList | undefined = TypeScriptHelpers.matchAncestor(span.node, [\n ts.SyntaxKind.VariableDeclarationList,\n ts.SyntaxKind.VariableDeclaration\n ]);\n if (!list) {\n // This should not happen unless the compiler API changes somehow\n throw new InternalError('Unsupported variable declaration');\n }\n const listPrefix: string = list\n .getSourceFile()\n .text.substring(list.getStart(), list.declarations[0].getStart());\n span.modification.prefix = listPrefix + span.modification.prefix;\n span.modification.suffix = ';';\n\n if (entity.shouldInlineExport) {\n span.modification.prefix = 'export ' + span.modification.prefix;\n }\n }\n break;\n\n case ts.SyntaxKind.Identifier:\n const referencedEntity: CollectorEntity | undefined = collector.tryGetEntityForNode(\n span.node as ts.Identifier\n );\n\n if (referencedEntity) {\n if (!referencedEntity.nameForEmit) {\n // This should never happen\n throw new InternalError('referencedEntry.nameForEmit is undefined');\n }\n\n span.modification.prefix = referencedEntity.nameForEmit;\n // For debugging:\n // span.modification.prefix += '/*R=FIX*/';\n } else {\n // For debugging:\n // span.modification.prefix += '/*R=KEEP*/';\n }\n\n break;\n\n case ts.SyntaxKind.TypeLiteral:\n insideTypeLiteral = true;\n break;\n\n case ts.SyntaxKind.ImportType:\n DtsEmitHelpers.modifyImportTypeSpan(\n collector,\n span,\n astDeclaration,\n (childSpan, childAstDeclaration) => {\n ApiReportGenerator._modifySpan(\n collector,\n childSpan,\n entity,\n childAstDeclaration,\n insideTypeLiteral\n );\n }\n );\n break;\n }\n\n if (recurseChildren) {\n for (const child of span.children) {\n let childAstDeclaration: AstDeclaration = astDeclaration;\n\n if (AstDeclaration.isSupportedSyntaxKind(child.kind)) {\n childAstDeclaration = collector.astSymbolTable.getChildAstDeclarationByNode(\n child.node,\n astDeclaration\n );\n\n if (sortChildren) {\n span.modification.sortChildren = true;\n child.modification.sortKey = Collector.getSortKeyIgnoringUnderscore(\n childAstDeclaration.astSymbol.localName\n );\n }\n\n if (!insideTypeLiteral) {\n const messagesToReport: ExtractorMessage[] =\n collector.messageRouter.fetchAssociatedMessagesForReviewFile(childAstDeclaration);\n const aedocSynopsis: string = ApiReportGenerator._getAedocSynopsis(\n collector,\n childAstDeclaration,\n messagesToReport\n );\n\n child.modification.prefix = aedocSynopsis + child.modification.prefix;\n }\n }\n\n ApiReportGenerator._modifySpan(collector, child, entity, childAstDeclaration, insideTypeLiteral);\n }\n }\n }\n\n /**\n * For declarations marked as `@preapproved`, this is used instead of _modifySpan().\n */\n private static _modifySpanForPreapproved(span: Span): void {\n // Match something like this:\n //\n // ClassDeclaration:\n // SyntaxList:\n // ExportKeyword: pre=[export] sep=[ ]\n // DeclareKeyword: pre=[declare] sep=[ ]\n // ClassKeyword: pre=[class] sep=[ ]\n // Identifier: pre=[_PreapprovedClass] sep=[ ]\n // FirstPunctuation: pre=[{] sep=[\\n\\n ]\n // SyntaxList:\n // ...\n // CloseBraceToken: pre=[}]\n //\n // or this:\n // ModuleDeclaration:\n // SyntaxList:\n // ExportKeyword: pre=[export] sep=[ ]\n // DeclareKeyword: pre=[declare] sep=[ ]\n // NamespaceKeyword: pre=[namespace] sep=[ ]\n // Identifier: pre=[_PreapprovedNamespace] sep=[ ]\n // ModuleBlock:\n // FirstPunctuation: pre=[{] sep=[\\n\\n ]\n // SyntaxList:\n // ...\n // CloseBraceToken: pre=[}]\n //\n // And reduce it to something like this:\n //\n // // @internal (undocumented)\n // class _PreapprovedClass { /* (preapproved) */ }\n //\n\n let skipRest: boolean = false;\n for (const child of span.children) {\n if (skipRest || child.kind === ts.SyntaxKind.SyntaxList || child.kind === ts.SyntaxKind.JSDocComment) {\n child.modification.skipAll();\n }\n if (child.kind === ts.SyntaxKind.Identifier) {\n skipRest = true;\n child.modification.omitSeparatorAfter = true;\n child.modification.suffix = ' { /* (preapproved) */ }';\n }\n }\n }\n\n /**\n * Writes a synopsis of the AEDoc comments, which indicates the release tag,\n * whether the item has been documented, and any warnings that were detected\n * by the analysis.\n */\n private static _getAedocSynopsis(\n collector: Collector,\n astDeclaration: AstDeclaration,\n messagesToReport: ExtractorMessage[]\n ): string {\n const writer: IndentedWriter = new IndentedWriter();\n\n for (const message of messagesToReport) {\n ApiReportGenerator._writeLineAsComments(writer, 'Warning: ' + message.formatMessageWithoutLocation());\n }\n\n if (!collector.isAncillaryDeclaration(astDeclaration)) {\n const footerParts: string[] = [];\n const apiItemMetadata: ApiItemMetadata = collector.fetchApiItemMetadata(astDeclaration);\n if (!apiItemMetadata.releaseTagSameAsParent) {\n if (apiItemMetadata.effectiveReleaseTag !== ReleaseTag.None) {\n footerParts.push(ReleaseTag.getTagName(apiItemMetadata.effectiveReleaseTag));\n }\n }\n\n if (apiItemMetadata.isSealed) {\n footerParts.push('@sealed');\n }\n\n if (apiItemMetadata.isVirtual) {\n footerParts.push('@virtual');\n }\n\n if (apiItemMetadata.isOverride) {\n footerParts.push('@override');\n }\n\n if (apiItemMetadata.isEventProperty) {\n footerParts.push('@eventProperty');\n }\n\n if (apiItemMetadata.tsdocComment) {\n if (apiItemMetadata.tsdocComment.deprecatedBlock) {\n footerParts.push('@deprecated');\n }\n }\n\n if (apiItemMetadata.needsDocumentation) {\n footerParts.push('(undocumented)');\n }\n\n if (footerParts.length > 0) {\n if (messagesToReport.length > 0) {\n ApiReportGenerator._writeLineAsComments(writer, ''); // skip a line after the warnings\n }\n\n ApiReportGenerator._writeLineAsComments(writer, footerParts.join(' '));\n }\n }\n\n return writer.toString();\n }\n\n private static _writeLineAsComments(writer: IndentedWriter, line: string): void {\n const lines: string[] = Text.convertToLf(line).split('\\n');\n for (const realLine of lines) {\n writer.write('// ');\n writer.write(realLine);\n writer.writeLine();\n }\n }\n}\n"]}
@@ -1,14 +1,10 @@
1
1
  import * as ts from 'typescript';
2
2
  import { DeclarationReference } from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';
3
- import { PackageJsonLookup } from '@rushstack/node-core-library';
3
+ import { Collector } from '../collector/Collector';
4
4
  export declare class DeclarationReferenceGenerator {
5
5
  static readonly unknownReference: string;
6
- private _packageJsonLookup;
7
- private _workingPackageName;
8
- private _program;
9
- private _typeChecker;
10
- private _bundledPackageNames;
11
- constructor(packageJsonLookup: PackageJsonLookup, workingPackageName: string, program: ts.Program, typeChecker: ts.TypeChecker, bundledPackageNames: ReadonlySet<string>);
6
+ private _collector;
7
+ constructor(collector: Collector);
12
8
  /**
13
9
  * Gets the UID for a TypeScript Identifier that references a type.
14
10
  */
@@ -20,7 +16,7 @@ export declare class DeclarationReferenceGenerator {
20
16
  private static _isInExpressionContext;
21
17
  private static _isExternalModuleSymbol;
22
18
  private static _isSameSymbol;
23
- private static _getNavigationToSymbol;
19
+ private _getNavigationToSymbol;
24
20
  private static _getMeaningOfSymbol;
25
21
  private _symbolToDeclarationReference;
26
22
  private _getParentReference;
@@ -1 +1 @@
1
- {"version":3,"file":"DeclarationReferenceGenerator.d.ts","sourceRoot":"","sources":["../../src/generators/DeclarationReferenceGenerator.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EACL,oBAAoB,EAKrB,MAAM,yDAAyD,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAmC,MAAM,8BAA8B,CAAC;AAIlG,qBAAa,6BAA6B;IACxC,gBAAuB,gBAAgB,EAAE,MAAM,CAAO;IAEtD,OAAO,CAAC,kBAAkB,CAAoB;IAC9C,OAAO,CAAC,mBAAmB,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAa;IAC7B,OAAO,CAAC,YAAY,CAAiB;IACrC,OAAO,CAAC,oBAAoB,CAAsB;gBAGhD,iBAAiB,EAAE,iBAAiB,EACpC,kBAAkB,EAAE,MAAM,EAC1B,OAAO,EAAE,EAAE,CAAC,OAAO,EACnB,WAAW,EAAE,EAAE,CAAC,WAAW,EAC3B,mBAAmB,EAAE,WAAW,CAAC,MAAM,CAAC;IAS1C;;OAEG;IACI,oCAAoC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,GAAG,oBAAoB,GAAG,SAAS;IAkBlG;;OAEG;IACI,gCAAgC,CACrC,MAAM,EAAE,EAAE,CAAC,MAAM,EACjB,OAAO,EAAE,EAAE,CAAC,WAAW,GACtB,oBAAoB,GAAG,SAAS;IAInC,OAAO,CAAC,MAAM,CAAC,sBAAsB;IAWrC,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAQtC,OAAO,CAAC,MAAM,CAAC,aAAa;IAY5B,OAAO,CAAC,MAAM,CAAC,sBAAsB;IAiErC,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAiDlC,OAAO,CAAC,6BAA6B;IAuErC,OAAO,CAAC,mBAAmB;IAiD3B,OAAO,CAAC,eAAe;IAcvB,OAAO,CAAC,yBAAyB;CAelC"}
1
+ {"version":3,"file":"DeclarationReferenceGenerator.d.ts","sourceRoot":"","sources":["../../src/generators/DeclarationReferenceGenerator.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EACL,oBAAoB,EAKrB,MAAM,yDAAyD,CAAC;AAIjE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGnD,qBAAa,6BAA6B;IACxC,gBAAuB,gBAAgB,EAAE,MAAM,CAAO;IAEtD,OAAO,CAAC,UAAU,CAAY;gBAEX,SAAS,EAAE,SAAS;IAIvC;;OAEG;IACI,oCAAoC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,GAAG,oBAAoB,GAAG,SAAS;IAkBlG;;OAEG;IACI,gCAAgC,CACrC,MAAM,EAAE,EAAE,CAAC,MAAM,EACjB,OAAO,EAAE,EAAE,CAAC,WAAW,GACtB,oBAAoB,GAAG,SAAS;IAInC,OAAO,CAAC,MAAM,CAAC,sBAAsB;IAWrC,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAQtC,OAAO,CAAC,MAAM,CAAC,aAAa;IAY5B,OAAO,CAAC,sBAAsB;IA2D9B,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAiDlC,OAAO,CAAC,6BAA6B;IAsErC,OAAO,CAAC,mBAAmB;IAiD3B,OAAO,CAAC,eAAe;IAavB,OAAO,CAAC,yBAAyB;CAelC"}
@@ -33,18 +33,14 @@ const node_core_library_1 = require("@rushstack/node-core-library");
33
33
  const TypeScriptHelpers_1 = require("../analyzer/TypeScriptHelpers");
34
34
  const TypeScriptInternals_1 = require("../analyzer/TypeScriptInternals");
35
35
  class DeclarationReferenceGenerator {
36
- constructor(packageJsonLookup, workingPackageName, program, typeChecker, bundledPackageNames) {
37
- this._packageJsonLookup = packageJsonLookup;
38
- this._workingPackageName = workingPackageName;
39
- this._program = program;
40
- this._typeChecker = typeChecker;
41
- this._bundledPackageNames = bundledPackageNames;
36
+ constructor(collector) {
37
+ this._collector = collector;
42
38
  }
43
39
  /**
44
40
  * Gets the UID for a TypeScript Identifier that references a type.
45
41
  */
46
42
  getDeclarationReferenceForIdentifier(node) {
47
- const symbol = this._typeChecker.getSymbolAtLocation(node);
43
+ const symbol = this._collector.typeChecker.getSymbolAtLocation(node);
48
44
  if (symbol !== undefined) {
49
45
  const isExpression = DeclarationReferenceGenerator._isInExpressionContext(node);
50
46
  return (this.getDeclarationReferenceForSymbol(symbol, isExpression ? ts.SymbolFlags.Value : ts.SymbolFlags.Type) ||
@@ -80,59 +76,48 @@ class DeclarationReferenceGenerator {
80
76
  right.valueDeclaration &&
81
77
  left.valueDeclaration === right.valueDeclaration));
82
78
  }
83
- static _getNavigationToSymbol(symbol) {
79
+ _getNavigationToSymbol(symbol) {
80
+ const declaration = TypeScriptHelpers_1.TypeScriptHelpers.tryGetADeclaration(symbol);
81
+ const sourceFile = declaration === null || declaration === void 0 ? void 0 : declaration.getSourceFile();
84
82
  const parent = TypeScriptInternals_1.TypeScriptInternals.getSymbolParent(symbol);
85
- // First, try to determine navigation to symbol via its parent.
86
- if (parent) {
87
- if (parent.exports &&
88
- DeclarationReferenceGenerator._isSameSymbol(parent.exports.get(symbol.escapedName), symbol)) {
89
- return "." /* Navigation.Exports */;
90
- }
91
- if (parent.members &&
83
+ // If it's global or from an external library, then use either Members or Exports. It's not possible for
84
+ // global symbols or external library symbols to be Locals.
85
+ const isGlobal = !!sourceFile && !ts.isExternalModule(sourceFile);
86
+ const isFromExternalLibrary = !!sourceFile && this._collector.program.isSourceFileFromExternalLibrary(sourceFile);
87
+ if (isGlobal || isFromExternalLibrary) {
88
+ if (parent &&
89
+ parent.members &&
92
90
  DeclarationReferenceGenerator._isSameSymbol(parent.members.get(symbol.escapedName), symbol)) {
93
91
  return "#" /* Navigation.Members */;
94
92
  }
95
- if (parent.globalExports &&
96
- DeclarationReferenceGenerator._isSameSymbol(parent.globalExports.get(symbol.escapedName), symbol)) {
97
- return 'global';
98
- }
93
+ return "." /* Navigation.Exports */;
99
94
  }
100
- // Next, try determining navigation to symbol by its node
101
- if (symbol.valueDeclaration) {
102
- const declaration = ts.isBindingElement(symbol.valueDeclaration)
103
- ? ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration)
104
- : symbol.valueDeclaration;
105
- if (ts.isClassElement(declaration) && ts.isClassLike(declaration.parent)) {
106
- // class members are an "export" if they have the static modifier.
107
- return ts.getCombinedModifierFlags(declaration) & ts.ModifierFlags.Static
108
- ? "." /* Navigation.Exports */
109
- : "#" /* Navigation.Members */;
110
- }
111
- if (ts.isTypeElement(declaration) || ts.isObjectLiteralElement(declaration)) {
112
- // type and object literal element members are just members
113
- return "#" /* Navigation.Members */;
114
- }
115
- if (ts.isEnumMember(declaration)) {
116
- // enum members are exports
117
- return "." /* Navigation.Exports */;
118
- }
119
- if (ts.isExportSpecifier(declaration) ||
120
- ts.isExportAssignment(declaration) ||
121
- ts.isExportSpecifier(declaration) ||
122
- ts.isExportDeclaration(declaration) ||
123
- ts.isNamedExports(declaration)) {
124
- return "." /* Navigation.Exports */;
95
+ // Otherwise, this symbol is from the current package.
96
+ if (parent) {
97
+ // If we've found an exported CollectorEntity, then it's exported from the package entry point, so
98
+ // use Exports.
99
+ const namedDeclaration = declaration === null || declaration === void 0 ? void 0 : declaration.name;
100
+ if (namedDeclaration && ts.isIdentifier(namedDeclaration)) {
101
+ const collectorEntity = this._collector.tryGetEntityForNode(namedDeclaration);
102
+ if (collectorEntity && collectorEntity.exported) {
103
+ return "." /* Navigation.Exports */;
104
+ }
125
105
  }
126
- // declarations are exports if they have an `export` modifier.
127
- if (ts.getCombinedModifierFlags(declaration) & ts.ModifierFlags.Export) {
106
+ // If its parent symbol is not a source file, then use either Exports or Members. If the parent symbol
107
+ // is a source file, but it wasn't exported from the package entry point (in the check above), then the
108
+ // symbol is a local, so fall through below.
109
+ if (!DeclarationReferenceGenerator._isExternalModuleSymbol(parent)) {
110
+ if (parent.members &&
111
+ DeclarationReferenceGenerator._isSameSymbol(parent.members.get(symbol.escapedName), symbol)) {
112
+ return "#" /* Navigation.Members */;
113
+ }
128
114
  return "." /* Navigation.Exports */;
129
115
  }
130
- if (ts.isSourceFile(declaration.parent) && !ts.isExternalModule(declaration.parent)) {
131
- // declarations in a source file are global if the source file is not a module.
132
- return 'global';
133
- }
134
116
  }
135
- // all other declarations are locals
117
+ // Otherwise, we have a local symbol, so use a Locals navigation. These are either:
118
+ //
119
+ // 1. Symbols that are exported from a file module but not the package entry point.
120
+ // 2. Symbols that are not exported from their parent module.
136
121
  return "~" /* Navigation.Locals */;
137
122
  }
138
123
  static _getMeaningOfSymbol(symbol, meaning) {
@@ -184,19 +169,19 @@ class DeclarationReferenceGenerator {
184
169
  return undefined;
185
170
  }
186
171
  _symbolToDeclarationReference(symbol, meaning, includeModuleSymbols) {
172
+ const declaration = TypeScriptHelpers_1.TypeScriptHelpers.tryGetADeclaration(symbol);
173
+ const sourceFile = declaration === null || declaration === void 0 ? void 0 : declaration.getSourceFile();
187
174
  let followedSymbol = symbol;
188
175
  if (followedSymbol.flags & ts.SymbolFlags.ExportValue) {
189
- followedSymbol = this._typeChecker.getExportSymbolOfSymbol(followedSymbol);
176
+ followedSymbol = this._collector.typeChecker.getExportSymbolOfSymbol(followedSymbol);
190
177
  }
191
178
  if (followedSymbol.flags & ts.SymbolFlags.Alias) {
192
- followedSymbol = this._typeChecker.getAliasedSymbol(followedSymbol);
179
+ followedSymbol = this._collector.typeChecker.getAliasedSymbol(followedSymbol);
193
180
  }
194
181
  if (DeclarationReferenceGenerator._isExternalModuleSymbol(followedSymbol)) {
195
182
  if (!includeModuleSymbols) {
196
183
  return undefined;
197
184
  }
198
- const declaration = TypeScriptHelpers_1.TypeScriptHelpers.tryGetADeclaration(symbol);
199
- const sourceFile = declaration === null || declaration === void 0 ? void 0 : declaration.getSourceFile();
200
185
  return new DeclarationReference_1.DeclarationReference(this._sourceFileToModuleSource(sourceFile));
201
186
  }
202
187
  // Do not generate a declaration reference for a type parameter.
@@ -231,12 +216,10 @@ class DeclarationReferenceGenerator {
231
216
  }
232
217
  }
233
218
  }
234
- let navigation = DeclarationReferenceGenerator._getNavigationToSymbol(followedSymbol);
235
- if (navigation === 'global') {
236
- if (parentRef.source !== DeclarationReference_1.GlobalSource.instance) {
237
- parentRef = new DeclarationReference_1.DeclarationReference(DeclarationReference_1.GlobalSource.instance);
238
- }
239
- navigation = "." /* Navigation.Exports */;
219
+ const navigation = this._getNavigationToSymbol(followedSymbol);
220
+ // If the symbol is a global, ensure the source is global.
221
+ if (sourceFile && !ts.isExternalModule(sourceFile) && parentRef.source !== DeclarationReference_1.GlobalSource.instance) {
222
+ parentRef = new DeclarationReference_1.DeclarationReference(DeclarationReference_1.GlobalSource.instance);
240
223
  }
241
224
  return parentRef
242
225
  .addNavigationStep(navigation, localName)
@@ -265,7 +248,7 @@ class DeclarationReferenceGenerator {
265
248
  // but its reference still needs to be qualified with the parent reference for `n`.
266
249
  const grandParent = (_a = declaration === null || declaration === void 0 ? void 0 : declaration.parent) === null || _a === void 0 ? void 0 : _a.parent;
267
250
  if (grandParent && ts.isModuleDeclaration(grandParent)) {
268
- const grandParentSymbol = TypeScriptInternals_1.TypeScriptInternals.tryGetSymbolForDeclaration(grandParent, this._typeChecker);
251
+ const grandParentSymbol = TypeScriptInternals_1.TypeScriptInternals.tryGetSymbolForDeclaration(grandParent, this._collector.typeChecker);
269
252
  if (grandParentSymbol) {
270
253
  return this._symbolToDeclarationReference(grandParentSymbol, grandParentSymbol.flags,
271
254
  /*includeModuleSymbols*/ true);
@@ -281,23 +264,23 @@ class DeclarationReferenceGenerator {
281
264
  }
282
265
  }
283
266
  _getPackageName(sourceFile) {
284
- if (this._program.isSourceFileFromExternalLibrary(sourceFile)) {
285
- const packageJson = this._packageJsonLookup.tryLoadNodePackageJsonFor(sourceFile.fileName);
267
+ if (this._collector.program.isSourceFileFromExternalLibrary(sourceFile)) {
268
+ const packageJson = this._collector.packageJsonLookup.tryLoadNodePackageJsonFor(sourceFile.fileName);
286
269
  if (packageJson && packageJson.name) {
287
270
  return packageJson.name;
288
271
  }
289
272
  return DeclarationReferenceGenerator.unknownReference;
290
273
  }
291
- return this._workingPackageName;
274
+ return this._collector.workingPackage.name;
292
275
  }
293
276
  _sourceFileToModuleSource(sourceFile) {
294
277
  if (sourceFile && ts.isExternalModule(sourceFile)) {
295
278
  const packageName = this._getPackageName(sourceFile);
296
- if (this._bundledPackageNames.has(packageName)) {
279
+ if (this._collector.bundledPackageNames.has(packageName)) {
297
280
  // The api-extractor.json config file has a "bundledPackages" setting, which causes imports from
298
281
  // certain NPM packages to be treated as part of the working project. In this case, we need to
299
282
  // substitute the working package name.
300
- return new DeclarationReference_1.ModuleSource(this._workingPackageName);
283
+ return new DeclarationReference_1.ModuleSource(this._collector.workingPackage.name);
301
284
  }
302
285
  else {
303
286
  return new DeclarationReference_1.ModuleSource(packageName);
@@ -1 +1 @@
1
- {"version":3,"file":"DeclarationReferenceGenerator.js","sourceRoot":"","sources":["../../src/generators/DeclarationReferenceGenerator.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,+BAA+B;AAC/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C,gGAAgG;gBAChG,+FAA+F;gBAC/F,uCAAuC;gBACvC,OAAO,IAAI,mCAAY,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;aACnD;iBAAM;gBACL,OAAO,IAAI,mCAAY,CAAC,WAAW,CAAC,CAAC;aACtC;SACF;QACD,OAAO,mCAAY,CAAC,QAAQ,CAAC;IAC/B,CAAC;;AA3VH,sEA4VC;AA3VwB,8CAAgB,GAAW,GAAG,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n/* eslint-disable no-bitwise */\nimport * as ts from 'typescript';\nimport {\n DeclarationReference,\n ModuleSource,\n GlobalSource,\n Navigation,\n Meaning\n} from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';\nimport { PackageJsonLookup, INodePackageJson, InternalError } from '@rushstack/node-core-library';\nimport { TypeScriptHelpers } from '../analyzer/TypeScriptHelpers';\nimport { TypeScriptInternals } from '../analyzer/TypeScriptInternals';\n\nexport class DeclarationReferenceGenerator {\n public static readonly unknownReference: string = '?';\n\n private _packageJsonLookup: PackageJsonLookup;\n private _workingPackageName: string;\n private _program: ts.Program;\n private _typeChecker: ts.TypeChecker;\n private _bundledPackageNames: ReadonlySet<string>;\n\n public constructor(\n packageJsonLookup: PackageJsonLookup,\n workingPackageName: string,\n program: ts.Program,\n typeChecker: ts.TypeChecker,\n bundledPackageNames: ReadonlySet<string>\n ) {\n this._packageJsonLookup = packageJsonLookup;\n this._workingPackageName = workingPackageName;\n this._program = program;\n this._typeChecker = typeChecker;\n this._bundledPackageNames = bundledPackageNames;\n }\n\n /**\n * Gets the UID for a TypeScript Identifier that references a type.\n */\n public getDeclarationReferenceForIdentifier(node: ts.Identifier): DeclarationReference | undefined {\n const symbol: ts.Symbol | undefined = this._typeChecker.getSymbolAtLocation(node);\n if (symbol !== undefined) {\n const isExpression: boolean = DeclarationReferenceGenerator._isInExpressionContext(node);\n return (\n this.getDeclarationReferenceForSymbol(\n symbol,\n isExpression ? ts.SymbolFlags.Value : ts.SymbolFlags.Type\n ) ||\n this.getDeclarationReferenceForSymbol(\n symbol,\n isExpression ? ts.SymbolFlags.Type : ts.SymbolFlags.Value\n ) ||\n this.getDeclarationReferenceForSymbol(symbol, ts.SymbolFlags.Namespace)\n );\n }\n }\n\n /**\n * Gets the DeclarationReference for a TypeScript Symbol for a given meaning.\n */\n public getDeclarationReferenceForSymbol(\n symbol: ts.Symbol,\n meaning: ts.SymbolFlags\n ): DeclarationReference | undefined {\n return this._symbolToDeclarationReference(symbol, meaning, /*includeModuleSymbols*/ false);\n }\n\n private static _isInExpressionContext(node: ts.Node): boolean {\n switch (node.parent.kind) {\n case ts.SyntaxKind.TypeQuery:\n return true;\n case ts.SyntaxKind.QualifiedName:\n return DeclarationReferenceGenerator._isInExpressionContext(node.parent);\n default:\n return false;\n }\n }\n\n private static _isExternalModuleSymbol(symbol: ts.Symbol): boolean {\n return (\n !!(symbol.flags & ts.SymbolFlags.ValueModule) &&\n symbol.valueDeclaration !== undefined &&\n ts.isSourceFile(symbol.valueDeclaration)\n );\n }\n\n private static _isSameSymbol(left: ts.Symbol | undefined, right: ts.Symbol): boolean {\n return (\n left === right ||\n !!(\n left &&\n left.valueDeclaration &&\n right.valueDeclaration &&\n left.valueDeclaration === right.valueDeclaration\n )\n );\n }\n\n private static _getNavigationToSymbol(symbol: ts.Symbol): Navigation | 'global' {\n const parent: ts.Symbol | undefined = TypeScriptInternals.getSymbolParent(symbol);\n // First, try to determine navigation to symbol via its parent.\n if (parent) {\n if (\n parent.exports &&\n DeclarationReferenceGenerator._isSameSymbol(parent.exports.get(symbol.escapedName), symbol)\n ) {\n return Navigation.Exports;\n }\n if (\n parent.members &&\n DeclarationReferenceGenerator._isSameSymbol(parent.members.get(symbol.escapedName), symbol)\n ) {\n return Navigation.Members;\n }\n if (\n parent.globalExports &&\n DeclarationReferenceGenerator._isSameSymbol(parent.globalExports.get(symbol.escapedName), symbol)\n ) {\n return 'global';\n }\n }\n\n // Next, try determining navigation to symbol by its node\n if (symbol.valueDeclaration) {\n const declaration: ts.Declaration = ts.isBindingElement(symbol.valueDeclaration)\n ? ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration)\n : symbol.valueDeclaration;\n if (ts.isClassElement(declaration) && ts.isClassLike(declaration.parent)) {\n // class members are an \"export\" if they have the static modifier.\n return ts.getCombinedModifierFlags(declaration) & ts.ModifierFlags.Static\n ? Navigation.Exports\n : Navigation.Members;\n }\n if (ts.isTypeElement(declaration) || ts.isObjectLiteralElement(declaration)) {\n // type and object literal element members are just members\n return Navigation.Members;\n }\n if (ts.isEnumMember(declaration)) {\n // enum members are exports\n return Navigation.Exports;\n }\n if (\n ts.isExportSpecifier(declaration) ||\n ts.isExportAssignment(declaration) ||\n ts.isExportSpecifier(declaration) ||\n ts.isExportDeclaration(declaration) ||\n ts.isNamedExports(declaration)\n ) {\n return Navigation.Exports;\n }\n // declarations are exports if they have an `export` modifier.\n if (ts.getCombinedModifierFlags(declaration) & ts.ModifierFlags.Export) {\n return Navigation.Exports;\n }\n if (ts.isSourceFile(declaration.parent) && !ts.isExternalModule(declaration.parent)) {\n // declarations in a source file are global if the source file is not a module.\n return 'global';\n }\n }\n // all other declarations are locals\n return Navigation.Locals;\n }\n\n private static _getMeaningOfSymbol(symbol: ts.Symbol, meaning: ts.SymbolFlags): Meaning | undefined {\n if (symbol.flags & meaning & ts.SymbolFlags.Class) {\n return Meaning.Class;\n }\n if (symbol.flags & meaning & ts.SymbolFlags.Enum) {\n return Meaning.Enum;\n }\n if (symbol.flags & meaning & ts.SymbolFlags.Interface) {\n return Meaning.Interface;\n }\n if (symbol.flags & meaning & ts.SymbolFlags.TypeAlias) {\n return Meaning.TypeAlias;\n }\n if (symbol.flags & meaning & ts.SymbolFlags.Function) {\n return Meaning.Function;\n }\n if (symbol.flags & meaning & ts.SymbolFlags.Variable) {\n return Meaning.Variable;\n }\n if (symbol.flags & meaning & ts.SymbolFlags.Module) {\n return Meaning.Namespace;\n }\n if (symbol.flags & meaning & ts.SymbolFlags.ClassMember) {\n return Meaning.Member;\n }\n if (symbol.flags & meaning & ts.SymbolFlags.Constructor) {\n return Meaning.Constructor;\n }\n if (symbol.flags & meaning & ts.SymbolFlags.EnumMember) {\n return Meaning.Member;\n }\n if (symbol.flags & meaning & ts.SymbolFlags.Signature) {\n if (symbol.escapedName === ts.InternalSymbolName.Call) {\n return Meaning.CallSignature;\n }\n if (symbol.escapedName === ts.InternalSymbolName.New) {\n return Meaning.ConstructSignature;\n }\n if (symbol.escapedName === ts.InternalSymbolName.Index) {\n return Meaning.IndexSignature;\n }\n }\n if (symbol.flags & meaning & ts.SymbolFlags.TypeParameter) {\n // This should have already been handled in `getDeclarationReferenceOfSymbol`.\n throw new InternalError('Not supported.');\n }\n return undefined;\n }\n\n private _symbolToDeclarationReference(\n symbol: ts.Symbol,\n meaning: ts.SymbolFlags,\n includeModuleSymbols: boolean\n ): DeclarationReference | undefined {\n let followedSymbol: ts.Symbol = symbol;\n if (followedSymbol.flags & ts.SymbolFlags.ExportValue) {\n followedSymbol = this._typeChecker.getExportSymbolOfSymbol(followedSymbol);\n }\n if (followedSymbol.flags & ts.SymbolFlags.Alias) {\n followedSymbol = this._typeChecker.getAliasedSymbol(followedSymbol);\n }\n\n if (DeclarationReferenceGenerator._isExternalModuleSymbol(followedSymbol)) {\n if (!includeModuleSymbols) {\n return undefined;\n }\n const declaration: ts.Node | undefined = TypeScriptHelpers.tryGetADeclaration(symbol);\n const sourceFile: ts.SourceFile | undefined = declaration?.getSourceFile();\n return new DeclarationReference(this._sourceFileToModuleSource(sourceFile));\n }\n\n // Do not generate a declaration reference for a type parameter.\n if (followedSymbol.flags & ts.SymbolFlags.TypeParameter) {\n return undefined;\n }\n\n let parentRef: DeclarationReference | undefined = this._getParentReference(followedSymbol);\n if (!parentRef) {\n return undefined;\n }\n\n let localName: string = followedSymbol.name;\n if (followedSymbol.escapedName === ts.InternalSymbolName.Constructor) {\n localName = 'constructor';\n } else {\n const wellKnownName: string | undefined = TypeScriptHelpers.tryDecodeWellKnownSymbolName(\n followedSymbol.escapedName\n );\n if (wellKnownName) {\n // TypeScript binds well-known ECMAScript symbols like 'Symbol.iterator' as '__@iterator'.\n // This converts a string like '__@iterator' into the property name '[Symbol.iterator]'.\n localName = wellKnownName;\n } else if (TypeScriptHelpers.isUniqueSymbolName(followedSymbol.escapedName)) {\n for (const decl of followedSymbol.declarations || []) {\n const declName: ts.DeclarationName | undefined = ts.getNameOfDeclaration(decl);\n if (declName && ts.isComputedPropertyName(declName)) {\n const lateName: string | undefined = TypeScriptHelpers.tryGetLateBoundName(declName);\n if (lateName !== undefined) {\n localName = lateName;\n break;\n }\n }\n }\n }\n }\n\n let navigation: Navigation | 'global' =\n DeclarationReferenceGenerator._getNavigationToSymbol(followedSymbol);\n if (navigation === 'global') {\n if (parentRef.source !== GlobalSource.instance) {\n parentRef = new DeclarationReference(GlobalSource.instance);\n }\n navigation = Navigation.Exports;\n }\n\n return parentRef\n .addNavigationStep(navigation, localName)\n .withMeaning(DeclarationReferenceGenerator._getMeaningOfSymbol(followedSymbol, meaning));\n }\n\n private _getParentReference(symbol: ts.Symbol): DeclarationReference | undefined {\n const declaration: ts.Node | undefined = TypeScriptHelpers.tryGetADeclaration(symbol);\n\n // First, try to find a parent symbol via the symbol tree.\n const parentSymbol: ts.Symbol | undefined = TypeScriptInternals.getSymbolParent(symbol);\n if (parentSymbol) {\n return this._symbolToDeclarationReference(\n parentSymbol,\n parentSymbol.flags,\n /*includeModuleSymbols*/ true\n );\n }\n\n // If that doesn't work, try to find a parent symbol via the node tree. As far as we can tell,\n // this logic is only needed for local symbols within namespaces. For example:\n //\n // ```\n // export namespace n {\n // type SomeType = number;\n // export function someFunction(): SomeType { return 5; }\n // }\n // ```\n //\n // In the example above, `SomeType` doesn't have a parent symbol per the TS internal API above,\n // but its reference still needs to be qualified with the parent reference for `n`.\n const grandParent: ts.Node | undefined = declaration?.parent?.parent;\n if (grandParent && ts.isModuleDeclaration(grandParent)) {\n const grandParentSymbol: ts.Symbol | undefined = TypeScriptInternals.tryGetSymbolForDeclaration(\n grandParent,\n this._typeChecker\n );\n if (grandParentSymbol) {\n return this._symbolToDeclarationReference(\n grandParentSymbol,\n grandParentSymbol.flags,\n /*includeModuleSymbols*/ true\n );\n }\n }\n\n // At this point, we have a local symbol in a module.\n const sourceFile: ts.SourceFile | undefined = declaration?.getSourceFile();\n if (sourceFile && ts.isExternalModule(sourceFile)) {\n return new DeclarationReference(this._sourceFileToModuleSource(sourceFile));\n } else {\n return new DeclarationReference(GlobalSource.instance);\n }\n }\n\n private _getPackageName(sourceFile: ts.SourceFile): string {\n if (this._program.isSourceFileFromExternalLibrary(sourceFile)) {\n const packageJson: INodePackageJson | undefined = this._packageJsonLookup.tryLoadNodePackageJsonFor(\n sourceFile.fileName\n );\n\n if (packageJson && packageJson.name) {\n return packageJson.name;\n }\n return DeclarationReferenceGenerator.unknownReference;\n }\n return this._workingPackageName;\n }\n\n private _sourceFileToModuleSource(sourceFile: ts.SourceFile | undefined): GlobalSource | ModuleSource {\n if (sourceFile && ts.isExternalModule(sourceFile)) {\n const packageName: string = this._getPackageName(sourceFile);\n\n if (this._bundledPackageNames.has(packageName)) {\n // The api-extractor.json config file has a \"bundledPackages\" setting, which causes imports from\n // certain NPM packages to be treated as part of the working project. In this case, we need to\n // substitute the working package name.\n return new ModuleSource(this._workingPackageName);\n } else {\n return new ModuleSource(packageName);\n }\n }\n return GlobalSource.instance;\n }\n}\n"]}
1
+ {"version":3,"file":"DeclarationReferenceGenerator.js","sourceRoot":"","sources":["../../src/generators/DeclarationReferenceGenerator.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,+BAA+B;AAC/B,+CAAiC;AACjC,kGAMiE;AACjE,oEAA+E;AAC/E,qEAAkE;AAClE,yEAAsE;AAItE,MAAa,6BAA6B;IAKxC,YAAmB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C,QAAQ,CAAC,CAAC;YAEnF,IAAI,WAAW,IAAI,WAAW,CAAC,IAAI,EAAE;gBACnC,OAAO,WAAW,CAAC,IAAI,CAAC;aACzB;YACD,OAAO,6BAA6B,CAAC,gBAAgB,CAAC;SACvD;QACD,OAAO,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC;IAC7C,CAAC;IAEO,yBAAyB,CAAC,UAAqC;QACrE,IAAI,UAAU,IAAI,EAAE,CAAC,gBAAgB,CAAC,UAAU,CAAC,EAAE;YACjD,MAAM,WAAW,GAAW,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;YAE7D,IAAI,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE;gBACxD,gGAAgG;gBAChG,+FAA+F;gBAC/F,uCAAuC;gBACvC,OAAO,IAAI,mCAAY,CAAC,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;aAC9D;iBAAM;gBACL,OAAO,IAAI,mCAAY,CAAC,WAAW,CAAC,CAAC;aACtC;SACF;QACD,OAAO,mCAAY,CAAC,QAAQ,CAAC;IAC/B,CAAC;;AArUH,sEAsUC;AArUwB,8CAAgB,GAAW,GAAG,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n/* eslint-disable no-bitwise */\nimport * as ts from 'typescript';\nimport {\n DeclarationReference,\n ModuleSource,\n GlobalSource,\n Navigation,\n Meaning\n} from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';\nimport { INodePackageJson, InternalError } from '@rushstack/node-core-library';\nimport { TypeScriptHelpers } from '../analyzer/TypeScriptHelpers';\nimport { TypeScriptInternals } from '../analyzer/TypeScriptInternals';\nimport { Collector } from '../collector/Collector';\nimport { CollectorEntity } from '../collector/CollectorEntity';\n\nexport class DeclarationReferenceGenerator {\n public static readonly unknownReference: string = '?';\n\n private _collector: Collector;\n\n public constructor(collector: Collector) {\n this._collector = collector;\n }\n\n /**\n * Gets the UID for a TypeScript Identifier that references a type.\n */\n public getDeclarationReferenceForIdentifier(node: ts.Identifier): DeclarationReference | undefined {\n const symbol: ts.Symbol | undefined = this._collector.typeChecker.getSymbolAtLocation(node);\n if (symbol !== undefined) {\n const isExpression: boolean = DeclarationReferenceGenerator._isInExpressionContext(node);\n return (\n this.getDeclarationReferenceForSymbol(\n symbol,\n isExpression ? ts.SymbolFlags.Value : ts.SymbolFlags.Type\n ) ||\n this.getDeclarationReferenceForSymbol(\n symbol,\n isExpression ? ts.SymbolFlags.Type : ts.SymbolFlags.Value\n ) ||\n this.getDeclarationReferenceForSymbol(symbol, ts.SymbolFlags.Namespace)\n );\n }\n }\n\n /**\n * Gets the DeclarationReference for a TypeScript Symbol for a given meaning.\n */\n public getDeclarationReferenceForSymbol(\n symbol: ts.Symbol,\n meaning: ts.SymbolFlags\n ): DeclarationReference | undefined {\n return this._symbolToDeclarationReference(symbol, meaning, /*includeModuleSymbols*/ false);\n }\n\n private static _isInExpressionContext(node: ts.Node): boolean {\n switch (node.parent.kind) {\n case ts.SyntaxKind.TypeQuery:\n return true;\n case ts.SyntaxKind.QualifiedName:\n return DeclarationReferenceGenerator._isInExpressionContext(node.parent);\n default:\n return false;\n }\n }\n\n private static _isExternalModuleSymbol(symbol: ts.Symbol): boolean {\n return (\n !!(symbol.flags & ts.SymbolFlags.ValueModule) &&\n symbol.valueDeclaration !== undefined &&\n ts.isSourceFile(symbol.valueDeclaration)\n );\n }\n\n private static _isSameSymbol(left: ts.Symbol | undefined, right: ts.Symbol): boolean {\n return (\n left === right ||\n !!(\n left &&\n left.valueDeclaration &&\n right.valueDeclaration &&\n left.valueDeclaration === right.valueDeclaration\n )\n );\n }\n\n private _getNavigationToSymbol(symbol: ts.Symbol): Navigation {\n const declaration: ts.Declaration | undefined = TypeScriptHelpers.tryGetADeclaration(symbol);\n const sourceFile: ts.SourceFile | undefined = declaration?.getSourceFile();\n const parent: ts.Symbol | undefined = TypeScriptInternals.getSymbolParent(symbol);\n\n // If it's global or from an external library, then use either Members or Exports. It's not possible for\n // global symbols or external library symbols to be Locals.\n const isGlobal: boolean = !!sourceFile && !ts.isExternalModule(sourceFile);\n const isFromExternalLibrary: boolean =\n !!sourceFile && this._collector.program.isSourceFileFromExternalLibrary(sourceFile);\n if (isGlobal || isFromExternalLibrary) {\n if (\n parent &&\n parent.members &&\n DeclarationReferenceGenerator._isSameSymbol(parent.members.get(symbol.escapedName), symbol)\n ) {\n return Navigation.Members;\n }\n\n return Navigation.Exports;\n }\n\n // Otherwise, this symbol is from the current package.\n if (parent) {\n // If we've found an exported CollectorEntity, then it's exported from the package entry point, so\n // use Exports.\n const namedDeclaration: ts.DeclarationName | undefined = (\n declaration as ts.NamedDeclaration | undefined\n )?.name;\n if (namedDeclaration && ts.isIdentifier(namedDeclaration)) {\n const collectorEntity: CollectorEntity | undefined =\n this._collector.tryGetEntityForNode(namedDeclaration);\n if (collectorEntity && collectorEntity.exported) {\n return Navigation.Exports;\n }\n }\n\n // If its parent symbol is not a source file, then use either Exports or Members. If the parent symbol\n // is a source file, but it wasn't exported from the package entry point (in the check above), then the\n // symbol is a local, so fall through below.\n if (!DeclarationReferenceGenerator._isExternalModuleSymbol(parent)) {\n if (\n parent.members &&\n DeclarationReferenceGenerator._isSameSymbol(parent.members.get(symbol.escapedName), symbol)\n ) {\n return Navigation.Members;\n }\n\n return Navigation.Exports;\n }\n }\n\n // Otherwise, we have a local symbol, so use a Locals navigation. These are either:\n //\n // 1. Symbols that are exported from a file module but not the package entry point.\n // 2. Symbols that are not exported from their parent module.\n return Navigation.Locals;\n }\n\n private static _getMeaningOfSymbol(symbol: ts.Symbol, meaning: ts.SymbolFlags): Meaning | undefined {\n if (symbol.flags & meaning & ts.SymbolFlags.Class) {\n return Meaning.Class;\n }\n if (symbol.flags & meaning & ts.SymbolFlags.Enum) {\n return Meaning.Enum;\n }\n if (symbol.flags & meaning & ts.SymbolFlags.Interface) {\n return Meaning.Interface;\n }\n if (symbol.flags & meaning & ts.SymbolFlags.TypeAlias) {\n return Meaning.TypeAlias;\n }\n if (symbol.flags & meaning & ts.SymbolFlags.Function) {\n return Meaning.Function;\n }\n if (symbol.flags & meaning & ts.SymbolFlags.Variable) {\n return Meaning.Variable;\n }\n if (symbol.flags & meaning & ts.SymbolFlags.Module) {\n return Meaning.Namespace;\n }\n if (symbol.flags & meaning & ts.SymbolFlags.ClassMember) {\n return Meaning.Member;\n }\n if (symbol.flags & meaning & ts.SymbolFlags.Constructor) {\n return Meaning.Constructor;\n }\n if (symbol.flags & meaning & ts.SymbolFlags.EnumMember) {\n return Meaning.Member;\n }\n if (symbol.flags & meaning & ts.SymbolFlags.Signature) {\n if (symbol.escapedName === ts.InternalSymbolName.Call) {\n return Meaning.CallSignature;\n }\n if (symbol.escapedName === ts.InternalSymbolName.New) {\n return Meaning.ConstructSignature;\n }\n if (symbol.escapedName === ts.InternalSymbolName.Index) {\n return Meaning.IndexSignature;\n }\n }\n if (symbol.flags & meaning & ts.SymbolFlags.TypeParameter) {\n // This should have already been handled in `getDeclarationReferenceOfSymbol`.\n throw new InternalError('Not supported.');\n }\n return undefined;\n }\n\n private _symbolToDeclarationReference(\n symbol: ts.Symbol,\n meaning: ts.SymbolFlags,\n includeModuleSymbols: boolean\n ): DeclarationReference | undefined {\n const declaration: ts.Node | undefined = TypeScriptHelpers.tryGetADeclaration(symbol);\n const sourceFile: ts.SourceFile | undefined = declaration?.getSourceFile();\n\n let followedSymbol: ts.Symbol = symbol;\n if (followedSymbol.flags & ts.SymbolFlags.ExportValue) {\n followedSymbol = this._collector.typeChecker.getExportSymbolOfSymbol(followedSymbol);\n }\n if (followedSymbol.flags & ts.SymbolFlags.Alias) {\n followedSymbol = this._collector.typeChecker.getAliasedSymbol(followedSymbol);\n }\n\n if (DeclarationReferenceGenerator._isExternalModuleSymbol(followedSymbol)) {\n if (!includeModuleSymbols) {\n return undefined;\n }\n return new DeclarationReference(this._sourceFileToModuleSource(sourceFile));\n }\n\n // Do not generate a declaration reference for a type parameter.\n if (followedSymbol.flags & ts.SymbolFlags.TypeParameter) {\n return undefined;\n }\n\n let parentRef: DeclarationReference | undefined = this._getParentReference(followedSymbol);\n if (!parentRef) {\n return undefined;\n }\n\n let localName: string = followedSymbol.name;\n if (followedSymbol.escapedName === ts.InternalSymbolName.Constructor) {\n localName = 'constructor';\n } else {\n const wellKnownName: string | undefined = TypeScriptHelpers.tryDecodeWellKnownSymbolName(\n followedSymbol.escapedName\n );\n if (wellKnownName) {\n // TypeScript binds well-known ECMAScript symbols like 'Symbol.iterator' as '__@iterator'.\n // This converts a string like '__@iterator' into the property name '[Symbol.iterator]'.\n localName = wellKnownName;\n } else if (TypeScriptHelpers.isUniqueSymbolName(followedSymbol.escapedName)) {\n for (const decl of followedSymbol.declarations || []) {\n const declName: ts.DeclarationName | undefined = ts.getNameOfDeclaration(decl);\n if (declName && ts.isComputedPropertyName(declName)) {\n const lateName: string | undefined = TypeScriptHelpers.tryGetLateBoundName(declName);\n if (lateName !== undefined) {\n localName = lateName;\n break;\n }\n }\n }\n }\n }\n\n const navigation: Navigation = this._getNavigationToSymbol(followedSymbol);\n\n // If the symbol is a global, ensure the source is global.\n if (sourceFile && !ts.isExternalModule(sourceFile) && parentRef.source !== GlobalSource.instance) {\n parentRef = new DeclarationReference(GlobalSource.instance);\n }\n\n return parentRef\n .addNavigationStep(navigation, localName)\n .withMeaning(DeclarationReferenceGenerator._getMeaningOfSymbol(followedSymbol, meaning));\n }\n\n private _getParentReference(symbol: ts.Symbol): DeclarationReference | undefined {\n const declaration: ts.Node | undefined = TypeScriptHelpers.tryGetADeclaration(symbol);\n\n // First, try to find a parent symbol via the symbol tree.\n const parentSymbol: ts.Symbol | undefined = TypeScriptInternals.getSymbolParent(symbol);\n if (parentSymbol) {\n return this._symbolToDeclarationReference(\n parentSymbol,\n parentSymbol.flags,\n /*includeModuleSymbols*/ true\n );\n }\n\n // If that doesn't work, try to find a parent symbol via the node tree. As far as we can tell,\n // this logic is only needed for local symbols within namespaces. For example:\n //\n // ```\n // export namespace n {\n // type SomeType = number;\n // export function someFunction(): SomeType { return 5; }\n // }\n // ```\n //\n // In the example above, `SomeType` doesn't have a parent symbol per the TS internal API above,\n // but its reference still needs to be qualified with the parent reference for `n`.\n const grandParent: ts.Node | undefined = declaration?.parent?.parent;\n if (grandParent && ts.isModuleDeclaration(grandParent)) {\n const grandParentSymbol: ts.Symbol | undefined = TypeScriptInternals.tryGetSymbolForDeclaration(\n grandParent,\n this._collector.typeChecker\n );\n if (grandParentSymbol) {\n return this._symbolToDeclarationReference(\n grandParentSymbol,\n grandParentSymbol.flags,\n /*includeModuleSymbols*/ true\n );\n }\n }\n\n // At this point, we have a local symbol in a module.\n const sourceFile: ts.SourceFile | undefined = declaration?.getSourceFile();\n if (sourceFile && ts.isExternalModule(sourceFile)) {\n return new DeclarationReference(this._sourceFileToModuleSource(sourceFile));\n } else {\n return new DeclarationReference(GlobalSource.instance);\n }\n }\n\n private _getPackageName(sourceFile: ts.SourceFile): string {\n if (this._collector.program.isSourceFileFromExternalLibrary(sourceFile)) {\n const packageJson: INodePackageJson | undefined =\n this._collector.packageJsonLookup.tryLoadNodePackageJsonFor(sourceFile.fileName);\n\n if (packageJson && packageJson.name) {\n return packageJson.name;\n }\n return DeclarationReferenceGenerator.unknownReference;\n }\n return this._collector.workingPackage.name;\n }\n\n private _sourceFileToModuleSource(sourceFile: ts.SourceFile | undefined): GlobalSource | ModuleSource {\n if (sourceFile && ts.isExternalModule(sourceFile)) {\n const packageName: string = this._getPackageName(sourceFile);\n\n if (this._collector.bundledPackageNames.has(packageName)) {\n // The api-extractor.json config file has a \"bundledPackages\" setting, which causes imports from\n // certain NPM packages to be treated as part of the working project. In this case, we need to\n // substitute the working package name.\n return new ModuleSource(this._collector.workingPackage.name);\n } else {\n return new ModuleSource(packageName);\n }\n }\n return GlobalSource.instance;\n }\n}\n"]}
@@ -18,12 +18,14 @@
18
18
  // ("enabled" is required)
19
19
  "reportFileName": "<unscopedPackageName>.api.md",
20
20
  "reportFolder": "<projectFolder>/etc/",
21
- "reportTempFolder": "<projectFolder>/temp/"
21
+ "reportTempFolder": "<projectFolder>/temp/",
22
+ "includeForgottenExports": false
22
23
  },
23
24
 
24
25
  "docModel": {
25
26
  // ("enabled" is required)
26
- "apiJsonFilePath": "<projectFolder>/temp/<unscopedPackageName>.api.json"
27
+ "apiJsonFilePath": "<projectFolder>/temp/<unscopedPackageName>.api.json",
28
+ "includeForgottenExports": false
27
29
  },
28
30
 
29
31
  "dtsRollup": {
@@ -80,12 +80,13 @@
80
80
  // "testMode": false,
81
81
 
82
82
  /**
83
- * Specifies how API Extractor sorts members of an enum when generating api.json. By default, the output files
84
- * will be sorted alphabetically, which is "by-name". To keep the ordering in the source code, specify "preserve".
83
+ * Specifies how API Extractor sorts members of an enum when generating the .api.json file. By default, the output
84
+ * files will be sorted alphabetically, which is "by-name". To keep the ordering in the source code, specify
85
+ * "preserve".
85
86
  *
86
87
  * DEFAULT VALUE: "by-name"
87
88
  */
88
- // enumMemberOrder?: EnumMemberOrder,
89
+ // "enumMemberOrder": "by-name",
89
90
 
90
91
  /**
91
92
  * Determines how the TypeScript compiler engine will be invoked by API Extractor.
@@ -175,7 +176,16 @@
175
176
  * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
176
177
  * DEFAULT VALUE: "<projectFolder>/temp/"
177
178
  */
178
- // "reportTempFolder": "<projectFolder>/temp/"
179
+ // "reportTempFolder": "<projectFolder>/temp/",
180
+
181
+ /**
182
+ * Whether "forgotten exports" should be included in the API report file. Forgotten exports are declarations
183
+ * flagged with `ae-forgotten-export` warnings. See https://api-extractor.com/pages/messages/ae-forgotten-export/ to
184
+ * learn more.
185
+ *
186
+ * DEFAULT VALUE: "false"
187
+ */
188
+ // "includeForgottenExports": false
179
189
  },
180
190
 
181
191
  /**
@@ -196,7 +206,16 @@
196
206
  * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
197
207
  * DEFAULT VALUE: "<projectFolder>/temp/<unscopedPackageName>.api.json"
198
208
  */
199
- // "apiJsonFilePath": "<projectFolder>/temp/<unscopedPackageName>.api.json"
209
+ // "apiJsonFilePath": "<projectFolder>/temp/<unscopedPackageName>.api.json",
210
+
211
+ /**
212
+ * Whether "forgotten exports" should be included in the doc model file. Forgotten exports are declarations
213
+ * flagged with `ae-forgotten-export` warnings. See https://api-extractor.com/pages/messages/ae-forgotten-export/ to
214
+ * learn more.
215
+ *
216
+ * DEFAULT VALUE: "false"
217
+ */
218
+ // "includeForgottenExports": false
200
219
  },
201
220
 
202
221
  /**