diff --git a/package.json b/package.json index 651d0518b..42bef3813 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,7 @@ "yakumo": "^1.0.0-beta.16", "yakumo-esbuild": "^1.0.0-beta.6", "yakumo-mocha": "^1.0.0-beta.2", - "yakumo-tsc": "^1.0.0-beta.3", + "yakumo-tsc": "^1.0.0-beta.4", "yml-register": "^1.2.5" } } diff --git a/packages/core/package.json b/packages/core/package.json index d6bd159c5..dc30078ed 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,7 +1,7 @@ { "name": "@koishijs/core", "description": "Core Features for Koishi", - "version": "4.17.8", + "version": "4.17.9", "main": "lib/index.cjs", "module": "lib/index.mjs", "typings": "lib/index.d.ts", @@ -33,10 +33,10 @@ "dependencies": { "@koishijs/i18n-utils": "^1.0.1", "@koishijs/utils": "^7.2.1", - "@satorijs/core": "^4.1.1", - "cordis": "^3.16.1", + "@satorijs/core": "^4.1.2", + "cordis": "^3.17.3", "cosmokit": "^1.6.2", "fastest-levenshtein": "^1.0.16", - "minato": "^3.4.0" + "minato": "^3.4.3" } } diff --git a/packages/core/src/context.ts b/packages/core/src/context.ts index 7c5dd67ea..982b46ae5 100644 --- a/packages/core/src/context.ts +++ b/packages/core/src/context.ts @@ -85,10 +85,10 @@ export class Context extends satori.Context { waterfall>(name: K, ...args: Parameters[K]>): Promisify[K]>> waterfall>(thisArg: ThisType[K]>, name: K, ...args: Parameters[K]>): Promisify[K]>> async waterfall(...args: [any, ...any[]]) { - const thisArg = typeof args[0] === 'object' ? args.shift() : null + const thisArg = typeof args[0] === 'object' || typeof args[0] === 'function' ? args.shift() : null const name = args.shift() - for (const callback of this.lifecycle.getHooks(name, thisArg)) { - const result = await callback.apply(thisArg, args) + for (const hook of this.lifecycle.filterHooks(this.lifecycle._hooks[name] || [], thisArg)) { + const result = await hook.callback.apply(thisArg, args) args[0] = result } return args[0] @@ -98,10 +98,10 @@ export class Context extends satori.Context { chain>(name: K, ...args: Parameters[K]>): ReturnType[K]> chain>(thisArg: ThisType[K]>, name: K, ...args: Parameters[K]>): ReturnType[K]> chain(...args: [any, ...any[]]) { - const thisArg = typeof args[0] === 'object' ? args.shift() : null + const thisArg = typeof args[0] === 'object' || typeof args[0] === 'function' ? args.shift() : null const name = args.shift() - for (const callback of this.lifecycle.getHooks(name, thisArg)) { - const result = callback.apply(thisArg, args) + for (const hook of this.lifecycle.filterHooks(this.lifecycle._hooks[name] || [], thisArg)) { + const result = hook.callback.apply(thisArg, args) args[0] = result } return args[0] diff --git a/packages/koishi/package.json b/packages/koishi/package.json index 180554454..c047205b7 100644 --- a/packages/koishi/package.json +++ b/packages/koishi/package.json @@ -1,19 +1,19 @@ { "name": "koishi", "description": "Cross-Platform Chatbot Framework Made with Love", - "version": "4.17.8", + "version": "4.17.9", "main": "lib/index.cjs", "module": "lib/index.mjs", "types": "lib/index.d.ts", "bin": "bin.js", "exports": { ".": { + "types": "./lib/index.d.ts", "node": { "import": "./lib/index.mjs", "require": "./lib/index.cjs" }, - "browser": "./browser.mjs", - "types": "./lib/index.d.ts" + "browser": "./browser.mjs" }, "./lib/cli": "./lib/cli/index.js", "./lib/worker": "./lib/worker/index.js", @@ -45,13 +45,13 @@ "framework" ], "dependencies": { - "@koishijs/core": "4.17.8", - "@koishijs/loader": "4.5.8", - "@koishijs/plugin-http": "^0.5.2", + "@koishijs/core": "4.17.9", + "@koishijs/loader": "4.5.9", + "@koishijs/plugin-http": "^0.5.3", "@koishijs/plugin-proxy-agent": "^0.3.2", "@koishijs/plugin-server": "^3.2.3", "@koishijs/utils": "^7.2.1", - "@satorijs/core": "^4.1.1", + "@satorijs/core": "^4.1.2", "cac": "^6.7.14", "kleur": "^4.1.5" }, diff --git a/packages/loader/package.json b/packages/loader/package.json index 44b65ef46..ccd347524 100644 --- a/packages/loader/package.json +++ b/packages/loader/package.json @@ -1,7 +1,7 @@ { "name": "@koishijs/loader", "description": "Config Loader for Koishi", - "version": "4.5.8", + "version": "4.5.9", "main": "lib/index.js", "module": "lib/index.mjs", "types": "lib/index.d.ts", @@ -45,10 +45,10 @@ "config" ], "peerDependencies": { - "@koishijs/core": "4.17.8" + "@koishijs/core": "4.17.9" }, "devDependencies": { - "@koishijs/core": "4.17.8", + "@koishijs/core": "4.17.9", "@types/js-yaml": "^4.0.9" }, "dependencies": { diff --git a/plugins/common/bind/package.json b/plugins/common/bind/package.json index 8516e5a47..831a7fc67 100644 --- a/plugins/common/bind/package.json +++ b/plugins/common/bind/package.json @@ -46,10 +46,10 @@ ] }, "peerDependencies": { - "koishi": "^4.17.8" + "koishi": "^4.17.9" }, "devDependencies": { - "@koishijs/plugin-mock": "^2.6.5", - "koishi": "^4.17.8" + "@koishijs/plugin-mock": "^2.6.6", + "koishi": "^4.17.9" } } diff --git a/plugins/common/broadcast/package.json b/plugins/common/broadcast/package.json index 473cb3520..c1005262d 100644 --- a/plugins/common/broadcast/package.json +++ b/plugins/common/broadcast/package.json @@ -45,10 +45,10 @@ ] }, "peerDependencies": { - "koishi": "^4.17.8" + "koishi": "^4.17.9" }, "devDependencies": { - "@koishijs/plugin-mock": "^2.6.5", - "koishi": "^4.17.8" + "@koishijs/plugin-mock": "^2.6.6", + "koishi": "^4.17.9" } } diff --git a/plugins/common/callme/package.json b/plugins/common/callme/package.json index 927a97262..05dea13bd 100644 --- a/plugins/common/callme/package.json +++ b/plugins/common/callme/package.json @@ -45,10 +45,10 @@ ] }, "peerDependencies": { - "koishi": "^4.17.8" + "koishi": "^4.17.9" }, "devDependencies": { - "@koishijs/plugin-mock": "^2.6.5", - "koishi": "^4.17.8" + "@koishijs/plugin-mock": "^2.6.6", + "koishi": "^4.17.9" } } diff --git a/plugins/common/echo/package.json b/plugins/common/echo/package.json index 1a3ec1c2a..51a382d29 100644 --- a/plugins/common/echo/package.json +++ b/plugins/common/echo/package.json @@ -41,10 +41,10 @@ ] }, "peerDependencies": { - "koishi": "^4.17.8" + "koishi": "^4.17.9" }, "devDependencies": { - "@koishijs/plugin-mock": "^2.6.5", - "koishi": "^4.17.8" + "@koishijs/plugin-mock": "^2.6.6", + "koishi": "^4.17.9" } } diff --git a/plugins/common/help/package.json b/plugins/common/help/package.json index 247b385a1..e865d3da2 100644 --- a/plugins/common/help/package.json +++ b/plugins/common/help/package.json @@ -1,7 +1,7 @@ { "name": "@koishijs/plugin-help", "description": "Help plugin for Koishi", - "version": "2.4.3", + "version": "2.4.4", "main": "lib/index.js", "typings": "lib/index.d.ts", "files": [ @@ -45,10 +45,10 @@ ] }, "peerDependencies": { - "koishi": "^4.17.8" + "koishi": "^4.17.9" }, "devDependencies": { - "@koishijs/plugin-mock": "^2.6.5", - "koishi": "^4.17.8" + "@koishijs/plugin-mock": "^2.6.6", + "koishi": "^4.17.9" } } diff --git a/plugins/common/inspect/package.json b/plugins/common/inspect/package.json index e84b53aa8..25ead1af9 100644 --- a/plugins/common/inspect/package.json +++ b/plugins/common/inspect/package.json @@ -47,10 +47,10 @@ ] }, "peerDependencies": { - "koishi": "^4.17.8" + "koishi": "^4.17.9" }, "devDependencies": { - "@koishijs/plugin-mock": "^2.6.5", - "koishi": "^4.17.8" + "@koishijs/plugin-mock": "^2.6.6", + "koishi": "^4.17.9" } } diff --git a/plugins/hmr/package.json b/plugins/hmr/package.json index 9cd4a9e7b..a36eb257d 100644 --- a/plugins/hmr/package.json +++ b/plugins/hmr/package.json @@ -42,13 +42,13 @@ } }, "peerDependencies": { - "@koishijs/loader": "^4.5.8", - "koishi": "^4.17.8" + "@koishijs/loader": "^4.5.9", + "koishi": "^4.17.9" }, "devDependencies": { "@types/babel__code-frame": "^7.0.6", "esbuild": "^0.18.20", - "koishi": "^4.17.8" + "koishi": "^4.17.9" }, "dependencies": { "@babel/code-frame": "^7.24.2", diff --git a/plugins/http/package.json b/plugins/http/package.json index 657f8c0df..d0c142c14 100644 --- a/plugins/http/package.json +++ b/plugins/http/package.json @@ -1,7 +1,7 @@ { "name": "@koishijs/plugin-http", "description": "HTTP and WebSocket client for Koishi", - "version": "0.5.2", + "version": "0.5.3", "type": "module", "main": "index.cjs", "module": "index.mjs", @@ -48,12 +48,12 @@ } }, "peerDependencies": { - "koishi": "^4.17.8" + "koishi": "^4.17.9" }, "devDependencies": { - "koishi": "^4.17.8" + "koishi": "^4.17.9" }, "dependencies": { - "@cordisjs/plugin-http": "^0.5.2" + "@cordisjs/plugin-http": "^0.5.3" } } diff --git a/plugins/mock/package.json b/plugins/mock/package.json index 03ef37bde..9faa2922d 100644 --- a/plugins/mock/package.json +++ b/plugins/mock/package.json @@ -1,7 +1,7 @@ { "name": "@koishijs/plugin-mock", "description": "Test Mocker for Koishi", - "version": "2.6.5", + "version": "2.6.6", "main": "lib/index.js", "typings": "lib/index.d.ts", "files": [ @@ -41,10 +41,10 @@ } }, "peerDependencies": { - "koishi": "^4.17.8" + "koishi": "^4.17.9" }, "devDependencies": { "@koishijs/plugin-server": "^3.2.3", - "koishi": "^4.17.8" + "koishi": "^4.17.9" } } diff --git a/plugins/proxy-agent/package.json b/plugins/proxy-agent/package.json index 4dbfa3a2e..405e716d8 100644 --- a/plugins/proxy-agent/package.json +++ b/plugins/proxy-agent/package.json @@ -52,10 +52,10 @@ } }, "peerDependencies": { - "koishi": "^4.17.8" + "koishi": "^4.17.9" }, "devDependencies": { - "koishi": "^4.17.8" + "koishi": "^4.17.9" }, "dependencies": { "@cordisjs/plugin-proxy-agent": "^0.3.2" diff --git a/plugins/server/package.json b/plugins/server/package.json index 7096cfbb1..39910a7b6 100644 --- a/plugins/server/package.json +++ b/plugins/server/package.json @@ -48,10 +48,10 @@ } }, "peerDependencies": { - "koishi": "^4.17.8" + "koishi": "^4.17.9" }, "devDependencies": { - "koishi": "^4.17.8" + "koishi": "^4.17.9" }, "dependencies": { "@cordisjs/plugin-server": "^0.2.3"