chore: tweak
This commit is contained in:
parent
cc3582c1f9
commit
6d0781b647
@ -1,5 +1,5 @@
|
||||
import type { IconOptions } from '../../shared/index.js'
|
||||
import { notNullish, toArray, uniqueBy } from '@pengzhanbo/utils'
|
||||
import { notNullish, toArray, uniqWith } from '@pengzhanbo/utils'
|
||||
import { isLinkAbsolute } from '@vuepress/helper'
|
||||
import { isLinkHttp } from 'vuepress/shared'
|
||||
import { logger } from '../utils/logger.js'
|
||||
@ -44,7 +44,7 @@ export function prepareIcon(
|
||||
let hasStyle = false
|
||||
let hasScript = false
|
||||
|
||||
for (const asset of uniqueBy(assets, (a, b) => a.link === b.link)) {
|
||||
for (const asset of uniqWith(assets, (a, b) => a.link === b.link)) {
|
||||
if (asset.type === 'style') {
|
||||
hasStyle = true
|
||||
setupContent.push(`useStyleTag('@import url("${asset.link}");')`)
|
||||
|
||||
@ -56,7 +56,7 @@ function createMatchRegex(match: string) {
|
||||
return regex
|
||||
}
|
||||
|
||||
function toMatch(match: string, pagePath: string, filePathRelative: string | null) {
|
||||
function toMatch(match: string, pagePath: string, filePathRelative?: string | null) {
|
||||
const relativePath = filePathRelative || ''
|
||||
if (match[0] === '^') {
|
||||
const regex = createMatchRegex(match)
|
||||
|
||||
@ -10,6 +10,7 @@ import type {
|
||||
ThemeSidebarMulti,
|
||||
TransitionOptions,
|
||||
} from './features/index.js'
|
||||
import type { LiteralUnion } from './utils.js'
|
||||
|
||||
/**
|
||||
* 内置的多语言配置
|
||||
@ -60,7 +61,7 @@ export interface ThemeLocale extends LocaleData {
|
||||
* 允许显示在导航栏的社交类型
|
||||
* @default ['github', 'twitter', 'discord', 'facebook']
|
||||
*/
|
||||
navbarSocialInclude?: (SocialLinkIconUnion | (string & { zz_IGNORE_ME?: never }))[]
|
||||
navbarSocialInclude?: LiteralUnion<SocialLinkIconUnion>[]
|
||||
|
||||
/**
|
||||
* 笔记配置, 笔记中的文章默认不会出现在首页文章列表
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import type { Prettify } from '@pengzhanbo/utils'
|
||||
import type { CommentPluginOptions } from '@vuepress/plugin-comment'
|
||||
import type { CopyCodePluginOptions } from '@vuepress/plugin-copy-code'
|
||||
import type { ChangelogOptions, ContributorsOptions } from '@vuepress/plugin-git'
|
||||
@ -85,7 +86,7 @@ export interface ThemeFeatureOptions {
|
||||
/**
|
||||
* 贡献者配置
|
||||
*/
|
||||
contributors?: boolean | ContributorsOptions & { mode?: 'inline' | 'block' }
|
||||
contributors?: boolean | Prettify<ContributorsOptions & { mode?: 'inline' | 'block' }>
|
||||
|
||||
/**
|
||||
* 页面变更记录配置
|
||||
@ -120,7 +121,7 @@ export interface ThemeFeatureOptions {
|
||||
/**
|
||||
* 水印配置
|
||||
*/
|
||||
watermark?: boolean | (WatermarkPluginOptions & { fullPage?: boolean })
|
||||
watermark?: boolean | Prettify<WatermarkPluginOptions & { fullPage?: boolean }>
|
||||
|
||||
/**
|
||||
* 阅读时间、字数统计
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import type { Nullable } from '@pengzhanbo/utils'
|
||||
import type { GitPluginPageData } from '@vuepress/plugin-git'
|
||||
import type { ReadingTime } from '@vuepress/plugin-reading-time'
|
||||
import type { PostsCategoryItem } from './features/index.js'
|
||||
@ -15,7 +16,7 @@ export interface ThemePageData extends GitPluginPageData {
|
||||
/**
|
||||
* 相对于根目录的文件路径
|
||||
*/
|
||||
filePathRelative: string | null
|
||||
filePathRelative: Nullable<string>
|
||||
/**
|
||||
* 阅读时间
|
||||
*/
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import type { Prettify } from '@pengzhanbo/utils'
|
||||
import type { SearchPluginOptions } from '@vuepress-plume/plugin-search'
|
||||
import type { CachePluginOptions } from '@vuepress/plugin-cache'
|
||||
import type { CommentPluginOptions } from '@vuepress/plugin-comment'
|
||||
@ -105,12 +106,12 @@ export interface ThemeBuiltinPlugins {
|
||||
/**
|
||||
* 生成站点地图
|
||||
*/
|
||||
sitemap?: false | Omit<SitemapPluginOptions, 'hostname'> & { hostname?: string }
|
||||
sitemap?: false | Prettify<Omit<SitemapPluginOptions, 'hostname'> & { hostname?: string }>
|
||||
|
||||
/**
|
||||
* SEO
|
||||
*/
|
||||
seo?: false | Omit<SeoPluginOptions, 'hostname'> & { hostname?: string }
|
||||
seo?: false | Prettify<Omit<SeoPluginOptions, 'hostname'> & { hostname?: string }>
|
||||
|
||||
/**
|
||||
* 缓存
|
||||
@ -125,7 +126,7 @@ export interface ThemeBuiltinPlugins {
|
||||
/**
|
||||
* 是否开启 水印
|
||||
*/
|
||||
watermark?: boolean | (WatermarkPluginOptions & { fullPage?: boolean })
|
||||
watermark?: boolean | Prettify<WatermarkPluginOptions & { fullPage?: boolean }>
|
||||
|
||||
/**
|
||||
* 资源链接替换
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user