typedoc 0.23.11 → 0.23.12

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.
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export { Converter, Context, type CommentParserConfig } from "./lib/converter";
7
7
  export { Renderer, DefaultTheme, DefaultThemeRenderContext, UrlMapping, Theme, PageEvent, RendererEvent, MarkdownEvent, IndexEvent, } from "./lib/output";
8
8
  export type { RenderTemplate, RendererHooks } from "./lib/output";
9
9
  export { ArgumentsReader, BindOption, CommentStyle, JSX, LogLevel, Logger, Options, ParameterHint, ParameterType, TSConfigReader, TypeDocReader, EntryPointStrategy, EventHooks, MinimalSourceFile, } from "./lib/utils";
10
- export type { OptionsReader, TypeDocOptions, TypeDocOptionMap, ValidationOptions, TypeDocOptionValues, KeyToDeclaration, DeclarationOption, DeclarationOptionBase, StringDeclarationOption, NumberDeclarationOption, BooleanDeclarationOption, ArrayDeclarationOption, MixedDeclarationOption, MapDeclarationOption, FlagsDeclarationOption, DeclarationOptionToOptionType, SortStrategy, ParameterTypeToOptionTypeMap, DocumentationEntryPoint, ManuallyValidatedOption, } from "./lib/utils";
10
+ export type { OptionsReader, TypeDocOptions, TypeDocOptionMap, ValidationOptions, TypeDocOptionValues, KeyToDeclaration, DeclarationOption, DeclarationOptionBase, StringDeclarationOption, NumberDeclarationOption, BooleanDeclarationOption, ArrayDeclarationOption, MixedDeclarationOption, ObjectDeclarationOption, MapDeclarationOption, FlagsDeclarationOption, DeclarationOptionToOptionType, SortStrategy, ParameterTypeToOptionTypeMap, DocumentationEntryPoint, ManuallyValidatedOption, } from "./lib/utils";
11
11
  export type { EventMap, EventCallback } from "./lib/utils/events";
12
12
  export { JSONOutput, Serializer, type SerializerComponent, SerializeEvent, } from "./lib/serialization";
13
13
  export type { SerializeEventData } from "./lib/serialization";
@@ -0,0 +1,3 @@
1
+ export declare const ApplicationEvents: {
2
+ BOOTSTRAP_END: string;
3
+ };
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApplicationEvents = void 0;
4
+ exports.ApplicationEvents = {
5
+ BOOTSTRAP_END: "bootstrapEnd",
6
+ };
@@ -46,6 +46,12 @@ export declare class Application extends ChildableComponent<Application, Abstrac
46
46
  * The version number of TypeDoc.
47
47
  */
48
48
  static VERSION: string;
49
+ /**
50
+ * Emitted after plugins have been loaded and options have been read, but before they have been frozen.
51
+ * The listener will be given an instance of {@link Application} and the {@link TypeDocOptions | Partial<TypeDocOptions>}
52
+ * passed to `bootstrap`.
53
+ */
54
+ static readonly EVENT_BOOTSTRAP_END: string;
49
55
  /**
50
56
  * Create a new TypeDoc application instance.
51
57
  *
@@ -24,6 +24,7 @@ const general_1 = require("./utils/general");
24
24
  const exports_1 = require("./validation/exports");
25
25
  const documentation_1 = require("./validation/documentation");
26
26
  const links_1 = require("./validation/links");
27
+ const application_events_1 = require("./application-events");
27
28
  // eslint-disable-next-line @typescript-eslint/no-var-requires
28
29
  const packageInfo = require("../../package.json");
29
30
  const supportedVersionMajorMinor = packageInfo.peerDependencies.typescript
@@ -98,6 +99,7 @@ let Application = Application_1 = class Application extends component_1.Childabl
98
99
  if ((0, general_1.hasBeenLoadedMultipleTimes)()) {
99
100
  this.logger.warn(`TypeDoc has been loaded multiple times. This is commonly caused by plugins which have their own installation of TypeDoc. The loaded paths are:\n\t${(0, general_1.getLoadedPaths)().join("\n\t")}`);
100
101
  }
102
+ this.trigger(application_events_1.ApplicationEvents.BOOTSTRAP_END, this, options);
101
103
  }
102
104
  /**
103
105
  * Return the path to the TypeScript compiler.
@@ -304,6 +306,12 @@ let Application = Application_1 = class Application extends component_1.Childabl
304
306
  * The version number of TypeDoc.
305
307
  */
