Skip to content

Commit

Permalink
feat: closes nuxt-community#69 - adds data to routes in the filter fu…
Browse files Browse the repository at this point in the history
…nction
  • Loading branch information
Snir Shechter committed Jun 16, 2019
1 parent a7a3bca commit 01f868c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ module.exports = function module (moduleOptions) {
this.extendRoutes(routes => {
// Get all static routes and ignore dynamic routes
let staticRoutes = flattenRoutes(routes)
.filter(r => !r.includes(':') && !r.includes('*'))
.filter(r => !r.url.includes(':') && !r.url.includes('*'))

// Exclude routes
options.exclude.forEach(pattern => {
const minimatch = new Minimatch(pattern)
minimatch.negate = true
staticRoutes = staticRoutes.filter(route => minimatch.match(route))
staticRoutes = staticRoutes.filter(route => minimatch.match(route.url))
})

// Create a cache for routes
Expand Down Expand Up @@ -232,7 +232,7 @@ function flattenRoutes (router, path = '', routes = []) {
flattenRoutes(r.children, path + r.path + '/', routes)
}
if (r.path !== '') {
routes.push(path + r.path)
routes.push({ ...r, url: path + r.path })
}
})
return routes
Expand Down

0 comments on commit 01f868c

Please sign in to comment.