typedoc 0.28.11 → 0.28.13

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 (48) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/lib/application.d.ts +4 -0
  3. package/dist/lib/application.js +8 -1
  4. package/dist/lib/converter/comments/discovery.js +12 -0
  5. package/dist/lib/converter/comments/parser.js +3 -0
  6. package/dist/lib/converter/comments/textParser.js +12 -8
  7. package/dist/lib/converter/plugins/CommentPlugin.d.ts +3 -2
  8. package/dist/lib/converter/plugins/ImplementsPlugin.js +25 -12
  9. package/dist/lib/converter/plugins/InheritDocPlugin.js +2 -0
  10. package/dist/lib/converter/plugins/SourcePlugin.d.ts +1 -2
  11. package/dist/lib/converter/plugins/SourcePlugin.js +5 -10
  12. package/dist/lib/converter/symbols.js +5 -1
  13. package/dist/lib/converter/types.js +2 -2
  14. package/dist/lib/internationalization/locales/en.cjs +4 -1
  15. package/dist/lib/internationalization/locales/en.d.cts +4 -1
  16. package/dist/lib/models/Comment.d.ts +15 -15
  17. package/dist/lib/models/Comment.js +12 -5
  18. package/dist/lib/models/DeclarationReflection.js +1 -1
  19. package/dist/lib/models/FileRegistry.js +1 -1
  20. package/dist/lib/models/ProjectReflection.js +2 -2
  21. package/dist/lib/models/Reflection.d.ts +3 -3
  22. package/dist/lib/models/Reflection.js +3 -3
  23. package/dist/lib/models/types.d.ts +1 -1
  24. package/dist/lib/models/types.js +4 -2
  25. package/dist/lib/output/themes/MarkedPlugin.js +11 -1
  26. package/dist/lib/output/themes/default/partials/comment.js +13 -12
  27. package/dist/lib/output/themes/default/partials/member.declaration.js +1 -1
  28. package/dist/lib/output/themes/default/partials/member.signature.body.js +1 -1
  29. package/dist/lib/output/themes/default/partials/moduleReflection.js +1 -1
  30. package/dist/lib/output/themes/default/partials/typeAndParent.d.ts +1 -1
  31. package/dist/lib/output/themes/default/partials/typeAndParent.js +18 -8
  32. package/dist/lib/output/themes/default/partials/typeDetails.js +21 -19
  33. package/dist/lib/output/themes/default/templates/reflection.js +1 -1
  34. package/dist/lib/serialization/deserializer.d.ts +2 -2
  35. package/dist/lib/serialization/deserializer.js +1 -1
  36. package/dist/lib/serialization/schema.d.ts +3 -3
  37. package/dist/lib/utils/ValidatingFileRegistry.d.ts +2 -0
  38. package/dist/lib/utils/ValidatingFileRegistry.js +18 -3
  39. package/dist/lib/utils/entry-point.js +3 -2
  40. package/dist/lib/utils/options/declaration.d.ts +10 -9
  41. package/dist/lib/utils/options/defaults.d.ts +7 -7
  42. package/dist/lib/utils/options/readers/arguments.js +2 -2
  43. package/dist/lib/utils/options/sources/typedoc.js +19 -26
  44. package/dist/lib/utils-common/i18n.d.ts +2 -1
  45. package/dist/lib/utils-common/index.d.ts +1 -0
  46. package/dist/lib/utils-common/validation.d.ts +2 -1
  47. package/package.json +9 -9
  48. package/static/main.js +2 -2
