nuxt-typed-router 3.1.5 → 3.2.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 +12 -53
- package/package.json +17 -17
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
|
@@ -38,7 +38,9 @@ class ModuleOptionsStore {
|
|
|
38
38
|
if (options.i18n != null)
|
|
39
39
|
this.i18n = options.i18n;
|
|
40
40
|
if (options.i18nOptions != null) {
|
|
41
|
-
this.i18nOptions = options.i18nOptions
|
|
41
|
+
this.i18nOptions = defu(options.i18nOptions, {
|
|
42
|
+
strategy: "prefix_except_default"
|
|
43
|
+
});
|
|
42
44
|
if (options.i18nOptions.locales) {
|
|
43
45
|
this.i18nLocales = options.i18nOptions.locales.map((l) => {
|
|
44
46
|
if (typeof l === "string") {
|
|
@@ -1114,7 +1116,7 @@ function createDefinePageMetaFile() {
|
|
|
1114
1116
|
[T in keyof PageMeta as [unknown] extends [PageMeta[T]] ? never : T]: PageMeta[T];
|
|
1115
1117
|
}
|
|
1116
1118
|
|
|
1117
|
-
export type TypedPageMeta
|
|
1119
|
+
export type TypedPageMeta = Omit<FilteredPageMeta, 'redirect' | 'validate' | 'key'> & {
|
|
1118
1120
|
/**
|
|
1119
1121
|
* Validate whether a given route can validly be rendered with this page.
|
|
1120
1122
|
*
|
|
@@ -1123,8 +1125,8 @@ function createDefinePageMetaFile() {
|
|
|
1123
1125
|
* statusCode/statusMessage to respond immediately with an error (other matches
|
|
1124
1126
|
* will not be checked).
|
|
1125
1127
|
*/
|
|
1126
|
-
validate?: (route:
|
|
1127
|
-
key?: false | string | ((route:
|
|
1128
|
+
validate?: (route: TypedRoute) => boolean | Promise<boolean> | Partial<NuxtError> | Promise<Partial<NuxtError>>;
|
|
1129
|
+
key?: false | string | ((route: TypedRoute) => string);
|
|
1128
1130
|
/** Allow types augmented by other modules */
|
|
1129
1131
|
[key: string]: any;
|
|
1130
1132
|
}
|
|
@@ -1147,26 +1149,22 @@ function createDefinePageMetaFile() {
|
|
|
1147
1149
|
* @exemple
|
|
1148
1150
|
*
|
|
1149
1151
|
* \`\`\`ts
|
|
1150
|
-
* definePageMeta('current-location-name', {
|
|
1151
|
-
* validate(route) {
|
|
1152
|
-
* });
|
|
1153
|
-
* // or
|
|
1154
1152
|
* definePageMeta({
|
|
1155
1153
|
* validate(route) {
|
|
1156
1154
|
* });
|
|
1157
1155
|
* \`\`\`
|
|
1158
1156
|
*/
|
|
1159
1157
|
export function definePageMeta<P extends string, U extends RoutesNamesList>(
|
|
1160
|
-
meta: TypedPageMeta
|
|
1158
|
+
meta: TypedPageMeta & { redirect: TypedRouteLocationRawFromName<U, P> }
|
|
1161
1159
|
): void;
|
|
1162
1160
|
${returnIfTrue(
|
|
1163
1161
|
pathCheck && !strictOptions.router.strictToArgument,
|
|
1164
1162
|
`export function definePageMeta<P extends string>(
|
|
1165
|
-
meta: TypedPageMeta
|
|
1163
|
+
meta: TypedPageMeta & { redirect: TypedPathParameter<P> }
|
|
1166
1164
|
): void;`
|
|
1167
1165
|
)}
|
|
1168
1166
|
export function definePageMeta<P extends string = string>(
|
|
1169
|
-
meta: TypedPageMeta
|
|
1167
|
+
meta: TypedPageMeta & {
|
|
1170
1168
|
redirect?: (to: TypedRoute) => TypedRouteLocationRaw<P> ${returnIfTrue(
|
|
1171
1169
|
pathCheck && !strictOptions.router.strictToArgument,
|
|
1172
1170
|
` | TypedPathParameter<P>`
|
|
@@ -1174,55 +1172,16 @@ export function definePageMeta<P extends string = string>(
|
|
|
1174
1172
|
}
|
|
1175
1173
|
): void;
|
|
1176
1174
|
export function definePageMeta<P extends string = string>(
|
|
1177
|
-
meta: TypedPageMeta
|
|
1175
|
+
meta: TypedPageMeta & {
|
|
1178
1176
|
redirect?: () => TypedRouteLocationRaw<P> ${returnIfTrue(
|
|
1179
1177
|
pathCheck && !strictOptions.router.strictToArgument,
|
|
1180
1178
|
` | TypedPathParameter<P>`
|
|
1181
1179
|
)};
|
|
1182
1180
|
}
|
|
1183
1181
|
): void;
|
|
1184
|
-
export function definePageMeta
|
|
1185
|
-
|
|
1186
|
-
P extends string,
|
|
1187
|
-
U extends RoutesNamesList
|
|
1188
|
-
>(routeName: T, meta: TypedPageMeta<T> & { redirect: TypedRouteLocationRawFromName<U, P> }): void;
|
|
1189
|
-
${returnIfTrue(
|
|
1190
|
-
pathCheck && !strictOptions.router.strictToArgument,
|
|
1191
|
-
`export function definePageMeta<T extends RoutesNamesList, P extends string>(
|
|
1192
|
-
routeName: T,
|
|
1193
|
-
meta: TypedPageMeta<T> & { redirect: TypedPathParameter<P> }
|
|
1194
|
-
): void;`
|
|
1195
|
-
)}
|
|
1196
|
-
export function definePageMeta<
|
|
1197
|
-
T extends RoutesNamesList,
|
|
1198
|
-
P extends string,
|
|
1199
|
-
U extends RoutesNamesList
|
|
1200
|
-
>(
|
|
1201
|
-
routeName: T,
|
|
1202
|
-
meta: TypedPageMeta<T> & {
|
|
1203
|
-
redirect?: (to: TypedRouteFromName<T>) => TypedRouteLocationRaw<P> ${returnIfTrue(
|
|
1204
|
-
pathCheck && !strictOptions.router.strictToArgument,
|
|
1205
|
-
` | TypedPathParameter<P>`
|
|
1206
|
-
)};
|
|
1207
|
-
}
|
|
1208
|
-
): void;
|
|
1209
|
-
export function definePageMeta<T extends RoutesNamesList, P extends string>(
|
|
1210
|
-
routeName: T,
|
|
1211
|
-
meta: TypedPageMeta<T> & {
|
|
1212
|
-
redirect?: () => TypedRouteLocationRaw<P> ${returnIfTrue(
|
|
1213
|
-
pathCheck && !strictOptions.router.strictToArgument,
|
|
1214
|
-
` | TypedPathParameter<P>`
|
|
1215
|
-
)};
|
|
1216
|
-
}
|
|
1217
|
-
): void;
|
|
1218
|
-
export function definePageMeta(metaOrName: any, meta?: any): void {
|
|
1219
|
-
if (typeof metaOrName === 'string') {
|
|
1220
|
-
return defaultDefinePageMeta(meta as any);
|
|
1221
|
-
} else {
|
|
1222
|
-
return defaultDefinePageMeta(metaOrName as any);
|
|
1223
|
-
}
|
|
1182
|
+
export function definePageMeta(meta?: TypedPageMeta): void {
|
|
1183
|
+
return defaultDefinePageMeta(meta);
|
|
1224
1184
|
}
|
|
1225
|
-
|
|
1226
1185
|
|
|
1227
1186
|
`
|
|
1228
1187
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-typed-router",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.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
|
-
"@nuxtjs/i18n": "8.0.0-beta.
|
|
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
|
}
|