typedoc 0.24.7 → 0.25.0
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/README.md +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +5 -1
- package/dist/lib/application.d.ts +16 -5
- package/dist/lib/application.js +53 -18
- package/dist/lib/cli.js +25 -21
- package/dist/lib/converter/comments/blockLexer.js +10 -1
- package/dist/lib/converter/comments/declarationReference.js +2 -0
- package/dist/lib/converter/comments/declarationReferenceResolver.js +2 -1
- package/dist/lib/converter/comments/discovery.js +0 -1
- package/dist/lib/converter/comments/lexer.js +1 -1
- package/dist/lib/converter/comments/linkResolver.d.ts +5 -2
- package/dist/lib/converter/comments/linkResolver.js +21 -13
- package/dist/lib/converter/comments/parser.js +2 -1
- package/dist/lib/converter/converter.d.ts +2 -0
- package/dist/lib/converter/converter.js +14 -9
- package/dist/lib/converter/factories/index-signature.js +2 -1
- package/dist/lib/converter/plugins/CategoryPlugin.js +2 -2
- package/dist/lib/converter/plugins/CommentPlugin.js +8 -4
- package/dist/lib/converter/plugins/GroupPlugin.js +3 -3
- package/dist/lib/converter/plugins/ImplementsPlugin.js +8 -6
- package/dist/lib/converter/plugins/InheritDocPlugin.d.ts +2 -0
- package/dist/lib/converter/plugins/InheritDocPlugin.js +11 -5
- package/dist/lib/converter/plugins/LinkResolverPlugin.js +4 -3
- package/dist/lib/converter/plugins/PackagePlugin.js +2 -2
- package/dist/lib/converter/plugins/SourcePlugin.d.ts +1 -0
- package/dist/lib/converter/plugins/SourcePlugin.js +31 -13
- package/dist/lib/converter/plugins/TypePlugin.js +12 -11
- package/dist/lib/converter/symbols.js +15 -3
- package/dist/lib/converter/types.js +6 -1
- package/dist/lib/converter/utils/nodes.d.ts +2 -2
- package/dist/lib/converter/utils/repository.d.ts +15 -5
- package/dist/lib/converter/utils/repository.js +28 -11
- package/dist/lib/models/ReflectionGroup.d.ts +4 -2
- package/dist/lib/models/ReflectionGroup.js +3 -1
- package/dist/lib/models/comments/comment.d.ts +9 -2
- package/dist/lib/models/comments/comment.js +2 -0
- package/dist/lib/models/reflections/abstract.d.ts +2 -1
- package/dist/lib/models/reflections/abstract.js +4 -3
- package/dist/lib/models/reflections/container.d.ts +3 -0
- package/dist/lib/models/reflections/container.js +4 -1
- package/dist/lib/models/reflections/declaration.d.ts +1 -0
- package/dist/lib/models/reflections/declaration.js +2 -1
- package/dist/lib/models/reflections/kind.d.ts +4 -4
- package/dist/lib/models/reflections/kind.js +7 -9
- package/dist/lib/models/reflections/parameter.d.ts +3 -0
- package/dist/lib/models/reflections/parameter.js +3 -0
- package/dist/lib/models/reflections/project.d.ts +1 -0
- package/dist/lib/models/reflections/project.js +3 -1
- package/dist/lib/models/reflections/reference.d.ts +1 -0
- package/dist/lib/models/reflections/reference.js +1 -0
- package/dist/lib/models/reflections/signature.d.ts +3 -0
- package/dist/lib/models/reflections/signature.js +3 -0
- package/dist/lib/models/reflections/type-parameter.d.ts +3 -0
- package/dist/lib/models/reflections/type-parameter.js +3 -0
- package/dist/lib/models/sources/file.d.ts +2 -0
- package/dist/lib/models/sources/file.js +5 -0
- package/dist/lib/models/types.d.ts +24 -0
- package/dist/lib/models/types.js +21 -0
- package/dist/lib/output/components.js +2 -3
- package/dist/lib/output/events.d.ts +8 -2
- package/dist/lib/output/events.js +10 -4
- package/dist/lib/output/plugins/AssetsPlugin.js +2 -2
- package/dist/lib/output/plugins/JavascriptIndexPlugin.js +2 -2
- package/dist/lib/output/renderer.d.ts +2 -0
- package/dist/lib/output/renderer.js +7 -2
- package/dist/lib/output/theme.d.ts +1 -1
- package/dist/lib/output/theme.js +2 -2
- package/dist/lib/output/themes/MarkedPlugin.js +5 -3
- package/dist/lib/output/themes/default/DefaultTheme.js +1 -1
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +4 -8
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +3 -9
- package/dist/lib/output/themes/default/partials/comment.d.ts +3 -1
- package/dist/lib/output/themes/default/partials/comment.js +30 -10
- package/dist/lib/output/themes/default/partials/footer.js +1 -1
- package/dist/lib/output/themes/default/partials/header.js +1 -1
- package/dist/lib/output/themes/default/partials/icon.js +8 -12
- package/dist/lib/output/themes/default/partials/member.declaration.d.ts +2 -2
- package/dist/lib/output/themes/default/partials/member.declaration.js +34 -21
- package/dist/lib/output/themes/default/partials/member.js +1 -1
- package/dist/lib/output/themes/default/partials/member.signature.body.js +6 -4
- package/dist/lib/output/themes/default/partials/navigation.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/navigation.js +28 -15
- package/dist/lib/output/themes/default/partials/parameter.js +11 -7
- package/dist/lib/output/themes/default/partials/typeParameters.js +2 -1
- package/dist/lib/output/themes/default/templates/reflection.js +5 -2
- package/dist/lib/output/themes/lib.d.ts +1 -2
- package/dist/lib/output/themes/lib.js +1 -11
- package/dist/lib/serialization/schema.d.ts +37 -1
- package/dist/lib/serialization/serializer.js +1 -1
- package/dist/lib/utils/component.d.ts +1 -1
- package/dist/lib/utils/component.js +1 -1
- package/dist/lib/utils/entry-point.d.ts +0 -6
- package/dist/lib/utils/entry-point.js +0 -99
- package/dist/lib/utils/jsx.d.ts +4 -1
- package/dist/lib/utils/jsx.js +30 -16
- package/dist/lib/utils/loggers.js +1 -1
- package/dist/lib/utils/options/declaration.d.ts +4 -1
- package/dist/lib/utils/options/declaration.js +3 -3
- package/dist/lib/utils/options/options.d.ts +3 -9
- package/dist/lib/utils/options/options.js +5 -13
- package/dist/lib/utils/options/readers/typedoc.d.ts +4 -2
- package/dist/lib/utils/options/readers/typedoc.js +33 -7
- package/dist/lib/utils/options/sources/typedoc.js +15 -4
- package/dist/lib/utils/options/tsdoc-defaults.d.ts +1 -1
- package/dist/lib/utils/options/tsdoc-defaults.js +4 -0
- package/dist/lib/utils/package-manifest.d.ts +0 -25
- package/dist/lib/utils/package-manifest.js +7 -148
- package/dist/lib/utils/perf.js +26 -11
- package/dist/lib/utils/sort.js +0 -1
- package/dist/lib/validation/links.js +10 -2
- package/package.json +12 -12
- package/static/main.js +1 -1
- package/static/style.css +19 -7
- package/tsdoc.json +16 -0
|
@@ -131,7 +131,7 @@ let GroupPlugin = GroupPlugin_1 = class GroupPlugin extends components_1.Convert
|
|
|
131
131
|
for (const name of this.getGroups(child)) {
|
|
132
132
|
let group = groups.get(name);
|
|
133
133
|
if (!group) {
|
|
134
|
-
group = new ReflectionGroup_1.ReflectionGroup(name);
|
|
134
|
+
group = new ReflectionGroup_1.ReflectionGroup(name, child);
|
|
135
135
|
groups.set(name, group);
|
|
136
136
|
}
|
|
137
137
|
group.children.push(child);
|
|
@@ -163,6 +163,7 @@ let GroupPlugin = GroupPlugin_1 = class GroupPlugin extends components_1.Convert
|
|
|
163
163
|
return aWeight - bWeight;
|
|
164
164
|
}
|
|
165
165
|
};
|
|
166
|
+
exports.GroupPlugin = GroupPlugin;
|
|
166
167
|
GroupPlugin.WEIGHTS = [];
|
|
167
168
|
__decorate([
|
|
168
169
|
(0, utils_1.BindOption)("searchGroupBoosts")
|
|
@@ -170,7 +171,6 @@ __decorate([
|
|
|
170
171
|
__decorate([
|
|
171
172
|
(0, utils_1.BindOption)("groupOrder")
|
|
172
173
|
], GroupPlugin.prototype, "groupOrder", void 0);
|
|
173
|
-
GroupPlugin = GroupPlugin_1 = __decorate([
|
|
174
|
+
exports.GroupPlugin = GroupPlugin = GroupPlugin_1 = __decorate([
|
|
174
175
|
(0, components_1.Component)({ name: "group" })
|
|
175
176
|
], GroupPlugin);
|
|
176
|
-
exports.GroupPlugin = GroupPlugin;
|
|
@@ -103,9 +103,10 @@ let ImplementsPlugin = class ImplementsPlugin extends components_1.ConverterComp
|
|
|
103
103
|
this.resolve(context.project);
|
|
104
104
|
}
|
|
105
105
|
resolve(project) {
|
|
106
|
-
for (const
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
for (const id in project.reflections) {
|
|
107
|
+
const refl = project.reflections[id];
|
|
108
|
+
if (refl instanceof index_1.DeclarationReflection) {
|
|
109
|
+
this.tryResolve(project, refl);
|
|
109
110
|
}
|
|
110
111
|
}
|
|
111
112
|
}
|
|
@@ -195,7 +196,8 @@ let ImplementsPlugin = class ImplementsPlugin extends components_1.ConverterComp
|
|
|
195
196
|
const property = findProperty(reflection, childType);
|
|
196
197
|
if (!property) {
|
|
197
198
|
// We're probably broken... but I don't think this should be fatal.
|
|
198
|
-
context.logger.warn(`Failed to retrieve${reflection.flags.isStatic ? " static" : ""} member "${reflection.escapedName ?? reflection.name}" of "${reflection.parent
|
|
199
|
+
context.logger.warn(`Failed to retrieve${reflection.flags.isStatic ? " static" : ""} member "${reflection.escapedName ?? reflection.name}" of "${reflection.parent
|
|
200
|
+
?.name}" for inheritance analysis. Please report a bug.`);
|
|
199
201
|
return;
|
|
200
202
|
}
|
|
201
203
|
// Need to check both extends and implements clauses.
|
|
@@ -224,10 +226,10 @@ let ImplementsPlugin = class ImplementsPlugin extends components_1.ConverterComp
|
|
|
224
226
|
}
|
|
225
227
|
}
|
|
226
228
|
};
|
|
227
|
-
ImplementsPlugin =
|
|
229
|
+
exports.ImplementsPlugin = ImplementsPlugin;
|
|
230
|
+
exports.ImplementsPlugin = ImplementsPlugin = __decorate([
|
|
228
231
|
(0, components_1.Component)({ name: "implements" })
|
|
229
232
|
], ImplementsPlugin);
|
|
230
|
-
exports.ImplementsPlugin = ImplementsPlugin;
|
|
231
233
|
function constructorInheritance(context, reflection, childDecl, constructorDecl) {
|
|
232
234
|
const extendsClause = childDecl.heritageClauses?.find((cl) => cl.token === typescript_1.default.SyntaxKind.ExtendsKeyword);
|
|
233
235
|
if (!extendsClause)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ConverterComponent } from "../components";
|
|
2
|
+
import { ValidationOptions } from "../../utils";
|
|
2
3
|
/**
|
|
3
4
|
* A plugin that handles `@inheritDoc` tags by copying documentation from another API item.
|
|
4
5
|
* It is NOT responsible for handling bare JSDoc style `@inheritDoc` tags which do not specify
|
|
@@ -13,6 +14,7 @@ import { ConverterComponent } from "../components";
|
|
|
13
14
|
* - `@return` block
|
|
14
15
|
*/
|
|
15
16
|
export declare class InheritDocPlugin extends ConverterComponent {
|
|
17
|
+
validation: ValidationOptions;
|
|
16
18
|
private dependencies;
|
|
17
19
|
/**
|
|
18
20
|
* Create a new InheritDocPlugin instance.
|
|
@@ -39,7 +39,7 @@ let InheritDocPlugin = class InheritDocPlugin extends components_1.ConverterComp
|
|
|
39
39
|
*/
|
|
40
40
|
initialize() {
|
|
41
41
|
this.owner.on(converter_1.Converter.EVENT_RESOLVE_END, (context) => this.processInheritDoc(context.project));
|
|
42
|
-
this.
|
|
42
|
+
this.application.on(application_events_1.ApplicationEvents.REVIVE, this.processInheritDoc, this);
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
45
|
* Traverse through reflection descendant to check for `inheritDoc` tag.
|
|
@@ -47,7 +47,8 @@ let InheritDocPlugin = class InheritDocPlugin extends components_1.ConverterComp
|
|
|
47
47
|
* that will provide actual comment.
|
|
48
48
|
*/
|
|
49
49
|
processInheritDoc(project) {
|
|
50
|
-
for (const
|
|
50
|
+
for (const id in project.reflections) {
|
|
51
|
+
const reflection = project.reflections[id];
|
|
51
52
|
const source = extractInheritDocTagReference(reflection);
|
|
52
53
|
if (!source)
|
|
53
54
|
continue;
|
|
@@ -78,7 +79,9 @@ let InheritDocPlugin = class InheritDocPlugin extends components_1.ConverterComp
|
|
|
78
79
|
sourceRefl = sourceRefl.getSignature || sourceRefl.setSignature;
|
|
79
80
|
}
|
|
80
81
|
if (!sourceRefl) {
|
|
81
|
-
this.
|
|
82
|
+
if (this.validation.invalidLink) {
|
|
83
|
+
this.application.logger.warn(`Failed to find "${source}" to inherit the comment from in the comment for ${reflection.getFullName()}`);
|
|
84
|
+
}
|
|
82
85
|
continue;
|
|
83
86
|
}
|
|
84
87
|
this.copyComment(sourceRefl, reflection);
|
|
@@ -159,10 +162,13 @@ let InheritDocPlugin = class InheritDocPlugin extends components_1.ConverterComp
|
|
|
159
162
|
}
|
|
160
163
|
}
|
|
161
164
|
};
|
|
162
|
-
InheritDocPlugin =
|
|
165
|
+
exports.InheritDocPlugin = InheritDocPlugin;
|
|
166
|
+
__decorate([
|
|
167
|
+
(0, utils_1.BindOption)("validation")
|
|
168
|
+
], InheritDocPlugin.prototype, "validation", void 0);
|
|
169
|
+
exports.InheritDocPlugin = InheritDocPlugin = __decorate([
|
|
163
170
|
(0, components_1.Component)({ name: "inheritDoc" })
|
|
164
171
|
], InheritDocPlugin);
|
|
165
|
-
exports.InheritDocPlugin = InheritDocPlugin;
|
|
166
172
|
function copySummaries(source, target) {
|
|
167
173
|
for (const [s, t] of (0, array_1.zip)(source || [], target || [])) {
|
|
168
174
|
t.comment = new models_1.Comment(s.comment?.summary);
|
|
@@ -26,7 +26,8 @@ let LinkResolverPlugin = class LinkResolverPlugin extends components_1.Converter
|
|
|
26
26
|
this.resolveLinks(context.project);
|
|
27
27
|
}
|
|
28
28
|
resolveLinks(project) {
|
|
29
|
-
for (const
|
|
29
|
+
for (const id in project.reflections) {
|
|
30
|
+
const reflection = project.reflections[id];
|
|
30
31
|
if (reflection.comment) {
|
|
31
32
|
this.owner.resolveLinks(reflection.comment, reflection);
|
|
32
33
|
}
|
|
@@ -53,10 +54,10 @@ let LinkResolverPlugin = class LinkResolverPlugin extends components_1.Converter
|
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
56
|
};
|
|
57
|
+
exports.LinkResolverPlugin = LinkResolverPlugin;
|
|
56
58
|
__decorate([
|
|
57
59
|
(0, utils_1.BindOption)("validation")
|
|
58
60
|
], LinkResolverPlugin.prototype, "validation", void 0);
|
|
59
|
-
LinkResolverPlugin = __decorate([
|
|
61
|
+
exports.LinkResolverPlugin = LinkResolverPlugin = __decorate([
|
|
60
62
|
(0, components_1.Component)({ name: "link-resolver" })
|
|
61
63
|
], LinkResolverPlugin);
|
|
62
|
-
exports.LinkResolverPlugin = LinkResolverPlugin;
|
|
@@ -129,6 +129,7 @@ let PackagePlugin = class PackagePlugin extends components_1.ConverterComponent
|
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
};
|
|
132
|
+
exports.PackagePlugin = PackagePlugin;
|
|
132
133
|
__decorate([
|
|
133
134
|
(0, utils_1.BindOption)("readme")
|
|
134
135
|
], PackagePlugin.prototype, "readme", void 0);
|
|
@@ -141,7 +142,6 @@ __decorate([
|
|
|
141
142
|
__decorate([
|
|
142
143
|
(0, utils_1.BindOption)("includeVersion")
|
|
143
144
|
], PackagePlugin.prototype, "includeVersion", void 0);
|
|
144
|
-
PackagePlugin = __decorate([
|
|
145
|
+
exports.PackagePlugin = PackagePlugin = __decorate([
|
|
145
146
|
(0, components_1.Component)({ name: "package" })
|
|
146
147
|
], PackagePlugin);
|
|
147
|
-
exports.PackagePlugin = PackagePlugin;
|
|
@@ -6,6 +6,7 @@ export declare class SourcePlugin extends ConverterComponent {
|
|
|
6
6
|
readonly disableSources: boolean;
|
|
7
7
|
readonly gitRevision: string;
|
|
8
8
|
readonly gitRemote: string;
|
|
9
|
+
readonly disableGit: boolean;
|
|
9
10
|
readonly sourceLinkTemplate: string;
|
|
10
11
|
readonly basePath: string;
|
|
11
12
|
/**
|
|
@@ -71,14 +71,11 @@ let SourcePlugin = class SourcePlugin extends components_1.ConverterComponent {
|
|
|
71
71
|
const fileName = base_path_1.BasePath.normalize(sourceFile.fileName);
|
|
72
72
|
this.fileNames.add(fileName);
|
|
73
73
|
let position;
|
|
74
|
-
if (
|
|
75
|
-
position = typescript_1.default.getLineAndCharacterOfPosition(sourceFile, node.name.getStart());
|
|
76
|
-
}
|
|
77
|
-
else if (typescript_1.default.isSourceFile(node)) {
|
|
74
|
+
if (typescript_1.default.isSourceFile(node)) {
|
|
78
75
|
position = { character: 0, line: 0 };
|
|
79
76
|
}
|
|
80
77
|
else {
|
|
81
|
-
position = typescript_1.default.getLineAndCharacterOfPosition(sourceFile, node.getStart());
|
|
78
|
+
position = typescript_1.default.getLineAndCharacterOfPosition(sourceFile, getLocationNode(node).getStart());
|
|
82
79
|
}
|
|
83
80
|
reflection.sources || (reflection.sources = []);
|
|
84
81
|
reflection.sources.push(new models_1.SourceReference(fileName, position.line + 1, position.character));
|
|
@@ -90,7 +87,7 @@ let SourcePlugin = class SourcePlugin extends components_1.ConverterComponent {
|
|
|
90
87
|
const sourceFile = sig.getSourceFile();
|
|
91
88
|
const fileName = base_path_1.BasePath.normalize(sourceFile.fileName);
|
|
92
89
|
this.fileNames.add(fileName);
|
|
93
|
-
const position = typescript_1.default.getLineAndCharacterOfPosition(sourceFile, sig.getStart());
|
|
90
|
+
const position = typescript_1.default.getLineAndCharacterOfPosition(sourceFile, getLocationNode(sig).getStart());
|
|
94
91
|
reflection.sources || (reflection.sources = []);
|
|
95
92
|
reflection.sources.push(new models_1.SourceReference(fileName, position.line + 1, position.character));
|
|
96
93
|
}
|
|
@@ -102,15 +99,25 @@ let SourcePlugin = class SourcePlugin extends components_1.ConverterComponent {
|
|
|
102
99
|
onBeginResolve(context) {
|
|
103
100
|
if (this.disableSources)
|
|
104
101
|
return;
|
|
102
|
+
if (this.disableGit && !this.sourceLinkTemplate) {
|
|
103
|
+
this.application.logger.error(`disableGit is set, but sourceLinkTemplate is not, so source links cannot be produced. Set a sourceLinkTemplate or disableSources to prevent source tracking.`);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (this.disableGit &&
|
|
107
|
+
this.sourceLinkTemplate.includes("{gitRevision}") &&
|
|
108
|
+
!this.gitRevision) {
|
|
109
|
+
this.application.logger.warn(`disableGit is set and sourceLinkTemplate contains {gitRevision}, which will be replaced with an empty string as no revision was provided.`);
|
|
110
|
+
}
|
|
105
111
|
const basePath = this.basePath || (0, utils_1.getCommonDirectory)([...this.fileNames]);
|
|
106
|
-
for (const
|
|
112
|
+
for (const id in context.project.reflections) {
|
|
113
|
+
const refl = context.project.reflections[id];
|
|
107
114
|
if (!(refl instanceof index_1.DeclarationReflection ||
|
|
108
115
|
refl instanceof index_1.SignatureReflection)) {
|
|
109
116
|
continue;
|
|
110
117
|
}
|
|
111
118
|
for (const source of refl.sources || []) {
|
|
112
|
-
if (repository_1.gitIsInstalled) {
|
|
113
|
-
const repo = this.getRepository(source.fullFileName);
|
|
119
|
+
if (this.disableGit || (0, repository_1.gitIsInstalled)()) {
|
|
120
|
+
const repo = this.getRepository(basePath, source.fullFileName);
|
|
114
121
|
source.url = repo?.getURL(source.fullFileName, source.line);
|
|
115
122
|
}
|
|
116
123
|
source.fileName = (0, utils_1.normalizePath)((0, path_1.relative)(basePath, source.fullFileName));
|
|
@@ -123,7 +130,10 @@ let SourcePlugin = class SourcePlugin extends components_1.ConverterComponent {
|
|
|
123
130
|
* @param fileName The name of the file a repository should be looked for.
|
|
124
131
|
* @returns The found repository info or undefined.
|
|
125
132
|
*/
|
|
126
|
-
getRepository(fileName) {
|
|
133
|
+
getRepository(basePath, fileName) {
|
|
134
|
+
if (this.disableGit) {
|
|
135
|
+
return new repository_1.AssumedRepository(basePath, this.gitRevision, this.sourceLinkTemplate);
|
|
136
|
+
}
|
|
127
137
|
// Check for known non-repositories
|
|
128
138
|
const dirName = (0, path_1.dirname)(fileName);
|
|
129
139
|
const segments = dirName.split("/");
|
|
@@ -139,7 +149,7 @@ let SourcePlugin = class SourcePlugin extends components_1.ConverterComponent {
|
|
|
139
149
|
}
|
|
140
150
|
}
|
|
141
151
|
// Try to create a new repository
|
|
142
|
-
const repository = repository_1.
|
|
152
|
+
const repository = repository_1.GitRepository.tryCreateRepository(dirName, this.sourceLinkTemplate, this.gitRevision, this.gitRemote, this.application.logger);
|
|
143
153
|
if (repository) {
|
|
144
154
|
this.repositories[repository.path.toLowerCase()] = repository;
|
|
145
155
|
return repository;
|
|
@@ -148,6 +158,7 @@ let SourcePlugin = class SourcePlugin extends components_1.ConverterComponent {
|
|
|
148
158
|
this.ignoredPaths.add(dirName);
|
|
149
159
|
}
|
|
150
160
|
};
|
|
161
|
+
exports.SourcePlugin = SourcePlugin;
|
|
151
162
|
__decorate([
|
|
152
163
|
(0, utils_1.BindOption)("disableSources")
|
|
153
164
|
], SourcePlugin.prototype, "disableSources", void 0);
|
|
@@ -157,13 +168,20 @@ __decorate([
|
|
|
157
168
|
__decorate([
|
|
158
169
|
(0, utils_1.BindOption)("gitRemote")
|
|
159
170
|
], SourcePlugin.prototype, "gitRemote", void 0);
|
|
171
|
+
__decorate([
|
|
172
|
+
(0, utils_1.BindOption)("disableGit")
|
|
173
|
+
], SourcePlugin.prototype, "disableGit", void 0);
|
|
160
174
|
__decorate([
|
|
161
175
|
(0, utils_1.BindOption)("sourceLinkTemplate")
|
|
162
176
|
], SourcePlugin.prototype, "sourceLinkTemplate", void 0);
|
|
163
177
|
__decorate([
|
|
164
178
|
(0, utils_1.BindOption)("basePath")
|
|
165
179
|
], SourcePlugin.prototype, "basePath", void 0);
|
|
166
|
-
SourcePlugin = __decorate([
|
|
180
|
+
exports.SourcePlugin = SourcePlugin = __decorate([
|
|
167
181
|
(0, components_1.Component)({ name: "source" })
|
|
168
182
|
], SourcePlugin);
|
|
169
|
-
|
|
183
|
+
function getLocationNode(node) {
|
|
184
|
+
if ((0, nodes_1.isNamedNode)(node))
|
|
185
|
+
return node.name;
|
|
186
|
+
return node;
|
|
187
|
+
}
|
|
@@ -34,8 +34,9 @@ let TypePlugin = class TypePlugin extends components_1.ConverterComponent {
|
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
onRevive(project) {
|
|
37
|
-
for (const
|
|
38
|
-
this.resolve(project,
|
|
37
|
+
for (const id in project.reflections) {
|
|
38
|
+
this.resolve(project, project.reflections[id],
|
|
39
|
+
/* create links */ false);
|
|
39
40
|
}
|
|
40
41
|
this.finishResolve(project);
|
|
41
42
|
this.reflections.clear();
|
|
@@ -43,24 +44,24 @@ let TypePlugin = class TypePlugin extends components_1.ConverterComponent {
|
|
|
43
44
|
onResolve(context, reflection) {
|
|
44
45
|
this.resolve(context.project, reflection);
|
|
45
46
|
}
|
|
46
|
-
resolve(project, reflection) {
|
|
47
|
+
resolve(project, reflection, createLinks = true) {
|
|
47
48
|
if (!(reflection instanceof index_1.DeclarationReflection))
|
|
48
49
|
return;
|
|
49
50
|
if (reflection.kindOf(index_1.ReflectionKind.ClassOrInterface)) {
|
|
50
51
|
this.postpone(reflection);
|
|
51
52
|
walk(reflection.implementedTypes, (target) => {
|
|
52
53
|
this.postpone(target);
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
target.implementedBy || (target.implementedBy = []);
|
|
55
|
+
if (createLinks) {
|
|
56
|
+
target.implementedBy.push(types_1.ReferenceType.createResolvedReference(reflection.name, reflection, project));
|
|
55
57
|
}
|
|
56
|
-
target.implementedBy.push(types_1.ReferenceType.createResolvedReference(reflection.name, reflection, project));
|
|
57
58
|
});
|
|
58
59
|
walk(reflection.extendedTypes, (target) => {
|
|
59
60
|
this.postpone(target);
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
target.extendedBy || (target.extendedBy = []);
|
|
62
|
+
if (createLinks) {
|
|
63
|
+
target.extendedBy.push(types_1.ReferenceType.createResolvedReference(reflection.name, reflection, project));
|
|
62
64
|
}
|
|
63
|
-
target.extendedBy.push(types_1.ReferenceType.createResolvedReference(reflection.name, reflection, project));
|
|
64
65
|
});
|
|
65
66
|
}
|
|
66
67
|
function walk(types, callback) {
|
|
@@ -121,7 +122,7 @@ let TypePlugin = class TypePlugin extends components_1.ConverterComponent {
|
|
|
121
122
|
});
|
|
122
123
|
}
|
|
123
124
|
};
|
|
124
|
-
TypePlugin =
|
|
125
|
+
exports.TypePlugin = TypePlugin;
|
|
126
|
+
exports.TypePlugin = TypePlugin = __decorate([
|
|
125
127
|
(0, components_1.Component)({ name: "type" })
|
|
126
128
|
], TypePlugin);
|
|
127
|
-
exports.TypePlugin = TypePlugin;
|
|
@@ -176,8 +176,16 @@ function convertNamespace(context, symbol, exportSymbol) {
|
|
|
176
176
|
return;
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
-
|
|
180
|
-
context.
|
|
179
|
+
// #2364, @namespace on a variable might be merged with a namespace containing types.
|
|
180
|
+
const existingReflection = context.project.getReflectionFromSymbol(exportSymbol || symbol);
|
|
181
|
+
let reflection;
|
|
182
|
+
if (existingReflection?.kind === models_1.ReflectionKind.Namespace) {
|
|
183
|
+
reflection = existingReflection;
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
reflection = context.createDeclarationReflection(models_1.ReflectionKind.Namespace, symbol, exportSymbol);
|
|
187
|
+
context.finalizeDeclarationReflection(reflection);
|
|
188
|
+
}
|
|
181
189
|
convertSymbols(context.withScope(reflection), context.checker
|
|
182
190
|
.getExportsOfModule(symbol)
|
|
183
191
|
.filter((s) => s.flags & exportFlags));
|
|
@@ -216,6 +224,9 @@ function convertTypeAliasAsInterface(context, symbol, exportSymbol, declaration)
|
|
|
216
224
|
context.finalizeDeclarationReflection(reflection);
|
|
217
225
|
const rc = context.withScope(reflection);
|
|
218
226
|
const type = context.checker.getTypeAtLocation(declaration);
|
|
227
|
+
if (type.getFlags() & typescript_1.default.TypeFlags.Union) {
|
|
228
|
+
context.logger.warn(`Using @interface on a union type will discard properties not present on all branches of the union. TypeDoc's output may not accurately describe your source code.`, declaration);
|
|
229
|
+
}
|
|
219
230
|
// Interfaces have properties
|
|
220
231
|
convertSymbols(rc, type.getProperties());
|
|
221
232
|
// And type arguments
|
|
@@ -511,7 +522,8 @@ function convertVariableAsNamespace(context, symbol, exportSymbol) {
|
|
|
511
522
|
const reflection = context.createDeclarationReflection(models_1.ReflectionKind.Namespace, symbol, exportSymbol);
|
|
512
523
|
context.finalizeDeclarationReflection(reflection);
|
|
513
524
|
const rc = context.withScope(reflection);
|
|
514
|
-
const declaration = symbol.declarations
|
|
525
|
+
const declaration = symbol.declarations?.find(typescript_1.default.isVariableDeclaration);
|
|
526
|
+
(0, assert_1.default)(declaration, "Missing variable declaration");
|
|
515
527
|
const type = context.checker.getTypeAtLocation(declaration);
|
|
516
528
|
convertSymbols(rc, type.getProperties());
|
|
517
529
|
return typescript_1.default.SymbolFlags.Property;
|
|
@@ -561,7 +561,12 @@ const tupleConverter = {
|
|
|
561
561
|
let elements = types?.map((type) => convertType(context, type));
|
|
562
562
|
if (type.target.labeledElementDeclarations) {
|
|
563
563
|
const namedDeclarations = type.target.labeledElementDeclarations;
|
|
564
|
-
elements = elements?.map((el, i) =>
|
|
564
|
+
elements = elements?.map((el, i) => {
|
|
565
|
+
const namedDecl = namedDeclarations[i];
|
|
566
|
+
return namedDecl
|
|
567
|
+
? new models_1.NamedTupleMember(namedDecl.name.getText(), !!namedDecl.questionToken, (0, reflections_1.removeUndefined)(el))
|
|
568
|
+
: el;
|
|
569
|
+
});
|
|
565
570
|
}
|
|
566
571
|
elements = elements?.map((el, i) => {
|
|
567
572
|
if (type.target.elementFlags[i] & typescript_1.default.ElementFlags.Variable) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
|
-
export declare function isNamedNode(node:
|
|
3
|
-
name: ts.Identifier | ts.PrivateIdentifier | ts.ComputedPropertyName;
|
|
2
|
+
export declare function isNamedNode(node: unknown): node is {
|
|
3
|
+
readonly name: ts.Identifier | ts.PrivateIdentifier | ts.ComputedPropertyName;
|
|
4
4
|
};
|
|
5
5
|
export declare function getHeritageTypes(declarations: readonly (ts.ClassDeclaration | ts.InterfaceDeclaration)[], kind: ts.SyntaxKind.ImplementsKeyword | ts.SyntaxKind.ExtendsKeyword): ts.ExpressionWithTypeArguments[];
|
|
6
6
|
export declare function isObjectType(type: ts.Type): type is ts.ObjectType;
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import type { Logger } from "../../utils";
|
|
2
|
-
export declare
|
|
2
|
+
export declare function gitIsInstalled(): boolean;
|
|
3
|
+
export interface Repository {
|
|
4
|
+
getURL(fileName: string, line: number): string | undefined;
|
|
5
|
+
}
|
|
6
|
+
export declare class AssumedRepository implements Repository {
|
|
7
|
+
readonly path: string;
|
|
8
|
+
readonly gitRevision: string;
|
|
9
|
+
readonly sourceLinkTemplate: string;
|
|
10
|
+
constructor(path: string, gitRevision: string, sourceLinkTemplate: string);
|
|
11
|
+
getURL(fileName: string, line: number): string | undefined;
|
|
12
|
+
}
|
|
3
13
|
/**
|
|
4
14
|
* Stores data of a repository.
|
|
5
15
|
*/
|
|
6
|
-
export declare class Repository {
|
|
16
|
+
export declare class GitRepository implements Repository {
|
|
7
17
|
/**
|
|
8
18
|
* The path of this repository on disk.
|
|
9
19
|
*/
|
|
@@ -31,11 +41,11 @@ export declare class Repository {
|
|
|
31
41
|
* Try to create a new repository instance.
|
|
32
42
|
*
|
|
33
43
|
* Checks whether the given path is the root of a valid repository and if so
|
|
34
|
-
* creates a new instance of {@link
|
|
44
|
+
* creates a new instance of {@link GitRepository}.
|
|
35
45
|
*
|
|
36
46
|
* @param path The potential repository root.
|
|
37
|
-
* @returns A new instance of {@link
|
|
47
|
+
* @returns A new instance of {@link GitRepository} or undefined.
|
|
38
48
|
*/
|
|
39
|
-
static tryCreateRepository(path: string, sourceLinkTemplate: string, gitRevision: string, gitRemote: string, logger: Logger):
|
|
49
|
+
static tryCreateRepository(path: string, sourceLinkTemplate: string, gitRevision: string, gitRemote: string, logger: Logger): GitRepository | undefined;
|
|
40
50
|
}
|
|
41
51
|
export declare function guessSourceUrlTemplate(remotes: string[]): string | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.guessSourceUrlTemplate = exports.
|
|
3
|
+
exports.guessSourceUrlTemplate = exports.GitRepository = exports.AssumedRepository = exports.gitIsInstalled = void 0;
|
|
4
4
|
const child_process_1 = require("child_process");
|
|
5
5
|
const base_path_1 = require("../utils/base-path");
|
|
6
6
|
const TEN_MEGABYTES = 1024 * 10000;
|
|
@@ -11,11 +11,32 @@ function git(...args) {
|
|
|
11
11
|
maxBuffer: TEN_MEGABYTES,
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
let haveGit;
|
|
15
|
+
function gitIsInstalled() {
|
|
16
|
+
haveGit ?? (haveGit = git("--version").status === 0);
|
|
17
|
+
return haveGit;
|
|
18
|
+
}
|
|
19
|
+
exports.gitIsInstalled = gitIsInstalled;
|
|
20
|
+
class AssumedRepository {
|
|
21
|
+
constructor(path, gitRevision, sourceLinkTemplate) {
|
|
22
|
+
this.path = path;
|
|
23
|
+
this.gitRevision = gitRevision;
|
|
24
|
+
this.sourceLinkTemplate = sourceLinkTemplate;
|
|
25
|
+
}
|
|
26
|
+
getURL(fileName, line) {
|
|
27
|
+
const replacements = {
|
|
28
|
+
gitRevision: this.gitRevision,
|
|
29
|
+
path: fileName.substring(this.path.length + 1),
|
|
30
|
+
line,
|
|
31
|
+
};
|
|
32
|
+
return this.sourceLinkTemplate.replace(/\{(path|line)\}/g, (_, key) => replacements[key]);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.AssumedRepository = AssumedRepository;
|
|
15
36
|
/**
|
|
16
37
|
* Stores data of a repository.
|
|
17
38
|
*/
|
|
18
|
-
class
|
|
39
|
+
class GitRepository {
|
|
19
40
|
/**
|
|
20
41
|
* Create a new Repository instance.
|
|
21
42
|
*
|
|
@@ -59,10 +80,10 @@ class Repository {
|
|
|
59
80
|
* Try to create a new repository instance.
|
|
60
81
|
*
|
|
61
82
|
* Checks whether the given path is the root of a valid repository and if so
|
|
62
|
-
* creates a new instance of {@link
|
|
83
|
+
* creates a new instance of {@link GitRepository}.
|
|
63
84
|
*
|
|
64
85
|
* @param path The potential repository root.
|
|
65
|
-
* @returns A new instance of {@link
|
|
86
|
+
* @returns A new instance of {@link GitRepository} or undefined.
|
|
66
87
|
*/
|
|
67
88
|
static tryCreateRepository(path, sourceLinkTemplate, gitRevision, gitRemote, logger) {
|
|
68
89
|
const topLevel = git("-C", path, "rev-parse", "--show-toplevel");
|
|
@@ -75,10 +96,6 @@ class Repository {
|
|
|
75
96
|
if (sourceLinkTemplate) {
|
|
76
97
|
urlTemplate = sourceLinkTemplate;
|
|
77
98
|
}
|
|
78
|
-
else if (/^https?:\/\//.test(gitRemote)) {
|
|
79
|
-
logger.warn("Using a link as the gitRemote is deprecated and will be removed in 0.24.");
|
|
80
|
-
urlTemplate = `${gitRemote}/{gitRevision}`;
|
|
81
|
-
}
|
|
82
99
|
else {
|
|
83
100
|
const remotesOut = git("-C", path, "remote", "get-url", gitRemote);
|
|
84
101
|
if (remotesOut.status === 0) {
|
|
@@ -90,10 +107,10 @@ class Repository {
|
|
|
90
107
|
}
|
|
91
108
|
if (!urlTemplate)
|
|
92
109
|
return;
|
|
93
|
-
return new
|
|
110
|
+
return new GitRepository(base_path_1.BasePath.normalize(topLevel.stdout.replace("\n", "")), gitRevision, urlTemplate);
|
|
94
111
|
}
|
|
95
112
|
}
|
|
96
|
-
exports.
|
|
113
|
+
exports.GitRepository = GitRepository;
|
|
97
114
|
// Should have three capturing groups:
|
|
98
115
|
// 1. hostname
|
|
99
116
|
// 2. user
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReflectionCategory } from "./ReflectionCategory";
|
|
2
|
-
import type { DeclarationReflection } from ".";
|
|
2
|
+
import type { DeclarationReflection, Reflection } from ".";
|
|
3
3
|
import type { Serializer, JSONOutput, Deserializer } from "../serialization";
|
|
4
4
|
/**
|
|
5
5
|
* A group of reflections. All reflections in a group are of the same kind.
|
|
@@ -9,6 +9,7 @@ import type { Serializer, JSONOutput, Deserializer } from "../serialization";
|
|
|
9
9
|
* render human readable children lists in templates.
|
|
10
10
|
*/
|
|
11
11
|
export declare class ReflectionGroup {
|
|
12
|
+
readonly owningReflection: Reflection;
|
|
12
13
|
/**
|
|
13
14
|
* The title, a string representation of the typescript kind, of this group.
|
|
14
15
|
*/
|
|
@@ -25,8 +26,9 @@ export declare class ReflectionGroup {
|
|
|
25
26
|
* Create a new ReflectionGroup instance.
|
|
26
27
|
*
|
|
27
28
|
* @param title The title of this group.
|
|
29
|
+
* @param owningReflection The reflection containing this group, useful for changing rendering based on a comment on a reflection.
|
|
28
30
|
*/
|
|
29
|
-
constructor(title: string);
|
|
31
|
+
constructor(title: string, owningReflection: Reflection);
|
|
30
32
|
/**
|
|
31
33
|
* Do all children of this group have a separate document?
|
|
32
34
|
*/
|
|
@@ -14,8 +14,10 @@ class ReflectionGroup {
|
|
|
14
14
|
* Create a new ReflectionGroup instance.
|
|
15
15
|
*
|
|
16
16
|
* @param title The title of this group.
|
|
17
|
+
* @param owningReflection The reflection containing this group, useful for changing rendering based on a comment on a reflection.
|
|
17
18
|
*/
|
|
18
|
-
constructor(title) {
|
|
19
|
+
constructor(title, owningReflection) {
|
|
20
|
+
this.owningReflection = owningReflection;
|
|
19
21
|
/**
|
|
20
22
|
* All reflections of this group.
|
|
21
23
|
*/
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { Reflection } from "../reflections";
|
|
2
2
|
import { ReflectionSymbolId } from "../reflections/ReflectionSymbolId";
|
|
3
3
|
import type { Serializer, Deserializer, JSONOutput } from "../../serialization";
|
|
4
|
+
/**
|
|
5
|
+
* Represents a parsed piece of a comment.
|
|
6
|
+
* @category Comments
|
|
7
|
+
*/
|
|
4
8
|
export type CommentDisplayPart = {
|
|
5
9
|
kind: "text";
|
|
6
10
|
text: string;
|
|
@@ -13,6 +17,7 @@ export type CommentDisplayPart = {
|
|
|
13
17
|
* property set indicating which reflection/url they link to. They may also
|
|
14
18
|
* have a `tsLinkText` property which includes the part of the `text` which
|
|
15
19
|
* TypeScript thinks should be displayed as the link text.
|
|
20
|
+
* @category Comments
|
|
16
21
|
*/
|
|
17
22
|
export interface InlineTagDisplayPart {
|
|
18
23
|
kind: "inline-tag";
|
|
@@ -25,6 +30,7 @@ export interface InlineTagDisplayPart {
|
|
|
25
30
|
* A model that represents a single TypeDoc comment tag.
|
|
26
31
|
*
|
|
27
32
|
* Tags are stored in the {@link Comment.blockTags} property.
|
|
33
|
+
* @category Comments
|
|
28
34
|
*/
|
|
29
35
|
export declare class CommentTag {
|
|
30
36
|
/**
|
|
@@ -53,6 +59,7 @@ export declare class CommentTag {
|
|
|
53
59
|
*
|
|
54
60
|
* Instances of this model are created by the CommentPlugin. You can retrieve comments
|
|
55
61
|
* through the {@link DeclarationReflection.comment} property.
|
|
62
|
+
* @category Comments
|
|
56
63
|
*/
|
|
57
64
|
export declare class Comment {
|
|
58
65
|
/**
|
|
@@ -97,7 +104,7 @@ export declare class Comment {
|
|
|
97
104
|
/**
|
|
98
105
|
* All modifier tags present on the comment, e.g. `@alpha`, `@beta`.
|
|
99
106
|
*/
|
|
100
|
-
modifierTags: Set
|
|
107
|
+
modifierTags: Set<`@${string}`>;
|
|
101
108
|
/**
|
|
102
109
|
* Label associated with this reflection, if any (https://tsdoc.org/pages/tags/label/)
|
|
103
110
|
*/
|
|
@@ -105,7 +112,7 @@ export declare class Comment {
|
|
|
105
112
|
/**
|
|
106
113
|
* Creates a new Comment instance.
|
|
107
114
|
*/
|
|
108
|
-
constructor(summary?: CommentDisplayPart[], blockTags?: CommentTag[], modifierTags?: Set
|
|
115
|
+
constructor(summary?: CommentDisplayPart[], blockTags?: CommentTag[], modifierTags?: Set<`@${string}`>);
|
|
109
116
|
/**
|
|
110
117
|
* Create a deep clone of this comment.
|
|
111
118
|
*/
|
|
@@ -8,6 +8,7 @@ const ReflectionSymbolId_1 = require("../reflections/ReflectionSymbolId");
|
|
|
8
8
|
* A model that represents a single TypeDoc comment tag.
|
|
9
9
|
*
|
|
10
10
|
* Tags are stored in the {@link Comment.blockTags} property.
|
|
11
|
+
* @category Comments
|
|
11
12
|
*/
|
|
12
13
|
class CommentTag {
|
|
13
14
|
/**
|
|
@@ -43,6 +44,7 @@ exports.CommentTag = CommentTag;
|
|
|
43
44
|
*
|
|
44
45
|
* Instances of this model are created by the CommentPlugin. You can retrieve comments
|
|
45
46
|
* through the {@link DeclarationReflection.comment} property.
|
|
47
|
+
* @category Comments
|
|
46
48
|
*/
|
|
47
49
|
class Comment {
|
|
48
50
|
/**
|
|
@@ -100,6 +100,7 @@ export interface TraverseCallback {
|
|
|
100
100
|
* This base class exposes the basic properties one may use to traverse the reflection tree.
|
|
101
101
|
* You can use the {@link ContainerReflection.children} and {@link parent} properties to walk the tree. The {@link ContainerReflection.groups} property
|
|
102
102
|
* contains a list of all children grouped and sorted for rendering.
|
|
103
|
+
* @category Reflections
|
|
103
104
|
*/
|
|
104
105
|
export declare abstract class Reflection {
|
|
105
106
|
/**
|
|
@@ -207,7 +208,7 @@ export declare abstract class Reflection {
|
|
|
207
208
|
* Traverse most potential child reflections of this reflection.
|
|
208
209
|
*
|
|
209
210
|
* Note: This may not necessarily traverse child reflections contained within the `type` property
|
|
210
|
-
* of the reflection, and should not be relied on for this. Support for checking object types will likely be removed in v0.
|
|
211
|
+
* of the reflection, and should not be relied on for this. Support for checking object types will likely be removed in v0.26.
|
|
211
212
|
*
|
|
212
213
|
* The given callback will be invoked for all children, signatures and type parameters
|
|
213
214
|
* attached to this reflection.
|