pull/4808/head
Divyansh Singh 3 months ago
parent 067d89083b
commit bc04d6ee23

@ -6,7 +6,7 @@ import type { SiteConfig } from './config'
import { createMarkdownRenderer } from './markdown/markdown'
import type { LoaderModule } from './plugins/staticDataPlugin'
import type { Awaitable } from './shared'
import { glob, normalizeWatchPatterns, type GlobOptions } from './utils/glob'
import { glob, normalizeGlob, type GlobOptions } from './utils/glob'
export interface ContentOptions<T = ContentData[]> {
/**
@ -87,7 +87,7 @@ export function createContentLoader<T = ContentData[]>(
const cache = new Map<string, { data: any; timestamp: number }>()
watch = normalizeWatchPatterns(watch, config.srcDir)
watch = normalizeGlob(watch, config.srcDir)
return {
watch,

@ -11,7 +11,7 @@ import {
} from 'vite'
import type { Awaitable } from '../shared'
import { type SiteConfig, type UserConfig } from '../siteConfig'
import { glob, normalizeWatchPatterns, type GlobOptions } from '../utils/glob'
import { glob, normalizeGlob, type GlobOptions } from '../utils/glob'
import { ModuleGraph } from '../utils/moduleGraph'
import { resolveRewrites } from './rewritesPlugin'
@ -282,10 +282,7 @@ async function resolveDynamicRoutes(
}
const loaderModule = mod.config as RouteModule
watch = normalizeWatchPatterns(
loaderModule.watch,
path.dirname(pathsFile)
)
watch = normalizeGlob(loaderModule.watch, path.dirname(pathsFile))
loader = loaderModule.paths
transformPageData = loaderModule.transformPageData
options = loaderModule.options || {}

@ -8,7 +8,7 @@ import {
type ViteDevServer
} from 'vite'
import type { Awaitable } from '../shared'
import { glob, normalizeWatchPatterns, type GlobOptions } from '../utils/glob'
import { glob, normalizeGlob, type GlobOptions } from '../utils/glob'
const loaderMatch = /\.data\.m?(j|t)s($|\?)/
@ -91,7 +91,7 @@ export const staticDataPlugin: Plugin = {
}
const loaderModule = res?.config as LoaderModule
watch = normalizeWatchPatterns(loaderModule.watch, base)
watch = normalizeGlob(loaderModule.watch, base)
load = loaderModule.load
options = loaderModule.options || {}
}

@ -9,7 +9,7 @@ export interface GlobOptions {
debug?: boolean
}
export function normalizeWatchPatterns(
export function normalizeGlob(
patterns: string[] | string | undefined,
base: string
): string[] {

Loading…
Cancel
Save