typedoc 0.25.13 → 0.26.0-beta.1

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 (209) hide show
  1. package/dist/index.d.ts +3 -2
  2. package/dist/index.js +3 -2
  3. package/dist/lib/application.d.ts +15 -3
  4. package/dist/lib/application.js +75 -24
  5. package/dist/lib/cli.js +1 -1
  6. package/dist/lib/converter/comments/blockLexer.d.ts +1 -1
  7. package/dist/lib/converter/comments/blockLexer.js +1 -2
  8. package/dist/lib/converter/comments/declarationReference.js +8 -8
  9. package/dist/lib/converter/comments/declarationReferenceResolver.d.ts +1 -1
  10. package/dist/lib/converter/comments/declarationReferenceResolver.js +15 -14
  11. package/dist/lib/converter/comments/discovery.d.ts +3 -3
  12. package/dist/lib/converter/comments/discovery.js +21 -19
  13. package/dist/lib/converter/comments/index.d.ts +1 -1
  14. package/dist/lib/converter/comments/index.js +35 -16
  15. package/dist/lib/converter/comments/lineLexer.d.ts +1 -1
  16. package/dist/lib/converter/comments/lineLexer.js +1 -2
  17. package/dist/lib/converter/comments/linkResolver.d.ts +2 -2
  18. package/dist/lib/converter/comments/linkResolver.js +5 -3
  19. package/dist/lib/converter/comments/parser.d.ts +14 -3
  20. package/dist/lib/converter/comments/parser.js +147 -39
  21. package/dist/lib/converter/comments/rawLexer.d.ts +7 -1
  22. package/dist/lib/converter/comments/rawLexer.js +21 -70
  23. package/dist/lib/converter/comments/tagName.js +1 -2
  24. package/dist/lib/converter/context.d.ts +7 -2
  25. package/dist/lib/converter/context.js +10 -2
  26. package/dist/lib/converter/convert-expression.js +2 -3
  27. package/dist/lib/converter/converter.d.ts +9 -4
  28. package/dist/lib/converter/converter.js +55 -17
  29. package/dist/lib/converter/factories/index-signature.d.ts +1 -1
  30. package/dist/lib/converter/factories/index-signature.js +9 -12
  31. package/dist/lib/converter/factories/signature.d.ts +1 -1
  32. package/dist/lib/converter/factories/signature.js +14 -15
  33. package/dist/lib/converter/jsdoc.js +2 -3
  34. package/dist/lib/converter/plugins/CategoryPlugin.d.ts +3 -3
  35. package/dist/lib/converter/plugins/CategoryPlugin.js +24 -17
  36. package/dist/lib/converter/plugins/CommentPlugin.d.ts +3 -1
  37. package/dist/lib/converter/plugins/CommentPlugin.js +112 -69
  38. package/dist/lib/converter/plugins/GroupPlugin.d.ts +4 -4
  39. package/dist/lib/converter/plugins/GroupPlugin.js +52 -18
  40. package/dist/lib/converter/plugins/ImplementsPlugin.js +4 -3
  41. package/dist/lib/converter/plugins/InheritDocPlugin.d.ts +1 -1
  42. package/dist/lib/converter/plugins/InheritDocPlugin.js +5 -6
  43. package/dist/lib/converter/plugins/LinkResolverPlugin.d.ts +2 -2
  44. package/dist/lib/converter/plugins/PackagePlugin.d.ts +0 -2
  45. package/dist/lib/converter/plugins/PackagePlugin.js +8 -30
  46. package/dist/lib/converter/plugins/SourcePlugin.js +2 -2
  47. package/dist/lib/converter/symbols.js +6 -11
  48. package/dist/lib/converter/types.d.ts +1 -1
  49. package/dist/lib/converter/types.js +4 -5
  50. package/dist/lib/converter/utils/nodes.js +3 -4
  51. package/dist/lib/converter/utils/reflections.d.ts +1 -1
  52. package/dist/lib/converter/utils/reflections.js +1 -2
  53. package/dist/lib/converter/utils/repository.js +4 -4
  54. package/dist/lib/converter/utils/symbols.js +1 -2
  55. package/dist/lib/internationalization/index.d.ts +7 -0
  56. package/dist/lib/internationalization/index.js +11 -0
  57. package/dist/lib/internationalization/internationalization.d.ts +92 -0
  58. package/dist/lib/internationalization/internationalization.js +194 -0
  59. package/dist/lib/internationalization/locales/en.cjs +3 -0
  60. package/dist/lib/internationalization/locales/en.d.cts +2 -0
  61. package/dist/lib/internationalization/locales/test.cjs +8 -0
  62. package/dist/lib/internationalization/locales/test.d.cts +5 -0
  63. package/dist/lib/internationalization/translatable.d.ts +304 -0
  64. package/dist/lib/internationalization/translatable.js +329 -0
  65. package/dist/lib/models/ReflectionCategory.d.ts +2 -2
  66. package/dist/lib/models/ReflectionGroup.d.ts +2 -2
  67. package/dist/lib/models/comments/comment.d.ts +17 -3
  68. package/dist/lib/models/comments/comment.js +377 -298
  69. package/dist/lib/models/reflections/ReflectionSymbolId.js +2 -2
  70. package/dist/lib/models/reflections/abstract.d.ts +11 -8
  71. package/dist/lib/models/reflections/abstract.js +17 -11
  72. package/dist/lib/models/reflections/container.d.ts +25 -3
  73. package/dist/lib/models/reflections/container.js +64 -0
  74. package/dist/lib/models/reflections/declaration.d.ts +3 -15
  75. package/dist/lib/models/reflections/declaration.js +16 -21
  76. package/dist/lib/models/reflections/document.d.ts +27 -0
  77. package/dist/lib/models/reflections/document.js +43 -0
  78. package/dist/lib/models/reflections/index.d.ts +4 -3
  79. package/dist/lib/models/reflections/index.js +5 -4
  80. package/dist/lib/models/reflections/kind.d.ts +14 -1
  81. package/dist/lib/models/reflections/kind.js +13 -0
  82. package/dist/lib/models/reflections/parameter.d.ts +1 -1
  83. package/dist/lib/models/reflections/project.d.ts +2 -2
  84. package/dist/lib/models/reflections/project.js +8 -7
  85. package/dist/lib/models/reflections/signature.d.ts +2 -2
  86. package/dist/lib/models/reflections/type-parameter.d.ts +1 -1
  87. package/dist/lib/models/reflections/utils.js +1 -2
  88. package/dist/lib/models/reflections/variant.d.ts +2 -0
  89. package/dist/lib/models/types.d.ts +4 -4
  90. package/dist/lib/models/types.js +3 -3
  91. package/dist/lib/output/events.d.ts +5 -5
  92. package/dist/lib/output/events.js +2 -1
  93. package/dist/lib/output/index.d.ts +1 -1
  94. package/dist/lib/output/index.js +2 -1
  95. package/dist/lib/output/plugins/AssetsPlugin.js +1 -1
  96. package/dist/lib/output/plugins/JavascriptIndexPlugin.d.ts +3 -1
  97. package/dist/lib/output/plugins/JavascriptIndexPlugin.js +28 -8
  98. package/dist/lib/output/plugins/SitemapPlugin.d.ts +1 -1
  99. package/dist/lib/output/plugins/SitemapPlugin.js +17 -27
  100. package/dist/lib/output/renderer.d.ts +3 -1
  101. package/dist/lib/output/renderer.js +7 -7
  102. package/dist/lib/output/themes/MarkedPlugin.d.ts +16 -25
  103. package/dist/lib/output/themes/MarkedPlugin.js +89 -161
  104. package/dist/lib/output/themes/default/DefaultTheme.d.ts +16 -4
  105. package/dist/lib/output/themes/default/DefaultTheme.js +66 -17
  106. package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +44 -44
  107. package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +6 -13
  108. package/dist/lib/output/themes/default/layouts/default.js +2 -2
  109. package/dist/lib/output/themes/default/partials/analytics.js +1 -2
  110. package/dist/lib/output/themes/default/partials/anchor-icon.js +2 -3
  111. package/dist/lib/output/themes/default/partials/comment.d.ts +1 -1
  112. package/dist/lib/output/themes/default/partials/comment.js +3 -4
  113. package/dist/lib/output/themes/default/partials/footer.js +31 -5
  114. package/dist/lib/output/themes/default/partials/header.d.ts +1 -1
  115. package/dist/lib/output/themes/default/partials/header.js +4 -3
  116. package/dist/lib/output/themes/default/partials/hierarchy.js +3 -4
  117. package/dist/lib/output/themes/default/partials/icon.js +7 -2
  118. package/dist/lib/output/themes/default/partials/index.js +4 -4
  119. package/dist/lib/output/themes/default/partials/member.d.ts +2 -2
  120. package/dist/lib/output/themes/default/partials/member.declaration.js +2 -3
  121. package/dist/lib/output/themes/default/partials/member.js +13 -2
  122. package/dist/lib/output/themes/default/partials/member.reference.d.ts +1 -1
  123. package/dist/lib/output/themes/default/partials/member.reference.js +9 -6
  124. package/dist/lib/output/themes/default/partials/member.signature.body.d.ts +1 -1
  125. package/dist/lib/output/themes/default/partials/member.signature.body.js +4 -4
  126. package/dist/lib/output/themes/default/partials/member.signature.title.d.ts +1 -1
  127. package/dist/lib/output/themes/default/partials/member.signature.title.js +1 -2
  128. package/dist/lib/output/themes/default/partials/member.sources.js +12 -6
  129. package/dist/lib/output/themes/default/partials/members.d.ts +1 -1
  130. package/dist/lib/output/themes/default/partials/members.group.js +1 -2
  131. package/dist/lib/output/themes/default/partials/members.js +1 -2
  132. package/dist/lib/output/themes/default/partials/navigation.d.ts +1 -1
  133. package/dist/lib/output/themes/default/partials/navigation.js +19 -17
  134. package/dist/lib/output/themes/default/partials/parameter.d.ts +1 -1
  135. package/dist/lib/output/themes/default/partials/parameter.js +15 -15
  136. package/dist/lib/output/themes/default/partials/reflectionPreview.js +1 -2
  137. package/dist/lib/output/themes/default/partials/toolbar.js +4 -4
  138. package/dist/lib/output/themes/default/partials/type.d.ts +1 -1
  139. package/dist/lib/output/themes/default/partials/type.js +14 -14
  140. package/dist/lib/output/themes/default/partials/typeAndParent.d.ts +1 -1
  141. package/dist/lib/output/themes/default/partials/typeParameters.js +2 -3
  142. package/dist/lib/output/themes/default/templates/document.d.ts +5 -0
  143. package/dist/lib/output/themes/default/templates/document.js +7 -0
  144. package/dist/lib/output/themes/default/templates/hierarchy.js +1 -2
  145. package/dist/lib/output/themes/default/templates/reflection.d.ts +1 -1
  146. package/dist/lib/output/themes/default/templates/reflection.js +21 -19
  147. package/dist/lib/output/themes/lib.d.ts +1 -1
  148. package/dist/lib/output/themes/lib.js +12 -16
  149. package/dist/lib/serialization/deserializer.d.ts +3 -3
  150. package/dist/lib/serialization/deserializer.js +7 -5
  151. package/dist/lib/serialization/schema.d.ts +10 -3
  152. package/dist/lib/utils/array.js +9 -10
  153. package/dist/lib/utils/component.d.ts +1 -1
  154. package/dist/lib/utils/component.js +2 -2
  155. package/dist/lib/utils/entry-point.d.ts +11 -0
  156. package/dist/lib/utils/entry-point.js +51 -24
  157. package/dist/lib/utils/enum.js +6 -7
  158. package/dist/lib/utils/fs.js +15 -16
  159. package/dist/lib/utils/general.d.ts +4 -3
  160. package/dist/lib/utils/general.js +4 -5
  161. package/dist/lib/utils/highlighter.d.ts +4 -2
  162. package/dist/lib/utils/highlighter.js +41 -40
  163. package/dist/lib/utils/html.js +2 -3
  164. package/dist/lib/utils/index.d.ts +1 -1
  165. package/dist/lib/utils/index.js +1 -2
  166. package/dist/lib/utils/jsx.elements.d.ts +13 -1
  167. package/dist/lib/utils/jsx.js +4 -4
  168. package/dist/lib/utils/loggers.d.ts +13 -7
  169. package/dist/lib/utils/loggers.js +13 -10
  170. package/dist/lib/utils/map.d.ts +1 -1
  171. package/dist/lib/utils/map.js +1 -1
  172. package/dist/lib/utils/options/declaration.d.ts +48 -21
  173. package/dist/lib/utils/options/declaration.js +36 -36
  174. package/dist/lib/utils/options/help.d.ts +2 -1
  175. package/dist/lib/utils/options/help.js +10 -10
  176. package/dist/lib/utils/options/index.d.ts +1 -1
  177. package/dist/lib/utils/options/index.js +1 -2
  178. package/dist/lib/utils/options/options.d.ts +5 -34
  179. package/dist/lib/utils/options/options.js +13 -23
  180. package/dist/lib/utils/options/readers/arguments.js +3 -5
  181. package/dist/lib/utils/options/readers/package-json.js +2 -2
  182. package/dist/lib/utils/options/readers/tsconfig.js +8 -12
  183. package/dist/lib/utils/options/readers/typedoc.d.ts +1 -1
  184. package/dist/lib/utils/options/readers/typedoc.js +8 -7
  185. package/dist/lib/utils/options/sources/typedoc.js +225 -178
  186. package/dist/lib/utils/options/tsdoc-defaults.d.ts +4 -4
  187. package/dist/lib/utils/options/tsdoc-defaults.js +27 -20
  188. package/dist/lib/utils/package-manifest.d.ts +1 -1
  189. package/dist/lib/utils/package-manifest.js +9 -11
  190. package/dist/lib/utils/paths.js +4 -5
  191. package/dist/lib/utils/perf.js +3 -4
  192. package/dist/lib/utils/plugins.js +4 -5
  193. package/dist/lib/utils/reflections.d.ts +1 -1
  194. package/dist/lib/utils/reflections.js +2 -3
  195. package/dist/lib/utils/set.d.ts +1 -0
  196. package/dist/lib/utils/set.js +12 -0
  197. package/dist/lib/utils/sort.d.ts +3 -2
  198. package/dist/lib/utils/sort.js +37 -6
  199. package/dist/lib/utils/tsconfig.js +3 -4
  200. package/dist/lib/utils/tsutils.js +2 -3
  201. package/dist/lib/utils/validation.js +4 -4
  202. package/dist/lib/validation/documentation.d.ts +1 -1
  203. package/dist/lib/validation/documentation.js +9 -4
  204. package/dist/lib/validation/exports.js +3 -5
  205. package/dist/lib/validation/links.js +2 -3
  206. package/package.json +12 -11
  207. package/static/main.js +4 -4
  208. package/static/style.css +46 -29
  209. package/tsdoc.json +22 -0
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.addInferredDeclarationMapPaths = exports.ReflectionSymbolId = void 0;
6
+ exports.ReflectionSymbolId = void 0;
7
+ exports.addInferredDeclarationMapPaths = addInferredDeclarationMapPaths;
7
8
  const fs_1 = require("fs");