306
308
  Application.VERSION = packageInfo.version;
309
+ /**
310
+ * Emitted after plugins have been loaded and options have been read, but before they have been frozen.
311
+ * The listener will be given an instance of {@link Application} and the {@link TypeDocOptions | Partial<TypeDocOptions>}
312
+ * passed to `bootstrap`.
313
+ */
314
+ Application.EVENT_BOOTSTRAP_END = application_events_1.ApplicationEvents.BOOTSTRAP_END;
307
315
  __decorate([
308
316
  (0, utils_1.BindOption)("logger")
309
317
  ], Application.prototype, "loggerType", void 0);
@@ -4,9 +4,7 @@ exports.getHeritageTypes = exports.isNamedNode = void 0;
4
4
  const ts = require("typescript");
5
5
  function isNamedNode(node) {
6
6
  const name = node.name;
7
- return (!!name &&
8
- (ts.isIdentifierOrPrivateIdentifier(name) ||
9
- ts.isComputedPropertyName(name)));
7
+ return !!name && (ts.isMemberName(name) || ts.isComputedPropertyName(name));
10
8
  }
11
9
  exports.isNamedNode = isNamedNode;
12
10
  function getHeritageTypes(declarations, kind) {
@@ -9,6 +9,7 @@ const package_manifest_1 = require("./package-manifest");
9
9
  const paths_1 = require("./paths");
10
10
  const fs_1 = require("./fs");
11
11
  const validation_1 = require("./validation");
12
+ const array_1 = require("./array");
12
13
  /**
13
14
  * Defines how entry points are interpreted.
14
15
  * @enum
@@ -191,6 +192,14 @@ function expandInputFiles(logger, entryPoints, options) {
191
192
  });
192
193
  return files;
193
194
  }
195
+ function deriveRootDir(packageGlobPaths) {
196
+ const globs = (0, paths_1.createMinimatch)(packageGlobPaths);
197
+ const rootPaths = globs.flatMap((glob) => (0, array_1.filterMap)(glob.set, (set) => {
198
+ const stop = set.findIndex((part) => typeof part !== "string");
199
+ return stop === -1 ? set.join("/") : set.slice(0, stop).join("/");
200
+ }));
201
+ return (0, fs_1.getCommonDirectory)(rootPaths);
202
+ }
194
203
  /**
195
204
  * Expand the provided packages configuration paths, determining the entry points
196
205
  * and creating the ts.Programs for any which are found.
@@ -201,9 +210,10 @@ function expandInputFiles(logger, entryPoints, options) {
201
210
  function getEntryPointsForPackages(logger, packageGlobPaths, options) {
202
211
  const results = [];
203
212
  const exclude = (0, paths_1.createMinimatch)(options.getValue("exclude"));
213
+ const rootDir = deriveRootDir(packageGlobPaths);
204
214
  // packages arguments are workspace tree roots, or glob patterns
205
215
  // This expands them to leave only leaf packages
206
- const expandedPackages = (0, package_manifest_1.expandPackages)(logger, ".", packageGlobPaths, exclude);
216
+ const expandedPackages = (0, package_manifest_1.expandPackages)(logger, rootDir, packageGlobPaths, exclude);
207
217
  for (const packagePath of expandedPackages) {
208
218
  const packageJsonPath = (0, path_1.resolve)(packagePath, "package.json");
209
219
  const packageJson = (0, package_manifest_1.loadPackageManifest)(logger, packageJsonPath);
@@ -149,10 +149,9 @@ function glob(pattern, root, options) {
149
149
  }
150
150
  if (child.isDirectory() && child.name !== "node_modules") {
151
151
  const childPath = dir.concat(child.name);
152
- if (mini.set.some((row) => mini.matchOne(
153
- // @ts-expect-error childPath really should be an array of strings, not a string.
154
- // https://github.com/DefinitelyTyped/DefinitelyTyped/pull/61956
155
- childPath, row,
152
+ if (mini.set.some((row) => mini.matchOne(childPath,
153
+ // @ts-expect-error https://github.com/DefinitelyTyped/DefinitelyTyped/pull/62049
154
+ row,
156
155
  /* partial */ true))) {
157
156
  dirs.push(childPath);
158
157
  }
