diff --git a/docs/.vuepress/theme.ts b/docs/.vuepress/theme.ts index 1a7e0e52..aea313f1 100644 --- a/docs/.vuepress/theme.ts +++ b/docs/.vuepress/theme.ts @@ -71,5 +71,5 @@ export const theme: Theme = plumeTheme({ }, }, - plugins: { git: true }, + // plugins: { git: true }, }) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d0023ba6..91603034 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -301,8 +301,8 @@ catalogs: specifier: 2.0.0-rc.86 version: 2.0.0-rc.86 '@vuepress/plugin-git': - specifier: 2.0.0-rc.79 - version: 2.0.0-rc.79 + specifier: 2.0.0-rc.87 + version: 2.0.0-rc.87 '@vuepress/plugin-markdown-hint': specifier: 2.0.0-rc.86 version: 2.0.0-rc.86 @@ -705,7 +705,7 @@ importers: version: 2.0.0-rc.86(@algolia/client-search@5.18.0)(search-insights@2.17.3)(typescript@5.8.2)(vuepress@2.0.0-rc.20(@vuepress/bundler-vite@2.0.0-rc.20(@types/node@22.13.11)(jiti@2.4.2)(less@4.2.2)(sass-embedded@1.86.0)(sass@1.86.0)(stylus@0.64.0)(typescript@5.8.2)(yaml@2.7.0))(typescript@5.8.2)(vue@3.5.13(typescript@5.8.2))) '@vuepress/plugin-git': specifier: catalog:vuepress - version: 2.0.0-rc.79(vuepress@2.0.0-rc.20(@vuepress/bundler-vite@2.0.0-rc.20(@types/node@22.13.11)(jiti@2.4.2)(less@4.2.2)(sass-embedded@1.86.0)(sass@1.86.0)(stylus@0.64.0)(typescript@5.8.2)(yaml@2.7.0))(typescript@5.8.2)(vue@3.5.13(typescript@5.8.2))) + version: 2.0.0-rc.87(typescript@5.8.2)(vuepress@2.0.0-rc.20(@vuepress/bundler-vite@2.0.0-rc.20(@types/node@22.13.11)(jiti@2.4.2)(less@4.2.2)(sass-embedded@1.86.0)(sass@1.86.0)(stylus@0.64.0)(typescript@5.8.2)(yaml@2.7.0))(typescript@5.8.2)(vue@3.5.13(typescript@5.8.2))) '@vuepress/plugin-markdown-hint': specifier: catalog:vuepress version: 2.0.0-rc.86(markdown-it@14.1.0)(typescript@5.8.2)(vue@3.5.13(typescript@5.8.2))(vuepress@2.0.0-rc.20(@vuepress/bundler-vite@2.0.0-rc.20(@types/node@22.13.11)(jiti@2.4.2)(less@4.2.2)(sass-embedded@1.86.0)(sass@1.86.0)(stylus@0.64.0)(typescript@5.8.2)(yaml@2.7.0))(typescript@5.8.2)(vue@3.5.13(typescript@5.8.2))) @@ -2559,8 +2559,8 @@ packages: peerDependencies: vuepress: 2.0.0-rc.20 - '@vuepress/plugin-git@2.0.0-rc.79': - resolution: {integrity: sha512-f3S3VieD0+K2V5feSbs85rzMXm4Pwk7ieP4UnAEDGfEXKTsPDJIuf5mLrbxL+9dwfopylO6A2rugtUqESQ2VKQ==} + '@vuepress/plugin-git@2.0.0-rc.87': + resolution: {integrity: sha512-kiZJyiLl2tkt3i/iuhc/g9FlnWKr1Yylj+iNf5gZYMwnO8rGnIdLFVw8a8mqqAc3587RYao6upvL/Kd75hKVfA==} peerDependencies: vuepress: 2.0.0-rc.20 @@ -8735,10 +8735,15 @@ snapshots: - search-insights - typescript - '@vuepress/plugin-git@2.0.0-rc.79(vuepress@2.0.0-rc.20(@vuepress/bundler-vite@2.0.0-rc.20(@types/node@22.13.11)(jiti@2.4.2)(less@4.2.2)(sass-embedded@1.86.0)(sass@1.86.0)(stylus@0.64.0)(typescript@5.8.2)(yaml@2.7.0))(typescript@5.8.2)(vue@3.5.13(typescript@5.8.2)))': + '@vuepress/plugin-git@2.0.0-rc.87(typescript@5.8.2)(vuepress@2.0.0-rc.20(@vuepress/bundler-vite@2.0.0-rc.20(@types/node@22.13.11)(jiti@2.4.2)(less@4.2.2)(sass-embedded@1.86.0)(sass@1.86.0)(stylus@0.64.0)(typescript@5.8.2)(yaml@2.7.0))(typescript@5.8.2)(vue@3.5.13(typescript@5.8.2)))': dependencies: + '@vuepress/helper': 2.0.0-rc.86(typescript@5.8.2)(vuepress@2.0.0-rc.20(@vuepress/bundler-vite@2.0.0-rc.20(@types/node@22.13.11)(jiti@2.4.2)(less@4.2.2)(sass-embedded@1.86.0)(sass@1.86.0)(stylus@0.64.0)(typescript@5.8.2)(yaml@2.7.0))(typescript@5.8.2)(vue@3.5.13(typescript@5.8.2))) + '@vueuse/core': 13.0.0(vue@3.5.13(typescript@5.8.2)) execa: 9.5.2 + vue: 3.5.13(typescript@5.8.2) vuepress: 2.0.0-rc.20(@vuepress/bundler-vite@2.0.0-rc.20(@types/node@22.13.11)(jiti@2.4.2)(less@4.2.2)(sass-embedded@1.86.0)(sass@1.86.0)(stylus@0.64.0)(typescript@5.8.2)(yaml@2.7.0))(typescript@5.8.2)(vue@3.5.13(typescript@5.8.2)) + transitivePeerDependencies: + - typescript '@vuepress/plugin-markdown-hint@2.0.0-rc.86(markdown-it@14.1.0)(typescript@5.8.2)(vue@3.5.13(typescript@5.8.2))(vuepress@2.0.0-rc.20(@vuepress/bundler-vite@2.0.0-rc.20(@types/node@22.13.11)(jiti@2.4.2)(less@4.2.2)(sass-embedded@1.86.0)(sass@1.86.0)(stylus@0.64.0)(typescript@5.8.2)(yaml@2.7.0))(typescript@5.8.2)(vue@3.5.13(typescript@5.8.2)))': dependencies: diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index f31c6e49..a02051fb 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -118,7 +118,7 @@ catalogs: '@vuepress/plugin-comment': 2.0.0-rc.86 '@vuepress/plugin-copy-code': 2.0.0-rc.86 '@vuepress/plugin-docsearch': 2.0.0-rc.86 - '@vuepress/plugin-git': 2.0.0-rc.79 + '@vuepress/plugin-git': 2.0.0-rc.87 '@vuepress/plugin-markdown-hint': 2.0.0-rc.86 '@vuepress/plugin-markdown-image': 2.0.0-rc.86 '@vuepress/plugin-markdown-include': 2.0.0-rc.86 diff --git a/theme/src/client/components/VPDoc.vue b/theme/src/client/components/VPDoc.vue index 54b44224..4f8082ea 100644 --- a/theme/src/client/components/VPDoc.vue +++ b/theme/src/client/components/VPDoc.vue @@ -1,8 +1,6 @@ - - - - diff --git a/theme/src/client/components/VPDocContributor.vue b/theme/src/client/components/VPDocContributor.vue deleted file mode 100644 index 016300a8..00000000 --- a/theme/src/client/components/VPDocContributor.vue +++ /dev/null @@ -1,59 +0,0 @@ - - - - - diff --git a/theme/src/client/composables/contributors.ts b/theme/src/client/composables/contributors.ts index 000fc781..e6c7b8ae 100644 --- a/theme/src/client/composables/contributors.ts +++ b/theme/src/client/composables/contributors.ts @@ -1,5 +1,6 @@ import type { ComputedRef } from 'vue' import type { GitContributor } from '../../shared/index.js' +import { useContributors as _useContributors } from '@vuepress/plugin-git/client' import { computed } from 'vue' import { isPlainObject } from 'vuepress/shared' import { useData } from '../composables/data.js' @@ -8,8 +9,11 @@ import { useThemeData } from './theme-data.js' export function useContributors(): { mode: ComputedRef<'inline' | 'block'> contributors: ComputedRef + hasContributors: ComputedRef } { - const { page, frontmatter } = useData() + const { frontmatter } = useData() + const list = _useContributors() + const theme = useThemeData() const mode = computed(() => { @@ -25,8 +29,10 @@ export function useContributors(): { if (config === false) return [] - return (page.value.git?.contributors ?? []) + return list.value }) - return { mode, contributors } + const hasContributors = computed(() => contributors.value.length > 0) + + return { mode, contributors, hasContributors } } diff --git a/theme/src/client/globalComponents.ts b/theme/src/client/globalComponents.ts index 4543b422..08fbe254 100644 --- a/theme/src/client/globalComponents.ts +++ b/theme/src/client/globalComponents.ts @@ -44,4 +44,18 @@ export function globalComponents(app: App) { } return null }) + + app.component('DocGitContributors', () => { + if (hasGlobalComponent('GitContributors')) { + return h(resolveComponent('GitContributors')) + } + return null + }) + + app.component('DocGitChangelog', () => { + if (hasGlobalComponent('GitChangelog')) { + return h(resolveComponent('GitChangelog')) + } + return null + }) } diff --git a/theme/src/client/styles/compat.css b/theme/src/client/styles/compat.css index cb6f4b67..2522adeb 100644 --- a/theme/src/client/styles/compat.css +++ b/theme/src/client/styles/compat.css @@ -16,3 +16,19 @@ .vp-comment { margin-top: 80px; } + +/* ------------------ Plugin Git ------------------ */ +.vp-doc #doc-contributors, +.vp-doc #doc-changelog { + border-top: 1px solid var(--vp-c-divider); +} + +.vp-doc .vp-changelog-wrapper { + background-color: var(--vp-c-default-soft); +} + +.vp-doc .vp-changelog-wrapper .vp-changelog-list { + padding-left: 0; + margin-block: 8px; + list-style: none; +} diff --git a/theme/src/node/config/extendsBundlerOptions.ts b/theme/src/node/config/extendsBundlerOptions.ts index 804a82e4..924d87b5 100644 --- a/theme/src/node/config/extendsBundlerOptions.ts +++ b/theme/src/node/config/extendsBundlerOptions.ts @@ -18,7 +18,7 @@ export function extendsBundlerOptions(bundlerOptions: any, app: App): void { addViteOptimizeDepsInclude( bundlerOptions, app, - ['@vueuse/core', 'bcrypt-ts/browser', '@vuepress/helper/client', '@iconify/vue', '@iconify/vue/offline'], + ['@vueuse/core', 'bcrypt-ts/browser', '@vuepress/helper/client', '@iconify/vue', '@iconify/vue/offline', '@vuepress/plugin-git/client'], ) addViteOptimizeDepsExclude(bundlerOptions, app, '@theme') diff --git a/theme/src/node/plugins/setupPlugins.ts b/theme/src/node/plugins/setupPlugins.ts index b848908a..e6efd4ab 100644 --- a/theme/src/node/plugins/setupPlugins.ts +++ b/theme/src/node/plugins/setupPlugins.ts @@ -114,9 +114,9 @@ export function setupPlugins( ...options.contributors === true ? {} : options.contributors, } : false, - changelog: options.changelog && (options.docsRepo || changelogOptions.repoUrl) + changelog: options.changelog && options.docsRepo ? { repoUrl: options.docsRepo, ...changelogOptions } - : false, + : options.changelog, filter(page) { if (page.frontmatter.home || excludes.includes(page.frontmatter.pageLayout as string)) return false diff --git a/theme/src/shared/index.ts b/theme/src/shared/index.ts index 61b88880..8676545d 100644 --- a/theme/src/shared/index.ts +++ b/theme/src/shared/index.ts @@ -8,4 +8,8 @@ export type * from './pageData.js' export type * from './plugins.js' export type * from './resolved/index.js' export type * from './utils.js' -export type { GitChangelog, GitContributor } from '@vuepress/plugin-git' + +export type { + GitChangelogInfo as GitChangelog, + GitContributorInfo as GitContributor, +} from '@vuepress/plugin-git'