diff options
author | isaacs <i@izs.me> | 2012-05-05 22:33:06 -0700 |
---|---|---|
committer | isaacs <i@izs.me> | 2012-05-05 22:33:12 -0700 |
commit | 33a9ac6087732da48e7d12ea7f7fbb41926fe46c (patch) | |
tree | a914e333e80a3401ce8726355b38f1d636500cb5 /deps | |
parent | 1858d1c340ca2631e28a32eb542c85ee8f725cac (diff) | |
download | node-new-33a9ac6087732da48e7d12ea7f7fbb41926fe46c.tar.gz |
Upgrade npm to 1.1.21
Somehow this got downgraded in the last v0.6 merge. Very strange.
Diffstat (limited to 'deps')
294 files changed, 3778 insertions, 2820 deletions
diff --git a/deps/npm/.npmignore b/deps/npm/.npmignore index 6ab186883a..5ddef35600 100644 --- a/deps/npm/.npmignore +++ b/deps/npm/.npmignore @@ -11,3 +11,7 @@ npm-debug.log ./npmrc .gitignore release/ + +# don't ignore .npmignore files +# these are used in some tests. +!.npmignore diff --git a/deps/npm/AUTHORS b/deps/npm/AUTHORS index c977af8c48..a2b8141d70 100644 --- a/deps/npm/AUTHORS +++ b/deps/npm/AUTHORS @@ -51,3 +51,17 @@ Stephen Sugden <glurgle@gmail.com> Gautham Pai <buzypi@gmail.com> David Trejo <david.daniel.trejo@gmail.com> Paul Vorbach <paul@vorb.de> +George Ornbo <george@shapeshed.com> +Tim Oxley <secoif@gmail.com> +Tyler Green <tyler.green2@gmail.com> +atomizer <danila.gerasimov@gmail.com> +Rod Vagg <rod@vagg.org> +Christian Howe <coderarity@gmail.com> +Andrew Lunny <alunny@gmail.com> +Henrik Hodne <dvyjones@binaryhex.com> +Adam Blackburn <regality@gmail.com> +Kris Windham <kriswindham@gmail.com> +Jens Grunert <jens.grunert@gmail.com> +Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl> +Dalmais Maxence <github@maxired.fr> +Marcus Ekwall <marcus.ekwall@gmail.com> diff --git a/deps/npm/LICENSE b/deps/npm/LICENSE index 71ca385bdf..c94425929d 100644 --- a/deps/npm/LICENSE +++ b/deps/npm/LICENSE @@ -1,4 +1,4 @@ -Copyright 2009, 2010, 2011 Isaac Z. Schlueter (the "Author") +Copyright 2009-2012, Isaac Z. Schlueter (the "Original Author") All rights reserved. MIT +no-false-attribs License @@ -20,9 +20,9 @@ by the recipients as they would use the unmodified Software, containing modifications that substantially alter, remove, or disable functionality of the Software, outside of the documented configuration mechanisms provided by the Software, shall be -modified such that the Author's bug reporting email addresses and -urls are either replaced with the contact information of the -parties responsible for the changes, or removed entirely. +modified such that the Original Author's bug reporting email +addresses and urls are either replaced with the contact information +of the parties responsible for the changes, or removed entirely. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES @@ -36,7 +36,7 @@ OTHER DEALINGS IN THE SOFTWARE. Except where noted, this license applies to any and all software programs and associated documentation files created by the -Author, when distributed with the Software. +Original Author, when distributed with the Software. "Node.js" and "node" trademark Joyent, Inc. npm is not officially part of the Node.js project, and is neither owned by nor @@ -49,13 +49,11 @@ and are not covered by this license. "npm Logo" created by Mathias Pettersson and Brian Hammond, used with permission. -This program includes a BSDTar/LibArchive version 2.8.3-1 binary, -originally distributed as part of the MinGW suite, compiled for -Win32, according to the terms of the BSD license. -See deps/basic-bsdtar-2.8.3-1-ming32-bin/basic-bsdtar.LICENSE. - This program uses "node-uuid", Copyright (c) 2010 Robert Kieffer, according to the terms of the MIT license. This program uses "request", Copyright (c) 2011 Mikeal Rogers, according to the terms of the Apache license. + +This program uses "mkdirp", Copyright (c) 2010 James Halliday, +according to the terms of the MIT/X11 license. diff --git a/deps/npm/Makefile b/deps/npm/Makefile index 415a1b3d68..19efd815c9 100644 --- a/deps/npm/Makefile +++ b/deps/npm/Makefile @@ -123,7 +123,7 @@ doc-publish: doc rsync -vazu --stats --no-implied-dirs --delete html/api/ npmjs.org:/var/www/npmjs.org/public/api zip-publish: release - scp release/*.zip npmjs.org:/var/www/npmjs.org/public/dist/ + scp release/* npmjs.org:/var/www/npmjs.org/public/dist/ release: @bash scripts/release.sh diff --git a/deps/npm/bin/npm-cli.js b/deps/npm/bin/npm-cli.js index e0b9f20bb8..f29437093e 100755 --- a/deps/npm/bin/npm-cli.js +++ b/deps/npm/bin/npm-cli.js @@ -49,6 +49,13 @@ if (conf.version) { return } +if (conf.versions) { + var v = process.versions + v.npm = npm.version + console.log(v) + return +} + log.info("npm@"+npm.version, "using") log.info("node@"+process.version, "using") diff --git a/deps/npm/bin/npm-get-uid-gid.js b/deps/npm/bin/npm-get-uid-gid.js deleted file mode 100755 index 390e0f2fc9..0000000000 --- a/deps/npm/bin/npm-get-uid-gid.js +++ /dev/null @@ -1,16 +0,0 @@ -var argv = process.argv.slice(2) - , user = argv[0] || process.getuid() - , group = argv[1] || process.getgid() - -if (!isNaN(user)) user = +user -if (!isNaN(group)) group = +group - -console.error([user, group]) - -try { - process.setgid(group) - process.setuid(user) - console.log(JSON.stringify({uid:+process.getuid(), gid:+process.getgid()})) -} catch (ex) { - console.log(JSON.stringify({error:ex.message,errno:ex.errno})) -} diff --git a/deps/npm/bin/npm.cmd b/deps/npm/bin/npm.cmd index bac9e5f1c4..7720e20529 100644 --- a/deps/npm/bin/npm.cmd +++ b/deps/npm/bin/npm.cmd @@ -1,6 +1,6 @@ :: Created by npm, please don't edit manually.
-@IF EXIST "%~dp0"\"node.exe" (
- "%~dp0"\"node.exe" "%~dp0\.\node_modules\npm\bin\npm-cli.js" %*
+@IF EXIST "%~dp0\node.exe" (
+ "%~dp0\node.exe" "%~dp0\.\node_modules\npm\bin\npm-cli.js" %*
) ELSE (
- node "%~dp0\.\node_modules\npm\bin\npm-cli.js" %*
-)
\ No newline at end of file + node "%~dp0\.\node_modules\npm\bin\npm-cli.js" %*
+)
diff --git a/deps/npm/doc/api/ls.md b/deps/npm/doc/api/ls.md index a6c0a13821..ed890ff146 100644 --- a/deps/npm/doc/api/ls.md +++ b/deps/npm/doc/api/ls.md @@ -21,6 +21,12 @@ It will print out extraneous, missing, and invalid packages. If the silent parameter is set to true, nothing will be output to the screen, but the data will still be returned. +Callback is provided an error if one occurred, the full data about which +packages are installed and which dependencies they will receive, and a +"lite" data object which just shows which versions are installed where. +Note that the full data object is a circular structure, so care must be +taken if it is serialized to JSON. + ## CONFIGURATION ### long diff --git a/deps/npm/doc/cli/changelog.md b/deps/npm/doc/cli/changelog.md index 0115405ca0..64feeacda8 100644 --- a/deps/npm/doc/cli/changelog.md +++ b/deps/npm/doc/cli/changelog.md @@ -3,6 +3,50 @@ npm-changelog(1) -- Changes ## HISTORY +### 1.1.3, 1.1.4 + +* Update request to support HTTPS-over-HTTP proxy tunneling +* Throw on undefined envs in config settings +* Update which to 1.0.5 +* Fix windows UNC busyloop in findPrefix +* Bundle nested bundleDependencies properly +* Alias adduser to add-user +* Doc updates (Christian Howe, Henrik Hodne, Andrew Lunny) +* ignore logfd/outfd streams in makeEnv() (Rod Vagg) +* shrinkwrap: Behave properly with url-installed deps +* install: Support --save with url install targets +* Support installing naked tars or single-file modules from urls etc. +* init: Don't add engines section +* Don't run make clean on rebuild +* Added missing unicode replacement (atomizer) + +### 1.1.2 + +Dave Pacheco (2): + add "npm shrinkwrap" + +Martin Cooper (1): + Fix #1753 Make a copy of the cached objects we'll modify. + +Tim Oxley (1): + correctly remove readme from default npm view command. + +Tyler Green (1): + fix #2187 set terminal columns to Infinity if 0 + +isaacs (19): + update minimatch + update request + Experimental: single-file modules + Fix #2172 Don't remove global mans uninstalling local pkgs + Add --versions flag to show the version of node as well + Support --json flag for ls output + update request to 2.9.151 + +### 1.1 +* Replace system tar dependency with a JS tar +* Continue to refine + ### 1.0 * Greatly simplified folder structure * Install locally (bundle by default) diff --git a/deps/npm/doc/cli/coding-style.md b/deps/npm/doc/cli/coding-style.md index 5315c575c1..42ac1d785f 100644 --- a/deps/npm/doc/cli/coding-style.md +++ b/deps/npm/doc/cli/coding-style.md @@ -59,8 +59,8 @@ Don't use them except in four situations: * `for (;;)` loops. They're actually required. * null loops like: `while (something) ;` (But you'd better have a good reason for doing that.) -* case "foo": doSomething(); break -* In front of a leading ( or [ at the start of the line. +* `case "foo": doSomething(); break` +* In front of a leading `(` or `[` at the start of the line. This prevents the expression from being interpreted as a function call or property access, respectively. diff --git a/deps/npm/doc/cli/config.md b/deps/npm/doc/cli/config.md index 2c6ca26c02..3fd9cb8269 100644 --- a/deps/npm/doc/cli/config.md +++ b/deps/npm/doc/cli/config.md @@ -115,6 +115,8 @@ The following shorthands are parsed on the command-line: * `-l`: `--long` * `-desc`: `--description` * `-S`: `--save` +* `-D`: `--save-dev` +* `-O`: `--save-optional` * `-y`: `--yes` * `-n`: `--yes false` * `ll` and `la` commands: `ls --long` @@ -218,6 +220,28 @@ See also the `strict-ssl` config. The location of npm's cache directory. See `npm-cache(1)` +### cache-max + +* Default: Infinity +* Type: Number + +The maximum time (in seconds) to keep items in the registry cache before +re-checking against the registry. + +Note that no purging is done unless the `npm cache clean` command is +explicitly used, and that only GET requests use the cache. + +### cache-min + +* Default: 0 +* Type: Number + +The minimum time (in seconds) to keep items in the registry cache before +re-checking against the registry. + +Note that no purging is done unless the `npm cache clean` command is +explicitly used, and that only GET requests use the cache. + ### color * Default: true on Posix, false on Windows @@ -336,6 +360,13 @@ user. A proxy to use for outgoing https requests. +### user-agent + +* Default: npm/{npm.version} node/{process.version} +* Type: String + +Sets a User-Agent to the request header + ### ignore * Default: "" @@ -353,7 +384,7 @@ The value `npm init` should use by default for the package version. ### init.author.name -* Default: "0.0.0" +* Default: "" * Type: String The value `npm init` should use by default for the package author's name. @@ -372,6 +403,17 @@ The value `npm init` should use by default for the package author's email. The value `npm init` should use by default for the package author's homepage. +### json + +* Default: false +* Type: Boolean + +Whether or not to output JSON data, rather than the normal output. + +This feature is currently experimental, and the output data structures +for many commands is either not implemented in JSON yet, or subject to +change. Only the output from `npm ls --json` is currently valid. + ### link * Default: false @@ -544,6 +586,24 @@ Save installed packages to a package.json file as dependencies. Only works if there is already a package.json file present. +### save-dev + +* Default: false +* Type: Boolean + +Save installed packages to a package.json file as devDependencies. + +Only works if there is already a package.json file present. + +### save-optional + +* Default: false +* Type: Boolean + +Save installed packages to a package.json file as optionalDependencies. + +Only works if there is already a package.json file present. + ### searchopts * Default: "" @@ -682,6 +742,16 @@ If true, output the npm version and exit successfully. Only relevant when specified explicitly on the command line. +### versions + +* Default: false +* Type: boolean + +If true, output the npm version as well as node's `process.versions` +hash, and exit successfully. + +Only relevant when specified explicitly on the command line. + ### viewer * Default: "man" on Posix, "browser" on Windows diff --git a/deps/npm/doc/cli/developers.md b/deps/npm/doc/cli/developers.md index 9123f35a33..7ab905bfa0 100644 --- a/deps/npm/doc/cli/developers.md +++ b/deps/npm/doc/cli/developers.md @@ -27,12 +27,23 @@ A package is: * d) a `<name>@<version>` that is published on the registry with (c) * e) a `<name>@<tag>` that points to (d) * f) a `<name>` that has a "latest" tag satisfying (e) +* g) a `git` url that, when cloned, results in (a). Even if you never publish your package, you can still get a lot of benefits of using npm if you just want to write a node program (a), and perhaps if you also want to be able to easily install it elsewhere after packing it up into a tarball (b). +Git urls can be of the form: + + git://github.com/user/project.git#commit-ish + git+ssh://user@hostname:project.git#commit-ish + git+http://user@hostname/project/blah.git#commit-ish + git+https://user@hostname/project/blah.git#commit-ish + +The `commit-ish` can be any tag, sha, or branch which can be supplied as +an argument to `git checkout`. The default is `master`. + ## The package.json File You need to have a `package.json` file in the root of your project to do diff --git a/deps/npm/doc/cli/index.md b/deps/npm/doc/cli/index.md index 5a9b99be19..ee88f3d8f3 100644 --- a/deps/npm/doc/cli/index.md +++ b/deps/npm/doc/cli/index.md @@ -170,6 +170,10 @@ npm-index(1) -- Index of all npm documentation The semantic versioner for npm +## npm-shrinkwrap(1) + + Lock down dependency versions + ## npm-star(1) Mark your favorite packages @@ -323,6 +327,10 @@ npm-index(1) -- Index of all npm documentation Search for packages +## npm-shrinkwrap(3) + + programmatically generate package shrinkwrap file + ## npm-start(3) Start a package diff --git a/deps/npm/doc/cli/install.md b/deps/npm/doc/cli/install.md index 22eb8234e7..cfa95e7229 100644 --- a/deps/npm/doc/cli/install.md +++ b/deps/npm/doc/cli/install.md @@ -7,14 +7,17 @@ npm-install(1) -- Install a package npm install <tarball file> npm install <tarball url> npm install <folder> - npm install <name> + npm install <name> [--save|--save-dev|--save-optional] npm install <name>@<tag> npm install <name>@<version> npm install <name>@<version range> + npm install <name>@<version range> ## DESCRIPTION -This command installs a package, and any packages that it depends on. +This command installs a package, and any packages that it depends on. If the +package has a shrinkwrap file, the installation of dependencies will be driven +by that. See npm-shrinkwrap(1). A `package` is: @@ -33,88 +36,116 @@ after packing it up into a tarball (b). * `npm install` (in package directory, no arguments): - Install the dependencies in the local node_modules folder. - In global mode (ie, with `-g` or `--global` appended to the command), - it installs the current package context (ie, the current working - directory) as a global package. + Install the dependencies in the local node_modules folder. + + In global mode (ie, with `-g` or `--global` appended to the command), + it installs the current package context (ie, the current working + directory) as a global package. + * `npm install <folder>`: - Install a package that is sitting in a folder on the filesystem. + + Install a package that is sitting in a folder on the filesystem. * `npm install <tarball file>`: - Install a package that is sitting on the filesystem. Note: if you just want - to link a dev directory into your npm root, you can do this more easily by - using `npm link`. - Example: + Install a package that is sitting on the filesystem. Note: if you just want + to link a dev directory into your npm root, you can do this more easily by + using `npm link`. + + Example: - npm install ./package.tgz + npm install ./package.tgz * `npm install <tarball url>`: - Fetch the tarball url, and then install it. In order to distinguish between - this and other options, the argument must start with "http://" or "https://" - Example: + Fetch the tarball url, and then install it. In order to distinguish between + this and other options, the argument must start with "http://" or "https://" + + Example: + + npm install https://github.com/indexzero/forever/tarball/v0.5.6 + +* `npm install <name> [--save|--save-dev|--save-optional]`: + + Do a `<name>@<tag>` install, where `<tag>` is the "tag" config. (See + `npm-config(1)`.) - npm install https://github.com/indexzero/forever/tarball/v0.5.6 + In most cases, this will install the latest version + of the module published on npm. -* `npm install <name>`: - Do a `<name>@<tag>` install, where `<tag>` is the "tag" config. (See - `npm-config(1)`) + Example: - Example: + npm install sax - npm install sax + `npm install` takes 3 exclusive, optional flags which save or update + the package version in your main package.json: - **Note**: If there is a file or folder named `<name>` in the current - working directory, then it will try to install that, and only try to - fetch the package by name if it is not valid. + * `--save`: Package will appear in your `dependencies`. + + * `--save-dev`: Package will appear in your `devDependencies`. + + * `--save-optional`: Package will appear in your `optionalDependencies`. + + Examples: + + npm install sax --save + npm install node-tap --save-dev + npm install dtrace-provider --save-optional + + + **Note**: If there is a file or folder named `<name>` in the current + working directory, then it will try to install that, and only try to + fetch the package by name if it is not valid. * `npm install <name>@<tag>`: - Install the version of the package that is referenced by the specified tag. - If the tag does not exist in the registry data for that package, then this - will fail. - Example: + Install the version of the package that is referenced by the specified tag. + If the tag does not exist in the registry data for that package, then this + will fail. + + Example: - npm install sax@latest + npm install sax@latest * `npm install <name>@<version>`: - Install the specified version of the package. This will fail if the version - has not been published to the registry. - Example: + Install the specified version of the package. This will fail if the version + has not been published to the registry. - npm install sax@0.1.1 + Example: + + npm install sax@0.1.1 * `npm install <name>@<version range>`: - Install a version of the package matching the specified version range. This - will follow the same rules for resolving dependencies described in `npm-json(1)`. - Note that most version ranges must be put in quotes so that your shell will - treat it as a single argument. + Install a version of the package matching the specified version range. This + will follow the same rules for resolving dependencies described in `npm-json(1)`. + + Note that most version ranges must be put in quotes so that your shell will + treat it as a single argument. - Example: + Example: - npm install sax@">=0.1.0 <0.2.0" + npm install sax@">=0.1.0 <0.2.0" * `npm install <git remote url>`: - Install a package by cloning a git remote url. The format of the git - url is: + Install a package by cloning a git remote url. The format of the git + url is: - <protocol>://[<user>@]<hostname><separator><path>[#<commit-ish>] + <protocol>://[<user>@]<hostname><separator><path>[#<commit-ish>] - `<protocol>` is one of `git`, `git+ssh`, `git+http`, or - `git+https`. If no `<commit-ish>` is specified, then `master` is - used. + `<protocol>` is one of `git`, `git+ssh`, `git+http`, or + `git+https`. If no `<commit-ish>` is specified, then `master` is + used. - Examples: + Examples: - git+ssh://git@github.com:isaacs/npm.git#v1.0.27 - git+https://isaacs@github.com/isaacs/npm.git - git://github.com/isaacs/npm.git#v1.0.27 + git+ssh://git@github.com:isaacs/npm.git#v1.0.27 + git+https://isaacs@github.com/isaacs/npm.git + git://github.com/isaacs/npm.git#v1.0.27 You may combine multiple arguments, and even multiple types of arguments. For example: @@ -199,3 +230,4 @@ affects a real use-case, it will be investigated. * npm-folders(1) * npm-tag(1) * npm-rm(1) +* npm-shrinkwrap(1) diff --git a/deps/npm/doc/cli/json.md b/deps/npm/doc/cli/json.md index 5f6e7ef621..ddd500e3b1 100644 --- a/deps/npm/doc/cli/json.md +++ b/deps/npm/doc/cli/json.md @@ -332,6 +332,7 @@ is a semver compatible version identifier. * `""` (just an empty string) Same as `*` * `version1 - version2` Same as `>=version1 <=version2`. * `range1 || range2` Passes if either range1 or range2 are satisfied. +* `git...` See 'Git URLs as Dependencies' below For example, these are all valid: @@ -387,6 +388,18 @@ of a version range. This tarball will be downloaded and installed locally to your package at install time. +### Git URLs as Dependencies + +Git urls can be of the form: + + git://github.com/user/project.git#commit-ish + git+ssh://user@hostname:project.git#commit-ish + git+http://user@hostname/project/blah.git#commit-ish + git+https://user@hostname/project/blah.git#commit-ish + +The `commit-ish` can be any tag, sha, or branch which can be supplied as +an argument to `git checkout`. The default is `master`. + ## devDependencies If someone is planning on downloading and using your module in their @@ -415,7 +428,7 @@ node that your stuff works on: { "engines" : { "node" : ">=0.1.27 <0.1.30" } } And, like with dependencies, if you don't specify the version (or if you -specify "*" as the version), then any version of node will do. +specify "\*" as the version), then any version of node will do. If you specify an "engines" field, then npm will require that "node" be somewhere on that list. If "engines" is omitted, then npm will just assume @@ -426,6 +439,36 @@ are capable of properly installing your program. For example: { "engines" : { "npm" : "~1.0.20" } } +## os + +You can specify which operating systems your +module will run on: + + "os" : [ "darwin", "linux" ] + +You can also blacklist instead of whitelist operating systems, +just prepend the blacklisted os with a '!': + + "os" : [ "!win32" ] + +The host operating system is determined by `process.platform` + +It is allowed to both blacklist, and whitelist, although there isn't any +good reason to do this. + +## cpu + +If your code only runs on certain cpu architectures, +you can specify which ones. + + "cpu" : [ "x64", "ia32" ] + +Like the `os` option, you can also blacklist architectures: + + "cpu" : [ "!arm", "!mips" ] + +The host architecture is determined by `process.arch` + ## preferGlobal If your package is primarily a command-line application that should be @@ -442,7 +485,7 @@ to publish it. This is a way to prevent accidental publication of private repositories. If you would like to ensure that a given package is only ever published -to a speciic registry (for example, an internal registry), +to a specific registry (for example, an internal registry), then use the `publishConfig` hash described below to override the `registry` config param at publish-time. diff --git a/deps/npm/doc/cli/list.md b/deps/npm/doc/cli/list.md index 596349a815..93d86cd838 100644 --- a/deps/npm/doc/cli/list.md +++ b/deps/npm/doc/cli/list.md @@ -22,6 +22,13 @@ When run as `ll` or `la`, it shows extended information by default. ## CONFIGURATION +### json + +* Default: false +* Type: Boolean + +Show information in JSON format. + ### long * Default: false diff --git a/deps/npm/doc/cli/scripts.md b/deps/npm/doc/cli/scripts.md index 64b3ec41a0..3d33a83919 100644 --- a/deps/npm/doc/cli/scripts.md +++ b/deps/npm/doc/cli/scripts.md @@ -62,6 +62,20 @@ Package scripts run in an environment where many pieces of information are made available regarding the setup of npm and the current state of the process. + +### path + +If you depend on modules that define executable scripts, like test suites, +then those executables will be added to the `PATH` for executing the scripts. +So, if your package.json has this: + + { "name" : "foo" + , "dependencies" : { "bar" : "0.1.x" } + , "scripts": { "start" : "bar ./test" } } + +then you could run `npm start` to execute the `bar` script, which is exported +into the `node_modules/.bin` directory on `npm install`. + ### package.json vars The package.json fields are tacked onto the `npm_package_` prefix. So, for diff --git a/deps/npm/html/api/bin.html b/deps/npm/html/api/bin.html index c4392671df..2d659898ca 100644 --- a/deps/npm/html/api/bin.html +++ b/deps/npm/html/api/bin.html @@ -19,7 +19,7 @@ <p>This function should not be used programmatically. Instead, just refer to the <code>npm.bin</code> member.</p> </div> -<p id="footer">bin — npm@1.1.0-2</p> +<p id="footer">bin — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/bugs.html b/deps/npm/html/api/bugs.html index df2aaf6c30..248e803704 100644 --- a/deps/npm/html/api/bugs.html +++ b/deps/npm/html/api/bugs.html @@ -25,7 +25,7 @@ optional version number.</p> <p>This command will launch a browser, so this command may not be the most friendly for programmatic use.</p> </div> -<p id="footer">bugs — npm@1.1.0-2</p> +<p id="footer">bugs — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/commands.html b/deps/npm/html/api/commands.html index cfdc5f1f50..442f06f0f2 100644 --- a/deps/npm/html/api/commands.html +++ b/deps/npm/html/api/commands.html @@ -28,7 +28,7 @@ usage, or <code>man 3 npm-<command></code> for programmatic usage.</p> <ul><li><a href="../doc/index.html">index(1)</a></li></ul> </div> -<p id="footer">commands — npm@1.1.0-2</p> +<p id="footer">commands — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/config.html b/deps/npm/html/api/config.html index f7431f9afe..e833df494e 100644 --- a/deps/npm/html/api/config.html +++ b/deps/npm/html/api/config.html @@ -33,7 +33,7 @@ functions instead.</p> <ul><li><a href="../api/npm.html">npm(3)</a></li></ul> </div> -<p id="footer">config — npm@1.1.0-2</p> +<p id="footer">config — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/deprecate.html b/deps/npm/html/api/deprecate.html index b68d13449e..3ae24825e4 100644 --- a/deps/npm/html/api/deprecate.html +++ b/deps/npm/html/api/deprecate.html @@ -30,7 +30,7 @@ install the package.</p></li></ul> <ul><li><a href="../api/publish.html">publish(3)</a></li><li><a href="../api/unpublish.html">unpublish(3)</a></li><li><a href="../doc/registry.html">registry(1)</a></li></ul> </div> -<p id="footer">deprecate — npm@1.1.0-2</p> +<p id="footer">deprecate — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/docs.html b/deps/npm/html/api/docs.html index 00913e5f36..047236c8e6 100644 --- a/deps/npm/html/api/docs.html +++ b/deps/npm/html/api/docs.html @@ -25,7 +25,7 @@ optional version number.</p> <p>This command will launch a browser, so this command may not be the most friendly for programmatic use.</p> </div> -<p id="footer">docs — npm@1.1.0-2</p> +<p id="footer">docs — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/edit.html b/deps/npm/html/api/edit.html index fbf2ff1cba..3bf153d133 100644 --- a/deps/npm/html/api/edit.html +++ b/deps/npm/html/api/edit.html @@ -30,7 +30,7 @@ to open. The package can optionally have a version number attached.</p> <p>Since this command opens an editor in a new process, be careful about where and how this is used.</p> </div> -<p id="footer">edit — npm@1.1.0-2</p> +<p id="footer">edit — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/explore.html b/deps/npm/html/api/explore.html index 29fe1f2059..c929960e72 100644 --- a/deps/npm/html/api/explore.html +++ b/deps/npm/html/api/explore.html @@ -24,7 +24,7 @@ sure to use <code>npm rebuild <pkg></code> if you make any changes.</p> <p>The first element in the 'args' parameter must be a package name. After that is the optional command, which can be any number of strings. All of the strings will be combined into one, space-delimited command.</p> </div> -<p id="footer">explore — npm@1.1.0-2</p> +<p id="footer">explore — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/help-search.html b/deps/npm/html/api/help-search.html index d784c426f2..d5c6f046cd 100644 --- a/deps/npm/html/api/help-search.html +++ b/deps/npm/html/api/help-search.html @@ -32,7 +32,7 @@ Name of the file that matched</li></ul> <p>The silent parameter is not neccessary not used, but it may in the future.</p> </div> -<p id="footer">help-search — npm@1.1.0-2</p> +<p id="footer">help-search — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/init.html b/deps/npm/html/api/init.html index 1a45b58daf..30a409425f 100644 --- a/deps/npm/html/api/init.html +++ b/deps/npm/html/api/init.html @@ -35,7 +35,7 @@ then go ahead and use this programmatically.</p> <p><a href="../doc/json.html">json(1)</a></p> </div> -<p id="footer">init — npm@1.1.0-2</p> +<p id="footer">init — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/install.html b/deps/npm/html/api/install.html index 41d51b37c0..c49f5f2375 100644 --- a/deps/npm/html/api/install.html +++ b/deps/npm/html/api/install.html @@ -25,7 +25,7 @@ the name of a package to be installed.</p> <p>Finally, 'callback' is a function that will be called when all packages have been installed or when an error has been encountered.</p> </div> -<p id="footer">install — npm@1.1.0-2</p> +<p id="footer">install — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/link.html b/deps/npm/html/api/link.html index eb1151c17a..a4714a4add 100644 --- a/deps/npm/html/api/link.html +++ b/deps/npm/html/api/link.html @@ -39,7 +39,7 @@ npm.commands.link('redis', cb) # link-install the package</code></pre> <p>Now, any changes to the redis package will be reflected in the package in the current working directory</p> </div> -<p id="footer">link — npm@1.1.0-2</p> +<p id="footer">link — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/load.html b/deps/npm/html/api/load.html index f134cfcb50..500e923878 100644 --- a/deps/npm/html/api/load.html +++ b/deps/npm/html/api/load.html @@ -32,7 +32,7 @@ config object.</p> <p>For a list of all the available command-line configs, see <code>npm help config</code></p> </div> -<p id="footer">load — npm@1.1.0-2</p> +<p id="footer">load — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/ls.html b/deps/npm/html/api/ls.html index d68d94579d..b59e502d2a 100644 --- a/deps/npm/html/api/ls.html +++ b/deps/npm/html/api/ls.html @@ -28,6 +28,12 @@ like with any other command, such as <code>global</code> to list global packages <p>If the silent parameter is set to true, nothing will be output to the screen, but the data will still be returned.</p> +<p>Callback is provided an error if one occurred, the full data about which +packages are installed and which dependencies they will receive, and a +"lite" data object which just shows which versions are installed where. +Note that the full data object is a circular structure, so care must be +taken if it is serialized to JSON.</p> + <h2 id="CONFIGURATION">CONFIGURATION</h2> <h3 id="long">long</h3> @@ -53,7 +59,7 @@ project.</p> This means that if a submodule a same dependency as a parent module, then the dependency will only be output once.</p> </div> -<p id="footer">ls — npm@1.1.0-2</p> +<p id="footer">ls — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/npm.html b/deps/npm/html/api/npm.html index f01571b28b..5652c8f618 100644 --- a/deps/npm/html/api/npm.html +++ b/deps/npm/html/api/npm.html @@ -24,7 +24,7 @@ npm.load(configObject, function (er, npm) { <h2 id="VERSION">VERSION</h2> -<p>1.1.0-2</p> +<p>1.1.21</p> <h2 id="DESCRIPTION">DESCRIPTION</h2> @@ -91,7 +91,7 @@ method names. Use the <code>npm.deref</code> method to find the real name.</p> <pre><code>var cmd = npm.deref("unp") // cmd === "unpublish"</code></pre> </div> -<p id="footer">npm — npm@1.1.0-2</p> +<p id="footer">npm — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/outdated.html b/deps/npm/html/api/outdated.html index f145e17d9b..5776a6153b 100644 --- a/deps/npm/html/api/outdated.html +++ b/deps/npm/html/api/outdated.html @@ -19,7 +19,7 @@ currently outdated.</p> <p>If the 'packages' parameter is left out, npm will check all packages.</p> </div> -<p id="footer">outdated — npm@1.1.0-2</p> +<p id="footer">outdated — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/owner.html b/deps/npm/html/api/owner.html index 7829e5b098..86c1592b1a 100644 --- a/deps/npm/html/api/owner.html +++ b/deps/npm/html/api/owner.html @@ -34,7 +34,7 @@ that is not implemented at this time.</p> <ul><li><a href="../api/publish.html">publish(3)</a></li><li><a href="../doc/registry.html">registry(1)</a></li></ul> </div> -<p id="footer">owner — npm@1.1.0-2</p> +<p id="footer">owner — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/pack.html b/deps/npm/html/api/pack.html index cc6cd870ad..93f8f6557b 100644 --- a/deps/npm/html/api/pack.html +++ b/deps/npm/html/api/pack.html @@ -25,7 +25,7 @@ overwritten the second time.</p> <p>If no arguments are supplied, then npm packs the current package folder.</p> </div> -<p id="footer">pack — npm@1.1.0-2</p> +<p id="footer">pack — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/prefix.html b/deps/npm/html/api/prefix.html index 52c5c8d55a..d3e89ae56e 100644 --- a/deps/npm/html/api/prefix.html +++ b/deps/npm/html/api/prefix.html @@ -21,7 +21,7 @@ <p>This function is not useful programmatically</p> </div> -<p id="footer">prefix — npm@1.1.0-2</p> +<p id="footer">prefix — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/prune.html b/deps/npm/html/api/prune.html index e40426942a..005c898ed7 100644 --- a/deps/npm/html/api/prune.html +++ b/deps/npm/html/api/prune.html @@ -23,7 +23,7 @@ <p>Extraneous packages are packages that are not listed on the parent package's dependencies list.</p> </div> -<p id="footer">prune — npm@1.1.0-2</p> +<p id="footer">prune — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/publish.html b/deps/npm/html/api/publish.html index 7e80a2cc1f..046cbf1bcd 100644 --- a/deps/npm/html/api/publish.html +++ b/deps/npm/html/api/publish.html @@ -32,7 +32,7 @@ the registry. Overwrites when the "force" environment variable is set.</p> <ul><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/adduser.html">adduser(1)</a></li><li><a href="../api/owner.html">owner(3)</a></li></ul> </div> -<p id="footer">publish — npm@1.1.0-2</p> +<p id="footer">publish — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/rebuild.html b/deps/npm/html/api/rebuild.html index 271c85cf4b..3573f3006a 100644 --- a/deps/npm/html/api/rebuild.html +++ b/deps/npm/html/api/rebuild.html @@ -22,7 +22,7 @@ the new binary. If no 'packages' parameter is specify, every package will be reb <p>See <code>npm help build</code></p> </div> -<p id="footer">rebuild — npm@1.1.0-2</p> +<p id="footer">rebuild — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/restart.html b/deps/npm/html/api/restart.html index bbff37d955..7ae34f6c91 100644 --- a/deps/npm/html/api/restart.html +++ b/deps/npm/html/api/restart.html @@ -27,7 +27,7 @@ in the <code>packages</code> parameter.</p> <ul><li><a href="../api/start.html">start(3)</a></li><li><a href="../api/stop.html">stop(3)</a></li></ul> </div> -<p id="footer">restart — npm@1.1.0-2</p> +<p id="footer">restart — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/root.html b/deps/npm/html/api/root.html index fe1e0ddd24..7300437d0e 100644 --- a/deps/npm/html/api/root.html +++ b/deps/npm/html/api/root.html @@ -21,7 +21,7 @@ <p>This function is not useful programmatically.</p> </div> -<p id="footer">root — npm@1.1.0-2</p> +<p id="footer">root — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/run-script.html b/deps/npm/html/api/run-script.html index 6fc2ed3b91..bf26c372a1 100644 --- a/deps/npm/html/api/run-script.html +++ b/deps/npm/html/api/run-script.html @@ -29,7 +29,7 @@ assumed to be the command to run. All other elements are ignored.</p> <ul><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../api/test.html">test(3)</a></li><li><a href="../api/start.html">start(3)</a></li><li><a href="../api/restart.html">restart(3)</a></li><li><a href="../api/stop.html">stop(3)</a></li></ul> </div> -<p id="footer">run-script — npm@1.1.0-2</p> +<p id="footer">run-script — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/search.html b/deps/npm/html/api/search.html index dace13e2e0..2da9d9fb3a 100644 --- a/deps/npm/html/api/search.html +++ b/deps/npm/html/api/search.html @@ -32,7 +32,7 @@ excluded term (the "searchexclude" config). The search is case insensitive and doesn't try to read your mind (it doesn't do any verb tense matching or the like).</p> </div> -<p id="footer">search — npm@1.1.0-2</p> +<p id="footer">search — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/shrinkwrap.html b/deps/npm/html/api/shrinkwrap.html index fb9d91fc4c..2f08685b1f 100644 --- a/deps/npm/html/api/shrinkwrap.html +++ b/deps/npm/html/api/shrinkwrap.html @@ -26,7 +26,7 @@ but the shrinkwrap file will still be written.</p> <p>Finally, 'callback' is a function that will be called when the shrinkwrap has been saved.</p> </div> -<p id="footer">shrinkwrap — npm@1.1.16</p> +<p id="footer">shrinkwrap — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/start.html b/deps/npm/html/api/start.html index 28f6eb34fb..9ab6bfd21a 100644 --- a/deps/npm/html/api/start.html +++ b/deps/npm/html/api/start.html @@ -19,7 +19,7 @@ <p>npm can run tests on multiple packages. Just specify multiple packages in the <code>packages</code> parameter.</p> </div> -<p id="footer">start — npm@1.1.0-2</p> +<p id="footer">start — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/stop.html b/deps/npm/html/api/stop.html index d6fd91ce88..191aaec469 100644 --- a/deps/npm/html/api/stop.html +++ b/deps/npm/html/api/stop.html @@ -19,7 +19,7 @@ <p>npm can run stop on multiple packages. Just specify multiple packages in the <code>packages</code> parameter.</p> </div> -<p id="footer">stop — npm@1.1.0-2</p> +<p id="footer">stop — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/submodule.html b/deps/npm/html/api/submodule.html index a9fed04a54..35a48c7f47 100644 --- a/deps/npm/html/api/submodule.html +++ b/deps/npm/html/api/submodule.html @@ -33,7 +33,7 @@ dependencies into the submodule folder.</p> <ul><li>npm help json</li><li>git help submodule</li></ul> </div> -<p id="footer">submodule — npm@1.1.0-2</p> +<p id="footer">submodule — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/tag.html b/deps/npm/html/api/tag.html index c94f459de2..77109f6fca 100644 --- a/deps/npm/html/api/tag.html +++ b/deps/npm/html/api/tag.html @@ -29,7 +29,7 @@ parameter is missing or falsey (empty), the default froom the config will be used. For more information about how to set this config, check <code>man 3 npm-config</code> for programmatic usage or <code>man npm-config</code> for cli usage.</p> </div> -<p id="footer">tag — npm@1.1.0-2</p> +<p id="footer">tag — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/test.html b/deps/npm/html/api/test.html index d72d7cdf1c..a6ea69c941 100644 --- a/deps/npm/html/api/test.html +++ b/deps/npm/html/api/test.html @@ -22,7 +22,7 @@ true.</p> <p>npm can run tests on multiple packages. Just specify multiple packages in the <code>packages</code> parameter.</p> </div> -<p id="footer">test — npm@1.1.0-2</p> +<p id="footer">test — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/uninstall.html b/deps/npm/html/api/uninstall.html index 1b86afc012..aa5d797d12 100644 --- a/deps/npm/html/api/uninstall.html +++ b/deps/npm/html/api/uninstall.html @@ -22,7 +22,7 @@ the name of a package to be uninstalled.</p> <p>Finally, 'callback' is a function that will be called when all packages have been uninstalled or when an error has been encountered.</p> </div> -<p id="footer">uninstall — npm@1.1.0-2</p> +<p id="footer">uninstall — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/unpublish.html b/deps/npm/html/api/unpublish.html index d5afd9a87f..3211d6aca8 100644 --- a/deps/npm/html/api/unpublish.html +++ b/deps/npm/html/api/unpublish.html @@ -26,7 +26,7 @@ is what is meant.</p> <p>If no version is specified, or if all versions are removed then the root package entry is removed from the registry entirely.</p> </div> -<p id="footer">unpublish — npm@1.1.0-2</p> +<p id="footer">unpublish — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/update.html b/deps/npm/html/api/update.html index a9db9fa58a..7dcf3cefd1 100644 --- a/deps/npm/html/api/update.html +++ b/deps/npm/html/api/update.html @@ -18,7 +18,7 @@ <p>The 'packages' argument is an array of packages to update. The 'callback' parameter will be called when done or when an error occurs.</p> </div> -<p id="footer">update — npm@1.1.0-2</p> +<p id="footer">update — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/version.html b/deps/npm/html/api/version.html index 4c4e906a21..e18618316e 100644 --- a/deps/npm/html/api/version.html +++ b/deps/npm/html/api/version.html @@ -24,7 +24,7 @@ fail if the repo is not clean.</p> parameter. The difference, however, is this function will fail if it does not have exactly one element. The only element should be a version number.</p> </div> -<p id="footer">version — npm@1.1.0-2</p> +<p id="footer">version — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/view.html b/deps/npm/html/api/view.html index d25d2db419..1c14db9db8 100644 --- a/deps/npm/html/api/view.html +++ b/deps/npm/html/api/view.html @@ -99,7 +99,7 @@ the field name.</p> <p>corresponding to the list of fields selected.</p> </div> -<p id="footer">view — npm@1.1.0-2</p> +<p id="footer">view — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/api/whoami.html b/deps/npm/html/api/whoami.html index 85b3134952..fb1de1a8b0 100644 --- a/deps/npm/html/api/whoami.html +++ b/deps/npm/html/api/whoami.html @@ -21,7 +21,7 @@ <p>This function is not useful programmatically</p> </div> -<p id="footer">whoami — npm@1.1.0-2</p> +<p id="footer">whoami — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/README.html b/deps/npm/html/doc/README.html index b353238bfc..5d01720293 100644 --- a/deps/npm/html/doc/README.html +++ b/deps/npm/html/doc/README.html @@ -267,7 +267,7 @@ will no doubt tell you to put the output in a gist or email.</p> <ul><li><a href="../doc/npm.html">npm(1)</a></li><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/help.html">help(1)</a></li><li><a href="../doc/index.html">index(1)</a></li></ul> </div> -<p id="footer"><a href="../doc/README.html">README</a> — npm@1.1.0-2</p> +<p id="footer"><a href="../doc/README.html">README</a> — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/adduser.html b/deps/npm/html/doc/adduser.html index 9757f703e6..3ec0580d2a 100644 --- a/deps/npm/html/doc/adduser.html +++ b/deps/npm/html/doc/adduser.html @@ -39,7 +39,7 @@ authorize on a new machine.</p> <ul><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/owner.html">owner(1)</a></li><li><a href="../doc/whoami.html">whoami(1)</a></li></ul> </div> -<p id="footer">adduser — npm@1.1.0-2</p> +<p id="footer">adduser — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/bin.html b/deps/npm/html/doc/bin.html index 582493e575..b4b90d5416 100644 --- a/deps/npm/html/doc/bin.html +++ b/deps/npm/html/doc/bin.html @@ -20,7 +20,7 @@ <ul><li><a href="../doc/prefix.html">prefix(1)</a></li><li><a href="../doc/root.html">root(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/config.html">config(1)</a></li></ul> </div> -<p id="footer">bin — npm@1.1.0-2</p> +<p id="footer">bin — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/bugs.html b/deps/npm/html/doc/bugs.html index 4653330968..20d6a66bb4 100644 --- a/deps/npm/html/doc/bugs.html +++ b/deps/npm/html/doc/bugs.html @@ -36,7 +36,7 @@ config param.</p> <ul><li><a href="../doc/docs.html">docs(1)</a></li><li><a href="../doc/view.html">view(1)</a></li><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/json.html">json(1)</a></li></ul> </div> -<p id="footer">bugs — npm@1.1.0-2</p> +<p id="footer">bugs — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/build.html b/deps/npm/html/doc/build.html index d0709fb51d..4930a22b34 100644 --- a/deps/npm/html/doc/build.html +++ b/deps/npm/html/doc/build.html @@ -25,7 +25,7 @@ A folder containing a <code>package.json</code> file in its root.</li></ul> <ul><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/link.html">link(1)</a></li><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../doc/json.html">json(1)</a></li></ul> </div> -<p id="footer">build — npm@1.1.0-2</p> +<p id="footer">build — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/bundle.html b/deps/npm/html/doc/bundle.html index b449b49154..12acd35a21 100644 --- a/deps/npm/html/doc/bundle.html +++ b/deps/npm/html/doc/bundle.html @@ -20,7 +20,7 @@ install packages into the local space.</p> <ul><li><a href="../doc/install.html">install(1)</a></li></ul> </div> -<p id="footer">bundle — npm@1.1.0-2</p> +<p id="footer">bundle — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/cache.html b/deps/npm/html/doc/cache.html index 92fbf64670..083f4818cd 100644 --- a/deps/npm/html/doc/cache.html +++ b/deps/npm/html/doc/cache.html @@ -66,7 +66,7 @@ they do not make an HTTP request to the registry.</p> <ul><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/pack.html">pack(1)</a></li></ul> </div> -<p id="footer">cache — npm@1.1.0-2</p> +<p id="footer">cache — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/changelog.html b/deps/npm/html/doc/changelog.html index 514b76258f..89737e4ceb 100644 --- a/deps/npm/html/doc/changelog.html +++ b/deps/npm/html/doc/changelog.html @@ -10,6 +10,37 @@ <h2 id="HISTORY">HISTORY</h2> +<h3 id="1-1-3-1-1-4">1.1.3, 1.1.4</h3> + +<ul><li>Update request to support HTTPS-over-HTTP proxy tunneling</li><li>Throw on undefined envs in config settings</li><li>Update which to 1.0.5</li><li>Fix windows UNC busyloop in findPrefix</li><li>Bundle nested bundleDependencies properly</li><li>Alias adduser to add-user</li><li>Doc updates (Christian Howe, Henrik Hodne, Andrew Lunny)</li><li>ignore logfd/outfd streams in makeEnv() (Rod Vagg)</li><li>shrinkwrap: Behave properly with url-installed deps</li><li>install: Support --save with url install targets</li><li>Support installing naked tars or single-file modules from urls etc.</li><li>init: Don't add engines section</li><li>Don't run make clean on rebuild</li><li>Added missing unicode replacement (atomizer)</li></ul> + +<h3 id="1-1-2">1.1.2</h3> + +<p>Dave Pacheco (2): + add "npm shrinkwrap"</p> + +<p>Martin Cooper (1): + Fix #1753 Make a copy of the cached objects we'll modify.</p> + +<p>Tim Oxley (1): + correctly remove readme from default npm view command.</p> + +<p>Tyler Green (1): + fix #2187 set terminal columns to Infinity if 0</p> + +<p>isaacs (19): + update minimatch + update request + Experimental: single-file modules + Fix #2172 Don't remove global mans uninstalling local pkgs + Add --versions flag to show the version of node as well + Support --json flag for ls output + update request to 2.9.151</p> + +<h3 id="1-1">1.1</h3> + +<ul><li>Replace system tar dependency with a JS tar</li><li>Continue to refine</li></ul> + <h3 id="1-0">1.0</h3> <ul><li>Greatly simplified folder structure </li><li>Install locally (bundle by default) </li><li>Drastic rearchitecture</li></ul> @@ -34,7 +65,7 @@ <ul><li><a href="../doc/npm.html">npm(1)</a></li><li><a href="../doc/faq.html">faq(1)</a></li></ul> </div> -<p id="footer">changelog — npm@1.1.0-2</p> +<p id="footer">changelog — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/coding-style.html b/deps/npm/html/doc/coding-style.html index 1d05ff507f..6579fabc99 100644 --- a/deps/npm/html/doc/coding-style.html +++ b/deps/npm/html/doc/coding-style.html @@ -64,7 +64,7 @@ while (foo) { <p>Don't use them except in four situations:</p> <ul><li><code>for (;;)</code> loops. They're actually required.</li><li>null loops like: <code>while (something) ;</code> (But you'd better have a good -reason for doing that.)</li><li>case "foo": doSomething(); break</li><li>In front of a leading ( or [ at the start of the line. +reason for doing that.)</li><li><code>case "foo": doSomething(); break</code></li><li>In front of a leading <code>(</code> or <code>[</code> at the start of the line. This prevents the expression from being interpreted as a function call or property access, respectively.</li></ul> @@ -191,7 +191,7 @@ set to anything."</p> <ul><li><a href="../doc/developers.html">developers(1)</a></li><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/npm.html">npm(1)</a></li></ul> </div> -<p id="footer">coding-style — npm@1.1.0-2</p> +<p id="footer">coding-style — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/completion.html b/deps/npm/html/doc/completion.html index 386a2760ae..3d82750a43 100644 --- a/deps/npm/html/doc/completion.html +++ b/deps/npm/html/doc/completion.html @@ -33,7 +33,7 @@ completions based on the arguments.</p> <ul><li><a href="../doc/developers.html">developers(1)</a></li><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/npm.html">npm(1)</a></li></ul> </div> -<p id="footer">completion — npm@1.1.0-2</p> +<p id="footer">completion — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/config.html b/deps/npm/html/doc/config.html index c950154f24..cc9a0dc22f 100644 --- a/deps/npm/html/doc/config.html +++ b/deps/npm/html/doc/config.html @@ -105,7 +105,7 @@ global config.</p> <p>The following shorthands are parsed on the command-line:</p> -<ul><li><code>-v</code>: <code>--version</code></li><li><code>-h</code>, <code>-?</code>, <code>--help</code>, <code>-H</code>: <code>--usage</code></li><li><code>-s</code>, <code>--silent</code>: <code>--loglevel silent</code></li><li><code>-q</code>, <code>--quiet</code>: <code>--loglevel warn</code></li><li><code>-d</code>: <code>--loglevel info</code></li><li><code>-dd</code>, <code>--verbose</code>: <code>--loglevel verbose</code></li><li><code>-ddd</code>: <code>--loglevel silly</code></li><li><code>-g</code>: <code>--global</code></li><li><code>-l</code>: <code>--long</code></li><li><code>-m</code>: <code>--message</code></li><li><code>-p</code>, <code>--porcelain</code>: <code>--parseable</code></li><li><code>-reg</code>: <code>--registry</code></li><li><code>-v</code>: <code>--version</code></li><li><code>-f</code>: <code>--force</code></li><li><code>-l</code>: <code>--long</code></li><li><code>-desc</code>: <code>--description</code></li><li><code>-S</code>: <code>--save</code></li><li><code>-y</code>: <code>--yes</code></li><li><code>-n</code>: <code>--yes false</code></li><li><code>ll</code> and <code>la</code> commands: <code>ls --long</code></li></ul> +<ul><li><code>-v</code>: <code>--version</code></li><li><code>-h</code>, <code>-?</code>, <code>--help</code>, <code>-H</code>: <code>--usage</code></li><li><code>-s</code>, <code>--silent</code>: <code>--loglevel silent</code></li><li><code>-q</code>, <code>--quiet</code>: <code>--loglevel warn</code></li><li><code>-d</code>: <code>--loglevel info</code></li><li><code>-dd</code>, <code>--verbose</code>: <code>--loglevel verbose</code></li><li><code>-ddd</code>: <code>--loglevel silly</code></li><li><code>-g</code>: <code>--global</code></li><li><code>-l</code>: <code>--long</code></li><li><code>-m</code>: <code>--message</code></li><li><code>-p</code>, <code>--porcelain</code>: <code>--parseable</code></li><li><code>-reg</code>: <code>--registry</code></li><li><code>-v</code>: <code>--version</code></li><li><code>-f</code>: <code>--force</code></li><li><code>-l</code>: <code>--long</code></li><li><code>-desc</code>: <code>--description</code></li><li><code>-S</code>: <code>--save</code></li><li><code>-D</code>: <code>--save-dev</code></li><li><code>-O</code>: <code>--save-optional</code></li><li><code>-y</code>: <code>--yes</code></li><li><code>-n</code>: <code>--yes false</code></li><li><code>ll</code> and <code>la</code> commands: <code>ls --long</code></li></ul> <p>If the specified configuration param resolves unambiguously to a known configuration parameter, then it is expanded to that configuration @@ -200,6 +200,26 @@ to trust only that specific signing authority.</p> <p>The location of npm's cache directory. See <code><a href="../doc/cache.html">cache(1)</a></code></p> +<h3 id="cache-max">cache-max</h3> + +<ul><li>Default: Infinity</li><li>Type: Number</li></ul> + +<p>The maximum time (in seconds) to keep items in the registry cache before +re-checking against the registry.</p> + +<p>Note that no purging is done unless the <code>npm cache clean</code> command is +explicitly used, and that only GET requests use the cache.</p> + +<h3 id="cache-min">cache-min</h3> + +<ul><li>Default: 0</li><li>Type: Number</li></ul> + +<p>The minimum time (in seconds) to keep items in the registry cache before +re-checking against the registry.</p> + +<p>Note that no purging is done unless the <code>npm cache clean</code> command is +explicitly used, and that only GET requests use the cache.</p> + <h3 id="color">color</h3> <ul><li>Default: true on Posix, false on Windows</li><li>Type: Boolean or <code>"always"</code></li></ul> @@ -300,6 +320,12 @@ user.</p> <p>A proxy to use for outgoing https requests.</p> +<h3 id="user-agent">user-agent</h3> + +<ul><li>Default: npm/{npm.version} node/{process.version}</li><li>Type: String</li></ul> + +<p>Sets a User-Agent to the request header</p> + <h3 id="ignore">ignore</h3> <ul><li>Default: ""</li><li>Type: string</li></ul> @@ -315,7 +341,7 @@ from packages when building tarballs.</p> <h3 id="init-author-name">init.author.name</h3> -<ul><li>Default: "0.0.0"</li><li>Type: String</li></ul> +<ul><li>Default: ""</li><li>Type: String</li></ul> <p>The value <code>npm init</code> should use by default for the package author's name.</p> @@ -331,6 +357,16 @@ from packages when building tarballs.</p> <p>The value <code>npm init</code> should use by default for the package author's homepage.</p> +<h3 id="json">json</h3> + +<ul><li>Default: false</li><li>Type: Boolean</li></ul> + +<p>Whether or not to output JSON data, rather than the normal output.</p> + +<p>This feature is currently experimental, and the output data structures +for many commands is either not implemented in JSON yet, or subject to +change. Only the output from <code>npm ls --json</code> is currently valid.</p> + <h3 id="link">link</h3> <ul><li>Default: false</li><li>Type: Boolean</li></ul> @@ -480,6 +516,22 @@ this as true.</p> <p>Only works if there is already a package.json file present.</p> +<h3 id="save-dev">save-dev</h3> + +<ul><li>Default: false</li><li>Type: Boolean</li></ul> + +<p>Save installed packages to a package.json file as devDependencies.</p> + +<p>Only works if there is already a package.json file present.</p> + +<h3 id="save-optional">save-optional</h3> + +<ul><li>Default: false</li><li>Type: Boolean</li></ul> + +<p>Save installed packages to a package.json file as optionalDependencies.</p> + +<p>Only works if there is already a package.json file present.</p> + <h3 id="searchopts">searchopts</h3> <ul><li>Default: ""</li><li>Type: String</li></ul> @@ -601,6 +653,15 @@ this value. Thus, the defaults are <code>0755</code> and <code>0644</code> resp <p>Only relevant when specified explicitly on the command line.</p> +<h3 id="versions">versions</h3> + +<ul><li>Default: false</li><li>Type: boolean</li></ul> + +<p>If true, output the npm version as well as node's <code>process.versions</code> +hash, and exit successfully.</p> + +<p>Only relevant when specified explicitly on the command line.</p> + <h3 id="viewer">viewer</h3> <ul><li>Default: "man" on Posix, "browser" on Windows</li><li>Type: path</li></ul> @@ -623,7 +684,7 @@ then answer "no" to any prompt.</p> <ul><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/npm.html">npm(1)</a></li></ul> </div> -<p id="footer">config — npm@1.1.0-2</p> +<p id="footer">config — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/deprecate.html b/deps/npm/html/doc/deprecate.html index 43f07a490f..a79ca7c5ca 100644 --- a/deps/npm/html/doc/deprecate.html +++ b/deps/npm/html/doc/deprecate.html @@ -29,7 +29,7 @@ something like this:</p> <ul><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li></ul> </div> -<p id="footer">deprecate — npm@1.1.0-2</p> +<p id="footer">deprecate — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/developers.html b/deps/npm/html/doc/developers.html index ba3189bb60..6f86cc26a7 100644 --- a/deps/npm/html/doc/developers.html +++ b/deps/npm/html/doc/developers.html @@ -28,13 +28,23 @@ topic, or <code>npm help thing</code> to see the same information.</p> <p>A package is:</p> -<ul><li>a) a folder containing a program described by a package.json file</li><li>b) a gzipped tarball containing (a)</li><li>c) a url that resolves to (b)</li><li>d) a <code><name>@<version></code> that is published on the registry with (c)</li><li>e) a <code><name>@<tag></code> that points to (d)</li><li>f) a <code><name></code> that has a "latest" tag satisfying (e)</li></ul> +<ul><li>a) a folder containing a program described by a package.json file</li><li>b) a gzipped tarball containing (a)</li><li>c) a url that resolves to (b)</li><li>d) a <code><name>@<version></code> that is published on the registry with (c)</li><li>e) a <code><name>@<tag></code> that points to (d)</li><li>f) a <code><name></code> that has a "latest" tag satisfying (e)</li><li>g) a <code>git</code> url that, when cloned, results in (a).</li></ul> <p>Even if you never publish your package, you can still get a lot of benefits of using npm if you just want to write a node program (a), and perhaps if you also want to be able to easily install it elsewhere after packing it up into a tarball (b).</p> +<p>Git urls can be of the form:</p> + +<pre><code>git://github.com/user/project.git#commit-ish +git+ssh://user@hostname:project.git#commit-ish +git+http://user@hostname/project/blah.git#commit-ish +git+https://user@hostname/project/blah.git#commit-ish</code></pre> + +<p>The <code>commit-ish</code> can be any tag, sha, or branch which can be supplied as +an argument to <code>git checkout</code>. The default is <code>master</code>.</p> + <h2 id="The-package-json-File">The package.json File</h2> <p>You need to have a <code>package.json</code> file in the root of your project to do @@ -150,7 +160,7 @@ from a fresh checkout.</p> <ul><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/npm.html">npm(1)</a></li><li><a href="../doc/init.html">init(1)</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/adduser.html">adduser(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li></ul> </div> -<p id="footer">developers — npm@1.1.0-2</p> +<p id="footer">developers — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/disputes.html b/deps/npm/html/doc/disputes.html index 074fa001e2..721f7d06af 100644 --- a/deps/npm/html/doc/disputes.html +++ b/deps/npm/html/doc/disputes.html @@ -80,7 +80,7 @@ license statement)</li><li>Illegal content.</li></ol> <ul><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/owner.html">owner(1)</a></li></ul> </div> -<p id="footer">disputes — npm@1.1.0-2</p> +<p id="footer">disputes — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/docs.html b/deps/npm/html/doc/docs.html index aad9a402c1..870dfa7f20 100644 --- a/deps/npm/html/doc/docs.html +++ b/deps/npm/html/doc/docs.html @@ -37,7 +37,7 @@ config param.</p> <ul><li><a href="../doc/view.html">view(1)</a></li><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/json.html">json(1)</a></li></ul> </div> -<p id="footer">docs — npm@1.1.0-2</p> +<p id="footer">docs — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/edit.html b/deps/npm/html/doc/edit.html index 0a5371e16f..51ca677c66 100644 --- a/deps/npm/html/doc/edit.html +++ b/deps/npm/html/doc/edit.html @@ -37,7 +37,7 @@ or <code>"notepad"</code> on Windows.</li><li>Type: path</li></ul> <ul><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/explore.html">explore(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/config.html">config(1)</a></li></ul> </div> -<p id="footer">edit — npm@1.1.0-2</p> +<p id="footer">edit — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/explore.html b/deps/npm/html/doc/explore.html index 6c29e11235..e1f12bf437 100644 --- a/deps/npm/html/doc/explore.html +++ b/deps/npm/html/doc/explore.html @@ -40,7 +40,7 @@ Windows</li><li>Type: path</li></ul> <ul><li><a href="../doc/submodule.html">submodule(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/edit.html">edit(1)</a></li><li><a href="../doc/rebuild.html">rebuild(1)</a></li><li><a href="../doc/build.html">build(1)</a></li><li><a href="../doc/install.html">install(1)</a></li></ul> </div> -<p id="footer">explore — npm@1.1.0-2</p> +<p id="footer">explore — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/faq.html b/deps/npm/html/doc/faq.html index d4853ac42f..b5bed0c567 100644 --- a/deps/npm/html/doc/faq.html +++ b/deps/npm/html/doc/faq.html @@ -241,7 +241,7 @@ We'll have someone kick it or something.</p> <ul><li><a href="../doc/npm.html">npm(1)</a></li><li><a href="../doc/developers.html">developers(1)</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li></ul> </div> -<p id="footer">faq — npm@1.1.0-2</p> +<p id="footer">faq — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/folders.html b/deps/npm/html/doc/folders.html index 987c5b8a86..127c452a56 100644 --- a/deps/npm/html/doc/folders.html +++ b/deps/npm/html/doc/folders.html @@ -205,7 +205,7 @@ cannot be found elsewhere. See <code><a href="../doc/json.html">json(1)</a></co <ul><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/pack.html">pack(1)</a></li><li><a href="../doc/cache.html">cache(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/publish.html">publish(1)</a></li></ul> </div> -<p id="footer">folders — npm@1.1.0-2</p> +<p id="footer">folders — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/help-search.html b/deps/npm/html/doc/help-search.html index 92e8f2e545..45fa055532 100644 --- a/deps/npm/html/doc/help-search.html +++ b/deps/npm/html/doc/help-search.html @@ -38,7 +38,7 @@ where the terms were found in the documentation.</p> <ul><li><a href="../doc/npm.html">npm(1)</a></li><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/help.html">help(1)</a></li></ul> </div> -<p id="footer">help-search — npm@1.1.0-2</p> +<p id="footer">help-search — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/help.html b/deps/npm/html/doc/help.html index 576df1b25e..b4ee8a7703 100644 --- a/deps/npm/html/doc/help.html +++ b/deps/npm/html/doc/help.html @@ -36,7 +36,7 @@ matches are equivalent to specifying a topic name.</p> <ul><li><a href="../doc/npm.html">npm(1)</a></li><li><a href="../doc/README.html">README</a></li><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/help-search.html">help-search(1)</a></li><li><a href="../doc/index.html">index(1)</a></li></ul> </div> -<p id="footer">help — npm@1.1.0-2</p> +<p id="footer">help — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/index.html b/deps/npm/html/doc/index.html index cd527bb2ae..a7e647ef47 100644 --- a/deps/npm/html/doc/index.html +++ b/deps/npm/html/doc/index.html @@ -178,6 +178,10 @@ <p> The semantic versioner for npm</p> +<h2 id="npm-shrinkwrap-1"><a href="../doc/shrinkwrap.html">shrinkwrap(1)</a></h2> + +<p> Lock down dependency versions</p> + <h2 id="npm-star-1"><a href="../doc/star.html">star(1)</a></h2> <p> Mark your favorite packages</p> @@ -332,6 +336,10 @@ <p> Search for packages</p> +<h2 id="npm-shrinkwrap-3"><a href="../api/shrinkwrap.html">shrinkwrap(3)</a></h2> + +<p> programmatically generate package shrinkwrap file</p> + <h2 id="npm-start-3"><a href="../api/start.html">start(3)</a></h2> <p> Start a package</p> @@ -376,7 +384,7 @@ <p> Display npm username</p> </div> -<p id="footer">index — npm@1.1.0-2</p> +<p id="footer">index — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/init.html b/deps/npm/html/doc/init.html index fb895e7e61..a090823499 100644 --- a/deps/npm/html/doc/init.html +++ b/deps/npm/html/doc/init.html @@ -29,7 +29,7 @@ without a really good reason to do so.</p> <ul><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/version.html">version(1)</a></li></ul> </div> -<p id="footer">init — npm@1.1.0-2</p> +<p id="footer">init — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/install.html b/deps/npm/html/doc/install.html index f059df5080..df9f5f513c 100644 --- a/deps/npm/html/doc/install.html +++ b/deps/npm/html/doc/install.html @@ -14,14 +14,17 @@ npm install <tarball file> npm install <tarball url> npm install <folder> -npm install <name> +npm install <name> [--save|--save-dev|--save-optional] npm install <name>@<tag> npm install <name>@<version> +npm install <name>@<version range> npm install <name>@<version range></code></pre> <h2 id="DESCRIPTION">DESCRIPTION</h2> -<p>This command installs a package, and any packages that it depends on.</p> +<p>This command installs a package, and any packages that it depends on. If the +package has a shrinkwrap file, the installation of dependencies will be driven +by that. See <a href="../doc/shrinkwrap.html">shrinkwrap(1)</a>.</p> <p>A <code>package</code> is:</p> @@ -32,33 +35,29 @@ benefits of using npm if you just want to write a node program (a), and perhaps if you also want to be able to easily install it elsewhere after packing it up into a tarball (b).</p> -<ul><li><p><code>npm install</code> (in package directory, no arguments): -Install the dependencies in the local node_modules folder.</p><p>In global mode (ie, with <code>-g</code> or <code>--global</code> appended to the command), +<ul><li><p><code>npm install</code> (in package directory, no arguments):</p><p>Install the dependencies in the local node_modules folder.</p><p>In global mode (ie, with <code>-g</code> or <code>--global</code> appended to the command), it installs the current package context (ie, the current working -directory) as a global package.</p></li><li><p><code>npm install <folder></code>: -Install a package that is sitting in a folder on the filesystem.</p></li><li><p><code>npm install <tarball file></code>: -Install a package that is sitting on the filesystem. Note: if you just want +directory) as a global package.</p></li><li><p><code>npm install <folder></code>:</p><p>Install a package that is sitting in a folder on the filesystem.</p></li><li><p><code>npm install <tarball file></code>:</p><p>Install a package that is sitting on the filesystem. Note: if you just want to link a dev directory into your npm root, you can do this more easily by -using <code>npm link</code>.</p><p>Example:</p><pre><code>npm install ./package.tgz</code></pre></li><li><p><code>npm install <tarball url></code>: -Fetch the tarball url, and then install it. In order to distinguish between -this and other options, the argument must start with "http://" or "https://"</p><p>Example:</p><pre><code>npm install https://github.com/indexzero/forever/tarball/v0.5.6</code></pre></li><li><p><code>npm install <name></code>: -Do a <code><name>@<tag></code> install, where <code><tag></code> is the "tag" config. (See -<code><a href="../doc/config.html">config(1)</a></code>)</p><p>Example:</p><pre><code>npm install sax</code></pre><p><strong>Note</strong>: If there is a file or folder named <code><name></code> in the current +using <code>npm link</code>.</p><p>Example:</p><pre><code> npm install ./package.tgz</code></pre></li><li><p><code>npm install <tarball url></code>:</p><p>Fetch the tarball url, and then install it. In order to distinguish between +this and other options, the argument must start with "http://" or "https://"</p><p>Example:</p><pre><code> npm install https://github.com/indexzero/forever/tarball/v0.5.6</code></pre></li><li><p><code>npm install <name> [--save|--save-dev|--save-optional]</code>:</p><p>Do a <code><name>@<tag></code> install, where <code><tag></code> is the "tag" config. (See +<code><a href="../doc/config.html">config(1)</a></code>.)</p><p>In most cases, this will install the latest version +of the module published on npm.</p><p>Example:</p><p> npm install sax</p><p><code>npm install</code> takes 3 exclusive, optional flags which save or update +the package version in your main package.json:</p><ul><li><p><code>--save</code>: Package will appear in your <code>dependencies</code>.</p></li><li><p><code>--save-dev</code>: Package will appear in your <code>devDependencies</code>.</p></li><li><p><code>--save-optional</code>: Package will appear in your <code>optionalDependencies</code>.</p><p>Examples:</p><p> npm install sax --save + npm install node-tap --save-dev + npm install dtrace-provider --save-optional</p><p><strong>Note</strong>: If there is a file or folder named <code><name></code> in the current working directory, then it will try to install that, and only try to -fetch the package by name if it is not valid.</p></li><li><p><code>npm install <name>@<tag></code>: -Install the version of the package that is referenced by the specified tag. +fetch the package by name if it is not valid.</p></li></ul></li><li><p><code>npm install <name>@<tag></code>:</p><p>Install the version of the package that is referenced by the specified tag. If the tag does not exist in the registry data for that package, then this -will fail.</p><p>Example:</p><pre><code>npm install sax@latest</code></pre></li><li><p><code>npm install <name>@<version></code>: -Install the specified version of the package. This will fail if the version -has not been published to the registry.</p><p>Example:</p><pre><code>npm install sax@0.1.1</code></pre></li><li><p><code>npm install <name>@<version range></code>: -Install a version of the package matching the specified version range. This +will fail.</p><p>Example:</p><pre><code> npm install sax@latest</code></pre></li><li><p><code>npm install <name>@<version></code>:</p><p>Install the specified version of the package. This will fail if the version +has not been published to the registry.</p><p>Example:</p><pre><code> npm install sax@0.1.1</code></pre></li><li><p><code>npm install <name>@<version range></code>:</p><p>Install a version of the package matching the specified version range. This will follow the same rules for resolving dependencies described in <code><a href="../doc/json.html">json(1)</a></code>.</p><p>Note that most version ranges must be put in quotes so that your shell will -treat it as a single argument.</p><p>Example:</p><pre><code>npm install sax@">=0.1.0 <0.2.0"</code></pre></li><li><p><code>npm install <git remote url></code>:</p><p>Install a package by cloning a git remote url. The format of the git -url is:</p><pre><code><protocol>://[<user>@]<hostname><separator><path>[#<commit-ish>]</code></pre><p><code><protocol></code> is one of <code>git</code>, <code>git+ssh</code>, <code>git+http</code>, or +treat it as a single argument.</p><p>Example:</p><p> npm install sax@">=0.1.0 <0.2.0"</p></li><li><p><code>npm install <git remote url></code>:</p><p>Install a package by cloning a git remote url. The format of the git +url is:</p><p> <protocol>://[<user>@]<hostname><separator><path>[#<commit-ish>]</p><p><code><protocol></code> is one of <code>git</code>, <code>git+ssh</code>, <code>git+http</code>, or <code>git+https</code>. If no <code><commit-ish></code> is specified, then <code>master</code> is -used.</p><p>Examples:</p><pre><code>git+ssh://git@github.com:isaacs/npm.git#v1.0.27 -git+https://isaacs@github.com/isaacs/npm.git -git://github.com/isaacs/npm.git#v1.0.27</code></pre></li></ul> +used.</p><p>Examples:</p><pre><code> git+ssh://git@github.com:isaacs/npm.git#v1.0.27 + git+https://isaacs@github.com/isaacs/npm.git + git://github.com/isaacs/npm.git#v1.0.27</code></pre></li></ul> <p>You may combine multiple arguments, and even multiple types of arguments. For example:</p> @@ -132,9 +131,9 @@ affects a real use-case, it will be investigated.</p> <h2 id="SEE-ALSO">SEE ALSO</h2> -<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></ul> +<ul><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/update.html">update(1)</a></li><li><a href="../doc/link.html">link(1)</a></li><li><a href="../doc/rebuild.html">rebuild(1)</a></li><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../doc/build.html">build(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/tag.html">tag(1)</a></li><li><a href="../doc/rm.html">rm(1)</a></li><li><a href="../doc/shrinkwrap.html">shrinkwrap(1)</a></li></ul> </div> -<p id="footer">install — npm@1.1.0-2</p> +<p id="footer">install — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/json.html b/deps/npm/html/doc/json.html index 54e29f8b73..480d684127 100644 --- a/deps/npm/html/doc/json.html +++ b/deps/npm/html/doc/json.html @@ -311,7 +311,7 @@ space-separated descriptors, OR a range like "fromVersion - toVersion"</p> <p>Version range descriptors may be any of the following styles, where "version" is a semver compatible version identifier.</p> -<ul><li><code>version</code> Must match <code>version</code> exactly</li><li><code>=version</code> Same as just <code>version</code></li><li><code>>version</code> Must be greater than <code>version</code></li><li><code>>=version</code> etc</li><li><code><version</code></li><li><code><=version</code></li><li><code>~version</code> See 'Tilde Version Ranges' below</li><li><code>1.2.x</code> See 'X Version Ranges' below</li><li><code>http://...</code> See 'URLs as Dependencies' below</li><li><code>*</code> Matches any version</li><li><code>""</code> (just an empty string) Same as <code>*</code></li><li><code>version1 - version2</code> Same as <code>>=version1 <=version2</code>.</li><li><code>range1 || range2</code> Passes if either range1 or range2 are satisfied.</li></ul> +<ul><li><code>version</code> Must match <code>version</code> exactly</li><li><code>=version</code> Same as just <code>version</code></li><li><code>>version</code> Must be greater than <code>version</code></li><li><code>>=version</code> etc</li><li><code><version</code></li><li><code><=version</code></li><li><code>~version</code> See 'Tilde Version Ranges' below</li><li><code>1.2.x</code> See 'X Version Ranges' below</li><li><code>http://...</code> See 'URLs as Dependencies' below</li><li><code>*</code> Matches any version</li><li><code>""</code> (just an empty string) Same as <code>*</code></li><li><code>version1 - version2</code> Same as <code>>=version1 <=version2</code>.</li><li><code>range1 || range2</code> Passes if either range1 or range2 are satisfied.</li><li><code>git...</code> See 'Git URLs as Dependencies' below</li></ul> <p>For example, these are all valid:</p> @@ -360,6 +360,18 @@ of a version range.</p> <p>This tarball will be downloaded and installed locally to your package at install time.</p> +<h3 id="Git-URLs-as-Dependencies">Git URLs as Dependencies</h3> + +<p>Git urls can be of the form:</p> + +<pre><code>git://github.com/user/project.git#commit-ish +git+ssh://user@hostname:project.git#commit-ish +git+http://user@hostname/project/blah.git#commit-ish +git+https://user@hostname/project/blah.git#commit-ish</code></pre> + +<p>The <code>commit-ish</code> can be any tag, sha, or branch which can be supplied as +an argument to <code>git checkout</code>. The default is <code>master</code>.</p> + <h2 id="devDependencies">devDependencies</h2> <p>If someone is planning on downloading and using your module in their @@ -399,6 +411,36 @@ are capable of properly installing your program. For example:</p> <pre><code>{ "engines" : { "npm" : "~1.0.20" } }</code></pre> +<h2 id="os">os</h2> + +<p>You can specify which operating systems your +module will run on:</p> + +<pre><code>"os" : [ "darwin", "linux" ]</code></pre> + +<p>You can also blacklist instead of whitelist operating systems, +just prepend the blacklisted os with a '!':</p> + +<pre><code>"os" : [ "!win32" ]</code></pre> + +<p>The host operating system is determined by <code>process.platform</code></p> + +<p>It is allowed to both blacklist, and whitelist, although there isn't any +good reason to do this.</p> + +<h2 id="cpu">cpu</h2> + +<p>If your code only runs on certain cpu architectures, +you can specify which ones.</p> + +<pre><code>"cpu" : [ "x64", "ia32" ]</code></pre> + +<p>Like the <code>os</code> option, you can also blacklist architectures:</p> + +<pre><code>"cpu" : [ "!arm", "!mips" ]</code></pre> + +<p>The host architecture is determined by <code>process.arch</code></p> + <h2 id="preferGlobal">preferGlobal</h2> <p>If your package is primarily a command-line application that should be @@ -415,7 +457,7 @@ to publish it.</p> <p>This is a way to prevent accidental publication of private repositories. If you would like to ensure that a given package is only ever published -to a speciic registry (for example, an internal registry), +to a specific registry (for example, an internal registry), then use the <code>publishConfig</code> hash described below to override the <code>registry</code> config param at publish-time.</p> @@ -436,7 +478,7 @@ overridden.</p> <ul><li><a href="../doc/semver.html">semver(1)</a></li><li><a href="../doc/init.html">init(1)</a></li><li><a href="../doc/version.html">version(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/help.html">help(1)</a></li><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/rm.html">rm(1)</a></li></ul> </div> -<p id="footer">json — npm@1.1.0-2</p> +<p id="footer">json — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/link.html b/deps/npm/html/doc/link.html index 95cdbdd846..2676834211 100644 --- a/deps/npm/html/doc/link.html +++ b/deps/npm/html/doc/link.html @@ -58,7 +58,7 @@ installation target into your project's <code>node_modules</code> folder.</p> <ul><li><a href="../doc/developers.html">developers(1)</a></li><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/config.html">config(1)</a></li></ul> </div> -<p id="footer">link — npm@1.1.0-2</p> +<p id="footer">link — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/list.html b/deps/npm/html/doc/list.html index 4d25dd7033..615d1119a5 100644 --- a/deps/npm/html/doc/list.html +++ b/deps/npm/html/doc/list.html @@ -29,6 +29,12 @@ like with any other command, such as <code>-g</code> to list global packages.</p <h2 id="CONFIGURATION">CONFIGURATION</h2> +<h3 id="json">json</h3> + +<ul><li>Default: false</li><li>Type: Boolean</li></ul> + +<p>Show information in JSON format.</p> + <h3 id="long">long</h3> <ul><li>Default: false</li><li>Type: Boolean</li></ul> @@ -52,7 +58,7 @@ project.</p> <ul><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/link.html">link(1)</a></li><li><a href="../doc/prune.html">prune(1)</a></li><li><a href="../doc/outdated.html">outdated(1)</a></li><li><a href="../doc/update.html">update(1)</a></li></ul> </div> -<p id="footer">list — npm@1.1.0-2</p> +<p id="footer">list — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/npm.html b/deps/npm/html/doc/npm.html index ba12b6edab..5d80a30f13 100644 --- a/deps/npm/html/doc/npm.html +++ b/deps/npm/html/doc/npm.html @@ -14,7 +14,7 @@ <h2 id="VERSION">VERSION</h2> -<p>1.1.0-2</p> +<p>1.1.21</p> <h2 id="DESCRIPTION">DESCRIPTION</h2> @@ -135,7 +135,7 @@ will no doubt tell you to put the output in a gist or email.</p> <ul><li><a href="../doc/help.html">help(1)</a></li><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/README.html">README</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/index.html">index(1)</a></li><li><a href="../api/npm.html">npm(3)</a></li></ul> </div> -<p id="footer">npm — npm@1.1.0-2</p> +<p id="footer">npm — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/outdated.html b/deps/npm/html/doc/outdated.html index 63f6017441..0067966efb 100644 --- a/deps/npm/html/doc/outdated.html +++ b/deps/npm/html/doc/outdated.html @@ -21,7 +21,7 @@ packages are currently outdated.</p> <ul><li><a href="../doc/update.html">update(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li></ul> </div> -<p id="footer">outdated — npm@1.1.0-2</p> +<p id="footer">outdated — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/owner.html b/deps/npm/html/doc/owner.html index 828307eeec..4a8a77ddc8 100644 --- a/deps/npm/html/doc/owner.html +++ b/deps/npm/html/doc/owner.html @@ -34,7 +34,7 @@ that is not implemented at this time.</p> <ul><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/adduser.html">adduser(1)</a></li><li><a href="../doc/disputes.html">disputes(1)</a></li></ul> </div> -<p id="footer">owner — npm@1.1.0-2</p> +<p id="footer">owner — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/pack.html b/deps/npm/html/doc/pack.html index 6d77e17f9a..290263cf1b 100644 --- a/deps/npm/html/doc/pack.html +++ b/deps/npm/html/doc/pack.html @@ -29,7 +29,7 @@ overwritten the second time.</p> <ul><li><a href="../doc/cache.html">cache(1)</a></li><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/config.html">config(1)</a></li></ul> </div> -<p id="footer">pack — npm@1.1.0-2</p> +<p id="footer">pack — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/prefix.html b/deps/npm/html/doc/prefix.html index eca0805abe..dfa853df1e 100644 --- a/deps/npm/html/doc/prefix.html +++ b/deps/npm/html/doc/prefix.html @@ -20,7 +20,7 @@ <ul><li><a href="../doc/root.html">root(1)</a></li><li><a href="../doc/bin.html">bin(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/config.html">config(1)</a></li></ul> </div> -<p id="footer">prefix — npm@1.1.0-2</p> +<p id="footer">prefix — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/prune.html b/deps/npm/html/doc/prune.html index fc2e919c7e..01474455cf 100644 --- a/deps/npm/html/doc/prune.html +++ b/deps/npm/html/doc/prune.html @@ -25,7 +25,7 @@ package's dependencies list.</p> <ul><li><a href="../doc/rm.html">rm(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/list.html">list(1)</a></li></ul> </div> -<p id="footer">prune — npm@1.1.0-2</p> +<p id="footer">prune — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/publish.html b/deps/npm/html/doc/publish.html index 46662fad0e..ff1d113e3e 100644 --- a/deps/npm/html/doc/publish.html +++ b/deps/npm/html/doc/publish.html @@ -29,7 +29,7 @@ the registry. Overwrites when the "--force" flag is set.</p> <ul><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/adduser.html">adduser(1)</a></li><li><a href="../doc/owner.html">owner(1)</a></li><li><a href="../doc/deprecate.html">deprecate(1)</a></li><li><a href="../doc/tag.html">tag(1)</a></li></ul> </div> -<p id="footer">publish — npm@1.1.0-2</p> +<p id="footer">publish — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/rebuild.html b/deps/npm/html/doc/rebuild.html index fea67ea0c6..e652529633 100644 --- a/deps/npm/html/doc/rebuild.html +++ b/deps/npm/html/doc/rebuild.html @@ -25,7 +25,7 @@ the new binary.</p> <ul><li><a href="../doc/build.html">build(1)</a></li><li><a href="../doc/install.html">install(1)</a></li></ul> </div> -<p id="footer">rebuild — npm@1.1.0-2</p> +<p id="footer">rebuild — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/registry.html b/deps/npm/html/doc/registry.html index ed4455513a..786603edd0 100644 --- a/deps/npm/html/doc/registry.html +++ b/deps/npm/html/doc/registry.html @@ -97,7 +97,7 @@ ask for help on the <a href="mailto:npm-@googlegroups.com">npm-@googlegroups.com <ul><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/developers.html">developers(1)</a></li><li><a href="../doc/disputes.html">disputes(1)</a></li></ul> </div> -<p id="footer">registry — npm@1.1.0-2</p> +<p id="footer">registry — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/removing-npm.html b/deps/npm/html/doc/removing-npm.html index 06109b0378..4124f41a6a 100644 --- a/deps/npm/html/doc/removing-npm.html +++ b/deps/npm/html/doc/removing-npm.html @@ -58,7 +58,7 @@ modules. To track those down, you can do the following:</p> <ul><li><a href="../doc/README.html">README</a></li><li><a href="../doc/rm.html">rm(1)</a></li><li><a href="../doc/prune.html">prune(1)</a></li></ul> </div> -<p id="footer">removing-npm — npm@1.1.0-2</p> +<p id="footer">removing-npm — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/restart.html b/deps/npm/html/doc/restart.html index 07fe2c36a3..21990f0675 100644 --- a/deps/npm/html/doc/restart.html +++ b/deps/npm/html/doc/restart.html @@ -24,7 +24,7 @@ the "start" script.</p> <ul><li><a href="../doc/run-script.html">run-script(1)</a></li><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../doc/test.html">test(1)</a></li><li><a href="../doc/start.html">start(1)</a></li><li><a href="../doc/stop.html">stop(1)</a></li></ul> </div> -<p id="footer">restart — npm@1.1.0-2</p> +<p id="footer">restart — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/root.html b/deps/npm/html/doc/root.html index fb5bb965ed..a7874010ad 100644 --- a/deps/npm/html/doc/root.html +++ b/deps/npm/html/doc/root.html @@ -20,7 +20,7 @@ <ul><li><a href="../doc/prefix.html">prefix(1)</a></li><li><a href="../doc/bin.html">bin(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/config.html">config(1)</a></li></ul> </div> -<p id="footer">root — npm@1.1.0-2</p> +<p id="footer">root — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/run-script.html b/deps/npm/html/doc/run-script.html index f9706a79d1..d10e7353fc 100644 --- a/deps/npm/html/doc/run-script.html +++ b/deps/npm/html/doc/run-script.html @@ -23,7 +23,7 @@ called directly, as well.</p> <ul><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../doc/test.html">test(1)</a></li><li><a href="../doc/start.html">start(1)</a></li><li><a href="../doc/restart.html">restart(1)</a></li><li><a href="../doc/stop.html">stop(1)</a></li></ul> </div> -<p id="footer">run-script — npm@1.1.0-2</p> +<p id="footer">run-script — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/scripts.html b/deps/npm/html/doc/scripts.html index 16b3026d29..39a813998d 100644 --- a/deps/npm/html/doc/scripts.html +++ b/deps/npm/html/doc/scripts.html @@ -52,6 +52,19 @@ privileges.</p> made available regarding the setup of npm and the current state of the process.</p> +<h3 id="path">path</h3> + +<p>If you depend on modules that define executable scripts, like test suites, +then those executables will be added to the <code>PATH</code> for executing the scripts. +So, if your package.json has this:</p> + +<pre><code>{ "name" : "foo" +, "dependencies" : { "bar" : "0.1.x" } +, "scripts": { "start" : "bar ./test" } }</code></pre> + +<p>then you could run <code>npm start</code> to execute the <code>bar</code> script, which is exported +into the <code>node_modules/.bin</code> directory on <code>npm install</code>.</p> + <h3 id="package-json-vars">package.json vars</h3> <p>The package.json fields are tacked onto the <code>npm_package_</code> prefix. So, for @@ -164,7 +177,7 @@ will sudo the npm command in question.</li></ul> <ul><li><a href="../doc/run-script.html">run-script(1)</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/developers.html">developers(1)</a></li><li><a href="../doc/install.html">install(1)</a></li></ul> </div> -<p id="footer">scripts — npm@1.1.0-2</p> +<p id="footer">scripts — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/search.html b/deps/npm/html/doc/search.html index dc451277db..2fbcaf438a 100644 --- a/deps/npm/html/doc/search.html +++ b/deps/npm/html/doc/search.html @@ -24,7 +24,7 @@ expression characters must be escaped or quoted in most shells.)</p> <ul><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/view.html">view(1)</a></li></ul> </div> -<p id="footer">search — npm@1.1.0-2</p> +<p id="footer">search — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/semver.html b/deps/npm/html/doc/semver.html index 7ca3e4d6f7..909c55e5cf 100644 --- a/deps/npm/html/doc/semver.html +++ b/deps/npm/html/doc/semver.html @@ -104,7 +104,7 @@ that satisfies the range, or null if none of them do.</li></ul> <ul><li><a href="../doc/json.html">json(1)</a></li></ul> </div> -<p id="footer">semver — npm@1.1.0-2</p> +<p id="footer">semver — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/shrinkwrap.html b/deps/npm/html/doc/shrinkwrap.html index a146e22563..158ed09942 100644 --- a/deps/npm/html/doc/shrinkwrap.html +++ b/deps/npm/html/doc/shrinkwrap.html @@ -169,7 +169,7 @@ versions.</p> <ul><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/list.html">list(1)</a></li></ul> </div> -<p id="footer">shrinkwrap — npm@1.1.16</p> +<p id="footer">shrinkwrap — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/star.html b/deps/npm/html/doc/star.html index fac1ab74b5..3aebbcdb48 100644 --- a/deps/npm/html/doc/star.html +++ b/deps/npm/html/doc/star.html @@ -26,7 +26,7 @@ a vaguely positive way to show that you care.</p> <ul><li><a href="../doc/view.html">view(1)</a></li><li><a href="../doc/whoami.html">whoami(1)</a></li><li><a href="../doc/adduser.html">adduser(1)</a></li></ul> </div> -<p id="footer">star — npm@1.1.0-2</p> +<p id="footer">star — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/start.html b/deps/npm/html/doc/start.html index f9c7fe8077..f86e9d8465 100644 --- a/deps/npm/html/doc/start.html +++ b/deps/npm/html/doc/start.html @@ -20,7 +20,7 @@ <ul><li><a href="../doc/run-script.html">run-script(1)</a></li><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../doc/test.html">test(1)</a></li><li><a href="../doc/restart.html">restart(1)</a></li><li><a href="../doc/stop.html">stop(1)</a></li></ul> </div> -<p id="footer">start — npm@1.1.0-2</p> +<p id="footer">start — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/stop.html b/deps/npm/html/doc/stop.html index a954d8a922..d3565a05ec 100644 --- a/deps/npm/html/doc/stop.html +++ b/deps/npm/html/doc/stop.html @@ -20,7 +20,7 @@ <ul><li><a href="../doc/run-script.html">run-script(1)</a></li><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../doc/test.html">test(1)</a></li><li><a href="../doc/start.html">start(1)</a></li><li><a href="../doc/restart.html">restart(1)</a></li></ul> </div> -<p id="footer">stop — npm@1.1.0-2</p> +<p id="footer">stop — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/submodule.html b/deps/npm/html/doc/submodule.html index 0b4206e735..7f26dc91fb 100644 --- a/deps/npm/html/doc/submodule.html +++ b/deps/npm/html/doc/submodule.html @@ -33,7 +33,7 @@ dependencies into the submodule folder.</p> <ul><li><a href="../doc/json.html">json(1)</a></li><li>git help submodule</li></ul> </div> -<p id="footer">submodule — npm@1.1.0-2</p> +<p id="footer">submodule — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/tag.html b/deps/npm/html/doc/tag.html index 9976dc5c8c..bfb5a58934 100644 --- a/deps/npm/html/doc/tag.html +++ b/deps/npm/html/doc/tag.html @@ -21,7 +21,7 @@ <ul><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/config.html">config(1)</a></li></ul> </div> -<p id="footer">tag — npm@1.1.0-2</p> +<p id="footer">tag — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/test.html b/deps/npm/html/doc/test.html index 9209e40e0e..51f7ee6ee7 100644 --- a/deps/npm/html/doc/test.html +++ b/deps/npm/html/doc/test.html @@ -23,7 +23,7 @@ true.</p> <ul><li><a href="../doc/run-script.html">run-script(1)</a></li><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../doc/start.html">start(1)</a></li><li><a href="../doc/restart.html">restart(1)</a></li><li><a href="../doc/stop.html">stop(1)</a></li></ul> </div> -<p id="footer">test — npm@1.1.0-2</p> +<p id="footer">test — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/uninstall.html b/deps/npm/html/doc/uninstall.html index 867e6af43a..96cee41022 100644 --- a/deps/npm/html/doc/uninstall.html +++ b/deps/npm/html/doc/uninstall.html @@ -22,7 +22,7 @@ on its behalf.</p> <ul><li><a href="../doc/prune.html">prune(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/config.html">config(1)</a></li></ul> </div> -<p id="footer">uninstall — npm@1.1.0-2</p> +<p id="footer">uninstall — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/unpublish.html b/deps/npm/html/doc/unpublish.html index 51fa5811e5..573a9e2e1a 100644 --- a/deps/npm/html/doc/unpublish.html +++ b/deps/npm/html/doc/unpublish.html @@ -34,7 +34,7 @@ the root package entry is removed from the registry entirely.</p> <ul><li><a href="../doc/deprecate.html">deprecate(1)</a></li><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/adduser.html">adduser(1)</a></li><li><a href="../doc/owner.html">owner(1)</a></li></ul> </div> -<p id="footer">unpublish — npm@1.1.0-2</p> +<p id="footer">unpublish — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/update.html b/deps/npm/html/doc/update.html index e41dbfb11b..eb1b20c752 100644 --- a/deps/npm/html/doc/update.html +++ b/deps/npm/html/doc/update.html @@ -23,7 +23,7 @@ <ul><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/outdated.html">outdated(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/list.html">list(1)</a></li></ul> </div> -<p id="footer">update — npm@1.1.0-2</p> +<p id="footer">update — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/version.html b/deps/npm/html/doc/version.html index 63d93a3d94..d85cad0343 100644 --- a/deps/npm/html/doc/version.html +++ b/deps/npm/html/doc/version.html @@ -31,7 +31,7 @@ will use it as a commit message when creating a version commit.</p> <ul><li><a href="../doc/init.html">init(1)</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/semver.html">semver(1)</a></li></ul> </div> -<p id="footer">version — npm@1.1.0-2</p> +<p id="footer">version — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/view.html b/deps/npm/html/doc/view.html index fe97f2e5d7..2327cf8fb4 100644 --- a/deps/npm/html/doc/view.html +++ b/deps/npm/html/doc/view.html @@ -88,7 +88,7 @@ the field name.</p> <ul><li><a href="../doc/search.html">search(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/docs.html">docs(1)</a></li></ul> </div> -<p id="footer">view — npm@1.1.0-2</p> +<p id="footer">view — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/doc/whoami.html b/deps/npm/html/doc/whoami.html index b4b2a9bb98..600c1893c5 100644 --- a/deps/npm/html/doc/whoami.html +++ b/deps/npm/html/doc/whoami.html @@ -20,7 +20,7 @@ <ul><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/adduser.html">adduser(1)</a></li></ul> </div> -<p id="footer">whoami — npm@1.1.0-2</p> +<p id="footer">whoami — npm@1.1.21</p> <script> ;(function () { var wrapper = document.getElementById("wrapper") diff --git a/deps/npm/html/index.html b/deps/npm/html/index.html index 9ccf28e57c..4a97cd3e7a 100644 --- a/deps/npm/html/index.html +++ b/deps/npm/html/index.html @@ -59,11 +59,14 @@ code { background:#fff ; outline: 1px solid #ccc; padding:0 2px; } <p>npm is a package manager for <a href="http://nodejs.org/">node</a>. You can use it to install and publish your node programs. It manages dependencies and does other cool stuff.</p> -<h2>One Line Install</h2> +<h2>Easy Zero Line Install</h2> -<code>curl http://npmjs.org/install.sh | sh</code> +<p><a href="http://nodejs.org/#download">Install Node.js</a> <br> +(npm comes with it.)</p> -<h2>More Than One Line Install</h2> +<p>Because a one-line install is one too many.</p> + +<h2>Fancy Install</h2> <ol> <li><a href="https://github.com/isaacs/npm">Get the code.</a> @@ -71,6 +74,12 @@ code { background:#fff ; outline: 1px solid #ccc; padding:0 2px; } says to do. </ol> +<p>There's a pretty thorough install script at +<a href="http://npmjs.org/install.sh">http://npmjs.org/install.sh</a></p> + +<p>For maximum security, make sure to thorougly inspect every +program that you run on your computer!</p> + <h2>Other Cool Stuff</h2> <ul> diff --git a/deps/npm/lib/bugs.js b/deps/npm/lib/bugs.js index a3a017cc02..7982746cfb 100644 --- a/deps/npm/lib/bugs.js +++ b/deps/npm/lib/bugs.js @@ -28,7 +28,7 @@ function bugs (args, cb) { } if (repo) { if (Array.isArray(repo)) repo = repo.shift() - if (repo.url) repo = repo.url + if (repo.hasOwnProperty("url")) repo = repo.url log.verbose(repo, "repository") if (repo && repo.match(/^(https?:\/\/|git(:\/\/|@))github.com/)) { return open(repo.replace(/^git(@|:\/\/)/, "http://") diff --git a/deps/npm/lib/cache.js b/deps/npm/lib/cache.js index 3dc1fb3a0a..b62e82dd14 100644 --- a/deps/npm/lib/cache.js +++ b/deps/npm/lib/cache.js @@ -3,11 +3,10 @@ /* adding a folder: 1. tar into tmp/random/package.tgz -2. untar into tmp/random/contents/{blah} -3. rename {blah} to "package" -4. tar tmp/random/contents/package to cache/n/v/package.tgz -5. untar cache/n/v/package.tgz into cache/n/v/package -6. rm tmp/random +2. untar into tmp/random/contents/package, stripping one dir piece +3. tar tmp/random/contents/package to cache/n/v/package.tgz +4. untar cache/n/v/package.tgz into cache/n/v/package +5. rm tmp/random Adding a url: 1. fetch to tmp/random/package.tgz @@ -32,7 +31,7 @@ exports.read = read exports.clean = clean exports.unpack = unpack -var mkdir = require("./utils/mkdir-p.js") +var mkdir = require("mkdirp") , exec = require("./utils/exec.js") , fetch = require("./utils/fetch.js") , npm = require("./npm.js") @@ -50,6 +49,7 @@ var mkdir = require("./utils/mkdir-p.js") , tar = require("./utils/tar.js") , fileCompletion = require("./utils/completion/file-completion.js") , url = require("url") + , chownr = require("chownr") cache.usage = "npm cache add <tarball file>" + "\nnpm cache add <folder>" @@ -95,12 +95,10 @@ function cache (args, cb) { // if the pkg and ver are in the cache, then // just do a readJson and return. // if they're not, then fetch them from the registry. -var cacheSeen = {} function read (name, ver, forceBypass, cb) { if (typeof cb !== "function") cb = forceBypass, forceBypass = true var jsonFile = path.join(npm.cache, name, ver, "package", "package.json") function c (er, data) { - if (!er) cacheSeen[data._id] = data if (data) deprCheck(data) return cb(er, data) } @@ -110,10 +108,6 @@ function read (name, ver, forceBypass, cb) { return addNamed(name, ver, c) } - if (name+"@"+ver in cacheSeen) { - return cb(null, cacheSeen[name+"@"+ver]) - } - readJson(jsonFile, function (er, data) { if (er) return addNamed(name, ver, c) deprCheck(data) @@ -126,9 +120,13 @@ function ls (args, cb) { output = output || require("./utils/output.js") args = args.join("/").split("@").join("/") if (args.substr(-1) === "/") args = args.substr(0, args.length - 1) + var prefix = npm.config.get("cache") + if (0 === prefix.indexOf(process.env.HOME)) { + prefix = "~" + prefix.substr(process.env.HOME.length) + } ls_(args, npm.config.get("depth"), function(er, files) { output.write(files.map(function (f) { - return path.join("~/.npm", f) + return path.join(prefix, f) }).join("\n").trim(), function (er) { return cb(er, files) }) @@ -212,7 +210,7 @@ function add (args, cb) { // see if the spec is a url // otherwise, treat as name@version - var p = url.parse(spec.replace(/^git\+/, "git")) || {} + var p = url.parse(spec) || {} log.verbose(p, "parsed url") // it could be that we got name@http://blah @@ -230,11 +228,11 @@ function add (args, cb) { case "https:": return addRemoteTarball(spec, null, name, cb) case "git:": - case "githttp:": - case "githttps:": - case "gitrsync:": - case "gitftp:": - case "gitssh:": + case "git+http:": + case "git+https:": + case "git+rsync:": + case "git+ftp:": + case "git+ssh:": //p.protocol = p.protocol.replace(/^git([^:])/, "$1") return addRemoteGit(spec, p, name, cb) default: @@ -636,7 +634,7 @@ function getCacheStat (cb) { } function makeCacheDir (cb) { - if (!process.getuid) return mkdir(npm.cache, npm.modes.exec, cb) + if (!process.getuid) return mkdir(npm.cache, cb) var uid = +process.getuid() , gid = +process.getgid() @@ -647,18 +645,28 @@ function makeCacheDir (cb) { } if (uid !== 0 || !process.env.HOME) { cacheStat = {uid: uid, gid: gid} - return mkdir(npm.cache, npm.modes.exec, uid, gid, function (er) { - return cb(er, cacheStat) - }) + return mkdir(npm.cache, afterMkdir) } + fs.stat(process.env.HOME, function (er, st) { if (er) return log.er(cb, "homeless?")(er) cacheStat = st log.silly([st.uid, st.gid], "uid, gid for cache dir") - return mkdir(npm.cache, npm.modes.exec, st.uid, st.gid, function (er) { + return mkdir(npm.cache, afterMkdir) + }) + + function afterMkdir (er, made) { + if (er || !cacheStat || isNaN(cacheStat.uid) || isNaN(cacheStat.gid)) { + return cb(er, cacheStat) + } + + if (!made) return cb(er, cacheStat) + + // ensure that the ownership is correct. + chownr(made, cacheStat.uid, cacheStat.gid, function (er) { return cb(er, cacheStat) }) - }) + } } @@ -736,9 +744,20 @@ function addLocalDirectory (p, name, cb) { , tgz = placeDirect ? placed : tmptgz , doFancyCrap = p.indexOf(npm.tmp) !== 0 && p.indexOf(npm.cache) !== 0 - tar.pack(tgz, p, data, doFancyCrap, function (er) { - if (er) return log.er(cb,"couldn't pack "+p+ " to "+tgz)(er) - addLocalTarball(tgz, name, cb) + getCacheStat(function (er, cs) { + 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 || !cs || isNaN(cs.uid) || isNaN(cs.gid)) return cb() + + chownr(made || tgz, cs.uid, cs.gid, function (er) { + if (er) return cb(er) + addLocalTarball(tgz, name, cb) + }) + }) + }) }) }) } @@ -747,36 +766,15 @@ function addTmpTarball (tgz, name, cb) { if (!cb) cb = name, name = "" getCacheStat(function (er, cs) { if (er) return cb(er) - return addTmpTarball_(tgz, name, cs.uid, cs.gid, cb) - }) -} - -function addTmpTarball_ (tgz, name, uid, gid, cb) { - var contents = path.resolve(path.dirname(tgz)) // , "contents") - tar.unpack( tgz, path.resolve(contents, "package") - , null, null - , uid, gid - , function (er) { - if (er) return log.er(cb, "couldn't unpack "+tgz+" to "+contents)(er) - fs.readdir(contents, function (er, folder) { - if (er) return log.er(cb, "couldn't readdir "+contents)(er) - log.verbose(folder, "tarball contents") - if (folder.length > 1) { - folder = folder.filter(function (f) { - return !f.match(/^\.|^tmp\.tgz$/) - }) - } - if (folder.length > 1) { - log.warn(folder.slice(1).join("\n") - ,"extra junk in folder, ignoring") + var contents = path.dirname(tgz) + tar.unpack( tgz, path.resolve(contents, "package") + , null, null + , cs.uid, cs.gid + , function (er) { + if (er) { + return cb(er) } - if (!folder.length) return cb(new Error("Empty package tarball")) - folder = path.join(contents, folder[0]) - var newName = path.join(contents, "package") - fs.rename(folder, newName, function (er) { - if (er) return log.er(cb, "couldn't rename "+folder+" to package")(er) - addLocalDirectory(newName, name, cb) - }) + addLocalDirectory(path.resolve(contents, "package"), name, cb) }) }) } @@ -792,11 +790,14 @@ function unpack (pkg, ver, unpackTarget, dMode, fMode, uid, gid, cb) { log.error("Could not read data for "+pkg+"@"+ver) return cb(er) } - tar.unpack( path.join(npm.cache, pkg, ver, "package.tgz") - , unpackTarget - , dMode, fMode - , uid, gid - , cb ) + npm.commands.unbuild([unpackTarget], function (er) { + if (er) return cb(er) + tar.unpack( path.join(npm.cache, pkg, ver, "package.tgz") + , unpackTarget + , dMode, fMode + , uid, gid + , cb ) + }) }) } diff --git a/deps/npm/lib/config.js b/deps/npm/lib/config.js index 6781679f1d..a69c30ea69 100644 --- a/deps/npm/lib/config.js +++ b/deps/npm/lib/config.js @@ -2,10 +2,12 @@ module.exports = config config.usage = "npm config set <key> <value>" - + "\nnpm config get <key>" + + "\nnpm config get [<key>]" + "\nnpm config delete <key>" + "\nnpm config list" + "\nnpm config edit" + + "\nnpm set <key> <value>" + + "\nnpm get [<key>]" var ini = require("./utils/ini.js") , log = require("./utils/log.js") @@ -113,6 +115,9 @@ function del (key, cb) { } function set (key, val, cb) { + if (key === undefined) { + return unknown("", cb) + } if (val === undefined) { if (key.indexOf("=") !== -1) { var k = key.split("=") diff --git a/deps/npm/lib/docs.js b/deps/npm/lib/docs.js index de9f71c654..8af4c1bb66 100644 --- a/deps/npm/lib/docs.js +++ b/deps/npm/lib/docs.js @@ -25,7 +25,7 @@ function docs (args, cb) { if (homepage) return open(homepage, cb) if (repo) { if (Array.isArray(repo)) repo = repo.shift() - if (repo.url) repo = repo.url + if (repo.hasOwnProperty("url")) repo = repo.url log.verbose(repo, "repository") if (repo) { return open(repo.replace(/^git(@|:\/\/)/, 'http://') diff --git a/deps/npm/lib/init.js b/deps/npm/lib/init.js index 2ddb3e86fc..7cd7da8e27 100644 --- a/deps/npm/lib/init.js +++ b/deps/npm/lib/init.js @@ -99,7 +99,10 @@ function init_ (data, folder, cb) { , function (er, r) { if (er) return cb(er) if (r !== "none") { - data.repository = (data.repository || {}).url = r + data.repository = (data.repository || {}) + data.repository.url = r + } else { + delete data.repository } cb() } @@ -146,13 +149,6 @@ function init_ (data, folder, cb) { (data.scripts = data.scripts || {}).test = t } ) - ( read - , [ { prompt: "What versions of node does it run on? " - , default: data.engines && data.engines.node || (eng) } ] - , function (nodever) { - (data.engines = data.engines || {}).node = nodever - } - ) (cleanupPaths, [data, folder]) (function (cb) { try { data = readJson.processJson(data) } diff --git a/deps/npm/lib/install.js b/deps/npm/lib/install.js index 1fb6dc30c0..5873ca968e 100644 --- a/deps/npm/lib/install.js +++ b/deps/npm/lib/install.js @@ -1,14 +1,15 @@ - // npm install <pkg> <pkg> <pkg> // // See doc/install.md for more description -// Managing "family" lists... -// every time we dive into a deeper node_modules folder, the "family" -// list that gets passed along uses the previous "family" list as -// it's __proto__. Any "resolved precise dependency" things that aren't -// already on this object get added, and then that's passed to the next -// generation of installation. +// Managing contexts... +// there's a lot of state associated with an "install" operation, including +// packages that are already installed, parent packages, current shrinkwrap, and +// so on. We maintain this state in a "context" object that gets passed around. +// every time we dive into a deeper node_modules folder, the "family" list that +// gets passed along uses the previous "family" list as its __proto__. Any +// "resolved precise dependency" things that aren't already on this object get +// added, and then that's passed to the next generation of installation. module.exports = install @@ -20,7 +21,9 @@ install.usage = "npm install <tarball file>" + "\nnpm install <pkg>@<version>" + "\nnpm install <pkg>@<version range>" + "\n\nCan specify one or more: npm install ./foo.tgz bar@stable /some/folder" - + "\nInstalls dependencies in ./package.json if no argument supplied" + + "\nIf no argument is supplied and ./npm-shrinkwrap.json is " + + "\npresent, installs dependencies specified in the shrinkwrap." + + "\nOtherwise, installs dependencies from ./package.json." install.completion = function (opts, cb) { // install can complete to a folder with a package.json, or any package. @@ -64,8 +67,9 @@ var npm = require("./npm.js") , relativize = require("./utils/relativize.js") , output , url = require("url") - , mkdir = require("./utils/mkdir-p.js") + , mkdir = require("mkdirp") , lifecycle = require("./utils/lifecycle.js") + , archy = require("archy") function install (args, cb_) { @@ -75,12 +79,15 @@ function install (args, cb_) { output = output || require("./utils/output.js") var tree = treeify(installed) - , pretty = prettify(tree, installed) + , pretty = prettify(tree, installed).trim() + + if (pretty) output.write(pretty, afterWrite) + else afterWrite() - output.write(pretty, function (er) { + function afterWrite (er) { if (er) return cb_(er) save(where, installed, tree, pretty, cb_) - }) + } } // the /path/to/node_modules/.. @@ -100,39 +107,116 @@ function install (args, cb_) { }) } - mkdir(where, function (er) { + mkdir(where, function (er, made) { if (er) return cb(er) // install dependencies locally by default, // or install current folder globally if (!args.length) { if (npm.config.get("global")) args = ["."] - else return readJson( path.resolve(where, "package.json") - , { dev: !npm.config.get("production") } - , function (er, data) { + else return readDependencies( null + , where + , { dev: !npm.config.get("production") } + , function (er, data) { if (er) return log.er(cb, "Couldn't read dependencies.")(er) var deps = Object.keys(data.dependencies || {}) log.verbose([where, deps], "where, deps") - var family = {} - , ancestors = {} - family[data.name] = ancestors[data.name] = data.version + var context = { family: {} + , ancestors: {} + , explicit: false + , parent: data + , wrap: null } + context.family[data.name] = context.ancestors[data.name] = data.version installManyTop(deps.map(function (dep) { var target = data.dependencies[dep] , parsed = url.parse(target.replace(/^git\+/, "git")) target = dep + "@" + target return target - }), where, family, ancestors, false, data, cb) + }), where, context, cb) }) } // initial "family" is the name:version of the root, if it's got - // a pacakge.json file. + // a package.json file. readJson(path.resolve(where, "package.json"), function (er, data) { if (er) data = null - var family = {} - , ancestors = {} - if (data) family[data.name] = ancestors[data.name] = data.version + var context = { family: {} + , ancestors: {} + , explicit: true + , parent: data + , wrap: null } + if (data) { + context.family[data.name] = context.ancestors[data.name] = data.version + } var fn = npm.config.get("global") ? installMany : installManyTop - fn(args, where, family, ancestors, true, data, cb) + fn(args, where, context, cb) + }) + }) +} + +// reads dependencies for the package at "where". There are several cases, +// depending on our current state and the package's configuration: +// +// 1. If "context" is specified, then we examine the context to see if there's a +// shrinkwrap there. In that case, dependencies are read from the shrinkwrap. +// 2. Otherwise, if an npm-shrinkwrap.json file is present, dependencies are +// read from there. +// 3. Otherwise, dependencies come from package.json. +// +// Regardless of which case we fall into, "cb" is invoked with a first argument +// describing the full package (as though readJson had been used) but with +// "dependencies" read as described above. The second argument to "cb" is the +// shrinkwrap to use in processing this package's dependencies, which may be +// "wrap" (in case 1) or a new shrinkwrap (in case 2). +function readDependencies (context, where, opts, cb) { + var wrap = context ? context.wrap : null + + readJson( path.resolve(where, "package.json") + , opts + , function (er, data) { + if (er) return cb(er) + + if (wrap) { + log.verbose([where, wrap], "readDependencies: using existing 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") + var w = wrap[key] + rv.dependencies[key] = w.from || w.version + }) + log.verbose([rv.dependencies], "readDependencies: returned deps") + return cb(null, rv, wrap) + } + + var wrapfile = path.resolve(where, "npm-shrinkwrap.json") + + fs.readFile(wrapfile, "utf8", function (er, wrapjson) { + if (er) { + log.verbose("readDependencies: using package.json deps") + return cb(null, data, null) + } + + try { + var newwrap = JSON.parse(wrapjson) + } catch (ex) { + return cb(ex) + } + + log.info(wrapfile, "using shrinkwrap file") + var rv = {} + Object.keys(data).forEach(function (key) { + rv[key] = data[key] + }) + rv.dependencies = {} + Object.keys(newwrap.dependencies || {}).forEach(function (key) { + var w = newwrap.dependencies[key] + rv.dependencies[key] = w.from || w.version + }) + log.verbose([rv.dependencies], "readDependencies: returned deps") + return cb(null, rv, newwrap.dependencies) }) }) } @@ -141,17 +225,28 @@ function install (args, cb_) { // as dependencies to a package.json file. // This is experimental. function save (where, installed, tree, pretty, cb) { - if (!npm.config.get("save") || npm.config.get("global")) { + if (!npm.config.get("save") && + !npm.config.get("save-dev") && + !npm.config.get("save-optional") || + npm.config.get("global")) { return cb(null, installed, tree, pretty) } + // each item in the tree is a top-level thing that should be saved // to the package.json file. // The relevant tree shape is { <folder>: {what:<pkg>} } var saveTarget = path.resolve(where, "package.json") , things = Object.keys(tree).map(function (k) { - return tree[k].what.split("@") + // if "what" was a url, then save that instead. + var t = tree[k] + , u = url.parse(t.from) + , w = t.what.split("@") + if (u && u.protocol) w[1] = t.from + return w }).reduce(function (set, k) { - var rangeDescriptor = semver.gte(k[1], "0.1.0") ? "~" : "" + var rangeDescriptor = semver.valid(k[1]) && + semver.gte(k[1], "0.1.0") + ? "~" : "" set[k[0]] = rangeDescriptor + k[1] return set }, {}) @@ -165,13 +260,18 @@ function save (where, installed, tree, pretty, cb) { } catch (ex) { er = ex } - if (er) return cb(null, installed, tree, pretty) + if (er) { + return cb(null, installed, tree, pretty) - var deps = npm.config.get("dev") ? "devDependencies" : "dependencies" - deps = data[deps] = data[deps] || {} + } + + var deps = npm.config.get("save-optional") ? "optionalDependencies" + : npm.config.get("save-dev") ? "devDependencies" + : "dependencies" + data[deps] = data[deps] || {} Object.keys(things).forEach(function (t) { - deps[t] = things[t] + data[deps][t] = things[t] }) data = JSON.stringify(data, null, 2) + "\n" fs.writeFile(saveTarget, data, function (er) { @@ -184,26 +284,48 @@ function save (where, installed, tree, pretty, cb) { // Outputting *all* the installed modules is a bit confusing, // because the length of the path does not make it clear // that the submodules are not immediately require()able. -// TODO: Show the complete tree, ls-style. +// TODO: Show the complete tree, ls-style, but only if --long is provided function prettify (tree, installed) { - if (npm.config.get("parseable")) return parseable(installed) - return Object.keys(tree).map(function (p) { - p = tree[p] - var c = "" - if (p.children && p.children.length) { - pref = "\n" - var l = p.children.pop() - c = p.children.map(function (c) { - var gc = c.children && c.children.length - ? " (" + c.children.map(function (gc) { - return gc.what - }).join(" ") + ")" - : "" - return "\n├── " + c.what + gc - }).join("") + "\n└── " + l.what + if (npm.config.get("json")) { + function red (set, kv) { + set[kv[0]] = kv[1] + return set } - return [p.what, p.where, c].join(" ") + tree = Object.keys(tree).map(function (p) { + if (!tree[p]) return null + var what = tree[p].what.split("@") + , name = what.shift() + , version = what.join("@") + , o = { name: name, version: version, from: tree[p].from } + o.dependencies = tree[p].children.map(function P (dep) { + var what = dep.what.split("@") + , name = what.shift() + , version = what.join("@") + , o = { version: version, from: dep.from } + o.dependencies = dep.children.map(P).reduce(red, {}) + return [name, o] + }).reduce(red, {}) + return o + }) + + return JSON.stringify(tree, null, 2) + } + if (npm.config.get("parseable")) return parseable(installed) + + return Object.keys(tree).map(function (p) { + return archy({ label: tree[p].what + " " + p + , nodes: (tree[p].children || []).map(function P (c) { + if (npm.config.get("long")) { + return { label: c.what, nodes: c.children.map(P) } + } + var g = c.children.map(function (g) { + return g.what + }).join(", ") + if (g) g = " (" + g + ")" + return c.what + g + }) + }) }).join("\n") } @@ -226,11 +348,13 @@ function treeify (installed) { , parent = r[2] , where = r[1] , what = r[0] + , from = r[4] l[where] = { parentDir: parentDir , parent: parent , children: [] , where: where - , what: what } + , what: what + , from: from } return l }, {}) @@ -252,10 +376,9 @@ function treeify (installed) { // just like installMany, but also add the existing packages in // where/node_modules to the family object. -function installManyTop (what, where, family, ancestors, explicit, parent, cb_) { - +function installManyTop (what, where, context, cb_) { function cb (er, d) { - if (explicit || er) return cb_(er, d) + if (context.explicit || er) return cb_(er, d) // since this wasn't an explicit install, let's build the top // folder, so that `npm install` also runs the lifecycle scripts. npm.commands.build([where], false, true, function (er) { @@ -263,7 +386,7 @@ function installManyTop (what, where, family, ancestors, explicit, parent, cb_) }) } - if (explicit) return next() + if (context.explicit) return next() readJson(path.join(where, "package.json"), function (er, data) { if (er) return next(er) @@ -272,21 +395,20 @@ function installManyTop (what, where, family, ancestors, explicit, parent, cb_) function next (er) { if (er) return cb(er) - installManyTop_(what, where, family, ancestors, explicit, parent, cb) + installManyTop_(what, where, context, cb) } } -function installManyTop_ (what, where, family, ancestors, explicit, parent, cb) { +function installManyTop_ (what, where, context, cb) { var nm = path.resolve(where, "node_modules") - , names = explicit + , names = context.explicit ? what.map(function (w) { return w.split(/@/).shift() }) : [] fs.readdir(nm, function (er, pkgs) { - if (er) return installMany(what, where, family, ancestors, explicit, parent, cb) + if (er) return installMany(what, where, context, cb) pkgs = pkgs.filter(function (p) { return !p.match(/^[\._-]/) - && (!explicit || names.indexOf(p) === -1) }) asyncMap(pkgs.map(function (p) { return path.resolve(nm, p, "package.json") @@ -299,36 +421,44 @@ function installManyTop_ (what, where, family, ancestors, explicit, parent, cb) // add all the existing packages to the family list. // however, do not add to the ancestors list. packages.forEach(function (p) { - family[p[0]] = p[1] + context.family[p[0]] = p[1] }) - return installMany(what, where, family, ancestors, explicit, parent, cb) + return installMany(what, where, context, cb) }) }) } -function installMany (what, where, family, ancestors, explicit, parent, cb) { - // 'npm install foo' should install the version of foo - // that satisfies the dep in the current folder. - // This will typically return immediately, since we already read - // this file family, and it'll be cached. - readJson(path.resolve(where, "package.json"), function (er, data) { +function installMany (what, where, context, cb) { + // readDependencies takes care of figuring out whether the list of + // dependencies we'll iterate below comes from an existing shrinkwrap from a + // parent level, a new shrinkwrap at this level, or package.json at this + // level, as well as which shrinkwrap (if any) our dependencies should use. + readDependencies(context, where, {}, function (er, data, wrap) { if (er) data = {} - d = data.dependencies || {} var parent = data + var d = data.dependencies || {} + + // if we're explicitly installing "what" into "where", then the shrinkwrap + // for "where" doesn't apply. This would be the case if someone were adding + // a new package to a shrinkwrapped package. (data.dependencies will not be + // used here except to indicate what packages are already present, so + // there's no harm in using that.) + if (context.explicit) wrap = null + // what is a list of things. // resolve each one. asyncMap( what - , targetResolver(where, family, ancestors, explicit, d, parent) + , targetResolver(where, context, d) , function (er, targets) { if (er) return cb(er) // each target will be a data object corresponding // to a package, folder, or whatever that is in the cache now. - var newPrev = Object.create(family) - , newAnc = Object.create(ancestors) + var newPrev = Object.create(context.family) + , newAnc = Object.create(context.ancestors) newAnc[data.name] = data.version targets.forEach(function (t) { @@ -339,25 +469,41 @@ function installMany (what, where, family, ancestors, explicit, parent, cb) { log.info(t._id, "into "+where) }) asyncMap(targets, function (target, cb) { - log(target._id, "installOne") - installOne(target, where, newPrev, newAnc, parent, cb) + log.info(target._id, "installOne") + var newWrap = wrap ? wrap[target.name].dependencies || {} : null + var newContext = { family: newPrev + , ancestors: newAnc + , parent: parent + , explicit: false + , wrap: newWrap } + installOne(target, where, newContext, cb) }, cb) }) }) } -function targetResolver (where, family, ancestors, explicit, deps, parent) { - var alreadyInstalledManually = explicit ? [] : null +function targetResolver (where, context, deps) { + var alreadyInstalledManually = context.explicit ? [] : null , nm = path.resolve(where, "node_modules") + , parent = context.parent + , wrap = context.wrap - if (!explicit) fs.readdir(nm, function (er, inst) { + if (!context.explicit) fs.readdir(nm, function (er, inst) { if (er) return alreadyInstalledManually = [] asyncMap(inst, function (pkg, cb) { readJson(path.resolve(nm, pkg, "package.json"), function (er, d) { + // error means it's not a package, most likely. if (er) return cb(null, []) - if (semver.satisfies(d.version, deps[d.name] || "*")) { + + // if it's a bundled dep, then assume that anything there is valid. + // otherwise, make sure that it's a semver match with what we want. + var bd = parent.bundleDependencies + if (bd && bd.indexOf(d.name) !== -1 || + semver.satisfies(d.version, deps[d.name] || "*")) { return cb(null, d.name) } + + // something is there, but it's not satisfactory. Clobber it. return cb(null, []) }) }, function (er, inst) { @@ -371,6 +517,7 @@ function targetResolver (where, family, ancestors, explicit, deps, parent) { if (!alreadyInstalledManually) return setTimeout(function () { resolver(what, cb) }, to++) + // 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) { @@ -378,23 +525,56 @@ function targetResolver (where, family, ancestors, explicit, deps, parent) { return cb(null, []) } - if (family[what] && semver.satisfies(family[what], deps[what] || "")) { + // check for a version installed higher in the tree. + // 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)") + return cb(null, []) + } + } + + // if it's identical to its parent, then it's probably someone + // 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") return cb(null, []) } - if (deps[what]) { + if (wrap) { + name = what.split(/@/).shift() + if (wrap[name]) { + var wrapTarget = wrap[name].from || wrap[name].version + log.verbose("resolving "+what+" to "+wrapTarget, "shrinkwrap") + what = name + "@" + wrapTarget + } else { + log.verbose("skipping "+what+" (not in shrinkwrap)", "shrinkwrap") + } + } else if (deps[what]) { what = what + "@" + deps[what] } cache.add(what, function (er, data) { if (er && parent && parent.optionalDependencies && - parent.optionalDependencies.hasOwnProperty(what.split("@").shift())) { + parent.optionalDependencies.hasOwnProperty(what.split("@")[0])) { log.warn(what, "optional dependency failed, continuing") + log.verbose([what, er], "optional dependency failed, continuing") return cb(null, []) } - if (!er && data && family[data.name] === data.version) { + + if (!er && + data && + !context.explicit && + context.family[data.name] === data.version && + !npm.config.get("force")) { + log.info(data.name + "@" + data.version, "already installed") return cb(null, []) } + + if (data) data._from = what + return cb(er, data) }) } @@ -402,20 +582,33 @@ function targetResolver (where, family, ancestors, explicit, deps, parent) { // we've already decided to install this. if anything's in the way, // then uninstall it first. -function installOne (target, where, family, ancestors, parent, cb) { +function installOne (target, where, context, cb) { // the --link flag makes this a "link" command if it's at the // the top level. if (where === npm.prefix && npm.config.get("link") && !npm.config.get("global")) { - return localLink(target, where, family, ancestors, parent, cb) + return localLink(target, where, context, cb) } - installOne_(target, where, family, ancestors, parent, cb) + installOne_(target, where, context, function (er, installedWhat) { + + // 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") + er = null + } + + cb(er, installedWhat) + }) + } -function localLink (target, where, family, ancestors, parent, cb) { +function localLink (target, where, context, cb) { log.verbose(target._id, "try to link") var jsonFile = path.resolve( npm.dir, target.name , "package.json" ) + , parent = context.parent readJson(jsonFile, function (er, data) { if (er || data._id === target._id) { @@ -437,7 +630,7 @@ function localLink (target, where, family, ancestors, parent, cb) { } else { log.verbose(target._id, "install locally (no link)") - installOne_(target, where, family, ancestors, parent, cb) + installOne_(target, where, context, cb) } }) } @@ -458,23 +651,25 @@ function resultList (target, where, parentId) { return [ target._id , targetFolder , prettyWhere && parentId - , parentId && prettyWhere ] + , parentId && prettyWhere + , target._from ] } -function installOne_ (target, where, family, ancestors, parent, cb) { +function installOne_ (target, where, context, cb) { var nm = path.resolve(where, "node_modules") , targetFolder = path.resolve(nm, target.name) , prettyWhere = relativize(where, process.cwd() + "/x") + , parent = context.parent if (prettyWhere === ".") prettyWhere = null chain ( [ [checkEngine, target] - , [checkCycle, target, ancestors] + , [checkPlatform, target] + , [checkCycle, target, context.ancestors] , [checkGit, targetFolder] - , [write, target, targetFolder, family, ancestors] ] + , [write, target, targetFolder, context] ] , function (er, d) { - log.verbose(target._id, "installOne cb") if (er) return cb(er) d.push(resultList(target, where, parent && parent._id)) cb(er, d) @@ -499,6 +694,58 @@ function checkEngine (target, cb) { return cb() } +function checkPlatform (target, cb) { + var platform = process.platform + , arch = process.arch + , osOk = true + , cpuOk = true + , force = npm.config.get("force") + + if (force) { + return cb() + } + + if (target.os) { + osOk = checkList(platform, target.os) + } + if (target.cpu) { + cpuOk = checkList(arch, target.cpu) + } + if (!osOk || !cpuOk) { + var er = new Error("Unsupported") + er.errno = npm.EBADPLATFORM + er.os = target.os || ['any'] + er.cpu = target.cpu || ['any'] + er.pkgid = target._id + return cb(er) + } + return cb() +} + +function checkList (value, list) { + var tmp + , match = false + , blc = 0 + if (typeof list === "string") { + list = [list] + } + if (list.length === 1 && list[0] === "any") { + return true; + } + for (var i = 0; i < list.length; ++i) { + tmp = list[i] + if (tmp[0] === '!') { + tmp = tmp.slice(1) + if (tmp === value) { + return false; + } + ++blc + } else { + match = match || tmp === value + } + } + return match || blc === list.length +} function checkCycle (target, ancestors, cb) { // there are some very rare and pathological edge-cases where @@ -513,8 +760,16 @@ function checkCycle (target, ancestors, cb) { // A more correct, but more complex, solution would be to symlink // the deeper thing into the new location. // Will do that if anyone whines about this irl. - - var p = Object.getPrototypeOf(ancestors) + // + // Note: `npm install foo` inside of the `foo` package will abort + // earlier if `--force` is not set. However, if it IS set, then + // we need to still fail here, but just skip the first level. Of + // course, it'll still fail eventually if it's a true cycle, and + // leave things in an undefined state, but that's what is to be + // expected when `--force` is used. That is why getPrototypeOf + // is used *twice* here: to skip the first level of repetition. + + var p = Object.getPrototypeOf(Object.getPrototypeOf(ancestors)) , name = target.name , version = target.version while (p && p !== Object.prototype && p[name] !== version) { @@ -556,16 +811,17 @@ function checkGit_ (folder, cb) { }) } -function write (target, targetFolder, family, ancestors, cb_) { +function write (target, targetFolder, context, cb_) { var up = npm.config.get("unsafe-perm") , user = up ? null : npm.config.get("user") , group = up ? null : npm.config.get("group") + , family = context.family function cb (er, data) { // cache.unpack returns the data object, and all we care about // is the list of installed packages from that last thing. if (!er) return cb_(er, data) - log.error(target._id,"error installing") + 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) @@ -573,33 +829,67 @@ function write (target, targetFolder, family, ancestors, cb_) { }) } + var bundled = [] + chain - ( [ [ npm.commands.unbuild, [targetFolder] ] - , [ cache.unpack, target.name, target.version, targetFolder + ( [ [ cache.unpack, target.name, target.version, targetFolder , null, null, user, group ] - , [ lifecycle, target, "preinstall", targetFolder ] ] + , [ fs, "writeFile" + , path.resolve(targetFolder, "package.json") + , JSON.stringify(target, null, 2) + "\n" ] + , [ lifecycle, target, "preinstall", targetFolder ] + , function (cb) { + if (!target.bundleDependencies) return cb() + + var bd = path.resolve(targetFolder, "node_modules") + fs.readdir(bd, function (er, b) { + // nothing bundled, maybe + if (er) return cb() + bundled = b || [] + cb() + }) + } ] // nest the chain so that we can throw away the results returned // up until this point, since we really don't care about it. - , function (er) { + , function X (er) { if (er) return cb(er) - var deps = Object.keys(target.dependencies || {}) - installMany(deps.filter(function (d) { - // prefer to not install things that are satisfied by - // something in the "family" list. - return !semver.satisfies(family[d], target.dependencies[d]) - }).map(function (d) { - var t = target.dependencies[d] - , parsed = url.parse(t.replace(/^git\+/, "git")) - t = d + "@" + t - return t - }), targetFolder, family, ancestors, false, target, function (er, d) { - log.verbose(targetFolder, "about to build") - if (er) return cb(er) - npm.commands.build( [targetFolder] - , npm.config.get("global") - , true - , function (er) { return cb(er, d) }) + + // before continuing to installing dependencies, check for a shrinkwrap. + readDependencies(context, targetFolder, {}, function (er, data, wrap) { + var deps = Object.keys(data.dependencies || {}) + + // don't install bundleDependencies, unless they're missing. + if (data.bundleDependencies) { + deps = deps.filter(function (d) { + return data.bundleDependencies.indexOf(d) === -1 || + bundled.indexOf(d) === -1 + }) + } + + var newcontext = { family: family + , ancestors: context.ancestors + , parent: target + , explicit: false + , wrap: wrap } + installMany(deps.filter(function (d) { + // prefer to not install things that are satisfied by + // something in the "family" list, unless we're installing + // from a shrinkwrap. + return wrap || !semver.satisfies(family[d], data.dependencies[d]) + }).map(function (d) { + var t = data.dependencies[d] + , parsed = url.parse(t.replace(/^git\+/, "git")) + t = d + "@" + t + return t + }), targetFolder, newcontext, function (er, d) { + log.verbose(targetFolder, "about to build") + if (er) return cb(er) + npm.commands.build( [targetFolder] + , npm.config.get("global") + , true + , function (er) { return cb(er, d) }) + }) }) - } ) + }) } diff --git a/deps/npm/lib/link.js b/deps/npm/lib/link.js index fea6606666..3049884cab 100644 --- a/deps/npm/lib/link.js +++ b/deps/npm/lib/link.js @@ -141,6 +141,7 @@ function resultPrinter (pkg, src, dest, rp, cb) { var where = relativize(dest, path.resolve(process.cwd(),"x")) rp = (rp || "").trim() src = (src || "").trim() + // XXX If --json is set, then look up the data from the package.json if (npm.config.get("parseable")) { return parseableOutput(dest, rp || src, cb) } @@ -150,6 +151,9 @@ function resultPrinter (pkg, src, dest, rp, cb) { } function parseableOutput (dest, rp, cb) { + // XXX this should match ls --parseable and install --parseable + // look up the data from package.json, format it the same way. + // // link is always effectively "long", since it doesn't help much to // *just* print the target folder. // However, we don't actually ever read the version number, so diff --git a/deps/npm/lib/ls.js b/deps/npm/lib/ls.js index 33336cf63e..276530c354 100644 --- a/deps/npm/lib/ls.js +++ b/deps/npm/lib/ls.js @@ -13,6 +13,7 @@ var npm = require("./npm.js") , log = require("./utils/log.js") , relativize = require("./utils/relativize.js") , path = require("path") + , archy = require("archy") ls.usage = "npm ls" @@ -26,13 +27,102 @@ function ls (args, silent, cb) { var dir = path.resolve(npm.dir, "..") readInstalled(dir, function (er, data) { - if (er || silent) return cb(er, data) + var lite = getLite(bfsify(data)) + if (er || silent) return cb(er, data, lite) + var long = npm.config.get("long") - var out = makePretty(bfsify(data), long, dir).join("\n") - output.write(out, function (er) { cb(er, data) }) + , json = npm.config.get("json") + , out + if (json) { + var seen = [] + var d = long ? bfsify(data) : lite + // the raw data can be circular + out = JSON.stringify(d, function (k, o) { + if (typeof o === "object") { + if (-1 !== seen.indexOf(o)) return "[Circular]" + seen.push(o) + } + return o + }, 2) + } else if (npm.config.get("parseable")) { + out = makeParseable(bfsify(data), long, dir) + } else if (data) { + out = makeArchy(bfsify(data), long, dir) + } + output.write(out, function (er) { cb(er, data, lite) }) }) } +function alphasort (a, b) { + a = a.toLowerCase() + b = b.toLowerCase() + return a > b ? 1 + : a < b ? -1 : 0 +} + +function getLite (data, noname) { + var lite = {} + , maxDepth = npm.config.get("depth") + , url = require("url") + + if (!noname && data.name) lite.name = data.name + if (data.version) lite.version = data.version + if (data.extraneous) { + lite.extraneous = true + lite.problems = lite.problems || [] + lite.problems.push( "extraneous: " + + data.name + "@" + data.version + + " " + (data.path || "") ) + } + + if (data._from) { + var from = data._from + if (from.indexOf(data.name + "@") === 0) { + from = from.substr(data.name.length + 1) + } + var u = url.parse(from) + if (u.protocol) lite.from = from + } + + if (data.invalid) { + lite.invalid = true + lite.problems = lite.problems || [] + lite.problems.push( "invalid: " + + data.name + "@" + data.version + + " " + (data.path || "") ) + } + + if (data.dependencies) { + var deps = Object.keys(data.dependencies) + if (deps.length) lite.dependencies = deps.map(function (d) { + var dep = data.dependencies[d] + if (typeof dep === "string") { + lite.problems = lite.problems || [] + var p + if (data.depth >= maxDepth) { + p = "max depth reached: " + } else { + p = "missing: " + } + p += d + "@" + dep + + ", required by " + + data.name + "@" + data.version + lite.problems.push(p) + return [d, { required: dep, missing: true }] + } + return [d, getLite(dep, true)] + }).reduce(function (deps, d) { + if (d[1].problems) { + lite.problems = lite.problems || [] + lite.problems.push.apply(lite.problems, d[1].problems) + } + deps[d[0]] = d[1] + return deps + }, {}) + } + return lite +} + function bfsify (root, current, queue, seen) { // walk over the data, and turn it from this: // +-- a @@ -45,7 +135,7 @@ function bfsify (root, current, queue, seen) { // which looks nicer current = current || root queue = queue || [] - seen = seen || [] + seen = seen || [root] var deps = current.dependencies = current.dependencies || {} Object.keys(deps).forEach(function (d) { var dep = deps[d] @@ -67,103 +157,115 @@ function bfsify (root, current, queue, seen) { } -function makePretty (data, long, dir, prefix, list) { - var top = !list - list = list || [] - prefix = prefix || "" - list.push(format(data, long, prefix, dir)) - var deps = data.dependencies || {} - , childPref = prefix.split("├─").join("│ ") - .split("└─").join(" ") - , depList = Object.keys(deps) - , depLast = depList.length - 1 - , maxDepth = npm.config.get("depth") - Object.keys(deps).sort(function (a, b) { - return a > b ? 1 : -1 - }).forEach(function (d, i) { - var depData = deps[d] - if (typeof depData === "string") { - if (data.depth < maxDepth) { - var p = data.link || data.path - log.warn("Unmet dependency in "+p, d+" "+deps[d]) - depData = npm.config.get("parseable") - ? ( npm.config.get("long") - ? path.resolve(data.path, "node_modules", d) - + ":"+d+"@"+JSON.stringify(depData)+":INVALID:MISSING" - : "" ) - : "─ \033[31;40mUNMET DEPENDENCY\033[0m "+d+" "+depData - } else { - if (npm.config.get("parseable")) { - depData = path.resolve(data.path, "node_modules", d) - + (npm.config.get("long") - ? ":" + d + "@" + JSON.stringify(depData) - + ":" // no realpath resolved - + ":MAXDEPTH" - : "") - } else { - depData = "─ "+d+"@'"+depData +"' (max depth reached)" - } - } - } - var c = i === depLast ? "└─" : "├─" - makePretty(depData, long, dir, childPref + c, list) - }) - if (top && list.length === 1 && !data._id) { - if (!npm.config.get("parseable")) { - list.push("(empty)") - } else if (npm.config.get("long")) list[0] += ":EMPTY" - } - return list.filter(function (l) { return l && l.trim() }) +function makeArchy (data, long, dir) { + var out = makeArchy_(data, long, dir, 0) + return archy(out, "", { unicode: npm.config.get("unicode") }) } -function ugly (data) { +function makeArchy_ (data, long, dir, depth, parent, d) { if (typeof data === "string") { + if (depth < npm.config.get("depth")) { + // just missing + var p = parent.link || parent.path + log.warn("Unmet dependency in "+p, d+" "+data) + data = "\033[31;40mUNMET DEPENDENCY\033[0m " + d + " " + data + } else { + data = d+"@'"+ data +"' (max depth reached)" + } return data } - if (!npm.config.get("long")) return data.path - return data.path - + ":" + (data._id || "") - + ":" + (data.realPath !== data.path ? data.realPath : "") - + (data.extraneous ? ":EXTRANEOUS" : "") - + (data.invalid ? ":INVALID" : "") -} + var out = {} + // the top level is a bit special. + out.label = data._id ? data._id + " " : "" + if (data.link) out.label += "-> " + data.link -function format (data, long, prefix, dir) { - if (npm.config.get("parseable")) return ugly(data) - if (typeof data === "string") { - return prefix + data - } -// console.log([data.path, dir], "relativize") - var depLen = Object.keys(data.dependencies).length - , space = prefix.split("├─").join("│ ") - .split("└─").join(" ") - + (depLen ? "" : " ") - , rel = relativize(data.path || "", dir) - , l = prefix - + (rel === "." ? "" : depLen ? "┬ " : "─ ") - + (data._id ? data._id + " " : "") - + (data.link ? "-> " + data.link : "") + "" - + (rel === "." && !(long && data._id) ? dir : "") if (data.invalid) { - if (data.realName !== data.name) l += " ("+data.realName+")" - l += " \033[31;40minvalid\033[0m" + if (data.realName !== data.name) out.label += " ("+data.realName+")" + out.label += " \033[31;40minvalid\033[0m" } - if (data.extraneous && rel !== ".") { - l += " \033[32;40mextraneous\033[0m" + + if (data.extraneous && data.path !== dir) { + out.label += " \033[32;40mextraneous\033[0m" + } + + if (long) { + if (dir === data.path) out.label += "\n" + dir + out.label += "\n" + getExtras(data, dir) + } else if (dir === data.path) { + out.label += dir + } + + // now all the children. + out.nodes = Object.keys(data.dependencies || {}) + .sort(alphasort).map(function (d) { + return makeArchy_(data.dependencies[d], long, dir, depth + 1, data, d) + }) + + if (out.nodes.length === 0 && data.path === dir) { + out.nodes = ["(empty)"] } - if (!long || !data._id) return l + + return out +} + +function getExtras (data, dir) { var extras = [] - if (rel !== ".") extras.push(rel) - else extras.push(dir) + , rel = relativize(data.path || "", dir) + , url = require("url") + if (data.description) extras.push(data.description) if (data.repository) extras.push(data.repository.url) if (data.homepage) extras.push(data.homepage) - extras = extras.filter(function (e) { return e }) - var lastExtra = !depLen && extras.length - 1 - l += extras.map(function (e, i) { - var indent = !depLen ? " " : "│ " - return "\n" + space + indent + e - }).join("") - return l + if (data._from) { + var from = data._from + if (from.indexOf(data.name + "@") === 0) { + from = from.substr(data.name.length + 1) + } + var u = url.parse(from) + if (u.protocol) extras.push(from) + } + return extras.join("\n") +} + + +function makeParseable (data, long, dir, depth, parent, d) { + depth = depth || 0 + + return [ makeParseable_(data, long, dir, depth, parent, d) ] + .concat(Object.keys(data.dependencies || {}) + .sort(alphasort).map(function (d) { + return makeParseable(data.dependencies[d], long, dir, depth + 1, data, d) + })) + .join("\n") +} + +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) + data = npm.config.get("long") + ? path.resolve(parent.path, "node_modules", d) + + ":"+d+"@"+JSON.stringify(data)+":INVALID:MISSING" + : "" + } else { + data = path.resolve(data.path, "node_modules", d) + + (npm.config.get("long") + ? ":" + d + "@" + JSON.stringify(data) + + ":" // no realpath resolved + + ":MAXDEPTH" + : "") + } + + return data + } + + if (!npm.config.get("long")) return data.path + + return data.path + + ":" + (data._id || "") + + ":" + (data.realPath !== data.path ? data.realPath : "") + + (data.extraneous ? ":EXTRANEOUS" : "") + + (data.invalid ? ":INVALID" : "") } diff --git a/deps/npm/lib/npm.js b/deps/npm/lib/npm.js index de68393d39..2db21e34de 100644 --- a/deps/npm/lib/npm.js +++ b/deps/npm/lib/npm.js @@ -17,8 +17,6 @@ require("path").SPLIT_CHAR = process.platform === "win32" ? "\\" : "/" var EventEmitter = require("events").EventEmitter , npm = module.exports = new EventEmitter , config = require("./config.js") - , set = require("./utils/set.js") - , get = require("./utils/get.js") , ini = require("./utils/ini.js") , log = require("./utils/log.js") , fs = require("graceful-fs") @@ -27,11 +25,28 @@ var EventEmitter = require("events").EventEmitter , which = require("which") , semver = require("semver") , findPrefix = require("./utils/find-prefix.js") - , getUid = require("./utils/uid-number.js") - , mkdir = require("./utils/mkdir-p.js") + , getUid = require("uid-number") + , mkdirp = require("mkdirp") , slide = require("slide") , chain = slide.chain +// /usr/local is often a read-only fs, which is not +// well handled by node or mkdirp. Just double-check +// in the case of errors when making the prefix dirs. +function mkdir (p, cb) { + mkdirp(p, function (er, made) { + // it could be that we couldn't create it, because it + // already exists, and is on a read-only fs. + if (er) { + return fs.stat(p, function (er2, st) { + if (er2 || !st.isDirectory()) return cb(er) + return cb(null, made) + }) + } + return cb(er, made) + }) +} + npm.commands = {} npm.ELIFECYCLE = {} npm.E404 = {} @@ -40,30 +55,7 @@ npm.EJSONPARSE = {} npm.EISGIT = {} npm.ECYCLE = {} npm.ENOTSUP = {} - -// HACK for windows -if (process.platform === "win32") { - // stub in unavailable methods from process and fs binding - if (!process.getuid) process.getuid = function() {} - if (!process.getgid) process.getgid = function() {} - var fsBinding = process.binding("fs") - if (!fsBinding.chown) fsBinding.chown = function() { - var cb = arguments[arguments.length - 1] - if (typeof cb == "function") cb() - } - - // patch rename/renameSync, but this should really be fixed in node - var _fsRename = fs.rename - , _fsPathPatch - _fsPathPatch = function(p) { - return p && p.replace(/\\/g, "/") || p; - } - fs.rename = function(p1, p2) { - arguments[0] = _fsPathPatch(p1) - arguments[1] = _fsPathPatch(p2) - return _fsRename.apply(fs, arguments); - } -} +npm.EBADPLATFORM = {} try { // startup, ok to do this synchronously @@ -112,6 +104,7 @@ var commandCache = {} , "unstar": "star" // same function , "apihelp" : "help" , "login": "adduser" + , "add-user": "adduser" } , aliasNames = Object.keys(aliases) @@ -138,6 +131,7 @@ var commandCache = {} , "unpublish" , "owner" , "deprecate" + , "shrinkwrap" , "help" , "help-search" @@ -309,7 +303,7 @@ function loadPrefix (npm, conf, cb) { }) // the prefix MUST exist, or else nothing works. if (!npm.config.get("global")) { - mkdir(p, npm.modes.exec, null, null, true, next) + mkdir(p, next) } else { next(er) } @@ -322,7 +316,7 @@ function loadPrefix (npm, conf, cb) { , enumerable : true }) // the prefix MUST exist, or else nothing works. - mkdir(gp, npm.modes.exec, null, null, true, next) + mkdir(gp, next) }) var i = 2 diff --git a/deps/npm/lib/outdated.js b/deps/npm/lib/outdated.js index 496dfbd426..e883abd359 100644 --- a/deps/npm/lib/outdated.js +++ b/deps/npm/lib/outdated.js @@ -48,6 +48,10 @@ function makePretty (p) { , dir = path.resolve(p[0], "node_modules", dep) , has = p[2] , want = p[3] + + // XXX add --json support + // Should match (more or less) the output of ls --json + if (parseable) { var str = dir if (npm.config.get("long")) { diff --git a/deps/npm/lib/rebuild.js b/deps/npm/lib/rebuild.js index fc5f96825d..0e1d56a1de 100644 --- a/deps/npm/lib/rebuild.js +++ b/deps/npm/lib/rebuild.js @@ -31,7 +31,6 @@ function rebuild (args, cb) { function cleanBuild (folders, set, cb) { // https://github.com/isaacs/npm/issues/1872 - // If there's a makefile, try 'make clean' // If there's a wscript, try 'node-waf clean' // But don't die on either of those if they fail. // Just a best-effort kind of deal. @@ -41,8 +40,6 @@ function cleanBuild (folders, set, cb) { if (er) return cb(er) if (files.indexOf("wscript") !== -1) { exec("node-waf", ["clean"], null, false, f, thenBuild) - } else if (files.indexOf("Makefile") !== -1) { - exec("make", ["clean"], null, false, f, thenBuild) } else thenBuild() }) function thenBuild (er) { diff --git a/deps/npm/lib/search.js b/deps/npm/lib/search.js index 92f4319f58..213390eb08 100644 --- a/deps/npm/lib/search.js +++ b/deps/npm/lib/search.js @@ -137,7 +137,8 @@ function prettify (data, args) { , stdout = process.stdout , cols = !tty.isatty(stdout.fd) ? Infinity : stdout._handle ? stdout._handle.getWindowSize()[0] - : tty.getWindowSize()[1] + : process.stdout.getWindowSize()[0] + cols = (cols == 0) ? Infinity : cols } catch (ex) { cols = Infinity } // name, desc, author, keywords diff --git a/deps/npm/lib/set.js b/deps/npm/lib/set.js index d821095157..c83602ec1f 100644 --- a/deps/npm/lib/set.js +++ b/deps/npm/lib/set.js @@ -8,5 +8,6 @@ var npm = require("./npm.js") set.completion = npm.commands.config.completion function set (args, cb) { + if (!args.length) return cb(set.usage) npm.commands.config(["set"].concat(args), cb) } diff --git a/deps/npm/lib/unbuild.js b/deps/npm/lib/unbuild.js index f4bd008a66..771eddf7db 100644 --- a/deps/npm/lib/unbuild.js +++ b/deps/npm/lib/unbuild.js @@ -3,6 +3,7 @@ unbuild.usage = "npm unbuild <folder>\n(this is plumbing)" var readJson = require("./utils/read-json.js") , rm = require("rimraf") + , gentlyRm = require("./utils/gently-rm.js") , npm = require("./npm.js") , path = require("path") , fs = require("graceful-fs") @@ -56,15 +57,20 @@ function rmBins (pkg, folder, parent, top, cb) { if (process.platform === "win32") { rm(path.resolve(binRoot, b) + ".cmd", cb) } else { - rm( path.resolve(binRoot, b) - , { gently: !npm.config.get("force") && folder } - , cb ) + gentlyRm( path.resolve(binRoot, b) + , !npm.config.get("force") && folder + , cb ) } }, cb) } function rmMans (pkg, folder, parent, top, cb) { - if (!pkg.man || !top || process.platform === "win32") return cb() + if (!pkg.man + || !top + || process.platform === "win32" + || !npm.config.get("global")) { + return cb() + } var manRoot = path.resolve(npm.config.get("prefix"), "share", "man") asyncMap(pkg.man, function (man, cb) { var parseMan = man.match(/(.*)\.([0-9]+)(\.gz)?$/) @@ -78,8 +84,8 @@ function rmMans (pkg, folder, parent, top, cb) { : pkg.name + "-" + bn) + "." + sxn + gz ) - rm( manDest - , { gently: !npm.config.get("force") && folder } - , cb ) + gentlyRm( manDest + , !npm.config.get("force") && folder + , cb ) }, cb) } diff --git a/deps/npm/lib/uninstall.js b/deps/npm/lib/uninstall.js index 1b43607d6d..655e5eb968 100644 --- a/deps/npm/lib/uninstall.js +++ b/deps/npm/lib/uninstall.js @@ -40,7 +40,12 @@ function uninstall (args, cb) { function uninstall_ (args, nm, cb) { asyncMap(args, function (arg, cb) { - var p = path.resolve(nm, arg) + // 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") + return cb(null, []) + } fs.lstat(p, function (er) { if (er) { log.warn(arg, "Not installed in "+nm) diff --git a/deps/npm/lib/utils/cmd-shim.js b/deps/npm/lib/utils/cmd-shim.js index a7892e8ee3..e24da36f6d 100644 --- a/deps/npm/lib/utils/cmd-shim.js +++ b/deps/npm/lib/utils/cmd-shim.js @@ -14,7 +14,7 @@ cmdShim.ifExists = cmdShimIfExists var fs = require("graceful-fs") , chain = require("slide").chain - , mkdir = require("./mkdir-p.js") + , mkdir = require("mkdirp") , rm = require("rimraf") , log = require("./log.js") , path = require("path") @@ -73,16 +73,16 @@ function writeShim_ (from, to, prog, args, cb) { target = "" shTarget = "" } else { - longProg = "\"%~dp0\"\\\"" + prog + ".exe\"" + longProg = "\"%~dp0\\" + prog + ".exe\"" shLongProg = "\"`dirname \"$0\"`/" + prog + "\"" target = "\"%~dp0\\" + target + "\"" shTarget = "\"`dirname \"$0\"`/" + shTarget + "\"" } - // @IF EXIST "%~dp0"\"node.exe" ( + // @IF EXIST "%~dp0\node.exe" ( // "%~dp0\node.exe" "%~dp0\.\node_modules\npm\bin\npm-cli.js" %* // ) ELSE ( - // node "%~dp0\.\node_modules\npm\bin\npm-cli.js" %* + // node "%~dp0\.\node_modules\npm\bin\npm-cli.js" %* // ) var cmd if (longProg) { diff --git a/deps/npm/lib/utils/completion/file-completion.js b/deps/npm/lib/utils/completion/file-completion.js index 427efefb44..c1c241d682 100644 --- a/deps/npm/lib/utils/completion/file-completion.js +++ b/deps/npm/lib/utils/completion/file-completion.js @@ -1,7 +1,7 @@ module.exports = fileCompletion var find = require("../find.js") - , mkdir = require("../mkdir-p.js") + , mkdir = require("mkdirp") , path = require("path") function fileCompletion (root, req, depth, cb) { diff --git a/deps/npm/lib/utils/config-defs.js b/deps/npm/lib/utils/config-defs.js index d368c49726..18b47ecdb7 100644 --- a/deps/npm/lib/utils/config-defs.js +++ b/deps/npm/lib/utils/config-defs.js @@ -9,6 +9,7 @@ var path = require("path") , os = require("os") , nopt = require("nopt") , log = require("./log.js") + , npm = require("../npm.js") function Octal () {} function validateOctal (data, k, val) { @@ -139,6 +140,8 @@ Object.defineProperty(exports, "defaults", {get: function () { , cache : process.platform === "win32" ? path.resolve(process.env.APPDATA || home || temp, "npm-cache") : path.resolve( home || temp, ".npm") + , "cache-max": Infinity + , "cache-min": 0 , color : process.platform !== "win32" || winColor , coverage: false @@ -161,6 +164,7 @@ Object.defineProperty(exports, "defaults", {get: function () { , "init.author.name" : "" , "init.author.email" : "" , "init.author.url" : "" + , json: false , link: false , logfd : 2 , loglevel : "http" @@ -180,10 +184,13 @@ Object.defineProperty(exports, "defaults", {get: function () { , proxy : process.env.HTTP_PROXY || process.env.http_proxy || null , "https-proxy" : process.env.HTTPS_PROXY || process.env.https_proxy || 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/" , rollback : true , save : false + , "save-dev" : false + , "save-optional" : false , searchopts: "" , searchexclude: null , searchsort: "name" @@ -206,6 +213,7 @@ Object.defineProperty(exports, "defaults", {get: function () { , userignorefile : path.resolve(home, ".npmignore") , umask: 022 , version : false + , versions : false , viewer: process.platform === "win32" ? "browser" : "man" , yes: null @@ -220,6 +228,8 @@ exports.types = , browser : String , ca: [null, String] , cache : path + , "cache-max": Number + , "cache-min": Number , color : ["always", Boolean] , coverage: Boolean , depth : Number @@ -233,11 +243,13 @@ exports.types = , globalignorefile: path , group : [Number, String] , "https-proxy" : [null, url] + , "user-agent" : String , ignore : String , "init.version" : [null, semver] , "init.author.name" : String , "init.author.email" : String , "init.author.url" : ["", url] + , json: Boolean , link: Boolean , logfd : [Number, Stream] , loglevel : ["silent","win","error","warn","http","info","verbose","silly"] @@ -259,6 +271,8 @@ exports.types = , registry : [null, url] , rollback : Boolean , save : Boolean + , "save-dev" : Boolean + , "save-optional" : Boolean , searchopts : String , searchexclude: [null, String] , searchsort: [ "name", "-name" @@ -279,6 +293,7 @@ exports.types = , userignorefile : path , umask: Octal , version : Boolean + , versions : Boolean , viewer: String , yes: [false, null, Boolean] , _exit : Boolean @@ -313,6 +328,8 @@ exports.shorthands = , porcelain : ["--parseable"] , g : ["--global"] , S : ["--save"] + , D : ["--save-dev"] + , O : ["--save-optional"] , y : ["--yes"] , n : ["--no-yes"] } diff --git a/deps/npm/lib/utils/error-handler.js b/deps/npm/lib/utils/error-handler.js index 22d26d8d6c..0cdc03faca 100644 --- a/deps/npm/lib/utils/error-handler.js +++ b/deps/npm/lib/utils/error-handler.js @@ -159,6 +159,17 @@ function errorHandler (er) { ].join("\n")) break + case npm.EBADPLATFORM: + er.code = "EBADPLATFORM" + log.error([er.message + ,"Not compatible with your operating system or architecture: "+er.pkgid + ,"Valid OS: "+er.os.join(",") + ,"Valid Arch: "+er.cpu.join(",") + ,"Actual OS: "+process.platform + ,"Actual Arch: "+process.arch + ].join("\n")) + break + case "EEXIST": case constants.EEXIST: log.error([er.message diff --git a/deps/npm/lib/utils/excludes.js b/deps/npm/lib/utils/excludes.js deleted file mode 100644 index 75fe41c057..0000000000 --- a/deps/npm/lib/utils/excludes.js +++ /dev/null @@ -1,157 +0,0 @@ -// build up a set of exclude lists in order of precedence: -// [ ["!foo", "bar"] -// , ["foo", "!bar"] ] -// being *included* will override a previous exclusion, -// and being excluded will override a previous inclusion. -// -// Each time the tar file-list generator thingie enters a new directory, -// it calls "addIgnoreFile(dir, list, cb)". If an ignore file is found, -// then it is added to the list and the cb() is called with an -// child of the original list, so that we don't have -// to worry about popping it off at the right time, since other -// directories will continue to use the original parent list. -// -// If no ignore file is found, then the original list is returned. -// -// To start off with, ~/.{npm,git}ignore is added, as is -// prefix/{npm,git}ignore, effectively treated as if they were in the -// base package directory. - -exports.addIgnoreFile = addIgnoreFile -exports.readIgnoreFile = readIgnoreFile -exports.parseIgnoreFile = parseIgnoreFile -exports.test = test -exports.filter = filter - -var path = require("path") - , fs = require("graceful-fs") - , minimatch = require("minimatch") - , relativize = require("./relativize.js") - , log = require("./log.js") - -// todo: memoize - -// read an ignore file, or fall back to the -// "gitBase" file in the same directory. -function readIgnoreFile (file, gitBase, cb) { - //log.warn(file, "ignoreFile") - if (!file) return cb(null, "") - fs.readFile(file, function (er, data) { - if (!er || !gitBase) return cb(null, data || "") - var gitFile = path.resolve(path.dirname(file), gitBase) - fs.readFile(gitFile, function (er, data) { - return cb(null, data || "") - }) - }) -} - -// read a file, and then return the list of patterns -function parseIgnoreFile (file, gitBase, dir, cb) { - readIgnoreFile(file, gitBase, function (er, data) { - data = data ? data.toString("utf8") : "" - - data = data.split(/[\r\n]+/).map(function (p) { - return p.trim() - }).filter(function (p) { - return p.length && p.charAt(0) !== "#" - }) - data.dir = dir - return cb(er, data) - }) -} - -// add an ignore file to an existing list which can -// then be passed to the test() function. If the ignore -// file doesn't exist, then the list is unmodified. If -// it is, then a concat-child of the original is returned, -// so that this is suitable for walking a directory tree. -function addIgnoreFile (file, gitBase, list, dir, cb) { - if (typeof cb !== "function") cb = dir, dir = path.dirname(file) - if (typeof cb !== "function") cb = list, list = [] - parseIgnoreFile(file, gitBase, dir, function (er, data) { - if (!er && data) { - // package.json "files" array trumps everything - // Make sure it's always last. - if (list.length && list[list.length-1].packageFiles) { - list = list.concat([data, list.pop()]) - } else { - list = list.concat([data]) - } - } - cb(er, list) - }) -} - - -// no IO -// loop through the lists created in the functions above, and test to -// see if a file should be included or not, given those exclude lists. -function test (file, excludeList) { - if (path.basename(file) === "package.json") return true - // log.warn(file, "test file") - // log.warn(excludeList, "test list") - var incRe = /^\!(\!\!)*/ - , excluded = false - for (var i = 0, l = excludeList.length; i < l; i ++) { - var excludes = excludeList[i] - , dir = excludes.dir - - // chop the filename down to be relative to excludeDir - var rf = relativize(file, dir, true) - rf = rf.replace(/^\.?\//, "") - if (file.slice(-1) === "/") rf += "/" - - // log.warn([file, rf], "rf") - - for (var ii = 0, ll = excludes.length; ii < ll; ii ++) { - var ex = excludes[ii].replace(/^(!*)\//, "$1") - , inc = !!ex.match(incRe) - - // log.warn([ex, rf], "ex, rf") - // excluding/including a dir excludes/includes all the files in it. - if (ex.slice(-1) === "/") ex += "**" - - // if this is not an inclusion attempt, and someone else - // excluded it, then just continue, because there's nothing - // that can be done here to change the exclusion. - if (!inc && excluded) continue - - // if it's an inclusion attempt, and the file has not been - // excluded, then skip it, because there's no need to try again. - if (inc && !excluded) continue - - // if it matches the pattern, then it should be excluded. - excluded = !!minimatch(rf, ex, { matchBase: true }) - // log.error([rf, ex, excluded], "rf, ex, excluded") - - // if you include foo, then it also includes foo/bar.js - if (inc && excluded && ex.slice(-3) !== "/**") { - excluded = minimatch(rf, ex + "/**", { matchBase: true }) - // log.warn([rf, ex + "/**", inc, excluded], "dir without /") - } - - // if you exclude foo, then it also excludes foo/bar.js - if (!inc - && excluded - && ex.slice(-3) !== "/**" - && rf.slice(-1) === "/" - && excludes.indexOf(ex + "/**") === -1) { - // log.warn(ex + "/**", "adding dir-matching exclude pattern") - excludes.splice(ii, 1, ex, ex + "/**") - ll ++ - } - } - // log.warn([rf, excluded, excludes], "rf, excluded, excludes") - } - // true if it *should* be included - // log.warn([file, excludeList, excluded], "file, excluded") - return !excluded -} - -// returns a function suitable for Array#filter -function filter (dir, list) { return function (file) { - file = file.trim() - var testFile = path.resolve(dir, file) - if (file.slice(-1) === "/") testFile += "/" - return file && test(testFile, list) -}} diff --git a/deps/npm/lib/utils/exec.js b/deps/npm/lib/utils/exec.js index 0fa0371b2e..b9a5b69114 100644 --- a/deps/npm/lib/utils/exec.js +++ b/deps/npm/lib/utils/exec.js @@ -1,4 +1,3 @@ - module.exports = exec exec.spawn = spawn exec.pipe = pipe @@ -11,6 +10,7 @@ var log = require("./log.js") , myGID = process.getgid ? process.getgid() : null , isRoot = process.getuid && myUID === 0 , constants = require("constants") + , uidNumber = require("uid-number") function exec (cmd, args, env, takeOver, cwd, uid, gid, cb) { if (typeof cb !== "function") cb = gid, gid = null @@ -34,6 +34,15 @@ function exec (cmd, args, env, takeOver, cwd, uid, gid, cb) { log.verbose(uid, "Setting uid from "+myUID) log.verbose(new Error().stack, "stack at uid setting") } + + if (uid && gid && (isNaN(uid) || isNaN(gid))) { + // get the numeric values + return uidNumber(uid, gid, function (er, uid, gid) { + if (er) return cb(er) + exec(cmd, args, env, takeOver, cwd, uid, gid, cb) + }) + } + log.silly(cmd+" "+args.map(JSON.stringify).join(" "), "exec") var stdout = "" , stderr = "" @@ -77,6 +86,7 @@ function pipe (cp1, cp2, cb) { cb(errState = new Error( "Failed "+(cp1.name || "<unknown>")+"\nexited with "+code)) }) + cp2.on("exit", function (code) { cp2._exited = true if (errState) return @@ -94,10 +104,10 @@ function spawn (c, a, env, takeOver, cwd, uid, gid) { , env : env || process.env , cwd : cwd || null } , cp - if (uid != null) opts.uid = uid - if (gid != null) opts.gid = gid - if (!isNaN(opts.uid)) opts.uid = +opts.uid - if (!isNaN(opts.gid)) opts.gid = +opts.gid + + if (uid && !isNaN(uid)) opts.uid = +uid + if (gid && !isNaN(gid)) opts.gid = +gid + var name = c +" "+ a.map(JSON.stringify).join(" ") log.silly([c, a, opts.cwd], "spawning") cp = child_process.spawn(c, a, opts) diff --git a/deps/npm/lib/utils/fetch.js b/deps/npm/lib/utils/fetch.js index ba1e567b1f..bc1c095cdf 100644 --- a/deps/npm/lib/utils/fetch.js +++ b/deps/npm/lib/utils/fetch.js @@ -8,16 +8,16 @@ var request = require("request") , url = require("url") , log = require("./log.js") , path = require("path") - , mkdir = require("./mkdir-p.js") + , mkdir = require("mkdirp") + , chownr = require("chownr") , regHost - , getAgent = require("./get-agent.js") module.exports = fetch function fetch (remote, local, headers, cb) { if (typeof cb !== "function") cb = headers, headers = {} log.verbose(local, "fetch to") - mkdir(path.dirname(local), function (er) { + mkdir(path.dirname(local), function (er, made) { if (er) return cb(er) fetch_(remote, local, headers, cb) }) @@ -57,8 +57,9 @@ function makeRequest (remote, fstr, headers) { request({ url: remote , proxy: proxy - , agent: getAgent(remote) , strictSSL: npm.config.get("strict-ssl") + , ca: remote.host === regHost ? npm.config.get("ca") : undefined + , headers: { "user-agent": npm.config.get("user-agent") } , onResponse: onResponse }).pipe(fstr) function onResponse (er, res) { if (er) return fstr.emit("error", er) diff --git a/deps/npm/lib/utils/find-prefix.js b/deps/npm/lib/utils/find-prefix.js index 320456c7ea..bc2c9598db 100644 --- a/deps/npm/lib/utils/find-prefix.js +++ b/deps/npm/lib/utils/find-prefix.js @@ -45,6 +45,9 @@ function findPrefix_ (p, original, cb) { return cb(null, p) } - return findPrefix_(path.dirname(p), original, cb) + var d = path.dirname(p) + if (d === p) return cb(null, original) + + return findPrefix_(d, original, cb) }) } diff --git a/deps/npm/lib/utils/get-agent.js b/deps/npm/lib/utils/get-agent.js deleted file mode 100644 index 4bc074f29b..0000000000 --- a/deps/npm/lib/utils/get-agent.js +++ /dev/null @@ -1,62 +0,0 @@ -// get an http/https agent -// This is necessary for the custom CA certs in http2, -// especially while juggling multiple different registries. -// -// When using http2, the agent key is just the CA setting, -// since it can manage socket pooling across different host:port -// options. When using the older implementation, the -// key is ca:host:port combination. - -module.exports = getAgent - -var npm = require("../npm.js") - , url = require("url") - , agents = {} - , isHttp2 = !!require("http").globalAgent - , registry = url.parse(npm.config.get("registry") || "") - , regCA = npm.config.get("ca") - -function getAgent (remote) { - // If not doing https, then there's no CA cert to manage. - // on http2, this will use the default global agent. - // on http1, this is undefined, so it'll spawn based on - // host:port if necessary. - if (remote.protocol !== "https:") { - return require("http").globalAgent - } - - if (typeof remote === "string") { - remote = url.parse(remote) - } - - var ca - // if this is the registry, then use the configuration ca. - // otherwise, just use the built-in CAs that node has. - // todo: multi-registry support. - if (remote.hostname === registry.hostname - && remote.port === registry.port) { - ca = regCA - } - - // no CA, just use the default agent. - if (!ca) { - return require("https").globalAgent - } - - var hostname = remote.hostname - , port = remote.port - , key = agentKey(hostname, port, ca) - - return agents[key] = agents[key] || getAgent_(hostname, port, ca) -} - -function getAgent_ (hostname, port, ca) { - var Agent = require("https").Agent - return new Agent({ host: hostname - , port: port - , ca: ca }) -} - -function agentKey (hostname, port, ca) { - return JSON.stringify(isHttp2 ? ca : [hostname, port, ca]) -} diff --git a/deps/npm/lib/utils/get.js b/deps/npm/lib/utils/get.js deleted file mode 100644 index 3c5e4f099b..0000000000 --- a/deps/npm/lib/utils/get.js +++ /dev/null @@ -1,6 +0,0 @@ - -module.exports = get -function get (obj, key) { - for (var i in obj) if (i.toLowerCase() === key.toLowerCase()) return obj[i] - return undefined -} diff --git a/deps/npm/lib/utils/ini.js b/deps/npm/lib/utils/ini.js index 48d4f99edf..b033b6a04d 100644 --- a/deps/npm/lib/utils/ini.js +++ b/deps/npm/lib/utils/ini.js @@ -323,8 +323,14 @@ function envReplace (f) { if (typeof f !== "string" || !f) return f // replace any ${ENV} values with the appropriate environ. - return f.replace(/\$\{([^}]+)\}/g, function (orig, name, i, s) { - return process.env[name] || orig + var envExpr = /(\\*)\$\{([^}]+)\}/g + return f.replace(envExpr, function (orig, esc, name, i, s) { + esc = esc.length && esc.length % 2 + if (esc) return orig + if (undefined === process.env[name]) { + throw new Error("Failed to replace env in config: "+orig) + } + return process.env[name] }) } diff --git a/deps/npm/lib/utils/lifecycle.js b/deps/npm/lib/utils/lifecycle.js index 970157349a..92b086e699 100644 --- a/deps/npm/lib/utils/lifecycle.js +++ b/deps/npm/lib/utils/lifecycle.js @@ -11,6 +11,17 @@ var log = require("./log.js") , chain = require("slide").chain , constants = require("constants") , output = require("./output.js") + , PATH = "PATH" + +// windows calls it's path "Path" usually, but this is not guaranteed. +if (process.platform === "win32") { + PATH = "Path" + Object.keys(process.env).forEach(function (e) { + if (e.match(/^PATH$/i)) { + PATH = e + } + }) +} function lifecycle (pkg, stage, wd, unsafe, failOk, cb) { if (typeof cb !== "function") cb = failOk, failOk = false @@ -54,16 +65,21 @@ function checkForLink (pkg, cb) { } function lifecycle_ (pkg, stage, wd, env, unsafe, failOk, cb) { - var PATH = [] + var pathArr = [] , p = wd.split("node_modules") , acc = path.resolve(p.shift()) p.forEach(function (pp) { - PATH.unshift(path.join(acc, "node_modules", ".bin")) + pathArr.unshift(path.join(acc, "node_modules", ".bin")) acc = path.join(acc, "node_modules", pp) }) - PATH.unshift(path.join(acc, "node_modules", ".bin")) - if (env.PATH) PATH.push(env.PATH) - env.PATH = PATH.join(process.platform === "win32" ? ";" : ":") + pathArr.unshift(path.join(acc, "node_modules", ".bin")) + + // we also unshift the bundled node-gyp-bin folder so that + // the bundled one will be used for installing things. + pathArr.unshift(path.join(__dirname, "..", "..", "bin", "node-gyp-bin")) + + if (env[PATH]) pathArr.push(env[PATH]) + env[PATH] = pathArr.join(process.platform === "win32" ? ";" : ":") var packageLifecycle = pkg.scripts && pkg.scripts.hasOwnProperty(stage) @@ -113,7 +129,7 @@ function runPackageLifecycle (pkg, env, wd, unsafe, cb) { , cmd = env.npm_lifecycle_script , sh = "sh" , shFlag = "-c" - + if (process.platform === "win32") { sh = "cmd" shFlag = "/c" @@ -121,9 +137,12 @@ function runPackageLifecycle (pkg, env, wd, unsafe, cb) { log.verbose(unsafe, "unsafe-perm in lifecycle") - output.write("\n> "+pkg._id+" " + stage+" "+wd+"\n> "+cmd+"\n", function (er) { + var note = "\n> " + pkg._id + " " + stage + " " + wd + + "\n> " + cmd + "\n" + + output.write(note, function (er) { if (er) return cb(er) - + exec( sh, [shFlag, cmd], env, true, wd , user, group , function (er, code, stdout, stderr) { @@ -233,6 +252,10 @@ function makeEnv (data, prefix, env) { return } var value = ini.get(i) + if (/^(log|out)fd$/.test(i) && typeof value === "object") { + // not an fd, a stream + return + } if (!value) value = "" else if (typeof value !== "string") value = JSON.stringify(value) diff --git a/deps/npm/lib/utils/link.js b/deps/npm/lib/utils/link.js index 9be1221f0a..7fa80d5e12 100644 --- a/deps/npm/lib/utils/link.js +++ b/deps/npm/lib/utils/link.js @@ -4,8 +4,8 @@ link.ifExists = linkIfExists var fs = require("graceful-fs") , chain = require("slide").chain - , mkdir = require("./mkdir-p.js") - , rm = require("rimraf") + , mkdir = require("mkdirp") + , rm = require("./gently-rm.js") , log = require("./log.js") , path = require("path") , relativize = require("./relativize.js") @@ -23,7 +23,7 @@ function link (from, to, gently, cb) { if (npm.config.get("force")) gently = false chain ( [ [fs, "stat", from] - , [rm, to, { gently: gently }] + , [rm, to, gently] , [mkdir, path.dirname(to)] , [fs, "symlink", relativize(from, to), to] ] , cb) diff --git a/deps/npm/lib/utils/mkdir-p.js b/deps/npm/lib/utils/mkdir-p.js deleted file mode 100644 index cc2b465fb6..0000000000 --- a/deps/npm/lib/utils/mkdir-p.js +++ /dev/null @@ -1,191 +0,0 @@ - -var log = require("./log.js") - , fs = require("graceful-fs") - , path = require("path") - , npm = require("../npm.js") - , exec = require("./exec.js") - , uidNumber = require("./uid-number.js") - , umask = process.umask() - , umaskOrig = umask - , addedUmaskExit = false - , mkdirCache = {} - -module.exports = mkdir -function mkdir (ensure, mode, uid, gid, noChmod, cb_) { - if (typeof cb_ !== "function") cb_ = noChmod, noChmod = null - if (typeof cb_ !== "function") cb_ = gid, gid = null - if (typeof cb_ !== "function") cb_ = uid, uid = null - if (typeof cb_ !== "function") cb_ = mode, mode = npm.modes.exec - - if (mode & umask) { - log.verbose(mode.toString(8), "umasking from "+umask.toString(8)) - process.umask(umask = 0) - if (!addedUmaskExit) { - addedUmaskExit = true - process.on("exit", function () { process.umask(umask = umaskOrig) }) - } - } - - ensure = path.resolve(ensure).replace(/\/+$/, '') - - // mkdir("/") should not do anything, since that always exists. - if (!ensure - || ( process.platform === "win32" - && ensure.match(/^[a-zA-Z]:(\\|\/)?$/))) { - return cb_() - } - - if (mkdirCache.hasOwnProperty(ensure)) { - return mkdirCache[ensure].push(cb_) - } - mkdirCache[ensure] = [cb_] - - function cb (er) { - var cbs = mkdirCache[ensure] - delete mkdirCache[ensure] - cbs.forEach(function (c) { c(er) }) - } - - if (uid === null && gid === null) { - return mkdir_(ensure, mode, uid, gid, noChmod, cb) - } - - uidNumber(uid, gid, function (er, uid, gid) { - if (er) return cb(er) - mkdir_(ensure, mode, uid, gid, noChmod, cb) - }) -} - -function mkdir_ (ensure, mode, uid, gid, noChmod, cb) { - // if it's already a dir, then just check the bits and owner. - fs.stat(ensure, function (er, s) { - if (s && s.isDirectory()) { - // check mode, uid, and gid. - if ((noChmod || (s.mode & mode) === mode) - && (typeof uid !== "number" || s.uid === uid) - && (typeof gid !== "number" || s.gid === gid)) return cb() - return done(ensure, mode, uid, gid, noChmod, cb) - } - return walkDirs(ensure, mode, uid, gid, noChmod, cb) - }) -} - -function done (ensure, mode, uid, gid, noChmod, cb) { - // now the directory has been created. - // chown it to the desired uid/gid - // Don't chown the npm.root dir, though, in case we're - // in unsafe-perm mode. - log.verbose("done: "+ensure+" "+mode.toString(8), "mkdir") - - // only chmod if noChmod isn't set. - var d = done_(ensure, mode, uid, gid, cb) - if (noChmod) return d() - fs.chmod(ensure, mode, d) -} - -function done_ (ensure, mode, uid, gid, cb) { - return function (er) { - if (er - || ensure === npm.dir - || typeof uid !== "number" - || typeof gid !== "number" - || npm.config.get("unsafe-perm")) return cb(er) - uid = Math.floor(uid) - gid = Math.floor(gid) - fs.chown(ensure, uid, gid, cb) - } -} - -var pathSplit = process.platform === "win32" ? /\/|\\/ : "/" -function walkDirs (ensure, mode, uid, gid, noChmod, cb) { - var dirs = ensure.split(pathSplit) - , walker = [] - , foundUID = null - , foundGID = null - - // gobble the "/" or C: first - walker.push(dirs.shift()) - - // The loop that goes through and stats each dir. - ;(function S (d) { - // no more directory steps left. - if (d === undefined) { - // do the chown stuff - return done(ensure, mode, uid, gid, noChmod, cb) - } - - // get the absolute dir for the next piece being stat'd - walker.push(d) - var dir = walker.join(path.SPLIT_CHAR) - - // stat callback lambda - fs.stat(dir, function STATCB (er, s) { - if (er) { - // the stat failed - directory does not exist. - - log.verbose(er.message, "mkdir (expected) error") - - // use the same uid/gid as the nearest parent, if not set. - if (foundUID !== null) uid = foundUID - if (foundGID !== null) gid = foundGID - - // make the directory - fs.mkdir(dir, mode, function MKDIRCB (er) { - // since stat and mkdir are done as two separate syscalls, - // operating on a path rather than a file descriptor, it's - // possible that the directory didn't exist when we did - // the stat, but then *did* exist when we go to to the mkdir. - // If we didn't care about uid/gid, we could just mkdir - // repeatedly, failing on any error other than "EEXIST". - if (er && er.message.indexOf("EEXIST") === 0) { - return fs.stat(dir, STATCB) - } - - // any other kind of error is not saveable. - if (er) return cb(er) - - // at this point, we've just created a new directory successfully. - - // if we care about permissions - if (!npm.config.get("unsafe-perm") // care about permissions - // specified a uid and gid - && uid !== null - && gid !== null ) { - // set the proper ownership - return fs.chown(dir, uid, gid, function (er) { - if (er) return cb(er) - // attack the next portion of the path. - S(dirs.shift()) - }) - } else { - // either we don't care about ownership, or it's already right. - S(dirs.shift()) - } - }) // mkdir - - } else { - // the stat succeeded. - if (s.isDirectory()) { - // if it's a directory, that's good. - // if the uid and gid aren't already set, then try to preserve - // the ownership on up the tree. Things in ~ remain owned by - // the user, things in / remain owned by root, etc. - if (uid === null && typeof s.uid === "number") foundUID = s.uid - if (gid === null && typeof s.gid === "number") foundGID = s.gid - - // move onto next portion of path - S(dirs.shift()) - - } else { - // the stat succeeded, but it's not a directory - log.verbose(dir, "mkdir exists") - log.silly(s, "stat("+dir+")") - log.verbose(s.isDirectory(), "isDirectory()") - cb(new Error("Failed to mkdir "+dir+": File exists")) - }// if (isDirectory) else - } // if (stat failed) else - }) // stat - - // start the S function with the first item in the list of directories. - })(dirs.shift()) -} diff --git a/deps/npm/lib/utils/npm-registry-client/get.js b/deps/npm/lib/utils/npm-registry-client/get.js index ae05ac1fc3..e0902f0276 100644 --- a/deps/npm/lib/utils/npm-registry-client/get.js +++ b/deps/npm/lib/utils/npm-registry-client/get.js @@ -6,8 +6,9 @@ var GET = require("./request.js").GET , npm = require("../../npm.js") , path = require("path") , log = require("../log.js") - , mkdir = require("../mkdir-p.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 @@ -19,6 +20,9 @@ function get (project, version, timeout, nofollow, staleOk, cb) { 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 @@ -136,7 +140,7 @@ function get_ (uri, timeout, cache, stat, data, nofollow, staleOk, cb) { data = remoteData if (!data) { - er = new Error("failed to fetch from registry: " + uri) + er = er || new Error("failed to fetch from registry: " + uri) } if (er) return cb(er, data, raw, response) @@ -170,13 +174,13 @@ function saveToCache (cache, data, saved) { } function saveToCache_ (cache, data, uid, gid, saved) { - mkdir(path.dirname(cache), npm.modes.exec, uid, gid, function (er) { + 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() } - fs.chown(cache, uid, gid, saved) + chownr(made || cache, uid, gid, saved) }) }) } diff --git a/deps/npm/lib/utils/npm-registry-client/request.js b/deps/npm/lib/utils/npm-registry-client/request.js index d98135e49e..d5122629dd 100644 --- a/deps/npm/lib/utils/npm-registry-client/request.js +++ b/deps/npm/lib/utils/npm-registry-client/request.js @@ -16,7 +16,6 @@ var npm = require("../../npm.js") , stream = require("stream") , Stream = stream.Stream , request = require("request") - , getAgent = require("../get-agent.js") function regRequest (method, where, what, etag, nofollow, cb_) { if (typeof cb_ !== "function") cb_ = nofollow, nofollow = false @@ -85,7 +84,7 @@ function regRequest (method, where, what, etag, nofollow, cb_) { function makeRequest (method, remote, where, what, etag, nofollow, cb) { var opts = { url: remote , method: method - , agent: getAgent(remote) + , ca: npm.config.get("ca") , strictSSL: npm.config.get("strict-ssl") } , headers = opts.headers = {} if (etag) { @@ -95,6 +94,8 @@ function makeRequest (method, remote, where, what, etag, nofollow, cb) { headers.accept = "application/json" + headers["user-agent"] = npm.config.get("user-agent") + opts.proxy = npm.config.get( remote.protocol === "https:" ? "https-proxy" : "proxy" ) diff --git a/deps/npm/lib/utils/output.js b/deps/npm/lib/utils/output.js index 00da9f69f7..b705153ad5 100644 --- a/deps/npm/lib/utils/output.js +++ b/deps/npm/lib/utils/output.js @@ -58,6 +58,7 @@ function write (args, stream, lf, cb) { if (!npm.config.get("unicode")) { arg = arg.replace(/â””/g, "`") .replace(/─/g, "-") + .replace(/│/g, "|") .replace(/├/g, "+") .replace(/┬/g, "-") } diff --git a/deps/npm/lib/utils/read-installed.js b/deps/npm/lib/utils/read-installed.js index 6c0ece25bc..ff220943d6 100644 --- a/deps/npm/lib/utils/read-installed.js +++ b/deps/npm/lib/utils/read-installed.js @@ -94,6 +94,7 @@ var npm = require("../npm.js") , semver = require("semver") , readJson = require("./read-json.js") , log = require("./log.js") + , url = require("url") module.exports = readInstalled @@ -125,7 +126,8 @@ function readInstalled_ (folder, parent, name, reqver, depth, maxDepth, cb) { }) readJson(path.resolve(folder, "package.json"), function (er, data) { - obj = data + obj = copy(data) + if (!parent) { obj = obj || true er = null @@ -253,6 +255,8 @@ function findUnmet (obj) { continue } if ( typeof deps[d] === "string" + // url deps presumed innocent. + && !url.parse(deps[d]).protocol && !semver.satisfies(found.version, deps[d])) { // the bad thing will happen log.warn(obj.path + " requires "+d+"@'"+deps[d] @@ -269,6 +273,15 @@ function findUnmet (obj) { return obj } +function copy (obj) { + if (!obj || typeof obj !== 'object') return obj + if (Array.isArray(obj)) return obj.map(copy) + + var o = {} + for (var i in obj) o[i] = copy(obj[i]) + return o +} + if (module === require.main) { var util = require("util") console.error("testing") diff --git a/deps/npm/lib/utils/read-json.js b/deps/npm/lib/utils/read-json.js index 388d6727eb..d1bba10f58 100644 --- a/deps/npm/lib/utils/read-json.js +++ b/deps/npm/lib/utils/read-json.js @@ -34,8 +34,33 @@ function readJson (jsonFile, opts, cb) { var wscript = null , contributors = null , serverjs = null + , gypfile = null - if (opts.wscript != null) { + if (opts.gypfile !== null && opts.gypfile !== undefined) { + gypfile = opts.gypfile + next() + } else { + var pkgdir = path.dirname(jsonFile) + + function hasGyp (has) { + gypfile = opts.gypfile = has + next() + } + + fs.readdir(pkgdir, function (er, gf) { + // this would be weird. + if (er) return hasGyp(false) + + // see if there are any *.gyp files in there. + gf = gf.filter(function (f) { + return f.match(/\.gyp$/) + }) + gf = gf[0] + return hasGyp(!!gf) + }) + } + + if (opts.wscript !== null && opts.wscript !== undefined) { wscript = opts.wscript next() } else fs.readFile( path.join(path.dirname(jsonFile), "wscript") @@ -47,7 +72,7 @@ function readJson (jsonFile, opts, cb) { next() }) - if (opts.contributors != null) { + if (opts.contributors !== null && opts.contributors !== undefined) { contributors = opts.contributors next() } else fs.readFile( path.join(path.dirname(jsonFile), "AUTHORS") @@ -64,7 +89,7 @@ function readJson (jsonFile, opts, cb) { next() }) - if (opts.serverjs != null) { + if (opts.serverjs !== null && opts.serverjs !== undefined) { serverjs = opts.serverjs next() } else fs.stat( path.join(path.dirname(jsonFile), "server.js") @@ -76,22 +101,55 @@ function readJson (jsonFile, opts, cb) { }) function next () { - if (wscript === null - || contributors === null - || serverjs === null) { + if (wscript === null || + contributors === null || + gypfile === null || + serverjs === null) { return } - fs.readFile(jsonFile, processJson(opts, function (er, data) { + // XXX this api here is insane. being internal is no excuse. + // please refactor. + var thenLoad = processJson(opts, function (er, data) { if (er) return cb(er) var doLoad = !(jsonFile.indexOf(npm.cache) === 0 && path.basename(path.dirname(jsonFile)) !== "package") if (!doLoad) return cb(er, data) loadPackageDefaults(data, path.dirname(jsonFile), cb) - })) + }) + + fs.readFile(jsonFile, function (er, data) { + if (er && er.code === "ENOENT") { + // single-file module, maybe? + // check index.js for a /**package { ... } **/ section. + var indexFile = path.resolve(path.dirname(jsonFile), "index.js") + return fs.readFile(indexFile, function (er2, data) { + // if this doesn't work, then die with the original error. + if (er2) return cb(er) + data = parseIndex(data) + if (!data) return cb(er) + thenLoad(null, data) + }) + } + thenLoad(er, data) + }) } } +// sync. no io. +// /**package { "name": "foo", "version": "1.2.3", ... } **/ +function parseIndex (data) { + data = data.toString() + data = data.split(/^\/\*\*package(?:\s|$)/m) + if (data.length < 2) return null + data = data[1] + data = data.split(/\*\*\/$/m) + if (data.length < 2) return null + data = data[0] + data = data.replace(/^\s*\*/mg, "") + return data +} + function processJson (opts, cb) { if (typeof cb !== "function") cb = opts, opts = {} if (typeof cb !== "function") { @@ -113,8 +171,8 @@ function processJson (opts, cb) { } function processJsonString (opts, cb) { return function (er, jsonString) { - jsonString += "" if (er) return cb(er, jsonString) + jsonString += "" var json try { json = JSON.parse(jsonString) @@ -188,11 +246,12 @@ function typoWarn (json) { } if (typeof json.bugs === "object") { + // just go ahead and correct these. Object.keys(bugsTypos).forEach(function (d) { if (json.bugs.hasOwnProperty(d)) { - log.warn( "package.json: bugs['" + d + "'] should probably be " - + "bugs['" + bugsTypos[d] + "']", json._id) - } + json.bugs[ bugsTypos[d] ] = json.bugs[d] + delete json.bugs[d] + } }) } @@ -300,6 +359,15 @@ function processObject (opts, cb) { return function (er, json) { 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") + if (!scripts.install && !scripts.preinstall) { + scripts.install = "node-gyp rebuild" + json.scripts = scripts + } + } + // if it has a wscript, then build it. if (opts.wscript && !json.prebuilt) { log.verbose([json.prebuilt, opts], "has wscript") @@ -379,11 +447,9 @@ function processObject (opts, cb) { return function (er, json) { if (opts.dev || npm.config.get("dev") || npm.config.get("npat")) { - // log.warn(json._id, "Adding devdeps") Object.keys(json.devDependencies || {}).forEach(function (d) { json.dependencies[d] = json.devDependencies[d] }) - // log.warn(json.dependencies, "Added devdeps") } typoWarn(json) @@ -409,13 +475,6 @@ function processObject (opts, cb) { return function (er, json) { var depObjectifyWarn = {} function depObjectify (deps, d, id) { - if ((!deps || typeof deps !== "object" || Array.isArray(deps)) - && !depObjectifyWarn[id+d]) { - log.warn( d + " field should be hash of <name>:<version-range> pairs" - , id ) - depObjectifyWarn[id + d] = true - } - if (!deps) return {} if (typeof deps === "string") { deps = deps.trim().split(/[\n\r\s\t ,]+/) diff --git a/deps/npm/lib/utils/set.js b/deps/npm/lib/utils/set.js deleted file mode 100644 index 4d9241aab7..0000000000 --- a/deps/npm/lib/utils/set.js +++ /dev/null @@ -1,25 +0,0 @@ - -module.exports = set -var get = require("./get.js") - , processJson = require("./read-json.js").processJson -function set (obj, key, val) { - for (var i in obj) { - if (i.toLowerCase() === key.toLowerCase()) return obj[i] = val - } - obj[key] = val - if (!val) return - // if it's a package set, then assign all the versions. - if (val.versions) return Object.keys(val.versions).forEach(function (v) { - if (typeof val.versions[v] !== "object") return - set(obj, key+"@"+v, val.versions[v]) - }) - // Note that this doesn't put the dist-tags there, only updates the versions - if (key === val.name+"@"+val.version) { - processJson(val) - var reg = get(obj, val.name) || {} - reg.name = reg._id = val.name - set(obj, val.name, reg) - reg.versions = get(reg, "versions") || {} - if (!get(reg.versions, val.version)) set(reg.versions, val.version, val) - } -} diff --git a/deps/npm/lib/utils/tar.js b/deps/npm/lib/utils/tar.js index f315bbf961..415eb7f9e2 100644 --- a/deps/npm/lib/utils/tar.js +++ b/deps/npm/lib/utils/tar.js @@ -1,115 +1,39 @@ -// XXX lib/cache.js and this file need to be rewritten. - // commands for packing and unpacking tarballs // this file is used by lib/cache.js var npm = require("../npm.js") , fs = require("graceful-fs") - , exec = require("./exec.js") - , find = require("./find.js") - , mkdir = require("./mkdir-p.js") - , asyncMap = require("slide").asyncMap , path = require("path") , log = require("./log.js") - , uidNumber = require("./uid-number.js") + , uidNumber = require("uid-number") , rm = require("rimraf") , readJson = require("./read-json.js") , relativize = require("./relativize.js") , cache = require("../cache.js") - , excludes = require("./excludes.js") , myUid = process.getuid && process.getuid() , myGid = process.getgid && process.getgid() , tar = require("tar") , zlib = require("zlib") , fstream = require("fstream") + , Packer = require("fstream-npm") + +if (process.env.SUDO_UID && myUid === 0) { + if (!isNaN(process.env.SUDO_UID)) myUid = +process.env.SUDO_UID + if (!isNaN(process.env.SUDO_GID)) myGid = +process.env.SUDO_GID +} exports.pack = pack exports.unpack = unpack -exports.makeList = makeList function pack (targetTarball, folder, pkg, dfc, cb) { + log.verbose([targetTarball, folder], "tar.pack") if (typeof cb !== "function") cb = dfc, dfc = true - folder = path.resolve(folder) - - log.verbose(folder, "pack") - - if (typeof pkg === "function") { - cb = pkg, pkg = null - return readJson(path.resolve(folder, "package.json"), function (er, pkg) { - if (er) return log.er(cb, "Couldn't find package.json in "+folder)(er) - pack(targetTarball, folder, pkg, dfc, cb) - }) - } - log.verbose(folder+" "+targetTarball, "pack") - var parent = path.dirname(folder) - , addFolder = path.basename(folder) - - var confEx = npm.config.get("ignore") - log.silly(folder, "makeList") - makeList(folder, pkg, dfc, function (er, files, cleanup) { - if (er) return cb(er) - // log.silly(files, "files") - return packFiles(targetTarball, parent, files, pkg, function (er) { - if (!cleanup || !cleanup.length) return cb(er) - // try to be a good citizen, even/especially in the event of failure. - cleanupResolveLinkDep(cleanup, function (er2) { - if (er || er2) { - if (er) log(er, "packing tarball") - if (er2) log(er2, "while cleaning up resolved deps") - } - return cb(er || er2) - }) - }) - }) -} - -function packFiles (targetTarball, parent, files, pkg, cb_) { - - var p - - files = files.map(function (f) { - p = f.split(/\/|\\/)[0] - return path.resolve(parent, f) - }) - - parent = path.resolve(parent, p) - - var called = false - function cb (er) { - if (called) return - called = true - cb_(er) - } log.verbose(targetTarball, "tarball") - log.verbose(parent, "parent") - fstream.Reader({ type: "Directory" - , path: parent - , filter: function () { - // files should *always* get into tarballs - // in a user-writable state, even if they're - // being installed from some wackey vm-mounted - // read-only filesystem. - this.props.mode = this.props.mode | 0200 - var inc = -1 !== files.indexOf(this.path) + log.verbose(folder, "folder") + new Packer({ path: folder, type: "Directory", isDirectory: true }) + .on("error", log.er(cb, "error reading "+folder)) - // WARNING! Hackety hack! - // XXX Fix this in a better way. - // Rename .gitignore to .npmignore if there is not a - // .npmignore file there already, the better to lock - // down installed packages with git for deployment. - if (this.basename === ".gitignore") { - if (this.parent._entries.indexOf(".npmignore") !== -1) { - return false - } - var d = path.dirname(this.path) - this.basename = ".npmignore" - this.path = path.join(d, ".npmignore") - } - return inc - } - }) - .on("error", log.er(cb, "error reading "+parent)) // By default, npm includes some proprietary attributes in the // package tarball. This is sane, and allowed by the spec. // However, npm *itself* excludes these from its own package, @@ -121,11 +45,14 @@ function packFiles (targetTarball, parent, files, pkg, cb_) { .on("error", log.er(cb, "gzip error "+targetTarball)) .pipe(fstream.Writer({ type: "File", path: targetTarball })) .on("error", log.er(cb, "Could not write "+targetTarball)) - .on("close", cb) + .on("close", function () { + cb() + }) } function unpack (tarball, unpackTarget, dMode, fMode, uid, gid, cb) { + log.verbose(tarball, "unpack") 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 @@ -138,466 +65,139 @@ function unpack (tarball, unpackTarget, dMode, fMode, uid, gid, cb) { } function unpack_ ( tarball, unpackTarget, dMode, fMode, uid, gid, cb ) { - // If the desired target is /path/to/foo, - // then unpack into /path/to/.foo.npm/{something} - // rename that to /path/to/foo, and delete /path/to/.foo.npm var parent = path.dirname(unpackTarget) , base = path.basename(unpackTarget) - , tmp = path.resolve(parent, "___" + base + ".npm") - mkdir(tmp, dMode || npm.modes.exec, uid, gid, function (er) { - log.verbose([uid, gid], "unpack_ uid, gid") - log.verbose(unpackTarget, "unpackTarget") - if (er) return log.er(cb, "Could not create "+tmp)(er) - // cp the gzip of the tarball, pipe the stdout into tar's stdin + rm(unpackTarget, function (er) { + if (er) return cb(er) + // gzip {tarball} --decompress --stdout \ // | tar -mvxpf - --strip-components=1 -C {unpackTarget} - gunzTarPerm( tarball, tmp + gunzTarPerm( tarball, unpackTarget , dMode, fMode , uid, gid , function (er, folder) { if (er) return cb(er) - log.verbose(folder, "gunzed") - - rm(unpackTarget, function (er) { - if (er) return cb(er) - log.verbose(unpackTarget, "rm'ed") - - moveIntoPlace(folder, unpackTarget, function (er) { - if (er) return cb(er) - log.verbose([folder, unpackTarget], "renamed") - // curse you, nfs! It will lie and tell you that the - // mv is done, when in fact, it isn't. In theory, - // reading the file should cause it to wait until it's done. - readJson( path.resolve(unpackTarget, "package.json") - , function (er, data) { - // now we read the json, so we know it's there. - rm(tmp, function (er2) { cb(er || er2, data) }) - }) - }) - }) + readJson(path.resolve(folder, "package.json"), cb) }) }) } -// on Windows, A/V software can lock the directory, causing this -// to fail with an EACCES. Try again on failure, for up to 1 second. -// XXX Fix this by not unpacking into a temp directory, instead just -// renaming things on the way out of the tarball. -function moveIntoPlace (folder, unpackTarget, cb) { - var start = Date.now() - fs.rename(folder, unpackTarget, function CB (er) { - if (er - && process.platform === "win32" - && er.code === "EACCES" - && Date.now() - start < 1000) { - return fs.rename(folder, unpackTarget, CB) - } - cb(er) - }) -} - -function gunzTarPerm (tarball, tmp, 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") - fs.createReadStream(tarball) - .on("error", log.er(cb, "error reading "+tarball)) - .pipe(zlib.Unzip()) - .on("error", log.er(cb, "unzip error "+tarball)) - .pipe(tar.Extract({ type: "Directory", path: tmp })) - .on("error", log.er(cb, "Failed unpacking "+tarball)) - .on("close", afterUntar) - - // - // XXX Do all this in an Extract filter. - // - function afterUntar (er) { - log.silly(er, "afterUntar") - // if we're not doing ownership management, - // then we're done now. - if (er) return log.er(cb, "Failed unpacking "+tarball)(er) - - // HACK skip on windows - if (npm.config.get("unsafe-perm") && process.platform !== "win32") { - uid = process.getuid() - gid = process.getgid() - if (uid === 0) { - if (process.env.SUDO_UID) uid = +process.env.SUDO_UID - if (process.env.SUDO_GID) gid = +process.env.SUDO_GID - } - } - - if (process.platform === "win32") { - return fs.readdir(tmp, function (er, files) { - files = files.filter(function (f) { - return f && f.indexOf("\0") === -1 - }) - cb(er, files && path.resolve(tmp, files[0])) - }) - } - - find(tmp, function (f) { - return f !== tmp - }, function (er, files) { - if (er) return cb(er) - asyncMap(files, function (f, cb) { - f = path.resolve(f) - log.silly(f, "asyncMap in gTP") - fs.lstat(f, function (er, stat) { - - if (er || stat.isSymbolicLink()) return cb(er) - if (typeof uid === "number" && typeof gid === "number") { - fs.chown(f, uid, gid, chown) - } else chown() - - function chown (er) { - if (er) return cb(er) - var mode = stat.isDirectory() ? dMode : fMode - , oldMode = stat.mode & 0777 - , newMode = (oldMode | mode) & (~npm.modes.umask) - if (mode && newMode !== oldMode) { - log.silly(newMode.toString(8), "chmod "+path.basename(f)) - fs.chmod(f, newMode, cb) - } else cb() - } - }) - }, function (er) { - - if (er) return cb(er) - if (typeof myUid === "number" && typeof myGid === "number") { - fs.chown(tmp, myUid, myGid, chown) - } else chown() - - function chown (er) { - if (er) return cb(er) - fs.readdir(tmp, function (er, folder) { - folder = folder && folder.filter(function (f) { - return f && !f.match(/^\._/) - }) - cb(er, folder && path.resolve(tmp, folder[0])) - }) - } - }) - }) + var cbCalled = false + function cb (er) { + if (cbCalled) return + cbCalled = true + cb_(er, target) } -} - -function makeList (dir, pkg, dfc, cb) { - if (typeof cb !== "function") cb = dfc, dfc = true - if (typeof cb !== "function") cb = pkg, pkg = null - dir = path.resolve(dir) - - if (!pkg.path) pkg.path = dir - - var name = path.basename(dir) - - // since this is a top-level traversal, get the user and global - // exclude files, as well as the "ignore" config setting. - var confIgnore = npm.config.get("ignore").trim() - .split(/[\n\r\s\t]+/) - .filter(function (i) { return i.trim() }) - , userIgnore = npm.config.get("userignorefile") - , globalIgnore = npm.config.get("globalignorefile") - , userExclude - , globalExclude - - confIgnore.dir = dir - confIgnore.name = "confIgnore" - - var defIgnore = ["build/"] - defIgnore.dir = dir - - // TODO: only look these up once, and cache outside this function - excludes.parseIgnoreFile( userIgnore, null, dir - , function (er, uex) { - if (er) return cb(er) - userExclude = uex - next() - }) - excludes.parseIgnoreFile( globalIgnore, null, dir - , function (er, gex) { - if (er) return cb(er) - globalExclude = gex - next() - }) + var fst = fs.createReadStream(tarball) - function next () { - if (!globalExclude || !userExclude) return - var exList = [ defIgnore, confIgnore, globalExclude, userExclude ] - - makeList_(dir, pkg, exList, dfc, function (er, files, cleanup) { - if (er) return cb(er) - var dirLen = dir.replace(/(\/|\\)$/, "").length + 1 - log.silly([dir, dirLen], "dir, dirLen") - files = files.map(function (file) { - return path.join(name, file.substr(dirLen)) - }) - return cb(null, files, cleanup) - }) + // figure out who we're supposed to be, if we're not pretending + // to be a specific user. + if (npm.config.get("unsafe-perm") && process.platform !== "win32") { + uid = myUid + gid = myGid } -} - -// Patterns ending in slashes will only match targets -// ending in slashes. To implement this, add a / to -// the filename iff it lstats isDirectory() -function readDir (dir, pkg, dfc, cb) { - fs.readdir(dir, function (er, files) { - if (er) return cb(er) - files = files.filter(function (f) { - return f && f.charAt(0) !== "/" && f.indexOf("\0") === -1 - }) - asyncMap(files, function (file, cb) { - fs.lstat(path.resolve(dir, file), function (er, st) { - if (er) return cb(null, []) - // if it's a directory, then tack "/" onto the name - // so that it can match dir-only patterns in the - // include/exclude logic later. - if (st.isDirectory()) return cb(null, file + "/") - - // if it's a symlink, then we need to do some more - // complex stuff for GH-691 - if (st.isSymbolicLink()) return readSymlink(dir, file, pkg, dfc, cb) - - // otherwise, just let it on through. - return cb(null, file) - }) - }, cb) - }) -} - -// just see where this link is pointing, and resolve relative paths. -function shallowReal (link, cb) { - link = path.resolve(link) - fs.readlink(link, function (er, t) { - if (er) return cb(er) - return cb(null, path.resolve(path.dirname(link), t), t) - }) -} - -function readSymlink (dir, file, pkg, dfc, cb) { - var isNM = dfc - && path.basename(dir) === "node_modules" - && path.dirname(dir) === pkg.path - // see if this thing is pointing outside of the package. - // external symlinks are resolved for deps, ignored for other things. - // internal symlinks are allowed through. - var df = path.resolve(dir, file) - shallowReal(df, function (er, r, target) { - if (er) return cb(null, []) // wtf? exclude file. - if (r.indexOf(dir) === 0) return cb(null, file) // internal - if (!isNM) return cb(null, []) // external non-dep - // now the fun stuff! - fs.realpath(df, function (er, resolved) { - if (er) return cb(null, []) // can't add it. - readJson(path.resolve(resolved, "package.json"), function (er) { - if (er) return cb(null, []) // not a package - resolveLinkDep(dir, file, resolved, target, pkg, function (er, f, c) { - cb(er, f, c) - }) - }) - }) - }) -} - -// put the link back the way it was. -function cleanupResolveLinkDep (cleanup, cb) { - // cut it out of the list, so that cycles will be broken. - if (!cleanup) return cb() - asyncMap(cleanup, function (d, cb) { - rm(d[1], function (er) { - if (er) return cb(er) - fs.symlink(d[0], d[1], cb) - }) - }, cb) -} - -function resolveLinkDep (dir, file, resolved, target, pkg, cb) { - // we've already decided that this is a dep that will be bundled. - // make sure the data reflects this. - var bd = pkg.bundleDependencies || pkg.bundledDependencies || [] - delete pkg.bundledDependencies - pkg.bundleDependencies = bd - var f = path.resolve(dir, file) - , cleanup = [[target, f, resolved]] + function extractEntry (entry) { + log.silly(entry.path, "extracting entry") + // 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 + entry.mode = entry.mode | (entry.type === "Directory" ? dMode : fMode) + 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") + } - if (bd.indexOf(file) === -1) { - // then we don't do this one. - // just move the symlink out of the way. - return rm(f, function (er) { - cb(er, file, cleanup) - }) + // if there's a specific owner uid/gid that we want, then set that + if (process.platform !== "win32" && + typeof uid === "number" && + typeof gid === "number") { + entry.props.uid = entry.uid = uid + entry.props.gid = entry.gid = gid + } } - rm(f, function (er) { - if (er) return cb(er) - cache.add(resolved, function (er, data) { - if (er) return cb(er) - cache.unpack(data.name, data.version, f, function (er, data) { - if (er) return cb(er) - // now clear out the cache entry, since it's weird, probably. - // pass the cleanup object along so that the thing getting the - // list of files knows what to clean up afterwards. - cache.clean([data._id], function (er) { cb(er, file, cleanup) }) - }) - }) - }) -} - -// exList is a list of ignore lists. -// Each exList item is an array of patterns of files to ignore -// -function makeList_ (dir, pkg, exList, dfc, cb) { - var files = null - , cleanup = null + var extractOpts = { type: "Directory", path: target, strip: 1 } - readDir(dir, pkg, dfc, function (er, f, c) { - if (er) return cb(er) - cleanup = c - files = f.map(function (f) { - // no nulls in paths! - return f.split(/\0/)[0] - }).filter(function (f) { - // always remove all source control folders and - // waf/vim/OSX garbage. this is a firm requirement. - return !( f === ".git/" - || f === ".lock-wscript" - || f === "CVS/" - || f === ".svn/" - || f === ".hg/" - || f.match(/^\..*\.swp/) - || f === ".DS_Store" - || f.match(/^\._/) - || f === "npm-debug.log" - || f === "" - || f.charAt(0) === "/" - ) - }) - - // if (files.length > 0) files.push(".") - - if (files.indexOf("package.json") !== -1 && dir !== pkg.path) { - // a package.json file starts the whole exclude/include - // logic all over. Otherwise, a parent could break its - // deps with its files list or .npmignore file. - readJson(path.resolve(dir, "package.json"), function (er, data) { - if (!er && typeof data === "object") { - data.path = dir - return makeList(dir, data, dfc, function (er, files) { - // these need to be mounted onto the directory now. - cb(er, files && files.map(function (f) { - return path.resolve(path.dirname(dir), f) - })) - }) - } - next() - }) - //next() - } else next() + if (process.platform !== "win32" && + typeof uid === "number" && + typeof gid === "number") { + extractOpts.uid = uid + extractOpts.gid = gid + } - // add a local ignore file, if found. - if (files.indexOf(".npmignore") === -1 - && files.indexOf(".gitignore") === -1) next() - else { - excludes.addIgnoreFile( path.resolve(dir, ".npmignore") - , ".gitignore" - , exList - , dir - , function (er, list) { - if (!er) exList = list - next(er) - }) + 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") + return false } - }) + return true + } - var n = 2 - , errState = null - function next (er) { - if (errState) return - if (er) return cb(errState = er, [], cleanup) - if (-- n > 0) return - if (!pkg) return cb(new Error("No package.json file in "+dir)) - if (pkg.path === dir && pkg.files) { - pkg.files = pkg.files.filter(function (f) { - f = f.trim() - return f && f.charAt(0) !== "#" - }) - if (!pkg.files.length) pkg.files = null - } - if (pkg.path === dir && pkg.files) { - // stuff on the files list MUST be there. - // ignore everything, then include the stuff on the files list. - var pkgFiles = ["*"].concat(pkg.files.map(function (f) { - return "!" + f - })) - pkgFiles.dir = dir - pkgFiles.packageFiles = true - exList.push(pkgFiles) - } - - if (path.basename(dir) === "node_modules" - && pkg.path === path.dirname(dir) - && dfc) { // do fancy crap - files = filterNodeModules(files, pkg) + fst.on("error", log.er(cb, "error reading "+tarball)) + fst.on("data", function OD (c) { + // detect what it is. + // Then, depending on that, we'll figure out whether it's + // a single-file module, gzipped tarball, or naked tarball. + // gzipped files all start with 1f8b08 + if (c[0] === 0x1F && + c[1] === 0x8B && + c[2] === 0x08) { + fst + .pipe(zlib.Unzip()) + .on("error", log.er(cb, "unzip error "+tarball)) + .pipe(tar.Extract(extractOpts)) + .on("entry", extractEntry) + .on("error", log.er(cb, "untar error "+tarball)) + .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("close", cb) } else { - // If a directory is excluded, we still need to be - // able to *include* a file within it, and have that override - // the prior exclusion. - // - // This whole makeList thing probably needs to be rewritten - files = files.filter(function (f) { - return excludes.filter(dir, exList)(f) || f.slice(-1) === "/" - }) - } - - - asyncMap(files, function (file, cb) { - // if this is a dir, then dive into it. - // otherwise, don't. - file = path.resolve(dir, file) - - // in 0.6.0, fs.readdir can produce some really odd results. - // XXX: remove this and make the engines hash exclude 0.6.0 - if (file.indexOf(dir) !== 0) { - return cb(null, []) + // naked js file + var jsOpts = { path: path.resolve(target, "index.js") } + + if (process.platform !== "win32" && + typeof uid === "number" && + typeof gid === "number") { + jsOpts.uid = uid + jsOpts.gid = gid } - fs.lstat(file, function (er, st) { - if (er) return cb(er) - if (st.isDirectory()) { - return makeList_(file, pkg, exList, dfc, cb) - } - return cb(null, file) - }) - }, function (er, files, c) { - if (c) cleanup = (cleanup || []).concat(c) - if (files.length > 0) files.push(dir) - return cb(er, files, cleanup) - }) - } -} - -// only include node_modules folder that are: -// 1. not on the dependencies list or -// 2. on the "bundleDependencies" list. -function filterNodeModules (files, pkg) { - var bd = pkg.bundleDependencies || pkg.bundledDependencies || [] - , deps = Object.keys(pkg.dependencies || {}) - .filter(function (key) { return !pkg.dependencies[key].extraneous }) - .concat(Object.keys(pkg.devDependencies || {})) - - delete pkg.bundledDependencies - pkg.bundleDependencies = bd + fst + .pipe(fstream.Writer(jsOpts)) + .on("error", log.er(cb, "copy error "+tarball)) + .on("close", function () { + var j = path.resolve(target, "package.json") + readJson(j, function (er, d) { + if (er) { + log.error(tarball, "Not a package") + return cb(er) + } + fs.writeFile(j, JSON.stringify(d) + "\n", cb) + }) + }) + } - return files.filter(function (f) { - f = f.replace(/\/$/, "") - return f.charAt(0) !== "." - && f.charAt(0) !== "_" - && bd.indexOf(f) !== -1 + // now un-hook, and re-emit the chunk + fst.removeListener("data", OD) + fst.emit("data", c) }) } diff --git a/deps/npm/lib/utils/uid-number.js b/deps/npm/lib/utils/uid-number.js deleted file mode 100644 index 3756275534..0000000000 --- a/deps/npm/lib/utils/uid-number.js +++ /dev/null @@ -1,55 +0,0 @@ -module.exports = uidNumber - -// This module calls into bin/npm-get-uid-gid.js, which sets the -// uid and gid to the supplied argument, in order to find out their -// numeric value. This can't be done in the main node process, -// because otherwise npm would be running as that user. - -var exec = require("./exec.js") - , path = require("path") - , log = require("./log.js") - , constants = require("constants") - , npm = require("../npm.js") - , uidSupport = process.getuid && process.setuid - , uidCache = {} - , gidCache = {} - -function uidNumber (uid, gid, cb) { - if (!uidSupport || npm.config.get("unsafe-perm")) return cb() - if (typeof cb !== "function") cb = gid, gid = null - if (typeof cb !== "function") cb = uid, uid = null - if (gid == null) gid = process.getgid() - if (uid == null) uid = process.getuid() - if (!isNaN(gid)) gid = +gid - if (!isNaN(uid)) uid = +uid - - if (uidCache[uid]) uid = uidCache[uid] - if (gidCache[gid]) gid = gidCache[gid] - - if (typeof gid === "number" && typeof uid === "number") { - return cb(null, uid, gid) - } - - var getter = path.join(__dirname, "..", "..", "bin", "npm-get-uid-gid.js") - return exec( process.execPath, [getter, uid, gid], process.env, false - , null, process.getuid(), process.getgid() - , function (er, code, out, err) { - if (er) return log.er(cb, "Could not get uid/gid "+err)(er) - log.silly(out, "output from getuid/gid") - out = JSON.parse(out+"") - if (out.error) { - if (!npm.config.get("unsafe-perm")) { - var er = new Error(out.error) - er.errno = out.errno - return cb(er) - } else { - return cb(null, +process.getuid(), +process.getgid()) - } - } - if (isNaN(out.uid) || isNaN(out.gid)) return cb(new Error( - "Could not get uid/gid: "+JSON.stringify(out))) - uidCache[uid] = out.uid - uidCache[gid] = out.gid - cb(null, out.uid, out.gid) - }) -} diff --git a/deps/npm/lib/version.js b/deps/npm/lib/version.js index f13d9e1b2e..febb56d730 100644 --- a/deps/npm/lib/version.js +++ b/deps/npm/lib/version.js @@ -63,6 +63,6 @@ function checkGit (data, cb) { } function write (data, cb) { fs.writeFile( path.join(process.cwd(), "package.json") - , new Buffer(JSON.stringify(data, null, 2)) + , new Buffer(JSON.stringify(data, null, 2) + "\n") , cb ) } diff --git a/deps/npm/lib/view.js b/deps/npm/lib/view.js index 3e39f76de9..33a5d0df80 100644 --- a/deps/npm/lib/view.js +++ b/deps/npm/lib/view.js @@ -70,6 +70,7 @@ function view (args, silent, cb) { data.versions = Object.keys(data.versions).sort(semver.compare) if (!args.length) args = [""] + // remove readme unless we asked for it if (-1 === args.indexOf("readme")) { delete data.readme } @@ -81,6 +82,10 @@ function view (args, silent, cb) { delete versions[v] } if (semver.satisfies(v, version)) args.forEach(function (args) { + // remove readme unless we asked for it + if (-1 === args.indexOf("readme")) { + delete versions[v].readme + } results.push(showFields(data, versions[v], args)) }) }) diff --git a/deps/npm/man/man1/README.1 b/deps/npm/man/man1/README.1 index a6c6243e17..eaf6a41b84 100644 --- a/deps/npm/man/man1/README.1 +++ b/deps/npm/man/man1/README.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM" "1" "January 2012" "" "" +.TH "NPM" "1" "May 2012" "" "" . .SH "NAME" \fBnpm\fR \-\- node package manager diff --git a/deps/npm/man/man1/adduser.1 b/deps/npm/man/man1/adduser.1 index 301c95a3e0..63080da11e 100644 --- a/deps/npm/man/man1/adduser.1 +++ b/deps/npm/man/man1/adduser.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-ADDUSER" "1" "January 2012" "" "" +.TH "NPM\-ADDUSER" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-adduser\fR \-\- Add a registry user account diff --git a/deps/npm/man/man1/bin.1 b/deps/npm/man/man1/bin.1 index 6c3ff4a89e..ccb802aa35 100644 --- a/deps/npm/man/man1/bin.1 +++ b/deps/npm/man/man1/bin.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-BIN" "1" "January 2012" "" "" +.TH "NPM\-BIN" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-bin\fR \-\- Display npm bin folder diff --git a/deps/npm/man/man1/bugs.1 b/deps/npm/man/man1/bugs.1 index 55aeeb7efc..1666c6437c 100644 --- a/deps/npm/man/man1/bugs.1 +++ b/deps/npm/man/man1/bugs.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-BUGS" "1" "January 2012" "" "" +.TH "NPM\-BUGS" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-bugs\fR \-\- Bugs for a package in a web browser maybe diff --git a/deps/npm/man/man1/build.1 b/deps/npm/man/man1/build.1 index 9c2d7bb18d..1ddab40cb3 100644 --- a/deps/npm/man/man1/build.1 +++ b/deps/npm/man/man1/build.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-BUILD" "1" "January 2012" "" "" +.TH "NPM\-BUILD" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-build\fR \-\- Build a package diff --git a/deps/npm/man/man1/bundle.1 b/deps/npm/man/man1/bundle.1 index 9a97ce95c5..5b5e4d2bf4 100644 --- a/deps/npm/man/man1/bundle.1 +++ b/deps/npm/man/man1/bundle.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-BUNDLE" "1" "January 2012" "" "" +.TH "NPM\-BUNDLE" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-bundle\fR \-\- REMOVED diff --git a/deps/npm/man/man1/cache.1 b/deps/npm/man/man1/cache.1 index f4df1fa4b7..6b828e7f22 100644 --- a/deps/npm/man/man1/cache.1 +++ b/deps/npm/man/man1/cache.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-CACHE" "1" "January 2012" "" "" +.TH "NPM\-CACHE" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-cache\fR \-\- Manipulates packages cache diff --git a/deps/npm/man/man1/changelog.1 b/deps/npm/man/man1/changelog.1 index a2112c8698..6cc8ff0c22 100644 --- a/deps/npm/man/man1/changelog.1 +++ b/deps/npm/man/man1/changelog.1 @@ -1,13 +1,95 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-CHANGELOG" "1" "January 2012" "" "" +.TH "NPM\-CHANGELOG" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-changelog\fR \-\- Changes . .SH "HISTORY" . +.SS "1\.1\.3, 1\.1\.4" +. +.IP "\(bu" 4 +Update request to support HTTPS\-over\-HTTP proxy tunneling +. +.IP "\(bu" 4 +Throw on undefined envs in config settings +. +.IP "\(bu" 4 +Update which to 1\.0\.5 +. +.IP "\(bu" 4 +Fix windows UNC busyloop in findPrefix +. +.IP "\(bu" 4 +Bundle nested bundleDependencies properly +. +.IP "\(bu" 4 +Alias adduser to add\-user +. +.IP "\(bu" 4 +Doc updates (Christian Howe, Henrik Hodne, Andrew Lunny) +. +.IP "\(bu" 4 +ignore logfd/outfd streams in makeEnv() (Rod Vagg) +. +.IP "\(bu" 4 +shrinkwrap: Behave properly with url\-installed deps +. +.IP "\(bu" 4 +install: Support \-\-save with url install targets +. +.IP "\(bu" 4 +Support installing naked tars or single\-file modules from urls etc\. +. +.IP "\(bu" 4 +init: Don\'t add engines section +. +.IP "\(bu" 4 +Don\'t run make clean on rebuild +. +.IP "\(bu" 4 +Added missing unicode replacement (atomizer) +. +.IP "" 0 +. +.SS "1\.1\.2" +Dave Pacheco (2): + add "npm shrinkwrap" +. +.P +Martin Cooper (1): + Fix #1753 Make a copy of the cached objects we\'ll modify\. +. +.P +Tim Oxley (1): + correctly remove readme from default npm view command\. +. +.P +Tyler Green (1): + fix #2187 set terminal columns to Infinity if 0 +. +.P +isaacs (19): + update minimatch + update request + Experimental: single\-file modules + Fix #2172 Don\'t remove global mans uninstalling local pkgs + Add \-\-versions flag to show the version of node as well + Support \-\-json flag for ls output + update request to 2\.9\.151 +. +.SS "1\.1" +. +.IP "\(bu" 4 +Replace system tar dependency with a JS tar +. +.IP "\(bu" 4 +Continue to refine +. +.IP "" 0 +. .SS "1\.0" . .IP "\(bu" 4 diff --git a/deps/npm/man/man1/coding-style.1 b/deps/npm/man/man1/coding-style.1 index 2f63d8c005..cb0f5abd21 100644 --- a/deps/npm/man/man1/coding-style.1 +++ b/deps/npm/man/man1/coding-style.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-CODING\-STYLE" "1" "January 2012" "" "" +.TH "NPM\-CODING\-STYLE" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-coding-style\fR \-\- npm\'s "funny" coding style @@ -99,10 +99,10 @@ null loops like: \fBwhile (something) ;\fR (But you\'d better have a good reason for doing that\.) . .IP "\(bu" 4 -case "foo": doSomething(); break +\fBcase "foo": doSomething(); break\fR . .IP "\(bu" 4 -In front of a leading ( or [ at the start of the line\. +In front of a leading \fB(\fR or \fB[\fR at the start of the line\. This prevents the expression from being interpreted as a function call or property access, respectively\. . diff --git a/deps/npm/man/man1/completion.1 b/deps/npm/man/man1/completion.1 index db423418c4..c593694faf 100644 --- a/deps/npm/man/man1/completion.1 +++ b/deps/npm/man/man1/completion.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-COMPLETION" "1" "January 2012" "" "" +.TH "NPM\-COMPLETION" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-completion\fR \-\- Tab Completion for npm diff --git a/deps/npm/man/man1/config.1 b/deps/npm/man/man1/config.1 index 2e38c0f6f1..1407b2b724 100644 --- a/deps/npm/man/man1/config.1 +++ b/deps/npm/man/man1/config.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-CONFIG" "1" "January 2012" "" "" +.TH "NPM\-CONFIG" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-config\fR \-\- Manage the npm configuration file @@ -171,6 +171,12 @@ The following shorthands are parsed on the command\-line: \fB\-S\fR: \fB\-\-save\fR . .IP "\(bu" 4 +\fB\-D\fR: \fB\-\-save\-dev\fR +. +.IP "\(bu" 4 +\fB\-O\fR: \fB\-\-save\-optional\fR +. +.IP "\(bu" 4 \fB\-y\fR: \fB\-\-yes\fR . .IP "\(bu" 4 @@ -357,6 +363,42 @@ Type: path .P The location of npm\'s cache directory\. See \fBnpm help cache\fR . +.SS "cache\-max" +. +.IP "\(bu" 4 +Default: Infinity +. +.IP "\(bu" 4 +Type: Number +. +.IP "" 0 +. +.P +The maximum time (in seconds) to keep items in the registry cache before +re\-checking against the registry\. +. +.P +Note that no purging is done unless the \fBnpm cache clean\fR command is +explicitly used, and that only GET requests use the cache\. +. +.SS "cache\-min" +. +.IP "\(bu" 4 +Default: 0 +. +.IP "\(bu" 4 +Type: Number +. +.IP "" 0 +. +.P +The minimum time (in seconds) to keep items in the registry cache before +re\-checking against the registry\. +. +.P +Note that no purging is done unless the \fBnpm cache clean\fR command is +explicitly used, and that only GET requests use the cache\. +. .SS "color" . .IP "\(bu" 4 @@ -567,6 +609,19 @@ Type: url .P A proxy to use for outgoing https requests\. . +.SS "user\-agent" +. +.IP "\(bu" 4 +Default: npm/{npm\.version} node/{process\.version} +. +.IP "\(bu" 4 +Type: String +. +.IP "" 0 +. +.P +Sets a User\-Agent to the request header +. .SS "ignore" . .IP "\(bu" 4 @@ -597,7 +652,7 @@ The value \fBnpm init\fR should use by default for the package version\. .SS "init\.author\.name" . .IP "\(bu" 4 -Default: "0\.0\.0" +Default: "" . .IP "\(bu" 4 Type: String @@ -633,6 +688,24 @@ Type: String .P The value \fBnpm init\fR should use by default for the package author\'s homepage\. . +.SS "json" +. +.IP "\(bu" 4 +Default: false +. +.IP "\(bu" 4 +Type: Boolean +. +.IP "" 0 +. +.P +Whether or not to output JSON data, rather than the normal output\. +. +.P +This feature is currently experimental, and the output data structures +for many commands is either not implemented in JSON yet, or subject to +change\. Only the output from \fBnpm ls \-\-json\fR is currently valid\. +. .SS "link" . .IP "\(bu" 4 @@ -940,6 +1013,38 @@ Save installed packages to a package\.json file as dependencies\. .P Only works if there is already a package\.json file present\. . +.SS "save\-dev" +. +.IP "\(bu" 4 +Default: false +. +.IP "\(bu" 4 +Type: Boolean +. +.IP "" 0 +. +.P +Save installed packages to a package\.json file as devDependencies\. +. +.P +Only works if there is already a package\.json file present\. +. +.SS "save\-optional" +. +.IP "\(bu" 4 +Default: false +. +.IP "\(bu" 4 +Type: Boolean +. +.IP "" 0 +. +.P +Save installed packages to a package\.json file as optionalDependencies\. +. +.P +Only works if there is already a package\.json file present\. +. .SS "searchopts" . .IP "\(bu" 4 @@ -1181,6 +1286,23 @@ If true, output the npm version and exit successfully\. .P Only relevant when specified explicitly on the command line\. . +.SS "versions" +. +.IP "\(bu" 4 +Default: false +. +.IP "\(bu" 4 +Type: boolean +. +.IP "" 0 +. +.P +If true, output the npm version as well as node\'s \fBprocess\.versions\fR +hash, and exit successfully\. +. +.P +Only relevant when specified explicitly on the command line\. +. .SS "viewer" . .IP "\(bu" 4 diff --git a/deps/npm/man/man1/deprecate.1 b/deps/npm/man/man1/deprecate.1 index f0ba00bd2b..08999d714e 100644 --- a/deps/npm/man/man1/deprecate.1 +++ b/deps/npm/man/man1/deprecate.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-DEPRECATE" "1" "January 2012" "" "" +.TH "NPM\-DEPRECATE" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-deprecate\fR \-\- Deprecate a version of a package diff --git a/deps/npm/man/man1/developers.1 b/deps/npm/man/man1/developers.1 index 61e16edb6a..669e7a40be 100644 --- a/deps/npm/man/man1/developers.1 +++ b/deps/npm/man/man1/developers.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-DEVELOPERS" "1" "January 2012" "" "" +.TH "NPM\-DEVELOPERS" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-developers\fR \-\- Developer Guide @@ -43,6 +43,9 @@ e) a \fB<name>@<tag>\fR that points to (d) .IP "\(bu" 4 f) a \fB<name>\fR that has a "latest" tag satisfying (e) . +.IP "\(bu" 4 +g) a \fBgit\fR url that, when cloned, results in (a)\. +. .IP "" 0 . .P @@ -51,6 +54,25 @@ benefits of using npm if you just want to write a node program (a), and perhaps if you also want to be able to easily install it elsewhere after packing it up into a tarball (b)\. . +.P +Git urls can be of the form: +. +.IP "" 4 +. +.nf +git://github\.com/user/project\.git#commit\-ish +git+ssh://user@hostname:project\.git#commit\-ish +git+http://user@hostname/project/blah\.git#commit\-ish +git+https://user@hostname/project/blah\.git#commit\-ish +. +.fi +. +.IP "" 0 +. +.P +The \fBcommit\-ish\fR can be any tag, sha, or branch which can be supplied as +an argument to \fBgit checkout\fR\|\. The default is \fBmaster\fR\|\. +. .SH "The package\.json File" You need to have a \fBpackage\.json\fR file in the root of your project to do much of anything with npm\. That is basically the whole interface\. diff --git a/deps/npm/man/man1/disputes.1 b/deps/npm/man/man1/disputes.1 index df52c52453..e92893ac83 100644 --- a/deps/npm/man/man1/disputes.1 +++ b/deps/npm/man/man1/disputes.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-DISPUTES" "1" "January 2012" "" "" +.TH "NPM\-DISPUTES" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-disputes\fR \-\- Handling Module Name Disputes diff --git a/deps/npm/man/man1/docs.1 b/deps/npm/man/man1/docs.1 index 7432cadde3..57bbf61fdc 100644 --- a/deps/npm/man/man1/docs.1 +++ b/deps/npm/man/man1/docs.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-DOCS" "1" "January 2012" "" "" +.TH "NPM\-DOCS" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-docs\fR \-\- Docs for a package in a web browser maybe diff --git a/deps/npm/man/man1/edit.1 b/deps/npm/man/man1/edit.1 index 56cffbb607..0c6db9d33d 100644 --- a/deps/npm/man/man1/edit.1 +++ b/deps/npm/man/man1/edit.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-EDIT" "1" "January 2012" "" "" +.TH "NPM\-EDIT" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-edit\fR \-\- Edit an installed package diff --git a/deps/npm/man/man1/explore.1 b/deps/npm/man/man1/explore.1 index 06be08b6d4..e6b5561ea7 100644 --- a/deps/npm/man/man1/explore.1 +++ b/deps/npm/man/man1/explore.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-EXPLORE" "1" "January 2012" "" "" +.TH "NPM\-EXPLORE" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-explore\fR \-\- Browse an installed package diff --git a/deps/npm/man/man1/faq.1 b/deps/npm/man/man1/faq.1 index 0f8857ab10..1342f06d08 100644 --- a/deps/npm/man/man1/faq.1 +++ b/deps/npm/man/man1/faq.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-FAQ" "1" "January 2012" "" "" +.TH "NPM\-FAQ" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-faq\fR \-\- Frequently Asked Questions diff --git a/deps/npm/man/man1/folders.1 b/deps/npm/man/man1/folders.1 index 394f72d5cb..b4d5d29e2d 100644 --- a/deps/npm/man/man1/folders.1 +++ b/deps/npm/man/man1/folders.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-FOLDERS" "1" "January 2012" "" "" +.TH "NPM\-FOLDERS" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-folders\fR \-\- Folder Structures Used by npm diff --git a/deps/npm/man/man1/help-search.1 b/deps/npm/man/man1/help-search.1 index b2959ab0e1..c09538600c 100644 --- a/deps/npm/man/man1/help-search.1 +++ b/deps/npm/man/man1/help-search.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-HELP\-SEARCH" "1" "January 2012" "" "" +.TH "NPM\-HELP\-SEARCH" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-help-search\fR \-\- Search npm help documentation diff --git a/deps/npm/man/man1/help.1 b/deps/npm/man/man1/help.1 index 5032a59f0b..b587216789 100644 --- a/deps/npm/man/man1/help.1 +++ b/deps/npm/man/man1/help.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-HELP" "1" "January 2012" "" "" +.TH "NPM\-HELP" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-help\fR \-\- Get help on npm diff --git a/deps/npm/man/man1/index.1 b/deps/npm/man/man1/index.1 index 43265769c3..4b3c55ae11 100644 --- a/deps/npm/man/man1/index.1 +++ b/deps/npm/man/man1/index.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-INDEX" "1" "January 2012" "" "" +.TH "NPM\-INDEX" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-index\fR \-\- Index of all npm documentation @@ -132,6 +132,9 @@ .SH "npm help semver" The semantic versioner for npm . +.SH "npm help shrinkwrap" + Lock down dependency versions +. .SH "npm help star" Mark your favorite packages . @@ -246,6 +249,9 @@ .SH "npm apihelp search" Search for packages . +.SH "npm apihelp shrinkwrap" + programmatically generate package shrinkwrap file +. .SH "npm apihelp start" Start a package . diff --git a/deps/npm/man/man1/init.1 b/deps/npm/man/man1/init.1 index 1ab75cbcc0..71690aa16c 100644 --- a/deps/npm/man/man1/init.1 +++ b/deps/npm/man/man1/init.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-INIT" "1" "January 2012" "" "" +.TH "NPM\-INIT" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-init\fR \-\- Interactively create a package\.json file diff --git a/deps/npm/man/man1/install.1 b/deps/npm/man/man1/install.1 index 651ee17307..9ab56a4a8e 100644 --- a/deps/npm/man/man1/install.1 +++ b/deps/npm/man/man1/install.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-INSTALL" "1" "January 2012" "" "" +.TH "NPM\-INSTALL" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-install\fR \-\- Install a package @@ -13,15 +13,18 @@ npm install (with no args in a package dir) npm install <tarball file> npm install <tarball url> npm install <folder> -npm install <name> +npm install <name> [\-\-save|\-\-save\-dev|\-\-save\-optional] npm install <name>@<tag> npm install <name>@<version> npm install <name>@<version range> +npm install <name>@<version range> . .fi . .SH "DESCRIPTION" -This command installs a package, and any packages that it depends on\. +This command installs a package, and any packages that it depends on\. If the +package has a shrinkwrap file, the installation of dependencies will be driven +by that\. See npm help shrinkwrap\. . .P A \fBpackage\fR is: @@ -57,6 +60,8 @@ after packing it up into a tarball (b)\. . .IP "\(bu" 4 \fBnpm install\fR (in package directory, no arguments): +. +.IP Install the dependencies in the local node_modules folder\. . .IP @@ -66,10 +71,14 @@ directory) as a global package\. . .IP "\(bu" 4 \fBnpm install <folder>\fR: +. +.IP Install a package that is sitting in a folder on the filesystem\. . .IP "\(bu" 4 \fBnpm install <tarball file>\fR: +. +.IP Install a package that is sitting on the filesystem\. Note: if you just want to link a dev directory into your npm root, you can do this more easily by using \fBnpm link\fR\|\. @@ -80,7 +89,7 @@ Example: .IP "" 4 . .nf -npm install \./package\.tgz + npm install \./package\.tgz . .fi . @@ -89,6 +98,8 @@ npm install \./package\.tgz . .IP "\(bu" 4 \fBnpm install <tarball url>\fR: +. +.IP Fetch the tarball url, and then install it\. In order to distinguish between this and other options, the argument must start with "http://" or "https://" . @@ -98,7 +109,7 @@ Example: .IP "" 4 . .nf -npm install https://github\.com/indexzero/forever/tarball/v0\.5\.6 + npm install https://github\.com/indexzero/forever/tarball/v0\.5\.6 . .fi . @@ -106,28 +117,54 @@ npm install https://github\.com/indexzero/forever/tarball/v0\.5\.6 . .IP "\(bu" 4 -\fBnpm install <name>\fR: -Do a \fB<name>@<tag>\fR install, where \fB<tag>\fR is the "tag" config\. (See \fBnpm help config\fR) +\fBnpm install <name> [\-\-save|\-\-save\-dev|\-\-save\-optional]\fR: +. +.IP +Do a \fB<name>@<tag>\fR install, where \fB<tag>\fR is the "tag" config\. (See \fBnpm help config\fR\|\.) +. +.IP +In most cases, this will install the latest version +of the module published on npm\. . .IP Example: . -.IP "" 4 +.IP + npm install sax . -.nf -npm install sax +.IP +\fBnpm install\fR takes 3 exclusive, optional flags which save or update +the package version in your main package\.json: . -.fi +.IP "\(bu" 4 +\fB\-\-save\fR: Package will appear in your \fBdependencies\fR\|\. . -.IP "" 0 +.IP "\(bu" 4 +\fB\-\-save\-dev\fR: Package will appear in your \fBdevDependencies\fR\|\. +. +.IP "\(bu" 4 +\fB\-\-save\-optional\fR: Package will appear in your \fBoptionalDependencies\fR\|\. +. +.IP +Examples: +. +.IP + npm install sax \-\-save + npm install node\-tap \-\-save\-dev + npm install dtrace\-provider \-\-save\-optional . .IP \fBNote\fR: If there is a file or folder named \fB<name>\fR in the current working directory, then it will try to install that, and only try to fetch the package by name if it is not valid\. . +.IP "" 0 + +. .IP "\(bu" 4 \fBnpm install <name>@<tag>\fR: +. +.IP Install the version of the package that is referenced by the specified tag\. If the tag does not exist in the registry data for that package, then this will fail\. @@ -138,7 +175,7 @@ Example: .IP "" 4 . .nf -npm install sax@latest + npm install sax@latest . .fi . @@ -147,6 +184,8 @@ npm install sax@latest . .IP "\(bu" 4 \fBnpm install <name>@<version>\fR: +. +.IP Install the specified version of the package\. This will fail if the version has not been published to the registry\. . @@ -156,7 +195,7 @@ Example: .IP "" 4 . .nf -npm install sax@0\.1\.1 + npm install sax@0\.1\.1 . .fi . @@ -165,6 +204,8 @@ npm install sax@0\.1\.1 . .IP "\(bu" 4 \fBnpm install <name>@<version range>\fR: +. +.IP Install a version of the package matching the specified version range\. This will follow the same rules for resolving dependencies described in \fBnpm help json\fR\|\. . @@ -175,15 +216,8 @@ treat it as a single argument\. .IP Example: . -.IP "" 4 -. -.nf -npm install sax@">=0\.1\.0 <0\.2\.0" -. -.fi -. -.IP "" 0 - +.IP + npm install sax@">=0\.1\.0 <0\.2\.0" . .IP "\(bu" 4 \fBnpm install <git remote url>\fR: @@ -192,14 +226,8 @@ npm install sax@">=0\.1\.0 <0\.2\.0" Install a package by cloning a git remote url\. The format of the git url is: . -.IP "" 4 -. -.nf -<protocol>://[<user>@]<hostname><separator><path>[#<commit\-ish>] -. -.fi -. -.IP "" 0 +.IP + <protocol>://[<user>@]<hostname><separator><path>[#<commit\-ish>] . .IP \fB<protocol>\fR is one of \fBgit\fR, \fBgit+ssh\fR, \fBgit+http\fR, or \fBgit+https\fR\|\. If no \fB<commit\-ish>\fR is specified, then \fBmaster\fR is @@ -211,9 +239,9 @@ Examples: .IP "" 4 . .nf -git+ssh://git@github\.com:isaacs/npm\.git#v1\.0\.27 -git+https://isaacs@github\.com/isaacs/npm\.git -git://github\.com/isaacs/npm\.git#v1\.0\.27 + git+ssh://git@github\.com:isaacs/npm\.git#v1\.0\.27 + git+https://isaacs@github\.com/isaacs/npm\.git + git://github\.com/isaacs/npm\.git#v1\.0\.27 . .fi . @@ -370,5 +398,8 @@ npm help tag .IP "\(bu" 4 npm help rm . +.IP "\(bu" 4 +npm help shrinkwrap +. .IP "" 0 diff --git a/deps/npm/man/man1/json.1 b/deps/npm/man/man1/json.1 index 73087c042c..25690428df 100644 --- a/deps/npm/man/man1/json.1 +++ b/deps/npm/man/man1/json.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-JSON" "1" "January 2012" "" "" +.TH "NPM\-JSON" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-json\fR \-\- Specifics of npm\'s package\.json handling @@ -466,6 +466,9 @@ is a semver compatible version identifier\. .IP "\(bu" 4 \fBrange1 || range2\fR Passes if either range1 or range2 are satisfied\. . +.IP "\(bu" 4 +\fBgit\.\.\.\fR See \'Git URLs as Dependencies\' below +. .IP "" 0 . .P @@ -554,6 +557,25 @@ of a version range\. This tarball will be downloaded and installed locally to your package at install time\. . +.SS "Git URLs as Dependencies" +Git urls can be of the form: +. +.IP "" 4 +. +.nf +git://github\.com/user/project\.git#commit\-ish +git+ssh://user@hostname:project\.git#commit\-ish +git+http://user@hostname/project/blah\.git#commit\-ish +git+https://user@hostname/project/blah\.git#commit\-ish +. +.fi +. +.IP "" 0 +. +.P +The \fBcommit\-ish\fR can be any tag, sha, or branch which can be supplied as +an argument to \fBgit checkout\fR\|\. The default is \fBmaster\fR\|\. +. .SH "devDependencies" If someone is planning on downloading and using your module in their program, then they probably don\'t want or need to download and build @@ -609,6 +631,67 @@ are capable of properly installing your program\. For example: . .IP "" 0 . +.SH "os" +You can specify which operating systems your +module will run on: +. +.IP "" 4 +. +.nf +"os" : [ "darwin", "linux" ] +. +.fi +. +.IP "" 0 +. +.P +You can also blacklist instead of whitelist operating systems, +just prepend the blacklisted os with a \'!\': +. +.IP "" 4 +. +.nf +"os" : [ "!win32" ] +. +.fi +. +.IP "" 0 +. +.P +The host operating system is determined by \fBprocess\.platform\fR +. +.P +It is allowed to both blacklist, and whitelist, although there isn\'t any +good reason to do this\. +. +.SH "cpu" +If your code only runs on certain cpu architectures, +you can specify which ones\. +. +.IP "" 4 +. +.nf +"cpu" : [ "x64", "ia32" ] +. +.fi +. +.IP "" 0 +. +.P +Like the \fBos\fR option, you can also blacklist architectures: +. +.IP "" 4 +. +.nf +"cpu" : [ "!arm", "!mips" ] +. +.fi +. +.IP "" 0 +. +.P +The host architecture is determined by \fBprocess\.arch\fR +. .SH "preferGlobal" If your package is primarily a command\-line application that should be installed globally, then set this value to \fBtrue\fR to provide a warning @@ -625,7 +708,7 @@ to publish it\. .P This is a way to prevent accidental publication of private repositories\. If you would like to ensure that a given package is only ever published -to a speciic registry (for example, an internal registry), +to a specific registry (for example, an internal registry), then use the \fBpublishConfig\fR hash described below to override the \fBregistry\fR config param at publish\-time\. . diff --git a/deps/npm/man/man1/link.1 b/deps/npm/man/man1/link.1 index 83d73a55dc..5f65c87140 100644 --- a/deps/npm/man/man1/link.1 +++ b/deps/npm/man/man1/link.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-LINK" "1" "January 2012" "" "" +.TH "NPM\-LINK" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-link\fR \-\- Symlink a package folder diff --git a/deps/npm/man/man1/list.1 b/deps/npm/man/man1/list.1 index 95c6362388..763af1e27d 100644 --- a/deps/npm/man/man1/list.1 +++ b/deps/npm/man/man1/list.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-LS" "1" "January 2012" "" "" +.TH "NPM\-LS" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-ls\fR \-\- List installed packages @@ -32,6 +32,19 @@ When run as \fBll\fR or \fBla\fR, it shows extended information by default\. . .SH "CONFIGURATION" . +.SS "json" +. +.IP "\(bu" 4 +Default: false +. +.IP "\(bu" 4 +Type: Boolean +. +.IP "" 0 +. +.P +Show information in JSON format\. +. .SS "long" . .IP "\(bu" 4 diff --git a/deps/npm/man/man1/npm.1 b/deps/npm/man/man1/npm.1 index 7d606a7c9a..f2589dc126 100644 --- a/deps/npm/man/man1/npm.1 +++ b/deps/npm/man/man1/npm.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM" "1" "January 2012" "" "" +.TH "NPM" "1" "May 2012" "" "" . .SH "NAME" \fBnpm\fR \-\- node package manager @@ -14,7 +14,7 @@ npm <command> [args] .fi . .SH "VERSION" -1.1.0-2 +1.1.21 . .SH "DESCRIPTION" npm is the package manager for the Node JavaScript platform\. It puts diff --git a/deps/npm/man/man1/outdated.1 b/deps/npm/man/man1/outdated.1 index 658d31106e..cb27b8cd26 100644 --- a/deps/npm/man/man1/outdated.1 +++ b/deps/npm/man/man1/outdated.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-OUTDATED" "1" "January 2012" "" "" +.TH "NPM\-OUTDATED" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-outdated\fR \-\- Check for outdated packages diff --git a/deps/npm/man/man1/owner.1 b/deps/npm/man/man1/owner.1 index 719fd6633a..6ba46a1189 100644 --- a/deps/npm/man/man1/owner.1 +++ b/deps/npm/man/man1/owner.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-OWNER" "1" "January 2012" "" "" +.TH "NPM\-OWNER" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-owner\fR \-\- Manage package owners diff --git a/deps/npm/man/man1/pack.1 b/deps/npm/man/man1/pack.1 index 578659d74d..54fb1c11c9 100644 --- a/deps/npm/man/man1/pack.1 +++ b/deps/npm/man/man1/pack.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-PACK" "1" "January 2012" "" "" +.TH "NPM\-PACK" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-pack\fR \-\- Create a tarball from a package diff --git a/deps/npm/man/man1/prefix.1 b/deps/npm/man/man1/prefix.1 index 235daa52b8..26e52d8cbb 100644 --- a/deps/npm/man/man1/prefix.1 +++ b/deps/npm/man/man1/prefix.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-PREFIX" "1" "January 2012" "" "" +.TH "NPM\-PREFIX" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-prefix\fR \-\- Display prefix diff --git a/deps/npm/man/man1/prune.1 b/deps/npm/man/man1/prune.1 index 25c1abfdfc..5d1aecbc99 100644 --- a/deps/npm/man/man1/prune.1 +++ b/deps/npm/man/man1/prune.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-PRUNE" "1" "January 2012" "" "" +.TH "NPM\-PRUNE" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-prune\fR \-\- Remove extraneous packages diff --git a/deps/npm/man/man1/publish.1 b/deps/npm/man/man1/publish.1 index 51bc9495bb..8ec2a1ed4d 100644 --- a/deps/npm/man/man1/publish.1 +++ b/deps/npm/man/man1/publish.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-PUBLISH" "1" "January 2012" "" "" +.TH "NPM\-PUBLISH" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-publish\fR \-\- Publish a package diff --git a/deps/npm/man/man1/rebuild.1 b/deps/npm/man/man1/rebuild.1 index 8836b1b9b2..b630729a72 100644 --- a/deps/npm/man/man1/rebuild.1 +++ b/deps/npm/man/man1/rebuild.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-REBUILD" "1" "January 2012" "" "" +.TH "NPM\-REBUILD" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-rebuild\fR \-\- Rebuild a package diff --git a/deps/npm/man/man1/registry.1 b/deps/npm/man/man1/registry.1 index e5b552eeec..187a946ac5 100644 --- a/deps/npm/man/man1/registry.1 +++ b/deps/npm/man/man1/registry.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-REGISTRY" "1" "January 2012" "" "" +.TH "NPM\-REGISTRY" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-registry\fR \-\- The JavaScript Package Registry diff --git a/deps/npm/man/man1/removing-npm.1 b/deps/npm/man/man1/removing-npm.1 index b8e7242517..601086cb93 100644 --- a/deps/npm/man/man1/removing-npm.1 +++ b/deps/npm/man/man1/removing-npm.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-REMOVAL" "1" "January 2012" "" "" +.TH "NPM\-REMOVAL" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-removal\fR \-\- Cleaning the Slate diff --git a/deps/npm/man/man1/restart.1 b/deps/npm/man/man1/restart.1 index a5fc7863e4..d74dc9283c 100644 --- a/deps/npm/man/man1/restart.1 +++ b/deps/npm/man/man1/restart.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-RESTART" "1" "January 2012" "" "" +.TH "NPM\-RESTART" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-restart\fR \-\- Start a package diff --git a/deps/npm/man/man1/root.1 b/deps/npm/man/man1/root.1 index 6f0f8c0518..539a6d424a 100644 --- a/deps/npm/man/man1/root.1 +++ b/deps/npm/man/man1/root.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-ROOT" "1" "January 2012" "" "" +.TH "NPM\-ROOT" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-root\fR \-\- Display npm root diff --git a/deps/npm/man/man1/run-script.1 b/deps/npm/man/man1/run-script.1 index 1561bb9be9..ec01fd3f48 100644 --- a/deps/npm/man/man1/run-script.1 +++ b/deps/npm/man/man1/run-script.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-RUN\-SCRIPT" "1" "January 2012" "" "" +.TH "NPM\-RUN\-SCRIPT" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-run-script\fR \-\- Run arbitrary package scripts diff --git a/deps/npm/man/man1/scripts.1 b/deps/npm/man/man1/scripts.1 index ff949bade4..5216862aac 100644 --- a/deps/npm/man/man1/scripts.1 +++ b/deps/npm/man/man1/scripts.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-SCRIPTS" "1" "January 2012" "" "" +.TH "NPM\-SCRIPTS" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-scripts\fR \-\- How npm handles the "scripts" field @@ -94,6 +94,26 @@ Package scripts run in an environment where many pieces of information are made available regarding the setup of npm and the current state of the process\. . +.SS "path" +If you depend on modules that define executable scripts, like test suites, +then those executables will be added to the \fBPATH\fR for executing the scripts\. +So, if your package\.json has this: +. +.IP "" 4 +. +.nf +{ "name" : "foo" +, "dependencies" : { "bar" : "0\.1\.x" } +, "scripts": { "start" : "bar \./test" } } +. +.fi +. +.IP "" 0 +. +.P +then you could run \fBnpm start\fR to execute the \fBbar\fR script, which is exported +into the \fBnode_modules/\.bin\fR directory on \fBnpm install\fR\|\. +. .SS "package\.json vars" The package\.json fields are tacked onto the \fBnpm_package_\fR prefix\. So, for instance, if you had \fB{"name":"foo", "version":"1\.2\.5"}\fR in your package\.json diff --git a/deps/npm/man/man1/search.1 b/deps/npm/man/man1/search.1 index 52a77841ac..e57b30279f 100644 --- a/deps/npm/man/man1/search.1 +++ b/deps/npm/man/man1/search.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-SEARCH" "1" "January 2012" "" "" +.TH "NPM\-SEARCH" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-search\fR \-\- Search for packages diff --git a/deps/npm/man/man1/semver.1 b/deps/npm/man/man1/semver.1 index 892b03366b..9cb0ba28bf 100644 --- a/deps/npm/man/man1/semver.1 +++ b/deps/npm/man/man1/semver.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-SEMVER" "1" "January 2012" "" "" +.TH "NPM\-SEMVER" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-semver\fR \-\- The semantic versioner for npm diff --git a/deps/npm/man/man1/shrinkwrap.1 b/deps/npm/man/man1/shrinkwrap.1 index 7dab32420f..6eb694b771 100644 --- a/deps/npm/man/man1/shrinkwrap.1 +++ b/deps/npm/man/man1/shrinkwrap.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-SHRINKWRAP" "1" "April 2012" "" "" +.TH "NPM\-SHRINKWRAP" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-shrinkwrap\fR \-\- Lock down dependency versions diff --git a/deps/npm/man/man1/star.1 b/deps/npm/man/man1/star.1 index 3a43c8c12d..9f6f976899 100644 --- a/deps/npm/man/man1/star.1 +++ b/deps/npm/man/man1/star.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-STAR" "1" "January 2012" "" "" +.TH "NPM\-STAR" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-star\fR \-\- Mark your favorite packages diff --git a/deps/npm/man/man1/start.1 b/deps/npm/man/man1/start.1 index acc0fc465b..309404f33c 100644 --- a/deps/npm/man/man1/start.1 +++ b/deps/npm/man/man1/start.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-START" "1" "January 2012" "" "" +.TH "NPM\-START" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-start\fR \-\- Start a package diff --git a/deps/npm/man/man1/stop.1 b/deps/npm/man/man1/stop.1 index 96d71ef986..182874f5f4 100644 --- a/deps/npm/man/man1/stop.1 +++ b/deps/npm/man/man1/stop.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-STOP" "1" "January 2012" "" "" +.TH "NPM\-STOP" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-stop\fR \-\- Stop a package diff --git a/deps/npm/man/man1/submodule.1 b/deps/npm/man/man1/submodule.1 index 831a11f33f..7458a04ca9 100644 --- a/deps/npm/man/man1/submodule.1 +++ b/deps/npm/man/man1/submodule.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-SUBMODULE" "1" "January 2012" "" "" +.TH "NPM\-SUBMODULE" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-submodule\fR \-\- Add a package as a git submodule diff --git a/deps/npm/man/man1/tag.1 b/deps/npm/man/man1/tag.1 index b0573216c1..ad1ba7c400 100644 --- a/deps/npm/man/man1/tag.1 +++ b/deps/npm/man/man1/tag.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-TAG" "1" "January 2012" "" "" +.TH "NPM\-TAG" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-tag\fR \-\- Tag a published version diff --git a/deps/npm/man/man1/test.1 b/deps/npm/man/man1/test.1 index 1fc73a4085..013a54b2eb 100644 --- a/deps/npm/man/man1/test.1 +++ b/deps/npm/man/man1/test.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-TEST" "1" "January 2012" "" "" +.TH "NPM\-TEST" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-test\fR \-\- Test a package diff --git a/deps/npm/man/man1/uninstall.1 b/deps/npm/man/man1/uninstall.1 index dd96d1725c..13ba214094 100644 --- a/deps/npm/man/man1/uninstall.1 +++ b/deps/npm/man/man1/uninstall.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-RM" "1" "January 2012" "" "" +.TH "NPM\-RM" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-rm\fR \-\- Remove a package diff --git a/deps/npm/man/man1/unpublish.1 b/deps/npm/man/man1/unpublish.1 index 22b93d141e..309ff03aad 100644 --- a/deps/npm/man/man1/unpublish.1 +++ b/deps/npm/man/man1/unpublish.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-UNPUBLISH" "1" "January 2012" "" "" +.TH "NPM\-UNPUBLISH" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-unpublish\fR \-\- Remove a package from the registry diff --git a/deps/npm/man/man1/update.1 b/deps/npm/man/man1/update.1 index 73cccbe4b4..758b8d1a73 100644 --- a/deps/npm/man/man1/update.1 +++ b/deps/npm/man/man1/update.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-UPDATE" "1" "January 2012" "" "" +.TH "NPM\-UPDATE" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-update\fR \-\- Update a package diff --git a/deps/npm/man/man1/version.1 b/deps/npm/man/man1/version.1 index bc6275121d..b611ad66b7 100644 --- a/deps/npm/man/man1/version.1 +++ b/deps/npm/man/man1/version.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-VERSION" "1" "January 2012" "" "" +.TH "NPM\-VERSION" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-version\fR \-\- Bump a package version diff --git a/deps/npm/man/man1/view.1 b/deps/npm/man/man1/view.1 index 774fdba007..4206584eee 100644 --- a/deps/npm/man/man1/view.1 +++ b/deps/npm/man/man1/view.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-VIEW" "1" "January 2012" "" "" +.TH "NPM\-VIEW" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-view\fR \-\- View registry info diff --git a/deps/npm/man/man1/whoami.1 b/deps/npm/man/man1/whoami.1 index 1d7f502bd8..62d9f87ba3 100644 --- a/deps/npm/man/man1/whoami.1 +++ b/deps/npm/man/man1/whoami.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-WHOAMI" "1" "January 2012" "" "" +.TH "NPM\-WHOAMI" "1" "May 2012" "" "" . .SH "NAME" \fBnpm-whoami\fR \-\- Display npm username diff --git a/deps/npm/man/man3/bin.3 b/deps/npm/man/man3/bin.3 index a318723329..c650e468d2 100644 --- a/deps/npm/man/man3/bin.3 +++ b/deps/npm/man/man3/bin.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-BIN" "3" "January 2012" "" "" +.TH "NPM\-BIN" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-bin\fR \-\- Display npm bin folder diff --git a/deps/npm/man/man3/bugs.3 b/deps/npm/man/man3/bugs.3 index 61deea7e7f..d2ba4244c1 100644 --- a/deps/npm/man/man3/bugs.3 +++ b/deps/npm/man/man3/bugs.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-BUGS" "3" "January 2012" "" "" +.TH "NPM\-BUGS" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-bugs\fR \-\- Bugs for a package in a web browser maybe diff --git a/deps/npm/man/man3/commands.3 b/deps/npm/man/man3/commands.3 index 38a6e0a426..bb850ddccc 100644 --- a/deps/npm/man/man3/commands.3 +++ b/deps/npm/man/man3/commands.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-COMMANDS" "3" "January 2012" "" "" +.TH "NPM\-COMMANDS" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-commands\fR \-\- npm commands diff --git a/deps/npm/man/man3/config.3 b/deps/npm/man/man3/config.3 index 05e64b08ed..777db93721 100644 --- a/deps/npm/man/man3/config.3 +++ b/deps/npm/man/man3/config.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-CONFIG" "3" "January 2012" "" "" +.TH "NPM\-CONFIG" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-config\fR \-\- Manage the npm configuration files diff --git a/deps/npm/man/man3/deprecate.3 b/deps/npm/man/man3/deprecate.3 index 2786d1ff80..9c071a66b2 100644 --- a/deps/npm/man/man3/deprecate.3 +++ b/deps/npm/man/man3/deprecate.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-DEPRECATE" "3" "January 2012" "" "" +.TH "NPM\-DEPRECATE" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-deprecate\fR \-\- Deprecate a version of a package diff --git a/deps/npm/man/man3/docs.3 b/deps/npm/man/man3/docs.3 index 200df585b7..78f55afbe5 100644 --- a/deps/npm/man/man3/docs.3 +++ b/deps/npm/man/man3/docs.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-DOCS" "3" "January 2012" "" "" +.TH "NPM\-DOCS" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-docs\fR \-\- Docs for a package in a web browser maybe diff --git a/deps/npm/man/man3/edit.3 b/deps/npm/man/man3/edit.3 index 5c6e5e71f8..743192d1c1 100644 --- a/deps/npm/man/man3/edit.3 +++ b/deps/npm/man/man3/edit.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-EDIT" "3" "January 2012" "" "" +.TH "NPM\-EDIT" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-edit\fR \-\- Edit an installed package diff --git a/deps/npm/man/man3/explore.3 b/deps/npm/man/man3/explore.3 index c6443f3ef8..d728918ea8 100644 --- a/deps/npm/man/man3/explore.3 +++ b/deps/npm/man/man3/explore.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-EXPLORE" "3" "January 2012" "" "" +.TH "NPM\-EXPLORE" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-explore\fR \-\- Browse an installed package diff --git a/deps/npm/man/man3/help-search.3 b/deps/npm/man/man3/help-search.3 index 61d54c1a1f..34312daac7 100644 --- a/deps/npm/man/man3/help-search.3 +++ b/deps/npm/man/man3/help-search.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-HELP\-SEARCH" "3" "January 2012" "" "" +.TH "NPM\-HELP\-SEARCH" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-help-search\fR \-\- Search the help pages diff --git a/deps/npm/man/man3/init.3 b/deps/npm/man/man3/init.3 index 31f508d73f..55ee2bfb4f 100644 --- a/deps/npm/man/man3/init.3 +++ b/deps/npm/man/man3/init.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "INIT" "3" "January 2012" "" "" +.TH "INIT" "3" "May 2012" "" "" . .SH "NAME" \fBinit\fR \-\- Interactively create a package\.json file diff --git a/deps/npm/man/man3/install.3 b/deps/npm/man/man3/install.3 index 89d0eb9408..35adb9dc95 100644 --- a/deps/npm/man/man3/install.3 +++ b/deps/npm/man/man3/install.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-INSTALL" "3" "January 2012" "" "" +.TH "NPM\-INSTALL" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-install\fR \-\- install a package programmatically diff --git a/deps/npm/man/man3/link.3 b/deps/npm/man/man3/link.3 index dfe050cad5..fd09d3f511 100644 --- a/deps/npm/man/man3/link.3 +++ b/deps/npm/man/man3/link.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-LINK" "3" "January 2012" "" "" +.TH "NPM\-LINK" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-link\fR \-\- Symlink a package folder diff --git a/deps/npm/man/man3/load.3 b/deps/npm/man/man3/load.3 index fe47803146..2bf6009d99 100644 --- a/deps/npm/man/man3/load.3 +++ b/deps/npm/man/man3/load.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-LOAD" "3" "January 2012" "" "" +.TH "NPM\-LOAD" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-load\fR \-\- Load config settings diff --git a/deps/npm/man/man3/ls.3 b/deps/npm/man/man3/ls.3 index 1c9e9ec118..2ec65b23fa 100644 --- a/deps/npm/man/man3/ls.3 +++ b/deps/npm/man/man3/ls.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-LS" "3" "January 2012" "" "" +.TH "NPM\-LS" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-ls\fR \-\- List installed packages @@ -31,6 +31,13 @@ It will print out extraneous, missing, and invalid packages\. If the silent parameter is set to true, nothing will be output to the screen, but the data will still be returned\. . +.P +Callback is provided an error if one occurred, the full data about which +packages are installed and which dependencies they will receive, and a +"lite" data object which just shows which versions are installed where\. +Note that the full data object is a circular structure, so care must be +taken if it is serialized to JSON\. +. .SH "CONFIGURATION" . .SS "long" diff --git a/deps/npm/man/man3/npm.3 b/deps/npm/man/man3/npm.3 index ff96d77780..978bfab2e3 100644 --- a/deps/npm/man/man3/npm.3 +++ b/deps/npm/man/man3/npm.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM" "3" "January 2012" "" "" +.TH "NPM" "3" "May 2012" "" "" . .SH "NAME" \fBnpm\fR \-\- node package manager @@ -21,7 +21,7 @@ npm\.load(configObject, function (er, npm) { .fi . .SH "VERSION" -1.1.0-2 +1.1.21 . .SH "DESCRIPTION" This is the API documentation for npm\. diff --git a/deps/npm/man/man3/outdated.3 b/deps/npm/man/man3/outdated.3 index 68940b357a..3173c55dfc 100644 --- a/deps/npm/man/man3/outdated.3 +++ b/deps/npm/man/man3/outdated.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-OUTDATED" "3" "January 2012" "" "" +.TH "NPM\-OUTDATED" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-outdated\fR \-\- Check for outdated packages diff --git a/deps/npm/man/man3/owner.3 b/deps/npm/man/man3/owner.3 index 7da0e4a950..6deea4501e 100644 --- a/deps/npm/man/man3/owner.3 +++ b/deps/npm/man/man3/owner.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-OWNER" "3" "January 2012" "" "" +.TH "NPM\-OWNER" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-owner\fR \-\- Manage package owners diff --git a/deps/npm/man/man3/pack.3 b/deps/npm/man/man3/pack.3 index 9b33661278..2a8bafddd8 100644 --- a/deps/npm/man/man3/pack.3 +++ b/deps/npm/man/man3/pack.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-PACK" "3" "January 2012" "" "" +.TH "NPM\-PACK" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-pack\fR \-\- Create a tarball from a package diff --git a/deps/npm/man/man3/prefix.3 b/deps/npm/man/man3/prefix.3 index 6f1db94cbe..c1fdfea49a 100644 --- a/deps/npm/man/man3/prefix.3 +++ b/deps/npm/man/man3/prefix.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-PREFIX" "3" "January 2012" "" "" +.TH "NPM\-PREFIX" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-prefix\fR \-\- Display prefix diff --git a/deps/npm/man/man3/prune.3 b/deps/npm/man/man3/prune.3 index 16b4d93b7f..a49d129c3d 100644 --- a/deps/npm/man/man3/prune.3 +++ b/deps/npm/man/man3/prune.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-PRUNE" "3" "January 2012" "" "" +.TH "NPM\-PRUNE" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-prune\fR \-\- Remove extraneous packages diff --git a/deps/npm/man/man3/publish.3 b/deps/npm/man/man3/publish.3 index 41280810f8..499bd0344f 100644 --- a/deps/npm/man/man3/publish.3 +++ b/deps/npm/man/man3/publish.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-PUBLISH" "3" "January 2012" "" "" +.TH "NPM\-PUBLISH" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-publish\fR \-\- Publish a package diff --git a/deps/npm/man/man3/rebuild.3 b/deps/npm/man/man3/rebuild.3 index 3f284c9b9a..6b8fb8cf56 100644 --- a/deps/npm/man/man3/rebuild.3 +++ b/deps/npm/man/man3/rebuild.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-REBUILD" "3" "January 2012" "" "" +.TH "NPM\-REBUILD" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-rebuild\fR \-\- Rebuild a package diff --git a/deps/npm/man/man3/restart.3 b/deps/npm/man/man3/restart.3 index 43939557ef..747c27f1eb 100644 --- a/deps/npm/man/man3/restart.3 +++ b/deps/npm/man/man3/restart.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-RESTART" "3" "January 2012" "" "" +.TH "NPM\-RESTART" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-restart\fR \-\- Start a package diff --git a/deps/npm/man/man3/root.3 b/deps/npm/man/man3/root.3 index 07c1b0cdd8..99a5b903d2 100644 --- a/deps/npm/man/man3/root.3 +++ b/deps/npm/man/man3/root.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-ROOT" "3" "January 2012" "" "" +.TH "NPM\-ROOT" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-root\fR \-\- Display npm root diff --git a/deps/npm/man/man3/run-script.3 b/deps/npm/man/man3/run-script.3 index b5f03e270d..9ceb7b30e9 100644 --- a/deps/npm/man/man3/run-script.3 +++ b/deps/npm/man/man3/run-script.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-RUN\-SCRIPT" "3" "January 2012" "" "" +.TH "NPM\-RUN\-SCRIPT" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-run-script\fR \-\- Run arbitrary package scripts diff --git a/deps/npm/man/man3/search.3 b/deps/npm/man/man3/search.3 index 4c4a4a2d0e..f56eb4b907 100644 --- a/deps/npm/man/man3/search.3 +++ b/deps/npm/man/man3/search.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-SEARCH" "3" "January 2012" "" "" +.TH "NPM\-SEARCH" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-search\fR \-\- Search for packages diff --git a/deps/npm/man/man3/shrinkwrap.3 b/deps/npm/man/man3/shrinkwrap.3 index 647e4a4306..304c3fd89b 100644 --- a/deps/npm/man/man3/shrinkwrap.3 +++ b/deps/npm/man/man3/shrinkwrap.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-SHRINKWRAP" "3" "April 2012" "" "" +.TH "NPM\-SHRINKWRAP" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-shrinkwrap\fR \-\- programmatically generate package shrinkwrap file diff --git a/deps/npm/man/man3/start.3 b/deps/npm/man/man3/start.3 index a050305ef7..29dd95e879 100644 --- a/deps/npm/man/man3/start.3 +++ b/deps/npm/man/man3/start.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-START" "3" "January 2012" "" "" +.TH "NPM\-START" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-start\fR \-\- Start a package diff --git a/deps/npm/man/man3/stop.3 b/deps/npm/man/man3/stop.3 index 302d72756b..1e4fcf2695 100644 --- a/deps/npm/man/man3/stop.3 +++ b/deps/npm/man/man3/stop.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-STOP" "3" "January 2012" "" "" +.TH "NPM\-STOP" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-stop\fR \-\- Stop a package diff --git a/deps/npm/man/man3/submodule.3 b/deps/npm/man/man3/submodule.3 index 8c60894b12..44eb54473b 100644 --- a/deps/npm/man/man3/submodule.3 +++ b/deps/npm/man/man3/submodule.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-SUBMODULE" "3" "January 2012" "" "" +.TH "NPM\-SUBMODULE" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-submodule\fR \-\- Add a package as a git submodule diff --git a/deps/npm/man/man3/tag.3 b/deps/npm/man/man3/tag.3 index ab48222d1d..cd95a8c7cd 100644 --- a/deps/npm/man/man3/tag.3 +++ b/deps/npm/man/man3/tag.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-TAG" "3" "January 2012" "" "" +.TH "NPM\-TAG" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-tag\fR \-\- Tag a published version diff --git a/deps/npm/man/man3/test.3 b/deps/npm/man/man3/test.3 index 3b9514a988..7a8b3a839c 100644 --- a/deps/npm/man/man3/test.3 +++ b/deps/npm/man/man3/test.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-TEST" "3" "January 2012" "" "" +.TH "NPM\-TEST" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-test\fR \-\- Test a package diff --git a/deps/npm/man/man3/uninstall.3 b/deps/npm/man/man3/uninstall.3 index 0349773b68..5a6f8f7501 100644 --- a/deps/npm/man/man3/uninstall.3 +++ b/deps/npm/man/man3/uninstall.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-UNINSTALL" "3" "January 2012" "" "" +.TH "NPM\-UNINSTALL" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-uninstall\fR \-\- uninstall a package programmatically diff --git a/deps/npm/man/man3/unpublish.3 b/deps/npm/man/man3/unpublish.3 index 91e66771cc..0a0e0f31ab 100644 --- a/deps/npm/man/man3/unpublish.3 +++ b/deps/npm/man/man3/unpublish.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-UNPUBLISH" "3" "January 2012" "" "" +.TH "NPM\-UNPUBLISH" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-unpublish\fR \-\- Remove a package from the registry diff --git a/deps/npm/man/man3/update.3 b/deps/npm/man/man3/update.3 index 299006b51f..f0543fcd06 100644 --- a/deps/npm/man/man3/update.3 +++ b/deps/npm/man/man3/update.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-UPDATE" "3" "January 2012" "" "" +.TH "NPM\-UPDATE" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-update\fR \-\- Update a package diff --git a/deps/npm/man/man3/version.3 b/deps/npm/man/man3/version.3 index 1925688c28..8c7fcb834c 100644 --- a/deps/npm/man/man3/version.3 +++ b/deps/npm/man/man3/version.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-VERSION" "3" "January 2012" "" "" +.TH "NPM\-VERSION" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-version\fR \-\- Bump a package version diff --git a/deps/npm/man/man3/view.3 b/deps/npm/man/man3/view.3 index d3485f6b8d..b507561691 100644 --- a/deps/npm/man/man3/view.3 +++ b/deps/npm/man/man3/view.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-VIEW" "3" "January 2012" "" "" +.TH "NPM\-VIEW" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-view\fR \-\- View registry info diff --git a/deps/npm/man/man3/whoami.3 b/deps/npm/man/man3/whoami.3 index 58d3462db4..8262b2af4f 100644 --- a/deps/npm/man/man3/whoami.3 +++ b/deps/npm/man/man3/whoami.3 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-WHOAMI" "3" "January 2012" "" "" +.TH "NPM\-WHOAMI" "3" "May 2012" "" "" . .SH "NAME" \fBnpm-whoami\fR \-\- Display npm username diff --git a/deps/npm/node_modules/block-stream/package.json b/deps/npm/node_modules/block-stream/package.json index 203961a144..1080b6bc9a 100644 --- a/deps/npm/node_modules/block-stream/package.json +++ b/deps/npm/node_modules/block-stream/package.json @@ -2,13 +2,13 @@ "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)", "name": "block-stream", "description": "a stream of blocks", - "version": "0.0.4", + "version": "0.0.5", "repository": { "type": "git", "url": "git://github.com/isaacs/block-stream.git" }, "engines": { - "node": "0.4 || ~0.5.8 || 0.6" + "node": "0.4 || ~0.5.8 || 0.6 || 0.7" }, "main": "block-stream.js", "dependencies": { diff --git a/deps/npm/node_modules/fast-list/.npmignore b/deps/npm/node_modules/fast-list/.npmignore deleted file mode 100644 index c2658d7d1b..0000000000 --- a/deps/npm/node_modules/fast-list/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules/ diff --git a/deps/npm/node_modules/fast-list/.travis.yml b/deps/npm/node_modules/fast-list/.travis.yml deleted file mode 100644 index f1d0f13c8a..0000000000 --- a/deps/npm/node_modules/fast-list/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - 0.4 - - 0.6 diff --git a/deps/npm/node_modules/fast-list/README.md b/deps/npm/node_modules/fast-list/README.md deleted file mode 100644 index 88a842ef0e..0000000000 --- a/deps/npm/node_modules/fast-list/README.md +++ /dev/null @@ -1,116 +0,0 @@ -# The Problem - -You've got some thing where you need to push a bunch of stuff into a -queue and then shift it out. Or, maybe it's a stack, and you're just -pushing and popping it. - -Arrays work for this, but are a bit costly performance-wise. - -# The Solution - -A linked-list implementation that takes advantage of what v8 is good at: -creating objects with a known shape. - -This is faster for this use case. How much faster? About 50%. - - $ node bench.js - benchmarking /Users/isaacs/dev-src/js/fast-list/bench.js - Please be patient. - { node: '0.6.2-pre', - v8: '3.6.6.8', - ares: '1.7.5-DEV', - uv: '0.1', - openssl: '0.9.8l' } - Scores: (bigger is better) - - new FastList() - Raw: - > 22556.39097744361 - > 23054.755043227666 - > 22770.398481973436 - > 23414.634146341465 - > 23099.133782483157 - Average (mean) 22979.062486293868 - - [] - Raw: - > 12195.121951219513 - > 12184.508268059182 - > 12173.91304347826 - > 12216.404886561955 - > 12184.508268059182 - Average (mean) 12190.891283475617 - - new Array() - Raw: - > 12131.715771230503 - > 12184.508268059182 - > 12216.404886561955 - > 12195.121951219513 - > 11940.298507462687 - Average (mean) 12133.609876906768 - - Winner: new FastList() - Compared with next highest ([]), it's: - 46.95% faster - 1.88 times as fast - 0.28 order(s) of magnitude faster - - Compared with the slowest (new Array()), it's: - 47.2% faster - 1.89 times as fast - 0.28 order(s) of magnitude faster - -This lacks a lot of features that arrays have: - -1. You can't specify the size at the outset. -2. It's not indexable. -3. There's no join, concat, etc. - -If any of this matters for your use case, you're probably better off -using an Array object. - -## Installing - -``` -npm install fast-list -``` - -## API - -```javascript -var FastList = require("fast-list") -var list = new FastList() -list.push("foo") -list.unshift("bar") -list.push("baz") -console.log(list.length) // 2 -console.log(list.pop()) // baz -console.log(list.shift()) // bar -console.log(list.shift()) // foo -``` - -### Methods - -* `push`: Just like Array.push, but only can take a single entry -* `pop`: Just like Array.pop -* `shift`: Just like Array.shift -* `unshift`: Just like Array.unshift, but only can take a single entry -* `drop`: Drop all entries -* `item(n)`: Retrieve the nth item in the list. This involves a walk - every time. It's very slow. If you find yourself using this, - consider using a normal Array instead. -* `map(fn, thisp)`: Like `Array.prototype.map`. Returns a new FastList. -* `reduce(fn, startValue, thisp)`: Like `Array.prototype.reduce` -* `forEach(fn, this)`: Like `Array.prototype.forEach` -* `filter(fn, thisp)`: Like `Array.prototype.filter`. Returns a new - FastList. -* `slice(start, end)`: Retrieve an array of the items at this position. - This involves a walk every time. It's very slow. If you find - yourself using this, consider using a normal Array instead. - -### Members - -* `length`: The number of things in the list. Note that, unlike - Array.length, this is not a getter/setter, but rather a counter that - is internally managed. Setting it can only cause harm. diff --git a/deps/npm/node_modules/fast-list/fast-list.js b/deps/npm/node_modules/fast-list/fast-list.js deleted file mode 100644 index 692db0df8f..0000000000 --- a/deps/npm/node_modules/fast-list/fast-list.js +++ /dev/null @@ -1,144 +0,0 @@ -;(function() { // closure for web browsers - -function Item (data, prev, next) { - this.next = next - if (next) next.prev = this - this.prev = prev - if (prev) prev.next = this - this.data = data -} - -function FastList () { - if (!(this instanceof FastList)) return new FastList - this._head = null - this._tail = null - this.length = 0 -} - -FastList.prototype = -{ push: function (data) { - this._tail = new Item(data, this._tail, null) - if (!this._head) this._head = this._tail - this.length ++ - } - -, pop: function () { - if (this.length === 0) return undefined - var t = this._tail - this._tail = t.prev - if (t.prev) { - t.prev = this._tail.next = null - } - this.length -- - if (this.length === 1) this._head = this._tail - else if (this.length === 0) this._head = this._tail = null - return t.data - } - -, unshift: function (data) { - this._head = new Item(data, null, this._head) - if (!this._tail) this._tail = this._head - this.length ++ - } - -, shift: function () { - if (this.length === 0) return undefined - var h = this._head - this._head = h.next - if (h.next) { - h.next = this._head.prev = null - } - this.length -- - if (this.length === 1) this._tail = this._head - else if (this.length === 0) this._head = this._tail = null - return h.data - } - -, item: function (n) { - if (n < 0) n = this.length + n - var h = this._head - while (n-- > 0 && h) h = h.next - return h ? h.data : undefined - } - -, slice: function (n, m) { - if (!n) n = 0 - if (!m) m = this.length - if (m < 0) m = this.length + m - if (n < 0) n = this.length + n - - if (m === n) { - return [] - } - - if (m < n) { - throw new Error("invalid offset: "+n+","+m+" (length="+this.length+")") - } - - var len = m - n - , ret = new Array(len) - , i = 0 - , h = this._head - while (n-- > 0 && h) h = h.next - while (i < len && h) { - ret[i++] = h.data - h = h.next - } - return ret - } - -, drop: function () { - FastList.call(this) - } - -, forEach: function (fn, thisp) { - var p = this._head - , i = 0 - , len = this.length - while (i < len && p) { - fn.call(thisp || this, p.data, i, this) - p = p.next - i ++ - } - } - -, map: function (fn, thisp) { - var n = new FastList() - this.forEach(function (v, i, me) { - n.push(fn.call(thisp || me, v, i, me)) - }) - return n - } - -, filter: function (fn, thisp) { - var n = new FastList() - this.forEach(function (v, i, me) { - if (fn.call(thisp || me, v, i, me)) n.push(v) - }) - return n - } - -, reduce: function (fn, val, thisp) { - var i = 0 - , p = this._head - , len = this.length - if (!val) { - i = 1 - val = p && p.data - p = p && p.next - } - while (i < len && p) { - val = fn.call(thisp || this, val, p.data, this) - i ++ - p = p.next - } - return val - } -} - -if ("undefined" !== typeof(exports)) module.exports = FastList -else if ("function" === typeof(define) && define.amd) { - define("FastList", function() { return FastList }) -} else (function () { return this })().FastList = FastList - -})() diff --git a/deps/npm/node_modules/fast-list/package.json b/deps/npm/node_modules/fast-list/package.json deleted file mode 100644 index 9bcc6b4133..0000000000 --- a/deps/npm/node_modules/fast-list/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)", - "name": "fast-list", - "description": "A fast linked list (good for queues, stacks, etc.)", - "version": "1.0.2", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/fast-list.git" - }, - "main": "fast-list.js", - "dependencies": {}, - "devDependencies": { - "bench": "~0.3.2", - "tap": "~0.1.0" - }, - "scripts": { - "test": "tap test.js", - "bench": "node bench.js" - } -} diff --git a/deps/npm/node_modules/fstream/.npmignore b/deps/npm/node_modules/fstream/.npmignore index 66880db1ab..494272a81a 100644 --- a/deps/npm/node_modules/fstream/.npmignore +++ b/deps/npm/node_modules/fstream/.npmignore @@ -1,3 +1,5 @@ .*.swp -examples/deep-copy node_modules/ +examples/deep-copy/ +examples/path/ +examples/filter-copy/ diff --git a/deps/npm/node_modules/fstream/lib/abstract.js b/deps/npm/node_modules/fstream/lib/abstract.js index add48b945d..5675d4a1b1 100644 --- a/deps/npm/node_modules/fstream/lib/abstract.js +++ b/deps/npm/node_modules/fstream/lib/abstract.js @@ -20,6 +20,11 @@ Abstract.prototype.on = function (ev, fn) { return this } +Abstract.prototype.abort = function () { + this._aborted = true + this.emit("abort") +} + Abstract.prototype.destroy = function () {} Abstract.prototype.warn = function (msg, code) { diff --git a/deps/npm/node_modules/fstream/lib/dir-reader.js b/deps/npm/node_modules/fstream/lib/dir-reader.js index ab990d1501..6a418c0bc1 100644 --- a/deps/npm/node_modules/fstream/lib/dir-reader.js +++ b/deps/npm/node_modules/fstream/lib/dir-reader.js @@ -11,6 +11,7 @@ var fs = require("graceful-fs") , mkdir = require("mkdirp") , path = require("path") , Reader = require("./reader.js") + , assert = require("assert").ok inherits(DirReader, Reader) @@ -24,25 +25,42 @@ function DirReader (props) { throw new Error("Non-directory type "+ props.type) } - me._entries = null + me.entries = null me._index = -1 me._paused = false me._length = -1 + if (props.sort) { + this.sort = props.sort + } + Reader.call(this, props) } DirReader.prototype._getEntries = function () { var me = this + + // race condition. might pause() before calling _getEntries, + // and then resume, and try to get them a second time. + if (me._gotEntries) return + me._gotEntries = true + fs.readdir(me._path, function (er, entries) { if (er) return me.error(er) - me._entries = entries - me._length = entries.length - // console.error("DR %s sort =", me.path, me.props.sort) - if (typeof me.props.sort === "function") { - me._entries.sort(me.props.sort) + + me.entries = entries + + me.emit("entries", entries) + if (me._paused) me.once("resume", processEntries) + else processEntries() + + function processEntries () { + me._length = me.entries.length + if (typeof me.sort === "function") { + me.entries = me.entries.sort(me.sort.bind(me)) + } + me._read() } - me._read() }) } @@ -50,7 +68,7 @@ DirReader.prototype._getEntries = function () { DirReader.prototype._read = function () { var me = this - if (!me._entries) return me._getEntries() + if (!me.entries) return me._getEntries() if (me._paused || me._currentEntry || me._aborted) { // console.error("DR paused=%j, current=%j, aborted=%j", me._paused, !!me._currentEntry, me._aborted) @@ -58,7 +76,7 @@ DirReader.prototype._read = function () { } me._index ++ - if (me._index >= me._length) { + if (me._index >= me.entries.length) { if (!me._ended) { me._ended = true me.emit("end") @@ -70,20 +88,26 @@ DirReader.prototype._read = function () { // ok, handle this one, then. // save creating a proxy, by stat'ing the thing now. - var p = path.resolve(me._path, me._entries[me._index]) + var p = path.resolve(me._path, me.entries[me._index]) + assert(p !== me._path) + assert(me.entries[me._index]) + // set this to prevent trying to _read() again in the stat time. me._currentEntry = p fs[ me.props.follow ? "stat" : "lstat" ](p, function (er, stat) { if (er) return me.error(er) - var entry = Reader({ path: p - , depth: me.depth + 1 - , root: me.root || me._proxy || me - , parent: me._proxy || me - , follow: me.follow - , filter: me.filter - , sort: me.props.sort - }, stat) + var who = me._proxy || me + + stat.path = p + stat.basename = path.basename(p) + stat.dirname = path.dirname(p) + var childProps = me.getChildProps.call(who, stat) + childProps.path = p + childProps.basename = path.basename(p) + childProps.dirname = path.dirname(p) + + var entry = Reader(childProps, stat) // console.error("DR Entry", p, stat.size) @@ -94,17 +118,25 @@ DirReader.prototype._read = function () { // This nomenclature is not completely final. entry.on("pause", function (who) { - if (!me._paused) { + if (!me._paused && !entry._disowned) { me.pause(who) } }) entry.on("resume", function (who) { - if (me._paused) { + if (me._paused && !entry._disowned) { me.resume(who) } }) + entry.on("stat", function (props) { + me.emit("_entryStat", entry, props) + if (entry._aborted) return + if (entry._paused) entry.once("resume", function () { + me.emit("entryStat", entry, props) + }) + }) + entry.on("ready", function EMITCHILD () { // console.error("DR emit child", entry._path) if (me._paused) { @@ -122,23 +154,25 @@ DirReader.prototype._read = function () { if (entry.type === "Socket") { me.emit("socket", entry) } else { - me.emit("entry", entry) - me.emit("child", entry) + me.emitEntry(entry) } }) var ended = false entry.on("close", onend) + entry.on("disown", onend) function onend () { if (ended) return ended = true me.emit("childEnd", entry) me.emit("entryEnd", entry) me._currentEntry = null - me._read() + if (!me._paused) { + me._read() + } } - // XXX Make this work in node. + // XXX Remove this. Works in node as of 0.6.2 or so. // Long filenames should not break stuff. entry.on("error", function (er) { if (entry._swallowErrors) { @@ -160,6 +194,26 @@ DirReader.prototype._read = function () { }) } +DirReader.prototype.disown = function (entry) { + entry.emit("beforeDisown") + entry._disowned = true + entry.parent = entry.root = null + if (entry === this._currentEntry) { + this._currentEntry = null + } + entry.emit("disown") +} + +DirReader.prototype.getChildProps = function (stat) { + return { depth: this.depth + 1 + , root: this.root || this + , parent: this + , follow: this.follow + , filter: this.filter + , sort: this.props.sort + } +} + DirReader.prototype.pause = function (who) { var me = this if (me._paused) return @@ -185,8 +239,11 @@ DirReader.prototype.resume = function (who) { } if (me._currentEntry) { - if (me._currentEntry.resume) { - me._currentEntry.resume(who) - } + if (me._currentEntry.resume) me._currentEntry.resume(who) } else me._read() } + +DirReader.prototype.emitEntry = function (entry) { + this.emit("entry", entry) + this.emit("child", entry) +} diff --git a/deps/npm/node_modules/fstream/lib/dir-writer.js b/deps/npm/node_modules/fstream/lib/dir-writer.js index 01920244c1..7073b883ea 100644 --- a/deps/npm/node_modules/fstream/lib/dir-writer.js +++ b/deps/npm/node_modules/fstream/lib/dir-writer.js @@ -37,6 +37,7 @@ DirWriter.prototype._create = function () { // ready to start getting entries! me.ready = true me.emit("ready") + me._process() }) } @@ -99,7 +100,9 @@ DirWriter.prototype._process = function () { // don't allow recursive copying var p = entry do { - if (p._path === me.root._path || p._path === me._path) { + var pp = p._path || p.path + if (pp === me.root._path || pp === me._path || + (pp && pp.indexOf(me._path) === 0)) { // console.error("DW Exit (recursive)", entry.basename, me._path) me._processing = false if (entry._collected) entry.pipe() @@ -122,6 +125,9 @@ DirWriter.prototype._process = function () { // get rid of any ../../ shenanigans props.path = path.join(me.path, path.join("/", p)) + // if i have a filter, the child should inherit it. + props.filter = me.filter + // all the rest of the stuff, copy over from the source. Object.keys(entry.props).forEach(function (k) { if (!props.hasOwnProperty(k)) { diff --git a/deps/npm/node_modules/fstream/lib/link-writer.js b/deps/npm/node_modules/fstream/lib/link-writer.js index 8a98163800..5c8f1e7012 100644 --- a/deps/npm/node_modules/fstream/lib/link-writer.js +++ b/deps/npm/node_modules/fstream/lib/link-writer.js @@ -4,7 +4,6 @@ module.exports = LinkWriter var fs = require("graceful-fs") , Writer = require("./writer.js") , inherits = require("inherits") - , collect = require("./collect.js") , path = require("path") , rimraf = require("rimraf") diff --git a/deps/npm/node_modules/fstream/lib/proxy-reader.js b/deps/npm/node_modules/fstream/lib/proxy-reader.js index f99b28fe55..a0ece34a26 100644 --- a/deps/npm/node_modules/fstream/lib/proxy-reader.js +++ b/deps/npm/node_modules/fstream/lib/proxy-reader.js @@ -59,7 +59,11 @@ ProxyReader.prototype._addProxy = function (proxy) { , "close" , "linkpath" , "entry" + , "entryEnd" + , "child" + , "childEnd" , "warn" + , "stat" ].forEach(function (ev) { // console.error("~~ proxy event", ev, me.path) proxy.on(ev, me.emit.bind(me, ev)) diff --git a/deps/npm/node_modules/fstream/lib/reader.js b/deps/npm/node_modules/fstream/lib/reader.js index 6aa67ada78..e4e1b482cf 100644 --- a/deps/npm/node_modules/fstream/lib/reader.js +++ b/deps/npm/node_modules/fstream/lib/reader.js @@ -187,19 +187,38 @@ Reader.prototype._stat = function (currentStat) { // if the filter doesn't pass, then just skip over this one. // still have to emit end so that dir-walking can move on. if (me.filter) { + var who = me._proxy || me // special handling for ProxyReaders - if (!me.filter.call(me._proxy || me)) { - me._aborted = true + if (!me.filter.call(who, who, props)) { + if (!me._disowned) { + me.abort() + me.emit("end") + me.emit("close") + } + return + } + } + + // last chance to abort or disown before the flow starts! + var events = ["_stat", "stat", "ready"] + var e = 0 + ;(function go () { + if (me._aborted) { me.emit("end") me.emit("close") return } - } - me.emit("ready", props) + if (me._paused) { + me.once("resume", go) + return + } - // if it's a directory, then we'll be emitting "entry" events. - me._read() + var ev = events[e ++] + if (!ev) return me._read() + me.emit(ev, props) + go() + })() } } diff --git a/deps/npm/node_modules/fstream/lib/writer.js b/deps/npm/node_modules/fstream/lib/writer.js index dde29fd7b2..243f6b64e8 100644 --- a/deps/npm/node_modules/fstream/lib/writer.js +++ b/deps/npm/node_modules/fstream/lib/writer.js @@ -98,6 +98,8 @@ function Writer (props, current) { me._buffer = [] me.ready = false + me.filter = typeof props.filter === "function" ? props.filter: null + // start the ball rolling. // this checks what's there already, and then calls // me._create() to call the impl-specific creation stuff. @@ -121,11 +123,19 @@ Writer.prototype._stat = function (current) { var me = this , props = me.props , stat = props.follow ? "stat" : "lstat" + , who = me._proxy || me if (current) statCb(null, current) else fs[stat](me._path, statCb) function statCb (er, current) { + if (me.filter && !me.filter.call(who, who, current)) { + me._aborted = true + me.emit("end") + me.emit("close") + return + } + // if it's not there, great. We'll just create it. // if it is there, then we'll need to change whatever differs if (er || !current) { @@ -156,13 +166,83 @@ function create (me) { // XXX Need to clobber non-dirs that are in the way, // unless { clobber: false } in the props. - mkdir(path.dirname(me._path), Writer.dirmode, function (er) { + mkdir(path.dirname(me._path), Writer.dirmode, function (er, made) { // console.error("W created", path.dirname(me._path), er) if (er) return me.error(er) - me._create() + + // later on, we have to set the mode and owner for these + me._madeDir = made + return me._create() }) } +function endChmod (me, want, current, path, cb) { + var wantMode = want.mode + , chmod = want.follow || me.type !== "SymbolicLink" + ? "chmod" : "lchmod" + + if (!fs[chmod]) return cb() + if (typeof wantMode !== "number") return cb() + + var curMode = current.mode & 0777 + wantMode = wantMode & 0777 + if (wantMode === curMode) return cb() + + fs[chmod](path, wantMode, cb) +} + + +function endChown (me, want, current, path, cb) { + // Don't even try it unless root. Too easy to EPERM. + if (process.platform === "win32") return cb() + if (!process.getuid || !process.getuid() === 0) return cb() + if (typeof want.uid !== "number" && + typeof want.gid !== "number" ) return cb() + + if (current.uid === want.uid && + current.gid === want.gid) return cb() + + var chown = (me.props.follow || me.type !== "SymbolicLink") + ? "chown" : "lchown" + if (!fs[chown]) return cb() + + if (typeof want.uid !== "number") want.uid = current.uid + if (typeof want.gid !== "number") want.gid = current.gid + + fs[chown](path, want.uid, want.gid, cb) +} + +function endUtimes (me, want, current, path, cb) { + if (!fs.utimes || process.platform === "win32") return cb() + + var utimes = (want.follow || me.type !== "SymbolicLink") + ? "utimes" : "lutimes" + + if (utimes === "lutimes" && !fs[utimes]) { + utimes = "utimes" + } + + if (!fs[utimes]) return cb() + + var curA = current.atime + , curM = current.mtime + , meA = want.atime + , meM = want.mtime + + if (meA === undefined) meA = curA + if (meM === undefined) meM = curM + + if (!isDate(meA)) meA = new Date(meA) + if (!isDate(meM)) meA = new Date(meM) + + if (meA.getTime() === curA.getTime() && + meM.getTime() === curM.getTime()) return cb() + + fs[utimes](path, meA, meM, cb) +} + + +// XXX This function is beastly. Break it up! Writer.prototype._finish = function () { var me = this @@ -210,88 +290,82 @@ Writer.prototype._finish = function () { return function setProps (current) { - // console.error(" W setprops", me._path) - // mode - var wantMode = me.props.mode - , chmod = me.props.follow || me.type !== "SymbolicLink" - ? "chmod" : "lchmod" - - if (fs[chmod] && typeof wantMode === "number") { - wantMode = wantMode & 0777 - todo ++ - // console.error(" W chmod", wantMode.toString(8), me.basename, "\r") - fs[chmod](me._path, wantMode, next(chmod)) - } + endChmod(me, me.props, current, me._path, next("chmod")) + endChown(me, me.props, current, me._path, next("chown")) + endUtimes(me, me.props, current, me._path, next("chown")) + } - // uid, gid - // Don't even try it unless root. Too easy to EPERM. - if (process.platform !== "win32" && - process.getuid && process.getuid() === 0 && - ( typeof me.props.uid === "number" || - typeof me.props.gid === "number" )) { - var chown = (me.props.follow || me.type !== "SymbolicLink") - ? "chown" : "lchown" - if (fs[chown]) { - if (typeof me.props.uid !== "number") me.props.uid = current.uid - if (typeof me.props.gid !== "number") me.props.gid = current.gid - if (me.props.uid !== current.uid || me.props.gid !== current.gid) { - todo ++ - // console.error(" W chown", me.props.uid, me.props.gid, me.basename) - fs[chown](me._path, me.props.uid, me.props.gid, next("chown")) + function next (what) { + todo ++ + return function (er) { + // console.error(" W Finish", what, todo) + if (errState) return + if (er) { + er.fstream_finish_call = what + return me.error(errState = er) + } + if (--todo > 0) return + if (done) return + done = true + + // we may still need to set the mode/etc. on some parent dirs + // that were created previously. delay end/close until then. + if (!me._madeDir) return end() + else endMadeDir(me, me._path, end) + + function end (er) { + if (er) { + er.fstream_finish_call = "setupMadeDir" + return me.error(er) } + // all the props have been set, so we're completely done. + me.emit("end") + me.emit("close") } } + } +} - // atime, mtime. - if (fs.utimes && process.platform !== "win32") { - var utimes = (me.props.follow || me.type !== "SymbolicLink") - ? "utimes" : "lutimes" - - if (utimes === "lutimes" && !fs[utimes]) { - utimes = "utimes" - } - - var curA = current.atime - , curM = current.mtime - , meA = me.props.atime - , meM = me.props.mtime +function endMadeDir (me, p, cb) { + var made = me._madeDir + // everything *between* made and path.dirname(me._path) + // needs to be set up. Note that this may just be one dir. + var d = path.dirname(p) - if (meA === undefined) meA = curA - if (meM === undefined) meM = curM + endMadeDir_(me, d, function (er) { + if (er) return cb(er) + if (d === made) { + return cb() + } + endMadeDir(me, d, cb) + }) +} - if (!isDate(meA)) meA = new Date(meA) - if (!isDate(meM)) meA = new Date(meM) +function endMadeDir_ (me, p, cb) { + var dirProps = {} + Object.keys(me.props).forEach(function (k) { + dirProps[k] = me.props[k] - if (meA.getTime() !== curA.getTime() || - meM.getTime() !== curM.getTime()) { - todo ++ - // console.error(" W utimes", meA, meM, me.basename) - fs[utimes](me._path, meA, meM, next("utimes")) - } + // only make non-readable dirs if explicitly requested. + if (k === "mode" && me.type !== "Directory") { + dirProps[k] = dirProps[k] | 0111 } + }) - // finally, handle the case if there was nothing to do. - if (todo === 0) { - // console.error(" W nothing to do", me.basename) - next("nothing to do")() - } - } + var todo = 3 + , errState = null + fs.stat(p, function (er, current) { + if (er) return cb(errState = er) + endChmod(me, dirProps, current, p, next) + endChown(me, dirProps, current, p, next) + endUtimes(me, dirProps, current, p, next) + }) - function next (what) { return function (er) { - // console.error(" W Finish", what, todo) + function next (er) { if (errState) return - if (er) { - er.fstream_finish_call = what - return me.error(errState = er) - } - if (--todo > 0) return - if (done) return - done = true - - // all the props have been set, so we're completely done. - me.emit("end") - me.emit("close") - }} + if (er) return cb(errState = er) + if (-- todo === 0) return cb() + } } Writer.prototype.pipe = function () { diff --git a/deps/npm/node_modules/fstream/package.json b/deps/npm/node_modules/fstream/package.json index eb8561532c..2be498e095 100644 --- a/deps/npm/node_modules/fstream/package.json +++ b/deps/npm/node_modules/fstream/package.json @@ -1,26 +1,42 @@ { - "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, "name": "fstream", "description": "Advanced file system stream things", - "version": "0.1.11", + "version": "0.1.18", "repository": { "type": "git", "url": "git://github.com/isaacs/fstream.git" }, "main": "fstream.js", "engines": { - "node": "0.5 || 0.6 || 0.7" + "node": ">=0.6" }, "dependencies": { - "rimraf": "~1.0.8", - "mkdirp": "~0.1.0", + "rimraf": "2", + "mkdirp": "0.3", "graceful-fs": "~1.1.2", "inherits": "~1.0.0" }, "devDependencies": { - "tap": "0.1" + "tap": "" }, "scripts": { "test": "tap examples/*.js" - } + }, + "license": "BSD", + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "_id": "fstream@0.1.18", + "optionalDependencies": {}, + "_engineSupported": true, + "_npmVersion": "1.1.13", + "_nodeVersion": "v0.7.7-pre", + "_defaultsLoaded": true, + "_from": "fstream@~0.1.17" } diff --git a/deps/npm/node_modules/graceful-fs/graceful-fs.js b/deps/npm/node_modules/graceful-fs/graceful-fs.js index 7467f304a2..ecbda31a5a 100644 --- a/deps/npm/node_modules/graceful-fs/graceful-fs.js +++ b/deps/npm/node_modules/graceful-fs/graceful-fs.js @@ -6,8 +6,7 @@ var fs = require("fs") // there is such a thing as TOO graceful. if (fs.open === gracefulOpen) return -var FastList = require("fast-list") - , queue = new FastList() +var queue = [] , curOpen = 0 , constants = require("constants") @@ -210,3 +209,67 @@ if (!fs.lutimes) { fs.lutimesSync = function () {} } } + + +// https://github.com/isaacs/node-graceful-fs/issues/4 +// Chown should not fail on einval or eperm if non-root. + +fs.chown = chownFix(fs.chown) +fs.fchown = chownFix(fs.fchown) +fs.lchown = chownFix(fs.lchown) + +fs.chownSync = chownFixSync(fs.chownSync) +fs.fchownSync = chownFixSync(fs.fchownSync) +fs.lchownSync = chownFixSync(fs.lchownSync) + +function chownFix (orig) { + if (!orig) return orig + return function (target, uid, gid, cb) { + return orig.call(fs, target, uid, gid, function (er, res) { + if (chownErOk(er)) er = null + cb(er, res) + }) + } +} + +function chownFixSync (orig) { + if (!orig) return orig + return function (target, uid, gid) { + try { + return orig.call(fs, target, uid, gid) + } catch (er) { + if (!chownErOk(er)) throw er + } + } +} + +function chownErOk (er) { + // if there's no getuid, or if getuid() is something other than 0, + // and the error is EINVAL or EPERM, then just ignore it. + // This specific case is a silent failure in cp, install, tar, + // and most other unix tools that manage permissions. + // When running as root, or if other types of errors are encountered, + // then it's strict. + if (!er || (!process.getuid || process.getuid() !== 0) + && (er.code === "EINVAL" || er.code === "EPERM")) return true +} + + + +// on Windows, A/V software can lock the directory, causing this +// to fail with an EACCES or EPERM if the directory contains newly +// created files. Try again on failure, for up to 1 second. +if (process.platform === "win32") { + var rename_ = fs.rename + fs.rename = function rename (from, to, cb) { + var start = Date.now() + rename_(from, to, function CB (er) { + if (er + && (er.code === "EACCES" || er.code === "EPERM") + && Date.now() - start < 1000) { + return rename_(from, to, CB) + } + cb(er) + }) + } +} diff --git a/deps/npm/node_modules/graceful-fs/package.json b/deps/npm/node_modules/graceful-fs/package.json index ec72affa13..757d3014c8 100644 --- a/deps/npm/node_modules/graceful-fs/package.json +++ b/deps/npm/node_modules/graceful-fs/package.json @@ -1,18 +1,31 @@ { - "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me" + }, "name": "graceful-fs", "description": "fs monkey-patching to avoid EMFILE and other problems", - "version": "1.1.2", + "version": "1.1.8", "repository": { "type": "git", "url": "git://github.com/isaacs/node-graceful-fs.git" }, "main": "graceful-fs.js", "engines": { - "node": "0.4 || 0.5 || 0.6" + "node": ">=0.4.0" }, - "dependencies": { - "fast-list": "1" + "devDependencies": {}, + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" }, - "devDependencies": {} + "_id": "graceful-fs@1.1.8", + "dependencies": {}, + "optionalDependencies": {}, + "_engineSupported": true, + "_npmVersion": "1.1.10", + "_nodeVersion": "v0.7.7-pre", + "_defaultsLoaded": true, + "_from": "graceful-fs@~1.1.1" } diff --git a/deps/npm/node_modules/inherits/LICENSE b/deps/npm/node_modules/inherits/LICENSE index c78c4f6618..5a8e332545 100644 --- a/deps/npm/node_modules/inherits/LICENSE +++ b/deps/npm/node_modules/inherits/LICENSE @@ -1,26 +1,14 @@ -Copyright 2011 Isaac Z. Schlueter (the "Author") -All rights reserved. + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 -General Public Obviousness License + Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> -The Author asserts that this software and associated documentation -files (the "Software"), while the Author's original creation, is -nonetheless obvious, trivial, unpatentable, and implied by the -context in which the software was created. If you sat down and -thought about the problem for an hour or less, you'd probably -come up with exactly this solution. + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. -Permission is granted to use this software in any way -whatsoever, with the following restriction: + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION -You may not release the Software under a more restrictive license -than this one. + 0. You just DO WHAT THE FUCK YOU WANT TO. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. diff --git a/deps/npm/node_modules/inherits/package.json b/deps/npm/node_modules/inherits/package.json index 7dc32771b9..b5499c1ec8 100644 --- a/deps/npm/node_modules/inherits/package.json +++ b/deps/npm/node_modules/inherits/package.json @@ -1,8 +1,44 @@ -{ "name" : "inherits" -, "description": "A tiny simple way to do classic inheritance in js" -, "version" : "1.0.0" -, "keywords" : ["inheritance", "class", "klass", "oop", "object-oriented"] -, "main" : "./inherits.js" -, "repository" : "https://github.com/isaacs/inherits" -, "license": { "type": "GPOL", "url": "https://raw.github.com/isaacs/inherits/master/LICENSE" } -, "author" : "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)" } +{ + "name": "inherits", + "description": "A tiny simple way to do classic inheritance in js", + "version": "1.0.0", + "keywords": [ + "inheritance", + "class", + "klass", + "oop", + "object-oriented" + ], + "main": "./inherits.js", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/inherits.git" + }, + "license": { + "type": "WTFPL2" + }, + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "_id": "inherits@1.0.0", + "dependencies": {}, + "devDependencies": {}, + "optionalDependencies": {}, + "engines": { + "node": "*" + }, + "_engineSupported": true, + "_npmVersion": "1.1.10", + "_nodeVersion": "v0.7.7-pre", + "_defaultsLoaded": true, + "dist": { + "shasum": "12dbc03c9f7c203289234b214a7d05a311d71450" + }, + "_from": "git://github.com/isaacs/inherits" +} diff --git a/deps/npm/node_modules/minimatch/README.md b/deps/npm/node_modules/minimatch/README.md index d5f97234cd..6fd07d2e97 100644 --- a/deps/npm/node_modules/minimatch/README.md +++ b/deps/npm/node_modules/minimatch/README.md @@ -60,11 +60,12 @@ thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but `a/**b` will not. **Note that this is different from the way that `**` is handled by ruby's `Dir` class.** -If an escaped pattern has no matches, and the `null` flag is not set, +If an escaped pattern has no matches, and the `nonull` flag is set, then minimatch.match returns the pattern as-provided, rather than interpreting the character escapes. For example, `minimatch.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than -`"*a?"`. +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. If brace expansion is not disabled, then it is performed before any other interpretation of the glob pattern. Thus, a pattern like @@ -147,8 +148,8 @@ var javascripts = fileList.filter(minimatch.filter("*.js", {matchBase: true})) ### minimatch.match(list, pattern, options) Match against the list of -files, in the style of fnmatch or glob. If nothing is matched, then -return the pattern (unless `{ null: true }` in the options.) +files, in the style of fnmatch or glob. If nothing is matched, and +options.nonull is set, then return a list containing the pattern itself. ```javascript var javascripts = minimatch.match(fileList, "*.js", {matchBase: true})) @@ -210,3 +211,8 @@ comment. ### nonegate Suppress the behavior of treating a leading `!` character as negation. + +### flipNegate + +Returns from negate expressions the same as if they were not negated. +(Ie, true on a hit, false on a miss.) diff --git a/deps/npm/node_modules/minimatch/minimatch.js b/deps/npm/node_modules/minimatch/minimatch.js index 768c8ebac7..1ca08104ee 100644 --- a/deps/npm/node_modules/minimatch/minimatch.js +++ b/deps/npm/node_modules/minimatch/minimatch.js @@ -4,7 +4,6 @@ minimatch.Minimatch = Minimatch var LRU = require("lru-cache") , cache = minimatch.cache = new LRU(100) , GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} - , pathSplit = process.platform === "win32" ? /\\|\// : "/" var path = require("path") // any single thing other than / @@ -130,7 +129,7 @@ function make () { this.parseNegate() // step 2: expand braces - var set = this.braceExpand() + var set = this.globSet = this.braceExpand() if (options.debug) console.error(this.pattern, set) @@ -139,36 +138,10 @@ function make () { // These will be regexps, except in the case of "**", which is // set to the GLOBSTAR object for globstar behavior, // and will not contain any / characters - set = set.map(function (s) { + set = this.globParts = set.map(function (s) { return s.split(slashSplit) }) - // step 4: if we have a defined root, then patterns starting with "" - // get attached to that. If we have a defined cwd, then patterns - // *not* starting with "" get attached to that. - // Exception 1: on windows, a pattern like //\?/c:/ or c:/ will - // not get anything prefixed to it. - // Exception 2: If matchBase is set, and it's just a filename, - // then don't prefix anything onto it, since it'll only match - // files with that basename anyhow. - set = set.map(function (p) { - if (process.platform === "win32" && - ( (p[0] === "" && p[1] === "" && p[2] === "\\?") // unc - || (p[0].match(/^[a-zA-Z]:$/)) )) { - return p - } - if (options.matchBase && p.length === 1) return p - // do prefixing. - if (options.root && p[0] === "") { - return options.root.split(pathSplit).concat(p) - } - if (options.cwd && p[0] !== "") { - return options.cwd.split(pathSplit).concat(p) - } - return p - }) - - if (options.debug) console.error(this.pattern, set) // glob --> regexps @@ -545,7 +518,8 @@ function parse (pattern, isSub) { patternListStack.push({ type: plType , start: i - 1 , reStart: re.length }) - re += stateChar === "!" ? "(?!" : "(?:" + // negation is (?:(?!js)[^/]*) + re += stateChar === "!" ? "(?:(?!" : "(?:" stateChar = false continue @@ -558,11 +532,15 @@ function parse (pattern, isSub) { hasMagic = true re += ")" plType = patternListStack.pop().type + // negation is (?:(?!js)[^/]*) + // The others are (?:<pattern>)<type> switch (plType) { + case "!": + re += "[^/]*?)" + break case "?": case "+": case "*": re += plType - case "!": // already handled by the start case "@": break // the default anyway } continue @@ -786,13 +764,12 @@ function match (f, partial) { if (this.comment) return false if (this.empty) return f === "" + if (f === "/" && partial) return true + var options = this.options // first, normalize any slash-separated path parts. // f = path.normalize(f) - var absolute = isAbsolute(f) - - // console.error(this.pattern, f, absolute) // windows: need to use /, not \ // On other platforms, \ is a valid (albeit bad) filename char. @@ -802,7 +779,9 @@ function match (f, partial) { // treat the test path as a set of pathparts. f = f.split(slashSplit) - // console.error(this.pattern, "split", f) + if (options.debug) { + console.error(this.pattern, "split", f) + } // just ONE of the pattern sets in this.set needs to match // in order for it to be valid. If negating, then just one @@ -816,12 +795,14 @@ function match (f, partial) { var pattern = set[i] var hit = this.matchOne(f, pattern, partial) if (hit) { + if (options.flipNegate) return true return !this.negate } } // didn't get any hits. this is success if it's a negative // pattern, failure otherwise. + if (options.flipNegate) return false return this.negate } @@ -1003,19 +984,3 @@ function globUnescape (s) { function regExpEscape (s) { return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&") } - - -function isAbsolute (p) { - if (process.platform !== "win32") return p.charAt(0) === "/" - - // yanked from node/lib/path.js - var splitDeviceRe = - /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?([\\\/])?([\s\S]*?)$/ - - var result = p.match(splitDeviceRe) - , device = result[1] || "" - , isUnc = device && device.charAt(1) !== ":" - , isAbs = !!result[2] || isUnc // UNC always absolute - - return isAbs -} diff --git a/deps/npm/node_modules/minimatch/package.json b/deps/npm/node_modules/minimatch/package.json index 92ccac5fb9..1bcb3d43e6 100644 --- a/deps/npm/node_modules/minimatch/package.json +++ b/deps/npm/node_modules/minimatch/package.json @@ -1,8 +1,12 @@ { - "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me" + }, "name": "minimatch", "description": "a glob matcher in javascript", - "version": "0.1.3", + "version": "0.2.2", "repository": { "type": "git", "url": "git://github.com/isaacs/minimatch.git" @@ -18,12 +22,23 @@ "lru-cache": "~1.0.5" }, "devDependencies": { - "tap": "~0.1.3" + "tap": "" }, - "licenses" : [ + "licenses": [ { - "type" : "MIT", - "url" : "http://github.com/isaacs/minimatch/raw/master/LICENSE" + "type": "MIT", + "url": "http://github.com/isaacs/minimatch/raw/master/LICENSE" } - ] + ], + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "_id": "minimatch@0.2.2", + "optionalDependencies": {}, + "_engineSupported": true, + "_npmVersion": "1.1.12", + "_nodeVersion": "v0.7.7-pre", + "_defaultsLoaded": true, + "_from": "minimatch@0" } diff --git a/deps/npm/node_modules/mkdirp/README.markdown b/deps/npm/node_modules/mkdirp/README.markdown index 0393c4ea53..b4dd75fdc6 100644 --- a/deps/npm/node_modules/mkdirp/README.markdown +++ b/deps/npm/node_modules/mkdirp/README.markdown @@ -3,14 +3,14 @@ mkdirp Like `mkdir -p`, but in node.js! -Example +example ======= pow.js ------ var mkdirp = require('mkdirp'); - mkdirp('/tmp/foo/bar/baz', 0755, function (err) { + mkdirp('/tmp/foo/bar/baz', function (err) { if (err) console.error(err) else console.log('pow!') }); @@ -19,3 +19,36 @@ Output pow! And now /tmp/foo/bar/baz exists, huzzah! + +methods +======= + +var mkdirp = require('mkdirp'); + +mkdirp(dir, mode, cb) +--------------------- + +Create a new directory and any necessary subdirectories at `dir` with octal +permission string `mode`. + +If `mode` isn't specified, it defaults to `0777 & (~process.umask())`. + +mkdirp.sync(dir, mode) +---------------------- + +Synchronously create a new directory and any necessary subdirectories at `dir` +with octal permission string `mode`. + +If `mode` isn't specified, it defaults to `0777 & (~process.umask())`. + +install +======= + +With [npm](http://npmjs.org) do: + + npm install mkdirp + +license +======= + +MIT/X11 diff --git a/deps/npm/node_modules/mkdirp/index.js b/deps/npm/node_modules/mkdirp/index.js index 6602801463..871488f63f 100644 --- a/deps/npm/node_modules/mkdirp/index.js +++ b/deps/npm/node_modules/mkdirp/index.js @@ -4,17 +4,28 @@ var fs = require('fs'); module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP; function mkdirP (p, mode, f) { + if (typeof mode === 'function' || mode === undefined) { + f = mode; + mode = 0777 & (~process.umask()); + } + + // secret passalong argument. + var made = arguments[3] || null; + var cb = f || function () {}; if (typeof mode === 'string') mode = parseInt(mode, 8); p = path.resolve(p); fs.mkdir(p, mode, function (er) { - if (!er) return cb(); + if (!er) { + made = made || p; + return cb(null, made); + } switch (er.code) { case 'ENOENT': - mkdirP(path.dirname(p), mode, function (er) { - if (er) cb(er); - else mkdirP(p, mode, cb); + mkdirP(path.dirname(p), mode, function (er, made) { + if (er) cb(er, made); + else mkdirP(p, mode, cb, made); }); break; @@ -22,15 +33,55 @@ function mkdirP (p, mode, f) { fs.stat(p, function (er2, stat) { // if the stat fails, then that's super weird. // let the original EEXIST be the failure reason. - if (er2 || !stat.isDirectory()) cb(er) - else if ((stat.mode & 0777) !== mode) fs.chmod(p, mode, cb); - else cb(); + if (er2 || !stat.isDirectory()) cb(er, made) + else cb(null, made); }); break; default: - cb(er); + cb(er, made); break; } }); } + +mkdirP.sync = function sync (p, mode) { + if (mode === undefined) { + mode = 0777 & (~process.umask()); + } + + // secret passalong argument + var made = arguments[2] || null; + + if (typeof mode === 'string') mode = parseInt(mode, 8); + p = path.resolve(p); + + try { + fs.mkdirSync(p, mode); + made = made || p; + } + catch (err0) { + switch (err0.code) { + case 'ENOENT' : + made = sync(path.dirname(p), mode, made); + sync(p, mode, made); + break; + + case 'EEXIST' : + var stat; + try { + stat = fs.statSync(p); + } + catch (err1) { + throw err0; + } + if (!stat.isDirectory()) throw err0; + break; + default : + throw err0 + break; + } + } + + return made; +}; diff --git a/deps/npm/node_modules/mkdirp/package.json b/deps/npm/node_modules/mkdirp/package.json index 99149f747d..2a40503c5f 100644 --- a/deps/npm/node_modules/mkdirp/package.json +++ b/deps/npm/node_modules/mkdirp/package.json @@ -1,23 +1,44 @@ { - "name" : "mkdirp", - "description" : "Recursively mkdir, like `mkdir -p`", - "version" : "0.1.0", - "author" : "James Halliday <mail@substack.net> (http://substack.net)", - "main" : "./index", - "keywords" : [ - "mkdir", - "directory" - ], - "repository" : { - "type" : "git", - "url" : "http://github.com/substack/node-mkdirp.git" - }, - "scripts" : { - "test" : "tap test/*.js" - }, - "devDependencies" : { - "tap" : "0.0.x" - }, - "license" : "MIT/X11", - "engines": { "node": "*" } + "name": "mkdirp", + "description": "Recursively mkdir, like `mkdir -p`", + "version": "0.3.0", + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "main": "./index", + "keywords": [ + "mkdir", + "directory" + ], + "repository": { + "type": "git", + "url": "git://github.com/substack/node-mkdirp.git" + }, + "scripts": { + "test": "tap test/*.js" + }, + "devDependencies": { + "tap": "0.2" + }, + "license": "MIT/X11", + "engines": { + "node": "*" + }, + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "_id": "mkdirp@0.3.0", + "dependencies": {}, + "optionalDependencies": {}, + "_engineSupported": true, + "_npmVersion": "1.1.13", + "_nodeVersion": "v0.7.7-pre", + "_defaultsLoaded": true, + "dist": { + "shasum": "a3cc6816e78b84f570caf9d95cb7368dc5d0bab8" + }, + "_from": "../mkdirp" } diff --git a/deps/npm/node_modules/read/lib/read.js b/deps/npm/node_modules/read/lib/read.js index 246044bcd9..ba2ef0ae78 100644 --- a/deps/npm/node_modules/read/lib/read.js +++ b/deps/npm/node_modules/read/lib/read.js @@ -5,6 +5,14 @@ var buffer = "" , tty = require("tty") , StringDecoder = require("string_decoder").StringDecoder +function raw (mode) { + try { + process.stdin.setRawMode(mode) + } catch (e) { + tty.setRawMode(mode) + } +} + function read (opts, cb) { if (!cb) cb = opts, opts = {} @@ -25,7 +33,7 @@ function read (opts, cb) { cb = (function (cb) { var called = false var t = setTimeout(function () { - tty.setRawMode(false) + raw(false) process.stdout.write("\n") if (def) done(null, def) else done(new Error("timeout")) @@ -109,7 +117,7 @@ function rawRead (def, timeout, delim, silent, num, cb) { , val = "" , decoder = new StringDecoder - tty.setRawMode(true) + raw(true) stdin.resume() stdin.on("error", cb) stdin.on("data", function D (c) { @@ -122,7 +130,7 @@ function rawRead (def, timeout, delim, silent, num, cb) { case "\u0004": // EOF case delim: - tty.setRawMode(false) + raw(false) stdin.removeListener("data", D) stdin.removeListener("error", cb) val = val.trim() || def @@ -131,7 +139,7 @@ function rawRead (def, timeout, delim, silent, num, cb) { return cb(null, val) case "\u0003": case "\0": // ^C or other signal abort - tty.setRawMode(false) + raw(false) stdin.removeListener("data", D) stdin.removeListener("error", cb) stdin.pause() diff --git a/deps/npm/node_modules/read/package.json b/deps/npm/node_modules/read/package.json index bc05577aac..f206a719b3 100644 --- a/deps/npm/node_modules/read/package.json +++ b/deps/npm/node_modules/read/package.json @@ -1,16 +1,28 @@ { "name": "read", - "version": "0.0.1", + "version": "0.0.2", "main": "lib/read.js", "dependencies": {}, "devDependencies": {}, "engines": { "node": ">=0.6" }, - "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, "description": "read(1) for node programs", "repository": { "type": "git", "url": "git://github.com/isaacs/read.git" - } + }, + "license": "BSD", + "_id": "read@0.0.2", + "optionalDependencies": {}, + "_engineSupported": true, + "_npmVersion": "1.1.15", + "_nodeVersion": "v0.7.7", + "_defaultsLoaded": true, + "_from": "read@0" } diff --git a/deps/npm/node_modules/request/README.md b/deps/npm/node_modules/request/README.md index 4ea89f794a..e5839b50e6 100644 --- a/deps/npm/node_modules/request/README.md +++ b/deps/npm/node_modules/request/README.md @@ -38,7 +38,7 @@ request('http://google.com/doodle.png').pipe(fs.createWriteStream('doodle.png')) You can also stream a file to a PUT or POST request. This method will also check the file extension against a mapping of file extensions to content-types, in this case `application/json`, and use the proper content-type in the PUT request if one is not already provided in the headers. ```javascript -fs.readStream('file.json').pipe(request.put('http://mysite.com/obj.json')) +fs.createReadStream('file.json').pipe(request.put('http://mysite.com/obj.json')) ``` Request can also pipe to itself. When doing so the content-type and content-length will be preserved in the PUT headers. @@ -146,6 +146,7 @@ request.post({url:url, oauth:oauth}, function (e, r, body) { The first argument can be either a url or an options object. The only required option is uri, all others are optional. * `uri` || `url` - fully qualified uri or a parsed url object from url.parse() +* `qs` - object containing querystring values to be appended to the uri * `method` - http method, defaults to GET * `headers` - http headers, defaults to {} * `body` - entity body for POST and PUT requests. Must be buffer or string. @@ -153,6 +154,7 @@ The first argument can be either a url or an options object. The only required o * `json` - sets `body` but to JSON representation of value and adds `Content-type: application/json` header. * `multipart` - (experimental) array of objects which contains their own headers and `body` attribute. Sends `multipart/related` request. See example below. * `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. diff --git a/deps/npm/node_modules/request/forever.js b/deps/npm/node_modules/request/forever.js index e6531a21b3..ac853c0d28 100644 --- a/deps/npm/node_modules/request/forever.js +++ b/deps/npm/node_modules/request/forever.js @@ -1,8 +1,11 @@ module.exports = ForeverAgent +ForeverAgent.SSL = ForeverAgentSSL var util = require('util') , Agent = require('http').Agent , net = require('net') + , tls = require('tls') + , AgentSSL = require('https').Agent function ForeverAgent(options) { var self = this @@ -34,12 +37,14 @@ function ForeverAgent(options) { socket.destroy(); } }) - self.createConnection = net.createConnection + } util.inherits(ForeverAgent, Agent) ForeverAgent.defaultMinSockets = 5 + +ForeverAgent.prototype.createConnection = net.createConnection ForeverAgent.prototype.addRequestNoreuse = Agent.prototype.addRequest ForeverAgent.prototype.addRequest = function(req, host, port) { var name = host + ':' + port @@ -82,3 +87,17 @@ ForeverAgent.prototype.removeSocket = function(s, name, host, port) { this.createSocket(name, host, port).emit('free'); } } + +function ForeverAgentSSL (options) { + ForeverAgent.call(this, options) +} +util.inherits(ForeverAgentSSL, ForeverAgent) + +ForeverAgentSSL.prototype.createConnection = createConnectionSSL +ForeverAgentSSL.prototype.addRequestNoreuse = AgentSSL.prototype.addRequest + +function createConnectionSSL (port, host, options) { + options.port = port + options.host = host + return tls.connect(options) +} diff --git a/deps/npm/node_modules/request/main.js b/deps/npm/node_modules/request/main.js index a25393ec3e..5a6bd9eb04 100644 --- a/deps/npm/node_modules/request/main.js +++ b/deps/npm/node_modules/request/main.js @@ -1,4 +1,4 @@ -// Copyright 2010-2011 Mikeal Rogers +// Copyright 2010-2012 Mikeal Rogers // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ var http = require('http') , Cookie = require('./vendor/cookie') , CookieJar = require('./vendor/cookie/jar') , cookieJar = new CookieJar + , tunnel = require('./tunnel') ; if (process.logging) { @@ -67,7 +68,9 @@ function isReadStream (rs) { function copy (obj) { var o = {} - for (var i in obj) o[i] = obj[i] + Object.keys(obj).forEach(function (i) { + o[i] = obj[i] + }) return o } @@ -83,24 +86,31 @@ function Request (options) { if (typeof options === 'string') { options = {uri:options} } - + + var reserved = Object.keys(Request.prototype) for (var i in options) { - this[i] = options[i] + if (reserved.indexOf(i) === -1) { + this[i] = options[i] + } else { + if (typeof options[i] === 'function') { + delete options[i] + } + } } - if (!this.pool) this.pool = globalPool - this.dests = [] - this.__isRequestRequest = true + options = copy(options) + + this.init(options) } util.inherits(Request, stream.Stream) -Request.prototype.getAgent = function (host, port) { - if (!this.pool[host+':'+port]) { - this.pool[host+':'+port] = new this.httpModule.Agent({host:host, port:port}) - } - return this.pool[host+':'+port] -} -Request.prototype.request = function () { +Request.prototype.init = function (options) { var self = this - + + if (!options) options = {} + + if (!self.pool) self.pool = globalPool + self.dests = [] + self.__isRequestRequest = true + // Protect against double callback if (!self._callback && self.callback) { self._callback = self.callback @@ -124,17 +134,32 @@ Request.prototype.request = function () { } if (self.proxy) { if (typeof self.proxy == 'string') self.proxy = url.parse(self.proxy) + + // do the HTTP CONNECT dance using koichik/node-tunnel + if (http.globalAgent && self.uri.protocol === "https:") { + var tunnelFn = self.proxy.protocol === "http:" + ? tunnel.httpsOverHttp : tunnel.httpsOverHttps + + var tunnelOptions = { proxy: { host: self.proxy.hostname + , port: +self.proxy.port + , proxyAuth: self.proxy.auth } + , ca: this.ca } + + self.agent = tunnelFn(tunnelOptions) + self.tunnel = true + } } self._redirectsFollowed = self._redirectsFollowed || 0 self.maxRedirects = (self.maxRedirects !== undefined) ? self.maxRedirects : 10 self.followRedirect = (self.followRedirect !== undefined) ? self.followRedirect : true - if (self.followRedirect) + self.followAllRedirects = (self.followAllRedirects !== undefined) ? self.followAllRedirects : false; + if (self.followRedirect || self.followAllRedirects) self.redirects = self.redirects || [] self.headers = self.headers ? copy(self.headers) : {} - var setHost = false + self.setHost = false if (!self.headers.host) { self.headers.host = self.uri.hostname if (self.uri.port) { @@ -142,27 +167,10 @@ Request.prototype.request = function () { !(self.uri.port === 443 && self.uri.protocol === 'https:') ) self.headers.host += (':'+self.uri.port) } - setHost = true - } - - if (self.jar === false) { - // disable cookies - var cookies = false; - self._disableCookies = true; - } else if (self.jar) { - // fetch cookie from the user defined cookie jar - var cookies = self.jar.get({ url: self.uri.href }) - } else { - // fetch cookie from the global cookie jar - var cookies = cookieJar.get({ url: self.uri.href }) - } - if (cookies) { - var cookieString = cookies.map(function (c) { - return c.name + "=" + c.value; - }).join("; "); - - self.headers.Cookie = cookieString; + self.setHost = true } + + self.jar(self._jar || options.jar) if (!self.uri.pathname) {self.uri.pathname = '/'} if (!self.uri.port) { @@ -170,7 +178,7 @@ Request.prototype.request = function () { else if (self.uri.protocol == 'https:') {self.uri.port = 443} } - if (self.proxy) { + if (self.proxy && !self.tunnel) { self.port = self.proxy.port self.host = self.proxy.hostname } else { @@ -183,74 +191,43 @@ Request.prototype.request = function () { delete self.callback } - var clientErrorHandler = function (error) { - if (setHost) delete self.headers.host - if (self.req._reusedSocket && error.code === 'ECONNRESET') { - self.agent = {addRequest: ForeverAgent.prototype.addRequestNoreuse.bind(self.agent)} + self.clientErrorHandler = function (error) { + if (self._aborted) return + + if (self.setHost) delete self.headers.host + if (self.req._reusedSocket && error.code === 'ECONNRESET' + && self.agent.addRequestNoreuse) { + self.agent = { addRequest: self.agent.addRequestNoreuse.bind(self.agent) } self.start() self.req.end() return } - if (self.timeout && self.timeoutTimer) clearTimeout(self.timeoutTimer) + if (self.timeout && self.timeoutTimer) { + 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 (self.form) { - self.headers['content-type'] = 'application/x-www-form-urlencoded; charset=utf-8' - self.body = qs.stringify(self.form).toString('utf8') - } - - if (self.oauth) { - var form - if (self.headers['content-type'] && - self.headers['content-type'].slice(0, 'application/x-www-form-urlencoded'.length) === - 'application/x-www-form-urlencoded' - ) { - form = qs.parse(self.body) - } - if (self.uri.query) { - form = qs.parse(self.uri.query) - } - if (!form) form = {} - var oa = {} - for (var i in form) oa[i] = form[i] - for (var i in self.oauth) oa['oauth_'+i] = self.oauth[i] - if (!oa.oauth_version) oa.oauth_version = '1.0' - if (!oa.oauth_timestamp) oa.oauth_timestamp = Math.floor( (new Date()).getTime() / 1000 ).toString() - if (!oa.oauth_nonce) oa.oauth_nonce = uuid().replace(/-/g, '') - - oa.oauth_signature_method = 'HMAC-SHA1' - - var consumer_secret = oa.oauth_consumer_secret - delete oa.oauth_consumer_secret - var token_secret = oa.oauth_token_secret - delete oa.oauth_token_secret - - var baseurl = self.uri.protocol + '//' + self.uri.host + self.uri.pathname - var signature = oauth.hmacsign(self.method, baseurl, oa, consumer_secret, token_secret) - - // oa.oauth_signature = signature - for (var i in form) { - if ( i.slice(0, 'oauth_') in self.oauth) { - // skip - } else { - delete oa['oauth_'+i] - } - } - self.headers.authorization = - 'OAuth '+Object.keys(oa).sort().map(function (i) {return i+'="'+oauth.rfc3986(oa[i])+'"'}).join(',') - self.headers.authorization += ',oauth_signature="'+oauth.rfc3986(signature)+'"' + if (options.form) { + self.form(options.form) + } + + if (options.oauth) { + self.oauth(options.oauth) } if (self.uri.auth && !self.headers.authorization) { self.headers.authorization = "Basic " + toBase64(self.uri.auth.split(':').map(function(item){ return qs.unescape(item)}).join(':')) } - if (self.proxy && self.proxy.auth && !self.headers['proxy-authorization']) { + if (self.proxy && self.proxy.auth && !self.headers['proxy-authorization'] && !self.tunnel) { self.headers['proxy-authorization'] = "Basic " + toBase64(self.proxy.auth.split(':').map(function(item){ return qs.unescape(item)}).join(':')) } + if (options.qs) self.qs(options.qs) + if (self.uri.path) { self.path = self.uri.path } else { @@ -259,41 +236,12 @@ Request.prototype.request = function () { if (self.path.length === 0) self.path = '/' - if (self.proxy) self.path = (self.uri.protocol + '//' + self.uri.host + self.path) - - if (self.json) { - self.headers['content-type'] = 'application/json' - if (typeof self.json === 'boolean') { - if (typeof self.body === 'object') self.body = JSON.stringify(self.body) - } else { - self.body = JSON.stringify(self.json) - } - - } else if (self.multipart) { - self.body = [] - - if (!self.headers['content-type']) { - self.headers['content-type'] = 'multipart/related;boundary="frontier"'; - } else { - self.headers['content-type'] = self.headers['content-type'].split(';')[0] + ';boundary="frontier"'; - } - - if (!self.multipart.forEach) throw new Error('Argument error, options.multipart.') + if (self.proxy && !self.tunnel) self.path = (self.uri.protocol + '//' + self.uri.host + self.path) - self.multipart.forEach(function (part) { - var body = part.body - if(!body) throw Error('Body attribute missing in multipart.') - delete part.body - var preamble = '--frontier\r\n' - Object.keys(part).forEach(function(key){ - preamble += key + ': ' + part[key] + '\r\n' - }) - preamble += '\r\n' - self.body.push(new Buffer(preamble)) - self.body.push(new Buffer(body)) - self.body.push(new Buffer('\r\n')) - }) - self.body.push(new Buffer('--frontier--')) + if (options.json) { + self.json(options.json) + } else if (options.multipart) { + self.multipart(options.multipart) } if (self.body) { @@ -317,7 +265,7 @@ Request.prototype.request = function () { } } - var protocol = self.proxy ? self.proxy.protocol : self.uri.protocol + var protocol = self.proxy && !self.tunnel ? self.proxy.protocol : self.uri.protocol , defaultModules = {'http:':http, 'https:':https} , httpModules = self.httpModules || {} ; @@ -325,177 +273,34 @@ Request.prototype.request = function () { if (!self.httpModule) throw new Error("Invalid protocol") + if (options.ca) self.ca = options.ca + + if (!self.agent) { + if (options.agentOptions) self.agentOptions = options.agentOptions + + if (options.agentClass) { + self.agentClass = options.agentClass + } else if (options.forever) { + self.agentClass = protocol === 'http:' ? ForeverAgent : ForeverAgent.SSL + } else { + self.agentClass = self.httpModule.Agent + } + } + if (self.pool === false) { self.agent = false } else { + self.agent = self.agent || self.getAgent() if (self.maxSockets) { // Don't use our pooling if node has the refactored client - self.agent = self.agent || self.httpModule.globalAgent || self.getAgent(self.host, self.port) self.agent.maxSockets = self.maxSockets } if (self.pool.maxSockets) { // Don't use our pooling if node has the refactored client - self.agent = self.agent || self.httpModule.globalAgent || self.getAgent(self.host, self.port) self.agent.maxSockets = self.pool.maxSockets } } - self.start = function () { - self._started = true - self.method = self.method || 'GET' - self.href = self.uri.href - if (log) log('%method %href', self) - self.req = self.httpModule.request(self, function (response) { - self.response = response - response.request = self - - if (self.httpModule === https && - self.strictSSL && - !response.client.authorized) { - var sslErr = response.client.authorizationError - self.emit('error', new Error('SSL Error: '+ sslErr)) - return - } - - if (setHost) delete self.headers.host - if (self.timeout && self.timeoutTimer) clearTimeout(self.timeoutTimer) - - if (response.headers['set-cookie'] && (!self._disableCookies)) { - response.headers['set-cookie'].forEach(function(cookie) { - if (self.jar) self.jar.add(new Cookie(cookie)) - else cookieJar.add(new Cookie(cookie)) - }) - } - - if (response.statusCode >= 300 && - response.statusCode < 400 && - self.followRedirect && - self.method !== 'PUT' && - self.method !== 'POST' && - response.headers.location) { - if (self._redirectsFollowed >= self.maxRedirects) { - self.emit('error', new Error("Exceeded maxRedirects. Probably stuck in a redirect loop.")) - return - } - self._redirectsFollowed += 1 - - if (!isUrl.test(response.headers.location)) { - response.headers.location = url.resolve(self.uri.href, response.headers.location) - } - self.uri = response.headers.location - self.redirects.push( - { statusCode : response.statusCode - , redirectUri: response.headers.location - } - ) - delete self.req - delete self.agent - delete self._started - if (self.headers) { - delete self.headers.host - } - if (log) log('Redirect to %uri', self) - request(self, self.callback) - return // Ignore the rest of the response - } else { - self._redirectsFollowed = self._redirectsFollowed || 0 - // Be a good stream and emit end when the response is finished. - // Hack to emit end on close because of a core bug that never fires end - response.on('close', function () { - if (!self._ended) self.response.emit('end') - }) - - if (self.encoding) { - if (self.dests.length !== 0) { - console.error("Ingoring encoding parameter as this stream is being piped to another stream which makes the encoding option invalid.") - } else { - response.setEncoding(self.encoding) - } - } - - self.pipeDest = function (dest) { - if (dest.headers) { - dest.headers['content-type'] = response.headers['content-type'] - if (response.headers['content-length']) { - dest.headers['content-length'] = response.headers['content-length'] - } - } - if (dest.setHeader) { - for (var i in response.headers) { - dest.setHeader(i, response.headers[i]) - } - dest.statusCode = response.statusCode - } - if (self.pipefilter) self.pipefilter(response, dest) - } - - self.dests.forEach(function (dest) { - self.pipeDest(dest) - }) - - response.on("data", function (chunk) { - self._destdata = true - self.emit("data", chunk) - }) - response.on("end", function (chunk) { - self._ended = true - self.emit("end", chunk) - }) - response.on("close", function () {self.emit("close")}) - - self.emit('response', response) - - if (self.onResponse) { - self.onResponse(null, response) - } - if (self.callback) { - var buffer = [] - var bodyLen = 0 - self.on("data", function (chunk) { - buffer.push(chunk) - bodyLen += chunk.length - }) - self.on("end", function () { - if (buffer.length && Buffer.isBuffer(buffer[0])) { - var body = new Buffer(bodyLen) - var i = 0 - buffer.forEach(function (chunk) { - chunk.copy(body, i, 0, chunk.length) - i += chunk.length - }) - if (self.encoding === null) { - response.body = body - } else { - response.body = body.toString() - } - } else if (buffer.length) { - response.body = buffer.join('') - } - - if (self.json) { - try { - response.body = JSON.parse(response.body) - } catch (e) {} - } - - self.callback(null, response, response.body) - }) - } - } - }) - - if (self.timeout && !self.timeoutTimer) { - self.timeoutTimer = setTimeout(function() { - self.req.abort() - var e = new Error("ETIMEDOUT") - e.code = "ETIMEDOUT" - self.emit("error", e) - }, self.timeout) - } - - self.req.on('error', clientErrorHandler) - } - self.once('pipe', function (src) { if (self.ntick) throw new Error("You cannot pipe to this stream after the first nextTick() after creation of the request stream.") self.src = src @@ -521,6 +326,8 @@ Request.prototype.request = function () { }) process.nextTick(function () { + if (self._aborted) return + if (self.body) { if (Array.isArray(self.body)) { self.body.forEach(function(part) { @@ -540,47 +347,538 @@ Request.prototype.request = function () { self.ntick = true }) } -Request.prototype.pipe = function (dest) { + +// 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 = {} + if (this.agentOptions) { + for (var i in this.agentOptions) { + options[i] = this.agentOptions[i] + } + } + if (this.ca) options.ca = this.ca + + var poolKey = '' + + // different types of agents are in different pools + if (Agent !== this.httpModule.Agent) { + poolKey += Agent.name + } + + if (!this.httpModule.globalAgent) { + // node 0.4.x + options.host = this.host + options.port = this.port + if (poolKey) poolKey += ':' + 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 (poolKey) poolKey += ':' + poolKey += options.ca + } + + if (!poolKey && Agent === this.httpModule.Agent && this.httpModule.globalAgent) { + // not doing anything special. Use the globalAgent + 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] + + return this.pool[poolKey] = new Agent(options) +} + +Request.prototype.start = function () { + var self = this + + if (self._aborted) return + + self._started = true + self.method = self.method || 'GET' + self.href = self.uri.href + if (log) log('%method %href', self) + self.req = self.httpModule.request(self, function (response) { + if (self._aborted) return + if (self._paused) response.pause() + + self.response = response + response.request = self + + if (self.httpModule === https && + self.strictSSL && + !response.client.authorized) { + var sslErr = response.client.authorizationError + self.emit('error', new Error('SSL Error: '+ sslErr)) + return + } + + if (self.setHost) delete self.headers.host + if (self.timeout && self.timeoutTimer) { + clearTimeout(self.timeoutTimer); + self.timeoutTimer = null; + } + + if (response.headers['set-cookie'] && (!self._disableCookies)) { + response.headers['set-cookie'].forEach(function(cookie) { + if (self._jar) self._jar.add(new Cookie(cookie)) + else cookieJar.add(new Cookie(cookie)) + }) + } + + if (response.statusCode >= 300 && response.statusCode < 400 && + (self.followAllRedirects || + (self.followRedirect && (self.method !== 'PUT' && self.method !== 'POST' && self.method !== 'DELETE'))) && + response.headers.location) { + if (self._redirectsFollowed >= self.maxRedirects) { + self.emit('error', new Error("Exceeded maxRedirects. Probably stuck in a redirect loop.")) + return + } + self._redirectsFollowed += 1 + + 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.redirects.push( + { statusCode : response.statusCode + , redirectUri: response.headers.location + } + ) + self.method = 'GET'; // Force all redirects to use GET + delete self.req + delete self.agent + delete self._started + delete self.body + if (self.headers) { + delete self.headers.host + } + if (log) log('Redirect to %uri', self) + self.init() + return // Ignore the rest of the response + } else { + self._redirectsFollowed = self._redirectsFollowed || 0 + // Be a good stream and emit end when the response is finished. + // Hack to emit end on close because of a core bug that never fires end + response.on('close', function () { + if (!self._ended) self.response.emit('end') + }) + + if (self.encoding) { + if (self.dests.length !== 0) { + console.error("Ingoring encoding parameter as this stream is being piped to another stream which makes the encoding option invalid.") + } else { + response.setEncoding(self.encoding) + } + } + + self.dests.forEach(function (dest) { + self.pipeDest(dest) + }) + + response.on("data", function (chunk) { + self._destdata = true + self.emit("data", chunk) + }) + response.on("end", function (chunk) { + self._ended = true + self.emit("end", chunk) + }) + response.on("close", function () {self.emit("close")}) + + self.emit('response', response) + + if (self.onResponse) { + self.onResponse(null, response) + } + if (self.callback) { + var buffer = [] + var bodyLen = 0 + self.on("data", function (chunk) { + buffer.push(chunk) + bodyLen += chunk.length + }) + self.on("end", function () { + if (self._aborted) return + + if (buffer.length && Buffer.isBuffer(buffer[0])) { + var body = new Buffer(bodyLen) + var i = 0 + buffer.forEach(function (chunk) { + chunk.copy(body, i, 0, chunk.length) + i += chunk.length + }) + if (self.encoding === null) { + response.body = body + } else { + response.body = body.toString() + } + } else if (buffer.length) { + response.body = buffer.join('') + } + + if (self._json) { + try { + response.body = JSON.parse(response.body) + } catch (e) {} + } + + self.callback(null, response, response.body) + }) + } + } + }) + + if (self.timeout && !self.timeoutTimer) { + self.timeoutTimer = setTimeout(function() { + self.req.abort() + var e = new Error("ETIMEDOUT") + e.code = "ETIMEDOUT" + self.emit("error", e) + }, self.timeout) + + // Set additional timeout on socket - in case if remote + // 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) + } + }) + } + } + + self.req.on('error', self.clientErrorHandler) + + self.emit('request', self.req) +} + +Request.prototype.abort = function() { + this._aborted = true; + + if (this.req) { + this.req.abort() + } + else if (this.response) { + this.response.abort() + } + + this.emit("abort") +} + +Request.prototype.pipeDest = function (dest) { + var response = this.response + // Called after the response is received + if (dest.headers) { + dest.headers['content-type'] = response.headers['content-type'] + if (response.headers['content-length']) { + dest.headers['content-length'] = response.headers['content-length'] + } + } + if (dest.setHeader) { + for (var i in response.headers) { + dest.setHeader(i, response.headers[i]) + } + dest.statusCode = response.statusCode + } + if (this.pipefilter) this.pipefilter(response, dest) +} + +// Composable API +Request.prototype.setHeader = function (name, value, clobber) { + if (clobber === undefined) clobber = true + if (clobber || !this.headers.hasOwnProperty(name)) this.headers[name] = value + else this.headers[name] += ',' + value + return this +} +Request.prototype.setHeaders = function (headers) { + for (i in headers) {this.setHeader(i, headers[i])} + return this +} +Request.prototype.qs = function (q, clobber) { + var base + if (!clobber && this.uri.query) base = qs.parse(this.uri.query) + else base = {} + + for (var i in q) { + base[i] = q[i] + } + + this.uri = url.parse(this.uri.href.split('?')[0] + '?' + qs.stringify(base)) + this.url = this.uri + + return this +} +Request.prototype.form = function (form) { + this.headers['content-type'] = 'application/x-www-form-urlencoded; charset=utf-8' + this.body = qs.stringify(form).toString('utf8') + return this +} +Request.prototype.multipart = function (multipart) { + var self = this + self.body = [] + + if (!self.headers['content-type']) { + self.headers['content-type'] = 'multipart/related;boundary="frontier"'; + } else { + self.headers['content-type'] = self.headers['content-type'].split(';')[0] + ';boundary="frontier"'; + } + + if (!multipart.forEach) throw new Error('Argument error, options.multipart.') + + multipart.forEach(function (part) { + var body = part.body + if(!body) throw Error('Body attribute missing in multipart.') + delete part.body + var preamble = '--frontier\r\n' + Object.keys(part).forEach(function(key){ + preamble += key + ': ' + part[key] + '\r\n' + }) + preamble += '\r\n' + self.body.push(new Buffer(preamble)) + self.body.push(new Buffer(body)) + self.body.push(new Buffer('\r\n')) + }) + self.body.push(new Buffer('--frontier--')) + return self +} +Request.prototype.json = function (val) { + this.setHeader('content-type', 'application/json') + this.setHeader('accept', 'application/json') + this._json = true + if (typeof val === 'boolean') { + if (typeof this.body === 'object') this.body = JSON.stringify(this.body) + } else { + this.body = JSON.stringify(val) + } + return this +} +Request.prototype.oauth = function (_oauth) { + var form + if (this.headers['content-type'] && + this.headers['content-type'].slice(0, 'application/x-www-form-urlencoded'.length) === + 'application/x-www-form-urlencoded' + ) { + form = qs.parse(this.body) + } + if (this.uri.query) { + form = qs.parse(this.uri.query) + } + if (!form) form = {} + var oa = {} + for (var i in form) oa[i] = form[i] + for (var i in _oauth) oa['oauth_'+i] = _oauth[i] + if (!oa.oauth_version) oa.oauth_version = '1.0' + if (!oa.oauth_timestamp) oa.oauth_timestamp = Math.floor( (new Date()).getTime() / 1000 ).toString() + if (!oa.oauth_nonce) oa.oauth_nonce = uuid().replace(/-/g, '') + + oa.oauth_signature_method = 'HMAC-SHA1' + + var consumer_secret = oa.oauth_consumer_secret + delete oa.oauth_consumer_secret + var token_secret = oa.oauth_token_secret + delete oa.oauth_token_secret + + var baseurl = this.uri.protocol + '//' + this.uri.host + this.uri.pathname + var signature = oauth.hmacsign(this.method, baseurl, oa, consumer_secret, token_secret) + + // oa.oauth_signature = signature + for (var i in form) { + if ( i.slice(0, 'oauth_') in _oauth) { + // skip + } else { + delete oa['oauth_'+i] + } + } + 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)+'"' + return this +} +Request.prototype.jar = function (jar) { + var cookies + + if (this._redirectsFollowed === 0) { + this.originalCookieHeader = this.headers.cookie + } + + if (jar === false) { + // disable cookies + cookies = false; + this._disableCookies = true; + } else if (jar) { + // fetch cookie from the user defined cookie jar + cookies = jar.get({ url: this.uri.href }) + } else { + // fetch cookie from the global cookie jar + cookies = cookieJar.get({ url: this.uri.href }) + } + + if (cookies && cookies.length) { + var cookieString = cookies.map(function (c) { + return c.name + "=" + c.value + }).join("; ") + + if (this.originalCookieHeader) { + // Don't overwrite existing Cookie header + this.headers.cookie = this.originalCookieHeader + '; ' + cookieString + } else { + this.headers.cookie = cookieString + } + } + this._jar = jar + return this +} + + +// Stream API +Request.prototype.pipe = function (dest, opts) { if (this.response) { if (this._destdata) { throw new Error("You cannot pipe after data has been emitted from the response.") } else if (this._ended) { throw new Error("You cannot pipe after the response has been ended.") } else { - stream.Stream.prototype.pipe.call(this, dest) + stream.Stream.prototype.pipe.call(this, dest, opts) this.pipeDest(dest) return dest } } else { this.dests.push(dest) - stream.Stream.prototype.pipe.call(this, dest) + stream.Stream.prototype.pipe.call(this, dest, opts) return dest } } Request.prototype.write = function () { if (!this._started) this.start() - if (!this.req) throw new Error("This request has been piped before http.request() was called.") this.req.write.apply(this.req, arguments) } -Request.prototype.end = function () { +Request.prototype.end = function (chunk) { + if (chunk) this.write(chunk) if (!this._started) this.start() - if (!this.req) throw new Error("This request has been piped before http.request() was called.") - this.req.end.apply(this.req, arguments) + this.req.end() } Request.prototype.pause = function () { - if (!this.response) throw new Error("This request has been piped before http.request() was called.") - this.response.pause.apply(this.response, arguments) + if (!this.response) this._paused = true + else this.response.pause.apply(this.response, arguments) } Request.prototype.resume = function () { - if (!this.response) throw new Error("This request has been piped before http.request() was called.") - this.response.resume.apply(this.response, arguments) + if (!this.response) this._paused = false + else this.response.resume.apply(this.response, arguments) +} +Request.prototype.destroy = function () { + if (!this._ended) this.end() } -function request (options, callback) { - if (typeof options === 'string') options = {uri:options} - if (callback) options.callback = callback +// organize params for post, put, head, del +function initParams(uri, options, callback) { + if ((typeof options === 'function') && !callback) callback = options; + if (typeof options === 'object') { + options.uri = uri; + } else if (typeof uri === 'string') { + options = {uri:uri}; + } else { + options = uri; + uri = options.uri; + } + return { uri: uri, options: options, callback: callback }; +} + +function request (uri, options, callback) { + if (typeof uri === 'undefined') throw new Error('undefined is not a valid uri or options object.') + if ((typeof options === 'function') && !callback) callback = options; + if (typeof options === 'object') { + options.uri = uri; + } else if (typeof uri === 'string') { + options = {uri:uri}; + } else { + options = uri; + } + + if (callback) options.callback = callback; var r = new Request(options) - r.request() return r } @@ -588,12 +886,12 @@ module.exports = request request.defaults = function (options) { var def = function (method) { - var d = function (opts, callback) { - if (typeof opts === 'string') opts = {uri:opts} + var d = function (uri, opts, callback) { + var params = initParams(uri, opts, callback); for (var i in options) { - if (opts[i] === undefined) opts[i] = options[i] + if (params.options[i] === undefined) params.options[i] = options[i] } - return method(opts, callback) + return method(params.uri, params.options, params.callback) } return d } @@ -610,43 +908,48 @@ request.defaults = function (options) { request.forever = function (agentOptions, optionsArg) { var options = {} - if (agentOptions) { + if (optionsArg) { for (option in optionsArg) { options[option] = optionsArg[option] } } - options.agent = new ForeverAgent(agentOptions) + if (agentOptions) options.agentOptions = agentOptions + options.forever = true return request.defaults(options) } request.get = request -request.post = function (options, callback) { - if (typeof options === 'string') options = {uri:options} - options.method = 'POST' - return request(options, callback) -} -request.put = function (options, callback) { - if (typeof options === 'string') options = {uri:options} - options.method = 'PUT' - return request(options, callback) -} -request.head = function (options, callback) { - if (typeof options === 'string') options = {uri:options} - options.method = 'HEAD' - if (options.body || options.requestBodyStream || options.json || options.multipart) { +request.post = function (uri, options, callback) { + var params = initParams(uri, options, callback); + params.options.method = 'POST'; + return request(params.uri || null, params.options, params.callback) +} +request.put = function (uri, options, callback) { + var params = initParams(uri, options, callback); + params.options.method = 'PUT' + return request(params.uri || null, params.options, params.callback) +} +request.head = function (uri, options, callback) { + var params = initParams(uri, options, callback); + params.options.method = 'HEAD' + if (params.options.body || + params.options.requestBodyStream || + (params.options.json && typeof params.options.json !== 'boolean') || + params.options.multipart) { throw new Error("HTTP HEAD requests MUST NOT include a request body.") } - return request(options, callback) + return request(params.uri || null, params.options, params.callback) } -request.del = function (options, callback) { - if (typeof options === 'string') options = {uri:options} - options.method = 'DELETE' - return request(options, callback) +request.del = function (uri, options, callback) { + var params = initParams(uri, options, callback); + params.options.method = 'DELETE' + return request(params.uri || null, params.options, params.callback) } request.jar = function () { return new CookieJar } request.cookie = function (str) { + if (str && str.uri) str = str.uri if (typeof str !== 'string') throw new Error("The cookie function only accepts STRING as param") return new Cookie(str) } diff --git a/deps/npm/node_modules/request/mimetypes.js b/deps/npm/node_modules/request/mimetypes.js index 86910064c9..59b21b419c 100644 --- a/deps/npm/node_modules/request/mimetypes.js +++ b/deps/npm/node_modules/request/mimetypes.js @@ -1,5 +1,6 @@ // from http://github.com/felixge/node-paperboy exports.types = { + "3gp":"video/3gpp", "aiff":"audio/x-aiff", "arj":"application/x-arj-compressed", "asf":"video/x-ms-asf", @@ -50,17 +51,21 @@ exports.types = { "lzh":"application/octet-stream", "m":"text/plain", "m3u":"audio/x-mpegurl", + "m4v":"video/mp4", "man":"application/x-troff-man", "me":"application/x-troff-me", "midi":"audio/midi", "mif":"application/x-mif", "mime":"www/mime", + "mkv":" video/x-matrosk", "movie":"video/x-sgi-movie", - "mustache":"text/plain", "mp4":"video/mp4", + "mp41":"video/mp4", + "mp42":"video/mp4", "mpg":"video/mpeg", "mpga":"audio/mpeg", "ms":"application/x-troff-ms", + "mustache":"text/plain", "nc":"application/x-netcdf", "oda":"application/oda", "ogm":"application/ogg", @@ -123,6 +128,7 @@ exports.types = { "vrm":"x-world/x-vrml", "wav":"audio/x-wav", "wax":"audio/x-ms-wax", + "webm":"video/webm", "wma":"audio/x-ms-wma", "wmv":"video/x-ms-wmv", "wmx":"video/x-ms-wmx", @@ -134,7 +140,7 @@ exports.types = { "xpm":"image/x-xpixmap", "xwd":"image/x-xwindowdump", "xyz":"chemical/x-pdb", - "zip":"application/zip", + "zip":"application/zip" }; exports.lookup = function(ext, defaultType) { diff --git a/deps/npm/node_modules/request/oauth.js b/deps/npm/node_modules/request/oauth.js index 25db669775..31b9dc65fe 100644 --- a/deps/npm/node_modules/request/oauth.js +++ b/deps/npm/node_modules/request/oauth.js @@ -19,7 +19,7 @@ function rfc3986 (str) { function hmacsign (httpMethod, base_uri, params, consumer_secret, token_secret, body) { // adapted from https://dev.twitter.com/docs/auth/oauth var base = - httpMethod + "&" + + (httpMethod || 'GET') + "&" + encodeURIComponent( base_uri ) + "&" + Object.keys(params).sort().map(function (i) { // big WTF here with the escape + encoding but it's what twitter wants diff --git a/deps/npm/node_modules/request/package.json b/deps/npm/node_modules/request/package.json index e7b899a8b1..0e6ddc5d85 100644 --- a/deps/npm/node_modules/request/package.json +++ b/deps/npm/node_modules/request/package.json @@ -1,15 +1,45 @@ -{ "name" : "request" -, "description" : "Simplified HTTP request client." -, "tags" : ["http", "simple", "util", "utility"] -, "version" : "2.9.3" -, "author" : "Mikeal Rogers <mikeal.rogers@gmail.com>" -, "repository" : - { "type" : "git" - , "url" : "http://github.com/mikeal/request.git" - } -, "bugs" : - { "url" : "http://github.com/mikeal/request/issues" } -, "engines" : ["node >= 0.3.6"] -, "main" : "./main" -, "scripts": { "test": "bash tests/run.sh" } +{ + "name": "request", + "description": "Simplified HTTP request client.", + "tags": [ + "http", + "simple", + "util", + "utility" + ], + "version": "2.9.153", + "author": { + "name": "Mikeal Rogers", + "email": "mikeal.rogers@gmail.com" + }, + "repository": { + "type": "git", + "url": "git://github.com/mikeal/request.git" + }, + "bugs": { + "url": "http://github.com/mikeal/request/issues" + }, + "engines": [ + "node >= 0.3.6" + ], + "main": "./main", + "scripts": { + "test": "node tests/run.js" + }, + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "_id": "request@2.9.153", + "dependencies": {}, + "devDependencies": {}, + "optionalDependencies": {}, + "_engineSupported": true, + "_npmVersion": "1.1.8", + "_nodeVersion": "v0.6.12", + "_defaultsLoaded": true, + "dist": { + "shasum": "6f07c2ba3acfbe0cfe941f43647102740f05ff73" + }, + "_from": "../request" } diff --git a/deps/npm/node_modules/request/vendor/cookie/index.js b/deps/npm/node_modules/request/vendor/cookie/index.js index 1eb2eaa220..ff44b3e629 100644 --- a/deps/npm/node_modules/request/vendor/cookie/index.js +++ b/deps/npm/node_modules/request/vendor/cookie/index.js @@ -21,22 +21,27 @@ var url = require('url'); var Cookie = exports = module.exports = function Cookie(str, req) { this.str = str; - // First key is the name - this.name = str.substr(0, str.indexOf('=')).trim(); - // Map the key/val pairs str.split(/ *; */).reduce(function(obj, pair){ var p = pair.indexOf('='); - if(p > 0) - obj[pair.substring(0, p).trim()] = pair.substring(p + 1).trim(); - else - obj[pair.trim()] = true; + var key = p > 0 ? pair.substring(0, p).trim() : pair.trim(); + var lowerCasedKey = key.toLowerCase(); + var value = p > 0 ? pair.substring(p + 1).trim() : true; + + if (!obj.name) { + // First key is the name + obj.name = key; + obj.value = value; + } + else if (lowerCasedKey === 'httponly') { + obj.httpOnly = value; + } + else { + obj[lowerCasedKey] = value; + } return obj; }, this); - // Assign value - this.value = this[this.name]; - // Expires this.expires = this.expires ? new Date(this.expires) diff --git a/deps/npm/node_modules/rimraf/AUTHORS b/deps/npm/node_modules/rimraf/AUTHORS index 008cbe7dd9..247b754373 100644 --- a/deps/npm/node_modules/rimraf/AUTHORS +++ b/deps/npm/node_modules/rimraf/AUTHORS @@ -3,3 +3,4 @@ Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me) Wayne Larsen <wayne@larsen.st> (http://github.com/wvl) ritch <skawful@gmail.com> Marcel Laverdet +Yosef Dinerstein <yosefd@microsoft.com> diff --git a/deps/npm/node_modules/rimraf/README.md b/deps/npm/node_modules/rimraf/README.md index 99983dc437..96ce9b2a0b 100644 --- a/deps/npm/node_modules/rimraf/README.md +++ b/deps/npm/node_modules/rimraf/README.md @@ -4,7 +4,7 @@ Install with `npm install rimraf`, or just drop rimraf.js somewhere. ## API -`rimraf(f, [options,] callback)` +`rimraf(f, callback)` The callback will be called with an error if there is one. Certain errors are handled for you: @@ -14,17 +14,6 @@ errors are handled for you: * `EMFILE` - If too many file descriptors get opened, rimraf will patiently wait until more become available. -## Options - -The options object is optional. These fields are respected: - -* `maxBusyTries` - The number of times to retry a file or folder in the - event of an `EBUSY` error. The default is 3. -* `gently` - If provided a `gently` path, then rimraf will only delete - files and folders that are beneath this path, and only delete symbolic - links that point to a place within this path. (This is very important - to npm's use-case, and shows rimraf's pedigree.) - ## rimraf.sync diff --git a/deps/npm/node_modules/rimraf/fiber.js b/deps/npm/node_modules/rimraf/fiber.js deleted file mode 100644 index 8812a6b449..0000000000 --- a/deps/npm/node_modules/rimraf/fiber.js +++ /dev/null @@ -1,86 +0,0 @@ -// fiber/future port originally written by Marcel Laverdet -// https://gist.github.com/1131093 -// I updated it to bring to feature parity with cb version. -// The bugs are probably mine, not Marcel's. -// -- isaacs - -var path = require('path') - , fs = require('fs') - , Future = require('fibers/future') - -// Create future-returning fs functions -var fs2 = {} -for (var ii in fs) { - fs2[ii] = Future.wrap(fs[ii]) -} - -// Return a future which just pauses for a certain amount of time - -function timer (ms) { - var future = new Future - setTimeout(function () { - future.return() - }, ms) - return future -} - -function realish (p) { - return path.resolve(path.dirname(fs2.readlink(p))) -} - -// for EMFILE backoff. -var timeout = 0 - , EMFILE_MAX = 1000 - -function rimraf_ (p, opts) { - opts = opts || {} - opts.maxBusyTries = opts.maxBusyTries || 3 - if (opts.gently) opts.gently = path.resolve(opts.gently) - var busyTries = 0 - - // exits by throwing or returning. - // loops on handled errors. - while (true) { - try { - var stat = fs2.lstat(p).wait() - - // check to make sure that symlinks are ours. - if (opts.gently) { - var rp = stat.isSymbolicLink() ? realish(p) : path.resolve(p) - if (rp.indexOf(opts.gently) !== 0) { - var er = new Error("Refusing to delete: "+p+" not in "+opts.gently) - er.errno = require("constants").EEXIST - er.code = "EEXIST" - er.path = p - throw er - } - } - - if (!stat.isDirectory()) return fs2.unlink(p).wait() - - var rimrafs = fs2.readdir(p).wait().map(function (file) { - return rimraf(path.join(p, file), opts) - }) - - Future.wait(rimrafs) - fs2.rmdir(p).wait() - timeout = 0 - return - - } catch (er) { - if (er.message.match(/^EMFILE/) && timeout < EMFILE_MAX) { - timer(timeout++).wait() - } else if (er.message.match(/^EBUSY/) - && busyTries < opt.maxBusyTries) { - timer(++busyTries * 100).wait() - } else if (er.message.match(/^ENOENT/)) { - // already gone - return - } else { - throw er - } - } - } -} - -var rimraf = module.exports = rimraf_.future() diff --git a/deps/npm/node_modules/rimraf/package.json b/deps/npm/node_modules/rimraf/package.json index 2b69536ef9..952bc8af9f 100644 --- a/deps/npm/node_modules/rimraf/package.json +++ b/deps/npm/node_modules/rimraf/package.json @@ -1,9 +1,10 @@ {"name":"rimraf" -,"version":"1.0.9" +,"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"}} diff --git a/deps/npm/node_modules/rimraf/rimraf.js b/deps/npm/node_modules/rimraf/rimraf.js index e8104e9e4b..67d018ab4a 100644 --- a/deps/npm/node_modules/rimraf/rimraf.js +++ b/deps/npm/node_modules/rimraf/rimraf.js @@ -16,34 +16,30 @@ var lstat = process.platform === "win32" ? "stat" : "lstat" // for EMFILE handling var timeout = 0 - , EMFILE_MAX = 1000 +exports.EMFILE_MAX = 1000 +exports.BUSYTRIES_MAX = 3 -function rimraf (p, opts, cb) { - if (typeof opts === "function") cb = opts, opts = {} +function rimraf (p, cb) { if (!cb) throw new Error("No callback passed to rimraf()") - if (!opts) opts = {} var busyTries = 0 - opts.maxBusyTries = opts.maxBusyTries || 3 - if (opts.gently) opts.gently = path.resolve(opts.gently) - - rimraf_(p, opts, function CB (er) { + rimraf_(p, function CB (er) { if (er) { - if (er.code === "EBUSY" && busyTries < opts.maxBusyTries) { - var time = (opts.maxBusyTries - busyTries) * 100 + if (er.code === "EBUSY" && busyTries < exports.BUSYTRIES_MAX) { + var time = (exports.BUSYTRIES_MAX - busyTries) * 100 busyTries ++ // try again, with the same exact callback as this one. return setTimeout(function () { - rimraf_(p, opts, CB) + rimraf_(p, CB) }) } // this one won't happen if graceful-fs is used. - if (er.code === "EMFILE" && timeout < EMFILE_MAX) { + if (er.code === "EMFILE" && timeout < exports.EMFILE_MAX) { return setTimeout(function () { - rimraf_(p, opts, CB) + rimraf_(p, CB) }, timeout ++) } @@ -56,9 +52,8 @@ function rimraf (p, opts, cb) { }) } -function rimraf_ (p, opts, cb) { +function rimraf_ (p, cb) { fs[lstat](p, function (er, s) { - // if the stat fails, then assume it's already gone. if (er) { // already gone if (er.code === "ENOENT") return cb() @@ -66,20 +61,55 @@ function rimraf_ (p, opts, cb) { return cb(er) } - // don't delete that don't point actually live in the "gently" path - if (opts.gently) return clobberTest(p, s, opts, cb) - return rm_(p, s, opts, cb) + return rm_(p, s, false, cb) }) } -function rm_ (p, s, opts, cb) { - if (!s.isDirectory()) return fs.unlink(p, cb) + +var myGid = function myGid () { + var g = process.getuid && process.getgid() + myGid = function myGid () { return g } + return g +} + +var myUid = function myUid () { + var u = process.getuid && process.getuid() + myUid = function myUid () { return u } + return u +} + + +function writable (s) { + var mode = s.mode || 0777 + , uid = myUid() + , gid = myGid() + return (mode & 0002) + || (gid === s.gid && (mode & 0020)) + || (uid === s.uid && (mode & 0200)) +} + +function rm_ (p, s, didWritableCheck, cb) { + if (!didWritableCheck && !writable(s)) { + // make file writable + // user/group/world, doesn't matter at this point + // since it's about to get nuked. + return fs.chmod(p, s.mode | 0222, function (er) { + if (er) return cb(er) + rm_(p, s, true, cb) + }) + } + + if (!s.isDirectory()) { + return fs.unlink(p, cb) + } + + // directory fs.readdir(p, function (er, files) { if (er) return cb(er) asyncForEach(files.map(function (f) { return path.join(p, f) }), function (file, cb) { - rimraf(file, opts, cb) + rimraf(file, cb) }, function (er) { if (er) return cb(er) fs.rmdir(p, cb) @@ -87,34 +117,6 @@ function rm_ (p, s, opts, cb) { }) } -function clobberTest (p, s, opts, cb) { - var gently = opts.gently - if (!s.isSymbolicLink()) next(null, path.resolve(p)) - else realish(p, next) - - function next (er, rp) { - if (er) return rm_(p, s, cb) - if (rp.indexOf(gently) !== 0) return clobberFail(p, gently, cb) - else return rm_(p, s, opts, cb) - } -} - -function realish (p, cb) { - fs.readlink(p, function (er, r) { - if (er) return cb(er) - return cb(null, path.resolve(path.dirname(p), r)) - }) -} - -function clobberFail (p, g, cb) { - var er = new Error("Refusing to delete: "+p+" not in "+g) - , constants = require("constants") - er.errno = constants.EEXIST - er.code = "EEXIST" - er.path = p - return cb(er) -} - function asyncForEach (list, fn, cb) { if (!list.length) cb() var c = list.length @@ -137,7 +139,13 @@ function rimrafSync (p) { if (er.code === "ENOENT") return throw er } + + if (!writable(s)) { + fs.chmodSync(p, s.mode | 0222) + } + if (!s.isDirectory()) return fs.unlinkSync(p) + fs.readdirSync(p).forEach(function (f) { rimrafSync(path.join(p, f)) }) diff --git a/deps/npm/node_modules/tar/lib/extract.js b/deps/npm/node_modules/tar/lib/extract.js index e45974c723..c34a81e21f 100644 --- a/deps/npm/node_modules/tar/lib/extract.js +++ b/deps/npm/node_modules/tar/lib/extract.js @@ -24,6 +24,10 @@ function Extract (opts) { opts.type = "Directory" opts.Directory = true + // similar to --strip or --strip-components + opts.strip = +opts.strip + if (!opts.strip || opts.strip <= 0) opts.strip = 0 + this._fst = fstream.Writer(opts) this.pause() @@ -33,6 +37,16 @@ function Extract (opts) { // of the tarball. So, they need to be resolved against // the target directory in order to be created properly. me.on("entry", function (entry) { + // if there's a "strip" argument, then strip off that many + // path components. + if (opts.strip) { + var p = entry.path.split("/").slice(opts.strip).join("/") + entry.path = entry.props.path = p + if (entry.linkpath) { + var lp = entry.linkpath.split("/").slice(opts.strip).join("/") + entry.linkpath = entry.props.linkpath = lp + } + } if (entry.type !== "Link") return entry.linkpath = entry.props.linkpath = path.join(opts.path, path.join("/", entry.props.linkpath)) diff --git a/deps/npm/node_modules/tar/package.json b/deps/npm/node_modules/tar/package.json index aa53022c64..849d0d6918 100644 --- a/deps/npm/node_modules/tar/package.json +++ b/deps/npm/node_modules/tar/package.json @@ -1,8 +1,12 @@ { - "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, "name": "tar", "description": "tar for node", - "version": "0.1.12", + "version": "0.1.13", "repository": { "type": "git", "url": "git://github.com/isaacs/node-tar.git" @@ -22,5 +26,19 @@ "devDependencies": { "tap": "0.x", "rimraf": "1.x" - } + }, + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "_id": "tar@0.1.13", + "optionalDependencies": {}, + "_engineSupported": true, + "_npmVersion": "1.1.4", + "_nodeVersion": "v0.7.6-pre", + "_defaultsLoaded": true, + "dist": { + "shasum": "804bdaaacaab928ec1c9bbd8b848a042c3adacb2" + }, + "_from": "tar@0.1.13" } diff --git a/deps/npm/node_modules/which/package.json b/deps/npm/node_modules/which/package.json index 02990697f7..c45dafee92 100644 --- a/deps/npm/node_modules/which/package.json +++ b/deps/npm/node_modules/which/package.json @@ -1,17 +1,34 @@ { - "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me" + }, "name": "which", "description": "Like which(1) unix command. Find the first instance of an executable in the PATH.", - "version": "1.0.2", + "version": "1.0.5", "repository": { "type": "git", "url": "git://github.com/isaacs/node-which.git" }, "main": "which.js", - "bin": "./bin/which", + "bin": { + "which": "./bin/which" + }, "engines": { "node": "*" }, "dependencies": {}, - "devDependencies": {} + "devDependencies": {}, + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "_id": "which@1.0.5", + "optionalDependencies": {}, + "_engineSupported": true, + "_npmVersion": "1.1.2", + "_nodeVersion": "v0.7.6-pre", + "_defaultsLoaded": true, + "_from": "which@1" } diff --git a/deps/npm/node_modules/which/which.js b/deps/npm/node_modules/which/which.js index b124ead672..db7e8f74dc 100644 --- a/deps/npm/node_modules/which/which.js +++ b/deps/npm/node_modules/which/which.js @@ -4,6 +4,7 @@ which.sync = whichSync var path = require("path") , fs , COLON = process.platform === "win32" ? ";" : ":" + , isExe try { fs = require("graceful-fs") @@ -11,24 +12,31 @@ try { fs = require("fs") } -// console.log(process.execPath) -// console.log(process.argv) - -function isExe (mod, uid, gid) { - //console.error("isExe?", (mod & 0111).toString(8)) - var ret = (mod & 0001) - || (mod & 0010) && process.getgid && gid === process.getgid() - || (mod & 0100) && process.getuid && uid === process.getuid() - //console.error("isExe?", ret) - return ret +if (process.platform == "win32") { + // On windows, there is no good way to check that a file is executable + isExe = function isExe () { return true } +} else { + isExe = function isExe (mod, uid, gid) { + //console.error(mod, uid, gid); + //console.error("isExe?", (mod & 0111).toString(8)) + var ret = (mod & 0001) + || (mod & 0010) && process.getgid && gid === process.getgid() + || (mod & 0100) && process.getuid && uid === process.getuid() + //console.error("isExe?", ret) + return ret + } } + + + function which (cmd, cb) { - if (cmd.charAt(0) === "/") return cb(null, cmd) + if (isAbsolute(cmd)) return cb(null, cmd) var pathEnv = (process.env.PATH || "").split(COLON) , pathExt = [""] if (process.platform === "win32") { pathEnv.push(process.cwd()) pathExt = (process.env.PATHEXT || ".EXE").split(COLON) + if (cmd.indexOf(".") !== -1) pathExt.unshift("") } //console.error("pathEnv", pathEnv) ;(function F (i, l) { @@ -52,16 +60,45 @@ function which (cmd, cb) { })(0, pathEnv.length) } - function whichSync (cmd) { - if (cmd.charAt(0) === "/") return cmd + if (isAbsolute(cmd)) return cmd var pathEnv = (process.env.PATH || "").split(COLON) + , pathExt = [""] + if (process.platform === "win32") { + pathEnv.push(process.cwd()) + pathExt = (process.env.PATHEXT || ".EXE").split(COLON) + if (cmd.indexOf(".") !== -1) pathExt.unshift("") + } for (var i = 0, l = pathEnv.length; i < l; i ++) { var p = path.join(pathEnv[i], cmd) - if (p === process.execPath) return p - var stat - try { stat = fs.statSync(p) } catch (ex) {} - if (stat && isExe(stat.mode, stat.uid, stat.gid)) return p + for (var j = 0, ll = pathExt.length; j < ll; j ++) { + var cur = p + pathExt[j] + var stat + try { stat = fs.statSync(cur) } catch (ex) {} + if (stat && + stat.isFile() && + isExe(stat.mode, stat.uid, stat.gid)) return cur + } } throw new Error("not found: "+cmd) } + +var isAbsolute = process.platform === "win32" ? absWin : absUnix + +function absWin (p) { + if (absUnix(p)) return true + // pull off the device/UNC bit from a windows path. + // from node's lib/path.js + var splitDeviceRe = + /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?([\\\/])?/ + , result = splitDeviceRe.exec(p) + , device = result[1] || '' + , isUnc = device && device.charAt(1) !== ':' + , isAbsolute = !!result[2] || isUnc // UNC paths are always absolute + + return isAbsolute +} + +function absUnix (p) { + return p.charAt(0) === "/" || p === "" +} diff --git a/deps/npm/package.json b/deps/npm/package.json index 55a2adf4c9..6510a03e8a 100644 --- a/deps/npm/package.json +++ b/deps/npm/package.json @@ -10,7 +10,7 @@ "install", "package.json" ], - "version": "1.1.0-2", + "version": "1.1.21", "preferGlobal": true, "config": { "publishtest": false @@ -39,21 +39,25 @@ "slide": "1", "abbrev": "1", "graceful-fs": "~1.1.1", - "minimatch": "0", + "minimatch": "~0.2", "nopt": "1", "node-uuid": "~1.3", "proto-list": "1", - "rimraf": "1", + "rimraf": "2", "request": "~2.9", "which": "1", "tar": "~0.1.12", - "fstream": "~0.1.5", + "fstream": "~0.1.17", "block-stream": "*", "inherits": "1", - "mkdirp": "0.1", - "fast-list": "~1.0.1", + "mkdirp": "0.3", "read": "0", - "lru-cache": "1" + "lru-cache": "1", + "node-gyp": "~0.4.1", + "fstream-npm": "0 >=0.0.5", + "uid-number": "0", + "archy": "0", + "chownr": "0" }, "bundleDependencies": [ "slide", @@ -73,9 +77,13 @@ "block-stream", "inherits", "mkdirp", - "fast-list", "read", - "lru-cache" + "lru-cache", + "node-gyp", + "fstream-npm", + "uid-number", + "archy", + "chownr" ], "devDependencies": { "ronn": "https://github.com/isaacs/ronnjs/tarball/master" diff --git a/deps/npm/scripts/index-build.js b/deps/npm/scripts/index-build.js index b3c19a03a1..551bb1d563 100755 --- a/deps/npm/scripts/index-build.js +++ b/deps/npm/scripts/index-build.js @@ -12,6 +12,7 @@ fs.readdir(api, done("api")) function done (which) { return function (er, docs) { if (er) throw er + docs.sort() if (which === "api") apidocs = docs else clidocs = docs diff --git a/deps/npm/test/packages/npm-test-env-reader/package.json b/deps/npm/test/packages/npm-test-env-reader/package.json index ddd5c91abd..99d7fc9307 100644 --- a/deps/npm/test/packages/npm-test-env-reader/package.json +++ b/deps/npm/test/packages/npm-test-env-reader/package.json @@ -1,14 +1,14 @@ { "name":"npm-test-env-reader" , "version" : "1.2.3" , "scripts" : - { "install" : "./test.sh" - , "preinstall" : "./test.sh" - , "preuninstall" : "./test.sh" - , "postuninstall" : "./test.sh" - , "test" : "./test.sh" - , "stop" : "./test.sh" - , "start" : "./test.sh" - , "restart" : "./test.sh" - , "foo" : "./test.sh" + { "install" : "node test.js" + , "preinstall" : "node test.js" + , "preuninstall" : "node test.js" + , "postuninstall" : "node test.js" + , "test" : "node test.js" + , "stop" : "node test.js" + , "start" : "node test.js" + , "restart" : "node test.js" + , "foo" : "node test.js" } } diff --git a/deps/npm/test/packages/npm-test-env-reader/test.sh b/deps/npm/test/packages/npm-test-env-reader/test.sh deleted file mode 100755 index b4ca4374ed..0000000000 --- a/deps/npm/test/packages/npm-test-env-reader/test.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env sh -env | grep npm | sort | uniq -echo PATH=$PATH diff --git a/deps/npm/test/packages/npm-test-files/package.json b/deps/npm/test/packages/npm-test-files/package.json index 7c067828e2..2afa12dc56 100644 --- a/deps/npm/test/packages/npm-test-files/package.json +++ b/deps/npm/test/packages/npm-test-files/package.json @@ -5,5 +5,6 @@ , "sub/include" , "sub/include2" , "sub/include4" - , "test.sh" ] + , "test.sh" + , ".npmignore" ] , "scripts":{"test":"bash test.sh"}} diff --git a/deps/npm/test/packages/npm-test-optional-deps/package.json b/deps/npm/test/packages/npm-test-optional-deps/package.json index ebcd56832d..56c6f09ed0 100644 --- a/deps/npm/test/packages/npm-test-optional-deps/package.json +++ b/deps/npm/test/packages/npm-test-optional-deps/package.json @@ -1,10 +1,12 @@ { "name": "npm-test-optional-deps" , "version": "1.2.5" +, "scripts": { "test": "node test.js" } , "optionalDependencies": { "npm-test-foobarzaaakakaka": "http://example.com/" , "dnode": "10.999.14234" - , "sax": "*" + , "sax": "0.3.5" , "999 invalid name": "1.2.3" , "glob": "some invalid version 99 #! $$ x y z" + , "npm-test-failer":"*" } } |