@atomist/sdm-pack-aspect
Version:
an Atomist SDM Extension Pack for visualizing drift across an organization
36 lines • 1.33 kB
TypeScript
import { Aspect, FP } from "@atomist/sdm-pack-fingerprint";
import { AspectMetadata } from "./commonTypes";
export interface GlobMatch {
path: string;
size: number;
}
export interface GlobAspectData<D = {}> {
kind: "glob";
glob: string;
matches: Array<GlobMatch & D>;
}
export declare function isGlobMatchFingerprint(fp: FP): fp is FP<GlobAspectData>;
export interface Validated {
/** Test this for a match */
contentTest?: (content: string, path: string) => boolean;
}
export interface Extracted<D> {
/** Extract the data object */
extract: (content: string, path: string) => Promise<D>;
}
export declare type GlobAspectOptions<D> = AspectMetadata & {
glob: string;
} & (Validated | Extracted<D>);
/**
* Check for presence of a glob.
* Always extracts a fingerprint, but may have an empty array of matches.
* Entropy stat is disabled by default, but callers can override this.
* Can optionally test file content to exclude matches, or extract additional data for
* each match with the extract method.
*/
export declare function globAspect<D = {}>(config: GlobAspectOptions<D>): Aspect<GlobAspectData<D>>;
/**
* Count the number of glob matches of the given type
*/
export declare function countGlobMatches(fps: FP[], type: string): number;
//# sourceMappingURL=globAspect.d.ts.map