UNPKG

1.71 kBTypeScriptView Raw
1// Type definitions for gulp-changed
2// Project: https://github.com/sindresorhus/gulp-changed
3// Definitions by: Thomas Corbière <https://github.com/tomc974>, Jordy van Dortmont <https://github.com/jordyvandortmont>
4// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5
6/// <reference types="node"/>
7/// <reference types="vinyl" />
8
9import { Transform } from "stream";
10import File = require("vinyl");
11
12interface IComparator {
13 /**
14 * @param stream Should be used to queue sourceFile if it passes some comparison
15 * @param sourceFile File to operate on
16 * @param destPath Destination for sourceFile as an absolute path
17 */
18 (stream: Transform, sourceFile: File, destPath: string): void;
19}
20
21interface IDestination {
22 (file: string | Buffer): string;
23}
24
25interface IOptions {
26 /**
27 * The working directory the folder is relative to.
28 * @default process.cwd()
29 */
30 cwd?: string | undefined;
31
32 /**
33 * Extension of the destination files.
34 */
35 extension?: string | undefined;
36
37 /**
38 * Function that determines whether the source file is different from the destination file.
39 * @default changed.compareLastModifiedTime
40 */
41 hasChanged?: IComparator | undefined;
42
43 /**
44 * Function to transform the path to the destination file. Should return the absolute path to the (renamed) destination file.
45 */
46 transformPath?: ((destPath: string) => string) | undefined;
47}
48
49interface IGulpChanged {
50 (destination: string | IDestination, options?: IOptions): NodeJS.ReadWriteStream;
51
52 compareLastModifiedTime: IComparator;
53 compareContents: IComparator;
54}
55
56declare const changed: IGulpChanged;
57export = changed;
58
\No newline at end of file