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 CHANGED
@@ -5,5 +5,5 @@
5
5
  "nuxt": "^3.0.0",
6
6
  "bridge": false
7
7
  },
8
- "version": "3.0.3"
8
+ "version": "3.0.4"
9
9
  }
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
- const hasOnlyNames = elements.flat().every((elem) => elem.type === "name");
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 && !hasOnlyNames) {
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
- ? ${hasOnlyNames ? `true :` : elements.flat().map((elem, index) => {
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(new RegExp(`/?[${i18nLocales?.join("|")}]${rt.path}`, "g"));
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("Generation failed", e);
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",
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.3",
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.4",
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/mkdirp": "^2.0.0",
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.53.0",
86
- "@typescript-eslint/parser": "^5.53.0",
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.6.0",
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.1",
96
- "tsd": "^0.25.0",
94
+ "playwright": "1.31.2",
95
+ "tsd": "^0.26.0",
97
96
  "typescript": "^4.9.5",
98
- "vitest": "^0.29.1",
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"