typedoc 0.23.5 → 0.23.6

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.
@@ -20,6 +20,8 @@ const symbols_1 = require("./symbols");
20
20
  const paths_1 = require("../utils/paths");
21
21
  const enum_1 = require("../utils/enum");
22
22
  const comments_1 = require("./comments");
23
+ const parser_1 = require("./comments/parser");
24
+ const rawLexer_1 = require("./comments/rawLexer");
23
25
  /**
24
26
  * Compiles source files using TypeScript and converts compiler symbols to reflections.
25
27
  */
@@ -73,7 +75,7 @@ let Converter = Converter_1 = class Converter extends component_1.ChildableCompo
73
75
  });
74
76
  entries.forEach((e) => {
75
77
  context.setActiveProgram(e.entryPoint.program);
76
- e.context = this.convertExports(context, e.entryPoint.sourceFile, entries.length === 1, e.entryPoint.displayName);
78
+ e.context = this.convertExports(context, e.entryPoint, entries.length === 1);
77
79
  });
78
80
  for (const { entryPoint, context } of entries) {
79
81
  // active program is already set on context
@@ -84,7 +86,9 @@ let Converter = Converter_1 = class Converter extends component_1.ChildableCompo
84
86
  }
85
87
  context.setActiveProgram(undefined);
86
88
  }
87
- convertExports(context, node, singleEntryPoint, entryName) {
89
+ convertExports(context, entryPoint, singleEntryPoint) {
90
+ const node = entryPoint.sourceFile;
91
+ const entryName = entryPoint.displayName;
88
92
  const symbol = getSymbolForModuleLike(context, node);
89
93
  let moduleContext;
90
94
  const allExports = getExports(context, node, symbol);
@@ -104,6 +108,19 @@ let Converter = Converter_1 = class Converter extends component_1.ChildableCompo
104
108
  }
105
109
  else {
106
110
  const reflection = context.createDeclarationReflection(index_1.ReflectionKind.Module, symbol, void 0, entryName);
111
+ if (entryPoint.readmeFile) {
112
+ const readme = (0, utils_1.readFile)(entryPoint.readmeFile);
113
+ const comment = (0, parser_1.parseComment)((0, rawLexer_1.lexCommentString)(readme), context.converter.config, new utils_1.MinimalSourceFile(readme, entryPoint.readmeFile), context.logger);
114
+ if (comment.blockTags.length || comment.modifierTags.size) {
115
+ const ignored = [
116
+ ...comment.blockTags.map((tag) => tag.tag),
117
+ ...comment.modifierTags,
118
+ ];
119
+ context.logger.warn(`Block and modifier tags will be ignored within the readme:\n\t${ignored.join("\n\t")}`);
120
+ }
121
+ reflection.readme = comment.summary;
122
+ }
123
+ reflection.version = entryPoint.version;
107
124
  context.finalizeDeclarationReflection(reflection);
108
125
  moduleContext = context.withScope(reflection);
109
126
  }
@@ -14,8 +14,9 @@ const declarationReference_1 = require("../comments/declarationReference");
14
14
  const ts = require("typescript");
15
15
  const utils_1 = require("../../utils");
16
16
  const declarationReferenceResolver_1 = require("../comments/declarationReferenceResolver");
17
+ const models_1 = require("../../models");
17
18
  const urlPrefix = /^(http|ftp)s?:\/\//;
18
- const brackets = /\[\[([^\]]+)\]\]/g;
19
+ const brackets = /\[\[(?!include:)([^\]]+)\]\]/g;
19
20
  /**
20
21
  * A plugin that resolves `{@link Foo}` tags.
21
22
  */
@@ -113,6 +114,9 @@ let LinkResolverPlugin = LinkResolverPlugin_1 = class LinkResolverPlugin extends
113
114
  for (const tag of comment.blockTags) {
114
115
  tag.content = this.processParts(reflection, tag.content, warn);
115
116
  }
117
+ if (reflection instanceof models_1.DeclarationReflection && reflection.readme) {
118
+ reflection.readme = this.processParts(reflection, reflection.readme, warn);
119
+ }
116
120
  }
