@yumerijs/core 1.3.0 → 1.3.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/core.d.ts +0 -3
- package/dist/core.js +15 -17
- package/package.json +8 -2
package/dist/core.d.ts
CHANGED
|
@@ -51,9 +51,6 @@ export declare class Core {
|
|
|
51
51
|
routes: Record<string, Route>;
|
|
52
52
|
pluginLoader: PluginLoader;
|
|
53
53
|
logger: Logger;
|
|
54
|
-
providedComponents: {
|
|
55
|
-
[name: string]: string;
|
|
56
|
-
};
|
|
57
54
|
globalMiddlewares: Record<string, Middleware>;
|
|
58
55
|
pluginStatus: Record<string, PluginStatus>;
|
|
59
56
|
hooks: Record<string, Hook>;
|
package/dist/core.js
CHANGED
|
@@ -57,7 +57,6 @@ class Core {
|
|
|
57
57
|
routes = {};
|
|
58
58
|
pluginLoader;
|
|
59
59
|
logger = new logger_1.Logger('core');
|
|
60
|
-
providedComponents = {};
|
|
61
60
|
globalMiddlewares = {};
|
|
62
61
|
pluginStatus = {};
|
|
63
62
|
hooks = {};
|
|
@@ -257,7 +256,7 @@ class Core {
|
|
|
257
256
|
throw new Error('Plugin loader returned no instance.');
|
|
258
257
|
}
|
|
259
258
|
const deps = pluginInstance.depend || [];
|
|
260
|
-
const unmetDependencies = deps.filter(dep => !this.
|
|
259
|
+
const unmetDependencies = deps.filter(dep => !this.components[dep]);
|
|
261
260
|
if (unmetDependencies.length > 0) {
|
|
262
261
|
// this.logger.info(`Plugin "${pluginName}" has unmet dependencies: [${unmetDependencies.join(', ')}]. Will retry later.`);
|
|
263
262
|
return false;
|
|
@@ -269,16 +268,15 @@ class Core {
|
|
|
269
268
|
await pluginInstance.apply(this.getContext(pluginName), await this.getPluginConfig(pluginName));
|
|
270
269
|
}
|
|
271
270
|
// 注册提供的组件
|
|
272
|
-
if (pluginInstance.provide) {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
}
|
|
271
|
+
// if (pluginInstance.provide) {
|
|
272
|
+
// for (const componentName of pluginInstance.provide) {
|
|
273
|
+
// if (this.components[componentName]) {
|
|
274
|
+
// this.logger.error(`Component "${componentName}" is provided by multiple plugins: "${this.providedComponents[componentName]}" and "${pluginName}".`);
|
|
275
|
+
// } else {
|
|
276
|
+
// this.components[componentName] = pluginName;
|
|
277
|
+
// }
|
|
278
|
+
// }
|
|
279
|
+
// }
|
|
282
280
|
this.pluginStatus[pluginName] = "enabled" /* PluginStatus.ENABLED */; // 更新状态为已启用
|
|
283
281
|
// 加载成功后,检查是否可以加载其他等待中的插件
|
|
284
282
|
if (triggerPendingCheck) {
|
|
@@ -453,10 +451,10 @@ class Core {
|
|
|
453
451
|
* @param component 组件实例
|
|
454
452
|
*/
|
|
455
453
|
registerComponent(name, component) {
|
|
456
|
-
if (this.components.hasOwnProperty(name)) {
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
}
|
|
454
|
+
// if (this.components.hasOwnProperty(name)) {
|
|
455
|
+
// this.logger.warn(`Component "${name}" already registered by plugin "${this.providedComponents[name]}".`);
|
|
456
|
+
// return;
|
|
457
|
+
// }
|
|
460
458
|
this.components[name] = component;
|
|
461
459
|
// this.logger.info(`Component "${name}" registered.`);
|
|
462
460
|
}
|
|
@@ -474,7 +472,7 @@ class Core {
|
|
|
474
472
|
*/
|
|
475
473
|
unregisterComponent(name) {
|
|
476
474
|
delete this.components[name];
|
|
477
|
-
delete this.providedComponents[name];
|
|
475
|
+
// delete this.providedComponents[name];
|
|
478
476
|
}
|
|
479
477
|
/**
|
|
480
478
|
* 注册事件监听器
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yumerijs/core",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "Core module for yumeri",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -26,15 +26,21 @@
|
|
|
26
26
|
},
|
|
27
27
|
"homepage": "https://github.com/yumerijs/yumeri#readme",
|
|
28
28
|
"devDependencies": {
|
|
29
|
+
"@types/formidable": "^3",
|
|
29
30
|
"@types/js-yaml": "^4.0.9",
|
|
31
|
+
"@types/mime-types": "^3",
|
|
30
32
|
"@types/node": "^22.13.10",
|
|
33
|
+
"@types/ws": "^8",
|
|
31
34
|
"typescript": "^5.8.2"
|
|
32
35
|
},
|
|
33
36
|
"dependencies": {
|
|
34
37
|
"@yumerijs/loader": "^1.2.0",
|
|
35
38
|
"chokidar": "^4.0.3",
|
|
39
|
+
"formidable": "^3.5.4",
|
|
36
40
|
"js-yaml": "^4.1.0",
|
|
37
|
-
"
|
|
41
|
+
"mime-types": "^3.0.1",
|
|
42
|
+
"picocolors": "^1.1.1",
|
|
43
|
+
"ws": "^8.18.3"
|
|
38
44
|
},
|
|
39
45
|
"packageManager": "yarn@4.9.1"
|
|
40
46
|
}
|