typedoc 0.26.3 → 0.26.5

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 (34) hide show
  1. package/dist/index.d.ts +2 -2
  2. package/dist/index.js +2 -1
  3. package/dist/lib/application.js +1 -1
  4. package/dist/lib/converter/comments/discovery.js +5 -0
  5. package/dist/lib/converter/comments/parser.js +2 -2
  6. package/dist/lib/converter/plugins/CommentPlugin.js +2 -4
  7. package/dist/lib/converter/plugins/ImplementsPlugin.d.ts +12 -0
  8. package/dist/lib/converter/plugins/ImplementsPlugin.js +91 -72
  9. package/dist/lib/converter/plugins/LinkResolverPlugin.js +5 -3
  10. package/dist/lib/internationalization/translatable.d.ts +2 -0
  11. package/dist/lib/internationalization/translatable.js +2 -0
  12. package/dist/lib/models/FileRegistry.js +3 -0
  13. package/dist/lib/models/comments/comment.d.ts +12 -0
  14. package/dist/lib/models/comments/comment.js +33 -0
  15. package/dist/lib/output/index.d.ts +1 -1
  16. package/dist/lib/output/themes/default/DefaultTheme.js +25 -16
  17. package/dist/lib/output/themes/default/partials/member.reference.d.ts +1 -1
  18. package/dist/lib/output/themes/default/partials/member.reference.js +10 -4
  19. package/dist/lib/utils/array.d.ts +2 -2
  20. package/dist/lib/utils/array.js +3 -3
  21. package/dist/lib/utils/index.d.ts +1 -1
  22. package/dist/lib/utils/index.js +2 -1
  23. package/dist/lib/utils/minimalSourceFile.d.ts +1 -1
  24. package/dist/lib/utils/minimalSourceFile.js +9 -1
  25. package/dist/lib/utils/options/defaults.d.ts +23 -0
  26. package/dist/lib/utils/options/defaults.js +120 -0
  27. package/dist/lib/utils/options/index.d.ts +1 -0
  28. package/dist/lib/utils/options/index.js +3 -1
  29. package/dist/lib/utils/options/sources/typedoc.js +12 -64
  30. package/dist/lib/utils/sort.js +4 -29
  31. package/dist/lib/validation/documentation.js +5 -1
  32. package/dist/lib/validation/links.js +45 -27
  33. package/package.json +1 -1
  34. package/static/main.js +4 -4
package/dist/index.d.ts CHANGED
@@ -19,8 +19,8 @@ export * as Configuration from "./lib/utils/options";
19
19
  export * from "./lib/models";
20
20
  export { Converter, Context, type CommentParserConfig, type DeclarationReference, type SymbolReference, type ComponentPath, type Meaning, type MeaningKeyword, type ExternalResolveResult, type ExternalSymbolResolver, type ConverterEvents, } from "./lib/converter";
21
21
  export { Renderer, DefaultTheme, DefaultThemeRenderContext, Slugger, UrlMapping, Theme, PageEvent, RendererEvent, MarkdownEvent, IndexEvent, } from "./lib/output";
22
- export type { RenderTemplate, RendererHooks, NavigationElement, RendererEvents, } from "./lib/output";
23
- export { ArgumentsReader, Option, CommentStyle, JSX, LogLevel, Logger, Options, PackageJsonReader, ParameterHint, ParameterType, TSConfigReader, TypeDocReader, EntryPointStrategy, EventHooks, MinimalSourceFile, normalizePath, } from "./lib/utils";
22
+ export type { RenderTemplate, RendererHooks, NavigationElement, RendererEvents, PageHeading, } from "./lib/output";
23
+ export { ArgumentsReader, Option, CommentStyle, JSX, LogLevel, Logger, Options, OptionDefaults, PackageJsonReader, ParameterHint, ParameterType, TSConfigReader, TypeDocReader, EntryPointStrategy, EventHooks, MinimalSourceFile, normalizePath, } from "./lib/utils";
24
24
  export type { OptionsReader, TypeDocOptions, TypeDocOptionMap, ValidationOptions, TypeDocOptionValues, KeyToDeclaration, DeclarationOption, DeclarationOptionBase, StringDeclarationOption, NumberDeclarationOption, BooleanDeclarationOption, ArrayDeclarationOption, MixedDeclarationOption, ObjectDeclarationOption, MapDeclarationOption, FlagsDeclarationOption, DeclarationOptionToOptionType, SortStrategy, ParameterTypeToOptionTypeMap, DocumentationEntryPoint, ManuallyValidatedOption, EnumKeys, JsDocCompatibility, } from "./lib/utils";
25
25
  export { JSONOutput, Serializer, type SerializerEvents, Deserializer, type Deserializable, type DeserializerComponent, type SerializerComponent, SerializeEvent, } from "./lib/serialization";
26
26
  export * as Internationalization from "./lib/internationalization/index";