117
121
  processParts(reflection, parts, warn) {
118
122
  return parts.flatMap((part) => this.processPart(reflection, part, warn));
@@ -1,4 +1,5 @@
1
1
  import { ConverterComponent } from "../components";
2
+ import { EntryPointStrategy } from "../../utils";
2
3
  /**
3
4
  * A handler that tries to find the package.json and readme.md files of the
4
5
  * current project.
@@ -6,6 +7,7 @@ import { ConverterComponent } from "../components";
6
7
  export declare class PackagePlugin extends ConverterComponent {
7
8
  readme: string;
8
9
  includeVersion: boolean;
10
+ entryPointStrategy: EntryPointStrategy;
9
11
  /**
10
12
  * The file name of the found readme.md file.
11
13
  */
@@ -102,7 +102,11 @@ let PackagePlugin = class PackagePlugin extends components_1.ConverterComponent
102
102
  project.name = `${project.name} - v${packageInfo.version}`;
103
103
  }
104
104
  else {
105
- context.logger.warn("--includeVersion was specified, but package.json does not specify a version.");
105
+ // since not all monorepo specifies a meaningful version to the main package.json
106
+ // this warning should be optional
107
+ if (this.entryPointStrategy !== utils_1.EntryPointStrategy.Packages) {
108
+ context.logger.warn("--includeVersion was specified, but package.json does not specify a version.");
109
+ }
106
110
  }
107
111
  }
108
112
  }
@@ -112,7 +116,11 @@ let PackagePlugin = class PackagePlugin extends components_1.ConverterComponent
112
116
  project.name = "Documentation";
113
117
  }
114
118
  if (this.includeVersion) {
115
- context.logger.warn("--includeVersion was specified, but no package.json was found. Not adding package version to the documentation.");
119
+ // since not all monorepo specifies a meaningful version to the main package.json
120
+ // this warning should be optional
121
+ if (this.entryPointStrategy !== utils_1.EntryPointStrategy.Packages) {
122
+ context.logger.warn("--includeVersion was specified, but no package.json was found. Not adding package version to the documentation.");
123
+ }
116
124
  }
117
125
  }
118
126
  }
