nuxt-i18n-micro 1.93.0 → 1.94.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/dist/client/200.html +8 -8
- package/dist/client/404.html +8 -8
- package/dist/client/_nuxt/{Bjm5k_ND.js → BghP2wsD.js} +3 -3
- package/dist/client/_nuxt/{BTINn22q.js → BhtDXNyb.js} +1 -1
- package/dist/client/_nuxt/{DvIeOzfB.js → BjB9nc_5.js} +1 -1
- package/dist/client/_nuxt/{DFBiwLO-.js → DpQNspb6.js} +1 -1
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/bd644dea-2454-468d-ba61-8e09f211303a.json +1 -0
- package/dist/client/_nuxt/error-404.CdQyF-WE.css +1 -0
- package/dist/client/_nuxt/error-500.CDURyqPT.css +1 -0
- package/dist/client/index.html +8 -8
- package/dist/module.d.mts +2 -1
- package/dist/module.json +3 -3
- package/dist/module.mjs +88 -33
- package/dist/runtime/components/i18n-group.vue +7 -10
- package/dist/runtime/components/i18n-group.vue.d.ts +19 -0
- package/dist/runtime/components/i18n-link.vue +26 -43
- package/dist/runtime/components/i18n-link.vue.d.ts +19 -0
- package/dist/runtime/components/i18n-switcher.vue +93 -143
- package/dist/runtime/components/i18n-switcher.vue.d.ts +62 -0
- package/dist/runtime/components/i18n-t.vue.d.ts +1 -304
- package/dist/runtime/components/locale-redirect.vue +32 -50
- package/dist/runtime/components/locale-redirect.vue.d.ts +2 -0
- package/dist/runtime/composables/useLocaleHead.d.ts +2 -2
- package/dist/runtime/plugins/01.plugin.js +6 -2
- package/dist/runtime/plugins/04.auto-detect.js +4 -1
- package/dist/types.d.mts +8 -2
- package/package.json +24 -27
- package/dist/client/_nuxt/builds/meta/66d92d10-1ef4-46a8-88af-62abfdb758c6.json +0 -1
- package/dist/client/_nuxt/error-404.CbefIQ4Z.css +0 -1
- package/dist/client/_nuxt/error-500.Bpd-7vXd.css +0 -1
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -31
- package/dist/types.d.ts +0 -7
- package/dist/utils.d.mts +0 -17
- package/dist/utils.d.ts +0 -17
- package/dist/utils.mjs +0 -64
- /package/{internals.d.ts → internals.d.mts} +0 -0
|
@@ -3,72 +3,54 @@
|
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
|
-
import { useRoute, useI18n, createError, navigateTo } from
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const pathSegments = route.fullPath.split('/')
|
|
14
|
-
const firstSegment = pathSegments[1]
|
|
15
|
-
|
|
6
|
+
import { useRoute, useI18n, createError, navigateTo } from "#imports";
|
|
7
|
+
const route = useRoute();
|
|
8
|
+
const { $getLocales, $defaultLocale } = useI18n();
|
|
9
|
+
const locales = $getLocales().map((locale) => locale.code);
|
|
10
|
+
const defaultLocale = $defaultLocale() || "en";
|
|
11
|
+
const pathSegments = route.fullPath.split("/");
|
|
12
|
+
const firstSegment = pathSegments[1];
|
|
16
13
|
const generateRouteName = (segments) => {
|
|
17
|
-
return segments
|
|
18
|
-
|
|
19
|
-
.map(segment => segment.replace(/:/g, ''))
|
|
20
|
-
.join('-')
|
|
21
|
-
}
|
|
22
|
-
|
|
14
|
+
return segments.slice(1).map((segment) => segment.replace(/:/g, "")).join("-");
|
|
15
|
+
};
|
|
23
16
|
const generateLocaleRouteName = (segments) => {
|
|
24
|
-
return segments
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const currentPageName = generateRouteName(pathSegments)
|
|
32
|
-
const currentLocalePageName = generateLocaleRouteName(pathSegments)
|
|
33
|
-
const globalLocaleRoutes = route.meta.globalLocaleRoutes ?? {}
|
|
34
|
-
|
|
17
|
+
return segments.filter((segment) => segment && segment.trim() !== "").slice(1).map((segment) => segment.replace(/:/g, "")).join("-");
|
|
18
|
+
};
|
|
19
|
+
const currentPageName = generateRouteName(pathSegments);
|
|
20
|
+
const currentLocalePageName = generateLocaleRouteName(pathSegments);
|
|
21
|
+
const globalLocaleRoutes = route.meta.globalLocaleRoutes ?? {};
|
|
35
22
|
const handleRedirect = (path) => {
|
|
36
23
|
if (import.meta.client) {
|
|
37
|
-
window.history.replaceState(null,
|
|
38
|
-
location.assign(path)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
navigateTo(path, { redirectCode: 301, external: true })
|
|
24
|
+
window.history.replaceState(null, "", path);
|
|
25
|
+
location.assign(path);
|
|
26
|
+
} else {
|
|
27
|
+
navigateTo(path, { redirectCode: 301, external: true });
|
|
42
28
|
}
|
|
43
|
-
}
|
|
44
|
-
|
|
29
|
+
};
|
|
45
30
|
if (globalLocaleRoutes && globalLocaleRoutes[currentPageName]) {
|
|
46
|
-
const localizedRoutes = globalLocaleRoutes[currentPageName]
|
|
31
|
+
const localizedRoutes = globalLocaleRoutes[currentPageName];
|
|
47
32
|
if (localizedRoutes && localizedRoutes[defaultLocale]) {
|
|
48
|
-
const localizedPath = localizedRoutes[defaultLocale]
|
|
33
|
+
const localizedPath = localizedRoutes[defaultLocale];
|
|
49
34
|
if (route.fullPath !== localizedPath) {
|
|
50
|
-
handleRedirect(localizedPath)
|
|
35
|
+
handleRedirect(localizedPath);
|
|
51
36
|
}
|
|
52
37
|
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const newPath = `/${defaultLocale}${route.fullPath}`
|
|
38
|
+
} else if (!locales.includes(firstSegment)) {
|
|
39
|
+
const newPath = `/${defaultLocale}${route.fullPath}`;
|
|
56
40
|
if (route.fullPath !== newPath) {
|
|
57
|
-
handleRedirect(newPath)
|
|
41
|
+
handleRedirect(newPath);
|
|
58
42
|
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const localizedRoutes = globalLocaleRoutes[currentLocalePageName]
|
|
43
|
+
} else if (locales.includes(firstSegment) && globalLocaleRoutes && globalLocaleRoutes[currentLocalePageName]) {
|
|
44
|
+
const localizedRoutes = globalLocaleRoutes[currentLocalePageName];
|
|
62
45
|
if (localizedRoutes && localizedRoutes[firstSegment]) {
|
|
63
|
-
const localizedPath = `/${firstSegment}${localizedRoutes[firstSegment]}
|
|
46
|
+
const localizedPath = `/${firstSegment}${localizedRoutes[firstSegment]}`;
|
|
64
47
|
if (route.fullPath !== localizedPath) {
|
|
65
|
-
handleRedirect(localizedPath)
|
|
48
|
+
handleRedirect(localizedPath);
|
|
66
49
|
}
|
|
67
50
|
}
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
51
|
+
} else {
|
|
70
52
|
throw createError({
|
|
71
|
-
statusCode: 404
|
|
72
|
-
})
|
|
53
|
+
statusCode: 404
|
|
54
|
+
});
|
|
73
55
|
}
|
|
74
56
|
</script>
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
export default _default;
|
|
@@ -25,7 +25,7 @@ export declare const useLocaleHead: ({ addDirAttribute, identifierAttribute, add
|
|
|
25
25
|
}) => import("vue").Ref<{
|
|
26
26
|
htmlAttrs: {
|
|
27
27
|
lang?: string | undefined;
|
|
28
|
-
dir?:
|
|
28
|
+
dir?: "ltr" | "rtl" | "auto" | undefined;
|
|
29
29
|
};
|
|
30
30
|
link: {
|
|
31
31
|
[x: string]: string | undefined;
|
|
@@ -41,7 +41,7 @@ export declare const useLocaleHead: ({ addDirAttribute, identifierAttribute, add
|
|
|
41
41
|
}, MetaObject | {
|
|
42
42
|
htmlAttrs: {
|
|
43
43
|
lang?: string | undefined;
|
|
44
|
-
dir?:
|
|
44
|
+
dir?: "ltr" | "rtl" | "auto" | undefined;
|
|
45
45
|
};
|
|
46
46
|
link: {
|
|
47
47
|
[x: string]: string | undefined;
|
|
@@ -38,8 +38,11 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
38
38
|
try {
|
|
39
39
|
if (!i18nHelper.hasPageTranslation(locale, routeName)) {
|
|
40
40
|
let fRouteName = routeName;
|
|
41
|
-
if (i18nConfig.routesLocaleLinks && i18nConfig.routesLocaleLinks[fRouteName]) {
|
|
42
|
-
|
|
41
|
+
if (i18nConfig.routesLocaleLinks && fRouteName && i18nConfig.routesLocaleLinks[fRouteName]) {
|
|
42
|
+
const newRouteName = i18nConfig.routesLocaleLinks[fRouteName];
|
|
43
|
+
if (newRouteName) {
|
|
44
|
+
fRouteName = newRouteName;
|
|
45
|
+
}
|
|
43
46
|
}
|
|
44
47
|
if (!fRouteName || fRouteName === "") {
|
|
45
48
|
console.warn(`[nuxt-i18n-next] The page name is missing in the path: ${path}. Please ensure that definePageMeta({ name: 'pageName' }) is set.`);
|
|
@@ -137,6 +140,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
137
140
|
tc: (key, params, defaultValue) => {
|
|
138
141
|
const currentLocale = routeService.getCurrentLocale();
|
|
139
142
|
const { count, ..._params } = typeof params === "number" ? { count: params } : params;
|
|
143
|
+
if (count === void 0) return defaultValue ?? key;
|
|
140
144
|
return plural(key, Number.parseInt(count.toString()), _params, currentLocale, provideData.t) ?? defaultValue ?? key;
|
|
141
145
|
},
|
|
142
146
|
tn: (value, options) => {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { isPrefixStrategy, isNoPrefixStrategy } from "nuxt-i18n-micro-core";
|
|
2
2
|
import { defineNuxtPlugin, useCookie, useRequestHeaders, navigateTo, useRoute, useRouter } from "#imports";
|
|
3
|
-
const parseAcceptLanguage = (acceptLanguage) => acceptLanguage.split(",").map((entry) =>
|
|
3
|
+
const parseAcceptLanguage = (acceptLanguage) => acceptLanguage.split(",").map((entry) => {
|
|
4
|
+
const parts = entry.split(";");
|
|
5
|
+
return parts[0] ? parts[0].trim() : "";
|
|
6
|
+
});
|
|
4
7
|
export default defineNuxtPlugin(async (nuxtApp) => {
|
|
5
8
|
const i18nConfig = nuxtApp.$config.public.i18nConfig;
|
|
6
9
|
const date = /* @__PURE__ */ new Date();
|
package/dist/types.d.mts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import type { ModuleHooks } from './module.
|
|
1
|
+
import type { ModuleHooks } from './module.mjs'
|
|
2
2
|
|
|
3
3
|
declare module '@nuxt/schema' {
|
|
4
4
|
interface NuxtHooks extends ModuleHooks {}
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
export { type Getter, type GlobalLocaleRoutes, type Locale, type LocaleCode, type ModuleOptions, type PluralFunc, type Strategies } from '
|
|
7
|
+
export { type Getter, type GlobalLocaleRoutes, type Locale, type LocaleCode, type ModuleOptions, type PluralFunc, type Strategies } from 'nuxt-i18n-micro-types'
|
|
8
|
+
|
|
9
|
+
export { type PluginsInjections } from '../dist/runtime/plugins/01.plugin.js'
|
|
10
|
+
|
|
11
|
+
export { default } from './module.mjs'
|
|
12
|
+
|
|
13
|
+
export { type ModuleHooks } from './module.mjs'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-i18n-micro",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.94.0",
|
|
4
4
|
"description": "Nuxt I18n Micro is a lightweight, high-performance internationalization module for Nuxt, designed to handle multi-language support with minimal overhead, fast build times, and efficient runtime performance.",
|
|
5
5
|
"repository": "s00d/nuxt-i18n-micro",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,23 +28,25 @@
|
|
|
28
28
|
},
|
|
29
29
|
"exports": {
|
|
30
30
|
".": {
|
|
31
|
-
"types": "./dist/types.d.
|
|
31
|
+
"types": "./dist/types.d.mts",
|
|
32
32
|
"default": "./dist/module.mjs"
|
|
33
33
|
},
|
|
34
|
-
"./
|
|
34
|
+
"./internals": "./internals.d.mts"
|
|
35
35
|
},
|
|
36
|
-
"main": "./dist/module.
|
|
36
|
+
"main": "./dist/module.mjs",
|
|
37
37
|
"typesVersions": {
|
|
38
38
|
"*": {
|
|
39
|
-
"
|
|
40
|
-
"./dist
|
|
41
|
-
|
|
39
|
+
".": [
|
|
40
|
+
"./dist/types.d.mts"
|
|
41
|
+
],
|
|
42
|
+
"internals": [
|
|
43
|
+
"./internals.d.mts"
|
|
42
44
|
]
|
|
43
45
|
}
|
|
44
46
|
},
|
|
45
47
|
"files": [
|
|
46
48
|
"dist",
|
|
47
|
-
"internals.d.
|
|
49
|
+
"internals.d.mts"
|
|
48
50
|
],
|
|
49
51
|
"stackblitz": {
|
|
50
52
|
"startCommand": "pnpm install && pnpm --filter \"./packages/**\" run build && pnpm run dev:prepare && pnpm run dev",
|
|
@@ -53,8 +55,8 @@
|
|
|
53
55
|
}
|
|
54
56
|
},
|
|
55
57
|
"dependencies": {
|
|
56
|
-
"@nuxt/devtools-kit": "^2.6.
|
|
57
|
-
"@nuxt/kit": "^3.18.1",
|
|
58
|
+
"@nuxt/devtools-kit": "^2.6.3",
|
|
59
|
+
"@nuxt/kit": "^3.18.1 || ^4.0.0",
|
|
58
60
|
"chokidar": "^3.6.0",
|
|
59
61
|
"globby": "^14.1.0",
|
|
60
62
|
"sirv": "^2.0.4",
|
|
@@ -64,23 +66,23 @@
|
|
|
64
66
|
"nuxt-i18n-micro-types": "1.0.6"
|
|
65
67
|
},
|
|
66
68
|
"devDependencies": {
|
|
67
|
-
"@nuxt/devtools": "^2.6.
|
|
68
|
-
"@nuxt/devtools-ui-kit": "^2.6.
|
|
69
|
-
"@nuxt/eslint-config": "1.
|
|
70
|
-
"@nuxt/module-builder": "^0.
|
|
71
|
-
"@nuxt/schema": "^3.18.1",
|
|
72
|
-
"@nuxt/test-utils": "^3.
|
|
73
|
-
"@playwright/test": "^1.
|
|
69
|
+
"@nuxt/devtools": "^2.6.3",
|
|
70
|
+
"@nuxt/devtools-ui-kit": "^2.6.3",
|
|
71
|
+
"@nuxt/eslint-config": "^1.9.0",
|
|
72
|
+
"@nuxt/module-builder": "^1.0.0",
|
|
73
|
+
"@nuxt/schema": "^3.18.1 || ^4.0.0",
|
|
74
|
+
"@nuxt/test-utils": "^3.19.2",
|
|
75
|
+
"@playwright/test": "^1.55.0",
|
|
74
76
|
"@types/jest": "^29.5.14",
|
|
75
77
|
"@types/node": "^20.17.10",
|
|
76
78
|
"changelogen": "^0.5.7",
|
|
77
|
-
"eslint": "^9.
|
|
79
|
+
"eslint": "^9.34.0",
|
|
78
80
|
"jest": "^29.7.0",
|
|
79
81
|
"ts-jest": "^29.2.5",
|
|
80
|
-
"typescript": "5.
|
|
81
|
-
"vitepress": "^1.6.
|
|
82
|
-
"vitest": "^3.
|
|
83
|
-
"vue-tsc": "2.
|
|
82
|
+
"typescript": "5.9.2",
|
|
83
|
+
"vitepress": "^1.6.4",
|
|
84
|
+
"vitest": "^3.2.4",
|
|
85
|
+
"vue-tsc": "^2.0.21"
|
|
84
86
|
},
|
|
85
87
|
"optionalDependencies": {
|
|
86
88
|
"@rollup/rollup-linux-x64-gnu": "^4.28.1",
|
|
@@ -93,11 +95,6 @@
|
|
|
93
95
|
"client",
|
|
94
96
|
"test/fixtures/**/*"
|
|
95
97
|
],
|
|
96
|
-
"build": {
|
|
97
|
-
"entries": [
|
|
98
|
-
"./src/utils"
|
|
99
|
-
]
|
|
100
|
-
},
|
|
101
98
|
"scripts": {
|
|
102
99
|
"dev": "nuxi dev playground",
|
|
103
100
|
"dev:build": "nuxi build playground",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"id":"66d92d10-1ef4-46a8-88af-62abfdb758c6","timestamp":1755983422297,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.spotlight[data-v-e84c2fd2]{background:linear-gradient(45deg,#00dc82,#36e4da 50%,#0047e1);bottom:-30vh;filter:blur(20vh);height:40vh}.gradient-border[data-v-e84c2fd2]{-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);border-radius:.5rem;position:relative}@media (prefers-color-scheme:light){.gradient-border[data-v-e84c2fd2]{background-color:#ffffff4d}.gradient-border[data-v-e84c2fd2]:before{background:linear-gradient(90deg,#e2e2e2,#e2e2e2 25%,#00dc82,#36e4da 75%,#0047e1)}}@media (prefers-color-scheme:dark){.gradient-border[data-v-e84c2fd2]{background-color:#1414144d}.gradient-border[data-v-e84c2fd2]:before{background:linear-gradient(90deg,#303030,#303030 25%,#00dc82,#36e4da 75%,#0047e1)}}.gradient-border[data-v-e84c2fd2]:before{background-size:400% auto;border-radius:.5rem;content:"";inset:0;-webkit-mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);-webkit-mask-composite:xor;mask-composite:exclude;opacity:.5;padding:2px;position:absolute;transition:background-position .3s ease-in-out,opacity .2s ease-in-out;width:100%}.gradient-border[data-v-e84c2fd2]:hover:before{background-position:-50% 0;opacity:1}.fixed[data-v-e84c2fd2]{position:fixed}.left-0[data-v-e84c2fd2]{left:0}.right-0[data-v-e84c2fd2]{right:0}.z-10[data-v-e84c2fd2]{z-index:10}.z-20[data-v-e84c2fd2]{z-index:20}.grid[data-v-e84c2fd2]{display:grid}.mb-16[data-v-e84c2fd2]{margin-bottom:4rem}.mb-8[data-v-e84c2fd2]{margin-bottom:2rem}.max-w-520px[data-v-e84c2fd2]{max-width:520px}.min-h-screen[data-v-e84c2fd2]{min-height:100vh}.w-full[data-v-e84c2fd2]{width:100%}.flex[data-v-e84c2fd2]{display:flex}.cursor-pointer[data-v-e84c2fd2]{cursor:pointer}.place-content-center[data-v-e84c2fd2]{place-content:center}.items-center[data-v-e84c2fd2]{align-items:center}.justify-center[data-v-e84c2fd2]{justify-content:center}.overflow-hidden[data-v-e84c2fd2]{overflow:hidden}.bg-white[data-v-e84c2fd2]{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.px-4[data-v-e84c2fd2]{padding-left:1rem;padding-right:1rem}.px-8[data-v-e84c2fd2]{padding-left:2rem;padding-right:2rem}.py-2[data-v-e84c2fd2]{padding-bottom:.5rem;padding-top:.5rem}.text-center[data-v-e84c2fd2]{text-align:center}.text-8xl[data-v-e84c2fd2]{font-size:6rem;line-height:1}.text-xl[data-v-e84c2fd2]{font-size:1.25rem;line-height:1.75rem}.text-black[data-v-e84c2fd2]{--un-text-opacity:1;color:rgb(0 0 0/var(--un-text-opacity))}.font-light[data-v-e84c2fd2]{font-weight:300}.font-medium[data-v-e84c2fd2]{font-weight:500}.leading-tight[data-v-e84c2fd2]{line-height:1.25}.font-sans[data-v-e84c2fd2]{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.antialiased[data-v-e84c2fd2]{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (prefers-color-scheme:dark){.dark\:bg-black[data-v-e84c2fd2]{--un-bg-opacity:1;background-color:rgb(0 0 0/var(--un-bg-opacity))}.dark\:text-white[data-v-e84c2fd2]{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media (min-width:640px){.sm\:px-0[data-v-e84c2fd2]{padding-left:0;padding-right:0}.sm\:px-6[data-v-e84c2fd2]{padding-left:1.5rem;padding-right:1.5rem}.sm\:py-3[data-v-e84c2fd2]{padding-bottom:.75rem;padding-top:.75rem}.sm\:text-4xl[data-v-e84c2fd2]{font-size:2.25rem;line-height:2.5rem}.sm\:text-xl[data-v-e84c2fd2]{font-size:1.25rem;line-height:1.75rem}}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.spotlight[data-v-3e7cfec8]{background:linear-gradient(45deg,#00dc82,#36e4da 50%,#0047e1);filter:blur(20vh)}.fixed[data-v-3e7cfec8]{position:fixed}.-bottom-1\/2[data-v-3e7cfec8]{bottom:-50%}.left-0[data-v-3e7cfec8]{left:0}.right-0[data-v-3e7cfec8]{right:0}.grid[data-v-3e7cfec8]{display:grid}.mb-16[data-v-3e7cfec8]{margin-bottom:4rem}.mb-8[data-v-3e7cfec8]{margin-bottom:2rem}.h-1\/2[data-v-3e7cfec8]{height:50%}.max-w-520px[data-v-3e7cfec8]{max-width:520px}.min-h-screen[data-v-3e7cfec8]{min-height:100vh}.place-content-center[data-v-3e7cfec8]{place-content:center}.overflow-hidden[data-v-3e7cfec8]{overflow:hidden}.bg-white[data-v-3e7cfec8]{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.px-8[data-v-3e7cfec8]{padding-left:2rem;padding-right:2rem}.text-center[data-v-3e7cfec8]{text-align:center}.text-8xl[data-v-3e7cfec8]{font-size:6rem;line-height:1}.text-xl[data-v-3e7cfec8]{font-size:1.25rem;line-height:1.75rem}.text-black[data-v-3e7cfec8]{--un-text-opacity:1;color:rgb(0 0 0/var(--un-text-opacity))}.font-light[data-v-3e7cfec8]{font-weight:300}.font-medium[data-v-3e7cfec8]{font-weight:500}.leading-tight[data-v-3e7cfec8]{line-height:1.25}.font-sans[data-v-3e7cfec8]{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.antialiased[data-v-3e7cfec8]{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (prefers-color-scheme:dark){.dark\:bg-black[data-v-3e7cfec8]{--un-bg-opacity:1;background-color:rgb(0 0 0/var(--un-bg-opacity))}.dark\:text-white[data-v-3e7cfec8]{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media (min-width:640px){.sm\:px-0[data-v-3e7cfec8]{padding-left:0;padding-right:0}.sm\:text-4xl[data-v-3e7cfec8]{font-size:2.25rem;line-height:2.5rem}}
|
package/dist/module.cjs
DELETED
package/dist/module.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
-
import { HookResult } from '@nuxt/schema';
|
|
3
|
-
import { ModulePrivateOptionsExtend, ModuleOptionsExtend, ModuleOptions } from 'nuxt-i18n-micro-types';
|
|
4
|
-
export { Getter, GlobalLocaleRoutes, Locale, LocaleCode, ModuleOptions, PluralFunc, Strategies } from 'nuxt-i18n-micro-types';
|
|
5
|
-
export { PluginsInjections } from '../dist/runtime/plugins/01.plugin.js';
|
|
6
|
-
|
|
7
|
-
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
8
|
-
|
|
9
|
-
interface ModuleHooks {
|
|
10
|
-
'i18n:register': (registerModule: (translations: unknown, locale?: string) => void, locale: string) => HookResult;
|
|
11
|
-
}
|
|
12
|
-
declare module '@nuxt/schema' {
|
|
13
|
-
interface ConfigSchema {
|
|
14
|
-
i18nConfig?: ModulePrivateOptionsExtend;
|
|
15
|
-
publicRuntimeConfig?: {
|
|
16
|
-
i18nConfig?: ModuleOptionsExtend;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
interface NuxtConfig {
|
|
20
|
-
i18nConfig?: ModuleOptionsExtend;
|
|
21
|
-
}
|
|
22
|
-
interface NuxtOptions {
|
|
23
|
-
i18nConfig?: ModuleOptionsExtend;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
declare module '@nuxt/schema' {
|
|
27
|
-
interface NuxtHooks extends ModuleHooks {
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export { type ModuleHooks, _default as default };
|
package/dist/types.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ModuleHooks } from './module'
|
|
2
|
-
|
|
3
|
-
declare module '@nuxt/schema' {
|
|
4
|
-
interface NuxtHooks extends ModuleHooks {}
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export { type Getter, type GlobalLocaleRoutes, type Locale, type LocaleCode, type ModuleOptions, type PluralFunc, type Strategies } from './module'
|
package/dist/utils.d.mts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { NuxtPage } from '@nuxt/schema';
|
|
2
|
-
import { LocaleCode, Locale } from 'nuxt-i18n-micro-types';
|
|
3
|
-
|
|
4
|
-
declare const isInternalPath: (p: string) => boolean;
|
|
5
|
-
declare function extractLocaleRoutes(content: string, filePath: string): Record<string, string> | null;
|
|
6
|
-
declare function validateDefineI18nRouteConfig(obj: Record<LocaleCode, Record<string, string>>): boolean;
|
|
7
|
-
declare const normalizePath: (routePath: string) => string;
|
|
8
|
-
declare const cloneArray: <T extends object>(array: T[]) => T[];
|
|
9
|
-
declare const isPageRedirectOnly: (page: NuxtPage) => boolean;
|
|
10
|
-
declare const removeLeadingSlash: (routePath: string) => string;
|
|
11
|
-
declare const buildRouteName: (baseName: string, localeCode: string, isCustom: boolean) => string;
|
|
12
|
-
declare const shouldAddLocalePrefix: (locale: string, defaultLocale: Locale, addLocalePrefix: boolean, includeDefaultLocaleRoute: boolean) => boolean;
|
|
13
|
-
declare const isLocaleDefault: (locale: string | Locale, defaultLocale: Locale, includeDefaultLocaleRoute: boolean) => boolean;
|
|
14
|
-
declare const buildFullPath: (locale: string | string[], basePath: string, customRegex?: string | RegExp) => string;
|
|
15
|
-
declare const buildFullPathNoPrefix: (basePath: string) => string;
|
|
16
|
-
|
|
17
|
-
export { buildFullPath, buildFullPathNoPrefix, buildRouteName, cloneArray, extractLocaleRoutes, isInternalPath, isLocaleDefault, isPageRedirectOnly, normalizePath, removeLeadingSlash, shouldAddLocalePrefix, validateDefineI18nRouteConfig };
|
package/dist/utils.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { NuxtPage } from '@nuxt/schema';
|
|
2
|
-
import { LocaleCode, Locale } from 'nuxt-i18n-micro-types';
|
|
3
|
-
|
|
4
|
-
declare const isInternalPath: (p: string) => boolean;
|
|
5
|
-
declare function extractLocaleRoutes(content: string, filePath: string): Record<string, string> | null;
|
|
6
|
-
declare function validateDefineI18nRouteConfig(obj: Record<LocaleCode, Record<string, string>>): boolean;
|
|
7
|
-
declare const normalizePath: (routePath: string) => string;
|
|
8
|
-
declare const cloneArray: <T extends object>(array: T[]) => T[];
|
|
9
|
-
declare const isPageRedirectOnly: (page: NuxtPage) => boolean;
|
|
10
|
-
declare const removeLeadingSlash: (routePath: string) => string;
|
|
11
|
-
declare const buildRouteName: (baseName: string, localeCode: string, isCustom: boolean) => string;
|
|
12
|
-
declare const shouldAddLocalePrefix: (locale: string, defaultLocale: Locale, addLocalePrefix: boolean, includeDefaultLocaleRoute: boolean) => boolean;
|
|
13
|
-
declare const isLocaleDefault: (locale: string | Locale, defaultLocale: Locale, includeDefaultLocaleRoute: boolean) => boolean;
|
|
14
|
-
declare const buildFullPath: (locale: string | string[], basePath: string, customRegex?: string | RegExp) => string;
|
|
15
|
-
declare const buildFullPathNoPrefix: (basePath: string) => string;
|
|
16
|
-
|
|
17
|
-
export { buildFullPath, buildFullPathNoPrefix, buildRouteName, cloneArray, extractLocaleRoutes, isInternalPath, isLocaleDefault, isPageRedirectOnly, normalizePath, removeLeadingSlash, shouldAddLocalePrefix, validateDefineI18nRouteConfig };
|
package/dist/utils.mjs
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
|
|
3
|
-
const isInternalPath = (p) => /(?:^|\/)__[^/]+/.test(p);
|
|
4
|
-
function extractLocaleRoutes(content, filePath) {
|
|
5
|
-
const defineMatch = content.match(/\$?\bdefineI18nRoute\s*\(\s*\{[\s\S]*?\}\s*\)/);
|
|
6
|
-
if (defineMatch) {
|
|
7
|
-
const localeRoutesMatch = defineMatch[0].match(/localeRoutes:\s*(\{[\s\S]*?\})/);
|
|
8
|
-
if (localeRoutesMatch && localeRoutesMatch[1]) {
|
|
9
|
-
try {
|
|
10
|
-
const parsedLocaleRoutes = Function('"use strict";return (' + localeRoutesMatch[1] + ")")();
|
|
11
|
-
if (typeof parsedLocaleRoutes === "object" && parsedLocaleRoutes !== null) {
|
|
12
|
-
if (validateDefineI18nRouteConfig(parsedLocaleRoutes)) {
|
|
13
|
-
return parsedLocaleRoutes;
|
|
14
|
-
}
|
|
15
|
-
} else {
|
|
16
|
-
console.error("localeRoutes found but it is not a valid object in file:", filePath);
|
|
17
|
-
}
|
|
18
|
-
} catch (error) {
|
|
19
|
-
console.error("Failed to parse localeRoutes:", error, "in file:", filePath);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
function validateDefineI18nRouteConfig(obj) {
|
|
26
|
-
if (typeof obj !== "object")
|
|
27
|
-
return false;
|
|
28
|
-
for (const routeKey in obj.localeRoutes) {
|
|
29
|
-
if (typeof obj.localeRoutes[routeKey] !== "string")
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
return true;
|
|
33
|
-
}
|
|
34
|
-
const normalizePath = (routePath) => {
|
|
35
|
-
if (!routePath) {
|
|
36
|
-
return "";
|
|
37
|
-
}
|
|
38
|
-
const normalized = path.posix.normalize(routePath).replace(/\/+$/, "");
|
|
39
|
-
return normalized === "." ? "" : normalized;
|
|
40
|
-
};
|
|
41
|
-
const cloneArray = (array) => array.map((item) => ({ ...item }));
|
|
42
|
-
const isPageRedirectOnly = (page) => !!(page.redirect && !page.file);
|
|
43
|
-
const removeLeadingSlash = (routePath) => routePath.startsWith("/") ? routePath.slice(1) : routePath;
|
|
44
|
-
const buildRouteName = (baseName, localeCode, isCustom) => isCustom ? `localized-${baseName}-${localeCode}` : `localized-${baseName}`;
|
|
45
|
-
const shouldAddLocalePrefix = (locale, defaultLocale, addLocalePrefix, includeDefaultLocaleRoute) => addLocalePrefix && !(locale === defaultLocale.code && !includeDefaultLocaleRoute);
|
|
46
|
-
const isLocaleDefault = (locale, defaultLocale, includeDefaultLocaleRoute) => {
|
|
47
|
-
const localeCode = typeof locale === "string" ? locale : locale.code;
|
|
48
|
-
return localeCode === defaultLocale.code && !includeDefaultLocaleRoute;
|
|
49
|
-
};
|
|
50
|
-
const buildFullPath = (locale, basePath, customRegex) => {
|
|
51
|
-
const regexString = normalizeRegex(customRegex?.toString());
|
|
52
|
-
const localeParam = regexString ? regexString : Array.isArray(locale) ? locale.join("|") : locale;
|
|
53
|
-
return normalizePath(path.posix.join("/", `:locale(${localeParam})`, basePath));
|
|
54
|
-
};
|
|
55
|
-
const buildFullPathNoPrefix = (basePath) => {
|
|
56
|
-
return normalizePath(basePath);
|
|
57
|
-
};
|
|
58
|
-
const normalizeRegex = (toNorm) => {
|
|
59
|
-
if (typeof toNorm === "undefined")
|
|
60
|
-
return void 0;
|
|
61
|
-
return toNorm.startsWith("/") && toNorm.endsWith("/") ? toNorm?.slice(1, -1) : toNorm;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export { buildFullPath, buildFullPathNoPrefix, buildRouteName, cloneArray, extractLocaleRoutes, isInternalPath, isLocaleDefault, isPageRedirectOnly, normalizePath, removeLeadingSlash, shouldAddLocalePrefix, validateDefineI18nRouteConfig };
|
|
File without changes
|