nuxt-i18n-micro 1.29.1 → 1.29.3
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 +2 -2
- package/dist/client/404.html +2 -2
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/efe8653b-e25e-4eb9-99b4-1b76c53051da.json +1 -0
- package/dist/client/index.html +2 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +24 -1
- package/dist/runtime/components/i18n-link.vue +5 -2
- package/dist/runtime/components/i18n-switcher.vue +18 -3
- package/package.json +1 -1
- package/dist/client/_nuxt/builds/meta/c6bfb7b0-9919-40d4-b4ae-cc005b332740.json +0 -1
package/dist/client/200.html
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/0GmYR_kR.js">
|
|
9
9
|
<link rel="prefetch" as="style" crossorigin href="/__nuxt-i18n-micro/_nuxt/error-500.CBAEdpZV.css">
|
|
10
10
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/2C6ahHCU.js">
|
|
11
|
-
<script type="module" src="/__nuxt-i18n-micro/_nuxt/Czi4MokJ.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},
|
|
12
|
-
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"
|
|
11
|
+
<script type="module" src="/__nuxt-i18n-micro/_nuxt/Czi4MokJ.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1729514511413,false]</script>
|
|
12
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"efe8653b-e25e-4eb9-99b4-1b76c53051da",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
package/dist/client/404.html
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/0GmYR_kR.js">
|
|
9
9
|
<link rel="prefetch" as="style" crossorigin href="/__nuxt-i18n-micro/_nuxt/error-500.CBAEdpZV.css">
|
|
10
10
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/2C6ahHCU.js">
|
|
11
|
-
<script type="module" src="/__nuxt-i18n-micro/_nuxt/Czi4MokJ.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},
|
|
12
|
-
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"
|
|
11
|
+
<script type="module" src="/__nuxt-i18n-micro/_nuxt/Czi4MokJ.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1729514511414,false]</script>
|
|
12
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"efe8653b-e25e-4eb9-99b4-1b76c53051da",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"
|
|
1
|
+
{"id":"efe8653b-e25e-4eb9-99b4-1b76c53051da","timestamp":1729514500710}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"id":"efe8653b-e25e-4eb9-99b4-1b76c53051da","timestamp":1729514500710,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|
package/dist/client/index.html
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/0GmYR_kR.js">
|
|
9
9
|
<link rel="prefetch" as="style" crossorigin href="/__nuxt-i18n-micro/_nuxt/error-500.CBAEdpZV.css">
|
|
10
10
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/2C6ahHCU.js">
|
|
11
|
-
<script type="module" src="/__nuxt-i18n-micro/_nuxt/Czi4MokJ.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},
|
|
12
|
-
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"
|
|
11
|
+
<script type="module" src="/__nuxt-i18n-micro/_nuxt/Czi4MokJ.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1729514511414,false]</script>
|
|
12
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"efe8653b-e25e-4eb9-99b4-1b76c53051da",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import * as fs from 'node:fs';
|
|
3
3
|
import fs__default, { readFileSync, existsSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
4
|
-
import { useNuxt, defineNuxtModule, useLogger, createResolver, addPlugin, addImportsDir, addServerHandler, addComponentsDir, extendPages, addPrerenderRoutes } from '@nuxt/kit';
|
|
4
|
+
import { useNuxt, defineNuxtModule, useLogger, createResolver, addPlugin, addImportsDir, addServerHandler, addComponentsDir, addTypeTemplate, extendPages, addPrerenderRoutes } from '@nuxt/kit';
|
|
5
5
|
import { watch } from 'chokidar';
|
|
6
6
|
import { onDevToolsInitialized, extendServerRpc } from '@nuxt/devtools-kit';
|
|
7
7
|
|
|
@@ -364,6 +364,25 @@ class LocaleManager {
|
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
366
|
|
|
367
|
+
function generateI18nTypes() {
|
|
368
|
+
return `
|
|
369
|
+
import type {PluginsInjections} from "nuxt-i18n-micro";
|
|
370
|
+
|
|
371
|
+
declare module 'vue/types/vue' {
|
|
372
|
+
interface Vue extends PluginsInjections { }
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
declare module '@nuxt/types' {
|
|
376
|
+
interface NuxtAppOptions extends PluginsInjections { }
|
|
377
|
+
interface Context extends PluginsInjections { }
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
declare module '#app' {
|
|
381
|
+
interface NuxtApp extends PluginsInjections { }
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
export {}`;
|
|
385
|
+
}
|
|
367
386
|
const module = defineNuxtModule({
|
|
368
387
|
meta: {
|
|
369
388
|
name: "nuxt-i18n-micro",
|
|
@@ -479,6 +498,10 @@ const module = defineNuxtModule({
|
|
|
479
498
|
pathPrefix: false,
|
|
480
499
|
extensions: ["vue"]
|
|
481
500
|
});
|
|
501
|
+
addTypeTemplate({
|
|
502
|
+
filename: "types/i18n-plugin.d.ts",
|
|
503
|
+
getContents: () => generateI18nTypes()
|
|
504
|
+
});
|
|
482
505
|
extendPages((pages) => {
|
|
483
506
|
const pagesNames = pages.map((page) => page.name).filter((name) => name !== void 0 && (!options.routesLocaleLinks || !options.routesLocaleLinks[name]));
|
|
484
507
|
if (!options.disableWatcher) {
|
|
@@ -9,10 +9,11 @@
|
|
|
9
9
|
|
|
10
10
|
<script lang="ts" setup>
|
|
11
11
|
import type { RouteLocationRaw } from 'vue-router'
|
|
12
|
-
import type { PluginsInjections } from '../../runtime/plugins/01.plugin'
|
|
13
12
|
import { useNuxtApp, computed, useRoute, useRouter } from '#imports'
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
const { $localeRoute } = useNuxtApp()
|
|
16
17
|
|
|
17
18
|
interface Props {
|
|
18
19
|
to: RouteLocationRaw | string
|
|
@@ -24,6 +25,8 @@ const route = useRoute()
|
|
|
24
25
|
|
|
25
26
|
const isActive = computed(() => {
|
|
26
27
|
// If `to` is a string, compare it directly to the route path
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
29
|
+
// @ts-ignore
|
|
27
30
|
const newPath = $localeRoute(props.to)
|
|
28
31
|
if (typeof newPath === 'string') {
|
|
29
32
|
return route.path === useRouter().resolve(newPath).path
|
|
@@ -39,11 +39,18 @@
|
|
|
39
39
|
<script lang="ts" setup>
|
|
40
40
|
import { ref, computed } from 'vue'
|
|
41
41
|
import type { CSSProperties } from 'vue'
|
|
42
|
-
import type { Locale } from '../../types'
|
|
43
|
-
import type { PluginsInjections } from '../../runtime/plugins/01.plugin'
|
|
44
42
|
import { useNuxtApp } from '#app'
|
|
45
43
|
import { useRoute } from '#imports'
|
|
46
44
|
|
|
45
|
+
type LocaleCode = string
|
|
46
|
+
interface Locale {
|
|
47
|
+
code: LocaleCode
|
|
48
|
+
disabled?: boolean
|
|
49
|
+
iso?: string
|
|
50
|
+
dir?: 'ltr' | 'rtl' | 'auto'
|
|
51
|
+
displayName?: string
|
|
52
|
+
}
|
|
53
|
+
|
|
47
54
|
interface Props {
|
|
48
55
|
customLabels?: Record<string, string>
|
|
49
56
|
customWrapperStyle?: CSSProperties
|
|
@@ -68,9 +75,15 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
68
75
|
customIconStyle: () => ({}),
|
|
69
76
|
})
|
|
70
77
|
|
|
71
|
-
const { $localeRoute, $getLocales, $getLocale, $getLocaleName } = useNuxtApp()
|
|
78
|
+
const { $localeRoute, $getLocales, $getLocale, $getLocaleName } = useNuxtApp()
|
|
79
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
80
|
+
// @ts-ignore
|
|
72
81
|
const locales = ref($getLocales())
|
|
82
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
83
|
+
// @ts-ignore
|
|
73
84
|
const currentLocale = computed(() => $getLocale())
|
|
85
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
86
|
+
// @ts-ignore
|
|
74
87
|
const currentLocaleName = computed(() => $getLocaleName())
|
|
75
88
|
const dropdownOpen = ref(false)
|
|
76
89
|
|
|
@@ -101,6 +114,8 @@ const getLocaleLink = (locale: Locale) => {
|
|
|
101
114
|
.replace(new RegExp(`-${currentLocale.value}$`), '')
|
|
102
115
|
.replace(new RegExp(`-${locale}$`), '')
|
|
103
116
|
|
|
117
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
118
|
+
// @ts-ignore
|
|
104
119
|
return $localeRoute({ name: routeName }, locale.code)
|
|
105
120
|
}
|
|
106
121
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-i18n-micro",
|
|
3
|
-
"version": "1.29.
|
|
3
|
+
"version": "1.29.3",
|
|
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",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"id":"c6bfb7b0-9919-40d4-b4ae-cc005b332740","timestamp":1729513225644,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|