typedoc 0.23.20 → 0.23.22
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/declarationReference.d.ts +1 -1
- package/dist/lib/converter/comments/discovery.js +2 -2
- package/dist/lib/converter/context.js +15 -15
- package/dist/lib/converter/converter.js +6 -3
- package/dist/lib/converter/plugins/CommentPlugin.d.ts +34 -2
- package/dist/lib/converter/plugins/CommentPlugin.js +34 -2
- package/dist/lib/converter/plugins/GroupPlugin.d.ts +1 -3
- package/dist/lib/converter/plugins/GroupPlugin.js +4 -4
- package/dist/lib/converter/plugins/SourcePlugin.js +3 -2
- package/dist/lib/converter/utils/base-path.js +1 -1
- package/dist/lib/models/comments/comment.d.ts +1 -1
- package/dist/lib/models/comments/comment.js +16 -16
- package/dist/lib/models/reflections/abstract.js +6 -6
- package/dist/lib/models/reflections/type-parameter.d.ts +1 -1
- package/dist/lib/models/types.d.ts +5 -5
- package/dist/lib/models/types.js +9 -9
- package/dist/lib/output/events.js +7 -7
- package/dist/lib/output/models/UrlMapping.d.ts +1 -1
- package/dist/lib/output/themes/default/DefaultTheme.js +6 -6
- package/dist/lib/output/themes/lib.js +2 -2
- package/dist/lib/serialization/schema.d.ts +9 -9
- package/dist/lib/utils/entry-point.d.ts +1 -1
- package/dist/lib/utils/enum.d.ts +1 -0
- package/dist/lib/utils/enum.js +8 -1
- package/dist/lib/utils/general.d.ts +4 -4
- package/dist/lib/utils/hooks.d.ts +1 -1
- package/dist/lib/utils/index.d.ts +1 -1
- package/dist/lib/utils/index.js +2 -2
- package/dist/lib/utils/jsx.elements.d.ts +2 -2
- package/dist/lib/utils/options/declaration.d.ts +10 -9
- package/dist/lib/utils/options/sources/typedoc.js +18 -1
- package/dist/lib/utils/package-manifest.d.ts +1 -1
- package/dist/lib/utils/plugins.js +3 -7
- package/dist/lib/utils/sort.d.ts +3 -2
- package/dist/lib/utils/sort.js +53 -41
- package/dist/lib/utils/validation.d.ts +5 -5
- package/package.json +9 -8
- package/static/main.js +1 -1
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @module
|
|
7
7
|
*/
|
|
8
8
|
export declare const MeaningKeywords: readonly ["class", "interface", "type", "enum", "namespace", "function", "var", "constructor", "member", "event", "call", "new", "index", "complex", "getter", "setter"];
|
|
9
|
-
export
|
|
9
|
+
export type MeaningKeyword = typeof MeaningKeywords[number];
|
|
10
10
|
export interface DeclarationReference {
|
|
11
11
|
resolutionStart: "global" | "local";
|
|
12
12
|
moduleSource?: string;
|
|
@@ -54,7 +54,7 @@ const wantedKinds = {
|
|
|
54
54
|
ts.SyntaxKind.PropertySignature,
|
|
55
55
|
ts.SyntaxKind.BinaryExpression,
|
|
56
56
|
ts.SyntaxKind.PropertyAssignment,
|
|
57
|
-
// class X { constructor(/** Comment */ readonly z:
|
|
57
|
+
// class X { constructor(/** Comment */ readonly z: string) }
|
|
58
58
|
ts.SyntaxKind.Parameter,
|
|
59
59
|
],
|
|
60
60
|
[models_1.ReflectionKind.Method]: [
|
|
@@ -75,7 +75,7 @@ const wantedKinds = {
|
|
|
75
75
|
[models_1.ReflectionKind.Parameter]: [ts.SyntaxKind.Parameter],
|
|
76
76
|
[models_1.ReflectionKind.TypeLiteral]: [ts.SyntaxKind.TypeLiteral],
|
|
77
77
|
[models_1.ReflectionKind.TypeParameter]: [ts.SyntaxKind.TypeParameter],
|
|
78
|
-
[models_1.ReflectionKind.Accessor]: [],
|
|
78
|
+
[models_1.ReflectionKind.Accessor]: [ts.SyntaxKind.PropertyDeclaration],
|
|
79
79
|
[models_1.ReflectionKind.GetSignature]: [ts.SyntaxKind.GetAccessor],
|
|
80
80
|
[models_1.ReflectionKind.SetSignature]: [ts.SyntaxKind.SetAccessor],
|
|
81
81
|
[models_1.ReflectionKind.ObjectLiteral]: [ts.SyntaxKind.ObjectLiteralExpression],
|
|
@@ -12,21 +12,6 @@ const comments_1 = require("./comments");
|
|
|
12
12
|
* The context describes the current state the converter is in.
|
|
13
13
|
*/
|
|
14
14
|
class Context {
|
|
15
|
-
/**
|
|
16
|
-
* Create a new Context instance.
|
|
17
|
-
*
|
|
18
|
-
* @param converter The converter instance that has created the context.
|
|
19
|
-
* @internal
|
|
20
|
-
*/
|
|
21
|
-
constructor(converter, programs, project, scope = project) {
|
|
22
|
-
/** @internal */
|
|
23
|
-
this.shouldBeStatic = false;
|
|
24
|
-
this.convertingTypeNode = false;
|
|
25
|
-
this.converter = converter;
|
|
26
|
-
this.programs = programs;
|
|
27
|
-
this.project = project;
|
|
28
|
-
this.scope = scope;
|
|
29
|
-
}
|
|
30
15
|
/**
|
|
31
16
|
* The TypeChecker instance returned by the TypeScript compiler.
|
|
32
17
|
*/
|
|
@@ -49,6 +34,21 @@ class Context {
|
|
|
49
34
|
setConvertingTypeNode() {
|
|
50
35
|
this.convertingTypeNode = true;
|
|
51
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Create a new Context instance.
|
|
39
|
+
*
|
|
40
|
+
* @param converter The converter instance that has created the context.
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
constructor(converter, programs, project, scope = project) {
|
|
44
|
+
/** @internal */
|
|
45
|
+
this.shouldBeStatic = false;
|
|
46
|
+
this.convertingTypeNode = false;
|
|
47
|
+
this.converter = converter;
|
|
48
|
+
this.programs = programs;
|
|
49
|
+
this.project = project;
|
|
50
|
+
this.scope = scope;
|
|
51
|
+
}
|
|
52
52
|
/** @internal */
|
|
53
53
|
get logger() {
|
|
54
54
|
return this.converter.application.logger;
|
|
@@ -27,6 +27,9 @@ const linkResolver_1 = require("./comments/linkResolver");
|
|
|
27
27
|
* Compiles source files using TypeScript and converts compiler symbols to reflections.
|
|
28
28
|
*/
|
|
29
29
|
let Converter = Converter_1 = class Converter extends component_1.ChildableComponent {
|
|
30
|
+
get config() {
|
|
31
|
+
return this._config || this._buildCommentParserConfig();
|
|
32
|
+
}
|
|
30
33
|
constructor(owner) {
|
|
31
34
|
super(owner);
|
|
32
35
|
this._externalSymbolResolvers = [];
|
|
@@ -50,11 +53,11 @@ let Converter = Converter_1 = class Converter extends component_1.ChildableCompo
|
|
|
50
53
|
if (typeof modLinks[name] === "string") {
|
|
51
54
|
return modLinks[name];
|
|
52
55
|
}
|
|
56
|
+
if (typeof modLinks["*"] === "string") {
|
|
57
|
+
return modLinks["*"];
|
|
58
|
+
}
|
|
53
59
|
});
|
|
54
60
|
}
|
|
55
|
-
get config() {
|
|
56
|
-
return this._config || this._buildCommentParserConfig();
|
|
57
|
-
}
|
|
58
61
|
/**
|
|
59
62
|
* Compile the given source files and create a project reflection for them.
|
|
60
63
|
*/
|
|
@@ -2,11 +2,13 @@ import { ConverterComponent } from "../components";
|
|
|
2
2
|
/**
|
|
3
3
|
* Handles most behavior triggered by comments. `@group` and `@category` are handled by their respective plugins, but everything else is here.
|
|
4
4
|
*
|
|
5
|
+
* How it works today
|
|
6
|
+
* ==================
|
|
5
7
|
* During conversion:
|
|
6
8
|
* - Handle visibility flags (`@private`, `@protected`. `@public`)
|
|
7
9
|
* - Handle module renames (`@module`)
|
|
8
10
|
* - Remove excluded tags & comment discovery tags (`@module`, `@packageDocumentation`)
|
|
9
|
-
* - Copy comments for type parameters from the parent container
|
|
11
|
+
* - Copy comments for type parameters from the parent container (for classes/interfaces)
|
|
10
12
|
*
|
|
11
13
|
* Resolve begin:
|
|
12
14
|
* - Remove hidden reflections
|
|
@@ -15,13 +17,43 @@ import { ConverterComponent } from "../components";
|
|
|
15
17
|
* - Apply `@label` tag
|
|
16
18
|
* - Copy comments on signature containers to the signature if signatures don't already have a comment
|
|
17
19
|
* and then remove the comment on the container.
|
|
18
|
-
* - Copy comments
|
|
20
|
+
* - Copy comments to parameters and type parameters (for signatures)
|
|
19
21
|
* - Apply `@group` and `@category` tags
|
|
20
22
|
*
|
|
21
23
|
* Resolve end:
|
|
22
24
|
* - Copy auto inherited comments from heritage clauses
|
|
23
25
|
* - Handle `@inheritDoc`
|
|
24
26
|
* - Resolve `@link` tags to point to target reflections
|
|
27
|
+
*
|
|
28
|
+
* How it should work
|
|
29
|
+
* ==================
|
|
30
|
+
* During conversion:
|
|
31
|
+
* - Handle visibility flags (`@private`, `@protected`. `@public`)
|
|
32
|
+
* - Handle module renames (`@module`)
|
|
33
|
+
* - Remove excluded tags & comment discovery tags (`@module`, `@packageDocumentation`)
|
|
34
|
+
*
|
|
35
|
+
* Resolve begin (100):
|
|
36
|
+
* - Copy auto inherited comments from heritage clauses
|
|
37
|
+
* - Apply `@label` tag
|
|
38
|
+
*
|
|
39
|
+
* Resolve begin (75)
|
|
40
|
+
* - Handle `@inheritDoc`
|
|
41
|
+
*
|
|
42
|
+
* Resolve begin (50)
|
|
43
|
+
* - Copy comments on signature containers to the signature if signatures don't already have a comment
|
|
44
|
+
* and then remove the comment on the container.
|
|
45
|
+
* - Copy comments for type parameters from the parent container (for classes/interfaces)
|
|
46
|
+
*
|
|
47
|
+
* Resolve begin (25)
|
|
48
|
+
* - Remove hidden reflections
|
|
49
|
+
*
|
|
50
|
+
* Resolve:
|
|
51
|
+
* - Copy comments to parameters and type parameters (for signatures)
|
|
52
|
+
* - Apply `@group` and `@category` tags
|
|
53
|
+
*
|
|
54
|
+
* Resolve end:
|
|
55
|
+
* - Resolve `@link` tags to point to target reflections
|
|
56
|
+
*
|
|
25
57
|
*/
|
|
26
58
|
export declare class CommentPlugin extends ConverterComponent {
|
|
27
59
|
excludeTags: `@${string}`[];
|
|
@@ -35,11 +35,13 @@ const NEVER_RENDERED = [
|
|
|
35
35
|
/**
|
|
36
36
|
* Handles most behavior triggered by comments. `@group` and `@category` are handled by their respective plugins, but everything else is here.
|
|
37
37
|
*
|
|
38
|
+
* How it works today
|
|
39
|
+
* ==================
|
|
38
40
|
* During conversion:
|
|
39
41
|
* - Handle visibility flags (`@private`, `@protected`. `@public`)
|
|
40
42
|
* - Handle module renames (`@module`)
|
|
41
43
|
* - Remove excluded tags & comment discovery tags (`@module`, `@packageDocumentation`)
|
|
42
|
-
* - Copy comments for type parameters from the parent container
|
|
44
|
+
* - Copy comments for type parameters from the parent container (for classes/interfaces)
|
|
43
45
|
*
|
|
44
46
|
* Resolve begin:
|
|
45
47
|
* - Remove hidden reflections
|
|
@@ -48,13 +50,43 @@ const NEVER_RENDERED = [
|
|
|
48
50
|
* - Apply `@label` tag
|
|
49
51
|
* - Copy comments on signature containers to the signature if signatures don't already have a comment
|
|
50
52
|
* and then remove the comment on the container.
|
|
51
|
-
* - Copy comments
|
|
53
|
+
* - Copy comments to parameters and type parameters (for signatures)
|
|
52
54
|
* - Apply `@group` and `@category` tags
|
|
53
55
|
*
|
|
54
56
|
* Resolve end:
|
|
55
57
|
* - Copy auto inherited comments from heritage clauses
|
|
56
58
|
* - Handle `@inheritDoc`
|
|
57
59
|
* - Resolve `@link` tags to point to target reflections
|
|
60
|
+
*
|
|
61
|
+
* How it should work
|
|
62
|
+
* ==================
|
|
63
|
+
* During conversion:
|
|
64
|
+
* - Handle visibility flags (`@private`, `@protected`. `@public`)
|
|
65
|
+
* - Handle module renames (`@module`)
|
|
66
|
+
* - Remove excluded tags & comment discovery tags (`@module`, `@packageDocumentation`)
|
|
67
|
+
*
|
|
68
|
+
* Resolve begin (100):
|
|
69
|
+
* - Copy auto inherited comments from heritage clauses
|
|
70
|
+
* - Apply `@label` tag
|
|
71
|
+
*
|
|
72
|
+
* Resolve begin (75)
|
|
73
|
+
* - Handle `@inheritDoc`
|
|
74
|
+
*
|
|
75
|
+
* Resolve begin (50)
|
|
76
|
+
* - Copy comments on signature containers to the signature if signatures don't already have a comment
|
|
77
|
+
* and then remove the comment on the container.
|
|
78
|
+
* - Copy comments for type parameters from the parent container (for classes/interfaces)
|
|
79
|
+
*
|
|
80
|
+
* Resolve begin (25)
|
|
81
|
+
* - Remove hidden reflections
|
|
82
|
+
*
|
|
83
|
+
* Resolve:
|
|
84
|
+
* - Copy comments to parameters and type parameters (for signatures)
|
|
85
|
+
* - Apply `@group` and `@category` tags
|
|
86
|
+
*
|
|
87
|
+
* Resolve end:
|
|
88
|
+
* - Resolve `@link` tags to point to target reflections
|
|
89
|
+
*
|
|
58
90
|
*/
|
|
59
91
|
let CommentPlugin = class CommentPlugin extends components_1.ConverterComponent {
|
|
60
92
|
/**
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ReflectionKind, DeclarationReflection } from "../../models/reflections/index";
|
|
2
2
|
import { ReflectionGroup } from "../../models/ReflectionGroup";
|
|
3
3
|
import { ConverterComponent } from "../components";
|
|
4
|
-
import { SortStrategy } from "../../utils/sort";
|
|
5
4
|
/**
|
|
6
5
|
* A handler that sorts and groups the found reflections in the resolving phase.
|
|
7
6
|
*
|
|
@@ -25,8 +24,7 @@ export declare class GroupPlugin extends ConverterComponent {
|
|
|
25
24
|
16: string;
|
|
26
25
|
4194304: string;
|
|
27
26
|
};
|
|
28
|
-
|
|
29
|
-
sortStrategies: SortStrategy[];
|
|
27
|
+
sortFunction: (reflections: DeclarationReflection[]) => void;
|
|
30
28
|
boosts: Record<string, number>;
|
|
31
29
|
usedBoosts: Set<string>;
|
|
32
30
|
/**
|
|
@@ -30,6 +30,9 @@ let GroupPlugin = GroupPlugin_1 = class GroupPlugin extends components_1.Convert
|
|
|
30
30
|
*/
|
|
31
31
|
initialize() {
|
|
32
32
|
this.listenTo(this.owner, {
|
|
33
|
+
[converter_1.Converter.EVENT_RESOLVE_BEGIN]: () => {
|
|
34
|
+
this.sortFunction = (0, sort_1.getSortFunction)(this.application.options);
|
|
35
|
+
},
|
|
33
36
|
[converter_1.Converter.EVENT_RESOLVE]: this.onResolve,
|
|
34
37
|
[converter_1.Converter.EVENT_RESOLVE_END]: this.onEndResolve,
|
|
35
38
|
});
|
|
@@ -68,7 +71,7 @@ let GroupPlugin = GroupPlugin_1 = class GroupPlugin extends components_1.Convert
|
|
|
68
71
|
if (reflection.children &&
|
|
69
72
|
reflection.children.length > 0 &&
|
|
70
73
|
!reflection.groups) {
|
|
71
|
-
|
|
74
|
+
this.sortFunction(reflection.children);
|
|
72
75
|
reflection.groups = this.getReflectionGroups(reflection.children);
|
|
73
76
|
}
|
|
74
77
|
}
|
|
@@ -193,9 +196,6 @@ GroupPlugin.PLURALS = {
|
|
|
193
196
|
[index_1.ReflectionKind.EnumMember]: "Enumeration Members",
|
|
194
197
|
[index_1.ReflectionKind.TypeAlias]: "Type Aliases",
|
|
195
198
|
};
|
|
196
|
-
__decorate([
|
|
197
|
-
(0, utils_1.BindOption)("sort")
|
|
198
|
-
], GroupPlugin.prototype, "sortStrategies", void 0);
|
|
199
199
|
__decorate([
|
|
200
200
|
(0, utils_1.BindOption)("searchGroupBoosts")
|
|
201
201
|
], GroupPlugin.prototype, "boosts", void 0);
|
|
@@ -16,6 +16,7 @@ const fs_1 = require("../../utils/fs");
|
|
|
16
16
|
const path_1 = require("path");
|
|
17
17
|
const models_1 = require("../../models");
|
|
18
18
|
const repository_1 = require("../utils/repository");
|
|
19
|
+
const base_path_1 = require("../utils/base-path");
|
|
19
20
|
/**
|
|
20
21
|
* A handler that attaches source file information to reflections.
|
|
21
22
|
*/
|
|
@@ -64,7 +65,7 @@ let SourcePlugin = class SourcePlugin extends components_1.ConverterComponent {
|
|
|
64
65
|
const symbol = reflection.project.getSymbolFromReflection(reflection);
|
|
65
66
|
for (const node of symbol?.declarations || []) {
|
|
66
67
|
const sourceFile = node.getSourceFile();
|
|
67
|
-
const fileName = sourceFile.fileName;
|
|
68
|
+
const fileName = base_path_1.BasePath.normalize(sourceFile.fileName);
|
|
68
69
|
this.fileNames.add(fileName);
|
|
69
70
|
let position;
|
|
70
71
|
if ((0, nodes_1.isNamedNode)(node)) {
|
|
@@ -81,7 +82,7 @@ let SourcePlugin = class SourcePlugin extends components_1.ConverterComponent {
|
|
|
81
82
|
if (this.disableSources || !sig)
|
|
82
83
|
return;
|
|
83
84
|
const sourceFile = sig.getSourceFile();
|
|
84
|
-
const fileName = sourceFile.fileName;
|
|
85
|
+
const fileName = base_path_1.BasePath.normalize(sourceFile.fileName);
|
|
85
86
|
this.fileNames.add(fileName);
|
|
86
87
|
const position = ts.getLineAndCharacterOfPosition(sourceFile, sig.getStart());
|
|
87
88
|
reflection.sources || (reflection.sources = []);
|
|
@@ -82,7 +82,7 @@ class BasePath {
|
|
|
82
82
|
path = path.replace(/\\/g, "/");
|
|
83
83
|
// Remove all surrounding quotes
|
|
84
84
|
path = path.replace(/^["']+|["']+$/g, "");
|
|
85
|
-
// Make Windows drive letters
|
|
85
|
+
// Make Windows drive letters upper case
|
|
86
86
|
return path.replace(/^([^:]+):\//, (_m, m1) => m1.toUpperCase() + ":/");
|
|
87
87
|
}
|
|
88
88
|
}
|
|
@@ -53,22 +53,6 @@ exports.CommentTag = CommentTag;
|
|
|
53
53
|
* through the {@link DeclarationReflection.comment} property.
|
|
54
54
|
*/
|
|
55
55
|
class Comment {
|
|
56
|
-
/**
|
|
57
|
-
* Creates a new Comment instance.
|
|
58
|
-
*/
|
|
59
|
-
constructor(summary = [], blockTags = [], modifierTags = new Set()) {
|
|
60
|
-
/**
|
|
61
|
-
* All associated block level tags.
|
|
62
|
-
*/
|
|
63
|
-
this.blockTags = [];
|
|
64
|
-
/**
|
|
65
|
-
* All modifier tags present on the comment, e.g. `@alpha`, `@beta`.
|
|
66
|
-
*/
|
|
67
|
-
this.modifierTags = new Set();
|
|
68
|
-
this.summary = summary;
|
|
69
|
-
this.blockTags = blockTags;
|
|
70
|
-
this.modifierTags = modifierTags;
|
|
71
|
-
}
|
|
72
56
|
/**
|
|
73
57
|
* Debugging utility for combining parts into a simple string. Not suitable for
|
|
74
58
|
* rendering, but can be useful in tests.
|
|
@@ -96,6 +80,22 @@ class Comment {
|
|
|
96
80
|
static cloneDisplayParts(parts) {
|
|
97
81
|
return parts.map((p) => ({ ...p }));
|
|
98
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Creates a new Comment instance.
|
|
85
|
+
*/
|
|
86
|
+
constructor(summary = [], blockTags = [], modifierTags = new Set()) {
|
|
87
|
+
/**
|
|
88
|
+
* All associated block level tags.
|
|
89
|
+
*/
|
|
90
|
+
this.blockTags = [];
|
|
91
|
+
/**
|
|
92
|
+
* All modifier tags present on the comment, e.g. `@alpha`, `@beta`.
|
|
93
|
+
*/
|
|
94
|
+
this.modifierTags = new Set();
|
|
95
|
+
this.summary = summary;
|
|
96
|
+
this.blockTags = blockTags;
|
|
97
|
+
this.modifierTags = modifierTags;
|
|
98
|
+
}
|
|
99
99
|
/**
|
|
100
100
|
* Create a deep clone of this comment.
|
|
101
101
|
*/
|
|
@@ -209,6 +209,12 @@ var TraverseProperty;
|
|
|
209
209
|
* contains a list of all children grouped and sorted for rendering.
|
|
210
210
|
*/
|
|
211
211
|
class Reflection {
|
|
212
|
+
get project() {
|
|
213
|
+
if (this.isProject())
|
|
214
|
+
return this;
|
|
215
|
+
(0, assert_1.ok)(this.parent, "Tried to get the project on a reflection not in a project");
|
|
216
|
+
return this.parent.project;
|
|
217
|
+
}
|
|
212
218
|
constructor(name, kind, parent) {
|
|
213
219
|
this.flags = new ReflectionFlags();
|
|
214
220
|
this.id = REFLECTION_ID++;
|
|
@@ -221,12 +227,6 @@ class Reflection {
|
|
|
221
227
|
this.setFlag(ReflectionFlag.External);
|
|
222
228
|
}
|
|
223
229
|
}
|
|
224
|
-
get project() {
|
|
225
|
-
if (this.isProject())
|
|
226
|
-
return this;
|
|
227
|
-
(0, assert_1.ok)(this.parent, "Tried to get the project on a reflection not in a project");
|
|
228
|
-
return this.parent.project;
|
|
229
|
-
}
|
|
230
230
|
/**
|
|
231
231
|
* Test whether this reflection is of the given kind.
|
|
232
232
|
*/
|
|
@@ -11,7 +11,7 @@ export declare const VarianceModifier: {
|
|
|
11
11
|
readonly out: "out";
|
|
12
12
|
readonly inOut: "in out";
|
|
13
13
|
};
|
|
14
|
-
export
|
|
14
|
+
export type VarianceModifier = typeof VarianceModifier[keyof typeof VarianceModifier];
|
|
15
15
|
export declare class TypeParameterReflection extends Reflection {
|
|
16
16
|
parent?: DeclarationReflection;
|
|
17
17
|
type?: SomeType;
|
|
@@ -53,12 +53,12 @@ export interface TypeKindMap {
|
|
|
53
53
|
union: UnionType;
|
|
54
54
|
unknown: UnknownType;
|
|
55
55
|
}
|
|
56
|
-
export
|
|
56
|
+
export type TypeVisitor<T = void> = {
|
|
57
57
|
[K in TypeKind]: (type: TypeKindMap[K]) => T;
|
|
58
58
|
};
|
|
59
59
|
export declare function makeRecursiveVisitor(visitor: Partial<TypeVisitor>): TypeVisitor;
|
|
60
|
-
export
|
|
61
|
-
export
|
|
60
|
+
export type TypeKind = keyof TypeKindMap;
|
|
61
|
+
export type SomeType = TypeKindMap[keyof TypeKindMap];
|
|
62
62
|
/**
|
|
63
63
|
* Enumeration that can be used when traversing types to track the location of recursion.
|
|
64
64
|
* Used by TypeDoc internally to track when to output parenthesis when rendering.
|
|
@@ -89,7 +89,7 @@ export declare const TypeContext: {
|
|
|
89
89
|
readonly tupleElement: "tupleElement";
|
|
90
90
|
readonly unionElement: "unionElement";
|
|
91
91
|
};
|
|
92
|
-
export
|
|
92
|
+
export type TypeContext = typeof TypeContext[keyof typeof TypeContext];
|
|
93
93
|
/**
|
|
94
94
|
* Represents an array type.
|
|
95
95
|
*
|
|
@@ -242,7 +242,7 @@ export declare class OptionalType extends Type {
|
|
|
242
242
|
* Represents a type predicate.
|
|
243
243
|
*
|
|
244
244
|
* ```ts
|
|
245
|
-
* function isString(
|
|
245
|
+
* function isString(x: unknown): x is string {}
|
|
246
246
|
* function assert(condition: boolean): asserts condition {}
|
|
247
247
|
* ```
|
|
248
248
|
*/
|
package/dist/lib/models/types.js
CHANGED
|
@@ -543,7 +543,7 @@ exports.OptionalType = OptionalType;
|
|
|
543
543
|
* Represents a type predicate.
|
|
544
544
|
*
|
|
545
545
|
* ```ts
|
|
546
|
-
* function isString(
|
|
546
|
+
* function isString(x: unknown): x is string {}
|
|
547
547
|
* function assert(condition: boolean): asserts condition {}
|
|
548
548
|
* ```
|
|
549
549
|
*/
|
|
@@ -629,14 +629,6 @@ exports.QueryType = QueryType;
|
|
|
629
629
|
* ```
|
|
630
630
|
*/
|
|
631
631
|
class ReferenceType extends Type {
|
|
632
|
-
constructor(name, target, project, qualifiedName) {
|
|
633
|
-
super();
|
|
634
|
-
this.type = "reference";
|
|
635
|
-
this.name = name;
|
|
636
|
-
this._target = target instanceof abstract_1.Reflection ? target.id : target;
|
|
637
|
-
this._project = project;
|
|
638
|
-
this.qualifiedName = qualifiedName;
|
|
639
|
-
}
|
|
640
632
|
/**
|
|
641
633
|
* The resolved reflection.
|
|
642
634
|
*/
|
|
@@ -675,6 +667,14 @@ class ReferenceType extends Type {
|
|
|
675
667
|
},
|
|
676
668
|
};
|
|
677
669
|
}
|
|
670
|
+
constructor(name, target, project, qualifiedName) {
|
|
671
|
+
super();
|
|
672
|
+
this.type = "reference";
|
|
673
|
+
this.name = name;
|
|
674
|
+
this._target = target instanceof abstract_1.Reflection ? target.id : target;
|
|
675
|
+
this._project = project;
|
|
676
|
+
this.qualifiedName = qualifiedName;
|
|
677
|
+
}
|
|
678
678
|
static createResolvedReference(name, target, project) {
|
|
679
679
|
return new ReferenceType(name, target, project, name);
|
|
680
680
|
}
|
|
@@ -86,6 +86,13 @@ MarkdownEvent.PARSE = "parseMarkdown";
|
|
|
86
86
|
* An event emitted when the search index is being prepared.
|
|
87
87
|
*/
|
|
88
88
|
class IndexEvent extends events_1.Event {
|
|
89
|
+
/**
|
|
90
|
+
* Remove a search result by index.
|
|
91
|
+
*/
|
|
92
|
+
removeResult(index) {
|
|
93
|
+
this.searchResults.splice(index, 1);
|
|
94
|
+
this.searchFields.splice(index, 1);
|
|
95
|
+
}
|
|
89
96
|
constructor(name, searchResults) {
|
|
90
97
|
super(name);
|
|
91
98
|
/**
|
|
@@ -105,13 +112,6 @@ class IndexEvent extends events_1.Event {
|
|
|
105
112
|
this.searchResults = searchResults;
|
|
106
113
|
this.searchFields = Array.from({ length: this.searchResults.length }, () => ({}));
|
|
107
114
|
}
|
|
108
|
-
/**
|
|
109
|
-
* Remove a search result by index.
|
|
110
|
-
*/
|
|
111
|
-
removeResult(index) {
|
|
112
|
-
this.searchResults.splice(index, 1);
|
|
113
|
-
this.searchFields.splice(index, 1);
|
|
114
|
-
}
|
|
115
115
|
}
|
|
116
116
|
exports.IndexEvent = IndexEvent;
|
|
117
117
|
/**
|
|
@@ -6,4 +6,4 @@ export declare class UrlMapping<Model = any> {
|
|
|
6
6
|
template: RenderTemplate<PageEvent<Model>>;
|
|
7
7
|
constructor(url: string, model: Model, template: RenderTemplate<PageEvent<Model>>);
|
|
8
8
|
}
|
|
9
|
-
export
|
|
9
|
+
export type RenderTemplate<T> = (data: T) => JSX.Element | string;
|
|
@@ -12,6 +12,12 @@ const utils_1 = require("../../../utils");
|
|
|
12
12
|
* {@link Theme} implementation, this theme class will be used.
|
|
13
13
|
*/
|
|
14
14
|
class DefaultTheme extends theme_1.Theme {
|
|
15
|
+
getRenderContext(_pageEvent) {
|
|
16
|
+
if (!this._renderContext) {
|
|
17
|
+
this._renderContext = new DefaultThemeRenderContext_1.DefaultThemeRenderContext(this, this.application.options);
|
|
18
|
+
}
|
|
19
|
+
return this._renderContext;
|
|
20
|
+
}
|
|
15
21
|
/**
|
|
16
22
|
* Create a new DefaultTheme instance.
|
|
17
23
|
*
|
|
@@ -72,12 +78,6 @@ class DefaultTheme extends theme_1.Theme {
|
|
|
72
78
|
this.markedPlugin = renderer.getComponent("marked");
|
|
73
79
|
this.listenTo(renderer, events_1.RendererEvent.BEGIN, this.onRendererBegin, 1024);
|
|
74
80
|
}
|
|
75
|
-
getRenderContext(_pageEvent) {
|
|
76
|
-
if (!this._renderContext) {
|
|
77
|
-
this._renderContext = new DefaultThemeRenderContext_1.DefaultThemeRenderContext(this, this.application.options);
|
|
78
|
-
}
|
|
79
|
-
return this._renderContext;
|
|
80
|
-
}
|
|
81
81
|
/**
|
|
82
82
|
* Map the models of the given project to the desired output files.
|
|
83
83
|
*
|
|
@@ -100,8 +100,8 @@ function displayPartsToMarkdown(parts, urlTo) {
|
|
|
100
100
|
case "@linkplain": {
|
|
101
101
|
if (part.target) {
|
|
102
102
|
const url = typeof part.target === "string" ? part.target : urlTo(part.target);
|
|
103
|
-
const
|
|
104
|
-
result.push(url ?
|
|
103
|
+
const text = part.tag === "@linkcode" ? `<code>${part.text}</code>` : part.text;
|
|
104
|
+
result.push(url ? `<a href="${url}">${text}</a>` : part.text);
|
|
105
105
|
}
|
|
106
106
|
else {
|
|
107
107
|
result.push(part.text);
|
|
@@ -31,10 +31,10 @@ import type * as M from "../models";
|
|
|
31
31
|
/**
|
|
32
32
|
* Describes the mapping from Model types to the corresponding JSON output type.
|
|
33
33
|
*/
|
|
34
|
-
export
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
export type ModelToObject<T> = T extends Array<infer U> ? _ModelToObject<U>[] : _ModelToObject<T>;
|
|
35
|
+
type _ModelToObject<T> = T extends Primitive ? T : T extends M.ReflectionGroup ? ReflectionGroup : T extends M.ReflectionCategory ? ReflectionCategory : T extends M.SignatureReflection ? SignatureReflection : T extends M.ParameterReflection ? ParameterReflection : T extends M.DeclarationReflection ? DeclarationReflection : T extends M.TypeParameterReflection ? TypeParameterReflection : T extends M.ProjectReflection ? ProjectReflection : T extends M.ContainerReflection ? ContainerReflection : T extends M.ReferenceReflection ? ReferenceReflection : T extends M.Reflection ? Reflection : 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 : never;
|
|
36
|
+
type Primitive = string | number | undefined | null | boolean;
|
|
37
|
+
type ToSerialized<T> = T extends Primitive ? T : T extends bigint ? {
|
|
38
38
|
value: string;
|
|
39
39
|
negative: boolean;
|
|
40
40
|
} : ModelToObject<T>;
|
|
@@ -44,7 +44,7 @@ declare type ToSerialized<T> = T extends Primitive ? T : T extends bigint ? {
|
|
|
44
44
|
* This helper removes the readonly modifier from properties since the result of serialization
|
|
45
45
|
* is a plain object that consumers may modify as they choose, TypeDoc doesn't care.
|
|
46
46
|
*/
|
|
47
|
-
|
|
47
|
+
type S<T, K extends keyof T> = {
|
|
48
48
|
-readonly [K2 in K]: ToSerialized<T[K2]>;
|
|
49
49
|
};
|
|
50
50
|
export interface ReflectionGroup extends S<M.ReflectionGroup, "title" | "categories"> {
|
|
@@ -78,8 +78,8 @@ export interface Reflection extends S<M.Reflection, "id" | "name" | "kind" | "ki
|
|
|
78
78
|
originalName?: M.Reflection["originalName"];
|
|
79
79
|
flags: ReflectionFlags;
|
|
80
80
|
}
|
|
81
|
-
export
|
|
82
|
-
export
|
|
81
|
+
export type SomeType = ModelToObject<M.SomeType>;
|
|
82
|
+
export type TypeKindMap = {
|
|
83
83
|
array: ArrayType;
|
|
84
84
|
conditional: ConditionalType;
|
|
85
85
|
indexedAccess: IndexedAccessType;
|
|
@@ -148,7 +148,7 @@ export interface UnknownType extends Type, S<M.UnknownType, "type" | "name"> {
|
|
|
148
148
|
}
|
|
149
149
|
export interface Type {
|
|
150
150
|
}
|
|
151
|
-
|
|
151
|
+
type BoolKeys<T> = {
|
|
152
152
|
[K in keyof T]-?: T[K] extends boolean ? K : never;
|
|
153
153
|
}[keyof T];
|
|
154
154
|
export interface ReflectionFlags extends Partial<S<M.ReflectionFlags, BoolKeys<M.ReflectionFlags>>> {
|
|
@@ -164,7 +164,7 @@ export interface CommentTag extends S<M.CommentTag, "tag" | "name"> {
|
|
|
164
164
|
* If `target` is a number, it is a reflection ID. If a string, it is a URL.
|
|
165
165
|
* `target` will only be set for `@link`, `@linkcode`, and `@linkplain` tags.
|
|
166
166
|
*/
|
|
167
|
-
export
|
|
167
|
+
export type CommentDisplayPart = {
|
|
168
168
|
kind: "text";
|
|
169
169
|
text: string;
|
|
170
170
|
} | {
|
|
@@ -22,7 +22,7 @@ export declare const EntryPointStrategy: {
|
|
|
22
22
|
*/
|
|
23
23
|
readonly Packages: "packages";
|
|
24
24
|
};
|
|
25
|
-
export
|
|
25
|
+
export type EntryPointStrategy = typeof EntryPointStrategy[keyof typeof EntryPointStrategy];
|
|
26
26
|
export interface DocumentationEntryPoint {
|
|
27
27
|
displayName: string;
|
|
28
28
|
readmeFile?: string;
|
package/dist/lib/utils/enum.d.ts
CHANGED
|
@@ -2,3 +2,4 @@ export declare function getEnumFlags<T extends number>(flags: T): T[];
|
|
|
2
2
|
export declare function removeFlag<T extends number>(flag: T, remove: T & {}): T;
|
|
3
3
|
export declare function hasAllFlags(flags: number, check: number): boolean;
|
|
4
4
|
export declare function hasAnyFlag(flags: number, check: number): boolean;
|
|
5
|
+
export declare function getEnumKeys(Enum: Record<string, string | number>): string[];
|
package/dist/lib/utils/enum.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasAnyFlag = exports.hasAllFlags = exports.removeFlag = exports.getEnumFlags = void 0;
|
|
3
|
+
exports.getEnumKeys = exports.hasAnyFlag = exports.hasAllFlags = exports.removeFlag = exports.getEnumFlags = void 0;
|
|
4
4
|
function getEnumFlags(flags) {
|
|
5
5
|
const result = [];
|
|
6
6
|
for (let i = 1; i <= flags; i <<= 1) {
|
|
@@ -24,3 +24,10 @@ function hasAnyFlag(flags, check) {
|
|
|
24
24
|
return (flags & check) !== 0;
|
|
25
25
|
}
|
|
26
26
|
exports.hasAnyFlag = hasAnyFlag;
|
|
27
|
+
// Note: String enums are not handled.
|
|
28
|
+
function getEnumKeys(Enum) {
|
|
29
|
+
return Object.keys(Enum).filter((k) => {
|
|
30
|
+
return Enum[Enum[k]] === k;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
exports.getEnumKeys = getEnumKeys;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* script will be used to switch this flag to false when publishing, then immediately back
|
|
5
5
|
* to true after a successful publish.
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
type InternalOnly = false;
|
|
8
8
|
/**
|
|
9
9
|
* Helper type to convert `T` to `F` if strict mode is on.
|
|
10
10
|
*
|
|
@@ -23,17 +23,17 @@ declare type InternalOnly = false;
|
|
|
23
23
|
* function over(flag: string): string { return flag }
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
|
-
export
|
|
26
|
+
export type IfInternal<T, F> = InternalOnly extends true ? T : F;
|
|
27
27
|
/**
|
|
28
28
|
* Helper type to convert `T` to `never` if strict mode is on.
|
|
29
29
|
*
|
|
30
30
|
* See {@link IfInternal} for the rationale.
|
|
31
31
|
*/
|
|
32
|
-
export
|
|
32
|
+
export type NeverIfInternal<T> = IfInternal<never, T>;
|
|
33
33
|
/**
|
|
34
34
|
* Resolves a string type into a union of characters, `"ab"` turns into `"a" | "b"`.
|
|
35
35
|
*/
|
|
36
|
-
export
|
|
36
|
+
export type Chars<T extends string> = T extends `${infer C}${infer R}` ? C | Chars<R> : never;
|
|
37
37
|
/**
|
|
38
38
|
* Utility to help type checking ensure that there is no uncovered case.
|
|
39
39
|
*/
|