nuxt-typed-router 3.0.3 → 3.0.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 +10 -5
- package/package.json +10 -11
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -235,12 +235,12 @@ function createTypeValidatePathCondition(elements) {
|
|
|
235
235
|
const typeName = `Validate${nanoid(7)}`;
|
|
236
236
|
const params = /* @__PURE__ */ new Map();
|
|
237
237
|
const routeName = elements.flat()[0].routeName;
|
|
238
|
-
|
|
238
|
+
elements.flat().every((elem) => elem.type === "name");
|
|
239
239
|
const isLocale = elements.flat()[0].isLocale;
|
|
240
240
|
const condition = `type ${typeName}<T> = T extends \`/${elements.map((elementArray, index) => {
|
|
241
241
|
return elementArray.map((elem) => {
|
|
242
242
|
const isLast = index === elements.flat().length - 1;
|
|
243
|
-
if (elem.type === "name" && isLast
|
|
243
|
+
if (elem.type === "name" && isLast) {
|
|
244
244
|
const id = nanoid(6);
|
|
245
245
|
params.set(elem.id, id);
|
|
246
246
|
return `${elem.content}\${infer ${id}}`;
|
|
@@ -255,7 +255,7 @@ function createTypeValidatePathCondition(elements) {
|
|
|
255
255
|
}
|
|
256
256
|
}).join("");
|
|
257
257
|
}).join("/")}\`
|
|
258
|
-
? ${
|
|
258
|
+
? ${elements.flat().map((elem, index) => {
|
|
259
259
|
let output = "";
|
|
260
260
|
const isLast = index === elements.flat().length - 1;
|
|
261
261
|
const isName = elem.type === "name";
|
|
@@ -1412,7 +1412,12 @@ function hasi18nSibling(source, route) {
|
|
|
1412
1412
|
if (i18n && i18nOptions?.strategy !== "no_prefix") {
|
|
1413
1413
|
const separator = i18nOptions?.routesNameSeparator ?? "___";
|
|
1414
1414
|
return source.some((rt) => {
|
|
1415
|
-
return route.name?.match(new RegExp(`^(${rt.name})${separator}[a-zA-Z]+`, "g")) || rt.path !== "/" && route.path?.match(
|
|
1415
|
+
return route.name?.match(new RegExp(`^(${rt.name})${separator}[a-zA-Z]+`, "g")) || rt.path !== "/" && route.path?.match(
|
|
1416
|
+
new RegExp(
|
|
1417
|
+
`/?[${i18nLocales?.map((m) => m.replace(/[^a-zA-Z0-9_]/gm, "\\$&")).join("|")}]${rt.path}`,
|
|
1418
|
+
"g"
|
|
1419
|
+
)
|
|
1420
|
+
);
|
|
1416
1421
|
});
|
|
1417
1422
|
}
|
|
1418
1423
|
return false;
|
|
@@ -1543,7 +1548,7 @@ function constructRouteMap(routesConfig) {
|
|
|
1543
1548
|
});
|
|
1544
1549
|
return output;
|
|
1545
1550
|
} catch (e) {
|
|
1546
|
-
throw new Error(
|
|
1551
|
+
throw new Error(`Generation failed: ${e}`);
|
|
1547
1552
|
}
|
|
1548
1553
|
}
|
|
1549
1554
|
function startGenerator({ output, routesConfig }) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-typed-router",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.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",
|
|
@@ -65,13 +65,13 @@
|
|
|
65
65
|
"defu": "^6.1.2",
|
|
66
66
|
"lodash-es": "^4.17.21",
|
|
67
67
|
"log-symbols": "^5.1.0",
|
|
68
|
-
"mkdirp": "^2.1.
|
|
68
|
+
"mkdirp": "^2.1.5",
|
|
69
69
|
"nanoid": "^4.0.1",
|
|
70
70
|
"pathe": "1.1.0",
|
|
71
71
|
"prettier": "2.8.4"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@nuxt/devtools": "^0.2.
|
|
74
|
+
"@nuxt/devtools": "^0.2.5",
|
|
75
75
|
"@nuxt/module-builder": "^0.2.1",
|
|
76
76
|
"@nuxt/test-utils": "^3.2.2",
|
|
77
77
|
"@nuxt/types": "^2.16.0",
|
|
@@ -79,23 +79,22 @@
|
|
|
79
79
|
"@nuxtjs/i18n": "8.0.0-beta.9",
|
|
80
80
|
"@nuxtjs/web-vitals": "^0.2.2",
|
|
81
81
|
"@types/lodash-es": "^4.17.6",
|
|
82
|
-
"@types/
|
|
83
|
-
"@types/node": "^18.14.0",
|
|
82
|
+
"@types/node": "^18.14.6",
|
|
84
83
|
"@types/prettier": "^2.7.2",
|
|
85
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
86
|
-
"@typescript-eslint/parser": "^5.
|
|
84
|
+
"@typescript-eslint/eslint-plugin": "^5.54.1",
|
|
85
|
+
"@typescript-eslint/parser": "^5.54.1",
|
|
87
86
|
"@vue/test-utils": "^2.3.0",
|
|
88
87
|
"bumpp": "9.0.0",
|
|
89
88
|
"changelogithub": "0.12.7",
|
|
90
89
|
"cross-env": "^7.0.3",
|
|
91
90
|
"eslint": "8.35.0",
|
|
92
|
-
"eslint-config-prettier": "^8.
|
|
91
|
+
"eslint-config-prettier": "^8.7.0",
|
|
93
92
|
"eslint-plugin-vue": "^9.9.0",
|
|
94
93
|
"nuxt": "3.2.3",
|
|
95
|
-
"playwright": "1.31.
|
|
96
|
-
"tsd": "^0.
|
|
94
|
+
"playwright": "1.31.2",
|
|
95
|
+
"tsd": "^0.26.0",
|
|
97
96
|
"typescript": "^4.9.5",
|
|
98
|
-
"vitest": "^0.29.
|
|
97
|
+
"vitest": "^0.29.2",
|
|
99
98
|
"vue-eslint-parser": "^9.1.0",
|
|
100
99
|
"vue-router": "^4.1.6",
|
|
101
100
|
"vue-tsc": "^1.1.7"
|