declare module "task.transforms" { import { Task } from "task.resolve"; export interface TaskTransform { predicate: (incoming: Task) => boolean; fn: (incoming: Task) => Task; } /** * Task Transformations * This gives an opportunity to change a task just before error collection */ export const transforms: { "@sh from File": { predicate(incoming: Task): boolean; fn(incoming: Task): Task; }; }; /** * Allow transformations on tasks before error collections */ export function applyTransforms(incoming: Task): Task; } declare module "task.sequence.factories" { import { Task } from "task.resolve"; import { CommandTrigger } from "command.run"; import { TaskStats } from "task.runner"; export enum SequenceItemTypes { SeriesGroup, ParallelGroup, Task, } export interface SequenceItem { type: SequenceItemTypes; taskName?: string; task?: Task; items: SequenceItem[]; factory?: (opts: any, ctx: CommandTrigger, observer: Rx.Observer) => any; fnName?: string; options?: any; subTaskName?: string; stats?: TaskStats; seqUID: number; skipped?: boolean; viaName?: string; } export interface SequenceSeriesGroup { taskName: string; skipped: boolean; items: any[]; } export interface SequenceParallelGroup extends SequenceSeriesGroup { } export interface SequenceTask { fnName: string; factory: TaskFactory; task: Task; options: any; subTaskName?: string; viaName?: string; } export interface TaskFactory { (task: Task, trigger: CommandTrigger): any; tasks?: TaskFactory[]; name?: string; } export function createSequenceTaskItem(incoming: SequenceTask): SequenceItem; export function createSequenceSeriesGroup(incoming: SequenceSeriesGroup): SequenceItem; export function createSequenceParallelGroup(incoming: SequenceParallelGroup): SequenceItem; } declare module "task.return.values" { export default function handleReturnType(output: any, cb: () => void): any; } declare module "watch.preprocess" { export interface OutgoingWatchTask { rawInput: string; taskName: string; patterns: string[]; tasks: string[]; } export function preprocessWatchTask(taskName: string): OutgoingWatchTask; } declare module "watch.errors" { import { CrossbowInput } from "index"; import { OutgoingWatchTask } from "watch.preprocess"; export enum WatchTaskErrorTypes { WatchTaskNameNotFound, } export interface WatchTaskError { type: WatchTaskErrorTypes; } export interface WatchTaskNameNotFoundError extends WatchTaskError { taskName: string; } export function gatherWatchTaskErrors(outgoing: OutgoingWatchTask, input: CrossbowInput): WatchTaskError[]; } declare module "watch.resolve" { import { WatchOptions } from "chokidar"; import { WatchTaskError } from "watch.errors"; import { CrossbowInput } from "index"; import { Tasks } from "task.resolve"; import { SequenceItem } from "task.sequence.factories"; import { Runner } from "task.runner"; import { CommandTrigger } from "command.run"; import { TaskCollection } from "task.resolve"; export const defaultWatchOptions: CBWatchOptions; export interface CBWatchOptions extends WatchOptions { throttle: number; debounce: number; delay: number; block: boolean; } export interface WatchTask { before: string[]; options: CBWatchOptions; watchers: Watcher[]; name: string; errors: WatchTaskError[]; patterns?: string[]; tasks?: string[]; } export interface Watcher { patterns: string[]; tasks: TaskCollection; options: any; watcherUID: string; _tasks?: Tasks; _sequence?: SequenceItem[]; _runner?: Runner; parent?: string; } export interface WatchTasks { valid: WatchTask[]; invalid: WatchTask[]; all: WatchTask[]; } export function resolveWatchTasks(taskNames: string[], trigger: CommandTrigger): WatchTasks; /** * The goal of this function is to produce a flat array containing tasks as strings * this allows us to feed that into the task resolution stuff */ export function resolveBeforeTasks(beforeFlagsFromCliOrConfig: string[], input: CrossbowInput, watchTasks: WatchTask[]): string[]; } declare module "task.sequence" { import { Task } from "task.resolve"; import { CommandTrigger } from "command.run"; import { Runner } from "task.runner"; import { SequenceItem } from "task.sequence.factories"; import { TaskReport } from "task.runner"; export function createFlattenedSequence(tasks: Task[], trigger: CommandTrigger): SequenceItem[]; /** * If the current TaskType is an InlineFunction or * module to be run, */ export interface ITaskOptions { _default?: any; [index: string]: any; } /** * ****************** * Where the **--~~Magic~~--** happens!!! * ****************** * * Creating a task runner in crossbow is really about * wrapping the process of running the tasks in a way * that allows comprehensive logging/reporting * * Series & Parallel have different semantics and are * therefor handled separately. * * Note that everything here is completely lazy and * nothing will be executed until a user calls subscribe */ export function createRunner(items: SequenceItem[], trigger: CommandTrigger): Runner; /** * After a bunch of tasks have run, we need to link up task-ended reports * with their original position in the sequence. This will allow us to * reconstruct the task render-tree but also show any tasks that errored * or did not complete * @param sequence * @param reports * @returns {*} */ export function decorateSequenceWithReports(sequence: SequenceItem[], reports: TaskReport[]): any; /** * Look at every item in the sequence tree and count how many * error have occured */ export function countSequenceErrors(items: SequenceItem[]): number; export function collectSkippedTasks(items: SequenceItem[], initial: any): SequenceItem[]; export function collectRunnableTasks(items: SequenceItem[], initial: SequenceItem[]): SequenceItem[]; } declare module "watch.before" { import { WatchTasks } from "watch.resolve"; import { Tasks } from "task.resolve"; import { SequenceItem } from "task.sequence.factories"; import { CommandTrigger } from "command.run"; export interface BeforeTasks { runner: any; beforeTasksAsCliInput: string[]; tasks: Tasks; sequence: SequenceItem[]; } export function getBeforeTaskRunner(trigger: CommandTrigger, watchTasks: WatchTasks): BeforeTasks; } declare module "watch.runner" { import { WatchTasks } from "watch.resolve"; import { Watcher } from "watch.resolve"; import { CommandTrigger } from "command.run"; import { BeforeTasks } from "watch.before"; export interface WatchRunners { all: Watcher[]; valid: Watcher[]; invalid: Watcher[]; } export interface WatchTaskRunner { tasks: WatchTasks; runners: WatchRunners; before: BeforeTasks; } export function createWatchRunners(watchTasks: WatchTasks, ctx: CommandTrigger): WatchRunners; } declare module "reporters/task.list" { import { Task } from "task.resolve"; import { WatchRunners } from "watch.runner"; import { TaskReport } from "task.runner"; export interface WriteableStream { columns: number; } export function getSimpleTaskList(tasks: Task[], longest: number): string[]; export function twoCol(tasks: Task[], longest: number): Array; export function twoColWatchers(runners: WatchRunners): Array; export function _taskReport(report: TaskReport): string; export function duration(ms: any): string; } declare module "file.utils" { 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 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 function retrieveDefaultInputFiles(config: CrossbowConfiguration): InputFiles; /** * Try to load cbfiles (like gulp) from the users * working directory * @param config * @returns {InputFiles} */ export 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 function readInputFiles(paths: string[], cwd: string): InputFiles; export function readFilesFromDiskWithContent(paths: string[], cwd: string): ExternalFileContent[]; export function readFileContent(file: ExternalFile): string; export function writeFileToDisk(file: ExternalFile, content: string): void; export function getStubFileWithContent(path: string, cwd: string): ExternalFileContent; export function readOrCreateJsonFile(path: string, cwd: string): ExternalFileContent; export 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 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 function getRequirePaths(config: CrossbowConfiguration): InputFiles; export function getExternalFiles(dirpaths: string[], cwd: string): ExternalFile[]; export 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 enum HashDirErrorTypes { HashNotADirectory, HashPathNotFound, } export interface HashDirError extends Error { code: string; path: string; syscall: string; } export function hashItems(dirs: string[], cwd: string, existingHashes: IHashItem[]): Rx.Observable; } declare module "command.init" { import { CrossbowConfiguration } from "config"; import { CrossbowInput, CLI, CrossbowReporter } from "index"; import Rx = require("rx"); import * as file from "file.utils"; import { ExternalFile } from "file.utils"; export enum InitConfigFileErrorTypes { InitInputFileExists, InitInputFileTypeNotSupported, } export interface InitConfigError { type: InitConfigFileErrorTypes; } export interface InitConfigFileExistsError extends InitConfigError { file: file.ExternalFile; } export interface InitConfigFileTypeNotSupported extends InitConfigError { providedType: InitConfigFileTypes; supportedTypes: {}; } export interface InitCommandOutput { existingFilesInCwd: ExternalFile[]; matchingFiles: ExternalFile[]; errors: InitConfigError[]; outputFilePath?: string; outputFileName?: string; templateFilePath?: string; } export type InitCommandComplete = Rx.Observable<{ setup: InitCommandOutput; }>; export enum InitConfigFileTypes { yaml, js, json, cbfile, } export default function handleIncomingInitCommand(cli: CLI, input: CrossbowInput, config: CrossbowConfiguration, reporter: CrossbowReporter): Rx.Observable<{ setup: InitCommandOutput; }>; } declare module "logger" { let logger: any; export default logger; export const compile: any; export const prefix: string; export const createAst: any; export const clean: any; } declare module "command.docs" { import { CrossbowConfiguration } from "config"; import { CrossbowInput, CLI, CrossbowReporter } from "index"; import { Tasks } from "task.resolve"; import Rx = require("rx"); import * as file from "file.utils"; export interface DocsError { type: DocsErrorTypes; } export interface DocsInputFileNotFoundError extends DocsError { file: file.ExternalFile; } export interface DocsOutputFileExistsError extends DocsInputFileNotFoundError { } export enum DocsErrorTypes { DocsInputFileNotFound, DocsOutputFileExists, } export const docStartComment: string; export const docEndComment: string; export const hasRegExp: RegExp; export const hasExistingComments: (inputString: any) => boolean; export const readmeRegExp: RegExp; export interface DocsFileOutput { file: file.ExternalFile; content: string; } export interface DocsCommandOutput { tasks: Tasks; errors: DocsError[]; markdown?: string; output?: DocsFileOutput[]; } export type DocsCommandComplete = Rx.Observable<{ setup: DocsCommandOutput; }>; export default function handleIncomingDocsCommand(cli: CLI, input: CrossbowInput, config: CrossbowConfiguration, reporter: CrossbowReporter): Rx.Observable<{ setup: DocsCommandOutput; }>; } declare module "watch.shorthand" { import { CommandTrigger } from "command.run"; export interface UnwrappedTask { patterns: string[]; tasks: string[]; i: number; name: string; } export function getModifiedWatchContext(trigger: CommandTrigger): CommandTrigger; /** * take the following: * $ crossbow watch "*.js -> (lint) (unit)" * * and convert it into * patterns: ["*.js"] * tasks: ["lint", "unit"] */ export function unwrapShorthand(incoming: string, i: number): UnwrappedTask; } declare module "watch.utils" { export function stripBlacklisted(incoming: string[]): string[]; } declare module "command.watch.interactive" { import Rx = require("rx"); import { CLI, CrossbowInput } from "index"; import { CrossbowConfiguration } from "config"; export interface WatchAnswers { watch: string[]; } export default function promptForWatchCommand(cli: CLI, input: CrossbowInput, config: CrossbowConfiguration): Rx.Observable; } declare module "command.watch" { import { CommandTrigger } from "command.run"; import { CrossbowConfiguration } from "config"; import { CrossbowInput, CLI, CrossbowReporter } from "index"; import { WatchRunners } from "watch.runner"; import { WatchTasks } from "watch.resolve"; import { BeforeTasks } from "watch.before"; import Rx = require("rx"); import { WatchTaskReport, WatchRunnerComplete } from "watch.file-watcher"; import { ReportTypes } from "reporter.resolve"; export interface CrossbowError extends Error { _cb: boolean; } export interface WatchCommandSetupErrors { type: ReportTypes; } export interface WatchCommandOutput { setup: WatchCommandSetup; update$: Rx.Observable; } export interface WatchCommandSetup { beforeTasks?: BeforeTasks; watchTasks?: WatchTasks; watchRunners?: WatchRunners; errors: WatchCommandSetupErrors[]; } export type WatchCommmandComplete = Rx.Observable; export interface WatchReport { type: WatchCommandEventTypes; data: WatchTaskReport | WatchRunnerComplete; } export enum WatchCommandEventTypes { SetupError, FileEvent, WatchTaskReport, WatchRunnerComplete, BeforeTasksComplete, } export default function handleIncomingWatchCommand(cli: CLI, input: CrossbowInput, config: CrossbowConfiguration, reporter: CrossbowReporter): WatchCommmandComplete; export function getWatchCommandSetup(trigger: CommandTrigger): WatchCommandSetup; } declare module "watch.file-watcher" { import { Watcher } from "watch.resolve"; import { CommandTrigger } from "command.run"; import { TaskReport } from "task.runner"; import Rx = require("rx"); import { SequenceItem } from "task.sequence.factories"; import { CrossbowReporter } from "index"; import { WatchCommandEventTypes } from "command.watch"; export interface WatchEventWithContext { watchEvent: WatchEvent; watcher: Watcher; } export interface WatchEvent { event: string; path: string; watcherUID: string; } export interface WatchTaskReport { taskReport: TaskReport; watchEvent: WatchEvent; count: number; } export interface WatchRunnerComplete { sequence: SequenceItem[]; reports: TaskReport[]; errors: TaskReport[]; watchEvent: WatchEvent; runtime: number; } /** * Create a stream that is the combination of all watchers */ export function createObservablesForWatchers(watchers: Watcher[], trigger: CommandTrigger): Rx.Observable<{ type: WatchCommandEventTypes; data: WatchTaskReport | WatchRunnerComplete; }>; /** * Create a file-system watcher that will emit */ export function createObservableForWatcher(watcher: Watcher, trigger: CommandTrigger): Rx.Observable; export function getFileChangeStream(watcher: Watcher, reporter: CrossbowReporter): Rx.Observable; } declare module "command.tasks" { import { CrossbowConfiguration } from "config"; import { CrossbowInput, CLI, CrossbowReporter } from "index"; import { Tasks, Task } from "task.resolve"; import Rx = require("rx"); export interface TaskGroup { title: string; tasks: Tasks; } export interface TaskCommandSetup { groups: TaskGroup[]; tasks: Task[]; errors: Error[]; } export interface TasksCommandCompletionReport { setup: TaskCommandSetup; } export type TasksCommandComplete = Rx.Observable; export default function handleIncomingTasksCommand(cli: CLI, input: CrossbowInput, config: CrossbowConfiguration, reporter: CrossbowReporter): TasksCommandComplete; } declare module "command.watchers" { import { CrossbowConfiguration } from "config"; import { CrossbowInput, CLI, CrossbowReporter } from "index"; import Rx = require("rx"); import { WatchTasks } from "watch.resolve"; import { WatchRunners } from "watch.runner"; import { ReportTypes } from "reporter.resolve"; export interface WatchersCommandError { type: ReportTypes; } export interface WatchersCommandOutput { watchTasks?: WatchTasks; runners?: WatchRunners; errors: WatchersCommandError[]; } export type WatchersCommandComplete = Rx.Observable<{ setup: WatchersCommandOutput; }>; export default function handleIncomingWatchersCommand(cli: CLI, input: CrossbowInput, config: CrossbowConfiguration, reporter: CrossbowReporter): Rx.Observable<{ setup: WatchersCommandOutput; }>; } declare module "reporter.resolve" { import { CrossbowConfiguration, OutgoingSignals } from "config"; import { CrossbowInput, CLI } from "index"; import { ExternalFile, ExternalFileInput, ExternalFileContent, HashDirErrorTypes } from "file.utils"; import { TaskReport } from "task.runner"; import { CommandTrigger } from "command.run"; import { SequenceItem } from "task.sequence.factories"; import { InitConfigFileExistsError, InitConfigFileTypeNotSupported } from "command.init"; import { ParsedPath } from "path"; import { Task, TaskCollection } from "task.resolve"; import { WatchTask, Watcher, WatchTasks } from "watch.resolve"; import { DocsInputFileNotFoundError, DocsOutputFileExistsError } from "command.docs"; import Rx = require("rx"); import { WatchEvent } from "watch.file-watcher"; import { TaskCommandSetup } from "command.tasks"; import { WatchersCommandOutput } from "command.watchers"; export interface Reporter { errors: {}[]; type: ReporterTypes; callable?: Function; sources: ExternalFile[]; } export enum ReporterErrorTypes { ReporterFileNotFound, ReporterTypeNotSupported, } export interface ReporterError { type: ReporterErrorTypes; file?: ExternalFile; } export interface ReporterFileNotFoundError extends ReporterError { } export interface ReporterTypeNotSupportedError extends ReporterError { } export enum ReporterTypes { InlineFunction, ExternalFile, UnsupportedValue, Muted, } export interface Reporters { all: Reporter[]; valid: Reporter[]; invalid: Reporter[]; } export enum ReportTypes { DuplicateInputFile, InputFileCreated, InitInputFileTypeNotSupported, InputError, InputFileNotFound, InvalidReporter, UsingInputFile, TaskList, TaskTree, TaskErrors, TaskReport, NoTasksAvailable, NoTasksProvided, SimpleTaskList, BeforeWatchTaskErrors, BeforeTaskList, BeforeTasksDidNotComplete, BeforeTasksSummary, WatchTaskTasksErrors, WatchTaskErrors, WatchTaskReport, NoFilesMatched, NoWatchersAvailable, NoWatchTasksProvided, Watchers, WatcherNames, WatcherTriggeredTasksCompleted, WatcherTriggeredTasks, WatcherSummary, DocsAddedToFile, DocsGenerated, DocsInputFileNotFound, DocsOutputFileExists, DocsInvalidTasksSimple, HashDirError, Summary, SignalReceived, CLIParserOutput, } export interface IncomingReport { type: ReportTypes; data?: any; } export interface OutgoingReport { origin: ReportTypes; data: string[]; } export interface UsingConfigFileReport { sources: ExternalFileInput[]; } export interface InputFileNotFoundReport { sources: ExternalFileInput[]; } export interface InputErrorReport { errors: any[]; sources: ExternalFileInput[]; } export interface TaskReportReport { report: TaskReport; config: CrossbowConfiguration; } export interface SignalReceivedReport { code: number; } export interface SummaryReport { sequence: SequenceItem[]; cli: CLI; config: CrossbowConfiguration; runtime: number; errors: TaskReport[]; } export interface BeforeTasksSummaryReport { sequence: SequenceItem[]; cli: CLI; config: CrossbowConfiguration; runtime: number; errors: TaskReport[]; } export interface WatcherSummaryReport { sequence: SequenceItem[]; cli: CLI; config: CrossbowConfiguration; runtime: number; errors: TaskReport[]; watchEvent: WatchEvent; watcher: Watcher; } export interface TaskListReport { sequence: SequenceItem[]; cli: CLI; titlePrefix: string; config: CrossbowConfiguration; } export interface SimpleTaskListReport { setup: TaskCommandSetup; } export interface InvalidReporterReport { reporters: Reporters; } export interface DuplicateConfigFile { error: InitConfigFileExistsError; } export interface ConfigFileCreatedReport { parsed: ParsedPath; } export interface InitInputFileTypeNotSupportedReport { error: InitConfigFileTypeNotSupported; } export interface TaskTreeReport { tasks: Task[]; config: CrossbowConfiguration; title: string; } export interface TaskErrorsReport { tasks: Task[]; taskCollection: TaskCollection; input: CrossbowInput; config: CrossbowConfiguration; } export interface WatchersReport { watchTasks: WatchTask[]; } export interface BeforeWatchTaskErrorsReport { watchTasks: WatchTasks; trigger: CommandTrigger; } export interface BeforeTaskListReport { sequence: SequenceItem[]; cli: CLI; config: CrossbowConfiguration; } export interface BeforeTasksDidNotCompleteReport { error: Error; } export interface WatchTaskTasksErrorsReport { tasks: Task[]; runner: Watcher; config: CrossbowConfiguration; } export interface WatchTaskErrorsReport { watchTasks: WatchTask[]; } export interface WatchTaskReportReport { report: TaskReport; trigger: CommandTrigger; } export interface WatcherTriggeredTasksReport { index: number; taskCollection: TaskCollection; } export interface WatcherTriggeredTasksCompletedReport { index: number; taskCollection: TaskCollection; time: number; } export interface WatcherNamesReport { setup: WatchersCommandOutput; } export interface NoFilesMatchedReport { watcher: Watcher; } export interface DocsInputFileNotFoundReport { error: DocsInputFileNotFoundError; } export interface DocsAddedToFileReport { file: ExternalFileContent; } export interface DocsOutputFileExistsReport { error: DocsOutputFileExistsError; } export interface HashError extends Error { type: HashDirErrorTypes; } export interface HashDirErrorReport { error: HashError; cwd: string; } export function getReporters(config: CrossbowConfiguration, input: CrossbowInput): Reporters; export type OutgoingReporter = Rx.Subject; export function getOutputObserver(mergedConfig: CrossbowConfiguration, outputObserver: OutgoingReporter): Rx.Observable; export function getSignalReporter(mergedConfig: CrossbowConfiguration, signalObserver?: OutgoingSignals): OutgoingSignals; export function getDefaultReporter(): any; } declare module "reporters/defaultReporter" { import { SequenceItem } from "task.sequence.factories"; import { CrossbowConfiguration } from "config"; import { Task } from "task.resolve"; import * as reports from "reporter.resolve"; export const enum LogLevel { Short = 0, Verbose = 1, } export default function (report: reports.IncomingReport, observer: Rx.Observer): void; export const reporterFunctions: { [x: number]: ((report: reports.UsingConfigFileReport) => string) | ((report: reports.InputErrorReport) => string[]) | ((report: reports.InvalidReporterReport) => string[]) | ((report: reports.DuplicateConfigFile) => string[]) | ((report: reports.ConfigFileCreatedReport) => string[]) | ((report: reports.InitInputFileTypeNotSupportedReport) => string[]) | ((report: reports.SimpleTaskListReport) => string[]) | ((report: reports.TaskTreeReport) => string[]) | ((report: reports.TaskListReport) => string) | ((report: reports.TaskErrorsReport) => string[]) | ((report: reports.TaskReportReport) => string) | ((report: reports.BeforeWatchTaskErrorsReport) => string[]) | ((report: reports.BeforeTaskListReport) => string[]) | ((report: reports.BeforeTasksDidNotCompleteReport) => string[]) | ((report: reports.WatchTaskTasksErrorsReport) => string[]) | ((report: reports.WatchTaskErrorsReport) => string[]) | ((report: reports.WatchTaskReportReport) => string) | ((report: reports.WatcherNamesReport) => string[]) | ((report: reports.NoFilesMatchedReport) => string) | ((report: reports.WatcherTriggeredTasksReport) => string) | (() => void) | ((report: reports.DocsInputFileNotFoundReport) => string[]) | ((report: reports.DocsAddedToFileReport) => string) | ((report: reports.SignalReceivedReport) => string[]); }; /** * There are multiple ways to output trees to the screen, * so this helper function helps to normalize the output * by providing the same padding on all but the first line. */ export function multiLineTree(tree: string): string; export interface CrossbowError extends Error { _cbError?: boolean; _cbExitCode?: number; } export function getStack(stack: string[], config: CrossbowConfiguration): string[]; /** * Show a tree of function calls */ export function reportSequenceTree(sequence: SequenceItem[], config: CrossbowConfiguration, title: any, showStats?: boolean): string; export function reportTaskTree(tasks: Task[], config: CrossbowConfiguration, title: string): string[]; export function getErrors(task: any): any; export function getCleanLabel(task: Task): string; export function getLabel(task: Task): string; } declare module "task.runner" { import { Tasks } from "task.resolve"; import { SequenceItem } from "task.sequence.factories"; import { CommandTrigger } from "command.run"; import Rx = require("rx"); import Immutable = require("immutable"); export interface Runner { series: (ctx?: RunContext) => Rx.Observable; parallel: (ctx?: RunContext) => Rx.Observable; sequence: SequenceItem[]; } export interface TaskRunner { tasks: Tasks; sequence: SequenceItem[]; runner: Runner; } export interface TaskStats { startTime: number; endTime: number; duration: number; started: boolean; completed: boolean; errors: Error[]; skipped?: boolean; skippedReadon?: TaskSkipReasons; } export interface TaskErrorStats { endTime: number; completed: boolean; errors: Error[]; cbError?: boolean; cbExitCode?: number; } export interface Report { item: SequenceItem; type: TaskReportType; } export enum TaskReportType { start, end, error, } export enum TaskSkipReasons { SkipFlag, IfChanged, } export interface TaskReport extends Report { stats: TaskStats; } export interface TaskErrorReport extends Report { stats: TaskErrorStats; } export type RunContext = Immutable.Map; /** * This creates a wrapper around the actual function that will be run. * This done to allow the before/after reporting to work as expected for consumers */ export function time(scheduler?: any): any; export function createObservableFromSequenceItem(item: SequenceItem, trigger: CommandTrigger, ctx: RunContext): Rx.Observable<{}>; /** * Create a new stats object with startTime */ export function getStartStats(startTime: number, additional?: { [index: string]: any; }): TaskStats; } declare module "task.utils" { import { CrossbowConfiguration } from "config"; import { CommandTrigger } from "command.run"; import { ExternalFileInput, ExternalFile } from "file.utils"; import { Task } from "task.resolve"; import { CrossbowInput } from "index"; export enum InputErrorTypes { InputFileNotFound, NoTasksAvailable, NoWatchersAvailable, FileNotFound, NotAFile, InvalidYaml, InvalidInput, InvalidJson, } export interface InputFileNotFoundError extends InputError { } export interface NoTasksAvailableError extends InputError { } export interface NoWatchersAvailableError extends InputError { } export interface InputError { type: InputErrorTypes; } export interface InputFiles { all: ExternalFileInput[]; valid: ExternalFileInput[]; invalid: ExternalFileInput[]; } export function locateModule(config: CrossbowConfiguration, taskName: string): ExternalFile[]; export function getChildTaskNames(task: Task): string[]; /** * Convert a JS object into ENV vars * eg: * var obj = { * options: { * docker: { * port: 8000 * } * } * } * -> * envifyObject(obj, 'CB', 'OPTIONS') * -> * CB_OPTIONS_DOCKER_PORT=8000 */ export function envifyObject(object: any, prefix: string, objectKeyName: string): any; export function excludeKeys(input: any, blacklist: string[]): any; export function getCBEnv(trigger: CommandTrigger): {}; export function getFunctionName(fn: any): string; export const removeNewlines: (x: string) => string; export const escapeNewLines: (x: string) => string; export const removeTrailingNewlines: (x: string) => string; export function stringifyObj(incoming: any, max?: number): string; export function isPlainObject(val: any): boolean; export function isString(val: any): boolean; export function isFunction(val: any): boolean; export function isReport(report: any): boolean; export function isPrivateTask(taskName: string): boolean; export function isPublicTask(taskName: string): boolean; export function isParentGroupName(name: string): RegExpMatchArray; export function isParentRef(name: string, names: string[]): boolean; export function getChildItems(name: string, input: any): any; export function getPossibleTaskNames(input: CrossbowInput): any[]; export function getChildName(name: any): any; export function isInternal(incoming: string): boolean; export function isSupportedFileType(incoming: any): boolean; export function _e(x: any): any; export function __e(x: any): any; export function longestString(col: string[]): number; export function getLongestTaskName(tasks: Task[]): number; export function padLine(incoming: any, max?: any): any; export function concatProps(tasks: any, initial: string[], propname: string): string[]; } declare module "task.errors" { import { Task } from "task.resolve"; import { CommandTrigger } from "command.run"; import { ExternalFile } from "file.utils"; export enum TaskErrorTypes { TaskNotFound, SubtasksNotInConfig, SubtaskNotProvided, SubtaskNotProvidedForParent, SubtaskNotFound, SubtaskWildcardNotAvailable, AdaptorNotFound, FlagNotFound, CBFlagNotProvided, InvalidTaskInput, CircularReference, FileTypeNotSupported, } export function gatherTaskErrors(task: Task, trigger: CommandTrigger): TaskError[]; export interface TaskError { type: TaskErrorTypes; } export interface TaskNotFoundError extends TaskError { taskName: string; cwd: string; possible: string[]; } export interface SubtasksNotInConfigError extends TaskError { name: string; } export interface SubtaskNotProvidedError extends TaskError { name: string; } export interface SubtaskNotProvidedForParentError extends TaskError { name: string; available: string[]; } export interface SubtaskWildcardNotAvailableError extends TaskError { name: string; } export interface SubtaskNotFoundError extends TaskError { name: string; } export interface AdaptorNotFoundError extends TaskError { taskName: string; } export interface InvalidTaskInputError extends TaskError { input: any; } export interface CBFlagNotFoundError extends TaskError { taskName: string; } export interface CBFlagNotProvidedError extends TaskError { taskName: string; } export interface CircularReferenceError extends TaskError { incoming: Task; parents: string[]; } export interface FileTypeNotSupportedError extends TaskError { taskName: string; externalFile: ExternalFile; } } declare module "cli.parse" { import { CLI } from "index"; export interface FlagOption { alias?: string; type?: CliFlagTypes; help?: string; } export interface FlagWithValues { name?: string; type?: CliFlagTypes; values?: any[]; help?: string; } /** * As given by the user, eg: * * { verbose: {alias: 'v', count: true } } */ export interface FlagOptions { [flagname: string]: FlagOption; } export interface Flags { [flagname: string]: FlagWithValues; help?: boolean; version?: boolean; } export interface FlagsWithValues extends FlagOption { values: string[]; } export enum CliFlagTypes { Array, String, Boolean, Number, Count, } export interface CliInputAndFlags { input: string[]; flags: Array; } export interface FlagsOutput extends CLI { command: string; input: string[]; rawFlags: Array; flagValues: FlagWithValues; flags: Flags; trailing: string; } /** * Accept either string or array input */ export default function parse(input: string | string[], opts?: FlagOptions): FlagsOutput; } declare module "task.preprocess" { import { Task } from "task.resolve"; import { CrossbowInput } from "index"; import { TaskRunModes, IncomingTaskItem } from "task.resolve"; import { CommandTrigger } from "command.run"; export function preprocessTask(taskName: IncomingTaskItem, trigger: CommandTrigger, parents: string[]): Task; export interface TaskLiteral { tasks?: IncomingTaskItem[]; runMode?: TaskRunModes; input?: string; adaptor?: string; command?: string; description?: string; } export function handleObjectInput(taskLiteral: TaskLiteral, input: any, parents: any): any; export function handleArrayInput(taskItems: any[], input: CrossbowInput, parents: string[]): Task; export interface SplitTaskAndFlags { taskName: string; cbflags: string[]; flags: {}; query: any; } } declare module "task.tree.transforms" { import { Task } from "task.resolve"; export interface TaskTreeTransform { predicate: (incoming: Task[]) => boolean; fn: (incoming: Task[]) => Task[]; } export const transforms: { "Add skipped property to children": { predicate(tasks: Task[]): boolean; fn(tasks: Task[]): Task[]; }; "Add if property to children": { predicate(tasks: Task[]): boolean; fn(tasks: Task[]): Task[]; }; "Pass options/flags/query from Groups -> Tasks": { predicate(): boolean; fn(tasks: Task[]): Task[]; }; }; /** * Allow transformations on tasks before error collections */ export function applyTreeTransforms(incoming: Task[]): Task[]; } declare module "task.resolve" { import { TaskError } from "task.errors"; import { CrossbowInput } from "index"; import { CommandTrigger } from "command.run"; import { Task, Tasks } from "task.resolve"; import { ExternalFile } from "file.utils"; /** * Function.name is es6 & > */ export interface CBFunction extends Function { name: string; } export type IncomingTaskItem = string | CBFunction | Task; export type IncomingInlineArray = { tasks: Array; runMode: TaskRunModes; }; export type TaskCollection = Array; export enum TaskTypes { ExternalTask, Adaptor, TaskGroup, ParentGroup, InlineFunction, } export enum TaskOriginTypes { CrossbowConfig, NpmScripts, FileSystem, Adaptor, InlineFunction, InlineArray, InlineObject, InlineChildObject, } export enum TaskRunModes { series, parallel, } /** * Factory for creating a new Task Item * @param {object} obj * @returns {object} */ export function createTask(obj: any): Task; /** * When a circular reference is detected, exit with the appropriate error */ export function createCircularReferenceTask(incoming: Task, parents: string[]): Task; /** * Match a task name with a top-level value from 'tasks' */ export function getTopLevelValue(baseTaskName: string, input: CrossbowInput): any; /** * Anything that begins @ is always an adaptor and will skip * file i/o etc. * @param taskName * @param parents * @returns {Task} */ export function createAdaptorTask(taskName: any, parents: any): Task; /** * Look at a hash and determine if the incoming 'taskName' * could match a valid taskName. * eg: * $ crossbow run shane * * -> matches: 'shane' & 'shane@p' */ export function maybeTaskNames(tasks: {}, taskName: string): string[]; export function resolveTasks(taskCollection: TaskCollection, trigger: CommandTrigger): Tasks; export interface Task { adaptor?: string; command?: string; valid: boolean; taskName: string; baseTaskName: string; subTasks: string[]; externalTasks: ExternalFile[]; tasks: Task[]; rawInput: string; parents: string[]; errors: TaskError[]; runMode: TaskRunModes; startTime?: number; endTime?: number; duration?: number; query: any; flags: any; options: any; cbflags: string[]; origin: TaskOriginTypes; type: TaskTypes; inlineFunctions: Array; env: any; description: string; skipped: boolean; ifChanged: string[]; } export interface TasknameWithOrigin { items: string[]; origin: TaskOriginTypes; } export interface Tasks { valid: Task[]; invalid: Task[]; all: Task[]; } } declare module "config" { import { TaskRunModes } from "task.resolve"; import { LogLevel } from "reporters/defaultReporter"; import { OutgoingReport } from "reporter.resolve"; import { InitConfigFileTypes } from "command.init"; import { WatchEvent } from "watch.file-watcher"; import { ExternalFile } from "file.utils"; import Rx = require("rx"); export enum SignalTypes { Exit, FileWrite, } export interface CBSignal { type: SignalTypes; data?: T; } export type OutgoingSignals = Rx.Subject>; export interface ExitSignal { code: number; } export interface FileWriteSignal { file: ExternalFile; content: string; } export interface CrossbowConfiguration { cwd: string; runMode: TaskRunModes; verbose: LogLevel; parallel: boolean; fail: boolean; force: boolean; reporter: string; handoff: boolean; input: string[]; interactive: boolean; outputOnly: boolean; suppressOutput: boolean; progress: boolean; cbfile?: string; dump: boolean; envPrefix: string; env: any; before: string[]; type?: InitConfigFileTypes; debug: boolean; reporters: Array; skip: string[]; tasksDir: string[]; nodeModulesPaths: string[]; block?: boolean; debounce?: boolean; throttle?: boolean; fromJson?: string; file?: string; output?: string; dryRun?: boolean; dryRunDuration?: number; outputObserver?: Rx.Observable; fileChangeObserver?: Rx.Observable; signalObserver?: OutgoingSignals; scheduler?: Rx.IScheduler; } /** * Merge default with incoming opts. * Also deal with single char flag * @returns {*} */ export function merge(opts: CrossbowConfiguration | any): CrossbowConfiguration; } declare module "input.resolve" { import { CrossbowInput } from "index"; import { CrossbowConfiguration } from "config"; import * as file from "file.utils"; export enum InputTypes { DefaultExternalFile, ExternalFile, InlineObject, CBFile, InlineJSON, } export interface UserInput { errors: any[]; sources: file.ExternalFileInput[]; type: InputTypes; inputs: CrossbowInput[]; } export function getInputs(config: CrossbowConfiguration, inlineInput?: any): UserInput; /** * `Input` is the object that is looked at to resolve tasks/options and * watchers */ export function generateBaseInput(incoming: CrossbowInput | any): CrossbowInput; } declare module "index" { import { CrossbowConfiguration, OutgoingSignals } from "config"; import { UserInput } from "input.resolve"; import * as reports from "reporter.resolve"; import { OutgoingReporter } from "reporter.resolve"; export interface CLI { input: string[]; flags: any; trailing?: string; command?: string; } export interface CrossbowInput { tasks: any; watch: any; options: any; env?: any; config?: any; } export interface CrossbowReporter { (report: reports.IncomingReport): void; } export interface PreparedInputErrors { type: reports.ReportTypes; } export interface PreparedInput { cli: CLI; config: CrossbowConfiguration; reportFn?: CrossbowReporter; userInput: UserInput; errors: PreparedInputErrors[]; } /** * Handle any type of init. It could be from the CLI, or via the API. * eg, any command from the CLI ultimately ends up in the following call * $ crossbow run task1 -c conf/cb.js * -> handleIncoming({ * input: ['run', 'task1'], * flags: {c: 'conf/cb.js'} * }); */ export function prepareInput(cli: CLI, input?: CrossbowInput | any, outputObserver?: OutgoingReporter, signalObserver?: OutgoingSignals): PreparedInput; /** * This the the proxy that allows command/run mode to be handled * @param preparedInput */ export function handleIncoming(preparedInput: PreparedInput): ReturnType; /** * This is the default export that can be * used as a convenience method. * Note: types are lost when using this method. */ export default function (cli: CLI, input?: CrossbowInput): any; } declare module "command.run.interactive" { import Rx = require("rx"); import { CLI, CrossbowInput, CrossbowReporter } from "index"; import { CrossbowConfiguration } from "config"; import { Task } from "task.resolve"; export interface Answers { tasks: string[]; } export default function prompt(cli: CLI, input: CrossbowInput, config: CrossbowConfiguration, reporter: CrossbowReporter): Rx.Observable; export function getTaskList(tasks: Task[]): { name: any; value: string; }[]; } declare module "command.run.context" { import { Task } from "task.resolve"; import Immutable = require("immutable"); import { CommandTrigger } from "command.run"; import Rx = require("rx"); /** * A task context is just an Immutable Map of key=>value pairs * that may be used to provide addition context to the task running * environment. This is especially useful in situations where you need * to do something that MUST block the task running altogether. An example * would be hashing files/directories to determine if a task/group of tasks should * run. */ export default function getContext(tasks: Task[], trigger: CommandTrigger): Rx.Observable>; } declare module "command.run.execute" { import { CommandTrigger } from "command.run"; import { Tasks } from "task.resolve"; import { SequenceItem } from "task.sequence.factories"; import { Runner } from "task.runner"; import { TaskReport } from "task.runner"; import Rx = require("rx"); import { CrossbowConfiguration } from "config"; import { CLI } from "index"; export enum RunCommandReportTypes { NoTasks, Setup, Complete, TaskReport, } export interface RunCommandSetupErrors { type: RunCommandReportTypes; } export type RunComplete = Rx.Observable; export interface RunActions { setup: RunCommandSetup; update$: Rx.Observable; } export interface RunCommandSetup { tasks?: Tasks; sequence?: SequenceItem[]; errors: RunCommandSetupErrors[]; } export interface RunCommandCompletionReport { tasks: Tasks; sequence: SequenceItem[]; runner: Runner; config: CrossbowConfiguration; reports?: TaskReport[]; decoratedSequence?: SequenceItem[]; runtime?: number; errors: RunCommandSetupErrors[]; taskErrors: TaskReport[]; cli: CLI; } export default function executeRunCommand(trigger: CommandTrigger): RunActions; } declare module "command.run" { import Rx = require("rx"); import { CLI, CrossbowInput, CrossbowReporter } from "index"; import { CrossbowConfiguration } from "config"; import { SequenceItem } from "task.sequence.factories"; import { Tasks } from "task.resolve"; import { Runner } from "task.runner"; import Immutable = require("immutable"); import { RunComplete } from "command.run.execute"; import { WatchEvent } from "watch.file-watcher"; import { Watcher } from "watch.resolve"; export interface CommandTrigger { type: TriggerTypes; cli: CLI; input: CrossbowInput; config: CrossbowConfiguration; tracker?: any; tracker$?: any; shared?: Rx.BehaviorSubject>; reporter: CrossbowReporter; watchEvent?: WatchEvent; watcher?: Watcher; } export interface RunCommandSetup { tasks: Tasks; sequence: SequenceItem[]; runner: Runner; } export enum TriggerTypes { command, watcher, } export function getRunCommandSetup(trigger: CommandTrigger): RunCommandSetup; export default function handleIncomingRunCommand(cli: CLI, input: CrossbowInput, config: CrossbowConfiguration, reporter: CrossbowReporter): RunComplete; } declare module "adaptors/@npm" { import { CommandTrigger } from "command.run"; import { CrossbowConfiguration } from "config"; import { Task } from "task.resolve"; import { EventEmitter } from "events"; export interface CommandOptions { cwd: string; env: any; stdio: any; } export interface CrossbowSpawnError extends Error { code: string; errno: string; syscall: string; file: string; } export interface CBEmitter extends EventEmitter { stdin: any; stdout: any; stderr: any; raw: any; kill: any; } function runCommand(args: string[], options: CommandOptions): CBEmitter; /** * Add the local ./node_modules/.bin directory to the beginning * of the users PATH - this will allow it to find local scripts * @param {process.env} process * @param {Immutable.Map} config * @returns {object} */ function getEnv(process: any, config: CrossbowConfiguration): any; export interface CommandArgs { stringInput?: string; cmd?: string[]; errors: Error[]; } function getArgs(command: string): CommandArgs; export function teardown(emitter: any, task: Task): void; export function getStdio(trigger: CommandTrigger): (string | NodeJS.WritableStream | NodeJS.ReadableStream)[]; export function handleExit(emitter: any, done: any): void; /** * The main export is the function this will be run in the sequence * @returns {Function} */ export default function (task: Task, trigger: CommandTrigger): (opts: any, ctx: any, done: any) => () => void; export { runCommand, getArgs, getEnv }; } declare module "adaptors/@cb" { import { CommandTrigger } from "command.run"; import { Task } from "task.resolve"; export default function (task: Task, trigger: CommandTrigger): (options: any, ctx: any, done: any) => any; } declare module "adaptors" { import { CommandTrigger } from "command.run"; import { Task } from "task.resolve"; const adaptors: { "shell": { validate: () => boolean; create: any; }; "sh": { validate: () => boolean; create: any; }; "bg": { validate: () => boolean; create: any; }; "bgnpm": { validate: () => boolean; create: any; }; "npm": { validate: () => boolean; create: (task: Task, trigger: CommandTrigger) => (opts: any, ctx: any, done: any) => () => void; }; "cb": { validate: () => boolean; create: (task: Task, trigger: CommandTrigger) => (options: any, ctx: any, done: any) => any; }; }; export = adaptors; } declare module "adaptors/@bg" { } declare module "adaptors/@shell" { } declare module "cli.commands" { export interface CommandOption { alias: string[]; description: string; opts: string[]; help: string; } export interface CLICommands { [command: string]: CommandOption; } export const commands: CLICommands; export function twoColFromJson(json: any, rightSidePropertyName: string, leftside?: Function): string; } declare module "cli" { import { CLICommands } from "cli.commands"; import { FlagsOutput } from "cli.parse"; export interface PostCLIParse { cli: FlagsOutput; execute: boolean; output: string[]; } export default function (args: string[]): PostCLIParse; export function getCommand(incoming: string, commands: CLICommands): string[]; } declare module "cb" { import { TaskReport } from "task.runner"; import { RunCommandSetup } from "command.run"; export interface CLIResults { setup: RunCommandSetup; reports: TaskReport[]; timestamp: number; } } declare module "command.run.post-execution" { import { RunCommandCompletionReport } from "command.run.execute"; export function postCliExecution(complete: RunCommandCompletionReport): void; } declare module "command.run.pre-execution" { import { Task } from "task.resolve"; import { CommandTrigger } from "command.run"; import Rx = require("rx"); export function createHashes(tasks: Task[], trigger: CommandTrigger): Rx.Observable<{ [index: string]: any; }>; } declare module "public/create" { import { CBWatchOptions } from "watch.resolve"; import { CrossbowConfiguration } from "config"; import { WatchReport } from "command.watch"; import { CLI } from "index"; import IDisposable = Rx.IDisposable; let input: { tasks: {}; watch: {}; options: {}; env: {}; config: CrossbowConfiguration; cli: CLI; reporter: () => void; }; export const api: { input: { tasks: {}; watch: {}; options: {}; env: {}; config: CrossbowConfiguration; cli: CLI; reporter: () => void; }; env: (obj: any) => void; config: (obj: any) => void; task: (taskname: string) => { options: (hash: any) => void; }; group: (groupName: string, tasks: {}) => void; options: (incoming: {}) => void; watch: (patterns: string[], tasks: string[], options?: CBWatchOptions) => IDisposable; watcher: (patterns: string[], tasks: string[], options?: CBWatchOptions) => Rx.Observable; }; export default input; } declare module "public/index" { } declare module "reporters/error.AdaptorNotFound" { } declare module "reporters/error.CBFlagNotProvided" { } declare module "reporters/error.CircularReference" { } declare module "reporters/error.DocsInputFileNotFound" { } declare module "reporters/error.DocsOutputFileExists" { } declare module "reporters/error.FileTypeNotSupported" { } declare module "reporters/error.HashNotADirectory" { } declare module "reporters/error.HashPathNotFound" { } declare module "reporters/error.InitInputFileExists" { } declare module "reporters/error.InitInputFileTypeNotSupported" { } declare module "reporters/error.InputFileNotFound" { } declare module "reporters/error.InvalidInput" { } declare module "reporters/error.InvalidJson" { } declare module "reporters/error.InvalidTaskInput" { } declare module "reporters/error.InvalidYaml" { } declare module "reporters/error.NoTasksAvailable" { } declare module "reporters/error.NoWatchersAvailable" { } declare module "reporters/error.ReporterFileNotFound" { } declare module "reporters/error.ReporterTypeNotSupported" { } declare module "reporters/error.SubtaskNotFound" { } declare module "reporters/error.SubtaskNotProvided" { } declare module "reporters/error.SubtaskNotProvidedForParent" { } declare module "reporters/error.SubtasksNotInConfig" { } declare module "reporters/error.SubtaskWildcardNotAvailable" { } declare module "reporters/error.TaskNotFound" { } declare module "reporters/error.WatchTaskNameNotFound" { }