@@ -123,6 +131,9 @@ __decorate([
123
131
  __decorate([
124
132
  (0, utils_1.BindOption)("includeVersion")
125
133
  ], PackagePlugin.prototype, "includeVersion", void 0);
134
+ __decorate([
135
+ (0, utils_1.BindOption)("entryPointStrategy")
136
+ ], PackagePlugin.prototype, "entryPointStrategy", void 0);
126
137
  PackagePlugin = __decorate([
127
138
  (0, components_1.Component)({ name: "package" })
128
139
  ], PackagePlugin);
@@ -5,6 +5,7 @@ import { ContainerReflection } from "./container";
5
5
  import type { SignatureReflection } from "./signature";
6
6
  import type { TypeParameterReflection } from "./type-parameter";
7
7
  import type { Serializer, JSONOutput } from "../../serialization";
8
+ import type { CommentDisplayPart } from "../comments";
8
9
  /**
9
10
  * Stores hierarchical type data.
10
11
  *
@@ -109,6 +110,14 @@ export declare class DeclarationReflection extends ContainerReflection {
109
110
  * rendered in templates.
110
111
  */
111
112
  typeHierarchy?: DeclarationHierarchy;
113
+ /**
114
+ * The contents of the readme file of the module when found.
115
+ */
116
+ readme?: CommentDisplayPart[];
117
+ /**
118
+ * The version of the module when found.
119
+ */
120
+ version?: string;
112
121
  hasGetterOrSetter(): boolean;
113
122
  getAllSignatures(): SignatureReflection[];
114
123
  /** @internal */
@@ -39,6 +39,9 @@ export declare class DefaultThemeRenderContext {
39
39
  members: (props: import("../../../models").ContainerReflection) => import("../../../utils/jsx.elements").JsxElement;
40
40
  membersGroup: (group: import("../../../models").ReflectionGroup) => import("../../../utils/jsx.elements").JsxElement;
41
41
  navigation: (props: import("../..").PageEvent<Reflection>) => import("../../../utils/jsx.elements").JsxElement;
42
+ settings: () => import("../../../utils/jsx.elements").JsxElement;
43
+ primaryNavigation: (props: import("../..").PageEvent<Reflection>) => import("../../../utils/jsx.elements").JsxElement;
44
+ secondaryNavigation: (props: import("../..").PageEvent<Reflection>) => import("../../../utils/jsx.elements").JsxElement | undefined;
42
45
  parameter: (props: import("../../../models").DeclarationReflection) => import("../../../utils/jsx.elements").JsxElement;
43
46
  toolbar: (props: import("../..").PageEvent<Reflection>) => import("../../../utils/jsx.elements").JsxElement;
44
47
  type: (type: import("../../../models").Type | undefined) => import("../../../utils/jsx.elements").JsxElement;
@@ -68,6 +68,9 @@ class DefaultThemeRenderContext {
68
68
  this.members = bind(members_1.members, this);
69
69
  this.membersGroup = bind(members_group_1.membersGroup, this);
70
70
  this.navigation = bind(navigation_1.navigation, this);
71
+ this.settings = bind(navigation_1.settings, this);
72
+ this.primaryNavigation = bind(navigation_1.primaryNavigation, this);
73
+ this.secondaryNavigation = bind(navigation_1.secondaryNavigation, this);
71
74
  this.parameter = bind(parameter_1.parameter, this);
72
75
  this.toolbar = bind(toolbar_1.toolbar, this);
73
76
  this.type = bind(type_1.type, this);
@@ -1,5 +1,5 @@
1
1
  import { JSX } from "../../../../utils";
2
2
  import type { DefaultThemeRenderContext } from "../DefaultThemeRenderContext";
3
3
  import type { PageEvent } from "../../../events";
4
- import type { Reflection } from "../../../../models";
4
+ import { Reflection } from "../../../../models";
5
5
  export declare const header: (context: DefaultThemeRenderContext, props: PageEvent<Reflection>) => JSX.Element;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.header = void 0;
4
4
  const lib_1 = require("../../lib");
5
5
  const utils_1 = require("../../../../utils");
6
+ const models_1 = require("../../../../models");
6
7
  const header = (context, props) => {
7
8
  const HeadingLevel = props.model.isProject() ? "h2" : "h1";
8
9
  return (utils_1.JSX.createElement("div", { class: "tsd-page-title" },
@@ -10,6 +11,9 @@ const header = (context, props) => {
10
11
  utils_1.JSX.createElement(HeadingLevel, null,
11
12
  props.model.kindString !== "Project" && `${props.model.kindString ?? ""} `,
12
13
  props.model.name,
14
+ props.model instanceof models_1.DeclarationReflection &&
15
+ props.model.version !== undefined &&
16
+ ` - v${props.model.version}`,
13
17
  (0, lib_1.hasTypeParameters)(props.model) && (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
14
18
  "<",
15
19
  (0, lib_1.join)(", ", props.model.typeParameters, (item) => item.name),
@@ -1,4 +1,4 @@
1
1
  import type { DefaultThemeRenderContext } from "../DefaultThemeRenderContext";
2
2
  import { JSX } from "../../../../utils";
3
- import type { ContainerReflection } from "../../../../models";
3
+ import { ContainerReflection } from "../../../../models";
4
4
  export declare function index(context: DefaultThemeRenderContext, props: ContainerReflection): JSX.Element;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.index = void 0;
4
4
  const lib_1 = require("../../lib");
5
5
  const utils_1 = require("../../../../utils");
6
+ const models_1 = require("../../../../models");
6
7
  function renderCategory({ urlTo, icons }, item, prependName = "") {
7
8
  return (utils_1.JSX.createElement("section", { class: "tsd-index-section" },
8
9
  utils_1.JSX.createElement("h3", { class: "tsd-index-heading" }, prependName ? `${prependName} - ${item.title}` : item.title),
@@ -36,7 +37,13 @@ function index(context, props) {
36
37
  utils_1.JSX.createElement("h3", { class: "tsd-index-heading uppercase" }, "Index"),
37
38
  content));
38
39
  }
39
- return (utils_1.JSX.createElement("section", { class: "tsd-panel-group tsd-index-group" },
40
- utils_1.JSX.createElement("section", { class: "tsd-panel tsd-index-panel" }, content)));
40
+ return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
41
+ props instanceof models_1.DeclarationReflection &&
42
+ props.kind === models_1.ReflectionKind.Module &&
43
+ props.readme?.length !== 0 && (utils_1.JSX.createElement("section", { class: "tsd-panel-group" },
44
+ utils_1.JSX.createElement("section", { class: "tsd-panel tsd-typography" },
45
+ utils_1.JSX.createElement(utils_1.Raw, { html: context.markdown((0, lib_1.displayPartsToMarkdown)(props.readme || [], context.urlTo)) })))),
46
+ utils_1.JSX.createElement("section", { class: "tsd-panel-group tsd-index-group" },
47
+ utils_1.JSX.createElement("section", { class: "tsd-panel tsd-index-panel" }, content))));
41
48
  }
42
49
  exports.index = index;
@@ -3,3 +3,6 @@ import { JSX } from "../../../../utils";
3
3
  import type { PageEvent } from "../../../events";
4
4
  import type { DefaultThemeRenderContext } from "../DefaultThemeRenderContext";
5
5
  export declare function navigation(context: DefaultThemeRenderContext, props: PageEvent<Reflection>): JSX.Element;
6
+ export declare function settings(context: DefaultThemeRenderContext): JSX.Element;
7
+ export declare function primaryNavigation(context: DefaultThemeRenderContext, props: PageEvent<Reflection>): JSX.Element;
8
+ export declare function secondaryNavigation(context: DefaultThemeRenderContext, props: PageEvent<Reflection>): JSX.Element | undefined;
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.navigation = void 0;
3
+ exports.secondaryNavigation = exports.primaryNavigation = exports.settings = exports.navigation = void 0;
4
4
  const models_1 = require("../../../../models");
5
5
  const utils_1 = require("../../../../utils");
6
6
  const lib_1 = require("../../lib");
7
7
  function navigation(context, props) {
8
8
  return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
9
- settings(context),
10
- primaryNavigation(context, props),
11
- secondaryNavigation(context, props)));
9
+ context.settings(),
10
+ context.primaryNavigation(props),
11
+ context.secondaryNavigation(props)));
12
12
  }
13
13
  exports.navigation = navigation;
14
14
  function buildFilterItem(context, name, displayName, defaultValue) {
@@ -55,6 +55,7 @@ function settings(context) {
55
55
  utils_1.JSX.createElement("option", { value: "light" }, "Light"),
56
56
  utils_1.JSX.createElement("option", { value: "dark" }, "Dark")))))));
