chore: tweak

This commit is contained in:
pengzhanbo 2026-04-18 17:09:26 +08:00
parent 035d521e96
commit e2b47da532

View File

@ -3,7 +3,7 @@ import type { SearchPluginOptions } from '../shared/index.js'
import { addViteOptimizeDepsInclude, getFullLocaleConfig } from '@vuepress/helper' import { addViteOptimizeDepsInclude, getFullLocaleConfig } from '@vuepress/helper'
import { getDirname, path } from 'vuepress/utils' import { getDirname, path } from 'vuepress/utils'
import { SEARCH_LOCALES } from './locales/index.js' import { SEARCH_LOCALES } from './locales/index.js'
import { onSearchIndexRemoved, onSearchIndexUpdated, prepareSearchIndex, prepareSearchIndexPlaceholder } from './prepareSearchIndex.js' import { /* onSearchIndexRemoved, onSearchIndexUpdated, */ prepareSearchIndex, prepareSearchIndexPlaceholder } from './prepareSearchIndex.js'
const __dirname = getDirname(import.meta.url) const __dirname = getDirname(import.meta.url)
@ -71,16 +71,16 @@ export function searchPlugin({
} }
}, },
onPageUpdated: async (app, type, page) => { // onPageUpdated: async (app, type, page) => {
if (!page?.filePathRelative) // if (!page?.filePathRelative)
return // return
if (type === 'create' || type === 'update') { // if (type === 'create' || type === 'update') {
await onSearchIndexUpdated(app, { page, isSearchable, searchOptions }) // await onSearchIndexUpdated(app, { page, isSearchable, searchOptions })
} // }
else if (type === 'delete') { // else if (type === 'delete') {
await onSearchIndexRemoved(app, { page, isSearchable, searchOptions }) // await onSearchIndexRemoved(app, { page, isSearchable, searchOptions })
} // }
}, // },
}) })
} }