@microsoft/api-extractor 7.52.15 → 7.53.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/CHANGELOG.json +29 -0
  2. package/CHANGELOG.md +8 -1
  3. package/dist/tsdoc-metadata.json +1 -1
  4. package/lib/aedoc/PackageDocComment.d.ts.map +1 -1
  5. package/lib/aedoc/PackageDocComment.js.map +1 -1
  6. package/lib/analyzer/AstDeclaration.d.ts.map +1 -1
  7. package/lib/analyzer/AstDeclaration.js +1 -1
  8. package/lib/analyzer/AstDeclaration.js.map +1 -1
  9. package/lib/analyzer/AstImport.d.ts.map +1 -1
  10. package/lib/analyzer/AstImport.js.map +1 -1
  11. package/lib/analyzer/AstReferenceResolver.d.ts.map +1 -1
  12. package/lib/analyzer/AstReferenceResolver.js.map +1 -1
  13. package/lib/analyzer/AstSymbol.d.ts.map +1 -1
  14. package/lib/analyzer/AstSymbol.js.map +1 -1
  15. package/lib/analyzer/AstSymbolTable.d.ts.map +1 -1
  16. package/lib/analyzer/AstSymbolTable.js.map +1 -1
  17. package/lib/analyzer/ExportAnalyzer.d.ts.map +1 -1
  18. package/lib/analyzer/ExportAnalyzer.js.map +1 -1
  19. package/lib/analyzer/PackageMetadataManager.d.ts.map +1 -1
  20. package/lib/analyzer/PackageMetadataManager.js +11 -11
  21. package/lib/analyzer/PackageMetadataManager.js.map +1 -1
  22. package/lib/analyzer/SourceFileLocationFormatter.d.ts.map +1 -1
  23. package/lib/analyzer/SourceFileLocationFormatter.js +1 -1
  24. package/lib/analyzer/SourceFileLocationFormatter.js.map +1 -1
  25. package/lib/analyzer/Span.d.ts.map +1 -1
  26. package/lib/analyzer/Span.js.map +1 -1
  27. package/lib/analyzer/TypeScriptHelpers.d.ts.map +1 -1
  28. package/lib/analyzer/TypeScriptHelpers.js +1 -1
  29. package/lib/analyzer/TypeScriptHelpers.js.map +1 -1
  30. package/lib/analyzer/TypeScriptInternals.d.ts.map +1 -1
  31. package/lib/analyzer/TypeScriptInternals.js.map +1 -1
  32. package/lib/api/CompilerState.d.ts.map +1 -1
  33. package/lib/api/CompilerState.js +2 -2
  34. package/lib/api/CompilerState.js.map +1 -1
  35. package/lib/api/Extractor.d.ts.map +1 -1
  36. package/lib/api/Extractor.js +2 -2
  37. package/lib/api/Extractor.js.map +1 -1
  38. package/lib/api/ExtractorConfig.d.ts +2 -2
  39. package/lib/api/ExtractorConfig.d.ts.map +1 -1
  40. package/lib/api/ExtractorConfig.js +3 -3
  41. package/lib/api/ExtractorConfig.js.map +1 -1
  42. package/lib/api/ExtractorMessage.d.ts.map +1 -1
  43. package/lib/api/ExtractorMessage.js.map +1 -1
  44. package/lib/api/IConfigFile.d.ts.map +1 -1
  45. package/lib/api/IConfigFile.js.map +1 -1
  46. package/lib/cli/ApiExtractorCommandLine.js +1 -1
  47. package/lib/cli/ApiExtractorCommandLine.js.map +1 -1
  48. package/lib/cli/InitAction.d.ts.map +1 -1
  49. package/lib/cli/InitAction.js +1 -1
  50. package/lib/cli/InitAction.js.map +1 -1
  51. package/lib/cli/RunAction.d.ts.map +1 -1
  52. package/lib/cli/RunAction.js +2 -2
  53. package/lib/cli/RunAction.js.map +1 -1
  54. package/lib/collector/ApiItemMetadata.d.ts.map +1 -1
  55. package/lib/collector/ApiItemMetadata.js.map +1 -1
  56. package/lib/collector/Collector.d.ts.map +1 -1
  57. package/lib/collector/Collector.js +2 -2
  58. package/lib/collector/Collector.js.map +1 -1
  59. package/lib/collector/CollectorEntity.d.ts.map +1 -1
  60. package/lib/collector/CollectorEntity.js +1 -1
  61. package/lib/collector/CollectorEntity.js.map +1 -1
  62. package/lib/collector/DeclarationMetadata.d.ts.map +1 -1
  63. package/lib/collector/DeclarationMetadata.js.map +1 -1
  64. package/lib/collector/MessageRouter.d.ts.map +1 -1
  65. package/lib/collector/MessageRouter.js.map +1 -1
  66. package/lib/collector/SourceMapper.d.ts.map +1 -1
  67. package/lib/collector/SourceMapper.js +1 -1
  68. package/lib/collector/SourceMapper.js.map +1 -1
  69. package/lib/collector/WorkingPackage.d.ts.map +1 -1
  70. package/lib/collector/WorkingPackage.js.map +1 -1
  71. package/lib/enhancers/DocCommentEnhancer.d.ts.map +1 -1
  72. package/lib/enhancers/DocCommentEnhancer.js +1 -1
  73. package/lib/enhancers/DocCommentEnhancer.js.map +1 -1
  74. package/lib/enhancers/ValidationEnhancer.d.ts.map +1 -1
  75. package/lib/enhancers/ValidationEnhancer.js +2 -2
  76. package/lib/enhancers/ValidationEnhancer.js.map +1 -1
  77. package/lib/generators/ApiModelGenerator.d.ts.map +1 -1
  78. package/lib/generators/ApiModelGenerator.js +1 -1
  79. package/lib/generators/ApiModelGenerator.js.map +1 -1
  80. package/lib/generators/ApiReportGenerator.d.ts.map +1 -1
  81. package/lib/generators/ApiReportGenerator.js +1 -1
  82. package/lib/generators/ApiReportGenerator.js.map +1 -1
  83. package/lib/generators/DeclarationReferenceGenerator.d.ts.map +1 -1
  84. package/lib/generators/DeclarationReferenceGenerator.js.map +1 -1
  85. package/lib/generators/DtsEmitHelpers.d.ts.map +1 -1
  86. package/lib/generators/DtsEmitHelpers.js.map +1 -1
  87. package/lib/generators/DtsRollupGenerator.d.ts.map +1 -1
  88. package/lib/generators/DtsRollupGenerator.js +1 -1
  89. package/lib/generators/DtsRollupGenerator.js.map +1 -1
  90. package/lib/generators/ExcerptBuilder.d.ts.map +1 -1
  91. package/lib/generators/ExcerptBuilder.js.map +1 -1
  92. package/lib/start.js +1 -1
  93. package/lib/start.js.map +1 -1
  94. package/package.json +7 -7