57
57
  }
58
+ exports.settings = settings;
58
59
  function primaryNavigation(context, props) {
59
60
  // Create the navigation for the current page
60
61
  const modules = props.model.project.getChildrenByKind(models_1.ReflectionKind.SomeModule);
@@ -82,10 +83,11 @@ function primaryNavigation(context, props) {
82
83
  childNav = utils_1.JSX.createElement("ul", null, childModules.map(link));
83
84
  }
84
85
  return (utils_1.JSX.createElement("li", { class: (0, lib_1.classNames)({ current, selected, deprecated: mod.isDeprecated() }, mod.cssClasses) },
85
- utils_1.JSX.createElement("a", { href: context.urlTo(mod) }, (0, lib_1.wbr)(mod.name)),
86
+ utils_1.JSX.createElement("a", { href: context.urlTo(mod) }, (0, lib_1.wbr)(`${mod.name}${mod.version !== undefined ? ` - v${mod.version}` : ""}`)),
86
87
  childNav));
87
88
  }
88
89
  }
90
+ exports.primaryNavigation = primaryNavigation;
89
91
  function secondaryNavigation(context, props) {
90
92
  // Multiple entry points, and on main project page.
91
93
  if (props.model.isProject() && props.model.getChildrenByKind(models_1.ReflectionKind.Module).length) {
@@ -117,6 +119,7 @@ function secondaryNavigation(context, props) {
117
119
  utils_1.JSX.createElement("span", null, (0, lib_1.wbr)(effectivePageParent.name))),
118
120
  !!pageNavigation.length && utils_1.JSX.createElement("ul", null, pageNavigation)))));
119
121
  }
