typedoc 0.23.26 → 0.24.0-beta.1
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/bin/typedoc +1 -130
- package/dist/index.d.ts +4 -5
- package/dist/index.js +15 -5
- package/dist/lib/application-events.d.ts +1 -1
- package/dist/lib/application-events.js +1 -1
- package/dist/lib/application.d.ts +24 -13
- package/dist/lib/application.js +136 -69
- package/dist/lib/cli.d.ts +1 -0
- package/dist/lib/cli.js +129 -0
- package/dist/lib/converter/comments/declarationReference.d.ts +1 -1
- package/dist/lib/converter/comments/declarationReferenceResolver.js +11 -5
- package/dist/lib/converter/comments/discovery.d.ts +1 -1
- package/dist/lib/converter/comments/discovery.js +96 -76
- package/dist/lib/converter/comments/index.d.ts +1 -1
- package/dist/lib/converter/comments/index.js +41 -21
- package/dist/lib/converter/comments/linkResolver.d.ts +2 -8
- package/dist/lib/converter/comments/linkResolver.js +42 -145
- package/dist/lib/converter/context.d.ts +1 -1
- package/dist/lib/converter/context.js +27 -14
- package/dist/lib/converter/convert-expression.d.ts +1 -1
- package/dist/lib/converter/convert-expression.js +35 -15
- package/dist/lib/converter/converter.d.ts +4 -6
- package/dist/lib/converter/converter.js +38 -27
- package/dist/lib/converter/factories/index-signature.d.ts +1 -1
- package/dist/lib/converter/factories/index-signature.js +26 -3
- package/dist/lib/converter/factories/signature.d.ts +2 -2
- package/dist/lib/converter/factories/signature.js +76 -52
- package/dist/lib/converter/index.d.ts +0 -1
- package/dist/lib/converter/jsdoc.d.ts +1 -1
- package/dist/lib/converter/jsdoc.js +39 -17
- package/dist/lib/converter/plugins/CommentPlugin.d.ts +0 -2
- package/dist/lib/converter/plugins/CommentPlugin.js +7 -28
- package/dist/lib/converter/plugins/GroupPlugin.d.ts +1 -39
- package/dist/lib/converter/plugins/GroupPlugin.js +3 -61
- package/dist/lib/converter/plugins/ImplementsPlugin.d.ts +1 -4
- package/dist/lib/converter/plugins/ImplementsPlugin.js +49 -28
- package/dist/lib/converter/plugins/InheritDocPlugin.d.ts +0 -3
- package/dist/lib/converter/plugins/InheritDocPlugin.js +6 -7
- package/dist/lib/converter/plugins/LinkResolverPlugin.d.ts +2 -3
- package/dist/lib/converter/plugins/LinkResolverPlugin.js +12 -18
- package/dist/lib/converter/plugins/PackagePlugin.d.ts +5 -14
- package/dist/lib/converter/plugins/PackagePlugin.js +44 -56
- package/dist/lib/converter/plugins/SourcePlugin.js +31 -6
- package/dist/lib/converter/plugins/TypePlugin.d.ts +4 -10
- package/dist/lib/converter/plugins/TypePlugin.js +23 -13
- package/dist/lib/converter/symbols.d.ts +1 -1
- package/dist/lib/converter/symbols.js +153 -132
- package/dist/lib/converter/types.d.ts +1 -1
- package/dist/lib/converter/types.js +121 -95
- package/dist/lib/converter/utils/nodes.d.ts +1 -1
- package/dist/lib/converter/utils/nodes.js +24 -4
- package/dist/lib/converter/utils/symbols.d.ts +1 -1
- package/dist/lib/converter/utils/symbols.js +24 -4
- package/dist/lib/models/ReflectionCategory.d.ts +2 -1
- package/dist/lib/models/ReflectionCategory.js +12 -0
- package/dist/lib/models/ReflectionGroup.d.ts +3 -2
- package/dist/lib/models/ReflectionGroup.js +20 -0
- package/dist/lib/models/comments/comment.d.ts +12 -7
- package/dist/lib/models/comments/comment.js +77 -64
- package/dist/lib/models/reflections/ReflectionSymbolId.d.ts +29 -0
- package/dist/lib/models/reflections/ReflectionSymbolId.js +94 -0
- package/dist/lib/models/reflections/abstract.d.ts +12 -37
- package/dist/lib/models/reflections/abstract.js +27 -35
- package/dist/lib/models/reflections/container.d.ts +6 -10
- package/dist/lib/models/reflections/container.js +8 -1
- package/dist/lib/models/reflections/declaration.d.ts +19 -4
- package/dist/lib/models/reflections/declaration.js +54 -1
- package/dist/lib/models/reflections/index.d.ts +2 -0
- package/dist/lib/models/reflections/index.js +3 -1
- package/dist/lib/models/reflections/kind.d.ts +15 -1
- package/dist/lib/models/reflections/kind.js +43 -1
- package/dist/lib/models/reflections/parameter.d.ts +3 -1
- package/dist/lib/models/reflections/parameter.js +10 -0
- package/dist/lib/models/reflections/project.d.ts +32 -5
- package/dist/lib/models/reflections/project.js +84 -20
- package/dist/lib/models/reflections/reference.d.ts +5 -9
- package/dist/lib/models/reflections/reference.js +13 -29
- package/dist/lib/models/reflections/signature.d.ts +8 -1
- package/dist/lib/models/reflections/signature.js +14 -0
- package/dist/lib/models/reflections/type-parameter.d.ts +7 -4
- package/dist/lib/models/reflections/type-parameter.js +9 -3
- package/dist/lib/models/reflections/variant.d.ts +18 -0
- package/dist/lib/models/reflections/variant.js +2 -0
- package/dist/lib/models/sources/file.d.ts +2 -0
- package/dist/lib/models/sources/file.js +3 -0
- package/dist/lib/models/types.d.ts +24 -20
- package/dist/lib/models/types.js +132 -33
- package/dist/lib/output/plugins/JavascriptIndexPlugin.js +3 -7
- package/dist/lib/output/renderer.d.ts +21 -14
- package/dist/lib/output/renderer.js +25 -25
- package/dist/lib/output/themes/MarkedPlugin.js +2 -3
- package/dist/lib/output/themes/default/DefaultTheme.d.ts +2 -20
- package/dist/lib/output/themes/default/DefaultTheme.js +4 -75
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +10 -9
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +55 -1
- package/dist/lib/output/themes/default/partials/header.js +2 -5
- package/dist/lib/output/themes/default/partials/index.js +2 -2
- package/dist/lib/output/themes/default/partials/member.getterSetter.d.ts +2 -2
- package/dist/lib/output/themes/default/partials/member.getterSetter.js +4 -1
- package/dist/lib/output/themes/default/partials/member.js +1 -1
- package/dist/lib/output/themes/default/partials/member.signatures.js +2 -1
- package/dist/lib/output/themes/default/partials/members.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/members.js +3 -1
- package/dist/lib/output/themes/default/partials/navigation.js +6 -4
- package/dist/lib/output/themes/default/partials/parameter.js +1 -1
- package/dist/lib/output/themes/default/partials/type.js +4 -4
- package/dist/lib/output/themes/default/templates/reflection.js +1 -1
- package/dist/lib/output/themes/lib.d.ts +4 -1
- package/dist/lib/output/themes/lib.js +53 -3
- package/dist/lib/serialization/deserializer.d.ts +54 -0
- package/dist/lib/serialization/deserializer.js +212 -0
- package/dist/lib/serialization/events.d.ts +0 -15
- package/dist/lib/serialization/index.d.ts +2 -3
- package/dist/lib/serialization/index.js +4 -3
- package/dist/lib/serialization/schema.d.ts +23 -17
- package/dist/lib/serialization/serializer.d.ts +5 -5
- package/dist/lib/serialization/serializer.js +4 -15
- package/dist/lib/utils/array.d.ts +0 -1
- package/dist/lib/utils/array.js +1 -2
- package/dist/lib/utils/entry-point.d.ts +15 -4
- package/dist/lib/utils/entry-point.js +45 -28
- package/dist/lib/utils/enum.d.ts +4 -1
- package/dist/lib/utils/enum.js +2 -3
- package/dist/lib/utils/fs.d.ts +3 -1
- package/dist/lib/utils/fs.js +36 -73
- package/dist/lib/utils/index.d.ts +4 -3
- package/dist/lib/utils/index.js +3 -3
- package/dist/lib/utils/loggers.d.ts +5 -26
- package/dist/lib/utils/loggers.js +38 -42
- package/dist/lib/utils/map.d.ts +17 -0
- package/dist/lib/utils/map.js +49 -1
- package/dist/lib/utils/options/declaration.d.ts +20 -6
- package/dist/lib/utils/options/help.js +1 -1
- package/dist/lib/utils/options/options.d.ts +27 -18
- package/dist/lib/utils/options/options.js +68 -14
- package/dist/lib/utils/options/readers/arguments.d.ts +2 -1
- package/dist/lib/utils/options/readers/arguments.js +9 -2
- package/dist/lib/utils/options/readers/tsconfig.d.ts +3 -7
- package/dist/lib/utils/options/readers/tsconfig.js +35 -36
- package/dist/lib/utils/options/readers/typedoc.d.ts +4 -5
- package/dist/lib/utils/options/readers/typedoc.js +9 -21
- package/dist/lib/utils/options/sources/typedoc.js +18 -64
- package/dist/lib/utils/package-manifest.js +1 -2
- package/dist/lib/utils/paths.js +2 -0
- package/dist/lib/utils/plugins.d.ts +1 -2
- package/dist/lib/utils/plugins.js +22 -106
- package/dist/lib/utils/sort.d.ts +1 -1
- package/dist/lib/utils/sort.js +8 -11
- package/dist/lib/utils/tsconfig.d.ts +4 -0
- package/dist/lib/utils/tsconfig.js +36 -0
- package/dist/lib/utils/tsutils.d.ts +3 -2
- package/dist/lib/utils/tsutils.js +46 -12
- package/dist/lib/validation/documentation.d.ts +1 -1
- package/dist/lib/validation/documentation.js +6 -29
- package/dist/lib/validation/exports.js +18 -21
- package/dist/lib/validation/links.js +1 -1
- package/package.json +18 -19
- package/static/main.js +1 -55
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Deserializer = void 0;
|
|
4
|
+
const assert_1 = require("assert");
|
|
5
|
+
const index_1 = require("../models/index");
|
|
6
|
+
const array_1 = require("../utils/array");
|
|
7
|
+
class Deserializer {
|
|
8
|
+
constructor(app) {
|
|
9
|
+
this.app = app;
|
|
10
|
+
this.deferred = [];
|
|
11
|
+
this.deserializers = [];
|
|
12
|
+
this.activeReflection = [];
|
|
13
|
+
this.reflectionBuilders = {
|
|
14
|
+
declaration(parent, obj) {
|
|
15
|
+
return new index_1.DeclarationReflection(obj.name, obj.kind, parent);
|
|
16
|
+
},
|
|
17
|
+
param(parent, obj) {
|
|
18
|
+
return new index_1.ParameterReflection(obj.name, obj.kind, parent);
|
|
19
|
+
},
|
|
20
|
+
project() {
|
|
21
|
+
throw new Error("Not supported, use Deserializer.reviveProject(s) instead.");
|
|
22
|
+
},
|
|
23
|
+
reference(parent, obj) {
|
|
24
|
+
// Ugly, but we don't have a reference yet!
|
|
25
|
+
return new index_1.ReferenceReflection(obj.name,
|
|
26
|
+
/* target */ parent, parent);
|
|
27
|
+
},
|
|
28
|
+
signature(parent, obj) {
|
|
29
|
+
return new index_1.SignatureReflection(obj.name, obj.kind, parent);
|
|
30
|
+
},
|
|
31
|
+
typeParam(parent, obj) {
|
|
32
|
+
return new index_1.TypeParameterReflection(obj.name, parent, void 0);
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
this.typeBuilders = {
|
|
36
|
+
array(obj, de) {
|
|
37
|
+
return new index_1.ArrayType(de.reviveType(obj.elementType));
|
|
38
|
+
},
|
|
39
|
+
conditional(obj, de) {
|
|
40
|
+
return new index_1.ConditionalType(de.reviveType(obj.checkType), de.reviveType(obj.extendsType), de.reviveType(obj.trueType), de.reviveType(obj.falseType));
|
|
41
|
+
},
|
|
42
|
+
indexedAccess(obj, de) {
|
|
43
|
+
return new index_1.IndexedAccessType(de.reviveType(obj.objectType), de.reviveType(obj.indexType));
|
|
44
|
+
},
|
|
45
|
+
inferred(obj, de) {
|
|
46
|
+
return new index_1.InferredType(obj.name, de.reviveType(obj.constraint));
|
|
47
|
+
},
|
|
48
|
+
intersection(obj, de) {
|
|
49
|
+
return new index_1.IntersectionType(obj.types.map((t) => de.reviveType(t)));
|
|
50
|
+
},
|
|
51
|
+
intrinsic(obj) {
|
|
52
|
+
return new index_1.IntrinsicType(obj.name);
|
|
53
|
+
},
|
|
54
|
+
literal(obj) {
|
|
55
|
+
if (obj.value && typeof obj.value === "object") {
|
|
56
|
+
return new index_1.LiteralType(BigInt(`${obj.value.negative ? "-" : ""}${obj.value.value}`));
|
|
57
|
+
}
|
|
58
|
+
return new index_1.LiteralType(obj.value);
|
|
59
|
+
},
|
|
60
|
+
mapped(obj, de) {
|
|
61
|
+
return new index_1.MappedType(obj.parameter, de.reviveType(obj.parameterType), de.reviveType(obj.templateType), obj.readonlyModifier, obj.optionalModifier, de.reviveType(obj.nameType));
|
|
62
|
+
},
|
|
63
|
+
optional(obj, de) {
|
|
64
|
+
return new index_1.OptionalType(de.reviveType(obj.elementType));
|
|
65
|
+
},
|
|
66
|
+
predicate(obj, de) {
|
|
67
|
+
return new index_1.PredicateType(obj.name, obj.asserts, de.reviveType(obj.targetType));
|
|
68
|
+
},
|
|
69
|
+
query(obj, de) {
|
|
70
|
+
return new index_1.QueryType(de.reviveType(obj.queryType));
|
|
71
|
+
},
|
|
72
|
+
reference(obj) {
|
|
73
|
+
// Correct reference will be restored in fromObject
|
|
74
|
+
return index_1.ReferenceType.createResolvedReference(obj.name, -2, null);
|
|
75
|
+
},
|
|
76
|
+
reflection(obj, de) {
|
|
77
|
+
return new index_1.ReflectionType(de.revive(obj.declaration, (o) => de.constructReflection(o)));
|
|
78
|
+
},
|
|
79
|
+
rest(obj, de) {
|
|
80
|
+
return new index_1.RestType(de.reviveType(obj.elementType));
|
|
81
|
+
},
|
|
82
|
+
templateLiteral(obj, de) {
|
|
83
|
+
return new index_1.TemplateLiteralType(obj.head, obj.tail.map(([t, s]) => [de.reviveType(t), s]));
|
|
84
|
+
},
|
|
85
|
+
tuple(obj, de) {
|
|
86
|
+
return new index_1.TupleType(obj.elements?.map((t) => de.reviveType(t)) || []);
|
|
87
|
+
},
|
|
88
|
+
namedTupleMember(obj, de) {
|
|
89
|
+
return new index_1.NamedTupleMember(obj.name, obj.isOptional, de.reviveType(obj.element));
|
|
90
|
+
},
|
|
91
|
+
typeOperator(obj, de) {
|
|
92
|
+
return new index_1.TypeOperatorType(de.reviveType(obj.target), obj.operator);
|
|
93
|
+
},
|
|
94
|
+
union(obj, de) {
|
|
95
|
+
return new index_1.UnionType(obj.types.map((t) => de.reviveType(t)));
|
|
96
|
+
},
|
|
97
|
+
unknown(obj) {
|
|
98
|
+
return new index_1.UnknownType(obj.name);
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
this.oldIdToNewId = {};
|
|
102
|
+
}
|
|
103
|
+
get logger() {
|
|
104
|
+
return this.app.logger;
|
|
105
|
+
}
|
|
106
|
+
addDeserializer(de) {
|
|
107
|
+
(0, array_1.insertPrioritySorted)(this.deserializers, de);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Revive a single project into the structure it was originally created with.
|
|
111
|
+
* This is generally not appropriate for merging multiple projects since projects may
|
|
112
|
+
* contain reflections in their root, not inside a module.
|
|
113
|
+
*/
|
|
114
|
+
reviveProject(projectObj, name) {
|
|
115
|
+
(0, assert_1.ok)(this.deferred.length === 0, "Deserializer.defer was called when not deserializing");
|
|
116
|
+
const project = new index_1.ProjectReflection(name || projectObj.name);
|
|
117
|
+
project.registerReflection(project);
|
|
118
|
+
this.project = project;
|
|
119
|
+
this.oldIdToNewId = { [projectObj.id]: project.id };
|
|
120
|
+
this.fromObject(project, projectObj);
|
|
121
|
+
const deferred = this.deferred;
|
|
122
|
+
this.deferred = [];
|
|
123
|
+
for (const def of deferred) {
|
|
124
|
+
def(project);
|
|
125
|
+
}
|
|
126
|
+
(0, assert_1.ok)(this.deferred.length === 0, "Work may not be double deferred when deserializing.");
|
|
127
|
+
(0, assert_1.ok)(this.activeReflection.length === 0, "Imbalanced reflection deserialization");
|
|
128
|
+
this.project = undefined;
|
|
129
|
+
this.oldIdToNewId = {};
|
|
130
|
+
return project;
|
|
131
|
+
}
|
|
132
|
+
reviveProjects(name, projects) {
|
|
133
|
+
if (projects.length === 1) {
|
|
134
|
+
return this.reviveProject(projects[0], name);
|
|
135
|
+
}
|
|
136
|
+
const project = new index_1.ProjectReflection(name);
|
|
137
|
+
project.children = [];
|
|
138
|
+
this.project = project;
|
|
139
|
+
for (const proj of projects) {
|
|
140
|
+
(0, assert_1.ok)(this.deferred.length === 0, "Deserializer.defer was called when not deserializing");
|
|
141
|
+
const projModule = new index_1.DeclarationReflection(proj.name, index_1.ReflectionKind.Module, project);
|
|
142
|
+
project.registerReflection(projModule);
|
|
143
|
+
project.children.push(projModule);
|
|
144
|
+
this.oldIdToNewId = { [proj.id]: projModule.id };
|
|
145
|
+
this.fromObject(projModule, proj);
|
|
146
|
+
const deferred = this.deferred;
|
|
147
|
+
this.deferred = [];
|
|
148
|
+
for (const def of deferred) {
|
|
149
|
+
def(project);
|
|
150
|
+
}
|
|
151
|
+
(0, assert_1.ok)(this.deferred.length === 0, "Work may not be double deferred when deserializing.");
|
|
152
|
+
(0, assert_1.ok)(this.activeReflection.length === 0, "Imbalanced reflection deserialization");
|
|
153
|
+
}
|
|
154
|
+
this.oldIdToNewId = {};
|
|
155
|
+
this.project = undefined;
|
|
156
|
+
return project;
|
|
157
|
+
}
|
|
158
|
+
revive(source, creator) {
|
|
159
|
+
if (source) {
|
|
160
|
+
const revived = creator(source);
|
|
161
|
+
this.fromObject(revived, source);
|
|
162
|
+
return revived;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
reviveMany(sourceArray, creator) {
|
|
166
|
+
if (sourceArray) {
|
|
167
|
+
return sourceArray.map((item) => {
|
|
168
|
+
const revived = creator(item);
|
|
169
|
+
this.fromObject(revived, item);
|
|
170
|
+
return revived;
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
reviveType(obj) {
|
|
175
|
+
return this.revive(obj, (o) => this.constructType(o));
|
|
176
|
+
}
|
|
177
|
+
constructReflection(obj) {
|
|
178
|
+
(0, assert_1.ok)(this.activeReflection.length > 0);
|
|
179
|
+
const result = this.reflectionBuilders[obj.variant](this.activeReflection[this.activeReflection.length - 1], obj);
|
|
180
|
+
this.oldIdToNewId[obj.id] = result.id;
|
|
181
|
+
this.project.registerReflection(result);
|
|
182
|
+
return result;
|
|
183
|
+
}
|
|
184
|
+
constructType(obj) {
|
|
185
|
+
const result = this.typeBuilders[obj.type](obj, this);
|
|
186
|
+
return result;
|
|
187
|
+
}
|
|
188
|
+
fromObject(receiver, obj) {
|
|
189
|
+
if (receiver instanceof index_1.Reflection) {
|
|
190
|
+
this.activeReflection.push(receiver);
|
|
191
|
+
}
|
|
192
|
+
receiver.fromObject(this, obj);
|
|
193
|
+
for (const de of this.deserializers) {
|
|
194
|
+
if (de.supports(receiver, obj)) {
|
|
195
|
+
de.fromObject(receiver, obj);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
if (receiver instanceof index_1.Reflection) {
|
|
199
|
+
this.activeReflection.pop();
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Defers work until the initial pass of serialization has been completed.
|
|
204
|
+
* This can be used to set up references which cannot be immediately restored.
|
|
205
|
+
*
|
|
206
|
+
* May only be called when deserializing.
|
|
207
|
+
*/
|
|
208
|
+
defer(cb) {
|
|
209
|
+
this.deferred.push(cb);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
exports.Deserializer = Deserializer;
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { Event } from "../utils/events";
|
|
2
2
|
import type { ProjectReflection } from "../models";
|
|
3
3
|
import type { ProjectReflection as JSONProjectReflection } from "./schema";
|
|
4
|
-
/**
|
|
5
|
-
* Optional data associated with the {@link SerializeEvent}.
|
|
6
|
-
*/
|
|
7
|
-
export interface SerializeEventData {
|
|
8
|
-
outputDirectory?: string;
|
|
9
|
-
outputFile?: string;
|
|
10
|
-
}
|
|
11
4
|
/**
|
|
12
5
|
* An event emitted by the {@link Serializer} class at the very beginning and
|
|
13
6
|
* ending of the a project serialization process.
|
|
@@ -20,14 +13,6 @@ export declare class SerializeEvent extends Event {
|
|
|
20
13
|
* The project the renderer is currently processing.
|
|
21
14
|
*/
|
|
22
15
|
readonly project: ProjectReflection;
|
|
23
|
-
/**
|
|
24
|
-
* The path of the directory the serialized JSON should be written to.
|
|
25
|
-
*/
|
|
26
|
-
outputDirectory?: string;
|
|
27
|
-
/**
|
|
28
|
-
* The name of the main JSON file (base + ext)
|
|
29
|
-
*/
|
|
30
|
-
outputFile?: string;
|
|
31
16
|
output: JSONProjectReflection | undefined;
|
|
32
17
|
constructor(name: string, project: ProjectReflection, output?: JSONProjectReflection);
|
|
33
18
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export type { SerializerComponent } from "./components";
|
|
2
|
+
export { Deserializer, type Deserializable, type DeserializerComponent, } from "./deserializer";
|
|
2
3
|
export { SerializeEvent } from "./events";
|
|
3
|
-
export
|
|
4
|
+
export * as JSONOutput from "./schema";
|
|
4
5
|
export { Serializer } from "./serializer";
|
|
5
|
-
export { JSONOutput };
|
|
6
|
-
import * as JSONOutput from "./schema";
|
|
@@ -23,10 +23,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
exports.Serializer = exports.JSONOutput = exports.SerializeEvent = exports.Deserializer = void 0;
|
|
27
|
+
var deserializer_1 = require("./deserializer");
|
|
28
|
+
Object.defineProperty(exports, "Deserializer", { enumerable: true, get: function () { return deserializer_1.Deserializer; } });
|
|
27
29
|
var events_1 = require("./events");
|
|
28
30
|
Object.defineProperty(exports, "SerializeEvent", { enumerable: true, get: function () { return events_1.SerializeEvent; } });
|
|
31
|
+
exports.JSONOutput = __importStar(require("./schema"));
|
|
29
32
|
var serializer_1 = require("./serializer");
|
|
30
33
|
Object.defineProperty(exports, "Serializer", { enumerable: true, get: function () { return serializer_1.Serializer; } });
|
|
31
|
-
const JSONOutput = __importStar(require("./schema"));
|
|
32
|
-
exports.JSONOutput = JSONOutput;
|
|
@@ -32,7 +32,7 @@ import type * as M from "../models";
|
|
|
32
32
|
* Describes the mapping from Model types to the corresponding JSON output type.
|
|
33
33
|
*/
|
|
34
34
|
export type ModelToObject<T> = T extends Array<infer U> ? _ModelToObject<U>[] : _ModelToObject<T>;
|
|
35
|
-
type _ModelToObject<T> = T extends Primitive ? T : T extends M.ReflectionGroup ? ReflectionGroup : T extends M.ReflectionCategory ? ReflectionCategory : T extends M.SignatureReflection ? SignatureReflection : T extends M.ParameterReflection ? ParameterReflection : T extends M.DeclarationReflection ? DeclarationReflection : T extends M.TypeParameterReflection ? TypeParameterReflection : T extends M.ProjectReflection ? ProjectReflection : T extends M.ContainerReflection ? ContainerReflection : T extends M.ReferenceReflection ? ReferenceReflection : T extends M.Reflection ? Reflection : T extends M.SomeType ? TypeKindMap[T["type"]] : T extends M.Type ? SomeType : T extends M.Comment ? Comment : T extends M.CommentTag ? CommentTag : T extends M.CommentDisplayPart ? CommentDisplayPart : T extends M.SourceReference ? SourceReference : never;
|
|
35
|
+
type _ModelToObject<T> = T extends Primitive ? T : Required<T> extends Required<M.ReflectionGroup> ? ReflectionGroup : Required<T> extends Required<M.ReflectionCategory> ? ReflectionCategory : T extends M.SignatureReflection ? SignatureReflection : T extends M.ParameterReflection ? ParameterReflection : T extends M.DeclarationReflection ? DeclarationReflection : T extends M.TypeParameterReflection ? TypeParameterReflection : T extends M.ProjectReflection ? ProjectReflection : T extends M.ContainerReflection ? ContainerReflection : T extends M.ReferenceReflection ? ReferenceReflection : T extends M.Reflection ? Reflection : T extends M.SomeType ? TypeKindMap[T["type"]] : T extends M.Type ? SomeType : T extends M.Comment ? Comment : T extends M.CommentTag ? CommentTag : T extends M.CommentDisplayPart ? CommentDisplayPart : T extends M.SourceReference ? SourceReference : never;
|
|
36
36
|
type Primitive = string | number | undefined | null | boolean;
|
|
37
37
|
type ToSerialized<T> = T extends Primitive ? T : T extends bigint ? {
|
|
38
38
|
value: string;
|
|
@@ -47,35 +47,42 @@ type ToSerialized<T> = T extends Primitive ? T : T extends bigint ? {
|
|
|
47
47
|
type S<T, K extends keyof T> = {
|
|
48
48
|
-readonly [K2 in K]: ToSerialized<T[K2]>;
|
|
49
49
|
};
|
|
50
|
+
export interface ReflectionSymbolId {
|
|
51
|
+
sourceFileName: string;
|
|
52
|
+
qualifiedName: string;
|
|
53
|
+
}
|
|
50
54
|
export interface ReflectionGroup extends S<M.ReflectionGroup, "title" | "categories"> {
|
|
51
55
|
children?: M.ReflectionGroup["children"][number]["id"][];
|
|
52
56
|
}
|
|
53
57
|
export interface ReflectionCategory extends S<M.ReflectionCategory, "title"> {
|
|
54
58
|
children?: M.ReflectionCategory["children"][number]["id"][];
|
|
55
59
|
}
|
|
56
|
-
export
|
|
60
|
+
export type SomeReflection = {
|
|
61
|
+
[K in keyof M.ReflectionVariant]: ModelToObject<M.ReflectionVariant[K]>;
|
|
62
|
+
}[keyof M.ReflectionVariant];
|
|
63
|
+
export interface ReferenceReflection extends Omit<DeclarationReflection, "variant">, S<M.ReferenceReflection, "variant"> {
|
|
57
64
|
/**
|
|
58
65
|
* -1 if the reference refers to a symbol that does not exist in the documentation.
|
|
59
66
|
* Otherwise, the reflection ID.
|
|
60
67
|
*/
|
|
61
68
|
target: number;
|
|
62
69
|
}
|
|
63
|
-
export interface SignatureReflection extends Reflection, S<M.SignatureReflection, "parameters" | "type" | "overwrites" | "inheritedFrom" | "implementationOf"> {
|
|
70
|
+
export interface SignatureReflection extends Omit<Reflection, "variant">, S<M.SignatureReflection, "variant" | "sources" | "parameters" | "type" | "overwrites" | "inheritedFrom" | "implementationOf"> {
|
|
64
71
|
typeParameter?: ModelToObject<M.SignatureReflection["typeParameters"]>;
|
|
65
72
|
}
|
|
66
|
-
export interface ParameterReflection extends Reflection, S<M.ParameterReflection, "type" | "defaultValue"> {
|
|
73
|
+
export interface ParameterReflection extends Omit<Reflection, "variant">, S<M.ParameterReflection, "variant" | "type" | "defaultValue"> {
|
|
74
|
+
variant: "param";
|
|
67
75
|
}
|
|
68
|
-
export interface DeclarationReflection extends ContainerReflection, S<M.DeclarationReflection, "type" | "signatures" | "indexSignature" | "defaultValue" | "overwrites" | "inheritedFrom" | "implementationOf" | "extendedTypes" | "extendedBy" | "implementedTypes" | "implementedBy" | "getSignature" | "setSignature" | "typeParameters"> {
|
|
76
|
+
export interface DeclarationReflection extends Omit<ContainerReflection, "variant">, S<M.DeclarationReflection, "variant" | "packageVersion" | "sources" | "relevanceBoost" | "type" | "signatures" | "indexSignature" | "defaultValue" | "overwrites" | "inheritedFrom" | "implementationOf" | "extendedTypes" | "extendedBy" | "implementedTypes" | "implementedBy" | "getSignature" | "setSignature" | "typeParameters"> {
|
|
69
77
|
}
|
|
70
|
-
export interface TypeParameterReflection extends Reflection, S<M.TypeParameterReflection, "type" | "default" | "varianceModifier"> {
|
|
78
|
+
export interface TypeParameterReflection extends Omit<Reflection, "variant">, S<M.TypeParameterReflection, "variant" | "type" | "default" | "varianceModifier"> {
|
|
71
79
|
}
|
|
72
|
-
export interface ProjectReflection extends ContainerReflection {
|
|
80
|
+
export interface ProjectReflection extends Omit<ContainerReflection, "variant">, S<M.ProjectReflection, "variant" | "packageName" | "packageVersion" | "readme"> {
|
|
81
|
+
symbolIdMap: Record<number, ReflectionSymbolId>;
|
|
73
82
|
}
|
|
74
|
-
export interface ContainerReflection extends Reflection, S<M.ContainerReflection, "children" | "groups" | "categories"
|
|
83
|
+
export interface ContainerReflection extends Reflection, S<M.ContainerReflection, "children" | "groups" | "categories"> {
|
|
75
84
|
}
|
|
76
|
-
export interface Reflection extends S<M.Reflection, "id" | "
|
|
77
|
-
/** Will not be present if name === originalName */
|
|
78
|
-
originalName?: M.Reflection["originalName"];
|
|
85
|
+
export interface Reflection extends S<M.Reflection, "id" | "variant" | "name" | "kind" | "comment"> {
|
|
79
86
|
flags: ReflectionFlags;
|
|
80
87
|
}
|
|
81
88
|
export type SomeType = ModelToObject<M.SomeType>;
|
|
@@ -94,9 +101,9 @@ export type TypeKindMap = {
|
|
|
94
101
|
reference: ReferenceType;
|
|
95
102
|
reflection: ReflectionType;
|
|
96
103
|
rest: RestType;
|
|
97
|
-
|
|
104
|
+
templateLiteral: TemplateLiteralType;
|
|
98
105
|
tuple: TupleType;
|
|
99
|
-
|
|
106
|
+
namedTupleMember: NamedTupleMemberType;
|
|
100
107
|
typeOperator: TypeOperatorType;
|
|
101
108
|
union: UnionType;
|
|
102
109
|
unknown: UnknownType;
|
|
@@ -120,11 +127,10 @@ export interface PredicateType extends Type, S<M.PredicateType, "type" | "name"
|
|
|
120
127
|
export interface QueryType extends Type, S<M.QueryType, "type" | "queryType"> {
|
|
121
128
|
}
|
|
122
129
|
export interface ReferenceType extends Type, S<M.ReferenceType, "type" | "name" | "typeArguments" | "package" | "externalUrl"> {
|
|
123
|
-
|
|
130
|
+
target: number | ReflectionSymbolId;
|
|
124
131
|
qualifiedName?: string;
|
|
125
132
|
}
|
|
126
|
-
export interface ReflectionType extends Type, S<M.ReflectionType, "type"> {
|
|
127
|
-
declaration?: ModelToObject<M.ReflectionType["declaration"]>;
|
|
133
|
+
export interface ReflectionType extends Type, S<M.ReflectionType, "type" | "declaration"> {
|
|
128
134
|
}
|
|
129
135
|
export interface RestType extends Type, S<M.RestType, "type" | "elementType"> {
|
|
130
136
|
}
|
|
@@ -153,7 +159,7 @@ type BoolKeys<T> = {
|
|
|
153
159
|
}[keyof T];
|
|
154
160
|
export interface ReflectionFlags extends Partial<S<M.ReflectionFlags, BoolKeys<M.ReflectionFlags>>> {
|
|
155
161
|
}
|
|
156
|
-
export interface Comment extends Partial<S<M.Comment, "blockTags">> {
|
|
162
|
+
export interface Comment extends Partial<S<M.Comment, "blockTags" | "label">> {
|
|
157
163
|
summary: CommentDisplayPart[];
|
|
158
164
|
modifierTags?: string[];
|
|
159
165
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { EventDispatcher } from "../utils";
|
|
2
2
|
import type { ProjectReflection } from "../models";
|
|
3
|
-
import { SerializeEventData } from "./events";
|
|
4
3
|
import type { ModelToObject } from "./schema";
|
|
5
4
|
import type { SerializerComponent } from "./components";
|
|
6
5
|
export declare class Serializer extends EventDispatcher {
|
|
@@ -15,6 +14,10 @@ export declare class Serializer extends EventDispatcher {
|
|
|
15
14
|
*/
|
|
16
15
|
static EVENT_END: string;
|
|
17
16
|
private serializers;
|
|
17
|
+
/**
|
|
18
|
+
* Only set after resolve.
|
|
19
|
+
*/
|
|
20
|
+
projectRoot: string;
|
|
18
21
|
addSerializer(serializer: SerializerComponent<any>): void;
|
|
19
22
|
toObject<T extends {
|
|
20
23
|
toObject(serializer: Serializer): ModelToObject<T>;
|
|
@@ -30,8 +33,5 @@ export declare class Serializer extends EventDispatcher {
|
|
|
30
33
|
* @param value
|
|
31
34
|
* @param eventData Partial information to set in the event
|
|
32
35
|
*/
|
|
33
|
-
projectToObject(value: ProjectReflection,
|
|
34
|
-
begin?: SerializeEventData;
|
|
35
|
-
end?: SerializeEventData;
|
|
36
|
-
}): ModelToObject<ProjectReflection>;
|
|
36
|
+
projectToObject(value: ProjectReflection, projectRoot: string): ModelToObject<ProjectReflection>;
|
|
37
37
|
}
|
|
@@ -3,18 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Serializer = void 0;
|
|
4
4
|
const utils_1 = require("../utils");
|
|
5
5
|
const events_1 = require("./events");
|
|
6
|
+
const array_1 = require("../utils/array");
|
|
6
7
|
class Serializer extends utils_1.EventDispatcher {
|
|
7
8
|
constructor() {
|
|
8
9
|
super(...arguments);
|
|
9
10
|
this.serializers = [];
|
|
10
11
|
}
|
|
11
12
|
addSerializer(serializer) {
|
|
12
|
-
|
|
13
|
-
// Remove this check in 0.24
|
|
14
|
-
throw new Error("Support for `serializeGroup` was removed. Use supports instead.");
|
|
15
|
-
}
|
|
16
|
-
this.serializers.push(serializer);
|
|
17
|
-
this.serializers.sort((a, b) => b.priority - a.priority);
|
|
13
|
+
(0, array_1.insertPrioritySorted)(this.serializers, serializer);
|
|
18
14
|
}
|
|
19
15
|
toObject(value) {
|
|
20
16
|
if (value === undefined) {
|
|
@@ -35,19 +31,12 @@ class Serializer extends utils_1.EventDispatcher {
|
|
|
35
31
|
* @param value
|
|
36
32
|
* @param eventData Partial information to set in the event
|
|
37
33
|
*/
|
|
38
|
-
projectToObject(value,
|
|
34
|
+
projectToObject(value, projectRoot) {
|
|
35
|
+
this.projectRoot = projectRoot;
|
|
39
36
|
const eventBegin = new events_1.SerializeEvent(Serializer.EVENT_BEGIN, value);
|
|
40
|
-
if (eventData.begin) {
|
|
41
|
-
eventBegin.outputDirectory = eventData.begin.outputDirectory;
|
|
42
|
-
eventBegin.outputFile = eventData.begin.outputFile;
|
|
43
|
-
}
|
|
44
37
|
this.trigger(eventBegin);
|
|
45
38
|
const project = this.toObject(value);
|
|
46
39
|
const eventEnd = new events_1.SerializeEvent(Serializer.EVENT_END, value, project);
|
|
47
|
-
if (eventData.end) {
|
|
48
|
-
eventBegin.outputDirectory = eventData.end.outputDirectory;
|
|
49
|
-
eventBegin.outputFile = eventData.end.outputFile;
|
|
50
|
-
}
|
|
51
40
|
this.trigger(eventEnd);
|
|
52
41
|
return project;
|
|
53
42
|
}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* the item will be inserted later will be placed earlier in the array.
|
|
4
4
|
* @param arr modified by inserting item.
|
|
5
5
|
* @param item
|
|
6
|
-
* @deprecated this is confusing, it sorts with lower priority being placed earlier. Prefer insertOrderSorted, which is nearly the same.
|
|
7
6
|
*/
|
|
8
7
|
export declare function insertPrioritySorted<T extends {
|
|
9
8
|
priority: number;
|
package/dist/lib/utils/array.js
CHANGED
|
@@ -6,10 +6,9 @@ exports.filterMap = exports.zip = exports.partition = exports.unique = exports.r
|
|
|
6
6
|
* the item will be inserted later will be placed earlier in the array.
|
|
7
7
|
* @param arr modified by inserting item.
|
|
8
8
|
* @param item
|
|
9
|
-
* @deprecated this is confusing, it sorts with lower priority being placed earlier. Prefer insertOrderSorted, which is nearly the same.
|
|
10
9
|
*/
|
|
11
10
|
function insertPrioritySorted(arr, item) {
|
|
12
|
-
const index = binaryFindPartition(arr, (v) => v.priority
|
|
11
|
+
const index = binaryFindPartition(arr, (v) => v.priority <= item.priority);
|
|
13
12
|
arr.splice(index === -1 ? arr.length : index, 0, item);
|
|
14
13
|
return arr;
|
|
15
14
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
1
|
+
import * as ts from "typescript";
|
|
2
2
|
import type { Logger } from "./loggers";
|
|
3
3
|
import type { Options } from "./options";
|
|
4
4
|
/**
|
|
@@ -7,7 +7,7 @@ import type { Options } from "./options";
|
|
|
7
7
|
*/
|
|
8
8
|
export declare const EntryPointStrategy: {
|
|
9
9
|
/**
|
|
10
|
-
* The default behavior in v0.22
|
|
10
|
+
* The default behavior in v0.22-v0.23, expects all provided entry points as being part of a single program.
|
|
11
11
|
* Any directories included in the entry point list will result in `dir/index.([cm][tj]s|[tj]sx?)` being used.
|
|
12
12
|
*/
|
|
13
13
|
readonly Resolve: "resolve";
|
|
@@ -17,12 +17,22 @@ export declare const EntryPointStrategy: {
|
|
|
17
17
|
*/
|
|
18
18
|
readonly Expand: "expand";
|
|
19
19
|
/**
|
|
20
|
+
* Run TypeDoc in each directory passed as an entry point, and save the json result to `.typedoc/<project>`
|
|
21
|
+
* Once all have been saved, use the merge option to produce final output.
|
|
22
|
+
*/
|
|
23
|
+
readonly Packages: "packages";
|
|
24
|
+
/**
|
|
25
|
+
* Will be removed in 0.25, this was called packages mode in 0.24.
|
|
20
26
|
* Alternative resolution mode useful for monorepos. With this mode, TypeDoc will look for a package.json
|
|
21
27
|
* and tsconfig.json under each provided entry point. The `main` field of each package will be documented.
|
|
22
28
|
*/
|
|
23
|
-
readonly
|
|
29
|
+
readonly LegacyPackages: "legacy-packages";
|
|
30
|
+
/**
|
|
31
|
+
* Merges multiple previously generated output from TypeDoc's --json output together into a single project.
|
|
32
|
+
*/
|
|
33
|
+
readonly Merge: "merge";
|
|
24
34
|
};
|
|
25
|
-
export type EntryPointStrategy =
|
|
35
|
+
export type EntryPointStrategy = typeof EntryPointStrategy[keyof typeof EntryPointStrategy];
|
|
26
36
|
export interface DocumentationEntryPoint {
|
|
27
37
|
displayName: string;
|
|
28
38
|
readmeFile?: string;
|
|
@@ -32,4 +42,5 @@ export interface DocumentationEntryPoint {
|
|
|
32
42
|
}
|
|
33
43
|
export declare function getEntryPoints(logger: Logger, options: Options): DocumentationEntryPoint[] | undefined;
|
|
34
44
|
export declare function getWatchEntryPoints(logger: Logger, options: Options, program: ts.Program): DocumentationEntryPoint[] | undefined;
|
|
45
|
+
export declare function getPackageDirectories(logger: Logger, options: Options, packageGlobPaths: string[]): string[];
|
|
35
46
|
export declare function getExpandedEntryPointsForPaths(logger: Logger, inputFiles: string[], options: Options, programs?: ts.Program[]): DocumentationEntryPoint[] | undefined;
|