typedoc 0.25.7 → 0.25.9

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 (51) hide show
  1. package/dist/index.d.ts +7 -0
  2. package/dist/index.js +7 -0
  3. package/dist/lib/converter/comments/discovery.d.ts +1 -0
  4. package/dist/lib/converter/comments/discovery.js +19 -1
  5. package/dist/lib/converter/comments/index.d.ts +1 -0
  6. package/dist/lib/converter/comments/index.js +5 -1
  7. package/dist/lib/converter/context.d.ts +1 -0
  8. package/dist/lib/converter/context.js +3 -0
  9. package/dist/lib/converter/converter.d.ts +2 -0
  10. package/dist/lib/converter/converter.js +11 -2
  11. package/dist/lib/converter/factories/signature.d.ts +5 -1
  12. package/dist/lib/converter/factories/signature.js +25 -1
  13. package/dist/lib/converter/plugins/CategoryPlugin.js +19 -3
  14. package/dist/lib/converter/plugins/GroupPlugin.d.ts +2 -2
  15. package/dist/lib/converter/plugins/GroupPlugin.js +18 -2
  16. package/dist/lib/converter/plugins/LinkResolverPlugin.d.ts +1 -0
  17. package/dist/lib/converter/plugins/LinkResolverPlugin.js +24 -0
  18. package/dist/lib/converter/symbols.js +57 -4
  19. package/dist/lib/converter/types.js +24 -2
  20. package/dist/lib/models/ReflectionCategory.d.ts +6 -2
  21. package/dist/lib/models/ReflectionCategory.js +8 -1
  22. package/dist/lib/models/ReflectionGroup.d.ts +5 -1
  23. package/dist/lib/models/ReflectionGroup.js +7 -0
  24. package/dist/lib/models/comments/comment.d.ts +10 -1
  25. package/dist/lib/models/comments/comment.js +45 -0
  26. package/dist/lib/models/reflections/abstract.d.ts +1 -1
  27. package/dist/lib/models/reflections/abstract.js +6 -7
  28. package/dist/lib/models/reflections/declaration.js +4 -3
  29. package/dist/lib/models/reflections/project.js +5 -5
  30. package/dist/lib/output/plugins/SitemapPlugin.d.ts +7 -0
  31. package/dist/lib/output/plugins/SitemapPlugin.js +152 -0
  32. package/dist/lib/output/plugins/index.d.ts +1 -0
  33. package/dist/lib/output/plugins/index.js +3 -1
  34. package/dist/lib/output/themes/default/DefaultTheme.js +1 -13
  35. package/dist/lib/output/themes/default/partials/index.js +3 -1
  36. package/dist/lib/output/themes/default/partials/member.signature.body.js +1 -1
  37. package/dist/lib/output/themes/default/partials/typeParameters.js +1 -1
  38. package/dist/lib/output/themes/default/templates/hierarchy.d.ts +1 -1
  39. package/dist/lib/output/themes/default/templates/hierarchy.js +8 -9
  40. package/dist/lib/output/themes/lib.d.ts +2 -1
  41. package/dist/lib/output/themes/lib.js +24 -1
  42. package/dist/lib/serialization/schema.d.ts +3 -3
  43. package/dist/lib/utils/entry-point.js +1 -1
  44. package/dist/lib/utils/events.js +1 -0
  45. package/dist/lib/utils/options/declaration.d.ts +2 -0
  46. package/dist/lib/utils/options/sources/typedoc.js +15 -0
  47. package/dist/lib/utils/options/tsdoc-defaults.d.ts +2 -2
  48. package/dist/lib/utils/options/tsdoc-defaults.js +4 -1
  49. package/package.json +3 -3
  50. package/static/main.js +4 -4
  51. package/tsdoc.json +14 -0
@@ -1,5 +1,5 @@
1
1
  import { ReflectionCategory } from "./ReflectionCategory";
2
- import type { DeclarationReflection, Reflection } from ".";
2
+ import type { CommentDisplayPart, DeclarationReflection, Reflection } from ".";
3
3
  import type { Serializer, JSONOutput, Deserializer } from "../serialization";
4
4
  /**
5
5
  * A group of reflections. All reflections in a group are of the same kind.
@@ -14,6 +14,10 @@ export declare class ReflectionGroup {
14
14
  * The title, a string representation of the typescript kind, of this group.
15
15
  */
16
16
  title: string;
17
+ /**
18
+ * User specified description via `@groupDescription`, if specified.
19
+ */
20
+ description?: CommentDisplayPart[];
17
21
  /**
18
22
  * All reflections of this group.
19
23
  */
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ReflectionGroup = void 0;
4
4
  const ReflectionCategory_1 = require("./ReflectionCategory");
