@microsoft/api-extractor 7.56.2 → 7.57.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 (298) hide show
  1. package/CHANGELOG.json +41 -0
  2. package/CHANGELOG.md +15 -1
  3. package/bin/api-extractor +1 -1
  4. package/lib-esm/aedoc/PackageDocComment.js +56 -0
  5. package/lib-esm/aedoc/PackageDocComment.js.map +1 -0
  6. package/lib-esm/analyzer/AstDeclaration.js +214 -0
  7. package/lib-esm/analyzer/AstDeclaration.js.map +1 -0
  8. package/lib-esm/analyzer/AstEntity.js +35 -0
  9. package/lib-esm/analyzer/AstEntity.js.map +1 -0
  10. package/lib-esm/analyzer/AstImport.js +76 -0
  11. package/lib-esm/analyzer/AstImport.js.map +1 -0
  12. package/lib-esm/analyzer/AstModule.js +22 -0
  13. package/lib-esm/analyzer/AstModule.js.map +1 -0
  14. package/lib-esm/analyzer/AstNamespaceExport.js +38 -0
  15. package/lib-esm/analyzer/AstNamespaceExport.js.map +1 -0
  16. package/lib-esm/analyzer/AstNamespaceImport.js +57 -0
  17. package/lib-esm/analyzer/AstNamespaceImport.js.map +1 -0
  18. package/lib-esm/analyzer/AstReferenceResolver.js +202 -0
  19. package/lib-esm/analyzer/AstReferenceResolver.js.map +1 -0
  20. package/lib-esm/analyzer/AstSymbol.js +104 -0
  21. package/lib-esm/analyzer/AstSymbol.js.map +1 -0
  22. package/lib-esm/analyzer/AstSymbolTable.js +524 -0
  23. package/lib-esm/analyzer/AstSymbolTable.js.map +1 -0
  24. package/lib-esm/analyzer/ExportAnalyzer.js +725 -0
  25. package/lib-esm/analyzer/ExportAnalyzer.js.map +1 -0
  26. package/lib-esm/analyzer/PackageMetadataManager.js +235 -0
  27. package/lib-esm/analyzer/PackageMetadataManager.js.map +1 -0
  28. package/lib-esm/analyzer/SourceFileLocationFormatter.js +44 -0
  29. package/lib-esm/analyzer/SourceFileLocationFormatter.js.map +1 -0
  30. package/lib-esm/analyzer/Span.js +545 -0
  31. package/lib-esm/analyzer/Span.js.map +1 -0
  32. package/lib-esm/analyzer/SyntaxHelpers.js +72 -0
  33. package/lib-esm/analyzer/SyntaxHelpers.js.map +1 -0
  34. package/lib-esm/analyzer/TypeScriptHelpers.js +242 -0
  35. package/lib-esm/analyzer/TypeScriptHelpers.js.map +1 -0
  36. package/lib-esm/analyzer/TypeScriptInternals.js +114 -0
  37. package/lib-esm/analyzer/TypeScriptInternals.js.map +1 -0
  38. package/lib-esm/api/CompilerState.js +149 -0
  39. package/lib-esm/api/CompilerState.js.map +1 -0
  40. package/lib-esm/api/ConsoleMessageId.js +82 -0
  41. package/lib-esm/api/ConsoleMessageId.js.map +1 -0
  42. package/lib-esm/api/Extractor.js +290 -0
  43. package/lib-esm/api/Extractor.js.map +1 -0
  44. package/lib-esm/api/ExtractorConfig.js +801 -0
  45. package/lib-esm/api/ExtractorConfig.js.map +1 -0
  46. package/lib-esm/api/ExtractorLogLevel.js +46 -0
  47. package/lib-esm/api/ExtractorLogLevel.js.map +1 -0
  48. package/lib-esm/api/ExtractorMessage.js +140 -0
  49. package/lib-esm/api/ExtractorMessage.js.map +1 -0
  50. package/lib-esm/api/ExtractorMessageId.js +128 -0
  51. package/lib-esm/api/ExtractorMessageId.js.map +1 -0
  52. package/lib-esm/api/IConfigFile.js +4 -0
  53. package/lib-esm/api/IConfigFile.js.map +1 -0
  54. package/lib-esm/cli/ApiExtractorCommandLine.js +51 -0
  55. package/lib-esm/cli/ApiExtractorCommandLine.js.map +1 -0
  56. package/lib-esm/cli/InitAction.js +35 -0
  57. package/lib-esm/cli/InitAction.js.map +1 -0
  58. package/lib-esm/cli/RunAction.js +123 -0
  59. package/lib-esm/cli/RunAction.js.map +1 -0
  60. package/lib-esm/collector/ApiItemMetadata.js +55 -0
  61. package/lib-esm/collector/ApiItemMetadata.js.map +1 -0
  62. package/lib-esm/collector/Collector.js +794 -0
  63. package/lib-esm/collector/Collector.js.map +1 -0
  64. package/lib-esm/collector/CollectorEntity.js +219 -0
  65. package/lib-esm/collector/CollectorEntity.js.map +1 -0
  66. package/lib-esm/collector/DeclarationMetadata.js +24 -0
  67. package/lib-esm/collector/DeclarationMetadata.js.map +1 -0
  68. package/lib-esm/collector/MessageRouter.js +476 -0
  69. package/lib-esm/collector/MessageRouter.js.map +1 -0
  70. package/lib-esm/collector/SourceMapper.js +171 -0
  71. package/lib-esm/collector/SourceMapper.js.map +1 -0
  72. package/lib-esm/collector/SymbolMetadata.js +12 -0
  73. package/lib-esm/collector/SymbolMetadata.js.map +1 -0
  74. package/lib-esm/collector/VisitorState.js +23 -0
  75. package/lib-esm/collector/VisitorState.js.map +1 -0
  76. package/lib-esm/collector/WorkingPackage.js +30 -0
  77. package/lib-esm/collector/WorkingPackage.js.map +1 -0
  78. package/lib-esm/enhancers/DocCommentEnhancer.js +213 -0
  79. package/lib-esm/enhancers/DocCommentEnhancer.js.map +1 -0
  80. package/lib-esm/enhancers/ValidationEnhancer.js +217 -0
  81. package/lib-esm/enhancers/ValidationEnhancer.js.map +1 -0
  82. package/lib-esm/generators/ApiModelGenerator.js +852 -0
  83. package/lib-esm/generators/ApiModelGenerator.js.map +1 -0
  84. package/lib-esm/generators/ApiReportGenerator.js +518 -0
  85. package/lib-esm/generators/ApiReportGenerator.js.map +1 -0
  86. package/lib-esm/generators/DeclarationReferenceGenerator.js +292 -0
  87. package/lib-esm/generators/DeclarationReferenceGenerator.js.map +1 -0
  88. package/lib-esm/generators/DtsEmitHelpers.js +227 -0
  89. package/lib-esm/generators/DtsEmitHelpers.js.map +1 -0
  90. package/lib-esm/generators/DtsRollupGenerator.js +391 -0
  91. package/lib-esm/generators/DtsRollupGenerator.js.map +1 -0
  92. package/lib-esm/generators/ExcerptBuilder.js +259 -0
  93. package/lib-esm/generators/ExcerptBuilder.js.map +1 -0
  94. package/lib-esm/generators/IndentedWriter.js +238 -0
  95. package/lib-esm/generators/IndentedWriter.js.map +1 -0
  96. package/lib-esm/index.js +17 -0
  97. package/lib-esm/index.js.map +1 -0
  98. package/lib-esm/schemas/api-extractor-defaults.json +94 -0
  99. package/lib-esm/schemas/api-extractor-template.json +454 -0
  100. package/lib-esm/schemas/api-extractor.schema.json +257 -0
  101. package/lib-esm/start.js +14 -0
  102. package/lib-esm/start.js.map +1 -0
  103. package/package.json +38 -12
  104. /package/{lib → lib-commonjs}/aedoc/PackageDocComment.js +0 -0
  105. /package/{lib → lib-commonjs}/aedoc/PackageDocComment.js.map +0 -0
  106. /package/{lib → lib-commonjs}/analyzer/AstDeclaration.js +0 -0
  107. /package/{lib → lib-commonjs}/analyzer/AstDeclaration.js.map +0 -0
  108. /package/{lib → lib-commonjs}/analyzer/AstEntity.js +0 -0
  109. /package/{lib → lib-commonjs}/analyzer/AstEntity.js.map +0 -0
  110. /package/{lib → lib-commonjs}/analyzer/AstImport.js +0 -0
  111. /package/{lib → lib-commonjs}/analyzer/AstImport.js.map +0 -0
  112. /package/{lib → lib-commonjs}/analyzer/AstModule.js +0 -0
  113. /package/{lib → lib-commonjs}/analyzer/AstModule.js.map +0 -0
  114. /package/{lib → lib-commonjs}/analyzer/AstNamespaceExport.js +0 -0
  115. /package/{lib → lib-commonjs}/analyzer/AstNamespaceExport.js.map +0 -0
  116. /package/{lib → lib-commonjs}/analyzer/AstNamespaceImport.js +0 -0
  117. /package/{lib → lib-commonjs}/analyzer/AstNamespaceImport.js.map +0 -0
  118. /package/{lib → lib-commonjs}/analyzer/AstReferenceResolver.js +0 -0
  119. /package/{lib → lib-commonjs}/analyzer/AstReferenceResolver.js.map +0 -0
  120. /package/{lib → lib-commonjs}/analyzer/AstSymbol.js +0 -0
  121. /package/{lib → lib-commonjs}/analyzer/AstSymbol.js.map +0 -0
  122. /package/{lib → lib-commonjs}/analyzer/AstSymbolTable.js +0 -0
  123. /package/{lib → lib-commonjs}/analyzer/AstSymbolTable.js.map +0 -0
  124. /package/{lib → lib-commonjs}/analyzer/ExportAnalyzer.js +0 -0
  125. /package/{lib → lib-commonjs}/analyzer/ExportAnalyzer.js.map +0 -0
  126. /package/{lib → lib-commonjs}/analyzer/PackageMetadataManager.js +0 -0
  127. /package/{lib → lib-commonjs}/analyzer/PackageMetadataManager.js.map +0 -0
  128. /package/{lib → lib-commonjs}/analyzer/SourceFileLocationFormatter.js +0 -0
  129. /package/{lib → lib-commonjs}/analyzer/SourceFileLocationFormatter.js.map +0 -0
  130. /package/{lib → lib-commonjs}/analyzer/Span.js +0 -0
  131. /package/{lib → lib-commonjs}/analyzer/Span.js.map +0 -0
  132. /package/{lib → lib-commonjs}/analyzer/SyntaxHelpers.js +0 -0
  133. /package/{lib → lib-commonjs}/analyzer/SyntaxHelpers.js.map +0 -0
  134. /package/{lib → lib-commonjs}/analyzer/TypeScriptHelpers.js +0 -0
  135. /package/{lib → lib-commonjs}/analyzer/TypeScriptHelpers.js.map +0 -0
  136. /package/{lib → lib-commonjs}/analyzer/TypeScriptInternals.js +0 -0
  137. /package/{lib → lib-commonjs}/analyzer/TypeScriptInternals.js.map +0 -0
  138. /package/{lib → lib-commonjs}/api/CompilerState.js +0 -0
  139. /package/{lib → lib-commonjs}/api/CompilerState.js.map +0 -0
  140. /package/{lib → lib-commonjs}/api/ConsoleMessageId.js +0 -0
  141. /package/{lib → lib-commonjs}/api/ConsoleMessageId.js.map +0 -0
  142. /package/{lib → lib-commonjs}/api/Extractor.js +0 -0
  143. /package/{lib → lib-commonjs}/api/Extractor.js.map +0 -0
  144. /package/{lib → lib-commonjs}/api/ExtractorConfig.js +0 -0
  145. /package/{lib → lib-commonjs}/api/ExtractorConfig.js.map +0 -0
  146. /package/{lib → lib-commonjs}/api/ExtractorLogLevel.js +0 -0
  147. /package/{lib → lib-commonjs}/api/ExtractorLogLevel.js.map +0 -0
  148. /package/{lib → lib-commonjs}/api/ExtractorMessage.js +0 -0
  149. /package/{lib → lib-commonjs}/api/ExtractorMessage.js.map +0 -0
  150. /package/{lib → lib-commonjs}/api/ExtractorMessageId.js +0 -0
  151. /package/{lib → lib-commonjs}/api/ExtractorMessageId.js.map +0 -0
  152. /package/{lib → lib-commonjs}/api/IConfigFile.js +0 -0
  153. /package/{lib → lib-commonjs}/api/IConfigFile.js.map +0 -0
  154. /package/{lib → lib-commonjs}/cli/ApiExtractorCommandLine.js +0 -0
  155. /package/{lib → lib-commonjs}/cli/ApiExtractorCommandLine.js.map +0 -0
  156. /package/{lib → lib-commonjs}/cli/InitAction.js +0 -0
  157. /package/{lib → lib-commonjs}/cli/InitAction.js.map +0 -0
  158. /package/{lib → lib-commonjs}/cli/RunAction.js +0 -0
  159. /package/{lib → lib-commonjs}/cli/RunAction.js.map +0 -0
  160. /package/{lib → lib-commonjs}/collector/ApiItemMetadata.js +0 -0
  161. /package/{lib → lib-commonjs}/collector/ApiItemMetadata.js.map +0 -0
  162. /package/{lib → lib-commonjs}/collector/Collector.js +0 -0
  163. /package/{lib → lib-commonjs}/collector/Collector.js.map +0 -0
  164. /package/{lib → lib-commonjs}/collector/CollectorEntity.js +0 -0
  165. /package/{lib → lib-commonjs}/collector/CollectorEntity.js.map +0 -0
  166. /package/{lib → lib-commonjs}/collector/DeclarationMetadata.js +0 -0
  167. /package/{lib → lib-commonjs}/collector/DeclarationMetadata.js.map +0 -0
  168. /package/{lib → lib-commonjs}/collector/MessageRouter.js +0 -0
  169. /package/{lib → lib-commonjs}/collector/MessageRouter.js.map +0 -0
  170. /package/{lib → lib-commonjs}/collector/SourceMapper.js +0 -0
  171. /package/{lib → lib-commonjs}/collector/SourceMapper.js.map +0 -0
  172. /package/{lib → lib-commonjs}/collector/SymbolMetadata.js +0 -0
  173. /package/{lib → lib-commonjs}/collector/SymbolMetadata.js.map +0 -0
  174. /package/{lib → lib-commonjs}/collector/VisitorState.js +0 -0
  175. /package/{lib → lib-commonjs}/collector/VisitorState.js.map +0 -0
  176. /package/{lib → lib-commonjs}/collector/WorkingPackage.js +0 -0
  177. /package/{lib → lib-commonjs}/collector/WorkingPackage.js.map +0 -0
  178. /package/{lib → lib-commonjs}/enhancers/DocCommentEnhancer.js +0 -0
  179. /package/{lib → lib-commonjs}/enhancers/DocCommentEnhancer.js.map +0 -0
  180. /package/{lib → lib-commonjs}/enhancers/ValidationEnhancer.js +0 -0
  181. /package/{lib → lib-commonjs}/enhancers/ValidationEnhancer.js.map +0 -0
  182. /package/{lib → lib-commonjs}/generators/ApiModelGenerator.js +0 -0
  183. /package/{lib → lib-commonjs}/generators/ApiModelGenerator.js.map +0 -0
  184. /package/{lib → lib-commonjs}/generators/ApiReportGenerator.js +0 -0
  185. /package/{lib → lib-commonjs}/generators/ApiReportGenerator.js.map +0 -0
  186. /package/{lib → lib-commonjs}/generators/DeclarationReferenceGenerator.js +0 -0
  187. /package/{lib → lib-commonjs}/generators/DeclarationReferenceGenerator.js.map +0 -0
  188. /package/{lib → lib-commonjs}/generators/DtsEmitHelpers.js +0 -0
  189. /package/{lib → lib-commonjs}/generators/DtsEmitHelpers.js.map +0 -0
  190. /package/{lib → lib-commonjs}/generators/DtsRollupGenerator.js +0 -0
  191. /package/{lib → lib-commonjs}/generators/DtsRollupGenerator.js.map +0 -0
  192. /package/{lib → lib-commonjs}/generators/ExcerptBuilder.js +0 -0
  193. /package/{lib → lib-commonjs}/generators/ExcerptBuilder.js.map +0 -0
  194. /package/{lib → lib-commonjs}/generators/IndentedWriter.js +0 -0
  195. /package/{lib → lib-commonjs}/generators/IndentedWriter.js.map +0 -0
  196. /package/{lib → lib-commonjs}/index.js +0 -0
  197. /package/{lib → lib-commonjs}/index.js.map +0 -0
  198. /package/{lib → lib-commonjs}/schemas/api-extractor-defaults.json +0 -0
  199. /package/{lib → lib-commonjs}/schemas/api-extractor-template.json +0 -0
  200. /package/{lib → lib-commonjs}/schemas/api-extractor.schema.json +0 -0
  201. /package/{lib → lib-commonjs}/start.js +0 -0
  202. /package/{lib → lib-commonjs}/start.js.map +0 -0
  203. /package/{lib → lib-dts}/aedoc/PackageDocComment.d.ts +0 -0
  204. /package/{lib → lib-dts}/aedoc/PackageDocComment.d.ts.map +0 -0
  205. /package/{lib → lib-dts}/analyzer/AstDeclaration.d.ts +0 -0
  206. /package/{lib → lib-dts}/analyzer/AstDeclaration.d.ts.map +0 -0
  207. /package/{lib → lib-dts}/analyzer/AstEntity.d.ts +0 -0
  208. /package/{lib → lib-dts}/analyzer/AstEntity.d.ts.map +0 -0
  209. /package/{lib → lib-dts}/analyzer/AstImport.d.ts +0 -0
  210. /package/{lib → lib-dts}/analyzer/AstImport.d.ts.map +0 -0
  211. /package/{lib → lib-dts}/analyzer/AstModule.d.ts +0 -0
  212. /package/{lib → lib-dts}/analyzer/AstModule.d.ts.map +0 -0
  213. /package/{lib → lib-dts}/analyzer/AstNamespaceExport.d.ts +0 -0
  214. /package/{lib → lib-dts}/analyzer/AstNamespaceExport.d.ts.map +0 -0
  215. /package/{lib → lib-dts}/analyzer/AstNamespaceImport.d.ts +0 -0
  216. /package/{lib → lib-dts}/analyzer/AstNamespaceImport.d.ts.map +0 -0
  217. /package/{lib → lib-dts}/analyzer/AstReferenceResolver.d.ts +0 -0
  218. /package/{lib → lib-dts}/analyzer/AstReferenceResolver.d.ts.map +0 -0
  219. /package/{lib → lib-dts}/analyzer/AstSymbol.d.ts +0 -0
  220. /package/{lib → lib-dts}/analyzer/AstSymbol.d.ts.map +0 -0
  221. /package/{lib → lib-dts}/analyzer/AstSymbolTable.d.ts +0 -0
  222. /package/{lib → lib-dts}/analyzer/AstSymbolTable.d.ts.map +0 -0
  223. /package/{lib → lib-dts}/analyzer/ExportAnalyzer.d.ts +0 -0
  224. /package/{lib → lib-dts}/analyzer/ExportAnalyzer.d.ts.map +0 -0
  225. /package/{lib → lib-dts}/analyzer/PackageMetadataManager.d.ts +0 -0
  226. /package/{lib → lib-dts}/analyzer/PackageMetadataManager.d.ts.map +0 -0
  227. /package/{lib → lib-dts}/analyzer/SourceFileLocationFormatter.d.ts +0 -0
  228. /package/{lib → lib-dts}/analyzer/SourceFileLocationFormatter.d.ts.map +0 -0
  229. /package/{lib → lib-dts}/analyzer/Span.d.ts +0 -0
  230. /package/{lib → lib-dts}/analyzer/Span.d.ts.map +0 -0
  231. /package/{lib → lib-dts}/analyzer/SyntaxHelpers.d.ts +0 -0
  232. /package/{lib → lib-dts}/analyzer/SyntaxHelpers.d.ts.map +0 -0
  233. /package/{lib → lib-dts}/analyzer/TypeScriptHelpers.d.ts +0 -0
  234. /package/{lib → lib-dts}/analyzer/TypeScriptHelpers.d.ts.map +0 -0
  235. /package/{lib → lib-dts}/analyzer/TypeScriptInternals.d.ts +0 -0
  236. /package/{lib → lib-dts}/analyzer/TypeScriptInternals.d.ts.map +0 -0
  237. /package/{lib → lib-dts}/api/CompilerState.d.ts +0 -0
  238. /package/{lib → lib-dts}/api/CompilerState.d.ts.map +0 -0
  239. /package/{lib → lib-dts}/api/ConsoleMessageId.d.ts +0 -0
  240. /package/{lib → lib-dts}/api/ConsoleMessageId.d.ts.map +0 -0
  241. /package/{lib → lib-dts}/api/Extractor.d.ts +0 -0
  242. /package/{lib → lib-dts}/api/Extractor.d.ts.map +0 -0
  243. /package/{lib → lib-dts}/api/ExtractorConfig.d.ts +0 -0
  244. /package/{lib → lib-dts}/api/ExtractorConfig.d.ts.map +0 -0
  245. /package/{lib → lib-dts}/api/ExtractorLogLevel.d.ts +0 -0
  246. /package/{lib → lib-dts}/api/ExtractorLogLevel.d.ts.map +0 -0
  247. /package/{lib → lib-dts}/api/ExtractorMessage.d.ts +0 -0
  248. /package/{lib → lib-dts}/api/ExtractorMessage.d.ts.map +0 -0
  249. /package/{lib → lib-dts}/api/ExtractorMessageId.d.ts +0 -0
  250. /package/{lib → lib-dts}/api/ExtractorMessageId.d.ts.map +0 -0
  251. /package/{lib → lib-dts}/api/IConfigFile.d.ts +0 -0
  252. /package/{lib → lib-dts}/api/IConfigFile.d.ts.map +0 -0
  253. /package/{lib → lib-dts}/cli/ApiExtractorCommandLine.d.ts +0 -0
  254. /package/{lib → lib-dts}/cli/ApiExtractorCommandLine.d.ts.map +0 -0
  255. /package/{lib → lib-dts}/cli/InitAction.d.ts +0 -0
  256. /package/{lib → lib-dts}/cli/InitAction.d.ts.map +0 -0
  257. /package/{lib → lib-dts}/cli/RunAction.d.ts +0 -0
  258. /package/{lib → lib-dts}/cli/RunAction.d.ts.map +0 -0
  259. /package/{lib → lib-dts}/collector/ApiItemMetadata.d.ts +0 -0
  260. /package/{lib → lib-dts}/collector/ApiItemMetadata.d.ts.map +0 -0
  261. /package/{lib → lib-dts}/collector/Collector.d.ts +0 -0
  262. /package/{lib → lib-dts}/collector/Collector.d.ts.map +0 -0
  263. /package/{lib → lib-dts}/collector/CollectorEntity.d.ts +0 -0
  264. /package/{lib → lib-dts}/collector/CollectorEntity.d.ts.map +0 -0
  265. /package/{lib → lib-dts}/collector/DeclarationMetadata.d.ts +0 -0
  266. /package/{lib → lib-dts}/collector/DeclarationMetadata.d.ts.map +0 -0
  267. /package/{lib → lib-dts}/collector/MessageRouter.d.ts +0 -0
  268. /package/{lib → lib-dts}/collector/MessageRouter.d.ts.map +0 -0
  269. /package/{lib → lib-dts}/collector/SourceMapper.d.ts +0 -0
  270. /package/{lib → lib-dts}/collector/SourceMapper.d.ts.map +0 -0
  271. /package/{lib → lib-dts}/collector/SymbolMetadata.d.ts +0 -0
  272. /package/{lib → lib-dts}/collector/SymbolMetadata.d.ts.map +0 -0
  273. /package/{lib → lib-dts}/collector/VisitorState.d.ts +0 -0
  274. /package/{lib → lib-dts}/collector/VisitorState.d.ts.map +0 -0
  275. /package/{lib → lib-dts}/collector/WorkingPackage.d.ts +0 -0
  276. /package/{lib → lib-dts}/collector/WorkingPackage.d.ts.map +0 -0
  277. /package/{lib → lib-dts}/enhancers/DocCommentEnhancer.d.ts +0 -0
  278. /package/{lib → lib-dts}/enhancers/DocCommentEnhancer.d.ts.map +0 -0
  279. /package/{lib → lib-dts}/enhancers/ValidationEnhancer.d.ts +0 -0
  280. /package/{lib → lib-dts}/enhancers/ValidationEnhancer.d.ts.map +0 -0
  281. /package/{lib → lib-dts}/generators/ApiModelGenerator.d.ts +0 -0
  282. /package/{lib → lib-dts}/generators/ApiModelGenerator.d.ts.map +0 -0
  283. /package/{lib → lib-dts}/generators/ApiReportGenerator.d.ts +0 -0
  284. /package/{lib → lib-dts}/generators/ApiReportGenerator.d.ts.map +0 -0
  285. /package/{lib → lib-dts}/generators/DeclarationReferenceGenerator.d.ts +0 -0
  286. /package/{lib → lib-dts}/generators/DeclarationReferenceGenerator.d.ts.map +0 -0
  287. /package/{lib → lib-dts}/generators/DtsEmitHelpers.d.ts +0 -0
  288. /package/{lib → lib-dts}/generators/DtsEmitHelpers.d.ts.map +0 -0
  289. /package/{lib → lib-dts}/generators/DtsRollupGenerator.d.ts +0 -0
  290. /package/{lib → lib-dts}/generators/DtsRollupGenerator.d.ts.map +0 -0
  291. /package/{lib → lib-dts}/generators/ExcerptBuilder.d.ts +0 -0
  292. /package/{lib → lib-dts}/generators/ExcerptBuilder.d.ts.map +0 -0
  293. /package/{lib → lib-dts}/generators/IndentedWriter.d.ts +0 -0
  294. /package/{lib → lib-dts}/generators/IndentedWriter.d.ts.map +0 -0
  295. /package/{lib → lib-dts}/index.d.ts +0 -0
  296. /package/{lib → lib-dts}/index.d.ts.map +0 -0
  297. /package/{lib → lib-dts}/start.d.ts +0 -0
  298. /package/{lib → lib-dts}/start.d.ts.map +0 -0
