feat: ServerConfiguration新增middleware配置

This commit is contained in:
Pan Qiancheng 2025-11-11 18:03:38 +08:00
parent 2114f959e6
commit 904a9a6b5e
3 changed files with 3 additions and 0 deletions

View File

@ -244,6 +244,7 @@ function resolveCompiledImportPath(sourceFilePath, outputFilePath, importPath, p
return importPath;
}
if (sourceFilePath.startsWith("node_modules")) {
// 如果是node_modules下的文件保持原有的处理逻辑
return importPath.startsWith('.') ? (relative
? path_1.default.join(relative, importPath).replace(/\\/g, '/')
: path_1.default.join('..', importPath).replace(/\\/g, '/')) : importPath;

View File

@ -56,6 +56,7 @@ export type ServerConfiguration = {
socket?: (ctx: Koa.ParameterizedContext<any, KoaRouter.IRouterParamContext<any, {}>, any>) => {
url: string;
} | undefined;
middleware?: Koa.Middleware[] | ((app: Koa<Koa.DefaultState, Koa.DefaultContext>) => Koa.Middleware[]);
};
/**
* 访

View File

@ -57,6 +57,7 @@ export type ServerConfiguration = {
internalExceptionMask?: string;
koaBody?: IKoaBodyOptions, // koa-body配置
socket?: (ctx: Koa.ParameterizedContext<any, KoaRouter.IRouterParamContext<any, {}>, any>) => { url: string } | undefined;
middleware?: Koa.Middleware[] | ((app: Koa<Koa.DefaultState, Koa.DefaultContext>) => Koa.Middleware[]); // 自定义中间件
};
/**