forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🤖 Merge PR DefinitelyTyped#64102 Fix types for gulp-if by @stof
All conditions supported by gulp-match are supported by gulp-if. This also describes the optional 4th argument allowing to pass the minimatch options for glob conditions.
- Loading branch information
Showing
4 changed files
with
27 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,23 @@ | ||
// Type definitions for gulp-if | ||
// Type definitions for gulp-if 3.0 | ||
// Project: https://github.com/robrich/gulp-if | ||
// Definitions by: Asana <https://asana.com>, Joe Skeen <https://github.com/joeskeen> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
|
||
/// <reference types="node"/> | ||
/// <reference types="vinyl" /> | ||
|
||
import fs = require('fs'); | ||
import vinyl = require('vinyl'); | ||
import gulpMatch = require('gulp-match'); | ||
import minimatch = require("minimatch"); | ||
|
||
interface GulpIf { | ||
/** | ||
* gulp-if will pipe data to stream whenever condition is truthy. | ||
* If condition is falsey and elseStream is passed, data will pipe to elseStream | ||
* After data is piped to stream or elseStream or neither, data is piped down-stream. | ||
* | ||
* @param condition whether input should be piped to stream | ||
* @param stream the stream to pipe to if condition is true | ||
* @param elseStream (optional) the stream to pipe to if condition is false | ||
*/ | ||
(condition: boolean, stream: NodeJS.ReadWriteStream, elseStream?: NodeJS.ReadWriteStream): NodeJS.ReadWriteStream; | ||
/** | ||
* gulp-if will pipe data to stream whenever condition is truthy. | ||
* If condition is falsey and elseStream is passed, data will pipe to elseStream | ||
* After data is piped to stream or elseStream or neither, data is piped down-stream. | ||
* | ||
* @param condition a Node Stat filter condition to be executed on the vinyl file's Stats object | ||
* @param stream the stream to pipe to if condition is true | ||
* @param elseStream (optional) the stream to pipe to if condition is false | ||
*/ | ||
(condition: StatFilterCondition, stream: NodeJS.ReadWriteStream, elseStream?: NodeJS.ReadWriteStream): NodeJS.ReadWriteStream; | ||
/** | ||
* gulp-if will pipe data to stream whenever condition is truthy. | ||
* If condition is falsey and elseStream is passed, data will pipe to elseStream | ||
* After data is piped to stream or elseStream or neither, data is piped down-stream. | ||
* | ||
* @param condition a function taking a vinyl file and returning a boolean | ||
* @param stream the stream to pipe to if condition is true | ||
* @param elseStream (optional) the stream to pipe to if condition is false | ||
*/ | ||
(condition: (fs: vinyl) => boolean, stream: NodeJS.ReadWriteStream, elseStream?: NodeJS.ReadWriteStream): NodeJS.ReadWriteStream; | ||
/** | ||
* gulp-if will pipe data to stream whenever condition is truthy. | ||
* If condition is falsey and elseStream is passed, data will pipe to elseStream | ||
* After data is piped to stream or elseStream or neither, data is piped down-stream. | ||
* | ||
* @param condition a RegularExpression that works on the file.path | ||
* @param stream the stream to pipe to if condition is true | ||
* @param elseStream (optional) the stream to pipe to if condition is false | ||
*/ | ||
(condition: RegExp, stream: NodeJS.ReadWriteStream, elseStream?: NodeJS.ReadWriteStream): NodeJS.ReadWriteStream; | ||
} | ||
|
||
interface StatFilterCondition { | ||
isDirectory?: boolean | undefined; | ||
isFile?: boolean | undefined; | ||
} | ||
|
||
declare var gulpIf: GulpIf; | ||
/** | ||
* gulp-if will pipe data to stream whenever condition is truthy. | ||
* If condition is falsey and elseStream is passed, data will pipe to elseStream | ||
* After data is piped to stream or elseStream or neither, data is piped down-stream. | ||
* | ||
* @param condition whether input should be piped to stream | ||
* @param stream the stream to pipe to if condition is true | ||
* @param elseStream (optional) the stream to pipe to if condition is false | ||
* @param minimatchOptions (optional) the minimatch options when matching glob conditions | ||
*/ | ||
declare function gulpIf(condition: gulpMatch.MatchCondition, stream: NodeJS.ReadWriteStream, elseStream?: NodeJS.ReadWriteStream, minimatchOptions?: minimatch.IOptions): NodeJS.ReadWriteStream; | ||
|
||
export = gulpIf; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"private": true, | ||
"dependencies": { | ||
"@types/minimatch": "*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
{ | ||
"extends": "@definitelytyped/dtslint/dt.json", | ||
"rules": { | ||
"no-reference-import": false, | ||
"no-trailing-whitespace": false, | ||
"unified-signatures": false | ||
} | ||
"extends": "@definitelytyped/dtslint/dt.json" | ||
} |