From: XhmikosR Date: Sat, 10 May 2014 06:32:37 +0000 (+0300) Subject: Update cleancss-browser.js. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=6e24df1795207efe7d6d2813ca76ea98198818da;p=html-minifier.git Update cleancss-browser.js. --- diff --git a/assets/cleancss-browser.js b/assets/cleancss-browser.js index 6beed87..216de08 100644 --- a/assets/cleancss-browser.js +++ b/assets/cleancss-browser.js @@ -392,8 +392,8 @@ var minify = function(data, callback) { data; }; -}).call(this,_dereq_("C:\\Users\\xmr\\Desktop\\clean-css\\node_modules\\browserify\\node_modules\\insert-module-globals\\node_modules\\process\\browser.js"),_dereq_("buffer").Buffer) -},{"./colors/hsl-to-hex":3,"./colors/long-to-short-hex":4,"./colors/rgb-to-hex":5,"./colors/shortener":6,"./images/url-rebase":7,"./imports/inliner":9,"./selectors/empty-removal":17,"./selectors/optimizer":18,"./text/comments":20,"./text/expressions":22,"./text/free":23,"./text/name-quotes":24,"./text/urls":26,"C:\\Users\\xmr\\Desktop\\clean-css\\node_modules\\browserify\\node_modules\\insert-module-globals\\node_modules\\process\\browser.js":38,"buffer":28}],3:[function(_dereq_,module,exports){ +}).call(this,_dereq_("Zbi7gb"),_dereq_("buffer").Buffer) +},{"./colors/hsl-to-hex":3,"./colors/long-to-short-hex":4,"./colors/rgb-to-hex":5,"./colors/shortener":6,"./images/url-rebase":7,"./imports/inliner":9,"./selectors/empty-removal":17,"./selectors/optimizer":18,"./text/comments":20,"./text/expressions":22,"./text/free":23,"./text/name-quotes":24,"./text/urls":26,"Zbi7gb":39,"buffer":28}],3:[function(_dereq_,module,exports){ module.exports = function HSLToHex(data) { // HSL to RGB converter. Both methods adapted from: // http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript @@ -699,7 +699,7 @@ module.exports = function UrlRebase(options, context) { return { process: process }; }; -},{"./url-rewriter":8,"path":39}],8:[function(_dereq_,module,exports){ +},{"./url-rewriter":8,"path":38}],8:[function(_dereq_,module,exports){ (function (process){ var path = _dereq_('path'); var url = _dereq_('url'); @@ -759,8 +759,8 @@ module.exports = { } }; -}).call(this,_dereq_("C:\\Users\\xmr\\Desktop\\clean-css\\node_modules\\browserify\\node_modules\\insert-module-globals\\node_modules\\process\\browser.js")) -},{"C:\\Users\\xmr\\Desktop\\clean-css\\node_modules\\browserify\\node_modules\\insert-module-globals\\node_modules\\process\\browser.js":38,"path":39,"url":52}],9:[function(_dereq_,module,exports){ +}).call(this,_dereq_("Zbi7gb")) +},{"Zbi7gb":39,"path":38,"url":58}],9:[function(_dereq_,module,exports){ var fs = _dereq_('fs'); var path = _dereq_('path'); var http = _dereq_('http'); @@ -1070,7 +1070,7 @@ module.exports = function Inliner(context, options) { return { process: process }; }; -},{"../images/url-rewriter":8,"fs":27,"http":32,"https":36,"path":39,"url":52}],10:[function(_dereq_,module,exports){ +},{"../images/url-rewriter":8,"fs":27,"http":32,"https":36,"path":38,"url":58}],10:[function(_dereq_,module,exports){ var processableInfo = _dereq_('./processable'); var overrideCompactor = _dereq_('./override-compactor'); @@ -3771,7 +3771,7 @@ Buffer.isBuffer = function (b) { Buffer.byteLength = function (str, encoding) { var ret - str = str + '' + str = str.toString() switch (encoding || 'utf8') { case 'hex': ret = str.length / 2 @@ -3801,8 +3801,7 @@ Buffer.byteLength = function (str, encoding) { } Buffer.concat = function (list, totalLength) { - assert(isArray(list), 'Usage: Buffer.concat(list, [totalLength])\n' + - 'list should be an Array.') + assert(isArray(list), 'Usage: Buffer.concat(list[, length])') if (list.length === 0) { return new Buffer(0) @@ -3811,7 +3810,7 @@ Buffer.concat = function (list, totalLength) { } var i - if (typeof totalLength !== 'number') { + if (totalLength === undefined) { totalLength = 0 for (i = 0; i < list.length; i++) { totalLength += list[i].length @@ -3828,10 +3827,28 @@ Buffer.concat = function (list, totalLength) { return buf } +Buffer.compare = function (a, b) { + assert(Buffer.isBuffer(a) && Buffer.isBuffer(b), 'Arguments must be Buffers') + var x = a.length + var y = b.length + for (var i = 0, len = Math.min(x, y); i < len && a[i] === b[i]; i++) {} + if (i !== len) { + x = a[i] + y = b[i] + } + if (x < y) { + return -1 + } + if (y < x) { + return 1 + } + return 0 +} + // BUFFER INSTANCE METHODS // ======================= -function _hexWrite (buf, string, offset, length) { +function hexWrite (buf, string, offset, length) { offset = Number(offset) || 0 var remaining = buf.length - offset if (!length) { @@ -3855,35 +3872,30 @@ function _hexWrite (buf, string, offset, length) { assert(!isNaN(byte), 'Invalid hex string') buf[offset + i] = byte } - Buffer._charsWritten = i * 2 return i } -function _utf8Write (buf, string, offset, length) { - var charsWritten = Buffer._charsWritten = - blitBuffer(utf8ToBytes(string), buf, offset, length) +function utf8Write (buf, string, offset, length) { + var charsWritten = blitBuffer(utf8ToBytes(string), buf, offset, length) return charsWritten } -function _asciiWrite (buf, string, offset, length) { - var charsWritten = Buffer._charsWritten = - blitBuffer(asciiToBytes(string), buf, offset, length) +function asciiWrite (buf, string, offset, length) { + var charsWritten = blitBuffer(asciiToBytes(string), buf, offset, length) return charsWritten } -function _binaryWrite (buf, string, offset, length) { - return _asciiWrite(buf, string, offset, length) +function binaryWrite (buf, string, offset, length) { + return asciiWrite(buf, string, offset, length) } -function _base64Write (buf, string, offset, length) { - var charsWritten = Buffer._charsWritten = - blitBuffer(base64ToBytes(string), buf, offset, length) +function base64Write (buf, string, offset, length) { + var charsWritten = blitBuffer(base64ToBytes(string), buf, offset, length) return charsWritten } -function _utf16leWrite (buf, string, offset, length) { - var charsWritten = Buffer._charsWritten = - blitBuffer(utf16leToBytes(string), buf, offset, length) +function utf16leWrite (buf, string, offset, length) { + var charsWritten = blitBuffer(utf16leToBytes(string), buf, offset, length) return charsWritten } @@ -3917,26 +3929,26 @@ Buffer.prototype.write = function (string, offset, length, encoding) { var ret switch (encoding) { case 'hex': - ret = _hexWrite(this, string, offset, length) + ret = hexWrite(this, string, offset, length) break case 'utf8': case 'utf-8': - ret = _utf8Write(this, string, offset, length) + ret = utf8Write(this, string, offset, length) break case 'ascii': - ret = _asciiWrite(this, string, offset, length) + ret = asciiWrite(this, string, offset, length) break case 'binary': - ret = _binaryWrite(this, string, offset, length) + ret = binaryWrite(this, string, offset, length) break case 'base64': - ret = _base64Write(this, string, offset, length) + ret = base64Write(this, string, offset, length) break case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': - ret = _utf16leWrite(this, string, offset, length) + ret = utf16leWrite(this, string, offset, length) break default: throw new Error('Unknown encoding') @@ -3949,9 +3961,7 @@ Buffer.prototype.toString = function (encoding, start, end) { encoding = String(encoding || 'utf8').toLowerCase() start = Number(start) || 0 - end = (end !== undefined) - ? Number(end) - : end = self.length + end = (end === undefined) ? self.length : Number(end) // Fastpath empty strings if (end === start) @@ -3960,26 +3970,26 @@ Buffer.prototype.toString = function (encoding, start, end) { var ret switch (encoding) { case 'hex': - ret = _hexSlice(self, start, end) + ret = hexSlice(self, start, end) break case 'utf8': case 'utf-8': - ret = _utf8Slice(self, start, end) + ret = utf8Slice(self, start, end) break case 'ascii': - ret = _asciiSlice(self, start, end) + ret = asciiSlice(self, start, end) break case 'binary': - ret = _binarySlice(self, start, end) + ret = binarySlice(self, start, end) break case 'base64': - ret = _base64Slice(self, start, end) + ret = base64Slice(self, start, end) break case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': - ret = _utf16leSlice(self, start, end) + ret = utf16leSlice(self, start, end) break default: throw new Error('Unknown encoding') @@ -3994,6 +4004,16 @@ Buffer.prototype.toJSON = function () { } } +Buffer.prototype.equals = function (b) { + assert(Buffer.isBuffer(b), 'Argument must be a Buffer') + return Buffer.compare(this, b) === 0 +} + +Buffer.prototype.compare = function (b) { + assert(Buffer.isBuffer(b), 'Argument must be a Buffer') + return Buffer.compare(this, b) +} + // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) Buffer.prototype.copy = function (target, target_start, start, end) { var source = this @@ -4022,14 +4042,15 @@ Buffer.prototype.copy = function (target, target_start, start, end) { var len = end - start if (len < 100 || !Buffer._useTypedArrays) { - for (var i = 0; i < len; i++) + for (var i = 0; i < len; i++) { target[i + target_start] = this[i + start] + } } else { target._set(this.subarray(start, start + len), target_start) } } -function _base64Slice (buf, start, end) { +function base64Slice (buf, start, end) { if (start === 0 && end === buf.length) { return base64.fromByteArray(buf) } else { @@ -4037,7 +4058,7 @@ function _base64Slice (buf, start, end) { } } -function _utf8Slice (buf, start, end) { +function utf8Slice (buf, start, end) { var res = '' var tmp = '' end = Math.min(buf.length, end) @@ -4054,20 +4075,21 @@ function _utf8Slice (buf, start, end) { return res + decodeUtf8Char(tmp) } -function _asciiSlice (buf, start, end) { +function asciiSlice (buf, start, end) { var ret = '' end = Math.min(buf.length, end) - for (var i = start; i < end; i++) + for (var i = start; i < end; i++) { ret += String.fromCharCode(buf[i]) + } return ret } -function _binarySlice (buf, start, end) { - return _asciiSlice(buf, start, end) +function binarySlice (buf, start, end) { + return asciiSlice(buf, start, end) } -function _hexSlice (buf, start, end) { +function hexSlice (buf, start, end) { var len = buf.length if (!start || start < 0) start = 0 @@ -4080,11 +4102,11 @@ function _hexSlice (buf, start, end) { return out } -function _utf16leSlice (buf, start, end) { +function utf16leSlice (buf, start, end) { var bytes = buf.slice(start, end) var res = '' for (var i = 0; i < bytes.length; i += 2) { - res += String.fromCharCode(bytes[i] + bytes[i+1] * 256) + res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256) } return res } @@ -4130,7 +4152,7 @@ Buffer.prototype.readUInt8 = function (offset, noAssert) { return this[offset] } -function _readUInt16 (buf, offset, littleEndian, noAssert) { +function readUInt16 (buf, offset, littleEndian, noAssert) { if (!noAssert) { assert(typeof littleEndian === 'boolean', 'missing or invalid endian') assert(offset !== undefined && offset !== null, 'missing offset') @@ -4155,14 +4177,14 @@ function _readUInt16 (buf, offset, littleEndian, noAssert) { } Buffer.prototype.readUInt16LE = function (offset, noAssert) { - return _readUInt16(this, offset, true, noAssert) + return readUInt16(this, offset, true, noAssert) } Buffer.prototype.readUInt16BE = function (offset, noAssert) { - return _readUInt16(this, offset, false, noAssert) + return readUInt16(this, offset, false, noAssert) } -function _readUInt32 (buf, offset, littleEndian, noAssert) { +function readUInt32 (buf, offset, littleEndian, noAssert) { if (!noAssert) { assert(typeof littleEndian === 'boolean', 'missing or invalid endian') assert(offset !== undefined && offset !== null, 'missing offset') @@ -4195,11 +4217,11 @@ function _readUInt32 (buf, offset, littleEndian, noAssert) { } Buffer.prototype.readUInt32LE = function (offset, noAssert) { - return _readUInt32(this, offset, true, noAssert) + return readUInt32(this, offset, true, noAssert) } Buffer.prototype.readUInt32BE = function (offset, noAssert) { - return _readUInt32(this, offset, false, noAssert) + return readUInt32(this, offset, false, noAssert) } Buffer.prototype.readInt8 = function (offset, noAssert) { @@ -4219,7 +4241,7 @@ Buffer.prototype.readInt8 = function (offset, noAssert) { return this[offset] } -function _readInt16 (buf, offset, littleEndian, noAssert) { +function readInt16 (buf, offset, littleEndian, noAssert) { if (!noAssert) { assert(typeof littleEndian === 'boolean', 'missing or invalid endian') assert(offset !== undefined && offset !== null, 'missing offset') @@ -4230,7 +4252,7 @@ function _readInt16 (buf, offset, littleEndian, noAssert) { if (offset >= len) return - var val = _readUInt16(buf, offset, littleEndian, true) + var val = readUInt16(buf, offset, littleEndian, true) var neg = val & 0x8000 if (neg) return (0xffff - val + 1) * -1 @@ -4239,14 +4261,14 @@ function _readInt16 (buf, offset, littleEndian, noAssert) { } Buffer.prototype.readInt16LE = function (offset, noAssert) { - return _readInt16(this, offset, true, noAssert) + return readInt16(this, offset, true, noAssert) } Buffer.prototype.readInt16BE = function (offset, noAssert) { - return _readInt16(this, offset, false, noAssert) + return readInt16(this, offset, false, noAssert) } -function _readInt32 (buf, offset, littleEndian, noAssert) { +function readInt32 (buf, offset, littleEndian, noAssert) { if (!noAssert) { assert(typeof littleEndian === 'boolean', 'missing or invalid endian') assert(offset !== undefined && offset !== null, 'missing offset') @@ -4257,7 +4279,7 @@ function _readInt32 (buf, offset, littleEndian, noAssert) { if (offset >= len) return - var val = _readUInt32(buf, offset, littleEndian, true) + var val = readUInt32(buf, offset, littleEndian, true) var neg = val & 0x80000000 if (neg) return (0xffffffff - val + 1) * -1 @@ -4266,14 +4288,14 @@ function _readInt32 (buf, offset, littleEndian, noAssert) { } Buffer.prototype.readInt32LE = function (offset, noAssert) { - return _readInt32(this, offset, true, noAssert) + return readInt32(this, offset, true, noAssert) } Buffer.prototype.readInt32BE = function (offset, noAssert) { - return _readInt32(this, offset, false, noAssert) + return readInt32(this, offset, false, noAssert) } -function _readFloat (buf, offset, littleEndian, noAssert) { +function readFloat (buf, offset, littleEndian, noAssert) { if (!noAssert) { assert(typeof littleEndian === 'boolean', 'missing or invalid endian') assert(offset + 3 < buf.length, 'Trying to read beyond buffer length') @@ -4283,14 +4305,14 @@ function _readFloat (buf, offset, littleEndian, noAssert) { } Buffer.prototype.readFloatLE = function (offset, noAssert) { - return _readFloat(this, offset, true, noAssert) + return readFloat(this, offset, true, noAssert) } Buffer.prototype.readFloatBE = function (offset, noAssert) { - return _readFloat(this, offset, false, noAssert) + return readFloat(this, offset, false, noAssert) } -function _readDouble (buf, offset, littleEndian, noAssert) { +function readDouble (buf, offset, littleEndian, noAssert) { if (!noAssert) { assert(typeof littleEndian === 'boolean', 'missing or invalid endian') assert(offset + 7 < buf.length, 'Trying to read beyond buffer length') @@ -4300,11 +4322,11 @@ function _readDouble (buf, offset, littleEndian, noAssert) { } Buffer.prototype.readDoubleLE = function (offset, noAssert) { - return _readDouble(this, offset, true, noAssert) + return readDouble(this, offset, true, noAssert) } Buffer.prototype.readDoubleBE = function (offset, noAssert) { - return _readDouble(this, offset, false, noAssert) + return readDouble(this, offset, false, noAssert) } Buffer.prototype.writeUInt8 = function (value, offset, noAssert) { @@ -4318,9 +4340,10 @@ Buffer.prototype.writeUInt8 = function (value, offset, noAssert) { if (offset >= this.length) return this[offset] = value + return offset + 1 } -function _writeUInt16 (buf, value, offset, littleEndian, noAssert) { +function writeUInt16 (buf, value, offset, littleEndian, noAssert) { if (!noAssert) { assert(value !== undefined && value !== null, 'missing value') assert(typeof littleEndian === 'boolean', 'missing or invalid endian') @@ -4338,17 +4361,18 @@ function _writeUInt16 (buf, value, offset, littleEndian, noAssert) { (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>> (littleEndian ? i : 1 - i) * 8 } + return offset + 2 } Buffer.prototype.writeUInt16LE = function (value, offset, noAssert) { - _writeUInt16(this, value, offset, true, noAssert) + return writeUInt16(this, value, offset, true, noAssert) } Buffer.prototype.writeUInt16BE = function (value, offset, noAssert) { - _writeUInt16(this, value, offset, false, noAssert) + return writeUInt16(this, value, offset, false, noAssert) } -function _writeUInt32 (buf, value, offset, littleEndian, noAssert) { +function writeUInt32 (buf, value, offset, littleEndian, noAssert) { if (!noAssert) { assert(value !== undefined && value !== null, 'missing value') assert(typeof littleEndian === 'boolean', 'missing or invalid endian') @@ -4365,14 +4389,15 @@ function _writeUInt32 (buf, value, offset, littleEndian, noAssert) { buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff } + return offset + 4 } Buffer.prototype.writeUInt32LE = function (value, offset, noAssert) { - _writeUInt32(this, value, offset, true, noAssert) + return writeUInt32(this, value, offset, true, noAssert) } Buffer.prototype.writeUInt32BE = function (value, offset, noAssert) { - _writeUInt32(this, value, offset, false, noAssert) + return writeUInt32(this, value, offset, false, noAssert) } Buffer.prototype.writeInt8 = function (value, offset, noAssert) { @@ -4390,9 +4415,10 @@ Buffer.prototype.writeInt8 = function (value, offset, noAssert) { this.writeUInt8(value, offset, noAssert) else this.writeUInt8(0xff + value + 1, offset, noAssert) + return offset + 1 } -function _writeInt16 (buf, value, offset, littleEndian, noAssert) { +function writeInt16 (buf, value, offset, littleEndian, noAssert) { if (!noAssert) { assert(value !== undefined && value !== null, 'missing value') assert(typeof littleEndian === 'boolean', 'missing or invalid endian') @@ -4406,20 +4432,21 @@ function _writeInt16 (buf, value, offset, littleEndian, noAssert) { return if (value >= 0) - _writeUInt16(buf, value, offset, littleEndian, noAssert) + writeUInt16(buf, value, offset, littleEndian, noAssert) else - _writeUInt16(buf, 0xffff + value + 1, offset, littleEndian, noAssert) + writeUInt16(buf, 0xffff + value + 1, offset, littleEndian, noAssert) + return offset + 2 } Buffer.prototype.writeInt16LE = function (value, offset, noAssert) { - _writeInt16(this, value, offset, true, noAssert) + return writeInt16(this, value, offset, true, noAssert) } Buffer.prototype.writeInt16BE = function (value, offset, noAssert) { - _writeInt16(this, value, offset, false, noAssert) + return writeInt16(this, value, offset, false, noAssert) } -function _writeInt32 (buf, value, offset, littleEndian, noAssert) { +function writeInt32 (buf, value, offset, littleEndian, noAssert) { if (!noAssert) { assert(value !== undefined && value !== null, 'missing value') assert(typeof littleEndian === 'boolean', 'missing or invalid endian') @@ -4433,20 +4460,21 @@ function _writeInt32 (buf, value, offset, littleEndian, noAssert) { return if (value >= 0) - _writeUInt32(buf, value, offset, littleEndian, noAssert) + writeUInt32(buf, value, offset, littleEndian, noAssert) else - _writeUInt32(buf, 0xffffffff + value + 1, offset, littleEndian, noAssert) + writeUInt32(buf, 0xffffffff + value + 1, offset, littleEndian, noAssert) + return offset + 4 } Buffer.prototype.writeInt32LE = function (value, offset, noAssert) { - _writeInt32(this, value, offset, true, noAssert) + return writeInt32(this, value, offset, true, noAssert) } Buffer.prototype.writeInt32BE = function (value, offset, noAssert) { - _writeInt32(this, value, offset, false, noAssert) + return writeInt32(this, value, offset, false, noAssert) } -function _writeFloat (buf, value, offset, littleEndian, noAssert) { +function writeFloat (buf, value, offset, littleEndian, noAssert) { if (!noAssert) { assert(value !== undefined && value !== null, 'missing value') assert(typeof littleEndian === 'boolean', 'missing or invalid endian') @@ -4460,17 +4488,18 @@ function _writeFloat (buf, value, offset, littleEndian, noAssert) { return ieee754.write(buf, value, offset, littleEndian, 23, 4) + return offset + 4 } Buffer.prototype.writeFloatLE = function (value, offset, noAssert) { - _writeFloat(this, value, offset, true, noAssert) + return writeFloat(this, value, offset, true, noAssert) } Buffer.prototype.writeFloatBE = function (value, offset, noAssert) { - _writeFloat(this, value, offset, false, noAssert) + return writeFloat(this, value, offset, false, noAssert) } -function _writeDouble (buf, value, offset, littleEndian, noAssert) { +function writeDouble (buf, value, offset, littleEndian, noAssert) { if (!noAssert) { assert(value !== undefined && value !== null, 'missing value') assert(typeof littleEndian === 'boolean', 'missing or invalid endian') @@ -4485,14 +4514,15 @@ function _writeDouble (buf, value, offset, littleEndian, noAssert) { return ieee754.write(buf, value, offset, littleEndian, 52, 8) + return offset + 8 } Buffer.prototype.writeDoubleLE = function (value, offset, noAssert) { - _writeDouble(this, value, offset, true, noAssert) + return writeDouble(this, value, offset, true, noAssert) } Buffer.prototype.writeDoubleBE = function (value, offset, noAssert) { - _writeDouble(this, value, offset, false, noAssert) + return writeDouble(this, value, offset, false, noAssert) } // fill(value, start=0, end=buffer.length) @@ -4501,11 +4531,6 @@ Buffer.prototype.fill = function (value, start, end) { if (!start) start = 0 if (!end) end = this.length - if (typeof value === 'string') { - value = value.charCodeAt(0) - } - - assert(typeof value === 'number' && !isNaN(value), 'value is not a number') assert(end >= start, 'end < start') // Fill 0 bytes; we're done @@ -4515,9 +4540,20 @@ Buffer.prototype.fill = function (value, start, end) { assert(start >= 0 && start < this.length, 'start out of bounds') assert(end >= 0 && end <= this.length, 'end out of bounds') - for (var i = start; i < end; i++) { - this[i] = value + var i + if (typeof value === 'number') { + for (i = start; i < end; i++) { + this[i] = value + } + } else { + var bytes = utf8ToBytes(value.toString()) + var len = bytes.length + for (i = start; i < end; i++) { + this[i] = bytes[i % len] + } } + + return this } Buffer.prototype.inspect = function () { @@ -4543,8 +4579,9 @@ Buffer.prototype.toArrayBuffer = function () { return (new Buffer(this)).buffer } else { var buf = new Uint8Array(this.length) - for (var i = 0, len = buf.length; i < len; i += 1) + for (var i = 0, len = buf.length; i < len; i += 1) { buf[i] = this[i] + } return buf.buffer } } else { @@ -4555,11 +4592,6 @@ Buffer.prototype.toArrayBuffer = function () { // HELPER FUNCTIONS // ================ -function stringtrim (str) { - if (str.trim) return str.trim() - return str.replace(/^\s+|\s+$/g, '') -} - var BP = Buffer.prototype /** @@ -4580,6 +4612,8 @@ Buffer._augment = function (arr) { arr.toString = BP.toString arr.toLocaleString = BP.toString arr.toJSON = BP.toJSON + arr.equals = BP.equals + arr.compare = BP.compare arr.copy = BP.copy arr.slice = BP.slice arr.readUInt8 = BP.readUInt8 @@ -4617,6 +4651,11 @@ Buffer._augment = function (arr) { return arr } +function stringtrim (str) { + if (str.trim) return str.trim() + return str.replace(/^\s+|\s+$/g, '') +} + // slice(start, end) function clamp (index, len, defaultValue) { if (typeof index !== 'number') return defaultValue @@ -4657,14 +4696,15 @@ function utf8ToBytes (str) { var byteArray = [] for (var i = 0; i < str.length; i++) { var b = str.charCodeAt(i) - if (b <= 0x7F) - byteArray.push(str.charCodeAt(i)) - else { + if (b <= 0x7F) { + byteArray.push(b) + } else { var start = i if (b >= 0xD800 && b <= 0xDFFF) i++ var h = encodeURIComponent(str.slice(start, i+1)).substr(1).split('%') - for (var j = 0; j < h.length; j++) + for (var j = 0; j < h.length; j++) { byteArray.push(parseInt(h[j], 16)) + } } } return byteArray @@ -4698,7 +4738,6 @@ function base64ToBytes (str) { } function blitBuffer (src, dst, offset, length) { - var pos for (var i = 0; i < length; i++) { if ((i + offset >= dst.length) || (i >= src.length)) break @@ -5394,7 +5433,7 @@ http.STATUS_CODES = { 510 : 'Not Extended', // RFC 2774 511 : 'Network Authentication Required' // RFC 6585 }; -},{"./lib/request":33,"events":31,"url":52}],33:[function(_dereq_,module,exports){ +},{"./lib/request":33,"events":31,"url":58}],33:[function(_dereq_,module,exports){ var Stream = _dereq_('stream'); var Response = _dereq_('./response'); var Base64 = _dereq_('Base64'); @@ -5585,7 +5624,7 @@ var indexOf = function (xs, x) { return -1; }; -},{"./response":34,"Base64":35,"inherits":37,"stream":45}],34:[function(_dereq_,module,exports){ +},{"./response":34,"Base64":35,"inherits":37,"stream":57}],34:[function(_dereq_,module,exports){ var Stream = _dereq_('stream'); var util = _dereq_('util'); @@ -5707,7 +5746,7 @@ var isArray = Array.isArray || function (xs) { return Object.prototype.toString.call(xs) === '[object Array]'; }; -},{"stream":45,"util":54}],35:[function(_dereq_,module,exports){ +},{"stream":57,"util":60}],35:[function(_dereq_,module,exports){ ;(function () { var object = typeof exports != 'undefined' ? exports : this; // #8: web workers @@ -5810,68 +5849,6 @@ if (typeof Object.create === 'function') { } },{}],38:[function(_dereq_,module,exports){ -// shim for using process in browser - -var process = module.exports = {}; - -process.nextTick = (function () { - var canSetImmediate = typeof window !== 'undefined' - && window.setImmediate; - var canPost = typeof window !== 'undefined' - && window.postMessage && window.addEventListener - ; - - if (canSetImmediate) { - return function (f) { return window.setImmediate(f) }; - } - - if (canPost) { - var queue = []; - window.addEventListener('message', function (ev) { - var source = ev.source; - if ((source === window || source === null) && ev.data === 'process-tick') { - ev.stopPropagation(); - if (queue.length > 0) { - var fn = queue.shift(); - fn(); - } - } - }, true); - - return function nextTick(fn) { - queue.push(fn); - window.postMessage('process-tick', '*'); - }; - } - - return function nextTick(fn) { - setTimeout(fn, 0); - }; -})(); - -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; - -function noop() {} - -process.on = noop; -process.once = noop; -process.off = noop; -process.emit = noop; - -process.binding = function (name) { - throw new Error('process.binding is not supported'); -} - -// TODO(shtylman) -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; - -},{}],39:[function(_dereq_,module,exports){ (function (process){ // Copyright Joyent, Inc. and other Node contributors. // @@ -6098,8 +6075,73 @@ var substr = 'ab'.substr(-1) === 'b' } ; -}).call(this,_dereq_("C:\\Users\\xmr\\Desktop\\clean-css\\node_modules\\browserify\\node_modules\\insert-module-globals\\node_modules\\process\\browser.js")) -},{"C:\\Users\\xmr\\Desktop\\clean-css\\node_modules\\browserify\\node_modules\\insert-module-globals\\node_modules\\process\\browser.js":38}],40:[function(_dereq_,module,exports){ +}).call(this,_dereq_("Zbi7gb")) +},{"Zbi7gb":39}],39:[function(_dereq_,module,exports){ +// shim for using process in browser + +var process = module.exports = {}; + +process.nextTick = (function () { + var canSetImmediate = typeof window !== 'undefined' + && window.setImmediate; + var canPost = typeof window !== 'undefined' + && window.postMessage && window.addEventListener + ; + + if (canSetImmediate) { + return function (f) { return window.setImmediate(f) }; + } + + if (canPost) { + var queue = []; + window.addEventListener('message', function (ev) { + var source = ev.source; + if ((source === window || source === null) && ev.data === 'process-tick') { + ev.stopPropagation(); + if (queue.length > 0) { + var fn = queue.shift(); + fn(); + } + } + }, true); + + return function nextTick(fn) { + queue.push(fn); + window.postMessage('process-tick', '*'); + }; + } + + return function nextTick(fn) { + setTimeout(fn, 0); + }; +})(); + +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; + +function noop() {} + +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +} + +// TODO(shtylman) +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; + +},{}],40:[function(_dereq_,module,exports){ (function (global){ /*! http://mths.be/punycode v1.2.4 by @mathias */ ;(function(root) { @@ -6790,6 +6832,10 @@ exports.decode = exports.parse = _dereq_('./decode'); exports.encode = exports.stringify = _dereq_('./encode'); },{"./decode":41,"./encode":42}],44:[function(_dereq_,module,exports){ +module.exports = _dereq_("./lib/_stream_duplex.js") + +},{"./lib/_stream_duplex.js":45}],45:[function(_dereq_,module,exports){ +(function (process){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -6817,16 +6863,30 @@ exports.encode = exports.stringify = _dereq_('./encode'); // Writable. module.exports = Duplex; -var inherits = _dereq_('inherits'); -var setImmediate = _dereq_('process/browser.js').nextTick; -var Readable = _dereq_('./readable.js'); -var Writable = _dereq_('./writable.js'); -inherits(Duplex, Readable); +/**/ +var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) keys.push(key); + return keys; +} +/**/ + -Duplex.prototype.write = Writable.prototype.write; -Duplex.prototype.end = Writable.prototype.end; -Duplex.prototype._write = Writable.prototype._write; +/**/ +var util = _dereq_('core-util-is'); +util.inherits = _dereq_('inherits'); +/**/ + +var Readable = _dereq_('./_stream_readable'); +var Writable = _dereq_('./_stream_writable'); + +util.inherits(Duplex, Readable); + +forEach(objectKeys(Writable.prototype), function(method) { + if (!Duplex.prototype[method]) + Duplex.prototype[method] = Writable.prototype[method]; +}); function Duplex(options) { if (!(this instanceof Duplex)) @@ -6857,13 +6917,17 @@ function onend() { // no more data can be written. // But allow more writes to happen in this tick. - var self = this; - setImmediate(function () { - self.end(); - }); + process.nextTick(this.end.bind(this)); +} + +function forEach (xs, f) { + for (var i = 0, l = xs.length; i < l; i++) { + f(xs[i], i); + } } -},{"./readable.js":48,"./writable.js":50,"inherits":37,"process/browser.js":46}],45:[function(_dereq_,module,exports){ +}).call(this,_dereq_("Zbi7gb")) +},{"./_stream_readable":47,"./_stream_writable":49,"Zbi7gb":39,"core-util-is":50,"inherits":37}],46:[function(_dereq_,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -6885,245 +6949,86 @@ function onend() { // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -module.exports = Stream; - -var EE = _dereq_('events').EventEmitter; -var inherits = _dereq_('inherits'); +// a passthrough stream. +// basically just the most minimal sort of Transform stream. +// Every written chunk gets output as-is. -inherits(Stream, EE); -Stream.Readable = _dereq_('./readable.js'); -Stream.Writable = _dereq_('./writable.js'); -Stream.Duplex = _dereq_('./duplex.js'); -Stream.Transform = _dereq_('./transform.js'); -Stream.PassThrough = _dereq_('./passthrough.js'); +module.exports = PassThrough; -// Backwards-compat with node 0.4.x -Stream.Stream = Stream; +var Transform = _dereq_('./_stream_transform'); +/**/ +var util = _dereq_('core-util-is'); +util.inherits = _dereq_('inherits'); +/**/ +util.inherits(PassThrough, Transform); -// old-style streams. Note that the pipe method (the only relevant -// part of this class) is overridden in the Readable class. +function PassThrough(options) { + if (!(this instanceof PassThrough)) + return new PassThrough(options); -function Stream() { - EE.call(this); + Transform.call(this, options); } -Stream.prototype.pipe = function(dest, options) { - var source = this; +PassThrough.prototype._transform = function(chunk, encoding, cb) { + cb(null, chunk); +}; - function ondata(chunk) { - if (dest.writable) { - if (false === dest.write(chunk) && source.pause) { - source.pause(); - } - } - } +},{"./_stream_transform":48,"core-util-is":50,"inherits":37}],47:[function(_dereq_,module,exports){ +(function (process){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. - source.on('data', ondata); +module.exports = Readable; - function ondrain() { - if (source.readable && source.resume) { - source.resume(); - } - } +/**/ +var isArray = _dereq_('isarray'); +/**/ - dest.on('drain', ondrain); - // If the 'end' option is not supplied, dest.end() will be called when - // source gets the 'end' or 'close' events. Only dest.end() once. - if (!dest._isStdio && (!options || options.end !== false)) { - source.on('end', onend); - source.on('close', onclose); - } +/**/ +var Buffer = _dereq_('buffer').Buffer; +/**/ - var didOnEnd = false; - function onend() { - if (didOnEnd) return; - didOnEnd = true; +Readable.ReadableState = ReadableState; - dest.end(); - } +var EE = _dereq_('events').EventEmitter; +/**/ +if (!EE.listenerCount) EE.listenerCount = function(emitter, type) { + return emitter.listeners(type).length; +}; +/**/ - function onclose() { - if (didOnEnd) return; - didOnEnd = true; +var Stream = _dereq_('stream'); - if (typeof dest.destroy === 'function') dest.destroy(); - } - - // don't leave dangling pipes when there are errors. - function onerror(er) { - cleanup(); - if (EE.listenerCount(this, 'error') === 0) { - throw er; // Unhandled stream error in pipe. - } - } - - source.on('error', onerror); - dest.on('error', onerror); - - // remove all the event listeners that were added. - function cleanup() { - source.removeListener('data', ondata); - dest.removeListener('drain', ondrain); - - source.removeListener('end', onend); - source.removeListener('close', onclose); - - source.removeListener('error', onerror); - dest.removeListener('error', onerror); - - source.removeListener('end', cleanup); - source.removeListener('close', cleanup); - - dest.removeListener('close', cleanup); - } - - source.on('end', cleanup); - source.on('close', cleanup); - - dest.on('close', cleanup); - - dest.emit('pipe', source); - - // Allow for unix-like usage: A.pipe(B).pipe(C) - return dest; -}; - -},{"./duplex.js":44,"./passthrough.js":47,"./readable.js":48,"./transform.js":49,"./writable.js":50,"events":31,"inherits":37}],46:[function(_dereq_,module,exports){ -// shim for using process in browser - -var process = module.exports = {}; - -process.nextTick = (function () { - var canSetImmediate = typeof window !== 'undefined' - && window.setImmediate; - var canPost = typeof window !== 'undefined' - && window.postMessage && window.addEventListener - ; - - if (canSetImmediate) { - return function (f) { return window.setImmediate(f) }; - } - - if (canPost) { - var queue = []; - window.addEventListener('message', function (ev) { - var source = ev.source; - if ((source === window || source === null) && ev.data === 'process-tick') { - ev.stopPropagation(); - if (queue.length > 0) { - var fn = queue.shift(); - fn(); - } - } - }, true); - - return function nextTick(fn) { - queue.push(fn); - window.postMessage('process-tick', '*'); - }; - } - - return function nextTick(fn) { - setTimeout(fn, 0); - }; -})(); - -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; - -process.binding = function (name) { - throw new Error('process.binding is not supported'); -} - -// TODO(shtylman) -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; - -},{}],47:[function(_dereq_,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// a passthrough stream. -// basically just the most minimal sort of Transform stream. -// Every written chunk gets output as-is. - -module.exports = PassThrough; - -var Transform = _dereq_('./transform.js'); -var inherits = _dereq_('inherits'); -inherits(PassThrough, Transform); - -function PassThrough(options) { - if (!(this instanceof PassThrough)) - return new PassThrough(options); - - Transform.call(this, options); -} - -PassThrough.prototype._transform = function(chunk, encoding, cb) { - cb(null, chunk); -}; - -},{"./transform.js":49,"inherits":37}],48:[function(_dereq_,module,exports){ -(function (process){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -module.exports = Readable; -Readable.ReadableState = ReadableState; +/**/ +var util = _dereq_('core-util-is'); +util.inherits = _dereq_('inherits'); +/**/ -var EE = _dereq_('events').EventEmitter; -var Stream = _dereq_('./index.js'); -var Buffer = _dereq_('buffer').Buffer; -var setImmediate = _dereq_('process/browser.js').nextTick; var StringDecoder; -var inherits = _dereq_('inherits'); -inherits(Readable, Stream); +util.inherits(Readable, Stream); function ReadableState(options, stream) { options = options || {}; @@ -7187,7 +7092,7 @@ function ReadableState(options, stream) { this.encoding = null; if (options.encoding) { if (!StringDecoder) - StringDecoder = _dereq_('string_decoder').StringDecoder; + StringDecoder = _dereq_('string_decoder/').StringDecoder; this.decoder = new StringDecoder(options.encoding); this.encoding = options.encoding; } @@ -7288,7 +7193,7 @@ function needMoreData(state) { // backwards compatibility. Readable.prototype.setEncoding = function(enc) { if (!StringDecoder) - StringDecoder = _dereq_('string_decoder').StringDecoder; + StringDecoder = _dereq_('string_decoder/').StringDecoder; this._readableState.decoder = new StringDecoder(enc); this._readableState.encoding = enc; }; @@ -7493,7 +7398,7 @@ function emitReadable(stream) { state.emittedReadable = true; if (state.sync) - setImmediate(function() { + process.nextTick(function() { emitReadable_(stream); }); else @@ -7514,7 +7419,7 @@ function emitReadable_(stream) { function maybeReadMore(stream, state) { if (!state.readingMore) { state.readingMore = true; - setImmediate(function() { + process.nextTick(function() { maybeReadMore_(stream, state); }); } @@ -7565,7 +7470,7 @@ Readable.prototype.pipe = function(dest, pipeOpts) { var endFn = doEnd ? onend : cleanup; if (state.endEmitted) - setImmediate(endFn); + process.nextTick(endFn); else src.once('end', endFn); @@ -7607,14 +7512,22 @@ Readable.prototype.pipe = function(dest, pipeOpts) { // if the dest has an error, then stop piping into it. // however, don't suppress the throwing behavior for this. - // check for listeners before emit removes one-time listeners. - var errListeners = EE.listenerCount(dest, 'error'); function onerror(er) { unpipe(); - if (errListeners === 0 && EE.listenerCount(dest, 'error') === 0) + dest.removeListener('error', onerror); + if (EE.listenerCount(dest, 'error') === 0) dest.emit('error', er); } - dest.once('error', onerror); + // This is a brutally ugly hack to make sure that our error handler + // is attached before any userland ones. NEVER DO THIS. + if (!dest._events || !dest._events.error) + dest.on('error', onerror); + else if (isArray(dest._events.error)) + dest._events.error.unshift(onerror); + else + dest._events.error = [onerror, dest._events.error]; + + // Both close and finish should trigger unpipe, but only once. function onclose() { @@ -7644,7 +7557,7 @@ Readable.prototype.pipe = function(dest, pipeOpts) { this.on('readable', pipeOnReadable); state.flowing = true; - setImmediate(function() { + process.nextTick(function() { flow(src); }); } @@ -7847,7 +7760,7 @@ function emitDataEvents(stream, startPaused) { stream.resume = function() { paused = false; if (readable) - setImmediate(function() { + process.nextTick(function() { stream.emit('readable'); }); else @@ -7904,9 +7817,7 @@ Readable.prototype.wrap = function(stream) { // proxy certain important events. var events = ['error', 'close', 'destroy', 'pause', 'resume']; forEach(events, function(ev) { - stream.on(ev, function (x) { - return self.emit.apply(self, ev, x); - }); + stream.on(ev, self.emit.bind(self, ev)); }); // when we try to consume some more bytes, simply unpause the @@ -8002,7 +7913,7 @@ function endReadable(stream) { if (!state.endEmitted && state.calledRead) { state.ended = true; - setImmediate(function() { + process.nextTick(function() { // Check that we didn't get one last unshift. if (!state.endEmitted && state.length === 0) { state.endEmitted = true; @@ -8026,8 +7937,8 @@ function indexOf (xs, x) { return -1; } -}).call(this,_dereq_("C:\\Users\\xmr\\Desktop\\clean-css\\node_modules\\browserify\\node_modules\\insert-module-globals\\node_modules\\process\\browser.js")) -},{"./index.js":45,"C:\\Users\\xmr\\Desktop\\clean-css\\node_modules\\browserify\\node_modules\\insert-module-globals\\node_modules\\process\\browser.js":38,"buffer":28,"events":31,"inherits":37,"process/browser.js":46,"string_decoder":51}],49:[function(_dereq_,module,exports){ +}).call(this,_dereq_("Zbi7gb")) +},{"Zbi7gb":39,"buffer":28,"core-util-is":50,"events":31,"inherits":37,"isarray":51,"stream":57,"string_decoder/":52}],48:[function(_dereq_,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -8049,6 +7960,7 @@ function indexOf (xs, x) { // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. + // a transform stream is a readable/writable stream where you do // something with the data. Sometimes it's called a "filter", // but that's not a great name for it, since that implies a thing where @@ -8093,9 +8005,14 @@ function indexOf (xs, x) { module.exports = Transform; -var Duplex = _dereq_('./duplex.js'); -var inherits = _dereq_('inherits'); -inherits(Transform, Duplex); +var Duplex = _dereq_('./_stream_duplex'); + +/**/ +var util = _dereq_('core-util-is'); +util.inherits = _dereq_('inherits'); +/**/ + +util.inherits(Transform, Duplex); function TransformState(options, stream) { @@ -8203,7 +8120,7 @@ Transform.prototype._write = function(chunk, encoding, cb) { Transform.prototype._read = function(n) { var ts = this._transformState; - if (ts.writechunk && ts.writecb && !ts.transforming) { + if (ts.writechunk !== null && ts.writecb && !ts.transforming) { ts.transforming = true; this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); } else { @@ -8233,7 +8150,8 @@ function done(stream, er) { return stream.push(null); } -},{"./duplex.js":44,"inherits":37}],50:[function(_dereq_,module,exports){ +},{"./_stream_duplex":45,"core-util-is":50,"inherits":37}],49:[function(_dereq_,module,exports){ +(function (process){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -8260,27 +8178,23 @@ function done(stream, er) { // the drain event emission and buffering. module.exports = Writable; + +/**/ +var Buffer = _dereq_('buffer').Buffer; +/**/ + Writable.WritableState = WritableState; -var isUint8Array = typeof Uint8Array !== 'undefined' - ? function (x) { return x instanceof Uint8Array } - : function (x) { - return x && x.constructor && x.constructor.name === 'Uint8Array' - } -; -var isArrayBuffer = typeof ArrayBuffer !== 'undefined' - ? function (x) { return x instanceof ArrayBuffer } - : function (x) { - return x && x.constructor && x.constructor.name === 'ArrayBuffer' - } -; -var inherits = _dereq_('inherits'); -var Stream = _dereq_('./index.js'); -var setImmediate = _dereq_('process/browser.js').nextTick; -var Buffer = _dereq_('buffer').Buffer; +/**/ +var util = _dereq_('core-util-is'); +util.inherits = _dereq_('inherits'); +/**/ + + +var Stream = _dereq_('stream'); -inherits(Writable, Stream); +util.inherits(Writable, Stream); function WriteReq(chunk, encoding, cb) { this.chunk = chunk; @@ -8354,12 +8268,17 @@ function WritableState(options, stream) { this.writelen = 0; this.buffer = []; + + // True if the error was already emitted and should not be thrown again + this.errorEmitted = false; } function Writable(options) { + var Duplex = _dereq_('./_stream_duplex'); + // Writable ctor is applied to Duplexes, though they're not // instanceof Writable, they're instanceof Readable. - if (!(this instanceof Writable) && !(this instanceof Stream.Duplex)) + if (!(this instanceof Writable) && !(this instanceof Duplex)) return new Writable(options); this._writableState = new WritableState(options, this); @@ -8380,7 +8299,7 @@ function writeAfterEnd(stream, state, cb) { var er = new Error('write after end'); // TODO: defer error events consistently everywhere, not just the cb stream.emit('error', er); - setImmediate(function() { + process.nextTick(function() { cb(er); }); } @@ -8399,7 +8318,7 @@ function validChunk(stream, state, chunk, cb) { !state.objectMode) { var er = new TypeError('Invalid non-string/buffer chunk'); stream.emit('error', er); - setImmediate(function() { + process.nextTick(function() { cb(er); }); valid = false; @@ -8416,11 +8335,6 @@ Writable.prototype.write = function(chunk, encoding, cb) { encoding = null; } - if (!Buffer.isBuffer(chunk) && isUint8Array(chunk)) - chunk = new Buffer(chunk); - if (isArrayBuffer(chunk) && typeof Uint8Array !== 'undefined') - chunk = new Buffer(new Uint8Array(chunk)); - if (Buffer.isBuffer(chunk)) encoding = 'buffer'; else if (!encoding) @@ -8451,12 +8365,16 @@ function decodeChunk(state, chunk, encoding) { // If we return false, then we need a drain event, so set that flag. function writeOrBuffer(stream, state, chunk, encoding, cb) { chunk = decodeChunk(state, chunk, encoding); + if (Buffer.isBuffer(chunk)) + encoding = 'buffer'; var len = state.objectMode ? 1 : chunk.length; state.length += len; var ret = state.length < state.highWaterMark; - state.needDrain = !ret; + // we must ensure that previous needDrain will not be reset to false. + if (!ret) + state.needDrain = true; if (state.writing) state.buffer.push(new WriteReq(chunk, encoding, cb)); @@ -8477,12 +8395,13 @@ function doWrite(stream, state, len, chunk, encoding, cb) { function onwriteError(stream, state, sync, er, cb) { if (sync) - setImmediate(function() { + process.nextTick(function() { cb(er); }); else cb(er); + stream._writableState.errorEmitted = true; stream.emit('error', er); } @@ -8510,7 +8429,7 @@ function onwrite(stream, er) { clearBuffer(stream, state); if (sync) { - setImmediate(function() { + process.nextTick(function() { afterWrite(stream, state, finished, cb); }); } else { @@ -8614,14 +8533,130 @@ function endWritable(stream, state, cb) { finishMaybe(stream, state); if (cb) { if (state.finished) - setImmediate(cb); + process.nextTick(cb); else stream.once('finish', cb); } state.ended = true; } -},{"./index.js":45,"buffer":28,"inherits":37,"process/browser.js":46}],51:[function(_dereq_,module,exports){ +}).call(this,_dereq_("Zbi7gb")) +},{"./_stream_duplex":45,"Zbi7gb":39,"buffer":28,"core-util-is":50,"inherits":37,"stream":57}],50:[function(_dereq_,module,exports){ +(function (Buffer){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. +function isArray(ar) { + return Array.isArray(ar); +} +exports.isArray = isArray; + +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; + +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; + +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; + +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; + +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; + +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; + +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; + +function isRegExp(re) { + return isObject(re) && objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; + +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} +exports.isObject = isObject; + +function isDate(d) { + return isObject(d) && objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; + +function isError(e) { + return isObject(e) && + (objectToString(e) === '[object Error]' || e instanceof Error); +} +exports.isError = isError; + +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; + +function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; +} +exports.isPrimitive = isPrimitive; + +function isBuffer(arg) { + return Buffer.isBuffer(arg); +} +exports.isBuffer = isBuffer; + +function objectToString(o) { + return Object.prototype.toString.call(o); +} +}).call(this,_dereq_("buffer").Buffer) +},{"buffer":28}],51:[function(_dereq_,module,exports){ +module.exports = Array.isArray || function (arr) { + return Object.prototype.toString.call(arr) == '[object Array]'; +}; + +},{}],52:[function(_dereq_,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -8645,8 +8680,17 @@ function endWritable(stream, state, cb) { var Buffer = _dereq_('buffer').Buffer; +var isBufferEncoding = Buffer.isEncoding + || function(encoding) { + switch (encoding && encoding.toLowerCase()) { + case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true; + default: return false; + } + } + + function assertEncoding(encoding) { - if (encoding && !Buffer.isEncoding(encoding)) { + if (encoding && !isBufferEncoding(encoding)) { throw new Error('Unknown encoding: ' + encoding); } } @@ -8814,7 +8858,153 @@ function base64DetectIncompleteChar(buffer) { return incomplete; } -},{"buffer":28}],52:[function(_dereq_,module,exports){ +},{"buffer":28}],53:[function(_dereq_,module,exports){ +module.exports = _dereq_("./lib/_stream_passthrough.js") + +},{"./lib/_stream_passthrough.js":46}],54:[function(_dereq_,module,exports){ +exports = module.exports = _dereq_('./lib/_stream_readable.js'); +exports.Readable = exports; +exports.Writable = _dereq_('./lib/_stream_writable.js'); +exports.Duplex = _dereq_('./lib/_stream_duplex.js'); +exports.Transform = _dereq_('./lib/_stream_transform.js'); +exports.PassThrough = _dereq_('./lib/_stream_passthrough.js'); + +},{"./lib/_stream_duplex.js":45,"./lib/_stream_passthrough.js":46,"./lib/_stream_readable.js":47,"./lib/_stream_transform.js":48,"./lib/_stream_writable.js":49}],55:[function(_dereq_,module,exports){ +module.exports = _dereq_("./lib/_stream_transform.js") + +},{"./lib/_stream_transform.js":48}],56:[function(_dereq_,module,exports){ +module.exports = _dereq_("./lib/_stream_writable.js") + +},{"./lib/_stream_writable.js":49}],57:[function(_dereq_,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +module.exports = Stream; + +var EE = _dereq_('events').EventEmitter; +var inherits = _dereq_('inherits'); + +inherits(Stream, EE); +Stream.Readable = _dereq_('readable-stream/readable.js'); +Stream.Writable = _dereq_('readable-stream/writable.js'); +Stream.Duplex = _dereq_('readable-stream/duplex.js'); +Stream.Transform = _dereq_('readable-stream/transform.js'); +Stream.PassThrough = _dereq_('readable-stream/passthrough.js'); + +// Backwards-compat with node 0.4.x +Stream.Stream = Stream; + + + +// old-style streams. Note that the pipe method (the only relevant +// part of this class) is overridden in the Readable class. + +function Stream() { + EE.call(this); +} + +Stream.prototype.pipe = function(dest, options) { + var source = this; + + function ondata(chunk) { + if (dest.writable) { + if (false === dest.write(chunk) && source.pause) { + source.pause(); + } + } + } + + source.on('data', ondata); + + function ondrain() { + if (source.readable && source.resume) { + source.resume(); + } + } + + dest.on('drain', ondrain); + + // If the 'end' option is not supplied, dest.end() will be called when + // source gets the 'end' or 'close' events. Only dest.end() once. + if (!dest._isStdio && (!options || options.end !== false)) { + source.on('end', onend); + source.on('close', onclose); + } + + var didOnEnd = false; + function onend() { + if (didOnEnd) return; + didOnEnd = true; + + dest.end(); + } + + + function onclose() { + if (didOnEnd) return; + didOnEnd = true; + + if (typeof dest.destroy === 'function') dest.destroy(); + } + + // don't leave dangling pipes when there are errors. + function onerror(er) { + cleanup(); + if (EE.listenerCount(this, 'error') === 0) { + throw er; // Unhandled stream error in pipe. + } + } + + source.on('error', onerror); + dest.on('error', onerror); + + // remove all the event listeners that were added. + function cleanup() { + source.removeListener('data', ondata); + dest.removeListener('drain', ondrain); + + source.removeListener('end', onend); + source.removeListener('close', onclose); + + source.removeListener('error', onerror); + dest.removeListener('error', onerror); + + source.removeListener('end', cleanup); + source.removeListener('close', cleanup); + + dest.removeListener('close', cleanup); + } + + source.on('end', cleanup); + source.on('close', cleanup); + + dest.on('close', cleanup); + + dest.emit('pipe', source); + + // Allow for unix-like usage: A.pipe(B).pipe(C) + return dest; +}; + +},{"events":31,"inherits":37,"readable-stream/duplex.js":44,"readable-stream/passthrough.js":53,"readable-stream/readable.js":54,"readable-stream/transform.js":55,"readable-stream/writable.js":56}],58:[function(_dereq_,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -9523,14 +9713,14 @@ function isNullOrUndefined(arg) { return arg == null; } -},{"punycode":40,"querystring":43}],53:[function(_dereq_,module,exports){ +},{"punycode":40,"querystring":43}],59:[function(_dereq_,module,exports){ module.exports = function isBuffer(arg) { return arg && typeof arg === 'object' && typeof arg.copy === 'function' && typeof arg.fill === 'function' && typeof arg.readUInt8 === 'function'; } -},{}],54:[function(_dereq_,module,exports){ +},{}],60:[function(_dereq_,module,exports){ (function (process,global){ // Copyright Joyent, Inc. and other Node contributors. // @@ -10119,7 +10309,7 @@ function hasOwnProperty(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } -}).call(this,_dereq_("C:\\Users\\xmr\\Desktop\\clean-css\\node_modules\\browserify\\node_modules\\insert-module-globals\\node_modules\\process\\browser.js"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":53,"C:\\Users\\xmr\\Desktop\\clean-css\\node_modules\\browserify\\node_modules\\insert-module-globals\\node_modules\\process\\browser.js":38,"inherits":37}]},{},[1]) +}).call(this,_dereq_("Zbi7gb"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./support/isBuffer":59,"Zbi7gb":39,"inherits":37}]},{},[1]) (1) }); \ No newline at end of file