nuxt-i18n-micro 1.78.0 → 1.80.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.
package/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  [![npm version](https://img.shields.io/npm/v/nuxt-i18n-micro/latest?style=for-the-badge)](https://www.npmjs.com/package/nuxt-i18n-micro)
2
2
  [![npm downloads](https://img.shields.io/npm/dw/nuxt-i18n-micro?style=for-the-badge)](https://www.npmjs.com/package/nuxt-i18n-micro)
3
3
  [![License](https://img.shields.io/npm/l/nuxt-i18n-micro?style=for-the-badge)](https://www.npmjs.com/package/nuxt-i18n-micro)
4
- [![Nuxt](https://img.shields.io/badge/Nuxt-020420?logo=nuxt.js&style=for-the-badge)](https://nuxt.com)
5
- [![Donate](https://img.shields.io/badge/Donate-ff4081?style=for-the-badge)](https://www.donationalerts.com/r/s00d88)
4
+ [![Donate](https://img.shields.io/badge/Donate-Donationalerts-ff4081?style=for-the-badge)](https://www.donationalerts.com/r/s00d88)
6
5
 
7
6
  <p align="center">
8
7
  <img src="https://github.com/s00d/nuxt-i18n-micro/blob/main/logo.png?raw=true" alt="logo">
@@ -8,5 +8,5 @@
8
8
  <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BBbCCCx2.js">
9
9
  <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.BRj5A2lo.css">
10
10
  <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/CfVvufsh.js">
11
- <script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/MjlAM4Ld.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},1741805954061,false]</script>
12
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"d269d831-d8f8-4ce1-bd15-d7a192ce3723",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
11
+ <script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/MjlAM4Ld.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},1742564872582,false]</script>
12
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"3511f6ca-45f6-42c5-baa4-2c7f6b8ecf7b",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
@@ -8,5 +8,5 @@
8
8
  <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BBbCCCx2.js">
9
9
  <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.BRj5A2lo.css">
10
10
  <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/CfVvufsh.js">
11
- <script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/MjlAM4Ld.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},1741805954062,false]</script>
12
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"d269d831-d8f8-4ce1-bd15-d7a192ce3723",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
11
+ <script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/MjlAM4Ld.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},1742564872583,false]</script>
12
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"3511f6ca-45f6-42c5-baa4-2c7f6b8ecf7b",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
@@ -1 +1 @@
1
- {"id":"d269d831-d8f8-4ce1-bd15-d7a192ce3723","timestamp":1741805947958}
1
+ {"id":"3511f6ca-45f6-42c5-baa4-2c7f6b8ecf7b","timestamp":1742564855518}
@@ -0,0 +1 @@
1
+ {"id":"3511f6ca-45f6-42c5-baa4-2c7f6b8ecf7b","timestamp":1742564855518,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
@@ -0,0 +1 @@
1
+ {"id":"dev","timestamp":1742564857380,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
@@ -8,5 +8,5 @@
8
8
  <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BBbCCCx2.js">
9
9
  <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.BRj5A2lo.css">
10
10
  <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/CfVvufsh.js">
11
- <script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/MjlAM4Ld.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},1741805954062,false]</script>
12
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"d269d831-d8f8-4ce1-bd15-d7a192ce3723",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
11
+ <script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/MjlAM4Ld.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},1742564872583,false]</script>
12
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"3511f6ca-45f6-42c5-baa4-2c7f6b8ecf7b",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.78.0",
4
+ "version": "1.80.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.4",
7
7
  "unbuild": "2.0.0"
package/dist/module.mjs CHANGED
@@ -176,16 +176,16 @@ class PageManager {
176
176
  const fileContent = readFileSync(page.file, "utf-8");
177
177
  const localeRoutes = extractLocaleRoutes(fileContent, page.file);
178
178
  if (localeRoutes) {
179
- const normalizedFullPath = normalizePath(path.join(parentPath, page.path));
179
+ const normalizedFullPath = normalizePath(path.posix.join(parentPath, page.path));
180
180
  localizedPaths[normalizedFullPath] = localeRoutes;
181
181
  }
182
182
  }
183
183
  } else if (typeof globalLocalePath === "object") {
184
- const normalizedFullPath = normalizePath(path.join(parentPath, page.path));
184
+ const normalizedFullPath = normalizePath(path.posix.join(parentPath, page.path));
185
185
  localizedPaths[normalizedFullPath] = globalLocalePath;
186
186
  }
187
187
  if (page.children?.length) {
188
- const parentFullPath = normalizePath(path.join(parentPath, page.path));
188
+ const parentFullPath = normalizePath(path.posix.join(parentPath, page.path));
189
189
  Object.assign(localizedPaths, this.extractLocalizedPaths(page.children, parentFullPath));
190
190
  }
191
191
  });
