typedoc 0.23.5 → 0.23.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/converter/comments/blockLexer.js +2 -1
- package/dist/lib/converter/comments/lineLexer.js +2 -1
- package/dist/lib/converter/comments/rawLexer.js +2 -1
- package/dist/lib/converter/converter.d.ts +7 -1
- package/dist/lib/converter/converter.js +27 -3
- package/dist/lib/converter/factories/signature.js +1 -1
- package/dist/lib/converter/plugins/CommentPlugin.js +14 -5
- package/dist/lib/converter/plugins/LinkResolverPlugin.js +21 -3
- package/dist/lib/converter/plugins/PackagePlugin.d.ts +2 -0
- package/dist/lib/converter/plugins/PackagePlugin.js +14 -5
- package/dist/lib/converter/plugins/SourcePlugin.d.ts +1 -0
- package/dist/lib/converter/plugins/SourcePlugin.js +11 -1
- package/dist/lib/converter/utils/repository.js +9 -1
- package/dist/lib/models/reflections/declaration.d.ts +9 -0
- package/dist/lib/models/reflections/kind.d.ts +5 -0
- package/dist/lib/models/reflections/kind.js +5 -0
- package/dist/lib/output/themes/default/DefaultTheme.js +5 -0
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +3 -0
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +3 -0
- package/dist/lib/output/themes/default/partials/header.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/header.js +5 -1
- package/dist/lib/output/themes/default/partials/index.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/index.js +9 -2
- package/dist/lib/output/themes/default/partials/member.getterSetter.js +18 -17
- package/dist/lib/output/themes/default/partials/member.signature.title.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/member.signature.title.js +2 -1
- package/dist/lib/output/themes/default/partials/member.signatures.js +6 -2
- package/dist/lib/output/themes/default/partials/navigation.d.ts +3 -0
- package/dist/lib/output/themes/default/partials/navigation.js +8 -5
- package/dist/lib/output/themes/default/partials/parameter.js +7 -6
- package/dist/lib/output/themes/default/templates/reflection.js +2 -1
- package/dist/lib/utils/entry-point.d.ts +2 -0
- package/dist/lib/utils/entry-point.js +16 -1
- package/dist/lib/utils/loggers.js +8 -6
- package/dist/lib/utils/package-manifest.d.ts +13 -0
- package/dist/lib/utils/package-manifest.js +34 -2
- package/package.json +1 -1
- package/static/main.js +3 -3
- package/static/style.css +6 -82
|
@@ -168,7 +168,8 @@ function* lexBlockComment2(file, pos, end) {
|
|
|
168
168
|
lookahead++;
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
-
if (lookahead !== pos + 1
|
|
171
|
+
if (lookahead !== pos + 1 &&
|
|
172
|
+
(lookahead === end || /\s/.test(file[lookahead]))) {
|
|
172
173
|
braceStartsType = true;
|
|
173
174
|
yield makeToken(lexer_1.TokenSyntaxKind.Tag, lookahead - pos);
|
|
174
175
|
break;
|
|
@@ -137,7 +137,8 @@ function* lexLineComments2(file, pos, end) {
|
|
|
137
137
|
lookahead++;
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
-
if (lookahead !== pos + 1
|
|
140
|
+
if (lookahead !== pos + 1 &&
|
|
141
|
+
(lookahead === end || /\s/.test(file[lookahead]))) {
|
|
141
142
|
braceStartsType = true;
|
|
142
143
|
yield makeToken(lexer_1.TokenSyntaxKind.Tag, lookahead - pos);
|
|
143
144
|
break;
|
|
@@ -141,7 +141,8 @@ function* lexCommentString2(file) {
|
|
|
141
141
|
lookahead++;
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
if (lookahead !== pos + 1
|
|
144
|
+
if (lookahead !== pos + 1 &&
|
|
145
|
+
(lookahead === end || /\s/.test(file[lookahead]))) {
|
|
145
146
|
braceStartsType = true;
|
|
146
147
|
yield makeToken(lexer_1.TokenSyntaxKind.Tag, lookahead - pos);
|
|
147
148
|
break;
|
|
@@ -4,6 +4,7 @@ import { ProjectReflection, SomeType } from "../models/index";
|
|
|
4
4
|
import { Context } from "./context";
|
|
5
5
|
import { ConverterComponent } from "./components";
|
|
6
6
|
import { ChildableComponent } from "../utils/component";
|
|
7
|
+
import { MinimalSourceFile } from "../utils";
|
|
7
8
|
import type { DocumentationEntryPoint } from "../utils/entry-point";
|
|
8
9
|
import { CommentParserConfig } from "./comments";
|
|
9
10
|
import type { CommentStyle } from "../utils/options/declaration";
|
|
@@ -51,7 +52,8 @@ export declare class Converter extends ChildableComponent<Application, Converter
|
|
|
51
52
|
static readonly EVENT_CREATE_DECLARATION: "createDeclaration";
|
|
52
53
|
/**
|
|
53
54
|
* Triggered when the converter has created a signature reflection.
|
|
54
|
-
* The listener will be given {@link Context}, {@link SignatureReflection} | {@link ProjectReflection} and
|
|
55
|
+
* The listener will be given {@link Context}, {@link SignatureReflection} | {@link ProjectReflection} and
|
|
56
|
+
* `ts.SignatureDeclaration | ts.IndexSignatureDeclaration | ts.JSDocSignature | undefined`
|
|
55
57
|
* @event
|
|
56
58
|
*/
|
|
57
59
|
static readonly EVENT_CREATE_SIGNATURE: "createSignature";
|
|
@@ -103,6 +105,10 @@ export declare class Converter extends ChildableComponent<Application, Converter
|
|
|
103
105
|
* @internal
|
|
104
106
|
*/
|
|
105
107
|
convertType(context: Context, node: ts.TypeNode | ts.Type | undefined): SomeType;
|
|
108
|
+
/**
|
|
109
|
+
* Parse the given file into a comment. Intended to be used with markdown files.
|
|
110
|
+
*/
|
|
111
|
+
parseRawComment(file: MinimalSourceFile): import("../models/index").Comment;
|
|
106
112
|
/**
|
|
107
113
|
* Compile the files within the given context and convert the compiler symbols to reflections.
|
|
108
114
|
*
|
|
@@ -20,6 +20,8 @@ const symbols_1 = require("./symbols");
|
|
|
20
20
|
const paths_1 = require("../utils/paths");
|
|
21
21
|
const enum_1 = require("../utils/enum");
|
|
22
22
|
const comments_1 = require("./comments");
|
|
23
|
+
const parser_1 = require("./comments/parser");
|
|
24
|
+
const rawLexer_1 = require("./comments/rawLexer");
|
|
23
25
|
/**
|
|
24
26
|
* Compiles source files using TypeScript and converts compiler symbols to reflections.
|
|
25
27
|
*/
|
|
@@ -58,6 +60,12 @@ let Converter = Converter_1 = class Converter extends component_1.ChildableCompo
|
|
|
58
60
|
convertType(context, node) {
|
|
59
61
|
return (0, types_1.convertType)(context, node);
|
|
60
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Parse the given file into a comment. Intended to be used with markdown files.
|
|
65
|
+
*/
|
|
66
|
+
parseRawComment(file) {
|
|
67
|
+
return (0, parser_1.parseComment)((0, rawLexer_1.lexCommentString)(file.text), this.config, file, this.application.logger);
|
|
68
|
+
}
|
|
61
69
|
/**
|
|
62
70
|
* Compile the files within the given context and convert the compiler symbols to reflections.
|
|
63
71
|
*
|
|
@@ -73,7 +81,7 @@ let Converter = Converter_1 = class Converter extends component_1.ChildableCompo
|
|
|
73
81
|
});
|
|
74
82
|
entries.forEach((e) => {
|
|
75
83
|
context.setActiveProgram(e.entryPoint.program);
|
|
76
|
-
e.context = this.convertExports(context, e.entryPoint
|
|
84
|
+
e.context = this.convertExports(context, e.entryPoint, entries.length === 1);
|
|
77
85
|
});
|
|
78
86
|
for (const { entryPoint, context } of entries) {
|
|
79
87
|
// active program is already set on context
|
|
@@ -84,7 +92,9 @@ let Converter = Converter_1 = class Converter extends component_1.ChildableCompo
|
|
|
84
92
|
}
|
|
85
93
|
context.setActiveProgram(undefined);
|
|
86
94
|
}
|
|
87
|
-
convertExports(context,
|
|
95
|
+
convertExports(context, entryPoint, singleEntryPoint) {
|
|
96
|
+
const node = entryPoint.sourceFile;
|
|
97
|
+
const entryName = entryPoint.displayName;
|
|
88
98
|
const symbol = getSymbolForModuleLike(context, node);
|
|
89
99
|
let moduleContext;
|
|
90
100
|
const allExports = getExports(context, node, symbol);
|
|
@@ -104,6 +114,19 @@ let Converter = Converter_1 = class Converter extends component_1.ChildableCompo
|
|
|
104
114
|
}
|
|
105
115
|
else {
|
|
106
116
|
const reflection = context.createDeclarationReflection(index_1.ReflectionKind.Module, symbol, void 0, entryName);
|
|
117
|
+
if (entryPoint.readmeFile) {
|
|
118
|
+
const readme = (0, utils_1.readFile)(entryPoint.readmeFile);
|
|
119
|
+
const comment = this.parseRawComment(new utils_1.MinimalSourceFile(readme, entryPoint.readmeFile));
|
|
120
|
+
if (comment.blockTags.length || comment.modifierTags.size) {
|
|
121
|
+
const ignored = [
|
|
122
|
+
...comment.blockTags.map((tag) => tag.tag),
|
|
123
|
+
...comment.modifierTags,
|
|
124
|
+
];
|
|
125
|
+
context.logger.warn(`Block and modifier tags will be ignored within the readme:\n\t${ignored.join("\n\t")}`);
|
|
126
|
+
}
|
|
127
|
+
reflection.readme = comment.summary;
|
|
128
|
+
}
|
|
129
|
+
reflection.version = entryPoint.version;
|
|
107
130
|
context.finalizeDeclarationReflection(reflection);
|
|
108
131
|
moduleContext = context.withScope(reflection);
|
|
109
132
|
}
|
|
@@ -189,7 +212,8 @@ Converter.EVENT_END = converter_events_1.ConverterEvents.END;
|
|
|
189
212
|
Converter.EVENT_CREATE_DECLARATION = converter_events_1.ConverterEvents.CREATE_DECLARATION;
|
|
190
213
|
/**
|
|
191
214
|
* Triggered when the converter has created a signature reflection.
|
|
192
|
-
* The listener will be given {@link Context}, {@link SignatureReflection} | {@link ProjectReflection} and
|
|
215
|
+
* The listener will be given {@link Context}, {@link SignatureReflection} | {@link ProjectReflection} and
|
|
216
|
+
* `ts.SignatureDeclaration | ts.IndexSignatureDeclaration | ts.JSDocSignature | undefined`
|
|
193
217
|
* @event
|
|
194
218
|
*/
|
|
195
219
|
Converter.EVENT_CREATE_SIGNATURE = converter_events_1.ConverterEvents.CREATE_SIGNATURE;
|
|
@@ -49,7 +49,7 @@ function createSignature(context, kind, signature, declaration) {
|
|
|
49
49
|
context.scope.signatures.push(sigRef);
|
|
50
50
|
break;
|
|
51
51
|
}
|
|
52
|
-
context.trigger(converter_events_1.ConverterEvents.CREATE_SIGNATURE, sigRef);
|
|
52
|
+
context.trigger(converter_events_1.ConverterEvents.CREATE_SIGNATURE, sigRef, declaration);
|
|
53
53
|
}
|
|
54
54
|
exports.createSignature = createSignature;
|
|
55
55
|
function convertParameters(context, sigRef, parameters, parameterNodes) {
|
|
@@ -174,14 +174,16 @@ let CommentPlugin = class CommentPlugin extends components_1.ConverterComponent
|
|
|
174
174
|
}
|
|
175
175
|
hidden.forEach((reflection) => project.removeReflection(reflection));
|
|
176
176
|
// remove functions with empty signatures after their signatures have been removed
|
|
177
|
-
const [allRemoved, someRemoved] = (0, utils_1.partition)((0, utils_1.filterMap)(hidden, (reflection) => reflection.parent?.kindOf(models_1.ReflectionKind.
|
|
177
|
+
const [allRemoved, someRemoved] = (0, utils_1.partition)((0, utils_1.unique)((0, utils_1.filterMap)(hidden, (reflection) => reflection.parent?.kindOf(models_1.ReflectionKind.SignatureContainer)
|
|
178
178
|
? reflection.parent
|
|
179
|
-
: void 0), (method) => method.
|
|
179
|
+
: void 0)), (method) => method.getNonIndexSignatures().length === 0);
|
|
180
180
|
allRemoved.forEach((reflection) => {
|
|
181
181
|
project.removeReflection(reflection);
|
|
182
182
|
});
|
|
183
183
|
someRemoved.forEach((reflection) => {
|
|
184
|
-
reflection.sources =
|
|
184
|
+
reflection.sources = reflection
|
|
185
|
+
.getNonIndexSignatures()
|
|
186
|
+
.flatMap((s) => s.sources ?? []);
|
|
185
187
|
});
|
|
186
188
|
}
|
|
187
189
|
/**
|
|
@@ -282,8 +284,9 @@ let CommentPlugin = class CommentPlugin extends components_1.ConverterComponent
|
|
|
282
284
|
}
|
|
283
285
|
if (!comment) {
|
|
284
286
|
if (this.excludeNotDocumented) {
|
|
285
|
-
//
|
|
286
|
-
if (!(reflection instanceof models_1.DeclarationReflection)
|
|
287
|
+
// Don't let excludeNotDocumented remove parameters.
|
|
288
|
+
if (!(reflection instanceof models_1.DeclarationReflection) &&
|
|
289
|
+
!(reflection instanceof models_1.SignatureReflection)) {
|
|
287
290
|
return false;
|
|
288
291
|
}
|
|
289
292
|
// excludeNotDocumented should hide a module only if it has no visible children
|
|
@@ -297,6 +300,12 @@ let CommentPlugin = class CommentPlugin extends components_1.ConverterComponent
|
|
|
297
300
|
if (reflection.kind === models_1.ReflectionKind.EnumMember) {
|
|
298
301
|
return false;
|
|
299
302
|
}
|
|
303
|
+
// signature containers should only be hidden if all their signatures are hidden
|
|
304
|
+
if (reflection.kindOf(models_1.ReflectionKind.SignatureContainer)) {
|
|
305
|
+
return reflection
|
|
306
|
+
.getAllSignatures()
|
|
307
|
+
.every((child) => this.isHidden(child));
|
|
308
|
+
}
|
|
300
309
|
// excludeNotDocumented should never hide parts of "type" reflections
|
|
301
310
|
return inTypeLiteral(reflection) === false;
|
|
302
311
|
}
|
|
@@ -14,8 +14,9 @@ const declarationReference_1 = require("../comments/declarationReference");
|
|
|
14
14
|
const ts = require("typescript");
|
|
15
15
|
const utils_1 = require("../../utils");
|
|
16
16
|
const declarationReferenceResolver_1 = require("../comments/declarationReferenceResolver");
|
|
17
|
+
const models_1 = require("../../models");
|
|
17
18
|
const urlPrefix = /^(http|ftp)s?:\/\//;
|
|
18
|
-
const brackets = /\[\[([^\]]+)\]\]/g;
|
|
19
|
+
const brackets = /\[\[(?!include:)([^\]]+)\]\]/g;
|
|
19
20
|
/**
|
|
20
21
|
* A plugin that resolves `{@link Foo}` tags.
|
|
21
22
|
*/
|
|
@@ -113,6 +114,9 @@ let LinkResolverPlugin = LinkResolverPlugin_1 = class LinkResolverPlugin extends
|
|
|
113
114
|
for (const tag of comment.blockTags) {
|
|
114
115
|
tag.content = this.processParts(reflection, tag.content, warn);
|
|
115
116
|
}
|
|
117
|
+
if (reflection instanceof models_1.DeclarationReflection && reflection.readme) {
|
|
118
|
+
reflection.readme = this.processParts(reflection, reflection.readme, warn);
|
|
119
|
+
}
|
|
116
120
|
}
|
|
117
121
|
processParts(reflection, parts, warn) {
|
|
118
122
|
return parts.flatMap((part) => this.processPart(reflection, part, warn));
|
|
@@ -173,6 +177,10 @@ exports.LinkResolverPlugin = LinkResolverPlugin;
|
|
|
173
177
|
function resolveLinkTag(reflection, part, warn) {
|
|
174
178
|
let pos = 0;
|
|
175
179
|
const end = part.text.length;
|
|
180
|
+
while (pos < end && ts.isWhiteSpaceLike(part.text.charCodeAt(pos))) {
|
|
181
|
+
pos++;
|
|
182
|
+
}
|
|
183
|
+
const origText = part.text;
|
|
176
184
|
// Try to parse one
|
|
177
185
|
const declRef = (0, declarationReference_1.parseDeclarationReference)(part.text, pos, end);
|
|
178
186
|
let target;
|
|
@@ -181,12 +189,20 @@ function resolveLinkTag(reflection, part, warn) {
|
|
|
181
189
|
target = (0, declarationReferenceResolver_1.resolveDeclarationReference)(reflection, declRef[0]);
|
|
182
190
|
pos = declRef[1];
|
|
183
191
|
}
|
|
192
|
+
if (!target) {
|
|
193
|
+
if (urlPrefix.test(part.text)) {
|
|
194
|
+
const wsIndex = part.text.search(/\s/);
|
|
195
|
+
target =
|
|
196
|
+
wsIndex === -1 ? part.text : part.text.substring(0, wsIndex);
|
|
197
|
+
pos = target.length;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
184
200
|
// If resolution via a declaration reference failed, revert to the legacy "split and check"
|
|
185
201
|
// method... this should go away in 0.24, once people have had a chance to migrate any failing links.
|
|
186
202
|
if (!target) {
|
|
187
203
|
const resolved = legacyResolveLinkTag(reflection, part);
|
|
188
204
|
if (resolved) {
|
|
189
|
-
warn(`Failed to resolve {@link ${
|
|
205
|
+
warn(`Failed to resolve {@link ${origText}} in ${reflection.getFriendlyFullName()} with declaration references. This link will break in v0.24.`);
|
|
190
206
|
}
|
|
191
207
|
return resolved;
|
|
192
208
|
}
|
|
@@ -199,7 +215,9 @@ function resolveLinkTag(reflection, part, warn) {
|
|
|
199
215
|
pos++;
|
|
200
216
|
}
|
|
201
217
|
part.target = target;
|
|
202
|
-
part.text =
|
|
218
|
+
part.text =
|
|
219
|
+
part.text.substring(pos).trim() ||
|
|
220
|
+
(typeof target === "string" ? target : target.name);
|
|
203
221
|
return part;
|
|
204
222
|
}
|
|
205
223
|
function legacyResolveLinkTag(reflection, part) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ConverterComponent } from "../components";
|
|
2
|
+
import { EntryPointStrategy } from "../../utils";
|
|
2
3
|
/**
|
|
3
4
|
* A handler that tries to find the package.json and readme.md files of the
|
|
4
5
|
* current project.
|
|
@@ -6,6 +7,7 @@ import { ConverterComponent } from "../components";
|
|
|
6
7
|
export declare class PackagePlugin extends ConverterComponent {
|
|
7
8
|
readme: string;
|
|
8
9
|
includeVersion: boolean;
|
|
10
|
+
entryPointStrategy: EntryPointStrategy;
|
|
9
11
|
/**
|
|
10
12
|
* The file name of the found readme.md file.
|
|
11
13
|
*/
|
|
@@ -14,8 +14,6 @@ const converter_1 = require("../converter");
|
|
|
14
14
|
const utils_1 = require("../../utils");
|
|
15
15
|
const fs_1 = require("../../utils/fs");
|
|
16
16
|
const paths_1 = require("../../utils/paths");
|
|
17
|
-
const rawLexer_1 = require("../comments/rawLexer");
|
|
18
|
-
const parser_1 = require("../comments/parser");
|
|
19
17
|
const minimalSourceFile_1 = require("../../utils/minimalSourceFile");
|
|
20
18
|
/**
|
|
21
19
|
* A handler that tries to find the package.json and readme.md files of the
|
|
@@ -76,7 +74,7 @@ let PackagePlugin = class PackagePlugin extends components_1.ConverterComponent
|
|
|
76
74
|
const project = context.project;
|
|
77
75
|
if (this.readmeFile) {
|
|
78
76
|
const readme = (0, utils_1.readFile)(this.readmeFile);
|
|
79
|
-
const comment =
|
|
77
|
+
const comment = context.converter.parseRawComment(new minimalSourceFile_1.MinimalSourceFile(readme, this.readmeFile));
|
|
80
78
|
if (comment.blockTags.length || comment.modifierTags.size) {
|
|
81
79
|
const ignored = [
|
|
82
80
|
...comment.blockTags.map((tag) => tag.tag),
|
|
@@ -102,7 +100,11 @@ let PackagePlugin = class PackagePlugin extends components_1.ConverterComponent
|
|
|
102
100
|
project.name = `${project.name} - v${packageInfo.version}`;
|
|
103
101
|
}
|
|
104
102
|
else {
|
|
105
|
-
|
|
103
|
+
// since not all monorepo specifies a meaningful version to the main package.json
|
|
104
|
+
// this warning should be optional
|
|
105
|
+
if (this.entryPointStrategy !== utils_1.EntryPointStrategy.Packages) {
|
|
106
|
+
context.logger.warn("--includeVersion was specified, but package.json does not specify a version.");
|
|
107
|
+
}
|
|
106
108
|
}
|
|
107
109
|
}
|
|
108
110
|
}
|
|
@@ -112,7 +114,11 @@ let PackagePlugin = class PackagePlugin extends components_1.ConverterComponent
|
|
|
112
114
|
project.name = "Documentation";
|
|
113
115
|
}
|
|
114
116
|
if (this.includeVersion) {
|
|
115
|
-
|
|
117
|
+
// since not all monorepo specifies a meaningful version to the main package.json
|
|
118
|
+
// this warning should be optional
|
|
119
|
+
if (this.entryPointStrategy !== utils_1.EntryPointStrategy.Packages) {
|
|
120
|
+
context.logger.warn("--includeVersion was specified, but no package.json was found. Not adding package version to the documentation.");
|
|
121
|
+
}
|
|
116
122
|
}
|
|
117
123
|
}
|
|
118
124
|
}
|
|
@@ -123,6 +129,9 @@ __decorate([
|
|
|
123
129
|
__decorate([
|
|
124
130
|
(0, utils_1.BindOption)("includeVersion")
|
|
125
131
|
], PackagePlugin.prototype, "includeVersion", void 0);
|
|
132
|
+
__decorate([
|
|
133
|
+
(0, utils_1.BindOption)("entryPointStrategy")
|
|
134
|
+
], PackagePlugin.prototype, "entryPointStrategy", void 0);
|
|
126
135
|
PackagePlugin = __decorate([
|
|
127
136
|
(0, components_1.Component)({ name: "package" })
|
|
128
137
|
], PackagePlugin);
|
|
@@ -42,7 +42,7 @@ let SourcePlugin = class SourcePlugin extends components_1.ConverterComponent {
|
|
|
42
42
|
this.listenTo(this.owner, {
|
|
43
43
|
[converter_1.Converter.EVENT_END]: this.onEnd,
|
|
44
44
|
[converter_1.Converter.EVENT_CREATE_DECLARATION]: this.onDeclaration,
|
|
45
|
-
[converter_1.Converter.EVENT_CREATE_SIGNATURE]: this.
|
|
45
|
+
[converter_1.Converter.EVENT_CREATE_SIGNATURE]: this.onSignature,
|
|
46
46
|
[converter_1.Converter.EVENT_RESOLVE_BEGIN]: this.onBeginResolve,
|
|
47
47
|
});
|
|
48
48
|
}
|
|
@@ -77,6 +77,16 @@ let SourcePlugin = class SourcePlugin extends components_1.ConverterComponent {
|
|
|
77
77
|
reflection.sources.push(new models_1.SourceReference(fileName, position.line + 1, position.character));
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
+
onSignature(_context, reflection, sig) {
|
|
81
|
+
if (this.disableSources || !sig)
|
|
82
|
+
return;
|
|
83
|
+
const sourceFile = sig.getSourceFile();
|
|
84
|
+
const fileName = sourceFile.fileName;
|
|
85
|
+
this.fileNames.add(fileName);
|
|
86
|
+
const position = ts.getLineAndCharacterOfPosition(sourceFile, sig.getStart());
|
|
87
|
+
reflection.sources || (reflection.sources = []);
|
|
88
|
+
reflection.sources.push(new models_1.SourceReference(fileName, position.line + 1, position.character));
|
|
89
|
+
}
|
|
80
90
|
/**
|
|
81
91
|
* Triggered when the converter begins resolving a project.
|
|
82
92
|
*
|
|
@@ -44,11 +44,19 @@ class Repository {
|
|
|
44
44
|
this.path = path;
|
|
45
45
|
this.branch = gitRevision || "master";
|
|
46
46
|
for (let i = 0, c = repoLinks.length; i < c; i++) {
|
|
47
|
-
let match = /(github(?:\.[a-z]+)*\.[a-z]{2,})[:/]([^/]+)\/(.*)/.exec(repoLinks[i]);
|
|
47
|
+
let match = /(github(?!.us)(?:\.[a-z]+)*\.[a-z]{2,})[:/]([^/]+)\/(.*)/.exec(repoLinks[i]);
|
|
48
48
|
// Github Enterprise
|
|
49
49
|
if (!match) {
|
|
50
50
|
match = /(\w+\.githubprivate.com)[:/]([^/]+)\/(.*)/.exec(repoLinks[i]);
|
|
51
51
|
}
|
|
52
|
+
// Github Enterprise
|
|
53
|
+
if (!match) {
|
|
54
|
+
match = /(\w+\.ghe.com)[:/]([^/]+)\/(.*)/.exec(repoLinks[i]);
|
|
55
|
+
}
|
|
56
|
+
// Github Enterprise
|
|
57
|
+
if (!match) {
|
|
58
|
+
match = /(\w+\.github.us)[:/]([^/]+)\/(.*)/.exec(repoLinks[i]);
|
|
59
|
+
}
|
|
52
60
|
if (!match) {
|
|
53
61
|
match = /(bitbucket.org)[:/]([^/]+)\/(.*)/.exec(repoLinks[i]);
|
|
54
62
|
}
|
|
@@ -5,6 +5,7 @@ import { ContainerReflection } from "./container";
|
|
|
5
5
|
import type { SignatureReflection } from "./signature";
|
|
6
6
|
import type { TypeParameterReflection } from "./type-parameter";
|
|
7
7
|
import type { Serializer, JSONOutput } from "../../serialization";
|
|
8
|
+
import type { CommentDisplayPart } from "../comments";
|
|
8
9
|
/**
|
|
9
10
|
* Stores hierarchical type data.
|
|
10
11
|
*
|
|
@@ -109,6 +110,14 @@ export declare class DeclarationReflection extends ContainerReflection {
|
|
|
109
110
|
* rendered in templates.
|
|
110
111
|
*/
|
|
111
112
|
typeHierarchy?: DeclarationHierarchy;
|
|
113
|
+
/**
|
|
114
|
+
* The contents of the readme file of the module when found.
|
|
115
|
+
*/
|
|
116
|
+
readme?: CommentDisplayPart[];
|
|
117
|
+
/**
|
|
118
|
+
* The version of the module when found.
|
|
119
|
+
*/
|
|
120
|
+
version?: string;
|
|
112
121
|
hasGetterOrSetter(): boolean;
|
|
113
122
|
getAllSignatures(): SignatureReflection[];
|
|
114
123
|
/** @internal */
|
|
@@ -45,4 +45,9 @@ export declare namespace ReflectionKind {
|
|
|
45
45
|
const Inheritable: number;
|
|
46
46
|
/** @internal */
|
|
47
47
|
const ContainsCallSignatures: number;
|
|
48
|
+
/**
|
|
49
|
+
* Note: This does not include Class/Interface, even though they technically could contain index signatures
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
const SignatureContainer: number;
|
|
48
53
|
}
|
|
@@ -78,4 +78,9 @@ var ReflectionKind;
|
|
|
78
78
|
ReflectionKind.ContainsCallSignatures = ReflectionKind.Constructor |
|
|
79
79
|
ReflectionKind.Function |
|
|
80
80
|
ReflectionKind.Method;
|
|
81
|
+
/**
|
|
82
|
+
* Note: This does not include Class/Interface, even though they technically could contain index signatures
|
|
83
|
+
* @internal
|
|
84
|
+
*/
|
|
85
|
+
ReflectionKind.SignatureContainer = ReflectionKind.ContainsCallSignatures | ReflectionKind.Accessor;
|
|
81
86
|
})(ReflectionKind = exports.ReflectionKind || (exports.ReflectionKind = {}));
|
|
@@ -221,6 +221,11 @@ class DefaultTheme extends theme_1.Theme {
|
|
|
221
221
|
classes.push("tsd-is-protected");
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
+
else if (key === "private") {
|
|
225
|
+
if (reflection.flags.isPrivate) {
|
|
226
|
+
classes.push("tsd-is-private");
|
|
227
|
+
}
|
|
228
|
+
}
|
|
224
229
|
else if (key === "external") {
|
|
225
230
|
if (reflection.flags.isExternal) {
|
|
226
231
|
classes.push("tsd-is-external");
|
|
@@ -39,6 +39,9 @@ export declare class DefaultThemeRenderContext {
|
|
|
39
39
|
members: (props: import("../../../models").ContainerReflection) => import("../../../utils/jsx.elements").JsxElement;
|
|
40
40
|
membersGroup: (group: import("../../../models").ReflectionGroup) => import("../../../utils/jsx.elements").JsxElement;
|
|
41
41
|
navigation: (props: import("../..").PageEvent<Reflection>) => import("../../../utils/jsx.elements").JsxElement;
|
|
42
|
+
settings: () => import("../../../utils/jsx.elements").JsxElement;
|
|
43
|
+
primaryNavigation: (props: import("../..").PageEvent<Reflection>) => import("../../../utils/jsx.elements").JsxElement;
|
|
44
|
+
secondaryNavigation: (props: import("../..").PageEvent<Reflection>) => import("../../../utils/jsx.elements").JsxElement | undefined;
|
|
42
45
|
parameter: (props: import("../../../models").DeclarationReflection) => import("../../../utils/jsx.elements").JsxElement;
|
|
43
46
|
toolbar: (props: import("../..").PageEvent<Reflection>) => import("../../../utils/jsx.elements").JsxElement;
|
|
44
47
|
type: (type: import("../../../models").Type | undefined) => import("../../../utils/jsx.elements").JsxElement;
|
|
@@ -68,6 +68,9 @@ class DefaultThemeRenderContext {
|
|
|
68
68
|
this.members = bind(members_1.members, this);
|
|
69
69
|
this.membersGroup = bind(members_group_1.membersGroup, this);
|
|
70
70
|
this.navigation = bind(navigation_1.navigation, this);
|
|
71
|
+
this.settings = bind(navigation_1.settings, this);
|
|
72
|
+
this.primaryNavigation = bind(navigation_1.primaryNavigation, this);
|
|
73
|
+
this.secondaryNavigation = bind(navigation_1.secondaryNavigation, this);
|
|
71
74
|
this.parameter = bind(parameter_1.parameter, this);
|
|
72
75
|
this.toolbar = bind(toolbar_1.toolbar, this);
|
|
73
76
|
this.type = bind(type_1.type, this);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JSX } from "../../../../utils";
|
|
2
2
|
import type { DefaultThemeRenderContext } from "../DefaultThemeRenderContext";
|
|
3
3
|
import type { PageEvent } from "../../../events";
|
|
4
|
-
import
|
|
4
|
+
import { Reflection } from "../../../../models";
|
|
5
5
|
export declare const header: (context: DefaultThemeRenderContext, props: PageEvent<Reflection>) => JSX.Element;
|
|
@@ -3,13 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.header = void 0;
|
|
4
4
|
const lib_1 = require("../../lib");
|
|
5
5
|
const utils_1 = require("../../../../utils");
|
|
6
|
+
const models_1 = require("../../../../models");
|
|
6
7
|
const header = (context, props) => {
|
|
7
8
|
const HeadingLevel = props.model.isProject() ? "h2" : "h1";
|
|
8
9
|
return (utils_1.JSX.createElement("div", { class: "tsd-page-title" },
|
|
9
10
|
!!props.model.parent && utils_1.JSX.createElement("ul", { class: "tsd-breadcrumb" }, context.breadcrumb(props.model)),
|
|
10
11
|
utils_1.JSX.createElement(HeadingLevel, null,
|
|
11
|
-
props.model.
|
|
12
|
+
props.model.kind !== models_1.ReflectionKind.Project && `${props.model.kindString ?? ""} `,
|
|
12
13
|
props.model.name,
|
|
14
|
+
props.model instanceof models_1.DeclarationReflection &&
|
|
15
|
+
props.model.version !== undefined &&
|
|
16
|
+
` - v${props.model.version}`,
|
|
13
17
|
(0, lib_1.hasTypeParameters)(props.model) && (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
14
18
|
"<",
|
|
15
19
|
(0, lib_1.join)(", ", props.model.typeParameters, (item) => item.name),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { DefaultThemeRenderContext } from "../DefaultThemeRenderContext";
|
|
2
2
|
import { JSX } from "../../../../utils";
|
|
3
|
-
import
|
|
3
|
+
import { ContainerReflection } from "../../../../models";
|
|
4
4
|
export declare function index(context: DefaultThemeRenderContext, props: ContainerReflection): JSX.Element;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.index = void 0;
|
|
4
4
|
const lib_1 = require("../../lib");
|
|
5
5
|
const utils_1 = require("../../../../utils");
|
|
6
|
+
const models_1 = require("../../../../models");
|
|
6
7
|
function renderCategory({ urlTo, icons }, item, prependName = "") {
|
|
7
8
|
return (utils_1.JSX.createElement("section", { class: "tsd-index-section" },
|
|
8
9
|
utils_1.JSX.createElement("h3", { class: "tsd-index-heading" }, prependName ? `${prependName} - ${item.title}` : item.title),
|
|
@@ -36,7 +37,13 @@ function index(context, props) {
|
|
|
36
37
|
utils_1.JSX.createElement("h3", { class: "tsd-index-heading uppercase" }, "Index"),
|
|
37
38
|
content));
|
|
38
39
|
}
|
|
39
|
-
return (utils_1.JSX.createElement(
|
|
40
|
-
|
|
40
|
+
return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
41
|
+
props instanceof models_1.DeclarationReflection &&
|
|
42
|
+
props.kind === models_1.ReflectionKind.Module &&
|
|
43
|
+
props.readme?.length !== 0 && (utils_1.JSX.createElement("section", { class: "tsd-panel-group" },
|
|
44
|
+
utils_1.JSX.createElement("section", { class: "tsd-panel tsd-typography" },
|
|
45
|
+
utils_1.JSX.createElement(utils_1.Raw, { html: context.markdown((0, lib_1.displayPartsToMarkdown)(props.readme || [], context.urlTo)) })))),
|
|
46
|
+
utils_1.JSX.createElement("section", { class: "tsd-panel-group tsd-index-group" },
|
|
47
|
+
utils_1.JSX.createElement("section", { class: "tsd-panel tsd-index-panel" }, content))));
|
|
41
48
|
}
|
|
42
49
|
exports.index = index;
|
|
@@ -4,21 +4,22 @@ exports.memberGetterSetter = void 0;
|
|
|
4
4
|
const utils_1 = require("../../../../utils");
|
|
5
5
|
const memberGetterSetter = (context, props) => (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
6
6
|
utils_1.JSX.createElement("ul", { class: "tsd-signatures " + props.cssClasses },
|
|
7
|
-
!!props.getSignature && (utils_1.JSX.createElement(
|
|
8
|
-
utils_1.JSX.createElement("
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
utils_1.JSX.createElement("
|
|
16
|
-
|
|
17
|
-
props.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
7
|
+
!!props.getSignature && (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
8
|
+
utils_1.JSX.createElement("li", { class: "tsd-signature", id: props.getSignature.anchor },
|
|
9
|
+
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "get"),
|
|
10
|
+
" ",
|
|
11
|
+
props.name,
|
|
12
|
+
context.memberSignatureTitle(props.getSignature, {
|
|
13
|
+
hideName: true,
|
|
14
|
+
})),
|
|
15
|
+
utils_1.JSX.createElement("li", { class: "tsd-description" }, context.memberSignatureBody(props.getSignature)))),
|
|
16
|
+
!!props.setSignature && (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
17
|
+
utils_1.JSX.createElement("li", { class: "tsd-signature", id: props.setSignature.anchor },
|
|
18
|
+
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "set"),
|
|
19
|
+
" ",
|
|
20
|
+
props.name,
|
|
21
|
+
context.memberSignatureTitle(props.setSignature, {
|
|
22
|
+
hideName: true,
|
|
23
|
+
})),
|
|
24
|
+
utils_1.JSX.createElement("li", { class: "tsd-description" }, context.memberSignatureBody(props.setSignature)))))));
|
|
24
25
|
exports.memberGetterSetter = memberGetterSetter;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DefaultThemeRenderContext } from "../DefaultThemeRenderContext";
|
|
2
2
|
import { JSX } from "../../../../utils";
|
|
3
|
-
import
|
|
3
|
+
import { SignatureReflection } from "../../../../models";
|
|
4
4
|
export declare const memberSignatureTitle: (context: DefaultThemeRenderContext, props: SignatureReflection, { hideName, arrowStyle }?: {
|
|
5
5
|
hideName?: boolean | undefined;
|
|
6
6
|
arrowStyle?: boolean | undefined;
|
|
@@ -3,8 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.memberSignatureTitle = void 0;
|
|
4
4
|
const lib_1 = require("../../lib");
|
|
5
5
|
const utils_1 = require("../../../../utils");
|
|
6
|
+
const models_1 = require("../../../../models");
|
|
6
7
|
const memberSignatureTitle = (context, props, { hideName = false, arrowStyle = false } = {}) => (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
7
|
-
!hideName ? ((0, lib_1.wbr)(props.name)) : (utils_1.JSX.createElement(utils_1.JSX.Fragment, null, props.
|
|
8
|
+
!hideName ? ((0, lib_1.wbr)(props.name)) : (utils_1.JSX.createElement(utils_1.JSX.Fragment, null, props.kind === models_1.ReflectionKind.ConstructorSignature && (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
8
9
|
!!props.flags.isAbstract && utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "abstract "),
|
|
9
10
|
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "new "))))),
|
|
10
11
|
(0, lib_1.renderTypeParametersSignature)(props.typeParameters),
|
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.memberSignatures = void 0;
|
|
4
4
|
const utils_1 = require("../../../../utils");
|
|
5
|
+
const anchor_icon_1 = require("./anchor-icon");
|
|
5
6
|
const memberSignatures = (context, props) => (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
6
|
-
utils_1.JSX.createElement("ul", { class: "tsd-signatures " + props.cssClasses }, props.signatures?.map((item) => (utils_1.JSX.createElement(
|
|
7
|
-
|
|
7
|
+
utils_1.JSX.createElement("ul", { class: "tsd-signatures " + props.cssClasses }, props.signatures?.map((item) => (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
8
|
+
utils_1.JSX.createElement("li", { class: "tsd-signature tsd-anchor-link", id: item.anchor },
|
|
9
|
+
context.memberSignatureTitle(item),
|
|
10
|
+
(0, anchor_icon_1.anchorIcon)(context, item.anchor)),
|
|
11
|
+
utils_1.JSX.createElement("li", { class: "tsd-description" }, context.memberSignatureBody(item))))))));
|
|
8
12
|
exports.memberSignatures = memberSignatures;
|
|
@@ -3,3 +3,6 @@ import { JSX } from "../../../../utils";
|
|
|
3
3
|
import type { PageEvent } from "../../../events";
|
|
4
4
|
import type { DefaultThemeRenderContext } from "../DefaultThemeRenderContext";
|
|
5
5
|
export declare function navigation(context: DefaultThemeRenderContext, props: PageEvent<Reflection>): JSX.Element;
|
|
6
|
+
export declare function settings(context: DefaultThemeRenderContext): JSX.Element;
|
|
7
|
+
export declare function primaryNavigation(context: DefaultThemeRenderContext, props: PageEvent<Reflection>): JSX.Element;
|
|
8
|
+
export declare function secondaryNavigation(context: DefaultThemeRenderContext, props: PageEvent<Reflection>): JSX.Element | undefined;
|