typedoc 0.28.6 → 0.28.8
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 +1 -1
- package/dist/lib/converter/comments/blockLexer.d.ts +2 -1
- package/dist/lib/converter/comments/blockLexer.js +6 -5
- package/dist/lib/converter/comments/discovery.js +7 -1
- package/dist/lib/converter/comments/index.d.ts +20 -5
- package/dist/lib/converter/comments/index.js +26 -23
- package/dist/lib/converter/comments/lineLexer.js +1 -1
- package/dist/lib/converter/comments/linkResolver.d.ts +2 -2
- package/dist/lib/converter/comments/linkResolver.js +53 -10
- package/dist/lib/converter/comments/parser.d.ts +2 -2
- package/dist/lib/converter/comments/parser.js +6 -6
- package/dist/lib/converter/comments/rawLexer.js +1 -1
- package/dist/lib/converter/comments/textParser.js +93 -19
- package/dist/lib/converter/context.d.ts +10 -0
- package/dist/lib/converter/context.js +30 -10
- package/dist/lib/converter/converter.d.ts +3 -1
- package/dist/lib/converter/converter.js +6 -3
- package/dist/lib/converter/factories/signature.js +1 -2
- package/dist/lib/converter/factories/symbol-id.d.ts +1 -1
- package/dist/lib/converter/factories/symbol-id.js +2 -1
- package/dist/lib/converter/jsdoc.js +1 -2
- package/dist/lib/converter/plugins/CategoryPlugin.d.ts +3 -2
- package/dist/lib/converter/plugins/CategoryPlugin.js +15 -3
- package/dist/lib/converter/plugins/GroupPlugin.d.ts +2 -1
- package/dist/lib/converter/plugins/GroupPlugin.js +23 -9
- package/dist/lib/converter/plugins/ImplementsPlugin.js +49 -11
- package/dist/lib/converter/plugins/LinkResolverPlugin.d.ts +1 -2
- package/dist/lib/converter/plugins/LinkResolverPlugin.js +1 -55
- package/dist/lib/converter/types.js +2 -3
- package/dist/lib/converter/utils/repository.js +1 -1
- package/dist/lib/internationalization/internationalization.js +1 -1
- package/dist/lib/internationalization/locales/en.cjs +4 -1
- package/dist/lib/internationalization/locales/en.d.cts +4 -1
- package/dist/lib/models/Comment.js +1 -1
- package/dist/lib/models/ContainerReflection.d.ts +1 -0
- package/dist/lib/models/ContainerReflection.js +3 -0
- package/dist/lib/models/Reflection.d.ts +2 -0
- package/dist/lib/models/Reflection.js +3 -0
- package/dist/lib/output/themes/default/partials/moduleReflection.js +1 -1
- package/dist/lib/output/themes/default/partials/navigation.js +1 -1
- package/dist/lib/output/themes/default/templates/hierarchy.js +1 -1
- package/dist/lib/serialization/schema.d.ts +1 -1
- package/dist/lib/utils/options/declaration.d.ts +17 -9
- package/dist/lib/utils/options/declaration.js +52 -31
- package/dist/lib/utils/options/readers/arguments.js +2 -0
- package/dist/lib/utils/options/sources/typedoc.js +2 -5
- package/dist/lib/utils/options/tsdoc-defaults.d.ts +1 -1
- package/dist/lib/utils/options/tsdoc-defaults.js +1 -0
- package/dist/lib/utils/plugins.d.ts +2 -1
- package/dist/lib/utils/plugins.js +26 -17
- package/dist/lib/utils/sort.d.ts +2 -1
- package/dist/lib/utils/sort.js +4 -2
- package/dist/lib/utils-common/array.d.ts +1 -2
- package/dist/lib/utils-common/array.js +0 -7
- package/dist/lib/utils-common/jsx.elements.d.ts +1 -1
- package/dist/lib/utils-common/jsx.js +7 -6
- package/dist/lib/utils-common/map.d.ts +1 -1
- package/dist/lib/utils-common/path.d.ts +6 -0
- package/dist/lib/utils-common/validation.js +1 -1
- package/dist/lib/validation/links.js +0 -3
- package/package.json +12 -12
- package/static/style.css +2 -9
- package/tsdoc.json +4 -0
|
@@ -66,6 +66,7 @@ declare const _default: {
|
|
|
66
66
|
readonly not_all_search_group_boosts_used_0: "Not all groups specified in searchGroupBoosts were used in the documentation. The unused groups were:\n\t{0}";
|
|
67
67
|
readonly comment_for_0_includes_categoryDescription_for_1_but_no_child_in_group: "Comment for {0} includes @categoryDescription for \"{1}\", but no child is placed in that category";
|
|
68
68
|
readonly comment_for_0_includes_groupDescription_for_1_but_no_child_in_group: "Comment for {0} includes @groupDescription for \"{1}\", but no child is placed in that group";
|
|
69
|
+
readonly comment_for_0_specifies_1_as_sort_strategy_but_only_2_is_valid: "Comment for {0} specifies @sortStrategy with \"{1}\", which is an invalid sort strategy, the following are valid:\n\t{2}";
|
|
69
70
|
readonly label_0_for_1_cannot_be_referenced: "The label \"{0}\" for {1} cannot be referenced with a declaration reference. Labels may only contain A-Z, 0-9, and _, and may not start with a number";
|
|
70
71
|
readonly modifier_tag_0_is_mutually_exclusive_with_1_in_comment_for_2: "The modifier tag {0} is mutually exclusive with {1} in the comment for {2}";
|
|
71
72
|
readonly signature_0_has_unused_param_with_name_1: "The signature {0} has an @param with name \"{1}\", which was not used";
|
|
@@ -258,13 +259,15 @@ declare const _default: {
|
|
|
258
259
|
readonly useHostedBaseUrlForAbsoluteLinks_requires_hostedBaseUrl: "The useHostedBaseUrlForAbsoluteLinks option requires that hostedBaseUrl be set";
|
|
259
260
|
readonly favicon_must_have_one_of_the_following_extensions_0: "Favicon must have one of the following extensions: {0}";
|
|
260
261
|
readonly option_0_must_be_an_object: "The '{0}' option must be a non-array object";
|
|
262
|
+
readonly option_0_must_be_an_array_of_string: "The '{0}' option must be set to an array of strings";
|
|
263
|
+
readonly option_0_must_be_an_array_of_string_or_functions: "The '{0}' option must be set to an array of strings/functions";
|
|
261
264
|
readonly option_0_must_be_a_function: "The '{0}' option must be a function";
|
|
262
265
|
readonly option_0_must_be_object_with_urls: "{0} must be an object with string labels as keys and URL values";
|
|
263
266
|
readonly visibility_filters_only_include_0: "visibilityFilters can only include the following non-@ keys: {0}";
|
|
264
267
|
readonly visibility_filters_must_be_booleans: "All values of visibilityFilters must be booleans";
|
|
265
268
|
readonly option_0_values_must_be_numbers: "All values of {0} must be numbers";
|
|
266
269
|
readonly option_0_values_must_be_array_of_tags: "{0} must be an array of valid tag names";
|
|
267
|
-
readonly option_0_specified_1_but_only_2_is_valid: "{0} may only specify known values, and invalid values were provided ({1}). The valid
|
|
270
|
+
readonly option_0_specified_1_but_only_2_is_valid: "{0} may only specify known values, and invalid values were provided ({1}). The valid options are:\n{2}";
|
|
268
271
|
readonly option_outputs_must_be_array: "\"outputs\" option must be an array of { name: string, path: string, options?: TypeDocOptions } values.";
|
|
269
272
|
readonly specified_output_0_has_not_been_defined: "Specified output \"{0}\" has not been defined.";
|
|
270
273
|
readonly alert_note: "Note";
|
|
@@ -49,6 +49,7 @@ export declare abstract class ContainerReflection extends Reflection {
|
|
|
49
49
|
getChildrenByKind(kind: ReflectionKind): DeclarationReflection[];
|
|
50
50
|
addChild(child: Reflection): void;
|
|
51
51
|
removeChild(child: DeclarationReflection | DocumentReflection): void;
|
|
52
|
+
isContainer(): this is ContainerReflection;
|
|
52
53
|
traverse(callback: TraverseCallback): void;
|
|
53
54
|
toObject(serializer: Serializer): JSONOutput.ContainerReflection;
|
|
54
55
|
fromObject(de: Deserializer, obj: JSONOutput.ContainerReflection): void;
|
|
@@ -100,6 +100,9 @@ export class ContainerReflection extends Reflection {
|
|
|
100
100
|
delete this.childrenIncludingDocuments;
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
+
isContainer() {
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
103
106
|
traverse(callback) {
|
|
104
107
|
for (const child of this.children?.slice() || []) {
|
|
105
108
|
if (callback(child, TraverseProperty.Children) === false) {
|
|
@@ -10,6 +10,7 @@ import type { ParameterReflection } from "./ParameterReflection.js";
|
|
|
10
10
|
import type { ReferenceReflection } from "./ReferenceReflection.js";
|
|
11
11
|
import type { SignatureReflection } from "./SignatureReflection.js";
|
|
12
12
|
import type { TypeParameterReflection } from "./TypeParameterReflection.js";
|
|
13
|
+
import type { ContainerReflection } from "./ContainerReflection.js";
|
|
13
14
|
/**
|
|
14
15
|
* Reset the reflection id.
|
|
15
16
|
*
|
|
@@ -193,6 +194,7 @@ export declare abstract class Reflection {
|
|
|
193
194
|
isParameter(): this is ParameterReflection;
|
|
194
195
|
isDocument(): this is DocumentReflection;
|
|
195
196
|
isReference(): this is ReferenceReflection;
|
|
197
|
+
isContainer(): this is ContainerReflection;
|
|
196
198
|
/**
|
|
197
199
|
* Check if this reflection or any of its parents have been marked with the `@deprecated` tag.
|
|
198
200
|
*/
|
|
@@ -8,7 +8,7 @@ export function moduleReflection(context, mod) {
|
|
|
8
8
|
mod.hasComment() && (JSX.createElement("section", { class: "tsd-panel tsd-comment" },
|
|
9
9
|
context.commentSummary(mod),
|
|
10
10
|
context.commentTags(mod))),
|
|
11
|
-
mod.isDeclaration() && mod.kind === ReflectionKind.Module && mod.readme?.length && (JSX.createElement("section", { class: "tsd-panel tsd-typography" },
|
|
11
|
+
mod.isDeclaration() && mod.kind === ReflectionKind.Module && !!mod.readme?.length && (JSX.createElement("section", { class: "tsd-panel tsd-typography" },
|
|
12
12
|
JSX.createElement(JSX.Raw, { html: context.markdown(mod.readme) }))),
|
|
13
13
|
sections.map((section) => {
|
|
14
14
|
if (!isNoneSection(section)) {
|
|
@@ -53,7 +53,7 @@ export function settings(context) {
|
|
|
53
53
|
context.icons.chevronDown(),
|
|
54
54
|
JSX.createElement("h3", null, i18n.theme_settings())),
|
|
55
55
|
JSX.createElement("div", { class: "tsd-accordion-details" },
|
|
56
|
-
visibilityOptions.length && (JSX.createElement("div", { class: "tsd-filter-visibility" },
|
|
56
|
+
!!visibilityOptions.length && (JSX.createElement("div", { class: "tsd-filter-visibility" },
|
|
57
57
|
JSX.createElement("span", { class: "settings-label" }, i18n.theme_member_visibility()),
|
|
58
58
|
JSX.createElement("ul", { id: "tsd-filter-options" }, ...visibilityOptions))),
|
|
59
59
|
JSX.createElement("div", { class: "tsd-theme-toggle" },
|
|
@@ -21,7 +21,7 @@ function fullHierarchy(context, root, seen) {
|
|
|
21
21
|
JSX.createElement("a", { href: context.urlTo(root) },
|
|
22
22
|
context.reflectionIcon(root),
|
|
23
23
|
root.name),
|
|
24
|
-
children.length && JSX.createElement("ul", null, children)));
|
|
24
|
+
!!children.length && JSX.createElement("ul", null, children)));
|
|
25
25
|
}
|
|
26
26
|
export function hierarchyTemplate(context, props) {
|
|
27
27
|
const seen = new Set();
|
|
@@ -37,7 +37,7 @@ export declare const SCHEMA_VERSION = "2.0";
|
|
|
37
37
|
export type ModelToObject<T> = [T] extends [Array<infer U>] ? ModelToObject<U>[] : [
|
|
38
38
|
M.SomeType
|
|
39
39
|
] extends [T] ? SomeType : _ModelToObject<T>;
|
|
40
|
-
type _ModelToObject<T> = T extends Primitive ? T : Required<T> extends Required<M.ReflectionGroup> ? ReflectionGroup : Required<T> extends Required<M.ReflectionCategory> ? ReflectionCategory : T extends M.ReflectionVariant[keyof M.ReflectionVariant] ? ReflectionVariantMap[T["variant"]] : T extends M.SomeType ? TypeKindMap[T["type"]] : T extends M.Type ? SomeType : T extends M.Comment ? Comment : T extends M.CommentTag ? CommentTag : T extends M.CommentDisplayPart ? CommentDisplayPart : T extends M.SourceReference ? SourceReference : T extends M.FileRegistry ? FileRegistry : never;
|
|
40
|
+
type _ModelToObject<T> = T extends Primitive ? T : Required<T> extends Required<M.ReflectionGroup> ? ReflectionGroup : Required<T> extends Required<M.ReflectionCategory> ? ReflectionCategory : T extends M.ReflectionVariant[keyof M.ReflectionVariant] ? ReflectionVariantMap[T["variant"]] : T extends M.SomeType ? TypeKindMap[T["type"]] : T extends M.Type ? SomeType : T extends M.Comment ? Comment : T extends M.CommentTag ? CommentTag : T extends M.CommentDisplayPart ? CommentDisplayPart : T extends M.SourceReference ? SourceReference : T extends M.FileRegistry ? FileRegistry : T extends M.ReflectionSymbolId ? ReflectionSymbolId : never;
|
|
41
41
|
type Primitive = string | number | undefined | null | boolean;
|
|
42
42
|
type ToSerialized<T> = T extends Primitive ? T : T extends bigint ? {
|
|
43
43
|
value: string;
|
|
@@ -2,8 +2,9 @@ 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 } from "#utils";
|
|
5
|
+
import { type GlobString, type LogLevel, type NeverIfInternal, type NormalizedPath, type NormalizedPathOrModule, type NormalizedPathOrModuleOrFunction } from "#utils";
|
|
6
6
|
import type { TranslationProxy } from "../../internationalization/internationalization.js";
|
|
7
|
+
import type { Application } from "../../application.js";
|
|
7
8
|
/** @enum */
|
|
8
9
|
export declare const EmitStrategy: {
|
|
9
10
|
readonly both: "both";
|
|
@@ -40,7 +41,7 @@ export declare const rootPackageOptions: readonly ["plugin", "packageOptions", "
|
|
|
40
41
|
* @interface
|
|
41
42
|
*/
|
|
42
43
|
export type TypeDocOptions = {
|
|
43
|
-
[K in keyof TypeDocOptionMap]?: unknown extends TypeDocOptionMap[K] ? unknown : TypeDocOptionMap[K] extends ManuallyValidatedOption<infer ManuallyValidated> ? ManuallyValidated : TypeDocOptionMap[K] extends NormalizedPath[] | NormalizedPathOrModule[] | GlobString[] ? string[] : TypeDocOptionMap[K] extends NormalizedPath ? string : TypeDocOptionMap[K] extends string | string[] | number | boolean ? TypeDocOptionMap[K] : TypeDocOptionMap[K] extends Record<string, boolean> ? Partial<TypeDocOptionMap[K]> | boolean : keyof TypeDocOptionMap[K] | TypeDocOptionMap[K][keyof TypeDocOptionMap[K]];
|
|
44
|
+
[K in keyof TypeDocOptionMap]?: unknown extends TypeDocOptionMap[K] ? unknown : TypeDocOptionMap[K] extends ManuallyValidatedOption<infer ManuallyValidated> ? ManuallyValidated : TypeDocOptionMap[K] extends NormalizedPath[] | NormalizedPathOrModule[] | NormalizedPathOrModuleOrFunction[] | GlobString[] ? string[] : TypeDocOptionMap[K] extends NormalizedPath ? string : TypeDocOptionMap[K] extends string | string[] | number | boolean ? TypeDocOptionMap[K] : TypeDocOptionMap[K] extends Record<string, boolean> ? Partial<TypeDocOptionMap[K]> | boolean : keyof TypeDocOptionMap[K] | TypeDocOptionMap[K][keyof TypeDocOptionMap[K]];
|
|
44
45
|
};
|
|
45
46
|
/**
|
|
46
47
|
* Describes all TypeDoc specific options as returned by {@link Options.getValue}, this is
|
|
@@ -50,7 +51,7 @@ export type TypeDocOptions = {
|
|
|
50
51
|
* @interface
|
|
51
52
|
*/
|
|
52
53
|
export type TypeDocOptionValues = {
|
|
53
|
-
[K in keyof TypeDocOptionMap]: unknown extends TypeDocOptionMap[K] ? unknown : TypeDocOptionMap[K] extends ManuallyValidatedOption<infer ManuallyValidated> ? ManuallyValidated : TypeDocOptionMap[K] extends string | string[] | GlobString[] | number | boolean | Record<string, boolean> ? TypeDocOptionMap[K] : TypeDocOptionMap[K][keyof TypeDocOptionMap[K]];
|
|
54
|
+
[K in keyof TypeDocOptionMap]: unknown extends TypeDocOptionMap[K] ? unknown : TypeDocOptionMap[K] extends ManuallyValidatedOption<infer ManuallyValidated> ? ManuallyValidated : TypeDocOptionMap[K] extends string | string[] | GlobString[] | NormalizedPathOrModule[] | NormalizedPathOrModuleOrFunction[] | number | boolean | Record<string, boolean> ? TypeDocOptionMap[K] : TypeDocOptionMap[K][keyof TypeDocOptionMap[K]];
|
|
54
55
|
};
|
|
55
56
|
/**
|
|
56
57
|
* Describes TypeDoc options suitable for setting within the `packageOptions` setting.
|
|
@@ -78,7 +79,7 @@ export interface TypeDocOptionMap {
|
|
|
78
79
|
options: NormalizedPath;
|
|
79
80
|
tsconfig: NormalizedPath;
|
|
80
81
|
compilerOptions: unknown;
|
|
81
|
-
plugin:
|
|
82
|
+
plugin: NormalizedPathOrModuleOrFunction[];
|
|
82
83
|
lang: string;
|
|
83
84
|
locales: ManuallyValidatedOption<Record<string, Record<string, string>>>;
|
|
84
85
|
packageOptions: ManuallyValidatedOption<TypeDocPackageOptions>;
|
|
@@ -276,7 +277,7 @@ export type JsDocCompatibility = {
|
|
|
276
277
|
/**
|
|
277
278
|
* Converts a given TypeDoc option key to the type of the declaration expected.
|
|
278
279
|
*/
|
|
279
|
-
export type KeyToDeclaration<K extends keyof TypeDocOptionMap> = TypeDocOptionMap[K] extends boolean ? BooleanDeclarationOption : TypeDocOptionMap[K] extends string | NormalizedPath ? StringDeclarationOption : TypeDocOptionMap[K] extends number ? NumberDeclarationOption : TypeDocOptionMap[K] extends GlobString[] ? GlobArrayDeclarationOption : TypeDocOptionMap[K] extends string[] | NormalizedPath[] | NormalizedPathOrModule[] ? ArrayDeclarationOption : unknown extends TypeDocOptionMap[K] ? MixedDeclarationOption | ObjectDeclarationOption : TypeDocOptionMap[K] extends ManuallyValidatedOption<unknown> ? (MixedDeclarationOption & {
|
|
280
|
+
export type KeyToDeclaration<K extends keyof TypeDocOptionMap> = TypeDocOptionMap[K] extends boolean ? BooleanDeclarationOption : TypeDocOptionMap[K] extends string | NormalizedPath ? StringDeclarationOption : TypeDocOptionMap[K] extends number ? NumberDeclarationOption : TypeDocOptionMap[K] extends GlobString[] ? GlobArrayDeclarationOption : TypeDocOptionMap[K] extends string[] | NormalizedPath[] | NormalizedPathOrModule[] | NormalizedPathOrModuleOrFunction[] ? ArrayDeclarationOption : unknown extends TypeDocOptionMap[K] ? MixedDeclarationOption | ObjectDeclarationOption : TypeDocOptionMap[K] extends ManuallyValidatedOption<unknown> ? (MixedDeclarationOption & {
|
|
280
281
|
validate(value: unknown, i18n: TranslationProxy): void;
|
|
281
282
|
}) | (ObjectDeclarationOption & {
|
|
282
283
|
validate(value: unknown, i18n: TranslationProxy): void;
|
|
@@ -306,20 +307,26 @@ export declare enum ParameterType {
|
|
|
306
307
|
PathArray = 8,
|
|
307
308
|
/**
|
|
308
309
|
* Resolved according to the config directory if it starts with `.`
|
|
310
|
+
* @deprecated since 0.28.8, will be removed in 0.29
|
|
309
311
|
*/
|
|
310
312
|
ModuleArray = 9,
|
|
313
|
+
/**
|
|
314
|
+
* Resolved according to the config directory if it starts with `.`
|
|
315
|
+
* @internal - only intended for use with the plugin option
|
|
316
|
+
*/
|
|
317
|
+
PluginArray = 10,
|
|
311
318
|
/**
|
|
312
319
|
* Relative to the config directory.
|
|
313
320
|
*/
|
|
314
|
-
GlobArray =
|
|
321
|
+
GlobArray = 11,
|
|
315
322
|
/**
|
|
316
323
|
* An object which partially merges user-set values into the defaults.
|
|
317
324
|
*/
|
|
318
|
-
Object =
|
|
325
|
+
Object = 12,
|
|
319
326
|
/**
|
|
320
327
|
* An object with true/false flags
|
|
321
328
|
*/
|
|
322
|
-
Flags =
|
|
329
|
+
Flags = 13
|
|
323
330
|
}
|
|
324
331
|
export interface DeclarationOptionBase {
|
|
325
332
|
/**
|
|
@@ -401,7 +408,7 @@ export interface BooleanDeclarationOption extends DeclarationOptionBase {
|
|
|
401
408
|
defaultValue?: boolean;
|
|
402
409
|
}
|
|
403
410
|
export interface ArrayDeclarationOption extends DeclarationOptionBase {
|
|
404
|
-
type: ParameterType.Array | ParameterType.PathArray | ParameterType.ModuleArray;
|
|
411
|
+
type: ParameterType.Array | ParameterType.PathArray | ParameterType.ModuleArray | ParameterType.PluginArray;
|
|
405
412
|
/**
|
|
406
413
|
* If not specified defaults to an empty array.
|
|
407
414
|
*/
|
|
@@ -482,6 +489,7 @@ export interface ParameterTypeToOptionTypeMap {
|
|
|
482
489
|
[ParameterType.Array]: string[];
|
|
483
490
|
[ParameterType.PathArray]: NormalizedPath[];
|
|
484
491
|
[ParameterType.ModuleArray]: NormalizedPathOrModule[];
|
|
492
|
+
[ParameterType.PluginArray]: Array<NormalizedPathOrModule | ((app: Application) => void | Promise<void>)>;
|
|
485
493
|
[ParameterType.GlobArray]: GlobString[];
|
|
486
494
|
[ParameterType.Flags]: Record<string, boolean>;
|
|
487
495
|
[ParameterType.Map]: unknown;
|
|
@@ -112,21 +112,45 @@ export var ParameterType;
|
|
|
112
112
|
ParameterType[ParameterType["PathArray"] = 8] = "PathArray";
|
|
113
113
|
/**
|
|
114
114
|
* Resolved according to the config directory if it starts with `.`
|
|
115
|
+
* @deprecated since 0.28.8, will be removed in 0.29
|
|
115
116
|
*/
|
|
116
117
|
ParameterType[ParameterType["ModuleArray"] = 9] = "ModuleArray";
|
|
118
|
+
/**
|
|
119
|
+
* Resolved according to the config directory if it starts with `.`
|
|
120
|
+
* @internal - only intended for use with the plugin option
|
|
121
|
+
*/
|
|
122
|
+
ParameterType[ParameterType["PluginArray"] = 10] = "PluginArray";
|
|
117
123
|
/**
|
|
118
124
|
* Relative to the config directory.
|
|
119
125
|
*/
|
|
120
|
-
ParameterType[ParameterType["GlobArray"] =
|
|
126
|
+
ParameterType[ParameterType["GlobArray"] = 11] = "GlobArray";
|
|
121
127
|
/**
|
|
122
128
|
* An object which partially merges user-set values into the defaults.
|
|
123
129
|
*/
|
|
124
|
-
ParameterType[ParameterType["Object"] =
|
|
130
|
+
ParameterType[ParameterType["Object"] = 12] = "Object";
|
|
125
131
|
/**
|
|
126
132
|
* An object with true/false flags
|
|
127
133
|
*/
|
|
128
|
-
ParameterType[ParameterType["Flags"] =
|
|
134
|
+
ParameterType[ParameterType["Flags"] = 13] = "Flags";
|
|
129
135
|
})(ParameterType || (ParameterType = {}));
|
|
136
|
+
function toStringArray(value, option) {
|
|
137
|
+
if (Array.isArray(value) && value.every(v => typeof v === "string")) {
|
|
138
|
+
return value;
|
|
139
|
+
}
|
|
140
|
+
else if (typeof value === "string") {
|
|
141
|
+
return [value];
|
|
142
|
+
}
|
|
143
|
+
throw new Error(i18n.option_0_must_be_an_array_of_string(option.name));
|
|
144
|
+
}
|
|
145
|
+
function toStringOrFunctionArray(value, option) {
|
|
146
|
+
if (Array.isArray(value) && value.every(v => typeof v === "string" || typeof v === "function")) {
|
|
147
|
+
return value;
|
|
148
|
+
}
|
|
149
|
+
else if (typeof value === "string") {
|
|
150
|
+
return [value];
|
|
151
|
+
}
|
|
152
|
+
throw new Error(i18n.option_0_must_be_an_array_of_string_or_functions(option.name));
|
|
153
|
+
}
|
|
130
154
|
const converters = {
|
|
131
155
|
[ParameterType.String](value, option) {
|
|
132
156
|
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
@@ -164,40 +188,28 @@ const converters = {
|
|
|
164
188
|
return !!value;
|
|
165
189
|
},
|
|
166
190
|
[ParameterType.Array](value, option) {
|
|
167
|
-
|
|
168
|
-
if (Array.isArray(value)) {
|
|
169
|
-
strArrValue = value.map(String);
|
|
170
|
-
}
|
|
171
|
-
else if (typeof value === "string") {
|
|
172
|
-
strArrValue = [value];
|
|
173
|
-
}
|
|
191
|
+
const strArrValue = toStringArray(value, option);
|
|
174
192
|
option.validate?.(strArrValue);
|
|
175
193
|
return strArrValue;
|
|
176
194
|
},
|
|
177
195
|
[ParameterType.PathArray](value, option, configPath) {
|
|
178
|
-
|
|
179
|
-
if (Array.isArray(value)) {
|
|
180
|
-
strArrValue = value.map(String);
|
|
181
|
-
}
|
|
182
|
-
else if (typeof value === "string") {
|
|
183
|
-
strArrValue = [value];
|
|
184
|
-
}
|
|
196
|
+
const strArrValue = toStringArray(value, option);
|
|
185
197
|
const normalized = strArrValue.map((path) => normalizePath(resolve(configPath, path)));
|
|
186
198
|
option.validate?.(normalized);
|
|
187
199
|
return normalized;
|
|
188
200
|
},
|
|
201
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
189
202
|
[ParameterType.ModuleArray](value, option, configPath) {
|
|
190
|
-
|
|
191
|
-
if (Array.isArray(value)) {
|
|
192
|
-
strArrValue = value.map(String);
|
|
193
|
-
}
|
|
194
|
-
else if (typeof value === "string") {
|
|
195
|
-
strArrValue = [value];
|
|
196
|
-
}
|
|
203
|
+
const strArrValue = toStringArray(value, option);
|
|
197
204
|
const resolved = resolveModulePaths(strArrValue, configPath);
|
|
198
205
|
option.validate?.(resolved);
|
|
199
206
|
return resolved;
|
|
200
207
|
},
|
|
208
|
+
[ParameterType.PluginArray](value, option, configPath) {
|
|
209
|
+
const arrayValue = toStringOrFunctionArray(value, option);
|
|
210
|
+
const resolved = arrayValue.map(plugin => typeof plugin === "function" ? plugin : resolveModulePath(plugin, configPath));
|
|
211
|
+
return resolved;
|
|
212
|
+
},
|
|
201
213
|
[ParameterType.GlobArray](value, option, configPath) {
|
|
202
214
|
const toGlobString = (v) => {
|
|
203
215
|
const s = String(v);
|
|
@@ -210,7 +222,8 @@ const converters = {
|
|
|
210
222
|
}
|
|
211
223
|
return createGlobString(configPath, s);
|
|
212
224
|
};
|
|
213
|
-
const
|
|
225
|
+
const strArrValue = toStringArray(value, option);
|
|
226
|
+
const globs = strArrValue.map(toGlobString);
|
|
214
227
|
option.validate?.(globs);
|
|
215
228
|
return globs;
|
|
216
229
|
},
|
|
@@ -329,12 +342,19 @@ const defaultGetters = {
|
|
|
329
342
|
[ParameterType.PathArray](option) {
|
|
330
343
|
return (option.defaultValue?.map((value) => normalizePath(resolve(process.cwd(), value))) ?? []);
|
|
331
344
|
},
|
|
345
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
332
346
|
[ParameterType.ModuleArray](option) {
|
|
333
347
|
if (option.defaultValue) {
|
|
334
348
|
return resolveModulePaths(option.defaultValue, process.cwd());
|
|
335
349
|
}
|
|
336
350
|
return [];
|
|
337
351
|
},
|
|
352
|
+
[ParameterType.PluginArray](option) {
|
|
353
|
+
if (option.defaultValue) {
|
|
354
|
+
return resolveModulePaths(option.defaultValue, process.cwd());
|
|
355
|
+
}
|
|
356
|
+
return [];
|
|
357
|
+
},
|
|
338
358
|
[ParameterType.GlobArray](option) {
|
|
339
359
|
return (option.defaultValue ?? []).map(g => createGlobString(normalizePath(process.cwd()), g));
|
|
340
360
|
},
|
|
@@ -347,12 +367,13 @@ export function getDefaultValue(option) {
|
|
|
347
367
|
return getters[option.type ?? ParameterType.String](option);
|
|
348
368
|
}
|
|
349
369
|
function resolveModulePaths(modules, configPath) {
|
|
350
|
-
return modules.map(
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
return normalizePath(path);
|
|
355
|
-
}
|
|
370
|
+
return modules.map(path => resolveModulePath(path, configPath));
|
|
371
|
+
}
|
|
372
|
+
function resolveModulePath(path, configPath) {
|
|
373
|
+
if (path.startsWith(".")) {
|
|
374
|
+
return normalizePath(resolve(configPath, path));
|
|
375
|
+
}
|
|
376
|
+
return normalizePath(path);
|
|
356
377
|
}
|
|
357
378
|
function isTsNumericEnum(map) {
|
|
358
379
|
return Object.values(map).every((key) => map[map[key]] === key);
|
|
@@ -4,7 +4,9 @@ import { i18n } from "#utils";
|
|
|
4
4
|
const ARRAY_OPTION_TYPES = new Set([
|
|
5
5
|
ParameterType.Array,
|
|
6
6
|
ParameterType.PathArray,
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
7
8
|
ParameterType.ModuleArray,
|
|
9
|
+
ParameterType.PluginArray,
|
|
8
10
|
ParameterType.GlobArray,
|
|
9
11
|
]);
|
|
10
12
|
/**
|
|
@@ -740,10 +740,7 @@ export function addTypeDocOptions(options) {
|
|
|
740
740
|
type: ParameterType.Array,
|
|
741
741
|
defaultValue: OptionDefaults.sort,
|
|
742
742
|
validate(value) {
|
|
743
|
-
const invalid =
|
|
744
|
-
for (const v of SORT_STRATEGIES) {
|
|
745
|
-
invalid.delete(v);
|
|
746
|
-
}
|
|
743
|
+
const invalid = setDifference(value, SORT_STRATEGIES);
|
|
747
744
|
if (invalid.size !== 0) {
|
|
748
745
|
throw new Error(i18n.option_0_specified_1_but_only_2_is_valid("sort", Array.from(invalid).join(", "), SORT_STRATEGIES.join(", ")));
|
|
749
746
|
}
|
|
@@ -804,7 +801,7 @@ export function addTypeDocOptions(options) {
|
|
|
804
801
|
options.addDeclaration({
|
|
805
802
|
name: "plugin",
|
|
806
803
|
help: () => i18n.help_plugin(),
|
|
807
|
-
type: ParameterType.
|
|
804
|
+
type: ParameterType.PluginArray,
|
|
808
805
|
});
|
|
809
806
|
options.addDeclaration({
|
|
810
807
|
name: "logLevel",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const tsdocBlockTags: readonly ["@defaultValue", "@deprecated", "@example", "@param", "@privateRemarks", "@remarks", "@returns", "@see", "@throws", "@typeParam"];
|
|
2
|
-
export declare const blockTags: readonly ["@defaultValue", "@deprecated", "@example", "@param", "@privateRemarks", "@remarks", "@returns", "@see", "@throws", "@typeParam", "@author", "@callback", "@category", "@categoryDescription", "@default", "@document", "@extends", "@augments", "@yields", "@group", "@groupDescription", "@import", "@inheritDoc", "@jsx", "@license", "@module", "@mergeModuleWith", "@prop", "@property", "@return", "@satisfies", "@since", "@template", "@type", "@typedef", "@summary", "@preventInline", "@inlineType", "@preventExpand", "@expandType"];
|
|
2
|
+
export declare const blockTags: readonly ["@defaultValue", "@deprecated", "@example", "@param", "@privateRemarks", "@remarks", "@returns", "@see", "@throws", "@typeParam", "@author", "@callback", "@category", "@categoryDescription", "@default", "@document", "@extends", "@augments", "@yields", "@group", "@groupDescription", "@import", "@inheritDoc", "@jsx", "@license", "@module", "@mergeModuleWith", "@prop", "@property", "@return", "@satisfies", "@since", "@sortStrategy", "@template", "@type", "@typedef", "@summary", "@preventInline", "@inlineType", "@preventExpand", "@expandType"];
|
|
3
3
|
export declare const tsdocInlineTags: readonly ["@link", "@inheritDoc", "@label"];
|
|
4
4
|
export declare const inlineTags: readonly ["@link", "@inheritDoc", "@label", "@linkcode", "@linkplain", "@include", "@includeCode"];
|
|
5
5
|
export declare const tsdocModifierTags: readonly ["@alpha", "@beta", "@eventProperty", "@experimental", "@internal", "@override", "@packageDocumentation", "@public", "@readonly", "@sealed", "@virtual"];
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import type { Application } from "../application.js";
|
|
2
|
-
|
|
2
|
+
import { type NormalizedPathOrModuleOrFunction } from "#utils";
|
|
3
|
+
export declare function loadPlugins(app: Application, plugins: readonly NormalizedPathOrModuleOrFunction[]): Promise<void>;
|
|
@@ -6,27 +6,33 @@ export async function loadPlugins(app, plugins) {
|
|
|
6
6
|
for (const plugin of plugins) {
|
|
7
7
|
const pluginDisplay = getPluginDisplayName(plugin);
|
|
8
8
|
try {
|
|
9
|
-
let
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
try {
|
|
13
|
-
// On Windows, we need to ensure this path is a file path.
|
|
14
|
-
// Or we'll get ERR_UNSUPPORTED_ESM_URL_SCHEME
|
|
15
|
-
const esmPath = isAbsolute(plugin)
|
|
16
|
-
? pathToFileURL(plugin).toString()
|
|
17
|
-
: plugin;
|
|
18
|
-
instance = await import(esmPath);
|
|
9
|
+
let initFunction;
|
|
10
|
+
if (typeof plugin === "function") {
|
|
11
|
+
initFunction = plugin;
|
|
19
12
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
else {
|
|
14
|
+
let instance;
|
|
15
|
+
// Try importing first to avoid warnings about requiring ESM being experimental.
|
|
16
|
+
// If that fails due to importing a directory, fall back to require.
|
|
17
|
+
try {
|
|
18
|
+
// On Windows, we need to ensure this path is a file path.
|
|
19
|
+
// Or we'll get ERR_UNSUPPORTED_ESM_URL_SCHEME
|
|
20
|
+
const esmPath = isAbsolute(plugin)
|
|
21
|
+
? pathToFileURL(plugin).toString()
|
|
22
|
+
: plugin;
|
|
23
|
+
instance = await import(esmPath);
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
catch (error) {
|
|
26
|
+
if (error.code === "ERR_UNSUPPORTED_DIR_IMPORT") {
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
28
|
+
instance = require(plugin);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
throw error;
|
|
32
|
+
}
|
|
27
33
|
}
|
|
34
|
+
initFunction = instance.load;
|
|
28
35
|
}
|
|
29
|
-
const initFunction = instance.load;
|
|
30
36
|
if (typeof initFunction === "function") {
|
|
31
37
|
await initFunction(app);
|
|
32
38
|
app.logger.info(i18n.loaded_plugin_0(pluginDisplay));
|
|
@@ -44,6 +50,9 @@ export async function loadPlugins(app, plugins) {
|
|
|
44
50
|
}
|
|
45
51
|
}
|
|
46
52
|
function getPluginDisplayName(plugin) {
|
|
53
|
+
if (typeof plugin === "function") {
|
|
54
|
+
return plugin.name || "function";
|
|
55
|
+
}
|
|
47
56
|
const path = nicePath(plugin);
|
|
48
57
|
if (path.startsWith("./node_modules/")) {
|
|
49
58
|
return path.substring("./node_modules/".length);
|
package/dist/lib/utils/sort.d.ts
CHANGED
|
@@ -7,4 +7,5 @@ import type { Options } from "./options/index.js";
|
|
|
7
7
|
import type { DocumentReflection } from "../models/index.js";
|
|
8
8
|
export declare const SORT_STRATEGIES: readonly ["source-order", "alphabetical", "alphabetical-ignoring-documents", "enum-value-ascending", "enum-value-descending", "enum-member-source-order", "static-first", "instance-first", "visibility", "required-first", "kind", "external-last", "documents-first", "documents-last"];
|
|
9
9
|
export type SortStrategy = (typeof SORT_STRATEGIES)[number];
|
|
10
|
-
export declare function
|
|
10
|
+
export declare function isValidSortStrategy(strategy: string): strategy is SortStrategy;
|
|
11
|
+
export declare function getSortFunction(opts: Options, strategies?: readonly SortStrategy[]): (reflections: (DeclarationReflection | DocumentReflection)[]) => void;
|
package/dist/lib/utils/sort.js
CHANGED
|
@@ -124,7 +124,10 @@ const sorts = {
|
|
|
124
124
|
b.kindOf(ReflectionKind.Document));
|
|
125
125
|
},
|
|
126
126
|
};
|
|
127
|
-
export function
|
|
127
|
+
export function isValidSortStrategy(strategy) {
|
|
128
|
+
return SORT_STRATEGIES.includes(strategy);
|
|
129
|
+
}
|
|
130
|
+
export function getSortFunction(opts, strategies = opts.getValue("sort")) {
|
|
128
131
|
const kindSortOrder = opts
|
|
129
132
|
.getValue("kindSortOrder")
|
|
130
133
|
.map((k) => ReflectionKind[k]);
|
|
@@ -133,7 +136,6 @@ export function getSortFunction(opts) {
|
|
|
133
136
|
kindSortOrder.push(ReflectionKind[kind]);
|
|
134
137
|
}
|
|
135
138
|
}
|
|
136
|
-
const strategies = opts.getValue("sort");
|
|
137
139
|
const data = { kindSortOrder };
|
|
138
140
|
return function sortReflections(reflections) {
|
|
139
141
|
reflections.sort((a, b) => {
|
|
@@ -50,9 +50,8 @@ export declare function zip<T extends Iterable<any>[]>(...args: T): Iterable<{
|
|
|
50
50
|
[K in keyof T]: T[K] extends Iterable<infer U> ? U : T[K];
|
|
51
51
|
}>;
|
|
52
52
|
export declare function filterMap<T, U>(iter: Iterable<T> | undefined, fn: (item: T) => U | undefined): U[];
|
|
53
|
-
export declare function firstDefined<T, U>(array: readonly T[]
|
|
53
|
+
export declare function firstDefined<T, U>(array: readonly T[], callback: (element: T, index: number) => U | undefined): U | undefined;
|
|
54
54
|
export declare function filter<T>(array: readonly T[] | undefined, predicate: (value: T, index: number, array: readonly T[]) => boolean): readonly T[];
|
|
55
55
|
export declare function aggregate<T>(arr: T[], fn: (item: T) => number): number;
|
|
56
|
-
export declare function aggregateWithJoiner<T>(arr: T[], fn: (item: T) => number, joiner: string): number;
|
|
57
56
|
export declare function joinArray<T>(arr: readonly T[] | undefined, joiner: string, mapper: (item: T) => string): string;
|
|
58
57
|
export declare function maxElementByScore<T>(arr: readonly T[], score: (a: T) => number): T | undefined;
|
|
@@ -115,9 +115,6 @@ export function filterMap(iter, fn) {
|
|
|
115
115
|
return result;
|
|
116
116
|
}
|
|
117
117
|
export function firstDefined(array, callback) {
|
|
118
|
-
if (array === undefined) {
|
|
119
|
-
return undefined;
|
|
120
|
-
}
|
|
121
118
|
for (let i = 0; i < array.length; i++) {
|
|
122
119
|
const result = callback(array[i], i);
|
|
123
120
|
if (result !== undefined) {
|
|
@@ -132,10 +129,6 @@ export function filter(array, predicate) {
|
|
|
132
129
|
export function aggregate(arr, fn) {
|
|
133
130
|
return arr.reduce((sum, it) => sum + fn(it), 0);
|
|
134
131
|
}
|
|
135
|
-
export function aggregateWithJoiner(arr, fn, joiner) {
|
|
136
|
-
return (arr.reduce((sum, it) => sum + fn(it), 0) +
|
|
137
|
-
(arr.length - 1) * joiner.length);
|
|
138
|
-
}
|
|
139
132
|
export function joinArray(arr, joiner, mapper) {
|
|
140
133
|
if (arr?.length) {
|
|
141
134
|
return arr.map(mapper).join(joiner);
|
|
@@ -131,7 +131,7 @@ export interface JsxElement {
|
|
|
131
131
|
props: object | null;
|
|
132
132
|
children: JsxChildren[];
|
|
133
133
|
}
|
|
134
|
-
export type JsxChildren = JsxElement | string | number | null | undefined | JsxChildren[];
|
|
134
|
+
export type JsxChildren = JsxElement | string | number | boolean | bigint | null | undefined | JsxChildren[];
|
|
135
135
|
/**
|
|
136
136
|
* The common properties that may appear on any HTML element.
|
|
137
137
|
*
|
|
@@ -71,7 +71,7 @@ export function setRenderSettings(options) {
|
|
|
71
71
|
renderPretty = options.pretty;
|
|
72
72
|
}
|
|
73
73
|
export function renderElement(element) {
|
|
74
|
-
if (!element
|
|
74
|
+
if (!element) {
|
|
75
75
|
return "";
|
|
76
76
|
}
|
|
77
77
|
const { tag, props, children } = element;
|
|
@@ -128,12 +128,12 @@ export function renderElement(element) {
|
|
|
128
128
|
return html;
|
|
129
129
|
function renderChildren(children) {
|
|
130
130
|
for (const child of children) {
|
|
131
|
-
if (
|
|
131
|
+
if (typeof child === "boolean")
|
|
132
132
|
continue;
|
|
133
133
|
if (Array.isArray(child)) {
|
|
134
134
|
renderChildren(child);
|
|
135
135
|
}
|
|
136
|
-
else if (typeof child === "string" || typeof child === "number") {
|
|
136
|
+
else if (typeof child === "string" || typeof child === "number" || typeof child === "bigint") {
|
|
137
137
|
html += escapeHtml(child.toString());
|
|
138
138
|
}
|
|
139
139
|
else {
|
|
@@ -148,7 +148,7 @@ export function renderElement(element) {
|
|
|
148
148
|
* @internal
|
|
149
149
|
*/
|
|
150
150
|
export function renderElementToText(element) {
|
|
151
|
-
if (!element
|
|
151
|
+
if (!element) {
|
|
152
152
|
return "";
|
|
153
153
|
}
|
|
154
154
|
const { tag, props, children } = element;
|
|
@@ -170,12 +170,13 @@ export function renderElementToText(element) {
|
|
|
170
170
|
return html;
|
|
171
171
|
function renderChildren(children) {
|
|
172
172
|
for (const child of children) {
|
|
173
|
-
if (
|
|
173
|
+
if (typeof child === "boolean")
|
|
174
174
|
continue;
|
|
175
175
|
if (Array.isArray(child)) {
|
|
176
176
|
renderChildren(child);
|
|
177
177
|
}
|
|
178
|
-
else if (typeof child === "string" || typeof child === "number") {
|
|
178
|
+
else if (typeof child === "string" || typeof child === "number" || typeof child === "bigint") {
|
|
179
|
+
// Turn non-breaking spaces into regular spaces
|
|
179
180
|
html += child.toString().replaceAll("\u00A0", " ");
|
|
180
181
|
}
|
|
181
182
|
else {
|
|
@@ -15,7 +15,7 @@ export declare class StableKeyMap<K extends {
|
|
|
15
15
|
has(key: K): boolean;
|
|
16
16
|
clear(): void;
|
|
17
17
|
delete(key: K): boolean;
|
|
18
|
-
forEach(callbackfn: (value: V, key: K, map:
|
|
18
|
+
forEach(callbackfn: (value: V, key: K, map: StableKeyMap<K, V>) => void, thisArg?: any): void;
|
|
19
19
|
entries(): IterableIterator<[K, V]>;
|
|
20
20
|
keys(): IterableIterator<K>;
|
|
21
21
|
values(): IterableIterator<V>;
|