Upgrade npm to 1.1.25
authorisaacs <i@izs.me>
Mon, 11 Jun 2012 04:29:47 +0000 (21:29 -0700)
committerisaacs <i@izs.me>
Mon, 11 Jun 2012 15:13:36 +0000 (08:13 -0700)
172 files changed:
deps/npm/LICENSE
deps/npm/bin/npm-cli.js
deps/npm/doc/cli/coding-style.md
deps/npm/doc/cli/config.md
deps/npm/html/api/bin.html
deps/npm/html/api/bugs.html
deps/npm/html/api/commands.html
deps/npm/html/api/config.html
deps/npm/html/api/deprecate.html
deps/npm/html/api/docs.html
deps/npm/html/api/edit.html
deps/npm/html/api/explore.html
deps/npm/html/api/help-search.html
deps/npm/html/api/init.html
deps/npm/html/api/install.html
deps/npm/html/api/link.html
deps/npm/html/api/load.html
deps/npm/html/api/ls.html
deps/npm/html/api/npm.html
deps/npm/html/api/outdated.html
deps/npm/html/api/owner.html
deps/npm/html/api/pack.html
deps/npm/html/api/prefix.html
deps/npm/html/api/prune.html
deps/npm/html/api/publish.html
deps/npm/html/api/rebuild.html
deps/npm/html/api/restart.html
deps/npm/html/api/root.html
deps/npm/html/api/run-script.html
deps/npm/html/api/search.html
deps/npm/html/api/shrinkwrap.html
deps/npm/html/api/start.html
deps/npm/html/api/stop.html
deps/npm/html/api/submodule.html
deps/npm/html/api/tag.html
deps/npm/html/api/test.html
deps/npm/html/api/uninstall.html
deps/npm/html/api/unpublish.html
deps/npm/html/api/update.html
deps/npm/html/api/version.html
deps/npm/html/api/view.html
deps/npm/html/api/whoami.html
deps/npm/html/doc/README.html
deps/npm/html/doc/adduser.html
deps/npm/html/doc/bin.html
deps/npm/html/doc/bugs.html
deps/npm/html/doc/build.html
deps/npm/html/doc/bundle.html
deps/npm/html/doc/cache.html
deps/npm/html/doc/changelog.html
deps/npm/html/doc/coding-style.html
deps/npm/html/doc/completion.html
deps/npm/html/doc/config.html
deps/npm/html/doc/deprecate.html
deps/npm/html/doc/developers.html
deps/npm/html/doc/disputes.html
deps/npm/html/doc/docs.html
deps/npm/html/doc/edit.html
deps/npm/html/doc/explore.html
deps/npm/html/doc/faq.html
deps/npm/html/doc/folders.html
deps/npm/html/doc/help-search.html
deps/npm/html/doc/help.html
deps/npm/html/doc/index.html
deps/npm/html/doc/init.html
deps/npm/html/doc/install.html
deps/npm/html/doc/json.html
deps/npm/html/doc/link.html
deps/npm/html/doc/list.html
deps/npm/html/doc/npm.html
deps/npm/html/doc/outdated.html
deps/npm/html/doc/owner.html
deps/npm/html/doc/pack.html
deps/npm/html/doc/prefix.html
deps/npm/html/doc/prune.html
deps/npm/html/doc/publish.html
deps/npm/html/doc/rebuild.html
deps/npm/html/doc/registry.html
deps/npm/html/doc/removing-npm.html
deps/npm/html/doc/restart.html
deps/npm/html/doc/root.html
deps/npm/html/doc/run-script.html
deps/npm/html/doc/scripts.html
deps/npm/html/doc/search.html
deps/npm/html/doc/semver.html
deps/npm/html/doc/shrinkwrap.html
deps/npm/html/doc/star.html
deps/npm/html/doc/start.html
deps/npm/html/doc/stop.html
deps/npm/html/doc/submodule.html
deps/npm/html/doc/tag.html
deps/npm/html/doc/test.html
deps/npm/html/doc/uninstall.html
deps/npm/html/doc/unpublish.html
deps/npm/html/doc/update.html
deps/npm/html/doc/version.html
deps/npm/html/doc/view.html
deps/npm/html/doc/whoami.html
deps/npm/html/style.css
deps/npm/lib/adduser.js
deps/npm/lib/bugs.js
deps/npm/lib/build.js
deps/npm/lib/cache.js
deps/npm/lib/config.js
deps/npm/lib/deprecate.js
deps/npm/lib/docs.js
deps/npm/lib/edit.js
deps/npm/lib/help-search.js
deps/npm/lib/help.js
deps/npm/lib/init.js
deps/npm/lib/install.js
deps/npm/lib/link.js
deps/npm/lib/ls.js
deps/npm/lib/npm.js
deps/npm/lib/outdated.js
deps/npm/lib/owner.js
deps/npm/lib/publish.js
deps/npm/lib/rebuild.js
deps/npm/lib/root.js
deps/npm/lib/run-script.js
deps/npm/lib/search.js
deps/npm/lib/shrinkwrap.js
deps/npm/lib/star.js
deps/npm/lib/substack.js
deps/npm/lib/tag.js
deps/npm/lib/unbuild.js
deps/npm/lib/uninstall.js
deps/npm/lib/unpublish.js
deps/npm/lib/update.js
deps/npm/lib/utils/cmd-shim.js
deps/npm/lib/utils/completion/remote-packages.js
deps/npm/lib/utils/completion/users.js
deps/npm/lib/utils/config-defs.js
deps/npm/lib/utils/error-handler.js
deps/npm/lib/utils/exec.js
deps/npm/lib/utils/fetch.js
deps/npm/lib/utils/ini.js
deps/npm/lib/utils/lifecycle.js
deps/npm/lib/utils/link.js
deps/npm/lib/utils/load-package-defaults.js
deps/npm/lib/utils/log.js [deleted file]
deps/npm/lib/utils/npm-registry-client/adduser.js [deleted file]
deps/npm/lib/utils/npm-registry-client/get.js [deleted file]
deps/npm/lib/utils/npm-registry-client/index.js [deleted file]
deps/npm/lib/utils/npm-registry-client/publish.js [deleted file]
deps/npm/lib/utils/npm-registry-client/request.js [deleted file]
deps/npm/lib/utils/npm-registry-client/star.js [deleted file]
deps/npm/lib/utils/npm-registry-client/tag.js [deleted file]
deps/npm/lib/utils/npm-registry-client/unpublish.js [deleted file]
deps/npm/lib/utils/read-installed.js
deps/npm/lib/utils/read-json.js
deps/npm/lib/utils/sha.js
deps/npm/lib/utils/tar.js
deps/npm/lib/version.js
deps/npm/lib/view.js
deps/npm/lib/whoami.js
deps/npm/lib/xmas.js
deps/npm/man/man1/coding-style.1
deps/npm/man/man1/config.1
deps/npm/man/man1/npm.1
deps/npm/man/man3/npm.3
deps/npm/node_modules/mkdirp/package.json
deps/npm/node_modules/node-gyp/node_modules/ansi/package.json
deps/npm/node_modules/node-gyp/node_modules/glob/package.json
deps/npm/node_modules/node-gyp/package.json
deps/npm/node_modules/request/README.md
deps/npm/node_modules/request/main.js
deps/npm/node_modules/request/oauth.js
deps/npm/node_modules/request/package.json
deps/npm/node_modules/rimraf/package.json
deps/npm/node_modules/rimraf/rimraf.js
deps/npm/package.json

