@yumerijs/core 1.3.2 → 1.3.3

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/context.d.ts CHANGED
@@ -6,6 +6,7 @@
6
6
  import { Core } from './core';
7
7
  import { Route } from './route';
8
8
  import { HookHandler } from './hook';
9
+ import { Middleware } from './middleware';
9
10
  /**
10
11
  * 插件上下文对象
11
12
  * 每个插件一个 Context,用于管理插件注册的命令、路由、事件、组件和中间件
@@ -44,7 +45,7 @@ export declare class Context {
44
45
  * @param name 中间件名称
45
46
  * @param callback 中间件回调函数
46
47
  */
47
- use(name: string, callback: Function): void;
48
+ use(name: string, callback: Middleware): void;
48
49
  /**
49
50
  * 注册 Hook 钩子
50
51
  * @param name Hook 点名称
package/dist/context.js CHANGED
@@ -57,7 +57,7 @@ class Context {
57
57
  */
58
58
  use(name, callback) {
59
59
  this.middlewares.push(name);
60
- this.core.use(name, async (...args) => callback(...args));
60
+ this.core.use(name, callback);
61
61
  }
62
62
  /**
63
63
  * 注册 Hook 钩子
@@ -141,7 +141,7 @@ class Context {
141
141
  });
142
142
  // 删除钩子
143
143
  for (const hook in this.hooks) {
144
- this.hooks.hook.forEach((hookname) => {
144
+ this.hooks[hook].forEach((hookname) => {
145
145
  this.core.unhook(hook, hookname);
146
146
  });
147
147
  }
package/dist/index.d.ts CHANGED
@@ -10,3 +10,4 @@ export * from './config';
10
10
  export * from './logger';
11
11
  export * from './context';
12
12
  export * from './hook';
13
+ export * from './middleware';
package/dist/index.js CHANGED
@@ -26,3 +26,4 @@ __exportStar(require("./config"), exports);
26
26
  __exportStar(require("./logger"), exports);
27
27
  __exportStar(require("./context"), exports);
28
28
  __exportStar(require("./hook"), exports);
29
+ __exportStar(require("./middleware"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yumerijs/core",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "description": "Core module for yumeri",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",