From 8a2c516274fd6f51c150a8ea5bb365fc0d30e23b Mon Sep 17 00:00:00 2001 From: PhilKunz Date: Wed, 19 Oct 2016 01:10:45 +0200 Subject: [PATCH] switched to ES6 default import --- README.md | 4 +- dist/index.d.ts | 4 ++ dist/index.js | 6 ++- test/test.d.ts | 2 +- test/test.js | 112 ++++++++++++++++++++++++------------------------ test/test.ts | 96 ++++++++++++++++++++--------------------- ts/index.ts | 4 +- 7 files changed, 118 insertions(+), 110 deletions(-) diff --git a/README.md b/README.md index d6f4c12..b14784d 100644 --- a/README.md +++ b/README.md @@ -19,8 +19,8 @@ accepts call to execute in gulp pipeline. ### Usage ```javascript -let gulp = require("gulp"); -let gulpFunction = require("gulp-function"); +import * as gulp from 'gulp'; +import gulpFunction from 'gulp-function' // default ES6 export let Q = require("q"); let myFunction = function (file, enc) { // file and enc are optional in case you want to modify the file object diff --git a/dist/index.d.ts b/dist/index.d.ts index 09731ee..79dfac2 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -1,5 +1,9 @@ +/// import 'typings-global'; +import { Transform } from 'stream'; export declare type TExecutionMode = 'forEach' | 'forFirst' | 'atEnd'; export interface IPromiseFunction { (file?: any, enc?: any): PromiseLike; } +declare let mainExportFunction: (functionsToExecuteArg: IPromiseFunction | IPromiseFunction[], executionModeArg?: TExecutionMode) => Transform; +export default mainExportFunction; diff --git a/dist/index.js b/dist/index.js index 99ebd8e..4f8e791 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2,7 +2,7 @@ require("typings-global"); const q = require("q"); const through2 = require("through2"); -module.exports = (functionsToExecuteArg, executionModeArg = 'forEach') => { +let mainExportFunction = (functionsToExecuteArg, executionModeArg = 'forEach') => { let promiseArray = []; let runFunction = function (functionArg, file, enc) { let returnValue = functionArg(file, enc); @@ -63,4 +63,6 @@ module.exports = (functionsToExecuteArg, executionModeArg = 'forEach') => { }; return through2.obj(forEach, atEnd); }; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJ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ksQ0FBQTtnQkFDdEIsS0FBSyxDQUFBO1lBQ1QsS0FBSyxPQUFPO2dCQUNSLEVBQUUsQ0FBQyxJQUFJLEVBQUUsSUFBSSxDQUFDLENBQUE7Z0JBQ2QsS0FBSyxDQUFBO1lBQ1Q7Z0JBQ0ksS0FBSyxDQUFBO1FBQ2IsQ0FBQztJQUNMLENBQUMsQ0FBQTtJQUVELElBQUksS0FBSyxHQUFHLFVBQVUsRUFBRTtRQUNwQixFQUFFLENBQUMsQ0FBQyxnQkFBZ0IsS0FBSyxPQUFPLENBQUMsQ0FBQyxDQUFDO1lBQy9CLG1CQUFtQixDQUFDLElBQUksRUFBRSxJQUFJLENBQUMsQ0FBQyxJQUFJLENBQUM7Z0JBQ2pDLEVBQUUsRUFBRSxDQUFBO1lBQ1IsQ0FBQyxDQUFDLENBQUE7UUFDTixDQUFDO1FBQUMsSUFBSSxDQUFDLENBQUM7WUFDSixFQUFFLEVBQUUsQ0FBQTtRQUNSLENBQUM7SUFDTCxDQUFDLENBQUE7SUFDRCxNQUFNLENBQUMsUUFBUSxDQUFDLEdBQUcsQ0FBQyxPQUFPLEVBQUUsS0FBSyxDQUFDLENBQUE7QUFDdkMsQ0FBQyxDQUFBIn0= \ No newline at end of file +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = mainExportFunction; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXVCO0FBQ3ZCLHVCQUFzQjtBQUN0QixxQ0FBb0M7QUFTcEMsSUFBSSxrQkFBa0IsR0FBRyxDQUNyQixxQkFBNEQsRUFDNUQsZ0JBQWdCLEdBQW1CLFNBQVM7SUFHNUMsSUFBSSxZQUFZLEdBQUcsRUFBRSxDQUFBO0lBQ3JCLElBQUksV0FBVyxHQUFHLF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SSxDQUFDLENBQUMsSUFBSSxDQUFDO2dCQUNqQyxFQUFFLEVBQUUsQ0FBQTtZQUNSLENBQUMsQ0FBQyxDQUFBO1FBQ04sQ0FBQztRQUFDLElBQUksQ0FBQyxDQUFDO1lBQ0osRUFBRSxFQUFFLENBQUE7UUFDUixDQUFDO0lBQ0wsQ0FBQyxDQUFBO0lBQ0QsTUFBTSxDQUFDLFFBQVEsQ0FBQyxHQUFHLENBQUMsT0FBTyxFQUFFLEtBQUssQ0FBQyxDQUFBO0FBQ3ZDLENBQUMsQ0FBQTs7QUFFRCxrQkFBZSxrQkFBa0IsQ0FBQSJ9 \ No newline at end of file diff --git a/test/test.d.ts b/test/test.d.ts index e7cc8ee..2fd432a 100644 --- a/test/test.d.ts +++ b/test/test.d.ts @@ -1 +1 @@ -import "typings-test"; +import 'typings-test'; diff --git a/test/test.js b/test/test.js index 1c741cd..37c3465 100644 --- a/test/test.js +++ b/test/test.js @@ -1,102 +1,102 @@ "use strict"; require("typings-test"); -var gulp = require("gulp"); -var gulpFunction = require("../dist/index.js"); -var beautylog = require("beautylog"); -var Q = require("q"); -var myFunction = function () { - var done = Q.defer(); - beautylog.log("Function executed"); +let gulp = require('gulp'); +const index_1 = require("../dist/index"); +let beautylog = require('beautylog'); +let Q = require('q'); +let myFunction = function () { + let done = Q.defer(); + beautylog.log('Function executed'); done.resolve(); return done.promise; }; -var myFunction2 = function () { - var done = Q.defer(); - beautylog.ok("Function2 executed"); +let myFunction2 = function () { + let done = Q.defer(); + beautylog.ok('Function2 executed'); done.resolve(); return done.promise; }; -var myFunction3 = function () { - var done = Q.defer(); - beautylog.success("Function3 executed"); +let myFunction3 = function () { + let done = Q.defer(); + beautylog.success('Function3 executed'); done.resolve(); return done.promise; }; -var beforeFunction = function () { - var done = Q.defer(); - beautylog.success("beforeFunction executed"); +let beforeFunction = function () { + let done = Q.defer(); + beautylog.success('beforeFunction executed'); done.resolve(); return done.promise; }; -var middleFunctionRun = false; -var middleFunction = function () { - var done = Q.defer(); - beautylog.success("middleFunction executed"); +let middleFunctionRun = false; +let middleFunction = function () { + let done = Q.defer(); + beautylog.success('middleFunction executed'); setTimeout(function () { - beautylog.log("timeout fired"); + beautylog.log('timeout fired'); middleFunctionRun = true; done.resolve(); }, 500); return done.promise; }; -var afterFunction = function () { - var done = Q.defer(); - beautylog.success("afterFunction executed"); +let afterFunction = function () { + let done = Q.defer(); + beautylog.success('afterFunction executed'); done.resolve(); return done.promise; }; let timeoutFunction = function () { - var done = Q.defer(); + let done = Q.defer(); setTimeout(function () { - beautylog.log("largeTimeout fired"); + beautylog.log('largeTimeout fired'); done.resolve(); }, 2000); return done.promise; }; -describe("gulpFunction", function () { - it("should run through smoothly with " + "'forEach'".blue, function (done) { +describe('gulpFunction', function () { + it('should run through smoothly with ' + "'forEach'", function (done) { gulp.src('./test/*.md') - .pipe(gulpFunction(myFunction, 'forEach')) - .pipe(gulp.dest("./test/result/")); + .pipe(index_1.default(myFunction, 'forEach')) + .pipe(gulp.dest('./test/result/')); gulp.src('./test/*.md') - .pipe(gulpFunction([myFunction2, myFunction3], 'forEach')) - .pipe(gulp.dest("./test/result/")) - .pipe(gulpFunction(done, "atEnd")); + .pipe(index_1.default([myFunction2, myFunction3], 'forEach')) + .pipe(gulp.dest('./test/result/')) + .pipe(index_1.default(done, 'atEnd')); }); - it("should run through smoothly with " + "'atEnd'".blue, function (done) { + it('should run through smoothly with ' + "'atEnd'", function (done) { gulp.src('./test/*.md') - .pipe(gulpFunction(myFunction, 'atEnd')) - .pipe(gulp.dest("./test/result/")); + .pipe(index_1.default(myFunction, 'atEnd')) + .pipe(gulp.dest('./test/result/')); gulp.src('./test/*.md') - .pipe(gulpFunction([myFunction2, myFunction3], 'atEnd')) - .pipe(gulp.dest("./test/result/")) - .pipe(gulpFunction(done, "atEnd")); + .pipe(index_1.default([myFunction2, myFunction3], 'atEnd')) + .pipe(gulp.dest('./test/result/')) + .pipe(index_1.default(done, 'atEnd')); }); - it("should run through smoothly once with " + "'atFirst'".blue, function (done) { + it('should run through smoothly once with ' + "'atFirst'", function (done) { gulp.src('./test/*.md') - .pipe(gulpFunction([myFunction2, myFunction3], 'forFirst')) - .pipe(gulp.dest("./test/result/")) - .pipe(gulpFunction(done, "atEnd")); + .pipe(index_1.default([myFunction2, myFunction3], 'forFirst')) + .pipe(gulp.dest('./test/result/')) + .pipe(index_1.default(done, 'atEnd')); }); - it("should run in order", function (done) { + it('should run in order', function (done) { this.timeout(5000); let stream = gulp.src('./test/*.md') - .pipe(gulpFunction([beforeFunction, middleFunction, middleFunction], 'atEnd')) - .pipe(gulpFunction(function () { - beautylog.log("stream progressed"); - var done2 = Q.defer(); + .pipe(index_1.default([beforeFunction, middleFunction, middleFunction], 'atEnd')) + .pipe(index_1.default(function () { + beautylog.log('stream progressed'); + let done2 = Q.defer(); done2.resolve(); return done2.promise; - }, "forEach")) - .pipe(gulpFunction(function () { - beautylog.log("nextStep"); + }, 'forEach')) + .pipe(index_1.default(function () { + beautylog.log('nextStep'); })) - .pipe(gulpFunction(afterFunction, "atEnd")) - .pipe(gulpFunction(timeoutFunction, "atEnd")); - stream.on("finish", function () { - beautylog.info("stream finished"); + .pipe(index_1.default(afterFunction, 'atEnd')) + .pipe(index_1.default(timeoutFunction, 'atEnd')); + stream.on('finish', function () { + beautylog.info('stream finished'); done(); }); }); }); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHdCQUFxQjtBQUNyQixJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsTUFBTSxDQUFDLENBQUM7QUFDM0IsSUFBSSxZQUFZLEdBQUcsT0FBTyxDQUFDLGtCQUFrQixDQUFDLENBQUM7QUFDL0MsSUFBSSxTQUFTLEdBQUcsT0FBTyxDQUFDLFdBQVcsQ0FBQyxDQUFD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DQUFDLENBQUM7YUFDekMsSUFBSSxDQUFDLGVBQVksQ0FBQyxlQUFlLEVBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQztRQUVqRCxNQUFNLENBQUMsRUFBRSxDQUFDLFFBQVEsRUFBQztZQUNmLFNBQVMsQ0FBQyxJQUFJLENBQUMsaUJBQWlCLENBQUMsQ0FBQztZQUNsQyxJQUFJLEVBQUUsQ0FBQztRQUNYLENBQUMsQ0FBQyxDQUFDO0lBQ1AsQ0FBQyxDQUFDLENBQUM7QUFDUCxDQUFDLENBQUMsQ0FBQyJ9 \ No newline at end of file diff --git a/test/test.ts b/test/test.ts index 678ce43..0c2a1dc 100644 --- a/test/test.ts +++ b/test/test.ts @@ -1,59 +1,59 @@ -import "typings-test" -var gulp = require("gulp"); -var gulpFunction = require("../dist/index.js"); -var beautylog = require("beautylog"); -var Q = require("q"); +import 'typings-test' +let gulp = require('gulp'); +import gulpFunction from '../dist/index' +let beautylog = require('beautylog') +let Q = require('q') -var myFunction = function () { - var done = Q.defer() - beautylog.log("Function executed"); +let myFunction = function () { + let done = Q.defer() + beautylog.log('Function executed'); done.resolve(); return done.promise; }; -var myFunction2 = function () { - var done = Q.defer(); - beautylog.ok("Function2 executed"); +let myFunction2 = function () { + let done = Q.defer(); + beautylog.ok('Function2 executed'); done.resolve(); return done.promise; }; -var myFunction3 = function () { - var done = Q.defer(); - beautylog.success("Function3 executed"); +let myFunction3 = function () { + let done = Q.defer(); + beautylog.success('Function3 executed'); done.resolve(); return done.promise; }; -var beforeFunction = function () { - var done = Q.defer(); - beautylog.success("beforeFunction executed"); +let beforeFunction = function () { + let done = Q.defer(); + beautylog.success('beforeFunction executed'); done.resolve(); return done.promise; }; -var middleFunctionRun = false; +let middleFunctionRun = false; -var middleFunction = function () { - var done = Q.defer(); - beautylog.success("middleFunction executed"); +let middleFunction = function () { + let done = Q.defer(); + beautylog.success('middleFunction executed'); setTimeout(function(){ - beautylog.log("timeout fired"); + beautylog.log('timeout fired'); middleFunctionRun = true; done.resolve(); }, 500); return done.promise; }; -var afterFunction = function () { - var done = Q.defer(); - beautylog.success("afterFunction executed"); +let afterFunction = function () { + let done = Q.defer(); + beautylog.success('afterFunction executed'); done.resolve(); return done.promise; }; let timeoutFunction = function(){ - var done = Q.defer(); + let done = Q.defer(); setTimeout(function(){ - beautylog.log("largeTimeout fired"); + beautylog.log('largeTimeout fired'); done.resolve(); },2000); return done.promise; @@ -61,56 +61,56 @@ let timeoutFunction = function(){ -describe("gulpFunction",function(){ - it("should run through smoothly with " + "'forEach'".blue,function(done){ +describe('gulpFunction',function(){ + it('should run through smoothly with ' + "'forEach'",function(done){ gulp.src('./test/*.md') .pipe(gulpFunction(myFunction,'forEach')) - .pipe(gulp.dest("./test/result/")); + .pipe(gulp.dest('./test/result/')); gulp.src('./test/*.md') .pipe(gulpFunction([myFunction2,myFunction3],'forEach')) - .pipe(gulp.dest("./test/result/")) - .pipe(gulpFunction(done,"atEnd")); + .pipe(gulp.dest('./test/result/')) + .pipe(gulpFunction(done,'atEnd')); }); - it("should run through smoothly with " + "'atEnd'".blue,function(done){ + it('should run through smoothly with ' + "'atEnd'",function(done){ gulp.src('./test/*.md') .pipe(gulpFunction(myFunction,'atEnd')) - .pipe(gulp.dest("./test/result/")); + .pipe(gulp.dest('./test/result/')); gulp.src('./test/*.md') .pipe(gulpFunction([myFunction2,myFunction3],'atEnd')) - .pipe(gulp.dest("./test/result/")) - .pipe(gulpFunction(done,"atEnd")); + .pipe(gulp.dest('./test/result/')) + .pipe(gulpFunction(done,'atEnd')); }); - it("should run through smoothly once with " + "'atFirst'".blue,function(done){ + it('should run through smoothly once with ' + "'atFirst'",function(done){ gulp.src('./test/*.md') .pipe(gulpFunction([myFunction2,myFunction3],'forFirst')) - .pipe(gulp.dest("./test/result/")) - .pipe(gulpFunction(done,"atEnd")); + .pipe(gulp.dest('./test/result/')) + .pipe(gulpFunction(done,'atEnd')); }); - it("should run in order",function(done){ + it('should run in order',function(done){ this.timeout(5000); let stream = gulp.src('./test/*.md') .pipe(gulpFunction([beforeFunction,middleFunction,middleFunction],'atEnd')) .pipe(gulpFunction(function(){ - beautylog.log("stream progressed"); - var done2 = Q.defer(); + beautylog.log('stream progressed'); + let done2 = Q.defer(); done2.resolve(); return done2.promise; - },"forEach")) + },'forEach')) .pipe(gulpFunction(function(){ - beautylog.log("nextStep"); + beautylog.log('nextStep'); })) - .pipe(gulpFunction(afterFunction,"atEnd")) - .pipe(gulpFunction(timeoutFunction,"atEnd")); + .pipe(gulpFunction(afterFunction,'atEnd')) + .pipe(gulpFunction(timeoutFunction,'atEnd')); - stream.on("finish",function(){ - beautylog.info("stream finished"); + stream.on('finish',function(){ + beautylog.info('stream finished'); done(); }); }); diff --git a/ts/index.ts b/ts/index.ts index 302f00c..e30f44e 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -9,7 +9,7 @@ export interface IPromiseFunction { (file?, enc?): PromiseLike } -module.exports = ( +let mainExportFunction = ( functionsToExecuteArg: IPromiseFunction | IPromiseFunction[], executionModeArg: TExecutionMode = 'forEach' ): Transform => { @@ -73,3 +73,5 @@ module.exports = ( } return through2.obj(forEach, atEnd) } + +export default mainExportFunction