@atomist/automation-client
Version:
Atomist API for software low-level client
56 lines • 2 kB
TypeScript
import { PathExpression, TreeNode } from "@atomist/tree-path";
import { ExecutionResult } from "@atomist/tree-path/lib/path/pathExpression";
import { File } from "../../project/File";
import { ProjectAsync } from "../../project/Project";
import { LocatedTreeNode } from "../LocatedTreeNode";
/**
* Options for handling production replacements
*/
export interface NodeReplacementOptions {
replaceAfter?: {
after: RegExp;
replacement: string;
};
}
/**
* Replacement option to zap trailing whitespace
* @type {{replaceAfter: {after: RegExp; replacement: string}}}
*/
export declare const ZapTrailingWhitespace: NodeReplacementOptions;
/**
* Extension of TreeNode that allows convenient addition before
* or after a node, without updating the node's value.
*/
export interface MatchResult extends LocatedTreeNode {
append(content: string): void;
prepend(content: string): void;
/**
* Delete the match. Same as setting $value to the empty string,
* but can zap trailing spaces also
* @param {NodeReplacementOptions} opts
*/
zap(opts: NodeReplacementOptions): void;
replace(newContent: string, opts: NodeReplacementOptions): void;
evaluateExpression(pex: string | PathExpression): ExecutionResult;
}
/**
* Represents a file and the hits against it
*/
export declare class FileHit {
private readonly project;
file: File;
fileNode: TreeNode;
readonly nodes: LocatedTreeNode[];
readonly matches: MatchResult[];
/**
* Represents the hits within a file within a project
* @param project
* @param {File} file file within the project
* @param {TreeNode} fileNode node structure including AST, so
* that if we want to dig into it or run further path expressions
* we don't need to reparse the file.
* @param {TreeNode[]} nodes
*/
constructor(project: ProjectAsync, file: File, fileNode: TreeNode, nodes: LocatedTreeNode[]);
}
//# sourceMappingURL=FileHits.d.ts.map