gulp-process-env
Advanced tools
Comparing version 0.0.1 to 0.0.2
13
index.js
@@ -17,10 +17,11 @@ 'use strict'; | ||
var spy = require('through2-spy'); | ||
var _require = require('through2'); | ||
var noop = function noop() {}; | ||
var through = _require.obj; | ||
var privates = new _weakMap2.default(); | ||
module.exports = function (environment, fn) { | ||
var stream = spy.obj(function () { | ||
var stream = through(function (chunk, enc, next) { | ||
if (!privates.get(environment)) { | ||
@@ -34,6 +35,9 @@ var env = (0, _keys2.default)(environment).reduce(function (memo, k) { | ||
} | ||
next(null, chunk); | ||
}); | ||
return (0, _extends3.default)(stream, { | ||
restore: function restore() { | ||
return spy.obj(noop).once('finish', function () { | ||
return through(function (chunk, env, next) { | ||
return next(null, chunk); | ||
}, function (flush) { | ||
var _privates$get = privates.get(environment); | ||
@@ -55,2 +59,3 @@ | ||
} | ||
flush(); | ||
}); | ||
@@ -57,0 +62,0 @@ } |
{ | ||
"name": "gulp-process-env", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "set and restore process environment variables for gulp streams", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "./node_modules/gulp spec" | ||
"test": "./node_modules/.bin/gulp" | ||
}, | ||
@@ -52,4 +52,4 @@ "repository": { | ||
"babel-runtime": "^6.3.19", | ||
"through2-spy": "^2.0.0" | ||
"through2": "^2.0.1" | ||
} | ||
} |
# gulp-process-env | ||
[![Build Status](https://travis-ci.org/rdy/gulp-process-env.svg?branch=master)](https://travis-ci.org/rdy/gulp-process-env) | ||
@@ -3,0 +4,0 @@ A utility to allow setting and restoring of environment variables for streams, specifically with gulp. |
4770
46
16
+ Addedthrough2@^2.0.1
- Removedthrough2-spy@^2.0.0
- Removedthrough2-spy@2.0.0(transitive)