nuxt-typed-router 3.2.0-beta.0 → 3.2.1-beta.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 +2 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +13 -21
- package/package.json +16 -16
package/README.md
CHANGED
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
<img src='https://img.shields.io/npm/l/nuxt-typed-router.svg'>
|
|
18
18
|
|
|
19
19
|
-----------
|
|
20
|
-
> ⚠️ Nuxt 3.4 introduced a breaking change in its router output
|
|
21
|
-
> Install `v3.1.4` of nuxt-typed-router if you're using this Nuxt version
|
|
20
|
+
> ⚠️ Nuxt 3.4 introduced a breaking change in its router output.
|
|
21
|
+
> Install a version superior > `v3.1.4` of nuxt-typed-router if you're using this Nuxt version
|
|
22
22
|
-----------
|
|
23
23
|
|
|
24
24
|
## Provide a type safe router to Nuxt with auto-generated typed definitions for route path, name and params
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1399,24 +1399,8 @@ const specialCharacterRegxp = /([^a-zA-Z0-9_])/gm;
|
|
|
1399
1399
|
function is18Sibling(source, route) {
|
|
1400
1400
|
const { i18n, i18nOptions, i18nLocales } = moduleOptionStore;
|
|
1401
1401
|
if (i18n && i18nOptions && i18nOptions?.strategy !== "no_prefix") {
|
|
1402
|
-
const separator = i18nOptions?.routesNameSeparator ?? "___";
|
|
1403
1402
|
const i18LocalesRecognizer = i18nLocales?.map((m) => m.replace(specialCharacterRegxp, "\\$&")).join("|");
|
|
1404
|
-
return
|
|
1405
|
-
return route.name?.match(
|
|
1406
|
-
new RegExp(
|
|
1407
|
-
`^(${rt.name?.replace(
|
|
1408
|
-
specialCharacterRegxp,
|
|
1409
|
-
"\\$&"
|
|
1410
|
-
)})${separator}(${i18LocalesRecognizer})`,
|
|
1411
|
-
"g"
|
|
1412
|
-
)
|
|
1413
|
-
) || route.path?.match(
|
|
1414
|
-
new RegExp(
|
|
1415
|
-
`/?(${i18LocalesRecognizer})${rt.path.replace(specialCharacterRegxp, "\\$&")}${rt.path === "/" ? "?" : ""}`,
|
|
1416
|
-
"g"
|
|
1417
|
-
)
|
|
1418
|
-
);
|
|
1419
|
-
});
|
|
1403
|
+
return !!route.path?.match(new RegExp(`/?(${i18LocalesRecognizer})(/.+)?`, "g"));
|
|
1420
1404
|
}
|
|
1421
1405
|
return false;
|
|
1422
1406
|
}
|
|
@@ -1434,6 +1418,10 @@ function modifyRoutePrefixDefaultIfI18n(route) {
|
|
|
1434
1418
|
if (match) {
|
|
1435
1419
|
const [_, routeName] = match;
|
|
1436
1420
|
route.name = routeName;
|
|
1421
|
+
return {
|
|
1422
|
+
...route,
|
|
1423
|
+
name: routeName
|
|
1424
|
+
};
|
|
1437
1425
|
}
|
|
1438
1426
|
} else if (i18nOptions?.strategy === "prefix_except_default") {
|
|
1439
1427
|
let defaultLocale = i18nLocales.find((f) => f === i18nOptions.defaultLocale) ? i18nOptions.defaultLocale?.replace(specialCharacterRegxp, "\\$&") : "";
|
|
@@ -1441,10 +1429,14 @@ function modifyRoutePrefixDefaultIfI18n(route) {
|
|
|
1441
1429
|
const match = routeDefaultNameRegXp.exec(route.name);
|
|
1442
1430
|
if (match) {
|
|
1443
1431
|
const [_, routeName] = match;
|
|
1444
|
-
|
|
1432
|
+
return {
|
|
1433
|
+
...route,
|
|
1434
|
+
name: routeName
|
|
1435
|
+
};
|
|
1445
1436
|
}
|
|
1446
1437
|
}
|
|
1447
1438
|
}
|
|
1439
|
+
return route;
|
|
1448
1440
|
}
|
|
1449
1441
|
|
|
1450
1442
|
function createKeyedName(route, parent) {
|
|
@@ -1467,7 +1459,7 @@ function createNameKeyFromFullName(route, level, parentName) {
|
|
|
1467
1459
|
return keyName;
|
|
1468
1460
|
}
|
|
1469
1461
|
function walkThoughRoutes({
|
|
1470
|
-
route,
|
|
1462
|
+
route: _route,
|
|
1471
1463
|
level,
|
|
1472
1464
|
siblings,
|
|
1473
1465
|
parent,
|
|
@@ -1476,9 +1468,9 @@ function walkThoughRoutes({
|
|
|
1476
1468
|
isLast,
|
|
1477
1469
|
isLocale
|
|
1478
1470
|
}) {
|
|
1479
|
-
modifyRoutePrefixDefaultIfI18n(
|
|
1480
|
-
const newPath = `${parent?.path ?? ""}${route.path.startsWith("/") ? route.path : `/${route.path}`}`;
|
|
1471
|
+
const route = modifyRoutePrefixDefaultIfI18n(_route);
|
|
1481
1472
|
const isLocaleRoute = isLocale || is18Sibling(output.routesPaths, route);
|
|
1473
|
+
const newPath = `${parent?.path ?? ""}${route.path.startsWith("/") ? route.path : `/${route.path}`}`;
|
|
1482
1474
|
output.routesPaths.push({
|
|
1483
1475
|
name: route.name,
|
|
1484
1476
|
path: newPath,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-typed-router",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.1-beta.0",
|
|
4
4
|
"description": "Provide autocompletion for routes paths, names and params in Nuxt apps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/module.cjs",
|
|
@@ -59,44 +59,44 @@
|
|
|
59
59
|
"url": "https://github.com/victorgarciaesgi/nuxt-typed-router/issues"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@nuxt/kit": "^3.4.
|
|
62
|
+
"@nuxt/kit": "^3.4.2",
|
|
63
63
|
"chalk": "^5.2.0",
|
|
64
64
|
"defu": "^6.1.2",
|
|
65
65
|
"lodash-es": "^4.17.21",
|
|
66
66
|
"log-symbols": "^5.1.0",
|
|
67
|
-
"mkdirp": "^3.0.
|
|
67
|
+
"mkdirp": "^3.0.1",
|
|
68
68
|
"nanoid": "^4.0.2",
|
|
69
69
|
"pathe": "1.1.0",
|
|
70
|
-
"prettier": "2.8.
|
|
70
|
+
"prettier": "2.8.8"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@nuxt/devtools": "^0.4.
|
|
73
|
+
"@nuxt/devtools": "^0.4.2",
|
|
74
74
|
"@nuxt/module-builder": "^0.3.0",
|
|
75
|
-
"@nuxt/test-utils": "^3.4.
|
|
75
|
+
"@nuxt/test-utils": "^3.4.2",
|
|
76
76
|
"@nuxt/types": "^2.16.3",
|
|
77
77
|
"@nuxtjs/eslint-config-typescript": "^12.0.0",
|
|
78
78
|
"@nuxtjs/i18n": "8.0.0-beta.10",
|
|
79
79
|
"@nuxtjs/web-vitals": "^0.2.4",
|
|
80
80
|
"@types/lodash-es": "^4.17.7",
|
|
81
|
-
"@types/node": "^18.
|
|
81
|
+
"@types/node": "^18.16.1",
|
|
82
82
|
"@types/prettier": "^2.7.2",
|
|
83
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
84
|
-
"@typescript-eslint/parser": "^5.
|
|
83
|
+
"@typescript-eslint/eslint-plugin": "^5.59.1",
|
|
84
|
+
"@typescript-eslint/parser": "^5.59.1",
|
|
85
85
|
"@vue/test-utils": "^2.3.2",
|
|
86
86
|
"bumpp": "9.1.0",
|
|
87
|
-
"changelogithub": "0.12.
|
|
87
|
+
"changelogithub": "0.12.9",
|
|
88
88
|
"cross-env": "^7.0.3",
|
|
89
|
-
"eslint": "8.
|
|
89
|
+
"eslint": "8.39.0",
|
|
90
90
|
"eslint-config-prettier": "^8.8.0",
|
|
91
|
-
"eslint-plugin-vue": "^9.
|
|
92
|
-
"nuxt": "3.4.
|
|
93
|
-
"nuxt-seo-kit": "1.3.
|
|
94
|
-
"playwright": "1.
|
|
91
|
+
"eslint-plugin-vue": "^9.11.0",
|
|
92
|
+
"nuxt": "3.4.2",
|
|
93
|
+
"nuxt-seo-kit": "1.3.7",
|
|
94
|
+
"playwright": "1.33.0",
|
|
95
95
|
"tsd": "^0.28.1",
|
|
96
96
|
"typescript": "^5.0.4",
|
|
97
97
|
"vitest": "^0.30.1",
|
|
98
98
|
"vue-eslint-parser": "^9.1.1",
|
|
99
99
|
"vue-router": "^4.1.6",
|
|
100
|
-
"vue-tsc": "^1.
|
|
100
|
+
"vue-tsc": "^1.6.0"
|
|
101
101
|
}
|
|
102
102
|
}
|