oak-domain/lib/utils/glob.d.ts

31 lines
990 B
TypeScript

/**
* 匹配 glob 模式
* @param filePath 文件路径(已标准化)
* @param pattern glob 模式
*/
export declare const matchGlobPattern: (filePath: string, pattern: string) => boolean;
/**
* 展开花括号模式 {a,b,c}
*/
export declare const expandBraces: (pattern: string) => string[];
/**
* 分割花括号选项(处理嵌套)
*/
export declare const splitBraceOptions: (content: string) => string[];
/**
* 递归匹配路径段
*/
export declare const matchSegments: (fileSegs: string[], fileIdx: number, patternSegs: string[], patternIdx: number) => boolean;
/**
* 匹配单个路径段(处理 *, ?, [] 通配符)
*/
export declare const matchSegment: (fileSeg: string, patternSeg: string) => boolean;
/**
* 查找匹配的右括号
*/
export declare const findClosingBracket: (pattern: string, startIdx: number) => number;
/**
* 匹配字符类 [abc] [a-z] [!abc]
*/
export declare const matchCharClass: (char: string, charClass: string) => boolean;