@apify/docusaurus-plugin-typedoc-api 4.4.12 → 5.1.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.
- package/README.md +38 -296
- package/lib/components/AnchorLink.d.ts +5 -0
- package/lib/components/AnchorLink.d.ts.map +1 -0
- package/lib/components/AnchorLink.js +7 -26
- package/lib/components/AnchorLink.js.map +1 -1
- package/lib/components/ApiChangelog.d.ts +6 -0
- package/lib/components/ApiChangelog.d.ts.map +1 -0
- package/lib/components/ApiChangelog.js +7 -24
- package/lib/components/ApiChangelog.js.map +1 -1
- package/lib/components/ApiDataContext.d.ts +6 -0
- package/lib/components/ApiDataContext.d.ts.map +1 -0
- package/lib/components/ApiDataContext.js +12 -15
- package/lib/components/ApiDataContext.js.map +1 -1
- package/lib/components/ApiIndex.d.ts +14 -0
- package/lib/components/ApiIndex.d.ts.map +1 -0
- package/lib/components/ApiIndex.js +33 -93
- package/lib/components/ApiIndex.js.map +1 -1
- package/lib/components/ApiItem.d.ts +6 -0
- package/lib/components/ApiItem.d.ts.map +1 -0
- package/lib/components/ApiItem.js +131 -191
- package/lib/components/ApiItem.js.map +1 -1
- package/lib/components/ApiItemLayout.d.ts +14 -0
- package/lib/components/ApiItemLayout.d.ts.map +1 -0
- package/lib/components/ApiItemLayout.js +21 -97
- package/lib/components/ApiItemLayout.js.map +1 -1
- package/lib/components/ApiOptionsContext.d.ts +5 -0
- package/lib/components/ApiOptionsContext.d.ts.map +1 -0
- package/lib/components/ApiOptionsContext.js +5 -9
- package/lib/components/ApiOptionsContext.js.map +1 -1
- package/lib/components/ApiOptionsLayout.d.ts +4 -0
- package/lib/components/ApiOptionsLayout.d.ts.map +1 -0
- package/lib/components/ApiOptionsLayout.js +10 -34
- package/lib/components/ApiOptionsLayout.js.map +1 -1
- package/lib/components/ApiPage.d.ts +11 -0
- package/lib/components/ApiPage.d.ts.map +1 -0
- package/lib/components/ApiPage.js +50 -63
- package/lib/components/ApiPage.js.map +1 -1
- package/lib/components/Breadcrumb.d.ts +7 -0
- package/lib/components/Breadcrumb.d.ts.map +1 -0
- package/lib/components/Breadcrumb.js +17 -49
- package/lib/components/Breadcrumb.js.map +1 -1
- package/lib/components/Comment.d.ts +10 -0
- package/lib/components/Comment.d.ts.map +1 -0
- package/lib/components/Comment.js +33 -60
- package/lib/components/Comment.js.map +1 -1
- package/lib/components/CommentBadges.d.ts +9 -0
- package/lib/components/CommentBadges.d.ts.map +1 -0
- package/lib/components/CommentBadges.js +16 -28
- package/lib/components/CommentBadges.js.map +1 -1
- package/lib/components/DefaultValue.d.ts +10 -0
- package/lib/components/DefaultValue.d.ts.map +1 -0
- package/lib/components/DefaultValue.js +25 -55
- package/lib/components/DefaultValue.js.map +1 -1
- package/lib/components/Flags.d.ts +6 -0
- package/lib/components/Flags.d.ts.map +1 -0
- package/lib/components/Flags.js +11 -22
- package/lib/components/Flags.js.map +1 -1
- package/lib/components/Footer.d.ts +2 -0
- package/lib/components/Footer.d.ts.map +1 -0
- package/lib/components/Footer.js +4 -16
- package/lib/components/Footer.js.map +1 -1
- package/lib/components/Hierarchy.d.ts +6 -0
- package/lib/components/Hierarchy.d.ts.map +1 -0
- package/lib/components/Hierarchy.js +5 -25
- package/lib/components/Hierarchy.js.map +1 -1
- package/lib/components/Icon.d.ts +6 -0
- package/lib/components/Icon.d.ts.map +1 -0
- package/lib/components/Icon.js +10 -21
- package/lib/components/Icon.js.map +1 -1
- package/lib/components/Index.d.ts +9 -0
- package/lib/components/Index.d.ts.map +1 -0
- package/lib/components/Index.js +30 -113
- package/lib/components/Index.js.map +1 -1
- package/lib/components/Markdown.d.ts +5 -0
- package/lib/components/Markdown.d.ts.map +1 -0
- package/lib/components/Markdown.js +138 -202
- package/lib/components/Markdown.js.map +1 -1
- package/lib/components/Member.d.ts +5 -0
- package/lib/components/Member.d.ts.map +1 -0
- package/lib/components/Member.js +40 -69
- package/lib/components/Member.js.map +1 -1
- package/lib/components/MemberDeclaration.d.ts +5 -0
- package/lib/components/MemberDeclaration.d.ts.map +1 -0
- package/lib/components/MemberDeclaration.js +20 -71
- package/lib/components/MemberDeclaration.js.map +1 -1
- package/lib/components/MemberGetterSetter.d.ts +8 -0
- package/lib/components/MemberGetterSetter.d.ts.map +1 -0
- package/lib/components/MemberGetterSetter.js +13 -68
- package/lib/components/MemberGetterSetter.js.map +1 -1
- package/lib/components/MemberReference.d.ts +6 -0
- package/lib/components/MemberReference.d.ts.map +1 -0
- package/lib/components/MemberReference.js +18 -48
- package/lib/components/MemberReference.js.map +1 -1
- package/lib/components/MemberSignatureBody.d.ts +9 -0
- package/lib/components/MemberSignatureBody.d.ts.map +1 -0
- package/lib/components/MemberSignatureBody.js +85 -182
- package/lib/components/MemberSignatureBody.js.map +1 -1
- package/lib/components/MemberSignatureTitle.d.ts +11 -0
- package/lib/components/MemberSignatureTitle.d.ts.map +1 -0
- package/lib/components/MemberSignatureTitle.js +27 -81
- package/lib/components/MemberSignatureTitle.js.map +1 -1
- package/lib/components/MemberSignatures.d.ts +7 -0
- package/lib/components/MemberSignatures.d.ts.map +1 -0
- package/lib/components/MemberSignatures.js +18 -66
- package/lib/components/MemberSignatures.js.map +1 -1
- package/lib/components/MemberSources.d.ts +7 -0
- package/lib/components/MemberSources.d.ts.map +1 -0
- package/lib/components/MemberSources.js +10 -34
- package/lib/components/MemberSources.js.map +1 -1
- package/lib/components/Members.d.ts +6 -0
- package/lib/components/Members.d.ts.map +1 -0
- package/lib/components/Members.js +29 -49
- package/lib/components/Members.js.map +1 -1
- package/lib/components/MembersGroup.d.ts +6 -0
- package/lib/components/MembersGroup.d.ts.map +1 -0
- package/lib/components/MembersGroup.js +16 -40
- package/lib/components/MembersGroup.js.map +1 -1
- package/lib/components/Parameter.d.ts +6 -0
- package/lib/components/Parameter.d.ts.map +1 -0
- package/lib/components/Parameter.js +35 -171
- package/lib/components/Parameter.js.map +1 -1
- package/lib/components/Reflection.d.ts +6 -0
- package/lib/components/Reflection.d.ts.map +1 -0
- package/lib/components/Reflection.js +29 -132
- package/lib/components/Reflection.js.map +1 -1
- package/lib/components/SourceLink.d.ts +10 -0
- package/lib/components/SourceLink.d.ts.map +1 -0
- package/lib/components/SourceLink.js +16 -36
- package/lib/components/SourceLink.js.map +1 -1
- package/lib/components/Type.d.ts +12 -0
- package/lib/components/Type.d.ts.map +1 -0
- package/lib/components/Type.js +142 -464
- package/lib/components/Type.js.map +1 -1
- package/lib/components/TypeAndParent.d.ts +6 -0
- package/lib/components/TypeAndParent.d.ts.map +1 -0
- package/lib/components/TypeAndParent.js +11 -27
- package/lib/components/TypeAndParent.js.map +1 -1
- package/lib/components/TypeParameters.d.ts +6 -0
- package/lib/components/TypeParameters.d.ts.map +1 -0
- package/lib/components/TypeParameters.js +10 -38
- package/lib/components/TypeParameters.js.map +1 -1
- package/lib/components/TypeParametersGeneric.d.ts +6 -0
- package/lib/components/TypeParametersGeneric.d.ts.map +1 -0
- package/lib/components/TypeParametersGeneric.js +8 -27
- package/lib/components/TypeParametersGeneric.js.map +1 -1
- package/lib/components/VersionBanner.d.ts +2 -0
- package/lib/components/VersionBanner.d.ts.map +1 -0
- package/lib/components/VersionBanner.js +18 -49
- package/lib/components/VersionBanner.js.map +1 -1
- package/lib/hooks/useBreadcrumbs.d.ts +2 -0
- package/lib/hooks/useBreadcrumbs.d.ts.map +1 -0
- package/lib/hooks/useBreadcrumbs.js +5 -8
- package/lib/hooks/useBreadcrumbs.js.map +1 -1
- package/lib/hooks/useGitRefName.d.ts +2 -0
- package/lib/hooks/useGitRefName.d.ts.map +1 -0
- package/lib/hooks/useGitRefName.js +5 -8
- package/lib/hooks/useGitRefName.js.map +1 -1
- package/lib/hooks/useMinimalLayout.d.ts +2 -0
- package/lib/hooks/useMinimalLayout.d.ts.map +1 -0
- package/lib/hooks/useMinimalLayout.js +5 -8
- package/lib/hooks/useMinimalLayout.js.map +1 -1
- package/lib/hooks/useReflection.d.ts +4 -0
- package/lib/hooks/useReflection.d.ts.map +1 -0
- package/lib/hooks/useReflection.js +15 -21
- package/lib/hooks/useReflection.js.map +1 -1
- package/lib/hooks/useReflectionMap.d.ts +3 -0
- package/lib/hooks/useReflectionMap.d.ts.map +1 -0
- package/lib/hooks/useReflectionMap.js +5 -8
- package/lib/hooks/useReflectionMap.js.map +1 -1
- package/lib/index.d.ts +4 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +349 -361
- package/lib/index.js.map +1 -1
- package/lib/markdownLoader.d.ts +6 -0
- package/lib/markdownLoader.d.ts.map +1 -0
- package/lib/markdownLoader.js +6 -10
- package/lib/markdownLoader.js.map +1 -1
- package/lib/plugin/data.d.ts +21 -0
- package/lib/plugin/data.d.ts.map +1 -0
- package/lib/plugin/data.js +391 -429
- package/lib/plugin/data.js.map +1 -1
- package/lib/plugin/python/consts.d.ts +35 -0
- package/lib/plugin/python/consts.d.ts.map +1 -0
- package/lib/plugin/python/consts.js +44 -44
- package/lib/plugin/python/consts.js.map +1 -1
- package/lib/plugin/python/index.d.ts +12 -0
- package/lib/plugin/python/index.d.ts.map +1 -0
- package/lib/plugin/python/index.js +25 -36
- package/lib/plugin/python/index.js.map +1 -1
- package/lib/plugin/python/inheritance.d.ts +42 -0
- package/lib/plugin/python/inheritance.d.ts.map +1 -0
- package/lib/plugin/python/inheritance.js +148 -153
- package/lib/plugin/python/inheritance.js.map +1 -1
- package/lib/plugin/python/packageVersions.d.ts +7 -0
- package/lib/plugin/python/packageVersions.d.ts.map +1 -0
- package/lib/plugin/python/packageVersions.js +30 -38
- package/lib/plugin/python/packageVersions.js.map +1 -1
- package/lib/plugin/python/transformation.d.ts +90 -0
- package/lib/plugin/python/transformation.d.ts.map +1 -0
- package/lib/plugin/python/transformation.js +424 -391
- package/lib/plugin/python/transformation.js.map +1 -1
- package/lib/plugin/python/type-parsing/index.d.ts +34 -0
- package/lib/plugin/python/type-parsing/index.d.ts.map +1 -0
- package/lib/plugin/python/type-parsing/index.js +78 -85
- package/lib/plugin/python/type-parsing/index.js.map +1 -1
- package/lib/plugin/python/types.d.ts +107 -0
- package/lib/plugin/python/types.d.ts.map +1 -0
- package/lib/plugin/python/types.js +2 -2
- package/lib/plugin/python/types.js.map +1 -1
- package/lib/plugin/python/utils.d.ts +40 -0
- package/lib/plugin/python/utils.d.ts.map +1 -0
- package/lib/plugin/python/utils.js +74 -73
- package/lib/plugin/python/utils.js.map +1 -1
- package/lib/plugin/sidebar.d.ts +6 -0
- package/lib/plugin/sidebar.d.ts.map +1 -0
- package/lib/plugin/sidebar.js +94 -96
- package/lib/plugin/sidebar.js.map +1 -1
- package/lib/plugin/structure/0.23.d.ts +3 -0
- package/lib/plugin/structure/0.23.d.ts.map +1 -0
- package/lib/plugin/structure/0.23.js +33 -41
- package/lib/plugin/structure/0.23.js.map +1 -1
- package/lib/plugin/url.d.ts +6 -0
- package/lib/plugin/url.d.ts.map +1 -0
- package/lib/plugin/url.js +36 -46
- package/lib/plugin/url.js.map +1 -1
- package/lib/plugin/version.d.ts +5 -0
- package/lib/plugin/version.d.ts.map +1 -0
- package/lib/plugin/version.js +73 -78
- package/lib/plugin/version.js.map +1 -1
- package/lib/types.d.ts +142 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +2 -2
- package/lib/types.js.map +1 -1
- package/lib/utils/helpers.d.ts +2 -0
- package/lib/utils/helpers.d.ts.map +1 -0
- package/lib/utils/helpers.js +5 -7
- package/lib/utils/helpers.js.map +1 -1
- package/lib/utils/hierarchy.d.ts +8 -0
- package/lib/utils/hierarchy.d.ts.map +1 -0
- package/lib/utils/hierarchy.js +31 -33
- package/lib/utils/hierarchy.js.map +1 -1
- package/lib/utils/icons.d.ts +5 -0
- package/lib/utils/icons.d.ts.map +1 -0
- package/lib/utils/icons.js +82 -114
- package/lib/utils/icons.js.map +1 -1
- package/lib/utils/links.d.ts +2 -0
- package/lib/utils/links.d.ts.map +1 -0
- package/lib/utils/links.js +24 -41
- package/lib/utils/links.js.map +1 -1
- package/lib/utils/markdown.d.ts +4 -0
- package/lib/utils/markdown.d.ts.map +1 -0
- package/lib/utils/markdown.js +45 -54
- package/lib/utils/markdown.js.map +1 -1
- package/lib/utils/reexports.d.ts +5 -0
- package/lib/utils/reexports.d.ts.map +1 -0
- package/lib/utils/reexports.js +90 -90
- package/lib/utils/reexports.js.map +1 -1
- package/lib/utils/removeScopes.d.ts +2 -0
- package/lib/utils/removeScopes.d.ts.map +1 -0
- package/lib/utils/removeScopes.js +7 -0
- package/lib/utils/removeScopes.js.map +1 -0
- package/lib/utils/visibility.d.ts +6 -0
- package/lib/utils/visibility.d.ts.map +1 -0
- package/lib/utils/visibility.js +14 -19
- package/lib/utils/visibility.js.map +1 -1
- package/package.json +29 -17
- package/python-scripts/docspec-gen/google_docstring_processor.py +54 -20
- package/src/components/ApiIndex.tsx +1 -1
- package/src/index.ts +2 -2
- package/src/plugin/data.ts +3 -3
- package/src/plugin/python/index.ts +3 -3
- package/src/plugin/python/packageVersions.ts +3 -3
- package/src/plugin/python/transformation.ts +89 -15
- package/src/plugin/python/types.ts +3 -4
- package/src/plugin/sidebar.ts +1 -1
- package/src/plugin/url.ts +1 -1
- package/src/plugin/version.ts +1 -1
- package/src/utils/links.ts +1 -12
- package/src/utils/removeScopes.ts +10 -0
- /package/{assets/styles-8ad572ec.css → lib/components/styles.css} +0 -0
|
@@ -1,159 +1,154 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
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
|
-
|
|
159
|
-
//# sourceMappingURL=inheritance.js.map
|
|
154
|
+
//# sourceMappingURL=inheritance.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inheritance.js","sources":["../../../src/plugin/python/inheritance.ts"],"
|
|
1
|
+
{"version":3,"file":"inheritance.js","sourceRoot":"","sources":["../../../src/plugin/python/inheritance.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,E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AI,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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
|
|
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"],"
|
|
1
|
+
{"version":3,"file":"packageVersions.js","sourceRoot":"","sources":["../../../src/plugin/python/packageVersions.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,YAAsB;IAC1D,4FAA4F;IAC5F,MAAM,WAAW,GAA2B,EAAE,CAAC;IAE/C,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;QAChC,MAAM,WAAW,GAAG,YAAY,CAAC,SAAS,CAAC,QAAQ,EAAE;YACpD,IAAI;YACJ,UAAU,GAAG,WAAW,GAAG,eAAe;SAC1C,CAAC,CAAC;QACH,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC9B,WAAW,CAAC,GAAG,CAAC,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC;QAC/D,CAAC;IACF,CAAC;IAED,OAAO,WAAW,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,WAAmB,EAAE,QAAgB;IACxE,IAAI,UAAU,GAAG,WAAW,CAAC;IAC7B,OAAO,UAAU,KAAK,GAAG,EAAE,CAAC;QAC3B,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACtC,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC;YACpD,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QACxC,CAAC;IACF,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,MAAM,QAAQ,gCAAgC,CAAC,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,iBAA0B;;IAC/D,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,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,90 @@
|
|
|
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
|
+
/**
|
|
32
|
+
* Maps Google-style docstring section names to Docusaurus admonition types.
|
|
33
|
+
* Only sections that semantically match admonition purposes are included.
|
|
34
|
+
* Sections like Raises, Yields, Attributes are technical documentation, not admonitions.
|
|
35
|
+
*/
|
|
36
|
+
private static readonly SECTION_TO_ADMONITION;
|
|
37
|
+
private pythonTypeResolver;
|
|
38
|
+
private inheritanceGraph;
|
|
39
|
+
private symbolIdTracker;
|
|
40
|
+
private moduleShortcuts;
|
|
41
|
+
private gitRevision;
|
|
42
|
+
/**
|
|
43
|
+
* Stack of the docstrings of the current context.
|
|
44
|
+
*
|
|
45
|
+
* Used to read the class Google-style docstrings from the class' properties and methods.
|
|
46
|
+
*/
|
|
47
|
+
private contextStack;
|
|
48
|
+
private settings;
|
|
49
|
+
constructor({ moduleShortcuts, gitRevision }: DocspecTransformerOptions);
|
|
50
|
+
transform(docspecModules: DocspecObject[]): TypeDocObject;
|
|
51
|
+
private getContext;
|
|
52
|
+
private popContext;
|
|
53
|
+
private newContext;
|
|
54
|
+
private unpackKwargs;
|
|
55
|
+
/**
|
|
56
|
+
* Recursively traverse the Typedoc structure and fix the references to the named entities.
|
|
57
|
+
*
|
|
58
|
+
* Searches for the {@link TypeDocType} structure with the `type` property set to `reference`, and replaces the `target` property
|
|
59
|
+
* with the corresponding ID of the named entity.
|
|
60
|
+
*/
|
|
61
|
+
private fixRefs;
|
|
62
|
+
private makeMethodSignature;
|
|
63
|
+
/**
|
|
64
|
+
* Given a docspec object outputted by `pydoc-markdown`, transforms this object into the Typedoc structure,
|
|
65
|
+
* and appends it as a child of the `parentTypeDoc` Typedoc object (which serves as an accumulator for the recursion).
|
|
66
|
+
* @param obj
|
|
67
|
+
* @param parent
|
|
68
|
+
* @param module
|
|
69
|
+
*/
|
|
70
|
+
private walkAndTransform;
|
|
71
|
+
private getGitHubUrls;
|
|
72
|
+
/**
|
|
73
|
+
* Converts a docstring section to Docusaurus admonition markdown format.
|
|
74
|
+
*/
|
|
75
|
+
private sectionToAdmonition;
|
|
76
|
+
/**
|
|
77
|
+
* If possible, parses the `.docstring` property of the passed object. If the docstring is a stringified JSON object,
|
|
78
|
+
* it extracts the `args` and `returns` sections and adds them to the returned object.
|
|
79
|
+
*
|
|
80
|
+
* The docstring format is a JSON object with a `content` array that contains interleaved text strings
|
|
81
|
+
* and section objects, preserving the original order from the docstring.
|
|
82
|
+
*/
|
|
83
|
+
private parseDocstring;
|
|
84
|
+
/**
|
|
85
|
+
* Given the current Docspec object and the parent Typedoc object, returns the Typedoc type and kind of the current object.
|
|
86
|
+
*/
|
|
87
|
+
private getTypedocType;
|
|
88
|
+
}
|
|
89
|
+
export {};
|
|
90
|
+
//# 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,MA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