summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform')
-rw-r--r--deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/.npmignore1
-rw-r--r--deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/LICENSE20
-rw-r--r--deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/README.md54
-rw-r--r--deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/index.js105
-rw-r--r--deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/node_modules/cyclist/.npmignore1
-rw-r--r--deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/node_modules/cyclist/README.md39
-rw-r--r--deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/node_modules/cyclist/index.js33
-rw-r--r--deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/node_modules/cyclist/package.json50
-rw-r--r--deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/package.json55
9 files changed, 358 insertions, 0 deletions
diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/.npmignore b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/.npmignore
new file mode 100644
index 0000000000..3c3629e647
--- /dev/null
+++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/.npmignore
@@ -0,0 +1 @@
+node_modules
diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/LICENSE b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/LICENSE
new file mode 100644
index 0000000000..4b30ed5d95
--- /dev/null
+++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/LICENSE
@@ -0,0 +1,20 @@
+Copyright 2013 Mathias Buus
+
+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.
diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/README.md b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/README.md
new file mode 100644
index 0000000000..f53e130849
--- /dev/null
+++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/README.md
@@ -0,0 +1,54 @@
+# parallel-transform
+
+[Transform stream](http://nodejs.org/api/stream.html#stream_class_stream_transform_1) for Node.js that allows you to run your transforms
+in parallel without changing the order of the output.
+
+ npm install parallel-transform
+
+It is easy to use
+
+``` js
+var transform = require('parallel-transform');
+
+var stream = transform(10, function(data, callback) { // 10 is the parallism level
+ setTimeout(function() {
+ callback(null, data);
+ }, Math.random() * 1000);
+});
+
+for (var i = 0; i < 10; i++) {
+ stream.write(''+i);
+}
+stream.end();
+
+stream.on('data', function(data) {
+ console.log(data); // prints 0,1,2,...
+});
+stream.on('end', function() {
+ console.log('stream has ended');
+});
+```
+
+If you run the above example you'll notice that it runs in parallel
+(does not take ~1 second between each print) and that the order is preserved
+
+## Stream options
+
+All transforms are Node 0.10 streams. Per default they are created with the options `{objectMode:true}`.
+If you want to use your own stream options pass them as the second parameter
+
+``` js
+var stream = transform(10, {objectMode:false}, function(data, callback) {
+ // data is now a buffer
+ callback(null, data);
+});
+
+fs.createReadStream('filename').pipe(stream).pipe(process.stdout);
+```
+
+### Unordered
+Passing the option `{ordered:false}` will output the data as soon as it's processed by a transform, without waiting to respect the order.
+
+## License
+
+MIT \ No newline at end of file
diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/index.js b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/index.js
new file mode 100644
index 0000000000..77329e4ccf
--- /dev/null
+++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/index.js
@@ -0,0 +1,105 @@
+var Transform = require('readable-stream').Transform;
+var inherits = require('inherits');
+var cyclist = require('cyclist');
+var util = require('util');
+
+var ParallelTransform = function(maxParallel, opts, ontransform) {
+ if (!(this instanceof ParallelTransform)) return new ParallelTransform(maxParallel, opts, ontransform);
+
+ if (typeof maxParallel === 'function') {
+ ontransform = maxParallel;
+ opts = null;
+ maxParallel = 1;
+ }
+ if (typeof opts === 'function') {
+ ontransform = opts;
+ opts = null;
+ }
+
+ if (!opts) opts = {};
+ if (!opts.highWaterMark) opts.highWaterMark = Math.max(maxParallel, 16);
+ if (opts.objectMode !== false) opts.objectMode = true;
+
+ Transform.call(this, opts);
+
+ this._maxParallel = maxParallel;
+ this._ontransform = ontransform;
+ this._destroyed = false;
+ this._flushed = false;
+ this._ordered = opts.ordered !== false;
+ this._buffer = this._ordered ? cyclist(maxParallel) : [];
+ this._top = 0;
+ this._bottom = 0;
+ this._ondrain = null;
+};
+
+inherits(ParallelTransform, Transform);
+
+ParallelTransform.prototype.destroy = function() {
+ if (this._destroyed) return;
+ this._destroyed = true;
+ this.emit('close');
+};
+
+ParallelTransform.prototype._transform = function(chunk, enc, callback) {
+ var self = this;
+ var pos = this._top++;
+
+ this._ontransform(chunk, function(err, data) {
+ if (self._destroyed) return;
+ if (err) {
+ self.emit('error', err);
+ self.push(null);
+ self.destroy();
+ return;
+ }
+ if (self._ordered) {
+ self._buffer.put(pos, (data === undefined || data === null) ? null : data);
+ }
+ else {
+ self._buffer.push(data);
+ }
+ self._drain();
+ });
+
+ if (this._top - this._bottom < this._maxParallel) return callback();
+ this._ondrain = callback;
+};
+
+ParallelTransform.prototype._flush = function(callback) {
+ this._flushed = true;
+ this._ondrain = callback;
+ this._drain();
+};
+
+ParallelTransform.prototype._drain = function() {
+ if (this._ordered) {
+ while (this._buffer.get(this._bottom) !== undefined) {
+ var data = this._buffer.del(this._bottom++);
+ if (data === null) continue;
+ this.push(data);
+ }
+ }
+ else {
+ while (this._buffer.length > 0) {
+ var data = this._buffer.pop();
+ this._bottom++;
+ if (data === null) continue;
+ this.push(data);
+ }
+ }
+
+
+ if (!this._drained() || !this._ondrain) return;
+
+ var ondrain = this._ondrain;
+ this._ondrain = null;
+ ondrain();
+};
+
+ParallelTransform.prototype._drained = function() {
+ var diff = this._top - this._bottom;
+ return this._flushed ? !diff : diff < this._maxParallel;
+};
+
+module.exports = ParallelTransform;
diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/node_modules/cyclist/.npmignore b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/node_modules/cyclist/.npmignore
new file mode 100644
index 0000000000..ba99195bae
--- /dev/null
+++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/node_modules/cyclist/.npmignore
@@ -0,0 +1 @@
+bench
diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/node_modules/cyclist/README.md b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/node_modules/cyclist/README.md
new file mode 100644
index 0000000000..50c35cc5fd
--- /dev/null
+++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/node_modules/cyclist/README.md
@@ -0,0 +1,39 @@
+# Cyclist
+
+Cyclist is an efficient [cyclic list](http://en.wikipedia.org/wiki/Circular_buffer) implemention for Javascript.
+It is available through npm
+
+ npm install cyclist
+
+## What?
+
+Cyclist allows you to create a list of fixed size that is cyclic.
+In a cyclist list the element following the last one is the first one.
+This property can be really useful when for example trying to order data
+packets that can arrive out of order over a network stream.
+
+## Usage
+
+``` js
+var cyclist = require('cyclist');
+var list = cyclist(4); // if size (4) is not a power of 2 it will be the follwing power of 2
+ // this buffer can now hold 4 elements in total
+
+list.put(42, 'hello 42'); // store something and index 42
+list.put(43, 'hello 43'); // store something and index 43
+
+console.log(list.get(42)); // prints hello 42
+console.log(list.get(46)); // prints hello 42 again since 46 - 42 == list.size
+```
+
+## API
+
+* `cyclist(size)` creates a new buffer
+* `cyclist#get(index)` get an object stored in the buffer
+* `cyclist#put(index,value)` insert an object into the buffer
+* `cyclist#del(index)` delete an object from an index
+* `cyclist#size` property containing current size of buffer
+
+## License
+
+MIT
diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/node_modules/cyclist/index.js b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/node_modules/cyclist/index.js
new file mode 100644
index 0000000000..baf710c3a9
--- /dev/null
+++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/node_modules/cyclist/index.js
@@ -0,0 +1,33 @@
+var ensureTwoPower = function(n) {
+ if (n && !(n & (n - 1))) return n;
+ var p = 1;
+ while (p < n) p <<= 1;
+ return p;
+};
+
+var Cyclist = function(size) {
+ if (!(this instanceof Cyclist)) return new Cyclist(size);
+ size = ensureTwoPower(size);
+ this.mask = size-1;
+ this.size = size;
+ this.values = new Array(size);
+};
+
+Cyclist.prototype.put = function(index, val) {
+ var pos = index & this.mask;
+ this.values[pos] = val;
+ return pos;
+};
+
+Cyclist.prototype.get = function(index) {
+ return this.values[index & this.mask];
+};
+
+Cyclist.prototype.del = function(index) {
+ var pos = index & this.mask;
+ var val = this.values[pos];
+ this.values[pos] = undefined;
+ return val;
+};
+
+module.exports = Cyclist; \ No newline at end of file
diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/node_modules/cyclist/package.json b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/node_modules/cyclist/package.json
new file mode 100644
index 0000000000..75381174b2
--- /dev/null
+++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/node_modules/cyclist/package.json
@@ -0,0 +1,50 @@
+{
+ "_from": "cyclist@~0.2.2",
+ "_id": "cyclist@0.2.2",
+ "_inBundle": false,
+ "_integrity": "sha1-GzN5LhHpFKL9bW7WRHRkRE5fpkA=",
+ "_location": "/pacote/make-fetch-happen/mississippi/parallel-transform/cyclist",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "cyclist@~0.2.2",
+ "name": "cyclist",
+ "escapedName": "cyclist",
+ "rawSpec": "~0.2.2",
+ "saveSpec": null,
+ "fetchSpec": "~0.2.2"
+ },
+ "_requiredBy": [
+ "/pacote/make-fetch-happen/mississippi/parallel-transform"
+ ],
+ "_resolved": "https://registry.npmjs.org/cyclist/-/cyclist-0.2.2.tgz",
+ "_shasum": "1b33792e11e914a2fd6d6ed6447464444e5fa640",
+ "_spec": "cyclist@~0.2.2",
+ "_where": "/Users/zkat/Documents/code/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform",
+ "author": {
+ "name": "Mathias Buus Madsen",
+ "email": "mathiasbuus@gmail.com"
+ },
+ "bugs": {
+ "url": "https://github.com/mafintosh/cyclist/issues"
+ },
+ "bundleDependencies": false,
+ "dependencies": {},
+ "deprecated": false,
+ "description": "Cyclist is an efficient cyclic list implemention.",
+ "homepage": "https://github.com/mafintosh/cyclist#readme",
+ "keywords": [
+ "circular",
+ "buffer",
+ "ring",
+ "cyclic",
+ "data"
+ ],
+ "name": "cyclist",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/mafintosh/cyclist.git"
+ },
+ "version": "0.2.2"
+}
diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/package.json b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/package.json
new file mode 100644
index 0000000000..892ea9399f
--- /dev/null
+++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi/node_modules/parallel-transform/package.json
@@ -0,0 +1,55 @@
+{
+ "_from": "parallel-transform@^1.1.0",
+ "_id": "parallel-transform@1.1.0",
+ "_inBundle": false,
+ "_integrity": "sha1-1BDwZbBdojCB/NEPKIVMKb2jOwY=",
+ "_location": "/pacote/make-fetch-happen/mississippi/parallel-transform",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "parallel-transform@^1.1.0",
+ "name": "parallel-transform",
+ "escapedName": "parallel-transform",
+ "rawSpec": "^1.1.0",
+ "saveSpec": null,
+ "fetchSpec": "^1.1.0"
+ },
+ "_requiredBy": [
+ "/pacote/make-fetch-happen/mississippi"
+ ],
+ "_resolved": "https://registry.npmjs.org/parallel-transform/-/parallel-transform-1.1.0.tgz",
+ "_shasum": "d410f065b05da23081fcd10f28854c29bda33b06",
+ "_spec": "parallel-transform@^1.1.0",
+ "_where": "/Users/zkat/Documents/code/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/mississippi",
+ "author": {
+ "name": "Mathias Buus Madsen",
+ "email": "mathiasbuus@gmail.com"
+ },
+ "bugs": {
+ "url": "https://github.com/mafintosh/parallel-transform/issues"
+ },
+ "bundleDependencies": false,
+ "dependencies": {
+ "cyclist": "~0.2.2",
+ "inherits": "^2.0.3",
+ "readable-stream": "^2.1.5"
+ },
+ "deprecated": false,
+ "description": "Transform stream that allows you to run your transforms in parallel without changing the order",
+ "homepage": "https://github.com/mafintosh/parallel-transform#readme",
+ "keywords": [
+ "transform",
+ "stream",
+ "parallel",
+ "preserve",
+ "order"
+ ],
+ "license": "MIT",
+ "name": "parallel-transform",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/mafintosh/parallel-transform.git"
+ },
+ "version": "1.1.0"
+}