UNPKG

vite-plugin-react-server

Version:
29 lines 1.36 kB
import type { RegExpOpt } from "../types.js"; /** * Resolves a pattern to a RegExp object, handling various input types: * - RegExp objects (including deserialized ones) * - String patterns (glob patterns like "*.js", "*.{js,ts}") * - Default patterns * * This function is the main entry point for converting user-friendly patterns * into RegExp objects that can be used for matching filenames and paths. * * @example * ```ts * // String patterns (glob patterns) - these get converted to regex * resolveRegExp("*.js") // /.*\.js$/ (matches any .js file) * resolveRegExp("*.{js,ts}") // /.*\.(js|ts)$/ (matches .js or .ts files) * resolveRegExp("src/*.js") // /^src\/.*\.js$/ (matches .js files in src/ directory) * resolveRegExp("*.js/i") // /.*\.js$/i (case-insensitive matching) * * // RegExp patterns - these are used as-is * resolveRegExp(/\.js$/) // /\.js$/ (same regex object) * resolveRegExp(/\.js$/i) // /\.js$/i (same regex object with flags) * * // Default patterns - used when no pattern is provided * resolveRegExp(undefined, "*.js") // /.*\.js$/ (uses default) * resolveRegExp(undefined, /\.js$/) // /\.js$/ (uses default) * ``` */ export declare function resolveRegExp(pattern?: RegExpOpt, defaultPattern?: RegExpOpt): RegExp; //# sourceMappingURL=resolveRegExp.d.ts.map