diff options
172 files changed, 872 insertions, 1906 deletions
diff --git a/deps/npm/LICENSE b/deps/npm/LICENSE index c94425929..3702d8a05 100644 --- a/deps/npm/LICENSE +++ b/deps/npm/LICENSE @@ -49,6 +49,11 @@ and are not covered by this license. "npm Logo" created by Mathias Pettersson and Brian Hammond, used with permission. +"Gubblebum Blocky" font +Copyright (c) 2007 by Tjarda Koster, http://jelloween.deviantart.com +included for use in the npm website and documentation, +used with permission. + This program uses "node-uuid", Copyright (c) 2010 Robert Kieffer, according to the terms of the MIT license. diff --git a/deps/npm/bin/npm-cli.js b/deps/npm/bin/npm-cli.js index f29437093..a71985b37 100755 --- a/deps/npm/bin/npm-cli.js +++ b/deps/npm/bin/npm-cli.js @@ -15,9 +15,9 @@ if (typeof WScript !== "undefined") { process.title = "npm" -var log = require("../lib/utils/log.js") -log.waitForConfig() -log.info("ok", "it worked if it ends with") +var log = require("npmlog") +log.pause() // will be unpaused when config is loaded. +log.info("it worked if it ends with", "ok") var fs = require("graceful-fs") , path = require("path") @@ -36,7 +36,7 @@ if (path.basename(process.argv[1]).slice(-1) === "g") { process.argv.splice(1, 1, "npm", "-g") } -log.verbose(process.argv, "cli") +log.verbose("cli", process.argv) var conf = nopt(types, shorthands) npm.argv = conf.argv.remain @@ -56,8 +56,8 @@ if (conf.versions) { return } -log.info("npm@"+npm.version, "using") -log.info("node@"+process.version, "using") +log.info("using", "npm@%s", npm.version) +log.info("using", "node@%s", process.version) // make sure that this version of node works with this version of npm. var semver = require("semver") diff --git a/deps/npm/doc/cli/coding-style.md b/deps/npm/doc/cli/coding-style.md index 42ac1d785..c505dba83 100644 --- a/deps/npm/doc/cli/coding-style.md +++ b/deps/npm/doc/cli/coding-style.md @@ -129,29 +129,18 @@ Just send the error message back as the first argument to the callback. Always create a new Error object with your message. Don't just return a string message to the callback. Stack traces are handy. -Use the `require("./utils/log").er` function. It takes a callback and an -error message, and returns an object that will report the message in the -event of a failure. It's quite handy. - - function myThing (args, cb) { - getData(args, function (er, data) { - if (er) return log.er(cb, "Couldn't get data")(er) - doSomethingElse(data, cb) - }) - } - function justHasToWork (cb) { - doSomething(log.er(cb, "the doSomething failed.")) - } - ## Logging +Logging is done using the [npmlog](https://github.com/isaacs/npmlog) +utility. + Please clean up logs when they are no longer helpful. In particular, logging the same object over and over again is not helpful. Logs should report what's happening so that it's easier to track down where a fault occurs. -Use appropriate log levels. The default log() function logs at the -"info" level. See `npm-config(1)` and search for "loglevel". +Use appropriate log levels. See `npm-config(1)` and search for +"loglevel". ## Case, naming, etc. diff --git a/deps/npm/doc/cli/config.md b/deps/npm/doc/cli/config.md index 3fd9cb826..659895eaf 100644 --- a/deps/npm/doc/cli/config.md +++ b/deps/npm/doc/cli/config.md @@ -430,13 +430,6 @@ if one of the two conditions are met: * the globally installed version is identical to the version that is being installed locally. -### logfd - -* Default: stderr file descriptor -* Type: Number or Stream - -The location to write log output. - ### loglevel * Default: "http" @@ -449,14 +442,6 @@ What level of logs to report. On failure, *all* logs are written to Any logs of a higher level than the setting are shown. The default is "http", which shows http, warn, and error output. -### logprefix - -* Default: true on Posix, false on Windows -* Type: Boolean - -Whether or not to prefix log messages with "npm" and the log level. See -also "color" and "loglevel". - ### long * Default: false @@ -503,13 +488,6 @@ The url to report npat test results. A node module to `require()` when npm loads. Useful for programmatic usage. -### outfd - -* Default: standard output file descriptor -* Type: Number or Stream - -Where to write "normal" output. This has no effect on log output. - ### parseable * Default: false diff --git a/deps/npm/html/api/bin.html b/deps/npm/html/api/bin.html index f6781bfa4..cca295eab 100644 --- a/deps/npm/html/api/bin.html +++ b/deps/npm/html/api/bin.html @@ -19,7 +19,7 @@ <p>This function should not be used programmatically. Instead, just refer to the <code>npm.bin</code> member.</p> </div> -<p id="footer">bin — npm@1.1.24</p> +<p id="footer">bin — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/bugs.html b/deps/npm/html/api/bugs.html index 3585f37c0..1fe13e924 100644 --- a/deps/npm/html/api/bugs.html +++ b/deps/npm/html/api/bugs.html @@ -25,7 +25,7 @@ optional version number.</p> <p>This command will launch a browser, so this command may not be the most friendly for programmatic use.</p> </div> -<p id="footer">bugs — npm@1.1.24</p> +<p id="footer">bugs — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/commands.html b/deps/npm/html/api/commands.html index dd6fc418a..c99a3dedb 100644 --- a/deps/npm/html/api/commands.html +++ b/deps/npm/html/api/commands.html @@ -28,7 +28,7 @@ usage, or <code>man 3 npm-<command></code> for programmatic usage.</p> <ul><li><a href="../doc/index.html">index(1)</a></li></ul> </div> -<p id="footer">commands — npm@1.1.24</p> +<p id="footer">commands — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/config.html b/deps/npm/html/api/config.html index 569d2a547..31abdf285 100644 --- a/deps/npm/html/api/config.html +++ b/deps/npm/html/api/config.html @@ -33,7 +33,7 @@ functions instead.</p> <ul><li><a href="../api/npm.html">npm(3)</a></li></ul> </div> -<p id="footer">config — npm@1.1.24</p> +<p id="footer">config — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/deprecate.html b/deps/npm/html/api/deprecate.html index bf1f860c7..09ffb2a00 100644 --- a/deps/npm/html/api/deprecate.html +++ b/deps/npm/html/api/deprecate.html @@ -30,7 +30,7 @@ install the package.</p></li></ul> <ul><li><a href="../api/publish.html">publish(3)</a></li><li><a href="../api/unpublish.html">unpublish(3)</a></li><li><a href="../doc/registry.html">registry(1)</a></li></ul> </div> -<p id="footer">deprecate — npm@1.1.24</p> +<p id="footer">deprecate — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/docs.html b/deps/npm/html/api/docs.html index 3dfcfcb61..f0375314a 100644 --- a/deps/npm/html/api/docs.html +++ b/deps/npm/html/api/docs.html @@ -25,7 +25,7 @@ optional version number.</p> <p>This command will launch a browser, so this command may not be the most friendly for programmatic use.</p> </div> -<p id="footer">docs — npm@1.1.24</p> +<p id="footer">docs — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/edit.html b/deps/npm/html/api/edit.html index 355603cc5..45a2ddd20 100644 --- a/deps/npm/html/api/edit.html +++ b/deps/npm/html/api/edit.html @@ -30,7 +30,7 @@ to open. The package can optionally have a version number attached.</p> <p>Since this command opens an editor in a new process, be careful about where and how this is used.</p> </div> -<p id="footer">edit — npm@1.1.24</p> +<p id="footer">edit — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/explore.html b/deps/npm/html/api/explore.html index e8264739f..37178a478 100644 --- a/deps/npm/html/api/explore.html +++ b/deps/npm/html/api/explore.html @@ -24,7 +24,7 @@ sure to use <code>npm rebuild <pkg></code> if you make any changes.</p> <p>The first element in the 'args' parameter must be a package name. After that is the optional command, which can be any number of strings. All of the strings will be combined into one, space-delimited command.</p> </div> -<p id="footer">explore — npm@1.1.24</p> +<p id="footer">explore — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/help-search.html b/deps/npm/html/api/help-search.html index 86ba337e9..cdc595400 100644 --- a/deps/npm/html/api/help-search.html +++ b/deps/npm/html/api/help-search.html @@ -32,7 +32,7 @@ Name of the file that matched</li></ul> <p>The silent parameter is not neccessary not used, but it may in the future.</p> </div> -<p id="footer">help-search — npm@1.1.24</p> +<p id="footer">help-search — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/init.html b/deps/npm/html/api/init.html index 4e8b7f92f..949acb1dc 100644 --- a/deps/npm/html/api/init.html +++ b/deps/npm/html/api/init.html @@ -35,7 +35,7 @@ then go ahead and use this programmatically.</p> <p><a href="../doc/json.html">json(1)</a></p> </div> -<p id="footer">init — npm@1.1.24</p> +<p id="footer">init — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/install.html b/deps/npm/html/api/install.html index 0cb6747ee..360363309 100644 --- a/deps/npm/html/api/install.html +++ b/deps/npm/html/api/install.html @@ -25,7 +25,7 @@ the name of a package to be installed.</p> <p>Finally, 'callback' is a function that will be called when all packages have been installed or when an error has been encountered.</p> </div> -<p id="footer">install — npm@1.1.24</p> +<p id="footer">install — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/link.html b/deps/npm/html/api/link.html index 0acc672b3..f9eeffe36 100644 --- a/deps/npm/html/api/link.html +++ b/deps/npm/html/api/link.html @@ -39,7 +39,7 @@ npm.commands.link('redis', cb) # link-install the package</code></pre> <p>Now, any changes to the redis package will be reflected in the package in the current working directory</p> </div> -<p id="footer">link — npm@1.1.24</p> +<p id="footer">link — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/load.html b/deps/npm/html/api/load.html index 68ac85386..4b0b8e342 100644 --- a/deps/npm/html/api/load.html +++ b/deps/npm/html/api/load.html @@ -32,7 +32,7 @@ config object.</p> <p>For a list of all the available command-line configs, see <code>npm help config</code></p> </div> -<p id="footer">load — npm@1.1.24</p> +<p id="footer">load — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/ls.html b/deps/npm/html/api/ls.html index 768e4dac9..d9c3751da 100644 --- a/deps/npm/html/api/ls.html +++ b/deps/npm/html/api/ls.html @@ -59,7 +59,7 @@ project.</p> This means that if a submodule a same dependency as a parent module, then the dependency will only be output once.</p> </div> -<p id="footer">ls — npm@1.1.24</p> +<p id="footer">ls — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/npm.html b/deps/npm/html/api/npm.html index 14958711e..d3002ef49 100644 --- a/deps/npm/html/api/npm.html +++ b/deps/npm/html/api/npm.html @@ -24,7 +24,7 @@ npm.load(configObject, function (er, npm) { <h2 id="VERSION">VERSION</h2> -<p>1.1.24</p> +<p>1.1.25</p> <h2 id="DESCRIPTION">DESCRIPTION</h2> @@ -91,7 +91,7 @@ method names. Use the <code>npm.deref</code> method to find the real name.</p> <pre><code>var cmd = npm.deref("unp") // cmd === "unpublish"</code></pre> </div> -<p id="footer">npm — npm@1.1.24</p> +<p id="footer">npm — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/outdated.html b/deps/npm/html/api/outdated.html index 4c4f3696a..a08afd836 100644 --- a/deps/npm/html/api/outdated.html +++ b/deps/npm/html/api/outdated.html @@ -19,7 +19,7 @@ currently outdated.</p> <p>If the 'packages' parameter is left out, npm will check all packages.</p> </div> -<p id="footer">outdated — npm@1.1.24</p> +<p id="footer">outdated — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/owner.html b/deps/npm/html/api/owner.html index 966422bf8..f943a639e 100644 --- a/deps/npm/html/api/owner.html +++ b/deps/npm/html/api/owner.html @@ -34,7 +34,7 @@ that is not implemented at this time.</p> <ul><li><a href="../api/publish.html">publish(3)</a></li><li><a href="../doc/registry.html">registry(1)</a></li></ul> </div> -<p id="footer">owner — npm@1.1.24</p> +<p id="footer">owner — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/pack.html b/deps/npm/html/api/pack.html index d038facc0..de159b412 100644 --- a/deps/npm/html/api/pack.html +++ b/deps/npm/html/api/pack.html @@ -25,7 +25,7 @@ overwritten the second time.</p> <p>If no arguments are supplied, then npm packs the current package folder.</p> </div> -<p id="footer">pack — npm@1.1.24</p> +<p id="footer">pack — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/prefix.html b/deps/npm/html/api/prefix.html index 719ea178f..391a728e3 100644 --- a/deps/npm/html/api/prefix.html +++ b/deps/npm/html/api/prefix.html @@ -21,7 +21,7 @@ <p>This function is not useful programmatically</p> </div> -<p id="footer">prefix — npm@1.1.24</p> +<p id="footer">prefix — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/prune.html b/deps/npm/html/api/prune.html index ac8874463..b32fe391d 100644 --- a/deps/npm/html/api/prune.html +++ b/deps/npm/html/api/prune.html @@ -23,7 +23,7 @@ <p>Extraneous packages are packages that are not listed on the parent package's dependencies list.</p> </div> -<p id="footer">prune — npm@1.1.24</p> +<p id="footer">prune — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/publish.html b/deps/npm/html/api/publish.html index fc7fc2139..d77130b39 100644 --- a/deps/npm/html/api/publish.html +++ b/deps/npm/html/api/publish.html @@ -32,7 +32,7 @@ the registry. Overwrites when the "force" environment variable is set.</p> <ul><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/adduser.html">adduser(1)</a></li><li><a href="../api/owner.html">owner(3)</a></li></ul> </div> -<p id="footer">publish — npm@1.1.24</p> +<p id="footer">publish — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/rebuild.html b/deps/npm/html/api/rebuild.html index 791c4ebe6..500ec1568 100644 --- a/deps/npm/html/api/rebuild.html +++ b/deps/npm/html/api/rebuild.html @@ -22,7 +22,7 @@ the new binary. If no 'packages' parameter is specify, every package will be reb <p>See <code>npm help build</code></p> </div> -<p id="footer">rebuild — npm@1.1.24</p> +<p id="footer">rebuild — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/restart.html b/deps/npm/html/api/restart.html index 85bddabe7..dd02b5783 100644 --- a/deps/npm/html/api/restart.html +++ b/deps/npm/html/api/restart.html @@ -27,7 +27,7 @@ in the <code>packages</code> parameter.</p> <ul><li><a href="../api/start.html">start(3)</a></li><li><a href="../api/stop.html">stop(3)</a></li></ul> </div> -<p id="footer">restart — npm@1.1.24</p> +<p id="footer">restart — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/root.html b/deps/npm/html/api/root.html index 174ca4611..d3670d43e 100644 --- a/deps/npm/html/api/root.html +++ b/deps/npm/html/api/root.html @@ -21,7 +21,7 @@ <p>This function is not useful programmatically.</p> </div> -<p id="footer">root — npm@1.1.24</p> +<p id="footer">root — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/run-script.html b/deps/npm/html/api/run-script.html index 799908bc8..553a6239a 100644 --- a/deps/npm/html/api/run-script.html +++ b/deps/npm/html/api/run-script.html @@ -29,7 +29,7 @@ assumed to be the command to run. All other elements are ignored.</p> <ul><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../api/test.html">test(3)</a></li><li><a href="../api/start.html">start(3)</a></li><li><a href="../api/restart.html">restart(3)</a></li><li><a href="../api/stop.html">stop(3)</a></li></ul> </div> -<p id="footer">run-script — npm@1.1.24</p> +<p id="footer">run-script — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/search.html b/deps/npm/html/api/search.html index bdb88fa62..7b855363c 100644 --- a/deps/npm/html/api/search.html +++ b/deps/npm/html/api/search.html @@ -32,7 +32,7 @@ excluded term (the "searchexclude" config). The search is case insensitive and doesn't try to read your mind (it doesn't do any verb tense matching or the like).</p> </div> -<p id="footer">search — npm@1.1.24</p> +<p id="footer">search — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/shrinkwrap.html b/deps/npm/html/api/shrinkwrap.html index 8be37c6a9..4f2751d39 100644 --- a/deps/npm/html/api/shrinkwrap.html +++ b/deps/npm/html/api/shrinkwrap.html @@ -26,7 +26,7 @@ but the shrinkwrap file will still be written.</p> <p>Finally, 'callback' is a function that will be called when the shrinkwrap has been saved.</p> </div> -<p id="footer">shrinkwrap — npm@1.1.24</p> +<p id="footer">shrinkwrap — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/start.html b/deps/npm/html/api/start.html index d762ff588..f4f632532 100644 --- a/deps/npm/html/api/start.html +++ b/deps/npm/html/api/start.html @@ -19,7 +19,7 @@ <p>npm can run tests on multiple packages. Just specify multiple packages in the <code>packages</code> parameter.</p> </div> -<p id="footer">start — npm@1.1.24</p> +<p id="footer">start — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/stop.html b/deps/npm/html/api/stop.html index e782f9fd8..c7ea121ee 100644 --- a/deps/npm/html/api/stop.html +++ b/deps/npm/html/api/stop.html @@ -19,7 +19,7 @@ <p>npm can run stop on multiple packages. Just specify multiple packages in the <code>packages</code> parameter.</p> </div> -<p id="footer">stop — npm@1.1.24</p> +<p id="footer">stop — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/submodule.html b/deps/npm/html/api/submodule.html index 685d9363c..dd34cb1a9 100644 --- a/deps/npm/html/api/submodule.html +++ b/deps/npm/html/api/submodule.html @@ -33,7 +33,7 @@ dependencies into the submodule folder.</p> <ul><li>npm help json</li><li>git help submodule</li></ul> </div> -<p id="footer">submodule — npm@1.1.24</p> +<p id="footer">submodule — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/tag.html b/deps/npm/html/api/tag.html index f1ec1f47f..2f945638c 100644 --- a/deps/npm/html/api/tag.html +++ b/deps/npm/html/api/tag.html @@ -29,7 +29,7 @@ parameter is missing or falsey (empty), the default froom the config will be used. For more information about how to set this config, check <code>man 3 npm-config</code> for programmatic usage or <code>man npm-config</code> for cli usage.</p> </div> -<p id="footer">tag — npm@1.1.24</p> +<p id="footer">tag — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/test.html b/deps/npm/html/api/test.html index 8a1c49598..ca2517301 100644 --- a/deps/npm/html/api/test.html +++ b/deps/npm/html/api/test.html @@ -22,7 +22,7 @@ true.</p> <p>npm can run tests on multiple packages. Just specify multiple packages in the <code>packages</code> parameter.</p> </div> -<p id="footer">test — npm@1.1.24</p> +<p id="footer">test — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/uninstall.html b/deps/npm/html/api/uninstall.html index 3fef0a66c..05ee40a0f 100644 --- a/deps/npm/html/api/uninstall.html +++ b/deps/npm/html/api/uninstall.html @@ -22,7 +22,7 @@ the name of a package to be uninstalled.</p> <p>Finally, 'callback' is a function that will be called when all packages have been uninstalled or when an error has been encountered.</p> </div> -<p id="footer">uninstall — npm@1.1.24</p> +<p id="footer">uninstall — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/unpublish.html b/deps/npm/html/api/unpublish.html index 0e024ac59..934a9cd9d 100644 --- a/deps/npm/html/api/unpublish.html +++ b/deps/npm/html/api/unpublish.html @@ -26,7 +26,7 @@ is what is meant.</p> <p>If no version is specified, or if all versions are removed then the root package entry is removed from the registry entirely.</p> </div> -<p id="footer">unpublish — npm@1.1.24</p> +<p id="footer">unpublish — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/update.html b/deps/npm/html/api/update.html index 2c4b38d2f..57fbbff76 100644 --- a/deps/npm/html/api/update.html +++ b/deps/npm/html/api/update.html @@ -18,7 +18,7 @@ <p>The 'packages' argument is an array of packages to update. The 'callback' parameter will be called when done or when an error occurs.</p> </div> -<p id="footer">update — npm@1.1.24</p> +<p id="footer">update — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/version.html b/deps/npm/html/api/version.html index 77418120c..e0d51347e 100644 --- a/deps/npm/html/api/version.html +++ b/deps/npm/html/api/version.html @@ -24,7 +24,7 @@ fail if the repo is not clean.</p> parameter. The difference, however, is this function will fail if it does not have exactly one element. The only element should be a version number.</p> </div> -<p id="footer">version — npm@1.1.24</p> +<p id="footer">version — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/view.html b/deps/npm/html/api/view.html index 24a74ba97..2280dd3e1 100644 --- a/deps/npm/html/api/view.html +++ b/deps/npm/html/api/view.html @@ -99,7 +99,7 @@ the field name.</p> <p>corresponding to the list of fields selected.</p> </div> -<p id="footer">view — npm@1.1.24</p> +<p id="footer">view — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/whoami.html b/deps/npm/html/api/whoami.html index eca747c9a..ac813e28d 100644 --- a/deps/npm/html/api/whoami.html +++ b/deps/npm/html/api/whoami.html @@ -21,7 +21,7 @@ <p>This function is not useful programmatically</p> </div> -<p id="footer">whoami — npm@1.1.24</p> +<p id="footer">whoami — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/README.html b/deps/npm/html/doc/README.html index 7923b66bc..87b710121 100644 --- a/deps/npm/html/doc/README.html +++ b/deps/npm/html/doc/README.html @@ -267,7 +267,7 @@ will no doubt tell you to put the output in a gist or email.</p> <ul><li><a href="../doc/npm.html">npm(1)</a></li><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/help.html">help(1)</a></li><li><a href="../doc/index.html">index(1)</a></li></ul> </div> -<p id="footer"><a href="../doc/README.html">README</a> — npm@1.1.24</p> +<p id="footer"><a href="../doc/README.html">README</a> — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/adduser.html b/deps/npm/html/doc/adduser.html index cf2d48108..3e10674ea 100644 --- a/deps/npm/html/doc/adduser.html +++ b/deps/npm/html/doc/adduser.html @@ -39,7 +39,7 @@ authorize on a new machine.</p> <ul><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/owner.html">owner(1)</a></li><li><a href="../doc/whoami.html">whoami(1)</a></li></ul> </div> -<p id="footer">adduser — npm@1.1.24</p> +<p id="footer">adduser — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/bin.html b/deps/npm/html/doc/bin.html index c6252a668..bfcbf7107 100644 --- a/deps/npm/html/doc/bin.html +++ b/deps/npm/html/doc/bin.html @@ -20,7 +20,7 @@ <ul><li><a href="../doc/prefix.html">prefix(1)</a></li><li><a href="../doc/root.html">root(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/config.html">config(1)</a></li></ul> </div> -<p id="footer">bin — npm@1.1.24</p> +<p id="footer">bin — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/bugs.html b/deps/npm/html/doc/bugs.html index 0e0637b8b..477c7919a 100644 --- a/deps/npm/html/doc/bugs.html +++ b/deps/npm/html/doc/bugs.html @@ -36,7 +36,7 @@ config param.</p> <ul><li><a href="../doc/docs.html">docs(1)</a></li><li><a href="../doc/view.html">view(1)</a></li><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/json.html">json(1)</a></li></ul> </div> -<p id="footer">bugs — npm@1.1.24</p> +<p id="footer">bugs — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/build.html b/deps/npm/html/doc/build.html index 62e3f817e..9cee8842c 100644 --- a/deps/npm/html/doc/build.html +++ b/deps/npm/html/doc/build.html @@ -25,7 +25,7 @@ A folder containing a <code>package.json</code> file in its root.</li></ul> <ul><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/link.html">link(1)</a></li><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../doc/json.html">json(1)</a></li></ul> </div> -<p id="footer">build — npm@1.1.24</p> +<p id="footer">build — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/bundle.html b/deps/npm/html/doc/bundle.html index 2955a00eb..8d4a701bb 100644 --- a/deps/npm/html/doc/bundle.html +++ b/deps/npm/html/doc/bundle.html @@ -20,7 +20,7 @@ install packages into the local space.</p> <ul><li><a href="../doc/install.html">install(1)</a></li></ul> </div> -<p id="footer">bundle — npm@1.1.24</p> +<p id="footer">bundle — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/cache.html b/deps/npm/html/doc/cache.html index 49b6fe14b..13fc18c4c 100644 --- a/deps/npm/html/doc/cache.html +++ b/deps/npm/html/doc/cache.html @@ -66,7 +66,7 @@ they do not make an HTTP request to the registry.</p> <ul><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/pack.html">pack(1)</a></li></ul> </div> -<p id="footer">cache — npm@1.1.24</p> +<p id="footer">cache — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/changelog.html b/deps/npm/html/doc/changelog.html index fbe8536be..ffddf4645 100644 --- a/deps/npm/html/doc/changelog.html +++ b/deps/npm/html/doc/changelog.html @@ -65,7 +65,7 @@ <ul><li><a href="../doc/npm.html">npm(1)</a></li><li><a href="../doc/faq.html">faq(1)</a></li></ul> </div> -<p id="footer">changelog — npm@1.1.24</p> +<p id="footer">changelog — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/coding-style.html b/deps/npm/html/doc/coding-style.html index 78d55b5b2..2f5f091bc 100644 --- a/deps/npm/html/doc/coding-style.html +++ b/deps/npm/html/doc/coding-style.html @@ -133,29 +133,18 @@ Just send the error message back as the first argument to the callback.</p> <p>Always create a new Error object with your message. Don't just return a string message to the callback. Stack traces are handy.</p> -<p>Use the <code>require("./utils/log").er</code> function. It takes a callback and an -error message, and returns an object that will report the message in the -event of a failure. It's quite handy.</p> - -<pre><code>function myThing (args, cb) { - getData(args, function (er, data) { - if (er) return log.er(cb, "Couldn't get data")(er) - doSomethingElse(data, cb) - }) -} -function justHasToWork (cb) { - doSomething(log.er(cb, "the doSomething failed.")) -}</code></pre> - <h2 id="Logging">Logging</h2> +<p>Logging is done using the <a href="https://github.com/isaacs/npmlog">npmlog</a> +utility.</p> + <p>Please clean up logs when they are no longer helpful. In particular, logging the same object over and over again is not helpful. Logs should report what's happening so that it's easier to track down where a fault occurs.</p> -<p>Use appropriate log levels. The default log() function logs at the -"info" level. See <code><a href="../doc/config.html">config(1)</a></code> and search for "loglevel".</p> +<p>Use appropriate log levels. See <code><a href="../doc/config.html">config(1)</a></code> and search for +"loglevel".</p> <h2 id="Case-naming-etc">Case, naming, etc.</h2> @@ -191,7 +180,7 @@ set to anything."</p> <ul><li><a href="../doc/developers.html">developers(1)</a></li><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/npm.html">npm(1)</a></li></ul> </div> -<p id="footer">coding-style — npm@1.1.24</p> +<p id="footer">coding-style — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/completion.html b/deps/npm/html/doc/completion.html index 5b1c70b7e..6036c6618 100644 --- a/deps/npm/html/doc/completion.html +++ b/deps/npm/html/doc/completion.html @@ -33,7 +33,7 @@ completions based on the arguments.</p> <ul><li><a href="../doc/developers.html">developers(1)</a></li><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/npm.html">npm(1)</a></li></ul> </div> -<p id="footer">completion — npm@1.1.24</p> +<p id="footer">completion — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/config.html b/deps/npm/html/doc/config.html index bdfcc4158..43c680d90 100644 --- a/deps/npm/html/doc/config.html +++ b/deps/npm/html/doc/config.html @@ -381,12 +381,6 @@ if one of the two conditions are met:</p> <ul><li>The package is not already installed globally, or</li><li>the globally installed version is identical to the version that is being installed locally.</li></ul> -<h3 id="logfd">logfd</h3> - -<ul><li>Default: stderr file descriptor</li><li>Type: Number or Stream</li></ul> - -<p>The location to write log output.</p> - <h3 id="loglevel">loglevel</h3> <ul><li>Default: "http"</li><li>Type: String</li><li>Values: "silent", "win", "error", "warn", "http", "info", "verbose", "silly"</li></ul> @@ -397,13 +391,6 @@ being installed locally.</li></ul> <p>Any logs of a higher level than the setting are shown. The default is "http", which shows http, warn, and error output.</p> -<h3 id="logprefix">logprefix</h3> - -<ul><li>Default: true on Posix, false on Windows</li><li>Type: Boolean</li></ul> - -<p>Whether or not to prefix log messages with "npm" and the log level. See -also "color" and "loglevel".</p> - <h3 id="long">long</h3> <ul><li>Default: false</li><li>Type: Boolean</li></ul> @@ -444,12 +431,6 @@ also "color" and "loglevel".</p> <p>A node module to <code>require()</code> when npm loads. Useful for programmatic usage.</p> -<h3 id="outfd">outfd</h3> - -<ul><li>Default: standard output file descriptor</li><li>Type: Number or Stream</li></ul> - -<p>Where to write "normal" output. This has no effect on log output.</p> - <h3 id="parseable">parseable</h3> <ul><li>Default: false</li><li>Type: Boolean</li></ul> @@ -684,7 +665,7 @@ then answer "no" to any prompt.</p> <ul><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/npm.html">npm(1)</a></li></ul> </div> -<p id="footer">config — npm@1.1.24</p> +<p id="footer">config — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/deprecate.html b/deps/npm/html/doc/deprecate.html index 8130e0ae3..01230f454 100644 --- a/deps/npm/html/doc/deprecate.html +++ b/deps/npm/html/doc/deprecate.html @@ -29,7 +29,7 @@ something like this:</p> <ul><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li></ul> </div> -<p id="footer">deprecate — npm@1.1.24</p> +<p id="footer">deprecate — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/developers.html b/deps/npm/html/doc/developers.html index 4c8f47bdd..39cf2f12b 100644 --- a/deps/npm/html/doc/developers.html +++ b/deps/npm/html/doc/developers.html @@ -160,7 +160,7 @@ from a fresh checkout.</p> <ul><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/npm.html">npm(1)</a></li><li><a href="../doc/init.html">init(1)</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/adduser.html">adduser(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li></ul> </div> -<p id="footer">developers — npm@1.1.24</p> +<p id="footer">developers — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/disputes.html b/deps/npm/html/doc/disputes.html index 8755084af..213779d9b 100644 --- a/deps/npm/html/doc/disputes.html +++ b/deps/npm/html/doc/disputes.html @@ -80,7 +80,7 @@ license statement)</li><li>Illegal content.</li></ol> <ul><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/owner.html">owner(1)</a></li></ul> </div> -<p id="footer">disputes — npm@1.1.24</p> +<p id="footer">disputes — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/docs.html b/deps/npm/html/doc/docs.html index 617d7442e..57b002d48 100644 --- a/deps/npm/html/doc/docs.html +++ b/deps/npm/html/doc/docs.html @@ -37,7 +37,7 @@ config param.</p> <ul><li><a href="../doc/view.html">view(1)</a></li><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/json.html">json(1)</a></li></ul> </div> -<p id="footer">docs — npm@1.1.24</p> +<p id="footer">docs — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/edit.html b/deps/npm/html/doc/edit.html index bdc574ad0..ce4a5d759 100644 --- a/deps/npm/html/doc/edit.html +++ b/deps/npm/html/doc/edit.html @@ -37,7 +37,7 @@ or <code>"notepad"</code> on Windows.</li><li>Type: path</li></ul> <ul><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/explore.html">explore(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/config.html">config(1)</a></li></ul> </div> -<p id="footer">edit — npm@1.1.24</p> +<p id="footer">edit — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/explore.html b/deps/npm/html/doc/explore.html index 5bfd6d738..9cb6b283b 100644 --- a/deps/npm/html/doc/explore.html +++ b/deps/npm/html/doc/explore.html @@ -40,7 +40,7 @@ Windows</li><li>Type: path</li></ul> <ul><li><a href="../doc/submodule.html">submodule(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/edit.html">edit(1)</a></li><li><a href="../doc/rebuild.html">rebuild(1)</a></li><li><a href="../doc/build.html">build(1)</a></li><li><a href="../doc/install.html">install(1)</a></li></ul> </div> -<p id="footer">explore — npm@1.1.24</p> +<p id="footer">explore — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/faq.html b/deps/npm/html/doc/faq.html index cd84fe9ec..f1c9a608d 100644 --- a/deps/npm/html/doc/faq.html +++ b/deps/npm/html/doc/faq.html @@ -241,7 +241,7 @@ We'll have someone kick it or something.</p> <ul><li><a href="../doc/npm.html">npm(1)</a></li><li><a href="../doc/developers.html">developers(1)</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li></ul> </div> -<p id="footer">faq — npm@1.1.24</p> +<p id="footer">faq — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/folders.html b/deps/npm/html/doc/folders.html index 582305a55..14b9c6993 100644 --- a/deps/npm/html/doc/folders.html +++ b/deps/npm/html/doc/folders.html @@ -205,7 +205,7 @@ cannot be found elsewhere. See <code><a href="../doc/json.html">json(1)</a></co <ul><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/pack.html">pack(1)</a></li><li><a href="../doc/cache.html">cache(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/publish.html">publish(1)</a></li></ul> </div> -<p id="footer">folders — npm@1.1.24</p> +<p id="footer">folders — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/help-search.html b/deps/npm/html/doc/help-search.html index fd8537766..1fca39d25 100644 --- a/deps/npm/html/doc/help-search.html +++ b/deps/npm/html/doc/help-search.html @@ -38,7 +38,7 @@ where the terms were found in the documentation.</p> <ul><li><a href="../doc/npm.html">npm(1)</a></li><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/help.html">help(1)</a></li></ul> </div> -<p id="footer">help-search — npm@1.1.24</p> +<p id="footer">help-search — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/help.html b/deps/npm/html/doc/help.html index 476b458f5..2991e1b64 100644 --- a/deps/npm/html/doc/help.html +++ b/deps/npm/html/doc/help.html @@ -36,7 +36,7 @@ matches are equivalent to specifying a topic name.</p> <ul><li><a href="../doc/npm.html">npm(1)</a></li><li><a href="../doc/README.html">README</a></li><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/help-search.html">help-search(1)</a></li><li><a href="../doc/index.html">index(1)</a></li></ul> </div> -<p id="footer">help — npm@1.1.24</p> +<p id="footer">help — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/index.html b/deps/npm/html/doc/index.html index 84d6d3443..7aa0f11b1 100644 --- a/deps/npm/html/doc/index.html +++ b/deps/npm/html/doc/index.html @@ -384,7 +384,7 @@ <p> Display npm username</p> </div> -<p id="footer">index — npm@1.1.24</p> +<p id="footer">index — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/init.html b/deps/npm/html/doc/init.html index 4721aa507..4ff20f088 100644 --- a/deps/npm/html/doc/init.html +++ b/deps/npm/html/doc/init.html @@ -29,7 +29,7 @@ without a really good reason to do so.</p> <ul><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/version.html">version(1)</a></li></ul> </div> -<p id="footer">init — npm@1.1.24</p> +<p id="footer">init — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/install.html b/deps/npm/html/doc/install.html index 76c5e65d8..1f894038d 100644 --- a/deps/npm/html/doc/install.html +++ b/deps/npm/html/doc/install.html @@ -133,7 +133,7 @@ affects a real use-case, it will be investigated.</p> <ul><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/update.html">update(1)</a></li><li><a href="../doc/link.html">link(1)</a></li><li><a href="../doc/rebuild.html">rebuild(1)</a></li><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../doc/build.html">build(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/tag.html">tag(1)</a></li><li><a href="../doc/rm.html">rm(1)</a></li><li><a href="../doc/shrinkwrap.html">shrinkwrap(1)</a></li></ul> </div> -<p id="footer">install — npm@1.1.24</p> +<p id="footer">install — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/json.html b/deps/npm/html/doc/json.html index cc452d2d4..2e712e1fb 100644 --- a/deps/npm/html/doc/json.html +++ b/deps/npm/html/doc/json.html @@ -509,7 +509,7 @@ overridden.</p> <ul><li><a href="../doc/semver.html">semver(1)</a></li><li><a href="../doc/init.html">init(1)</a></li><li><a href="../doc/version.html">version(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/help.html">help(1)</a></li><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/rm.html">rm(1)</a></li></ul> </div> -<p id="footer">json — npm@1.1.24</p> +<p id="footer">json — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/link.html b/deps/npm/html/doc/link.html index 8d97ac934..30e3ad7da 100644 --- a/deps/npm/html/doc/link.html +++ b/deps/npm/html/doc/link.html @@ -58,7 +58,7 @@ installation target into your project's <code>node_modules</code> folder.</p> <ul><li><a href="../doc/developers.html">developers(1)</a></li><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/config.html">config(1)</a></li></ul> </div> -<p id="footer">link — npm@1.1.24</p> +<p id="footer">link — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/list.html b/deps/npm/html/doc/list.html index 42ce8e29e..6376e0d3a 100644 --- a/deps/npm/html/doc/list.html +++ b/deps/npm/html/doc/list.html @@ -58,7 +58,7 @@ project.</p> <ul><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/link.html">link(1)</a></li><li><a href="../doc/prune.html">prune(1)</a></li><li><a href="../doc/outdated.html">outdated(1)</a></li><li><a href="../doc/update.html">update(1)</a></li></ul> </div> -<p id="footer">list — npm@1.1.24</p> +<p id="footer">list — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/npm.html b/deps/npm/html/doc/npm.html index 0d5a06942..12b1d037a 100644 --- a/deps/npm/html/doc/npm.html +++ b/deps/npm/html/doc/npm.html @@ -14,7 +14,7 @@ <h2 id="VERSION">VERSION</h2> -<p>1.1.24</p> +<p>1.1.25</p> <h2 id="DESCRIPTION">DESCRIPTION</h2> @@ -135,7 +135,7 @@ will no doubt tell you to put the output in a gist or email.</p> <ul><li><a href="../doc/help.html">help(1)</a></li><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/README.html">README</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/index.html">index(1)</a></li><li><a href="../api/npm.html">npm(3)</a></li></ul> </div> -<p id="footer">npm — npm@1.1.24</p> +<p id="footer">npm — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/outdated.html b/deps/npm/html/doc/outdated.html index 4d96f4b2a..7b5cf26d3 100644 --- a/deps/npm/html/doc/outdated.html +++ b/deps/npm/html/doc/outdated.html @@ -21,7 +21,7 @@ packages are currently outdated.</p> <ul><li><a href="../doc/update.html">update(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li></ul> </div> -<p id="footer">outdated — npm@1.1.24</p> +<p id="footer">outdated — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/owner.html b/deps/npm/html/doc/owner.html index d45964d48..65766a99a 100644 --- a/deps/npm/html/doc/owner.html +++ b/deps/npm/html/doc/owner.html @@ -34,7 +34,7 @@ that is not implemented at this time.</p> <ul><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/adduser.html">adduser(1)</a></li><li><a href="../doc/disputes.html">disputes(1)</a></li></ul> </div> -<p id="footer">owner — npm@1.1.24</p> +<p id="footer">owner — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/pack.html b/deps/npm/html/doc/pack.html index 23a6a7028..be1c3d5c9 100644 --- a/deps/npm/html/doc/pack.html +++ b/deps/npm/html/doc/pack.html @@ -29,7 +29,7 @@ overwritten the second time.</p> <ul><li><a href="../doc/cache.html">cache(1)</a></li><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/config.html">config(1)</a></li></ul> </div> -<p id="footer">pack — npm@1.1.24</p> +<p id="footer">pack — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/prefix.html b/deps/npm/html/doc/prefix.html index a90db1e54..57a7ccb56 100644 --- a/deps/npm/html/doc/prefix.html +++ b/deps/npm/html/doc/prefix.html @@ -20,7 +20,7 @@ <ul><li><a href="../doc/root.html">root(1)</a></li><li><a href="../doc/bin.html">bin(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/config.html">config(1)</a></li></ul> </div> -<p id="footer">prefix — npm@1.1.24</p> +<p id="footer">prefix — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/prune.html b/deps/npm/html/doc/prune.html index 618bba394..2100a8846 100644 --- a/deps/npm/html/doc/prune.html +++ b/deps/npm/html/doc/prune.html @@ -25,7 +25,7 @@ package's dependencies list.</p> <ul><li><a href="../doc/rm.html">rm(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/list.html">list(1)</a></li></ul> </div> -<p id="footer">prune — npm@1.1.24</p> +<p id="footer">prune — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/publish.html b/deps/npm/html/doc/publish.html index b36695868..974d8e48f 100644 --- a/deps/npm/html/doc/publish.html +++ b/deps/npm/html/doc/publish.html @@ -29,7 +29,7 @@ the registry. Overwrites when the "--force" flag is set.</p> <ul><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/adduser.html">adduser(1)</a></li><li><a href="../doc/owner.html">owner(1)</a></li><li><a href="../doc/deprecate.html">deprecate(1)</a></li><li><a href="../doc/tag.html">tag(1)</a></li></ul> </div> -<p id="footer">publish — npm@1.1.24</p> +<p id="footer">publish — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/rebuild.html b/deps/npm/html/doc/rebuild.html index 77f0ced0b..dcd6a710d 100644 --- a/deps/npm/html/doc/rebuild.html +++ b/deps/npm/html/doc/rebuild.html @@ -25,7 +25,7 @@ the new binary.</p> <ul><li><a href="../doc/build.html">build(1)</a></li><li><a href="../doc/install.html">install(1)</a></li></ul> </div> -<p id="footer">rebuild — npm@1.1.24</p> +<p id="footer">rebuild — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/registry.html b/deps/npm/html/doc/registry.html index 2a4ec5783..bb5726287 100644 --- a/deps/npm/html/doc/registry.html +++ b/deps/npm/html/doc/registry.html @@ -97,7 +97,7 @@ ask for help on the <a href="mailto:npm-@googlegroups.com">npm-@googlegroups.com <ul><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/developers.html">developers(1)</a></li><li><a href="../doc/disputes.html">disputes(1)</a></li></ul> </div> -<p id="footer">registry — npm@1.1.24</p> +<p id="footer">registry — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/removing-npm.html b/deps/npm/html/doc/removing-npm.html index 983d427b6..6da3d3b0e 100644 --- a/deps/npm/html/doc/removing-npm.html +++ b/deps/npm/html/doc/removing-npm.html @@ -58,7 +58,7 @@ modules. To track those down, you can do the following:</p> <ul><li><a href="../doc/README.html">README</a></li><li><a href="../doc/rm.html">rm(1)</a></li><li><a href="../doc/prune.html">prune(1)</a></li></ul> </div> -<p id="footer">removing-npm — npm@1.1.24</p> +<p id="footer">removing-npm — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/restart.html b/deps/npm/html/doc/restart.html index 965e38f7e..595f10b93 100644 --- a/deps/npm/html/doc/restart.html +++ b/deps/npm/html/doc/restart.html @@ -24,7 +24,7 @@ the "start" script.</p> <ul><li><a href="../doc/run-script.html">run-script(1)</a></li><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../doc/test.html">test(1)</a></li><li><a href="../doc/start.html">start(1)</a></li><li><a href="../doc/stop.html">stop(1)</a></li></ul> </div> -<p id="footer">restart — npm@1.1.24</p> +<p id="footer">restart — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/root.html b/deps/npm/html/doc/root.html index bdb274d22..b78f7cf2e 100644 --- a/deps/npm/html/doc/root.html +++ b/deps/npm/html/doc/root.html @@ -20,7 +20,7 @@ <ul><li><a href="../doc/prefix.html">prefix(1)</a></li><li><a href="../doc/bin.html">bin(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/config.html">config(1)</a></li></ul> </div> -<p id="footer">root — npm@1.1.24</p> +<p id="footer">root — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/run-script.html b/deps/npm/html/doc/run-script.html index 36bd064a3..9e93c0688 100644 --- a/deps/npm/html/doc/run-script.html +++ b/deps/npm/html/doc/run-script.html @@ -23,7 +23,7 @@ called directly, as well.</p> <ul><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../doc/test.html">test(1)</a></li><li><a href="../doc/start.html">start(1)</a></li><li><a href="../doc/restart.html">restart(1)</a></li><li><a href="../doc/stop.html">stop(1)</a></li></ul> </div> -<p id="footer">run-script — npm@1.1.24</p> +<p id="footer">run-script — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/scripts.html b/deps/npm/html/doc/scripts.html index 549b1e66c..c8b0b5bbb 100644 --- a/deps/npm/html/doc/scripts.html +++ b/deps/npm/html/doc/scripts.html @@ -177,7 +177,7 @@ will sudo the npm command in question.</li></ul> <ul><li><a href="../doc/run-script.html">run-script(1)</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/developers.html">developers(1)</a></li><li><a href="../doc/install.html">install(1)</a></li></ul> </div> -<p id="footer">scripts — npm@1.1.24</p> +<p id="footer">scripts — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/search.html b/deps/npm/html/doc/search.html index 956a95bfe..bf8d54a7a 100644 --- a/deps/npm/html/doc/search.html +++ b/deps/npm/html/doc/search.html @@ -24,7 +24,7 @@ expression characters must be escaped or quoted in most shells.)</p> <ul><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/view.html">view(1)</a></li></ul> </div> -<p id="footer">search — npm@1.1.24</p> +<p id="footer">search — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/semver.html b/deps/npm/html/doc/semver.html index cefa7bbed..f4a6ab2c6 100644 --- a/deps/npm/html/doc/semver.html +++ b/deps/npm/html/doc/semver.html @@ -104,7 +104,7 @@ that satisfies the range, or null if none of them do.</li></ul> <ul><li><a href="../doc/json.html">json(1)</a></li></ul> </div> -<p id="footer">semver — npm@1.1.24</p> +<p id="footer">semver — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/shrinkwrap.html b/deps/npm/html/doc/shrinkwrap.html index e0d115e14..9e2f9b44c 100644 --- a/deps/npm/html/doc/shrinkwrap.html +++ b/deps/npm/html/doc/shrinkwrap.html @@ -169,7 +169,7 @@ versions.</p> <ul><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/list.html">list(1)</a></li></ul> </div> -<p id="footer">shrinkwrap — npm@1.1.24</p> +<p id="footer">shrinkwrap — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/star.html b/deps/npm/html/doc/star.html index e303611e8..e259d2c2f 100644 --- a/deps/npm/html/doc/star.html +++ b/deps/npm/html/doc/star.html @@ -26,7 +26,7 @@ a vaguely positive way to show that you care.</p> <ul><li><a href="../doc/view.html">view(1)</a></li><li><a href="../doc/whoami.html">whoami(1)</a></li><li><a href="../doc/adduser.html">adduser(1)</a></li></ul> </div> -<p id="footer">star — npm@1.1.24</p> +<p id="footer">star — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/start.html b/deps/npm/html/doc/start.html index ffa11b75d..b8403fd76 100644 --- a/deps/npm/html/doc/start.html +++ b/deps/npm/html/doc/start.html @@ -20,7 +20,7 @@ <ul><li><a href="../doc/run-script.html">run-script(1)</a></li><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../doc/test.html">test(1)</a></li><li><a href="../doc/restart.html">restart(1)</a></li><li><a href="../doc/stop.html">stop(1)</a></li></ul> </div> -<p id="footer">start — npm@1.1.24</p> +<p id="footer">start — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/stop.html b/deps/npm/html/doc/stop.html index 2d3d7a6e4..aa3ff0306 100644 --- a/deps/npm/html/doc/stop.html +++ b/deps/npm/html/doc/stop.html @@ -20,7 +20,7 @@ <ul><li><a href="../doc/run-script.html">run-script(1)</a></li><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../doc/test.html">test(1)</a></li><li><a href="../doc/start.html">start(1)</a></li><li><a href="../doc/restart.html">restart(1)</a></li></ul> </div> -<p id="footer">stop — npm@1.1.24</p> +<p id="footer">stop — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/submodule.html b/deps/npm/html/doc/submodule.html index a366345cf..0867ff890 100644 --- a/deps/npm/html/doc/submodule.html +++ b/deps/npm/html/doc/submodule.html @@ -33,7 +33,7 @@ dependencies into the submodule folder.</p> <ul><li><a href="../doc/json.html">json(1)</a></li><li>git help submodule</li></ul> </div> -<p id="footer">submodule — npm@1.1.24</p> +<p id="footer">submodule — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/tag.html b/deps/npm/html/doc/tag.html index e235733d0..e5abdce7b 100644 --- a/deps/npm/html/doc/tag.html +++ b/deps/npm/html/doc/tag.html @@ -21,7 +21,7 @@ <ul><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/config.html">config(1)</a></li></ul> </div> -<p id="footer">tag — npm@1.1.24</p> +<p id="footer">tag — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/test.html b/deps/npm/html/doc/test.html index 0e4b27379..4d5ce46f2 100644 --- a/deps/npm/html/doc/test.html +++ b/deps/npm/html/doc/test.html @@ -23,7 +23,7 @@ true.</p> <ul><li><a href="../doc/run-script.html">run-script(1)</a></li><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../doc/start.html">start(1)</a></li><li><a href="../doc/restart.html">restart(1)</a></li><li><a href="../doc/stop.html">stop(1)</a></li></ul> </div> -<p id="footer">test — npm@1.1.24</p> +<p id="footer">test — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/uninstall.html b/deps/npm/html/doc/uninstall.html index 3b588d2b5..b003d7c50 100644 --- a/deps/npm/html/doc/uninstall.html +++ b/deps/npm/html/doc/uninstall.html @@ -22,7 +22,7 @@ on its behalf.</p> <ul><li><a href="../doc/prune.html">prune(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/config.html">config(1)</a></li></ul> </div> -<p id="footer">uninstall — npm@1.1.24</p> +<p id="footer">uninstall — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/unpublish.html b/deps/npm/html/doc/unpublish.html index abb8b767e..d9d28c6a3 100644 --- a/deps/npm/html/doc/unpublish.html +++ b/deps/npm/html/doc/unpublish.html @@ -34,7 +34,7 @@ the root package entry is removed from the registry entirely.</p> <ul><li><a href="../doc/deprecate.html">deprecate(1)</a></li><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/adduser.html">adduser(1)</a></li><li><a href="../doc/owner.html">owner(1)</a></li></ul> </div> -<p id="footer">unpublish — npm@1.1.24</p> +<p id="footer">unpublish — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/update.html b/deps/npm/html/doc/update.html index aa4ba7212..61edb2140 100644 --- a/deps/npm/html/doc/update.html +++ b/deps/npm/html/doc/update.html @@ -23,7 +23,7 @@ <ul><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/outdated.html">outdated(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/list.html">list(1)</a></li></ul> </div> -<p id="footer">update — npm@1.1.24</p> +<p id="footer">update — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/version.html b/deps/npm/html/doc/version.html index 040cdcfb2..dc0ade866 100644 --- a/deps/npm/html/doc/version.html +++ b/deps/npm/html/doc/version.html @@ -31,7 +31,7 @@ will use it as a commit message when creating a version commit.</p> <ul><li><a href="../doc/init.html">init(1)</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/semver.html">semver(1)</a></li></ul> </div> -<p id="footer">version — npm@1.1.24</p> +<p id="footer">version — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/view.html b/deps/npm/html/doc/view.html index 75a6f8ff6..4f89345ab 100644 --- a/deps/npm/html/doc/view.html +++ b/deps/npm/html/doc/view.html @@ -88,7 +88,7 @@ the field name.</p> <ul><li><a href="../doc/search.html">search(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/docs.html">docs(1)</a></li></ul> </div> -<p id="footer">view — npm@1.1.24</p> +<p id="footer">view — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/whoami.html b/deps/npm/html/doc/whoami.html index 5d42516ad..c3ce70c11 100644 --- a/deps/npm/html/doc/whoami.html +++ b/deps/npm/html/doc/whoami.html @@ -20,7 +20,7 @@ <ul><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/adduser.html">adduser(1)</a></li></ul> </div> -<p id="footer">whoami — npm@1.1.24</p> +<p id="footer">whoami — npm@1.1.25</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/style.css b/deps/npm/html/style.css index c5b071be7..e63b74519 100644 --- a/deps/npm/html/style.css +++ b/deps/npm/html/style.css @@ -1,21 +1,14 @@ -/* @license - * MyFonts Webfont Build ID 2303021, 2012-06-04T14:43:21-0400 - * - * The fonts listed in this notice are subject to the End User License - * Agreement(s) entered into by the website owner. All other parties are - * explicitly restricted from using the Licensed Webfonts(s). - * - * You may obtain a valid license at the URLs below. - * - * Webfont: Gubblebum Blocky by Jelloween - * URL: http://www.myfonts.com/fonts/jelloween/gubblebum/blocky/ - * Licensed pageviews: unspecified - * - * - * License: http://www.myfonts.com/viewlicense?type=web&buildid=2303021 - * Webfonts copyright: Copyright (c) 2007 by Tjarda Koster. All rights reserved. - * - * © 2012 Bitstream Inc +/* + +Webfont: Gubblebum Blocky by Jelloween +License: http://www.myfonts.com/viewlicense?type=web&buildid=2303021 +Webfonts copyright: Copyright (c) 2007 by Tjarda Koster. All rights reserved. + +"Gubblebum Blocky" font +Copyright (c) 2007 by Tjarda Koster, http://jelloween.deviantart.com +included for use in the npm website and documentation, +used with permission. + */ @font-face { diff --git a/deps/npm/lib/adduser.js b/deps/npm/lib/adduser.js index d65eed595..f0fc8d10e 100644 --- a/deps/npm/lib/adduser.js +++ b/deps/npm/lib/adduser.js @@ -1,10 +1,10 @@ module.exports = adduser -var registry = require("./utils/npm-registry-client/index.js") - , ini = require("./utils/ini.js") - , log = require("./utils/log.js") +var ini = require("./utils/ini.js") + , log = require("npmlog") , npm = require("./npm.js") + , registry = npm.registry , read = require("read") , promiseChain = require("./utils/promise-chain.js") , crypto @@ -39,10 +39,13 @@ function adduser (args, cb) { if (changed) npm.config.del("_auth") registry.adduser(u.u, u.p, u.e, function (er) { if (er) return cb(er) + registry.username = u.u + registry.password = u.p + registry.email = u.e ini.set("username", u.u, "user") ini.set("_password", u.p, "user") ini.set("email", u.e, "user") - log("Authorized user " + u.u, "adduser") + log.info("adduser", "Authorized user %s", u.u) ini.save("user", cb) }) }) diff --git a/deps/npm/lib/bugs.js b/deps/npm/lib/bugs.js index 2a9352632..3f9de1231 100644 --- a/deps/npm/lib/bugs.js +++ b/deps/npm/lib/bugs.js @@ -3,22 +3,22 @@ module.exports = bugs bugs.usage = "npm bugs <pkgname>" +var exec = require("./utils/exec.js") + , npm = require("./npm.js") + , registry = npm.registry + , log = require("npmlog") + bugs.completion = function (opts, cb) { if (opts.conf.argv.remain.length > 2) return cb() - registry.get("/-/short", null, 60000, function (er, list) { + registry.get("/-/short", 60000, function (er, list) { return cb(null, list || []) }) } -var exec = require("./utils/exec.js") - , registry = require("./utils/npm-registry-client/index.js") - , npm = require("./npm.js") - , log = require("./utils/log.js") - function bugs (args, cb) { if (!args.length) return cb(bugs.usage) var n = args[0].split("@").shift() - registry.get(n, "latest", 3600, function (er, d) { + registry.get(n + "/latest", 3600, function (er, d) { if (er) return cb(er) var bugs = d.bugs , repo = d.repository || d.repositories @@ -29,7 +29,7 @@ function bugs (args, cb) { if (repo) { if (Array.isArray(repo)) repo = repo.shift() if (repo.hasOwnProperty("url")) repo = repo.url - log.verbose(repo, "repository") + log.verbose("repository", repo) if (repo && repo.match(/^(https?:\/\/|git(:\/\/|@))github.com/)) { return open(repo.replace(/^git(@|:\/\/)/, "http://") .replace(/^https?:\/\/github.com:/, "github.com/") diff --git a/deps/npm/lib/build.js b/deps/npm/lib/build.js index 864eb27cf..c0dcbf7fb 100644 --- a/deps/npm/lib/build.js +++ b/deps/npm/lib/build.js @@ -9,7 +9,7 @@ // This runs AFTER install or link are completed. var npm = require("./npm.js") - , log = require("./utils/log.js") + , log = require("npmlog") , chain = require("slide").chain , fs = require("graceful-fs") , path = require("path") @@ -44,7 +44,7 @@ function build (args, global, didPre, didRB, cb) { function build_ (global, didPre, didRB) { return function (folder, cb) { folder = path.resolve(folder) build._didBuild[folder] = true - log.info(folder, "build") + log.info("build", folder) readJson(path.resolve(folder, "package.json"), function (er, pkg) { if (er) return cb(er) chain @@ -76,17 +76,17 @@ function linkStuff (pkg, folder, global, didRB, cb) { , top = parent === npm.dir , gtop = parent === gnm - log.verbose([global, gnm, gtop, parent], "linkStuff") - log(pkg._id, "linkStuff") + log.verbose("linkStuff", [global, gnm, gtop, parent]) + log.info("linkStuff", pkg._id) if (top && pkg.preferGlobal && !global) { - log.warn(pkg._id + " should be installed with -g", "prefer global") + log.warn("prefer global", pkg._id + " should be installed with -g") } asyncMap( [linkBins, linkMans, !didRB && rebuildBundles] , function (fn, cb) { if (!fn) return cb() - log.verbose(pkg._id, fn.name) + log.verbose(fn.name, pkg._id) fn(pkg, folder, parent, gtop, cb) }, cb) } @@ -102,7 +102,7 @@ function rebuildBundles (pkg, folder, parent, gtop, cb) { // error means no bundles if (er) return cb() - log.verbose(files, "rebuildBundles") + log.verbose("rebuildBundles", files) // don't asyncMap these, because otherwise build script output // gets interleaved and is impossible to read chain(files.filter(function (file) { @@ -117,7 +117,7 @@ function rebuildBundles (pkg, folder, parent, gtop, cb) { file = path.resolve(folder, "node_modules", file) return function (cb) { if (build._didBuild[file]) return cb() - log.verbose(file, "rebuild bundle") + log.verbose("rebuild bundle", file) // if file is not a package dir, then don't do it. fs.lstat(path.resolve(file, "package.json"), function (er, st) { if (er) return cb() @@ -133,7 +133,7 @@ function linkBins (pkg, folder, parent, gtop, cb) { } var binRoot = gtop ? npm.globalBin : path.resolve(parent, ".bin") - log.verbose([pkg.bin, binRoot, gtop], "bins linking") + log.verbose("link bins", [pkg.bin, binRoot, gtop]) asyncMap(Object.keys(pkg.bin), function (b, cb) { linkBin( path.resolve(folder, pkg.bin[b]) diff --git a/deps/npm/lib/cache.js b/deps/npm/lib/cache.js index 076267e89..e2e037ebe 100644 --- a/deps/npm/lib/cache.js +++ b/deps/npm/lib/cache.js @@ -13,7 +13,7 @@ Adding a url: 2. goto folder(2) adding a name@version: -1. registry.get(name, version) +1. registry.get(name/version) 2. if response isn't 304, add url(dist.tarball) adding a name@range: @@ -38,8 +38,8 @@ var mkdir = require("mkdirp") , fs = require("graceful-fs") , rm = require("rimraf") , readJson = require("./utils/read-json.js") - , registry = require("./utils/npm-registry-client/index.js") - , log = require("./utils/log.js") + , registry = npm.registry + , log = require("npmlog") , path = require("path") , output , sha = require("./utils/sha.js") @@ -104,7 +104,7 @@ function read (name, ver, forceBypass, cb) { } if (forceBypass && npm.config.get("force")) { - log.verbose(true, "force found, skipping cache") + log.verbose("using force", "skipping cache") return addNamed(name, ver, c) } @@ -171,7 +171,7 @@ exports.add = function (pkg, ver, scrub, cb) { add([pkg, ver], cb) }) } - log.verbose([pkg, ver], "cache add") + log.verbose("cache add", [pkg, ver]) return add([pkg, ver], cb) } @@ -204,14 +204,15 @@ function add (args, cb) { spec = args[0] } - log.silly([name, spec, args], "cache add: name, spec, args") + log.silly("cache add", "name=%j spec=%j args=%j", name, spec, args) + if (!name && !spec) return cb(usage) // see if the spec is a url // otherwise, treat as name@version var p = url.parse(spec) || {} - log.verbose(p, "parsed url") + log.verbose("parsed url", p) // it could be that we got name@http://blah // in that case, we will not have a protocol now, but if we @@ -260,12 +261,15 @@ function addRemoteTarball (u, shasum, name, cb_) { delete inFlightURLs[u] } - log.verbose([u, shasum], "addRemoteTarball") + log.verbose("addRemoteTarball", [u, shasum]) var tmp = path.join(npm.tmp, Date.now()+"-"+Math.random(), "tmp.tgz") mkdir(path.dirname(tmp), function (er) { if (er) return cb(er) fetch(u, tmp, function (er) { - if (er) return log.er(cb, "failed to fetch "+u)(er) + if (er) { + log.error("fetch failed", u) + return cb(er) + } if (!shasum) return done() // validate that the url we just downloaded matches the expected shasum. sha.check(tmp, shasum, done) @@ -309,7 +313,7 @@ function addRemoteGit (u, parsed, name, cb_) { u = u.replace(/^ssh:\/\//, "") } - log.verbose([u, co], "addRemoteGit") + log.verbose("addRemoteGit", [u, co]) var tmp = path.join(npm.tmp, Date.now()+"-"+Math.random()) mkdir(path.dirname(tmp), function (er) { @@ -318,18 +322,18 @@ function addRemoteGit (u, parsed, name, cb_) { , function (er, code, stdout, stderr) { stdout = (stdout + "\n" + stderr).trim() if (er) { - log.error(stdout, "git clone "+u) + log.error("git clone " + u, stdout) return cb(er) } - log.verbose(stdout, "git clone "+u) + log.verbose("git clone "+u, stdout) exec( npm.config.get("git"), ["checkout", co], null, false, tmp , function (er, code, stdout, stderr) { stdout = (stdout + "\n" + stderr).trim() if (er) { - log.error(stdout, "git checkout "+co) + log.error("git checkout " + co, stdout) return cb(er) } - log.verbose(stdout, "git checkout "+co) + log.verbose("git checkout " + co, stdout) addLocalDirectory(tmp, cb) }) }) @@ -341,7 +345,7 @@ function addRemoteGit (u, parsed, name, cb_) { // name@blah thing. var inFlightNames = {} function addNamed (name, x, cb_) { - log.verbose([name, x], "addNamed") + log.verbose("addNamed", [name, x]) var k = name + "@" + x if (!inFlightNames[k]) inFlightNames[k] = [] var iF = inFlightNames[k] @@ -354,7 +358,7 @@ function addNamed (name, x, cb_) { delete inFlightNames[k] } - log.verbose([semver.valid(x), semver.validRange(x)], "addNamed") + log.verbose("addNamed", [semver.valid(x), semver.validRange(x)]) return ( null !== semver.valid(x) ? addNameVersion : null !== semver.validRange(x) ? addNameRange : addNameTag @@ -362,7 +366,7 @@ function addNamed (name, x, cb_) { } function addNameTag (name, tag, cb) { - log([name, tag], "addNameTag") + log.info("addNameTag", [name, tag]) var explicit = true if (!tag) { explicit = false @@ -407,7 +411,7 @@ function addNameRange (name, range, data, cb) { if (range === null) return cb(new Error( "Invalid version range: "+range)) - log.silly([name, range, !!data], "name, range, hasData") + log.silly("addNameRange", {name:name, range:range, hasData:!!data}) if (data) return next() registry.get(name, function (er, d, json, response) { @@ -417,7 +421,8 @@ function addNameRange (name, range, data, cb) { }) function next () { - log.silly([name, range, !!data], "name, range, hasData 2") + log.silly( "addNameRange", "number 2" + , {name:name, range:range, hasData:!!data}) engineFilter(data) if (npm.config.get("registry")) return next_() @@ -433,7 +438,9 @@ function addNameRange (name, range, data, cb) { } function next_ () { - log.silly([data.name, Object.keys(data.versions)], "versions") + log.silly("addNameRange", "versions" + , [data.name, Object.keys(data.versions)]) + // if the tagged version satisfies, then use that. var tagged = data["dist-tags"][npm.config.get("tag")] if (tagged && data.versions[tagged] && semver.satisfies(tagged, range)) { @@ -454,9 +461,12 @@ function addNameRange (name, range, data, cb) { // filter the versions down based on what's already in cache. function cachedFilter (data, range, cb) { - log.silly(data.name, "cachedFilter") + log.silly("cachedFilter", data.name) ls_(data.name, 1, function (er, files) { - if (er) return log.er(cb, "Not in cache, can't fetch: "+data.name)(er) + if (er) { + log.error("cachedFilter", "Not in cache, can't fetch", data.name) + return cb(er) + } files = files.map(function (f) { return path.basename(f.replace(/(\\|\/)$/, "")) }).filter(function (f) { @@ -467,16 +477,17 @@ function cachedFilter (data, range, cb) { return cb(new Error("Not in cache, can't fetch: "+data.name+"@"+range)) } - log.silly([data.name, files], "cached") + log.silly("cached", [data.name, files]) Object.keys(data.versions).forEach(function (v) { if (files.indexOf(v) === -1) delete data.versions[v] }) if (Object.keys(data.versions).length === 0) { - return log.er(cb, "Not in cache, can't fetch: "+data.name)(er) + log.error("cachedFilter", "Not in cache, can't fetch", data.name) + return cb(new Error("Not in cache, can't fetch: "+data.name+"@"+range)) } - log.silly([data.name, Object.keys(data.versions)], "filtered") + log.silly("filtered", [data.name, Object.keys(data.versions)]) cb(null, data) }) } @@ -509,7 +520,7 @@ function addNameVersion (name, ver, data, cb) { response = null return next() } - registry.get(name, ver, function (er, d, json, resp) { + registry.get(name + "/" + ver, function (er, d, json, resp) { if (er) return cb(er) data = d response = resp @@ -524,10 +535,10 @@ function addNameVersion (name, ver, data, cb) { var bd = npm.config.get("bindist") , b = dist.bin && bd && dist.bin[bd] - log.verbose([bd, dist], "bin dist") + log.verbose("bin dist", [bd, dist]) if (b && b.tarball && b.shasum) { - log.info(data._id, "prebuilt") - log.verbose(b, "prebuilt "+data._id) + log.info("prebuilt", data._id) + log.verbose("prebuilt", data._id, b) dist = b } @@ -579,7 +590,8 @@ function addLocal (p, name, cb_) { && (process.platform !== "win32" || p.indexOf("\\") === -1)) { return addNamed(p, "", cb_) } - return log.er(cb_, "Could not install: "+p)(er) + log.error("addLocal", "Could not install %s", p) + return cb_(er) } return cb_(er, data) } @@ -620,7 +632,7 @@ function addLocalTarball (p, name, cb) { to.on("error", errHandler) to.on("close", function () { if (errState) return - log.verbose(npm.modes.file.toString(8), "chmod "+tmp) + log.verbose("chmod", tmp, npm.modes.file.toString(8)) fs.chmod(tmp, npm.modes.file, function (er) { if (er) return cb(er) addTmpTarball(tmp, name, cb) @@ -637,7 +649,8 @@ function getCacheStat (cb) { fs.stat(npm.cache, function (er, st) { if (er) return makeCacheDir(cb) if (!st.isDirectory()) { - return log.er(cb, "invalid cache directory: "+npm.cache)(er) + log.error("getCacheStat", "invalid cache dir %j", npm.cache) + return cb(er) } return cb(null, cacheStat = st) }) @@ -659,9 +672,12 @@ function makeCacheDir (cb) { } fs.stat(process.env.HOME, function (er, st) { - if (er) return log.er(cb, "homeless?")(er) + if (er) { + log.error("makeCacheDir", "homeless?") + return cb(er) + } cacheStat = st - log.silly([st.uid, st.gid], "uid, gid for cache dir") + log.silly("makeCacheDir", "cache dir uid, gid", [st.uid, st.gid]) return mkdir(npm.cache, afterMkdir) }) @@ -698,33 +714,46 @@ function addPlacedTarball_ (p, name, uid, gid, cb) { , folder = path.join(target, "package") rm(folder, function (er) { - if (er) return log.er(cb, "Could not remove "+folder)(er) + if (er) { + log.error("addPlacedTarball", "Could not remove %j", folder) + return cb(er) + } tar.unpack(p, folder, null, null, uid, gid, function (er) { - if (er) return log.er(cb, "Could not unpack "+p+" to "+target)(er) + if (er) { + log.error("addPlacedTarball", "Could not unpack %j to %j", p, target) + return cb(er) + } // calculate the sha of the file that we just unpacked. // this is so that the data is available when publishing. sha.get(p, function (er, shasum) { - if (er) return log.er(cb, "couldn't validate shasum of "+p)(er) + if (er) { + log.error("addPlacedTarball", "shasum fail", p) + return cb(er) + } readJson(path.join(folder, "package.json"), function (er, data) { - if (er) return log.er(cb, "couldn't read json in "+folder)(er) + if (er) { + log.error("addPlacedTarball", "Couldn't read json in %j" + , folder) + return cb(er) + } data.dist = data.dist || {} if (shasum) data.dist.shasum = shasum deprCheck(data) asyncMap([p], function (f, cb) { - log.verbose(npm.modes.file.toString(8), "chmod "+f) + log.verbose("chmod", f, npm.modes.file.toString(8)) fs.chmod(f, npm.modes.file, cb) }, function (f, cb) { if (process.platform === "win32") { - log.silly(f, "skipping chown for windows") + log.silly("chown", "skipping for windows", f) cb() } else if (typeof uid === "number" && typeof gid === "number" && parseInt(uid, 10) === uid && parseInt(gid, 10) === gid) { - log.verbose([f, uid, gid], "chown") + log.verbose("chown", f, [uid, gid]) fs.chown(f, uid, gid, cb) } else { - log.verbose([f, uid, gid], "not chowning, invalid uid/gid") + log.verbose("chown", "skip for invalid uid/gid", [f, uid, gid]) cb() } }, function (er) { @@ -758,9 +787,15 @@ function addLocalDirectory (p, name, cb) { mkdir(path.dirname(tgz), function (er, made) { if (er) return cb(er) tar.pack(tgz, p, data, doFancyCrap, function (er) { - if (er) return log.er(cb,"couldn't pack "+p+ " to "+tgz)(er) + if (er) { + log.error( "addLocalDirectory", "Could not pack %j to %j" + , p, tgz ) + return cb(er) + } - if (er || !cs || isNaN(cs.uid) || isNaN(cs.gid)) return cb() + // if we don't get a cache stat, or if the gid/uid is not + // a number, then just move on. chown would fail anyway. + if (!cs || isNaN(cs.uid) || isNaN(cs.gid)) return cb() chownr(made || tgz, cs.uid, cs.gid, function (er) { if (er) return cb(er) @@ -797,7 +832,7 @@ function unpack (pkg, ver, unpackTarget, dMode, fMode, uid, gid, cb) { read(pkg, ver, false, function (er, data) { if (er) { - log.error("Could not read data for "+pkg+"@"+ver) + log.error("unpack", "Could not read data for %s", pkg + "@" + ver) return cb(er) } npm.commands.unbuild([unpackTarget], function (er) { @@ -819,6 +854,6 @@ function deprCheck (data) { else return if (!deprWarned[data._id]) { deprWarned[data._id] = true - log.warn(data._id+": "+data.deprecated, "deprecated") + log.warn("deprecated", "%s: %s", data._id, data.deprecated) } } diff --git a/deps/npm/lib/config.js b/deps/npm/lib/config.js index a69c30ea6..44f3d36f4 100644 --- a/deps/npm/lib/config.js +++ b/deps/npm/lib/config.js @@ -10,7 +10,7 @@ config.usage = "npm config set <key> <value>" + "\nnpm get [<key>]" var ini = require("./utils/ini.js") - , log = require("./utils/log.js") + , log = require("npmlog") , npm = require("./npm.js") , exec = require("./utils/exec.js") , fs = require("graceful-fs") @@ -129,7 +129,7 @@ function set (key, val, cb) { } key = key.trim() val = val.trim() - log("set "+key+" "+val, "config") + log.info("config", "set %j %j", key, val) var where = ini.get("global") ? "global" : "user" ini.set(key, val, where) ini.save(where, cb) diff --git a/deps/npm/lib/deprecate.js b/deps/npm/lib/deprecate.js index 6f18879e4..c9e724e69 100644 --- a/deps/npm/lib/deprecate.js +++ b/deps/npm/lib/deprecate.js @@ -18,10 +18,9 @@ deprecate.completion = function (opts, cb) { }) } -var registry = require("./utils/npm-registry-client/index.js") - , semver = require("semver") - , log = require("./utils/log.js") +var semver = require("semver") , npm = require("./npm.js") + , registry = npm.registry function deprecate (args, cb) { var pkg = args[0] @@ -43,6 +42,6 @@ function deprecate (args, cb) { data.versions[v].deprecated = msg }) // now update the doc on the registry - registry.request.PUT(data._id, data, cb) + registry.request('PUT', data._id, data, cb) }) } diff --git a/deps/npm/lib/docs.js b/deps/npm/lib/docs.js index 20b110406..72c1869b9 100644 --- a/deps/npm/lib/docs.js +++ b/deps/npm/lib/docs.js @@ -5,20 +5,20 @@ docs.usage = "npm docs <pkgname>" docs.completion = function (opts, cb) { if (opts.conf.argv.remain.length > 2) return cb() - registry.get("/-/short", null, 60000, function (er, list) { + registry.get("/-/short", 60000, function (er, list) { return cb(null, list || []) }) } var exec = require("./utils/exec.js") - , registry = require("./utils/npm-registry-client/index.js") , npm = require("./npm.js") - , log = require("./utils/log.js") + , registry = npm.registry + , log = require("npmlog") function docs (args, cb) { if (!args.length) return cb(docs.usage) var n = args[0].split("@").shift() - registry.get(n, "latest", 3600, function (er, d) { + registry.get(n + "/latest", 3600, function (er, d) { if (er) return cb(er) var homepage = d.homepage , repo = d.repository || d.repositories @@ -26,7 +26,7 @@ function docs (args, cb) { if (repo) { if (Array.isArray(repo)) repo = repo.shift() if (repo.hasOwnProperty("url")) repo = repo.url - log.verbose(repo, "repository") + log.verbose("repository", repo) if (repo) { return open(repo.replace(/^git(@|:\/\/)/, 'http://') .replace(/\.git$/, '')+"#readme", cb) diff --git a/deps/npm/lib/edit.js b/deps/npm/lib/edit.js index df103d4df..0ffe723bc 100644 --- a/deps/npm/lib/edit.js +++ b/deps/npm/lib/edit.js @@ -10,7 +10,6 @@ var npm = require("./npm.js") , exec = require("./utils/exec.js") , path = require("path") , fs = require("graceful-fs") - , log = require("./utils/log.js") function edit (args, cb) { var p = args[0] diff --git a/deps/npm/lib/help-search.js b/deps/npm/lib/help-search.js index a4ef667c0..6f1f117cb 100644 --- a/deps/npm/lib/help-search.js +++ b/deps/npm/lib/help-search.js @@ -7,7 +7,7 @@ var fs = require("graceful-fs") , asyncMap = require("slide").asyncMap , cliDocsPath = path.join(__dirname, "..", "doc", "cli") , apiDocsPath = path.join(__dirname, "..", "doc", "api") - , log = require("./utils/log.js") + , log = require("npmlog") , npm = require("./npm.js") helpSearch.usage = "npm help-search <text>" @@ -26,7 +26,10 @@ function helpSearch (args, silent, cb) { } fs.readdir(docsPath, function(er, files) { - if (er) return log.er(cb, "Could not load documentation")(er) + if (er) { + log.error("helpSearch", "Could not load documentation") + return cb(er) + } var search = args.join(" ") , results = [] diff --git a/deps/npm/lib/help.js b/deps/npm/lib/help.js index 442f839b3..998d90471 100644 --- a/deps/npm/lib/help.js +++ b/deps/npm/lib/help.js @@ -13,7 +13,7 @@ var fs = require("graceful-fs") , exec = require("./utils/exec.js") , npm = require("./npm.js") , output = require("./utils/output.js") - , log = require("./utils/log.js") + , log = require("npmlog") function help (args, cb) { var num = 1 @@ -34,6 +34,7 @@ function help (args, cb) { && npm.commands[section].usage ) { npm.config.set("loglevel", "silent") + log.level = "silent" return output.write(npm.commands[section].usage, cb) } @@ -83,6 +84,7 @@ function help (args, cb) { } else getSections(function (er, sections) { if (er) return cb(er) npm.config.set("loglevel", "silent") + log.level = "silent" output.write ( ["\nUsage: npm <command>" , "" diff --git a/deps/npm/lib/init.js b/deps/npm/lib/init.js index 7cd7da8e2..0d96e07ac 100644 --- a/deps/npm/lib/init.js +++ b/deps/npm/lib/init.js @@ -10,7 +10,7 @@ var read = require("read") , promiseChain = require("./utils/promise-chain.js") , exec = require("./utils/exec.js") , semver = require("semver") - , log = require("./utils/log.js") + , log = require("npmlog") , npm = require("./npm.js") , output = require("./utils/output.js") @@ -18,8 +18,7 @@ init.usage = "npm init [folder]" function init (args, cb) { var folder = args[0] || "." - , ll = npm.config.get("loglevel") - npm.config.set("loglevel", "paused") + log.pause() if (folder.charAt(0) !== "/") folder = path.join(process.cwd(), folder) readJson(path.join(folder, "package.json"), function (er, data) { @@ -31,8 +30,8 @@ function init (args, cb) { , url: npm.config.get("init.author.url") } init_(data, folder, function (er) { - npm.config.set("loglevel", ll) - if (!er) log(path.resolve(folder, "package.json"), "written") + log.resume() + if (!er) log.info("written", path.resolve(folder, "package.json")) cb(er) }) }) diff --git a/deps/npm/lib/install.js b/deps/npm/lib/install.js index 276f3d8b3..26a5a63ee 100644 --- a/deps/npm/lib/install.js +++ b/deps/npm/lib/install.js @@ -30,7 +30,7 @@ install.completion = function (opts, cb) { // if it has a slash, then it's gotta be a folder // if it starts with https?://, then just give up, because it's a url // for now, not yet implemented. - var registry = require("./utils/npm-registry-client/index.js") + var registry = npm.registry registry.get("/-/short", function (er, pkgs) { if (er) return cb() if (!opts.partialWord) return cb(null, pkgs) @@ -58,7 +58,7 @@ install.completion = function (opts, cb) { var npm = require("./npm.js") , semver = require("semver") , readJson = require("./utils/read-json.js") - , log = require("./utils/log.js") + , log = require("npmlog") , path = require("path") , fs = require("graceful-fs") , cache = require("./cache.js") @@ -98,7 +98,7 @@ function install (args, cb_) { where = args args = [].concat(cb_) // pass in [] to do default dep-install cb_ = arguments[2] - log.verbose([where, args], "install(where, what)") + log.verbose("install", "where,what", [where, args]) } if (!npm.config.get("global")) { @@ -117,9 +117,12 @@ function install (args, cb_) { , where , { dev: !npm.config.get("production") } , function (er, data) { - if (er) return log.er(cb, "Couldn't read dependencies.")(er) + if (er) { + log.error("install", "Couldn't read dependencies") + return cb(er) + } var deps = Object.keys(data.dependencies || {}) - log.verbose([where, deps], "where, deps") + log.verbose("install", "where, deps", [where, deps]) var context = { family: {} , ancestors: {} , explicit: false @@ -176,18 +179,18 @@ function readDependencies (context, where, opts, cb) { if (er) return cb(er) if (wrap) { - log.verbose([where, wrap], "readDependencies: using existing wrap") + log.verbose("readDependencies: using existing wrap", [where, wrap]) var rv = {} Object.keys(data).forEach(function (key) { rv[key] = data[key] }) rv.dependencies = {} Object.keys(wrap).forEach(function (key) { - log.verbose([key, wrap[key]], "from wrap") + log.verbose("from wrap", [key, wrap[key]]) var w = wrap[key] rv.dependencies[key] = w.from || w.version }) - log.verbose([rv.dependencies], "readDependencies: returned deps") + log.verbose("readDependencies returned deps", rv.dependencies) return cb(null, rv, wrap) } @@ -195,7 +198,7 @@ function readDependencies (context, where, opts, cb) { fs.readFile(wrapfile, "utf8", function (er, wrapjson) { if (er) { - log.verbose("readDependencies: using package.json deps") + log.verbose("readDependencies", "using package.json deps") return cb(null, data, null) } @@ -205,7 +208,7 @@ function readDependencies (context, where, opts, cb) { return cb(ex) } - log.info(wrapfile, "using shrinkwrap file") + log.info("shrinkwrap", "file %j", wrapfile) var rv = {} Object.keys(data).forEach(function (key) { rv[key] = data[key] @@ -215,7 +218,7 @@ function readDependencies (context, where, opts, cb) { var w = newwrap.dependencies[key] rv.dependencies[key] = w.from || w.version }) - log.verbose([rv.dependencies], "readDependencies: returned deps") + log.verbose("readDependencies returned deps", rv.dependencies) return cb(null, rv, newwrap.dependencies) }) }) @@ -358,10 +361,10 @@ function treeify (installed) { return l }, {}) - //log.warn(whatWhere, "whatWhere") + //log.warn("install", whatWhere, "whatWhere") return Object.keys(whatWhere).reduce(function (l, r) { var ww = whatWhere[r] - //log.warn([r, ww], "r, ww") + //log.warn("r, ww", [r, ww]) if (!ww.parent) { l[r] = ww } else { @@ -464,12 +467,12 @@ function installMany (what, where, context, cb) { targets.forEach(function (t) { newPrev[t.name] = t.version }) - log.silly(targets, "resolved") + log.silly("resolved", targets) targets.filter(function (t) { return t }).forEach(function (t) { - log.info(t._id, "into "+where) + log.info("install", "%s into %s", t._id, where) }) asyncMap(targets, function (target, cb) { - log.info(target._id, "installOne") + log.info("installOne", target._id) var newWrap = wrap ? wrap[target.name].dependencies || {} : null var newContext = { family: newPrev , ancestors: newAnc @@ -521,7 +524,7 @@ function targetResolver (where, context, deps) { // now we know what's been installed here manually, // or tampered with in some way that npm doesn't want to overwrite. if (alreadyInstalledManually.indexOf(what.split("@").shift()) !== -1) { - log.verbose("skipping "+what, "already installed in "+where) + log.verbose("already installed", "skipping %s %s", what, where) return cb(null, []) } @@ -529,7 +532,7 @@ function targetResolver (where, context, deps) { // If installing from a shrinkwrap, it must match exactly. if (context.family[what]) { if (wrap && wrap[what].version === context.family[what]) { - log.verbose(what, "using existing (matches shrinkwrap)") + log.verbose("shrinkwrap", "use existing", what) return cb(null, []) } } @@ -538,8 +541,8 @@ function targetResolver (where, context, deps) { // doing `npm install foo` inside of the foo project. Print // a warning, and skip it. if (parent && parent.name === what && !npm.config.get("force")) { - log.warn("Refusing to install "+what+" as a dependency of itself" - ,"install") + log.warn("install", "Refusing to install %s as a dependency of itself" + , what) return cb(null, []) } @@ -547,10 +550,10 @@ function targetResolver (where, context, deps) { name = what.split(/@/).shift() if (wrap[name]) { var wrapTarget = wrap[name].from || wrap[name].version - log.verbose("resolving "+what+" to "+wrapTarget, "shrinkwrap") + log.verbose("shrinkwrap", "resolving %s to %s", wrapTarget, what) what = name + "@" + wrapTarget } else { - log.verbose("skipping "+what+" (not in shrinkwrap)", "shrinkwrap") + log.verbose("shrinkwrap", "skipping %s (not in shrinkwrap)", what) } } else if (deps[what]) { what = what + "@" + deps[what] @@ -559,8 +562,8 @@ function targetResolver (where, context, deps) { cache.add(what, function (er, data) { if (er && parent && parent.optionalDependencies && parent.optionalDependencies.hasOwnProperty(what.split("@")[0])) { - log.warn(what, "optional dependency failed, continuing") - log.verbose([what, er], "optional dependency failed, continuing") + log.warn("optional dep failed, continuing", what) + log.verbose("optional dep failed, continuing", [what, er]) return cb(null, []) } @@ -569,7 +572,7 @@ function targetResolver (where, context, deps) { !context.explicit && context.family[data.name] === data.version && !npm.config.get("force")) { - log.info(data.name + "@" + data.version, "already installed") + log.info("already installed", data.name + "@" + data.version) return cb(null, []) } @@ -594,8 +597,8 @@ function installOne (target, where, context, cb) { // check if this one is optional to its parent. if (er && context.parent && context.parent.optionalDependencies && context.parent.optionalDependencies.hasOwnProperty(target.name)) { - log.warn(target._id, "optional dependency failed, continuing") - log.verbose([target._id, er], "optional dependency failed, continuing") + log.warn("optional dep failed, continuing", target._id) + log.verbose("optional dep failed, continuing", [target._id, er]) er = null } @@ -605,7 +608,7 @@ function installOne (target, where, context, cb) { } function localLink (target, where, context, cb) { - log.verbose(target._id, "try to link") + log.verbose("localLink", target._id) var jsonFile = path.resolve( npm.globalDir, target.name , "package.json" ) , parent = context.parent @@ -623,13 +626,13 @@ function localLink (target, where, context, cb) { function thenLink () { npm.commands.link([target.name], function (er, d) { - log.silly([er, d], "back from link") + log.silly("localLink", "back from link", [er, d]) cb(er, [resultList(target, where, parent && parent._id)]) }) } } else { - log.verbose(target._id, "install locally (no link)") + log.verbose("localLink", "install locally (no link)", target._id) installOne_(target, where, context, cb) } }) @@ -686,7 +689,7 @@ function checkEngine (target, cb) { if (nodev && eng.node && !semver.satisfies(nodev, eng.node) || eng.npm && !semver.satisfies(npmv, eng.npm)) { var er = new Error("Unsupported") - er.errno = npm.ENOTSUP + er.code = "ENOTSUP" er.required = eng er.pkgid = target._id return cb(er) @@ -713,7 +716,7 @@ function checkPlatform (target, cb) { } if (!osOk || !cpuOk) { var er = new Error("Unsupported") - er.errno = npm.EBADPLATFORM + er.code = "EBADPLATFORM" er.os = target.os || ['any'] er.cpu = target.cpu || ['any'] er.pkgid = target._id @@ -785,9 +788,9 @@ function checkCycle (target, ancestors, cb) { tree.push(JSON.parse(JSON.stringify(t))) t = Object.getPrototypeOf(t) } - log.verbose(tree, "unresolvable dependency tree") + log.verbose("unresolvable dependency tree", tree) er.pkgid = target._id - er.errno = npm.ECYCLE + er.code = "ECYCLE" return cb(er) } @@ -804,7 +807,7 @@ function checkGit_ (folder, cb) { if (!er && s.isDirectory()) { var e = new Error("Appears to be a git repo or submodule.") e.path = folder - e.errno = npm.EISGIT + e.code = "EISGIT" return cb(e) } cb() @@ -824,7 +827,7 @@ function write (target, targetFolder, context, cb_) { if (false === npm.config.get("rollback")) return cb_(er) npm.commands.unbuild([targetFolder], function (er2) { - if (er2) log.error(er2, "error rolling back "+target._id) + if (er2) log.error("error rolling back", target._id, er2) return cb_(er, data) }) } @@ -883,7 +886,7 @@ function write (target, targetFolder, context, cb_) { t = d + "@" + t return t }), targetFolder, newcontext, function (er, d) { - log.verbose(targetFolder, "about to build") + log.verbose("about to build", targetFolder) if (er) return cb(er) npm.commands.build( [targetFolder] , npm.config.get("global") diff --git a/deps/npm/lib/link.js b/deps/npm/lib/link.js index 3049884ca..de3d09c1c 100644 --- a/deps/npm/lib/link.js +++ b/deps/npm/lib/link.js @@ -1,11 +1,10 @@ - // link with no args: symlink the folder to the global location // link with package arg: symlink the global to the local var npm = require("./npm.js") , symlink = require("./utils/link.js") , fs = require("graceful-fs") - , log = require("./utils/log.js") + , log = require("npmlog") , asyncMap = require("slide").asyncMap , chain = require("slide").chain , path = require("path") @@ -30,16 +29,21 @@ link.completion = function (opts, cb) { function link (args, cb) { if (process.platform === "win32") { - var e = new Error("npm link not supported on windows") - e.code = "ENOTSUP" - e.errno = require("constants").ENOTSUP - return cb(e) + var semver = require("semver") + if (!semver.satisfies(process.version, ">=0.7.9")) { + var msg = "npm link not supported on windows prior to node 0.7.9" + , e = new Error(msg) + e.code = "ENOTSUP" + e.errno = require("constants").ENOTSUP + return cb(e) + } } if (npm.config.get("global")) { return cb(new Error("link should never be --global.\n" +"Please re-run this command with --local")) } + if (args.length === 1 && args[0] === ".") args = [] if (args.length) return linkInstall(args, cb) linkPkg(npm.prefix, cb) @@ -85,7 +89,7 @@ function linkInstall (pkgs, cb) { next() } else { return fs.realpath(pp, function (er, real) { - if (er) log.warn(pkg, "invalid symbolic link") + if (er) log.warn("invalid symbolic link", pkg) else rp = real next() }) @@ -95,7 +99,10 @@ function linkInstall (pkgs, cb) { function next () { chain ( [ [npm.commands, "unbuild", [target]] - , [log.verbose, "symlinking " + pp + " to "+target, "link"] + , [function (cb) { + log.verbose("link", "symlinking %s to %s", pp, target) + cb() + }] , [symlink, pp, target] // do run lifecycle scripts - full build here. , rp && [build, [target]] @@ -108,6 +115,9 @@ function linkInstall (pkgs, cb) { function linkPkg (folder, cb_) { var me = folder || npm.prefix , readJson = require("./utils/read-json.js") + + log.verbose("linkPkg", folder) + readJson( path.resolve(me, "package.json") , { dev: true } , function (er, d) { @@ -120,7 +130,7 @@ function linkPkg (folder, cb_) { if (er) return cb(er) symlink(me, target, function (er) { if (er) return cb(er) - log.verbose(target, "link: build target") + log.verbose("link", "build target", target) // also install missing dependencies. npm.commands.install(me, [], function (er, installed) { if (er) return cb(er) diff --git a/deps/npm/lib/ls.js b/deps/npm/lib/ls.js index 276530c35..29e65ad0d 100644 --- a/deps/npm/lib/ls.js +++ b/deps/npm/lib/ls.js @@ -10,7 +10,7 @@ module.exports = exports = ls var npm = require("./npm.js") , readInstalled = require("./utils/read-installed.js") , output = require("./utils/output.js") - , log = require("./utils/log.js") + , log = require("npmlog") , relativize = require("./utils/relativize.js") , path = require("path") , archy = require("archy") @@ -21,6 +21,8 @@ function ls (args, silent, cb) { if (typeof cb !== "function") cb = silent, silent = false if (args.length) { + // TODO: it would actually be nice to maybe show the locally + // installed packages only matching the argument names. log.warn("ls doesn't take positional args. Try the 'search' command") } @@ -167,10 +169,10 @@ function makeArchy_ (data, long, dir, depth, parent, d) { if (depth < npm.config.get("depth")) { // just missing var p = parent.link || parent.path - log.warn("Unmet dependency in "+p, d+" "+data) + log.warn("unmet dependency", "%s in %s", d+" "+data, p) data = "\033[31;40mUNMET DEPENDENCY\033[0m " + d + " " + data } else { - data = d+"@'"+ data +"' (max depth reached)" + data = d+"@"+ data +" (max depth reached)" } return data } @@ -244,7 +246,7 @@ function makeParseable_ (data, long, dir, depth, parent, d) { if (typeof data === "string") { if (data.depth < npm.config.get("depth")) { var p = parent.link || parent.path - log.warn("Unmet dependency in "+p, d+" "+data) + log.warn("unmet dependency", "%s in %s", d+" "+data, p) data = npm.config.get("long") ? path.resolve(parent.path, "node_modules", d) + ":"+d+"@"+JSON.stringify(data)+":INVALID:MISSING" diff --git a/deps/npm/lib/npm.js b/deps/npm/lib/npm.js index 2db21e34d..9b9545914 100644 --- a/deps/npm/lib/npm.js +++ b/deps/npm/lib/npm.js @@ -18,7 +18,7 @@ var EventEmitter = require("events").EventEmitter , npm = module.exports = new EventEmitter , config = require("./config.js") , ini = require("./utils/ini.js") - , log = require("./utils/log.js") + , log = require("npmlog") , fs = require("graceful-fs") , path = require("path") , abbrev = require("abbrev") @@ -29,6 +29,7 @@ var EventEmitter = require("events").EventEmitter , mkdirp = require("mkdirp") , slide = require("slide") , chain = slide.chain + , RegClient = require("npm-registry-client") // /usr/local is often a read-only fs, which is not // well handled by node or mkdirp. Just double-check @@ -48,14 +49,6 @@ function mkdir (p, cb) { } npm.commands = {} -npm.ELIFECYCLE = {} -npm.E404 = {} -npm.EPUBLISHCONFLICT = {} -npm.EJSONPARSE = {} -npm.EISGIT = {} -npm.ECYCLE = {} -npm.ENOTSUP = {} -npm.EBADPLATFORM = {} try { // startup, ok to do this synchronously @@ -64,17 +57,17 @@ try { npm.version = j.version npm.nodeVersionRequired = j.engines.node if (!semver.satisfies(process.version, j.engines.node)) { - log.error(["" + log.error("unsupported version", ["" ,"npm requires node version: "+j.engines.node ,"And you have: "+process.version ,"which is not satisfactory." ,"" ,"Bad things will likely happen. You have been warned." - ,""].join("\n"), "unsupported version") + ,""].join("\n")) } } catch (ex) { try { - log(ex, "error reading version") + log.info("error reading version", ex) } catch (er) {} npm.version = ex } @@ -250,7 +243,7 @@ npm.load = function (conf, cb_) { } } - log.waitForConfig() + log.pause() load(npm, conf, cb) } @@ -268,9 +261,33 @@ function load (npm, conf, cb) { //console.error("about to look up configs") ini.resolveConfigs(conf, function (er) { - //console.error("back from config lookup", er && er.stack) + log.level = npm.config.get("loglevel") + log.heading = "npm" + switch (npm.config.get("color")) { + case "always": log.enableColor(); break + case false: log.disableColor(); break + } + log.resume() + if (er) return cb(er) + // at this point the configs are all set. + // go ahead and spin up the registry client. + npm.registry = new RegClient( + { registry: npm.config.get("registry") + , cache: npm.config.get("cache") + , auth: npm.config.get("_auth") + , alwaysAuth: npm.config.get("always-auth") + , email: npm.config.get("email") + , tag: npm.config.get("tag") + , ca: npm.config.get("ca") + , strictSSL: npm.config.get("strict-ssl") + , userAgent: npm.config.get("user-agent") + , E404: npm.E404 + , EPUBLISHCONFLICT: npm.EPUBLISHCONFLICT + , log: log + }) + var umask = parseInt(conf.umask, 8) npm.modes = { exec: 0777 & (~umask) , file: 0666 & (~umask) @@ -352,7 +369,7 @@ function setUser (cl, dc, cb) { var prefix = path.resolve(cl.get("prefix")) mkdir(prefix, function (er) { if (er) { - log.error(prefix, "could not create prefix directory") + log.error("could not create prefix dir", prefix) return cb(er) } fs.stat(prefix, function (er, st) { diff --git a/deps/npm/lib/outdated.js b/deps/npm/lib/outdated.js index e883abd35..d87dc9ab6 100644 --- a/deps/npm/lib/outdated.js +++ b/deps/npm/lib/outdated.js @@ -24,7 +24,6 @@ var path = require("path") , cache = require("./cache.js") , asyncMap = require("slide").asyncMap , npm = require("./npm.js") - , log = require("./utils/log.js") , semver = require("semver") , relativize = require("./utils/relativize.js") diff --git a/deps/npm/lib/owner.js b/deps/npm/lib/owner.js index 5f13d926f..6a38625e5 100644 --- a/deps/npm/lib/owner.js +++ b/deps/npm/lib/owner.js @@ -64,12 +64,10 @@ owner.completion = function (opts, cb) { } } -var registry = require("./utils/npm-registry-client/index.js") - , get = registry.request.GET - , put = registry.request.PUT - , log = require("./utils/log.js") +var npm = require("./npm.js") + , registry = npm.registry + , log = require("npmlog") , output - , npm = require("./npm.js") function owner (args, cb) { var action = args.shift() @@ -83,9 +81,12 @@ function owner (args, cb) { function ls (pkg, cb) { if (!pkg) return cb(owner.usage) - get(pkg, function (er, data) { + registry.get(pkg, function (er, data) { var msg = "" - if (er) return log.er(cb, "Couldn't get owner data for "+pkg)(er) + if (er) { + log.error("owner ls", "Couldn't get owner data", pkg) + return cb(er) + } var owners = data.maintainers if (!owners || !owners.length) msg = "admin party!" else msg = owners.map(function (o) { return o.name +" <"+o.email+">" }).join("\n") @@ -101,15 +102,14 @@ function add (user, pkg, cb) { add(user, pkg, cb) }) - log.verbose(user+" to "+pkg, "owner add") + log.verbose("owner add", "%s to %s", user, pkg) mutate(pkg, user, function (u, owners) { if (!owners) owners = [] for (var i = 0, l = owners.length; i < l; i ++) { var o = owners[i] if (o.name === u.name) { - log( "Already a package owner: "+o.name+" <"+o.email+">" - , "owner add" - ) + log.info( "owner add" + , "Already a package owner: "+o.name+" <"+o.email+">") return false } } @@ -125,7 +125,7 @@ function rm (user, pkg, cb) { rm(user, pkg, cb) }) - log.verbose(user+" from "+pkg, "owner rm") + log.verbose("owner rm", "%s from %s", user, pkg) mutate(pkg, null, function (u, owners) { var found = false , m = owners.filter(function (o) { @@ -134,7 +134,7 @@ function rm (user, pkg, cb) { return !match }) if (!found) { - log("Not a package owner: "+user, "owner rm") + log.info("owner rm", "Not a package owner: "+user) return false } if (!m.length) return new Error( @@ -145,18 +145,26 @@ function rm (user, pkg, cb) { function mutate (pkg, user, mutation, cb) { if (user) { - get("/-/user/org.couchdb.user:"+user, mutate_) + registry.get("/-/user/org.couchdb.user:"+user, mutate_) } else { mutate_(null, null) } function mutate_ (er, u) { - if (er) return log.er(cb, "Error getting user data for "+user)(er) - if (user && (!u || u.error)) return cb(new Error( - "Couldn't get user data for "+user+": "+JSON.stringify(u))) + if (!er && user && (!u || u.error)) er = new Error( + "Couldn't get user data for "+user+": "+JSON.stringify(u)) + + if (er) { + log.error("owner mutate", "Error getting user data for %s", user) + return cb(er) + } + if (u) u = { "name" : u.name, "email" : u.email } - get("/"+pkg, function (er, data) { - if (er) return log.er(cb, "Couldn't get package data for "+pkg)(er) + registry.get(pkg, function (er, data) { + if (er) { + log.error("owner mutate", "Error getting package data for %s", pkg) + return cb(er) + } var m = mutation(u, data.maintainers) if (!m) return cb() // handled if (m instanceof Error) return cb(m) // error @@ -164,11 +172,15 @@ function mutate (pkg, user, mutation, cb) { , _rev : data._rev , maintainers : m } - put("/"+pkg+"/-rev/"+data._rev, data, function (er, data) { - if (er) return log.er(cb, "Failed to update package metadata")(er) - if (data.error) return cb(new Error( - "Failed to update package metadata: "+JSON.stringify(data))) - cb(null, data) + registry.request("PUT" + , pkg+"/-rev/"+data._rev, data + , function (er, data) { + if (!er && data.error) er = new Error( + "Failed to update package metadata: "+JSON.stringify(data)) + if (er) { + log.error("owner mutate", "Failed to update package metadata") + } + cb(er, data) }) }) } diff --git a/deps/npm/lib/publish.js b/deps/npm/lib/publish.js index 1cf59f01a..dfe21c251 100644 --- a/deps/npm/lib/publish.js +++ b/deps/npm/lib/publish.js @@ -2,8 +2,8 @@ module.exports = publish var npm = require("./npm.js") - , registry = require("./utils/npm-registry-client/index.js") - , log = require("./utils/log.js") + , registry = npm.registry + , log = require("npmlog") , tar = require("./utils/tar.js") , sha = require("./utils/sha.js") , path = require("path") @@ -29,7 +29,7 @@ function publish (args, isRetry, cb) { if (args.length === 0) args = ["."] if (args.length !== 1) return cb(publish.usage) - log.verbose(args, "publish") + log.verbose("publish", args) var arg = args[0] // if it's a local folder, then run the prepublish there, first. readJson(path.resolve(arg, "package.json"), function (er, data) { @@ -46,7 +46,7 @@ function publish (args, isRetry, cb) { function cacheAddPublish (arg, didPre, isRetry, cb) { npm.commands.cache.add(arg, function (er, data) { if (er) return cb(er) - log.silly(data, "publish") + log.silly("publish", data) var cachedir = path.resolve( npm.cache , data.name , data.version @@ -66,7 +66,7 @@ function publish_ (arg, data, isRetry, cachedir, cb) { // check for publishConfig hash if (data.publishConfig) { Object.keys(data.publishConfig).forEach(function (k) { - log.info(k + "=" + data.publishConfig[k], "publishConfig") + log.info("publishConfig", k + "=" + data.publishConfig[k]) npm.config.set(k, data.publishConfig[k]) }) } @@ -101,13 +101,13 @@ function preBuild (data, bd, cb) { , tb = path.resolve(cf, "package-"+bd+".tgz") , sourceBall = path.resolve(cf, "package.tgz") - log.verbose("about to cache unpack") - log.verbose(sourceBall, "the tarball") + log.verbose("preBuild", "about to cache unpack") + log.verbose("preBuild", "tarball = %s", sourceBall) npm.commands.install(pb, sourceBall, function (er) { - log.info(data._id, "prebuild done") + log.info("preBuild", "done", data._id) // build failure just means that we can't prebuild if (er) { - log.warn(er.message, "prebuild failed "+bd) + log.warn("preBuild", "failed (continuing without prebuild)", bd, er) return cb() } // now strip the preinstall/install scripts @@ -149,12 +149,15 @@ function preBuild (data, bd, cb) { function regPublish (data, prebuilt, isRetry, arg, cachedir, cb) { // check to see if there's a README.md in there. var readme = path.resolve(cachedir, "README.md") + , tarball = cachedir + ".tgz" + fs.readFile(readme, function (er, readme) { // ignore error. it's an optional feature - registry.publish(data, prebuilt, readme, function (er) { - if (er && er.errno === npm.EPUBLISHCONFLICT + + registry.publish(data, tarball, readme, function (er) { + if (er && er.code === "EPUBLISHCONFLICT" && npm.config.get("force") && !isRetry) { - log.warn("Forced publish over "+data._id, "publish") + log.warn("publish", "Forced publish over "+data._id) return npm.commands.unpublish([data._id], function (er) { // ignore errors. Use the force. Reach out with your feelings. publish([arg], true, cb) diff --git a/deps/npm/lib/rebuild.js b/deps/npm/lib/rebuild.js index 0e1d56a1d..a4a39f7b9 100644 --- a/deps/npm/lib/rebuild.js +++ b/deps/npm/lib/rebuild.js @@ -3,7 +3,7 @@ module.exports = rebuild var readInstalled = require("./utils/read-installed.js") , semver = require("semver") - , log = require("./utils/log.js") + , log = require("npmlog") , path = require("path") , npm = require("./npm.js") , output = require("./utils/output.js") @@ -17,14 +17,14 @@ rebuild.completion = require("./utils/completion/installed-deep.js") function rebuild (args, cb) { readInstalled(npm.prefix, function (er, data) { - log(typeof data, "read Installed") + log.info("readInstalled", typeof data) if (er) return cb(er) var set = filter(data, args) , folders = Object.keys(set).filter(function (f) { return f !== npm.prefix }) if (!folders.length) return cb() - log.silly(folders, "rebuild set") + log.silly("rebuild set", folders) cleanBuild(folders, set, cb) }) } @@ -79,7 +79,7 @@ function filter (data, args, set, seen) { } } if (pass && data._id) { - log.verbose([data.path, data._id], "path id") + log.verbose("rebuild", "path, id", [data.path, data._id]) set[data.path] = data._id } // need to also dive through kids, always. diff --git a/deps/npm/lib/root.js b/deps/npm/lib/root.js index 6062ec220..59ccc0b08 100644 --- a/deps/npm/lib/root.js +++ b/deps/npm/lib/root.js @@ -2,7 +2,6 @@ module.exports = root var npm = require("./npm.js") , output = require("./utils/output.js") - , log = require("./utils/log.js") root.usage = "npm root\nnpm root -g\n(just prints the root folder)" diff --git a/deps/npm/lib/run-script.js b/deps/npm/lib/run-script.js index 4a4d2dc61..17b48abf8 100644 --- a/deps/npm/lib/run-script.js +++ b/deps/npm/lib/run-script.js @@ -5,7 +5,7 @@ var lifecycle = require("./utils/lifecycle.js") , npm = require("./npm.js") , path = require("path") , readJson = require("./utils/read-json.js") - , log = require("./utils/log.js") + , log = require("npmlog") , chain = require("slide").chain , fs = require("graceful-fs") , asyncMap = require("slide").asyncMap @@ -92,7 +92,7 @@ function run (pkg, wd, cmd, cb) { if (!cmd.match(/^(pre|post)/)) { cmds = ["pre"+cmd].concat(cmds).concat("post"+cmd) } - log.verbose(cmds, "run-script") + log.verbose("run-script", cmds) chain(cmds.map(function (c) { // when running scripts explicitly, assume that they're trusted. return [lifecycle, pkg, c, wd, true] diff --git a/deps/npm/lib/search.js b/deps/npm/lib/search.js index 213390eb0..9ed712bcc 100644 --- a/deps/npm/lib/search.js +++ b/deps/npm/lib/search.js @@ -2,10 +2,9 @@ module.exports = exports = search var npm = require("./npm.js") - , registry = require("./utils/npm-registry-client/index.js") + , registry = npm.registry , semver = require("semver") , output - , log = require("./utils/log.js") search.usage = "npm search [some search terms ...]" @@ -60,7 +59,7 @@ function search (args, silent, staleness, cb_) { } function getFilteredData (staleness, args, notArgs, cb) { - registry.get( "/-/all", null, staleness, false + registry.get( "/-/all", staleness, false , true, function (er, data) { if (er) return cb(er) return cb(null, filter(data, args, notArgs)) diff --git a/deps/npm/lib/shrinkwrap.js b/deps/npm/lib/shrinkwrap.js index 59942d586..cdad89abc 100644 --- a/deps/npm/lib/shrinkwrap.js +++ b/deps/npm/lib/shrinkwrap.js @@ -5,7 +5,7 @@ module.exports = exports = shrinkwrap var npm = require("./npm.js") , output = require("./utils/output.js") - , log = require("./utils/log.js") + , log = require("npmlog") , fs = require("fs") , path = require("path") @@ -15,7 +15,7 @@ function shrinkwrap (args, silent, cb) { if (typeof cb !== "function") cb = silent, silent = false if (args.length) { - log.warn("shrinkwrap doesn't take positional args.") + log.warn("shrinkwrap", "doesn't take positional args") } npm.commands.ls([], true, function (er, _, pkginfo) { @@ -33,7 +33,7 @@ function shrinkwrap_ (pkginfo, silent, cb) { try { var swdata = JSON.stringify(pkginfo, null, 2) + "\n" } catch (er) { - log.error("Error converting package info to json") + log.error("shrinkwrap", "Error converting package info to json") return cb(er) } diff --git a/deps/npm/lib/star.js b/deps/npm/lib/star.js index d84fa02ed..fc4fb96f1 100644 --- a/deps/npm/lib/star.js +++ b/deps/npm/lib/star.js @@ -2,8 +2,8 @@ module.exports = star var npm = require("./npm.js") - , registry = require("./utils/npm-registry-client/index.js") - , log = require("./utils/log.js") + , registry = npm.registry + , log = require("npmlog") , asyncMap = require("slide").asyncMap , output = require("./utils/output.js") @@ -11,7 +11,7 @@ star.usage = "npm star <package> [pkg, pkg, ...]\n" + "npm unstar <package> [pkg, pkg, ...]" star.completion = function (opts, cb) { - registry.get("/-/short", null, 60000, function (er, list) { + registry.get("/-/short", 60000, function (er, list) { return cb(null, list || []) }) } @@ -26,7 +26,7 @@ function star (args, cb) { registry.star(pkg, using, function (er, data, raw, req) { if (!er) { output.write(s + " "+pkg, npm.config.get("outfd")) - log.verbose(data, "back from star/unstar") + log.verbose("star", data) } cb(er, data, raw, req) }) diff --git a/deps/npm/lib/substack.js b/deps/npm/lib/substack.js index 95a90f824..1929f1873 100644 --- a/deps/npm/lib/substack.js +++ b/deps/npm/lib/substack.js @@ -1,9 +1,19 @@ module.exports = substack var npm = require("./npm.js") - , log = require("./utils/log.js") + +var isms = + [ "\033[32mbeep \033[35mboop\033[m" + , "Replace your configs with services" + , "SEPARATE ALL THE CONCERNS!" + , "MODULE ALL THE THINGS!" + , "\\o/" + , "but first, burritos" + , "full time mad scientist here" + , "c/,,\\" ] function substack (args, cb) { - console.log("\033[32mbeep \033[35mboop\033[m") + var i = Math.floor(Math.random() * isms.length) + console.log(isms[i]) var c = args.shift() if (c) npm.commands[c](args, cb) else cb() diff --git a/deps/npm/lib/tag.js b/deps/npm/lib/tag.js index 06aa70c5e..8a7c51ca0 100644 --- a/deps/npm/lib/tag.js +++ b/deps/npm/lib/tag.js @@ -6,6 +6,7 @@ tag.usage = "npm tag <project>@<version> [<tag>]" tag.completion = require("./unpublish.js").completion var npm = require("./npm.js") + , registry = npm.registry function tag (args, cb) { var thing = (args.shift() || "").split("@") @@ -13,5 +14,5 @@ function tag (args, cb) { , version = thing.join("@") , t = args.shift() || npm.config.get("tag") if (!project || !version || !t) return cb("Usage:\n"+tag.usage) - require("./utils/npm-registry-client/index.js").tag(project, version, t, cb) + registry.tag(project, version, t, cb) } diff --git a/deps/npm/lib/unbuild.js b/deps/npm/lib/unbuild.js index 771eddf7d..dd0293be5 100644 --- a/deps/npm/lib/unbuild.js +++ b/deps/npm/lib/unbuild.js @@ -10,7 +10,7 @@ var readJson = require("./utils/read-json.js") , lifecycle = require("./utils/lifecycle.js") , asyncMap = require("slide").asyncMap , chain = require("slide").chain - , log = require("./utils/log.js") + , log = require("npmlog") , build = require("./build.js") // args is a list of folders. @@ -55,7 +55,8 @@ function rmBins (pkg, folder, parent, top, cb) { log.verbose([binRoot, pkg.bin], "binRoot") asyncMap(Object.keys(pkg.bin), function (b, cb) { if (process.platform === "win32") { - rm(path.resolve(binRoot, b) + ".cmd", cb) + chain([ [rm, path.resolve(binRoot, b) + ".cmd"] + , [rm, path.resolve(binRoot, b) ] ], cb) } else { gentlyRm( path.resolve(binRoot, b) , !npm.config.get("force") && folder diff --git a/deps/npm/lib/uninstall.js b/deps/npm/lib/uninstall.js index 655e5eb96..a1998e7fe 100644 --- a/deps/npm/lib/uninstall.js +++ b/deps/npm/lib/uninstall.js @@ -9,7 +9,7 @@ uninstall.usage = "npm uninstall <name>[@<version> [<name>[@<version>] ...]" uninstall.completion = require("./utils/completion/installed-shallow.js") var fs = require("graceful-fs") - , log = require("./utils/log.js") + , log = require("npmlog") , readJson = require("./utils/read-json.js") , path = require("path") , npm = require("./npm.js") @@ -43,12 +43,12 @@ function uninstall_ (args, nm, cb) { // uninstall .. should not delete /usr/local/lib/node_modules/.. var p = path.join(path.resolve(nm), path.join("/", arg)) if (path.resolve(p) === nm) { - log.warn(arg, "uninstall: invalid argument") + log.warn("uninstall", "invalid argument: %j", arg) return cb(null, []) } fs.lstat(p, function (er) { if (er) { - log.warn(arg, "Not installed in "+nm) + log.warn("uninstall", "not installed in %s: %j", nm, arg) return cb(null, []) } cb(null, p) diff --git a/deps/npm/lib/unpublish.js b/deps/npm/lib/unpublish.js index b7f6cbec8..8aae12c3d 100644 --- a/deps/npm/lib/unpublish.js +++ b/deps/npm/lib/unpublish.js @@ -1,9 +1,9 @@ module.exports = unpublish -var registry = require("./utils/npm-registry-client/index.js") - , log = require("./utils/log.js") +var log = require("npmlog") , npm = require("./npm.js") + , registry = npm.registry , readJson = require("./utils/read-json.js") , path = require("path") , output = require("./utils/output.js") @@ -72,7 +72,11 @@ function gotProject (project, version, cb_) { // remove from the cache first npm.commands.cache(["clean", project, version], function (er) { - if (er) return log.er(cb, "Failed to clean cache")(er) + if (er) { + log.error("unpublish", "Failed to clean cache") + return cb(er) + } + registry.unpublish(project, version, cb) }) } diff --git a/deps/npm/lib/update.js b/deps/npm/lib/update.js index 69b9f98e8..46d32678e 100644 --- a/deps/npm/lib/update.js +++ b/deps/npm/lib/update.js @@ -12,7 +12,7 @@ update.usage = "npm update [pkg]" var npm = require("./npm.js") , lifecycle = require("./utils/lifecycle.js") , asyncMap = require("slide").asyncMap - , log = require("./utils/log.js") + , log = require("npmlog") // load these, just so that we know that they'll be available, in case // npm itself is getting overwritten. @@ -23,7 +23,7 @@ update.completion = npm.commands.outdated.completion function update (args, cb) { npm.commands.outdated(args, true, function (er, outdated) { - log(outdated, "outdated updating") + log.info("outdated", "updating", outdated) if (er) return cb(er) asyncMap(outdated, function (ww, cb) { diff --git a/deps/npm/lib/utils/cmd-shim.js b/deps/npm/lib/utils/cmd-shim.js index e24da36f6..a31af6801 100644 --- a/deps/npm/lib/utils/cmd-shim.js +++ b/deps/npm/lib/utils/cmd-shim.js @@ -16,7 +16,7 @@ var fs = require("graceful-fs") , chain = require("slide").chain , mkdir = require("mkdirp") , rm = require("rimraf") - , log = require("./log.js") + , log = require("npmlog") , path = require("path") , relativize = require("./relativize.js") , npm = require("../npm.js") @@ -122,12 +122,12 @@ function writeShim_ (from, to, prog, args, cb) { fs.writeFile(to + ".cmd", cmd, "utf8", function (er) { if (er) { - log.warn("Could not write "+to+".cmd", "cmdShim") + log.warn("cmdShim", "Could not write "+to+".cmd") return cb(er) } fs.writeFile(to, sh, "utf8", function (er) { if (er) { - log.warn("Could not write "+to, "shShim") + log.warn("shShim", "Could not write "+to) return cb(er) } fs.chmod(to, 0755, cb) diff --git a/deps/npm/lib/utils/completion/remote-packages.js b/deps/npm/lib/utils/completion/remote-packages.js index 4bf82d070..18d812caa 100644 --- a/deps/npm/lib/utils/completion/remote-packages.js +++ b/deps/npm/lib/utils/completion/remote-packages.js @@ -1,7 +1,8 @@ module.exports = remotePackages -var registry = require("../npm-registry-client/index.js") +var npm = require("../../npm.js") + , registry = npm.registry , containsSingleMatch = require("./contains-single-match.js") , getCompletions = require("./get-completions.js") @@ -25,7 +26,7 @@ function remotePackages (args, index, doVersion, doTag if (name === undefined) name = "" if (name.indexOf("/") !== -1) return cb(null, []) // use up-to 1 hour stale cache. not super urgent. - registry.get("/", null, 3600, function (er, d) { + registry.get("/", 3600, function (er, d) { if (er) return cb(er) var remoteList = Object.keys(d) , found = remoteList.indexOf(name) diff --git a/deps/npm/lib/utils/completion/users.js b/deps/npm/lib/utils/completion/users.js index f77312c94..1dc6dbb91 100644 --- a/deps/npm/lib/utils/completion/users.js +++ b/deps/npm/lib/utils/completion/users.js @@ -1,19 +1,20 @@ module.exports = users -var registry = require("../npm-registry-client/index.js") +var npm = require("../../npm") + , registry = npm.registry , containsSingleMatch = require("./contains-single-match.js") , getCompletions = require("./get-completions.js") - , log = require("../log.js") + , log = require("npmlog") function users (args, index, cb) { var name = (args.length + 1 === index) ? args[args.length - 1] : "" if (name === undefined) name = "" // use up-to 1 day stale cache. doesn't change much - log.warn("About to fetch", "users completion") - registry.get("/-/users", null, 24*60*60, function (er, d) { - log.warn(d, "userdata") - log.warn(name, "name") + log.warn("users completion", "About to fetch") + registry.get("/-/users", 24*60*60, function (er, d) { + log.warn("userdata", d) + log.warn("name", name) if (er) return cb(er) var remoteList = Object.keys(d) , simpleMatches = getCompletions(name, remoteList) diff --git a/deps/npm/lib/utils/config-defs.js b/deps/npm/lib/utils/config-defs.js index 18b47ecdb..4542e8fd6 100644 --- a/deps/npm/lib/utils/config-defs.js +++ b/deps/npm/lib/utils/config-defs.js @@ -8,7 +8,7 @@ var path = require("path") , stableFamily = semver.parse(process.version) , os = require("os") , nopt = require("nopt") - , log = require("./log.js") + , log = require("npmlog") , npm = require("../npm.js") function Octal () {} @@ -32,7 +32,7 @@ nopt.typeDefs.semver = { type: semver, validate: validateSemver } nopt.typeDefs.Octal = { type: Octal, validate: validateOctal } nopt.invalidHandler = function (k, val, type, data) { - log.warn(k + "=" + JSON.stringify(val), "invalid config") + log.warn("invalid config", k + "=" + JSON.stringify(val)) if (Array.isArray(type)) { if (type.indexOf(url) !== -1) type = url @@ -41,16 +41,16 @@ nopt.invalidHandler = function (k, val, type, data) { switch (type) { case Octal: - log.warn("Must be octal number, starting with 0", "invalid config") + log.warn("invalid config", "Must be octal number, starting with 0") break case url: - log.warn("Must be a full url with 'http://'", "invalid config") + log.warn("invalid config", "Must be a full url with 'http://'") break case path: - log.warn("Must be a valid filesystem path", "invalid config") + log.warn("invalid config", "Must be a valid filesystem path") break case Number: - log.warn("Must be a numeric value", "invalid config") + log.warn("invalid config", "Must be a numeric value") break } } @@ -58,9 +58,6 @@ nopt.invalidHandler = function (k, val, type, data) { if (!stableFamily || (+stableFamily[2] % 2)) stableFamily = null else stableFamily = stableFamily[1] + "." + stableFamily[2] -var httpsOk = semver.satisfies(process.version, ">=0.4.9") -var winColor = semver.satisfies(process.version, ">=0.5.9") - var defaults var temp = process.env.TMPDIR @@ -143,7 +140,7 @@ Object.defineProperty(exports, "defaults", {get: function () { , "cache-max": Infinity , "cache-min": 0 - , color : process.platform !== "win32" || winColor + , color : true , coverage: false , depth: Infinity , description : true @@ -166,9 +163,7 @@ Object.defineProperty(exports, "defaults", {get: function () { , "init.author.url" : "" , json: false , link: false - , logfd : 2 , loglevel : "http" - , logprefix : process.platform !== "win32" || winColor , long : false , message : "%s" , "node-version" : process.version @@ -186,7 +181,7 @@ Object.defineProperty(exports, "defaults", {get: function () { process.env.HTTP_PROXY || process.env.http_proxy || null , "user-agent" : "npm/" + npm.version + " node/" + process.version , "rebuild-bundle" : true - , registry : "http" + (httpsOk ? "s" : "") + "://registry.npmjs.org/" + , registry : "https://registry.npmjs.org/" , rollback : true , save : false , "save-dev" : false @@ -251,9 +246,7 @@ exports.types = , "init.author.url" : ["", url] , json: Boolean , link: Boolean - , logfd : [Number, Stream] , loglevel : ["silent","win","error","warn","http","info","verbose","silly"] - , logprefix : Boolean , long : Boolean , message: String , "node-version" : [null, semver] diff --git a/deps/npm/lib/utils/error-handler.js b/deps/npm/lib/utils/error-handler.js index f7fdf165f..a5332b050 100644 --- a/deps/npm/lib/utils/error-handler.js +++ b/deps/npm/lib/utils/error-handler.js @@ -2,10 +2,9 @@ module.exports = errorHandler var cbCalled = false - , log = require("./log.js") + , log = require("npmlog") , npm = require("../npm.js") , rm = require("rimraf") - , constants = require("constants") , itWorked = false , path = require("path") , ini = require("./ini.js") @@ -20,16 +19,17 @@ process.on("exit", function (code) { if (itWorked) log.info("ok") else { if (!cbCalled) { - log.error("cb() never called!\n ") + log.error("", "cb() never called!") } + if (wroteLogFile) { - log.error(["" + log.error("", ["" ,"Additional logging details can be found in:" ," " + path.resolve("npm-debug.log") ].join("\n")) wroteLogFile = false } - log.win("not ok") + log.error("not ok", "code", code) } var doExit = npm.config.get("_exit") @@ -48,13 +48,16 @@ function exit (code, noLog) { exitCode = exitCode || code var doExit = npm.config.get("_exit") - log.verbose([code, doExit], "exit") - if (log.level === log.LEVEL.silent) noLog = true + log.verbose("exit", [code, doExit]) + if (log.level === "silent") noLog = true if (code && !noLog) writeLogFile(reallyExit) else rm("npm-debug.log", function () { rm(npm.tmp, reallyExit) }) function reallyExit() { + // truncate once it's been written. + log.record.length = 0 + itWorked = !code // just emit a fake exit event. @@ -80,40 +83,32 @@ function errorHandler (er) { cbCalled = true if (!er) return exit(0) if (!(er instanceof Error)) { - log.error(er) + log.error("weird error", er) return exit(1, true) } var m = er.code || er.message.match(/^(?:Error: )?(E[A-Z]+)/) - if (m) { - m = m[1] - if (!constants[m] && !npm[m]) constants[m] = {} - er.errno = npm[m] || constants[m] - } + if (m && !er.code) er.code = m - console.error("") - switch (er.code || er.errno) { + switch (er.code) { case "ECONNREFUSED": - case constants.ECONNREFUSED: - log.error(er) - log.error(["\nIf you are behind a proxy, please make sure that the" + log.error("", er) + log.error("", ["\nIf you are behind a proxy, please make sure that the" ,"'proxy' config is set properly. See: 'npm help config'" ].join("\n")) break case "EACCES": case "EPERM": - case constants.EACCES: - case constants.EPERM: - log.error(er) - log.error(["\nPlease try running this command again as root/Administrator." + log.error("", er) + log.error("", ["\nPlease try running this command again as root/Administrator." ].join("\n")) break - case npm.ELIFECYCLE: + case "ELIFECYCLE": er.code = "ELIFECYCLE" - log.error(er.message) - log.error(["","Failed at the "+er.pkgid+" "+er.stage+" script." + log.error("", er.message) + log.error("", ["","Failed at the "+er.pkgid+" "+er.stage+" script." ,"This is most likely a problem with the "+er.pkgname+" package," ,"not with npm itself." ,"Tell the author that this fails on your system:" @@ -124,18 +119,18 @@ function errorHandler (er) { ].join("\n")) break - case npm.EJSONPARSE: + case "EJSONPARSE": er.code = "EJSONPARSE" - log.error(er.message) - log.error("File: "+er.file) - log.error(["Failed to parse package.json data." + log.error("", er.message) + log.error("", "File: "+er.file) + log.error("", ["Failed to parse package.json data." ,"package.json must be actual JSON, not just JavaScript." ,"","This is not a bug in npm." ,"Tell the package author to fix their package.json file." ].join("\n"), "JSON.parse") break - case npm.E404: + case "E404": er.code = "E404" if (er.pkgid && er.pkgid !== "-") { var msg = ["'"+er.pkgid+"' is not in the npm registry." @@ -149,51 +144,40 @@ function errorHandler (er) { } msg.push("\nNote that you can also install from a" ,"tarball, folder, or http url, or git url.") - log.error(msg.join("\n"), "404") + log.error("404", msg.join("\n")) } break - case npm.EPUBLISHCONFLICT: + case "EPUBLISHCONFLICT": er.code = "EPUBLISHCONFLICT" - log.error(["Cannot publish over existing version." + log.error("publish fail", ["Cannot publish over existing version." ,"Bump the 'version' field, set the --force flag, or" ," npm unpublish '"+er.pkgid+"'" ,"and try again" - ].join("\n"), "publish fail" ) + ].join("\n")) break - case npm.EISGIT: + case "EISGIT": er.code = "EISGIT" - log.error([er.message + log.error("git", [er.message ," "+er.path ,"Refusing to remove it. Update manually," ,"or move it out of the way first." - ].join("\n"), "git" ) + ].join("\n")) break - case npm.ECYCLE: + case "ECYCLE": er.code = "ECYCLE" - log.error([er.message + log.error("cycle", [er.message ,"While installing: "+er.pkgid ,"Found a pathological dependency case that npm cannot solve." ,"Please report this to the package author." ].join("\n")) break - case npm.ENOTSUP: - er.code = "ENOTSUP" - log.error([er.message - ,"Not compatible with your version of node/npm: "+er.pkgid - ,"Required: "+JSON.stringify(er.required) - ,"Actual: " - +JSON.stringify({npm:npm.version - ,node:npm.config.get("node-version")}) - ].join("\n")) - break - - case npm.EBADPLATFORM: + case "EBADPLATFORM": er.code = "EBADPLATFORM" - log.error([er.message + log.error("notsup", [er.message ,"Not compatible with your operating system or architecture: "+er.pkgid ,"Valid OS: "+er.os.join(",") ,"Valid Arch: "+er.cpu.join(",") @@ -203,15 +187,26 @@ function errorHandler (er) { break case "EEXIST": - case constants.EEXIST: log.error([er.message ,"File exists: "+er.path ,"Move it away, and try again."].join("\n")) break + case "ENOTSUP": + if (er.required) { + log.error("notsup", [er.message + ,"Not compatible with your version of node/npm: "+er.pkgid + ,"Required: "+JSON.stringify(er.required) + ,"Actual: " + +JSON.stringify({npm:npm.version + ,node:npm.config.get("node-version")}) + ].join("\n")) + break + } // else passthrough + default: - log.error(er) - log.error(["You may report this log at:" + log.error("", er) + log.error("", ["You may report this log at:" ," <http://github.com/isaacs/npm/issues>" ,"or email it to:" ," <npm-@googlegroups.com>" @@ -220,13 +215,14 @@ function errorHandler (er) { } var os = require("os") - log.error("") - log.error(os.type() + " " + os.release(), "System") - log.error(process.argv - .map(JSON.stringify).join(" "), "command") - log.error(process.cwd(), "cwd") - log.error(process.version, "node -v") - log.error(npm.version, "npm -v") + // just a line break + console.error("") + log.error("System", os.type() + " " + os.release()) + log.error("command", process.argv + .map(JSON.stringify).join(" ")) + log.error("cwd", process.cwd()) + log.error("node -v", process.version) + log.error("npm -v", npm.version) ; [ "file" , "path" @@ -238,16 +234,15 @@ function errorHandler (er) { , "fstream_class" , "fstream_finish_call" , "fstream_linkpath" - , "arguments" , "code" , "message" , "errno" ].forEach(function (k) { - if (er[k]) log.error(er[k], k) + if (er[k]) log.error(k, er[k]) }) if (er.fstream_stack) { - log.error(er.fstream_stack.join("\n"), "fstream_stack") + log.error("fstream_stack", er.fstream_stack.join("\n")) } if (er.errno && typeof er.errno !== "object") log.error(er.errno, "errno") @@ -263,19 +258,21 @@ function writeLogFile (cb) { var fs = require("graceful-fs") , fstr = fs.createWriteStream("npm-debug.log") , util = require("util") - - log.history.forEach(function (m) { - var lvl = log.LEVEL[m.level] - , pref = m.pref ? " " + m.pref : "" - , b = lvl + pref + " " - , eol = process.platform === "win32" ? "\r\n" : "\n" - , msg = typeof m.msg === "string" ? m.msg - : msg instanceof Error ? msg.stack || msg.message - : util.inspect(m.msg, 0, 4) - fstr.write(new Buffer(b - +(msg.split(/\r?\n+/).join(eol+b)) - + eol)) + , eol = process.platform === "win32" ? "\r\n" : "\n" + , out = "" + + log.record.forEach(function (m) { + var pref = [m.id, m.level] + if (m.prefix) pref.push(m.prefix) + pref = pref.join(' ') + + m.message.trim().split(/\r?\n/).map(function (line) { + return (pref + ' ' + line).trim() + }).forEach(function (line) { + out += line + eol + }) }) - fstr.end() + + fstr.end(out) fstr.on("close", cb) } diff --git a/deps/npm/lib/utils/exec.js b/deps/npm/lib/utils/exec.js index b9a5b6911..56d331a67 100644 --- a/deps/npm/lib/utils/exec.js +++ b/deps/npm/lib/utils/exec.js @@ -1,8 +1,7 @@ module.exports = exec exec.spawn = spawn -exec.pipe = pipe -var log = require("./log.js") +var log = require("npmlog") , child_process = require("child_process") , util = require("util") , npm = require("../npm.js") @@ -31,8 +30,7 @@ function exec (cmd, args, env, takeOver, cwd, uid, gid, cb) { } } if (uid !== myUID) { - log.verbose(uid, "Setting uid from "+myUID) - log.verbose(new Error().stack, "stack at uid setting") + log.verbose("set uid", "from=%s to=%s", myUID, uid) } if (uid && gid && (isNaN(uid) || isNaN(gid))) { @@ -43,7 +41,7 @@ function exec (cmd, args, env, takeOver, cwd, uid, gid, cb) { }) } - log.silly(cmd+" "+args.map(JSON.stringify).join(" "), "exec") + log.silly("exec", cmd+" "+args.map(JSON.stringify).join(" ")) var stdout = "" , stderr = "" , cp = spawn(cmd, args, env, takeOver, cwd, uid, gid) @@ -65,38 +63,6 @@ function exec (cmd, args, env, takeOver, cwd, uid, gid, cb) { return cp } -function logger (d) { if (d) process.stderr.write(d+"") } -function pipe (cp1, cp2, cb) { - util.pump(cp1.stdout, cp2.stdin) - var errState = null - , buff1 = "" - , buff2 = "" - if (log.level <= log.LEVEL.silly) { - cp1.stderr.on("data", logger) - cp2.stderr.on("data", logger) - } else { - cp1.stderr.on("data", function (d) { buff1 += d }) - cp2.stderr.on("data", function (d) { buff2 += d }) - } - - cp1.on("exit", function (code) { - if (!code) return log.verbose(cp1.name || "<unknown>", "success") - if (!cp2._exited) cp2.kill() - log.error(buff1, cp1.name || "<unknown>") - cb(errState = new Error( - "Failed "+(cp1.name || "<unknown>")+"\nexited with "+code)) - }) - - cp2.on("exit", function (code) { - cp2._exited = true - if (errState) return - if (!code) return log.verbose(cp2.name || "<unknown>", "success", cb) - log.error(buff2, cp2.name || "<unknown>") - cb(new Error( "Failed " - + (cp2.name || "<unknown>") - + "\nexited with " + code )) - }) -} function spawn (c, a, env, takeOver, cwd, uid, gid) { var fds = [ 0, 1, 2 ] diff --git a/deps/npm/lib/utils/fetch.js b/deps/npm/lib/utils/fetch.js index bc1c095cd..f69975ba6 100644 --- a/deps/npm/lib/utils/fetch.js +++ b/deps/npm/lib/utils/fetch.js @@ -6,7 +6,7 @@ var request = require("request") , fs = require("graceful-fs") , npm = require("../npm.js") , url = require("url") - , log = require("./log.js") + , log = require("npmlog") , path = require("path") , mkdir = require("mkdirp") , chownr = require("chownr") @@ -16,7 +16,7 @@ module.exports = fetch function fetch (remote, local, headers, cb) { if (typeof cb !== "function") cb = headers, headers = {} - log.verbose(local, "fetch to") + log.verbose("fetch", "to=", local) mkdir(path.dirname(local), function (er, made) { if (er) return cb(er) fetch_(remote, local, headers, cb) @@ -41,7 +41,7 @@ function fetch_ (remote, local, headers, cb) { function makeRequest (remote, fstr, headers) { remote = url.parse(remote) - log.http(remote.href, "GET") + log.http("GET", remote.href) regHost = regHost || url.parse(npm.config.get("registry")).host if (remote.host === regHost && npm.config.get("always-auth")) { @@ -63,6 +63,6 @@ function makeRequest (remote, fstr, headers) { , onResponse: onResponse }).pipe(fstr) function onResponse (er, res) { if (er) return fstr.emit("error", er) - log.http(res.statusCode + " " + remote.href) + log.http(res.statusCode, remote.href) } } diff --git a/deps/npm/lib/utils/ini.js b/deps/npm/lib/utils/ini.js index b033b6a04..aa4f43180 100644 --- a/deps/npm/lib/utils/ini.js +++ b/deps/npm/lib/utils/ini.js @@ -39,7 +39,7 @@ var fs = require("graceful-fs") , mkdir = require("mkdirp") , npm = require("../npm.js") - , log = require("./log.js") + , log = require("npmlog") , configDefs = require("./config-defs.js") , myUid = process.env.SUDO_UID !== undefined @@ -66,7 +66,6 @@ exports.configList = configList // just put this here for a moment, so that the logs // in the config-loading phase don't cause it to blow up. -configList.push({loglevel:"warn"}) function resolveConfigs (cli, cb_) { defaultConfig = defaultConfig || configDefs.defaults @@ -108,7 +107,8 @@ function resolveConfigs (cli, cb_) { if (er) return cb(er) if (conf.hasOwnProperty("prefix")) { - log.warn("Cannot set prefix in globalconfig file" + log.warn( "globalconfig" + , "Cannot set prefix in globalconfig file" , cl.get("globalconfig")) delete conf.prefix } @@ -196,7 +196,7 @@ function parseField (f, k, emptyIsFalse) { function parseFile (file, cb) { if (!file) return cb(null, {}) - log.verbose(file, "config file") + log.verbose("config file", file) fs.readFile(file, function (er, data) { // treat all errors as just an empty file if (er) return cb(null, {}) diff --git a/deps/npm/lib/utils/lifecycle.js b/deps/npm/lib/utils/lifecycle.js index c5ebbbee1..2f31af007 100644 --- a/deps/npm/lib/utils/lifecycle.js +++ b/deps/npm/lib/utils/lifecycle.js @@ -2,7 +2,7 @@ exports = module.exports = lifecycle exports.cmd = cmd -var log = require("./log.js") +var log = require("npmlog") , exec = require("./exec.js") , npm = require("../npm.js") , path = require("path") @@ -31,7 +31,7 @@ function lifecycle (pkg, stage, wd, unsafe, failOk, cb) { while (pkg && pkg._data) pkg = pkg._data if (!pkg) return cb(new Error("Invalid package data")) - log(pkg._id, stage) + log.info(stage, pkg._id) if (!pkg.scripts) pkg.scripts = {} validWd(wd || path.resolve(npm.dir, pkg.name), function (er, wd) { @@ -41,7 +41,8 @@ function lifecycle (pkg, stage, wd, unsafe, failOk, cb) { if ((wd.indexOf(npm.dir) !== 0 || path.basename(wd) !== pkg.name) && !unsafe && pkg.scripts[stage]) { - log.warn(pkg._id+" "+pkg.scripts[stage], "skipping, cannot run in "+wd) + log.warn( "cannot run in wd", "%s %s (wd=%s)" + , pkg._id, pkg.scripts[stage], wd) return cb() } @@ -98,14 +99,14 @@ function lifecycle_ (pkg, stage, wd, env, unsafe, failOk, cb) { if (failOk) { cb = (function (cb_) { return function (er) { - if (er) log.warn(er.message, "continuing anyway") + if (er) log.warn("continuing anyway", er.message) cb_() }})(cb) } if (npm.config.get("force")) { cb = (function (cb_) { return function (er) { - if (er) log(er, "forced, continuing") + if (er) log.info("forced, continuing", er) cb_() }})(cb) } @@ -143,7 +144,7 @@ function runPackageLifecycle (pkg, env, wd, unsafe, cb) { shFlag = "/c" } - log.verbose(unsafe, "unsafe-perm in lifecycle") + log.verbose("unsafe-perm in lifecycle", unsafe) var note = "\n> " + pkg._id + " " + stage + " " + wd + "\n> " + cmd + "\n" @@ -155,12 +156,12 @@ function runPackageLifecycle (pkg, env, wd, unsafe, cb) { , user, group , function (er, code, stdout, stderr) { if (er && !npm.ROLLBACK) { - log("Failed to exec "+stage+" script", pkg._id) + log.info(pkg._id, "Failed to exec "+stage+" script") er.message = pkg._id + " " + stage + ": `" + env.npm_lifecycle_script+"`\n" + er.message - if (er.errno !== constants.EPERM) { - er.errno = npm.ELIFECYCLE + if (er.code !== "EPERM") { + er.code = "ELIFECYCLE" } er.pkgid = pkg._id er.stage = stage @@ -168,8 +169,8 @@ function runPackageLifecycle (pkg, env, wd, unsafe, cb) { er.pkgname = pkg.name return cb(er) } else if (er) { - log.error(er, pkg._id+"."+stage) - log.error("failed, but continuing anyway", pkg._id+"."+stage) + log.error(pkg._id+"."+stage, er) + log.error(pkg._id+"."+stage, "continuing anyway") return cb() } cb(er) @@ -193,7 +194,7 @@ function runHookLifecycle (pkg, env, wd, unsafe, cb) { , function (er) { if (er) { er.message += "\nFailed to exec "+stage+" hook script" - log(er, pkg._id) + log.info(pkg._id, er) } if (npm.ROLLBACK) return cb() cb(er) @@ -260,10 +261,6 @@ function makeEnv (data, prefix, env) { return } var value = ini.get(i) - if (/^(log|out)fd$/.test(i) && typeof value === "object") { - // not an fd, a stream - return - } if (!value) value = "" else if (typeof value !== "string") value = JSON.stringify(value) diff --git a/deps/npm/lib/utils/link.js b/deps/npm/lib/utils/link.js index 7fa80d5e1..806fe22eb 100644 --- a/deps/npm/lib/utils/link.js +++ b/deps/npm/lib/utils/link.js @@ -6,7 +6,6 @@ var fs = require("graceful-fs") , chain = require("slide").chain , mkdir = require("mkdirp") , rm = require("./gently-rm.js") - , log = require("./log.js") , path = require("path") , relativize = require("./relativize.js") , npm = require("../npm.js") @@ -21,10 +20,14 @@ function linkIfExists (from, to, gently, cb) { function link (from, to, gently, cb) { if (typeof cb !== "function") cb = gently, gently = null if (npm.config.get("force")) gently = false + + // junction symlinks on windows must be absolute + var rel = process.platform === "win32" ? from : relativize(from, to) + chain ( [ [fs, "stat", from] , [rm, to, gently] , [mkdir, path.dirname(to)] - , [fs, "symlink", relativize(from, to), to] ] + , [fs, "symlink", rel, to, "junction"] ] , cb) } diff --git a/deps/npm/lib/utils/load-package-defaults.js b/deps/npm/lib/utils/load-package-defaults.js index 180507a44..8a72ade30 100644 --- a/deps/npm/lib/utils/load-package-defaults.js +++ b/deps/npm/lib/utils/load-package-defaults.js @@ -2,7 +2,7 @@ module.exports = loadPackageDefaults var path = require("path") - , log = require("./log.js") + , log = require("npmlog") , find = require("./find.js") , asyncMap = require("slide").asyncMap , npm = require("../npm.js") @@ -21,7 +21,7 @@ function loadPackageDefaults (pkg, pkgDir, cb) { pkg._defaultsLoaded = true asyncMap ( [pkg] - , function (pkg, cb) { log.verbose(pkg._id, "loadDefaults", cb) } + , function (pkg, cb) { log.verbose("loadDefaults", pkg._id); cb() } , readDefaultBins(pkgDir) , readDefaultMans(pkgDir) , function (er) { cb(er, pkg) } ) @@ -54,7 +54,7 @@ function readDefaultBins (pkgDir) { return function (pkg, cb) { var bin = pkg.directories && pkg.directories.bin if (pkg.bins) pkg.bin = pkg.bins, delete pkg.bins if (pkg.bin || !bin) return cb(null, pkg) - log.verbose("linking default bins", pkg._id) + log.verbose("loadDefaults", pkg._id, "linking default bins") var binDir = path.join(pkgDir, bin) pkg.bin = {} find(binDir, function (er, filenames) { @@ -69,7 +69,7 @@ function readDefaultBins (pkgDir) { return function (pkg, cb) { , val = filename.substr(cut) if (key.length && val.length) pkg.bin[key] = val }) - log.silly(pkg.bin, pkg._id+".bin") + log.silly("loadDefaults", pkg._id, "bin", pkg.bin) cb(null, pkg) }) }} diff --git a/deps/npm/lib/utils/log.js b/deps/npm/lib/utils/log.js deleted file mode 100644 index 07867e3e9..000000000 --- a/deps/npm/lib/utils/log.js +++ /dev/null @@ -1,170 +0,0 @@ - -module.exports = log - -var output = require("./output.js") - -function colorize (msg, color) { - return msg ? "\033["+color+"m"+msg+"\033[0m" : "" -} - -var l = -1 - , LEVEL = { silly : l++ - , verbose : l++ - , info : l++ - , "http" : l++ - , WARN : l++ - , "ERR!" : l++ - , ERROR : "ERR!" - , ERR : "ERR!" - , win : 0x15AAC5 - , paused : 0x19790701 - , silent : 0xDECAFBAD - } - , COLOR = {} - , SHOWLEVEL = null - , normalNames = {} -log.LEVEL = LEVEL -normalNames[LEVEL["ERR!"]] = "error" -normalNames[LEVEL.WARN] = "warn" -normalNames[LEVEL.info] = "info" -normalNames[LEVEL.verbose] = "verbose" -normalNames[LEVEL.silly] = "silly" -normalNames[LEVEL.win] = "win" - -Object.keys(LEVEL).forEach(function (l) { - if (typeof LEVEL[l] === "string") LEVEL[l] = LEVEL[LEVEL[l]] - else LEVEL[LEVEL[l]] = l - LEVEL[l.toLowerCase()] = LEVEL[l] - if (l === "silent" || l === "paused") return - log[l] = log[l.toLowerCase()] = - function (msg, pref, cb) { return log(msg, pref, l, cb) } -}) - -COLOR[LEVEL.silly] = 30 -COLOR[LEVEL.verbose] = "34;40" -COLOR[LEVEL.info] = 32 -COLOR[LEVEL.http] = "32;40" -COLOR[LEVEL.warn] = "30;41" -COLOR[LEVEL.error] = "31;40" -for (var c in COLOR) COLOR[LEVEL[c]] = COLOR[c] -COLOR.npm = "37;40" -COLOR.pref = 35 - -var logBuffer = [] - , ini = require("./ini.js") - , waitForConfig -log.waitForConfig = function () { waitForConfig = true } - -// now the required stuff has been loaded, -// so the transitive module dep will work -var util = require("util") - , npm = require("../npm.js") - , net = require("net") - -Object.defineProperty(log, "level", - { get : function () { - if (SHOWLEVEL !== null) return SHOWLEVEL - var show = npm.config && npm.config.get("loglevel") || '' - show = show.split(",")[0] - if (!isNaN(show)) show = +show - else if (!LEVEL.hasOwnProperty(show)) { - util.error("Invalid loglevel config: "+JSON.stringify(show)) - show = "info" - } - if (isNaN(show)) show = LEVEL[show] - else show = +show - if (!waitForConfig || ini.resolved) SHOWLEVEL = show - return show - } - , set : function (l) { - SHOWLEVEL = null - npm.config.set("showlevel", l) - } - }) - -function log (msg, pref, level, cb) { - if (typeof level === "function") cb = level, level = null - var show = log.level - if (show === LEVEL.silent || show === LEVEL.paused) return cb && cb() - if (level == null) level = LEVEL.info - if (isNaN(level)) level = LEVEL[level] - else level = +level - - // logging just undefined is almost never the right thing. - // a lot of these are kicking around throughout the codebase - // with relatively unhelpful prefixes. - if (msg === undefined && level > LEVEL.silly) { - msg = new Error("undefined log message") - } - if (typeof msg === "object" && (msg instanceof Error)) level = LEVEL.error - if (!ini.resolved && waitForConfig || level === LEVEL.paused) { - return logBuffer.push([msg, pref, level, cb]) - } - if (logBuffer.length && !logBuffer.discharging) { - logBuffer.push([msg, pref, level, cb]) - logBuffer.discharging = true - logBuffer.forEach(function (l) { log.apply(null, l) }) - logBuffer.length = 0 - delete logBuffer.discharging - return - } - log.level = show - npm.emit("log", { level : level, msg : msg, pref : pref, cb : cb }) - npm.emit("log."+normalNames[level], { msg : msg, pref : pref, cb : cb }) -} - -var loglog = log.history = [] - , loglogLen = 0 -npm.on("log", function (logData) { - var level = logData.level - , msg = logData.msg - , pref = logData.pref - , cb = logData.cb || function () {} - , show = log.level - , spaces = " " - , logFD = npm.config.get("logfd") - if (msg instanceof Error) { - msg = logData.msg = msg.stack || msg.toString() - } - loglog.push(logData) - loglogLen ++ - if (loglogLen > 2000) { - loglog = loglog.slice(loglogLen - 1000) - loglogLen = 1000 - } - if (!isFinite(level) || level < show) return cb() - if (typeof msg !== "string" && !(msg instanceof Error)) { - msg = util.inspect(msg, 0, 4, true) - } - - // console.error("level, showlevel, show", level, show, (level >= show)) - if (pref && COLOR.pref) { - pref = colorize(pref, COLOR.pref) - } - if (!pref) pref = "" - - if (npm.config.get("logprefix")) { - pref = colorize("npm", COLOR.npm) - + (COLOR[level] ? " "+colorize( - (LEVEL[level]+spaces).substr(0,4), COLOR[level]) : "") - + (pref ? (" " + pref) : "") - } - if (pref) pref += " " - - - - if (msg.indexOf("\n") !== -1) { - msg = msg.split(/\n/).join("\n"+pref) - } - msg = pref+msg - return output.write(msg, logFD, cb) -}) - -log.er = function (cb, msg) { - if (!msg) throw new Error( - "Why bother logging it if you're not going to print a message?") - return function (er) { - if (er) log.error(msg) - cb.apply(this, arguments) - } -} diff --git a/deps/npm/lib/utils/npm-registry-client/adduser.js b/deps/npm/lib/utils/npm-registry-client/adduser.js deleted file mode 100644 index 5e6794a75..000000000 --- a/deps/npm/lib/utils/npm-registry-client/adduser.js +++ /dev/null @@ -1,100 +0,0 @@ - -module.exports = adduser - -var uuid = require("node-uuid") - , request = require("./request.js") - , log = require("../log.js") - , npm = require("../../npm.js") - , crypto - -try { - crypto = process.binding("crypto") && require("crypto") -} catch (ex) {} - -function sha (s) { - return crypto.createHash("sha1").update(s).digest("hex") -} - -function adduser (username, password, email, cb) { - if (!crypto) return cb(new Error( - "You must compile node with ssl support to use the adduser feature")) - - password = ("" + (password || "")).trim() - if (!password) return cb(new Error("No password supplied.")) - - email = ("" + (email || "")).trim() - if (!email) return cb(new Error("No email address supplied.")) - if (!email.match(/^[^@]+@[^\.]+\.[^\.]+/)) { - return cb(new Error("Please use a real email address.")) - } - - if (password.indexOf(":") !== -1) return cb(new Error( - "Sorry, ':' chars are not allowed in passwords.\n"+ - "See <https://issues.apache.org/jira/browse/COUCHDB-969> for why.")) - var salt = uuid() - , userobj = - { name : username - , salt : salt - , password_sha : sha(password + salt) - , email : email - , _id : 'org.couchdb.user:'+username - , type : "user" - , roles : [] - , date: new Date().toISOString() - } - cb = done(cb) - log.verbose(userobj, "before first PUT") - request.PUT - ( '/-/user/org.couchdb.user:'+encodeURIComponent(username) - , userobj - , function (error, data, json, response) { - // if it worked, then we just created a new user, and all is well. - // but if we're updating a current record, then it'll 409 first - if (error && !npm.config.get("_auth")) { - // must be trying to re-auth on a new machine. - // use this info as auth - npm.config.set("username", username) - npm.config.set("_password", password) - var b = new Buffer(username + ":" + password) - npm.config.set("_auth", b.toString("base64")) - } - if (!error || !response || response.statusCode !== 409) { - return cb(error, data, json, response) - } - log.verbose("update existing user", "adduser") - return request.GET - ( '/-/user/org.couchdb.user:'+encodeURIComponent(username) - , function (er, data, json, response) { - userobj._rev = data._rev - userobj.roles = data.roles - log.verbose(userobj, "userobj") - request.PUT - ( '/-/user/org.couchdb.user:'+encodeURIComponent(username) - + "/-rev/" + userobj._rev - , userobj - , cb ) - } - ) - } - ) -} - -function done (cb) { return function (error, data, json, response) { - if (!error && (!response || response.statusCode === 201)) { - return cb(error, data, json, response) - } - log.verbose([error, data, json], "back from adduser") - if (!error) { - error = new Error( (response && response.statusCode || "") + " "+ - "Could not create user\n"+JSON.stringify(data)) - } - if (response - && (response.statusCode === 401 || response.statusCode === 403)) { - log.warn("Incorrect username or password\n" - +"You can reset your account by visiting:\n" - +"\n" - +" http://admin.npmjs.org/reset\n") - } - - return cb(error) -}} diff --git a/deps/npm/lib/utils/npm-registry-client/get.js b/deps/npm/lib/utils/npm-registry-client/get.js deleted file mode 100644 index e0902f027..000000000 --- a/deps/npm/lib/utils/npm-registry-client/get.js +++ /dev/null @@ -1,186 +0,0 @@ - -module.exports = get - -var GET = require("./request.js").GET - , fs = require("graceful-fs") - , npm = require("../../npm.js") - , path = require("path") - , log = require("../log.js") - , mkdir = require("mkdirp") - , cacheStat = null - , chownr = require("chownr") - -function get (project, version, timeout, nofollow, staleOk, cb) { - if (typeof cb !== "function") cb = staleOk, staleOk = false - if (typeof cb !== "function") cb = nofollow, nofollow = false - if (typeof cb !== "function") cb = timeout, timeout = -1 - if (typeof cb !== "function") cb = version, version = null - if (typeof cb !== "function") cb = project, project = null - if (typeof cb !== "function") { - throw new Error("No callback provided to registry.get") - } - - timeout = Math.min(timeout, npm.config.get("cache-max")) - timeout = Math.max(timeout, npm.config.get("cache-min")) - - if ( process.env.COMP_CWORD !== undefined - && process.env.COMP_LINE !== undefined - && process.env.COMP_POINT !== undefined - ) timeout = Math.max(timeout, 60000) - - var uri = [] - uri.push(project || "") - if (version) uri.push(version) - uri = uri.join("/") - - // /-/all is special. - // It uses timestamp-based caching and partial updates, - // because it is a monster. - if (uri === "/-/all") { - return requestAll(cb) - } - - var cache = path.join(npm.cache, uri, ".cache.json") - fs.stat(cache, function (er, stat) { - if (!er) fs.readFile(cache, function (er, data) { - try { data = JSON.parse(data) } - catch (ex) { data = null } - get_(uri, timeout, cache, stat, data, nofollow, staleOk, cb) - }) - else get_(uri, timeout, cache, null, null, nofollow, staleOk, cb) - }) -} - -function requestAll (cb) { - var cache = path.join(npm.cache, "/-/all", ".cache.json") - - mkdir(path.join(npm.cache, "-", "all"), function (er) { - fs.readFile(cache, function (er, data) { - if (er) return requestAll_(0, {}, cb) - try { - data = JSON.parse(data) - } catch (ex) { - fs.writeFile(cache, "{}", function (er) { - if (er) return cb(new Error("Broken cache. " - +"Please run 'npm cache clean' " - +"and try again.")) - return requestAll_(0, {}, cb) - }) - } - var t = +data._updated || 0 - requestAll_(t, data, cb) - }) - }) -} - -function requestAll_ (c, data, cb) { - // use the cache and update in the background if it's not too old - if (Date.now() - c < 60000) { - cb(null, data) - cb = function () {} - } - - var uri = "/-/all/since?stale=update_after&startkey=" + c - - if (c === 0) { - log.warn("Building the local index for the first time, please be patient") - uri = "/-/all" - } - - var cache = path.join(npm.cache, "-/all", ".cache.json") - GET(uri, function (er, updates, _, res) { - if (er) return cb(er, data) - var headers = res.headers - , updated = Date.parse(headers.date) - Object.keys(updates).forEach(function (p) { - data[p] = updates[p] - }) - data._updated = updated - fs.writeFile( cache, JSON.stringify(data) - , function (er) { - delete data._updated - return cb(er, data) - }) - }) -} - -function get_ (uri, timeout, cache, stat, data, nofollow, staleOk, cb) { - var etag - if (data && data._etag) etag = data._etag - if (timeout && timeout > 0 && stat && data) { - if ((Date.now() - stat.mtime.getTime())/1000 < timeout) { - log.verbose("not expired, no request", "registry.get " +uri) - delete data._etag - return cb(null, data, JSON.stringify(data), {statusCode:304}) - } - if (staleOk) { - log.verbose("staleOk, background update", "registry.get " +uri) - delete data._etag - process.nextTick(cb.bind( null, null, data, JSON.stringify(data) - , {statusCode: 304} )) - cb = function () {} - } - } - - GET(uri, etag, nofollow, function (er, remoteData, raw, response) { - // if we get an error talking to the registry, but we have it - // from the cache, then just pretend we got it. - if (er && cache && data && !data.error) { - er = null - response = {statusCode: 304} - } - - if (response) { - log.silly([response.statusCode, response.headers], "get cb") - if (response.statusCode === 304 && etag) { - remoteData = data - log.verbose(uri+" from cache", "etag") - } - } - - data = remoteData - if (!data) { - er = er || new Error("failed to fetch from registry: " + uri) - } - - if (er) return cb(er, data, raw, response) - - // just give the write the old college try. if it fails, whatever. - function saved () { - delete data._etag - cb(er, data, raw, response) - } - - saveToCache(cache, data, saved) - }) -} - -function saveToCache (cache, data, saved) { - if (cacheStat) { - return saveToCache_(cache, data, cacheStat.uid, cacheStat.gid, saved) - } - fs.stat(npm.cache, function (er, st) { - if (er) { - return fs.stat(process.env.HOME || "", function (er, st) { - // if this fails, oh well. - if (er) return saved() - cacheStat = st - return saveToCache(cache, data, saved) - }) - } - cacheStat = st || { uid: null, gid: null } - return saveToCache(cache, data, saved) - }) -} - -function saveToCache_ (cache, data, uid, gid, saved) { - mkdir(path.dirname(cache), function (er, made) { - if (er) return saved() - fs.writeFile(cache, JSON.stringify(data), function (er) { - if (er || uid === null || gid === null) { - return saved() - } - chownr(made || cache, uid, gid, saved) - }) - }) -} diff --git a/deps/npm/lib/utils/npm-registry-client/index.js b/deps/npm/lib/utils/npm-registry-client/index.js deleted file mode 100644 index 2a4294745..000000000 --- a/deps/npm/lib/utils/npm-registry-client/index.js +++ /dev/null @@ -1,16 +0,0 @@ - -// utilities for working with the js-registry site. - -var cached = {} -function lazyGet (p) { return function () { - return cached[p] || (cached[p] = require("./"+p+".js")) -}} - -function setLazyGet (p) { - Object.defineProperty(exports, p, - { get : lazyGet(p) - , enumerable : true }) -} - -; ["publish", "unpublish", "tag", "adduser", "get", "request", "star"] - .forEach(setLazyGet) diff --git a/deps/npm/lib/utils/npm-registry-client/publish.js b/deps/npm/lib/utils/npm-registry-client/publish.js deleted file mode 100644 index a196a3c07..000000000 --- a/deps/npm/lib/utils/npm-registry-client/publish.js +++ /dev/null @@ -1,170 +0,0 @@ - -module.exports = publish - -var request = require("./request.js") - , GET = request.GET - , PUT = request.PUT - , DELETE = request.DELETE - , reg = request.reg - , upload = request.upload - , log = require("../log.js") - , path = require("path") - , npm = require("../../npm.js") - , url = require("url") - -function publish (data, prebuilt, readme, cb) { - if (typeof readme === "function") cb = readme, readme = "" - if (typeof prebuilt === "function") cb = prebuilt, prebuilt = null - // add the dist-url to the data, pointing at the tarball. - // if the {name} isn't there, then create it. - // if the {version} is already there, then fail. - // then: - // PUT the data to {config.registry}/{data.name}/{data.version} - var registry = reg() - if (registry instanceof Error) return cb(registry) - - readme = readme ? "" + readme : "" - - var fullData = - { _id : data.name - , name : data.name - , description : data.description - , "dist-tags" : {} - , versions : {} - , readme: readme - , maintainers : - [ { name : npm.config.get("username") - , email : npm.config.get("email") - } - ] - } - - var tbName = data.name + "-" + data.version + ".tgz" - , bd = npm.config.get("bindist") - , pbName = data.name + "-" + data.version + "-" + bd + ".tgz" - , tbURI = data.name + "/-/" + tbName - , pbURI = data.name + "/-/" + pbName - - data._id = data.name+"@"+data.version - data.dist = data.dist || {} - data.dist.tarball = url.resolve(registry, tbURI) - .replace(/^https:\/\//, "http://") - - if (prebuilt && bd) { - data.dist.bin[bd] = data.dist.bin[bd] || {} - data.dist.bin[bd].tarball = url.resolve(registry, pbURI) - .replace(/^https:\/\//, "http://") - } - - - - - // first try to just PUT the whole fullData, and this will fail if it's - // already there, because it'll be lacking a _rev, so couch'll bounce it. - PUT(encodeURIComponent(data.name), fullData, - function (er, parsed, json, response) { - // get the rev and then upload the attachment - // a 409 is expected here, if this is a new version of an existing package. - if (er - && !(response && response.statusCode === 409) - && !( parsed - && parsed.reason === - "must supply latest _rev to update existing package" )) { - return log.er(cb, "Failed PUT response " - +(response && response.statusCode))(er) - } - var dataURI = encodeURIComponent(data.name) - + "/" + encodeURIComponent(data.version) - - var tag = data.tag || npm.config.get("tag") - if (npm.config.get("pre")) dataURI += "/-pre/true" - else if (tag) dataURI += "/-tag/" + tag - else dataURI += "/-tag/latest" - - // let's see what verions are already published. - // could be that we just need to update the bin dist values. - GET(data.name, function (er, fullData) { - if (er) return cb(er) - - var exists = fullData.versions && fullData.versions[data.version] - if (exists) { - log(exists._id, "Already published") - var ebin = exists.dist.bin || {} - , nbin = data.dist.bin || {} - , needs = Object.keys(nbin).filter(function (bd) { - return !ebin.hasOwnProperty(bd) - }) - log.verbose(needs, "uploading bin dists") - if (!needs.length) return cb(conflictError(data._id)) - // attach the needed bindists, upload the new metadata - exists.dist.bin = ebin - needs.forEach(function (bd) { exists.dist.bin[bd] = nbin[bd] }) - return PUT(dataURI + "/-rev/" + fullData._rev, exists, function (er) { - if (er) return cb(er) - attach(data.name, prebuilt, pbName, cb) - }) - } - - // this way, it'll also get attached to packages that were previously - // published with a version of npm that lacked this feature. - if (!fullData.readme) { - data.readme = readme - } - PUT(dataURI, data, function (er) { - if (er) { - if (er.message.indexOf("conflict Document update conflict.") === 0) { - return cb(conflictError(data._id)) - } - return log.er(cb, "Error sending version data")(er) - } - - var c = path.resolve(npm.cache, data.name, data.version) - , tb = path.resolve(c, "package.tgz") - - cb = rollbackFailure(data, cb) - - log.verbose([data.name, tb, tbName], "attach 2") - attach(data.name, tb, tbName, function (er) { - log.verbose([er, data.name, prebuilt, pbName], "attach 3") - if (er || !prebuilt) return cb(er) - attach(data.name, prebuilt, pbName, cb) - }) - }) - }) - }) -} - -function conflictError (pkgid) { - var e = new Error("publish fail") - e.errno = npm.EPUBLISHCONFLICT - e.pkgid = pkgid - return e -} - -function attach (doc, file, filename, cb) { - doc = encodeURIComponent(doc) - GET(doc, function (er, d) { - if (er) return cb(er) - if (!d) return cb(new Error( - "Attempting to upload to invalid doc "+doc)) - var rev = "-rev/"+d._rev - , attURI = doc + "/-/" + encodeURIComponent(filename) + "/" + rev - log.verbose([attURI, file], "uploading") - upload(attURI, file, cb) - }) -} - -function rollbackFailure (data, cb) { return function (er) { - if (!er) return cb() - npm.ROLLBACK = true - log.error(er, "publish failed") - log("rollback", "publish failed") - npm.commands.unpublish([data.name+"@"+data.version], function (er_) { - if (er_) { - log.error(er_, "rollback failed") - log.error( "Invalid data in registry! Please report this." - , "rollback failed" ) - } else log("rolled back", "publish failed") - cb(er) - }) -}} diff --git a/deps/npm/lib/utils/npm-registry-client/request.js b/deps/npm/lib/utils/npm-registry-client/request.js deleted file mode 100644 index d5122629d..000000000 --- a/deps/npm/lib/utils/npm-registry-client/request.js +++ /dev/null @@ -1,245 +0,0 @@ -module.exports = regRequest - -regRequest.GET = GET -regRequest.PUT = PUT -regRequest.reg = reg -regRequest.upload = upload - -var npm = require("../../npm.js") - , url = require("url") - , log = require("../log.js") - , fs = require("graceful-fs") - , rm = require("rimraf") - , asyncMap = require("slide").asyncMap - , warnedAuth = false - , newloctimeout = 0 - , stream = require("stream") - , Stream = stream.Stream - , request = require("request") - -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 - - // Since there are multiple places where an error could occur, - // don't let the cb be called more than once. - var errState = null - function cb (er) { - if (errState) return - if (er) errState = er - cb_.apply(null, arguments) - } - - if (where.match(/^\/?favicon.ico/)) { - return cb(new Error("favicon.ico isn't a package, it's a picture.")) - } - - var registry = reg() - if (registry instanceof Error) return cb(registry) - - var adduserChange = /^\/?-\/user\/org\.couchdb\.user:([^\/]+)\/-rev/ - , adduserNew = /^\/?-\/user\/org\.couchdb\.user:([^\/]+)/ - , authRequired = (what || npm.config.get("always-auth")) - && !where.match(adduserNew) - || where.match(adduserChange) - || method === "DELETE" - - // resolve to a full url on the registry - if (!where.match(/^https?:\/\//)) { - log.verbose(where, "raw, before any munging") - - var q = where.split("?") - where = q.shift() - q = q.join("?") - - if (where.charAt(0) !== "/") where = "/" + where - where = "." + where.split("/").map(function (p) { - p = p.trim() - if (p.match(/^org.couchdb.user/)) { - return p.replace(/\//g, encodeURIComponent("/")) - } - return encodeURIComponent(p) - }).join("/") - if (q) where += "?" + q - log.verbose([registry, where], "url resolving") - where = url.resolve(registry, where) - log.verbose(where, "url resolved") - } - - var remote = url.parse(where) - , auth = authRequired && npm.config.get("_auth") - - if (authRequired && !auth) { - return cb(new Error( - "Cannot insert data into the registry without authorization\n" - + "See: npm-adduser(1)")) - } - - if (auth) remote.auth = new Buffer(auth, "base64").toString("utf8") - - makeRequest(method, remote, where, what, etag, nofollow, cb) -} - -function makeRequest (method, remote, where, what, etag, nofollow, cb) { - var opts = { url: remote - , method: method - , ca: npm.config.get("ca") - , strictSSL: npm.config.get("strict-ssl") } - , headers = opts.headers = {} - if (etag) { - log.verbose(etag, "etag") - headers[method === "GET" ? "if-none-match" : "if-match"] = etag - } - - headers.accept = "application/json" - - headers["user-agent"] = npm.config.get("user-agent") - - opts.proxy = npm.config.get( remote.protocol === "https:" - ? "https-proxy" : "proxy" ) - - // figure out wth 'what' is - if (what) { - if (Buffer.isBuffer(what) || typeof what === "string") { - opts.body = what - headers["content-type"] = "application/json" - headers["content-length"] = Buffer.byteLength(what) - } else if (what instanceof Stream) { - headers["content-type"] = "application/octet-stream" - if (what.size) headers["content-length"] = what.size - } else { - delete what._etag - opts.json = what - } - } - - if (nofollow) { - opts.followRedirect = false - } - - log.http(remote.href || "/", method) - - var req = request(opts, requestDone(method, where, cb)) - var r = npm.config.get("registry") - if (!r) { - return new Error("Must define registry URL before accessing registry.") - } - - req.on("error", cb) - - if (what && (what instanceof Stream)) { - what.pipe(req) - } -} - -// cb(er, parsed, raw, response) -function requestDone (method, where, cb) { return function (er, response, data) { - if (er) return cb(er) - - log.http(response.statusCode + " " + url.parse(where).href) - - var parsed - - if (Buffer.isBuffer(data)) { - data = data.toString() - } - - if (data && typeof data === "string" && response.statusCode !== 304) { - try { - parsed = JSON.parse(data) - } catch (ex) { - ex.message += "\n" + data - log.verbose(data, "bad json") - log.error("error parsing json", "registry") - return cb(ex, null, data, response) - } - } else if (data) { - parsed = data - data = JSON.stringify(parsed) - } - - // expect data with any error codes - if (!data && response.statusCode >= 400) { - return cb( response.statusCode + " " - + require("http").STATUS_CODES[response.statusCode] - , null, data, response ) - } - - var er = null - if (parsed && response.headers.etag) { - parsed._etag = response.headers.etag - } - - if (parsed && parsed.error && response.statusCode >= 400) { - var w = url.parse(where).pathname.substr(1) - if (!w.match(/^-/) && parsed.error === "not_found") { - w = w.split("/") - name = w[w.indexOf("_rewrite") + 1] - er = new Error("404 Not Found: "+name) - er.errno = npm.E404 - er.pkgid = name - } else { - er = new Error( - parsed.error + " " + (parsed.reason || "") + ": " + w) - } - } else if (method !== "HEAD" && method !== "GET") { - // invalidate cache - // This is irrelevant for commands that do etag caching, but - // ls and view also have a timed cache, so this keeps the user - // from thinking that it didn't work when it did. - // Note that failure is an acceptable option here, since the - // only result will be a stale cache for some helper commands. - var path = require("path") - , p = url.parse(where).pathname.split("/") - , _ = "/" - , caches = p.map(function (part) { - return _ = path.join(_, part) - }).map(function (cache) { - return path.join(npm.cache, cache, ".cache.json") - }) - - // if the method is DELETE, then also remove the thing itself. - // Note that the search index is probably invalid. Whatever. - // That's what you get for deleting stuff. Don't do that. - if (method === "DELETE") { - p = p.slice(0, p.indexOf("-rev")) - caches.push(path.join(npm.cache, p.join("/"))) - } - - asyncMap(caches, rm, function () {}) - } - return cb(er, parsed, data, response) -}} - -function GET (where, etag, nofollow, cb) { - regRequest("GET", where, null, etag, nofollow, cb) -} - -function PUT (where, what, etag, nofollow, cb) { - regRequest("PUT", where, what, etag, nofollow, cb) -} - -function upload (where, filename, etag, nofollow, cb) { - if (typeof nofollow === "function") cb = nofollow, nofollow = false - if (typeof etag === "function") cb = etag, etag = null - - fs.stat(filename, function (er, stat) { - if (er) return cb(er) - var s = fs.createReadStream(filename) - s.size = stat.size - s.on("error", cb) - - PUT(where, s, etag, nofollow, cb) - }) -} - -function reg () { - var r = npm.config.get("registry") - if (!r) { - return new Error("Must define registry URL before accessing registry.") - } - if (r.substr(-1) !== "/") r += "/" - npm.config.set("registry", r) - return r -} diff --git a/deps/npm/lib/utils/npm-registry-client/star.js b/deps/npm/lib/utils/npm-registry-client/star.js deleted file mode 100644 index 474a1786d..000000000 --- a/deps/npm/lib/utils/npm-registry-client/star.js +++ /dev/null @@ -1,32 +0,0 @@ - -module.exports = star - -var request = require("./request.js") - , GET = request.GET - , PUT = request.PUT - , log = require("../log.js") - , npm = require("../../npm.js") - -function star (package, starred, cb) { - var users = {} - - GET(package, function (er, fullData) { - if (er) return cb(er) - - fullData = { _id: fullData._id - , _rev: fullData._rev - , users: fullData.users || {} } - - if (starred) { - log.info("starring", fullData._id) - fullData.users[npm.config.get("username")] = true - log.verbose(fullData) - } else { - delete fullData.users[npm.config.get("username")] - log.info("unstarring", fullData._id) - log.verbose(fullData) - } - - return PUT(package, fullData, cb) - }) -} diff --git a/deps/npm/lib/utils/npm-registry-client/tag.js b/deps/npm/lib/utils/npm-registry-client/tag.js deleted file mode 100644 index 4d88a98db..000000000 --- a/deps/npm/lib/utils/npm-registry-client/tag.js +++ /dev/null @@ -1,8 +0,0 @@ - -module.exports = tag - -var PUT = require("./request.js").PUT - -function tag (project, version, tag, cb) { - PUT(project+"/"+tag, JSON.stringify(version), cb) -} diff --git a/deps/npm/lib/utils/npm-registry-client/unpublish.js b/deps/npm/lib/utils/npm-registry-client/unpublish.js deleted file mode 100644 index 0c7c44991..000000000 --- a/deps/npm/lib/utils/npm-registry-client/unpublish.js +++ /dev/null @@ -1,98 +0,0 @@ - -// fetch the data -// modify to remove the version in question -// If no versions remaining, then DELETE -// else, PUT the modified data -// delete the tarball - -module.exports = unpublish - -var request = require("./request.js") - , log = require("../log.js") - , get = require("./get.js") - , semver = require("semver") - , url = require("url") - , chain = require("slide").chain - -function unpublish (name, ver, cb) { - if (!cb) cb = ver, ver = null - if (!cb) throw new Error( - "Not enough arguments for registry unpublish") - - get(name, null, -1, true, function (er, data) { - if (er) return log(name+" not published", "unpublish", cb) - // remove all if no version specified - if (!ver) { - log("No version specified, removing all", "unpublish") - return request("DELETE", name+'/-rev/'+data._rev, cb) - } - - var versions = data.versions || {} - , versionPublic = versions.hasOwnProperty(ver) - - if (!versionPublic) log(name+"@"+ver+" not published", "unpublish") - else { - var dist = versions[ver].dist - log.verbose(dist, "removing attachments") - } - - delete versions[ver] - // if it was the only version, then delete the whole package. - if (!Object.keys(versions).length) { - log("No versions remain, removing entire package", "unpublish") - return request("DELETE", name+"/-rev/"+data._rev, cb) - } - - if (!versionPublic) return cb() - - var latestVer = data["dist-tags"].latest - for (var tag in data["dist-tags"]) { - if (data["dist-tags"][tag] === ver) delete data["dist-tags"][tag] - } - - if (latestVer === ver) { - data["dist-tags"].latest = - Object.getOwnPropertyNames(versions).sort(semver.compare).pop() - } - - var rev = data._rev - delete data._revisions - delete data._attachments - // log(data._rev, "rev") - request.PUT(name+"/-rev/"+rev, data, - log.er(detacher(data, dist, cb), "Failed to update the data")) - }) -} - -function detacher (data, dist, cb) { return function (er) { - if (er) return cb(er) - get(data.name, function (er, data) { - if (er) return cb(er) - - var tb = url.parse(dist.tarball) - - detach(data, tb.pathname, data._rev, function (er) { - if (er || !dist.bin) return cb(er) - chain(Object.keys(dist.bin).map(function (bt) { - return function (cb) { - var d = dist.bin[bt] - detach(data, url.parse(d.tarball).pathname, null, cb) - } - }), cb) - }) - }) -}} - -function detach (data, path, rev, cb) { - if (rev) { - path += "/-rev/" + rev - log(path, "detach") - return request("DELETE", path, cb) - } - get(data.name, function (er, data) { - rev = data._rev - if (!rev) return cb(new Error( - "No _rev found in "+data._id)) - detach(data, path, rev, cb) - }) -} diff --git a/deps/npm/lib/utils/read-installed.js b/deps/npm/lib/utils/read-installed.js index ff220943d..3776f9019 100644 --- a/deps/npm/lib/utils/read-installed.js +++ b/deps/npm/lib/utils/read-installed.js @@ -93,7 +93,7 @@ var npm = require("../npm.js") , asyncMap = require("slide").asyncMap , semver = require("semver") , readJson = require("./read-json.js") - , log = require("./log.js") + , log = require("npmlog") , url = require("url") module.exports = readInstalled @@ -186,13 +186,26 @@ function readInstalled_ (folder, parent, name, reqver, depth, maxDepth, cb) { if (parent && !obj.link) obj.parent = parent rpSeen[real] = obj obj.depth = depth - if (depth >= maxDepth) return cb(null, obj) + //if (depth >= maxDepth) return cb(null, obj) asyncMap(installed, function (pkg, cb) { var rv = obj.dependencies[pkg] if (!rv && obj.devDependencies) rv = obj.devDependencies[pkg] + if (depth >= maxDepth) { + // just try to get the version number + var pkgfolder = path.resolve(folder, "node_modules", pkg) + , jsonFile = path.resolve(pkgfolder, "package.json") + return readJson(jsonFile, function (er, depData) { + // already out of our depth, ignore errors + if (er || !depData || !depData.version) return cb(null, obj) + obj.dependencies[pkg] = depData.version + cb(null, obj) + }) + } + readInstalled_( path.resolve(folder, "node_modules/"+pkg) , obj, pkg, obj.dependencies[pkg], depth + 1, maxDepth , cb ) + }, function (er, installedData) { if (er) return cb(er) installedData.forEach(function (dep) { @@ -259,17 +272,17 @@ function findUnmet (obj) { && !url.parse(deps[d]).protocol && !semver.satisfies(found.version, deps[d])) { // the bad thing will happen - log.warn(obj.path + " requires "+d+"@'"+deps[d] + log.warn("unmet dependency", obj.path + " requires "+d+"@'"+deps[d] +"' but will load\n" +found.path+",\nwhich is version "+found.version - ,"unmet dependency") + ) found.invalid = true } deps[d] = found } }) - log.verbose([obj._id], "returning") + log.verbose("readInstalled", "returning", obj._id) return obj } diff --git a/deps/npm/lib/utils/read-json.js b/deps/npm/lib/utils/read-json.js index d1bba10f5..146f46062 100644 --- a/deps/npm/lib/utils/read-json.js +++ b/deps/npm/lib/utils/read-json.js @@ -8,7 +8,7 @@ readJson.clearCache = clearCache var fs = require("graceful-fs") , semver = require("semver") , path = require("path") - , log = require("./log.js") + , log = require("npmlog") , npm = require("../npm.js") , cache = {} , timers = {} @@ -17,19 +17,12 @@ var fs = require("graceful-fs") function readJson (jsonFile, opts, cb) { if (typeof cb !== "function") cb = opts, opts = {} if (cache.hasOwnProperty(jsonFile)) { - log.verbose(jsonFile, "from cache") + log.verbose("json from cache", jsonFile) return cb(null, cache[jsonFile]) } + log.verbose("read json", jsonFile) + opts.file = jsonFile - if (!opts.tag) { - var parsedPath = jsonFile.indexOf(npm.dir) === 0 && jsonFile.match( - /\/([^\/]+)\/([^\/]+)\/package\/package\.json$/) - if (parsedPath && semver.valid(parsedPath[2])) { - // this is a package.json in some installed package. - // infer the opts.tag so that linked packages behave right. - opts.tag = parsedPath[2] - } - } var wscript = null , contributors = null @@ -180,8 +173,7 @@ function processJsonString (opts, cb) { return function (er, jsonString) { if (opts.file && opts.file.indexOf(npm.dir) === 0) { try { json = require("vm").runInNewContext("(\n"+jsonString+"\n)") - log.error(opts.file, "Error parsing json") - log.error(ex, "parse error ") + log.error("Error parsing json", opts.file, ex) } catch (ex2) { return jsonParseFail(ex, opts.file, cb) } @@ -196,7 +188,7 @@ function processJsonString (opts, cb) { return function (er, jsonString) { function jsonParseFail (ex, file, cb) { var e = new Error( "Failed to parse json\n"+ex.message) - e.errno = npm.EJSONPARSE + e.code = "EJSONPARSE" e.file = file if (cb) return cb(e) throw e @@ -209,7 +201,7 @@ function typoWarn (json) { typoWarned[json._id] = true if (json.modules) { - log.warn("package.json: 'modules' object is deprecated", json._id) + log.verbose("package.json", "'modules' object is deprecated", json._id) delete json.modules } @@ -235,8 +227,8 @@ function typoWarn (json) { Object.keys(typos).forEach(function (d) { if (json.hasOwnProperty(d)) { - log.warn( "package.json: '" + d + "' should probably be '" - + typos[d] + "'", json._id) + log.warn( json._id, "package.json: '" + d + "' should probably be '" + + typos[d] + "'" ) } }) @@ -259,8 +251,9 @@ function typoWarn (json) { var scriptTypos = { "server": "start" } if (json.scripts) Object.keys(scriptTypos).forEach(function (d) { if (json.scripts.hasOwnProperty(d)) { - log.warn( "package.json: scripts['" + d + "'] should probably be " - + "scripts['" + scriptTypos[d] + "']", json._id) + log.warn( json._id + , "package.json: scripts['" + d + "'] should probably be " + + "scripts['" + scriptTypos[d] + "']" ) } }) } @@ -268,7 +261,6 @@ function typoWarn (json) { function processObject (opts, cb) { return function (er, json) { // json._npmJsonOpts = opts - // log.warn(json, "processing json") if (npm.config.get("username")) { json._npmUser = { name: npm.config.get("username") , email: npm.config.get("email") } @@ -310,7 +302,7 @@ function processObject (opts, cb) { return function (er, json) { // uncomment once this is no longer an issue. // if (cb) return cb(e) // throw e - log.error(msg, "incorrect json: "+json.name) + log.error("json", "incorrect json: "+json.name, msg) json.repostory = json.repositories[0] delete json.repositories } @@ -335,14 +327,14 @@ function processObject (opts, cb) { return function (er, json) { } if (repo.match(/github\.com\/[^\/]+\/[^\/]+\/?$/) && repo.match(/\.git\.git$/)) { - log.warn(repo, "Probably broken git url") + log.warn(json._id, "Probably broken git url", repo) } json.repository.url = repo } var files = json.files if (files && !Array.isArray(files)) { - log.warn(files, "Invalid 'files' member. See 'npm help json'") + log.warn(json._id, "Invalid 'files' member. See 'npm help json'", files) delete json.files } @@ -354,14 +346,11 @@ function processObject (opts, cb) { return function (er, json) { json._id = json.name+"@"+json.version - var tag = opts.tag - if (tag) json.version = tag - var scripts = json.scripts || {} // if it has a bindings.gyp, then build with node-gyp if (opts.gypfile && !json.prebuilt) { - log.verbose([json.prebuilt, opts], "has bindings.gyp") + log.verbose(json._id, "has bindings.gyp", [json.prebuilt, opts]) if (!scripts.install && !scripts.preinstall) { scripts.install = "node-gyp rebuild" json.scripts = scripts @@ -370,7 +359,7 @@ function processObject (opts, cb) { return function (er, json) { // if it has a wscript, then build it. if (opts.wscript && !json.prebuilt) { - log.verbose([json.prebuilt, opts], "has wscript") + log.verbose(json._id, "has wscript", [json.prebuilt, opts]) if (!scripts.install && !scripts.preinstall) { // don't fail if it was unexpected, just try. scripts.preinstall = "node-waf clean || (exit 0); node-waf configure build" @@ -460,7 +449,7 @@ function processObject (opts, cb) { return function (er, json) { json._npmVersion = npm.version json._nodeVersion = process.version if (opts.file) { - log.verbose(opts.file, "caching") + log.verbose("caching json", opts.file) cache[opts.file] = json // arbitrary var keys = Object.keys(cache) @@ -522,8 +511,9 @@ function testEngine (json) { } if (json.engines.node === "") json.engines.node = "*" if (json.engines.node && null === semver.validRange(json.engines.node)) { - log.warn( json.engines.node - , "Invalid range in engines.node. Please see `npm help json`" ) + log.warn( json._id + , "Invalid range in engines.node. Please see `npm help json`" + , json.engines.node ) } if (nodeVer) { diff --git a/deps/npm/lib/utils/sha.js b/deps/npm/lib/utils/sha.js index 17b8c38f9..d3cd83a93 100644 --- a/deps/npm/lib/utils/sha.js +++ b/deps/npm/lib/utils/sha.js @@ -1,7 +1,7 @@ var fs = require("graceful-fs") , crypto = require("crypto") - , log = require("./log.js") + , log = require("npmlog") , binding try { binding = process.binding("crypto") } @@ -12,11 +12,14 @@ exports.get = get function check (file, sum, cb) { if (!binding) { - log.warn("crypto binding not found. Cannot verify shasum.", "shasum") + log.warn("shasum", "crypto binding not found. Cannot verify shasum.") return cb() } get(file, function (er, actual) { - if (er) return log.er(cb, "Error getting shasum")(er) + if (er) { + log.error("shasum", "error getting shasum") + return cb(er) + } var expected = sum.toLowerCase().trim() , ok = actual === expected cb(ok ? null : new Error( @@ -28,7 +31,7 @@ function check (file, sum, cb) { function get (file, cb) { if (!binding) { - log.warn("crypto binding not found. Cannot verify shasum.", "shasum") + log.warn("shasum", "crypto binding not found. Cannot verify shasum.") return cb() } var h = crypto.createHash("sha1") @@ -36,16 +39,16 @@ function get (file, cb) { , errState = null s.on("error", function (er) { if (errState) return - log.silly(er.stack || er.message, "sha error") + log.silly("shasum", "error", er) return cb(errState = er) }).on("data", function (chunk) { if (errState) return - log.silly(chunk.length, "updated sha bytes") + log.silly("shasum", "updated bytes", chunk.length) h.update(chunk) }).on("end", function () { if (errState) return var actual = h.digest("hex").toLowerCase().trim() - log(actual+"\n"+file, "shasum") + log.info("shasum", actual+"\n"+file) cb(null, actual) }) } diff --git a/deps/npm/lib/utils/tar.js b/deps/npm/lib/utils/tar.js index 76ef6ea92..22a4a852c 100644 --- a/deps/npm/lib/utils/tar.js +++ b/deps/npm/lib/utils/tar.js @@ -4,7 +4,7 @@ var npm = require("../npm.js") , fs = require("graceful-fs") , path = require("path") - , log = require("./log.js") + , log = require("npmlog") , uidNumber = require("uid-number") , rm = require("rimraf") , readJson = require("./read-json.js") @@ -27,11 +27,11 @@ exports.pack = pack exports.unpack = unpack function pack (targetTarball, folder, pkg, dfc, cb) { - log.verbose([targetTarball, folder], "tar.pack") + log.verbose("tar pack", [targetTarball, folder]) if (typeof cb !== "function") cb = dfc, dfc = false - log.verbose(targetTarball, "tarball") - log.verbose(folder, "folder") + log.verbose("tarball", targetTarball) + log.verbose("folder", folder) if (dfc) { // do fancy crap @@ -46,7 +46,10 @@ function pack (targetTarball, folder, pkg, dfc, cb) { function pack_ (targetTarball, folder, pkg, cb) { new Packer({ path: folder, type: "Directory", isDirectory: true }) - .on("error", log.er(cb, "error reading "+folder)) + .on("error", function (er) { + if (er) log.error("tar pack", "Error reading " + folder) + return cb(er) + }) // By default, npm includes some proprietary attributes in the // package tarball. This is sane, and allowed by the spec. @@ -54,19 +57,26 @@ function pack_ (targetTarball, folder, pkg, cb) { // so that it can be more easily bootstrapped using old and // non-compliant tar implementations. .pipe(tar.Pack({ noProprietary: !npm.config.get("proprietary-attribs") })) - .on("error", log.er(cb, "tar creation error "+targetTarball)) + .on("error", function (er) { + if (er) log.error("tar.pack", "tar creation error", targetTarball) + cb(er) + }) .pipe(zlib.Gzip()) - .on("error", log.er(cb, "gzip error "+targetTarball)) + .on("error", function (er) { + if (er) log.error("tar.pack", "gzip error "+targetTarball) + cb(er) + }) .pipe(fstream.Writer({ type: "File", path: targetTarball })) - .on("error", log.er(cb, "Could not write "+targetTarball)) - .on("close", function () { - cb() + .on("error", function (er) { + if (er) log.error("tar.pack", "Could not write "+targetTarball) + cb(er) }) + .on("close", cb) } function unpack (tarball, unpackTarget, dMode, fMode, uid, gid, cb) { - log.verbose(tarball, "unpack") + log.verbose("tar unpack", tarball) if (typeof cb !== "function") cb = gid, gid = null if (typeof cb !== "function") cb = uid, uid = null if (typeof cb !== "function") cb = fMode, fMode = npm.modes.file @@ -101,7 +111,7 @@ function unpack_ ( tarball, unpackTarget, dMode, fMode, uid, gid, cb ) { function gunzTarPerm (tarball, target, dMode, fMode, uid, gid, cb_) { if (!dMode) dMode = npm.modes.exec if (!fMode) fMode = npm.modes.file - log.silly([dMode.toString(8), fMode.toString(8)], "gunzTarPerm modes") + log.silly("gunzTarPerm", "modes", [dMode.toString(8), fMode.toString(8)]) var cbCalled = false function cb (er) { @@ -120,7 +130,7 @@ function gunzTarPerm (tarball, target, dMode, fMode, uid, gid, cb_) { } function extractEntry (entry) { - log.silly(entry.path, "extracting entry") + log.silly("gunzTarPerm", "extractEntry", entry.path) // never create things that are user-unreadable, // or dirs that are user-un-listable. Only leads to headaches. var originalMode = entry.mode = entry.mode || entry.props.mode @@ -128,7 +138,8 @@ function gunzTarPerm (tarball, target, dMode, fMode, uid, gid, cb_) { entry.mode = entry.mode & (~npm.modes.umask) entry.props.mode = entry.mode if (originalMode !== entry.mode) { - log.silly([entry.path, originalMode, entry.mode], "modified mode") + log.silly( "gunzTarPerm", "modified mode" + , [entry.path, originalMode, entry.mode]) } // if there's a specific owner uid/gid that we want, then set that @@ -152,16 +163,19 @@ function gunzTarPerm (tarball, target, dMode, fMode, uid, gid, cb_) { extractOpts.filter = function () { // symbolic links are not allowed in packages. if (this.type.match(/^.*Link$/)) { - log.warn( this.path.substr(target.length + 1) - + ' -> ' + this.linkpath - , "excluding symbolic link") + log.warn( "excluding symbolic link" + , this.path.substr(target.length + 1) + + ' -> ' + this.linkpath ) return false } return true } - fst.on("error", log.er(cb, "error reading "+tarball)) + fst.on("error", function (er) { + if (er) log.error("tar.unpack", "error reading "+tarball) + cb(er) + }) fst.on("data", function OD (c) { // detect what it is. // Then, depending on that, we'll figure out whether it's @@ -172,17 +186,26 @@ function gunzTarPerm (tarball, target, dMode, fMode, uid, gid, cb_) { c[2] === 0x08) { fst .pipe(zlib.Unzip()) - .on("error", log.er(cb, "unzip error "+tarball)) + .on("error", function (er) { + if (er) log.error("tar.unpack", "unzip error "+tarball) + cb(er) + }) .pipe(tar.Extract(extractOpts)) .on("entry", extractEntry) - .on("error", log.er(cb, "untar error "+tarball)) + .on("error", function (er) { + if (er) log.error("tar.unpack", "untar error "+tarball) + cb(er) + }) .on("close", cb) } else if (c.toString().match(/^package\//)) { // naked tar fst .pipe(tar.Extract(extractOpts)) .on("entry", extractEntry) - .on("error", log.er(cb, "untar error "+tarball)) + .on("error", function (er) { + if (er) log.error("tar.unpack", "untar error "+tarball) + cb(er) + }) .on("close", cb) } else { // naked js file @@ -197,12 +220,15 @@ function gunzTarPerm (tarball, target, dMode, fMode, uid, gid, cb_) { fst .pipe(fstream.Writer(jsOpts)) - .on("error", log.er(cb, "copy error "+tarball)) + .on("error", function (er) { + if (er) log.error("tar.unpack", "copy error "+tarball) + cb(er) + }) .on("close", function () { var j = path.resolve(target, "package.json") readJson(j, function (er, d) { if (er) { - log.error(tarball, "Not a package") + log.error("not a package", tarball) return cb(er) } fs.writeFile(j, JSON.stringify(d) + "\n", cb) diff --git a/deps/npm/lib/version.js b/deps/npm/lib/version.js index febb56d73..35329760e 100644 --- a/deps/npm/lib/version.js +++ b/deps/npm/lib/version.js @@ -8,7 +8,7 @@ var exec = require("./utils/exec.js") , path = require("path") , fs = require("graceful-fs") , chain = require("slide").chain - , log = require("./utils/log.js") + , log = require("npmlog") , npm = require("./npm.js") version.usage = "npm version <newversion> [--message commit-message]" @@ -22,7 +22,10 @@ version.usage = "npm version <newversion> [--message commit-message]" function version (args, cb) { if (args.length !== 1) return cb(version.usage) readJson(path.join(process.cwd(), "package.json"), function (er, data) { - if (er) return log.er(cb, "No package.json found")(er) + if (er) { + log.error("version", "No package.json found") + return cb(er) + } var newVer = semver.valid(args[0]) if (!newVer) newVer = semver.inc(data.version, args[0]) if (!newVer) return cb(version.usage) diff --git a/deps/npm/lib/view.js b/deps/npm/lib/view.js index 33a5d0df8..6ffde4c28 100644 --- a/deps/npm/lib/view.js +++ b/deps/npm/lib/view.js @@ -39,12 +39,12 @@ view.completion = function (opts, cb) { } } -var registry = require("./utils/npm-registry-client/index.js") +var npm = require("./npm.js") + , registry = npm.registry , ini = require("ini") - , log = require("./utils/log.js") + , log = require("npmlog") , util = require("util") , output - , npm = require("./npm.js") , semver = require("semver") , readJson = require("./utils/read-json.js") @@ -59,7 +59,7 @@ function view (args, silent, cb) { if (name === ".") return cb(view.usage) // get the data about this package - registry.get(name, null, 600, function (er, data) { + registry.get(name, 600, function (er, data) { if (er) return cb(er) if (data["dist-tags"].hasOwnProperty(version)) { version = data["dist-tags"][version] @@ -94,7 +94,7 @@ function view (args, silent, cb) { if (args.length === 1 && args[0] === "") { retval = cleanBlanks(retval) - log.silly(retval, "cleanup") + log.silly("cleanup", retval) } if (error || silent) cb(error, retval) diff --git a/deps/npm/lib/whoami.js b/deps/npm/lib/whoami.js index c48f04b1d..b6e495253 100644 --- a/deps/npm/lib/whoami.js +++ b/deps/npm/lib/whoami.js @@ -2,7 +2,6 @@ module.exports = whoami var npm = require("./npm.js") , output = require("./utils/output.js") - , log = require("./utils/log.js") whoami.usage = "npm whoami\n(just prints the 'username' config)" diff --git a/deps/npm/lib/xmas.js b/deps/npm/lib/xmas.js index 90282d0f7..bf838a87a 100644 --- a/deps/npm/lib/xmas.js +++ b/deps/npm/lib/xmas.js @@ -1,9 +1,8 @@ // happy xmas var npm = require("./npm.js") - , log = require("./utils/log.js") + , log = require("npmlog") module.exports = function (args, cb) { -npm.config.set("loglevel", "win") var s = process.platform === "win32" ? " *" : " \u2605" , f = "\uFF0F" , b = "\uFF3C" @@ -44,7 +43,10 @@ w("\n") } })(20) w("\n\n") -log.win("Happy Xmas, Noders!", "loves you", cb) +log.heading = '' +log.addLevel('npm', 100000, log.headingStyle) +log.npm("loves you", "Happy Xmas, Noders!") +cb() } var dg=false Object.defineProperty(module.exports, "usage", {get:function () { diff --git a/deps/npm/man/man1/coding-style.1 b/deps/npm/man/man1/coding-style.1 index 16f27621b..11adb5f98 100644 --- a/deps/npm/man/man1/coding-style.1 +++ b/deps/npm/man/man1/coding-style.1 @@ -187,37 +187,19 @@ Just send the error message back as the first argument to the callback\. Always create a new Error object with your message\. Don\'t just return a string message to the callback\. Stack traces are handy\. . -.P -Use the \fBrequire("\./utils/log")\.er\fR function\. It takes a callback and an -error message, and returns an object that will report the message in the -event of a failure\. It\'s quite handy\. -. -.IP "" 4 -. -.nf -function myThing (args, cb) { - getData(args, function (er, data) { - if (er) return log\.er(cb, "Couldn\'t get data")(er) - doSomethingElse(data, cb) - }) -} -function justHasToWork (cb) { - doSomething(log\.er(cb, "the doSomething failed\.")) -} -. -.fi -. -.IP "" 0 -. .SH "Logging" +Logging is done using the npmlog \fIhttps://github\.com/isaacs/npmlog\fR +utility\. +. +.P Please clean up logs when they are no longer helpful\. In particular, logging the same object over and over again is not helpful\. Logs should report what\'s happening so that it\'s easier to track down where a fault occurs\. . .P -Use appropriate log levels\. The default log() function logs at the -"info" level\. See \fBnpm help config\fR and search for "loglevel"\. +Use appropriate log levels\. See \fBnpm help config\fR and search for +"loglevel"\. . .SH "Case, naming, etc\." Use \fBlowerCamelCase\fR for multiword identifiers when they refer to objects, diff --git a/deps/npm/man/man1/config.1 b/deps/npm/man/man1/config.1 index d5c8ac504..59c44d3d6 100644 --- a/deps/npm/man/man1/config.1 +++ b/deps/npm/man/man1/config.1 @@ -734,19 +734,6 @@ being installed locally\. . .IP "" 0 . -.SS "logfd" -. -.IP "\(bu" 4 -Default: stderr file descriptor -. -.IP "\(bu" 4 -Type: Number or Stream -. -.IP "" 0 -. -.P -The location to write log output\. -. .SS "loglevel" . .IP "\(bu" 4 @@ -767,20 +754,6 @@ What level of logs to report\. On failure, \fIall\fR logs are written to \fBnpm Any logs of a higher level than the setting are shown\. The default is "http", which shows http, warn, and error output\. . -.SS "logprefix" -. -.IP "\(bu" 4 -Default: true on Posix, false on Windows -. -.IP "\(bu" 4 -Type: Boolean -. -.IP "" 0 -. -.P -Whether or not to prefix log messages with "npm" and the log level\. See -also "color" and "loglevel"\. -. .SS "long" . .IP "\(bu" 4 @@ -863,19 +836,6 @@ Type: path A node module to \fBrequire()\fR when npm loads\. Useful for programmatic usage\. . -.SS "outfd" -. -.IP "\(bu" 4 -Default: standard output file descriptor -. -.IP "\(bu" 4 -Type: Number or Stream -. -.IP "" 0 -. -.P -Where to write "normal" output\. This has no effect on log output\. -. .SS "parseable" . .IP "\(bu" 4 diff --git a/deps/npm/man/man1/npm.1 b/deps/npm/man/man1/npm.1 index 21584cbe9..553b4bf4b 100644 --- a/deps/npm/man/man1/npm.1 +++ b/deps/npm/man/man1/npm.1 @@ -14,7 +14,7 @@ npm <command> [args] .fi . .SH "VERSION" -1.1.24 +1.1.25 . .SH "DESCRIPTION" npm is the package manager for the Node JavaScript platform\. It puts diff --git a/deps/npm/man/man3/npm.3 b/deps/npm/man/man3/npm.3 index b9e685423..fbb2b865d 100644 --- a/deps/npm/man/man3/npm.3 +++ b/deps/npm/man/man3/npm.3 @@ -21,7 +21,7 @@ npm\.load(configObject, function (er, npm) { .fi . .SH "VERSION" -1.1.24 +1.1.25 . .SH "DESCRIPTION" This is the API documentation for npm\. diff --git a/deps/npm/node_modules/mkdirp/package.json b/deps/npm/node_modules/mkdirp/package.json index 2a393e97a..f77965837 100644 --- a/deps/npm/node_modules/mkdirp/package.json +++ b/deps/npm/node_modules/mkdirp/package.json @@ -1,7 +1,7 @@ { "name": "mkdirp", "description": "Recursively mkdir, like `mkdir -p`", - "version": "0.3.2", + "version": "0.3.3", "author": { "name": "James Halliday", "email": "mail@substack.net", @@ -30,15 +30,12 @@ "name": "isaacs", "email": "i@izs.me" }, - "_id": "mkdirp@0.3.2", + "_id": "mkdirp@0.3.3", "dependencies": {}, "optionalDependencies": {}, "_engineSupported": true, - "_npmVersion": "1.1.23", + "_npmVersion": "1.1.24", "_nodeVersion": "v0.7.10-pre", "_defaultsLoaded": true, - "dist": { - "shasum": "bebd1a16759571a6bd30f89a7edffc38ad442881" - }, - "_from": "../mkdirp" + "_from": "mkdirp@0.3" } diff --git a/deps/npm/node_modules/node-gyp/node_modules/ansi/package.json b/deps/npm/node_modules/node-gyp/node_modules/ansi/package.json index d8a5c2987..5c9fca11b 100644 --- a/deps/npm/node_modules/node-gyp/node_modules/ansi/package.json +++ b/deps/npm/node_modules/node-gyp/node_modules/ansi/package.json @@ -41,7 +41,7 @@ "dependencies": {}, "optionalDependencies": {}, "_engineSupported": true, - "_npmVersion": "1.1.23", + "_npmVersion": "1.1.24", "_nodeVersion": "v0.7.10-pre", "_defaultsLoaded": true, "_from": "ansi@0.0.x" diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/package.json b/deps/npm/node_modules/node-gyp/node_modules/glob/package.json index 3589c368f..c1e8ce509 100644 --- a/deps/npm/node_modules/node-gyp/node_modules/glob/package.json +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/package.json @@ -36,7 +36,7 @@ "_id": "glob@3.1.9", "optionalDependencies": {}, "_engineSupported": true, - "_npmVersion": "1.1.23", + "_npmVersion": "1.1.24", "_nodeVersion": "v0.7.10-pre", "_defaultsLoaded": true, "_from": "glob@3" diff --git a/deps/npm/node_modules/node-gyp/package.json b/deps/npm/node_modules/node-gyp/package.json index 83be556c7..f4d762868 100644 --- a/deps/npm/node_modules/node-gyp/package.json +++ b/deps/npm/node_modules/node-gyp/package.json @@ -51,11 +51,8 @@ "devDependencies": {}, "optionalDependencies": {}, "_engineSupported": true, - "_npmVersion": "1.1.23", + "_npmVersion": "1.1.24", "_nodeVersion": "v0.7.10-pre", "_defaultsLoaded": true, - "dist": { - "shasum": "9ddb9c4218322fd3d6b9771b27c236c4e5965e3b" - }, - "_from": "node-gyp@~0.4.4" + "_from": "node-gyp@~0.4.5" } diff --git a/deps/npm/node_modules/request/README.md b/deps/npm/node_modules/request/README.md index e5839b50e..639d1a45a 100644 --- a/deps/npm/node_modules/request/README.md +++ b/deps/npm/node_modules/request/README.md @@ -156,7 +156,6 @@ The first argument can be either a url or an options object. The only required o * `followRedirect` - follow HTTP 3xx responses as redirects. defaults to true. * `followAllRedirects` - follow non-GET HTTP 3xx responses as redirects. defaults to false. * `maxRedirects` - the maximum number of redirects to follow, defaults to 10. -* `onResponse` - If true the callback will be fired on the "response" event instead of "end". If a function it will be called on "response" and not effect the regular semantics of the main callback on "end". * `encoding` - Encoding to be used on `setEncoding` of response data. If set to `null`, the body is returned as a Buffer. * `pool` - A hash object containing the agents for these requests. If omitted this request will use the global pool which is set to node's default maxSockets. * `pool.maxSockets` - Integer containing the maximum amount of sockets in the pool. diff --git a/deps/npm/node_modules/request/main.js b/deps/npm/node_modules/request/main.js index 5a6bd9eb0..d734b0858 100644 --- a/deps/npm/node_modules/request/main.js +++ b/deps/npm/node_modules/request/main.js @@ -119,6 +119,8 @@ Request.prototype.init = function (options) { self._callback.apply(self, arguments) self._callbackCalled = true } + self.on('error', self.callback.bind()) + self.on('complete', self.callback.bind(self, null)) } if (self.url) { @@ -137,11 +139,12 @@ Request.prototype.init = function (options) { // do the HTTP CONNECT dance using koichik/node-tunnel if (http.globalAgent && self.uri.protocol === "https:") { + self.tunnel = true var tunnelFn = self.proxy.protocol === "http:" ? tunnel.httpsOverHttp : tunnel.httpsOverHttps var tunnelOptions = { proxy: { host: self.proxy.hostname - , port: +self.proxy.port + , port: +self.proxy.port , proxyAuth: self.proxy.auth } , ca: this.ca } @@ -186,11 +189,6 @@ Request.prototype.init = function (options) { self.host = self.uri.hostname } - if (self.onResponse === true) { - self.onResponse = self.callback - delete self.callback - } - self.clientErrorHandler = function (error) { if (self._aborted) return @@ -203,13 +201,11 @@ Request.prototype.init = function (options) { return } if (self.timeout && self.timeoutTimer) { - clearTimeout(self.timeoutTimer); - self.timeoutTimer = null; + clearTimeout(self.timeoutTimer) + self.timeoutTimer = null } self.emit('error', error) } - if (self.onResponse) self.on('error', function (e) {self.onResponse(e)}) - if (self.callback) self.on('error', function (e) {self.callback(e)}) if (options.form) { self.form(options.form) @@ -348,70 +344,6 @@ Request.prototype.init = function (options) { }) } -// Must call this when following a redirect from https to http or vice versa -// Attempts to keep everything as identical as possible, but update the -// httpModule, Tunneling agent, and/or Forever Agent in use. -Request.prototype._updateProtocol = function () { - var self = this - var protocol = self.uri.protocol - - if (protocol === 'https:') { - // previously was doing http, now doing https - // if it's https, then we might need to tunnel now. - if (self.proxy) { - self.tunnel = true - var tunnelFn = self.proxy.protocol === 'http:' - ? tunnel.httpsOverHttp : tunnel.httpsOverHttps - var tunnelOptions = { proxy: { host: self.proxy.hostname - , post: +self.proxy.port - , proxyAuth: self.proxy.auth } - , ca: self.ca } - self.agent = tunnelFn(tunnelOptions) - return - } - - self.httpModule = https - switch (self.agentClass) { - case ForeverAgent: - self.agentClass = ForeverAgent.SSL - break - case http.Agent: - self.agentClass = https.Agent - break - default: - // nothing we can do. Just hope for the best. - return - } - - // if there's an agent, we need to get a new one. - if (self.agent) self.agent = self.getAgent() - - } else { - if (log) log('previously https, now http') - // previously was doing https, now doing http - // stop any tunneling. - if (self.tunnel) self.tunnel = false - self.httpModule = http - switch (self.agentClass) { - case ForeverAgent.SSL: - self.agentClass = ForeverAgent - break - case https.Agent: - self.agentClass = http.Agent - break - default: - // nothing we can do. just hope for the best - return - } - - // if there's an agent, then get a new one. - if (self.agent) { - self.agent = null - self.agent = self.getAgent() - } - } -} - Request.prototype.getAgent = function () { var Agent = this.agentClass var options = {} @@ -437,11 +369,7 @@ Request.prototype.getAgent = function () { poolKey += this.host + ':' + this.port } - // ca option is only relevant if proxy or destination are https - var proxy = this.proxy - if (typeof proxy === 'string') proxy = url.parse(proxy) - var caRelevant = (proxy && proxy.protocol === 'https:') || this.uri.protocol === 'https:' - if (options.ca && caRelevant) { + if (options.ca) { if (poolKey) poolKey += ':' poolKey += options.ca } @@ -451,9 +379,6 @@ Request.prototype.getAgent = function () { return this.httpModule.globalAgent } - // we're using a stored agent. Make sure it's protocol-specific - poolKey = this.uri.protocol + poolKey - // already generated an agent for this setting if (this.pool[poolKey]) return this.pool[poolKey] @@ -475,6 +400,7 @@ Request.prototype.start = function () { self.response = response response.request = self + response.toJSON = toJSON if (self.httpModule === https && self.strictSSL && @@ -486,8 +412,8 @@ Request.prototype.start = function () { if (self.setHost) delete self.headers.host if (self.timeout && self.timeoutTimer) { - clearTimeout(self.timeoutTimer); - self.timeoutTimer = null; + clearTimeout(self.timeoutTimer) + self.timeoutTimer = null } if (response.headers['set-cookie'] && (!self._disableCookies)) { @@ -510,21 +436,14 @@ Request.prototype.start = function () { if (!isUrl.test(response.headers.location)) { response.headers.location = url.resolve(self.uri.href, response.headers.location) } - - var uriPrev = self.uri - self.uri = url.parse(response.headers.location) - - // handle the case where we change protocol from https to http or vice versa - if (self.uri.protocol !== uriPrev.protocol) { - self._updateProtocol() - } - + self.uri = response.headers.location self.redirects.push( { statusCode : response.statusCode , redirectUri: response.headers.location } ) - self.method = 'GET'; // Force all redirects to use GET + if (self.followAllRedirects) self.method = 'GET' + // self.method = 'GET'; // Force all redirects to use GET || commented out fixes #215 delete self.req delete self.agent delete self._started @@ -567,9 +486,6 @@ Request.prototype.start = function () { self.emit('response', response) - if (self.onResponse) { - self.onResponse(null, response) - } if (self.callback) { var buffer = [] var bodyLen = 0 @@ -601,8 +517,8 @@ Request.prototype.start = function () { response.body = JSON.parse(response.body) } catch (e) {} } - - self.callback(null, response, response.body) + + self.emit('complete', response, response.body) }) } } @@ -620,12 +536,12 @@ Request.prototype.start = function () { // server freeze after sending headers if (self.req.setTimeout) { // only works on node 0.6+ self.req.setTimeout(self.timeout, function(){ - if (self.req) { - self.req.abort() - var e = new Error("ESOCKETTIMEDOUT") - e.code = "ESOCKETTIMEDOUT" - self.emit("error", e) - } + if (self.req) { + self.req.abort() + var e = new Error("ESOCKETTIMEDOUT") + e.code = "ESOCKETTIMEDOUT" + self.emit("error", e) + } }) } } @@ -701,9 +617,9 @@ Request.prototype.multipart = function (multipart) { self.body = [] if (!self.headers['content-type']) { - self.headers['content-type'] = 'multipart/related;boundary="frontier"'; + self.headers['content-type'] = 'multipart/related; boundary=frontier'; } else { - self.headers['content-type'] = self.headers['content-type'].split(';')[0] + ';boundary="frontier"'; + self.headers['content-type'] = self.headers['content-type'].split(';')[0] + '; boundary=frontier'; } if (!multipart.forEach) throw new Error('Argument error, options.multipart.') @@ -772,9 +688,9 @@ Request.prototype.oauth = function (_oauth) { delete oa['oauth_'+i] } } - this.headers.authorization = + this.headers.Authorization = 'OAuth '+Object.keys(oa).sort().map(function (i) {return i+'="'+oauth.rfc3986(oa[i])+'"'}).join(',') - this.headers.authorization += ',oauth_signature="'+oauth.rfc3986(signature)+'"' + this.headers.Authorization += ',oauth_signature="'+oauth.rfc3986(signature)+'"' return this } Request.prototype.jar = function (jar) { @@ -891,7 +807,7 @@ request.defaults = function (options) { for (var i in options) { if (params.options[i] === undefined) params.options[i] = options[i] } - return method(params.uri, params.options, params.callback) + return method(params.options, params.callback) } return d } @@ -953,3 +869,45 @@ request.cookie = function (str) { if (typeof str !== 'string') throw new Error("The cookie function only accepts STRING as param") return new Cookie(str) } + +// Safe toJSON + +function getSafe (self, uuid) { + if (typeof self === 'object' || typeof self === 'function') var safe = {} + if (Array.isArray(self)) var safe = [] + + var recurse = [] + + Object.defineProperty(self, uuid, {}) + + var attrs = Object.keys(self).filter(function (i) { + if (i === uuid) return false + if ( (typeof self[i] !== 'object' && typeof self[i] !== 'function') || self[i] === null) return true + return !(Object.getOwnPropertyDescriptor(self[i], uuid)) + }) + + + for (var i=0;i<attrs.length;i++) { + if ( (typeof self[attrs[i]] !== 'object' && typeof self[attrs[i]] !== 'function') || + self[attrs[i]] === null + ) { + safe[attrs[i]] = self[attrs[i]] + } else { + recurse.push(attrs[i]) + Object.defineProperty(self[attrs[i]], uuid, {}) + } + } + + for (var i=0;i<recurse.length;i++) { + safe[recurse[i]] = getSafe(self[recurse[i]], uuid) + } + + return safe +} + +function toJSON () { + return getSafe(this, (((1+Math.random())*0x10000)|0).toString(16)) +} + +Request.prototype.toJSON = toJSON + diff --git a/deps/npm/node_modules/request/oauth.js b/deps/npm/node_modules/request/oauth.js index 31b9dc65f..f6abae33c 100644 --- a/deps/npm/node_modules/request/oauth.js +++ b/deps/npm/node_modules/request/oauth.js @@ -8,11 +8,11 @@ function sha1 (key, body) { function rfc3986 (str) { return encodeURIComponent(str) - .replace('!','%21') - .replace('*','%2A') - .replace('(','%28') - .replace(')','%29') - .replace("'",'%27') + .replace(/!/g,'%21') + .replace(/\*/g,'%2A') + .replace(/\(/g,'%28') + .replace(/\)/g,'%29') + .replace(/'/g,'%27') ; } diff --git a/deps/npm/node_modules/request/package.json b/deps/npm/node_modules/request/package.json index 0e6ddc5d8..1fe21b1e7 100644 --- a/deps/npm/node_modules/request/package.json +++ b/deps/npm/node_modules/request/package.json @@ -7,7 +7,7 @@ "util", "utility" ], - "version": "2.9.153", + "version": "2.9.202", "author": { "name": "Mikeal Rogers", "email": "mikeal.rogers@gmail.com" @@ -30,16 +30,16 @@ "name": "isaacs", "email": "i@izs.me" }, - "_id": "request@2.9.153", + "_id": "request@2.9.202", "dependencies": {}, "devDependencies": {}, "optionalDependencies": {}, "_engineSupported": true, - "_npmVersion": "1.1.8", - "_nodeVersion": "v0.6.12", + "_npmVersion": "1.1.24", + "_nodeVersion": "v0.7.10-pre", "_defaultsLoaded": true, "dist": { - "shasum": "6f07c2ba3acfbe0cfe941f43647102740f05ff73" + "shasum": "f762430e0080df88bd7917330acb00d1c1b3481d" }, - "_from": "../request" + "_from": "request@2.9.202" } diff --git a/deps/npm/node_modules/rimraf/package.json b/deps/npm/node_modules/rimraf/package.json index 952bc8af9..c8aa86f55 100644 --- a/deps/npm/node_modules/rimraf/package.json +++ b/deps/npm/node_modules/rimraf/package.json @@ -1,10 +1,65 @@ -{"name":"rimraf" -,"version":"2.0.1" -,"main":"rimraf.js" -,"description":"A deep deletion module for node (like `rm -rf`)" -,"author":"Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)" -,"license": - {"type":"MIT", "url": "https://github.com/isaacs/rimraf/raw/master/LICENSE"} -,"optionalDependencies":{"graceful-fs":"~1.1"} -,"repository":"git://github.com/isaacs/rimraf.git" -,"scripts":{"test":"cd test && bash run.sh"}} +{ + "name": "rimraf", + "version": "2.0.2", + "main": "rimraf.js", + "description": "A deep deletion module for node (like `rm -rf`)", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "license": { + "type": "MIT", + "url": "https://github.com/isaacs/rimraf/raw/master/LICENSE" + }, + "optionalDependencies": { + "graceful-fs": "~1.1" + }, + "repository": { + "type": "git", + "url": "git://github.com/isaacs/rimraf.git" + }, + "scripts": { + "test": "cd test && bash run.sh" + }, + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "_id": "rimraf@2.0.2", + "contributors": [ + { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me" + }, + { + "name": "Wayne Larsen", + "email": "wayne@larsen.st", + "url": "http://github.com/wvl" + }, + { + "name": "ritch", + "email": "skawful@gmail.com" + }, + { + "name": "Marcel Laverdet" + }, + { + "name": "Yosef Dinerstein", + "email": "yosefd@microsoft.com" + } + ], + "dependencies": { + "graceful-fs": "~1.1" + }, + "devDependencies": {}, + "engines": { + "node": "*" + }, + "_engineSupported": true, + "_npmVersion": "1.1.24", + "_nodeVersion": "v0.7.10-pre", + "_defaultsLoaded": true, + "_from": "rimraf@2" +} diff --git a/deps/npm/node_modules/rimraf/rimraf.js b/deps/npm/node_modules/rimraf/rimraf.js index 67d018ab4..bb1bb8cc2 100644 --- a/deps/npm/node_modules/rimraf/rimraf.js +++ b/deps/npm/node_modules/rimraf/rimraf.js @@ -11,8 +11,16 @@ try { fs = require("fs") } -var lstat = process.platform === "win32" ? "stat" : "lstat" - , lstatSync = lstat + "Sync" +var lstat = "lstat" +if (process.platform === "win32") { + // not reliable on windows prior to 0.7.9 + var v = process.version.replace(/^v/, '').split(/\.|-/).map(Number) + if (v[0] === 0 && (v[1] < 7 || v[1] == 7 && v[2] < 9)) { + lstat = "stat" + } +} +if (!fs[lstat]) lstat = "stat" +var lstatSync = lstat + "Sync" // for EMFILE handling var timeout = 0 @@ -28,12 +36,12 @@ function rimraf (p, cb) { rimraf_(p, function CB (er) { if (er) { if (er.code === "EBUSY" && busyTries < exports.BUSYTRIES_MAX) { - var time = (exports.BUSYTRIES_MAX - busyTries) * 100 busyTries ++ + var time = busyTries * 100 // try again, with the same exact callback as this one. return setTimeout(function () { rimraf_(p, CB) - }) + }, time) } // this one won't happen if graceful-fs is used. diff --git a/deps/npm/package.json b/deps/npm/package.json index b21f66859..61476b041 100644 --- a/deps/npm/package.json +++ b/deps/npm/package.json @@ -1,4 +1,5 @@ { + "version": "1.1.25", "name": "npm", "publishConfig": { "proprietary-attribs": false @@ -10,7 +11,6 @@ "install", "package.json" ], - "version": "1.1.24", "preferGlobal": true, "config": { "publishtest": false @@ -50,14 +50,17 @@ "fstream": "~0.1.17", "block-stream": "*", "inherits": "1", - "mkdirp": "0.3", + "mkdirp": "~0.3.3", "read": "0", "lru-cache": "1", "node-gyp": "~0.4.5", "fstream-npm": "0.1", "uid-number": "0", "archy": "0", - "chownr": "0" + "chownr": "0", + "npmlog": "0", + "ansi": "~0.1.2", + "npm-registry-client": "0" }, "bundleDependencies": [ "slide", @@ -83,7 +86,10 @@ "fstream-npm", "uid-number", "archy", - "chownr" + "chownr", + "npmlog", + "ansi", + "npm-registry-client" ], "devDependencies": { "ronn": "https://github.com/isaacs/ronnjs/tarball/master" @@ -94,7 +100,7 @@ }, "scripts": { "test": "node ./test/run.js", - "prepublish": "npm prune; rm -rf node_modules/*/{test,example,bench}*; make -j4 doc", + "prepublish": "npm prune ; make -j4 doc", "dumpconf": "env | grep npm | sort | uniq" }, "licenses": [ |