Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2014-05-02 03:12:09 +0400
committerisaacs <i@izs.me>2014-05-02 03:12:09 +0400
commit90b8427a308e2b27f76d7ebb454e27abbd745df7 (patch)
tree5d02c02781b19a18c55aa65f1ce64543f8974c5a /lib/npm.js
parente21c9c2fac024709e357547af4281f99b3997dfc (diff)
send referer header
Diffstat (limited to 'lib/npm.js')
-rw-r--r--lib/npm.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/npm.js b/lib/npm.js
index a529862d5..c8965bdc6 100644
--- a/lib/npm.js
+++ b/lib/npm.js
@@ -191,20 +191,38 @@ Object.keys(abbrevs).concat(plumbing).forEach(function addCommand (c) {
if (c === "la" || c === "ll") {
npm.config.set("long", true)
}
+
npm.command = c
if (commandCache[a]) return commandCache[a]
+
var cmd = require(__dirname+"/"+a+".js")
+
commandCache[a] = function () {
var args = Array.prototype.slice.call(arguments, 0)
if (typeof args[args.length - 1] !== "function") {
args.push(defaultCb)
}
if (args.length === 1) args.unshift([])
+
+ npm.registry.refer = [a].concat(args[0]).map(function (arg) {
+ // exclude anything that might be a URL, path, or private module
+ // Those things will always have a slash in them somewhere
+ if (arg && arg.match(/\/|\\/)) {
+ return "[REDACTED]"
+ } else {
+ return arg
+ }
+ }).filter(function (arg) {
+ return arg
+ }).join(" ")
+
cmd.apply(npm, args)
}
+
Object.keys(cmd).forEach(function (k) {
commandCache[a][k] = cmd[k]
})
+
return commandCache[a]
}, enumerable: fullList.indexOf(c) !== -1 })