vuepress-shared
Version:
Shared files for vuepress2
168 lines (159 loc) • 3.87 kB
TypeScript
import { GitPluginPageData } from '@vuepress/plugin-git';
import { Page } from 'vuepress/core';
import { PageFrontmatter } from 'vuepress/shared';
interface DeprecatedLoggerOptions {
options: Record<string, unknown>;
old: string;
new: string;
msg?: string;
scope?: string;
}
interface DroppedLoggerOptions {
options: Record<string, unknown>;
old: string;
new?: string;
msg?: string;
scope?: string;
}
interface Converter {
deprecatedLogger: (options: DeprecatedLoggerOptions) => void;
droppedLogger: (options: DroppedLoggerOptions) => void;
}
declare const createConverter: (name: string) => Converter;
declare const getDateString: (date: Date) => string;
declare const getTimeString: (date: Date) => string;
declare const getFullDateString: (date: Date) => string;
interface DateOptions {
/**
* @default "en"
*/
lang?: string;
/**
* Timezone
*/
timezone?: string;
/**
* @default "full"
*/
type?: "date" | "time" | "full";
}
declare const timeTransformer: (date: string | Date | undefined, options?: DateOptions) => string | null;
declare const injectLocalizedDate: (page: Page<{
localizedDate?: string | null;
} & Partial<GitPluginPageData>>) => void;
declare const getDirContents: (dir: string, base?: string) => string[];
declare const getTitleFromFilename: (filename: string) => string;
type AuthorName = string;
interface AuthorInfo {
/**
* Author name
*
* 作者姓名
*/
name: string;
/**
* Author website
*
* 作者网站
*/
url?: string;
/**
* Author email
*
* 作者 Email
*/
email?: string;
}
type Author = AuthorName | AuthorName[] | AuthorInfo | AuthorInfo[];
interface BasePageFrontMatter extends PageFrontmatter {
/**
* Page icon
*
* 页面图标
*/
icon?: string;
/**
* Page Author(s)
*
* 页面作者
*/
author?: Author | false;
/**
* Writing Date
*
* 写作日期
*/
date?: Date | string;
/**
* Page Category(ies)
*
* 页面分类
*/
category?: string | string[];
categories?: string[];
/**
* Page Tag(s)
*
* 页面标签
*/
tag?: string[] | string;
tags?: string[];
/**
* Whether the content is original
*
* 是否原创
*/
isOriginal?: boolean;
/**
* Whether the page is an article
*
* 页面是否是文章
*/
article?: boolean;
/**
* Page Cover
*
* 页面封面
*/
cover?: string;
/**
* Page Banner
*
* 页面 Banner 图
*/
banner?: string;
/**
* Footer text
*
* 页脚文字
*/
footer?: string | boolean;
/**
* License text
*
* 协议文字
*/
license?: string;
/**
* Copyright text
*
* 版权文字
*/
copyright?: string | false;
/**
* Whether is home page
*
* 是否是主页
*/
home?: boolean;
/**
* @deprecated use `date` instead
*/
time?: Date | string;
}
declare const getAuthor: (author: Author | false | undefined, canDisable?: boolean) => AuthorInfo[];
declare const getStringArray: (value: string[] | string | undefined, optionName: string) => string[];
declare const getCategory: (category: string[] | string | undefined) => string[];
declare const getTag: (tag: string[] | string | undefined) => string[];
export { createConverter, getAuthor, getCategory, getDateString, getDirContents, getFullDateString, getStringArray, getTag, getTimeString, getTitleFromFilename, injectLocalizedDate, timeTransformer };
export type { Author, AuthorInfo, AuthorName, BasePageFrontMatter, Converter, DateOptions, DeprecatedLoggerOptions, DroppedLoggerOptions };