@@ -7,7 +7,7 @@ export { assertNever } from "./general";
7
7
  export { CallbackLogger, ConsoleLogger, Logger, LogLevel } from "./loggers";
8
8
  export { DefaultMap } from "./map";
9
9
  export { ArgumentsReader, BindOption, CommentStyle, Options, ParameterHint, ParameterType, TSConfigReader, TypeDocReader, } from "./options";
10
- export type { ArrayDeclarationOption, BooleanDeclarationOption, DeclarationOption, DeclarationOptionBase, DeclarationOptionToOptionType, KeyToDeclaration, MapDeclarationOption, MixedDeclarationOption, NumberDeclarationOption, FlagsDeclarationOption, OptionsReader, StringDeclarationOption, TypeDocOptionMap, TypeDocOptions, ValidationOptions, TypeDocOptionValues, ParameterTypeToOptionTypeMap, ManuallyValidatedOption, } from "./options";
10
+ export type { ArrayDeclarationOption, BooleanDeclarationOption, DeclarationOption, DeclarationOptionBase, DeclarationOptionToOptionType, KeyToDeclaration, MapDeclarationOption, MixedDeclarationOption, NumberDeclarationOption, FlagsDeclarationOption, ObjectDeclarationOption, OptionsReader, StringDeclarationOption, TypeDocOptionMap, TypeDocOptions, ValidationOptions, TypeDocOptionValues, ParameterTypeToOptionTypeMap, ManuallyValidatedOption, } from "./options";
11
11
  export { discoverPlugins, loadPlugins } from "./plugins";
12
12
  export { sortReflections } from "./sort";
13
13
  export type { SortStrategy } from "./sort";
