nuxt-i18n-micro 1.83.4 → 1.84.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/dist/client/200.html +2 -2
- package/dist/client/404.html +2 -2
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/b44e2c27-d406-446e-8b5c-449b8e228196.json +1 -0
- package/dist/client/index.html +2 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +78 -19
- package/package.json +3 -3
- package/dist/client/_nuxt/builds/meta/8d9dd6d0-32a5-43e2-9386-f7e061431fb2.json +0 -1
package/dist/client/200.html
CHANGED
|
@@ -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},
|
|
12
|
-
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"
|
|
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},1745573186060,false]</script>
|
|
12
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"b44e2c27-d406-446e-8b5c-449b8e228196",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
package/dist/client/404.html
CHANGED
|
@@ -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},
|
|
12
|
-
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"
|
|
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},1745573186060,false]</script>
|
|
12
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"b44e2c27-d406-446e-8b5c-449b8e228196",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"
|
|
1
|
+
{"id":"b44e2c27-d406-446e-8b5c-449b8e228196","timestamp":1745573180739}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"id":"b44e2c27-d406-446e-8b5c-449b8e228196","timestamp":1745573180739,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|
package/dist/client/index.html
CHANGED
|
@@ -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},
|
|
12
|
-
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"
|
|
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},1745573186060,false]</script>
|
|
12
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"b44e2c27-d406-446e-8b5c-449b8e228196",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
package/dist/module.json
CHANGED
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, isPageRedirectOnly, cloneArray,
|
|
10
|
+
import { extractLocaleRoutes, normalizePath, isLocaleDefault, isPageRedirectOnly, cloneArray, removeLeadingSlash, buildRouteName, shouldAddLocalePrefix, buildFullPath, buildFullPathNoPrefix } from './utils.mjs';
|
|
11
11
|
|
|
12
12
|
const DEVTOOLS_UI_PORT = 3030;
|
|
13
13
|
const DEVTOOLS_UI_ROUTE = "/__nuxt-i18n-micro";
|
|
@@ -287,15 +287,77 @@ class PageManager {
|
|
|
287
287
|
}
|
|
288
288
|
});
|
|
289
289
|
}
|
|
290
|
-
createLocalizedChildren(routes, parentPath, localeCodes, modifyName = true, addLocalePrefix = false) {
|
|
291
|
-
return routes.flatMap(
|
|
290
|
+
createLocalizedChildren(routes, parentPath, localeCodes, modifyName = true, addLocalePrefix = false, parentIsLocalized = false, localizedParentPaths = {}) {
|
|
291
|
+
return routes.flatMap(
|
|
292
|
+
(route) => this.createLocalizedVariants(
|
|
293
|
+
route,
|
|
294
|
+
parentPath,
|
|
295
|
+
localeCodes,
|
|
296
|
+
modifyName,
|
|
297
|
+
addLocalePrefix,
|
|
298
|
+
parentIsLocalized,
|
|
299
|
+
localizedParentPaths
|
|
300
|
+
)
|
|
301
|
+
);
|
|
292
302
|
}
|
|
293
|
-
createLocalizedVariants(route, parentPath, localeCodes, modifyName, addLocalePrefix) {
|
|
303
|
+
createLocalizedVariants(route, parentPath, localeCodes, modifyName, addLocalePrefix, parentIsLocalized, localizedParentPaths) {
|
|
294
304
|
const routePath = normalizePath(route.path);
|
|
305
|
+
const isDynamic = routePath.startsWith(":");
|
|
295
306
|
const fullPath = normalizePath(path.posix.join(parentPath, routePath));
|
|
296
307
|
const customLocalePaths = this.localizedPaths[fullPath];
|
|
297
|
-
|
|
298
|
-
|
|
308
|
+
if (isDynamic && !customLocalePaths) {
|
|
309
|
+
const localizedChildren = this.createLocalizedChildren(
|
|
310
|
+
route.children ?? [],
|
|
311
|
+
fullPath,
|
|
312
|
+
localeCodes,
|
|
313
|
+
modifyName,
|
|
314
|
+
addLocalePrefix,
|
|
315
|
+
true,
|
|
316
|
+
localizedParentPaths
|
|
317
|
+
);
|
|
318
|
+
const baseName = buildRouteNameFromRoute(route.name, route.path);
|
|
319
|
+
return [
|
|
320
|
+
{
|
|
321
|
+
...route,
|
|
322
|
+
name: modifyName ? `localized-${baseName}` : baseName,
|
|
323
|
+
path: removeLeadingSlash(routePath),
|
|
324
|
+
children: localizedChildren
|
|
325
|
+
}
|
|
326
|
+
];
|
|
327
|
+
}
|
|
328
|
+
const result = [];
|
|
329
|
+
for (const locale of localeCodes) {
|
|
330
|
+
const parentPathLocalized = localizedParentPaths[locale] || parentPath;
|
|
331
|
+
const fullPath2 = normalizePath(path.posix.join(parentPathLocalized, routePath));
|
|
332
|
+
const localizedChildren = this.createLocalizedChildren(
|
|
333
|
+
route.children ?? [],
|
|
334
|
+
fullPath2,
|
|
335
|
+
[locale],
|
|
336
|
+
modifyName,
|
|
337
|
+
addLocalePrefix,
|
|
338
|
+
true,
|
|
339
|
+
localizedParentPaths
|
|
340
|
+
);
|
|
341
|
+
const routeName = this.buildLocalizedRouteName(
|
|
342
|
+
buildRouteNameFromRoute(route.name, route.path),
|
|
343
|
+
locale,
|
|
344
|
+
modifyName,
|
|
345
|
+
parentIsLocalized || !!customLocalePaths
|
|
346
|
+
);
|
|
347
|
+
const finalPath = this.buildLocalizedRoutePath(
|
|
348
|
+
routePath,
|
|
349
|
+
locale,
|
|
350
|
+
customLocalePaths,
|
|
351
|
+
addLocalePrefix
|
|
352
|
+
);
|
|
353
|
+
result.push({
|
|
354
|
+
...route,
|
|
355
|
+
name: routeName,
|
|
356
|
+
path: removeLeadingSlash(finalPath),
|
|
357
|
+
children: localizedChildren
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
return result;
|
|
299
361
|
}
|
|
300
362
|
createLocalizedRoute(page, localeCodes, originalChildren, isCustom, customPath = "", customRegex, force = false) {
|
|
301
363
|
const routePath = this.buildRoutePath(localeCodes, page.path, encodeURI(customPath), isCustom, customRegex, force);
|
|
@@ -304,28 +366,25 @@ class PageManager {
|
|
|
304
366
|
const routeName = buildRouteName(buildRouteNameFromRoute(page.name, page.path), localeCodes[0], isCustom);
|
|
305
367
|
return {
|
|
306
368
|
...page,
|
|
307
|
-
children: this.createLocalizedChildren(originalChildren, page.path, localeCodes, true),
|
|
369
|
+
children: this.createLocalizedChildren(originalChildren, page.path, localeCodes, true, false, true),
|
|
308
370
|
path: routePath,
|
|
309
371
|
name: routeName
|
|
310
372
|
};
|
|
311
373
|
}
|
|
312
|
-
createLocalizedChildRoute(route, routePath, locale, customLocalePaths, children, modifyName, addLocalePrefix) {
|
|
313
|
-
const finalPath = this.buildLocalizedRoutePath(routePath, locale, customLocalePaths, addLocalePrefix);
|
|
314
|
-
const routeName = this.buildLocalizedRouteName(buildRouteNameFromRoute(route.name, route.path), locale, modifyName);
|
|
315
|
-
return {
|
|
316
|
-
...route,
|
|
317
|
-
name: routeName,
|
|
318
|
-
path: removeLeadingSlash(finalPath),
|
|
319
|
-
children
|
|
320
|
-
};
|
|
321
|
-
}
|
|
322
374
|
buildLocalizedRoutePath(routePath, locale, customLocalePaths, addLocalePrefix) {
|
|
323
375
|
const basePath = customLocalePaths?.[locale] || routePath;
|
|
324
376
|
const normalizedBasePath = encodeURI(normalizePath(basePath));
|
|
325
377
|
return shouldAddLocalePrefix(locale, this.defaultLocale, addLocalePrefix, isPrefixStrategy(this.strategy)) ? buildFullPath(locale, normalizedBasePath) : normalizedBasePath;
|
|
326
378
|
}
|
|
327
|
-
buildLocalizedRouteName(baseName, locale, modifyName) {
|
|
328
|
-
|
|
379
|
+
buildLocalizedRouteName(baseName, locale, modifyName, forceLocaleSuffix = false) {
|
|
380
|
+
if (!modifyName) {
|
|
381
|
+
return baseName;
|
|
382
|
+
}
|
|
383
|
+
if (forceLocaleSuffix) {
|
|
384
|
+
return `localized-${baseName}-${locale}`;
|
|
385
|
+
}
|
|
386
|
+
const shouldAddLocaleSuffix = locale && !isLocaleDefault(locale, this.defaultLocale, isPrefixStrategy(this.strategy) || isPrefixAndDefaultStrategy(this.strategy));
|
|
387
|
+
return shouldAddLocaleSuffix ? `localized-${baseName}-${locale}` : `localized-${baseName}`;
|
|
329
388
|
}
|
|
330
389
|
buildRoutePath(localeCodes, originalPath, customPath, isCustom, customRegex, force = false) {
|
|
331
390
|
if (isNoPrefixStrategy(this.strategy)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-i18n-micro",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.84.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-
|
|
62
|
+
"nuxt-i18n-micro-core": "1.0.18",
|
|
63
63
|
"nuxt-i18n-micro-types": "1.0.4",
|
|
64
|
-
"nuxt-i18n-micro-
|
|
64
|
+
"nuxt-i18n-micro-test-utils": "1.0.6"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@nuxt/devtools": "^2.1.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"id":"8d9dd6d0-32a5-43e2-9386-f7e061431fb2","timestamp":1745439527347,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|