summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules')
-rw-r--r--deps/npm/node_modules/npm-install-checks/LICENSE234
-rw-r--r--deps/npm/node_modules/npm-install-checks/README.md25
-rw-r--r--deps/npm/node_modules/npm-install-checks/index.js146
-rw-r--r--deps/npm/node_modules/npm-install-checks/package.json43
-rw-r--r--deps/npm/node_modules/npm-install-checks/test/check-engine.js35
-rw-r--r--deps/npm/node_modules/npm-install-checks/test/check-git.js31
-rw-r--r--deps/npm/node_modules/npm-install-checks/test/check-platform.js44
-rw-r--r--deps/npm/node_modules/npm-registry-client/index.js17
-rw-r--r--deps/npm/node_modules/npm-registry-client/lib/publish.js20
-rw-r--r--deps/npm/node_modules/npm-registry-client/lib/request.js65
-rw-r--r--deps/npm/node_modules/npm-registry-client/node_modules/couch-login/.npmignore4
-rw-r--r--deps/npm/node_modules/npm-registry-client/node_modules/couch-login/LICENSE15
-rw-r--r--deps/npm/node_modules/npm-registry-client/node_modules/couch-login/README.md278
-rw-r--r--deps/npm/node_modules/npm-registry-client/node_modules/couch-login/couch-login.js399
-rw-r--r--deps/npm/node_modules/npm-registry-client/node_modules/couch-login/package.json33
-rw-r--r--deps/npm/node_modules/npm-registry-client/node_modules/couch-login/test/00-setup.js100
-rw-r--r--deps/npm/node_modules/npm-registry-client/node_modules/couch-login/test/basic.js298
-rw-r--r--deps/npm/node_modules/npm-registry-client/node_modules/couch-login/test/fixtures/_replicator.couchbin4194 -> 0 bytes
-rw-r--r--deps/npm/node_modules/npm-registry-client/node_modules/couch-login/test/fixtures/couch.ini25
-rw-r--r--deps/npm/node_modules/npm-registry-client/node_modules/couch-login/test/fixtures/registry.couchbin24674 -> 0 bytes
-rw-r--r--deps/npm/node_modules/npm-registry-client/node_modules/couch-login/test/registry.js252
-rw-r--r--deps/npm/node_modules/npm-registry-client/node_modules/couch-login/test/reset-then-signup.js112
-rw-r--r--deps/npm/node_modules/npm-registry-client/node_modules/couch-login/test/zz-teardown.js23
-rw-r--r--deps/npm/node_modules/npm-registry-client/package.json11
-rw-r--r--deps/npm/node_modules/read-package-json/.npmignore13
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/fixer.js63
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/safe_format.js9
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/warning_messages.json28
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/package.json10
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/normalize.js55
-rw-r--r--deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/typo.js75
-rw-r--r--deps/npm/node_modules/read-package-json/package.json12
32 files changed, 755 insertions, 1720 deletions
diff --git a/deps/npm/node_modules/npm-install-checks/LICENSE b/deps/npm/node_modules/npm-install-checks/LICENSE
new file mode 100644
index 0000000000..1a8fdb735b
--- /dev/null
+++ b/deps/npm/node_modules/npm-install-checks/LICENSE
@@ -0,0 +1,234 @@
+Copyright (c) Robert Kowalski ("Author")
+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 AUTHOR 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 AUTHOR 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.
+
+
+This uses parts of npm, (c) Isaac Z. Schlueter, under the following license:
+
+
+The Artistic License 2.0
+
+Copyright (c) 2000-2006, The Perl Foundation.
+
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+
+Preamble
+
+This license establishes the terms under which a given free software
+Package may be copied, modified, distributed, and/or redistributed.
+The intent is that the Copyright Holder maintains some artistic
+control over the development of that Package while still keeping the
+Package available as open source and free software.
+
+You are always permitted to make arrangements wholly outside of this
+license directly with the Copyright Holder of a given Package. If the
+terms of this license do not permit the full use that you propose to
+make of the Package, you should contact the Copyright Holder and seek
+a different licensing arrangement.
+
+Definitions
+
+ "Copyright Holder" means the individual(s) or organization(s)
+ named in the copyright notice for the entire Package.
+
+ "Contributor" means any party that has contributed code or other
+ material to the Package, in accordance with the Copyright Holder's
+ procedures.
+
+ "You" and "your" means any person who would like to copy,
+ distribute, or modify the Package.
+
+ "Package" means the collection of files distributed by the
+ Copyright Holder, and derivatives of that collection and/or of
+ those files. A given Package may consist of either the Standard
+ Version, or a Modified Version.
+
+ "Distribute" means providing a copy of the Package or making it
+ accessible to anyone else, or in the case of a company or
+ organization, to others outside of your company or organization.
+
+ "Distributor Fee" means any fee that you charge for Distributing
+ this Package or providing support for this Package to another
+ party. It does not mean licensing fees.
+
+ "Standard Version" refers to the Package if it has not been
+ modified, or has been modified only in ways explicitly requested
+ by the Copyright Holder.
+
+ "Modified Version" means the Package, if it has been changed, and
+ such changes were not explicitly requested by the Copyright
+ Holder.
+
+ "Original License" means this Artistic License as Distributed with
+ the Standard Version of the Package, in its current version or as
+ it may be modified by The Perl Foundation in the future.
+
+ "Source" form means the source code, documentation source, and
+ configuration files for the Package.
+
+ "Compiled" form means the compiled bytecode, object code, binary,
+ or any other form resulting from mechanical transformation or
+ translation of the Source form.
+
+
+Permission for Use and Modification Without Distribution
+
+(1) You are permitted to use the Standard Version and create and use
+Modified Versions for any purpose without restriction, provided that
+you do not Distribute the Modified Version.
+
+
+Permissions for Redistribution of the Standard Version
+
+(2) You may Distribute verbatim copies of the Source form of the
+Standard Version of this Package in any medium without restriction,
+either gratis or for a Distributor Fee, provided that you duplicate
+all of the original copyright notices and associated disclaimers. At
+your discretion, such verbatim copies may or may not include a
+Compiled form of the Package.
+
+(3) You may apply any bug fixes, portability changes, and other
+modifications made available from the Copyright Holder. The resulting
+Package will still be considered the Standard Version, and as such
+will be subject to the Original License.
+
+
+Distribution of Modified Versions of the Package as Source
+
+(4) You may Distribute your Modified Version as Source (either gratis
+or for a Distributor Fee, and with or without a Compiled form of the
+Modified Version) provided that you clearly document how it differs
+from the Standard Version, including, but not limited to, documenting
+any non-standard features, executables, or modules, and provided that
+you do at least ONE of the following:
+
+ (a) make the Modified Version available to the Copyright Holder
+ of the Standard Version, under the Original License, so that the
+ Copyright Holder may include your modifications in the Standard
+ Version.
+
+ (b) ensure that installation of your Modified Version does not
+ prevent the user installing or running the Standard Version. In
+ addition, the Modified Version must bear a name that is different
+ from the name of the Standard Version.
+
+ (c) allow anyone who receives a copy of the Modified Version to
+ make the Source form of the Modified Version available to others
+ under
+
+ (i) the Original License or
+
+ (ii) a license that permits the licensee to freely copy,
+ modify and redistribute the Modified Version using the same
+ licensing terms that apply to the copy that the licensee
+ received, and requires that the Source form of the Modified
+ Version, and of any works derived from it, be made freely
+ available in that license fees are prohibited but Distributor
+ Fees are allowed.
+
+
+Distribution of Compiled Forms of the Standard Version
+or Modified Versions without the Source
+
+(5) You may Distribute Compiled forms of the Standard Version without
+the Source, provided that you include complete instructions on how to
+get the Source of the Standard Version. Such instructions must be
+valid at the time of your distribution. If these instructions, at any
+time while you are carrying out such distribution, become invalid, you
+must provide new instructions on demand or cease further distribution.
+If you provide valid instructions or cease distribution within thirty
+days after you become aware that the instructions are invalid, then
+you do not forfeit any of your rights under this license.
+
+(6) You may Distribute a Modified Version in Compiled form without
+the Source, provided that you comply with Section 4 with respect to
+the Source of the Modified Version.
+
+
+Aggregating or Linking the Package
+
+(7) You may aggregate the Package (either the Standard Version or
+Modified Version) with other packages and Distribute the resulting
+aggregation provided that you do not charge a licensing fee for the
+Package. Distributor Fees are permitted, and licensing fees for other
+components in the aggregation are permitted. The terms of this license
+apply to the use and Distribution of the Standard or Modified Versions
+as included in the aggregation.
+
+(8) You are permitted to link Modified and Standard Versions with
+other works, to embed the Package in a larger work of your own, or to
+build stand-alone binary or bytecode versions of applications that
+include the Package, and Distribute the result without restriction,
+provided the result does not expose a direct interface to the Package.
+
+
+Items That are Not Considered Part of a Modified Version
+
+(9) Works (including, but not limited to, modules and scripts) that
+merely extend or make use of the Package, do not, by themselves, cause
+the Package to be a Modified Version. In addition, such works are not
+considered parts of the Package itself, and are not subject to the
+terms of this license.
+
+
+General Provisions
+
+(10) Any use, modification, and distribution of the Standard or
+Modified Versions is governed by this Artistic License. By using,
+modifying or distributing the Package, you accept this license. Do not
+use, modify, or distribute the Package, if you do not accept this
+license.
+
+(11) If your Modified Version has been derived from a Modified
+Version made by someone other than you, you are nevertheless required
+to ensure that your Modified Version complies with the requirements of
+this license.
+
+(12) This license does not grant you the right to use any trademark,
+service mark, tradename, or logo of the Copyright Holder.
+
+(13) This license includes the non-exclusive, worldwide,
+free-of-charge patent license to make, have made, use, offer to sell,
+sell, import and otherwise transfer the Package with respect to any
+patent claims licensable by the Copyright Holder that are necessarily
+infringed by the Package. If you institute patent litigation
+(including a cross-claim or counterclaim) against any party alleging
+that the Package constitutes direct or contributory patent
+infringement, then this Artistic License to you shall terminate on the
+date that such litigation is filed.
+
+(14) Disclaimer of Warranty:
+THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
+IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
+WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
+NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL
+LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/deps/npm/node_modules/npm-install-checks/README.md b/deps/npm/node_modules/npm-install-checks/README.md
new file mode 100644
index 0000000000..7da4af1487
--- /dev/null
+++ b/deps/npm/node_modules/npm-install-checks/README.md
@@ -0,0 +1,25 @@
+# npm-install-checks
+
+A package that contains checks that npm runs during the installation.
+
+## API
+
+### .checkEngine(target, npmVer, nodeVer, force, strict, cb)
+Check if node/npm version is supported by the package.
+
+Error type: `ENOTSUP`
+
+### .checkPlatform(target, force, cb)
+Check if OS/Arch is supported by the package.
+
+Error type: `EBADPLATFORM`
+
+### .checkCycle(target, ancestors, cb)
+Check for cyclic dependencies.
+
+Error type: `ECYCLE`
+
+### .checkGit(folder, cb)
+Check if a folder is a .git folder.
+
+Error type: `EISGIT`
diff --git a/deps/npm/node_modules/npm-install-checks/index.js b/deps/npm/node_modules/npm-install-checks/index.js
new file mode 100644
index 0000000000..10f214fa93
--- /dev/null
+++ b/deps/npm/node_modules/npm-install-checks/index.js
@@ -0,0 +1,146 @@
+var fs = require("fs")
+var path = require("path")
+var log = require("npmlog")
+var semver = require("semver")
+
+exports.checkEngine = checkEngine
+function checkEngine (target, npmVer, nodeVer, force, strict, cb) {
+ var nodev = force ? null : nodeVer
+ , strict = strict || target.engineStrict
+ , eng = target.engines
+ if (!eng) return cb()
+ if (nodev && eng.node && !semver.satisfies(nodev, eng.node)
+ || eng.npm && !semver.satisfies(npmVer, eng.npm)) {
+
+ if (strict) {
+ var er = new Error("Unsupported")
+ er.code = "ENOTSUP"
+ er.required = eng
+ er.pkgid = target._id
+ return cb(er)
+ } else {
+ log.warn( "engine", "%s: wanted: %j (current: %j)"
+ , target._id, eng, {node: nodev, npm: npmVer} )
+ }
+ }
+ return cb()
+}
+
+exports.checkPlatform = checkPlatform
+function checkPlatform (target, force, cb) {
+ var platform = process.platform
+ , arch = process.arch
+ , osOk = true
+ , cpuOk = true
+
+ if (force) {
+ return cb()
+ }
+
+ if (target.os) {
+ osOk = checkList(platform, target.os)
+ }
+ if (target.cpu) {
+ cpuOk = checkList(arch, target.cpu)
+ }
+ if (!osOk || !cpuOk) {
+ var er = new Error("Unsupported")
+ er.code = "EBADPLATFORM"
+ er.os = target.os || ['any']
+ er.cpu = target.cpu || ['any']
+ er.pkgid = target._id
+ return cb(er)
+ }
+ return cb()
+}
+
+function checkList (value, list) {
+ var tmp
+ , match = false
+ , blc = 0
+ if (typeof list === "string") {
+ list = [list]
+ }
+ if (list.length === 1 && list[0] === "any") {
+ return true
+ }
+ for (var i = 0; i < list.length; ++i) {
+ tmp = list[i]
+ if (tmp[0] === '!') {
+ tmp = tmp.slice(1)
+ if (tmp === value) {
+ return false
+ }
+ ++blc
+ } else {
+ match = match || tmp === value
+ }
+ }
+ return match || blc === list.length
+}
+
+exports.checkCycle = checkCycle
+function checkCycle (target, ancestors, cb) {
+ // there are some very rare and pathological edge-cases where
+ // a cycle can cause npm to try to install a never-ending tree
+ // of stuff.
+ // Simplest:
+ //
+ // A -> B -> A' -> B' -> A -> B -> A' -> B' -> A -> ...
+ //
+ // Solution: Simply flat-out refuse to install any name@version
+ // that is already in the prototype tree of the ancestors object.
+ // A more correct, but more complex, solution would be to symlink
+ // the deeper thing into the new location.
+ // Will do that if anyone whines about this irl.
+ //
+ // Note: `npm install foo` inside of the `foo` package will abort
+ // earlier if `--force` is not set. However, if it IS set, then
+ // we need to still fail here, but just skip the first level. Of
+ // course, it'll still fail eventually if it's a true cycle, and
+ // leave things in an undefined state, but that's what is to be
+ // expected when `--force` is used. That is why getPrototypeOf
+ // is used *twice* here: to skip the first level of repetition.
+
+ var p = Object.getPrototypeOf(Object.getPrototypeOf(ancestors))
+ , name = target.name
+ , version = target.version
+ while (p && p !== Object.prototype && p[name] !== version) {
+ p = Object.getPrototypeOf(p)
+ }
+ if (p[name] !== version) return cb()
+
+ var er = new Error("Unresolvable cycle detected")
+ var tree = [target._id, JSON.parse(JSON.stringify(ancestors))]
+ , t = Object.getPrototypeOf(ancestors)
+ while (t && t !== Object.prototype) {
+ if (t === p) t.THIS_IS_P = true
+ tree.push(JSON.parse(JSON.stringify(t)))
+ t = Object.getPrototypeOf(t)
+ }
+ log.verbose("unresolvable dependency tree", tree)
+ er.pkgid = target._id
+ er.code = "ECYCLE"
+ return cb(er)
+}
+
+exports.checkGit = checkGit
+function checkGit (folder, cb) {
+ // if it's a git repo then don't touch it!
+ fs.lstat(folder, function (er, s) {
+ if (er || !s.isDirectory()) return cb()
+ else checkGit_(folder, cb)
+ })
+}
+
+function checkGit_ (folder, cb) {
+ fs.stat(path.resolve(folder, ".git"), function (er, s) {
+ if (!er && s.isDirectory()) {
+ var e = new Error("Appears to be a git repo or submodule.")
+ e.path = folder
+ e.code = "EISGIT"
+ return cb(e)
+ }
+ cb()
+ })
+}
diff --git a/deps/npm/node_modules/npm-install-checks/package.json b/deps/npm/node_modules/npm-install-checks/package.json
new file mode 100644
index 0000000000..39b7adf994
--- /dev/null
+++ b/deps/npm/node_modules/npm-install-checks/package.json
@@ -0,0 +1,43 @@
+{
+ "name": "npm-install-checks",
+ "version": "1.0.0",
+ "description": "checks that npm runs during the installation of a module",
+ "main": "index.js",
+ "dependencies": {
+ "npmlog": "0.0.6",
+ "semver": "~2.2.1"
+ },
+ "devDependencies": {
+ "tap": "~0.4.8",
+ "rimraf": "~2.2.5",
+ "mkdirp": "~0.3.5"
+ },
+ "scripts": {
+ "test": "tap test/*.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/robertkowalski/npm-install-checks.git"
+ },
+ "homepage": "https://github.com/robertkowalski/npm-install-checks",
+ "keywords": [
+ "npm,",
+ "install"
+ ],
+ "author": {
+ "name": "Robert Kowalski",
+ "email": "rok@kowalski.gd"
+ },
+ "license": "BSD-2-Clause",
+ "bugs": {
+ "url": "https://github.com/robertkowalski/npm-install-checks/issues"
+ },
+ "readme": "# npm-install-checks\n\nA package that contains checks that npm runs during the installation.\n\n## API\n\n### .checkEngine(target, npmVer, nodeVer, force, strict, cb)\nCheck if node/npm version is supported by the package.\n\nError type: `ENOTSUP`\n\n### .checkPlatform(target, force, cb)\nCheck if OS/Arch is supported by the package.\n\nError type: `EBADPLATFORM`\n\n### .checkCycle(target, ancestors, cb)\nCheck for cyclic dependencies.\n\nError type: `ECYCLE`\n\n### .checkGit(folder, cb)\nCheck if a folder is a .git folder.\n\nError type: `EISGIT`\n",
+ "readmeFilename": "README.md",
+ "_id": "npm-install-checks@1.0.0",
+ "dist": {
+ "shasum": "7e1469b5e0c693b2ae2a8830b5fc4e7bf76c88fd"
+ },
+ "_from": "npm-install-checks@1.0.0",
+ "_resolved": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-1.0.0.tgz"
+}
diff --git a/deps/npm/node_modules/npm-install-checks/test/check-engine.js b/deps/npm/node_modules/npm-install-checks/test/check-engine.js
new file mode 100644
index 0000000000..a16b13d7db
--- /dev/null
+++ b/deps/npm/node_modules/npm-install-checks/test/check-engine.js
@@ -0,0 +1,35 @@
+var test = require("tap").test
+var c = require("../index.js").checkEngine
+
+test("no engine defined", function (t) {
+ c({ engines: {}}, "1.1.2", "0.2.1", false, true, function (err) {
+ t.notOk(err, "no error present")
+ t.end()
+ })
+})
+
+test("node version too old", function (t) {
+ var target = { engines: { node: "0.10.24" }}
+ c(target, "1.1.2", "0.10.18", false, true, function (err) {
+ t.ok(err, "returns an error")
+ t.equals(err.required.node, "0.10.24")
+ t.end()
+ })
+})
+
+test("npm version too old", function (t) {
+ var target = { engines: { npm: "1.3.6" }}
+ c(target, "1.4.2", "0.2.1", false, true, function (err) {
+ t.ok(err, "returns an error")
+ t.equals(err.required.npm, "1.3.6")
+ t.end()
+ })
+})
+
+test("strict=false does not return an error", function (t) {
+ var target = { engines: { npm: "1.3.6" }}
+ c(target, "1.4.2", "0.2.1", false, false, function (err) {
+ t.notOk(err, "returns no error")
+ t.end()
+ })
+})
diff --git a/deps/npm/node_modules/npm-install-checks/test/check-git.js b/deps/npm/node_modules/npm-install-checks/test/check-git.js
new file mode 100644
index 0000000000..d09d0b5181
--- /dev/null
+++ b/deps/npm/node_modules/npm-install-checks/test/check-git.js
@@ -0,0 +1,31 @@
+var test = require("tap").test
+var c = require("../index.js").checkGit
+var fs = require("fs")
+var rimraf = require("rimraf")
+var mkdirp = require("mkdirp")
+var path = require("path")
+var gitFixturePath = path.resolve(__dirname, "out")
+
+test("is .git repo", function (t) {
+ mkdirp(gitFixturePath + "/.git", function () {
+ c(gitFixturePath, function (err) {
+ t.ok(err, "error present")
+ t.equal(err.code, "EISGIT")
+ t.end()
+ })
+ })
+})
+
+test("is not a .git repo", function (t) {
+ c(__dirname, function (err) {
+ t.notOk(err, "error not present")
+ t.end()
+ })
+})
+
+test("cleanup", function (t) {
+ rimraf(gitFixturePath, function () {
+ t.pass("cleanup")
+ t.end()
+ })
+})
diff --git a/deps/npm/node_modules/npm-install-checks/test/check-platform.js b/deps/npm/node_modules/npm-install-checks/test/check-platform.js
new file mode 100644
index 0000000000..eeeb1bceff
--- /dev/null
+++ b/deps/npm/node_modules/npm-install-checks/test/check-platform.js
@@ -0,0 +1,44 @@
+var test = require("tap").test
+var c = require("../index.js").checkPlatform
+
+test("target cpu wrong", function (t) {
+ var target = {}
+ target.cpu = "enten-cpu"
+ target.os = "any"
+ c(target, false, function (err) {
+ t.ok(err, "error present")
+ t.equal(err.code, "EBADPLATFORM")
+ t.end()
+ })
+})
+
+test("os wrong", function (t) {
+ var target = {}
+ target.cpu = "any"
+ target.os = "enten-os"
+ c(target, false, function (err) {
+ t.ok(err, "error present")
+ t.equal(err.code, "EBADPLATFORM")
+ t.end()
+ })
+})
+
+test("nothing wrong", function (t) {
+ var target = {}
+ target.cpu = "any"
+ target.os = "any"
+ c(target, false, function (err) {
+ t.notOk(err, "no error present")
+ t.end()
+ })
+})
+
+test("force", function (t) {
+ var target = {}
+ target.cpu = "enten-cpu"
+ target.os = "any"
+ c(target, true, function (err) {
+ t.notOk(err, "no error present")
+ t.end()
+ })
+})
diff --git a/deps/npm/node_modules/npm-registry-client/index.js b/deps/npm/node_modules/npm-registry-client/index.js
index 2a28bd5e78..24c33ae44e 100644
--- a/deps/npm/node_modules/npm-registry-client/index.js
+++ b/deps/npm/node_modules/npm-registry-client/index.js
@@ -5,7 +5,6 @@ module.exports = RegClient
var fs = require('fs')
, url = require('url')
, path = require('path')
-, CouchLogin = require('couch-login')
, npmlog
try {
@@ -47,22 +46,6 @@ function RegClient (conf) {
}
if (!conf.get('cache')) throw new Error("Cache dir is required")
-
- var auth = this.conf.get('_auth')
- var alwaysAuth = this.conf.get('always-auth')
- if (auth && !alwaysAuth && registry) {
- // if we're always authing, then we just send the
- // user/pass on every thing. otherwise, create a
- // session, and use that.
- var token = this.conf.get('_token')
- this.couchLogin = new CouchLogin(registry, token)
- this.couchLogin.proxy = this.conf.get('proxy')
- this.couchLogin.strictSSL = this.conf.get('strict-ssl')
- this.couchLogin.ca = this.conf.get('ca')
- this.couchLogin.cert = this.conf.get('cert')
- this.couchLogin.key = this.conf.get('key')
- }
-
this.log = conf.log || conf.get('log') || npmlog
}
diff --git a/deps/npm/node_modules/npm-registry-client/lib/publish.js b/deps/npm/node_modules/npm-registry-client/lib/publish.js
index 46c6ba3a72..acc0ca81c0 100644
--- a/deps/npm/node_modules/npm-registry-client/lib/publish.js
+++ b/deps/npm/node_modules/npm-registry-client/lib/publish.js
@@ -106,14 +106,17 @@ function putFirst (data, tardata, stat, username, email, cb) {
function putNext(newVersion, root, current, cb) {
// already have the tardata on the root object
// just merge in existing stuff
- // if the version already exists, and not a --force, then raise error
- var force = this.conf.get('force')
var curVers = Object.keys(current.versions || {}).map(function (v) {
return semver.clean(v, true)
- })
-
- if (!force && curVers.indexOf(newVersion) !== -1) {
- return cb(conflictError(root.name))
+ }).concat(Object.keys(current.time || {}).map(function(v) {
+ if (semver.valid(v, true))
+ return semver.clean(v, true)
+ }).filter(function(v) {
+ return v
+ }))
+
+ if (curVers.indexOf(newVersion) !== -1) {
+ return cb(conflictError(root.name, newVersion))
}
current.versions[newVersion] = root.versions[newVersion]
@@ -143,9 +146,10 @@ function putNext(newVersion, root, current, cb) {
this.request("PUT", root.name, current, cb)
}
-function conflictError (pkgid) {
- var e = new Error("cannot modify existing version")
+function conflictError (pkgid, version) {
+ var e = new Error("cannot modify pre-existing version")
e.code = "EPUBLISHCONFLICT"
e.pkgid = pkgid
+ e.version = version
return e
}
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 240c873b5c..b2cff11a74 100644
--- a/deps/npm/node_modules/npm-registry-client/lib/request.js
+++ b/deps/npm/node_modules/npm-registry-client/lib/request.js
@@ -8,8 +8,7 @@ var url = require("url")
, request = require("request")
, retry = require("retry")
-function regRequest (method, where, what, etag, nofollow, reauthed, cb_) {
- if (typeof cb_ !== "function") cb_ = reauthed, reauthed = false
+function regRequest (method, where, what, etag, nofollow, cb_) {
if (typeof cb_ !== "function") cb_ = nofollow, nofollow = false
if (typeof cb_ !== "function") cb_ = etag, etag = null
if (typeof cb_ !== "function") cb_ = what, what = null
@@ -35,9 +34,10 @@ function regRequest (method, where, what, etag, nofollow, reauthed, cb_) {
, adduserNew = /^\/?-\/user\/org\.couchdb\.user:([^\/]+)/
, nu = where.match(adduserNew)
, uc = where.match(adduserChange)
- , isUpload = what || this.conf.get('always-auth')
+ , alwaysAuth = this.conf.get('always-auth')
, isDel = method === "DELETE"
- , authRequired = isUpload && !nu || uc || isDel
+ , isWrite = what || isDel
+ , authRequired = (alwaysAuth || isWrite) && !nu || uc || isDel
// resolve to a full url on the registry
if (!where.match(/^https?:\/\//)) {
@@ -64,41 +64,19 @@ function regRequest (method, where, what, etag, nofollow, reauthed, cb_) {
var remote = url.parse(where)
, auth = this.conf.get('_auth')
- if (authRequired && !this.conf.get('always-auth')) {
- var couch = this.couchLogin
- , token = couch && (this.conf.get('_token') || couch.token)
- , validToken = token && couch.valid(token)
-
- if (!validToken) token = null
- else this.conf.set('_token', token)
-
- if (couch && !token) {
- // login to get a valid token
- var a = { name: this.conf.get('username'),
- password: this.conf.get('_password') }
- var args = arguments
- return this.couchLogin.login(a, function (er, cr, data) {
- if (er || !couch.valid(couch.token)) {
- er = er || new Error('login error')
- return cb(er, cr, data)
- }
- this.conf.set('_token', this.couchLogin.token)
- if (this.conf.save) this.conf.save('user')
- return regRequest.call(this,
- method, where, what,
- etag, nofollow, reauthed, cb_)
- }.bind(this))
- }
+ if (authRequired && !auth) {
+ var un = this.conf.get('username')
+ var pw = this.conf.get('_password')
+ if (un && pw)
+ auth = new Buffer(un + ':' + pw).toString('base64')
}
- // now we either have a valid token, or an auth.
-
- if (authRequired && !auth && !token) {
+ if (authRequired && !auth) {
return cb(new Error(
"Cannot insert data into the registry without auth"))
}
- if (auth && !token && authRequired) {
+ if (auth && authRequired) {
remote.auth = new Buffer(auth, "base64").toString("utf8")
}
@@ -115,7 +93,7 @@ function regRequest (method, where, what, etag, nofollow, reauthed, cb_) {
operation.attempt(function (currentAttempt) {
self.log.info("trying", "registry request attempt " + currentAttempt
+ " at " + (new Date()).toLocaleTimeString())
- makeRequest.call(self, method, remote, where, what, etag, nofollow, token
+ makeRequest.call(self, method, remote, where, what, etag, nofollow
, function (er, parsed, raw, response) {
if (!er || er.message.match(/^SSL Error/)) {
if (er)
@@ -126,22 +104,9 @@ function regRequest (method, where, what, etag, nofollow, reauthed, cb_) {
// Only retry on 408, 5xx or no `response`.
var statusCode = response && response.statusCode
- var reauth = !reauthed &&
- ( statusCode === 401 ||
- statusCode === 400 ||
- statusCode === 403 )
- if (reauth)
- reauthed = true
-
var timeout = statusCode === 408
var serverError = statusCode >= 500
var statusRetry = !statusCode || timeout || serverError
- if (reauth && this.conf.get('_auth') && this.conf.get('_token')) {
- this.conf.del('_token')
- this.couchLogin.token = null
- return regRequest.call(this, method, where, what,
- etag, nofollow, reauthed, cb_)
- }
if (er && statusRetry && operation.retry(er)) {
self.log.info("retry", "will retry, error on last attempt: " + er)
return
@@ -151,7 +116,7 @@ function regRequest (method, where, what, etag, nofollow, reauthed, cb_) {
}.bind(this))
}
-function makeRequest (method, remote, where, what, etag, nofollow, tok, cb_) {
+function makeRequest (method, remote, where, what, etag, nofollow, cb_) {
var cbCalled = false
function cb () {
if (cbCalled) return
@@ -174,10 +139,6 @@ function makeRequest (method, remote, where, what, etag, nofollow, tok, cb_) {
headers[method === "GET" ? "if-none-match" : "if-match"] = etag
}
- if (tok) {
- headers.cookie = 'AuthSession=' + tok.AuthSession
- }
-
headers.accept = "application/json"
headers["user-agent"] = this.conf.get('user-agent') ||
diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/.npmignore b/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/.npmignore
deleted file mode 100644
index 9ed56e7a5c..0000000000
--- a/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/.npmignore
+++ /dev/null
@@ -1,4 +0,0 @@
-test/fixtures/couch.log
-test/fixtures/.delete
-test/fixtures/pid
-test/fixtures/_users.couch
diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/LICENSE b/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/LICENSE
deleted file mode 100644
index 05eeeb88c2..0000000000
--- a/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/LICENSE
+++ /dev/null
@@ -1,15 +0,0 @@
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/README.md b/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/README.md
deleted file mode 100644
index 4b7578c0a4..0000000000
--- a/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/README.md
+++ /dev/null
@@ -1,278 +0,0 @@
-# couch-login
-
-This module lets you log into couchdb to get a session token, then make
-requests using that session. It is basically just a thin wrapper around
-[@mikeal's request module](https://github.com/mikeal/request).
-
-This is handy if you want a user to take actions in a couchdb database
-on behalf of a user, without having to store their couchdb username and
-password anywhere. (You do need to store the AuthSession token
-somewhere, though.)
-
-## Usage
-
-```javascript
-var CouchLogin = require('couch-login')
-
-// Nothing about this module is http-server specific of course.
-// You could also use it to do authenticated requests against
-// a couchdb using sessions and storing the token somewhere else.
-
-http.createServer(function (req, res) {
- var couch = new CouchLogin('http://my-couch.iriscouch.com:5984/')
-
- // .. look up the token in the user's session or whatever ..
- // Look at couch.decorate(req, res) for more on doing that
- // automatically, below.
-
- if (sessionToken) {
- // this user already logged in.
- couch.token = sessionToken
-
- // now we can do things on their behalf, like:
- // 1. View their session info.
- // like doing request.get({ uri: couch + '/_session', ... })
- // but with the cookie and whatnot
-
- couch.get('/_session', function (er, resp, data) {
- // er = some kind of communication error.
- // resp = response object from the couchdb request.
- // data = parsed JSON response body.
- if (er || resp.statusCode !== 200) {
- res.statusCode = resp.statusCode || 403
- return res.end('Invalid login or something')
- }
-
- // now we have the session info, we know who this user is.
- // hitting couchdb for this on every request is kinda costly,
- // so maybe you should store the username wherever you're storing
- // the sessionToken. RedSess is a good util for this, if you're
- // into redis. And if you're not into redis, you're crazy,
- // because it is awesome.
-
- // now let's get the user record.
- // note that this will 404 for anyone other than the user,
- // unless they're a server admin.
- couch.get('/_users/org.couchdb.user:' + data.userCtx.name, etc)
-
- // PUTs and DELETEs will also use their session, of course, so
- // your validate_doc_update's will see their info in userCtx
- })
-
- } else {
- // don't have a sessionToken.
- // get a username and password from the post body or something.
- // maybe redirect to a /login page or something to ask for that.
- var login = { name: name, password: password }
- couch.login(login, function (er, resp, data) {
- // again, er is an error, resp is the response obj, data is the json
- if (er || resp.statusCode !== 200) {
- res.statusCode = resp.statusCode || 403
- return res.end('Invalid login or something')
- }
-
- // the data is something like
- // {"ok":true,"name":"testuser","roles":[]}
- // and couch.token is the token you'll need to save somewhere.
-
- // at this point, you can start making authenticated requests to
- // couchdb, or save data in their session, or do whatever it is
- // that you need to do.
-
- res.statusCode = 200
- res.write("Who's got two thumbs and just logged you into couch?\n")
- setTimeout(function () {
- res.end("THIS GUY!")
- }, 500)
- })
- }
-})
-```
-
-## Class: CouchLogin
-### new CouchLogin(couchdbUrl, token)
-
-Create a new CouchLogin object bound to the couchdb url.
-
-In addition to these, the `get`, `post`, `put`, and `del` methods all
-proxy to the associated method on [request](https://github.com/mikeal/request).
-
-However, as you'll note in the example above, only the pathname portion
-of the url is required. Urls will be appended to the couchdb url passed
-into the constructor.
-
-If you have to talk to more than one couchdb, then you'll need more than
-one CouchLogin object, for somewhat obvious reasons.
-
-All callbacks get called with the following arguments, which are exactly
-identical to the arguments passed to a `request` callback.
-
-* `er` {Error | null} Set if a communication error happens.
-* `resp` {HTTP Response} The response from the request to couchdb
-* `data` {Object} The parsed JSON data from couch
-
-If the token is the string "anonymous", then it will not attempt to log
-in before making requests. If the token is not "anonymous", then it
-must be an object with the appropriate fields.
-
-### couch.token
-
-* {Object}
-
-An object representing the couchdb session token. (Basically just a
-cookie and a timeout.)
-
-If the token has already timed out, then setting it will have no effect.
-
-### couch.tokenSet
-
-If set, this method is called whenever the token is saved.
-
-For example, you could assign a function to this method to save the
-token into a redis session, a cookie, or in some other database.
-
-Takes a callback which should be called when the token is saved.
-
-### couch.tokenGet
-
-If set, this method is called to look up the token on demand.
-
-The inverse of couch.tokenSet. Takes a callback which is called with
-the `cb(er || null, token)`.
-
-### couch.tokenDel
-
-If set, this method is called to delete the token when it should be
-discarded.
-
-Related to tokenGet and tokenSet. Takes a callback which should be
-called when the token is deleted.
-
-### couch.ca
-
-* {String | Array | null}
-
-A certificate authority string (PEM encoded), or an array of CA strings. Only
-relevant for HTTPS couches, of course.
-
-Leave as `null` to use the default ca settings built into node.
-
-### couch.cert
-
-* {String | null}
-
-A client certificate (PEM encoded) used to support secure access to servers that require client certificate. Only
-relevant for HTTPS couches, of course.
-
-Leave as `null` when not supporting client certificates.
-
-### couch.key
-
-* {String | null}
-
-A private key string (PEM encoded) used to validate a client certificate. Only
-relevant for HTTPS couches, of course.
-
-Leave as `null` when not supporting client certificates.
-
-### couch.strictSSL
-
-* {Boolean | null}
-
-Whether or not to be strict about SSL connections. If left as null,
-then use the default setting in node, which is true in node versions
-0.9.x and above, and false prior to 0.8.x.
-
-Only relevant for HTTPS couches, of course.
-
-### couch.anonymous()
-
-Return a new CouchLogin object that points at the same couchdb server,
-but doesn't try to log in before making requests.
-
-This is handy for situations where the user is not logged in at the
-moment, but a request needs to be made anyway, and does not require
-authorization.
-
-### couch.login(auth, callback)
-
-* `auth` {Object} The login details
- * `name` {String}
- * `password` {String}
-* `callback` {Function}
-
-When the callback is called, the `couch.token` will already have been
-set (assuming it worked!), so subsequent requests will be done as that
-user.
-
-### couch.get(path, callback)
-
-GET the supplied path from the couchdb using the credentials on the
-token.
-
-Fails if the token is invalid or expired.
-
-### couch.del(path, callback)
-
-DELETE the supplied path from the couchdb using the credentials on the
-token.
-
-Fails if the token is invalid or expired.
-
-### couch.post(path, data, callback)
-
-POST the data to the supplied path in the couchdb, using the credentials
-on the token.
-
-Fails if the token is invalid or expired.
-
-### couch.put(path, data, callback)
-
-PUT the data to the supplied path in the couchdb, using the credentials
-on the token.
-
-Fails if the token is invalid or expired.
-
-### couch.changePass(newAuth, callback)
-
-Must already be logged in. Updates the `_users` document with new salt
-and hash, and re-logs in with the new credentials. Callback is called
-with the same arguments as login, or the first step of the process that
-failed.
-
-### couch.signup(userData, callback)
-
-Create a new user account. The userData must contain at least a `name`
-and `password` field. Any additional data will be copied to the user
-record. The `_id`, `name`, `roles`, `type`, `password_sha`, `salt`, and
-`date` fields are generated.
-
-Also signs in as the newly created user, on successful account creation.
-
-### couch.deleteAccount(name, callback)
-
-Deletes a user account. If not logged in as the user, or a server
-admin, then the request will fail.
-
-Note that this immediately invalidates any session tokens for the
-deleted user account. If you are deleting the user's record, then you
-ought to follow this with `couch.logout(callback)` so that it won't try
-to re-use the invalid session.
-
-### couch.logout(callback)
-
-Delete the session out of couchdb. This makes the token permanently
-invalid, and deletes it.
-
-### couch.decorate(req, res)
-
-Set up `req.couch` and `res.couch` as references to this couch login
-instance.
-
-Additionall, if `req.session` or `res.session` is set, then it'll call
-`session.get('couch_token', cb)` as the tokenGet method,
-`session.set('couch_token', token, cb)` as the tokenSet method, and
-`session.del('couch_token', cb)` as the tokenDel method.
-
-This works really nice with
-[RedSess](https://github.com/isaacs/redsess).
diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/couch-login.js b/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/couch-login.js
deleted file mode 100644
index 52939c6a1c..0000000000
--- a/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/couch-login.js
+++ /dev/null
@@ -1,399 +0,0 @@
-var request = require('request')
-, url = require('url')
-, crypto = require('crypto')
-, YEAR = (1000 * 60 * 60 * 24 * 365)
-, BASIC = {}
-, assert = require('assert')
-
-module.exports = CouchLogin
-
-function CouchLogin (couch, tok) {
- if (!(this instanceof CouchLogin)) {
- return new CouchLogin(couch)
- }
-
- if (!couch) throw new Error(
- "Need to pass a couch url to CouchLogin constructor")
-
- if (couch instanceof CouchLogin)
- couch = couch.couch
-
- couch = url.parse(couch)
- if (couch.auth) {
- var a = couch.auth.split(':')
- var name = a.shift()
- var password = a.join(':')
- this.name = name
- if (password)
- this.auth = new Buffer(name + ':' + password).toString('base64')
- } else {
- this.auth = null
- this.name = null
- }
- delete couch.auth
-
- if (tok === 'anonymous')
- tok = NaN
- else if (tok === 'basic')
- tok = BASIC
-
- // ensure that couch url ends with a slash
- couch.pathname = couch.pathname.replace(/\/?$/, '/');
-
- this.token = tok
- this.couch = url.format(couch)
- this.proxy = null
-
- this.maxAge = YEAR
-
- // replace with a CA cert string, or an array, or leave as null
- // to use the defaults included in node. Only relevant for HTTPS
- // couches, of course.
- this.ca = null
-
- // replace these with client certificate and private key if required by
- // the server. Only relevant for HTTPS couches. These are passed to
- // the request and then on to https and tls as-is.
- this.cert = null
- this.key = null
-
- // set to boolean true or false to specify the strictSSL behavior.
- // if left as null, then it'll use whatever node defaults to, which
- // is false <=0.8.x, and true >=0.9.x
- //
- // Again, only relevant for https couches, of course.
- this.strictSSL = null
-}
-
-CouchLogin.prototype =
-{ get: makeReq('GET')
-, del: makeReq('DELETE')
-, put: makeReq('PUT', true)
-, post: makeReq('POST', true)
-, login: login
-, logout: logout
-, decorate: decorate
-, changePass: changePass
-, signup: signup
-, deleteAccount: deleteAccount
-, anon: anon
-, anonymous: anon
-, valid: valid
-}
-
-Object.defineProperty(CouchLogin.prototype, 'constructor',
- { value: CouchLogin, enumerable: false })
-
-function decorate (req, res) {
- assert(this instanceof CouchLogin)
- req.couch = res.couch = this
-
- // backed by some sort of set(k,v,cb), get(k,cb) session storage.
- var session = req.session || res.session || null
- if (session) {
- this.tokenGet = function (cb) {
- session.get('couch_token', cb)
- }
-
- // don't worry about it failing. it'll just mean a login next time.
- this.tokenSet = function (tok, cb) {
- session.set('couch_token', tok, cb || function () {})
- }
-
- this.tokenDel = function (cb) {
- session.del('couch_token', cb || function () {})
- }
- }
-
- return this
-}
-
-function anon () {
- assert(this instanceof CouchLogin)
- return new CouchLogin(this.couch, NaN)
-}
-
-function makeReq (meth, body, f) { return function madeReq (p, d, cb) {
- assert(this instanceof CouchLogin)
- f = f || (this.token !== this.token)
- if (!f && !valid(this.token)) {
- // lazily get the token.
- if (this.tokenGet) return this.tokenGet(function (er, tok) {
- if (er || !valid(tok)) {
- if (!body) cb = d, d = null
- return cb(new Error('auth token expired or invalid'))
- }
- this.token = tok
- return madeReq.call(this, p, d, cb)
- }.bind(this))
-
- // no getter, no token, no business.
- return process.nextTick(function () {
- if (!body) cb = d, d = null
- cb(new Error('auth token expired or invalid'))
- })
- }
-
- if (!body) cb = d, d = null
-
- var h = {}
- , u = url.resolve(this.couch, p.replace(/^\//, ''))
- , req = { uri: u, headers: h, json: true, body: d, method: meth }
-
- if (this.token === BASIC) {
- if (!this.auth)
- return process.nextTick(cb.bind(this, new Error(
- 'Using basic auth and no auth provided')))
- else
- h.authorization = 'Basic ' + this.auth
- } else if (this.token) {
- h.cookie = 'AuthSession=' + this.token.AuthSession
- }
-
- if (this.proxy) {
- req.proxy = this.proxy
- }
-
- // we're handling cookies, don't do it for us.
- req.jar = false
-
- if (this.ca)
- req.ca = this.ca
-
- if (this.cert)
- req.cert = this.cert
- if (this.key)
- req.key = this.key
-
- if (typeof this.strictSSL === 'boolean')
- req.strictSSL = req.rejectUnauthorized = this.strictSSL
-
- request(req, function (er, res, data) {
- // update cookie.
- if (er || res.statusCode !== 200) return cb(er, res, data)
- addToken.call(this, res)
- return cb.call(this, er, res, data)
- }.bind(this))
-}}
-
-function login (auth, cb) {
- assert(this instanceof CouchLogin)
- if (this.token === BASIC) {
- this.auth = new Buffer(auth.name + ':' + auth.password).toString('base64')
- this.name = auth.name
- cb = cb.bind(this, null, { statusCode: 200 }, { ok: true })
- return process.nextTick(cb)
- }
- var a = { name: auth.name, password: auth.password }
- var req = makeReq('post', true, true)
- req.call(this, '/_session', a, function (er, cr, data) {
- if (er || (cr && cr.statusCode >= 400))
- return cb(er, cr, data)
- this.name = auth.name
- cb(er, cr, data)
- }.bind(this))
-}
-
-function changePass (auth, cb) {
- assert(this instanceof CouchLogin)
- if (!auth.name || !auth.password) return cb(new Error('invalid auth'))
-
- var u = '/_users/org.couchdb.user:' + auth.name
- this.get(u, function (er, res, data) {
- if (er || res.statusCode !== 200) return cb(er, res, data)
-
- // copy any other keys we're setting here.
- // note that name, password_sha, salt, and date
- // are all set explicitly below.
- Object.keys(auth).filter(function (k) {
- return k.charAt(0) !== '_'
- && k !== 'password'
- && k !== 'password_sha'
- && k !== 'salt'
- }).forEach(function (k) {
- data[k] = auth[k]
- })
-
- var newSalt = crypto.randomBytes(30).toString('hex')
- , newPass = auth.password
- , newSha = sha(newPass + newSalt)
-
- data.password_sha = newSha
- data.salt = newSalt
- data.date = new Date().toISOString()
-
- this.put(u + '?rev=' + data._rev, data, function (er, res, data) {
- if (er || res.statusCode >= 400)
- return cb(er, res, data)
- if (this.name && this.name !== auth.name)
- return cb(er, res, data)
- return this.login(auth, cb)
- }.bind(this))
- }.bind(this))
-}
-
-// They said that there should probably be a warning before
-// deleting the user's whole account, so here it is:
-//
-// WATCH OUT!
-function deleteAccount (name, cb) {
- assert(this instanceof CouchLogin)
- var u = '/_users/org.couchdb.user:' + name
- this.get(u, thenPut.bind(this))
-
- function thenPut (er, res, data) {
- if (er || res.statusCode !== 200) {
- return cb(er, res, data)
- }
-
- // user accts can't be just DELETE'd by non-admins
- // so we take the existing doc and just slap a _deleted
- // flag on it to fake it. Works the same either way
- // in couch.
- data._deleted = true
- this.put(u + '?rev=' + data._rev, data, cb)
- }
-}
-
-
-
-function signup (auth, cb) {
- assert(this instanceof CouchLogin)
- if (this.token && this.token !== BASIC) {
-
- return this.logout(function (er, res, data) {
- if (er || res && res.statusCode !== 200) {
- return cb(er, res, data)
- }
-
- if (this.token) {
- return cb(new Error('failed to delete token'), res, data)
- }
-
- this.signup(auth, cb)
- }.bind(this))
- }
-
- // make a new user record.
- var newSalt = crypto.randomBytes(30).toString('hex')
- , newSha = sha(auth.password + newSalt)
- , user = { _id: 'org.couchdb.user:' + auth.name
- , name: auth.name
- , roles: []
- , type: 'user'
- , password_sha: newSha
- , salt: newSalt
- , date: new Date().toISOString() }
-
- Object.keys(auth).forEach(function (k) {
- if (k === 'name' || k === 'password') return
- user[k] = auth[k]
- })
-
- var u = '/_users/' + user._id
- makeReq('put', true, true).call(this, u, user, function (er, res, data) {
- if (er || res.statusCode >= 400) {
- return cb(er, res, data)
- }
-
- // it worked! log in as that user and get their record
- this.login(auth, function (er, res, data) {
- if (er || (res && res.statusCode >= 400) || data && data.error) {
- return cb(er, res, data)
- }
- this.get(u, cb)
- }.bind(this))
- }.bind(this))
-}
-
-function addToken (res) {
- assert(this instanceof CouchLogin)
- // not doing the whole login session cookie thing.
- if (this.token === BASIC)
- return
-
- // attach the token, if a new one was provided.
- var sc = res.headers['set-cookie']
- if (!sc) return
- if (!Array.isArray(sc)) sc = [sc]
-
- sc = sc.filter(function (c) {
- return c.match(/^AuthSession=/)
- })[0]
-
- if (!sc.length) return
-
- sc = sc.split(/\s*;\s*/).map(function (p) {
- return p.split('=')
- }).reduce(function (set, p) {
- var k = p[0] === 'AuthSession' ? p[0] : p[0].toLowerCase()
- , v = k === 'expires' ? Date.parse(p[1])
- : p[1] === '' || p[1] === undefined ? true // HttpOnly
- : p[1]
- set[k] = v
- return set
- }, {})
-
- if (sc.hasOwnProperty('max-age')) {
- var ma = sc['max-age']
- sc.expires = (ma <= 0) ? 0 : Date.now() + (ma * 1000)
- delete sc['max-age']
- }
-
- // expire the session after 1 year, even if couch won't.
- if (!sc.hasOwnProperty('expires')) {
- sc.expires = Date.now() + YEAR
- }
-
- if (!isNaN(this.maxAge)) {
- sc.expires = Math.min(sc.expires, Date.now() + this.maxAge)
- }
-
- this.token = sc
- if (this.tokenSet) this.tokenSet(this.token)
-}
-
-
-function logout (cb) {
- assert(this instanceof CouchLogin)
- if (!this.token && this.tokenGet) {
- return this.tokenGet(function (er, tok) {
- if (er || !tok)
- return cb(null, { statusCode: 200 }, {})
- this.token = tok
- this.logout(cb)
- }.bind(this))
- }
-
- if (!valid(this.token)) {
- this.token = null
- if (this.tokenDel) this.tokenDel()
- return process.nextTick(cb.bind(this, null, { statusCode: 200 }, {}))
- }
-
- var h = { cookie: 'AuthSession=' + this.token.AuthSession }
- , u = url.resolve(this.couch, '_session')
- , req = { uri: u, headers: h, json: true }
-
- request.del(req, function (er, res, data) {
- if (er || (res.statusCode !== 200 && res.statusCode !== 404)) {
- return cb(er, res, data)
- }
-
- this.token = null
- if (this.tokenDel)
- this.tokenDel()
- cb(er, res, data)
- }.bind(this))
-}
-
-function valid (token) {
- if (token === BASIC) return true
- if (!token) return false
- if (!token.hasOwnProperty('expires')) return true
- return token.expires > Date.now()
-}
-
-function sha (s) {
- return crypto.createHash("sha1").update(s).digest("hex")
-}
diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/package.json b/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/package.json
deleted file mode 100644
index 8afcd152bc..0000000000
--- a/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/package.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
- "author": {
- "name": "Isaac Z. Schlueter",
- "email": "i@izs.me",
- "url": "http://blog.izs.me/"
- },
- "name": "couch-login",
- "description": "A module for doing logged-in requests to a couchdb server",
- "version": "0.1.20",
- "repository": {
- "type": "git",
- "url": "git://github.com/isaacs/couch-login.git"
- },
- "main": "couch-login.js",
- "scripts": {
- "test": "tap test/*.js"
- },
- "dependencies": {
- "request": "2 >=2.25.0"
- },
- "devDependencies": {
- "tap": "~0.2.4"
- },
- "license": "ISC",
- "readme": "# couch-login\n\nThis module lets you log into couchdb to get a session token, then make\nrequests using that session. It is basically just a thin wrapper around\n[@mikeal's request module](https://github.com/mikeal/request).\n\nThis is handy if you want a user to take actions in a couchdb database\non behalf of a user, without having to store their couchdb username and\npassword anywhere. (You do need to store the AuthSession token\nsomewhere, though.)\n\n## Usage\n\n```javascript\nvar CouchLogin = require('couch-login')\n\n// Nothing about this module is http-server specific of course.\n// You could also use it to do authenticated requests against\n// a couchdb using sessions and storing the token somewhere else.\n\nhttp.createServer(function (req, res) {\n var couch = new CouchLogin('http://my-couch.iriscouch.com:5984/')\n\n // .. look up the token in the user's session or whatever ..\n // Look at couch.decorate(req, res) for more on doing that\n // automatically, below.\n\n if (sessionToken) {\n // this user already logged in.\n couch.token = sessionToken\n\n // now we can do things on their behalf, like:\n // 1. View their session info.\n // like doing request.get({ uri: couch + '/_session', ... })\n // but with the cookie and whatnot\n\n couch.get('/_session', function (er, resp, data) {\n // er = some kind of communication error.\n // resp = response object from the couchdb request.\n // data = parsed JSON response body.\n if (er || resp.statusCode !== 200) {\n res.statusCode = resp.statusCode || 403\n return res.end('Invalid login or something')\n }\n\n // now we have the session info, we know who this user is.\n // hitting couchdb for this on every request is kinda costly,\n // so maybe you should store the username wherever you're storing\n // the sessionToken. RedSess is a good util for this, if you're\n // into redis. And if you're not into redis, you're crazy,\n // because it is awesome.\n\n // now let's get the user record.\n // note that this will 404 for anyone other than the user,\n // unless they're a server admin.\n couch.get('/_users/org.couchdb.user:' + data.userCtx.name, etc)\n\n // PUTs and DELETEs will also use their session, of course, so\n // your validate_doc_update's will see their info in userCtx\n })\n\n } else {\n // don't have a sessionToken.\n // get a username and password from the post body or something.\n // maybe redirect to a /login page or something to ask for that.\n var login = { name: name, password: password }\n couch.login(login, function (er, resp, data) {\n // again, er is an error, resp is the response obj, data is the json\n if (er || resp.statusCode !== 200) {\n res.statusCode = resp.statusCode || 403\n return res.end('Invalid login or something')\n }\n\n // the data is something like\n // {\"ok\":true,\"name\":\"testuser\",\"roles\":[]}\n // and couch.token is the token you'll need to save somewhere.\n\n // at this point, you can start making authenticated requests to\n // couchdb, or save data in their session, or do whatever it is\n // that you need to do.\n\n res.statusCode = 200\n res.write(\"Who's got two thumbs and just logged you into couch?\\n\")\n setTimeout(function () {\n res.end(\"THIS GUY!\")\n }, 500)\n })\n }\n})\n```\n\n## Class: CouchLogin\n### new CouchLogin(couchdbUrl, token)\n\nCreate a new CouchLogin object bound to the couchdb url.\n\nIn addition to these, the `get`, `post`, `put`, and `del` methods all\nproxy to the associated method on [request](https://github.com/mikeal/request).\n\nHowever, as you'll note in the example above, only the pathname portion\nof the url is required. Urls will be appended to the couchdb url passed\ninto the constructor.\n\nIf you have to talk to more than one couchdb, then you'll need more than\none CouchLogin object, for somewhat obvious reasons.\n\nAll callbacks get called with the following arguments, which are exactly\nidentical to the arguments passed to a `request` callback.\n\n* `er` {Error | null} Set if a communication error happens.\n* `resp` {HTTP Response} The response from the request to couchdb\n* `data` {Object} The parsed JSON data from couch\n\nIf the token is the string \"anonymous\", then it will not attempt to log\nin before making requests. If the token is not \"anonymous\", then it\nmust be an object with the appropriate fields.\n\n### couch.token\n\n* {Object}\n\nAn object representing the couchdb session token. (Basically just a\ncookie and a timeout.)\n\nIf the token has already timed out, then setting it will have no effect.\n\n### couch.tokenSet\n\nIf set, this method is called whenever the token is saved.\n\nFor example, you could assign a function to this method to save the\ntoken into a redis session, a cookie, or in some other database.\n\nTakes a callback which should be called when the token is saved.\n\n### couch.tokenGet\n\nIf set, this method is called to look up the token on demand.\n\nThe inverse of couch.tokenSet. Takes a callback which is called with\nthe `cb(er || null, token)`.\n\n### couch.tokenDel\n\nIf set, this method is called to delete the token when it should be\ndiscarded.\n\nRelated to tokenGet and tokenSet. Takes a callback which should be\ncalled when the token is deleted.\n\n### couch.ca\n\n* {String | Array | null}\n\nA certificate authority string (PEM encoded), or an array of CA strings. Only\nrelevant for HTTPS couches, of course.\n\nLeave as `null` to use the default ca settings built into node.\n\n### couch.cert\n\n* {String | null}\n\nA client certificate (PEM encoded) used to support secure access to servers that require client certificate. Only\nrelevant for HTTPS couches, of course.\n\nLeave as `null` when not supporting client certificates.\n\n### couch.key\n\n* {String | null}\n\nA private key string (PEM encoded) used to validate a client certificate. Only\nrelevant for HTTPS couches, of course.\n\nLeave as `null` when not supporting client certificates.\n\n### couch.strictSSL\n\n* {Boolean | null}\n\nWhether or not to be strict about SSL connections. If left as null,\nthen use the default setting in node, which is true in node versions\n0.9.x and above, and false prior to 0.8.x.\n\nOnly relevant for HTTPS couches, of course.\n\n### couch.anonymous()\n\nReturn a new CouchLogin object that points at the same couchdb server,\nbut doesn't try to log in before making requests.\n\nThis is handy for situations where the user is not logged in at the\nmoment, but a request needs to be made anyway, and does not require\nauthorization.\n\n### couch.login(auth, callback)\n\n* `auth` {Object} The login details\n * `name` {String}\n * `password` {String}\n* `callback` {Function}\n\nWhen the callback is called, the `couch.token` will already have been\nset (assuming it worked!), so subsequent requests will be done as that\nuser.\n\n### couch.get(path, callback)\n\nGET the supplied path from the couchdb using the credentials on the\ntoken.\n\nFails if the token is invalid or expired.\n\n### couch.del(path, callback)\n\nDELETE the supplied path from the couchdb using the credentials on the\ntoken.\n\nFails if the token is invalid or expired.\n\n### couch.post(path, data, callback)\n\nPOST the data to the supplied path in the couchdb, using the credentials\non the token.\n\nFails if the token is invalid or expired.\n\n### couch.put(path, data, callback)\n\nPUT the data to the supplied path in the couchdb, using the credentials\non the token.\n\nFails if the token is invalid or expired.\n\n### couch.changePass(newAuth, callback)\n\nMust already be logged in. Updates the `_users` document with new salt\nand hash, and re-logs in with the new credentials. Callback is called\nwith the same arguments as login, or the first step of the process that\nfailed.\n\n### couch.signup(userData, callback)\n\nCreate a new user account. The userData must contain at least a `name`\nand `password` field. Any additional data will be copied to the user\nrecord. The `_id`, `name`, `roles`, `type`, `password_sha`, `salt`, and\n`date` fields are generated.\n\nAlso signs in as the newly created user, on successful account creation.\n\n### couch.deleteAccount(name, callback)\n\nDeletes a user account. If not logged in as the user, or a server\nadmin, then the request will fail.\n\nNote that this immediately invalidates any session tokens for the\ndeleted user account. If you are deleting the user's record, then you\nought to follow this with `couch.logout(callback)` so that it won't try\nto re-use the invalid session.\n\n### couch.logout(callback)\n\nDelete the session out of couchdb. This makes the token permanently\ninvalid, and deletes it.\n\n### couch.decorate(req, res)\n\nSet up `req.couch` and `res.couch` as references to this couch login\ninstance.\n\nAdditionall, if `req.session` or `res.session` is set, then it'll call\n`session.get('couch_token', cb)` as the tokenGet method,\n`session.set('couch_token', token, cb)` as the tokenSet method, and\n`session.del('couch_token', cb)` as the tokenDel method.\n\nThis works really nice with\n[RedSess](https://github.com/isaacs/redsess).\n",
- "readmeFilename": "README.md",
- "bugs": {
- "url": "https://github.com/isaacs/couch-login/issues"
- },
- "homepage": "https://github.com/isaacs/couch-login",
- "_id": "couch-login@0.1.20",
- "_from": "couch-login@~0.1.18"
-}
diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/test/00-setup.js b/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/test/00-setup.js
deleted file mode 100644
index d5dcc190d0..0000000000
--- a/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/test/00-setup.js
+++ /dev/null
@@ -1,100 +0,0 @@
-// start the couchdb spinning as a detached child process.
-// the zz-teardown.js test kills it.
-//
-// localhost:15985 ==> couchdb
-// 127.0.0.1:15985 ==> npm registry
-
-var spawn = require('child_process').spawn
-var test = require('tap').test
-var path = require('path')
-var fs = require('fs')
-var request = require('request')
-
-// run with the cwd of the main program.
-var cwd = path.dirname(__dirname)
-
-var conf = path.resolve(__dirname, 'fixtures', 'couch.ini')
-var pidfile = path.resolve(__dirname, 'fixtures', 'pid')
-var logfile = path.resolve(__dirname, 'fixtures', 'couch.log')
-var started = /Apache CouchDB has started on http:\/\/127\.0\.0\.1:15985\/\n$/
-
-test('start couch as a zombie child', function (t) {
- var fd = fs.openSync(pidfile, 'wx')
-
- try { fs.unlinkSync(logfile) } catch (er) {}
-
- var child = spawn('couchdb', ['-a', conf], {
- detached: true,
- stdio: 'ignore',
- cwd: cwd
- })
- child.unref()
- t.ok(child.pid)
- fs.writeSync(fd, child.pid + '\n')
- fs.closeSync(fd)
-
- // wait for it to create a log, give it 5 seconds
- var start = Date.now()
- fs.readFile(logfile, function R (er, log) {
- log = log ? log.toString() : ''
- if (!er && !log.match(started))
- er = new Error('not started yet')
- if (er) {
- if (Date.now() - start < 5000)
- return setTimeout(function () {
- fs.readFile(logfile, R)
- }, 100)
- else
- throw er
- }
- t.pass('relax')
- t.end()
- })
-})
-
-// set up the testuser account that we'll be using everywhere.
-// first delete any existing one, so that we don't end up with
-// some newer copy taking over.
-test('create testuser', function (t) {
- var u = 'http://admin:admin@localhost:15985/_users/org.couchdb.user:testuser'
- var rev
-
- request.get({ url: u, json: true }, function (er, res, data) {
- if (er)
- throw er
- rev = data._rev
- if (res.statusCode === 404)
- put()
- else
- del()
- })
-
- function del () {
- request.del(u + '?rev=' + rev, function (er, res, data) {
- if (er)
- throw er
- put()
- })
- }
-
- function put () {
- request.put({
- url: u,
- body: {
- _id: 'org.couchdb.user:testuser',
- name: 'testuser',
- roles: [],
- type: 'user',
- password_sha: 'e23952b517695e6bb72ecf060e10bf1b35bf7e0b',
- salt: '83695c9b64d3b48b94c9dda0cd691e72',
- date: '2012-09-26T16:49:30.175Z'
- },
- json: true
- }, function (er, res, data) {
- if (er)
- throw er
- t.ok(data.ok, 'user created')
- t.end()
- })
- }
-})
diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/test/basic.js b/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/test/basic.js
deleted file mode 100644
index 4dea12b3f2..0000000000
--- a/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/test/basic.js
+++ /dev/null
@@ -1,298 +0,0 @@
-var tap = require('tap')
-, CouchLogin = require('../couch-login.js')
-
-var auth = { name: 'testuser', password: 'test' }
-, newAuth = { name: 'testuser', password: 'asdfasdf' }
-, couch = new CouchLogin('http://localhost:15985/')
-, u = '/_users/org.couchdb.user:' + auth.name
-, userRecordMarker
-
-// simulate the 'must change password on next login' thing
-newAuth.mustChangePass = true
-auth.mustChangePass = false
-
-
-function okStatus (t, res) {
- var x = { found: res.statusCode, wanted: 'around 200' }
- var r = res.statusCode
- x.ok = (r >= 200 && r < 300)
- return t.ok(x.ok, 'Status code should be 200-ish', x)
-}
-
-tap.test('login', function (t) {
- couch.login(auth, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
- t.deepEqual(data, { ok: true, name: 'testuser', roles: [] })
- t.ok(couch.token)
- t.deepEqual(couch.token,
- { AuthSession: couch.token && couch.token.AuthSession,
- version: '1',
- expires: couch.token && couch.token.expires,
- path: '/',
- httponly: true })
- t.ok(couch.token, 'has token')
- t.end()
- })
-})
-
-var userRecord
-tap.test('get', function (t) {
- couch.get(u, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- t.ok(data, 'data')
- t.ok(couch.token, 'token')
- userRecord = data
- okStatus(t, res)
- t.end()
- })
-})
-
-var userRecordMarker = require('crypto').randomBytes(30).toString('base64')
-tap.test('add key to user record', function (t) {
- userRecord.testingCouchLogin = userRecordMarker
- var revved = u + '?rev=' + userRecord._rev
- couch.put(revved, userRecord, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
- t.ok(data, 'data')
- t.ok(couch.token, 'token')
- // get again so we have the current rev
- couch.get(u, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
- t.ok(data)
- t.ok(userRecord)
- t.equal(data.testingCouchLogin, userRecord.testingCouchLogin)
- userRecord = data
- t.end()
- })
- })
-})
-
-tap.test('remove key', function (t) {
- var revved = u + '?rev=' + userRecord._rev
- delete userRecord.testingCouchLogin
- couch.put(revved, userRecord, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
- t.ok(couch.token, 'token')
- couch.get(u, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
- t.ok(data, 'data')
- t.ok(couch.token, 'token')
- t.equal(data.testingCouchLogin, undefined)
- userRecord = data
- t.end()
- })
- })
-})
-
-var crypto = require('crypto')
-function sha (s) {
- return crypto.createHash("sha1").update(s).digest("hex")
-}
-
-tap.test('change password manually', function (t) {
- var revved = u + '?rev=' + userRecord._rev
- , newPass = newAuth.password
- , newSalt = 'test-salt-two'
- , newSha = sha(newPass + newSalt)
-
- userRecord.salt = newSalt
- userRecord.password_sha = newSha
- couch.put(revved, userRecord, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
-
- // changing password invalidates session.
- // need to re-login
- couch.login(newAuth, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
-
- couch.get(u, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
- t.ok(data, 'data')
- t.ok(couch.token, 'token')
- t.equal(data.testingCouchLogin, undefined)
- userRecord = data
- t.end()
- })
- })
- })
-})
-
-tap.test('change password back manually', function (t) {
- var revved = u + '?rev=' + userRecord._rev
- , newPass = auth.password
- , newSalt = 'test-salt'
- , newSha = sha(newPass + newSalt)
-
- userRecord.salt = newSalt
- userRecord.password_sha = newSha
- couch.put(revved, userRecord, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
- t.ok(data, 'data')
- t.ok(couch.token, 'token')
-
- couch.login(auth, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
-
- couch.get(u, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
- t.ok(data, 'data')
- t.ok(couch.token, 'token')
- userRecord = data
- t.end()
- })
- })
- })
-})
-
-tap.test('change password easy', function (t) {
- couch.changePass(newAuth, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
-
- couch.get(u, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
- t.ok(data, 'data')
- t.ok(couch.token, 'token')
- t.equal(data.testingCouchLogin, undefined)
- t.equal(data.mustChangePass, true)
- userRecord = data
- t.end()
- })
- })
-})
-
-tap.test('change password back easy', function (t) {
- couch.changePass(auth, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
-
- couch.get(u, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
- t.ok(data, 'data')
- t.ok(couch.token, 'token')
- t.equal(data.testingCouchLogin, undefined)
- t.equal(data.mustChangePass, false)
- userRecord = data
- t.end()
- })
- })
-})
-
-
-tap.test('logout', function (t) {
- couch.logout(function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
- t.ok(data, 'data')
- t.notOk(couch.token, 'token')
- t.end()
- })
-})
-
-// now try some logged out monkey business!
-tap.test('logged out post', function (t) {
- couch.post('/yeah-right', {foo: 100}, function (er, res, data) {
- t.ok(er, 'should get an error')
- t.notOk(couch.token, 'token')
- t.end()
- })
-})
-
-tap.test('anonymous put', function (t) {
- var guy = couch.anonymous()
- guy.put('/remember', {november:5}, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- t.equal(res.statusCode, 401)
- t.deepEqual(data, { error: 'unauthorized'
- , reason: 'You are not a server admin.' })
- t.end()
- })
-})
-
-tap.test('anonymous get', function (t) {
- var guy = couch.anonymous()
- guy.get('/', function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- t.equal(res.statusCode, 200)
- t.has(data, { couchdb: 'Welcome' })
- t.ok(data.version)
- t.end()
- })
-})
-
-
-
-var signupUser = { name: 'test-user-signup', password: 'signup-test' }
-
-tap.test('sign up as new user', function (t) {
- couch.signup(signupUser, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
- t.ok(data, 'data')
- t.has(data,
- { _id: 'org.couchdb.user:test-user-signup',
- name: 'test-user-signup',
- roles: [],
- type: 'user' })
- t.ok(data._rev, 'rev')
- t.ok(data.date, 'date')
- t.ok(data.password_sha, 'hash')
- t.ok(data.salt, 'salt')
- t.ok(couch.token, 'token')
- // now delete account
- var name = signupUser.name
- couch.deleteAccount(name, function (er, res, data) {
- t.ifError(er, 'should be no error deleting account')
- if (er) return t.end()
- okStatus(t, res)
- t.ok(data, 'data')
- t.end()
- })
- })
-})
-
-tap.test('using basic auth', function (t) {
- var c = new CouchLogin(couch.couch, 'basic')
- c.login(auth, function () {
- c.get('/_users/org.couchdb.user:testuser', function (er, res, data) {
- if (er)
- throw er
- okStatus(t, res)
- t.ok(data, 'data')
- t.end()
- })
- })
-})
diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/test/fixtures/_replicator.couch b/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/test/fixtures/_replicator.couch
deleted file mode 100644
index b8dbbebd04..0000000000
--- a/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/test/fixtures/_replicator.couch
+++ /dev/null
Binary files differ
diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/test/fixtures/couch.ini b/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/test/fixtures/couch.ini
deleted file mode 100644
index 5f35797131..0000000000
--- a/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/test/fixtures/couch.ini
+++ /dev/null
@@ -1,25 +0,0 @@
-[couchdb]
-database_dir = test/fixtures
-view_index_dir = test/fixtures
-uuid = 3ec49bc6c314484cb21d684dc3fc778e
-
-[httpd]
-port = 15985
-bind_address = 127.0.0.1
-secure_rewrites = false
-allow_jsonp = true
-config_whitelist = [{uuids,algorithm},{vhosts,"*"},{admins,"*"},{log,level},{httpd,allow_jsonp},{httpd,secure_rewrites},{httpd,mobile_futon},{httpd,sammy_futon},{httpd,cors},{httpd,x_forwarded_host},{httpd,'WWW-Authenticate'},{cors,"*"},{compactions,"*"},{replicator,db},{attachments,compression_level},{attachments,compressible_types},{couch_httpd_auth,authentication_db},{couch_httpd_auth,allow_persistent_cookies},{couch_httpd_auth,authentication_redirect},{couch_httpd_auth,require_valid_user},{couch_httpd_auth,timeout},{couch_httpd_auth,secret},{couchdb,os_process_timeout},{query_server_config,reduce_limit},{couch_httpd_oauth,"*"},{oauth_token_users,"*"},{oauth_token_secrets,"*"},{oauth_consumer_secrets,"*"},{browserid,enabled},{browserid,hash_secret},{fb,"*"}]
-
-[log]
-file = test/fixtures/couch.log
-
-[admins]
-admin = -hashed-b933598b0ade0e4c2a258d53c95990d5939461dd,a44895e5740b79d14b392ada8021d31d
-
-[couch_httpd_auth]
-secret = cafebad000deadbeef00000019790701
-timeout = 36000
-allow_persistent_cookies = true
-
-[vhosts]
-127.0.0.1:15985 = /registry/_design/ghost/_rewrite
diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/test/fixtures/registry.couch b/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/test/fixtures/registry.couch
deleted file mode 100644
index 5806317db5..0000000000
--- a/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/test/fixtures/registry.couch
+++ /dev/null
Binary files differ
diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/test/registry.js b/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/test/registry.js
deleted file mode 100644
index d99d9f4f66..0000000000
--- a/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/test/registry.js
+++ /dev/null
@@ -1,252 +0,0 @@
-// Should be able to use this module to log into the registry, as well.
-
-var tap = require('tap')
-, CouchLogin = require('../couch-login.js')
-
-var auth = { name: 'testuser', password: 'test' }
-, newAuth = { name: 'testuser', password: 'asdfasdf' }
-, couch = new CouchLogin('http://127.0.0.1:15985/')
-, u = '/_users/org.couchdb.user:' + auth.name
-, userRecordMarker
-
-// simulate the 'must change password on next login' thing
-newAuth.mustChangePass = true
-auth.mustChangePass = false
-
-
-function okStatus (t, res) {
- var x = { found: res.statusCode, wanted: 'around 200' }
- var r = res.statusCode
- x.ok = (r >= 200 && r < 300)
- return t.ok(x.ok, 'Status code should be 200-ish', x)
-}
-
-tap.test('login', function (t) {
- couch.login(auth, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
- t.deepEqual(data, { ok: true, name: 'testuser', roles: [] })
- t.ok(couch.token)
- t.deepEqual(couch.token,
- { AuthSession: couch.token && couch.token.AuthSession,
- version: '1',
- expires: couch.token && couch.token.expires,
- path: '/',
- httponly: true })
- t.ok(couch.token, 'has token')
- t.end()
- })
-})
-
-var userRecord
-tap.test('get', function (t) {
- couch.get(u, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- t.ok(data, 'data')
- t.ok(couch.token, 'token')
- userRecord = data
- okStatus(t, res)
- t.end()
- })
-})
-
-var userRecordMarker = require('crypto').randomBytes(30).toString('base64')
-tap.test('add key to user record', function (t) {
- userRecord.testingCouchLogin = userRecordMarker
- var revved = u + '?rev=' + userRecord._rev
- couch.put(revved, userRecord, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
- t.ok(data, 'data')
- t.ok(couch.token, 'token')
- // get again so we have the current rev
- couch.get(u, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
- t.ok(data)
- t.ok(userRecord)
- t.equal(data.testingCouchLogin, userRecord.testingCouchLogin)
- userRecord = data
- t.end()
- })
- })
-})
-
-tap.test('remove key', function (t) {
- var revved = u + '?rev=' + userRecord._rev
- delete userRecord.testingCouchLogin
- couch.put(revved, userRecord, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
- t.ok(couch.token, 'token')
- couch.get(u, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
- t.ok(data, 'data')
- t.ok(couch.token, 'token')
- t.equal(data.testingCouchLogin, undefined)
- userRecord = data
- t.end()
- })
- })
-})
-
-var crypto = require('crypto')
-function sha (s) {
- return crypto.createHash("sha1").update(s).digest("hex")
-}
-
-tap.test('change password manually', function (t) {
- var revved = u + '?rev=' + userRecord._rev
- , newPass = newAuth.password
- , newSalt = 'test-salt-two'
- , newSha = sha(newPass + newSalt)
-
- userRecord.salt = newSalt
- userRecord.password_sha = newSha
- couch.put(revved, userRecord, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
-
- // changing password invalidates session.
- // need to re-login
- couch.login(newAuth, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
-
- couch.get(u, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
- t.ok(data, 'data')
- t.ok(couch.token, 'token')
- t.equal(data.testingCouchLogin, undefined)
- userRecord = data
- t.end()
- })
- })
- })
-})
-
-tap.test('change password back manually', function (t) {
- var revved = u + '?rev=' + userRecord._rev
- , newPass = auth.password
- , newSalt = 'test-salt'
- , newSha = sha(newPass + newSalt)
-
- userRecord.salt = newSalt
- userRecord.password_sha = newSha
- couch.put(revved, userRecord, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
- t.ok(data, 'data')
- t.ok(couch.token, 'token')
-
- couch.login(auth, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
-
- couch.get(u, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
- t.ok(data, 'data')
- t.ok(couch.token, 'token')
- userRecord = data
- t.end()
- })
- })
- })
-})
-
-tap.test('change password easy', function (t) {
- couch.changePass(newAuth, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
-
- couch.get(u, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
- t.ok(data, 'data')
- t.ok(couch.token, 'token')
- t.equal(data.testingCouchLogin, undefined)
- t.equal(data.mustChangePass, true)
- userRecord = data
- t.end()
- })
- })
-})
-
-tap.test('change password back easy', function (t) {
- couch.changePass(auth, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
-
- couch.get(u, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
- t.ok(data, 'data')
- t.ok(couch.token, 'token')
- t.equal(data.testingCouchLogin, undefined)
- t.notOk(data.mustChangePass)
- userRecord = data
- t.end()
- })
- })
-})
-
-
-tap.test('logout', function (t) {
- couch.logout(function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
- t.ok(data, 'data')
- t.notOk(couch.token, 'token')
- t.end()
- })
-})
-
-var signupUser = { name: 'test-user-signup', password: 'signup-test' }
-
-tap.test('sign up as new user', function (t) {
- couch.signup(signupUser, function (er, res, data) {
- t.ifError(er)
- if (er) return t.end()
- okStatus(t, res)
- t.ok(data, 'data')
- t.has(data,
- { _id: 'org.couchdb.user:test-user-signup',
- name: 'test-user-signup',
- roles: [],
- type: 'user' })
- t.ok(data._rev, 'rev')
- t.ok(data.date, 'date')
- t.ok(data.password_sha, 'hash')
- t.ok(data.salt, 'salt')
- t.ok(couch.token, 'token')
- // now delete account
- var name = signupUser.name
- couch.deleteAccount(name, function (er, res, data) {
- t.ifError(er, 'should be no error deleting account')
- if (er) return t.end()
- okStatus(t, res)
- t.ok(data, 'data')
- t.end()
- })
- })
-})
diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/test/reset-then-signup.js b/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/test/reset-then-signup.js
deleted file mode 100644
index 77a5ceda93..0000000000
--- a/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/test/reset-then-signup.js
+++ /dev/null
@@ -1,112 +0,0 @@
-var test = require('tap').test
-var CouchLogin = require('../couch-login.js')
-
-var auth = { name: 'testuser', password: 'test' }
-, newAuth = { name: 'testuser', password: 'asdf', mustChangePass: true }
-, db = 'http://localhost:15985/'
-, couch = new CouchLogin(db)
-, u = '/_users/org.couchdb.user:' + auth.name
-, admin = { name: 'admin', password: 'admin' }
-, newUser = { name: 'testuser', password: 'test' }
-, newUserCouch = null
-, authToken = null
-
-newUser.name += Math.floor(Math.random() * 1E9)
-
-var okGlobal = Object.keys(global)
-
-var adminCouch = new CouchLogin(db, 'basic')
-
-function okStatus (t, res) {
- var x = { found: res.statusCode, wanted: 'around 200' }
- var r = res.statusCode
- x.ok = (r >= 200 && r < 300)
- return t.ok(x.ok, 'Status code should be 200-ish', x)
-}
-
-test('adminCouch login', function (t) {
- t.deepEqual(Object.keys(global), okGlobal)
- console.error('adminCouch login')
- adminCouch.login(admin, function (er, res, data) {
- if (er)
- throw er
- okStatus(t, res)
- t.ok(data)
- t.end()
- })
-})
-
-test('get the user data as admin', function (t) {
- t.deepEqual(Object.keys(global), okGlobal)
- console.error('2')
- adminCouch.get(u, function (er, res, data) {
- if (er)
- throw er
- okStatus(t, res)
- t.ok(data)
- t.end()
- })
-})
-
-test('admin user changes the password for non-admin user', function (t) {
- console.error(3)
- t.deepEqual(Object.keys(global), okGlobal)
- adminCouch.changePass(newAuth, function (er, res, data) {
- if (er)
- throw er
- okStatus(t, res)
- t.ok(data)
- t.end()
- })
-})
-
-test('testuser logs in', function (t) {
- console.error(4)
- t.deepEqual(Object.keys(global), okGlobal)
- couch.login(newAuth, function (er, res, data) {
- if (er)
- throw er
- okStatus(t, res)
- t.deepEqual(data, { ok: true, name: 'testuser', roles: [] })
- authToken = couch.token
- t.end()
- })
-})
-
-// test('testuser changes password', function (t) {
-// couch = new CouchLogin(db)
-// couch.token = authToken
-// couch.changePass(auth, function (er, res, data) {
-// if (er)
-// throw er
-// okStatus(t, res)
-// console.error(data)
-// t.ok(data)
-// t.end()
-// })
-// })
-
-test('new user signup', function (t) {
- t.deepEqual(Object.keys(global), okGlobal)
- newUserCouch = new CouchLogin(db)
- newUserCouch.signup(newUser, function (er, res, data) {
- if (er)
- throw er
- okStatus(t, res)
- console.error(data)
- t.ok(data)
- t.end()
- })
-})
-
-test('delete newUser account', function (t) {
- t.deepEqual(Object.keys(global), okGlobal)
- newUserCouch.deleteAccount(newUser.name, function (er, res, data) {
- if (er)
- throw er
- okStatus(t, res)
- console.error(data)
- t.ok(data)
- t.end()
- })
-})
diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/test/zz-teardown.js b/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/test/zz-teardown.js
deleted file mode 100644
index a66e24a104..0000000000
--- a/deps/npm/node_modules/npm-registry-client/node_modules/couch-login/test/zz-teardown.js
+++ /dev/null
@@ -1,23 +0,0 @@
-// kill the couchdb process that's running as a detached child process
-// started by the 00-setup.js test
-
-var fs = require('fs')
-var test = require('tap').test
-var path = require('path')
-var pidfile = path.resolve(__dirname, 'fixtures', 'pid')
-var _users = path.resolve(__dirname, 'fixtures', '_users.couch')
-
-test('kill all the users', function (t) {
- fs.unlinkSync(_users)
- t.pass('_users db deleted')
- t.end()
-})
-
-test('craigslist (well, how do you get rid of YOUR couches?)', function (t) {
- var pid = fs.readFileSync(pidfile)
- fs.unlinkSync(pidfile)
- process.kill(pid)
- t.pass('couch is no more')
- t.end()
-})
-
diff --git a/deps/npm/node_modules/npm-registry-client/package.json b/deps/npm/node_modules/npm-registry-client/package.json
index e09464889d..d9e22e289b 100644
--- a/deps/npm/node_modules/npm-registry-client/package.json
+++ b/deps/npm/node_modules/npm-registry-client/package.json
@@ -6,7 +6,7 @@
},
"name": "npm-registry-client",
"description": "Client for the npm registry",
- "version": "0.3.5",
+ "version": "0.4.0",
"repository": {
"url": "git://github.com/isaacs/npm-registry-client"
},
@@ -23,7 +23,6 @@
"mkdirp": "~0.3.3",
"rimraf": "~2",
"retry": "0.6.0",
- "couch-login": "~0.1.18",
"npmlog": ""
},
"devDependencies": {
@@ -39,10 +38,10 @@
"url": "https://github.com/isaacs/npm-registry-client/issues"
},
"homepage": "https://github.com/isaacs/npm-registry-client",
- "_id": "npm-registry-client@0.3.5",
+ "_id": "npm-registry-client@0.4.0",
"dist": {
- "shasum": "98ba1ac851a3939a3fb9917c28fa8da522dc635f"
+ "shasum": "30d0c178b7f2e54183a6a3fc9fe4071eb10290bf"
},
- "_from": "npm-registry-client@0.3.5",
- "_resolved": "https://registry.npmjs.org/npm-registry-client/-/npm-registry-client-0.3.5.tgz"
+ "_from": "npm-registry-client@0.4.0",
+ "_resolved": "https://registry.npmjs.org/npm-registry-client/-/npm-registry-client-0.4.0.tgz"
}
diff --git a/deps/npm/node_modules/read-package-json/.npmignore b/deps/npm/node_modules/read-package-json/.npmignore
new file mode 100644
index 0000000000..8c23deeb34
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/.npmignore
@@ -0,0 +1,13 @@
+*.swp
+.*.swp
+
+.DS_Store
+*~
+.project
+.settings
+npm-debug.log
+coverage.html
+.idea
+lib-cov
+
+node_modules
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/fixer.js b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/fixer.js
index af2bf55ae6..9d832ee173 100644
--- a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/fixer.js
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/fixer.js
@@ -6,6 +6,8 @@ var url = require("url")
var typos = require("./typos")
var coreModuleNames = require("./core_module_names")
var githubUserRepo = require("github-url-from-username-repo")
+var warningMessages = require('./warning_messages.json')
+var format = require('util').format
var fixer = module.exports = {
// default warning function
@@ -13,11 +15,10 @@ var fixer = module.exports = {
fixRepositoryField: function(data) {
if (data.repositories) {
- this.warn("'repositories' (plural) Not supported.\n" +
- "Please pick one as the 'repository' field");
+ this.warn(warningMessages.repositories);
data.repository = data.repositories[0]
}
- if (!data.repository) return this.warn('No repository field.')
+ if (!data.repository) return this.warn(warningMessages.missingRepository)
if (typeof data.repository === "string") {
data.repository = {
type: "git",
@@ -36,7 +37,7 @@ var fixer = module.exports = {
}
if (r.match(/github.com\/[^\/]+\/[^\/]+\.git\.git$/)) {
- this.warn("Probably broken git url: " + r)
+ this.warn(format(warningMessages.brokenGitUrl, r))
}
}
@@ -51,12 +52,12 @@ var fixer = module.exports = {
, fixScriptsField: function(data) {
if (!data.scripts) return
if (typeof data.scripts !== "object") {
- this.warn("scripts must be an object")
+ this.warn(warningMessages.nonObjectScripts)
delete data.scripts
}
Object.keys(data.scripts).forEach(function (k) {
if (typeof data.scripts[k] !== "string") {
- this.warn("script values must be string commands")
+ this.warn(warningMessages.nonStringScript)
delete data.scripts[k]
} else if (typos.script[k]) {
this.warn(makeTypoWarning(k, typos.script[k], "scripts"))
@@ -67,12 +68,12 @@ var fixer = module.exports = {
, fixFilesField: function(data) {
var files = data.files
if (files && !Array.isArray(files)) {
- this.warn("Invalid 'files' member")
+ this.warn(warningMessages.nonArrayFiles)
delete data.files
} else if (data.files) {
data.files = data.files.filter(function(file) {
if (!file || typeof file !== "string") {
- this.warn("Invalid filename in 'files' list: " + file)
+ this.warn(format(warningMessages.invalidFilename, file))
return false
} else {
return true
@@ -104,13 +105,12 @@ var fixer = module.exports = {
delete data[bdd]
}
if (data[bd] && !Array.isArray(data[bd])) {
- this.warn("Invalid 'bundleDependencies' list. " +
- "Must be array of package names")
+ this.warn(warningMessages.nonArrayBundleDependencies)
delete data[bd]
} else if (data[bd]) {
data[bd] = data[bd].filter(function(bd) {
if (!bd || typeof bd !== 'string') {
- this.warn("Invalid bundleDependencies member: " + bd)
+ this.warn(format(nonStringBundleDependency, bd))
return false
} else {
return true
@@ -128,23 +128,28 @@ var fixer = module.exports = {
;['dependencies','devDependencies'].forEach(function(deps) {
if (!(deps in data)) return
if (!data[deps] || typeof data[deps] !== "object") {
- this.warn(deps + " field must be an object")
+ this.warn(format(warningMessages.nonObjectDependencies, deps))
delete data[deps]
return
}
Object.keys(data[deps]).forEach(function (d) {
var r = data[deps][d]
if (typeof r !== 'string') {
- this.warn('Invalid dependency: ' + d + ' ' + JSON.stringify(r))
+ this.warn(format(nonStringDependency, d, JSON.stringify(r)))
delete data[deps][d]
}
+ // "/" is not allowed as packagename for publishing, but for git-urls
+ // normalize shorthand-urls
+ if (githubUserRepo(data[deps][d])) {
+ data[deps][d] = githubUserRepo(data[deps][d])
+ }
}, this)
}, this)
}
, fixModulesField: function (data) {
if (data.modules) {
- this.warn("modules field is deprecated")
+ this.warn(warningMessages.deprecatedModules)
delete data.modules
}
}
@@ -155,11 +160,11 @@ var fixer = module.exports = {
}
if (data.keywords && !Array.isArray(data.keywords)) {
delete data.keywords
- this.warn("keywords should be an array of strings")
+ this.warn(warningMessages.nonArrayKeywords)
} else if (data.keywords) {
data.keywords = data.keywords.filter(function(kw) {
if (typeof kw !== "string" || !kw) {
- this.warn("keywords should be an array of strings");
+ this.warn(warningMessages.nonStringKeyword);
return false
} else {
return true
@@ -200,24 +205,24 @@ var fixer = module.exports = {
data.name = data.name.trim()
ensureValidName(data.name, strict)
if (coreModuleNames.indexOf(data.name) !== -1)
- this.warn(data.name + " is also the name of a node core module.")
+ this.warn(format(warningMessages.conflictingName, data.name))
}
, fixDescriptionField: function (data) {
if (data.description && typeof data.description !== 'string') {
- this.warn("'description' field should be a string")
+ this.warn(warningMessages.nonStringDescription)
delete data.description
}
if (data.readme && !data.description)
data.description = extractDescription(data.readme)
if(data.description === undefined) delete data.description;
- if (!data.description) this.warn('No description')
+ if (!data.description) this.warn(warningMessages.missingDescription)
}
, fixReadmeField: function (data) {
if (!data.readme) {
- this.warn("No README data")
+ this.warn(warningMessages.missingReadme)
data.readme = "ERROR: No README data found!"
}
}
@@ -240,7 +245,7 @@ var fixer = module.exports = {
else if(url.parse(data.bugs).protocol)
data.bugs = {url: data.bugs}
else
- this.warn("Bug string field must be url, email, or {email,url}")
+ this.warn(warningMessages.nonEmailUrlBugsString)
}
else {
bugsTypos(data.bugs, this.warn)
@@ -250,18 +255,18 @@ var fixer = module.exports = {
if(typeof(oldBugs.url) == "string" && url.parse(oldBugs.url).protocol)
data.bugs.url = oldBugs.url
else
- this.warn("bugs.url field must be a string url. Deleted.")
+ this.warn(warningMessages.nonUrlBugsUrlField)
}
if(oldBugs.email) {
if(typeof(oldBugs.email) == "string" && emailRe.test(oldBugs.email))
data.bugs.email = oldBugs.email
else
- this.warn("bugs.email field must be a string email. Deleted.")
+ this.warn(warningMessages.nonEmailBugsEmailField)
}
}
if(!data.bugs.email && !data.bugs.url) {
delete data.bugs
- this.warn("Normalized value of bugs field is an empty object. Deleted.")
+ this.warn(warningMessages.emptyNormalizedBugs)
}
}
}
@@ -277,11 +282,11 @@ var fixer = module.exports = {
return true
if(typeof data.homepage !== "string") {
- this.warn("homepage field must be a string url. Deleted.")
+ this.warn(warningMessages.nonUrlHomepage)
return delete data.homepage
}
if(!url.parse(data.homepage).protocol) {
- this.warn("homepage field must start with a protocol.")
+ this.warn(warningMessages.missingProtocolHomepage)
data.homepage = "http://" + data.homepage
}
}
@@ -345,7 +350,7 @@ function depObjectify (deps, type, warn) {
deps = deps.trim().split(/[\n\r\s\t ,]+/)
}
if (!Array.isArray(deps)) return deps
- warn("specifying " + type + " as array is deprecated")
+ warn(format(warningMessages.deprecatedArrayDependencies, type))
var o = {}
deps.filter(function (d) {
return typeof d === "string"
@@ -383,5 +388,5 @@ function makeTypoWarning (providedName, probableName, field) {
providedName = field + "['" + providedName + "']"
probableName = field + "['" + probableName + "']"
}
- return providedName + " should probably be " + probableName + "."
-}
+ return format(warningMessages.typo, providedName, probableName)
+} \ No newline at end of file
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/safe_format.js b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/safe_format.js
new file mode 100644
index 0000000000..08517f1421
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/safe_format.js
@@ -0,0 +1,9 @@
+var util = require('util')
+
+module.exports = function() {
+ var args = Array.prototype.slice.call(arguments, 0)
+ args.forEach(function(arg) {
+ if (!arg) throw new TypeError('Bad arguments.')
+ })
+ return util.format.apply(null, arguments)
+} \ No newline at end of file
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/warning_messages.json b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/warning_messages.json
new file mode 100644
index 0000000000..9605f5cc64
--- /dev/null
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/warning_messages.json
@@ -0,0 +1,28 @@
+{
+ "repositories": "'repositories' (plural) Not supported. Please pick one as the 'repository' field"
+ ,"missingRepository": "No repository field."
+ ,"brokenGitUrl": "Probably broken git url: %s"
+ ,"nonObjectScripts": "scripts must be an object"
+ ,"nonStringScript": "script values must be string commands"
+ ,"nonArrayFiles": "Invalid 'files' member"
+ ,"invalidFilename": "Invalid filename in 'files' list: %s"
+ ,"nonArrayBundleDependencies": "Invalid 'bundleDependencies' list. Must be array of package names"
+ ,"nonStringBundleDependency": "Invalid bundleDependencies member: %s"
+ ,"nonObjectDependencies": "%s field must be an object"
+ ,"nonStringDependency": "Invalid dependency: %s %s"
+ ,"deprecatedArrayDependencies": "specifying %s as array is deprecated"
+ ,"deprecatedModules": "modules field is deprecated"
+ ,"nonArrayKeywords": "keywords should be an array of strings"
+ ,"nonStringKeyword": "keywords should be an array of strings"
+ ,"conflictingName": "%s is also the name of a node core module."
+ ,"nonStringDescription": "'description' field should be a string"
+ ,"missingDescription": "No description"
+ ,"missingReadme": "No README data"
+ ,"nonEmailUrlBugsString": "Bug string field must be url, email, or {email,url}"
+ ,"nonUrlBugsUrlField": "bugs.url field must be a string url. Deleted."
+ ,"nonEmailBugsEmailField": "bugs.email field must be a string email. Deleted."
+ ,"emptyNormalizedBugs": "Normalized value of bugs field is an empty object. Deleted."
+ ,"nonUrlHomepage": "homepage field must be a string url. Deleted."
+ ,"missingProtocolHomepage": "homepage field must start with a protocol."
+ ,"typo": "%s should probably be %s."
+} \ No newline at end of file
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/package.json b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/package.json
index 1ea36836ac..05037bf927 100644
--- a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/package.json
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/package.json
@@ -1,6 +1,6 @@
{
"name": "normalize-package-data",
- "version": "0.2.8",
+ "version": "0.2.9",
"author": {
"name": "Meryn Stol",
"email": "merynstol@gmail.com"
@@ -44,6 +44,10 @@
"url": "https://github.com/meryn/normalize-package-data/issues"
},
"homepage": "https://github.com/meryn/normalize-package-data",
- "_id": "normalize-package-data@0.2.8",
- "_from": "normalize-package-data@~0.2.7"
+ "_id": "normalize-package-data@0.2.9",
+ "dist": {
+ "shasum": "73fff1f896ce6f95bd089c57037a96389ad5789e"
+ },
+ "_from": "normalize-package-data@~0.2.9",
+ "_resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-0.2.9.tgz"
}
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/normalize.js b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/normalize.js
index 6e96e6dc97..dd26c5d01f 100644
--- a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/normalize.js
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/normalize.js
@@ -5,6 +5,8 @@ var path = require("path")
var globals = Object.keys(global)
var normalize = require("../lib/normalize")
+var warningMessages = require("../lib/warning_messages.json")
+var safeFormat = require("../lib/safe_format")
var rpjPath = path.resolve(__dirname,"./fixtures/read-package-json.json")
tap.test("normalize some package data", function(t) {
@@ -48,9 +50,9 @@ tap.test("empty object", function(t) {
normalize(packageData, warn)
t.same(packageData, expect)
t.same(warnings, [
- "No description",
- "No repository field.",
- "No README data"
+ warningMessages.missingDescription,
+ warningMessages.missingRepository,
+ warningMessages.missingReadme
])
t.end()
})
@@ -70,10 +72,10 @@ tap.test("core module name", function(t) {
}, warn)
var expect = [
- "http is also the name of a node core module.",
- "Bug string field must be url, email, or {email,url}",
- "Normalized value of bugs field is an empty object. Deleted.",
- "homepage field must be a string url. Deleted."
+ safeFormat(warningMessages.conflictingName, 'http'),
+ warningMessages.nonEmailUrlBugsString,
+ warningMessages.emptyNormalizedBugs,
+ warningMessages.nonUrlHomepage
]
t.same(warnings, expect)
t.end()
@@ -101,15 +103,15 @@ tap.test("urls required", function(t) {
console.error(a)
var expect =
- [ "No description",
- "No repository field.",
- "bugs.url field must be a string url. Deleted.",
- "bugs.email field must be a string email. Deleted.",
- "Normalized value of bugs field is an empty object. Deleted.",
- "No README data",
- "Bug string field must be url, email, or {email,url}",
- "Normalized value of bugs field is an empty object. Deleted.",
- "homepage field must be a string url. Deleted." ]
+ [ warningMessages.missingDescription,
+ warningMessages.missingRepository,
+ warningMessages.nonUrlBugsUrlField,
+ warningMessages.nonEmailBugsEmailField,
+ warningMessages.emptyNormalizedBugs,
+ warningMessages.missingReadme,
+ warningMessages.nonEmailUrlBugsString,
+ warningMessages.emptyNormalizedBugs,
+ warningMessages.nonUrlHomepage ]
t.same(warnings, expect)
t.end()
})
@@ -127,10 +129,10 @@ tap.test("homepage field must start with a protocol.", function(t) {
console.error(a)
var expect =
- [ "No description",
- "No repository field.",
- "No README data",
- "homepage field must start with a protocol." ]
+ [ warningMessages.missingDescription,
+ warningMessages.missingRepository,
+ warningMessages.missingReadme,
+ warningMessages.missingProtocolHomepage ]
t.same(warnings, expect)
t.same(a.homepage, 'http://example.org')
t.end()
@@ -194,6 +196,13 @@ tap.test("homepage field will set to github gist url if repository is a shorthan
t.end()
})
+tap.test("treat isaacs/node-graceful-fs as github repo in dependencies", function(t) {
+ var d = {dependencies: {"node-graceful-fs": "isaacs/node-graceful-fs"}}
+ normalize(d)
+ t.same(d.dependencies, {"node-graceful-fs": "git://github.com/isaacs/node-graceful-fs" })
+ t.end()
+});
+
tap.test("deprecation warning for array in dependencies fields", function(t) {
var a
var warnings = []
@@ -205,9 +214,9 @@ tap.test("deprecation warning for array in dependencies fields", function(t) {
devDependencies: [],
optionalDependencies: []
}, warn)
- t.ok(~warnings.indexOf("specifying dependencies as array is deprecated"), "deprecation warning")
- t.ok(~warnings.indexOf("specifying devDependencies as array is deprecated"), "deprecation warning")
- t.ok(~warnings.indexOf("specifying optionalDependencies as array is deprecated"), "deprecation warning")
+ t.ok(~warnings.indexOf(safeFormat(warningMessages.deprecatedArrayDependencies, 'dependencies')), "deprecation warning")
+ t.ok(~warnings.indexOf(safeFormat(warningMessages.deprecatedArrayDependencies, 'devDependencies')), "deprecation warning")
+ t.ok(~warnings.indexOf(safeFormat(warningMessages.deprecatedArrayDependencies, 'optionalDependencies')), "deprecation warning")
t.end()
})
diff --git a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/typo.js b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/typo.js
index 3eef829fd4..eda75545e9 100644
--- a/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/typo.js
+++ b/deps/npm/node_modules/read-package-json/node_modules/normalize-package-data/test/typo.js
@@ -1,33 +1,38 @@
var test = require('tap').test
+
var normalize = require('../')
var typos = require('../lib/typos.json')
+var warningMessages = require("../lib/warning_messages.json")
+var safeFormat = require("../lib/safe_format")
test('typos', function(t) {
var warnings = []
function warn(m) {
warnings.push(m)
}
+
+ var typoMessage = safeFormat.bind(undefined, warningMessages.typo)
var expect =
- [ 'No repository field.',
- 'dependancies should probably be dependencies.',
- 'dependecies should probably be dependencies.',
- 'depdenencies should probably be dependencies.',
- 'devEependencies should probably be devDependencies.',
- 'depends should probably be dependencies.',
- 'dev-dependencies should probably be devDependencies.',
- 'devDependences should probably be devDependencies.',
- 'devDepenencies should probably be devDependencies.',
- 'devdependencies should probably be devDependencies.',
- 'repostitory should probably be repository.',
- 'repo should probably be repository.',
- 'prefereGlobal should probably be preferGlobal.',
- 'hompage should probably be homepage.',
- 'hampage should probably be homepage.',
- 'autohr should probably be author.',
- 'autor should probably be author.',
- 'contributers should probably be contributors.',
- 'publicationConfig should probably be publishConfig.' ]
+ [ warningMessages.missingRepository,
+ typoMessage('dependancies', 'dependencies'),
+ typoMessage('dependecies', 'dependencies'),
+ typoMessage('depdenencies', 'dependencies'),
+ typoMessage('devEependencies', 'devDependencies'),
+ typoMessage('depends', 'dependencies'),
+ typoMessage('dev-dependencies', 'devDependencies'),
+ typoMessage('devDependences', 'devDependencies'),
+ typoMessage('devDepenencies', 'devDependencies'),
+ typoMessage('devdependencies', 'devDependencies'),
+ typoMessage('repostitory', 'repository'),
+ typoMessage('repo', 'repository'),
+ typoMessage('prefereGlobal', 'preferGlobal'),
+ typoMessage('hompage', 'homepage'),
+ typoMessage('hampage', 'homepage'),
+ typoMessage('autohr', 'author'),
+ typoMessage('autor', 'author'),
+ typoMessage('contributers', 'contributors'),
+ typoMessage('publicationConfig', 'publishConfig') ]
normalize({"dependancies": "dependencies"
,"dependecies": "dependencies"
@@ -55,13 +60,13 @@ test('typos', function(t) {
warnings.length = 0
var expect =
- [ 'No description',
- 'No repository field.',
- 'bugs[\'web\'] should probably be bugs[\'url\'].',
- 'bugs[\'name\'] should probably be bugs[\'url\'].',
- 'bugs.url field must be a string url. Deleted.',
- 'Normalized value of bugs field is an empty object. Deleted.',
- "No README data" ]
+ [ warningMessages.missingDescription,
+ warningMessages.missingRepository,
+ typoMessage("bugs['web']", "bugs['url']"),
+ typoMessage("bugs['name']", "bugs['url']"),
+ warningMessages.nonUrlBugsUrlField,
+ warningMessages.emptyNormalizedBugs,
+ warningMessages.missingReadme ]
normalize({name:"name"
,version:"1.2.5"
@@ -71,10 +76,10 @@ test('typos', function(t) {
warnings.length = 0
var expect =
- [ 'No description',
- 'No repository field.',
- "No README data",
- 'script should probably be scripts.' ]
+ [ warningMessages.missingDescription,
+ warningMessages.missingRepository,
+ warningMessages.missingReadme,
+ typoMessage('script', 'scripts') ]
normalize({name:"name"
,version:"1.2.5"
@@ -84,11 +89,11 @@ test('typos', function(t) {
warnings.length = 0
expect =
- [ 'No description',
- 'No repository field.',
- 'scripts[\'server\'] should probably be scripts[\'start\'].',
- 'scripts[\'tests\'] should probably be scripts[\'test\'].',
- "No README data" ]
+ [ warningMessages.missingDescription,
+ warningMessages.missingRepository,
+ typoMessage("scripts['server']", "scripts['start']"),
+ typoMessage("scripts['tests']", "scripts['test']"),
+ warningMessages.missingReadme ]
normalize({name:"name"
,version:"1.2.5"
diff --git a/deps/npm/node_modules/read-package-json/package.json b/deps/npm/node_modules/read-package-json/package.json
index f1e40ddc13..794aedb8ec 100644
--- a/deps/npm/node_modules/read-package-json/package.json
+++ b/deps/npm/node_modules/read-package-json/package.json
@@ -1,6 +1,6 @@
{
"name": "read-package-json",
- "version": "1.1.6",
+ "version": "1.1.7",
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me",
@@ -18,7 +18,7 @@
"dependencies": {
"glob": "~3.2.1",
"lru-cache": "2",
- "normalize-package-data": "~0.2.7",
+ "normalize-package-data": "~0.2.9",
"graceful-fs": "2"
},
"devDependencies": {
@@ -34,10 +34,6 @@
"url": "https://github.com/isaacs/read-package-json/issues"
},
"homepage": "https://github.com/isaacs/read-package-json",
- "_id": "read-package-json@1.1.6",
- "dist": {
- "shasum": "a851dbbaca48ff78a87f890f0a9fdf43b1759d5a"
- },
- "_from": "read-package-json@1.1.6",
- "_resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-1.1.6.tgz"
+ "_id": "read-package-json@1.1.7",
+ "_from": "read-package-json@~1.1.6"
}