nuxt-i18n-micro 1.63.2 → 1.65.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.
Files changed (37) hide show
  1. package/dist/client/200.html +8 -8
  2. package/dist/client/404.html +8 -8
  3. package/dist/client/_nuxt/{AXE8DZQI.js → CcDaBmcC.js} +1 -1
  4. package/dist/client/_nuxt/{Ddb0iCRU.js → ClTsZsex.js} +59 -59
  5. package/dist/client/_nuxt/{Deg2o1hP.js → DT0mZaxo.js} +1 -1
  6. package/dist/client/_nuxt/builds/latest.json +1 -1
  7. package/dist/client/_nuxt/builds/meta/ca0ba9b5-54af-4e8c-85d7-f8f741ea6b35.json +1 -0
  8. package/dist/client/_nuxt/error-404.DCBEmQSD.css +1 -0
  9. package/dist/client/_nuxt/error-500.D1x2GrnM.css +1 -0
  10. package/dist/client/_nuxt/{D9gx-VEt.js → rqhqIC0Q.js} +1 -1
  11. package/dist/client/index.html +8 -8
  12. package/dist/module.d.mts +3 -3
  13. package/dist/module.d.ts +3 -3
  14. package/dist/module.json +1 -1
  15. package/dist/module.mjs +48 -26
  16. package/dist/runtime/components/i18n-t.vue.d.ts +1 -1
  17. package/dist/runtime/components/locale-redirect.vue +20 -4
  18. package/dist/runtime/composables/useLocaleHead.js +2 -2
  19. package/dist/runtime/plugins/01.plugin.d.ts +7 -8
  20. package/dist/runtime/plugins/01.plugin.js +85 -325
  21. package/dist/runtime/plugins/03.define.d.ts +2 -2
  22. package/dist/runtime/plugins/03.define.js +29 -29
  23. package/dist/runtime/plugins/04.auto-detect.js +5 -3
  24. package/dist/runtime/translation-server-middleware.d.ts +1 -1
  25. package/dist/types.d.mts +1 -1
  26. package/dist/types.d.ts +1 -1
  27. package/dist/utils.d.mts +3 -2
  28. package/dist/utils.d.ts +3 -2
  29. package/dist/utils.mjs +4 -1
  30. package/package.json +5 -4
  31. package/dist/client/_nuxt/builds/meta/4fb36a07-acc6-4000-9c26-f521b5d784b5.json +0 -1
  32. package/dist/client/_nuxt/error-404.vh32VtAd.css +0 -1
  33. package/dist/client/_nuxt/error-500.EgQ3RNLZ.css +0 -1
  34. package/dist/runtime/helpers.d.ts +0 -6
  35. package/dist/runtime/helpers.js +0 -5
  36. package/dist/shared/nuxt-i18n-micro.4b19b717.d.mts +0 -57
  37. package/dist/shared/nuxt-i18n-micro.4b19b717.d.ts +0 -57
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.4b19b717.js';
2
+ import { LocaleCode, Locale } from 'nuxt-i18n-micro-types';
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;
@@ -11,5 +11,6 @@ declare const buildRouteName: (baseName: string, localeCode: string, isCustom: b
11
11
  declare const shouldAddLocalePrefix: (locale: string, defaultLocale: Locale, addLocalePrefix: boolean, includeDefaultLocaleRoute: boolean) => boolean;
12
12
  declare const isLocaleDefault: (locale: string | Locale, defaultLocale: Locale, includeDefaultLocaleRoute: boolean) => boolean;
13
13
  declare const buildFullPath: (locale: string | string[], basePath: string, customRegex?: string | RegExp) => string;
14
+ declare const buildFullPathNoPrefix: (basePath: string) => string;
14
15
 
15
- export { buildFullPath, buildRouteName, cloneArray, extractLocaleRoutes, isLocaleDefault, isPageRedirectOnly, normalizePath, removeLeadingSlash, shouldAddLocalePrefix, validateDefineI18nRouteConfig };
16
+ export { buildFullPath, buildFullPathNoPrefix, buildRouteName, cloneArray, extractLocaleRoutes, isLocaleDefault, isPageRedirectOnly, normalizePath, removeLeadingSlash, shouldAddLocalePrefix, validateDefineI18nRouteConfig };
package/dist/utils.mjs CHANGED
@@ -51,10 +51,13 @@ const buildFullPath = (locale, basePath, customRegex) => {
51
51
  const localeParam = regexString ? regexString : Array.isArray(locale) ? locale.join("|") : locale;
52
52
  return normalizePath(path.posix.join("/", `:locale(${localeParam})`, basePath));
53
53
  };
54
+ const buildFullPathNoPrefix = (basePath) => {
55
+ return normalizePath(basePath);
56
+ };
54
57
  const normalizeRegex = (toNorm) => {
55
58
  if (typeof toNorm === "undefined")
56
59
  return void 0;
57
60
  return toNorm.startsWith("/") && toNorm.endsWith("/") ? toNorm?.slice(1, -1) : toNorm;
58
61
  };
59
62
 
60
- export { buildFullPath, buildRouteName, cloneArray, extractLocaleRoutes, isLocaleDefault, isPageRedirectOnly, normalizePath, removeLeadingSlash, shouldAddLocalePrefix, validateDefineI18nRouteConfig };
63
+ export { buildFullPath, buildFullPathNoPrefix, buildRouteName, cloneArray, extractLocaleRoutes, isLocaleDefault, isPageRedirectOnly, normalizePath, removeLeadingSlash, shouldAddLocalePrefix, validateDefineI18nRouteConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-i18n-micro",
3
- "version": "1.63.2",
3
+ "version": "1.65.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",
@@ -53,8 +53,9 @@
53
53
  "globby": "^14.0.2",
54
54
  "sirv": "^2.0.4",
55
55
  "ufo": "^1.5.4",
56
- "nuxt-i18n-micro-core": "1.0.13",
57
- "nuxt-i18n-micro-test-utils": "1.0.6"
56
+ "nuxt-i18n-micro-test-utils": "1.0.6",
57
+ "nuxt-i18n-micro-types": "1.0.0",
58
+ "nuxt-i18n-micro-core": "1.0.14"
58
59
  },
59
60
  "devDependencies": {
60
61
  "@nuxt/devtools": "^1.7.0",
@@ -73,7 +74,7 @@
73
74
  "ts-jest": "^29.2.5",
74
75
  "typescript": "5.6.3",
75
76
  "vitepress": "^1.5.0",
76
- "vitest": "^2.1.8",
77
+ "vitest": "^3.0.2",
77
78
  "vue-tsc": "2.1.10"
78
79
  },
79
80
  "optionalDependencies": {
@@ -1 +0,0 @@
1
- {"id":"4fb36a07-acc6-4000-9c26-f521b5d784b5","timestamp":1737032288794,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
@@ -1 +0,0 @@
1
- .spotlight[data-v-c1463376]{background:linear-gradient(45deg,#00dc82,#36e4da 50%,#0047e1);bottom:-30vh;filter:blur(20vh);height:40vh}.gradient-border[data-v-c1463376]{-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);border-radius:.5rem;position:relative}@media (prefers-color-scheme:light){.gradient-border[data-v-c1463376]{background-color:#ffffff4d}.gradient-border[data-v-c1463376]:before{background:linear-gradient(90deg,#e2e2e2,#e2e2e2 25%,#00dc82,#36e4da 75%,#0047e1)}}@media (prefers-color-scheme:dark){.gradient-border[data-v-c1463376]{background-color:#1414144d}.gradient-border[data-v-c1463376]:before{background:linear-gradient(90deg,#303030,#303030 25%,#00dc82,#36e4da 75%,#0047e1)}}.gradient-border[data-v-c1463376]:before{background-size:400% auto;border-radius:.5rem;bottom:0;content:"";left: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;right:0;top:0;transition:background-position .3s ease-in-out,opacity .2s ease-in-out;width:100%}.gradient-border[data-v-c1463376]:hover:before{background-position:-50% 0;opacity:1}.fixed[data-v-c1463376]{position:fixed}.left-0[data-v-c1463376]{left:0}.right-0[data-v-c1463376]{right:0}.z-10[data-v-c1463376]{z-index:10}.z-20[data-v-c1463376]{z-index:20}.grid[data-v-c1463376]{display:grid}.mb-16[data-v-c1463376]{margin-bottom:4rem}.mb-8[data-v-c1463376]{margin-bottom:2rem}.max-w-520px[data-v-c1463376]{max-width:520px}.min-h-screen[data-v-c1463376]{min-height:100vh}.w-full[data-v-c1463376]{width:100%}.flex[data-v-c1463376]{display:flex}.cursor-pointer[data-v-c1463376]{cursor:pointer}.place-content-center[data-v-c1463376]{place-content:center}.items-center[data-v-c1463376]{align-items:center}.justify-center[data-v-c1463376]{justify-content:center}.overflow-hidden[data-v-c1463376]{overflow:hidden}.bg-white[data-v-c1463376]{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.px-4[data-v-c1463376]{padding-left:1rem;padding-right:1rem}.px-8[data-v-c1463376]{padding-left:2rem;padding-right:2rem}.py-2[data-v-c1463376]{padding-bottom:.5rem;padding-top:.5rem}.text-center[data-v-c1463376]{text-align:center}.text-8xl[data-v-c1463376]{font-size:6rem;line-height:1}.text-xl[data-v-c1463376]{font-size:1.25rem;line-height:1.75rem}.text-black[data-v-c1463376]{--un-text-opacity:1;color:rgb(0 0 0/var(--un-text-opacity))}.font-light[data-v-c1463376]{font-weight:300}.font-medium[data-v-c1463376]{font-weight:500}.leading-tight[data-v-c1463376]{line-height:1.25}.font-sans[data-v-c1463376]{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-c1463376]{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (prefers-color-scheme:dark){.dark\:bg-black[data-v-c1463376]{--un-bg-opacity:1;background-color:rgb(0 0 0/var(--un-bg-opacity))}.dark\:text-white[data-v-c1463376]{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media (min-width:640px){.sm\:px-0[data-v-c1463376]{padding-left:0;padding-right:0}.sm\:px-6[data-v-c1463376]{padding-left:1.5rem;padding-right:1.5rem}.sm\:py-3[data-v-c1463376]{padding-bottom:.75rem;padding-top:.75rem}.sm\:text-4xl[data-v-c1463376]{font-size:2.25rem;line-height:2.5rem}.sm\:text-xl[data-v-c1463376]{font-size:1.25rem;line-height:1.75rem}}
@@ -1 +0,0 @@
1
- .spotlight[data-v-05ddf355]{background:linear-gradient(45deg,#00dc82,#36e4da 50%,#0047e1);filter:blur(20vh)}.fixed[data-v-05ddf355]{position:fixed}.-bottom-1\/2[data-v-05ddf355]{bottom:-50%}.left-0[data-v-05ddf355]{left:0}.right-0[data-v-05ddf355]{right:0}.grid[data-v-05ddf355]{display:grid}.mb-16[data-v-05ddf355]{margin-bottom:4rem}.mb-8[data-v-05ddf355]{margin-bottom:2rem}.h-1\/2[data-v-05ddf355]{height:50%}.max-w-520px[data-v-05ddf355]{max-width:520px}.min-h-screen[data-v-05ddf355]{min-height:100vh}.place-content-center[data-v-05ddf355]{place-content:center}.overflow-hidden[data-v-05ddf355]{overflow:hidden}.bg-white[data-v-05ddf355]{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.px-8[data-v-05ddf355]{padding-left:2rem;padding-right:2rem}.text-center[data-v-05ddf355]{text-align:center}.text-8xl[data-v-05ddf355]{font-size:6rem;line-height:1}.text-xl[data-v-05ddf355]{font-size:1.25rem;line-height:1.75rem}.text-black[data-v-05ddf355]{--un-text-opacity:1;color:rgb(0 0 0/var(--un-text-opacity))}.font-light[data-v-05ddf355]{font-weight:300}.font-medium[data-v-05ddf355]{font-weight:500}.leading-tight[data-v-05ddf355]{line-height:1.25}.font-sans[data-v-05ddf355]{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-05ddf355]{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (prefers-color-scheme:dark){.dark\:bg-black[data-v-05ddf355]{--un-bg-opacity:1;background-color:rgb(0 0 0/var(--un-bg-opacity))}.dark\:text-white[data-v-05ddf355]{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media (min-width:640px){.sm\:px-0[data-v-05ddf355]{padding-left:0;padding-right:0}.sm\:text-4xl[data-v-05ddf355]{font-size:2.25rem;line-height:2.5rem}}
@@ -1,6 +0,0 @@
1
- import type { Strategies } from '../types.js';
2
- export declare const withPrefixStrategy: (strategy: Strategies) => strategy is "prefix" | "prefix_and_default";
3
- export declare const isNoPrefixStrategy: (strategy: Strategies) => strategy is "no_prefix";
4
- export declare const isPrefixStrategy: (strategy: Strategies) => strategy is "prefix";
5
- export declare const isPrefixExceptDefaultStrategy: (strategy: Strategies) => strategy is "prefix_except_default";
6
- export declare const isPrefixAndDefaultStrategy: (strategy: Strategies) => strategy is "prefix_and_default";
@@ -1,5 +0,0 @@
1
- export const withPrefixStrategy = (strategy) => strategy === "prefix" || strategy === "prefix_and_default";
2
- export const isNoPrefixStrategy = (strategy) => strategy === "no_prefix";
3
- export const isPrefixStrategy = (strategy) => strategy === "prefix";
4
- export const isPrefixExceptDefaultStrategy = (strategy) => strategy === "prefix_except_default";
5
- export const isPrefixAndDefaultStrategy = (strategy) => strategy === "prefix_and_default";
@@ -1,57 +0,0 @@
1
- type LocaleCode = string;
2
- interface Locale {
3
- code: LocaleCode;
4
- disabled?: boolean;
5
- iso?: string;
6
- dir?: 'ltr' | 'rtl' | 'auto';
7
- displayName?: string;
8
- baseUrl?: string;
9
- baseDefault?: boolean;
10
- [key: string]: unknown;
11
- }
12
- type Params = Record<string, string | number | boolean>;
13
- type Getter = (key: string, params?: Record<string, string | number | boolean>, defaultValue?: string) => unknown;
14
- type PluralFunc = (key: string, count: number, params: Params, locale: string, getter: Getter) => string | null;
15
- type GlobalLocaleRoutes = Record<string, Record<LocaleCode, string> | false | boolean> | null | undefined;
16
- type Strategies = 'no_prefix' | 'prefix_except_default' | 'prefix' | 'prefix_and_default';
17
- interface ModuleOptions {
18
- locales?: Locale[];
19
- meta?: boolean;
20
- strategy?: Strategies;
21
- metaBaseUrl?: string;
22
- define?: boolean;
23
- plugin?: boolean;
24
- defaultLocale?: string;
25
- apiBaseUrl?: string;
26
- translationDir?: string;
27
- autoDetectLanguage?: boolean;
28
- autoDetectPath?: string;
29
- disableWatcher?: boolean;
30
- disableUpdater?: boolean;
31
- types?: boolean;
32
- includeDefaultLocaleRoute?: boolean;
33
- routesLocaleLinks?: {
34
- [key: string]: string;
35
- };
36
- plural?: string | PluralFunc;
37
- disablePageLocales?: boolean;
38
- fallbackLocale?: string;
39
- localeCookie?: string;
40
- debug?: boolean;
41
- globalLocaleRoutes?: GlobalLocaleRoutes;
42
- customRegexMatcher?: string | RegExp;
43
- }
44
- interface ModuleOptionsExtend extends ModuleOptions {
45
- dateBuild: number;
46
- hashMode: boolean;
47
- isSSG: boolean;
48
- apiBaseUrl: string;
49
- disablePageLocales: boolean;
50
- }
51
- interface ModulePrivateOptionsExtend extends ModuleOptions {
52
- rootDir: string;
53
- rootDirs: string[];
54
- debug: boolean;
55
- }
56
-
57
- export type { GlobalLocaleRoutes as G, LocaleCode as L, ModulePrivateOptionsExtend as M, PluralFunc as P, Locale as a, ModuleOptionsExtend as b, ModuleOptions as c, Getter as d };
@@ -1,57 +0,0 @@
1
- type LocaleCode = string;
2
- interface Locale {
3
- code: LocaleCode;
4
- disabled?: boolean;
5
- iso?: string;
6
- dir?: 'ltr' | 'rtl' | 'auto';
7
- displayName?: string;
8
- baseUrl?: string;
9
- baseDefault?: boolean;
10
- [key: string]: unknown;
11
- }
12
- type Params = Record<string, string | number | boolean>;
13
- type Getter = (key: string, params?: Record<string, string | number | boolean>, defaultValue?: string) => unknown;
14
- type PluralFunc = (key: string, count: number, params: Params, locale: string, getter: Getter) => string | null;
15
- type GlobalLocaleRoutes = Record<string, Record<LocaleCode, string> | false | boolean> | null | undefined;
16
- type Strategies = 'no_prefix' | 'prefix_except_default' | 'prefix' | 'prefix_and_default';
17
- interface ModuleOptions {
18
- locales?: Locale[];
19
- meta?: boolean;
20
- strategy?: Strategies;
21
- metaBaseUrl?: string;
22
- define?: boolean;
23
- plugin?: boolean;
24
- defaultLocale?: string;
25
- apiBaseUrl?: string;
26
- translationDir?: string;
27
- autoDetectLanguage?: boolean;
28
- autoDetectPath?: string;
29
- disableWatcher?: boolean;
30
- disableUpdater?: boolean;
31
- types?: boolean;
32
- includeDefaultLocaleRoute?: boolean;
33
- routesLocaleLinks?: {
34
- [key: string]: string;
35
- };
36
- plural?: string | PluralFunc;
37
- disablePageLocales?: boolean;
38
- fallbackLocale?: string;
39
- localeCookie?: string;
40
- debug?: boolean;
41
- globalLocaleRoutes?: GlobalLocaleRoutes;
42
- customRegexMatcher?: string | RegExp;
43
- }
44
- interface ModuleOptionsExtend extends ModuleOptions {
45
- dateBuild: number;
46
- hashMode: boolean;
47
- isSSG: boolean;
48
- apiBaseUrl: string;
49
- disablePageLocales: boolean;
50
- }
51
- interface ModulePrivateOptionsExtend extends ModuleOptions {
52
- rootDir: string;
53
- rootDirs: string[];
54
- debug: boolean;
55
- }
56
-
57
- export type { GlobalLocaleRoutes as G, LocaleCode as L, ModulePrivateOptionsExtend as M, PluralFunc as P, Locale as a, ModuleOptionsExtend as b, ModuleOptions as c, Getter as d };