nuxt-i18n-micro 1.89.0 → 1.90.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/wFfez25B.js">
9
9
  <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.0eydygwr.css">
10
10
  <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/DDsBobp8.js">
11
- <script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BAeNieJD.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},1754719495852,false]</script>
12
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"f9f50f20-eeba-4e27-be51-939811ea107e",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
11
+ <script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BAeNieJD.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},1754753555195,false]</script>
12
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"f86721c0-54d9-4b43-8b95-4aef334b801b",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
@@ -8,5 +8,5 @@
8
8
  <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/wFfez25B.js">
9
9
  <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.0eydygwr.css">
10
10
  <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/DDsBobp8.js">
11
- <script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BAeNieJD.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},1754719495852,false]</script>
12
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"f9f50f20-eeba-4e27-be51-939811ea107e",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
11
+ <script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BAeNieJD.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},1754753555195,false]</script>
12
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"f86721c0-54d9-4b43-8b95-4aef334b801b",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
@@ -1 +1 @@
1
- {"id":"f9f50f20-eeba-4e27-be51-939811ea107e","timestamp":1754719491099}
1
+ {"id":"f86721c0-54d9-4b43-8b95-4aef334b801b","timestamp":1754753549253}
@@ -0,0 +1 @@
1
+ {"id":"f86721c0-54d9-4b43-8b95-4aef334b801b","timestamp":1754753549253,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
@@ -8,5 +8,5 @@
8
8
  <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/wFfez25B.js">
9
9
  <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.0eydygwr.css">
10
10
  <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/DDsBobp8.js">
11
- <script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BAeNieJD.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},1754719495852,false]</script>
12
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"f9f50f20-eeba-4e27-be51-939811ea107e",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
11
+ <script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BAeNieJD.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},1754753555196,false]</script>
12
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"f86721c0-54d9-4b43-8b95-4aef334b801b",buildAssetsDir:"/_nuxt/",cdnURL:""}}</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": "1.89.0",
4
+ "version": "1.90.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.4",
7
7
  "unbuild": "2.0.0"
