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
@@ -833,8 +833,10 @@ let ReferenceType = (() => {
833
833
  * later during conversion.
834
834
  * @internal
835
835
  */
836
- static createBrokenReference(name, project) {
837
- return new ReferenceType(name, -1, project, name);
836
+ static createBrokenReference(name, project, packageName) {
837
+ const ref = new ReferenceType(name, -1, project, name);
838
+ ref.package = packageName;
839
+ return ref;
838
840
  }
839
841
  getTypeString() {
840
842
  const name = this.reflection ? this.reflection.name : this.name;
@@ -240,7 +240,17 @@ let MarkedPlugin = (() => {
240
240
  const refl = page.project.files.resolve(part.target, page.model.project);
241
241
  let url;
242
242
  if (typeof refl === "object") {
243
- url = context.urlTo(refl);
243
+ // #3006, this is an unfortunate heuristic. If there is a relative link to the project
244
+ // the user probably created it by linking to the directory of the project or to
245
+ // the project's readme. Since the readme doesn't get its own reflection, we can't
246
+ // reliably disambiguate this and instead will arbitrarily decide to reference the
247
+ // root index page in this case.
248
+ if (refl.isProject()) {
249
+ url = context.relativeURL("./");
250
+ }
251
+ else {
252
+ url = context.urlTo(refl);
253
+ }
244
254
  }
245
255
  else {
246
256
  const fileName = page.project.files.getName(part.target);
@@ -48,20 +48,21 @@ export function commentTags(context, props) {
48
48
  ? props.comment.blockTags.filter((tag) => tag.tag !== "@returns" && !tag.skipRendering && !skippedTags.includes(tag.tag))
49
49
  : props.comment.blockTags.filter((tag) => !tag.skipRendering && !skippedTags.includes(tag.tag));
50
50
  skipSave.forEach((skip, i) => (props.comment.blockTags[i].skipRendering = skip));
51
+ const tagsContents = tags.map((item) => {
52
+ const name = item.name
53
+ ? `${translateTagName(item.tag)}: ${item.name}`
54
+ : translateTagName(item.tag);
55
+ const anchor = context.slugger.slug(name);
56
+ return (JSX.createElement(JSX.Fragment, null,
57
+ JSX.createElement("div", { class: `tsd-tag-${item.tag.substring(1)}` },
58
+ JSX.createElement("h4", { class: "tsd-anchor-link", id: anchor },
59
+ name,
60
+ anchorIcon(context, anchor)),
61
+ JSX.createElement(JSX.Raw, { html: context.markdown(item.content) }))));
62
+ });
51
63
  return (JSX.createElement(JSX.Fragment, null,
52
64
  beforeTags,
53
- JSX.createElement("div", { class: "tsd-comment tsd-typography" }, tags.map((item) => {
54
- const name = item.name
55
- ? `${translateTagName(item.tag)}: ${item.name}`
56
- : translateTagName(item.tag);
57
- const anchor = context.slugger.slug(name);
58
- return (JSX.createElement(JSX.Fragment, null,
59
- JSX.createElement("div", { class: `tsd-tag-${item.tag.substring(1)}` },
60
- JSX.createElement("h4", { class: "tsd-anchor-link", id: anchor },
61
- name,
62
- anchorIcon(context, anchor)),
63
- JSX.createElement(JSX.Raw, { html: context.markdown(item.content) }))));
64
- })),
65
+ tagsContents.length > 0 && (JSX.createElement("div", { class: "tsd-comment tsd-typography" }, tagsContents)),
65
66
  afterTags));
66
67
  }
67
68
  export function reflectionFlags(context, props) {
@@ -9,7 +9,7 @@ function shouldRenderDefaultValue(props) {
9
9
  /** Fix for #2717. If type is the same as value the default value is omitted */
10
10
  if (props.type && props.type.type === "literal") {
11
11
  const reflectionTypeString = props.type.toString();
12
- if (reflectionTypeString === defaultValue.toString()) {
12
+ if (reflectionTypeString === defaultValue) {
13
13
  return false;
14
14
  }
15
15
  }
@@ -11,7 +11,7 @@ export function memberSignatureBody(context, props, { hideSources = false } = {}
11
11
  JSX.createElement("ul", { class: "tsd-parameter-list" }, props.parameters.map((item) => (JSX.createElement("li", null,
12
12
  JSX.createElement("span", null,
13
13
  context.reflectionFlags(item),
14
- !!item.flags.isRest && JSX.createElement("span", { class: "tsd-signature-symbol" }, "..."),
14
+ item.flags.isRest && JSX.createElement("span", { class: "tsd-signature-symbol" }, "..."),
15
15
  JSX.createElement("span", { class: "tsd-kind-parameter" }, item.name),
16
16
  ": ",
17
17
  context.type(item.type),
@@ -5,7 +5,7 @@ import { anchorIcon } from "./anchor-icon.js";
5
5
  export function moduleReflection(context, mod) {
6
6
  const sections = getMemberSections(mod);
7
7
  return (JSX.createElement(JSX.Fragment, null,
8
- mod.hasComment() && (JSX.createElement("section", { class: "tsd-panel tsd-comment" },
8
+ mod.hasComment(context.options.getValue("notRenderedTags")) && (JSX.createElement("section", { class: "tsd-panel tsd-comment" },
9
9
  context.commentSummary(mod),
10
10
  context.commentTags(mod))),
11
11
  mod.isDeclaration() && mod.kind === ReflectionKind.Module && !!mod.readme?.length && (JSX.createElement("section", { class: "tsd-panel tsd-typography" },
@@ -1,4 +1,4 @@
1
1
  import type { DefaultThemeRenderContext } from "../DefaultThemeRenderContext.js";
2
- import { type Type } from "../../../../models/index.js";
2
+ import { type Type } from "#models";
3
3
  import { JSX } from "#utils";
4
4
  export declare const typeAndParent: (context: DefaultThemeRenderContext, props: Type) => JSX.Element;
@@ -1,4 +1,4 @@
1
- import { ArrayType, ReferenceType, SignatureReflection } from "../../../../models/index.js";
1
+ import { ArrayType, ReferenceType, SignatureReflection } from "#models";
2
2
  import { JSX } from "#utils";
3
3
  export const typeAndParent = (context, props) => {
4
4
  if (props instanceof ArrayType) {
@@ -6,13 +6,23 @@ export const typeAndParent = (context, props) => {
6
6
  context.typeAndParent(props.elementType),
7
7
  "[]"));
8
8
  }
9
- if (props instanceof ReferenceType && props.reflection) {
10
- const refl = props.reflection instanceof SignatureReflection ? props.reflection.parent : props.reflection;
11
- const parent = refl.parent;
12
- return (JSX.createElement(JSX.Fragment, null,
13
- JSX.createElement("a", { href: context.urlTo(parent) }, parent.name),
14
- ".",
15
- JSX.createElement("a", { href: context.urlTo(refl) }, refl.name)));
9
+ if (props instanceof ReferenceType) {
10
+ if (props.reflection) {
11
+ const refl = props.reflection instanceof SignatureReflection ? props.reflection.parent : props.reflection;
12
+ const parent = refl.parent;
13
+ return (JSX.createElement(JSX.Fragment, null,
14
+ JSX.createElement("a", { href: context.urlTo(parent) }, parent.name),
15
+ ".",
16
+ JSX.createElement("a", { href: context.urlTo(refl) }, refl.name)));
17
+ }
18
+ else if (props.externalUrl) {
19
+ if (props.externalUrl === "#") {
20
+ return JSX.createElement(JSX.Fragment, null, props.toString());
21
+ }
22
+ else {
23
+ return JSX.createElement("a", { href: props.externalUrl, class: "external", target: "_blank" }, props.name);
24
+ }
25
+ }
16
26
  }
17
27
  return JSX.createElement(JSX.Fragment, null, props.toString());
18
28
  };
@@ -2,19 +2,20 @@ import { Comment, Reflection, ReflectionKind, } from "../../../../models/index.j
2
2
  import { assert, i18n, JSX } from "#utils";
3
3
  import { classNames, getKindClass } from "../../lib.js";
4
4
  import { anchorTargetIfPresent } from "./anchor-icon.js";
5
- function renderingTypeDetailsIsUseful(container, type) {
5
+ function renderingTypeDetailsIsUseful(container, type, notRenderedTags) {
6
6
  const isUsefulVisitor = {
7
7
  array(type) {
8
- return renderingTypeDetailsIsUseful(container, type.elementType);
8
+ return renderingTypeDetailsIsUseful(container, type.elementType, notRenderedTags);
9
9
  },
10
10
  intersection(type) {
11
- return type.types.some(t => renderingTypeDetailsIsUseful(container, t));
11
+ return type.types.some(t => renderingTypeDetailsIsUseful(container, t, notRenderedTags));
12
12
  },
13
13
  union(type) {
14
- return !!type.elementSummaries || type.types.some(t => renderingTypeDetailsIsUseful(container, t));
14
+ return !!type.elementSummaries ||
15
+ type.types.some(t => renderingTypeDetailsIsUseful(container, t, notRenderedTags));
15
16
  },
16
17
  reflection(type) {
17
- return renderingChildIsUseful(type.declaration);
18
+ return renderingChildIsUseful(type.declaration, notRenderedTags);
18
19
  },
19
20
  reference(type) {
20
21
  return shouldExpandReference(container, type);
@@ -24,7 +25,7 @@ function renderingTypeDetailsIsUseful(container, type) {
24
25
  }
25
26
  export function typeDeclaration(context, reflectionOwningType, type) {
26
27
  assert(reflectionOwningType instanceof Reflection, "typeDeclaration(reflectionOwningType, type) called incorrectly");
27
- if (renderingTypeDetailsIsUseful(reflectionOwningType, type)) {
28
+ if (renderingTypeDetailsIsUseful(reflectionOwningType, type, context.options.getValue("notRenderedTags"))) {
28
29
  return (JSX.createElement("div", { class: "tsd-type-declaration" },
29
30
  JSX.createElement("h4", null, i18n.theme_type_declaration()),
30
31
  context.typeDetails(reflectionOwningType, type, true)));
@@ -135,7 +136,7 @@ export function typeDetailsImpl(context, reflectionOwningType, type, renderAncho
135
136
  }
136
137
  export function typeDetailsIfUseful(context, reflectionOwningType, type) {
137
138
  assert(reflectionOwningType instanceof Reflection, "typeDetailsIfUseful(reflectionOwningType, type) called incorrectly");
138
- if (type && renderingTypeDetailsIsUseful(reflectionOwningType, type)) {
139
+ if (type && renderingTypeDetailsIsUseful(reflectionOwningType, type, context.options.getValue("notRenderedTags"))) {
139
140
  return context.typeDetails(reflectionOwningType, type, false);
140
141
  }
141
142
  }
@@ -177,10 +178,10 @@ function renderChild(context, child, renderAnchors, highlight) {
177
178
  if (child.signatures) {
178
179
  return (JSX.createElement("li", { class: "tsd-parameter" },
179
180
  JSX.createElement("h5", { id: anchorTargetIfPresent(context, child) },
180
- !!child.flags.isRest && JSX.createElement("span", { class: "tsd-signature-symbol" }, "..."),
181
+ child.flags.isRest && JSX.createElement("span", { class: "tsd-signature-symbol" }, "..."),
181
182
  JSX.createElement("span", { class: getKindClass(child) }, child.name),
182
183
  JSX.createElement("span", { class: "tsd-signature-symbol" },
183
- !!child.flags.isOptional && "?",
184
+ child.flags.isOptional && "?",
184
185
  ":"),
185
186
  " function"),
186
187
  context.memberSignatures(child)));
@@ -195,17 +196,18 @@ function renderChild(context, child, renderAnchors, highlight) {
195
196
  }
196
197
  // standard type
197
198
  if (child.type) {
199
+ const notRenderedTags = context.options.getValue("notRenderedTags");
198
200
  return (JSX.createElement("li", { class: "tsd-parameter" },
199
201
  JSX.createElement("h5", { id: anchorTargetIfPresent(context, child) },
200
202
  context.reflectionFlags(child),
201
- !!child.flags.isRest && JSX.createElement("span", { class: "tsd-signature-symbol" }, "..."),
203
+ child.flags.isRest && JSX.createElement("span", { class: "tsd-signature-symbol" }, "..."),
202
204
  JSX.createElement("span", { class: getKindClass(child) }, child.name),
203
205
  JSX.createElement("span", { class: "tsd-signature-symbol" },
204
- !!child.flags.isOptional && "?",
206
+ child.flags.isOptional && "?",
205
207
  ": "),
206
208
  context.type(child.type)),
207
209
  highlightOrComment(child),
208
- child.getProperties().some(renderingChildIsUseful) && (JSX.createElement("ul", { class: "tsd-parameters" }, child.getProperties().map((c) => renderChild(context, c, renderAnchors))))));
210
+ child.getProperties().some(prop => renderingChildIsUseful(prop, notRenderedTags)) && (JSX.createElement("ul", { class: "tsd-parameters" }, child.getProperties().map((c) => renderChild(context, c, renderAnchors))))));
209
211
  }
210
212
  // getter/setter
211
213
  return (JSX.createElement(JSX.Fragment, null,
@@ -254,7 +256,7 @@ function renderIndexSignature(context, index) {
254
256
  context.commentTags(index),
255
257
  context.typeDeclaration(index, index.type)));
256
258
  }
257
- function renderingChildIsUseful(refl) {
259
+ function renderingChildIsUseful(refl, notRenderedTags) {
258
260
  // Object types directly under a variable/type alias will always be considered useful.
259
261
  // This probably isn't ideal, but it is an easy thing to check when assigning URLs
260
262
  // in the default theme, so we'll make the assumption that those properties ought to always
@@ -265,18 +267,18 @@ function renderingChildIsUseful(refl) {
265
267
  refl.parent.type?.type === "reflection") {
266
268
  return true;
267
269
  }
268
- if (renderingThisChildIsUseful(refl)) {
270
+ if (renderingThisChildIsUseful(refl, notRenderedTags)) {
269
271
  return true;
270
272
  }
271
- return refl.getProperties().some(renderingThisChildIsUseful);
273
+ return refl.getProperties().some(prop => renderingThisChildIsUseful(prop, notRenderedTags));
272
274
  }
273
- function renderingThisChildIsUseful(refl) {
274
- if (refl.hasComment())
275
+ function renderingThisChildIsUseful(refl, notRenderedTags) {
276
+ if (refl.hasComment(notRenderedTags))
275
277
  return true;
276
278
  const declaration = refl.type?.type === "reflection" ? refl.type.declaration : refl;
277
- if (declaration.hasComment())
279
+ if (declaration.hasComment(notRenderedTags))
278
280
  return true;
279
281
  return declaration.getAllSignatures().some((sig) => {
280
- return sig.hasComment() || sig.parameters?.some((p) => p.hasComment());
282
+ return sig.hasComment(notRenderedTags) || sig.parameters?.some((p) => p.hasComment(notRenderedTags));
281
283
  });
282
284
  }
@@ -12,7 +12,7 @@ export function reflectionTemplate(context, props) {
12
12
  return context.moduleReflection(props.model);
13
13
  }
14
14
  return (JSX.createElement(JSX.Fragment, null,
15
- props.model.hasComment() && (JSX.createElement("section", { class: "tsd-panel tsd-comment" },
15
+ props.model.hasComment(context.options.getValue("notRenderedTags")) && (JSX.createElement("section", { class: "tsd-panel tsd-comment" },
16
16
  context.commentSummary(props.model),
17
17
  context.commentTags(props.model))),
18
18
  context.reflectionPreview(props.model),
@@ -49,8 +49,8 @@ export declare class Deserializer {
49
49
  registry: FileRegistry;
50
50
  alwaysCreateEntryPointModule: boolean;
51
51
  }): ProjectReflection;
52
- revive<T, U extends Deserializable<T>>(source: NonNullable<T>, creator: (obj: T) => U): U;
53
- revive<T, U extends Deserializable<T>>(source: T | undefined, creator: (obj: T) => U): U | undefined;
52
+ revive<T extends object, U extends Deserializable<T>>(source: NonNullable<T>, creator: (obj: T) => U): U;
53
+ revive<T extends object, U extends Deserializable<T>>(source: T | undefined, creator: (obj: T) => U): U | undefined;
54
54
  reviveMany<T, U extends Deserializable<T>>(sourceArray: T[], creator: (obj: T) => U): U[];
55
55
  reviveMany<T, U extends Deserializable<T>>(sourceArray: T[] | undefined, creator: (obj: T) => U): U[] | undefined;
56
56
  reviveType<T extends JSONOutput.SomeType>(obj: T): TypeKindMap[T["type"]];
@@ -58,7 +58,7 @@ export class Deserializer {
58
58
  return new IntrinsicType(obj.name);
59
59
  },
60
60
  literal(obj) {
61
- if (obj.value && typeof obj.value === "object") {
61
+ if (typeof obj.value === "object" && obj.value != null) {
62
62
  return new LiteralType(BigInt(`${obj.value.negative ? "-" : ""}${obj.value.value}`));
63
63
  }
64
64
  return new LiteralType(obj.value);
@@ -29,7 +29,7 @@
29
29
  * @module
30
30
  */
31
31
  import type * as M from "#models";
32
- import type { IfInternal, NormalizedPath } from "#utils";
32
+ import type { IfInternal, NormalizedPath, TagString } from "#utils";
33
33
  export declare const SCHEMA_VERSION = "2.0";
34
34
  /**
35
35
  * Describes the mapping from Model types to the corresponding JSON output type.
@@ -223,7 +223,7 @@ export interface ReflectionFlags extends Partial<S<M.ReflectionFlags, BoolKeys<M
223
223
  /** @category Comments */
224
224
  export interface Comment extends Partial<S<M.Comment, "blockTags" | "label">> {
225
225
  summary: CommentDisplayPart[];
226
- modifierTags?: `@${string}`[];
226
+ modifierTags?: TagString[];
227
227
  }
228
228
  /** @category Comments */
229
229
  export interface CommentTag extends S<M.CommentTag, "tag" | "name"> {
@@ -247,7 +247,7 @@ export type CommentDisplayPart = {
247
247
  */
248
248
  export interface InlineTagDisplayPart {
249
249
  kind: "inline-tag";
250
- tag: `@${string}`;
250
+ tag: TagString;
251
251
  text: string;
252
252
  target?: string | ReflectionId | ReflectionSymbolId;
253
253
  tsLinkText?: string;
@@ -2,6 +2,8 @@ import { type FileId, FileRegistry } from "../models/FileRegistry.js";
2
2
  import type { Deserializer, JSONOutput } from "#serialization";
3
3
  import { type NormalizedPath } from "#utils";
4
4
  export declare class ValidatingFileRegistry extends FileRegistry {
5
+ basePath: NormalizedPath;
6
+ constructor(basePath?: NormalizedPath);
5
7
  register(sourcePath: NormalizedPath, relativePath: NormalizedPath): {
6
8
  target: FileId;
7
9
  anchor: string | undefined;
@@ -2,14 +2,29 @@ import { FileRegistry } from "../models/FileRegistry.js";
2
2
  import { i18n, NormalizedPathUtils } from "#utils";
3
3
  import { existsSync } from "fs";
4
4
  export class ValidatingFileRegistry extends FileRegistry {
5
+ basePath;
6
+ constructor(basePath = "") {
7
+ super();
8
+ this.basePath = basePath;
9
+ }
5
10
  register(sourcePath, relativePath) {
6
- const absolute = NormalizedPathUtils.resolve(NormalizedPathUtils.dirname(sourcePath), relativePath);
7
- const absoluteWithoutAnchor = absolute.replace(/#.*/, "");
11
+ let absolute = NormalizedPathUtils.resolve(NormalizedPathUtils.dirname(sourcePath), relativePath);
12
+ let absoluteWithoutAnchor = absolute.replace(/#.*/, "");
8
13
  // Note: We allow paths to directories to be registered here, but the AssetsPlugin will not
9
14
  // copy them to the output path. This is so that we can link to directories and associate them
10
15
  // with reflections in packages mode.
11
16
  if (!existsSync(absoluteWithoutAnchor)) {
12
- return;
17
+ // If the relative path didn't exist normally, also check the path relative to the assetBasePath option
18
+ if (this.basePath != "") {
19
+ absolute = NormalizedPathUtils.resolve(this.basePath, relativePath);
20
+ absoluteWithoutAnchor = absolute.replace(/#.*/, "");
21
+ if (!existsSync(absoluteWithoutAnchor)) {
22
+ return;
23
+ }
24
+ }
25
+ else {
26
+ return;
27
+ }
13
28
  }
14
29
  return this.registerAbsolute(absolute);
15
30
  }
@@ -124,7 +124,7 @@ export function getDocumentEntryPoints(logger, options) {
124
124
  // that have at some point or another been used for markdown: https://superuser.com/a/285878
125
125
  const supportedFileRegex = /\.(md|markdown)$/;
126
126
  const expanded = expandInputFiles(logger, docPaths, options, supportedFileRegex);
127
- const baseDir = options.getValue("basePath") || getCommonDirectory(expanded);
127
+ const baseDir = options.getValue("displayBasePath") || options.getValue("basePath") || getCommonDirectory(expanded);
128
128
  return expanded.map((path) => {
129
129
  return {
130
130
  displayName: relative(baseDir, path).replace(/\.[^.]+$/, ""),
@@ -184,7 +184,8 @@ function getModuleName(fileName, baseDir) {
184
184
  * This is in contrast with the package-oriented `getEntryPointsForPackages`
185
185
  */
186
186
  function getEntryPointsForPaths(logger, inputFiles, options, programs = getEntryPrograms(inputFiles, logger, options)) {
187
- const baseDir = options.getValue("basePath") || getCommonDirectory(inputFiles);
187
+ const baseDir = options.getValue("displayBasePath") || options.getValue("basePath") ||
188
+ getCommonDirectory(inputFiles);
188
189
  const entryPoints = [];
189
190
  let expandSuggestion = true;
190
191
  entryLoop: for (const fileOrDir of inputFiles.map(normalizePath)) {
@@ -2,7 +2,7 @@ import type { BundledTheme as ShikiTheme } from "@gerrit0/mini-shiki";
2
2
  import type { SortStrategy } from "../sort.js";
3
3
  import type { EntryPointStrategy } from "../entry-point.js";
4
4
  import type { ReflectionKind } from "../../models/kind.js";
5
- import { type GlobString, type LogLevel, type NeverIfInternal, type NormalizedPath, type NormalizedPathOrModule, type NormalizedPathOrModuleOrFunction } from "#utils";
5
+ import { type GlobString, type LogLevel, type NeverIfInternal, type NormalizedPath, type NormalizedPathOrModule, type NormalizedPathOrModuleOrFunction, type TagString } from "#utils";
6
6
  import type { TranslationProxy } from "../../internationalization/internationalization.js";
7
7
  import type { Application } from "../../application.js";
8
8
  /** @enum */
@@ -108,6 +108,7 @@ export interface TypeDocOptionMap {
108
108
  gitRevision: string;
109
109
  gitRemote: string;
110
110
  readme: string;
111
+ basePath: NormalizedPath;
111
112
  outputs: ManuallyValidatedOption<Array<OutputSpecification>>;
112
113
  out: NormalizedPath;
113
114
  html: NormalizedPath;
@@ -145,7 +146,7 @@ export interface TypeDocOptionMap {
145
146
  * strictly typed here.
146
147
  */
147
148
  markdownItLoader: ManuallyValidatedOption<(parser: any) => void>;
148
- basePath: NormalizedPath;
149
+ displayBasePath: NormalizedPath;
149
150
  cname: string;
150
151
  favicon: NormalizedPath;
151
152
  githubPages: boolean;
@@ -182,7 +183,7 @@ export interface TypeDocOptionMap {
182
183
  private?: boolean;
183
184
  inherited?: boolean;
184
185
  external?: boolean;
185
- [tag: `@${string}`]: boolean;
186
+ [tag: TagString]: boolean;
186
187
  }>;
187
188
  searchCategoryBoosts: ManuallyValidatedOption<Record<string, number>>;
188
189
  searchGroupBoosts: ManuallyValidatedOption<Record<string, number>>;
@@ -192,13 +193,13 @@ export interface TypeDocOptionMap {
192
193
  preserveLinkText: boolean;
193
194
  jsDocCompatibility: JsDocCompatibility;
194
195
  suppressCommentWarningsInDeclarationFiles: boolean;
195
- blockTags: `@${string}`[];
196
- inlineTags: `@${string}`[];
197
- modifierTags: `@${string}`[];
198
- excludeTags: `@${string}`[];
199
- notRenderedTags: `@${string}`[];
196
+ blockTags: TagString[];
197
+ inlineTags: TagString[];
198
+ modifierTags: TagString[];
199
+ excludeTags: TagString[];
200
+ notRenderedTags: TagString[];
200
201
  externalSymbolLinkMappings: ManuallyValidatedOption<Record<string, Record<string, string>>>;
201
- cascadedModifierTags: `@${string}`[];
202
+ cascadedModifierTags: TagString[];
202
203
  categorizeByGroup: boolean;
203
204
  groupReferencesByType: boolean;
204
205
  defaultCategory: string;
@@ -3,15 +3,15 @@
3
3
  * @module
4
4
  */
5
5
  import type { BundledLanguage } from "@gerrit0/mini-shiki";
6
- import type { EnumKeys } from "#utils";
6
+ import type { EnumKeys, TagString } from "#utils";
7
7
  import type { ReflectionKind } from "../../models/index.js";
8
8
  export declare const excludeNotDocumentedKinds: readonly EnumKeys<typeof ReflectionKind>[];
9
- export declare const excludeTags: readonly `@${string}`[];
10
- export declare const blockTags: readonly `@${string}`[];
11
- export declare const inlineTags: readonly `@${string}`[];
12
- export declare const modifierTags: readonly `@${string}`[];
13
- export declare const cascadedModifierTags: readonly `@${string}`[];
14
- export declare const notRenderedTags: readonly `@${string}`[];
9
+ export declare const excludeTags: readonly TagString[];
10
+ export declare const blockTags: readonly TagString[];
11
+ export declare const inlineTags: readonly TagString[];
12
+ export declare const modifierTags: readonly TagString[];
13
+ export declare const cascadedModifierTags: readonly TagString[];
14
+ export declare const notRenderedTags: readonly TagString[];
15
15
  export declare const highlightLanguages: readonly BundledLanguage[];
16
16
  export declare const ignoredHighlightLanguages: readonly string[];
17
17
  export declare const sort: readonly string[];
@@ -59,7 +59,7 @@ export class ArgumentsReader {
59
59
  }
60
60
  else if (decl.type === ParameterType.Boolean ||
61
61
  decl.type === ParameterType.Flags) {
62
- const value = String(this.args[index]).toLowerCase();
62
+ const value = String(this.args.at(index)).toLowerCase();
63
63
  if (value === "true" || value === "false") {
64
64
  trySet(decl.name, value === "true");
65
65
  }
@@ -87,7 +87,7 @@ export class ArgumentsReader {
87
87
  const decl = options.getDeclaration(actualName);
88
88
  if (decl && decl.type === ParameterType.Flags) {
89
89
  const flagName = name.split(".", 2)[1];
90
- const value = String(this.args[index]).toLowerCase();
90
+ const value = String(this.args.at(index)).toLowerCase();
91
91
  if (value === "true" || value === "false") {
92
92
  trySet(decl.name, { [flagName]: value === "true" });
93
93
  }
@@ -16,9 +16,7 @@ function makeTagArrayValidator(name) {
16
16
  }
17
17
  // For convenience, added in the same order as they are documented on the website.
18
18
  export function addTypeDocOptions(options) {
19
- ///////////////////////////
20
- // Configuration Options //
21
- ///////////////////////////
19
+ // MARK: Configuration Options
22
20
  options.addDeclaration({
23
21
  type: ParameterType.Path,
24
22
  name: "options",
@@ -84,9 +82,7 @@ export function addTypeDocOptions(options) {
84
82
  }
85
83
  },
86
84
  });
87
- ///////////////////////////
88
- ////// Input Options //////
89
- ///////////////////////////
85
+ // MARK: Input Options
90
86
  options.addDeclaration({
91
87
  name: "entryPoints",
92
88
  help: () => i18n.help_entryPoints(),
@@ -202,9 +198,17 @@ export function addTypeDocOptions(options) {
202
198
  }
203
199
  },
204
200
  });
205
- ///////////////////////////
206
- ///// Output Options //////
207
- ///////////////////////////
201
+ options.addDeclaration({
202
+ name: "readme",
203
+ help: () => i18n.help_readme(),
204
+ type: ParameterType.Path,
205
+ });
206
+ options.addDeclaration({
207
+ name: "basePath",
208
+ help: () => i18n.help_basePath(),
209
+ type: ParameterType.Path,
210
+ });
211
+ // MARK: Output Options
208
212
  options.addDeclaration({
209
213
  name: "outputs",
210
214
  help: () => i18n.help_out(),
@@ -396,13 +400,8 @@ export function addTypeDocOptions(options) {
396
400
  type: ParameterType.Boolean,
397
401
  });
398
402
  options.addDeclaration({
399
- name: "basePath",
400
- help: () => i18n.help_basePath(),
401
- type: ParameterType.Path,
402
- });
403
- options.addDeclaration({
404
- name: "readme",
405
- help: () => i18n.help_readme(),
403
+ name: "displayBasePath",
404
+ help: () => i18n.help_displayBasePath(),
406
405
  type: ParameterType.Path,
407
406
  });
408
407
  options.addDeclaration({
@@ -574,7 +573,7 @@ export function addTypeDocOptions(options) {
574
573
  },
575
574
  validate(value) {
576
575
  const knownKeys = ["protected", "private", "inherited", "external"];
577
- if (!value || typeof value !== "object") {
576
+ if (typeof value !== "object" || !value) {
578
577
  throw new Error(i18n.option_0_must_be_an_object("visibilityFilters"));
579
578
  }
580
579
  for (const [key, val] of Object.entries(value)) {
@@ -622,9 +621,7 @@ export function addTypeDocOptions(options) {
622
621
  help: () => i18n.help_useFirstParagraphOfCommentAsSummary(),
623
622
  type: ParameterType.Boolean,
624
623
  });
625
- ///////////////////////////
626
- ///// Comment Options /////
627
- ///////////////////////////
624
+ // MARK: Comment Options
628
625
  options.addDeclaration({
629
626
  name: "jsDocCompatibility",
630
627
  help: () => i18n.help_jsDocCompatibility(),
@@ -703,9 +700,7 @@ export function addTypeDocOptions(options) {
703
700
  defaultValue: OptionDefaults.cascadedModifierTags,
704
701
  validate: makeTagArrayValidator("cascadedModifierTags"),
705
702
  });
706
- ///////////////////////////
707
- // Organization Options ///
708
- ///////////////////////////
703
+ // MARK: Organization Options
709
704
  options.addDeclaration({
710
705
  name: "categorizeByGroup",
711
706
  help: () => i18n.help_categorizeByGroup(),
@@ -764,9 +759,7 @@ export function addTypeDocOptions(options) {
764
759
  }
765
760
  },
766
761
  });
767
- ///////////////////////////
768
- ///// General Options /////
769
- ///////////////////////////
762
+ // MARK: General Options
770
763
  options.addDeclaration({
771
764
  name: "watch",
772
765
  help: () => i18n.help_watch(),
@@ -1,4 +1,5 @@
1
1
  import type { TranslationProxy } from "../internationalization/internationalization.js";
2
+ import type { TagString } from "./validation.js";
2
3
  declare const TranslatedString: unique symbol;
3
4
  export type TranslatedString = string & {
4
5
  [TranslatedString]: true;
@@ -13,5 +14,5 @@ export declare function setTranslations(t: Record<string, string>): void;
13
14
  */
14
15
  export declare function addTranslations(t: Record<string, string>): void;
15
16
  export declare const i18n: TranslationProxy;
16
- export declare function translateTagName(tag: `@${string}`): TranslatedString;
17
+ export declare function translateTagName(tag: TagString): TranslatedString;
17
18
  export {};
@@ -13,3 +13,4 @@ export * from "./path.js";
13
13
  export * from "./set.js";
14
14
  export * from "./string.js";
15
15
  export * as Validation from "./validation.js";
16
+ export type { TagString } from "./validation.js";
@@ -28,5 +28,6 @@ export type Schema = typeof String | typeof Number | typeof Boolean | readonly s
28
28
  */
29
29
  export declare function validate<T extends Schema>(schema: T, obj: unknown): obj is Infer<T>;
30
30
  export declare function optional<T extends Schema>(x: T): Optional<T>;
31
- export declare function isTagString(x: unknown): x is `@${string}`;
31
+ export type TagString = `@${string}`;
32
+ export declare function isTagString(x: unknown): x is TagString;
32
33
  export {};