@apify/docusaurus-plugin-typedoc-api 4.3.2 → 4.3.3

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.
@@ -6,66 +6,139 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
6
6
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
7
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
8
  const utils = require('./utils.js');
9
+ class InheritanceGraph {
10
+ nodes = new Map();
11
+ children = new Map();
9
12
 
10
- /**
11
- * Given an ancestor and a descendant objects, injects the children of the ancestor into the descendant.
12
- *
13
- * Sets the `extendedTypes` / `extendedBy` properties.
14
- * @param ancestor
15
- * @param descendant
16
- */
17
- function resolveInheritedSymbols(ancestor, descendant) {
18
- descendant.children ??= [];
19
- descendant.extendedTypes = [...(descendant.extendedTypes ?? []), {
20
- name: ancestor.name,
21
- target: ancestor.id,
22
- type: 'reference'
23
- }];
24
- ancestor.extendedBy = [...(ancestor.extendedBy ?? []), {
25
- name: descendant.name,
26
- target: descendant.id,
27
- type: 'reference'
28
- }];
29
- for (const inheritedChild of ancestor.children ?? []) {
30
- const ownChild = descendant.children?.find(x => x.name === inheritedChild.name);
31
- if (!ownChild) {
32
- const childId = utils.getOID();
33
- const _utils$getGroupName = utils.getGroupName(inheritedChild),
34
- groupName = _utils$getGroupName.groupName;
35
- if (!groupName) {
36
- throw new Error(`Couldn't resolve the group name for ${inheritedChild.name} (inherited child of ${ancestor.name})`);
37
- }
38
- const group = descendant.groups?.find(g => g.title === groupName);
39
- if (group) {
40
- group.children.push(inheritedChild.id);
41
- } else {
42
- descendant.groups?.push({
43
- children: [inheritedChild.id],
44
- title: groupName
45
- });
13
+ /**
14
+ * Adds a new inheritance relationship.
15
+ * @param parentName Name of the ancestor class.
16
+ * @param child The object representing the descendant class.
17
+ */
18
+ addRelationship(parentName, child) {
19
+ const children = this.children.get(parentName) ?? [];
20
+ children.push(child.name);
21
+ this.children.set(parentName, children);
22
+ this.nodes.set(child.name, child);
23
+ this.registerNode(child);
24
+ }
25
+ registerNode(node) {
26
+ this.nodes.set(node.name, node);
27
+ }
28
+
29
+ /**
30
+ * Resolves the inheritance relationships between the objects.
31
+ *
32
+ * Adds the inherited symbols to the descendants, and sets the `extendedTypes` / `extendedBy` properties.
33
+ * The symbol inheritance works transitively, so if `A` inherits from `B` and `B` inherits from `C`, then `A` inherits from `C`.
34
+ *
35
+ * The order of the inheritance is determined by the topological order of the inheritance graph (to ensure the ancestors are processed before the descendants).
36
+ */
37
+ resolveInheritance() {
38
+ const objects = this.getTopologicalOrder();
39
+ for (const parent of objects) {
40
+ const children = this.children.get(parent.name);
41
+ if (children) {
42
+ for (const childId of children) {
43
+ const child = this.nodes.get(childId);
44
+ if (child) {
45
+ this.resolveInheritedSymbols(parent, child);
46
+ }
47
+ }
46
48
  }
47
- descendant.children.push(_objectSpread(_objectSpread({}, inheritedChild), {}, {
48
- id: childId,
49
- inheritedFrom: {
49
+ }
50
+ }
51
+
52
+ /**
53
+ * Given two TypeDoc objects, resolves the inherited symbols between them.
54
+ * This method injects the ancestors' symbols into the descendants.
55
+ *
56
+ * In case the descendant already has a symbol with the same name, the symbol is not injected.
57
+ * @param ancestor The ancestor object.
58
+ * @param descendant The descendant object.
59
+ */
60
+ resolveInheritedSymbols(ancestor, descendant) {
61
+ descendant.children ??= [];
62
+ descendant.extendedTypes = [...(descendant.extendedTypes ?? []), {
63
+ name: ancestor.name,
64
+ target: ancestor.id,
65
+ type: 'reference'
66
+ }];
67
+ ancestor.extendedBy = [...(ancestor.extendedBy ?? []), {
68
+ name: descendant.name,
69
+ target: descendant.id,
70
+ type: 'reference'
71
+ }];
72
+ for (const inheritedChild of ancestor.children ?? []) {
73
+ const ownChild = descendant.children?.find(x => x.name === inheritedChild.name);
74
+ if (!ownChild) {
75
+ const childId = utils.getOID();
76
+ const _utils$getGroupName = utils.getGroupName(inheritedChild),
77
+ groupName = _utils$getGroupName.groupName;
78
+ if (!groupName) {
79
+ throw new Error(`Couldn't resolve the group name for ${inheritedChild.name} (inherited child of ${ancestor.name})`);
80
+ }
81
+ const group = descendant.groups?.find(g => g.title === groupName);
82
+ if (group) {
83
+ group.children.push(inheritedChild.id);
84
+ } else {
85
+ descendant.groups?.push({
86
+ children: [inheritedChild.id],
87
+ title: groupName
88
+ });
89
+ }
90
+ descendant.children.push(_objectSpread(_objectSpread({}, inheritedChild), {}, {
91
+ id: childId,
92
+ inheritedFrom: {
93
+ name: `${ancestor.name}.${inheritedChild.name}`,
94
+ target: inheritedChild.id,
95
+ type: 'reference'
96
+ }
97
+ }));
98
+ } else if (!ownChild.comment?.summary?.[0]?.text) {
99
+ ownChild.inheritedFrom = {
50
100
  name: `${ancestor.name}.${inheritedChild.name}`,
51
101
  target: inheritedChild.id,
52
102
  type: 'reference'
103
+ };
104
+ for (const key of Object.keys(inheritedChild)) {
105
+ if (key !== 'id' && key !== 'inheritedFrom') {
106
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
107
+ ownChild[key] = inheritedChild[key];
108
+ }
53
109
  }
54
- }));
55
- } else if (!ownChild.comment?.summary?.[0]?.text) {
56
- ownChild.inheritedFrom = {
57
- name: `${ancestor.name}.${inheritedChild.name}`,
58
- target: inheritedChild.id,
59
- type: 'reference'
60
- };
61
- for (const key of Object.keys(inheritedChild)) {
62
- if (key !== 'id' && key !== 'inheritedFrom') {
63
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
64
- ownChild[key] = inheritedChild[key];
65
- }
66
110
  }
67
111
  }
112
+ utils.sortChildren(descendant);
113
+ }
114
+
115
+ /**
116
+ * Returns the topological order of the inheritance graph.
117
+ *
118
+ * The topological order puts the ancestors before their descendants.
119
+ * This ensures that all the ancestors are processed before the descendants.
120
+ * @returns
121
+ */
122
+ getTopologicalOrder() {
123
+ const visited = new Set();
124
+ const stack = [];
125
+ const visit = nodeName => {
126
+ if (visited.has(nodeName)) return;
127
+ const node = this.nodes.get(nodeName);
128
+ if (!node) {
129
+ throw new Error(`Couldn't find the node with the name ${nodeName}`);
130
+ }
131
+ visited.add(nodeName);
132
+ for (const child of this.children.get(nodeName) ?? []) {
133
+ visit(child);
134
+ }
135
+ stack.push(node);
136
+ };
137
+ for (const node of this.children.keys()) {
138
+ visit(node);
139
+ }
140
+ return stack.reverse();
68
141
  }
69
142
  }
70
- exports.resolveInheritedSymbols = resolveInheritedSymbols;
143
+ exports.InheritanceGraph = InheritanceGraph;
71
144
  //# sourceMappingURL=inheritance.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"inheritance.js","sources":["../../../src/plugin/python/inheritance.ts"],"sourcesContent":null,"names":["getOID","getGroupName"],"mappings":";;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,uBAAuB,CAAC,QAAQ,EAAE,UAAU,EAAE;AAC9D,EAAE,UAAU,CAAC,QAAQ,KAAK,EAAE,CAAC;AAC7B,EAAE,UAAU,CAAC,aAAa,GAAG,CAAC,IAAI,UAAU,CAAC,aAAa,IAAI,EAAE,CAAC,EAAE;AACnE,IAAI,IAAI,EAAE,QAAQ,CAAC,IAAI;AACvB,IAAI,MAAM,EAAE,QAAQ,CAAC,EAAE;AACvB,IAAI,IAAI,EAAE,WAAW;AACrB,GAAG,CAAC,CAAC;AACL,EAAE,QAAQ,CAAC,UAAU,GAAG,CAAC,IAAI,QAAQ,CAAC,UAAU,IAAI,EAAE,CAAC,EAAE;AACzD,IAAI,IAAI,EAAE,UAAU,CAAC,IAAI;AACzB,IAAI,MAAM,EAAE,UAAU,CAAC,EAAE;AACzB,IAAI,IAAI,EAAE,WAAW;AACrB,GAAG,CAAC,CAAC;AACL,EAAE,KAAK,MAAM,cAAc,IAAI,Q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EAAE;AACnC,UAAU,IAAI,EAAE,WAAW;AAC3B,SAAS;AACT,OAAO,CAAC,CAAC;AACT,KAAK,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE;AACtD,MAAM,QAAQ,CAAC,aAAa,GAAG;AAC/B,QAAQ,IAAI,EAAE,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,cAAc,CAAC,IAAI,CAAC,CAAC;AACvD,QAAQ,MAAM,EAAE,cAAc,CAAC,EAAE;AACjC,QAAQ,IAAI,EAAE,WAAW;AACzB,OAAO,CAAC;AACR,MAAM,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE;AACrD,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,eAAe,EAAE;AACrD;AACA,UAAU,QAAQ,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;AAC9C,SAAS;AACT,OAAO;AACP,KAAK;AACL,GAAG;AACH;;;;"}
1
+ {"version":3,"file":"inheritance.js","sources":["../../../src/plugin/python/inheritance.ts"],"sourcesContent":null,"names":["getOID","getGroupName","sortChildren"],"mappings":";;;;AACO,MAAM,gBAAgB,CAAC;AAC9B,EAAE,KAAK,GAAG,IAAI,GAAG,EAAE,CAAC;AACpB,EAAE,QAAQ,GAAG,IAAI,GAAG,EAAE,CAAC;AACvB;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,eAAe,CAAC,UAAU,EAAE,KAAK,EAAE;AACrC,IAAI,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;AACzD,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC9B,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CA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,IAAI;AAC9B,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,OAAO;AACxC,MAAM,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC5C,MAAM,IAAI,CAAC,IAAI,EAAE;AACjB,QAAQ,MAAM,IAAI,KAAK,CAAC,CAAC,qCAAqC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;AAC5E,OAAO;AACP,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC5B,MAAM,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE;AAC7D,QAAQ,KAAK,CAAC,KAAK,CAAC,CAAC;AACrB,OAAO;AACP,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACvB,KAAK,CAAC;AACN,IAAI,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE;AAC7C,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC;AAClB,KAAK;AACL,IAAI,OAAO,KAAK,CAAC,OAAO,EAAE,CAAC;AAC3B,GAAG;AACH;;;;"}
@@ -11,24 +11,11 @@ const index = require('./type-parsing/index.js');
11
11
  const utils = require('./utils.js');
12
12
  class DocspecTransformer {
13
13
  pythonTypeResolver;
14
+ inheritanceGraph = new inheritance.InheritanceGraph();
14
15
  symbolIdMap = {};
15
16
  namesToIds = {};
16
17
  moduleShortcuts;
17
18
 
18
- /**
19
- * Maps the name of the class to the list of Typedoc objects representing the classes that extend it.
20
- *
21
- * This is used for resolving the references to the base classes - in case the base class is encountered after the class that extends it.
22
- */
23
- forwardAncestorRefs = new Map();
24
-
25
- /**
26
- * Maps the name of the class to the reference to the Typedoc object representing the class.
27
- *
28
- * This is used to resolve the references to the base classes of a class using the name.
29
- */
30
- backwardAncestorRefs = new Map();
31
-
32
19
  /**
33
20
  * Stack of the docstrings of the current context.
34
21
  *
@@ -71,6 +58,7 @@ class DocspecTransformer {
71
58
  parentTypeDoc: typedocApiReference
72
59
  });
73
60
  }
61
+ this.inheritanceGraph.resolveInheritance();
74
62
  this.pythonTypeResolver.resolveTypes();
75
63
  this.namesToIds = Object.entries(this.symbolIdMap).reduce((acc, [id, {
76
64
  qualifiedName
@@ -79,7 +67,7 @@ class DocspecTransformer {
79
67
  return acc;
80
68
  }, {});
81
69
  this.fixRefs(typedocApiReference);
82
- this.sortChildren(typedocApiReference);
70
+ utils.sortChildren(typedocApiReference);
83
71
  return typedocApiReference;
84
72
  }
85
73
  getContext() {
@@ -240,15 +228,10 @@ class DocspecTransformer {
240
228
  if (currentDocspecNode.bases && currentDocspecNode.bases.length > 0) {
241
229
  for (const base of currentDocspecNode.bases) {
242
230
  const canonicalAncestorType = this.pythonTypeResolver.getBaseType(base);
243
- const baseTypedocMember = this.backwardAncestorRefs.get(canonicalAncestorType);
244
- if (baseTypedocMember) {
245
- inheritance.resolveInheritedSymbols(baseTypedocMember, currentTypedocNode);
246
- } else {
247
- this.forwardAncestorRefs.set(canonicalAncestorType, [...(this.forwardAncestorRefs.get(canonicalAncestorType) ?? []), currentTypedocNode]);
248
- }
231
+ this.inheritanceGraph.addRelationship(canonicalAncestorType, currentTypedocNode);
249
232
  }
250
233
  }
251
- this.backwardAncestorRefs.set(currentDocspecNode.name, currentTypedocNode);
234
+ this.inheritanceGraph.registerNode(currentTypedocNode);
252
235
  }
253
236
  const _utils$getGroupName = utils.getGroupName(currentTypedocNode),
254
237
  groupName = _utils$getGroupName.groupName,
@@ -267,13 +250,7 @@ class DocspecTransformer {
267
250
  }
268
251
  }
269
252
  parentTypeDoc.children?.push(currentTypedocNode);
270
- this.sortChildren(currentTypedocNode);
271
- if (currentTypedocNode.kindString === 'Class') {
272
- for (const descendant of this.forwardAncestorRefs.get(currentTypedocNode.name) ?? []) {
273
- inheritance.resolveInheritedSymbols(currentTypedocNode, descendant);
274
- this.sortChildren(descendant);
275
- }
276
- }
253
+ utils.sortChildren(currentTypedocNode);
277
254
  }
278
255
 
279
256
  // Get the URL of the member in GitHub
@@ -284,21 +261,6 @@ class DocspecTransformer {
284
261
  };
285
262
  }
286
263
 
287
- /**
288
- * Sorts the `groups` of `typedocMember` using {@link groupSort} and sorts the children of each group alphabetically.
289
- */
290
- sortChildren(typedocMember) {
291
- if (!typedocMember.groups) return;
292
- for (const group of typedocMember.groups) {
293
- group.children.sort((a, b) => {
294
- const firstName = typedocMember.children?.find(x => x.id === a || x.inheritedFrom?.target === a)?.name ?? 'a';
295
- const secondName = typedocMember.children?.find(x => x.id === b || x.inheritedFrom?.target === b)?.name ?? 'b';
296
- return firstName.localeCompare(secondName);
297
- });
298
- }
299
- typedocMember.groups?.sort((a, b) => utils.groupSort(a.title, b.title));
300
- }
301
-
302
264
  /**
303
265
  * If possible, parses the `.docstring` property of the passed object. If the docstring is a stringified JSON object,
304
266
  * it extracts the `args` and `returns` sections and adds them to the returned object.
@@ -1 +1 @@
1
- {"version":3,"file":"transformation.js","sources":["../../../src/plugin/python/transformation.ts"],"sourcesContent":null,"names":["PythonTypeResolver","projectUsesDocsGroupDecorator","isHidden","getOID","resolveInheritedSymbols","getGroupName","REPO_ROOT_PLACEHOLDER","groupSort","TYPEDOC_KINDS"],"mappings":";;;;;;;AAIO,MAAM,kBAAkB,CAAC;AAChC,EAAE,kBAAkB,CAAC;AACrB,EAAE,WAAW,GAAG,EAAE,CAAC;AACnB,EAAE,UAAU,GAAG,EAAE,CAAC;AAClB,EAAE,eAAe,CAAC;AAClB;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,mBAAmB,GAAG,IAAI,GAAG,EAAE,CAAC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,oBAAoB,GAAG,IAAI,GAAG,EAAE,CAAC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,YAAY,GAAG,EAAE,CAAC;AACpB,EAAE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C,MAAM,WAAW,GAAG;AACpB,QAAQ,IAAI,EAAE,SAAS;AACvB,QAAQ,KAAK,EAAE,aAAa,CAAC,KAAK;AAClC,OAAO,CAAC;AACR,KAAK;AACL,IAAI,OAAO;AACX,MAAM,WAAW;AACjB,MAAM,WAAW;AACjB,KAAK,CAAC;AACN,GAAG;AACH;;;;"}
1
+ {"version":3,"file":"transformation.js","sources":["../../../src/plugin/python/transformation.ts"],"sourcesContent":null,"names":["InheritanceGraph","PythonTypeResolver","projectUsesDocsGroupDecorator","sortChildren","isHidden","getOID","getGroupName","REPO_ROOT_PLACEHOLDER","TYPEDOC_KINDS"],"mappings":";;;;;;;AAIO,MAAM,kBAAkB,CAAC;AAChC,EAAE,kBAAkB,CAAC;AACrB,EAAE,gBAAgB,GAAG,IAAIA,4BAAgB,EAAE,CAAC;AAC5C,EAAE,WAAW,GAAG,EAAE,CAAC;AACnB,EAAE,UAAU,GAAG,EAAE,CAAC;AAClB,EAAE,eAAe,CAAC;AAClB;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,YAAY,GAAG,EAAE,CAAC;AACpB,EAAE,QAAQ,GAAG;AACb,IAAI,YAAY,EAAE,KAAK;AACvB,GAAG,CAAC;AACJ,EAAE,WAAW,CAAC;AACd,IAAI,eAAe;AACnB,GAAG,EAAE;AACL,IAAI,IAAI,CAAC,kBAAkB,GAAG,IAAIC,wBAAkB,EAAE,CAAC;AACvD,IAAI,IAAI,CAAC,eAAe,GAAG,eAAe,IAAI,EAAE,CAAC;AACjD,GAAG;AACH,EAAE,SAAS,CAAC,cAAc,EAAE;AAC5B;AACA,IAAI,MAAM,mBAAmB,GAAG;AAChC,MAAM,QAAQ,EAAE,EAAE;AAClB,MAAM,KAAK,EAAE,EAAE;AACf,MAAM,MAAM,EAAE,EAAE;AAChB,MAAM,EAAE,EAAE,CAAC;AACX,MAAM,IAAI,EAAE,CAAC;AACb,MAAM,UAAU,EAAE,SAAS;AAC3B,MAAM,IAAI,EAAE,cAAc;AAC1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,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE;AAC7F,MAAM,WAAW,GAAGA,oBAAa,CAAC,IAAI,CAAC;AACvC,MAAM,WAAW,GAAG,IAAI,CAAC,kBAAkB,CAAC,YAAY,CAAC,aAAa,CAAC,WAAW,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAC;AAC9G,KAAK;AACL,IAAI,IAAI,aAAa,CAAC,UAAU,KAAK,aAAa,EAAE;AACpD,MAAM,WAAW,GAAGA,oBAAa,CAAC,SAAS,CAAC;AAC5C,MAAM,WAAW,GAAG;AACpB,QAAQ,IAAI,EAAE,SAAS;AACvB,QAAQ,KAAK,EAAE,aAAa,CAAC,KAAK;AAClC,OAAO,CAAC;AACR,KAAK;AACL,IAAI,OAAO;AACX,MAAM,WAAW;AACjB,MAAM,WAAW;AACjB,KAAK,CAAC;AACN,GAAG;AACH;;;;"}
@@ -98,9 +98,25 @@ function groupSort(g1, g2) {
98
98
  }
99
99
  return g1.localeCompare(g2);
100
100
  }
101
+
102
+ /**
103
+ * Sorts the `groups` of `typedocMember` using {@link groupSort} and sorts the children of each group alphabetically.
104
+ */
105
+ function sortChildren(typedocMember) {
106
+ if (!typedocMember.groups) return;
107
+ for (const group of typedocMember.groups) {
108
+ group.children.sort((a, b) => {
109
+ const firstName = typedocMember.children?.find(x => x.id === a || x.inheritedFrom?.target === a)?.name ?? 'a';
110
+ const secondName = typedocMember.children?.find(x => x.id === b || x.inheritedFrom?.target === b)?.name ?? 'b';
111
+ return firstName.localeCompare(secondName);
112
+ });
113
+ }
114
+ typedocMember.groups?.sort((a, b) => groupSort(a.title, b.title));
115
+ }
101
116
  exports.getGroupName = getGroupName;
102
117
  exports.getOID = getOID;
103
118
  exports.groupSort = groupSort;
104
119
  exports.isHidden = isHidden;
105
120
  exports.projectUsesDocsGroupDecorator = projectUsesDocsGroupDecorator;
121
+ exports.sortChildren = sortChildren;
106
122
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../src/plugin/python/utils.ts"],"sourcesContent":null,"names":["TYPEDOC_KINDS","GROUP_ORDER"],"mappings":";;;;AAAA;AAEA,UAAU,WAAW,GAAG;AACxB,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;AACb,EAAE,OAAO,IAAI,EAAE;AACf,IAAI,MAAM,EAAE,EAAE,CAAC;AACf,GAAG;AACH,CAAC;AACD,MAAM,YAAY,GAAG,WAAW,EAAE,CAAC;AACnC;AACA;AACA;AACA;AACA;AACO,SAAS,MAAM,GAAG;AACzB,EAAE,OAAO,YAAY,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC;AACnC,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,YAAY,CAAC,MAAM,EAAE;AACrC,EAAE,IAAI,MAAM,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,YAAY,CAAC,EAAE;AAC9D,IAAI,MAAM,eAAe,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,YAAY,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACrG,IAAI,IAAI,eAAe,EAAE;AACzB,MAAM,OAAO;AACb,QAAQ,SAAS,EAAE,eAAe;AAClC,QAAQ,MAAM,EAAE,WAAW;AAC3B,OAAO,CAAC;AACR,KAAK;AACL,GAAG;AACH,EAAE,MAAM,eAAe,GAAG;AAC1B,IAAI,oBAAoB,EAAE,CAAC,IAAI,CAAC,gBAAgB,EAAE,0BAA0B,EAAE,0BAA0B,EAAE,sBAAsB,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;AAClJ,IAAI,iBAAiB,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,WAAW,EA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IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,OAAO;AACpC,EAAE,KAAK,MAAM,KAAK,IAAI,aAAa,CAAC,MAAM,EAAE;AAC5C,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK;AAClC,MAAM,MAAM,SAAS,GAAG,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,MAAM,KAAK,CAAC,CAAC,EAAE,IAAI,IAAI,GAAG,CAAC;AACpH,MAAM,MAAM,UAAU,GAAG,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,MAAM,KAAK,CAAC,CAAC,EAAE,IAAI,IAAI,GAAG,CAAC;AACrH,MAAM,OAAO,SAAS,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;AACjD,KAAK,CAAC,CAAC;AACP,GAAG;AACH,EAAE,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AACpE;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apify/docusaurus-plugin-typedoc-api",
3
- "version": "4.3.2",
3
+ "version": "4.3.3",
4
4
  "description": "Docusaurus plugin that provides source code API documentation powered by TypeDoc. ",
5
5
  "keywords": [
6
6
  "docusaurus",
@@ -1,80 +1,171 @@
1
1
  import type { TypeDocObject } from './types';
2
- import { getGroupName, getOID } from './utils';
3
-
4
- /**
5
- * Given an ancestor and a descendant objects, injects the children of the ancestor into the descendant.
6
- *
7
- * Sets the `extendedTypes` / `extendedBy` properties.
8
- * @param ancestor
9
- * @param descendant
10
- */
11
- export function resolveInheritedSymbols(ancestor: TypeDocObject, descendant: TypeDocObject) {
12
- descendant.children ??= [];
13
-
14
- descendant.extendedTypes = [
15
- ...(descendant.extendedTypes ?? []),
16
- {
17
- name: ancestor.name,
18
- target: ancestor.id,
19
- type: 'reference',
20
- },
21
- ];
22
-
23
- ancestor.extendedBy = [
24
- ...(ancestor.extendedBy ?? []),
25
- {
26
- name: descendant.name,
27
- target: descendant.id,
28
- type: 'reference',
29
- },
30
- ];
31
-
32
- for (const inheritedChild of ancestor.children ?? []) {
33
- const ownChild = descendant.children?.find((x) => x.name === inheritedChild.name);
34
-
35
- if (!ownChild) {
36
- const childId = getOID();
37
-
38
- const { groupName } = getGroupName(inheritedChild);
39
- if (!groupName) {
40
- throw new Error(
41
- `Couldn't resolve the group name for ${inheritedChild.name} (inherited child of ${ancestor.name})`,
42
- );
43
- }
2
+ import { getGroupName, getOID, sortChildren } from './utils';
44
3
 
45
- const group = descendant.groups?.find((g) => g.title === groupName);
4
+ export class InheritanceGraph {
5
+ private readonly nodes = new Map<TypeDocObject['name'], TypeDocObject>();
46
6
 
47
- if (group) {
48
- group.children.push(inheritedChild.id);
49
- } else {
50
- descendant.groups?.push({
51
- children: [inheritedChild.id],
52
- title: groupName,
53
- });
7
+ private readonly children: Map<TypeDocObject['name'], TypeDocObject['name'][]> = new Map();
8
+
9
+ /**
10
+ * Adds a new inheritance relationship.
11
+ * @param parentName Name of the ancestor class.
12
+ * @param child The object representing the descendant class.
13
+ */
14
+ addRelationship(parentName: TypeDocObject['name'], child: TypeDocObject) {
15
+ const children = this.children.get(parentName) ?? [];
16
+
17
+ children.push(child.name);
18
+ this.children.set(parentName, children);
19
+
20
+ this.nodes.set(child.name, child);
21
+
22
+ this.registerNode(child);
23
+ }
24
+
25
+ registerNode(node: TypeDocObject) {
26
+ this.nodes.set(node.name, node);
27
+ }
28
+
29
+ /**
30
+ * Resolves the inheritance relationships between the objects.
31
+ *
32
+ * Adds the inherited symbols to the descendants, and sets the `extendedTypes` / `extendedBy` properties.
33
+ * The symbol inheritance works transitively, so if `A` inherits from `B` and `B` inherits from `C`, then `A` inherits from `C`.
34
+ *
35
+ * The order of the inheritance is determined by the topological order of the inheritance graph (to ensure the ancestors are processed before the descendants).
36
+ */
37
+ resolveInheritance() {
38
+ const objects = this.getTopologicalOrder();
39
+
40
+ for (const parent of objects) {
41
+ const children = this.children.get(parent.name);
42
+
43
+ if (children) {
44
+ for (const childId of children) {
45
+ const child = this.nodes.get(childId);
46
+
47
+ if (child) {
48
+ this.resolveInheritedSymbols(parent, child);
49
+ }
50
+ }
54
51
  }
52
+ }
53
+ }
55
54
 
56
- descendant.children.push({
57
- ...inheritedChild,
58
- id: childId,
59
- inheritedFrom: {
55
+ /**
56
+ * Given two TypeDoc objects, resolves the inherited symbols between them.
57
+ * This method injects the ancestors' symbols into the descendants.
58
+ *
59
+ * In case the descendant already has a symbol with the same name, the symbol is not injected.
60
+ * @param ancestor The ancestor object.
61
+ * @param descendant The descendant object.
62
+ */
63
+ protected resolveInheritedSymbols(ancestor: TypeDocObject, descendant: TypeDocObject) {
64
+ descendant.children ??= [];
65
+
66
+ descendant.extendedTypes = [
67
+ ...(descendant.extendedTypes ?? []),
68
+ {
69
+ name: ancestor.name,
70
+ target: ancestor.id,
71
+ type: 'reference',
72
+ },
73
+ ];
74
+
75
+ ancestor.extendedBy = [
76
+ ...(ancestor.extendedBy ?? []),
77
+ {
78
+ name: descendant.name,
79
+ target: descendant.id,
80
+ type: 'reference',
81
+ },
82
+ ];
83
+
84
+ for (const inheritedChild of ancestor.children ?? []) {
85
+ const ownChild = descendant.children?.find((x) => x.name === inheritedChild.name);
86
+
87
+ if (!ownChild) {
88
+ const childId = getOID();
89
+
90
+ const { groupName } = getGroupName(inheritedChild);
91
+ if (!groupName) {
92
+ throw new Error(
93
+ `Couldn't resolve the group name for ${inheritedChild.name} (inherited child of ${ancestor.name})`,
94
+ );
95
+ }
96
+
97
+ const group = descendant.groups?.find((g) => g.title === groupName);
98
+
99
+ if (group) {
100
+ group.children.push(inheritedChild.id);
101
+ } else {
102
+ descendant.groups?.push({
103
+ children: [inheritedChild.id],
104
+ title: groupName,
105
+ });
106
+ }
107
+
108
+ descendant.children.push({
109
+ ...inheritedChild,
110
+ id: childId,
111
+ inheritedFrom: {
112
+ name: `${ancestor.name}.${inheritedChild.name}`,
113
+ target: inheritedChild.id,
114
+ type: 'reference',
115
+ },
116
+ });
117
+ } else if (!ownChild.comment?.summary?.[0]?.text) {
118
+ ownChild.inheritedFrom = {
60
119
  name: `${ancestor.name}.${inheritedChild.name}`,
61
120
  target: inheritedChild.id,
62
121
  type: 'reference',
63
- },
64
- });
65
- } else if (!ownChild.comment?.summary?.[0]?.text) {
66
- ownChild.inheritedFrom = {
67
- name: `${ancestor.name}.${inheritedChild.name}`,
68
- target: inheritedChild.id,
69
- type: 'reference',
70
- };
71
-
72
- for (const key of Object.keys(inheritedChild)) {
73
- if (key !== 'id' && key !== 'inheritedFrom') {
74
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
75
- ownChild[key as keyof typeof ownChild] = inheritedChild[key as keyof typeof inheritedChild];
122
+ };
123
+
124
+ for (const key of Object.keys(inheritedChild)) {
125
+ if (key !== 'id' && key !== 'inheritedFrom') {
126
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
127
+ ownChild[key as keyof typeof ownChild] = inheritedChild[key as keyof typeof inheritedChild];
128
+ }
76
129
  }
77
130
  }
78
131
  }
132
+
133
+ sortChildren(descendant);
134
+ }
135
+
136
+ /**
137
+ * Returns the topological order of the inheritance graph.
138
+ *
139
+ * The topological order puts the ancestors before their descendants.
140
+ * This ensures that all the ancestors are processed before the descendants.
141
+ * @returns
142
+ */
143
+ protected getTopologicalOrder(): TypeDocObject[] {
144
+ const visited = new Set<TypeDocObject['name']>();
145
+ const stack: TypeDocObject[] = [];
146
+
147
+ const visit = (nodeName: TypeDocObject['name']) => {
148
+ if (visited.has(nodeName)) return;
149
+
150
+ const node = this.nodes.get(nodeName);
151
+
152
+ if (!node) {
153
+ throw new Error(`Couldn't find the node with the name ${nodeName}`);
154
+ }
155
+
156
+ visited.add(nodeName);
157
+
158
+ for (const child of this.children.get(nodeName) ?? []) {
159
+ visit(child);
160
+ }
161
+
162
+ stack.push(node);
163
+ };
164
+
165
+ for (const node of this.children.keys()) {
166
+ visit(node as TypeDocObject['name']);
167
+ }
168
+
169
+ return stack.reverse();
79
170
  }
80
171
  }
@@ -1,5 +1,5 @@
1
1
  import { REPO_ROOT_PLACEHOLDER, TYPEDOC_KINDS } from './consts';
2
- import { resolveInheritedSymbols } from './inheritance';
2
+ import { InheritanceGraph } from './inheritance';
3
3
  import { PythonTypeResolver } from './type-parsing';
4
4
  import type {
5
5
  DocspecDocstring,
@@ -8,7 +8,7 @@ import type {
8
8
  TypeDocObject,
9
9
  TypeDocType,
10
10
  } from './types';
11
- import { getGroupName, getOID, groupSort, isHidden, projectUsesDocsGroupDecorator } from './utils';
11
+ import { getGroupName, getOID, isHidden, projectUsesDocsGroupDecorator, sortChildren } from './utils';
12
12
 
13
13
  interface TransformObjectOptions {
14
14
  /**
@@ -35,26 +35,14 @@ interface DocspecTransformerOptions {
35
35
  export class DocspecTransformer {
36
36
  private pythonTypeResolver: PythonTypeResolver;
37
37
 
38
+ private inheritanceGraph: InheritanceGraph = new InheritanceGraph();
39
+
38
40
  private symbolIdMap: Record<number, { qualifiedName: string; sourceFileName: string }> = {};
39
41
 
40
42
  private namesToIds: Record<string, number> = {};
41
43
 
42
44
  private moduleShortcuts: Record<string, string>;
43
45
 
44
- /**
45
- * Maps the name of the class to the list of Typedoc objects representing the classes that extend it.
46
- *
47
- * This is used for resolving the references to the base classes - in case the base class is encountered after the class that extends it.
48
- */
49
- private forwardAncestorRefs = new Map<string, TypeDocObject[]>();
50
-
51
- /**
52
- * Maps the name of the class to the reference to the Typedoc object representing the class.
53
- *
54
- * This is used to resolve the references to the base classes of a class using the name.
55
- */
56
- private backwardAncestorRefs = new Map<string, TypeDocObject>();
57
-
58
46
  /**
59
47
  * Stack of the docstrings of the current context.
60
48
  *
@@ -102,6 +90,7 @@ export class DocspecTransformer {
102
90
  });
103
91
  }
104
92
 
93
+ this.inheritanceGraph.resolveInheritance();
105
94
  this.pythonTypeResolver.resolveTypes();
106
95
 
107
96
  this.namesToIds = Object.entries(this.symbolIdMap).reduce<Record<string, number>>(
@@ -113,7 +102,7 @@ export class DocspecTransformer {
113
102
  );
114
103
 
115
104
  this.fixRefs(typedocApiReference);
116
- this.sortChildren(typedocApiReference);
105
+ sortChildren(typedocApiReference);
117
106
 
118
107
  return typedocApiReference;
119
108
  }
@@ -296,19 +285,11 @@ export class DocspecTransformer {
296
285
  for (const base of currentDocspecNode.bases) {
297
286
  const canonicalAncestorType = this.pythonTypeResolver.getBaseType(base);
298
287
 
299
- const baseTypedocMember = this.backwardAncestorRefs.get(canonicalAncestorType);
300
- if (baseTypedocMember) {
301
- resolveInheritedSymbols(baseTypedocMember, currentTypedocNode);
302
- } else {
303
- this.forwardAncestorRefs.set(canonicalAncestorType, [
304
- ...(this.forwardAncestorRefs.get(canonicalAncestorType) ?? []),
305
- currentTypedocNode,
306
- ]);
307
- }
288
+ this.inheritanceGraph.addRelationship(canonicalAncestorType, currentTypedocNode);
308
289
  }
309
290
  }
310
291
 
311
- this.backwardAncestorRefs.set(currentDocspecNode.name, currentTypedocNode);
292
+ this.inheritanceGraph.registerNode(currentTypedocNode);
312
293
  }
313
294
 
314
295
  const { groupName, source: groupSource } = getGroupName(currentTypedocNode);
@@ -331,16 +312,7 @@ export class DocspecTransformer {
331
312
  }
332
313
 
333
314
  parentTypeDoc.children?.push(currentTypedocNode);
334
-
335
- this.sortChildren(currentTypedocNode);
336
-
337
- if (currentTypedocNode.kindString === 'Class') {
338
- for (const descendant of this.forwardAncestorRefs.get(currentTypedocNode.name) ?? []) {
339
- resolveInheritedSymbols(currentTypedocNode, descendant);
340
-
341
- this.sortChildren(descendant);
342
- }
343
- }
315
+ sortChildren(currentTypedocNode);
344
316
  }
345
317
 
346
318
  // Get the URL of the member in GitHub
@@ -350,26 +322,6 @@ export class DocspecTransformer {
350
322
  return { filePathInRepo };
351
323
  }
352
324
 
353
- /**
354
- * Sorts the `groups` of `typedocMember` using {@link groupSort} and sorts the children of each group alphabetically.
355
- */
356
- private sortChildren(typedocMember: TypeDocObject) {
357
- if (!typedocMember.groups) return;
358
-
359
- for (const group of typedocMember.groups) {
360
- group.children.sort((a, b) => {
361
- const firstName =
362
- typedocMember.children?.find((x) => x.id === a || x.inheritedFrom?.target === a)?.name ??
363
- 'a';
364
- const secondName =
365
- typedocMember.children?.find((x) => x.id === b || x.inheritedFrom?.target === b)?.name ??
366
- 'b';
367
- return firstName.localeCompare(secondName);
368
- });
369
- }
370
- typedocMember.groups?.sort((a, b) => groupSort(a.title, b.title));
371
- }
372
-
373
325
  /**
374
326
  * If possible, parses the `.docstring` property of the passed object. If the docstring is a stringified JSON object,
375
327
  * it extracts the `args` and `returns` sections and adds them to the returned object.
@@ -121,3 +121,23 @@ export function groupSort(g1: string, g2: string) {
121
121
  }
122
122
  return g1.localeCompare(g2);
123
123
  }
124
+
125
+ /**
126
+ * Sorts the `groups` of `typedocMember` using {@link groupSort} and sorts the children of each group alphabetically.
127
+ */
128
+ export function sortChildren(typedocMember: TypeDocObject) {
129
+ if (!typedocMember.groups) return;
130
+
131
+ for (const group of typedocMember.groups) {
132
+ group.children.sort((a, b) => {
133
+ const firstName =
134
+ typedocMember.children?.find((x) => x.id === a || x.inheritedFrom?.target === a)?.name ??
135
+ 'a';
136
+ const secondName =
137
+ typedocMember.children?.find((x) => x.id === b || x.inheritedFrom?.target === b)?.name ??
138
+ 'b';
139
+ return firstName.localeCompare(secondName);
140
+ });
141
+ }
142
+ typedocMember.groups?.sort((a, b) => groupSort(a.title, b.title));
143
+ }