@@ -137,9 +137,11 @@ export declare type ValidationOptions = {
137
137
  /**
138
138
  * Converts a given TypeDoc option key to the type of the declaration expected.
139
139
  */
140
- export declare type KeyToDeclaration<K extends keyof TypeDocOptionMap> = TypeDocOptionMap[K] extends boolean ? BooleanDeclarationOption : TypeDocOptionMap[K] extends string ? StringDeclarationOption : TypeDocOptionMap[K] extends number ? NumberDeclarationOption : TypeDocOptionMap[K] extends string[] ? ArrayDeclarationOption : unknown extends TypeDocOptionMap[K] ? MixedDeclarationOption : TypeDocOptionMap[K] extends ManuallyValidatedOption<unknown> ? MixedDeclarationOption & {
140
+ export declare type KeyToDeclaration<K extends keyof TypeDocOptionMap> = TypeDocOptionMap[K] extends boolean ? BooleanDeclarationOption : TypeDocOptionMap[K] extends string ? StringDeclarationOption : TypeDocOptionMap[K] extends number ? NumberDeclarationOption : TypeDocOptionMap[K] extends string[] ? ArrayDeclarationOption : unknown extends TypeDocOptionMap[K] ? MixedDeclarationOption | ObjectDeclarationOption : TypeDocOptionMap[K] extends ManuallyValidatedOption<unknown> ? (MixedDeclarationOption & {
141
141
  validate(value: unknown): void;
142
- } : TypeDocOptionMap[K] extends Record<string, boolean> ? FlagsDeclarationOption<TypeDocOptionMap[K]> : TypeDocOptionMap[K] extends Record<string | number, infer U> ? MapDeclarationOption<U> : never;
142
+ }) | (ObjectDeclarationOption & {
143
+ validate(value: unknown): void;
144
+ }) : TypeDocOptionMap[K] extends Record<string, boolean> ? FlagsDeclarationOption<TypeDocOptionMap[K]> : TypeDocOptionMap[K] extends Record<string | number, infer U> ? MapDeclarationOption<U> : never;
143
145
  export declare enum ParameterHint {
144
146
  File = 0,
145
147
  Directory = 1
@@ -167,10 +169,14 @@ export declare enum ParameterType {
167
169
  * Resolved according to the config directory unless it starts with `**`, after skipping any leading `!` and `#` characters.
168
170
  */
169
171
  GlobArray = 9,
172
+ /**
173
+ * An unopinionated object that preserves default settings unless explicitly overridden
174
+ */
175
+ Object = 10,
170
176
  /**
171
177
  * An object with true/false flags
172
178
  */
173
- Flags = 10
179
+ Flags = 11
174
180
  }
175
181
  export interface DeclarationOptionBase {
176
182
  /**
@@ -258,6 +264,18 @@ export interface MixedDeclarationOption extends DeclarationOptionBase {
258
264
  */
259
265
  validate?: (value: unknown) => void;
260
266
  }
267
+ export interface ObjectDeclarationOption extends DeclarationOptionBase {
268
+ type: ParameterType.Object;
269
+ /**
270
+ * If not specified defaults to undefined.
271
+ */
272
+ defaultValue?: unknown;
273
+ /**
274
+ * An optional validation function that validates a potential value of this option.
275
+ * The function must throw an Error if the validation fails and should do nothing otherwise.
276
+ */
277
+ validate?: (value: unknown) => void;
278
+ }
261
279
  export interface MapDeclarationOption<T> extends DeclarationOptionBase {
262
280
  type: ParameterType.Map;
263
281
  /**
@@ -283,13 +301,14 @@ export interface FlagsDeclarationOption<T extends Record<string, boolean>> exten
283
301
  */
284
302
  defaults: T;
285
303
  }
286
- export declare type DeclarationOption = StringDeclarationOption | NumberDeclarationOption | BooleanDeclarationOption | MixedDeclarationOption | MapDeclarationOption<unknown> | ArrayDeclarationOption | FlagsDeclarationOption<Record<string, boolean>>;
304
+ export declare type DeclarationOption = StringDeclarationOption | NumberDeclarationOption | BooleanDeclarationOption | MixedDeclarationOption | ObjectDeclarationOption | MapDeclarationOption<unknown> | ArrayDeclarationOption | FlagsDeclarationOption<Record<string, boolean>>;
287
305
  export interface ParameterTypeToOptionTypeMap {
288
306
  [ParameterType.String]: string;
289
307
  [ParameterType.Path]: string;
290
308
  [ParameterType.Number]: number;
291
309
  [ParameterType.Boolean]: boolean;
292
310
  [ParameterType.Mixed]: unknown;
311
+ [ParameterType.Object]: unknown;
293
312
  [ParameterType.Array]: string[];
294
313
  [ParameterType.PathArray]: string[];
295
314
  [ParameterType.ModuleArray]: string[];
@@ -306,5 +325,5 @@ export declare type DeclarationOptionToOptionType<T extends DeclarationOption> =
306
325
  * @param option The option for which the value should be converted.
307
326
  * @returns The result of the conversion. Might be the value or an error.
308
327
  */
309
- export declare function convert(value: unknown, option: DeclarationOption, configPath: string): unknown;
328
+ export declare function convert(value: unknown, option: DeclarationOption, configPath: string, oldValue?: unknown): unknown;
310
329
  export declare function getDefaultValue(option: DeclarationOption): unknown;
@@ -47,10 +47,14 @@ var ParameterType;
47
47
  * Resolved according to the config directory unless it starts with `**`, after skipping any leading `!` and `#` characters.
48
48
  */
49
49
  ParameterType[ParameterType["GlobArray"] = 9] = "GlobArray";
50
+ /**
51
+ * An unopinionated object that preserves default settings unless explicitly overridden
52
+ */
53
+ ParameterType[ParameterType["Object"] = 10] = "Object";
50
54
  /**
51
55
  * An object with true/false flags
52
56
  */
53
- ParameterType[ParameterType["Flags"] = 10] = "Flags";
57
+ ParameterType[ParameterType["Flags"] = 11] = "Flags";
54
58
  })(ParameterType = exports.ParameterType || (exports.ParameterType = {}));
55
59
  const converters = {
56
60
  [ParameterType.String](value, option) {
@@ -146,6 +150,12 @@ const converters = {
146
150
  option.validate?.(value);
147
151
  return value;
148
152
  },
153
+ [ParameterType.Object](value, option, _configPath, oldValue) {
154
+ option.validate?.(value);
155
+ if (typeof oldValue !== "undefined")
156
+ value = { ...oldValue, ...value };
157
+ return value;
158
+ },
149
159
  [ParameterType.Flags](value, option) {
150
160
  if (typeof value === "boolean") {
151
161
  value = Object.fromEntries(Object.keys(option.defaults).map((key) => [key, value]));
@@ -179,9 +189,9 @@ const converters = {
179
189
  * @param option The option for which the value should be converted.
180
190
  * @returns The result of the conversion. Might be the value or an error.
181
191
  */
182
- function convert(value, option, configPath) {
192
+ function convert(value, option, configPath, oldValue) {
183
193
  const _converters = converters;
184
- return _converters[option.type ?? ParameterType.String](value, option, configPath);
194
+ return _converters[option.type ?? ParameterType.String](value, option, configPath, oldValue);
185
195
  }
186
196
  exports.convert = convert;
187
197
  const defaultGetters = {
@@ -209,6 +219,9 @@ const defaultGetters = {
209
219
  [ParameterType.Mixed](option) {
210
220
  return option.defaultValue;
211
221
  },
222
+ [ParameterType.Object](option) {
223
+ return option.defaultValue;
224
+ },
212
225
  [ParameterType.Array](option) {
213
226
  return option.defaultValue?.slice() ?? [];
214
227
  },
@@ -2,4 +2,4 @@ export { Options, BindOption } from "./options";
2
2
  export type { OptionsReader } from "./options";
3
3
  export { ArgumentsReader, TypeDocReader, TSConfigReader } from "./readers";
4
4
  export { CommentStyle, EmitStrategy, ParameterType, ParameterHint, } from "./declaration";
5
- export type { TypeDocOptions, TypeDocOptionMap, ValidationOptions, KeyToDeclaration, DeclarationOption, DeclarationOptionBase, StringDeclarationOption, NumberDeclarationOption, BooleanDeclarationOption, ArrayDeclarationOption, MixedDeclarationOption, MapDeclarationOption, FlagsDeclarationOption, DeclarationOptionToOptionType, TypeDocOptionValues, ParameterTypeToOptionTypeMap, ManuallyValidatedOption, } from "./declaration";
5
+ export type { TypeDocOptions, TypeDocOptionMap, ValidationOptions, KeyToDeclaration, DeclarationOption, DeclarationOptionBase, StringDeclarationOption, NumberDeclarationOption, BooleanDeclarationOption, ArrayDeclarationOption, MixedDeclarationOption, ObjectDeclarationOption, MapDeclarationOption, FlagsDeclarationOption, DeclarationOptionToOptionType, TypeDocOptionValues, ParameterTypeToOptionTypeMap, ManuallyValidatedOption, } from "./declaration";
@@ -164,7 +164,10 @@ class Options {
164
164
  if (!declaration) {
165
165
  throw new Error(`Tried to set an option (${name}) that was not declared.`);
166
166
  }
167
- const converted = (0, declaration_2.convert)(value, declaration, configPath ?? process.cwd());
167
+ let oldValue = this._values[declaration.name];
168
+ if (typeof oldValue === "undefined")
169
+ oldValue = (0, declaration_2.getDefaultValue)(declaration);
170
+ const converted = (0, declaration_2.convert)(value, declaration, configPath ?? process.cwd(), oldValue);
168
171
  if (declaration.type === declaration_1.ParameterType.Flags) {
169
172
  Object.assign(this._values[declaration.name], converted);
170
173
  }
@@ -1,5 +1,5 @@
1
1
  import type { Logger } from "./loggers";
2
- import type { IMinimatch } from "minimatch";
2
+ import type { Minimatch } from "minimatch";
3
3
  import { additionalProperties, Infer } from "./validation";
4
4
  /**
5
5
  * Loads a package.json and validates that it is a JSON Object
@@ -20,7 +20,7 @@ export declare function extractTypedocConfigFromPackageManifest(logger: Logger,
20
20
  * Given a list of (potentially wildcarded) package paths,
21
21
  * return all the actual package folders found.
22
22
  */
23
- export declare function expandPackages(logger: Logger, packageJsonDir: string, workspaces: string[], exclude: IMinimatch[]): string[];
23
+ export declare function expandPackages(logger: Logger, packageJsonDir: string, workspaces: string[], exclude: Minimatch[]): string[];
24
24
  export declare const ignorePackage: unique symbol;
25
25
  /**
26
26
  * Given a package.json, attempt to find the TS file that defines its entry point
@@ -1,9 +1,9 @@
1
- import { IMinimatch } from "minimatch";
1
+ import { Minimatch } from "minimatch";
2
2
  /**
3
3
  * Convert array of glob patterns to array of minimatch instances.
4
4
  *
5
5
  * Handle a few Windows-Unix path gotchas.
6
6
  */
7
- export declare function createMinimatch(patterns: string[]): IMinimatch[];
8
- export declare function matchesAny(patterns: readonly IMinimatch[], path: string): boolean;
7
+ export declare function createMinimatch(patterns: string[]): Minimatch[];
8
+ export declare function matchesAny(patterns: readonly Minimatch[], path: string): boolean;
9
9
  export declare function nicePath(absPath: string): string;
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.11",
4
+ "version": "0.23.12",
5
5
  "homepage": "https://typedoc.org",
6
6
  "main": "./dist/index.js",
7
7
  "exports": {
@@ -35,15 +35,15 @@
35
35
  "devDependencies": {
36
36
  "@types/lunr": "^2.3.4",
37
37
  "@types/marked": "^4.0.6",
38
- "@types/minimatch": "5.1.0",
38
+ "@types/minimatch": "5.1.1",
39
39
  "@types/mocha": "^9.1.1",
40
40
  "@types/node": "14",
41
- "@typescript-eslint/eslint-plugin": "^5.35.1",
42
- "@typescript-eslint/parser": "^5.35.1",
41
+ "@typescript-eslint/eslint-plugin": "^5.36.1",
42
+ "@typescript-eslint/parser": "^5.36.1",
43
43
  "@typestrong/fs-fixture-builder": "github:TypeStrong/fs-fixture-builder#b88cd06fe814614a0d924af9d10d04ff95a551de",
44
44
  "c8": "^7.12.0",
45
- "esbuild": "^0.15.5",
46
- "eslint": "^8.22.0",
45
+ "esbuild": "^0.15.6",
46
+ "eslint": "^8.23.0",
47
47
  "mocha": "^10.0.0",
48
48
  "prettier": "2.7.1",
49
49
  "puppeteer": "^13.5.2",
package/static/style.css CHANGED
@@ -1109,6 +1109,7 @@ ul.tsd-type-parameter-list h5 {
1109
1109
  background: var(--color-background-secondary);
1110
1110
  border-bottom: 1px var(--color-accent) solid;
1111
1111
  transition: transform 0.3s ease-in-out;
1112
+ margin: 0 auto;
1112
1113
  }
1113
1114
  .tsd-page-toolbar a {
1114
1115
  color: var(--color-text);