@@ -1 +1 @@
1
- {"version":3,"file":"CollectorEntity.js","sourceRoot":"","sources":["../../src/collector/CollectorEntity.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,+CAAiC;AAEjC,qDAAkD;AAClD,2CAAwC;AACxC,oEAAoD;AAEpD,uEAAoE;AAEpE;;;;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AAI,gBAAgB,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;gBACnD,OAAO,MAAM,CAAC;YAChB,CAAC;QACH,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;OAEG;IACI,aAAa,CAAC,UAAkB;QACrC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;YACvC,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;YAChC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YAElC,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;gBACjC,IAAI,CAAC,iBAAiB,GAAG,UAAU,CAAC;YACtC,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAAC;YACrC,CAAC;QACH,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACI,kBAAkB,CAAC,eAAuB,EAAE,MAAuB;QACxE,MAAM,gBAAgB,GAAgB,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,GAAG,EAAE,CAAC;QAC9F,gBAAgB,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;QAEtC,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC/D,CAAC;IAED;;OAEG;IACI,UAAU;QACf,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,IAAI,CAAC,QAAQ,GAAG,qBAAS,CAAC,4BAA4B,CAAC,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QACvG,CAAC;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF;AAjOD,0CAiOC","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 { AstSymbol } from '../analyzer/AstSymbol';\nimport { Collector } from './Collector';\nimport { Sort } from '@rushstack/node-core-library';\nimport type { AstEntity } from '../analyzer/AstEntity';\nimport { AstNamespaceExport } from '../analyzer/AstNamespaceExport';\n\n/**\n * This is a data structure used by the Collector to track an AstEntity that may be emitted in the *.d.ts file.\n *\n * @remarks\n * The additional contextual state beyond AstSymbol is:\n * - Whether it's an export of this entry point or not\n * - The nameForEmit, which may get renamed by DtsRollupGenerator._makeUniqueNames()\n * - The export name (or names, if the same symbol is exported multiple times)\n */\nexport class CollectorEntity {\n /**\n * The AstEntity that this entry represents.\n */\n public readonly astEntity: AstEntity;\n\n private _exportNames: Set<string> = new Set();\n private _exportNamesSorted: boolean = false;\n private _singleExportName: string | undefined = undefined;\n private _localExportNamesByParent: Map<CollectorEntity, Set<string>> = new Map();\n\n private _nameForEmit: string | undefined = undefined;\n\n private _sortKey: string | undefined = undefined;\n\n public constructor(astEntity: AstEntity) {\n this.astEntity = astEntity;\n }\n\n /**\n * The declaration name that will be emitted in the .d.ts rollup, .api.md, and .api.json files. Generated by\n * `Collector._makeUniqueNames`. Be aware that the declaration may be renamed to avoid conflicts with (1)\n * global names (e.g. `Promise`) and (2) if local, other local names across different files.\n */\n public get nameForEmit(): string | undefined {\n return this._nameForEmit;\n }\n\n public set nameForEmit(value: string | undefined) {\n this._nameForEmit = value;\n this._sortKey = undefined; // invalidate the cached value\n }\n\n /**\n * The list of export names if this symbol is exported from the entry point.\n *\n * @remarks\n * Note that a given symbol may be exported more than once:\n * ```\n * class X { }\n * export { X }\n * export { X as Y }\n * ```\n */\n public get exportNames(): ReadonlySet<string> {\n if (!this._exportNamesSorted) {\n Sort.sortSet(this._exportNames);\n this._exportNamesSorted = true;\n }\n return this._exportNames;\n }\n\n /**\n * If exportNames contains only one string, then singleExportName is that string.\n * In all other cases, it is undefined.\n */\n public get singleExportName(): string | undefined {\n return this._singleExportName;\n }\n\n /**\n * This is true if exportNames contains only one string, and the declaration can be exported using the inline syntax\n * such as \"export class X { }\" instead of \"export { X }\".\n */\n public get shouldInlineExport(): boolean {\n // We export the namespace directly\n if (this.astEntity instanceof AstNamespaceExport) {\n return true;\n }\n\n // We don't inline an AstImport\n if (this.astEntity instanceof AstSymbol) {\n // We don't inline a symbol with more than one exported name\n if (this._singleExportName !== undefined && this._singleExportName !== ts.InternalSymbolName.Default) {\n // We can't inline a symbol whose emitted name is different from the export name\n if (this._nameForEmit === undefined || this._nameForEmit === this._singleExportName) {\n return true;\n }\n }\n }\n return false;\n }\n\n /**\n * Indicates that this entity is exported from the package entry point. Compare to `CollectorEntity.exported`.\n */\n public get exportedFromEntryPoint(): boolean {\n return this.exportNames.size > 0;\n }\n\n /**\n * Indicates that this entity is exported from its parent module (i.e. either the package entry point or\n * a local namespace). Compare to `CollectorEntity.consumable`.\n *\n * @remarks\n * In the example below:\n *\n * ```ts\n * declare function add(): void;\n * declare namespace calculator {\n * export {\n * add\n * }\n * }\n * ```\n *\n * Namespace `calculator` is neither exported nor consumable, function `add` is exported (from `calculator`)\n * but not consumable.\n */\n public get exported(): boolean {\n // Exported from top-level?\n if (this.exportedFromEntryPoint) return true;\n\n // Exported from parent?\n for (const localExportNames of this._localExportNamesByParent.values()) {\n if (localExportNames.size > 0) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Indicates that it is possible for a consumer of the API to \"consume\" this entity, either by importing\n * it directly or via a namespace. If an entity is not consumable, then API Extractor will report an\n * `ae-forgotten-export` warning. Compare to `CollectorEntity.exported`.\n *\n * @remarks\n * An API item is consumable if:\n *\n * 1. It is exported from the top-level entry point OR\n * 2. It is exported from a consumable parent entity.\n *\n * For an example of #2, consider how `AstNamespaceImport` entities are processed. A generated rollup.d.ts\n * might look like this:\n *\n * ```ts\n * declare function add(): void;\n * declare namespace calculator {\n * export {\n * add\n * }\n * }\n * export { calculator }\n * ```\n *\n * In this example, `add` is exported via the consumable `calculator` namespace.\n */\n public get consumable(): boolean {\n // Exported from top-level?\n if (this.exportedFromEntryPoint) return true;\n\n // Exported from consumable parent?\n for (const [parent, localExportNames] of this._localExportNamesByParent) {\n if (localExportNames.size > 0 && parent.consumable) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Return the first consumable parent that exports this entity. If there is none, returns\n * `undefined`.\n */\n public getFirstExportingConsumableParent(): CollectorEntity | undefined {\n for (const [parent, localExportNames] of this._localExportNamesByParent) {\n if (parent.consumable && localExportNames.size > 0) {\n return parent;\n }\n }\n return undefined;\n }\n\n /**\n * Adds a new export name to the entity.\n */\n public addExportName(exportName: string): void {\n if (!this._exportNames.has(exportName)) {\n this._exportNamesSorted = false;\n this._exportNames.add(exportName);\n\n if (this._exportNames.size === 1) {\n this._singleExportName = exportName;\n } else {\n this._singleExportName = undefined;\n }\n }\n }\n\n /**\n * Adds a new local export name to the entity.\n *\n * @remarks\n * In the example below:\n *\n * ```ts\n * declare function add(): void;\n * declare namespace calculator {\n * export {\n * add\n * }\n * }\n * ```\n *\n * `add` is the local export name for the `CollectorEntity` for `add`.\n */\n public addLocalExportName(localExportName: string, parent: CollectorEntity): void {\n const localExportNames: Set<string> = this._localExportNamesByParent.get(parent) || new Set();\n localExportNames.add(localExportName);\n\n this._localExportNamesByParent.set(parent, localExportNames);\n }\n\n /**\n * A sorting key used by DtsRollupGenerator._makeUniqueNames()\n */\n public getSortKey(): string {\n if (!this._sortKey) {\n this._sortKey = Collector.getSortKeyIgnoringUnderscore(this.nameForEmit || this.astEntity.localName);\n }\n return this._sortKey;\n }\n}\n"]}
1
+ {"version":3,"file":"CollectorEntity.js","sourceRoot":"","sources":["../../src/collector/CollectorEntity.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,+CAAiC;AAEjC,oEAAoD;AAEpD,qDAAkD;AAClD,2CAAwC;AAExC,uEAAoE;AAEpE;;;;;;;;GAQG;AACH,MAAa,e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I,GAAG,CAAC,EAAE,CAAC;gBACnD,OAAO,MAAM,CAAC;YAChB,CAAC;QACH,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;OAEG;IACI,aAAa,CAAC,UAAkB;QACrC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;YACvC,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;YAChC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YAElC,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;gBACjC,IAAI,CAAC,iBAAiB,GAAG,UAAU,CAAC;YACtC,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAAC;YACrC,CAAC;QACH,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACI,kBAAkB,CAAC,eAAuB,EAAE,MAAuB;QACxE,MAAM,gBAAgB,GAAgB,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,GAAG,EAAE,CAAC;QAC9F,gBAAgB,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;QAEtC,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC/D,CAAC;IAED;;OAEG;IACI,UAAU;QACf,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,IAAI,CAAC,QAAQ,GAAG,qBAAS,CAAC,4BAA4B,CAAC,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QACvG,CAAC;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF;AAjOD,0CAiOC","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 { Sort } from '@rushstack/node-core-library';\n\nimport { AstSymbol } from '../analyzer/AstSymbol';\nimport { Collector } from './Collector';\nimport type { AstEntity } from '../analyzer/AstEntity';\nimport { AstNamespaceExport } from '../analyzer/AstNamespaceExport';\n\n/**\n * This is a data structure used by the Collector to track an AstEntity that may be emitted in the *.d.ts file.\n *\n * @remarks\n * The additional contextual state beyond AstSymbol is:\n * - Whether it's an export of this entry point or not\n * - The nameForEmit, which may get renamed by DtsRollupGenerator._makeUniqueNames()\n * - The export name (or names, if the same symbol is exported multiple times)\n */\nexport class CollectorEntity {\n /**\n * The AstEntity that this entry represents.\n */\n public readonly astEntity: AstEntity;\n\n private _exportNames: Set<string> = new Set();\n private _exportNamesSorted: boolean = false;\n private _singleExportName: string | undefined = undefined;\n private _localExportNamesByParent: Map<CollectorEntity, Set<string>> = new Map();\n\n private _nameForEmit: string | undefined = undefined;\n\n private _sortKey: string | undefined = undefined;\n\n public constructor(astEntity: AstEntity) {\n this.astEntity = astEntity;\n }\n\n /**\n * The declaration name that will be emitted in the .d.ts rollup, .api.md, and .api.json files. Generated by\n * `Collector._makeUniqueNames`. Be aware that the declaration may be renamed to avoid conflicts with (1)\n * global names (e.g. `Promise`) and (2) if local, other local names across different files.\n */\n public get nameForEmit(): string | undefined {\n return this._nameForEmit;\n }\n\n public set nameForEmit(value: string | undefined) {\n this._nameForEmit = value;\n this._sortKey = undefined; // invalidate the cached value\n }\n\n /**\n * The list of export names if this symbol is exported from the entry point.\n *\n * @remarks\n * Note that a given symbol may be exported more than once:\n * ```\n * class X { }\n * export { X }\n * export { X as Y }\n * ```\n */\n public get exportNames(): ReadonlySet<string> {\n if (!this._exportNamesSorted) {\n Sort.sortSet(this._exportNames);\n this._exportNamesSorted = true;\n }\n return this._exportNames;\n }\n\n /**\n * If exportNames contains only one string, then singleExportName is that string.\n * In all other cases, it is undefined.\n */\n public get singleExportName(): string | undefined {\n return this._singleExportName;\n }\n\n /**\n * This is true if exportNames contains only one string, and the declaration can be exported using the inline syntax\n * such as \"export class X { }\" instead of \"export { X }\".\n */\n public get shouldInlineExport(): boolean {\n // We export the namespace directly\n if (this.astEntity instanceof AstNamespaceExport) {\n return true;\n }\n\n // We don't inline an AstImport\n if (this.astEntity instanceof AstSymbol) {\n // We don't inline a symbol with more than one exported name\n if (this._singleExportName !== undefined && this._singleExportName !== ts.InternalSymbolName.Default) {\n // We can't inline a symbol whose emitted name is different from the export name\n if (this._nameForEmit === undefined || this._nameForEmit === this._singleExportName) {\n return true;\n }\n }\n }\n return false;\n }\n\n /**\n * Indicates that this entity is exported from the package entry point. Compare to `CollectorEntity.exported`.\n */\n public get exportedFromEntryPoint(): boolean {\n return this.exportNames.size > 0;\n }\n\n /**\n * Indicates that this entity is exported from its parent module (i.e. either the package entry point or\n * a local namespace). Compare to `CollectorEntity.consumable`.\n *\n * @remarks\n * In the example below:\n *\n * ```ts\n * declare function add(): void;\n * declare namespace calculator {\n * export {\n * add\n * }\n * }\n * ```\n *\n * Namespace `calculator` is neither exported nor consumable, function `add` is exported (from `calculator`)\n * but not consumable.\n */\n public get exported(): boolean {\n // Exported from top-level?\n if (this.exportedFromEntryPoint) return true;\n\n // Exported from parent?\n for (const localExportNames of this._localExportNamesByParent.values()) {\n if (localExportNames.size > 0) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Indicates that it is possible for a consumer of the API to \"consume\" this entity, either by importing\n * it directly or via a namespace. If an entity is not consumable, then API Extractor will report an\n * `ae-forgotten-export` warning. Compare to `CollectorEntity.exported`.\n *\n * @remarks\n * An API item is consumable if:\n *\n * 1. It is exported from the top-level entry point OR\n * 2. It is exported from a consumable parent entity.\n *\n * For an example of #2, consider how `AstNamespaceImport` entities are processed. A generated rollup.d.ts\n * might look like this:\n *\n * ```ts\n * declare function add(): void;\n * declare namespace calculator {\n * export {\n * add\n * }\n * }\n * export { calculator }\n * ```\n *\n * In this example, `add` is exported via the consumable `calculator` namespace.\n */\n public get consumable(): boolean {\n // Exported from top-level?\n if (this.exportedFromEntryPoint) return true;\n\n // Exported from consumable parent?\n for (const [parent, localExportNames] of this._localExportNamesByParent) {\n if (localExportNames.size > 0 && parent.consumable) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Return the first consumable parent that exports this entity. If there is none, returns\n * `undefined`.\n */\n public getFirstExportingConsumableParent(): CollectorEntity | undefined {\n for (const [parent, localExportNames] of this._localExportNamesByParent) {\n if (parent.consumable && localExportNames.size > 0) {\n return parent;\n }\n }\n return undefined;\n }\n\n /**\n * Adds a new export name to the entity.\n */\n public addExportName(exportName: string): void {\n if (!this._exportNames.has(exportName)) {\n this._exportNamesSorted = false;\n this._exportNames.add(exportName);\n\n if (this._exportNames.size === 1) {\n this._singleExportName = exportName;\n } else {\n this._singleExportName = undefined;\n }\n }\n }\n\n /**\n * Adds a new local export name to the entity.\n *\n * @remarks\n * In the example below:\n *\n * ```ts\n * declare function add(): void;\n * declare namespace calculator {\n * export {\n * add\n * }\n * }\n * ```\n *\n * `add` is the local export name for the `CollectorEntity` for `add`.\n */\n public addLocalExportName(localExportName: string, parent: CollectorEntity): void {\n const localExportNames: Set<string> = this._localExportNamesByParent.get(parent) || new Set();\n localExportNames.add(localExportName);\n\n this._localExportNamesByParent.set(parent, localExportNames);\n }\n\n /**\n * A sorting key used by DtsRollupGenerator._makeUniqueNames()\n */\n public getSortKey(): string {\n if (!this._sortKey) {\n this._sortKey = Collector.getSortKeyIgnoringUnderscore(this.nameForEmit || this.astEntity.localName);\n }\n return this._sortKey;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"DeclarationMetadata.d.ts","sourceRoot":"","sources":["../../src/collector/DeclarationMetadata.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE;;;;;;;GAOG;AACH,8BAAsB,mBAAmB;IACvC;;;;;;OAMG;IACH,kBAAyB,kBAAkB,EAAE,KAAK,CAAC,aAAa,GAAG,SAAS,CAAC;IAE7E;;OAEG;IACH,kBAAyB,WAAW,EAAE,OAAO,CAAC;IAE9C;;;;;;OAMG;IACH,kBAAyB,qBAAqB,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;CAC/E;AAED;;GAEG;AACH,qBAAa,2BAA4B,SAAQ,mBAAmB;IAC3D,kBAAkB,EAAE,KAAK,CAAC,aAAa,GAAG,SAAS,CAAa;IAEhE,WAAW,EAAE,OAAO,CAAS;IAE7B,qBAAqB,EAAE,cAAc,EAAE,CAAM;CACrD"}
1
+ {"version":3,"file":"DeclarationMetadata.d.ts","sourceRoot":"","sources":["../../src/collector/DeclarationMetadata.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAE/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE;;;;;;;GAOG;AACH,8BAAsB,mBAAmB;IACvC;;;;;;OAMG;IACH,kBAAyB,kBAAkB,EAAE,KAAK,CAAC,aAAa,GAAG,SAAS,CAAC;IAE7E;;OAEG;IACH,kBAAyB,WAAW,EAAE,OAAO,CAAC;IAE9C;;;;;;OAMG;IACH,kBAAyB,qBAAqB,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;CAC/E;AAED;;GAEG;AACH,qBAAa,2BAA4B,SAAQ,mBAAmB;IAC3D,kBAAkB,EAAE,KAAK,CAAC,aAAa,GAAG,SAAS,CAAa;IAEhE,WAAW,EAAE,OAAO,CAAS;IAE7B,qBAAqB,EAAE,cAAc,EAAE,CAAM;CACrD"}
@@ -1 +1 @@
1
- {"version":3,"file":"DeclarationMetadata.js","sourceRoot":"","sources":["../../src/collector/DeclarationMetadata.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAK3D;;;;;;;GAOG;AACH,MAAsB,mBAAmB;CAuBxC;AAvBD,kDAuBC;AAED;;GAEG;AACH,MAAa,2BAA4B,SAAQ,mBAAmB;IAApE;;QACS,uBAAkB,GAAoC,SAAS,CAAC;QAEhE,gBAAW,GAAY,KAAK,CAAC;QAE7B,0BAAqB,GAAqB,EAAE,CAAC;IACtD,CAAC;CAAA;AAND,kEAMC","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 type * as tsdoc from '@microsoft/tsdoc';\nimport type { AstDeclaration } from '../analyzer/AstDeclaration';\n\n/**\n * Stores the Collector's additional analysis for a specific `AstDeclaration` signature. This object is assigned to\n * `AstDeclaration.declarationMetadata` but consumers must always obtain it by calling\n * `Collector.fetchDeclarationMetadata()`.\n *\n * Note that ancillary declarations share their `ApiItemMetadata` with the main declaration,\n * whereas a separate `DeclarationMetadata` object is created for each declaration.\n */\nexport abstract class DeclarationMetadata {\n /**\n * The ParserContext from when the TSDoc comment was parsed from the source code.\n * If the source code did not contain a doc comment, then this will be undefined.\n *\n * Note that if an ancillary declaration has a doc comment, it is tracked here, whereas\n * `ApiItemMetadata.tsdocComment` corresponds to documentation for the main declaration.\n */\n public abstract readonly tsdocParserContext: tsdoc.ParserContext | undefined;\n\n /**\n * If true, then this declaration is treated as part of another declaration.\n */\n public abstract readonly isAncillary: boolean;\n\n /**\n * A list of other declarations that are treated as being part of this declaration. For example, a property\n * getter/setter pair will be treated as a single API item, with the setter being treated as ancillary to the getter.\n *\n * If the `ancillaryDeclarations` array is non-empty, then `isAncillary` will be false for this declaration,\n * and `isAncillary` will be true for all the array items.\n */\n public abstract readonly ancillaryDeclarations: ReadonlyArray<AstDeclaration>;\n}\n\n/**\n * Used internally by the `Collector` to build up `DeclarationMetadata`.\n */\nexport class InternalDeclarationMetadata extends DeclarationMetadata {\n public tsdocParserContext: tsdoc.ParserContext | undefined = undefined;\n\n public isAncillary: boolean = false;\n\n public ancillaryDeclarations: AstDeclaration[] = [];\n}\n"]}
1
+ {"version":3,"file":"DeclarationMetadata.js","sourceRoot":"","sources":["../../src/collector/DeclarationMetadata.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAM3D;;;;;;;GAOG;AACH,MAAsB,mBAAmB;CAuBxC;AAvBD,kDAuBC;AAED;;GAEG;AACH,MAAa,2BAA4B,SAAQ,mBAAmB;IAApE;;QACS,uBAAkB,GAAoC,SAAS,CAAC;QAEhE,gBAAW,GAAY,KAAK,CAAC;QAE7B,0BAAqB,GAAqB,EAAE,CAAC;IACtD,CAAC;CAAA;AAND,kEAMC","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 type * as tsdoc from '@microsoft/tsdoc';\n\nimport type { AstDeclaration } from '../analyzer/AstDeclaration';\n\n/**\n * Stores the Collector's additional analysis for a specific `AstDeclaration` signature. This object is assigned to\n * `AstDeclaration.declarationMetadata` but consumers must always obtain it by calling\n * `Collector.fetchDeclarationMetadata()`.\n *\n * Note that ancillary declarations share their `ApiItemMetadata` with the main declaration,\n * whereas a separate `DeclarationMetadata` object is created for each declaration.\n */\nexport abstract class DeclarationMetadata {\n /**\n * The ParserContext from when the TSDoc comment was parsed from the source code.\n * If the source code did not contain a doc comment, then this will be undefined.\n *\n * Note that if an ancillary declaration has a doc comment, it is tracked here, whereas\n * `ApiItemMetadata.tsdocComment` corresponds to documentation for the main declaration.\n */\n public abstract readonly tsdocParserContext: tsdoc.ParserContext | undefined;\n\n /**\n * If true, then this declaration is treated as part of another declaration.\n */\n public abstract readonly isAncillary: boolean;\n\n /**\n * A list of other declarations that are treated as being part of this declaration. For example, a property\n * getter/setter pair will be treated as a single API item, with the setter being treated as ancillary to the getter.\n *\n * If the `ancillaryDeclarations` array is non-empty, then `isAncillary` will be false for this declaration,\n * and `isAncillary` will be true for all the array items.\n */\n public abstract readonly ancillaryDeclarations: ReadonlyArray<AstDeclaration>;\n}\n\n/**\n * Used internally by the `Collector` to build up `DeclarationMetadata`.\n */\nexport class InternalDeclarationMetadata extends DeclarationMetadata {\n public tsdocParserContext: tsdoc.ParserContext | undefined = undefined;\n\n public isAncillary: boolean = false;\n\n public ancillaryDeclarations: AstDeclaration[] = [];\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"MessageRouter.d.ts","sourceRoot":"","sources":["../../src/collector/MessageRouter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,KAAK,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAI/C,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EACL,gBAAgB,EAGhB,KAAK,2BAA2B,EACjC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,KAAK,kBAAkB,EAA0B,MAAM,2BAA2B,CAAC;AAC5F,OAAO,KAAK,EAAE,wBAAwB,EAA+B,MAAM,oBAAoB,CAAC;AAChG,OAAO,KAAK,EAAmB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAO3D,MAAM,WAAW,qBAAqB;IACpC,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACnE,cAAc,EAAE,wBAAwB,CAAC;IACzC,mBAAmB,EAAE,OAAO,CAAC;IAC7B,eAAe,EAAE,OAAO,CAAC;IACzB,kBAAkB,EAAE,KAAK,CAAC,kBAAkB,CAAC;IAC7C,YAAY,EAAE,YAAY,CAAC;CAC5B;AAED,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,qBAAa,aAAa;IACxB,gBAAuB,gBAAgB,EAAE,MAAM,CACkB;IAEjE,OAAO,CAAC,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AI,IAAI,KAAK,CAAC,EAAE,CAAC;gBACf,OAAO,IAAI,CAAC;YACd,CAAC;YACD,yBAAyB;YACzB,OAAO,wBAAI,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;IACL,CAAC;;AApmBH,sCAqmBC;AApmBwB,8BAAgB,GACrC,8DAA8D,AADzB,CAC0B","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as ts from 'typescript';\nimport type * as tsdoc from '@microsoft/tsdoc';\nimport { Sort, InternalError } from '@rushstack/node-core-library';\nimport { Colorize } from '@rushstack/terminal';\n\nimport { AstDeclaration } from '../analyzer/AstDeclaration';\nimport type { AstSymbol } from '../analyzer/AstSymbol';\nimport {\n ExtractorMessage,\n ExtractorMessageCategory,\n type IExtractorMessageOptions,\n type IExtractorMessageProperties\n} from '../api/ExtractorMessage';\nimport { type ExtractorMessageId, allExtractorMessageIds } from '../api/ExtractorMessageId';\nimport type { IExtractorMessagesConfig, IConfigMessageReportingRule } from '../api/IConfigFile';\nimport type { ISourceLocation, SourceMapper } from './SourceMapper';\nimport { ExtractorLogLevel } from '../api/ExtractorLogLevel';\nimport { ConsoleMessageId } from '../api/ConsoleMessageId';\n\ninterface IReportingRule {\n logLevel: ExtractorLogLevel;\n addToApiReportFile: boolean;\n}\n\nexport interface IMessageRouterOptions {\n workingPackageFolder: string | undefined;\n messageCallback: ((message: ExtractorMessage) => void) | undefined;\n messagesConfig: IExtractorMessagesConfig;\n showVerboseMessages: boolean;\n showDiagnostics: boolean;\n tsdocConfiguration: tsdoc.TSDocConfiguration;\n sourceMapper: SourceMapper;\n}\n\nexport interface IBuildJsonDumpObjectOptions {\n /**\n * {@link MessageRouter.buildJsonDumpObject} will omit any objects keys with these names.\n */\n keyNamesToOmit?: string[];\n}\n\nexport class MessageRouter {\n public static readonly DIAGNOSTICS_LINE: string =\n '============================================================';\n\n private readonly _workingPackageFolder: string | undefined;\n private readonly _messageCallback: ((message: ExtractorMessage) => void) | undefined;\n\n // All messages\n private readonly _messages: ExtractorMessage[];\n\n // For each AstDeclaration, the messages associated with it. This is used when addToApiReportFile=true\n private readonly _associatedMessagesForAstDeclaration: Map<AstDeclaration, ExtractorMessage[]>;\n\n private readonly _sourceMapper: SourceMapper;\n\n private readonly _tsdocConfiguration: tsdoc.TSDocConfiguration;\n\n // Normalized representation of the routing rules from api-extractor.json\n private _reportingRuleByMessageId: Map<string, IReportingRule> = new Map<string, IReportingRule>();\n private _compilerDefaultRule: IReportingRule = {\n logLevel: ExtractorLogLevel.None,\n addToApiReportFile: false\n };\n private _extractorDefaultRule: IReportingRule = {\n logLevel: ExtractorLogLevel.None,\n addToApiReportFile: false\n };\n private _tsdocDefaultRule: IReportingRule = { logLevel: ExtractorLogLevel.None, addToApiReportFile: false };\n\n public errorCount: number = 0;\n public warningCount: number = 0;\n\n /**\n * See {@link IExtractorInvokeOptions.showVerboseMessages}\n */\n public readonly showVerboseMessages: boolean;\n\n /**\n * See {@link IExtractorInvokeOptions.showDiagnostics}\n */\n public readonly showDiagnostics: boolean;\n\n public constructor(options: IMessageRouterOptions) {\n this._workingPackageFolder = options.workingPackageFolder;\n this._messageCallback = options.messageCallback;\n\n this._messages = [];\n this._associatedMessagesForAstDeclaration = new Map<AstDeclaration, ExtractorMessage[]>();\n this._sourceMapper = options.sourceMapper;\n this._tsdocConfiguration = options.tsdocConfiguration;\n\n // showDiagnostics implies showVerboseMessages\n this.showVerboseMessages = options.showVerboseMessages || options.showDiagnostics;\n this.showDiagnostics = options.showDiagnostics;\n\n this._applyMessagesConfig(options.messagesConfig);\n }\n\n /**\n * Read the api-extractor.json configuration and build up the tables of routing rules.\n */\n private _applyMessagesConfig(messagesConfig: IExtractorMessagesConfig): void {\n if (messagesConfig.compilerMessageReporting) {\n for (const messageId of Object.getOwnPropertyNames(messagesConfig.compilerMessageReporting)) {\n const reportingRule: IReportingRule = MessageRouter._getNormalizedRule(\n messagesConfig.compilerMessageReporting[messageId]\n );\n\n if (messageId === 'default') {\n this._compilerDefaultRule = reportingRule;\n } else if (!/^TS[0-9]+$/.test(messageId)) {\n throw new Error(\n `Error in API Extractor config: The messages.compilerMessageReporting table contains` +\n ` an invalid entry \"${messageId}\". The identifier format is \"TS\" followed by an integer.`\n );\n } else {\n this._reportingRuleByMessageId.set(messageId, reportingRule);\n }\n }\n }\n\n if (messagesConfig.extractorMessageReporting) {\n for (const messageId of Object.getOwnPropertyNames(messagesConfig.extractorMessageReporting)) {\n const reportingRule: IReportingRule = MessageRouter._getNormalizedRule(\n messagesConfig.extractorMessageReporting[messageId]\n );\n\n if (messageId === 'default') {\n this._extractorDefaultRule = reportingRule;\n } else if (!/^ae-/.test(messageId)) {\n throw new Error(\n `Error in API Extractor config: The messages.extractorMessageReporting table contains` +\n ` an invalid entry \"${messageId}\". The name should begin with the \"ae-\" prefix.`\n );\n } else if (!allExtractorMessageIds.has(messageId)) {\n throw new Error(\n `Error in API Extractor config: The messages.extractorMessageReporting table contains` +\n ` an unrecognized identifier \"${messageId}\". Is it spelled correctly?`\n );\n } else {\n this._reportingRuleByMessageId.set(messageId, reportingRule);\n }\n }\n }\n\n if (messagesConfig.tsdocMessageReporting) {\n for (const messageId of Object.getOwnPropertyNames(messagesConfig.tsdocMessageReporting)) {\n const reportingRule: IReportingRule = MessageRouter._getNormalizedRule(\n messagesConfig.tsdocMessageReporting[messageId]\n );\n\n if (messageId === 'default') {\n this._tsdocDefaultRule = reportingRule;\n } else if (!/^tsdoc-/.test(messageId)) {\n throw new Error(\n `Error in API Extractor config: The messages.tsdocMessageReporting table contains` +\n ` an invalid entry \"${messageId}\". The name should begin with the \"tsdoc-\" prefix.`\n );\n } else if (!this._tsdocConfiguration.isKnownMessageId(messageId)) {\n throw new Error(\n `Error in API Extractor config: The messages.tsdocMessageReporting table contains` +\n ` an unrecognized identifier \"${messageId}\". Is it spelled correctly?`\n );\n } else {\n this._reportingRuleByMessageId.set(messageId, reportingRule);\n }\n }\n }\n }\n\n private static _getNormalizedRule(rule: IConfigMessageReportingRule): IReportingRule {\n return {\n logLevel: rule.logLevel || 'none',\n addToApiReportFile: rule.addToApiReportFile || false\n };\n }\n\n public get messages(): ReadonlyArray<ExtractorMessage> {\n return this._messages;\n }\n\n /**\n * Add a diagnostic message reported by the TypeScript compiler\n */\n public addCompilerDiagnostic(diagnostic: ts.Diagnostic): void {\n switch (diagnostic.category) {\n case ts.DiagnosticCategory.Suggestion:\n case ts.DiagnosticCategory.Message:\n return; // ignore noise\n }\n\n const messageText: string = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\\n');\n const options: IExtractorMessageOptions = {\n category: ExtractorMessageCategory.Compiler,\n messageId: `TS${diagnostic.code}`,\n text: messageText\n };\n\n if (diagnostic.file) {\n // NOTE: Since compiler errors pertain to issues specific to the .d.ts files,\n // we do not apply source mappings for them.\n const sourceFile: ts.SourceFile = diagnostic.file;\n const sourceLocation: ISourceLocation = this._sourceMapper.getSourceLocation({\n sourceFile,\n pos: diagnostic.start || 0,\n useDtsLocation: true\n });\n options.sourceFilePath = sourceLocation.sourceFilePath;\n options.sourceFileLine = sourceLocation.sourceFileLine;\n options.sourceFileColumn = sourceLocation.sourceFileColumn;\n }\n\n this._messages.push(new ExtractorMessage(options));\n }\n\n /**\n * Add a message from the API Extractor analysis\n */\n public addAnalyzerIssue(\n messageId: ExtractorMessageId,\n messageText: string,\n astDeclarationOrSymbol: AstDeclaration | AstSymbol,\n properties?: IExtractorMessageProperties\n ): void {\n let astDeclaration: AstDeclaration;\n if (astDeclarationOrSymbol instanceof AstDeclaration) {\n astDeclaration = astDeclarationOrSymbol;\n } else {\n astDeclaration = astDeclarationOrSymbol.astDeclarations[0];\n }\n\n const extractorMessage: ExtractorMessage = this.addAnalyzerIssueForPosition(\n messageId,\n messageText,\n astDeclaration.declaration.getSourceFile(),\n astDeclaration.declaration.getStart(),\n properties\n );\n\n this._associateMessageWithAstDeclaration(extractorMessage, astDeclaration);\n }\n\n /**\n * Add all messages produced from an invocation of the TSDoc parser, assuming they refer to\n * code in the specified source file.\n */\n public addTsdocMessages(\n parserContext: tsdoc.ParserContext,\n sourceFile: ts.SourceFile,\n astDeclaration?: AstDeclaration\n ): void {\n for (const message of parserContext.log.messages) {\n const options: IExtractorMessageOptions = {\n category: ExtractorMessageCategory.TSDoc,\n messageId: message.messageId,\n text: message.unformattedText\n };\n\n const sourceLocation: ISourceLocation = this._sourceMapper.getSourceLocation({\n sourceFile,\n pos: message.textRange.pos\n });\n options.sourceFilePath = sourceLocation.sourceFilePath;\n options.sourceFileLine = sourceLocation.sourceFileLine;\n options.sourceFileColumn = sourceLocation.sourceFileColumn;\n\n const extractorMessage: ExtractorMessage = new ExtractorMessage(options);\n\n if (astDeclaration) {\n this._associateMessageWithAstDeclaration(extractorMessage, astDeclaration);\n }\n\n this._messages.push(extractorMessage);\n }\n }\n\n /**\n * Recursively collects the primitive members (numbers, strings, arrays, etc) into an object that\n * is JSON serializable. This is used by the \"--diagnostics\" feature to dump the state of configuration objects.\n *\n * @returns a JSON serializable object (possibly including `null` values)\n * or `undefined` if the input cannot be represented as JSON\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public static buildJsonDumpObject(input: any, options?: IBuildJsonDumpObjectOptions): any | undefined {\n if (!options) {\n options = {};\n }\n\n const keyNamesToOmit: Set<string> = new Set(options.keyNamesToOmit);\n\n return MessageRouter._buildJsonDumpObject(input, keyNamesToOmit);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private static _buildJsonDumpObject(input: any, keyNamesToOmit: Set<string>): any | undefined {\n if (input === null || input === undefined) {\n return null; // JSON uses null instead of undefined\n }\n\n switch (typeof input) {\n case 'boolean':\n case 'number':\n case 'string':\n return input;\n case 'object':\n if (Array.isArray(input)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const outputArray: any[] = [];\n for (const element of input) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const serializedElement: any = MessageRouter._buildJsonDumpObject(element, keyNamesToOmit);\n if (serializedElement !== undefined) {\n outputArray.push(serializedElement);\n }\n }\n return outputArray;\n }\n\n const outputObject: object = {};\n for (const key of Object.getOwnPropertyNames(input)) {\n if (keyNamesToOmit.has(key)) {\n continue;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const value: any = input[key];\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const serializedValue: any = MessageRouter._buildJsonDumpObject(value, keyNamesToOmit);\n\n if (serializedValue !== undefined) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (outputObject as any)[key] = serializedValue;\n }\n }\n return outputObject;\n }\n\n return undefined;\n }\n\n /**\n * Record this message in _associatedMessagesForAstDeclaration\n */\n private _associateMessageWithAstDeclaration(\n extractorMessage: ExtractorMessage,\n astDeclaration: AstDeclaration\n ): void {\n let associatedMessages: ExtractorMessage[] | undefined =\n this._associatedMessagesForAstDeclaration.get(astDeclaration);\n\n if (!associatedMessages) {\n associatedMessages = [];\n this._associatedMessagesForAstDeclaration.set(astDeclaration, associatedMessages);\n }\n associatedMessages.push(extractorMessage);\n }\n\n /**\n * Add a message for a location in an arbitrary source file.\n */\n public addAnalyzerIssueForPosition(\n messageId: ExtractorMessageId,\n messageText: string,\n sourceFile: ts.SourceFile,\n pos: number,\n properties?: IExtractorMessageProperties\n ): ExtractorMessage {\n const options: IExtractorMessageOptions = {\n category: ExtractorMessageCategory.Extractor,\n messageId,\n text: messageText,\n properties\n };\n\n const sourceLocation: ISourceLocation = this._sourceMapper.getSourceLocation({\n sourceFile,\n pos\n });\n options.sourceFilePath = sourceLocation.sourceFilePath;\n options.sourceFileLine = sourceLocation.sourceFileLine;\n options.sourceFileColumn = sourceLocation.sourceFileColumn;\n\n const extractorMessage: ExtractorMessage = new ExtractorMessage(options);\n\n this._messages.push(extractorMessage);\n return extractorMessage;\n }\n\n /**\n * This is used when writing the API report file. It looks up any messages that were configured to get emitted\n * in the API report file and returns them. It also records that they were emitted, which suppresses them from\n * being shown on the console.\n */\n public fetchAssociatedMessagesForReviewFile(astDeclaration: AstDeclaration): ExtractorMessage[] {\n const messagesForApiReportFile: ExtractorMessage[] = [];\n\n const associatedMessages: ExtractorMessage[] =\n this._associatedMessagesForAstDeclaration.get(astDeclaration) || [];\n for (const associatedMessage of associatedMessages) {\n // Make sure we didn't already report this message for some reason\n if (!associatedMessage.handled) {\n // Is this message type configured to go in the API report file?\n const reportingRule: IReportingRule = this._getRuleForMessage(associatedMessage);\n if (reportingRule.addToApiReportFile) {\n // Include it in the result, and record that it went to the API report file\n messagesForApiReportFile.push(associatedMessage);\n associatedMessage.handled = true;\n }\n }\n }\n\n this._sortMessagesForOutput(messagesForApiReportFile);\n return messagesForApiReportFile;\n }\n\n /**\n * This returns all remaining messages that were flagged with `addToApiReportFile`, but which were not\n * retreieved using `fetchAssociatedMessagesForReviewFile()`.\n */\n public fetchUnassociatedMessagesForReviewFile(): ExtractorMessage[] {\n const messagesForApiReportFile: ExtractorMessage[] = [];\n\n for (const unassociatedMessage of this.messages) {\n // Make sure we didn't already report this message for some reason\n if (!unassociatedMessage.handled) {\n // Is this message type configured to go in the API report file?\n const reportingRule: IReportingRule = this._getRuleForMessage(unassociatedMessage);\n if (reportingRule.addToApiReportFile) {\n // Include it in the result, and record that it went to the API report file\n messagesForApiReportFile.push(unassociatedMessage);\n unassociatedMessage.handled = true;\n }\n }\n }\n\n this._sortMessagesForOutput(messagesForApiReportFile);\n return messagesForApiReportFile;\n }\n\n /**\n * This returns the list of remaining messages that were not already processed by\n * `fetchAssociatedMessagesForReviewFile()` or `fetchUnassociatedMessagesForReviewFile()`.\n * These messages will be shown on the console.\n */\n public handleRemainingNonConsoleMessages(): void {\n const messagesForLogger: ExtractorMessage[] = [];\n\n for (const message of this.messages) {\n // Make sure we didn't already report this message\n if (!message.handled) {\n messagesForLogger.push(message);\n }\n }\n\n this._sortMessagesForOutput(messagesForLogger);\n\n for (const message of messagesForLogger) {\n this._handleMessage(message);\n }\n }\n\n public logError(\n messageId: ConsoleMessageId,\n message: string,\n properties?: IExtractorMessageProperties\n ): void {\n this._handleMessage(\n new ExtractorMessage({\n category: ExtractorMessageCategory.Console,\n messageId,\n text: message,\n properties,\n logLevel: ExtractorLogLevel.Error\n })\n );\n }\n\n public logWarning(\n messageId: ConsoleMessageId,\n message: string,\n properties?: IExtractorMessageProperties\n ): void {\n this._handleMessage(\n new ExtractorMessage({\n category: ExtractorMessageCategory.Console,\n messageId,\n text: message,\n properties,\n logLevel: ExtractorLogLevel.Warning\n })\n );\n }\n\n public logInfo(\n messageId: ConsoleMessageId,\n message: string,\n properties?: IExtractorMessageProperties\n ): void {\n this._handleMessage(\n new ExtractorMessage({\n category: ExtractorMessageCategory.Console,\n messageId,\n text: message,\n properties,\n logLevel: ExtractorLogLevel.Info\n })\n );\n }\n\n public logVerbose(\n messageId: ConsoleMessageId,\n message: string,\n properties?: IExtractorMessageProperties\n ): void {\n this._handleMessage(\n new ExtractorMessage({\n category: ExtractorMessageCategory.Console,\n messageId,\n text: message,\n properties,\n logLevel: ExtractorLogLevel.Verbose\n })\n );\n }\n\n public logDiagnosticHeader(title: string): void {\n this.logDiagnostic(MessageRouter.DIAGNOSTICS_LINE);\n this.logDiagnostic(`DIAGNOSTIC: ` + title);\n this.logDiagnostic(MessageRouter.DIAGNOSTICS_LINE);\n }\n\n public logDiagnosticFooter(): void {\n this.logDiagnostic(MessageRouter.DIAGNOSTICS_LINE + '\\n');\n }\n\n public logDiagnostic(message: string): void {\n if (this.showDiagnostics) {\n this.logVerbose(ConsoleMessageId.Diagnostics, message);\n }\n }\n\n /**\n * Give the calling application a chance to handle the `ExtractorMessage`, and if not, display it on the console.\n */\n private _handleMessage(message: ExtractorMessage): void {\n // Don't tally messages that were already \"handled\" by writing them into the API report\n if (message.handled) {\n return;\n }\n\n // Assign the ExtractorMessage.logLevel; the message callback may adjust it below\n if (message.category === ExtractorMessageCategory.Console) {\n // Console messages have their category log level assigned via logInfo(), logVerbose(), etc.\n } else {\n const reportingRule: IReportingRule = this._getRuleForMessage(message);\n message.logLevel = reportingRule.logLevel;\n }\n\n // If there is a callback, allow it to modify and/or handle the message\n if (this._messageCallback) {\n this._messageCallback(message);\n }\n\n // Update the statistics\n switch (message.logLevel) {\n case ExtractorLogLevel.Error:\n ++this.errorCount;\n break;\n case ExtractorLogLevel.Warning:\n ++this.warningCount;\n break;\n }\n\n if (message.handled) {\n return;\n }\n\n // The messageCallback did not handle the message, so perform default handling\n message.handled = true;\n\n if (message.logLevel === ExtractorLogLevel.None) {\n return;\n }\n\n let messageText: string;\n if (message.category === ExtractorMessageCategory.Console) {\n messageText = message.text;\n } else {\n messageText = message.formatMessageWithLocation(this._workingPackageFolder);\n }\n\n switch (message.logLevel) {\n case ExtractorLogLevel.Error:\n console.error(Colorize.red('Error: ' + messageText));\n break;\n case ExtractorLogLevel.Warning:\n console.warn(Colorize.yellow('Warning: ' + messageText));\n break;\n case ExtractorLogLevel.Info:\n console.log(messageText);\n break;\n case ExtractorLogLevel.Verbose:\n if (this.showVerboseMessages) {\n console.log(Colorize.cyan(messageText));\n }\n break;\n default:\n throw new Error(`Invalid logLevel value: ${JSON.stringify(message.logLevel)}`);\n }\n }\n\n /**\n * For a given message, determine the IReportingRule based on the rule tables.\n */\n private _getRuleForMessage(message: ExtractorMessage): IReportingRule {\n const reportingRule: IReportingRule | undefined = this._reportingRuleByMessageId.get(message.messageId);\n if (reportingRule) {\n return reportingRule;\n }\n switch (message.category) {\n case ExtractorMessageCategory.Compiler:\n return this._compilerDefaultRule;\n case ExtractorMessageCategory.Extractor:\n return this._extractorDefaultRule;\n case ExtractorMessageCategory.TSDoc:\n return this._tsdocDefaultRule;\n case ExtractorMessageCategory.Console:\n throw new InternalError('ExtractorMessageCategory.Console is not supported with IReportingRule');\n }\n }\n\n /**\n * Sorts an array of messages according to a reasonable ordering\n */\n private _sortMessagesForOutput(messages: ExtractorMessage[]): void {\n messages.sort((a, b) => {\n let diff: number;\n // First sort by file name\n diff = Sort.compareByValue(a.sourceFilePath, b.sourceFilePath);\n if (diff !== 0) {\n return diff;\n }\n // Then sort by line number\n diff = Sort.compareByValue(a.sourceFileLine, b.sourceFileLine);\n if (diff !== 0) {\n return diff;\n }\n // Then sort by messageId\n return Sort.compareByValue(a.messageId, b.messageId);\n });\n }\n}\n"]}
1
+ {"version":3,"file":"MessageRouter.js","sourceRoot":"","sources":["../../src/collector/MessageRouter.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,+CAAiC;AAGjC,oEAAmE;AACnE,kDAA+C;AAE/C,+DAA4D;AAE5D,8DAKiC;AACjC,kEAA4F;AAG5F,gEAA6D;AAC7D,8DAA2D;AAwB3D,MAAa,aAAa;IA0CxB,YAAmB,OAA8B;QAzBjD,yEAAyE;QACjE,8BAAyB,GAAgC,IAAI,GAAG,EAA0B,CAAC;QAC3F,yBAAoB,GAAmB;YAC7C,QAAQ,EAAE,qCAAiB,CAAC,IAAI;YAChC,kBAAkB,EAAE,KAAK;SAC1B,CAAC;QACM,0BAAqB,GAAmB;YAC9C,QAAQ,EAAE,qCAAiB,CAAC,IAAI;YAChC,kBAAkB,EAAE,KAAK;SAC1B,CAAC;QACM,sBAAiB,GAAmB,EAAE,QAAQ,EAAE,qCAAiB,CAAC,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,CAAC;QAErG,eAAU,GAAW,CAAC,CAAC;QACvB,iBAAY,GAAW,CAAC,CAAC;QAa9B,IAAI,CAAC,qBAAqB,GAAG,OAAO,CAAC,oBAAoB,CAAC;QAC1D,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC;QAEhD,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,oCAAoC,GAAG,IAAI,GAAG,EAAsC,CAAC;QAC1F,IAAI,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AAwB,CAAC,KAAK;gBACjC,OAAO,IAAI,CAAC,iBAAiB,CAAC;YAChC,KAAK,2CAAwB,CAAC,OAAO;gBACnC,MAAM,IAAI,iCAAa,CAAC,uEAAuE,CAAC,CAAC;QACrG,CAAC;IACH,CAAC;IAED;;OAEG;IACK,sBAAsB,CAAC,QAA4B;QACzD,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YACrB,IAAI,IAAY,CAAC;YACjB,0BAA0B;YAC1B,IAAI,GAAG,wBAAI,CAAC,cAAc,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,cAAc,CAAC,CAAC;YAC/D,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;gBACf,OAAO,IAAI,CAAC;YACd,CAAC;YACD,2BAA2B;YAC3B,IAAI,GAAG,wBAAI,CAAC,cAAc,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,cAAc,CAAC,CAAC;YAC/D,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;gBACf,OAAO,IAAI,CAAC;YACd,CAAC;YACD,yBAAyB;YACzB,OAAO,wBAAI,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;IACL,CAAC;;AApmBH,sCAqmBC;AApmBwB,8BAAgB,GACrC,8DAA8D,AADzB,CAC0B","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 type * as tsdoc from '@microsoft/tsdoc';\nimport { Sort, InternalError } from '@rushstack/node-core-library';\nimport { Colorize } from '@rushstack/terminal';\n\nimport { AstDeclaration } from '../analyzer/AstDeclaration';\nimport type { AstSymbol } from '../analyzer/AstSymbol';\nimport {\n ExtractorMessage,\n ExtractorMessageCategory,\n type IExtractorMessageOptions,\n type IExtractorMessageProperties\n} from '../api/ExtractorMessage';\nimport { type ExtractorMessageId, allExtractorMessageIds } from '../api/ExtractorMessageId';\nimport type { IExtractorMessagesConfig, IConfigMessageReportingRule } from '../api/IConfigFile';\nimport type { ISourceLocation, SourceMapper } from './SourceMapper';\nimport { ExtractorLogLevel } from '../api/ExtractorLogLevel';\nimport { ConsoleMessageId } from '../api/ConsoleMessageId';\n\ninterface IReportingRule {\n logLevel: ExtractorLogLevel;\n addToApiReportFile: boolean;\n}\n\nexport interface IMessageRouterOptions {\n workingPackageFolder: string | undefined;\n messageCallback: ((message: ExtractorMessage) => void) | undefined;\n messagesConfig: IExtractorMessagesConfig;\n showVerboseMessages: boolean;\n showDiagnostics: boolean;\n tsdocConfiguration: tsdoc.TSDocConfiguration;\n sourceMapper: SourceMapper;\n}\n\nexport interface IBuildJsonDumpObjectOptions {\n /**\n * {@link MessageRouter.buildJsonDumpObject} will omit any objects keys with these names.\n */\n keyNamesToOmit?: string[];\n}\n\nexport class MessageRouter {\n public static readonly DIAGNOSTICS_LINE: string =\n '============================================================';\n\n private readonly _workingPackageFolder: string | undefined;\n private readonly _messageCallback: ((message: ExtractorMessage) => void) | undefined;\n\n // All messages\n private readonly _messages: ExtractorMessage[];\n\n // For each AstDeclaration, the messages associated with it. This is used when addToApiReportFile=true\n private readonly _associatedMessagesForAstDeclaration: Map<AstDeclaration, ExtractorMessage[]>;\n\n private readonly _sourceMapper: SourceMapper;\n\n private readonly _tsdocConfiguration: tsdoc.TSDocConfiguration;\n\n // Normalized representation of the routing rules from api-extractor.json\n private _reportingRuleByMessageId: Map<string, IReportingRule> = new Map<string, IReportingRule>();\n private _compilerDefaultRule: IReportingRule = {\n logLevel: ExtractorLogLevel.None,\n addToApiReportFile: false\n };\n private _extractorDefaultRule: IReportingRule = {\n logLevel: ExtractorLogLevel.None,\n addToApiReportFile: false\n };\n private _tsdocDefaultRule: IReportingRule = { logLevel: ExtractorLogLevel.None, addToApiReportFile: false };\n\n public errorCount: number = 0;\n public warningCount: number = 0;\n\n /**\n * See {@link IExtractorInvokeOptions.showVerboseMessages}\n */\n public readonly showVerboseMessages: boolean;\n\n /**\n * See {@link IExtractorInvokeOptions.showDiagnostics}\n */\n public readonly showDiagnostics: boolean;\n\n public constructor(options: IMessageRouterOptions) {\n this._workingPackageFolder = options.workingPackageFolder;\n this._messageCallback = options.messageCallback;\n\n this._messages = [];\n this._associatedMessagesForAstDeclaration = new Map<AstDeclaration, ExtractorMessage[]>();\n this._sourceMapper = options.sourceMapper;\n this._tsdocConfiguration = options.tsdocConfiguration;\n\n // showDiagnostics implies showVerboseMessages\n this.showVerboseMessages = options.showVerboseMessages || options.showDiagnostics;\n this.showDiagnostics = options.showDiagnostics;\n\n this._applyMessagesConfig(options.messagesConfig);\n }\n\n /**\n * Read the api-extractor.json configuration and build up the tables of routing rules.\n */\n private _applyMessagesConfig(messagesConfig: IExtractorMessagesConfig): void {\n if (messagesConfig.compilerMessageReporting) {\n for (const messageId of Object.getOwnPropertyNames(messagesConfig.compilerMessageReporting)) {\n const reportingRule: IReportingRule = MessageRouter._getNormalizedRule(\n messagesConfig.compilerMessageReporting[messageId]\n );\n\n if (messageId === 'default') {\n this._compilerDefaultRule = reportingRule;\n } else if (!/^TS[0-9]+$/.test(messageId)) {\n throw new Error(\n `Error in API Extractor config: The messages.compilerMessageReporting table contains` +\n ` an invalid entry \"${messageId}\". The identifier format is \"TS\" followed by an integer.`\n );\n } else {\n this._reportingRuleByMessageId.set(messageId, reportingRule);\n }\n }\n }\n\n if (messagesConfig.extractorMessageReporting) {\n for (const messageId of Object.getOwnPropertyNames(messagesConfig.extractorMessageReporting)) {\n const reportingRule: IReportingRule = MessageRouter._getNormalizedRule(\n messagesConfig.extractorMessageReporting[messageId]\n );\n\n if (messageId === 'default') {\n this._extractorDefaultRule = reportingRule;\n } else if (!/^ae-/.test(messageId)) {\n throw new Error(\n `Error in API Extractor config: The messages.extractorMessageReporting table contains` +\n ` an invalid entry \"${messageId}\". The name should begin with the \"ae-\" prefix.`\n );\n } else if (!allExtractorMessageIds.has(messageId)) {\n throw new Error(\n `Error in API Extractor config: The messages.extractorMessageReporting table contains` +\n ` an unrecognized identifier \"${messageId}\". Is it spelled correctly?`\n );\n } else {\n this._reportingRuleByMessageId.set(messageId, reportingRule);\n }\n }\n }\n\n if (messagesConfig.tsdocMessageReporting) {\n for (const messageId of Object.getOwnPropertyNames(messagesConfig.tsdocMessageReporting)) {\n const reportingRule: IReportingRule = MessageRouter._getNormalizedRule(\n messagesConfig.tsdocMessageReporting[messageId]\n );\n\n if (messageId === 'default') {\n this._tsdocDefaultRule = reportingRule;\n } else if (!/^tsdoc-/.test(messageId)) {\n throw new Error(\n `Error in API Extractor config: The messages.tsdocMessageReporting table contains` +\n ` an invalid entry \"${messageId}\". The name should begin with the \"tsdoc-\" prefix.`\n );\n } else if (!this._tsdocConfiguration.isKnownMessageId(messageId)) {\n throw new Error(\n `Error in API Extractor config: The messages.tsdocMessageReporting table contains` +\n ` an unrecognized identifier \"${messageId}\". Is it spelled correctly?`\n );\n } else {\n this._reportingRuleByMessageId.set(messageId, reportingRule);\n }\n }\n }\n }\n\n private static _getNormalizedRule(rule: IConfigMessageReportingRule): IReportingRule {\n return {\n logLevel: rule.logLevel || 'none',\n addToApiReportFile: rule.addToApiReportFile || false\n };\n }\n\n public get messages(): ReadonlyArray<ExtractorMessage> {\n return this._messages;\n }\n\n /**\n * Add a diagnostic message reported by the TypeScript compiler\n */\n public addCompilerDiagnostic(diagnostic: ts.Diagnostic): void {\n switch (diagnostic.category) {\n case ts.DiagnosticCategory.Suggestion:\n case ts.DiagnosticCategory.Message:\n return; // ignore noise\n }\n\n const messageText: string = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\\n');\n const options: IExtractorMessageOptions = {\n category: ExtractorMessageCategory.Compiler,\n messageId: `TS${diagnostic.code}`,\n text: messageText\n };\n\n if (diagnostic.file) {\n // NOTE: Since compiler errors pertain to issues specific to the .d.ts files,\n // we do not apply source mappings for them.\n const sourceFile: ts.SourceFile = diagnostic.file;\n const sourceLocation: ISourceLocation = this._sourceMapper.getSourceLocation({\n sourceFile,\n pos: diagnostic.start || 0,\n useDtsLocation: true\n });\n options.sourceFilePath = sourceLocation.sourceFilePath;\n options.sourceFileLine = sourceLocation.sourceFileLine;\n options.sourceFileColumn = sourceLocation.sourceFileColumn;\n }\n\n this._messages.push(new ExtractorMessage(options));\n }\n\n /**\n * Add a message from the API Extractor analysis\n */\n public addAnalyzerIssue(\n messageId: ExtractorMessageId,\n messageText: string,\n astDeclarationOrSymbol: AstDeclaration | AstSymbol,\n properties?: IExtractorMessageProperties\n ): void {\n let astDeclaration: AstDeclaration;\n if (astDeclarationOrSymbol instanceof AstDeclaration) {\n astDeclaration = astDeclarationOrSymbol;\n } else {\n astDeclaration = astDeclarationOrSymbol.astDeclarations[0];\n }\n\n const extractorMessage: ExtractorMessage = this.addAnalyzerIssueForPosition(\n messageId,\n messageText,\n astDeclaration.declaration.getSourceFile(),\n astDeclaration.declaration.getStart(),\n properties\n );\n\n this._associateMessageWithAstDeclaration(extractorMessage, astDeclaration);\n }\n\n /**\n * Add all messages produced from an invocation of the TSDoc parser, assuming they refer to\n * code in the specified source file.\n */\n public addTsdocMessages(\n parserContext: tsdoc.ParserContext,\n sourceFile: ts.SourceFile,\n astDeclaration?: AstDeclaration\n ): void {\n for (const message of parserContext.log.messages) {\n const options: IExtractorMessageOptions = {\n category: ExtractorMessageCategory.TSDoc,\n messageId: message.messageId,\n text: message.unformattedText\n };\n\n const sourceLocation: ISourceLocation = this._sourceMapper.getSourceLocation({\n sourceFile,\n pos: message.textRange.pos\n });\n options.sourceFilePath = sourceLocation.sourceFilePath;\n options.sourceFileLine = sourceLocation.sourceFileLine;\n options.sourceFileColumn = sourceLocation.sourceFileColumn;\n\n const extractorMessage: ExtractorMessage = new ExtractorMessage(options);\n\n if (astDeclaration) {\n this._associateMessageWithAstDeclaration(extractorMessage, astDeclaration);\n }\n\n this._messages.push(extractorMessage);\n }\n }\n\n /**\n * Recursively collects the primitive members (numbers, strings, arrays, etc) into an object that\n * is JSON serializable. This is used by the \"--diagnostics\" feature to dump the state of configuration objects.\n *\n * @returns a JSON serializable object (possibly including `null` values)\n * or `undefined` if the input cannot be represented as JSON\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public static buildJsonDumpObject(input: any, options?: IBuildJsonDumpObjectOptions): any | undefined {\n if (!options) {\n options = {};\n }\n\n const keyNamesToOmit: Set<string> = new Set(options.keyNamesToOmit);\n\n return MessageRouter._buildJsonDumpObject(input, keyNamesToOmit);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private static _buildJsonDumpObject(input: any, keyNamesToOmit: Set<string>): any | undefined {\n if (input === null || input === undefined) {\n return null; // JSON uses null instead of undefined\n }\n\n switch (typeof input) {\n case 'boolean':\n case 'number':\n case 'string':\n return input;\n case 'object':\n if (Array.isArray(input)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const outputArray: any[] = [];\n for (const element of input) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const serializedElement: any = MessageRouter._buildJsonDumpObject(element, keyNamesToOmit);\n if (serializedElement !== undefined) {\n outputArray.push(serializedElement);\n }\n }\n return outputArray;\n }\n\n const outputObject: object = {};\n for (const key of Object.getOwnPropertyNames(input)) {\n if (keyNamesToOmit.has(key)) {\n continue;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const value: any = input[key];\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const serializedValue: any = MessageRouter._buildJsonDumpObject(value, keyNamesToOmit);\n\n if (serializedValue !== undefined) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (outputObject as any)[key] = serializedValue;\n }\n }\n return outputObject;\n }\n\n return undefined;\n }\n\n /**\n * Record this message in _associatedMessagesForAstDeclaration\n */\n private _associateMessageWithAstDeclaration(\n extractorMessage: ExtractorMessage,\n astDeclaration: AstDeclaration\n ): void {\n let associatedMessages: ExtractorMessage[] | undefined =\n this._associatedMessagesForAstDeclaration.get(astDeclaration);\n\n if (!associatedMessages) {\n associatedMessages = [];\n this._associatedMessagesForAstDeclaration.set(astDeclaration, associatedMessages);\n }\n associatedMessages.push(extractorMessage);\n }\n\n /**\n * Add a message for a location in an arbitrary source file.\n */\n public addAnalyzerIssueForPosition(\n messageId: ExtractorMessageId,\n messageText: string,\n sourceFile: ts.SourceFile,\n pos: number,\n properties?: IExtractorMessageProperties\n ): ExtractorMessage {\n const options: IExtractorMessageOptions = {\n category: ExtractorMessageCategory.Extractor,\n messageId,\n text: messageText,\n properties\n };\n\n const sourceLocation: ISourceLocation = this._sourceMapper.getSourceLocation({\n sourceFile,\n pos\n });\n options.sourceFilePath = sourceLocation.sourceFilePath;\n options.sourceFileLine = sourceLocation.sourceFileLine;\n options.sourceFileColumn = sourceLocation.sourceFileColumn;\n\n const extractorMessage: ExtractorMessage = new ExtractorMessage(options);\n\n this._messages.push(extractorMessage);\n return extractorMessage;\n }\n\n /**\n * This is used when writing the API report file. It looks up any messages that were configured to get emitted\n * in the API report file and returns them. It also records that they were emitted, which suppresses them from\n * being shown on the console.\n */\n public fetchAssociatedMessagesForReviewFile(astDeclaration: AstDeclaration): ExtractorMessage[] {\n const messagesForApiReportFile: ExtractorMessage[] = [];\n\n const associatedMessages: ExtractorMessage[] =\n this._associatedMessagesForAstDeclaration.get(astDeclaration) || [];\n for (const associatedMessage of associatedMessages) {\n // Make sure we didn't already report this message for some reason\n if (!associatedMessage.handled) {\n // Is this message type configured to go in the API report file?\n const reportingRule: IReportingRule = this._getRuleForMessage(associatedMessage);\n if (reportingRule.addToApiReportFile) {\n // Include it in the result, and record that it went to the API report file\n messagesForApiReportFile.push(associatedMessage);\n associatedMessage.handled = true;\n }\n }\n }\n\n this._sortMessagesForOutput(messagesForApiReportFile);\n return messagesForApiReportFile;\n }\n\n /**\n * This returns all remaining messages that were flagged with `addToApiReportFile`, but which were not\n * retreieved using `fetchAssociatedMessagesForReviewFile()`.\n */\n public fetchUnassociatedMessagesForReviewFile(): ExtractorMessage[] {\n const messagesForApiReportFile: ExtractorMessage[] = [];\n\n for (const unassociatedMessage of this.messages) {\n // Make sure we didn't already report this message for some reason\n if (!unassociatedMessage.handled) {\n // Is this message type configured to go in the API report file?\n const reportingRule: IReportingRule = this._getRuleForMessage(unassociatedMessage);\n if (reportingRule.addToApiReportFile) {\n // Include it in the result, and record that it went to the API report file\n messagesForApiReportFile.push(unassociatedMessage);\n unassociatedMessage.handled = true;\n }\n }\n }\n\n this._sortMessagesForOutput(messagesForApiReportFile);\n return messagesForApiReportFile;\n }\n\n /**\n * This returns the list of remaining messages that were not already processed by\n * `fetchAssociatedMessagesForReviewFile()` or `fetchUnassociatedMessagesForReviewFile()`.\n * These messages will be shown on the console.\n */\n public handleRemainingNonConsoleMessages(): void {\n const messagesForLogger: ExtractorMessage[] = [];\n\n for (const message of this.messages) {\n // Make sure we didn't already report this message\n if (!message.handled) {\n messagesForLogger.push(message);\n }\n }\n\n this._sortMessagesForOutput(messagesForLogger);\n\n for (const message of messagesForLogger) {\n this._handleMessage(message);\n }\n }\n\n public logError(\n messageId: ConsoleMessageId,\n message: string,\n properties?: IExtractorMessageProperties\n ): void {\n this._handleMessage(\n new ExtractorMessage({\n category: ExtractorMessageCategory.Console,\n messageId,\n text: message,\n properties,\n logLevel: ExtractorLogLevel.Error\n })\n );\n }\n\n public logWarning(\n messageId: ConsoleMessageId,\n message: string,\n properties?: IExtractorMessageProperties\n ): void {\n this._handleMessage(\n new ExtractorMessage({\n category: ExtractorMessageCategory.Console,\n messageId,\n text: message,\n properties,\n logLevel: ExtractorLogLevel.Warning\n })\n );\n }\n\n public logInfo(\n messageId: ConsoleMessageId,\n message: string,\n properties?: IExtractorMessageProperties\n ): void {\n this._handleMessage(\n new ExtractorMessage({\n category: ExtractorMessageCategory.Console,\n messageId,\n text: message,\n properties,\n logLevel: ExtractorLogLevel.Info\n })\n );\n }\n\n public logVerbose(\n messageId: ConsoleMessageId,\n message: string,\n properties?: IExtractorMessageProperties\n ): void {\n this._handleMessage(\n new ExtractorMessage({\n category: ExtractorMessageCategory.Console,\n messageId,\n text: message,\n properties,\n logLevel: ExtractorLogLevel.Verbose\n })\n );\n }\n\n public logDiagnosticHeader(title: string): void {\n this.logDiagnostic(MessageRouter.DIAGNOSTICS_LINE);\n this.logDiagnostic(`DIAGNOSTIC: ` + title);\n this.logDiagnostic(MessageRouter.DIAGNOSTICS_LINE);\n }\n\n public logDiagnosticFooter(): void {\n this.logDiagnostic(MessageRouter.DIAGNOSTICS_LINE + '\\n');\n }\n\n public logDiagnostic(message: string): void {\n if (this.showDiagnostics) {\n this.logVerbose(ConsoleMessageId.Diagnostics, message);\n }\n }\n\n /**\n * Give the calling application a chance to handle the `ExtractorMessage`, and if not, display it on the console.\n */\n private _handleMessage(message: ExtractorMessage): void {\n // Don't tally messages that were already \"handled\" by writing them into the API report\n if (message.handled) {\n return;\n }\n\n // Assign the ExtractorMessage.logLevel; the message callback may adjust it below\n if (message.category === ExtractorMessageCategory.Console) {\n // Console messages have their category log level assigned via logInfo(), logVerbose(), etc.\n } else {\n const reportingRule: IReportingRule = this._getRuleForMessage(message);\n message.logLevel = reportingRule.logLevel;\n }\n\n // If there is a callback, allow it to modify and/or handle the message\n if (this._messageCallback) {\n this._messageCallback(message);\n }\n\n // Update the statistics\n switch (message.logLevel) {\n case ExtractorLogLevel.Error:\n ++this.errorCount;\n break;\n case ExtractorLogLevel.Warning:\n ++this.warningCount;\n break;\n }\n\n if (message.handled) {\n return;\n }\n\n // The messageCallback did not handle the message, so perform default handling\n message.handled = true;\n\n if (message.logLevel === ExtractorLogLevel.None) {\n return;\n }\n\n let messageText: string;\n if (message.category === ExtractorMessageCategory.Console) {\n messageText = message.text;\n } else {\n messageText = message.formatMessageWithLocation(this._workingPackageFolder);\n }\n\n switch (message.logLevel) {\n case ExtractorLogLevel.Error:\n console.error(Colorize.red('Error: ' + messageText));\n break;\n case ExtractorLogLevel.Warning:\n console.warn(Colorize.yellow('Warning: ' + messageText));\n break;\n case ExtractorLogLevel.Info:\n console.log(messageText);\n break;\n case ExtractorLogLevel.Verbose:\n if (this.showVerboseMessages) {\n console.log(Colorize.cyan(messageText));\n }\n break;\n default:\n throw new Error(`Invalid logLevel value: ${JSON.stringify(message.logLevel)}`);\n }\n }\n\n /**\n * For a given message, determine the IReportingRule based on the rule tables.\n */\n private _getRuleForMessage(message: ExtractorMessage): IReportingRule {\n const reportingRule: IReportingRule | undefined = this._reportingRuleByMessageId.get(message.messageId);\n if (reportingRule) {\n return reportingRule;\n }\n switch (message.category) {\n case ExtractorMessageCategory.Compiler:\n return this._compilerDefaultRule;\n case ExtractorMessageCategory.Extractor:\n return this._extractorDefaultRule;\n case ExtractorMessageCategory.TSDoc:\n return this._tsdocDefaultRule;\n case ExtractorMessageCategory.Console:\n throw new InternalError('ExtractorMessageCategory.Console is not supported with IReportingRule');\n }\n }\n\n /**\n * Sorts an array of messages according to a reasonable ordering\n */\n private _sortMessagesForOutput(messages: ExtractorMessage[]): void {\n messages.sort((a, b) => {\n let diff: number;\n // First sort by file name\n diff = Sort.compareByValue(a.sourceFilePath, b.sourceFilePath);\n if (diff !== 0) {\n return diff;\n }\n // Then sort by line number\n diff = Sort.compareByValue(a.sourceFileLine, b.sourceFileLine);\n if (diff !== 0) {\n return diff;\n }\n // Then sort by messageId\n return Sort.compareByValue(a.messageId, b.messageId);\n });\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SourceMapper.d.ts","sourceRoot":"","sources":["../../src/collector/SourceMapper.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAoBjC,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,UAAU,EAAE,EAAE,C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this.__importStar) || (function () {
36
36
  })();
37
37
  Object.defineProperty(exports, "__esModule", { value: true });
38
38
  exports.SourceMapper = void 0;
39
- const path = __importStar(require("path"));
39
+ const path = __importStar(require("node:path"));
40
40
  const source_map_1 = require("source-map");
41
41
  const node_core_library_1 = require("@rushstack/node-core-library");
42
42
  class SourceMapper {
@@ -1 +1 @@
1
- {"version":3,"file":"SourceMapper.js","sourceRoot":"","sources":["../../src/collector/SourceMapper.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAC7B,2CAAmG;AACnG,oEAAgG;AA4DhG,MAAa,YAAY;IAAzB;QACE,0FAA0F;QAClF,yBAAoB,GAAmC,IAAI,GAAG,EAA6B,CAAC;QAEpG,4DAA4D;QACpD,4BAAuB,GAAmC,IAAI,GAAG,EAA6B,CAAC;IAkMzG,CAAC;IAhMC;;;OAGG;IACI,iBAAiB,CAAC,OAAkC;QACzD,MAAM,gBAAgB,GAAwB,OAAO,CAAC,UAAU,CAAC,6BAA6B,CAC5F,OAAO,CAAC,GAAG,CACZ,CAAC;QACF,MAAM,cAAc,GAAoB;YACtC,cAAc,EAAE,OAAO,CAAC,UAAU,CAAC,QAAQ;YAC3C,cAAc,EAAE,gBAAgB,CAAC,IAAI,GAAG,CAAC;YACzC,gBAAgB,EAAE,gBAAgB,CAAC,SAAS,GAAG,CAAC;SACjD,CAAC;QAEF,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;YAC3B,OAAO,cAAc,CAAC;QACxB,CAAC;QAED,MAAM,oBAAoB,GAAgC,IAAI,CAAC,wBAAwB,CAAC,cAAc,CAAC,CAAC;QACxG,OAAO,oBAAoB,IAAI,cAAc,CAAC;IAChD,CAAC;IAEO,wBAAwB,CAAC,cAA+B;QAC9D,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,EAAE,GAAG,cAAc,CAAC;QAE5E,IAAI,CAAC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CAAC;CACF;AAvMD,oCAuMC","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 path from 'path';\nimport { SourceMapConsumer, type RawSourceMap, type MappingItem, type Position } from 'source-map';\nimport { FileSystem, InternalError, JsonFile, NewlineKind } from '@rushstack/node-core-library';\nimport type ts from 'typescript';\n\ninterface ISourceMap {\n sourceMapConsumer: SourceMapConsumer;\n\n // SourceMapConsumer.originalPositionFor() is useless because the mapping contains numerous gaps,\n // and the API provides no way to find the nearest match. So instead we extract all the mapping items\n // and search them using SourceMapper._findNearestMappingItem().\n mappingItems: MappingItem[];\n}\n\ninterface IOriginalFileInfo {\n // Whether the .ts file exists\n fileExists: boolean;\n\n // This is used to check whether the guessed position is out of bounds.\n // Since column/line numbers are 1-based, the 0th item in this array is unused.\n maxColumnForLine: number[];\n}\n\nexport interface ISourceLocation {\n /**\n * The absolute path to the source file.\n */\n sourceFilePath: string;\n\n /**\n * The line number in the source file. The first line number is 1.\n */\n sourceFileLine: number;\n\n /**\n * The column number in the source file. The first column number is 1.\n */\n sourceFileColumn: number;\n}\n\nexport interface IGetSourceLocationOptions {\n /**\n * The source file to get the source location from.\n */\n sourceFile: ts.SourceFile;\n\n /**\n * The position within the source file to get the source location from.\n */\n pos: number;\n\n /**\n * If `false` or not provided, then we attempt to follow source maps in order to resolve the\n * location to the original `.ts` file. If resolution isn't possible for some reason, we fall\n * back to the `.d.ts` location.\n *\n * If `true`, then we don't bother following source maps, and the location refers to the `.d.ts`\n * location.\n */\n useDtsLocation?: boolean;\n}\n\nexport class SourceMapper {\n // Map from .d.ts file path --> ISourceMap if a source map was found, or null if not found\n private _sourceMapByFilePath: Map<string, ISourceMap | null> = new Map<string, ISourceMap | null>();\n\n // Cache the FileSystem.exists() result for mapped .ts files\n private _originalFileInfoByPath: Map<string, IOriginalFileInfo> = new Map<string, IOriginalFileInfo>();\n\n /**\n * Given a `.d.ts` source file and a specific position within the file, return the corresponding\n * `ISourceLocation`.\n */\n public getSourceLocation(options: IGetSourceLocationOptions): ISourceLocation {\n const lineAndCharacter: ts.LineAndCharacter = options.sourceFile.getLineAndCharacterOfPosition(\n options.pos\n );\n const sourceLocation: ISourceLocation = {\n sourceFilePath: options.sourceFile.fileName,\n sourceFileLine: lineAndCharacter.line + 1,\n sourceFileColumn: lineAndCharacter.character + 1\n };\n\n if (options.useDtsLocation) {\n return sourceLocation;\n }\n\n const mappedSourceLocation: ISourceLocation | undefined = this._getMappedSourceLocation(sourceLocation);\n return mappedSourceLocation || sourceLocation;\n }\n\n private _getMappedSourceLocation(sourceLocation: ISourceLocation): ISourceLocation | undefined {\n const { sourceFilePath, sourceFileLine, sourceFileColumn } = sourceLocation;\n\n if (!FileSystem.exists(sourceFilePath)) {\n // Sanity check\n throw new InternalError('The referenced path was not found: ' + sourceFilePath);\n }\n\n const sourceMap: ISourceMap | null = this._getSourceMap(sourceFilePath);\n if (!sourceMap) return;\n\n const nearestMappingItem: MappingItem | undefined = SourceMapper._findNearestMappingItem(\n sourceMap.mappingItems,\n {\n line: sourceFileLine,\n column: sourceFileColumn\n }\n );\n\n if (!nearestMappingItem) return;\n\n const mappedFilePath: string = path.resolve(path.dirname(sourceFilePath), nearestMappingItem.source);\n\n // Does the mapped filename exist? Use a cache to remember the answer.\n let originalFileInfo: IOriginalFileInfo | undefined = this._originalFileInfoByPath.get(mappedFilePath);\n if (originalFileInfo === undefined) {\n originalFileInfo = {\n fileExists: FileSystem.exists(mappedFilePath),\n maxColumnForLine: []\n };\n\n if (originalFileInfo.fileExists) {\n // Read the file and measure the length of each line\n originalFileInfo.maxColumnForLine = FileSystem.readFile(mappedFilePath, {\n convertLineEndings: NewlineKind.Lf\n })\n .split('\\n')\n .map((x) => x.length + 1); // +1 since columns are 1-based\n originalFileInfo.maxColumnForLine.unshift(0); // Extra item since lines are 1-based\n }\n\n this._originalFileInfoByPath.set(mappedFilePath, originalFileInfo);\n }\n\n // Don't translate coordinates to a file that doesn't exist\n if (!originalFileInfo.fileExists) return;\n\n // The nearestMappingItem anchor may be above/left of the real position, due to gaps in the mapping. Calculate\n // the delta and apply it to the original position.\n const guessedPosition: Position = {\n line: nearestMappingItem.originalLine + sourceFileLine - nearestMappingItem.generatedLine,\n column: nearestMappingItem.originalColumn + sourceFileColumn - nearestMappingItem.generatedColumn\n };\n\n // Verify that the result is not out of bounds, in cause our heuristic failed\n if (\n guessedPosition.line >= 1 &&\n guessedPosition.line < originalFileInfo.maxColumnForLine.length &&\n guessedPosition.column >= 1 &&\n guessedPosition.column <= originalFileInfo.maxColumnForLine[guessedPosition.line]\n ) {\n return {\n sourceFilePath: mappedFilePath,\n sourceFileLine: guessedPosition.line,\n sourceFileColumn: guessedPosition.column\n };\n } else {\n // The guessed position was out of bounds, so use the nearestMappingItem position instead.\n return {\n sourceFilePath: mappedFilePath,\n sourceFileLine: nearestMappingItem.originalLine,\n sourceFileColumn: nearestMappingItem.originalColumn\n };\n }\n }\n\n private _getSourceMap(sourceFilePath: string): ISourceMap | null {\n let sourceMap: ISourceMap | null | undefined = this._sourceMapByFilePath.get(sourceFilePath);\n\n if (sourceMap === undefined) {\n // Normalize the path and redo the lookup\n const normalizedPath: string = FileSystem.getRealPath(sourceFilePath);\n\n sourceMap = this._sourceMapByFilePath.get(normalizedPath);\n if (sourceMap !== undefined) {\n // Copy the result from the normalized to the non-normalized key\n this._sourceMapByFilePath.set(sourceFilePath, sourceMap);\n } else {\n // Given \"folder/file.d.ts\", check for a corresponding \"folder/file.d.ts.map\"\n const sourceMapPath: string = normalizedPath + '.map';\n if (FileSystem.exists(sourceMapPath)) {\n // Load up the source map\n const rawSourceMap: RawSourceMap = JsonFile.load(sourceMapPath) as RawSourceMap;\n\n const sourceMapConsumer: SourceMapConsumer = new SourceMapConsumer(rawSourceMap);\n const mappingItems: MappingItem[] = [];\n\n // Extract the list of mapping items\n sourceMapConsumer.eachMapping(\n (mappingItem: MappingItem) => {\n mappingItems.push({\n ...mappingItem,\n // The \"source-map\" package inexplicably uses 1-based line numbers but 0-based column numbers.\n // Fix that up proactively so we don't have to deal with it later.\n generatedColumn: mappingItem.generatedColumn + 1,\n originalColumn: mappingItem.originalColumn + 1\n });\n },\n this,\n SourceMapConsumer.GENERATED_ORDER\n );\n\n sourceMap = { sourceMapConsumer, mappingItems };\n } else {\n // No source map for this filename\n sourceMap = null;\n }\n\n this._sourceMapByFilePath.set(normalizedPath, sourceMap);\n if (sourceFilePath !== normalizedPath) {\n // Add both keys to the map\n this._sourceMapByFilePath.set(sourceFilePath, sourceMap);\n }\n }\n }\n\n return sourceMap;\n }\n\n // The `mappingItems` array is sorted by generatedLine/generatedColumn (GENERATED_ORDER).\n // The _findNearestMappingItem() lookup is a simple binary search that returns the previous item\n // if there is no exact match.\n private static _findNearestMappingItem(\n mappingItems: MappingItem[],\n position: Position\n ): MappingItem | undefined {\n if (mappingItems.length === 0) {\n return undefined;\n }\n\n let startIndex: number = 0;\n let endIndex: number = mappingItems.length - 1;\n\n while (startIndex <= endIndex) {\n const middleIndex: number = startIndex + Math.floor((endIndex - startIndex) / 2);\n\n const diff: number = SourceMapper._compareMappingItem(mappingItems[middleIndex], position);\n\n if (diff < 0) {\n startIndex = middleIndex + 1;\n } else if (diff > 0) {\n endIndex = middleIndex - 1;\n } else {\n // Exact match\n return mappingItems[middleIndex];\n }\n }\n\n // If we didn't find an exact match, then endIndex < startIndex.\n // Take endIndex because it's the smaller value.\n return mappingItems[endIndex];\n }\n\n private static _compareMappingItem(mappingItem: MappingItem, position: Position): number {\n const diff: number = mappingItem.generatedLine - position.line;\n if (diff !== 0) {\n return diff;\n }\n return mappingItem.generatedColumn - position.column;\n }\n}\n"]}
1
+ {"version":3,"file":"SourceMapper.js","sourceRoot":"","sources":["../../src/collector/SourceMapper.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,gDAAkC;AAElC,2CAAmG;AAGn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AG,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;YAEjF,MAAM,IAAI,GAAW,YAAY,CAAC,mBAAmB,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,CAAC;YAE3F,IAAI,IAAI,GAAG,CAAC,EAAE,CAAC;gBACb,UAAU,GAAG,WAAW,GAAG,CAAC,CAAC;YAC/B,CAAC;iBAAM,IAAI,IAAI,GAAG,CAAC,EAAE,CAAC;gBACpB,QAAQ,GAAG,WAAW,GAAG,CAAC,CAAC;YAC7B,CAAC;iBAAM,CAAC;gBACN,cAAc;gBACd,OAAO,YAAY,CAAC,WAAW,CAAC,CAAC;YACnC,CAAC;QACH,CAAC;QAED,gEAAgE;QAChE,gDAAgD;QAChD,OAAO,YAAY,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAEO,MAAM,CAAC,mBAAmB,CAAC,WAAwB,EAAE,QAAkB;QAC7E,MAAM,IAAI,GAAW,WAAW,CAAC,aAAa,GAAG,QAAQ,CAAC,IAAI,CAAC;QAC/D,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;YACf,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,WAAW,CAAC,eAAe,GAAG,QAAQ,CAAC,MAAM,CAAC;IACvD,CAAC;CACF;AAvMD,oCAuMC","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 path from 'node:path';\n\nimport { SourceMapConsumer, type RawSourceMap, type MappingItem, type Position } from 'source-map';\nimport type ts from 'typescript';\n\nimport { FileSystem, InternalError, JsonFile, NewlineKind } from '@rushstack/node-core-library';\n\ninterface ISourceMap {\n sourceMapConsumer: SourceMapConsumer;\n\n // SourceMapConsumer.originalPositionFor() is useless because the mapping contains numerous gaps,\n // and the API provides no way to find the nearest match. So instead we extract all the mapping items\n // and search them using SourceMapper._findNearestMappingItem().\n mappingItems: MappingItem[];\n}\n\ninterface IOriginalFileInfo {\n // Whether the .ts file exists\n fileExists: boolean;\n\n // This is used to check whether the guessed position is out of bounds.\n // Since column/line numbers are 1-based, the 0th item in this array is unused.\n maxColumnForLine: number[];\n}\n\nexport interface ISourceLocation {\n /**\n * The absolute path to the source file.\n */\n sourceFilePath: string;\n\n /**\n * The line number in the source file. The first line number is 1.\n */\n sourceFileLine: number;\n\n /**\n * The column number in the source file. The first column number is 1.\n */\n sourceFileColumn: number;\n}\n\nexport interface IGetSourceLocationOptions {\n /**\n * The source file to get the source location from.\n */\n sourceFile: ts.SourceFile;\n\n /**\n * The position within the source file to get the source location from.\n */\n pos: number;\n\n /**\n * If `false` or not provided, then we attempt to follow source maps in order to resolve the\n * location to the original `.ts` file. If resolution isn't possible for some reason, we fall\n * back to the `.d.ts` location.\n *\n * If `true`, then we don't bother following source maps, and the location refers to the `.d.ts`\n * location.\n */\n useDtsLocation?: boolean;\n}\n\nexport class SourceMapper {\n // Map from .d.ts file path --> ISourceMap if a source map was found, or null if not found\n private _sourceMapByFilePath: Map<string, ISourceMap | null> = new Map<string, ISourceMap | null>();\n\n // Cache the FileSystem.exists() result for mapped .ts files\n private _originalFileInfoByPath: Map<string, IOriginalFileInfo> = new Map<string, IOriginalFileInfo>();\n\n /**\n * Given a `.d.ts` source file and a specific position within the file, return the corresponding\n * `ISourceLocation`.\n */\n public getSourceLocation(options: IGetSourceLocationOptions): ISourceLocation {\n const lineAndCharacter: ts.LineAndCharacter = options.sourceFile.getLineAndCharacterOfPosition(\n options.pos\n );\n const sourceLocation: ISourceLocation = {\n sourceFilePath: options.sourceFile.fileName,\n sourceFileLine: lineAndCharacter.line + 1,\n sourceFileColumn: lineAndCharacter.character + 1\n };\n\n if (options.useDtsLocation) {\n return sourceLocation;\n }\n\n const mappedSourceLocation: ISourceLocation | undefined = this._getMappedSourceLocation(sourceLocation);\n return mappedSourceLocation || sourceLocation;\n }\n\n private _getMappedSourceLocation(sourceLocation: ISourceLocation): ISourceLocation | undefined {\n const { sourceFilePath, sourceFileLine, sourceFileColumn } = sourceLocation;\n\n if (!FileSystem.exists(sourceFilePath)) {\n // Sanity check\n throw new InternalError('The referenced path was not found: ' + sourceFilePath);\n }\n\n const sourceMap: ISourceMap | null = this._getSourceMap(sourceFilePath);\n if (!sourceMap) return;\n\n const nearestMappingItem: MappingItem | undefined = SourceMapper._findNearestMappingItem(\n sourceMap.mappingItems,\n {\n line: sourceFileLine,\n column: sourceFileColumn\n }\n );\n\n if (!nearestMappingItem) return;\n\n const mappedFilePath: string = path.resolve(path.dirname(sourceFilePath), nearestMappingItem.source);\n\n // Does the mapped filename exist? Use a cache to remember the answer.\n let originalFileInfo: IOriginalFileInfo | undefined = this._originalFileInfoByPath.get(mappedFilePath);\n if (originalFileInfo === undefined) {\n originalFileInfo = {\n fileExists: FileSystem.exists(mappedFilePath),\n maxColumnForLine: []\n };\n\n if (originalFileInfo.fileExists) {\n // Read the file and measure the length of each line\n originalFileInfo.maxColumnForLine = FileSystem.readFile(mappedFilePath, {\n convertLineEndings: NewlineKind.Lf\n })\n .split('\\n')\n .map((x) => x.length + 1); // +1 since columns are 1-based\n originalFileInfo.maxColumnForLine.unshift(0); // Extra item since lines are 1-based\n }\n\n this._originalFileInfoByPath.set(mappedFilePath, originalFileInfo);\n }\n\n // Don't translate coordinates to a file that doesn't exist\n if (!originalFileInfo.fileExists) return;\n\n // The nearestMappingItem anchor may be above/left of the real position, due to gaps in the mapping. Calculate\n // the delta and apply it to the original position.\n const guessedPosition: Position = {\n line: nearestMappingItem.originalLine + sourceFileLine - nearestMappingItem.generatedLine,\n column: nearestMappingItem.originalColumn + sourceFileColumn - nearestMappingItem.generatedColumn\n };\n\n // Verify that the result is not out of bounds, in cause our heuristic failed\n if (\n guessedPosition.line >= 1 &&\n guessedPosition.line < originalFileInfo.maxColumnForLine.length &&\n guessedPosition.column >= 1 &&\n guessedPosition.column <= originalFileInfo.maxColumnForLine[guessedPosition.line]\n ) {\n return {\n sourceFilePath: mappedFilePath,\n sourceFileLine: guessedPosition.line,\n sourceFileColumn: guessedPosition.column\n };\n } else {\n // The guessed position was out of bounds, so use the nearestMappingItem position instead.\n return {\n sourceFilePath: mappedFilePath,\n sourceFileLine: nearestMappingItem.originalLine,\n sourceFileColumn: nearestMappingItem.originalColumn\n };\n }\n }\n\n private _getSourceMap(sourceFilePath: string): ISourceMap | null {\n let sourceMap: ISourceMap | null | undefined = this._sourceMapByFilePath.get(sourceFilePath);\n\n if (sourceMap === undefined) {\n // Normalize the path and redo the lookup\n const normalizedPath: string = FileSystem.getRealPath(sourceFilePath);\n\n sourceMap = this._sourceMapByFilePath.get(normalizedPath);\n if (sourceMap !== undefined) {\n // Copy the result from the normalized to the non-normalized key\n this._sourceMapByFilePath.set(sourceFilePath, sourceMap);\n } else {\n // Given \"folder/file.d.ts\", check for a corresponding \"folder/file.d.ts.map\"\n const sourceMapPath: string = normalizedPath + '.map';\n if (FileSystem.exists(sourceMapPath)) {\n // Load up the source map\n const rawSourceMap: RawSourceMap = JsonFile.load(sourceMapPath) as RawSourceMap;\n\n const sourceMapConsumer: SourceMapConsumer = new SourceMapConsumer(rawSourceMap);\n const mappingItems: MappingItem[] = [];\n\n // Extract the list of mapping items\n sourceMapConsumer.eachMapping(\n (mappingItem: MappingItem) => {\n mappingItems.push({\n ...mappingItem,\n // The \"source-map\" package inexplicably uses 1-based line numbers but 0-based column numbers.\n // Fix that up proactively so we don't have to deal with it later.\n generatedColumn: mappingItem.generatedColumn + 1,\n originalColumn: mappingItem.originalColumn + 1\n });\n },\n this,\n SourceMapConsumer.GENERATED_ORDER\n );\n\n sourceMap = { sourceMapConsumer, mappingItems };\n } else {\n // No source map for this filename\n sourceMap = null;\n }\n\n this._sourceMapByFilePath.set(normalizedPath, sourceMap);\n if (sourceFilePath !== normalizedPath) {\n // Add both keys to the map\n this._sourceMapByFilePath.set(sourceFilePath, sourceMap);\n }\n }\n }\n\n return sourceMap;\n }\n\n // The `mappingItems` array is sorted by generatedLine/generatedColumn (GENERATED_ORDER).\n // The _findNearestMappingItem() lookup is a simple binary search that returns the previous item\n // if there is no exact match.\n private static _findNearestMappingItem(\n mappingItems: MappingItem[],\n position: Position\n ): MappingItem | undefined {\n if (mappingItems.length === 0) {\n return undefined;\n }\n\n let startIndex: number = 0;\n let endIndex: number = mappingItems.length - 1;\n\n while (startIndex <= endIndex) {\n const middleIndex: number = startIndex + Math.floor((endIndex - startIndex) / 2);\n\n const diff: number = SourceMapper._compareMappingItem(mappingItems[middleIndex], position);\n\n if (diff < 0) {\n startIndex = middleIndex + 1;\n } else if (diff > 0) {\n endIndex = middleIndex - 1;\n } else {\n // Exact match\n return mappingItems[middleIndex];\n }\n }\n\n // If we didn't find an exact match, then endIndex < startIndex.\n // Take endIndex because it's the smaller value.\n return mappingItems[endIndex];\n }\n\n private static _compareMappingItem(mappingItem: MappingItem, position: Position): number {\n const diff: number = mappingItem.generatedLine - position.line;\n if (diff !== 0) {\n return diff;\n }\n return mappingItem.generatedColumn - position.column;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"WorkingPackage.d.ts","sourceRoot":"","sources":["../../src/collector/WorkingPackage.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAE/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,gBAAgB,CAAC;IAC9B,oBAAoB,EAAE,EAAE,CAAC,UAAU,CAAC;CACrC;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,cAAc;IACzB;;;;;;OAMG;IACH,SAAgB,aAAa,EAAE,MAAM,CAAC;IAEtC;;OAEG;IACH,SAAgB,WAAW,EAAE,gBAAgB,CAAC;IAE9C;;;;;;;OAOG;IACH,SAAgB,oBAAoB,EAAE,EAAE,CAAC,UAAU,CAAC;IAEpD;;OAEG;IACI,YAAY,EAAE,KAAK,CAAC,UAAU,GAAG,SAAS,CAAC;IAElD;;OAEG;IACI,kBAAkB,EAAE,KAAK,CAAC,aAAa,GAAG,SAAS,CAAC;gBAExC,OAAO,EAAE,sBAAsB;IAMlD;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;CACF"}
1
+ {"version":3,"file":"WorkingPackage.d.ts","sourceRoot":"","sources":["../../src/collector/WorkingPackage.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,KAAK,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,gBAAgB,CAAC;IAC9B,oBAAoB,EAAE,EAAE,CAAC,UAAU,CAAC;CACrC;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,cAAc;IACzB;;;;;;OAMG;IACH,SAAgB,aAAa,EAAE,MAAM,CAAC;IAEtC;;OAEG;IACH,SAAgB,WAAW,EAAE,gBAAgB,CAAC;IAE9C;;;;;;;OAOG;IACH,SAAgB,oBAAoB,EAAE,EAAE,CAAC,UAAU,CAAC;IAEpD;;OAEG;IACI,YAAY,EAAE,KAAK,CAAC,UAAU,GAAG,SAAS,CAAC;IAElD;;OAEG;IACI,kBAAkB,EAAE,KAAK,CAAC,aAAa,GAAG,SAAS,CAAC;gBAExC,OAAO,EAAE,sBAAsB;IAMlD;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"WorkingPackage.js","sourceRoot":"","sources":["../../src/collector/WorkingPackage.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAgB3D;;;;;;;;;;;;;GAaG;AACH,MAAa,cAAc;IAmCzB,YAAmB,OAA+B;QAChD,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;QAC3C,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAC3D,CAAC;IAED;;OAEG;IACH,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IAC/B,CAAC;CACF;AA/CD,wCA+CC","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 type * as ts from 'typescript';\nimport type * as tsdoc from '@microsoft/tsdoc';\n\nimport type { INodePackageJson } from '@rushstack/node-core-library';\n\n/**\n * Constructor options for WorkingPackage\n */\nexport interface IWorkingPackageOptions {\n packageFolder: string;\n packageJson: INodePackageJson;\n entryPointSourceFile: ts.SourceFile;\n}\n\n/**\n * Information about the working package for a particular invocation of API Extractor.\n *\n * @remarks\n * API Extractor tries to model the world as a collection of NPM packages, such that each\n * .d.ts file belongs to at most one package. When API Extractor is invoked on a project,\n * we refer to that project as being the \"working package\". There is exactly one\n * \"working package\" for the duration of this analysis. Any files that do not belong to\n * the working package are referred to as \"external\": external declarations belonging to\n * external packages.\n *\n * If API Extractor is invoked on a standalone .d.ts file, the \"working package\" may not\n * have an actual package.json file on disk, but we still refer to it in concept.\n */\nexport class WorkingPackage {\n /**\n * Returns the folder for the package.json file of the working package.\n *\n * @remarks\n * If the entry point is `C:\\Folder\\project\\src\\index.ts` and the nearest package.json\n * is `C:\\Folder\\project\\package.json`, then the packageFolder is `C:\\Folder\\project`\n */\n public readonly packageFolder: string;\n\n /**\n * The parsed package.json file for the working package.\n */\n public readonly packageJson: INodePackageJson;\n\n /**\n * The entry point being processed during this invocation of API Extractor.\n *\n * @remarks\n * The working package may have multiple entry points; however, today API Extractor\n * only processes a single entry point during an invocation. This will be improved\n * in the future.\n */\n public readonly entryPointSourceFile: ts.SourceFile;\n\n /**\n * The `@packageDocumentation` comment, if any, for the working package.\n */\n public tsdocComment: tsdoc.DocComment | undefined;\n\n /**\n * Additional parser information for `WorkingPackage.tsdocComment`.\n */\n public tsdocParserContext: tsdoc.ParserContext | undefined;\n\n public constructor(options: IWorkingPackageOptions) {\n this.packageFolder = options.packageFolder;\n this.packageJson = options.packageJson;\n this.entryPointSourceFile = options.entryPointSourceFile;\n }\n\n /**\n * Returns the full name of the working package.\n */\n public get name(): string {\n return this.packageJson.name;\n }\n}\n"]}
1
+ {"version":3,"file":"WorkingPackage.js","sourceRoot":"","sources":["../../src/collector/WorkingPackage.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAgB3D;;;;;;;;;;;;;GAaG;AACH,MAAa,cAAc;IAmCzB,YAAmB,OAA+B;QAChD,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;QAC3C,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAC3D,CAAC;IAED;;OAEG;IACH,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IAC/B,CAAC;CACF;AA/CD,wCA+CC","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 type * as ts from 'typescript';\n\nimport type * as tsdoc from '@microsoft/tsdoc';\nimport type { INodePackageJson } from '@rushstack/node-core-library';\n\n/**\n * Constructor options for WorkingPackage\n */\nexport interface IWorkingPackageOptions {\n packageFolder: string;\n packageJson: INodePackageJson;\n entryPointSourceFile: ts.SourceFile;\n}\n\n/**\n * Information about the working package for a particular invocation of API Extractor.\n *\n * @remarks\n * API Extractor tries to model the world as a collection of NPM packages, such that each\n * .d.ts file belongs to at most one package. When API Extractor is invoked on a project,\n * we refer to that project as being the \"working package\". There is exactly one\n * \"working package\" for the duration of this analysis. Any files that do not belong to\n * the working package are referred to as \"external\": external declarations belonging to\n * external packages.\n *\n * If API Extractor is invoked on a standalone .d.ts file, the \"working package\" may not\n * have an actual package.json file on disk, but we still refer to it in concept.\n */\nexport class WorkingPackage {\n /**\n * Returns the folder for the package.json file of the working package.\n *\n * @remarks\n * If the entry point is `C:\\Folder\\project\\src\\index.ts` and the nearest package.json\n * is `C:\\Folder\\project\\package.json`, then the packageFolder is `C:\\Folder\\project`\n */\n public readonly packageFolder: string;\n\n /**\n * The parsed package.json file for the working package.\n */\n public readonly packageJson: INodePackageJson;\n\n /**\n * The entry point being processed during this invocation of API Extractor.\n *\n * @remarks\n * The working package may have multiple entry points; however, today API Extractor\n * only processes a single entry point during an invocation. This will be improved\n * in the future.\n */\n public readonly entryPointSourceFile: ts.SourceFile;\n\n /**\n * The `@packageDocumentation` comment, if any, for the working package.\n */\n public tsdocComment: tsdoc.DocComment | undefined;\n\n /**\n * Additional parser information for `WorkingPackage.tsdocComment`.\n */\n public tsdocParserContext: tsdoc.ParserContext | undefined;\n\n public constructor(options: IWorkingPackageOptions) {\n this.packageFolder = options.packageFolder;\n this.packageJson = options.packageJson;\n this.entryPointSourceFile = options.entryPointSourceFile;\n }\n\n /**\n * Returns the full name of the working package.\n */\n public get name(): string {\n return this.packageJson.name;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"DocCommentEnhancer.d.ts","sourceRoot":"","sources":["../../src/enhancers/DocCommentEnhancer.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AASxD,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAY;gBAEpB,SAAS,EAAE,SAAS;WAIzB,OAAO,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;IAK1C,OAAO,IAAI,IAAI;IAgBtB,OAAO,CAAC,eAAe;IA2BvB,OAAO,CAAC,0BAA0B;IAuGlC,OAAO,CAAC,oBAAoB;IAO5B,OAAO,CAAC,6BAA6B;IAyBrC;;OAEG;IACH,OAAO,CAAC,gBAAgB;IA2CxB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAgB1B;;OAEG;IACH,OAAO,CAAC,oCAAoC;CAQ7C"}
1
+ {"version":3,"file":"DocCommentEnhancer.d.ts","sourceRoot":"","sources":["../../src/enhancers/DocCommentEnhancer.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAQxD,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAY;gBAEpB,SAAS,EAAE,SAAS;WAIzB,OAAO,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;IAK1C,OAAO,IAAI,IAAI;IAgBtB,OAAO,CAAC,eAAe;IA2BvB,OAAO,CAAC,0BAA0B;IAuGlC,OAAO,CAAC,oBAAoB;IAO5B,OAAO,CAAC,6BAA6B;IAyBrC;;OAEG;IACH,OAAO,CAAC,gBAAgB;IA2CxB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAgB1B;;OAEG;IACH,OAAO,CAAC,oCAAoC;CAQ7C"}
@@ -38,8 +38,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
38
38
  exports.DocCommentEnhancer = void 0;
39
39
  const ts = __importStar(require("typescript"));
40
40
  const tsdoc = __importStar(require("@microsoft/tsdoc"));
41
- const AstSymbol_1 = require("../analyzer/AstSymbol");
42
41
  const api_extractor_model_1 = require("@microsoft/api-extractor-model");
42
+ const AstSymbol_1 = require("../analyzer/AstSymbol");
43
43
  const ExtractorMessageId_1 = require("../api/ExtractorMessageId");
44
44
  const VisitorState_1 = require("../collector/VisitorState");
45
45
  const AstReferenceResolver_1 = require("../analyzer/AstReferenceResolver");
@@ -1 +1 @@
1
- {"version":3,"file":"DocCommentEnhancer.js","sourceRoot":"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,CAAC;QACrC,CAAC;QACD,KAAK,MAAM,SAAS,IAAI,gBAAgB,CAAC,UAAU,EAAE,CAAC;YACpD,gBAAgB,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAC7C,CAAC;QACD,gBAAgB,CAAC,YAAY,GAAG,gBAAgB,CAAC,YAAY,CAAC;QAE9D,gBAAgB,CAAC,aAAa,GAAG,SAAS,CAAC;IAC7C,CAAC;IAED;;OAEG;IACK,oCAAoC,CAC1C,oBAA+D;QAE/D,OAAO,CACL,CAAA,oBAAoB,aAApB,oBAAoB,uBAApB,oBAAoB,CAAE,WAAW,MAAK,SAAS;YAC/C,oBAAoB,CAAC,WAAW,KAAK,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,IAAI,CACzE,CAAC;IACJ,CAAC;CACF;AA1QD,gDA0QC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as ts from 'typescript';\nimport * as tsdoc from '@microsoft/tsdoc';\n\nimport type { Collector } from '../collector/Collector';\nimport { AstSymbol } from '../analyzer/AstSymbol';\nimport type { AstDeclaration } from '../analyzer/AstDeclaration';\nimport type { ApiItemMetadata } from '../collector/ApiItemMetadata';\nimport { ReleaseTag } from '@microsoft/api-extractor-model';\nimport { ExtractorMessageId } from '../api/ExtractorMessageId';\nimport { VisitorState } from '../collector/VisitorState';\nimport { ResolverFailure } from '../analyzer/AstReferenceResolver';\n\nexport class DocCommentEnhancer {\n private readonly _collector: Collector;\n\n public constructor(collector: Collector) {\n this._collector = collector;\n }\n\n public static analyze(collector: Collector): void {\n const docCommentEnhancer: DocCommentEnhancer = new DocCommentEnhancer(collector);\n docCommentEnhancer.analyze();\n }\n\n public analyze(): void {\n for (const entity of this._collector.entities) {\n if (entity.astEntity instanceof AstSymbol) {\n if (\n entity.consumable ||\n this._collector.extractorConfig.apiReportIncludeForgottenExports ||\n this._collector.extractorConfig.docModelIncludeForgottenExports\n ) {\n entity.astEntity.forEachDeclarationRecursive((astDeclaration: AstDeclaration) => {\n this._analyzeApiItem(astDeclaration);\n });\n }\n }\n }\n }\n\n private _analyzeApiItem(astDeclaration: AstDeclaration): void {\n const metadata: ApiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration);\n if (metadata.docCommentEnhancerVisitorState === VisitorState.Visited) {\n return;\n }\n\n if (metadata.docCommentEnhancerVisitorState === VisitorState.Visiting) {\n this._collector.messageRouter.addAnalyzerIssue(\n ExtractorMessageId.CyclicInheritDoc,\n `The @inheritDoc tag for \"${astDeclaration.astSymbol.localName}\" refers to its own declaration`,\n astDeclaration\n );\n return;\n }\n metadata.docCommentEnhancerVisitorState = VisitorState.Visiting;\n\n if (metadata.tsdocComment && metadata.tsdocComment.inheritDocTag) {\n this._applyInheritDoc(astDeclaration, metadata.tsdocComment, metadata.tsdocComment.inheritDocTag);\n }\n\n this._analyzeNeedsDocumentation(astDeclaration, metadata);\n\n this._checkForBrokenLinks(astDeclaration, metadata);\n\n metadata.docCommentEnhancerVisitorState = VisitorState.Visited;\n }\n\n private _analyzeNeedsDocumentation(astDeclaration: AstDeclaration, metadata: ApiItemMetadata): void {\n if (astDeclaration.declaration.kind === ts.SyntaxKind.Constructor) {\n // Constructors always do pretty much the same thing, so it's annoying to require people to write\n // descriptions for them. Instead, if the constructor lacks a TSDoc summary, then API Extractor\n // will auto-generate one.\n metadata.undocumented = false;\n\n // The class that contains this constructor\n const classDeclaration: AstDeclaration = astDeclaration.parent!;\n\n const configuration: tsdoc.TSDocConfiguration = this._collector.extractorConfig.tsdocConfiguration;\n\n if (!metadata.tsdocComment) {\n metadata.tsdocComment = new tsdoc.DocComment({ configuration });\n }\n\n if (!tsdoc.PlainTextEmitter.hasAnyTextContent(metadata.tsdocComment.summarySection)) {\n metadata.tsdocComment.summarySection.appendNodesInParagraph([\n new tsdoc.DocPlainText({ configuration, text: 'Constructs a new instance of the ' }),\n new tsdoc.DocCodeSpan({\n configuration,\n code: classDeclaration.astSymbol.localName\n }),\n new tsdoc.DocPlainText({ configuration, text: ' class' })\n ]);\n }\n\n const apiItemMetadata: ApiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration);\n if (apiItemMetadata.effectiveReleaseTag === ReleaseTag.Internal) {\n // If the constructor is marked as internal, then add a boilerplate notice for the containing class\n const classMetadata: ApiItemMetadata = this._collector.fetchApiItemMetadata(classDeclaration);\n\n if (!classMetadata.tsdocComment) {\n classMetadata.tsdocComment = new tsdoc.DocComment({ configuration });\n }\n\n if (classMetadata.tsdocComment.remarksBlock === undefined) {\n classMetadata.tsdocComment.remarksBlock = new tsdoc.DocBlock({\n configuration,\n blockTag: new tsdoc.DocBlockTag({\n configuration,\n tagName: tsdoc.StandardTags.remarks.tagName\n })\n });\n }\n\n classMetadata.tsdocComment.remarksBlock.content.appendNode(\n new tsdoc.DocParagraph({ configuration }, [\n new tsdoc.DocPlainText({\n configuration,\n text:\n `The constructor for this class is marked as internal. Third-party code should not` +\n ` call the constructor directly or create subclasses that extend the `\n }),\n new tsdoc.DocCodeSpan({\n configuration,\n code: classDeclaration.astSymbol.localName\n }),\n new tsdoc.DocPlainText({ configuration, text: ' class.' })\n ])\n );\n }\n return;\n } else {\n // For non-constructor items, we will determine whether or not the item is documented as follows:\n // 1. If it contains a summary section with at least 10 characters, then it is considered \"documented\".\n // 2. If it contains an @inheritDoc tag, then it *may* be considered \"documented\", depending on whether or not\n // the tag resolves to a \"documented\" API member.\n // - Note: for external members, we cannot currently determine this, so we will consider the \"documented\"\n // status to be unknown.\n if (metadata.tsdocComment) {\n if (tsdoc.PlainTextEmitter.hasAnyTextContent(metadata.tsdocComment.summarySection, 10)) {\n // If the API item has a summary comment block (with at least 10 characters), mark it as \"documented\".\n metadata.undocumented = false;\n } else if (metadata.tsdocComment.inheritDocTag) {\n if (\n this._refersToDeclarationInWorkingPackage(\n metadata.tsdocComment.inheritDocTag.declarationReference\n )\n ) {\n // If the API item has an `@inheritDoc` comment that points to an API item in the working package,\n // then the documentation contents should have already been copied from the target via `_applyInheritDoc`.\n // The continued existence of the tag indicates that the declaration reference was invalid, and not\n // documentation contents could be copied.\n // An analyzer issue will have already been logged for this.\n // We will treat such an API as \"undocumented\".\n metadata.undocumented = true;\n } else {\n // If the API item has an `@inheritDoc` comment that points to an external API item, we cannot currently\n // determine whether or not the target is \"documented\", so we cannot say definitively that this is \"undocumented\".\n metadata.undocumented = false;\n }\n } else {\n // If the API item has neither a summary comment block, nor an `@inheritDoc` comment, mark it as \"undocumented\".\n metadata.undocumented = true;\n }\n } else {\n // If there is no tsdoc comment at all, mark \"undocumented\".\n metadata.undocumented = true;\n }\n }\n }\n\n private _checkForBrokenLinks(astDeclaration: AstDeclaration, metadata: ApiItemMetadata): void {\n if (!metadata.tsdocComment) {\n return;\n }\n this._checkForBrokenLinksRecursive(astDeclaration, metadata.tsdocComment);\n }\n\n private _checkForBrokenLinksRecursive(astDeclaration: AstDeclaration, node: tsdoc.DocNode): void {\n if (node instanceof tsdoc.DocLinkTag) {\n if (node.codeDestination) {\n // Is it referring to the working package? If not, we don't do any link validation, because\n // AstReferenceResolver doesn't support it yet (but ModelReferenceResolver does of course).\n // Tracked by: https://github.com/microsoft/rushstack/issues/1195\n if (this._refersToDeclarationInWorkingPackage(node.codeDestination)) {\n const referencedAstDeclaration: AstDeclaration | ResolverFailure =\n this._collector.astReferenceResolver.resolve(node.codeDestination);\n\n if (referencedAstDeclaration instanceof ResolverFailure) {\n this._collector.messageRouter.addAnalyzerIssue(\n ExtractorMessageId.UnresolvedLink,\n 'The @link reference could not be resolved: ' + referencedAstDeclaration.reason,\n astDeclaration\n );\n }\n }\n }\n }\n for (const childNode of node.getChildNodes()) {\n this._checkForBrokenLinksRecursive(astDeclaration, childNode);\n }\n }\n\n /**\n * Follow an `{@inheritDoc ___}` reference and copy the content that we find in the referenced comment.\n */\n private _applyInheritDoc(\n astDeclaration: AstDeclaration,\n docComment: tsdoc.DocComment,\n inheritDocTag: tsdoc.DocInheritDocTag\n ): void {\n if (!inheritDocTag.declarationReference) {\n this._collector.messageRouter.addAnalyzerIssue(\n ExtractorMessageId.UnresolvedInheritDocBase,\n 'The @inheritDoc tag needs a TSDoc declaration reference; signature matching is not supported yet',\n astDeclaration\n );\n return;\n }\n\n if (!this._refersToDeclarationInWorkingPackage(inheritDocTag.declarationReference)) {\n // The `@inheritDoc` tag is referencing an external package. Skip it, since AstReferenceResolver doesn't\n // support it yet. As a workaround, this tag will get handled later by api-documenter.\n // Tracked by: https://github.com/microsoft/rushstack/issues/1195\n return;\n }\n\n const referencedAstDeclaration: AstDeclaration | ResolverFailure =\n this._collector.astReferenceResolver.resolve(inheritDocTag.declarationReference);\n\n if (referencedAstDeclaration instanceof ResolverFailure) {\n this._collector.messageRouter.addAnalyzerIssue(\n ExtractorMessageId.UnresolvedInheritDocReference,\n 'The @inheritDoc reference could not be resolved: ' + referencedAstDeclaration.reason,\n astDeclaration\n );\n return;\n }\n\n this._analyzeApiItem(referencedAstDeclaration);\n\n const referencedMetadata: ApiItemMetadata =\n this._collector.fetchApiItemMetadata(referencedAstDeclaration);\n\n if (referencedMetadata.tsdocComment) {\n this._copyInheritedDocs(docComment, referencedMetadata.tsdocComment);\n }\n }\n\n /**\n * Copy the content from `sourceDocComment` to `targetDocComment`.\n */\n private _copyInheritedDocs(targetDocComment: tsdoc.DocComment, sourceDocComment: tsdoc.DocComment): void {\n targetDocComment.summarySection = sourceDocComment.summarySection;\n targetDocComment.remarksBlock = sourceDocComment.remarksBlock;\n\n targetDocComment.params.clear();\n for (const param of sourceDocComment.params) {\n targetDocComment.params.add(param);\n }\n for (const typeParam of sourceDocComment.typeParams) {\n targetDocComment.typeParams.add(typeParam);\n }\n targetDocComment.returnsBlock = sourceDocComment.returnsBlock;\n\n targetDocComment.inheritDocTag = undefined;\n }\n\n /**\n * Determines whether or not the provided declaration reference points to an item in the working package.\n */\n private _refersToDeclarationInWorkingPackage(\n declarationReference: tsdoc.DocDeclarationReference | undefined\n ): boolean {\n return (\n declarationReference?.packageName === undefined ||\n declarationReference.packageName === this._collector.workingPackage.name\n );\n }\n}\n"]}
1
+ {"version":3,"file":"DocCommentEnhancer.js","sourceRoot":"","sources":["../../src/enhancers/DocCommentEnhancer.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,+CAAiC;AAEjC,wDAA0C;AAC1C,wEAA4D;AAG5D,qDAAkD;AAGlD,kEAA+D;AAC/D,4DAAyD;AACzD,2EAAmE;AAEnE,MAAa,kBAAkB;IAG7B,YAAmB,SAAoB;QACrC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAC9B,CAAC;IAEM,MAAM,CAAC,OAAO,CAAC,SAAoB;QACxC,MAAM,kBAAkB,GAAuB,IAAI,kBAAkB,CAAC,SAAS,CAAC,CAAC;QACjF,kBAAkB,CAAC,OAAO,EAAE,CAAC;IAC/B,CAAC;IAEM,OAAO;QACZ,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;YAC9C,IAAI,MAAM,CAAC,SAAS,YAAY,qBAAS,EAAE,CAAC;gBAC1C,IACE,MAAM,CAAC,UAAU;oBACjB,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,gCAAgC;oBAChE,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,+BAA+B,EAC/D,CAAC;oBACD,MAAM,CAAC,SAAS,CAAC,2BAA2B,CAAC,CAAC,cAA8B,EAAE,EAAE;wBAC9E,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;oBACvC,CAAC,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAEO,eAAe,CAAC,cAA8B;QACpD,MAAM,QAAQ,GAAoB,IAAI,CAAC,UAAU,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;QACvF,IAAI,QAAQ,CAAC,8BAA8B,KAAK,2BAAY,C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,KAAK,MAAM,KAAK,IAAI,gBAAgB,CAAC,MAAM,EAAE,CAAC;YAC5C,gBAAgB,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACrC,CAAC;QACD,KAAK,MAAM,SAAS,IAAI,gBAAgB,CAAC,UAAU,EAAE,CAAC;YACpD,gBAAgB,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAC7C,CAAC;QACD,gBAAgB,CAAC,YAAY,GAAG,gBAAgB,CAAC,YAAY,CAAC;QAE9D,gBAAgB,CAAC,aAAa,GAAG,SAAS,CAAC;IAC7C,CAAC;IAED;;OAEG;IACK,oCAAoC,CAC1C,oBAA+D;QAE/D,OAAO,CACL,CAAA,oBAAoB,aAApB,oBAAoB,uBAApB,oBAAoB,CAAE,WAAW,MAAK,SAAS;YAC/C,oBAAoB,CAAC,WAAW,KAAK,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,IAAI,CACzE,CAAC;IACJ,CAAC;CACF;AA1QD,gDA0QC","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 * as tsdoc from '@microsoft/tsdoc';\nimport { ReleaseTag } from '@microsoft/api-extractor-model';\n\nimport type { Collector } from '../collector/Collector';\nimport { AstSymbol } from '../analyzer/AstSymbol';\nimport type { AstDeclaration } from '../analyzer/AstDeclaration';\nimport type { ApiItemMetadata } from '../collector/ApiItemMetadata';\nimport { ExtractorMessageId } from '../api/ExtractorMessageId';\nimport { VisitorState } from '../collector/VisitorState';\nimport { ResolverFailure } from '../analyzer/AstReferenceResolver';\n\nexport class DocCommentEnhancer {\n private readonly _collector: Collector;\n\n public constructor(collector: Collector) {\n this._collector = collector;\n }\n\n public static analyze(collector: Collector): void {\n const docCommentEnhancer: DocCommentEnhancer = new DocCommentEnhancer(collector);\n docCommentEnhancer.analyze();\n }\n\n public analyze(): void {\n for (const entity of this._collector.entities) {\n if (entity.astEntity instanceof AstSymbol) {\n if (\n entity.consumable ||\n this._collector.extractorConfig.apiReportIncludeForgottenExports ||\n this._collector.extractorConfig.docModelIncludeForgottenExports\n ) {\n entity.astEntity.forEachDeclarationRecursive((astDeclaration: AstDeclaration) => {\n this._analyzeApiItem(astDeclaration);\n });\n }\n }\n }\n }\n\n private _analyzeApiItem(astDeclaration: AstDeclaration): void {\n const metadata: ApiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration);\n if (metadata.docCommentEnhancerVisitorState === VisitorState.Visited) {\n return;\n }\n\n if (metadata.docCommentEnhancerVisitorState === VisitorState.Visiting) {\n this._collector.messageRouter.addAnalyzerIssue(\n ExtractorMessageId.CyclicInheritDoc,\n `The @inheritDoc tag for \"${astDeclaration.astSymbol.localName}\" refers to its own declaration`,\n astDeclaration\n );\n return;\n }\n metadata.docCommentEnhancerVisitorState = VisitorState.Visiting;\n\n if (metadata.tsdocComment && metadata.tsdocComment.inheritDocTag) {\n this._applyInheritDoc(astDeclaration, metadata.tsdocComment, metadata.tsdocComment.inheritDocTag);\n }\n\n this._analyzeNeedsDocumentation(astDeclaration, metadata);\n\n this._checkForBrokenLinks(astDeclaration, metadata);\n\n metadata.docCommentEnhancerVisitorState = VisitorState.Visited;\n }\n\n private _analyzeNeedsDocumentation(astDeclaration: AstDeclaration, metadata: ApiItemMetadata): void {\n if (astDeclaration.declaration.kind === ts.SyntaxKind.Constructor) {\n // Constructors always do pretty much the same thing, so it's annoying to require people to write\n // descriptions for them. Instead, if the constructor lacks a TSDoc summary, then API Extractor\n // will auto-generate one.\n metadata.undocumented = false;\n\n // The class that contains this constructor\n const classDeclaration: AstDeclaration = astDeclaration.parent!;\n\n const configuration: tsdoc.TSDocConfiguration = this._collector.extractorConfig.tsdocConfiguration;\n\n if (!metadata.tsdocComment) {\n metadata.tsdocComment = new tsdoc.DocComment({ configuration });\n }\n\n if (!tsdoc.PlainTextEmitter.hasAnyTextContent(metadata.tsdocComment.summarySection)) {\n metadata.tsdocComment.summarySection.appendNodesInParagraph([\n new tsdoc.DocPlainText({ configuration, text: 'Constructs a new instance of the ' }),\n new tsdoc.DocCodeSpan({\n configuration,\n code: classDeclaration.astSymbol.localName\n }),\n new tsdoc.DocPlainText({ configuration, text: ' class' })\n ]);\n }\n\n const apiItemMetadata: ApiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration);\n if (apiItemMetadata.effectiveReleaseTag === ReleaseTag.Internal) {\n // If the constructor is marked as internal, then add a boilerplate notice for the containing class\n const classMetadata: ApiItemMetadata = this._collector.fetchApiItemMetadata(classDeclaration);\n\n if (!classMetadata.tsdocComment) {\n classMetadata.tsdocComment = new tsdoc.DocComment({ configuration });\n }\n\n if (classMetadata.tsdocComment.remarksBlock === undefined) {\n classMetadata.tsdocComment.remarksBlock = new tsdoc.DocBlock({\n configuration,\n blockTag: new tsdoc.DocBlockTag({\n configuration,\n tagName: tsdoc.StandardTags.remarks.tagName\n })\n });\n }\n\n classMetadata.tsdocComment.remarksBlock.content.appendNode(\n new tsdoc.DocParagraph({ configuration }, [\n new tsdoc.DocPlainText({\n configuration,\n text:\n `The constructor for this class is marked as internal. Third-party code should not` +\n ` call the constructor directly or create subclasses that extend the `\n }),\n new tsdoc.DocCodeSpan({\n configuration,\n code: classDeclaration.astSymbol.localName\n }),\n new tsdoc.DocPlainText({ configuration, text: ' class.' })\n ])\n );\n }\n return;\n } else {\n // For non-constructor items, we will determine whether or not the item is documented as follows:\n // 1. If it contains a summary section with at least 10 characters, then it is considered \"documented\".\n // 2. If it contains an @inheritDoc tag, then it *may* be considered \"documented\", depending on whether or not\n // the tag resolves to a \"documented\" API member.\n // - Note: for external members, we cannot currently determine this, so we will consider the \"documented\"\n // status to be unknown.\n if (metadata.tsdocComment) {\n if (tsdoc.PlainTextEmitter.hasAnyTextContent(metadata.tsdocComment.summarySection, 10)) {\n // If the API item has a summary comment block (with at least 10 characters), mark it as \"documented\".\n metadata.undocumented = false;\n } else if (metadata.tsdocComment.inheritDocTag) {\n if (\n this._refersToDeclarationInWorkingPackage(\n metadata.tsdocComment.inheritDocTag.declarationReference\n )\n ) {\n // If the API item has an `@inheritDoc` comment that points to an API item in the working package,\n // then the documentation contents should have already been copied from the target via `_applyInheritDoc`.\n // The continued existence of the tag indicates that the declaration reference was invalid, and not\n // documentation contents could be copied.\n // An analyzer issue will have already been logged for this.\n // We will treat such an API as \"undocumented\".\n metadata.undocumented = true;\n } else {\n // If the API item has an `@inheritDoc` comment that points to an external API item, we cannot currently\n // determine whether or not the target is \"documented\", so we cannot say definitively that this is \"undocumented\".\n metadata.undocumented = false;\n }\n } else {\n // If the API item has neither a summary comment block, nor an `@inheritDoc` comment, mark it as \"undocumented\".\n metadata.undocumented = true;\n }\n } else {\n // If there is no tsdoc comment at all, mark \"undocumented\".\n metadata.undocumented = true;\n }\n }\n }\n\n private _checkForBrokenLinks(astDeclaration: AstDeclaration, metadata: ApiItemMetadata): void {\n if (!metadata.tsdocComment) {\n return;\n }\n this._checkForBrokenLinksRecursive(astDeclaration, metadata.tsdocComment);\n }\n\n private _checkForBrokenLinksRecursive(astDeclaration: AstDeclaration, node: tsdoc.DocNode): void {\n if (node instanceof tsdoc.DocLinkTag) {\n if (node.codeDestination) {\n // Is it referring to the working package? If not, we don't do any link validation, because\n // AstReferenceResolver doesn't support it yet (but ModelReferenceResolver does of course).\n // Tracked by: https://github.com/microsoft/rushstack/issues/1195\n if (this._refersToDeclarationInWorkingPackage(node.codeDestination)) {\n const referencedAstDeclaration: AstDeclaration | ResolverFailure =\n this._collector.astReferenceResolver.resolve(node.codeDestination);\n\n if (referencedAstDeclaration instanceof ResolverFailure) {\n this._collector.messageRouter.addAnalyzerIssue(\n ExtractorMessageId.UnresolvedLink,\n 'The @link reference could not be resolved: ' + referencedAstDeclaration.reason,\n astDeclaration\n );\n }\n }\n }\n }\n for (const childNode of node.getChildNodes()) {\n this._checkForBrokenLinksRecursive(astDeclaration, childNode);\n }\n }\n\n /**\n * Follow an `{@inheritDoc ___}` reference and copy the content that we find in the referenced comment.\n */\n private _applyInheritDoc(\n astDeclaration: AstDeclaration,\n docComment: tsdoc.DocComment,\n inheritDocTag: tsdoc.DocInheritDocTag\n ): void {\n if (!inheritDocTag.declarationReference) {\n this._collector.messageRouter.addAnalyzerIssue(\n ExtractorMessageId.UnresolvedInheritDocBase,\n 'The @inheritDoc tag needs a TSDoc declaration reference; signature matching is not supported yet',\n astDeclaration\n );\n return;\n }\n\n if (!this._refersToDeclarationInWorkingPackage(inheritDocTag.declarationReference)) {\n // The `@inheritDoc` tag is referencing an external package. Skip it, since AstReferenceResolver doesn't\n // support it yet. As a workaround, this tag will get handled later by api-documenter.\n // Tracked by: https://github.com/microsoft/rushstack/issues/1195\n return;\n }\n\n const referencedAstDeclaration: AstDeclaration | ResolverFailure =\n this._collector.astReferenceResolver.resolve(inheritDocTag.declarationReference);\n\n if (referencedAstDeclaration instanceof ResolverFailure) {\n this._collector.messageRouter.addAnalyzerIssue(\n ExtractorMessageId.UnresolvedInheritDocReference,\n 'The @inheritDoc reference could not be resolved: ' + referencedAstDeclaration.reason,\n astDeclaration\n );\n return;\n }\n\n this._analyzeApiItem(referencedAstDeclaration);\n\n const referencedMetadata: ApiItemMetadata =\n this._collector.fetchApiItemMetadata(referencedAstDeclaration);\n\n if (referencedMetadata.tsdocComment) {\n this._copyInheritedDocs(docComment, referencedMetadata.tsdocComment);\n }\n }\n\n /**\n * Copy the content from `sourceDocComment` to `targetDocComment`.\n */\n private _copyInheritedDocs(targetDocComment: tsdoc.DocComment, sourceDocComment: tsdoc.DocComment): void {\n targetDocComment.summarySection = sourceDocComment.summarySection;\n targetDocComment.remarksBlock = sourceDocComment.remarksBlock;\n\n targetDocComment.params.clear();\n for (const param of sourceDocComment.params) {\n targetDocComment.params.add(param);\n }\n for (const typeParam of sourceDocComment.typeParams) {\n targetDocComment.typeParams.add(typeParam);\n }\n targetDocComment.returnsBlock = sourceDocComment.returnsBlock;\n\n targetDocComment.inheritDocTag = undefined;\n }\n\n /**\n * Determines whether or not the provided declaration reference points to an item in the working package.\n */\n private _refersToDeclarationInWorkingPackage(\n declarationReference: tsdoc.DocDeclarationReference | undefined\n ): boolean {\n return (\n declarationReference?.packageName === undefined ||\n declarationReference.packageName === this._collector.workingPackage.name\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ValidationEnhancer.d.ts","sourceRoot":"","sources":["../../src/enhancers/ValidationEnhancer.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAYxD,qBAAa,kBAAkB;WACf,OAAO,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;IAoDjD,OAAO,CAAC,MAAM,CAAC,2BAA2B;IA0D1C,OAAO,CAAC,MAAM,CAAC,gCAAgC;IAiE/C,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAgF/B,OAAO,CAAC,MAAM,CAAC,mBAAmB;CA2BnC"}
1
+ {"version":3,"file":"ValidationEnhancer.d.ts","sourceRoot":"","sources":["../../src/enhancers/ValidationEnhancer.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAWxD,qBAAa,kBAAkB;WACf,OAAO,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;IAoDjD,OAAO,CAAC,MAAM,CAAC,2BAA2B;IA0D1C,OAAO,CAAC,MAAM,CAAC,gCAAgC;IAiE/C,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAgF/B,OAAO,CAAC,MAAM,CAAC,mBAAmB;CA2BnC"}
@@ -36,11 +36,11 @@ var __importStar = (this && this.__importStar) || (function () {
36
36
  })();
37
37
  Object.defineProperty(exports, "__esModule", { value: true });
38
38
  exports.ValidationEnhancer = void 0;
39
- const path = __importStar(require("path"));
39
+ const path = __importStar(require("node:path"));
40
40
  const ts = __importStar(require("typescript"));
41
+ const api_extractor_model_1 = require("@microsoft/api-extractor-model");
41
42
  const AstSymbol_1 = require("../analyzer/AstSymbol");
42
43
  const ExtractorMessageId_1 = require("../api/ExtractorMessageId");
43
- const api_extractor_model_1 = require("@microsoft/api-extractor-model");
44
44
  const AstNamespaceImport_1 = require("../analyzer/AstNamespaceImport");
45
45
  class ValidationEnhancer {
46
46
  static analyze(collector) {