@apify/docusaurus-plugin-typedoc-api 4.4.11 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (278) hide show
  1. package/README.md +38 -296
  2. package/lib/components/AnchorLink.d.ts +5 -0
  3. package/lib/components/AnchorLink.d.ts.map +1 -0
  4. package/lib/components/AnchorLink.js +7 -26
  5. package/lib/components/AnchorLink.js.map +1 -1
  6. package/lib/components/ApiChangelog.d.ts +6 -0
  7. package/lib/components/ApiChangelog.d.ts.map +1 -0
  8. package/lib/components/ApiChangelog.js +7 -24
  9. package/lib/components/ApiChangelog.js.map +1 -1
  10. package/lib/components/ApiDataContext.d.ts +6 -0
  11. package/lib/components/ApiDataContext.d.ts.map +1 -0
  12. package/lib/components/ApiDataContext.js +12 -15
  13. package/lib/components/ApiDataContext.js.map +1 -1
  14. package/lib/components/ApiIndex.d.ts +14 -0
  15. package/lib/components/ApiIndex.d.ts.map +1 -0
  16. package/lib/components/ApiIndex.js +33 -93
  17. package/lib/components/ApiIndex.js.map +1 -1
  18. package/lib/components/ApiItem.d.ts +6 -0
  19. package/lib/components/ApiItem.d.ts.map +1 -0
  20. package/lib/components/ApiItem.js +131 -191
  21. package/lib/components/ApiItem.js.map +1 -1
  22. package/lib/components/ApiItemLayout.d.ts +14 -0
  23. package/lib/components/ApiItemLayout.d.ts.map +1 -0
  24. package/lib/components/ApiItemLayout.js +21 -97
  25. package/lib/components/ApiItemLayout.js.map +1 -1
  26. package/lib/components/ApiOptionsContext.d.ts +5 -0
  27. package/lib/components/ApiOptionsContext.d.ts.map +1 -0
  28. package/lib/components/ApiOptionsContext.js +5 -9
  29. package/lib/components/ApiOptionsContext.js.map +1 -1
  30. package/lib/components/ApiOptionsLayout.d.ts +4 -0
  31. package/lib/components/ApiOptionsLayout.d.ts.map +1 -0
  32. package/lib/components/ApiOptionsLayout.js +10 -34
  33. package/lib/components/ApiOptionsLayout.js.map +1 -1
  34. package/lib/components/ApiPage.d.ts +11 -0
  35. package/lib/components/ApiPage.d.ts.map +1 -0
  36. package/lib/components/ApiPage.js +50 -63
  37. package/lib/components/ApiPage.js.map +1 -1
  38. package/lib/components/Breadcrumb.d.ts +7 -0
  39. package/lib/components/Breadcrumb.d.ts.map +1 -0
  40. package/lib/components/Breadcrumb.js +17 -49
  41. package/lib/components/Breadcrumb.js.map +1 -1
  42. package/lib/components/Comment.d.ts +10 -0
  43. package/lib/components/Comment.d.ts.map +1 -0
  44. package/lib/components/Comment.js +33 -60
  45. package/lib/components/Comment.js.map +1 -1
  46. package/lib/components/CommentBadges.d.ts +9 -0
  47. package/lib/components/CommentBadges.d.ts.map +1 -0
  48. package/lib/components/CommentBadges.js +16 -28
  49. package/lib/components/CommentBadges.js.map +1 -1
  50. package/lib/components/DefaultValue.d.ts +10 -0
  51. package/lib/components/DefaultValue.d.ts.map +1 -0
  52. package/lib/components/DefaultValue.js +25 -55
  53. package/lib/components/DefaultValue.js.map +1 -1
  54. package/lib/components/Flags.d.ts +6 -0
  55. package/lib/components/Flags.d.ts.map +1 -0
  56. package/lib/components/Flags.js +11 -22
  57. package/lib/components/Flags.js.map +1 -1
  58. package/lib/components/Footer.d.ts +2 -0
  59. package/lib/components/Footer.d.ts.map +1 -0
  60. package/lib/components/Footer.js +4 -16
  61. package/lib/components/Footer.js.map +1 -1
  62. package/lib/components/Hierarchy.d.ts +6 -0
  63. package/lib/components/Hierarchy.d.ts.map +1 -0
  64. package/lib/components/Hierarchy.js +5 -25
  65. package/lib/components/Hierarchy.js.map +1 -1
  66. package/lib/components/Icon.d.ts +6 -0
  67. package/lib/components/Icon.d.ts.map +1 -0
  68. package/lib/components/Icon.js +10 -21
  69. package/lib/components/Icon.js.map +1 -1
  70. package/lib/components/Index.d.ts +9 -0
  71. package/lib/components/Index.d.ts.map +1 -0
  72. package/lib/components/Index.js +30 -113
  73. package/lib/components/Index.js.map +1 -1
  74. package/lib/components/Markdown.d.ts +5 -0
  75. package/lib/components/Markdown.d.ts.map +1 -0
  76. package/lib/components/Markdown.js +138 -202
  77. package/lib/components/Markdown.js.map +1 -1
  78. package/lib/components/Member.d.ts +5 -0
  79. package/lib/components/Member.d.ts.map +1 -0
  80. package/lib/components/Member.js +40 -69
  81. package/lib/components/Member.js.map +1 -1
  82. package/lib/components/MemberDeclaration.d.ts +5 -0
  83. package/lib/components/MemberDeclaration.d.ts.map +1 -0
  84. package/lib/components/MemberDeclaration.js +20 -71
  85. package/lib/components/MemberDeclaration.js.map +1 -1
  86. package/lib/components/MemberGetterSetter.d.ts +8 -0
  87. package/lib/components/MemberGetterSetter.d.ts.map +1 -0
  88. package/lib/components/MemberGetterSetter.js +13 -68
  89. package/lib/components/MemberGetterSetter.js.map +1 -1
  90. package/lib/components/MemberReference.d.ts +6 -0
  91. package/lib/components/MemberReference.d.ts.map +1 -0
  92. package/lib/components/MemberReference.js +18 -48
  93. package/lib/components/MemberReference.js.map +1 -1
  94. package/lib/components/MemberSignatureBody.d.ts +9 -0
  95. package/lib/components/MemberSignatureBody.d.ts.map +1 -0
  96. package/lib/components/MemberSignatureBody.js +85 -182
  97. package/lib/components/MemberSignatureBody.js.map +1 -1
  98. package/lib/components/MemberSignatureTitle.d.ts +11 -0
  99. package/lib/components/MemberSignatureTitle.d.ts.map +1 -0
  100. package/lib/components/MemberSignatureTitle.js +27 -81
  101. package/lib/components/MemberSignatureTitle.js.map +1 -1
  102. package/lib/components/MemberSignatures.d.ts +7 -0
  103. package/lib/components/MemberSignatures.d.ts.map +1 -0
  104. package/lib/components/MemberSignatures.js +18 -66
  105. package/lib/components/MemberSignatures.js.map +1 -1
  106. package/lib/components/MemberSources.d.ts +7 -0
  107. package/lib/components/MemberSources.d.ts.map +1 -0
  108. package/lib/components/MemberSources.js +10 -34
  109. package/lib/components/MemberSources.js.map +1 -1
  110. package/lib/components/Members.d.ts +6 -0
  111. package/lib/components/Members.d.ts.map +1 -0
  112. package/lib/components/Members.js +29 -49
  113. package/lib/components/Members.js.map +1 -1
  114. package/lib/components/MembersGroup.d.ts +6 -0
  115. package/lib/components/MembersGroup.d.ts.map +1 -0
  116. package/lib/components/MembersGroup.js +16 -40
  117. package/lib/components/MembersGroup.js.map +1 -1
  118. package/lib/components/Parameter.d.ts +6 -0
  119. package/lib/components/Parameter.d.ts.map +1 -0
  120. package/lib/components/Parameter.js +35 -171
  121. package/lib/components/Parameter.js.map +1 -1
  122. package/lib/components/Reflection.d.ts +6 -0
  123. package/lib/components/Reflection.d.ts.map +1 -0
  124. package/lib/components/Reflection.js +29 -132
  125. package/lib/components/Reflection.js.map +1 -1
  126. package/lib/components/SourceLink.d.ts +10 -0
  127. package/lib/components/SourceLink.d.ts.map +1 -0
  128. package/lib/components/SourceLink.js +16 -36
  129. package/lib/components/SourceLink.js.map +1 -1
  130. package/lib/components/Type.d.ts +12 -0
  131. package/lib/components/Type.d.ts.map +1 -0
  132. package/lib/components/Type.js +142 -464
  133. package/lib/components/Type.js.map +1 -1
  134. package/lib/components/TypeAndParent.d.ts +6 -0
  135. package/lib/components/TypeAndParent.d.ts.map +1 -0
  136. package/lib/components/TypeAndParent.js +11 -27
  137. package/lib/components/TypeAndParent.js.map +1 -1
  138. package/lib/components/TypeParameters.d.ts +6 -0
  139. package/lib/components/TypeParameters.d.ts.map +1 -0
  140. package/lib/components/TypeParameters.js +10 -38
  141. package/lib/components/TypeParameters.js.map +1 -1
  142. package/lib/components/TypeParametersGeneric.d.ts +6 -0
  143. package/lib/components/TypeParametersGeneric.d.ts.map +1 -0
  144. package/lib/components/TypeParametersGeneric.js +8 -27
  145. package/lib/components/TypeParametersGeneric.js.map +1 -1
  146. package/lib/components/VersionBanner.d.ts +2 -0
  147. package/lib/components/VersionBanner.d.ts.map +1 -0
  148. package/lib/components/VersionBanner.js +18 -49
  149. package/lib/components/VersionBanner.js.map +1 -1
  150. package/lib/hooks/useBreadcrumbs.d.ts +2 -0
  151. package/lib/hooks/useBreadcrumbs.d.ts.map +1 -0
  152. package/lib/hooks/useBreadcrumbs.js +5 -8
  153. package/lib/hooks/useBreadcrumbs.js.map +1 -1
  154. package/lib/hooks/useGitRefName.d.ts +2 -0
  155. package/lib/hooks/useGitRefName.d.ts.map +1 -0
  156. package/lib/hooks/useGitRefName.js +5 -8
  157. package/lib/hooks/useGitRefName.js.map +1 -1
  158. package/lib/hooks/useMinimalLayout.d.ts +2 -0
  159. package/lib/hooks/useMinimalLayout.d.ts.map +1 -0
  160. package/lib/hooks/useMinimalLayout.js +5 -8
  161. package/lib/hooks/useMinimalLayout.js.map +1 -1
  162. package/lib/hooks/useReflection.d.ts +4 -0
  163. package/lib/hooks/useReflection.d.ts.map +1 -0
  164. package/lib/hooks/useReflection.js +15 -21
  165. package/lib/hooks/useReflection.js.map +1 -1
  166. package/lib/hooks/useReflectionMap.d.ts +3 -0
  167. package/lib/hooks/useReflectionMap.d.ts.map +1 -0
  168. package/lib/hooks/useReflectionMap.js +5 -8
  169. package/lib/hooks/useReflectionMap.js.map +1 -1
  170. package/lib/index.d.ts +4 -0
  171. package/lib/index.d.ts.map +1 -0
  172. package/lib/index.js +349 -361
  173. package/lib/index.js.map +1 -1
  174. package/lib/markdownLoader.d.ts +6 -0
  175. package/lib/markdownLoader.d.ts.map +1 -0
  176. package/lib/markdownLoader.js +6 -10
  177. package/lib/markdownLoader.js.map +1 -1
  178. package/lib/plugin/data.d.ts +21 -0
  179. package/lib/plugin/data.d.ts.map +1 -0
  180. package/lib/plugin/data.js +391 -429
  181. package/lib/plugin/data.js.map +1 -1
  182. package/lib/plugin/python/consts.d.ts +35 -0
  183. package/lib/plugin/python/consts.d.ts.map +1 -0
  184. package/lib/plugin/python/consts.js +44 -44
  185. package/lib/plugin/python/consts.js.map +1 -1
  186. package/lib/plugin/python/index.d.ts +12 -0
  187. package/lib/plugin/python/index.d.ts.map +1 -0
  188. package/lib/plugin/python/index.js +25 -36
  189. package/lib/plugin/python/index.js.map +1 -1
  190. package/lib/plugin/python/inheritance.d.ts +42 -0
  191. package/lib/plugin/python/inheritance.d.ts.map +1 -0
  192. package/lib/plugin/python/inheritance.js +148 -153
  193. package/lib/plugin/python/inheritance.js.map +1 -1
  194. package/lib/plugin/python/packageVersions.d.ts +7 -0
  195. package/lib/plugin/python/packageVersions.d.ts.map +1 -0
  196. package/lib/plugin/python/packageVersions.js +30 -38
  197. package/lib/plugin/python/packageVersions.js.map +1 -1
  198. package/lib/plugin/python/transformation.d.ts +80 -0
  199. package/lib/plugin/python/transformation.d.ts.map +1 -0
  200. package/lib/plugin/python/transformation.js +350 -392
  201. package/lib/plugin/python/transformation.js.map +1 -1
  202. package/lib/plugin/python/type-parsing/index.d.ts +34 -0
  203. package/lib/plugin/python/type-parsing/index.d.ts.map +1 -0
  204. package/lib/plugin/python/type-parsing/index.js +78 -85
  205. package/lib/plugin/python/type-parsing/index.js.map +1 -1
  206. package/lib/plugin/python/types.d.ts +112 -0
  207. package/lib/plugin/python/types.d.ts.map +1 -0
  208. package/lib/plugin/python/types.js +2 -2
  209. package/lib/plugin/python/types.js.map +1 -1
  210. package/lib/plugin/python/utils.d.ts +40 -0
  211. package/lib/plugin/python/utils.d.ts.map +1 -0
  212. package/lib/plugin/python/utils.js +74 -73
  213. package/lib/plugin/python/utils.js.map +1 -1
  214. package/lib/plugin/sidebar.d.ts +6 -0
  215. package/lib/plugin/sidebar.d.ts.map +1 -0
  216. package/lib/plugin/sidebar.js +94 -96
  217. package/lib/plugin/sidebar.js.map +1 -1
  218. package/lib/plugin/structure/0.23.d.ts +3 -0
  219. package/lib/plugin/structure/0.23.d.ts.map +1 -0
  220. package/lib/plugin/structure/0.23.js +33 -41
  221. package/lib/plugin/structure/0.23.js.map +1 -1
  222. package/lib/plugin/url.d.ts +6 -0
  223. package/lib/plugin/url.d.ts.map +1 -0
  224. package/lib/plugin/url.js +36 -46
  225. package/lib/plugin/url.js.map +1 -1
  226. package/lib/plugin/version.d.ts +5 -0
  227. package/lib/plugin/version.d.ts.map +1 -0
  228. package/lib/plugin/version.js +73 -78
  229. package/lib/plugin/version.js.map +1 -1
  230. package/lib/types.d.ts +142 -0
  231. package/lib/types.d.ts.map +1 -0
  232. package/lib/types.js +2 -2
  233. package/lib/types.js.map +1 -1
  234. package/lib/utils/helpers.d.ts +2 -0
  235. package/lib/utils/helpers.d.ts.map +1 -0
  236. package/lib/utils/helpers.js +5 -7
  237. package/lib/utils/helpers.js.map +1 -1
  238. package/lib/utils/hierarchy.d.ts +8 -0
  239. package/lib/utils/hierarchy.d.ts.map +1 -0
  240. package/lib/utils/hierarchy.js +31 -33
  241. package/lib/utils/hierarchy.js.map +1 -1
  242. package/lib/utils/icons.d.ts +5 -0
  243. package/lib/utils/icons.d.ts.map +1 -0
  244. package/lib/utils/icons.js +82 -114
  245. package/lib/utils/icons.js.map +1 -1
  246. package/lib/utils/links.d.ts +2 -0
  247. package/lib/utils/links.d.ts.map +1 -0
  248. package/lib/utils/links.js +24 -41
  249. package/lib/utils/links.js.map +1 -1
  250. package/lib/utils/markdown.d.ts +4 -0
  251. package/lib/utils/markdown.d.ts.map +1 -0
  252. package/lib/utils/markdown.js +45 -54
  253. package/lib/utils/markdown.js.map +1 -1
  254. package/lib/utils/reexports.d.ts +5 -0
  255. package/lib/utils/reexports.d.ts.map +1 -0
  256. package/lib/utils/reexports.js +90 -90
  257. package/lib/utils/reexports.js.map +1 -1
  258. package/lib/utils/removeScopes.d.ts +2 -0
  259. package/lib/utils/removeScopes.d.ts.map +1 -0
  260. package/lib/utils/removeScopes.js +7 -0
  261. package/lib/utils/removeScopes.js.map +1 -0
  262. package/lib/utils/visibility.d.ts +6 -0
  263. package/lib/utils/visibility.d.ts.map +1 -0
  264. package/lib/utils/visibility.js +14 -19
  265. package/lib/utils/visibility.js.map +1 -1
  266. package/package.json +24 -17
  267. package/src/components/ApiIndex.tsx +1 -1
  268. package/src/components/Type.tsx +4 -4
  269. package/src/index.ts +2 -2
  270. package/src/plugin/data.ts +3 -3
  271. package/src/plugin/python/index.ts +3 -3
  272. package/src/plugin/python/packageVersions.ts +3 -3
  273. package/src/plugin/sidebar.ts +1 -1
  274. package/src/plugin/url.ts +1 -1
  275. package/src/plugin/version.ts +1 -1
  276. package/src/utils/links.ts +1 -12
  277. package/src/utils/removeScopes.ts +10 -0
  278. /package/{assets/styles-8ad572ec.css → lib/components/styles.css} +0 -0