122
+ exports.secondaryNavigation = secondaryNavigation;
120
123
  function inPath(thisPage, toCheck) {
121
124
  while (toCheck) {
122
125
  if (toCheck.isProject())
@@ -25,8 +25,10 @@ export declare const EntryPointStrategy: {
25
25
  export declare type EntryPointStrategy = typeof EntryPointStrategy[keyof typeof EntryPointStrategy];
26
26
  export interface DocumentationEntryPoint {
27
27
  displayName: string;
28
+ readmeFile?: string;
28
29
  program: ts.Program;
29
30
  sourceFile: ts.SourceFile;
31
+ version?: string;
30
32
  }
31
33
  export declare function getEntryPoints(logger: Logger, options: Options): DocumentationEntryPoint[] | undefined;
32
34
  export declare function getWatchEntryPoints(logger: Logger, options: Options, program: ts.Program): DocumentationEntryPoint[] | undefined;
@@ -4,6 +4,7 @@ exports.getExpandedEntryPointsForPaths = exports.getWatchEntryPoints = exports.g
4
4
  const path_1 = require("path");
5
5
  const ts = require("typescript");
6
6
  const FS = require("fs");
7
+ const Path = require("path");
7
8
  const package_manifest_1 = require("./package-manifest");
8
9
  const paths_1 = require("./paths");
9
10
  const fs_1 = require("./fs");
@@ -205,6 +206,10 @@ function getEntryPointsForPackages(logger, packageGlobPaths, options) {
205
206
  for (const packagePath of expandedPackages) {
206
207
  const packageJsonPath = (0, path_1.resolve)(packagePath, "package.json");
207
208
  const packageJson = (0, package_manifest_1.loadPackageManifest)(logger, packageJsonPath);
209
+ const includeVersion = options.getValue("includeVersion");
210
+ const typedocPackageConfig = packageJson
211
+ ? (0, package_manifest_1.extractTypedocConfigFromPackageManifest)(logger, packageJsonPath)
212
+ : undefined;
208
213
  if (packageJson === undefined) {
209
214
  logger.error(`Could not load package manifest ${packageJsonPath}`);
210
215
  return;
@@ -248,8 +253,18 @@ function getEntryPointsForPackages(logger, packageGlobPaths, options) {
248
253
  logger.error(`Entry point "${packageEntryPoint}" does not appear to be built by the tsconfig found at "${tsconfigFile}"`);
249
254
  return;
250
255
  }
256
+ if (includeVersion &&
257
+ (!packageJson["version"] ||
258
+ typeof packageJson["version"] !== "string")) {
259
+ logger.warn(`--includeVersion was specified, but "${(0, paths_1.nicePath)(packageJsonPath)}" does not properly specify a version.`);
260
+ }
251
261
  results.push({
252
- displayName: packageJson["name"],
262
+ displayName: typedocPackageConfig?.displayName ??
263
+ packageJson["name"],
264
+ version: packageJson["version"],
265
+ readmeFile: typedocPackageConfig?.readmeFile
266
+ ? Path.resolve(Path.join(packageJsonPath, "..", typedocPackageConfig?.readmeFile))
267
+ : undefined,
253
268
  program,
254
269
  sourceFile,
255
270
  });
@@ -98,16 +98,18 @@ class Logger {
98
98
  this.log(text, LogLevel.Info);
99
99
  }
100
100
  warn(text, ...args) {
101
- if (this.seenWarnings.has(text))
101
+ const text2 = this.addContext(text, LogLevel.Warn, ...args);
102
+ if (this.seenWarnings.has(text2))
102
103
  return;
103
- this.seenWarnings.add(text);
104
- this.log(this.addContext(text, LogLevel.Warn, ...args), LogLevel.Warn);
104
+ this.seenWarnings.add(text2);
105
+ this.log(text2, LogLevel.Warn);
105
106
  }
106
107
  error(text, ...args) {
107
- if (this.seenErrors.has(text))
108
+ const text2 = this.addContext(text, LogLevel.Error, ...args);
109
+ if (this.seenErrors.has(text2))
108
110
  return;
109
- this.seenErrors.add(text);
110
- this.log(this.addContext(text, LogLevel.Error, ...args), LogLevel.Error);
111
+ this.seenErrors.add(text2);
112
+ this.log(text2, LogLevel.Error);
111
113
  }
112
114
  /** @internal */
113
115
  deprecated(text, addStack = true) {
@@ -1,9 +1,21 @@
1
1
  import type { Logger } from "./loggers";
2
2
  import type { IMinimatch } from "minimatch";
3
+ import { additionalProperties, Infer } from "./validation";
3
4
  /**
4
5
  * Loads a package.json and validates that it is a JSON Object
5
6
  */
6
7
  export declare function loadPackageManifest(logger: Logger, packageJsonPath: string): Record<string, unknown> | undefined;
8
+ declare const typedocPackageManifestConfigSchema: {
9
+ displayName: import("./validation").Optional<StringConstructor>;
10
+ entryPoint: import("./validation").Optional<StringConstructor>;
11
+ readmeFile: import("./validation").Optional<StringConstructor>;
12
+ [additionalProperties]: boolean;
13
+ };
14
+ export declare type TypedocPackageManifestConfig = Infer<typeof typedocPackageManifestConfigSchema>;
15
+ /**
16
+ * Extracts typedoc specific config from a specified package manifest
17
+ */
18
+ export declare function extractTypedocConfigFromPackageManifest(logger: Logger, packageJsonPath: string): TypedocPackageManifestConfig | undefined;
7
19
  /**
8
20
  * Given a list of (potentially wildcarded) package paths,
9
21
  * return all the actual package folders found.
@@ -20,3 +32,4 @@ export declare const ignorePackage: unique symbol;
20
32
  * the necessary metadata for us to document.
21
33
  */
22
34
  export declare function getTsEntryPointForPackage(logger: Logger, packageJsonPath: string, packageJson: Record<string, unknown>): string | undefined | typeof ignorePackage;
35
+ export {};
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  // Utilities to support the inspection of node package "manifests"
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.getTsEntryPointForPackage = exports.ignorePackage = exports.expandPackages = exports.loadPackageManifest = void 0;
4
+ exports.getTsEntryPointForPackage = exports.ignorePackage = exports.expandPackages = exports.extractTypedocConfigFromPackageManifest = exports.loadPackageManifest = void 0;
5
5
  const path_1 = require("path");
6
6
  const fs_1 = require("fs");
7
7
  const fs_2 = require("./fs");
8
8
  const paths_1 = require("./paths");
9
+ const validation_1 = require("./validation");
9
10
  /**
10
11
  * Helper for the TS type system to understand hasOwnProperty
11
12
  * and narrow a type appropriately.
@@ -27,6 +28,32 @@ function loadPackageManifest(logger, packageJsonPath) {
27
28
  return packageJson;
28
29
  }
29
30
  exports.loadPackageManifest = loadPackageManifest;
31
+ const typedocPackageManifestConfigSchema = {
32
+ displayName: (0, validation_1.optional)(String),
33
+ entryPoint: (0, validation_1.optional)(String),
34
+ readmeFile: (0, validation_1.optional)(String),
35
+ [validation_1.additionalProperties]: false,
36
+ };
37
+ /**
38
+ * Extracts typedoc specific config from a specified package manifest
39
+ */
40
+ function extractTypedocConfigFromPackageManifest(logger, packageJsonPath) {
41
+ const packageJson = loadPackageManifest(logger, packageJsonPath);
42
+ if (!packageJson) {
43
+ return undefined;
44
+ }
45
+ if (hasOwnProperty(packageJson, "typedoc") &&
46
+ typeof packageJson.typedoc == "object" &&
47
+ packageJson.typedoc) {
48
+ if (!(0, validation_1.validate)(typedocPackageManifestConfigSchema, packageJson.typedoc)) {
49
+ logger.error(`Typedoc config extracted from package manifest file ${packageJsonPath} is not valid`);
50
+ return undefined;
51
+ }
52
+ return packageJson.typedoc;
53
+ }
54
+ return undefined;
55
+ }
56
+ exports.extractTypedocConfigFromPackageManifest = extractTypedocConfigFromPackageManifest;
30
57
  /**
31
58
  * Load the paths to packages specified in a Yarn workspace package JSON
32
59
  * Returns undefined if packageJSON does not define a Yarn workspace
@@ -146,8 +173,13 @@ exports.ignorePackage = Symbol("ignorePackage");
146
173
  function getTsEntryPointForPackage(logger, packageJsonPath, packageJson) {
147
174
  let packageMain = "index.js"; // The default, per the npm docs.
148
175
  let packageTypes = null;
149
- if (hasOwnProperty(packageJson, "typedocMain") &&
176
+ const typedocPackageConfig = extractTypedocConfigFromPackageManifest(logger, packageJsonPath);
177
+ if (typedocPackageConfig?.entryPoint) {
178
+ packageMain = typedocPackageConfig.entryPoint;
179
+ }
180
+ else if (hasOwnProperty(packageJson, "typedocMain") &&
150
181
  typeof packageJson.typedocMain == "string") {
182
+ logger.warn(`Legacy typedoc entry point config (using "typedocMain" field) found for "${(0, paths_1.nicePath)(packageJsonPath)}". Please update to use "typedoc": { "entryPoint": "..." } instead. In future upgrade, "typedocMain" field will be ignored.`);
151
183
  packageMain = packageJson.typedocMain;
152
184
  }
153
185
  else if (hasOwnProperty(packageJson, "main") &&
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "typedoc",
3
3
  "description": "Create api documentation for TypeScript projects.",
4
- "version": "0.23.5",
4
+ "version": "0.23.6",
5
5
  "homepage": "https://typedoc.org",
6
6
  "main": "./dist/index.js",
7
7
  "exports": {