From 1f1b1858c773ba1fba0c20a029bb2bf8ffb472d0 Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Sun, 21 Jun 2026 22:32:51 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=A2=9E=E5=8A=A0=E6=B8=85=E7=90=86?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=E7=BC=93=E5=AD=98=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/pipeline/src/access/api.ts | 2 +- packages/core/pipeline/src/plugin/api.ts | 4 ++-- .../plugin-lib/src/cert/dns-provider/base.ts | 2 +- .../src/locales/langs/en-US/certd/sys-plugin.ts | 5 +++-- .../src/locales/langs/zh-CN/certd/sys-plugin.ts | 5 +++-- .../certd-client/src/views/sys/plugin/crud.tsx | 1 + packages/ui/certd-server/package.json | 2 +- .../modules/runtime-deps/runtime-deps-service.ts | 16 ++++++++++------ 8 files changed, 22 insertions(+), 15 deletions(-) diff --git a/packages/core/pipeline/src/access/api.ts b/packages/core/pipeline/src/access/api.ts index 36b017fe8..8298b1306 100644 --- a/packages/core/pipeline/src/access/api.ts +++ b/packages/core/pipeline/src/access/api.ts @@ -52,7 +52,7 @@ export abstract class BaseAccess implements IAccess { async importRuntime(specifier: string) { if (!this.runtimeDepsService) { - return await import(specifier); + throw new Error("runtimeDepsService 未初始化"); } return await this.runtimeDepsService.importRuntime(specifier, this.ctx.logger); } diff --git a/packages/core/pipeline/src/plugin/api.ts b/packages/core/pipeline/src/plugin/api.ts index ed2241d16..b04d457a6 100644 --- a/packages/core/pipeline/src/plugin/api.ts +++ b/packages/core/pipeline/src/plugin/api.ts @@ -150,11 +150,11 @@ export abstract class AbstractTaskPlugin implements ITaskPlugin { logger!: ILogger; http!: HttpClient; accessService!: IAccessService; - runtimeDepsService?: IRuntimeDepsService; + runtimeDepsService!: IRuntimeDepsService; async importRuntime(specifier: string) { if (!this.runtimeDepsService) { - return await import(specifier); + throw new Error("runtimeDepsService 未初始化"); } return await this.runtimeDepsService.importRuntime(specifier, this.logger); } diff --git a/packages/plugins/plugin-lib/src/cert/dns-provider/base.ts b/packages/plugins/plugin-lib/src/cert/dns-provider/base.ts index c104fd75d..b74df800b 100644 --- a/packages/plugins/plugin-lib/src/cert/dns-provider/base.ts +++ b/packages/plugins/plugin-lib/src/cert/dns-provider/base.ts @@ -11,7 +11,7 @@ export abstract class AbstractDnsProvider implements IDnsProvider { async importRuntime(specifier: string) { if (!this.runtimeDepsService) { - return await import(specifier); + throw new Error("runtimeDepsService 未初始化"); } return await this.runtimeDepsService.importRuntime(specifier, this.logger); } diff --git a/packages/ui/certd-client/src/locales/langs/en-US/certd/sys-plugin.ts b/packages/ui/certd-client/src/locales/langs/en-US/certd/sys-plugin.ts index ff6254014..c163d40c5 100644 --- a/packages/ui/certd-client/src/locales/langs/en-US/certd/sys-plugin.ts +++ b/packages/ui/certd-client/src/locales/langs/en-US/certd/sys-plugin.ts @@ -41,6 +41,7 @@ export default { pluginBetaWarning: "Custom plugins are in BETA and may have breaking changes in future", pleaseSelectRecord: "Please select records first", clearRuntimeDeps: "Clear Runtime Deps Cache", - clearRuntimeDepsConfirm: "Are you sure to clear the runtime dependencies cache? Required dependencies will be reinstalled on the next pipeline execution.", - clearRuntimeDepsSuccess: "Runtime dependencies cache cleared successfully", + clearRuntimeDepsTooltip: "Restart the certd container after clearing, otherwise cached modules will not be reloaded", + clearRuntimeDepsConfirm: "Are you sure to clear the runtime dependencies cache? Please restart the certd container afterwards to ensure dependencies are reloaded.", + clearRuntimeDepsSuccess: "Runtime dependencies cache cleared successfully, please restart the certd container", }; diff --git a/packages/ui/certd-client/src/locales/langs/zh-CN/certd/sys-plugin.ts b/packages/ui/certd-client/src/locales/langs/zh-CN/certd/sys-plugin.ts index 38d598bd1..2ceaea20a 100644 --- a/packages/ui/certd-client/src/locales/langs/zh-CN/certd/sys-plugin.ts +++ b/packages/ui/certd-client/src/locales/langs/zh-CN/certd/sys-plugin.ts @@ -41,6 +41,7 @@ export default { pluginBetaWarning: "自定义插件处于BETA测试版,后续可能会有破坏性变更", pleaseSelectRecord: "请先勾选记录", clearRuntimeDeps: "清理第三方依赖缓存", - clearRuntimeDepsConfirm: "确定要清理第三方依赖缓存吗?清理后下次执行流水线时将重新安装所需依赖。", - clearRuntimeDepsSuccess: "第三方依赖缓存清理成功", + clearRuntimeDepsTooltip: "清除后需重启 certd 容器,否则已缓存模块不会重新读取", + clearRuntimeDepsConfirm: "确定要清理第三方依赖缓存吗?清理后请重启 certd 容器以确保重新加载依赖。", + clearRuntimeDepsSuccess: "第三方依赖缓存清理成功,请重启 certd 容器", }; diff --git a/packages/ui/certd-client/src/views/sys/plugin/crud.tsx b/packages/ui/certd-client/src/views/sys/plugin/crud.tsx index a00e8701f..32c0fc9cf 100644 --- a/packages/ui/certd-client/src/views/sys/plugin/crud.tsx +++ b/packages/ui/certd-client/src/views/sys/plugin/crud.tsx @@ -87,6 +87,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat show: true, icon: "ion:trash-outline", text: t("certd.clearRuntimeDeps"), + tooltip: { title: t("certd.clearRuntimeDepsTooltip") }, type: "primary", danger: true, async click() { diff --git a/packages/ui/certd-server/package.json b/packages/ui/certd-server/package.json index 9f030419b..99f7bdf91 100644 --- a/packages/ui/certd-server/package.json +++ b/packages/ui/certd-server/package.json @@ -37,7 +37,7 @@ "tsc": "tsc --skipLibCheck", "slimming": "node ./slimming.js", "pub": "echo 1", - "compile": "tsc --skipLibCheck --watch", + "compile": "", "lint1": "eslint --fix" }, "dependencies": { diff --git a/packages/ui/certd-server/src/modules/runtime-deps/runtime-deps-service.ts b/packages/ui/certd-server/src/modules/runtime-deps/runtime-deps-service.ts index b71a2d8fd..05ea9c814 100644 --- a/packages/ui/certd-server/src/modules/runtime-deps/runtime-deps-service.ts +++ b/packages/ui/certd-server/src/modules/runtime-deps/runtime-deps-service.ts @@ -441,16 +441,20 @@ export class RuntimeDepsService { private getDefineByPluginKey(pluginKey: string, owner?: RuntimeDependencyPluginDefine): RuntimeDependencyPluginDefine { const parts = pluginKey.split(":"); - const [pluginType, subtype, name] = parts; - if (parts.length < 2 || (pluginType === "addon" && parts.length !== 3) || (pluginType !== "addon" && parts.length !== 2)) { + let [pluginType, subtype, name] = parts; + if (parts.length === 2) { + name = subtype; + }else if (parts.length === 3) { + //无修改 + } else { const ownerName = owner?.name || pluginKey; throw new Error(`插件依赖格式错误: ${ownerName} 依赖 ${pluginKey},请使用 plugin:name、access:name、notification:name、dnsProvider:name 或 addon:subtype:name 格式`); } const registryMap: Record; key: string; pluginType: string; addonType?: string }> = { - plugin: { registry: pluginRegistry, key: subtype, pluginType: "plugin" }, - access: { registry: accessRegistry, key: subtype, pluginType: "access" }, - notification: { registry: notificationRegistry, key: subtype, pluginType: "notification" }, - dnsProvider: { registry: dnsProviderRegistry, key: subtype, pluginType: "dnsProvider" }, + plugin: { registry: pluginRegistry, key: name, pluginType: "plugin" }, + access: { registry: accessRegistry, key: name, pluginType: "access" }, + notification: { registry: notificationRegistry, key: name, pluginType: "notification" }, + dnsProvider: { registry: dnsProviderRegistry, key: name, pluginType: "dnsProvider" }, addon: { registry: addonRegistry, key: `${subtype}:${name}`, pluginType: "addon", addonType: subtype }, }; const target = registryMap[pluginType];