typedoc 0.23.14 → 0.23.16
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/converter.d.ts +1 -1
- package/dist/lib/converter/converter.js +2 -2
- package/dist/lib/converter/factories/signature.js +6 -1
- package/dist/lib/converter/jsdoc.js +41 -0
- package/dist/lib/converter/plugins/SourcePlugin.js +1 -1
- package/dist/lib/converter/symbols.js +7 -3
- package/dist/lib/converter/types.js +3 -5
- package/dist/lib/converter/utils/nodes.d.ts +1 -0
- package/dist/lib/converter/utils/nodes.js +5 -1
- package/dist/lib/converter/utils/repository.d.ts +11 -35
- package/dist/lib/converter/utils/repository.js +80 -106
- package/dist/lib/models/reflections/declaration.d.ts +12 -0
- package/dist/lib/models/reflections/declaration.js +17 -1
- package/dist/lib/models/reflections/index.d.ts +1 -1
- package/dist/lib/models/reflections/index.js +2 -1
- package/dist/lib/models/sources/index.d.ts +0 -1
- package/dist/lib/models/sources/index.js +1 -3
- package/dist/lib/output/renderer.js +2 -0
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/hierarchy.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/hierarchy.js +12 -5
- package/dist/lib/output/themes/default/partials/member.declaration.js +1 -3
- package/dist/lib/output/themes/default/partials/member.signature.body.js +1 -3
- package/dist/lib/output/themes/default/partials/type.d.ts +1 -0
- package/dist/lib/output/themes/default/partials/type.js +26 -6
- package/dist/lib/utils/entry-point.js +16 -4
- package/dist/lib/utils/package-manifest.d.ts +1 -0
- package/dist/lib/utils/package-manifest.js +1 -0
- package/package.json +1 -1
- package/dist/lib/models/sources/repository.d.ts +0 -5
- package/dist/lib/models/sources/repository.js +0 -9
- package/static/widgets.png +0 -0
- package/static/widgets@2x.png +0 -0
|
@@ -104,7 +104,7 @@ export declare class Converter extends ChildableComponent<Application, Converter
|
|
|
104
104
|
*/
|
|
105
105
|
convert(entryPoints: readonly DocumentationEntryPoint[]): ProjectReflection;
|
|
106
106
|
/** @internal */
|
|
107
|
-
convertSymbol(context: Context, symbol: ts.Symbol): void;
|
|
107
|
+
convertSymbol(context: Context, symbol: ts.Symbol, exportSymbol?: ts.Symbol): void;
|
|
108
108
|
/**
|
|
109
109
|
* Convert the given TypeScript type into its TypeDoc type reflection.
|
|
110
110
|
*
|
|
@@ -72,8 +72,8 @@ let Converter = Converter_1 = class Converter extends component_1.ChildableCompo
|
|
|
72
72
|
return project;
|
|
73
73
|
}
|
|
74
74
|
/** @internal */
|
|
75
|
-
convertSymbol(context, symbol) {
|
|
76
|
-
(0, symbols_1.convertSymbol)(context, symbol);
|
|
75
|
+
convertSymbol(context, symbol, exportSymbol) {
|
|
76
|
+
(0, symbols_1.convertSymbol)(context, symbol, exportSymbol);
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
79
|
* Convert the given TypeScript type into its TypeDoc type reflection.
|
|
@@ -15,7 +15,12 @@ function createSignature(context, kind, signature, declaration) {
|
|
|
15
15
|
const sigRef = new models_1.SignatureReflection(kind == models_1.ReflectionKind.ConstructorSignature
|
|
16
16
|
? `new ${context.scope.parent.name}`
|
|
17
17
|
: context.scope.name, kind, context.scope);
|
|
18
|
-
|
|
18
|
+
// If we are creating signatures for a variable and the variable has a comment associated with it
|
|
19
|
+
// then we should prefer that variable's comment over any comment on the signature. The comment plugin
|
|
20
|
+
// will copy the comment down if this signature doesn't have one, so don't set one.
|
|
21
|
+
if (declaration &&
|
|
22
|
+
(!context.scope.comment ||
|
|
23
|
+
!(context.scope.conversionFlags & models_1.ConversionFlags.VariableSource))) {
|
|
19
24
|
sigRef.comment = (0, comments_1.getSignatureComment)(declaration, context.converter.config, context.logger, context.converter.commentStyle);
|
|
20
25
|
}
|
|
21
26
|
sigRef.typeParameters = convertTypeParameters(context, sigRef, signature.typeParameters);
|
|
@@ -16,6 +16,14 @@ function convertJsDocAlias(context, symbol, declaration, exportSymbol) {
|
|
|
16
16
|
convertJsDocInterface(context, declaration, symbol, exportSymbol);
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
|
+
// If the typedef tag is just referring to another type-space symbol, with no type parameters
|
|
20
|
+
// or appropriate forwarding type parameters, then we treat it as a re-export instead of creating
|
|
21
|
+
// a type alias with an import type.
|
|
22
|
+
const aliasedSymbol = getTypedefReExportTarget(context, declaration);
|
|
23
|
+
if (aliasedSymbol) {
|
|
24
|
+
context.converter.convertSymbol(context, aliasedSymbol, exportSymbol ?? symbol);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
19
27
|
const reflection = context.createDeclarationReflection(models_1.ReflectionKind.TypeAlias, symbol, exportSymbol);
|
|
20
28
|
reflection.comment = (0, comments_1.getJsDocComment)(declaration, context.converter.config, context.logger);
|
|
21
29
|
reflection.type = context.converter.convertType(context.withScope(reflection), declaration.typeExpression?.type);
|
|
@@ -69,3 +77,36 @@ function convertTemplateParameterNodes(context, nodes) {
|
|
|
69
77
|
const params = (nodes ?? []).flatMap((tag) => tag.typeParameters);
|
|
70
78
|
return (0, signature_1.convertTypeParameterNodes)(context, params);
|
|
71
79
|
}
|
|
80
|
+
function getTypedefReExportTarget(context, declaration) {
|
|
81
|
+
const typeExpression = declaration.typeExpression;
|
|
82
|
+
if (!ts.isJSDocTypedefTag(declaration) ||
|
|
83
|
+
!typeExpression ||
|
|
84
|
+
ts.isJSDocTypeLiteral(typeExpression) ||
|
|
85
|
+
!ts.isImportTypeNode(typeExpression.type) ||
|
|
86
|
+
!typeExpression.type.qualifier ||
|
|
87
|
+
!ts.isIdentifier(typeExpression.type.qualifier)) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const targetSymbol = context.expectSymbolAtLocation(typeExpression.type.qualifier);
|
|
91
|
+
const decl = targetSymbol.declarations?.[0];
|
|
92
|
+
if (!decl ||
|
|
93
|
+
!(ts.isTypeAliasDeclaration(decl) ||
|
|
94
|
+
ts.isInterfaceDeclaration(decl) ||
|
|
95
|
+
ts.isJSDocTypedefTag(decl) ||
|
|
96
|
+
ts.isJSDocCallbackTag(decl))) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const targetParams = ts.getEffectiveTypeParameterDeclarations(decl);
|
|
100
|
+
const localParams = ts.getEffectiveTypeParameterDeclarations(declaration);
|
|
101
|
+
const localArgs = typeExpression.type.typeArguments || [];
|
|
102
|
+
// If we have type parameters, ensure they are forwarding parameters with no transformations.
|
|
103
|
+
// This doesn't check constraints since they aren't checked in JSDoc types.
|
|
104
|
+
if (targetParams.length !== localParams.length ||
|
|
105
|
+
localArgs.some((arg, i) => !ts.isTypeReferenceNode(arg) ||
|
|
106
|
+
!ts.isIdentifier(arg.typeName) ||
|
|
107
|
+
arg.typeArguments ||
|
|
108
|
+
localParams[i]?.name.text !== arg.typeName.text)) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
return targetSymbol;
|
|
112
|
+
}
|
|
@@ -131,7 +131,7 @@ let SourcePlugin = class SourcePlugin extends components_1.ConverterComponent {
|
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
// Try to create a new repository
|
|
134
|
-
const repository = repository_1.Repository.tryCreateRepository(dirName, this.gitRevision, this.gitRemote);
|
|
134
|
+
const repository = repository_1.Repository.tryCreateRepository(dirName, this.gitRevision, this.gitRemote, this.application.logger);
|
|
135
135
|
if (repository) {
|
|
136
136
|
this.repositories[repository.path.toLowerCase()] = repository;
|
|
137
137
|
return repository;
|
|
@@ -477,6 +477,7 @@ function convertVariableAsFunction(context, symbol, exportSymbol) {
|
|
|
477
477
|
: context.checker.getDeclaredTypeOfSymbol(symbol);
|
|
478
478
|
const reflection = context.createDeclarationReflection(models_1.ReflectionKind.Function, symbol, exportSymbol);
|
|
479
479
|
setModifiers(symbol, accessDeclaration, reflection);
|
|
480
|
+
reflection.conversionFlags |= models_1.ConversionFlags.VariableSource;
|
|
480
481
|
context.finalizeDeclarationReflection(reflection);
|
|
481
482
|
const reflectionContext = context.withScope(reflection);
|
|
482
483
|
reflection.signatures ?? (reflection.signatures = []);
|
|
@@ -511,9 +512,12 @@ function convertAccessor(context, symbol, exportSymbol) {
|
|
|
511
512
|
function isInherited(context, symbol) {
|
|
512
513
|
const parentSymbol = context.project.getSymbolFromReflection(context.scope);
|
|
513
514
|
assert(parentSymbol, `No parent symbol found for ${symbol.name} in ${context.scope.name}`);
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
515
|
+
const parents = parentSymbol.declarations?.slice() || [];
|
|
516
|
+
const constructorDecls = parents.flatMap((parent) => ts.isClassDeclaration(parent)
|
|
517
|
+
? parent.members.filter(ts.isConstructorDeclaration)
|
|
518
|
+
: []);
|
|
519
|
+
parents.push(...constructorDecls);
|
|
520
|
+
return (parents.some((d) => symbol.getDeclarations()?.some((d2) => d2.parent === d)) === false);
|
|
517
521
|
}
|
|
518
522
|
function setModifiers(symbol, declaration, reflection) {
|
|
519
523
|
if (!declaration) {
|
|
@@ -9,6 +9,7 @@ const converter_events_1 = require("./converter-events");
|
|
|
9
9
|
const index_signature_1 = require("./factories/index-signature");
|
|
10
10
|
const signature_1 = require("./factories/signature");
|
|
11
11
|
const symbols_1 = require("./symbols");
|
|
12
|
+
const nodes_1 = require("./utils/nodes");
|
|
12
13
|
const reflections_1 = require("./utils/reflections");
|
|
13
14
|
const converters = new Map();
|
|
14
15
|
function loadConverters() {
|
|
@@ -576,7 +577,7 @@ const typeOperatorConverter = {
|
|
|
576
577
|
// readonly is only valid on array and tuple literal types.
|
|
577
578
|
if (node.operator === ts.SyntaxKind.ReadonlyKeyword) {
|
|
578
579
|
const resolved = resolveReference(type);
|
|
579
|
-
assert(isObjectType(resolved));
|
|
580
|
+
assert((0, nodes_1.isObjectType)(resolved));
|
|
580
581
|
const args = context.checker
|
|
581
582
|
.getTypeArguments(type)
|
|
582
583
|
.map((type) => convertType(context, type));
|
|
@@ -645,11 +646,8 @@ function requestBugReport(context, nodeOrType) {
|
|
|
645
646
|
return new models_1.UnknownType(typeString);
|
|
646
647
|
}
|
|
647
648
|
}
|
|
648
|
-
function isObjectType(type) {
|
|
649
|
-
return typeof type.objectFlags === "number";
|
|
650
|
-
}
|
|
651
649
|
function resolveReference(type) {
|
|
652
|
-
if (isObjectType(type) && type.objectFlags & ts.ObjectFlags.Reference) {
|
|
650
|
+
if ((0, nodes_1.isObjectType)(type) && type.objectFlags & ts.ObjectFlags.Reference) {
|
|
653
651
|
return type.target;
|
|
654
652
|
}
|
|
655
653
|
return type;
|
|
@@ -3,3 +3,4 @@ export declare function isNamedNode(node: ts.Node): node is ts.Node & {
|
|
|
3
3
|
name: ts.Identifier | ts.PrivateIdentifier | ts.ComputedPropertyName;
|
|
4
4
|
};
|
|
5
5
|
export declare function getHeritageTypes(declarations: readonly (ts.ClassDeclaration | ts.InterfaceDeclaration)[], kind: ts.SyntaxKind.ImplementsKeyword | ts.SyntaxKind.ExtendsKeyword): ts.ExpressionWithTypeArguments[];
|
|
6
|
+
export declare function isObjectType(type: ts.Type): type is ts.ObjectType;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getHeritageTypes = exports.isNamedNode = void 0;
|
|
3
|
+
exports.isObjectType = exports.getHeritageTypes = exports.isNamedNode = void 0;
|
|
4
4
|
const ts = require("typescript");
|
|
5
5
|
function isNamedNode(node) {
|
|
6
6
|
const name = node.name;
|
|
@@ -22,3 +22,7 @@ function getHeritageTypes(declarations, kind) {
|
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
exports.getHeritageTypes = getHeritageTypes;
|
|
25
|
+
function isObjectType(type) {
|
|
26
|
+
return typeof type.objectFlags === "number";
|
|
27
|
+
}
|
|
28
|
+
exports.isObjectType = isObjectType;
|
|
@@ -1,56 +1,31 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Logger } from "../../utils";
|
|
2
2
|
export declare const gitIsInstalled: boolean;
|
|
3
3
|
/**
|
|
4
4
|
* Stores data of a repository.
|
|
5
5
|
*/
|
|
6
6
|
export declare class Repository {
|
|
7
7
|
/**
|
|
8
|
-
* The
|
|
8
|
+
* The path of this repository on disk.
|
|
9
9
|
*/
|
|
10
10
|
path: string;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* All files tracked by the repository.
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
files: Set<string>;
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* The base url for link creation.
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
baseUrl: string;
|
|
19
19
|
/**
|
|
20
|
-
* The
|
|
20
|
+
* The anchor prefix used to select lines, usually `L`
|
|
21
21
|
*/
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* The project name of this repository on GitHub.
|
|
25
|
-
*/
|
|
26
|
-
project?: string;
|
|
27
|
-
/**
|
|
28
|
-
* The hostname for this GitHub/Bitbucket/.etc project.
|
|
29
|
-
*
|
|
30
|
-
* Defaults to: `github.com` (for normal, public GitHub instance projects)
|
|
31
|
-
*
|
|
32
|
-
* Can be the hostname for an enterprise version of GitHub, e.g. `github.acme.com`
|
|
33
|
-
* (if found as a match in the list of git remotes).
|
|
34
|
-
*/
|
|
35
|
-
hostname: string;
|
|
36
|
-
/**
|
|
37
|
-
* Whether this is a GitHub, Bitbucket, or other type of repository.
|
|
38
|
-
*/
|
|
39
|
-
type: RepositoryType;
|
|
40
|
-
private urlCache;
|
|
22
|
+
anchorPrefix: string;
|
|
41
23
|
/**
|
|
42
24
|
* Create a new Repository instance.
|
|
43
25
|
*
|
|
44
26
|
* @param path The root path of the repository.
|
|
45
27
|
*/
|
|
46
|
-
constructor(path: string,
|
|
47
|
-
/**
|
|
48
|
-
* Check whether the given file is tracked by this repository.
|
|
49
|
-
*
|
|
50
|
-
* @param fileName The name of the file to test for.
|
|
51
|
-
* @returns TRUE when the file is part of the repository, otherwise FALSE.
|
|
52
|
-
*/
|
|
53
|
-
contains(fileName: string): boolean;
|
|
28
|
+
constructor(path: string, baseUrl: string);
|
|
54
29
|
/**
|
|
55
30
|
* Get the URL of the given file on GitHub or Bitbucket.
|
|
56
31
|
*
|
|
@@ -68,5 +43,6 @@ export declare class Repository {
|
|
|
68
43
|
* @param path The potential repository root.
|
|
69
44
|
* @returns A new instance of {@link Repository} or undefined.
|
|
70
45
|
*/
|
|
71
|
-
static tryCreateRepository(path: string, gitRevision: string, gitRemote: string): Repository | undefined;
|
|
46
|
+
static tryCreateRepository(path: string, gitRevision: string, gitRemote: string, logger: Logger): Repository | undefined;
|
|
72
47
|
}
|
|
48
|
+
export declare function guessBaseUrl(gitRevision: string, remotes: string[]): string | undefined;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Repository = exports.gitIsInstalled = void 0;
|
|
3
|
+
exports.guessBaseUrl = exports.Repository = exports.gitIsInstalled = void 0;
|
|
4
4
|
const child_process_1 = require("child_process");
|
|
5
|
-
const models_1 = require("../../models");
|
|
6
5
|
const base_path_1 = require("../utils/base-path");
|
|
7
6
|
const TEN_MEGABYTES = 1024 * 10000;
|
|
8
7
|
function git(...args) {
|
|
@@ -22,89 +21,22 @@ class Repository {
|
|
|
22
21
|
*
|
|
23
22
|
* @param path The root path of the repository.
|
|
24
23
|
*/
|
|
25
|
-
constructor(path,
|
|
24
|
+
constructor(path, baseUrl) {
|
|
26
25
|
/**
|
|
27
|
-
*
|
|
26
|
+
* All files tracked by the repository.
|
|
28
27
|
*/
|
|
29
|
-
this.files =
|
|
30
|
-
/**
|
|
31
|
-
* The hostname for this GitHub/Bitbucket/.etc project.
|
|
32
|
-
*
|
|
33
|
-
* Defaults to: `github.com` (for normal, public GitHub instance projects)
|
|
34
|
-
*
|
|
35
|
-
* Can be the hostname for an enterprise version of GitHub, e.g. `github.acme.com`
|
|
36
|
-
* (if found as a match in the list of git remotes).
|
|
37
|
-
*/
|
|
38
|
-
this.hostname = "github.com";
|
|
39
|
-
/**
|
|
40
|
-
* Whether this is a GitHub, Bitbucket, or other type of repository.
|
|
41
|
-
*/
|
|
42
|
-
this.type = models_1.RepositoryType.GitHub;
|
|
43
|
-
this.urlCache = new Map();
|
|
28
|
+
this.files = new Set();
|
|
44
29
|
this.path = path;
|
|
45
|
-
this.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
// Github Enterprise
|
|
49
|
-
if (!match) {
|
|
50
|
-
match = /(\w+\.githubprivate.com)[:/]([^/]+)\/(.*)/.exec(repoLinks[i]);
|
|
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
|
-
}
|
|
60
|
-
if (!match) {
|
|
61
|
-
match = /(bitbucket.org)[:/]([^/]+)\/(.*)/.exec(repoLinks[i]);
|
|
62
|
-
}
|
|
63
|
-
if (!match) {
|
|
64
|
-
match = /(gitlab.com)[:/]([^/]+)\/(.*)/.exec(repoLinks[i]);
|
|
65
|
-
}
|
|
66
|
-
if (match) {
|
|
67
|
-
this.hostname = match[1];
|
|
68
|
-
this.user = match[2];
|
|
69
|
-
this.project = match[3];
|
|
70
|
-
if (this.project.endsWith(".git")) {
|
|
71
|
-
this.project = this.project.slice(0, -4);
|
|
72
|
-
}
|
|
73
|
-
break;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
if (this.hostname.includes("bitbucket.org")) {
|
|
77
|
-
this.type = models_1.RepositoryType.Bitbucket;
|
|
78
|
-
}
|
|
79
|
-
else if (this.hostname.includes("gitlab.com")) {
|
|
80
|
-
this.type = models_1.RepositoryType.GitLab;
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
this.type = models_1.RepositoryType.GitHub;
|
|
84
|
-
}
|
|
85
|
-
let out = git("-C", path, "ls-files");
|
|
30
|
+
this.baseUrl = baseUrl;
|
|
31
|
+
this.anchorPrefix = guessAnchorPrefix(this.baseUrl);
|
|
32
|
+
const out = git("-C", path, "ls-files");
|
|
86
33
|
if (out.status === 0) {
|
|
87
34
|
out.stdout.split("\n").forEach((file) => {
|
|
88
35
|
if (file !== "") {
|
|
89
|
-
this.files.
|
|
36
|
+
this.files.add(base_path_1.BasePath.normalize(path + "/" + file));
|
|
90
37
|
}
|
|
91
38
|
});
|
|
92
39
|
}
|
|
93
|
-
if (!gitRevision) {
|
|
94
|
-
out = git("-C", path, "rev-parse", "--short", "HEAD");
|
|
95
|
-
if (out.status === 0) {
|
|
96
|
-
this.branch = out.stdout.replace("\n", "");
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Check whether the given file is tracked by this repository.
|
|
102
|
-
*
|
|
103
|
-
* @param fileName The name of the file to test for.
|
|
104
|
-
* @returns TRUE when the file is part of the repository, otherwise FALSE.
|
|
105
|
-
*/
|
|
106
|
-
contains(fileName) {
|
|
107
|
-
return this.files.includes(fileName);
|
|
108
40
|
}
|
|
109
41
|
/**
|
|
110
42
|
* Get the URL of the given file on GitHub or Bitbucket.
|
|
@@ -113,35 +45,13 @@ class Repository {
|
|
|
113
45
|
* @returns A URL pointing to the web preview of the given file or undefined.
|
|
114
46
|
*/
|
|
115
47
|
getURL(fileName) {
|
|
116
|
-
if (this.
|
|
117
|
-
return this.urlCache.get(fileName);
|
|
118
|
-
}
|
|
119
|
-
if (!this.user || !this.project || !this.contains(fileName)) {
|
|
48
|
+
if (!this.files.has(fileName)) {
|
|
120
49
|
return;
|
|
121
50
|
}
|
|
122
|
-
|
|
123
|
-
`https://${this.hostname}`,
|
|
124
|
-
this.user,
|
|
125
|
-
this.project,
|
|
126
|
-
this.type === models_1.RepositoryType.GitLab ? "-" : undefined,
|
|
127
|
-
this.type === models_1.RepositoryType.Bitbucket ? "src" : "blob",
|
|
128
|
-
this.branch,
|
|
129
|
-
fileName.substring(this.path.length + 1),
|
|
130
|
-
]
|
|
131
|
-
.filter((s) => !!s)
|
|
132
|
-
.join("/");
|
|
133
|
-
this.urlCache.set(fileName, url);
|
|
134
|
-
return url;
|
|
51
|
+
return `${this.baseUrl}/${fileName.substring(this.path.length + 1)}`;
|
|
135
52
|
}
|
|
136
53
|
getLineNumberAnchor(lineNumber) {
|
|
137
|
-
|
|
138
|
-
default:
|
|
139
|
-
case models_1.RepositoryType.GitHub:
|
|
140
|
-
case models_1.RepositoryType.GitLab:
|
|
141
|
-
return "L" + lineNumber;
|
|
142
|
-
case models_1.RepositoryType.Bitbucket:
|
|
143
|
-
return "lines-" + lineNumber;
|
|
144
|
-
}
|
|
54
|
+
return `${this.anchorPrefix}${lineNumber}`;
|
|
145
55
|
}
|
|
146
56
|
/**
|
|
147
57
|
* Try to create a new repository instance.
|
|
@@ -152,13 +62,77 @@ class Repository {
|
|
|
152
62
|
* @param path The potential repository root.
|
|
153
63
|
* @returns A new instance of {@link Repository} or undefined.
|
|
154
64
|
*/
|
|
155
|
-
static tryCreateRepository(path, gitRevision, gitRemote) {
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
if (out.status !== 0 || remotesOutput.status !== 0) {
|
|
65
|
+
static tryCreateRepository(path, gitRevision, gitRemote, logger) {
|
|
66
|
+
const topLevel = git("-C", path, "rev-parse", "--show-toplevel");
|
|
67
|
+
if (topLevel.status !== 0)
|
|
159
68
|
return;
|
|
69
|
+
gitRevision || (gitRevision = git("-C", path, "rev-parse", "--short", "HEAD").stdout.trim());
|
|
70
|
+
if (!gitRevision)
|
|
71
|
+
return; // Will only happen in a repo with no commits.
|
|
72
|
+
let baseUrl;
|
|
73
|
+
if (/^https?:\/\//.test(gitRemote)) {
|
|
74
|
+
baseUrl = `${gitRemote}/${gitRevision}`;
|
|
160
75
|
}
|
|
161
|
-
|
|
76
|
+
else {
|
|
77
|
+
const remotesOut = git("-C", path, "remote", "get-url", gitRemote);
|
|
78
|
+
if (remotesOut.status === 0) {
|
|
79
|
+
baseUrl = guessBaseUrl(gitRevision, remotesOut.stdout.split("\n"));
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
logger.warn(`The provided git remote "${gitRemote}" was not valid. Source links will be broken.`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (!baseUrl)
|
|
86
|
+
return;
|
|
87
|
+
return new Repository(base_path_1.BasePath.normalize(topLevel.stdout.replace("\n", "")), baseUrl);
|
|
162
88
|
}
|
|
163
89
|
}
|
|
164
90
|
exports.Repository = Repository;
|
|
91
|
+
// Should have three capturing groups:
|
|
92
|
+
// 1. hostname
|
|
93
|
+
// 2. user
|
|
94
|
+
// 3. project
|
|
95
|
+
const repoExpressions = [
|
|
96
|
+
/(github(?!.us)(?:\.[a-z]+)*\.[a-z]{2,})[:/]([^/]+)\/(.*)/,
|
|
97
|
+
/(\w+\.githubprivate.com)[:/]([^/]+)\/(.*)/,
|
|
98
|
+
/(\w+\.ghe.com)[:/]([^/]+)\/(.*)/,
|
|
99
|
+
/(\w+\.github.us)[:/]([^/]+)\/(.*)/,
|
|
100
|
+
/(bitbucket.org)[:/]([^/]+)\/(.*)/,
|
|
101
|
+
/(gitlab.com)[:/]([^/]+)\/(.*)/,
|
|
102
|
+
];
|
|
103
|
+
function guessBaseUrl(gitRevision, remotes) {
|
|
104
|
+
let hostname = "";
|
|
105
|
+
let user = "";
|
|
106
|
+
let project = "";
|
|
107
|
+
outer: for (const repoLink of remotes) {
|
|
108
|
+
for (const regex of repoExpressions) {
|
|
109
|
+
const match = regex.exec(repoLink);
|
|
110
|
+
if (match) {
|
|
111
|
+
hostname = match[1];
|
|
112
|
+
user = match[2];
|
|
113
|
+
project = match[3];
|
|
114
|
+
break outer;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (!hostname)
|
|
119
|
+
return;
|
|
120
|
+
if (project.endsWith(".git")) {
|
|
121
|
+
project = project.slice(0, -4);
|
|
122
|
+
}
|
|
123
|
+
let sourcePath = "blob";
|
|
124
|
+
if (hostname.includes("gitlab")) {
|
|
125
|
+
sourcePath = "-/blob";
|
|
126
|
+
}
|
|
127
|
+
else if (hostname.includes("bitbucket")) {
|
|
128
|
+
sourcePath = "src";
|
|
129
|
+
}
|
|
130
|
+
return `https://${hostname}/${user}/${project}/${sourcePath}/${gitRevision}`;
|
|
131
|
+
}
|
|
132
|
+
exports.guessBaseUrl = guessBaseUrl;
|
|
133
|
+
function guessAnchorPrefix(url) {
|
|
134
|
+
if (url.includes("bitbucket")) {
|
|
135
|
+
return "lines-";
|
|
136
|
+
}
|
|
137
|
+
return "L";
|
|
138
|
+
}
|
|
@@ -25,6 +25,13 @@ export interface DeclarationHierarchy {
|
|
|
25
25
|
*/
|
|
26
26
|
isTarget?: boolean;
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
export declare enum ConversionFlags {
|
|
32
|
+
None = 0,
|
|
33
|
+
VariableSource = 1
|
|
34
|
+
}
|
|
28
35
|
/**
|
|
29
36
|
* A reflection that represents a single declaration emitted by the TypeScript compiler.
|
|
30
37
|
*
|
|
@@ -118,6 +125,11 @@ export declare class DeclarationReflection extends ContainerReflection {
|
|
|
118
125
|
* The version of the module when found.
|
|
119
126
|
*/
|
|
120
127
|
version?: string;
|
|
128
|
+
/**
|
|
129
|
+
* Flags for information about a reflection which is needed solely during conversion.
|
|
130
|
+
* @internal
|
|
131
|
+
*/
|
|
132
|
+
conversionFlags: ConversionFlags;
|
|
121
133
|
hasGetterOrSetter(): boolean;
|
|
122
134
|
getAllSignatures(): SignatureReflection[];
|
|
123
135
|
/** @internal */
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DeclarationReflection = void 0;
|
|
3
|
+
exports.DeclarationReflection = exports.ConversionFlags = void 0;
|
|
4
4
|
const types_1 = require("../types");
|
|
5
5
|
const abstract_1 = require("./abstract");
|
|
6
6
|
const container_1 = require("./container");
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
var ConversionFlags;
|
|
11
|
+
(function (ConversionFlags) {
|
|
12
|
+
ConversionFlags[ConversionFlags["None"] = 0] = "None";
|
|
13
|
+
ConversionFlags[ConversionFlags["VariableSource"] = 1] = "VariableSource";
|
|
14
|
+
})(ConversionFlags = exports.ConversionFlags || (exports.ConversionFlags = {}));
|
|
7
15
|
/**
|
|
8
16
|
* A reflection that represents a single declaration emitted by the TypeScript compiler.
|
|
9
17
|
*
|
|
@@ -11,6 +19,14 @@ const container_1 = require("./container");
|
|
|
11
19
|
* kind of a reflection is stored in its ´kind´ member.
|
|
12
20
|
*/
|
|
13
21
|
class DeclarationReflection extends container_1.ContainerReflection {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
/**
|
|
25
|
+
* Flags for information about a reflection which is needed solely during conversion.
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
this.conversionFlags = ConversionFlags.None;
|
|
29
|
+
}
|
|
14
30
|
hasGetterOrSetter() {
|
|
15
31
|
return !!this.getSignature || !!this.setSignature;
|
|
16
32
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { Reflection, ReflectionFlag, ReflectionFlags, TraverseProperty, } from "./abstract";
|
|
2
2
|
export type { TraverseCallback } from "./abstract";
|
|
3
3
|
export { ContainerReflection } from "./container";
|
|
4
|
-
export { DeclarationReflection } from "./declaration";
|
|
4
|
+
export { DeclarationReflection, ConversionFlags } from "./declaration";
|
|
5
5
|
export type { DeclarationHierarchy } from "./declaration";
|
|
6
6
|
export { ReflectionKind } from "./kind";
|
|
7
7
|
export { ParameterReflection } from "./parameter";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.splitUnquotedString = exports.VarianceModifier = exports.TypeParameterReflection = exports.SignatureReflection = exports.ReferenceReflection = exports.ProjectReflection = exports.ParameterReflection = exports.ReflectionKind = exports.DeclarationReflection = exports.ContainerReflection = exports.TraverseProperty = exports.ReflectionFlags = exports.ReflectionFlag = exports.Reflection = void 0;
|
|
3
|
+
exports.splitUnquotedString = exports.VarianceModifier = exports.TypeParameterReflection = exports.SignatureReflection = exports.ReferenceReflection = exports.ProjectReflection = exports.ParameterReflection = exports.ReflectionKind = exports.ConversionFlags = exports.DeclarationReflection = exports.ContainerReflection = exports.TraverseProperty = exports.ReflectionFlags = exports.ReflectionFlag = exports.Reflection = void 0;
|
|
4
4
|
var abstract_1 = require("./abstract");
|
|
5
5
|
Object.defineProperty(exports, "Reflection", { enumerable: true, get: function () { return abstract_1.Reflection; } });
|
|
6
6
|
Object.defineProperty(exports, "ReflectionFlag", { enumerable: true, get: function () { return abstract_1.ReflectionFlag; } });
|
|
@@ -10,6 +10,7 @@ var container_1 = require("./container");
|
|
|
10
10
|
Object.defineProperty(exports, "ContainerReflection", { enumerable: true, get: function () { return container_1.ContainerReflection; } });
|
|
11
11
|
var declaration_1 = require("./declaration");
|
|
12
12
|
Object.defineProperty(exports, "DeclarationReflection", { enumerable: true, get: function () { return declaration_1.DeclarationReflection; } });
|
|
13
|
+
Object.defineProperty(exports, "ConversionFlags", { enumerable: true, get: function () { return declaration_1.ConversionFlags; } });
|
|
13
14
|
var kind_1 = require("./kind");
|
|
14
15
|
Object.defineProperty(exports, "ReflectionKind", { enumerable: true, get: function () { return kind_1.ReflectionKind; } });
|
|
15
16
|
var parameter_1 = require("./parameter");
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.SourceReference = void 0;
|
|
4
4
|
var file_1 = require("./file");
|
|
5
5
|
Object.defineProperty(exports, "SourceReference", { enumerable: true, get: function () { return file_1.SourceReference; } });
|
|
6
|
-
var repository_1 = require("./repository");
|
|
7
|
-
Object.defineProperty(exports, "RepositoryType", { enumerable: true, get: function () { return repository_1.RepositoryType; } });
|
|
@@ -26,6 +26,7 @@ const utils_1 = require("../utils");
|
|
|
26
26
|
const highlighter_1 = require("../utils/highlighter");
|
|
27
27
|
const models_1 = require("../models");
|
|
28
28
|
const icon_1 = require("./themes/default/partials/icon");
|
|
29
|
+
const type_1 = require("./themes/default/partials/type");
|
|
29
30
|
/**
|
|
30
31
|
* The renderer processes a {@link ProjectReflection} using a {@link Theme} instance and writes
|
|
31
32
|
* the emitted html documents to a output directory. You can specify which theme should be used
|
|
@@ -132,6 +133,7 @@ let Renderer = class Renderer extends component_1.ChildableComponent {
|
|
|
132
133
|
output.urls.forEach((mapping) => {
|
|
133
134
|
(0, icon_1.clearSeenIconCache)();
|
|
134
135
|
this.renderDocument(output.createPageEvent(mapping));
|
|
136
|
+
(0, type_1.validateStateIsClean)(mapping.url);
|
|
135
137
|
});
|
|
136
138
|
this.trigger(events_1.RendererEvent.END, output);
|
|
137
139
|
}
|
|
@@ -26,7 +26,7 @@ export declare class DefaultThemeRenderContext {
|
|
|
26
26
|
comment: (props: Reflection) => import("../../../utils/jsx.elements").JsxElement | undefined;
|
|
27
27
|
footer: () => import("../../../utils/jsx.elements").JsxElement | undefined;
|
|
28
28
|
header: (props: import("../..").PageEvent<Reflection>) => import("../../../utils/jsx.elements").JsxElement;
|
|
29
|
-
hierarchy: (props: import("../../../models").DeclarationHierarchy | undefined) => import("../../../utils/jsx.elements").JsxElement;
|
|
29
|
+
hierarchy: (props: import("../../../models").DeclarationHierarchy | undefined) => import("../../../utils/jsx.elements").JsxElement | undefined;
|
|
30
30
|
index: (props: import("../../../models").ContainerReflection) => import("../../../utils/jsx.elements").JsxElement;
|
|
31
31
|
member: (props: import("../../../models").DeclarationReflection) => import("../../../utils/jsx.elements").JsxElement;
|
|
32
32
|
memberDeclaration: (props: import("../../../models").DeclarationReflection) => import("../../../utils/jsx.elements").JsxElement;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { DefaultThemeRenderContext } from "../DefaultThemeRenderContext";
|
|
2
2
|
import { JSX } from "../../../../utils";
|
|
3
3
|
import type { DeclarationHierarchy } from "../../../../models";
|
|
4
|
-
export declare
|
|
4
|
+
export declare function hierarchy(context: DefaultThemeRenderContext, props: DeclarationHierarchy | undefined): JSX.Element | undefined;
|
|
@@ -2,9 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.hierarchy = void 0;
|
|
4
4
|
const utils_1 = require("../../../../utils");
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
function hierarchy(context, props) {
|
|
6
|
+
if (!props)
|
|
7
|
+
return;
|
|
8
|
+
return (utils_1.JSX.createElement("section", { class: "tsd-panel tsd-hierarchy" },
|
|
9
|
+
utils_1.JSX.createElement("h4", null, "Hierarchy"),
|
|
10
|
+
hierarchyList(context, props)));
|
|
11
|
+
}
|
|
10
12
|
exports.hierarchy = hierarchy;
|
|
13
|
+
function hierarchyList(context, props) {
|
|
14
|
+
return (utils_1.JSX.createElement("ul", { class: "tsd-hierarchy" }, props.types.map((item, i, l) => (utils_1.JSX.createElement("li", null,
|
|
15
|
+
props.isTarget ? utils_1.JSX.createElement("span", { class: "target" }, item.toString()) : context.type(item),
|
|
16
|
+
i === l.length - 1 && !!props.next && hierarchyList(context, props.next))))));
|
|
17
|
+
}
|
|
@@ -19,9 +19,7 @@ const memberDeclaration = (context, props) => (utils_1.JSX.createElement(utils_1
|
|
|
19
19
|
" = ",
|
|
20
20
|
props.defaultValue)))),
|
|
21
21
|
context.comment(props),
|
|
22
|
-
(0, lib_1.hasTypeParameters)(props) &&
|
|
23
|
-
utils_1.JSX.createElement("h4", { class: "tsd-type-parameters-title" }, "Type Parameters"),
|
|
24
|
-
context.typeParameters(props.typeParameters))),
|
|
22
|
+
(0, lib_1.hasTypeParameters)(props) && context.typeParameters(props.typeParameters),
|
|
25
23
|
props.type instanceof models_1.ReflectionType && (utils_1.JSX.createElement("div", { class: "tsd-type-declaration" },
|
|
26
24
|
utils_1.JSX.createElement("h4", null, "Type declaration"),
|
|
27
25
|
context.parameter(props.type.declaration))),
|
|
@@ -7,9 +7,7 @@ const lib_1 = require("../../lib");
|
|
|
7
7
|
const memberSignatureBody = (context, props, { hideSources = false } = {}) => (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
8
8
|
(0, lib_1.renderFlags)(props.flags, props.comment),
|
|
9
9
|
context.comment(props),
|
|
10
|
-
(0, lib_1.hasTypeParameters)(props) && (
|
|
11
|
-
utils_1.JSX.createElement("h4", { class: "tsd-type-parameters-title" }, "Type Parameters"),
|
|
12
|
-
context.typeParameters(props.typeParameters))),
|
|
10
|
+
(0, lib_1.hasTypeParameters)(props) && context.typeParameters(props.typeParameters),
|
|
13
11
|
props.parameters && props.parameters.length > 0 && (utils_1.JSX.createElement("div", { class: "tsd-parameters" },
|
|
14
12
|
utils_1.JSX.createElement("h4", { class: "tsd-parameters-title" }, "Parameters"),
|
|
15
13
|
utils_1.JSX.createElement("ul", { class: "tsd-parameter-list" }, props.parameters.map((item) => (utils_1.JSX.createElement("li", null,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { DefaultThemeRenderContext } from "../DefaultThemeRenderContext";
|
|
2
2
|
import { Type } from "../../../../models";
|
|
3
3
|
import { JSX } from "../../../../utils";
|
|
4
|
+
export declare function validateStateIsClean(page: string): void;
|
|
4
5
|
export declare function type(context: DefaultThemeRenderContext, type: Type | undefined): JSX.Element;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.type = void 0;
|
|
3
|
+
exports.type = exports.validateStateIsClean = void 0;
|
|
4
4
|
const models_1 = require("../../../../models");
|
|
5
5
|
const utils_1 = require("../../../../utils");
|
|
6
6
|
const lib_1 = require("../../lib");
|
|
7
|
+
const assert_1 = require("assert");
|
|
7
8
|
const EXPORTABLE = models_1.ReflectionKind.Class |
|
|
8
9
|
models_1.ReflectionKind.Interface |
|
|
9
10
|
models_1.ReflectionKind.Enum |
|
|
@@ -51,6 +52,14 @@ function getNamespacedPath(reflection) {
|
|
|
51
52
|
function renderUniquePath(context, reflection) {
|
|
52
53
|
return (0, lib_1.join)(utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "."), getUniquePath(reflection), (item) => (utils_1.JSX.createElement("a", { href: context.urlTo(item), class: "tsd-signature-type", "data-tsd-kind": item.kindString }, item.name)));
|
|
53
54
|
}
|
|
55
|
+
let indentationDepth = 0;
|
|
56
|
+
function includeIndentation() {
|
|
57
|
+
return indentationDepth > 0 ? utils_1.JSX.createElement("span", null, "\u00A0".repeat(indentationDepth * 4)) : utils_1.JSX.createElement(utils_1.JSX.Fragment, null);
|
|
58
|
+
}
|
|
59
|
+
function validateStateIsClean(page) {
|
|
60
|
+
(0, assert_1.ok)(indentationDepth === 0, `Rendering ${page}: Indentation depth increment/decrement not matched: ${indentationDepth}`);
|
|
61
|
+
}
|
|
62
|
+
exports.validateStateIsClean = validateStateIsClean;
|
|
54
63
|
// The type helper accepts an optional needsParens parameter that is checked
|
|
55
64
|
// if an inner type may result in invalid output without them. For example:
|
|
56
65
|
// 1 | 2[] !== (1 | 2)[]
|
|
@@ -192,7 +201,9 @@ const typeRenderers = {
|
|
|
192
201
|
},
|
|
193
202
|
reflection(context, type) {
|
|
194
203
|
const members = [];
|
|
195
|
-
|
|
204
|
+
const children = type.declaration.children || [];
|
|
205
|
+
indentationDepth++;
|
|
206
|
+
for (const item of children) {
|
|
196
207
|
if (item.getSignature && item.setSignature) {
|
|
197
208
|
members.push(utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
198
209
|
item.name,
|
|
@@ -237,6 +248,7 @@ const typeRenderers = {
|
|
|
237
248
|
renderType(context, index.type, models_1.TypeContext.none)));
|
|
238
249
|
}
|
|
239
250
|
if (!members.length && type.declaration.signatures?.length === 1) {
|
|
251
|
+
indentationDepth--;
|
|
240
252
|
return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
241
253
|
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "("),
|
|
242
254
|
context.memberSignatureTitle(type.declaration.signatures[0], {
|
|
@@ -249,17 +261,25 @@ const typeRenderers = {
|
|
|
249
261
|
members.push(context.memberSignatureTitle(item, { hideName: true }));
|
|
250
262
|
}
|
|
251
263
|
if (members.length) {
|
|
252
|
-
const membersWithSeparators = members.flatMap((m) => [
|
|
264
|
+
const membersWithSeparators = members.flatMap((m) => [
|
|
265
|
+
includeIndentation(),
|
|
266
|
+
m,
|
|
267
|
+
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "; "),
|
|
268
|
+
utils_1.JSX.createElement("br", null),
|
|
269
|
+
]);
|
|
253
270
|
membersWithSeparators.pop();
|
|
271
|
+
indentationDepth--;
|
|
254
272
|
return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
|
|
255
273
|
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" },
|
|
256
274
|
"{",
|
|
257
275
|
" "),
|
|
276
|
+
utils_1.JSX.createElement("br", null),
|
|
258
277
|
membersWithSeparators,
|
|
259
|
-
utils_1.JSX.createElement("
|
|
260
|
-
|
|
261
|
-
|
|
278
|
+
utils_1.JSX.createElement("br", null),
|
|
279
|
+
includeIndentation(),
|
|
280
|
+
utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "}")));
|
|
262
281
|
}
|
|
282
|
+
indentationDepth--;
|
|
263
283
|
return utils_1.JSX.createElement("span", { class: "tsd-signature-symbol" }, "{}");
|
|
264
284
|
},
|
|
265
285
|
rest(context, type) {
|
|
@@ -234,7 +234,7 @@ function getEntryPointsForPackages(logger, packageGlobPaths, options) {
|
|
|
234
234
|
if (packageEntryPoint === package_manifest_1.ignorePackage) {
|
|
235
235
|
continue;
|
|
236
236
|
}
|
|
237
|
-
const tsconfigFile = ts.findConfigFile(packageEntryPoint, ts.sys.fileExists);
|
|
237
|
+
const tsconfigFile = ts.findConfigFile(packageEntryPoint, ts.sys.fileExists, typedocPackageConfig?.tsconfig);
|
|
238
238
|
if (tsconfigFile === undefined) {
|
|
239
239
|
logger.error(`Could not determine tsconfig.json for source file ${packageEntryPoint} (it must be on an ancestor path)`);
|
|
240
240
|
return;
|
|
@@ -274,12 +274,24 @@ function getEntryPointsForPackages(logger, packageGlobPaths, options) {
|
|
|
274
274
|
version: includeVersion
|
|
275
275
|
? packageJson["version"]
|
|
276
276
|
: void 0,
|
|
277
|
-
readmeFile: typedocPackageConfig?.readmeFile
|
|
278
|
-
? Path.resolve(Path.join(packageJsonPath, "..", typedocPackageConfig?.readmeFile))
|
|
279
|
-
: undefined,
|
|
277
|
+
readmeFile: discoverReadmeFile(logger, Path.join(packageJsonPath, ".."), typedocPackageConfig?.readmeFile),
|
|
280
278
|
program,
|
|
281
279
|
sourceFile,
|
|
282
280
|
});
|
|
283
281
|
}
|
|
284
282
|
return results;
|
|
285
283
|
}
|
|
284
|
+
function discoverReadmeFile(logger, packageDir, userReadme) {
|
|
285
|
+
if (userReadme) {
|
|
286
|
+
if (!FS.existsSync(Path.join(packageDir, userReadme))) {
|
|
287
|
+
logger.warn(`Failed to find ${userReadme} in ${(0, paths_1.nicePath)(packageDir)}`);
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
return Path.resolve(Path.join(packageDir, userReadme));
|
|
291
|
+
}
|
|
292
|
+
for (const file of FS.readdirSync(packageDir)) {
|
|
293
|
+
if (file.toLowerCase() === "readme.md") {
|
|
294
|
+
return Path.resolve(Path.join(packageDir, file));
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
@@ -9,6 +9,7 @@ declare const typedocPackageManifestConfigSchema: {
|
|
|
9
9
|
displayName: import("./validation").Optional<StringConstructor>;
|
|
10
10
|
entryPoint: import("./validation").Optional<StringConstructor>;
|
|
11
11
|
readmeFile: import("./validation").Optional<StringConstructor>;
|
|
12
|
+
tsconfig: import("./validation").Optional<StringConstructor>;
|
|
12
13
|
[additionalProperties]: boolean;
|
|
13
14
|
};
|
|
14
15
|
export declare type TypedocPackageManifestConfig = Infer<typeof typedocPackageManifestConfigSchema>;
|
|
@@ -32,6 +32,7 @@ const typedocPackageManifestConfigSchema = {
|
|
|
32
32
|
displayName: (0, validation_1.optional)(String),
|
|
33
33
|
entryPoint: (0, validation_1.optional)(String),
|
|
34
34
|
readmeFile: (0, validation_1.optional)(String),
|
|
35
|
+
tsconfig: (0, validation_1.optional)(String),
|
|
35
36
|
[validation_1.additionalProperties]: false,
|
|
36
37
|
};
|
|
37
38
|
/**
|
package/package.json
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RepositoryType = void 0;
|
|
4
|
-
var RepositoryType;
|
|
5
|
-
(function (RepositoryType) {
|
|
6
|
-
RepositoryType["GitHub"] = "github";
|
|
7
|
-
RepositoryType["Bitbucket"] = "bitbucket";
|
|
8
|
-
RepositoryType["GitLab"] = "gitlab";
|
|
9
|
-
})(RepositoryType = exports.RepositoryType || (exports.RepositoryType = {}));
|
package/static/widgets.png
DELETED
|
Binary file
|
package/static/widgets@2x.png
DELETED
|
Binary file
|