package/dist/index.js CHANGED
@@ -29,7 +29,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
29
29
  return (mod && mod.__esModule) ? mod : { "default": mod };
30
30
  };
31
31
  Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.TypeScript = exports.Internationalization = exports.SerializeEvent = exports.Deserializer = exports.Serializer = exports.JSONOutput = exports.normalizePath = exports.MinimalSourceFile = exports.EventHooks = exports.EntryPointStrategy = exports.TypeDocReader = exports.TSConfigReader = exports.ParameterType = exports.ParameterHint = exports.PackageJsonReader = exports.Options = exports.Logger = exports.LogLevel = exports.JSX = exports.CommentStyle = exports.Option = exports.ArgumentsReader = exports.IndexEvent = exports.MarkdownEvent = exports.RendererEvent = exports.PageEvent = exports.Theme = exports.UrlMapping = exports.Slugger = exports.DefaultThemeRenderContext = exports.DefaultTheme = exports.Renderer = exports.Context = exports.Converter = exports.Configuration = exports.Models = exports.resetReflectionID = exports.EventDispatcher = exports.Application = void 0;
32
+ exports.TypeScript = exports.Internationalization = exports.SerializeEvent = exports.Deserializer = exports.Serializer = exports.JSONOutput = exports.normalizePath = exports.MinimalSourceFile = exports.EventHooks = exports.EntryPointStrategy = exports.TypeDocReader = exports.TSConfigReader = exports.ParameterType = exports.ParameterHint = exports.PackageJsonReader = exports.OptionDefaults = exports.Options = exports.Logger = exports.LogLevel = exports.JSX = exports.CommentStyle = exports.Option = exports.ArgumentsReader = exports.IndexEvent = exports.MarkdownEvent = exports.RendererEvent = exports.PageEvent = exports.Theme = exports.UrlMapping = exports.Slugger = exports.DefaultThemeRenderContext = exports.DefaultTheme = exports.Renderer = exports.Context = exports.Converter = exports.Configuration = exports.Models = exports.resetReflectionID = exports.EventDispatcher = exports.Application = void 0;
33
33
  var application_1 = require("./lib/application");
34
34
  Object.defineProperty(exports, "Application", { enumerable: true, get: function () { return application_1.Application; } });
35
35
  var events_1 = require("./lib/utils/events");
@@ -74,6 +74,7 @@ Object.defineProperty(exports, "JSX", { enumerable: true, get: function () { ret
74
74
  Object.defineProperty(exports, "LogLevel", { enumerable: true, get: function () { return utils_1.LogLevel; } });
75
75
  Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return utils_1.Logger; } });
76
76
  Object.defineProperty(exports, "Options", { enumerable: true, get: function () { return utils_1.Options; } });
77
+ Object.defineProperty(exports, "OptionDefaults", { enumerable: true, get: function () { return utils_1.OptionDefaults; } });
77
78
  Object.defineProperty(exports, "PackageJsonReader", { enumerable: true, get: function () { return utils_1.PackageJsonReader; } });
78
79
  Object.defineProperty(exports, "ParameterHint", { enumerable: true, get: function () { return utils_1.ParameterHint; } });
79
80
  Object.defineProperty(exports, "ParameterType", { enumerable: true, get: function () { return utils_1.ParameterType; } });
