nuxt-typed-router 3.0.1-beta.1 → 3.0.2

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 CHANGED
@@ -89,10 +89,10 @@ export default defineNuxtConfig({
89
89
 
90
90
  # Roadmap
91
91
 
92
- - [ ] Add `path` autocomplete with TS string templates
93
- - [ ] Enforce strong params typing depending of origin route
94
- - [ ] Add support for `validate` in `definePageMeta`
92
+ - [x] Add `path` autocomplete with TS string templates
93
+ - [x] Add support for `validate` and `redirect` in `definePageMeta`
95
94
  - [x] Add `strict` option to prevent path navigation
95
+ - [ ] Enforce strong params typing depending of origin route
96
96
 
97
97
 
98
98
  ## Development
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.1-beta.1"
8
+ "version": "3.0.2"
9
9
  }
package/dist/module.mjs CHANGED
@@ -1395,6 +1395,42 @@ function extractChunkMain(chunkName) {
1395
1395
  return chunkArray?.join("/");
1396
1396
  }
1397
1397
 
1398
+ function hasi18nSibling(source, route) {
1399
+ const { i18n, i18nOptions } = moduleOptionStore;
1400
+ if (i18n && i18nOptions?.strategy !== "no_prefix") {
1401
+ const separator = i18nOptions?.routesNameSeparator ?? "___";
1402
+ return source.some((rt) => {
1403
+ return route.name?.match(new RegExp(`^(${rt.name})${separator}[a-zA-Z]+`, "g")) || rt.path !== "/" && route.path?.match(new RegExp(`/?[${i18nOptions?.locales?.join("|")}]${rt.path}`, "g"));
1404
+ });
1405
+ }
1406
+ return false;
1407
+ }
1408
+ function modifyRoutePrefixDefaultIfI18n(route) {
1409
+ const { i18n, i18nOptions } = moduleOptionStore;
1410
+ if (i18n && route.name) {
1411
+ const separator = i18nOptions?.routesNameSeparator ?? "___";
1412
+ if (i18nOptions?.strategy === "prefix_and_default") {
1413
+ const routeDefaultRegXp = new RegExp(
1414
+ `([a-zA-Z-]+)${separator}[a-zA-Z]+${separator}default`,
1415
+ "g"
1416
+ );
1417
+ const match = routeDefaultRegXp.exec(route.name);
1418
+ if (match) {
1419
+ const [_, routeName] = match;
1420
+ route.name = routeName;
1421
+ }
1422
+ } else if (i18nOptions?.strategy === "prefix_except_default") {
1423
+ const defaultLocale = i18nOptions.defaultLocale;
1424
+ const routeDefaultNameRegXp = new RegExp(`^([a-zA-Z-]+)${separator}${defaultLocale}`, "g");
1425
+ const match = routeDefaultNameRegXp.exec(route.name);
1426
+ if (match) {
1427
+ const [_, routeName] = match;
1428
+ route.name = routeName;
1429
+ }
1430
+ }
1431
+ }
1432
+ }
1433
+
1398
1434
  function createKeyedName(route, parent) {
1399
1435
  const splittedPaths = route.path.split("/");
1400
1436
  const parentPath = splittedPaths[splittedPaths.length - 1];
@@ -1414,31 +1450,6 @@ function createNameKeyFromFullName(route, level, parentName) {
1414
1450
  const keyName = route.path === "" ? "index" : camelCase(splitted.join("-")) || "index";
1415
1451
  return keyName;
1416
1452
  }
1417
- function hasi18nSibling(source, route) {
1418
- const { i18n, i18nOptions } = moduleOptionStore;
1419
- if (i18n) {
1420
- const separator = i18nOptions?.routesNameSeparator ?? "___";
1421
- return source.some((rt) => {
1422
- return route.name?.match(new RegExp(`^(${rt.name})${separator}[a-zA-Z]+`, "g")) || rt.path !== "/" && route.path?.match(new RegExp(`/?[a-zA-Z]+${rt.path}`, "g"));
1423
- });
1424
- }
1425
- return false;
1426
- }
1427
- function modifyRoutePrefixDefaultIfI18n(route) {
1428
- const { i18n, i18nOptions } = moduleOptionStore;
1429
- if (i18n && route.name && i18nOptions?.strategy === "prefix_and_default") {
1430
- const separator = i18nOptions?.routesNameSeparator ?? "___";
1431
- const routeDefaultRegXp = new RegExp(
1432
- `([a-zA-Z-]+)${separator}[a-zA-Z]+${separator}default`,
1433
- "g"
1434
- );
1435
- const match = routeDefaultRegXp.exec(route.name);
1436
- if (match) {
1437
- const [_, routeName] = match;
1438
- route.name = routeName;
1439
- }
1440
- }
1441
- }
1442
1453
  function walkThoughRoutes({
1443
1454
  route,
1444
1455
  level,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-typed-router",
3
- "version": "3.0.1-beta.1",
3
+ "version": "3.0.2",
4
4
  "description": "Provide autocompletion for routes paths, names and params in Nuxt apps",
5
5
  "type": "module",
6
6
  "main": "./dist/module.cjs",
@@ -19,6 +19,7 @@
19
19
  "prepack": "nuxt-module-build",
20
20
  "dev": "nuxi dev playground",
21
21
  "dev:build": "nuxi build playground",
22
+ "prepare:playground": "nuxi prepare playground",
22
23
  "dev:prepare": "nuxt-module-build --stub && nuxi prepare playground && pnpm run test:prepare-fixtures",
23
24
  "build:test": "cross-env NUXT_BUILD_TYPE=stub pnpm run prepack && pnpm run dev:build",
24
25
  "test:prepare-fixtures": "nuxi prepare test/fixtures/simple && nuxi prepare test/fixtures/withOptions && nuxi prepare test/fixtures/complex",
@@ -30,7 +31,7 @@
30
31
  "docs:dev": "cd docs && pnpm run dev",
31
32
  "docs:build": "npm run dev:prepare && cd docs && nuxi generate",
32
33
  "typecheck": "tsc --noEmit",
33
- "release": "pnpm test && standard-version && git push --follow-tags && npm publish"
34
+ "release": "bumpp && npm publish && git push --follow-tags"
34
35
  },
35
36
  "publishConfig": {
36
37
  "access": "public"
@@ -70,7 +71,7 @@
70
71
  "prettier": "2.8.4"
71
72
  },
72
73
  "devDependencies": {
73
- "@nuxt/devtools": "^0.1.6",
74
+ "@nuxt/devtools": "^0.2.4",
74
75
  "@nuxt/module-builder": "^0.2.1",
75
76
  "@nuxt/test-utils": "^3.2.2",
76
77
  "@nuxt/types": "^2.16.0",
@@ -84,16 +85,17 @@
84
85
  "@typescript-eslint/eslint-plugin": "^5.53.0",
85
86
  "@typescript-eslint/parser": "^5.53.0",
86
87
  "@vue/test-utils": "^2.3.0",
88
+ "bumpp": "9.0.0",
89
+ "changelogithub": "0.12.7",
87
90
  "cross-env": "^7.0.3",
88
- "eslint": "8.34.0",
91
+ "eslint": "8.35.0",
89
92
  "eslint-config-prettier": "^8.6.0",
90
93
  "eslint-plugin-vue": "^9.9.0",
91
- "nuxt": "3.2.2",
92
- "playwright": "1.31.0",
93
- "standard-version": "^9.5.0",
94
+ "nuxt": "3.2.3",
95
+ "playwright": "1.31.1",
94
96
  "tsd": "^0.25.0",
95
97
  "typescript": "^4.9.5",
96
- "vitest": "^0.28.5",
98
+ "vitest": "^0.29.1",
97
99
  "vue-eslint-parser": "^9.1.0",
98
100
  "vue-router": "^4.1.6",
99
101
  "vue-tsc": "^1.1.7"