8
9
  const path_1 = require("path");
9
10
  const typescript_1 = __importDefault(require("typescript"));
@@ -109,4 +110,3 @@ function addInferredDeclarationMapPaths(opts, files) {
109
110
  declarationMapCache.set(mapFile, file);
110
111
  }
111
112
  }
112
- exports.addInferredDeclarationMapPaths = addInferredDeclarationMapPaths;
@@ -5,6 +5,7 @@ import { ReflectionKind } from "./kind";
5
5
  import type { Serializer, Deserializer, JSONOutput } from "../../serialization";
6
6
  import type { ReflectionVariant } from "./variant";
7
7
  import type { DeclarationReflection } from "./declaration";
8
+ import type { DocumentReflection } from "./document";
8
9
  /**
9
10
  * Reset the reflection id.
10
11
  *
@@ -75,13 +76,14 @@ export declare class ReflectionFlags extends Array<string> {
75
76
  }
76
77
  export declare enum TraverseProperty {
77
78
  Children = 0,
78
- Parameters = 1,
79
- TypeLiteral = 2,
80
- TypeParameter = 3,
81
- Signatures = 4,
82
- IndexSignature = 5,
83
- GetSignature = 6,
84
- SetSignature = 7
79
+ Documents = 1,
80
+ Parameters = 2,
81
+ TypeLiteral = 3,
82
+ TypeParameter = 4,
83
+ Signatures = 5,
84
+ IndexSignature = 6,
85
+ GetSignature = 7,
86
+ SetSignature = 8
85
87
  }
86
88
  export interface TraverseCallback {
87
89
  /**
@@ -201,6 +203,7 @@ export declare abstract class Reflection {
201
203
  */
