mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 21:00:01 +08:00
[gulp-changed] Add type definitions
This commit is contained in:
19
gulp-changed/gulp-changed-tests.ts
Normal file
19
gulp-changed/gulp-changed-tests.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
/// <reference path="./gulp-changed.d.ts" />
|
||||
/// <reference path="../gulp-minify-html/gulp-minify-html.d.ts" />
|
||||
|
||||
import * as gulp from "gulp";
|
||||
import changed = require("gulp-changed");
|
||||
import minifyHtml = require("gulp-minify-html");
|
||||
|
||||
// Without options
|
||||
gulp.src("*.html")
|
||||
.pipe(changed("build"))
|
||||
.pipe(minifyHtml())
|
||||
.pipe(gulp.dest("build"));
|
||||
|
||||
// Without some options
|
||||
gulp.src("*.html")
|
||||
.pipe(changed("build", { hasChanged: changed.compareSha1Digest }))
|
||||
.pipe(minifyHtml())
|
||||
.pipe(gulp.dest("build"));
|
||||
60
gulp-changed/gulp-changed.d.ts
vendored
Normal file
60
gulp-changed/gulp-changed.d.ts
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
// Type definitions for gulp-changed
|
||||
// Project: https://github.com/sindresorhus/gulp-changed
|
||||
// Definitions by: Thomas Corbière <https://github.com/tomc974>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
/// <reference path="../vinyl/vinyl.d.ts"/>
|
||||
|
||||
declare module "gulp-changed"
|
||||
{
|
||||
import { Transform } from "stream";
|
||||
import File = require("vinyl");
|
||||
|
||||
interface IComparator
|
||||
{
|
||||
/**
|
||||
* @param stream Should be used to queue sourceFile if it passes some comparison
|
||||
* @param callback Should be called when done
|
||||
* @param sourceFile File to operate on
|
||||
* @param destPath Destination for sourceFile as an absolute path
|
||||
*/
|
||||
(stream: Transform, callback: Function, sourceFile: File, destPath: string): void;
|
||||
}
|
||||
|
||||
interface IDestination
|
||||
{
|
||||
(file: string|Buffer): string;
|
||||
}
|
||||
|
||||
interface IOptions
|
||||
{
|
||||
/**
|
||||
* The working directory the folder is relative to.
|
||||
* @default process.cwd()
|
||||
*/
|
||||
cwd?: string;
|
||||
|
||||
/**
|
||||
* Extension of the destination files.
|
||||
*/
|
||||
extension?: string;
|
||||
|
||||
/**
|
||||
* Function that determines whether the source file is different from the destination file.
|
||||
* @default changed.compareLastModifiedTime
|
||||
*/
|
||||
hasChanged?: IComparator;
|
||||
}
|
||||
|
||||
interface IGulpChanged
|
||||
{
|
||||
(destination: string|IDestination, options?: IOptions): NodeJS.ReadWriteStream;
|
||||
|
||||
compareLastModifiedTime: IComparator;
|
||||
compareSha1Digest: IComparator;
|
||||
}
|
||||
|
||||
const changed: IGulpChanged;
|
||||
export = changed;
|
||||
}
|
||||
Reference in New Issue
Block a user