nuxt-typed-router 3.2.3 → 3.2.4
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/module.json +1 -1
- package/dist/module.mjs +13 -11
- package/package.json +16 -16
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -240,9 +240,9 @@ function createValidatePathTypes(pathElements, withLocale = false) {
|
|
|
240
240
|
function createTypeValidatePathCondition(elements) {
|
|
241
241
|
const typeName = `Validate${nanoid(7)}`;
|
|
242
242
|
const params = /* @__PURE__ */ new Map();
|
|
243
|
-
const routeName = elements.flat()[0]
|
|
243
|
+
const routeName = elements.flat()[0]?.routeName ?? "index";
|
|
244
244
|
elements.flat().every((elem) => elem.type === "name");
|
|
245
|
-
const isLocale = elements.flat()[0]
|
|
245
|
+
const isLocale = elements.flat()[0]?.isLocale ?? false;
|
|
246
246
|
const condition = `type ${typeName}<T> = T extends \`/${elements.map((elementArray, index) => {
|
|
247
247
|
return elementArray.map((elem) => {
|
|
248
248
|
const isLast = index === elements.flat().length - 1;
|
|
@@ -885,7 +885,7 @@ function createi18nRouterFile() {
|
|
|
885
885
|
);
|
|
886
886
|
}
|
|
887
887
|
|
|
888
|
-
const routeParamExtractRegxp = /(:(\w+)(\(
|
|
888
|
+
const routeParamExtractRegxp = /(:(\w+)(\(\.[^(]\)[*+]?)?(\?)?)+/g;
|
|
889
889
|
function extractParamsFromPathDecl(path) {
|
|
890
890
|
let params = [];
|
|
891
891
|
let matches;
|
|
@@ -1029,7 +1029,7 @@ function createPathsFiles({ routesPaths }) {
|
|
|
1029
1029
|
});
|
|
1030
1030
|
const pathElements = filteredRoutesPaths.filter((f) => f.path && f.path !== "/").map((route) => {
|
|
1031
1031
|
return route.path.split("/").filter((f) => f.length).map((m) => destructurePath(m, route));
|
|
1032
|
-
});
|
|
1032
|
+
}).filter((f) => f.length);
|
|
1033
1033
|
const validatePathTypes = createValidatePathTypes(pathElements);
|
|
1034
1034
|
const validateLocalePathTypes = createValidatePathTypes(pathElements, true);
|
|
1035
1035
|
return (
|
|
@@ -1432,7 +1432,7 @@ function createKeyedName(route, parent) {
|
|
|
1432
1432
|
if (parent) {
|
|
1433
1433
|
return camelCase(parentPath || "index");
|
|
1434
1434
|
} else {
|
|
1435
|
-
return camelCase(route.path.split("/").join("-") || "index"
|
|
1435
|
+
return camelCase(route.path.split("/").join("-")) || "index";
|
|
1436
1436
|
}
|
|
1437
1437
|
}
|
|
1438
1438
|
function createNameKeyFromFullName(route, level, parentName) {
|
|
@@ -1457,12 +1457,14 @@ function walkThoughRoutes({
|
|
|
1457
1457
|
}) {
|
|
1458
1458
|
const route = modifyRoutePrefixDefaultIfI18n(_route);
|
|
1459
1459
|
const isLocaleRoute = isLocale || is18Sibling(output.routesPaths, route);
|
|
1460
|
-
const newPath = `${parent?.path ?? ""}${route.path.startsWith("/") ? route.path : `/${route.path}`}`;
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1460
|
+
const newPath = `${parent?.path ?? ""}${route.path.startsWith("/") || parent?.path === "/" ? route.path : `/${route.path}`}`;
|
|
1461
|
+
if (parent?.path !== "/") {
|
|
1462
|
+
output.routesPaths.push({
|
|
1463
|
+
name: route.name,
|
|
1464
|
+
path: newPath,
|
|
1465
|
+
isLocale: isLocaleRoute
|
|
1466
|
+
});
|
|
1467
|
+
}
|
|
1466
1468
|
if (route.children?.length) {
|
|
1467
1469
|
let childrenChunks = route.children;
|
|
1468
1470
|
let nameKey = createKeyedName(route, parent);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-typed-router",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.4",
|
|
4
4
|
"description": "Provide autocompletion for routes paths, names and params in Nuxt apps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/module.cjs",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"url": "https://github.com/victorgarciaesgi/nuxt-typed-router/issues"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@nuxt/kit": "^3.
|
|
64
|
-
"chalk": "^5.
|
|
63
|
+
"@nuxt/kit": "^3.6.1",
|
|
64
|
+
"chalk": "^5.3.0",
|
|
65
65
|
"defu": "^6.1.2",
|
|
66
66
|
"lodash-es": "^4.17.21",
|
|
67
67
|
"log-symbols": "^5.1.0",
|
|
@@ -73,31 +73,31 @@
|
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@nuxt/devtools": "^0.5.5",
|
|
75
75
|
"@nuxt/module-builder": "^0.3.1",
|
|
76
|
-
"@nuxt/test-utils": "^3.
|
|
77
|
-
"@nuxt/types": "^2.
|
|
76
|
+
"@nuxt/test-utils": "^3.6.1",
|
|
77
|
+
"@nuxt/types": "^2.17.0",
|
|
78
78
|
"@nuxtjs/eslint-config-typescript": "^12.0.0",
|
|
79
79
|
"@nuxtjs/i18n": "8.0.0-beta.10",
|
|
80
80
|
"@nuxtjs/web-vitals": "^0.2.6",
|
|
81
81
|
"@types/lodash-es": "^4.17.7",
|
|
82
|
-
"@types/node": "^20.
|
|
83
|
-
"@types/prettier": "^2.7.
|
|
84
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
85
|
-
"@typescript-eslint/parser": "^5.
|
|
86
|
-
"@vue/test-utils": "^2.
|
|
82
|
+
"@types/node": "^20.3.3",
|
|
83
|
+
"@types/prettier": "^2.7.3",
|
|
84
|
+
"@typescript-eslint/eslint-plugin": "^5.61.0",
|
|
85
|
+
"@typescript-eslint/parser": "^5.61.0",
|
|
86
|
+
"@vue/test-utils": "^2.4.0",
|
|
87
87
|
"bumpp": "9.1.0",
|
|
88
88
|
"changelogithub": "0.12.11",
|
|
89
89
|
"cross-env": "^7.0.3",
|
|
90
90
|
"eslint": "8.41.0",
|
|
91
91
|
"eslint-config-prettier": "^8.8.0",
|
|
92
|
-
"eslint-plugin-vue": "^9.
|
|
92
|
+
"eslint-plugin-vue": "^9.15.1",
|
|
93
93
|
"nuxt": "3.5.1",
|
|
94
94
|
"nuxt-seo-kit": "1.3.8",
|
|
95
95
|
"playwright": "1.34.3",
|
|
96
96
|
"tsd": "^0.28.1",
|
|
97
|
-
"typescript": "^5.
|
|
98
|
-
"vitest": "^0.31.
|
|
99
|
-
"vue-eslint-parser": "^9.3.
|
|
100
|
-
"vue-router": "^4.2.
|
|
101
|
-
"vue-tsc": "^1.
|
|
97
|
+
"typescript": "^5.1.6",
|
|
98
|
+
"vitest": "^0.31.4",
|
|
99
|
+
"vue-eslint-parser": "^9.3.1",
|
|
100
|
+
"vue-router": "^4.2.2",
|
|
101
|
+
"vue-tsc": "^1.8.4"
|
|
102
102
|
}
|
|
103
103
|
}
|