202
204
  isProject(): this is ProjectReflection;
203
205
  isDeclaration(): this is DeclarationReflection;
206
+ isDocument(): this is DocumentReflection;
204
207
  /**
205
208
  * Check if this reflection or any of its parents have been marked with the `@deprecated` tag.
206
209
  */
@@ -209,7 +212,7 @@ export declare abstract class Reflection {
209
212
  * Traverse most potential child reflections of this reflection.
210
213
  *
211
214
  * Note: This may not necessarily traverse child reflections contained within the `type` property
212
- * of the reflection, and should not be relied on for this. Support for checking object types will likely be removed in v0.26.
215
+ * of the reflection, and should not be relied on for this. Support for checking object types will likely be removed in v0.27.
213
216
  *
214
217
  * The given callback will be invoked for all children, signatures and type parameters
215
218
  * attached to this reflection.
@@ -34,7 +34,8 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
34
34
  return useValue ? value : void 0;
35
35
  };
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.Reflection = exports.TraverseProperty = exports.ReflectionFlags = exports.ReflectionFlag = exports.resetReflectionID = void 0;
37
+ exports.Reflection = exports.TraverseProperty = exports.ReflectionFlags = exports.ReflectionFlag = void 0;
38
+ exports.resetReflectionID = resetReflectionID;
38
39
  const comment_1 = require("../comments/comment");
39
40
  const utils_1 = require("./utils");
