fix(theme): internal deps
This commit is contained in:
parent
46f6277dfb
commit
728a6868e6
@ -4,7 +4,7 @@ export interface BaiduTongjiOptions {
|
||||
key?: string
|
||||
}
|
||||
|
||||
export const baiduTongjiPlugin = ({ key }: BaiduTongjiOptions): Plugin => {
|
||||
export const baiduTongjiPlugin = ({ key = '' }: BaiduTongjiOptions): Plugin => {
|
||||
return {
|
||||
name: '@vuepress-plume/vuepress-plugin-baidu-tongji',
|
||||
extendsPage: (page) => {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { postIndex as postIndexRaw } from '@internal/postIndex.js'
|
||||
import { postIndex as postIndexRaw } from '@internal/postIndex'
|
||||
import { ref } from 'vue'
|
||||
import type { Ref } from 'vue'
|
||||
import type { PostIndex } from '../../shared/index.js'
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { sidebarIndex as sidebarIndexRaw } from '@internal/sidebarIndex.js'
|
||||
import { sidebarIndex as sidebarIndexRaw } from '@internal/sidebarIndex'
|
||||
import { usePageFrontmatter } from '@vuepress/client'
|
||||
import { computed, ref } from 'vue'
|
||||
import type { ComputedRef, Ref } from 'vue'
|
||||
|
||||
4
packages/theme/src/client/shim.d.ts
vendored
4
packages/theme/src/client/shim.d.ts
vendored
@ -8,13 +8,13 @@ declare const __VUEPRESS_DEV__: boolean
|
||||
declare const __VUEPRESS_SSR__: boolean
|
||||
declare const __VUE_HMR_RUNTIME__: Record<string, unknown>
|
||||
|
||||
declare module '@internal/postIndex.js' {
|
||||
declare module '@internal/postIndex' {
|
||||
import type { PostIndex } from '../shared'
|
||||
const postIndex: PostIndex
|
||||
export { postIndex }
|
||||
}
|
||||
|
||||
declare module '@internal/sidebarIndex.js' {
|
||||
declare module '@internal/sidebarIndex' {
|
||||
import type { SidebarOptions } from '../shared'
|
||||
const sidebarIndex: Record<string, SidebarOptions>
|
||||
export { sidebarIndex }
|
||||
|
||||
@ -3,12 +3,12 @@ import type { PlumeThemeLocaleOptions } from '../../shared/index.js'
|
||||
import { preparedPostIndex, watchPostIndex } from './postIndex.js'
|
||||
import { preparedSidebarIndex, watchSidebarIndex } from './sidebarIndex.js'
|
||||
|
||||
export const onPrepared = (
|
||||
export const onPrepared = async (
|
||||
app: App,
|
||||
localeOption: PlumeThemeLocaleOptions
|
||||
): void => {
|
||||
preparedPostIndex(app, localeOption)
|
||||
preparedSidebarIndex(app, localeOption)
|
||||
): Promise<void> => {
|
||||
await preparedPostIndex(app, localeOption)
|
||||
await preparedSidebarIndex(app, localeOption)
|
||||
}
|
||||
|
||||
export const preparedWatch = (
|
||||
|
||||
@ -24,10 +24,10 @@ if (import.meta.hot) {
|
||||
}
|
||||
`
|
||||
|
||||
export const preparedPostIndex = (
|
||||
export const preparedPostIndex = async (
|
||||
app: App,
|
||||
localeOption: PlumeThemeLocaleOptions
|
||||
): void => {
|
||||
): Promise<void> => {
|
||||
const postIndex: PostIndex = (app.pages as Page<PlumeThemePageData>[])
|
||||
.filter((page) => {
|
||||
return (
|
||||
@ -68,7 +68,7 @@ export const postIndex = ${JSON.stringify(postIndex, null, 2)}
|
||||
content += HMR_CODE
|
||||
}
|
||||
|
||||
app.writeTemp('internal/postIndex.js', content)
|
||||
await app.writeTemp('internal/postIndex.js', content)
|
||||
}
|
||||
|
||||
export const watchPostIndex = (
|
||||
|
||||
@ -32,10 +32,10 @@ interface NotePage {
|
||||
link: string
|
||||
}
|
||||
|
||||
export const preparedSidebarIndex = (
|
||||
export const preparedSidebarIndex = async (
|
||||
app: App,
|
||||
{ notes }: PlumeThemeLocaleOptions
|
||||
): void => {
|
||||
): Promise<void> => {
|
||||
const pages = app.pages as Page<PlumeThemePageData>[]
|
||||
if (notes === false) return
|
||||
const {
|
||||
@ -71,7 +71,7 @@ export const sidebarIndex = ${JSON.stringify(sidebarMap, null, 2)}
|
||||
content += HMR_CODE
|
||||
}
|
||||
|
||||
app.writeTemp('internal/sidebarIndex.js', content)
|
||||
await app.writeTemp('internal/sidebarIndex.js', content)
|
||||
}
|
||||
|
||||
function noteSidebar(
|
||||
|
||||
@ -30,7 +30,7 @@ export const themePlume = ({
|
||||
formatFrontmatter()
|
||||
await createPage(app, localeOption)
|
||||
},
|
||||
onPrepared: (app) => onPrepared(app, localeOption),
|
||||
onPrepared: async (app) => await onPrepared(app, localeOption),
|
||||
extendsPage: (page: Page<Partial<PlumeThemePageData>>) =>
|
||||
extendsPage(page, localeOption),
|
||||
onWatched: (app, watchers) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user