index c944259..3702d8a 100644 (file)
@@ -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.
 
index f294370..a71985b 100755 (executable)
@@ -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")
index 42ac1d7..c505dba 100644 (file)
@@ -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.
 
index 3fd9cb8..659895e 100644 (file)
@@ -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
index f6781bf..cca295e 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">bin &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 3585f37..1fe13e9 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">bugs &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index dd6fc41..c99a3de 100644 (file)
@@ -28,7 +28,7 @@ usage, or <code>man 3 npm-&lt;command&gt;</code> for programmatic usage.</p>
 
 <ul><li><a href="../doc/index.html">index(1)</a></li></ul>
 </div>
-<p id="footer">commands &mdash; npm@1.1.24</p>
+<p id="footer">commands &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 569d2a5..31abdf2 100644 (file)
@@ -33,7 +33,7 @@ functions instead.</p>
 
 <ul><li><a href="../api/npm.html">npm(3)</a></li></ul>
 </div>
-<p id="footer">config &mdash; npm@1.1.24</p>
+<p id="footer">config &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index bf1f860..09ffb2a 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">deprecate &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 3dfcfcb..f037531 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">docs &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 355603c..45a2ddd 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">edit &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index e826473..37178a4 100644 (file)
@@ -24,7 +24,7 @@ sure to use <code>npm rebuild &lt;pkg&gt;</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 &mdash; npm@1.1.24</p>
+<p id="footer">explore &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 86ba337..cdc5954 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">help-search &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 4e8b7f9..949acb1 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">init &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 0cb6747..3603633 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">install &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 0acc672..f9eeffe 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">link &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 68ac853..4b0b8e3 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">load &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 768e4da..d9c3751 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">ls &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 1495871..d3002ef 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">npm &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 4c4f369..a08afd8 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">outdated &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 966422b..f943a63 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">owner &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index d038fac..de159b4 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">pack &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 719ea17..391a728 100644 (file)
@@ -21,7 +21,7 @@
 
 <p>This function is not useful programmatically</p>
 </div>
