From a03ac7c78b3b0a15ebb3744593ee40769d6e126d Mon Sep 17 00:00:00 2001 From: parisma Date: Thu, 10 Nov 2022 20:10:21 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20core=E4=BB=A3=E7=A0=81=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E5=85=BC=E5=AE=B9=E8=80=81=E7=9A=84=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/Node.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/core/src/Node.ts b/packages/core/src/Node.ts index 0c91ab7a..cd4f46cf 100644 --- a/packages/core/src/Node.ts +++ b/packages/core/src/Node.ts @@ -85,6 +85,11 @@ class Node extends EventEmitter { } private async runCodeBlock(hook: string) { + if (typeof this.data[hook] === 'function') { + // 兼容旧的数据格式 + await this.data[hook](this); + return; + } if (this.data[hook]?.hookType !== HookType.CODE || !this.app.codeDsl || isEmpty(this.app?.codeDsl)) return; for (const item of this.data[hook].hookData) { const { codeId, params = {} } = item;