@factor/app
Advanced tools
Comparing version 1.5.0 to 1.5.4
{ | ||
"name": "@factor/app", | ||
"version": "1.5.0", | ||
"version": "1.5.4", | ||
"license": "GPL-2.0", | ||
@@ -8,5 +8,3 @@ "publishConfig": { | ||
}, | ||
"factor": { | ||
"_id": "app" | ||
}, | ||
"factor": {}, | ||
"dependencies": { | ||
@@ -18,3 +16,3 @@ "qs": "^6.6.0", | ||
}, | ||
"gitHead": "dece0baedc5818060c224378d61f963e74a3087a" | ||
"gitHead": "41692117e7dcba394dec21ba8046b3e40a8bd276" | ||
} |
@@ -6,3 +6,3 @@ import { applyFilters, runCallbacks, pushToFilter, addFilter } from "@factor/api/hooks" | ||
import qs from "qs" | ||
import { uniq } from "@factor/api" | ||
Vue.use(VueRouter) | ||
@@ -65,2 +65,45 @@ | ||
/** | ||
* Pull routes for sitemap out of a router config | ||
*/ | ||
export const getRouterPaths = (routes: RouteConfig[], parent = ""): string[] => { | ||
let out: string[] = [] | ||
routes | ||
.filter(_ => _.path !== "*") | ||
.forEach(_ => { | ||
if (_.path) { | ||
let _p = _.path | ||
if (parent && !_.path.startsWith("/")) { | ||
_p = `${parent}/${_.path}` | ||
} else if (parent && _.path == "/") { | ||
_p = parent | ||
} | ||
out.push(_p) | ||
} | ||
if (_.children) { | ||
out = [...out, ...getRouterPaths(_.children, _.path)] | ||
} | ||
}) | ||
return out | ||
} | ||
/** | ||
* get statically assigned routes | ||
* then remove duplicated and dynamic routes (which include a colon (:)) | ||
*/ | ||
export const getKnownRoutePaths = (): string[] => { | ||
const contentRoutes = applyFilters("content-routes", []) | ||
const theRoutes = uniq(getRouterPaths(contentRoutes)).filter((fullPath: string) => { | ||
return !fullPath.includes(":") | ||
}) | ||
return theRoutes | ||
} | ||
/** | ||
* Creates the Vue Router instance | ||
@@ -67,0 +110,0 @@ * @library vue-router |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48480
773