nuxt-i18n-micro 1.88.2 → 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},1754684606618,false]</script>
12
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"8f49ff6f-21b5-4fe7-be6f-c52acfc810cd",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},1754684606618,false]</script>
12
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"8f49ff6f-21b5-4fe7-be6f-c52acfc810cd",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":"8f49ff6f-21b5-4fe7-be6f-c52acfc810cd","timestamp":1754684601103}
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},1754684606618,false]</script>
12
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"8f49ff6f-21b5-4fe7-be6f-c52acfc810cd",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.88.2",
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 !== "/") {
@@ -678,6 +683,9 @@ const module = defineNuxtModule({
678
683
  if (!page.path)
679
684
  return;
680
685
  const fullPath = path.posix.normalize(`${parentPath}/${page.path}`);
686
+ if (isInternalPath(fullPath)) {
687
+ return;
688
+ }
681
689
  const localeSegmentMatch = fullPath.match(/:locale\(([^)]+)\)/);
682
690
  if (localeSegmentMatch) {
683
691
  const availableLocales = localeSegmentMatch[1].split("|");
@@ -686,11 +694,15 @@ const module = defineNuxtModule({
686
694
  if (availableLocales.includes(localeCode)) {
687
695
  let localizedPath = fullPath;
688
696
  localizedPath = localizedPath.replace(/:locale\([^)]+\)/, localeCode);
689
- prerenderRoutes.push(localizedPath);
697
+ if (!isInternalPath(localizedPath)) {
698
+ prerenderRoutes.push(localizedPath);
699
+ }
690
700
  }
691
701
  });
692
702
  } else {
693
- prerenderRoutes.push(fullPath);
703
+ if (!isInternalPath(fullPath)) {
704
+ prerenderRoutes.push(fullPath);
705
+ }
694
706
  }
695
707
  if (page.children && page.children.length) {
696
708
  page.children.forEach((childPage) => processPageWithChildren(childPage, fullPath));
@@ -755,7 +767,7 @@ const module = defineNuxtModule({
755
767
  const shouldGenerate = locale.code !== defaultLocale || withPrefixStrategy(options.strategy);
756
768
  if (shouldGenerate) {
757
769
  pages.forEach((page) => {
758
- if (!/\.[a-z0-9]+$/i.test(page)) {
770
+ if (!/\.[a-z0-9]+$/i.test(page) && !isInternalPath(page)) {
759
771
  routes.push(`/${locale.code}${page}`);
760
772
  }
761
773
  });
@@ -800,9 +812,16 @@ const module = defineNuxtModule({
800
812
  return;
801
813
  }
802
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));
803
822
  const additionalRoutes = /* @__PURE__ */ new Set();
804
823
  routesSet.forEach((route) => {
805
- if (!/\.[a-z0-9]+$/i.test(route)) {
824
+ if (!/\.[a-z0-9]+$/i.test(route) && !isInternalPath(route)) {
806
825
  localeManager.locales.forEach((locale) => {
807
826
  const shouldGenerate = locale.code !== defaultLocale || withPrefixStrategy(options.strategy);
808
827
  if (shouldGenerate) {
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.88.2",
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",
@@ -1 +0,0 @@
1
- {"id":"8f49ff6f-21b5-4fe7-be6f-c52acfc810cd","timestamp":1754684601103,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}