package/dist/module.mjs CHANGED
@@ -7,7 +7,7 @@ import { isPrefixAndDefaultStrategy, isPrefixStrategy, isNoPrefixStrategy, isPre
7
7
  import { fileURLToPath } from 'node:url';
8
8
  import { onDevToolsInitialized, extendServerRpc } from '@nuxt/devtools-kit';
9
9
  import sirv from 'sirv';
10
- import { extractLocaleRoutes, normalizePath, isLocaleDefault, cloneArray, isPageRedirectOnly, removeLeadingSlash, shouldAddLocalePrefix, buildFullPath, buildRouteName, buildFullPathNoPrefix } from './utils.mjs';
10
+ import { isInternalPath, extractLocaleRoutes, normalizePath, isLocaleDefault, cloneArray, isPageRedirectOnly, removeLeadingSlash, shouldAddLocalePrefix, buildFullPath, buildRouteName, buildFullPathNoPrefix } from './utils.mjs';
11
11
 
12
12
  const DEVTOOLS_UI_PORT = 3030;
13
13
  const DEVTOOLS_UI_ROUTE = "/__nuxt-i18n-micro";
@@ -144,6 +144,9 @@ class PageManager {
144
144
  this.localizedPaths = this.extractLocalizedPaths(pages);
145
145
  const additionalRoutes = [];
146
146
  for (const page of [...pages]) {
147
+ if (page.path && isInternalPath(page.path)) {
148
+ continue;
149
+ }
147
150
  if (!page.name && page.file?.endsWith(".vue")) {
148
151
  console.warn(`[nuxt-i18n-next] Page name is missing for the file: ${page.file}`);
149
152
  }
@@ -162,6 +165,8 @@ class PageManager {
162
165
  const page = pages[i];
163
166
  const pagePath = page.path ?? "";
164
167
  const pageName = page.name ?? "";
168
+ if (isInternalPath(pagePath))
169
+ continue;
165
170
  if (this.globalLocaleRoutes[pageName] === false)
166
171
  continue;
167
172
  if (!/^\/:locale/.test(pagePath) && pagePath !== "/") {
@@ -463,7 +468,6 @@ class LocaleManager {
463
468
  }
464
469
  }
465
470
 
466
- const isInternalPath = (p) => /(?:^|\/)__[^/]+/.test(p);
467
471
  function generateI18nTypes() {
468
472
  return `
469
473
  import type {PluginsInjections} from "nuxt-i18n-micro";
@@ -679,6 +683,9 @@ const module = defineNuxtModule({
679
683
  if (!page.path)
680
684
  return;
681
685
  const fullPath = path.posix.normalize(`${parentPath}/${page.path}`);
686
+ if (isInternalPath(fullPath)) {
687
+ return;
688
+ }
682
689
  const localeSegmentMatch = fullPath.match(/:locale\(([^)]+)\)/);
683
690
  if (localeSegmentMatch) {
684
691
  const availableLocales = localeSegmentMatch[1].split("|");
@@ -687,11 +694,15 @@ const module = defineNuxtModule({
687
694
  if (availableLocales.includes(localeCode)) {
688
695
  let localizedPath = fullPath;
689
696
  localizedPath = localizedPath.replace(/:locale\([^)]+\)/, localeCode);
690
- prerenderRoutes.push(localizedPath);
697
+ if (!isInternalPath(localizedPath)) {
698
+ prerenderRoutes.push(localizedPath);
699
+ }
691
700
  }
692
701
  });
693
702
  } else {
694
- prerenderRoutes.push(fullPath);
703
+ if (!isInternalPath(fullPath)) {
704
+ prerenderRoutes.push(fullPath);
705
+ }
695
706
  }
696
707
  if (page.children && page.children.length) {
697
708
  page.children.forEach((childPage) => processPageWithChildren(childPage, fullPath));
@@ -801,6 +812,13 @@ const module = defineNuxtModule({
801
812
  return;
802
813
  }
803
814
  const routesSet = prerenderRoutes.routes;
815
+ const routesToRemove = [];
816
+ routesSet.forEach((route) => {
817
+ if (isInternalPath(route)) {
818
+ routesToRemove.push(route);
819
+ }
820
+ });
821
+ routesToRemove.forEach((route) => routesSet.delete(route));
804
822
  const additionalRoutes = /* @__PURE__ */ new Set();
805
823
  routesSet.forEach((route) => {
806
824
  if (!/\.[a-z0-9]+$/i.test(route) && !isInternalPath(route)) {
package/dist/utils.d.mts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { NuxtPage } from '@nuxt/schema';
2
2
  import { LocaleCode, Locale } from 'nuxt-i18n-micro-types';
3
3
 
4
+ declare const isInternalPath: (p: string) => boolean;
4
5
  declare function extractLocaleRoutes(content: string, filePath: string): Record<string, string> | null;
5
6
  declare function validateDefineI18nRouteConfig(obj: Record<LocaleCode, Record<string, string>>): boolean;
6
7
  declare const normalizePath: (routePath: string) => string;
@@ -13,4 +14,4 @@ declare const isLocaleDefault: (locale: string | Locale, defaultLocale: Locale,
13
14
  declare const buildFullPath: (locale: string | string[], basePath: string, customRegex?: string | RegExp) => string;
14
15
  declare const buildFullPathNoPrefix: (basePath: string) => string;
15
16
 
16
- export { buildFullPath, buildFullPathNoPrefix, buildRouteName, cloneArray, extractLocaleRoutes, isLocaleDefault, isPageRedirectOnly, normalizePath, removeLeadingSlash, shouldAddLocalePrefix, validateDefineI18nRouteConfig };
17
+ export { buildFullPath, buildFullPathNoPrefix, buildRouteName, cloneArray, extractLocaleRoutes, isInternalPath, isLocaleDefault, isPageRedirectOnly, normalizePath, removeLeadingSlash, shouldAddLocalePrefix, validateDefineI18nRouteConfig };
package/dist/utils.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { NuxtPage } from '@nuxt/schema';
2
2
  import { LocaleCode, Locale } from 'nuxt-i18n-micro-types';
3
3
 
4
+ declare const isInternalPath: (p: string) => boolean;
4
5
  declare function extractLocaleRoutes(content: string, filePath: string): Record<string, string> | null;
5
6
  declare function validateDefineI18nRouteConfig(obj: Record<LocaleCode, Record<string, string>>): boolean;
6
7
  declare const normalizePath: (routePath: string) => string;
@@ -13,4 +14,4 @@ declare const isLocaleDefault: (locale: string | Locale, defaultLocale: Locale,
13
14
  declare const buildFullPath: (locale: string | string[], basePath: string, customRegex?: string | RegExp) => string;
14
15
  declare const buildFullPathNoPrefix: (basePath: string) => string;
15
16
 
16
- export { buildFullPath, buildFullPathNoPrefix, buildRouteName, cloneArray, extractLocaleRoutes, isLocaleDefault, isPageRedirectOnly, normalizePath, removeLeadingSlash, shouldAddLocalePrefix, validateDefineI18nRouteConfig };
17
+ export { buildFullPath, buildFullPathNoPrefix, buildRouteName, cloneArray, extractLocaleRoutes, isInternalPath, isLocaleDefault, isPageRedirectOnly, normalizePath, removeLeadingSlash, shouldAddLocalePrefix, validateDefineI18nRouteConfig };
package/dist/utils.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import path from 'node:path';
2
2
 
3
+ const isInternalPath = (p) => /(?:^|\/)__[^/]+/.test(p);
3
4
  function extractLocaleRoutes(content, filePath) {
4
5
  const defineMatch = content.match(/\$?\bdefineI18nRoute\s*\(\s*\{[\s\S]*?\}\s*\)/);
5
6
  if (defineMatch) {
@@ -60,4 +61,4 @@ const normalizeRegex = (toNorm) => {
60
61
  return toNorm.startsWith("/") && toNorm.endsWith("/") ? toNorm?.slice(1, -1) : toNorm;
61
62
  };
62
63
 
63
- export { buildFullPath, buildFullPathNoPrefix, buildRouteName, cloneArray, extractLocaleRoutes, isLocaleDefault, isPageRedirectOnly, normalizePath, removeLeadingSlash, shouldAddLocalePrefix, validateDefineI18nRouteConfig };
64
+ export { buildFullPath, buildFullPathNoPrefix, buildRouteName, cloneArray, extractLocaleRoutes, isInternalPath, 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.89.0",
3
+ "version": "1.90.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",
@@ -60,8 +60,8 @@
60
60
  "sirv": "^2.0.4",
61
61
  "ufo": "^1.5.4",
62
62
  "nuxt-i18n-micro-core": "1.0.18",
63
- "nuxt-i18n-micro-test-utils": "1.0.6",
64
- "nuxt-i18n-micro-types": "1.0.6"
63
+ "nuxt-i18n-micro-types": "1.0.6",
64
+ "nuxt-i18n-micro-test-utils": "1.0.6"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@nuxt/devtools": "^2.6.2",
@@ -1 +0,0 @@
1
- {"id":"f9f50f20-eeba-4e27-be51-939811ea107e","timestamp":1754719491099,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}