40
41
  const kind_1 = require("./kind");
@@ -51,7 +52,6 @@ let REFLECTION_ID = 0;
51
52
  function resetReflectionID() {
52
53
  REFLECTION_ID = 0;
53
54
  }
54
- exports.resetReflectionID = resetReflectionID;
55
55
  var ReflectionFlag;
56
56
  (function (ReflectionFlag) {
57
57
  ReflectionFlag[ReflectionFlag["None"] = 0] = "None";
@@ -221,13 +221,14 @@ ReflectionFlags.serializedFlags = [
221
221
  var TraverseProperty;
222
222
  (function (TraverseProperty) {
223
223
  TraverseProperty[TraverseProperty["Children"] = 0] = "Children";
224
- TraverseProperty[TraverseProperty["Parameters"] = 1] = "Parameters";
225
- TraverseProperty[TraverseProperty["TypeLiteral"] = 2] = "TypeLiteral";
226
- TraverseProperty[TraverseProperty["TypeParameter"] = 3] = "TypeParameter";
227
- TraverseProperty[TraverseProperty["Signatures"] = 4] = "Signatures";
228
- TraverseProperty[TraverseProperty["IndexSignature"] = 5] = "IndexSignature";
229
- TraverseProperty[TraverseProperty["GetSignature"] = 6] = "GetSignature";
230
- TraverseProperty[TraverseProperty["SetSignature"] = 7] = "SetSignature";
224
+ TraverseProperty[TraverseProperty["Documents"] = 1] = "Documents";
225
+ TraverseProperty[TraverseProperty["Parameters"] = 2] = "Parameters";
226
+ TraverseProperty[TraverseProperty["TypeLiteral"] = 3] = "TypeLiteral";
227
+ TraverseProperty[TraverseProperty["TypeParameter"] = 4] = "TypeParameter";
228
+ TraverseProperty[TraverseProperty["Signatures"] = 5] = "Signatures";
229
+ TraverseProperty[TraverseProperty["IndexSignature"] = 6] = "IndexSignature";
230
+ TraverseProperty[TraverseProperty["GetSignature"] = 7] = "GetSignature";
231
+ TraverseProperty[TraverseProperty["SetSignature"] = 8] = "SetSignature";
231
232
  })(TraverseProperty || (exports.TraverseProperty = TraverseProperty = {}));
232
233
  /**
233
234
  * Base class for all reflection classes.
@@ -275,8 +276,10 @@ let Reflection = (() => {
275
276
  * Test whether this reflection is of the given kind.
276
277
  */
277
278
  kindOf(kind) {
278
- const kindArray = Array.isArray(kind) ? kind : [kind];
279
- return kindArray.some((kind) => (this.kind & kind) !== 0);
279
+ const kindFlags = Array.isArray(kind)
280
+ ? kind.reduce((a, b) => a | b, 0)
281
+ : kind;
282
+ return (this.kind & kindFlags) !== 0;
280
283
  }
281
284
  /**
282
285
  * Return the full name of this reflection. Intended for use in debugging. For log messages
@@ -396,6 +399,9 @@ let Reflection = (() => {
396
399
  isDeclaration() {
397
400
  return false;
398
401
  }
402
+ isDocument() {
403
+ return false;
404
+ }
399
405
  /**
400
406
  * Check if this reflection or any of its parents have been marked with the `@deprecated` tag.
401
407
  */
@@ -1,17 +1,37 @@
1
- import { Reflection, TraverseCallback } from "./abstract";
1
+ import { Reflection, type TraverseCallback } from "./abstract";
2
2
  import { ReflectionCategory } from "../ReflectionCategory";
3
3
  import { ReflectionGroup } from "../ReflectionGroup";
4
4
  import type { ReflectionKind } from "./kind";
5
5
  import type { Serializer, JSONOutput, Deserializer } from "../../serialization";
6
+ import type { DocumentReflection } from "./document";
6
7
  import type { DeclarationReflection } from "./declaration";
7
8
  /**
8
9
  * @category Reflections
9
10
  */
10
11
  export declare abstract class ContainerReflection extends Reflection {
11
12
  /**
12
- * The children of this reflection.
13
+ * The children of this reflection. Do not add reflections to this array
14
+ * manually. Instead call {@link addChild}.
13
15
  */
14
- children?: DeclarationReflection[];
16
+ children?: Array<DeclarationReflection>;
17
+ /**
18
+ * Documents associated with this reflection.
19
+ *
20
+ * These are not children as including them as children requires code handle both
21
+ * types, despite being mostly unrelated and handled separately.
22
+ *
23
+ * Including them here in a separate array neatly handles that problem, but also
24
+ * introduces another one for rendering. When rendering, documents should really
25
+ * actually be considered part of the "children" of a reflection. For this reason,
26
+ * we also maintain a list of child declarations with child documents which is used
27
+ * when rendering.
28
+ */
29
+ documents?: Array<DocumentReflection>;
30
+ /**
31
+ * Union of the {@link children} and {@link documents} arrays which dictates the
32
+ * sort order for rendering.
33
+ */
34
+ childrenIncludingDocuments?: Array<DeclarationReflection | DocumentReflection>;
15
35
  /**
16
36
  * All children grouped by their kind.
17
37
  */
@@ -27,6 +47,8 @@ export declare abstract class ContainerReflection extends Reflection {
27
47
  * @returns An array containing all children with the desired kind.
28
48
  */
29
49
  getChildrenByKind(kind: ReflectionKind): DeclarationReflection[];
50
+ addChild(child: DeclarationReflection | DocumentReflection): void;
51
+ removeChild(child: DeclarationReflection | DocumentReflection): void;
30
52
  traverse(callback: TraverseCallback): void;
31
53
  toObject(serializer: Serializer): JSONOutput.ContainerReflection;
32
54
  fromObject(de: Deserializer, obj: JSONOutput.ContainerReflection): void;
@@ -4,6 +4,7 @@ exports.ContainerReflection = void 0;
4
4
  const abstract_1 = require("./abstract");
5
5
  const ReflectionCategory_1 = require("../ReflectionCategory");
6
6
  const ReflectionGroup_1 = require("../ReflectionGroup");
7
+ const utils_1 = require("../../utils");
7
8
  /**
8
9
  * @category Reflections
9
10
  */
@@ -17,17 +18,58 @@ class ContainerReflection extends abstract_1.Reflection {
17
18
  getChildrenByKind(kind) {
18
19
  return (this.children || []).filter((child) => child.kindOf(kind));
19
20
  }
21
+ addChild(child) {
22
+ if (child.isDeclaration()) {
23
+ this.children ||= [];
24
+ this.children.push(child);
25
+ }
26
+ else {
27
+ this.documents ||= [];
28
+ this.documents.push(child);
29
+ }
30
+ this.childrenIncludingDocuments ||= [];
31
+ this.childrenIncludingDocuments.push(child);
32
+ }
33
+ removeChild(child) {
34
+ if (child.isDeclaration()) {
35
+ (0, utils_1.removeIfPresent)(this.children, child);
36
+ if (this.children?.length === 0) {
37
+ delete this.children;
38
+ }
39
+ }
40
+ else {
41
+ (0, utils_1.removeIfPresent)(this.documents, child);
42
+ if (this.documents?.length === 0) {
43
+ delete this.documents;
44
+ }
45
+ }
46
+ (0, utils_1.removeIfPresent)(this.childrenIncludingDocuments, child);
47
+ if (this.childrenIncludingDocuments?.length === 0) {
48
+ delete this.childrenIncludingDocuments;
49
+ }
50
+ }
20
51
  traverse(callback) {
21
52
  for (const child of this.children?.slice() || []) {
22
53
  if (callback(child, abstract_1.TraverseProperty.Children) === false) {
23
54
  return;
24
55
  }
25
56
  }
57
+ for (const child of this.documents?.slice() || []) {
58
+ if (callback(child, abstract_1.TraverseProperty.Documents) === false) {
59
+ return;
60
+ }
61
+ }
26
62
  }
27
63
  toObject(serializer) {
28
64
  return {
29
65
  ...super.toObject(serializer),
30
66
  children: serializer.toObjectsOptional(this.children),
67
+ documents: serializer.toObjectsOptional(this.documents),
68
+ // If we only have one type of child, don't bother writing the duplicate info about
69
+ // ordering with documents to the serialized file.
70
+ childrenIncludingDocuments: this.children?.length && this.documents?.length
71
+ ? this.childrenIncludingDocuments?.map((refl) => refl.id)
72
+ : undefined,
31
73
  groups: serializer.toObjectsOptional(this.groups),
32
74
  categories: serializer.toObjectsOptional(this.categories),
33
75
  };
@@ -35,6 +77,28 @@ class ContainerReflection extends abstract_1.Reflection {
35
77
  fromObject(de, obj) {
36
78
  super.fromObject(de, obj);
37
79
  this.children = de.reviveMany(obj.children, (child) => de.constructReflection(child));
80
+ this.documents = de.reviveMany(obj.documents, (child) => de.constructReflection(child));
81
+ const byId = new Map();
82
+ for (const child of this.children || []) {
83
+ byId.set(child.id, child);
84
+ }
85
+ for (const child of this.documents || []) {
86
+ byId.set(child.id, child);
87
+ }
88
+ for (const id of obj.childrenIncludingDocuments || []) {
89
+ const child = byId.get(de.oldIdToNewId[id] ?? -1);
90
+ if (child) {
91
+ this.childrenIncludingDocuments ||= [];
92
+ this.childrenIncludingDocuments.push(child);
93
+ byId.delete(de.oldIdToNewId[id] ?? -1);
94
+ }
95
+ }
96
+ if (byId.size) {
97
+ // Anything left in byId wasn't included in the childrenIncludingDocuments array.
98
+ // This is expected if we're dealing with a JSON file produced by TypeDoc 0.25.
99
+ this.childrenIncludingDocuments ||= [];
100
+ this.childrenIncludingDocuments.push(...byId.values());
101
+ }
38
102
  this.groups = de.reviveMany(obj.groups, (group) => new ReflectionGroup_1.ReflectionGroup(group.title, this));
39
103
  this.categories = de.reviveMany(obj.categories, (cat) => new ReflectionCategory_1.ReflectionCategory(cat.title));
40
104
  }
@@ -1,11 +1,11 @@
1
1
  import type * as ts from "typescript";
2
- import { ReferenceType, Type, type SomeType } from "../types";
2
+ import { type ReferenceType, type Type, type SomeType } from "../types";
3
3
  import { type TraverseCallback } from "./abstract";
4
4
  import { ContainerReflection } from "./container";
5
5
  import type { SignatureReflection } from "./signature";
6
6
  import type { TypeParameterReflection } from "./type-parameter";
7
7
  import type { Serializer, JSONOutput, Deserializer } from "../../serialization";
8
- import { CommentDisplayPart } from "../comments";
8
+ import { type CommentDisplayPart } from "../comments";
9
9
  import { SourceReference } from "../sources/file";
10
10
  /**
11
11
  * Stores hierarchical type data.
@@ -26,13 +26,6 @@ export interface DeclarationHierarchy {
26
26
  */
27
27
  isTarget?: boolean;
28
28
  }
29
- /**
30
- * @internal
31
- */
32
- export declare enum ConversionFlags {
33
- None = 0,
34
- VariableOrPropertySource = 1
35
- }
36
29
  /**
37
30
  * A reflection that represents a single declaration emitted by the TypeScript compiler.
38
31
  *
@@ -77,7 +70,7 @@ export declare class DeclarationReflection extends ContainerReflection {
77
70
  /**
78
71
  * The index signature of this declaration.
79
72
  */
80
- indexSignature?: SignatureReflection;
73
+ indexSignatures?: SignatureReflection[];
81
74
  /**
82
75
  * The get signature of this declaration.
83
76
  */
@@ -139,11 +132,6 @@ export declare class DeclarationReflection extends ContainerReflection {
139
132
  * The version of the module when found.
140
133
  */
141
134
  packageVersion?: string;
142
- /**
143
- * Flags for information about a reflection which is needed solely during conversion.
144
- * @internal
145
- */
146
- conversionFlags: ConversionFlags;
147
135
  isDeclaration(): this is DeclarationReflection;
148
136
  hasGetterOrSetter(): boolean;
149
137
  getAllSignatures(): SignatureReflection[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DeclarationReflection = exports.ConversionFlags = void 0;
3
+ exports.DeclarationReflection = void 0;
4
4
  const types_1 = require("../types");
5
5
  const abstract_1 = require("./abstract");
6
6
  const container_1 = require("./container");
@@ -8,14 +8,6 @@ const comments_1 = require("../comments");
8
8
  const file_1 = require("../sources/file");
9
9
  const ReflectionSymbolId_1 = require("./ReflectionSymbolId");
10
10
  const kind_1 = require("./kind");
11
- /**
12
- * @internal
13
- */
14
- var ConversionFlags;
15
- (function (ConversionFlags) {
16
- ConversionFlags[ConversionFlags["None"] = 0] = "None";
17
- ConversionFlags[ConversionFlags["VariableOrPropertySource"] = 1] = "VariableOrPropertySource";
18
- })(ConversionFlags || (exports.ConversionFlags = ConversionFlags = {}));
19
11
  /**
20
12
  * A reflection that represents a single declaration emitted by the TypeScript compiler.
21
13
  *
@@ -27,11 +19,6 @@ class DeclarationReflection extends container_1.ContainerReflection {
27
19
  constructor() {
28
20
  super(...arguments);
29
21
  this.variant = "declaration";
30
- /**
31
- * Flags for information about a reflection which is needed solely during conversion.
32
- * @internal
33
- */
34
- this.conversionFlags = ConversionFlags.None;
35
22
  }
36
23
  isDeclaration() {
37
24
  return true;
@@ -44,8 +31,8 @@ class DeclarationReflection extends container_1.ContainerReflection {
44
31
  if (this.signatures) {
45
32
  result = result.concat(this.signatures);
46
33
  }
47
- if (this.indexSignature) {
48
- result.push(this.indexSignature);
34
+ if (this.indexSignatures) {
35
+ result = result.concat(this.indexSignatures);
49
36
  }
50
37
  if (this.getSignature) {
51
38
  result.push(this.getSignature);
@@ -75,8 +62,8 @@ class DeclarationReflection extends container_1.ContainerReflection {
75
62
  return;
76
63
  }
77
64
  }
78
- if (this.indexSignature) {
79
- if (callback(this.indexSignature, abstract_1.TraverseProperty.IndexSignature) === false) {
65
+ for (const signature of this.indexSignatures?.slice() || []) {
66
+ if (callback(signature, abstract_1.TraverseProperty.IndexSignature) === false) {
80
67
  return;
81
68
  }
82
69
  }
@@ -118,7 +105,7 @@ class DeclarationReflection extends container_1.ContainerReflection {
118
105
  typeParameters: serializer.toObjectsOptional(this.typeParameters),
119
106
  type: serializer.toObject(this.type),
120
107
  signatures: serializer.toObjectsOptional(this.signatures),
121
- indexSignature: serializer.toObject(this.indexSignature),
108
+ indexSignatures: serializer.toObjectsOptional(this.indexSignatures),
122
109
  getSignature: serializer.toObject(this.getSignature),
123
110
  setSignature: serializer.toObject(this.setSignature),
124
111
  defaultValue: this.defaultValue,
@@ -149,7 +136,7 @@ class DeclarationReflection extends container_1.ContainerReflection {
149
136
  this.project.registerSymbolId(refl, new ReflectionSymbolId_1.ReflectionSymbolId(sid));
150
137
  }
151
138
  else {
152
- de.logger.warn(`Serialized project contained a reflection with id ${id} but it was not present in deserialized project.`);
139
+ de.logger.warn(de.application.i18n.serialized_project_referenced_0_not_part_of_project(id.toString()));
153
140
  }
154
141
  }
155
142
  });
@@ -161,7 +148,15 @@ class DeclarationReflection extends container_1.ContainerReflection {
161
148
  this.typeParameters = de.reviveMany(obj.typeParameters, (tp) => de.constructReflection(tp));
162
149
  this.type = de.revive(obj.type, (t) => de.constructType(t));
163
150
  this.signatures = de.reviveMany(obj.signatures, (r) => de.constructReflection(r));
164
- this.indexSignature = de.revive(obj.indexSignature, (r) => de.constructReflection(r));
151
+ // TypeDoc 0.25, remove check with 0.28.
152
+ if (obj.indexSignature) {
153
+ this.indexSignatures = [
154
+ de.revive(obj.indexSignature, (r) => de.constructReflection(r)),
155
+ ];
156
+ }
157
+ else {
158
+ this.indexSignatures = de.reviveMany(obj.indexSignatures, (r) => de.constructReflection(r));
159
+ }
165
160
  this.getSignature = de.revive(obj.getSignature, (r) => de.constructReflection(r));
166
161
  this.setSignature = de.revive(obj.setSignature, (r) => de.constructReflection(r));
167
162
  this.defaultValue = obj.defaultValue;
@@ -0,0 +1,27 @@
1
+ import type { Deserializer, JSONOutput, Serializer } from "../../serialization";
2
+ import { type CommentDisplayPart } from "../comments";
3
+ import { Reflection, type TraverseCallback } from "./abstract";
4
+ /**
5
+ * Non-TS reflection type which is used to represent markdown documents included in the docs.
6
+ */
7
+ export declare class DocumentReflection extends Reflection {
8
+ readonly variant = "document";
9
+ /**
10
+ * The content to be displayed on the page for this reflection.
11
+ */
12
+ content: CommentDisplayPart[];
13
+ /**
14
+ * Frontmatter included in document
15
+ */
16
+ frontmatter: Record<string, unknown>;
17
+ /**
18
+ * A precomputed boost derived from the searchCategoryBoosts and searchGroupBoosts options, used when
19
+ * boosting search relevance scores at runtime. May be modified by plugins.
20
+ */
21
+ relevanceBoost?: number;
22
+ constructor(name: string, parent: Reflection, content: CommentDisplayPart[], frontmatter: Record<string, unknown>);
23
+ isDocument(): this is DocumentReflection;
24
+ traverse(_callback: TraverseCallback): void;
25
+ toObject(serializer: Serializer): JSONOutput.DocumentReflection;
26
+ fromObject(de: Deserializer, obj: JSONOutput.DocumentReflection): void;
27
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DocumentReflection = void 0;
4
+ const comments_1 = require("../comments");
5
+ const abstract_1 = require("./abstract");
6
+ const kind_1 = require("./kind");
7
+ /**
8
+ * Non-TS reflection type which is used to represent markdown documents included in the docs.
9
+ */
10
+ class DocumentReflection extends abstract_1.Reflection {
11
+ constructor(name, parent, content, frontmatter) {
12
+ super(name, kind_1.ReflectionKind.Document, parent);
13
+ this.variant = "document";
14
+ this.content = content;
15
+ this.frontmatter = frontmatter;
16
+ if (typeof frontmatter["title"] === "string") {
17
+ this.name = frontmatter["title"];
18
+ delete frontmatter["title"];
19
+ }
20
+ }
21
+ isDocument() {
22
+ return true;
23
+ }
24
+ traverse(_callback) {
25
+ // Nothing to do here, we have no children.
26
+ }
27
+ toObject(serializer) {
28
+ return {
29
+ ...super.toObject(serializer),
30
+ variant: this.variant,
31
+ content: comments_1.Comment.serializeDisplayParts(serializer, this.content),
32
+ frontmatter: this.frontmatter,
33
+ relevanceBoost: this.relevanceBoost,
34
+ };
35
+ }
36
+ fromObject(de, obj) {
37
+ super.fromObject(de, obj);
38
+ this.content = comments_1.Comment.deserializeDisplayParts(de, obj.content);
39
+ this.frontmatter = obj.frontmatter;
40
+ this.relevanceBoost = obj.relevanceBoost;
41
+ }
42
+ }
43
+ exports.DocumentReflection = DocumentReflection;
@@ -1,14 +1,15 @@
1
1
  export { Reflection, ReflectionFlag, ReflectionFlags, TraverseProperty, } from "./abstract";
2
- export type { TraverseCallback, ReflectionVisitor } from "./abstract";
2
+ export type { ReflectionVisitor, TraverseCallback } from "./abstract";
3
3
  export { ContainerReflection } from "./container";
4
- export { DeclarationReflection, ConversionFlags } from "./declaration";
4
+ export { DeclarationReflection } from "./declaration";
5
5
  export type { DeclarationHierarchy } from "./declaration";
6
+ export { DocumentReflection } from "./document";
6
7
  export { ReflectionKind } from "./kind";
7
8
  export { ParameterReflection } from "./parameter";
8
9
  export { ProjectReflection } from "./project";
9
10
  export { ReferenceReflection } from "./reference";
11
+ export { ReflectionSymbolId, type ReflectionSymbolIdString, } from "./ReflectionSymbolId";
10
12
  export { SignatureReflection } from "./signature";
11
13
  export { TypeParameterReflection, VarianceModifier } from "./type-parameter";
12
14
  export { splitUnquotedString } from "./utils";
13
15
  export type { ReflectionVariant } from "./variant";
14
- export { ReflectionSymbolId, type ReflectionSymbolIdString, } from "./ReflectionSymbolId";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ReflectionSymbolId = exports.splitUnquotedString = exports.VarianceModifier = exports.TypeParameterReflection = exports.SignatureReflection = exports.ReferenceReflection = exports.ProjectReflection = exports.ParameterReflection = exports.ReflectionKind = exports.ConversionFlags = exports.DeclarationReflection = exports.ContainerReflection = exports.TraverseProperty = exports.ReflectionFlags = exports.ReflectionFlag = exports.Reflection = void 0;
3
+ exports.splitUnquotedString = exports.VarianceModifier = exports.TypeParameterReflection = exports.SignatureReflection = exports.ReflectionSymbolId = exports.ReferenceReflection = exports.ProjectReflection = exports.ParameterReflection = exports.ReflectionKind = exports.DocumentReflection = exports.DeclarationReflection = exports.ContainerReflection = exports.TraverseProperty = exports.ReflectionFlags = exports.ReflectionFlag = exports.Reflection = void 0;
4
4
  var abstract_1 = require("./abstract");
5
5
  Object.defineProperty(exports, "Reflection", { enumerable: true, get: function () { return abstract_1.Reflection; } });
6
6
  Object.defineProperty(exports, "ReflectionFlag", { enumerable: true, get: function () { return abstract_1.ReflectionFlag; } });
@@ -10,7 +10,8 @@ var container_1 = require("./container");
10
10
  Object.defineProperty(exports, "ContainerReflection", { enumerable: true, get: function () { return container_1.ContainerReflection; } });
11
11
  var declaration_1 = require("./declaration");
12
12
  Object.defineProperty(exports, "DeclarationReflection", { enumerable: true, get: function () { return declaration_1.DeclarationReflection; } });
13
- Object.defineProperty(exports, "ConversionFlags", { enumerable: true, get: function () { return declaration_1.ConversionFlags; } });
13
+ var document_1 = require("./document");
14
+ Object.defineProperty(exports, "DocumentReflection", { enumerable: true, get: function () { return document_1.DocumentReflection; } });
14
15
  var kind_1 = require("./kind");
15
16
  Object.defineProperty(exports, "ReflectionKind", { enumerable: true, get: function () { return kind_1.ReflectionKind; } });
16
17
  var parameter_1 = require("./parameter");
@@ -19,6 +20,8 @@ var project_1 = require("./project");
19
20
  Object.defineProperty(exports, "ProjectReflection", { enumerable: true, get: function () { return project_1.ProjectReflection; } });
20
21
  var reference_1 = require("./reference");
21
22
  Object.defineProperty(exports, "ReferenceReflection", { enumerable: true, get: function () { return reference_1.ReferenceReflection; } });
23
+ var ReflectionSymbolId_1 = require("./ReflectionSymbolId");
24
+ Object.defineProperty(exports, "ReflectionSymbolId", { enumerable: true, get: function () { return ReflectionSymbolId_1.ReflectionSymbolId; } });
22
25
  var signature_1 = require("./signature");
23
26
  Object.defineProperty(exports, "SignatureReflection", { enumerable: true, get: function () { return signature_1.SignatureReflection; } });
24
27
  var type_parameter_1 = require("./type-parameter");
@@ -26,5 +29,3 @@ Object.defineProperty(exports, "TypeParameterReflection", { enumerable: true, ge
26
29
  Object.defineProperty(exports, "VarianceModifier", { enumerable: true, get: function () { return type_parameter_1.VarianceModifier; } });
27
30
  var utils_1 = require("./utils");
28
31
  Object.defineProperty(exports, "splitUnquotedString", { enumerable: true, get: function () { return utils_1.splitUnquotedString; } });
29
- var ReflectionSymbolId_1 = require("./ReflectionSymbolId");
30
- Object.defineProperty(exports, "ReflectionSymbolId", { enumerable: true, get: function () { return ReflectionSymbolId_1.ReflectionSymbolId; } });
@@ -26,7 +26,11 @@ export declare enum ReflectionKind {
26
26
  GetSignature = 524288,
27
27
  SetSignature = 1048576,
28
28
  TypeAlias = 2097152,
29
- Reference = 4194304
29
+ Reference = 4194304,
30
+ /**
31
+ * Generic non-ts content to be included in the generated docs as its own page.
32
+ */
33
+ Document = 8388608
30
34
  }
31
35
  /** @category Reflections */
32
36
  export declare namespace ReflectionKind {
@@ -52,6 +56,7 @@ export declare namespace ReflectionKind {
52
56
  const SomeMember: number;
53
57
  /** @internal */
54
58
  const SomeExport: number;
59
+ const MayContainDocuments: number;
55
60
  /** @internal */
56
61
  const ExportContainer: number;
57
62
  /** @internal */
@@ -67,9 +72,17 @@ export declare namespace ReflectionKind {
67
72
  * @internal
68
73
  */
69
74
  const SignatureContainer: number;
75
+ /** @internal */
70
76
  const VariableContainer: number;
77
+ /** @internal */
71
78
  const MethodContainer: number;
79
+ /**
80
+ * Get a non-localized kind string. For the localized string, use `app.internationalization.kindSingularString(kind)`
81
+ */
72
82
  function singularString(kind: ReflectionKind): string;
83
+ /**
84
+ * Get a non-localized kind string. For the localized string, use `app.internationalization.kindPluralString(kind)`
85
+ */
73
86
  function pluralString(kind: ReflectionKind): string;
74
87
  function classString(kind: ReflectionKind): string;
75
88
  }
@@ -30,6 +30,10 @@ var ReflectionKind;
30
30
  ReflectionKind[ReflectionKind["SetSignature"] = 1048576] = "SetSignature";
31
31
  ReflectionKind[ReflectionKind["TypeAlias"] = 2097152] = "TypeAlias";
32
32
  ReflectionKind[ReflectionKind["Reference"] = 4194304] = "Reference";
33
+ /**
34
+ * Generic non-ts content to be included in the generated docs as its own page.
35
+ */
36
+ ReflectionKind[ReflectionKind["Document"] = 8388608] = "Document";
33
37
  })(ReflectionKind || (exports.ReflectionKind = ReflectionKind = {}));
34
38
  /** @category Reflections */
35
39
  (function (ReflectionKind) {
@@ -75,6 +79,7 @@ var ReflectionKind;
75
79
  ReflectionKind.Interface |
76
80
  ReflectionKind.TypeAlias |
77
81
  ReflectionKind.Reference;
82
+ ReflectionKind.MayContainDocuments = ReflectionKind.SomeExport | ReflectionKind.Project;
78
83
  /** @internal */
79
84
  ReflectionKind.ExportContainer = ReflectionKind.SomeModule | ReflectionKind.Project;
80
85
  /** @internal */
@@ -104,7 +109,9 @@ var ReflectionKind;
104
109
  * @internal
105
110
  */
106
111
  ReflectionKind.SignatureContainer = ReflectionKind.ContainsCallSignatures | ReflectionKind.Accessor;
112
+ /** @internal */
107
113
  ReflectionKind.VariableContainer = ReflectionKind.SomeModule | ReflectionKind.Project;
114
+ /** @internal */
108
115
  ReflectionKind.MethodContainer = ReflectionKind.ClassOrInterface |
109
116
  ReflectionKind.VariableOrProperty |
110
117
  ReflectionKind.FunctionOrMethod |
@@ -120,6 +127,9 @@ var ReflectionKind;
120
127
  [ReflectionKind.EnumMember]: "Enumeration Members",
121
128
  [ReflectionKind.TypeAlias]: "Type Aliases",
122
129
  };
130
+ /**
131
+ * Get a non-localized kind string. For the localized string, use `app.internationalization.kindSingularString(kind)`
132
+ */
123
133
  function singularString(kind) {
124
134
  if (kind in SINGULARS) {
125
135
  return SINGULARS[kind];
@@ -129,6 +139,9 @@ var ReflectionKind;
129
139
  }
130
140
  }
131
141
  ReflectionKind.singularString = singularString;
142
+ /**
143
+ * Get a non-localized kind string. For the localized string, use `app.internationalization.kindPluralString(kind)`
144
+ */
132
145
  function pluralString(kind) {
133
146
  if (kind in PLURALS) {
134
147
  return PLURALS[kind];
@@ -1,5 +1,5 @@
1
1
  import type { SomeType } from "..";
2
- import { Reflection, TraverseCallback } from "./abstract";
2
+ import { Reflection, type TraverseCallback } from "./abstract";
3
3
  import type { SignatureReflection } from "./signature";
4
4
  import type { Serializer, JSONOutput, Deserializer } from "../../serialization";
5
5
  /**
@@ -1,8 +1,8 @@
1
- import { Reflection } from "./abstract";
1
+ import { type Reflection } from "./abstract";
2
2
  import { ContainerReflection } from "./container";
3
3
  import type * as ts from "typescript";
4
4
  import { ReflectionKind } from "./kind";
5
- import { CommentDisplayPart } from "../comments";
5
+ import { type CommentDisplayPart } from "../comments";
6
6
  import { ReflectionSymbolId } from "./ReflectionSymbolId";
7
7
  import type { Serializer } from "../../serialization/serializer";
8
8
  import type { Deserializer, JSONOutput } from "../../serialization/index";