typedoc 0.26.4 → 0.26.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/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/lib/application.js +3 -4
- package/dist/lib/converter/comments/discovery.js +5 -0
- package/dist/lib/converter/comments/parser.js +4 -3
- package/dist/lib/converter/plugins/ImplementsPlugin.d.ts +12 -0
- package/dist/lib/converter/plugins/ImplementsPlugin.js +91 -72
- package/dist/lib/internationalization/internationalization.js +1 -1
- package/dist/lib/internationalization/translatable.js +2 -4
- package/dist/lib/models/FileRegistry.js +5 -1
- package/dist/lib/models/comments/comment.d.ts +12 -0
- package/dist/lib/models/comments/comment.js +33 -0
- package/dist/lib/models/reflections/project.d.ts +8 -0
- package/dist/lib/models/reflections/project.js +14 -1
- package/dist/lib/output/plugins/JavascriptIndexPlugin.js +4 -2
- package/dist/lib/output/themes/default/DefaultTheme.js +27 -18
- package/dist/lib/serialization/components.d.ts +1 -1
- package/dist/lib/serialization/deserializer.js +0 -1
- package/dist/lib/serialization/serializer.d.ts +5 -1
- package/dist/lib/serialization/serializer.js +3 -0
- package/dist/lib/utils/array.d.ts +1 -1
- package/dist/lib/utils/array.js +2 -2
- package/dist/lib/utils/component.d.ts +1 -1
- package/dist/lib/utils/enum.d.ts +3 -3
- package/dist/lib/utils/fs.d.ts +1 -0
- package/dist/lib/utils/fs.js +4 -0
- package/dist/lib/utils/index.d.ts +1 -1
- package/dist/lib/utils/index.js +2 -1
- package/dist/lib/utils/options/declaration.d.ts +1 -0
- package/dist/lib/utils/options/defaults.d.ts +23 -0
- package/dist/lib/utils/options/defaults.js +120 -0
- package/dist/lib/utils/options/index.d.ts +1 -0
- package/dist/lib/utils/options/index.js +3 -1
- package/dist/lib/utils/options/readers/typedoc.js +1 -0
- package/dist/lib/utils/options/sources/typedoc.js +13 -64
- package/dist/lib/utils/options/tsdoc-defaults.d.ts +1 -1
- package/dist/lib/utils/options/tsdoc-defaults.js +3 -0
- package/dist/lib/utils/perf.d.ts +2 -2
- package/dist/lib/utils/plugins.js +1 -0
- package/dist/lib/utils/sort.js +4 -29
- package/dist/lib/validation/documentation.js +5 -1
- package/package.json +2 -2
- package/static/main.js +1 -1
- package/tsdoc.json +12 -0
package/dist/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export * from "./lib/models";
|
|
|
20
20
|
export { Converter, Context, type CommentParserConfig, type DeclarationReference, type SymbolReference, type ComponentPath, type Meaning, type MeaningKeyword, type ExternalResolveResult, type ExternalSymbolResolver, type ConverterEvents, } from "./lib/converter";
|
|
21
21
|
export { Renderer, DefaultTheme, DefaultThemeRenderContext, Slugger, UrlMapping, Theme, PageEvent, RendererEvent, MarkdownEvent, IndexEvent, } from "./lib/output";
|
|
22
22
|
export type { RenderTemplate, RendererHooks, NavigationElement, RendererEvents, PageHeading, } from "./lib/output";
|
|
23
|
-
export { ArgumentsReader, Option, CommentStyle, JSX, LogLevel, Logger, Options, PackageJsonReader, ParameterHint, ParameterType, TSConfigReader, TypeDocReader, EntryPointStrategy, EventHooks, MinimalSourceFile, normalizePath, } from "./lib/utils";
|
|
23
|
+
export { ArgumentsReader, Option, CommentStyle, JSX, LogLevel, Logger, Options, OptionDefaults, PackageJsonReader, ParameterHint, ParameterType, TSConfigReader, TypeDocReader, EntryPointStrategy, EventHooks, MinimalSourceFile, normalizePath, } from "./lib/utils";
|
|
24
24
|
export type { OptionsReader, TypeDocOptions, TypeDocOptionMap, ValidationOptions, TypeDocOptionValues, KeyToDeclaration, DeclarationOption, DeclarationOptionBase, StringDeclarationOption, NumberDeclarationOption, BooleanDeclarationOption, ArrayDeclarationOption, MixedDeclarationOption, ObjectDeclarationOption, MapDeclarationOption, FlagsDeclarationOption, DeclarationOptionToOptionType, SortStrategy, ParameterTypeToOptionTypeMap, DocumentationEntryPoint, ManuallyValidatedOption, EnumKeys, JsDocCompatibility, } from "./lib/utils";
|
|
25
25
|
export { JSONOutput, Serializer, type SerializerEvents, Deserializer, type Deserializable, type DeserializerComponent, type SerializerComponent, SerializeEvent, } from "./lib/serialization";
|
|
26
26
|
export * as Internationalization from "./lib/internationalization/index";
|
package/dist/index.js
CHANGED
|
@@ -29,7 +29,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
29
29
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
30
|
};
|
|
31
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.TypeScript = exports.Internationalization = exports.SerializeEvent = exports.Deserializer = exports.Serializer = exports.JSONOutput = exports.normalizePath = exports.MinimalSourceFile = exports.EventHooks = exports.EntryPointStrategy = exports.TypeDocReader = exports.TSConfigReader = exports.ParameterType = exports.ParameterHint = exports.PackageJsonReader = exports.Options = exports.Logger = exports.LogLevel = exports.JSX = exports.CommentStyle = exports.Option = exports.ArgumentsReader = exports.IndexEvent = exports.MarkdownEvent = exports.RendererEvent = exports.PageEvent = exports.Theme = exports.UrlMapping = exports.Slugger = exports.DefaultThemeRenderContext = exports.DefaultTheme = exports.Renderer = exports.Context = exports.Converter = exports.Configuration = exports.Models = exports.resetReflectionID = exports.EventDispatcher = exports.Application = void 0;
|
|
32
|
+
exports.TypeScript = exports.Internationalization = exports.SerializeEvent = exports.Deserializer = exports.Serializer = exports.JSONOutput = exports.normalizePath = exports.MinimalSourceFile = exports.EventHooks = exports.EntryPointStrategy = exports.TypeDocReader = exports.TSConfigReader = exports.ParameterType = exports.ParameterHint = exports.PackageJsonReader = exports.OptionDefaults = exports.Options = exports.Logger = exports.LogLevel = exports.JSX = exports.CommentStyle = exports.Option = exports.ArgumentsReader = exports.IndexEvent = exports.MarkdownEvent = exports.RendererEvent = exports.PageEvent = exports.Theme = exports.UrlMapping = exports.Slugger = exports.DefaultThemeRenderContext = exports.DefaultTheme = exports.Renderer = exports.Context = exports.Converter = exports.Configuration = exports.Models = exports.resetReflectionID = exports.EventDispatcher = exports.Application = void 0;
|
|
33
33
|
var application_1 = require("./lib/application");
|
|
34
34
|
Object.defineProperty(exports, "Application", { enumerable: true, get: function () { return application_1.Application; } });
|
|
35
35
|
var events_1 = require("./lib/utils/events");
|
|
@@ -74,6 +74,7 @@ Object.defineProperty(exports, "JSX", { enumerable: true, get: function () { ret
|
|
|
74
74
|
Object.defineProperty(exports, "LogLevel", { enumerable: true, get: function () { return utils_1.LogLevel; } });
|
|
75
75
|
Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return utils_1.Logger; } });
|
|
76
76
|
Object.defineProperty(exports, "Options", { enumerable: true, get: function () { return utils_1.Options; } });
|
|
77
|
+
Object.defineProperty(exports, "OptionDefaults", { enumerable: true, get: function () { return utils_1.OptionDefaults; } });
|
|
77
78
|
Object.defineProperty(exports, "PackageJsonReader", { enumerable: true, get: function () { return utils_1.PackageJsonReader; } });
|
|
78
79
|
Object.defineProperty(exports, "ParameterHint", { enumerable: true, get: function () { return utils_1.ParameterHint; } });
|
|
79
80
|
Object.defineProperty(exports, "ParameterType", { enumerable: true, get: function () { return utils_1.ParameterType; } });
|
package/dist/lib/application.js
CHANGED
|
@@ -96,12 +96,11 @@ const links_1 = require("./validation/links");
|
|
|
96
96
|
const application_events_1 = require("./application-events");
|
|
97
97
|
const tsconfig_1 = require("./utils/tsconfig");
|
|
98
98
|
const fs_1 = require("./utils/fs");
|
|
99
|
-
const abstract_1 = require("./models/reflections/abstract");
|
|
100
99
|
const ReflectionSymbolId_1 = require("./models/reflections/ReflectionSymbolId");
|
|
101
100
|
const internationalization_1 = require("./internationalization/internationalization");
|
|
102
101
|
const highlighter_1 = require("./utils/highlighter");
|
|
103
102
|
const FileRegistry_1 = require("./models/FileRegistry");
|
|
104
|
-
// eslint-disable-next-line @typescript-eslint/no-
|
|
103
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
105
104
|
const packageInfo = require("../../package.json");
|
|
106
105
|
const supportedVersionMajorMinor = packageInfo.peerDependencies.typescript
|
|
107
106
|
.split("||")
|
|
@@ -535,12 +534,12 @@ let Application = (() => {
|
|
|
535
534
|
projects.push(serialized);
|
|
536
535
|
}
|
|
537
536
|
// When debugging memory issues, it's useful to set these
|
|
538
|
-
// here so that a breakpoint on
|
|
537
|
+
// here so that a breakpoint on the continue statement below
|
|
539
538
|
// gets the memory as it ought to be with all TS objects released.
|
|
540
539
|
project = undefined;
|
|
541
540
|
this.files = undefined;
|
|
542
541
|
// global.gc!();
|
|
543
|
-
|
|
542
|
+
continue;
|
|
544
543
|
}
|
|
545
544
|
this.options = origOptions;
|
|
546
545
|
this.files = origFiles;
|
|
@@ -308,6 +308,11 @@ function declarationToCommentNodeIgnoringParents(node) {
|
|
|
308
308
|
// ts.SourceFile is a counterexample
|
|
309
309
|
if (!node.parent)
|
|
310
310
|
return node;
|
|
311
|
+
// function foo(x: number)
|
|
312
|
+
// ^^^^^^^^^
|
|
313
|
+
if (node.kind === typescript_1.default.SyntaxKind.Parameter) {
|
|
314
|
+
return node;
|
|
315
|
+
}
|
|
311
316
|
// const abc = 123
|
|
312
317
|
// ^^^
|
|
313
318
|
if (node.parent.kind === typescript_1.default.SyntaxKind.VariableDeclarationList) {
|
|
@@ -34,6 +34,7 @@ const lexer_1 = require("./lexer");
|
|
|
34
34
|
const tagName_1 = require("./tagName");
|
|
35
35
|
const FileRegistry_1 = require("../../models/FileRegistry");
|
|
36
36
|
const textParser_1 = require("./textParser");
|
|
37
|
+
const fs_1 = require("../../utils/fs");
|
|
37
38
|
function makeLookaheadGenerator(gen) {
|
|
38
39
|
let trackHistory = false;
|
|
39
40
|
const history = [];
|
|
@@ -80,7 +81,7 @@ function parseComment(tokens, config, file, logger, files) {
|
|
|
80
81
|
return comment;
|
|
81
82
|
function warningImpl(message, token) {
|
|
82
83
|
if (config.suppressCommentWarningsInDeclarationFiles &&
|
|
83
|
-
file.fileName
|
|
84
|
+
(0, fs_1.hasDeclarationFileExtension)(file.fileName)) {
|
|
84
85
|
return;
|
|
85
86
|
}
|
|
86
87
|
logger.warn(message, token.pos, file);
|
|
@@ -140,8 +141,8 @@ function parseCommentString(tokens, config, file, logger, files) {
|
|
|
140
141
|
}
|
|
141
142
|
// Check for frontmatter
|
|
142
143
|
let frontmatterData = {};
|
|
143
|
-
const firstBlock = content
|
|
144
|
-
if (firstBlock
|
|
144
|
+
const firstBlock = content.at(0);
|
|
145
|
+
if (firstBlock?.text.startsWith("---\n")) {
|
|
145
146
|
const end = firstBlock.text.indexOf("\n---\n");
|
|
146
147
|
if (end !== -1) {
|
|
147
148
|
const yamlText = firstBlock.text.slice("---\n".length, end);
|
|
@@ -6,6 +6,7 @@ import { ConverterComponent } from "../components";
|
|
|
6
6
|
export declare class ImplementsPlugin extends ConverterComponent {
|
|
7
7
|
private resolved;
|
|
8
8
|
private postponed;
|
|
9
|
+
private revivingSerialized;
|
|
9
10
|
/**
|
|
10
11
|
* Create a new ImplementsPlugin instance.
|
|
11
12
|
*/
|
|
@@ -16,6 +17,7 @@ export declare class ImplementsPlugin extends ConverterComponent {
|
|
|
16
17
|
private analyzeImplements;
|
|
17
18
|
private analyzeInheritance;
|
|
18
19
|
private onResolveEnd;
|
|
20
|
+
private onRevive;
|
|
19
21
|
private resolve;
|
|
20
22
|
private tryResolve;
|
|
21
23
|
private doResolve;
|
|
@@ -28,4 +30,14 @@ export declare class ImplementsPlugin extends ConverterComponent {
|
|
|
28
30
|
* during the resolve step with links which actually point to the right place.
|
|
29
31
|
*/
|
|
30
32
|
private onDeclaration;
|
|
33
|
+
/**
|
|
34
|
+
* Responsible for copying comments from "parent" reflections defined
|
|
35
|
+
* in either a base class or implemented interface to the child class.
|
|
36
|
+
*/
|
|
37
|
+
private handleInheritedComments;
|
|
38
|
+
/**
|
|
39
|
+
* Copy the comment of the source reflection to the target reflection with a JSDoc style copy
|
|
40
|
+
* function. The TSDoc copy function is in the InheritDocPlugin.
|
|
41
|
+
*/
|
|
42
|
+
private copyComment;
|
|
31
43
|
}
|
|
@@ -65,6 +65,7 @@ let ImplementsPlugin = (() => {
|
|
|
65
65
|
super(...arguments);
|
|
66
66
|
this.resolved = new WeakSet();
|
|
67
67
|
this.postponed = new WeakMap();
|
|
68
|
+
this.revivingSerialized = false;
|
|
68
69
|
}
|
|
69
70
|
/**
|
|
70
71
|
* Create a new ImplementsPlugin instance.
|
|
@@ -73,13 +74,13 @@ let ImplementsPlugin = (() => {
|
|
|
73
74
|
this.owner.on(converter_1.Converter.EVENT_RESOLVE_END, this.onResolveEnd.bind(this));
|
|
74
75
|
this.owner.on(converter_1.Converter.EVENT_CREATE_DECLARATION, this.onDeclaration.bind(this), -1000);
|
|
75
76
|
this.owner.on(converter_1.Converter.EVENT_CREATE_SIGNATURE, this.onSignature.bind(this), 1000);
|
|
76
|
-
this.application.on(application_events_1.ApplicationEvents.REVIVE, this.
|
|
77
|
+
this.application.on(application_events_1.ApplicationEvents.REVIVE, this.onRevive.bind(this));
|
|
77
78
|
}
|
|
78
79
|
/**
|
|
79
80
|
* Mark all members of the given class to be the implementation of the matching interface member.
|
|
80
81
|
*/
|
|
81
82
|
analyzeImplements(project, classReflection, interfaceReflection) {
|
|
82
|
-
handleInheritedComments(classReflection, interfaceReflection);
|
|
83
|
+
this.handleInheritedComments(classReflection, interfaceReflection);
|
|
83
84
|
if (!interfaceReflection.children) {
|
|
84
85
|
return;
|
|
85
86
|
}
|
|
@@ -110,7 +111,7 @@ let ImplementsPlugin = (() => {
|
|
|
110
111
|
}
|
|
111
112
|
}
|
|
112
113
|
}
|
|
113
|
-
handleInheritedComments(classMember, interfaceMember);
|
|
114
|
+
this.handleInheritedComments(classMember, interfaceMember);
|
|
114
115
|
});
|
|
115
116
|
}
|
|
116
117
|
analyzeInheritance(project, reflection) {
|
|
@@ -121,7 +122,7 @@ let ImplementsPlugin = (() => {
|
|
|
121
122
|
: void 0;
|
|
122
123
|
});
|
|
123
124
|
for (const parent of extendedTypes) {
|
|
124
|
-
handleInheritedComments(reflection, parent.reflection);
|
|
125
|
+
this.handleInheritedComments(reflection, parent.reflection);
|
|
125
126
|
for (const parentMember of parent.reflection.children ?? []) {
|
|
126
127
|
const child = findMatchingMember(parentMember, reflection);
|
|
127
128
|
if (child) {
|
|
@@ -132,7 +133,7 @@ let ImplementsPlugin = (() => {
|
|
|
132
133
|
childSig[key] = types_1.ReferenceType.createResolvedReference(`${parent.name}.${parentMember.name}`, parentSig, project);
|
|
133
134
|
}
|
|
134
135
|
child[key] = types_1.ReferenceType.createResolvedReference(`${parent.name}.${parentMember.name}`, parentMember, project);
|
|
135
|
-
handleInheritedComments(child, parentMember);
|
|
136
|
+
this.handleInheritedComments(child, parentMember);
|
|
136
137
|
}
|
|
137
138
|
}
|
|
138
139
|
}
|
|
@@ -140,6 +141,11 @@ let ImplementsPlugin = (() => {
|
|
|
140
141
|
onResolveEnd(context) {
|
|
141
142
|
this.resolve(context.project);
|
|
142
143
|
}
|
|
144
|
+
onRevive(project) {
|
|
145
|
+
this.revivingSerialized = true;
|
|
146
|
+
this.resolve(project);
|
|
147
|
+
this.revivingSerialized = false;
|
|
148
|
+
}
|
|
143
149
|
resolve(project) {
|
|
144
150
|
for (const id in project.reflections) {
|
|
145
151
|
const refl = project.reflections[id];
|
|
@@ -262,6 +268,73 @@ let ImplementsPlugin = (() => {
|
|
|
262
268
|
}
|
|
263
269
|
}
|
|
264
270
|
}
|
|
271
|
+
/**
|
|
272
|
+
* Responsible for copying comments from "parent" reflections defined
|
|
273
|
+
* in either a base class or implemented interface to the child class.
|
|
274
|
+
*/
|
|
275
|
+
handleInheritedComments(child, parent) {
|
|
276
|
+
this.copyComment(child, parent);
|
|
277
|
+
if (parent.kindOf(index_1.ReflectionKind.Property) &&
|
|
278
|
+
child.kindOf(index_1.ReflectionKind.Accessor)) {
|
|
279
|
+
if (child.getSignature) {
|
|
280
|
+
this.copyComment(child.getSignature, parent);
|
|
281
|
+
child.getSignature.implementationOf = child.implementationOf;
|
|
282
|
+
}
|
|
283
|
+
if (child.setSignature) {
|
|
284
|
+
this.copyComment(child.setSignature, parent);
|
|
285
|
+
child.setSignature.implementationOf = child.implementationOf;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
if (parent.kindOf(index_1.ReflectionKind.Accessor) &&
|
|
289
|
+
child.kindOf(index_1.ReflectionKind.Accessor)) {
|
|
290
|
+
if (parent.getSignature && child.getSignature) {
|
|
291
|
+
this.copyComment(child.getSignature, parent.getSignature);
|
|
292
|
+
}
|
|
293
|
+
if (parent.setSignature && child.setSignature) {
|
|
294
|
+
this.copyComment(child.setSignature, parent.setSignature);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
if (parent.kindOf(index_1.ReflectionKind.FunctionOrMethod) &&
|
|
298
|
+
parent.signatures &&
|
|
299
|
+
child.signatures) {
|
|
300
|
+
for (const [cs, ps] of (0, array_1.zip)(child.signatures, parent.signatures)) {
|
|
301
|
+
this.copyComment(cs, ps);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
else if (parent.kindOf(index_1.ReflectionKind.Property) &&
|
|
305
|
+
parent.type instanceof types_1.ReflectionType &&
|
|
306
|
+
parent.type.declaration.signatures &&
|
|
307
|
+
child.signatures) {
|
|
308
|
+
for (const [cs, ps] of (0, array_1.zip)(child.signatures, parent.type.declaration.signatures)) {
|
|
309
|
+
this.copyComment(cs, ps);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Copy the comment of the source reflection to the target reflection with a JSDoc style copy
|
|
315
|
+
* function. The TSDoc copy function is in the InheritDocPlugin.
|
|
316
|
+
*/
|
|
317
|
+
copyComment(target, source) {
|
|
318
|
+
if (!shouldCopyComment(target, source, this.revivingSerialized)) {
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
target.comment = source.comment.clone();
|
|
322
|
+
if (target instanceof index_1.DeclarationReflection &&
|
|
323
|
+
source instanceof index_1.DeclarationReflection) {
|
|
324
|
+
for (const [tt, ts] of (0, array_1.zip)(target.typeParameters || [], source.typeParameters || [])) {
|
|
325
|
+
this.copyComment(tt, ts);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
if (target instanceof index_1.SignatureReflection &&
|
|
329
|
+
source instanceof index_1.SignatureReflection) {
|
|
330
|
+
for (const [tt, ts] of (0, array_1.zip)(target.typeParameters || [], source.typeParameters || [])) {
|
|
331
|
+
this.copyComment(tt, ts);
|
|
332
|
+
}
|
|
333
|
+
for (const [pt, ps] of (0, array_1.zip)(target.parameters || [], source.parameters || [])) {
|
|
334
|
+
this.copyComment(pt, ps);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
265
338
|
};
|
|
266
339
|
__setFunctionName(_classThis, "ImplementsPlugin");
|
|
267
340
|
(() => {
|
|
@@ -305,7 +378,9 @@ function createLink(context, reflection, clause, expr, symbol, isInherit) {
|
|
|
305
378
|
link(sig);
|
|
306
379
|
}
|
|
307
380
|
// Intentionally create broken links here. These will be replaced with real links during
|
|
308
|
-
// resolution if we can do so.
|
|
381
|
+
// resolution if we can do so. We create broken links rather than real links because in the
|
|
382
|
+
// case of an inherited symbol, we'll end up referencing a single symbol ID rather than one
|
|
383
|
+
// for each class.
|
|
309
384
|
function link(target) {
|
|
310
385
|
if (!target)
|
|
311
386
|
return;
|
|
@@ -322,79 +397,23 @@ function createLink(context, reflection, clause, expr, symbol, isInherit) {
|
|
|
322
397
|
}
|
|
323
398
|
}
|
|
324
399
|
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
*/
|
|
329
|
-
function handleInheritedComments(child, parent) {
|
|
330
|
-
copyComment(child, parent);
|
|
331
|
-
if (parent.kindOf(index_1.ReflectionKind.Property) &&
|
|
332
|
-
child.kindOf(index_1.ReflectionKind.Accessor)) {
|
|
333
|
-
if (child.getSignature) {
|
|
334
|
-
copyComment(child.getSignature, parent);
|
|
335
|
-
child.getSignature.implementationOf = child.implementationOf;
|
|
336
|
-
}
|
|
337
|
-
if (child.setSignature) {
|
|
338
|
-
copyComment(child.setSignature, parent);
|
|
339
|
-
child.setSignature.implementationOf = child.implementationOf;
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
if (parent.kindOf(index_1.ReflectionKind.Accessor) &&
|
|
343
|
-
child.kindOf(index_1.ReflectionKind.Accessor)) {
|
|
344
|
-
if (parent.getSignature && child.getSignature) {
|
|
345
|
-
copyComment(child.getSignature, parent.getSignature);
|
|
346
|
-
}
|
|
347
|
-
if (parent.setSignature && child.setSignature) {
|
|
348
|
-
copyComment(child.setSignature, parent.setSignature);
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
if (parent.kindOf(index_1.ReflectionKind.FunctionOrMethod) &&
|
|
352
|
-
parent.signatures &&
|
|
353
|
-
child.signatures) {
|
|
354
|
-
for (const [cs, ps] of (0, array_1.zip)(child.signatures, parent.signatures)) {
|
|
355
|
-
copyComment(cs, ps);
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
else if (parent.kindOf(index_1.ReflectionKind.Property) &&
|
|
359
|
-
parent.type instanceof types_1.ReflectionType &&
|
|
360
|
-
parent.type.declaration.signatures &&
|
|
361
|
-
child.signatures) {
|
|
362
|
-
for (const [cs, ps] of (0, array_1.zip)(child.signatures, parent.type.declaration.signatures)) {
|
|
363
|
-
copyComment(cs, ps);
|
|
364
|
-
}
|
|
400
|
+
function shouldCopyComment(target, source, revivingSerialized) {
|
|
401
|
+
if (!source.comment) {
|
|
402
|
+
return false;
|
|
365
403
|
}
|
|
366
|
-
}
|
|
367
|
-
/**
|
|
368
|
-
* Copy the comment of the source reflection to the target reflection with a JSDoc style copy
|
|
369
|
-
* function. The TSDoc copy function is in the InheritDocPlugin.
|
|
370
|
-
*/
|
|
371
|
-
function copyComment(target, source) {
|
|
372
404
|
if (target.comment) {
|
|
405
|
+
// If we're reviving, then the revived project might have a better comment
|
|
406
|
+
// on source, so copy it.
|
|
407
|
+
if (revivingSerialized && source.comment.similarTo(target.comment)) {
|
|
408
|
+
return true;
|
|
409
|
+
}
|
|
373
410
|
// We might still want to copy, if the child has a JSDoc style inheritDoc tag.
|
|
374
411
|
const tag = target.comment.getTag("@inheritDoc");
|
|
375
412
|
if (!tag || tag.name) {
|
|
376
|
-
return;
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
if (!source.comment) {
|
|
380
|
-
return;
|
|
381
|
-
}
|
|
382
|
-
target.comment = source.comment.clone();
|
|
383
|
-
if (target instanceof index_1.DeclarationReflection &&
|
|
384
|
-
source instanceof index_1.DeclarationReflection) {
|
|
385
|
-
for (const [tt, ts] of (0, array_1.zip)(target.typeParameters || [], source.typeParameters || [])) {
|
|
386
|
-
copyComment(tt, ts);
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
if (target instanceof index_1.SignatureReflection &&
|
|
390
|
-
source instanceof index_1.SignatureReflection) {
|
|
391
|
-
for (const [tt, ts] of (0, array_1.zip)(target.typeParameters || [], source.typeParameters || [])) {
|
|
392
|
-
copyComment(tt, ts);
|
|
393
|
-
}
|
|
394
|
-
for (const [pt, ps] of (0, array_1.zip)(target.parameters || [], source.parameters || [])) {
|
|
395
|
-
copyComment(pt, ps);
|
|
413
|
+
return false;
|
|
396
414
|
}
|
|
397
415
|
}
|
|
416
|
+
return true;
|
|
398
417
|
}
|
|
399
418
|
function findMatchingMember(toMatch, container) {
|
|
400
419
|
return container.children?.find((child) => child.name == toMatch.name &&
|
|
@@ -31,7 +31,7 @@ class Internationalization {
|
|
|
31
31
|
(0, assert_1.ok)(/^[A-Za-z-]+$/.test(lang), "Locale names may only contain letters and dashes");
|
|
32
32
|
try {
|
|
33
33
|
return new Map(
|
|
34
|
-
// eslint-disable-next-line @typescript-eslint/no-
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
35
35
|
Object.entries(require(`./locales/${lang}.${ext}`)));
|
|
36
36
|
}
|
|
37
37
|
catch {
|
|
@@ -356,9 +356,7 @@ exports.translatable = {
|
|
|
356
356
|
// Compiler errors here which says a property is missing indicates that the value on translatable
|
|
357
357
|
// is not a literal string. It should be so that TypeDoc's placeholder replacement detection
|
|
358
358
|
// can validate that all placeholders have been specified.
|
|
359
|
-
|
|
360
|
-
_validateLiteralStrings;
|
|
359
|
+
({});
|
|
361
360
|
// Compiler errors here which says a property is missing indicates that the key on translatable
|
|
362
361
|
// contains a placeholder _0/_1, etc. but the value does not match the expected constraint.
|
|
363
|
-
|
|
364
|
-
_validatePlaceholdersPresent;
|
|
362
|
+
exports.translatable;
|
|
@@ -85,7 +85,11 @@ class FileRegistry {
|
|
|
85
85
|
result.entries[key] = (0, utils_1.normalizePath)((0, path_1.relative)(ser.projectRoot, val));
|
|
86
86
|
}
|
|
87
87
|
for (const [key, val] of this.mediaToReflection.entries()) {
|
|
88
|
-
|
|
88
|
+
// A registry may be shared by multiple projects. When serializing,
|
|
89
|
+
// only save reflection mapping for reflections in the serialized project.
|
|
90
|
+
if (ser.project.getReflectionById(val.id)) {
|
|
91
|
+
result.reflections[key] = val.id;
|
|
92
|
+
}
|
|
89
93
|
}
|
|
90
94
|
return result;
|
|
91
95
|
}
|
|
@@ -93,6 +93,12 @@ export declare class CommentTag {
|
|
|
93
93
|
* Create a new CommentTag instance.
|
|
94
94
|
*/
|
|
95
95
|
constructor(tag: `@${string}`, text: CommentDisplayPart[]);
|
|
96
|
+
/**
|
|
97
|
+
* Checks if this block tag is roughly equal to the other tag.
|
|
98
|
+
* This isn't exactly equal, but just "roughly equal" by the tag
|
|
99
|
+
* text.
|
|
100
|
+
*/
|
|
101
|
+
similarTo(other: CommentTag): boolean;
|
|
96
102
|
clone(): CommentTag;
|
|
97
103
|
toObject(serializer: Serializer): JSONOutput.CommentTag;
|
|
98
104
|
fromObject(de: Deserializer, obj: JSONOutput.CommentTag): void;
|
|
@@ -191,6 +197,12 @@ export declare class Comment {
|
|
|
191
197
|
* Creates a new Comment instance.
|
|
192
198
|
*/
|
|
193
199
|
constructor(summary?: CommentDisplayPart[], blockTags?: CommentTag[], modifierTags?: Set<`@${string}`>);
|
|
200
|
+
/**
|
|
201
|
+
* Checks if this comment is roughly equal to the other comment.
|
|
202
|
+
* This isn't exactly equal, but just "roughly equal" by the comment
|
|
203
|
+
* text.
|
|
204
|
+
*/
|
|
205
|
+
similarTo(other: Comment): boolean;
|
|
194
206
|
/**
|
|
195
207
|
* Create a deep clone of this comment.
|
|
196
208
|
*/
|
|
@@ -58,6 +58,17 @@ class CommentTag {
|
|
|
58
58
|
this.tag = tag;
|
|
59
59
|
this.content = text;
|
|
60
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Checks if this block tag is roughly equal to the other tag.
|
|
63
|
+
* This isn't exactly equal, but just "roughly equal" by the tag
|
|
64
|
+
* text.
|
|
65
|
+
*/
|
|
66
|
+
similarTo(other) {
|
|
67
|
+
return (this.tag === other.tag &&
|
|
68
|
+
this.name === other.tag &&
|
|
69
|
+
Comment.combineDisplayParts(this.content) ===
|
|
70
|
+
Comment.combineDisplayParts(other.content));
|
|
71
|
+
}
|
|
61
72
|
clone() {
|
|
62
73
|
const tag = new CommentTag(this.tag, Comment.cloneDisplayParts(this.content));
|
|
63
74
|
if (this.name) {
|
|
@@ -317,6 +328,28 @@ let Comment = (() => {
|
|
|
317
328
|
this.modifierTags = modifierTags;
|
|
318
329
|
extractLabelTag(this);
|
|
319
330
|
}
|
|
331
|
+
/**
|
|
332
|
+
* Checks if this comment is roughly equal to the other comment.
|
|
333
|
+
* This isn't exactly equal, but just "roughly equal" by the comment
|
|
334
|
+
* text.
|
|
335
|
+
*/
|
|
336
|
+
similarTo(other) {
|
|
337
|
+
if (_a.combineDisplayParts(this.summary) !==
|
|
338
|
+
_a.combineDisplayParts(other.summary)) {
|
|
339
|
+
return false;
|
|
340
|
+
}
|
|
341
|
+
// Ignore modifier tags, as they could cause false negatives
|
|
342
|
+
// if a cascaded modifier tag is present in one comment but not the other.
|
|
343
|
+
if (this.blockTags.length !== other.blockTags.length) {
|
|
344
|
+
return false;
|
|
345
|
+
}
|
|
346
|
+
for (let i = 0; i < this.blockTags.length; ++i) {
|
|
347
|
+
if (!this.blockTags[i].similarTo(other.blockTags[i])) {
|
|
348
|
+
return false;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
return true;
|
|
352
|
+
}
|
|
320
353
|
/**
|
|
321
354
|
* Create a deep clone of this comment.
|
|
322
355
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Reflection } from "./abstract";
|
|
2
2
|
import { ContainerReflection } from "./container";
|
|
3
|
+
import { type Type } from "../types";
|
|
3
4
|
import type * as ts from "typescript";
|
|
4
5
|
import { ReflectionKind } from "./kind";
|
|
5
6
|
import { type CommentDisplayPart } from "../comments";
|
|
@@ -64,6 +65,13 @@ export declare class ProjectReflection extends ContainerReflection {
|
|
|
64
65
|
* Should be called for *every* reflection added to the project.
|
|
65
66
|
*/
|
|
66
67
|
registerReflection(reflection: Reflection, symbol: ts.Symbol | undefined, filePath: string | undefined): void;
|
|
68
|
+
/**
|
|
69
|
+
* Removes references to reflections contained within the provided type.
|
|
70
|
+
* Plugins which overwrite types on reflections should pass the type to this
|
|
71
|
+
* method before overwriting the property.
|
|
72
|
+
* @since 0.26.6
|
|
73
|
+
*/
|
|
74
|
+
removeTypeReflections(type: Type | undefined): void;
|
|
67
75
|
/**
|
|
68
76
|
* Removes a reflection from the documentation. Can be used by plugins to filter reflections
|
|
69
77
|
* out of the generated documentation. Has no effect if the reflection is not present in the
|
|
@@ -34,7 +34,7 @@ class ProjectReflection extends container_1.ContainerReflection {
|
|
|
34
34
|
*
|
|
35
35
|
* This may be replaced with a `Map<number, Reflection>` someday.
|
|
36
36
|
*/
|
|
37
|
-
this.reflections = {};
|
|
37
|
+
this.reflections = { [this.id]: this };
|
|
38
38
|
this.reflections[this.id] = this;
|
|
39
39
|
this.files = registry;
|
|
40
40
|
}
|
|
@@ -92,6 +92,19 @@ class ProjectReflection extends container_1.ContainerReflection {
|
|
|
92
92
|
this.files.registerReflection(filePath, reflection);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Removes references to reflections contained within the provided type.
|
|
97
|
+
* Plugins which overwrite types on reflections should pass the type to this
|
|
98
|
+
* method before overwriting the property.
|
|
99
|
+
* @since 0.26.6
|
|
100
|
+
*/
|
|
101
|
+
removeTypeReflections(type) {
|
|
102
|
+
type?.visit((0, types_1.makeRecursiveVisitor)({
|
|
103
|
+
reflection: (type) => {
|
|
104
|
+
this.removeReflection(type.declaration);
|
|
105
|
+
},
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
95
108
|
/**
|
|
96
109
|
* Removes a reflection from the documentation. Can be used by plugins to filter reflections
|
|
97
110
|
* out of the generated documentation. Has no effect if the reflection is not present in the
|
|
@@ -180,10 +180,12 @@ let JavascriptIndexPlugin = (() => {
|
|
|
180
180
|
comments.push(reflection.comment);
|
|
181
181
|
if (reflection.isDeclaration()) {
|
|
182
182
|
reflection.signatures?.forEach((s) => s.comment && comments.push(s.comment));
|
|
183
|
-
reflection.getSignature?.comment
|
|
183
|
+
if (reflection.getSignature?.comment) {
|
|
184
184
|
comments.push(reflection.getSignature.comment);
|
|
185
|
-
|
|
185
|
+
}
|
|
186
|
+
if (reflection.setSignature?.comment) {
|
|
186
187
|
comments.push(reflection.setSignature.comment);
|
|
188
|
+
}
|
|
187
189
|
}
|
|
188
190
|
if (!comments.length) {
|
|
189
191
|
return;
|
|
@@ -258,9 +258,6 @@ class DefaultTheme extends theme_1.Theme {
|
|
|
258
258
|
children,
|
|
259
259
|
};
|
|
260
260
|
}
|
|
261
|
-
if (!element.hasOwnDocument) {
|
|
262
|
-
return;
|
|
263
|
-
}
|
|
264
261
|
return {
|
|
265
262
|
text: (0, lib_1.getDisplayName)(element),
|
|
266
263
|
path: element.url,
|
|
@@ -294,16 +291,26 @@ class DefaultTheme extends theme_1.Theme {
|
|
|
294
291
|
return (0, utils_1.filterMap)(parent.documents, toNavigation);
|
|
295
292
|
}
|
|
296
293
|
if (parent.categories && shouldShowCategories(parent, opts)) {
|
|
297
|
-
return (
|
|
294
|
+
return filterMapWithNoneCollection(parent.categories);
|
|
298
295
|
}
|
|
299
296
|
if (parent.groups && shouldShowGroups(parent, opts)) {
|
|
300
|
-
return (
|
|
297
|
+
return filterMapWithNoneCollection(parent.groups);
|
|
301
298
|
}
|
|
302
299
|
if (opts.includeFolders && parent.childrenIncludingDocuments?.some((child) => child.name.includes("/"))) {
|
|
303
300
|
return deriveModuleFolders(parent.childrenIncludingDocuments);
|
|
304
301
|
}
|
|
305
302
|
return (0, utils_1.filterMap)(parent.childrenIncludingDocuments, toNavigation);
|
|
306
303
|
}
|
|
304
|
+
function filterMapWithNoneCollection(reflection) {
|
|
305
|
+
const none = reflection.find((x) => x.title.toLocaleLowerCase() === "none");
|
|
306
|
+
const others = reflection.filter((x) => x.title.toLocaleLowerCase() !== "none");
|
|
307
|
+
const mappedOthers = (0, utils_1.filterMap)(others, toNavigation);
|
|
308
|
+
if (none) {
|
|
309
|
+
const noneMappedChildren = (0, utils_1.filterMap)(none.children, toNavigation);
|
|
310
|
+
return [...noneMappedChildren, ...mappedOthers];
|
|
311
|
+
}
|
|
312
|
+
return mappedOthers;
|
|
313
|
+
}
|
|
307
314
|
function deriveModuleFolders(children) {
|
|
308
315
|
const result = [];
|
|
309
316
|
const resolveOrCreateParents = (path, root = result) => {
|
|
@@ -336,19 +343,21 @@ class DefaultTheme extends theme_1.Theme {
|
|
|
336
343
|
}
|
|
337
344
|
// Now merge single-possible-paths together so we don't have folders in our navigation
|
|
338
345
|
// which contain only another single folder.
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
346
|
+
if (opts.compactFolders) {
|
|
347
|
+
const queue = [...result];
|
|
348
|
+
while (queue.length) {
|
|
349
|
+
const review = queue.shift();
|
|
350
|
+
queue.push(...(review.children || []));
|
|
351
|
+
if (review.kind || review.path)
|
|
352
|
+
continue;
|
|
353
|
+
if (review.children?.length === 1) {
|
|
354
|
+
const copyFrom = review.children[0];
|
|
355
|
+
const fullName = `${review.text}/${copyFrom.text}`;
|
|
356
|
+
delete review.children;
|
|
357
|
+
Object.assign(review, copyFrom);
|
|
358
|
+
review.text = fullName;
|
|
359
|
+
queue.push(review);
|
|
360
|
+
}
|
|
352
361
|
}
|
|
353
362
|
}
|
|
354
363
|
return result;
|
|
@@ -9,7 +9,7 @@ import type { ModelToObject } from "./schema";
|
|
|
9
9
|
* Additionally, each {@link Serializer} plugin must define a predicate that instructs the group
|
|
10
10
|
* it belongs to.
|
|
11
11
|
*/
|
|
12
|
-
export interface SerializerComponent<T extends
|
|
12
|
+
export interface SerializerComponent<T extends object> {
|
|
13
13
|
/**
|
|
14
14
|
* The priority this serializer should be executed with.
|
|
15
15
|
* A higher priority means the {@link Serializer} will be applied earlier.
|
|
@@ -118,7 +118,6 @@ class Deserializer {
|
|
|
118
118
|
reviveProject(projectObj, name, projectRoot, registry) {
|
|
119
119
|
(0, assert_1.ok)(this.deferred.length === 0, "Deserializer.defer was called when not deserializing");
|
|
120
120
|
const project = new index_1.ProjectReflection(name || projectObj.name, registry);
|
|
121
|
-
project.registerReflection(project, undefined, undefined);
|
|
122
121
|
this.project = project;
|
|
123
122
|
this.projectRoot = projectRoot;
|
|
124
123
|
this.oldIdToNewId = { [projectObj.id]: project.id };
|
|
@@ -23,7 +23,11 @@ export declare class Serializer extends EventDispatcher<SerializerEvents> {
|
|
|
23
23
|
* Only set when serializing.
|
|
24
24
|
*/
|
|
25
25
|
projectRoot: string;
|
|
26
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Only set when serializing
|
|
28
|
+
*/
|
|
29
|
+
project: ProjectReflection;
|
|
30
|
+
addSerializer<T extends object>(serializer: SerializerComponent<T>): void;
|
|
27
31
|
toObject<T extends {
|
|
28
32
|
toObject(serializer: Serializer): ModelToObject<T>;
|
|
29
33
|
}>(value: T): ModelToObject<T>;
|