nuxt-i18n-micro 1.59.0 → 1.60.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.
@@ -8,5 +8,5 @@
8
8
  <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/EwNUkbJF.js">
9
9
  <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.C2JGrgZX.css">
10
10
  <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/DuZjM2Ym.js">
11
- <script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/C9njAg9E.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},1736500540286,false]</script>
12
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"cd075107-392f-495b-8345-ce296b14f76e",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
11
+ <script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/C9njAg9E.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},1736853592172,false]</script>
12
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"1bc37d11-ac0a-4cf4-9f49-6f1123ca70df",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
@@ -8,5 +8,5 @@
8
8
  <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/EwNUkbJF.js">
9
9
  <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.C2JGrgZX.css">
10
10
  <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/DuZjM2Ym.js">
11
- <script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/C9njAg9E.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},1736500540286,false]</script>
12
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"cd075107-392f-495b-8345-ce296b14f76e",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
11
+ <script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/C9njAg9E.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},1736853592173,false]</script>
12
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"1bc37d11-ac0a-4cf4-9f49-6f1123ca70df",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
@@ -1 +1 @@
1
- {"id":"cd075107-392f-495b-8345-ce296b14f76e","timestamp":1736500534009}
1
+ {"id":"1bc37d11-ac0a-4cf4-9f49-6f1123ca70df","timestamp":1736853586767}
@@ -0,0 +1 @@
1
+ {"id":"1bc37d11-ac0a-4cf4-9f49-6f1123ca70df","timestamp":1736853586767,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
@@ -8,5 +8,5 @@
8
8
  <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/EwNUkbJF.js">
9
9
  <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.C2JGrgZX.css">
10
10
  <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/DuZjM2Ym.js">
11
- <script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/C9njAg9E.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},1736500540286,false]</script>
12
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"cd075107-392f-495b-8345-ce296b14f76e",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
11
+ <script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/C9njAg9E.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},1736853592173,false]</script>
12
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"1bc37d11-ac0a-4cf4-9f49-6f1123ca70df",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
package/dist/module.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
2
  import { HookResult } from '@nuxt/schema';
3
- import { M as ModulePrivateOptionsExtend, b as ModuleOptionsExtend, c as ModuleOptions } from './shared/nuxt-i18n-micro.4444721d.mjs';
4
- export { d as Getter, G as GlobalLocaleRoutes, a as Locale, L as LocaleCode, P as PluralFunc } from './shared/nuxt-i18n-micro.4444721d.mjs';
3
+ import { M as ModulePrivateOptionsExtend, b as ModuleOptionsExtend, c as ModuleOptions } from './shared/nuxt-i18n-micro.4b19b717.mjs';
4
+ export { d as Getter, G as GlobalLocaleRoutes, a as Locale, L as LocaleCode, P as PluralFunc } from './shared/nuxt-i18n-micro.4b19b717.mjs';
5
5
  export { PluginsInjections } from '../dist/runtime/plugins/01.plugin.js';
6
6
 
7
7
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
package/dist/module.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
2
  import { HookResult } from '@nuxt/schema';
3
- import { M as ModulePrivateOptionsExtend, b as ModuleOptionsExtend, c as ModuleOptions } from './shared/nuxt-i18n-micro.4444721d.js';
4
- export { d as Getter, G as GlobalLocaleRoutes, a as Locale, L as LocaleCode, P as PluralFunc } from './shared/nuxt-i18n-micro.4444721d.js';
3
+ import { M as ModulePrivateOptionsExtend, b as ModuleOptionsExtend, c as ModuleOptions } from './shared/nuxt-i18n-micro.4b19b717.js';
4
+ export { d as Getter, G as GlobalLocaleRoutes, a as Locale, L as LocaleCode, P as PluralFunc } from './shared/nuxt-i18n-micro.4b19b717.js';
5
5
  export { PluginsInjections } from '../dist/runtime/plugins/01.plugin.js';
6
6
 
7
7
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-i18n-micro",
3
3
  "configKey": "i18n",
4
- "version": "1.59.0",
4
+ "version": "1.60.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.4",
7
7
  "unbuild": "2.0.0"