@@ -244,7 +244,7 @@ class PageManager {
244
244
  }
245
245
  const currentChildren = page.children ? [...page.children] : [];
246
246
  if (originalChildren.length) {
247
- const newName = normalizePath(path.join("/", buildRouteNameFromRoute(page.name, page.path)));
247
+ const newName = normalizePath(path.posix.join("/", buildRouteNameFromRoute(page.name, page.path)));
248
248
  const localizedChildren = this.mergeChildren(originalChildren, newName, [this.defaultLocale.code]);
249
249
  const childrenMap = new Map(currentChildren.map((child) => [child.name, child]));
250
250
  localizedChildren.forEach((localizedChild) => {
@@ -291,7 +291,7 @@ class PageManager {
291
291
  }
292
292
  createLocalizedVariants(route, parentPath, localeCodes, modifyName, addLocalePrefix) {
293
293
  const routePath = normalizePath(route.path);
294
- const fullPath = normalizePath(path.join(parentPath, routePath));
294
+ const fullPath = normalizePath(path.posix.join(parentPath, routePath));
295
295
  const customLocalePaths = this.localizedPaths[fullPath];
296
296
  const localizedChildren = this.createLocalizedChildren(route.children ?? [], fullPath, localeCodes, modifyName);
297
297
  return localeCodes.map((locale) => this.createLocalizedChildRoute(route, routePath, locale, customLocalePaths, localizedChildren, modifyName, addLocalePrefix));
@@ -491,6 +491,8 @@ const module = defineNuxtModule({
491
491
  rootDir: nuxt.options.rootDir,
492
492
  rootDirs,
493
493
  debug: options.debug ?? false,
494
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
495
+ // @ts-ignore
494
496
  fallbackLocale: options.fallbackLocale ?? void 0,
495
497
  translationDir: options.translationDir ?? "locales",
496
498
  customRegexMatcher: options.customRegexMatcher
@@ -24,6 +24,7 @@ export default defineEventHandler(async (event) => {
24
24
  if (customRegexMatcher && locales && !locales.map((l) => l.code).includes(locale)) {
25
25
  throw createError({ statusCode: 404 });
26
26
  }
27
+ const currentLocaleConfig = locales?.find((l) => l.code === locale) ?? null;
27
28
  const getTranslationPath = (locale2, page2) => page2 === "general" ? `${locale2}.json` : `pages/${page2}/${locale2}.json`;
28
29
  let translations = {};
29
30
  const serverStorage = useStorage("assets:server");
@@ -44,6 +45,7 @@ export default defineEventHandler(async (event) => {
44
45
  }));
45
46
  const paths = [
46
47
  ...fallbackLocale && fallbackLocale !== locale ? createPaths(fallbackLocale) : [],
48
+ ...currentLocaleConfig && currentLocaleConfig.fallbackLocale ? createPaths(currentLocaleConfig.fallbackLocale) : [],
47
49
  ...createPaths(locale)
48
50
  ];
49
51
  for (const { translationPath, name } of paths) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-i18n-micro",
3
- "version": "1.78.0",
3
+ "version": "1.80.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",
@@ -59,9 +59,9 @@
59
59
  "globby": "^14.1.0",
60
60
  "sirv": "^2.0.4",
61
61
  "ufo": "^1.5.4",
62
- "nuxt-i18n-micro-core": "1.0.17",
63
62
  "nuxt-i18n-micro-test-utils": "1.0.6",
64
- "nuxt-i18n-micro-types": "1.0.2"
63
+ "nuxt-i18n-micro-core": "1.0.17",
64
+ "nuxt-i18n-micro-types": "1.0.3"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@nuxt/devtools": "^2.1.0",
@@ -1 +0,0 @@
1
- {"id":"d269d831-d8f8-4ce1-bd15-d7a192ce3723","timestamp":1741805947958,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}