@@ -471,7 +471,7 @@ let Application = (() => {
471
471
  out = Path.resolve(out);
472
472
  const ser = this.serializer.projectToObject(project, process.cwd());
473
473
  const space = this.options.getValue("pretty") ? "\t" : "";
474
- await (0, index_2.writeFile)(out, JSON.stringify(ser, null, space));
474
+ await (0, index_2.writeFile)(out, JSON.stringify(ser, null, space) + "\n");
475
475
  this.logger.info(this.i18n.json_written_to_0((0, paths_1.nicePath)(out)));
476
476
  this.logger.verbose(`JSON rendering took ${Date.now() - start}ms`);
477
477
  }
@@ -308,6 +308,11 @@ function declarationToCommentNodeIgnoringParents(node) {
308
308
  // ts.SourceFile is a counterexample
309
309
  if (!node.parent)
310
310
  return node;
311
+ // function foo(x: number)
312
+ // ^^^^^^^^^
313
+ if (node.kind === typescript_1.default.SyntaxKind.Parameter) {
314
+ return node;
315
+ }
311
316
  // const abc = 123
312
317
  // ^^^
313
318
  if (node.parent.kind === typescript_1.default.SyntaxKind.VariableDeclarationList) {
@@ -140,8 +140,8 @@ function parseCommentString(tokens, config, file, logger, files) {
140
140
  }
141
141
  // Check for frontmatter
142
142
  let frontmatterData = {};
143
- const firstBlock = content[0];
144
- if (firstBlock.text.startsWith("---\n")) {
143
+ const firstBlock = content.at(0);
144
+ if (firstBlock?.text.startsWith("---\n")) {
145
145
  const end = firstBlock.text.indexOf("\n---\n");
146
146
  if (end !== -1) {
147
147
  const yamlText = firstBlock.text.slice("---\n".length, end);
@@ -565,13 +565,11 @@ let CommentPlugin = (() => {
565
565
  const isHidden = comment.hasModifier("@hidden") ||
566
566
  comment.hasModifier("@ignore") ||
567
567
  (comment.hasModifier("@internal") && this.excludeInternal);
568
- if (isHidden &&
568
+ if (!isHidden &&
569
569
  reflection.kindOf(models_1.ReflectionKind.ContainsCallSignatures)) {
570
570
  return reflection
571
571
  .getNonIndexSignatures()
572
- .every((sig) => {
573
- return !sig.comment || this.isHidden(sig);
574
- });
572
+ .every((sig) => this.isHidden(sig));
575
573
  }
576
574
  return isHidden;
577
575
  }
@@ -6,6 +6,7 @@ import { ConverterComponent } from "../components";
6
6
  export declare class ImplementsPlugin extends ConverterComponent {
7
7
  private resolved;
8
8
  private postponed;
9
+ private revivingSerialized;
9
10
  /**
10
11
  * Create a new ImplementsPlugin instance.
11
12
  */
@@ -16,6 +17,7 @@ export declare class ImplementsPlugin extends ConverterComponent {
16
17
  private analyzeImplements;
17
18
  private analyzeInheritance;
18
19
  private onResolveEnd;
20
+ private onRevive;
19
21
  private resolve;
20
22
  private tryResolve;
21
23
  private doResolve;
@@ -28,4 +30,14 @@ export declare class ImplementsPlugin extends ConverterComponent {
28
30
  * during the resolve step with links which actually point to the right place.
29
31
  */
30
32
  private onDeclaration;
33
+ /**
34
+ * Responsible for copying comments from "parent" reflections defined
35
+ * in either a base class or implemented interface to the child class.
36
+ */
37
+ private handleInheritedComments;
38
+ /**
39
+ * Copy the comment of the source reflection to the target reflection with a JSDoc style copy
40
+ * function. The TSDoc copy function is in the InheritDocPlugin.
41
+ */
42
+ private copyComment;
31
43
  }
@@ -65,6 +65,7 @@ let ImplementsPlugin = (() => {
65
65
  super(...arguments);
66
66
  this.resolved = new WeakSet();
67
67
  this.postponed = new WeakMap();
68
+ this.revivingSerialized = false;
68
69
  }
69
70
  /**
70
71
  * Create a new ImplementsPlugin instance.
@@ -73,13 +74,13 @@ let ImplementsPlugin = (() => {
73
74
  this.owner.on(converter_1.Converter.EVENT_RESOLVE_END, this.onResolveEnd.bind(this));
74
75
  this.owner.on(converter_1.Converter.EVENT_CREATE_DECLARATION, this.onDeclaration.bind(this), -1000);
75
76
  this.owner.on(converter_1.Converter.EVENT_CREATE_SIGNATURE, this.onSignature.bind(this), 1000);
76
- this.application.on(application_events_1.ApplicationEvents.REVIVE, this.resolve.bind(this));
77
+ this.application.on(application_events_1.ApplicationEvents.REVIVE, this.onRevive.bind(this));
77
78
  }
78
79
  /**
79
80
  * Mark all members of the given class to be the implementation of the matching interface member.
80
81
  */
81
82
  analyzeImplements(project, classReflection, interfaceReflection) {
82
- handleInheritedComments(classReflection, interfaceReflection);
83
+ this.handleInheritedComments(classReflection, interfaceReflection);
83
84
  if (!interfaceReflection.children) {
84
85
  return;
85
86
  }
@@ -110,7 +111,7 @@ let ImplementsPlugin = (() => {
110
111
  }
111
112
  }
112
113
  }
113
- handleInheritedComments(classMember, interfaceMember);
114
+ this.handleInheritedComments(classMember, interfaceMember);
114
115
  });
115
116
  }
116
117
  analyzeInheritance(project, reflection) {
@@ -121,7 +122,7 @@ let ImplementsPlugin = (() => {
121
122
  : void 0;
122
123
  });
123
124
  for (const parent of extendedTypes) {
124
- handleInheritedComments(reflection, parent.reflection);
125
+ this.handleInheritedComments(reflection, parent.reflection);
125
126
  for (const parentMember of parent.reflection.children ?? []) {
126
127
  const child = findMatchingMember(parentMember, reflection);
127
128
  if (child) {
@@ -132,7 +133,7 @@ let ImplementsPlugin = (() => {
132
133
  childSig[key] = types_1.ReferenceType.createResolvedReference(`${parent.name}.${parentMember.name}`, parentSig, project);
133
134
  }
134
135
  child[key] = types_1.ReferenceType.createResolvedReference(`${parent.name}.${parentMember.name}`, parentMember, project);
135
- handleInheritedComments(child, parentMember);
136
+ this.handleInheritedComments(child, parentMember);
136
137
  }
137
138
  }
138
139
  }
@@ -140,6 +141,11 @@ let ImplementsPlugin = (() => {
140
141
  onResolveEnd(context) {
141
142
  this.resolve(context.project);
142
143
  }
144
+ onRevive(project) {
145
+ this.revivingSerialized = true;
146
+ this.resolve(project);
147
+ this.revivingSerialized = false;
148
+ }
143
149
  resolve(project) {
144
150
  for (const id in project.reflections) {
145
151
  const refl = project.reflections[id];
@@ -262,6 +268,73 @@ let ImplementsPlugin = (() => {
262
268
  }
263
269
  }
264
270
  }
271
+ /**
272
+ * Responsible for copying comments from "parent" reflections defined
273
+ * in either a base class or implemented interface to the child class.
274
+ */
275
+ handleInheritedComments(child, parent) {
276
+ this.copyComment(child, parent);
277
+ if (parent.kindOf(index_1.ReflectionKind.Property) &&
278
+ child.kindOf(index_1.ReflectionKind.Accessor)) {
279
+ if (child.getSignature) {
280
+ this.copyComment(child.getSignature, parent);
281
+ child.getSignature.implementationOf = child.implementationOf;
282
+ }
283
+ if (child.setSignature) {
284
+ this.copyComment(child.setSignature, parent);
285
+ child.setSignature.implementationOf = child.implementationOf;
286
+ }
287
+ }
288
+ if (parent.kindOf(index_1.ReflectionKind.Accessor) &&
289
+ child.kindOf(index_1.ReflectionKind.Accessor)) {
290
+ if (parent.getSignature && child.getSignature) {
291
+ this.copyComment(child.getSignature, parent.getSignature);
292
+ }
293
+ if (parent.setSignature && child.setSignature) {
294
+ this.copyComment(child.setSignature, parent.setSignature);
295
+ }
296
+ }
297
+ if (parent.kindOf(index_1.ReflectionKind.FunctionOrMethod) &&
298
+ parent.signatures &&
299
+ child.signatures) {
300
+ for (const [cs, ps] of (0, array_1.zip)(child.signatures, parent.signatures)) {
301
+ this.copyComment(cs, ps);
302
+ }
303
+ }
304
+ else if (parent.kindOf(index_1.ReflectionKind.Property) &&
305
+ parent.type instanceof types_1.ReflectionType &&
306
+ parent.type.declaration.signatures &&
307
+ child.signatures) {
308
+ for (const [cs, ps] of (0, array_1.zip)(child.signatures, parent.type.declaration.signatures)) {
309
+ this.copyComment(cs, ps);
310
+ }
311
+ }
312
+ }
313
+ /**
314
+ * Copy the comment of the source reflection to the target reflection with a JSDoc style copy
315
+ * function. The TSDoc copy function is in the InheritDocPlugin.
316
+ */
317
+ copyComment(target, source) {
318
+ if (!shouldCopyComment(target, source, this.revivingSerialized)) {
319
+ return;
320
+ }
321
+ target.comment = source.comment.clone();
322
+ if (target instanceof index_1.DeclarationReflection &&
323
+ source instanceof index_1.DeclarationReflection) {
324
+ for (const [tt, ts] of (0, array_1.zip)(target.typeParameters || [], source.typeParameters || [])) {
325
+ this.copyComment(tt, ts);
326
+ }
327
+ }
328
+ if (target instanceof index_1.SignatureReflection &&
329
+ source instanceof index_1.SignatureReflection) {
330
+ for (const [tt, ts] of (0, array_1.zip)(target.typeParameters || [], source.typeParameters || [])) {
331
+ this.copyComment(tt, ts);
332
+ }
333
+ for (const [pt, ps] of (0, array_1.zip)(target.parameters || [], source.parameters || [])) {
334
+ this.copyComment(pt, ps);
335
+ }
336
+ }
337
+ }
265
338
  };
266
339
  __setFunctionName(_classThis, "ImplementsPlugin");
267
340
  (() => {
@@ -305,7 +378,9 @@ function createLink(context, reflection, clause, expr, symbol, isInherit) {
305
378
  link(sig);
306
379
  }
307
380
  // Intentionally create broken links here. These will be replaced with real links during
308
- // resolution if we can do so.
381
+ // resolution if we can do so. We create broken links rather than real links because in the
382
+ // case of an inherited symbol, we'll end up referencing a single symbol ID rather than one
383
+ // for each class.
309
384
  function link(target) {
310
385
  if (!target)
311
386
  return;
@@ -322,79 +397,23 @@ function createLink(context, reflection, clause, expr, symbol, isInherit) {
322
397
  }
323
398
  }
324
399
  }
325
- /**
326
- * Responsible for copying comments from "parent" reflections defined
327
- * in either a base class or implemented interface to the child class.
328
- */
329
- function handleInheritedComments(child, parent) {
330
- copyComment(child, parent);
331
- if (parent.kindOf(index_1.ReflectionKind.Property) &&
332
- child.kindOf(index_1.ReflectionKind.Accessor)) {
333
- if (child.getSignature) {
334
- copyComment(child.getSignature, parent);
335
- child.getSignature.implementationOf = child.implementationOf;
336
- }
337
- if (child.setSignature) {
338
- copyComment(child.setSignature, parent);
339
- child.setSignature.implementationOf = child.implementationOf;
340
- }
341
- }
342
- if (parent.kindOf(index_1.ReflectionKind.Accessor) &&
343
- child.kindOf(index_1.ReflectionKind.Accessor)) {
344
- if (parent.getSignature && child.getSignature) {
345
- copyComment(child.getSignature, parent.getSignature);
346
- }
347
- if (parent.setSignature && child.setSignature) {
348
- copyComment(child.setSignature, parent.setSignature);
349
- }
350
- }
351
- if (parent.kindOf(index_1.ReflectionKind.FunctionOrMethod) &&
352
- parent.signatures &&
353
- child.signatures) {
354
- for (const [cs, ps] of (0, array_1.zip)(child.signatures, parent.signatures)) {
355
- copyComment(cs, ps);
356
- }
357
- }
358
- else if (parent.kindOf(index_1.ReflectionKind.Property) &&
359
- parent.type instanceof types_1.ReflectionType &&
360
- parent.type.declaration.signatures &&
361
- child.signatures) {
362
- for (const [cs, ps] of (0, array_1.zip)(child.signatures, parent.type.declaration.signatures)) {
363
- copyComment(cs, ps);
364
- }
400
+ function shouldCopyComment(target, source, revivingSerialized) {
401
+ if (!source.comment) {
402
+ return false;
365
403
  }
366
- }
367
- /**
368
- * Copy the comment of the source reflection to the target reflection with a JSDoc style copy
369
- * function. The TSDoc copy function is in the InheritDocPlugin.
370
- */
371
- function copyComment(target, source) {
372
404
  if (target.comment) {
405
+ // If we're reviving, then the revived project might have a better comment
406
+ // on source, so copy it.
407
+ if (revivingSerialized && source.comment.similarTo(target.comment)) {
408
+ return true;
409
+ }
373
410
  // We might still want to copy, if the child has a JSDoc style inheritDoc tag.
374
411
  const tag = target.comment.getTag("@inheritDoc");
375
412
  if (!tag || tag.name) {
376
- return;
377
- }
378
- }
379
- if (!source.comment) {
380
- return;
381
- }
382
- target.comment = source.comment.clone();
383
- if (target instanceof index_1.DeclarationReflection &&
384
- source instanceof index_1.DeclarationReflection) {
385
- for (const [tt, ts] of (0, array_1.zip)(target.typeParameters || [], source.typeParameters || [])) {
386
- copyComment(tt, ts);
387
- }
388
- }
389
- if (target instanceof index_1.SignatureReflection &&
390
- source instanceof index_1.SignatureReflection) {
391
- for (const [tt, ts] of (0, array_1.zip)(target.typeParameters || [], source.typeParameters || [])) {
392
- copyComment(tt, ts);
393
- }
394
- for (const [pt, ps] of (0, array_1.zip)(target.parameters || [], source.parameters || [])) {
395
- copyComment(pt, ps);
413
+ return false;
396
414
  }
397
415
  }
416
+ return true;
398
417
  }
399
418
  function findMatchingMember(toMatch, container) {
400
419
  return container.children?.find((child) => child.name == toMatch.name &&
@@ -92,10 +92,12 @@ let LinkResolverPlugin = (() => {
92
92
  type.elementSummaries = type.elementSummaries?.map((parts) => this.owner.resolveLinks(parts, reflection));
93
93
  },
94
94
  }));
95
+ if (reflection.readme) {
96
+ reflection.readme = this.owner.resolveLinks(reflection.readme, reflection);
97
+ }
95
98
  }
96
- if (reflection instanceof models_1.DeclarationReflection &&
97
- reflection.readme) {
98
- reflection.readme = this.owner.resolveLinks(reflection.readme, reflection);
99
+ if (reflection.isDocument()) {
100
+ reflection.content = this.owner.resolveLinks(reflection.content, reflection);
99
101
  }
100
102
  if (reflection instanceof models_1.ContainerReflection) {
101
103
  if (reflection.groups) {
@@ -54,6 +54,8 @@ export declare const translatable: {
54
54
  readonly failed_to_resolve_link_to_0_in_comment_for_1_may_have_meant_2: "Failed to resolve link to \"{0}\" in comment for {1}. You may have wanted \"{2}\"";
55
55
  readonly failed_to_resolve_link_to_0_in_readme_for_1: "Failed to resolve link to \"{0}\" in readme for {1}";
56
56
  readonly failed_to_resolve_link_to_0_in_readme_for_1_may_have_meant_2: "Failed to resolve link to \"{0}\" in readme for {1}. You may have wanted \"{2}\"";
57
+ readonly failed_to_resolve_link_to_0_in_document_1: "Failed to resolve link to \"{0}\" in document {1}";
58
+ readonly failed_to_resolve_link_to_0_in_document_1_may_have_meant_2: "Failed to resolve link to \"{0}\" in document {1}. You may have wanted \"{2}\"";
57
59
  readonly type_0_defined_in_1_is_referenced_by_2_but_not_included_in_docs: "{0}, defined in {1}, is referenced by {2} but not included in the documentation";
58
60
  readonly reflection_0_kind_1_defined_in_2_does_not_have_any_documentation: "{0} ({1}), defined in {2}, does not have any documentation";
59
61
  readonly invalid_intentionally_not_exported_symbols_0: "The following symbols were marked as intentionally not exported, but were either not referenced in the documentation, or were exported:\n\t{0}";
@@ -64,6 +64,8 @@ exports.translatable = {
64
64
  failed_to_resolve_link_to_0_in_comment_for_1_may_have_meant_2: `Failed to resolve link to "{0}" in comment for {1}. You may have wanted "{2}"`,
65
65
  failed_to_resolve_link_to_0_in_readme_for_1: `Failed to resolve link to "{0}" in readme for {1}`,
66
66
  failed_to_resolve_link_to_0_in_readme_for_1_may_have_meant_2: `Failed to resolve link to "{0}" in readme for {1}. You may have wanted "{2}"`,
67
+ failed_to_resolve_link_to_0_in_document_1: `Failed to resolve link to "{0}" in document {1}`,
68
+ failed_to_resolve_link_to_0_in_document_1_may_have_meant_2: `Failed to resolve link to "{0}" in document {1}. You may have wanted "{2}"`,
67
69
  type_0_defined_in_1_is_referenced_by_2_but_not_included_in_docs: `{0}, defined in {1}, is referenced by {2} but not included in the documentation`,
68
70
  reflection_0_kind_1_defined_in_2_does_not_have_any_documentation: `{0} ({1}), defined in {2}, does not have any documentation`,
69
71
  invalid_intentionally_not_exported_symbols_0: "The following symbols were marked as intentionally not exported, but were either not referenced in the documentation, or were exported:\n\t{0}",
@@ -49,6 +49,9 @@ class FileRegistry {
49
49
  const absolute = this.mediaToPath.get(id);
50
50
  if (!absolute)
51
51
  return;
52
+ if (this.names.has(id)) {
53
+ return this.names.get(id);
54
+ }
52
55
  const file = (0, path_1.basename)(absolute);
53
56
  if (!this.nameUsage.has(file)) {
54
57
  this.nameUsage.set(file, 1);
@@ -93,6 +93,12 @@ export declare class CommentTag {
93
93
  * Create a new CommentTag instance.
94
94
  */
95
95
  constructor(tag: `@${string}`, text: CommentDisplayPart[]);
96
+ /**
97
+ * Checks if this block tag is roughly equal to the other tag.
98
+ * This isn't exactly equal, but just "roughly equal" by the tag
99
+ * text.
100
+ */
101
+ similarTo(other: CommentTag): boolean;
96
102
  clone(): CommentTag;
97
103
  toObject(serializer: Serializer): JSONOutput.CommentTag;
98
104
  fromObject(de: Deserializer, obj: JSONOutput.CommentTag): void;
@@ -191,6 +197,12 @@ export declare class Comment {
191
197
  * Creates a new Comment instance.
192
198
  */
193
199
  constructor(summary?: CommentDisplayPart[], blockTags?: CommentTag[], modifierTags?: Set<`@${string}`>);
200
+ /**
201
+ * Checks if this comment is roughly equal to the other comment.
202
+ * This isn't exactly equal, but just "roughly equal" by the comment
203
+ * text.
204
+ */
205
+ similarTo(other: Comment): boolean;
194
206
  /**
195
207
  * Create a deep clone of this comment.
196
208
  */
@@ -58,6 +58,17 @@ class CommentTag {
58
58
  this.tag = tag;
59
59
  this.content = text;
60
60
  }
61
+ /**
62
+ * Checks if this block tag is roughly equal to the other tag.
63
+ * This isn't exactly equal, but just "roughly equal" by the tag
64
+ * text.
65
+ */
66
+ similarTo(other) {
67
+ return (this.tag === other.tag &&
68
+ this.name === other.tag &&
69
+ Comment.combineDisplayParts(this.content) ===
70
+ Comment.combineDisplayParts(other.content));
71
+ }
61
72
  clone() {
62
73
  const tag = new CommentTag(this.tag, Comment.cloneDisplayParts(this.content));
63
74
  if (this.name) {
@@ -317,6 +328,28 @@ let Comment = (() => {
317
328
  this.modifierTags = modifierTags;
318
329
  extractLabelTag(this);
319
330
  }
331
+ /**
332
+ * Checks if this comment is roughly equal to the other comment.
333
+ * This isn't exactly equal, but just "roughly equal" by the comment
334
+ * text.
335
+ */
336
+ similarTo(other) {
337
+ if (_a.combineDisplayParts(this.summary) !==
338
+ _a.combineDisplayParts(other.summary)) {
339
+ return false;
340
+ }
341
+ // Ignore modifier tags, as they could cause false negatives
342
+ // if a cascaded modifier tag is present in one comment but not the other.
343
+ if (this.blockTags.length !== other.blockTags.length) {
344
+ return false;
345
+ }
346
+ for (let i = 0; i < this.blockTags.length; ++i) {
347
+ if (!this.blockTags[i].similarTo(other.blockTags[i])) {
348
+ return false;
349
+ }
350
+ }
351
+ return true;
352
+ }
320
353
  /**
321
354
  * Create a deep clone of this comment.
322
355
  */
@@ -1,4 +1,4 @@
1
- export { PageEvent, RendererEvent, MarkdownEvent, IndexEvent } from "./events";
1
+ export { PageEvent, RendererEvent, MarkdownEvent, IndexEvent, type PageHeading, } from "./events";
2
2
  export { UrlMapping } from "./models/UrlMapping";
3
3
  export type { RenderTemplate } from "./models/UrlMapping";
4
4
  export { Renderer, type RendererEvents } from "./renderer";
@@ -228,7 +228,7 @@ class DefaultTheme extends theme_1.Theme {
228
228
  }
229
229
  render(page, template) {
230
230
  const templateOutput = this.defaultLayoutTemplate(page, template);
231
- return "<!DOCTYPE html>" + utils_1.JSX.renderElement(templateOutput);
231
+ return "<!DOCTYPE html>" + utils_1.JSX.renderElement(templateOutput) + "\n";
232
232
  }
233
233
  /**
234
234
  * If implementing a custom theme, it is recommended to override {@link buildNavigation} instead.
@@ -248,29 +248,36 @@ class DefaultTheme extends theme_1.Theme {
248
248
  const leaves = this.application.options.getValue("navigationLeaves");
249
249
  return getNavigationElements(project) || [];
250
250
  function toNavigation(element) {
251
+ const children = getNavigationElements(element);
251
252
  if (element instanceof models_1.ReflectionCategory || element instanceof models_1.ReflectionGroup) {
253
+ if (!children?.length) {
254
+ return;
255
+ }
252
256
  return {
253
257
  text: element.title,
254
- children: getNavigationElements(element),
258
+ children,
255
259
  };
256
260
  }
261
+ if (!element.hasOwnDocument) {
262
+ return;
263
+ }
257
264
  return {
258
265
  text: (0, lib_1.getDisplayName)(element),
259
266
  path: element.url,
260
267
  kind: element.kind,
261
268
  class: (0, lib_1.classNames)({ deprecated: element.isDeprecated() }, theme.getReflectionClasses(element)),
262
- children: getNavigationElements(element),
269
+ children: children?.length ? children : undefined,
263
270
  };
264
271
  }
265
272
  function getNavigationElements(parent) {
266
273
  if (parent instanceof models_1.ReflectionCategory) {
267
- return parent.children.map(toNavigation);
274
+ return (0, utils_1.filterMap)(parent.children, toNavigation);
268
275
  }
269
276
  if (parent instanceof models_1.ReflectionGroup) {
270
277
  if (shouldShowCategories(parent.owningReflection, opts) && parent.categories) {
271
- return parent.categories.map(toNavigation);
278
+ return (0, utils_1.filterMap)(parent.categories, toNavigation);
272
279
  }
273
- return parent.children.map(toNavigation);
280
+ return (0, utils_1.filterMap)(parent.children, toNavigation);
274
281
  }
275
282
  if (leaves.includes(parent.getFullName())) {
276
283
  return;
@@ -279,23 +286,23 @@ class DefaultTheme extends theme_1.Theme {
279
286
  return;
280
287
  }
281
288
  if (parent.isDocument()) {
282
- return parent.children?.map(toNavigation);
289
+ return (0, utils_1.filterMap)(parent.children, toNavigation);
283
290
  }
284
291
  if (!parent.kindOf(models_1.ReflectionKind.SomeModule | models_1.ReflectionKind.Project)) {
285
292
  // Tricky: Non-module children don't show up in the navigation pane,
286
293
  // but any documents added by them should.
287
- return parent.documents?.map(toNavigation);
294
+ return (0, utils_1.filterMap)(parent.documents, toNavigation);
288
295
  }
289
296
  if (parent.categories && shouldShowCategories(parent, opts)) {
290
- return parent.categories.map(toNavigation);
297
+ return (0, utils_1.filterMap)(parent.categories, toNavigation);
291
298
  }
292
299
  if (parent.groups && shouldShowGroups(parent, opts)) {
293
- return parent.groups.map(toNavigation);
300
+ return (0, utils_1.filterMap)(parent.groups, toNavigation);
294
301
  }
295
302
  if (opts.includeFolders && parent.childrenIncludingDocuments?.some((child) => child.name.includes("/"))) {
296
303
  return deriveModuleFolders(parent.childrenIncludingDocuments);
297
304
  }
298
- return parent.childrenIncludingDocuments?.map(toNavigation);
305
+ return (0, utils_1.filterMap)(parent.childrenIncludingDocuments, toNavigation);
299
306
  }
300
307
  function deriveModuleFolders(children) {
301
308
  const result = [];
@@ -318,12 +325,14 @@ class DefaultTheme extends theme_1.Theme {
318
325
  };
319
326
  // Note: This might end up putting a module within another module if we document
320
327
  // both foo/index.ts and foo/bar.ts.
321
- for (const child of children) {
322
- const parts = child.name.split("/");
323
- const collection = resolveOrCreateParents(parts);
328
+ for (const child of children.filter((c) => c.hasOwnDocument)) {
324
329
  const nav = toNavigation(child);
325
- nav.text = parts[parts.length - 1];
326
- collection.push(nav);
330
+ if (nav) {
331
+ const parts = child.name.split("/");
332
+ const collection = resolveOrCreateParents(parts);
333
+ nav.text = parts[parts.length - 1];
334
+ collection.push(nav);
335
+ }
327
336
  }
328
337
  // Now merge single-possible-paths together so we don't have folders in our navigation
329
338
  // which contain only another single folder.
@@ -1,4 +1,4 @@
1
1
  import type { DefaultThemeRenderContext } from "../DefaultThemeRenderContext";
2
2
  import { JSX } from "../../../../utils";
3
3
  import type { ReferenceReflection } from "../../../../models";
4
- export declare const memberReference: ({ urlTo, i18n }: DefaultThemeRenderContext, props: ReferenceReflection) => JSX.Element;
4
+ export declare const memberReference: ({ urlTo, i18n, commentSummary, commentTags }: DefaultThemeRenderContext, props: ReferenceReflection) => JSX.Element;
@@ -2,23 +2,29 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.memberReference = void 0;
4
4
  const utils_1 = require("../../../../utils");
5
- const memberReference = ({ urlTo, i18n }, props) => {
5
+ const memberReference = ({ urlTo, i18n, commentSummary, commentTags }, props) => {
6
6
  const referenced = props.tryGetTargetReflectionDeep();
7
7
  if (!referenced) {
8
8
  return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
9
9
  i18n.theme_re_exports(),
10
10
  " ",
11
- props.name));
11
+ props.name,
12
+ commentSummary(props),
13
+ commentTags(props)));
12
14
  }
13
15
  if (props.name === referenced.name) {
14
16
  return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
15
17
  i18n.theme_re_exports(),
16
18
  " ",
17
- utils_1.JSX.createElement("a", { href: urlTo(referenced) }, referenced.name)));
19
+ utils_1.JSX.createElement("a", { href: urlTo(referenced) }, referenced.name),
20
+ commentSummary(props),
21
+ commentTags(props)));
18
22
  }
19
23
  return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
20
24
  i18n.theme_renames_and_re_exports(),
21
25
  " ",
22
- utils_1.JSX.createElement("a", { href: urlTo(referenced) }, referenced.name)));
26
+ utils_1.JSX.createElement("a", { href: urlTo(referenced) }, referenced.name),
27
+ commentSummary(props),
28
+ commentTags(props)));
23
29
  };
24
30
  exports.memberReference = memberReference;
@@ -1,7 +1,7 @@
1
1
  export declare const emptyArray: readonly [];
2
2
  /**
3
3
  * Inserts an item into an array sorted by priority. If two items have the same priority,
4
- * the item will be inserted later will be placed earlier in the array.
4
+ * the item will be inserted later will be placed later in the array.
5
5
  * @param arr modified by inserting item.
6
6
  * @param item
7
7
  */
@@ -48,6 +48,6 @@ export declare function partition<T>(iter: Iterable<T>, predicate: (item: T) =>
48
48
  export declare function zip<T extends Iterable<any>[]>(...args: T): Iterable<{
49
49
  [K in keyof T]: T[K] extends Iterable<infer U> ? U : T[K];
50
50
  }>;
51
- export declare function filterMap<T, U>(iter: Iterable<T>, fn: (item: T) => U | undefined): U[];
51
+ export declare function filterMap<T, U>(iter: Iterable<T> | undefined, fn: (item: T) => U | undefined): U[];
52
52
  export declare function firstDefined<T, U>(array: readonly T[] | undefined, callback: (element: T, index: number) => U | undefined): U | undefined;
53
53
  export declare function filter<T>(array: readonly T[] | undefined, predicate: (value: T, index: number, array: readonly T[]) => boolean): readonly T[];