package/dist/module.mjs CHANGED
@@ -395,6 +395,7 @@ const module = defineNuxtModule({
395
395
  autoDetectLanguage: true,
396
396
  disablePageLocales: false,
397
397
  disableWatcher: false,
398
+ disableUpdater: false,
398
399
  includeDefaultLocaleRoute: void 0,
399
400
  fallbackLocale: void 0,
400
401
  localeCookie: "user-locale",
@@ -440,6 +441,7 @@ const module = defineNuxtModule({
440
441
  metaBaseUrl: options.metaBaseUrl ?? void 0,
441
442
  define: options.define ?? true,
442
443
  disableWatcher: options.disableWatcher ?? false,
444
+ disableUpdater: options.disableUpdater ?? false,
443
445
  defaultLocale: options.defaultLocale ?? "en",
444
446
  translationDir: options.translationDir ?? "locales",
445
447
  localeCookie: options.localeCookie ?? "user-locale",
@@ -615,22 +617,24 @@ const module = defineNuxtModule({
615
617
  }
616
618
  }
617
619
  });
618
- nuxt.hook("nitro:build:before", async (_nitro) => {
619
- const isProd = nuxt.options.dev === false;
620
- if (!isProd) {
621
- const translationPath = path.resolve(nuxt.options.rootDir, options.translationDir);
622
- logger.log("\u2139 add file watcher: " + translationPath);
623
- const watcherEvent = async (path2) => {
624
- watcher.close();
625
- logger.log("\u21BB update store item: " + path2);
626
- nuxt.callHook("restart");
627
- };
628
- const watcher = watch(translationPath, { depth: 2, persistent: true }).on("change", watcherEvent);
629
- nuxt.hook("close", () => {
630
- watcher.close();
631
- });
632
- }
633
- });
620
+ if (!options.disableUpdater) {
621
+ nuxt.hook("nitro:build:before", async (_nitro) => {
622
+ const isProd = nuxt.options.dev === false;
623
+ if (!isProd) {
624
+ const translationPath = path.resolve(nuxt.options.rootDir, options.translationDir);
625
+ logger.log("\u2139 add file watcher: " + translationPath);
626
+ const watcherEvent = async (path2) => {
627
+ watcher.close();
628
+ logger.log("\u21BB update store item: " + path2);
629
+ nuxt.callHook("restart");
630
+ };
631
+ const watcher = watch(translationPath, { depth: 2, persistent: true }).on("change", watcherEvent);
632
+ nuxt.hook("close", () => {
633
+ watcher.close();
634
+ });
635
+ }
636
+ });
637
+ }
634
638
  nuxt.hook("prerender:routes", async (prerenderRoutes) => {
635
639
  if (isNoPrefixStrategy(options.strategy)) {
636
640
  return;
@@ -20,8 +20,8 @@ declare const _default: import("nuxt/app").Plugin<{
20
20
  switchLocaleRoute: (toLocale: string) => string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric;
21
21
  switchLocalePath: (toLocale: string) => string;
22
22
  switchLocale: (toLocale: string) => void;
23
- switchRoute: (route: RouteLocationNormalizedLoaded | RouteLocationResolvedGeneric | string, toLocale?: string) => void;
24
- localeRoute: (to: RouteLocationAsString | RouteLocationAsRelative | RouteLocationAsPath, locale?: string) => RouteLocationResolved;
23
+ switchRoute: (to: RouteLocationNormalizedLoaded | RouteLocationResolvedGeneric | string, toLocale?: string) => void;
24
+ localeRoute: (to: RouteLocationAsString | RouteLocationAsRelative | RouteLocationAsPath | string, locale?: string) => RouteLocationResolved;
25
25
  localePath: (to: RouteLocationAsString | RouteLocationAsRelative | RouteLocationAsPath, locale?: string) => string;
26
26
  setI18nRouteParams: (value: I18nRouteParams) => I18nRouteParams;
27
27
  }> & import("nuxt/app").ObjectPlugin<{
@@ -43,8 +43,8 @@ declare const _default: import("nuxt/app").Plugin<{
43
43
  switchLocaleRoute: (toLocale: string) => string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric;
44
44
  switchLocalePath: (toLocale: string) => string;
45
45
  switchLocale: (toLocale: string) => void;
46
- switchRoute: (route: RouteLocationNormalizedLoaded | RouteLocationResolvedGeneric | string, toLocale?: string) => void;
47
- localeRoute: (to: RouteLocationAsString | RouteLocationAsRelative | RouteLocationAsPath, locale?: string) => RouteLocationResolved;
46
+ switchRoute: (to: RouteLocationNormalizedLoaded | RouteLocationResolvedGeneric | string, toLocale?: string) => void;
47
+ localeRoute: (to: RouteLocationAsString | RouteLocationAsRelative | RouteLocationAsPath | string, locale?: string) => RouteLocationResolved;
48
48
  localePath: (to: RouteLocationAsString | RouteLocationAsRelative | RouteLocationAsPath, locale?: string) => string;
49
49
  setI18nRouteParams: (value: I18nRouteParams) => I18nRouteParams;
50
50
  }>;
@@ -374,22 +374,28 @@ export default defineNuxtPlugin(async (nuxtApp) => {
374
374
  const route2 = router.currentRoute.value;
375
375
  switchLocale(i18nHelper.getLocale(), toLocale, route2, router, i18nConfig, i18nRouteParams.value);
376
376
  },
377
- switchRoute: (route2, toLocale) => {
377
+ switchRoute: (to, toLocale) => {
378
378
  const currentRoute = router.currentRoute.value;
379
379
  const fromLocale = (currentRoute.params?.locale ?? i18nConfig.defaultLocale).toString();
380
380
  const currentLocale2 = toLocale ?? fromLocale;
381
- let to = null;
382
- if (typeof route2 === "string" && !isNoPrefixStrategy(i18nConfig.strategy)) {
381
+ if (typeof to === "string" && !isNoPrefixStrategy(i18nConfig.strategy)) {
383
382
  if (currentLocale2 !== i18nConfig.defaultLocale || withPrefixStrategy(i18nConfig.strategy)) {
384
- to = router.resolve("/" + fromLocale + route2);
383
+ to = router.resolve("/" + fromLocale + to);
385
384
  } else {
386
- to = router.resolve(route2);
385
+ to = router.resolve(route);
387
386
  }
388
387
  }
389
388
  if (!to) {
390
389
  return;
391
390
  }
392
- switchLocale(i18nHelper.getLocale(), toLocale ?? fromLocale, to, router, i18nConfig, i18nRouteParams.value);
391
+ switchLocale(
392
+ i18nHelper.getLocale(),
393
+ toLocale ?? fromLocale,
394
+ to,
395
+ router,
396
+ i18nConfig,
397
+ i18nRouteParams.value
398
+ );
393
399
  },
394
400
  localeRoute: (to, locale) => {
395
401
  const fromLocale = i18nHelper.getLocale();
@@ -27,6 +27,7 @@ interface ModuleOptions {
27
27
  autoDetectLanguage?: boolean;
28
28
  autoDetectPath?: string;
29
29
  disableWatcher?: boolean;
30
+ disableUpdater?: boolean;
30
31
  types?: boolean;
31
32
  includeDefaultLocaleRoute?: boolean;
32
33
  routesLocaleLinks?: {
@@ -27,6 +27,7 @@ interface ModuleOptions {
27
27
  autoDetectLanguage?: boolean;
28
28
  autoDetectPath?: string;
29
29
  disableWatcher?: boolean;
30
+ disableUpdater?: boolean;
30
31
  types?: boolean;
31
32
  includeDefaultLocaleRoute?: boolean;
32
33
  routesLocaleLinks?: {
package/dist/utils.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { NuxtPage } from '@nuxt/schema';
2
- import { L as LocaleCode, a as Locale } from './shared/nuxt-i18n-micro.4444721d.mjs';
2
+ import { L as LocaleCode, a as Locale } from './shared/nuxt-i18n-micro.4b19b717.mjs';
3
3
 
4
4
  declare function extractLocaleRoutes(content: string, filePath: string): Record<string, string> | null;
5
5
  declare function validateDefineI18nRouteConfig(obj: Record<LocaleCode, Record<string, string>>): boolean;
package/dist/utils.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { NuxtPage } from '@nuxt/schema';
2
- import { L as LocaleCode, a as Locale } from './shared/nuxt-i18n-micro.4444721d.js';
2
+ import { L as LocaleCode, a as Locale } from './shared/nuxt-i18n-micro.4b19b717.js';
3
3
 
4
4
  declare function extractLocaleRoutes(content: string, filePath: string): Record<string, string> | null;
5
5
  declare function validateDefineI18nRouteConfig(obj: Record<LocaleCode, Record<string, string>>): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-i18n-micro",
3
- "version": "1.59.0",
3
+ "version": "1.60.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",
@@ -1 +0,0 @@
1
- {"id":"cd075107-392f-495b-8345-ce296b14f76e","timestamp":1736500534009,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}