-<p id="footer">prefix &mdash; npm@1.1.24</p>
+<p id="footer">prefix &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index ac88744..b32fe39 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">prune &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index fc7fc21..d77130b 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">publish &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 791c4eb..500ec15 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">rebuild &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 85bddab..dd02b57 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">restart &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 174ca46..d3670d4 100644 (file)
@@ -21,7 +21,7 @@
 
 <p>This function is not useful programmatically.</p>
 </div>
-<p id="footer">root &mdash; npm@1.1.24</p>
+<p id="footer">root &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 799908b..553a623 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">run-script &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index bdb88fa..7b85536 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">search &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 8be37c6..4f2751d 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">shrinkwrap &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index d762ff5..f4f6325 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">start &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index e782f9f..c7ea121 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">stop &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 685d936..dd34cb1 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">submodule &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index f1ec1f4..2f94563 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">tag &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 8a1c495..ca25173 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">test &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 3fef0a6..05ee40a 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">uninstall &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 0e024ac..934a9cd 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">unpublish &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 2c4b38d..57fbbff 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">update &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 7741812..e0d5134 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">version &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 24a74ba..2280dd3 100644 (file)
@@ -99,7 +99,7 @@ the field name.</p>
 
 <p>corresponding to the list of fields selected.</p>
 </div>
-<p id="footer">view &mdash; npm@1.1.24</p>
+<p id="footer">view &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index eca747c..ac813e2 100644 (file)
@@ -21,7 +21,7 @@
 
 <p>This function is not useful programmatically</p>
 </div>
-<p id="footer">whoami &mdash; npm@1.1.24</p>
+<p id="footer">whoami &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 7923b66..87b7101 100644 (file)
@@ -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> &mdash; npm@1.1.24</p>
+<p id="footer"><a href="../doc/README.html">README</a> &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index cf2d481..3e10674 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">adduser &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index c6252a6..bfcbf71 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">bin &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 0e0637b..477c791 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">bugs &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 62e3f81..9cee884 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">build &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 2955a00..8d4a701 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">bundle &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 49b6fe1..13fc18c 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">cache &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index fbe8536..ffddf46 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">changelog &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 78d55b5..2f5f091 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">coding-style &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 5b1c70b..6036c66 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">completion &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index bdfcc41..43c680d 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">config &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 8130e0a..01230f4 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">deprecate &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 4c8f47b..39cf2f1 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">developers &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 8755084..213779d 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">disputes &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 617d744..57b002d 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">docs &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index bdc574a..ce4a5d7 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">edit &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 5bfd6d7..9cb6b28 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">explore &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index cd84fe9..f1c9a60 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">faq &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 582305a..14b9c69 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">folders &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index fd85377..1fca39d 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">help-search &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 476b458..2991e1b 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">help &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 84d6d34..7aa0f11 100644 (file)
 
 <p> Display npm username</p>
 </div>
