@ -1,3 +1,4 @@
import { exactRegex } from '@rolldown/pluginutils'
import path from 'node:path'
import c from 'picocolors'
import {
@ -166,11 +167,12 @@ export async function createVitePressPlugin(
: baseConfig
} ,
resolveId ( id , importer , resolveOptions ) {
resolveId : {
filter : { id : [ exactRegex ( SITE_DATA_ID ) , startsWithThemeRE ] } ,
handler ( id , importer , resolveOptions ) {
if ( id === SITE_DATA_ID ) {
return SITE_DATA_REQUEST_PATH
}
if ( startsWithThemeRE . test ( id ) ) {
return this . resolve (
siteConfig . themeDir + id . slice ( 6 ) ,
importer ,
@ -179,8 +181,9 @@ export async function createVitePressPlugin(
}
} ,
load ( id ) {
if ( id === SITE_DATA_REQUEST_PATH ) {
load : {
filter : { id : exactRegex ( SITE_DATA_REQUEST_PATH ) } ,
handler() {
let data = siteData
// head info is not needed by the client in production build
if ( config . command === 'build' ) {
@ -196,8 +199,9 @@ export async function createVitePressPlugin(
}
} ,
// TODO: use plugin hook filters
async transform ( code , id ) {
transform : {
filter : { id : [ docsearchRE , /\.vue$/ , /\.md$/ ] } ,
async handler ( code , id ) {
if ( docsearchRE . test ( normalizePath ( id ) ) ) {
return code
. replaceAll ( '[data-theme=dark]' , '.dark' )
@ -239,6 +243,7 @@ export async function createVitePressPlugin(
}
return processClientJS ( vueSrc , id )
}
}
} ,
renderStart() {