package/dist/index.d.ts CHANGED
@@ -41,7 +41,7 @@ export type { Icons, NavigationElement, PageDefinition, PageHeading, RendererEve
41
41
  export { Outputs } from "./lib/output/output.js";
42
42
  export { ArgumentsReader, CommentStyle, EntryPointStrategy, normalizePath, Option, OptionDefaults, Options, PackageJsonReader, ParameterHint, ParameterType, TSConfigReader, TypeDocReader, ValidatingFileRegistry, } from "./lib/utils/index.js";
43
43
  export type { ArrayDeclarationOption, BooleanDeclarationOption, DeclarationOption, DeclarationOptionBase, DeclarationOptionToOptionType, DocumentationEntryPoint, FancyConsoleLogger, FlagsDeclarationOption, JsDocCompatibility, KeyToDeclaration, ManuallyValidatedOption, MapDeclarationOption, MixedDeclarationOption, NumberDeclarationOption, ObjectDeclarationOption, OptionsReader, OutputSpecification, ParameterTypeToOptionTypeMap, SortStrategy, StringDeclarationOption, TypeDocOptionMap, TypeDocOptions, TypeDocOptionValues, ValidationOptions, } from "./lib/utils/index.js";
44
- export { type ComponentPath, ConsoleLogger, type DeclarationReference, type EnumKeys, EventDispatcher, EventHooks, type GlobString, i18n, JSX, Logger, LogLevel, type Meaning, type MeaningKeyword, type MinimalNode, MinimalSourceFile, type NormalizedPath, type NormalizedPathOrModule, type NormalizedPathOrModuleOrFunction, type SymbolReference, type TranslatedString, translateTagName, } from "#utils";
44
+ export { type ComponentPath, ConsoleLogger, type DeclarationReference, type EnumKeys, EventDispatcher, EventHooks, type GlobString, i18n, JSX, Logger, LogLevel, type Meaning, type MeaningKeyword, type MinimalNode, MinimalSourceFile, type NormalizedPath, type NormalizedPathOrModule, type NormalizedPathOrModuleOrFunction, type SymbolReference, type TagString, type TranslatedString, translateTagName, } from "#utils";
45
45
  export { type Deserializable, Deserializer, type DeserializerComponent, JSONOutput, SerializeEvent, Serializer, type SerializerComponent, type SerializerEvents, } from "./lib/serialization/index.js";
46
46
  export * as Internationalization from "./lib/internationalization/index.js";
47
47
  export type { TranslatableStrings } from "./lib/internationalization/internationalization.js";
@@ -67,6 +67,10 @@ export declare class Application extends AbstractComponent<Application, Applicat
67
67
  */
68
68
  internationalization: Internationalization;
69
69
  options: Options;
70
+ /**
71
+ * Due for deprecation in 0.29, use the reference to this on {@link ProjectReflection},
72
+ * this was the wrong place for this member to live.
73
+ */
70
74
  files: FileRegistry;
71
75
  /** @internal */
72
76
  accessor lang: string;
@@ -158,6 +158,10 @@ let Application = (() => {
158
158
  */
159
159
  internationalization = new Internationalization();
160
160
  options = new Options();
161
+ /**
162
+ * Due for deprecation in 0.29, use the reference to this on {@link ProjectReflection},
163
+ * this was the wrong place for this member to live.
164
+ */
161
165
  files = new ValidatingFileRegistry();
162
166
  #lang_accessor_storage = __runInitializers(this, _lang_initializers, void 0);
163
167
  /** @internal */
@@ -260,6 +264,9 @@ let Application = (() => {
260
264
  else {
261
265
  this.logger.level = this.options.getValue("logLevel");
262
266
  }
267
+ if (this.files instanceof ValidatingFileRegistry) {
268
+ this.files.basePath = this.options.getValue("basePath");
269
+ }
263
270
  for (const [lang, locales] of Object.entries(this.options.getValue("locales"))) {
264
271
  this.internationalization.addTranslations(lang, locales);
265
272
  }
@@ -630,7 +637,7 @@ let Application = (() => {
630
637
  for (const { dir, options } of projectsToConvert) {
631
638
  this.logger.info(i18n.converting_project_at_0(nicePath(dir)));
632
639
  this.options = options;
633
- this.files = new ValidatingFileRegistry();
640
+ this.files = new ValidatingFileRegistry(options.getValue("basePath"));
634
641
  let project = await this.convert();
635
642
  if (project) {
636
643
  this.validate(project);
@@ -4,6 +4,7 @@ import { CommentStyle } from "../../utils/options/declaration.js";
4
4
  import { nicePath } from "../../utils/paths.js";
5
5
  import { ok } from "assert";
6
6
  import { assertNever, filter, firstDefined, i18n } from "#utils";
7
+ import { resolveAliasedSymbol } from "../utils/symbols.js";
7
8
  const variablePropertyKinds = [
8
9
  ts.SyntaxKind.PropertyDeclaration,
9
10
  ts.SyntaxKind.PropertySignature,
@@ -415,6 +416,17 @@ function declarationToCommentNodes(node, checker) {
415
416
  });
416
417
  }
417
418
  }
419
+ // #3003 even more magic for handling an imported symbol which appears in a shorthand property assignment
420
+ const originalSymbol = sourceSymbol && resolveAliasedSymbol(sourceSymbol, checker);
421
+ if (originalSymbol !== sourceSymbol && originalSymbol?.valueDeclaration) {
422
+ const commentNode = declarationToCommentNodeIgnoringParents(originalSymbol?.valueDeclaration);
423
+ if (commentNode) {
424
+ result.push({
425
+ node: commentNode,
426
+ inheritedFromParentDeclaration: true,
427
+ });
428
+ }
429
+ }
418
430
  }
419
431
  // With overloaded functions/methods, TypeScript will use the comment on the first signature
420
432
  // declaration
@@ -206,6 +206,9 @@ function postProcessComment(comment, i18n, getPosition, warning) {
206
206
  if ((inlineInheritDoc.length || inheritDoc.length) && remarks.length) {
207
207
  warning(i18n.content_in_remarks_block_overwritten_by_inheritdoc_in_comment_at_0(getPosition()));
208
208
  }
209
+ if ((inlineInheritDoc.length || inheritDoc.length) && returns.length) {
210
+ warning(i18n.content_in_returns_block_overwritten_by_inheritdoc_in_comment_at_0(getPosition()));
211
+ }
209
212
  }
210
213
  const aliasedTags = new Map([["@return", "@returns"]]);
211
214
  function blockTag(comment, lexer, config, i18n, warning, files) {
@@ -166,8 +166,9 @@ function checkMarkdownLink(data, reentry) {
166
166
  if (link.ok) {
167
167
  // Only make a relative-link display part if it's actually a relative link.
168
168
  // Discard protocol:// links, unix style absolute paths, and windows style absolute paths.
169
- if (isRelativePath(link.str)) {
170
- const { target, anchor } = files.register(sourcePath, link.str) || { target: undefined, anchor: undefined };
169
+ const decoded = decodeURI(link.str);
170
+ if (isRelativePath(decoded)) {
171
+ const { target, anchor } = files.register(sourcePath, decoded) || { target: undefined, anchor: undefined };
171
172
  return {
172
173
  pos: lookahead,
173
174
  end: link.pos,
@@ -213,8 +214,9 @@ function checkReference(data) {
213
214
  }
214
215
  const link = MdHelpers.parseLinkDestination(token.text, lookahead, token.text.length);
215
216
  if (link.ok) {
216
- if (isRelativePath(link.str)) {
217
- const { target, anchor } = files.register(sourcePath, link.str) || { target: undefined, anchor: undefined };
217
+ const decoded = decodeURI(link.str);
218
+ if (isRelativePath(decoded)) {
219
+ const { target, anchor } = files.register(sourcePath, decoded) || { target: undefined, anchor: undefined };
218
220
  return {
219
221
  pos: lookahead,
220
222
  end: link.pos,
@@ -273,8 +275,9 @@ function checkAttributes(data, attributes) {
273
275
  return links;
274
276
  }
275
277
  function checkAttributeDirectPath(data, text, pos, end) {
276
- if (isRelativePath(text.trim())) {
277
- const { target, anchor } = data.files.register(data.sourcePath, text.trim()) || { target: undefined, anchor: undefined };
278
+ const decoded = decodeURI(text.trim());
279
+ if (isRelativePath(decoded)) {
280
+ const { target, anchor } = data.files.register(data.sourcePath, decoded) || { target: undefined, anchor: undefined };
278
281
  return [{
279
282
  pos,
280
283
  end,
@@ -302,8 +305,9 @@ function checkAttributeSrcSet(data, text, pos, _end) {
302
305
  // TypeDoc: We don't exactly match this, PR welcome! For now, just permit anything
303
306
  // that's not whitespace or a comma
304
307
  const url = text.slice(textPos).match(/^[^\t\r\f\n ,]+/);
305
- if (url && isRelativePath(url[0])) {
306
- const { target, anchor } = data.files.register(data.sourcePath, url[0]) || { target: undefined, anchor: undefined };
308
+ const decoded = url && decodeURI(url[0]);
309
+ if (decoded && isRelativePath(decoded)) {
310
+ const { target, anchor } = data.files.register(data.sourcePath, decoded) || { target: undefined, anchor: undefined };
307
311
  result.push({
308
312
  pos: pos + textPos,
309
313
  end: pos + textPos + url[0].length,
@@ -1,3 +1,4 @@
1
+ import { type TagString } from "#utils";
1
2
  import { ConverterComponent } from "../components.js";
2
3
  import type { Converter } from "../converter.js";
3
4
  /**
@@ -56,8 +57,8 @@ import type { Converter } from "../converter.js";
56
57
  * - Resolve `@link` tags to point to target reflections
57
58
  */
58
59
  export declare class CommentPlugin extends ConverterComponent {
59
- accessor excludeTags: `@${string}`[];
60
- accessor cascadedModifierTags: `@${string}`[];
60
+ accessor excludeTags: TagString[];
61
+ accessor cascadedModifierTags: TagString[];
61
62
  accessor excludeInternal: boolean;
62
63
  accessor excludePrivate: boolean;
63
64
  accessor excludeProtected: boolean;
@@ -4,7 +4,7 @@ import { DeclarationReflection, ReflectionFlag, ReflectionKind, SignatureReflect
4
4
  import { ReferenceType, ReflectionType } from "../../models/types.js";
5
5
  import { filterMap, zip } from "#utils";
6
6
  import { ConverterComponent } from "../components.js";
7
- import { getHumanName } from "../../utils/index.js";
7
+ import { findPackageForPath, getHumanName } from "../../utils/index.js";
8
8
  import { ConverterEvents } from "../converter-events.js";
9
9
  /**
10
10
  * A plugin that detects interface implementations of functions and
@@ -95,22 +95,23 @@ export class ImplementsPlugin extends ConverterComponent {
95
95
  // serialization/deserialization, might point to an unexpected location. (See the mixin
96
96
  // converter tests, I suspect this might actually be an indication of something else slightly
97
97
  // broken there, but don't want to spend more time with this right now.)
98
- // #2982, even more unfortunately, we only want to keep the link if it is pointing to a reflection
99
- // which will receive a link during rendering.
100
- const isValidRef = (ref) => ref.reflection && !ref.reflection.parent?.kindOf(ReflectionKind.TypeLiteral);
98
+ // #2982/#3007, even more unfortunately, we only want to keep the link if it is pointing
99
+ // to a reflection which will receive a link during rendering, we pick this based on it being
100
+ // the type of member we expect to point to.
101
+ const isValidRef = (ref) => !!ref.reflection?.parent?.kindOf(ReflectionKind.ClassOrInterface | ReflectionKind.Method | ReflectionKind.Constructor);
101
102
  for (const child of reflection.children || []) {
102
103
  if (child.inheritedFrom && !isValidRef(child.inheritedFrom)) {
103
- child.inheritedFrom = ReferenceType.createBrokenReference(child.inheritedFrom.name, project);
104
+ child.inheritedFrom = ReferenceType.createBrokenReference(child.inheritedFrom.name, project, child.inheritedFrom.package);
104
105
  }
105
106
  if (child.overwrites && !isValidRef(child.overwrites)) {
106
- child.overwrites = ReferenceType.createBrokenReference(child.overwrites.name, project);
107
+ child.overwrites = ReferenceType.createBrokenReference(child.overwrites.name, project, child.overwrites.package);
107
108
  }
108
109
  for (const childSig of child.getAllSignatures()) {
109
110
  if (childSig.inheritedFrom && !isValidRef(childSig.inheritedFrom)) {
110
- childSig.inheritedFrom = ReferenceType.createBrokenReference(childSig.inheritedFrom.name, project);
111
+ childSig.inheritedFrom = ReferenceType.createBrokenReference(childSig.inheritedFrom.name, project, childSig.inheritedFrom.package);
111
112
  }
112
113
  if (childSig.overwrites && !isValidRef(childSig.overwrites)) {
113
- childSig.overwrites = ReferenceType.createBrokenReference(childSig.overwrites.name, project);
114
+ childSig.overwrites = ReferenceType.createBrokenReference(childSig.overwrites.name, project, childSig.overwrites.package);
114
115
  }
115
116
  }
116
117
  }
@@ -325,15 +326,27 @@ export class ImplementsPlugin extends ConverterComponent {
325
326
  }
326
327
  }
327
328
  }
329
+ function getConstructorPackagePath(context, clause) {
330
+ const symbol = context.getSymbolAtLocation(clause.expression);
331
+ if (!symbol)
332
+ return undefined;
333
+ const resolvedSymbol = context.resolveAliasedSymbol(symbol);
334
+ const symbolPath = resolvedSymbol?.declarations?.[0]?.getSourceFile().fileName;
335
+ if (!symbolPath)
336
+ return undefined;
337
+ return findPackageForPath(symbolPath)?.[0];
338
+ }
328
339
  function constructorInheritance(context, reflection, childDecl, constructorDecl) {
329
340
  const extendsClause = childDecl.heritageClauses?.find((cl) => cl.token === ts.SyntaxKind.ExtendsKeyword);
330
341
  if (!extendsClause)
331
342
  return;
332
- const name = `${extendsClause.types[0].getText()}.constructor`;
343
+ const extendsType = extendsClause.types[0];
344
+ const refPackage = getConstructorPackagePath(context, extendsType);
345
+ const name = `${extendsType.getText()}.constructor`;
333
346
  const key = constructorDecl ? "overwrites" : "inheritedFrom";
334
- reflection[key] ??= ReferenceType.createBrokenReference(name, context.project);
347
+ reflection[key] ??= ReferenceType.createBrokenReference(name, context.project, refPackage);
335
348
  for (const sig of reflection.signatures ?? []) {
336
- sig[key] ??= ReferenceType.createBrokenReference(name, context.project);
349
+ sig[key] ??= ReferenceType.createBrokenReference(name, context.project, refPackage);
337
350
  }
338
351
  }
339
352
  function findProperty(reflection, parent) {
@@ -356,7 +369,7 @@ function createLink(context, reflection, clause, expr, symbol, isInherit) {
356
369
  const rootSymbols = context.checker.getRootSymbols(symbol);
357
370
  const ref = rootSymbols.length && rootSymbols[0] != symbol
358
371
  ? context.createSymbolReference(rootSymbols[0], context, name)
359
- : ReferenceType.createBrokenReference(name, context.project);
372
+ : ReferenceType.createBrokenReference(name, context.project, undefined);
360
373
  link(reflection);
361
374
  link(reflection.getSignature);
362
375
  link(reflection.setSignature);
@@ -149,6 +149,8 @@ let InheritDocPlugin = (() => {
149
149
  return;
150
150
  }
151
151
  target.comment.removeTags("@inheritDoc");
152
+ target.comment.removeTags("@remarks");
153
+ target.comment.removeTags("@returns");
152
154
  target.comment.summary = Comment.cloneDisplayParts(source.comment.summary);
153
155
  const remarks = source.comment.getTag("@remarks");
154
156
  if (remarks) {
@@ -1,6 +1,5 @@
1
1
  import { ConverterComponent } from "../components.js";
2
2
  import type { Converter } from "../converter.js";
3
- import { type NormalizedPath } from "#utils";
4
3
  /**
5
4
  * A handler that attaches source file information to reflections.
6
5
  */
@@ -10,7 +9,7 @@ export declare class SourcePlugin extends ConverterComponent {
10
9
  accessor gitRemote: string;
11
10
  accessor disableGit: boolean;
12
11
  accessor sourceLinkTemplate: string;
13
- accessor basePath: NormalizedPath;
12
+ get displayBasePath(): import("#utils").NormalizedPath;
14
13
  /**
15
14
  * All file names to find the base path from.
16
15
  */
@@ -62,9 +62,6 @@ let SourcePlugin = (() => {
62
62
  let _sourceLinkTemplate_decorators;
63
63
  let _sourceLinkTemplate_initializers = [];
64
64
  let _sourceLinkTemplate_extraInitializers = [];
65
- let _basePath_decorators;
66
- let _basePath_initializers = [];
67
- let _basePath_extraInitializers = [];
68
65
  return class SourcePlugin extends _classSuper {
69
66
  static {
70
67
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
@@ -73,13 +70,11 @@ let SourcePlugin = (() => {
73
70
  _gitRemote_decorators = [Option("gitRemote")];
74
71
  _disableGit_decorators = [Option("disableGit")];
75
72
  _sourceLinkTemplate_decorators = [Option("sourceLinkTemplate")];
76
- _basePath_decorators = [Option("basePath")];
77
73
  __esDecorate(this, null, _disableSources_decorators, { kind: "accessor", name: "disableSources", static: false, private: false, access: { has: obj => "disableSources" in obj, get: obj => obj.disableSources, set: (obj, value) => { obj.disableSources = value; } }, metadata: _metadata }, _disableSources_initializers, _disableSources_extraInitializers);
78
74
  __esDecorate(this, null, _gitRevision_decorators, { kind: "accessor", name: "gitRevision", static: false, private: false, access: { has: obj => "gitRevision" in obj, get: obj => obj.gitRevision, set: (obj, value) => { obj.gitRevision = value; } }, metadata: _metadata }, _gitRevision_initializers, _gitRevision_extraInitializers);
79
75
  __esDecorate(this, null, _gitRemote_decorators, { kind: "accessor", name: "gitRemote", static: false, private: false, access: { has: obj => "gitRemote" in obj, get: obj => obj.gitRemote, set: (obj, value) => { obj.gitRemote = value; } }, metadata: _metadata }, _gitRemote_initializers, _gitRemote_extraInitializers);
80
76
  __esDecorate(this, null, _disableGit_decorators, { kind: "accessor", name: "disableGit", static: false, private: false, access: { has: obj => "disableGit" in obj, get: obj => obj.disableGit, set: (obj, value) => { obj.disableGit = value; } }, metadata: _metadata }, _disableGit_initializers, _disableGit_extraInitializers);
81
77
  __esDecorate(this, null, _sourceLinkTemplate_decorators, { kind: "accessor", name: "sourceLinkTemplate", static: false, private: false, access: { has: obj => "sourceLinkTemplate" in obj, get: obj => obj.sourceLinkTemplate, set: (obj, value) => { obj.sourceLinkTemplate = value; } }, metadata: _metadata }, _sourceLinkTemplate_initializers, _sourceLinkTemplate_extraInitializers);
82
- __esDecorate(this, null, _basePath_decorators, { kind: "accessor", name: "basePath", static: false, private: false, access: { has: obj => "basePath" in obj, get: obj => obj.basePath, set: (obj, value) => { obj.basePath = value; } }, metadata: _metadata }, _basePath_initializers, _basePath_extraInitializers);
83
78
  if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
84
79
  }
85
80
  #disableSources_accessor_storage = __runInitializers(this, _disableSources_initializers, void 0);
@@ -97,13 +92,13 @@ let SourcePlugin = (() => {
97
92
  #sourceLinkTemplate_accessor_storage = (__runInitializers(this, _disableGit_extraInitializers), __runInitializers(this, _sourceLinkTemplate_initializers, void 0));
98
93
  get sourceLinkTemplate() { return this.#sourceLinkTemplate_accessor_storage; }
99
94
  set sourceLinkTemplate(value) { this.#sourceLinkTemplate_accessor_storage = value; }
100
- #basePath_accessor_storage = (__runInitializers(this, _sourceLinkTemplate_extraInitializers), __runInitializers(this, _basePath_initializers, void 0));
101
- get basePath() { return this.#basePath_accessor_storage; }
102
- set basePath(value) { this.#basePath_accessor_storage = value; }
95
+ get displayBasePath() {
96
+ return this.application.options.getValue("displayBasePath") || this.application.options.getValue("basePath");
97
+ }
103
98
  /**
104
99
  * All file names to find the base path from.
105
100
  */
106
- fileNames = (__runInitializers(this, _basePath_extraInitializers), new Set());
101
+ fileNames = (__runInitializers(this, _sourceLinkTemplate_extraInitializers), new Set());
107
102
  repositories;
108
103
  constructor(owner) {
109
104
  super(owner);
@@ -170,7 +165,7 @@ let SourcePlugin = (() => {
170
165
  !this.gitRevision) {
171
166
  this.application.logger.warn(i18n.disable_git_set_and_git_revision_used());
172
167
  }
173
- const basePath = this.basePath || getCommonDirectory([...this.fileNames]);
168
+ const basePath = this.displayBasePath || getCommonDirectory([...this.fileNames]);
174
169
  this.repositories ||= new RepositoryManager(basePath, this.gitRevision, this.gitRemote, this.sourceLinkTemplate, this.disableGit, this.application.logger);
175
170
  for (const id in context.project.reflections) {
176
171
  const refl = context.project.reflections[id];
@@ -631,7 +631,11 @@ function convertVariableAsEnum(context, symbol, exportSymbol) {
631
631
  const reflection = context.createDeclarationReflection(ReflectionKind.Enum, symbol, exportSymbol);
632
632
  context.finalizeDeclarationReflection(reflection);
633
633
  const rc = context.withScope(reflection);
634
- const declaration = symbol.declarations.find(ts.isVariableDeclaration);
634
+ const declaration = symbol.valueDeclaration;
635
+ if (!declaration) {
636
+ context.logger.error(i18n.converting_0_as_enum_requires_value_declaration(symbol.name), symbol.declarations?.[0]);
637
+ return;
638
+ }
635
639
  const type = context.checker.getTypeAtLocation(declaration);
636
640
  for (const prop of type.getProperties()) {
637
641
  const reflection = rc.createDeclarationReflection(ReflectionKind.EnumMember, prop, void 0);
@@ -410,7 +410,7 @@ const queryConverter = {
410
410
  if (!querySymbol) {
411
411
  // This can happen if someone uses `typeof` on some property
412
412
  // on a variable typed as `any` with a name that doesn't exist.
413
- return new QueryType(ReferenceType.createBrokenReference(node.exprName.getText(), context.project));
413
+ return new QueryType(ReferenceType.createBrokenReference(node.exprName.getText(), context.project, undefined));
414
414
  }
415
415
  const ref = context.createSymbolReference(context.resolveAliasedSymbol(querySymbol), context, node.exprName.getText());
416
416
  ref.preferValues = true;
@@ -454,7 +454,7 @@ const referenceConverter = {
454
454
  if (!symbol) {
455
455
  // This happens when we get a reference to a type parameter
456
456
  // created within a mapped type, `K` in: `{ [K in T]: string }`
457
- const ref = ReferenceType.createBrokenReference(context.checker.typeToString(type), context.project);
457
+ const ref = ReferenceType.createBrokenReference(context.checker.typeToString(type), context.project, undefined);
458
458
  ref.refersToTypeParameter = true;
459
459
  return ref;
460
460
  }
@@ -31,6 +31,7 @@ module.exports = {
31
31
  converting_union_as_interface: `Using @interface on a union type will discard properties not present on all branches of the union. TypeDoc's output may not accurately describe your source code`,
32
32
  converting_0_as_class_requires_value_declaration: `Converting {0} as a class requires a declaration which represents a non-type value`,
33
33
  converting_0_as_class_without_construct_signatures: `{0} is being converted as a class, but does not have any construct signatures`,
34
+ converting_0_as_enum_requires_value_declaration: `Converting {0} as an enum requires a declaration which represents a non-type value`,
34
35
  comment_for_0_should_not_contain_block_or_modifier_tags: `The comment for {0} should not contain any block or modifier tags`,
35
36
  symbol_0_has_multiple_declarations_with_comment: `{0} has multiple declarations with a comment. An arbitrary comment will be used`,
36
37
  comments_for_0_are_declared_at_1: `The comments for {0} are declared at:\n\t{1}`,
@@ -44,6 +45,7 @@ module.exports = {
44
45
  at_most_one_inheritdoc_tag_expected_in_comment_at_0: "At most one @inheritDoc tag is expected in a comment, ignoring all but the first in comment at {0}",
45
46
  content_in_summary_overwritten_by_inheritdoc_in_comment_at_0: "Content in the summary section will be overwritten by the @inheritDoc tag in comment at {0}",
46
47
  content_in_remarks_block_overwritten_by_inheritdoc_in_comment_at_0: "Content in the @remarks block will be overwritten by the @inheritDoc tag in comment at {0}",
48
+ content_in_returns_block_overwritten_by_inheritdoc_in_comment_at_0: "Content in the @returns block will be overwritten by the @inheritDoc tag in comment at {0}",
47
49
  example_tag_literal_name: "The first line of an example tag will be taken literally as the example name, and should only contain text",
48
50
  inheritdoc_tag_properly_capitalized: "The @inheritDoc tag should be properly capitalized",
49
51
  treating_unrecognized_tag_0_as_modifier: `Treating unrecognized tag {0} as a modifier tag`,
@@ -194,11 +196,12 @@ module.exports = {
194
196
  help_gitRevision: "Use specified revision instead of the last revision for linking to GitHub/Bitbucket source files. Has no effect if disableSources is set",
195
197
  help_gitRemote: "Use the specified remote for linking to GitHub/Bitbucket source files. Has no effect if disableGit or disableSources is set",
196
198
  help_disableGit: "Assume that all can be linked to with the sourceLinkTemplate, sourceLinkTemplate must be set if this is enabled. {path} will be rooted at basePath",
197
- help_basePath: "Specifies the base path to be used when displaying file paths",
199
+ help_displayBasePath: "Specifies the base path to be used when displaying file paths. If not specified, basePath is used.",
198
200
  help_excludeTags: "Remove the listed block/modifier tags from doc comments",
199
201
  help_notRenderedTags: "Tags which will be preserved in doc comments, but not rendered when creating output",
200
202
  help_cascadedModifierTags: "Modifier tags which should be copied to all children of the parent reflection",
201
203
  help_readme: "Path to the readme file that should be displayed on the index page. Pass `none` to disable the index page and start the documentation on the globals page",
204
+ help_basePath: "Specifies a path which links may be resolved relative to.",
202
205
  help_cname: "Set the CNAME file text, it's useful for custom domains on GitHub Pages",
203
206
  help_favicon: "Path to favicon to include as the site icon",
204
207
  help_sourceLinkExternal: "Specifies that source links should be treated as external links to be opened in a new tab",
@@ -28,6 +28,7 @@ declare const _default: {
28
28
  readonly converting_union_as_interface: "Using @interface on a union type will discard properties not present on all branches of the union. TypeDoc's output may not accurately describe your source code";
29
29
  readonly converting_0_as_class_requires_value_declaration: "Converting {0} as a class requires a declaration which represents a non-type value";
30
30
  readonly converting_0_as_class_without_construct_signatures: "{0} is being converted as a class, but does not have any construct signatures";
31
+ readonly converting_0_as_enum_requires_value_declaration: "Converting {0} as an enum requires a declaration which represents a non-type value";
31
32
  readonly comment_for_0_should_not_contain_block_or_modifier_tags: "The comment for {0} should not contain any block or modifier tags";
32
33
  readonly symbol_0_has_multiple_declarations_with_comment: "{0} has multiple declarations with a comment. An arbitrary comment will be used";
33
34
  readonly comments_for_0_are_declared_at_1: "The comments for {0} are declared at:\n\t{1}";
@@ -40,6 +41,7 @@ declare const _default: {
40
41
  readonly at_most_one_inheritdoc_tag_expected_in_comment_at_0: "At most one @inheritDoc tag is expected in a comment, ignoring all but the first in comment at {0}";
41
42
  readonly content_in_summary_overwritten_by_inheritdoc_in_comment_at_0: "Content in the summary section will be overwritten by the @inheritDoc tag in comment at {0}";
42
43
  readonly content_in_remarks_block_overwritten_by_inheritdoc_in_comment_at_0: "Content in the @remarks block will be overwritten by the @inheritDoc tag in comment at {0}";
44
+ readonly content_in_returns_block_overwritten_by_inheritdoc_in_comment_at_0: "Content in the @returns block will be overwritten by the @inheritDoc tag in comment at {0}";
43
45
  readonly example_tag_literal_name: "The first line of an example tag will be taken literally as the example name, and should only contain text";
44
46
  readonly inheritdoc_tag_properly_capitalized: "The @inheritDoc tag should be properly capitalized";
45
47
  readonly treating_unrecognized_tag_0_as_modifier: "Treating unrecognized tag {0} as a modifier tag";
@@ -181,11 +183,12 @@ declare const _default: {
181
183
  readonly help_gitRevision: "Use specified revision instead of the last revision for linking to GitHub/Bitbucket source files. Has no effect if disableSources is set";
182
184
  readonly help_gitRemote: "Use the specified remote for linking to GitHub/Bitbucket source files. Has no effect if disableGit or disableSources is set";
183
185
  readonly help_disableGit: "Assume that all can be linked to with the sourceLinkTemplate, sourceLinkTemplate must be set if this is enabled. {path} will be rooted at basePath";
184
- readonly help_basePath: "Specifies the base path to be used when displaying file paths";
186
+ readonly help_displayBasePath: "Specifies the base path to be used when displaying file paths. If not specified, basePath is used.";
185
187
  readonly help_excludeTags: "Remove the listed block/modifier tags from doc comments";
186
188
  readonly help_notRenderedTags: "Tags which will be preserved in doc comments, but not rendered when creating output";
187
189
  readonly help_cascadedModifierTags: "Modifier tags which should be copied to all children of the parent reflection";
188
190
  readonly help_readme: "Path to the readme file that should be displayed on the index page. Pass `none` to disable the index page and start the documentation on the globals page";
191
+ readonly help_basePath: "Specifies a path which links may be resolved relative to.";
189
192
  readonly help_cname: "Set the CNAME file text, it's useful for custom domains on GitHub Pages";
190
193
  readonly help_favicon: "Path to favicon to include as the site icon";
191
194
  readonly help_sourceLinkExternal: "Specifies that source links should be treated as external links to be opened in a new tab";
@@ -1,4 +1,4 @@
1
- import { type NormalizedPath } from "#utils";
1
+ import { type NormalizedPath, type TagString } from "#utils";
2
2
  import type { Reflection } from "./Reflection.js";
3
3
  import { ReflectionSymbolId } from "./ReflectionSymbolId.js";
4
4
  import type { Deserializer, JSONOutput, Serializer } from "#serialization";
@@ -36,7 +36,7 @@ export type CommentDisplayPart =
36
36
  */
37
37
  export interface InlineTagDisplayPart {
38
38
  kind: "inline-tag";
39
- tag: `@${string}`;
39
+ tag: TagString;
40
40
  text: string;
41
41
  target?: Reflection | string | ReflectionSymbolId;
42
42
  tsLinkText?: string;
@@ -79,7 +79,7 @@ export declare class CommentTag {
79
79
  /**
80
80
  * The name of this tag, e.g. `@returns`, `@example`
81
81
  */
82
- tag: `@${string}`;
82
+ tag: TagString;
83
83
  /**
84
84
  * Some tags, (`@typedef`, `@param`, `@property`, etc.) may have a user defined identifier associated with them.
85
85
  * If this tag is one of those, it will be parsed out and included here.
@@ -98,7 +98,7 @@ export declare class CommentTag {
98
98
  /**
99
99
  * Create a new CommentTag instance.
100
100
  */
101
- constructor(tag: `@${string}`, text: CommentDisplayPart[]);
101
+ constructor(tag: TagString, text: CommentDisplayPart[]);
102
102
  /**
103
103
  * Checks if this block tag is roughly equal to the other tag.
104
104
  * This isn't exactly equal, but just "roughly equal" by the tag
@@ -150,7 +150,7 @@ export declare class Comment {
150
150
  /**
151
151
  * All modifier tags present on the comment, e.g. `@alpha`, `@beta`.
152
152
  */
153
- modifierTags: Set<`@${string}`>;
153
+ modifierTags: Set<TagString>;
154
154
  /**
155
155
  * Label associated with this reflection, if any (https://tsdoc.org/pages/tags/label/)
156
156
  */
@@ -179,7 +179,7 @@ export declare class Comment {
179
179
  /**
180
180
  * Creates a new Comment instance.
181
181
  */
182
- constructor(summary?: CommentDisplayPart[], blockTags?: CommentTag[], modifierTags?: Set<`@${string}`>);
182
+ constructor(summary?: CommentDisplayPart[], blockTags?: CommentTag[], modifierTags?: Set<TagString>);
183
183
  /**
184
184
  * Gets either the `@summary` tag, or a short version of the comment summary
185
185
  * section for rendering in module/namespace pages.
@@ -201,36 +201,36 @@ export declare class Comment {
201
201
  */
202
202
  isEmpty(): boolean;
203
203
  /**
204
- * Has this comment a visible component?
204
+ * Checks if this comment contains any visible text.
205
205
  *
206
- * @returns TRUE when this comment has a visible component.
206
+ * @returns TRUE when this reflection has a visible comment.
207
207
  */
208
- hasVisibleComponent(): boolean;
208
+ hasVisibleComponent(notRenderedTags?: readonly TagString[]): boolean;
209
209
  /**
210
210
  * Test whether this comment contains a tag with the given name.
211
211
  *
212
212
  * @param tagName The name of the tag to look for.
213
213
  * @returns TRUE when this comment contains a tag with the given name, otherwise FALSE.
214
214
  */
215
- hasModifier(tagName: `@${string}`): boolean;
216
- removeModifier(tagName: `@${string}`): void;
215
+ hasModifier(tagName: TagString): boolean;
216
+ removeModifier(tagName: TagString): void;
217
217
  /**
218
218
  * Return the first tag with the given name.
219
219
  *
220
220
  * @param tagName The name of the tag to look for.
221
221
  * @returns The found tag or undefined.
222
222
  */
223
- getTag(tagName: `@${string}`): CommentTag | undefined;
223
+ getTag(tagName: TagString): CommentTag | undefined;
224
224
  /**
225
225
  * Get all tags with the given tag name.
226
226
  */
227
- getTags(tagName: `@${string}`): CommentTag[];
228
- getIdentifiedTag(identifier: string, tagName: `@${string}`): CommentTag | undefined;
227
+ getTags(tagName: TagString): CommentTag[];
228
+ getIdentifiedTag(identifier: string, tagName: TagString): CommentTag | undefined;
229
229
  /**
230
230
  * Removes all block tags with the given tag name from the comment.
231
231
  * @param tagName
232
232
  */
233
- removeTags(tagName: `@${string}`): void;
233
+ removeTags(tagName: TagString): void;
234
234
  toObject(serializer: Serializer): JSONOutput.Comment;
235
235
  fromObject(de: Deserializer, obj: JSONOutput.Comment): void;
236
236
  }
@@ -441,13 +441,20 @@ let Comment = (() => {
441
441
  return !this.hasVisibleComponent() && this.modifierTags.size === 0;
442
442
  }
443
443
  /**
444
- * Has this comment a visible component?
444
+ * Checks if this comment contains any visible text.
445
445
  *
446
- * @returns TRUE when this comment has a visible component.
446
+ * @returns TRUE when this reflection has a visible comment.
447
447
  */
448
- hasVisibleComponent() {
449
- return (this.summary.some((x) => x.kind !== "text" || x.text !== "") ||
450
- this.blockTags.length > 0);
448
+ hasVisibleComponent(notRenderedTags) {
449
+ if (this.summary.some((x) => x.kind !== "text" || x.text !== "")) {
450
+ return true;
451
+ }
452
+ if (notRenderedTags) {
453
+ return this.blockTags.some(tag => !notRenderedTags.includes(tag.tag));
454
+ }
455
+ else {
456
+ return this.blockTags.length > 0;
457
+ }
451
458
  }
452
459
  /**
453
460
  * Test whether this comment contains a tag with the given name.
@@ -252,7 +252,7 @@ export class DeclarationReflection extends ContainerReflection {
252
252
  this.project.registerSymbolId(refl, new ReflectionSymbolId(sid));
253
253
  }
254
254
  else {
255
- de.logger.warn(i18n.serialized_project_referenced_0_not_part_of_project(id.toString()));
255
+ de.logger.warn(i18n.serialized_project_referenced_0_not_part_of_project(id));
256
256
  }
257
257
  }
258
258
  });
@@ -55,7 +55,7 @@ export class FileRegistry {
55
55
  }
56
56
  resolve(id, project) {
57
57
  const reflId = this.mediaToReflection.get(id);
58
- if (reflId) {
58
+ if (typeof reflId === "number") {
59
59
  return project.getReflectionById(reflId);
60
60
  }
61
61
  return this.mediaToPath.get(id);
@@ -342,7 +342,7 @@ let ProjectReflection = (() => {
342
342
  this.removedSymbolIds.delete(id);
343
343
  this.reflectionIdToSymbolIdMap.set(reflection.id, id);
344
344
  const previous = this.symbolToReflectionIdMap.get(id);
345
- if (previous) {
345
+ if (typeof previous !== "undefined") {
346
346
  if (typeof previous === "number") {
347
347
  this.symbolToReflectionIdMap.set(id, [previous, reflection.id]);
348
348
  }
@@ -407,7 +407,7 @@ let ProjectReflection = (() => {
407
407
  this.registerSymbolId(refl, new ReflectionSymbolId(sid));
408
408
  }
409
409
  else {
410
- de.logger.warn(i18n.serialized_project_referenced_0_not_part_of_project(id.toString()));
410
+ de.logger.warn(i18n.serialized_project_referenced_0_not_part_of_project(id));
411
411
  }
412
412
  }
413
413
  });
@@ -1,6 +1,6 @@
1
1
  import { Comment } from "./Comment.js";
2
2
  import type { ProjectReflection } from "./ProjectReflection.js";
3
- import { type NeverIfInternal, type TranslatedString } from "#utils";
3
+ import { type NeverIfInternal, type TagString, type TranslatedString } from "#utils";
4
4
  import { ReflectionKind } from "./kind.js";
5
5
  import type { Deserializer, JSONOutput, Serializer } from "#serialization";
6
6
  import type { ReflectionVariant } from "./variant.js";
@@ -171,11 +171,11 @@ export declare abstract class Reflection {
171
171
  */
172
172
  setFlag(flag: ReflectionFlag, value?: boolean): void;
173
173
  /**
174
- * Has this reflection a visible comment?
174
+ * Checks if this reflection has a comment which contains any visible text.
175
175
  *
176
176
  * @returns TRUE when this reflection has a visible comment.
177
177
  */
178
- hasComment(): boolean;
178
+ hasComment(notRenderedTags?: readonly TagString[]): boolean;
179
179
  hasGetterOrSetter(): boolean;
180
180
  /**
181
181
  * Return a child by its name.
@@ -359,12 +359,12 @@ let Reflection = (() => {
359
359
  this.flags.setFlag(flag, value);
360
360
  }
361
361
  /**
362
- * Has this reflection a visible comment?
362
+ * Checks if this reflection has a comment which contains any visible text.
363
363
  *
364
364
  * @returns TRUE when this reflection has a visible comment.
365
365
  */
366
- hasComment() {
367
- return this.comment ? this.comment.hasVisibleComponent() : false;
366
+ hasComment(notRenderedTags) {
367
+ return this.comment ? this.comment.hasVisibleComponent(notRenderedTags) : false;
368
368
  }
369
369
  hasGetterOrSetter() {
370
370
  return false;
@@ -393,7 +393,7 @@ export declare class ReferenceType extends Type {
393
393
  * later during conversion.
394
394
  * @internal
395
395
  */
396
- static createBrokenReference(name: string, project: ProjectReflection): ReferenceType;
396
+ static createBrokenReference(name: string, project: ProjectReflection, packageName: string | undefined): ReferenceType;
397
397
  protected getTypeString(): string;
398
398
  needsParenthesis(): boolean;
399
399
  toObject(serializer: Serializer): JSONOutput.ReferenceType;