@apify/docusaurus-plugin-typedoc-api 4.4.11 → 5.0.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 (278) hide show
  1. package/README.md +38 -296
  2. package/lib/components/AnchorLink.d.ts +5 -0
  3. package/lib/components/AnchorLink.d.ts.map +1 -0
  4. package/lib/components/AnchorLink.js +7 -26
  5. package/lib/components/AnchorLink.js.map +1 -1
  6. package/lib/components/ApiChangelog.d.ts +6 -0
  7. package/lib/components/ApiChangelog.d.ts.map +1 -0
  8. package/lib/components/ApiChangelog.js +7 -24
  9. package/lib/components/ApiChangelog.js.map +1 -1
  10. package/lib/components/ApiDataContext.d.ts +6 -0
  11. package/lib/components/ApiDataContext.d.ts.map +1 -0
  12. package/lib/components/ApiDataContext.js +12 -15
  13. package/lib/components/ApiDataContext.js.map +1 -1
  14. package/lib/components/ApiIndex.d.ts +14 -0
  15. package/lib/components/ApiIndex.d.ts.map +1 -0
  16. package/lib/components/ApiIndex.js +33 -93
  17. package/lib/components/ApiIndex.js.map +1 -1
  18. package/lib/components/ApiItem.d.ts +6 -0
  19. package/lib/components/ApiItem.d.ts.map +1 -0
  20. package/lib/components/ApiItem.js +131 -191
  21. package/lib/components/ApiItem.js.map +1 -1
  22. package/lib/components/ApiItemLayout.d.ts +14 -0
  23. package/lib/components/ApiItemLayout.d.ts.map +1 -0
  24. package/lib/components/ApiItemLayout.js +21 -97
  25. package/lib/components/ApiItemLayout.js.map +1 -1
  26. package/lib/components/ApiOptionsContext.d.ts +5 -0
  27. package/lib/components/ApiOptionsContext.d.ts.map +1 -0
  28. package/lib/components/ApiOptionsContext.js +5 -9
  29. package/lib/components/ApiOptionsContext.js.map +1 -1
  30. package/lib/components/ApiOptionsLayout.d.ts +4 -0
  31. package/lib/components/ApiOptionsLayout.d.ts.map +1 -0
  32. package/lib/components/ApiOptionsLayout.js +10 -34
  33. package/lib/components/ApiOptionsLayout.js.map +1 -1
  34. package/lib/components/ApiPage.d.ts +11 -0
  35. package/lib/components/ApiPage.d.ts.map +1 -0
  36. package/lib/components/ApiPage.js +50 -63
  37. package/lib/components/ApiPage.js.map +1 -1
  38. package/lib/components/Breadcrumb.d.ts +7 -0
  39. package/lib/components/Breadcrumb.d.ts.map +1 -0
  40. package/lib/components/Breadcrumb.js +17 -49
  41. package/lib/components/Breadcrumb.js.map +1 -1
  42. package/lib/components/Comment.d.ts +10 -0
  43. package/lib/components/Comment.d.ts.map +1 -0
  44. package/lib/components/Comment.js +33 -60
  45. package/lib/components/Comment.js.map +1 -1
  46. package/lib/components/CommentBadges.d.ts +9 -0
  47. package/lib/components/CommentBadges.d.ts.map +1 -0
  48. package/lib/components/CommentBadges.js +16 -28
  49. package/lib/components/CommentBadges.js.map +1 -1
  50. package/lib/components/DefaultValue.d.ts +10 -0
  51. package/lib/components/DefaultValue.d.ts.map +1 -0
  52. package/lib/components/DefaultValue.js +25 -55
  53. package/lib/components/DefaultValue.js.map +1 -1
  54. package/lib/components/Flags.d.ts +6 -0
  55. package/lib/components/Flags.d.ts.map +1 -0
  56. package/lib/components/Flags.js +11 -22
  57. package/lib/components/Flags.js.map +1 -1
  58. package/lib/components/Footer.d.ts +2 -0
  59. package/lib/components/Footer.d.ts.map +1 -0
  60. package/lib/components/Footer.js +4 -16
  61. package/lib/components/Footer.js.map +1 -1
  62. package/lib/components/Hierarchy.d.ts +6 -0
  63. package/lib/components/Hierarchy.d.ts.map +1 -0
  64. package/lib/components/Hierarchy.js +5 -25
  65. package/lib/components/Hierarchy.js.map +1 -1
  66. package/lib/components/Icon.d.ts +6 -0
  67. package/lib/components/Icon.d.ts.map +1 -0
  68. package/lib/components/Icon.js +10 -21
  69. package/lib/components/Icon.js.map +1 -1
  70. package/lib/components/Index.d.ts +9 -0
  71. package/lib/components/Index.d.ts.map +1 -0
  72. package/lib/components/Index.js +30 -113
  73. package/lib/components/Index.js.map +1 -1
  74. package/lib/components/Markdown.d.ts +5 -0
  75. package/lib/components/Markdown.d.ts.map +1 -0
  76. package/lib/components/Markdown.js +138 -202
  77. package/lib/components/Markdown.js.map +1 -1
  78. package/lib/components/Member.d.ts +5 -0
  79. package/lib/components/Member.d.ts.map +1 -0
  80. package/lib/components/Member.js +40 -69
  81. package/lib/components/Member.js.map +1 -1
  82. package/lib/components/MemberDeclaration.d.ts +5 -0
  83. package/lib/components/MemberDeclaration.d.ts.map +1 -0
  84. package/lib/components/MemberDeclaration.js +20 -71
  85. package/lib/components/MemberDeclaration.js.map +1 -1
  86. package/lib/components/MemberGetterSetter.d.ts +8 -0
  87. package/lib/components/MemberGetterSetter.d.ts.map +1 -0
  88. package/lib/components/MemberGetterSetter.js +13 -68
  89. package/lib/components/MemberGetterSetter.js.map +1 -1
  90. package/lib/components/MemberReference.d.ts +6 -0
  91. package/lib/components/MemberReference.d.ts.map +1 -0
  92. package/lib/components/MemberReference.js +18 -48
  93. package/lib/components/MemberReference.js.map +1 -1
  94. package/lib/components/MemberSignatureBody.d.ts +9 -0
  95. package/lib/components/MemberSignatureBody.d.ts.map +1 -0
  96. package/lib/components/MemberSignatureBody.js +85 -182
  97. package/lib/components/MemberSignatureBody.js.map +1 -1
  98. package/lib/components/MemberSignatureTitle.d.ts +11 -0
  99. package/lib/components/MemberSignatureTitle.d.ts.map +1 -0
  100. package/lib/components/MemberSignatureTitle.js +27 -81
  101. package/lib/components/MemberSignatureTitle.js.map +1 -1
  102. package/lib/components/MemberSignatures.d.ts +7 -0
  103. package/lib/components/MemberSignatures.d.ts.map +1 -0
  104. package/lib/components/MemberSignatures.js +18 -66
  105. package/lib/components/MemberSignatures.js.map +1 -1
  106. package/lib/components/MemberSources.d.ts +7 -0
  107. package/lib/components/MemberSources.d.ts.map +1 -0
  108. package/lib/components/MemberSources.js +10 -34
  109. package/lib/components/MemberSources.js.map +1 -1
  110. package/lib/components/Members.d.ts +6 -0
  111. package/lib/components/Members.d.ts.map +1 -0
  112. package/lib/components/Members.js +29 -49
  113. package/lib/components/Members.js.map +1 -1
  114. package/lib/components/MembersGroup.d.ts +6 -0
  115. package/lib/components/MembersGroup.d.ts.map +1 -0
  116. package/lib/components/MembersGroup.js +16 -40
  117. package/lib/components/MembersGroup.js.map +1 -1
  118. package/lib/components/Parameter.d.ts +6 -0
  119. package/lib/components/Parameter.d.ts.map +1 -0
  120. package/lib/components/Parameter.js +35 -171
  121. package/lib/components/Parameter.js.map +1 -1
  122. package/lib/components/Reflection.d.ts +6 -0
  123. package/lib/components/Reflection.d.ts.map +1 -0
  124. package/lib/components/Reflection.js +29 -132
  125. package/lib/components/Reflection.js.map +1 -1
  126. package/lib/components/SourceLink.d.ts +10 -0
  127. package/lib/components/SourceLink.d.ts.map +1 -0
  128. package/lib/components/SourceLink.js +16 -36
  129. package/lib/components/SourceLink.js.map +1 -1
  130. package/lib/components/Type.d.ts +12 -0
  131. package/lib/components/Type.d.ts.map +1 -0
  132. package/lib/components/Type.js +142 -464
  133. package/lib/components/Type.js.map +1 -1
  134. package/lib/components/TypeAndParent.d.ts +6 -0
  135. package/lib/components/TypeAndParent.d.ts.map +1 -0
  136. package/lib/components/TypeAndParent.js +11 -27
  137. package/lib/components/TypeAndParent.js.map +1 -1
  138. package/lib/components/TypeParameters.d.ts +6 -0
  139. package/lib/components/TypeParameters.d.ts.map +1 -0
  140. package/lib/components/TypeParameters.js +10 -38
  141. package/lib/components/TypeParameters.js.map +1 -1
  142. package/lib/components/TypeParametersGeneric.d.ts +6 -0
  143. package/lib/components/TypeParametersGeneric.d.ts.map +1 -0
  144. package/lib/components/TypeParametersGeneric.js +8 -27
  145. package/lib/components/TypeParametersGeneric.js.map +1 -1
  146. package/lib/components/VersionBanner.d.ts +2 -0
  147. package/lib/components/VersionBanner.d.ts.map +1 -0
  148. package/lib/components/VersionBanner.js +18 -49
  149. package/lib/components/VersionBanner.js.map +1 -1
  150. package/lib/hooks/useBreadcrumbs.d.ts +2 -0
  151. package/lib/hooks/useBreadcrumbs.d.ts.map +1 -0
  152. package/lib/hooks/useBreadcrumbs.js +5 -8
  153. package/lib/hooks/useBreadcrumbs.js.map +1 -1
  154. package/lib/hooks/useGitRefName.d.ts +2 -0
  155. package/lib/hooks/useGitRefName.d.ts.map +1 -0
  156. package/lib/hooks/useGitRefName.js +5 -8
  157. package/lib/hooks/useGitRefName.js.map +1 -1
  158. package/lib/hooks/useMinimalLayout.d.ts +2 -0
  159. package/lib/hooks/useMinimalLayout.d.ts.map +1 -0
  160. package/lib/hooks/useMinimalLayout.js +5 -8
  161. package/lib/hooks/useMinimalLayout.js.map +1 -1
  162. package/lib/hooks/useReflection.d.ts +4 -0
  163. package/lib/hooks/useReflection.d.ts.map +1 -0
  164. package/lib/hooks/useReflection.js +15 -21
  165. package/lib/hooks/useReflection.js.map +1 -1
  166. package/lib/hooks/useReflectionMap.d.ts +3 -0
  167. package/lib/hooks/useReflectionMap.d.ts.map +1 -0
  168. package/lib/hooks/useReflectionMap.js +5 -8
  169. package/lib/hooks/useReflectionMap.js.map +1 -1
  170. package/lib/index.d.ts +4 -0
  171. package/lib/index.d.ts.map +1 -0
  172. package/lib/index.js +349 -361
  173. package/lib/index.js.map +1 -1
  174. package/lib/markdownLoader.d.ts +6 -0
  175. package/lib/markdownLoader.d.ts.map +1 -0
  176. package/lib/markdownLoader.js +6 -10
  177. package/lib/markdownLoader.js.map +1 -1
  178. package/lib/plugin/data.d.ts +21 -0
  179. package/lib/plugin/data.d.ts.map +1 -0
  180. package/lib/plugin/data.js +391 -429
  181. package/lib/plugin/data.js.map +1 -1
  182. package/lib/plugin/python/consts.d.ts +35 -0
  183. package/lib/plugin/python/consts.d.ts.map +1 -0
  184. package/lib/plugin/python/consts.js +44 -44
  185. package/lib/plugin/python/consts.js.map +1 -1
  186. package/lib/plugin/python/index.d.ts +12 -0
  187. package/lib/plugin/python/index.d.ts.map +1 -0
  188. package/lib/plugin/python/index.js +25 -36
  189. package/lib/plugin/python/index.js.map +1 -1
  190. package/lib/plugin/python/inheritance.d.ts +42 -0
  191. package/lib/plugin/python/inheritance.d.ts.map +1 -0
  192. package/lib/plugin/python/inheritance.js +148 -153
  193. package/lib/plugin/python/inheritance.js.map +1 -1
  194. package/lib/plugin/python/packageVersions.d.ts +7 -0
  195. package/lib/plugin/python/packageVersions.d.ts.map +1 -0
  196. package/lib/plugin/python/packageVersions.js +30 -38
  197. package/lib/plugin/python/packageVersions.js.map +1 -1
  198. package/lib/plugin/python/transformation.d.ts +80 -0
  199. package/lib/plugin/python/transformation.d.ts.map +1 -0
  200. package/lib/plugin/python/transformation.js +350 -392
  201. package/lib/plugin/python/transformation.js.map +1 -1
  202. package/lib/plugin/python/type-parsing/index.d.ts +34 -0
  203. package/lib/plugin/python/type-parsing/index.d.ts.map +1 -0
  204. package/lib/plugin/python/type-parsing/index.js +78 -85
  205. package/lib/plugin/python/type-parsing/index.js.map +1 -1
  206. package/lib/plugin/python/types.d.ts +112 -0
  207. package/lib/plugin/python/types.d.ts.map +1 -0
  208. package/lib/plugin/python/types.js +2 -2
  209. package/lib/plugin/python/types.js.map +1 -1
  210. package/lib/plugin/python/utils.d.ts +40 -0
  211. package/lib/plugin/python/utils.d.ts.map +1 -0
  212. package/lib/plugin/python/utils.js +74 -73
  213. package/lib/plugin/python/utils.js.map +1 -1
  214. package/lib/plugin/sidebar.d.ts +6 -0
  215. package/lib/plugin/sidebar.d.ts.map +1 -0
  216. package/lib/plugin/sidebar.js +94 -96
  217. package/lib/plugin/sidebar.js.map +1 -1
  218. package/lib/plugin/structure/0.23.d.ts +3 -0
  219. package/lib/plugin/structure/0.23.d.ts.map +1 -0
  220. package/lib/plugin/structure/0.23.js +33 -41
  221. package/lib/plugin/structure/0.23.js.map +1 -1
  222. package/lib/plugin/url.d.ts +6 -0
  223. package/lib/plugin/url.d.ts.map +1 -0
  224. package/lib/plugin/url.js +36 -46
  225. package/lib/plugin/url.js.map +1 -1
  226. package/lib/plugin/version.d.ts +5 -0
  227. package/lib/plugin/version.d.ts.map +1 -0
  228. package/lib/plugin/version.js +73 -78
  229. package/lib/plugin/version.js.map +1 -1
  230. package/lib/types.d.ts +142 -0
  231. package/lib/types.d.ts.map +1 -0
  232. package/lib/types.js +2 -2
  233. package/lib/types.js.map +1 -1
  234. package/lib/utils/helpers.d.ts +2 -0
  235. package/lib/utils/helpers.d.ts.map +1 -0
  236. package/lib/utils/helpers.js +5 -7
  237. package/lib/utils/helpers.js.map +1 -1
  238. package/lib/utils/hierarchy.d.ts +8 -0
  239. package/lib/utils/hierarchy.d.ts.map +1 -0
  240. package/lib/utils/hierarchy.js +31 -33
  241. package/lib/utils/hierarchy.js.map +1 -1
  242. package/lib/utils/icons.d.ts +5 -0
  243. package/lib/utils/icons.d.ts.map +1 -0
  244. package/lib/utils/icons.js +82 -114
  245. package/lib/utils/icons.js.map +1 -1
  246. package/lib/utils/links.d.ts +2 -0
  247. package/lib/utils/links.d.ts.map +1 -0
  248. package/lib/utils/links.js +24 -41
  249. package/lib/utils/links.js.map +1 -1
  250. package/lib/utils/markdown.d.ts +4 -0
  251. package/lib/utils/markdown.d.ts.map +1 -0
  252. package/lib/utils/markdown.js +45 -54
  253. package/lib/utils/markdown.js.map +1 -1
  254. package/lib/utils/reexports.d.ts +5 -0
  255. package/lib/utils/reexports.d.ts.map +1 -0
  256. package/lib/utils/reexports.js +90 -90
  257. package/lib/utils/reexports.js.map +1 -1
  258. package/lib/utils/removeScopes.d.ts +2 -0
  259. package/lib/utils/removeScopes.d.ts.map +1 -0
  260. package/lib/utils/removeScopes.js +7 -0
  261. package/lib/utils/removeScopes.js.map +1 -0
  262. package/lib/utils/visibility.d.ts +6 -0
  263. package/lib/utils/visibility.d.ts.map +1 -0
  264. package/lib/utils/visibility.js +14 -19
  265. package/lib/utils/visibility.js.map +1 -1
  266. package/package.json +24 -17
  267. package/src/components/ApiIndex.tsx +1 -1
  268. package/src/components/Type.tsx +4 -4
  269. package/src/index.ts +2 -2
  270. package/src/plugin/data.ts +3 -3
  271. package/src/plugin/python/index.ts +3 -3
  272. package/src/plugin/python/packageVersions.ts +3 -3
  273. package/src/plugin/sidebar.ts +1 -1
  274. package/src/plugin/url.ts +1 -1
  275. package/src/plugin/version.ts +1 -1
  276. package/src/utils/links.ts +1 -12
  277. package/src/utils/removeScopes.ts +10 -0
  278. /package/{assets/styles-8ad572ec.css → lib/components/styles.css} +0 -0
