typedoc 0.24.0-beta.4 → 0.24.0-beta.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/dist/lib/converter/comments/discovery.js +24 -15
- package/dist/lib/converter/context.d.ts +2 -10
- package/dist/lib/converter/context.js +11 -17
- package/dist/lib/converter/plugins/CommentPlugin.js +20 -0
- package/dist/lib/converter/plugins/SourcePlugin.js +3 -0
- package/dist/lib/converter/symbols.js +41 -1
- package/dist/lib/converter/types.js +2 -2
- package/dist/lib/output/renderer.d.ts +3 -0
- package/dist/lib/output/renderer.js +6 -2
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +1 -1
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +9 -3
- package/dist/lib/output/themes/default/layouts/default.js +5 -5
- package/dist/lib/utils/options/declaration.d.ts +3 -0
- package/dist/lib/utils/options/sources/typedoc.js +5 -0
- package/dist/lib/utils/options/tsdoc-defaults.d.ts +1 -1
- package/dist/lib/utils/options/tsdoc-defaults.js +2 -0
- package/package.json +1 -1
- package/tsdoc.json +8 -0
|
@@ -10,6 +10,19 @@ const utils_1 = require("../../utils");
|
|
|
10
10
|
const declaration_1 = require("../../utils/options/declaration");
|
|
11
11
|
const paths_1 = require("../../utils/paths");
|
|
12
12
|
const assert_1 = require("assert");
|
|
13
|
+
const variablePropertyKinds = [
|
|
14
|
+
typescript_1.default.SyntaxKind.PropertyDeclaration,
|
|
15
|
+
typescript_1.default.SyntaxKind.PropertySignature,
|
|
16
|
+
typescript_1.default.SyntaxKind.BinaryExpression,
|
|
17
|
+
typescript_1.default.SyntaxKind.PropertyAssignment,
|
|
18
|
+
// class X { constructor(/** Comment */ readonly z: string) }
|
|
19
|
+
typescript_1.default.SyntaxKind.Parameter,
|
|
20
|
+
// Variable values
|
|
21
|
+
typescript_1.default.SyntaxKind.VariableDeclaration,
|
|
22
|
+
typescript_1.default.SyntaxKind.BindingElement,
|
|
23
|
+
typescript_1.default.SyntaxKind.ExportAssignment,
|
|
24
|
+
typescript_1.default.SyntaxKind.PropertyAccessExpression,
|
|
25
|
+
];
|
|
13
26
|
// Note: This does NOT include JSDoc syntax kinds. This is important!
|
|
14
27
|
// Comments from @typedef and @callback tags are handled specially by
|
|
15
28
|
// the JSDoc converter because we only want part of the comment when
|
|
@@ -23,6 +36,11 @@ const wantedKinds = {
|
|
|
23
36
|
typescript_1.default.SyntaxKind.BindingElement,
|
|
24
37
|
typescript_1.default.SyntaxKind.ExportSpecifier,
|
|
25
38
|
typescript_1.default.SyntaxKind.NamespaceExport,
|
|
39
|
+
// @namespace support
|
|
40
|
+
typescript_1.default.SyntaxKind.VariableDeclaration,
|
|
41
|
+
typescript_1.default.SyntaxKind.BindingElement,
|
|
42
|
+
typescript_1.default.SyntaxKind.ExportAssignment,
|
|
43
|
+
typescript_1.default.SyntaxKind.PropertyAccessExpression,
|
|
26
44
|
],
|
|
27
45
|
[models_1.ReflectionKind.Enum]: [
|
|
28
46
|
typescript_1.default.SyntaxKind.EnumDeclaration,
|
|
@@ -34,12 +52,7 @@ const wantedKinds = {
|
|
|
34
52
|
typescript_1.default.SyntaxKind.PropertyAssignment,
|
|
35
53
|
typescript_1.default.SyntaxKind.PropertySignature,
|
|
36
54
|
],
|
|
37
|
-
[models_1.ReflectionKind.Variable]:
|
|
38
|
-
typescript_1.default.SyntaxKind.VariableDeclaration,
|
|
39
|
-
typescript_1.default.SyntaxKind.BindingElement,
|
|
40
|
-
typescript_1.default.SyntaxKind.ExportAssignment,
|
|
41
|
-
typescript_1.default.SyntaxKind.PropertyAccessExpression,
|
|
42
|
-
],
|
|
55
|
+
[models_1.ReflectionKind.Variable]: variablePropertyKinds,
|
|
43
56
|
[models_1.ReflectionKind.Function]: [
|
|
44
57
|
typescript_1.default.SyntaxKind.FunctionDeclaration,
|
|
45
58
|
typescript_1.default.SyntaxKind.BindingElement,
|
|
@@ -51,16 +64,12 @@ const wantedKinds = {
|
|
|
51
64
|
typescript_1.default.SyntaxKind.ClassDeclaration,
|
|
52
65
|
typescript_1.default.SyntaxKind.BindingElement,
|
|
53
66
|
],
|
|
54
|
-
[models_1.ReflectionKind.Interface]: [
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
typescript_1.default.SyntaxKind.PropertyDeclaration,
|
|
58
|
-
typescript_1.default.SyntaxKind.PropertySignature,
|
|
59
|
-
typescript_1.default.SyntaxKind.BinaryExpression,
|
|
60
|
-
typescript_1.default.SyntaxKind.PropertyAssignment,
|
|
61
|
-
// class X { constructor(/** Comment */ readonly z: string) }
|
|
62
|
-
typescript_1.default.SyntaxKind.Parameter,
|
|
67
|
+
[models_1.ReflectionKind.Interface]: [
|
|
68
|
+
typescript_1.default.SyntaxKind.InterfaceDeclaration,
|
|
69
|
+
typescript_1.default.SyntaxKind.TypeAliasDeclaration,
|
|
63
70
|
],
|
|
71
|
+
[models_1.ReflectionKind.Constructor]: [typescript_1.default.SyntaxKind.Constructor],
|
|
72
|
+
[models_1.ReflectionKind.Property]: variablePropertyKinds,
|
|
64
73
|
[models_1.ReflectionKind.Method]: [
|
|
65
74
|
typescript_1.default.SyntaxKind.FunctionDeclaration,
|
|
66
75
|
typescript_1.default.SyntaxKind.MethodDeclaration,
|
|
@@ -31,13 +31,9 @@ export declare class Context {
|
|
|
31
31
|
* The scope or parent reflection that is currently processed.
|
|
32
32
|
*/
|
|
33
33
|
readonly scope: Reflection;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
/** @internal */
|
|
37
|
-
setConvertingTypeNode(): void;
|
|
38
|
-
/** @internal */
|
|
34
|
+
convertingTypeNode: boolean;
|
|
35
|
+
convertingClassOrInterface: boolean;
|
|
39
36
|
shouldBeStatic: boolean;
|
|
40
|
-
private convertingTypeNode;
|
|
41
37
|
/**
|
|
42
38
|
* Create a new Context instance.
|
|
43
39
|
*
|
|
@@ -47,10 +43,6 @@ export declare class Context {
|
|
|
47
43
|
constructor(converter: Converter, programs: readonly ts.Program[], project: ProjectReflection, scope?: Context["scope"]);
|
|
48
44
|
/** @internal */
|
|
49
45
|
get logger(): import("../utils").Logger;
|
|
50
|
-
/**
|
|
51
|
-
* Return the compiler options.
|
|
52
|
-
*/
|
|
53
|
-
getCompilerOptions(): ts.CompilerOptions;
|
|
54
46
|
/**
|
|
55
47
|
* Return the type declaration of the given node.
|
|
56
48
|
*
|
|
@@ -30,14 +30,6 @@ class Context {
|
|
|
30
30
|
(0, assert_1.ok)(this._program, "Tried to access Context.program when not converting a source file");
|
|
31
31
|
return this._program;
|
|
32
32
|
}
|
|
33
|
-
/** @internal */
|
|
34
|
-
isConvertingTypeNode() {
|
|
35
|
-
return this.convertingTypeNode;
|
|
36
|
-
}
|
|
37
|
-
/** @internal */
|
|
38
|
-
setConvertingTypeNode() {
|
|
39
|
-
this.convertingTypeNode = true;
|
|
40
|
-
}
|
|
41
33
|
/**
|
|
42
34
|
* Create a new Context instance.
|
|
43
35
|
*
|
|
@@ -45,9 +37,9 @@ class Context {
|
|
|
45
37
|
* @internal
|
|
46
38
|
*/
|
|
47
39
|
constructor(converter, programs, project, scope = project) {
|
|
48
|
-
|
|
49
|
-
this.
|
|
50
|
-
this.
|
|
40
|
+
this.convertingTypeNode = false; // Inherited by withScope
|
|
41
|
+
this.convertingClassOrInterface = false; // Not inherited
|
|
42
|
+
this.shouldBeStatic = false; // Not inherited
|
|
51
43
|
this.converter = converter;
|
|
52
44
|
this.programs = programs;
|
|
53
45
|
this.project = project;
|
|
@@ -57,12 +49,6 @@ class Context {
|
|
|
57
49
|
get logger() {
|
|
58
50
|
return this.converter.application.logger;
|
|
59
51
|
}
|
|
60
|
-
/**
|
|
61
|
-
* Return the compiler options.
|
|
62
|
-
*/
|
|
63
|
-
getCompilerOptions() {
|
|
64
|
-
return this.converter.application.options.getCompilerOptions();
|
|
65
|
-
}
|
|
66
52
|
/**
|
|
67
53
|
* Return the type declaration of the given node.
|
|
68
54
|
*
|
|
@@ -112,6 +98,14 @@ class Context {
|
|
|
112
98
|
// We need this because modules don't always have symbols.
|
|
113
99
|
nameOverride) {
|
|
114
100
|
const name = (0, tsutils_1.getHumanName)(nameOverride ?? exportSymbol?.name ?? symbol?.name ?? "unknown");
|
|
101
|
+
if (this.convertingClassOrInterface) {
|
|
102
|
+
if (kind === index_1.ReflectionKind.Function) {
|
|
103
|
+
kind = index_1.ReflectionKind.Method;
|
|
104
|
+
}
|
|
105
|
+
if (kind === index_1.ReflectionKind.Variable) {
|
|
106
|
+
kind = index_1.ReflectionKind.Property;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
115
109
|
const reflection = new index_1.DeclarationReflection(name, kind, this.scope);
|
|
116
110
|
this.postReflectionCreation(reflection, symbol, exportSymbol);
|
|
117
111
|
return reflection;
|
|
@@ -117,6 +117,12 @@ let CommentPlugin = class CommentPlugin extends components_1.ConverterComponent
|
|
|
117
117
|
* @param comment The comment that should be searched for modifiers.
|
|
118
118
|
*/
|
|
119
119
|
applyModifiers(reflection, comment) {
|
|
120
|
+
if (reflection.kindOf(models_1.ReflectionKind.SomeModule)) {
|
|
121
|
+
comment.removeModifier("@namespace");
|
|
122
|
+
}
|
|
123
|
+
if (reflection.kindOf(models_1.ReflectionKind.Interface)) {
|
|
124
|
+
comment.removeModifier("@interface");
|
|
125
|
+
}
|
|
120
126
|
if (comment.hasModifier("@private")) {
|
|
121
127
|
reflection.setFlag(models_1.ReflectionFlag.Private);
|
|
122
128
|
if (reflection.kindOf(models_1.ReflectionKind.CallSignature)) {
|
|
@@ -267,6 +273,7 @@ let CommentPlugin = class CommentPlugin extends components_1.ConverterComponent
|
|
|
267
273
|
`Labels may only contain A-Z, 0-9, and _, and may not start with a number.`);
|
|
268
274
|
}
|
|
269
275
|
mergeSeeTags(reflection.comment);
|
|
276
|
+
movePropertyTags(reflection.comment, reflection);
|
|
270
277
|
}
|
|
271
278
|
if (!(reflection instanceof models_1.DeclarationReflection)) {
|
|
272
279
|
return;
|
|
@@ -445,6 +452,19 @@ function moveNestedParamTags(comment, parameter) {
|
|
|
445
452
|
};
|
|
446
453
|
parameter.type?.visit(visitor);
|
|
447
454
|
}
|
|
455
|
+
function movePropertyTags(comment, container) {
|
|
456
|
+
const propTags = comment.blockTags.filter((tag) => tag.tag === "@prop" || tag.tag === "@property");
|
|
457
|
+
comment.removeTags("@prop");
|
|
458
|
+
comment.removeTags("@property");
|
|
459
|
+
for (const prop of propTags) {
|
|
460
|
+
if (!prop.name)
|
|
461
|
+
continue;
|
|
462
|
+
const child = container.getChildByName(prop.name);
|
|
463
|
+
if (child) {
|
|
464
|
+
child.comment = new models_1.Comment(models_1.Comment.cloneDisplayParts(prop.content));
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
}
|
|
448
468
|
function mergeSeeTags(comment) {
|
|
449
469
|
const see = comment.getTags("@see");
|
|
450
470
|
if (see.length < 2)
|
|
@@ -75,6 +75,9 @@ let SourcePlugin = class SourcePlugin extends components_1.ConverterComponent {
|
|
|
75
75
|
if ((0, nodes_1.isNamedNode)(node)) {
|
|
76
76
|
position = typescript_1.default.getLineAndCharacterOfPosition(sourceFile, node.name.getStart());
|
|
77
77
|
}
|
|
78
|
+
else if (typescript_1.default.isSourceFile(node)) {
|
|
79
|
+
position = { character: 0, line: 0 };
|
|
80
|
+
}
|
|
78
81
|
else {
|
|
79
82
|
position = typescript_1.default.getLineAndCharacterOfPosition(sourceFile, node.getStart());
|
|
80
83
|
}
|
|
@@ -191,6 +191,9 @@ function convertTypeAlias(context, symbol, exportSymbol) {
|
|
|
191
191
|
typescript_1.default.isJSDocEnumTag(d));
|
|
192
192
|
(0, assert_1.default)(declaration);
|
|
193
193
|
if (typescript_1.default.isTypeAliasDeclaration(declaration)) {
|
|
194
|
+
if (symbol.getJsDocTags().some((tag) => tag.name === "interface")) {
|
|
195
|
+
return convertTypeAliasAsInterface(context, symbol, exportSymbol, declaration);
|
|
196
|
+
}
|
|
194
197
|
const reflection = context.createDeclarationReflection(models_1.ReflectionKind.TypeAlias, symbol, exportSymbol);
|
|
195
198
|
reflection.type = context.converter.convertType(context.withScope(reflection), declaration.type);
|
|
196
199
|
context.finalizeDeclarationReflection(reflection);
|
|
@@ -206,6 +209,30 @@ function convertTypeAlias(context, symbol, exportSymbol) {
|
|
|
206
209
|
(0, jsdoc_1.convertJsDocCallback)(context, symbol, declaration, exportSymbol);
|
|
207
210
|
}
|
|
208
211
|
}
|
|
212
|
+
function convertTypeAliasAsInterface(context, symbol, exportSymbol, declaration) {
|
|
213
|
+
const reflection = context.createDeclarationReflection(models_1.ReflectionKind.Interface, symbol, exportSymbol);
|
|
214
|
+
context.finalizeDeclarationReflection(reflection);
|
|
215
|
+
const rc = context.withScope(reflection);
|
|
216
|
+
const type = context.checker.getTypeAtLocation(declaration);
|
|
217
|
+
// Interfaces have properties
|
|
218
|
+
convertSymbols(rc, type.getProperties());
|
|
219
|
+
// And type arguments
|
|
220
|
+
if (declaration.typeParameters) {
|
|
221
|
+
reflection.typeParameters = declaration.typeParameters.map((param) => {
|
|
222
|
+
const declaration = param.symbol?.declarations?.[0];
|
|
223
|
+
(0, assert_1.default)(declaration && typescript_1.default.isTypeParameterDeclaration(declaration));
|
|
224
|
+
return (0, signature_1.createTypeParamReflection)(declaration, rc);
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
// And maybe call signatures
|
|
228
|
+
context.checker
|
|
229
|
+
.getSignaturesOfType(type, typescript_1.default.SignatureKind.Call)
|
|
230
|
+
.forEach((sig) => (0, signature_1.createSignature)(rc, models_1.ReflectionKind.CallSignature, sig, symbol));
|
|
231
|
+
// And maybe constructor signatures
|
|
232
|
+
convertConstructSignatures(rc, symbol);
|
|
233
|
+
// And finally, index signatures
|
|
234
|
+
(0, index_signature_1.convertIndexSignature)(rc, symbol);
|
|
235
|
+
}
|
|
209
236
|
function convertFunctionOrMethod(context, symbol, exportSymbol) {
|
|
210
237
|
// Can't just check method flag because this might be called for properties as well
|
|
211
238
|
// This will *NOT* be called for variables that look like functions, they need a special case.
|
|
@@ -258,6 +285,7 @@ function convertClassOrInterface(context, symbol, exportSymbol) {
|
|
|
258
285
|
if (classDeclaration)
|
|
259
286
|
setModifiers(symbol, classDeclaration, reflection);
|
|
260
287
|
const reflectionContext = context.withScope(reflection);
|
|
288
|
+
reflectionContext.convertingClassOrInterface = true;
|
|
261
289
|
const instanceType = context.checker.getDeclaredTypeOfSymbol(symbol);
|
|
262
290
|
(0, assert_1.default)(instanceType.isClassOrInterface());
|
|
263
291
|
// We might do some inheritance - do this first so that it's set when converting properties
|
|
@@ -362,7 +390,7 @@ function convertProperty(context, symbol, exportSymbol) {
|
|
|
362
390
|
setModifiers(symbol, declaration, reflection);
|
|
363
391
|
}
|
|
364
392
|
reflection.defaultValue = declaration && (0, convert_expression_1.convertDefaultValue)(declaration);
|
|
365
|
-
reflection.type = context.converter.convertType(context.withScope(reflection), (context.
|
|
393
|
+
reflection.type = context.converter.convertType(context.withScope(reflection), (context.convertingTypeNode ? parameterType : void 0) ??
|
|
366
394
|
context.checker.getTypeOfSymbol(symbol));
|
|
367
395
|
if (reflection.flags.isOptional) {
|
|
368
396
|
reflection.type = (0, reflections_1.removeUndefined)(reflection.type);
|
|
@@ -429,6 +457,9 @@ function convertVariable(context, symbol, exportSymbol) {
|
|
|
429
457
|
symbol.getJsDocTags().some((tag) => tag.name === "enum")) {
|
|
430
458
|
return convertVariableAsEnum(context, symbol, exportSymbol);
|
|
431
459
|
}
|
|
460
|
+
if (symbol.getJsDocTags().some((tag) => tag.name === "namespace")) {
|
|
461
|
+
return convertVariableAsNamespace(context, symbol, exportSymbol);
|
|
462
|
+
}
|
|
432
463
|
if (type.getCallSignatures().length) {
|
|
433
464
|
return convertVariableAsFunction(context, symbol, exportSymbol);
|
|
434
465
|
}
|
|
@@ -471,6 +502,15 @@ function convertVariableAsEnum(context, symbol, exportSymbol) {
|
|
|
471
502
|
// Skip converting the type alias, if there is one
|
|
472
503
|
return typescript_1.default.SymbolFlags.TypeAlias;
|
|
473
504
|
}
|
|
505
|
+
function convertVariableAsNamespace(context, symbol, exportSymbol) {
|
|
506
|
+
const reflection = context.createDeclarationReflection(models_1.ReflectionKind.Namespace, symbol, exportSymbol);
|
|
507
|
+
context.finalizeDeclarationReflection(reflection);
|
|
508
|
+
const rc = context.withScope(reflection);
|
|
509
|
+
const declaration = symbol.declarations[0];
|
|
510
|
+
const type = context.checker.getTypeAtLocation(declaration);
|
|
511
|
+
convertSymbols(rc, type.getProperties());
|
|
512
|
+
return typescript_1.default.SymbolFlags.Property;
|
|
513
|
+
}
|
|
474
514
|
function convertVariableAsFunction(context, symbol, exportSymbol) {
|
|
475
515
|
const declaration = symbol
|
|
476
516
|
.getDeclarations()
|
|
@@ -143,7 +143,7 @@ const constructorConverter = {
|
|
|
143
143
|
}
|
|
144
144
|
const reflection = new models_1.DeclarationReflection("__type", models_1.ReflectionKind.Constructor, context.scope);
|
|
145
145
|
const rc = context.withScope(reflection);
|
|
146
|
-
rc.
|
|
146
|
+
rc.convertingTypeNode = true;
|
|
147
147
|
context.registerReflection(reflection, symbol);
|
|
148
148
|
context.trigger(converter_events_1.ConverterEvents.CREATE_DECLARATION, reflection);
|
|
149
149
|
const signature = new models_1.SignatureReflection("__type", models_1.ReflectionKind.ConstructorSignature, reflection);
|
|
@@ -346,7 +346,7 @@ const typeLiteralConverter = {
|
|
|
346
346
|
}
|
|
347
347
|
const reflection = new models_1.DeclarationReflection("__type", models_1.ReflectionKind.TypeLiteral, context.scope);
|
|
348
348
|
const rc = context.withScope(reflection);
|
|
349
|
-
rc.
|
|
349
|
+
rc.convertingTypeNode = true;
|
|
350
350
|
context.registerReflection(reflection, symbol);
|
|
351
351
|
context.trigger(converter_events_1.ConverterEvents.CREATE_DECLARATION, reflection);
|
|
352
352
|
for (const prop of context.checker.getPropertiesOfType(type)) {
|
|
@@ -132,9 +132,12 @@ export declare class Renderer extends ChildableComponent<Application, RendererCo
|
|
|
132
132
|
/** @internal */
|
|
133
133
|
githubPages: boolean;
|
|
134
134
|
/** @internal */
|
|
135
|
+
cacheBust: boolean;
|
|
136
|
+
/** @internal */
|
|
135
137
|
lightTheme: ShikiTheme;
|
|
136
138
|
/** @internal */
|
|
137
139
|
darkTheme: ShikiTheme;
|
|
140
|
+
renderStartTime: number;
|
|
138
141
|
/**
|
|
139
142
|
* Define a new theme that can be used to render output.
|
|
140
143
|
* This API will likely be changing at some point, to allow more easily overriding parts of the theme without
|
|
@@ -117,6 +117,7 @@ let Renderer = class Renderer extends component_1.ChildableComponent {
|
|
|
117
117
|
* See {@link RendererHooks} for a description of each available hook, and when it will be called.
|
|
118
118
|
*/
|
|
119
119
|
this.hooks = new utils_1.EventHooks();
|
|
120
|
+
this.renderStartTime = -1;
|
|
120
121
|
}
|
|
121
122
|
/**
|
|
122
123
|
* Define a new theme that can be used to render output.
|
|
@@ -139,9 +140,9 @@ let Renderer = class Renderer extends component_1.ChildableComponent {
|
|
|
139
140
|
*/
|
|
140
141
|
async render(project, outputDirectory) {
|
|
141
142
|
const momento = this.hooks.saveMomento();
|
|
142
|
-
|
|
143
|
+
this.renderStartTime = Date.now();
|
|
143
144
|
await (0, highlighter_1.loadHighlighter)(this.lightTheme, this.darkTheme);
|
|
144
|
-
this.application.logger.verbose(`Renderer: Loading highlighter took ${Date.now() -
|
|
145
|
+
this.application.logger.verbose(`Renderer: Loading highlighter took ${Date.now() - this.renderStartTime}ms`);
|
|
145
146
|
if (!this.prepareTheme() ||
|
|
146
147
|
!(await this.prepareOutputDirectory(outputDirectory))) {
|
|
147
148
|
return;
|
|
@@ -286,6 +287,9 @@ __decorate([
|
|
|
286
287
|
__decorate([
|
|
287
288
|
(0, utils_1.BindOption)("githubPages")
|
|
288
289
|
], Renderer.prototype, "githubPages", void 0);
|
|
290
|
+
__decorate([
|
|
291
|
+
(0, utils_1.BindOption)("cacheBust")
|
|
292
|
+
], Renderer.prototype, "cacheBust", void 0);
|
|
289
293
|
__decorate([
|
|
290
294
|
(0, utils_1.BindOption)("lightHighlightTheme")
|
|
291
295
|
], Renderer.prototype, "lightTheme", void 0);
|
|
@@ -9,7 +9,7 @@ export declare class DefaultThemeRenderContext {
|
|
|
9
9
|
icons: Record<"search" | "anchor" | ReflectionKind | "checkbox" | "chevronDown" | "menu" | "chevronSmall", () => import("../../../utils/jsx.elements").JsxElement>;
|
|
10
10
|
hook: (name: keyof RendererHooks) => import("../../../utils/jsx.elements").JsxElement[];
|
|
11
11
|
/** Avoid this in favor of urlTo if possible */
|
|
12
|
-
relativeURL: (url: string
|
|
12
|
+
relativeURL: (url: string, cacheBust?: boolean) => string;
|
|
13
13
|
urlTo: (reflection: Reflection) => string;
|
|
14
14
|
markdown: (md: readonly CommentDisplayPart[] | NeverIfInternal<string | undefined>) => string;
|
|
15
15
|
/**
|
|
@@ -38,10 +38,16 @@ class DefaultThemeRenderContext {
|
|
|
38
38
|
this.icons = icon_1.icons;
|
|
39
39
|
this.hook = (name) => this.theme.owner.hooks.emit(name, this);
|
|
40
40
|
/** Avoid this in favor of urlTo if possible */
|
|
41
|
-
this.relativeURL = (url) => {
|
|
42
|
-
|
|
41
|
+
this.relativeURL = (url, cacheBust = false) => {
|
|
42
|
+
const result = this.theme.markedPlugin.getRelativeUrl(url);
|
|
43
|
+
if (cacheBust && this.theme.owner.cacheBust) {
|
|
44
|
+
return result + `?cache=${this.theme.owner.renderStartTime}`;
|
|
45
|
+
}
|
|
46
|
+
return result;
|
|
47
|
+
};
|
|
48
|
+
this.urlTo = (reflection) => {
|
|
49
|
+
return reflection.url ? this.relativeURL(reflection.url) : "";
|
|
43
50
|
};
|
|
44
|
-
this.urlTo = (reflection) => this.relativeURL(reflection.url);
|
|
45
51
|
this.markdown = (md) => {
|
|
46
52
|
if (md instanceof Array) {
|
|
47
53
|
return this.theme.markedPlugin.parseMarkdown(models_1.Comment.displayPartsToMarkdown(md, this.urlTo));
|
|
@@ -12,10 +12,10 @@ const defaultLayout = (context, props) => (utils_1.JSX.createElement("html", { c
|
|
|
12
12
|
: `${props.model.name} | ${props.project.name}`),
|
|
13
13
|
utils_1.JSX.createElement("meta", { name: "description", content: "Documentation for " + props.project.name }),
|
|
14
14
|
utils_1.JSX.createElement("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }),
|
|
15
|
-
utils_1.JSX.createElement("link", { rel: "stylesheet", href: context.relativeURL("assets/style.css") }),
|
|
16
|
-
utils_1.JSX.createElement("link", { rel: "stylesheet", href: context.relativeURL("assets/highlight.css") }),
|
|
17
|
-
context.options.getValue("customCss") && (utils_1.JSX.createElement("link", { rel: "stylesheet", href: context.relativeURL("assets/custom.css") })),
|
|
18
|
-
utils_1.JSX.createElement("script", { async: true, src: context.relativeURL("assets/search.js"), id: "search-script" }),
|
|
15
|
+
utils_1.JSX.createElement("link", { rel: "stylesheet", href: context.relativeURL("assets/style.css", true) }),
|
|
16
|
+
utils_1.JSX.createElement("link", { rel: "stylesheet", href: context.relativeURL("assets/highlight.css", true) }),
|
|
17
|
+
context.options.getValue("customCss") && (utils_1.JSX.createElement("link", { rel: "stylesheet", href: context.relativeURL("assets/custom.css", true) })),
|
|
18
|
+
utils_1.JSX.createElement("script", { async: true, src: context.relativeURL("assets/search.js", true), id: "search-script" }),
|
|
19
19
|
context.hook("head.end")),
|
|
20
20
|
utils_1.JSX.createElement("body", null,
|
|
21
21
|
context.hook("body.begin"),
|
|
@@ -34,7 +34,7 @@ const defaultLayout = (context, props) => (utils_1.JSX.createElement("html", { c
|
|
|
34
34
|
context.hook("content.end"))),
|
|
35
35
|
context.footer(),
|
|
36
36
|
utils_1.JSX.createElement("div", { class: "overlay" }),
|
|
37
|
-
utils_1.JSX.createElement("script", { src: context.relativeURL("assets/main.js") }),
|
|
37
|
+
utils_1.JSX.createElement("script", { src: context.relativeURL("assets/main.js", true) }),
|
|
38
38
|
context.analytics(),
|
|
39
39
|
context.hook("body.end"))));
|
|
40
40
|
exports.defaultLayout = defaultLayout;
|
|
@@ -26,6 +26,7 @@ export type CommentStyle = (typeof CommentStyle)[keyof typeof CommentStyle];
|
|
|
26
26
|
* An interface describing all TypeDoc specific options. Generated from a
|
|
27
27
|
* map which contains more information about each option for better types when
|
|
28
28
|
* defining said options.
|
|
29
|
+
* @interface
|
|
29
30
|
*/
|
|
30
31
|
export type TypeDocOptions = {
|
|
31
32
|
[K in keyof TypeDocOptionMap]: unknown extends TypeDocOptionMap[K] ? unknown : TypeDocOptionMap[K] extends ManuallyValidatedOption<infer ManuallyValidated> ? ManuallyValidated : TypeDocOptionMap[K] extends string | string[] | number | boolean ? TypeDocOptionMap[K] : TypeDocOptionMap[K] extends Record<string, boolean> ? Partial<TypeDocOptionMap[K]> | boolean : keyof TypeDocOptionMap[K] | TypeDocOptionMap[K][keyof TypeDocOptionMap[K]];
|
|
@@ -34,6 +35,7 @@ export type TypeDocOptions = {
|
|
|
34
35
|
* Describes all TypeDoc specific options as returned by {@link Options.getValue}, this is
|
|
35
36
|
* slightly more restrictive than the {@link TypeDocOptions} since it does not allow both
|
|
36
37
|
* keys and values for mapped option types, and does not allow partials of flag values.
|
|
38
|
+
* @interface
|
|
37
39
|
*/
|
|
38
40
|
export type TypeDocOptionValues = {
|
|
39
41
|
[K in keyof TypeDocOptionMap]: unknown extends TypeDocOptionMap[K] ? unknown : TypeDocOptionMap[K] extends ManuallyValidatedOption<infer ManuallyValidated> ? ManuallyValidated : TypeDocOptionMap[K] extends string | string[] | number | boolean | Record<string, boolean> ? TypeDocOptionMap[K] : TypeDocOptionMap[K][keyof TypeDocOptionMap[K]];
|
|
@@ -93,6 +95,7 @@ export interface TypeDocOptionMap {
|
|
|
93
95
|
githubPages: boolean;
|
|
94
96
|
gaID: string;
|
|
95
97
|
hideGenerator: boolean;
|
|
98
|
+
cacheBust: boolean;
|
|
96
99
|
searchInComments: boolean;
|
|
97
100
|
cleanOutputDir: boolean;
|
|
98
101
|
titleLink: string;
|
|
@@ -347,6 +347,11 @@ function addTypeDocOptions(options) {
|
|
|
347
347
|
help: "Do not print the TypeDoc link at the end of the page.",
|
|
348
348
|
type: declaration_1.ParameterType.Boolean,
|
|
349
349
|
});
|
|
350
|
+
options.addDeclaration({
|
|
351
|
+
name: "cacheBust",
|
|
352
|
+
help: "Include the generation time in links to static assets.",
|
|
353
|
+
type: declaration_1.ParameterType.Boolean,
|
|
354
|
+
});
|
|
350
355
|
options.addDeclaration({
|
|
351
356
|
name: "searchInComments",
|
|
352
357
|
help: "If set, the search index will also include comments. This will greatly increase the size of the search index.",
|
|
@@ -3,4 +3,4 @@ export declare const blockTags: readonly ["@deprecated", "@param", "@remarks", "
|
|
|
3
3
|
export declare const tsdocInlineTags: readonly ["@link", "@inheritDoc", "@label"];
|
|
4
4
|
export declare const inlineTags: string[];
|
|
5
5
|
export declare const tsdocModifierTags: readonly ["@public", "@private", "@protected", "@internal", "@readonly", "@packageDocumentation", "@eventProperty", "@alpha", "@beta", "@experimental", "@sealed", "@override", "@virtual"];
|
|
6
|
-
export declare const modifierTags: readonly ["@public", "@private", "@protected", "@internal", "@readonly", "@packageDocumentation", "@eventProperty", "@alpha", "@beta", "@experimental", "@sealed", "@override", "@virtual", "@hidden", "@ignore", "@enum", "@event", "@overload"];
|
|
6
|
+
export declare const modifierTags: readonly ["@public", "@private", "@protected", "@internal", "@readonly", "@packageDocumentation", "@eventProperty", "@alpha", "@beta", "@experimental", "@sealed", "@override", "@virtual", "@hidden", "@ignore", "@enum", "@event", "@overload", "@namespace", "@interface"];
|
package/package.json
CHANGED