5
+ const comments_1 = require("./comments");
5
6
  /**
6
7
  * A group of reflections. All reflections in a group are of the same kind.
7
8
  *
@@ -33,6 +34,9 @@ class ReflectionGroup {
33
34
  toObject(serializer) {
34
35
  return {
35
36
  title: this.title,
37
+ description: this.description
38
+ ? comments_1.Comment.serializeDisplayParts(serializer, this.description)
39
+ : undefined,
36
40
  children: this.children.length > 0
37
41
  ? this.children.map((child) => child.id)
38
42
  : undefined,
@@ -40,6 +44,9 @@ class ReflectionGroup {
40
44
  };
41
45
  }
42
46
  fromObject(de, obj) {
47
+ if (obj.description) {
48
+ this.description = comments_1.Comment.deserializeDisplayParts(de, obj.description);
49
+ }
43
50
  if (obj.categories) {
44
51
  this.categories = obj.categories.map((catObj) => {
45
52
  const cat = new ReflectionCategory_1.ReflectionCategory(catObj.title);
@@ -76,7 +76,7 @@ export declare class Comment {
76
76
  /**
77
77
  * Helper utility to clone {@link Comment.summary} or {@link CommentTag.content}
78
78
  */
79
- static cloneDisplayParts(parts: CommentDisplayPart[]): ({
79
+ static cloneDisplayParts(parts: readonly CommentDisplayPart[]): ({
80
80
  kind: "text";
81
81
  text: string;
82
82
  } | {
@@ -93,6 +93,15 @@ export declare class Comment {
93
93
  /** @hidden no point in showing this signature in api docs */
94
94
  static serializeDisplayParts(serializer: Serializer, parts: CommentDisplayPart[] | undefined): JSONOutput.CommentDisplayPart[] | undefined;
95
95
  static deserializeDisplayParts(de: Deserializer, parts: JSONOutput.CommentDisplayPart[]): CommentDisplayPart[];
96
+ /**
97
+ * Splits the provided parts into a header (first line, as a string)
98
+ * and body (remaining lines). If the header line contains inline tags
99
+ * they will be serialized to a string.
100
+ */
101
+ static splitPartsToHeaderAndBody(parts: readonly CommentDisplayPart[]): {
102
+ header: string;
103
+ body: CommentDisplayPart[];
104
+ };
96
105
  /**
97
106
  * The content of the comment which is not associated with a block tag.
98
107
  */
@@ -218,6 +218,51 @@ class Comment {
218
218
  }
219
219
  return result;
220
220
  }
221
+ /**
222
+ * Splits the provided parts into a header (first line, as a string)
223
+ * and body (remaining lines). If the header line contains inline tags
224
+ * they will be serialized to a string.
225
+ */
226
+ static splitPartsToHeaderAndBody(parts) {
227
+ let index = parts.findIndex((part) => {
228
+ switch (part.kind) {
229
+ case "text":
230
+ case "code":
231
+ return part.text.includes("\n");
232
+ case "inline-tag":
233
+ return false;
234
+ }
235
+ });
236
+ if (index === -1) {
237
+ return {
238
+ header: Comment.combineDisplayParts(parts),
239
+ body: [],
240
+ };
241
+ }
242
+ // Do not split a code block, stop the header at the end of the previous block
243
+ if (parts[index].kind === "code") {
244
+ --index;
245
+ }
246
+ if (index === -1) {
247
+ return { header: "", body: Comment.cloneDisplayParts(parts) };
248
+ }
249
+ let header = Comment.combineDisplayParts(parts.slice(0, index));
250
+ const split = parts[index].text.indexOf("\n");
251
+ let body;
252
+ if (split === -1) {
253
+ header += parts[index].text;
254
+ body = Comment.cloneDisplayParts(parts.slice(index + 1));
255
+ }
256
+ else {
257
+ header += parts[index].text.substring(0, split);
258
+ body = Comment.cloneDisplayParts(parts.slice(index));
259
+ body[0].text = body[0].text.substring(split + 1);
260
+ }
261
+ if (!body[0].text) {
262
+ body.shift();
263
+ }
264
+ return { header: header.trim(), body };
265
+ }
221
266
  /**
222
267
  * Creates a new Comment instance.
223
268
  */
@@ -127,7 +127,7 @@ export declare abstract class Reflection {
127
127
  * The reflection this reflection is a child of.
128
128
  */
129
129
  parent?: Reflection;
130
- get project(): ProjectReflection;
130
+ project: ProjectReflection;
131
131
  /**
132
132
  * The parsed documentation comment attached to this reflection.
133
133
  */
@@ -35,7 +35,6 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn,
35
35
  };
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
37
  exports.Reflection = exports.TraverseProperty = exports.ReflectionFlags = exports.ReflectionFlag = exports.resetReflectionID = void 0;
38
- const assert_1 = require("assert");
39
38
  const comment_1 = require("../comments/comment");
40
39
  const utils_1 = require("./utils");
41
40
  const kind_1 = require("./kind");
@@ -247,13 +246,9 @@ let Reflection = (() => {
247
246
  let _instanceExtraInitializers = [];
248
247
  let _parent_decorators;
249
248
  let _parent_initializers = [];
249
+ let _project_decorators;
250
+ let _project_initializers = [];
250
251
  return _a = class Reflection {
251
- get project() {
252
- if (this.isProject())
253
- return this;
254
- (0, assert_1.ok)(this.parent, "Tried to get the project on a reflection not in a project");
255
- return this.parent.project;
256
- }
257
252
  constructor(name, kind, parent) {
258
253
  /**
259
254
  * Unique id of this reflection.
@@ -264,8 +259,10 @@ let Reflection = (() => {
264
259
  * The reflection this reflection is a child of.
265
260
  */
266
261
  this.parent = __runInitializers(this, _parent_initializers, void 0);
262
+ this.project = __runInitializers(this, _project_initializers, void 0);
267
263
  this.id = REFLECTION_ID++;
268
264
  this.parent = parent;
265
+ this.project = parent?.project || this;
269
266
  this.name = name;
270
267
  this.kind = kind;
271
268
  // If our parent is external, we are too.
@@ -471,7 +468,9 @@ let Reflection = (() => {
471
468
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
472
469
  _parent_decorators = [general_1.NonEnumerable // So that it doesn't show up in console.log
473
470
  ];
471
+ _project_decorators = [general_1.NonEnumerable];
474
472
  __esDecorate(null, null, _parent_decorators, { kind: "field", name: "parent", static: false, private: false, access: { has: obj => "parent" in obj, get: obj => obj.parent, set: (obj, value) => { obj.parent = value; } }, metadata: _metadata }, _parent_initializers, _instanceExtraInitializers);
473
+ __esDecorate(null, null, _project_decorators, { kind: "field", name: "project", static: false, private: false, access: { has: obj => "project" in obj, get: obj => obj.project, set: (obj, value) => { obj.project = value; } }, metadata: _metadata }, _project_initializers, _instanceExtraInitializers);
475
474
  if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
476
475
  })(),
477
476
  _a;
@@ -129,18 +129,19 @@ class DeclarationReflection extends container_1.ContainerReflection {
129
129
  extendedBy: serializer.toObjectsOptional(this.extendedBy),
130
130
  implementedTypes: serializer.toObjectsOptional(this.implementedTypes),
131
131
  implementedBy: serializer.toObjectsOptional(this.implementedBy),
132
+ readme: comments_1.Comment.serializeDisplayParts(serializer, this.readme),
132
133
  };
133
134
  }
134
135
  fromObject(de, obj) {
135
136
  super.fromObject(de, obj);
137
+ if (obj.readme) {
138
+ this.readme = comments_1.Comment.deserializeDisplayParts(de, obj.readme);
139
+ }
136
140
  // This happens when merging multiple projects together.
137
141
  // If updating this, also check ProjectReflection.fromObject.
138
142
  if (obj.variant === "project") {
139
143
  this.kind = kind_1.ReflectionKind.Module;
140
144
  this.packageVersion = obj.packageVersion;
141
- if (obj.readme) {
142
- this.readme = comments_1.Comment.deserializeDisplayParts(de, obj.readme);
143
- }
144
145
  de.defer(() => {
145
146
  for (const [id, sid] of Object.entries(obj.symbolIdMap || {})) {
146
147
  const refl = this.project.getReflectionById(de.oldIdToNewId[+id] ?? -1);
@@ -172,17 +172,17 @@ class ProjectReflection extends container_1.ContainerReflection {
172
172
  }
173
173
  this.reflectionChildren.delete(reflection.id);
174
174
  // Remove references from the TS symbol to this reflection.
175
- const symbol = this.reflectionIdToSymbolMap.get(reflection.id);
176
- if (symbol) {
177
- const id = new ReflectionSymbolId_1.ReflectionSymbolId(symbol);
178
- const saved = this.symbolToReflectionIdMap.get(id);
175
+ const symbolId = this.reflectionIdToSymbolIdMap.get(reflection.id);
176
+ if (symbolId) {
177
+ const saved = this.symbolToReflectionIdMap.get(symbolId);
179
178
  if (saved === reflection.id) {
180
- this.symbolToReflectionIdMap.delete(id);
179
+ this.symbolToReflectionIdMap.delete(symbolId);
181
180
  }
182
181
  else if (typeof saved === "object") {
183
182
  (0, utils_1.removeIfPresent)(saved, reflection.id);
184
183
  }
185
184
  }
185
+ this.reflectionIdToSymbolMap.delete(reflection.id);
186
186
  this.reflectionIdToSymbolIdMap.delete(reflection.id);
187
187
  delete this.reflections[reflection.id];
188
188
  }
@@ -0,0 +1,7 @@
1
+ import { RendererComponent } from "../components";
2
+ export declare class SitemapPlugin extends RendererComponent {
3
+ accessor sitemapBaseUrl: string;
4
+ initialize(): void;
5
+ private onRendererBegin;
6
+ private buildSitemap;
7
+ }
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
7
+ var _, done = false;
8
+ for (var i = decorators.length - 1; i >= 0; i--) {
9
+ var context = {};
10
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
11
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
12
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
14
+ if (kind === "accessor") {
15
+ if (result === void 0) continue;
16
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
17
+ if (_ = accept(result.get)) descriptor.get = _;
18
+ if (_ = accept(result.set)) descriptor.set = _;
19
+ if (_ = accept(result.init)) initializers.unshift(_);
20
+ }
21
+ else if (_ = accept(result)) {
22
+ if (kind === "field") initializers.unshift(_);
23
+ else descriptor[key] = _;
24
+ }
25
+ }
26
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
27
+ done = true;
28
+ };
29
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
30
+ var useValue = arguments.length > 2;
31
+ for (var i = 0; i < initializers.length; i++) {
32
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
33
+ }
34
+ return useValue ? value : void 0;
35
+ };
36
+ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
37
+ if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
38
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
39
+ };
40
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
41
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
42
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
43
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
44
+ };
45
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
46
+ if (kind === "m") throw new TypeError("Private method is not writable");
47
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
48
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
49
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
50
+ };
51
+ var __importDefault = (this && this.__importDefault) || function (mod) {
52
+ return (mod && mod.__esModule) ? mod : { "default": mod };
53
+ };
54
+ Object.defineProperty(exports, "__esModule", { value: true });
55
+ exports.SitemapPlugin = void 0;
56
+ const path_1 = __importDefault(require("path"));
57
+ const components_1 = require("../components");
58
+ const events_1 = require("../events");
59
+ const DefaultTheme_1 = require("../themes/default/DefaultTheme");
60
+ const utils_1 = require("../../utils");
61
+ const html_1 = require("../../utils/html");
62
+ let SitemapPlugin = (() => {
63
+ var _SitemapPlugin_sitemapBaseUrl_accessor_storage;
64
+ let _classDecorators = [(0, components_1.Component)({ name: "sitemap" })];
65
+ let _classDescriptor;
66
+ let _classExtraInitializers = [];
67
+ let _classThis;
68
+ let _classSuper = components_1.RendererComponent;
69
+ let _instanceExtraInitializers = [];
70
+ let _sitemapBaseUrl_decorators;
71
+ let _sitemapBaseUrl_initializers = [];
72
+ var SitemapPlugin = _classThis = class extends _classSuper {
73
+ constructor() {
74
+ super(...arguments);
75
+ _SitemapPlugin_sitemapBaseUrl_accessor_storage.set(this, (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _sitemapBaseUrl_initializers, void 0)));
76
+ }
77
+ get sitemapBaseUrl() { return __classPrivateFieldGet(this, _SitemapPlugin_sitemapBaseUrl_accessor_storage, "f"); }
78
+ set sitemapBaseUrl(value) { __classPrivateFieldSet(this, _SitemapPlugin_sitemapBaseUrl_accessor_storage, value, "f"); }
79
+ initialize() {
80
+ this.listenTo(this.owner, events_1.RendererEvent.BEGIN, this.onRendererBegin);
81
+ }
82
+ onRendererBegin(event) {
83
+ if (!(this.owner.theme instanceof DefaultTheme_1.DefaultTheme)) {
84
+ return;
85
+ }
86
+ if (event.isDefaultPrevented || !this.sitemapBaseUrl) {
87
+ return;
88
+ }
89
+ this.owner.preRenderAsyncJobs.push((event) => this.buildSitemap(event));
90
+ }
91
+ async buildSitemap(event) {
92
+ // cSpell:words lastmod urlset
93
+ const sitemapXml = path_1.default.join(event.outputDirectory, "sitemap.xml");
94
+ const lastmod = new Date(this.owner.renderStartTime).toISOString();
95
+ const urls = event.urls?.map((url) => {
96
+ return {
97
+ tag: "url",
98
+ children: [
99
+ {
100
+ tag: "loc",
101
+ children: new URL(url.url, this.sitemapBaseUrl).toString(),
102
+ },
103
+ {
104
+ tag: "lastmod",
105
+ children: lastmod,
106
+ },
107
+ ],
108
+ };
109
+ }) ?? [];
110
+ const sitemap = `<?xml version="1.0" encoding="UTF-8"?>\n` +
111
+ stringifyXml({
112
+ tag: "urlset",
113
+ attr: { xmlns: "http://www.sitemaps.org/schemas/sitemap/0.9" },
114
+ children: urls,
115
+ }) +
116
+ "\n";
117
+ await (0, utils_1.writeFile)(sitemapXml, sitemap);
118
+ }
119
+ };
120
+ _SitemapPlugin_sitemapBaseUrl_accessor_storage = new WeakMap();
121
+ __setFunctionName(_classThis, "SitemapPlugin");
122
+ (() => {
123
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
124
+ _sitemapBaseUrl_decorators = [(0, utils_1.Option)("sitemapBaseUrl")];
125
+ __esDecorate(_classThis, null, _sitemapBaseUrl_decorators, { kind: "accessor", name: "sitemapBaseUrl", static: false, private: false, access: { has: obj => "sitemapBaseUrl" in obj, get: obj => obj.sitemapBaseUrl, set: (obj, value) => { obj.sitemapBaseUrl = value; } }, metadata: _metadata }, _sitemapBaseUrl_initializers, _instanceExtraInitializers);
126
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
127
+ SitemapPlugin = _classThis = _classDescriptor.value;
128
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
129
+ __runInitializers(_classThis, _classExtraInitializers);
130
+ })();
131
+ return SitemapPlugin = _classThis;
132
+ })();
133
+ exports.SitemapPlugin = SitemapPlugin;
134
+ function stringifyXml(xml, indent = 0) {
135
+ const parts = ["\t".repeat(indent), "<", xml.tag];
136
+ for (const [key, val] of Object.entries(xml.attr || {})) {
137
+ parts.push(" ", key, '="', (0, html_1.escapeHtml)(val), '"');
138
+ }
139
+ parts.push(">");
140
+ if (typeof xml.children === "string") {
141
+ parts.push((0, html_1.escapeHtml)(xml.children));
142
+ }
143
+ else {
144
+ for (const child of xml.children) {
145
+ parts.push("\n");
146
+ parts.push(stringifyXml(child, indent + 1));
147
+ }
148
+ parts.push("\n", "\t".repeat(indent));
149
+ }
150
+ parts.push("</", xml.tag, ">");
151
+ return parts.join("");
152
+ }
@@ -2,3 +2,4 @@ export { MarkedPlugin } from "../themes/MarkedPlugin";
2
2
  export { AssetsPlugin } from "./AssetsPlugin";
3
3
  export { JavascriptIndexPlugin } from "./JavascriptIndexPlugin";
4
4
  export { NavigationPlugin } from "./NavigationPlugin";
5
+ export { SitemapPlugin } from "./SitemapPlugin";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NavigationPlugin = exports.JavascriptIndexPlugin = exports.AssetsPlugin = exports.MarkedPlugin = void 0;
3
+ exports.SitemapPlugin = exports.NavigationPlugin = exports.JavascriptIndexPlugin = exports.AssetsPlugin = exports.MarkedPlugin = void 0;
4
4
  var MarkedPlugin_1 = require("../themes/MarkedPlugin");
5
5
  Object.defineProperty(exports, "MarkedPlugin", { enumerable: true, get: function () { return MarkedPlugin_1.MarkedPlugin; } });
6
6
  var AssetsPlugin_1 = require("./AssetsPlugin");
@@ -9,3 +9,5 @@ var JavascriptIndexPlugin_1 = require("./JavascriptIndexPlugin");
9
9
  Object.defineProperty(exports, "JavascriptIndexPlugin", { enumerable: true, get: function () { return JavascriptIndexPlugin_1.JavascriptIndexPlugin; } });
10
10
  var NavigationPlugin_1 = require("./NavigationPlugin");
11
11
  Object.defineProperty(exports, "NavigationPlugin", { enumerable: true, get: function () { return NavigationPlugin_1.NavigationPlugin; } });
12
+ var SitemapPlugin_1 = require("./SitemapPlugin");
13
+ Object.defineProperty(exports, "SitemapPlugin", { enumerable: true, get: function () { return SitemapPlugin_1.SitemapPlugin; } });
@@ -104,7 +104,7 @@ class DefaultTheme extends theme_1.Theme {
104
104
  urls.push(new UrlMapping_1.UrlMapping("modules.html", project, this.reflectionTemplate));
105
105
  urls.push(new UrlMapping_1.UrlMapping("index.html", project, this.indexTemplate));
106
106
  }
107
- if (includeHierarchyPage(project)) {
107
+ if ((0, lib_1.getHierarchyRoots)(project).length) {
108
108
  urls.push(new UrlMapping_1.UrlMapping("hierarchy.html", project, this.hierarchyTemplate));
109
109
  }
110
110
  project.children?.forEach((child) => {
@@ -365,15 +365,3 @@ function shouldShowGroups(reflection, opts) {
365
365
  }
366
366
  return reflection.comment?.hasModifier("@showGroups") === true;
367
367
  }
368
- function includeHierarchyPage(project) {
369
- for (const id in project.reflections) {
370
- const refl = project.reflections[id];
371
- if (refl.kindOf(models_1.ReflectionKind.ClassOrInterface)) {
372
- // Keep this condition in sync with the one in hierarchy.tsx for determining roots
373
- if (!(refl.implementedTypes || refl.extendedTypes) && (refl.implementedBy || refl.extendedBy)) {
374
- return true;
375
- }
376
- }
377
- }
378
- return false;
379
- }
@@ -3,9 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.index = void 0;
4
4
  const lib_1 = require("../../lib");
5
5
  const utils_1 = require("../../../../utils");
6
- function renderCategory({ urlTo, icons, getReflectionClasses }, item, prependName = "") {
6
+ function renderCategory({ urlTo, icons, getReflectionClasses, markdown }, item, prependName = "") {
7
7
  return (utils_1.JSX.createElement("section", { class: "tsd-index-section" },
8
8
  utils_1.JSX.createElement("h3", { class: "tsd-index-heading" }, prependName ? `${prependName} - ${item.title}` : item.title),
9
+ item.description && (utils_1.JSX.createElement("div", { class: "tsd-comment tsd-typography" },
10
+ utils_1.JSX.createElement(utils_1.Raw, { html: markdown(item.description) }))),
9
11
  utils_1.JSX.createElement("div", { class: "tsd-index-list" }, item.children.map((item) => (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
10
12
  utils_1.JSX.createElement("a", { href: urlTo(item), class: (0, lib_1.classNames)({ "tsd-index-link": true, deprecated: item.isDeprecated() }, getReflectionClasses(item)) },
11
13
  icons[item.kind](),
@@ -13,7 +13,7 @@ function memberSignatureBody(context, props, { hideSources = false } = {}) {
13
13
  props.parameters && props.parameters.length > 0 && (utils_1.JSX.createElement("div", { class: "tsd-parameters" },
14
14
  utils_1.JSX.createElement("h4", { class: "tsd-parameters-title" }, "Parameters"),
15
15
  utils_1.JSX.createElement("ul", { class: "tsd-parameter-list" }, props.parameters.map((item) => (utils_1.JSX.createElement("li", null,
16
- utils_1.JSX.createElement("h5", null,
16
+ utils_1.JSX.createElement("span", null,
17
17
  context.reflectionFlags(item),
18
18
  !!item.flags.isRest && utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "..."),
19
19
  utils_1.JSX.createElement("span", { class: "tsd-kind-parameter" }, item.name),
@@ -7,7 +7,7 @@ function typeParameters(context, typeParameters) {
7
7
  utils_1.JSX.createElement("section", { class: "tsd-panel" },
8
8
  utils_1.JSX.createElement("h4", null, "Type Parameters"),
9
9
  utils_1.JSX.createElement("ul", { class: "tsd-type-parameter-list" }, typeParameters?.map((item) => (utils_1.JSX.createElement("li", null,
10
- utils_1.JSX.createElement("h4", null,
10
+ utils_1.JSX.createElement("span", null,
11
11
  utils_1.JSX.createElement("a", { id: item.anchor, class: "tsd-anchor" }),
12
12
  item.flags.isConst && utils_1.JSX.createElement("span", { class: "tsd-signature-keyword" }, "const "),
13
13
  item.varianceModifier && (utils_1.JSX.createElement("span", { class: "tsd-signature-keyword" },
@@ -1,5 +1,5 @@
1
1
  import type { DefaultThemeRenderContext } from "../DefaultThemeRenderContext";
2
2
  import type { PageEvent } from "../../../events";
3
3
  import { JSX } from "../../../../utils";
4
- import { type ProjectReflection } from "../../../../models";
4
+ import type { ProjectReflection } from "../../../../models";
5
5
  export declare function hierarchyTemplate(context: DefaultThemeRenderContext, props: PageEvent<ProjectReflection>): JSX.Element;
@@ -2,8 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.hierarchyTemplate = void 0;
4
4
  const utils_1 = require("../../../../utils");
5
- const models_1 = require("../../../../models");
6
- function fullHierarchy(context, root) {
5
+ const lib_1 = require("../../lib");
6
+ function fullHierarchy(context, root, seen = new Set()) {
7
+ if (seen.has(root))
8
+ return;
9
+ seen.add(root);
7
10
  // Note: We don't use root.anchor for the anchor, because those are built on a per page basis.
8
11
  // And classes/interfaces get their own page, so all the anchors will be empty anyways.
9
12
  // Full name should be safe here, since this list only includes classes/interfaces.
@@ -14,19 +17,15 @@ function fullHierarchy(context, root) {
14
17
  root.name),
15
18
  utils_1.JSX.createElement("ul", null,
16
19
  root.implementedBy?.map((child) => {
17
- return child.reflection && fullHierarchy(context, child.reflection);
20
+ return child.reflection && fullHierarchy(context, child.reflection, seen);
18
21
  }),
19
22
  root.extendedBy?.map((child) => {
20
- return child.reflection && fullHierarchy(context, child.reflection);
23
+ return child.reflection && fullHierarchy(context, child.reflection, seen);
21
24
  }))));
22
25
  }
23
26
  function hierarchyTemplate(context, props) {
24
- // Keep this condition in sync with the one in DefaultTheme.tsx
25
- const roots = props.project.getReflectionsByKind(models_1.ReflectionKind.ClassOrInterface)
26
- .filter((refl) => !(refl.implementedTypes || refl.extendedTypes) && (refl.implementedBy || refl.extendedBy))
27
- .sort((a, b) => a.name.localeCompare(b.name));
28
27
  return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
29
28
  utils_1.JSX.createElement("h2", null, "Class Hierarchy"),
30
- roots.map((root) => (utils_1.JSX.createElement("ul", { class: "tsd-full-hierarchy" }, fullHierarchy(context, root))))));
29
+ (0, lib_1.getHierarchyRoots)(props.project).map((root) => (utils_1.JSX.createElement("ul", { class: "tsd-full-hierarchy" }, fullHierarchy(context, root))))));
31
30
  }
32
31
  exports.hierarchyTemplate = hierarchyTemplate;
@@ -1,5 +1,5 @@
1
1
  import type { DefaultThemeRenderContext } from "..";
2
- import { Reflection, TypeParameterReflection } from "../../models";
2
+ import { DeclarationReflection, ProjectReflection, Reflection, TypeParameterReflection } from "../../models";
3
3
  import { JSX } from "../../utils";
4
4
  export declare function stringify(data: unknown): string;
5
5
  export declare function getDisplayName(refl: Reflection): string;
@@ -25,3 +25,4 @@ export declare function camelToTitleCase(text: string): string;
25
25
  * Renders the reflection name with an additional `?` if optional.
26
26
  */
27
27
  export declare function renderName(refl: Reflection): JSX.Element | (string | JSX.Element)[];
28
+ export declare function getHierarchyRoots(project: ProjectReflection): DeclarationReflection[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.renderName = exports.camelToTitleCase = exports.renderTypeParametersSignature = exports.hasTypeParameters = exports.classNames = exports.join = exports.wbr = exports.getKindClass = exports.toStyleClass = exports.getDisplayName = exports.stringify = void 0;
3
+ exports.getHierarchyRoots = exports.renderName = exports.camelToTitleCase = exports.renderTypeParametersSignature = exports.hasTypeParameters = exports.classNames = exports.join = exports.wbr = exports.getKindClass = exports.toStyleClass = exports.getDisplayName = exports.stringify = void 0;
4
4
  const models_1 = require("../../models");
5
5
  const utils_1 = require("../../utils");
6
6
  function stringify(data) {
@@ -122,3 +122,26 @@ function renderName(refl) {
122
122
  return wbr(refl.name);
123
123
  }
124
124
  exports.renderName = renderName;
125
+ function getHierarchyRoots(project) {
126
+ const allClasses = project.getReflectionsByKind(models_1.ReflectionKind.ClassOrInterface);
127
+ const roots = allClasses.filter((refl) => {
128
+ // If nobody extends this class, there's no possible hierarchy to display.
129
+ if (!refl.implementedBy && !refl.extendedBy) {
130
+ return false;
131
+ }
132
+ // If we don't extend anything, then we are a root
133
+ if (!refl.implementedTypes && !refl.extendedTypes) {
134
+ return true;
135
+ }
136
+ // We might still be a root, if our extended/implemented types are not included
137
+ // in the documentation.
138
+ const types = [...(refl.implementedTypes || []), ...(refl.extendedTypes || [])];
139
+ return types.every((type) => !type.visit({
140
+ reference(ref) {
141
+ return ref.reflection !== undefined;
142
+ },
143
+ }));
144
+ });
145
+ return roots.sort((a, b) => a.name.localeCompare(b.name));
146
+ }
147
+ exports.getHierarchyRoots = getHierarchyRoots;
@@ -51,10 +51,10 @@ export interface ReflectionSymbolId {
51
51
  sourceFileName: string;
52
52
  qualifiedName: string;
53
53
  }
54
- export interface ReflectionGroup extends S<M.ReflectionGroup, "title" | "categories"> {
54
+ export interface ReflectionGroup extends S<M.ReflectionGroup, "title" | "description" | "categories"> {
55
55
  children?: M.ReflectionGroup["children"][number]["id"][];
56
56
  }
57
- export interface ReflectionCategory extends S<M.ReflectionCategory, "title"> {
57
+ export interface ReflectionCategory extends S<M.ReflectionCategory, "title" | "description"> {
58
58
  children?: M.ReflectionCategory["children"][number]["id"][];
59
59
  }
60
60
  /** @category Reflections */
@@ -78,7 +78,7 @@ export interface ParameterReflection extends Omit<Reflection, "variant">, S<M.Pa
78
78
  variant: "param";
79
79
  }
80
80
  /** @category Reflections */
81
- export interface DeclarationReflection extends Omit<ContainerReflection, "variant">, S<M.DeclarationReflection, "variant" | "packageVersion" | "sources" | "relevanceBoost" | "type" | "signatures" | "indexSignature" | "defaultValue" | "overwrites" | "inheritedFrom" | "implementationOf" | "extendedTypes" | "extendedBy" | "implementedTypes" | "implementedBy" | "getSignature" | "setSignature" | "typeParameters"> {
81
+ export interface DeclarationReflection extends Omit<ContainerReflection, "variant">, S<M.DeclarationReflection, "variant" | "packageVersion" | "sources" | "relevanceBoost" | "type" | "signatures" | "indexSignature" | "defaultValue" | "overwrites" | "inheritedFrom" | "implementationOf" | "extendedTypes" | "extendedBy" | "implementedTypes" | "implementedBy" | "getSignature" | "setSignature" | "typeParameters" | "readme"> {
82
82
  }
83
83
  /** @category Reflections */
84
84
  export interface TypeParameterReflection extends Omit<Reflection, "variant">, S<M.TypeParameterReflection, "variant" | "type" | "default" | "varianceModifier"> {
@@ -161,7 +161,7 @@ function getEntryPointsForPaths(logger, inputFiles, options, programs = getEntry
161
161
  const suggestion = (0, fs_1.isDir)(fileOrDir)
162
162
  ? " If you wanted to include files inside this directory, set --entryPointStrategy to expand or specify a glob."
163
163
  : "";
164
- logger.warn(`The entry point ${(0, paths_1.nicePath)(fileOrDir)} is not included in the program for your provided tsconfig.${suggestion}`);
164
+ logger.warn(`The entry point ${(0, paths_1.nicePath)(fileOrDir)} is not referenced by the 'files' or 'include' option in your tsconfig.${suggestion}`);
165
165
  }
166
166
  return entryPoints;
167
167
  }
@@ -9,6 +9,7 @@
9
9
  // https://github.com/jashkenas/backbone/blob/05fde9e201f7e2137796663081105cd6dad12a98/backbone.js#L119-L374
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.EventDispatcher = exports.Event = void 0;
12
+ // Priority: Higher number makes the listener be called earlier.
12
13
  const uniqueId = (function () {
13
14
  const prefixes = Object.create(null);
14
15
  return function (prefix) {
@@ -72,6 +72,7 @@ export interface TypeDocOptionMap {
72
72
  excludeProtected: boolean;
73
73
  excludeReferences: boolean;
74
74
  excludeCategories: string[];
75
+ maxTypeConversionDepth: number;
75
76
  name: string;
76
77
  includeVersion: boolean;
77
78
  disableSources: boolean;
@@ -95,6 +96,7 @@ export interface TypeDocOptionMap {
95
96
  cname: string;
96
97
  htmlLang: string;
97
98
  githubPages: boolean;
99
+ sitemapBaseUrl: string;
98
100
  cacheBust: boolean;
99
101
  gaID: string;
100
102
  hideGenerator: boolean;