@ice/mf-runtime 1.0.1 → 1.0.2-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/README.md +221 -1
- package/es2017/RemoteModule.js +35 -16
- package/es2017/__tests__/plugin-manager.test.d.ts +1 -0
- package/es2017/__tests__/plugin-manager.test.js +294 -0
- package/es2017/__tests__/setup.d.ts +1 -0
- package/es2017/__tests__/setup.js +28 -0
- package/es2017/index.d.ts +2 -0
- package/es2017/index.js +4 -2
- package/es2017/plugin-manager.d.ts +79 -0
- package/es2017/plugin-manager.js +134 -0
- package/es2017/runtime-plugin.js +3 -2
- package/es2017/types.d.ts +27 -0
- package/es2017/types.js +2 -1
- package/esm/RemoteModule.js +34 -26
- package/esm/__tests__/plugin-manager.test.d.ts +1 -0
- package/esm/__tests__/plugin-manager.test.js +348 -0
- package/esm/__tests__/setup.d.ts +1 -0
- package/esm/__tests__/setup.js +43 -0
- package/esm/index.d.ts +2 -0
- package/esm/index.js +4 -2
- package/esm/plugin-manager.d.ts +79 -0
- package/esm/plugin-manager.js +207 -0
- package/esm/runtime-plugin.js +3 -2
- package/esm/types.d.ts +27 -0
- package/esm/types.js +2 -1
- package/package.json +12 -2
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
|
+
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
3
|
+
import { describe, it, expect, beforeEach, vi } from "vitest";
|
|
4
|
+
import { EnhancedPluginManager, getEnhancedPluginManager, registerEnhancedPlugin, registerEnhancedPlugins } from "../plugin-manager";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
describe("EnhancedPluginManager", function() {
|
|
7
|
+
var manager;
|
|
8
|
+
beforeEach(function() {
|
|
9
|
+
manager = new EnhancedPluginManager();
|
|
10
|
+
});
|
|
11
|
+
describe("Plugin Registration", function() {
|
|
12
|
+
it("should register an enhanced plugin", function() {
|
|
13
|
+
var enhancedPlugin = {
|
|
14
|
+
name: "test-enhanced",
|
|
15
|
+
wrapComponent: function(Component) {
|
|
16
|
+
return Component;
|
|
17
|
+
},
|
|
18
|
+
injectProps: function(props) {
|
|
19
|
+
return props;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
manager.register(enhancedPlugin);
|
|
23
|
+
var plugins = manager.getPlugins();
|
|
24
|
+
expect(plugins).toHaveLength(1);
|
|
25
|
+
expect(plugins[0].name).toBe("test-enhanced");
|
|
26
|
+
});
|
|
27
|
+
it("should replace existing plugin with same name", function() {
|
|
28
|
+
var plugin1 = {
|
|
29
|
+
name: "test-plugin",
|
|
30
|
+
wrapComponent: function(Component) {
|
|
31
|
+
return Component;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var plugin2 = {
|
|
35
|
+
name: "test-plugin",
|
|
36
|
+
injectProps: function(props) {
|
|
37
|
+
return props;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
manager.register(plugin1);
|
|
41
|
+
manager.register(plugin2);
|
|
42
|
+
var plugins = manager.getPlugins();
|
|
43
|
+
expect(plugins).toHaveLength(1);
|
|
44
|
+
expect(plugins[0]).toBe(plugin2);
|
|
45
|
+
});
|
|
46
|
+
it("should register multiple plugins", function() {
|
|
47
|
+
var plugins = [
|
|
48
|
+
{
|
|
49
|
+
name: "plugin1",
|
|
50
|
+
wrapComponent: function(Component) {
|
|
51
|
+
return Component;
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: "plugin2",
|
|
56
|
+
injectProps: function(props) {
|
|
57
|
+
return props;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
];
|
|
61
|
+
manager.registerPlugins(plugins);
|
|
62
|
+
expect(manager.getPlugins()).toHaveLength(2);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
describe("Component Wrapping", function() {
|
|
66
|
+
it("should wrap component with single plugin", function() {
|
|
67
|
+
var TestComponent = function() {
|
|
68
|
+
return React.createElement("div", null, "test");
|
|
69
|
+
};
|
|
70
|
+
var mockWrapper = vi.fn(function(Component) {
|
|
71
|
+
return Component;
|
|
72
|
+
});
|
|
73
|
+
var plugin = {
|
|
74
|
+
name: "wrapper-plugin",
|
|
75
|
+
wrapComponent: mockWrapper
|
|
76
|
+
};
|
|
77
|
+
manager.register(plugin);
|
|
78
|
+
var context = {
|
|
79
|
+
remoteName: "test-remote",
|
|
80
|
+
moduleName: "test-module",
|
|
81
|
+
props: {
|
|
82
|
+
test: true
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
var wrappedComponent = manager.wrapComponent(TestComponent, context);
|
|
86
|
+
expect(mockWrapper).toHaveBeenCalledWith(TestComponent, context);
|
|
87
|
+
expect(wrappedComponent).toBe(TestComponent);
|
|
88
|
+
});
|
|
89
|
+
it("should apply multiple wrappers in order", function() {
|
|
90
|
+
var TestComponent = function() {
|
|
91
|
+
return React.createElement("div", null, "original");
|
|
92
|
+
};
|
|
93
|
+
var Wrapper1 = function() {
|
|
94
|
+
return React.createElement("div", null, "wrapper1");
|
|
95
|
+
};
|
|
96
|
+
var Wrapper2 = function() {
|
|
97
|
+
return React.createElement("div", null, "wrapper2");
|
|
98
|
+
};
|
|
99
|
+
var plugin1 = {
|
|
100
|
+
name: "wrapper1",
|
|
101
|
+
wrapComponent: function() {
|
|
102
|
+
return Wrapper1;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
var plugin2 = {
|
|
106
|
+
name: "wrapper2",
|
|
107
|
+
wrapComponent: function() {
|
|
108
|
+
return Wrapper2;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
// 注册顺序很重要
|
|
112
|
+
manager.register(plugin1);
|
|
113
|
+
manager.register(plugin2);
|
|
114
|
+
var context = {
|
|
115
|
+
remoteName: "test-remote",
|
|
116
|
+
moduleName: "test-module",
|
|
117
|
+
props: {}
|
|
118
|
+
};
|
|
119
|
+
var result = manager.wrapComponent(TestComponent, context);
|
|
120
|
+
// plugin2 应该最后执行,所以返回 Wrapper2
|
|
121
|
+
expect(result).toBe(Wrapper2);
|
|
122
|
+
});
|
|
123
|
+
it("should handle wrapper errors gracefully", function() {
|
|
124
|
+
var TestComponent = function() {
|
|
125
|
+
return React.createElement("div", null, "test");
|
|
126
|
+
};
|
|
127
|
+
var consoleSpy = vi.spyOn(console, "error").mockImplementation(function() {});
|
|
128
|
+
var plugin = {
|
|
129
|
+
name: "error-plugin",
|
|
130
|
+
wrapComponent: function() {
|
|
131
|
+
throw new Error("Wrapper error");
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
manager.register(plugin);
|
|
135
|
+
var context = {
|
|
136
|
+
remoteName: "test-remote",
|
|
137
|
+
moduleName: "test-module",
|
|
138
|
+
props: {}
|
|
139
|
+
};
|
|
140
|
+
var result = manager.wrapComponent(TestComponent, context);
|
|
141
|
+
expect(consoleSpy).toHaveBeenCalledWith(expect.stringContaining('Error applying wrapper from plugin "error-plugin"'), expect.any(Error));
|
|
142
|
+
expect(result).toBe(TestComponent); // 应该返回原始组件
|
|
143
|
+
consoleSpy.mockRestore();
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
describe("Props Injection", function() {
|
|
147
|
+
it("should inject props with single plugin", function() {
|
|
148
|
+
var mockInjector = vi.fn(function(props) {
|
|
149
|
+
return _object_spread_props(_object_spread({}, props), {
|
|
150
|
+
injected: true
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
var plugin = {
|
|
154
|
+
name: "injector-plugin",
|
|
155
|
+
injectProps: mockInjector
|
|
156
|
+
};
|
|
157
|
+
manager.register(plugin);
|
|
158
|
+
var context = {
|
|
159
|
+
remoteName: "test-remote",
|
|
160
|
+
moduleName: "test-module"
|
|
161
|
+
};
|
|
162
|
+
var result = manager.injectProps({
|
|
163
|
+
original: true
|
|
164
|
+
}, context);
|
|
165
|
+
expect(mockInjector).toHaveBeenCalledWith({
|
|
166
|
+
original: true
|
|
167
|
+
}, context);
|
|
168
|
+
expect(result).toEqual({
|
|
169
|
+
original: true,
|
|
170
|
+
injected: true
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
it("should apply multiple injectors in order", function() {
|
|
174
|
+
var plugin1 = {
|
|
175
|
+
name: "injector1",
|
|
176
|
+
injectProps: function(props) {
|
|
177
|
+
return _object_spread_props(_object_spread({}, props), {
|
|
178
|
+
step1: true
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
var plugin2 = {
|
|
183
|
+
name: "injector2",
|
|
184
|
+
injectProps: function(props) {
|
|
185
|
+
return _object_spread_props(_object_spread({}, props), {
|
|
186
|
+
step2: true
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
manager.register(plugin1);
|
|
191
|
+
manager.register(plugin2);
|
|
192
|
+
var context = {
|
|
193
|
+
remoteName: "test-remote",
|
|
194
|
+
moduleName: "test-module"
|
|
195
|
+
};
|
|
196
|
+
var result = manager.injectProps({
|
|
197
|
+
original: true
|
|
198
|
+
}, context);
|
|
199
|
+
expect(result).toEqual({
|
|
200
|
+
original: true,
|
|
201
|
+
step1: true,
|
|
202
|
+
step2: true
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
it("should handle injection errors gracefully", function() {
|
|
206
|
+
var consoleSpy = vi.spyOn(console, "error").mockImplementation(function() {});
|
|
207
|
+
var plugin = {
|
|
208
|
+
name: "error-plugin",
|
|
209
|
+
injectProps: function() {
|
|
210
|
+
throw new Error("Injection error");
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
manager.register(plugin);
|
|
214
|
+
var context = {
|
|
215
|
+
remoteName: "test-remote",
|
|
216
|
+
moduleName: "test-module"
|
|
217
|
+
};
|
|
218
|
+
var result = manager.injectProps({
|
|
219
|
+
original: true
|
|
220
|
+
}, context);
|
|
221
|
+
expect(consoleSpy).toHaveBeenCalledWith(expect.stringContaining('Error injecting props from plugin "error-plugin"'), expect.any(Error));
|
|
222
|
+
expect(result).toEqual({
|
|
223
|
+
original: true
|
|
224
|
+
}); // 应该返回原始props
|
|
225
|
+
consoleSpy.mockRestore();
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
describe("Plugin Management", function() {
|
|
229
|
+
it("should get plugin info", function() {
|
|
230
|
+
var wrapperPlugin = {
|
|
231
|
+
name: "wrapper-plugin",
|
|
232
|
+
wrapComponent: function(Component) {
|
|
233
|
+
return Component;
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
var injectorPlugin = {
|
|
237
|
+
name: "injector-plugin",
|
|
238
|
+
injectProps: function(props) {
|
|
239
|
+
return props;
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
var hybridPlugin = {
|
|
243
|
+
name: "hybrid-plugin",
|
|
244
|
+
wrapComponent: function(Component) {
|
|
245
|
+
return Component;
|
|
246
|
+
},
|
|
247
|
+
injectProps: function(props) {
|
|
248
|
+
return props;
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
manager.register(wrapperPlugin);
|
|
252
|
+
manager.register(injectorPlugin);
|
|
253
|
+
manager.register(hybridPlugin);
|
|
254
|
+
var info = manager.getPluginInfo();
|
|
255
|
+
expect(info).toHaveLength(3);
|
|
256
|
+
expect(info[0]).toEqual({
|
|
257
|
+
name: "wrapper-plugin",
|
|
258
|
+
hasWrapper: true,
|
|
259
|
+
hasInjector: false
|
|
260
|
+
});
|
|
261
|
+
expect(info[1]).toEqual({
|
|
262
|
+
name: "injector-plugin",
|
|
263
|
+
hasWrapper: false,
|
|
264
|
+
hasInjector: true
|
|
265
|
+
});
|
|
266
|
+
expect(info[2]).toEqual({
|
|
267
|
+
name: "hybrid-plugin",
|
|
268
|
+
hasWrapper: true,
|
|
269
|
+
hasInjector: true
|
|
270
|
+
});
|
|
271
|
+
});
|
|
272
|
+
it("should remove plugin", function() {
|
|
273
|
+
var plugin = {
|
|
274
|
+
name: "test-plugin",
|
|
275
|
+
wrapComponent: function(Component) {
|
|
276
|
+
return Component;
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
manager.register(plugin);
|
|
280
|
+
expect(manager.getPlugins()).toHaveLength(1);
|
|
281
|
+
var removed = manager.removePlugin("test-plugin");
|
|
282
|
+
expect(removed).toBe(true);
|
|
283
|
+
expect(manager.getPlugins()).toHaveLength(0);
|
|
284
|
+
});
|
|
285
|
+
it("should return false when removing non-existent plugin", function() {
|
|
286
|
+
var removed = manager.removePlugin("non-existent");
|
|
287
|
+
expect(removed).toBe(false);
|
|
288
|
+
});
|
|
289
|
+
it("should clear all plugins", function() {
|
|
290
|
+
manager.register({
|
|
291
|
+
name: "plugin1",
|
|
292
|
+
wrapComponent: function(Component) {
|
|
293
|
+
return Component;
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
manager.register({
|
|
297
|
+
name: "plugin2",
|
|
298
|
+
injectProps: function(props) {
|
|
299
|
+
return props;
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
expect(manager.getPlugins()).toHaveLength(2);
|
|
303
|
+
manager.clear();
|
|
304
|
+
expect(manager.getPlugins()).toHaveLength(0);
|
|
305
|
+
});
|
|
306
|
+
});
|
|
307
|
+
describe("Global Enhanced Plugin Manager", function() {
|
|
308
|
+
beforeEach(function() {
|
|
309
|
+
// 清理全局状态
|
|
310
|
+
getEnhancedPluginManager().clear();
|
|
311
|
+
});
|
|
312
|
+
it("should provide singleton instance", function() {
|
|
313
|
+
var manager1 = getEnhancedPluginManager();
|
|
314
|
+
var manager2 = getEnhancedPluginManager();
|
|
315
|
+
expect(manager1).toBe(manager2);
|
|
316
|
+
});
|
|
317
|
+
it("should register plugin via convenience function", function() {
|
|
318
|
+
var plugin = {
|
|
319
|
+
name: "convenience-plugin",
|
|
320
|
+
wrapComponent: function(Component) {
|
|
321
|
+
return Component;
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
registerEnhancedPlugin(plugin);
|
|
325
|
+
var manager = getEnhancedPluginManager();
|
|
326
|
+
expect(manager.getPlugins()).toContainEqual(plugin);
|
|
327
|
+
});
|
|
328
|
+
it("should register multiple plugins via convenience function", function() {
|
|
329
|
+
var plugins = [
|
|
330
|
+
{
|
|
331
|
+
name: "plugin1",
|
|
332
|
+
wrapComponent: function(Component) {
|
|
333
|
+
return Component;
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
name: "plugin2",
|
|
338
|
+
injectProps: function(props) {
|
|
339
|
+
return props;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
];
|
|
343
|
+
registerEnhancedPlugins(plugins);
|
|
344
|
+
var manager = getEnhancedPluginManager();
|
|
345
|
+
expect(manager.getPlugins()).toHaveLength(2);
|
|
346
|
+
});
|
|
347
|
+
});
|
|
348
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
|
2
|
+
import { vi } from "vitest";
|
|
3
|
+
// Test setup for ice-mf-runtime
|
|
4
|
+
// Mock @ice/stark-app dependency
|
|
5
|
+
vi.mock("@ice/stark-app", function() {
|
|
6
|
+
return {
|
|
7
|
+
getBasename: function() {
|
|
8
|
+
return "/app";
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
});
|
|
12
|
+
// Mock @module-federation/runtime
|
|
13
|
+
vi.mock("@module-federation/runtime", function() {
|
|
14
|
+
return {
|
|
15
|
+
init: vi.fn(),
|
|
16
|
+
registerPlugins: vi.fn(),
|
|
17
|
+
loadRemote: vi.fn()
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
// Mock performance API
|
|
21
|
+
Object.defineProperty(globalThis, "performance", {
|
|
22
|
+
value: {
|
|
23
|
+
now: function() {
|
|
24
|
+
return Date.now();
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
writable: true
|
|
28
|
+
});
|
|
29
|
+
// Suppress console warnings during tests
|
|
30
|
+
var originalWarn = console.warn;
|
|
31
|
+
console.warn = function() {
|
|
32
|
+
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
33
|
+
args[_key] = arguments[_key];
|
|
34
|
+
}
|
|
35
|
+
var _originalWarn;
|
|
36
|
+
var _args__includes, _args_;
|
|
37
|
+
if ((_args_ = args[0]) === null || _args_ === void 0 ? void 0 : (_args__includes = _args_.includes) === null || _args__includes === void 0 ? void 0 : _args__includes.call(_args_, "Warning: ReactDOM.render is no longer supported")) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
(_originalWarn = originalWarn).call.apply(_originalWarn, [
|
|
41
|
+
console
|
|
42
|
+
].concat(_to_consumable_array(args)));
|
|
43
|
+
};
|
package/esm/index.d.ts
CHANGED
|
@@ -2,5 +2,7 @@ import type { ExtendedUserOptions, MicroMod } from './types';
|
|
|
2
2
|
export { loadRemote, registerPlugins } from '@module-federation/runtime';
|
|
3
3
|
export * from './FallBack';
|
|
4
4
|
export * from './RemoteModule';
|
|
5
|
+
export * from './types';
|
|
6
|
+
export * from './plugin-manager';
|
|
5
7
|
export declare function init(options: ExtendedUserOptions, microMods?: MicroMod[]): void;
|
|
6
8
|
export declare function initByMicroMods(microMods: MicroMod[], hostName?: string): void;
|
package/esm/index.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { getBasename } from "@ice/stark-app";
|
|
2
|
-
import { registerPlugins, init as mfInit } from "@module-federation/runtime";
|
|
2
|
+
import { registerPlugins as mfRegisterPlugins, init as mfInit } from "@module-federation/runtime";
|
|
3
3
|
import { runtimePlugin } from "./runtime-plugin";
|
|
4
4
|
import { initGlobalStore } from "./mf-global-store";
|
|
5
5
|
export { loadRemote, registerPlugins } from "@module-federation/runtime";
|
|
6
6
|
export * from "./FallBack";
|
|
7
7
|
export * from "./RemoteModule";
|
|
8
|
+
export * from "./types";
|
|
9
|
+
export * from "./plugin-manager";
|
|
8
10
|
export function init(options, microMods) {
|
|
9
11
|
initGlobalStore(options, microMods);
|
|
10
12
|
mfInit(options);
|
|
11
|
-
|
|
13
|
+
mfRegisterPlugins([
|
|
12
14
|
runtimePlugin()
|
|
13
15
|
]);
|
|
14
16
|
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { EnhancedRuntimePlugin, WrapperContext, InjectionContext } from './types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* 增强插件管理器 - 专门负责管理和执行增强运行时插件
|
|
5
|
+
* 标准 MF 插件交由底层 @module-federation/runtime 管理
|
|
6
|
+
*/
|
|
7
|
+
export declare class EnhancedPluginManager {
|
|
8
|
+
private plugins;
|
|
9
|
+
/**
|
|
10
|
+
* 注册增强插件
|
|
11
|
+
* @param plugin 增强运行时插件
|
|
12
|
+
*/
|
|
13
|
+
register(plugin: EnhancedRuntimePlugin): void;
|
|
14
|
+
/**
|
|
15
|
+
* 注册多个增强插件
|
|
16
|
+
* @param plugins 增强插件数组
|
|
17
|
+
*/
|
|
18
|
+
registerPlugins(plugins: EnhancedRuntimePlugin[]): void;
|
|
19
|
+
/**
|
|
20
|
+
* 获取所有增强插件列表
|
|
21
|
+
* @returns 增强插件数组
|
|
22
|
+
*/
|
|
23
|
+
getPlugins(): EnhancedRuntimePlugin[];
|
|
24
|
+
/**
|
|
25
|
+
* 应用组件包装器
|
|
26
|
+
* 按插件注册顺序依次应用所有组件包装器
|
|
27
|
+
* @param Component 原始组件
|
|
28
|
+
* @param context 包装器上下文
|
|
29
|
+
* @returns 包装后的组件
|
|
30
|
+
*/
|
|
31
|
+
wrapComponent(Component: React.ComponentType, context: WrapperContext): React.ComponentType;
|
|
32
|
+
/**
|
|
33
|
+
* 注入属性
|
|
34
|
+
* 按插件注册顺序依次应用所有属性注入器
|
|
35
|
+
* @param props 原始属性
|
|
36
|
+
* @param context 注入上下文
|
|
37
|
+
* @returns 注入后的属性
|
|
38
|
+
*/
|
|
39
|
+
injectProps(props: Record<string, any>, context: InjectionContext): Record<string, any>;
|
|
40
|
+
/**
|
|
41
|
+
* 获取所有插件信息
|
|
42
|
+
* @returns 插件信息数组
|
|
43
|
+
*/
|
|
44
|
+
getPluginInfo(): Array<{
|
|
45
|
+
name: string;
|
|
46
|
+
hasWrapper: boolean;
|
|
47
|
+
hasInjector: boolean;
|
|
48
|
+
}>;
|
|
49
|
+
/**
|
|
50
|
+
* 移除插件
|
|
51
|
+
* @param name 插件名称
|
|
52
|
+
* @returns 是否成功移除
|
|
53
|
+
*/
|
|
54
|
+
removePlugin(name: string): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* 清空所有插件
|
|
57
|
+
*/
|
|
58
|
+
clear(): void;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* 获取全局增强插件管理器实例
|
|
62
|
+
* @returns 增强插件管理器实例
|
|
63
|
+
*/
|
|
64
|
+
export declare function getEnhancedPluginManager(): EnhancedPluginManager;
|
|
65
|
+
/**
|
|
66
|
+
* 注册增强插件(便捷函数)
|
|
67
|
+
* @param plugin 增强运行时插件
|
|
68
|
+
*/
|
|
69
|
+
export declare function registerEnhancedPlugin(plugin: EnhancedRuntimePlugin): void;
|
|
70
|
+
/**
|
|
71
|
+
* 注册多个增强插件(便捷函数)
|
|
72
|
+
* @param plugins 增强插件数组
|
|
73
|
+
*/
|
|
74
|
+
export declare function registerEnhancedPlugins(plugins: EnhancedRuntimePlugin[]): void;
|
|
75
|
+
/**
|
|
76
|
+
* React Hook:使用增强插件管理器
|
|
77
|
+
* @returns 增强插件管理器实例
|
|
78
|
+
*/
|
|
79
|
+
export declare function useEnhancedPluginManager(): EnhancedPluginManager;
|