vite-plugin-react-server
Version:
Vite plugin for React Server Components (RSC)
25 lines • 814 B
TypeScript
/**
* Converts a user-friendly pattern string to a RegExp.
* Supports:
* - Simple patterns like "*.js" -> /\.js$/
* - Basic wildcards like "*.{js,ts}" -> /\.(js|ts)$/
* - Escaped characters with backslash
* - Optional flags at the end like "*.js/i" -> /\.js$/i
*
* @example
* ```ts
* // File extensions
* parsePattern("*.js").test("file.js") // true
* parsePattern("*.{js,ts}").test("file.ts") // true
*
* // Directory patterns
* parsePattern("src/*.js").test("src/file.js") // true
* parsePattern("src/*.js").test("file.js") // false
*
* // Case sensitivity
* parsePattern("*.js").test("file.JS") // false
* parsePattern("*.js/i").test("file.JS") // true
* ```
*/
export declare function parsePattern(pattern: string): RegExp;
//# sourceMappingURL=parsePattern.d.ts.map