-<p id="footer">index &mdash; npm@1.1.24</p>
+<p id="footer">index &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 4721aa5..4ff20f0 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">init &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 76c5e65..1f89403 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">install &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index cc452d2..2e712e1 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">json &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 8d97ac9..30e3ad7 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">link &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 42ce8e2..6376e0d 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">list &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 0d5a069..12b1d03 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">npm &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 4d96f4b..7b5cf26 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">outdated &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index d45964d..65766a9 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">owner &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 23a6a70..be1c3d5 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">pack &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index a90db1e..57a7ccb 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">prefix &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 618bba3..2100a88 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">prune &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index b366958..974d8e4 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">publish &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 77f0ced..dcd6a71 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">rebuild &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 2a4ec57..bb57262 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">registry &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 983d427..6da3d3b 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">removing-npm &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 965e38f..595f10b 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">restart &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index bdb274d..b78f7cf 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">root &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 36bd064..9e93c06 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">run-script &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 549b1e6..c8b0b5b 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">scripts &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 956a95b..bf8d54a 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">search &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index cefa7bb..f4a6ab2 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">semver &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index e0d115e..9e2f9b4 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">shrinkwrap &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index e303611..e259d2c 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">star &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index ffa11b7..b8403fd 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">start &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 2d3d7a6..aa3ff03 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">stop &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index a366345..0867ff8 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">submodule &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index e235733..e5abdce 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">tag &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 0e4b273..4d5ce46 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">test &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 3b588d2..b003d7c 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">uninstall &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index abb8b76..d9d28c6 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">unpublish &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index aa4ba72..61edb21 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">update &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 040cdcf..dc0ade8 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">version &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 75a6f8f..4f89345 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">view &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index 5d42516..c3ce70c 100644 (file)
@@ -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 &mdash; npm@1.1.24</p>
+<p id="footer">whoami &mdash; npm@1.1.25</p>
 <script>
 ;(function () {
 var wrapper = document.getElementById("wrapper")
index c5b071b..e63b745 100644 (file)
@@ -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 {
index d65eed5..f0fc8d1 100644 (file)
@@ -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)
       })
     })
index 2a93526..3f9de12 100644 (file)
@@ -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/")
index 864eb27..c0dcbf7 100644 (file)
@@ -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])
index 076267e..e2e037e 100644 (file)
@@ -13,7 +13,7 @@ Adding a url:
 2. goto folder(2)
 
 adding a name@version:
-1. registry.get(nameversion)
+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)
   }
 }
index a69c30e..44f3d36 100644 (file)
@@ -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)
index 6f18879..c9e724e 100644 (file)
@@ -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)
   })
 }
index 20b1104..72c1869 100644 (file)
@@ -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)
index df103d4..0ffe723 100644 (file)
@@ -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]
index a4ef667..6f1f117 100644 (file)
@@ -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 = []
index 442f839..998d904 100644 (file)
@@ -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>"
         , ""
index 7cd7da8..0d96e07 100644 (file)
@@ -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)
     })
   })
index 276f3d8..26a5a63 100644 (file)
@@ -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("readDependenciesusing 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")
index 3049884..de3d09c 100644 (file)
@@ -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)
index 276530c..29e65ad 100644 (file)
@@ -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"
index 2db21e3..9b95459 100644 (file)
@@ -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) {
index e883abd..d87dc9a 100644 (file)
@@ -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")
 
index 5f13d92..6a38625 100644 (file)
@@ -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)
       })
     })
   }
index 1cf59f0..dfe21c2 100644 (file)
@@ -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)
index 0e1d56a..a4a39f7 100644 (file)
@@ -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.
index 6062ec2..59ccc0b 100644 (file)
@@ -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)"
 
index 4a4d2dc..17b48ab 100644 (file)
@@ -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]
index 213390e..9ed712b 100644 (file)
@@ -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))
index 59942d5..cdad89a 100644 (file)
@@ -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)
   }
 
