Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/fix-bff-middleware-typo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@modern-js/server-core': patch
'@modern-js/plugin-bff': patch
---

fix: correct the "Middlware" typo in BFF middleware identifiers — the exported `PublicMiddlwareOptions` type from `@modern-js/server-core` is renamed to `PublicMiddlewareOptions`, and the internal `routeMiddlwares` variable in `@modern-js/plugin-bff` is renamed to `routeMiddlewares`
fix: 修正 BFF 中间件标识符里的 "Middlware" 拼写错误——`@modern-js/server-core` 导出的 `PublicMiddlwareOptions` 类型更名为 `PublicMiddlewareOptions`,`@modern-js/plugin-bff` 内部变量 `routeMiddlwares` 更名为 `routeMiddlewares`
6 changes: 3 additions & 3 deletions packages/cli/plugin-bff/src/utils/createHonoRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ type Handler = APIHandlerInfo['handler'];

const createHonoRoutes = (handlerInfos: APIHandlerInfo[] = []) => {
return handlerInfos.map(({ routePath, handler, httpMethod }) => {
const routeMiddlwares = Reflect.getMetadata('middleware', handler) || [];
const routeMiddlewares = Reflect.getMetadata('middleware', handler) || [];
const honoHandler = createHonoHandler(handler);

return {
method: httpMethod.toLowerCase() as any,
path: routePath,
handler:
routeMiddlwares.length > 0
? [...routeMiddlwares, honoHandler]
routeMiddlewares.length > 0
? [...routeMiddlewares, honoHandler]
: honoHandler,
};
});
Expand Down
4 changes: 2 additions & 2 deletions packages/server/core/src/adapters/node/plugins/static.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ export const serverStaticPlugin = (): ServerPlugin => ({
},
});

export type PublicMiddlwareOptions = {
export type PublicMiddlewareOptions = {
pwd: string;
routes: ServerRoute[];
};

export function createPublicMiddleware({
pwd,
routes,
}: PublicMiddlwareOptions): Middleware {
}: PublicMiddlewareOptions): Middleware {
return async (c, next) => {
const route = matchPublicRoute(c.req, routes);

Expand Down
Loading