diff --git a/README.md b/README.md index c8a1e22..d464be5 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,14 @@ gulp.task('gulpTest',function() { }); ``` -> Note: The first argument of gulpFunction can also be an array of multiple functionnames. +### Notes: + +* The first argument of gulpFunction can also be an **array of multiple functionnames**. Each function can return a promise. the pipe stop will finish when every promise is fullfilled. -> Note: the second argument can be empty, "forEach" (default), "forFirst" or "atEnd"; \ No newline at end of file +* the second argument can be empty, it defaults to "forEach" +* the following options are available: + * "forFirst" - executes when first chunk/vinylfile of the stream reaches the pipestop. + file is pushed further down the line when function's returned promise is fullfilled. + * "atEnd" - executes like "forFirst" but with every chunk/vinylfile in the stream; + * "atLast" - executes after all chunks have passed and are processed in full. + That means the stream's "finish" event fires before "atLast" is executed!!! \ No newline at end of file diff --git a/dist/gulpfunction.plugins.js b/dist/gulpfunction.plugins.js new file mode 100644 index 0000000..4beeb7d --- /dev/null +++ b/dist/gulpfunction.plugins.js @@ -0,0 +1,6 @@ +/// +"use strict"; +exports.Q = require("q"); +exports.through2 = require("through2"); + +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImd1bHBmdW5jdGlvbi5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDBDQUEwQzs7QUFFL0IsU0FBQyxHQUFHLE9BQU8sQ0FBQyxHQUFHLENBQUMsQ0FBQztBQUNqQixnQkFBUSxHQUFHLE9BQU8sQ0FBQyxVQUFVLENBQUMsQ0FBQyIsImZpbGUiOiJndWxwZnVuY3Rpb24ucGx1Z2lucy5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8vLyA8cmVmZXJlbmNlIHBhdGg9XCJ0eXBpbmdzL21haW4uZC50c1wiIC8+XG5cbmV4cG9ydCBsZXQgUSA9IHJlcXVpcmUoXCJxXCIpO1xuZXhwb3J0IGxldCB0aHJvdWdoMiA9IHJlcXVpcmUoXCJ0aHJvdWdoMlwiKTtcbiJdLCJzb3VyY2VSb290IjoiL3NvdXJjZS8ifQ== diff --git a/dist/index.js b/dist/index.js index ccb1850..fd2a237 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,9 +1,6 @@ /// -var plugins = { - beautylog: require("beautylog"), - Q: require("q"), - through: require("through2") -}; +"use strict"; +var plugins = require("./gulpfunction.plugins"); module.exports = function (functionsToExecuteArg, executionModeArg) { if (executionModeArg === void 0) { executionModeArg = 'forEach'; } //important vars @@ -26,7 +23,7 @@ module.exports = function (functionsToExecuteArg, executionModeArg) { } } else { - plugins.beautylog.error('gulp-callfunction: something is strange with the given arguments'); + throw new Error("gulp-callfunction: something is strange with the given arguments"); } return plugins.Q.all(promiseArray); }; @@ -61,7 +58,7 @@ module.exports = function (functionsToExecuteArg, executionModeArg) { cb(); } }; - return plugins.through.obj(forEach, atEnd); + return plugins.through2.obj(forEach, atEnd); }; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDBDQUEwQztBQUUxQyxJQUFJLE9BQU8sR0FBRztJQUNWLFNBQVMsRUFBRSxPQUFPLENBQUMsV0FBVyxDQUFDO0lBQy9CLENBQUMsRUFBRSxPQUFPLENBQUMsR0FBRyxDQUFDO0lBQ2YsT0FBTyxFQUFFLE9BQU8sQ0FBQyxVQUFVLENBQUM7Q0FDL0IsQ0FBQTtBQUtELE1BQU0sQ0FBQyxPQUFPLEdBQUcsVUFBVSxxQkFBK0IsRUFBQyxnQkFBbUM7SUFBbkMsZ0NBQW1DLEdBQW5DLDRCQUFtQztJQUMxRixnQkFBZ0I7SUFDaEIsSUFBSSxhQUFhLEdBQUcsZ0JBQWdCLENBQUMsQ0FBQyx5QkFBeUI7SUFDL0QsSUFBSSxrQkFBa0IsR0FBRyxxQkFBcUIsQ0FBQztJQUMvQyxJQUFJLFlBQVksR0FBRyxFQUFFLENBQUM7SUFDdEIsSU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b3JGaXJzdFwiOlxuICAgICAgICAgICAgICAgICFoYXNFeGVjdXRlZE9uY2UgPyBjaGVja0FuZFJ1bkZ1bmN0aW9uKCkudGhlbihmdW5jdGlvbigpe1xuICAgICAgICAgICAgICAgICAgICBjYihudWxsLCBmaWxlKTtcbiAgICAgICAgICAgICAgICB9KSA6IGNiKG51bGwsIGZpbGUpO1xuICAgICAgICAgICAgICAgIGhhc0V4ZWN1dGVkT25jZSA9IHRydWU7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFwiYXRFbmRcIjpcbiAgICAgICAgICAgICAgICBjYihudWxsLCBmaWxlKTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIH1cbiAgICB9O1xuXG4gICAgbGV0IGF0RW5kID0gZnVuY3Rpb24oY2IpIHtcbiAgICAgICAgaWYgKGV4ZWN1dGlvbk1vZGUgPT09IFwiYXRFbmRcIikge1xuICAgICAgICAgICAgY2hlY2tBbmRSdW5GdW5jdGlvbigpLnRoZW4oZnVuY3Rpb24oKXtcbiAgICAgICAgICAgICAgICBjYigpO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBjYigpO1xuICAgICAgICB9XG4gICAgfTtcbiAgICByZXR1cm4gcGx1Z2lucy50aHJvdWdoLm9iaihmb3JFYWNoLGF0RW5kKTtcbn07XG4iXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0= +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDBDQUEwQzs7QUFFMUMsSUFBTyxPQUFPLFdBQVcsd0JBQXdCLENBQUMsQ0FBQztBQUtuRCxNQUFNLENBQUMsT0FBTyxHQUFHLFVBQVUscUJBQStCLE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ZnVuY3Rpb24oKXtcbiAgICAgICAgICAgICAgICAgICAgY2IobnVsbCwgZmlsZSk7XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIFwiZm9yRmlyc3RcIjpcbiAgICAgICAgICAgICAgICAhaGFzRXhlY3V0ZWRPbmNlID8gY2hlY2tBbmRSdW5GdW5jdGlvbigpLnRoZW4oZnVuY3Rpb24oKXtcbiAgICAgICAgICAgICAgICAgICAgY2IobnVsbCwgZmlsZSk7XG4gICAgICAgICAgICAgICAgfSkgOiBjYihudWxsLCBmaWxlKTtcbiAgICAgICAgICAgICAgICBoYXNFeGVjdXRlZE9uY2UgPSB0cnVlO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBcImF0RW5kXCI6XG4gICAgICAgICAgICAgICAgY2IobnVsbCwgZmlsZSk7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICB9XG4gICAgfTtcblxuICAgIGxldCBhdEVuZCA9IGZ1bmN0aW9uKGNiKSB7XG4gICAgICAgIGlmIChleGVjdXRpb25Nb2RlID09PSBcImF0RW5kXCIpIHtcbiAgICAgICAgICAgIGNoZWNrQW5kUnVuRnVuY3Rpb24oKS50aGVuKGZ1bmN0aW9uKCl7XG4gICAgICAgICAgICAgICAgY2IoKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgY2IoKTtcbiAgICAgICAgfVxuICAgIH07XG4gICAgcmV0dXJuIHBsdWdpbnMudGhyb3VnaDIub2JqKGZvckVhY2gsYXRFbmQpO1xufTtcbiJdLCJzb3VyY2VSb290IjoiL3NvdXJjZS8ifQ== diff --git a/ts/gulpfunction.plugins.ts b/ts/gulpfunction.plugins.ts new file mode 100644 index 0000000..fa6a315 --- /dev/null +++ b/ts/gulpfunction.plugins.ts @@ -0,0 +1,4 @@ +/// + +export let Q = require("q"); +export let through2 = require("through2"); diff --git a/ts/index.ts b/ts/index.ts index 91396fe..42143b1 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -1,10 +1,6 @@ /// -var plugins = { - beautylog: require("beautylog"), - Q: require("q"), - through: require("through2") -} +import plugins = require("./gulpfunction.plugins"); @@ -29,7 +25,7 @@ module.exports = function (functionsToExecuteArg:any|any[],executionModeArg:stri runFunction(functionsToExecute[anyFunction]); } } else { - plugins.beautylog.error('gulp-callfunction: something is strange with the given arguments'); + throw new Error("gulp-callfunction: something is strange with the given arguments"); } return plugins.Q.all(promiseArray); }; @@ -65,5 +61,5 @@ module.exports = function (functionsToExecuteArg:any|any[],executionModeArg:stri cb(); } }; - return plugins.through.obj(forEach,atEnd); + return plugins.through2.obj(forEach,atEnd); };