@yumerijs/core 1.3.1 → 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 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.providedComponents[dep]);
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
- for (const componentName of pluginInstance.provide) {
274
- if (this.providedComponents[componentName]) {
275
- this.logger.error(`Component "${componentName}" is provided by multiple plugins: "${this.providedComponents[componentName]}" and "${pluginName}".`);
276
- }
277
- else {
278
- this.providedComponents[componentName] = pluginName;
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
- this.logger.warn(`Component "${name}" already registered by plugin "${this.providedComponents[name]}".`);
458
- return;
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.1",
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",