typedoc 0.22.6 → 0.22.10
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 +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -1
- package/dist/lib/application.js +5 -3
- package/dist/lib/converter/converter.d.ts +2 -2
- package/dist/lib/converter/converter.js +26 -9
- package/dist/lib/converter/plugins/CategoryPlugin.d.ts +2 -2
- package/dist/lib/converter/plugins/CategoryPlugin.js +11 -7
- package/dist/lib/converter/plugins/{GitHubPlugin.d.ts → SourceLinkPlugin.d.ts} +4 -4
- package/dist/lib/converter/plugins/{GitHubPlugin.js → SourceLinkPlugin.js} +37 -16
- package/dist/lib/converter/plugins/index.d.ts +1 -1
- package/dist/lib/converter/plugins/index.js +3 -3
- package/dist/lib/converter/symbols.js +5 -2
- package/dist/lib/converter/types.d.ts +4 -4
- package/dist/lib/converter/utils/reflections.d.ts +2 -2
- package/dist/lib/models/reflections/abstract.js +12 -6
- package/dist/lib/models/reflections/declaration.d.ts +3 -2
- package/dist/lib/models/reflections/parameter.d.ts +2 -2
- package/dist/lib/models/sources/repository.d.ts +2 -1
- package/dist/lib/models/sources/repository.js +1 -0
- package/dist/lib/models/types.d.ts +2 -2
- package/dist/lib/output/index.d.ts +1 -0
- package/dist/lib/output/renderer.d.ts +34 -0
- package/dist/lib/output/renderer.js +14 -0
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +2 -0
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +1 -0
- package/dist/lib/output/themes/default/layouts/default.js +12 -8
- package/dist/lib/output/themes/default/partials/analytics.js +9 -13
- package/dist/lib/output/themes/default/partials/member.declaration.js +1 -4
- package/dist/lib/output/themes/default/partials/member.signature.title.js +1 -4
- package/dist/lib/output/themes/default/partials/member.sources.js +32 -18
- package/dist/lib/output/themes/default/partials/type.js +49 -1
- package/dist/lib/output/themes/lib.d.ts +1 -0
- package/dist/lib/output/themes/lib.js +8 -1
- package/dist/lib/utils/array.d.ts +11 -0
- package/dist/lib/utils/array.js +15 -1
- package/dist/lib/utils/general.d.ts +1 -0
- package/dist/lib/utils/general.js +14 -0
- package/dist/lib/utils/hooks.d.ts +56 -0
- package/dist/lib/utils/hooks.js +102 -0
- package/dist/lib/utils/index.d.ts +2 -1
- package/dist/lib/utils/index.js +4 -2
- package/dist/lib/utils/jsx.elements.d.ts +0 -1
- package/dist/lib/utils/options/options.d.ts +2 -0
- package/dist/lib/utils/plugins.d.ts +1 -1
- package/dist/lib/utils/plugins.js +10 -4
- package/package.json +18 -18
- package/static/main.js +1 -1
- package/static/style.css +4 -0
package/README.md
CHANGED
|
@@ -99,8 +99,8 @@ For a complete list of the command line arguments run `typedoc --help` or visit
|
|
|
99
99
|
|
|
100
100
|
#### Theming
|
|
101
101
|
|
|
102
|
-
- `--theme <default|
|
|
103
|
-
Specify the
|
|
102
|
+
- `--theme <default|plugin defined theme>`<br>
|
|
103
|
+
Specify the theme that should be used.
|
|
104
104
|
- `--name <Documentation title>`<br>
|
|
105
105
|
Set the name of the project that will be used in the header of the template.
|
|
106
106
|
- `--readme <path/to/readme|none>`<br>
|
package/dist/index.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ export { normalizePath } from "./lib/utils/fs";
|
|
|
5
5
|
export * from "./lib/models";
|
|
6
6
|
export { Converter, Context } from "./lib/converter";
|
|
7
7
|
export { Renderer, DefaultTheme, DefaultThemeRenderContext, UrlMapping, Theme, PageEvent, RendererEvent, MarkdownEvent, } from "./lib/output";
|
|
8
|
-
export type { RenderTemplate } from "./lib/output";
|
|
9
|
-
export { ArgumentsReader, BindOption, JSX, LogLevel, Logger, Options, ParameterHint, ParameterType, TSConfigReader, TypeDocReader, EntryPointStrategy, } from "./lib/utils";
|
|
8
|
+
export type { RenderTemplate, RendererHooks } from "./lib/output";
|
|
9
|
+
export { ArgumentsReader, BindOption, JSX, LogLevel, Logger, Options, ParameterHint, ParameterType, TSConfigReader, TypeDocReader, EntryPointStrategy, EventHooks, } from "./lib/utils";
|
|
10
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";
|
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.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;
|
|
13
|
+
exports.TypeScript = exports.SerializeEvent = exports.SerializerComponent = exports.Serializer = exports.JSONOutput = exports.EventHooks = 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");
|
|
@@ -45,6 +45,7 @@ Object.defineProperty(exports, "ParameterType", { enumerable: true, get: functio
|
|
|
45
45
|
Object.defineProperty(exports, "TSConfigReader", { enumerable: true, get: function () { return utils_1.TSConfigReader; } });
|
|
46
46
|
Object.defineProperty(exports, "TypeDocReader", { enumerable: true, get: function () { return utils_1.TypeDocReader; } });
|
|
47
47
|
Object.defineProperty(exports, "EntryPointStrategy", { enumerable: true, get: function () { return utils_1.EntryPointStrategy; } });
|
|
48
|
+
Object.defineProperty(exports, "EventHooks", { enumerable: true, get: function () { return utils_1.EventHooks; } });
|
|
48
49
|
var serialization_1 = require("./lib/serialization");
|
|
49
50
|
Object.defineProperty(exports, "JSONOutput", { enumerable: true, get: function () { return serialization_1.JSONOutput; } });
|
|
50
51
|
Object.defineProperty(exports, "Serializer", { enumerable: true, get: function () { return serialization_1.Serializer; } });
|
package/dist/lib/application.js
CHANGED
|
@@ -21,6 +21,7 @@ const exports_1 = require("./validation/exports");
|
|
|
21
21
|
const assert_1 = require("assert");
|
|
22
22
|
const entry_point_1 = require("./utils/entry-point");
|
|
23
23
|
const paths_1 = require("./utils/paths");
|
|
24
|
+
const general_1 = require("./utils/general");
|
|
24
25
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
25
26
|
const packageInfo = require("../../package.json");
|
|
26
27
|
const supportedVersionMajorMinor = packageInfo.peerDependencies.typescript
|
|
@@ -79,9 +80,7 @@ let Application = Application_1 = class Application extends component_1.Childabl
|
|
|
79
80
|
this.options.setLogger(this.logger);
|
|
80
81
|
}
|
|
81
82
|
this.logger.level = this.options.getValue("logLevel");
|
|
82
|
-
const plugins =
|
|
83
|
-
? this.options.getValue("plugin")
|
|
84
|
-
: (0, index_2.discoverNpmPlugins)(this);
|
|
83
|
+
const plugins = (0, index_2.discoverPlugins)(this);
|
|
85
84
|
(0, index_2.loadPlugins)(this, plugins);
|
|
86
85
|
this.options.reset();
|
|
87
86
|
for (const [key, val] of Object.entries(options)) {
|
|
@@ -94,6 +93,9 @@ let Application = Application_1 = class Application extends component_1.Childabl
|
|
|
94
93
|
}
|
|
95
94
|
}
|
|
96
95
|
this.options.read(this.logger);
|
|
96
|
+
if ((0, general_1.hasBeenLoadedMultipleTimes)()) {
|
|
97
|
+
this.logger.warn(`TypeDoc has been loaded multiple times. This is commonly caused by plugins which have their own installation of TypeDoc. This will likely break things.`);
|
|
98
|
+
}
|
|
97
99
|
}
|
|
98
100
|
/**
|
|
99
101
|
* Return the application / root component instance.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as ts from "typescript";
|
|
2
2
|
import type { Application } from "../application";
|
|
3
|
-
import {
|
|
3
|
+
import { ProjectReflection, ReflectionKind, SomeType } from "../models/index";
|
|
4
4
|
import { Context } from "./context";
|
|
5
5
|
import { ConverterComponent } from "./components";
|
|
6
6
|
import { ChildableComponent } from "../utils/component";
|
|
@@ -97,7 +97,7 @@ export declare class Converter extends ChildableComponent<Application, Converter
|
|
|
97
97
|
* @returns The TypeDoc type reflection representing the given node and type.
|
|
98
98
|
* @internal
|
|
99
99
|
*/
|
|
100
|
-
convertType(context: Context, node: ts.TypeNode | ts.Type | undefined):
|
|
100
|
+
convertType(context: Context, node: ts.TypeNode | ts.Type | undefined): SomeType;
|
|
101
101
|
/** @internal */
|
|
102
102
|
getNodesForSymbol(symbol: ts.Symbol, kind: ReflectionKind): ts.Declaration[];
|
|
103
103
|
/**
|
|
@@ -354,6 +354,7 @@ function getSymbolForModuleLike(context, node) {
|
|
|
354
354
|
}
|
|
355
355
|
function getExports(context, node, symbol) {
|
|
356
356
|
var _a;
|
|
357
|
+
let result;
|
|
357
358
|
// The generated docs aren't great, but you really ought not be using
|
|
358
359
|
// this in the first place... so it's better than nothing.
|
|
359
360
|
const exportEq = (_a = symbol === null || symbol === void 0 ? void 0 : symbol.exports) === null || _a === void 0 ? void 0 : _a.get("export=");
|
|
@@ -361,21 +362,37 @@ function getExports(context, node, symbol) {
|
|
|
361
362
|
// JS users might also have exported types here.
|
|
362
363
|
// We need to filter for types because otherwise static methods can show up as both
|
|
363
364
|
// members of the export= class and as functions if a class is directly exported.
|
|
364
|
-
|
|
365
|
+
result = [exportEq].concat(context.checker
|
|
365
366
|
.getExportsOfModule(symbol)
|
|
366
367
|
.filter((s) => !(0, enum_1.hasAnyFlag)(s.flags, ts.SymbolFlags.Prototype | ts.SymbolFlags.Value)));
|
|
367
368
|
}
|
|
368
|
-
if (symbol) {
|
|
369
|
-
|
|
369
|
+
else if (symbol) {
|
|
370
|
+
result = context.checker
|
|
370
371
|
.getExportsOfModule(symbol)
|
|
371
372
|
.filter((s) => !(0, enum_1.hasAllFlags)(s.flags, ts.SymbolFlags.Prototype));
|
|
372
373
|
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
374
|
+
else {
|
|
375
|
+
// Global file with no inferred top level symbol, get all symbols declared in this file.
|
|
376
|
+
const sourceFile = node.getSourceFile();
|
|
377
|
+
result = context.checker
|
|
378
|
+
.getSymbolsInScope(node, ts.SymbolFlags.ModuleMember)
|
|
379
|
+
.filter((s) => {
|
|
380
|
+
var _a;
|
|
381
|
+
return (_a = s
|
|
382
|
+
.getDeclarations()) === null || _a === void 0 ? void 0 : _a.some((d) => d.getSourceFile() === sourceFile);
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
// Put symbols named "default" last, #1795
|
|
386
|
+
result.sort((a, b) => {
|
|
387
|
+
if (a.name === "default") {
|
|
388
|
+
return 1;
|
|
389
|
+
}
|
|
390
|
+
else if (b.name === "default") {
|
|
391
|
+
return -1;
|
|
392
|
+
}
|
|
393
|
+
return 0;
|
|
394
|
+
});
|
|
395
|
+
return result;
|
|
379
396
|
}
|
|
380
397
|
function isDirectExport(symbol, file) {
|
|
381
398
|
var _a, _b;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DeclarationReflection } from "../../models";
|
|
2
2
|
import { ReflectionCategory } from "../../models/ReflectionCategory";
|
|
3
3
|
import { ConverterComponent } from "../components";
|
|
4
4
|
/**
|
|
@@ -49,7 +49,7 @@ export declare class CategoryPlugin extends ConverterComponent {
|
|
|
49
49
|
* @param reflection The reflection.
|
|
50
50
|
* @returns The category the reflection belongs to
|
|
51
51
|
*/
|
|
52
|
-
static getCategories(reflection:
|
|
52
|
+
static getCategories(reflection: DeclarationReflection): Set<string>;
|
|
53
53
|
/**
|
|
54
54
|
* Callback used to sort categories by name.
|
|
55
55
|
*
|
|
@@ -143,8 +143,11 @@ let CategoryPlugin = CategoryPlugin_1 = class CategoryPlugin extends components_
|
|
|
143
143
|
* @returns The category the reflection belongs to
|
|
144
144
|
*/
|
|
145
145
|
static getCategories(reflection) {
|
|
146
|
+
var _a, _b, _c;
|
|
146
147
|
function extractCategoryTag(comment) {
|
|
147
148
|
const categories = new Set();
|
|
149
|
+
if (!comment)
|
|
150
|
+
return categories;
|
|
148
151
|
const tags = comment.tags;
|
|
149
152
|
const commentTags = [];
|
|
150
153
|
tags.forEach((tag) => {
|
|
@@ -161,20 +164,21 @@ let CategoryPlugin = CategoryPlugin_1 = class CategoryPlugin extends components_
|
|
|
161
164
|
comment.tags = commentTags;
|
|
162
165
|
return categories;
|
|
163
166
|
}
|
|
164
|
-
|
|
167
|
+
let categories = new Set();
|
|
165
168
|
if (reflection.comment) {
|
|
166
|
-
|
|
169
|
+
categories = extractCategoryTag(reflection.comment);
|
|
167
170
|
}
|
|
168
|
-
else if (reflection
|
|
169
|
-
reflection.signatures) {
|
|
171
|
+
else if (reflection.signatures) {
|
|
170
172
|
for (const sig of reflection.signatures) {
|
|
171
|
-
for (const cat of sig.comment
|
|
172
|
-
? extractCategoryTag(sig.comment)
|
|
173
|
-
: []) {
|
|
173
|
+
for (const cat of extractCategoryTag(sig.comment)) {
|
|
174
174
|
categories.add(cat);
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
|
+
if (((_a = reflection.type) === null || _a === void 0 ? void 0 : _a.type) === "reflection") {
|
|
179
|
+
(_b = reflection.type.declaration.comment) === null || _b === void 0 ? void 0 : _b.removeTags("category");
|
|
180
|
+
(_c = reflection.type.declaration.signatures) === null || _c === void 0 ? void 0 : _c.forEach((s) => { var _a; return (_a = s.comment) === null || _a === void 0 ? void 0 : _a.removeTags("category"); });
|
|
181
|
+
}
|
|
178
182
|
return categories;
|
|
179
183
|
}
|
|
180
184
|
/**
|
|
@@ -25,16 +25,16 @@ export declare class Repository {
|
|
|
25
25
|
*/
|
|
26
26
|
project?: string;
|
|
27
27
|
/**
|
|
28
|
-
* The hostname for this GitHub
|
|
28
|
+
* The hostname for this GitHub/Bitbucket/.etc project.
|
|
29
29
|
*
|
|
30
30
|
* Defaults to: `github.com` (for normal, public GitHub instance projects)
|
|
31
31
|
*
|
|
32
|
-
*
|
|
32
|
+
* Can be the hostname for an enterprise version of GitHub, e.g. `github.acme.com`
|
|
33
33
|
* (if found as a match in the list of git remotes).
|
|
34
34
|
*/
|
|
35
35
|
hostname: string;
|
|
36
36
|
/**
|
|
37
|
-
* Whether this is a GitHub or
|
|
37
|
+
* Whether this is a GitHub, Bitbucket, or other type of repository.
|
|
38
38
|
*/
|
|
39
39
|
type: RepositoryType;
|
|
40
40
|
/**
|
|
@@ -73,7 +73,7 @@ export declare class Repository {
|
|
|
73
73
|
* A handler that watches for repositories with GitHub origin and links
|
|
74
74
|
* their source files to the related GitHub pages.
|
|
75
75
|
*/
|
|
76
|
-
export declare class
|
|
76
|
+
export declare class SourceLinkPlugin extends ConverterComponent {
|
|
77
77
|
/**
|
|
78
78
|
* List of known repositories.
|
|
79
79
|
*/
|
|
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.SourceLinkPlugin = exports.Repository = void 0;
|
|
10
10
|
const Path = require("path");
|
|
11
11
|
const child_process_1 = require("child_process");
|
|
12
12
|
const components_1 = require("../components");
|
|
@@ -14,8 +14,13 @@ const base_path_1 = require("../utils/base-path");
|
|
|
14
14
|
const converter_1 = require("../converter");
|
|
15
15
|
const utils_1 = require("../../utils");
|
|
16
16
|
const models_1 = require("../../models");
|
|
17
|
+
const TEN_MEGABYTES = 1024 * 10000;
|
|
17
18
|
function git(...args) {
|
|
18
|
-
return (0, child_process_1.spawnSync)("git", args, {
|
|
19
|
+
return (0, child_process_1.spawnSync)("git", args, {
|
|
20
|
+
encoding: "utf-8",
|
|
21
|
+
windowsHide: true,
|
|
22
|
+
maxBuffer: TEN_MEGABYTES,
|
|
23
|
+
});
|
|
19
24
|
}
|
|
20
25
|
/**
|
|
21
26
|
* Stores data of a repository.
|
|
@@ -32,25 +37,32 @@ class Repository {
|
|
|
32
37
|
*/
|
|
33
38
|
this.files = [];
|
|
34
39
|
/**
|
|
35
|
-
* The hostname for this GitHub
|
|
40
|
+
* The hostname for this GitHub/Bitbucket/.etc project.
|
|
36
41
|
*
|
|
37
42
|
* Defaults to: `github.com` (for normal, public GitHub instance projects)
|
|
38
43
|
*
|
|
39
|
-
*
|
|
44
|
+
* Can be the hostname for an enterprise version of GitHub, e.g. `github.acme.com`
|
|
40
45
|
* (if found as a match in the list of git remotes).
|
|
41
46
|
*/
|
|
42
47
|
this.hostname = "github.com";
|
|
43
48
|
/**
|
|
44
|
-
* Whether this is a GitHub or
|
|
49
|
+
* Whether this is a GitHub, Bitbucket, or other type of repository.
|
|
45
50
|
*/
|
|
46
51
|
this.type = models_1.RepositoryType.GitHub;
|
|
47
52
|
this.path = path;
|
|
48
53
|
this.branch = gitRevision || "master";
|
|
49
54
|
for (let i = 0, c = repoLinks.length; i < c; i++) {
|
|
50
55
|
let match = /(github(?:\.[a-z]+)*\.[a-z]{2,})[:/]([^/]+)\/(.*)/.exec(repoLinks[i]);
|
|
56
|
+
// Github Enterprise
|
|
57
|
+
if (!match) {
|
|
58
|
+
match = /(\w+\.githubprivate.com)[:/]([^/]+)\/(.*)/.exec(repoLinks[i]);
|
|
59
|
+
}
|
|
51
60
|
if (!match) {
|
|
52
61
|
match = /(bitbucket.org)[:/]([^/]+)\/(.*)/.exec(repoLinks[i]);
|
|
53
62
|
}
|
|
63
|
+
if (!match) {
|
|
64
|
+
match = /(gitlab.com)[:/]([^/]+)\/(.*)/.exec(repoLinks[i]);
|
|
65
|
+
}
|
|
54
66
|
if (match) {
|
|
55
67
|
this.hostname = match[1];
|
|
56
68
|
this.user = match[2];
|
|
@@ -61,10 +73,15 @@ class Repository {
|
|
|
61
73
|
break;
|
|
62
74
|
}
|
|
63
75
|
}
|
|
64
|
-
if (this.hostname.includes("bitbucket.org"))
|
|
76
|
+
if (this.hostname.includes("bitbucket.org")) {
|
|
65
77
|
this.type = models_1.RepositoryType.Bitbucket;
|
|
66
|
-
|
|
78
|
+
}
|
|
79
|
+
else if (this.hostname.includes("gitlab.com")) {
|
|
80
|
+
this.type = models_1.RepositoryType.GitLab;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
67
83
|
this.type = models_1.RepositoryType.GitHub;
|
|
84
|
+
}
|
|
68
85
|
let out = git("-C", path, "ls-files");
|
|
69
86
|
if (out.status === 0) {
|
|
70
87
|
out.stdout.split("\n").forEach((file) => {
|
|
@@ -103,10 +120,13 @@ class Repository {
|
|
|
103
120
|
`https://${this.hostname}`,
|
|
104
121
|
this.user,
|
|
105
122
|
this.project,
|
|
106
|
-
this.type ===
|
|
123
|
+
this.type === models_1.RepositoryType.GitLab ? "-" : undefined,
|
|
124
|
+
this.type === models_1.RepositoryType.Bitbucket ? "src" : "blob",
|
|
107
125
|
this.branch,
|
|
108
126
|
fileName.substr(this.path.length + 1),
|
|
109
|
-
]
|
|
127
|
+
]
|
|
128
|
+
.filter((s) => !!s)
|
|
129
|
+
.join("/");
|
|
110
130
|
}
|
|
111
131
|
/**
|
|
112
132
|
* Try to create a new repository instance.
|
|
@@ -129,6 +149,7 @@ class Repository {
|
|
|
129
149
|
switch (repositoryType) {
|
|
130
150
|
default:
|
|
131
151
|
case models_1.RepositoryType.GitHub:
|
|
152
|
+
case models_1.RepositoryType.GitLab:
|
|
132
153
|
return "L" + lineNumber;
|
|
133
154
|
case models_1.RepositoryType.Bitbucket:
|
|
134
155
|
return "lines-" + lineNumber;
|
|
@@ -140,7 +161,7 @@ exports.Repository = Repository;
|
|
|
140
161
|
* A handler that watches for repositories with GitHub origin and links
|
|
141
162
|
* their source files to the related GitHub pages.
|
|
142
163
|
*/
|
|
143
|
-
let
|
|
164
|
+
let SourceLinkPlugin = class SourceLinkPlugin extends components_1.ConverterComponent {
|
|
144
165
|
constructor() {
|
|
145
166
|
super(...arguments);
|
|
146
167
|
/**
|
|
@@ -225,11 +246,11 @@ let GitHubPlugin = class GitHubPlugin extends components_1.ConverterComponent {
|
|
|
225
246
|
};
|
|
226
247
|
__decorate([
|
|
227
248
|
(0, utils_1.BindOption)("gitRevision")
|
|
228
|
-
],
|
|
249
|
+
], SourceLinkPlugin.prototype, "gitRevision", void 0);
|
|
229
250
|
__decorate([
|
|
230
251
|
(0, utils_1.BindOption)("gitRemote")
|
|
231
|
-
],
|
|
232
|
-
|
|
233
|
-
(0, components_1.Component)({ name: "
|
|
234
|
-
],
|
|
235
|
-
exports.
|
|
252
|
+
], SourceLinkPlugin.prototype, "gitRemote", void 0);
|
|
253
|
+
SourceLinkPlugin = __decorate([
|
|
254
|
+
(0, components_1.Component)({ name: "source-link" })
|
|
255
|
+
], SourceLinkPlugin);
|
|
256
|
+
exports.SourceLinkPlugin = SourceLinkPlugin;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { CategoryPlugin } from "./CategoryPlugin";
|
|
2
2
|
export { CommentPlugin } from "./CommentPlugin";
|
|
3
3
|
export { DecoratorPlugin } from "./DecoratorPlugin";
|
|
4
|
-
export {
|
|
4
|
+
export { SourceLinkPlugin } from "./SourceLinkPlugin";
|
|
5
5
|
export { GroupPlugin } from "./GroupPlugin";
|
|
6
6
|
export { ImplementsPlugin } from "./ImplementsPlugin";
|
|
7
7
|
export { PackagePlugin } from "./PackagePlugin";
|
|
@@ -1,14 +1,14 @@
|
|
|
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.
|
|
3
|
+
exports.InheritDocPlugin = exports.TypePlugin = exports.SourcePlugin = exports.PackagePlugin = exports.ImplementsPlugin = exports.GroupPlugin = exports.SourceLinkPlugin = 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
|
|
11
|
-
Object.defineProperty(exports, "
|
|
10
|
+
var SourceLinkPlugin_1 = require("./SourceLinkPlugin");
|
|
11
|
+
Object.defineProperty(exports, "SourceLinkPlugin", { enumerable: true, get: function () { return SourceLinkPlugin_1.SourceLinkPlugin; } });
|
|
12
12
|
var GroupPlugin_1 = require("./GroupPlugin");
|
|
13
13
|
Object.defineProperty(exports, "GroupPlugin", { enumerable: true, get: function () { return GroupPlugin_1.GroupPlugin; } });
|
|
14
14
|
var ImplementsPlugin_1 = require("./ImplementsPlugin");
|
|
@@ -99,7 +99,10 @@ function convertSymbol(context, symbol, exportSymbol) {
|
|
|
99
99
|
// This might be here if a namespace is declared several times.
|
|
100
100
|
flags = (0, enum_1.removeFlag)(flags, ts.SymbolFlags.ValueModule);
|
|
101
101
|
}
|
|
102
|
-
if ((0, enum_1.
|
|
102
|
+
if ((0, enum_1.hasAnyFlag)(symbol.flags, ts.SymbolFlags.Method |
|
|
103
|
+
ts.SymbolFlags.Interface |
|
|
104
|
+
ts.SymbolFlags.Class |
|
|
105
|
+
ts.SymbolFlags.Variable)) {
|
|
103
106
|
// This happens when someone declares an object with methods:
|
|
104
107
|
// { methodProperty() {} }
|
|
105
108
|
flags = (0, enum_1.removeFlag)(flags, ts.SymbolFlags.Property);
|
|
@@ -528,7 +531,7 @@ function convertAccessor(context, symbol, exportSymbol) {
|
|
|
528
531
|
function isInherited(context, symbol) {
|
|
529
532
|
var _a;
|
|
530
533
|
const parentSymbol = context.project.getSymbolFromReflection(context.scope);
|
|
531
|
-
assert(parentSymbol);
|
|
534
|
+
assert(parentSymbol, `No parent symbol found for ${symbol.name} in ${context.scope.name}`);
|
|
532
535
|
return (((_a = parentSymbol
|
|
533
536
|
.getDeclarations()) === null || _a === void 0 ? void 0 : _a.some((d) => { var _a; return (_a = symbol.getDeclarations()) === null || _a === void 0 ? void 0 : _a.some((d2) => d2.parent === d); })) === false);
|
|
534
537
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as ts from "typescript";
|
|
2
|
-
import {
|
|
2
|
+
import { SomeType } from "../models";
|
|
3
3
|
import type { Context } from "./context";
|
|
4
4
|
export interface TypeConverter<TNode extends ts.TypeNode = ts.TypeNode, TType extends ts.Type = ts.Type> {
|
|
5
5
|
kind: TNode["kind"][];
|
|
6
|
-
convert(context: Context, node: TNode):
|
|
7
|
-
convertType(context: Context, type: TType, node: TNode):
|
|
6
|
+
convert(context: Context, node: TNode): SomeType;
|
|
7
|
+
convertType(context: Context, type: TType, node: TNode): SomeType;
|
|
8
8
|
}
|
|
9
9
|
export declare function loadConverters(): void;
|
|
10
|
-
export declare function convertType(context: Context, typeOrNode: ts.Type | ts.TypeNode | undefined):
|
|
10
|
+
export declare function convertType(context: Context, typeOrNode: ts.Type | ts.TypeNode | undefined): SomeType;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Reflection,
|
|
2
|
-
export declare function removeUndefined(type:
|
|
1
|
+
import { Reflection, SomeType } from "../../models";
|
|
2
|
+
export declare function removeUndefined(type: SomeType): SomeType;
|
|
3
3
|
/**
|
|
4
4
|
* Copy the comment of the source reflection to the target reflection.
|
|
5
5
|
*
|
|
@@ -83,7 +83,9 @@ var ReflectionKind;
|
|
|
83
83
|
ReflectionKind.Function |
|
|
84
84
|
ReflectionKind.ObjectLiteral;
|
|
85
85
|
/** @internal */
|
|
86
|
-
ReflectionKind.Inheritable = ReflectionKind.
|
|
86
|
+
ReflectionKind.Inheritable = ReflectionKind.Accessor |
|
|
87
|
+
ReflectionKind.IndexSignature |
|
|
88
|
+
ReflectionKind.Property |
|
|
87
89
|
ReflectionKind.Method |
|
|
88
90
|
ReflectionKind.Constructor;
|
|
89
91
|
})(ReflectionKind = exports.ReflectionKind || (exports.ReflectionKind = {}));
|
|
@@ -316,14 +318,18 @@ class Reflection {
|
|
|
316
318
|
target = target.parent;
|
|
317
319
|
}
|
|
318
320
|
if (!target._aliases) {
|
|
319
|
-
target._aliases =
|
|
321
|
+
target._aliases = new Map();
|
|
322
|
+
}
|
|
323
|
+
let suffix = "";
|
|
324
|
+
if (!target._aliases.has(alias)) {
|
|
325
|
+
target._aliases.set(alias, 1);
|
|
320
326
|
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
suffix = "-" +
|
|
327
|
+
else {
|
|
328
|
+
const count = target._aliases.get(alias);
|
|
329
|
+
suffix = "-" + count.toString();
|
|
330
|
+
target._aliases.set(alias, count + 1);
|
|
324
331
|
}
|
|
325
332
|
alias += suffix;
|
|
326
|
-
target._aliases.push(alias);
|
|
327
333
|
this._alias = alias;
|
|
328
334
|
}
|
|
329
335
|
return this._alias;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type * as ts from "typescript";
|
|
2
|
+
import type { SomeType } from "..";
|
|
2
3
|
import { ReferenceType, Type } from "../types";
|
|
3
4
|
import { TraverseCallback } from "./abstract";
|
|
4
5
|
import { ContainerReflection } from "./container";
|
|
@@ -42,12 +43,12 @@ export declare class DeclarationReflection extends ContainerReflection {
|
|
|
42
43
|
* If the reflection represents a variable or a property, this is the value type.<br />
|
|
43
44
|
* If the reflection represents a signature, this is the return type.
|
|
44
45
|
*/
|
|
45
|
-
type?:
|
|
46
|
+
type?: SomeType;
|
|
46
47
|
typeParameters?: TypeParameterReflection[];
|
|
47
48
|
/**
|
|
48
49
|
* A list of call signatures attached to this declaration.
|
|
49
50
|
*
|
|
50
|
-
* TypeDoc creates one declaration per function that may contain
|
|
51
|
+
* TypeDoc creates one declaration per function that may contain one or more
|
|
51
52
|
* signature reflections.
|
|
52
53
|
*/
|
|
53
54
|
signatures?: SignatureReflection[];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SomeType } from "..";
|
|
2
2
|
import { Reflection, TraverseCallback } from "./abstract";
|
|
3
3
|
import type { SignatureReflection } from "./signature";
|
|
4
4
|
export declare class ParameterReflection extends Reflection {
|
|
5
5
|
parent?: SignatureReflection;
|
|
6
6
|
defaultValue?: string;
|
|
7
|
-
type?:
|
|
7
|
+
type?: SomeType;
|
|
8
8
|
/**
|
|
9
9
|
* Traverse all potential child reflections of this reflection.
|
|
10
10
|
*
|
|
@@ -354,9 +354,9 @@ export declare class TypeOperatorType extends Type {
|
|
|
354
354
|
* ```
|
|
355
355
|
*/
|
|
356
356
|
export declare class UnionType extends Type {
|
|
357
|
-
types:
|
|
357
|
+
types: SomeType[];
|
|
358
358
|
readonly type = "union";
|
|
359
|
-
constructor(types:
|
|
359
|
+
constructor(types: SomeType[]);
|
|
360
360
|
toString(): string;
|
|
361
361
|
private normalize;
|
|
362
362
|
}
|
|
@@ -2,6 +2,7 @@ export { PageEvent, RendererEvent, MarkdownEvent } from "./events";
|
|
|
2
2
|
export { UrlMapping } from "./models/UrlMapping";
|
|
3
3
|
export type { RenderTemplate } from "./models/UrlMapping";
|
|
4
4
|
export { Renderer } from "./renderer";
|
|
5
|
+
export type { RendererHooks } from "./renderer";
|
|
5
6
|
export { Theme } from "./theme";
|
|
6
7
|
export { DefaultTheme } from "./themes/default/DefaultTheme";
|
|
7
8
|
export { DefaultThemeRenderContext } from "./themes/default/DefaultThemeRenderContext";
|
|
@@ -12,7 +12,32 @@ import type { Theme } from "./theme";
|
|
|
12
12
|
import type { ProjectReflection } from "../models/reflections/project";
|
|
13
13
|
import { RendererComponent } from "./components";
|
|
14
14
|
import { ChildableComponent } from "../utils/component";
|
|
15
|
+
import { EventHooks } from "../utils";
|
|
15
16
|
import type { Theme as ShikiTheme } from "shiki";
|
|
17
|
+
import type { JsxElement } from "../utils/jsx.elements";
|
|
18
|
+
import type { DefaultThemeRenderContext } from "./themes/default/DefaultThemeRenderContext";
|
|
19
|
+
/**
|
|
20
|
+
* Describes the hooks available to inject output in the default theme.
|
|
21
|
+
* If the available hooks don't let you put something where you'd like, please open an issue!
|
|
22
|
+
*/
|
|
23
|
+
export interface RendererHooks {
|
|
24
|
+
/**
|
|
25
|
+
* Applied immediately after the opening `<head>` tag.
|
|
26
|
+
*/
|
|
27
|
+
"head.begin": [DefaultThemeRenderContext];
|
|
28
|
+
/**
|
|
29
|
+
* Applied immediately before the closing `</head>` tag.
|
|
30
|
+
*/
|
|
31
|
+
"head.end": [DefaultThemeRenderContext];
|
|
32
|
+
/**
|
|
33
|
+
* Applied immediately after the opening `<body>` tag.
|
|
34
|
+
*/
|
|
35
|
+
"body.begin": [DefaultThemeRenderContext];
|
|
36
|
+
/**
|
|
37
|
+
* Applied immediately before the closing `</body>` tag.
|
|
38
|
+
*/
|
|
39
|
+
"body.end": [DefaultThemeRenderContext];
|
|
40
|
+
}
|
|
16
41
|
/**
|
|
17
42
|
* The renderer processes a {@link ProjectReflection} using a {@link Theme} instance and writes
|
|
18
43
|
* the emitted html documents to a output directory. You can specify which theme should be used
|
|
@@ -56,6 +81,15 @@ export declare class Renderer extends ChildableComponent<Application, RendererCo
|
|
|
56
81
|
* The theme that is used to render the documentation.
|
|
57
82
|
*/
|
|
58
83
|
theme?: Theme;
|
|
84
|
+
/**
|
|
85
|
+
* Hooks which will be called when rendering pages.
|
|
86
|
+
* Note:
|
|
87
|
+
* - Hooks added during output will be discarded at the end of rendering.
|
|
88
|
+
* - Hooks added during a page render will be discarded at the end of that page's render.
|
|
89
|
+
*
|
|
90
|
+
* See {@link RendererHooks} for a description of each available hook, and when it will be called.
|
|
91
|
+
*/
|
|
92
|
+
hooks: EventHooks<RendererHooks, JsxElement>;
|
|
59
93
|
/** @internal */
|
|
60
94
|
themeName: string;
|
|
61
95
|
/** @internal */
|