@microsoft/api-extractor 7.55.2 → 7.56.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.
- package/CHANGELOG.json +54 -0
- package/CHANGELOG.md +25 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/generators/ApiModelGenerator.d.ts +1 -1
- package/lib/generators/ApiModelGenerator.d.ts.map +1 -1
- package/lib/generators/ApiModelGenerator.js +101 -71
- package/lib/generators/ApiModelGenerator.js.map +1 -1
- package/lib/generators/ApiReportGenerator.d.ts.map +1 -1
- package/lib/generators/ApiReportGenerator.js +29 -4
- package/lib/generators/ApiReportGenerator.js.map +1 -1
- package/lib/generators/DtsEmitHelpers.d.ts +13 -0
- package/lib/generators/DtsEmitHelpers.d.ts.map +1 -1
- package/lib/generators/DtsEmitHelpers.js +99 -0
- package/lib/generators/DtsEmitHelpers.js.map +1 -1
- package/lib/generators/DtsRollupGenerator.d.ts.map +1 -1
- package/lib/generators/DtsRollupGenerator.js +7 -0
- package/lib/generators/DtsRollupGenerator.js.map +1 -1
- package/lib/generators/ExcerptBuilder.d.ts +13 -8
- package/lib/generators/ExcerptBuilder.d.ts.map +1 -1
- package/lib/generators/ExcerptBuilder.js +32 -13
- package/lib/generators/ExcerptBuilder.js.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiReportGenerator.js","sourceRoot":"","sources":["../../src/generators/ApiReportGenerator.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,+CAAiC;AAEjC,wEAA4D;AAC5D,oEAAmE;AAEnE,sDAAmD;AACnD,qEAAkE;AAClE,2CAAwC;AAExC,+DAA4D;AAE5D,qDAAkD;AAClD,qDAAkD;AAElD,qDAAkD;AAClD,qDAAkD;AAClD,uEAAoE;AAGpE,yFAAsF;AACtF,kEAA+D;AAI/D,MAAa,k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SAAS,CAAC,SAAS,IAAI,EACpE,cAAc,CACf,CAAC;YACJ,CAAC;YAED,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC3B,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAChC,kBAAkB,CAAC,oBAAoB,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,iCAAiC;gBACxF,CAAC;gBAED,kBAAkB,CAAC,oBAAoB,CAAC,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YACzE,CAAC;QACH,CAAC;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,CAAC;YAC7B,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YACvB,MAAM,CAAC,SAAS,EAAE,CAAC;QACrB,CAAC;IACH,CAAC;;AAznBH,gDA0nBC;AAznBgB,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';\n\nimport { ReleaseTag } from '@microsoft/api-extractor-model';\nimport { Text, InternalError } from '@rushstack/node-core-library';\n\nimport { Collector } from '../collector/Collector';\nimport { TypeScriptHelpers } from '../analyzer/TypeScriptHelpers';\nimport { Span } from '../analyzer/Span';\nimport type { CollectorEntity } from '../collector/CollectorEntity';\nimport { AstDeclaration } from '../analyzer/AstDeclaration';\nimport type { ApiItemMetadata } from '../collector/ApiItemMetadata';\nimport { AstImport } from '../analyzer/AstImport';\nimport { AstSymbol } from '../analyzer/AstSymbol';\nimport type { ExtractorMessage } from '../api/ExtractorMessage';\nimport { IndentedWriter } from './IndentedWriter';\nimport { DtsEmitHelpers } from './DtsEmitHelpers';\nimport { AstNamespaceImport } from '../analyzer/AstNamespaceImport';\nimport type { AstEntity } from '../analyzer/AstEntity';\nimport type { IAstModuleExportInfo } from '../analyzer/AstModule';\nimport { SourceFileLocationFormatter } from '../analyzer/SourceFileLocationFormatter';\nimport { ExtractorMessageId } from '../api/ExtractorMessageId';\nimport type { ApiReportVariant } from '../api/IConfigFile';\nimport type { SymbolMetadata } from '../collector/SymbolMetadata';\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 /**\n * Generates and returns the API report contents as a string.\n *\n * @param reportVariant - The release level with which the report is associated.\n * Can also be viewed as the minimal release level of items that should be included in the report.\n */\n public static generateReviewFileContent(collector: Collector, reportVariant: ApiReportVariant): string {\n const writer: IndentedWriter = new IndentedWriter();\n writer.trimLeadingSpaces = true;\n\n function capitalizeFirstLetter(input: string): string {\n return input === '' ? '' : `${input[0].toLocaleUpperCase()}${input.slice(1)}`;\n }\n\n // For backwards compatibility, don't emit \"complete\" in report text for untrimmed reports.\n const releaseLevelPrefix: string =\n reportVariant === 'complete' ? '' : `${capitalizeFirstLetter(reportVariant)} `;\n writer.writeLine(\n [\n `## ${releaseLevelPrefix}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 const symbolMetadata: SymbolMetadata | undefined = collector.tryFetchMetadataForAstEntity(astEntity);\n const maxEffectiveReleaseTag: ReleaseTag = symbolMetadata?.maxEffectiveReleaseTag ?? ReleaseTag.None;\n\n if (!this._shouldIncludeReleaseTag(maxEffectiveReleaseTag, reportVariant)) {\n continue;\n }\n\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 if (this._shouldIncludeDeclaration(collector, astDeclaration, reportVariant)) {\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, reportVariant);\n }\n\n span.writeModifiedText(writer);\n writer.ensureNewLine();\n }\n }\n }\n\n if (astEntity instanceof AstNamespaceImport) {\n const astModuleExportInfo: IAstModuleExportInfo = 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 reportVariant: ApiReportVariant\n ): void {\n // Should we process this declaration at all?\n if (!ApiReportGenerator._shouldIncludeDeclaration(collector, astDeclaration, reportVariant)) {\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 reportVariant\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 (ApiReportGenerator._shouldIncludeDeclaration(collector, childAstDeclaration, reportVariant)) {\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\n // NOTE: This generates ae-undocumented messages as a side effect\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\n ApiReportGenerator._modifySpan(\n collector,\n child,\n entity,\n childAstDeclaration,\n insideTypeLiteral,\n reportVariant\n );\n }\n }\n }\n\n private static _shouldIncludeDeclaration(\n collector: Collector,\n astDeclaration: AstDeclaration,\n reportVariant: ApiReportVariant\n ): boolean {\n // Private declarations are not included in the API report\n // eslint-disable-next-line no-bitwise\n if ((astDeclaration.modifierFlags & ts.ModifierFlags.Private) !== 0) {\n return false;\n }\n\n const apiItemMetadata: ApiItemMetadata = collector.fetchApiItemMetadata(astDeclaration);\n\n return this._shouldIncludeReleaseTag(apiItemMetadata.effectiveReleaseTag, reportVariant);\n }\n\n private static _shouldIncludeReleaseTag(releaseTag: ReleaseTag, reportVariant: ApiReportVariant): boolean {\n switch (reportVariant) {\n case 'complete':\n return true;\n case 'alpha':\n return (\n releaseTag === ReleaseTag.Alpha ||\n releaseTag === ReleaseTag.Beta ||\n releaseTag === ReleaseTag.Public ||\n // NOTE: No specified release tag is implicitly treated as `@public`.\n releaseTag === ReleaseTag.None\n );\n case 'beta':\n return (\n releaseTag === ReleaseTag.Beta ||\n releaseTag === ReleaseTag.Public ||\n // NOTE: No specified release tag is implicitly treated as `@public`.\n releaseTag === ReleaseTag.None\n );\n case 'public':\n return (\n releaseTag === ReleaseTag.Public ||\n // NOTE: No specified release tag is implicitly treated as `@public`.\n releaseTag === ReleaseTag.None\n );\n default:\n throw new Error(`Unrecognized release level: ${reportVariant}`);\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\n // 1. Release tag (if present)\n if (!apiItemMetadata.releaseTagSameAsParent) {\n if (apiItemMetadata.effectiveReleaseTag !== ReleaseTag.None) {\n footerParts.push(ReleaseTag.getTagName(apiItemMetadata.effectiveReleaseTag));\n }\n }\n\n // 2. Enumerate configured tags, reporting standard system tags first and then other configured tags.\n // Note that the ordering we handle the standard tags is important for backwards compatibility.\n // Also note that we had special mechanisms for checking whether or not an item is documented with these tags,\n // so they are checked specially.\n const {\n '@sealed': reportSealedTag,\n '@virtual': reportVirtualTag,\n '@override': reportOverrideTag,\n '@eventProperty': reportEventPropertyTag,\n '@deprecated': reportDeprecatedTag,\n ...otherTagsToReport\n } = collector.extractorConfig.tagsToReport;\n\n // 2.a Check for standard tags and report those that are both configured and present in the metadata.\n if (reportSealedTag && apiItemMetadata.isSealed) {\n footerParts.push('@sealed');\n }\n if (reportVirtualTag && apiItemMetadata.isVirtual) {\n footerParts.push('@virtual');\n }\n if (reportOverrideTag && apiItemMetadata.isOverride) {\n footerParts.push('@override');\n }\n if (reportEventPropertyTag && apiItemMetadata.isEventProperty) {\n footerParts.push('@eventProperty');\n }\n if (reportDeprecatedTag && apiItemMetadata.tsdocComment?.deprecatedBlock) {\n footerParts.push('@deprecated');\n }\n\n // 2.b Check for other configured tags and report those that are present in the tsdoc metadata.\n for (const [tag, reportTag] of Object.entries(otherTagsToReport)) {\n if (reportTag) {\n // If the tag was not handled specially, check if it is present in the metadata.\n if (apiItemMetadata.tsdocComment?.customBlocks.some((block) => block.blockTag.tagName === tag)) {\n footerParts.push(tag);\n } else if (apiItemMetadata.tsdocComment?.modifierTagSet.hasTagName(tag)) {\n footerParts.push(tag);\n }\n }\n }\n\n // 3. If the item is undocumented, append notice at the end of the list\n if (apiItemMetadata.undocumented) {\n footerParts.push('(undocumented)');\n\n collector.messageRouter.addAnalyzerIssue(\n ExtractorMessageId.Undocumented,\n `Missing documentation for \"${astDeclaration.astSymbol.localName}\".`,\n astDeclaration\n );\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
|
+
{"version":3,"file":"ApiReportGenerator.js","sourceRoot":"","sources":["../../src/generators/ApiReportGenerator.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,+CAAiC;AAEjC,wEAA4D;AAC5D,oEAAmE;AAEnE,sDAAmD;AACnD,qEAAkE;AAClE,2CAAwC;AAExC,+DAA4D;AAE5D,qDAAkD;AAClD,qDAAkD;AAElD,qDAAkD;AAClD,qDAAkD;AAClD,uEAAoE;AAGpE,yFAAsF;AACtF,kEAA+D;AAU/D,MAAa,k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C,WAAW,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC3D,KAAK,MAAM,QAAQ,IAAI,KAAK,EAAE,CAAC;YAC7B,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YACvB,MAAM,CAAC,SAAS,EAAE,CAAC;QACrB,CAAC;IACH,CAAC;;AA7oBH,gDA8oBC;AA7oBgB,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';\n\nimport { ReleaseTag } from '@microsoft/api-extractor-model';\nimport { Text, InternalError } from '@rushstack/node-core-library';\n\nimport { Collector } from '../collector/Collector';\nimport { TypeScriptHelpers } from '../analyzer/TypeScriptHelpers';\nimport { Span } from '../analyzer/Span';\nimport type { CollectorEntity } from '../collector/CollectorEntity';\nimport { AstDeclaration } from '../analyzer/AstDeclaration';\nimport type { ApiItemMetadata } from '../collector/ApiItemMetadata';\nimport { AstImport } from '../analyzer/AstImport';\nimport { AstSymbol } from '../analyzer/AstSymbol';\nimport type { ExtractorMessage } from '../api/ExtractorMessage';\nimport { IndentedWriter } from './IndentedWriter';\nimport { DtsEmitHelpers } from './DtsEmitHelpers';\nimport { AstNamespaceImport } from '../analyzer/AstNamespaceImport';\nimport type { AstEntity } from '../analyzer/AstEntity';\nimport type { IAstModuleExportInfo } from '../analyzer/AstModule';\nimport { SourceFileLocationFormatter } from '../analyzer/SourceFileLocationFormatter';\nimport { ExtractorMessageId } from '../api/ExtractorMessageId';\nimport type { ApiReportVariant } from '../api/IConfigFile';\nimport type { SymbolMetadata } from '../collector/SymbolMetadata';\n\ninterface IContext {\n collector: Collector;\n reportVariant: ApiReportVariant;\n alreadyProcessedSignatures: Set<Span>;\n}\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 /**\n * Generates and returns the API report contents as a string.\n *\n * @param reportVariant - The release level with which the report is associated.\n * Can also be viewed as the minimal release level of items that should be included in the report.\n */\n public static generateReviewFileContent(collector: Collector, reportVariant: ApiReportVariant): string {\n const writer: IndentedWriter = new IndentedWriter();\n writer.trimLeadingSpaces = true;\n\n function capitalizeFirstLetter(input: string): string {\n return input === '' ? '' : `${input[0].toLocaleUpperCase()}${input.slice(1)}`;\n }\n\n // For backwards compatibility, don't emit \"complete\" in report text for untrimmed reports.\n const releaseLevelPrefix: string =\n reportVariant === 'complete' ? '' : `${capitalizeFirstLetter(reportVariant)} `;\n writer.writeLine(\n [\n `## ${releaseLevelPrefix}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 const context: IContext = {\n collector,\n reportVariant,\n alreadyProcessedSignatures: new Set()\n };\n\n // Emit the regular declarations\n for (const entity of collector.entities) {\n const astEntity: AstEntity = entity.astEntity;\n const symbolMetadata: SymbolMetadata | undefined = collector.tryFetchMetadataForAstEntity(astEntity);\n const maxEffectiveReleaseTag: ReleaseTag = symbolMetadata?.maxEffectiveReleaseTag ?? ReleaseTag.None;\n\n if (!this._shouldIncludeReleaseTag(maxEffectiveReleaseTag, reportVariant)) {\n continue;\n }\n\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 if (this._shouldIncludeDeclaration(collector, astDeclaration, reportVariant)) {\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(span, entity, astDeclaration, false, context);\n }\n\n span.writeModifiedText(writer);\n writer.ensureNewLine();\n }\n }\n }\n\n if (astEntity instanceof AstNamespaceImport) {\n const astModuleExportInfo: IAstModuleExportInfo = 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 span: Span,\n entity: CollectorEntity,\n astDeclaration: AstDeclaration,\n insideTypeLiteral: boolean,\n context: IContext\n ): void {\n const { collector, reportVariant } = context;\n\n // Should we process this declaration at all?\n if (!ApiReportGenerator._shouldIncludeDeclaration(collector, astDeclaration, reportVariant)) {\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 if (DtsEmitHelpers.isExportKeywordInNamespaceExportDeclaration(span.node)) {\n // This is an export declaration inside a namespace - preserve the export keyword\n break;\n }\n // Otherwise, delete the export keyword -- we will re-add it below\n span.modification.skipAll();\n break;\n\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.Parameter:\n {\n // (signature) -> SyntaxList -> Parameter\n const signatureParent: Span | undefined = span.parent;\n if (signatureParent) {\n if (!context.alreadyProcessedSignatures.has(signatureParent)) {\n context.alreadyProcessedSignatures.add(signatureParent);\n DtsEmitHelpers.normalizeParameterNames(signatureParent);\n }\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 childSpan,\n entity,\n childAstDeclaration,\n insideTypeLiteral,\n context\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 (ApiReportGenerator._shouldIncludeDeclaration(collector, childAstDeclaration, reportVariant)) {\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\n // NOTE: This generates ae-undocumented messages as a side effect\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\n ApiReportGenerator._modifySpan(child, entity, childAstDeclaration, insideTypeLiteral, context);\n }\n }\n }\n\n private static _shouldIncludeDeclaration(\n collector: Collector,\n astDeclaration: AstDeclaration,\n reportVariant: ApiReportVariant\n ): boolean {\n // Private declarations are not included in the API report\n // eslint-disable-next-line no-bitwise\n if ((astDeclaration.modifierFlags & ts.ModifierFlags.Private) !== 0) {\n return false;\n }\n\n const apiItemMetadata: ApiItemMetadata = collector.fetchApiItemMetadata(astDeclaration);\n\n return this._shouldIncludeReleaseTag(apiItemMetadata.effectiveReleaseTag, reportVariant);\n }\n\n private static _shouldIncludeReleaseTag(releaseTag: ReleaseTag, reportVariant: ApiReportVariant): boolean {\n switch (reportVariant) {\n case 'complete':\n return true;\n case 'alpha':\n return (\n releaseTag === ReleaseTag.Alpha ||\n releaseTag === ReleaseTag.Beta ||\n releaseTag === ReleaseTag.Public ||\n // NOTE: No specified release tag is implicitly treated as `@public`.\n releaseTag === ReleaseTag.None\n );\n case 'beta':\n return (\n releaseTag === ReleaseTag.Beta ||\n releaseTag === ReleaseTag.Public ||\n // NOTE: No specified release tag is implicitly treated as `@public`.\n releaseTag === ReleaseTag.None\n );\n case 'public':\n return (\n releaseTag === ReleaseTag.Public ||\n // NOTE: No specified release tag is implicitly treated as `@public`.\n releaseTag === ReleaseTag.None\n );\n default:\n throw new Error(`Unrecognized release level: ${reportVariant}`);\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\n // 1. Release tag (if present)\n if (!apiItemMetadata.releaseTagSameAsParent) {\n if (apiItemMetadata.effectiveReleaseTag !== ReleaseTag.None) {\n footerParts.push(ReleaseTag.getTagName(apiItemMetadata.effectiveReleaseTag));\n }\n }\n\n // 2. Enumerate configured tags, reporting standard system tags first and then other configured tags.\n // Note that the ordering we handle the standard tags is important for backwards compatibility.\n // Also note that we had special mechanisms for checking whether or not an item is documented with these tags,\n // so they are checked specially.\n const {\n '@sealed': reportSealedTag,\n '@virtual': reportVirtualTag,\n '@override': reportOverrideTag,\n '@eventProperty': reportEventPropertyTag,\n '@deprecated': reportDeprecatedTag,\n ...otherTagsToReport\n } = collector.extractorConfig.tagsToReport;\n\n // 2.a Check for standard tags and report those that are both configured and present in the metadata.\n if (reportSealedTag && apiItemMetadata.isSealed) {\n footerParts.push('@sealed');\n }\n if (reportVirtualTag && apiItemMetadata.isVirtual) {\n footerParts.push('@virtual');\n }\n if (reportOverrideTag && apiItemMetadata.isOverride) {\n footerParts.push('@override');\n }\n if (reportEventPropertyTag && apiItemMetadata.isEventProperty) {\n footerParts.push('@eventProperty');\n }\n if (reportDeprecatedTag && apiItemMetadata.tsdocComment?.deprecatedBlock) {\n footerParts.push('@deprecated');\n }\n\n // 2.b Check for other configured tags and report those that are present in the tsdoc metadata.\n for (const [tag, reportTag] of Object.entries(otherTagsToReport)) {\n if (reportTag) {\n // If the tag was not handled specially, check if it is present in the metadata.\n if (apiItemMetadata.tsdocComment?.customBlocks.some((block) => block.blockTag.tagName === tag)) {\n footerParts.push(tag);\n } else if (apiItemMetadata.tsdocComment?.modifierTagSet.hasTagName(tag)) {\n footerParts.push(tag);\n }\n }\n }\n\n // 3. If the item is undocumented, append notice at the end of the list\n if (apiItemMetadata.undocumented) {\n footerParts.push('(undocumented)');\n\n collector.messageRouter.addAnalyzerIssue(\n ExtractorMessageId.Undocumented,\n `Missing documentation for \"${astDeclaration.astSymbol.localName}\".`,\n astDeclaration\n );\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,3 +1,4 @@
|
|
|
1
|
+
import * as ts from 'typescript';
|
|
1
2
|
import type { CollectorEntity } from '../collector/CollectorEntity';
|
|
2
3
|
import { AstImport } from '../analyzer/AstImport';
|
|
3
4
|
import { AstDeclaration } from '../analyzer/AstDeclaration';
|
|
@@ -12,5 +13,17 @@ export declare class DtsEmitHelpers {
|
|
|
12
13
|
static emitNamedExport(writer: IndentedWriter, exportName: string, collectorEntity: CollectorEntity): void;
|
|
13
14
|
static emitStarExports(writer: IndentedWriter, collector: Collector): void;
|
|
14
15
|
static modifyImportTypeSpan(collector: Collector, span: Span, astDeclaration: AstDeclaration, modifyNestedSpan: (childSpan: Span, childAstDeclaration: AstDeclaration) => void): void;
|
|
16
|
+
/**
|
|
17
|
+
* Checks if an export keyword is part of an ExportDeclaration inside a namespace
|
|
18
|
+
* (e.g., "export { Foo, Bar };" inside "declare namespace SDK { ... }").
|
|
19
|
+
* In that case, the export keyword must be preserved, otherwise the output is invalid TypeScript.
|
|
20
|
+
*/
|
|
21
|
+
static isExportKeywordInNamespaceExportDeclaration(node: ts.Node): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Given an array that includes some parameter nodes, this returns an array of the same length;
|
|
24
|
+
* elements that are not undefined correspond to a parameter that should be renamed.
|
|
25
|
+
*/
|
|
26
|
+
static forEachParameterToNormalize(nodes: ArrayLike<ts.Node>, action: (parameter: ts.ParameterDeclaration, syntheticName: string | undefined) => void): void;
|
|
27
|
+
static normalizeParameterNames(signatureSpan: Span): void;
|
|
15
28
|
}
|
|
16
29
|
//# sourceMappingURL=DtsEmitHelpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DtsEmitHelpers.d.ts","sourceRoot":"","sources":["../../src/generators/DtsEmitHelpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DtsEmitHelpers.d.ts","sourceRoot":"","sources":["../../src/generators/DtsEmitHelpers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAIjC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,SAAS,EAAiB,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIvD;;GAEG;AACH,qBAAa,cAAc;WACX,UAAU,CACtB,MAAM,EAAE,cAAc,EACtB,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,SAAS,GACnB,IAAI;WAkDO,eAAe,CAC3B,MAAM,EAAE,cAAc,EACtB,UAAU,EAAE,MAAM,EAClB,eAAe,EAAE,eAAe,GAC/B,IAAI;WAUO,eAAe,CAAC,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI;WASnE,oBAAoB,CAChC,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,cAAc,EAC9B,gBAAgB,EAAE,CAAC,SAAS,EAAE,IAAI,EAAE,mBAAmB,EAAE,cAAc,KAAK,IAAI,GAC/E,IAAI;IAyEP;;;;OAIG;WACW,2CAA2C,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,OAAO;IAajF;;;OAGG;WACW,2BAA2B,CACvC,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC,IAAI,CAAC,EACzB,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,oBAAoB,EAAE,aAAa,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,GACtF,IAAI;WAuEO,uBAAuB,CAAC,aAAa,EAAE,IAAI,GAAG,IAAI;CAuBjE"}
|
|
@@ -41,6 +41,7 @@ const node_core_library_1 = require("@rushstack/node-core-library");
|
|
|
41
41
|
const AstImport_1 = require("../analyzer/AstImport");
|
|
42
42
|
const AstDeclaration_1 = require("../analyzer/AstDeclaration");
|
|
43
43
|
const SourceFileLocationFormatter_1 = require("../analyzer/SourceFileLocationFormatter");
|
|
44
|
+
const TypeScriptHelpers_1 = require("../analyzer/TypeScriptHelpers");
|
|
44
45
|
/**
|
|
45
46
|
* Some common code shared between DtsRollupGenerator and ApiReportGenerator.
|
|
46
47
|
*/
|
|
@@ -160,6 +161,104 @@ class DtsEmitHelpers {
|
|
|
160
161
|
}
|
|
161
162
|
}
|
|
162
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* Checks if an export keyword is part of an ExportDeclaration inside a namespace
|
|
166
|
+
* (e.g., "export { Foo, Bar };" inside "declare namespace SDK { ... }").
|
|
167
|
+
* In that case, the export keyword must be preserved, otherwise the output is invalid TypeScript.
|
|
168
|
+
*/
|
|
169
|
+
static isExportKeywordInNamespaceExportDeclaration(node) {
|
|
170
|
+
if (node.parent && ts.isExportDeclaration(node.parent)) {
|
|
171
|
+
const moduleBlock = TypeScriptHelpers_1.TypeScriptHelpers.findFirstParent(node, ts.SyntaxKind.ModuleBlock);
|
|
172
|
+
if (moduleBlock) {
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Given an array that includes some parameter nodes, this returns an array of the same length;
|
|
180
|
+
* elements that are not undefined correspond to a parameter that should be renamed.
|
|
181
|
+
*/
|
|
182
|
+
static forEachParameterToNormalize(nodes, action) {
|
|
183
|
+
let actionIndex = 0;
|
|
184
|
+
// Optimistically assume that no parameters need to be normalized
|
|
185
|
+
for (actionIndex = 0; actionIndex < nodes.length; ++actionIndex) {
|
|
186
|
+
const parameter = nodes[actionIndex];
|
|
187
|
+
if (!ts.isParameter(parameter)) {
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
action(parameter, undefined);
|
|
191
|
+
if (ts.isObjectBindingPattern(parameter.name) || ts.isArrayBindingPattern(parameter.name)) {
|
|
192
|
+
// Our optimistic assumption was not true; we'll need to stop and calculate alreadyUsedNames
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
if (actionIndex === nodes.length) {
|
|
197
|
+
// Our optimistic assumption was true
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
// First, calculate alreadyUsedNames
|
|
201
|
+
const alreadyUsedNames = [];
|
|
202
|
+
for (let index = 0; index < nodes.length; ++index) {
|
|
203
|
+
const parameter = nodes[index];
|
|
204
|
+
if (!ts.isParameter(parameter)) {
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
if (!(ts.isObjectBindingPattern(parameter.name) || ts.isArrayBindingPattern(parameter.name))) {
|
|
208
|
+
alreadyUsedNames.push(parameter.name.text.trim());
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
// Now continue with the rest of the actions
|
|
212
|
+
for (; actionIndex < nodes.length; ++actionIndex) {
|
|
213
|
+
const parameter = nodes[actionIndex];
|
|
214
|
+
if (!ts.isParameter(parameter)) {
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
if (ts.isObjectBindingPattern(parameter.name) || ts.isArrayBindingPattern(parameter.name)) {
|
|
218
|
+
// Examples:
|
|
219
|
+
//
|
|
220
|
+
// function f({ y, z }: { y: string, z: string })
|
|
221
|
+
// ---> function f(input: { y: string, z: string })
|
|
222
|
+
//
|
|
223
|
+
// function f(x: number, [a, b]: [number, number])
|
|
224
|
+
// ---> function f(x: number, input: [number, number])
|
|
225
|
+
//
|
|
226
|
+
// Example of a naming collision:
|
|
227
|
+
//
|
|
228
|
+
// function f({ a }: { a: string }, { b }: { b: string }, input2: string)
|
|
229
|
+
// ---> function f(input: { a: string }, input3: { b: string }, input2: string)
|
|
230
|
+
const baseName = 'input';
|
|
231
|
+
let counter = 2;
|
|
232
|
+
let syntheticName = baseName;
|
|
233
|
+
while (alreadyUsedNames.includes(syntheticName)) {
|
|
234
|
+
syntheticName = `${baseName}${counter++}`;
|
|
235
|
+
}
|
|
236
|
+
alreadyUsedNames.push(syntheticName);
|
|
237
|
+
action(parameter, syntheticName);
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
action(parameter, undefined);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
static normalizeParameterNames(signatureSpan) {
|
|
245
|
+
const syntheticNamesByNode = new Map();
|
|
246
|
+
DtsEmitHelpers.forEachParameterToNormalize(signatureSpan.node.getChildren(), (parameter, syntheticName) => {
|
|
247
|
+
if (syntheticName !== undefined) {
|
|
248
|
+
syntheticNamesByNode.set(parameter.name, syntheticName);
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
if (syntheticNamesByNode.size > 0) {
|
|
252
|
+
signatureSpan.forEach((childSpan) => {
|
|
253
|
+
const syntheticName = syntheticNamesByNode.get(childSpan.node);
|
|
254
|
+
if (syntheticName !== undefined) {
|
|
255
|
+
childSpan.modification.prefix = syntheticName;
|
|
256
|
+
childSpan.modification.suffix = '';
|
|
257
|
+
childSpan.modification.omitChildren = true;
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
163
262
|
}
|
|
164
263
|
exports.DtsEmitHelpers = DtsEmitHelpers;
|
|
165
264
|
//# sourceMappingURL=DtsEmitHelpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DtsEmitHelpers.js","sourceRoot":"","sources":["../../src/generators/DtsEmitHelpers.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,+CAAiC;AAEjC,oEAA6D;AAG7D,qDAAiE;AACjE,+DAA4D;AAI5D,yFAAsF;AAEtF;;GAEG;AACH,MAAa,cAAc;IAClB,MAAM,CAAC,UAAU,CACtB,MAAsB,EACtB,eAAgC,EAChC,SAAoB;QAEpB,MAAM,YAAY,GAAW,SAAS,CAAC,oBAAoB,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC;QAEvF,QAAQ,SAAS,CAAC,UAAU,EAAE,CAAC;YAC7B,KAAK,yBAAa,CAAC,aAAa;gBAC9B,IAAI,eAAe,CAAC,WAAW,KAAK,SAAS,CAAC,UAAU,EAAE,CAAC;oBACzD,MAAM,CAAC,KAAK,CAAC,GAAG,YAAY,iBAAiB,eAAe,CAAC,WAAW,IAAI,CAAC,CAAC;gBAChF,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,KAAK,CAAC,GAAG,YAAY,IAAI,SAAS,CAAC,UAAU,EAAE,CAAC,CAAC;gBAC1D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IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,WAAW,CAAC;YACzC,CAAC;iBAAM,CAAC;gBACN,4CAA4C;gBAC5C,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;gBAC5B,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,GAAG,gBAAgB,CAAC,WAAW,GAAG,iBAAiB,GAAG,cAAc,EAAE,CAAC;YACpG,CAAC;QACH,CAAC;IACH,CAAC;CACF;AA3JD,wCA2JC","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';\n\nimport { InternalError } from '@rushstack/node-core-library';\n\nimport type { CollectorEntity } from '../collector/CollectorEntity';\nimport { AstImport, AstImportKind } from '../analyzer/AstImport';\nimport { AstDeclaration } from '../analyzer/AstDeclaration';\nimport type { Collector } from '../collector/Collector';\nimport type { Span } from '../analyzer/Span';\nimport type { IndentedWriter } from './IndentedWriter';\nimport { SourceFileLocationFormatter } from '../analyzer/SourceFileLocationFormatter';\n\n/**\n * Some common code shared between DtsRollupGenerator and ApiReportGenerator.\n */\nexport class DtsEmitHelpers {\n public static emitImport(\n writer: IndentedWriter,\n collectorEntity: CollectorEntity,\n astImport: AstImport\n ): void {\n const importPrefix: string = astImport.isTypeOnlyEverywhere ? 'import type' : 'import';\n\n switch (astImport.importKind) {\n case AstImportKind.DefaultImport:\n if (collectorEntity.nameForEmit !== astImport.exportName) {\n writer.write(`${importPrefix} { default as ${collectorEntity.nameForEmit} }`);\n } else {\n writer.write(`${importPrefix} ${astImport.exportName}`);\n }\n writer.writeLine(` from '${astImport.modulePath}';`);\n break;\n case AstImportKind.NamedImport:\n if (collectorEntity.nameForEmit === astImport.exportName) {\n writer.write(`${importPrefix} { ${astImport.exportName} }`);\n } else {\n writer.write(`${importPrefix} { ${astImport.exportName} as ${collectorEntity.nameForEmit} }`);\n }\n writer.writeLine(` from '${astImport.modulePath}';`);\n break;\n case AstImportKind.StarImport:\n writer.writeLine(\n `${importPrefix} * as ${collectorEntity.nameForEmit} from '${astImport.modulePath}';`\n );\n break;\n case AstImportKind.EqualsImport:\n writer.writeLine(\n `${importPrefix} ${collectorEntity.nameForEmit} = require('${astImport.modulePath}');`\n );\n break;\n case AstImportKind.ImportType:\n if (!astImport.exportName) {\n writer.writeLine(\n `${importPrefix} * as ${collectorEntity.nameForEmit} from '${astImport.modulePath}';`\n );\n } else {\n const topExportName: string = astImport.exportName.split('.')[0];\n if (collectorEntity.nameForEmit === topExportName) {\n writer.write(`${importPrefix} { ${topExportName} }`);\n } else {\n writer.write(`${importPrefix} { ${topExportName} as ${collectorEntity.nameForEmit} }`);\n }\n writer.writeLine(` from '${astImport.modulePath}';`);\n }\n break;\n default:\n throw new InternalError('Unimplemented AstImportKind');\n }\n }\n\n public static emitNamedExport(\n writer: IndentedWriter,\n exportName: string,\n collectorEntity: CollectorEntity\n ): void {\n if (exportName === ts.InternalSymbolName.Default) {\n writer.writeLine(`export default ${collectorEntity.nameForEmit};`);\n } else if (collectorEntity.nameForEmit !== exportName) {\n writer.writeLine(`export { ${collectorEntity.nameForEmit} as ${exportName} }`);\n } else {\n writer.writeLine(`export { ${exportName} }`);\n }\n }\n\n public static emitStarExports(writer: IndentedWriter, collector: Collector): void {\n if (collector.starExportedExternalModulePaths.length > 0) {\n writer.writeLine();\n for (const starExportedExternalModulePath of collector.starExportedExternalModulePaths) {\n writer.writeLine(`export * from \"${starExportedExternalModulePath}\";`);\n }\n }\n }\n\n public static modifyImportTypeSpan(\n collector: Collector,\n span: Span,\n astDeclaration: AstDeclaration,\n modifyNestedSpan: (childSpan: Span, childAstDeclaration: AstDeclaration) => void\n ): void {\n const node: ts.ImportTypeNode = span.node as ts.ImportTypeNode;\n const referencedEntity: CollectorEntity | undefined = collector.tryGetEntityForNode(node);\n\n if (referencedEntity) {\n if (!referencedEntity.nameForEmit) {\n // This should never happen\n\n throw new InternalError('referencedEntry.nameForEmit is undefined');\n }\n\n let typeArgumentsText: string = '';\n\n if (node.typeArguments && node.typeArguments.length > 0) {\n // Type arguments have to be processed and written to the document\n const lessThanTokenPos: number = span.children.findIndex(\n (childSpan) => childSpan.node.kind === ts.SyntaxKind.LessThanToken\n );\n const greaterThanTokenPos: number = span.children.findIndex(\n (childSpan) => childSpan.node.kind === ts.SyntaxKind.GreaterThanToken\n );\n\n if (lessThanTokenPos < 0 || greaterThanTokenPos <= lessThanTokenPos) {\n throw new InternalError(\n `Invalid type arguments: ${node.getText()}\\n` +\n SourceFileLocationFormatter.formatDeclaration(node)\n );\n }\n\n const typeArgumentsSpans: Span[] = span.children.slice(lessThanTokenPos + 1, greaterThanTokenPos);\n\n // Apply modifications to Span elements of typeArguments\n typeArgumentsSpans.forEach((childSpan) => {\n const childAstDeclaration: AstDeclaration = AstDeclaration.isSupportedSyntaxKind(childSpan.kind)\n ? collector.astSymbolTable.getChildAstDeclarationByNode(childSpan.node, astDeclaration)\n : astDeclaration;\n\n modifyNestedSpan(childSpan, childAstDeclaration);\n });\n\n const typeArgumentsStrings: string[] = typeArgumentsSpans.map((childSpan) =>\n childSpan.getModifiedText()\n );\n typeArgumentsText = `<${typeArgumentsStrings.join(', ')}>`;\n }\n\n const separatorAfter: string = /(\\s*)$/.exec(span.getText())?.[1] ?? '';\n\n if (\n referencedEntity.astEntity instanceof AstImport &&\n referencedEntity.astEntity.importKind === AstImportKind.ImportType &&\n referencedEntity.astEntity.exportName\n ) {\n // For an ImportType with a namespace chain, only the top namespace is imported.\n // Must add the original nested qualifiers to the rolled up import.\n const qualifiersText: string = node.qualifier?.getText() ?? '';\n const nestedQualifiersStart: number = qualifiersText.indexOf('.');\n // Including the leading \".\"\n const nestedQualifiersText: string =\n nestedQualifiersStart >= 0 ? qualifiersText.substring(nestedQualifiersStart) : '';\n\n const replacement: string = `${referencedEntity.nameForEmit}${nestedQualifiersText}${typeArgumentsText}${separatorAfter}`;\n\n span.modification.skipAll();\n span.modification.prefix = replacement;\n } else {\n // Replace with internal symbol or AstImport\n span.modification.skipAll();\n span.modification.prefix = `${referencedEntity.nameForEmit}${typeArgumentsText}${separatorAfter}`;\n }\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"DtsEmitHelpers.js","sourceRoot":"","sources":["../../src/generators/DtsEmitHelpers.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,+CAAiC;AAEjC,oEAA6D;AAG7D,qDAAiE;AACjE,+DAA4D;AAI5D,yFAAsF;AACtF,qEAAkE;AAElE;;GAEG;AACH,MAAa,cAAc;IAClB,MAAM,CAAC,UAAU,CACtB,MAAsB,EACtB,eAAgC,EAChC,SAAoB;QAEpB,MAAM,YAAY,GAAW,SAAS,CAAC,oBAAoB,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC;QAEvF,QAAQ,SAAS,CAAC,UAAU,EAAE,CAAC;YAC7B,KAAK,yBAAa,CAAC,aAAa;gBAC9B,IAAI,eAAe,CAAC,WAAW,KAAK,SAAS,CAAC,UAAU,EAAE,CAAC;oBACzD,MAAM,CAAC,KAAK,CAAC,GAAG,YAAY,iBAAiB,eAAe,CAAC,WAAW,IAAI,CAAC,CAAC;gBAChF,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,KAAK,CAAC,GAAG,YAAY,IAAI,SAAS,CAAC,UAAU,EAAE,CAAC,CAAC;gBAC1D,CAAC;gBACD,MAAM,CAAC,SAAS,CAAC,UAAU,SAAS,CAAC,UAAU,IAAI,CAAC,CAAC;gBACrD,MAAM;YACR,KAAK,yBAAa,CAAC,WAAW;gBAC5B,IAAI,eAAe,CAAC,WAAW,KAAK,SAAS,CAAC,UAAU,EAAE,CAAC;oBACzD,MAAM,CAAC,KAAK,CAAC,GAAG,YAAY,MAAM,SAAS,CAAC,UAAU,IAAI,CAAC,CAAC;gBAC9D,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC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AC,CAAC;YACnC,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;IACH,CAAC;IAEM,MAAM,CAAC,uBAAuB,CAAC,aAAmB;QACvD,MAAM,oBAAoB,GAAyB,IAAI,GAAG,EAAE,CAAC;QAE7D,cAAc,CAAC,2BAA2B,CACxC,aAAa,CAAC,IAAI,CAAC,WAAW,EAAE,EAChC,CAAC,SAAkC,EAAE,aAAiC,EAAQ,EAAE;YAC9E,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;gBAChC,oBAAoB,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;YAC1D,CAAC;QACH,CAAC,CACF,CAAC;QAEF,IAAI,oBAAoB,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;YAClC,aAAa,CAAC,OAAO,CAAC,CAAC,SAAe,EAAQ,EAAE;gBAC9C,MAAM,aAAa,GAAuB,oBAAoB,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;gBACnF,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;oBAChC,SAAS,CAAC,YAAY,CAAC,MAAM,GAAG,aAAa,CAAC;oBAC9C,SAAS,CAAC,YAAY,CAAC,MAAM,GAAG,EAAE,CAAC;oBACnC,SAAS,CAAC,YAAY,CAAC,YAAY,GAAG,IAAI,CAAC;gBAC7C,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF;AAnRD,wCAmRC","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';\n\nimport { InternalError } from '@rushstack/node-core-library';\n\nimport type { CollectorEntity } from '../collector/CollectorEntity';\nimport { AstImport, AstImportKind } from '../analyzer/AstImport';\nimport { AstDeclaration } from '../analyzer/AstDeclaration';\nimport type { Collector } from '../collector/Collector';\nimport type { Span } from '../analyzer/Span';\nimport type { IndentedWriter } from './IndentedWriter';\nimport { SourceFileLocationFormatter } from '../analyzer/SourceFileLocationFormatter';\nimport { TypeScriptHelpers } from '../analyzer/TypeScriptHelpers';\n\n/**\n * Some common code shared between DtsRollupGenerator and ApiReportGenerator.\n */\nexport class DtsEmitHelpers {\n public static emitImport(\n writer: IndentedWriter,\n collectorEntity: CollectorEntity,\n astImport: AstImport\n ): void {\n const importPrefix: string = astImport.isTypeOnlyEverywhere ? 'import type' : 'import';\n\n switch (astImport.importKind) {\n case AstImportKind.DefaultImport:\n if (collectorEntity.nameForEmit !== astImport.exportName) {\n writer.write(`${importPrefix} { default as ${collectorEntity.nameForEmit} }`);\n } else {\n writer.write(`${importPrefix} ${astImport.exportName}`);\n }\n writer.writeLine(` from '${astImport.modulePath}';`);\n break;\n case AstImportKind.NamedImport:\n if (collectorEntity.nameForEmit === astImport.exportName) {\n writer.write(`${importPrefix} { ${astImport.exportName} }`);\n } else {\n writer.write(`${importPrefix} { ${astImport.exportName} as ${collectorEntity.nameForEmit} }`);\n }\n writer.writeLine(` from '${astImport.modulePath}';`);\n break;\n case AstImportKind.StarImport:\n writer.writeLine(\n `${importPrefix} * as ${collectorEntity.nameForEmit} from '${astImport.modulePath}';`\n );\n break;\n case AstImportKind.EqualsImport:\n writer.writeLine(\n `${importPrefix} ${collectorEntity.nameForEmit} = require('${astImport.modulePath}');`\n );\n break;\n case AstImportKind.ImportType:\n if (!astImport.exportName) {\n writer.writeLine(\n `${importPrefix} * as ${collectorEntity.nameForEmit} from '${astImport.modulePath}';`\n );\n } else {\n const topExportName: string = astImport.exportName.split('.')[0];\n if (collectorEntity.nameForEmit === topExportName) {\n writer.write(`${importPrefix} { ${topExportName} }`);\n } else {\n writer.write(`${importPrefix} { ${topExportName} as ${collectorEntity.nameForEmit} }`);\n }\n writer.writeLine(` from '${astImport.modulePath}';`);\n }\n break;\n default:\n throw new InternalError('Unimplemented AstImportKind');\n }\n }\n\n public static emitNamedExport(\n writer: IndentedWriter,\n exportName: string,\n collectorEntity: CollectorEntity\n ): void {\n if (exportName === ts.InternalSymbolName.Default) {\n writer.writeLine(`export default ${collectorEntity.nameForEmit};`);\n } else if (collectorEntity.nameForEmit !== exportName) {\n writer.writeLine(`export { ${collectorEntity.nameForEmit} as ${exportName} }`);\n } else {\n writer.writeLine(`export { ${exportName} }`);\n }\n }\n\n public static emitStarExports(writer: IndentedWriter, collector: Collector): void {\n if (collector.starExportedExternalModulePaths.length > 0) {\n writer.writeLine();\n for (const starExportedExternalModulePath of collector.starExportedExternalModulePaths) {\n writer.writeLine(`export * from \"${starExportedExternalModulePath}\";`);\n }\n }\n }\n\n public static modifyImportTypeSpan(\n collector: Collector,\n span: Span,\n astDeclaration: AstDeclaration,\n modifyNestedSpan: (childSpan: Span, childAstDeclaration: AstDeclaration) => void\n ): void {\n const node: ts.ImportTypeNode = span.node as ts.ImportTypeNode;\n const referencedEntity: CollectorEntity | undefined = collector.tryGetEntityForNode(node);\n\n if (referencedEntity) {\n if (!referencedEntity.nameForEmit) {\n // This should never happen\n\n throw new InternalError('referencedEntry.nameForEmit is undefined');\n }\n\n let typeArgumentsText: string = '';\n\n if (node.typeArguments && node.typeArguments.length > 0) {\n // Type arguments have to be processed and written to the document\n const lessThanTokenPos: number = span.children.findIndex(\n (childSpan) => childSpan.node.kind === ts.SyntaxKind.LessThanToken\n );\n const greaterThanTokenPos: number = span.children.findIndex(\n (childSpan) => childSpan.node.kind === ts.SyntaxKind.GreaterThanToken\n );\n\n if (lessThanTokenPos < 0 || greaterThanTokenPos <= lessThanTokenPos) {\n throw new InternalError(\n `Invalid type arguments: ${node.getText()}\\n` +\n SourceFileLocationFormatter.formatDeclaration(node)\n );\n }\n\n const typeArgumentsSpans: Span[] = span.children.slice(lessThanTokenPos + 1, greaterThanTokenPos);\n\n // Apply modifications to Span elements of typeArguments\n typeArgumentsSpans.forEach((childSpan) => {\n const childAstDeclaration: AstDeclaration = AstDeclaration.isSupportedSyntaxKind(childSpan.kind)\n ? collector.astSymbolTable.getChildAstDeclarationByNode(childSpan.node, astDeclaration)\n : astDeclaration;\n\n modifyNestedSpan(childSpan, childAstDeclaration);\n });\n\n const typeArgumentsStrings: string[] = typeArgumentsSpans.map((childSpan) =>\n childSpan.getModifiedText()\n );\n typeArgumentsText = `<${typeArgumentsStrings.join(', ')}>`;\n }\n\n const separatorAfter: string = /(\\s*)$/.exec(span.getText())?.[1] ?? '';\n\n if (\n referencedEntity.astEntity instanceof AstImport &&\n referencedEntity.astEntity.importKind === AstImportKind.ImportType &&\n referencedEntity.astEntity.exportName\n ) {\n // For an ImportType with a namespace chain, only the top namespace is imported.\n // Must add the original nested qualifiers to the rolled up import.\n const qualifiersText: string = node.qualifier?.getText() ?? '';\n const nestedQualifiersStart: number = qualifiersText.indexOf('.');\n // Including the leading \".\"\n const nestedQualifiersText: string =\n nestedQualifiersStart >= 0 ? qualifiersText.substring(nestedQualifiersStart) : '';\n\n const replacement: string = `${referencedEntity.nameForEmit}${nestedQualifiersText}${typeArgumentsText}${separatorAfter}`;\n\n span.modification.skipAll();\n span.modification.prefix = replacement;\n } else {\n // Replace with internal symbol or AstImport\n span.modification.skipAll();\n span.modification.prefix = `${referencedEntity.nameForEmit}${typeArgumentsText}${separatorAfter}`;\n }\n }\n }\n\n /**\n * Checks if an export keyword is part of an ExportDeclaration inside a namespace\n * (e.g., \"export { Foo, Bar };\" inside \"declare namespace SDK { ... }\").\n * In that case, the export keyword must be preserved, otherwise the output is invalid TypeScript.\n */\n public static isExportKeywordInNamespaceExportDeclaration(node: ts.Node): boolean {\n if (node.parent && ts.isExportDeclaration(node.parent)) {\n const moduleBlock: ts.ModuleBlock | undefined = TypeScriptHelpers.findFirstParent(\n node,\n ts.SyntaxKind.ModuleBlock\n );\n if (moduleBlock) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Given an array that includes some parameter nodes, this returns an array of the same length;\n * elements that are not undefined correspond to a parameter that should be renamed.\n */\n public static forEachParameterToNormalize(\n nodes: ArrayLike<ts.Node>,\n action: (parameter: ts.ParameterDeclaration, syntheticName: string | undefined) => void\n ): void {\n let actionIndex: number = 0;\n\n // Optimistically assume that no parameters need to be normalized\n for (actionIndex = 0; actionIndex < nodes.length; ++actionIndex) {\n const parameter: ts.Node = nodes[actionIndex];\n if (!ts.isParameter(parameter)) {\n continue;\n }\n action(parameter, undefined);\n if (ts.isObjectBindingPattern(parameter.name) || ts.isArrayBindingPattern(parameter.name)) {\n // Our optimistic assumption was not true; we'll need to stop and calculate alreadyUsedNames\n break;\n }\n }\n\n if (actionIndex === nodes.length) {\n // Our optimistic assumption was true\n return;\n }\n\n // First, calculate alreadyUsedNames\n const alreadyUsedNames: string[] = [];\n\n for (let index: number = 0; index < nodes.length; ++index) {\n const parameter: ts.Node = nodes[index];\n if (!ts.isParameter(parameter)) {\n continue;\n }\n\n if (!(ts.isObjectBindingPattern(parameter.name) || ts.isArrayBindingPattern(parameter.name))) {\n alreadyUsedNames.push(parameter.name.text.trim());\n }\n }\n\n // Now continue with the rest of the actions\n for (; actionIndex < nodes.length; ++actionIndex) {\n const parameter: ts.Node = nodes[actionIndex];\n if (!ts.isParameter(parameter)) {\n continue;\n }\n\n if (ts.isObjectBindingPattern(parameter.name) || ts.isArrayBindingPattern(parameter.name)) {\n // Examples:\n //\n // function f({ y, z }: { y: string, z: string })\n // ---> function f(input: { y: string, z: string })\n //\n // function f(x: number, [a, b]: [number, number])\n // ---> function f(x: number, input: [number, number])\n //\n // Example of a naming collision:\n //\n // function f({ a }: { a: string }, { b }: { b: string }, input2: string)\n // ---> function f(input: { a: string }, input3: { b: string }, input2: string)\n const baseName: string = 'input';\n let counter: number = 2;\n\n let syntheticName: string = baseName;\n while (alreadyUsedNames.includes(syntheticName)) {\n syntheticName = `${baseName}${counter++}`;\n }\n alreadyUsedNames.push(syntheticName);\n\n action(parameter, syntheticName);\n } else {\n action(parameter, undefined);\n }\n }\n }\n\n public static normalizeParameterNames(signatureSpan: Span): void {\n const syntheticNamesByNode: Map<ts.Node, string> = new Map();\n\n DtsEmitHelpers.forEachParameterToNormalize(\n signatureSpan.node.getChildren(),\n (parameter: ts.ParameterDeclaration, syntheticName: string | undefined): void => {\n if (syntheticName !== undefined) {\n syntheticNamesByNode.set(parameter.name, syntheticName);\n }\n }\n );\n\n if (syntheticNamesByNode.size > 0) {\n signatureSpan.forEach((childSpan: Span): void => {\n const syntheticName: string | undefined = syntheticNamesByNode.get(childSpan.node);\n if (syntheticName !== undefined) {\n childSpan.modification.prefix = syntheticName;\n childSpan.modification.suffix = '';\n childSpan.modification.omitChildren = true;\n }\n });\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DtsRollupGenerator.d.ts","sourceRoot":"","sources":["../../src/generators/DtsRollupGenerator.ts"],"names":[],"mappings":"AAMA,OAAO,EAAc,KAAK,WAAW,EAAiB,MAAM,8BAA8B,CAAC;AAE3F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAiBxD;;GAEG;AACH,oBAAY,aAAa;IACvB;;;OAGG;IACH,eAAe,IAAA;IAEf;;;;OAIG;IACH,YAAY,IAAA;IAEZ;;;;OAIG;IACH,WAAW,IAAA;IAEX;;;;OAIG;IACH,aAAa,IAAA;CACd;AAED,qBAAa,kBAAkB;IAC7B;;;;OAIG;WACW,gBAAgB,CAC5B,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,aAAa,EACtB,WAAW,EAAE,WAAW,GACvB,IAAI;IAYP,OAAO,CAAC,MAAM,CAAC,2BAA2B;IAsK1C;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,WAAW;
|
|
1
|
+
{"version":3,"file":"DtsRollupGenerator.d.ts","sourceRoot":"","sources":["../../src/generators/DtsRollupGenerator.ts"],"names":[],"mappings":"AAMA,OAAO,EAAc,KAAK,WAAW,EAAiB,MAAM,8BAA8B,CAAC;AAE3F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAiBxD;;GAEG;AACH,oBAAY,aAAa;IACvB;;;OAGG;IACH,eAAe,IAAA;IAEf;;;;OAIG;IACH,YAAY,IAAA;IAEZ;;;;OAIG;IACH,WAAW,IAAA;IAEX;;;;OAIG;IACH,aAAa,IAAA;CACd;AAED,qBAAa,kBAAkB;IAC7B;;;;OAIG;WACW,gBAAgB,CAC5B,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,aAAa,EACtB,WAAW,EAAE,WAAW,GACvB,IAAI;IAYP,OAAO,CAAC,MAAM,CAAC,2BAA2B;IAsK1C;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,WAAW;IAqN1B,OAAO,CAAC,MAAM,CAAC,wBAAwB;CAyBxC"}
|
|
@@ -246,6 +246,13 @@ class DtsRollupGenerator {
|
|
|
246
246
|
recurseChildren = false;
|
|
247
247
|
break;
|
|
248
248
|
case ts.SyntaxKind.ExportKeyword:
|
|
249
|
+
if (DtsEmitHelpers_1.DtsEmitHelpers.isExportKeywordInNamespaceExportDeclaration(span.node)) {
|
|
250
|
+
// This is an export declaration inside a namespace - preserve the export keyword
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
253
|
+
// Otherwise, delete the export keyword -- we will re-add it below
|
|
254
|
+
span.modification.skipAll();
|
|
255
|
+
break;
|
|
249
256
|
case ts.SyntaxKind.DefaultKeyword:
|
|
250
257
|
case ts.SyntaxKind.DeclareKeyword:
|
|
251
258
|
// Delete any explicit "export" or "declare" keywords -- we will re-add them below
|