mirror of
https://github.com/hanzo-docs/docs.git
synced 2026-10-25 04:20:02 +00:00
Core: Try to workaround legacy i18n middleware under /i18n export without breaking changes
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'fumadocs-core': patch
|
||||
---
|
||||
|
||||
Try to workaround legacy i18n middleware under `/i18n` export without breaking changes
|
||||
@@ -62,8 +62,8 @@
|
||||
},
|
||||
"./i18n": {
|
||||
"browser": "./dist/i18n/index.js",
|
||||
"import": "./dist/i18n/index.server.js",
|
||||
"types": "./dist/i18n/index.server.d.ts"
|
||||
"import": "./dist/i18n/legacy.js",
|
||||
"types": "./dist/i18n/legacy.d.ts"
|
||||
},
|
||||
"./i18n/middleware": {
|
||||
"import": "./dist/i18n/middleware.js",
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
export * from './index';
|
||||
export * from './middleware';
|
||||
@@ -0,0 +1,20 @@
|
||||
import type { NextMiddleware } from 'next/dist/server/web/types';
|
||||
import type * as Middleware from './middleware';
|
||||
|
||||
export * from './index';
|
||||
|
||||
/**
|
||||
* @deprecated Import from `fumadocs-core/i18n/middleware` instead
|
||||
*/
|
||||
export const createI18nMiddleware: typeof Middleware.createI18nMiddleware = (
|
||||
...args
|
||||
): NextMiddleware => {
|
||||
console.warn(
|
||||
'[Fumadocs Core] Please import i18n middleware from `fumadocs-core/i18n/middleware` instead, this export will soon be removed.',
|
||||
);
|
||||
const middleware: Promise<NextMiddleware> = import('./middleware').then(
|
||||
(res) => res.createI18nMiddleware(...args),
|
||||
);
|
||||
|
||||
return async (...args) => (await middleware)(...args);
|
||||
};
|
||||
Reference in New Issue
Block a user