nuxt-i18n-micro 3.21.2 → 3.21.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.
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/entry.Kj_DYE7z.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/SDQMalAT.js"><script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/SDQMalAT.js" crossorigin></script><link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-404.CyBDSRXN.css"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/Dx6dmpFi.js"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BA2bGsrZ.js"><link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.DJtCwW7w.css"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/C_HK2snF.js"></head><body><div id="__nuxt"></div><div id="teleports"></div><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"f7833305-70eb-49a4-b409-6c9a2024ac9f",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1782733813121,false]</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/entry.Kj_DYE7z.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/SDQMalAT.js"><script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/SDQMalAT.js" crossorigin></script><link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-404.CyBDSRXN.css"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/Dx6dmpFi.js"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BA2bGsrZ.js"><link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.DJtCwW7w.css"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/C_HK2snF.js"></head><body><div id="__nuxt"></div><div id="teleports"></div><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"c9d7b088-6db2-475d-ace3-eb69981a0074",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1783063267809,false]</script></body></html>
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/entry.Kj_DYE7z.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/SDQMalAT.js"><script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/SDQMalAT.js" crossorigin></script><link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-404.CyBDSRXN.css"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/Dx6dmpFi.js"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BA2bGsrZ.js"><link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.DJtCwW7w.css"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/C_HK2snF.js"></head><body><div id="__nuxt"></div><div id="teleports"></div><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"f7833305-70eb-49a4-b409-6c9a2024ac9f",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1782733813121,false]</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/entry.Kj_DYE7z.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/SDQMalAT.js"><script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/SDQMalAT.js" crossorigin></script><link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-404.CyBDSRXN.css"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/Dx6dmpFi.js"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BA2bGsrZ.js"><link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.DJtCwW7w.css"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/C_HK2snF.js"></head><body><div id="__nuxt"></div><div id="teleports"></div><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"c9d7b088-6db2-475d-ace3-eb69981a0074",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1783063267809,false]</script></body></html>
@@ -1 +1 @@
1
- {"id":"f7833305-70eb-49a4-b409-6c9a2024ac9f","timestamp":1782733808986}
1
+ {"id":"c9d7b088-6db2-475d-ace3-eb69981a0074","timestamp":1783063264190}
@@ -0,0 +1 @@
1
+ {"id":"c9d7b088-6db2-475d-ace3-eb69981a0074","timestamp":1783063264190,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/entry.Kj_DYE7z.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/SDQMalAT.js"><script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/SDQMalAT.js" crossorigin></script><link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-404.CyBDSRXN.css"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/Dx6dmpFi.js"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BA2bGsrZ.js"><link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.DJtCwW7w.css"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/C_HK2snF.js"></head><body><div id="__nuxt"></div><div id="teleports"></div><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"f7833305-70eb-49a4-b409-6c9a2024ac9f",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1782733813121,false]</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/entry.Kj_DYE7z.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/SDQMalAT.js"><script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/SDQMalAT.js" crossorigin></script><link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-404.CyBDSRXN.css"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/Dx6dmpFi.js"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BA2bGsrZ.js"><link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.DJtCwW7w.css"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/C_HK2snF.js"></head><body><div id="__nuxt"></div><div id="teleports"></div><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"c9d7b088-6db2-475d-ace3-eb69981a0074",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1783063267809,false]</script></body></html>
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-i18n-micro",
3
3
  "configKey": "i18n",
4
- "version": "3.21.2",
4
+ "version": "3.21.3",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -1,9 +1,10 @@
1
1
  import { isInternalPath } from "@i18n-micro/route-strategy";
2
2
  import { getEnabledLocaleCodes } from "@i18n-micro/utils/active-locales";
3
+ import { withoutAppBaseURL } from "@i18n-micro/utils/app-path";
3
4
  import { getLocaleCookieName, getLocaleCookieOptions } from "@i18n-micro/utils/cookie";
4
5
  import { resolvePreferredLocale } from "@i18n-micro/utils/resolve-locale";
5
6
  import { getCookie, getHeader, getRequestURL, setCookie } from "h3";
6
- import { createError, defineNuxtPlugin, navigateTo, useRequestEvent, useState } from "#imports";
7
+ import { createError, defineNuxtPlugin, navigateTo, useRequestEvent, useRuntimeConfig, useState } from "#imports";
7
8
  const DEBUG = process.env.NUXT_I18N_DEBUG_REDIRECT === "1";
