typedoc 0.28.6 → 0.28.7
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/lib/converter/comments/discovery.js +7 -1
- package/dist/lib/converter/comments/linkResolver.d.ts +2 -2
- package/dist/lib/converter/comments/linkResolver.js +53 -10
- package/dist/lib/converter/converter.d.ts +3 -1
- package/dist/lib/converter/converter.js +6 -3
- 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/LinkResolverPlugin.d.ts +1 -2
- package/dist/lib/converter/plugins/LinkResolverPlugin.js +1 -55
- package/dist/lib/converter/utils/repository.js +1 -1
- package/dist/lib/internationalization/internationalization.js +1 -1
- package/dist/lib/internationalization/locales/en.cjs +3 -1
- package/dist/lib/internationalization/locales/en.d.cts +3 -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/utils/options/declaration.js +14 -22
- package/dist/lib/utils/options/sources/typedoc.js +1 -4
- 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/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/validation/links.js +0 -3
- package/package.json +12 -12
- package/static/style.css +2 -9
- package/tsdoc.json +4 -0
|
@@ -78,6 +78,7 @@ const wantedKinds = {
|
|
|
78
78
|
[ReflectionKind.Interface]: [
|
|
79
79
|
ts.SyntaxKind.InterfaceDeclaration,
|
|
80
80
|
ts.SyntaxKind.TypeAliasDeclaration,
|
|
81
|
+
ts.SyntaxKind.ClassDeclaration, // type only exports
|
|
81
82
|
],
|
|
82
83
|
[ReflectionKind.Constructor]: [ts.SyntaxKind.Constructor],
|
|
83
84
|
[ReflectionKind.Property]: variablePropertyKinds,
|
|
@@ -102,7 +103,12 @@ const wantedKinds = {
|
|
|
102
103
|
[ReflectionKind.Accessor]: [ts.SyntaxKind.PropertyDeclaration],
|
|
103
104
|
[ReflectionKind.GetSignature]: [ts.SyntaxKind.GetAccessor],
|
|
104
105
|
[ReflectionKind.SetSignature]: [ts.SyntaxKind.SetAccessor],
|
|
105
|
-
[ReflectionKind.TypeAlias]: [
|
|
106
|
+
[ReflectionKind.TypeAlias]: [
|
|
107
|
+
ts.SyntaxKind.TypeAliasDeclaration,
|
|
108
|
+
ts.SyntaxKind.FunctionDeclaration, // type only exports
|
|
109
|
+
// Intentionally not included to avoid comments being copied for variable/alias combos
|
|
110
|
+
// ts.SyntaxKind.VariableDeclaration,
|
|
111
|
+
],
|
|
106
112
|
[ReflectionKind.Reference]: [
|
|
107
113
|
ts.SyntaxKind.NamespaceExport,
|
|
108
114
|
ts.SyntaxKind.ExportSpecifier,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type CommentDisplayPart, Reflection, ReflectionSymbolId } from "../../models/index.js";
|
|
2
2
|
import { type DeclarationReference } from "#utils";
|
|
3
3
|
export type ExternalResolveResult = {
|
|
4
4
|
target: string;
|
|
@@ -16,5 +16,5 @@ export type ExternalSymbolResolver = (ref: DeclarationReference, refl: Reflectio
|
|
|
16
16
|
export type LinkResolverOptions = {
|
|
17
17
|
preserveLinkText: boolean;
|
|
18
18
|
};
|
|
19
|
-
export declare function resolveLinks(
|
|
19
|
+
export declare function resolveLinks(reflection: Reflection, externalResolver: ExternalSymbolResolver, options: LinkResolverOptions): void;
|
|
20
20
|
export declare function resolvePartLinks(reflection: Reflection, parts: readonly CommentDisplayPart[], externalResolver: ExternalSymbolResolver, options: LinkResolverOptions): CommentDisplayPart[];
|
|
@@ -1,19 +1,62 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
|
-
import {
|
|
2
|
+
import { makeRecursiveVisitor, Reflection, ReflectionKind, ReflectionSymbolId, } from "../../models/index.js";
|
|
3
3
|
import { resolveDeclarationReference } from "./declarationReferenceResolver.js";
|
|
4
4
|
import { maxElementByScore, parseDeclarationReference } from "#utils";
|
|
5
5
|
const urlPrefix = /^(http|ftp)s?:\/\//;
|
|
6
|
-
export function resolveLinks(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
export function resolveLinks(reflection, externalResolver, options) {
|
|
7
|
+
if (reflection.comment) {
|
|
8
|
+
reflection.comment.summary = resolvePartLinks(reflection, reflection.comment.summary, externalResolver, options);
|
|
9
|
+
for (const tag of reflection.comment.blockTags) {
|
|
10
|
+
tag.content = resolvePartLinks(reflection, tag.content, externalResolver, options);
|
|
11
|
+
}
|
|
10
12
|
}
|
|
11
|
-
if (reflection
|
|
13
|
+
if ((reflection.isDeclaration() || reflection.isProject()) && reflection.readme) {
|
|
12
14
|
reflection.readme = resolvePartLinks(reflection, reflection.readme, externalResolver, options);
|
|
13
15
|
}
|
|
16
|
+
if (reflection.isDeclaration()) {
|
|
17
|
+
reflection.type?.visit(makeRecursiveVisitor({
|
|
18
|
+
union: (type) => {
|
|
19
|
+
type.elementSummaries = type.elementSummaries?.map((parts) => resolvePartLinks(reflection, parts, externalResolver, options));
|
|
20
|
+
},
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
14
23
|
if (reflection.isDocument()) {
|
|
15
24
|
reflection.content = resolvePartLinks(reflection, reflection.content, externalResolver, options);
|
|
16
25
|
}
|
|
26
|
+
if (reflection.isParameter() &&
|
|
27
|
+
reflection.type?.type === "reference" &&
|
|
28
|
+
reflection.type.highlightedProperties) {
|
|
29
|
+
const resolved = new Map(Array.from(reflection.type.highlightedProperties, ([name, parts]) => {
|
|
30
|
+
return [
|
|
31
|
+
name,
|
|
32
|
+
resolvePartLinks(reflection, parts, externalResolver, options),
|
|
33
|
+
];
|
|
34
|
+
}));
|
|
35
|
+
reflection.type.highlightedProperties = resolved;
|
|
36
|
+
}
|
|
37
|
+
if (reflection.isContainer()) {
|
|
38
|
+
if (reflection.groups) {
|
|
39
|
+
for (const group of reflection.groups) {
|
|
40
|
+
if (group.description) {
|
|
41
|
+
group.description = resolvePartLinks(reflection, group.description, externalResolver, options);
|
|
42
|
+
}
|
|
43
|
+
if (group.categories) {
|
|
44
|
+
for (const cat of group.categories) {
|
|
45
|
+
if (cat.description) {
|
|
46
|
+
cat.description = resolvePartLinks(reflection, cat.description, externalResolver, options);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (reflection.categories) {
|
|
53
|
+
for (const cat of reflection.categories) {
|
|
54
|
+
if (cat.description) {
|
|
55
|
+
cat.description = resolvePartLinks(reflection, cat.description, externalResolver, options);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
17
60
|
}
|
|
18
61
|
export function resolvePartLinks(reflection, parts, externalResolver, options) {
|
|
19
62
|
return parts.flatMap((part) => processPart(reflection, part, externalResolver, options));
|
|
@@ -48,10 +91,10 @@ function resolveLinkTag(reflection, part, externalResolver, options) {
|
|
|
48
91
|
const tsTargets = reflection.project.getReflectionsFromSymbolId(part.target);
|
|
49
92
|
if (tsTargets.length) {
|
|
50
93
|
// Find the target most likely to have a real url in the generated documentation
|
|
51
|
-
//
|
|
52
|
-
//
|
|
53
|
-
//
|
|
54
|
-
//
|
|
94
|
+
// 4. A direct export (class, interface, variable)
|
|
95
|
+
// 3. A property of a direct export (class/interface property)
|
|
96
|
+
// 2. A property of a type of an export (property on type alias)
|
|
97
|
+
// 1. Whatever the first symbol found was
|
|
55
98
|
target = maxElementByScore(tsTargets, (r) => {
|
|
56
99
|
if (r.kindOf(ReflectionKind.SomeExport)) {
|
|
57
100
|
return 4;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
2
|
import type { Application } from "../application.js";
|
|
3
|
-
import { Comment, type CommentDisplayPart, type ContainerReflection, type DeclarationReflection, DocumentReflection, type ParameterReflection, ProjectReflection,
|
|
3
|
+
import { Comment, type CommentDisplayPart, type ContainerReflection, type DeclarationReflection, DocumentReflection, type ParameterReflection, ProjectReflection, Reflection, type ReflectionSymbolId, type SignatureReflection, type SomeType, type TypeParameterReflection } from "../models/index.js";
|
|
4
4
|
import { Context } from "./context.js";
|
|
5
5
|
import { AbstractComponent } from "../utils/component.js";
|
|
6
6
|
import { type GlobString, MinimalSourceFile } from "#utils";
|
|
@@ -187,6 +187,8 @@ export declare class Converter extends AbstractComponent<Application, ConverterE
|
|
|
187
187
|
addUnknownSymbolResolver(resolver: ExternalSymbolResolver): void;
|
|
188
188
|
/** @internal */
|
|
189
189
|
resolveExternalLink(ref: DeclarationReference, refl: Reflection, part: CommentDisplayPart | undefined, symbolId: ReflectionSymbolId | undefined): ExternalResolveResult | string | undefined;
|
|
190
|
+
resolveLinks(reflection: Reflection): void;
|
|
191
|
+
/** @deprecated just pass the reflection */
|
|
190
192
|
resolveLinks(comment: Comment, owner: Reflection): void;
|
|
191
193
|
resolveLinks(parts: readonly CommentDisplayPart[], owner: Reflection): CommentDisplayPart[];
|
|
192
194
|
/**
|
|
@@ -34,7 +34,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
34
34
|
};
|
|
35
35
|
import ts from "typescript";
|
|
36
36
|
import { ok } from "assert";
|
|
37
|
-
import { Comment, DocumentReflection, ProjectReflection, ReflectionKind, } from "../models/index.js";
|
|
37
|
+
import { Comment, DocumentReflection, ProjectReflection, Reflection, ReflectionKind, } from "../models/index.js";
|
|
38
38
|
import { Context } from "./context.js";
|
|
39
39
|
import { AbstractComponent } from "../utils/component.js";
|
|
40
40
|
import { getDocumentEntryPoints, Option, readFile } from "../utils/index.js";
|
|
@@ -374,8 +374,11 @@ let Converter = (() => {
|
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
376
|
resolveLinks(comment, owner) {
|
|
377
|
-
if (comment instanceof
|
|
378
|
-
resolveLinks(comment,
|
|
377
|
+
if (comment instanceof Reflection) {
|
|
378
|
+
resolveLinks(comment, (ref, part, refl, id) => this.resolveExternalLink(ref, part, refl, id), { preserveLinkText: this.preserveLinkText });
|
|
379
|
+
}
|
|
380
|
+
else if (comment instanceof Comment) {
|
|
381
|
+
resolveLinks(owner, (ref, part, refl, id) => this.resolveExternalLink(ref, part, refl, id), { preserveLinkText: this.preserveLinkText });
|
|
379
382
|
}
|
|
380
383
|
else {
|
|
381
384
|
return resolvePartLinks(owner, comment, (ref, part, refl, id) => this.resolveExternalLink(ref, part, refl, id), { preserveLinkText: this.preserveLinkText });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type DeclarationReflection, type DocumentReflection } from "../../models/index.js";
|
|
1
|
+
import { ContainerReflection, type DeclarationReflection, type DocumentReflection } from "../../models/index.js";
|
|
2
2
|
import { ConverterComponent } from "../components.js";
|
|
3
3
|
import type { Converter } from "../converter.js";
|
|
4
4
|
/**
|
|
@@ -7,7 +7,7 @@ import type { Converter } from "../converter.js";
|
|
|
7
7
|
* The handler sets the ´category´ property of all reflections.
|
|
8
8
|
*/
|
|
9
9
|
export declare class CategoryPlugin extends ConverterComponent {
|
|
10
|
-
|
|
10
|
+
defaultSortFunction: (reflections: Array<DeclarationReflection | DocumentReflection>) => void;
|
|
11
11
|
accessor defaultCategory: string;
|
|
12
12
|
accessor categoryOrder: string[];
|
|
13
13
|
accessor categorizeByGroup: boolean;
|
|
@@ -35,6 +35,7 @@ export declare class CategoryPlugin extends ConverterComponent {
|
|
|
35
35
|
* @returns An array containing all children of the given reflection categorized
|
|
36
36
|
*/
|
|
37
37
|
private getReflectionCategories;
|
|
38
|
+
getSortFunction(reflection: ContainerReflection): (reflections: (DeclarationReflection | DocumentReflection)[]) => void;
|
|
38
39
|
/**
|
|
39
40
|
* Callback used to sort categories by name.
|
|
40
41
|
*
|
|
@@ -39,6 +39,7 @@ import { getSortFunction, Option } from "../../utils/index.js";
|
|
|
39
39
|
import { ConverterComponent } from "../components.js";
|
|
40
40
|
import { ConverterEvents } from "../converter-events.js";
|
|
41
41
|
import { i18n } from "#utils";
|
|
42
|
+
import { isValidSortStrategy } from "../../utils/sort.js";
|
|
42
43
|
/**
|
|
43
44
|
* A handler that sorts and categorizes the found reflections in the resolving phase.
|
|
44
45
|
*
|
|
@@ -66,7 +67,7 @@ let CategoryPlugin = (() => {
|
|
|
66
67
|
__esDecorate(this, null, _categorizeByGroup_decorators, { kind: "accessor", name: "categorizeByGroup", static: false, private: false, access: { has: obj => "categorizeByGroup" in obj, get: obj => obj.categorizeByGroup, set: (obj, value) => { obj.categorizeByGroup = value; } }, metadata: _metadata }, _categorizeByGroup_initializers, _categorizeByGroup_extraInitializers);
|
|
67
68
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
68
69
|
}
|
|
69
|
-
|
|
70
|
+
defaultSortFunction;
|
|
70
71
|
#defaultCategory_accessor_storage = __runInitializers(this, _defaultCategory_initializers, void 0);
|
|
71
72
|
get defaultCategory() { return this.#defaultCategory_accessor_storage; }
|
|
72
73
|
set defaultCategory(value) { this.#defaultCategory_accessor_storage = value; }
|
|
@@ -97,7 +98,7 @@ let CategoryPlugin = (() => {
|
|
|
97
98
|
* Triggered when the converter begins converting a project.
|
|
98
99
|
*/
|
|
99
100
|
setup() {
|
|
100
|
-
this.
|
|
101
|
+
this.defaultSortFunction = getSortFunction(this.application.options);
|
|
101
102
|
// Set up static properties
|
|
102
103
|
if (this.defaultCategory) {
|
|
103
104
|
CategoryPlugin.defaultCategory = this.defaultCategory;
|
|
@@ -201,10 +202,21 @@ let CategoryPlugin = (() => {
|
|
|
201
202
|
}
|
|
202
203
|
}
|
|
203
204
|
for (const cat of categories.values()) {
|
|
204
|
-
this.
|
|
205
|
+
this.getSortFunction(parent)(cat.children);
|
|
205
206
|
}
|
|
206
207
|
return Array.from(categories.values());
|
|
207
208
|
}
|
|
209
|
+
getSortFunction(reflection) {
|
|
210
|
+
const tag = reflection.comment?.getTag("@sortStrategy");
|
|
211
|
+
if (tag) {
|
|
212
|
+
const text = Comment.combineDisplayParts(tag.content);
|
|
213
|
+
// We don't need to warn about invalid strategies here because the group plugin
|
|
214
|
+
// runs first and will have already warned.
|
|
215
|
+
const strategies = text.split(/[,\s]+/).filter(isValidSortStrategy);
|
|
216
|
+
return getSortFunction(this.application.options, strategies);
|
|
217
|
+
}
|
|
218
|
+
return this.defaultSortFunction;
|
|
219
|
+
}
|
|
208
220
|
/**
|
|
209
221
|
* Callback used to sort categories by name.
|
|
210
222
|
*
|
|
@@ -8,7 +8,7 @@ import type { Converter } from "../converter.js";
|
|
|
8
8
|
* The handler sets the `groups` property of all container reflections.
|
|
9
9
|
*/
|
|
10
10
|
export declare class GroupPlugin extends ConverterComponent {
|
|
11
|
-
|
|
11
|
+
defaultSortFunction: (reflections: Array<DeclarationReflection | DocumentReflection>) => void;
|
|
12
12
|
accessor groupOrder: string[];
|
|
13
13
|
accessor sortEntryPoints: boolean;
|
|
14
14
|
accessor groupReferencesByType: boolean;
|
|
@@ -40,6 +40,7 @@ export declare class GroupPlugin extends ConverterComponent {
|
|
|
40
40
|
* @returns An array containing all children of the given reflection grouped by their kind.
|
|
41
41
|
*/
|
|
42
42
|
getReflectionGroups(parent: ContainerReflection, reflections: Array<DeclarationReflection | DocumentReflection>): ReflectionGroup[];
|
|
43
|
+
getSortFunction(reflection: ContainerReflection): (reflections: (DeclarationReflection | DocumentReflection)[]) => void;
|
|
43
44
|
/**
|
|
44
45
|
* Callback used to sort groups by name.
|
|
45
46
|
*/
|
|
@@ -35,13 +35,13 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
35
35
|
import { ContainerReflection, ReferenceReflection, ReflectionKind, } from "../../models/index.js";
|
|
36
36
|
import { ReflectionGroup } from "../../models/ReflectionGroup.js";
|
|
37
37
|
import { ConverterComponent } from "../components.js";
|
|
38
|
-
import { getSortFunction } from "../../utils/sort.js";
|
|
38
|
+
import { getSortFunction, isValidSortStrategy, SORT_STRATEGIES } from "../../utils/sort.js";
|
|
39
39
|
import { Option } from "../../utils/index.js";
|
|
40
40
|
import { Comment } from "../../models/index.js";
|
|
41
41
|
import { ConverterEvents } from "../converter-events.js";
|
|
42
42
|
import { ApplicationEvents } from "../../application-events.js";
|
|
43
43
|
import assert from "assert";
|
|
44
|
-
import { i18n } from "#utils";
|
|
44
|
+
import { i18n, partition } from "#utils";
|
|
45
45
|
// Same as the defaultKindSortOrder in sort.ts
|
|
46
46
|
const defaultGroupOrder = [
|
|
47
47
|
ReflectionKind.Document,
|
|
@@ -89,7 +89,7 @@ let GroupPlugin = (() => {
|
|
|
89
89
|
__esDecorate(this, null, _groupReferencesByType_decorators, { kind: "accessor", name: "groupReferencesByType", static: false, private: false, access: { has: obj => "groupReferencesByType" in obj, get: obj => obj.groupReferencesByType, set: (obj, value) => { obj.groupReferencesByType = value; } }, metadata: _metadata }, _groupReferencesByType_initializers, _groupReferencesByType_extraInitializers);
|
|
90
90
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
91
91
|
}
|
|
92
|
-
|
|
92
|
+
defaultSortFunction;
|
|
93
93
|
#groupOrder_accessor_storage = __runInitializers(this, _groupOrder_initializers, void 0);
|
|
94
94
|
get groupOrder() { return this.#groupOrder_accessor_storage; }
|
|
95
95
|
set groupOrder(value) { this.#groupOrder_accessor_storage = value; }
|
|
@@ -130,25 +130,26 @@ let GroupPlugin = (() => {
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
setup() {
|
|
133
|
-
this.
|
|
133
|
+
this.defaultSortFunction = getSortFunction(this.application.options);
|
|
134
134
|
GroupPlugin.WEIGHTS = this.groupOrder;
|
|
135
135
|
if (GroupPlugin.WEIGHTS.length === 0) {
|
|
136
136
|
GroupPlugin.WEIGHTS = defaultGroupOrder.map((kind) => ReflectionKind.pluralString(kind));
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
group(reflection) {
|
|
140
|
+
const sortFunction = this.getSortFunction(reflection);
|
|
140
141
|
if (reflection.childrenIncludingDocuments && !reflection.groups) {
|
|
141
142
|
if (reflection.children) {
|
|
142
143
|
if (this.sortEntryPoints ||
|
|
143
144
|
!reflection.children.some((c) => c.kindOf(ReflectionKind.Module))) {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
145
|
+
sortFunction(reflection.children);
|
|
146
|
+
sortFunction(reflection.documents || []);
|
|
147
|
+
sortFunction(reflection.childrenIncludingDocuments);
|
|
147
148
|
}
|
|
148
149
|
}
|
|
149
150
|
else if (reflection.documents) {
|
|
150
|
-
|
|
151
|
-
|
|
151
|
+
sortFunction(reflection.documents);
|
|
152
|
+
sortFunction(reflection.childrenIncludingDocuments);
|
|
152
153
|
}
|
|
153
154
|
if (reflection.comment?.hasModifier("@disableGroups")) {
|
|
154
155
|
return;
|
|
@@ -239,6 +240,19 @@ let GroupPlugin = (() => {
|
|
|
239
240
|
}
|
|
240
241
|
return Array.from(groups.values()).sort(GroupPlugin.sortGroupCallback);
|
|
241
242
|
}
|
|
243
|
+
getSortFunction(reflection) {
|
|
244
|
+
const tag = reflection.comment?.getTag("@sortStrategy");
|
|
245
|
+
if (tag) {
|
|
246
|
+
const text = Comment.combineDisplayParts(tag.content);
|
|
247
|
+
const strategies = text.split(/[,\s]+/);
|
|
248
|
+
const [valid, invalid] = partition(strategies, isValidSortStrategy);
|
|
249
|
+
for (const inv of invalid) {
|
|
250
|
+
this.application.logger.warn(i18n.comment_for_0_specifies_1_as_sort_strategy_but_only_2_is_valid(reflection.getFriendlyFullName(), inv, SORT_STRATEGIES.join("\n\t")));
|
|
251
|
+
}
|
|
252
|
+
return getSortFunction(this.application.options, valid);
|
|
253
|
+
}
|
|
254
|
+
return this.defaultSortFunction;
|
|
255
|
+
}
|
|
242
256
|
/**
|
|
243
257
|
* Callback used to sort groups by name.
|
|
244
258
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ConverterComponent } from "../components.js";
|
|
2
2
|
import type { Context, Converter } from "../../converter/index.js";
|
|
3
3
|
import { type ValidationOptions } from "../../utils/index.js";
|
|
4
|
-
import {
|
|
4
|
+
import type { ProjectReflection } from "../../models/index.js";
|
|
5
5
|
/**
|
|
6
6
|
* A plugin that resolves `{@link Foo}` tags.
|
|
7
7
|
*/
|
|
@@ -10,5 +10,4 @@ export declare class LinkResolverPlugin extends ConverterComponent {
|
|
|
10
10
|
constructor(owner: Converter);
|
|
11
11
|
onResolve(context: Context): void;
|
|
12
12
|
resolveLinks(project: ProjectReflection): void;
|
|
13
|
-
private resolveCategoryLinks;
|
|
14
13
|
}
|
|
@@ -35,7 +35,6 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
35
35
|
import { ConverterComponent } from "../components.js";
|
|
36
36
|
import { ConverterEvents } from "../converter-events.js";
|
|
37
37
|
import { Option } from "../../utils/index.js";
|
|
38
|
-
import { ContainerReflection, makeRecursiveVisitor, } from "../../models/index.js";
|
|
39
38
|
import { discoverAllReferenceTypes } from "../../utils/reflections.js";
|
|
40
39
|
import { ApplicationEvents } from "../../application-events.js";
|
|
41
40
|
/**
|
|
@@ -68,55 +67,7 @@ let LinkResolverPlugin = (() => {
|
|
|
68
67
|
resolveLinks(project) {
|
|
69
68
|
for (const id in project.reflections) {
|
|
70
69
|
const reflection = project.reflections[id];
|
|
71
|
-
|
|
72
|
-
this.owner.resolveLinks(reflection.comment, reflection);
|
|
73
|
-
}
|
|
74
|
-
if (reflection.isDeclaration()) {
|
|
75
|
-
reflection.type?.visit(makeRecursiveVisitor({
|
|
76
|
-
union: (type) => {
|
|
77
|
-
type.elementSummaries = type.elementSummaries?.map((parts) => this.owner.resolveLinks(parts, reflection));
|
|
78
|
-
},
|
|
79
|
-
}));
|
|
80
|
-
if (reflection.readme) {
|
|
81
|
-
reflection.readme = this.owner.resolveLinks(reflection.readme, reflection);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
if (reflection.isDocument()) {
|
|
85
|
-
reflection.content = this.owner.resolveLinks(reflection.content, reflection);
|
|
86
|
-
}
|
|
87
|
-
if (reflection.isParameter() &&
|
|
88
|
-
reflection.type?.type === "reference" &&
|
|
89
|
-
reflection.type.highlightedProperties) {
|
|
90
|
-
const resolved = new Map(Array.from(reflection.type.highlightedProperties, ([name, parts]) => {
|
|
91
|
-
return [
|
|
92
|
-
name,
|
|
93
|
-
this.owner.resolveLinks(parts, reflection),
|
|
94
|
-
];
|
|
95
|
-
}));
|
|
96
|
-
reflection.type.highlightedProperties = resolved;
|
|
97
|
-
}
|
|
98
|
-
if (reflection instanceof ContainerReflection) {
|
|
99
|
-
if (reflection.groups) {
|
|
100
|
-
for (const group of reflection.groups) {
|
|
101
|
-
if (group.description) {
|
|
102
|
-
group.description = this.owner.resolveLinks(group.description, reflection);
|
|
103
|
-
}
|
|
104
|
-
if (group.categories) {
|
|
105
|
-
for (const cat of group.categories) {
|
|
106
|
-
this.resolveCategoryLinks(cat, reflection);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
if (reflection.categories) {
|
|
112
|
-
for (const cat of reflection.categories) {
|
|
113
|
-
this.resolveCategoryLinks(cat, reflection);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
if (project.readme) {
|
|
119
|
-
project.readme = this.owner.resolveLinks(project.readme, project);
|
|
70
|
+
this.owner.resolveLinks(reflection);
|
|
120
71
|
}
|
|
121
72
|
for (const { type, owner } of discoverAllReferenceTypes(project, false)) {
|
|
122
73
|
if (!type.reflection) {
|
|
@@ -132,11 +83,6 @@ let LinkResolverPlugin = (() => {
|
|
|
132
83
|
}
|
|
133
84
|
}
|
|
134
85
|
}
|
|
135
|
-
resolveCategoryLinks(category, owner) {
|
|
136
|
-
if (category.description) {
|
|
137
|
-
category.description = this.owner.resolveLinks(category.description, owner);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
86
|
};
|
|
141
87
|
})();
|
|
142
88
|
export { LinkResolverPlugin };
|
|
@@ -140,7 +140,7 @@ let GitRepository = (() => {
|
|
|
140
140
|
*/
|
|
141
141
|
static tryCreateRepository(path, sourceLinkTemplate, gitRevision, gitRemote, logger) {
|
|
142
142
|
gitRevision ||= git("-C", path, "rev-parse", "HEAD").stdout.trim();
|
|
143
|
-
if (
|
|
143
|
+
if (gitRevision == "HEAD")
|
|
144
144
|
return; // Will only happen in a repo with no commits.
|
|
145
145
|
let urlTemplate;
|
|
146
146
|
if (sourceLinkTemplate) {
|
|
@@ -72,6 +72,7 @@ module.exports = {
|
|
|
72
72
|
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}`,
|
|
73
73
|
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`,
|
|
74
74
|
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`,
|
|
75
|
+
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}`,
|
|
75
76
|
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`,
|
|
76
77
|
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}`,
|
|
77
78
|
signature_0_has_unused_param_with_name_1: `The signature {0} has an @param with name "{1}", which was not used`,
|
|
@@ -274,13 +275,14 @@ module.exports = {
|
|
|
274
275
|
useHostedBaseUrlForAbsoluteLinks_requires_hostedBaseUrl: "The useHostedBaseUrlForAbsoluteLinks option requires that hostedBaseUrl be set",
|
|
275
276
|
favicon_must_have_one_of_the_following_extensions_0: "Favicon must have one of the following extensions: {0}",
|
|
276
277
|
option_0_must_be_an_object: "The '{0}' option must be a non-array object",
|
|
278
|
+
option_0_must_be_an_array_of_string: "The '{0}' option must be set to an array of strings",
|
|
277
279
|
option_0_must_be_a_function: "The '{0}' option must be a function",
|
|
278
280
|
option_0_must_be_object_with_urls: `{0} must be an object with string labels as keys and URL values`,
|
|
279
281
|
visibility_filters_only_include_0: `visibilityFilters can only include the following non-@ keys: {0}`,
|
|
280
282
|
visibility_filters_must_be_booleans: `All values of visibilityFilters must be booleans`,
|
|
281
283
|
option_0_values_must_be_numbers: "All values of {0} must be numbers",
|
|
282
284
|
option_0_values_must_be_array_of_tags: "{0} must be an array of valid tag names",
|
|
283
|
-
option_0_specified_1_but_only_2_is_valid: `{0} may only specify known values, and invalid values were provided ({1}). The valid
|
|
285
|
+
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}`,
|
|
284
286
|
option_outputs_must_be_array: `"outputs" option must be an array of { name: string, path: string, options?: TypeDocOptions } values.`,
|
|
285
287
|
specified_output_0_has_not_been_defined: `Specified output "{0}" has not been defined.`,
|
|
286
288
|
// https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts
|
|
@@ -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,14 @@ 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";
|
|
261
263
|
readonly option_0_must_be_a_function: "The '{0}' option must be a function";
|
|
262
264
|
readonly option_0_must_be_object_with_urls: "{0} must be an object with string labels as keys and URL values";
|
|
263
265
|
readonly visibility_filters_only_include_0: "visibilityFilters can only include the following non-@ keys: {0}";
|
|
264
266
|
readonly visibility_filters_must_be_booleans: "All values of visibilityFilters must be booleans";
|
|
265
267
|
readonly option_0_values_must_be_numbers: "All values of {0} must be numbers";
|
|
266
268
|
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
|
|
269
|
+
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
270
|
readonly option_outputs_must_be_array: "\"outputs\" option must be an array of { name: string, path: string, options?: TypeDocOptions } values.";
|
|
269
271
|
readonly specified_output_0_has_not_been_defined: "Specified output \"{0}\" has not been defined.";
|
|
270
272
|
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();
|
|
@@ -127,6 +127,15 @@ export var ParameterType;
|
|
|
127
127
|
*/
|
|
128
128
|
ParameterType[ParameterType["Flags"] = 12] = "Flags";
|
|
129
129
|
})(ParameterType || (ParameterType = {}));
|
|
130
|
+
function toStringArray(value, option) {
|
|
131
|
+
if (Array.isArray(value) && value.every(v => typeof v === "string")) {
|
|
132
|
+
return value;
|
|
133
|
+
}
|
|
134
|
+
else if (typeof value === "string") {
|
|
135
|
+
return [value];
|
|
136
|
+
}
|
|
137
|
+
throw new Error(i18n.option_0_must_be_an_array_of_string(option.name));
|
|
138
|
+
}
|
|
130
139
|
const converters = {
|
|
131
140
|
[ParameterType.String](value, option) {
|
|
132
141
|
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
@@ -164,36 +173,18 @@ const converters = {
|
|
|
164
173
|
return !!value;
|
|
165
174
|
},
|
|
166
175
|
[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
|
-
}
|
|
176
|
+
const strArrValue = toStringArray(value, option);
|
|
174
177
|
option.validate?.(strArrValue);
|
|
175
178
|
return strArrValue;
|
|
176
179
|
},
|
|
177
180
|
[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
|
-
}
|
|
181
|
+
const strArrValue = toStringArray(value, option);
|
|
185
182
|
const normalized = strArrValue.map((path) => normalizePath(resolve(configPath, path)));
|
|
186
183
|
option.validate?.(normalized);
|
|
187
184
|
return normalized;
|
|
188
185
|
},
|
|
189
186
|
[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
|
-
}
|
|
187
|
+
const strArrValue = toStringArray(value, option);
|
|
197
188
|
const resolved = resolveModulePaths(strArrValue, configPath);
|
|
198
189
|
option.validate?.(resolved);
|
|
199
190
|
return resolved;
|
|
@@ -210,7 +201,8 @@ const converters = {
|
|
|
210
201
|
}
|
|
211
202
|
return createGlobString(configPath, s);
|
|
212
203
|
};
|
|
213
|
-
const
|
|
204
|
+
const strArrValue = toStringArray(value, option);
|
|
205
|
+
const globs = strArrValue.map(toGlobString);
|
|
214
206
|
option.validate?.(globs);
|
|
215
207
|
return globs;
|
|
216
208
|
},
|
|
@@ -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
|
}
|
|
@@ -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"];
|
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>;
|
|
@@ -25,9 +25,6 @@ export function validateLinks(project, logger) {
|
|
|
25
25
|
for (const id in project.reflections) {
|
|
26
26
|
checkReflection(project.reflections[id], logger);
|
|
27
27
|
}
|
|
28
|
-
if (!(project.id in project.reflections)) {
|
|
29
|
-
checkReflection(project, logger);
|
|
30
|
-
}
|
|
31
28
|
}
|
|
32
29
|
function checkReflection(reflection, logger) {
|
|
33
30
|
if (reflection.isProject() || reflection.isDeclaration()) {
|
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.28.
|
|
4
|
+
"version": "0.28.7",
|
|
5
5
|
"homepage": "https://typedoc.org",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
@@ -31,32 +31,32 @@
|
|
|
31
31
|
"pnpm": ">= 10"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@gerrit0/mini-shiki": "^3.
|
|
34
|
+
"@gerrit0/mini-shiki": "^3.7.0",
|
|
35
35
|
"lunr": "^2.3.9",
|
|
36
36
|
"markdown-it": "^14.1.0",
|
|
37
37
|
"minimatch": "^9.0.5",
|
|
38
|
-
"yaml": "^2.
|
|
38
|
+
"yaml": "^2.8.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"typescript": "5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x || 5.6.x || 5.7.x || 5.8.x"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@eslint/js": "^9.
|
|
44
|
+
"@eslint/js": "^9.30.0",
|
|
45
45
|
"@types/lunr": "^2.3.7",
|
|
46
46
|
"@types/markdown-it": "^14.1.2",
|
|
47
47
|
"@types/mocha": "^10.0.10",
|
|
48
48
|
"@types/node": "18",
|
|
49
49
|
"@typestrong/fs-fixture-builder": "github:TypeStrong/fs-fixture-builder#34113409e3a171e68ce5e2b55461ef5c35591cfe",
|
|
50
50
|
"c8": "^10.1.3",
|
|
51
|
-
"dprint": "^0.
|
|
52
|
-
"esbuild": "^0.25.
|
|
53
|
-
"eslint": "^9.
|
|
54
|
-
"mocha": "^11.1
|
|
55
|
-
"puppeteer": "^24.
|
|
56
|
-
"semver": "^7.7.
|
|
57
|
-
"tsx": "^4.
|
|
51
|
+
"dprint": "^0.50.0",
|
|
52
|
+
"esbuild": "^0.25.5",
|
|
53
|
+
"eslint": "^9.30.0",
|
|
54
|
+
"mocha": "^11.7.1",
|
|
55
|
+
"puppeteer": "^24.11.1",
|
|
56
|
+
"semver": "^7.7.2",
|
|
57
|
+
"tsx": "^4.20.3",
|
|
58
58
|
"typescript": "5.8.3",
|
|
59
|
-
"typescript-eslint": "^8.
|
|
59
|
+
"typescript-eslint": "^8.35.0"
|
|
60
60
|
},
|
|
61
61
|
"files": [
|
|
62
62
|
"/bin",
|
package/static/style.css
CHANGED
|
@@ -504,15 +504,8 @@
|
|
|
504
504
|
body {
|
|
505
505
|
background: var(--color-background);
|
|
506
506
|
font-family:
|
|
507
|
-
-apple-system,
|
|
508
|
-
|
|
509
|
-
"Segoe UI",
|
|
510
|
-
"Noto Sans",
|
|
511
|
-
Helvetica,
|
|
512
|
-
Arial,
|
|
513
|
-
sans-serif,
|
|
514
|
-
"Apple Color Emoji",
|
|
515
|
-
"Segoe UI Emoji";
|
|
507
|
+
-apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans",
|
|
508
|
+
Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
|
|
516
509
|
font-size: 16px;
|
|
517
510
|
color: var(--color-text);
|
|
518
511
|
margin: 0;
|