/// <reference types="gulp" />
/// <reference types="node" />
import { FSWatcher } from "fs";
import { Gulp, TaskFunction } from "gulp";
import * as typescript from "typescript";
import { CleanOptions } from "../options/clean";
import { CopyOptions } from "../options/copy";
import { CompilerOptionsJson } from "../options/tsc";
import { OutModules } from "../options/typescript";
import { Project, ResolvedProject } from "../project";
import { AbsPosixPath, RelPosixPath } from "../types";
export declare type WatchTaskFunction = (TaskFunction & (() => FSWatcher));
/**
 * Generate a copy task (and the corresponding watch task) for the copy operations described by `copyOptions`
 *
 * @param gulp Gulp instance to use for utility methods.
 * @param srcDir Base directory for source resolution.
 * @param targetDir Base directory for target (build) resolution.
 * @param copyOptions Simple copy operations to apply for this copy task.
 * @return A tuple with the task function and corresponding watch task function.
 */
export declare function getCopy(gulp: Gulp, srcDir: string, targetDir: string, copyOptions: Iterable<CopyOptions>): [TaskFunction, TaskFunction];
export interface TargetBase {
    project: Project;
    /**
     * Name of the target.
     * All the tasks related to this target will be prefixed by this name.
     * It will also be used to resolve the default values for some paths, so it must avoid any special characters.
     */
    name: string;
    /**
     * Relative path to the base directory for the sources, relative to `project.rootDir`.
     * The default value is `project.srcDir`.
     */
    srcDir?: RelPosixPath;
    /**
     * Relative path to the build directory for this target, relative to `project.rootDir`.
     * The default value is `join(project.buildDir, target.name)`.
     */
    buildDir?: RelPosixPath;
    /**
     * Glob patterns for the Typescript sources, relative to `target.srcDir`.
     *
     * It uses the `minimatch` patterns. Glob stars (wild stars, `**`) use `target.srcDir` as their base directory.
     *
     * Default: `[join(target.srcDir, "**", "*.ts")]`
     */
    scripts?: Iterable<string>;
    /**
     * Directory containing custom typings, relative to `project.rootDir`.
     * Custom typings are typings that are not available on `@types`.
     * `null` means that you don't use custom typings.
     * The default value will be `join(target.srcDir, "custom-typings")` if it exists (sync test), else `null`.
     */
    customTypingsDir?: RelPosixPath | null;
    /**
     * Overrides for the options of the Typescript compiler.
     */
    tscOptions?: CompilerOptionsJson;
    /**
     * Output modules.
     *
     * - `Js`: Use the compiler options to emit `*.js` files.
     * - `Mjs`: Enforce `es2015` modules and emit `*.mjs` files.
     * - `Both`: Emit both `*.js` files using the compiler options and `*.mjs` using `es2015`.
     *
     * Default: `Js`
     */
    outModules?: OutModules;
    /**
     * Path to the `tsconfig.json` file for this target, relative to `project.rootDir`.
     * Use `null` to not generate a `tsconfig.json` task.
     *
     * The default value is `join(target.srcDir, "tsconfig.json")`.
     */
    tsconfigJson?: RelPosixPath | null;
    /**
     * Override default dependencies or provide optional dependencies.
     */
    dependencies?: BaseDependencies;
    /**
     * A list of copy operations to perform during the build process.
     *
     * Default: `[]`
     */
    copy?: CopyOptions[];
    /**
     * Minimatch patterns to clean the files create during the `build` and `dist` tasks, relative to `project.root`.
     *
     * Default:
     * {
     *   dirs: [
     *     path.join(project.buildDir, target.targetDir),
     *     path.join(project.distDir, target.targetDir)
     *   ]
     * }
     */
    clean?: CleanOptions;
}
/**
 * Library with fully resolved paths and dependencies.
 */
export interface ResolvedTargetBase extends TargetBase {
    readonly project: ResolvedProject;
    readonly srcDir: AbsPosixPath;
    readonly buildDir: AbsPosixPath;
    readonly scripts: Iterable<string>;
    readonly customTypingsDir: AbsPosixPath | null;
    readonly tscOptions: CompilerOptionsJson;
    readonly outModules: OutModules;
    readonly tsconfigJson: AbsPosixPath | null;
    readonly dependencies: ResolvedBaseDependencies;
    readonly copy?: CopyOptions[];
    readonly clean?: CleanOptions;
}
export interface BaseDependencies {
    readonly typescript?: typeof typescript;
}
/**
 * Fully resolved dependencies, either using defaults or the library provided by the user.
 */
export interface ResolvedBaseDependencies extends BaseDependencies {
    readonly typescript: typeof typescript;
}
/**
 * Resolve absolute paths and dependencies for the provided target.
 *
 * @param target Non-resolved target.
 * @return Resolved target.
 */
export declare function resolveTargetBase(target: TargetBase): ResolvedTargetBase;
/**
 * Adds a display name to the supplied task function and returns the task function.
 *
 * @param name The display name to set.
 * @param task The task function to name.
 * @return The input task, with its `displayName` property set to `name`.
 */
export declare function nameTask<T extends TaskFunction>(name: string, task: T): T & {
    displayName: string;
};
/**
 * Name a task function and register it to the provided gulp instance.
 */
export declare function addTask(gulp: Gulp, displayName: string, task: TaskFunction): TaskFunction;
/**
 * Creates a Vinyl stream source from a Buffer.
 */
export declare function gulpBufferSrc(filename: string, data: Buffer): NodeJS.ReadableStream;
/**
 * Base tasks available for every target.
 */
export interface BaseTasks {
    buildScripts: TaskFunction;
    buildCopy?: TaskFunction;
    build: TaskFunction;
    watch?: TaskFunction;
    clean?: TaskFunction;
    tsconfigJson?: TaskFunction;
}
/**
 * Generates gulp tasks available for every target (base tasks).
 *
 * @param gulp Gulp instance used to generate tasks manipulating files.
 * @param targetOptions Target configuration.
 */
export declare function generateBaseTasks(gulp: Gulp, targetOptions: TargetBase): BaseTasks;
/**
 * Generates and registers gulp tasks available for every target (base tasks).
 *
 * @param gulp Gulp instance where the tasks will be registered.
 * @param targetOptions Target configuration.
 */
export declare function registerBaseTasks(gulp: Gulp, targetOptions: TargetBase): BaseTasks;
