@atomist/automation-client
Version:
Atomist API for software low-level client
52 lines • 3.34 kB
TypeScript
import { PathExpression } from "@atomist/tree-path/path/pathExpression";
import { ProjectAsync } from "../../project/Project";
import { GlobOptions } from "../../project/util/projectUtils";
import { FileHit, MatchResult, NodeReplacementOptions } from "./FileHits";
import { FileParser } from "./FileParser";
import { FileParserRegistry } from "./FileParserRegistry";
/**
* Integrate path expressions with project operations to find all matches
* @param p project
* @param globPatterns file glob patterns
* @param parserOrRegistry parser for files
* @param pathExpression path expression string or parsed
* @param functionRegistry registry to look for path expression functions in
* @return {Promise<MatchResult[]>} hit records for each matching file
*/
export declare function findMatches(p: ProjectAsync, parserOrRegistry: FileParser | FileParserRegistry, globPatterns: GlobOptions, pathExpression: string | PathExpression, functionRegistry?: object): Promise<MatchResult[]>;
export declare function findFileMatches(p: ProjectAsync, parserOrRegistry: FileParser | FileParserRegistry, globPatterns: GlobOptions, pathExpression: string | PathExpression, functionRegistry?: object): Promise<FileHit[]>;
/**
* Convenient method to find all values of matching nodes--
* typically, terminals such as identifiers
* @param p project
* @param globPatterns file glob pattern
* @param parserOrRegistry parser for files
* @param pathExpression path expression string or parsed
* @param functionRegistry registry to look for path expression functions in
* @return {Promise<TreeNode[]>} hit record for each matching file
*/
export declare function findValues(p: ProjectAsync, parserOrRegistry: FileParser | FileParserRegistry, globPatterns: GlobOptions, pathExpression: string | PathExpression, functionRegistry?: object): Promise<string[]>;
/**
* Integrate path expressions with project operations to find all matches
* of a path expression and zap them. Use with care!
* @param p project
* @param globPatterns file glob pattern
* @param parserOrRegistry parser for files
* @param pathExpression path expression string or parsed
* @param opts options for handling whitespace
* @return {Promise<TreeNode[]>} hit record for each matching file
*/
export declare function zapAllMatches<P extends ProjectAsync = ProjectAsync>(p: P, parserOrRegistry: FileParser | FileParserRegistry, globPatterns: GlobOptions, pathExpression: string | PathExpression, opts?: NodeReplacementOptions): Promise<P>;
/**
* Integrate path expressions with project operations to find all matches
* of a path expression and perform a mutation on them them. Use with care!
* @param p project
* @param globPatterns file glob pattern
* @param parserOrRegistry parser for files
* @param pathExpression path expression string or parsed
* @param todo what to do with matches
* @return {Promise<TreeNode[]>} hit record for each matching file
*/
export declare function doWithAllMatches<P extends ProjectAsync = ProjectAsync>(p: P, parserOrRegistry: FileParser | FileParserRegistry, globPatterns: GlobOptions, pathExpression: string | PathExpression, todo: (m: MatchResult) => void): Promise<P>;
export declare function findParser(pathExpression: PathExpression, fp: FileParser | FileParserRegistry): FileParser;
//# sourceMappingURL=astUtils.d.ts.map