nuxt-typed-router
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -19,11 +19,13 @@ import fs from 'fs'; | ||
const recursiveTypedRoutes = route => { | ||
const name = route.name; | ||
if (name) routesInterfaces += `'${camelCase(name)}': '${name}',`; | ||
const routeName = route.name; | ||
if (route.children) { | ||
const [_, name] = route.chunkName.split('pages/'); | ||
routesInterfaces += `${camelCase(name)}:{`; | ||
const { length: len, [len - 1]: childChunk } = route.chunkName.split('/'); | ||
routesInterfaces += `${camelCase(childChunk)}:{`; | ||
route.children.map(recursiveTypedRoutes); | ||
routesInterfaces += '},'; | ||
} else if (routeName) { | ||
const { length: len, [len - 1]: childChunk } = route.chunkName.split('/'); | ||
routesInterfaces += `'${camelCase(childChunk)}': '${routeName}',`; | ||
routesEnum.push(`'${route.name}'`); | ||
} | ||
if (route.name) routesEnum.push(`'${route.name}'`); | ||
}; | ||
@@ -30,0 +32,0 @@ routes.map(recursiveTypedRoutes); |
{ | ||
"name": "nuxt-typed-router", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "Provide autocompletion for pages route names generated by Nuxt router", | ||
@@ -5,0 +5,0 @@ "main": "lib/module.js", |
@@ -81,3 +81,2 @@ # 🚦Typed Router Module | ||
### _Requirements_ | ||
@@ -177,6 +176,6 @@ | ||
index: 'index', | ||
indexCommunication: 'index-communication', | ||
indexContent: 'index-content', | ||
indexStatistics: 'index-statistics', | ||
indexUsers: 'index-users', | ||
communication: 'index-communication', | ||
content: 'index-content', | ||
statistics: 'index-statistics', | ||
users: 'index-users', | ||
}, | ||
@@ -183,0 +182,0 @@ }; |
12160
146
210