@windrun-huaiin/diaomao 12.0.1 → 12.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/i18n.ts +1 -1
- package/src/lib/appConfig.ts +1 -1
- package/src/proxy.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@windrun-huaiin/diaomao",
|
|
3
|
-
"version": "12.0
|
|
3
|
+
"version": "12.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"@types/mdx": "^2.0.13",
|
|
30
30
|
"@windrun-huaiin/backend-core": "^12.0.0",
|
|
31
31
|
"@windrun-huaiin/base-ui": "^12.0.0",
|
|
32
|
-
"@windrun-huaiin/lib": "^12.0
|
|
33
|
-
"@windrun-huaiin/third-ui": "^12.0
|
|
32
|
+
"@windrun-huaiin/lib": "^12.1.0",
|
|
33
|
+
"@windrun-huaiin/third-ui": "^12.1.0",
|
|
34
34
|
"autoprefixer": "^10.4.22",
|
|
35
35
|
"class-variance-authority": "^0.7.1",
|
|
36
36
|
"clsx": "^2.1.1",
|
package/src/i18n.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { I18nConfig } from 'fumadocs-core/i18n';
|
|
|
5
5
|
export const i18n: I18nConfig = {
|
|
6
6
|
defaultLanguage: appConfig.i18n.defaultLocale,
|
|
7
7
|
languages: appConfig.i18n.locales as unknown as string[],
|
|
8
|
-
hideLocale: appConfig.i18n.
|
|
8
|
+
hideLocale: appConfig.i18n.localePrefixAsNeeded ? "default-locale" : "never",
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
// Can be imported from a shared config
|
package/src/lib/appConfig.ts
CHANGED
|
@@ -14,7 +14,7 @@ export const appConfig = {
|
|
|
14
14
|
// export i18n helpers
|
|
15
15
|
export const { isSupportedLocale, getValidLocale, generatedLocales } = createI18nHelpers(appConfig.i18n);
|
|
16
16
|
|
|
17
|
-
export const {
|
|
17
|
+
export const { localePrefixAsNeeded, defaultLocale } = appConfig.i18n;
|
|
18
18
|
|
|
19
19
|
// export shortcuts
|
|
20
20
|
export const { iconColor, watermark, showBanner, clerkPageBanner, clerkAuthInModal, placeHolderImage } = appConfig.shortcuts;
|
package/src/proxy.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { NextRequest, NextResponse } from "next/server";
|
|
|
13
13
|
const intlMiddleware = createMiddleware({
|
|
14
14
|
locales: appConfig.i18n.locales,
|
|
15
15
|
defaultLocale: appConfig.i18n.defaultLocale,
|
|
16
|
-
localePrefix: appConfig.i18n.
|
|
16
|
+
localePrefix: appConfig.i18n.localePrefixAsNeeded ? "as-needed" : "always",
|
|
17
17
|
localeDetection: false
|
|
18
18
|
});
|
|
19
19
|
|
|
@@ -64,7 +64,7 @@ export default clerkMiddleware(
|
|
|
64
64
|
const url = req.nextUrl.clone();
|
|
65
65
|
url.pathname = `/${defaultLocale}${pathname}`;
|
|
66
66
|
|
|
67
|
-
if (appConfig.i18n.
|
|
67
|
+
if (appConfig.i18n.localePrefixAsNeeded) {
|
|
68
68
|
// as-needed: 内部rewrite,用户URL保持无前缀
|
|
69
69
|
console.log('[middleware rewrite]', { from: pathname, to: url.pathname });
|
|
70
70
|
return NextResponse.rewrite(url);
|