@apify/docusaurus-plugin-typedoc-api 3.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.
- package/LICENSE +21 -0
- package/README.md +290 -0
- package/assets/styles-8ad572ec.css +303 -0
- package/lib/components/AnchorLink.js +22 -0
- package/lib/components/AnchorLink.js.map +1 -0
- package/lib/components/ApiChangelog.js +28 -0
- package/lib/components/ApiChangelog.js.map +1 -0
- package/lib/components/ApiDataContext.js +16 -0
- package/lib/components/ApiDataContext.js.map +1 -0
- package/lib/components/ApiIndex.js +80 -0
- package/lib/components/ApiIndex.js.map +1 -0
- package/lib/components/ApiItem.js +86 -0
- package/lib/components/ApiItem.js.map +1 -0
- package/lib/components/ApiItemLayout.js +69 -0
- package/lib/components/ApiItemLayout.js.map +1 -0
- package/lib/components/ApiPage.js +69 -0
- package/lib/components/ApiPage.js.map +1 -0
- package/lib/components/Breadcrumb.js +38 -0
- package/lib/components/Breadcrumb.js.map +1 -0
- package/lib/components/Comment.js +56 -0
- package/lib/components/Comment.js.map +1 -0
- package/lib/components/CommentBadges.js +35 -0
- package/lib/components/CommentBadges.js.map +1 -0
- package/lib/components/DefaultValue.js +49 -0
- package/lib/components/DefaultValue.js.map +1 -0
- package/lib/components/Flags.js +27 -0
- package/lib/components/Flags.js.map +1 -0
- package/lib/components/Footer.js +18 -0
- package/lib/components/Footer.js.map +1 -0
- package/lib/components/Hierarchy.js +27 -0
- package/lib/components/Hierarchy.js.map +1 -0
- package/lib/components/Icon.js +27 -0
- package/lib/components/Icon.js.map +1 -0
- package/lib/components/Index.js +87 -0
- package/lib/components/Index.js.map +1 -0
- package/lib/components/Markdown.js +204 -0
- package/lib/components/Markdown.js.map +1 -0
- package/lib/components/Member.js +68 -0
- package/lib/components/Member.js.map +1 -0
- package/lib/components/MemberDeclaration.js +64 -0
- package/lib/components/MemberDeclaration.js.map +1 -0
- package/lib/components/MemberGetterSetter.js +61 -0
- package/lib/components/MemberGetterSetter.js.map +1 -0
- package/lib/components/MemberReference.js +38 -0
- package/lib/components/MemberReference.js.map +1 -0
- package/lib/components/MemberSignatureBody.js +91 -0
- package/lib/components/MemberSignatureBody.js.map +1 -0
- package/lib/components/MemberSignatureTitle.js +52 -0
- package/lib/components/MemberSignatureTitle.js.map +1 -0
- package/lib/components/MemberSignatures.js +61 -0
- package/lib/components/MemberSignatures.js.map +1 -0
- package/lib/components/MemberSources.js +33 -0
- package/lib/components/MemberSources.js.map +1 -0
- package/lib/components/Members.js +51 -0
- package/lib/components/Members.js.map +1 -0
- package/lib/components/MembersGroup.js +39 -0
- package/lib/components/MembersGroup.js.map +1 -0
- package/lib/components/Parameter.js +145 -0
- package/lib/components/Parameter.js.map +1 -0
- package/lib/components/Reflection.js +112 -0
- package/lib/components/Reflection.js.map +1 -0
- package/lib/components/SourceLink.js +37 -0
- package/lib/components/SourceLink.js.map +1 -0
- package/lib/components/Type.js +341 -0
- package/lib/components/Type.js.map +1 -0
- package/lib/components/TypeAndParent.js +27 -0
- package/lib/components/TypeAndParent.js.map +1 -0
- package/lib/components/TypeParameters.js +36 -0
- package/lib/components/TypeParameters.js.map +1 -0
- package/lib/components/TypeParametersGeneric.js +27 -0
- package/lib/components/TypeParametersGeneric.js.map +1 -0
- package/lib/components/VersionBanner.js +39 -0
- package/lib/components/VersionBanner.js.map +1 -0
- package/lib/hooks/useBreadcrumbs.js +9 -0
- package/lib/hooks/useBreadcrumbs.js.map +1 -0
- package/lib/hooks/useGitRefName.js +9 -0
- package/lib/hooks/useGitRefName.js.map +1 -0
- package/lib/hooks/useMinimalLayout.js +9 -0
- package/lib/hooks/useMinimalLayout.js.map +1 -0
- package/lib/hooks/useReflection.js +19 -0
- package/lib/hooks/useReflection.js.map +1 -0
- package/lib/hooks/useReflectionMap.js +9 -0
- package/lib/hooks/useReflectionMap.js.map +1 -0
- package/lib/index.js +320 -0
- package/lib/index.js.map +1 -0
- package/lib/markdownLoader.js +11 -0
- package/lib/markdownLoader.js.map +1 -0
- package/lib/plugin/data.js +332 -0
- package/lib/plugin/data.js.map +1 -0
- package/lib/plugin/sidebar.js +105 -0
- package/lib/plugin/sidebar.js.map +1 -0
- package/lib/plugin/structure/0.23.js +48 -0
- package/lib/plugin/structure/0.23.js.map +1 -0
- package/lib/plugin/url.js +49 -0
- package/lib/plugin/url.js.map +1 -0
- package/lib/plugin/version.js +83 -0
- package/lib/plugin/version.js.map +1 -0
- package/lib/types.js +2 -0
- package/lib/types.js.map +1 -0
- package/lib/utils/hierarchy.js +35 -0
- package/lib/utils/hierarchy.js.map +1 -0
- package/lib/utils/icons.js +124 -0
- package/lib/utils/icons.js.map +1 -0
- package/lib/utils/links.js +10 -0
- package/lib/utils/links.js.map +1 -0
- package/lib/utils/markdown.js +69 -0
- package/lib/utils/markdown.js.map +1 -0
- package/lib/utils/visibility.js +25 -0
- package/lib/utils/visibility.js.map +1 -0
- package/package.json +57 -0
- package/src/components/AnchorLink.tsx +14 -0
- package/src/components/ApiChangelog.tsx +26 -0
- package/src/components/ApiDataContext.ts +17 -0
- package/src/components/ApiIndex.tsx +109 -0
- package/src/components/ApiItem.tsx +110 -0
- package/src/components/ApiItemLayout.tsx +96 -0
- package/src/components/ApiPage.tsx +78 -0
- package/src/components/Breadcrumb.tsx +41 -0
- package/src/components/Comment.tsx +74 -0
- package/src/components/CommentBadges.tsx +40 -0
- package/src/components/DefaultValue.tsx +48 -0
- package/src/components/Flags.tsx +29 -0
- package/src/components/Footer.tsx +13 -0
- package/src/components/Hierarchy.tsx +27 -0
- package/src/components/Icon.tsx +20 -0
- package/src/components/Index.tsx +109 -0
- package/src/components/Markdown.tsx +241 -0
- package/src/components/Member.tsx +64 -0
- package/src/components/MemberDeclaration.tsx +67 -0
- package/src/components/MemberGetterSetter.tsx +69 -0
- package/src/components/MemberReference.tsx +43 -0
- package/src/components/MemberSignatureBody.tsx +121 -0
- package/src/components/MemberSignatureTitle.tsx +65 -0
- package/src/components/MemberSignatures.tsx +64 -0
- package/src/components/MemberSources.tsx +42 -0
- package/src/components/Members.tsx +62 -0
- package/src/components/MembersGroup.tsx +47 -0
- package/src/components/Parameter.tsx +165 -0
- package/src/components/README.md +9 -0
- package/src/components/Reflection.tsx +136 -0
- package/src/components/SourceLink.tsx +46 -0
- package/src/components/Type.tsx +377 -0
- package/src/components/TypeAndParent.tsx +26 -0
- package/src/components/TypeParameters.tsx +37 -0
- package/src/components/TypeParametersGeneric.tsx +25 -0
- package/src/components/VersionBanner.tsx +44 -0
- package/src/components/styles.css +303 -0
- package/src/hooks/useBreadcrumbs.ts +6 -0
- package/src/hooks/useGitRefName.ts +6 -0
- package/src/hooks/useMinimalLayout.ts +6 -0
- package/src/hooks/useReflection.ts +18 -0
- package/src/hooks/useReflectionMap.ts +7 -0
- package/src/index.ts +420 -0
- package/src/markdownLoader.ts +10 -0
- package/src/plugin/data.ts +389 -0
- package/src/plugin/sidebar.ts +139 -0
- package/src/plugin/structure/0.23.ts +58 -0
- package/src/plugin/url.ts +49 -0
- package/src/plugin/version.ts +118 -0
- package/src/types.ts +165 -0
- package/src/utils/hierarchy.ts +46 -0
- package/src/utils/icons.ts +103 -0
- package/src/utils/links.ts +10 -0
- package/src/utils/markdown.ts +82 -0
- package/src/utils/visibility.ts +31 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sources":["../../src/plugin/version.ts"],"sourcesContent":null,"names":["path","DEFAULT_PLUGIN_ID","VERSIONED_DOCS_DIR","CURRENT_VERSION_NAME","normalizeUrl","getDefaultVersionBanner","readVersionNames","filterVersions"],"mappings":";;;;;;;;;;AAAA;AAKO,SAAS,uBAAuB,CAAC,OAAO,EAAE,QAAQ,EAAE;AAC3D,EAAE,OAAOA,qBAAI,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,KAAKC,uBAAiB,GAAGC,yBAAkB,GAAG,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAEA,yBAAkB,CAAC,CAAC,CAAC,CAAC;AACvH,CAAC;A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/lib/types.js
ADDED
package/lib/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sources":[],"sourcesContent":null,"names":[],"mappings":";;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// The JSON output does not include hierarchy information, so we need to duplicate the logic!
|
|
4
|
+
// https://github.com/TypeStrong/typedoc/blob/master/src/lib/converter/plugins/TypePlugin.ts#L98
|
|
5
|
+
function createHierarchy(reflection) {
|
|
6
|
+
let root;
|
|
7
|
+
let hierarchy;
|
|
8
|
+
function push(types) {
|
|
9
|
+
const level = {
|
|
10
|
+
types
|
|
11
|
+
};
|
|
12
|
+
if (hierarchy) {
|
|
13
|
+
hierarchy.next = level;
|
|
14
|
+
hierarchy = level;
|
|
15
|
+
} else {
|
|
16
|
+
root = level;
|
|
17
|
+
hierarchy = level;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (reflection.extendedTypes) {
|
|
21
|
+
push(reflection.extendedTypes);
|
|
22
|
+
}
|
|
23
|
+
push([{
|
|
24
|
+
id: reflection.id,
|
|
25
|
+
name: reflection.name,
|
|
26
|
+
type: 'reference'
|
|
27
|
+
}]);
|
|
28
|
+
hierarchy.isTarget = true;
|
|
29
|
+
if (reflection.extendedBy) {
|
|
30
|
+
push(reflection.extendedBy);
|
|
31
|
+
}
|
|
32
|
+
return root;
|
|
33
|
+
}
|
|
34
|
+
exports.createHierarchy = createHierarchy;
|
|
35
|
+
//# sourceMappingURL=hierarchy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hierarchy.js","sources":["../../src/utils/hierarchy.ts"],"sourcesContent":null,"names":[],"mappings":";;AAAA;AACA;AACO,SAAS,eAAe,CAAC,UAAU,EAAE;AAC5C,EAAE,IAAI,IAAI,CAAC;AACX,EAAE,IAAI,SAAS,CAAC;AAChB,EAAE,SAAS,IAAI,CAAC,KAAK,EAAE;AACvB,IAAI,MAAM,KAAK,GAAG;AAClB,MAAM,KAAK;AACX,KAAK,CAAC;AACN,IAAI,IAAI,SAAS,EAAE;AACnB,MAAM,SAAS,CAAC,IAAI,GAAG,KAAK,CAAC;AAC7B,MAAM,SAAS,GAAG,KAAK,CAAC;AACxB,KAAK,MAAM;AACX,MAAM,IAAI,GAAG,KAAK,CAAC;AACnB,MAAM,SAAS,GAAG,KAAK,CAAC;AACxB,KAAK;AACL,GAAG;AACH,EAAE,IAAI,UAAU,CAAC,aAAa,EAAE;AAChC,IAAI,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACnC,GAAG;AACH,EAAE,IAAI,CAAC,CAAC;AACR,IAAI,EAAE,EAAE,UAAU,CAAC,EAAE;AACrB,IAAI,IAAI,EAAE,UAAU,CAAC,IAAI;AACzB,IAAI,IAAI,EAAE,WAAW;AACrB,GAAG,CAAC,CAAC,CAAC;AACN,EAAE,SAAS,CAAC,QAAQ,GAAG,IAAI,CAAC;AAC5B,EAAE,IAAI,UAAU,CAAC,UAAU,EAAE;AAC7B,IAAI,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;AAChC,GAAG;AACH,EAAE,OAAO,IAAI,CAAC;AACd;;;;"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/* eslint-disable no-fallthrough */
|
|
4
|
+
|
|
5
|
+
// We have to map these manually instead of using the `ReflectionKind` enum,
|
|
6
|
+
// otherwise the `typedoc` package ends up in the bundle and crashes.
|
|
7
|
+
const KIND_ICONS = {
|
|
8
|
+
1: 'project',
|
|
9
|
+
// Project
|
|
10
|
+
2: 'package',
|
|
11
|
+
// Module
|
|
12
|
+
4: 'symbol-namespace',
|
|
13
|
+
// Namespace
|
|
14
|
+
8: 'symbol-enum',
|
|
15
|
+
// Enum
|
|
16
|
+
16: 'symbol-enum-member',
|
|
17
|
+
// EnumMember
|
|
18
|
+
32: 'symbol-variable',
|
|
19
|
+
// Variable
|
|
20
|
+
64: 'symbol-function',
|
|
21
|
+
// Function
|
|
22
|
+
128: 'symbol-class',
|
|
23
|
+
// Class
|
|
24
|
+
256: 'symbol-interface',
|
|
25
|
+
// Interface
|
|
26
|
+
512: 'symbol-constructor',
|
|
27
|
+
// Constructor
|
|
28
|
+
1024: 'symbol-property',
|
|
29
|
+
// Property
|
|
30
|
+
2048: 'symbol-method',
|
|
31
|
+
// Method
|
|
32
|
+
4096: 'symbol-method',
|
|
33
|
+
// CallSignature
|
|
34
|
+
8192: 'bracket-dot',
|
|
35
|
+
// IndexSignature
|
|
36
|
+
16_384: 'symbol-method',
|
|
37
|
+
// ConstructorSignature
|
|
38
|
+
32_768: 'symbol-property',
|
|
39
|
+
// Parameter
|
|
40
|
+
65_536: 'symbol-key',
|
|
41
|
+
// TypeLiteral
|
|
42
|
+
131_072: 'symbol-type-parameter',
|
|
43
|
+
// TypeParameter
|
|
44
|
+
262_144: 'symbol-field',
|
|
45
|
+
// Accessor
|
|
46
|
+
524_288: 'symbol-field',
|
|
47
|
+
// GetSignature
|
|
48
|
+
1_048_576: 'symbol-field',
|
|
49
|
+
// SetSignature
|
|
50
|
+
2_097_152: 'bracket',
|
|
51
|
+
// ObjectLiteral
|
|
52
|
+
4_194_304: 'symbol-parameter',
|
|
53
|
+
// TypeAlias
|
|
54
|
+
8_388_608: 'references' // Reference
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
function getKindIcon(kind, name) {
|
|
58
|
+
let icon = KIND_ICONS[kind];
|
|
59
|
+
|
|
60
|
+
// Use event icon when property starts with "on"
|
|
61
|
+
if (kind === 1024 && name.match(/^on[A-Z]/)) {
|
|
62
|
+
icon = 'symbol-event';
|
|
63
|
+
}
|
|
64
|
+
return icon;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// eslint-disable-next-line complexity
|
|
68
|
+
function getKindIconColor(kind) {
|
|
69
|
+
switch (kind) {
|
|
70
|
+
// Function
|
|
71
|
+
case 64:
|
|
72
|
+
// Constructor
|
|
73
|
+
case 512:
|
|
74
|
+
// Method
|
|
75
|
+
case 2048:
|
|
76
|
+
// CallSignature
|
|
77
|
+
case 4096:
|
|
78
|
+
// ConstructorSignature
|
|
79
|
+
case 16_384:
|
|
80
|
+
// Accessor
|
|
81
|
+
case 262_144:
|
|
82
|
+
return 'var(--ifm-color-info)';
|
|
83
|
+
|
|
84
|
+
// EnumMember
|
|
85
|
+
case 16:
|
|
86
|
+
// Variable
|
|
87
|
+
case 32:
|
|
88
|
+
// Property
|
|
89
|
+
case 1024:
|
|
90
|
+
// GetSignature
|
|
91
|
+
case 524_288:
|
|
92
|
+
// SetSignature
|
|
93
|
+
case 1_048_576:
|
|
94
|
+
return 'var(--ifm-color-success)';
|
|
95
|
+
|
|
96
|
+
// Namespace
|
|
97
|
+
case 4:
|
|
98
|
+
// Class
|
|
99
|
+
case 128:
|
|
100
|
+
return 'var(--ifm-color-warning)';
|
|
101
|
+
|
|
102
|
+
// Enum
|
|
103
|
+
case 8:
|
|
104
|
+
// Interface
|
|
105
|
+
case 256:
|
|
106
|
+
// TypeAlias
|
|
107
|
+
case 4_194_304:
|
|
108
|
+
return 'var(--ifm-color-danger)';
|
|
109
|
+
default:
|
|
110
|
+
return 'inherit';
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function getKindIconHtml(kind, name) {
|
|
114
|
+
const icon = getKindIcon(kind, name);
|
|
115
|
+
if (!icon) {
|
|
116
|
+
return '';
|
|
117
|
+
}
|
|
118
|
+
const color = getKindIconColor(kind);
|
|
119
|
+
return `<i class="codicon codicon-${icon}" style="color:${color};"></i>`;
|
|
120
|
+
}
|
|
121
|
+
exports.getKindIcon = getKindIcon;
|
|
122
|
+
exports.getKindIconColor = getKindIconColor;
|
|
123
|
+
exports.getKindIconHtml = getKindIconHtml;
|
|
124
|
+
//# sourceMappingURL=icons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.js","sources":["../../src/utils/icons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use strict';
|
|
2
|
+
|
|
3
|
+
function removeScopes(text, scopes) {
|
|
4
|
+
if (scopes.length === 0) {
|
|
5
|
+
return text;
|
|
6
|
+
}
|
|
7
|
+
return scopes.reduce((value, scope) => value.replace(new RegExp(`^(${scope}-|@${scope}/)`), ''), text);
|
|
8
|
+
}
|
|
9
|
+
exports.removeScopes = removeScopes;
|
|
10
|
+
//# sourceMappingURL=links.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"links.js","sources":["../../src/utils/links.ts"],"sourcesContent":null,"names":[],"mappings":";;AAAO,SAAS,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE;AAC3C,EAAE,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;AAC3B,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,KAAK,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;AACzG;;;;"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
7
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
8
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
|
+
function splitLinkText(text) {
|
|
10
|
+
let splitIndex = text.indexOf('|');
|
|
11
|
+
if (splitIndex === -1) {
|
|
12
|
+
splitIndex = text.search(/\s/);
|
|
13
|
+
}
|
|
14
|
+
if (splitIndex !== -1) {
|
|
15
|
+
return {
|
|
16
|
+
caption: text.slice(splitIndex + 1).replace(/\n+/, ' ').trim(),
|
|
17
|
+
target: text.slice(0, Math.max(0, splitIndex)).trim()
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
caption: text,
|
|
22
|
+
target: text
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function findReflectionWithMatchingTarget(reflections, symbol, member) {
|
|
26
|
+
return Object.values(reflections).find(ref => {
|
|
27
|
+
if (ref.name !== symbol) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
return member ? ref.children?.some(child => child.name === member) : true;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function replaceApiLinks(reflections) {
|
|
34
|
+
return (match, tagName, content) => {
|
|
35
|
+
const _splitLinkText = splitLinkText(content),
|
|
36
|
+
caption = _splitLinkText.caption,
|
|
37
|
+
target = _splitLinkText.target;
|
|
38
|
+
const _target$split = target.split('.'),
|
|
39
|
+
_target$split2 = _slicedToArray(_target$split, 2),
|
|
40
|
+
symbol = _target$split2[0],
|
|
41
|
+
member = _target$split2[1];
|
|
42
|
+
const reflection = findReflectionWithMatchingTarget(reflections, symbol, member);
|
|
43
|
+
const label = tagName === 'linkcode' ? `\`${caption}\`` : caption;
|
|
44
|
+
if (!reflection?.permalink) {
|
|
45
|
+
return label;
|
|
46
|
+
}
|
|
47
|
+
return `[${label}](${reflection.permalink}${member ? `#${member}` : ''})`;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function replaceDocLinks(currentVersion) {
|
|
51
|
+
return (match, content) => {
|
|
52
|
+
const _splitLinkText2 = splitLinkText(content),
|
|
53
|
+
caption = _splitLinkText2.caption,
|
|
54
|
+
target = _splitLinkText2.target;
|
|
55
|
+
const version = currentVersion.version === 'current' ? 'next' : currentVersion.version;
|
|
56
|
+
|
|
57
|
+
// TODO: Handle `routeBasePath`? Something else besides "docs"?
|
|
58
|
+
const url = currentVersion.isLast ? `/docs/${target}` : `/docs/${version}/${target}`;
|
|
59
|
+
return `[${caption}](${url})`;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// TypeDoc JSON output does not replace links, so we need to do this manually.
|
|
64
|
+
// @see https://github.com/TypeStrong/typedoc/blob/master/src/lib/output/plugins/MarkedLinksPlugin.ts
|
|
65
|
+
function replaceLinkTokens(markdown, reflections, currentVersion) {
|
|
66
|
+
return markdown.replace(/{@(link|linkcode|linkplain|apilink)\s+([^}]+?)}/gi, replaceApiLinks(reflections)).replace(/{@doclink\s+([^}]+?)}/gi, replaceDocLinks(currentVersion));
|
|
67
|
+
}
|
|
68
|
+
exports.replaceLinkTokens = replaceLinkTokens;
|
|
69
|
+
//# sourceMappingURL=markdown.js.map
|
|
@@ -0,0 +1 @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,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;AAClC,GAAG,CAAC;AACJ,CAAC;AACD;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,QAAQ,EAAE,WAAW,EAAE,cAAc,EAAE;AACzE,EAAE,OAAO,QAAQ,CAAC,OAAO,CAAC,mDAAmD,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,yBAAyB,EAAE,eAAe,CAAC,cAAc,CAAC,CAAC,CAAC;AACjL;;;;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// https://github.com/TypeStrong/typedoc/blob/master/src/lib/output/themes/DefaultTheme.ts#L264
|
|
4
|
+
function hasOwnDocument(id, reflections) {
|
|
5
|
+
const reflection = reflections[id];
|
|
6
|
+
return Boolean(reflection?.permalink && !reflection.permalink.includes('#'));
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// https://github.com/TypeStrong/typedoc/blob/2103f347c9cba40fcaa1f67e36f7cea0bdea2f0f/src/lib/models/ReflectionCategory.ts#L44
|
|
10
|
+
function allCategoryChildrenHaveOwnDocument(category, reflections) {
|
|
11
|
+
let onlyOwnDocuments = true;
|
|
12
|
+
category.children?.forEach(child => {
|
|
13
|
+
onlyOwnDocuments &&= hasOwnDocument(child, reflections);
|
|
14
|
+
});
|
|
15
|
+
return onlyOwnDocuments;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// https://github.com/TypeStrong/typedoc/blob/2103f347c9cba40fcaa1f67e36f7cea0bdea2f0f/src/lib/models/ReflectionGroup.ts#L81
|
|
19
|
+
function allGroupChildrenHaveOwnDocument(group, reflections) {
|
|
20
|
+
return Boolean(group.children?.every(child => hasOwnDocument(child, reflections)));
|
|
21
|
+
}
|
|
22
|
+
exports.allCategoryChildrenHaveOwnDocument = allCategoryChildrenHaveOwnDocument;
|
|
23
|
+
exports.allGroupChildrenHaveOwnDocument = allGroupChildrenHaveOwnDocument;
|
|
24
|
+
exports.hasOwnDocument = hasOwnDocument;
|
|
25
|
+
//# sourceMappingURL=visibility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visibility.js","sources":["../../src/utils/visibility.ts"],"sourcesContent":null,"names":[],"mappings":";;AAAA;AACO,SAAS,cAAc,CAAC,EAAE,EAAE,WAAW,EAAE;AAChD,EAAE,MAAM,UAAU,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC;AACrC,EAAE,OAAO,OAAO,CAAC,UAAU,EAAE,SAAS,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/E,CAAC;AACD;AACA;AACO,SAAS,kCAAkC,CAAC,QAAQ,EAAE,WAAW,EAAE;AAC1E,EAAE,IAAI,gBAAgB,GAAG,IAAI,CAAC;AAC9B,EAAE,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,KAAK,IAAI;AACtC,IAAI,gBAAgB,KAAK,cAAc,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;AAC5D,GAAG,CAAC,CAAC;AACL,EAAE,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AACD;AACA;AACO,SAAS,+BAA+B,CAAC,KAAK,EAAE,WAAW,EAAE;AACpE,EAAE,OAAO,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,IAAI,cAAc,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;AACrF;;;;;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@apify/docusaurus-plugin-typedoc-api",
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"description": "Docusaurus plugin that provides source code API documentation powered by TypeDoc. ",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"docusaurus",
|
|
7
|
+
"plugin",
|
|
8
|
+
"typedoc",
|
|
9
|
+
"api"
|
|
10
|
+
],
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git@github.com:apify/docusaurus-plugin-typedoc-api.git"
|
|
14
|
+
},
|
|
15
|
+
"author": "Miles Johnson, Apify Technologies",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"main": "./lib/index.js",
|
|
18
|
+
"types": "./lib/index.d.ts",
|
|
19
|
+
"files": [
|
|
20
|
+
"assets/**/*",
|
|
21
|
+
"lib/**/*",
|
|
22
|
+
"src/**/*",
|
|
23
|
+
"styles.css"
|
|
24
|
+
],
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=16.12.0"
|
|
27
|
+
},
|
|
28
|
+
"packemon": {
|
|
29
|
+
"format": "lib",
|
|
30
|
+
"platform": "node",
|
|
31
|
+
"externals": [
|
|
32
|
+
"@theme/*",
|
|
33
|
+
"@docusaurus/*",
|
|
34
|
+
"@vscode/*",
|
|
35
|
+
"css$"
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"@docusaurus/core": "^2.0.0",
|
|
40
|
+
"react": ">=16.0.0",
|
|
41
|
+
"typescript": "^4.0.0 || ^5.0.0"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@docusaurus/plugin-content-docs": "^2.4.0",
|
|
45
|
+
"@docusaurus/types": "^2.4.0",
|
|
46
|
+
"@docusaurus/utils": "^2.4.0",
|
|
47
|
+
"@vscode/codicons": "^0.0.32",
|
|
48
|
+
"marked": "^4.3.0",
|
|
49
|
+
"typedoc": "^0.23.28"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@docusaurus/module-type-aliases": "^2.4.0",
|
|
53
|
+
"react": "^17.0.2",
|
|
54
|
+
"react-dom": "^17.0.2",
|
|
55
|
+
"typescript": "^5.0.2"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
export interface AnchorLinkProps {
|
|
4
|
+
id: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function AnchorLink({ id }: AnchorLinkProps) {
|
|
8
|
+
return (
|
|
9
|
+
<a className="tsd-anchor" href={`#${id}`}>
|
|
10
|
+
<span className="tsd-anchor-id" id={id} />
|
|
11
|
+
<i className="codicon codicon-symbol-numeric" />
|
|
12
|
+
</a>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PageMetadata } from '@docusaurus/theme-common';
|
|
3
|
+
import type { Props as DocItemProps } from '@theme/DocItem';
|
|
4
|
+
import type { TOCItem } from '../types';
|
|
5
|
+
import ApiItemLayout from './ApiItemLayout';
|
|
6
|
+
|
|
7
|
+
export interface ApiChangelogProps extends Pick<DocItemProps, 'route'> {
|
|
8
|
+
changelog: DocItemProps['content'];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const emptyToc: TOCItem[] = [];
|
|
12
|
+
|
|
13
|
+
export default function ApiChangelog({ changelog: Changelog, route }: ApiChangelogProps) {
|
|
14
|
+
return (
|
|
15
|
+
<ApiItemLayout
|
|
16
|
+
heading="Changelog"
|
|
17
|
+
pageMetadata={<PageMetadata description={Changelog.contentTitle} title="Changelog | API" />}
|
|
18
|
+
route={route}
|
|
19
|
+
toc={Changelog.toc ?? emptyToc}
|
|
20
|
+
>
|
|
21
|
+
<section className="tsd-readme">
|
|
22
|
+
<Changelog />
|
|
23
|
+
</section>
|
|
24
|
+
</ApiItemLayout>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
import type { ApiOptions, DeclarationReflectionMap } from '../types';
|
|
3
|
+
|
|
4
|
+
export const ApiDataContext = createContext<{
|
|
5
|
+
options: ApiOptions;
|
|
6
|
+
reflections: DeclarationReflectionMap;
|
|
7
|
+
}>({
|
|
8
|
+
options: {
|
|
9
|
+
banner: '',
|
|
10
|
+
breadcrumbs: true,
|
|
11
|
+
gitRefName: 'master',
|
|
12
|
+
minimal: false,
|
|
13
|
+
pluginId: 'default',
|
|
14
|
+
scopes: [],
|
|
15
|
+
},
|
|
16
|
+
reflections: {},
|
|
17
|
+
});
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import Link from '@docusaurus/Link';
|
|
3
|
+
import type { PropVersionMetadata } from '@docusaurus/plugin-content-docs';
|
|
4
|
+
import type { GlobalVersion } from '@docusaurus/plugin-content-docs/client';
|
|
5
|
+
import { useDocsPreferredVersion } from '@docusaurus/theme-common';
|
|
6
|
+
import { useDocsVersion } from '@docusaurus/theme-common/internal';
|
|
7
|
+
import type { Props as DocItemProps } from '@theme/DocItem';
|
|
8
|
+
import Heading from '@theme/Heading';
|
|
9
|
+
import type { ApiOptions, PackageReflectionGroup } from '../types';
|
|
10
|
+
import { removeScopes } from '../utils/links';
|
|
11
|
+
import { VersionBanner } from './VersionBanner';
|
|
12
|
+
|
|
13
|
+
export interface ApiIndexProps extends Pick<DocItemProps, 'route'> {
|
|
14
|
+
history: {
|
|
15
|
+
location: { pathname: string };
|
|
16
|
+
replace: (path: string) => void;
|
|
17
|
+
};
|
|
18
|
+
options: ApiOptions;
|
|
19
|
+
packages: PackageReflectionGroup[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function addVersionToUrl(
|
|
23
|
+
url: string,
|
|
24
|
+
latestVersion: PropVersionMetadata,
|
|
25
|
+
preferredVersion: GlobalVersion | null | undefined,
|
|
26
|
+
) {
|
|
27
|
+
if (
|
|
28
|
+
!url.match(/api\/([\d.]+)/) &&
|
|
29
|
+
!url.includes('api/next') &&
|
|
30
|
+
preferredVersion &&
|
|
31
|
+
preferredVersion.name !== latestVersion.version
|
|
32
|
+
) {
|
|
33
|
+
const version = preferredVersion.name === 'current' ? 'next' : preferredVersion.name;
|
|
34
|
+
|
|
35
|
+
if (url.endsWith('/api')) {
|
|
36
|
+
return `${url}/${version}`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return url.replace('/api/', `/api/${version}/`);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return url;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default function ApiIndex({ options, packages, history }: ApiIndexProps) {
|
|
46
|
+
const latestVersion = useDocsVersion();
|
|
47
|
+
const { preferredVersion } = useDocsPreferredVersion(latestVersion.pluginId);
|
|
48
|
+
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
// Redirect to package when only 1
|
|
51
|
+
if (packages.length === 1) {
|
|
52
|
+
history.replace(
|
|
53
|
+
addVersionToUrl(
|
|
54
|
+
packages[0].entryPoints[0].reflection.permalink,
|
|
55
|
+
latestVersion,
|
|
56
|
+
preferredVersion,
|
|
57
|
+
),
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
// Redirect to preferred version
|
|
61
|
+
} else if (preferredVersion) {
|
|
62
|
+
history.replace(addVersionToUrl(history.location.pathname, latestVersion, preferredVersion));
|
|
63
|
+
}
|
|
64
|
+
}, [packages, history, latestVersion, preferredVersion]);
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<div className="row">
|
|
68
|
+
<div className="col apiItemCol">
|
|
69
|
+
{options.banner && (
|
|
70
|
+
<div className="alert alert--info margin-bottom--md" role="alert">
|
|
71
|
+
{/* eslint-disable-next-line react/no-danger, react-perf/jsx-no-new-object-as-prop */}
|
|
72
|
+
<div dangerouslySetInnerHTML={{ __html: options.banner }} />
|
|
73
|
+
</div>
|
|
74
|
+
)}
|
|
75
|
+
|
|
76
|
+
<VersionBanner />
|
|
77
|
+
|
|
78
|
+
<div className="apiItemContainer">
|
|
79
|
+
<article>
|
|
80
|
+
<div className="markdown">
|
|
81
|
+
<header>
|
|
82
|
+
<Heading as="h1">API</Heading>
|
|
83
|
+
</header>
|
|
84
|
+
|
|
85
|
+
<section className="tsd-panel">
|
|
86
|
+
<h3 className="tsd-panel-header">Packages</h3>
|
|
87
|
+
<div className="tsd-panel-content">
|
|
88
|
+
<ul className="tsd-index-list">
|
|
89
|
+
{packages.map((pkg) => (
|
|
90
|
+
<li key={pkg.packageName} className="tsd-truncate">
|
|
91
|
+
<Link
|
|
92
|
+
className="tsd-kind-icon"
|
|
93
|
+
to={pkg.entryPoints[0].reflection.permalink}
|
|
94
|
+
>
|
|
95
|
+
<span className="tsd-signature-symbol">v{pkg.packageVersion}</span>{' '}
|
|
96
|
+
<span>{removeScopes(pkg.packageName, options.scopes)}</span>
|
|
97
|
+
</Link>
|
|
98
|
+
</li>
|
|
99
|
+
))}
|
|
100
|
+
</ul>
|
|
101
|
+
</div>
|
|
102
|
+
</section>
|
|
103
|
+
</div>
|
|
104
|
+
</article>
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
);
|
|
109
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import type { JSONOutput } from 'typedoc';
|
|
3
|
+
import { PageMetadata } from '@docusaurus/theme-common';
|
|
4
|
+
import type { Props as DocItemProps } from '@theme/DocItem';
|
|
5
|
+
import { useReflection } from '../hooks/useReflection';
|
|
6
|
+
import { useReflectionMap } from '../hooks/useReflectionMap';
|
|
7
|
+
import type { DeclarationReflectionMap, TOCItem } from '../types';
|
|
8
|
+
import { getKindIconHtml } from '../utils/icons';
|
|
9
|
+
import ApiItemLayout from './ApiItemLayout';
|
|
10
|
+
import { displayPartsToMarkdown } from './Comment';
|
|
11
|
+
import { Flags } from './Flags';
|
|
12
|
+
import { Reflection } from './Reflection';
|
|
13
|
+
import { TypeParametersGeneric } from './TypeParametersGeneric';
|
|
14
|
+
|
|
15
|
+
function extractTOC(
|
|
16
|
+
item: JSONOutput.DeclarationReflection,
|
|
17
|
+
map: DeclarationReflectionMap,
|
|
18
|
+
): TOCItem[] {
|
|
19
|
+
const toc: TOCItem[] = [];
|
|
20
|
+
const mapped = new Set<string>();
|
|
21
|
+
|
|
22
|
+
item.groups?.forEach((group) => {
|
|
23
|
+
group.children?.forEach((childId) => {
|
|
24
|
+
const child = map[childId]!;
|
|
25
|
+
|
|
26
|
+
if (mapped.has(child.name)) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const iconHtml = getKindIconHtml(child.kind, child.name);
|
|
31
|
+
|
|
32
|
+
if (!child.permalink || child.permalink.includes('#')) {
|
|
33
|
+
toc.push({
|
|
34
|
+
// @ts-expect-error Not typed upstream
|
|
35
|
+
children: [],
|
|
36
|
+
id: child.name,
|
|
37
|
+
value: iconHtml ? `${iconHtml} ${child.name}` : child.name,
|
|
38
|
+
level: 1,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
mapped.add(child.name);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
return toc;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface ApiItemProps extends Pick<DocItemProps, 'route'> {
|
|
50
|
+
readme?: React.ComponentType;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export default function ApiItem({ readme: Readme, route }: ApiItemProps) {
|
|
54
|
+
const item = useReflection((route as unknown as { id: number }).id)!;
|
|
55
|
+
const reflections = useReflectionMap();
|
|
56
|
+
const toc = useMemo(() => extractTOC(item, reflections), [item, reflections]);
|
|
57
|
+
|
|
58
|
+
// Pagination
|
|
59
|
+
const prevItem = useReflection(item.previousId);
|
|
60
|
+
const nextItem = useReflection(item.nextId);
|
|
61
|
+
const pagingMetadata = useMemo(
|
|
62
|
+
() => ({
|
|
63
|
+
next: nextItem
|
|
64
|
+
? {
|
|
65
|
+
permalink: nextItem.permalink,
|
|
66
|
+
title: nextItem.name,
|
|
67
|
+
}
|
|
68
|
+
: undefined,
|
|
69
|
+
previous: prevItem
|
|
70
|
+
? {
|
|
71
|
+
permalink: prevItem.permalink,
|
|
72
|
+
title: prevItem.name,
|
|
73
|
+
}
|
|
74
|
+
: undefined,
|
|
75
|
+
}),
|
|
76
|
+
[nextItem, prevItem],
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<ApiItemLayout
|
|
81
|
+
heading={
|
|
82
|
+
<>
|
|
83
|
+
<span className="tsd-header-flags">
|
|
84
|
+
<Flags flags={item.flags} />
|
|
85
|
+
</span>
|
|
86
|
+
{item.name} <TypeParametersGeneric params={item.typeParameters} />
|
|
87
|
+
</>
|
|
88
|
+
}
|
|
89
|
+
module={(item as unknown as { module: string }).module}
|
|
90
|
+
name={item.name}
|
|
91
|
+
pageMetadata={
|
|
92
|
+
<PageMetadata
|
|
93
|
+
description={item.comment?.summary ? displayPartsToMarkdown(item.comment.summary) : ''}
|
|
94
|
+
title={`${item.name} | API`}
|
|
95
|
+
/>
|
|
96
|
+
}
|
|
97
|
+
pagingMetadata={pagingMetadata}
|
|
98
|
+
route={route}
|
|
99
|
+
toc={toc}
|
|
100
|
+
>
|
|
101
|
+
{Readme && (
|
|
102
|
+
<section className="tsd-readme">
|
|
103
|
+
<Readme />
|
|
104
|
+
</section>
|
|
105
|
+
)}
|
|
106
|
+
|
|
107
|
+
<Reflection reflection={item} />
|
|
108
|
+
</ApiItemLayout>
|
|
109
|
+
);
|
|
110
|
+
}
|