From 44fdc4c19b75a5b6018ad4553898154136719fbe Mon Sep 17 00:00:00 2001 From: tkQubo Date: Mon, 24 Aug 2015 22:14:13 +0900 Subject: [PATCH] Add vinyl-paths --- vinyl-paths/vinyl-paths-tests.ts | 26 ++++++++++++++++++++++++++ vinyl-paths/vinyl-paths.d.ts | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 vinyl-paths/vinyl-paths-tests.ts create mode 100644 vinyl-paths/vinyl-paths.d.ts diff --git a/vinyl-paths/vinyl-paths-tests.ts b/vinyl-paths/vinyl-paths-tests.ts new file mode 100644 index 0000000000..e369dcb645 --- /dev/null +++ b/vinyl-paths/vinyl-paths-tests.ts @@ -0,0 +1,26 @@ +/// +/// +/// + +import gulp = require('gulp'); +import del = require('del'); +import paths = require('vinyl-paths'); + +gulp.task('delete', function () { + return gulp.src('app/*') + .pipe(paths(del)); +}); + +// or if you need to use the paths after the pipeline +gulp.task('delete2', function (cb: Function) { + var vp = paths(); + + gulp.src('app/*') + .pipe(vp) + .pipe(gulp.dest('dist')) + .on('end', function () { + del(vp.paths, cb); + }); +}); + + diff --git a/vinyl-paths/vinyl-paths.d.ts b/vinyl-paths/vinyl-paths.d.ts new file mode 100644 index 0000000000..681601eb9f --- /dev/null +++ b/vinyl-paths/vinyl-paths.d.ts @@ -0,0 +1,32 @@ +// Type definitions for vinyl-paths +// Project: https://github.com/sindresorhus/vinyl-paths +// Definitions by: Qubo +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "vinyl-paths" { + + namespace paths { + interface Paths extends NodeJS.ReadWriteStream { + paths: string[]; + } + + interface PathsStatic { + /** + * Use the file paths from a gulp pipeline in vanilla node module + * @param callback The optionally supplied callback will get a file path for every file and is expected + * to call the callback when done. An array of the file paths so far is available as a paths property + * on the stream. + */ + (callback?: Callback): Paths; + } + + interface Callback { + //TODO: Function is gulp.ITaskCallback, which is currently invisible + (path: string, callback: Function): any; + } + } + + var paths: paths.PathsStatic; + export = paths; +} +