diff options
author | Forrest L Norvell <forrest@npmjs.com> | 2015-10-15 08:17:03 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2015-10-16 01:25:33 +0300 |
commit | 25a234b4595ee3f1a2c09e2a39e3c238aa642557 (patch) | |
tree | def772e3c15c7bd3d0b05eeeb6069898617cbf23 /node_modules/mute-stream/mute.js | |
parent | 4cd74b0cdc639081fcf292eb9a03dbd93451c7c0 (diff) |
src: install npm@3 with npm@2
Restore the ability to do one-shot upgrades from the versions of npm
bundled with Node 0.8 to npm@3, which simplifies using Travis with old
Node and new npm, for compatibility testing purposes. Older versions of
npm repack packages on install, which works poorly with the way npm@3
handles bundledDependencies with flat trees.
Fixes: #9668
PR-URL: https://github.com/npm/npm/pull/9981
Diffstat (limited to 'node_modules/mute-stream/mute.js')
-rw-r--r-- | node_modules/mute-stream/mute.js | 140 |
1 files changed, 0 insertions, 140 deletions
diff --git a/node_modules/mute-stream/mute.js b/node_modules/mute-stream/mute.js deleted file mode 100644 index 42eac31e1..000000000 --- a/node_modules/mute-stream/mute.js +++ /dev/null @@ -1,140 +0,0 @@ -var Stream = require('stream') - -module.exports = MuteStream - -// var out = new MuteStream(process.stdout) -// argument auto-pipes -function MuteStream (opts) { - Stream.apply(this) - opts = opts || {} - this.writable = this.readable = true - this.muted = false - this.on('pipe', this._onpipe) - this.replace = opts.replace - - // For readline-type situations - // This much at the start of a line being redrawn after a ctrl char - // is seen (such as backspace) won't be redrawn as the replacement - this._prompt = opts.prompt || null - this._hadControl = false -} - -MuteStream.prototype = Object.create(Stream.prototype) - -Object.defineProperty(MuteStream.prototype, 'constructor', { - value: MuteStream, - enumerable: false -}) - -MuteStream.prototype.mute = function () { - this.muted = true -} - -MuteStream.prototype.unmute = function () { - this.muted = false -} - -Object.defineProperty(MuteStream.prototype, '_onpipe', { - value: onPipe, - enumerable: false, - writable: true, - configurable: true -}) - -function onPipe (src) { - this._src = src -} - -Object.defineProperty(MuteStream.prototype, 'isTTY', { - get: getIsTTY, - set: setIsTTY, - enumerable: true, - configurable: true -}) - -function getIsTTY () { - return( (this._dest) ? this._dest.isTTY - : (this._src) ? this._src.isTTY - : false - ) -} - -// basically just get replace the getter/setter with a regular value -function setIsTTY (isTTY) { - Object.defineProperty(this, 'isTTY', { - value: isTTY, - enumerable: true, - writable: true, - configurable: true - }) -} - -Object.defineProperty(MuteStream.prototype, 'rows', { - get: function () { - return( this._dest ? this._dest.rows - : this._src ? this._src.rows - : undefined ) - }, enumerable: true, configurable: true }) - -Object.defineProperty(MuteStream.prototype, 'columns', { - get: function () { - return( this._dest ? this._dest.columns - : this._src ? this._src.columns - : undefined ) - }, enumerable: true, configurable: true }) - - -MuteStream.prototype.pipe = function (dest) { - this._dest = dest - return Stream.prototype.pipe.call(this, dest) -} - -MuteStream.prototype.pause = function () { - if (this._src) return this._src.pause() -} - -MuteStream.prototype.resume = function () { - if (this._src) return this._src.resume() -} - -MuteStream.prototype.write = function (c) { - if (this.muted) { - if (!this.replace) return true - if (c.match(/^\u001b/)) { - this._hadControl = true - return this.emit('data', c) - } else { - if (this._prompt && this._hadControl && - c.indexOf(this._prompt) === 0) { - this._hadControl = false - this.emit('data', this._prompt) - c = c.substr(this._prompt.length) - } - c = c.toString().replace(/./g, this.replace) - } - } - this.emit('data', c) -} - -MuteStream.prototype.end = function (c) { - if (this.muted) { - if (c && this.replace) { - c = c.toString().replace(/./g, this.replace) - } else { - c = null - } - } - if (c) this.emit('data', c) - this.emit('end') -} - -function proxy (fn) { return function () { - var d = this._dest - var s = this._src - if (d && d[fn]) d[fn].apply(d, arguments) - if (s && s[fn]) s[fn].apply(s, arguments) -}} - -MuteStream.prototype.destroy = proxy('destroy') -MuteStream.prototype.destroySoon = proxy('destroySoon') -MuteStream.prototype.close = proxy('close') |