nuxt-typed-router 1.1.1 โ 1.2.1
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 +8 -3
- package/dist/module.json +2 -2
- package/dist/module.mjs +7 -3
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# ๐๐ฆ Typed Router for Nuxt
|
|
1
|
+
# ๐๐ฆ Typed Router for Nuxt
|
|
2
2
|
|
|
3
3
|
[npm-version-src]: https://img.shields.io/npm/v/nuxt-typed-router.svg
|
|
4
4
|
[npm-version-href]: https://www.npmjs.com/package/nuxt-typed-router
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
[![npm downloads][npm-total-downloads-src]][npm-downloads-href]
|
|
12
12
|
<img src='https://img.shields.io/npm/l/simple-graphql-to-typescript.svg'>
|
|
13
13
|
|
|
14
|
-
> Provide a type safe router to Nuxt
|
|
14
|
+
> Provide a type safe router to Nuxt with auto-generated typed definitions for route names and autocompletion for route params
|
|
15
15
|
|
|
16
16
|
- ๐ Provides a hook `useTypedRouter` that returns an alias of `$typedRouter` and also a typed list of your routes
|
|
17
17
|
- ๐ Expose a global method `$typedRouter` (clone of vue-router), but typed with the routes defined in `pages` directory
|
|
@@ -21,6 +21,11 @@
|
|
|
21
21
|
|
|
22
22
|
Demo ๐งช : [nuxt-typed-router-demo](https://github.com/victorgarciaesgi/nuxt-typed-router-demo)
|
|
23
23
|
|
|
24
|
+
## Compatibility:
|
|
25
|
+
|
|
26
|
+
- Nuxt 3
|
|
27
|
+
- Nuxt 2 (via [`nuxt2` branch](https://github.com/victorgarciaesgi/nuxt-typed-router/tree/nuxt2))
|
|
28
|
+
|
|
24
29
|
<br/>
|
|
25
30
|
<p align="center">
|
|
26
31
|
<img src="https://github.com/victorgarciaesgi/nuxt-typed-router/blob/master/medias/in-action.gif?raw=true"/>
|
|
@@ -83,7 +88,7 @@ interface ModuleOptions {
|
|
|
83
88
|
The module will generate 4 files each time you modify the `pages` folder :
|
|
84
89
|
|
|
85
90
|
- `~/<outDir>/__routes.ts` with the global object of the route names inside.
|
|
86
|
-
- `~/<outDir>/__useTypedRouter.ts` Composable
|
|
91
|
+
- `~/<outDir>/__useTypedRouter.ts` Composable to simply access your typed routes
|
|
87
92
|
- `~/<outDir>/typed-router.d.ts` containing the global typecript definitions and exports
|
|
88
93
|
- `~/plugins/__typed_router.ts` Plugin that will inject `$typedRouter` and `$routesList` (`@nuxt/kit` has problems registering plugin templates so this is a workaround)
|
|
89
94
|
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -274,7 +274,7 @@ const staticDeclarations = `
|
|
|
274
274
|
): Promise<NavigationFailure | void | undefined>;
|
|
275
275
|
}
|
|
276
276
|
|
|
277
|
-
declare module '
|
|
277
|
+
declare module 'nuxt/dist/app/nuxt' {
|
|
278
278
|
export interface NuxtApp {
|
|
279
279
|
$typedRouter: TypedRouter;
|
|
280
280
|
$routesList: RouteListDecl;
|
|
@@ -415,11 +415,15 @@ const module = defineNuxtModule({
|
|
|
415
415
|
meta: {
|
|
416
416
|
name: "nuxt-typed-router",
|
|
417
417
|
configKey: "nuxtTypedRouter",
|
|
418
|
-
compatibility: { nuxt: "^3.0.0", bridge: false }
|
|
418
|
+
compatibility: { nuxt: "^3.0.0-rc.1", bridge: false }
|
|
419
|
+
},
|
|
420
|
+
defaults: {
|
|
421
|
+
outDir: `./generated`,
|
|
422
|
+
routesObjectName: "routerPagesNames"
|
|
419
423
|
},
|
|
420
424
|
setup(moduleOptions, nuxt) {
|
|
421
425
|
const srcDir = nuxt.options.srcDir;
|
|
422
|
-
const { outDir
|
|
426
|
+
const { outDir, routesObjectName } = moduleOptions;
|
|
423
427
|
nuxt.hook("pages:extend", () => routeHook(outDir, routesObjectName, srcDir, nuxt));
|
|
424
428
|
routeHook(outDir, routesObjectName, srcDir, nuxt);
|
|
425
429
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-typed-router",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Provide autocompletion for pages route names generated by Nuxt router",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -51,28 +51,28 @@
|
|
|
51
51
|
"url": "https://github.com/victorgarciaesgi/nuxt-typed-router/issues"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@nuxt/kit": "
|
|
54
|
+
"@nuxt/kit": "^3.0.0-rc.9",
|
|
55
55
|
"chalk": "^4.1.2",
|
|
56
56
|
"lodash-es": "^4.17.21",
|
|
57
57
|
"log-symbols": "^5.1.0",
|
|
58
58
|
"mkdirp": "^1.0.4",
|
|
59
59
|
"pathe": "^0.2.0",
|
|
60
|
-
"prettier": "^2.
|
|
60
|
+
"prettier": "^2.7.1"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@nuxt/module-builder": "latest",
|
|
64
64
|
"@nuxt/types": "^2.15.8",
|
|
65
65
|
"@nuxtjs/eslint-config-typescript": "latest",
|
|
66
|
-
"@types/lodash-es": "^4.
|
|
66
|
+
"@types/lodash-es": "^4.17.6",
|
|
67
67
|
"@types/mkdirp": "^1.0.2",
|
|
68
|
-
"@types/node": "^
|
|
69
|
-
"@types/prettier": "^2.
|
|
68
|
+
"@types/node": "^17.0.23",
|
|
69
|
+
"@types/prettier": "^2.7.0",
|
|
70
70
|
"cross-env": "^7.0.3",
|
|
71
|
-
"eslint": "8.
|
|
72
|
-
"eslint-config-prettier": "^8.
|
|
73
|
-
"
|
|
74
|
-
"typescript": "^4.
|
|
75
|
-
"vitest": "^0.
|
|
76
|
-
"vue-router": "^4.
|
|
71
|
+
"eslint": "8.23.0",
|
|
72
|
+
"eslint-config-prettier": "^8.5.0",
|
|
73
|
+
"nuxt": "^3.0.0-rc.9",
|
|
74
|
+
"typescript": "^4.6.3",
|
|
75
|
+
"vitest": "^0.22.1",
|
|
76
|
+
"vue-router": "^4.1.5"
|
|
77
77
|
}
|
|
78
78
|
}
|