@@ -0,0 +1,518 @@
1
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
2
+ // See LICENSE in the project root for license information.
3
+ import * as ts from 'typescript';
4
+ import { ReleaseTag } from '@microsoft/api-extractor-model';
5
+ import { Text, InternalError } from '@rushstack/node-core-library';
6
+ import { Collector } from '../collector/Collector';
7
+ import { TypeScriptHelpers } from '../analyzer/TypeScriptHelpers';
8
+ import { Span } from '../analyzer/Span';
9
+ import { AstDeclaration } from '../analyzer/AstDeclaration';
10
+ import { AstImport } from '../analyzer/AstImport';
11
+ import { AstSymbol } from '../analyzer/AstSymbol';
12
+ import { IndentedWriter } from './IndentedWriter';
13
+ import { DtsEmitHelpers } from './DtsEmitHelpers';
14
+ import { AstNamespaceImport } from '../analyzer/AstNamespaceImport';
15
+ import { SourceFileLocationFormatter } from '../analyzer/SourceFileLocationFormatter';
16
+ import { ExtractorMessageId } from '../api/ExtractorMessageId';
17
+ export class ApiReportGenerator {
18
+ /**
19
+ * Compares the contents of two API files that were created using ApiFileGenerator,
20
+ * and returns true if they are equivalent. Note that these files are not normally edited
21
+ * by a human; the "equivalence" comparison here is intended to ignore spurious changes that
22
+ * might be introduced by a tool, e.g. Git newline normalization or an editor that strips
23
+ * whitespace when saving.
24
+ */
25
+ static areEquivalentApiFileContents(actualFileContent, expectedFileContent) {
26
+ // NOTE: "\s" also matches "\r" and "\n"
27
+ const normalizedActual = actualFileContent.replace(/[\s]+/g, ' ');
28
+ const normalizedExpected = expectedFileContent.replace(/[\s]+/g, ' ');
29
+ return normalizedActual === normalizedExpected;
30
+ }
31
+ /**
32
+ * Generates and returns the API report contents as a string.
33
+ *
34
+ * @param reportVariant - The release level with which the report is associated.
35
+ * Can also be viewed as the minimal release level of items that should be included in the report.
36
+ */
37
+ static generateReviewFileContent(collector, reportVariant) {
38
+ var _a;
39
+ const writer = new IndentedWriter();
40
+ writer.trimLeadingSpaces = true;
41
+ function capitalizeFirstLetter(input) {
42
+ return input === '' ? '' : `${input[0].toLocaleUpperCase()}${input.slice(1)}`;
43
+ }
44
+ // For backwards compatibility, don't emit "complete" in report text for untrimmed reports.
45
+ const releaseLevelPrefix = reportVariant === 'complete' ? '' : `${capitalizeFirstLetter(reportVariant)} `;
46
+ writer.writeLine([
47
+ `## ${releaseLevelPrefix}API Report File for "${collector.workingPackage.name}"`,
48
+ ``,
49
+ `> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).`,
50
+ ``
51
+ ].join('\n'));
52
+ // Write the opening delimiter for the Markdown code fence
53
+ writer.writeLine('```ts\n');
54
+ // Emit the triple slash directives
55
+ for (const typeDirectiveReference of Array.from(collector.dtsTypeReferenceDirectives).sort()) {
56
+ // https://github.com/microsoft/TypeScript/blob/611ebc7aadd7a44a4c0447698bfda9222a78cb66/src/compiler/declarationEmitter.ts#L162
57
+ writer.writeLine(`/// <reference types="${typeDirectiveReference}" />`);
58
+ }
59
+ for (const libDirectiveReference of Array.from(collector.dtsLibReferenceDirectives).sort()) {
60
+ writer.writeLine(`/// <reference lib="${libDirectiveReference}" />`);
61
+ }
62
+ writer.ensureSkippedLine();
63
+ // Emit the imports
64
+ for (const entity of collector.entities) {
65
+ if (entity.astEntity instanceof AstImport) {
66
+ DtsEmitHelpers.emitImport(writer, entity, entity.astEntity);
67
+ }
68
+ }
69
+ writer.ensureSkippedLine();
70
+ const context = {
71
+ collector,
72
+ reportVariant,
73
+ alreadyProcessedSignatures: new Set()
74
+ };
75
+ // Emit the regular declarations
76
+ for (const entity of collector.entities) {
77
+ const astEntity = entity.astEntity;
78
+ const symbolMetadata = collector.tryFetchMetadataForAstEntity(astEntity);
79
+ const maxEffectiveReleaseTag = (_a = symbolMetadata === null || symbolMetadata === void 0 ? void 0 : symbolMetadata.maxEffectiveReleaseTag) !== null && _a !== void 0 ? _a : ReleaseTag.None;
80
+ if (!this._shouldIncludeReleaseTag(maxEffectiveReleaseTag, reportVariant)) {
81
+ continue;
82
+ }
83
+ if (entity.consumable || collector.extractorConfig.apiReportIncludeForgottenExports) {
84
+ const exportsToEmit = new Map();
85
+ for (const exportName of entity.exportNames) {
86
+ if (!entity.shouldInlineExport) {
87
+ exportsToEmit.set(exportName, { exportName, associatedMessages: [] });
88
+ }
89
+ }
90
+ if (astEntity instanceof AstSymbol) {
91
+ // Emit all the declarations for this entity
92
+ for (const astDeclaration of astEntity.astDeclarations || []) {
93
+ // Get the messages associated with this declaration
94
+ const fetchedMessages = collector.messageRouter.fetchAssociatedMessagesForReviewFile(astDeclaration);
95
+ // Peel off the messages associated with an export statement and store them
96
+ // in IExportToEmit.associatedMessages (to be processed later). The remaining messages will
97
+ // added to messagesToReport, to be emitted next to the declaration instead of the export statement.
98
+ const messagesToReport = [];
99
+ for (const message of fetchedMessages) {
100
+ if (message.properties.exportName) {
101
+ const exportToEmit = exportsToEmit.get(message.properties.exportName);
102
+ if (exportToEmit) {
103
+ exportToEmit.associatedMessages.push(message);
104
+ continue;
105
+ }
106
+ }
107
+ messagesToReport.push(message);
108
+ }
109
+ if (this._shouldIncludeDeclaration(collector, astDeclaration, reportVariant)) {
110
+ writer.ensureSkippedLine();
111
+ writer.write(ApiReportGenerator._getAedocSynopsis(collector, astDeclaration, messagesToReport));
112
+ const span = new Span(astDeclaration.declaration);
113
+ const apiItemMetadata = collector.fetchApiItemMetadata(astDeclaration);
114
+ if (apiItemMetadata.isPreapproved) {
115
+ ApiReportGenerator._modifySpanForPreapproved(span);
116
+ }
117
+ else {
118
+ ApiReportGenerator._modifySpan(span, entity, astDeclaration, false, context);
119
+ }
120
+ span.writeModifiedText(writer);
121
+ writer.ensureNewLine();
122
+ }
123
+ }
124
+ }
125
+ if (astEntity instanceof AstNamespaceImport) {
126
+ const astModuleExportInfo = astEntity.fetchAstModuleExportInfo(collector);
127
+ if (entity.nameForEmit === undefined) {
128
+ // This should never happen
129
+ throw new InternalError('referencedEntry.nameForEmit is undefined');
130
+ }
131
+ if (astModuleExportInfo.starExportedExternalModules.size > 0) {
132
+ // We could support this, but we would need to find a way to safely represent it.
133
+ throw new Error(`The ${entity.nameForEmit} namespace import includes a star export, which is not supported:\n` +
134
+ SourceFileLocationFormatter.formatDeclaration(astEntity.declaration));
135
+ }
136
+ // Emit a synthetic declaration for the namespace. It will look like this:
137
+ //
138
+ // declare namespace example {
139
+ // export {
140
+ // f1,
141
+ // f2
142
+ // }
143
+ // }
144
+ //
145
+ // Note that we do not try to relocate f1()/f2() to be inside the namespace because other type
146
+ // signatures may reference them directly (without using the namespace qualifier).
147
+ writer.ensureSkippedLine();
148
+ writer.writeLine(`declare namespace ${entity.nameForEmit} {`);
149
+ // all local exports of local imported module are just references to top-level declarations
150
+ writer.increaseIndent();
151
+ writer.writeLine('export {');
152
+ writer.increaseIndent();
153
+ const exportClauses = [];
154
+ for (const [exportedName, exportedEntity] of astModuleExportInfo.exportedLocalEntities) {
155
+ const collectorEntity = collector.tryGetCollectorEntity(exportedEntity);
156
+ if (collectorEntity === undefined) {
157
+ // This should never happen
158
+ // top-level exports of local imported module should be added as collector entities before
159
+ throw new InternalError(`Cannot find collector entity for ${entity.nameForEmit}.${exportedEntity.localName}`);
160
+ }
161
+ if (collectorEntity.nameForEmit === exportedName) {
162
+ exportClauses.push(collectorEntity.nameForEmit);
163
+ }
164
+ else {
165
+ exportClauses.push(`${collectorEntity.nameForEmit} as ${exportedName}`);
166
+ }
167
+ }
168
+ writer.writeLine(exportClauses.join(',\n'));
169
+ writer.decreaseIndent();
170
+ writer.writeLine('}'); // end of "export { ... }"
171
+ writer.decreaseIndent();
172
+ writer.writeLine('}'); // end of "declare namespace { ... }"
173
+ }
174
+ // Now emit the export statements for this entity.
175
+ for (const exportToEmit of exportsToEmit.values()) {
176
+ // Write any associated messages
177
+ if (exportToEmit.associatedMessages.length > 0) {
178
+ writer.ensureSkippedLine();
179
+ for (const message of exportToEmit.associatedMessages) {
180
+ ApiReportGenerator._writeLineAsComments(writer, 'Warning: ' + message.formatMessageWithoutLocation());
181
+ }
182
+ }
183
+ DtsEmitHelpers.emitNamedExport(writer, exportToEmit.exportName, entity);
184
+ }
185
+ writer.ensureSkippedLine();
186
+ }
187
+ }
188
+ DtsEmitHelpers.emitStarExports(writer, collector);
189
+ // Write the unassociated warnings at the bottom of the file
190
+ const unassociatedMessages = collector.messageRouter.fetchUnassociatedMessagesForReviewFile();
191
+ if (unassociatedMessages.length > 0) {
192
+ writer.ensureSkippedLine();
193
+ ApiReportGenerator._writeLineAsComments(writer, 'Warnings were encountered during analysis:');
194
+ ApiReportGenerator._writeLineAsComments(writer, '');
195
+ for (const unassociatedMessage of unassociatedMessages) {
196
+ ApiReportGenerator._writeLineAsComments(writer, unassociatedMessage.formatMessageWithLocation(collector.workingPackage.packageFolder));
197
+ }
198
+ }
199
+ if (collector.workingPackage.tsdocComment === undefined) {
200
+ writer.ensureSkippedLine();
201
+ ApiReportGenerator._writeLineAsComments(writer, '(No @packageDocumentation comment for this package)');
202
+ }
203
+ // Write the closing delimiter for the Markdown code fence
204
+ writer.ensureSkippedLine();
205
+ writer.writeLine('```');
206
+ // Remove any trailing spaces
207
+ return writer.toString().replace(ApiReportGenerator._trimSpacesRegExp, '');
208
+ }
209
+ /**
210
+ * Before writing out a declaration, _modifySpan() applies various fixups to make it nice.
211
+ */
212
+ static _modifySpan(span, entity, astDeclaration, insideTypeLiteral, context) {
213
+ const { collector, reportVariant } = context;
214
+ // Should we process this declaration at all?
215
+ if (!ApiReportGenerator._shouldIncludeDeclaration(collector, astDeclaration, reportVariant)) {
216
+ span.modification.skipAll();
217
+ return;
218
+ }
219
+ const previousSpan = span.previousSibling;
220
+ let recurseChildren = true;
221
+ let sortChildren = false;
222
+ switch (span.kind) {
223
+ case ts.SyntaxKind.JSDocComment:
224
+ span.modification.skipAll();
225
+ // For now, we don't transform JSDoc comment nodes at all
226
+ recurseChildren = false;
227
+ break;
228
+ case ts.SyntaxKind.ExportKeyword:
229
+ if (DtsEmitHelpers.isExportKeywordInNamespaceExportDeclaration(span.node)) {
230
+ // This is an export declaration inside a namespace - preserve the export keyword
231
+ break;
232
+ }
233
+ // Otherwise, delete the export keyword -- we will re-add it below
234
+ span.modification.skipAll();
235
+ break;
236
+ case ts.SyntaxKind.DefaultKeyword:
237
+ case ts.SyntaxKind.DeclareKeyword:
238
+ // Delete any explicit "export" or "declare" keywords -- we will re-add them below
239
+ span.modification.skipAll();
240
+ break;
241
+ case ts.SyntaxKind.InterfaceKeyword:
242
+ case ts.SyntaxKind.ClassKeyword:
243
+ case ts.SyntaxKind.EnumKeyword:
244
+ case ts.SyntaxKind.NamespaceKeyword:
245
+ case ts.SyntaxKind.ModuleKeyword:
246
+ case ts.SyntaxKind.TypeKeyword:
247
+ case ts.SyntaxKind.FunctionKeyword:
248
+ // Replace the stuff we possibly deleted above
249
+ let replacedModifiers = '';
250
+ if (entity.shouldInlineExport) {
251
+ replacedModifiers = 'export ' + replacedModifiers;
252
+ }
253
+ if (previousSpan && previousSpan.kind === ts.SyntaxKind.SyntaxList) {
254
+ // If there is a previous span of type SyntaxList, then apply it before any other modifiers
255
+ // (e.g. "abstract") that appear there.
256
+ previousSpan.modification.prefix = replacedModifiers + previousSpan.modification.prefix;
257
+ }
258
+ else {
259
+ // Otherwise just stick it in front of this span
260
+ span.modification.prefix = replacedModifiers + span.modification.prefix;
261
+ }
262
+ break;
263
+ case ts.SyntaxKind.SyntaxList:
264
+ if (span.parent) {
265
+ if (AstDeclaration.isSupportedSyntaxKind(span.parent.kind)) {
266
+ // If the immediate parent is an API declaration, and the immediate children are API declarations,
267
+ // then sort the children alphabetically
268
+ sortChildren = true;
269
+ }
270
+ else if (span.parent.kind === ts.SyntaxKind.ModuleBlock) {
271
+ // Namespaces are special because their chain goes ModuleDeclaration -> ModuleBlock -> SyntaxList
272
+ sortChildren = true;
273
+ }
274
+ }
275
+ break;
276
+ case ts.SyntaxKind.VariableDeclaration:
277
+ if (!span.parent) {
278
+ // The VariableDeclaration node is part of a VariableDeclarationList, however
279
+ // the Entry.followedSymbol points to the VariableDeclaration part because
280
+ // multiple definitions might share the same VariableDeclarationList.
281
+ //
282
+ // Since we are emitting a separate declaration for each one, we need to look upwards
283
+ // in the ts.Node tree and write a copy of the enclosing VariableDeclarationList
284
+ // content (e.g. "var" from "var x=1, y=2").
285
+ const list = TypeScriptHelpers.matchAncestor(span.node, [
286
+ ts.SyntaxKind.VariableDeclarationList,
287
+ ts.SyntaxKind.VariableDeclaration
288
+ ]);
289
+ if (!list) {
290
+ // This should not happen unless the compiler API changes somehow
291
+ throw new InternalError('Unsupported variable declaration');
292
+ }
293
+ const listPrefix = list
294
+ .getSourceFile()
295
+ .text.substring(list.getStart(), list.declarations[0].getStart());
296
+ span.modification.prefix = listPrefix + span.modification.prefix;
297
+ span.modification.suffix = ';';
298
+ if (entity.shouldInlineExport) {
299
+ span.modification.prefix = 'export ' + span.modification.prefix;
300
+ }
301
+ }
302
+ break;
303
+ case ts.SyntaxKind.Parameter:
304
+ {
305
+ // (signature) -> SyntaxList -> Parameter
306
+ const signatureParent = span.parent;
307
+ if (signatureParent) {
308
+ if (!context.alreadyProcessedSignatures.has(signatureParent)) {
309
+ context.alreadyProcessedSignatures.add(signatureParent);
310
+ DtsEmitHelpers.normalizeParameterNames(signatureParent);
311
+ }
312
+ }
313
+ }
314
+ break;
315
+ case ts.SyntaxKind.Identifier:
316
+ const referencedEntity = collector.tryGetEntityForNode(span.node);
317
+ if (referencedEntity) {
318
+ if (!referencedEntity.nameForEmit) {
319
+ // This should never happen
320
+ throw new InternalError('referencedEntry.nameForEmit is undefined');
321
+ }
322
+ span.modification.prefix = referencedEntity.nameForEmit;
323
+ // For debugging:
324
+ // span.modification.prefix += '/*R=FIX*/';
325
+ }
326
+ else {
327
+ // For debugging:
328
+ // span.modification.prefix += '/*R=KEEP*/';
329
+ }
330
+ break;
331
+ case ts.SyntaxKind.TypeLiteral:
332
+ insideTypeLiteral = true;
333
+ break;
334
+ case ts.SyntaxKind.ImportType:
335
+ DtsEmitHelpers.modifyImportTypeSpan(collector, span, astDeclaration, (childSpan, childAstDeclaration) => {
336
+ ApiReportGenerator._modifySpan(childSpan, entity, childAstDeclaration, insideTypeLiteral, context);
337
+ });
338
+ break;
339
+ }
340
+ if (recurseChildren) {
341
+ for (const child of span.children) {
342
+ let childAstDeclaration = astDeclaration;
343
+ if (AstDeclaration.isSupportedSyntaxKind(child.kind)) {
344
+ childAstDeclaration = collector.astSymbolTable.getChildAstDeclarationByNode(child.node, astDeclaration);
345
+ if (ApiReportGenerator._shouldIncludeDeclaration(collector, childAstDeclaration, reportVariant)) {
346
+ if (sortChildren) {
347
+ span.modification.sortChildren = true;
348
+ child.modification.sortKey = Collector.getSortKeyIgnoringUnderscore(childAstDeclaration.astSymbol.localName);
349
+ }
350
+ if (!insideTypeLiteral) {
351
+ const messagesToReport = collector.messageRouter.fetchAssociatedMessagesForReviewFile(childAstDeclaration);
352
+ // NOTE: This generates ae-undocumented messages as a side effect
353
+ const aedocSynopsis = ApiReportGenerator._getAedocSynopsis(collector, childAstDeclaration, messagesToReport);
354
+ child.modification.prefix = aedocSynopsis + child.modification.prefix;
355
+ }
356
+ }
357
+ }
358
+ ApiReportGenerator._modifySpan(child, entity, childAstDeclaration, insideTypeLiteral, context);
359
+ }
360
+ }
361
+ }
362
+ static _shouldIncludeDeclaration(collector, astDeclaration, reportVariant) {
363
+ // Private declarations are not included in the API report
364
+ // eslint-disable-next-line no-bitwise
365
+ if ((astDeclaration.modifierFlags & ts.ModifierFlags.Private) !== 0) {
366
+ return false;
367
+ }
368
+ const apiItemMetadata = collector.fetchApiItemMetadata(astDeclaration);
369
+ return this._shouldIncludeReleaseTag(apiItemMetadata.effectiveReleaseTag, reportVariant);
370
+ }
371
+ static _shouldIncludeReleaseTag(releaseTag, reportVariant) {
372
+ switch (reportVariant) {
373
+ case 'complete':
374
+ return true;
375
+ case 'alpha':
376
+ return (releaseTag === ReleaseTag.Alpha ||
377
+ releaseTag === ReleaseTag.Beta ||
378
+ releaseTag === ReleaseTag.Public ||
379
+ // NOTE: No specified release tag is implicitly treated as `@public`.
380
+ releaseTag === ReleaseTag.None);
381
+ case 'beta':
382
+ return (releaseTag === ReleaseTag.Beta ||
383
+ releaseTag === ReleaseTag.Public ||
384
+ // NOTE: No specified release tag is implicitly treated as `@public`.
385
+ releaseTag === ReleaseTag.None);
386
+ case 'public':
387
+ return (releaseTag === ReleaseTag.Public ||
388
+ // NOTE: No specified release tag is implicitly treated as `@public`.
389
+ releaseTag === ReleaseTag.None);
390
+ default:
391
+ throw new Error(`Unrecognized release level: ${reportVariant}`);
392
+ }
393
+ }
394
+ /**
395
+ * For declarations marked as `@preapproved`, this is used instead of _modifySpan().
396
+ */
397
+ static _modifySpanForPreapproved(span) {
398
+ // Match something like this:
399
+ //
400
+ // ClassDeclaration:
401
+ // SyntaxList:
402
+ // ExportKeyword: pre=[export] sep=[ ]
403
+ // DeclareKeyword: pre=[declare] sep=[ ]
404
+ // ClassKeyword: pre=[class] sep=[ ]
405
+ // Identifier: pre=[_PreapprovedClass] sep=[ ]
406
+ // FirstPunctuation: pre=[{] sep=[\n\n ]
407
+ // SyntaxList:
408
+ // ...
409
+ // CloseBraceToken: pre=[}]
410
+ //
411
+ // or this:
412
+ // ModuleDeclaration:
413
+ // SyntaxList:
414
+ // ExportKeyword: pre=[export] sep=[ ]
415
+ // DeclareKeyword: pre=[declare] sep=[ ]
416
+ // NamespaceKeyword: pre=[namespace] sep=[ ]
417
+ // Identifier: pre=[_PreapprovedNamespace] sep=[ ]
418
+ // ModuleBlock:
419
+ // FirstPunctuation: pre=[{] sep=[\n\n ]
420
+ // SyntaxList:
421
+ // ...
422
+ // CloseBraceToken: pre=[}]
423
+ //
424
+ // And reduce it to something like this:
425
+ //
426
+ // // @internal (undocumented)
427
+ // class _PreapprovedClass { /* (preapproved) */ }
428
+ //
429
+ let skipRest = false;
430
+ for (const child of span.children) {
431
+ if (skipRest || child.kind === ts.SyntaxKind.SyntaxList || child.kind === ts.SyntaxKind.JSDocComment) {
432
+ child.modification.skipAll();
433
+ }
434
+ if (child.kind === ts.SyntaxKind.Identifier) {
435
+ skipRest = true;
436
+ child.modification.omitSeparatorAfter = true;
437
+ child.modification.suffix = ' { /* (preapproved) */ }';
438
+ }
439
+ }
440
+ }
441
+ /**
442
+ * Writes a synopsis of the AEDoc comments, which indicates the release tag,
443
+ * whether the item has been documented, and any warnings that were detected
444
+ * by the analysis.
445
+ */
446
+ static _getAedocSynopsis(collector, astDeclaration, messagesToReport) {
447
+ var _a, _b, _c;
448
+ const writer = new IndentedWriter();
449
+ for (const message of messagesToReport) {
450
+ ApiReportGenerator._writeLineAsComments(writer, 'Warning: ' + message.formatMessageWithoutLocation());
451
+ }
452
+ if (!collector.isAncillaryDeclaration(astDeclaration)) {
453
+ const footerParts = [];
454
+ const apiItemMetadata = collector.fetchApiItemMetadata(astDeclaration);
455
+ // 1. Release tag (if present)
456
+ if (!apiItemMetadata.releaseTagSameAsParent) {
457
+ if (apiItemMetadata.effectiveReleaseTag !== ReleaseTag.None) {
458
+ footerParts.push(ReleaseTag.getTagName(apiItemMetadata.effectiveReleaseTag));
459
+ }
460
+ }
461
+ // 2. Enumerate configured tags, reporting standard system tags first and then other configured tags.
462
+ // Note that the ordering we handle the standard tags is important for backwards compatibility.
463
+ // Also note that we had special mechanisms for checking whether or not an item is documented with these tags,
464
+ // so they are checked specially.
465
+ const { '@sealed': reportSealedTag, '@virtual': reportVirtualTag, '@override': reportOverrideTag, '@eventProperty': reportEventPropertyTag, '@deprecated': reportDeprecatedTag, ...otherTagsToReport } = collector.extractorConfig.tagsToReport;
466
+ // 2.a Check for standard tags and report those that are both configured and present in the metadata.
467
+ if (reportSealedTag && apiItemMetadata.isSealed) {
468
+ footerParts.push('@sealed');
469
+ }
470
+ if (reportVirtualTag && apiItemMetadata.isVirtual) {
471
+ footerParts.push('@virtual');
472
+ }
473
+ if (reportOverrideTag && apiItemMetadata.isOverride) {
474
+ footerParts.push('@override');
475
+ }
476
+ if (reportEventPropertyTag && apiItemMetadata.isEventProperty) {
477
+ footerParts.push('@eventProperty');
478
+ }
479
+ if (reportDeprecatedTag && ((_a = apiItemMetadata.tsdocComment) === null || _a === void 0 ? void 0 : _a.deprecatedBlock)) {
480
+ footerParts.push('@deprecated');
481
+ }
482
+ // 2.b Check for other configured tags and report those that are present in the tsdoc metadata.
483
+ for (const [tag, reportTag] of Object.entries(otherTagsToReport)) {
484
+ if (reportTag) {
485
+ // If the tag was not handled specially, check if it is present in the metadata.
486
+ if ((_b = apiItemMetadata.tsdocComment) === null || _b === void 0 ? void 0 : _b.customBlocks.some((block) => block.blockTag.tagName === tag)) {
487
+ footerParts.push(tag);
488
+ }
489
+ else if ((_c = apiItemMetadata.tsdocComment) === null || _c === void 0 ? void 0 : _c.modifierTagSet.hasTagName(tag)) {
490
+ footerParts.push(tag);
491
+ }
492
+ }
493
+ }
494
+ // 3. If the item is undocumented, append notice at the end of the list
495
+ if (apiItemMetadata.undocumented) {
496
+ footerParts.push('(undocumented)');
497
+ collector.messageRouter.addAnalyzerIssue(ExtractorMessageId.Undocumented, `Missing documentation for "${astDeclaration.astSymbol.localName}".`, astDeclaration);
498
+ }
499
+ if (footerParts.length > 0) {
500
+ if (messagesToReport.length > 0) {
501
+ ApiReportGenerator._writeLineAsComments(writer, ''); // skip a line after the warnings
502
+ }
503
+ ApiReportGenerator._writeLineAsComments(writer, footerParts.join(' '));
504
+ }
505
+ }
506
+ return writer.toString();
507
+ }
508
+ static _writeLineAsComments(writer, line) {
509
+ const lines = Text.convertToLf(line).split('\n');
510
+ for (const realLine of lines) {
511
+ writer.write('// ');
512
+ writer.write(realLine);
513
+ writer.writeLine();
514
+ }
515
+ }
516
+ }
517
+ ApiReportGenerator._trimSpacesRegExp = / +$/gm;
518
+ //# sourceMappingURL=ApiReportGenerator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApiReportGenerator.js","sourceRoot":"","sources":["../../src/generators/ApiReportGenerator.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,S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AiC;gBACxF,CAAC;gBAED,kBAAkB,CAAC,oBAAoB,CAAC,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YACzE,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;IAEO,MAAM,CAAC,oBAAoB,CAAC,MAAsB,EAAE,IAAY;QACtE,MAAM,KAAK,GAAa,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC3D,KAAK,MAAM,QAAQ,IAAI,KAAK,EAAE,CAAC;YAC7B,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YACvB,MAAM,CAAC,SAAS,EAAE,CAAC;QACrB,CAAC;IACH,CAAC;;AA5oBc,oCAAiB,GAAW,OAAO,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as ts from 'typescript';\n\nimport { ReleaseTag } from '@microsoft/api-extractor-model';\nimport { Text, InternalError } from '@rushstack/node-core-library';\n\nimport { Collector } from '../collector/Collector';\nimport { TypeScriptHelpers } from '../analyzer/TypeScriptHelpers';\nimport { Span } from '../analyzer/Span';\nimport type { CollectorEntity } from '../collector/CollectorEntity';\nimport { AstDeclaration } from '../analyzer/AstDeclaration';\nimport type { ApiItemMetadata } from '../collector/ApiItemMetadata';\nimport { AstImport } from '../analyzer/AstImport';\nimport { AstSymbol } from '../analyzer/AstSymbol';\nimport type { ExtractorMessage } from '../api/ExtractorMessage';\nimport { IndentedWriter } from './IndentedWriter';\nimport { DtsEmitHelpers } from './DtsEmitHelpers';\nimport { AstNamespaceImport } from '../analyzer/AstNamespaceImport';\nimport type { AstEntity } from '../analyzer/AstEntity';\nimport type { IAstModuleExportInfo } from '../analyzer/AstModule';\nimport { SourceFileLocationFormatter } from '../analyzer/SourceFileLocationFormatter';\nimport { ExtractorMessageId } from '../api/ExtractorMessageId';\nimport type { ApiReportVariant } from '../api/IConfigFile';\nimport type { SymbolMetadata } from '../collector/SymbolMetadata';\n\ninterface IContext {\n collector: Collector;\n reportVariant: ApiReportVariant;\n alreadyProcessedSignatures: Set<Span>;\n}\n\nexport class ApiReportGenerator {\n private static _trimSpacesRegExp: RegExp = / +$/gm;\n\n /**\n * Compares the contents of two API files that were created using ApiFileGenerator,\n * and returns true if they are equivalent. Note that these files are not normally edited\n * by a human; the \"equivalence\" comparison here is intended to ignore spurious changes that\n * might be introduced by a tool, e.g. Git newline normalization or an editor that strips\n * whitespace when saving.\n */\n public static areEquivalentApiFileContents(\n actualFileContent: string,\n expectedFileContent: string\n ): boolean {\n // NOTE: \"\\s\" also matches \"\\r\" and \"\\n\"\n const normalizedActual: string = actualFileContent.replace(/[\\s]+/g, ' ');\n const normalizedExpected: string = expectedFileContent.replace(/[\\s]+/g, ' ');\n return normalizedActual === normalizedExpected;\n }\n\n /**\n * Generates and returns the API report contents as a string.\n *\n * @param reportVariant - The release level with which the report is associated.\n * Can also be viewed as the minimal release level of items that should be included in the report.\n */\n public static generateReviewFileContent(collector: Collector, reportVariant: ApiReportVariant): string {\n const writer: IndentedWriter = new IndentedWriter();\n writer.trimLeadingSpaces = true;\n\n function capitalizeFirstLetter(input: string): string {\n return input === '' ? '' : `${input[0].toLocaleUpperCase()}${input.slice(1)}`;\n }\n\n // For backwards compatibility, don't emit \"complete\" in report text for untrimmed reports.\n const releaseLevelPrefix: string =\n reportVariant === 'complete' ? '' : `${capitalizeFirstLetter(reportVariant)} `;\n writer.writeLine(\n [\n `## ${releaseLevelPrefix}API Report File for \"${collector.workingPackage.name}\"`,\n ``,\n `> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).`,\n ``\n ].join('\\n')\n );\n\n // Write the opening delimiter for the Markdown code fence\n writer.writeLine('```ts\\n');\n\n // Emit the triple slash directives\n for (const typeDirectiveReference of Array.from(collector.dtsTypeReferenceDirectives).sort()) {\n // https://github.com/microsoft/TypeScript/blob/611ebc7aadd7a44a4c0447698bfda9222a78cb66/src/compiler/declarationEmitter.ts#L162\n writer.writeLine(`/// <reference types=\"${typeDirectiveReference}\" />`);\n }\n for (const libDirectiveReference of Array.from(collector.dtsLibReferenceDirectives).sort()) {\n writer.writeLine(`/// <reference lib=\"${libDirectiveReference}\" />`);\n }\n writer.ensureSkippedLine();\n\n // Emit the imports\n for (const entity of collector.entities) {\n if (entity.astEntity instanceof AstImport) {\n DtsEmitHelpers.emitImport(writer, entity, entity.astEntity);\n }\n }\n writer.ensureSkippedLine();\n\n const context: IContext = {\n collector,\n reportVariant,\n alreadyProcessedSignatures: new Set()\n };\n\n // Emit the regular declarations\n for (const entity of collector.entities) {\n const astEntity: AstEntity = entity.astEntity;\n const symbolMetadata: SymbolMetadata | undefined = collector.tryFetchMetadataForAstEntity(astEntity);\n const maxEffectiveReleaseTag: ReleaseTag = symbolMetadata?.maxEffectiveReleaseTag ?? ReleaseTag.None;\n\n if (!this._shouldIncludeReleaseTag(maxEffectiveReleaseTag, reportVariant)) {\n continue;\n }\n\n if (entity.consumable || collector.extractorConfig.apiReportIncludeForgottenExports) {\n // First, collect the list of export names for this symbol. When reporting messages with\n // ExtractorMessage.properties.exportName, this will enable us to emit the warning comments alongside\n // the associated export statement.\n interface IExportToEmit {\n readonly exportName: string;\n readonly associatedMessages: ExtractorMessage[];\n }\n const exportsToEmit: Map<string, IExportToEmit> = new Map<string, IExportToEmit>();\n\n for (const exportName of entity.exportNames) {\n if (!entity.shouldInlineExport) {\n exportsToEmit.set(exportName, { exportName, associatedMessages: [] });\n }\n }\n\n if (astEntity instanceof AstSymbol) {\n // Emit all the declarations for this entity\n for (const astDeclaration of astEntity.astDeclarations || []) {\n // Get the messages associated with this declaration\n const fetchedMessages: ExtractorMessage[] =\n collector.messageRouter.fetchAssociatedMessagesForReviewFile(astDeclaration);\n\n // Peel off the messages associated with an export statement and store them\n // in IExportToEmit.associatedMessages (to be processed later). The remaining messages will\n // added to messagesToReport, to be emitted next to the declaration instead of the export statement.\n const messagesToReport: ExtractorMessage[] = [];\n for (const message of fetchedMessages) {\n if (message.properties.exportName) {\n const exportToEmit: IExportToEmit | undefined = exportsToEmit.get(\n message.properties.exportName\n );\n if (exportToEmit) {\n exportToEmit.associatedMessages.push(message);\n continue;\n }\n }\n messagesToReport.push(message);\n }\n\n if (this._shouldIncludeDeclaration(collector, astDeclaration, reportVariant)) {\n writer.ensureSkippedLine();\n writer.write(ApiReportGenerator._getAedocSynopsis(collector, astDeclaration, messagesToReport));\n\n const span: Span = new Span(astDeclaration.declaration);\n\n const apiItemMetadata: ApiItemMetadata = collector.fetchApiItemMetadata(astDeclaration);\n if (apiItemMetadata.isPreapproved) {\n ApiReportGenerator._modifySpanForPreapproved(span);\n } else {\n ApiReportGenerator._modifySpan(span, entity, astDeclaration, false, context);\n }\n\n span.writeModifiedText(writer);\n writer.ensureNewLine();\n }\n }\n }\n\n if (astEntity instanceof AstNamespaceImport) {\n const astModuleExportInfo: IAstModuleExportInfo = astEntity.fetchAstModuleExportInfo(collector);\n\n if (entity.nameForEmit === undefined) {\n // This should never happen\n throw new InternalError('referencedEntry.nameForEmit is undefined');\n }\n\n if (astModuleExportInfo.starExportedExternalModules.size > 0) {\n // We could support this, but we would need to find a way to safely represent it.\n throw new Error(\n `The ${entity.nameForEmit} namespace import includes a star export, which is not supported:\\n` +\n SourceFileLocationFormatter.formatDeclaration(astEntity.declaration)\n );\n }\n\n // Emit a synthetic declaration for the namespace. It will look like this:\n //\n // declare namespace example {\n // export {\n // f1,\n // f2\n // }\n // }\n //\n // Note that we do not try to relocate f1()/f2() to be inside the namespace because other type\n // signatures may reference them directly (without using the namespace qualifier).\n\n writer.ensureSkippedLine();\n writer.writeLine(`declare namespace ${entity.nameForEmit} {`);\n\n // all local exports of local imported module are just references to top-level declarations\n writer.increaseIndent();\n writer.writeLine('export {');\n writer.increaseIndent();\n\n const exportClauses: string[] = [];\n for (const [exportedName, exportedEntity] of astModuleExportInfo.exportedLocalEntities) {\n const collectorEntity: CollectorEntity | undefined =\n collector.tryGetCollectorEntity(exportedEntity);\n if (collectorEntity === undefined) {\n // This should never happen\n // top-level exports of local imported module should be added as collector entities before\n throw new InternalError(\n `Cannot find collector entity for ${entity.nameForEmit}.${exportedEntity.localName}`\n );\n }\n\n if (collectorEntity.nameForEmit === exportedName) {\n exportClauses.push(collectorEntity.nameForEmit);\n } else {\n exportClauses.push(`${collectorEntity.nameForEmit} as ${exportedName}`);\n }\n }\n writer.writeLine(exportClauses.join(',\\n'));\n\n writer.decreaseIndent();\n writer.writeLine('}'); // end of \"export { ... }\"\n writer.decreaseIndent();\n writer.writeLine('}'); // end of \"declare namespace { ... }\"\n }\n\n // Now emit the export statements for this entity.\n for (const exportToEmit of exportsToEmit.values()) {\n // Write any associated messages\n if (exportToEmit.associatedMessages.length > 0) {\n writer.ensureSkippedLine();\n for (const message of exportToEmit.associatedMessages) {\n ApiReportGenerator._writeLineAsComments(\n writer,\n 'Warning: ' + message.formatMessageWithoutLocation()\n );\n }\n }\n\n DtsEmitHelpers.emitNamedExport(writer, exportToEmit.exportName, entity);\n }\n writer.ensureSkippedLine();\n }\n }\n\n DtsEmitHelpers.emitStarExports(writer, collector);\n\n // Write the unassociated warnings at the bottom of the file\n const unassociatedMessages: ExtractorMessage[] =\n collector.messageRouter.fetchUnassociatedMessagesForReviewFile();\n if (unassociatedMessages.length > 0) {\n writer.ensureSkippedLine();\n ApiReportGenerator._writeLineAsComments(writer, 'Warnings were encountered during analysis:');\n ApiReportGenerator._writeLineAsComments(writer, '');\n for (const unassociatedMessage of unassociatedMessages) {\n ApiReportGenerator._writeLineAsComments(\n writer,\n unassociatedMessage.formatMessageWithLocation(collector.workingPackage.packageFolder)\n );\n }\n }\n\n if (collector.workingPackage.tsdocComment === undefined) {\n writer.ensureSkippedLine();\n ApiReportGenerator._writeLineAsComments(writer, '(No @packageDocumentation comment for this package)');\n }\n\n // Write the closing delimiter for the Markdown code fence\n writer.ensureSkippedLine();\n writer.writeLine('```');\n\n // Remove any trailing spaces\n return writer.toString().replace(ApiReportGenerator._trimSpacesRegExp, '');\n }\n\n /**\n * Before writing out a declaration, _modifySpan() applies various fixups to make it nice.\n */\n private static _modifySpan(\n span: Span,\n entity: CollectorEntity,\n astDeclaration: AstDeclaration,\n insideTypeLiteral: boolean,\n context: IContext\n ): void {\n const { collector, reportVariant } = context;\n\n // Should we process this declaration at all?\n if (!ApiReportGenerator._shouldIncludeDeclaration(collector, astDeclaration, reportVariant)) {\n span.modification.skipAll();\n return;\n }\n\n const previousSpan: Span | undefined = span.previousSibling;\n\n let recurseChildren: boolean = true;\n let sortChildren: boolean = false;\n\n switch (span.kind) {\n case ts.SyntaxKind.JSDocComment:\n span.modification.skipAll();\n // For now, we don't transform JSDoc comment nodes at all\n recurseChildren = false;\n break;\n\n case ts.SyntaxKind.ExportKeyword:\n if (DtsEmitHelpers.isExportKeywordInNamespaceExportDeclaration(span.node)) {\n // This is an export declaration inside a namespace - preserve the export keyword\n break;\n }\n // Otherwise, delete the export keyword -- we will re-add it below\n span.modification.skipAll();\n break;\n\n case ts.SyntaxKind.DefaultKeyword:\n case ts.SyntaxKind.DeclareKeyword:\n // Delete any explicit \"export\" or \"declare\" keywords -- we will re-add them below\n span.modification.skipAll();\n break;\n\n case ts.SyntaxKind.InterfaceKeyword:\n case ts.SyntaxKind.ClassKeyword:\n case ts.SyntaxKind.EnumKeyword:\n case ts.SyntaxKind.NamespaceKeyword:\n case ts.SyntaxKind.ModuleKeyword:\n case ts.SyntaxKind.TypeKeyword:\n case ts.SyntaxKind.FunctionKeyword:\n // Replace the stuff we possibly deleted above\n let replacedModifiers: string = '';\n\n if (entity.shouldInlineExport) {\n replacedModifiers = 'export ' + replacedModifiers;\n }\n\n if (previousSpan && previousSpan.kind === ts.SyntaxKind.SyntaxList) {\n // If there is a previous span of type SyntaxList, then apply it before any other modifiers\n // (e.g. \"abstract\") that appear there.\n previousSpan.modification.prefix = replacedModifiers + previousSpan.modification.prefix;\n } else {\n // Otherwise just stick it in front of this span\n span.modification.prefix = replacedModifiers + span.modification.prefix;\n }\n break;\n\n case ts.SyntaxKind.SyntaxList:\n if (span.parent) {\n if (AstDeclaration.isSupportedSyntaxKind(span.parent.kind)) {\n // If the immediate parent is an API declaration, and the immediate children are API declarations,\n // then sort the children alphabetically\n sortChildren = true;\n } else if (span.parent.kind === ts.SyntaxKind.ModuleBlock) {\n // Namespaces are special because their chain goes ModuleDeclaration -> ModuleBlock -> SyntaxList\n sortChildren = true;\n }\n }\n break;\n\n case ts.SyntaxKind.VariableDeclaration:\n if (!span.parent) {\n // The VariableDeclaration node is part of a VariableDeclarationList, however\n // the Entry.followedSymbol points to the VariableDeclaration part because\n // multiple definitions might share the same VariableDeclarationList.\n //\n // Since we are emitting a separate declaration for each one, we need to look upwards\n // in the ts.Node tree and write a copy of the enclosing VariableDeclarationList\n // content (e.g. \"var\" from \"var x=1, y=2\").\n const list: ts.VariableDeclarationList | undefined = TypeScriptHelpers.matchAncestor(span.node, [\n ts.SyntaxKind.VariableDeclarationList,\n ts.SyntaxKind.VariableDeclaration\n ]);\n if (!list) {\n // This should not happen unless the compiler API changes somehow\n throw new InternalError('Unsupported variable declaration');\n }\n const listPrefix: string = list\n .getSourceFile()\n .text.substring(list.getStart(), list.declarations[0].getStart());\n span.modification.prefix = listPrefix + span.modification.prefix;\n span.modification.suffix = ';';\n\n if (entity.shouldInlineExport) {\n span.modification.prefix = 'export ' + span.modification.prefix;\n }\n }\n break;\n\n case ts.SyntaxKind.Parameter:\n {\n // (signature) -> SyntaxList -> Parameter\n const signatureParent: Span | undefined = span.parent;\n if (signatureParent) {\n if (!context.alreadyProcessedSignatures.has(signatureParent)) {\n context.alreadyProcessedSignatures.add(signatureParent);\n DtsEmitHelpers.normalizeParameterNames(signatureParent);\n }\n }\n }\n break;\n\n case ts.SyntaxKind.Identifier:\n const referencedEntity: CollectorEntity | undefined = collector.tryGetEntityForNode(\n span.node as ts.Identifier\n );\n\n if (referencedEntity) {\n if (!referencedEntity.nameForEmit) {\n // This should never happen\n throw new InternalError('referencedEntry.nameForEmit is undefined');\n }\n\n span.modification.prefix = referencedEntity.nameForEmit;\n // For debugging:\n // span.modification.prefix += '/*R=FIX*/';\n } else {\n // For debugging:\n // span.modification.prefix += '/*R=KEEP*/';\n }\n\n break;\n\n case ts.SyntaxKind.TypeLiteral:\n insideTypeLiteral = true;\n break;\n\n case ts.SyntaxKind.ImportType:\n DtsEmitHelpers.modifyImportTypeSpan(\n collector,\n span,\n astDeclaration,\n (childSpan, childAstDeclaration) => {\n ApiReportGenerator._modifySpan(\n childSpan,\n entity,\n childAstDeclaration,\n insideTypeLiteral,\n context\n );\n }\n );\n break;\n }\n\n if (recurseChildren) {\n for (const child of span.children) {\n let childAstDeclaration: AstDeclaration = astDeclaration;\n\n if (AstDeclaration.isSupportedSyntaxKind(child.kind)) {\n childAstDeclaration = collector.astSymbolTable.getChildAstDeclarationByNode(\n child.node,\n astDeclaration\n );\n\n if (ApiReportGenerator._shouldIncludeDeclaration(collector, childAstDeclaration, reportVariant)) {\n if (sortChildren) {\n span.modification.sortChildren = true;\n child.modification.sortKey = Collector.getSortKeyIgnoringUnderscore(\n childAstDeclaration.astSymbol.localName\n );\n }\n\n if (!insideTypeLiteral) {\n const messagesToReport: ExtractorMessage[] =\n collector.messageRouter.fetchAssociatedMessagesForReviewFile(childAstDeclaration);\n\n // NOTE: This generates ae-undocumented messages as a side effect\n const aedocSynopsis: string = ApiReportGenerator._getAedocSynopsis(\n collector,\n childAstDeclaration,\n messagesToReport\n );\n\n child.modification.prefix = aedocSynopsis + child.modification.prefix;\n }\n }\n }\n\n ApiReportGenerator._modifySpan(child, entity, childAstDeclaration, insideTypeLiteral, context);\n }\n }\n }\n\n private static _shouldIncludeDeclaration(\n collector: Collector,\n astDeclaration: AstDeclaration,\n reportVariant: ApiReportVariant\n ): boolean {\n // Private declarations are not included in the API report\n // eslint-disable-next-line no-bitwise\n if ((astDeclaration.modifierFlags & ts.ModifierFlags.Private) !== 0) {\n return false;\n }\n\n const apiItemMetadata: ApiItemMetadata = collector.fetchApiItemMetadata(astDeclaration);\n\n return this._shouldIncludeReleaseTag(apiItemMetadata.effectiveReleaseTag, reportVariant);\n }\n\n private static _shouldIncludeReleaseTag(releaseTag: ReleaseTag, reportVariant: ApiReportVariant): boolean {\n switch (reportVariant) {\n case 'complete':\n return true;\n case 'alpha':\n return (\n releaseTag === ReleaseTag.Alpha ||\n releaseTag === ReleaseTag.Beta ||\n releaseTag === ReleaseTag.Public ||\n // NOTE: No specified release tag is implicitly treated as `@public`.\n releaseTag === ReleaseTag.None\n );\n case 'beta':\n return (\n releaseTag === ReleaseTag.Beta ||\n releaseTag === ReleaseTag.Public ||\n // NOTE: No specified release tag is implicitly treated as `@public`.\n releaseTag === ReleaseTag.None\n );\n case 'public':\n return (\n releaseTag === ReleaseTag.Public ||\n // NOTE: No specified release tag is implicitly treated as `@public`.\n releaseTag === ReleaseTag.None\n );\n default:\n throw new Error(`Unrecognized release level: ${reportVariant}`);\n }\n }\n\n /**\n * For declarations marked as `@preapproved`, this is used instead of _modifySpan().\n */\n private static _modifySpanForPreapproved(span: Span): void {\n // Match something like this:\n //\n // ClassDeclaration:\n // SyntaxList:\n // ExportKeyword: pre=[export] sep=[ ]\n // DeclareKeyword: pre=[declare] sep=[ ]\n // ClassKeyword: pre=[class] sep=[ ]\n // Identifier: pre=[_PreapprovedClass] sep=[ ]\n // FirstPunctuation: pre=[{] sep=[\\n\\n ]\n // SyntaxList:\n // ...\n // CloseBraceToken: pre=[}]\n //\n // or this:\n // ModuleDeclaration:\n // SyntaxList:\n // ExportKeyword: pre=[export] sep=[ ]\n // DeclareKeyword: pre=[declare] sep=[ ]\n // NamespaceKeyword: pre=[namespace] sep=[ ]\n // Identifier: pre=[_PreapprovedNamespace] sep=[ ]\n // ModuleBlock:\n // FirstPunctuation: pre=[{] sep=[\\n\\n ]\n // SyntaxList:\n // ...\n // CloseBraceToken: pre=[}]\n //\n // And reduce it to something like this:\n //\n // // @internal (undocumented)\n // class _PreapprovedClass { /* (preapproved) */ }\n //\n\n let skipRest: boolean = false;\n for (const child of span.children) {\n if (skipRest || child.kind === ts.SyntaxKind.SyntaxList || child.kind === ts.SyntaxKind.JSDocComment) {\n child.modification.skipAll();\n }\n if (child.kind === ts.SyntaxKind.Identifier) {\n skipRest = true;\n child.modification.omitSeparatorAfter = true;\n child.modification.suffix = ' { /* (preapproved) */ }';\n }\n }\n }\n\n /**\n * Writes a synopsis of the AEDoc comments, which indicates the release tag,\n * whether the item has been documented, and any warnings that were detected\n * by the analysis.\n */\n private static _getAedocSynopsis(\n collector: Collector,\n astDeclaration: AstDeclaration,\n messagesToReport: ExtractorMessage[]\n ): string {\n const writer: IndentedWriter = new IndentedWriter();\n\n for (const message of messagesToReport) {\n ApiReportGenerator._writeLineAsComments(writer, 'Warning: ' + message.formatMessageWithoutLocation());\n }\n\n if (!collector.isAncillaryDeclaration(astDeclaration)) {\n const footerParts: string[] = [];\n const apiItemMetadata: ApiItemMetadata = collector.fetchApiItemMetadata(astDeclaration);\n\n // 1. Release tag (if present)\n if (!apiItemMetadata.releaseTagSameAsParent) {\n if (apiItemMetadata.effectiveReleaseTag !== ReleaseTag.None) {\n footerParts.push(ReleaseTag.getTagName(apiItemMetadata.effectiveReleaseTag));\n }\n }\n\n // 2. Enumerate configured tags, reporting standard system tags first and then other configured tags.\n // Note that the ordering we handle the standard tags is important for backwards compatibility.\n // Also note that we had special mechanisms for checking whether or not an item is documented with these tags,\n // so they are checked specially.\n const {\n '@sealed': reportSealedTag,\n '@virtual': reportVirtualTag,\n '@override': reportOverrideTag,\n '@eventProperty': reportEventPropertyTag,\n '@deprecated': reportDeprecatedTag,\n ...otherTagsToReport\n } = collector.extractorConfig.tagsToReport;\n\n // 2.a Check for standard tags and report those that are both configured and present in the metadata.\n if (reportSealedTag && apiItemMetadata.isSealed) {\n footerParts.push('@sealed');\n }\n if (reportVirtualTag && apiItemMetadata.isVirtual) {\n footerParts.push('@virtual');\n }\n if (reportOverrideTag && apiItemMetadata.isOverride) {\n footerParts.push('@override');\n }\n if (reportEventPropertyTag && apiItemMetadata.isEventProperty) {\n footerParts.push('@eventProperty');\n }\n if (reportDeprecatedTag && apiItemMetadata.tsdocComment?.deprecatedBlock) {\n footerParts.push('@deprecated');\n }\n\n // 2.b Check for other configured tags and report those that are present in the tsdoc metadata.\n for (const [tag, reportTag] of Object.entries(otherTagsToReport)) {\n if (reportTag) {\n // If the tag was not handled specially, check if it is present in the metadata.\n if (apiItemMetadata.tsdocComment?.customBlocks.some((block) => block.blockTag.tagName === tag)) {\n footerParts.push(tag);\n } else if (apiItemMetadata.tsdocComment?.modifierTagSet.hasTagName(tag)) {\n footerParts.push(tag);\n }\n }\n }\n\n // 3. If the item is undocumented, append notice at the end of the list\n if (apiItemMetadata.undocumented) {\n footerParts.push('(undocumented)');\n\n collector.messageRouter.addAnalyzerIssue(\n ExtractorMessageId.Undocumented,\n `Missing documentation for \"${astDeclaration.astSymbol.localName}\".`,\n astDeclaration\n );\n }\n\n if (footerParts.length > 0) {\n if (messagesToReport.length > 0) {\n ApiReportGenerator._writeLineAsComments(writer, ''); // skip a line after the warnings\n }\n\n ApiReportGenerator._writeLineAsComments(writer, footerParts.join(' '));\n }\n }\n\n return writer.toString();\n }\n\n private static _writeLineAsComments(writer: IndentedWriter, line: string): void {\n const lines: string[] = Text.convertToLf(line).split('\\n');\n for (const realLine of lines) {\n writer.write('// ');\n writer.write(realLine);\n writer.writeLine();\n }\n }\n}\n"]}