vuepress-plugin-blog2
Advanced tools
Comparing version 2.0.0-beta.35 to 2.0.0-beta.36
@@ -1,2 +0,2 @@ | ||
import{resolveRouteWithRedirect as t}from"@mr-hope/vuepress-shared/lib/client";import{categoryMap as e}from"@temp/blog/category";import{useRouteLocale as o,usePageFrontmatter as a}from"@vuepress/client";import{ref as p,computed as m}from"vue";import{useRouter as r,useRoute as s}from"vue-router";import{typeMap as n}from"@temp/blog/type";const i=p(e),u=(e="")=>{const p=r(),n=s(),u=o();return m((()=>{var o;const m=e||(null===(o=a().value.blog)||void 0===o?void 0:o.key)||"",r=p.getRoutes(),s=i.value[m][u.value],l={path:s.path,map:{}};for(const e in s.map){const o=s.map[e];l.map[e]={path:o.path,items:[]};for(const a of o.keys){const o=r.find((({name:t})=>t===a));if(o){const a=t(p,o.path);l.map[e].items.push({path:a.path,info:""===BLOG_META_SCOPE?a.meta:a.meta[BLOG_META_SCOPE]})}}n.path===o.path&&(l.currentItems=l.map[e].items)}return l}))};(import.meta.webpackHot||import.meta.hot)&&(__VUE_HMR_RUNTIME__.updateBlogCategory=t=>{i.value=t});const l=p(n),c=(e="")=>{const p=r(),s=o();return m((()=>{var o;const m=e||(null===(o=a().value.blog)||void 0===o?void 0:o.key)||"",r=p.getRoutes(),n=l.value[m][s.value],i={path:n.path,items:[]};for(const e of n.keys){const o=r.find((({name:t})=>t===e));if(o){const e=t(p,o.path);i.items.push({path:e.path,info:""===BLOG_META_SCOPE?e.meta:e.meta[BLOG_META_SCOPE]})}}return i}))};(import.meta.webpackHot||import.meta.hot)&&(__VUE_HMR_RUNTIME__.updateBlogType=t=>{l.value=t});export{i as blogCategoryMap,l as blogTypeMap,u as useBlogCategory,c as useBlogType}; | ||
import{resolveRouteWithRedirect as t}from"@mr-hope/vuepress-shared/lib/client";import{categoryMap as o}from"@temp/blog/category";import{useRouteLocale as e,usePageFrontmatter as a}from"@vuepress/client";import{ref as n,computed as r}from"vue";import{useRouter as p,useRoute as i}from"vue-router";import{typeMap as m}from"@temp/blog/type";const s=n(o),u=(o="")=>{const n=p(),m=i(),u=e();return r((()=>{var e;const r=o||(null===(e=a().value.blog)||void 0===e?void 0:e.key)||"",p=n.getRoutes();if(!s.value[r])throw new Error("useBlogCategory: "+(o?`key ${o} is invalid`:"can not bind to an exisiting key on non blog pages"));const i=s.value[r][u.value],l={path:i.path,map:{}};for(const o in i.map){const e=i.map[o];l.map[o]={path:e.path,items:[]};for(const a of e.keys){const e=p.find((({name:t})=>t===a));if(e){const a=t(n,e.path);l.map[o].items.push({path:a.path,info:""===BLOG_META_SCOPE?a.meta:a.meta[BLOG_META_SCOPE]})}}m.path===e.path&&(l.currentItems=l.map[o].items)}return l}))};(import.meta.webpackHot||import.meta.hot)&&(__VUE_HMR_RUNTIME__.updateBlogCategory=t=>{s.value=t});const l=n(m),c=(o="")=>{const n=p(),i=e();return r((()=>{var e;const r=o||(null===(e=a().value.blog)||void 0===e?void 0:e.key)||"";if(!l.value[r])throw new Error("useBlogType: "+(o?`key ${o} is invalid`:"can not bind to an exisiting key on non blog pages"));const p=n.getRoutes(),m=l.value[r][i.value],s={path:m.path,items:[]};for(const o of m.keys){const e=p.find((({name:t})=>t===o));if(e){const o=t(n,e.path);s.items.push({path:o.path,info:""===BLOG_META_SCOPE?o.meta:o.meta[BLOG_META_SCOPE]})}}return s}))};(import.meta.webpackHot||import.meta.hot)&&(__VUE_HMR_RUNTIME__.updateBlogType=t=>{l.value=t});export{s as blogCategoryMap,l as blogTypeMap,u as useBlogCategory,c as useBlogType}; | ||
//# sourceMappingURL=index.js.map |
@@ -80,3 +80,3 @@ import { Page, Plugin, PluginConfig } from '@vuepress/core'; | ||
*/ | ||
getter: (page: Page) => string[]; | ||
getter: <ExtraPageData extends Record<string | number | symbol, unknown> = Record<never, never>, ExtraPageFrontmatter extends Record<string | number | symbol, unknown> = Record<string, unknown>, ExtraPageFields extends Record<string | number | symbol, unknown> = Record<never, never>>(page: Page<ExtraPageData, ExtraPageFrontmatter, ExtraPageFields>) => string[]; | ||
/** | ||
@@ -87,3 +87,3 @@ * A custom function to sort the pages | ||
*/ | ||
sorter?: (pageA: Page, pageB: Page) => number; | ||
sorter?: <ExtraPageData extends Record<string | number | symbol, unknown> = Record<never, never>, ExtraPageFrontmatter extends Record<string | number | symbol, unknown> = Record<string, unknown>, ExtraPageFields extends Record<string | number | symbol, unknown> = Record<never, never>>(pageA: Page<ExtraPageData, ExtraPageFrontmatter, ExtraPageFields>, pageB: Page<ExtraPageData, ExtraPageFrontmatter, ExtraPageFields>) => number; | ||
/** | ||
@@ -154,3 +154,3 @@ * Path pattern of page to be registered | ||
*/ | ||
filter: (page: Page) => boolean; | ||
filter: <ExtraPageData extends Record<string | number | symbol, unknown> = Record<never, never>, ExtraPageFrontmatter extends Record<string | number | symbol, unknown> = Record<string, unknown>, ExtraPageFields extends Record<string | number | symbol, unknown> = Record<never, never>>(page: Page<ExtraPageData, ExtraPageFrontmatter, ExtraPageFields>) => boolean; | ||
/** | ||
@@ -161,3 +161,3 @@ * A custom function to sort the pages | ||
*/ | ||
sorter?: (pageA: Page, pageB: Page) => number; | ||
sorter?: <ExtraPageData extends Record<string | number | symbol, unknown> = Record<never, never>, ExtraPageFrontmatter extends Record<string | number | symbol, unknown> = Record<string, unknown>, ExtraPageFields extends Record<string | number | symbol, unknown> = Record<never, never>>(pageA: Page<ExtraPageData, ExtraPageFrontmatter, ExtraPageFields>, pageB: Page<ExtraPageData, ExtraPageFrontmatter, ExtraPageFields>) => number; | ||
/** | ||
@@ -192,3 +192,3 @@ * Page path to be registered | ||
*/ | ||
getInfo?: (page: Page) => Record<string, unknown>; | ||
getInfo?: <ExtraPageData extends Record<string | number | symbol, unknown> = Record<never, never>, ExtraPageFrontmatter extends Record<string | number | symbol, unknown> = Record<string, unknown>, ExtraPageFields extends Record<string | number | symbol, unknown> = Record<never, never>>(page: Page<ExtraPageData, ExtraPageFrontmatter, ExtraPageFields>) => Record<string, unknown>; | ||
/** | ||
@@ -201,3 +201,3 @@ * Page filter, determine whether a page should be included. | ||
*/ | ||
filter?: (page: Page) => boolean; | ||
filter?: <ExtraPageData extends Record<string | number | symbol, unknown> = Record<never, never>, ExtraPageFrontmatter extends Record<string | number | symbol, unknown> = Record<string, unknown>, ExtraPageFields extends Record<string | number | symbol, unknown> = Record<never, never>>(page: Page<ExtraPageData, ExtraPageFrontmatter, ExtraPageFields>) => boolean; | ||
/** | ||
@@ -204,0 +204,0 @@ * Categories config |
{ | ||
"name": "vuepress-plugin-blog2", | ||
"version": "2.0.0-beta.35", | ||
"version": "2.0.0-beta.36", | ||
"description": "Blog plugin for VuePress", | ||
@@ -39,5 +39,5 @@ "keywords": [ | ||
"dependencies": { | ||
"@mr-hope/vuepress-shared": "2.0.0-beta.35", | ||
"@vuepress/client": "2.0.0-beta.37", | ||
"@vuepress/core": "2.0.0-beta.37", | ||
"@mr-hope/vuepress-shared": "2.0.0-beta.36", | ||
"@vuepress/client": "2.0.0-beta.38", | ||
"@vuepress/core": "2.0.0-beta.38", | ||
"chokidar": "^3.5.3", | ||
@@ -50,3 +50,3 @@ "vue": "^3.2.31", | ||
}, | ||
"gitHead": "289c8fda20a3cdc515f426ce2619929aa0329263" | ||
"gitHead": "c5e6cf3bbca6086c459861750f2ceef5534a5eac" | ||
} |
@@ -37,2 +37,12 @@ import { resolveRouteWithRedirect } from "@mr-hope/vuepress-shared/lib/client"; | ||
const routes = router.getRoutes(); | ||
if (!blogCategoryMap.value[mapKey]) | ||
throw new Error( | ||
`useBlogCategory: ${ | ||
key | ||
? `key ${key} is invalid` | ||
: "can not bind to an exisiting key on non blog pages" | ||
}` | ||
); | ||
const currentMap = blogCategoryMap.value[mapKey][routeLocale.value]; | ||
@@ -39,0 +49,0 @@ const result: BlogCategoryData<T> = { |
@@ -35,2 +35,11 @@ import { resolveRouteWithRedirect } from "@mr-hope/vuepress-shared/lib/client"; | ||
if (!blogTypeMap.value[mapKey]) | ||
throw new Error( | ||
`useBlogType: ${ | ||
key | ||
? `key ${key} is invalid` | ||
: "can not bind to an exisiting key on non blog pages" | ||
}` | ||
); | ||
const routes = router.getRoutes(); | ||
@@ -37,0 +46,0 @@ const configMap = blogTypeMap.value[mapKey][routeLocale.value]; |
@@ -0,1 +1,2 @@ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
import type { Page } from "@vuepress/core"; | ||
@@ -16,3 +17,18 @@ | ||
*/ | ||
getter: (page: Page) => string[]; | ||
getter: < | ||
ExtraPageData extends Record<string | number | symbol, unknown> = Record< | ||
never, | ||
never | ||
>, | ||
ExtraPageFrontmatter extends Record< | ||
string | number | symbol, | ||
unknown | ||
> = Record<string, unknown>, | ||
ExtraPageFields extends Record<string | number | symbol, unknown> = Record< | ||
never, | ||
never | ||
> | ||
>( | ||
page: Page<ExtraPageData, ExtraPageFrontmatter, ExtraPageFields> | ||
) => string[]; | ||
@@ -24,3 +40,19 @@ /** | ||
*/ | ||
sorter?: (pageA: Page, pageB: Page) => number; | ||
sorter?: < | ||
ExtraPageData extends Record<string | number | symbol, unknown> = Record< | ||
never, | ||
never | ||
>, | ||
ExtraPageFrontmatter extends Record< | ||
string | number | symbol, | ||
unknown | ||
> = Record<string, unknown>, | ||
ExtraPageFields extends Record<string | number | symbol, unknown> = Record< | ||
never, | ||
never | ||
> | ||
>( | ||
pageA: Page<ExtraPageData, ExtraPageFrontmatter, ExtraPageFields>, | ||
pageB: Page<ExtraPageData, ExtraPageFrontmatter, ExtraPageFields> | ||
) => number; | ||
@@ -102,3 +134,18 @@ /** | ||
*/ | ||
filter: (page: Page) => boolean; | ||
filter: < | ||
ExtraPageData extends Record<string | number | symbol, unknown> = Record< | ||
never, | ||
never | ||
>, | ||
ExtraPageFrontmatter extends Record< | ||
string | number | symbol, | ||
unknown | ||
> = Record<string, unknown>, | ||
ExtraPageFields extends Record<string | number | symbol, unknown> = Record< | ||
never, | ||
never | ||
> | ||
>( | ||
page: Page<ExtraPageData, ExtraPageFrontmatter, ExtraPageFields> | ||
) => boolean; | ||
@@ -110,3 +157,19 @@ /** | ||
*/ | ||
sorter?: (pageA: Page, pageB: Page) => number; | ||
sorter?: < | ||
ExtraPageData extends Record<string | number | symbol, unknown> = Record< | ||
never, | ||
never | ||
>, | ||
ExtraPageFrontmatter extends Record< | ||
string | number | symbol, | ||
unknown | ||
> = Record<string, unknown>, | ||
ExtraPageFields extends Record<string | number | symbol, unknown> = Record< | ||
never, | ||
never | ||
> | ||
>( | ||
pageA: Page<ExtraPageData, ExtraPageFrontmatter, ExtraPageFields>, | ||
pageB: Page<ExtraPageData, ExtraPageFrontmatter, ExtraPageFields> | ||
) => number; | ||
@@ -145,3 +208,18 @@ /** | ||
*/ | ||
getInfo?: (page: Page) => Record<string, unknown>; | ||
getInfo?: < | ||
ExtraPageData extends Record<string | number | symbol, unknown> = Record< | ||
never, | ||
never | ||
>, | ||
ExtraPageFrontmatter extends Record< | ||
string | number | symbol, | ||
unknown | ||
> = Record<string, unknown>, | ||
ExtraPageFields extends Record<string | number | symbol, unknown> = Record< | ||
never, | ||
never | ||
> | ||
>( | ||
page: Page<ExtraPageData, ExtraPageFrontmatter, ExtraPageFields> | ||
) => Record<string, unknown>; | ||
@@ -155,3 +233,18 @@ /** | ||
*/ | ||
filter?: (page: Page) => boolean; | ||
filter?: < | ||
ExtraPageData extends Record<string | number | symbol, unknown> = Record< | ||
never, | ||
never | ||
>, | ||
ExtraPageFrontmatter extends Record< | ||
string | number | symbol, | ||
unknown | ||
> = Record<string, unknown>, | ||
ExtraPageFields extends Record<string | number | symbol, unknown> = Record< | ||
never, | ||
never | ||
> | ||
>( | ||
page: Page<ExtraPageData, ExtraPageFrontmatter, ExtraPageFields> | ||
) => boolean; | ||
@@ -158,0 +251,0 @@ /** |
Sorry, the diff of this file is not supported yet
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
64260
1497
+ Added@mr-hope/vuepress-shared@2.0.0-beta.36(transitive)
+ Added@vuepress/client@2.0.0-beta.38(transitive)
+ Added@vuepress/core@2.0.0-beta.38(transitive)
+ Added@vuepress/markdown@2.0.0-beta.38(transitive)
+ Added@vuepress/plugin-git@2.0.0-beta.38(transitive)
+ Added@vuepress/plugin-theme-data@2.0.0-beta.38(transitive)
+ Added@vuepress/shared@2.0.0-beta.38(transitive)
+ Added@vuepress/utils@2.0.0-beta.38(transitive)
- Removed@mr-hope/vuepress-shared@2.0.0-beta.35(transitive)
- Removed@vuepress/client@2.0.0-beta.37(transitive)
- Removed@vuepress/core@2.0.0-beta.37(transitive)
- Removed@vuepress/markdown@2.0.0-beta.37(transitive)
- Removed@vuepress/plugin-git@2.0.0-beta.37(transitive)
- Removed@vuepress/plugin-theme-data@2.0.0-beta.37(transitive)
- Removed@vuepress/shared@2.0.0-beta.37(transitive)
- Removed@vuepress/utils@2.0.0-beta.37(transitive)
Updated@vuepress/core@2.0.0-beta.38