nuxt-i18n-micro 1.50.4 → 1.52.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/BzXxbhIZ.js">
9
9
  <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.DWqKq_Wn.css">
10
10
  <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/B85fdbn4.js">
11
- <script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BhDLGWZB.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},1734690624712,false]</script>
12
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"add7d083-605d-4009-bc43-0a8cd0dc1f28",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
11
+ <script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BhDLGWZB.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},1735030489134,false]</script>
12
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"3086ca3a-1f67-491b-a81d-22fa2fedfc38",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
@@ -8,5 +8,5 @@
8
8
  <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BzXxbhIZ.js">
9
9
  <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.DWqKq_Wn.css">
10
10
  <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/B85fdbn4.js">
11
- <script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BhDLGWZB.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},1734690624713,false]</script>
12
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"add7d083-605d-4009-bc43-0a8cd0dc1f28",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
11
+ <script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BhDLGWZB.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},1735030489134,false]</script>
12
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"3086ca3a-1f67-491b-a81d-22fa2fedfc38",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
@@ -1 +1 @@
1
- {"id":"add7d083-605d-4009-bc43-0a8cd0dc1f28","timestamp":1734690619952}
1
+ {"id":"3086ca3a-1f67-491b-a81d-22fa2fedfc38","timestamp":1735030484548}
@@ -0,0 +1 @@
1
+ {"id":"3086ca3a-1f67-491b-a81d-22fa2fedfc38","timestamp":1735030484548,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
@@ -8,5 +8,5 @@
8
8
  <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BzXxbhIZ.js">
9
9
  <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.DWqKq_Wn.css">
10
10
  <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/B85fdbn4.js">
11
- <script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BhDLGWZB.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},1734690624713,false]</script>
12
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"add7d083-605d-4009-bc43-0a8cd0dc1f28",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
11
+ <script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BhDLGWZB.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},1735030489134,false]</script>
12
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"3086ca3a-1f67-491b-a81d-22fa2fedfc38",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.50.4",
4
+ "version": "1.52.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.4",
7
7
  "unbuild": "2.0.0"
package/dist/module.mjs CHANGED
@@ -481,12 +481,6 @@ const module = defineNuxtModule({
481
481
  if (isCloudflarePages && !isPrefixStrategy(options.strategy)) {
482
482
  throw new Error('Nuxt-i18n-micro: "includeDefaultLocaleRoute" must be set to true when using Cloudflare Pages.');
483
483
  }
484
- try {
485
- const storagePahh = path.join(nuxt.options.rootDir, "./server/assets");
486
- fs__default.rmdirSync(storagePahh);
487
- logger.log(`Cleanup storage: ${storagePahh}`);
488
- } catch {
489
- }
490
484
  const resolver = createResolver(import.meta.url);
491
485
  const rootDirs = nuxt.options._layers.map((layer) => layer.config.rootDir).reverse();
492
486
  const localeManager = new LocaleManager(options, rootDirs);
@@ -646,6 +640,9 @@ const module = defineNuxtModule({
646
640
  imports: ["useTranslationServerMiddleware"]
647
641
  });
648
642
  }
643
+ if (isNoPrefixStrategy(options.strategy)) {
644
+ return;
645
+ }
649
646
  const routes = nitroConfig.prerender?.routes || [];
650
647
  nuxt.options.generate.routes = Array.isArray(nuxt.options.generate.routes) ? nuxt.options.generate.routes : [];
651
648
  const pages = nuxt.options.generate.routes || [];
@@ -691,6 +688,9 @@ const module = defineNuxtModule({
691
688
  }
692
689
  });
693
690
  nuxt.hook("prerender:routes", async (prerenderRoutes) => {
691
+ if (isNoPrefixStrategy(options.strategy)) {
692
+ return;
693
+ }
694
694
  const routesSet = prerenderRoutes.routes;
695
695
  const additionalRoutes = /* @__PURE__ */ new Set();
696
696
  routesSet.forEach((route) => {
@@ -2,6 +2,7 @@ import { resolve } from "node:path";
2
2
  import { readFile } from "node:fs/promises";
3
3
  import { defineEventHandler } from "h3";
4
4
  import { useRuntimeConfig, createError, useStorage } from "#imports";
5
+ let storageInit = false;
5
6
  function deepMerge(target, source) {
6
7
  for (const key of Object.keys(source)) {
7
8
  if (key === "__proto__" || key === "constructor") {
@@ -51,6 +52,14 @@ export default defineEventHandler(async (event) => {
51
52
  });
52
53
  let translations = {};
53
54
  const serverStorage = await useStorage("assets:server");
55
+ if (!storageInit) {
56
+ if (debug) {
57
+ console.log("[nuxt-i18n-micro] clear storage cache");
58
+ }
59
+ const handlerKeys = await serverStorage.getKeys();
60
+ await Promise.all(handlerKeys.map((element) => serverStorage.removeItem(element)));
61
+ storageInit = true;
62
+ }
54
63
  for (const { translationPath, name } of paths) {
55
64
  try {
56
65
  if (debug) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-i18n-micro",
3
- "version": "1.50.4",
3
+ "version": "1.52.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",
@@ -45,8 +45,8 @@
45
45
  "chokidar": "^3.6.0",
46
46
  "sirv": "^2.0.4",
47
47
  "ufo": "^1.5.4",
48
- "nuxt-i18n-micro-core": "1.0.10",
49
- "nuxt-i18n-micro-test-utils": "1.0.3"
48
+ "nuxt-i18n-micro-test-utils": "1.0.3",
49
+ "nuxt-i18n-micro-core": "1.0.10"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/jest": "^29.5.14",
@@ -1 +0,0 @@
1
- {"id":"add7d083-605d-4009-bc43-0a8cd0dc1f28","timestamp":1734690619952,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}