@@ -1,469 +1,431 @@
1
- 'use strict';
2
-
3
- const _excluded = ["changelogPath", "readmePath"];
4
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
5
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
6
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
7
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
9
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
10
- 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); }
11
- const childProcess = require('node:child_process');
12
- const fs = require('node:fs');
13
- const path = require('node:path');
14
- const TypeDoc = require('typedoc');
15
- const ts = require('typescript');
16
- const utils = require('@docusaurus/utils');
17
- const links = require('../utils/links.js');
18
- const reexports = require('../utils/reexports.js');
19
- const index = require('./python/index.js');
20
- const _0_23 = require('./structure/0.23.js');
21
- const url = require('./url.js');
22
- const _interopDefault = e => e && e.__esModule ? e : {
23
- default: e
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
24
9
  };
25
- function _interopNamespace(e) {
26
- if (e && e.__esModule) return e;
27
- const n = Object.create(null);
28
- if (e) {
29
- for (const k in e) {
30
- if (k !== 'default') {
31
- const d = Object.getOwnPropertyDescriptor(e, k);
32
- Object.defineProperty(n, k, d.get ? d : {
33
- enumerable: true,
34
- get: () => e[k]
35
- });
36
- }
37
- }
38
- }
39
- n.default = e;
40
- return Object.freeze(n);
41
- }
42
- const fs__default = /*#__PURE__*/_interopDefault(fs);
43
- const path__default = /*#__PURE__*/_interopDefault(path);
44
- const TypeDoc__namespace = /*#__PURE__*/_interopNamespace(TypeDoc);
45
- const ts__default = /*#__PURE__*/_interopDefault(ts);
10
+ var __rest = (this && this.__rest) || function (s, e) {
11
+ var t = {};
12
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
13
+ t[p] = s[p];
14
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
15
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
16
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
17
+ t[p[i]] = s[p[i]];
18
+ }
19
+ return t;
20
+ };
21
+ import { spawnSync } from 'node:child_process';
22
+ import fs from 'node:fs';
23
+ import path from 'node:path';
24
+ import * as TypeDoc from 'typedoc';
25
+ import { ReflectionKind } from 'typedoc';
26
+ import ts from 'typescript';
27
+ import { normalizeUrl } from '@docusaurus/utils';
28
+ import { injectGitRevision } from '../utils/links';
29
+ import { injectReexports } from '../utils/reexports';
30
+ import { processPythonDocs } from './python';
31
+ import { migrateToVersion0230 } from './structure/0.23';
32
+ import { getKindSlug, getPackageSlug, joinUrl } from './url';
46
33
  function shouldEmit(projectRoot, tsconfigPath) {
47
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
48
- const _ts__default$default$ = ts__default.default.readConfigFile(tsconfigPath, name => fs__default.default.readFileSync(name, 'utf8')),
49
- config = _ts__default$default$.config,
50
- error = _ts__default$default$.error;
51
- if (error) {
52
- throw new Error(`Failed to load ${tsconfigPath}`);
53
- }
54
- const result = ts__default.default.parseJsonConfigFileContent(config, ts__default.default.sys, projectRoot, {}, tsconfigPath);
55
- if (result.errors.length > 0) {
56
- throw new Error(`Failed to parse ${tsconfigPath}`);
57
- }
58
- return result.projectReferences && result.projectReferences.length > 0 ? 'docs' : 'none';
34
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
35
+ const { config, error } = ts.readConfigFile(tsconfigPath, (name) => fs.readFileSync(name, 'utf8'));
36
+ if (error) {
37
+ throw new Error(`Failed to load ${tsconfigPath}`);
38
+ }
39
+ const result = ts.parseJsonConfigFileContent(config, ts.sys, projectRoot, {}, tsconfigPath);
40
+ if (result.errors.length > 0) {
41
+ throw new Error(`Failed to parse ${tsconfigPath}`);
42
+ }
43
+ return result.projectReferences && result.projectReferences.length > 0 ? 'docs' : 'none';
59
44
  }