@@ -1,159 +1,154 @@
1
- 'use strict';
2
-
3
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
6
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
7
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
- const utils = require('./utils.js');
9
- class InheritanceGraph {
10
- nodes = new Map();
11
- children = new Map();
12
- symbolIdResolver;
13
- constructor(symbolIdResolver) {
14
- this.symbolIdResolver = symbolIdResolver;
15
- }
16
-
17
- /**
18
- * Adds a new inheritance relationship.
19
- * @param parentName Name of the ancestor class.
20
- * @param child The object representing the descendant class.
21
- */
22
- addRelationship(parentName, child) {
23
- const children = this.children.get(parentName) ?? [];
24
- children.push(child.name);
25
- this.children.set(parentName, children);
26
- this.nodes.set(child.name, child);
27
- this.registerNode(child);
28
- }
29
- registerNode(node) {
30
- this.nodes.set(node.name, node);
31
- }
32
-
33
- /**
34
- * Resolves the inheritance relationships between the objects.
35
- *
36
- * Adds the inherited symbols to the descendants, and sets the `extendedTypes` / `extendedBy` properties.
37
- * The symbol inheritance works transitively, so if `A` inherits from `B` and `B` inherits from `C`, then `A` inherits from `C`.
38
- *
39
- * The order of the inheritance is determined by the topological order of the inheritance graph (to ensure the ancestors are processed before the descendants).
40
- */
41
- resolveInheritance() {
42
- const objects = this.getTopologicalOrder();
43
- for (const parent of objects) {
44
- const children = this.children.get(parent.name);
45
- if (children) {
46
- for (const childId of children) {
47
- const child = this.nodes.get(childId);
48
- if (child) {
49
- this.resolveInheritedSymbols(parent, child);
50
- }
51
- }
52
- }
1
+ import { getGroupName, sortChildren } from './utils';
2
+ export class InheritanceGraph {
3
+ constructor(symbolIdResolver) {
4
+ this.nodes = new Map();
5
+ this.children = new Map();
6
+ this.symbolIdResolver = symbolIdResolver;
53
7
  }
54
- }
55
-
56
- /**
57
- * Given two TypeDoc objects, resolves the inherited symbols between them.
58
- * This method injects the ancestors' symbols into the descendants.
59
- *
60
- * In case the descendant already has a symbol with the same name, the symbol is not injected.
61
- * @param ancestor The ancestor object.
62
- * @param descendant The descendant object.
63
- */
64
- resolveInheritedSymbols(ancestor, descendant) {
65
- descendant.children ??= [];
66
- descendant.extendedTypes = [...(descendant.extendedTypes ?? []), {
67
- name: ancestor.name,
68
- target: ancestor.id,
69
- type: 'reference'
70
- }];
71
- ancestor.extendedBy = [...(ancestor.extendedBy ?? []), {
72
- name: descendant.name,
73
- target: descendant.id,
74
- type: 'reference'
75
- }];
76
- for (const inheritedChild of ancestor.children ?? []) {
77
- let ownChild = descendant.children?.find(x => x.name === inheritedChild.name);
78
- if (ownChild) {
79
- ownChild.overwrites = {
80
- name: `${ancestor.name}.${inheritedChild.name}`,
81
- target: inheritedChild.id,
82
- type: 'reference'
83
- };
84
- } else {
85
- const childId = this.symbolIdResolver.getNewId();
86
- const _utils$getGroupName = utils.getGroupName(inheritedChild),
87
- groupName = _utils$getGroupName.groupName;
88
- if (!groupName) {
89
- throw new Error(`Couldn't resolve the group name for ${inheritedChild.name} (inherited child of ${ancestor.name})`);
90
- }
91
- const group = descendant.groups?.find(g => g.title === groupName);
92
- if (group) {
93
- group.children.push(childId);
94
- } else {
95
- descendant.groups?.push({
96
- children: [childId],
97
- title: groupName
98
- });
99
- }
100
- ownChild = JSON.parse(JSON.stringify(_objectSpread(_objectSpread({}, inheritedChild), {}, {
101
- id: childId,
102
- inheritedFrom: inheritedChild.inheritedFrom ?? {
103
- name: `${ancestor.name}.${inheritedChild.name}`,
104
- target: inheritedChild.id,
105
- type: 'reference'
106
- }
107
- })));
108
- descendant.children.push(ownChild);
109
- }
110
- if (!ownChild.comment?.summary?.[0]?.text) {
111
- for (const key of Object.keys(inheritedChild)) {
112
- if (!['id', 'inheritedFrom', 'overwrites', 'sources'].includes(key)) {
113
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
114
- ownChild[key] = inheritedChild[key];
115
- }
8
+ /**
9
+ * Adds a new inheritance relationship.
10
+ * @param parentName Name of the ancestor class.
11
+ * @param child The object representing the descendant class.
12
+ */
13
+ addRelationship(parentName, child) {
14
+ var _a;
15
+ const children = (_a = this.children.get(parentName)) !== null && _a !== void 0 ? _a : [];
16
+ children.push(child.name);
17
+ this.children.set(parentName, children);
18
+ this.nodes.set(child.name, child);
19
+ this.registerNode(child);
20
+ }
21
+ registerNode(node) {
22
+ this.nodes.set(node.name, node);
23
+ }
24
+ /**
25
+ * Resolves the inheritance relationships between the objects.
26
+ *
27
+ * Adds the inherited symbols to the descendants, and sets the `extendedTypes` / `extendedBy` properties.
28
+ * The symbol inheritance works transitively, so if `A` inherits from `B` and `B` inherits from `C`, then `A` inherits from `C`.
29
+ *
30
+ * The order of the inheritance is determined by the topological order of the inheritance graph (to ensure the ancestors are processed before the descendants).
31
+ */
32
+ resolveInheritance() {
33
+ const objects = this.getTopologicalOrder();
34
+ for (const parent of objects) {
35
+ const children = this.children.get(parent.name);
36
+ if (children) {
37
+ for (const childId of children) {
38
+ const child = this.nodes.get(childId);
39
+ if (child) {
40
+ this.resolveInheritedSymbols(parent, child);
41
+ }
42
+ }
43
+ }
116
44
  }
117
- }
118
- if (ownChild.kindString === 'Method') {
119
- for (const sig of ownChild.signatures ?? []) {
120
- sig.inheritedFrom = ownChild.inheritedFrom;
121
- sig.overwrites = ownChild.overwrites;
45
+ }
46
+ /**
47
+ * Given two TypeDoc objects, resolves the inherited symbols between them.
48
+ * This method injects the ancestors' symbols into the descendants.
49
+ *
50
+ * In case the descendant already has a symbol with the same name, the symbol is not injected.
51
+ * @param ancestor The ancestor object.
52
+ * @param descendant The descendant object.
53
+ */
54
+ resolveInheritedSymbols(ancestor, descendant) {
55
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
56
+ (_a = descendant.children) !== null && _a !== void 0 ? _a : (descendant.children = []);
57
+ descendant.extendedTypes = [
58
+ ...((_b = descendant.extendedTypes) !== null && _b !== void 0 ? _b : []),
59
+ {
60
+ name: ancestor.name,
61
+ target: ancestor.id,
62
+ type: 'reference',
63
+ },
64
+ ];
65
+ ancestor.extendedBy = [
66
+ ...((_c = ancestor.extendedBy) !== null && _c !== void 0 ? _c : []),
67
+ {
68
+ name: descendant.name,
69
+ target: descendant.id,
70
+ type: 'reference',
71
+ },
72
+ ];
73
+ for (const inheritedChild of (_d = ancestor.children) !== null && _d !== void 0 ? _d : []) {
74
+ let ownChild = (_e = descendant.children) === null || _e === void 0 ? void 0 : _e.find((x) => x.name === inheritedChild.name);
75
+ if (ownChild) {
76
+ ownChild.overwrites = {
77
+ name: `${ancestor.name}.${inheritedChild.name}`,
78
+ target: inheritedChild.id,
79
+ type: 'reference',
80
+ };
81
+ }
82
+ else {
83
+ const childId = this.symbolIdResolver.getNewId();
84
+ const { groupName } = getGroupName(inheritedChild);
85
+ if (!groupName) {
86
+ throw new Error(`Couldn't resolve the group name for ${inheritedChild.name} (inherited child of ${ancestor.name})`);
87
+ }
88
+ const group = (_f = descendant.groups) === null || _f === void 0 ? void 0 : _f.find((g) => g.title === groupName);
89
+ if (group) {
90
+ group.children.push(childId);
91
+ }
92
+ else {
93
+ (_g = descendant.groups) === null || _g === void 0 ? void 0 : _g.push({
94
+ children: [childId],
95
+ title: groupName,
96
+ });
97
+ }
98
+ ownChild = JSON.parse(JSON.stringify(Object.assign(Object.assign({}, inheritedChild), { id: childId, inheritedFrom: (_h = inheritedChild.inheritedFrom) !== null && _h !== void 0 ? _h : {
99
+ name: `${ancestor.name}.${inheritedChild.name}`,
100
+ target: inheritedChild.id,
101
+ type: 'reference',
102
+ } })));
103
+ descendant.children.push(ownChild);
104
+ }
105
+ if (!((_l = (_k = (_j = ownChild.comment) === null || _j === void 0 ? void 0 : _j.summary) === null || _k === void 0 ? void 0 : _k[0]) === null || _l === void 0 ? void 0 : _l.text)) {
106
+ for (const key of Object.keys(inheritedChild)) {
107
+ if (!['id', 'inheritedFrom', 'overwrites', 'sources'].includes(key)) {
108
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
109
+ ownChild[key] = inheritedChild[key];
110
+ }
111
+ }
112
+ }
113
+ if (ownChild.kindString === 'Method') {
114
+ for (const sig of (_m = ownChild.signatures) !== null && _m !== void 0 ? _m : []) {
115
+ sig.inheritedFrom = ownChild.inheritedFrom;
116
+ sig.overwrites = ownChild.overwrites;
117
+ }
118
+ }
119
+ this.symbolIdResolver.addNewReference(ownChild);
122
120
  }
123
- }
124
- this.symbolIdResolver.addNewReference(ownChild);
121
+ sortChildren(descendant);
125
122
  }
126
- utils.sortChildren(descendant);
127
- }
128
-
129
- /**
130
- * Returns the topological order of the inheritance graph.
131
- *
132
- * The topological order puts the ancestors before their descendants.
133
- * This ensures that all the ancestors are processed before the descendants.
134
- * @returns
135
- */
136
- getTopologicalOrder() {
137
- const visited = new Set();
138
- const stack = [];
139
- const visit = nodeName => {
140
- if (visited.has(nodeName)) return;
141
- const node = this.nodes.get(nodeName);
142
- if (!node) {
143
- // throw new Error(`Couldn't find the node with the name ${nodeName}`); // breaks the build for projects with external ancestors
144
- return;
145
- }
146
- visited.add(nodeName);
147
- for (const child of this.children.get(nodeName) ?? []) {
148
- visit(child);
149
- }
150
- stack.push(node);
151
- };
152
- for (const node of this.children.keys()) {
153
- visit(node);
123
+ /**
124
+ * Returns the topological order of the inheritance graph.
125
+ *
126
+ * The topological order puts the ancestors before their descendants.
127
+ * This ensures that all the ancestors are processed before the descendants.
128
+ * @returns
129
+ */
130
+ getTopologicalOrder() {
131
+ const visited = new Set();
132
+ const stack = [];
133
+ const visit = (nodeName) => {
134
+ var _a;
135
+ if (visited.has(nodeName))
136
+ return;
137
+ const node = this.nodes.get(nodeName);
138
+ if (!node) {
139
+ // throw new Error(`Couldn't find the node with the name ${nodeName}`); // breaks the build for projects with external ancestors
140
+ return;
141
+ }
142
+ visited.add(nodeName);
143
+ for (const child of (_a = this.children.get(nodeName)) !== null && _a !== void 0 ? _a : []) {
144
+ visit(child);
145
+ }
146
+ stack.push(node);
147
+ };
148
+ for (const node of this.children.keys()) {
149
+ visit(node);
150
+ }
151
+ return stack.reverse();
154
152
  }
155
- return stack.reverse();
156
- }
157
153
  }
158
- exports.InheritanceGraph = InheritanceGraph;
159
- //# sourceMappingURL=inheritance.js.map
154
+ //# sourceMappingURL=inheritance.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"inheritance.js","sources":["../../../src/plugin/python/inheritance.ts"],"sourcesContent":null,"names":["getGroupName","sortChildren"],"mappings":";;;;AACO,MAAM,gBAAgB,CAAC;AAC9B,EAAE,KAAK,GAAG,IAAI,GAAG,EAAE,CAAC;AACpB,EAAE,QAAQ,GAAG,IAAI,GAAG,EAAE,CAAC;AACvB,EAAE,gBAAgB,CAAC;AACnB,EAAE,WAAW,CAAC,gBA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B,CAAC;QACjD,MAAM,KAAK,GAAoB,EAAE,CAAC;QAElC,MAAM,KAAK,GAAG,CAAC,QAA+B,EAAE,EAAE;;YACjD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;gBAAE,OAAO;YAElC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAEtC,IAAI,CAAC,IAAI,EAAE,CAAC;gBACX,gIAAgI;gBAChI,OAAO;YACR,CAAC;YAED,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAEtB,KAAK,MAAM,KAAK,IAAI,MAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,mCAAI,EAAE,EAAE,CAAC;gBACvD,KAAK,CAAC,KAAK,CAAC,CAAC;YACd,CAAC;YAED,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClB,CAAC,CAAC;QAEF,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC;YACzC,KAAK,CAAC,IAAI,CAAC,CAAC;QACb,CAAC;QAED,OAAO,KAAK,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;CACD"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Looks for the installed versions of the given packages and returns them as a dictionary.
3
+ */
4
+ export declare function getPackageGitHubTags(packageNames: string[]): Record<string, string>;
5
+ export declare function findNearestInParent(currentPath: string, filename: string): string;
6
+ export declare function getCurrentPackageName(pyprojectTomlPath?: string): string;
7
+ //# sourceMappingURL=packageVersions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packageVersions.d.ts","sourceRoot":"","sources":["../../../src/plugin/python/packageVersions.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAenF;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,UAUxE;AAED,wBAAgB,qBAAqB,CAAC,iBAAiB,CAAC,EAAE,MAAM,UAM/D"}
@@ -1,46 +1,38 @@
1
- 'use strict';
2
-
3
- const childProcess = require('node:child_process');
4
- const fs = require('node:fs');
5
- const path = require('node:path');
6
- const _interopDefault = e => e && e.__esModule ? e : {
7
- default: e
8
- };
9
- const childProcess__default = /*#__PURE__*/_interopDefault(childProcess);
10
- const fs__default = /*#__PURE__*/_interopDefault(fs);
11
- const path__default = /*#__PURE__*/_interopDefault(path);
12
-
1
+ import childProcess from 'node:child_process';
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
13
4
  /**
14
5
  * Looks for the installed versions of the given packages and returns them as a dictionary.
15
6
  */
16
- function getPackageGitHubTags(packageNames) {
17
- // For each package, get the installed version, and set the tag to the corresponding version
18
- const packageTags = {};
19
- for (const pkg of packageNames) {
20
- const spawnResult = childProcess__default.default.spawnSync('python', ['-c', `import ${pkg}; print(${pkg}.__version__)`]);
21
- if (spawnResult.status === 0) {
22
- packageTags[pkg] = `v${spawnResult.stdout.toString().trim()}`;
7
+ export function getPackageGitHubTags(packageNames) {
8
+ // For each package, get the installed version, and set the tag to the corresponding version
9
+ const packageTags = {};
10
+ for (const pkg of packageNames) {
11
+ const spawnResult = childProcess.spawnSync('python', [
12
+ '-c',
13
+ `import ${pkg}; print(${pkg}.__version__)`,
14
+ ]);
15
+ if (spawnResult.status === 0) {
16
+ packageTags[pkg] = `v${spawnResult.stdout.toString().trim()}`;
17
+ }
23
18
  }
24
- }
25
- return packageTags;
19
+ return packageTags;
26
20
  }
27
- function findNearestInParent(currentPath, filename) {
28
- let parentPath = currentPath;
29
- while (parentPath !== '/') {
30
- parentPath = path__default.default.dirname(parentPath);
31
- if (fs__default.default.existsSync(path__default.default.join(parentPath, filename))) {
32
- return path__default.default.join(parentPath, filename);
21
+ export function findNearestInParent(currentPath, filename) {
22
+ let parentPath = currentPath;
23
+ while (parentPath !== '/') {
24
+ parentPath = path.dirname(parentPath);
25
+ if (fs.existsSync(path.join(parentPath, filename))) {
26
+ return path.join(parentPath, filename);
27
+ }
33
28
  }
34
- }
35
- throw new Error(`No ${filename} found in any parent directory`);
29
+ throw new Error(`No ${filename} found in any parent directory`);
36
30
  }
37
- function getCurrentPackageName(pyprojectTomlPath) {
38
- const currentPath = path__default.default.dirname(__dirname);
39
- pyprojectTomlPath ??= findNearestInParent(currentPath, 'pyproject.toml');
40
- const pyprojectToml = fs__default.default.readFileSync(pyprojectTomlPath, 'utf8');
41
- return pyprojectToml.match(/^name = "(.+)"$/m)?.[1];
31
+ export function getCurrentPackageName(pyprojectTomlPath) {
32
+ var _a;
33
+ const currentPath = path.dirname(__dirname);
34
+ pyprojectTomlPath !== null && pyprojectTomlPath !== void 0 ? pyprojectTomlPath : (pyprojectTomlPath = findNearestInParent(currentPath, 'pyproject.toml'));
35
+ const pyprojectToml = fs.readFileSync(pyprojectTomlPath, 'utf8');
36
+ return (_a = pyprojectToml.match(/^name = "(.+)"$/m)) === null || _a === void 0 ? void 0 : _a[1];
42
37
  }
43
- exports.findNearestInParent = findNearestInParent;
44
- exports.getCurrentPackageName = getCurrentPackageName;
45
- exports.getPackageGitHubTags = getPackageGitHubTags;
46
- //# sourceMappingURL=packageVersions.js.map
38
+ //# sourceMappingURL=packageVersions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersions.js","sources":["../../../src/plugin/python/packageVersions.ts"],"sourcesContent":null,"names":["childProcess","path","fs"],"mappings":";;;;;;;;;;;;AAIA;AACA;AACA;AACO,SAAS,oBAAoB,CAAC,YAAY,EAAE;AACnD;AACA,EAAE,MAAM,WAAW,GAAG,EAAE,CAAC;AACzB,EAAE,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE;AAClC,IAAI,MAAM,WAAW,GAAGA,6BAAY,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,OAAO,E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,CAAC,SAAS,CAAC,CAAC;IAC5C,iBAAiB,aAAjB,iBAAiB,cAAjB,iBAAiB,IAAjB,iBAAiB,GAAK,mBAAmB,CAAC,WAAW,EAAE,gBAAgB,CAAC,EAAC;IACzE,MAAM,aAAa,GAAG,EAAE,CAAC,YAAY,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;IAEjE,OAAO,MAAA,aAAa,CAAC,KAAK,CAAC,kBAAkB,CAAC,0CAAG,CAAC,CAAC,CAAC;AACrD,CAAC"}
@@ -0,0 +1,80 @@
1
+ import type { DocspecObject, OID, TypeDocObject } from './types';
2
+ interface DocspecTransformerOptions {
3
+ /**
4
+ * A map of module shortcuts, where the key is the full name of the module, and the value is the shortened name.
5
+ */
6
+ moduleShortcuts?: Record<string, string>;
7
+ /**
8
+ * SHA of the git revision to use in the GitHub source links. If not provided, `master` will be used.
9
+ */
10
+ gitRevision?: string;
11
+ }
12
+ export declare class SymbolIdTracker {
13
+ symbolIdMap: Record<number, {
14
+ qualifiedName: string;
15
+ sourceFileName: string;
16
+ }>;
17
+ private idToReference;
18
+ private oidGenerator;
19
+ /**
20
+ * Returns automatically incrementing OID. Every call to this function will return a new unique OID.
21
+ * @returns {number} The OID.
22
+ */
23
+ getNewId(): OID;
24
+ addNewReference(object: TypeDocObject): void;
25
+ getMethodSignatures(): TypeDocObject[];
26
+ getIdByName(name: string): string;
27
+ getTypeDocById(id: number): TypeDocObject;
28
+ private generateOID;
29
+ }
30
+ export declare class DocspecTransformer {
31
+ private pythonTypeResolver;
32
+ private inheritanceGraph;
33
+ private symbolIdTracker;
34
+ private moduleShortcuts;
35
+ private gitRevision;
36
+ /**
37
+ * Stack of the docstrings of the current context.
38
+ *
39
+ * Used to read the class Google-style docstrings from the class' properties and methods.
40
+ */
41
+ private contextStack;
42
+ private settings;
43
+ constructor({ moduleShortcuts, gitRevision }: DocspecTransformerOptions);
44
+ transform(docspecModules: DocspecObject[]): TypeDocObject;
45
+ private getContext;
46
+ private popContext;
47
+ private newContext;
48
+ private unpackKwargs;
49
+ /**
50
+ * Recursively traverse the Typedoc structure and fix the references to the named entities.
51
+ *
52
+ * Searches for the {@link TypeDocType} structure with the `type` property set to `reference`, and replaces the `target` property
53
+ * with the corresponding ID of the named entity.
54
+ */
55
+ private fixRefs;
56
+ private makeMethodSignature;
57
+ /**
58
+ * Given a docspec object outputted by `pydoc-markdown`, transforms this object into the Typedoc structure,
59
+ * and appends it as a child of the `parentTypeDoc` Typedoc object (which serves as an accumulator for the recursion).
60
+ * @param obj
61
+ * @param parent
62
+ * @param module
63
+ */
64
+ private walkAndTransform;
65
+ private getGitHubUrls;
66
+ /**
67
+ * If possible, parses the `.docstring` property of the passed object. If the docstring is a stringified JSON object,
68
+ * it extracts the `args` and `returns` sections and adds them to the returned object.
69
+ *
70
+ * TODO
71
+ * This structure is created in the `google` docstring format, which is a JSON object with the following structure:
72
+ */
73
+ private parseDocstring;
74
+ /**
75
+ * Given the current Docspec object and the parent Typedoc object, returns the Typedoc type and kind of the current object.
76
+ */
77
+ private getTypedocType;
78
+ }
79
+ export {};
80
+ //# sourceMappingURL=transformation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transformation.d.ts","sourceRoot":"","sources":["../../../src/plugin/python/transformation.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAEX,aAAa,EACb,GAAG,EAEH,aAAa,EAEb,MAAM,SAAS,CAAC;AAkBjB,UAAU,yBAAyB;IAClC;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEzC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,eAAe;IAC3B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,CAAA;KAAE,CAAC,CAAM;IAEpF,OAAO,CAAC,aAAa,CAAqC;IAE1D,OAAO,CAAC,YAAY,CAA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