diff options
author | Timothy J Fontaine <tjfontaine@gmail.com> | 2014-09-24 14:41:07 -0700 |
---|---|---|
committer | Timothy J Fontaine <tjfontaine@gmail.com> | 2014-09-24 17:15:10 -0700 |
commit | 9fad8958df671c0e894506ef59b4c781c3dfb349 (patch) | |
tree | 4db7643b40c4ffd726fb27fb4aa276d420b3bfd8 /deps/npm/lib/dedupe.js | |
parent | b26dd4e5ab9192bad72b9dc61fa4ad2d8f215da2 (diff) | |
download | android-node-v8-9fad8958df671c0e894506ef59b4c781c3dfb349.tar.gz android-node-v8-9fad8958df671c0e894506ef59b4c781c3dfb349.tar.bz2 android-node-v8-9fad8958df671c0e894506ef59b4c781c3dfb349.zip |
deps: upgrade npm to 2.0.0
Diffstat (limited to 'deps/npm/lib/dedupe.js')
-rw-r--r-- | deps/npm/lib/dedupe.js | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/deps/npm/lib/dedupe.js b/deps/npm/lib/dedupe.js index e6762e15bc..74397d0cb9 100644 --- a/deps/npm/lib/dedupe.js +++ b/deps/npm/lib/dedupe.js @@ -7,7 +7,6 @@ // much better "put pkg X at folder Y" abstraction. Oh well, // whatever. Perfect enemy of the good, and all that. -var url = require("url") var fs = require("fs") var asyncMap = require("slide").asyncMap var path = require("path") @@ -16,6 +15,7 @@ var semver = require("semver") var rm = require("./utils/gently-rm.js") var log = require("npmlog") var npm = require("./npm.js") +var mapToRegistry = require("./utils/map-to-registry.js") module.exports = dedupe @@ -61,7 +61,7 @@ function dedupe_ (dir, filter, unavoidable, dryrun, silent, cb) { Object.keys(obj.children).forEach(function (k) { U(obj.children[k]) }) - }) + })(data) // then collect them up and figure out who needs them ;(function C (obj) { @@ -240,13 +240,19 @@ function findVersions (npm, summary, cb) { var versions = data.versions var ranges = data.ranges - var uri = url.resolve(npm.config.get("registry"), name) - npm.registry.get(uri, null, function (er, data) { + mapToRegistry(name, npm.config, function (er, uri) { + if (er) return cb(er) + + npm.registry.get(uri, null, next) + }) + + function next (er, data) { var regVersions = er ? [] : Object.keys(data.versions) var locMatch = bestMatch(versions, ranges) - var regMatch; var tag = npm.config.get("tag") var distTag = data["dist-tags"] && data["dist-tags"][tag] + + var regMatch if (distTag && data.versions[distTag] && matches(distTag, ranges)) { regMatch = distTag } else { @@ -254,7 +260,7 @@ function findVersions (npm, summary, cb) { } cb(null, [[name, has, loc, locMatch, regMatch, locs]]) - }) + } }, cb) } |