60
-
61
45
  // Persist build state as a global, since the plugin is re-evaluated every hot reload.
62
46
  // Because of this, we can't use state in the plugin or module scope.
63
47
  if (!global.typedocBuild) {
64
- global.typedocBuild = {
65
- count: 0
66
- };
48
+ global.typedocBuild = { count: 0 };
67
49
  }
68
50
  function getCurrentGitRef() {
69
- try {
70
- const result = childProcess.spawnSync('git', ['rev-parse', 'HEAD'], {
71
- encoding: 'utf8'
72
- });
73
- if (result.status === 0) {
74
- return result.stdout.trim();
51
+ try {
52
+ const result = spawnSync('git', ['rev-parse', 'HEAD'], { encoding: 'utf8' });
53
+ if (result.status === 0) {
54
+ return result.stdout.trim();
55
+ }
56
+ console.warn(`[@apify/docusaurus-plugin-typedoc-api]: Unable to get current git SHA:`, result.stderr.trim());
75
57
  }
76
- console.warn(`[@apify/docusaurus-plugin-typedoc-api]: Unable to get current git SHA:`, result.stderr.trim());
77
- } catch (error) {
78
- console.warn(`[@apify/docusaurus-plugin-typedoc-api]: Error while getting current git SHA:`, error);
79
- }
80
- return undefined;
81
- }
82
- async function generateJson(projectRoot, entryPoints, outFile, options, context) {
83
- /* eslint-disable sort-keys */
84
- if (projectRoot && !path__default.default.isAbsolute(projectRoot)) {
85
- projectRoot = path__default.default.join(context.siteDir, projectRoot);
86
- }
87
-
88
- // Running the TypeDoc compiler is pretty slow...
89
- // We should only load on the 1st build, and use cache for subsequent reloads.
90
- if (global.typedocBuild.count > 0 && fs__default.default.existsSync(outFile)) {
91
- return true;
92
- }
93
- if (options.pathToCurrentVersionTypedocJSON) {
94
- fs__default.default.copyFileSync(options.pathToCurrentVersionTypedocJSON, outFile);
95
- }
96
- if (Object.keys(options.pythonOptions).length > 0) {
97
- if (!options.pythonOptions.pythonModulePath || !options.pythonOptions.moduleShortcutsPath) {
98
- throw new Error('Python options are missing required fields');
58
+ catch (error) {
59
+ console.warn(`[@apify/docusaurus-plugin-typedoc-api]: Error while getting current git SHA:`, error);
99
60
  }
100
- index.processPythonDocs({
101
- moduleShortcutsPath: options.pythonOptions.moduleShortcutsPath,
102
- outPath: outFile,
103
- pythonModulePath: options.pythonOptions.pythonModulePath,
104
- gitRevision: options.gitRefName
61
+ return undefined;
62
+ }
63
+ export function generateJson(projectRoot, entryPoints, outFile, options, context) {
64
+ return __awaiter(this, void 0, void 0, function* () {
65
+ var _a, _b;
66
+ /* eslint-disable sort-keys */
67
+ if (projectRoot && !path.isAbsolute(projectRoot)) {
68
+ projectRoot = path.join(context.siteDir, projectRoot);
69
+ }
70
+ // Running the TypeDoc compiler is pretty slow...
71
+ // We should only load on the 1st build, and use cache for subsequent reloads.
72
+ if (global.typedocBuild.count > 0 && fs.existsSync(outFile)) {
73
+ return true;
74
+ }
75
+ if (options.pathToCurrentVersionTypedocJSON) {
76
+ fs.copyFileSync(options.pathToCurrentVersionTypedocJSON, outFile);
77
+ }
78
+ if (Object.keys(options.pythonOptions).length > 0) {
79
+ if (!options.pythonOptions.pythonModulePath ||
80
+ !options.pythonOptions.moduleShortcutsPath) {
81
+ throw new Error('Python options are missing required fields');
82
+ }
83
+ processPythonDocs({
84
+ moduleShortcutsPath: options.pythonOptions.moduleShortcutsPath,
85
+ outPath: outFile,
86
+ pythonModulePath: options.pythonOptions.pythonModulePath,
87
+ gitRevision: options.gitRefName,
88
+ });
89
+ }
90
+ else {
91
+ const tsconfig = path.join(projectRoot, (_a = options.tsconfigName) !== null && _a !== void 0 ? _a : 'tsconfig.json');
92
+ const app = yield TypeDoc.Application.bootstrapWithPlugins(Object.assign(Object.assign({ gitRevision: (_b = getCurrentGitRef()) !== null && _b !== void 0 ? _b : options.gitRefName, includeVersion: true, skipErrorChecking: true,
93
+ // stripYamlFrontmatter: true,
94
+ // Only emit when using project references
95
+ emit: shouldEmit(projectRoot, tsconfig),
96
+ // Only document the public API by default
97
+ excludeExternals: true, excludeInternal: true, excludePrivate: true, excludeProtected: true,
98
+ // Enable verbose logging when debugging
99
+ logLevel: options.debug ? 'Verbose' : 'Info', inlineTags: [
100
+ '@link',
101
+ '@inheritDoc',
102
+ '@label',
103
+ '@linkcode',
104
+ '@linkplain',
105
+ '@apilink',
106
+ '@doclink',
107
+ ] }, options.typedocOptions), {
108
+ // Control how config and packages are detected
109
+ tsconfig, entryPoints: entryPoints.map((ep) => path.join(projectRoot, ep)), entryPointStrategy: 'expand', exclude: options.exclude,
110
+ // We use a fake category title so that we can fallback to the parent group
111
+ defaultCategory: '__CATEGORY__' }), [new TypeDoc.TSConfigReader(), new TypeDoc.TypeDocReader()]);
112
+ const project = yield app.convert();
113
+ if (project) {
114
+ yield app.generateJson(project, outFile);
115
+ global.typedocBuild.count += 1;
116
+ }
117
+ }
118
+ if (options.reexports && options.reexports.length > 0) {
119
+ yield injectReexports(outFile, options.reexports);
120
+ }
121
+ const gitRefName = getCurrentGitRef();
122
+ if (gitRefName) {
123
+ injectGitRevision(outFile, gitRefName);
124
+ }
125
+ return true;
105
126
  });
106
- } else {
107
- const tsconfig = path__default.default.join(projectRoot, options.tsconfigName ?? 'tsconfig.json');
108
- const app = await TypeDoc__namespace.Application.bootstrapWithPlugins(_objectSpread(_objectSpread({
109
- gitRevision: getCurrentGitRef() ?? options.gitRefName,
110
- includeVersion: true,
111
- skipErrorChecking: true,
112
- // stripYamlFrontmatter: true,
113
- // Only emit when using project references
114
- emit: shouldEmit(projectRoot, tsconfig),
115
- // Only document the public API by default
116
- excludeExternals: true,
117
- excludeInternal: true,
118
- excludePrivate: true,
119
- excludeProtected: true,
120
- // Enable verbose logging when debugging
121
- logLevel: options.debug ? 'Verbose' : 'Info',
122
- inlineTags: ['@link', '@inheritDoc', '@label', '@linkcode', '@linkplain', '@apilink', '@doclink']
123
- }, options.typedocOptions), {}, {
124
- // Control how config and packages are detected
125
- tsconfig,
126
- entryPoints: entryPoints.map(ep => path__default.default.join(projectRoot, ep)),
127
- entryPointStrategy: 'expand',
128
- exclude: options.exclude,
129
- // We use a fake category title so that we can fallback to the parent group
130
- defaultCategory: '__CATEGORY__'
131
- }), [new TypeDoc__namespace.TSConfigReader(), new TypeDoc__namespace.TypeDocReader()]);
132
- const project = await app.convert();
133
- if (project) {
134
- await app.generateJson(project, outFile);
135
- global.typedocBuild.count += 1;
136
- }
137
- }
138
- if (options.reexports && options.reexports.length > 0) {
139
- await reexports.injectReexports(outFile, options.reexports);
140
- }
141
- const gitRefName = getCurrentGitRef();
142
- if (gitRefName) {
143
- links.injectGitRevision(outFile, gitRefName);
144
- }
145
- return true;
146
127
  }
147
- function createReflectionMap(items = []) {
148
- const map = {};
149
- items.forEach(item => {
150
- // Add @reference categories to reflection.
151
- const referenceCategories = {};
152
- for (const tag of item.comment?.blockTags ?? []) {
153
- if (tag.tag === '@reference' && tag.content.length >= 2 && tag.content[0].kind === 'text') {
154
- const categoryName = tag.content[0].text.trim();
155
- const ref = tag.content.find(t => t.tag === '@link');
156
- if (ref && typeof ref.target === 'number') {
157
- if (!(categoryName in referenceCategories)) {
158
- referenceCategories[categoryName] = {
159
- title: categoryName,
160
- children: []
161
- };
162
- }
163
- if (!referenceCategories[categoryName].children.includes(ref.target)) {
164
- referenceCategories[categoryName].children.push(ref.target);
165
- }
128
+ export function createReflectionMap(items = []) {
129
+ const map = {};
130
+ items.forEach((item) => {
131
+ var _a, _b;
132
+ // Add @reference categories to reflection.
133
+ const referenceCategories = {};
134
+ for (const tag of (_b = (_a = item.comment) === null || _a === void 0 ? void 0 : _a.blockTags) !== null && _b !== void 0 ? _b : []) {
135
+ if (tag.tag === '@reference' && tag.content.length >= 2 && tag.content[0].kind === 'text') {
136
+ const categoryName = tag.content[0].text.trim();
137
+ const ref = tag.content.find((t) => t.tag === '@link');
138
+ if (ref && typeof ref.target === 'number') {
139
+ if (!(categoryName in referenceCategories)) {
140
+ referenceCategories[categoryName] = { title: categoryName, children: [] };
141
+ }
142
+ if (!referenceCategories[categoryName].children.includes(ref.target)) {
143
+ referenceCategories[categoryName].children.push(ref.target);
144
+ }
145
+ }
146
+ }
166
147
  }
167
- }
168
- }
169
-
170
- // Update categories with reference categories.
171
- if (!item.categories) {
172
- item.categories = [];
173
- }
174
- for (const category of Object.values(referenceCategories)) {
175
- if (category.children.length > 0) {
176
- const index = item.categories.findIndex(c => c.title === category.title);
177
- if (index === -1) {
178
- item.categories.push(category);
148
+ // Update categories with reference categories.
149
+ if (!item.categories) {
150
+ item.categories = [];
179
151
  }
180
- }
181
- }
182
-
183
- // Add item.
184
- map[item.id] = item;
185
- });
186
- return map;
152
+ for (const category of Object.values(referenceCategories)) {
153
+ if (category.children.length > 0) {
154
+ const index = item.categories.findIndex((c) => c.title === category.title);
155
+ if (index === -1) {
156
+ item.categories.push(category);
157
+ }
158
+ }
159
+ }
160
+ // Add item.
161
+ map[item.id] = item;
162
+ });
163
+ return map;
187
164
  }
188
- function loadPackageJsonAndDocs(initialDir, pkgFileName = 'package.json', readmeFileName = 'README.md', changelogFileName = 'CHANGELOG.md') {
189
- let currentDir = initialDir;
190
- let found = true;
191
- while (!fs__default.default.existsSync(path__default.default.join(currentDir, pkgFileName))) {
192
- if (currentDir === path__default.default.dirname(currentDir)) {
193
- found = false;
194
- break;
195
- } else {
196
- currentDir = path__default.default.dirname(currentDir);
165
+ export function loadPackageJsonAndDocs(initialDir, pkgFileName = 'package.json', readmeFileName = 'README.md', changelogFileName = 'CHANGELOG.md') {
166
+ let currentDir = initialDir;
167
+ let found = true;
168
+ while (!fs.existsSync(path.join(currentDir, pkgFileName))) {
169
+ if (currentDir === path.dirname(currentDir)) {
170
+ found = false;
171
+ break;
172
+ }
173
+ else {
174
+ currentDir = path.dirname(currentDir);
175
+ }
197
176
  }
198
- }
199
- if (!found) {
200
- // TODO: load the actual package information from pyproject.toml or similar
177
+ if (!found) {
178
+ // TODO: load the actual package information from pyproject.toml or similar
179
+ return {
180
+ packageJson: {
181
+ name: 'crawlee',
182
+ version: '1.0.0',
183
+ },
184
+ readmePath: '',
185
+ changelogPath: '',
186
+ };
187
+ }
188
+ const readmePath = path.join(currentDir, readmeFileName);
189
+ const changelogPath = path.join(currentDir, changelogFileName);
201
190
  return {
202
- packageJson: {
203
- name: 'crawlee',
204
- version: '1.0.0'
205
- },
206
- readmePath: '',
207
- changelogPath: ''
191
+ packageJson: JSON.parse(fs.readFileSync(path.join(currentDir, pkgFileName), 'utf8')),
192
+ readmePath: fs.existsSync(readmePath) ? readmePath : '',
193
+ changelogPath: fs.existsSync(changelogPath) ? changelogPath : '',
208
194
  };
209
- }
210
- const readmePath = path__default.default.join(currentDir, readmeFileName);
211
- const changelogPath = path__default.default.join(currentDir, changelogFileName);
212
- return {
213
- packageJson: JSON.parse(fs__default.default.readFileSync(path__default.default.join(currentDir, pkgFileName), 'utf8')),
214
- readmePath: fs__default.default.existsSync(readmePath) ? readmePath : '',
215
- changelogPath: fs__default.default.existsSync(changelogPath) ? changelogPath : ''
216
- };
217
195
  }
218
- function addMetadataToReflections(project, packageSlug, urlPrefix, options) {
219
- const permalink = `/${url.joinUrl(urlPrefix, packageSlug)}`;
220
- if (project.children) {
221
- project.children = project.children.map(child => {
222
- _0_23.migrateToVersion0230(child);
223
- const kindSlugPart = url.getKindSlug(child);
224
- const childSlug = kindSlugPart ? `/${kindSlugPart}/${child.name}` : `#${child.name}`;
225
- const childPermalink = permalink + childSlug;
226
-
227
- // We need to go another level deeper and only use fragments
228
- if ((child.kind === TypeDoc.ReflectionKind.Namespace || options.python) && child.children) {
229
- child.children = child.children.map(grandChild => _objectSpread(_objectSpread({}, grandChild), {}, {
230
- permalink: utils.normalizeUrl([`${childPermalink}#${grandChild.name}`])
231
- }));
232
- }
233
- return _objectSpread(_objectSpread({}, child), {}, {
234
- permalink: utils.normalizeUrl([childPermalink])
235
- });
236
- });
237
- }
238
-
239
- // @ts-expect-error Not sure why this fails
240
- return _objectSpread(_objectSpread({}, project), {}, {
241
- permalink: utils.normalizeUrl([permalink])
242
- });
196
+ export function addMetadataToReflections(project, packageSlug, urlPrefix, options) {
197
+ const permalink = `/${joinUrl(urlPrefix, packageSlug)}`;
198
+ if (project.children) {
199
+ project.children = project.children.map((child) => {
200
+ migrateToVersion0230(child);
201
+ const kindSlugPart = getKindSlug(child);
202
+ const childSlug = kindSlugPart ? `/${kindSlugPart}/${child.name}` : `#${child.name}`;
203
+ const childPermalink = permalink + childSlug;
204
+ // We need to go another level deeper and only use fragments
205
+ if ((child.kind === ReflectionKind.Namespace || options.python) && child.children) {
206
+ child.children = child.children.map((grandChild) => (Object.assign(Object.assign({}, grandChild), { permalink: normalizeUrl([`${childPermalink}#${grandChild.name}`]) })));
207
+ }
208
+ return Object.assign(Object.assign({}, child), { permalink: normalizeUrl([childPermalink]) });
209
+ });
210
+ }
211
+ // @ts-expect-error Not sure why this fails
212
+ return Object.assign(Object.assign({}, project), { permalink: normalizeUrl([permalink]) });
243
213
  }
244
214
  function mergeReflections(base, next) {
245
- if (Array.isArray(base.children) && Array.isArray(next.children)) {
246
- base.children.push(...next.children);
247
- }
248
- if (Array.isArray(base.groups) && Array.isArray(next.groups)) {
249
- next.groups.forEach(group => {
250
- const baseGroup = base.groups?.find(g => g.title === group.title);
251
- if (baseGroup) {
252
- baseGroup.children?.push(...(group.children ?? []));
253
- } else {
254
- base.groups?.push(group);
255
- }
256
- });
257
-
258
- // We can remove refs since were merging all reflections into one
259
-
260
- base.groups = base.groups.filter(group => group.title !== 'References');
261
- }
215
+ if (Array.isArray(base.children) && Array.isArray(next.children)) {
216
+ base.children.push(...next.children);
217
+ }
218
+ if (Array.isArray(base.groups) && Array.isArray(next.groups)) {
219
+ next.groups.forEach((group) => {
220
+ var _a, _b, _c, _d;
221
+ const baseGroup = (_a = base.groups) === null || _a === void 0 ? void 0 : _a.find((g) => g.title === group.title);
222
+ if (baseGroup) {
223
+ (_b = baseGroup.children) === null || _b === void 0 ? void 0 : _b.push(...((_c = group.children) !== null && _c !== void 0 ? _c : []));
224
+ }
225
+ else {
226
+ (_d = base.groups) === null || _d === void 0 ? void 0 : _d.push(group);
227
+ }
228
+ });
229
+ // We can remove refs since were merging all reflections into one
230
+ base.groups = base.groups.filter((group) => group.title !== 'References');
231
+ }
262
232
  }
263
233
  function sortReflectionGroups(reflections) {
264
- reflections.forEach(reflection => {
265
- const map = createReflectionMap(reflection.children);
266
- const sort = (a, b) => map[a].name < map[b].name ? -1 : 1;
267
- reflection.categories?.forEach(category => {
268
- category.children?.sort(sort);
269
- });
270
- reflection.groups?.forEach(group => {
271
- group.children?.sort(sort);
272
- group.categories?.forEach(category => {
273
- category.children?.sort(sort);
274
- });
234
+ reflections.forEach((reflection) => {
235
+ var _a, _b;
236
+ const map = createReflectionMap(reflection.children);
237
+ const sort = (a, b) => (map[a].name < map[b].name ? -1 : 1);
238
+ (_a = reflection.categories) === null || _a === void 0 ? void 0 : _a.forEach((category) => {
239
+ var _a;
240
+ (_a = category.children) === null || _a === void 0 ? void 0 : _a.sort(sort);
241
+ });
242
+ (_b = reflection.groups) === null || _b === void 0 ? void 0 : _b.forEach((group) => {
243
+ var _a, _b;
244
+ (_a = group.children) === null || _a === void 0 ? void 0 : _a.sort(sort);
245
+ (_b = group.categories) === null || _b === void 0 ? void 0 : _b.forEach((category) => {
246
+ var _a;
247
+ (_a = category.children) === null || _a === void 0 ? void 0 : _a.sort(sort);
248
+ });
249
+ });
275
250
  });
276
- });
277
251
  }
278
- function sourceFileMatchesEntryPoint(sourceFile, entryPoint, {
279
- deep,
280
- single
281
- }) {
282
- // Single package
283
- if (single) {
252
+ function sourceFileMatchesEntryPoint(sourceFile, entryPoint, { deep, single }) {
253
+ // Single package
254
+ if (single) {
255
+ return (
256
+ // src/index.ts === src/index.ts
257
+ (!deep && sourceFile === entryPoint) ||
258
+ // index.ts === src/index.ts
259
+ (!deep && sourceFile === path.basename(entryPoint)) ||
260
+ // some/deep/file.ts === ...
261
+ deep);
262
+ }
263
+ // Multiple packages
284
264
  return (
285
- // src/index.ts === src/index.ts
286
- !deep && sourceFile === entryPoint ||
287
- // index.ts === src/index.ts
288
- !deep && sourceFile === path__default.default.basename(entryPoint) ||
289
- // some/deep/file.ts === ...
290
- deep
291
- );
292
- }
293
-
294
- // Multiple packages
295
- return (
296
265
  // packages/foo/src/index.ts === packages/foo/src/index.ts
297
266
  // foo/src/index.ts ~ packages/foo/src/index.ts
298
- !deep && (sourceFile === entryPoint || entryPoint.endsWith(sourceFile)) ||
299
- // packages/foo/src/some/deep/file.ts === packages/foo/src/
300
- deep && sourceFile.startsWith(entryPoint)
301
- );
267
+ (!deep && (sourceFile === entryPoint || entryPoint.endsWith(sourceFile))) ||
268
+ // packages/foo/src/some/deep/file.ts === packages/foo/src/
269
+ (deep && sourceFile.startsWith(entryPoint)));
302
270
  }
303
271
  function modContainsEntryPoint(mod, entry, meta) {
304
- const relModSources = mod.sources ?? [];
305
- const relModSourceFile = relModSources.find(sf => !!sf.fileName)?.fileName ?? '';
306
- const relEntryPoint = url.joinUrl(meta.packagePath, entry.path);
307
-
308
- // Monorepos of 1 package don't have sources, so use the child sources.
309
- // They also don't use full paths like "package/src/index.ts" and simply use "index.ts",
310
- // so account for those entry points also.
311
- if (!relModSourceFile) {
312
- const absEntryPoint = path__default.default.normalize(path__default.default.join(meta.packageRoot ?? '', entry.path ?? ''));
313
- const relEntryPointName = path__default.default.basename(relEntryPoint);
314
- const entryPointInSourceFiles = !!meta.allSourceFiles[absEntryPoint] || !!meta.allSourceFiles[relEntryPoint] || relEntryPointName.startsWith('index.') && !!meta.allSourceFiles[relEntryPointName];
315
- if (entryPointInSourceFiles) {
316
- return sourceFileMatchesEntryPoint(relEntryPoint, relEntryPoint, {
317
- deep: meta.isUsingDeepImports,
318
- single: meta.isSinglePackage
319
- });
272
+ var _a, _b, _c, _d, _e;
273
+ const relModSources = (_a = mod.sources) !== null && _a !== void 0 ? _a : [];
274
+ const relModSourceFile = (_c = (_b = relModSources.find((sf) => !!sf.fileName)) === null || _b === void 0 ? void 0 : _b.fileName) !== null && _c !== void 0 ? _c : '';
275
+ const relEntryPoint = joinUrl(meta.packagePath, entry.path);
276
+ // Monorepos of 1 package don't have sources, so use the child sources.
277
+ // They also don't use full paths like "package/src/index.ts" and simply use "index.ts",
278
+ // so account for those entry points also.
279
+ if (!relModSourceFile) {
280
+ const absEntryPoint = path.normalize(path.join((_d = meta.packageRoot) !== null && _d !== void 0 ? _d : '', (_e = entry.path) !== null && _e !== void 0 ? _e : ''));
281
+ const relEntryPointName = path.basename(relEntryPoint);
282
+ const entryPointInSourceFiles = !!meta.allSourceFiles[absEntryPoint] ||
283
+ !!meta.allSourceFiles[relEntryPoint] ||
284
+ (relEntryPointName.startsWith('index.') && !!meta.allSourceFiles[relEntryPointName]);
285
+ if (entryPointInSourceFiles) {
286
+ return sourceFileMatchesEntryPoint(relEntryPoint, relEntryPoint, {
287
+ deep: meta.isUsingDeepImports,
288
+ single: meta.isSinglePackage,
289
+ });
290
+ }
320
291
  }
321
- }
322
- return sourceFileMatchesEntryPoint(relModSourceFile, relEntryPoint, {
323
- deep: meta.isUsingDeepImports,
324
- single: meta.isSinglePackage
325
- });
292
+ return sourceFileMatchesEntryPoint(relModSourceFile, relEntryPoint, {
293
+ deep: meta.isUsingDeepImports,
294
+ single: meta.isSinglePackage,
295
+ });
326
296
  }
327
297
  function extractReflectionModules(project, isSinglePackage) {
328
- const modules = [];
329
- const inheritChildren = () => {
330
- project.children?.forEach(child => {
331
- if (child.kind === TypeDoc.ReflectionKind.Module) {
332
- modules.push(child);
333
- }
334
- });
335
- };
336
-
337
- // Single packages are extremely difficult, as the TypeDoc structure is
338
- // different for every kind of package entry point pattern
339
- if (isSinglePackage) {
340
- const hasNoModules = project.children?.every(child => child.kind !== TypeDoc.ReflectionKind.Module);
341
- if (hasNoModules) {
342
- // No "module" children:
343
- // - Polyrepos
344
- // - Monorepos with 1 package
345
- modules.push(project);
346
- } else {
347
- // Has "module" children:
348
- // - Polyrepos with deep imports
349
- // - Polyrepos with multi-imports
350
- // - Monorepos
351
- inheritChildren();
298
+ var _a;
299
+ const modules = [];
300
+ const inheritChildren = () => {
301
+ var _a;
302
+ (_a = project.children) === null || _a === void 0 ? void 0 : _a.forEach((child) => {
303
+ if (child.kind === ReflectionKind.Module) {
304
+ modules.push(child);
305
+ }
306
+ });
307
+ };
308
+ // Single packages are extremely difficult, as the TypeDoc structure is
309
+ // different for every kind of package entry point pattern
310
+ if (isSinglePackage) {
311
+ const hasNoModules = (_a = project.children) === null || _a === void 0 ? void 0 : _a.every((child) => child.kind !== ReflectionKind.Module);
312
+ if (hasNoModules) {
313
+ // No "module" children:
314
+ // - Polyrepos
315
+ // - Monorepos with 1 package
316
+ modules.push(project);
317
+ }
318
+ else {
319
+ // Has "module" children:
320
+ // - Polyrepos with deep imports
321
+ // - Polyrepos with multi-imports
322
+ // - Monorepos
323
+ inheritChildren();
324
+ }
325
+ // Multiple packages are extremely simple, as every package is a module reflection
326
+ // as a child on the top-level project reflection
327
+ }
328
+ else {
329
+ inheritChildren();
352
330
  }
353
-
354
- // Multiple packages are extremely simple, as every package is a module reflection
355
- // as a child on the top-level project reflection
356
- } else {
357
- inheritChildren();
358
- }
359
- return modules;
331
+ return modules;
360
332
  }
361
333
  function buildSourceFileNameMap(project, modChildren) {
362
- const map = {};
363
- const cwd = process.cwd();
364
- if (project.symbolIdMap) {
365
- Object.values(project.symbolIdMap).forEach(symbol => {
366
- // absolute
367
- map[path__default.default.normalize(path__default.default.join(cwd, symbol.sourceFileName))] = true;
368
- });
369
- }
370
- modChildren.forEach(child => {
371
- child.sources?.forEach(sf => {
372
- // relative
373
- map[sf.fileName] = true;
334
+ const map = {};
335
+ const cwd = process.cwd();
336
+ if (project.symbolIdMap) {
337
+ Object.values(project.symbolIdMap).forEach((symbol) => {
338
+ // absolute
339
+ map[path.normalize(path.join(cwd, symbol.sourceFileName))] = true;
340
+ });
341
+ }
342
+ modChildren.forEach((child) => {
343
+ var _a;
344
+ (_a = child.sources) === null || _a === void 0 ? void 0 : _a.forEach((sf) => {
345
+ // relative
346
+ map[sf.fileName] = true;
347
+ });
374
348
  });
375
- });
376
- return map;
349
+ return map;
377
350
  }
378
- function flattenAndGroupPackages(packageConfigs, project, urlPrefix, options, context, versioned = false) {
379
- const isSinglePackage = packageConfigs.length === 1;
380
- const modules = extractReflectionModules(project, isSinglePackage);
381
-
382
- // Loop through every TypeDoc module and group based on package and entry point
383
- const packages = {};
384
- const packagesWithDeepImports = [];
385
- modules.forEach(mod => {
386
- const allSourceFiles = buildSourceFileNameMap(project, mod.children ?? []);
387
- packageConfigs.some(cfg => Object.entries(cfg.entryPoints).some(([importPath, entry]) => {
388
- const isUsingDeepImports = !entry.path.match(/\.tsx?$/);
389
- let packageRoot = cfg.packageRoot;
390
- if (packageRoot && !path__default.default.isAbsolute(packageRoot)) {
391
- packageRoot = path__default.default.join(context.siteDir, packageRoot);
392
- }
393
- if (!modContainsEntryPoint(mod, entry, {
394
- allSourceFiles,
395
- isSinglePackage,
396
- isUsingDeepImports,
397
- packagePath: cfg.packagePath,
398
- packageRoot
399
- })) {
400
- return false;
401
- }
402
-
403
- // We have a matching entry point, so store the record
404
- if (!packages[cfg.packagePath]) {
405
- const _loadPackageJsonAndDo = loadPackageJsonAndDocs(path__default.default.join(options.projectRoot, cfg.packagePath), options.packageJsonName, options.readmeName, options.changelogName),
406
- packageJson = _loadPackageJsonAndDo.packageJson,
407
- readmePath = _loadPackageJsonAndDo.readmePath,
408
- changelogPath = _loadPackageJsonAndDo.changelogPath;
409
- packages[cfg.packagePath] = {
410
- entryPoints: [],
411
- packageName: versioned && cfg.packageName || packageJson.name,
412
- packageVersion: versioned && cfg.packageVersion || packageJson.version,
413
- readmePath,
414
- changelogPath
415
- };
416
- cfg.packageName = packages[cfg.packagePath].packageName;
417
- cfg.packageVersion = packages[cfg.packagePath].packageVersion;
418
- }
419
-
420
- // Add metadata to package and children reflections
421
- const urlSlug = url.getPackageSlug(cfg, importPath, isSinglePackage);
422
- const reflection = addMetadataToReflections(mod, urlSlug, urlPrefix, options);
423
- const existingEntry = packages[cfg.packagePath].entryPoints.find(ep => ep.urlSlug === urlSlug);
424
- if (existingEntry) {
425
- if (isUsingDeepImports) {
426
- mergeReflections(existingEntry.reflection, reflection);
427
- } else {
428
- // eslint-disable-next-line no-console
429
- console.error(`Entry point ${urlSlug} already defined. How did you get here?`);
430
- }
431
- } else {
432
- packages[cfg.packagePath].entryPoints.push({
433
- index: importPath === 'index',
434
- label: entry.label,
435
- reflection,
436
- urlSlug
437
- });
438
- if (isUsingDeepImports) {
439
- packagesWithDeepImports.push(reflection);
440
- }
441
- }
442
-
443
- // Update the reflection name since its useless
444
- reflection.name = importPath === 'index' ? packages[cfg.packagePath].packageName : url.joinUrl(packages[cfg.packagePath].packageName, importPath);
445
- return true;
446
- }));
447
- });
448
-
449
- // Since we merged multiple reflections together, we'll need to sort groups manually
450
- sortReflectionGroups(packagesWithDeepImports);
451
-
452
- // Sort packages by name
453
- return Object.values(packages).sort((a, b) => a.packageName.localeCompare(b.packageName));
351
+ export function flattenAndGroupPackages(packageConfigs, project, urlPrefix, options, context, versioned = false) {
352
+ const isSinglePackage = packageConfigs.length === 1;
353
+ const modules = extractReflectionModules(project, isSinglePackage);
354
+ // Loop through every TypeDoc module and group based on package and entry point
355
+ const packages = {};
356
+ const packagesWithDeepImports = [];
357
+ modules.forEach((mod) => {
358
+ var _a;
359
+ const allSourceFiles = buildSourceFileNameMap(project, (_a = mod.children) !== null && _a !== void 0 ? _a : []);
360
+ packageConfigs.some((cfg) => Object.entries(cfg.entryPoints).some(([importPath, entry]) => {
361
+ const isUsingDeepImports = !entry.path.match(/\.tsx?$/);
362
+ let { packageRoot } = cfg;
363
+ if (packageRoot && !path.isAbsolute(packageRoot)) {
364
+ packageRoot = path.join(context.siteDir, packageRoot);
365
+ }
366
+ if (!modContainsEntryPoint(mod, entry, {
367
+ allSourceFiles,
368
+ isSinglePackage,
369
+ isUsingDeepImports,
370
+ packagePath: cfg.packagePath,
371
+ packageRoot,
372
+ })) {
373
+ return false;
374
+ }
375
+ // We have a matching entry point, so store the record
376
+ if (!packages[cfg.packagePath]) {
377
+ const { packageJson, readmePath, changelogPath } = loadPackageJsonAndDocs(path.join(options.projectRoot, cfg.packagePath), options.packageJsonName, options.readmeName, options.changelogName);
378
+ packages[cfg.packagePath] = {
379
+ entryPoints: [],
380
+ packageName: (versioned && cfg.packageName) || packageJson.name,
381
+ packageVersion: (versioned && cfg.packageVersion) || packageJson.version,
382
+ readmePath,
383
+ changelogPath,
384
+ };
385
+ cfg.packageName = packages[cfg.packagePath].packageName;
386
+ cfg.packageVersion = packages[cfg.packagePath].packageVersion;
387
+ }
388
+ // Add metadata to package and children reflections
389
+ const urlSlug = getPackageSlug(cfg, importPath, isSinglePackage);
390
+ const reflection = addMetadataToReflections(mod, urlSlug, urlPrefix, options);
391
+ const existingEntry = packages[cfg.packagePath].entryPoints.find((ep) => ep.urlSlug === urlSlug);
392
+ if (existingEntry) {
393
+ if (isUsingDeepImports) {
394
+ mergeReflections(existingEntry.reflection, reflection);
395
+ }
396
+ else {
397
+ // eslint-disable-next-line no-console
398
+ console.error(`Entry point ${urlSlug} already defined. How did you get here?`);
399
+ }
400
+ }
401
+ else {
402
+ packages[cfg.packagePath].entryPoints.push({
403
+ index: importPath === 'index',
404
+ label: entry.label,
405
+ reflection,
406
+ urlSlug,
407
+ });
408
+ if (isUsingDeepImports) {
409
+ packagesWithDeepImports.push(reflection);
410
+ }
411
+ }
412
+ // Update the reflection name since its useless
413
+ reflection.name =
414
+ importPath === 'index'
415
+ ? packages[cfg.packagePath].packageName
416
+ : joinUrl(packages[cfg.packagePath].packageName, importPath);
417
+ return true;
418
+ }));
419
+ });
420
+ // Since we merged multiple reflections together, we'll need to sort groups manually
421
+ sortReflectionGroups(packagesWithDeepImports);
422
+ // Sort packages by name
423
+ return Object.values(packages).sort((a, b) => a.packageName.localeCompare(b.packageName));
454
424
  }
455
- function formatPackagesWithoutHostInfo(packages) {
456
- return packages.map(_ref => {
457
- let changelogPath = _ref.changelogPath,
458
- readmePath = _ref.readmePath,
459
- pkg = _objectWithoutProperties(_ref, _excluded);
460
- return pkg;
461
- });
425
+ export function formatPackagesWithoutHostInfo(packages) {
426
+ return packages.map((_a) => {
427
+ var { changelogPath, readmePath } = _a, pkg = __rest(_a, ["changelogPath", "readmePath"]);
428
+ return pkg;
429
+ });
462
430
  }
463
- exports.addMetadataToReflections = addMetadataToReflections;
464
- exports.createReflectionMap = createReflectionMap;
465
- exports.flattenAndGroupPackages = flattenAndGroupPackages;
466
- exports.formatPackagesWithoutHostInfo = formatPackagesWithoutHostInfo;
467
- exports.generateJson = generateJson;
468
- exports.loadPackageJsonAndDocs = loadPackageJsonAndDocs;
469
- //# sourceMappingURL=data.js.map
431
+ //# sourceMappingURL=data.js.map