snyk
Version:
snyk library and cli utility
34 lines (33 loc) • 2.03 kB
TypeScript
import { IacFileParsed, IacFileParseFailure } from './types';
/**
* This function handles everything from filtering out Terraform files directory by directory,
* loading them, sending them to the parser and getting the parsing results back.
* Then it concatenates and returns the new parsing results with the existing parsing results.
* @param pathToScan - the path to scan provided by the user
* @param maxDepth? - an optional maxDepth of directories if provided by the detection-depth flag
* @returns { parsedFiles, failedFiles} - all the parsing results so far
*/
export declare function loadAndParseTerraformFiles(pathToScan: string, maxDepth?: number): Promise<{
parsedFiles: Array<IacFileParsed>;
failedFiles: Array<IacFileParseFailure>;
}>;
/**
* Gets all nested directories for the path that we ran a scan.
* @param pathToScan - the path to scan provided by the user
* @param maxDepth? - An optional `maxDepth` argument can be provided to limit how deep in the file tree the search will go.
* @returns {string[]} An array with all the non-empty nested directories in this path
*/
export declare function getAllDirectoriesForPath(pathToScan: string, maxDepth?: number): string[];
/**
* Gets all file paths for the specific directory. If the provided path is a supported file, then it gets returned.
* @param pathToScan - the path to scan provided by the user
* @param currentDirectory - the directory which we want to return files for
* @returns {string[]} An array with all the Terraform filePaths for this directory
*/
export declare function getFilesForDirectory(pathToScan: string, currentDirectory: string): string[];
/**
* Iterates through the makeFileAndDirectoryGenerator function and gets all the Terraform files in the specified directory
* @param pathToScan - the pathToScan to scan provided by the user
* @returns {Generator<string>} - a generator which holds all the filepaths
*/
export declare function getTerraformFilesInDirectoryGenerator(pathToScan: string): Generator<string>;