UNPKG

vite-plugin-react-server

Version:
39 lines 1.27 kB
import type { RegExpOpt } from "../types.js"; /** * Resolves a pattern with values, handling string, RegExp, and function inputs. * For strings, it interpolates values and creates a new RegExp. * For RegExp objects, it returns them as-is without interpolation. * For functions, it returns them as-is. * * @example * ```ts * // String patterns with interpolation * const jsMatcher = resolvePatternWithValues( * "*.{ext}", * "*.js", * { ext: "js" } * ); * jsMatcher("file.js") // true * jsMatcher("file.ts") // false * * // RegExp patterns (no interpolation) * const regexMatcher = resolvePatternWithValues( * /\.js$/, * "*.js", * { ext: "js" } * ); * regexMatcher("file.js") // true * regexMatcher("file.ts") // false * * // Complex patterns * const moduleMatcher = resolvePatternWithValues( * "*.{ext}", * "*.{js,ts,jsx,tsx}", * { ext: "js|ts|jsx|tsx" } * ); * moduleMatcher("file.tsx") // true * moduleMatcher("file.css") // false * ``` */ export declare function resolvePatternWithValues(pattern?: RegExpOpt, defaultPattern?: RegExpOpt | ((path: string) => boolean), values?: Record<string, string>): (path: string, moduleId?: string) => boolean; //# sourceMappingURL=resolvePatternWithValues.d.ts.map