typedoc 0.25.13 → 0.26.0-beta.0
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/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/lib/application.d.ts +15 -3
- package/dist/lib/application.js +65 -23
- package/dist/lib/cli.js +1 -1
- package/dist/lib/converter/comments/blockLexer.d.ts +1 -1
- package/dist/lib/converter/comments/blockLexer.js +1 -2
- package/dist/lib/converter/comments/declarationReference.js +8 -8
- package/dist/lib/converter/comments/declarationReferenceResolver.d.ts +1 -1
- package/dist/lib/converter/comments/declarationReferenceResolver.js +15 -14
- package/dist/lib/converter/comments/discovery.d.ts +3 -3
- package/dist/lib/converter/comments/discovery.js +21 -19
- package/dist/lib/converter/comments/index.d.ts +1 -1
- package/dist/lib/converter/comments/index.js +35 -16
- package/dist/lib/converter/comments/lineLexer.d.ts +1 -1
- package/dist/lib/converter/comments/lineLexer.js +1 -2
- package/dist/lib/converter/comments/linkResolver.d.ts +2 -2
- package/dist/lib/converter/comments/linkResolver.js +5 -3
- package/dist/lib/converter/comments/parser.d.ts +14 -3
- package/dist/lib/converter/comments/parser.js +144 -39
- package/dist/lib/converter/comments/rawLexer.d.ts +7 -1
- package/dist/lib/converter/comments/rawLexer.js +21 -70
- package/dist/lib/converter/comments/tagName.js +1 -2
- package/dist/lib/converter/context.d.ts +7 -2
- package/dist/lib/converter/context.js +7 -2
- package/dist/lib/converter/convert-expression.js +2 -3
- package/dist/lib/converter/converter.d.ts +8 -3
- package/dist/lib/converter/converter.js +16 -13
- package/dist/lib/converter/factories/index-signature.d.ts +1 -1
- package/dist/lib/converter/factories/index-signature.js +9 -12
- package/dist/lib/converter/factories/signature.d.ts +1 -1
- package/dist/lib/converter/factories/signature.js +11 -12
- package/dist/lib/converter/jsdoc.js +2 -3
- package/dist/lib/converter/plugins/CategoryPlugin.d.ts +3 -3
- package/dist/lib/converter/plugins/CategoryPlugin.js +22 -15
- package/dist/lib/converter/plugins/CommentPlugin.d.ts +1 -1
- package/dist/lib/converter/plugins/CommentPlugin.js +58 -67
- package/dist/lib/converter/plugins/GroupPlugin.d.ts +4 -4
- package/dist/lib/converter/plugins/GroupPlugin.js +52 -18
- package/dist/lib/converter/plugins/ImplementsPlugin.js +4 -3
- package/dist/lib/converter/plugins/InheritDocPlugin.d.ts +1 -1
- package/dist/lib/converter/plugins/InheritDocPlugin.js +5 -6
- package/dist/lib/converter/plugins/LinkResolverPlugin.d.ts +2 -2
- package/dist/lib/converter/plugins/PackagePlugin.d.ts +0 -2
- package/dist/lib/converter/plugins/PackagePlugin.js +8 -30
- package/dist/lib/converter/plugins/SourcePlugin.js +2 -2
- package/dist/lib/converter/symbols.js +31 -11
- package/dist/lib/converter/types.d.ts +1 -1
- package/dist/lib/converter/types.js +4 -5
- package/dist/lib/converter/utils/nodes.js +3 -4
- package/dist/lib/converter/utils/reflections.d.ts +1 -1
- package/dist/lib/converter/utils/reflections.js +1 -2
- package/dist/lib/converter/utils/repository.js +4 -4
- package/dist/lib/converter/utils/symbols.js +1 -2
- package/dist/lib/internationalization/index.d.ts +7 -0
- package/dist/lib/internationalization/index.js +11 -0
- package/dist/lib/internationalization/internationalization.d.ts +92 -0
- package/dist/lib/internationalization/internationalization.js +194 -0
- package/dist/lib/internationalization/locales/en.cjs +3 -0
- package/dist/lib/internationalization/locales/en.d.cts +2 -0
- package/dist/lib/internationalization/locales/test.cjs +8 -0
- package/dist/lib/internationalization/locales/test.d.cts +5 -0
- package/dist/lib/internationalization/translatable.d.ts +297 -0
- package/dist/lib/internationalization/translatable.js +322 -0
- package/dist/lib/models/ReflectionCategory.d.ts +2 -2
- package/dist/lib/models/ReflectionGroup.d.ts +2 -2
- package/dist/lib/models/comments/comment.d.ts +17 -3
- package/dist/lib/models/comments/comment.js +377 -298
- package/dist/lib/models/reflections/ReflectionSymbolId.js +2 -2
- package/dist/lib/models/reflections/abstract.d.ts +11 -8
- package/dist/lib/models/reflections/abstract.js +17 -11
- package/dist/lib/models/reflections/container.d.ts +25 -3
- package/dist/lib/models/reflections/container.js +64 -0
- package/dist/lib/models/reflections/declaration.d.ts +3 -15
- package/dist/lib/models/reflections/declaration.js +16 -21
- package/dist/lib/models/reflections/document.d.ts +27 -0
- package/dist/lib/models/reflections/document.js +43 -0
- package/dist/lib/models/reflections/index.d.ts +4 -3
- package/dist/lib/models/reflections/index.js +5 -4
- package/dist/lib/models/reflections/kind.d.ts +13 -1
- package/dist/lib/models/reflections/kind.js +12 -0
- package/dist/lib/models/reflections/parameter.d.ts +1 -1
- package/dist/lib/models/reflections/project.d.ts +2 -2
- package/dist/lib/models/reflections/project.js +8 -7
- package/dist/lib/models/reflections/signature.d.ts +2 -2
- package/dist/lib/models/reflections/type-parameter.d.ts +1 -1
- package/dist/lib/models/reflections/utils.js +1 -2
- package/dist/lib/models/reflections/variant.d.ts +2 -0
- package/dist/lib/models/types.d.ts +4 -4
- package/dist/lib/models/types.js +3 -3
- package/dist/lib/output/events.d.ts +5 -5
- package/dist/lib/output/events.js +2 -1
- package/dist/lib/output/index.d.ts +1 -1
- package/dist/lib/output/index.js +2 -1
- package/dist/lib/output/plugins/AssetsPlugin.js +1 -1
- package/dist/lib/output/plugins/JavascriptIndexPlugin.d.ts +3 -1
- package/dist/lib/output/plugins/JavascriptIndexPlugin.js +28 -8
- package/dist/lib/output/plugins/SitemapPlugin.d.ts +1 -1
- package/dist/lib/output/plugins/SitemapPlugin.js +24 -13
- package/dist/lib/output/renderer.d.ts +1 -1
- package/dist/lib/output/renderer.js +5 -7
- package/dist/lib/output/themes/MarkedPlugin.d.ts +13 -24
- package/dist/lib/output/themes/MarkedPlugin.js +75 -160
- package/dist/lib/output/themes/default/DefaultTheme.d.ts +16 -4
- package/dist/lib/output/themes/default/DefaultTheme.js +62 -16
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +44 -44
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +10 -10
- package/dist/lib/output/themes/default/layouts/default.js +1 -1
- package/dist/lib/output/themes/default/partials/analytics.js +1 -2
- package/dist/lib/output/themes/default/partials/anchor-icon.js +2 -3
- package/dist/lib/output/themes/default/partials/comment.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/comment.js +3 -4
- package/dist/lib/output/themes/default/partials/footer.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/footer.js +19 -5
- package/dist/lib/output/themes/default/partials/header.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/header.js +4 -3
- package/dist/lib/output/themes/default/partials/hierarchy.js +3 -4
- package/dist/lib/output/themes/default/partials/icon.js +7 -2
- package/dist/lib/output/themes/default/partials/index.js +4 -4
- package/dist/lib/output/themes/default/partials/member.d.ts +2 -2
- package/dist/lib/output/themes/default/partials/member.declaration.js +2 -3
- package/dist/lib/output/themes/default/partials/member.js +13 -2
- package/dist/lib/output/themes/default/partials/member.reference.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/member.reference.js +9 -6
- package/dist/lib/output/themes/default/partials/member.signature.body.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/member.signature.body.js +4 -4
- package/dist/lib/output/themes/default/partials/member.signature.title.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/member.signature.title.js +1 -2
- package/dist/lib/output/themes/default/partials/member.sources.js +12 -6
- package/dist/lib/output/themes/default/partials/members.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/members.group.js +1 -2
- package/dist/lib/output/themes/default/partials/members.js +1 -2
- package/dist/lib/output/themes/default/partials/navigation.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/navigation.js +18 -15
- package/dist/lib/output/themes/default/partials/parameter.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/parameter.js +15 -15
- package/dist/lib/output/themes/default/partials/reflectionPreview.js +1 -2
- package/dist/lib/output/themes/default/partials/toolbar.js +4 -4
- package/dist/lib/output/themes/default/partials/type.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/type.js +14 -14
- package/dist/lib/output/themes/default/partials/typeAndParent.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/typeParameters.js +2 -3
- package/dist/lib/output/themes/default/templates/document.d.ts +5 -0
- package/dist/lib/output/themes/default/templates/document.js +7 -0
- package/dist/lib/output/themes/default/templates/hierarchy.js +1 -2
- package/dist/lib/output/themes/default/templates/reflection.d.ts +1 -1
- package/dist/lib/output/themes/default/templates/reflection.js +21 -19
- package/dist/lib/output/themes/lib.d.ts +1 -1
- package/dist/lib/output/themes/lib.js +12 -16
- package/dist/lib/serialization/deserializer.d.ts +3 -3
- package/dist/lib/serialization/deserializer.js +7 -5
- package/dist/lib/serialization/schema.d.ts +10 -3
- package/dist/lib/utils/array.js +9 -10
- package/dist/lib/utils/component.d.ts +1 -1
- package/dist/lib/utils/component.js +2 -2
- package/dist/lib/utils/entry-point.d.ts +11 -0
- package/dist/lib/utils/entry-point.js +51 -24
- package/dist/lib/utils/enum.js +6 -7
- package/dist/lib/utils/fs.js +15 -16
- package/dist/lib/utils/general.d.ts +4 -3
- package/dist/lib/utils/general.js +4 -5
- package/dist/lib/utils/highlighter.d.ts +4 -2
- package/dist/lib/utils/highlighter.js +41 -40
- package/dist/lib/utils/html.js +2 -3
- package/dist/lib/utils/index.d.ts +1 -1
- package/dist/lib/utils/index.js +1 -2
- package/dist/lib/utils/jsx.elements.d.ts +12 -0
- package/dist/lib/utils/jsx.js +4 -4
- package/dist/lib/utils/loggers.d.ts +13 -7
- package/dist/lib/utils/loggers.js +13 -10
- package/dist/lib/utils/map.d.ts +1 -1
- package/dist/lib/utils/map.js +1 -1
- package/dist/lib/utils/options/declaration.d.ts +40 -21
- package/dist/lib/utils/options/declaration.js +36 -36
- package/dist/lib/utils/options/help.d.ts +2 -1
- package/dist/lib/utils/options/help.js +10 -10
- package/dist/lib/utils/options/index.d.ts +1 -1
- package/dist/lib/utils/options/index.js +1 -2
- package/dist/lib/utils/options/options.d.ts +5 -34
- package/dist/lib/utils/options/options.js +10 -23
- package/dist/lib/utils/options/readers/arguments.js +3 -5
- package/dist/lib/utils/options/readers/package-json.js +2 -2
- package/dist/lib/utils/options/readers/tsconfig.js +8 -12
- package/dist/lib/utils/options/readers/typedoc.js +7 -6
- package/dist/lib/utils/options/sources/typedoc.js +187 -178
- package/dist/lib/utils/options/tsdoc-defaults.d.ts +1 -1
- package/dist/lib/utils/options/tsdoc-defaults.js +2 -0
- package/dist/lib/utils/package-manifest.d.ts +1 -1
- package/dist/lib/utils/package-manifest.js +9 -11
- package/dist/lib/utils/paths.js +4 -5
- package/dist/lib/utils/perf.js +3 -4
- package/dist/lib/utils/plugins.js +4 -5
- package/dist/lib/utils/reflections.d.ts +1 -1
- package/dist/lib/utils/reflections.js +2 -3
- package/dist/lib/utils/sort.d.ts +3 -2
- package/dist/lib/utils/sort.js +37 -6
- package/dist/lib/utils/tsconfig.js +3 -4
- package/dist/lib/utils/tsutils.js +2 -3
- package/dist/lib/utils/validation.js +4 -4
- package/dist/lib/validation/documentation.d.ts +1 -1
- package/dist/lib/validation/documentation.js +9 -4
- package/dist/lib/validation/exports.js +3 -5
- package/dist/lib/validation/links.js +2 -3
- package/package.json +12 -11
- package/static/main.js +4 -4
- package/static/style.css +18 -10
- package/tsdoc.json +9 -0
|
@@ -208,6 +208,7 @@ let Converter = (() => {
|
|
|
208
208
|
const project = new index_1.ProjectReflection(this.application.options.getValue("name"));
|
|
209
209
|
const context = new context_1.Context(this, programs, project);
|
|
210
210
|
this.trigger(Converter.EVENT_BEGIN, context);
|
|
211
|
+
this.addProjectDocuments(project);
|
|
211
212
|
this.compile(entryPoints, context);
|
|
212
213
|
this.resolve(context);
|
|
213
214
|
this.trigger(Converter.EVENT_END, context);
|
|
@@ -215,6 +216,17 @@ let Converter = (() => {
|
|
|
215
216
|
return project;
|
|
216
217
|
}
|
|
217
218
|
/** @internal */
|
|
219
|
+
addProjectDocuments(project) {
|
|
220
|
+
const projectDocuments = (0, utils_1.getDocumentEntryPoints)(this.application.logger, this.application.options);
|
|
221
|
+
for (const { displayName, path } of projectDocuments) {
|
|
222
|
+
const file = new utils_1.MinimalSourceFile((0, utils_1.readFile)(path), path);
|
|
223
|
+
const { content, frontmatter } = this.parseRawComment(file);
|
|
224
|
+
const docRefl = new index_1.DocumentReflection(displayName, project, content, frontmatter);
|
|
225
|
+
project.addChild(docRefl);
|
|
226
|
+
project.registerReflection(docRefl);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
/** @internal */
|
|
218
230
|
convertSymbol(context, symbol, exportSymbol) {
|
|
219
231
|
(0, symbols_1.convertSymbol)(context, symbol, exportSymbol);
|
|
220
232
|
}
|
|
@@ -232,7 +244,7 @@ let Converter = (() => {
|
|
|
232
244
|
* Parse the given file into a comment. Intended to be used with markdown files.
|
|
233
245
|
*/
|
|
234
246
|
parseRawComment(file) {
|
|
235
|
-
return (0, parser_1.
|
|
247
|
+
return (0, parser_1.parseCommentString)((0, rawLexer_1.lexCommentString)(file.text), this.config, file, this.application.logger);
|
|
236
248
|
}
|
|
237
249
|
/**
|
|
238
250
|
* Adds a new resolver that the theme can use to try to figure out how to link to a symbol declared
|
|
@@ -314,15 +326,8 @@ let Converter = (() => {
|
|
|
314
326
|
}
|
|
315
327
|
if (entryPoint.readmeFile) {
|
|
316
328
|
const readme = (0, utils_1.readFile)(entryPoint.readmeFile);
|
|
317
|
-
const
|
|
318
|
-
|
|
319
|
-
const ignored = [
|
|
320
|
-
...comment.blockTags.map((tag) => tag.tag),
|
|
321
|
-
...comment.modifierTags,
|
|
322
|
-
];
|
|
323
|
-
context.logger.warn(`Block and modifier tags will be ignored within the readme:\n\t${ignored.join("\n\t")}`);
|
|
324
|
-
}
|
|
325
|
-
reflection.readme = comment.summary;
|
|
329
|
+
const { content } = this.parseRawComment(new utils_1.MinimalSourceFile(readme, entryPoint.readmeFile));
|
|
330
|
+
reflection.readme = content;
|
|
326
331
|
}
|
|
327
332
|
reflection.packageVersion = entryPoint.version;
|
|
328
333
|
context.finalizeDeclarationReflection(reflection);
|
|
@@ -511,9 +516,7 @@ function getSymbolForModuleLike(context, node) {
|
|
|
511
516
|
const sourceFile = node.getSourceFile();
|
|
512
517
|
const globalSymbols = context.checker
|
|
513
518
|
.getSymbolsInScope(node, typescript_1.default.SymbolFlags.ModuleMember)
|
|
514
|
-
.filter((s) => s
|
|
515
|
-
.getDeclarations()
|
|
516
|
-
?.some((d) => d.getSourceFile() === sourceFile));
|
|
519
|
+
.filter((s) => s.getDeclarations()?.some((d) => d.getSourceFile() === sourceFile));
|
|
517
520
|
// Detect declaration files with declare module "foo" as their only export
|
|
518
521
|
// and lift that up one level as the source file symbol
|
|
519
522
|
if (globalSymbols.length === 1 &&
|
|
@@ -3,33 +3,30 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.convertIndexSignatures = convertIndexSignatures;
|
|
7
7
|
const assert_1 = __importDefault(require("assert"));
|
|
8
8
|
const typescript_1 = __importDefault(require("typescript"));
|
|
9
9
|
const models_1 = require("../../models");
|
|
10
10
|
const converter_events_1 = require("../converter-events");
|
|
11
|
-
function
|
|
11
|
+
function convertIndexSignatures(context, symbol) {
|
|
12
12
|
(0, assert_1.default)(context.scope instanceof models_1.DeclarationReflection);
|
|
13
13
|
const indexSymbol = symbol.members?.get("__index");
|
|
14
|
-
if (indexSymbol)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const indexDeclaration = indexSymbol.getDeclarations()?.[0];
|
|
19
|
-
(0, assert_1.default)(indexDeclaration &&
|
|
20
|
-
typescript_1.default.isIndexSignatureDeclaration(indexDeclaration));
|
|
14
|
+
if (!indexSymbol)
|
|
15
|
+
return;
|
|
16
|
+
for (const indexDeclaration of indexSymbol.getDeclarations() || []) {
|
|
17
|
+
(0, assert_1.default)(typescript_1.default.isIndexSignatureDeclaration(indexDeclaration));
|
|
21
18
|
const param = indexDeclaration.parameters[0];
|
|
22
19
|
(0, assert_1.default)(param && typescript_1.default.isParameter(param));
|
|
23
20
|
const index = new models_1.SignatureReflection("__index", models_1.ReflectionKind.IndexSignature, context.scope);
|
|
24
|
-
index.comment = context.
|
|
21
|
+
index.comment = context.getNodeComment(indexDeclaration, index.kind);
|
|
25
22
|
index.parameters = [
|
|
26
23
|
new models_1.ParameterReflection(param.name.getText(), models_1.ReflectionKind.Parameter, index),
|
|
27
24
|
];
|
|
28
25
|
index.parameters[0].type = context.converter.convertType(context.withScope(index.parameters[0]), param.type);
|
|
29
26
|
index.type = context.converter.convertType(context.withScope(index), indexDeclaration.type);
|
|
30
27
|
context.registerReflection(index, indexSymbol);
|
|
31
|
-
context.scope.
|
|
28
|
+
context.scope.indexSignatures ||= [];
|
|
29
|
+
context.scope.indexSignatures.push(index);
|
|
32
30
|
context.trigger(converter_events_1.ConverterEvents.CREATE_SIGNATURE, index, indexDeclaration);
|
|
33
31
|
}
|
|
34
32
|
}
|
|
35
|
-
exports.convertIndexSignature = convertIndexSignature;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
|
-
import { ParameterReflection, Reflection, ReflectionKind, SignatureReflection, TypeParameterReflection } from "../../models";
|
|
2
|
+
import { ParameterReflection, type Reflection, ReflectionKind, SignatureReflection, TypeParameterReflection } from "../../models";
|
|
3
3
|
import type { Context } from "../context";
|
|
4
4
|
export declare function createSignature(context: Context, kind: ReflectionKind.CallSignature | ReflectionKind.ConstructorSignature | ReflectionKind.GetSignature | ReflectionKind.SetSignature, signature: ts.Signature, symbol: ts.Symbol | undefined, declaration?: ts.SignatureDeclaration | ts.JSDocSignature): void;
|
|
5
5
|
/**
|
|
@@ -3,7 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.createSignature = createSignature;
|
|
7
|
+
exports.createConstructSignatureWithType = createConstructSignatureWithType;
|
|
8
|
+
exports.convertParameterNodes = convertParameterNodes;
|
|
9
|
+
exports.convertTypeParameterNodes = convertTypeParameterNodes;
|
|
10
|
+
exports.createTypeParamReflection = createTypeParamReflection;
|
|
11
|
+
exports.convertTemplateParameterNodes = convertTemplateParameterNodes;
|
|
7
12
|
const typescript_1 = __importDefault(require("typescript"));
|
|
8
13
|
const assert_1 = __importDefault(require("assert"));
|
|
9
14
|
const models_1 = require("../../models");
|
|
@@ -34,11 +39,11 @@ function createSignature(context, kind, signature, symbol, declaration) {
|
|
|
34
39
|
parentReflection.parent instanceof models_1.DeclarationReflection) {
|
|
35
40
|
parentReflection = parentReflection.parent;
|
|
36
41
|
}
|
|
37
|
-
if (declaration
|
|
38
|
-
(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
if (declaration) {
|
|
43
|
+
const sigComment = context.getSignatureComment(declaration);
|
|
44
|
+
if (parentReflection.comment?.discoveryId !== sigComment?.discoveryId) {
|
|
45
|
+
sigRef.comment = sigComment;
|
|
46
|
+
}
|
|
42
47
|
}
|
|
43
48
|
sigRef.typeParameters = convertTypeParameters(sigRefCtx, sigRef, signature.typeParameters);
|
|
44
49
|
const parameterSymbols = signature.thisParameter
|
|
@@ -76,7 +81,6 @@ function createSignature(context, kind, signature, symbol, declaration) {
|
|
|
76
81
|
}
|
|
77
82
|
context.converter.trigger(converter_events_1.ConverterEvents.CREATE_SIGNATURE, context, sigRef, declaration, signature);
|
|
78
83
|
}
|
|
79
|
-
exports.createSignature = createSignature;
|
|
80
84
|
/**
|
|
81
85
|
* Special cased constructor factory for functions tagged with `@class`
|
|
82
86
|
*/
|
|
@@ -95,7 +99,6 @@ function createConstructSignatureWithType(context, signature, classType) {
|
|
|
95
99
|
context.scope.signatures.push(sigRef);
|
|
96
100
|
context.converter.trigger(converter_events_1.ConverterEvents.CREATE_SIGNATURE, context, sigRef, declaration, signature);
|
|
97
101
|
}
|
|
98
|
-
exports.createConstructSignatureWithType = createConstructSignatureWithType;
|
|
99
102
|
function convertParameters(context, sigRef, parameters, parameterNodes) {
|
|
100
103
|
return parameters.map((param, i) => {
|
|
101
104
|
const declaration = param.valueDeclaration;
|
|
@@ -179,7 +182,6 @@ function convertParameterNodes(context, sigRef, parameters) {
|
|
|
179
182
|
return paramRefl;
|
|
180
183
|
});
|
|
181
184
|
}
|
|
182
|
-
exports.convertParameterNodes = convertParameterNodes;
|
|
183
185
|
function checkForDestructuredParameterDefaults(param, decl) {
|
|
184
186
|
if (!decl || !typescript_1.default.isParameter(decl))
|
|
185
187
|
return;
|
|
@@ -226,7 +228,6 @@ function convertTypeParameters(context, parent, parameters) {
|
|
|
226
228
|
function convertTypeParameterNodes(context, parameters) {
|
|
227
229
|
return parameters?.map((param) => createTypeParamReflection(param, context));
|
|
228
230
|
}
|
|
229
|
-
exports.convertTypeParameterNodes = convertTypeParameterNodes;
|
|
230
231
|
function createTypeParamReflection(param, context) {
|
|
231
232
|
const paramRefl = new models_1.TypeParameterReflection(param.name.text, context.scope, getVariance(param.modifiers));
|
|
232
233
|
const paramScope = context.withScope(paramRefl);
|
|
@@ -246,7 +247,6 @@ function createTypeParamReflection(param, context) {
|
|
|
246
247
|
context.trigger(converter_events_1.ConverterEvents.CREATE_TYPE_PARAMETER, paramRefl, param);
|
|
247
248
|
return paramRefl;
|
|
248
249
|
}
|
|
249
|
-
exports.createTypeParamReflection = createTypeParamReflection;
|
|
250
250
|
function convertTemplateParameterNodes(context, nodes) {
|
|
251
251
|
return nodes?.flatMap((node) => {
|
|
252
252
|
return node.typeParameters.map((param, index) => {
|
|
@@ -271,7 +271,6 @@ function convertTemplateParameterNodes(context, nodes) {
|
|
|
271
271
|
});
|
|
272
272
|
});
|
|
273
273
|
}
|
|
274
|
-
exports.convertTemplateParameterNodes = convertTemplateParameterNodes;
|
|
275
274
|
function getVariance(modifiers) {
|
|
276
275
|
const hasIn = modifiers?.some((mod) => mod.kind === typescript_1.default.SyntaxKind.InKeyword);
|
|
277
276
|
const hasOut = modifiers?.some((mod) => mod.kind === typescript_1.default.SyntaxKind.OutKeyword);
|
|
@@ -6,7 +6,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
6
6
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.convertJsDocAlias = convertJsDocAlias;
|
|
10
|
+
exports.convertJsDocCallback = convertJsDocCallback;
|
|
10
11
|
const assert_1 = require("assert");
|
|
11
12
|
const typescript_1 = __importDefault(require("typescript"));
|
|
12
13
|
const models_1 = require("../models");
|
|
@@ -33,7 +34,6 @@ function convertJsDocAlias(context, symbol, declaration, exportSymbol) {
|
|
|
33
34
|
convertTemplateParameters(context.withScope(reflection), declaration.parent);
|
|
34
35
|
context.finalizeDeclarationReflection(reflection);
|
|
35
36
|
}
|
|
36
|
-
exports.convertJsDocAlias = convertJsDocAlias;
|
|
37
37
|
function convertJsDocCallback(context, symbol, declaration, exportSymbol) {
|
|
38
38
|
const alias = context.createDeclarationReflection(models_1.ReflectionKind.TypeAlias, symbol, exportSymbol);
|
|
39
39
|
alias.comment = context.getJsDocComment(declaration);
|
|
@@ -42,7 +42,6 @@ function convertJsDocCallback(context, symbol, declaration, exportSymbol) {
|
|
|
42
42
|
alias.type = convertJsDocSignature(ac, declaration.typeExpression);
|
|
43
43
|
convertTemplateParameters(ac, declaration.parent);
|
|
44
44
|
}
|
|
45
|
-
exports.convertJsDocCallback = convertJsDocCallback;
|
|
46
45
|
function convertJsDocInterface(context, declaration, symbol, exportSymbol) {
|
|
47
46
|
const reflection = context.createDeclarationReflection(models_1.ReflectionKind.Interface, symbol, exportSymbol);
|
|
48
47
|
reflection.comment = context.getJsDocComment(declaration);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DeclarationReflection } from "../../models";
|
|
1
|
+
import { type DeclarationReflection, type DocumentReflection } from "../../models";
|
|
2
2
|
import { ConverterComponent } from "../components";
|
|
3
3
|
/**
|
|
4
4
|
* A handler that sorts and categorizes the found reflections in the resolving phase.
|
|
@@ -6,7 +6,7 @@ import { ConverterComponent } from "../components";
|
|
|
6
6
|
* The handler sets the ´category´ property of all reflections.
|
|
7
7
|
*/
|
|
8
8
|
export declare class CategoryPlugin extends ConverterComponent {
|
|
9
|
-
sortFunction: (reflections: DeclarationReflection
|
|
9
|
+
sortFunction: (reflections: Array<DeclarationReflection | DocumentReflection>) => void;
|
|
10
10
|
accessor defaultCategory: string;
|
|
11
11
|
accessor categoryOrder: string[];
|
|
12
12
|
accessor categorizeByGroup: boolean;
|
|
@@ -58,5 +58,5 @@ export declare class CategoryPlugin extends ConverterComponent {
|
|
|
58
58
|
* @returns The sorting weight.
|
|
59
59
|
*/
|
|
60
60
|
private static sortCatCallback;
|
|
61
|
-
static getCategories(reflection: DeclarationReflection): Set<string>;
|
|
61
|
+
static getCategories(reflection: DeclarationReflection | DocumentReflection): Set<string>;
|
|
62
62
|
}
|
|
@@ -138,8 +138,7 @@ let CategoryPlugin = (() => {
|
|
|
138
138
|
}
|
|
139
139
|
this.usedBoosts.clear();
|
|
140
140
|
if (unusedBoosts.size) {
|
|
141
|
-
context.logger.warn(
|
|
142
|
-
` The unused categories were:\n\t${Array.from(unusedBoosts).join("\n\t")}`);
|
|
141
|
+
context.logger.warn(context.i18n.not_all_search_category_boosts_used_0(Array.from(unusedBoosts).join("\n\t")));
|
|
143
142
|
}
|
|
144
143
|
}
|
|
145
144
|
categorize(obj) {
|
|
@@ -218,7 +217,7 @@ let CategoryPlugin = (() => {
|
|
|
218
217
|
cat.description = body;
|
|
219
218
|
}
|
|
220
219
|
else {
|
|
221
|
-
this.application.logger.warn(
|
|
220
|
+
this.application.logger.warn(this.application.i18n.comment_for_0_includes_categoryDescription_for_1_but_no_child_in_group(parent.getFriendlyFullName(), header));
|
|
222
221
|
}
|
|
223
222
|
return true;
|
|
224
223
|
}
|
|
@@ -242,14 +241,20 @@ let CategoryPlugin = (() => {
|
|
|
242
241
|
extractCategories(reflection) {
|
|
243
242
|
const categories = CategoryPlugin.getCategories(reflection);
|
|
244
243
|
reflection.comment?.removeTags("@category");
|
|
245
|
-
|
|
246
|
-
sig.
|
|
247
|
-
}
|
|
248
|
-
if (reflection.type?.type === "reflection") {
|
|
249
|
-
reflection.type.declaration.comment?.removeTags("@category");
|
|
250
|
-
for (const sig of reflection.type.declaration.getNonIndexSignatures()) {
|
|
244
|
+
if (reflection.isDeclaration()) {
|
|
245
|
+
for (const sig of reflection.getNonIndexSignatures()) {
|
|
251
246
|
sig.comment?.removeTags("@category");
|
|
252
247
|
}
|
|
248
|
+
if (reflection.type?.type === "reflection") {
|
|
249
|
+
reflection.type.declaration.comment?.removeTags("@category");
|
|
250
|
+
for (const sig of reflection.type.declaration.getNonIndexSignatures()) {
|
|
251
|
+
sig.comment?.removeTags("@category");
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
if (reflection.isDocument() && "category" in reflection.frontmatter) {
|
|
256
|
+
categories.add(String(reflection.frontmatter["category"]));
|
|
257
|
+
delete reflection.frontmatter["category"];
|
|
253
258
|
}
|
|
254
259
|
categories.delete("");
|
|
255
260
|
for (const cat of categories) {
|
|
@@ -300,14 +305,16 @@ let CategoryPlugin = (() => {
|
|
|
300
305
|
}
|
|
301
306
|
}
|
|
302
307
|
discoverCategories(reflection.comment);
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
}
|
|
306
|
-
if (reflection.type?.type === "reflection") {
|
|
307
|
-
discoverCategories(reflection.type.declaration.comment);
|
|
308
|
-
for (const sig of reflection.type.declaration.getNonIndexSignatures()) {
|
|
308
|
+
if (reflection.isDeclaration()) {
|
|
309
|
+
for (const sig of reflection.getNonIndexSignatures()) {
|
|
309
310
|
discoverCategories(sig.comment);
|
|
310
311
|
}
|
|
312
|
+
if (reflection.type?.type === "reflection") {
|
|
313
|
+
discoverCategories(reflection.type.declaration.comment);
|
|
314
|
+
for (const sig of reflection.type.declaration.getNonIndexSignatures()) {
|
|
315
|
+
discoverCategories(sig.comment);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
311
318
|
}
|
|
312
319
|
categories.delete("");
|
|
313
320
|
return categories;
|
|
@@ -112,7 +112,7 @@ export declare class CommentPlugin extends ConverterComponent {
|
|
|
112
112
|
* @param reflection The reflection that is currently resolved.
|
|
113
113
|
*/
|
|
114
114
|
private onResolve;
|
|
115
|
-
private
|
|
115
|
+
private moveSignatureParamComments;
|
|
116
116
|
private removeExcludedTags;
|
|
117
117
|
/**
|
|
118
118
|
* Determines whether or not a reflection has been hidden
|
|
@@ -281,6 +281,7 @@ let CommentPlugin = (() => {
|
|
|
281
281
|
}
|
|
282
282
|
if (tag) {
|
|
283
283
|
reflection.comment = new models_1.Comment(tag.content);
|
|
284
|
+
reflection.comment.sourcePath = comment.sourcePath;
|
|
284
285
|
(0, utils_1.removeIfPresent)(comment.blockTags, tag);
|
|
285
286
|
}
|
|
286
287
|
}
|
|
@@ -366,80 +367,67 @@ let CommentPlugin = (() => {
|
|
|
366
367
|
if (reflection.comment) {
|
|
367
368
|
if (reflection.comment.label &&
|
|
368
369
|
!/[A-Z_][A-Z0-9_]/.test(reflection.comment.label)) {
|
|
369
|
-
context.logger.warn(
|
|
370
|
-
`Labels may only contain A-Z, 0-9, and _, and may not start with a number.`);
|
|
370
|
+
context.logger.warn(context.i18n.label_0_for_1_cannot_be_referenced(reflection.comment.label, reflection.getFriendlyFullName()));
|
|
371
371
|
}
|
|
372
372
|
mergeSeeTags(reflection.comment);
|
|
373
373
|
movePropertyTags(reflection.comment, reflection);
|
|
374
374
|
}
|
|
375
|
-
if (
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
375
|
+
if (reflection instanceof models_1.DeclarationReflection && reflection.comment) {
|
|
376
|
+
let sigs;
|
|
377
|
+
if (reflection.type instanceof models_1.ReflectionType) {
|
|
378
|
+
sigs = reflection.type.declaration.getNonIndexSignatures();
|
|
379
|
+
}
|
|
380
|
+
else {
|
|
381
|
+
sigs = reflection.getNonIndexSignatures();
|
|
382
|
+
}
|
|
383
|
+
// For variables and properties, the symbol might own the comment but we might also
|
|
384
|
+
// have @param and @returns comments for an owned signature. Only do this if there is
|
|
385
|
+
// exactly one signature as otherwise we have no hope of doing validation right.
|
|
386
|
+
if (sigs.length === 1 && !sigs[0].comment) {
|
|
387
|
+
this.moveSignatureParamComments(sigs[0], reflection.comment);
|
|
388
|
+
const returnsTag = reflection.comment.getTag("@returns");
|
|
389
|
+
if (returnsTag) {
|
|
390
|
+
sigs[0].comment = new models_1.Comment();
|
|
391
|
+
sigs[0].comment.sourcePath = reflection.comment.sourcePath;
|
|
392
|
+
sigs[0].comment.blockTags.push(returnsTag);
|
|
393
|
+
reflection.comment.removeTags("@returns");
|
|
394
|
+
}
|
|
395
|
+
}
|
|
380
396
|
}
|
|
381
|
-
|
|
382
|
-
this.
|
|
397
|
+
if (reflection instanceof models_1.SignatureReflection) {
|
|
398
|
+
this.moveSignatureParamComments(reflection);
|
|
383
399
|
}
|
|
384
400
|
}
|
|
385
|
-
|
|
386
|
-
if (!
|
|
401
|
+
moveSignatureParamComments(signature, comment = signature.comment) {
|
|
402
|
+
if (!comment)
|
|
387
403
|
return;
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
const childComment = (signature.comment ||= comment?.clone());
|
|
395
|
-
if (!childComment)
|
|
396
|
-
continue;
|
|
397
|
-
signature.parameters?.forEach((parameter, index) => {
|
|
398
|
-
if (parameter.name === "__namedParameters") {
|
|
399
|
-
const commentParams = childComment.blockTags.filter((tag) => tag.tag === "@param" && !tag.name?.includes("."));
|
|
400
|
-
if (signature.parameters?.length === commentParams.length &&
|
|
401
|
-
commentParams[index].name) {
|
|
402
|
-
parameter.name = commentParams[index].name;
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
const tag = childComment.getIdentifiedTag(parameter.name, "@param");
|
|
406
|
-
if (tag) {
|
|
407
|
-
parameter.comment = new models_1.Comment(models_1.Comment.cloneDisplayParts(tag.content));
|
|
408
|
-
}
|
|
409
|
-
});
|
|
410
|
-
for (const parameter of signature.typeParameters || []) {
|
|
411
|
-
const tag = childComment.getIdentifiedTag(parameter.name, "@typeParam") ||
|
|
412
|
-
childComment.getIdentifiedTag(parameter.name, "@template") ||
|
|
413
|
-
childComment.getIdentifiedTag(`<${parameter.name}>`, "@param");
|
|
414
|
-
if (tag) {
|
|
415
|
-
parameter.comment = new models_1.Comment(models_1.Comment.cloneDisplayParts(tag.content));
|
|
404
|
+
signature.parameters?.forEach((parameter, index) => {
|
|
405
|
+
if (parameter.name === "__namedParameters") {
|
|
406
|
+
const commentParams = comment.blockTags.filter((tag) => tag.tag === "@param" && !tag.name?.includes("."));
|
|
407
|
+
if (signature.parameters?.length === commentParams.length &&
|
|
408
|
+
commentParams[index].name) {
|
|
409
|
+
parameter.name = commentParams[index].name;
|
|
416
410
|
}
|
|
417
411
|
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
else {
|
|
432
|
-
reflection.comment?.removeTags("@param");
|
|
433
|
-
reflection.comment?.removeTags("@typeParam");
|
|
434
|
-
reflection.comment?.removeTags("@template");
|
|
435
|
-
const parentComment = models_1.Comment.combineDisplayParts(reflection.comment?.summary);
|
|
436
|
-
for (const sig of signatures) {
|
|
437
|
-
if (models_1.Comment.combineDisplayParts(sig.comment?.summary) ===
|
|
438
|
-
parentComment) {
|
|
439
|
-
delete sig.comment;
|
|
440
|
-
}
|
|
412
|
+
const tag = comment.getIdentifiedTag(parameter.name, "@param");
|
|
413
|
+
if (tag) {
|
|
414
|
+
parameter.comment = new models_1.Comment(models_1.Comment.cloneDisplayParts(tag.content));
|
|
415
|
+
parameter.comment.sourcePath = comment.sourcePath;
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
for (const parameter of signature.typeParameters || []) {
|
|
419
|
+
const tag = comment.getIdentifiedTag(parameter.name, "@typeParam") ||
|
|
420
|
+
comment.getIdentifiedTag(parameter.name, "@template") ||
|
|
421
|
+
comment.getIdentifiedTag(`<${parameter.name}>`, "@param");
|
|
422
|
+
if (tag) {
|
|
423
|
+
parameter.comment = new models_1.Comment(models_1.Comment.cloneDisplayParts(tag.content));
|
|
424
|
+
parameter.comment.sourcePath = comment.sourcePath;
|
|
441
425
|
}
|
|
442
426
|
}
|
|
427
|
+
this.validateParamTags(signature, comment, signature.parameters || []);
|
|
428
|
+
comment.removeTags("@param");
|
|
429
|
+
comment.removeTags("@typeParam");
|
|
430
|
+
comment.removeTags("@template");
|
|
443
431
|
}
|
|
444
432
|
removeExcludedTags(comment) {
|
|
445
433
|
for (const tag of NEVER_RENDERED) {
|
|
@@ -534,13 +522,13 @@ let CommentPlugin = (() => {
|
|
|
534
522
|
}
|
|
535
523
|
return excludeCategories.some((cat) => categories.has(cat));
|
|
536
524
|
}
|
|
537
|
-
validateParamTags(signature, comment, params
|
|
525
|
+
validateParamTags(signature, comment, params) {
|
|
538
526
|
const paramTags = comment.blockTags.filter((tag) => tag.tag === "@param");
|
|
539
527
|
(0, utils_1.removeIf)(paramTags, (tag) => params.some((param) => param.name === tag.name));
|
|
540
|
-
moveNestedParamTags(/* in-out */ paramTags, params);
|
|
541
|
-
if (
|
|
528
|
+
moveNestedParamTags(/* in-out */ paramTags, params, comment.sourcePath);
|
|
529
|
+
if (paramTags.length) {
|
|
542
530
|
for (const tag of paramTags) {
|
|
543
|
-
this.application.logger.warn(
|
|
531
|
+
this.application.logger.warn(this.application.i18n.signature_0_has_unused_param_with_name_1(signature.getFriendlyFullName(), tag.name ?? "(missing)"));
|
|
544
532
|
}
|
|
545
533
|
}
|
|
546
534
|
}
|
|
@@ -588,7 +576,7 @@ function inTypeLiteral(refl) {
|
|
|
588
576
|
}
|
|
589
577
|
// Moves tags like `@param foo.bar docs for bar` into the `bar` property of the `foo` parameter.
|
|
590
578
|
function moveNestedParamTags(
|
|
591
|
-
/* in-out */ paramTags, parameters) {
|
|
579
|
+
/* in-out */ paramTags, parameters, sourcePath) {
|
|
592
580
|
const used = new Set();
|
|
593
581
|
for (const param of parameters) {
|
|
594
582
|
const visitor = {
|
|
@@ -600,6 +588,7 @@ function moveNestedParamTags(
|
|
|
600
588
|
const child = target.declaration.getChildByName(path);
|
|
601
589
|
if (child && !child.comment) {
|
|
602
590
|
child.comment = new models_1.Comment(models_1.Comment.cloneDisplayParts(tag.content));
|
|
591
|
+
child.comment.sourcePath = sourcePath;
|
|
603
592
|
used.add(paramTags.indexOf(tag));
|
|
604
593
|
}
|
|
605
594
|
}
|
|
@@ -631,9 +620,11 @@ function movePropertyTags(comment, container) {
|
|
|
631
620
|
const child = container.getChildByName(prop.name);
|
|
632
621
|
if (child) {
|
|
633
622
|
child.comment = new models_1.Comment(models_1.Comment.cloneDisplayParts(prop.content));
|
|
623
|
+
child.comment.sourcePath = comment.sourcePath;
|
|
634
624
|
if (child instanceof models_1.DeclarationReflection && child.signatures) {
|
|
635
625
|
for (const sig of child.signatures) {
|
|
636
626
|
sig.comment = new models_1.Comment(models_1.Comment.cloneDisplayParts(prop.content));
|
|
627
|
+
sig.comment.sourcePath = comment.sourcePath;
|
|
637
628
|
}
|
|
638
629
|
}
|
|
639
630
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ContainerReflection, DeclarationReflection } from "../../models/reflections/index";
|
|
1
|
+
import { ContainerReflection, type DeclarationReflection, type DocumentReflection } from "../../models/reflections/index";
|
|
2
2
|
import { ReflectionGroup } from "../../models/ReflectionGroup";
|
|
3
3
|
import { ConverterComponent } from "../components";
|
|
4
4
|
/**
|
|
@@ -7,7 +7,7 @@ import { ConverterComponent } from "../components";
|
|
|
7
7
|
* The handler sets the `groups` property of all container reflections.
|
|
8
8
|
*/
|
|
9
9
|
export declare class GroupPlugin extends ConverterComponent {
|
|
10
|
-
sortFunction: (reflections: DeclarationReflection
|
|
10
|
+
sortFunction: (reflections: Array<DeclarationReflection | DocumentReflection>) => void;
|
|
11
11
|
accessor boosts: Record<string, number>;
|
|
12
12
|
accessor groupOrder: string[];
|
|
13
13
|
accessor sortEntryPoints: boolean;
|
|
@@ -30,7 +30,7 @@ export declare class GroupPlugin extends ConverterComponent {
|
|
|
30
30
|
* @privateRemarks
|
|
31
31
|
* If you change this, also update extractCategories in CategoryPlugin accordingly.
|
|
32
32
|
*/
|
|
33
|
-
getGroups(reflection: DeclarationReflection): Set<string>;
|
|
33
|
+
getGroups(reflection: DeclarationReflection | DocumentReflection): Set<string>;
|
|
34
34
|
/**
|
|
35
35
|
* Create a grouped representation of the given list of reflections.
|
|
36
36
|
*
|
|
@@ -39,7 +39,7 @@ export declare class GroupPlugin extends ConverterComponent {
|
|
|
39
39
|
* @param reflections The reflections that should be grouped.
|
|
40
40
|
* @returns An array containing all children of the given reflection grouped by their kind.
|
|
41
41
|
*/
|
|
42
|
-
getReflectionGroups(parent: ContainerReflection, reflections: DeclarationReflection
|
|
42
|
+
getReflectionGroups(parent: ContainerReflection, reflections: Array<DeclarationReflection | DocumentReflection>): ReflectionGroup[];
|
|
43
43
|
/**
|
|
44
44
|
* Callback used to sort groups by name.
|
|
45
45
|
*/
|