refactor(certd-server): 移除非运行时依赖到动态导入

将alipay-sdk、openid-client、otplib、wechatpay-node-v3改为动态导入,从dependencies移到devDependencies?不,是改为通过importRuntime动态加载,移除顶层静态引入,优化启动时依赖加载,减少初始包体积和启动耗时
This commit is contained in:
xiaojunnuo
2026-07-12 00:04:06 +08:00
parent ec69b8f11b
commit 8517a0b564
5 changed files with 15 additions and 14 deletions
@@ -1,6 +1,5 @@
import { AccessInput, BaseAccess, IsAccess } from "@certd/pipeline";
import FormData from "form-data";
import { authenticator } from "otplib";
export interface ProxyHost {
id: number;
@@ -274,6 +273,7 @@ export class NginxProxyManagerAccess extends BaseAccess {
let code: string;
try {
const { authenticator } = await this.importRuntime("otplib");
code = authenticator.generate(this.totpSecret);
} catch (error) {
throw this.describeError(error, "Generating TOTP code");