/** * @fileoverview Fast path handlers for common glob patterns * * This module provides optimized matching for the most common glob patterns, * avoiding the overhead of full regex compilation. These fast paths use * simple string operations like startsWith(), endsWith(), and includes() * which are significantly faster than regex matching. * * Supported fast path patterns: * - `*` - Match any single path segment (except dotfiles by default) * - `*.ext` - Match files with specific extension (e.g., `*.js`, `*.ts`) * - `*.*` - Match files with any extension * - `.*` - Match hidden files (dotfiles) * - `???` - Match files with exact length (question mark patterns) * * When a pattern doesn't match any fast path, null is returned and the * caller should fall back to full pattern matching. * * @author 686f6c61 * @see https://github.com/686f6c61/minimatch-fast * @license MIT */ import type { MinimatchOptions } from './types.js'; /** * Try to match a path against a pattern using a fast path. * * This function attempts to use optimized string operations for common * glob patterns instead of full regex compilation. If the pattern is not * a simple pattern that can be handled by a fast path, null is returned. * * @param path - The path to match (should be a filename without directory) * @param pattern - The glob pattern to match against * @param options - Minimatch options (dot, nocase are relevant) * @returns true if matches, false if doesn't match, null if no fast path available * * @example * ```typescript * tryFastPath('foo.js', '*.js', {}); // true * tryFastPath('foo.txt', '*.js', {}); // false * tryFastPath('.hidden', '*', {}); // false * tryFastPath('.hidden', '*', { dot: true }); // true * tryFastPath('foo.js', '**\/*.js', {}); // null (has /, need full matching) * ``` */ export declare function tryFastPath(path: string, pattern: string, options: MinimatchOptions): boolean | null; /** * Check if a pattern might be eligible for fast path. * This is a quick pre-check to avoid expensive regex tests. * * @param pattern - The glob pattern * @returns true if pattern might use fast path */ export declare function mightUseFastPath(pattern: string): boolean; //# sourceMappingURL=fast-paths.d.ts.map