typedoc 0.28.18 → 0.28.20

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 (397) hide show
  1. package/README.md +12 -13
  2. package/bin/typedoc +1 -1
  3. package/dist/browser-locales/fr.d.ts +2 -0
  4. package/dist/browser-locales/fr.js +62 -0
  5. package/dist/browser-utils.js +29 -2
  6. package/dist/cli.js +111 -0
  7. package/dist/index.js +17888 -44
  8. package/dist/models.js +3736 -0
  9. package/dist/node-utils.js +7018 -0
  10. package/dist/serialization.js +430 -0
  11. package/dist/{lib → types}/application-events.d.ts +2 -0
  12. package/dist/{lib → types}/application.d.ts +51 -8
  13. package/dist/{lib → types}/converter/comments/declarationReferenceResolver.d.ts +1 -1
  14. package/dist/{lib → types}/converter/comments/discovery.d.ts +3 -3
  15. package/dist/{lib → types}/converter/comments/index.d.ts +4 -4
  16. package/dist/{lib → types}/converter/comments/lexer.d.ts +1 -1
  17. package/dist/{lib → types}/converter/comments/linkResolver.d.ts +1 -1
  18. package/dist/{lib → types}/converter/comments/parser.d.ts +3 -4
  19. package/dist/{lib → types}/converter/comments/textParser.d.ts +8 -2
  20. package/dist/{lib → types}/converter/components.d.ts +1 -1
  21. package/dist/{lib → types}/converter/context.d.ts +2 -2
  22. package/dist/{lib → types}/converter/converter.d.ts +6 -8
  23. package/dist/{lib → types}/converter/factories/signature.d.ts +1 -1
  24. package/dist/{lib → types}/converter/index.d.ts +1 -0
  25. package/dist/{lib → types}/converter/plugins/CategoryPlugin.d.ts +2 -2
  26. package/dist/{lib → types}/converter/plugins/GroupPlugin.d.ts +2 -3
  27. package/dist/{lib → types}/converter/plugins/IncludePlugin.d.ts +1 -1
  28. package/dist/{lib → types}/converter/plugins/InheritDocPlugin.d.ts +1 -1
  29. package/dist/{lib → types}/converter/plugins/LinkResolverPlugin.d.ts +3 -3
  30. package/dist/{lib → types}/converter/plugins/SourcePlugin.d.ts +1 -2
  31. package/dist/{lib → types}/converter/plugins/TypePlugin.d.ts +1 -1
  32. package/dist/{lib → types}/converter/types.d.ts +1 -1
  33. package/dist/{lib/converter/utils → types/converter/utilities}/reflections.d.ts +1 -1
  34. package/dist/{lib/converter/utils → types/converter/utilities}/repository.d.ts +14 -13
  35. package/dist/{index.d.ts → types/index.d.ts} +15 -16
  36. package/dist/{lib → types}/internationalization/internationalization.d.ts +0 -8
  37. package/dist/types/internationalization/locale-utils.d.ts +3 -0
  38. package/dist/types/internationalization/locales/de.d.ts +368 -0
  39. package/dist/{lib/internationalization/locales/en.d.cts → types/internationalization/locales/en.d.ts} +2 -1
  40. package/dist/types/internationalization/locales/fr.d.ts +346 -0
  41. package/dist/types/internationalization/locales/ja.d.ts +307 -0
  42. package/dist/types/internationalization/locales/ko.d.ts +221 -0
  43. package/dist/types/internationalization/locales/zh.d.ts +452 -0
  44. package/dist/{lib → types}/internationalization/translatable.d.ts +1 -1
  45. package/dist/{lib → types}/models/FileRegistry.d.ts +6 -1
  46. package/dist/{lib → types}/models/ReflectionSymbolId.d.ts +9 -3
  47. package/dist/{lib → types}/models/SourceReference.d.ts +5 -3
  48. package/dist/types/models.d.ts +1 -0
  49. package/dist/types/node-utils.d.ts +1 -0
  50. package/dist/{lib → types}/output/components.d.ts +3 -3
  51. package/dist/{lib → types}/output/events.d.ts +1 -2
  52. package/dist/{lib → types}/output/formatter.d.ts +1 -2
  53. package/dist/{lib → types}/output/output.d.ts +2 -2
  54. package/dist/{lib → types}/output/renderer.d.ts +4 -5
  55. package/dist/{lib → types}/output/router.d.ts +3 -2
  56. package/dist/{lib → types}/output/themes/MarkedPlugin.d.ts +3 -3
  57. package/dist/{lib → types}/output/themes/default/DefaultTheme.d.ts +1 -1
  58. package/dist/{lib → types}/output/themes/default/DefaultThemeRenderContext.d.ts +25 -25
  59. package/dist/{lib → types}/output/themes/default/layouts/default.d.ts +1 -1
  60. package/dist/{lib → types}/output/themes/default/partials/anchor-icon.d.ts +1 -1
  61. package/dist/{lib → types}/output/themes/default/partials/breadcrumb.d.ts +1 -1
  62. package/dist/{lib → types}/output/themes/default/partials/comment.d.ts +1 -1
  63. package/dist/{lib → types}/output/themes/default/partials/header.d.ts +1 -1
  64. package/dist/{lib → types}/output/themes/default/partials/hierarchy.d.ts +1 -1
  65. package/dist/{lib → types}/output/themes/default/partials/icon.d.ts +1 -1
  66. package/dist/{lib → types}/output/themes/default/partials/index.d.ts +1 -1
  67. package/dist/{lib → types}/output/themes/default/partials/member.d.ts +1 -1
  68. package/dist/{lib → types}/output/themes/default/partials/member.getterSetter.d.ts +1 -1
  69. package/dist/{lib → types}/output/themes/default/partials/member.signature.body.d.ts +1 -1
  70. package/dist/{lib → types}/output/themes/default/partials/member.signature.title.d.ts +2 -2
  71. package/dist/{lib → types}/output/themes/default/partials/member.signatures.d.ts +1 -1
  72. package/dist/{lib → types}/output/themes/default/partials/member.sources.d.ts +1 -1
  73. package/dist/{lib → types}/output/themes/default/partials/members.d.ts +1 -1
  74. package/dist/{lib → types}/output/themes/default/partials/moduleReflection.d.ts +1 -1
  75. package/dist/{lib → types}/output/themes/default/partials/navigation.d.ts +1 -1
  76. package/dist/{lib → types}/output/themes/default/partials/reflectionPreview.d.ts +1 -1
  77. package/dist/{lib → types}/output/themes/default/partials/toolbar.d.ts +1 -1
  78. package/dist/{lib → types}/output/themes/default/partials/type.d.ts +2 -2
  79. package/dist/{lib → types}/output/themes/default/partials/typeDetails.d.ts +2 -2
  80. package/dist/{lib → types}/output/themes/default/partials/typeParameters.d.ts +1 -1
  81. package/dist/{lib → types}/output/themes/default/templates/document.d.ts +1 -1
  82. package/dist/{lib → types}/output/themes/default/templates/hierarchy.d.ts +1 -1
  83. package/dist/{lib → types}/output/themes/default/templates/index.d.ts +1 -1
  84. package/dist/{lib → types}/output/themes/default/templates/reflection.d.ts +1 -1
  85. package/dist/{lib → types}/output/themes/lib.d.ts +1 -1
  86. package/dist/types/serialization.d.ts +1 -0
  87. package/dist/types/tsconfig.tsbuildinfo +1 -0
  88. package/dist/{lib → types}/utils/ValidatingFileRegistry.d.ts +1 -1
  89. package/dist/{lib → types}/utils/entry-point.d.ts +2 -2
  90. package/dist/{lib → types}/utils/general.d.ts +3 -0
  91. package/dist/types/utils/index.d.ts +22 -0
  92. package/dist/{lib → types}/utils/options/declaration.d.ts +2 -1
  93. package/dist/{lib → types}/utils/options/defaults.d.ts +1 -1
  94. package/dist/{lib → types}/utils/options/index.d.ts +2 -1
  95. package/dist/{lib → types}/utils/options/options.d.ts +1 -1
  96. package/dist/{lib → types}/utils/options/tsdoc-defaults.d.ts +1 -1
  97. package/dist/{lib → types}/utils/reflections.d.ts +1 -1
  98. package/dist/{lib → types}/utils/sort.d.ts +1 -2
  99. package/dist/{lib → types}/utils-common/general.d.ts +4 -4
  100. package/dist/{lib → types}/utils-common/jsx.elements.d.ts +16 -0
  101. package/dist/types/utils-common.d.ts +1 -0
  102. package/dist/{lib → types}/validation/documentation.d.ts +1 -1
  103. package/dist/{lib → types}/validation/exports.d.ts +1 -1
  104. package/dist/types/validation/filePaths.d.ts +3 -0
  105. package/dist/{lib → types}/validation/links.d.ts +1 -1
  106. package/dist/{lib → types}/validation/unusedMergeModuleWith.d.ts +1 -1
  107. package/dist/utils-common.js +1311 -0
  108. package/package.json +46 -37
  109. package/static/main.js +4 -4
  110. package/static/style.css +18 -3
  111. package/tsdoc.json +4 -0
  112. package/typedoc-config.schema.json +2 -0
  113. package/dist/lib/application-events.js +0 -5
  114. package/dist/lib/application.js +0 -716
  115. package/dist/lib/cli.js +0 -111
  116. package/dist/lib/converter/comments/blockLexer.js +0 -391
  117. package/dist/lib/converter/comments/declarationReferenceResolver.js +0 -218
  118. package/dist/lib/converter/comments/discovery.js +0 -563
  119. package/dist/lib/converter/comments/index.js +0 -241
  120. package/dist/lib/converter/comments/lexer.js +0 -10
  121. package/dist/lib/converter/comments/lineLexer.js +0 -279
  122. package/dist/lib/converter/comments/linkResolver.js +0 -186
  123. package/dist/lib/converter/comments/parser.js +0 -538
  124. package/dist/lib/converter/comments/rawLexer.js +0 -218
  125. package/dist/lib/converter/comments/tagName.js +0 -58
  126. package/dist/lib/converter/comments/textParser.js +0 -372
  127. package/dist/lib/converter/components.js +0 -3
  128. package/dist/lib/converter/context.js +0 -311
  129. package/dist/lib/converter/convert-expression.js +0 -58
  130. package/dist/lib/converter/converter-events.js +0 -13
  131. package/dist/lib/converter/converter.js +0 -705
  132. package/dist/lib/converter/factories/index-signature.js +0 -50
  133. package/dist/lib/converter/factories/signature.js +0 -353
  134. package/dist/lib/converter/factories/symbol-id.js +0 -50
  135. package/dist/lib/converter/index.js +0 -3
  136. package/dist/lib/converter/jsdoc.js +0 -135
  137. package/dist/lib/converter/plugins/CategoryPlugin.js +0 -278
  138. package/dist/lib/converter/plugins/CommentPlugin.js +0 -770
  139. package/dist/lib/converter/plugins/GroupPlugin.js +0 -281
  140. package/dist/lib/converter/plugins/ImplementsPlugin.js +0 -438
  141. package/dist/lib/converter/plugins/IncludePlugin.js +0 -254
  142. package/dist/lib/converter/plugins/InheritDocPlugin.js +0 -220
  143. package/dist/lib/converter/plugins/LinkResolverPlugin.js +0 -88
  144. package/dist/lib/converter/plugins/MergeModuleWithPlugin.js +0 -50
  145. package/dist/lib/converter/plugins/PackagePlugin.js +0 -188
  146. package/dist/lib/converter/plugins/SourcePlugin.js +0 -215
  147. package/dist/lib/converter/plugins/TypePlugin.js +0 -108
  148. package/dist/lib/converter/plugins/index.js +0 -10
  149. package/dist/lib/converter/symbols.js +0 -861
  150. package/dist/lib/converter/types.js +0 -833
  151. package/dist/lib/converter/utils/nodes.js +0 -26
  152. package/dist/lib/converter/utils/reflections.js +0 -17
  153. package/dist/lib/converter/utils/repository.js +0 -295
  154. package/dist/lib/converter/utils/symbols.js +0 -12
  155. package/dist/lib/debug/index.js +0 -2
  156. package/dist/lib/debug/reflectionLifetimes.js +0 -27
  157. package/dist/lib/debug/rendererUrls.js +0 -68
  158. package/dist/lib/internationalization/index.js +0 -7
  159. package/dist/lib/internationalization/internationalization.js +0 -64
  160. package/dist/lib/internationalization/locale-utils.cjs +0 -8
  161. package/dist/lib/internationalization/locale-utils.d.cts +0 -8
  162. package/dist/lib/internationalization/locales/de.cjs +0 -401
  163. package/dist/lib/internationalization/locales/de.d.cts +0 -368
  164. package/dist/lib/internationalization/locales/en.cjs +0 -411
  165. package/dist/lib/internationalization/locales/ja.cjs +0 -320
  166. package/dist/lib/internationalization/locales/ja.d.cts +0 -307
  167. package/dist/lib/internationalization/locales/ko.cjs +0 -233
  168. package/dist/lib/internationalization/locales/ko.d.cts +0 -221
  169. package/dist/lib/internationalization/locales/zh.cjs +0 -488
  170. package/dist/lib/internationalization/locales/zh.d.cts +0 -452
  171. package/dist/lib/internationalization/translatable.js +0 -8
  172. package/dist/lib/models/Comment.js +0 -534
  173. package/dist/lib/models/ContainerReflection.js +0 -159
  174. package/dist/lib/models/DeclarationReflection.js +0 -287
  175. package/dist/lib/models/DocumentReflection.js +0 -66
  176. package/dist/lib/models/FileRegistry.js +0 -133
  177. package/dist/lib/models/ParameterReflection.js +0 -39
  178. package/dist/lib/models/ProjectReflection.js +0 -417
  179. package/dist/lib/models/ReferenceReflection.js +0 -85
  180. package/dist/lib/models/Reflection.js +0 -495
  181. package/dist/lib/models/ReflectionCategory.js +0 -56
  182. package/dist/lib/models/ReflectionGroup.js +0 -72
  183. package/dist/lib/models/ReflectionSymbolId.js +0 -85
  184. package/dist/lib/models/SignatureReflection.js +0 -96
  185. package/dist/lib/models/SourceReference.js +0 -50
  186. package/dist/lib/models/TypeParameterReflection.js +0 -45
  187. package/dist/lib/models/index.js +0 -19
  188. package/dist/lib/models/kind.js +0 -231
  189. package/dist/lib/models/types.js +0 -1296
  190. package/dist/lib/models/utils.js +0 -26
  191. package/dist/lib/models/variant.js +0 -1
  192. package/dist/lib/output/components.js +0 -133
  193. package/dist/lib/output/events.js +0 -195
  194. package/dist/lib/output/formatter.js +0 -660
  195. package/dist/lib/output/index.js +0 -7
  196. package/dist/lib/output/output.js +0 -92
  197. package/dist/lib/output/plugins/AssetsPlugin.js +0 -160
  198. package/dist/lib/output/plugins/HierarchyPlugin.js +0 -65
  199. package/dist/lib/output/plugins/IconsPlugin.js +0 -54
  200. package/dist/lib/output/plugins/JavascriptIndexPlugin.js +0 -222
  201. package/dist/lib/output/plugins/NavigationPlugin.js +0 -23
  202. package/dist/lib/output/plugins/SitemapPlugin.js +0 -82
  203. package/dist/lib/output/plugins/index.js +0 -7
  204. package/dist/lib/output/renderer.js +0 -387
  205. package/dist/lib/output/router.js +0 -520
  206. package/dist/lib/output/theme.js +0 -17
  207. package/dist/lib/output/themes/MarkedPlugin.js +0 -461
  208. package/dist/lib/output/themes/default/DefaultTheme.js +0 -367
  209. package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +0 -151
  210. package/dist/lib/output/themes/default/Slugger.js +0 -60
  211. package/dist/lib/output/themes/default/layouts/default.js +0 -89
  212. package/dist/lib/output/themes/default/partials/anchor-icon.js +0 -9
  213. package/dist/lib/output/themes/default/partials/breadcrumb.js +0 -11
  214. package/dist/lib/output/themes/default/partials/comment.js +0 -80
  215. package/dist/lib/output/themes/default/partials/footer.js +0 -37
  216. package/dist/lib/output/themes/default/partials/header.js +0 -39
  217. package/dist/lib/output/themes/default/partials/hierarchy.js +0 -32
  218. package/dist/lib/output/themes/default/partials/icon.js +0 -101
  219. package/dist/lib/output/themes/default/partials/index.js +0 -24
  220. package/dist/lib/output/themes/default/partials/member.declaration.js +0 -35
  221. package/dist/lib/output/themes/default/partials/member.getterSetter.js +0 -12
  222. package/dist/lib/output/themes/default/partials/member.js +0 -36
  223. package/dist/lib/output/themes/default/partials/member.signature.body.js +0 -33
  224. package/dist/lib/output/themes/default/partials/member.signature.title.js +0 -9
  225. package/dist/lib/output/themes/default/partials/member.signatures.js +0 -9
  226. package/dist/lib/output/themes/default/partials/member.sources.js +0 -55
  227. package/dist/lib/output/themes/default/partials/members.js +0 -17
  228. package/dist/lib/output/themes/default/partials/moduleReflection.js +0 -68
  229. package/dist/lib/output/themes/default/partials/navigation.js +0 -144
  230. package/dist/lib/output/themes/default/partials/reflectionPreview.js +0 -26
  231. package/dist/lib/output/themes/default/partials/toolbar.js +0 -13
  232. package/dist/lib/output/themes/default/partials/type.js +0 -9
  233. package/dist/lib/output/themes/default/partials/typeAndParent.js +0 -28
  234. package/dist/lib/output/themes/default/partials/typeDetails.js +0 -284
  235. package/dist/lib/output/themes/default/partials/typeParameters.js +0 -26
  236. package/dist/lib/output/themes/default/templates/document.js +0 -3
  237. package/dist/lib/output/themes/default/templates/hierarchy.js +0 -31
  238. package/dist/lib/output/themes/default/templates/index.js +0 -3
  239. package/dist/lib/output/themes/default/templates/reflection.js +0 -53
  240. package/dist/lib/output/themes/lib.js +0 -218
  241. package/dist/lib/serialization/components.js +0 -1
  242. package/dist/lib/serialization/deserializer.js +0 -235
  243. package/dist/lib/serialization/events.js +0 -18
  244. package/dist/lib/serialization/index.js +0 -4
  245. package/dist/lib/serialization/schema.js +0 -32
  246. package/dist/lib/serialization/serializer.js +0 -65
  247. package/dist/lib/utils/ValidatingFileRegistry.js +0 -52
  248. package/dist/lib/utils/component.js +0 -41
  249. package/dist/lib/utils/compress.js +0 -13
  250. package/dist/lib/utils/declaration-maps.js +0 -51
  251. package/dist/lib/utils/entry-point.js +0 -330
  252. package/dist/lib/utils/fs.js +0 -372
  253. package/dist/lib/utils/general.js +0 -25
  254. package/dist/lib/utils/highlighter.js +0 -150
  255. package/dist/lib/utils/html-entities.js +0 -2329
  256. package/dist/lib/utils/html.js +0 -635
  257. package/dist/lib/utils/index.d.ts +0 -17
  258. package/dist/lib/utils/index.js +0 -15
  259. package/dist/lib/utils/loggers.js +0 -71
  260. package/dist/lib/utils/options/declaration.js +0 -443
  261. package/dist/lib/utils/options/defaults.js +0 -104
  262. package/dist/lib/utils/options/help.js +0 -63
  263. package/dist/lib/utils/options/index.js +0 -4
  264. package/dist/lib/utils/options/options.js +0 -273
  265. package/dist/lib/utils/options/readers/arguments.js +0 -109
  266. package/dist/lib/utils/options/readers/index.js +0 -4
  267. package/dist/lib/utils/options/readers/package-json.js +0 -40
  268. package/dist/lib/utils/options/readers/tsconfig.js +0 -172
  269. package/dist/lib/utils/options/readers/typedoc.js +0 -136
  270. package/dist/lib/utils/options/sources/index.js +0 -1
  271. package/dist/lib/utils/options/sources/typedoc.js +0 -876
  272. package/dist/lib/utils/options/tsdoc-defaults.js +0 -94
  273. package/dist/lib/utils/package-manifest.js +0 -84
  274. package/dist/lib/utils/paths.js +0 -127
  275. package/dist/lib/utils/perf.js +0 -86
  276. package/dist/lib/utils/plugins.js +0 -61
  277. package/dist/lib/utils/reflections.js +0 -64
  278. package/dist/lib/utils/sort.js +0 -153
  279. package/dist/lib/utils/tsconfig.js +0 -60
  280. package/dist/lib/utils/tsutils.js +0 -23
  281. package/dist/lib/utils-common/array.js +0 -152
  282. package/dist/lib/utils-common/declarationReference.js +0 -341
  283. package/dist/lib/utils-common/enum.js +0 -27
  284. package/dist/lib/utils-common/events.js +0 -49
  285. package/dist/lib/utils-common/general.js +0 -22
  286. package/dist/lib/utils-common/hooks.js +0 -90
  287. package/dist/lib/utils-common/i18n.js +0 -39
  288. package/dist/lib/utils-common/index.js +0 -17
  289. package/dist/lib/utils-common/jsx.elements.js +0 -3
  290. package/dist/lib/utils-common/jsx.js +0 -187
  291. package/dist/lib/utils-common/logger.js +0 -129
  292. package/dist/lib/utils-common/map.js +0 -63
  293. package/dist/lib/utils-common/minimalSourceFile.js +0 -43
  294. package/dist/lib/utils-common/path.js +0 -130
  295. package/dist/lib/utils-common/set.js +0 -23
  296. package/dist/lib/utils-common/string.js +0 -84
  297. package/dist/lib/utils-common/validation.js +0 -50
  298. package/dist/lib/validation/documentation.js +0 -91
  299. package/dist/lib/validation/exports.js +0 -65
  300. package/dist/lib/validation/links.js +0 -78
  301. package/dist/lib/validation/unusedMergeModuleWith.js +0 -12
  302. /package/dist/{browser-utils.d.ts → types/browser-utils.d.ts} +0 -0
  303. /package/dist/{lib → types}/cli.d.ts +0 -0
  304. /package/dist/{lib → types}/converter/comments/blockLexer.d.ts +0 -0
  305. /package/dist/{lib → types}/converter/comments/lineLexer.d.ts +0 -0
  306. /package/dist/{lib → types}/converter/comments/rawLexer.d.ts +0 -0
  307. /package/dist/{lib → types}/converter/comments/tagName.d.ts +0 -0
  308. /package/dist/{lib → types}/converter/convert-expression.d.ts +0 -0
  309. /package/dist/{lib → types}/converter/converter-events.d.ts +0 -0
  310. /package/dist/{lib → types}/converter/factories/index-signature.d.ts +0 -0
  311. /package/dist/{lib → types}/converter/factories/symbol-id.d.ts +0 -0
  312. /package/dist/{lib → types}/converter/jsdoc.d.ts +0 -0
  313. /package/dist/{lib → types}/converter/plugins/CommentPlugin.d.ts +0 -0
  314. /package/dist/{lib → types}/converter/plugins/ImplementsPlugin.d.ts +0 -0
  315. /package/dist/{lib → types}/converter/plugins/MergeModuleWithPlugin.d.ts +0 -0
  316. /package/dist/{lib → types}/converter/plugins/PackagePlugin.d.ts +0 -0
  317. /package/dist/{lib → types}/converter/plugins/index.d.ts +0 -0
  318. /package/dist/{lib → types}/converter/symbols.d.ts +0 -0
  319. /package/dist/{lib/converter/utils → types/converter/utilities}/nodes.d.ts +0 -0
  320. /package/dist/{lib/converter/utils → types/converter/utilities}/symbols.d.ts +0 -0
  321. /package/dist/{lib → types}/debug/index.d.ts +0 -0
  322. /package/dist/{lib → types}/debug/reflectionLifetimes.d.ts +0 -0
  323. /package/dist/{lib → types}/debug/rendererUrls.d.ts +0 -0
  324. /package/dist/{lib → types}/internationalization/index.d.ts +0 -0
  325. /package/dist/{lib → types}/models/Comment.d.ts +0 -0
  326. /package/dist/{lib → types}/models/ContainerReflection.d.ts +0 -0
  327. /package/dist/{lib → types}/models/DeclarationReflection.d.ts +0 -0
  328. /package/dist/{lib → types}/models/DocumentReflection.d.ts +0 -0
  329. /package/dist/{lib → types}/models/ParameterReflection.d.ts +0 -0
  330. /package/dist/{lib → types}/models/ProjectReflection.d.ts +0 -0
  331. /package/dist/{lib → types}/models/ReferenceReflection.d.ts +0 -0
  332. /package/dist/{lib → types}/models/Reflection.d.ts +0 -0
  333. /package/dist/{lib → types}/models/ReflectionCategory.d.ts +0 -0
  334. /package/dist/{lib → types}/models/ReflectionGroup.d.ts +0 -0
  335. /package/dist/{lib → types}/models/SignatureReflection.d.ts +0 -0
  336. /package/dist/{lib → types}/models/TypeParameterReflection.d.ts +0 -0
  337. /package/dist/{lib → types}/models/index.d.ts +0 -0
  338. /package/dist/{lib → types}/models/kind.d.ts +0 -0
  339. /package/dist/{lib → types}/models/types.d.ts +0 -0
  340. /package/dist/{lib → types}/models/utils.d.ts +0 -0
  341. /package/dist/{lib → types}/models/variant.d.ts +0 -0
  342. /package/dist/{lib → types}/output/index.d.ts +0 -0
  343. /package/dist/{lib → types}/output/plugins/AssetsPlugin.d.ts +0 -0
  344. /package/dist/{lib → types}/output/plugins/HierarchyPlugin.d.ts +0 -0
  345. /package/dist/{lib → types}/output/plugins/IconsPlugin.d.ts +0 -0
  346. /package/dist/{lib → types}/output/plugins/JavascriptIndexPlugin.d.ts +0 -0
  347. /package/dist/{lib → types}/output/plugins/NavigationPlugin.d.ts +0 -0
  348. /package/dist/{lib → types}/output/plugins/SitemapPlugin.d.ts +0 -0
  349. /package/dist/{lib → types}/output/plugins/index.d.ts +0 -0
  350. /package/dist/{lib → types}/output/theme.d.ts +0 -0
  351. /package/dist/{lib → types}/output/themes/default/Slugger.d.ts +0 -0
  352. /package/dist/{lib → types}/output/themes/default/partials/footer.d.ts +0 -0
  353. /package/dist/{lib → types}/output/themes/default/partials/member.declaration.d.ts +0 -0
  354. /package/dist/{lib → types}/output/themes/default/partials/typeAndParent.d.ts +0 -0
  355. /package/dist/{lib → types}/serialization/components.d.ts +0 -0
  356. /package/dist/{lib → types}/serialization/deserializer.d.ts +0 -0
  357. /package/dist/{lib → types}/serialization/events.d.ts +0 -0
  358. /package/dist/{lib → types}/serialization/index.d.ts +0 -0
  359. /package/dist/{lib → types}/serialization/schema.d.ts +0 -0
  360. /package/dist/{lib → types}/serialization/serializer.d.ts +0 -0
  361. /package/dist/{lib → types}/utils/component.d.ts +0 -0
  362. /package/dist/{lib → types}/utils/compress.d.ts +0 -0
  363. /package/dist/{lib → types}/utils/declaration-maps.d.ts +0 -0
  364. /package/dist/{lib → types}/utils/fs.d.ts +0 -0
  365. /package/dist/{lib → types}/utils/highlighter.d.ts +0 -0
  366. /package/dist/{lib → types}/utils/html-entities.d.ts +0 -0
  367. /package/dist/{lib → types}/utils/html.d.ts +0 -0
  368. /package/dist/{lib → types}/utils/loggers.d.ts +0 -0
  369. /package/dist/{lib → types}/utils/options/help.d.ts +0 -0
  370. /package/dist/{lib → types}/utils/options/readers/arguments.d.ts +0 -0
  371. /package/dist/{lib → types}/utils/options/readers/index.d.ts +0 -0
  372. /package/dist/{lib → types}/utils/options/readers/package-json.d.ts +0 -0
  373. /package/dist/{lib → types}/utils/options/readers/tsconfig.d.ts +0 -0
  374. /package/dist/{lib → types}/utils/options/readers/typedoc.d.ts +0 -0
  375. /package/dist/{lib → types}/utils/options/sources/index.d.ts +0 -0
  376. /package/dist/{lib → types}/utils/options/sources/typedoc.d.ts +0 -0
  377. /package/dist/{lib → types}/utils/package-manifest.d.ts +0 -0
  378. /package/dist/{lib → types}/utils/paths.d.ts +0 -0
  379. /package/dist/{lib → types}/utils/perf.d.ts +0 -0
  380. /package/dist/{lib → types}/utils/plugins.d.ts +0 -0
  381. /package/dist/{lib → types}/utils/tsconfig.d.ts +0 -0
  382. /package/dist/{lib → types}/utils/tsutils.d.ts +0 -0
  383. /package/dist/{lib → types}/utils-common/array.d.ts +0 -0
  384. /package/dist/{lib → types}/utils-common/declarationReference.d.ts +0 -0
  385. /package/dist/{lib → types}/utils-common/enum.d.ts +0 -0
  386. /package/dist/{lib → types}/utils-common/events.d.ts +0 -0
  387. /package/dist/{lib → types}/utils-common/hooks.d.ts +0 -0
  388. /package/dist/{lib → types}/utils-common/i18n.d.ts +0 -0
  389. /package/dist/{lib → types}/utils-common/index.d.ts +0 -0
  390. /package/dist/{lib → types}/utils-common/jsx.d.ts +0 -0
  391. /package/dist/{lib → types}/utils-common/logger.d.ts +0 -0
  392. /package/dist/{lib → types}/utils-common/map.d.ts +0 -0
  393. /package/dist/{lib → types}/utils-common/minimalSourceFile.d.ts +0 -0
  394. /package/dist/{lib → types}/utils-common/path.d.ts +0 -0
  395. /package/dist/{lib → types}/utils-common/set.d.ts +0 -0
  396. /package/dist/{lib → types}/utils-common/string.d.ts +0 -0
  397. /package/dist/{lib → types}/utils-common/validation.d.ts +0 -0
