import { Microgrammar } from "@atomist/microgrammar/Microgrammar"; import { PatternMatch } from "@atomist/microgrammar/PatternMatch"; import { File } from "../File"; import { ProjectAsync } from "../Project"; import { GlobOptions } from "./projectUtils"; export declare type Match = M & PatternMatch; /** * Matches within a particular file */ export interface FileWithMatches { file: File; content: string; matches: Array>; /** * Make matches updatable */ makeUpdatable(): void; } /** * Options for microgrammar matching */ export interface Opts { /** * Should we make the results updatable? */ makeUpdatable?: boolean; /** * If specified, transforms content of each file matched * by the glob before running the microgrammar. * Used to remove comments etc. * @param {string} content * @return {string} */ contentTransformer?: (content: string) => string; } export declare const DefaultOpts: Opts; /** * Integrate microgrammars with project operations to find all matches * @param p project * @param globPatterns file glob patterns * @param microgrammar microgrammar to run against each eligible file * @param opts options */ export declare function findMatches(p: ProjectAsync, globPatterns: GlobOptions, microgrammar: Microgrammar, opts?: Opts): Promise>>; /** * Integrate microgrammars with project operations to find all matches * @param p project * @param globPatterns file glob patterns * @param microgrammar microgrammar to run against each eligible file * @param opts options */ export declare function findFileMatches(p: ProjectAsync, globPatterns: GlobOptions, microgrammar: Microgrammar, opts?: Opts): Promise>>; /** * Manipulate each file match containing an actual match. Will automatically match if necessary. * @param p project * @param {string} globPatterns * @param {Microgrammar} microgrammar * @param {(fh: FileWithMatches) => void} action * @param opts options */ export declare function doWithFileMatches(p: P, globPatterns: GlobOptions, microgrammar: Microgrammar, action: (fh: FileWithMatches) => void, opts?: Opts): Promise

; /** * Convenience function to operate on matches in the project. * Works regardless of the number of matches * @param p project * @param {string} globPatterns * @param {Microgrammar} microgrammar * @param {(m: M) => void} action * @param {{makeUpdatable: boolean}} opts */ export declare function doWithMatches(p: P, globPatterns: GlobOptions, microgrammar: Microgrammar, action: (m: M) => void, opts?: Opts): Promise

; /** * Convenience function to operate on the sole match in the project. * Fail if zero or more than one. * @param p project * @param {string} globPatterns * @param {Microgrammar} microgrammar * @param {(m: M) => void} action * @param {{makeUpdatable: boolean}} opts */ export declare function doWithUniqueMatch(p: P, globPatterns: GlobOptions, microgrammar: Microgrammar, action: (m: M) => void, opts?: Opts): Promise

; /** * Similar to doWithUniqueMatch, but accepts zero matches without error * @param p project * @param {string} globPatterns * @param {Microgrammar} microgrammar * @param {(m: M) => void} action * @param {{makeUpdatable: boolean}} opts */ export declare function doWithAtMostOneMatch(p: P, globPatterns: GlobOptions, microgrammar: Microgrammar, action: (m: M) => void, opts?: Opts): Promise

; //# sourceMappingURL=parseUtils.d.ts.map