import { CrossbowConfiguration } from "./config"; import { InputFiles, InputError } from "./task.utils"; import { CrossbowInput } from "./index"; import { ParsedPath } from "path"; import Rx = require("rx"); export interface ExternalFile { rawInput: string; resolved: string; relative: string; errors: InputError[]; parsed: ParsedPath; } export interface FileNotFoundError extends InputError { } export interface BinDirectoryNotFoundError extends InputError { } export interface ExternalFileContent extends ExternalFile { content: string; data?: any; } export interface ExternalFileInput extends ExternalFile { input: CrossbowInput | any; } /** * Try to auto-load configuration files * from the users CWD */ export declare function retrieveDefaultInputFiles(config: CrossbowConfiguration): InputFiles; /** * Try to load cbfiles (like gulp) from the users * working directory * @param config * @returns {InputFiles} */ export declare function retrieveCBFiles(config: CrossbowConfiguration): InputFiles; /** * Try to retrieve input files from disk. * This is different from regular file reading as * we deliver errors with context */ export declare function readInputFiles(paths: string[], cwd: string): InputFiles; export declare function readFileFromDiskWithContent(path: string, cwd: string): ExternalFileContent; export declare function readFilesFromDiskWithContent(paths: string[], cwd: string): ExternalFileContent[]; export declare function readFileContent(file: ExternalFile): string; export declare function writeFileToDisk(file: ExternalFile, content: string): void; export declare function getStubFileWithContent(path: string, cwd: string): ExternalFileContent; export declare function readOrCreateJsonFile(path: string, cwd: string): ExternalFileContent; export declare function getStubFile(path: string, cwd: string): ExternalFile; /** * Take an array of paths and return file info + errors if they don't exist * @param paths * @param cwd * @returns {ExternalFile[]} */ export declare function readFilesFromDisk(paths: string[], cwd: string): ExternalFile[]; /** * Attempt to use the LOCALLY installed crossbow version * first, this will ensure anything registered with .task etc * can be picked up by global installs too. * @param config * @returns {InputFiles} */ export declare function getRequirePaths(config: CrossbowConfiguration): InputFiles; export declare function getExternalFiles(dirpaths: string[], cwd: string): ExternalFile[]; export declare function getPossibleTasksFromDirectories(dirpaths: string[], cwd: string): string[]; export interface IHashItem { userInput: string; resolved: string; hash: string; changed: boolean; } export interface IHashInput { userInput: string; pathObj: ExternalFile; } export interface IHashResults { output: IHashItem[]; markedHashes: IHashItem[]; } export declare enum HashDirErrorTypes { HashNotADirectory, HashPathNotFound, } export interface HashDirError extends Error { code: string; path: string; syscall: string; } export declare function hashItems(dirs: string[], cwd: string, existingHashes: IHashItem[]): Rx.Observable; /** * Thanks to https://github.com/motdotla/dotenv * @param src * @returns {{}} */ export declare function parseEnv(src: string): { [index: string]: string; }; export declare const Right: (x: any) => { chain: (f: any) => any; map: (f: any) => any; fold: (f: any, g: any) => any; inspect: () => string; }; export declare const Left: (x: any) => { chain: (f: any) => any; map: (f: any) => any; fold: (f: any, g: any) => any; inspect: () => string; }; export declare const tryCatch: (f: any) => { chain: (f: any) => any; map: (f: any) => any; fold: (f: any, g: any) => any; inspect: () => string; };