mirror of
https://github.com/pengzhanbo/vuepress-theme-plume.git
synced 2026-04-23 10:58:13 +08:00
perf: optimize package import
This commit is contained in:
parent
9f341b131e
commit
936b0b4851
@ -1,12 +0,0 @@
|
||||
import { defineClientConfig } from 'vuepress/client'
|
||||
import type { ClientConfig } from 'vuepress/client'
|
||||
import { Content } from './components/Content.js'
|
||||
|
||||
export default defineClientConfig({
|
||||
enhance({ app }) {
|
||||
if (app._context.components.Content)
|
||||
delete app._context.components.Content
|
||||
|
||||
app.component('Content', Content)
|
||||
},
|
||||
}) as ClientConfig
|
||||
@ -6,6 +6,6 @@ const __dirname = getDirname(import.meta.url)
|
||||
export function contentUpdatePlugin(): Plugin {
|
||||
return {
|
||||
name: '@vuepress-plume/plugin-content-update',
|
||||
clientConfigFile: path.resolve(__dirname, '../client/clientConfig.js'),
|
||||
clientConfigFile: path.resolve(__dirname, '../client/config.js'),
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ import { ClientOnly } from 'vuepress/client'
|
||||
import type { IconifyRenderMode } from '@iconify/vue'
|
||||
import type { StyleValue } from 'vue'
|
||||
import { computed, toRefs } from 'vue'
|
||||
import { useIconify } from '../composables/iconify.js'
|
||||
import { useIconify } from '../composables/index.js'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@ -31,13 +31,13 @@ const { name } = toRefs(props)
|
||||
const { icon, loaded } = useIconify(name)
|
||||
|
||||
const size = computed(() => {
|
||||
const size = props.size || __VUEPRESS_PLUGIN_ICONIFY_DEFAULT_SIZE__
|
||||
const size = props.size || __VP_ICONIFY_SIZE__
|
||||
if (String(Number(size)) === size)
|
||||
return `${size}px`
|
||||
|
||||
return size
|
||||
})
|
||||
const color = computed(() => props.color || __VUEPRESS_PLUGIN_ICONIFY_DEFAULT_COLOR__)
|
||||
const color = computed(() => props.color || __VP_ICONIFY_COLOR__)
|
||||
|
||||
const bind = computed<any>(() => ({
|
||||
icon: icon.value,
|
||||
@ -55,8 +55,8 @@ const bind = computed<any>(() => ({
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
declare const __VUEPRESS_PLUGIN_ICONIFY_DEFAULT_SIZE__: string
|
||||
declare const __VUEPRESS_PLUGIN_ICONIFY_DEFAULT_COLOR__: string
|
||||
declare const __VP_ICONIFY_SIZE__: string
|
||||
declare const __VP_ICONIFY_COLOR__: string
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
1
plugins/plugin-iconify/src/client/composables/index.ts
Normal file
1
plugins/plugin-iconify/src/client/composables/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './iconify.js'
|
||||
@ -2,10 +2,10 @@ import { defineClientConfig } from 'vuepress/client'
|
||||
import type { ClientConfig } from 'vuepress/client'
|
||||
import Iconify from './components/Iconify.vue'
|
||||
|
||||
declare const __VUEPRESS_PLUGIN_ICONIFY_COMPONENT_NAME__: string
|
||||
declare const __VP_ICONIFY_NAME__: string
|
||||
export default defineClientConfig({
|
||||
enhance({ app }) {
|
||||
const name = __VUEPRESS_PLUGIN_ICONIFY_COMPONENT_NAME__ || 'Iconify'
|
||||
const name = __VP_ICONIFY_NAME__ || 'Iconify'
|
||||
app.component(name, Iconify)
|
||||
},
|
||||
}) as ClientConfig
|
||||
@ -1,2 +0,0 @@
|
||||
export * from './composables/iconify.js'
|
||||
export * from '../shared/index.js'
|
||||
@ -1,6 +1,6 @@
|
||||
import { iconifyPlugin } from './plugin.js'
|
||||
|
||||
export * from './plugin.js'
|
||||
export * from '../shared/index.js'
|
||||
|
||||
/** @deprecated 请使用 具名导出 替代 默认导出 */
|
||||
export default iconifyPlugin
|
||||
|
||||
@ -1,24 +1,24 @@
|
||||
import type { Plugin } from 'vuepress/core'
|
||||
import { getDirname, path } from 'vuepress/utils'
|
||||
import type { IconifyOptions } from '../shared/index.js'
|
||||
|
||||
export interface IconifyPluginOptions {
|
||||
componentName?: string
|
||||
color?: string
|
||||
size?: string | number
|
||||
}
|
||||
|
||||
export function iconifyPlugin({
|
||||
componentName = 'Iconify',
|
||||
size = '1em',
|
||||
color = 'currentColor',
|
||||
}: IconifyOptions = {}): Plugin {
|
||||
return () => {
|
||||
return {
|
||||
name: '@vuepress-plume/plugin-iconify',
|
||||
define: {
|
||||
__VUEPRESS_PLUGIN_ICONIFY_COMPONENT_NAME__: componentName,
|
||||
__VUEPRESS_PLUGIN_ICONIFY_DEFAULT_SIZE__: size,
|
||||
__VUEPRESS_PLUGIN_ICONIFY_DEFAULT_COLOR__: color,
|
||||
},
|
||||
clientConfigFile: path.resolve(
|
||||
getDirname(import.meta.url),
|
||||
'../client/clientConfig.js',
|
||||
),
|
||||
}
|
||||
}: IconifyPluginOptions = {}): Plugin {
|
||||
return {
|
||||
name: '@vuepress-plume/plugin-iconify',
|
||||
define: {
|
||||
__VP_ICONIFY_NAME__: componentName,
|
||||
__VP_ICONIFY_SIZE__: size,
|
||||
__VP_ICONIFY_COLOR__: color,
|
||||
},
|
||||
clientConfigFile: path.resolve(getDirname(import.meta.url), '../client/config.js'),
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
export interface IconifyOptions {
|
||||
componentName?: string
|
||||
color?: string
|
||||
size?: string | number
|
||||
}
|
||||
@ -51,18 +51,11 @@ export async function prepareConfigFile(app: App, options: MarkdownPowerPluginOp
|
||||
enhances.add(`app.component('CodeRepl', CodeRepl)`)
|
||||
}
|
||||
|
||||
// enhances.add(`if (__VUEPRESS_SSR__) return`)
|
||||
|
||||
if (options.caniuse) {
|
||||
imports.add(`import CanIUse from '${CLIENT_FOLDER}components/CanIUse.vue'`)
|
||||
enhances.add(`app.component('CanIUseViewer', CanIUse)`)
|
||||
}
|
||||
|
||||
// if (options.caniuse) {
|
||||
// imports.add(`import { setupCanIUse } from '${CLIENT_FOLDER}composables/setupCanIUse.js'`)
|
||||
// enhances.add(`router.afterEach(() => setupCanIUse())`)
|
||||
// }
|
||||
|
||||
return app.writeTemp(
|
||||
'md-power/config.js',
|
||||
`\
|
||||
|
||||
@ -23,10 +23,9 @@ import {
|
||||
import Mark from 'mark.js/src/vanilla.js'
|
||||
import { useFocusTrap } from '@vueuse/integrations/useFocusTrap'
|
||||
import MiniSearch, { type SearchResult } from 'minisearch'
|
||||
import { useSearchIndex } from '../composables/index.js'
|
||||
import { useLocale, useSearchIndex } from '../composables/index.js'
|
||||
import type { SearchBoxLocales, SearchOptions } from '../../shared/index.js'
|
||||
import { LRUCache } from '../utils/lru.js'
|
||||
import { useLocale } from '../composables/locale.js'
|
||||
import { LRUCache } from '../utils/index.js'
|
||||
import SearchIcon from './icons/SearchIcon.vue'
|
||||
import ClearIcon from './icons/ClearIcon.vue'
|
||||
import BackIcon from './icons/BackIcon.vue'
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { toRef } from 'vue'
|
||||
import type { SearchBoxLocales } from '../../shared/index.js'
|
||||
import { useLocale } from '../composables/locale.js'
|
||||
import { useLocale } from '../composables/index.js'
|
||||
|
||||
const props = defineProps<{
|
||||
locales: SearchBoxLocales
|
||||
|
||||
@ -1 +1,2 @@
|
||||
export * from './searchIndex.js'
|
||||
export * from './locale.js'
|
||||
|
||||
1
plugins/plugin-search/src/client/utils/index.ts
Normal file
1
plugins/plugin-search/src/client/utils/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './lru.js'
|
||||
@ -7,7 +7,7 @@ import VPBlogTags from '@theme/Blog/VPBlogTags.vue'
|
||||
import VPBlogCategories from '@theme/Blog/VPBlogCategories.vue'
|
||||
import VPBlogNav from '@theme/Blog/VPBlogNav.vue'
|
||||
import VPTransitionFadeSlideY from '@theme/VPTransitionFadeSlideY.vue'
|
||||
import { useData } from '../../composables/data.js'
|
||||
import { useData } from '../../composables/index.js'
|
||||
|
||||
const { theme, page } = useData()
|
||||
</script>
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
<script lang="ts" setup>
|
||||
import VPShortPostList from '@theme/Blog/VPShortPostList.vue'
|
||||
import { useBlogNavTitle } from '../../composables/blog-extract.js'
|
||||
import { useArchives } from '../../composables/blog-archives.js'
|
||||
import { useArchives, useBlogNavTitle } from '../../composables/index.js'
|
||||
|
||||
const title = useBlogNavTitle('archive')
|
||||
const { archives } = useArchives()
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<script lang="ts" setup>
|
||||
import VPBlogNav from '@theme/Blog/VPBlogNav.vue'
|
||||
import VPBlogProfile from '@theme/Blog/VPBlogProfile.vue'
|
||||
import { useData } from '../../composables/data.js'
|
||||
import { useData } from '../../composables/index.js'
|
||||
|
||||
const { theme } = useData()
|
||||
</script>
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import VPCategories from '@theme/Blog/VPCategories.vue'
|
||||
import { useBlogCategory } from '../../composables/blog-category.js'
|
||||
import { useBlogNavTitle } from '../../composables/blog-extract.js'
|
||||
import { useBlogCategory, useBlogNavTitle } from '../../composables/index.js'
|
||||
|
||||
const title = useBlogNavTitle('category')
|
||||
const { categories } = useBlogCategory()
|
||||
|
||||
@ -4,8 +4,7 @@ import { computed, ref, watch } from 'vue'
|
||||
import { useRoute, withBase } from 'vuepress/client'
|
||||
import { isLinkHttp } from 'vuepress/shared'
|
||||
import VPLink from '@theme/VPLink.vue'
|
||||
import { useBlogExtract } from '../../composables/blog-extract.js'
|
||||
import { useData } from '../../composables/data.js'
|
||||
import { useBlogExtract, useData } from '../../composables/index.js'
|
||||
import { inBrowser } from '../../utils/index.js'
|
||||
|
||||
const { theme } = useData()
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { useRoute } from 'vuepress/client'
|
||||
import VPLink from '@theme/VPLink.vue'
|
||||
import { useBlogExtract } from '../../composables/blog-extract.js'
|
||||
import { useBlogExtract } from '../../composables/index.js'
|
||||
|
||||
const props = defineProps<{
|
||||
isLocal?: boolean
|
||||
|
||||
@ -3,7 +3,7 @@ import { computed } from 'vue'
|
||||
import { withBase } from 'vuepress/client'
|
||||
import { isLinkHttp } from 'vuepress/shared'
|
||||
import VPSocialLinks from '@theme/VPSocialLinks.vue'
|
||||
import { useData } from '../../composables/data.js'
|
||||
import { useData } from '../../composables/index.js'
|
||||
|
||||
const { theme } = useData()
|
||||
const profile = computed(() => theme.value.profile)
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
<script lang="ts" setup>
|
||||
import VPShortPostList from '@theme/Blog/VPShortPostList.vue'
|
||||
import { useBlogNavTitle } from '../../composables/blog-extract.js'
|
||||
import { useTags } from '../../composables/blog-tags.js'
|
||||
import { useBlogNavTitle, useTags } from '../../composables/index.js'
|
||||
|
||||
const { tags, currentTag, postList, handleTagClick } = useTags()
|
||||
const title = useBlogNavTitle('tag')
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<script lang="ts" setup>
|
||||
import VPLink from '@theme/VPLink.vue'
|
||||
import VPCategoriesGroup from '@theme/Blog/VPCategoriesGroup.vue'
|
||||
import type { BlogCategoryItem, BlogCategoryItemWithPost } from '../../composables/blog-category.js'
|
||||
import type { BlogCategoryItem, BlogCategoryItemWithPost } from '../../composables/index.js'
|
||||
|
||||
defineProps < {
|
||||
items: (BlogCategoryItem | BlogCategoryItemWithPost)[]
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
import { useRoute } from 'vuepress/client'
|
||||
import { onMounted, ref, watch } from 'vue'
|
||||
import VPCategories from '@theme/Blog/VPCategories.vue'
|
||||
import type { BlogCategoryItem } from '../../composables/blog-category.js'
|
||||
import type { BlogCategoryItem } from '../../composables/index.js'
|
||||
|
||||
const props = defineProps<{
|
||||
item: BlogCategoryItem
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { useData } from '../../composables/data.js'
|
||||
import { useData } from '../../composables/index.js'
|
||||
|
||||
defineProps<{
|
||||
page: number
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
import { computed } from 'vue'
|
||||
import VPLink from '@theme/VPLink.vue'
|
||||
import type { PlumeThemeBlogPostItem } from '../../../shared/index.js'
|
||||
import { useTagColors } from '../../composables/tag-colors.js'
|
||||
import { useTagColors } from '../../composables/index.js'
|
||||
|
||||
const props = defineProps<{
|
||||
post: PlumeThemeBlogPostItem
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
import VPTransitionDrop from '@theme/VPTransitionDrop.vue'
|
||||
import VPPostItem from '@theme/Blog/VPPostItem.vue'
|
||||
import VPPagination from '@theme/Blog/VPPagination.vue'
|
||||
import { usePostListControl } from '../../composables/blog-post-list.js'
|
||||
import { usePostListControl } from '../../composables/index.js'
|
||||
|
||||
const {
|
||||
postList,
|
||||
|
||||
@ -6,7 +6,7 @@ import VPHomeFeatures from '@theme/Home/VPHomeFeatures.vue'
|
||||
import VPHomeTextImage from '@theme/Home/VPHomeTextImage.vue'
|
||||
import VPHomeProfile from '@theme/Home/VPHomeProfile.vue'
|
||||
import VPHomeCustom from '@theme/Home/VPHomeCustom.vue'
|
||||
import { useData } from '../../composables/data.js'
|
||||
import { useData } from '../../composables/index.js'
|
||||
|
||||
const components: Record<string, Component<any, any, any>> = {
|
||||
'banner': VPHomeBanner,
|
||||
|
||||
@ -4,7 +4,7 @@ import { isLinkHttp } from 'vuepress/shared'
|
||||
import { computed } from 'vue'
|
||||
import VPButton from '@theme/VPButton.vue'
|
||||
import type { PlumeThemeHomeBanner } from '../../../shared/index.js'
|
||||
import { useData } from '../../composables/data.js'
|
||||
import { useData } from '../../composables/index.js'
|
||||
|
||||
const props = defineProps<PlumeThemeHomeBanner>()
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ import { withBase } from 'vuepress/client'
|
||||
import { computed, normalizeClass } from 'vue'
|
||||
import { isLinkHttp } from 'vuepress/shared'
|
||||
import type { PlumeHomeConfigBase } from '../../../shared/index.js'
|
||||
import { useDarkMode } from '../../composables/dark-mode.js'
|
||||
import { useDarkMode } from '../../composables/index.js'
|
||||
|
||||
const props = defineProps<PlumeHomeConfigBase & {
|
||||
containerClass?: any
|
||||
|
||||
@ -3,8 +3,7 @@ import { withBase } from 'vuepress/client'
|
||||
import { isLinkHttp } from 'vuepress/shared'
|
||||
import { computed, ref } from 'vue'
|
||||
import VPButton from '@theme/VPButton.vue'
|
||||
import { useData } from '../../composables/data.js'
|
||||
import { useHomeHeroTintPlate } from '../../composables/home.js'
|
||||
import { useData, useHomeHeroTintPlate } from '../../composables/index.js'
|
||||
import type { PlumeThemeHomeHero } from '../../../shared/index.js'
|
||||
|
||||
const props = defineProps<PlumeThemeHomeHero>()
|
||||
|
||||
@ -3,7 +3,7 @@ import { computed } from 'vue'
|
||||
import VPImage from '@theme/VPImage.vue'
|
||||
import VPHomeBox from '@theme/Home/VPHomeBox.vue'
|
||||
import type { PlumeThemeHomeProfile } from '../../../shared/index.js'
|
||||
import { useData } from '../../composables/data.js'
|
||||
import { useData } from '../../composables/index.js'
|
||||
|
||||
const props = defineProps<PlumeThemeHomeProfile>()
|
||||
|
||||
|
||||
@ -2,8 +2,7 @@
|
||||
import { computed, provide, watchEffect } from 'vue'
|
||||
import VPNavbar from '@theme/Nav/VPNavBar.vue'
|
||||
import VPNavScreen from '@theme/Nav/VPNavScreen.vue'
|
||||
import { useNav } from '../../composables/nav.js'
|
||||
import { useData } from '../../composables/data.js'
|
||||
import { useData, useNav } from '../../composables/index.js'
|
||||
import { inBrowser } from '../../utils/index.js'
|
||||
|
||||
const { page, frontmatter } = useData()
|
||||
|
||||
@ -9,8 +9,7 @@ import VPNavBarSearch from '@theme/Nav/VPNavBarSearch.vue'
|
||||
import VPNavBarSocialLinks from '@theme/Nav/VPNavBarSocialLinks.vue'
|
||||
import VPNavBarTitle from '@theme/Nav/VPNavBarTitle.vue'
|
||||
import VPNavBarTranslations from '@theme/Nav/VPNavBarTranslations.vue'
|
||||
import { useData } from '../../composables/data.js'
|
||||
import { useSidebar } from '../../composables/sidebar.js'
|
||||
import { useData, useSidebar } from '../../composables/index.js'
|
||||
|
||||
const props = defineProps<{
|
||||
isScreenOpen: boolean
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<script lang="ts" setup>
|
||||
import VPSwitchAppearance from '@theme/VPSwitchAppearance.vue'
|
||||
import { useData } from '../../composables/data.js'
|
||||
import { useData } from '../../composables/index.js'
|
||||
|
||||
const { theme } = useData()
|
||||
</script>
|
||||
|
||||
@ -4,8 +4,7 @@ import VPFlyout from '@theme/VPFlyout.vue'
|
||||
import VPMenuLink from '@theme/VPMenuLink.vue'
|
||||
import VPSocialLinks from '@theme/VPSocialLinks.vue'
|
||||
import VPSwitchAppearance from '@theme/VPSwitchAppearance.vue'
|
||||
import { useLangs } from '../../composables/langs.js'
|
||||
import { useData } from '../../composables/data.js'
|
||||
import { useData, useLangs } from '../../composables/index.js'
|
||||
|
||||
const { theme } = useData()
|
||||
const { localeLinks, currentLang } = useLangs()
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<script lang="ts" setup>
|
||||
import VPNavBarMenuGroup from '@theme/Nav/VPNavBarMenuGroup.vue'
|
||||
import VPNavBarMenuLink from '@theme/Nav/VPNavBarMenuLink.vue'
|
||||
import { useNavbarData } from '../../composables/nav.js'
|
||||
import { useNavbarData } from '../../composables/index.js'
|
||||
|
||||
const navbar = useNavbarData()
|
||||
</script>
|
||||
|
||||
@ -5,9 +5,9 @@ import VPFlyout from '@theme/VPFlyout.vue'
|
||||
import type {
|
||||
ResolvedNavItem,
|
||||
ResolvedNavItemWithChildren,
|
||||
} from '../../../shared/resolved/navbar.js'
|
||||
} from '../../../shared/index.js'
|
||||
import { isActive } from '../../utils/index.js'
|
||||
import { useData } from '../../composables/data.js'
|
||||
import { useData } from '../../composables/index.js'
|
||||
|
||||
const props = defineProps<{
|
||||
item: ResolvedNavItemWithChildren
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
import { resolveRouteFullPath } from 'vuepress/client'
|
||||
import VPLink from '@theme/VPLink.vue'
|
||||
import VPIcon from '@theme/VPIcon.vue'
|
||||
import type { ResolvedNavItemWithLink } from '../../../shared/resolved/navbar.js'
|
||||
import type { ResolvedNavItemWithLink } from '../../../shared/index.js'
|
||||
import { isActive } from '../../utils/index.js'
|
||||
import { useData } from '../../composables/data.js'
|
||||
import { useData } from '../../composables/index.js'
|
||||
|
||||
defineProps<{
|
||||
item: ResolvedNavItemWithLink
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue'
|
||||
import VPSocialLinks from '@theme/VPSocialLinks.vue'
|
||||
import { useData } from '../../composables/data.js'
|
||||
import { useData } from '../../composables/index.js'
|
||||
|
||||
const { theme } = useData()
|
||||
|
||||
|
||||
@ -2,8 +2,7 @@
|
||||
import { useRouteLocale } from 'vuepress/client'
|
||||
import VPLink from '@theme/VPLink.vue'
|
||||
import VPImage from '@theme/VPImage.vue'
|
||||
import { useSidebar } from '../../composables/sidebar.js'
|
||||
import { useData } from '../../composables/data.js'
|
||||
import { useData, useSidebar } from '../../composables/index.js'
|
||||
|
||||
const { theme, site } = useData()
|
||||
const { hasSidebar } = useSidebar()
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
<script lang="ts" setup>
|
||||
import VPFlyout from '@theme/VPFlyout.vue'
|
||||
import VPMenuLink from '@theme/VPMenuLink.vue'
|
||||
import { useLangs } from '../../composables/langs.js'
|
||||
import { useData } from '../../composables/data.js'
|
||||
import { useData, useLangs } from '../../composables/index.js'
|
||||
|
||||
const { theme } = useData()
|
||||
const { currentLang, localeLinks } = useLangs()
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<script lang="ts" setup>
|
||||
import VPSwitchAppearance from '@theme/VPSwitchAppearance.vue'
|
||||
import { useData } from '../../composables/data.js'
|
||||
import { useData } from '../../composables/index.js'
|
||||
|
||||
const { theme } = useData()
|
||||
</script>
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<script lang="ts" setup>
|
||||
import VPNavScreenMenuGroup from '@theme/Nav/VPNavScreenMenuGroup.vue'
|
||||
import VPNavScreenMenuLink from '@theme/Nav/VPNavScreenMenuLink.vue'
|
||||
import { useNavbarData } from '../../composables/nav.js'
|
||||
import { useNavbarData } from '../../composables/index.js'
|
||||
|
||||
const navbar = useNavbarData()
|
||||
</script>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
import { inject } from 'vue'
|
||||
import VPLink from '@theme/VPLink.vue'
|
||||
import VPIcon from '@theme/VPIcon.vue'
|
||||
import type { ResolvedNavItemWithLink } from '../../../shared/resolved/navbar.js'
|
||||
import type { ResolvedNavItemWithLink } from '../../../shared/index.js'
|
||||
|
||||
defineProps<{
|
||||
item: ResolvedNavItemWithLink
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
import { inject } from 'vue'
|
||||
import VPLink from '@theme/VPLink.vue'
|
||||
import VPIcon from '@theme/VPIcon.vue'
|
||||
import type { ResolvedNavItemWithLink } from '../../../shared/resolved/navbar.js'
|
||||
import type { ResolvedNavItemWithLink } from '../../../shared/index.js'
|
||||
|
||||
defineProps<{
|
||||
item: ResolvedNavItemWithLink
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<script lang="ts" setup>
|
||||
import VPSocialLinks from '@theme/VPSocialLinks.vue'
|
||||
import { useData } from '../../composables/data.js'
|
||||
import { useData } from '../../composables/index.js'
|
||||
|
||||
const { theme } = useData()
|
||||
</script>
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import VPLink from '@theme/VPLink.vue'
|
||||
import { useLangs } from '../../composables/langs.js'
|
||||
import { useLangs } from '../../composables/index.js'
|
||||
|
||||
const { localeLinks, currentLang } = useLangs()
|
||||
const isOpen = ref(false)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { useElementSize, useWindowScroll, useWindowSize } from '@vueuse/core'
|
||||
import { computed, onMounted, ref, shallowRef, watch } from 'vue'
|
||||
import { useData } from '../composables/data.js'
|
||||
import { useData } from '../composables/index.js'
|
||||
|
||||
const body = shallowRef<HTMLElement | null>()
|
||||
const { height: bodyHeight } = useElementSize(body)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, toRef } from 'vue'
|
||||
import { useRouter, withBase } from 'vuepress/client'
|
||||
import { useLink } from '../composables/link.js'
|
||||
import { useLink } from '../composables/index.js'
|
||||
|
||||
interface Props {
|
||||
tag?: string
|
||||
|
||||
@ -5,9 +5,8 @@ import VPDoc from '@theme/VPDoc.vue'
|
||||
import VPPage from '@theme/VPPage.vue'
|
||||
import VPHome from '@theme/Home/VPHome.vue'
|
||||
import VPFriends from '@theme/VPFriends.vue'
|
||||
import { useData, useSidebar } from '../composables/index.js'
|
||||
import { useBlogPageData, useData, useSidebar } from '../composables/index.js'
|
||||
import { inBrowser } from '../utils/index.js'
|
||||
import { useBlogPageData } from '../composables/page.js'
|
||||
|
||||
const props = defineProps<{
|
||||
isNotFound?: boolean
|
||||
|
||||
@ -6,11 +6,13 @@ import VPDocAside from '@theme/VPDocAside.vue'
|
||||
import VPDocFooter from '@theme/VPDocFooter.vue'
|
||||
import VPEncryptPage from '@theme/VPEncryptPage.vue'
|
||||
import VPDocMeta from '@theme/VPDocMeta.vue'
|
||||
import { useEncrypt } from '../composables/encrypt.js'
|
||||
import { useSidebar } from '../composables/sidebar.js'
|
||||
import { useData } from '../composables/data.js'
|
||||
import { useHeaders } from '../composables/outline.js'
|
||||
import { useBlogPageData } from '../composables/page.js'
|
||||
import {
|
||||
useBlogPageData,
|
||||
useData,
|
||||
useEncrypt,
|
||||
useHeaders,
|
||||
useSidebar,
|
||||
} from '../composables/index.js'
|
||||
|
||||
const { page, theme, frontmatter, isDark } = useData()
|
||||
const route = useRoute()
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref } from 'vue'
|
||||
import VPDocOutlineItem from '@theme/VPDocOutlineItem.vue'
|
||||
import { useActiveAnchor, useHeaders } from '../composables/outline.js'
|
||||
import { useData } from '../composables/data.js'
|
||||
import { useActiveAnchor, useData, useHeaders } from '../composables/index.js'
|
||||
|
||||
const { theme } = useData()
|
||||
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue'
|
||||
import VPLink from '@theme/VPLink.vue'
|
||||
import { useContributors } from '../composables/contributors.js'
|
||||
import { useEditLink } from '../composables/edit-link.js'
|
||||
import { useLastUpdated } from '../composables/latest-updated.js'
|
||||
import { usePrevNext } from '../composables/prev-next.js'
|
||||
import { useData } from '../composables/data.js'
|
||||
import {
|
||||
useContributors,
|
||||
useData,
|
||||
useEditLink,
|
||||
useLastUpdated,
|
||||
usePrevNext,
|
||||
} from '../composables/index.js'
|
||||
|
||||
const { theme, frontmatter } = useData()
|
||||
const editLink = useEditLink()
|
||||
|
||||
@ -2,10 +2,12 @@
|
||||
import { computed } from 'vue'
|
||||
import { useReadingTimeLocale } from '@vuepress/plugin-reading-time/client'
|
||||
import VPLink from '@theme/VPLink.vue'
|
||||
import { useData } from '../composables/data.js'
|
||||
import { useTagColors } from '../composables/tag-colors.js'
|
||||
import { useBlogPageData } from '../composables/page.js'
|
||||
import { useBlogExtract } from '../composables/blog-extract.js'
|
||||
import {
|
||||
useBlogExtract,
|
||||
useBlogPageData,
|
||||
useData,
|
||||
useTagColors,
|
||||
} from '../composables/index.js'
|
||||
|
||||
const { page, frontmatter: matter } = useData<'post'>()
|
||||
const { isBlogPost } = useBlogPageData()
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import type { MenuItem } from '../composables/outline.js'
|
||||
import type { MenuItem } from '../composables/index.js'
|
||||
|
||||
defineProps<{
|
||||
headers: MenuItem[]
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { useData } from '../composables/data.js'
|
||||
import { useEncryptCompare } from '../composables/encrypt.js'
|
||||
import { useData, useEncryptCompare } from '../composables/index.js'
|
||||
|
||||
const props = defineProps<{
|
||||
global?: boolean
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
import { computed } from 'vue'
|
||||
import VPFooter from '@theme/VPFooter.vue'
|
||||
import VPEncryptForm from '@theme/VPEncryptForm.vue'
|
||||
import { useData } from '../composables/data.js'
|
||||
import { useData } from '../composables/index.js'
|
||||
|
||||
const { theme, site } = useData()
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import VPEncryptForm from '@theme/VPEncryptForm.vue'
|
||||
import { useData } from '../composables/data.js'
|
||||
import { useData } from '../composables/index.js'
|
||||
|
||||
const { theme } = useData()
|
||||
</script>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
import { ref } from 'vue'
|
||||
import VPIcon from '@theme/VPIcon.vue'
|
||||
import VPMenu from '@theme/VPMenu.vue'
|
||||
import { useFlyout } from '../composables/flyout.js'
|
||||
import { useFlyout } from '../composables/index.js'
|
||||
|
||||
defineProps<{
|
||||
prefixIcon?: string | { svg: string }
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { useCssVar } from '@vueuse/core'
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { useData } from '../composables/data.js'
|
||||
import { useSidebar } from '../composables/sidebar.js'
|
||||
import { useData, useSidebar } from '../composables/index.js'
|
||||
import { inBrowser } from '../utils/index.js'
|
||||
|
||||
const { theme } = useData()
|
||||
|
||||
@ -3,8 +3,7 @@ import { computed } from 'vue'
|
||||
import VPLink from '@theme/VPLink.vue'
|
||||
import VPFriendsItem from '@theme/VPFriendsItem.vue'
|
||||
import VPFriendsGroup from '@theme/VPFriendsGroup.vue'
|
||||
import { useEditLink } from '../composables/edit-link.js'
|
||||
import { useData } from '../composables/data.js'
|
||||
import { useData, useEditLink } from '../composables/index.js'
|
||||
|
||||
const editLink = useEditLink()
|
||||
const { frontmatter: matter } = useData<'friends'>()
|
||||
|
||||
@ -3,7 +3,7 @@ import { isPlainObject } from '@vuepress/helper/client'
|
||||
import { computed } from 'vue'
|
||||
import VPLink from '@theme/VPLink.vue'
|
||||
import type { FriendsItem } from '../../shared/index'
|
||||
import { useDarkMode } from '../composables/dark-mode.js'
|
||||
import { useDarkMode } from '../composables/index.js'
|
||||
import VPSocialLinks from './VPSocialLinks.vue'
|
||||
|
||||
const props = defineProps<{
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed, toRef } from 'vue'
|
||||
import { useRouter, withBase } from 'vuepress/client'
|
||||
import { useLink } from '../composables/link.js'
|
||||
import { useLink } from '../composables/index.js'
|
||||
|
||||
const props = defineProps<{
|
||||
tag?: string
|
||||
|
||||
@ -2,10 +2,7 @@
|
||||
import { useWindowScroll } from '@vueuse/core'
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import VPLocalNavOutlineDropdown from '@theme/VPLocalNavOutlineDropdown.vue'
|
||||
import { useSidebar } from '../composables/sidebar.js'
|
||||
import { useHeaders } from '../composables/outline.js'
|
||||
import { useData } from '../composables/data.js'
|
||||
import { useBlogPageData } from '../composables/page.js'
|
||||
import { useBlogPageData, useData, useHeaders, useSidebar } from '../composables/index.js'
|
||||
|
||||
const props = defineProps<{
|
||||
open: boolean
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
import { onClickOutside } from '@vueuse/core'
|
||||
import { nextTick, ref, watch } from 'vue'
|
||||
import VPDocOutlineItem from '@theme/VPDocOutlineItem.vue'
|
||||
import type { MenuItem } from '../composables/outline.js'
|
||||
import { useData } from '../composables/data.js'
|
||||
import type { MenuItem } from '../composables/index.js'
|
||||
import { useData } from '../composables/index.js'
|
||||
|
||||
const props = defineProps<{
|
||||
headers: MenuItem[]
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
import VPLink from '@theme/VPLink.vue'
|
||||
import VPIcon from '@theme/VPIcon.vue'
|
||||
import { resolveRouteFullPath } from 'vuepress/client'
|
||||
import { useData } from '../composables/data.js'
|
||||
import { useData } from '../composables/index.js'
|
||||
import { isActive } from '../utils/index.js'
|
||||
|
||||
defineProps<{
|
||||
|
||||
@ -4,7 +4,7 @@ import { onMounted, ref, watch } from 'vue'
|
||||
import { useRoutePath } from 'vuepress/client'
|
||||
import VPSidebarGroup from '@theme/VPSidebarGroup.vue'
|
||||
import VPTransitionFadeSlideY from '@theme/VPTransitionFadeSlideY.vue'
|
||||
import { useSidebar } from '../composables/sidebar.js'
|
||||
import { useSidebar } from '../composables/index.js'
|
||||
import { inBrowser } from '../utils/index.js'
|
||||
|
||||
const props = defineProps<{
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { onBeforeUnmount, onMounted, ref } from 'vue'
|
||||
import type { ResolvedSidebarItem } from '../../shared/resolved/sidebar.js'
|
||||
import VPSidebarItem from './VPSidebarItem.vue'
|
||||
import VPSidebarItem from '@theme/VPSidebarItem.vue'
|
||||
import type { ResolvedSidebarItem } from '../../shared/index.js'
|
||||
|
||||
defineProps<{
|
||||
items: ResolvedSidebarItem[]
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
import { computed } from 'vue'
|
||||
import VPLink from '@theme/VPLink.vue'
|
||||
import VPIcon from '@theme/VPIcon.vue'
|
||||
import { useSidebarControl } from '../composables/sidebar.js'
|
||||
import type { ResolvedSidebarItem } from '../../shared/resolved/sidebar.js'
|
||||
import { useSidebarControl } from '../composables/index.js'
|
||||
import type { ResolvedSidebarItem } from '../../shared/index.js'
|
||||
|
||||
const props = defineProps<{
|
||||
item: ResolvedSidebarItem
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { inject, ref, watchPostEffect } from 'vue'
|
||||
import VPSwitch from '@theme/VPSwitch.vue'
|
||||
import { useData } from '../composables/data.js'
|
||||
import { useData } from '../composables/index.js'
|
||||
|
||||
const checked = ref(false)
|
||||
const { theme, isDark } = useData()
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { useData } from '../composables/data.js'
|
||||
import { useData } from '../composables/index.js'
|
||||
|
||||
interface Props {
|
||||
delay?: number
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue'
|
||||
import { useScrollPromise } from '../composables/scroll-promise.js'
|
||||
import { useData } from '../composables/data.js'
|
||||
import { useData, useScrollPromise } from '../composables/index.js'
|
||||
|
||||
const { theme } = useData()
|
||||
const { resolve: onBeforeEnter, pending: onBeforeLeave } = useScrollPromise()
|
||||
|
||||
@ -1,9 +1,13 @@
|
||||
export * from './theme-data.js'
|
||||
export * from './dark-mode.js'
|
||||
export * from './data.js'
|
||||
|
||||
export * from './scroll-promise.js'
|
||||
export * from './scroll-behavior.js'
|
||||
|
||||
export * from './langs.js'
|
||||
export * from './flyout.js'
|
||||
export * from './nav.js'
|
||||
export * from './sidebar.js'
|
||||
export * from './aside.js'
|
||||
export * from './outline.js'
|
||||
@ -13,6 +17,8 @@ export * from './edit-link.js'
|
||||
export * from './latest-updated.js'
|
||||
export * from './contributors.js'
|
||||
|
||||
export * from './home.js'
|
||||
|
||||
export * from './blog-data.js'
|
||||
export * from './blog-post-list.js'
|
||||
export * from './blog-extract.js'
|
||||
@ -28,4 +34,5 @@ export * from './encrypt.js'
|
||||
export * from './link.js'
|
||||
export * from './locale.js'
|
||||
export * from './route-query.js'
|
||||
|
||||
export * from './watermark.js'
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { usePageLang } from 'vuepress/client'
|
||||
import { computed, onMounted, ref, watchEffect } from 'vue'
|
||||
import { useData } from '../composables/data.js'
|
||||
import { useData } from './data.js'
|
||||
|
||||
export function useLastUpdated() {
|
||||
const { theme, page, frontmatter } = useData()
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
import type { Ref } from 'vue'
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { useRoute } from 'vuepress/client'
|
||||
import type { NavItem } from '../../shared/index.js'
|
||||
import type {
|
||||
NavItem,
|
||||
ResolvedNavItem,
|
||||
ResolvedNavItemWithLink,
|
||||
} from '../../shared/resolved/navbar.js'
|
||||
} from '../../shared/index.js'
|
||||
|
||||
import { normalizeLink, resolveNavLink } from '../utils/index.js'
|
||||
import { useData } from './data.js'
|
||||
|
||||
|
||||
@ -20,8 +20,7 @@ import {
|
||||
} from 'vue'
|
||||
import { sidebar as sidebarRaw } from '@internal/sidebar'
|
||||
import { isActive, normalizeLink, normalizePrefix, resolveNavLink } from '../utils/index.js'
|
||||
import type { Sidebar, SidebarItem } from '../../shared/index.js'
|
||||
import type { ResolvedSidebarItem } from '../../shared/resolved/sidebar.js'
|
||||
import type { ResolvedSidebarItem, Sidebar, SidebarItem } from '../../shared/index.js'
|
||||
import { useData } from './data.js'
|
||||
import { useEncrypt } from './encrypt.js'
|
||||
|
||||
|
||||
@ -10,9 +10,7 @@ import VPSkipLink from '@theme/VPSkipLink.vue'
|
||||
import VPFooter from '@theme/VPFooter.vue'
|
||||
import VPBackToTop from '@theme/VPBackToTop.vue'
|
||||
import VPEncryptGlobal from '@theme/VPEncryptGlobal.vue'
|
||||
import { useCloseSidebarOnEscape, useSidebar } from '../composables/sidebar.js'
|
||||
import { useEncrypt } from '../composables/encrypt.js'
|
||||
import { useData } from '../composables/data.js'
|
||||
import { useCloseSidebarOnEscape, useData, useEncrypt, useSidebar } from '../composables/index.js'
|
||||
|
||||
const {
|
||||
isOpen: isSidebarOpen,
|
||||
|
||||
@ -3,7 +3,7 @@ import { useRouteLocale, withBase } from 'vuepress/client'
|
||||
import VPNav from '@theme/Nav/VPNav.vue'
|
||||
import VPSkipLink from '@theme/VPSkipLink.vue'
|
||||
import VPFooter from '@theme/VPFooter.vue'
|
||||
import { useData } from '../composables/data.js'
|
||||
import { useData } from '../composables/index.js'
|
||||
|
||||
const root = useRouteLocale()
|
||||
const { theme } = useData()
|
||||
|
||||
@ -3,3 +3,4 @@ export * from './dom.js'
|
||||
export * from './resolveEditLink.js'
|
||||
export * from './resolveRepoType.js'
|
||||
export * from './resolveNavLink.js'
|
||||
export * from './animate.js'
|
||||
|
||||
@ -5,7 +5,7 @@ import {
|
||||
isLinkAbsolute,
|
||||
isLinkWithProtocol,
|
||||
} from '@vuepress/helper/client'
|
||||
import type { ResolvedNavItemWithLink } from '../../shared/resolved/navbar.js'
|
||||
import type { ResolvedNavItemWithLink } from '../../shared/index.js'
|
||||
|
||||
/**
|
||||
* Resolve NavLink props from string
|
||||
|
||||
@ -10,8 +10,8 @@ import type {
|
||||
AutoFrontmatterArray,
|
||||
AutoFrontmatterMarkdownFile,
|
||||
AutoFrontmatterObject,
|
||||
} from '../../shared/auto-frontmatter.js'
|
||||
import type { PlumeThemeLocaleOptions } from '../../shared/index.js'
|
||||
PlumeThemeLocaleOptions,
|
||||
} from '../../shared/index.js'
|
||||
import { readMarkdown, readMarkdownList } from './readFile.js'
|
||||
import { resolveOptions } from './resolveOptions.js'
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { fs, path } from 'vuepress/utils'
|
||||
import fg from 'fast-glob'
|
||||
import type { AutoFrontmatterMarkdownFile } from '../../shared/auto-frontmatter.js'
|
||||
import type { AutoFrontmatterMarkdownFile } from '../../shared/index.js'
|
||||
|
||||
export async function readMarkdownList(
|
||||
sourceDir: string,
|
||||
|
||||
@ -1,9 +1,4 @@
|
||||
import type {
|
||||
NoteItem,
|
||||
NotesOptions,
|
||||
} from '../shared/notes.js'
|
||||
import type { NavItem } from '../shared/index.js'
|
||||
import type { ThemeConfig } from '../shared/theme-data.js'
|
||||
import type { NavItem, NoteItem, NotesOptions, ThemeConfig } from '../shared/index.js'
|
||||
|
||||
export function definePlumeNotesConfig(notes: NotesOptions): NotesOptions {
|
||||
return notes
|
||||
|
||||
@ -4,7 +4,7 @@ import process from 'node:process'
|
||||
import { pathToFileURL } from 'node:url'
|
||||
import { build } from 'esbuild'
|
||||
import { importFileDefault } from 'vuepress/utils'
|
||||
import type { ThemeConfig } from '../../shared/theme-data.js'
|
||||
import type { ThemeConfig } from '../../shared/index.js'
|
||||
import { hash } from '../utils/index.js'
|
||||
|
||||
export async function compiler(configPath?: string,
|
||||
|
||||
@ -3,8 +3,7 @@ import type { FSWatcher } from 'chokidar'
|
||||
import { path } from 'vuepress/utils'
|
||||
import { watch } from 'chokidar'
|
||||
import { deepMerge } from '@pengzhanbo/utils'
|
||||
import type { ThemeConfig } from '../../shared/theme-data.js'
|
||||
import type { AutoFrontmatter, PlumeThemeEncrypt, PlumeThemeLocaleOptions } from '../../shared/index.js'
|
||||
import type { AutoFrontmatter, PlumeThemeEncrypt, PlumeThemeLocaleOptions, ThemeConfig } from '../../shared/index.js'
|
||||
import { resolveLocaleOptions } from '../config/resolveLocaleOptions.js'
|
||||
import { findConfigPath } from './findConfigPath.js'
|
||||
import { compiler } from './compiler.js'
|
||||
|
||||
@ -4,7 +4,6 @@ import { docsearchPlugin } from '@vuepress/plugin-docsearch'
|
||||
import { gitPlugin } from '@vuepress/plugin-git'
|
||||
import { photoSwipePlugin } from '@vuepress/plugin-photo-swipe'
|
||||
import { nprogressPlugin } from '@vuepress/plugin-nprogress'
|
||||
import { baiduTongjiPlugin } from '@vuepress-plume/plugin-baidu-tongji'
|
||||
import { iconifyPlugin } from '@vuepress-plume/plugin-iconify'
|
||||
import { shikiPlugin } from '@vuepress-plume/plugin-shikiji'
|
||||
import { commentPlugin } from '@vuepress/plugin-comment'
|
||||
@ -149,10 +148,6 @@ export function getPlugins({
|
||||
plugins.push(commentPlugin(pluginOptions.comment))
|
||||
}
|
||||
|
||||
if (pluginOptions.baiduTongji !== false && pluginOptions.baiduTongji?.key && isProd) {
|
||||
plugins.push(baiduTongjiPlugin(pluginOptions.baiduTongji))
|
||||
}
|
||||
|
||||
if (pluginOptions.sitemap !== false && hostname && isProd) {
|
||||
plugins.push(sitemapPlugin({ hostname }))
|
||||
}
|
||||
|
||||
@ -8,12 +8,12 @@ import {
|
||||
import type {
|
||||
PlumeThemeLocaleOptions,
|
||||
PlumeThemePageData,
|
||||
ResolvedSidebarItem,
|
||||
Sidebar,
|
||||
SidebarItem,
|
||||
ThemeIcon,
|
||||
} from '../../shared/index.js'
|
||||
import { normalizeLink, resolveContent, writeTemp } from '../utils/index.js'
|
||||
import type { ResolvedSidebarItem } from '../../shared/resolved/sidebar.js'
|
||||
|
||||
export async function prepareSidebar(app: App, localeOptions: PlumeThemeLocaleOptions) {
|
||||
const sidebar = getAllSidebar(localeOptions)
|
||||
|
||||
@ -71,11 +71,12 @@ export function plumeTheme(options: PlumeThemeOptions = {}): Theme {
|
||||
await setupPage(app, localeOptions)
|
||||
},
|
||||
|
||||
onPrepared: (app) => {
|
||||
onPrepared: async (app) => {
|
||||
onConfigChange(({ localeOptions }) => {
|
||||
prepareThemeData(app, localeOptions)
|
||||
prepareData(app)
|
||||
})
|
||||
await waitForConfigLoaded()
|
||||
},
|
||||
|
||||
onWatched: (app, watchers) => {
|
||||
|
||||
@ -3,7 +3,7 @@ import { ensureEndingSlash, ensureLeadingSlash, isLinkAbsolute, isLinkWithProtoc
|
||||
|
||||
const __dirname = getDirname(import.meta.url)
|
||||
|
||||
export const resolve = (...args: string[]) => path.resolve(__dirname, '../../', ...args)
|
||||
export const resolve = (...args: string[]) => path.resolve(__dirname, '../', ...args)
|
||||
export const templates = (url: string) => resolve('../templates', url)
|
||||
|
||||
const RE_SLASH = /(\\|\/)+/g
|
||||
|
||||
@ -3,8 +3,9 @@ export * from './frontmatter/index.js'
|
||||
export * from './options/index.js'
|
||||
export * from './page-data.js'
|
||||
export * from './blog.js'
|
||||
export * from './sidebar.js'
|
||||
export * from './navbar.js'
|
||||
export * from './notes.js'
|
||||
export * from './auto-frontmatter.js'
|
||||
export * from './theme-data.js'
|
||||
export * from './sidebar.js'
|
||||
export * from './navbar.js'
|
||||
export * from './resolved/index.js'
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import type { DocsearchOptions } from '@vuepress/plugin-docsearch'
|
||||
import type { SearchPluginOptions } from '@vuepress-plume/plugin-search'
|
||||
import type { BaiduTongjiOptions } from '@vuepress-plume/plugin-baidu-tongji'
|
||||
import type { ShikiPluginOptions } from '@vuepress-plume/plugin-shikiji'
|
||||
import type { CommentPluginOptions } from '@vuepress/plugin-comment'
|
||||
import type { MarkdownEnhancePluginOptions } from 'vuepress-plugin-md-enhance'
|
||||
@ -57,7 +56,11 @@ export interface PlumeThemePluginOptions {
|
||||
|
||||
seo?: false
|
||||
|
||||
baiduTongji?: false | BaiduTongjiOptions
|
||||
/**
|
||||
* @deprecated
|
||||
* 请使用 [@vuepress/plugin-baidu-analytics](https://ecosystem.vuejs.press/zh/plugins/analytics/baidu-analytics.html) 代替
|
||||
*/
|
||||
baiduTongji?: never
|
||||
|
||||
/**
|
||||
* @deprecated 使用 `autoFrontmatter` 代替
|
||||
|
||||
2
theme/src/shared/resolved/index.ts
Normal file
2
theme/src/shared/resolved/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './navbar.js'
|
||||
export * from './sidebar.js'
|
||||
Loading…
x
Reference in New Issue
Block a user