chore: tweak

This commit is contained in:
pengzhanbo 2026-01-09 15:32:49 +08:00
parent cc3582c1f9
commit 6d0781b647
6 changed files with 14 additions and 10 deletions

View File

@ -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}");')`)

View File

@ -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)

View File

@ -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>[]
/**
*

View File

@ -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 }>
/**
*

View File

@ -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>
/**
*
*/

View File

@ -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 }>
/**
*