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
|
@@ -1,9 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
3
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
4
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
5
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
6
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
7
|
+
var _, done = false;
|
|
8
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
9
|
+
var context = {};
|
|
10
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
11
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
12
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
13
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
14
|
+
if (kind === "accessor") {
|
|
15
|
+
if (result === void 0) continue;
|
|
16
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
17
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
18
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
19
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
20
|
+
}
|
|
21
|
+
else if (_ = accept(result)) {
|
|
22
|
+
if (kind === "field") initializers.unshift(_);
|
|
23
|
+
else descriptor[key] = _;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
27
|
+
done = true;
|
|
28
|
+
};
|
|
29
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
30
|
+
var useValue = arguments.length > 2;
|
|
31
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
32
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
33
|
+
}
|
|
34
|
+
return useValue ? value : void 0;
|
|
35
|
+
};
|
|
2
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
37
|
exports.Comment = exports.CommentTag = void 0;
|
|
4
38
|
const utils_1 = require("../../utils");
|
|
5
39
|
const kind_1 = require("../reflections/kind");
|
|
6
40
|
const ReflectionSymbolId_1 = require("../reflections/ReflectionSymbolId");
|
|
41
|
+
const general_1 = require("../../utils/general");
|
|
7
42
|
/**
|
|
8
43
|
* A model that represents a single TypeDoc comment tag.
|
|
9
44
|
*
|
|
@@ -46,321 +81,365 @@ exports.CommentTag = CommentTag;
|
|
|
46
81
|
* through the {@link DeclarationReflection.comment} property.
|
|
47
82
|
* @category Comments
|
|
48
83
|
*/
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
84
|
+
let Comment = (() => {
|
|
85
|
+
var _a;
|
|
86
|
+
let _sourcePath_decorators;
|
|
87
|
+
let _sourcePath_initializers = [];
|
|
88
|
+
let _sourcePath_extraInitializers = [];
|
|
89
|
+
let _discoveryId_decorators;
|
|
90
|
+
let _discoveryId_initializers = [];
|
|
91
|
+
let _discoveryId_extraInitializers = [];
|
|
92
|
+
return _a = class Comment {
|
|
93
|
+
/**
|
|
94
|
+
* Debugging utility for combining parts into a simple string. Not suitable for
|
|
95
|
+
* rendering, but can be useful in tests.
|
|
96
|
+
*/
|
|
97
|
+
static combineDisplayParts(parts) {
|
|
98
|
+
let result = "";
|
|
99
|
+
for (const item of parts || []) {
|
|
100
|
+
switch (item.kind) {
|
|
101
|
+
case "text":
|
|
102
|
+
case "code":
|
|
103
|
+
result += item.text;
|
|
104
|
+
break;
|
|
105
|
+
case "inline-tag":
|
|
106
|
+
result += `{${item.tag} ${item.text}}`;
|
|
107
|
+
break;
|
|
108
|
+
default:
|
|
109
|
+
(0, utils_1.assertNever)(item);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return result;
|
|
67
113
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
114
|
+
/**
|
|
115
|
+
* Helper function to convert an array of comment display parts into markdown suitable for
|
|
116
|
+
* passing into markdown-it.
|
|
117
|
+
* @param urlTo - Used to resolve urls to any reflections linked to with `@link` tags..
|
|
118
|
+
* @param useHtml - If set, will produce `<a>` links which can be colored according to the reflection type they are pointed at.
|
|
119
|
+
*/
|
|
120
|
+
static displayPartsToMarkdown(parts, urlTo, useHtml) {
|
|
121
|
+
const result = [];
|
|
122
|
+
for (const part of parts) {
|
|
123
|
+
switch (part.kind) {
|
|
124
|
+
case "text":
|
|
125
|
+
case "code":
|
|
126
|
+
result.push(part.text);
|
|
127
|
+
break;
|
|
128
|
+
case "inline-tag":
|
|
129
|
+
switch (part.tag) {
|
|
130
|
+
case "@label":
|
|
131
|
+
case "@inheritdoc": // Shouldn't happen
|
|
132
|
+
break; // Not rendered.
|
|
133
|
+
case "@link":
|
|
134
|
+
case "@linkcode":
|
|
135
|
+
case "@linkplain": {
|
|
136
|
+
if (part.target) {
|
|
137
|
+
let url;
|
|
138
|
+
let kindClass;
|
|
139
|
+
if (typeof part.target === "string") {
|
|
140
|
+
url = part.target;
|
|
141
|
+
}
|
|
142
|
+
else if (part.target && "id" in part.target) {
|
|
143
|
+
// No point in trying to resolve a ReflectionSymbolId at this point, we've already
|
|
144
|
+
// tried and failed during the resolution step.
|
|
145
|
+
url = urlTo(part.target);
|
|
146
|
+
kindClass = kind_1.ReflectionKind.classString(part.target.kind);
|
|
147
|
+
}
|
|
148
|
+
if (useHtml) {
|
|
149
|
+
const text = part.tag === "@linkcode"
|
|
150
|
+
? `<code>${part.text}</code>`
|
|
151
|
+
: part.text;
|
|
152
|
+
result.push(url
|
|
153
|
+
? `<a href="${url}"${kindClass
|
|
154
|
+
? ` class="${kindClass}"`
|
|
155
|
+
: ""}>${text}</a>`
|
|
156
|
+
: part.text);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
const text = part.tag === "@linkcode"
|
|
160
|
+
? "`" + part.text + "`"
|
|
161
|
+
: part.text;
|
|
162
|
+
result.push(url ? `[${text}](${url})` : text);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
result.push(part.text);
|
|
167
|
+
}
|
|
168
|
+
break;
|
|
103
169
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
? ` class="${kindClass}"`
|
|
110
|
-
: ""}>${text}</a>`
|
|
111
|
-
: part.text);
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
result.push(part.text);
|
|
170
|
+
default:
|
|
171
|
+
// Hmm... probably want to be able to render these somehow, so custom inline tags can be given
|
|
172
|
+
// special rendering rules. Future capability. For now, just render their text.
|
|
173
|
+
result.push(`{${part.tag} ${part.text}}`);
|
|
174
|
+
break;
|
|
115
175
|
}
|
|
116
176
|
break;
|
|
117
|
-
}
|
|
118
177
|
default:
|
|
119
|
-
|
|
120
|
-
// special rendering rules. Future capability. For now, just render their text.
|
|
121
|
-
result.push(`{${part.tag} ${part.text}}`);
|
|
122
|
-
break;
|
|
178
|
+
(0, utils_1.assertNever)(part);
|
|
123
179
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
(0, utils_1.assertNever)(part);
|
|
180
|
+
}
|
|
181
|
+
return result.join("");
|
|
127
182
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
183
|
+
/**
|
|
184
|
+
* Helper utility to clone {@link Comment.summary} or {@link CommentTag.content}
|
|
185
|
+
*/
|
|
186
|
+
static cloneDisplayParts(parts) {
|
|
187
|
+
return parts.map((p) => ({ ...p }));
|
|
188
|
+
}
|
|
189
|
+
static serializeDisplayParts(serializer, parts) {
|
|
190
|
+
return parts?.map((part) => {
|
|
191
|
+
switch (part.kind) {
|
|
192
|
+
case "text":
|
|
193
|
+
case "code":
|
|
194
|
+
return { ...part };
|
|
195
|
+
case "inline-tag": {
|
|
196
|
+
let target;
|
|
197
|
+
if (typeof part.target === "string") {
|
|
198
|
+
target = part.target;
|
|
199
|
+
}
|
|
200
|
+
else if (part.target) {
|
|
201
|
+
if ("id" in part.target) {
|
|
202
|
+
target = part.target.id;
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
target = part.target.toObject(serializer);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return {
|
|
209
|
+
...part,
|
|
210
|
+
target,
|
|
211
|
+
};
|
|
212
|
+
}
|
|
147
213
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
//Since display parts are plain objects, this lives here
|
|
217
|
+
static deserializeDisplayParts(de, parts) {
|
|
218
|
+
const links = [];
|
|
219
|
+
const result = parts.map((part) => {
|
|
220
|
+
switch (part.kind) {
|
|
221
|
+
case "text":
|
|
222
|
+
case "code":
|
|
223
|
+
return { ...part };
|
|
224
|
+
case "inline-tag": {
|
|
225
|
+
if (typeof part.target === "number") {
|
|
226
|
+
const part2 = {
|
|
227
|
+
kind: part.kind,
|
|
228
|
+
tag: part.tag,
|
|
229
|
+
text: part.text,
|
|
230
|
+
target: undefined,
|
|
231
|
+
tsLinkText: part.tsLinkText,
|
|
232
|
+
};
|
|
233
|
+
links.push([part.target, part2]);
|
|
234
|
+
return part2;
|
|
235
|
+
}
|
|
236
|
+
else if (typeof part.target === "string" ||
|
|
237
|
+
part.target === undefined) {
|
|
238
|
+
return {
|
|
239
|
+
kind: "inline-tag",
|
|
240
|
+
tag: part.tag,
|
|
241
|
+
text: part.text,
|
|
242
|
+
target: part.target,
|
|
243
|
+
tsLinkText: part.tsLinkText,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
else if (typeof part.target === "object") {
|
|
247
|
+
return {
|
|
248
|
+
kind: "inline-tag",
|
|
249
|
+
tag: part.tag,
|
|
250
|
+
text: part.text,
|
|
251
|
+
target: new ReflectionSymbolId_1.ReflectionSymbolId(part.target),
|
|
252
|
+
tsLinkText: part.tsLinkText,
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
(0, utils_1.assertNever)(part.target);
|
|
257
|
+
}
|
|
151
258
|
}
|
|
152
|
-
|
|
153
|
-
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
if (links.length) {
|
|
262
|
+
de.defer((project) => {
|
|
263
|
+
for (const [oldId, part] of links) {
|
|
264
|
+
part.target = project.getReflectionById(de.oldIdToNewId[oldId] ?? -1);
|
|
265
|
+
if (!part.target) {
|
|
266
|
+
de.logger.warn(de.application.i18n.serialized_project_referenced_0_not_part_of_project(oldId.toString()));
|
|
267
|
+
}
|
|
154
268
|
}
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
return result;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Splits the provided parts into a header (first line, as a string)
|
|
275
|
+
* and body (remaining lines). If the header line contains inline tags
|
|
276
|
+
* they will be serialized to a string.
|
|
277
|
+
*/
|
|
278
|
+
static splitPartsToHeaderAndBody(parts) {
|
|
279
|
+
let index = parts.findIndex((part) => {
|
|
280
|
+
switch (part.kind) {
|
|
281
|
+
case "text":
|
|
282
|
+
case "code":
|
|
283
|
+
return part.text.includes("\n");
|
|
284
|
+
case "inline-tag":
|
|
285
|
+
return false;
|
|
155
286
|
}
|
|
287
|
+
});
|
|
288
|
+
if (index === -1) {
|
|
156
289
|
return {
|
|
157
|
-
|
|
158
|
-
|
|
290
|
+
header: _a.combineDisplayParts(parts),
|
|
291
|
+
body: [],
|
|
159
292
|
};
|
|
160
293
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
//Since display parts are plain objects, this lives here
|
|
165
|
-
static deserializeDisplayParts(de, parts) {
|
|
166
|
-
const links = [];
|
|
167
|
-
const result = parts.map((part) => {
|
|
168
|
-
switch (part.kind) {
|
|
169
|
-
case "text":
|
|
170
|
-
case "code":
|
|
171
|
-
return { ...part };
|
|
172
|
-
case "inline-tag": {
|
|
173
|
-
if (typeof part.target === "number") {
|
|
174
|
-
const part2 = {
|
|
175
|
-
kind: part.kind,
|
|
176
|
-
tag: part.tag,
|
|
177
|
-
text: part.text,
|
|
178
|
-
target: undefined,
|
|
179
|
-
tsLinkText: part.tsLinkText,
|
|
180
|
-
};
|
|
181
|
-
links.push([part.target, part2]);
|
|
182
|
-
return part2;
|
|
183
|
-
}
|
|
184
|
-
else if (typeof part.target === "string" ||
|
|
185
|
-
part.target === undefined) {
|
|
186
|
-
return {
|
|
187
|
-
kind: "inline-tag",
|
|
188
|
-
tag: part.tag,
|
|
189
|
-
text: part.text,
|
|
190
|
-
target: part.target,
|
|
191
|
-
tsLinkText: part.tsLinkText,
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
else if (typeof part.target === "object") {
|
|
195
|
-
return {
|
|
196
|
-
kind: "inline-tag",
|
|
197
|
-
tag: part.tag,
|
|
198
|
-
text: part.text,
|
|
199
|
-
target: new ReflectionSymbolId_1.ReflectionSymbolId(part.target),
|
|
200
|
-
tsLinkText: part.tsLinkText,
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
else {
|
|
204
|
-
(0, utils_1.assertNever)(part.target);
|
|
205
|
-
}
|
|
294
|
+
// Do not split a code block, stop the header at the end of the previous block
|
|
295
|
+
if (parts[index].kind === "code") {
|
|
296
|
+
--index;
|
|
206
297
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
if (links.length) {
|
|
210
|
-
de.defer((project) => {
|
|
211
|
-
for (const [oldId, part] of links) {
|
|
212
|
-
part.target = project.getReflectionById(de.oldIdToNewId[oldId] ?? -1);
|
|
213
|
-
if (!part.target) {
|
|
214
|
-
de.logger.warn(`Serialized project contained a link to ${oldId} (${part.text}), which was not a part of the project.`);
|
|
215
|
-
}
|
|
298
|
+
if (index === -1) {
|
|
299
|
+
return { header: "", body: _a.cloneDisplayParts(parts) };
|
|
216
300
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
return false;
|
|
301
|
+
let header = _a.combineDisplayParts(parts.slice(0, index));
|
|
302
|
+
const split = parts[index].text.indexOf("\n");
|
|
303
|
+
let body;
|
|
304
|
+
if (split === -1) {
|
|
305
|
+
header += parts[index].text;
|
|
306
|
+
body = _a.cloneDisplayParts(parts.slice(index + 1));
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
header += parts[index].text.substring(0, split);
|
|
310
|
+
body = _a.cloneDisplayParts(parts.slice(index));
|
|
311
|
+
body[0].text = body[0].text.substring(split + 1);
|
|
312
|
+
}
|
|
313
|
+
if (!body[0].text) {
|
|
314
|
+
body.shift();
|
|
315
|
+
}
|
|
316
|
+
return { header: header.trim(), body };
|
|
234
317
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
obj.
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
this.modifierTags = new Set(obj.modifierTags);
|
|
361
|
-
this.label = obj.label;
|
|
362
|
-
}
|
|
363
|
-
}
|
|
318
|
+
/**
|
|
319
|
+
* Creates a new Comment instance.
|
|
320
|
+
*/
|
|
321
|
+
constructor(summary = [], blockTags = [], modifierTags = new Set()) {
|
|
322
|
+
/**
|
|
323
|
+
* All associated block level tags.
|
|
324
|
+
*/
|
|
325
|
+
this.blockTags = [];
|
|
326
|
+
/**
|
|
327
|
+
* All modifier tags present on the comment, e.g. `@alpha`, `@beta`.
|
|
328
|
+
*/
|
|
329
|
+
this.modifierTags = new Set();
|
|
330
|
+
/**
|
|
331
|
+
* Full path to the file where this comment originated from, if any.
|
|
332
|
+
* This field will not be serialized, so will not be present when handling JSON-revived reflections.
|
|
333
|
+
*
|
|
334
|
+
* Note: This field is non-enumerable to make testing comment contents with `deepEqual` easier.
|
|
335
|
+
*/
|
|
336
|
+
this.sourcePath = __runInitializers(this, _sourcePath_initializers, void 0);
|
|
337
|
+
/**
|
|
338
|
+
* Internal discovery ID used to prevent symbol comments from
|
|
339
|
+
* being duplicated on signatures. Only set when the comment was created
|
|
340
|
+
* @internal
|
|
341
|
+
*/
|
|
342
|
+
this.discoveryId = (__runInitializers(this, _sourcePath_extraInitializers), __runInitializers(this, _discoveryId_initializers, void 0));
|
|
343
|
+
__runInitializers(this, _discoveryId_extraInitializers);
|
|
344
|
+
this.summary = summary;
|
|
345
|
+
this.blockTags = blockTags;
|
|
346
|
+
this.modifierTags = modifierTags;
|
|
347
|
+
extractLabelTag(this);
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Create a deep clone of this comment.
|
|
351
|
+
*/
|
|
352
|
+
clone() {
|
|
353
|
+
const comment = new _a(_a.cloneDisplayParts(this.summary), this.blockTags.map((tag) => tag.clone()), new Set(this.modifierTags));
|
|
354
|
+
comment.discoveryId = this.discoveryId;
|
|
355
|
+
comment.sourcePath = this.sourcePath;
|
|
356
|
+
return comment;
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Returns true if this comment is completely empty.
|
|
360
|
+
* @internal
|
|
361
|
+
*/
|
|
362
|
+
isEmpty() {
|
|
363
|
+
return !this.hasVisibleComponent() && this.modifierTags.size === 0;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Has this comment a visible component?
|
|
367
|
+
*
|
|
368
|
+
* @returns TRUE when this comment has a visible component.
|
|
369
|
+
*/
|
|
370
|
+
hasVisibleComponent() {
|
|
371
|
+
return (this.summary.some((x) => x.kind !== "text" || x.text !== "") ||
|
|
372
|
+
this.blockTags.length > 0);
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Test whether this comment contains a tag with the given name.
|
|
376
|
+
*
|
|
377
|
+
* @param tagName The name of the tag to look for.
|
|
378
|
+
* @returns TRUE when this comment contains a tag with the given name, otherwise FALSE.
|
|
379
|
+
*/
|
|
380
|
+
hasModifier(tagName) {
|
|
381
|
+
return this.modifierTags.has(tagName);
|
|
382
|
+
}
|
|
383
|
+
removeModifier(tagName) {
|
|
384
|
+
this.modifierTags.delete(tagName);
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Return the first tag with the given name.
|
|
388
|
+
*
|
|
389
|
+
* @param tagName The name of the tag to look for.
|
|
390
|
+
* @returns The found tag or undefined.
|
|
391
|
+
*/
|
|
392
|
+
getTag(tagName) {
|
|
393
|
+
return this.blockTags.find((tag) => tag.tag === tagName);
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Get all tags with the given tag name.
|
|
397
|
+
*/
|
|
398
|
+
getTags(tagName) {
|
|
399
|
+
return this.blockTags.filter((tag) => tag.tag === tagName);
|
|
400
|
+
}
|
|
401
|
+
getIdentifiedTag(identifier, tagName) {
|
|
402
|
+
return this.blockTags.find((tag) => tag.tag === tagName && tag.name === identifier);
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Removes all block tags with the given tag name from the comment.
|
|
406
|
+
* @param tagName
|
|
407
|
+
*/
|
|
408
|
+
removeTags(tagName) {
|
|
409
|
+
(0, utils_1.removeIf)(this.blockTags, (tag) => tag.tag === tagName);
|
|
410
|
+
}
|
|
411
|
+
toObject(serializer) {
|
|
412
|
+
return {
|
|
413
|
+
summary: _a.serializeDisplayParts(serializer, this.summary),
|
|
414
|
+
blockTags: serializer.toObjectsOptional(this.blockTags),
|
|
415
|
+
modifierTags: this.modifierTags.size > 0
|
|
416
|
+
? Array.from(this.modifierTags)
|
|
417
|
+
: undefined,
|
|
418
|
+
label: this.label,
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
fromObject(de, obj) {
|
|
422
|
+
this.summary = _a.deserializeDisplayParts(de, obj.summary);
|
|
423
|
+
this.blockTags =
|
|
424
|
+
obj.blockTags?.map((tagObj) => {
|
|
425
|
+
const tag = new CommentTag(tagObj.tag, []);
|
|
426
|
+
de.fromObject(tag, tagObj);
|
|
427
|
+
return tag;
|
|
428
|
+
}) || [];
|
|
429
|
+
this.modifierTags = new Set(obj.modifierTags);
|
|
430
|
+
this.label = obj.label;
|
|
431
|
+
}
|
|
432
|
+
},
|
|
433
|
+
(() => {
|
|
434
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
435
|
+
_sourcePath_decorators = [general_1.NonEnumerable];
|
|
436
|
+
_discoveryId_decorators = [general_1.NonEnumerable];
|
|
437
|
+
__esDecorate(null, null, _sourcePath_decorators, { kind: "field", name: "sourcePath", static: false, private: false, access: { has: obj => "sourcePath" in obj, get: obj => obj.sourcePath, set: (obj, value) => { obj.sourcePath = value; } }, metadata: _metadata }, _sourcePath_initializers, _sourcePath_extraInitializers);
|
|
438
|
+
__esDecorate(null, null, _discoveryId_decorators, { kind: "field", name: "discoveryId", static: false, private: false, access: { has: obj => "discoveryId" in obj, get: obj => obj.discoveryId, set: (obj, value) => { obj.discoveryId = value; } }, metadata: _metadata }, _discoveryId_initializers, _discoveryId_extraInitializers);
|
|
439
|
+
if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
440
|
+
})(),
|
|
441
|
+
_a;
|
|
442
|
+
})();
|
|
364
443
|
exports.Comment = Comment;
|
|
365
444
|
function extractLabelTag(comment) {
|
|
366
445
|
const index = comment.summary.findIndex((part) => part.kind === "inline-tag" && part.tag === "@label");
|