@microsoft/api-extractor 7.55.2 → 7.55.5
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 +42 -0
- package/CHANGELOG.md +18 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/generators/ApiReportGenerator.d.ts.map +1 -1
- package/lib/generators/ApiReportGenerator.js +7 -0
- package/lib/generators/ApiReportGenerator.js.map +1 -1
- package/lib/generators/DtsEmitHelpers.d.ts +7 -0
- package/lib/generators/DtsEmitHelpers.d.ts.map +1 -1
- package/lib/generators/DtsEmitHelpers.js +15 -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/package.json +6 -6
package/CHANGELOG.json
CHANGED
|
@@ -1,6 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/api-extractor",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"version": "7.55.5",
|
|
6
|
+
"tag": "@microsoft/api-extractor_v7.55.5",
|
|
7
|
+
"date": "Thu, 08 Jan 2026 01:12:30 GMT",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"comment": "Fix missing 'export' keyword for namespace re-exports that produced invalid TypeScript output"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"version": "7.55.4",
|
|
18
|
+
"tag": "@microsoft/api-extractor_v7.55.4",
|
|
19
|
+
"date": "Wed, 07 Jan 2026 01:12:24 GMT",
|
|
20
|
+
"comments": {
|
|
21
|
+
"dependency": [
|
|
22
|
+
{
|
|
23
|
+
"comment": "Updating dependency \"@rushstack/terminal\" to `0.21.0`"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"comment": "Updating dependency \"@rushstack/ts-command-line\" to `5.1.7`"
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"version": "7.55.3",
|
|
33
|
+
"tag": "@microsoft/api-extractor_v7.55.3",
|
|
34
|
+
"date": "Mon, 05 Jan 2026 16:12:49 GMT",
|
|
35
|
+
"comments": {
|
|
36
|
+
"dependency": [
|
|
37
|
+
{
|
|
38
|
+
"comment": "Updating dependency \"@rushstack/terminal\" to `0.20.0`"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"comment": "Updating dependency \"@rushstack/ts-command-line\" to `5.1.6`"
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
},
|
|
4
46
|
{
|
|
5
47
|
"version": "7.55.2",
|
|
6
48
|
"tag": "@microsoft/api-extractor_v7.55.2",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
# Change Log - @microsoft/api-extractor
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 08 Jan 2026 01:12:30 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 7.55.5
|
|
6
|
+
Thu, 08 Jan 2026 01:12:30 GMT
|
|
7
|
+
|
|
8
|
+
### Patches
|
|
9
|
+
|
|
10
|
+
- Fix missing 'export' keyword for namespace re-exports that produced invalid TypeScript output
|
|
11
|
+
|
|
12
|
+
## 7.55.4
|
|
13
|
+
Wed, 07 Jan 2026 01:12:24 GMT
|
|
14
|
+
|
|
15
|
+
_Version update only_
|
|
16
|
+
|
|
17
|
+
## 7.55.3
|
|
18
|
+
Mon, 05 Jan 2026 16:12:49 GMT
|
|
19
|
+
|
|
20
|
+
_Version update only_
|
|
4
21
|
|
|
5
22
|
## 7.55.2
|
|
6
23
|
Sat, 06 Dec 2025 01:12:28 GMT
|
package/dist/tsdoc-metadata.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiReportGenerator.d.ts","sourceRoot":"","sources":["../../src/generators/ApiReportGenerator.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAgBnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAG3D,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAmB;IAEnD;;;;;;OAMG;WACW,4BAA4B,CACxC,iBAAiB,EAAE,MAAM,EACzB,mBAAmB,EAAE,MAAM,GAC1B,OAAO;IAOV;;;;;OAKG;WACW,yBAAyB,CAAC,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,gBAAgB,GAAG,MAAM;IA6NtG;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,WAAW;
|
|
1
|
+
{"version":3,"file":"ApiReportGenerator.d.ts","sourceRoot":"","sources":["../../src/generators/ApiReportGenerator.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAgBnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAG3D,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAmB;IAEnD;;;;;;OAMG;WACW,4BAA4B,CACxC,iBAAiB,EAAE,MAAM,EACzB,mBAAmB,EAAE,MAAM,GAC1B,OAAO;IAOV;;;;;OAKG;WACW,yBAAyB,CAAC,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,gBAAgB,GAAG,MAAM;IA6NtG;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,WAAW;IAqM1B,OAAO,CAAC,MAAM,CAAC,yBAAyB;IAgBxC,OAAO,CAAC,MAAM,CAAC,wBAAwB;IA8BvC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,yBAAyB;IA8CxC;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAuFhC,OAAO,CAAC,MAAM,CAAC,oBAAoB;CAQpC"}
|
|
@@ -256,6 +256,13 @@ class ApiReportGenerator {
|
|
|
256
256
|
recurseChildren = false;
|
|
257
257
|
break;
|
|
258
258
|
case ts.SyntaxKind.ExportKeyword:
|
|
259
|
+
if (DtsEmitHelpers_1.DtsEmitHelpers.isExportKeywordInNamespaceExportDeclaration(span.node)) {
|
|
260
|
+
// This is an export declaration inside a namespace - preserve the export keyword
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
// Otherwise, delete the export keyword -- we will re-add it below
|
|
264
|
+
span.modification.skipAll();
|
|
265
|
+
break;
|
|
259
266
|
case ts.SyntaxKind.DefaultKeyword:
|
|
260
267
|
case ts.SyntaxKind.DeclareKeyword:
|
|
261
268
|
// Delete any explicit "export" or "declare" keywords -- we will re-add them below
|
|
@@ -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,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,gB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AC,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;AAI/D,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,gB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AG,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;;AAjoBH,gDAkoBC;AAjoBgB,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 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.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,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,11 @@ 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;
|
|
15
22
|
}
|
|
16
23
|
//# 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;CAYlF"}
|
|
@@ -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,20 @@ 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
|
+
}
|
|
163
178
|
}
|
|
164
179
|
exports.DtsEmitHelpers = DtsEmitHelpers;
|
|
165
180
|
//# 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,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,KA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oft 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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AC;CACF;AA7KD,wCA6KC","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"]}
|
|
@@ -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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DtsRollupGenerator.js","sourceRoot":"","sources":["../../src/generators/DtsRollupGenerator.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,+CAAiC;AAEjC,wEAA4D;AAC5D,oEAA2F;AAG3F,qEAAkE;AAClE,2CAAsF;AACtF,qDAAkD;AAElD,+DAA4D;AAE5D,qDAAkD;AAElD,qDAAkD;AAClD,qDAAkD;AAElD,uEAAoE;AAEpE,yFAAsF;AAGtF;;GAEG;AACH,IAAY,aA2BX;AA3BD,WAAY,aAAa;IACvB;;;OAGG;IACH,uEAAe,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Aa,CAAC,eAAe;gBAChC,OAAO,IAAI,CAAC;YACd,KAAK,aAAa,CAAC,YAAY;gBAC7B,OAAO,CACL,UAAU,KAAK,gCAAU,CAAC,KAAK;oBAC/B,UAAU,KAAK,gCAAU,CAAC,IAAI;oBAC9B,UAAU,KAAK,gCAAU,CAAC,MAAM;oBAChC,uFAAuF;oBACvF,UAAU,KAAK,gCAAU,CAAC,IAAI,CAC/B,CAAC;YACJ,KAAK,aAAa,CAAC,WAAW;gBAC5B,OAAO,CACL,UAAU,KAAK,gCAAU,CAAC,IAAI;oBAC9B,UAAU,KAAK,gCAAU,CAAC,MAAM;oBAChC,uFAAuF;oBACvF,UAAU,KAAK,gCAAU,CAAC,IAAI,CAC/B,CAAC;YACJ,KAAK,aAAa,CAAC,aAAa;gBAC9B,OAAO,UAAU,KAAK,gCAAU,CAAC,MAAM,IAAI,UAAU,KAAK,gCAAU,CAAC,IAAI,CAAC;YAC5E;gBACE,MAAM,IAAI,KAAK,CAAC,GAAG,aAAa,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;CACF;AAtaD,gDAsaC","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 { FileSystem, type NewlineKind, InternalError } from '@rushstack/node-core-library';\n\nimport type { Collector } from '../collector/Collector';\nimport { TypeScriptHelpers } from '../analyzer/TypeScriptHelpers';\nimport { IndentDocCommentScope, Span, type SpanModification } from '../analyzer/Span';\nimport { AstImport } from '../analyzer/AstImport';\nimport type { CollectorEntity } from '../collector/CollectorEntity';\nimport { AstDeclaration } from '../analyzer/AstDeclaration';\nimport type { ApiItemMetadata } from '../collector/ApiItemMetadata';\nimport { AstSymbol } from '../analyzer/AstSymbol';\nimport type { SymbolMetadata } from '../collector/SymbolMetadata';\nimport { IndentedWriter } from './IndentedWriter';\nimport { DtsEmitHelpers } from './DtsEmitHelpers';\nimport type { DeclarationMetadata } from '../collector/DeclarationMetadata';\nimport { AstNamespaceImport } from '../analyzer/AstNamespaceImport';\nimport type { IAstModuleExportInfo } from '../analyzer/AstModule';\nimport { SourceFileLocationFormatter } from '../analyzer/SourceFileLocationFormatter';\nimport type { AstEntity } from '../analyzer/AstEntity';\n\n/**\n * Used with DtsRollupGenerator.writeTypingsFile()\n */\nexport enum DtsRollupKind {\n /**\n * Generate a *.d.ts file for an internal release, or for the trimming=false mode.\n * This output file will contain all definitions that are reachable from the entry point.\n */\n InternalRelease,\n\n /**\n * Generate a *.d.ts file for a preview release.\n * This output file will contain all definitions that are reachable from the entry point,\n * except definitions marked as \\@internal.\n */\n AlphaRelease,\n\n /**\n * Generate a *.d.ts file for a preview release.\n * This output file will contain all definitions that are reachable from the entry point,\n * except definitions marked as \\@alpha or \\@internal.\n */\n BetaRelease,\n\n /**\n * Generate a *.d.ts file for a public release.\n * This output file will contain all definitions that are reachable from the entry point,\n * except definitions marked as \\@beta, \\@alpha, or \\@internal.\n */\n PublicRelease\n}\n\nexport class DtsRollupGenerator {\n /**\n * Generates the typings file and writes it to disk.\n *\n * @param dtsFilename - The *.d.ts output filename\n */\n public static writeTypingsFile(\n collector: Collector,\n dtsFilename: string,\n dtsKind: DtsRollupKind,\n newlineKind: NewlineKind\n ): void {\n const writer: IndentedWriter = new IndentedWriter();\n writer.trimLeadingSpaces = true;\n\n DtsRollupGenerator._generateTypingsFileContent(collector, writer, dtsKind);\n\n FileSystem.writeFile(dtsFilename, writer.toString(), {\n convertLineEndings: newlineKind,\n ensureFolderExists: true\n });\n }\n\n private static _generateTypingsFileContent(\n collector: Collector,\n writer: IndentedWriter,\n dtsKind: DtsRollupKind\n ): void {\n // Emit the @packageDocumentation comment at the top of the file\n if (collector.workingPackage.tsdocParserContext) {\n writer.trimLeadingSpaces = false;\n writer.writeLine(collector.workingPackage.tsdocParserContext.sourceRange.toString());\n writer.trimLeadingSpaces = true;\n writer.ensureSkippedLine();\n }\n\n // Emit the triple slash directives\n for (const typeDirectiveReference of collector.dtsTypeReferenceDirectives) {\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 collector.dtsLibReferenceDirectives) {\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 // Note: it isn't valid to trim imports based on their release tags.\n // E.g. class Foo (`@public`) extends interface Bar (`@beta`) from some external library.\n // API-Extractor cannot trim `import { Bar } from \"external-library\"` when generating its public rollup,\n // or the export of `Foo` would include a broken reference to `Bar`.\n const astImport: AstImport = entity.astEntity;\n DtsEmitHelpers.emitImport(writer, entity, astImport);\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\n ? symbolMetadata.maxEffectiveReleaseTag\n : ReleaseTag.None;\n\n if (!this._shouldIncludeReleaseTag(maxEffectiveReleaseTag, dtsKind)) {\n if (!collector.extractorConfig.omitTrimmingComments) {\n writer.ensureSkippedLine();\n writer.writeLine(`/* Excluded from this release type: ${entity.nameForEmit} */`);\n }\n continue;\n }\n\n if (astEntity instanceof AstSymbol) {\n // Emit all the declarations for this entry\n for (const astDeclaration of astEntity.astDeclarations || []) {\n const apiItemMetadata: ApiItemMetadata = collector.fetchApiItemMetadata(astDeclaration);\n\n if (!this._shouldIncludeReleaseTag(apiItemMetadata.effectiveReleaseTag, dtsKind)) {\n if (!collector.extractorConfig.omitTrimmingComments) {\n writer.ensureSkippedLine();\n writer.writeLine(`/* Excluded declaration from this release type: ${entity.nameForEmit} */`);\n }\n continue;\n } else {\n const span: Span = new Span(astDeclaration.declaration);\n DtsRollupGenerator._modifySpan(collector, span, entity, astDeclaration, dtsKind);\n writer.ensureSkippedLine();\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 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 if (entity.shouldInlineExport) {\n writer.write('export ');\n }\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 the entity's declaration won't be included, then neither should the namespace export it\n // This fixes the issue encountered here: https://github.com/microsoft/rushstack/issues/2791\n const exportedSymbolMetadata: SymbolMetadata | undefined =\n collector.tryFetchMetadataForAstEntity(exportedEntity);\n const exportedMaxEffectiveReleaseTag: ReleaseTag = exportedSymbolMetadata\n ? exportedSymbolMetadata.maxEffectiveReleaseTag\n : ReleaseTag.None;\n if (!this._shouldIncludeReleaseTag(exportedMaxEffectiveReleaseTag, dtsKind)) {\n continue;\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 if (!entity.shouldInlineExport) {\n for (const exportName of entity.exportNames) {\n DtsEmitHelpers.emitNamedExport(writer, exportName, entity);\n }\n }\n\n writer.ensureSkippedLine();\n }\n\n DtsEmitHelpers.emitStarExports(writer, collector);\n\n // Emit \"export { }\" which is a special directive that prevents consumers from importing declarations\n // that don't have an explicit \"export\" modifier.\n writer.ensureSkippedLine();\n writer.writeLine('export { }');\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 dtsKind: DtsRollupKind\n ): void {\n const previousSpan: Span | undefined = span.previousSibling;\n\n let recurseChildren: boolean = true;\n switch (span.kind) {\n case ts.SyntaxKind.JSDocComment:\n // If the @packageDocumentation comment seems to be attached to one of the regular API items,\n // omit it. It gets explictly emitted at the top of the file.\n if (span.node.getText().match(/(?:\\s|\\*)@packageDocumentation(?:\\s|\\*)/gi)) {\n span.modification.skipAll();\n }\n\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 // Add a declare statement for root declarations (but not for nested declarations)\n if (!astDeclaration.parent) {\n replacedModifiers += 'declare ';\n }\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.VariableDeclaration:\n // Is this a top-level variable declaration?\n // (The logic below does not apply to variable declarations that are part of an explicit \"namespace\" block,\n // since the compiler prefers not to emit \"declare\" or \"export\" keywords for those declarations.)\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 = 'declare ' + listPrefix + span.modification.prefix;\n span.modification.suffix = ';';\n\n if (entity.shouldInlineExport) {\n span.modification.prefix = 'export ' + span.modification.prefix;\n }\n\n const declarationMetadata: DeclarationMetadata = collector.fetchDeclarationMetadata(astDeclaration);\n if (declarationMetadata.tsdocParserContext) {\n // Typically the comment for a variable declaration is attached to the outer variable statement\n // (which may possibly contain multiple variable declarations), so it's not part of the Span.\n // Instead we need to manually inject it.\n let originalComment: string = declarationMetadata.tsdocParserContext.sourceRange.toString();\n if (!/\\r?\\n\\s*$/.test(originalComment)) {\n originalComment += '\\n';\n }\n span.modification.indentDocComment = IndentDocCommentScope.PrefixOnly;\n span.modification.prefix = originalComment + span.modification.prefix;\n }\n }\n break;\n\n case ts.SyntaxKind.Identifier:\n {\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.ImportType:\n DtsEmitHelpers.modifyImportTypeSpan(\n collector,\n span,\n astDeclaration,\n (childSpan, childAstDeclaration) => {\n DtsRollupGenerator._modifySpan(collector, childSpan, entity, childAstDeclaration, dtsKind);\n }\n );\n break;\n }\n\n if (recurseChildren) {\n for (const child of span.children) {\n let childAstDeclaration: AstDeclaration = astDeclaration;\n\n // Should we trim this node?\n let trimmed: boolean = false;\n if (AstDeclaration.isSupportedSyntaxKind(child.kind)) {\n childAstDeclaration = collector.astSymbolTable.getChildAstDeclarationByNode(\n child.node,\n astDeclaration\n );\n const releaseTag: ReleaseTag =\n collector.fetchApiItemMetadata(childAstDeclaration).effectiveReleaseTag;\n\n if (!this._shouldIncludeReleaseTag(releaseTag, dtsKind)) {\n let nodeToTrim: Span = child;\n\n // If we are trimming a variable statement, then we need to trim the outer VariableDeclarationList\n // as well.\n if (child.kind === ts.SyntaxKind.VariableDeclaration) {\n const variableStatement: Span | undefined = child.findFirstParent(\n ts.SyntaxKind.VariableStatement\n );\n if (variableStatement !== undefined) {\n nodeToTrim = variableStatement;\n }\n }\n\n const modification: SpanModification = nodeToTrim.modification;\n\n // Yes, trim it and stop here\n const name: string = childAstDeclaration.astSymbol.localName;\n modification.omitChildren = true;\n\n if (!collector.extractorConfig.omitTrimmingComments) {\n modification.prefix = `/* Excluded from this release type: ${name} */`;\n } else {\n modification.prefix = '';\n }\n modification.suffix = '';\n\n if (nodeToTrim.children.length > 0) {\n // If there are grandchildren, then keep the last grandchild's separator,\n // since it often has useful whitespace\n modification.suffix = nodeToTrim.children[nodeToTrim.children.length - 1].separator;\n }\n\n if (nodeToTrim.nextSibling) {\n // If the thing we are trimming is followed by a comma, then trim the comma also.\n // An example would be an enum member.\n if (nodeToTrim.nextSibling.kind === ts.SyntaxKind.CommaToken) {\n // Keep its separator since it often has useful whitespace\n modification.suffix += nodeToTrim.nextSibling.separator;\n nodeToTrim.nextSibling.modification.skipAll();\n }\n }\n\n trimmed = true;\n }\n }\n\n if (!trimmed) {\n DtsRollupGenerator._modifySpan(collector, child, entity, childAstDeclaration, dtsKind);\n }\n }\n }\n }\n\n private static _shouldIncludeReleaseTag(releaseTag: ReleaseTag, dtsKind: DtsRollupKind): boolean {\n switch (dtsKind) {\n case DtsRollupKind.InternalRelease:\n return true;\n case DtsRollupKind.AlphaRelease:\n return (\n releaseTag === ReleaseTag.Alpha ||\n releaseTag === ReleaseTag.Beta ||\n releaseTag === ReleaseTag.Public ||\n // NOTE: If the release tag is \"None\", then we don't have enough information to trim it\n releaseTag === ReleaseTag.None\n );\n case DtsRollupKind.BetaRelease:\n return (\n releaseTag === ReleaseTag.Beta ||\n releaseTag === ReleaseTag.Public ||\n // NOTE: If the release tag is \"None\", then we don't have enough information to trim it\n releaseTag === ReleaseTag.None\n );\n case DtsRollupKind.PublicRelease:\n return releaseTag === ReleaseTag.Public || releaseTag === ReleaseTag.None;\n default:\n throw new Error(`${DtsRollupKind[dtsKind]} is not implemented`);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"DtsRollupGenerator.js","sourceRoot":"","sources":["../../src/generators/DtsRollupGenerator.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,+CAAiC;AAEjC,wEAA4D;AAC5D,oEAA2F;AAG3F,qEAAkE;AAClE,2CAAsF;AACtF,qDAAkD;AAElD,+DAA4D;AAE5D,qDAAkD;AAElD,qDAAkD;AAClD,qDAAkD;AAElD,uEAAoE;AAEpE,yFAAsF;AAGtF;;GAEG;AACH,IAAY,aA2BX;AA3BD,WAAY,aAAa;IACvB;;;OAGG;IACH,uEAAe,CAAA;IAEf;;;;OAIG;IACH,iEAAY,CAAA;IAEZ;;;;OAIG;IACH,+DAAW,CAAA;IAEX;;;;OAIG;IACH,mEAAa,CAAA;AACf,CAAC,EA3BW,aAAa,6BAAb,aAAa,QA2BxB;AAED,MAAa,kBAAkB;IAC7B;;;;OAIG;IACI,MAAM,CAAC,gBAAgB,CAC5B,SAAoB,EACpB,WAAmB,EACnB,OAAsB,EACtB,WAAwB;QAExB,MAAM,MAAM,GAAmB,IAAI,+BAAc,EAAE,CAAC;QACpD,MAAM,CAAC,iBAAiB,GAAG,IAAI,CAAC;QAEhC,kBAAkB,CAAC,2BAA2B,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAE3E,8BAAU,CAAC,SAAS,CAAC,WAAW,EAAE,MAAM,CAAC,QAAQ,EAAE,EAAE;YACnD,kBAAkB,EAAE,WAAW;YAC/B,kBAAkB,EAAE,IAAI;SACzB,CAAC,CAAC;IACL,CAAC;IAEO,MAAM,CAAC,2BAA2B,CACxC,SAAoB,EACpB,MAAsB,EACtB,OAAsB;QAEtB,gEAAgE;QAChE,IAAI,SAAS,CAAC,cAAc,CAAC,kBAAkB,EA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AU,KAAK,gCAAU,CAAC,IAAI,CAAC;YAC5E;gBACE,MAAM,IAAI,KAAK,CAAC,GAAG,aAAa,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;CACF;AA9aD,gDA8aC","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 { FileSystem, type NewlineKind, InternalError } from '@rushstack/node-core-library';\n\nimport type { Collector } from '../collector/Collector';\nimport { TypeScriptHelpers } from '../analyzer/TypeScriptHelpers';\nimport { IndentDocCommentScope, Span, type SpanModification } from '../analyzer/Span';\nimport { AstImport } from '../analyzer/AstImport';\nimport type { CollectorEntity } from '../collector/CollectorEntity';\nimport { AstDeclaration } from '../analyzer/AstDeclaration';\nimport type { ApiItemMetadata } from '../collector/ApiItemMetadata';\nimport { AstSymbol } from '../analyzer/AstSymbol';\nimport type { SymbolMetadata } from '../collector/SymbolMetadata';\nimport { IndentedWriter } from './IndentedWriter';\nimport { DtsEmitHelpers } from './DtsEmitHelpers';\nimport type { DeclarationMetadata } from '../collector/DeclarationMetadata';\nimport { AstNamespaceImport } from '../analyzer/AstNamespaceImport';\nimport type { IAstModuleExportInfo } from '../analyzer/AstModule';\nimport { SourceFileLocationFormatter } from '../analyzer/SourceFileLocationFormatter';\nimport type { AstEntity } from '../analyzer/AstEntity';\n\n/**\n * Used with DtsRollupGenerator.writeTypingsFile()\n */\nexport enum DtsRollupKind {\n /**\n * Generate a *.d.ts file for an internal release, or for the trimming=false mode.\n * This output file will contain all definitions that are reachable from the entry point.\n */\n InternalRelease,\n\n /**\n * Generate a *.d.ts file for a preview release.\n * This output file will contain all definitions that are reachable from the entry point,\n * except definitions marked as \\@internal.\n */\n AlphaRelease,\n\n /**\n * Generate a *.d.ts file for a preview release.\n * This output file will contain all definitions that are reachable from the entry point,\n * except definitions marked as \\@alpha or \\@internal.\n */\n BetaRelease,\n\n /**\n * Generate a *.d.ts file for a public release.\n * This output file will contain all definitions that are reachable from the entry point,\n * except definitions marked as \\@beta, \\@alpha, or \\@internal.\n */\n PublicRelease\n}\n\nexport class DtsRollupGenerator {\n /**\n * Generates the typings file and writes it to disk.\n *\n * @param dtsFilename - The *.d.ts output filename\n */\n public static writeTypingsFile(\n collector: Collector,\n dtsFilename: string,\n dtsKind: DtsRollupKind,\n newlineKind: NewlineKind\n ): void {\n const writer: IndentedWriter = new IndentedWriter();\n writer.trimLeadingSpaces = true;\n\n DtsRollupGenerator._generateTypingsFileContent(collector, writer, dtsKind);\n\n FileSystem.writeFile(dtsFilename, writer.toString(), {\n convertLineEndings: newlineKind,\n ensureFolderExists: true\n });\n }\n\n private static _generateTypingsFileContent(\n collector: Collector,\n writer: IndentedWriter,\n dtsKind: DtsRollupKind\n ): void {\n // Emit the @packageDocumentation comment at the top of the file\n if (collector.workingPackage.tsdocParserContext) {\n writer.trimLeadingSpaces = false;\n writer.writeLine(collector.workingPackage.tsdocParserContext.sourceRange.toString());\n writer.trimLeadingSpaces = true;\n writer.ensureSkippedLine();\n }\n\n // Emit the triple slash directives\n for (const typeDirectiveReference of collector.dtsTypeReferenceDirectives) {\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 collector.dtsLibReferenceDirectives) {\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 // Note: it isn't valid to trim imports based on their release tags.\n // E.g. class Foo (`@public`) extends interface Bar (`@beta`) from some external library.\n // API-Extractor cannot trim `import { Bar } from \"external-library\"` when generating its public rollup,\n // or the export of `Foo` would include a broken reference to `Bar`.\n const astImport: AstImport = entity.astEntity;\n DtsEmitHelpers.emitImport(writer, entity, astImport);\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\n ? symbolMetadata.maxEffectiveReleaseTag\n : ReleaseTag.None;\n\n if (!this._shouldIncludeReleaseTag(maxEffectiveReleaseTag, dtsKind)) {\n if (!collector.extractorConfig.omitTrimmingComments) {\n writer.ensureSkippedLine();\n writer.writeLine(`/* Excluded from this release type: ${entity.nameForEmit} */`);\n }\n continue;\n }\n\n if (astEntity instanceof AstSymbol) {\n // Emit all the declarations for this entry\n for (const astDeclaration of astEntity.astDeclarations || []) {\n const apiItemMetadata: ApiItemMetadata = collector.fetchApiItemMetadata(astDeclaration);\n\n if (!this._shouldIncludeReleaseTag(apiItemMetadata.effectiveReleaseTag, dtsKind)) {\n if (!collector.extractorConfig.omitTrimmingComments) {\n writer.ensureSkippedLine();\n writer.writeLine(`/* Excluded declaration from this release type: ${entity.nameForEmit} */`);\n }\n continue;\n } else {\n const span: Span = new Span(astDeclaration.declaration);\n DtsRollupGenerator._modifySpan(collector, span, entity, astDeclaration, dtsKind);\n writer.ensureSkippedLine();\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 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 if (entity.shouldInlineExport) {\n writer.write('export ');\n }\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 the entity's declaration won't be included, then neither should the namespace export it\n // This fixes the issue encountered here: https://github.com/microsoft/rushstack/issues/2791\n const exportedSymbolMetadata: SymbolMetadata | undefined =\n collector.tryFetchMetadataForAstEntity(exportedEntity);\n const exportedMaxEffectiveReleaseTag: ReleaseTag = exportedSymbolMetadata\n ? exportedSymbolMetadata.maxEffectiveReleaseTag\n : ReleaseTag.None;\n if (!this._shouldIncludeReleaseTag(exportedMaxEffectiveReleaseTag, dtsKind)) {\n continue;\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 if (!entity.shouldInlineExport) {\n for (const exportName of entity.exportNames) {\n DtsEmitHelpers.emitNamedExport(writer, exportName, entity);\n }\n }\n\n writer.ensureSkippedLine();\n }\n\n DtsEmitHelpers.emitStarExports(writer, collector);\n\n // Emit \"export { }\" which is a special directive that prevents consumers from importing declarations\n // that don't have an explicit \"export\" modifier.\n writer.ensureSkippedLine();\n writer.writeLine('export { }');\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 dtsKind: DtsRollupKind\n ): void {\n const previousSpan: Span | undefined = span.previousSibling;\n\n let recurseChildren: boolean = true;\n switch (span.kind) {\n case ts.SyntaxKind.JSDocComment:\n // If the @packageDocumentation comment seems to be attached to one of the regular API items,\n // omit it. It gets explictly emitted at the top of the file.\n if (span.node.getText().match(/(?:\\s|\\*)@packageDocumentation(?:\\s|\\*)/gi)) {\n span.modification.skipAll();\n }\n\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 // Add a declare statement for root declarations (but not for nested declarations)\n if (!astDeclaration.parent) {\n replacedModifiers += 'declare ';\n }\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.VariableDeclaration:\n // Is this a top-level variable declaration?\n // (The logic below does not apply to variable declarations that are part of an explicit \"namespace\" block,\n // since the compiler prefers not to emit \"declare\" or \"export\" keywords for those declarations.)\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 = 'declare ' + listPrefix + span.modification.prefix;\n span.modification.suffix = ';';\n\n if (entity.shouldInlineExport) {\n span.modification.prefix = 'export ' + span.modification.prefix;\n }\n\n const declarationMetadata: DeclarationMetadata = collector.fetchDeclarationMetadata(astDeclaration);\n if (declarationMetadata.tsdocParserContext) {\n // Typically the comment for a variable declaration is attached to the outer variable statement\n // (which may possibly contain multiple variable declarations), so it's not part of the Span.\n // Instead we need to manually inject it.\n let originalComment: string = declarationMetadata.tsdocParserContext.sourceRange.toString();\n if (!/\\r?\\n\\s*$/.test(originalComment)) {\n originalComment += '\\n';\n }\n span.modification.indentDocComment = IndentDocCommentScope.PrefixOnly;\n span.modification.prefix = originalComment + span.modification.prefix;\n }\n }\n break;\n\n case ts.SyntaxKind.Identifier:\n {\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.ImportType:\n DtsEmitHelpers.modifyImportTypeSpan(\n collector,\n span,\n astDeclaration,\n (childSpan, childAstDeclaration) => {\n DtsRollupGenerator._modifySpan(collector, childSpan, entity, childAstDeclaration, dtsKind);\n }\n );\n break;\n }\n\n if (recurseChildren) {\n for (const child of span.children) {\n let childAstDeclaration: AstDeclaration = astDeclaration;\n\n // Should we trim this node?\n let trimmed: boolean = false;\n if (AstDeclaration.isSupportedSyntaxKind(child.kind)) {\n childAstDeclaration = collector.astSymbolTable.getChildAstDeclarationByNode(\n child.node,\n astDeclaration\n );\n const releaseTag: ReleaseTag =\n collector.fetchApiItemMetadata(childAstDeclaration).effectiveReleaseTag;\n\n if (!this._shouldIncludeReleaseTag(releaseTag, dtsKind)) {\n let nodeToTrim: Span = child;\n\n // If we are trimming a variable statement, then we need to trim the outer VariableDeclarationList\n // as well.\n if (child.kind === ts.SyntaxKind.VariableDeclaration) {\n const variableStatement: Span | undefined = child.findFirstParent(\n ts.SyntaxKind.VariableStatement\n );\n if (variableStatement !== undefined) {\n nodeToTrim = variableStatement;\n }\n }\n\n const modification: SpanModification = nodeToTrim.modification;\n\n // Yes, trim it and stop here\n const name: string = childAstDeclaration.astSymbol.localName;\n modification.omitChildren = true;\n\n if (!collector.extractorConfig.omitTrimmingComments) {\n modification.prefix = `/* Excluded from this release type: ${name} */`;\n } else {\n modification.prefix = '';\n }\n modification.suffix = '';\n\n if (nodeToTrim.children.length > 0) {\n // If there are grandchildren, then keep the last grandchild's separator,\n // since it often has useful whitespace\n modification.suffix = nodeToTrim.children[nodeToTrim.children.length - 1].separator;\n }\n\n if (nodeToTrim.nextSibling) {\n // If the thing we are trimming is followed by a comma, then trim the comma also.\n // An example would be an enum member.\n if (nodeToTrim.nextSibling.kind === ts.SyntaxKind.CommaToken) {\n // Keep its separator since it often has useful whitespace\n modification.suffix += nodeToTrim.nextSibling.separator;\n nodeToTrim.nextSibling.modification.skipAll();\n }\n }\n\n trimmed = true;\n }\n }\n\n if (!trimmed) {\n DtsRollupGenerator._modifySpan(collector, child, entity, childAstDeclaration, dtsKind);\n }\n }\n }\n }\n\n private static _shouldIncludeReleaseTag(releaseTag: ReleaseTag, dtsKind: DtsRollupKind): boolean {\n switch (dtsKind) {\n case DtsRollupKind.InternalRelease:\n return true;\n case DtsRollupKind.AlphaRelease:\n return (\n releaseTag === ReleaseTag.Alpha ||\n releaseTag === ReleaseTag.Beta ||\n releaseTag === ReleaseTag.Public ||\n // NOTE: If the release tag is \"None\", then we don't have enough information to trim it\n releaseTag === ReleaseTag.None\n );\n case DtsRollupKind.BetaRelease:\n return (\n releaseTag === ReleaseTag.Beta ||\n releaseTag === ReleaseTag.Public ||\n // NOTE: If the release tag is \"None\", then we don't have enough information to trim it\n releaseTag === ReleaseTag.None\n );\n case DtsRollupKind.PublicRelease:\n return releaseTag === ReleaseTag.Public || releaseTag === ReleaseTag.None;\n default:\n throw new Error(`${DtsRollupKind[dtsKind]} is not implemented`);\n }\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/api-extractor",
|
|
3
|
-
"version": "7.55.
|
|
3
|
+
"version": "7.55.5",
|
|
4
4
|
"description": "Analyze the exported API for a TypeScript library and generate reviews, documentation, and .d.ts rollups",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -41,14 +41,14 @@
|
|
|
41
41
|
"semver": "~7.5.4",
|
|
42
42
|
"source-map": "~0.6.1",
|
|
43
43
|
"typescript": "5.8.2",
|
|
44
|
-
"@rushstack/node-core-library": "5.19.1",
|
|
45
|
-
"@rushstack/rig-package": "0.6.0",
|
|
46
44
|
"@microsoft/api-extractor-model": "7.32.2",
|
|
47
|
-
"@rushstack/
|
|
48
|
-
"@rushstack/
|
|
45
|
+
"@rushstack/rig-package": "0.6.0",
|
|
46
|
+
"@rushstack/node-core-library": "5.19.1",
|
|
47
|
+
"@rushstack/ts-command-line": "5.1.7",
|
|
48
|
+
"@rushstack/terminal": "0.21.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@rushstack/heft": "1.1.
|
|
51
|
+
"@rushstack/heft": "1.1.7",
|
|
52
52
|
"@types/lodash": "4.14.116",
|
|
53
53
|
"@types/resolve": "1.20.2",
|
|
54
54
|
"@types/semver": "7.5.0",
|