@@ -1,50 +0,0 @@
1
- import assert from "assert";
2
- import { DeclarationReflection, ParameterReflection, ReflectionFlag, ReflectionKind, SignatureReflection, UnionType, } from "../../models/index.js";
3
- import { ConverterEvents } from "../converter-events.js";
4
- export function convertIndexSignatures(context, type) {
5
- assert(context.scope instanceof DeclarationReflection);
6
- // Each declaration should have one SignatureReflection
7
- // If we don't have a declaration, the index signature was inferred by TS
8
- // and we should make a separate SignatureReflection for each index signature.
9
- const seenByDeclaration = new Map();
10
- const createdSignatures = [];
11
- for (const indexInfo of context.checker.getIndexInfosOfType(type)) {
12
- // Check if we've already created an index signature for this type
13
- if (indexInfo.declaration &&
14
- seenByDeclaration.has(indexInfo.declaration)) {
15
- const createdSig = seenByDeclaration.get(indexInfo.declaration);
16
- if (createdSig.parameters[0].type?.type !== "union") {
17
- createdSig.parameters[0].type = new UnionType([
18
- createdSig.parameters[0].type,
19
- ]);
20
- }
21
- createdSig.parameters[0].type.types.push(context.converter.convertType(context.withScope(createdSig), indexInfo.keyType));
22
- // No need to update the return type as it will be the same for all members.
23
- continue;
24
- }
25
- // Otherwise create a new one
26
- const index = new SignatureReflection("__index", ReflectionKind.IndexSignature, context.scope);
27
- const ic = context.withScope(index);
28
- if (indexInfo.isReadonly) {
29
- index.setFlag(ReflectionFlag.Readonly);
30
- }
31
- createdSignatures.push([indexInfo.declaration, index]);
32
- if (indexInfo.declaration) {
33
- seenByDeclaration.set(indexInfo.declaration, index);
34
- index.comment = context.getNodeComment(indexInfo.declaration,
35
- /* moduleComment */ false);
36
- }
37
- index.parameters = [
38
- new ParameterReflection(indexInfo.declaration?.parameters[0].name.getText() ?? "key", ReflectionKind.Parameter, index),
39
- ];
40
- index.parameters[0].type = context.converter.convertType(ic.withScope(index.parameters[0]), indexInfo.keyType);
41
- index.type = context.converter.convertType(ic, indexInfo.type);
42
- context.registerReflection(index, indexInfo.declaration?.symbol);
43
- context.scope.indexSignatures ||= [];
44
- context.scope.indexSignatures.push(index);
45
- }
46
- // Now that we've created everything, trigger events for them.
47
- for (const [declaration, index] of createdSignatures) {
48
- context.converter.trigger(ConverterEvents.CREATE_SIGNATURE, context, index, declaration);
49
- }
50
- }
@@ -1,353 +0,0 @@
1
- import ts from "typescript";
2
- import assert from "assert";
3
- import { DeclarationReflection, IntrinsicType, ParameterReflection, PredicateType, ReferenceType, ReflectionFlag, ReflectionKind, SignatureReflection, TypeParameterReflection, VarianceModifier, } from "../../models/index.js";
4
- import { ConverterEvents } from "../converter-events.js";
5
- import { convertDefaultValue } from "../convert-expression.js";
6
- import { removeUndefined } from "../utils/reflections.js";
7
- export function convertConstructSignatures(context, symbol) {
8
- const type = context.checker.getDeclaredTypeOfSymbol(symbol);
9
- // These get added as a "constructor" member of this interface. This is a problem... but nobody
10
- // has complained yet. We really ought to have a constructSignatures property on the reflection instead.
11
- const constructSignatures = context.checker.getSignaturesOfType(type, ts.SignatureKind.Construct);
12
- if (constructSignatures.length) {
13
- const constructMember = new DeclarationReflection("constructor", ReflectionKind.Constructor, context.scope);
14
- context.postReflectionCreation(constructMember, symbol, void 0);
15
- context.finalizeDeclarationReflection(constructMember);
16
- const constructContext = context.withScope(constructMember);
17
- constructSignatures.forEach((sig) => createSignature(constructContext, ReflectionKind.ConstructorSignature, sig, symbol));
18
- }
19
- }
20
- export function createSignature(context, kind, signature, symbol, declaration) {
21
- assert(context.scope instanceof DeclarationReflection);
22
- declaration ||= signature.getDeclaration();
23
- const sigRef = new SignatureReflection(kind == ReflectionKind.ConstructorSignature
24
- ? context.scope.parent.name
25
- : context.scope.name, kind, context.scope);
26
- // This feels awful, but we need some way to tell if callable signatures on classes
27
- // are "static" (e.g. `Foo()`) or not (e.g. `(new Foo())()`)
28
- if (context.shouldBeStatic) {
29
- sigRef.setFlag(ReflectionFlag.Static);
30
- }
31
- if (symbol && declaration) {
32
- context.project.registerSymbolId(sigRef, context.createSymbolId(symbol, declaration));
33
- }
34
- let parentReflection = context.scope;
35
- if (parentReflection.kindOf(ReflectionKind.TypeLiteral) &&
36
- parentReflection.parent instanceof DeclarationReflection) {
37
- parentReflection = parentReflection.parent;
38
- }
39
- if (declaration) {
40
- const sigComment = context.getSignatureComment(declaration);
41
- if (parentReflection.comment?.discoveryId !== sigComment?.discoveryId) {
42
- sigRef.comment = sigComment;
43
- if (parentReflection.kindOf(ReflectionKind.MayContainDocuments)) {
44
- context.converter.processDocumentTags(sigRef, parentReflection);
45
- }
46
- }
47
- }
48
- const sigRefCtx = context.withScope(sigRef);
49
- sigRef.typeParameters = convertTypeParameters(sigRefCtx, sigRef, signature.typeParameters);
50
- const parameterSymbols = signature.thisParameter
51
- ? [signature.thisParameter, ...signature.parameters]
52
- : signature.parameters;
53
- sigRef.parameters = convertParameters(sigRefCtx, sigRef, parameterSymbols, declaration?.parameters);
54
- const predicate = context.checker.getTypePredicateOfSignature(signature);
55
- if (predicate) {
56
- sigRef.type = convertPredicate(predicate, sigRefCtx);
57
- }
58
- else if (kind == ReflectionKind.SetSignature) {
59
- sigRef.type = new IntrinsicType("void");
60
- }
61
- else if (declaration?.type?.kind === ts.SyntaxKind.ThisType) {
62
- sigRef.type = new IntrinsicType("this");
63
- }
64
- else {
65
- let typeNode = declaration?.type;
66
- if (typeNode && ts.isJSDocReturnTag(typeNode)) {
67
- typeNode = typeNode.typeExpression?.type;
68
- }
69
- sigRef.type = context.converter.convertType(sigRefCtx, signature.getReturnType(), typeNode);
70
- }
71
- context.registerReflection(sigRef, undefined);
72
- switch (kind) {
73
- case ReflectionKind.GetSignature:
74
- context.scope.getSignature = sigRef;
75
- break;
76
- case ReflectionKind.SetSignature:
77
- context.scope.setSignature = sigRef;
78
- break;
79
- case ReflectionKind.CallSignature:
80
- case ReflectionKind.ConstructorSignature:
81
- context.scope.signatures ??= [];
82
- context.scope.signatures.push(sigRef);
83
- break;
84
- }
85
- context.converter.trigger(ConverterEvents.CREATE_SIGNATURE, context, sigRef, declaration, signature);
86
- }
87
- /**
88
- * Special cased constructor factory for functions tagged with `@class`
89
- */
90
- export function createConstructSignatureWithType(context, signature, classType) {
91
- assert(context.scope instanceof DeclarationReflection);
92
- const declaration = signature.getDeclaration();
93
- const sigRef = new SignatureReflection(context.scope.parent.name, ReflectionKind.ConstructorSignature, context.scope);
94
- const sigRefCtx = context.withScope(sigRef);
95
- if (declaration) {
96
- sigRef.comment = context.getSignatureComment(declaration);
97
- if (sigRef.comment?.discoveryId === context.scope.parent?.comment?.discoveryId) {
98
- delete sigRef.comment;
99
- }
100
- }
101
- const parameterSymbols = signature.thisParameter
102
- ? [signature.thisParameter, ...signature.parameters]
103
- : [...signature.parameters];
104
- // Prevent a `this` parameter from appearing on constructor signature
105
- // as TS disallows them on regular classes.
106
- if (parameterSymbols[0]?.name === "this") {
107
- parameterSymbols.shift();
108
- }
109
- sigRef.parameters = convertParameters(sigRefCtx, sigRef, parameterSymbols, declaration?.parameters);
110
- sigRef.parameters = convertParameters(sigRefCtx, sigRef, parameterSymbols, undefined);
111
- // Do NOT convert type parameters here, they go on the class itself in the @class case
112
- // See #2914.
113
- sigRef.type = ReferenceType.createResolvedReference(context.scope.parent.name, classType, context.project);
114
- context.registerReflection(sigRef, undefined);
115
- context.scope.signatures ??= [];
116
- context.scope.signatures.push(sigRef);
117
- context.converter.trigger(ConverterEvents.CREATE_SIGNATURE, context, sigRef, declaration, signature);
118
- }
119
- function convertParameters(context, sigRef, parameters, parameterNodes) {
120
- // #2698 if `satisfies` is used to imply a this parameter, we might have
121
- // more parameters than parameter nodes and need to shift the parameterNode
122
- // access index. Very ugly, but it does the job.
123
- const parameterNodeOffset = parameterNodes?.length !== parameters.length ? -1 : 0;
124
- return parameters.map((param, i) => {
125
- const declaration = param.valueDeclaration;
126
- assert(!declaration ||
127
- ts.isParameter(declaration) ||
128
- ts.isJSDocParameterTag(declaration));
129
- const paramRefl = new ParameterReflection(/^__\d+$/.test(param.name) ? "__namedParameters" : param.name, ReflectionKind.Parameter, sigRef);
130
- if (declaration && ts.isJSDocParameterTag(declaration)) {
131
- paramRefl.comment = context.getJsDocComment(declaration);
132
- }
133
- paramRefl.comment ||= context.getComment(param, paramRefl.kind);
134
- context.registerReflection(paramRefl, param);
135
- context.converter.trigger(ConverterEvents.CREATE_PARAMETER, context, paramRefl);
136
- let type;
137
- let typeNode;
138
- if (declaration) {
139
- type = context.checker.getTypeOfSymbolAtLocation(param, declaration);
140
- if (ts.isParameter(declaration)) {
141
- typeNode = declaration.type;
142
- }
143
- else {
144
- typeNode = declaration.typeExpression?.type;
145
- }
146
- }
147
- else {
148
- type = context.checker.getTypeOfSymbol(param);
149
- }
150
- if (declaration &&
151
- ts.isParameter(declaration) &&
152
- declaration.type?.kind === ts.SyntaxKind.ThisType) {
153
- paramRefl.type = new IntrinsicType("this");
154
- }
155
- else if (!type) {
156
- paramRefl.type = new IntrinsicType("any");
157
- }
158
- else {
159
- paramRefl.type = context.converter.convertType(context.withScope(paramRefl), type, typeNode);
160
- }
161
- let isOptional = false;
162
- if (declaration) {
163
- isOptional = ts.isParameter(declaration)
164
- ? !!declaration.questionToken ||
165
- ts
166
- .getJSDocParameterTags(declaration)
167
- .some((tag) => tag.isBracketed)
168
- : declaration.isBracketed;
169
- }
170
- if (isOptional) {
171
- paramRefl.type = removeUndefined(paramRefl.type);
172
- }
173
- paramRefl.defaultValue = convertDefaultValue(parameterNodes?.[i + parameterNodeOffset]);
174
- paramRefl.setFlag(ReflectionFlag.Optional, isOptional);
175
- // If we have no declaration, then this is an implicitly defined parameter in JS land
176
- // because the method body uses `arguments`... which is always a rest argument,
177
- // unless it is a this parameter defined with @this in JSDoc.
178
- let isRest = param.name !== "this";
179
- if (declaration) {
180
- isRest = ts.isParameter(declaration)
181
- ? !!declaration.dotDotDotToken
182
- : !!declaration.typeExpression &&
183
- ts.isJSDocVariadicType(declaration.typeExpression.type);
184
- }
185
- paramRefl.setFlag(ReflectionFlag.Rest, isRest);
186
- checkForDestructuredParameterDefaults(paramRefl, parameterNodes?.[i + parameterNodeOffset]);
187
- return paramRefl;
188
- });
189
- }
190
- export function convertParameterNodes(context, sigRef, parameters) {
191
- return parameters.map((param) => {
192
- const paramRefl = new ParameterReflection(/__\d+/.test(param.name.getText())
193
- ? "__namedParameters"
194
- : param.name.getText(), ReflectionKind.Parameter, sigRef);
195
- if (ts.isJSDocParameterTag(param)) {
196
- paramRefl.comment = context.getJsDocComment(param);
197
- }
198
- context.registerReflection(paramRefl, context.getSymbolAtLocation(param));
199
- context.converter.trigger(ConverterEvents.CREATE_PARAMETER, context, paramRefl);
200
- paramRefl.type = context.converter.convertType(context.withScope(paramRefl), ts.isParameter(param) ? param.type : param.typeExpression?.type);
201
- const isOptional = ts.isParameter(param)
202
- ? !!param.questionToken
203
- : param.isBracketed;
204
- if (isOptional) {
205
- paramRefl.type = removeUndefined(paramRefl.type);
206
- }
207
- paramRefl.defaultValue = convertDefaultValue(param);
208
- paramRefl.setFlag(ReflectionFlag.Optional, isOptional);
209
- paramRefl.setFlag(ReflectionFlag.Rest, ts.isParameter(param)
210
- ? !!param.dotDotDotToken
211
- : !!param.typeExpression &&
212
- ts.isJSDocVariadicType(param.typeExpression.type));
213
- checkForDestructuredParameterDefaults(paramRefl, param);
214
- return paramRefl;
215
- });
216
- }
217
- function checkForDestructuredParameterDefaults(param, decl) {
218
- if (!decl || !ts.isParameter(decl))
219
- return;
220
- if (param.name !== "__namedParameters")
221
- return;
222
- if (!ts.isObjectBindingPattern(decl.name))
223
- return;
224
- if (param.type?.type !== "reflection")
225
- return;
226
- for (const child of param.type.declaration.children || []) {
227
- const tsChild = decl.name.elements.find((el) => (el.propertyName || el.name).getText() === child.name);
228
- if (tsChild) {
229
- child.defaultValue = convertDefaultValue(tsChild);
230
- }
231
- }
232
- }
233
- export function convertTypeParameters(context, parent, parameters) {
234
- return parameters?.map((param) => {
235
- const constraintT = param.getConstraint();
236
- const defaultT = param.getDefault();
237
- // There's no way to determine directly from a ts.TypeParameter what it's variance modifiers are
238
- // so unfortunately we have to go back to the node for this...
239
- const declaration = param
240
- .getSymbol()
241
- ?.declarations?.find(ts.isTypeParameterDeclaration);
242
- const variance = getVariance(declaration?.modifiers);
243
- const paramRefl = new TypeParameterReflection(param.symbol.name, parent, variance);
244
- const paramCtx = context.withScope(paramRefl);
245
- paramRefl.type = constraintT
246
- ? context.converter.convertType(paramCtx, constraintT)
247
- : void 0;
248
- paramRefl.default = defaultT
249
- ? context.converter.convertType(paramCtx, defaultT)
250
- : void 0;
251
- // No way to determine this from the type parameter itself, need to go back to the declaration
252
- if (declaration?.modifiers?.some((m) => m.kind === ts.SyntaxKind.ConstKeyword)) {
253
- paramRefl.flags.setFlag(ReflectionFlag.Const, true);
254
- }
255
- context.registerReflection(paramRefl, param.getSymbol());
256
- context.converter.trigger(ConverterEvents.CREATE_TYPE_PARAMETER, context, paramRefl);
257
- return paramRefl;
258
- });
259
- }
260
- export function convertTypeParameterNodes(context, parameters) {
261
- return parameters?.map((param) => createTypeParamReflection(param, context));
262
- }
263
- export function createTypeParamReflection(param, context) {
264
- const paramRefl = new TypeParameterReflection(param.name.text, context.scope, getVariance(param.modifiers));
265
- const paramScope = context.withScope(paramRefl);
266
- if (ts.isJSDocTemplateTag(param.parent)) {
267
- // With a @template tag, the constraint applies only to the
268
- // first type parameter declared.
269
- if (param.parent.typeParameters[0].name.text === param.name.text && param.parent.constraint) {
270
- paramRefl.type = context.converter.convertType(paramScope, param.parent.constraint);
271
- }
272
- }
273
- else {
274
- paramRefl.type = param.constraint
275
- ? context.converter.convertType(paramScope, param.constraint)
276
- : void 0;
277
- }
278
- paramRefl.default = param.default
279
- ? context.converter.convertType(paramScope, param.default)
280
- : void 0;
281
- if (param.modifiers?.some((m) => m.kind === ts.SyntaxKind.ConstKeyword)) {
282
- paramRefl.flags.setFlag(ReflectionFlag.Const, true);
283
- }
284
- context.registerReflection(paramRefl, param.symbol);
285
- if (ts.isJSDocTemplateTag(param.parent)) {
286
- paramRefl.comment = context.getJsDocComment(param.parent);
287
- }
288
- context.converter.trigger(ConverterEvents.CREATE_TYPE_PARAMETER, context, paramRefl, param);
289
- return paramRefl;
290
- }
291
- export function convertTemplateParameterNodes(context, nodes) {
292
- return nodes?.flatMap((node) => {
293
- return node.typeParameters.map((param, index) => {
294
- const paramRefl = new TypeParameterReflection(param.name.text, context.scope, getVariance(param.modifiers));
295
- const paramScope = context.withScope(paramRefl);
296
- paramRefl.type = index || !node.constraint
297
- ? void 0
298
- : context.converter.convertType(paramScope, node.constraint.type);
299
- paramRefl.default = param.default
300
- ? context.converter.convertType(paramScope, param.default)
301
- : void 0;
302
- if (param.modifiers?.some((m) => m.kind === ts.SyntaxKind.ConstKeyword)) {
303
- paramRefl.flags.setFlag(ReflectionFlag.Const, true);
304
- }
305
- context.registerReflection(paramRefl, param.symbol);
306
- if (ts.isJSDocTemplateTag(param.parent)) {
307
- paramRefl.comment = context.getJsDocComment(param.parent);
308
- }
309
- context.converter.trigger(ConverterEvents.CREATE_TYPE_PARAMETER, context, paramRefl, param);
310
- return paramRefl;
311
- });
312
- });
313
- }
314
- function getVariance(modifiers) {
315
- const hasIn = modifiers?.some((mod) => mod.kind === ts.SyntaxKind.InKeyword);
316
- const hasOut = modifiers?.some((mod) => mod.kind === ts.SyntaxKind.OutKeyword);
317
- if (hasIn && hasOut) {
318
- return VarianceModifier.inOut;
319
- }
320
- if (hasIn) {
321
- return VarianceModifier.in;
322
- }
323
- if (hasOut) {
324
- return VarianceModifier.out;
325
- }
326
- }
327
- function convertPredicate(predicate, context) {
328
- let name;
329
- switch (predicate.kind) {
330
- case ts.TypePredicateKind.This:
331
- case ts.TypePredicateKind.AssertsThis:
332
- name = "this";
333
- break;
334
- case ts.TypePredicateKind.Identifier:
335
- case ts.TypePredicateKind.AssertsIdentifier:
336
- name = predicate.parameterName;
337
- break;
338
- }
339
- let asserts;
340
- switch (predicate.kind) {
341
- case ts.TypePredicateKind.This:
342
- case ts.TypePredicateKind.Identifier:
343
- asserts = false;
344
- break;
345
- case ts.TypePredicateKind.AssertsThis:
346
- case ts.TypePredicateKind.AssertsIdentifier:
347
- asserts = true;
348
- break;
349
- }
350
- return new PredicateType(name, asserts, predicate.type
351
- ? context.converter.convertType(context, predicate.type)
352
- : void 0);
353
- }
@@ -1,50 +0,0 @@
1
- import { ReflectionSymbolId } from "#models";
2
- import { findPackageForPath, getQualifiedName, normalizePath, resolveDeclarationMaps } from "#node-utils";
3
- import {} from "#utils";
4
- import { relative } from "node:path";
5
- import ts from "typescript";
6
- let transientCount = 0;
7
- const transientIds = new WeakMap();
8
- // Don't use this directly, use Context.createSymbolId instead.
9
- export function createSymbolIdImpl(symbol, declaration) {
10
- declaration ??= symbol.declarations?.[0];
11
- const tsSource = declaration?.getSourceFile().fileName ?? "";
12
- const sourceFileName = resolveDeclarationMaps(tsSource);
13
- let packageName;
14
- let packagePath;
15
- const packageInfo = findPackageForPath(tsSource);
16
- if (packageInfo) {
17
- let packageDir;
18
- [packageName, packageDir] = packageInfo;
19
- packagePath = normalizePath(relative(packageDir, sourceFileName));
20
- }
21
- else {
22
- packageName = ReflectionSymbolId.UNKNOWN_PACKAGE;
23
- packagePath = normalizePath(sourceFileName);
24
- }
25
- let qualifiedName;
26
- if (symbol.declarations?.some(ts.isSourceFile)) {
27
- qualifiedName = "";
28
- }
29
- else {
30
- qualifiedName = getQualifiedName(symbol, symbol.name);
31
- }
32
- const pos = declaration?.getStart() ?? Infinity;
33
- // Transient symbols may need to be tagged as such to disambiguate between references
34
- // to generic classes/interfaces/aliases. However esModuleInterop can also introduce
35
- // transient symbols for modules, which we don't want to catch here.
36
- let transientId = NaN;
37
- if ((symbol.flags & ts.SymbolFlags.Transient) && declaration?.kind !== ts.SyntaxKind.SourceFile) {
38
- transientId = transientIds.get(symbol) ?? ++transientCount;
39
- transientIds.set(symbol, transientId);
40
- }
41
- const id = new ReflectionSymbolId({
42
- packageName,
43
- packagePath,
44
- qualifiedName,
45
- });
46
- id.pos = pos;
47
- id.transientId = transientId;
48
- id.fileName = normalizePath(sourceFileName);
49
- return id;
50
- }
@@ -1,3 +0,0 @@
1
- export { Context } from "./context.js";
2
- export { convertDefaultValue, convertExpression } from "./convert-expression.js";
3
- export { Converter } from "./converter.js";
@@ -1,135 +0,0 @@
1
- // Converter functions for JSDoc defined types
2
- // @typedef
3
- // @callback
4
- import { ok } from "assert";
5
- import ts from "typescript";
6
- import { DeclarationReflection, IntrinsicType, ReflectionKind, ReflectionType, SignatureReflection, } from "../models/index.js";
7
- import { ConverterEvents } from "./converter-events.js";
8
- import { convertConstructSignatures, convertParameterNodes, convertTemplateParameterNodes, createSignature, } from "./factories/signature.js";
9
- import { i18n } from "#utils";
10
- import { convertIndexSignatures } from "./factories/index-signature.js";
11
- // This is almost convertTypeAliasAsInterface, but unfortunately needs to be separate
12
- // due to type parameters being different in JSDoc comments
13
- function convertJsDocAliasAsInterface(context, symbol, exportSymbol, declaration) {
14
- const reflection = context.createDeclarationReflection(ReflectionKind.Interface, symbol, exportSymbol);
15
- context.finalizeDeclarationReflection(reflection);
16
- const rc = context.withScope(reflection);
17
- const type = context.checker.getTypeAtLocation(declaration);
18
- if (type.getFlags() & ts.TypeFlags.Union) {
19
- context.logger.warn(i18n.converting_union_as_interface(), declaration);
20
- }
21
- // Interfaces have properties
22
- for (const prop of type.getProperties()) {
23
- context.converter.convertSymbol(rc, prop);
24
- }
25
- // And type parameters
26
- convertTemplateParameters(rc, declaration.parent);
27
- // And maybe call signatures
28
- context.checker
29
- .getSignaturesOfType(type, ts.SignatureKind.Call)
30
- .forEach((sig) => createSignature(rc, ReflectionKind.CallSignature, sig, symbol));
31
- // And maybe constructor signatures
32
- convertConstructSignatures(rc, symbol);
33
- // And finally, index signatures
34
- convertIndexSignatures(rc, type);
35
- }
36
- export function convertJsDocAlias(context, symbol, declaration, exportSymbol) {
37
- if (declaration.typeExpression &&
38
- ts.isJSDocTypeLiteral(declaration.typeExpression)) {
39
- convertJsDocInterface(context, declaration, symbol, exportSymbol);
40
- return;
41
- }
42
- const comment = context.getJsDocComment(declaration);
43
- if (comment?.hasModifier("@interface")) {
44
- return convertJsDocAliasAsInterface(context, symbol, exportSymbol, declaration);
45
- }
46
- // If the typedef tag is just referring to another type-space symbol, with no type parameters
47
- // or appropriate forwarding type parameters, then we treat it as a re-export instead of creating
48
- // a type alias with an import type.
49
- const aliasedSymbol = getTypedefReExportTarget(context, declaration);
50
- if (aliasedSymbol) {
51
- context.converter.convertSymbol(context, aliasedSymbol, exportSymbol ?? symbol);
52
- return;
53
- }
54
- const reflection = context.createDeclarationReflection(ReflectionKind.TypeAlias, symbol, exportSymbol);
55
- reflection.comment = comment;
56
- reflection.type = context.converter.convertType(context.withScope(reflection), declaration.typeExpression?.type);
57
- convertTemplateParameters(context.withScope(reflection), declaration.parent);
58
- context.finalizeDeclarationReflection(reflection);
59
- }
60
- export function convertJsDocCallback(context, symbol, declaration, exportSymbol) {
61
- const alias = context.createDeclarationReflection(ReflectionKind.TypeAlias, symbol, exportSymbol);
62
- alias.comment = context.getJsDocComment(declaration);
63
- context.finalizeDeclarationReflection(alias);
64
- const ac = context.withScope(alias);
65
- alias.type = convertJsDocSignature(ac, declaration.typeExpression);
66
- convertTemplateParameters(ac, declaration.parent);
67
- }
68
- function convertJsDocInterface(context, declaration, symbol, exportSymbol) {
69
- const reflection = context.createDeclarationReflection(ReflectionKind.Interface, symbol, exportSymbol);
70
- reflection.comment = context.getJsDocComment(declaration);
71
- context.finalizeDeclarationReflection(reflection);
72
- const rc = context.withScope(reflection);
73
- const type = context.checker.getDeclaredTypeOfSymbol(symbol);
74
- for (const s of type.getProperties()) {
75
- context.converter.convertSymbol(rc, s);
76
- }
77
- convertTemplateParameters(rc, declaration.parent);
78
- }
79
- function convertJsDocSignature(context, node) {
80
- const symbol = context.getSymbolAtLocation(node) ?? node.symbol;
81
- const type = context.getTypeAtLocation(node);
82
- if (!symbol || !type) {
83
- return new IntrinsicType("Function");
84
- }
85
- const reflection = new DeclarationReflection("__type", ReflectionKind.TypeLiteral, context.scope);
86
- const rc = context.withScope(reflection);
87
- context.registerReflection(reflection, symbol);
88
- context.converter.trigger(ConverterEvents.CREATE_DECLARATION, context, reflection);
89
- const signature = new SignatureReflection("__type", ReflectionKind.CallSignature, reflection);
90
- context.project.registerSymbolId(signature, context.createSymbolId(symbol, node));
91
- context.registerReflection(signature, void 0);
92
- const signatureCtx = rc.withScope(signature);
93
- reflection.signatures = [signature];
94
- signature.type = context.converter.convertType(signatureCtx, node.type?.typeExpression?.type);
95
- signature.parameters = convertParameterNodes(signatureCtx, signature, node.parameters);
96
- signature.typeParameters = convertTemplateParameterNodes(context.withScope(reflection), node.typeParameters);
97
- return new ReflectionType(reflection);
98
- }
99
- function convertTemplateParameters(context, node) {
100
- ok(context.scope instanceof DeclarationReflection);
101
- context.scope.typeParameters = convertTemplateParameterNodes(context, node.tags?.filter(ts.isJSDocTemplateTag));
102
- }
103
- function getTypedefReExportTarget(context, declaration) {
104
- const typeExpression = declaration.typeExpression;
105
- if (!ts.isJSDocTypedefTag(declaration) ||
106
- !typeExpression ||
107
- ts.isJSDocTypeLiteral(typeExpression) ||
108
- !ts.isImportTypeNode(typeExpression.type) ||
109
- !typeExpression.type.qualifier ||
110
- !ts.isIdentifier(typeExpression.type.qualifier)) {
111
- return;
112
- }
113
- const targetSymbol = context.expectSymbolAtLocation(typeExpression.type.qualifier);
114
- const decl = targetSymbol.declarations?.[0];
115
- if (!decl ||
116
- !(ts.isTypeAliasDeclaration(decl) ||
117
- ts.isInterfaceDeclaration(decl) ||
118
- ts.isJSDocTypedefTag(decl) ||
119
- ts.isJSDocCallbackTag(decl))) {
120
- return;
121
- }
122
- const targetParams = ts.getEffectiveTypeParameterDeclarations(decl);
123
- const localParams = ts.getEffectiveTypeParameterDeclarations(declaration);
124
- const localArgs = typeExpression.type.typeArguments || [];
125
- // If we have type parameters, ensure they are forwarding parameters with no transformations.
126
- // This doesn't check constraints since they aren't checked in JSDoc types.
127
- if (targetParams.length !== localParams.length ||
128
- localArgs.some((arg, i) => !ts.isTypeReferenceNode(arg) ||
129
- !ts.isIdentifier(arg.typeName) ||
130
- arg.typeArguments ||
131
- localParams[i]?.name.text !== arg.typeName.text)) {
132
- return;
133
- }
134
- return targetSymbol;
135
- }