summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2012-06-28 19:08:32 -0700
committerisaacs <i@izs.me>2012-06-28 19:08:32 -0700
commitc721604d254f57eefef715d4bd83329fac0750c7 (patch)
tree906a4b7bd1c3d6991293ca720cf8a7858efb43fd /deps/npm/node_modules
parentf2a9ed487369ab7222522e1097708550adbe165c (diff)
downloadnode-c721604d254f57eefef715d4bd83329fac0750c7.tar.gz
npm: Upgrade to 1.1.33
Support for parallel use of the cache folder Retry on registry timeouts or network failures Reduce 'engines' failures to a warning Use new zsh completion if aviailable
Diffstat (limited to 'deps/npm/node_modules')
-rw-r--r--deps/npm/node_modules/lockfile/LICENSE25
-rw-r--r--deps/npm/node_modules/lockfile/README.md81
-rw-r--r--deps/npm/node_modules/lockfile/lockfile.js241
-rw-r--r--deps/npm/node_modules/lockfile/package.json36
-rw-r--r--deps/npm/node_modules/npm-registry-client/LICENSE25
-rw-r--r--deps/npm/node_modules/npm-registry-client/README.md7
-rw-r--r--deps/npm/node_modules/npm-registry-client/index.js5
-rw-r--r--deps/npm/node_modules/npm-registry-client/lib/get.js2
-rw-r--r--deps/npm/node_modules/npm-registry-client/lib/request.js38
-rw-r--r--deps/npm/node_modules/npm-registry-client/package.json15
-rw-r--r--deps/npm/node_modules/read-package-json/package.json6
-rw-r--r--deps/npm/node_modules/read-package-json/read-json.js2
-rw-r--r--deps/npm/node_modules/retry/.npmignore1
-rw-r--r--deps/npm/node_modules/retry/License21
-rw-r--r--deps/npm/node_modules/retry/Makefile7
-rw-r--r--deps/npm/node_modules/retry/Readme.md167
-rw-r--r--deps/npm/node_modules/retry/equation.gifbin0 -> 1209 bytes
-rw-r--r--deps/npm/node_modules/retry/index.js1
-rw-r--r--deps/npm/node_modules/retry/lib/retry.js50
-rw-r--r--deps/npm/node_modules/retry/lib/retry_operation.js109
-rw-r--r--deps/npm/node_modules/retry/package.json29
21 files changed, 853 insertions, 15 deletions
diff --git a/deps/npm/node_modules/lockfile/LICENSE b/deps/npm/node_modules/lockfile/LICENSE
new file mode 100644
index 000000000..74489e2e2
--- /dev/null
+++ b/deps/npm/node_modules/lockfile/LICENSE
@@ -0,0 +1,25 @@
+Copyright (c) Isaac Z. Schlueter
+All rights reserved.
+
+The BSD License
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
diff --git a/deps/npm/node_modules/lockfile/README.md b/deps/npm/node_modules/lockfile/README.md
new file mode 100644
index 000000000..18ffd5041
--- /dev/null
+++ b/deps/npm/node_modules/lockfile/README.md
@@ -0,0 +1,81 @@
+# lockfile
+
+A very polite lock file utility, which endeavors to not litter, and to
+wait patiently for others.
+
+## Usage
+
+```javascript
+var lockFile = require('lockfile')
+
+// opts is optional, and defaults to {}
+lockFile.lock('some-file.lock', opts, function (er, fd) {
+ // if the er happens, then it failed to acquire a lock.
+ // if there was not an error, then the fd is opened in
+ // wx mode. If you want to write something to it, go ahead.
+
+ // do my stuff, free of interruptions
+ // then, some time later, do:
+ lockFile.unlock('some-file.lock', function (er) {
+ // er means that an error happened, and is probably bad.
+ })
+})
+```
+
+## Methods
+
+Sync methods return the value/throw the error, others don't. Standard
+node fs stuff.
+
+All known locks are removed when the process exits. Of course, it's
+possible for certain types of failures to cause this to fail, but a best
+effort is made to not be a litterbug.
+
+### lockFile.lock(path, [opts], cb)
+
+Acquire a file lock on the specified path. Returns the FD.
+
+### lockFile.lockSync(path, [opts])
+
+Acquire a file lock on the specified path
+
+### lockFile.unlock(path, cb)
+
+Close and unlink the lockfile.
+
+### lockFile.unlockSync(path)
+
+Close and unlink the lockfile.
+
+### lockFile.check(path, [opts], cb)
+
+Check if the lockfile is locked and not stale.
+
+Returns boolean.
+
+### lockFile.checkSync(path, [opts], cb)
+
+Check if the lockfile is locked and not stale.
+
+Callback is called with `cb(error, isLocked)`.
+
+## Options
+
+### opts.wait
+
+A number of milliseconds to wait for locks to expire before giving up.
+Only used by lockFile.lock. Relies on fs.watch. If the lock is not
+cleared by the time the wait expires, then it returns with the original
+error.
+
+### opts.stale
+
+A number of milliseconds before locks are considered to have expired.
+
+### opts.retries
+
+Used by lock and lockSync. Retry `n` number of times before giving up.
+
+### opts.retryWait
+
+Used by lock. Wait `n` milliseconds before retrying.
diff --git a/deps/npm/node_modules/lockfile/lockfile.js b/deps/npm/node_modules/lockfile/lockfile.js
new file mode 100644
index 000000000..0bc54169c
--- /dev/null
+++ b/deps/npm/node_modules/lockfile/lockfile.js
@@ -0,0 +1,241 @@
+var fs = require('fs')
+
+var wx = 'wx'
+if (process.version.match(/^v0.[456]/)) {
+ var c = require('constants')
+ wx = c.O_TRUNC | c.O_CREAT | c.O_WRONLY | c.O_EXCL
+}
+
+var locks = {}
+
+process.on('exit', function () {
+ // cleanup
+ Object.keys(locks).forEach(exports.unlockSync)
+})
+
+// XXX https://github.com/joyent/node/issues/3555
+// Remove when node 0.8 is deprecated.
+process.on('uncaughtException', function H (er) {
+ var l = process.listeners('uncaughtException').filter(function (h) {
+ return h !== H
+ })
+ if (!l.length) {
+ // cleanup
+ Object.keys(locks).forEach(exports.unlockSync)
+ process.removeListener('uncaughtException', H)
+ throw er
+ }
+})
+
+exports.unlock = function (path, cb) {
+ // best-effort. unlocking an already-unlocked lock is a noop
+ fs.unlink(path, function (unlinkEr) {
+ if (!locks.hasOwnProperty(path)) return cb()
+ fs.close(locks[path], function (closeEr) {
+ delete locks[path]
+ cb()
+ })
+ })
+}
+
+exports.unlockSync = function (path) {
+ try { fs.unlinkSync(path) } catch (er) {}
+ if (!locks.hasOwnProperty(path)) return
+ // best-effort. unlocking an already-unlocked lock is a noop
+ try { fs.close(locks[path]) } catch (er) {}
+ delete locks[path]
+}
+
+
+// if the file can be opened in readonly mode, then it's there.
+// if the error is something other than ENOENT, then it's not.
+exports.check = function (path, opts, cb) {
+ if (typeof opts === 'function') cb = opts, opts = {}
+ fs.open(path, 'r', function (er, fd) {
+ if (er) {
+ if (er.code !== 'ENOENT') return cb(er)
+ return cb(null, false)
+ }
+
+ if (!opts.stale) {
+ return fs.close(fd, function (er) {
+ return cb(er, true)
+ })
+ }
+
+ fs.fstat(fd, function (er, st) {
+ if (er) return fs.close(fd, function (er2) {
+ return cb(er)
+ })
+
+ fs.close(fd, function (er) {
+ var age = Date.now() - st.ctime.getTime()
+ return cb(er, age <= opts.stale)
+ })
+ })
+ })
+}
+
+exports.checkSync = function (path, opts) {
+ opts = opts || {}
+ if (opts.wait) {
+ throw new Error('opts.wait not supported sync for obvious reasons')
+ }
+
+ try {
+ var fd = fs.openSync(path, 'r')
+ } catch (er) {
+ if (er.code !== 'ENOENT') throw er
+ return false
+ }
+
+ if (!opts.stale) {
+ fs.closeSync(fd)
+ return true
+ }
+
+ // file exists. however, might be stale
+ if (opts.stale) {
+ try {
+ var st = fs.fstatSync(fd)
+ } finally {
+ fs.closeSync(fd)
+ }
+ var age = Date.now() - st.ctime.getTime()
+ return (age <= opts.stale)
+ }
+}
+
+
+
+exports.lock = function (path, opts, cb) {
+ if (typeof opts === 'function') cb = opts, opts = {}
+
+ if (typeof opts.retries === 'number' && opts.retries > 0) {
+ cb = (function (orig) { return function (er, fd) {
+ if (!er) return orig(er, fd)
+ var newRT = opts.retries - 1
+ opts_ = Object.create(opts, { retries: { value: newRT }})
+ if (opts.retryWait) setTimeout(function() {
+ exports.lock(path, opts_, orig)
+ }, opts.retryWait)
+ else exports.lock(path, opts_, orig)
+ }})(cb)
+ }
+
+ // try to engage the lock.
+ // if this succeeds, then we're in business.
+ fs.open(path, wx, function (er, fd) {
+ if (!er) {
+ locks[path] = fd
+ return cb(null, fd)
+ }
+
+ // something other than "currently locked"
+ // maybe eperm or something.
+ if (er.code !== 'EEXIST') return cb(er)
+
+ // someone's got this one. see if it's valid.
+ if (opts.stale) fs.stat(path, function (er, st) {
+ if (er) {
+ if (er.code === 'ENOENT') {
+ // expired already!
+ var opts_ = Object.create(opts, { stale: { value: false }})
+ exports.lock(path, opts_, cb)
+ return
+ }
+ return cb(er)
+ }
+
+ var age = Date.now() - st.ctime.getTime()
+ if (age > opts.stale) {
+ exports.unlock(path, function (er) {
+ if (er) return cb(er)
+ var opts_ = Object.create(opts, { stale: { value: false }})
+ exports.lock(path, opts_, cb)
+ })
+ } else notStale(er, path, opts, cb)
+ })
+ else notStale(er, path, opts, cb)
+ })
+}
+
+function notStale (er, path, opts, cb) {
+ if (typeof opts.wait === 'number' && opts.wait > 0) {
+ // wait for some ms for the lock to clear
+ var start = Date.now()
+
+ var retried = false
+ function retry () {
+ if (retried) return
+ retried = true
+ // maybe already closed.
+ try { watcher.close() } catch (e) {}
+ clearTimeout(timer)
+ var newWait = Date.now() - start
+ var opts_ = Object.create(opts, { wait: { value: newWait }})
+ exports.lock(path, opts_, cb)
+ }
+
+ try {
+ var watcher = fs.watch(path, function (change) {
+ if (change === 'rename') {
+ // ok, try and get it now.
+ // if this fails, then continue waiting, maybe.
+ retry()
+ }
+ })
+ watcher.on('error', function (er) {
+ // usually means it expired before the watcher spotted it
+ retry()
+ })
+ } catch (er) {
+ retry()
+ }
+
+ var timer = setTimeout(function () {
+ try { watcher.close() } catch (e) {}
+ cb(er)
+ }, opts.wait)
+ } else {
+ // failed to lock!
+ return cb(er)
+ }
+}
+
+exports.lockSync = function (path, opts) {
+ opts = opts || {}
+ if (opts.wait || opts.retryWait) {
+ throw new Error('opts.wait not supported sync for obvious reasons')
+ }
+
+ try {
+ var fd = fs.openSync(path, wx)
+ locks[path] = fd
+ return fd
+ } catch (er) {
+ if (er.code !== 'EEXIST') return retryThrow(path, opts, er)
+
+ if (opts.stale) {
+ var st = fs.statSync(path)
+ var age = Date.now() - st.ctime.getTime()
+ if (age > opts.stale) {
+ exports.unlockSync(path)
+ return exports.lockSync(path, opts)
+ }
+ }
+
+ // failed to lock!
+ return retryThrow(path, opts, er)
+ }
+}
+
+function retryThrow (path, opts, er) {
+ if (typeof opts.retries === 'number' && opts.retries > 0) {
+ var newRT = opts.retries - 1
+ var opts_ = Object.create(opts, { retries: { value: newRT }})
+ return exports.lockSync(path, opts_)
+ }
+ throw er
+}
+
diff --git a/deps/npm/node_modules/lockfile/package.json b/deps/npm/node_modules/lockfile/package.json
new file mode 100644
index 000000000..b93404bcd
--- /dev/null
+++ b/deps/npm/node_modules/lockfile/package.json
@@ -0,0 +1,36 @@
+{
+ "name": "lockfile",
+ "version": "0.2.1",
+ "main": "lockfile.js",
+ "directories": {
+ "test": "test"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "tap": "~0.2.5"
+ },
+ "scripts": {
+ "test": "tap test/*.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/isaacs/lockfile"
+ },
+ "keywords": [
+ "lockfile",
+ "lock",
+ "file",
+ "fs",
+ "O_EXCL"
+ ],
+ "author": {
+ "name": "Isaac Z. Schlueter",
+ "email": "i@izs.me",
+ "url": "http://blog.izs.me/"
+ },
+ "license": "BSD",
+ "description": "A very polite lock file utility, which endeavors to not litter, and to wait patiently for others.",
+ "readme": "# lockfile\n\nA very polite lock file utility, which endeavors to not litter, and to\nwait patiently for others.\n\n## Usage\n\n```javascript\nvar lockFile = require('lockfile')\n\n// opts is optional, and defaults to {}\nlockFile.lock('some-file.lock', opts, function (er, fd) {\n // if the er happens, then it failed to acquire a lock.\n // if there was not an error, then the fd is opened in\n // wx mode. If you want to write something to it, go ahead.\n\n // do my stuff, free of interruptions\n // then, some time later, do:\n lockFile.unlock('some-file.lock', function (er) {\n // er means that an error happened, and is probably bad.\n })\n})\n```\n\n## Methods\n\nSync methods return the value/throw the error, others don't. Standard\nnode fs stuff.\n\nAll known locks are removed when the process exits. Of course, it's\npossible for certain types of failures to cause this to fail, but a best\neffort is made to not be a litterbug.\n\n### lockFile.lock(path, [opts], cb)\n\nAcquire a file lock on the specified path. Returns the FD.\n\n### lockFile.lockSync(path, [opts])\n\nAcquire a file lock on the specified path\n\n### lockFile.unlock(path, cb)\n\nClose and unlink the lockfile.\n\n### lockFile.unlockSync(path)\n\nClose and unlink the lockfile.\n\n### lockFile.check(path, [opts], cb)\n\nCheck if the lockfile is locked and not stale.\n\nReturns boolean.\n\n### lockFile.checkSync(path, [opts], cb)\n\nCheck if the lockfile is locked and not stale.\n\nCallback is called with `cb(error, isLocked)`.\n\n## Options\n\n### opts.wait\n\nA number of milliseconds to wait for locks to expire before giving up.\nOnly used by lockFile.lock. Relies on fs.watch. If the lock is not\ncleared by the time the wait expires, then it returns with the original\nerror.\n\n### opts.stale\n\nA number of milliseconds before locks are considered to have expired.\n\n### opts.retries\n\nUsed by lock and lockSync. Retry `n` number of times before giving up.\n\n### opts.retryWait\n\nUsed by lock. Wait `n` milliseconds before retrying.\n",
+ "_id": "lockfile@0.2.1",
+ "_from": "lockfile@>=0.2"
+}
diff --git a/deps/npm/node_modules/npm-registry-client/LICENSE b/deps/npm/node_modules/npm-registry-client/LICENSE
new file mode 100644
index 000000000..74489e2e2
--- /dev/null
+++ b/deps/npm/node_modules/npm-registry-client/LICENSE
@@ -0,0 +1,25 @@
+Copyright (c) Isaac Z. Schlueter
+All rights reserved.
+
+The BSD License
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
diff --git a/deps/npm/node_modules/npm-registry-client/README.md b/deps/npm/node_modules/npm-registry-client/README.md
index b665ebfb9..dbeb94422 100644
--- a/deps/npm/node_modules/npm-registry-client/README.md
+++ b/deps/npm/node_modules/npm-registry-client/README.md
@@ -34,6 +34,13 @@ client.get("npm", "latest", 1000, function (er, data, raw, res) {
`"node/{process.version}"`
* `log` {Object} The logger to use. Defaults to `require("npmlog")` if
that works, otherwise logs are disabled.
+* `retries` {Number} Number of times to retry on GET failures.
+ Default=2
+* `retryFactor` {Number} `factor` setting for `node-retry`. Default=10
+* `retryMinTimeout` {Number} `minTimeout` setting for `node-retry`.
+ Default=10000 (10 seconds)
+* `retryMaxTimeout` {Number} `maxTimeout` setting for `node-retry`.
+ Default=60000 (60 seconds)
# client.request(method, where, [what], [etag], [nofollow], cb)
diff --git a/deps/npm/node_modules/npm-registry-client/index.js b/deps/npm/node_modules/npm-registry-client/index.js
index 00107c6bd..673789f9b 100644
--- a/deps/npm/node_modules/npm-registry-client/index.js
+++ b/deps/npm/node_modules/npm-registry-client/index.js
@@ -25,6 +25,11 @@ function RegClient (options) {
'Invalid registry: ' + registry.url)
this.registry = registry.href
+ this.retries = options.retries || 2
+ this.retryFactor = options.retryFactor || 10
+ this.retryMinTimeout = options.retryMinTimeout || 10000
+ this.retryMaxTimeout = options.retryMaxTimeout || 60000
+
this.cache = options.cache
if (!this.cache) throw new Error("Cache dir is required")
diff --git a/deps/npm/node_modules/npm-registry-client/lib/get.js b/deps/npm/node_modules/npm-registry-client/lib/get.js
index e0180429d..b56fefcc6 100644
--- a/deps/npm/node_modules/npm-registry-client/lib/get.js
+++ b/deps/npm/node_modules/npm-registry-client/lib/get.js
@@ -76,7 +76,7 @@ function requestAll_ (c, data, cb) {
this.request('GET', uri, function (er, updates, _, res) {
if (er) return cb(er, data)
var headers = res.headers
- , updated = Date.parse(headers.date)
+ , updated = data._updated || Date.parse(headers.date)
Object.keys(updates).forEach(function (p) {
data[p] = updates[p]
})
diff --git a/deps/npm/node_modules/npm-registry-client/lib/request.js b/deps/npm/node_modules/npm-registry-client/lib/request.js
index 5f21c0299..c26504b2a 100644
--- a/deps/npm/node_modules/npm-registry-client/lib/request.js
+++ b/deps/npm/node_modules/npm-registry-client/lib/request.js
@@ -6,6 +6,7 @@ var url = require("url")
, asyncMap = require("slide").asyncMap
, Stream = require("stream").Stream
, request = require("request")
+ , retry = require("retry")
function regRequest (method, where, what, etag, nofollow, cb_) {
if (typeof cb_ !== "function") cb_ = nofollow, nofollow = false
@@ -74,10 +75,40 @@ function regRequest (method, where, what, etag, nofollow, cb_) {
remote.auth = new Buffer(auth, "base64").toString("utf8")
}
- makeRequest.call(this, method, remote, where, what, etag, nofollow, cb)
+ // Tuned to spread 3 attempts over about a minute.
+ // See formula at <https://github.com/tim-kos/node-retry>.
+ var operation = retry.operation({
+ retries: this.retries,
+ factor: this.retryFactor,
+ minTimeout: this.retryMinTimeout,
+ maxTimeout: this.retryMaxTimeout
+ })
+ var self = this
+ operation.attempt(function (currentAttempt) {
+ self.log.info("retry", "registry request attempt " + currentAttempt
+ + " at " + (new Date()).toLocaleTimeString())
+ makeRequest.call(self, method, remote, where, what, etag, nofollow
+ , function (er, parsed, raw, response) {
+ // Only retry on 408, 5xx or no `response`.
+ var statusCode = response && response.statusCode
+ var statusRetry = !statusCode || (statusCode === 408 || statusCode >= 500)
+ if (er && statusRetry && operation.retry(er)) {
+ self.log.info("retry", "will retry, error on last attempt: " + er)
+ return
+ }
+ cb.apply(null, arguments)
+ })
+ })
}
-function makeRequest (method, remote, where, what, etag, nofollow, cb) {
+function makeRequest (method, remote, where, what, etag, nofollow, cb_) {
+ var cbCalled = false
+ function cb () {
+ if (cbCalled) return
+ cbCalled = true
+ cb_.apply(null, arguments)
+ }
+
var opts = { url: remote
, method: method
, ca: this.ca
@@ -120,6 +151,9 @@ function makeRequest (method, remote, where, what, etag, nofollow, cb) {
var req = request(opts, done)
req.on("error", cb)
+ req.on("socket", function (s) {
+ s.on("error", cb)
+ })
if (what && (what instanceof Stream)) {
what.pipe(req)
diff --git a/deps/npm/node_modules/npm-registry-client/package.json b/deps/npm/node_modules/npm-registry-client/package.json
index 5f00509e8..08ecd7ef9 100644
--- a/deps/npm/node_modules/npm-registry-client/package.json
+++ b/deps/npm/node_modules/npm-registry-client/package.json
@@ -5,8 +5,8 @@
"url": "http://blog.izs.me/"
},
"name": "npm-registry-client",
- "description": "The code that npm uses to talk to the registry",
- "version": "0.0.7",
+ "description": "Client for the npm registry",
+ "version": "0.0.8",
"repository": {
"url": "git://github.com/isaacs/npm-registry-client"
},
@@ -23,6 +23,7 @@
"chownr": "0",
"mkdirp": "~0.3.3",
"rimraf": "~2.0.1",
+ "retry": "0.6.0",
"npmlog": ""
},
"devDependencies": {
@@ -31,10 +32,8 @@
"optionalDependencies": {
"npmlog": ""
},
- "engines": {
- "node": "*"
- },
- "readme": "# npm-registry-client\n\nThe code that npm uses to talk to the registry.\n\nIt handles all the caching and HTTP calls.\n\n## Usage\n\n```javascript\nvar RegClient = require('npm-registry-client')\nvar client = new RegClient(options)\n\nclient.get(\"npm\", \"latest\", 1000, function (er, data, raw, res) {\n // error is an error if there was a problem.\n // data is the parsed data object\n // raw is the json string\n // res is the response from couch\n})\n```\n\n# Options\n\n* `registry` **Required** {String} URL to the registry\n* `cache` **Required** {String} Path to the cache folder\n* `alwaysAuth` {Boolean} Auth even for GET requests.\n* `auth` {String} A base64-encoded `username:password`\n* `email` {String} User's email address\n* `tag` {String} The default tag to use when publishing new packages.\n Default = `\"latest\"`\n* `ca` {String} Cerficate signing authority certificates to trust.\n* `strictSSL` {Boolean} Whether or not to be strict with SSL\n certificates. Default = `true`\n* `userAgent` {String} User agent header to send. Default =\n `\"node/{process.version}\"`\n* `log` {Object} The logger to use. Defaults to `require(\"npmlog\")` if\n that works, otherwise logs are disabled.\n\n# client.request(method, where, [what], [etag], [nofollow], cb)\n\n* `method` {String} HTTP method\n* `where` {String} Path to request on the server\n* `what` {Stream | Buffer | String | Object} The request body. Objects\n that are not Buffers or Streams are encoded as JSON.\n* `etag` {String} The cached ETag\n* `nofollow` {Boolean} Prevent following 302/301 responses\n* `cb` {Function}\n * `error` {Error | null}\n * `data` {Object} the parsed data object\n * `raw` {String} the json\n * `res` {Response Object} response from couch\n\nMake a request to the registry. All the other methods are wrappers\naround this. one.\n\n# client.adduser(username, password, email, cb)\n\n* `username` {String}\n* `password` {String}\n* `email` {String}\n* `cb` {Function}\n\nAdd a user account to the registry, or verify the credentials.\n\n# client.get(url, [timeout], [nofollow], [staleOk], cb)\n\n* `url` {String} The url path to fetch\n* `timeout` {Number} Number of seconds old that a cached copy must be\n before a new request will be made.\n* `nofollow` {Boolean} Do not follow 301/302 responses\n* `staleOk` {Boolean} If there's cached data available, then return that\n to the callback quickly, and update the cache the background.\n\nFetches data from the registry via a GET request, saving it in\nthe cache folder with the ETag.\n\n# client.publish(data, tarball, [readme], cb)\n\n* `data` {Object} Package data\n* `tarball` {String | Stream} Filename or stream of the package tarball\n* `readme` {String} Contents of the README markdown file\n* `cb` {Function}\n\nPublish a package to the registry.\n\nNote that this does not create the tarball from a folder. However, it\ncan accept a gzipped tar stream or a filename to a tarball.\n\n# client.star(package, starred, cb)\n\n* `package` {String} Name of the package to star\n* `starred` {Boolean} True to star the package, false to unstar it.\n* `cb` {Function}\n\nStar or unstar a package.\n\nNote that the user does not have to be the package owner to star or\nunstar a package, though other writes do require that the user be the\npackage owner.\n\n# client.tag(project, version, tag, cb)\n\n* `project` {String} Project name\n* `version` {String} Version to tag\n* `tag` {String} Tag name to apply\n* `cb` {Function}\n\nMark a version in the `dist-tags` hash, so that `pkg@tag`\nwill fetch the specified version.\n\n# client.unpublish(name, [ver], cb)\n\n* `name` {String} package name\n* `ver` {String} version to unpublish. Leave blank to unpublish all\n versions.\n* `cb` {Function}\n\nRemove a version of a package (or all versions) from the registry. When\nthe last version us unpublished, the entire document is removed from the\ndatabase.\n\n# client.upload(where, file, [etag], [nofollow], cb)\n\n* `where` {String} URL path to upload to\n* `file` {String | Stream} Either the filename or a readable stream\n* `etag` {String} Cache ETag\n* `nofollow` {Boolean} Do not follow 301/302 responses\n* `cb` {Function}\n\nUpload an attachment. Mostly used by `client.publish()`.\n",
- "_id": "npm-registry-client@0.0.7",
- "_from": "npm-registry-client@latest"
+ "license": "BSD",
+ "readme": "# npm-registry-client\n\nThe code that npm uses to talk to the registry.\n\nIt handles all the caching and HTTP calls.\n\n## Usage\n\n```javascript\nvar RegClient = require('npm-registry-client')\nvar client = new RegClient(options)\n\nclient.get(\"npm\", \"latest\", 1000, function (er, data, raw, res) {\n // error is an error if there was a problem.\n // data is the parsed data object\n // raw is the json string\n // res is the response from couch\n})\n```\n\n# Options\n\n* `registry` **Required** {String} URL to the registry\n* `cache` **Required** {String} Path to the cache folder\n* `alwaysAuth` {Boolean} Auth even for GET requests.\n* `auth` {String} A base64-encoded `username:password`\n* `email` {String} User's email address\n* `tag` {String} The default tag to use when publishing new packages.\n Default = `\"latest\"`\n* `ca` {String} Cerficate signing authority certificates to trust.\n* `strictSSL` {Boolean} Whether or not to be strict with SSL\n certificates. Default = `true`\n* `userAgent` {String} User agent header to send. Default =\n `\"node/{process.version}\"`\n* `log` {Object} The logger to use. Defaults to `require(\"npmlog\")` if\n that works, otherwise logs are disabled.\n* `retries` {Number} Number of times to retry on GET failures.\n Default=2\n* `retryFactor` {Number} `factor` setting for `node-retry`. Default=10\n* `retryMinTimeout` {Number} `minTimeout` setting for `node-retry`.\n Default=10000 (10 seconds)\n* `retryMaxTimeout` {Number} `maxTimeout` setting for `node-retry`.\n Default=60000 (60 seconds)\n\n# client.request(method, where, [what], [etag], [nofollow], cb)\n\n* `method` {String} HTTP method\n* `where` {String} Path to request on the server\n* `what` {Stream | Buffer | String | Object} The request body. Objects\n that are not Buffers or Streams are encoded as JSON.\n* `etag` {String} The cached ETag\n* `nofollow` {Boolean} Prevent following 302/301 responses\n* `cb` {Function}\n * `error` {Error | null}\n * `data` {Object} the parsed data object\n * `raw` {String} the json\n * `res` {Response Object} response from couch\n\nMake a request to the registry. All the other methods are wrappers\naround this. one.\n\n# client.adduser(username, password, email, cb)\n\n* `username` {String}\n* `password` {String}\n* `email` {String}\n* `cb` {Function}\n\nAdd a user account to the registry, or verify the credentials.\n\n# client.get(url, [timeout], [nofollow], [staleOk], cb)\n\n* `url` {String} The url path to fetch\n* `timeout` {Number} Number of seconds old that a cached copy must be\n before a new request will be made.\n* `nofollow` {Boolean} Do not follow 301/302 responses\n* `staleOk` {Boolean} If there's cached data available, then return that\n to the callback quickly, and update the cache the background.\n\nFetches data from the registry via a GET request, saving it in\nthe cache folder with the ETag.\n\n# client.publish(data, tarball, [readme], cb)\n\n* `data` {Object} Package data\n* `tarball` {String | Stream} Filename or stream of the package tarball\n* `readme` {String} Contents of the README markdown file\n* `cb` {Function}\n\nPublish a package to the registry.\n\nNote that this does not create the tarball from a folder. However, it\ncan accept a gzipped tar stream or a filename to a tarball.\n\n# client.star(package, starred, cb)\n\n* `package` {String} Name of the package to star\n* `starred` {Boolean} True to star the package, false to unstar it.\n* `cb` {Function}\n\nStar or unstar a package.\n\nNote that the user does not have to be the package owner to star or\nunstar a package, though other writes do require that the user be the\npackage owner.\n\n# client.tag(project, version, tag, cb)\n\n* `project` {String} Project name\n* `version` {String} Version to tag\n* `tag` {String} Tag name to apply\n* `cb` {Function}\n\nMark a version in the `dist-tags` hash, so that `pkg@tag`\nwill fetch the specified version.\n\n# client.unpublish(name, [ver], cb)\n\n* `name` {String} package name\n* `ver` {String} version to unpublish. Leave blank to unpublish all\n versions.\n* `cb` {Function}\n\nRemove a version of a package (or all versions) from the registry. When\nthe last version us unpublished, the entire document is removed from the\ndatabase.\n\n# client.upload(where, file, [etag], [nofollow], cb)\n\n* `where` {String} URL path to upload to\n* `file` {String | Stream} Either the filename or a readable stream\n* `etag` {String} Cache ETag\n* `nofollow` {Boolean} Do not follow 301/302 responses\n* `cb` {Function}\n\nUpload an attachment. Mostly used by `client.publish()`.\n",
+ "_id": "npm-registry-client@0.0.8",
+ "_from": "npm-registry-client@0"
}
diff --git a/deps/npm/node_modules/read-package-json/package.json b/deps/npm/node_modules/read-package-json/package.json
index df15445b5..e147c242b 100644
--- a/deps/npm/node_modules/read-package-json/package.json
+++ b/deps/npm/node_modules/read-package-json/package.json
@@ -1,12 +1,12 @@
{
"name": "read-package-json",
- "version": "0.0.11",
+ "version": "0.0.12",
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me",
"url": "http://blog.izs.me/"
},
- "description": "This is the thing that npm uses to read package.json files. It validates some stuff, and loads some default things.",
+ "description": "The thing npm uses to read package.json files with semantics and defaults and validation",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/read-package-json.git"
@@ -31,6 +31,6 @@
"graceful-fs": "~1.1.8"
},
"readme": "# read-package-json\n\nThis is the thing that npm uses to read package.json files. It\nvalidates some stuff, and loads some default things.\n\nIt keeps a cache of the files you've read, so that you don't end\nup reading the same package.json file multiple times.\n\nNote that if you just want to see what's literally in the package.json\nfile, you can usually do `var data = require('some-module/package.json')`.\n\nThis module is basically only needed by npm, but it's handy to see what\nnpm will see when it looks at your package.\n\n## Usage\n\n```javascript\nvar readJson = require('read-package-json')\n\nreadJson('/path/to/package.json', function (er, data) {\n if (er) {\n console.error(\"There was an error reading the file\")\n return\n }\n\n console.error('the package data is', data)\n}\n```\n\n## readJson(file, cb)\n\n* `file` {String} The path to the package.json file\n* `cb` {Function}\n\nReads the JSON file and does the things.\n\n## `package.json` Fields\n\nSee `man 5 package.json` or `npm help json`.\n\n## readJson.log\n\nBy default this is a reference to the `npmlog` module. But if that\nmodule can't be found, then it'll be set to just a dummy thing that does\nnothing.\n\nReplace with your own `{log,warn,error}` object for fun loggy time.\n\n## readJson.extras(file, data, cb)\n\nRun all the extra stuff relative to the file, with the parsed data.\n\nModifies the data as it does stuff. Calls the cb when it's done.\n\n## readJson.extraSet = [fn, fn, ...]\n\nArray of functions that are called by `extras`. Each one receives the\narguments `fn(file, data, cb)` and is expected to call `cb(er, data)`\nwhen done or when an error occurs.\n\nOrder is indeterminate, so each function should be completely\nindependent.\n\nMix and match!\n\n## readJson.cache\n\nThe `lru-cache` object that readJson uses to not read the same file over\nand over again. See\n[lru-cache](https://github.com/isaacs/node-lru-cache) for details.\n\n## Other Relevant Files Besides `package.json`\n\nSome other files have an effect on the resulting data object, in the\nfollowing ways:\n\n### `README?(.*)`\n\nIf there is a `README` or `README.*` file present, then npm will attach\na `readme` field to the data with the contents of this file.\n\nOwing to the fact that roughly 100% of existing node modules have\nMarkdown README files, it will generally be assumed to be Markdown,\nregardless of the extension. Please plan accordingly.\n\n### `server.js`\n\nIf there is a `server.js` file, and there is not already a\n`scripts.start` field, then `scripts.start` will be set to `node\nserver.js`.\n\n### `AUTHORS`\n\nIf there is not already a `contributors` field, then the `contributors`\nfield will be set to the contents of the `AUTHORS` file, split by lines,\nand parsed.\n\n### `bindings.gyp`\n\nIf a bindings.gyp file exists, and there is not already a\n`scripts.install` field, then the `scripts.install` field will be set to\n`node-gyp rebuild`.\n\n### `wscript`\n\nIf a wscript file exists, and there is not already a `scripts.install`\nfield, then the `scripts.install` field will be set to `node-waf clean ;\nnode-waf configure build`.\n\nNote that the `bindings.gyp` file supercedes this, since node-waf has\nbeen deprecated in favor of node-gyp.\n\n### `index.js`\n\nIf the json file does not exist, but there is a `index.js` file\npresent instead, and that file has a package comment, then it will try\nto parse the package comment, and use that as the data instead.\n\nA package comment looks like this:\n\n```javascript\n/**package\n * { \"name\": \"my-bare-module\"\n * , \"version\": \"1.2.3\"\n * , \"description\": \"etc....\" }\n **/\n\n// or...\n\n/**package\n{ \"name\": \"my-bare-module\"\n, \"version\": \"1.2.3\"\n, \"description\": \"etc....\" }\n**/\n```\n\nThe important thing is that it starts with `/**package`, and ends with\n`**/`. If the package.json file exists, then the index.js is not\nparsed.\n\n### `{directories.man}/*.[0-9]`\n\nIf there is not already a `man` field defined as an array of files or a\nsingle file, and\nthere is a `directories.man` field defined, then that directory will\nbe searched for manpages.\n\nAny valid manpages found in that directory will be assigned to the `man`\narray, and installed in the appropriate man directory at package install\ntime, when installed globally on a Unix system.\n\n### `{directories.bin}/*`\n\nIf there is not already a `bin` field defined as a string filename or a\nhash of `<name> : <filename>` pairs, then the `directories.bin`\ndirectory will be searched and all the files within it will be linked as\nexecutables at install time.\n\nWhen installing locally, npm links bins into `node_modules/.bin`, which\nis in the `PATH` environ when npm runs scripts. When\ninstalling globally, they are linked into `{prefix}/bin`, which is\npresumably in the `PATH` environment variable.\n",
- "_id": "read-package-json@0.0.11",
+ "_id": "read-package-json@0.0.12",
"_from": "read-package-json@0"
}
diff --git a/deps/npm/node_modules/read-package-json/read-json.js b/deps/npm/node_modules/read-package-json/read-json.js
index d3c7a1a05..ec3bf709b 100644
--- a/deps/npm/node_modules/read-package-json/read-json.js
+++ b/deps/npm/node_modules/read-package-json/read-json.js
@@ -214,7 +214,7 @@ function readmeDescription (file, data) {
// the first block of text before the first heading
// that isn't the first line heading
d = d.trim().split('\n')
- for (var s = 0; d[s].trim().match(/^(#|$)/); s ++);
+ for (var s = 0; d[s] && d[s].trim().match(/^(#|$)/); s ++);
var l = d.length
for (var e = s + 1; e < l && d[e].trim(); e ++);
data.description = d.slice(s, e).join(' ').trim()
diff --git a/deps/npm/node_modules/retry/.npmignore b/deps/npm/node_modules/retry/.npmignore
new file mode 100644
index 000000000..5a23aa6a0
--- /dev/null
+++ b/deps/npm/node_modules/retry/.npmignore
@@ -0,0 +1 @@
+/node_modules/*
diff --git a/deps/npm/node_modules/retry/License b/deps/npm/node_modules/retry/License
new file mode 100644
index 000000000..0b58de379
--- /dev/null
+++ b/deps/npm/node_modules/retry/License
@@ -0,0 +1,21 @@
+Copyright (c) 2011:
+Tim Koschützki (tim@debuggable.com)
+Felix Geisendörfer (felix@debuggable.com)
+
+ 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/retry/Makefile b/deps/npm/node_modules/retry/Makefile
new file mode 100644
index 000000000..a6e68c418
--- /dev/null
+++ b/deps/npm/node_modules/retry/Makefile
@@ -0,0 +1,7 @@
+SHELL := /bin/bash
+
+test:
+ @node test/runner.js
+
+.PHONY: test
+
diff --git a/deps/npm/node_modules/retry/Readme.md b/deps/npm/node_modules/retry/Readme.md
new file mode 100644
index 000000000..2bb865097
--- /dev/null
+++ b/deps/npm/node_modules/retry/Readme.md
@@ -0,0 +1,167 @@
+# retry
+
+Abstraction for exponential and custom retry strategies for failed operations.
+
+## Installation
+
+ npm install retry
+
+## Current Status
+
+This module has been tested and is ready to be used.
+
+## Tutorial
+
+The example below will retry a potentially failing `dns.resolve` operation
+`10` times using an exponential backoff strategy. With the default settings, this
+means the last attempt is made after `34 minutes and 7 seconds`.
+
+``` javascript
+var dns = require('dns');
+var retry = require('retry');
+
+function faultTolerantResolve(address, cb) {
+ var operation = retry.operation();
+
+ operation.attempt(function(currentAttempt) {
+ dns.resolve(address, function(err, addresses) {
+ if (operation.retry(err)) {
+ return;
+ }
+
+ cb(operation.mainError(), addresses);
+ });
+ });
+}
+
+faultTolerantResolve('nodejs.org', function(err, addresses) {
+ console.log(err, addresses);
+});
+```
+
+Of course you can also configure the factors that go into the exponential
+backoff. See the API documentation below for all available settings.
+currentAttempt is an int representing the number of attempts so far.
+
+``` javascript
+var operation = retry.operation({
+ retries: 5,
+ factor: 3,
+ minTimeout: 1 * 1000,
+ maxTimeout: 60 * 1000,
+ randomize: true,
+});
+```
+
+## API
+
+### retry.operation([options])
+
+Creates a new `RetryOperation` object. See the `retry.timeouts()` function
+below for available `options`.
+
+### retry.timeouts([options])
+
+Returns an array of timeouts. All time `options` and return values are in
+milliseconds. If `options` is an array, a copy of that array is returned.
+
+`options` is a JS object that can contain any of the following keys:
+
+* `retries`: The maximum amount of times to retry the operation. Default is `10`.
+* `factor`: The exponential factor to use. Default is `2`.
+* `minTimeout`: The amount of time before starting the first retry. Default is `1000`.
+* `maxTimeout`: The maximum amount of time between two retries. Default is `Infinity`.
+* `randomize`: Randomizes the timeouts by multiplying with a factor between `1` to `2`. Default is `false`.
+
+The formula used to calculate the individual timeouts is:
+
+```
+var Math.min(random * minTimeout * Math.pow(factor, attempt), maxTimeout);
+```
+
+Have a look at [this article][article] for a better explanation of approach.
+
+If you want to tune your `factor` / `times` settings to attempt the last retry
+after a certain amount of time, you can use wolfram alpha. For example in order
+to tune for `10` attempts in `5 minutes`, you can use this equation:
+
+![screenshot](https://github.com/tim-kos/node-retry/raw/master/equation.gif)
+
+Explaining the various values from left to right:
+
+* `k = 0 ... 9`: The `retries` value (10)
+* `1000`: The `minTimeout` value in ms (1000)
+* `x^k`: No need to change this, `x` will be your resulting factor
+* `5 * 60 * 1000`: The desired total amount of time for retrying in ms (5 minutes)
+
+To make this a little easier for you, use wolfram alpha to do the calculations:
+
+[http://www.wolframalpha.com/input/?i=Sum%5B1000*x^k%2C+{k%2C+0%2C+9}%5D+%3D+5+*+60+*+1000]()
+
+[article]: http://dthain.blogspot.com/2009/02/exponential-backoff-in-distributed.html
+
+### new RetryOperation(timeouts)
+
+Creates a new `RetryOperation` where `timeouts` is an array where each value is
+a timeout given in milliseconds.
+
+#### retryOperation.errors()
+
+Returns an array of all errors that have been passed to
+`retryOperation.retry()` so far.
+
+#### retryOperation.mainError()
+
+A reference to the error object that occured most frequently. Errors are
+compared using the `error.message` property.
+
+If multiple error messages occured the same amount of time, the last error
+object with that message is returned.
+
+If no errors occured so far, the value is `null`.
+
+#### retryOperation.attempt(fn, timeoutOps)
+
+Defines the function `fn` that is to be retried and executes it for the first
+time right away. The `fn` function can receive an optional `currentAttempt` callback that represents the number of attempts to execute `fn` so far.
+
+Optionally defines `timeoutOps` which is an object having a property `timeout` in miliseconds and a property `cb` callback function.
+Whenever your retry operation takes longer than `timeout` to execute, the timeout callback function `cb` is called.
+
+
+#### retryOperation.try(fn)
+
+This is an alias for `retryOperation.attempt(fn)`. This is deprecated.
+
+#### retryOperation.start(fn)
+
+This is an alias for `retryOperation.attempt(fn)`. This is deprecated.
+
+#### retryOperation.retry(error)
+
+Returns `false` when no `error` value is given, or the maximum amount of retries
+has been reached.
+
+Otherwise it returns `true`, and retries the operation after the timeout for
+the current attempt number.
+
+#### retryOperation.attempts()
+
+Returns an int representing the number of attempts it took to call `fn` before it was successful.
+
+## License
+
+retry is licensed under the MIT license.
+
+
+#Changelog
+
+0.6.0 Introduced optional timeOps parameter for the attempt() function which is an object having a property timeout in miliseconds and a property cb callback function. Whenever your retry operation takes longer than timeout to execute, the timeout callback function cb is called.
+
+0.5.0 Some minor refactorings.
+
+0.4.0 Changed retryOperation.try() to retryOperation.attempt(). Deprecated the aliases start() and try() for it.
+
+0.3.0 Added retryOperation.start() which is an alias for retryOperation.try().
+
+0.2.0 Added attempts() function and parameter to retryOperation.try() representing the number of attempts it took to call fn().
diff --git a/deps/npm/node_modules/retry/equation.gif b/deps/npm/node_modules/retry/equation.gif
new file mode 100644
index 000000000..97107237b
--- /dev/null
+++ b/deps/npm/node_modules/retry/equation.gif
Binary files differ
diff --git a/deps/npm/node_modules/retry/index.js b/deps/npm/node_modules/retry/index.js
new file mode 100644
index 000000000..ee62f3a11
--- /dev/null
+++ b/deps/npm/node_modules/retry/index.js
@@ -0,0 +1 @@
+module.exports = require('./lib/retry'); \ No newline at end of file
diff --git a/deps/npm/node_modules/retry/lib/retry.js b/deps/npm/node_modules/retry/lib/retry.js
new file mode 100644
index 000000000..38406860d
--- /dev/null
+++ b/deps/npm/node_modules/retry/lib/retry.js
@@ -0,0 +1,50 @@
+var RetryOperation = require('./retry_operation');
+
+exports.operation = function(options) {
+ var timeouts = exports.timeouts(options);
+ return new RetryOperation(timeouts);
+};
+
+exports.timeouts = function(options) {
+ if (options instanceof Array) {
+ return [].concat(options);
+ }
+
+ var opts = {
+ retries: 10,
+ factor: 2,
+ minTimeout: 1 * 1000,
+ maxTimeout: Infinity,
+ randomize: false
+ };
+ for (var key in options) {
+ opts[key] = options[key];
+ }
+
+ if (opts.minTimeout > opts.maxTimeout) {
+ throw new Error('minTimeout is greater than maxTimeout');
+ }
+
+ var timeouts = [];
+ for (var i = 0; i < opts.retries; i++) {
+ timeouts.push(this._createTimeout(i, opts));
+ }
+
+ // sort the array numerically ascending
+ timeouts.sort(function(a,b) {
+ return a - b;
+ });
+
+ return timeouts;
+};
+
+exports._createTimeout = function(attempt, opts) {
+ var random = (opts.randomize)
+ ? (Math.random() + 1)
+ : 1;
+
+ var timeout = Math.round(random * opts.minTimeout * Math.pow(opts.factor, attempt));
+ timeout = Math.min(timeout, opts.maxTimeout);
+
+ return timeout;
+}; \ No newline at end of file
diff --git a/deps/npm/node_modules/retry/lib/retry_operation.js b/deps/npm/node_modules/retry/lib/retry_operation.js
new file mode 100644
index 000000000..f24d2d5a4
--- /dev/null
+++ b/deps/npm/node_modules/retry/lib/retry_operation.js
@@ -0,0 +1,109 @@
+function RetryOperation(timeouts) {
+ this._timeouts = timeouts;
+ this._fn = null;
+ this._errors = [];
+ this._attempts = 1;
+ this._operationTimeout = null;
+ this._operationTimeoutCb = null;
+ this._timeout = null;
+}
+module.exports = RetryOperation;
+
+RetryOperation.prototype.retry = function(err) {
+ if (this._timeout) {
+ clearTimeout(this._timeout);
+ }
+
+ if (!err) {
+ return false;
+ }
+
+ this._errors.push(err);
+
+ var timeout = this._timeouts.shift();
+ if (timeout === undefined) {
+ return false;
+ }
+
+ this._attempts++;
+
+ var self = this;
+ setTimeout(function() {
+ self._fn(self._attempts);
+
+ if (self._operationTimeoutCb) {
+ self._timeout = setTimeout(function() {
+ self._operationTimeoutCb(self._attempts);
+ }, self._operationTimeout);
+ }
+ }, timeout);
+
+ return true;
+};
+
+RetryOperation.prototype.attempt = function(fn, timeoutOps) {
+ this._fn = fn;
+
+ if (timeoutOps) {
+ if (timeoutOps.timeout) {
+ this._operationTimeout = timeoutOps.timeout;
+ }
+ if (timeoutOps.cb) {
+ this._operationTimeoutCb = timeoutOps.cb;
+ }
+ }
+
+ this._fn(this._attempts);
+
+ var self = this;
+ if (this._operationTimeoutCb) {
+ this._timeout = setTimeout(function() {
+ self._operationTimeoutCb();
+ }, self._operationTimeout);
+ }
+};
+
+RetryOperation.prototype.try = function(fn) {
+ console.log('Using RetryOperation.try() is deprecated');
+ this.attempt(fn);
+};
+
+RetryOperation.prototype.start = function(fn) {
+ console.log('Using RetryOperation.start() is deprecated');
+ this.attempt(fn);
+};
+
+RetryOperation.prototype.start = RetryOperation.prototype.try;
+
+RetryOperation.prototype.errors = function() {
+ return this._errors;
+};
+
+RetryOperation.prototype.attempts = function() {
+ return this._attempts;
+};
+
+RetryOperation.prototype.mainError = function() {
+ if (this._errors.length === 0) {
+ return null;
+ }
+
+ var counts = {};
+ var mainError = null;
+ var mainErrorCount = 0;
+
+ for (var i = 0; i < this._errors.length; i++) {
+ var error = this._errors[i];
+ var message = error.message;
+ var count = (counts[message] || 0) + 1;
+
+ counts[message] = count;
+
+ if (count >= mainErrorCount) {
+ mainError = error;
+ mainErrorCount = count;
+ }
+ }
+
+ return mainError;
+}; \ No newline at end of file
diff --git a/deps/npm/node_modules/retry/package.json b/deps/npm/node_modules/retry/package.json
new file mode 100644
index 000000000..8f5e6d21f
--- /dev/null
+++ b/deps/npm/node_modules/retry/package.json
@@ -0,0 +1,29 @@
+{
+ "author": {
+ "name": "Tim Koschützki",
+ "email": "tim@debuggable.com",
+ "url": "http://debuggable.com/"
+ },
+ "name": "retry",
+ "description": "Abstraction for exponential and custom retry strategies for failed operations.",
+ "version": "0.6.0",
+ "homepage": "https://github.com/tim-kos/node-retry",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/felixge/node-retry.git"
+ },
+ "directories": {
+ "lib": "./lib"
+ },
+ "main": "index",
+ "engines": {
+ "node": "*"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "fake": "0.2.0",
+ "far": "0.0.1"
+ },
+ "_id": "retry@0.6.0",
+ "_from": "retry"
+}