typedoc 0.22.2 → 0.22.6
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/bin/typedoc +23 -20
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -1
- package/dist/lib/application.js +25 -11
- package/dist/lib/converter/context.d.ts +1 -1
- package/dist/lib/converter/convert-expression.js +14 -0
- package/dist/lib/converter/factories/comment.js +3 -0
- package/dist/lib/converter/plugins/CategoryPlugin.d.ts +2 -2
- package/dist/lib/converter/plugins/CommentPlugin.js +86 -25
- package/dist/lib/converter/plugins/GitHubPlugin.d.ts +14 -8
- package/dist/lib/converter/plugins/GitHubPlugin.js +45 -22
- package/dist/lib/converter/plugins/GroupPlugin.d.ts +2 -2
- package/dist/lib/converter/plugins/SourcePlugin.js +0 -1
- package/dist/lib/converter/plugins/index.d.ts +0 -1
- package/dist/lib/converter/plugins/index.js +1 -3
- package/dist/lib/converter/symbols.js +20 -22
- package/dist/lib/models/ReflectionCategory.d.ts +3 -10
- package/dist/lib/models/ReflectionCategory.js +2 -7
- package/dist/lib/models/ReflectionGroup.d.ts +4 -10
- package/dist/lib/models/ReflectionGroup.js +1 -8
- package/dist/lib/models/comments/comment.d.ts +1 -1
- package/dist/lib/models/comments/comment.js +1 -1
- package/dist/lib/models/sources/directory.d.ts +2 -2
- package/dist/lib/models/sources/directory.js +2 -6
- package/dist/lib/models/sources/file.d.ts +8 -3
- package/dist/lib/models/sources/index.d.ts +1 -0
- package/dist/lib/models/sources/index.js +3 -1
- package/dist/lib/models/sources/repository.d.ts +4 -0
- package/dist/lib/models/sources/repository.js +8 -0
- package/dist/lib/output/index.d.ts +1 -1
- package/dist/lib/output/index.js +2 -1
- package/dist/lib/output/plugins/MarkedLinksPlugin.d.ts +2 -0
- package/dist/lib/output/plugins/MarkedLinksPlugin.js +8 -1
- package/dist/lib/output/plugins/index.d.ts +1 -1
- package/dist/lib/output/renderer.d.ts +2 -0
- package/dist/lib/output/renderer.js +19 -1
- package/dist/lib/output/themes/MarkedPlugin.d.ts +1 -0
- package/dist/lib/output/themes/MarkedPlugin.js +6 -9
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +25 -25
- package/dist/lib/output/themes/default/layouts/default.js +2 -1
- package/dist/lib/output/themes/default/partials/member.js +2 -2
- package/dist/lib/output/themes/default/partials/members.group.js +2 -3
- package/dist/lib/output/themes/default/partials/members.js +1 -2
- package/dist/lib/output/themes/lib.d.ts +1 -2
- package/dist/lib/output/themes/lib.js +1 -7
- package/dist/lib/utils/entry-point.d.ts +1 -0
- package/dist/lib/utils/entry-point.js +24 -1
- package/dist/lib/utils/general.d.ts +0 -22
- package/dist/lib/utils/highlighter.js +8 -10
- package/dist/lib/utils/index.d.ts +1 -1
- package/dist/lib/utils/jsx.d.ts +8 -35
- package/dist/lib/utils/jsx.elements.d.ts +819 -0
- package/dist/lib/utils/jsx.elements.js +4 -0
- package/dist/lib/utils/jsx.js +7 -6
- package/dist/lib/utils/options/declaration.d.ts +43 -8
- package/dist/lib/utils/options/declaration.js +39 -1
- package/dist/lib/utils/options/index.d.ts +2 -2
- package/dist/lib/utils/options/index.js +2 -1
- package/dist/lib/utils/options/options.d.ts +4 -99
- package/dist/lib/utils/options/options.js +22 -15
- package/dist/lib/utils/options/readers/arguments.js +22 -3
- package/dist/lib/utils/options/readers/tsconfig.d.ts +5 -0
- package/dist/lib/utils/options/readers/tsconfig.js +19 -7
- package/dist/lib/utils/options/sources/typedoc.js +50 -26
- package/dist/lib/validation/exports.d.ts +1 -1
- package/dist/lib/validation/exports.js +53 -20
- package/package.json +20 -15
- package/static/main.js +1 -1
- package/static/style.css +51 -8
- package/dist/lib/converter/plugins/DeepCommentPlugin.d.ts +0 -16
- package/dist/lib/converter/plugins/DeepCommentPlugin.js +0 -84
package/bin/typedoc
CHANGED
|
@@ -105,27 +105,30 @@ async function run(app) {
|
|
|
105
105
|
return ExitCodes.ValidationError;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
108
|
+
if (app.options.getValue("emit") !== "none") {
|
|
109
|
+
const out = app.options.getValue("out");
|
|
110
|
+
if (out) {
|
|
111
|
+
await app.generateDocs(project, out);
|
|
112
|
+
}
|
|
113
|
+
const json = app.options.getValue("json");
|
|
114
|
+
if (json) {
|
|
115
|
+
await app.generateJson(project, json);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (!out && !json) {
|
|
119
|
+
await app.generateDocs(project, "./docs");
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (app.logger.hasErrors()) {
|
|
123
|
+
return ExitCodes.OutputError;
|
|
124
|
+
}
|
|
125
|
+
if (
|
|
126
|
+
app.options.getValue("treatWarningsAsErrors") &&
|
|
127
|
+
app.logger.hasWarnings()
|
|
128
|
+
) {
|
|
129
|
+
return ExitCodes.OutputError;
|
|
130
|
+
}
|
|
119
131
|
}
|
|
120
132
|
|
|
121
|
-
if (app.logger.hasErrors()) {
|
|
122
|
-
return ExitCodes.OutputError;
|
|
123
|
-
}
|
|
124
|
-
if (
|
|
125
|
-
app.options.getValue("treatWarningsAsErrors") &&
|
|
126
|
-
app.logger.hasWarnings()
|
|
127
|
-
) {
|
|
128
|
-
return ExitCodes.OutputError;
|
|
129
|
-
}
|
|
130
133
|
return ExitCodes.Ok;
|
|
131
134
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,10 +4,10 @@ export { resetReflectionID } from "./lib/models/reflections/abstract";
|
|
|
4
4
|
export { normalizePath } from "./lib/utils/fs";
|
|
5
5
|
export * from "./lib/models";
|
|
6
6
|
export { Converter, Context } from "./lib/converter";
|
|
7
|
-
export { Renderer, DefaultTheme, DefaultThemeRenderContext, UrlMapping, Theme, PageEvent, RendererEvent, } from "./lib/output";
|
|
7
|
+
export { Renderer, DefaultTheme, DefaultThemeRenderContext, UrlMapping, Theme, PageEvent, RendererEvent, MarkdownEvent, } from "./lib/output";
|
|
8
8
|
export type { RenderTemplate } from "./lib/output";
|
|
9
9
|
export { ArgumentsReader, BindOption, JSX, LogLevel, Logger, Options, ParameterHint, ParameterType, TSConfigReader, TypeDocReader, EntryPointStrategy, } from "./lib/utils";
|
|
10
|
-
export type { OptionsReader, TypeDocOptions, TypeDocOptionMap, TypeDocOptionValues, KeyToDeclaration, DeclarationOption, DeclarationOptionBase, StringDeclarationOption, NumberDeclarationOption, BooleanDeclarationOption, ArrayDeclarationOption, MixedDeclarationOption, MapDeclarationOption, DeclarationOptionToOptionType, SortStrategy, ParameterTypeToOptionTypeMap, DocumentationEntryPoint, } from "./lib/utils";
|
|
10
|
+
export type { OptionsReader, TypeDocOptions, TypeDocOptionMap, ValidationOptions, TypeDocOptionValues, KeyToDeclaration, DeclarationOption, DeclarationOptionBase, StringDeclarationOption, NumberDeclarationOption, BooleanDeclarationOption, ArrayDeclarationOption, MixedDeclarationOption, MapDeclarationOption, FlagsDeclarationOption, DeclarationOptionToOptionType, SortStrategy, ParameterTypeToOptionTypeMap, DocumentationEntryPoint, } from "./lib/utils";
|
|
11
11
|
export type { EventMap, EventCallback } from "./lib/utils/events";
|
|
12
12
|
export { JSONOutput, Serializer, SerializerComponent, SerializeEvent, } from "./lib/serialization";
|
|
13
13
|
export type { SerializeEventData } from "./lib/serialization";
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.TypeScript = exports.SerializeEvent = exports.SerializerComponent = exports.Serializer = exports.JSONOutput = exports.EntryPointStrategy = exports.TypeDocReader = exports.TSConfigReader = exports.ParameterType = exports.ParameterHint = exports.Options = exports.Logger = exports.LogLevel = exports.JSX = exports.BindOption = exports.ArgumentsReader = exports.RendererEvent = exports.PageEvent = exports.Theme = exports.UrlMapping = exports.DefaultThemeRenderContext = exports.DefaultTheme = exports.Renderer = exports.Context = exports.Converter = exports.normalizePath = exports.resetReflectionID = exports.Event = exports.EventDispatcher = exports.Application = void 0;
|
|
13
|
+
exports.TypeScript = exports.SerializeEvent = exports.SerializerComponent = exports.Serializer = exports.JSONOutput = exports.EntryPointStrategy = exports.TypeDocReader = exports.TSConfigReader = exports.ParameterType = exports.ParameterHint = exports.Options = exports.Logger = exports.LogLevel = exports.JSX = exports.BindOption = exports.ArgumentsReader = exports.MarkdownEvent = exports.RendererEvent = exports.PageEvent = exports.Theme = exports.UrlMapping = exports.DefaultThemeRenderContext = exports.DefaultTheme = exports.Renderer = exports.Context = exports.Converter = exports.normalizePath = exports.resetReflectionID = exports.Event = exports.EventDispatcher = exports.Application = void 0;
|
|
14
14
|
var application_1 = require("./lib/application");
|
|
15
15
|
Object.defineProperty(exports, "Application", { enumerable: true, get: function () { return application_1.Application; } });
|
|
16
16
|
var events_1 = require("./lib/utils/events");
|
|
@@ -32,6 +32,7 @@ Object.defineProperty(exports, "UrlMapping", { enumerable: true, get: function (
|
|
|
32
32
|
Object.defineProperty(exports, "Theme", { enumerable: true, get: function () { return output_1.Theme; } });
|
|
33
33
|
Object.defineProperty(exports, "PageEvent", { enumerable: true, get: function () { return output_1.PageEvent; } });
|
|
34
34
|
Object.defineProperty(exports, "RendererEvent", { enumerable: true, get: function () { return output_1.RendererEvent; } });
|
|
35
|
+
Object.defineProperty(exports, "MarkdownEvent", { enumerable: true, get: function () { return output_1.MarkdownEvent; } });
|
|
35
36
|
var utils_1 = require("./lib/utils");
|
|
36
37
|
Object.defineProperty(exports, "ArgumentsReader", { enumerable: true, get: function () { return utils_1.ArgumentsReader; } });
|
|
37
38
|
Object.defineProperty(exports, "BindOption", { enumerable: true, get: function () { return utils_1.BindOption; } });
|
package/dist/lib/application.js
CHANGED
|
@@ -17,7 +17,6 @@ const index_2 = require("./utils/index");
|
|
|
17
17
|
const component_1 = require("./utils/component");
|
|
18
18
|
const utils_1 = require("./utils");
|
|
19
19
|
const array_1 = require("./utils/array");
|
|
20
|
-
const path_1 = require("path");
|
|
21
20
|
const exports_1 = require("./validation/exports");
|
|
22
21
|
const assert_1 = require("assert");
|
|
23
22
|
const entry_point_1 = require("./utils/entry-point");
|
|
@@ -145,7 +144,8 @@ let Application = Application_1 = class Application extends component_1.Childabl
|
|
|
145
144
|
this.logger.diagnostics(errors);
|
|
146
145
|
return;
|
|
147
146
|
}
|
|
148
|
-
if (this.options.getValue("emit")
|
|
147
|
+
if (this.options.getValue("emit") === "both" ||
|
|
148
|
+
this.options.getValue("emit") === true) {
|
|
149
149
|
for (const program of programs) {
|
|
150
150
|
program.emit();
|
|
151
151
|
}
|
|
@@ -182,16 +182,11 @@ let Application = Application_1 = class Application extends component_1.Childabl
|
|
|
182
182
|
this.logger.error("The packages option of entryPointStrategy is not supported in watch mode.");
|
|
183
183
|
return;
|
|
184
184
|
}
|
|
185
|
-
|
|
186
|
-
let tsconfigFile = this.options.getValue("tsconfig");
|
|
187
|
-
tsconfigFile =
|
|
188
|
-
(_c = ts.findConfigFile(tsconfigFile, ts.sys.fileExists, tsconfigFile.toLowerCase().endsWith(".json")
|
|
189
|
-
? (0, path_1.basename)(tsconfigFile)
|
|
190
|
-
: undefined)) !== null && _c !== void 0 ? _c : "tsconfig.json";
|
|
185
|
+
const tsconfigFile = (_c = index_2.TSConfigReader.findConfigFile(this.options.getValue("tsconfig"))) !== null && _c !== void 0 ? _c : "tsconfig.json";
|
|
191
186
|
// We don't want to do it the first time to preserve initial debug status messages. They'll be lost
|
|
192
187
|
// after the user saves a file, but better than nothing...
|
|
193
188
|
let firstStatusReport = true;
|
|
194
|
-
const host = ts.createWatchCompilerHost(tsconfigFile,
|
|
189
|
+
const host = ts.createWatchCompilerHost(tsconfigFile, {}, ts.sys, ts.createEmitAndSemanticDiagnosticsBuilderProgram, (diagnostic) => this.logger.diagnostic(diagnostic), (status, newLine, _options, errorCount) => {
|
|
195
190
|
var _a, _b;
|
|
196
191
|
if (!firstStatusReport &&
|
|
197
192
|
errorCount === void 0 &&
|
|
@@ -209,8 +204,13 @@ let Application = Application_1 = class Application extends component_1.Childabl
|
|
|
209
204
|
return;
|
|
210
205
|
}
|
|
211
206
|
if (successFinished) {
|
|
207
|
+
if (this.options.getValue("emit") === "both" ||
|
|
208
|
+
this.options.getValue("emit") === true) {
|
|
209
|
+
currentProgram.emit();
|
|
210
|
+
}
|
|
212
211
|
this.logger.resetErrors();
|
|
213
|
-
|
|
212
|
+
this.logger.resetWarnings();
|
|
213
|
+
const entryPoints = (0, entry_point_1.getWatchEntryPoints)(this.logger, this.options, currentProgram);
|
|
214
214
|
if (!entryPoints) {
|
|
215
215
|
return;
|
|
216
216
|
}
|
|
@@ -223,6 +223,14 @@ let Application = Application_1 = class Application extends component_1.Childabl
|
|
|
223
223
|
});
|
|
224
224
|
}
|
|
225
225
|
};
|
|
226
|
+
const origCreateProgram = host.createProgram;
|
|
227
|
+
host.createProgram = (rootNames, options, host, oldProgram, configDiagnostics, references) => {
|
|
228
|
+
// If we always do this, we'll get a crash the second time a program is created.
|
|
229
|
+
if (rootNames !== undefined) {
|
|
230
|
+
options = this.options.fixCompilerOptions(options || {});
|
|
231
|
+
}
|
|
232
|
+
return origCreateProgram(rootNames, options, host, oldProgram, configDiagnostics, references);
|
|
233
|
+
};
|
|
226
234
|
const origAfterProgramCreate = host.afterProgramCreate;
|
|
227
235
|
host.afterProgramCreate = (program) => {
|
|
228
236
|
if (ts.getPreEmitDiagnostics(program.getProgram()).length === 0) {
|
|
@@ -234,7 +242,13 @@ let Application = Application_1 = class Application extends component_1.Childabl
|
|
|
234
242
|
ts.createWatchProgram(host);
|
|
235
243
|
}
|
|
236
244
|
validate(project) {
|
|
237
|
-
|
|
245
|
+
const checks = this.options.getValue("validation");
|
|
246
|
+
if (checks.notExported) {
|
|
247
|
+
(0, exports_1.validateExports)(project, this.logger, this.options.getValue("intentionallyNotExported"));
|
|
248
|
+
}
|
|
249
|
+
// checks.invalidLink is currently handled when rendering by the MarkedLinksPlugin.
|
|
250
|
+
// It should really move here, but I'm putting that off until done refactoring the comment
|
|
251
|
+
// parsing so that we don't have duplicate parse logic all over the place.
|
|
238
252
|
}
|
|
239
253
|
/**
|
|
240
254
|
* Render HTML for the given project
|
|
@@ -26,6 +26,7 @@ function convertExpression(expression) {
|
|
|
26
26
|
case ts.SyntaxKind.NullKeyword:
|
|
27
27
|
case ts.SyntaxKind.NumericLiteral:
|
|
28
28
|
case ts.SyntaxKind.PrefixUnaryExpression:
|
|
29
|
+
case ts.SyntaxKind.Identifier:
|
|
29
30
|
return expression.getText();
|
|
30
31
|
}
|
|
31
32
|
if (ts.isArrayLiteralExpression(expression) &&
|
|
@@ -36,6 +37,19 @@ function convertExpression(expression) {
|
|
|
36
37
|
expression.properties.length === 0) {
|
|
37
38
|
return "{}";
|
|
38
39
|
}
|
|
40
|
+
// a.b.c.d
|
|
41
|
+
if (ts.isPropertyAccessExpression(expression)) {
|
|
42
|
+
const parts = [expression.name.getText()];
|
|
43
|
+
let iter = expression.expression;
|
|
44
|
+
while (ts.isPropertyAccessExpression(iter)) {
|
|
45
|
+
parts.unshift(iter.name.getText());
|
|
46
|
+
iter = iter.expression;
|
|
47
|
+
}
|
|
48
|
+
if (ts.isIdentifier(iter)) {
|
|
49
|
+
parts.unshift(iter.text);
|
|
50
|
+
return parts.join(".");
|
|
51
|
+
}
|
|
52
|
+
}
|
|
39
53
|
// More complex expressions are generally not useful in the documentation.
|
|
40
54
|
// Show that there was a value, but not specifics.
|
|
41
55
|
return "...";
|
|
@@ -195,6 +195,9 @@ function parseComment(text, comment = new index_1.Comment()) {
|
|
|
195
195
|
if (tagName === "return") {
|
|
196
196
|
tagName = "returns";
|
|
197
197
|
}
|
|
198
|
+
if (tagName === "example") {
|
|
199
|
+
line = line.replace(/<\/?caption>/g, "");
|
|
200
|
+
}
|
|
198
201
|
if (tagName === "param" ||
|
|
199
202
|
tagName === "typeparam" ||
|
|
200
203
|
tagName === "template" ||
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Reflection } from "../../models";
|
|
1
|
+
import { Reflection, DeclarationReflection } from "../../models";
|
|
2
2
|
import { ReflectionCategory } from "../../models/ReflectionCategory";
|
|
3
3
|
import { ConverterComponent } from "../components";
|
|
4
4
|
/**
|
|
@@ -42,7 +42,7 @@ export declare class CategoryPlugin extends ConverterComponent {
|
|
|
42
42
|
* @param reflections The reflections that should be categorized.
|
|
43
43
|
* @returns An array containing all children of the given reflection categorized
|
|
44
44
|
*/
|
|
45
|
-
static getReflectionCategories(reflections:
|
|
45
|
+
static getReflectionCategories(reflections: DeclarationReflection[]): ReflectionCategory[];
|
|
46
46
|
/**
|
|
47
47
|
* Return the category of a given reflection.
|
|
48
48
|
*
|
|
@@ -141,9 +141,29 @@ let CommentPlugin = CommentPlugin_1 = class CommentPlugin extends components_1.C
|
|
|
141
141
|
onDeclaration(context, reflection, node) {
|
|
142
142
|
var _a, _b;
|
|
143
143
|
if (reflection.kindOf(index_2.ReflectionKind.FunctionOrMethod)) {
|
|
144
|
-
|
|
144
|
+
// We only want a comment on functions/methods if this is a set of overloaded functions.
|
|
145
|
+
// In that case, TypeDoc lets you put a comment on the implementation, and will copy it over to
|
|
146
|
+
// the available signatures so that you can avoid documenting things multiple times.
|
|
147
|
+
// Once TypeDoc has proper support for TSDoc, this will go away since the same thing will be
|
|
148
|
+
// possible by using a @inheritDoc tag to specify that docs should be copied from a specific signature.
|
|
149
|
+
let specialOverloadCase = false;
|
|
150
|
+
if (node &&
|
|
151
|
+
(ts.isFunctionDeclaration(node) || ts.isMethodDeclaration(node))) {
|
|
152
|
+
const symbol = node.name && context.checker.getSymbolAtLocation(node.name);
|
|
153
|
+
if (symbol && symbol.declarations) {
|
|
154
|
+
const declarations = symbol.declarations.filter((d) => ts.isFunctionDeclaration(d) ||
|
|
155
|
+
ts.isMethodDeclaration(d));
|
|
156
|
+
if (declarations.length > 1 &&
|
|
157
|
+
"body" in declarations[declarations.length - 1]) {
|
|
158
|
+
node = declarations[declarations.length - 1];
|
|
159
|
+
specialOverloadCase = true;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (!specialOverloadCase)
|
|
164
|
+
return;
|
|
145
165
|
}
|
|
146
|
-
// Clean this up in 0.
|
|
166
|
+
// Clean this up in 0.23. We should really accept a ts.Symbol so we don't need exportSymbol on Context
|
|
147
167
|
const exportNode = (_b = (_a = context.exportSymbol) === null || _a === void 0 ? void 0 : _a.getDeclarations()) === null || _b === void 0 ? void 0 : _b[0];
|
|
148
168
|
let rawComment = exportNode && (0, comment_1.getRawComment)(exportNode, this.application.logger);
|
|
149
169
|
rawComment !== null && rawComment !== void 0 ? rawComment : (rawComment = node && (0, comment_1.getRawComment)(node, this.application.logger));
|
|
@@ -220,13 +240,13 @@ let CommentPlugin = CommentPlugin_1 = class CommentPlugin extends components_1.C
|
|
|
220
240
|
if (!signatures.length) {
|
|
221
241
|
return;
|
|
222
242
|
}
|
|
223
|
-
let movedComment = false;
|
|
224
243
|
const comment = reflection.comment;
|
|
225
244
|
if (comment && comment.hasTag("returns")) {
|
|
226
245
|
comment.returns = comment.getTag("returns").text;
|
|
227
246
|
comment.removeTags("returns");
|
|
228
247
|
}
|
|
229
248
|
signatures.forEach((signature) => {
|
|
249
|
+
var _a, _b;
|
|
230
250
|
let childComment = signature.comment;
|
|
231
251
|
if (childComment && childComment.hasTag("returns")) {
|
|
232
252
|
childComment.returns = childComment.getTag("returns").text;
|
|
@@ -234,34 +254,60 @@ let CommentPlugin = CommentPlugin_1 = class CommentPlugin extends components_1.C
|
|
|
234
254
|
}
|
|
235
255
|
if (comment) {
|
|
236
256
|
if (!childComment) {
|
|
237
|
-
movedComment = true;
|
|
238
257
|
childComment = signature.comment = new index_1.Comment();
|
|
239
258
|
}
|
|
240
|
-
childComment.shortText =
|
|
241
|
-
|
|
242
|
-
childComment.
|
|
243
|
-
childComment.
|
|
244
|
-
|
|
259
|
+
childComment.shortText || (childComment.shortText = comment.shortText);
|
|
260
|
+
childComment.text || (childComment.text = comment.text);
|
|
261
|
+
childComment.returns || (childComment.returns = comment.returns);
|
|
262
|
+
childComment.tags = childComment.tags.length
|
|
263
|
+
? childComment.tags
|
|
264
|
+
: [...comment.tags];
|
|
245
265
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
if (
|
|
253
|
-
|
|
266
|
+
(_a = signature.parameters) === null || _a === void 0 ? void 0 : _a.forEach((parameter, index) => {
|
|
267
|
+
var _a;
|
|
268
|
+
let tag;
|
|
269
|
+
if (childComment && parameter.name === "__namedParameters") {
|
|
270
|
+
const commentParams = childComment === null || childComment === void 0 ? void 0 : childComment.tags.filter((tag) => tag.tagName === "param" &&
|
|
271
|
+
!tag.paramName.includes("."));
|
|
272
|
+
if (((_a = signature.parameters) === null || _a === void 0 ? void 0 : _a.length) === commentParams.length &&
|
|
273
|
+
commentParams[index].paramName) {
|
|
274
|
+
parameter.name = commentParams[index].paramName;
|
|
254
275
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
276
|
+
}
|
|
277
|
+
if (childComment) {
|
|
278
|
+
moveNestedParamTags(childComment, parameter);
|
|
279
|
+
tag = childComment.getTag("param", parameter.name);
|
|
280
|
+
}
|
|
281
|
+
if (comment && !tag) {
|
|
282
|
+
tag = comment.getTag("param", parameter.name);
|
|
283
|
+
}
|
|
284
|
+
if (tag) {
|
|
285
|
+
parameter.comment = new index_1.Comment(tag.text);
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
(_b = signature.typeParameters) === null || _b === void 0 ? void 0 : _b.forEach((parameter) => {
|
|
289
|
+
let tag;
|
|
290
|
+
if (childComment) {
|
|
291
|
+
tag =
|
|
292
|
+
childComment.getTag("typeparam", parameter.name) ||
|
|
293
|
+
childComment.getTag("template", parameter.name) ||
|
|
294
|
+
childComment.getTag("param", `<${parameter.name}>`);
|
|
295
|
+
}
|
|
296
|
+
if (comment && !tag) {
|
|
297
|
+
tag =
|
|
298
|
+
comment.getTag("typeparam", parameter.name) ||
|
|
299
|
+
comment.getTag("template", parameter.name) ||
|
|
300
|
+
comment.getTag("param", `<${parameter.name}>`);
|
|
301
|
+
}
|
|
302
|
+
if (tag) {
|
|
303
|
+
parameter.comment = new index_1.Comment(tag.text);
|
|
304
|
+
}
|
|
305
|
+
});
|
|
260
306
|
childComment === null || childComment === void 0 ? void 0 : childComment.removeTags("param");
|
|
307
|
+
childComment === null || childComment === void 0 ? void 0 : childComment.removeTags("typeparam");
|
|
308
|
+
childComment === null || childComment === void 0 ? void 0 : childComment.removeTags("template");
|
|
261
309
|
});
|
|
262
|
-
|
|
263
|
-
if (movedComment)
|
|
264
|
-
reflection.comment = void 0;
|
|
310
|
+
delete reflection.comment;
|
|
265
311
|
}
|
|
266
312
|
removeExcludedTags(comment) {
|
|
267
313
|
for (const tag of TAG_BLACKLIST) {
|
|
@@ -301,3 +347,18 @@ CommentPlugin = CommentPlugin_1 = __decorate([
|
|
|
301
347
|
(0, components_1.Component)({ name: "comment" })
|
|
302
348
|
], CommentPlugin);
|
|
303
349
|
exports.CommentPlugin = CommentPlugin;
|
|
350
|
+
// Moves tags like `@param foo.bar docs for bar` into the `bar` property of the `foo` parameter.
|
|
351
|
+
function moveNestedParamTags(comment, parameter) {
|
|
352
|
+
if (parameter.type instanceof models_1.ReflectionType) {
|
|
353
|
+
const tags = comment.tags.filter((t) => t.tagName === "param" &&
|
|
354
|
+
t.paramName.startsWith(`${parameter.name}.`));
|
|
355
|
+
for (const tag of tags) {
|
|
356
|
+
const path = tag.paramName.split(".");
|
|
357
|
+
path.shift();
|
|
358
|
+
const child = parameter.type.declaration.getChildByName(path);
|
|
359
|
+
if (child && !child.comment) {
|
|
360
|
+
child.comment = new index_1.Comment(tag.text);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ConverterComponent } from "../components";
|
|
2
|
+
import { RepositoryType } from "../../models";
|
|
2
3
|
/**
|
|
3
4
|
* Stores data of a repository.
|
|
4
5
|
*/
|
|
@@ -18,20 +19,24 @@ export declare class Repository {
|
|
|
18
19
|
/**
|
|
19
20
|
* The user/organization name of this repository on GitHub.
|
|
20
21
|
*/
|
|
21
|
-
|
|
22
|
+
user?: string;
|
|
22
23
|
/**
|
|
23
24
|
* The project name of this repository on GitHub.
|
|
24
25
|
*/
|
|
25
|
-
|
|
26
|
+
project?: string;
|
|
26
27
|
/**
|
|
27
|
-
* The hostname for this
|
|
28
|
+
* The hostname for this GitHub or Bitbucket project.
|
|
28
29
|
*
|
|
29
30
|
* Defaults to: `github.com` (for normal, public GitHub instance projects)
|
|
30
31
|
*
|
|
31
32
|
* Or the hostname for an enterprise version of GitHub, e.g. `github.acme.com`
|
|
32
33
|
* (if found as a match in the list of git remotes).
|
|
33
34
|
*/
|
|
34
|
-
|
|
35
|
+
hostname: string;
|
|
36
|
+
/**
|
|
37
|
+
* Whether this is a GitHub or Bitbucket repository.
|
|
38
|
+
*/
|
|
39
|
+
type: RepositoryType;
|
|
35
40
|
/**
|
|
36
41
|
* Create a new Repository instance.
|
|
37
42
|
*
|
|
@@ -46,12 +51,12 @@ export declare class Repository {
|
|
|
46
51
|
*/
|
|
47
52
|
contains(fileName: string): boolean;
|
|
48
53
|
/**
|
|
49
|
-
* Get the URL of the given file on GitHub.
|
|
54
|
+
* Get the URL of the given file on GitHub or Bitbucket.
|
|
50
55
|
*
|
|
51
|
-
* @param fileName The file whose
|
|
52
|
-
* @returns
|
|
56
|
+
* @param fileName The file whose URL should be determined.
|
|
57
|
+
* @returns A URL pointing to the web preview of the given file or undefined.
|
|
53
58
|
*/
|
|
54
|
-
|
|
59
|
+
getURL(fileName: string): string | undefined;
|
|
55
60
|
/**
|
|
56
61
|
* Try to create a new repository instance.
|
|
57
62
|
*
|
|
@@ -62,6 +67,7 @@ export declare class Repository {
|
|
|
62
67
|
* @returns A new instance of {@link Repository} or undefined.
|
|
63
68
|
*/
|
|
64
69
|
static tryCreateRepository(path: string, gitRevision: string, gitRemote: string): Repository | undefined;
|
|
70
|
+
static getLineNumberAnchor(lineNumber: number, repositoryType: RepositoryType | undefined): string;
|
|
65
71
|
}
|
|
66
72
|
/**
|
|
67
73
|
* A handler that watches for repositories with GitHub origin and links
|
|
@@ -13,6 +13,7 @@ const components_1 = require("../components");
|
|
|
13
13
|
const base_path_1 = require("../utils/base-path");
|
|
14
14
|
const converter_1 = require("../converter");
|
|
15
15
|
const utils_1 = require("../../utils");
|
|
16
|
+
const models_1 = require("../../models");
|
|
16
17
|
function git(...args) {
|
|
17
18
|
return (0, child_process_1.spawnSync)("git", args, { encoding: "utf-8", windowsHide: true });
|
|
18
19
|
}
|
|
@@ -31,28 +32,39 @@ class Repository {
|
|
|
31
32
|
*/
|
|
32
33
|
this.files = [];
|
|
33
34
|
/**
|
|
34
|
-
* The hostname for this
|
|
35
|
+
* The hostname for this GitHub or Bitbucket project.
|
|
35
36
|
*
|
|
36
37
|
* Defaults to: `github.com` (for normal, public GitHub instance projects)
|
|
37
38
|
*
|
|
38
39
|
* Or the hostname for an enterprise version of GitHub, e.g. `github.acme.com`
|
|
39
40
|
* (if found as a match in the list of git remotes).
|
|
40
41
|
*/
|
|
41
|
-
this.
|
|
42
|
+
this.hostname = "github.com";
|
|
43
|
+
/**
|
|
44
|
+
* Whether this is a GitHub or Bitbucket repository.
|
|
45
|
+
*/
|
|
46
|
+
this.type = models_1.RepositoryType.GitHub;
|
|
42
47
|
this.path = path;
|
|
43
48
|
this.branch = gitRevision || "master";
|
|
44
49
|
for (let i = 0, c = repoLinks.length; i < c; i++) {
|
|
45
|
-
|
|
46
|
-
if (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
let match = /(github(?:\.[a-z]+)*\.[a-z]{2,})[:/]([^/]+)\/(.*)/.exec(repoLinks[i]);
|
|
51
|
+
if (!match) {
|
|
52
|
+
match = /(bitbucket.org)[:/]([^/]+)\/(.*)/.exec(repoLinks[i]);
|
|
53
|
+
}
|
|
54
|
+
if (match) {
|
|
55
|
+
this.hostname = match[1];
|
|
56
|
+
this.user = match[2];
|
|
57
|
+
this.project = match[3];
|
|
58
|
+
if (this.project.substr(-4) === ".git") {
|
|
59
|
+
this.project = this.project.substr(0, this.project.length - 4);
|
|
52
60
|
}
|
|
53
61
|
break;
|
|
54
62
|
}
|
|
55
63
|
}
|
|
64
|
+
if (this.hostname.includes("bitbucket.org"))
|
|
65
|
+
this.type = models_1.RepositoryType.Bitbucket;
|
|
66
|
+
else
|
|
67
|
+
this.type = models_1.RepositoryType.GitHub;
|
|
56
68
|
let out = git("-C", path, "ls-files");
|
|
57
69
|
if (out.status === 0) {
|
|
58
70
|
out.stdout.split("\n").forEach((file) => {
|
|
@@ -78,22 +90,20 @@ class Repository {
|
|
|
78
90
|
return this.files.includes(fileName);
|
|
79
91
|
}
|
|
80
92
|
/**
|
|
81
|
-
* Get the URL of the given file on GitHub.
|
|
93
|
+
* Get the URL of the given file on GitHub or Bitbucket.
|
|
82
94
|
*
|
|
83
|
-
* @param fileName The file whose
|
|
84
|
-
* @returns
|
|
95
|
+
* @param fileName The file whose URL should be determined.
|
|
96
|
+
* @returns A URL pointing to the web preview of the given file or undefined.
|
|
85
97
|
*/
|
|
86
|
-
|
|
87
|
-
if (!this.
|
|
88
|
-
!this.gitHubProject ||
|
|
89
|
-
!this.contains(fileName)) {
|
|
98
|
+
getURL(fileName) {
|
|
99
|
+
if (!this.user || !this.project || !this.contains(fileName)) {
|
|
90
100
|
return;
|
|
91
101
|
}
|
|
92
102
|
return [
|
|
93
|
-
`https://${this.
|
|
94
|
-
this.
|
|
95
|
-
this.
|
|
96
|
-
"blob",
|
|
103
|
+
`https://${this.hostname}`,
|
|
104
|
+
this.user,
|
|
105
|
+
this.project,
|
|
106
|
+
this.type === "github" ? "blob" : "src",
|
|
97
107
|
this.branch,
|
|
98
108
|
fileName.substr(this.path.length + 1),
|
|
99
109
|
].join("/");
|
|
@@ -115,6 +125,15 @@ class Repository {
|
|
|
115
125
|
}
|
|
116
126
|
return new Repository(base_path_1.BasePath.normalize(out.stdout.replace("\n", "")), gitRevision, remotesOutput.stdout.split("\n"));
|
|
117
127
|
}
|
|
128
|
+
static getLineNumberAnchor(lineNumber, repositoryType) {
|
|
129
|
+
switch (repositoryType) {
|
|
130
|
+
default:
|
|
131
|
+
case models_1.RepositoryType.GitHub:
|
|
132
|
+
return "L" + lineNumber;
|
|
133
|
+
case models_1.RepositoryType.Bitbucket:
|
|
134
|
+
return "lines-" + lineNumber;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
118
137
|
}
|
|
119
138
|
exports.Repository = Repository;
|
|
120
139
|
/**
|
|
@@ -185,7 +204,8 @@ let GitHubPlugin = class GitHubPlugin extends components_1.ConverterComponent {
|
|
|
185
204
|
project.files.forEach((sourceFile) => {
|
|
186
205
|
const repository = this.getRepository(sourceFile.fullFileName);
|
|
187
206
|
if (repository) {
|
|
188
|
-
sourceFile.url = repository.
|
|
207
|
+
sourceFile.url = repository.getURL(sourceFile.fullFileName);
|
|
208
|
+
sourceFile.repositoryType = repository.type;
|
|
189
209
|
}
|
|
190
210
|
});
|
|
191
211
|
for (const key in project.reflections) {
|
|
@@ -193,7 +213,10 @@ let GitHubPlugin = class GitHubPlugin extends components_1.ConverterComponent {
|
|
|
193
213
|
if (reflection.sources) {
|
|
194
214
|
reflection.sources.forEach((source) => {
|
|
195
215
|
if (source.file && source.file.url) {
|
|
196
|
-
source.url =
|
|
216
|
+
source.url =
|
|
217
|
+
source.file.url +
|
|
218
|
+
"#" +
|
|
219
|
+
Repository.getLineNumberAnchor(source.line, source.file.repositoryType);
|
|
197
220
|
}
|
|
198
221
|
});
|
|
199
222
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReflectionKind, DeclarationReflection } from "../../models/reflections/index";
|
|
2
2
|
import { ReflectionGroup } from "../../models/ReflectionGroup";
|
|
3
3
|
import { ConverterComponent } from "../components";
|
|
4
4
|
import { SortStrategy } from "../../utils/sort";
|
|
@@ -53,7 +53,7 @@ export declare class GroupPlugin extends ConverterComponent {
|
|
|
53
53
|
* @param reflections The reflections that should be grouped.
|
|
54
54
|
* @returns An array containing all children of the given reflection grouped by their kind.
|
|
55
55
|
*/
|
|
56
|
-
static getReflectionGroups(reflections:
|
|
56
|
+
static getReflectionGroups(reflections: DeclarationReflection[]): ReflectionGroup[];
|
|
57
57
|
/**
|
|
58
58
|
* Transform the internal typescript kind identifier into a human readable version.
|
|
59
59
|
*
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export { CategoryPlugin } from "./CategoryPlugin";
|
|
2
2
|
export { CommentPlugin } from "./CommentPlugin";
|
|
3
3
|
export { DecoratorPlugin } from "./DecoratorPlugin";
|
|
4
|
-
export { DeepCommentPlugin } from "./DeepCommentPlugin";
|
|
5
4
|
export { GitHubPlugin } from "./GitHubPlugin";
|
|
6
5
|
export { GroupPlugin } from "./GroupPlugin";
|
|
7
6
|
export { ImplementsPlugin } from "./ImplementsPlugin";
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InheritDocPlugin = exports.TypePlugin = exports.SourcePlugin = exports.PackagePlugin = exports.ImplementsPlugin = exports.GroupPlugin = exports.GitHubPlugin = exports.
|
|
3
|
+
exports.InheritDocPlugin = exports.TypePlugin = exports.SourcePlugin = exports.PackagePlugin = exports.ImplementsPlugin = exports.GroupPlugin = exports.GitHubPlugin = exports.DecoratorPlugin = exports.CommentPlugin = exports.CategoryPlugin = void 0;
|
|
4
4
|
var CategoryPlugin_1 = require("./CategoryPlugin");
|
|
5
5
|
Object.defineProperty(exports, "CategoryPlugin", { enumerable: true, get: function () { return CategoryPlugin_1.CategoryPlugin; } });
|
|
6
6
|
var CommentPlugin_1 = require("./CommentPlugin");
|
|
7
7
|
Object.defineProperty(exports, "CommentPlugin", { enumerable: true, get: function () { return CommentPlugin_1.CommentPlugin; } });
|
|
8
8
|
var DecoratorPlugin_1 = require("./DecoratorPlugin");
|
|
9
9
|
Object.defineProperty(exports, "DecoratorPlugin", { enumerable: true, get: function () { return DecoratorPlugin_1.DecoratorPlugin; } });
|
|
10
|
-
var DeepCommentPlugin_1 = require("./DeepCommentPlugin");
|
|
11
|
-
Object.defineProperty(exports, "DeepCommentPlugin", { enumerable: true, get: function () { return DeepCommentPlugin_1.DeepCommentPlugin; } });
|
|
12
10
|
var GitHubPlugin_1 = require("./GitHubPlugin");
|
|
13
11
|
Object.defineProperty(exports, "GitHubPlugin", { enumerable: true, get: function () { return GitHubPlugin_1.GitHubPlugin; } });
|
|
14
12
|
var GroupPlugin_1 = require("./GroupPlugin");
|