@pooder/core 2.0.0 → 2.1.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/CHANGELOG.md +6 -0
- package/dist/index.d.mts +100 -4
- package/dist/index.d.ts +100 -4
- package/dist/index.js +280 -4
- package/dist/index.mjs +278 -4
- package/package.json +1 -1
- package/src/command.ts +10 -10
- package/src/context.ts +17 -17
- package/src/contribution/index.ts +12 -12
- package/src/contribution/points.ts +27 -3
- package/src/contribution/registry.ts +118 -118
- package/src/disposable.ts +3 -3
- package/src/extension.ts +171 -164
- package/src/index.ts +161 -145
- package/src/run-test-full.ts +98 -98
- package/src/services/CommandService.ts +79 -79
- package/src/services/ConfigurationService.ts +107 -107
- package/src/services/ToolRegistryService.ts +41 -0
- package/src/services/ToolSessionService.ts +176 -0
- package/src/services/WorkbenchService.ts +138 -9
- package/src/services/index.ts +9 -1
- package/src/test-extension-full.ts +79 -79
|
@@ -1,118 +1,118 @@
|
|
|
1
|
-
import { Contribution, ContributionPoint, ContributionPointIds } from "./index";
|
|
2
|
-
import Disposable from "../disposable";
|
|
3
|
-
|
|
4
|
-
export class ContributionRegistry {
|
|
5
|
-
private points: Map<string, ContributionPoint> = new Map();
|
|
6
|
-
private contributions = {
|
|
7
|
-
byId: new Map<string, Contribution>(),
|
|
8
|
-
byPointId: new Map<string, Contribution[]>(),
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Register a new contribution point
|
|
13
|
-
*/
|
|
14
|
-
registerPoint<T>(point: ContributionPoint<T>): void {
|
|
15
|
-
if (this.points.has(point.id)) {
|
|
16
|
-
console.warn(
|
|
17
|
-
`Contribution point ${point.id} already exists. Overwriting definitions may cause issues.`,
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
this.points.set(point.id, point);
|
|
21
|
-
if (!this.contributions.byPointId.has(point.id)) {
|
|
22
|
-
this.contributions.byPointId.set(point.id, []);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Register a contribution to a specific point
|
|
28
|
-
* @returns Disposable to unregister the contribution
|
|
29
|
-
*/
|
|
30
|
-
register<T>(pointId: string, contribution: Contribution<T>): Disposable {
|
|
31
|
-
if (this.contributions.byId.has(contribution.id)) {
|
|
32
|
-
console.warn(
|
|
33
|
-
`Contribution with ID "${contribution.id}" is already registered. Overwriting.`,
|
|
34
|
-
);
|
|
35
|
-
// We could choose to throw, or overwrite. Let's overwrite for now but warn.
|
|
36
|
-
// If we overwrite, we should probably remove the old one from the list first to avoid duplicates.
|
|
37
|
-
this.unregister(pointId, contribution.id);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (!this.points.has(pointId)) {
|
|
41
|
-
console.warn(
|
|
42
|
-
`Contribution point ${pointId} does not exist. The contribution ${contribution.id} will be queued but may not be valid.`,
|
|
43
|
-
);
|
|
44
|
-
if (!this.contributions.byPointId.has(pointId)) {
|
|
45
|
-
this.contributions.byPointId.set(pointId, []);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const point = this.points.get(pointId);
|
|
50
|
-
if (point?.validate) {
|
|
51
|
-
try {
|
|
52
|
-
if (!point.validate(contribution.data)) {
|
|
53
|
-
console.error(
|
|
54
|
-
`Contribution ${contribution.id} failed validation for point ${pointId}.`,
|
|
55
|
-
);
|
|
56
|
-
return { dispose: () => {} };
|
|
57
|
-
}
|
|
58
|
-
} catch (e) {
|
|
59
|
-
console.error(
|
|
60
|
-
`Validation error for contribution ${contribution.id}:`,
|
|
61
|
-
e,
|
|
62
|
-
);
|
|
63
|
-
return { dispose: () => {} };
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const arr = this.contributions.byPointId.get(pointId)!;
|
|
68
|
-
|
|
69
|
-
arr.push(contribution);
|
|
70
|
-
this.contributions.byId.set(contribution.id, contribution);
|
|
71
|
-
|
|
72
|
-
// Auto-register if this is a contribution point contribution
|
|
73
|
-
if (pointId === ContributionPointIds.CONTRIBUTIONS) {
|
|
74
|
-
this.registerPoint(contribution.data as ContributionPoint);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return {
|
|
78
|
-
dispose: () => {
|
|
79
|
-
this.unregister(pointId, contribution.id);
|
|
80
|
-
},
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Get all contributions for a given point
|
|
86
|
-
*/
|
|
87
|
-
get<T>(pointId: string): Contribution<T>[] {
|
|
88
|
-
return Array.from(
|
|
89
|
-
this.contributions.byPointId.get(pointId)?.values() || [],
|
|
90
|
-
) as Contribution<T>[];
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Get a specific contribution by ID
|
|
95
|
-
*/
|
|
96
|
-
getById<T>(id: string): Contribution<T> | undefined {
|
|
97
|
-
return this.contributions.byId.get(id) as Contribution<T> | undefined;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Get the contribution point definition
|
|
102
|
-
*/
|
|
103
|
-
getPoint(pointId: string): ContributionPoint | undefined {
|
|
104
|
-
return this.points.get(pointId);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Unregister a contribution
|
|
109
|
-
*/
|
|
110
|
-
private unregister(pointId: string, contributionId: string): void {
|
|
111
|
-
const arr = this.contributions.byPointId.get(pointId);
|
|
112
|
-
arr?.splice(
|
|
113
|
-
arr.findIndex((c) => c.id === contributionId),
|
|
114
|
-
1,
|
|
115
|
-
);
|
|
116
|
-
this.contributions.byId.delete(contributionId);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
1
|
+
import { Contribution, ContributionPoint, ContributionPointIds } from "./index";
|
|
2
|
+
import Disposable from "../disposable";
|
|
3
|
+
|
|
4
|
+
export class ContributionRegistry {
|
|
5
|
+
private points: Map<string, ContributionPoint> = new Map();
|
|
6
|
+
private contributions = {
|
|
7
|
+
byId: new Map<string, Contribution>(),
|
|
8
|
+
byPointId: new Map<string, Contribution[]>(),
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Register a new contribution point
|
|
13
|
+
*/
|
|
14
|
+
registerPoint<T>(point: ContributionPoint<T>): void {
|
|
15
|
+
if (this.points.has(point.id)) {
|
|
16
|
+
console.warn(
|
|
17
|
+
`Contribution point ${point.id} already exists. Overwriting definitions may cause issues.`,
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
this.points.set(point.id, point);
|
|
21
|
+
if (!this.contributions.byPointId.has(point.id)) {
|
|
22
|
+
this.contributions.byPointId.set(point.id, []);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Register a contribution to a specific point
|
|
28
|
+
* @returns Disposable to unregister the contribution
|
|
29
|
+
*/
|
|
30
|
+
register<T>(pointId: string, contribution: Contribution<T>): Disposable {
|
|
31
|
+
if (this.contributions.byId.has(contribution.id)) {
|
|
32
|
+
console.warn(
|
|
33
|
+
`Contribution with ID "${contribution.id}" is already registered. Overwriting.`,
|
|
34
|
+
);
|
|
35
|
+
// We could choose to throw, or overwrite. Let's overwrite for now but warn.
|
|
36
|
+
// If we overwrite, we should probably remove the old one from the list first to avoid duplicates.
|
|
37
|
+
this.unregister(pointId, contribution.id);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (!this.points.has(pointId)) {
|
|
41
|
+
console.warn(
|
|
42
|
+
`Contribution point ${pointId} does not exist. The contribution ${contribution.id} will be queued but may not be valid.`,
|
|
43
|
+
);
|
|
44
|
+
if (!this.contributions.byPointId.has(pointId)) {
|
|
45
|
+
this.contributions.byPointId.set(pointId, []);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const point = this.points.get(pointId);
|
|
50
|
+
if (point?.validate) {
|
|
51
|
+
try {
|
|
52
|
+
if (!point.validate(contribution.data)) {
|
|
53
|
+
console.error(
|
|
54
|
+
`Contribution ${contribution.id} failed validation for point ${pointId}.`,
|
|
55
|
+
);
|
|
56
|
+
return { dispose: () => {} };
|
|
57
|
+
}
|
|
58
|
+
} catch (e) {
|
|
59
|
+
console.error(
|
|
60
|
+
`Validation error for contribution ${contribution.id}:`,
|
|
61
|
+
e,
|
|
62
|
+
);
|
|
63
|
+
return { dispose: () => {} };
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const arr = this.contributions.byPointId.get(pointId)!;
|
|
68
|
+
|
|
69
|
+
arr.push(contribution);
|
|
70
|
+
this.contributions.byId.set(contribution.id, contribution);
|
|
71
|
+
|
|
72
|
+
// Auto-register if this is a contribution point contribution
|
|
73
|
+
if (pointId === ContributionPointIds.CONTRIBUTIONS) {
|
|
74
|
+
this.registerPoint(contribution.data as ContributionPoint);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return {
|
|
78
|
+
dispose: () => {
|
|
79
|
+
this.unregister(pointId, contribution.id);
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Get all contributions for a given point
|
|
86
|
+
*/
|
|
87
|
+
get<T>(pointId: string): Contribution<T>[] {
|
|
88
|
+
return Array.from(
|
|
89
|
+
this.contributions.byPointId.get(pointId)?.values() || [],
|
|
90
|
+
) as Contribution<T>[];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Get a specific contribution by ID
|
|
95
|
+
*/
|
|
96
|
+
getById<T>(id: string): Contribution<T> | undefined {
|
|
97
|
+
return this.contributions.byId.get(id) as Contribution<T> | undefined;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Get the contribution point definition
|
|
102
|
+
*/
|
|
103
|
+
getPoint(pointId: string): ContributionPoint | undefined {
|
|
104
|
+
return this.points.get(pointId);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Unregister a contribution
|
|
109
|
+
*/
|
|
110
|
+
private unregister(pointId: string, contributionId: string): void {
|
|
111
|
+
const arr = this.contributions.byPointId.get(pointId);
|
|
112
|
+
arr?.splice(
|
|
113
|
+
arr.findIndex((c) => c.id === contributionId),
|
|
114
|
+
1,
|
|
115
|
+
);
|
|
116
|
+
this.contributions.byId.delete(contributionId);
|
|
117
|
+
}
|
|
118
|
+
}
|
package/src/disposable.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export default interface Disposable {
|
|
2
|
-
dispose(): void;
|
|
3
|
-
}
|
|
1
|
+
export default interface Disposable {
|
|
2
|
+
dispose(): void;
|
|
3
|
+
}
|
package/src/extension.ts
CHANGED
|
@@ -1,164 +1,171 @@
|
|
|
1
|
-
import { ExtensionContext } from "./context";
|
|
2
|
-
import { Contribution, ContributionPointIds } from "./contribution";
|
|
3
|
-
import Disposable from "./disposable";
|
|
4
|
-
import CommandService from "./services/CommandService";
|
|
5
|
-
import { ConfigurationService } from "./services";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
private
|
|
25
|
-
private
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
this
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
this.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
console.
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
this
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
1
|
+
import { ExtensionContext } from "./context";
|
|
2
|
+
import { Contribution, ContributionPointIds } from "./contribution";
|
|
3
|
+
import Disposable from "./disposable";
|
|
4
|
+
import CommandService from "./services/CommandService";
|
|
5
|
+
import { ConfigurationService } from "./services";
|
|
6
|
+
import ToolRegistryService from "./services/ToolRegistryService";
|
|
7
|
+
|
|
8
|
+
interface ExtensionMetadata {
|
|
9
|
+
name: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface Extension {
|
|
13
|
+
id: string;
|
|
14
|
+
metadata?: Partial<ExtensionMetadata>;
|
|
15
|
+
|
|
16
|
+
activate(context: ExtensionContext): void;
|
|
17
|
+
deactivate(context: ExtensionContext): void;
|
|
18
|
+
contribute?(): Record<string, any[]>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
class ExtensionRegistry extends Map<string, Extension> {}
|
|
22
|
+
|
|
23
|
+
class ExtensionManager {
|
|
24
|
+
private readonly context: ExtensionContext;
|
|
25
|
+
private extensionRegistry: ExtensionRegistry = new ExtensionRegistry();
|
|
26
|
+
private extensionDisposables: Map<string, Disposable[]> = new Map();
|
|
27
|
+
|
|
28
|
+
constructor(context: ExtensionContext) {
|
|
29
|
+
this.context = context;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
register(extension: Extension) {
|
|
33
|
+
if (this.extensionRegistry.has(extension.id)) {
|
|
34
|
+
console.warn(
|
|
35
|
+
`Plugin "${extension.id}" already registered. It will be overwritten.`,
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Initialize disposables for this extension
|
|
40
|
+
this.extensionDisposables.set(extension.id, []);
|
|
41
|
+
const disposables = this.extensionDisposables.get(extension.id)!;
|
|
42
|
+
|
|
43
|
+
// Process declarative contributions
|
|
44
|
+
if (extension.contribute) {
|
|
45
|
+
for (const [pointId, items] of Object.entries(extension.contribute())) {
|
|
46
|
+
if (Array.isArray(items)) {
|
|
47
|
+
items.forEach((item, index) => {
|
|
48
|
+
const contributionId =
|
|
49
|
+
item.id ||
|
|
50
|
+
(item.command
|
|
51
|
+
? item.command
|
|
52
|
+
: `${extension.id}.${pointId}.${index}`);
|
|
53
|
+
const contribution: Contribution = {
|
|
54
|
+
id: contributionId,
|
|
55
|
+
metadata: {
|
|
56
|
+
extensionId: extension.id,
|
|
57
|
+
...item?.metadata,
|
|
58
|
+
},
|
|
59
|
+
data: item,
|
|
60
|
+
};
|
|
61
|
+
const disposable = this.context.contributions.register(
|
|
62
|
+
pointId,
|
|
63
|
+
contribution,
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
// Track contribution registration to unregister later
|
|
67
|
+
disposables.push(disposable);
|
|
68
|
+
|
|
69
|
+
const dispose = this.collectContribution(pointId, contribution);
|
|
70
|
+
if (dispose) {
|
|
71
|
+
disposables.push(dispose);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
try {
|
|
79
|
+
this.extensionRegistry.set(extension.id, extension);
|
|
80
|
+
this.context.eventBus.emit("extension:register", extension);
|
|
81
|
+
} catch (error) {
|
|
82
|
+
console.error(
|
|
83
|
+
`Error in onCreate hook for plugin "${extension.id}":`,
|
|
84
|
+
error,
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
try {
|
|
89
|
+
extension.activate(this.context);
|
|
90
|
+
} catch (error) {
|
|
91
|
+
console.error(
|
|
92
|
+
`Error in onActivate hook for plugin "${extension.id}":`,
|
|
93
|
+
error,
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
console.log(`Plugin "${extension.id}" registered successfully`);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
collectContribution(pointId: string, item: any): Disposable | undefined {
|
|
101
|
+
// If registering configurations, update ConfigurationService defaults
|
|
102
|
+
if (pointId === ContributionPointIds.CONFIGURATIONS) {
|
|
103
|
+
const configService = this.context.services.get<ConfigurationService>(
|
|
104
|
+
"ConfigurationService",
|
|
105
|
+
);
|
|
106
|
+
configService?.initializeDefaults([item.data]);
|
|
107
|
+
}
|
|
108
|
+
if (pointId === ContributionPointIds.COMMANDS && item.data.handler) {
|
|
109
|
+
const commandService =
|
|
110
|
+
this.context.services.get<CommandService>("CommandService")!;
|
|
111
|
+
|
|
112
|
+
return commandService.registerCommand(item.id, item.data.handler);
|
|
113
|
+
}
|
|
114
|
+
if (pointId === ContributionPointIds.TOOLS) {
|
|
115
|
+
const toolRegistry =
|
|
116
|
+
this.context.services.get<ToolRegistryService>("ToolRegistryService");
|
|
117
|
+
if (!toolRegistry) return;
|
|
118
|
+
return toolRegistry.registerTool(item.data);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
unregister(name: string) {
|
|
123
|
+
const extension = this.extensionRegistry.get(name);
|
|
124
|
+
if (!extension) {
|
|
125
|
+
console.warn(`Plugin "${name}" not found.`);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
try {
|
|
130
|
+
extension.deactivate(this.context);
|
|
131
|
+
} catch (error) {
|
|
132
|
+
console.error(`Error in deactivate for plugin "${name}":`, error);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Dispose all resources associated with this extension
|
|
136
|
+
const disposables = this.extensionDisposables.get(name);
|
|
137
|
+
if (disposables) {
|
|
138
|
+
disposables.forEach((d) => d.dispose());
|
|
139
|
+
this.extensionDisposables.delete(name);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
this.extensionRegistry.delete(name);
|
|
143
|
+
console.log(`Plugin "${name}" unregistered`);
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
enable(name: string) {
|
|
148
|
+
const extension = this.extensionRegistry.get(name);
|
|
149
|
+
if (!extension) {
|
|
150
|
+
console.warn(`Plugin "${name}" not found.`);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
disable(name: string) {
|
|
156
|
+
const extension = this.extensionRegistry.get(name);
|
|
157
|
+
if (!extension) {
|
|
158
|
+
console.warn(`Plugin "${name}" not found.`);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
update() {}
|
|
164
|
+
|
|
165
|
+
destroy() {
|
|
166
|
+
const extensionNames = Array.from(this.extensionRegistry.keys());
|
|
167
|
+
extensionNames.forEach((name) => this.unregister(name));
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export { Extension, ExtensionMetadata, ExtensionRegistry, ExtensionManager };
|