typedoc 0.25.0 → 0.25.2
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 +2 -2
- package/dist/index.js +2 -1
- package/dist/lib/application.d.ts +3 -3
- package/dist/lib/application.js +440 -359
- package/dist/lib/cli.js +6 -3
- package/dist/lib/converter/comments/discovery.js +8 -2
- package/dist/lib/converter/comments/index.js +9 -1
- package/dist/lib/converter/comments/parser.js +5 -11
- package/dist/lib/converter/comments/tagName.d.ts +8 -0
- package/dist/lib/converter/comments/tagName.js +62 -0
- package/dist/lib/converter/context.js +1 -2
- package/dist/lib/converter/converter.d.ts +11 -11
- package/dist/lib/converter/converter.js +436 -311
- package/dist/lib/converter/factories/signature.d.ts +1 -0
- package/dist/lib/converter/factories/signature.js +31 -5
- package/dist/lib/converter/jsdoc.js +2 -6
- package/dist/lib/converter/plugins/CategoryPlugin.d.ts +8 -8
- package/dist/lib/converter/plugins/CategoryPlugin.js +293 -200
- package/dist/lib/converter/plugins/CommentPlugin.d.ts +8 -5
- package/dist/lib/converter/plugins/CommentPlugin.js +433 -305
- package/dist/lib/converter/plugins/GroupPlugin.d.ts +4 -3
- package/dist/lib/converter/plugins/GroupPlugin.js +226 -145
- package/dist/lib/converter/plugins/ImplementsPlugin.js +239 -194
- package/dist/lib/converter/plugins/InheritDocPlugin.d.ts +1 -1
- package/dist/lib/converter/plugins/InheritDocPlugin.js +201 -138
- package/dist/lib/converter/plugins/LinkResolverPlugin.d.ts +1 -1
- package/dist/lib/converter/plugins/LinkResolverPlugin.js +110 -44
- package/dist/lib/converter/plugins/PackagePlugin.d.ts +6 -4
- package/dist/lib/converter/plugins/PackagePlugin.js +191 -96
- package/dist/lib/converter/plugins/SourcePlugin.d.ts +6 -6
- package/dist/lib/converter/plugins/SourcePlugin.js +234 -146
- package/dist/lib/converter/plugins/TypePlugin.js +147 -102
- package/dist/lib/converter/symbols.js +1 -1
- package/dist/lib/converter/types.js +10 -0
- package/dist/lib/converter/utils/repository.js +2 -2
- package/dist/lib/models/reflections/ReflectionSymbolId.js +1 -1
- package/dist/lib/models/reflections/abstract.d.ts +4 -0
- package/dist/lib/models/reflections/abstract.js +14 -2
- package/dist/lib/models/reflections/index.d.ts +1 -1
- package/dist/lib/output/components.d.ts +1 -0
- package/dist/lib/output/components.js +9 -1
- package/dist/lib/output/index.d.ts +1 -1
- package/dist/lib/output/plugins/AssetsPlugin.d.ts +1 -1
- package/dist/lib/output/plugins/AssetsPlugin.js +111 -44
- package/dist/lib/output/plugins/JavascriptIndexPlugin.d.ts +2 -1
- package/dist/lib/output/plugins/JavascriptIndexPlugin.js +173 -99
- package/dist/lib/output/plugins/NavigationPlugin.d.ts +6 -0
- package/dist/lib/output/plugins/NavigationPlugin.js +109 -0
- package/dist/lib/output/plugins/index.d.ts +2 -1
- package/dist/lib/output/plugins/index.js +5 -3
- package/dist/lib/output/renderer.d.ts +10 -8
- package/dist/lib/output/renderer.js +315 -202
- package/dist/lib/output/theme.js +63 -18
- package/dist/lib/output/themes/MarkedPlugin.d.ts +4 -4
- package/dist/lib/output/themes/MarkedPlugin.js +223 -145
- package/dist/lib/output/themes/default/DefaultTheme.d.ts +14 -1
- package/dist/lib/output/themes/default/DefaultTheme.js +72 -0
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +42 -36
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +15 -1
- package/dist/lib/output/themes/default/layouts/default.js +2 -0
- package/dist/lib/output/themes/default/partials/header.js +1 -1
- package/dist/lib/output/themes/default/partials/icon.d.ts +4 -1
- package/dist/lib/output/themes/default/partials/icon.js +46 -35
- package/dist/lib/output/themes/default/partials/member.signature.body.js +1 -1
- package/dist/lib/output/themes/default/partials/navigation.js +34 -67
- package/dist/lib/utils/component.d.ts +1 -1
- package/dist/lib/utils/component.js +3 -1
- package/dist/lib/utils/entry-point.js +36 -18
- package/dist/lib/utils/events.js +1 -1
- package/dist/lib/utils/general.js +1 -1
- package/dist/lib/utils/index.d.ts +1 -1
- package/dist/lib/utils/index.js +2 -1
- package/dist/lib/utils/jsx.js +1 -1
- package/dist/lib/utils/options/declaration.d.ts +4 -0
- package/dist/lib/utils/options/index.d.ts +1 -1
- package/dist/lib/utils/options/index.js +2 -1
- package/dist/lib/utils/options/options.d.ts +19 -0
- package/dist/lib/utils/options/options.js +22 -2
- package/dist/lib/utils/options/readers/tsconfig.js +2 -7
- package/dist/lib/utils/options/sources/typedoc.js +22 -0
- package/dist/lib/utils/perf.d.ts +1 -1
- package/dist/lib/utils/perf.js +10 -20
- package/package.json +9 -9
- package/static/main.js +4 -3
- package/static/style.css +7 -3
|
@@ -8,8 +8,9 @@ import { ConverterComponent } from "../components";
|
|
|
8
8
|
*/
|
|
9
9
|
export declare class GroupPlugin extends ConverterComponent {
|
|
10
10
|
sortFunction: (reflections: DeclarationReflection[]) => void;
|
|
11
|
-
boosts: Record<string, number>;
|
|
12
|
-
groupOrder: string[];
|
|
11
|
+
accessor boosts: Record<string, number>;
|
|
12
|
+
accessor groupOrder: string[];
|
|
13
|
+
accessor sortEntryPoints: boolean;
|
|
13
14
|
usedBoosts: Set<string>;
|
|
14
15
|
static WEIGHTS: string[];
|
|
15
16
|
/**
|
|
@@ -34,7 +35,7 @@ export declare class GroupPlugin extends ConverterComponent {
|
|
|
34
35
|
* Extracts the groups for a given reflection.
|
|
35
36
|
*
|
|
36
37
|
* @privateRemarks
|
|
37
|
-
* If you change this, also update
|
|
38
|
+
* If you change this, also update extractCategories in CategoryPlugin accordingly.
|
|
38
39
|
*/
|
|
39
40
|
getGroups(reflection: DeclarationReflection): Set<string>;
|
|
40
41
|
/**
|
|
@@ -1,11 +1,53 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
3
|
+
var useValue = arguments.length > 2;
|
|
4
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
5
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
6
|
+
}
|
|
7
|
+
return useValue ? value : void 0;
|
|
8
|
+
};
|
|
9
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
10
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
11
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
12
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
13
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
14
|
+
var _, done = false;
|
|
15
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
16
|
+
var context = {};
|
|
17
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
18
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
19
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
20
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
21
|
+
if (kind === "accessor") {
|
|
22
|
+
if (result === void 0) continue;
|
|
23
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
24
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
25
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
26
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
27
|
+
}
|
|
28
|
+
else if (_ = accept(result)) {
|
|
29
|
+
if (kind === "field") initializers.unshift(_);
|
|
30
|
+
else descriptor[key] = _;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
34
|
+
done = true;
|
|
35
|
+
};
|
|
36
|
+
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
|
|
37
|
+
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
38
|
+
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
39
|
+
};
|
|
40
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
41
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
42
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
43
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
44
|
+
};
|
|
45
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
46
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
47
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
48
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
49
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
50
|
};
|
|
8
|
-
var GroupPlugin_1;
|
|
9
51
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
52
|
exports.GroupPlugin = void 0;
|
|
11
53
|
const index_1 = require("../../models/reflections/index");
|
|
@@ -20,157 +62,196 @@ const models_1 = require("../../models");
|
|
|
20
62
|
*
|
|
21
63
|
* The handler sets the `groups` property of all container reflections.
|
|
22
64
|
*/
|
|
23
|
-
let GroupPlugin =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
* @param reflection The reflection that is currently resolved.
|
|
46
|
-
*/
|
|
47
|
-
onResolve(_context, reflection) {
|
|
48
|
-
if (reflection instanceof index_1.ContainerReflection) {
|
|
49
|
-
this.group(reflection);
|
|
65
|
+
let GroupPlugin = (() => {
|
|
66
|
+
var _GroupPlugin_boosts_accessor_storage, _GroupPlugin_groupOrder_accessor_storage, _GroupPlugin_sortEntryPoints_accessor_storage;
|
|
67
|
+
let _classDecorators = [(0, components_1.Component)({ name: "group" })];
|
|
68
|
+
let _classDescriptor;
|
|
69
|
+
let _classExtraInitializers = [];
|
|
70
|
+
let _classThis;
|
|
71
|
+
let _classSuper = components_1.ConverterComponent;
|
|
72
|
+
let _instanceExtraInitializers = [];
|
|
73
|
+
let _boosts_decorators;
|
|
74
|
+
let _boosts_initializers = [];
|
|
75
|
+
let _groupOrder_decorators;
|
|
76
|
+
let _groupOrder_initializers = [];
|
|
77
|
+
let _sortEntryPoints_decorators;
|
|
78
|
+
let _sortEntryPoints_initializers = [];
|
|
79
|
+
var GroupPlugin = _classThis = class extends _classSuper {
|
|
80
|
+
constructor() {
|
|
81
|
+
super(...arguments);
|
|
82
|
+
this.sortFunction = (__runInitializers(this, _instanceExtraInitializers), void 0);
|
|
83
|
+
_GroupPlugin_boosts_accessor_storage.set(this, __runInitializers(this, _boosts_initializers, void 0));
|
|
84
|
+
_GroupPlugin_groupOrder_accessor_storage.set(this, __runInitializers(this, _groupOrder_initializers, void 0));
|
|
85
|
+
_GroupPlugin_sortEntryPoints_accessor_storage.set(this, __runInitializers(this, _sortEntryPoints_initializers, void 0));
|
|
86
|
+
this.usedBoosts = new Set();
|
|
50
87
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
group(reflection) {
|
|
71
|
-
if (reflection.children &&
|
|
72
|
-
reflection.children.length > 0 &&
|
|
73
|
-
!reflection.groups) {
|
|
74
|
-
this.sortFunction(reflection.children);
|
|
75
|
-
reflection.groups = this.getReflectionGroups(reflection.children);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Extracts the groups for a given reflection.
|
|
80
|
-
*
|
|
81
|
-
* @privateRemarks
|
|
82
|
-
* If you change this, also update getCategories in CategoryPlugin accordingly.
|
|
83
|
-
*/
|
|
84
|
-
getGroups(reflection) {
|
|
85
|
-
const groups = new Set();
|
|
86
|
-
function extractGroupTags(comment) {
|
|
87
|
-
if (!comment)
|
|
88
|
-
return;
|
|
89
|
-
(0, utils_1.removeIf)(comment.blockTags, (tag) => {
|
|
90
|
-
if (tag.tag === "@group") {
|
|
91
|
-
groups.add(models_1.Comment.combineDisplayParts(tag.content).trim());
|
|
92
|
-
return true;
|
|
93
|
-
}
|
|
94
|
-
return false;
|
|
88
|
+
get boosts() { return __classPrivateFieldGet(this, _GroupPlugin_boosts_accessor_storage, "f"); }
|
|
89
|
+
set boosts(value) { __classPrivateFieldSet(this, _GroupPlugin_boosts_accessor_storage, value, "f"); }
|
|
90
|
+
get groupOrder() { return __classPrivateFieldGet(this, _GroupPlugin_groupOrder_accessor_storage, "f"); }
|
|
91
|
+
set groupOrder(value) { __classPrivateFieldSet(this, _GroupPlugin_groupOrder_accessor_storage, value, "f"); }
|
|
92
|
+
get sortEntryPoints() { return __classPrivateFieldGet(this, _GroupPlugin_sortEntryPoints_accessor_storage, "f"); }
|
|
93
|
+
set sortEntryPoints(value) { __classPrivateFieldSet(this, _GroupPlugin_sortEntryPoints_accessor_storage, value, "f"); }
|
|
94
|
+
/**
|
|
95
|
+
* Create a new GroupPlugin instance.
|
|
96
|
+
*/
|
|
97
|
+
initialize() {
|
|
98
|
+
this.listenTo(this.owner, {
|
|
99
|
+
[converter_1.Converter.EVENT_RESOLVE_BEGIN]: () => {
|
|
100
|
+
this.sortFunction = (0, sort_1.getSortFunction)(this.application.options);
|
|
101
|
+
GroupPlugin.WEIGHTS = this.groupOrder;
|
|
102
|
+
},
|
|
103
|
+
[converter_1.Converter.EVENT_RESOLVE]: this.onResolve,
|
|
104
|
+
[converter_1.Converter.EVENT_RESOLVE_END]: this.onEndResolve,
|
|
95
105
|
});
|
|
96
106
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
107
|
+
/**
|
|
108
|
+
* Triggered when the converter resolves a reflection.
|
|
109
|
+
*
|
|
110
|
+
* @param context The context object describing the current state the converter is in.
|
|
111
|
+
* @param reflection The reflection that is currently resolved.
|
|
112
|
+
*/
|
|
113
|
+
onResolve(_context, reflection) {
|
|
114
|
+
if (reflection instanceof index_1.ContainerReflection) {
|
|
115
|
+
this.group(reflection);
|
|
105
116
|
}
|
|
106
117
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
118
|
+
/**
|
|
119
|
+
* Triggered when the converter has finished resolving a project.
|
|
120
|
+
*
|
|
121
|
+
* @param context The context object describing the current state the converter is in.
|
|
122
|
+
*/
|
|
123
|
+
onEndResolve(context) {
|
|
124
|
+
this.group(context.project);
|
|
125
|
+
const unusedBoosts = new Set(Object.keys(this.boosts));
|
|
126
|
+
for (const boost of this.usedBoosts) {
|
|
127
|
+
unusedBoosts.delete(boost);
|
|
128
|
+
}
|
|
129
|
+
this.usedBoosts.clear();
|
|
130
|
+
if (unusedBoosts.size &&
|
|
131
|
+
this.application.options.isSet("searchGroupBoosts")) {
|
|
132
|
+
context.logger.warn(`Not all groups specified in searchGroupBoosts were used in the documentation.` +
|
|
133
|
+
` The unused groups were:\n\t${Array.from(unusedBoosts).join("\n\t")}`);
|
|
116
134
|
}
|
|
117
135
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
* @param reflections The reflections that should be grouped.
|
|
126
|
-
* @returns An array containing all children of the given reflection grouped by their kind.
|
|
127
|
-
*/
|
|
128
|
-
getReflectionGroups(reflections) {
|
|
129
|
-
const groups = new Map();
|
|
130
|
-
reflections.forEach((child) => {
|
|
131
|
-
for (const name of this.getGroups(child)) {
|
|
132
|
-
let group = groups.get(name);
|
|
133
|
-
if (!group) {
|
|
134
|
-
group = new ReflectionGroup_1.ReflectionGroup(name, child);
|
|
135
|
-
groups.set(name, group);
|
|
136
|
+
group(reflection) {
|
|
137
|
+
if (reflection.children &&
|
|
138
|
+
reflection.children.length > 0 &&
|
|
139
|
+
!reflection.groups) {
|
|
140
|
+
if (this.sortEntryPoints ||
|
|
141
|
+
!reflection.children.some((c) => c.kindOf(index_1.ReflectionKind.Module))) {
|
|
142
|
+
this.sortFunction(reflection.children);
|
|
136
143
|
}
|
|
137
|
-
|
|
144
|
+
reflection.groups = this.getReflectionGroups(reflection.children);
|
|
138
145
|
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Extracts the groups for a given reflection.
|
|
149
|
+
*
|
|
150
|
+
* @privateRemarks
|
|
151
|
+
* If you change this, also update extractCategories in CategoryPlugin accordingly.
|
|
152
|
+
*/
|
|
153
|
+
getGroups(reflection) {
|
|
154
|
+
const groups = new Set();
|
|
155
|
+
function extractGroupTags(comment) {
|
|
156
|
+
if (!comment)
|
|
157
|
+
return;
|
|
158
|
+
(0, utils_1.removeIf)(comment.blockTags, (tag) => {
|
|
159
|
+
if (tag.tag === "@group") {
|
|
160
|
+
groups.add(models_1.Comment.combineDisplayParts(tag.content).trim());
|
|
161
|
+
return true;
|
|
162
|
+
}
|
|
163
|
+
return false;
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
extractGroupTags(reflection.comment);
|
|
167
|
+
for (const sig of reflection.getNonIndexSignatures()) {
|
|
168
|
+
extractGroupTags(sig.comment);
|
|
152
169
|
}
|
|
153
|
-
if (
|
|
154
|
-
|
|
170
|
+
if (reflection.type?.type === "reflection") {
|
|
171
|
+
extractGroupTags(reflection.type.declaration.comment);
|
|
172
|
+
for (const sig of reflection.type.declaration.getNonIndexSignatures()) {
|
|
173
|
+
extractGroupTags(sig.comment);
|
|
174
|
+
}
|
|
155
175
|
}
|
|
156
|
-
|
|
157
|
-
|
|
176
|
+
groups.delete("");
|
|
177
|
+
if (groups.size === 0) {
|
|
178
|
+
groups.add(index_1.ReflectionKind.pluralString(reflection.kind));
|
|
158
179
|
}
|
|
180
|
+
for (const group of groups) {
|
|
181
|
+
if (group in this.boosts) {
|
|
182
|
+
this.usedBoosts.add(group);
|
|
183
|
+
reflection.relevanceBoost =
|
|
184
|
+
(reflection.relevanceBoost ?? 1) * this.boosts[group];
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return groups;
|
|
159
188
|
}
|
|
160
|
-
|
|
161
|
-
|
|
189
|
+
/**
|
|
190
|
+
* Create a grouped representation of the given list of reflections.
|
|
191
|
+
*
|
|
192
|
+
* Reflections are grouped by kind and sorted by weight and name.
|
|
193
|
+
*
|
|
194
|
+
* @param reflections The reflections that should be grouped.
|
|
195
|
+
* @returns An array containing all children of the given reflection grouped by their kind.
|
|
196
|
+
*/
|
|
197
|
+
getReflectionGroups(reflections) {
|
|
198
|
+
const groups = new Map();
|
|
199
|
+
reflections.forEach((child) => {
|
|
200
|
+
for (const name of this.getGroups(child)) {
|
|
201
|
+
let group = groups.get(name);
|
|
202
|
+
if (!group) {
|
|
203
|
+
group = new ReflectionGroup_1.ReflectionGroup(name, child);
|
|
204
|
+
groups.set(name, group);
|
|
205
|
+
}
|
|
206
|
+
group.children.push(child);
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
return Array.from(groups.values()).sort(GroupPlugin.sortGroupCallback);
|
|
162
210
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
211
|
+
/**
|
|
212
|
+
* Callback used to sort groups by name.
|
|
213
|
+
*/
|
|
214
|
+
static sortGroupCallback(a, b) {
|
|
215
|
+
let aWeight = GroupPlugin.WEIGHTS.indexOf(a.title);
|
|
216
|
+
let bWeight = GroupPlugin.WEIGHTS.indexOf(b.title);
|
|
217
|
+
if (aWeight === -1 || bWeight === -1) {
|
|
218
|
+
let asteriskIndex = GroupPlugin.WEIGHTS.indexOf("*");
|
|
219
|
+
if (asteriskIndex === -1) {
|
|
220
|
+
asteriskIndex = GroupPlugin.WEIGHTS.length;
|
|
221
|
+
}
|
|
222
|
+
if (aWeight === -1) {
|
|
223
|
+
aWeight = asteriskIndex;
|
|
224
|
+
}
|
|
225
|
+
if (bWeight === -1) {
|
|
226
|
+
bWeight = asteriskIndex;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
if (aWeight === bWeight) {
|
|
230
|
+
return a.title > b.title ? 1 : -1;
|
|
231
|
+
}
|
|
232
|
+
return aWeight - bWeight;
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
_GroupPlugin_boosts_accessor_storage = new WeakMap();
|
|
236
|
+
_GroupPlugin_groupOrder_accessor_storage = new WeakMap();
|
|
237
|
+
_GroupPlugin_sortEntryPoints_accessor_storage = new WeakMap();
|
|
238
|
+
__setFunctionName(_classThis, "GroupPlugin");
|
|
239
|
+
(() => {
|
|
240
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
241
|
+
_boosts_decorators = [(0, utils_1.Option)("searchGroupBoosts")];
|
|
242
|
+
_groupOrder_decorators = [(0, utils_1.Option)("groupOrder")];
|
|
243
|
+
_sortEntryPoints_decorators = [(0, utils_1.Option)("sortEntryPoints")];
|
|
244
|
+
__esDecorate(_classThis, null, _boosts_decorators, { kind: "accessor", name: "boosts", static: false, private: false, access: { has: obj => "boosts" in obj, get: obj => obj.boosts, set: (obj, value) => { obj.boosts = value; } }, metadata: _metadata }, _boosts_initializers, _instanceExtraInitializers);
|
|
245
|
+
__esDecorate(_classThis, null, _groupOrder_decorators, { kind: "accessor", name: "groupOrder", static: false, private: false, access: { has: obj => "groupOrder" in obj, get: obj => obj.groupOrder, set: (obj, value) => { obj.groupOrder = value; } }, metadata: _metadata }, _groupOrder_initializers, _instanceExtraInitializers);
|
|
246
|
+
__esDecorate(_classThis, null, _sortEntryPoints_decorators, { kind: "accessor", name: "sortEntryPoints", static: false, private: false, access: { has: obj => "sortEntryPoints" in obj, get: obj => obj.sortEntryPoints, set: (obj, value) => { obj.sortEntryPoints = value; } }, metadata: _metadata }, _sortEntryPoints_initializers, _instanceExtraInitializers);
|
|
247
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
248
|
+
GroupPlugin = _classThis = _classDescriptor.value;
|
|
249
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
250
|
+
})();
|
|
251
|
+
_classThis.WEIGHTS = [];
|
|
252
|
+
(() => {
|
|
253
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
254
|
+
})();
|
|
255
|
+
return GroupPlugin = _classThis;
|
|
256
|
+
})();
|
|
166
257
|
exports.GroupPlugin = GroupPlugin;
|
|
167
|
-
GroupPlugin.WEIGHTS = [];
|
|
168
|
-
__decorate([
|
|
169
|
-
(0, utils_1.BindOption)("searchGroupBoosts")
|
|
170
|
-
], GroupPlugin.prototype, "boosts", void 0);
|
|
171
|
-
__decorate([
|
|
172
|
-
(0, utils_1.BindOption)("groupOrder")
|
|
173
|
-
], GroupPlugin.prototype, "groupOrder", void 0);
|
|
174
|
-
exports.GroupPlugin = GroupPlugin = GroupPlugin_1 = __decorate([
|
|
175
|
-
(0, components_1.Component)({ name: "group" })
|
|
176
|
-
], GroupPlugin);
|