diff --git a/src/node/contentLoader.ts b/src/node/contentLoader.ts index 443f1a50..2756abf9 100644 --- a/src/node/contentLoader.ts +++ b/src/node/contentLoader.ts @@ -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 { /** @@ -87,7 +87,7 @@ export function createContentLoader( const cache = new Map() - watch = normalizeWatchPatterns(watch, config.srcDir) + watch = normalizeGlob(watch, config.srcDir) return { watch, diff --git a/src/node/plugins/dynamicRoutesPlugin.ts b/src/node/plugins/dynamicRoutesPlugin.ts index 64341a5d..70294e1d 100644 --- a/src/node/plugins/dynamicRoutesPlugin.ts +++ b/src/node/plugins/dynamicRoutesPlugin.ts @@ -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 || {} diff --git a/src/node/plugins/staticDataPlugin.ts b/src/node/plugins/staticDataPlugin.ts index 10c37d23..05065c27 100644 --- a/src/node/plugins/staticDataPlugin.ts +++ b/src/node/plugins/staticDataPlugin.ts @@ -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 || {} } diff --git a/src/node/utils/glob.ts b/src/node/utils/glob.ts index eaad49fd..f329d343 100644 --- a/src/node/utils/glob.ts +++ b/src/node/utils/glob.ts @@ -9,7 +9,7 @@ export interface GlobOptions { debug?: boolean } -export function normalizeWatchPatterns( +export function normalizeGlob( patterns: string[] | string | undefined, base: string ): string[] {