UNPKG

@mcpc-tech/ripgrep-napi

Version:

Fast text search library powered by Rust ripgrep, providing Node.js bindings via NAPI-RS

103 lines (96 loc) 3.27 kB
/* auto-generated by NAPI-RS */ /* eslint-disable */ /** * Get a list of commonly supported file extensions * * # Returns * Vector of file type names and extensions */ export declare function getSupportedFileTypes(): Array<string> /** * Search for text patterns in multiple files and directories * * # Arguments * * `pattern` - Regular expression pattern to search for * * `paths` - List of file paths or directories to search in * * `options` - Optional search configuration settings * * # Returns * SearchResult containing all matches and search statistics */ export declare function search(pattern: string, paths: Array<string>, options?: SearchOptions | undefined | null): SearchResult /** * Search for text patterns in a single file * * # Arguments * * `pattern` - Regular expression pattern to search for * * `file_path` - Path to the file to search in * * `options` - Optional search configuration settings * * # Returns * SearchResult containing all matches found in the file */ export declare function searchFile(pattern: string, filePath: string, options?: SearchOptions | undefined | null): SearchResult /** Represents a single match found during text search */ export interface SearchMatch { /** File path where the match was found */ path: string /** Line number (1-based) where the match occurred */ lineNumber: number /** Complete line content containing the match */ line: string /** Start position of the match within the line */ start?: number /** End position of the match within the line */ end?: number } /** Configuration options for text search operations */ export interface SearchOptions { /** Enable case-sensitive matching (default: true) */ caseSensitive?: boolean /** Enable multiline mode for regex patterns */ multiline?: boolean /** Match whole words only using word boundaries */ wordRegexp?: boolean /** Maximum directory depth to search */ maxDepth?: number /** Include hidden files and directories in search */ hidden?: boolean /** Follow symbolic links during traversal */ followLinks?: boolean /** Patterns to ignore during search */ ignorePatterns?: Array<string> /** Include line numbers in results (default: true) */ lineNumber?: boolean /** Return only file names with matches, not match details */ filesWithMatches?: boolean /** Invert match to show non-matching lines */ invertMatch?: boolean /** Maximum number of matches per file */ maxCount?: number } /** Complete search results with statistics and match data */ export interface SearchResult { /** All matches found during the search */ matches: Array<SearchMatch> /** Total number of files searched */ filesSearched: number /** Number of files containing matches */ filesWithMatches: number /** Total number of individual matches found */ totalMatches: number /** Whether the search completed successfully */ success: boolean /** Error message if search failed */ error?: string } /** * Validate if a regex pattern is syntactically correct * * # Arguments * * `pattern` - Regular expression pattern to validate * * # Returns * true if the pattern is valid, false otherwise */ export declare function validatePattern(pattern: string): boolean