diff --git a/vendor/npm/npm-1.0.27/.gitignore b/vendor/npm/npm-1.0.27/.gitignore new file mode 100644 index 000000000..d28e5585e --- /dev/null +++ b/vendor/npm/npm-1.0.27/.gitignore @@ -0,0 +1,10 @@ +*.swp +test/bin +test/output.log +test/packages/*/node_modules +test/packages/npm-test-depends-on-spark/which-spark.log +test/packages/test-package/random-data.txt +test/root +node_modules/ronn +node_modules/.bin +npm-debug.log diff --git a/vendor/npm/npm-1.0.27/.gitmodules b/vendor/npm/npm-1.0.27/.gitmodules new file mode 100644 index 000000000..d529ce16a --- /dev/null +++ b/vendor/npm/npm-1.0.27/.gitmodules @@ -0,0 +1,33 @@ +[submodule "node_modules/semver"] + path = node_modules/semver + url = https://github.com/isaacs/node-semver.git +[submodule "node_modules/abbrev"] + path = node_modules/abbrev + url = https://github.com/isaacs/abbrev-js.git +[submodule "node_modules/nopt"] + path = node_modules/nopt + url = https://github.com/isaacs/nopt.git +[submodule "node_modules/node-uuid"] + path = node_modules/node-uuid + url = https://github.com/broofa/node-uuid +[submodule "node_modules/minimatch"] + path = node_modules/minimatch + url = https://github.com/isaacs/minimatch.git +[submodule "node_modules/graceful-fs"] + path = node_modules/graceful-fs + url = https://github.com/isaacs/node-graceful-fs.git +[submodule "node_modules/slide"] + path = node_modules/slide + url = https://github.com/isaacs/slide-flow-control.git +[submodule "node_modules/rimraf"] + path = node_modules/rimraf + url = https://github.com/isaacs/rimraf.git +[submodule "node_modules/proto-list"] + path = node_modules/proto-list + url = https://github.com/isaacs/proto-list.git +[submodule "node_modules/ini"] + path = node_modules/ini + url = https://github.com/isaacs/ini.git +[submodule "node_modules/which"] + path = node_modules/which + url = https://github.com/isaacs/node-which.git diff --git a/vendor/npm/npm-1.0.27/AUTHORS b/vendor/npm/npm-1.0.27/AUTHORS new file mode 100644 index 000000000..d042457af --- /dev/null +++ b/vendor/npm/npm-1.0.27/AUTHORS @@ -0,0 +1,43 @@ +# Authors sorted by whether or not they're me +Isaac Z. Schlueter (http://blog.izs.me/) +Steve Steiner (http://websaucesoftware.com/blog/) +Mikeal Rogers (http://www.mikealrogers.com/) +Aaron Blohowiak (http://aaronblohowiak.com/) +Martyn Smith (http://dollyfish.net.nz/) +Mathias Pettersson (http://mape.me/) +Brian Hammond (http://fictorial.com/) +Charlie Robbins (http://www.charlierobbins.com/) +Francisco Treacy (http://franciscotreacy.com/) +Cliffano Subagio (http://blog.cliffano.com/) +Christian Eager (http://perpenduum.com) +Dav Glass (http://blog.davglass.com) +Alex K. Wolfe +James Sanders (http://james-sanders.com/) +Reid Burke (http://reidburke.com/) +Arlo Breault (http://thoughtherder.com/) +Timo Derstappen (http://teemow.com) +Bradley Meck +Bart Teeuwisse (http://thecodemill.biz/) +Ben Noordhuis (http://bnoordhuis.nl/) +Tor Valamo (http://www.magnimedia.no/) +Whyme.Lyu <5longluna@gmail.com> (http://whyme.kuantu.com/) +Olivier Melcher +Tomaž Muraus (http://www.tomaz-muraus.info) +Evan Meagher (http://evanmeagher.net/) +Orlando Vazquez (http://2wycked.net/) +George Miroshnykov +Geoff Flarity (http://ca.linkedin.com/pub/geoff-flarity/a/536/43a) +Pete Kruckenberg +Laurie Harper (http://laurie.holoweb.net/) +Chris Wong +Max Goodman (http://chromacode.com/) +Scott Bronson +Federico Romero +Visnu Pitiyanuvath (http://visnup.com) +Irakli Gozalishvili (http://jeditoolkit.com/) +Mark Cahill (http://www.tiemonster.info/) +Zearin +Iain Sproat +Trent Mick (http://trentm.com/) +Felix Geisendörfer (http://www.debuggable.com/) +Conny Brunnkvist (http://twitter.com/connyb) diff --git a/vendor/npm/npm-1.0.27/CHANGES b/vendor/npm/npm-1.0.27/CHANGES new file mode 120000 index 000000000..0dade3591 --- /dev/null +++ b/vendor/npm/npm-1.0.27/CHANGES @@ -0,0 +1 @@ +doc/changelog.md \ No newline at end of file diff --git a/vendor/npm/npm-1.0.27/LICENSE b/vendor/npm/npm-1.0.27/LICENSE new file mode 100644 index 000000000..f123c9373 --- /dev/null +++ b/vendor/npm/npm-1.0.27/LICENSE @@ -0,0 +1,35 @@ +Copyright 2009, 2010, 2011 Isaac Z. Schlueter. +All rights reserved. + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +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. + + +"Node.js" and "node" trademark Joyent, Inc. npm is not officially +part of the Node.js project, and is neither owned by nor +officially affiliated with Joyent, Inc. + +Packages published in the npm registry are not part of npm +itself, and are the sole property of their respective +maintainers. + +"npm Logo" created by Mathias Pettersson and Brian Hammond, +used with permission. diff --git a/vendor/npm/npm-1.0.27/Makefile b/vendor/npm/npm-1.0.27/Makefile new file mode 100644 index 000000000..bb2f8f475 --- /dev/null +++ b/vendor/npm/npm-1.0.27/Makefile @@ -0,0 +1,64 @@ +SHELL = bash + +docs = $(shell find doc -name '*.md' \ + |sed 's|.md|.1|g' \ + |sed 's|doc/|man1/|g' ) + +doc_subfolders = $(shell find doc -type d \ + |sed 's|doc/|man1/|g' ) + +# This is the default make target. +# Since 'make' typically does non-installation build stuff, +# it seems appropriate. +submodules: + ! [ -d .git ] || git submodule update --init --recursive + +latest: submodules + @echo "Installing latest published npm" + @echo "Use 'make install' or 'make link' to install the code" + @echo "in this folder that you're looking at right now." + node cli.js install -g -f npm + +install: submodules + node cli.js install -g -f + +# backwards compat +dev: install + +link: uninstall + node cli.js link -f + +clean: uninstall + node cli.js cache clean + +uninstall: submodules + node cli.js rm npm -g -f + +man: man1 + +man1: $(doc_subfolders) + [ -d man1 ] || mkdir -p man1 + +doc: man1 $(docs) + +# use `npm install ronn` for this to work. +man1/%.1: doc/%.md + @[ -x ./node_modules/.bin/ronn ] || node cli.js install ronn + ./node_modules/.bin/ronn --roff $< > $@ + +man1/%/: doc/%/ + @[ -d $@ ] || mkdir -p $@ + +test: submodules + node cli.js test + +version: link + git add package.json &&\ + git ci -m v$(shell npm -v) + +publish: link + git tag -s -m v$(shell npm -v) v$(shell npm -v) &&\ + git push origin master &&\ + npm publish + +.PHONY: latest install dev link doc clean uninstall test man diff --git a/vendor/npm/npm-1.0.27/README.md b/vendor/npm/npm-1.0.27/README.md new file mode 100644 index 000000000..981b52059 --- /dev/null +++ b/vendor/npm/npm-1.0.27/README.md @@ -0,0 +1,219 @@ +# npm + +This is just enough info to get you up and running. + +Much more info available via `npm help` once it's installed. + +## IMPORTANT + +**You need node v0.4 or higher to run this program.** + +To install an old **and unsupported** version of npm that works on node 0.3 +and prior: + +```bash +git clone git://github.com/isaacs/npm.git ./npm +cd npm +git checkout origin/0.2 +make dev +``` + +## Simple Install + +To install npm with one command, do this: + +```bash +curl http://npmjs.org/install.sh | sh +``` + +To skip the npm 0.x cleanup, do this: + +```bash +curl http://npmjs.org/install.sh | clean=no sh +``` + +To say "yes" to the 0.x cleanup, but skip the prompt: + +```bash +curl http://npmjs.org/install.sh | clean=yes sh +``` + +If that fails, try this: + +```bash +git clone https://github.com/isaacs/npm.git +cd npm +sudo make install +``` + +If you're sitting in the code folder reading this document in your +terminal, then you've already got the code. Just do: + +```bash +sudo make install +``` + +and npm will install itself. + +If you don't have make, and don't have curl or git, and ALL you have is +this code and node, you can probably do this: + +```bash +sudo node ./cli.js install -g +``` + +However, note that github tarballs **do not contain submodules**, so +those won't work. You'll have to also fetch the appropriate submodules +listed in the .gitmodules file. + +## Permissions + +**tl;dr** + +* Use `sudo` for greater safety. Or don't, if you prefer not to. +* npm will downgrade permissions if it's root before running any build + scripts that package authors specified. + +### More details... + +As of version 0.3, it is recommended to run npm as root. +This allows npm to change the user identifier to the `nobody` user prior +to running any package build or test commands. + +If you are not the root user, or if you are on a platform that does not +support uid switching, then npm will not attempt to change the userid. + +If you would like to ensure that npm **always** runs scripts as the +"nobody" user, and have it fail if it cannot downgrade permissions, then +set the following configuration param: + +```bash +npm config set unsafe-perm false +``` + +This will prevent running in unsafe mode, even as non-root users. + +## Uninstalling + +So sad to see you go. + +```bash +sudo npm uninstall npm -g +``` + +Or, if that fails, + +```bash +sudo make uninstall +``` + +## More Severe Uninstalling + +Usually, the above instructions are sufficient. That will remove +npm, but leave behind anything you've installed. + +If you would like to remove all the packages that you have installed, +then you can use the `npm ls` command to find them, and then `npm rm` to +remove them. + +To remove cruft left behind by npm 0.x, you can use the included +`clean-old.sh` script file. You can run it conveniently like this: + +```bash +npm explore npm -g -- sh scripts/clean-old.sh +``` + +npm uses two configuration files, one for per-user configs, and another +for global (every-user) configs. You can view them by doing: + +```bash +npm config get userconfig # defaults to ~/.npmrc +npm config get globalconfig # defaults to /usr/local/etc/npmrc +``` + +Uninstalling npm does not remove configuration files by default. You +must remove them yourself manually if you want them gone. Note that +this means that future npm installs will not remember the settings that +you have chosen. + +## Using npm Programmatically + +If you would like to use npm programmatically, you can do that. +It's not very well documented, but it *is* rather simple. + +```javascript +var npm = require("npm") +npm.load(myConfigObject, function (er) { + if (er) return handlError(er) + npm.commands.install(["some", "args"], function (er, data) { + if (er) return commandFailed(er) + // command succeeded, and data might have some info + }) + npm.on("log", function (message) { .... }) +}) +``` + +The `load` function takes an object hash of the command-line configs. +The various `npm.commands.` functions take an **array** of +positional argument **strings**. The last argument to any +`npm.commands.` function is a callback. Some commands take other +optional arguments. Read the source. + +You cannot set configs individually for any single npm function at this +time. Since `npm` is a singleton, any call to `npm.config.set` will +change the value for *all* npm commands in that process. + +See `./bin/npm.js` for an example of pulling config values off of the +command line arguments using nopt. You may also want to check out `npm +help config` to learn about all the options you can set there. + +## More Docs + +Check out the [docs](http://github.com/isaacs/npm/blob/master/doc/), +especially the +[faq](http://github.com/isaacs/npm/blob/master/doc/faq.md#readme). + +You can use the `npm help` command to read any of them. + +If you're a developer, and you want to use npm to publish your program, +you should +[read this](http://github.com/isaacs/npm/blob/master/doc/developers.md#readme) + +## Legal Stuff + +"npm" and "the npm registry" are owned by Isaac Z. Schlueter. All +rights not explicitly granted in the MIT license are reserved. See the +included LICENSE file for more details. + +"Node.js" and "node" are trademarks owned by Joyent, Inc. npm is not +officially part of the Node.js project, and is neither owned by nor +officially affiliated with Joyent, Inc. + +The packages in the npm registry are not part of npm itself, and are the +sole property of their respective maintainers. While every effort is +made to ensure accountability, there is absolutely no guarantee, +warrantee, or assertion made as to the quality, fitness for a specific +purpose, or lack of malice in any given npm package. Modules +published on the npm registry are not affiliated with or endorsed by +Joyent, Inc., Isaac Z. Schlueter, Ryan Dahl, or the Node.js project. + +If you have a complaint about a package in the npm registry, and cannot +resolve it with the package owner, please express your concerns to +Isaac Z. Schlueter at . + +### In plain english + +This is mine; not my employer's, not Node's, not Joyent's, not Ryan +Dahl's. + +If you publish something, it's yours, and you are solely accountable +for it. Not me, not Node, not Joyent, not Ryan Dahl. + +If other people publish something, it's theirs. Not mine, not Node's, +not Joyent's, not Ryan Dahl's. + +Yes, you can publish something evil. It will be removed promptly if +reported, and we'll lose respect for you. But there is no vetting +process for published modules. + +If this concerns you, inspect the source before using packages. diff --git a/vendor/npm/npm-1.0.27/bin/npm-get-uid-gid.js b/vendor/npm/npm-1.0.27/bin/npm-get-uid-gid.js new file mode 100755 index 000000000..390e0f2fc --- /dev/null +++ b/vendor/npm/npm-1.0.27/bin/npm-get-uid-gid.js @@ -0,0 +1,16 @@ +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/vendor/npm/npm-1.0.27/bin/npm.js b/vendor/npm/npm-1.0.27/bin/npm.js new file mode 100755 index 000000000..e1f534d79 --- /dev/null +++ b/vendor/npm/npm-1.0.27/bin/npm.js @@ -0,0 +1,62 @@ +#!/usr/bin/env node +;(function () { // wrapper in case we're in module_context mode +var log = require("../lib/utils/log") +log.waitForConfig() +log.info("ok", "it worked if it ends with") + +var fs = require("graceful-fs") + , path = require("path") + , npm = require("../npm") + , ini = require("../lib/utils/ini") + , errorHandler = require("../lib/utils/error-handler") + + , configDefs = require("../lib/utils/config-defs") + , shorthands = configDefs.shorthands + , types = configDefs.types + , nopt = require("nopt") + +// if npm is called as "npmg" or "npm_g", then +// run in global mode. +if(path.basename(process.argv[1]).slice(-1) === "g") { + process.argv.splice(1, 1, "npm", "-g") +} + +log.verbose(process.argv, "cli") + +var conf = nopt(types, shorthands) +npm.argv = conf.argv.remain +if (npm.deref(npm.argv[0])) npm.command = npm.argv.shift() +else conf.usage = true + + +if (conf.version) { + console.log(npm.version) + return +} else log("npm@"+npm.version, "using") +log("node@"+process.version, "using") + +// make sure that this version of node works with this version of npm. +var semver = require("semver") + , nodeVer = process.version + , reqVer = npm.nodeVersionRequired +if (reqVer && !semver.satisfies(nodeVer, reqVer)) { + return errorHandler(new Error( + "npm doesn't work with node " + nodeVer + + "\nRequired: node@" + reqVer), true) +} + +process.on("uncaughtException", errorHandler) + +if (conf.usage && npm.command !== "help") { + npm.argv.unshift(npm.command) + npm.command = "help" +} + +// now actually fire up npm and run the command. +// this is how to use npm programmatically: +conf._exit = true +npm.load(conf, function (er) { + if (er) return errorHandler(er) + npm.commands[npm.command](npm.argv, errorHandler) +}) +})() diff --git a/vendor/npm/npm-1.0.27/bin/read-package-json.js b/vendor/npm/npm-1.0.27/bin/read-package-json.js new file mode 100755 index 000000000..8c95d86e8 --- /dev/null +++ b/vendor/npm/npm-1.0.27/bin/read-package-json.js @@ -0,0 +1,22 @@ +var argv = process.argv +if (argv.length < 3) { + console.error("Usage: read-package.json [ ...]") + process.exit(1) +} + +var fs = require("fs") + , file = argv[2] + , readJson = require("../lib/utils/read-json") + +readJson(file, function (er, data) { + if (er) throw er + if (argv.length === 3) console.log(data) + else argv.slice(3).forEach(function (field) { + field = field.split(".") + var val = data + field.forEach(function (f) { + val = val[f] + }) + console.log(val) + }) +}) diff --git a/vendor/npm/npm-1.0.27/cli.js b/vendor/npm/npm-1.0.27/cli.js new file mode 100755 index 000000000..f9478d85a --- /dev/null +++ b/vendor/npm/npm-1.0.27/cli.js @@ -0,0 +1,2 @@ +#!/usr/bin/env node +require("./bin/npm.js") diff --git a/vendor/npm/npm-1.0.27/configure b/vendor/npm/npm-1.0.27/configure new file mode 100755 index 000000000..62036c651 --- /dev/null +++ b/vendor/npm/npm-1.0.27/configure @@ -0,0 +1,39 @@ +#!/bin/bash + +# this is a wicked hack, but whatever. + +CONFIGS=() +i=0 + +while [ $# -gt 0 ]; do + conf="$1" + case $conf in + --help) + echo "./configure --param=value ..." + exit 0 + ;; + --*) + CONFIGS[$i]="${conf:2}" + ;; + *) + CONFIGS[$i]="$conf" + ;; + esac + let i++ + shift +done + +# Pull in submodules, since npm can't work without them. +if [ -d .git ]; then + git submodule update --init --recursive +fi + +for c in "${CONFIGS[@]}"; do + echo '+node ./bin/npm.js config set "'"$c"'"' + node ./bin/npm.js config set "$c" +done +echo + +echo +node ./bin/npm.js config ls +echo +node ./bin/npm.js config ls diff --git a/vendor/npm/npm-1.0.27/doc/adduser.md b/vendor/npm/npm-1.0.27/doc/adduser.md new file mode 100644 index 000000000..c6136814d --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/adduser.md @@ -0,0 +1,29 @@ +npm-adduser(1) -- Add a registry user account +============================================= + +## SYNOPSIS + + npm adduser + +## DESCRIPTION + +Create or verify a user named `` in the npm registry, and +save the credentials to the `.npmrc` file. + +The username, password, and email are read in from prompts. + +You may use this command to change your email address, but not username +or password. + +To reset your password, go to + +You may use this command multiple times with the same user account to +authorize on a new machine. + +## CONFIGURATION + +### registry + +Default: http://registry.npmjs.org/ + +The base URL of the npm package registry. diff --git a/vendor/npm/npm-1.0.27/doc/author.md b/vendor/npm/npm-1.0.27/doc/author.md new file mode 120000 index 000000000..b7a53cb66 --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/author.md @@ -0,0 +1 @@ +owner.md \ No newline at end of file diff --git a/vendor/npm/npm-1.0.27/doc/bin.md b/vendor/npm/npm-1.0.27/doc/bin.md new file mode 100644 index 000000000..5e260647c --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/bin.md @@ -0,0 +1,10 @@ +npm-bin(1) -- Display npm bin folder +==================================== + +## SYNOPSIS + + npm bin + +## DESCRIPTION + +Print the folder where npm will install executables. diff --git a/vendor/npm/npm-1.0.27/doc/build.md b/vendor/npm/npm-1.0.27/doc/build.md new file mode 100644 index 000000000..978f4a6d6 --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/build.md @@ -0,0 +1,22 @@ +npm-build(1) -- Build a package +=============================== + +## SYNOPSIS + + npm build + +* ``: + A folder containing a `package.json` file in its root. + +## DESCRIPTION + +This is the plumbing command called by `npm link` and `npm install`. + +It should generally not be called directly. + +## SEE ALSO + +* npm-install(1) +* npm-link(1) +* npm-scripts(1) +* npm-json(1) diff --git a/vendor/npm/npm-1.0.27/doc/bundle.md b/vendor/npm/npm-1.0.27/doc/bundle.md new file mode 100644 index 000000000..b2fd0cf57 --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/bundle.md @@ -0,0 +1,10 @@ +npm-bundle(1) -- REMOVED +======================== + +## DESCRIPTION + +The `npm bundle` command has been removed in 1.0, for the simple reason +that it is no longer necessary, as the default behavior is now to +install packages into the local space. + +Just use `npm install` now to do what `npm bundle` used to do. diff --git a/vendor/npm/npm-1.0.27/doc/cache.md b/vendor/npm/npm-1.0.27/doc/cache.md new file mode 100644 index 000000000..5c2680812 --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/cache.md @@ -0,0 +1,60 @@ +npm-cache(1) -- install a package +=================================== + +## SYNOPSIS + + npm cache add + npm cache add + npm cache add + npm cache add @ + + npm cache ls [] + + npm cache clean [] + +## DESCRIPTION + +* add: + Add the specified package to the local cache. This command is primarily + intended to be used internally by npm, but it can provide a way to + add data to the local installation cache explicitly. + +* ls: + Show the data in the cache. Argument is a path to show in the cache + folder. Works a bit like the `find` program, but limited by the + `depth` config. + +* clean: + Delete data out of the cache folder. If an argument is provided, then + it specifies a subpath to delete. If no argument is provided, then + the entire cache is cleared. + +## DETAILS + +npm stores cache data in `$HOME/.npm`. For each package that is added +to the cache, three pieces of information are stored in +`{cache}/{name}/{version}`: + +* .../package/: + A folder containing the package contents as they appear in the tarball. +* .../package.json: + The package.json file, as npm sees it, with overlays applied and a _id attribute. +* .../package.tgz: + The tarball for that version. + +Additionally, whenever a registry request is made, a `.cache.json` file +is placed at the corresponding URI, to store the ETag and the requested +data. + +Commands that make non-essential registry requests (such as `search` and +`view`, or the completion scripts) generally specify a minimum timeout. +If the `.cache.json` file is younger than the specified timeout, then +they do not make an HTTP request to the registry. + +## CONFIGURATION + +### cache + +Default: `$HOME/.npm` on Posix, or `$HOME/npm-cache` on Windows. + +The root cache folder. diff --git a/vendor/npm/npm-1.0.27/doc/changelog.md b/vendor/npm/npm-1.0.27/doc/changelog.md new file mode 100644 index 000000000..80062046a --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/changelog.md @@ -0,0 +1,31 @@ +npm-changelog(1) -- Changes +=========================== + +## HISTORY + +### 1.0 +* Greatly simplified folder structure +* Install locally (bundle by default) +* Drastic rearchitecture + +### 0.3 +* More correct permission/uid handling when running as root +* Require node 0.4.0 +* Reduce featureset +* Packages without "main" modules don't export modules +* Remove support for invalid JSON (since node doesn't support it) + +### 0.2 +* First allegedly "stable" release +* Most functionality implemented +* Used shim files and `name@version` symlinks +* Feature explosion +* Kind of a mess + +### 0.1 +* push to beta, and announce +* Solaris and Cygwin support + +### 0.0 +* Lots of sketches and false starts; abandoned a few times +* Core functionality established \ No newline at end of file diff --git a/vendor/npm/npm-1.0.27/doc/coding-style.md b/vendor/npm/npm-1.0.27/doc/coding-style.md new file mode 100644 index 000000000..d09d4ea44 --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/coding-style.md @@ -0,0 +1,184 @@ +npm-coding-style(1) -- npm's "funny" coding style +================================================= + +## DESCRIPTION + +npm's coding style is a bit unconventional. It is not different for +difference's sake, but rather a carefully crafted style that is +designed to reduce visual clutter and make bugs more apparent. + +If you want to contribute to npm (which is very encouraged), you should +make your code conform to npm's style. + +## Line Length + +Keep lines shorter than 80 characters. It's better for lines to be +too short than to be too long. Break up long lists, objects, and other +statements onto multiple lines. + +## Indentation + +Two-spaces. Tabs are better, but they look like hell in web browsers +(and on github), and node uses 2 spaces, so that's that. + +Configure your editor appropriately. + +## Curly braces + +Curly braces belong on the same line as the thing that necessitates them. + +Bad: + + function () + { + +Good: + + function () { + +If a block needs to wrap to the next line, use a curly brace. Don't +use it if it doesn't. + +Bad: + + if (foo) { bar() } + while (foo) + bar() + +Good: + + if (foo) bar() + while (foo) { + bar() + } + +## Semicolons + +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. + This prevents the expression from being interpreted + as a function call or property access, respectively. + +Some examples of good semicolon usage: + + ;(x || y).doSomething() + ;[a, b, c].forEach(doSomething) + for (var i = 0; i < 10; i ++) { + switch (state) { + case "begin": start(); continue + case "end": finish(); break + default: throw new Error("unknown state") + } + end() + } + +Note that starting lines with `-` and `+` also should be prefixed +with a semicolon, but this is much less common. + +## Comma First + +If there is a list of things separated by commas, and it wraps +across multiple lines, put the comma at the start of the next +line, directly below the token that starts the list. Put the +final token in the list on a line by itself. For example: + + var magicWords = [ "abracadabra" + , "gesundheit" + , "ventrilo" + ] + , spells = { "fireball" : function () { setOnFire() } + , "water" : function () { putOut() } + } + , a = 1 + , b = "abc" + , etc + , somethingElse + +## Whitespace + +Put a single space in front of ( for anything other than a function call. +Also use a single space wherever it makes things more readable. + +Don't leave trailing whitespace at the end of lines. Don't indent empty +lines. Don't use more spaces than are helpful. + +## Functions + +Use named functions. They make stack traces a lot easier to read. + +## Callbacks, Sync/async Style + +Use the asynchronous/non-blocking versions of things as much as possible. +It might make more sense for npm to use the synchronous fs APIs, but this +way, the fs and http and child process stuff all uses the same callback-passing +methodology. + +The callback should always be the last argument in the list. Its first +argument is the Error or null. + +Be very careful never to ever ever throw anything. It's worse than useless. +Just send the error message back as the first argument to the callback. + +## Errors + +Always create a new Error object with your message. Don't just return a +string message to the callback. Stack traces are handy. + +Use the `require("./utils/log").er` function. It takes a callback and an +error message, and returns an object that will report the message in the +event of a failure. It's quite handy. + + function myThing (args, cb) { + getData(args, function (er, data) { + if (er) return log.er(cb, "Couldn't get data")(er) + doSomethingElse(data, cb) + }) + } + function justHasToWork (cb) { + doSomething(log.er(cb, "the doSomething failed.")) + } + +## Logging + +Please clean up logs when they are no longer helpful. In particular, +logging the same object over and over again is not helpful. Logs should +report what's happening so that it's easier to track down where a fault +occurs. + +Use appropriate log levels. The default log() function logs at the +"info" level. See `npm help config` and search for "loglevel". + +## Case, naming, etc. + +Use lowerCamelCase for multiword identifiers when they refer to objects, +functions, methods, members, or anything not specified in this section. + +Use UpperCamelCase for class names (things that you'd pass to "new"). + +Use all-lower-hyphen-css-case for multiword filenames and config keys. + +Use named functions. They make stack traces easier to follow. + +Use CAPS_SNAKE_CASE for constants, things that should never change +and are rarely used. + +Use a single uppercase letter for function names where the function +would normally be anonymous, but needs to call itself recursively. It +makes it clear that it's a "throwaway" function. + +## null, undefined, false, 0 + +Boolean variables and functions should always be either `true` or +`false`. Don't set it to 0 unless it's supposed to be a number. + +When something is intentionally missing or removed, set it to `null`. + +Don't set things to `undefined`. Reserve that value to mean "not yet +set to anything." + +Boolean objects are verboten. diff --git a/vendor/npm/npm-1.0.27/doc/completion.md b/vendor/npm/npm-1.0.27/doc/completion.md new file mode 100644 index 000000000..89d69f2ad --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/completion.md @@ -0,0 +1,21 @@ +npm-completion(1) -- Tab Completion for npm +=========================================== + +## SYNOPSIS + + . <(npm completion) + +## DESCRIPTION + +Enables tab-completion in all npm commands. The synopsis above +loads the completions into your current shell. Adding it to +your ~/.bashrc or ~/.zshrc will make the completions available +everywhere. + +You may of course also pipe the output of npm completion to a file +such as `/usr/local/etc/bash_completion.d/npm` if you have a system +that will read that file for you. + +When `COMP_CWORD`, `COMP_LINE`, and `COMP_POINT` are defined in the +environment, `npm completion` acts in "plumbing mode", and outputs +completions based on the arguments. diff --git a/vendor/npm/npm-1.0.27/doc/config.md b/vendor/npm/npm-1.0.27/doc/config.md new file mode 100644 index 000000000..f4ca3ce53 --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/config.md @@ -0,0 +1,587 @@ +npm-config(1) -- Manage the npm configuration file +================================================== + +## SYNOPSIS + + npm config set [--global] + npm config get + npm config delete + npm config list + npm config edit + npm get + npm set [--global] + +## DESCRIPTION + +npm gets its configuration values from 5 sources, in this priority: + +* cli: + The command line flags. Putting `--foo bar` on the command line sets the + `foo` configuration parameter to `"bar"`. A `--` argument tells the cli + parser to stop reading flags. A `--flag` parameter that is at the *end* of + the command will be given the value of `true`. +* env: + Any environment variables that start with `npm_config_` will be interpreted + as a configuration parameter. For example, putting `npm_config_foo=bar` in + your environment will set the `foo` configuration parameter to `bar`. Any + environment configurations that are not given a value will be given the value + of `true`. Config values are case-insensitive, so `NPM_CONFIG_FOO=bar` will + work the same. +* $HOME/.npmrc (or the `userconfig` param, if set above): + This file is an ini-file formatted list of `key = value` parameters. +* $PREFIX/etc/npmrc (or the `globalconfig` param, if set above): + This file is an ini-file formatted list of `key = value` parameters +* default configs: + This is a set of configuration parameters that are internal to npm, and are + defaults if nothing else is specified. + +## Sub-commands + +Config supports the following sub-commands: + +### set + + npm config set key value + +Sets the config key to the value. + +If value is omitted, then it sets it to "true". + +### get + + npm config get key + +Echo the config value to stdout. + +### list + + npm config list + +Show all the config settings. + +### delete + + npm config delete key + +Deletes the key from all configuration files. + +### edit + + npm config edit + +Opens the config file in an editor. Use the `--global` flag to edit the +global config. + +## Shorthands and Other CLI Niceties + +The following shorthands are parsed on the command-line: + +* `-v`: `--version` +* `-h`, `-?`, `--help`, `-H`: `--usage` +* `-s`, `--silent`: `--loglevel silent` +* `-d`: `--loglevel info` +* `-dd`, `--verbose`: `--loglevel verbose` +* `-ddd`: `--loglevel silly` +* `-g`: `--global` +* `-l`: `--long` +* `-p`, `--porcelain`: `--parseable` +* `-reg`: `--registry` +* `-v`: `--version` +* `-f`: `--force` +* `-l`: `--long` +* `-desc`: `--description` +* `-S`: `--save` +* `-y`: `--yes` +* `-n`: `--yes false` +* `ll` and `la` commands: `ls --long` + +If the specified configuration param resolves unambiguously to a known +configuration parameter, then it is expanded to that configuration +parameter. For example: + + npm ls --par + # same as: + npm ls --parseable + +If multiple single-character shorthands are strung together, and the +resulting combination is unambiguously not some other configuration +param, then it is expanded to its various component pieces. For +example: + + npm ls -gpld + # same as: + npm ls --global --parseable --long --loglevel info + +## Per-Package Config Settings + +When running scripts (see `npm help scripts`) +the package.json "config" keys are overwritten in the environment if +there is a config param of `[@]:`. For example, if +the package.json has this: + + { "name" : "foo" + , "config" : { "port" : "8080" } + , "scripts" : { "start" : "node server.js" } } + +and the server.js is this: + + http.createServer(...).listen(process.env.npm_package_config_port) + +then the user could change the behavior by doing: + + npm config set foo:port 80 + +## Config Settings + +### always-auth + +* Default: false +* Type: Boolean + +Force npm to always require authentication when accessing the registry, +even for `GET` requests. + +### bin-publish + +* Default: false +* Type: Boolean + +If set to true, then binary packages will be created on publish. + +This is the way to opt into the "bindist" behavior described below. + +### bindist + +* Default: Unstable node versions, `null`, otherwise + `"--"` +* Type: String or `null` + +Experimental: on stable versions of node, binary distributions will be +created with this tag. If a user then installs that package, and their +`bindist` tag is found in the list of binary distributions, they will +get that prebuilt version. + +Pre-build node packages have their preinstall, install, and postinstall +scripts stripped (since they are run prior to publishing), and do not +have their `build` directories automatically ignored. + +It's yet to be seen if this is a good idea. + +### browser + +* Default: OS X: `"open"`, others: `"google-chrome"` +* Type: String + +The browser that is called by the `npm docs` command to open websites. + +### cache + +* Default: Windows: `~/npm-cache`, Posix: `~/.npm` +* Type: path + +The location of npm's cache directory. See `npm help cache` + +### color + +* Default: true +* Type: Boolean or `"always"` + +If false, never shows colors. If `"always"` then always shows colors. +If true, then only prints color codes for tty file descriptors. + +### depth + +* Default: Infinity +* Type: Number + +The depth to go when recursing directories for `npm ls` and +`npm cache ls`. + +### description + +* Default: true +* Type: Boolean + +Show the description in `npm search` + +### dev + +* Default: false +* Type: Boolean + +Install `dev-dependencies` along with packages. + +Note that `dev-dependencies` are also installed if the `npat` flag is +set. + +### editor + +* Default: `EDITOR` environment variable if set, or `"vi"` +* Type: path + +The command to run for `npm edit` or `npm config edit`. + +### force + +* Default: false +* Type: Boolean + +Makes various commands more forceful. + +* lifecycle script failure does not block progress. +* publishing clobbers previously published versions. +* skips cache when requesting from the registry. +* prevents checks against clobbering non-npm files. + +### global + +* Default: false +* Type: Boolean + +Operates in "global" mode, so that packages are installed into the +`prefix` folder instead of the current working directory. See +`npm help folders` for more on the differences in behavior. + +* packages are installed into the `prefix/node_modules` folder, instead of the + current working directory. +* bin files are linked to `prefix/bin` +* man pages are linked to `prefix/share/man` + +### globalconfig + +* Default: {prefix}/etc/npmrc +* Type: path + +The config file to read for global config options. + +### globalignorefile + +* Default: {prefix}/etc/npmignore +* Type: path + +The config file to read for global ignore patterns to apply to all users +and all projects. + +If not found, but there is a "gitignore" file in the +same directory, then that will be used instead. + +### group + +* Default: GID of the current process +* Type: String or Number + +The group to use when running package scripts in global mode as the root +user. + +### gzipbin + +* Default: "gzip" +* Type: path + +The gzip binary + +### ignore + +* Default: "" +* Type: string + +A white-space separated list of glob patterns of files to always exclude +from packages when building tarballs. + +### init.version + +* Default: "0.0.0" +* Type: semver + +The value `npm init` should use by default for the package version. + +### init.author.name + +* Default: "0.0.0" +* Type: String + +The value `npm init` should use by default for the package author's name. + +### init.author.email + +* Default: "" +* Type: String + +The value `npm init` should use by default for the package author's email. + +### init.author.url + +* Default: "" +* Type: String + +The value `npm init` should use by default for the package author's homepage. + +### link + +* Default: false +* Type: Boolean + +If true, then local installs will link if there is a suitable globally +installed package. + +Note that this means that local installs can cause things to be +installed into the global space at the same time. The link is only done +if one of the two conditions are met: + +* The package is not already installed globally, or +* the globally installed version is identical to the version that is + being installed locally. + +### logfd + +* Default: stderr file descriptor +* Type: Number or Stream + +The location to write log output. + +### loglevel + +* Default: "warn" +* Type: String +* Values: "silent", "win", "error", "warn", "info", "verbose", "silly" + +What level of logs to report. On failure, *all* logs are written to +`npm-debug.log` in the current working directory. + +### long + +* Default: false +* Type: Boolean + +Show extended information in `npm ls` + +### node-version + +* Default: process.version +* Type: semver or false + +The node version to use when checking package's "engines" hash. + +### npat + +* Default: false +* Type: Boolean + +Run tests on installation and report results to the +`npaturl`. + +### npaturl + +* Default: Not yet implemented +* Type: url + +The url to report npat test results. + +### onload-script + +* Default: false +* Type: path + +A node module to `require()` when npm loads. Useful for programmatic +usage. + +### outfd + +* Default: standard output file descriptor +* Type: Number or Stream + +Where to write "normal" output. This has no effect on log output. + +### parseable + +* Default: false +* Type: Boolean + +Output parseable results from commands that write to +standard output. + +### prefix + +* Default: node's process.installPrefix +* Type: path + +The location to install global items. If set on the command line, then +it forces non-global commands to run in the specified folder. + +### production + +* Default: false +* Type: Boolean + +Set to true to run in "production" mode. + +1. devDependencies are not installed at the topmost level when running + local `npm install` without any arguments. +2. Set the NODE_ENV="production" for lifecycle scripts. + +### proxy + +* Default: `HTTP_PROXY` or `http_proxy` environment variable, or null +* Type: url + +A proxy to use for outgoing http requests. + +### rebuild-bundle + +* Default: true +* Type: Boolean + +Rebuild bundled dependencies after installation. + +### registry + +* Default: https://registry.npmjs.org/ +* Type: url + +The base URL of the npm package registry. + +### rollback + +* Default: true +* Type: Boolean + +Remove failed installs. + +### save + +* Default: false +* Type: Boolean + +Save installed packages to a package.json file as dependencies. + +Only works if there is already a package.json file present. + +### searchopts + +* Default: "" +* Type: String + +Space-separated options that are always passed to search. + +### searchexclude + +* Default: "" +* Type: String + +Space-separated options that limit the results from search. + +### shell + +* Default: SHELL environment variable, or "bash" +* Type: path + +The shell to run for the `npm explore` command. + +### tag + +* Default: latest +* Type: String + +If you ask npm to install a package and don't tell it a specific version, then +it will install the specified tag. + +Also the tag that is added to the package@version specified by the `npm +tag` command, if no explicit tag is given. + +### tar + +* Default: TAR environment variable, or "tar" +* Type: path + +The tar executable + +### tmp + +* Default: TMPDIR environment variable, or "/tmp" +* Type: path + +Where to store temporary files and folders. All temp files are deleted +on success, but left behind on failure for forensic purposes. + +### unicode + +* Default: true +* Type: Boolean + +When set to true, npm uses unicode characters in the tree output. When +false, it uses ascii characters to draw trees. + +### unsafe-perm + +* Default: false if running as root, true otherwise +* Type: Boolean + +Set to true to suppress the UID/GID switching when running package +scripts. If set explicitly to false, then installing as a non-root user +will fail. + +### usage + +* Default: false +* Type: Boolean + +Set to show short usage output (like the -H output) +instead of complete help when doing `npm help`. + +### user + +* Default: "nobody" +* Type: String or Number + +The UID to set to when running package scripts as root. + +### username + +* Default: null +* Type: String + +The username on the npm registry. Set with `npm adduser` + +### userconfig + +* Default: ~/.npmrc +* Type: path + +The location of user-level configuration settings. + +### userignorefile + +* Default: ~/.npmignore +* Type: path + +The location of a user-level ignore file to apply to all packages. + +If not found, but there is a .gitignore file in the same directory, then +that will be used instead. + +### version + +* Default: false +* Type: boolean + +If true, output the npm version and exit successfully. + +Only relevant when specified explicitly on the command line. + +### viewer + +* Default: "man" +* Type: path + +The program to use to view help content. + +### yes + +* Default: null +* Type: Boolean or null + +If set to `null`, then prompt the user for responses in some +circumstances. + +If set to `true`, then answer "yes" to any prompt. If set to `false` +then answer "no" to any prompt. diff --git a/vendor/npm/npm-1.0.27/doc/deprecate.md b/vendor/npm/npm-1.0.27/doc/deprecate.md new file mode 100644 index 000000000..a6d7c74e7 --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/deprecate.md @@ -0,0 +1,19 @@ +npm-deprecate(1) -- Deprecate a version of a package +==================================================== + +## SYNOPSIS + + npm deprecate [@] + +## DESCRIPTION + +This command will update the npm registry entry for a package, providing +a deprecation warning to all who attempt to install it. + +It works on version ranges as well as specific versions, so you can do +something like this: + + npm deprecate my-thing@"< 0.2.3" "critical bug fixed in v0.2.3" + +Note that you must be the package owner to deprecate something. See the +`owner` and `adduser` help topics. diff --git a/vendor/npm/npm-1.0.27/doc/developers.md b/vendor/npm/npm-1.0.27/doc/developers.md new file mode 100644 index 000000000..eab9b8aa8 --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/developers.md @@ -0,0 +1,167 @@ +npm-developers(1) -- Developer Guide +==================================== + +## DESCRIPTION + +So, you've decided to use npm to develop (and maybe publish/deploy) +your project. + +Fantastic! + +There are a few things that you need to do above the simple steps +that your users will do to install your program. + +## About These Documents + +These are man pages. If you install npm, you should be able to +then do `man npm-thing` to get the documentation on a particular +topic. + +Any time you see "see npm-whatever(1)", you can do `man npm-whatever` +or `npm help whatever` to get at the docs. + +## What is a `package` + +A package is: + +* a) a folder containing a program described by a package.json file +* b) a gzipped tarball containing (a) +* c) a url that resolves to (b) +* d) a `@` that is published on the registry with (c) +* e) a `@` that points to (d) +* f) a `` that has a "latest" tag satisfying (e) + +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). + +## The package.json File + +You need to have a `package.json` file in the root of your project to do +much of anything with npm. That is basically the whole interface. + +See npm-json(1) for details about what goes in that file. At the very +least, you need: + +* name: + This should be a string that identifies your project. Please do not + use the name to specify that it runs on node, or is in JavaScript. + You can use the "engines" field to explicitly state the versions of + node (or whatever else) that your program requires, and it's pretty + well assumed that it's javascript. + + It does not necessarily need to match your github repository name. + + So, `node-foo` and `bar-js` are bad names. `foo` or `bar` are better. + +* version: + A semver-compatible version. + +* engines: + Specify the versions of node (or whatever else) that your program + runs on. The node API changes a lot, and there may be bugs or new + functionality that you depend on. Be explicit. + +* author: + Take some credit. + +* scripts: + If you have a special compilation or installation script, then you + should put it in the `scripts` hash. You should definitely have at + least a basic smoke-test command as the "scripts.test" field. + See npm-scripts(1). + +* main: + If you have a single module that serves as the entry point to your + program (like what the "foo" package gives you at require("foo")), + then you need to specify that in the "main" field. + +* directories: + This is a hash of folders. The best ones to include are "lib" and + "doc", but if you specify a folder full of man pages in "man", then + they'll get installed just like these ones. + +You can use `npm init` in the root of your package in order to get you +started with a pretty basic package.json file. See `npm-init(1)` for +more info. + +## Keeping files *out* of your package + +Use a `.npmignore` file to keep stuff out of your package. If there's +no .npmignore file, but there *is* a .gitignore file, then npm will +ignore the stuff matched by the .gitignore file. If you *want* to +include something that is excluded by your .gitignore file, you can +create an empty .npmignore file to override it. + +## Link Packages + +`npm link` is designed to install a development package and see the +changes in real time without having to keep re-installing it. (You do +need to either re-link or `npm rebuild -g` to update compiled packages, +of course.) + +More info at `npm-link(1)`. + +## Before Publishing: Make Sure Your Package Installs and Works + +**This is important.** + +If you can not install it locally, you'll have +problems trying to publish it. Or, worse yet, you'll be able to +publish it, but you'll be publishing a broken or pointless package. +So don't do that. + +In the root of your package, do this: + + npm install . -g + +That'll show you that it's working. If you'd rather just create a symlink +package that points to your working directory, then do this: + + npm link + +Use `npm ls -g` to see if it's there. + +To test a local install, go into some other folder, and then do: + + cd ../some-other-folder + npm install ../my-package + +to install it locally into the node_modules folder in that other place. + +Then go into the node-repl, and try using require("my-thing") to +bring in your module's main module. + +## Create a User Account + +Create a user with the adduser command. It works like this: + + npm adduser + +and then follow the prompts. + +This is documented better in npm-adduser(1). So do this to get the +details: + + npm help adduser + +## Publish your package + +This part's easy. IN the root of your folder, do this: + + npm publish + +You can give publish a url to a tarball, or a filename of a tarball, +or a path to a folder. + +Note that pretty much **everything in that folder will be exposed** +by default. So, if you have secret stuff in there, use a `.npminclude` +or `.npmignore` file to list out the globs to include/ignore, or publish +from a fresh checkout. + +## Brag about it + +Send emails, write blogs, blab in IRC. + +Tell the world how easy it is to install your program! diff --git a/vendor/npm/npm-1.0.27/doc/docs.md b/vendor/npm/npm-1.0.27/doc/docs.md new file mode 100644 index 000000000..38e123c59 --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/docs.md @@ -0,0 +1,14 @@ +npm-docs(1) -- Docs for a package in a web browser maybe +======================================================== + +## SYNOPSIS + + npm docs + npm home + +## DESCRIPTION + +This command tries to guess at the likely location of a package's +documentation URL, and then tries to open it using the `--browser` +config param. + diff --git a/vendor/npm/npm-1.0.27/doc/edit.md b/vendor/npm/npm-1.0.27/doc/edit.md new file mode 100644 index 000000000..b5bd07947 --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/edit.md @@ -0,0 +1,18 @@ +npm-edit(1) -- Edit an installed package +======================================== + +## SYNOPSIS + + npm edit [@] + +## DESCRIPTION + +Opens the package folder in the default editor (or whatever you've +configured as the npm `editor` config -- see `npm help config`.) + +After it has been edited, the package is rebuilt so as to pick up any +changes in compiled packages. + +For instance, you can do `npm install connect` to install connect +into your package, and then `npm edit connect` to make a few +changes to your locally installed copy. diff --git a/vendor/npm/npm-1.0.27/doc/explore.md b/vendor/npm/npm-1.0.27/doc/explore.md new file mode 100644 index 000000000..6a1b71e9c --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/explore.md @@ -0,0 +1,16 @@ +npm-explore(1) -- Browse an installed package +============================================= + +## SYNOPSIS + + npm explore [@] [ -- ] + +## DESCRIPTION + +Spawn a subshell in the directory of the installed package specified. + +If a command is specified, then it is run in the subshell, which then +immediately terminates. + +Note that the package is *not* automatically rebuilt afterwards, so be +sure to use `npm rebuild ` if you make any changes. diff --git a/vendor/npm/npm-1.0.27/doc/faq.md b/vendor/npm/npm-1.0.27/doc/faq.md new file mode 100644 index 000000000..4cfcec5b7 --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/faq.md @@ -0,0 +1,200 @@ +npm-faq(1) -- Frequently Asked Questions +======================================== + +## Where can I find these docs in HTML? + + + +## It didn't work. + +That's not really a question. + +## Why didn't it work? + +I don't know yet. + +Read the error output, and if you can't figure out what it means, +do what it says and post a bug with all the information it asks for. + +## Where does npm put stuff? + +See `npm help folders` + +tl;dr: + +* Use the `npm root` command to see where modules go, and the `npm bin` + command to see where executables go +* Global installs are different from local installs. If you install + something with the `-g` flag, then its executables go in `npm bin -g` + and its modules go in `npm root -g`. + +## How do I install something everywhere? + +Install it globally by tacking `-g` or `--global` to the command. + +## I installed something globally, but I can't `require()` it + +Install it locally. + +## I don't wanna. + +Check out `npm link`. You might like it. + +## No, I really want 0.x style 'everything global' style. + +Ok, fine. Do this: + + echo 'export NODE_PATH="'$(npm root -g)'"' >> ~/.bashrc + . ~/.bashrc + npm config set global true + +This is not recommended. + +Many things **will not work** if you do this. Make sure you read and +understand `npm help config` and `npm help global` before you complain +about things being broken. + +When you realize what a mistake it was, do this to switch back: + + npm config delete global --local + +## If 'npm' is an acronym, why is it never capitalized? + +Contrary to the belief of many, "npm" is not in fact an abbreviation for +"Node Package Manager". It is a recursive bacronymic abbreviation for +"npm is not an acronym". + +"NPM", however, *is* an acronym for the National Association of +Pastoral Musicians. You can learn more about them at . +It is not an acronym, you see, but rather a capitonym. + +In all earnestness, "npm" is named after its command-line utility, +which was mostly designed to be easily typed by right-handed programmers +using US QWERTY keyboard layouts, ending with the right-ring-finger in a +postition to type the `"-"` key for flags and other command-line +arguments, and is always lower-case, though it starts most sentences it +is a part of. + +## How do I list installed packages? + +`npm ls` + +## How do I search for packages? + +`npm search` + +Arguments are greps. `npm search jsdom` shows jsdom packages. + +## How do I update npm? + + npm update npm -g + +You can also update all outdated local packages by doing `npm update` without +any arguments, or global packages by doing `npm update -g`. + +Occasionally, the version of npm will progress such that the current +version cannot be properly installed with the version that you have +installed already. (Consider, if there is ever a bug in the `update` +command.) + +In those cases, you can do this: + + curl http://npmjs.org/install.sh | sh + +## What is a `package`? + +A package is: + +* a) a folder containing a program described by a package.json file +* b) a gzipped tarball containing (a) +* c) a url that resolves to (b) +* d) a `@` that is published on the registry with (c) +* e) a `@` that points to (d) +* f) a `` 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`. + +## How do I install node with npm? + +You don't. Try one of these: + +* +* +* + +## How can I use npm for development? + +See `npm help developers` and `npm help json`. + +You'll most likely want to `npm link` your development folder. That's +awesomely handy. + +To set up your own private registry, check out `npm help registry`. + +## Can I list a url as a dependency? + +Yes. It should be a url to a gzipped tarball containing a single folder +that has a package.json in its root, or a git url. +(See "what is a package?" above.) + +## How do I symlink to a dev folder so I don't have to keep re-installing? + +See `npm help link` + +## The package registry website. What is that exactly? + +See `npm help registry`. + +## What's up with the insecure channel warnings? + +Until node 0.4.10, there were problems sending big files over HTTPS. That +means that publishes go over HTTP by default in those versions of node. + +## I forgot my password, and can't publish. How do I reset it? + +Go to . + +## I get ECONNREFUSED a lot. What's up? + +Either the registry is down, or node's DNS isn't able to reach out. +This happens a lot if you don't follow *all* the steps in the Cygwin +setup doc. + +To check if the registry is down, open up + +in a web browser. This will also tell you if you are just unable to +access the internet for some reason. + +If the registry IS down, let me know by emailing or posting an issue. +We'll have someone kick it or something. + +## Who does npm? + +`npm view npm author` + +`npm view npm contributors` + +## I have a question or request not addressed here. Where should I put it? + +Discuss it on the mailing list, or post an issue. + +* +* + +## Why does npm hate me? + +npm is not capable of hatred. It loves everyone, especially you. diff --git a/vendor/npm/npm-1.0.27/doc/find.md b/vendor/npm/npm-1.0.27/doc/find.md new file mode 120000 index 000000000..eaad7acae --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/find.md @@ -0,0 +1 @@ +list.md \ No newline at end of file diff --git a/vendor/npm/npm-1.0.27/doc/folders.md b/vendor/npm/npm-1.0.27/doc/folders.md new file mode 100644 index 000000000..7c1327a00 --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/folders.md @@ -0,0 +1,185 @@ +npm-folders(1) -- Folder Structures Used by npm +=============================================== + +## DESCRIPTION + +npm puts various things on your computer. That's its job. + +This document will tell you what it puts where. + +### tl;dr + +* Local install (default): puts stuff in `./node_modules` +* Global install (with `-g`): puts stuff in /usr/local +* Install it **locally** if you're going to `require()` it. +* Install it **globally** if you're going to run it on the command line. +* If you need both, then install it in both places, or use `npm link`. + +### prefix Configuration + +The `prefix` config defaults to the location where node is installed. +On most systems, this is `/usr/local`, and most of the time is the same +as node's `process.installPrefix`. + +When the `global` flag is set, npm installs things into this prefix. +When it is not set, it uses the root of the current package, or the +current working directory if not in a package already. + +### Node Modules + +Packages are dropped into the `node_modules` folder under the `prefix`. +When installing locally, this means that you can +`require("packagename")` to load its main module, or +`require("packagename/lib/path/to/sub/module")` to load other modules. + +If you wish to `require()` a package, then install it locally. + +### Executables + +When in global mode, executables are linked into `prefix/bin`. + +When in local mode, executables are linked into +`prefix/node_modules/.bin`. + +### Man Pages + +When in global mode, man pages are linked into `prefix/share/man`. + +When in local mode, man pages are not installed. + +### Cache + +See `npm help cache`. Cache files are stored in `~/.npm` on Posix, or +`~/npm-cache` on Windows. + +This is controlled by the `cache` configuration param. + +### Temp Files + +Temporary files are stored by default in the folder specified by the +`tmp` config, which defaults to either the TMPDIR environment +variable, or `/tmp`. + +Temp files are given a unique folder under this root for each run of the +program, and are deleted upon successful exit. + +## More Information + +When doing local installings, npm first tries to find an appropriate +`prefix` folder. This is so that `npm install foo@1.2.3` will install +to the sensible root of your package, even if you happen to have `cd`ed +into some other folder. + +Starting at the $PWD, npm will walk up the folder tree checking for a +folder that contains either a `package.json` file, or a `node_modules` +folder. If such a thing is found, then that is treated as the effective +"current directory" for the purpose of running npm commands. (This +behavior is inspired by and similar to git's .git-folder seeking +logic when running git commands in a working dir.) + +If no package root is found, then the current folder is used. + +When you run `npm install foo@1.2.3`, then the package is loaded into +the cache, and then unpacked into `./node_modules/foo`. Then, any of +foo's dependencies are similarly unpacked into +`./node_modules/foo/node_modules/...`. + +Any bin files are symlinked to `./node_modules/.bin/`, so that they may +be found by npm scripts when necessary. + +### Global Installation + +If the `global` configuration is set to true, then npm will +install packages "globally". + +For global installation, packages are installed roughly the same way, +but the module root is `/usr/local/lib/node_modules`, and bin files are +linked to `/usr/local/bin` instead of `./node_modules/.bin`. + +### Cycles, Conflicts, and Folder Parsimony + +Cycles are handled using the property of node's module system that it +walks up the directories looking for `node_modules` folders. So, at every +stage, if a package is already installed in an ancestor `node_modules` +folder, then it is not installed at the current location. + +Consider the case above, where `foo -> bar -> baz`. Imagine if, in +addition to that, baz depended on bar, so you'd have: +`foo -> bar -> baz -> bar -> baz ...`. However, since the folder +structure is: `foo/node_modules/bar/node_modules/baz`, there's no need to +put another copy of bar into `.../baz/node_modules`, since when it calls +require("bar"), it will get the copy that is installed in +`foo/node_modules/bar`. + +This shortcut is only used if the exact same +version would be installed in multiple nested `node_modules` folders. It +is still possible to have `a/node_modules/b/node_modules/a` if the two +"a" packages are different versions. However, without repeating the +exact same package multiple times, an infinite regress will always be +prevented. + +Another optimization can be made by installing dependencies at the +highest level possible, below the localized "target" folder. + +#### Example + +Consider this dependency graph: + + foo + +-- blerg@1.2.5 + +-- bar@1.2.3 + | +-- blerg@1.x (latest=1.3.7) + | +-- baz@2.x + | | `-- quux@3.x + | | `-- bar@1.2.3 (cycle) + | `-- asdf@* + `-- baz@1.2.3 + `-- quux@3.x + `-- bar + +In this case, we might expect a folder structure like this: + + foo + +-- node_modules + +-- blerg (1.2.5) <---[A] + +-- bar (1.2.3) <---[B] + | +-- node_modules + | | `-- baz (2.0.2) <---[C] + | | `-- node_modules + | | `-- quux (3.2.0) + | `-- asdf (2.3.4) + `-- baz (1.2.3) <---[D] + `-- node_modules + `-- quux (3.2.0) <---[E] + +Since foo depends directly on bar@1.2.3 and baz@1.2.3, those are +installed in foo's `node_modules` folder. + +Even though the latest copy of blerg is 1.3.7, foo has a specific +dependency on version 1.2.5. So, that gets installed at [A]. Since the +parent installation of blerg satisfie's bar's dependency on blerg@1.x, +it does not install another copy under [B]. + +Bar [B] also has dependencies on baz and asdf, so those are installed in +bar's `node_modules` folder. Because it depends on `baz@2.x`, it cannot +re-use the `baz@1.2.3` installed in the parent `node_modules` folder [D], +and must install its own copy [C]. + +Underneath bar, the `baz->quux->bar` dependency creates a cycle. +However, because `bar` is already in `quux`'s ancestry [B], it does not +unpack another copy of bar into that folder. + +Underneath `foo->baz` [D], quux's [E] folder tree is empty, because its +dependency on bar is satisfied by the parent folder copy installed at [B]. + +For a graphical breakdown of what is installed where, use `npm ls`. + +### Publishing + +Upon publishing, npm will look in the `node_modules` folder. If any of +the items there are not in the `bundledDependencies` array, then they will +not be included in the package tarball. + +This allows a package maintainer to install all of their dependencies +(and dev dependencies) locally, but only re-publish those items that +cannot be found elsewhere. See `npm help json` for more information. diff --git a/vendor/npm/npm-1.0.27/doc/get.md b/vendor/npm/npm-1.0.27/doc/get.md new file mode 120000 index 000000000..3dc873736 --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/get.md @@ -0,0 +1 @@ +config.md \ No newline at end of file diff --git a/vendor/npm/npm-1.0.27/doc/global.md b/vendor/npm/npm-1.0.27/doc/global.md new file mode 120000 index 000000000..c3598dd7d --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/global.md @@ -0,0 +1 @@ +folders.md \ No newline at end of file diff --git a/vendor/npm/npm-1.0.27/doc/help-search.md b/vendor/npm/npm-1.0.27/doc/help-search.md new file mode 100644 index 000000000..a63c942d7 --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/help-search.md @@ -0,0 +1,29 @@ +npm-help-search(1) Search npm help documentation +================================================ + +## SYNOPSIS + + npm help-search some search terms + +## DESCRIPTION + +This command will search the npm markdown documentation files for the +terms provided, and then list the results, sorted by relevance. + +If only one result is found, then it will show that help topic. + +If the argument to `npm help` is not a known help topic, then it will +call `help-search`. It is rarely if ever necessary to call this +command directly. + +## CONFIGURATION + +### long + +* Type: Boolean +* Default false + +If true, the "long" flag will cause help-search to output context around +where the terms were found in the documentation. + +If false, then help-search will just list out the help topics found. diff --git a/vendor/npm/npm-1.0.27/doc/home.md b/vendor/npm/npm-1.0.27/doc/home.md new file mode 120000 index 000000000..8828313f5 --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/home.md @@ -0,0 +1 @@ +docs.md \ No newline at end of file diff --git a/vendor/npm/npm-1.0.27/doc/init.md b/vendor/npm/npm-1.0.27/doc/init.md new file mode 100644 index 000000000..5f6d81c2a --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/init.md @@ -0,0 +1,23 @@ +npm init(1) -- Interactively create a package.json file +======================================================= + +## SYNOPSIS + + npm init + +## DESCRIPTION + +This will ask you a bunch of questions, and then write a package.json for you. + +It attempts to make reasonable guesses about what you want things to be set to, +and then writes a package.json file with the options you've selected. + +If you already have a package.json file, it'll read that first, and default to +the options in there. + +It is strictly additive, so it does not delete options from your package.json +without a really good reason to do so. + +## SEE ALSO + +npm-json(1) diff --git a/vendor/npm/npm-1.0.27/doc/install.md b/vendor/npm/npm-1.0.27/doc/install.md new file mode 100644 index 000000000..0d4e959fa --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/install.md @@ -0,0 +1,129 @@ +npm-install(1) -- install a package +=================================== + +## SYNOPSIS + + npm install (with no args in a package dir) + npm install + npm install + npm install + npm install + npm install @ + npm install @ + npm install @ + +## DESCRIPTION + +This command installs a package, and any packages that it depends on. + +A `package` is: + +* a) a folder containing a program described by a package.json file +* b) a gzipped tarball containing (a) +* c) a url that resolves to (b) +* d) a `@` that is published on the registry with (c) +* e) a `@` that points to (d) +* f) a `` that has a "latest" tag satisfying (e) + +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). + + +* 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. + +* npm install ``: + Install a package that is sitting in a folder on the filesystem. + +* npm install ``: + 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`. + + In order to distinguish between this and remote installs, the argument + must either be "." or contain a "/" in it. + + Example: + + npm install ./package.tgz + +* npm install ``: + 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 http://github.com/waveto/node-crypto/tarball/v0.0.5 + +* npm install ``: + Do a `@` install, where `` is the "tag" config. (See + `npm help config`) + + Example: + + npm install sax + +* npm install `@`: + 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@stable + +* npm install `@`: + Install the specified version of the package. This will fail if the version + has not been published to the registry. + + Example: + + npm install sax@0.1.1 + +* npm install `@`: + Install a version of the package matching the specified version range. This + will follow the same rules for resolving dependencies described in `npm help json`. + + Note that most version ranges must be put in quotes so that your shell will + treat it as a single argument. + + Example: + + npm install sax@">=0.1.0 <0.2.0" + +You may combine multiple arguments, and even multiple types of arguments. +For example: + + npm install sax@">=0.1.0 <0.2.0" bench supervisor + +The `--tag` argument will apply to all of the specified install targets. + +The `--force` argument will force npm to fetch remote resources even if a +local copy exists on disk. + + npm install sax --force + +The `--global` argument will cause npm to install the package globally +rather than locally. See `npm help global`. + +The `--link` argument will cause npm to link global installs into the +local space in some cases. + +See `npm help config`. Many of the configuration params have some +effect on installation, since that's most of what npm does. + +## SEE ALSO + +* npm-config(1) +* npm-build(1) +* npm-registry(1) +* npm-build(1) +* npm-link(1) +* npm-folders(1) +* npm-tag(1) diff --git a/vendor/npm/npm-1.0.27/doc/json.md b/vendor/npm/npm-1.0.27/doc/json.md new file mode 100644 index 000000000..2a7b10eb7 --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/json.md @@ -0,0 +1,448 @@ +npm-json(1) -- Specifics of npm's package.json handling +======================================================= + +## DESCRIPTION + +This document is all you need to know about what's required in your package.json +file. It must be actual JSON, not just a JavaScript object literal. + +A lot of the behavior described in this document is affected by the config +settings described in `npm help config`. + +## DEFAULT VALUES + +npm will default some values based on package contents. + +* `"scripts": {"start": "node server.js"}` + + If there is a `server.js` file in the root of your package, then npm + will default the `start` command to `node server.js`. + +* `"scripts":{"preinstall": "node-waf clean || true; node-waf configure build"}` + + If there is a `wscript` file in the root of your package, npm will + default the `preinstall` command to compile using node-waf. + +* `"contributors": [...]` + + If there is an `AUTHORS` file in the root of your package, npm will + treat each line as a `Name (url)` format, where email and url + are optional. Lines which start with a `#` or are blank, will be + ignored. + +## name + +The *most* important things in your package.json are the name and version fields. +Those are actually required, and your package won't install without +them. The name and version together form an identifier that is assumed +to be completely unique. Changes to the package should come along with +changes to the version. + +The name is what your thing is called. Some tips: + +* Don't put "js" or "node" in the name. It's assumed that it's js, since you're + writing a package.json file, and you can specify the engine using the "engines" + field. (See below.) +* The name ends up being part of a URL, an argument on the command line, and a + folder name. Any name with non-url-safe characters will be rejected. + Also, it can't start with a dot or an underscore. +* The name will probably be passed as an argument to require(), so it should + be something short, but also reasonably descriptive. +* You may want to check the npm registry to see if there's something by that name + already, before you get too attached to it. http://registry.npmjs.org/ + +## version + +The *most* important things in your package.json are the name and version fields. +Those are actually required, and your package won't install without +them. The name and version together form an identifier that is assumed +to be completely unique. Changes to the package should come along with +changes to the version. + +Version must be parseable by +[node-semver](https://github.com/isaacs/node-semver), which is bundled +with npm as a dependency. (`npm install semver` to use it yourself.) + +Here's how npm's semver implementation deviates from what's on semver.org: + +* Versions can start with "v" +* A numeric item separated from the main three-number version by a hyphen + will be interpreted as a "build" number, and will *increase* the version. + But, if the tag is not a number separated by a hyphen, then it's treated + as a pre-release tag, and is *less than* the version without a tag. + So, `0.1.2-7 > 0.1.2-7-beta > 0.1.2-6 > 0.1.2 > 0.1.2beta` + +This is a little bit confusing to explain, but matches what you see in practice +when people create tags in git like "v1.2.3" and then do "git describe" to generate +a patch version. + +## description + +Put a description in it. It's a string. This helps people discover your +package, as it's listed in `npm search`. + +## keywords + +Put keywords in it. It's an array of strings. This helps people +discover your package as it's listed in `npm search`. + +## homepage + +The url to the project homepage. + +**NOTE**: This is *not* the same as "url". If you put a "url" field, +then the registry will think it's a redirection to your package that has +been published somewhere else, and spit at you. + +Literally. Spit. I'm so not kidding. + +## people fields: author, contributors + +The "author" is one person. "contributors" is an array of people. A "person" +is an object with a "name" field and optionally "url" and "email", like this: + + { "name" : "Barney Rubble" + , "email" : "b@rubble.com" + , "url" : "http://barnyrubble.tumblr.com/" + } + +Or you can shorten that all into a single string, and npm will parse it for you: + + "Barney Rubble (http://barnyrubble.tumblr.com/) + +Both email and url are optional either way. + +npm also sets a top-level "maintainers" field with your npm user info. + +## files + +The "files" field is an array of files to include in your project. If +you name a folder in the array, then it will also include the files +inside that folder. (Unless they would be ignored by another rule.) + +You can also provide a ".npmignore" file in the root of your package, +which will keep files from being included, even if they would be picked +up by the files array. The ".npmignore" file works just like a +".gitignore". + +## main + +The main field is a module ID that is the primary entry point to your program. +That is, if your package is named `foo`, and a user installs it, and then does +`require("foo")`, then your main module's exports object will be returned. + +This should be a module ID relative to the root of your package folder. + +For most modules, it makes the most sense to have a main script and often not +much else. + +## bin + +A lot of packages have one or more executable files that they'd like to +install into the PATH. npm makes this pretty easy (in fact, it uses this +feature to install the "npm" executable.) + +To use this, supply a `bin` field in your package.json which is a map of +command name to local file name. On install, npm will link that file into +place right next to wherever node is installed. (Presumably, this is in your +PATH, and defaults to `/usr/local/bin`.) On activation, the versioned file +will get linked to the main filename (just like how the main.js stuff works, +but with an executable in the PATH.) + +For example, npm has this: + + { "bin" : { "npm" : "./cli.js" } } + +So, when you install npm, it'll create a symlink from the `cli.js` script to +`/usr/local/bin/npm-version`. Then, when you activate that version, it'll +create a symlink from `/usr/local/bin/npm-version` to `/usr/local/bin/npm`. + +Notice that if the executable file is interpreted by node (i.e., specifying +node in the shebang line), npm actually installs a shim instead of symlinking +it, which causes expressions `require.main === module` and `module.id === "."` +evaluate to `false` within the file. This seems unable to be resolved until +node provides a "flexible `require()`". + +Shortcut: If you have a single executable, and its name is already what you +want it to be, then you can just supply it as a string. For example: + + { "bin" : "./path/to/program" } + +would be the same as this: + + { "bin" : { "program" : "./path/to/program" } } + +## man + +Specify either a single file or an array of filenames to put in place for the +`man` program to find. + +If only a single file is provided, then it's installed such that it is the +result from `man `, regardless of its actual filename. For example: + + { "name" : "foo" + , "version" : "1.2.3" + , "description" : "A packaged foo fooer for fooing foos" + , "main" : "foo.js" + , "man" : "./man/doc.1" + } + +would link the `./man/doc.1` file in such that it is the target for `man foo` + +If the filename doesn't start with the package name, then it's prefixed. +So, this: + + { "name" : "foo" + , "version" : "1.2.3" + , "description" : "A packaged foo fooer for fooing foos" + , "main" : "foo.js" + , "man" : [ "./man/foo.1", "./man/bar.1" ] + } + +will create files to do `man foo` and `man foo-bar`. + +Man files must end with a number, and optionally a `.gz` suffix if they are +compressed. The number dictates which man section the file is installed into. + + { "name" : "foo" + , "version" : "1.2.3" + , "description" : "A packaged foo fooer for fooing foos" + , "main" : "foo.js" + , "man" : [ "./man/foo.1", "./man/foo.2" ] + } + +will create entries for `man foo` and `man 2 foo` + +## directories + +The CommonJS [Packages](http://wiki.commonjs.org/wiki/Packages/1.0) spec details a +few ways that you can indicate the structure of your package using a `directories` +hash. If you look at [npm's package.json](http://registry.npmjs.org/npm/latest), +you'll see that it has directories for doc, lib, and man. + +In the future, this information may be used in other creative ways. + +### directories.lib + +Tell people where the bulk of your library is. Nothing special is done +with the lib folder in any way, but it's useful meta info. + +### directories.bin + +If you specify a "bin" directory, then all the files in that folder will +be used as the "bin" hash. + +If you have a "bin" hash already, then this has no effect. + +### directories.man + +A folder that is full of man pages. Sugar to generate a "man" array by +walking the folder. + +### directories.doc + +Put markdown files in here. Eventually, these will be displayed nicely, +maybe, someday. + +### directories.example + +Put example scripts in here. Someday, it might be exposed in some clever way. + +## repository + +Specify the place where your code lives. This is helpful for people who +want to contribute. If the git repo is on github, then the `npm docs` +command will be able to find you. + +Do it like this: + + "repository" : + { "type" : "git" + , "url" : "http://github.com/isaacs/npm.git" + } + + "repository" : + { "type" : "svn" + , "url" : "http://v8.googlecode.com/svn/trunk/" + } + +The URL should be a publicly available (perhaps read-only) url that can be handed +directly to a VCS program without any modification. It should not be a url to an +html project page that you put in your browser. It's for computers. + +## scripts + +The "scripts" member is an object hash of script commands that are run +at various times in the lifecycle of your package. The key is the lifecycle +event, and the value is the command to run at that point. + +See `npm help scripts` to find out more about writing package scripts. + +## config + +A "config" hash can be used to set configuration +parameters used in package scripts that persist across upgrades. For +instance, if a package had the following: + + { "name" : "foo" + , "config" : { "port" : "8080" } } + +and then had a "start" command that then referenced the +`npm_package_config_port` environment variable, then the user could +override that by doing `npm config set foo:port 8001`. + +See `npm help config` and `npm help scripts` for more on package +configs. + +## dependencies + +Dependencies are specified with a simple hash of package name to version +range. The version range is EITHER a string which has one or more +space-separated descriptors, OR a range like "fromVersion - toVersion" + +**Please do not put test harnesses in your `dependencies` hash.** See +`devDependencies`, below. + +Version range descriptors may be any of the following styles, where "version" +is a semver compatible version identifier. + +* `version` Must match `version` exactly +* `=version` Same as just `version` +* `>version` Must be greater than `version` +* `>=version` etc +* `=version1 <=version2`. +* `range1 || range2` Passes if either range1 or range2 are satisfied. + +For example, these are all valid: + + { "dependencies" : + { "foo" : "1.0.0 - 2.9999.9999" + , "bar" : ">=1.0.2 <2.1.2" + , "baz" : ">1.0.2 <=2.3.4" + , "boo" : "2.0.1" + , "qux" : "<1.0.0 || >=2.3.1 <2.4.5 || >=2.5.2 <3.0.0" + , "asd" : "http://asdf.com/asdf.tar.gz" + , "til" : "~1.2" + , "elf" : "~1.2.3" + , "two" : "2.x" + , "thr" : "3.3.x" + } + } + +### Tilde Version Ranges + +A range specifier starting with a tilde `~` character is matched against +a version in the following fashion. + +* The version must be at least as high as the range. +* The version must be less than the next major revision above the range. + +For example, the following are equivalent: + +* `"~1.2.3" = ">=1.2.3 <1.3.0"` +* `"~1.2" = ">=1.2.0 <2.0.0"` +* `"~1" = ">=1.0.0 <2.0.0"` + +### X Version Ranges + +An "x" in a version range specifies that the version number must start +with the supplied digits, but any digit may be used in place of the x. + +The following are equivalent: + +* `"1.2.x" = ">=1.2.0 <1.3.0"` +* `"1.x.x" = ">=1.0.0 <2.0.0"` +* `"1.2" = "1.2.x"` +* `"1.x" = "1.x.x"` +* `"1" = "1.x.x"` + +You may not supply a comparator with a version containing an x. Any +digits after the first "x" are ignored. + +### URLs as Dependencies + +Starting with npm version 0.2.14, you may specify a tarball URL in place +of a version range. + +This tarball will be downloaded and installed locally to your package at +install time. + +## 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 +the external test or documentation framework that you use. + +In this case, it's best to list these additional items in a +`devDependencies` hash. + +These things will be installed whenever the `--dev` configuration flag +is set. This flag is set automatically when doing `npm link`, and can +be managed like any other npm configuration param. See `npm help +config` for more on the topic. + +## bundledDependencies + +Array of package names that will be bundled when publishing the package. + +## engines + +Packages/1.0 says that you can have an "engines" field with an array of engine +names. However, it has no provision for specifying which version of the engine +your stuff runs on. + +With npm, you can use either of the following styles to specify the version of +node that your stuff works on: + + { "engines" : [ "node >=0.1.27 <0.1.30" ] } + +or: + + { "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. + +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 +that it works on node. + +## preferGlobal + +If your package is primarily a command-line application that should be +installed globally, then set this value to `true` to provide a warning +if it is installed locally. + +It doesn't actually prevent users from installing it locally, but it +does help prevent some confusion if it doesn't work as expected. + +## private + +If you set `"private": true` in your package.json, then npm will refuse +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), +then use the `publishConfig` hash described below +to override the `registry` config param at publish-time. + +## publishConfig + +This is a set of config values that will be used at publish-time. It's +especially handy if you want to set the tag or registry, so that you can +ensure that a given package is not tagged with "latest" or published to +the global public registry by default. + +Any config values can be overridden, but of course only "tag" and +"registry" probably matter for the purposes of publishing. + +See `npm help config` to see the list of config options that can be +overridden. diff --git a/vendor/npm/npm-1.0.27/doc/link.md b/vendor/npm/npm-1.0.27/doc/link.md new file mode 100644 index 000000000..dc2e5136b --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/link.md @@ -0,0 +1,49 @@ +npm-link(1) -- Symlink a package folder +======================================= + +## SYNOPSIS + + npm link (in package folder) + npm link + + +## DESCRIPTION + +Package linking is a two-step process. + +First, `npm link` in a package folder will create a globally-installed +symbolic link from `prefix/package-name` to the current folder. + +Next, in some other location, `npm link package-name` will create a +symlink from the local `node_modules` folder to the global symlink. + +When creating tarballs for `npm publish`, the linked packages are +"snapshotted" to their current state by resolving the symbolic links. + +This is +handy for installing your own stuff, so that you can work on it and test it +iteratively without having to continually rebuild. + +For example: + + cd ~/projects/node-redis # go into the package directory + npm link # creates global link + cd ~/projects/node-bloggy # go into some other package directory. + npm link redis # link-install the package + +Now, any changes to ~/projects/node-redis will be reflected in +~/projects/node-bloggy/node_modules/redis/ + +You may also shortcut the two steps in one. For example, to do the +above use-case in a shorter way: + + cd ~/projects/node-bloggy # go into the dir of your main project + npm link ../node-redis # link the dir of your dependency + +The second line is the equivalent of doing: + + (cd ../node-redis; npm link) + npm link redis + +That is, it first creates a global link, and then links the global +installation target into your project's `node_modules` folder. diff --git a/vendor/npm/npm-1.0.27/doc/list.md b/vendor/npm/npm-1.0.27/doc/list.md new file mode 100644 index 000000000..7d6e60acb --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/list.md @@ -0,0 +1,45 @@ +npm-ls(1) -- List installed packages +====================================== + +## SYNOPSIS + + npm list + npm ls + npm la + npm ll + +## DESCRIPTION + +This command will print to stdout all the versions of packages that are +installed, as well as their dependencies, in a tree-structure. + +It does not take positional arguments, though you may set config flags +like with any other command, such as `-g` to list global packages. + +It will print out extraneous, missing, and invalid packages. + +When run as `ll` or `la`, it shows extended information by default. + +## CONFIGURATION + +### long + +* Default: false +* Type: Boolean + +Show extended information. + +### parseable + +* Default: false +* Type: Boolean + +Show parseable output instead of tree view. + +### global + +* Default: false +* Type: Boolean + +List packages in the global install prefix instead of in the current +project. diff --git a/vendor/npm/npm-1.0.27/doc/ln.md b/vendor/npm/npm-1.0.27/doc/ln.md new file mode 120000 index 000000000..52ae308ef --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/ln.md @@ -0,0 +1 @@ +./link.md \ No newline at end of file diff --git a/vendor/npm/npm-1.0.27/doc/ls.md b/vendor/npm/npm-1.0.27/doc/ls.md new file mode 120000 index 000000000..51a383bf1 --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/ls.md @@ -0,0 +1 @@ +./list.md \ No newline at end of file diff --git a/vendor/npm/npm-1.0.27/doc/npm.md b/vendor/npm/npm-1.0.27/doc/npm.md new file mode 100644 index 000000000..700b9ef07 --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/npm.md @@ -0,0 +1,137 @@ +npm(1) -- node package manager +============================== + +## SYNOPSIS + + npm [args] + +## DESCRIPTION + +npm is the package manager for the Node JavaScript platform. It puts +modules in place so that node can find them, and manages dependency +conflicts intelligently. + +It is extremely configurable to support a wide variety of use cases. +Most commonly, it is used to publish, discover, install, and develop node +programs. + +Run `npm help` to get a list of available commands. + +## INTRODUCTION + +You probably got npm because you want to install stuff. + +Use `npm install blerg` to install the latest version of "blerg". Check out +`npm help install` for more info. It can do a lot of stuff. + +Use the `npm search` command to show everything that's available. +Use `npm ls` to show everything you've installed. + +## DIRECTORIES + +See `npm help folders` to learn about where npm puts stuff. + +In particular, npm has two modes of operation: + +* global mode: + npm installs packages into the install prefix at + `prefix/lib/node_modules` and bins are installed in `prefix/bin`. +* local mode: + npm installs packages into the current project directory, which + defaults to the current working directory. Packages are installed to + `./node_modules`, and bins are installed to `./node_modules/.bin`. + +Local mode is the default. Use `--global` or `-g` on any command to +operate in global mode instead. + +## DEVELOPER USAGE + +If you're using npm to develop and publish your code, check out the +following help topics: + +* json: + Make a package.json file. See `npm help json`. +* link: + For linking your current working code into Node's path, so that you + don't have to reinstall every time you make a change. Use + `npm link` to do this. +* install: + It's a good idea to install things if you don't need the symbolic link. + Especially, installing other peoples code from the registry is done via + `npm install` +* adduser: + Create an account or log in. Creditials are stored in the + user config file. +* publish: + Use the `npm publish` command to upload your code to the registry. + +## CONFIGURATION + +npm is extremely configurable. It reads its configuration options from +5 places. + +* Command line switches: + Set a config with `--key val`. All keys take a value, even if they + are booleans (the config parser doesn't know what the options are at + the time of parsing.) If no value is provided, then the option is set + to boolean `true`. +* Environment Variables: + Set any config by prefixing the name in an environment variable with + `npm_config_`. For example, `export npm_config_key=val`. +* User Configs: + The file at $HOME/.npmrc is an ini-formatted list of configs. If + present, it is parsed. If the `userconfig` option is set in the cli + or env, then that will be used instead. +* Global Configs: + The file found at ../etc/npmrc (from the node executable, by default + this resolves to /usr/local/etc/npmrc) will be parsed if it is found. + If the `globalconfig` option is set in the cli, env, or user config, + then that file is parsed instead. +* Defaults: + npm's default configuration options are defined in + lib/utils/config-defs.js. These must not be changed. + +See `npm help config` for much much more information. + +## CONTRIBUTIONS + +Patches welcome! + +* code: + Read through `npm help coding-style` if you plan to submit code. + You don't have to agree with it, but you do have to follow it. +* docs: + If you find an error in the documentation, edit the appropriate markdown + file in the "doc" folder. (Don't worry about generating the man page.) + +Contributors are listed in npm's `package.json` file. You can view them +easily by doing `npm view npm contributors`. + +If you would like to contribute, but don't know what to work on, check +the issues list or ask on the mailing list. + +* +* + +## BUGS + +When you find issues, please report them: + +* web: + +* email: + + +Be sure to include *all* of the output from the npm command that didn't work +as expected. The `npm-debug.log` file is also helpful to provide. + +You can also look for isaacs in #node.js on irc://irc.freenode.net. He +will no doubt tell you to put the output in a gist or email. + +## HISTORY + +See npm-changelog(1) + +## AUTHOR + +Isaac Z. Schlueter :: isaacs :: @izs :: diff --git a/vendor/npm/npm-1.0.27/doc/outdated.md b/vendor/npm/npm-1.0.27/doc/outdated.md new file mode 100644 index 000000000..fd30478cc --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/outdated.md @@ -0,0 +1,11 @@ +npm-outdated(1) -- Check for outdated packages +============================================== + +## SYNOPSIS + + npm outdated [ [ ...]] + +## DESCRIPTION + +This command will check the registry to see if any (or, specific) installed +packages are currently outdated. diff --git a/vendor/npm/npm-1.0.27/doc/owner.md b/vendor/npm/npm-1.0.27/doc/owner.md new file mode 100644 index 000000000..c637bea64 --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/owner.md @@ -0,0 +1,29 @@ +npm-owner(1) -- Manage package owners +===================================== + +## SYNOPSIS + + npm owner ls + npm owner add + npm owner rm + +## DESCRIPTION + +* ls: + List all the users who have access to modify a package and push new versions. + Handy when you need to know who to bug for help. +* add: + Add a new user as a maintainer of a package. This user is enabled to modify + metadata, publish new versions, and add other owners. +* rm: + Remove a user from the package owner list. This immediately revokes their + privileges. + +Note that there is only one level of access. Either you can modify a package, +or you can't. Future versions may contain more fine-grained access levels, but +that is not implemented at this time. + +## SEE ALSO + +* npm-publish(1) +* npm-registry(1) diff --git a/vendor/npm/npm-1.0.27/doc/pack.md b/vendor/npm/npm-1.0.27/doc/pack.md new file mode 100644 index 000000000..1a5920b4d --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/pack.md @@ -0,0 +1,19 @@ +npm-pack(1) -- Create a tarball from a package +============================================== + +## SYNOPSIS + + npm pack [ [ ...]] + +## DESCRIPTION + +For anything that's installable (that is, a package folder, tarball, +tarball url, name@tag, name@version, or name), this command will fetch +it to the cache, and then copy the tarball to the current working +directory as `-.tgz`, and then write the filenames out to +stdout. + +If the same package is specified multiple times, then the file will be +overwritten the second time. + +If no arguments are supplied, then npm packs the current package folder. diff --git a/vendor/npm/npm-1.0.27/doc/prefix.md b/vendor/npm/npm-1.0.27/doc/prefix.md new file mode 100644 index 000000000..93da78b94 --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/prefix.md @@ -0,0 +1,10 @@ +npm-prefix(1) -- Display prefix +=============================== + +## SYNOPSIS + + npm prefix + +## DESCRIPTION + +Print the prefix to standard out. diff --git a/vendor/npm/npm-1.0.27/doc/prune.md b/vendor/npm/npm-1.0.27/doc/prune.md new file mode 100644 index 000000000..7344753f2 --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/prune.md @@ -0,0 +1,15 @@ +npm-prune(1) -- Remove extraneous packages +========================================== + +## SYNOPSIS + + npm prune [ [ + npm publish + +## DESCRIPTION + +Publishes a package to the registry so that it can be installed by name. + +* ``: + A folder containing a package.json file + +* ``: + A url or file path to a gzipped tar archive containing a single folder + with a package.json file inside. + +Fails if the package name and version combination already exists in +the registry. Overwrites when the "--force" flag is set. + +## SEE ALSO + +* npm-registry(1) +* npm-adduser(1) +* npm-owner(1) diff --git a/vendor/npm/npm-1.0.27/doc/rebuild.md b/vendor/npm/npm-1.0.27/doc/rebuild.md new file mode 100644 index 000000000..f98485cd0 --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/rebuild.md @@ -0,0 +1,19 @@ +npm-rebuild(1) -- Rebuild a package +=================================== + +## SYNOPSIS + + npm rebuild [ [ ...]] + +* ``: + The package to rebuild + +## DESCRIPTION + +This command runs the `npm build` command on the matched folders. This is useful +when you install a new version of node, and must recompile all your C++ addons with +the new binary. + +## CONFIGURATION + +See `npm help build` diff --git a/vendor/npm/npm-1.0.27/doc/registry.md b/vendor/npm/npm-1.0.27/doc/registry.md new file mode 100644 index 000000000..6dc2702b2 --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/registry.md @@ -0,0 +1,87 @@ +npm-registry(1) -- The JavaScript Package Registry +================================================== + +## DESCRIPTION + +To resolve packages by name and version, npm talks to a registry website +that implements the CommonJS Package Registry specification for reading +package info. + +Additionally, npm's package registry implementation supports several +write APIs as well, to allow for publishing packages and managing user +account information. + +The official public npm registry is at . It +is powered by a CouchDB database at +. The code for the couchapp is +available at . npm user accounts +are CouchDB users, stored in the +database. + +The registry URL is supplied by the `registry` config parameter. See +`npm help config` for more on managing npm's configuration. + +## Can I run my own private registry? + +Yes! + +The easiest way is to replicate the couch database, and use the same (or +similar) design doc to implement the APIs. + +If you set up continuous replication from the official CouchDB, and then +set your internal CouchDB as the registry config, then you'll be able +to read any published packages, in addition to your private ones, and by +default will only publish internally. If you then want to publish a +package for the whole world to see, you can simply override the +`--registry` config for that command. + +## I don't want my package published in the official registry. It's private. + +Set `"private": true` in your package.json to prevent it from being +published at all, or +`"publishConfig":{"registry":"http://my-internal-registry.local"}` +to force it to be published only to your internal registry. + +See `npm help json` for more info on what goes in the package.json file. + +## Will you replicate from my registry into the public one? + +No. If you want things to be public, then publish them into the public +registry using npm. What little security there is would be for nought +otherwise. + +## Do I have to use couchdb to build a registry that npm can talk to? + +No, but it's way easier. + +## I published something elsewhere, and want to tell the npm registry about it. + +That is supported, but not using the npm client. You'll have to get +your hands dirty and do some HTTP. The request looks something like +this: + + PUT /my-foreign-package + content-type:application/json + accept:application/json + authorization:Basic $base_64_encoded + + { "name":"my-foreign-package" + , "maintainers":["owner","usernames"] + , "description":"A package that is hosted elsewhere" + , "keywords":["nih","my cheese smells the best"] + , "url":"http://my-different-registry.com/blerg/my-local-package" + } + +(Keywords and description are optional, but recommended. Name, +maintainers, and url are required.) + +Then, when a user tries to install "my-foreign-package", it'll redirect +to your registry. If that doesn't resolve to a valid package entry, +then it'll fail, so please make sure that you understand the spec, and +ask for help on the mailing list. + +## Is there a website or something to see package docs and such? + +No, but such a thing is planned, and a tiny bit developed. + +Stay tuned! diff --git a/vendor/npm/npm-1.0.27/doc/removing-npm.md b/vendor/npm/npm-1.0.27/doc/removing-npm.md new file mode 100644 index 000000000..a6d09d3ca --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/removing-npm.md @@ -0,0 +1,41 @@ +npm-removal(1) -- Cleaning the Slate +==================================== + +## SUMMARY + +So sad to see you go. + + sudo npm uninstall npm -g + +Or, if that fails, get the npm source code, and do: + + sudo make uninstall + +## More Severe Uninstalling + +Usually, the above instructions are sufficient. That will remove +npm, but leave behind anything you've installed. + +If that doesn't work, or if you require more drastic measures, +continue reading. + +This assumes that you installed node and npm in the default place. If +you configured node with a different `--prefix`, or installed npm with a +different prefix setting, then adjust the paths accordingly, replacing +`/usr/local` with your install prefix. + + rm -rf /usr/local/{lib/node,lib/node/.npm,bin,share/man}/npm* + +If you installed things *with* npm, then your best bet is to uninstall +them with npm first, and then install them again once you have a +proper install. This can help find any symlinks that are lying +around: + + ls -laF /usr/local/{lib/node,lib/node/.npm,bin,share/man} | grep npm + +Prior to version 0.3, npm used shim files for executables and node +modules. To track those down, you can do the following: + + find /usr/local/{lib/node,bin} -exec grep -l npm \{\} \; ; + +(This is also in the README file.) diff --git a/vendor/npm/npm-1.0.27/doc/restart.md b/vendor/npm/npm-1.0.27/doc/restart.md new file mode 100644 index 000000000..f052098be --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/restart.md @@ -0,0 +1,19 @@ +npm-restart(1) -- Start a package +================================= + +## SYNOPSIS + + npm restart + +## DESCRIPTION + +This runs a package's "restart" script, if one was provided. +Otherwise it runs package's "stop" script, if one was provided, and then +the "start" script. + +If no version is specified, then it restarts the "active" version. + +## SEE ALSO + +* npm-start(1) +* npm-stop(1) diff --git a/vendor/npm/npm-1.0.27/doc/rm.md b/vendor/npm/npm-1.0.27/doc/rm.md new file mode 120000 index 000000000..a9423dfac --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/rm.md @@ -0,0 +1 @@ +./uninstall.md \ No newline at end of file diff --git a/vendor/npm/npm-1.0.27/doc/root.md b/vendor/npm/npm-1.0.27/doc/root.md new file mode 100644 index 000000000..ce4e04113 --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/root.md @@ -0,0 +1,10 @@ +npm-root(1) -- Display npm root +=============================== + +## SYNOPSIS + + npm root + +## DESCRIPTION + +Print the effective `node_modules` folder to standard out. diff --git a/vendor/npm/npm-1.0.27/doc/run-script.md b/vendor/npm/npm-1.0.27/doc/run-script.md new file mode 100644 index 000000000..41ef5e787 --- /dev/null +++ b/vendor/npm/npm-1.0.27/doc/run-script.md @@ -0,0 +1,21 @@ +npm-run-script(1) -- Run arbitrary package scripts +================================================== + +## SYNOPSIS + + npm run-script + +### In node.js + + var uuid = require('node-uuid'); + +## Usage + +### Generate a String UUID + + var id = uuid(); // -> '92329D39-6F5C-4520-ABFC-AAB64544E172' + +### Generate a Binary UUID + + // Simple form - allocates a Buffer/Array for you + var buf = uuid('binary'); + // node.js -> + // browser -> [8, 80, 5, 200, 156, 178, 76, 7, 172, 7, 209, 79, 185, 245, 4, 81] + + // Provide your own Buffer or Array + var buf = new Array(16); + uuid('binary', buf); // -> [8, 80, 5, 200, 156, 178, 76, 7, 172, 7, 209, 79, 185, 245, 4, 81] + var buf = new Buffer(16); + uuid('binary', buf); // -> + + // Provide your own Buffer/Array, plus specify offset + // (e.g. here we fill an array with 3 uuids) + var buf = new Buffer(16 \* 3); + uuid('binary', id, 0); + uuid('binary', id, 16); + uuid('binary', id, 32); + +## Testing + +test/test.js generates performance data (similar to test/benchmark.js). It also verifies the syntax of 100K string UUIDs, and logs the distribution of hex digits found therein. For example: + + - - - Performance Data - - - + uuid(): 1052631 uuids/second + uuid('binary'): 680272 uuids/second + uuid('binary', buffer): 2702702 uuids/second + + - - - Distribution of Hex Digits (% deviation from ideal) - - - + 0 |================================| 187705 (0.11%) + 1 |================================| 187880 (0.2%) + 2 |================================| 186875 (-0.33%) + 3 |================================| 186847 (-0.35%) + 4 |==================================================| 287433 (-0.02%) + 5 |================================| 187910 (0.22%) + 6 |================================| 188172 (0.36%) + 7 |================================| 187350 (-0.08%) + 8 |====================================| 211994 (-0.24%) + 9 |====================================| 212664 (0.08%) + A |=====================================| 213185 (0.32%) + B |=====================================| 212877 (0.18%) + C |================================| 187445 (-0.03%) + D |================================| 186737 (-0.41%) + E |================================| 187155 (-0.18%) + F |================================| 187771 (0.14%) + +Note that the increased values for 4 and 8-B are expected as part of the RFC4122 syntax (and are accounted for in the deviation calculation). BTW, if someone wants to do the calculation to determine what a statistically significant deviation would be, I'll gladly add that to the test. + +### In browser + + Open test/test.html + +### In node.js + + > node test/test.js + +node.js users can also run the node-uuid .vs. uuid.js benchmark: + + > node test/benchmark.js + +## Performance + +### In node.js + +node-uuid is designed to be fast. That said, the target platform is node.js, where it is screaming fast. Here's what I get on my 2.66GHz Macbook Pro for the test/benchmark.js script: + + nodeuuid(): 1126126 uuids/second + nodeuuid('binary'): 782472 uuids/second + nodeuuid('binary', buffer): 2688172 uuids/second + uuidjs(): 620347 uuids/second + uuidjs('binary'): 1275510 uuids/second + +The uuidjs() entries are for Nikhil Marathe's [uuidjs module](https://bitbucket.org/nikhilm/uuidjs), and are provided for comparison. uuidjs is a wrapper around the native libuuid library. + +### In browser + +node-uuid performance varies dramatically across browsers. For comprehensive test results, please [checkout the JSPerf tests](http://jsperf.com/node-uuid-performance). diff --git a/vendor/npm/npm-1.0.27/node_modules/node-uuid/package.json b/vendor/npm/npm-1.0.27/node_modules/node-uuid/package.json new file mode 100644 index 000000000..bf70062ab --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/node-uuid/package.json @@ -0,0 +1,12 @@ +{ + "name" : "node-uuid", + "description" : "Simple, fast generation of RFC4122(v4) UUIDs.", + "url" : "http://github.com/broofa/node-uuid", + "keywords" : ["uuid", "guid", "rfc4122"], + "author" : "Robert Kieffer ", + "contributors" : [], + "dependencies" : [], + "lib" : ".", + "main" : "./uuid.js", + "version" : "1.2.0" +} diff --git a/vendor/npm/npm-1.0.27/node_modules/node-uuid/test/benchmark-native.c b/vendor/npm/npm-1.0.27/node_modules/node-uuid/test/benchmark-native.c new file mode 100644 index 000000000..dbfc75f6d --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/node-uuid/test/benchmark-native.c @@ -0,0 +1,34 @@ +/* +Test performance of native C UUID generation + +To Compile: cc -luuid benchmark-native.c -o benchmark-native +*/ + +#include +#include +#include +#include + +int main() { + uuid_t myid; + char buf[36+1]; + int i; + struct timeval t; + double start, finish; + + gettimeofday(&t, NULL); + start = t.tv_sec + t.tv_usec/1e6; + + int n = 2e5; + for (i = 0; i < n; i++) { + uuid_generate(myid); + uuid_unparse(myid, buf); + } + + gettimeofday(&t, NULL); + finish = t.tv_sec + t.tv_usec/1e6; + double dur = finish - start; + + printf("%d uuids/sec", (int)(n/dur)); + return 0; +} diff --git a/vendor/npm/npm-1.0.27/node_modules/node-uuid/test/benchmark.js b/vendor/npm/npm-1.0.27/node_modules/node-uuid/test/benchmark.js new file mode 100644 index 000000000..2505dc4a2 --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/node-uuid/test/benchmark.js @@ -0,0 +1,27 @@ +var nodeuuid = require('../uuid'), + uuidjs = require('uuid').generate, + N = 5e5; + +function rate(msg, t) { + console.log(msg + ': ' + + (N / (Date.now() - t) * 1e3 | 0) + + ' uuids/second'); +} + +// node-uuid - string form +for (var i = 0, t = Date.now(); i < N; i++) nodeuuid(); +rate('nodeuuid()', t); + +for (var i = 0, t = Date.now(); i < N; i++) nodeuuid('binary'); +rate('nodeuuid(\'binary\')', t); + +var buffer = new nodeuuid.BufferClass(16); +for (var i = 0, t = Date.now(); i < N; i++) nodeuuid('binary', buffer); +rate('nodeuuid(\'binary\', buffer)', t); + +// node-uuid - string form +for (var i = 0, t = Date.now(); i < N; i++) uuidjs(); +rate('uuidjs()', t); + +for (var i = 0, t = Date.now(); i < N; i++) uuidjs('binary'); +rate('uuidjs(\'binary\')', t); diff --git a/vendor/npm/npm-1.0.27/node_modules/node-uuid/test/test.html b/vendor/npm/npm-1.0.27/node_modules/node-uuid/test/test.html new file mode 100644 index 000000000..89e0f2c44 --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/node-uuid/test/test.html @@ -0,0 +1,14 @@ + + + + + + + + + diff --git a/vendor/npm/npm-1.0.27/node_modules/node-uuid/test/test.js b/vendor/npm/npm-1.0.27/node_modules/node-uuid/test/test.js new file mode 100644 index 000000000..5037566ea --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/node-uuid/test/test.js @@ -0,0 +1,83 @@ +if (typeof(uuid) == 'undefined') { + uuid = require('../uuid'); +} + +var UUID_FORMAT = /[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89a-fAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}/; +var N = 1e5; + +function log(msg) { + if (typeof(document) != 'undefined') { + document.write('
' + msg + '
'); + } + if (typeof(console) != 'undefined') { + console.log(msg); + } +} + +function rate(msg, t) { + log(msg + ': ' + (N / (Date.now() - t) * 1e3 | 0) + ' uuids/second'); +} + +// Perf tests +log('- - - Performance Data - - -'); +for (var i = 0, t = Date.now(); i < N; i++) uuid(); +rate('uuid()', t); +for (var i = 0, t = Date.now(); i < N; i++) uuid('binary'); +rate('uuid(\'binary\')', t); +var buf = new uuid.BufferClass(16); +for (var i = 0, t = Date.now(); i < N; i++) uuid('binary', buf); +rate('uuid(\'binary\', buffer)', t); + +var counts = {}, max = 0; + +var b = new uuid.BufferClass(16); +for (var i = 0; i < N; i++) { + id = uuid(); + if (!UUID_FORMAT.test(id)) { + throw Error(id + ' is not a valid UUID string'); + } + + if (id != uuid.unparse(uuid.parse(id))) { + throw Error(id + ' does not parse/unparse'); + } + + // Count digits for our randomness check + var digits = id.replace(/-/g, '').split(''); + for (var j = digits.length-1; j >= 0; j--) { + var c = digits[j]; + max = Math.max(max, counts[c] = (counts[c] || 0) + 1); + } +} + +// Get %'age an actual value differs from the ideal value +function divergence(actual, ideal) { + return Math.round(100*100*(actual - ideal)/ideal)/100; +} + +log('
- - - Distribution of Hex Digits (% deviation from ideal) - - -'); + +// Check randomness +for (var i = 0; i < 16; i++) { + var c = i.toString(16); + var bar = '', n = counts[c], p = Math.round(n/max*100|0); + + // 1-3,5-8, and D-F: 1:16 odds over 30 digits + var ideal = N*30/16; + if (i == 4) { + // 4: 1:1 odds on 1 digit, plus 1:16 odds on 30 digits + ideal = N*(1 + 30/16); + } else if (i >= 8 && i <= 11) { + // 8-B: 1:4 odds on 1 digit, plus 1:16 odds on 30 digits + ideal = N*(1/4 + 30/16); + } else { + // Otherwise: 1:16 odds on 30 digits + ideal = N*30/16; + } + var d = divergence(n, ideal); + + // Draw bar using UTF squares (just for grins) + var s = n/max*50 | 0; + while (s--) bar += '='; + + log(c + ' |' + bar + '| ' + counts[c] + ' (' + d + '%)'); +} diff --git a/vendor/npm/npm-1.0.27/node_modules/node-uuid/uuid.js b/vendor/npm/npm-1.0.27/node_modules/node-uuid/uuid.js new file mode 100644 index 000000000..fdf6c54fd --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/node-uuid/uuid.js @@ -0,0 +1,80 @@ +(function() { + /* + * Generate a RFC4122(v4) UUID + * + * Documentation at https://github.com/broofa/node-uuid + */ + + // Use node.js Buffer class if available, otherwise use the Array class + var BufferClass = typeof(Buffer) == 'function' ? Buffer : Array; + + // Buffer used for generating string uuids + var _buf = new BufferClass(16); + + // Cache number <-> hex string for octet values + var toString = []; + var toNumber = {}; + for (var i = 0; i < 256; i++) { + toString[i] = (i + 0x100).toString(16).substr(1); + toNumber[toString[i]] = i; + } + + function parse(s) { + var buf = new BufferClass(16); + var i = 0, ton = toNumber; + s.toLowerCase().replace(/[0-9a-f][0-9a-f]/g, function(octet) { + buf[i++] = toNumber[octet]; + }); + return buf; + } + + function unparse(buf) { + var tos = toString, b = buf; + return tos[b[0]] + tos[b[1]] + tos[b[2]] + tos[b[3]] + '-' + + tos[b[4]] + tos[b[5]] + '-' + + tos[b[6]] + tos[b[7]] + '-' + + tos[b[8]] + tos[b[9]] + '-' + + tos[b[10]] + tos[b[11]] + tos[b[12]] + + tos[b[13]] + tos[b[14]] + tos[b[15]]; + } + + var b32 = 0x100000000, ff = 0xff; + function uuid(fmt, buf, offset) { + var b = fmt != 'binary' ? _buf : (buf ? buf : new BufferClass(16)); + var i = buf && offset || 0; + + var r = Math.random()*b32; + b[i++] = r & ff; + b[i++] = r>>>8 & ff; + b[i++] = r>>>16 & ff; + b[i++] = r>>>24 & ff; + r = Math.random()*b32; + b[i++] = r & ff; + b[i++] = r>>>8 & ff; + b[i++] = r>>>16 & 0x0f | 0x40; // See RFC4122 sect. 4.1.3 + b[i++] = r>>>24 & ff; + r = Math.random()*b32; + b[i++] = r & 0x3f | 0x80; // See RFC4122 sect. 4.4 + b[i++] = r>>>8 & ff; + b[i++] = r>>>16 & ff; + b[i++] = r>>>24 & ff; + r = Math.random()*b32; + b[i++] = r & ff; + b[i++] = r>>>8 & ff; + b[i++] = r>>>16 & ff; + b[i++] = r>>>24 & ff; + + return fmt === undefined ? unparse(b) : b; + }; + + uuid.parse = parse; + uuid.unparse = unparse; + uuid.BufferClass = BufferClass; + + if (typeof(module) != 'undefined') { + module.exports = uuid; + } else { + // In browser? Set as top-level function + this.uuid = uuid; + } +})(); diff --git a/vendor/npm/npm-1.0.27/node_modules/nopt/.gitignore b/vendor/npm/npm-1.0.27/node_modules/nopt/.gitignore new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/npm/npm-1.0.27/node_modules/nopt/LICENSE b/vendor/npm/npm-1.0.27/node_modules/nopt/LICENSE new file mode 100644 index 000000000..05a401094 --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/nopt/LICENSE @@ -0,0 +1,23 @@ +Copyright 2009, 2010, 2011 Isaac Z. Schlueter. +All rights reserved. + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +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/vendor/npm/npm-1.0.27/node_modules/nopt/README.md b/vendor/npm/npm-1.0.27/node_modules/nopt/README.md new file mode 100644 index 000000000..d6385a481 --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/nopt/README.md @@ -0,0 +1,182 @@ +If you want to write an option parser, and have it be good, there are +two ways to do it. The Right Way, and the Wrong Way. + +The Wrong Way is to sit down and write an option parser. We've all done +that. + +The Right Way is to write some complex configurable program with so many +options that you go half-insane just trying to manage them all, and put +it off with duct-tape solutions until you see exactly to the core of the +problem, and finally snap and write an awesome option parser. + +If you want to write an option parser, don't write an option parser. +Write a package manager, or a source control system, or a service +restarter, or an operating system. You probably won't end up with a +good one of those, but if you don't give up, and you are relentless and +diligent enough in your procrastination, you may just end up with a very +nice option parser. + +## USAGE + + // my-program.js + var nopt = require("nopt") + , Stream = require("stream").Stream + , path = require("path") + , knownOpts = { "foo" : [String, null] + , "bar" : [Stream, Number] + , "baz" : path + , "bloo" : [ "big", "medium", "small" ] + , "flag" : Boolean + , "pick" : Boolean + } + , shortHands = { "foofoo" : ["--foo", "Mr. Foo"] + , "b7" : ["--bar", "7"] + , "m" : ["--bloo", "medium"] + , "p" : ["--pick"] + , "f" : ["--flag"] + } + // everything is optional. + // knownOpts and shorthands default to {} + // arg list defaults to process.argv + // slice defaults to 2 + , parsed = nopt(knownOpts, shortHands, process.argv, 2) + console.log(parsed) + +This would give you support for any of the following: + + $ node my-program.js --foo "blerp" --no-flag + { "foo" : "blerp", "flag" : false } + + $ node my-program.js ---bar 7 --foo "Mr. Hand" --flag + { bar: 7, foo: "Mr. Hand", flag: true } + + $ node my-program.js --foo "blerp" -f -----p + { foo: "blerp", flag: true, pick: true } + + $ node my-program.js -fp --foofoo + { foo: "Mr. Foo", flag: true, pick: true } + + $ node my-program.js --foofoo -- -fp # -- stops the flag parsing. + { foo: "Mr. Foo", argv: { remain: ["-fp"] } } + + $ node my-program.js --blatzk 1000 -fp # unknown opts are ok. + { blatzk: 1000, flag: true, pick: true } + + $ node my-program.js --blatzk true -fp # but they need a value + { blatzk: true, flag: true, pick: true } + + $ node my-program.js --no-blatzk -fp # unless they start with "no-" + { blatzk: false, flag: true, pick: true } + + $ node my-program.js --baz b/a/z # known paths are resolved. + { baz: "/Users/isaacs/b/a/z" } + +Read the tests at the bottom of `lib/nopt.js` for more examples of +what this puppy can do. + +## Types + +The following types are supported, and defined on `nopt.typeDefs` + +* String: A normal string. No parsing is done. +* path: A file system path. Gets resolved against cwd if not absolute. +* Number: Must be numeric. +* url: A url. If it doesn't parse, it isn't accepted. +* Boolean: Must be either `true` or `false`. If an option is a boolean, + then it does not need a value, and its presence will imply `true` as + the value. To negate boolean flags, do `--no-whatever` or `--whatever + false` +* NaN: Means that the option is strictly not allowed. Any value will + fail. +* Stream: An object matching the "Stream" class in node. Valuable + for use when validating programmatically. (npm uses this to let you + supply any WriteStream on the `outfd` and `logfd` config options.) + +If a type is an array of values not on this list, then those are +considered valid values. For instance, in the example above, the +`--bloo` option can only be one of `"big"`, `"medium"`, or `"small"`, +and any other value will be rejected. + +When parsing unknown fields, `"true"`, `"false"`, and `"null"` will be +interpreted as their JavaScript equivalents, and numeric values will be +interpreted as a number. + +You can also mix types and values, or multiple types, in a list. For +instance `{ blah: [Number, null] }` would allow a value to be set to +either a Number or null. + +To define a new type, add it to `nopt.typeDefs`. Each item in that +hash is an object with a `type` member and a `validate` method. The +`type` member is an object that matches what goes in the type list. The +`validate` method is a function that gets called with `validate(data, +key, val)`. Validate methods should assign `data[key]` to the valid +value of `val` if it can be handled properly, or return boolean +`false` if it cannot. + +You can also call `nopt.clean(data, types, typeDefs)` to clean up a +config object and remove its invalid properties. + +## Error Handling + +By default, nopt outputs a warning to standard error when invalid +options are found. You can change this behavior by assigning a method +to `nopt.invalidHandler`. This method will be called with +the offending `nopt.invalidHandler(key, val, types)`. + +If no `nopt.invalidHandler` is assigned, then it will console.error +its whining. If it is assigned to boolean `false` then the warning is +suppressed. + +## Abbreviations + +Yes, they are supported. If you define options like this: + + { "foolhardyelephants" : Boolean + , "pileofmonkeys" : Boolean } + +Then this will work: + + node program.js --foolhar --pil + node program.js --no-f --pileofmon + # etc. + +## Shorthands + +Shorthands are a hash of shorter option names to a snippet of args that +they expand to. + +If multiple one-character shorthands are all combined, and the +combination does not unambiguously match any other option or shorthand, +then they will be broken up into their constituent parts. For example: + + { "s" : ["--loglevel", "silent"] + , "g" : "--global" + , "f" : "--force" + , "p" : "--parseable" + , "l" : "--long" + } + + npm ls -sgflp + # just like doing this: + npm ls --loglevel silent --global --force --long --parseable + +## The Rest of the args + +The config object returned by nopt is given a special member called +`argv`, which is an object with the following fields: + +* `remain`: The remaining args after all the parsing has occurred. +* `original`: The args as they originally appeared. +* `cooked`: The args after flags and shorthands are expanded. + +## Slicing + +Node programs are called with more or less the exact argv as it appears +in C land, after the v8 and node-specific options have been plucked off. +As such, `argv[0]` is always `node` and `argv[1]` is always the +JavaScript program being run. + +That's usually not very useful to you. So they're sliced off by +default. If you want them, then you can pass in `0` as the last +argument, or any other number that you'd like to slice off the start of +the list. diff --git a/vendor/npm/npm-1.0.27/node_modules/nopt/examples/my-program.js b/vendor/npm/npm-1.0.27/node_modules/nopt/examples/my-program.js new file mode 100755 index 000000000..142447e18 --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/nopt/examples/my-program.js @@ -0,0 +1,30 @@ +#!/usr/bin/env node + +//process.env.DEBUG_NOPT = 1 + +// my-program.js +var nopt = require("../lib/nopt") + , Stream = require("stream").Stream + , path = require("path") + , knownOpts = { "foo" : [String, null] + , "bar" : [Stream, Number] + , "baz" : path + , "bloo" : [ "big", "medium", "small" ] + , "flag" : Boolean + , "pick" : Boolean + } + , shortHands = { "foofoo" : ["--foo", "Mr. Foo"] + , "b7" : ["--bar", "7"] + , "m" : ["--bloo", "medium"] + , "p" : ["--pick"] + , "f" : ["--flag", "true"] + , "g" : ["--flag"] + , "s" : "--flag" + } + // everything is optional. + // knownOpts and shorthands default to {} + // arg list defaults to process.argv + // slice defaults to 2 + , parsed = nopt(knownOpts, shortHands, process.argv, 2) + +console.log("parsed =\n"+ require("util").inspect(parsed)) diff --git a/vendor/npm/npm-1.0.27/node_modules/nopt/lib/nopt.js b/vendor/npm/npm-1.0.27/node_modules/nopt/lib/nopt.js new file mode 100644 index 000000000..e646710c6 --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/nopt/lib/nopt.js @@ -0,0 +1,395 @@ +// info about each config option. + +var debug = process.env.DEBUG_NOPT + ? function () { console.error.apply(console, arguments) } + : function () {} + +var url = require("url") + , path = require("path") + , Stream = require("stream").Stream + , abbrev = require("abbrev") + +module.exports = exports = nopt +exports.clean = clean + +exports.typeDefs = + { String : { type: String, validate: validateString } + , Boolean : { type: Boolean, validate: validateBoolean } + , url : { type: url, validate: validateUrl } + , Number : { type: Number, validate: validateNumber } + , path : { type: path, validate: validatePath } + , Stream : { type: Stream, validate: validateStream } + } + +function nopt (types, shorthands, args, slice) { + args = args || process.argv + types = types || {} + shorthands = shorthands || {} + if (typeof slice !== "number") slice = 2 + + debug(types, shorthands, args, slice) + + args = args.slice(slice) + var data = {} + , key + , remain = [] + , cooked = args + , original = args.slice(0) + + parse(args, data, remain, types, shorthands) + // now data is full + clean(data, types, exports.typeDefs) + data.argv = {remain:remain,cooked:cooked,original:original} + data.argv.toString = function () { + return this.original.map(JSON.stringify).join(" ") + } + return data +} + +function clean (data, types, typeDefs) { + typeDefs = typeDefs || exports.typeDefs + Object.keys(data).forEach(function (k) { + var val = data[k] + // if it's an unknown value, then parse false/true/null/numbers + if (typeof val === "string") { + val = val.trim() + if (val === "null" || val === "true" || val === "false") { + val = JSON.parse(val) + } else if (!isNaN(val)) { + val = +val + } + } + if (!types.hasOwnProperty(k)) { + data[k] = val + return + } + if (!validate(data, k, val, types[k], typeDefs)) { + if (exports.invalidHandler) { + exports.invalidHandler(k, val, types[k], data) + } else if (exports.invalidHandler !== false) { + debug("invalid: "+k+"="+val, types[k]) + } + } + }) +} + +function validateString (data, k, val) { + data[k] = String(val) +} + +function validatePath (data, k, val) { + data[k] = path.resolve(String(val)) +} + +function validateNumber (data, k, val) { + debug("validate Number %j %j %j", k, val, isNaN(val)) + if (isNaN(val)) return false + data[k] = +val +} + +function validateBoolean (data, k, val) { + if (val instanceof Boolean) val = val.valueOf() + else if (typeof val === "string") { + if (!isNaN(val)) val = !!(+val) + else if (val === "null" || val === "false") val = false + else val = true + } else val = !!val + data[k] = val +} + +function validateUrl (data, k, val) { + val = url.parse(String(val)) + if (!val.host) return false + data[k] = val.href +} + +function validateStream (data, k, val) { + if (!(val instanceof Stream)) return false + data[k] = val +} + +function validate (data, k, val, type, typeDefs) { + // arrays are lists of types. + if (Array.isArray(type)) { + for (var i = 0, l = type.length; i < l; i ++) { + if (validate(data, k, val, type[i], typeDefs)) return true + } + delete data[k] + return false + } + + // NaN is poisonous. Means that something is not allowed. + if (type !== type) { + debug("Poison NaN", k, val, type) + delete data[k] + return false + } + + // explicit list of values + if (val === type) { + debug("Explicitly allowed %j", val) + data[k] = val + return true + } + + // now go through the list of typeDefs, validate against each one. + var ok = false + , types = Object.keys(typeDefs) + for (var i = 0, l = types.length; i < l; i ++) { + debug("test type %j %j %j", k, val, types[i]) + var t = typeDefs[types[i]] + if (t && type === t.type) { + ok = false !== t.validate(data, k, val) + if (ok) break + } + } + debug("OK? %j (%j %j %j)", ok, k, val, types[i]) + + if (!ok) delete data[k] + return ok +} + +function parse (args, data, remain, types, shorthands) { + debug("parse", args, data, remain) + + var key = null + , abbrevs = abbrev(Object.keys(types)) + , shortAbbr = abbrev(Object.keys(shorthands)) + + for (var i = 0; i < args.length; i ++) { + var arg = args[i] + debug("arg", arg) + + if (arg.match(/^-{2,}$/)) { + // done with keys. + // the rest are args. + remain.push.apply(remain, args.slice(i + 1)) + args[i] = "--" + break + } + if (arg.charAt(0) === "-") { + if (arg.indexOf("=") !== -1) { + var v = arg.split("=") + arg = v.shift() + v = v.join("=") + args.splice.apply(args, [i, 1].concat([arg, v])) + } + // see if it's a shorthand + // if so, splice and back up to re-parse it. + var shRes = resolveShort(arg, shorthands, shortAbbr, abbrevs) + debug("arg=%j shRes=%j", arg, shRes) + if (shRes) { + debug(arg, shRes) + args.splice.apply(args, [i, 1].concat(shRes)) + if (arg !== shRes[0]) { + i -- + continue + } + } + arg = arg.replace(/^-+/, "") + var no = false + while (arg.toLowerCase().indexOf("no-") === 0) { + no = !no + arg = arg.substr(3) + } + var isBool = no || types[arg] === Boolean || + Array.isArray(types[arg]) && types[arg].indexOf(Boolean) !== -1 + if (abbrevs[arg]) arg = abbrevs[arg] + if (isBool) { + // just set and move along + data[arg] = !no + // however, also support --bool true or --bool false + var la = args[i + 1] + if (la === "true" || la === "false") { + data[arg] = JSON.parse(la) + if (no) data[arg] = !data[arg] + i ++ + } + continue + } + var la = args[i + 1] + if (la && la.match(/^-{2,}$/)) { + la = undefined + i -- + } + data[arg] = la === undefined ? true : la + i ++ + continue + } + remain.push(arg) + } +} + +function resolveShort (arg, shorthands, shortAbbr, abbrevs) { + // handle single-char shorthands glommed together, like + // npm ls -glp, but only if there is one dash, and only if + // all of the chars are single-char shorthands, and it's + // not a match to some other abbrev. + arg = arg.replace(/^-+/, '') + if (abbrevs[arg] && !shorthands[arg]) { + return null + } + if (shortAbbr[arg]) { + arg = shortAbbr[arg] + } else { + var singles = shorthands.___singles + if (!singles) { + singles = Object.keys(shorthands).filter(function (s) { + return s.length === 1 + }).reduce(function (l,r) { l[r] = true ; return l }, {}) + shorthands.___singles = singles + } + var chrs = arg.split("").filter(function (c) { + return singles[c] + }) + if (chrs.join("") === arg) return chrs.map(function (c) { + return shorthands[c] + }).reduce(function (l, r) { + return l.concat(r) + }, []) + } + + if (shorthands[arg] && !Array.isArray(shorthands[arg])) { + shorthands[arg] = shorthands[arg].split(/\s+/) + } + return shorthands[arg] +} + +if (module === require.main) { +var assert = require("assert") + , sys = require("sys") + + , shorthands = + { s : ["--loglevel", "silent"] + , d : ["--loglevel", "info"] + , dd : ["--loglevel", "verbose"] + , ddd : ["--loglevel", "silly"] + , noreg : ["--no-registry"] + , reg : ["--registry"] + , "no-reg" : ["--no-registry"] + , silent : ["--loglevel", "silent"] + , verbose : ["--loglevel", "verbose"] + , h : ["--usage"] + , H : ["--usage"] + , "?" : ["--usage"] + , help : ["--usage"] + , v : ["--version"] + , f : ["--force"] + , desc : ["--description"] + , "no-desc" : ["--no-description"] + , "local" : ["--no-global"] + , l : ["--long"] + , p : ["--parseable"] + , porcelain : ["--parseable"] + , g : ["--global"] + } + + , types = + { argv : NaN + , browser : String + , cache : path + , color : ["always", Boolean] + , depth : Number + , description : Boolean + , dev : Boolean + , editor : path + , force : Boolean + , global : Boolean + , globalconfig : path + , group : [String, Number] + , gzipbin : String + , logfd : [Number, Stream] + , loglevel : ["silent","win","error","warn","info","verbose","silly"] + , long : Boolean + , "node-version" : [false, String] + , npaturl : url + , npat : Boolean + , "onload-script" : [false, String] + , outfd : [Number, Stream] + , parseable : Boolean + , pre: Boolean + , prefix: path + , proxy : url + , "rebuild-bundle" : Boolean + , registry : url + , searchopts : String + , searchexclude: [null, String] + , shell : path + , tag : String + , tar : String + , tmp : path + , "unsafe-perm" : Boolean + , usage : Boolean + , user : String + , username : String + , userconfig : path + , version : Boolean + , viewer: path + , _exit : Boolean + } + +; [["-v", {version:true}, []] + ,["---v", {version:true}, []] + ,["ls -s --no-reg connect -d", + {loglevel:"info",registry:null},["ls","connect"]] + ,["ls ---s foo",{loglevel:"silent"},["ls","foo"]] + ,["ls --registry blargle", {}, ["ls"]] + ,["--no-registry", {registry:null}, []] + ,["--no-color true", {color:false}, []] + ,["--no-color false", {color:true}, []] + ,["--no-color", {color:false}, []] + ,["--color false", {color:false}, []] + ,["--color --logfd 7", {logfd:7,color:true}, []] + ,["--color=true", {color:true}, []] + ,["--logfd=10", {logfd:10}, []] + ,["--tmp=/tmp -tar=gtar",{tmp:"/tmp",tar:"gtar"},[]] + ,["--tmp=tmp -tar=gtar", + {tmp:path.join(process.cwd(), "tmp"),tar:"gtar"},[]] + ,["--logfd x", {}, []] + ,["a -true -- -no-false", {true:true},["a","-no-false"]] + ,["a -no-false", {false:false},["a"]] + ,["a -no-no-true", {true:true}, ["a"]] + ,["a -no-no-no-false", {false:false}, ["a"]] + ,["---NO-no-No-no-no-no-nO-no-no"+ + "-No-no-no-no-no-no-no-no-no"+ + "-no-no-no-no-NO-NO-no-no-no-no-no-no"+ + "-no-body-can-do-the-boogaloo-like-I-do" + ,{"body-can-do-the-boogaloo-like-I-do":false}, []] + ,["we are -no-strangers-to-love "+ + "--you-know the-rules --and so-do-i "+ + "---im-thinking-of=a-full-commitment "+ + "--no-you-would-get-this-from-any-other-guy "+ + "--no-gonna-give-you-up "+ + "-no-gonna-let-you-down=true "+ + "--no-no-gonna-run-around false "+ + "--desert-you=false "+ + "--make-you-cry false "+ + "--no-tell-a-lie "+ + "--no-no-and-hurt-you false" + ,{"strangers-to-love":false + ,"you-know":"the-rules" + ,"and":"so-do-i" + ,"you-would-get-this-from-any-other-guy":false + ,"gonna-give-you-up":false + ,"gonna-let-you-down":false + ,"gonna-run-around":false + ,"desert-you":false + ,"make-you-cry":false + ,"tell-a-lie":false + ,"and-hurt-you":false + },["we", "are"]] + ].forEach(function (test) { + var argv = test[0].split(/\s+/) + , opts = test[1] + , rem = test[2] + , actual = nopt(types, shorthands, argv, 0) + , parsed = actual.argv + delete actual.argv + console.log(parsed.remain) + console.log(sys.inspect(actual, false, 2, true)) + for (var i in opts) { + assert.equal(opts[i], actual[i]) + } + assert.deepEqual(rem, parsed.remain) + }) +} diff --git a/vendor/npm/npm-1.0.27/node_modules/nopt/package.json b/vendor/npm/npm-1.0.27/node_modules/nopt/package.json new file mode 100644 index 000000000..55561b3e9 --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/nopt/package.json @@ -0,0 +1,11 @@ +{ "name" : "nopt" +, "version" : "1.0.5" +, "description" : "Option parsing for Node, supporting types, shorthands, etc. Used by npm." +, "author" : "Isaac Z. Schlueter (http://blog.izs.me/)" +, "main" : "lib/nopt.js" +, "scripts" : { "test" : "node lib/nopt.js" } +, "repository" : "http://github.com/isaacs/nopt" +, "license" : + { "type" : "MIT" + , "url" : "https://github.com/isaacs/nopt/raw/master/LICENSE" } +, "dependencies" : { "abbrev" : "1" }} diff --git a/vendor/npm/npm-1.0.27/node_modules/proto-list/LICENSE b/vendor/npm/npm-1.0.27/node_modules/proto-list/LICENSE new file mode 100644 index 000000000..05a401094 --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/proto-list/LICENSE @@ -0,0 +1,23 @@ +Copyright 2009, 2010, 2011 Isaac Z. Schlueter. +All rights reserved. + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +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/vendor/npm/npm-1.0.27/node_modules/proto-list/README.md b/vendor/npm/npm-1.0.27/node_modules/proto-list/README.md new file mode 100644 index 000000000..43cfa3589 --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/proto-list/README.md @@ -0,0 +1,3 @@ +A list of objects, bound by their prototype chain. + +Used in npm's config stuff. diff --git a/vendor/npm/npm-1.0.27/node_modules/proto-list/package.json b/vendor/npm/npm-1.0.27/node_modules/proto-list/package.json new file mode 100644 index 000000000..5cab34bef --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/proto-list/package.json @@ -0,0 +1,9 @@ +{ "name" : "proto-list" +, "version" : "1.0.0" +, "description" : "A utility for managing a prototype chain" +, "main" : "./proto-list.js" +, "author" : "Isaac Z. Schlueter (http://blog.izs.me/)" +, "scripts" : { "test" : "node proto-list.js" } +, "repository": { "type": "git", "url": "https://github.com/isaacs/proto-list" } +, "license": { "type": "MIT", "url": "https://github.com/isaacs/proto-list/blob/master/LICENSE" } +, "devDependencies" : { "tap" : "0" } } diff --git a/vendor/npm/npm-1.0.27/node_modules/proto-list/proto-list.js b/vendor/npm/npm-1.0.27/node_modules/proto-list/proto-list.js new file mode 100644 index 000000000..759d82738 --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/proto-list/proto-list.js @@ -0,0 +1,94 @@ + +module.exports = ProtoList + +function ProtoList () { this.list = [] } +ProtoList.prototype = + { get length () { return this.list.length } + , get keys () { + var k = [] + for (var i in this.list[0]) k.push(i) + return k + } + , get snapshot () { + var o = {} + this.keys.forEach(function (k) { o[k] = this.get(k) }, this) + return o + } + , push : function (obj) { + if (typeof obj !== "object") obj = {valueOf:obj} + if (this.list.length >= 1) { + this.list[this.list.length - 1].__proto__ = obj + } + obj.__proto__ = Object.prototype + return this.list.push(obj) + } + , pop : function () { + if (this.list.length >= 2) { + this.list[this.list.length - 2].__proto__ = Object.prototype + } + return this.list.pop() + } + , unshift : function (obj) { + obj.__proto__ = this.list[0] || Object.prototype + return this.list.unshift(obj) + } + , shift : function () { + if (this.list.length >= 1) { + this.list[0].__proto__ = Object.prototype + } + return this.list.shift() + } + , get : function (key) { + return this.list[0][key] + } + , set : function (key, val, save) { + if (!this.length) this.push({}) + if (save && this.list[0].hasOwnProperty(key)) this.push({}) + return this.list[0][key] = val + } + , forEach : function (fn, thisp) { + for (var key in this.list[0]) fn.call(thisp, key, this.list[0][key]) + } + , slice : function () { + return this.list.slice.apply(this.list, arguments) + } + , splice : function () { + return this.list.splice.apply(this.list, arguments) + } + } + +if (module === require.main) { + +var tap = require("tap") + , test = tap.test + +tap.plan(1) + +tap.test("protoList tests", function (t) { + var p = new ProtoList + p.push({foo:"bar"}) + p.push({}) + p.set("foo", "baz") + t.equal(p.get("foo"), "baz") + + var p = new ProtoList + p.push({foo:"bar"}) + p.set("foo", "baz") + t.equal(p.get("foo"), "baz") + t.equal(p.length, 1) + p.pop() + t.equal(p.length, 0) + p.set("foo", "asdf") + t.equal(p.length, 1) + t.equal(p.get("foo"), "asdf") + p.push({bar:"baz"}) + t.equal(p.length, 2) + t.equal(p.get("foo"), "asdf") + p.shift() + t.equal(p.length, 1) + t.equal(p.get("foo"), undefined) + t.end() +}) + + +} diff --git a/vendor/npm/npm-1.0.27/node_modules/rimraf/AUTHORS b/vendor/npm/npm-1.0.27/node_modules/rimraf/AUTHORS new file mode 100644 index 000000000..d0f15f615 --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/rimraf/AUTHORS @@ -0,0 +1,4 @@ +# Authors sorted by whether or not they're me. +Isaac Z. Schlueter (http://blog.izs.me) +Wayne Larsen (http://github.com/wvl) +ritch diff --git a/vendor/npm/npm-1.0.27/node_modules/rimraf/LICENSE b/vendor/npm/npm-1.0.27/node_modules/rimraf/LICENSE new file mode 100644 index 000000000..05a401094 --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/rimraf/LICENSE @@ -0,0 +1,23 @@ +Copyright 2009, 2010, 2011 Isaac Z. Schlueter. +All rights reserved. + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +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/vendor/npm/npm-1.0.27/node_modules/rimraf/README.md b/vendor/npm/npm-1.0.27/node_modules/rimraf/README.md new file mode 100644 index 000000000..99983dc43 --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/rimraf/README.md @@ -0,0 +1,32 @@ +A `rm -rf` for node. + +Install with `npm install rimraf`, or just drop rimraf.js somewhere. + +## API + +`rimraf(f, [options,] callback)` + +The callback will be called with an error if there is one. Certain +errors are handled for you: + +* `EBUSY` - rimraf will back off a maximum of opts.maxBusyTries times + before giving up. +* `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 + +It can remove stuff synchronously, too. But that's not so good. Use +the async API. It's better. diff --git a/vendor/npm/npm-1.0.27/node_modules/rimraf/package.json b/vendor/npm/npm-1.0.27/node_modules/rimraf/package.json new file mode 100644 index 000000000..78eef7d80 --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/rimraf/package.json @@ -0,0 +1,9 @@ +{"name":"rimraf" +,"version":"1.0.4" +,"main":"rimraf.js" +,"description":"A deep deletion module for node (like `rm -rf`)" +,"author":"Isaac Z. Schlueter (http://blog.izs.me/)" +,"license": + {"type":"MIT", "url": "https://github.com/isaacs/rimraf/raw/master/LICENSE"} +,"repository":"git://github.com/isaacs/rimraf.git" +,"scripts":{"test":"cd test && bash run.sh"}} diff --git a/vendor/npm/npm-1.0.27/node_modules/rimraf/rimraf.js b/vendor/npm/npm-1.0.27/node_modules/rimraf/rimraf.js new file mode 100644 index 000000000..ff81e3ff7 --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/rimraf/rimraf.js @@ -0,0 +1,127 @@ +module.exports = rimraf +rimraf.sync = rimrafSync + +var path = require("path") + , fs + +try { + // optional dependency + fs = require("graceful-fs") +} catch (ex) { + fs = require("fs") +} + +// for EBUSY handling +var waitBusy = {} + +// for EMFILE handling +var resetTimer = null + , timeout = 0 + +function rimraf (p, opts, cb) { + if (typeof opts === "function") cb = opts, opts = {} + + opts.maxBusyTries = opts.maxBusyTries || 3 + + rimraf_(p, opts, function (er) { + if (er) { + if (er.message.match(/^EBUSY/)) { + // windows is annoying. + if (!waitBusy.hasOwnProperty(p)) waitBusy[p] = opts.maxBusyTries + if (waitBusy[p]) { + waitBusy[p] -- + // give it 100ms more each time + var time = (opts.maxBusyTries - waitBusy[p]) * 100 + return setTimeout(function () { rimraf_(p, opts, cb) }, time) + } + } + + // this one won't happen if graceful-fs is used. + if (er.message.match(/^EMFILE/)) { + return setTimeout(function () { + rimraf_(p, opts, cb) + }, timeout ++) + } + } + timeout = 0 + cb(er) + }) +} + +function asyncForEach (list, fn, cb) { + if (!list.length) cb() + var c = list.length + , errState = null + list.forEach(function (item, i, list) { + fn(item, function (er) { + if (errState) return + if (er) return cb(errState = er) + if (-- c === 0) return cb() + }) + }) +} + +function rimraf_ (p, opts, cb) { + fs.lstat(p, function (er, s) { + // if the stat fails, then assume it's already gone. + if (er) return cb() + + // 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) + }) +} + +function rm_ (p, s, opts, cb) { + if (!s.isDirectory()) return fs.unlink(p, cb) + 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) + }, function (er) { + if (er) return cb(er) + fs.rmdir(p, 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) +} + +// this looks simpler, but it will fail with big directory trees, +// or on slow stupid awful windows filesystems +function rimrafSync (p) { + var s = fs.lstatSync(p) + if (!s.isDirectory()) return fs.unlinkSync(p) + fs.readdirSync(p).forEach(function (f) { + rimrafSync(path.join(p, f)) + }) + fs.rmdirSync(p) +} diff --git a/vendor/npm/npm-1.0.27/node_modules/rimraf/test/run.sh b/vendor/npm/npm-1.0.27/node_modules/rimraf/test/run.sh new file mode 100644 index 000000000..598f0163b --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/rimraf/test/run.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -e +for i in test-*.js; do + echo -n $i ... + bash setup.sh + node $i + ! [ -d target ] + echo "pass" +done +rm -rf target diff --git a/vendor/npm/npm-1.0.27/node_modules/rimraf/test/setup.sh b/vendor/npm/npm-1.0.27/node_modules/rimraf/test/setup.sh new file mode 100644 index 000000000..2602e6316 --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/rimraf/test/setup.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +set -e + +files=10 +folders=2 +depth=4 +target="$PWD/target" + +rm -rf target + +fill () { + local depth=$1 + local files=$2 + local folders=$3 + local target=$4 + + if ! [ -d $target ]; then + mkdir -p $target + fi + + local f + + f=$files + while [ $f -gt 0 ]; do + touch "$target/f-$depth-$f" + let f-- + done + + let depth-- + + if [ $depth -le 0 ]; then + return 0 + fi + + f=$folders + while [ $f -gt 0 ]; do + mkdir "$target/folder-$depth-$f" + fill $depth $files $folders "$target/d-$depth-$f" + let f-- + done +} + +fill $depth $files $folders $target + +# sanity assert +[ -d $target ] diff --git a/vendor/npm/npm-1.0.27/node_modules/rimraf/test/test-async.js b/vendor/npm/npm-1.0.27/node_modules/rimraf/test/test-async.js new file mode 100644 index 000000000..9c2e0b7be --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/rimraf/test/test-async.js @@ -0,0 +1,5 @@ +var rimraf = require("../rimraf") + , path = require("path") +rimraf(path.join(__dirname, "target"), function (er) { + if (er) throw er +}) diff --git a/vendor/npm/npm-1.0.27/node_modules/rimraf/test/test-sync.js b/vendor/npm/npm-1.0.27/node_modules/rimraf/test/test-sync.js new file mode 100644 index 000000000..eb71f1047 --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/rimraf/test/test-sync.js @@ -0,0 +1,3 @@ +var rimraf = require("../rimraf") + , path = require("path") +rimraf.sync(path.join(__dirname, "target")) diff --git a/vendor/npm/npm-1.0.27/node_modules/semver/LICENSE b/vendor/npm/npm-1.0.27/node_modules/semver/LICENSE new file mode 100644 index 000000000..05a401094 --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/semver/LICENSE @@ -0,0 +1,23 @@ +Copyright 2009, 2010, 2011 Isaac Z. Schlueter. +All rights reserved. + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +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/vendor/npm/npm-1.0.27/node_modules/semver/README.md b/vendor/npm/npm-1.0.27/node_modules/semver/README.md new file mode 100644 index 000000000..6fa37a3d8 --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/semver/README.md @@ -0,0 +1,119 @@ +semver(1) -- The semantic versioner for npm +=========================================== + +## Usage + + $ npm install semver + + semver.valid('1.2.3') // true + semver.valid('a.b.c') // false + semver.clean(' =v1.2.3 ') // '1.2.3' + semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true + semver.gt('1.2.3', '9.8.7') // false + semver.lt('1.2.3', '9.8.7') // true + +As a command-line utility: + + $ semver -h + + Usage: semver -v [-r ] + Test if version(s) satisfy the supplied range(s), + and sort them. + + Multiple versions or ranges may be supplied. + + Program exits successfully if any valid version satisfies + all supplied ranges, and prints all satisfying versions. + + If no versions are valid, or ranges are not satisfied, + then exits failure. + + Versions are printed in ascending order, so supplying + multiple versions to the utility will just sort them. + +## Versions + +A version is the following things, in this order: + +* a number (Major) +* a period +* a number (minor) +* a period +* a number (patch) +* OPTIONAL: a hyphen, followed by a number (build) +* OPTIONAL: a collection of pretty much any non-whitespace characters + (tag) + +A leading `"="` or `"v"` character is stripped off and ignored. + +## Comparisons + +The ordering of versions is done using the following algorithm, given +two versions and asked to find the greater of the two: + +* If the majors are numerically different, then take the one + with a bigger major number. `2.3.4 > 1.3.4` +* If the minors are numerically different, then take the one + with the bigger minor number. `2.3.4 > 2.2.4` +* If the patches are numerically different, then take the one with the + bigger patch number. `2.3.4 > 2.3.3` +* If only one of them has a build number, then take the one with the + build number. `2.3.4-0 > 2.3.4` +* If they both have build numbers, and the build numbers are numerically + different, then take the one with the bigger build number. + `2.3.4-10 > 2.3.4-9` +* If only one of them has a tag, then take the one without the tag. + `2.3.4 > 2.3.4-beta` +* If they both have tags, then take the one with the lexicographically + larger tag. `2.3.4-beta > 2.3.4-alpha` +* At this point, they're equal. + +## Ranges + +The following range styles are supported: + +* `>1.2.3` Greater than a specific version. +* `<1.2.3` Less than +* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4` +* `~1.2.3` := `>=1.2.3 <1.3.0` +* `~1.2` := `>=1.2.0 <2.0.0` +* `~1` := `>=1.0.0 <2.0.0` +* `1.2.x` := `>=1.2.0 <1.3.0` +* `1.x` := `>=1.0.0 <2.0.0` + +Ranges can be joined with either a space (which implies "and") or a +`||` (which implies "or"). + +## Functions + +* valid(v): Return the parsed version, or null if it's not valid. +* inc(v, release): Return the version incremented by the release type + (major, minor, patch, or build), or null if it's not valid. + +### Comparison + +* gt(v1, v2): `v1 > v2` +* gte(v1, v2): `v1 >= v2` +* lt(v1, v2): `v1 < v2` +* lte(v1, v2): `v1 <= v2` +* eq(v1, v2): `v1 == v2` This is true if they're logically equivalent, + even if they're not the exact same string. You already know how to + compare strings. +* neq(v1, v2): `v1 != v2` The opposite of eq. +* cmp(v1, comparator, v2): Pass in a comparison string, and it'll call + the corresponding function above. `"==="` and `"!=="` do simple + string comparison, but are included for completeness. Throws if an + invalid comparison string is provided. +* compare(v1, v2): Return 0 if v1 == v2, or 1 if v1 is greater, or -1 if + v2 is greater. Sorts in ascending order if passed to Array.sort(). +* rcompare(v1, v2): The reverse of compare. Sorts an array of versions + in descending order when passed to Array.sort(). + + +### Ranges + +* validRange(range): Return the valid range or null if it's not valid +* satisfies(version, range): Return true if the version satisfies the + range. +* maxSatisfying(versions, range): Return the highest version in the list + that satisfies the range, or null if none of them do. diff --git a/vendor/npm/npm-1.0.27/node_modules/semver/bin/semver b/vendor/npm/npm-1.0.27/node_modules/semver/bin/semver new file mode 100755 index 000000000..3e6afb40d --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/semver/bin/semver @@ -0,0 +1,71 @@ +#!/usr/bin/env node +// Standalone semver comparison program. +// Exits successfully and prints matching version(s) if +// any supplied version is valid and passes all tests. + +var argv = process.argv.slice(2) + , versions = [] + , range = [] + , gt = [] + , lt = [] + , eq = [] + , semver = require("../semver") + +main() + +function main () { + if (!argv.length) return help() + while (argv.length) { + var a + switch (a = argv.shift()) { + case "-v": case "--version": + versions.push(argv.shift()) + break + case "-r": case "--range": + range.push(argv.shift()) + break + case "-h": case "--help": case "-?": + return help() + default: + versions.push(a) + break + } + } + + versions = versions.filter(semver.valid) + for (var i = 0, l = range.length; i < l ; i ++) { + versions = versions.filter(function (v) { + return semver.satisfies(v, range[i]) + }) + if (!versions.length) return fail() + } + return success(versions) +} + +function fail () { process.exit(1) } + +function success () { + versions.sort(semver.compare) + .map(semver.clean) + .forEach(function (v,i,_) { console.log(v) }) +} + +function help () { + console.log(["Usage: semver -v [-r ]" + ,"Test if version(s) satisfy the supplied range(s)," + ,"and sort them." + ,"" + ,"Multiple versions or ranges may be supplied." + ,"" + ,"Program exits successfully if any valid version satisfies" + ,"all supplied ranges, and prints all satisfying versions." + ,"" + ,"If no versions are valid, or ranges are not satisfied," + ,"then exits failure." + ,"" + ,"Versions are printed in ascending order, so supplying" + ,"multiple versions to the utility will just sort them." + ].join("\n")) +} + + diff --git a/vendor/npm/npm-1.0.27/node_modules/semver/package.json b/vendor/npm/npm-1.0.27/node_modules/semver/package.json new file mode 100644 index 000000000..3b0dbf5c6 --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/semver/package.json @@ -0,0 +1,11 @@ +{ "name" : "semver" +, "version" : "1.0.9" +, "description" : "The semantic version parser used by npm." +, "main" : "semver.js" +, "scripts" : { "test" : "tap semver.js" } +, "devDependencies": { "tap" : "0.x >=0.0.4" } +, "license" : + { "type" : "MIT" + , "url" : "https://github.com/isaacs/semver/raw/master/LICENSE" } +, "repository" : "git://github.com/isaacs/node-semver.git" +, "bin" : { "semver" : "./bin/semver" } } diff --git a/vendor/npm/npm-1.0.27/node_modules/semver/semver.js b/vendor/npm/npm-1.0.27/node_modules/semver/semver.js new file mode 100644 index 000000000..b3a6a4320 --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/semver/semver.js @@ -0,0 +1,518 @@ + +// See http://semver.org/ +// This implementation is a *hair* less strict in that it allows +// v1.2.3 things, and also tags that don't begin with a char. + +var semver = "\\s*[v=]*\\s*([0-9]+)" // major + + "\\.([0-9]+)" // minor + + "\\.([0-9]+)" // patch + + "(-[0-9]+-?)?" // build + + "([a-zA-Z-][a-zA-Z0-9-\.:]*)?" // tag + , exprComparator = "^((<|>)?=?)\s*("+semver+")$|^$" + , xRangePlain = "[v=]*([0-9]+|x|X)(?:\\.([0-9]+|x|X)(?:\\.([0-9]+|x|X))?)?" + , xRange = "((?:<|>)?=?)?\\s*" + xRangePlain + , exprSpermy = "(?:~>?)"+xRange + , expressions = exports.expressions = + { parse : new RegExp("^\\s*"+semver+"\\s*$") + , parsePackage : new RegExp("^\\s*([^\/]+)[-@](" +semver+")\\s*$") + , parseRange : new RegExp( + "^\\s*(" + semver + ")\\s+-\\s+(" + semver + ")\\s*$") + , validComparator : new RegExp("^"+exprComparator+"$") + , parseXRange : new RegExp("^"+xRange+"$") + , parseSpermy : new RegExp("^"+exprSpermy+"$") + } +Object.getOwnPropertyNames(expressions).forEach(function (i) { + exports[i] = function (str) { return (str || "").match(expressions[i]) } +}) + +exports.rangeReplace = ">=$1 <=$7" +exports.clean = clean +exports.compare = compare +exports.satisfies = satisfies +exports.gt = gt +exports.gte = gte +exports.lt = lt +exports.lte = lte +exports.eq = eq +exports.neq = neq +exports.cmp = cmp +exports.inc = inc + +exports.valid = valid +exports.validPackage = validPackage +exports.validRange = validRange +exports.maxSatisfying = maxSatisfying + +function stringify (version) { + var v = version + return [v[1]||'', v[2]||'', v[3]||''].join(".") + (v[4]||'') + (v[5]||'') +} + +function clean (version) { + version = exports.parse(version) + if (!version) return version + return stringify(version) +} + +function valid (version) { + return exports.parse(version) && version.trim().replace(/^[v=]+/, '') +} + +function validPackage (version) { + return version.match(expressions.parsePackage) && version.trim() +} + +// range can be one of: +// "1.0.3 - 2.0.0" range, inclusive, like ">=1.0.3 <=2.0.0" +// ">1.0.2" like 1.0.3 - 9999.9999.9999 +// ">=1.0.2" like 1.0.2 - 9999.9999.9999 +// "<2.0.0" like 0.0.0 - 1.9999.9999 +// ">1.0.2 <2.0.0" like 1.0.3 - 1.9999.9999 +var starExpression = /(<|>)?=?\s*\*/g + , starReplace = "" + , compTrimExpression = new RegExp("((<|>)?=?)\\s*(" + +semver+"|"+xRangePlain+")", "g") + , compTrimReplace = "$1$3" + +function toComparators (range) { + var ret = (range || "").trim() + .replace(expressions.parseRange, exports.rangeReplace) + .replace(compTrimExpression, compTrimReplace) + .split(/\s+/) + .join(" ") + .split("||") + .map(function (orchunk) { + return orchunk + .split(" ") + .map(replaceXRanges) + .map(replaceSpermies) + .map(replaceStars) + .join(" ").trim() + }) + .map(function (orchunk) { + return orchunk + .trim() + .split(/\s+/) + .filter(function (c) { return c.match(expressions.validComparator) }) + }) + .filter(function (c) { return c.length }) + //console.error("comparators", range, ret) + return ret +} + +function replaceStars (stars) { + return stars.replace(starExpression, starReplace) +} + +// "2.x","2.x.x" --> ">=2.0.0 <2.1" +// "2.3.x" --> ">=2.3.0 <2.4.0" +function replaceXRanges (ranges) { + return ranges.split(/\s+/) + .map(replaceXRange) + .join(" ") +} + +function replaceXRange (version) { + return version.trim().replace(expressions.parseXRange, + function (v, gtlt, M, m, p) { + var anyX = !M || M.toLowerCase() === "x" + || !m || m.toLowerCase() === "x" + || !p || p.toLowerCase() === "x" + , ret = v + + if (gtlt && anyX) { + // just replace x'es with zeroes + ;(!M || M.toLowerCase() === "x") && (M = 0) + ;(!m || m.toLowerCase() === "x") && (m = 0) + ;(!p || p.toLowerCase() === "x") && (p = 0) + ret = gtlt + M+"."+m+"."+p + } else if (!M || M.toLowerCase() === "x") { + ret = "*" // allow any + } else if (!m || m.toLowerCase() === "x") { + // append "-" onto the version, otherwise + // "1.x.x" matches "2.0.0beta", since the tag + // *lowers* the version value + ret = ">="+M+".0.0- <"+(+M+1)+".0.0-" + } else if (!p || p.toLowerCase() === "x") { + ret = ">="+M+"."+m+".0- <"+M+"."+(+m+1)+".0-" + } + //console.error("parseXRange", [].slice.call(arguments), ret) + return ret + }) +} + +// ~, ~> --> * (any, kinda silly) +// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 +// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 +// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 +// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 +// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 +function replaceSpermies (version) { + return version.trim().replace(expressions.parseSpermy, + function (v, gtlt, M, m, p) { + if (gtlt) throw new Error( + "Using '"+gtlt+"' with ~ makes no sense. Don't do it.") + if (!M || M.toLowerCase() === "x") { + return "*" + } + // ~1 == >=1.0.0 <2.0.0 + if (!m || m.toLowerCase() === "x") { + return ">="+M+".0.0 <"+(+M+1)+".0.0" + } + // ~1.2 == >=1.2.0 <1.3.0 + if (!p || p.toLowerCase() === "x") { + return ">="+M+"."+m+".0 <"+M+"."+(+m+1)+".0" + } + // ~1.2.3 == >=1.2.3 <1.3.0 + return ">="+M+"."+m+"."+p+" <"+M+"."+(+m+1)+".0" + }) +} + +function validRange (range) { + range = range.trim().replace(starExpression, starReplace) + var c = toComparators(range) + return (c.length === 0) + ? null + : c.map(function (c) { return c.join(" ") }).join("||") +} + +// returns the highest satisfying version in the list, or undefined +function maxSatisfying (versions, range) { + return versions + .filter(function (v) { return satisfies(v, range) }) + .sort(compare) + .pop() +} +function satisfies (version, range) { + version = valid(version) + if (!version) return false + range = toComparators(range) + for (var i = 0, l = range.length ; i < l ; i ++) { + var ok = false + for (var j = 0, ll = range[i].length ; j < ll ; j ++) { + var r = range[i][j] + , gtlt = r.charAt(0) === ">" ? gt + : r.charAt(0) === "<" ? lt + : false + , eq = r.charAt(!!gtlt) === "=" + , sub = (!!eq) + (!!gtlt) + if (!gtlt) eq = true + r = r.substr(sub) + r = (r === "") ? r : valid(r) + ok = (r === "") || (eq && r === version) || (gtlt && gtlt(version, r)) + if (!ok) break + } + if (ok) return true + } + return false +} + +// return v1 > v2 ? 1 : -1 +function compare (v1, v2) { + var g = gt(v1, v2) + return g === null ? 0 : g ? 1 : -1 +} + +function rcompare (v1, v2) { + return compare(v2, v1) +} + +function lt (v1, v2) { return gt(v2, v1) } +function gte (v1, v2) { return !lt(v1, v2) } +function lte (v1, v2) { return !gt(v1, v2) } +function eq (v1, v2) { return gt(v1, v2) === null } +function neq (v1, v2) { return gt(v1, v2) !== null } +function cmp (v1, c, v2) { + switch (c) { + case ">": return gt(v1, v2) + case "<": return lt(v1, v2) + case ">=": return gte(v1, v2) + case "<=": return lte(v1, v2) + case "==": return eq(v1, v2) + case "!=": return neq(v1, v2) + case "===": return v1 === v2 + case "!==": return v1 !== v2 + default: throw new Error("Y U NO USE VALID COMPARATOR!? "+c) + } +} + +// return v1 > v2 +function num (v) { + return v === undefined ? -1 : parseInt((v||"0").replace(/[^0-9]+/g, ''), 10) +} +function gt (v1, v2) { + v1 = exports.parse(v1) + v2 = exports.parse(v2) + if (!v1 || !v2) return false + + for (var i = 1; i < 5; i ++) { + v1[i] = num(v1[i]) + v2[i] = num(v2[i]) + if (v1[i] > v2[i]) return true + else if (v1[i] !== v2[i]) return false + } + // no tag is > than any tag, or use lexicographical order. + var tag1 = v1[5] || "" + , tag2 = v2[5] || "" + + // kludge: null means they were equal. falsey, and detectable. + // embarrassingly overclever, though, I know. + return tag1 === tag2 ? null + : !tag1 ? true + : !tag2 ? false + : tag1 > tag2 +} + +function inc (version, release) { + version = exports.parse(version) + if (!version) return null + + var parsedIndexLookup = + { 'major': 1 + , 'minor': 2 + , 'patch': 3 + , 'build': 4 } + var incIndex = parsedIndexLookup[release] + if (incIndex === undefined) return null + + var current = num(version[incIndex]) + version[incIndex] = current === -1 ? 1 : current + 1 + + for (var i = incIndex + 1; i < 5; i ++) { + if (num(version[i]) !== -1) version[i] = "0" + } + + if (version[4]) version[4] = "-" + version[4] + version[5] = "" + + return stringify(version) +} + +if (module === require.main) { // tests below + +var tap = require("tap") + , test = tap.test + +tap.plan(5) + +test("\ncomparison tests", function (t) { +; [ ["0.0.0", "0.0.0foo"] + , ["0.0.1", "0.0.0"] + , ["1.0.0", "0.9.9"] + , ["0.10.0", "0.9.0"] + , ["0.99.0", "0.10.0"] + , ["2.0.0", "1.2.3"] + , ["v0.0.0", "0.0.0foo"] + , ["v0.0.1", "0.0.0"] + , ["v1.0.0", "0.9.9"] + , ["v0.10.0", "0.9.0"] + , ["v0.99.0", "0.10.0"] + , ["v2.0.0", "1.2.3"] + , ["0.0.0", "v0.0.0foo"] + , ["0.0.1", "v0.0.0"] + , ["1.0.0", "v0.9.9"] + , ["0.10.0", "v0.9.0"] + , ["0.99.0", "v0.10.0"] + , ["2.0.0", "v1.2.3"] + , ["1.2.3", "1.2.3-asdf"] + , ["1.2.3-4", "1.2.3"] + , ["1.2.3-4-foo", "1.2.3"] + , ["1.2.3-5", "1.2.3-5-foo"] + , ["1.2.3-5", "1.2.3-4"] + , ["1.2.3-5-foo", "1.2.3-5-Foo"] + ].forEach(function (v) { + var v0 = v[0] + , v1 = v[1] + t.ok(gt(v0, v1), "gt('"+v0+"', '"+v1+"')") + t.ok(lt(v1, v0), "lt('"+v1+"', '"+v0+"')") + t.ok(!gt(v1, v0), "!gt('"+v1+"', '"+v0+"')") + t.ok(!lt(v0, v1), "!lt('"+v0+"', '"+v1+"')") + t.ok(eq(v0, v0), "eq('"+v0+"', '"+v0+"')") + t.ok(eq(v1, v1), "eq('"+v1+"', '"+v1+"')") + t.ok(neq(v0, v1), "neq('"+v0+"', '"+v1+"')") + t.ok(cmp(v1, "==", v1), "cmp('"+v1+"' == '"+v1+"')") + t.ok(cmp(v0, ">=", v1), "cmp('"+v0+"' >= '"+v1+"')") + t.ok(cmp(v1, "<=", v0), "cmp('"+v1+"' <= '"+v0+"')") + t.ok(cmp(v0, "!=", v1), "cmp('"+v0+"' != '"+v1+"')") + }) + t.end() +}) + +test("\nequality tests", function (t) { +; [ ["1.2.3", "v1.2.3"] + , ["1.2.3", "=1.2.3"] + , ["1.2.3", "v 1.2.3"] + , ["1.2.3", "= 1.2.3"] + , ["1.2.3", " v1.2.3"] + , ["1.2.3", " =1.2.3"] + , ["1.2.3", " v 1.2.3"] + , ["1.2.3", " = 1.2.3"] + , ["1.2.3-0", "v1.2.3-0"] + , ["1.2.3-0", "=1.2.3-0"] + , ["1.2.3-0", "v 1.2.3-0"] + , ["1.2.3-0", "= 1.2.3-0"] + , ["1.2.3-0", " v1.2.3-0"] + , ["1.2.3-0", " =1.2.3-0"] + , ["1.2.3-0", " v 1.2.3-0"] + , ["1.2.3-0", " = 1.2.3-0"] + , ["1.2.3-01", "v1.2.3-1"] + , ["1.2.3-01", "=1.2.3-1"] + , ["1.2.3-01", "v 1.2.3-1"] + , ["1.2.3-01", "= 1.2.3-1"] + , ["1.2.3-01", " v1.2.3-1"] + , ["1.2.3-01", " =1.2.3-1"] + , ["1.2.3-01", " v 1.2.3-1"] + , ["1.2.3-01", " = 1.2.3-1"] + , ["1.2.3beta", "v1.2.3beta"] + , ["1.2.3beta", "=1.2.3beta"] + , ["1.2.3beta", "v 1.2.3beta"] + , ["1.2.3beta", "= 1.2.3beta"] + , ["1.2.3beta", " v1.2.3beta"] + , ["1.2.3beta", " =1.2.3beta"] + , ["1.2.3beta", " v 1.2.3beta"] + , ["1.2.3beta", " = 1.2.3beta"] + ].forEach(function (v) { + var v0 = v[0] + , v1 = v[1] + t.ok(eq(v0, v1), "eq('"+v0+"', '"+v1+"')") + t.ok(!neq(v0, v1), "!neq('"+v0+"', '"+v1+"')") + t.ok(cmp(v0, "==", v1), "cmp("+v0+"=="+v1+")") + t.ok(!cmp(v0, "!=", v1), "!cmp("+v0+"!="+v1+")") + t.ok(!cmp(v0, "===", v1), "!cmp("+v0+"==="+v1+")") + t.ok(cmp(v0, "!==", v1), "cmp("+v0+"!=="+v1+")") + t.ok(!gt(v0, v1), "!gt('"+v0+"', '"+v1+"')") + t.ok(gte(v0, v1), "gte('"+v0+"', '"+v1+"')") + t.ok(!lt(v0, v1), "!lt('"+v0+"', '"+v1+"')") + t.ok(lte(v0, v1), "lte('"+v0+"', '"+v1+"')") + }) + t.end() +}) + + +test("\nrange tests", function (t) { +; [ ["1.0.0 - 2.0.0", "1.2.3"] + , ["1.0.0", "1.0.0"] + , [">=*", "0.2.4"] + , ["", "1.0.0"] + , ["*", "1.2.3"] + , ["*", "v1.2.3-foo"] + , [">=1.0.0", "1.0.0"] + , [">=1.0.0", "1.0.1"] + , [">=1.0.0", "1.1.0"] + , [">1.0.0", "1.0.1"] + , [">1.0.0", "1.1.0"] + , ["<=2.0.0", "2.0.0"] + , ["<=2.0.0", "1.9999.9999"] + , ["<=2.0.0", "0.2.9"] + , ["<2.0.0", "1.9999.9999"] + , ["<2.0.0", "0.2.9"] + , [">= 1.0.0", "1.0.0"] + , [">= 1.0.0", "1.0.1"] + , [">= 1.0.0", "1.1.0"] + , ["> 1.0.0", "1.0.1"] + , ["> 1.0.0", "1.1.0"] + , ["<= 2.0.0", "2.0.0"] + , ["<= 2.0.0", "1.9999.9999"] + , ["<= 2.0.0", "0.2.9"] + , ["< 2.0.0", "1.9999.9999"] + , ["<\t2.0.0", "0.2.9"] + , [">=0.1.97", "v0.1.97"] + , [">=0.1.97", "0.1.97"] + , ["0.1.20 || 1.2.4", "1.2.4"] + , [">=0.2.3 || <0.0.1", "0.0.0"] + , [">=0.2.3 || <0.0.1", "0.2.3"] + , [">=0.2.3 || <0.0.1", "0.2.4"] + , ["||", "1.3.4"] + , ["2.x.x", "2.1.3"] + , ["1.2.x", "1.2.3"] + , ["1.2.x || 2.x", "2.1.3"] + , ["1.2.x || 2.x", "1.2.3"] + , ["x", "1.2.3"] + , ["2", "2.1.2"] + , ["2.3", "2.3.1"] + , ["~2.4", "2.4.0"] // >=2.4.0 <2.5.0 + , ["~2.4", "2.4.5"] + , ["~>3.2.1", "3.2.2"] // >=3.2.1 <3.3.0 + , ["~1", "1.2.3"] // >=1.0.0 <2.0.0 + , ["~>1", "1.2.3"] + , ["~> 1", "1.2.3"] + , ["~1.0", "1.0.2"] // >=1.0.0 <1.1.0 + , ["~ 1.0", "1.0.2"] + , ["<1", "1.0.0beta"] + , ["< 1", "1.0.0beta"] + , [">=1", "1.0.0"] + , [">= 1", "1.0.0"] + , ["<1.2", "1.1.1"] + , ["< 1.2", "1.1.1"] + , ["1", "1.0.0beta"] + ].forEach(function (v) { + t.ok(satisfies(v[1], v[0]), v[0]+" satisfied by "+v[1]) + }) + t.end() +}) + +test("\nnegative range tests", function (t) { +; [ ["1.0.0 - 2.0.0", "2.2.3"] + , ["1.0.0", "1.0.1"] + , [">=1.0.0", "0.0.0"] + , [">=1.0.0", "0.0.1"] + , [">=1.0.0", "0.1.0"] + , [">1.0.0", "0.0.1"] + , [">1.0.0", "0.1.0"] + , ["<=2.0.0", "3.0.0"] + , ["<=2.0.0", "2.9999.9999"] + , ["<=2.0.0", "2.2.9"] + , ["<2.0.0", "2.9999.9999"] + , ["<2.0.0", "2.2.9"] + , [">=0.1.97", "v0.1.93"] + , [">=0.1.97", "0.1.93"] + , ["0.1.20 || 1.2.4", "1.2.3"] + , [">=0.2.3 || <0.0.1", "0.0.3"] + , [">=0.2.3 || <0.0.1", "0.2.2"] + , ["2.x.x", "1.1.3"] + , ["2.x.x", "3.1.3"] + , ["1.2.x", "1.3.3"] + , ["1.2.x || 2.x", "3.1.3"] + , ["1.2.x || 2.x", "1.1.3"] + , ["2", "1.1.2"] + , ["2.3", "2.4.1"] + , ["~2.4", "2.5.0"] // >=2.4.0 <2.5.0 + , ["~2.4", "2.3.9"] + , ["~>3.2.1", "3.3.2"] // >=3.2.1 <3.3.0 + , ["~>3.2.1", "3.2.0"] // >=3.2.1 <3.3.0 + , ["~1", "0.2.3"] // >=1.0.0 <2.0.0 + , ["~>1", "2.2.3"] + , ["~1.0", "1.1.0"] // >=1.0.0 <1.1.0 + , ["<1", "1.0.0"] + , [">=1.2", "1.1.1"] + , ["1", "2.0.0beta"] + ].forEach(function (v) { + t.ok(!satisfies(v[1], v[0]), v[0]+" not satisfied by "+v[1]) + }) + t.end() +}) + +test("\nincrement versions test", function (t) { +; [ [ "1.2.3", "major", "2.0.0" ] + , [ "1.2.3", "minor", "1.3.0" ] + , [ "1.2.3", "patch", "1.2.4" ] + , [ "1.2.3", "build", "1.2.3-1" ] + , [ "1.2.3-4", "build", "1.2.3-5" ] + + , [ "1.2.3tag", "major", "2.0.0" ] + , [ "1.2.3-tag", "major", "2.0.0" ] + , [ "1.2.3tag", "build", "1.2.3-1" ] + , [ "1.2.3-tag", "build", "1.2.3-1" ] + , [ "1.2.3-4-tag", "build", "1.2.3-5" ] + , [ "1.2.3-4tag", "build", "1.2.3-5" ] + + , [ "1.2.3", "fake", null ] + , [ "fake", "major", null ] + ].forEach(function (v) { + t.equal(inc(v[0], v[1]), v[2], "inc("+v[0]+", "+v[1]+") === "+v[2]) + }) + + t.end() +}) + +} diff --git a/vendor/npm/npm-1.0.27/node_modules/slide/README.md b/vendor/npm/npm-1.0.27/node_modules/slide/README.md new file mode 100644 index 000000000..ed0905f40 --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/slide/README.md @@ -0,0 +1,27 @@ +# Slide - a tiny flow control library + +Callbacks are simple and easy if you keep the pattern consistent. + +Check out the [slide presentation](http://github.com/isaacs/slide-flow-control/raw/master/nodejs-controlling-flow.pdf). + +You'll laugh when you see how little code is actually in this thing. +It's so not-enterprisey, you won't believe it. It does almost nothing, +but it's super handy. + +I actually use an earlier version of this util in +[a real world program](http://npmjs.org/). + +## Installation + +Just copy the files into your project, and use them that way, or +you can do this: + + npm install slide + +and then: + + var asyncMap = require("slide").asyncMap + , chain = require("slide").chain + // use the power! + +Enjoy! diff --git a/vendor/npm/npm-1.0.27/node_modules/slide/index.js b/vendor/npm/npm-1.0.27/node_modules/slide/index.js new file mode 100644 index 000000000..0a9277f6e --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/slide/index.js @@ -0,0 +1 @@ +module.exports=require("./lib/slide") diff --git a/vendor/npm/npm-1.0.27/node_modules/slide/lib/async-map-ordered.js b/vendor/npm/npm-1.0.27/node_modules/slide/lib/async-map-ordered.js new file mode 100644 index 000000000..5cca79a82 --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/slide/lib/async-map-ordered.js @@ -0,0 +1,65 @@ + +throw new Error("TODO: Not yet implemented.") + +/* +usage: + +Like asyncMap, but only can take a single cb, and guarantees +the order of the results. +*/ + +module.exports = asyncMapOrdered + +function asyncMapOrdered (list, fn, cb_) { + if (typeof cb_ !== "function") throw new Error( + "No callback provided to asyncMapOrdered") + + if (typeof fn !== "function") throw new Error( + "No map function provided to asyncMapOrdered") + + if (list === undefined || list === null) return cb_(null, []) + if (!Array.isArray(list)) list = [list] + if (!list.length) return cb_(null, []) + + var errState = null + , l = list.length + , a = l + , res = [] + , resCount = 0 + , maxArgLen = 0 + + function cb (index) { return function () { + if (errState) return + var er = arguments[0] + var argLen = arguments.length + maxArgLen = Math.max(maxArgLen, argLen) + res[index] = argLen === 1 ? [er] : Array.apply(null, arguments) + + // see if any new things have been added. + if (list.length > l) { + var newList = list.slice(l) + a += (list.length - l) + var oldLen = l + l = list.length + process.nextTick(function () { + newList.forEach(function (ar, i) { fn(ar, cb(i + oldLen)) }) + }) + } + + if (er || --a === 0) { + errState = er + cb_.apply(null, [errState].concat(flip(res, resCount, maxArgLen))) + } + }} + // expect the supplied cb function to be called + // "n" times for each thing in the array. + list.forEach(function (ar) { + steps.forEach(function (fn, i) { fn(ar, cb(i)) }) + }) +} + +function flip (res, resCount, argLen) { + var flat = [] + // res = [[er, x, y], [er, x1, y1], [er, x2, y2, z2]] + // return [[x, x1, x2], [y, y1, y2], [undefined, undefined, z2]] + diff --git a/vendor/npm/npm-1.0.27/node_modules/slide/lib/async-map.js b/vendor/npm/npm-1.0.27/node_modules/slide/lib/async-map.js new file mode 100644 index 000000000..1ced158e0 --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/slide/lib/async-map.js @@ -0,0 +1,56 @@ + +/* +usage: + +// do something to a list of things +asyncMap(myListOfStuff, function (thing, cb) { doSomething(thing.foo, cb) }, cb) +// do more than one thing to each item +asyncMap(list, fooFn, barFn, cb) + +*/ + +module.exports = asyncMap + +function asyncMap () { + var steps = Array.prototype.slice.call(arguments) + , list = steps.shift() || [] + , cb_ = steps.pop() + if (typeof cb_ !== "function") throw new Error( + "No callback provided to asyncMap") + if (!list) return cb_(null, []) + if (!Array.isArray(list)) list = [list] + var n = steps.length + , data = [] // 2d array + , errState = null + , l = list.length + , a = l * n + if (!a) return cb_(null, []) + function cb (er) { + if (errState) return + var argLen = arguments.length + for (var i = 1; i < argLen; i ++) if (arguments[i] !== undefined) { + data[i - 1] = (data[i - 1] || []).concat(arguments[i]) + } + // see if any new things have been added. + if (list.length > l) { + var newList = list.slice(l) + a += (list.length - l) * n + l = list.length + process.nextTick(function () { + newList.forEach(function (ar) { + steps.forEach(function (fn) { fn(ar, cb) }) + }) + }) + } + + if (er || --a === 0) { + errState = er + cb_.apply(null, [errState].concat(data)) + } + } + // expect the supplied cb function to be called + // "n" times for each thing in the array. + list.forEach(function (ar) { + steps.forEach(function (fn) { fn(ar, cb) }) + }) +} diff --git a/vendor/npm/npm-1.0.27/node_modules/slide/lib/bind-actor.js b/vendor/npm/npm-1.0.27/node_modules/slide/lib/bind-actor.js new file mode 100644 index 000000000..6a3707274 --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/slide/lib/bind-actor.js @@ -0,0 +1,16 @@ +module.exports = bindActor +function bindActor () { + var args = + Array.prototype.slice.call + (arguments) // jswtf. + , obj = null + , fn + if (typeof args[0] === "object") { + obj = args.shift() + fn = args.shift() + if (typeof fn === "string") + fn = obj[ fn ] + } else fn = args.shift() + return function (cb) { + fn.apply(obj, args.concat(cb)) } +} diff --git a/vendor/npm/npm-1.0.27/node_modules/slide/lib/chain.js b/vendor/npm/npm-1.0.27/node_modules/slide/lib/chain.js new file mode 100644 index 000000000..17b371149 --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/slide/lib/chain.js @@ -0,0 +1,20 @@ +module.exports = chain +var bindActor = require("./bind-actor.js") +chain.first = {} ; chain.last = {} +function chain (things, cb) { + var res = [] + ;(function LOOP (i, len) { + if (i >= len) return cb(null,res) + if (Array.isArray(things[i])) + things[i] = bindActor.apply(null, + things[i].map(function(i){ + return (i===chain.first) ? res[0] + : (i===chain.last) + ? res[res.length - 1] : i })) + if (!things[i]) return LOOP(i + 1, len) + things[i](function (er, data) { + if (er) return cb(er, res) + if (data !== undefined) res = res.concat(data) + LOOP(i + 1, len) + }) + })(0, things.length) } diff --git a/vendor/npm/npm-1.0.27/node_modules/slide/lib/slide.js b/vendor/npm/npm-1.0.27/node_modules/slide/lib/slide.js new file mode 100644 index 000000000..6e9ec2327 --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/slide/lib/slide.js @@ -0,0 +1,3 @@ +exports.asyncMap = require("./async-map") +exports.bindActor = require("./bind-actor") +exports.chain = require("./chain") diff --git a/vendor/npm/npm-1.0.27/node_modules/slide/nodejs-controlling-flow.pdf b/vendor/npm/npm-1.0.27/node_modules/slide/nodejs-controlling-flow.pdf new file mode 100644 index 000000000..ca12d60cb Binary files /dev/null and b/vendor/npm/npm-1.0.27/node_modules/slide/nodejs-controlling-flow.pdf differ diff --git a/vendor/npm/npm-1.0.27/node_modules/slide/package.json b/vendor/npm/npm-1.0.27/node_modules/slide/package.json new file mode 100644 index 000000000..5cc2689e6 --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/slide/package.json @@ -0,0 +1,19 @@ +{ + "name": "slide", + "version": "1.1.3", + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "contributors": [ + "S. Sriram (http://www.565labs.com)" + ], + "description": "A flow control lib small enough to fit on in a slide presentation. Derived live at Oak.JS", + "main": "./lib/slide.js", + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": "*" + }, + "repository": { + "type": "git", + "url": "git://github.com/isaacs/slide-flow-control.git" + } +} diff --git a/vendor/npm/npm-1.0.27/node_modules/which/README.md b/vendor/npm/npm-1.0.27/node_modules/which/README.md new file mode 100644 index 000000000..ff1eb531a --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/which/README.md @@ -0,0 +1,5 @@ +The "which" util from npm's guts. + +Finds the first instance of a specified executable in the PATH +environment variable. Does not cache the results, so `hash -r` is not +needed when the PATH changes. diff --git a/vendor/npm/npm-1.0.27/node_modules/which/bin/which b/vendor/npm/npm-1.0.27/node_modules/which/bin/which new file mode 100755 index 000000000..8432ce2f6 --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/which/bin/which @@ -0,0 +1,14 @@ +#!/usr/bin/env node +var which = require("../") +if (process.argv.length < 3) { + console.error("Usage: which ") + process.exit(1) +} + +which(process.argv[2], function (er, thing) { + if (er) { + console.error(er.message) + process.exit(er.errno || 127) + } + console.log(thing) +}) diff --git a/vendor/npm/npm-1.0.27/node_modules/which/package.json b/vendor/npm/npm-1.0.27/node_modules/which/package.json new file mode 100644 index 000000000..a01c042da --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/which/package.json @@ -0,0 +1,17 @@ +{ + "author": "Isaac Z. Schlueter (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.0", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/node-which.git" + }, + "main": "which.js", + "bin": "./bin/which", + "engines": { + "node": "*" + }, + "dependencies": {}, + "devDependencies": {} +} diff --git a/vendor/npm/npm-1.0.27/node_modules/which/which.js b/vendor/npm/npm-1.0.27/node_modules/which/which.js new file mode 100644 index 000000000..e5ef62d4a --- /dev/null +++ b/vendor/npm/npm-1.0.27/node_modules/which/which.js @@ -0,0 +1,50 @@ +module.exports = which +which.sync = whichSync + +var path = require("path") + , fs + , COLON = process.platform === "win32" ? ";" : ":" + +try { + fs = require("graceful-fs") +} catch (ex) { + fs = require("fs") +} + +// console.log(process.execPath) +// console.log(process.argv) + +function isExe (mod, uid, gid) { + return (mod & 0001) + || (mod & 0010) && gid === process.getgid() + || (mod & 0100) && uid === process.getuid() +} +function which (cmd, cb) { + if (cmd.charAt(0) === "/") return cb(null, cmd) + var pathEnv = (process.env.PATH || "").split(COLON) + ;(function F (i, l) { + if (i === l) return cb(new Error("not found: "+cmd)) + var p = path.join(pathEnv[i], cmd) + if (p === process.execPath) return cb(null, p) + fs.stat(p, function (er, stat) { + if (!er && stat && isExe(stat.mode, stat.uid, stat.gid)) { + return cb(null, p) + } + return F(i+1, l) + }) + })(0, pathEnv.length) +} + + +function whichSync (cmd) { + if (cmd.charAt(0) === "/") return cmd + var pathEnv = (process.env.PATH || "").split(COLON) + 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 + } + throw new Error("not found: "+cmd) +} diff --git a/vendor/npm/npm-1.0.27/npm.js b/vendor/npm/npm-1.0.27/npm.js new file mode 100644 index 000000000..808d620f1 --- /dev/null +++ b/vendor/npm/npm-1.0.27/npm.js @@ -0,0 +1,334 @@ + +process.title = "npm" + +var EventEmitter = require("events").EventEmitter + , npm = module.exports = new EventEmitter + , config = require("./lib/config.js") + , set = require("./lib/utils/set.js") + , get = require("./lib/utils/get.js") + , ini = require("./lib/utils/ini.js") + , log = require("./lib/utils/log.js") + , fs = require("graceful-fs") + , path = require("path") + , abbrev = require("abbrev") + , which = require("which") + , semver = require("semver") + , findPrefix = require("./lib/utils/find-prefix.js") + , getUid = require("./lib/utils/uid-number.js") + +npm.commands = {} +npm.ELIFECYCLE = {} +npm.E404 = {} +npm.EPUBLISHCONFLICT = {} +npm.EJSONPARSE = {} +npm.EISGIT = {} +npm.ECYCLE = {} +npm.EENGINE = {} + + +try { + // startup, ok to do this synchronously + var j = JSON.parse(fs.readFileSync(path.join(__dirname, "package.json"))+"") + npm.version = j.version + npm.nodeVersionRequired = j.engines.node + if (!semver.satisfies(process.version, j.engines.node)) { + log.error(["" + ,"npm requires node version: "+j.engines.node + ,"And you have: "+process.version + ,"which is not satisfactory." + ,"" + ,"Bad things will likely happen. You have been warned." + ,""].join("\n"), "unsupported version") + } +} catch (ex) { + try { + log(ex, "error reading version") + } catch (er) {} + npm.version = ex +} + +var commandCache = {} + // short names for common things + , aliases = { "rm" : "uninstall" + , "r" : "uninstall" + , "un" : "uninstall" + , "unlink" : "uninstall" + , "remove" : "uninstall" + , "rb" : "rebuild" + , "list" : "ls" + , "la" : "ls" + , "ll" : "ls" + , "ln" : "link" + , "i" : "install" + , "up" : "update" + , "c" : "config" + , "info" : "view" + , "find" : "search" + , "s" : "search" + , "se" : "search" + , "author" : "owner" + , "home" : "docs" + } + + , aliasNames = Object.keys(aliases) + // these are filenames in ./lib + , cmdList = [ "install" + , "uninstall" + , "cache" + , "config" + , "set" + , "get" + , "update" + , "outdated" + , "prune" + , "submodule" + , "pack" + + , "rebuild" + , "link" + + , "publish" + , "tag" + , "adduser" + , "unpublish" + , "owner" + , "deprecate" + + , "help" + , "help-search" + , "ls" + , "search" + , "view" + , "init" + , "version" + , "edit" + , "explore" + , "docs" + , "faq" + , "root" + , "prefix" + , "bin" + , "whoami" + + , "test" + , "stop" + , "start" + , "restart" + , "run-script" + , "completion" + ] + , plumbing = [ "build" + , "unbuild" + , "xmas" + ] + , fullList = npm.fullList = cmdList.concat(aliasNames).filter(function (c) { + return plumbing.indexOf(c) === -1 + }) + , abbrevs = abbrev(fullList) + +Object.keys(abbrevs).concat(plumbing).forEach(function addCommand (c) { + Object.defineProperty(npm.commands, c, { get : function () { + if (!loaded) throw new Error( + "Call npm.load(conf, cb) before using this command.\n"+ + "See the README.md or cli.js for example usage.") + var a = npm.deref(c) + if (c === "la" || c === "ll") { + npm.config.set("long", true) + } + if (commandCache[a]) return commandCache[a] + var cmd = require(__dirname+"/lib/"+a+".js") + commandCache[a] = function () { + var args = Array.prototype.slice.call(arguments, 0) + if (typeof args[args.length - 1] !== "function") { + args.push(defaultCb) + } + if (args.length === 1) args.unshift([]) + cmd.apply(npm, args) + } + Object.keys(cmd).forEach(function (k) { + commandCache[a][k] = cmd[k] + }) + return commandCache[a] + }, enumerable: fullList.indexOf(c) !== -1 }) + + // make css-case commands callable via camelCase as well + if (c.match(/\-([a-z])/)) { + addCommand(c.replace(/\-([a-z])/g, function (a, b) { + return b.toUpperCase() + })) + } +}) + +function defaultCb (er, data) { + if (er) console.error(er.stack || er.message) + else console.log(data) +} + +npm.deref = function (c) { + if (!c) return "" + if (c.match(/[A-Z]/)) c = c.replace(/([A-Z])/g, function (m) { + return "-" + m.toLowerCase() + }) + if (plumbing.indexOf(c) !== -1) return c + var a = abbrevs[c] + if (aliases[a]) a = aliases[a] + return a +} + +var loaded = false + , loading = false + , loadErr = null + , loadListeners = [] + +function loadCb (er) { + loadListeners.forEach(function (cb) { + process.nextTick(cb.bind(npm, er, npm)) + }) + loadListeners.length = 0 +} + + +npm.load = function (conf, cb_) { + if (!cb_ && typeof conf === "function") cb_ = conf , conf = {} + if (!cb_) cb_ = function () {} + if (!conf) conf = {} + loadListeners.push(cb_) + if (loaded || loadErr) return cb(loadErr) + if (loading) return + loading = true + var onload = true + + function cb (er) { + if (loadErr) return + loaded = true + loadCb(loadErr = er) + if (onload = onload && npm.config.get("onload-script")) { + require(onload) + onload = false + } + } + + log.waitForConfig() + + load(npm, conf, cb) +} + + +function load (npm, conf, cb) { + which(process.argv[0], function (er, node) { + if (!er && node !== process.execPath) { + log.verbose("node symlink", node) + process.execPath = node + process.installPrefix = path.resolve(node, "..", "..") + } + + // look up configs + ini.resolveConfigs(conf, function (er) { + if (er) return cb(er) + + var n = 2 + , errState + + loadPrefix(npm, conf, next) + loadUid(npm, conf, next) + + function next (er) { + if (errState) return + if (er) return cb(errState = er) + if (-- n <= 0) return cb() + } + }) + }) +} + + +function loadPrefix (npm, conf, cb) { + // try to guess at a good node_modules location. + var p + if (!npm.config.get("global") + && !conf.hasOwnProperty("prefix")) { + p = process.cwd() + } else { + p = npm.config.get("prefix") + } + + findPrefix(p, function (er, p) { + Object.defineProperty(npm, "prefix", + { get : function () { return p } + , set : function (r) { return p = r } + , enumerable : true + }) + cb() + }) +} + + +function loadUid (npm, conf, cb) { + // if we're not in unsafe-perm mode, then figure out who + // to run stuff as. Do this first, to support `npm update npm -g` + if (!npm.config.get("unsafe-perm")) { + getUid(npm.config.get("user"), npm.config.get("group"), cb) + } else cb() +} + + +npm.config = + { get : function (key) { return ini.get(key) } + , set : function (key, val) { return ini.set(key, val, "cli") } + , del : function (key, val) { return ini.del(key, val, "cli") } + } + +Object.defineProperty(npm, "dir", + { get : function () { + if (npm.config.get("global")) { + return path.resolve(npm.prefix, "lib", "node_modules") + } else { + return path.resolve(npm.prefix, "node_modules") + } + } + , enumerable : true + }) + +Object.defineProperty(npm, "root", + { get : function () { return npm.dir } }) + +Object.defineProperty(npm, "cache", + { get : function () { return npm.config.get("cache") } + , set : function (r) { return npm.config.set("cache", r) } + , enumerable : true + }) + +var tmpFolder +Object.defineProperty(npm, "tmp", + { get : function () { + if (!tmpFolder) tmpFolder = "npm-"+Date.now() + return path.resolve(npm.config.get("tmp"), tmpFolder) + } + , enumerable : true + }) + +// the better to repl you with +Object.getOwnPropertyNames(npm.commands).forEach(function (n) { + if (npm.hasOwnProperty(n)) return + + Object.defineProperty(npm, n, { get: function () { + return function () { + var args = Array.prototype.slice.call(arguments, 0) + , cb = defaultCb + + if (args.length === 1 && Array.isArray(args[0])) { + args = args[0] + } + + if (typeof args[args.length - 1] === "function") { + cb = args.pop() + } + + npm.commands[n](args, cb) + } + }, enumerable: false, configurable: true }) +}) + +if (require.main === module) { + require("./bin/npm.js") +} diff --git a/vendor/npm/npm-1.0.27/package.json b/vendor/npm/npm-1.0.27/package.json new file mode 100644 index 000000000..69537ed4c --- /dev/null +++ b/vendor/npm/npm-1.0.27/package.json @@ -0,0 +1,60 @@ +{ "name" : "npm" +, "description" : "A package manager for node" +, "keywords" : [ "package manager", "modules", "install", "package.json" ] +, "version" : "1.0.27" +, "preferGlobal" : true +, "config" : { "publishtest" : false } +, "homepage" : "http://npmjs.org/" +, "author" : "Isaac Z. Schlueter (http://blog.izs.me)" +, "repository" : + { "type" : "git" + , "url" : "https://github.com/isaacs/npm.git" + } +, "bugs" : + { "mail" : "npm-@googlegroups.com" + , "web" : "http://github.com/isaacs/npm/issues" + } +, "directories" : { "doc" : "./doc" + , "man" : "./man1" + , "lib" : "./lib" + , "bin" : "./bin" + } +, "main" : "npm" +, "bin" : { "npm" : "./bin/npm.js" + , "npm_g" : "./bin/npm.js" + , "npm-g" : "./bin/npm.js" } +, "dependencies" : + { "semver" : "1" + , "ini" : "1" + , "slide" : "1" + , "abbrev" : "1" + , "graceful-fs" : "1" + , "minimatch" : "0" + , "nopt" : "1" + , "node-uuid" : "1.2" + , "proto-list": "1" + , "rimraf" : "1" + , "which" : "1" } +, "bundleDependencies" : + [ "slide" + , "ini" + , "semver" + , "abbrev" + , "graceful-fs" + , "minimatch" + , "nopt" + , "node-uuid" + , "rimraf" + , "proto-list" + , "which" ] +, "devDependencies" : { "ronn" : "" } +, "engines" : { "node" : "0.4 || 0.5", "npm" : "1" } +, "scripts" : { "test" : "./test/run.sh" + , "prepublish" : "make doc" + } +, "licenses" : + [ { "type" : "MIT" + , "url" : "http://github.com/isaacs/npm/raw/master/LICENSE" + } + ] +} diff --git a/vendor/npm/npm-1.0.27/scripts/clean-old.sh b/vendor/npm/npm-1.0.27/scripts/clean-old.sh new file mode 100644 index 000000000..98b44e711 --- /dev/null +++ b/vendor/npm/npm-1.0.27/scripts/clean-old.sh @@ -0,0 +1,144 @@ +#!/bin/sh + +# look for old 0.x cruft, and get rid of it. +# Should already be sitting in the npm folder. + +# Sorry, if readlink isn't available, then this is just too tricky. +# However, greadlink is fine, so Solaris can join the party, too. +readlink="readlink" +which $readlink >/dev/null 2>/dev/null +if [ $? -ne 0 ]; then + readlink="greadlink" + which $readlink >/dev/null 2>/dev/null + if [ $? -ne 0 ]; then + echo "Can't find the readlink or greadlink command. Aborting." + exit 1 + fi +fi + +if [ "x$npm_config_prefix" != "x" ]; then + PREFIXES=$npm_config_prefix +else + node="$NODE" + if [ "x$node" = "x" ]; then + node=`which node` + fi + if [ "x$node" = "x" ]; then + echo "Can't find node to determine prefix. Aborting." + exit 1 + fi + + + PREFIX=`dirname $node` + PREFIX=`dirname $PREFIX` + echo "cleanup prefix=$PREFIX" + PREFIXES=$PREFIX + + altprefix=`"$node" -e process.installPrefix` + if [ "x$altprefix" != "x" ] && [ "x$altprefix" != "x$PREFIX" ]; then + echo "altprefix=$altprefix" + PREFIXES="$PREFIX $altprefix" + fi +fi + +# now prefix is where npm would be rooted by default +# go hunting. + +packages= +for prefix in $PREFIXES; do + packages="$packages + "`ls "$prefix"/lib/node/.npm 2>/dev/null | grep -v .cache` +done + +packages=`echo $packages` + +echo "" +echo "This script will find and eliminate any shims, symbolic" +echo "links, and other cruft that was installed by npm 0.x." +echo "" + +if [ "x$packages" != "x" ]; then + echo "The following packages appear to have been installed with" + echo "an old version of npm, and will be removed forcibly:" + for pkg in $packages; do + echo " $pkg" + done + echo "Make a note of these. You may want to install them" + echo "with npm 1.0 when this process is completed." + echo "" +fi + +OK= +if [ "x$1" = "x-y" ]; then + OK="yes" +fi + +while [ "$OK" != "y" ] && [ "$OK" != "yes" ] && [ "$OK" != "no" ]; do + echo "Is this OK? enter 'yes' or 'no' " + read OK +done +if [ "$OK" = "no" ]; then + echo "Aborting" + exit 1 +fi + +filelist="" + +for prefix in $PREFIXES; do + # remove any links into the .npm dir, or links to + # version-named shims/symlinks. + for folder in share/man bin lib/node; do + find $prefix/$folder -type l | while read file; do + target=`$readlink $file | grep '/\.npm/'` + if [ "x$target" != "x" ]; then + # found one! + echo rm -rf "$file" + rm -rf "$file" + # also remove any symlinks to this file. + base=`basename "$file"` + base=`echo "$base" | awk -F@ '{print $1}'` + if [ "x$base" != "x" ]; then + find "`dirname $file`" -type l -name "$base"'*' \ + | while read l; do + target=`$readlink "$l" | grep "$base"` + if [ "x$target" != "x" ]; then + echo rm -rf $l + rm -rf $l + fi + done + fi + fi + done + + # Scour for shim files. These are relics of 0.2 npm installs. + # note: grep -r is not portable. + find $prefix/$folder -type f \ + | xargs grep -sl '// generated by npm' \ + | while read file; do + echo rm -rf $file + rm -rf $file + done + done + + # now remove the package modules, and the .npm folder itself. + if [ "x$packages" != "x" ]; then + for pkg in $packages; do + echo rm -rf $prefix/lib/node/$pkg + rm -rf $prefix/lib/node/$pkg + echo rm -rf $prefix/lib/node/$pkg\@* + rm -rf $prefix/lib/node/$pkg\@* + done + fi + + for folder in lib/node/.npm lib/npm share/npm; do + if [ -d $prefix/$folder ]; then + echo rm -rf $prefix/$folder + rm -rf $prefix/$folder + fi + done +done + +echo "" +echo 'All clean!' + +exit 0 diff --git a/vendor/npm/npm-1.0.27/scripts/install.sh b/vendor/npm/npm-1.0.27/scripts/install.sh new file mode 100644 index 000000000..36c913562 --- /dev/null +++ b/vendor/npm/npm-1.0.27/scripts/install.sh @@ -0,0 +1,159 @@ +#!/bin/sh + +if [ "x$0" = "xsh" ]; then + # run as curl | sh + # on some systems, you can just do cat>npm-install.sh + # which is a bit cuter. But on others, &1 is already closed, + # so catting to another script file won't do anything. + curl -s http://npmjs.org/install.sh > npm-install-$$.sh + sh npm-install-$$.sh + ret=$? + rm npm-install-$$.sh + exit $ret +fi + +npm_config_loglevel="error" +if ! [ "x$npm_debug" = "x" ]; then + set -x + npm_config_loglevel="verbose" +fi +export npm_config_loglevel + +# make sure that node exists +node=`which node 2>&1` +ret=$? +if [ $ret -ne 0 ] || ! [ -x "$node" ]; then + echo "npm cannot be installed without nodejs." >&2 + echo "Install node first, and then try again." >&2 + echo "" >&2 + echo "Maybe node is installed, but not in the PATH?" >&2 + echo "Note that running as sudo can change envs." >&2 + echo "" + echo "PATH=$PATH" >&2 + exit $ret +fi + +# set the temp dir +TMP="${TMPDIR}" +if [ "x$TMP" = "x" ]; then + TMP="/tmp" +fi +TMP="${TMP}/npm.$$" +rm -rf "$TMP" || true +mkdir "$TMP" +if [ $? -ne 0 ]; then + echo "failed to mkdir $TMP" >&2 + exit 1 +fi + +BACK="$PWD" + +# sniff for gtar/gegrep/gmake +# use which, but don't trust it very much. + +tar="${TAR}" +if [ -z "$tar" ]; then + tar=tar +fi + +egrep=`which gegrep 2>&1` +if [ $? -ne 0 ] || ! [ -x $egrep ]; then + egrep=egrep +fi + +make=`which gmake 2>&1` +if [ $? -ne 0 ] || ! [ -x $make ]; then + make=`which make 2>&1` + if [ $? -ne 0 ] || ! [ -x $make ]; then + make=NOMAKE + echo "Installing without make. This may fail." >&2 + fi +fi + +t="${npm_install}" +if [ -z "$t" ]; then + t="latest" +fi + +url=`curl -s -L http://registry.npmjs.org/npm/$t \ + | $egrep -o 'tarball":"[^"]+' \ + | head -n 1 \ + | $egrep -o 'http://.*'` +echo "fetching: $url" >&2 + +ret=$? +if [ $ret -ne 0 ]; then + echo "Failed to get tarball url" >&2 + exit $ret +fi + +cd "$TMP" \ + && curl -s -L "$url" | gzip --decompress --stdout | $tar -xf - \ + && cd * \ + && (node_version=`"$node" --version 2>&1` + ret=$? + if [ $ret -eq 0 ]; then + req=`"$node" bin/read-package-json.js package.json engines.node` + if [ -e node_modules ]; then + "$node" node_modules/semver/bin/semver -v "$node_version" -r "$req" + ret=$? + else + "$node" bin/semver.js -v "$node_version" -r "$req" + ret=$? + fi + fi + if [ $ret -ne 0 ]; then + echo "You need node $req to run this program." >&2 + echo "node --version reports: $node_version" >&2 + echo "Please upgrade node before continuing." + exit $ret + fi) \ + && (ver=`"$node" bin/read-package-json.js package.json version` + isnpm10=0 + if [ $ret -eq 0 ]; then + req=`"$node" bin/read-package-json.js package.json engines.node` + if [ -e node_modules ]; then + if "$node" node_modules/semver/bin/semver -v "$ver" -r "1" + then + isnpm10=1 + fi + else + if "$node" bin/semver -v "$ver" -r ">=1.0"; then + isnpm10=1 + fi + fi + fi + + ret=0 + if [ $isnpm10 -eq 1 ] && [ -f "scripts/clean-old.sh" ]; then + if ! [ "x$skipclean" = "x" ] \ + || [ "x$clean" = "xno" ] \ + || [ "x$clean" = "xn" ]; then + echo "Skipping 0.x cruft clean" >&2 + ret=0 + elif [ "x$clean" = "xy" ] || [ "x$clean" = "xyes" ]; then + NODE="$node" /bin/sh "scripts/clean-old.sh" "-y" + ret=$? + else + NODE="$node" /bin/sh "scripts/clean-old.sh" &2 + exit $ret + fi) \ + && (if [ "$make" = "NOMAKE" ] || ! $make clean install; then + "$node" cli.js rm npm -gf + "$node" cli.js install -gf + fi) \ + && cd "$BACK" \ + && rm -rf "$TMP" \ + && echo "It worked" + +ret=$? +if [ $ret -ne 0 ]; then + echo "It failed" >&2 +fi +exit $ret diff --git a/vendor/npm/npm-1.0.27/test/common.js b/vendor/npm/npm-1.0.27/test/common.js new file mode 100644 index 000000000..2755056b1 --- /dev/null +++ b/vendor/npm/npm-1.0.27/test/common.js @@ -0,0 +1,7 @@ + +// whatever, it's just tests. +;["util","assert"].forEach(function (thing) { + thing = require("thing") + for (var i in thing) global[i] = thing[i] +} + diff --git a/vendor/npm/npm-1.0.27/test/disabled/bundlerecurs/package.json b/vendor/npm/npm-1.0.27/test/disabled/bundlerecurs/package.json new file mode 100644 index 000000000..d87041170 --- /dev/null +++ b/vendor/npm/npm-1.0.27/test/disabled/bundlerecurs/package.json @@ -0,0 +1,4 @@ +{ "name" : "bundletest" +, "version" : "1.0.0" +, "dependencies" : { "bundletest" : "*" } +} diff --git a/vendor/npm/npm-1.0.27/test/disabled/failer/package.json b/vendor/npm/npm-1.0.27/test/disabled/failer/package.json new file mode 100644 index 000000000..e1f8e946b --- /dev/null +++ b/vendor/npm/npm-1.0.27/test/disabled/failer/package.json @@ -0,0 +1,5 @@ +{ "name" : "failer" +, "version" : "9999.999.99" +, "dependencies" : { "base64" : "*" } +, "scripts" : { "preinstall" : "exit 1" } +} diff --git a/vendor/npm/npm-1.0.27/test/disabled/fast/package.json b/vendor/npm/npm-1.0.27/test/disabled/fast/package.json new file mode 100644 index 000000000..9de6b81c3 --- /dev/null +++ b/vendor/npm/npm-1.0.27/test/disabled/fast/package.json @@ -0,0 +1,12 @@ +{ "name" : "fast" +, "description" : "does nothing, and not very fast" +, "version" : "1.2.3" +, "scripts" : +{ "preinstall" : "sleep 1 && echo fast 1 $(date +%s) && echo fast 2" +, "install" : "sleep 1 && echo fast 2 $(date +%s) && echo fast 3" +, "postinstall" : "sleep 1 && echo fast 3 $(date +%s) && echo fast 4" +, "preactivate" : "sleep 1 && echo fast 4 $(date +%s) && echo fast 5" +, "activate" : "sleep 1 && echo fast 5 $(date +%s) && echo fast 6" +, "postactivate" : "sleep 1 && echo fast 6 $(date +%s) && echo fast 7" +} +} diff --git a/vendor/npm/npm-1.0.27/test/disabled/package-config/package.json b/vendor/npm/npm-1.0.27/test/disabled/package-config/package.json new file mode 100644 index 000000000..7ec97d380 --- /dev/null +++ b/vendor/npm/npm-1.0.27/test/disabled/package-config/package.json @@ -0,0 +1,4 @@ +{"name":"package-config" +,"version":"1.2.3" +,"config":{"foo":"bar"} +,"scripts":{"test":"./test.js"}} diff --git a/vendor/npm/npm-1.0.27/test/disabled/package-config/test.js b/vendor/npm/npm-1.0.27/test/disabled/package-config/test.js new file mode 100755 index 000000000..7337b237b --- /dev/null +++ b/vendor/npm/npm-1.0.27/test/disabled/package-config/test.js @@ -0,0 +1,17 @@ +#!/usr/bin/env node + +var env = process.env + , orig = require(process.env.npm_package_name+"/package.json").config + , assert = require("assert") + +console.log("Before running this test, do:\n" + +" npm config set package-config:foo boo\n" + +"or else it's about to fail.") +assert.equal(env.npm_package_config_foo, "boo", "foo != boo") +assert.equal(orig.foo, "bar", "original foo != bar") +assert.equal(env["npm_config_package-config:foo"], "boo", + "package-config:foo != boo") +console.log({ foo: env.npm_package_config_foo + , orig_foo: orig.foo + , "package-config:foo": env["npm_config_package-config:foo"] + }) diff --git a/vendor/npm/npm-1.0.27/test/disabled/slow/package.json b/vendor/npm/npm-1.0.27/test/disabled/slow/package.json new file mode 100644 index 000000000..75c404606 --- /dev/null +++ b/vendor/npm/npm-1.0.27/test/disabled/slow/package.json @@ -0,0 +1,12 @@ +{ "name" : "slow" +, "description" : "just like fast, but even slower" +, "version" : "1.2.3" +, "scripts" : + { "preinstall" : "sleep 1 && echo slow 1 $(date +%s) && sleep 1 && echo slow 2 $(date +%s)" + , "install" : "sleep 1 && echo slow 2 $(date +%s) && sleep 1 && echo slow 3 $(date +%s)" + , "postinstall" : "sleep 1 && echo slow 3 $(date +%s) && sleep 1 && echo slow 4 $(date +%s)" + , "preactivate" : "sleep 1 && echo slow 4 $(date +%s) && sleep 1 && echo slow 5 $(date +%s)" + , "activate" : "sleep 1 && echo slow 5 $(date +%s) && sleep 1 && echo slow 6 $(date +%s)" + , "postactivate" : "sleep 1 && echo slow 6 $(date +%s) && sleep 1 && echo slow 7 $(date +%s)" + } +} diff --git a/vendor/npm/npm-1.0.27/test/disabled/startstop/package.json b/vendor/npm/npm-1.0.27/test/disabled/startstop/package.json new file mode 100644 index 000000000..bee2a2fd3 --- /dev/null +++ b/vendor/npm/npm-1.0.27/test/disabled/startstop/package.json @@ -0,0 +1,3 @@ +{"name":"startstop" +,"version":"1.2.3" +,"scripts":{"start":"echo 'start'","stop":"echo 'stop'"}} diff --git a/vendor/npm/npm-1.0.27/test/packages/npm-test-blerg/package.json b/vendor/npm/npm-1.0.27/test/packages/npm-test-blerg/package.json new file mode 100644 index 000000000..374b4432b --- /dev/null +++ b/vendor/npm/npm-1.0.27/test/packages/npm-test-blerg/package.json @@ -0,0 +1,4 @@ +{ "name":"npm-test-blerg" +, "version" : "0.0.0" +, "scripts" : { "test" : "node test.js" } +} diff --git a/vendor/npm/npm-1.0.27/test/packages/npm-test-blerg/test.js b/vendor/npm/npm-1.0.27/test/packages/npm-test-blerg/test.js new file mode 100644 index 000000000..f548458ac --- /dev/null +++ b/vendor/npm/npm-1.0.27/test/packages/npm-test-blerg/test.js @@ -0,0 +1,5 @@ + +var assert = require("assert") +assert.equal(undefined, process.env.npm_config__password, "password exposed!") +assert.equal(undefined, process.env.npm_config__auth, "auth exposed!") +assert.equal(undefined, process.env.npm_config__authCrypt, "authCrypt exposed!") diff --git a/vendor/npm/npm-1.0.27/test/packages/npm-test-env-reader/package.json b/vendor/npm/npm-1.0.27/test/packages/npm-test-env-reader/package.json new file mode 100644 index 000000000..01153a2df --- /dev/null +++ b/vendor/npm/npm-1.0.27/test/packages/npm-test-env-reader/package.json @@ -0,0 +1,18 @@ +{ "name":"npm-test-env-reader" +, "version" : "1.2.3" +, "dependencies" : { "connect":"*", "fab":"*", "glob":"*" } +, "scripts" : + { "install" : "./test.sh" + , "preinstall" : "./test.sh" + , "activate" : "./test.sh" + , "postactivate" : "./test.sh" + , "preuninstall" : "./test.sh" + , "postuninstall" : "./test.sh" + , "predeactivate" : "./test.sh" + , "test" : "./test.sh" + , "stop" : "./test.sh" + , "start" : "./test.sh" + , "restart" : "./test.sh" + , "foo" : "./test.sh" + } +} diff --git a/vendor/npm/npm-1.0.27/test/packages/npm-test-env-reader/test.sh b/vendor/npm/npm-1.0.27/test/packages/npm-test-env-reader/test.sh new file mode 100755 index 000000000..b4ca4374e --- /dev/null +++ b/vendor/npm/npm-1.0.27/test/packages/npm-test-env-reader/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env sh +env | grep npm | sort | uniq +echo PATH=$PATH diff --git a/vendor/npm/npm-1.0.27/test/packages/npm-test-missing-bindir/package.json b/vendor/npm/npm-1.0.27/test/packages/npm-test-missing-bindir/package.json new file mode 100644 index 000000000..49e26742d --- /dev/null +++ b/vendor/npm/npm-1.0.27/test/packages/npm-test-missing-bindir/package.json @@ -0,0 +1,4 @@ +{ "name":"npm-test-missing-bindir" +, "version" : "0.0.0" +, "scripts" : { "test" : "node test.js" } +, "directories": { "bin" : "./not-found" } } diff --git a/vendor/npm/npm-1.0.27/test/packages/npm-test-missing-bindir/test.js b/vendor/npm/npm-1.0.27/test/packages/npm-test-missing-bindir/test.js new file mode 100644 index 000000000..f548458ac --- /dev/null +++ b/vendor/npm/npm-1.0.27/test/packages/npm-test-missing-bindir/test.js @@ -0,0 +1,5 @@ + +var assert = require("assert") +assert.equal(undefined, process.env.npm_config__password, "password exposed!") +assert.equal(undefined, process.env.npm_config__auth, "auth exposed!") +assert.equal(undefined, process.env.npm_config__authCrypt, "authCrypt exposed!") diff --git a/vendor/npm/npm-1.0.27/test/packages/npm-test-private/package.json b/vendor/npm/npm-1.0.27/test/packages/npm-test-private/package.json new file mode 100644 index 000000000..3d95a37af --- /dev/null +++ b/vendor/npm/npm-1.0.27/test/packages/npm-test-private/package.json @@ -0,0 +1,4 @@ +{"name":"npm-test-private" +,"version":"9.9.9-9" +,"homepage":"http://www.youtube.com/watch?v=1MLry6Cn_D4" +,"private":"true"} diff --git a/vendor/npm/npm-1.0.27/test/packages/npm-test-test-package/package.json b/vendor/npm/npm-1.0.27/test/packages/npm-test-test-package/package.json new file mode 100644 index 000000000..c5c5aeabc --- /dev/null +++ b/vendor/npm/npm-1.0.27/test/packages/npm-test-test-package/package.json @@ -0,0 +1,5 @@ +{ "name":"npm-test-test-package" +, "author" : "Testy McMock" +, "version" : "1.2.3-99-b" +, "description" : "This is a test package used for debugging. It has some random data and that's all." +} diff --git a/vendor/npm/npm-1.0.27/test/packages/npm-test-url-dep/package.json b/vendor/npm/npm-1.0.27/test/packages/npm-test-url-dep/package.json new file mode 100644 index 000000000..b19a167c8 --- /dev/null +++ b/vendor/npm/npm-1.0.27/test/packages/npm-test-url-dep/package.json @@ -0,0 +1,6 @@ +{ "name":"npm-test-url-dep" +, "version" : "1.2.3" +, "files" : [] +, "dependencies" : + { "express" : "*" + , "npm" : "https://github.com/isaacs/npm/tarball/master" } } diff --git a/vendor/npm/npm-1.0.27/test/run.sh b/vendor/npm/npm-1.0.27/test/run.sh new file mode 100755 index 000000000..9b4189acc --- /dev/null +++ b/vendor/npm/npm-1.0.27/test/run.sh @@ -0,0 +1,133 @@ +#!/bin/bash + +# the "npm" command is set to a custom function here so that we can +# test the code in this repo, rather than whichever version of npm +# happens to be installed. + +main () { + # setup + FAILURES=0 + + cd "$TESTDIR" + + npm config ls + + # install + npm install "$NPMPKG" || exit 1 + + # used in test later + npm config set package-config:foo boo || exit 1 + + npm install $( ls packages | awk '{print "packages/" $1 }' ) || exit 1 + (ls packages | while read pkg; do + npm test "$pkg" + done) || exit 1 + if [ "$FAILURES" == "0" ]; then + npm rm $(ls packages) npm || exit 1 + fi + cleanup + + if ! [ "$npm_package_config_publishtest" == "true" ]; then + echo_err "To test publishing: npm config set npm:publishtest true" + else + # attempt to publish and unpublish each of them. + npm install "$NPMPKG" || exit 1 + + (ls packages | grep -v 'npm-test-private' | while read pkg; do + npm publish packages/$pkg || exit 1 + npm install $pkg || exit 1 + npm unpublish $pkg || exit 1 + done) || exit 1 + + # verify that the private package can't be published + # bypass the test-harness npm function. + "$NPMCLI" publish packages/npm-test-private && ( + npm unpublish npm-test-private + exit 1000 + ) + if [ $? -eq 1000 ]; then + fail "Private package shouldn't be publishable" >&2 + fi + + if [ "$FAILURES" == "0" ]; then + npm rm $(ls packages) npm || exit 1 + fi + cleanup + + fi + + if [ $FAILURES -eq 0 ]; then + echo_err "ok" + rm -rf $TMP + else + echo_err "FAILED: $FAILURES" + fi + exit $FAILURES +} + + + +#################### +# Test Harness below + +# fake functions +npm () { + echo -e "npm $@" + "$NPMCLI" "$@" \ + || fail npm "$@" +} + +# get the absolute path of the executable +SELF_PATH="$0" +if [ "${SELF_PATH:0:1}" != "." ] && [ "${SELF_PATH:0:1}" != "/" ]; then + SELF_PATH=./"$SELF_PATH" +fi +SELF_PATH=$( cd -P -- "$(dirname -- "$SELF_PATH")" \ + && pwd -P \ + ) && SELF_PATH=$SELF_PATH/$(basename -- "$0") +# resolve symlinks +while [ -h "$SELF_PATH" ]; do + DIR=$(dirname -- "$SELF_PATH") + SYM=$(readlink -- "$SELF_PATH") + SELF_PATH=$( cd -- "$DIR" \ + && cd -- $(dirname -- "$SYM") \ + && pwd \ + )/$(basename -- "$SYM") +done +NPMPKG="$(dirname -- "$(dirname -- "$SELF_PATH")")" +NPMCLI="$NPMPKG/cli.js" +TESTDIR="$NPMPKG/test/" +TMP=${TMPDIR:-/tmp} +rm -rf $TMP/npm* +TMP=$TMP/npm-test-$$ +echo "Testing in $TMP ..." +ROOTDIR="$TMP/root" + +cleanup () { + if [ "$FAILURES" != "0" ] && [ "$FAILURES" != "" ]; then + return + fi + [ -d "$ROOTDIR" ] && rm -rf -- "$ROOTDIR" + mkdir -p -- "$ROOTDIR" +} + +export npm_config_prefix="$ROOTDIR" +export npm_config_color="always" +export npm_config_global=true +# have to set this to false, or it'll try to test itself forever +export npm_config_npat=false +export PATH="$PATH":"$ROOTDIR/bin":"$ROOTDIR/node_modules/.bin" +export NODE_PATH="$ROOTDIR/node_modules" + +echo_err () { + echo "$@" >&2 +} +fail () { + let 'FAILURES += 1' + echo_err "" + echo_err -e "\033[33mFailure: $@\033[m" + exit 1 +} + +cleanup +main diff --git a/vendor/npm/npm-1.0.27/test/update-test.sh b/vendor/npm/npm-1.0.27/test/update-test.sh new file mode 100755 index 000000000..f72c90dd9 --- /dev/null +++ b/vendor/npm/npm-1.0.27/test/update-test.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +SELF_PATH="$0" +if [ "${SELF_PATH:0:1}" != "." ] && [ "${SELF_PATH:0:1}" != "/" ]; then + SELF_PATH=./"$SELF_PATH" +fi +SELF_PATH=$( cd -P -- "$(dirname -- "$SELF_PATH")" \ + && pwd -P \ + ) && SELF_PATH=$SELF_PATH/$(basename -- "$0") + +# resolve symlinks +while [ -h "$SELF_PATH" ]; do + DIR=$(dirname -- "$SELF_PATH") + SYM=$(readlink -- "$SELF_PATH") + SELF_PATH=$( cd -- "$DIR" \ + && cd -- $(dirname -- "$SYM") \ + && pwd \ + )/$(basename -- "$SYM") +done +DIR=$( dirname -- "$SELF_PATH" ) + +export npm_config_root=$DIR/root +export npm_config_binroot=$DIR/bin + +rm -rf $DIR/{root,bin} +mkdir -p $DIR/root +mkdir -p $DIR/bin +npm ls installed 2>/dev/null | grep -v npm | awk '{print $1}' | xargs npm rm &>/dev/null +npm install \ + base64@1.0.0 \ + eyes@0.1.1 \ + vows@0.2.5 \ + websocket-server@1.0.5 &>/dev/null +npm install ./test/packages/blerg &>/dev/null +npm install vows@0.3.0 &>/dev/null + +echo "" +echo "##" +echo "## starting update" +echo "##" +echo "" + +npm update + +echo "" +echo "##" +echo "## update done, all should be 'latest'" +echo "##" +echo "" + +list=$( npm ls installed remote 2>/dev/null ) +echo "$list" +notlatest=$( echo "$list" | grep -v latest ) +if [ "$notlatest" != "" ]; then + echo "Failed: not latest" + echo $notlatest +else + echo "ok" +fi