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/are-we-there-yet | |
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/are-we-there-yet')
-rw-r--r-- | node_modules/are-we-there-yet/.npmignore | 3 | ||||
-rw-r--r-- | node_modules/are-we-there-yet/README.md | 183 | ||||
-rw-r--r-- | node_modules/are-we-there-yet/index.js | 130 | ||||
-rw-r--r-- | node_modules/are-we-there-yet/package.json | 74 | ||||
-rw-r--r-- | node_modules/are-we-there-yet/test/tracker.js | 56 | ||||
-rw-r--r-- | node_modules/are-we-there-yet/test/trackergroup.js | 87 | ||||
-rw-r--r-- | node_modules/are-we-there-yet/test/trackerstream.js | 65 |
7 files changed, 0 insertions, 598 deletions
diff --git a/node_modules/are-we-there-yet/.npmignore b/node_modules/are-we-there-yet/.npmignore deleted file mode 100644 index 926ddf616..000000000 --- a/node_modules/are-we-there-yet/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -*~ -.#* -node_modules diff --git a/node_modules/are-we-there-yet/README.md b/node_modules/are-we-there-yet/README.md deleted file mode 100644 index 52f9f9ae1..000000000 --- a/node_modules/are-we-there-yet/README.md +++ /dev/null @@ -1,183 +0,0 @@ -are-we-there-yet ----------------- - -Track complex hiearchies of asynchronous task completion statuses. This is -intended to give you a way of recording and reporting the progress of the big -recursive fan-out and gather type workflows that are so common in async. - -What you do with this completion data is up to you, but the most common use case is to -feed it to one of the many progress bar modules. - -Most progress bar modules include a rudamentary version of this, but my -needs were more complex. - -Usage -===== - -```javascript -var TrackerGroup = require("are-we-there-yet").TrackerGroup - -var top = new TrackerGroup("program") - -var single = top.newItem("one thing", 100) -single.completeWork(20) - -console.log(top.completed()) // 0.2 - -fs.stat("file", function(er, stat) { - if (er) throw er - var stream = top.newStream("file", stat.size) - console.log(top.completed()) // now 0.1 as single is 50% of the job and is 20% complete - // and 50% * 20% == 10% - fs.createReadStream("file").pipe(stream).on("data", function (chunk) { - // do stuff with chunk - }) - top.on("change", function (name) { - // called each time a chunk is read from "file" - // top.completed() will start at 0.1 and fill up to 0.6 as the file is read - }) -}) -``` - -Shared Methods -============== - -All tracker objects described below have the following methods, they, along -with the event comprise the interface for consumers of tracker objects. - -* var completed = tracker.completed() - -Returns the ratio of completed work to work to be done. Range of 0 to 1. - -* tracker.finish() - -Marks the tracker as completed. With a TrackerGroup this marks all of its -components as completed. - -Marks all of the components of this tracker as finished, which in turn means -that `tracker.completed()` for this will now be 1. - -This will result in one or more `change` events being emitted. - -Events -====== - -All tracker objects emit `change` events with an argument of the name of the -thing changing. - -TrackerGroup -============ - -* var tracker = new TrackerGroup(**name**) - - * **name** *(optional)* - The name of this tracker group, used in change - notifications if the component updating didn't have a name. Defaults to undefined. - -Creates a new empty tracker aggregation group. These are trackers whose -completion status is determined by the completion status of other trackers. - -* tracker.addUnit(**otherTracker**, **weight**) - - * **otherTracker** - Any of the other are-we-there-yet tracker objects - * **weight** *(optional)* - The weight to give the tracker, defaults to 1. - -Adds the **otherTracker** to this aggregation group. The weight determines -how long you expect this tracker to take to complete in proportion to other -units. So for instance, if you add one tracker with a weight of 1 and -another with a weight of 2, you're saying the second will take twice as long -to complete as the first. As such, the first will account for 33% of the -completion of this tracker and the second will account for the other 67%. - -Returns **otherTracker**. - -* var subGroup = tracker.newGroup(**name**, **weight**) - -The above is exactly equivalent to: - -```javascript - var subGroup = tracker.addUnit(new TrackerGroup(name), weight) -``` - -* var subItem = tracker.newItem(**name**, **todo**, **weight**) - -The above is exactly equivalent to: - -```javascript - var subItem = tracker.addUnit(new Tracker(name, todo), weight) -``` - -* var subStream = tracker.newStream(**name**, **todo**, **weight**) - -The above is exactly equivalent to: - -```javascript - var subStream = tracker.addUnit(new TrackerStream(name, todo), weight) -``` - -* console.log( tracker.debug() ) - -Returns a tree showing the completion of this tracker group and all of its -children, including recursively entering all of the children. - -Tracker -======= - -* var tracker = new Tracker(**name**, **todo**) - - * **name** *(optional)* The name of this counter to report in change - events. Defaults to undefined. - * **todo** *(optional)* The amount of work todo (a number). Defaults to 0. - -Ordinarily these are constructed as a part of a tracker group (via `newItem`) but they c - -* var completed = tracker.completed() - -Returns the ratio of completed work to work to be done. Range of 0 to 1. If -total work to be done is 0 then it will return 0. - -* tracker.addWork(**todo**) - - * **todo** A number to add to the amount of work to be done. - -Increases the amount of work to be done, thus decreasing the completion -percentage. Triggers a `change` event. - -* tracker.completeWork(**completed**) - - * **completed** A number to add to the work complete - -Increase the amount of work complete, thus increasing the completion percentage. -Will never increase the work completed past the amount of work todo. That is, -percentages > 100% are not allowed. Triggers a `change` event. - -* tracker.finish() - -Marks this tracker as finished, tracker.completed() will now be 1. Triggers -a `change` event. - -TrackerStream -============= - -* var tracker = new TrackerStream(**name**, **size**, **options**) - - * **name** *(optional)* The name of this counter to report in change - events. Defaults to undefined. - * **size** *(optional)* The number of bytes being sent through this stream. - * **options** *(optional)* A hash of stream options - -The tracker stream object is a pass through stream that updates an internal -tracker object each time a block passes through. It's intended to track -downloads, file extraction and other related activities. You use it by piping -your data source into it and then using it as your data source. - -If your data has a length attribute then that's used as the amount of work -completed when the chunk is passed through. If it does not (eg, object -streams) then each chunk counts as completing 1 unit of work, so your size -should be the total number of objects being streamed. - -* tracker.addWork(**todo**) - - * **todo** Increase the expected overall size by **todo** bytes. - -Increases the amount of work to be done, thus decreasing the completion -percentage. Triggers a `change` event. diff --git a/node_modules/are-we-there-yet/index.js b/node_modules/are-we-there-yet/index.js deleted file mode 100644 index 22f47ac88..000000000 --- a/node_modules/are-we-there-yet/index.js +++ /dev/null @@ -1,130 +0,0 @@ -"use strict" -var stream = require("readable-stream"); -var EventEmitter = require("events").EventEmitter -var util = require("util") -var delegate = require("delegates") - -var TrackerGroup = exports.TrackerGroup = function (name) { - EventEmitter.call(this) - this.name = name - this.trackGroup = [] - var self = this - this.totalWeight = 0 - var noteChange = this.noteChange = function (name) { - self.emit("change", name || this.name) - }.bind(this) - this.trackGroup.forEach(function(unit) { - unit.on("change", noteChange) - }) -} -util.inherits(TrackerGroup, EventEmitter) - -TrackerGroup.prototype.completed = function () { - if (this.trackGroup.length==0) return 0 - var valPerWeight = 1 / this.totalWeight - var completed = 0 - this.trackGroup.forEach(function(T) { - completed += valPerWeight * T.weight * T.completed() - }) - return completed -} - -TrackerGroup.prototype.addUnit = function (unit, weight, noChange) { - unit.weight = weight || 1 - this.totalWeight += unit.weight - this.trackGroup.push(unit) - unit.on("change", this.noteChange) - if (! noChange) this.emit("change", this.name) - return unit -} - -TrackerGroup.prototype.newGroup = function (name, weight) { - return this.addUnit(new TrackerGroup(name), weight) -} - -TrackerGroup.prototype.newItem = function (name, todo, weight) { - return this.addUnit(new Tracker(name, todo), weight) -} - -TrackerGroup.prototype.newStream = function (name, todo, weight) { - return this.addUnit(new TrackerStream(name, todo), weight) -} - -TrackerGroup.prototype.finish = function () { - if (! this.trackGroup.length) { this.addUnit(new Tracker(), 1, true) } - var self = this - this.trackGroup.forEach(function(T) { - T.removeListener("change", self.noteChange) - T.finish() - }) - this.emit("change", this.name) -} - -var buffer = " " -TrackerGroup.prototype.debug = function (depth) { - depth = depth || 0 - var indent = depth ? buffer.substr(0,depth) : "" - var output = indent + (this.name||"top") + ": " + this.completed() + "\n" - this.trackGroup.forEach(function(T) { - if (T instanceof TrackerGroup) { - output += T.debug(depth + 1) - } - else { - output += indent + " " + T.name + ": " + T.completed() + "\n" - } - }) - return output -} - -var Tracker = exports.Tracker = function (name,todo) { - EventEmitter.call(this) - this.name = name - this.workDone = 0 - this.workTodo = todo || 0 -} -util.inherits(Tracker, EventEmitter) - -Tracker.prototype.completed = function () { - return this.workTodo==0 ? 0 : this.workDone / this.workTodo -} - -Tracker.prototype.addWork = function (work) { - this.workTodo += work - this.emit("change", this.name) -} - -Tracker.prototype.completeWork = function (work) { - this.workDone += work - if (this.workDone > this.workTodo) this.workDone = this.workTodo - this.emit("change", this.name) -} - -Tracker.prototype.finish = function () { - this.workTodo = this.workDone = 1 - this.emit("change", this.name) -} - - -var TrackerStream = exports.TrackerStream = function (name, size, options) { - stream.Transform.call(this, options) - this.tracker = new Tracker(name, size) - this.name = name - var self = this - this.tracker.on("change", function (name) { self.emit("change", name) }) -} -util.inherits(TrackerStream, stream.Transform) - -TrackerStream.prototype._transform = function (data, encoding, cb) { - this.tracker.completeWork(data.length ? data.length : 1) - this.push(data) - cb() -} - -TrackerStream.prototype._flush = function (cb) { - this.tracker.finish() - cb() -} - -delegate(TrackerStream.prototype, "tracker") - .method("completed") - .method("addWork") diff --git a/node_modules/are-we-there-yet/package.json b/node_modules/are-we-there-yet/package.json deleted file mode 100644 index 008eec835..000000000 --- a/node_modules/are-we-there-yet/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "_args": [ - [ - "are-we-there-yet@~1.0.0", - "/Users/rebecca/code/npm/node_modules/npmlog" - ] - ], - "_from": "are-we-there-yet@>=1.0.0 <1.1.0", - "_id": "are-we-there-yet@1.0.4", - "_inCache": true, - "_location": "/are-we-there-yet", - "_npmUser": { - "email": "me@re-becca.org", - "name": "iarna" - }, - "_npmVersion": "2.0.0", - "_phantomChildren": {}, - "_requested": { - "name": "are-we-there-yet", - "raw": "are-we-there-yet@~1.0.0", - "rawSpec": "~1.0.0", - "scope": null, - "spec": ">=1.0.0 <1.1.0", - "type": "range" - }, - "_requiredBy": [ - "/npmlog" - ], - "_resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.0.4.tgz", - "_shasum": "527fe389f7bcba90806106b99244eaa07e886f85", - "_shrinkwrap": null, - "_spec": "are-we-there-yet@~1.0.0", - "_where": "/Users/rebecca/code/npm/node_modules/npmlog", - "author": { - "name": "Rebecca Turner", - "url": "http://re-becca.org" - }, - "bugs": { - "url": "https://github.com/iarna/are-we-there-yet/issues" - }, - "dependencies": { - "delegates": "^0.1.0", - "readable-stream": "^1.1.13" - }, - "description": "Keep track of the overall completion of many dispirate processes", - "devDependencies": { - "tap": "^0.4.13" - }, - "directories": {}, - "dist": { - "shasum": "527fe389f7bcba90806106b99244eaa07e886f85", - "tarball": "http://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.0.4.tgz" - }, - "gitHead": "7ce414849b81ab83935a935275def01914821bde", - "homepage": "https://github.com/iarna/are-we-there-yet", - "license": "ISC", - "main": "index.js", - "maintainers": [ - { - "name": "iarna", - "email": "me@re-becca.org" - } - ], - "name": "are-we-there-yet", - "optionalDependencies": {}, - "repository": { - "type": "git", - "url": "https://github.com/iarna/are-we-there-yet.git" - }, - "scripts": { - "test": "tap test/*.js" - }, - "version": "1.0.4" -} diff --git a/node_modules/are-we-there-yet/test/tracker.js b/node_modules/are-we-there-yet/test/tracker.js deleted file mode 100644 index 18c31c32c..000000000 --- a/node_modules/are-we-there-yet/test/tracker.js +++ /dev/null @@ -1,56 +0,0 @@ -"use strict" -var test = require("tap").test -var Tracker = require("../index.js").Tracker - -var timeoutError = new Error("timeout") -var testEvent = function (obj,event,next) { - var timeout = setTimeout(function(){ - obj.removeListener(event, eventHandler) - next(timeoutError) - }, 10) - var eventHandler = function () { - var args = Array.prototype.slice.call(arguments) - args.unshift(null) - clearTimeout(timeout) - next.apply(null, args) - } - obj.once(event, eventHandler) -} - -test("Tracker", function (t) { - t.plan(10) - - var name = "test" - var track = new Tracker(name) - - t.is(track.completed(), 0, "Nothing todo is 0 completion") - - var todo = 100 - track = new Tracker(name, todo) - t.is(track.completed(), 0, "Nothing done is 0 completion") - - testEvent(track, "change", afterCompleteWork) - track.completeWork(100) - function afterCompleteWork(er, onChangeName) { - t.is(er, null, "completeWork: on change event fired") - t.is(onChangeName, name, "completeWork: on change emits the correct name") - } - t.is(track.completed(), 1, "completeWork: 100% completed") - - testEvent(track, "change", afterAddWork) - track.addWork(100) - function afterAddWork(er, onChangeName) { - t.is(er, null, "addWork: on change event fired") - t.is(onChangeName, name, "addWork: on change emits the correct name") - } - t.is(track.completed(), 0.5, "addWork: 50% completed") - - - track.completeWork(200) - t.is(track.completed(), 1, "completeWork: Over completion is still only 100% complete") - - track = new Tracker(name, todo) - track.completeWork(50) - track.finish() - t.is(track.completed(), 1, "finish: Explicitly finishing moves to 100%") -}) diff --git a/node_modules/are-we-there-yet/test/trackergroup.js b/node_modules/are-we-there-yet/test/trackergroup.js deleted file mode 100644 index a64e121c0..000000000 --- a/node_modules/are-we-there-yet/test/trackergroup.js +++ /dev/null @@ -1,87 +0,0 @@ -"use strict" -var test = require("tap").test -var Tracker = require("../index.js").Tracker -var TrackerGroup = require("../index.js").TrackerGroup - -var timeoutError = new Error("timeout") -var testEvent = function (obj,event,next) { - var timeout = setTimeout(function(){ - obj.removeListener(event, eventHandler) - next(timeoutError) - }, 10) - var eventHandler = function () { - var args = Array.prototype.slice.call(arguments) - args.unshift(null) - clearTimeout(timeout) - next.apply(null, args) - } - obj.once(event, eventHandler) -} - -test("TrackerGroup", function (t) { - var name = "test" - - var track = new TrackerGroup(name) - t.is(track.completed(), 0, "Nothing todo is 0 completion") - testEvent(track, "change", afterFinishEmpty) - track.finish() - var a, b - function afterFinishEmpty(er, onChangeName) { - t.is(er, null, "finishEmpty: on change event fired") - t.is(onChangeName, name, "finishEmpty: on change emits the correct name") - t.is(track.completed(), 1, "finishEmpty: Finishing an empty group actually finishes it") - - track = new TrackerGroup(name) - a = track.newItem("a", 10, 1) - b = track.newItem("b", 10, 1) - t.is(track.completed(), 0, "Initially empty") - testEvent(track, "change", afterCompleteWork) - a.completeWork(5) - } - function afterCompleteWork(er, onChangeName) { - t.is(er, null, "on change event fired") - t.is(onChangeName, "a", "on change emits the correct name") - t.is(track.completed(), 0.25, "Complete half of one is a quarter overall") - testEvent(track, "change", afterFinishAll) - track.finish() - } - function afterFinishAll(er, onChangeName) { - t.is(er, null, "finishAll: on change event fired") - t.is(onChangeName, name, "finishAll: on change emits the correct name") - t.is(track.completed(), 1, "Finishing everything ") - - track = new TrackerGroup(name) - a = track.newItem("a", 10, 2) - b = track.newItem("b", 10, 1) - t.is(track.completed(), 0, "weighted: Initially empty") - testEvent(track, "change", afterWeightedCompleteWork) - a.completeWork(5) - } - function afterWeightedCompleteWork(er, onChangeName) { - t.is(er, null, "weighted: on change event fired") - t.is(onChangeName, "a", "weighted: on change emits the correct name") - t.is(Math.round(track.completed()*100), 33, "weighted: Complete half of double weighted") - testEvent(track, "change", afterWeightedFinishAll) - track.finish() - } - function afterWeightedFinishAll(er, onChangeName) { - t.is(er, null, "weightedFinishAll: on change event fired") - t.is(onChangeName, name, "weightedFinishAll: on change emits the correct name") - t.is(track.completed(), 1, "weightedFinishaAll: Finishing everything ") - - track = new TrackerGroup(name) - a = track.newGroup("a", 10) - b = track.newGroup("b", 10) - var a1 = a.newItem("a.1",10) - a1.completeWork(5) - t.is(track.completed(), 0.25, "nested: Initially quarter done") - testEvent(track, "change", afterNestedComplete) - b.finish() - } - function afterNestedComplete(er, onChangeName) { - t.is(er, null, "nestedComplete: on change event fired") - t.is(onChangeName, "b", "nestedComplete: on change emits the correct name") - t.is(track.completed(), 0.75, "nestedComplete: Finishing everything ") - t.end() - } -}) diff --git a/node_modules/are-we-there-yet/test/trackerstream.js b/node_modules/are-we-there-yet/test/trackerstream.js deleted file mode 100644 index 72b604309..000000000 --- a/node_modules/are-we-there-yet/test/trackerstream.js +++ /dev/null @@ -1,65 +0,0 @@ -"use strict" -var test = require("tap").test -var util = require("util") -var stream = require("readable-stream") -var TrackerStream = require("../index.js").TrackerStream - -var timeoutError = new Error("timeout") -var testEvent = function (obj,event,next) { - var timeout = setTimeout(function(){ - obj.removeListener(event, eventHandler) - next(timeoutError) - }, 10) - var eventHandler = function () { - var args = Array.prototype.slice.call(arguments) - args.unshift(null) - clearTimeout(timeout) - next.apply(null, args) - } - obj.once(event, eventHandler) -} - -var Sink = function () { - stream.Writable.apply(this,arguments) -} -util.inherits(Sink, stream.Writable) -Sink.prototype._write = function (data, encoding, cb) { - cb() -} - -test("TrackerStream", function (t) { - t.plan(9) - - var name = "test" - var track = new TrackerStream(name) - - t.is(track.completed(), 0, "Nothing todo is 0 completion") - - var todo = 10 - track = new TrackerStream(name, todo) - t.is(track.completed(), 0, "Nothing done is 0 completion") - - track.pipe(new Sink()) - - testEvent(track, "change", afterCompleteWork) - track.write("0123456789") - function afterCompleteWork(er, onChangeName) { - t.is(er, null, "write: on change event fired") - t.is(onChangeName, name, "write: on change emits the correct name") - t.is(track.completed(), 1, "write: 100% completed") - - testEvent(track, "change", afterAddWork) - track.addWork(10) - } - function afterAddWork(er, onChangeName) { - t.is(er, null, "addWork: on change event fired") - t.is(track.completed(), 0.5, "addWork: 50% completed") - - testEvent(track, "change", afterAllWork) - track.write("ABCDEFGHIJKLMNOPQRST") - } - function afterAllWork(er) { - t.is(er, null, "allWork: on change event fired") - t.is(track.completed(), 1, "allWork: 100% completed") - } -}) |