@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,391 @@
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 { FileSystem, InternalError } from '@rushstack/node-core-library';
6
+ import { TypeScriptHelpers } from '../analyzer/TypeScriptHelpers';
7
+ import { IndentDocCommentScope, Span } from '../analyzer/Span';
8
+ import { AstImport } from '../analyzer/AstImport';
9
+ import { AstDeclaration } from '../analyzer/AstDeclaration';
10
+ import { AstSymbol } from '../analyzer/AstSymbol';
11
+ import { IndentedWriter } from './IndentedWriter';
12
+ import { DtsEmitHelpers } from './DtsEmitHelpers';
13
+ import { AstNamespaceImport } from '../analyzer/AstNamespaceImport';
14
+ import { SourceFileLocationFormatter } from '../analyzer/SourceFileLocationFormatter';
15
+ /**
16
+ * Used with DtsRollupGenerator.writeTypingsFile()
17
+ */
18
+ export var DtsRollupKind;
19
+ (function (DtsRollupKind) {
20
+ /**
21
+ * Generate a *.d.ts file for an internal release, or for the trimming=false mode.
22
+ * This output file will contain all definitions that are reachable from the entry point.
23
+ */
24
+ DtsRollupKind[DtsRollupKind["InternalRelease"] = 0] = "InternalRelease";
25
+ /**
26
+ * Generate a *.d.ts file for a preview release.
27
+ * This output file will contain all definitions that are reachable from the entry point,
28
+ * except definitions marked as \@internal.
29
+ */
30
+ DtsRollupKind[DtsRollupKind["AlphaRelease"] = 1] = "AlphaRelease";
31
+ /**
32
+ * Generate a *.d.ts file for a preview release.
33
+ * This output file will contain all definitions that are reachable from the entry point,
34
+ * except definitions marked as \@alpha or \@internal.
35
+ */
36
+ DtsRollupKind[DtsRollupKind["BetaRelease"] = 2] = "BetaRelease";
37
+ /**
38
+ * Generate a *.d.ts file for a public release.
39
+ * This output file will contain all definitions that are reachable from the entry point,
40
+ * except definitions marked as \@beta, \@alpha, or \@internal.
41
+ */
42
+ DtsRollupKind[DtsRollupKind["PublicRelease"] = 3] = "PublicRelease";
43
+ })(DtsRollupKind || (DtsRollupKind = {}));
44
+ export class DtsRollupGenerator {
45
+ /**
46
+ * Generates the typings file and writes it to disk.
47
+ *
48
+ * @param dtsFilename - The *.d.ts output filename
49
+ */
50
+ static writeTypingsFile(collector, dtsFilename, dtsKind, newlineKind) {
51
+ const writer = new IndentedWriter();
52
+ writer.trimLeadingSpaces = true;
53
+ DtsRollupGenerator._generateTypingsFileContent(collector, writer, dtsKind);
54
+ FileSystem.writeFile(dtsFilename, writer.toString(), {
55
+ convertLineEndings: newlineKind,
56
+ ensureFolderExists: true
57
+ });
58
+ }
59
+ static _generateTypingsFileContent(collector, writer, dtsKind) {
60
+ // Emit the @packageDocumentation comment at the top of the file
61
+ if (collector.workingPackage.tsdocParserContext) {
62
+ writer.trimLeadingSpaces = false;
63
+ writer.writeLine(collector.workingPackage.tsdocParserContext.sourceRange.toString());
64
+ writer.trimLeadingSpaces = true;
65
+ writer.ensureSkippedLine();
66
+ }
67
+ // Emit the triple slash directives
68
+ for (const typeDirectiveReference of collector.dtsTypeReferenceDirectives) {
69
+ // https://github.com/microsoft/TypeScript/blob/611ebc7aadd7a44a4c0447698bfda9222a78cb66/src/compiler/declarationEmitter.ts#L162
70
+ writer.writeLine(`/// <reference types="${typeDirectiveReference}" />`);
71
+ }
72
+ for (const libDirectiveReference of collector.dtsLibReferenceDirectives) {
73
+ writer.writeLine(`/// <reference lib="${libDirectiveReference}" />`);
74
+ }
75
+ writer.ensureSkippedLine();
76
+ // Emit the imports
77
+ for (const entity of collector.entities) {
78
+ if (entity.astEntity instanceof AstImport) {
79
+ // Note: it isn't valid to trim imports based on their release tags.
80
+ // E.g. class Foo (`@public`) extends interface Bar (`@beta`) from some external library.
81
+ // API-Extractor cannot trim `import { Bar } from "external-library"` when generating its public rollup,
82
+ // or the export of `Foo` would include a broken reference to `Bar`.
83
+ const astImport = entity.astEntity;
84
+ DtsEmitHelpers.emitImport(writer, entity, astImport);
85
+ }
86
+ }
87
+ writer.ensureSkippedLine();
88
+ // Emit the regular declarations
89
+ for (const entity of collector.entities) {
90
+ const astEntity = entity.astEntity;
91
+ const symbolMetadata = collector.tryFetchMetadataForAstEntity(astEntity);
92
+ const maxEffectiveReleaseTag = symbolMetadata
93
+ ? symbolMetadata.maxEffectiveReleaseTag
94
+ : ReleaseTag.None;
95
+ if (!this._shouldIncludeReleaseTag(maxEffectiveReleaseTag, dtsKind)) {
96
+ if (!collector.extractorConfig.omitTrimmingComments) {
97
+ writer.ensureSkippedLine();
98
+ writer.writeLine(`/* Excluded from this release type: ${entity.nameForEmit} */`);
99
+ }
100
+ continue;
101
+ }
102
+ if (astEntity instanceof AstSymbol) {
103
+ // Emit all the declarations for this entry
104
+ for (const astDeclaration of astEntity.astDeclarations || []) {
105
+ const apiItemMetadata = collector.fetchApiItemMetadata(astDeclaration);
106
+ if (!this._shouldIncludeReleaseTag(apiItemMetadata.effectiveReleaseTag, dtsKind)) {
107
+ if (!collector.extractorConfig.omitTrimmingComments) {
108
+ writer.ensureSkippedLine();
109
+ writer.writeLine(`/* Excluded declaration from this release type: ${entity.nameForEmit} */`);
110
+ }
111
+ continue;
112
+ }
113
+ else {
114
+ const span = new Span(astDeclaration.declaration);
115
+ DtsRollupGenerator._modifySpan(collector, span, entity, astDeclaration, dtsKind);
116
+ writer.ensureSkippedLine();
117
+ span.writeModifiedText(writer);
118
+ writer.ensureNewLine();
119
+ }
120
+ }
121
+ }
122
+ if (astEntity instanceof AstNamespaceImport) {
123
+ const astModuleExportInfo = astEntity.fetchAstModuleExportInfo(collector);
124
+ if (entity.nameForEmit === undefined) {
125
+ // This should never happen
126
+ throw new InternalError('referencedEntry.nameForEmit is undefined');
127
+ }
128
+ if (astModuleExportInfo.starExportedExternalModules.size > 0) {
129
+ // We could support this, but we would need to find a way to safely represent it.
130
+ throw new Error(`The ${entity.nameForEmit} namespace import includes a start export, which is not supported:\n` +
131
+ SourceFileLocationFormatter.formatDeclaration(astEntity.declaration));
132
+ }
133
+ // Emit a synthetic declaration for the namespace. It will look like this:
134
+ //
135
+ // declare namespace example {
136
+ // export {
137
+ // f1,
138
+ // f2
139
+ // }
140
+ // }
141
+ //
142
+ // Note that we do not try to relocate f1()/f2() to be inside the namespace because other type
143
+ // signatures may reference them directly (without using the namespace qualifier).
144
+ writer.ensureSkippedLine();
145
+ if (entity.shouldInlineExport) {
146
+ writer.write('export ');
147
+ }
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 the entity's declaration won't be included, then neither should the namespace export it
162
+ // This fixes the issue encountered here: https://github.com/microsoft/rushstack/issues/2791
163
+ const exportedSymbolMetadata = collector.tryFetchMetadataForAstEntity(exportedEntity);
164
+ const exportedMaxEffectiveReleaseTag = exportedSymbolMetadata
165
+ ? exportedSymbolMetadata.maxEffectiveReleaseTag
166
+ : ReleaseTag.None;
167
+ if (!this._shouldIncludeReleaseTag(exportedMaxEffectiveReleaseTag, dtsKind)) {
168
+ continue;
169
+ }
170
+ if (collectorEntity.nameForEmit === exportedName) {
171
+ exportClauses.push(collectorEntity.nameForEmit);
172
+ }
173
+ else {
174
+ exportClauses.push(`${collectorEntity.nameForEmit} as ${exportedName}`);
175
+ }
176
+ }
177
+ writer.writeLine(exportClauses.join(',\n'));
178
+ writer.decreaseIndent();
179
+ writer.writeLine('}'); // end of "export { ... }"
180
+ writer.decreaseIndent();
181
+ writer.writeLine('}'); // end of "declare namespace { ... }"
182
+ }
183
+ if (!entity.shouldInlineExport) {
184
+ for (const exportName of entity.exportNames) {
185
+ DtsEmitHelpers.emitNamedExport(writer, exportName, entity);
186
+ }
187
+ }
188
+ writer.ensureSkippedLine();
189
+ }
190
+ DtsEmitHelpers.emitStarExports(writer, collector);
191
+ // Emit "export { }" which is a special directive that prevents consumers from importing declarations
192
+ // that don't have an explicit "export" modifier.
193
+ writer.ensureSkippedLine();
194
+ writer.writeLine('export { }');
195
+ }
196
+ /**
197
+ * Before writing out a declaration, _modifySpan() applies various fixups to make it nice.
198
+ */
199
+ static _modifySpan(collector, span, entity, astDeclaration, dtsKind) {
200
+ const previousSpan = span.previousSibling;
201
+ let recurseChildren = true;
202
+ switch (span.kind) {
203
+ case ts.SyntaxKind.JSDocComment:
204
+ // If the @packageDocumentation comment seems to be attached to one of the regular API items,
205
+ // omit it. It gets explictly emitted at the top of the file.
206
+ if (span.node.getText().match(/(?:\s|\*)@packageDocumentation(?:\s|\*)/gi)) {
207
+ span.modification.skipAll();
208
+ }
209
+ // For now, we don't transform JSDoc comment nodes at all
210
+ recurseChildren = false;
211
+ break;
212
+ case ts.SyntaxKind.ExportKeyword:
213
+ if (DtsEmitHelpers.isExportKeywordInNamespaceExportDeclaration(span.node)) {
214
+ // This is an export declaration inside a namespace - preserve the export keyword
215
+ break;
216
+ }
217
+ // Otherwise, delete the export keyword -- we will re-add it below
218
+ span.modification.skipAll();
219
+ break;
220
+ case ts.SyntaxKind.DefaultKeyword:
221
+ case ts.SyntaxKind.DeclareKeyword:
222
+ // Delete any explicit "export" or "declare" keywords -- we will re-add them below
223
+ span.modification.skipAll();
224
+ break;
225
+ case ts.SyntaxKind.InterfaceKeyword:
226
+ case ts.SyntaxKind.ClassKeyword:
227
+ case ts.SyntaxKind.EnumKeyword:
228
+ case ts.SyntaxKind.NamespaceKeyword:
229
+ case ts.SyntaxKind.ModuleKeyword:
230
+ case ts.SyntaxKind.TypeKeyword:
231
+ case ts.SyntaxKind.FunctionKeyword:
232
+ // Replace the stuff we possibly deleted above
233
+ let replacedModifiers = '';
234
+ // Add a declare statement for root declarations (but not for nested declarations)
235
+ if (!astDeclaration.parent) {
236
+ replacedModifiers += 'declare ';
237
+ }
238
+ if (entity.shouldInlineExport) {
239
+ replacedModifiers = 'export ' + replacedModifiers;
240
+ }
241
+ if (previousSpan && previousSpan.kind === ts.SyntaxKind.SyntaxList) {
242
+ // If there is a previous span of type SyntaxList, then apply it before any other modifiers
243
+ // (e.g. "abstract") that appear there.
244
+ previousSpan.modification.prefix = replacedModifiers + previousSpan.modification.prefix;
245
+ }
246
+ else {
247
+ // Otherwise just stick it in front of this span
248
+ span.modification.prefix = replacedModifiers + span.modification.prefix;
249
+ }
250
+ break;
251
+ case ts.SyntaxKind.VariableDeclaration:
252
+ // Is this a top-level variable declaration?
253
+ // (The logic below does not apply to variable declarations that are part of an explicit "namespace" block,
254
+ // since the compiler prefers not to emit "declare" or "export" keywords for those declarations.)
255
+ if (!span.parent) {
256
+ // The VariableDeclaration node is part of a VariableDeclarationList, however
257
+ // the Entry.followedSymbol points to the VariableDeclaration part because
258
+ // multiple definitions might share the same VariableDeclarationList.
259
+ //
260
+ // Since we are emitting a separate declaration for each one, we need to look upwards
261
+ // in the ts.Node tree and write a copy of the enclosing VariableDeclarationList
262
+ // content (e.g. "var" from "var x=1, y=2").
263
+ const list = TypeScriptHelpers.matchAncestor(span.node, [
264
+ ts.SyntaxKind.VariableDeclarationList,
265
+ ts.SyntaxKind.VariableDeclaration
266
+ ]);
267
+ if (!list) {
268
+ // This should not happen unless the compiler API changes somehow
269
+ throw new InternalError('Unsupported variable declaration');
270
+ }
271
+ const listPrefix = list
272
+ .getSourceFile()
273
+ .text.substring(list.getStart(), list.declarations[0].getStart());
274
+ span.modification.prefix = 'declare ' + listPrefix + span.modification.prefix;
275
+ span.modification.suffix = ';';
276
+ if (entity.shouldInlineExport) {
277
+ span.modification.prefix = 'export ' + span.modification.prefix;
278
+ }
279
+ const declarationMetadata = collector.fetchDeclarationMetadata(astDeclaration);
280
+ if (declarationMetadata.tsdocParserContext) {
281
+ // Typically the comment for a variable declaration is attached to the outer variable statement
282
+ // (which may possibly contain multiple variable declarations), so it's not part of the Span.
283
+ // Instead we need to manually inject it.
284
+ let originalComment = declarationMetadata.tsdocParserContext.sourceRange.toString();
285
+ if (!/\r?\n\s*$/.test(originalComment)) {
286
+ originalComment += '\n';
287
+ }
288
+ span.modification.indentDocComment = IndentDocCommentScope.PrefixOnly;
289
+ span.modification.prefix = originalComment + span.modification.prefix;
290
+ }
291
+ }
292
+ break;
293
+ case ts.SyntaxKind.Identifier:
294
+ {
295
+ const referencedEntity = collector.tryGetEntityForNode(span.node);
296
+ if (referencedEntity) {
297
+ if (!referencedEntity.nameForEmit) {
298
+ // This should never happen
299
+ throw new InternalError('referencedEntry.nameForEmit is undefined');
300
+ }
301
+ span.modification.prefix = referencedEntity.nameForEmit;
302
+ // For debugging:
303
+ // span.modification.prefix += '/*R=FIX*/';
304
+ }
305
+ else {
306
+ // For debugging:
307
+ // span.modification.prefix += '/*R=KEEP*/';
308
+ }
309
+ }
310
+ break;
311
+ case ts.SyntaxKind.ImportType:
312
+ DtsEmitHelpers.modifyImportTypeSpan(collector, span, astDeclaration, (childSpan, childAstDeclaration) => {
313
+ DtsRollupGenerator._modifySpan(collector, childSpan, entity, childAstDeclaration, dtsKind);
314
+ });
315
+ break;
316
+ }
317
+ if (recurseChildren) {
318
+ for (const child of span.children) {
319
+ let childAstDeclaration = astDeclaration;
320
+ // Should we trim this node?
321
+ let trimmed = false;
322
+ if (AstDeclaration.isSupportedSyntaxKind(child.kind)) {
323
+ childAstDeclaration = collector.astSymbolTable.getChildAstDeclarationByNode(child.node, astDeclaration);
324
+ const releaseTag = collector.fetchApiItemMetadata(childAstDeclaration).effectiveReleaseTag;
325
+ if (!this._shouldIncludeReleaseTag(releaseTag, dtsKind)) {
326
+ let nodeToTrim = child;
327
+ // If we are trimming a variable statement, then we need to trim the outer VariableDeclarationList
328
+ // as well.
329
+ if (child.kind === ts.SyntaxKind.VariableDeclaration) {
330
+ const variableStatement = child.findFirstParent(ts.SyntaxKind.VariableStatement);
331
+ if (variableStatement !== undefined) {
332
+ nodeToTrim = variableStatement;
333
+ }
334
+ }
335
+ const modification = nodeToTrim.modification;
336
+ // Yes, trim it and stop here
337
+ const name = childAstDeclaration.astSymbol.localName;
338
+ modification.omitChildren = true;
339
+ if (!collector.extractorConfig.omitTrimmingComments) {
340
+ modification.prefix = `/* Excluded from this release type: ${name} */`;
341
+ }
342
+ else {
343
+ modification.prefix = '';
344
+ }
345
+ modification.suffix = '';
346
+ if (nodeToTrim.children.length > 0) {
347
+ // If there are grandchildren, then keep the last grandchild's separator,
348
+ // since it often has useful whitespace
349
+ modification.suffix = nodeToTrim.children[nodeToTrim.children.length - 1].separator;
350
+ }
351
+ if (nodeToTrim.nextSibling) {
352
+ // If the thing we are trimming is followed by a comma, then trim the comma also.
353
+ // An example would be an enum member.
354
+ if (nodeToTrim.nextSibling.kind === ts.SyntaxKind.CommaToken) {
355
+ // Keep its separator since it often has useful whitespace
356
+ modification.suffix += nodeToTrim.nextSibling.separator;
357
+ nodeToTrim.nextSibling.modification.skipAll();
358
+ }
359
+ }
360
+ trimmed = true;
361
+ }
362
+ }
363
+ if (!trimmed) {
364
+ DtsRollupGenerator._modifySpan(collector, child, entity, childAstDeclaration, dtsKind);
365
+ }
366
+ }
367
+ }
368
+ }
369
+ static _shouldIncludeReleaseTag(releaseTag, dtsKind) {
370
+ switch (dtsKind) {
371
+ case DtsRollupKind.InternalRelease:
372
+ return true;
373
+ case DtsRollupKind.AlphaRelease:
374
+ return (releaseTag === ReleaseTag.Alpha ||
375
+ releaseTag === ReleaseTag.Beta ||
376
+ releaseTag === ReleaseTag.Public ||
377
+ // NOTE: If the release tag is "None", then we don't have enough information to trim it
378
+ releaseTag === ReleaseTag.None);
379
+ case DtsRollupKind.BetaRelease:
380
+ return (releaseTag === ReleaseTag.Beta ||
381
+ releaseTag === ReleaseTag.Public ||
382
+ // NOTE: If the release tag is "None", then we don't have enough information to trim it
383
+ releaseTag === ReleaseTag.None);
384
+ case DtsRollupKind.PublicRelease:
385
+ return releaseTag === ReleaseTag.Public || releaseTag === ReleaseTag.None;
386
+ default:
387
+ throw new Error(`${DtsRollupKind[dtsKind]} is not implemented`);
388
+ }
389
+ }
390
+ }
391
+ //# sourceMappingURL=DtsRollupGenerator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DtsRollupGenerator.js","sourceRoot":"","sources":["../../src/generators/DtsRollupGenerator.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,O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AAM;oBAChC,uFAAuF;oBACvF,UAAU,KAAK,UAAU,CAAC,IAAI,CAC/B,CAAC;YACJ,KAAK,aAAa,CAAC,aAAa;gBAC9B,OAAO,UAAU,KAAK,UAAU,CAAC,MAAM,IAAI,UAAU,KAAK,UAAU,CAAC,IAAI,CAAC;YAC5E;gBACE,MAAM,IAAI,KAAK,CAAC,GAAG,aAAa,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as ts from 'typescript';\n\nimport { ReleaseTag } from '@microsoft/api-extractor-model';\nimport { FileSystem, type NewlineKind, InternalError } from '@rushstack/node-core-library';\n\nimport type { Collector } from '../collector/Collector';\nimport { TypeScriptHelpers } from '../analyzer/TypeScriptHelpers';\nimport { IndentDocCommentScope, Span, type SpanModification } from '../analyzer/Span';\nimport { AstImport } from '../analyzer/AstImport';\nimport type { CollectorEntity } from '../collector/CollectorEntity';\nimport { AstDeclaration } from '../analyzer/AstDeclaration';\nimport type { ApiItemMetadata } from '../collector/ApiItemMetadata';\nimport { AstSymbol } from '../analyzer/AstSymbol';\nimport type { SymbolMetadata } from '../collector/SymbolMetadata';\nimport { IndentedWriter } from './IndentedWriter';\nimport { DtsEmitHelpers } from './DtsEmitHelpers';\nimport type { DeclarationMetadata } from '../collector/DeclarationMetadata';\nimport { AstNamespaceImport } from '../analyzer/AstNamespaceImport';\nimport type { IAstModuleExportInfo } from '../analyzer/AstModule';\nimport { SourceFileLocationFormatter } from '../analyzer/SourceFileLocationFormatter';\nimport type { AstEntity } from '../analyzer/AstEntity';\n\n/**\n * Used with DtsRollupGenerator.writeTypingsFile()\n */\nexport enum DtsRollupKind {\n /**\n * Generate a *.d.ts file for an internal release, or for the trimming=false mode.\n * This output file will contain all definitions that are reachable from the entry point.\n */\n InternalRelease,\n\n /**\n * Generate a *.d.ts file for a preview release.\n * This output file will contain all definitions that are reachable from the entry point,\n * except definitions marked as \\@internal.\n */\n AlphaRelease,\n\n /**\n * Generate a *.d.ts file for a preview release.\n * This output file will contain all definitions that are reachable from the entry point,\n * except definitions marked as \\@alpha or \\@internal.\n */\n BetaRelease,\n\n /**\n * Generate a *.d.ts file for a public release.\n * This output file will contain all definitions that are reachable from the entry point,\n * except definitions marked as \\@beta, \\@alpha, or \\@internal.\n */\n PublicRelease\n}\n\nexport class DtsRollupGenerator {\n /**\n * Generates the typings file and writes it to disk.\n *\n * @param dtsFilename - The *.d.ts output filename\n */\n public static writeTypingsFile(\n collector: Collector,\n dtsFilename: string,\n dtsKind: DtsRollupKind,\n newlineKind: NewlineKind\n ): void {\n const writer: IndentedWriter = new IndentedWriter();\n writer.trimLeadingSpaces = true;\n\n DtsRollupGenerator._generateTypingsFileContent(collector, writer, dtsKind);\n\n FileSystem.writeFile(dtsFilename, writer.toString(), {\n convertLineEndings: newlineKind,\n ensureFolderExists: true\n });\n }\n\n private static _generateTypingsFileContent(\n collector: Collector,\n writer: IndentedWriter,\n dtsKind: DtsRollupKind\n ): void {\n // Emit the @packageDocumentation comment at the top of the file\n if (collector.workingPackage.tsdocParserContext) {\n writer.trimLeadingSpaces = false;\n writer.writeLine(collector.workingPackage.tsdocParserContext.sourceRange.toString());\n writer.trimLeadingSpaces = true;\n writer.ensureSkippedLine();\n }\n\n // Emit the triple slash directives\n for (const typeDirectiveReference of collector.dtsTypeReferenceDirectives) {\n // https://github.com/microsoft/TypeScript/blob/611ebc7aadd7a44a4c0447698bfda9222a78cb66/src/compiler/declarationEmitter.ts#L162\n writer.writeLine(`/// <reference types=\"${typeDirectiveReference}\" />`);\n }\n for (const libDirectiveReference of collector.dtsLibReferenceDirectives) {\n writer.writeLine(`/// <reference lib=\"${libDirectiveReference}\" />`);\n }\n writer.ensureSkippedLine();\n\n // Emit the imports\n for (const entity of collector.entities) {\n if (entity.astEntity instanceof AstImport) {\n // Note: it isn't valid to trim imports based on their release tags.\n // E.g. class Foo (`@public`) extends interface Bar (`@beta`) from some external library.\n // API-Extractor cannot trim `import { Bar } from \"external-library\"` when generating its public rollup,\n // or the export of `Foo` would include a broken reference to `Bar`.\n const astImport: AstImport = entity.astEntity;\n DtsEmitHelpers.emitImport(writer, entity, astImport);\n }\n }\n writer.ensureSkippedLine();\n\n // Emit the regular declarations\n for (const entity of collector.entities) {\n const astEntity: AstEntity = entity.astEntity;\n const symbolMetadata: SymbolMetadata | undefined = collector.tryFetchMetadataForAstEntity(astEntity);\n const maxEffectiveReleaseTag: ReleaseTag = symbolMetadata\n ? symbolMetadata.maxEffectiveReleaseTag\n : ReleaseTag.None;\n\n if (!this._shouldIncludeReleaseTag(maxEffectiveReleaseTag, dtsKind)) {\n if (!collector.extractorConfig.omitTrimmingComments) {\n writer.ensureSkippedLine();\n writer.writeLine(`/* Excluded from this release type: ${entity.nameForEmit} */`);\n }\n continue;\n }\n\n if (astEntity instanceof AstSymbol) {\n // Emit all the declarations for this entry\n for (const astDeclaration of astEntity.astDeclarations || []) {\n const apiItemMetadata: ApiItemMetadata = collector.fetchApiItemMetadata(astDeclaration);\n\n if (!this._shouldIncludeReleaseTag(apiItemMetadata.effectiveReleaseTag, dtsKind)) {\n if (!collector.extractorConfig.omitTrimmingComments) {\n writer.ensureSkippedLine();\n writer.writeLine(`/* Excluded declaration from this release type: ${entity.nameForEmit} */`);\n }\n continue;\n } else {\n const span: Span = new Span(astDeclaration.declaration);\n DtsRollupGenerator._modifySpan(collector, span, entity, astDeclaration, dtsKind);\n writer.ensureSkippedLine();\n span.writeModifiedText(writer);\n writer.ensureNewLine();\n }\n }\n }\n\n if (astEntity instanceof AstNamespaceImport) {\n const astModuleExportInfo: IAstModuleExportInfo = astEntity.fetchAstModuleExportInfo(collector);\n\n if (entity.nameForEmit === undefined) {\n // This should never happen\n throw new InternalError('referencedEntry.nameForEmit is undefined');\n }\n\n if (astModuleExportInfo.starExportedExternalModules.size > 0) {\n // We could support this, but we would need to find a way to safely represent it.\n throw new Error(\n `The ${entity.nameForEmit} namespace import includes a start export, which is not supported:\\n` +\n SourceFileLocationFormatter.formatDeclaration(astEntity.declaration)\n );\n }\n\n // Emit a synthetic declaration for the namespace. It will look like this:\n //\n // declare namespace example {\n // export {\n // f1,\n // f2\n // }\n // }\n //\n // Note that we do not try to relocate f1()/f2() to be inside the namespace because other type\n // signatures may reference them directly (without using the namespace qualifier).\n\n writer.ensureSkippedLine();\n if (entity.shouldInlineExport) {\n writer.write('export ');\n }\n writer.writeLine(`declare namespace ${entity.nameForEmit} {`);\n\n // all local exports of local imported module are just references to top-level declarations\n writer.increaseIndent();\n writer.writeLine('export {');\n writer.increaseIndent();\n\n const exportClauses: string[] = [];\n for (const [exportedName, exportedEntity] of astModuleExportInfo.exportedLocalEntities) {\n const collectorEntity: CollectorEntity | undefined =\n collector.tryGetCollectorEntity(exportedEntity);\n if (collectorEntity === undefined) {\n // This should never happen\n // top-level exports of local imported module should be added as collector entities before\n throw new InternalError(\n `Cannot find collector entity for ${entity.nameForEmit}.${exportedEntity.localName}`\n );\n }\n\n // If the entity's declaration won't be included, then neither should the namespace export it\n // This fixes the issue encountered here: https://github.com/microsoft/rushstack/issues/2791\n const exportedSymbolMetadata: SymbolMetadata | undefined =\n collector.tryFetchMetadataForAstEntity(exportedEntity);\n const exportedMaxEffectiveReleaseTag: ReleaseTag = exportedSymbolMetadata\n ? exportedSymbolMetadata.maxEffectiveReleaseTag\n : ReleaseTag.None;\n if (!this._shouldIncludeReleaseTag(exportedMaxEffectiveReleaseTag, dtsKind)) {\n continue;\n }\n\n if (collectorEntity.nameForEmit === exportedName) {\n exportClauses.push(collectorEntity.nameForEmit);\n } else {\n exportClauses.push(`${collectorEntity.nameForEmit} as ${exportedName}`);\n }\n }\n writer.writeLine(exportClauses.join(',\\n'));\n\n writer.decreaseIndent();\n writer.writeLine('}'); // end of \"export { ... }\"\n writer.decreaseIndent();\n writer.writeLine('}'); // end of \"declare namespace { ... }\"\n }\n\n if (!entity.shouldInlineExport) {\n for (const exportName of entity.exportNames) {\n DtsEmitHelpers.emitNamedExport(writer, exportName, entity);\n }\n }\n\n writer.ensureSkippedLine();\n }\n\n DtsEmitHelpers.emitStarExports(writer, collector);\n\n // Emit \"export { }\" which is a special directive that prevents consumers from importing declarations\n // that don't have an explicit \"export\" modifier.\n writer.ensureSkippedLine();\n writer.writeLine('export { }');\n }\n\n /**\n * Before writing out a declaration, _modifySpan() applies various fixups to make it nice.\n */\n private static _modifySpan(\n collector: Collector,\n span: Span,\n entity: CollectorEntity,\n astDeclaration: AstDeclaration,\n dtsKind: DtsRollupKind\n ): void {\n const previousSpan: Span | undefined = span.previousSibling;\n\n let recurseChildren: boolean = true;\n switch (span.kind) {\n case ts.SyntaxKind.JSDocComment:\n // If the @packageDocumentation comment seems to be attached to one of the regular API items,\n // omit it. It gets explictly emitted at the top of the file.\n if (span.node.getText().match(/(?:\\s|\\*)@packageDocumentation(?:\\s|\\*)/gi)) {\n span.modification.skipAll();\n }\n\n // For now, we don't transform JSDoc comment nodes at all\n recurseChildren = false;\n break;\n\n case ts.SyntaxKind.ExportKeyword:\n if (DtsEmitHelpers.isExportKeywordInNamespaceExportDeclaration(span.node)) {\n // This is an export declaration inside a namespace - preserve the export keyword\n break;\n }\n // Otherwise, delete the export keyword -- we will re-add it below\n span.modification.skipAll();\n break;\n\n case ts.SyntaxKind.DefaultKeyword:\n case ts.SyntaxKind.DeclareKeyword:\n // Delete any explicit \"export\" or \"declare\" keywords -- we will re-add them below\n span.modification.skipAll();\n break;\n\n case ts.SyntaxKind.InterfaceKeyword:\n case ts.SyntaxKind.ClassKeyword:\n case ts.SyntaxKind.EnumKeyword:\n case ts.SyntaxKind.NamespaceKeyword:\n case ts.SyntaxKind.ModuleKeyword:\n case ts.SyntaxKind.TypeKeyword:\n case ts.SyntaxKind.FunctionKeyword:\n // Replace the stuff we possibly deleted above\n let replacedModifiers: string = '';\n\n // Add a declare statement for root declarations (but not for nested declarations)\n if (!astDeclaration.parent) {\n replacedModifiers += 'declare ';\n }\n\n if (entity.shouldInlineExport) {\n replacedModifiers = 'export ' + replacedModifiers;\n }\n\n if (previousSpan && previousSpan.kind === ts.SyntaxKind.SyntaxList) {\n // If there is a previous span of type SyntaxList, then apply it before any other modifiers\n // (e.g. \"abstract\") that appear there.\n previousSpan.modification.prefix = replacedModifiers + previousSpan.modification.prefix;\n } else {\n // Otherwise just stick it in front of this span\n span.modification.prefix = replacedModifiers + span.modification.prefix;\n }\n break;\n\n case ts.SyntaxKind.VariableDeclaration:\n // Is this a top-level variable declaration?\n // (The logic below does not apply to variable declarations that are part of an explicit \"namespace\" block,\n // since the compiler prefers not to emit \"declare\" or \"export\" keywords for those declarations.)\n if (!span.parent) {\n // The VariableDeclaration node is part of a VariableDeclarationList, however\n // the Entry.followedSymbol points to the VariableDeclaration part because\n // multiple definitions might share the same VariableDeclarationList.\n //\n // Since we are emitting a separate declaration for each one, we need to look upwards\n // in the ts.Node tree and write a copy of the enclosing VariableDeclarationList\n // content (e.g. \"var\" from \"var x=1, y=2\").\n const list: ts.VariableDeclarationList | undefined = TypeScriptHelpers.matchAncestor(span.node, [\n ts.SyntaxKind.VariableDeclarationList,\n ts.SyntaxKind.VariableDeclaration\n ]);\n if (!list) {\n // This should not happen unless the compiler API changes somehow\n throw new InternalError('Unsupported variable declaration');\n }\n const listPrefix: string = list\n .getSourceFile()\n .text.substring(list.getStart(), list.declarations[0].getStart());\n span.modification.prefix = 'declare ' + listPrefix + span.modification.prefix;\n span.modification.suffix = ';';\n\n if (entity.shouldInlineExport) {\n span.modification.prefix = 'export ' + span.modification.prefix;\n }\n\n const declarationMetadata: DeclarationMetadata = collector.fetchDeclarationMetadata(astDeclaration);\n if (declarationMetadata.tsdocParserContext) {\n // Typically the comment for a variable declaration is attached to the outer variable statement\n // (which may possibly contain multiple variable declarations), so it's not part of the Span.\n // Instead we need to manually inject it.\n let originalComment: string = declarationMetadata.tsdocParserContext.sourceRange.toString();\n if (!/\\r?\\n\\s*$/.test(originalComment)) {\n originalComment += '\\n';\n }\n span.modification.indentDocComment = IndentDocCommentScope.PrefixOnly;\n span.modification.prefix = originalComment + span.modification.prefix;\n }\n }\n break;\n\n case ts.SyntaxKind.Identifier:\n {\n const referencedEntity: CollectorEntity | undefined = collector.tryGetEntityForNode(\n span.node as ts.Identifier\n );\n\n if (referencedEntity) {\n if (!referencedEntity.nameForEmit) {\n // This should never happen\n throw new InternalError('referencedEntry.nameForEmit is undefined');\n }\n\n span.modification.prefix = referencedEntity.nameForEmit;\n // For debugging:\n // span.modification.prefix += '/*R=FIX*/';\n } else {\n // For debugging:\n // span.modification.prefix += '/*R=KEEP*/';\n }\n }\n break;\n\n case ts.SyntaxKind.ImportType:\n DtsEmitHelpers.modifyImportTypeSpan(\n collector,\n span,\n astDeclaration,\n (childSpan, childAstDeclaration) => {\n DtsRollupGenerator._modifySpan(collector, childSpan, entity, childAstDeclaration, dtsKind);\n }\n );\n break;\n }\n\n if (recurseChildren) {\n for (const child of span.children) {\n let childAstDeclaration: AstDeclaration = astDeclaration;\n\n // Should we trim this node?\n let trimmed: boolean = false;\n if (AstDeclaration.isSupportedSyntaxKind(child.kind)) {\n childAstDeclaration = collector.astSymbolTable.getChildAstDeclarationByNode(\n child.node,\n astDeclaration\n );\n const releaseTag: ReleaseTag =\n collector.fetchApiItemMetadata(childAstDeclaration).effectiveReleaseTag;\n\n if (!this._shouldIncludeReleaseTag(releaseTag, dtsKind)) {\n let nodeToTrim: Span = child;\n\n // If we are trimming a variable statement, then we need to trim the outer VariableDeclarationList\n // as well.\n if (child.kind === ts.SyntaxKind.VariableDeclaration) {\n const variableStatement: Span | undefined = child.findFirstParent(\n ts.SyntaxKind.VariableStatement\n );\n if (variableStatement !== undefined) {\n nodeToTrim = variableStatement;\n }\n }\n\n const modification: SpanModification = nodeToTrim.modification;\n\n // Yes, trim it and stop here\n const name: string = childAstDeclaration.astSymbol.localName;\n modification.omitChildren = true;\n\n if (!collector.extractorConfig.omitTrimmingComments) {\n modification.prefix = `/* Excluded from this release type: ${name} */`;\n } else {\n modification.prefix = '';\n }\n modification.suffix = '';\n\n if (nodeToTrim.children.length > 0) {\n // If there are grandchildren, then keep the last grandchild's separator,\n // since it often has useful whitespace\n modification.suffix = nodeToTrim.children[nodeToTrim.children.length - 1].separator;\n }\n\n if (nodeToTrim.nextSibling) {\n // If the thing we are trimming is followed by a comma, then trim the comma also.\n // An example would be an enum member.\n if (nodeToTrim.nextSibling.kind === ts.SyntaxKind.CommaToken) {\n // Keep its separator since it often has useful whitespace\n modification.suffix += nodeToTrim.nextSibling.separator;\n nodeToTrim.nextSibling.modification.skipAll();\n }\n }\n\n trimmed = true;\n }\n }\n\n if (!trimmed) {\n DtsRollupGenerator._modifySpan(collector, child, entity, childAstDeclaration, dtsKind);\n }\n }\n }\n }\n\n private static _shouldIncludeReleaseTag(releaseTag: ReleaseTag, dtsKind: DtsRollupKind): boolean {\n switch (dtsKind) {\n case DtsRollupKind.InternalRelease:\n return true;\n case DtsRollupKind.AlphaRelease:\n return (\n releaseTag === ReleaseTag.Alpha ||\n releaseTag === ReleaseTag.Beta ||\n releaseTag === ReleaseTag.Public ||\n // NOTE: If the release tag is \"None\", then we don't have enough information to trim it\n releaseTag === ReleaseTag.None\n );\n case DtsRollupKind.BetaRelease:\n return (\n releaseTag === ReleaseTag.Beta ||\n releaseTag === ReleaseTag.Public ||\n // NOTE: If the release tag is \"None\", then we don't have enough information to trim it\n releaseTag === ReleaseTag.None\n );\n case DtsRollupKind.PublicRelease:\n return releaseTag === ReleaseTag.Public || releaseTag === ReleaseTag.None;\n default:\n throw new Error(`${DtsRollupKind[dtsKind]} is not implemented`);\n }\n }\n}\n"]}