vuepress-plugin-blog2
Advanced tools
Comparing version 2.0.0-beta.73 to 2.0.0-beta.74
@@ -1,1 +0,66 @@ | ||
export * from "./composables"; | ||
import * as vue from 'vue'; | ||
import { ComputedRef } from 'vue'; | ||
import * as _temp_blog_category from '@temp/blog/category'; | ||
import * as _temp_blog_type from '@temp/blog/type'; | ||
interface BlogCategoryData<T extends Record<string, unknown> = Record<string, unknown>> { | ||
/** | ||
* Category path | ||
* | ||
* 分类路径 | ||
*/ | ||
path: string; | ||
/** | ||
* Only available when current route matches an item path | ||
* | ||
* 仅当当前路径和某个子项目匹配时可用 | ||
*/ | ||
currentItems?: Article<T>[]; | ||
/** | ||
* Category map | ||
* | ||
* 分类映射 | ||
*/ | ||
map: Record< | ||
/** | ||
* Unique key under current category | ||
* | ||
* 当前分类下全局唯一的 key | ||
*/ | ||
string, { | ||
/** | ||
* Category path of the key | ||
* | ||
* 对应键值的分类路径 | ||
*/ | ||
path: string; | ||
/** | ||
* Category items of the key | ||
* | ||
* 对应键值的项目 | ||
*/ | ||
items: Article<T>[]; | ||
}>; | ||
} | ||
interface BlogTypeData<T extends Record<string, unknown> = Record<string, unknown>> { | ||
/** | ||
* Type path | ||
* | ||
* 类别路径 | ||
*/ | ||
path: string; | ||
/** | ||
* Items under current type | ||
* | ||
* 当前类别下的项目 | ||
*/ | ||
items: Article<T>[]; | ||
} | ||
declare const blogCategoryMap: vue.Ref<Record<string, _temp_blog_category.CategoryMap>>; | ||
declare const useBlogCategory: <T extends Record<string, unknown> = Record<string, unknown>>(key?: string) => ComputedRef<BlogCategoryData<T>>; | ||
declare const blogTypeMap: vue.Ref<Record<string, _temp_blog_type.TypeMap>>; | ||
declare const useBlogType: <T extends Record<string, unknown> = Record<string, unknown>>(key?: string) => ComputedRef<BlogTypeData<T>>; | ||
export { blogCategoryMap, blogTypeMap, useBlogCategory, useBlogType }; |
@@ -1,4 +0,305 @@ | ||
import { blogPlugin } from "./plugin"; | ||
export * from "./plugin"; | ||
export * from "../shared"; | ||
export default blogPlugin; | ||
import { Page, PluginFunction } from '@vuepress/core'; | ||
import { BasePageFrontMatter } from 'vuepress-shared'; | ||
interface BlogCategoryFrontmatterOptions { | ||
type: "category"; | ||
/** | ||
* Unique key under current category | ||
* | ||
* 在当前分类下全局唯一的 key | ||
*/ | ||
key: string; | ||
/** | ||
* Current category name | ||
* | ||
* @description Only available in category item page | ||
* | ||
* 当前的分类名称 | ||
* | ||
* @description 仅在分类子项目页面中可用 | ||
*/ | ||
name?: string; | ||
} | ||
interface BlogTypeFrontmatterOptions { | ||
type: "type"; | ||
/** | ||
* Unique key under current category | ||
* | ||
* 在当前分类下全局唯一的 key | ||
*/ | ||
key: string; | ||
} | ||
interface BlogPluginCategoryFrontmatter extends BasePageFrontMatter { | ||
blog: BlogCategoryFrontmatterOptions; | ||
} | ||
interface BlogPluginTypeFrontmatter extends BasePageFrontMatter { | ||
blog: BlogTypeFrontmatterOptions; | ||
} | ||
declare type BlogPluginFrontmatter = BlogPluginCategoryFrontmatter | BlogPluginTypeFrontmatter; | ||
declare type PageMap = Record</** Locale Path */ string, /** Pages */ Page[]>; | ||
declare type ArticleMap = Record< | ||
/** Locale Path */ string, | ||
/** Page Keys */ string[]>; | ||
interface CategoryConfig { | ||
path: string; | ||
keys: string[]; | ||
} | ||
declare type CategoryLocaleMap = Record< | ||
/** Category name */ string, | ||
/** Category config */ CategoryConfig>; | ||
interface CategoryLocaleConfig { | ||
/** Main page of category */ | ||
path: string; | ||
/** category map for current locale */ | ||
map: CategoryLocaleMap; | ||
} | ||
declare type CategoryMap = Record< | ||
/** Locale Path */ string, | ||
/** Locale category config */ CategoryLocaleConfig>; | ||
interface TypeConfig { | ||
path: string; | ||
keys: string[]; | ||
} | ||
declare type TypeMap = Record< | ||
/** Locale Path */ string, | ||
/** Locale Type config */ TypeConfig>; | ||
interface BlogCategoryOptions { | ||
/** | ||
* Unique category name | ||
* | ||
* 唯一的分类名称 | ||
*/ | ||
key: string; | ||
/** | ||
* Function getting category from page | ||
* | ||
* 从页面中获取分类的函数 | ||
*/ | ||
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[]; | ||
/** | ||
* A custom function to sort the pages | ||
* | ||
* 页面排序器 | ||
*/ | ||
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; | ||
/** | ||
* Path pattern of page to be registered | ||
* | ||
* @description `:key` will be replaced by the "slugify" result of the original key | ||
* | ||
* 待注册的页面路径图案 | ||
* | ||
* @description `:key` 将会被替换为原 key 的 slugify 结果 | ||
* | ||
* @default `/:key/` | ||
*/ | ||
path?: string | false; | ||
/** | ||
* Page layout name | ||
* | ||
* 页面布局组件名称 | ||
* | ||
* @default 'Layout' | ||
*/ | ||
layout?: string; | ||
/** | ||
* Frontmatter | ||
* | ||
* Front Matter 配置 | ||
*/ | ||
frontmatter?: (localePath: string) => Record<string, unknown>; | ||
/** | ||
* Item page path pattern or custom function to be registered | ||
* | ||
* @description When filling in a string, `:key` and `:name` will be replaced by the "slugify" result of the original key and name | ||
* | ||
* 待注册的项目页面路径图案或自定义函数 | ||
* | ||
* @description 当填入字符串的时候, `:key` 和 `:name` 会被自动替换为原始的 key、name 的 slugify 结果。 | ||
* | ||
* @default `/:key/:name/` | ||
*/ | ||
itemPath?: string | ((name: string) => string) | false; | ||
/** | ||
* Item page layout name | ||
* | ||
* 项目页面布局组件名称 | ||
* | ||
* @default 'Layout' | ||
*/ | ||
itemLayout?: string; | ||
/** | ||
* Items Frontmatter | ||
* | ||
* 项目 Front Matter 配置 | ||
*/ | ||
itemFrontmatter?: (name: string, localePath: string) => Record<string, unknown>; | ||
} | ||
interface BlogTypeOptions { | ||
/** | ||
* Unique type name | ||
* | ||
* 唯一的类型名称 | ||
*/ | ||
key: string; | ||
/** | ||
* A filter function to determine whether a page should be the type | ||
* | ||
* 一个过滤函数来决定页面是否满足此类型 | ||
*/ | ||
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; | ||
/** | ||
* A custom function to sort the pages | ||
* | ||
* 页面排序器 | ||
*/ | ||
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; | ||
/** | ||
* Page path to be registered | ||
* | ||
* 待注册的页面路径 | ||
* | ||
* @default '/:key/' | ||
*/ | ||
path?: string | false; | ||
/** | ||
* Page layout name | ||
* | ||
* 页面布局组件名称 | ||
* | ||
* @default 'Layout' | ||
*/ | ||
layout?: string; | ||
/** | ||
* Frontmatter | ||
* | ||
* Front Matter 配置 | ||
*/ | ||
frontmatter?: (localePath: string) => Record<string, unknown>; | ||
} | ||
interface BlogOptions { | ||
/** | ||
* Function getting article info. | ||
* | ||
* 获取文章信息的函数。 | ||
*/ | ||
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>; | ||
/** | ||
* Page filter, determine whether a page should be included. | ||
* | ||
* 页面过滤器,此函数用于鉴别页面是否作为文章。 | ||
* | ||
* @default (page) => Boolean(page.filePathRelative) && !page.frontmatter.home | ||
*/ | ||
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; | ||
/** | ||
* Categories config | ||
*/ | ||
category?: BlogCategoryOptions[]; | ||
/** | ||
* Types config | ||
*/ | ||
type?: BlogTypeOptions[]; | ||
/** | ||
* Key used when injecting info to route meta. | ||
* | ||
* 注入文章信息至路由元数据时使用的键名。 | ||
* | ||
* @default '_blog' | ||
*/ | ||
metaScope?: string; | ||
/** | ||
* Slugify function | ||
* | ||
* Slugify 函数 | ||
* | ||
* @default (name) => name.replace(/ _/g, '-').toLowerCase() | ||
*/ | ||
slugify?: (name: string) => string; | ||
/** | ||
* Whether enable hotReload | ||
* | ||
* @description This may have performance impact in large sites | ||
* | ||
* 是否启用热更新 | ||
* | ||
* @description 在大型站点上,这可能会有性能影响 | ||
* | ||
* @default false | ||
*/ | ||
hotReload?: boolean; | ||
} | ||
interface Article<T extends Record<string, unknown> = Record<string, unknown>> { | ||
/** | ||
* Article path | ||
* | ||
* 文章路径 | ||
*/ | ||
path: string; | ||
/** | ||
* Article info | ||
* | ||
* 文章信息 | ||
*/ | ||
info: T; | ||
} | ||
interface BlogCategoryData<T extends Record<string, unknown> = Record<string, unknown>> { | ||
/** | ||
* Category path | ||
* | ||
* 分类路径 | ||
*/ | ||
path: string; | ||
/** | ||
* Only available when current route matches an item path | ||
* | ||
* 仅当当前路径和某个子项目匹配时可用 | ||
*/ | ||
currentItems?: Article<T>[]; | ||
/** | ||
* Category map | ||
* | ||
* 分类映射 | ||
*/ | ||
map: Record< | ||
/** | ||
* Unique key under current category | ||
* | ||
* 当前分类下全局唯一的 key | ||
*/ | ||
string, { | ||
/** | ||
* Category path of the key | ||
* | ||
* 对应键值的分类路径 | ||
*/ | ||
path: string; | ||
/** | ||
* Category items of the key | ||
* | ||
* 对应键值的项目 | ||
*/ | ||
items: Article<T>[]; | ||
}>; | ||
} | ||
interface BlogTypeData<T extends Record<string, unknown> = Record<string, unknown>> { | ||
/** | ||
* Type path | ||
* | ||
* 类别路径 | ||
*/ | ||
path: string; | ||
/** | ||
* Items under current type | ||
* | ||
* 当前类别下的项目 | ||
*/ | ||
items: Article<T>[]; | ||
} | ||
declare const blogPlugin: (options: BlogOptions) => PluginFunction; | ||
export { Article, ArticleMap, BlogCategoryData, BlogCategoryFrontmatterOptions, BlogCategoryOptions, BlogOptions, BlogPluginCategoryFrontmatter, BlogPluginFrontmatter, BlogPluginTypeFrontmatter, BlogTypeData, BlogTypeFrontmatterOptions, BlogTypeOptions, CategoryConfig, CategoryLocaleConfig, CategoryLocaleMap, CategoryMap, PageMap, TypeConfig, TypeMap, blogPlugin, blogPlugin as default }; |
{ | ||
"name": "vuepress-plugin-blog2", | ||
"version": "2.0.0-beta.73", | ||
"version": "2.0.0-beta.74", | ||
"description": "Blog plugin for VuePress", | ||
@@ -39,3 +39,3 @@ "keywords": [ | ||
"vue-router": "^4.0.15", | ||
"vuepress-shared": "2.0.0-beta.73" | ||
"vuepress-shared": "2.0.0-beta.74" | ||
}, | ||
@@ -42,0 +42,0 @@ "devDependencies": { |
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
1458
63178
25
+ Addedvuepress-shared@2.0.0-beta.74(transitive)
- Removedvuepress-shared@2.0.0-beta.73(transitive)