nuxt-i18n-micro 3.21.0 → 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:"0792ea61-cd2b-4714-91c8-a8e7805549a8",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1782394434395,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:"0792ea61-cd2b-4714-91c8-a8e7805549a8",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1782394434396,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":"0792ea61-cd2b-4714-91c8-a8e7805549a8","timestamp":1782394431420}
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:"0792ea61-cd2b-4714-91c8-a8e7805549a8",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1782394434396,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.0",
4
+ "version": "3.21.3",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -319,14 +319,6 @@ function collectDefineI18nRouteMetaFromFiles(pageFiles, rootDirs) {
319
319
  }
320
320
 
321
321
  const DEFAULT_CANONICAL_QUERY_WHITELIST = ["page", "sort", "filter", "search", "q", "query", "tag"];
322
- const moduleRequire = createRequire(import.meta.url);
323
- const I18N_MICRO_NITRO_TRACE_ENTRIES = [
324
- "@i18n-micro/utils/route",
325
- "@i18n-micro/core",
326
- "@i18n-micro/route-strategy",
327
- "@i18n-micro/path-strategy",
328
- "@i18n-micro/hmr/cache-keys"
329
- ];
330
322
  function generateI18nTypes() {
331
323
  return `
332
324
  import type {PluginsInjections} from "nuxt-i18n-micro";
@@ -769,17 +761,6 @@ declare module '#i18n-internal/plural' {
769
761
  nitroConfig.alias["#i18n-internal/plural"] = pluralTemplate.dst;
770
762
  nitroConfig.alias["#i18n-internal/strategy"] = strategyTemplate.dst;
771
763
  nitroConfig.alias["#i18n-internal/config"] = configTemplate.dst;
772
- nitroConfig.externals = nitroConfig.externals || {};
773
- nitroConfig.externals.traceInclude = nitroConfig.externals.traceInclude || [];
774
- for (const entry of I18N_MICRO_NITRO_TRACE_ENTRIES) {
775
- try {
776
- const resolved = moduleRequire.resolve(entry);
777
- if (!nitroConfig.externals.traceInclude.includes(resolved)) {
778
- nitroConfig.externals.traceInclude.push(resolved);
779
- }
780
- } catch {
781
- }
782
- }
783
764
  if (translationPayloads.serverAssets) {
784
765
  nitroConfig.serverAssets = nitroConfig.serverAssets || [];
785
766
  nitroConfig.serverAssets.push({
@@ -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.0",
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.2",
80
- "@i18n-micro/route-strategy": "1.1.8",
81
- "@i18n-micro/path-strategy": "1.3.3",
82
- "@i18n-micro/types": "1.2.6",
83
- "@i18n-micro/utils": "1.0.3",
79
+ "@i18n-micro/hmr": "1.0.2",
84
80
  "@i18n-micro/test-utils": "1.2.2",
85
- "@i18n-micro/hmr": "1.0.1"
81
+ "@i18n-micro/route-strategy": "1.1.9",
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":"0792ea61-cd2b-4714-91c8-a8e7805549a8","timestamp":1782394431420,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}