8
9
  function resolveI18nStrategy(nuxtApp) {
9
10
  if (nuxtApp.$i18nStrategy) {
@@ -21,6 +22,7 @@ export default defineNuxtPlugin({
21
22
  throw new Error("[nuxt-i18n-micro] i18n redirect plugin requires $getI18nConfig from the main i18n plugin.");
22
23
  }
23
24
  const i18nConfig = getRuntimeConfig();
25
+ const appBaseURL = useRuntimeConfig().app.baseURL;
24
26
  const validLocales = getEnabledLocaleCodes(i18nConfig.locales);
25
27
  const defaultLocale = i18nConfig.defaultLocale || "en";
26
28
  const autoDetectPath = i18nConfig.autoDetectPath || "/";
@@ -29,7 +31,7 @@ export default defineNuxtPlugin({
29
31
  const event = useRequestEvent();
30
32
  if (!event) return;
31
33
  const url = getRequestURL(event);
32
- const path = url.pathname;
34
+ const path = withoutAppBaseURL(url.pathname, appBaseURL);
33
35
  const performRedirect = (targetUrl, code = 302) => {
34
36
  return navigateTo(targetUrl, { redirectCode: code });
35
37
  };
@@ -1,4 +1,5 @@
1
1
  import { getEnabledLocaleCodes } from "@i18n-micro/utils/active-locales";
2
+ import { withoutAppBaseURL } from "@i18n-micro/utils/app-path";
2
3
  import { getLocaleCookieName } from "@i18n-micro/utils/cookie";
3
4
  import { resolveServerLocale } from "@i18n-micro/utils/resolve-locale";
4
5
  import { resolveI18nConfigWithRuntimeOverrides } from "@i18n-micro/utils/runtime-config";
@@ -8,7 +9,9 @@ import { getI18nConfig } from "#i18n-internal/strategy";
8
9
  import { useRuntimeConfig } from "#imports";
9
10
  import { loadTranslationsFromServer } from "../utils/server-loader.js";
10
11
  export default defineEventHandler(async (event) => {
11
- const path = event.path || getRequestURL(event).pathname;
12
+ const appBaseURL = useRuntimeConfig(event).app.baseURL;
13
+ const rawPath = event.path || getRequestURL(event).pathname;
14
+ const path = withoutAppBaseURL(rawPath, appBaseURL);
12
15
  if (path.startsWith("/api") || path.startsWith("/_nuxt") || path.startsWith("/_locales") || path.startsWith("/__")) return;
13
16
  if (path.includes(".") && !path.endsWith(".html")) return;
14
17
  const config = resolveI18nConfigWithRuntimeOverrides(
@@ -1,7 +1,9 @@
1
1
  import { getEnabledLocaleCodes } from "@i18n-micro/utils/active-locales";
2
+ import { withoutAppBaseURL } from "@i18n-micro/utils/app-path";
2
3
  import { getLocaleCookieName } from "@i18n-micro/utils/cookie";
3
4
  import { resolveServerLocale } from "@i18n-micro/utils/resolve-locale";
4
5
  import { getCookie, getQuery, getRequestURL } from "h3";
6
+ import { useRuntimeConfig } from "#imports";
5
7
  export const detectCurrentLocale = (event, config, defaultLocale) => {
6
8
  const { fallbackLocale, defaultLocale: configDefaultLocale, locales, localeCookie, autoDetectLanguage } = config;
7
9
  if (event.context.params?.locale) {
@@ -10,7 +12,8 @@ export const detectCurrentLocale = (event, config, defaultLocale) => {
10
12
  const resolvedDefault = defaultLocale || configDefaultLocale || "en";
11
13
  const validLocales = getEnabledLocaleCodes(locales ?? []);
12
14
  const url = getRequestURL(event);
13
- const cleanPath = url.pathname.split("?")[0]?.split("#")[0] ?? url.pathname;
15
+ const rawPath = url.pathname.split("?")[0]?.split("#")[0] ?? url.pathname;
16
+ const cleanPath = withoutAppBaseURL(rawPath, useRuntimeConfig(event).app.baseURL);
14
17
  const pathSegments = cleanPath.split("/").filter(Boolean);
15
18
  const firstSegment = pathSegments[0] ?? "";
16
19
  const hasLocaleInUrl = Boolean(firstSegment && validLocales.includes(firstSegment));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-i18n-micro",
3
- "version": "3.21.2",
3
+ "version": "3.21.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",
@@ -76,13 +76,13 @@
76
76
  "ufo": "^1.5.4",
77
77
  "unplugin": "^1.16.1",
78
78
  "@vue/compiler-sfc": "^3.5.25",
79
- "@i18n-micro/core": "1.3.3",
80
79
  "@i18n-micro/hmr": "1.0.2",
81
- "@i18n-micro/path-strategy": "1.3.4",
82
80
  "@i18n-micro/test-utils": "1.2.2",
83
- "@i18n-micro/types": "1.2.6",
84
81
  "@i18n-micro/route-strategy": "1.1.9",
85
- "@i18n-micro/utils": "1.0.4"
82
+ "@i18n-micro/path-strategy": "1.3.4",
83
+ "@i18n-micro/types": "1.2.6",
84
+ "@i18n-micro/core": "1.3.3",
85
+ "@i18n-micro/utils": "1.0.6"
86
86
  },
87
87
  "devDependencies": {
88
88
  "oxfmt": "^0.43.0",
@@ -1 +0,0 @@
1
- {"id":"f7833305-70eb-49a4-b409-6c9a2024ac9f","timestamp":1782733808986,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}