UNPKG

2 kBTypeScriptView Raw
1import { PathExpression, TreeNode } from "@atomist/tree-path";
2import { ExecutionResult } from "@atomist/tree-path/lib/path/pathExpression";
3import { File } from "../../project/File";
4import { ProjectAsync } from "../../project/Project";
5import { LocatedTreeNode } from "../LocatedTreeNode";
6/**
7 * Options for handling production replacements
8 */
9export interface NodeReplacementOptions {
10 replaceAfter?: {
11 after: RegExp;
12 replacement: string;
13 };
14}
15/**
16 * Replacement option to zap trailing whitespace
17 * @type {{replaceAfter: {after: RegExp; replacement: string}}}
18 */
19export declare const ZapTrailingWhitespace: NodeReplacementOptions;
20/**
21 * Extension of TreeNode that allows convenient addition before
22 * or after a node, without updating the node's value.
23 */
24export interface MatchResult extends LocatedTreeNode {
25 append(content: string): void;
26 prepend(content: string): void;
27 /**
28 * Delete the match. Same as setting $value to the empty string,
29 * but can zap trailing spaces also
30 * @param {NodeReplacementOptions} opts
31 */
32 zap(opts: NodeReplacementOptions): void;
33 replace(newContent: string, opts: NodeReplacementOptions): void;
34 evaluateExpression(pex: string | PathExpression): ExecutionResult;
35}
36/**
37 * Represents a file and the hits against it
38 */
39export declare class FileHit {
40 private readonly project;
41 file: File;
42 fileNode: TreeNode;
43 readonly nodes: LocatedTreeNode[];
44 readonly matches: MatchResult[];
45 /**
46 * Represents the hits within a file within a project
47 * @param project
48 * @param {File} file file within the project
49 * @param {TreeNode} fileNode node structure including AST, so
50 * that if we want to dig into it or run further path expressions
51 * we don't need to reparse the file.
52 * @param {TreeNode[]} nodes
53 */
54 constructor(project: ProjectAsync, file: File, fileNode: TreeNode, nodes: LocatedTreeNode[]);
55}
56//# sourceMappingURL=FileHits.d.ts.map
\No newline at end of file