typedoc 0.28.13 → 0.28.14
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/index.d.ts +1 -0
- package/dist/lib/converter/comments/parser.js +16 -2
- package/dist/lib/converter/converter.js +1 -0
- package/dist/lib/converter/factories/signature.js +5 -4
- package/dist/lib/converter/plugins/CommentPlugin.d.ts +1 -0
- package/dist/lib/converter/plugins/CommentPlugin.js +35 -11
- package/dist/lib/converter/symbols.js +7 -0
- package/dist/lib/converter/types.js +18 -6
- package/dist/lib/internationalization/locales/de.cjs +0 -1
- package/dist/lib/internationalization/locales/de.d.cts +0 -1
- package/dist/lib/internationalization/locales/en.cjs +3 -1
- package/dist/lib/internationalization/locales/en.d.cts +3 -1
- package/dist/lib/internationalization/locales/ja.cjs +0 -1
- package/dist/lib/internationalization/locales/ja.d.cts +0 -1
- package/dist/lib/internationalization/locales/ko.cjs +0 -1
- package/dist/lib/internationalization/locales/ko.d.cts +0 -1
- package/dist/lib/internationalization/locales/zh.cjs +0 -1
- package/dist/lib/internationalization/locales/zh.d.cts +0 -1
- package/dist/lib/models/Comment.d.ts +5 -0
- package/dist/lib/models/Comment.js +10 -0
- package/dist/lib/output/themes/MarkedPlugin.js +8 -1
- package/dist/lib/output/themes/default/Slugger.d.ts +1 -1
- package/dist/lib/output/themes/default/Slugger.js +13 -5
- package/dist/lib/output/themes/default/partials/comment.js +1 -0
- package/dist/lib/serialization/schema.d.ts +1 -1
- package/dist/lib/utils/options/declaration.d.ts +2 -0
- package/dist/lib/utils/options/defaults.d.ts +1 -0
- package/dist/lib/utils/options/defaults.js +1 -0
- package/dist/lib/utils/options/sources/typedoc.js +13 -0
- package/dist/lib/utils/options/tsdoc-defaults.d.ts +1 -1
- package/dist/lib/utils/options/tsdoc-defaults.js +1 -0
- package/dist/lib/utils-common/general.js +2 -0
- package/package.json +3 -3
- package/tsdoc.json +5 -0
|
@@ -8,6 +8,7 @@ export interface CommentParserConfig {
|
|
|
8
8
|
blockTags: Set<string>;
|
|
9
9
|
inlineTags: Set<string>;
|
|
10
10
|
modifierTags: Set<string>;
|
|
11
|
+
preservedTypeAnnotationTags: Set<string>;
|
|
11
12
|
jsDocCompatibility: JsDocCompatibility;
|
|
12
13
|
suppressCommentWarningsInDeclarationFiles: boolean;
|
|
13
14
|
useTsLinkResolution: boolean;
|
|
@@ -222,14 +222,28 @@ function blockTag(comment, lexer, config, i18n, warning, files) {
|
|
|
222
222
|
if (tagName === "@example") {
|
|
223
223
|
return exampleBlock(comment, lexer, config, i18n, warning, files);
|
|
224
224
|
}
|
|
225
|
-
|
|
225
|
+
let typeAnnotation;
|
|
226
|
+
if (!lexer.done() &&
|
|
227
|
+
config.preservedTypeAnnotationTags.has(tagName)) {
|
|
228
|
+
if (lexer.peek().kind === TokenSyntaxKind.Text && /^\s+$/.test(lexer.peek().text)) {
|
|
229
|
+
lexer.take();
|
|
230
|
+
}
|
|
231
|
+
if (lexer.peek().kind === TokenSyntaxKind.TypeAnnotation) {
|
|
232
|
+
typeAnnotation = lexer.take().text;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
if (["@default", "@defaultValue"].includes(tagName) &&
|
|
226
236
|
config.jsDocCompatibility.defaultTag) {
|
|
227
237
|
content = defaultBlockContent(comment, lexer, config, i18n, warning, files);
|
|
228
238
|
}
|
|
229
239
|
else {
|
|
230
240
|
content = blockContent(comment, lexer, config, i18n, warning, files);
|
|
231
241
|
}
|
|
232
|
-
|
|
242
|
+
const tag = new CommentTag(tagName, content);
|
|
243
|
+
if (typeAnnotation) {
|
|
244
|
+
tag.typeAnnotation = typeAnnotation;
|
|
245
|
+
}
|
|
246
|
+
return tag;
|
|
233
247
|
}
|
|
234
248
|
/**
|
|
235
249
|
* The `@default` tag gets a special case because otherwise we will produce many warnings
|
|
@@ -609,6 +609,7 @@ let Converter = (() => {
|
|
|
609
609
|
blockTags: new Set(this.application.options.getValue("blockTags")),
|
|
610
610
|
inlineTags: new Set(this.application.options.getValue("inlineTags")),
|
|
611
611
|
modifierTags: new Set(this.application.options.getValue("modifierTags")),
|
|
612
|
+
preservedTypeAnnotationTags: new Set(this.application.options.getValue("preservedTypeAnnotationTags")),
|
|
612
613
|
jsDocCompatibility: this.application.options.getValue("jsDocCompatibility"),
|
|
613
614
|
suppressCommentWarningsInDeclarationFiles: this.application.options.getValue("suppressCommentWarningsInDeclarationFiles"),
|
|
614
615
|
useTsLinkResolution: this.application.options.getValue("useTsLinkResolution"),
|
|
@@ -113,7 +113,7 @@ function convertParameters(context, sigRef, parameters, parameterNodes) {
|
|
|
113
113
|
assert(!declaration ||
|
|
114
114
|
ts.isParameter(declaration) ||
|
|
115
115
|
ts.isJSDocParameterTag(declaration));
|
|
116
|
-
const paramRefl = new ParameterReflection(
|
|
116
|
+
const paramRefl = new ParameterReflection(/^__\d+$/.test(param.name) ? "__namedParameters" : param.name, ReflectionKind.Parameter, sigRef);
|
|
117
117
|
if (declaration && ts.isJSDocParameterTag(declaration)) {
|
|
118
118
|
paramRefl.comment = context.getJsDocComment(declaration);
|
|
119
119
|
}
|
|
@@ -132,7 +132,7 @@ function convertParameters(context, sigRef, parameters, parameterNodes) {
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
else {
|
|
135
|
-
type = param
|
|
135
|
+
type = context.checker.getTypeOfSymbol(param);
|
|
136
136
|
}
|
|
137
137
|
if (declaration &&
|
|
138
138
|
ts.isParameter(declaration) &&
|
|
@@ -160,8 +160,9 @@ function convertParameters(context, sigRef, parameters, parameterNodes) {
|
|
|
160
160
|
paramRefl.defaultValue = convertDefaultValue(parameterNodes?.[i + parameterNodeOffset]);
|
|
161
161
|
paramRefl.setFlag(ReflectionFlag.Optional, isOptional);
|
|
162
162
|
// If we have no declaration, then this is an implicitly defined parameter in JS land
|
|
163
|
-
// because the method body uses `arguments`... which is always a rest argument
|
|
164
|
-
|
|
163
|
+
// because the method body uses `arguments`... which is always a rest argument,
|
|
164
|
+
// unless it is a this parameter defined with @this in JSDoc.
|
|
165
|
+
let isRest = param.name !== "this";
|
|
165
166
|
if (declaration) {
|
|
166
167
|
isRest = ts.isParameter(declaration)
|
|
167
168
|
? !!declaration.dotDotDotToken
|
|
@@ -61,6 +61,7 @@ export declare class CommentPlugin extends ConverterComponent {
|
|
|
61
61
|
accessor cascadedModifierTags: TagString[];
|
|
62
62
|
accessor excludeInternal: boolean;
|
|
63
63
|
accessor excludePrivate: boolean;
|
|
64
|
+
accessor excludePrivateClassFields: boolean;
|
|
64
65
|
accessor excludeProtected: boolean;
|
|
65
66
|
accessor excludeNotDocumented: boolean;
|
|
66
67
|
accessor excludeCategories: string[];
|
|
@@ -44,9 +44,9 @@ import { CategoryPlugin } from "./CategoryPlugin.js";
|
|
|
44
44
|
* (for JS users) will be consumed by TypeScript and need not be preserved
|
|
45
45
|
* in the comment.
|
|
46
46
|
*
|
|
47
|
-
* Note that param/arg/argument/return/returns are not present.
|
|
47
|
+
* Note that param/arg/argument/return/returns/this are not present.
|
|
48
48
|
* These tags will have their type information stripped when parsing, but still
|
|
49
|
-
* provide useful information for documentation.
|
|
49
|
+
* may provide useful information for documentation.
|
|
50
50
|
*/
|
|
51
51
|
const NEVER_RENDERED = [
|
|
52
52
|
"@augments",
|
|
@@ -55,7 +55,6 @@ const NEVER_RENDERED = [
|
|
|
55
55
|
"@constructor",
|
|
56
56
|
"@enum",
|
|
57
57
|
"@extends",
|
|
58
|
-
"@this",
|
|
59
58
|
"@type",
|
|
60
59
|
"@typedef",
|
|
61
60
|
"@jsx",
|
|
@@ -140,6 +139,9 @@ let CommentPlugin = (() => {
|
|
|
140
139
|
let _excludePrivate_decorators;
|
|
141
140
|
let _excludePrivate_initializers = [];
|
|
142
141
|
let _excludePrivate_extraInitializers = [];
|
|
142
|
+
let _excludePrivateClassFields_decorators;
|
|
143
|
+
let _excludePrivateClassFields_initializers = [];
|
|
144
|
+
let _excludePrivateClassFields_extraInitializers = [];
|
|
143
145
|
let _excludeProtected_decorators;
|
|
144
146
|
let _excludeProtected_initializers = [];
|
|
145
147
|
let _excludeProtected_extraInitializers = [];
|
|
@@ -159,6 +161,7 @@ let CommentPlugin = (() => {
|
|
|
159
161
|
_cascadedModifierTags_decorators = [Option("cascadedModifierTags")];
|
|
160
162
|
_excludeInternal_decorators = [Option("excludeInternal")];
|
|
161
163
|
_excludePrivate_decorators = [Option("excludePrivate")];
|
|
164
|
+
_excludePrivateClassFields_decorators = [Option("excludePrivateClassFields")];
|
|
162
165
|
_excludeProtected_decorators = [Option("excludeProtected")];
|
|
163
166
|
_excludeNotDocumented_decorators = [Option("excludeNotDocumented")];
|
|
164
167
|
_excludeCategories_decorators = [Option("excludeCategories")];
|
|
@@ -167,6 +170,7 @@ let CommentPlugin = (() => {
|
|
|
167
170
|
__esDecorate(this, null, _cascadedModifierTags_decorators, { kind: "accessor", name: "cascadedModifierTags", static: false, private: false, access: { has: obj => "cascadedModifierTags" in obj, get: obj => obj.cascadedModifierTags, set: (obj, value) => { obj.cascadedModifierTags = value; } }, metadata: _metadata }, _cascadedModifierTags_initializers, _cascadedModifierTags_extraInitializers);
|
|
168
171
|
__esDecorate(this, null, _excludeInternal_decorators, { kind: "accessor", name: "excludeInternal", static: false, private: false, access: { has: obj => "excludeInternal" in obj, get: obj => obj.excludeInternal, set: (obj, value) => { obj.excludeInternal = value; } }, metadata: _metadata }, _excludeInternal_initializers, _excludeInternal_extraInitializers);
|
|
169
172
|
__esDecorate(this, null, _excludePrivate_decorators, { kind: "accessor", name: "excludePrivate", static: false, private: false, access: { has: obj => "excludePrivate" in obj, get: obj => obj.excludePrivate, set: (obj, value) => { obj.excludePrivate = value; } }, metadata: _metadata }, _excludePrivate_initializers, _excludePrivate_extraInitializers);
|
|
173
|
+
__esDecorate(this, null, _excludePrivateClassFields_decorators, { kind: "accessor", name: "excludePrivateClassFields", static: false, private: false, access: { has: obj => "excludePrivateClassFields" in obj, get: obj => obj.excludePrivateClassFields, set: (obj, value) => { obj.excludePrivateClassFields = value; } }, metadata: _metadata }, _excludePrivateClassFields_initializers, _excludePrivateClassFields_extraInitializers);
|
|
170
174
|
__esDecorate(this, null, _excludeProtected_decorators, { kind: "accessor", name: "excludeProtected", static: false, private: false, access: { has: obj => "excludeProtected" in obj, get: obj => obj.excludeProtected, set: (obj, value) => { obj.excludeProtected = value; } }, metadata: _metadata }, _excludeProtected_initializers, _excludeProtected_extraInitializers);
|
|
171
175
|
__esDecorate(this, null, _excludeNotDocumented_decorators, { kind: "accessor", name: "excludeNotDocumented", static: false, private: false, access: { has: obj => "excludeNotDocumented" in obj, get: obj => obj.excludeNotDocumented, set: (obj, value) => { obj.excludeNotDocumented = value; } }, metadata: _metadata }, _excludeNotDocumented_initializers, _excludeNotDocumented_extraInitializers);
|
|
172
176
|
__esDecorate(this, null, _excludeCategories_decorators, { kind: "accessor", name: "excludeCategories", static: false, private: false, access: { has: obj => "excludeCategories" in obj, get: obj => obj.excludeCategories, set: (obj, value) => { obj.excludeCategories = value; } }, metadata: _metadata }, _excludeCategories_initializers, _excludeCategories_extraInitializers);
|
|
@@ -185,7 +189,10 @@ let CommentPlugin = (() => {
|
|
|
185
189
|
#excludePrivate_accessor_storage = (__runInitializers(this, _excludeInternal_extraInitializers), __runInitializers(this, _excludePrivate_initializers, void 0));
|
|
186
190
|
get excludePrivate() { return this.#excludePrivate_accessor_storage; }
|
|
187
191
|
set excludePrivate(value) { this.#excludePrivate_accessor_storage = value; }
|
|
188
|
-
#
|
|
192
|
+
#excludePrivateClassFields_accessor_storage = (__runInitializers(this, _excludePrivate_extraInitializers), __runInitializers(this, _excludePrivateClassFields_initializers, void 0));
|
|
193
|
+
get excludePrivateClassFields() { return this.#excludePrivateClassFields_accessor_storage; }
|
|
194
|
+
set excludePrivateClassFields(value) { this.#excludePrivateClassFields_accessor_storage = value; }
|
|
195
|
+
#excludeProtected_accessor_storage = (__runInitializers(this, _excludePrivateClassFields_extraInitializers), __runInitializers(this, _excludeProtected_initializers, void 0));
|
|
189
196
|
get excludeProtected() { return this.#excludeProtected_accessor_storage; }
|
|
190
197
|
set excludeProtected(value) { this.#excludeProtected_accessor_storage = value; }
|
|
191
198
|
#excludeNotDocumented_accessor_storage = (__runInitializers(this, _excludeProtected_extraInitializers), __runInitializers(this, _excludeNotDocumented_initializers, void 0));
|
|
@@ -447,19 +454,25 @@ let CommentPlugin = (() => {
|
|
|
447
454
|
moveSignatureParamComments(signature, comment = signature.comment) {
|
|
448
455
|
if (!comment)
|
|
449
456
|
return;
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
}
|
|
457
|
+
const unusedCommentParams = comment.blockTags.filter((tag) => tag.tag === "@param" && tag.name && !tag.name.includes(".") &&
|
|
458
|
+
!signature.parameters?.some(p => p.name === tag.name));
|
|
459
|
+
signature.parameters?.forEach((parameter) => {
|
|
460
|
+
if (parameter.name === "__namedParameters" && unusedCommentParams.length) {
|
|
461
|
+
parameter.name = unusedCommentParams[0].name;
|
|
462
|
+
unusedCommentParams.splice(0, 1);
|
|
457
463
|
}
|
|
458
464
|
const tag = comment.getIdentifiedTag(parameter.name, "@param");
|
|
459
465
|
if (tag) {
|
|
460
466
|
parameter.comment = new Comment(Comment.cloneDisplayParts(tag.content));
|
|
461
467
|
parameter.comment.sourcePath = comment.sourcePath;
|
|
462
468
|
}
|
|
469
|
+
else if (parameter.name === "this") {
|
|
470
|
+
const thisTag = comment.getTag("@this");
|
|
471
|
+
if (thisTag) {
|
|
472
|
+
parameter.comment = new Comment(Comment.cloneDisplayParts(thisTag.content));
|
|
473
|
+
parameter.comment.sourcePath = comment.sourcePath;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
463
476
|
});
|
|
464
477
|
for (const parameter of signature.typeParameters || []) {
|
|
465
478
|
const tag = comment.getIdentifiedTag(parameter.name, "@typeParam") ||
|
|
@@ -471,6 +484,7 @@ let CommentPlugin = (() => {
|
|
|
471
484
|
}
|
|
472
485
|
}
|
|
473
486
|
this.validateParamTags(signature, comment, signature.parameters || []);
|
|
487
|
+
comment.removeTags("@this");
|
|
474
488
|
comment.removeTags("@param");
|
|
475
489
|
comment.removeTags("@typeParam");
|
|
476
490
|
comment.removeTags("@template");
|
|
@@ -513,6 +527,16 @@ let CommentPlugin = (() => {
|
|
|
513
527
|
this.excludePrivate) {
|
|
514
528
|
return true;
|
|
515
529
|
}
|
|
530
|
+
// #3017 this isn't quite right as it may incorrectly detect
|
|
531
|
+
// private members named with a hash which aren't actually private
|
|
532
|
+
// class fields (e.g. class Foo { "#hash" = 1 })
|
|
533
|
+
// We can't fix this without storing more information about the name,
|
|
534
|
+
// which I'm going to put off until #3015 is done.
|
|
535
|
+
if (reflection.flags.hasFlag(ReflectionFlag.Private) &&
|
|
536
|
+
reflection.name.startsWith("#") &&
|
|
537
|
+
this.excludePrivateClassFields) {
|
|
538
|
+
return true;
|
|
539
|
+
}
|
|
516
540
|
if (reflection.flags.hasFlag(ReflectionFlag.Protected) &&
|
|
517
541
|
this.excludeProtected) {
|
|
518
542
|
return true;
|
|
@@ -754,6 +754,13 @@ function convertAccessor(context, symbol, exportSymbol) {
|
|
|
754
754
|
const declaration = symbol.getDeclarations()?.[0];
|
|
755
755
|
if (declaration) {
|
|
756
756
|
setModifiers(symbol, declaration, reflection);
|
|
757
|
+
// #3019, auto accessors `accessor x: string` get the symbol flag for
|
|
758
|
+
// an accessor, but they don't have get/set accessors, so the need a type
|
|
759
|
+
// set on the accessor reflection structure.
|
|
760
|
+
if (ts.isPropertyDeclaration(declaration) &&
|
|
761
|
+
declaration.modifiers?.some(n => n.kind === ts.SyntaxKind.AccessorKeyword)) {
|
|
762
|
+
reflection.type = context.converter.convertType(context.withScope(reflection), context.checker.getTypeOfSymbol(symbol), declaration.type);
|
|
763
|
+
}
|
|
757
764
|
}
|
|
758
765
|
context.finalizeDeclarationReflection(reflection);
|
|
759
766
|
const getDeclaration = symbol.getDeclarations()?.find(ts.isGetAccessor);
|
|
@@ -696,7 +696,7 @@ const unionConverter = {
|
|
|
696
696
|
convertType(context, type) {
|
|
697
697
|
const types = type.types.map((type) => convertType(context, type));
|
|
698
698
|
normalizeUnion(types);
|
|
699
|
-
|
|
699
|
+
sortUnion(types);
|
|
700
700
|
return new UnionType(types);
|
|
701
701
|
},
|
|
702
702
|
};
|
|
@@ -764,14 +764,26 @@ function kindToModifier(kind) {
|
|
|
764
764
|
return undefined;
|
|
765
765
|
}
|
|
766
766
|
}
|
|
767
|
-
function
|
|
768
|
-
|
|
767
|
+
function sortUnion(types) {
|
|
768
|
+
// If every member of the union is a literal numeric type, sort in ascending order
|
|
769
|
+
if (types.every(t => t.type === "literal" && typeof t.value === "number")) {
|
|
770
|
+
types.sort((a, b) => {
|
|
771
|
+
const aLit = a;
|
|
772
|
+
const bLit = b;
|
|
773
|
+
return aLit.value - bLit.value;
|
|
774
|
+
});
|
|
769
775
|
return;
|
|
770
776
|
}
|
|
777
|
+
// #3024 Otherwise, leave the union in the converted order with the exception of null
|
|
778
|
+
// and undefined, which should be sorted last, with null before undefined.
|
|
771
779
|
types.sort((a, b) => {
|
|
772
|
-
const
|
|
773
|
-
const
|
|
774
|
-
|
|
780
|
+
const aIsNull = a.type === "literal" && a.value === null;
|
|
781
|
+
const aIsUndef = a.type === "intrinsic" && a.name === "undefined";
|
|
782
|
+
const bIsNull = b.type === "literal" && b.value === null;
|
|
783
|
+
const bIsUndef = b.type === "intrinsic" && b.name === "undefined";
|
|
784
|
+
const aWeight = aIsNull ? 1 : aIsUndef ? 2 : 0;
|
|
785
|
+
const bWeight = bIsNull ? 1 : bIsUndef ? 2 : 0;
|
|
786
|
+
return aWeight - bWeight;
|
|
775
787
|
});
|
|
776
788
|
}
|
|
777
789
|
function normalizeUnion(types) {
|
|
@@ -165,7 +165,6 @@ module.exports = localeUtils.buildIncompleteTranslation({
|
|
|
165
165
|
help_excludeNotDocumentedKinds: "Arten von Reflections, die von excludeNotDocumented entfernt werden können",
|
|
166
166
|
help_excludeInternal: "Verhindert, dass Symbole in der Dokumentation erscheinen, die mit @internal markiert sind",
|
|
167
167
|
help_excludeCategories: "Schließt Symbole aus dieser Kategorie von der Dokumentation aus",
|
|
168
|
-
help_excludePrivate: "Ignoriert private Variablen und Methoden, Standardwert ist true.",
|
|
169
168
|
help_excludeProtected: "Ignoriert geschützte Variablen und Methoden",
|
|
170
169
|
help_excludeReferences: "Wird ein Symbol mehrfach exportiert, ignoriere alle außer dem ersten Export",
|
|
171
170
|
help_externalSymbolLinkMappings: "Definiert eigene Links für Symbole, die nicht in der Dokumentation enthalten sind",
|
|
@@ -150,7 +150,6 @@ declare const _default: {
|
|
|
150
150
|
help_excludeNotDocumentedKinds: string;
|
|
151
151
|
help_excludeInternal: string;
|
|
152
152
|
help_excludeCategories: string;
|
|
153
|
-
help_excludePrivate: string;
|
|
154
153
|
help_excludeProtected: string;
|
|
155
154
|
help_excludeReferences: string;
|
|
156
155
|
help_externalSymbolLinkMappings: string;
|
|
@@ -168,7 +168,8 @@ module.exports = {
|
|
|
168
168
|
help_excludeNotDocumentedKinds: "Specify the type of reflections that can be removed by excludeNotDocumented",
|
|
169
169
|
help_excludeInternal: "Prevent symbols that are marked with @internal from being documented",
|
|
170
170
|
help_excludeCategories: "Exclude symbols within this category from the documentation",
|
|
171
|
-
help_excludePrivate: "Ignore private
|
|
171
|
+
help_excludePrivate: "Ignore members marked with the private keyword and #private class fields, defaults to true.",
|
|
172
|
+
help_excludePrivateClassFields: "Ignore #private class fields, defaults to true.",
|
|
172
173
|
help_excludeProtected: "Ignore protected variables and methods",
|
|
173
174
|
help_excludeReferences: "If a symbol is exported multiple times, ignore all but the first export",
|
|
174
175
|
help_externalSymbolLinkMappings: "Define custom links for symbols not included in the documentation",
|
|
@@ -200,6 +201,7 @@ module.exports = {
|
|
|
200
201
|
help_excludeTags: "Remove the listed block/modifier tags from doc comments",
|
|
201
202
|
help_notRenderedTags: "Tags which will be preserved in doc comments, but not rendered when creating output",
|
|
202
203
|
help_cascadedModifierTags: "Modifier tags which should be copied to all children of the parent reflection",
|
|
204
|
+
help_preservedTypeAnnotationTags: "Block tags whose type annotations should be preserved in the output.",
|
|
203
205
|
help_readme: "Path to the readme file that should be displayed on the index page. Pass `none` to disable the index page and start the documentation on the globals page",
|
|
204
206
|
help_basePath: "Specifies a path which links may be resolved relative to.",
|
|
205
207
|
help_cname: "Set the CNAME file text, it's useful for custom domains on GitHub Pages",
|
|
@@ -155,7 +155,8 @@ declare const _default: {
|
|
|
155
155
|
readonly help_excludeNotDocumentedKinds: "Specify the type of reflections that can be removed by excludeNotDocumented";
|
|
156
156
|
readonly help_excludeInternal: "Prevent symbols that are marked with @internal from being documented";
|
|
157
157
|
readonly help_excludeCategories: "Exclude symbols within this category from the documentation";
|
|
158
|
-
readonly help_excludePrivate: "Ignore private
|
|
158
|
+
readonly help_excludePrivate: "Ignore members marked with the private keyword and #private class fields, defaults to true.";
|
|
159
|
+
readonly help_excludePrivateClassFields: "Ignore #private class fields, defaults to true.";
|
|
159
160
|
readonly help_excludeProtected: "Ignore protected variables and methods";
|
|
160
161
|
readonly help_excludeReferences: "If a symbol is exported multiple times, ignore all but the first export";
|
|
161
162
|
readonly help_externalSymbolLinkMappings: "Define custom links for symbols not included in the documentation";
|
|
@@ -187,6 +188,7 @@ declare const _default: {
|
|
|
187
188
|
readonly help_excludeTags: "Remove the listed block/modifier tags from doc comments";
|
|
188
189
|
readonly help_notRenderedTags: "Tags which will be preserved in doc comments, but not rendered when creating output";
|
|
189
190
|
readonly help_cascadedModifierTags: "Modifier tags which should be copied to all children of the parent reflection";
|
|
191
|
+
readonly help_preservedTypeAnnotationTags: "Block tags whose type annotations should be preserved in the output.";
|
|
190
192
|
readonly help_readme: "Path to the readme file that should be displayed on the index page. Pass `none` to disable the index page and start the documentation on the globals page";
|
|
191
193
|
readonly help_basePath: "Specifies a path which links may be resolved relative to.";
|
|
192
194
|
readonly help_cname: "Set the CNAME file text, it's useful for custom domains on GitHub Pages";
|
|
@@ -129,7 +129,6 @@ module.exports = localeUtils.buildIncompleteTranslation({
|
|
|
129
129
|
help_excludeNotDocumentedKinds: "excludeNotDocumented によって削除できる反射の種類を指定します",
|
|
130
130
|
help_excludeInternal: "@internal でマークされたシンボルがドキュメント化されないようにする",
|
|
131
131
|
help_excludeCategories: "このカテゴリ内のシンボルをドキュメントから除外する",
|
|
132
|
-
help_excludePrivate: "プライベート変数とメソッドを無視します。デフォルトは true です。",
|
|
133
132
|
help_excludeProtected: "保護された変数とメソッドを無視する",
|
|
134
133
|
help_excludeReferences: "シンボルが複数回エクスポートされた場合、最初のエクスポート以外はすべて無視されます。",
|
|
135
134
|
help_externalSymbolLinkMappings: "ドキュメントに含まれていないシンボルのカスタムリンクを定義する",
|
|
@@ -119,7 +119,6 @@ declare const _default: {
|
|
|
119
119
|
help_excludeNotDocumentedKinds: string;
|
|
120
120
|
help_excludeInternal: string;
|
|
121
121
|
help_excludeCategories: string;
|
|
122
|
-
help_excludePrivate: string;
|
|
123
122
|
help_excludeProtected: string;
|
|
124
123
|
help_excludeReferences: string;
|
|
125
124
|
help_externalSymbolLinkMappings: string;
|
|
@@ -47,7 +47,6 @@ module.exports = localeUtils.buildIncompleteTranslation({
|
|
|
47
47
|
help_excludeNotDocumentedKinds: "excludeNotDocumented로 제거될 리플렉션 유형을 지정합니다",
|
|
48
48
|
help_excludeInternal: "@internal로 표시된 심볼이 문서화되지 않도록 방지합니다",
|
|
49
49
|
help_excludeCategories: "문서에서 제외할 카테고리 내의 심볼을 제외합니다",
|
|
50
|
-
help_excludePrivate: "비공개 변수와 메서드를 무시합니다. 기본값은 true입니다.",
|
|
51
50
|
help_excludeProtected: "보호된 변수와 메서드를 무시합니다",
|
|
52
51
|
help_excludeReferences: "심볼이 여러 번 내보내진 경우 첫 번째 내보내기를 제외하고 모두 무시합니다",
|
|
53
52
|
help_externalSymbolLinkMappings: "문서에 포함되지 않은 심볼에 대한 사용자 정의 링크를 정의합니다",
|
|
@@ -39,7 +39,6 @@ declare const _default: {
|
|
|
39
39
|
help_excludeNotDocumentedKinds: string;
|
|
40
40
|
help_excludeInternal: string;
|
|
41
41
|
help_excludeCategories: string;
|
|
42
|
-
help_excludePrivate: string;
|
|
43
42
|
help_excludeProtected: string;
|
|
44
43
|
help_excludeReferences: string;
|
|
45
44
|
help_externalSymbolLinkMappings: string;
|
|
@@ -167,7 +167,6 @@ module.exports = localeUtils.buildIncompleteTranslation({
|
|
|
167
167
|
help_excludeNotDocumentedKinds: "指定可以通过 excludeNotDocumented 删除的反射类型",
|
|
168
168
|
help_excludeInternal: "防止标有 @internal 的符号被记录",
|
|
169
169
|
help_excludeCategories: "从文档中排除此类别中的符号",
|
|
170
|
-
help_excludePrivate: "忽略私有变量和方法,默认为 true。",
|
|
171
170
|
help_excludeProtected: "忽略受保护的变量和方法",
|
|
172
171
|
help_excludeReferences: "如果一个符号被导出多次,则忽略除第一次导出之外的所有导出",
|
|
173
172
|
help_externalSymbolLinkMappings: "为文档中未包含的符号定义自定义链接",
|
|
@@ -152,7 +152,6 @@ declare const _default: {
|
|
|
152
152
|
help_excludeNotDocumentedKinds: string;
|
|
153
153
|
help_excludeInternal: string;
|
|
154
154
|
help_excludeCategories: string;
|
|
155
|
-
help_excludePrivate: string;
|
|
156
155
|
help_excludeProtected: string;
|
|
157
156
|
help_excludeReferences: string;
|
|
158
157
|
help_externalSymbolLinkMappings: string;
|
|
@@ -85,6 +85,11 @@ export declare class CommentTag {
|
|
|
85
85
|
* If this tag is one of those, it will be parsed out and included here.
|
|
86
86
|
*/
|
|
87
87
|
name?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Optional type annotation associated with this tag. TypeDoc will remove type annotations unless explicitly
|
|
90
|
+
* requested by the user with the `preservedTypeAnnotationTags` option.
|
|
91
|
+
*/
|
|
92
|
+
typeAnnotation?: string;
|
|
88
93
|
/**
|
|
89
94
|
* The actual body text of this tag.
|
|
90
95
|
*/
|
|
@@ -50,6 +50,11 @@ export class CommentTag {
|
|
|
50
50
|
* If this tag is one of those, it will be parsed out and included here.
|
|
51
51
|
*/
|
|
52
52
|
name;
|
|
53
|
+
/**
|
|
54
|
+
* Optional type annotation associated with this tag. TypeDoc will remove type annotations unless explicitly
|
|
55
|
+
* requested by the user with the `preservedTypeAnnotationTags` option.
|
|
56
|
+
*/
|
|
57
|
+
typeAnnotation;
|
|
53
58
|
/**
|
|
54
59
|
* The actual body text of this tag.
|
|
55
60
|
*/
|
|
@@ -83,6 +88,9 @@ export class CommentTag {
|
|
|
83
88
|
if (this.name) {
|
|
84
89
|
tag.name = this.name;
|
|
85
90
|
}
|
|
91
|
+
if (this.typeAnnotation) {
|
|
92
|
+
tag.typeAnnotation = this.typeAnnotation;
|
|
93
|
+
}
|
|
86
94
|
return tag;
|
|
87
95
|
}
|
|
88
96
|
toObject() {
|
|
@@ -90,11 +98,13 @@ export class CommentTag {
|
|
|
90
98
|
tag: this.tag,
|
|
91
99
|
name: this.name,
|
|
92
100
|
content: Comment.serializeDisplayParts(this.content),
|
|
101
|
+
typeAnnotation: this.typeAnnotation,
|
|
93
102
|
};
|
|
94
103
|
}
|
|
95
104
|
fromObject(de, obj) {
|
|
96
105
|
// tag already set by Comment.fromObject
|
|
97
106
|
this.name = obj.name;
|
|
107
|
+
this.typeAnnotation = obj.typeAnnotation;
|
|
98
108
|
this.content = Comment.deserializeDisplayParts(de, obj.content);
|
|
99
109
|
}
|
|
100
110
|
}
|
|
@@ -387,10 +387,17 @@ let MarkedPlugin = (() => {
|
|
|
387
387
|
})();
|
|
388
388
|
export { MarkedPlugin };
|
|
389
389
|
function getTokenTextContent(token) {
|
|
390
|
+
// If there are children, we want their text content, not the full text content
|
|
390
391
|
if (token.children) {
|
|
391
392
|
return token.children.map(getTokenTextContent).join("");
|
|
392
393
|
}
|
|
393
|
-
|
|
394
|
+
// If this is a simple text fragment, use its content
|
|
395
|
+
if (token.type === "text") {
|
|
396
|
+
return token.content;
|
|
397
|
+
}
|
|
398
|
+
// Otherwise this is some type of metadata token (e.g. header_open)
|
|
399
|
+
// or a HTML tag token. Don't include it in the text content.
|
|
400
|
+
return "";
|
|
394
401
|
}
|
|
395
402
|
const kindNames = ["note", "tip", "important", "warning", "caution"];
|
|
396
403
|
const iconNames = ["alertNote", "alertTip", "alertImportant", "alertWarning", "alertCaution"];
|
|
@@ -6,15 +6,23 @@ export class Slugger {
|
|
|
6
6
|
options;
|
|
7
7
|
seen = new Map();
|
|
8
8
|
serialize(value) {
|
|
9
|
-
//
|
|
10
|
-
//
|
|
9
|
+
// There are quite a few trade-offs here. We used to remove HTML tags here,
|
|
10
|
+
// but TypeDoc now removes the HTML tags before passing text into the slug
|
|
11
|
+
// method, which allows us to skip doing that here. This improves the slugger
|
|
12
|
+
// generation for headers which look like the following:
|
|
13
|
+
// (html allowed in markdown)
|
|
14
|
+
// # test <t>
|
|
15
|
+
// (html disallowed in markdown)
|
|
16
|
+
// # test <t>
|
|
17
|
+
// both of the above should slug to test-t
|
|
11
18
|
return (value
|
|
12
19
|
.trim()
|
|
13
|
-
// remove html tags
|
|
14
|
-
.replace(/<[!/a-z].*?>/gi, "")
|
|
15
20
|
// remove unwanted chars
|
|
16
21
|
.replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, "")
|
|
17
|
-
|
|
22
|
+
// change whitespace to dash
|
|
23
|
+
.replace(/\s/g, "-")
|
|
24
|
+
// combine adjacent dashes
|
|
25
|
+
.replace(/--+/, "-"));
|
|
18
26
|
}
|
|
19
27
|
constructor(options) {
|
|
20
28
|
this.options = options;
|
|
@@ -58,6 +58,7 @@ export function commentTags(context, props) {
|
|
|
58
58
|
JSX.createElement("h4", { class: "tsd-anchor-link", id: anchor },
|
|
59
59
|
name,
|
|
60
60
|
anchorIcon(context, anchor)),
|
|
61
|
+
item.typeAnnotation && JSX.createElement("span", { class: "tsd-type-annotation" }, item.typeAnnotation),
|
|
61
62
|
JSX.createElement(JSX.Raw, { html: context.markdown(item.content) }))));
|
|
62
63
|
});
|
|
63
64
|
return (JSX.createElement(JSX.Fragment, null,
|
|
@@ -226,7 +226,7 @@ export interface Comment extends Partial<S<M.Comment, "blockTags" | "label">> {
|
|
|
226
226
|
modifierTags?: TagString[];
|
|
227
227
|
}
|
|
228
228
|
/** @category Comments */
|
|
229
|
-
export interface CommentTag extends S<M.CommentTag, "tag" | "name"> {
|
|
229
|
+
export interface CommentTag extends S<M.CommentTag, "tag" | "name" | "typeAnnotation"> {
|
|
230
230
|
content: CommentDisplayPart[];
|
|
231
231
|
}
|
|
232
232
|
/**
|
|
@@ -93,6 +93,7 @@ export interface TypeDocOptionMap {
|
|
|
93
93
|
excludeNotDocumented: boolean;
|
|
94
94
|
excludeNotDocumentedKinds: ReflectionKind.KindString[];
|
|
95
95
|
excludeInternal: boolean;
|
|
96
|
+
excludePrivateClassFields: boolean;
|
|
96
97
|
excludePrivate: boolean;
|
|
97
98
|
excludeProtected: boolean;
|
|
98
99
|
excludeReferences: boolean;
|
|
@@ -200,6 +201,7 @@ export interface TypeDocOptionMap {
|
|
|
200
201
|
notRenderedTags: TagString[];
|
|
201
202
|
externalSymbolLinkMappings: ManuallyValidatedOption<Record<string, Record<string, string>>>;
|
|
202
203
|
cascadedModifierTags: TagString[];
|
|
204
|
+
preservedTypeAnnotationTags: TagString[];
|
|
203
205
|
categorizeByGroup: boolean;
|
|
204
206
|
groupReferencesByType: boolean;
|
|
205
207
|
defaultCategory: string;
|
|
@@ -11,6 +11,7 @@ export declare const blockTags: readonly TagString[];
|
|
|
11
11
|
export declare const inlineTags: readonly TagString[];
|
|
12
12
|
export declare const modifierTags: readonly TagString[];
|
|
13
13
|
export declare const cascadedModifierTags: readonly TagString[];
|
|
14
|
+
export declare const preservedTypeAnnotationTags: readonly TagString[];
|
|
14
15
|
export declare const notRenderedTags: readonly TagString[];
|
|
15
16
|
export declare const highlightLanguages: readonly BundledLanguage[];
|
|
16
17
|
export declare const ignoredHighlightLanguages: readonly string[];
|
|
@@ -167,6 +167,12 @@ export function addTypeDocOptions(options) {
|
|
|
167
167
|
type: ParameterType.Boolean,
|
|
168
168
|
defaultValue: true,
|
|
169
169
|
});
|
|
170
|
+
options.addDeclaration({
|
|
171
|
+
name: "excludePrivateClassFields",
|
|
172
|
+
help: () => i18n.help_excludePrivateClassFields(),
|
|
173
|
+
type: ParameterType.Boolean,
|
|
174
|
+
defaultValue: true,
|
|
175
|
+
});
|
|
170
176
|
options.addDeclaration({
|
|
171
177
|
name: "excludeProtected",
|
|
172
178
|
help: () => i18n.help_excludeProtected(),
|
|
@@ -700,6 +706,13 @@ export function addTypeDocOptions(options) {
|
|
|
700
706
|
defaultValue: OptionDefaults.cascadedModifierTags,
|
|
701
707
|
validate: makeTagArrayValidator("cascadedModifierTags"),
|
|
702
708
|
});
|
|
709
|
+
options.addDeclaration({
|
|
710
|
+
name: "preservedTypeAnnotationTags",
|
|
711
|
+
help: () => i18n.help_preservedTypeAnnotationTags(),
|
|
712
|
+
type: ParameterType.Array,
|
|
713
|
+
defaultValue: OptionDefaults.preservedTypeAnnotationTags,
|
|
714
|
+
validate: makeTagArrayValidator("preservedTypeAnnotationTags"),
|
|
715
|
+
});
|
|
703
716
|
// MARK: Organization Options
|
|
704
717
|
options.addDeclaration({
|
|
705
718
|
name: "categorizeByGroup",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const tsdocBlockTags: readonly ["@defaultValue", "@deprecated", "@example", "@param", "@privateRemarks", "@remarks", "@returns", "@see", "@throws", "@typeParam"];
|
|
2
|
-
export declare const blockTags: readonly ["@defaultValue", "@deprecated", "@example", "@param", "@privateRemarks", "@remarks", "@returns", "@see", "@throws", "@typeParam", "@author", "@callback", "@category", "@categoryDescription", "@default", "@document", "@extends", "@augments", "@yields", "@group", "@groupDescription", "@import", "@inheritDoc", "@jsx", "@license", "@module", "@mergeModuleWith", "@prop", "@property", "@return", "@satisfies", "@since", "@sortStrategy", "@template", "@type", "@typedef", "@summary", "@preventInline", "@inlineType", "@preventExpand", "@expandType"];
|
|
2
|
+
export declare const blockTags: readonly ["@defaultValue", "@deprecated", "@example", "@param", "@privateRemarks", "@remarks", "@returns", "@see", "@throws", "@typeParam", "@author", "@callback", "@category", "@categoryDescription", "@default", "@document", "@extends", "@augments", "@yields", "@group", "@groupDescription", "@import", "@inheritDoc", "@jsx", "@license", "@module", "@mergeModuleWith", "@prop", "@property", "@return", "@satisfies", "@since", "@sortStrategy", "@template", "@this", "@type", "@typedef", "@summary", "@preventInline", "@inlineType", "@preventExpand", "@expandType"];
|
|
3
3
|
export declare const tsdocInlineTags: readonly ["@link", "@inheritDoc", "@label"];
|
|
4
4
|
export declare const inlineTags: readonly ["@link", "@inheritDoc", "@label", "@linkcode", "@linkplain", "@include", "@includeCode"];
|
|
5
5
|
export declare const tsdocModifierTags: readonly ["@alpha", "@beta", "@eventProperty", "@experimental", "@internal", "@override", "@packageDocumentation", "@public", "@readonly", "@sealed", "@virtual"];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typedoc",
|
|
3
3
|
"description": "Create api documentation for TypeScript projects.",
|
|
4
|
-
"version": "0.28.
|
|
4
|
+
"version": "0.28.14",
|
|
5
5
|
"homepage": "https://typedoc.org",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
@@ -111,9 +111,9 @@
|
|
|
111
111
|
"test": "mocha --config .config/mocha.fast.json",
|
|
112
112
|
"test:cov": "c8 -r lcov mocha --config .config/mocha.fast.json",
|
|
113
113
|
"doc:c": "node bin/typedoc --tsconfig src/test/converter/tsconfig.json",
|
|
114
|
-
"doc:cd": "node --inspect-brk
|
|
114
|
+
"doc:cd": "node --inspect-brk dist/lib/cli.js --tsconfig src/test/converter/tsconfig.json",
|
|
115
115
|
"doc:c2": "node bin/typedoc --options src/test/converter2 --tsconfig src/test/converter2/tsconfig.json",
|
|
116
|
-
"doc:c2d": "node --inspect-brk
|
|
116
|
+
"doc:c2d": "node --inspect-brk dist/lib/cli.js --options src/test/converter2 --tsconfig src/test/converter2/tsconfig.json",
|
|
117
117
|
"example": "cd example && node ../bin/typedoc",
|
|
118
118
|
"test:full": "c8 -r lcov -r text-summary mocha --config .config/mocha.full.json",
|
|
119
119
|
"rebuild_specs": "node scripts/rebuild_specs.js",
|