index d84fa02..fc4fb96 100644 (file)
@@ -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)
     })
index 95a90f8..1929f18 100644 (file)
@@ -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()
index 06aa70c..8a7c51c 100644 (file)
@@ -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)
 }
index 771eddf..dd0293b 100644 (file)
@@ -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
index 655e5eb..a1998e7 100644 (file)
@@ -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)
index b7f6cbe..8aae12c 100644 (file)
@@ -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)
   })
 }
index 69b9f98..46d3267 100644 (file)
@@ -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) {
index e24da36..a31af68 100644 (file)
@@ -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)
index 4bf82d0..18d812c 100644 (file)
@@ -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)
index f77312c..1dc6dbb 100644 (file)
@@ -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)
index 18b47ec..4542e8f 100644 (file)
@@ -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]
index f7fdf16..a5332b0 100644 (file)
@@ -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)
 }
index b9a5b69..56d331a 100644 (file)
@@ -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 ]
index bc1c095..f69975b 100644 (file)
@@ -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)
   }
 }
index b033b6a..aa4f431 100644 (file)
@@ -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, {})
index c5ebbbe..2f31af0 100644 (file)
@@ -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)
 
index 7fa80d5..806fe22 100644 (file)
@@ -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)
 }
index 180507a..8a72ade 100644 (file)
@@ -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 (file)
index 07867e3..0000000
+++ /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 (file)
index 5e6794a..0000000
+++ /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 (file)
index e0902f0..0000000
+++ /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 (file)
index 2a42947..0000000
+++ /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 (file)
index a196a3c..0000000
+++ /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 (file)
index d512262..0000000
+++ /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 (file)
index 474a178..0000000
+++ /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 (file)
index 4d88a98..0000000
+++ /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 (file)
index 0c7c449..0000000
+++ /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)
-  })
-}
index ff22094..3776f90 100644 (file)
@@ -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
 }
 
index d1bba10..146f460 100644 (file)
@@ -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) {
index 17b8c38..d3cd83a 100644 (file)
@@ -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)
   })
 }
index 76ef6ea..22a4a85 100644 (file)
@@ -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)
index febb56d..3532976 100644 (file)
@@ -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)
index 33a5d0d..6ffde4c 100644 (file)
@@ -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)
index c48f04b..b6e4952 100644 (file)
@@ -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)"
 
index 90282d0..bf838a8 100644 (file)
@@ -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 () {
index 16f2762..11adb5f 100644 (file)
@@ -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,
index d5c8ac5..59c44d3 100644 (file)
@@ -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
index 21584cb..553b4bf 100644 (file)
@@ -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
index b9e6854..fbb2b86 100644 (file)
@@ -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\.
index 2a393e9..f779658 100644 (file)
@@ -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",
     "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"
 }
index d8a5c29..5c9fca1 100644 (file)
@@ -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"
index 3589c36..c1e8ce5 100644 (file)
@@ -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"
index 83be556..f4d7628 100644 (file)
   "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"
 }
index e5839b5..639d1a4 100644 (file)
@@ -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.
index 5a6bd9e..d734b08 100644 (file)
@@ -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
+
index 31b9dc6..f6abae3 100644 (file)
@@ -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')
     ;
 }
 
index 0e6ddc5..1fe21b1 100644 (file)
@@ -7,7 +7,7 @@
     "util",
     "utility"
   ],
-  "version": "2.9.153",
+  "version": "2.9.202",
   "author": {
     "name": "Mikeal Rogers",
     "email": "mikeal.rogers@gmail.com"
     "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"
 }
index 952bc8a..c8aa86f 100644 (file)
@@ -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"
+}
index 67d018a..bb1bb8c 100644 (file)
@@ -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.
index b21f668..61476b0 100644 (file)
@@ -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
     "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",
     "fstream-npm",
     "uid-number",
     "archy",
-    "chownr"
+    "chownr",
+    "npmlog",
+    "ansi",
+    "npm-registry-client"
   ],
   "devDependencies": {
     "ronn": "https://github.com/isaacs/ronnjs/tarball/master"
   },
   "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": [