Added node-modules

This commit is contained in:
Dobie Wollert
2014-09-14 07:04:16 -04:00
parent 663941bf57
commit 6a92348cf5
4870 changed files with 670395 additions and 0 deletions

27
node_modules/supervisor/LICENSE generated vendored Normal file
View File

@ -0,0 +1,27 @@
Copyright (c) Isaac Z. Schlueter, Ian Young, and Other Contributors
All rights reserved.
The BSD License
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

104
node_modules/supervisor/README.md generated vendored Normal file
View File

@ -0,0 +1,104 @@
# node-supervisor
A little supervisor script for nodejs. It runs your program, and
watches for code changes, so you can have hot-code reloading-ish
behavior, without worrying about memory leaks and making sure you
clean up all the inter-module references, and without a whole new
`require` system.
## node-supervisor -?
Node Supervisor is used to restart programs when they crash.
It can also be used to restart programs when a *.js file changes.
Usage:
supervisor [options] <program>
supervisor [options] -- <program> [args ...]
Required:
<program>
The program to run.
Options:
-w|--watch <watchItems>
A comma-delimited list of folders or js files to watch for changes.
When a change to a js file occurs, reload the program
Default is '.'
-i|--ignore <ignoreItems>
A comma-delimited list of folders to ignore for changes.
No default
-p|--poll-interval <milliseconds>
How often to poll watched files for changes.
Defaults to Node default.
-e|--extensions <extensions>
Specific file extensions to watch in addition to defaults.
Used when --watch option includes folders
Default is 'node|js'
-x|--exec <executable>
The executable that runs the specified program.
Default is 'node'
--debug
Start node with --debug flag.
--debug-brk
Start node with --debug-brk flag.
-n|--no-restart-on error|exit
Don't automatically restart the supervised program if it ends.
Supervisor will wait for a change in the source files.
If "error", an exit code of 0 will still restart.
If "exit", no restart regardless of exit code.
-h|--help|-?
Display these usage instructions.
-q|--quiet
Suppress DEBUG messages
Examples:
supervisor myapp.js
supervisor myapp.coffee
supervisor -w scripts -e myext -x myrunner myapp
supervisor -w lib,server.js,config.js server.js
supervisor -- server.js -h host -p port
## Simple Install
Install npm, and then do this:
npm install supervisor -g
You don't even need to download or fork this repo at all.
## Fancy Install
Get this code, install npm, and then do this:
npm link
## todo
1. Re-attach to a process by pid. If the supervisor is
backgrounded, and then disowned, the child will keep running. At
that point, the supervisor may be killed, but the child will keep
on running. It'd be nice to have two supervisors that kept each
other up, and could also perhaps run a child program.
2. Run more types of programs than just "node blargh.js".
3. Be able to run more than one program, so that you can have two
supervisors supervise each other, and then also keep some child
server up.
4. When watching, it'd be good to perhaps bring up a new child
and then kill the old one gently, rather than just crashing the
child abruptly.
5. Keep the pid in a safe place, so another supervisor can pull
it out if told to supervise the same program.
6. It'd be pretty cool if this program could be run just like
doing `node blah.js`, but could somehow "know" which files had
been loaded, and restart whenever a touched file changes.

14
node_modules/supervisor/lib/cli-wrapper.js generated vendored Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env node
var path = require("path")
, fs = require("fs")
, args = process.argv.slice(1)
var arg, base;
do arg = args.shift();
while ( fs.realpathSync(arg) !== __filename
&& (base = path.basename(arg)) !== "node-supervisor"
&& base !== "supervisor"
&& base !== "supervisor.js"
)
require("./supervisor").run(args)

312
node_modules/supervisor/lib/supervisor.js generated vendored Normal file
View File

@ -0,0 +1,312 @@
var util = require("util");
var fs = require("fs");
var spawn = require("child_process").spawn;
var path = require("path");
var fileExtensionPattern;
var startChildProcess;
var noRestartOn = null;
var debug = true;
var verbose = false;
var ignoredPaths = {};
exports.run = run;
function run (args) {
var arg, next, watch, ignore, program, extensions, executor, poll_interval, debugFlag, debugBrkFlag;
while (arg = args.shift()) {
if (arg === "--help" || arg === "-h" || arg === "-?") {
return help();
} else if (arg === "--quiet" || arg === "-q") {
debug = false;
util.debug = function(){};
util.puts = function(){};
} else if (arg === "--verbose" || arg === "-V") {
verbose = true;
} else if (arg === "--watch" || arg === "-w") {
watch = args.shift();
} else if (arg === "--ignore" || arg === "-i") {
ignore = args.shift();
} else if (arg === "--poll-interval" || arg === "-p") {
poll_interval = parseInt(args.shift());
} else if (arg === "--extensions" || arg === "-e") {
extensions = args.shift();
} else if (arg === "--exec" || arg === "-x") {
executor = args.shift();
} else if (arg === "--no-restart-on" || arg === "-n") {
noRestartOn = args.shift();
} else if (arg === "--debug") {
debugFlag = true;
} else if (arg === "--debug-brk") {
debugBrkFlag = true;
} else if (arg === "--") {
program = args;
break;
} else if (arg.indexOf("-") && !args.length) {
// Assume last arg is the program
program = [arg];
}
}
if (!program) {
return help();
}
if (!watch) {
watch = ".";
}
if (!poll_interval) {
poll_interval = 1000;
}
var programExt = program.join(" ").match(/.*\.(\S*)/);
programExt = programExt && programExt[1];
if (!extensions) {
// If no extensions passed try to guess from the program
extensions = "node|js";
if (programExt && extensions.indexOf(programExt) == -1) {
// Support coffee and litcoffee extensions
if(programExt === "coffee" || programExt === "litcoffee") {
extensions += "|coffee|litcoffee";
} else {
extensions += "|" + programExt;
}
}
}
extensions = extensions.replace(/,/g, "|");
fileExtensionPattern = new RegExp("^.*\.(" + extensions + ")$");
if (!executor) {
executor = (programExt === "coffee" || programExt === "litcoffee") ? "coffee" : "node";
}
if (debugFlag) {
program.unshift("--debug");
}
if (debugBrkFlag) {
program.unshift("--debug-brk");
}
if (executor === "coffee" && (debugFlag || debugBrkFlag)) {
// coffee does not understand debug or debug-brk, make coffee pass options to node
program.unshift("--nodejs")
}
try {
// Pass kill signals through to child
[ "SIGTERM", "SIGINT", "SIGHUP", "SIGQUIT" ].forEach( function(signal) {
process.on(signal, function () {
var child = exports.child;
if (child) {
util.debug("Sending "+signal+" to child...");
child.kill(signal);
}
process.exit();
});
});
} catch(e) {
// Windows doesn't support signals yet, so they simply don't get this handling.
// https://github.com/joyent/node/issues/1553
}
util.puts("")
util.debug("Running node-supervisor with");
util.debug(" program '" + program.join(" ") + "'");
util.debug(" --watch '" + watch + "'");
util.debug(" --ignore '" + ignore + "'");
util.debug(" --extensions '" + extensions + "'");
util.debug(" --exec '" + executor + "'");
util.puts("");
// store the call to startProgramm in startChildProcess
// in order to call it later
startChildProcess = function() { startProgram(program, executor); };
// if we have a program, then run it, and restart when it crashes.
// if we have a watch folder, then watch the folder for changes and restart the prog
startChildProcess();
if (ignore) {
var ignoreItems = ignore.split(',');
ignoreItems.forEach(function (ignoreItem) {
ignoreItem = path.resolve(ignoreItem);
ignoredPaths[ignoreItem] = true;
util.debug("Ignoring directory '" + ignoreItem + "'.");
});
}
var watchItems = watch.split(',');
watchItems.forEach(function (watchItem) {
watchItem = path.resolve(watchItem);
util.debug("Watching directory '" + watchItem + "' for changes.");
findAllWatchFiles(watchItem, function(f) {
watchGivenFile( f, poll_interval );
});
});
};
function print (m, n) { util.print(m+(!n?"\n":"")); return print; }
function help () {
print
("")
("Node Supervisor is used to restart programs when they crash.")
("It can also be used to restart programs when a *.js file changes.")
("")
("Usage:")
(" supervisor [options] <program>")
(" supervisor [options] -- <program> [args ...]")
("")
("Required:")
(" <program>")
(" The program to run.")
("")
("Options:")
(" -w|--watch <watchItems>")
(" A comma-delimited list of folders or js files to watch for changes.")
(" When a change to a js file occurs, reload the program")
(" Default is '.'")
("")
(" -i|--ignore <ignoreItems>")
(" A comma-delimited list of folders to ignore for changes.")
(" No default")
("")
(" -p|--poll-interval <milliseconds>")
(" How often to poll watched files for changes.")
(" Defaults to Node default.")
("")
(" -e|--extensions <extensions>")
(" Specific file extensions to watch in addition to defaults.")
(" Used when --watch option includes folders")
(" Default is 'node|js'")
("")
(" -x|--exec <executable>")
(" The executable that runs the specified program.")
(" Default is 'node'")
("")
(" --debug")
(" Start node with --debug flag.")
("")
(" --debug-brk")
(" Start node with --debug-brk flag.")
("")
(" -n|--no-restart-on error|exit")
(" Don't automatically restart the supervised program if it ends.")
(" Supervisor will wait for a change in the source files.")
(" If \"error\", an exit code of 0 will still restart.")
(" If \"exit\", no restart regardless of exit code.")
("")
(" -h|--help|-?")
(" Display these usage instructions.")
("")
(" -q|--quiet")
(" Suppress DEBUG messages")
("")
(" -V|--verbose")
(" Show extra DEBUG messages")
("")
("Examples:")
(" supervisor myapp.js")
(" supervisor myapp.coffee")
(" supervisor -w scripts -e myext -x myrunner myapp")
(" supervisor -- server.js -h host -p port")
("");
};
function startProgram (prog, exec) {
util.debug("Starting child process with '" + exec + " " + prog.join(" ") + "'");
crash_queued = false;
var child = exports.child = spawn(exec, prog, {stdio: 'inherit'});
if (child.stdout) {
// node < 0.8 doesn't understand the 'inherit' option, so pass through manually
child.stdout.addListener("data", function (chunk) { chunk && util.print(chunk); });
child.stderr.addListener("data", function (chunk) { chunk && util.debug(chunk); });
}
child.addListener("exit", function (code) {
if (!crash_queued) {
util.debug("Program " + exec + " " + prog.join(" ") + " exited with code " + code + "\n");
exports.child = null;
if (noRestartOn == "exit" || noRestartOn == "error" && code !== 0) return;
}
startProgram(prog, exec);
});
}
var timer = null, mtime = null; crash_queued = false;
function crash () {
if (crash_queued)
return;
crash_queued = true;
var child = exports.child;
setTimeout(function() {
if (child) {
util.debug("crashing child");
process.kill(child.pid);
} else {
util.debug("restarting child");
startChildProcess();
}
}, 50);
}
function crashWin (event, filename) {
var shouldCrash = true;
if( event === 'change' ) {
if (filename) {
filename = path.resolve(filename);
Object.keys(ignoredPaths).forEach(function (ignorePath) {
if ( filename.indexOf(ignorePath + '\\') === 0 ) {
shouldCrash = false;
}
});
}
if (shouldCrash)
crash();
}
}
function crashOther (oldStat, newStat) {
// we only care about modification time, not access time.
if ( newStat.mtime.getTime() !== oldStat.mtime.getTime() )
crash();
}
var nodeVersion = process.version.split(".");
var isWindowsWithoutWatchFile = process.platform === 'win32' && parseInt(nodeVersion[1]) <= 6;
function watchGivenFile (watch, poll_interval) {
if (isWindowsWithoutWatchFile)
fs.watch(watch, { persistent: true, interval: poll_interval }, crashWin);
else
fs.watchFile(watch, { persistent: true, interval: poll_interval }, crashOther);
if (verbose)
util.debug("watching file '" + watch + "'");
}
var findAllWatchFiles = function(dir, callback) {
dir = path.resolve(dir);
if (ignoredPaths[dir])
return;
fs.stat(dir, function(err, stats){
if (err) {
util.error('Error retrieving stats for file: ' + dir);
} else {
if (stats.isDirectory()) {
if (isWindowsWithoutWatchFile) callback(dir);
fs.readdir(dir, function(err, fileNames) {
if(err) {
util.error('Error reading path: ' + dir);
}
else {
fileNames.forEach(function (fileName) {
findAllWatchFiles(path.join(dir, fileName), callback);
});
}
});
} else {
if (!isWindowsWithoutWatchFile && dir.match(fileExtensionPattern)) {
callback(dir);
}
}
}
});
};

118
node_modules/supervisor/package.json generated vendored Normal file
View File

@ -0,0 +1,118 @@
{
"name": "supervisor",
"version": "0.5.3",
"description": "A supervisor program for running nodejs programs",
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me"
},
"contributors": [
{
"name": "Todd Branchflower",
"email": "toddbran@stanford.edu"
},
{
"name": "Giannis Dzegoutanis",
"email": "erasmospunk@gmail.com"
},
{
"name": "Brian Ehmann",
"email": "behmann@gmail.com"
},
{
"name": "Corey Jewett",
"email": "cj@syntheticplayground.com"
},
{
"name": "Taka Kojima",
"email": "taka.kojima@ff0000.com"
},
{
"name": "Aneil Mallavarapu",
"email": "aneil@blipboard.com"
},
{
"name": "David Murdoch",
"email": "hello@davidmurdoch.com"
},
{
"name": "Michiel ter Reehorst",
"email": "jm.ter.reehorst@jamiter.com"
},
{
"name": "Jonathan 'Wolf' Rentzsch",
"email": "jwr.git@redshed.net"
},
{
"name": "John Roberts",
"email": "jroberts@logitech.com"
},
{
"name": "Scott Sanders",
"email": "scott@stonecobra.com"
},
{
"name": "Fernando H. Silva",
"email": "ferhensil@gmail.com"
},
{
"name": "Kei Son",
"email": "heyacct@gmail.com"
},
{
"name": "David Taylor",
"email": "david@zensatellite.com"
},
{
"name": "Antonio Touriño",
"email": "atourino@gmail.com"
},
{
"name": "Oliver Wong",
"email": "oliver@owiber.com"
},
{
"name": "Di Wu",
"email": "dw323@cornell.edu"
},
{
"name": "Jesse Yang",
"email": "jyyjcc@gmail.com"
},
{
"name": "Ian Young",
"email": "ian.greenleaf@gmail.com"
},
{
"name": "jazzzz",
"email": "jazzzz@gmail.com"
},
{
"name": "rma4ok",
"email": "rma4ok@gmail.com"
}
],
"repository": {
"type": "git",
"url": "git://github.com/isaacs/node-supervisor.git"
},
"bugs": "https://github.com/isaacs/node-supervisor/issues",
"homepage": "https://github.com/isaacs/node-supervisor/",
"main": "lib/supervisor.js",
"bin": {
"node-supervisor": "lib/cli-wrapper.js",
"supervisor": "lib/cli-wrapper.js"
},
"engines": {
"node": ">=0.3.7"
},
"preferGlobal": true,
"readme": "# node-supervisor\n\nA little supervisor script for nodejs. It runs your program, and\nwatches for code changes, so you can have hot-code reloading-ish\nbehavior, without worrying about memory leaks and making sure you\nclean up all the inter-module references, and without a whole new\n`require` system.\n\n## node-supervisor -?\n\n\n Node Supervisor is used to restart programs when they crash.\n It can also be used to restart programs when a *.js file changes.\n\n Usage:\n supervisor [options] <program>\n supervisor [options] -- <program> [args ...]\n\n Required:\n <program>\n The program to run.\n\n Options:\n -w|--watch <watchItems>\n A comma-delimited list of folders or js files to watch for changes.\n When a change to a js file occurs, reload the program\n Default is '.'\n\n -i|--ignore <ignoreItems>\n A comma-delimited list of folders to ignore for changes.\n No default\n\n -p|--poll-interval <milliseconds>\n How often to poll watched files for changes.\n Defaults to Node default.\n\n -e|--extensions <extensions>\n Specific file extensions to watch in addition to defaults.\n Used when --watch option includes folders\n Default is 'node|js'\n\n -x|--exec <executable>\n The executable that runs the specified program.\n Default is 'node'\n\n --debug\n Start node with --debug flag.\n\n --debug-brk\n Start node with --debug-brk flag.\n\n -n|--no-restart-on error|exit\n Don't automatically restart the supervised program if it ends.\n Supervisor will wait for a change in the source files.\n If \"error\", an exit code of 0 will still restart.\n If \"exit\", no restart regardless of exit code.\n\n -h|--help|-?\n Display these usage instructions.\n\n -q|--quiet\n Suppress DEBUG messages\n\n Examples:\n supervisor myapp.js\n supervisor myapp.coffee\n supervisor -w scripts -e myext -x myrunner myapp\n supervisor -w lib,server.js,config.js server.js\n supervisor -- server.js -h host -p port\n\n\n## Simple Install\n\nInstall npm, and then do this:\n\n npm install supervisor -g\n\nYou don't even need to download or fork this repo at all.\n\n## Fancy Install\n\nGet this code, install npm, and then do this:\n\n npm link\n\n## todo\n\n1. Re-attach to a process by pid. If the supervisor is\nbackgrounded, and then disowned, the child will keep running. At\nthat point, the supervisor may be killed, but the child will keep\non running. It'd be nice to have two supervisors that kept each\nother up, and could also perhaps run a child program.\n2. Run more types of programs than just \"node blargh.js\".\n3. Be able to run more than one program, so that you can have two\nsupervisors supervise each other, and then also keep some child\nserver up.\n4. When watching, it'd be good to perhaps bring up a new child\nand then kill the old one gently, rather than just crashing the\nchild abruptly.\n5. Keep the pid in a safe place, so another supervisor can pull\nit out if told to supervise the same program.\n6. It'd be pretty cool if this program could be run just like\ndoing `node blah.js`, but could somehow \"know\" which files had\nbeen loaded, and restart whenever a touched file changes.\n",
"readmeFilename": "README.md",
"_id": "supervisor@0.5.3",
"dist": {
"shasum": "a38c50574cedb35bbf3e3c12801b8139c41582d2"
},
"_from": "supervisor@",
"_resolved": "https://registry.npmjs.org/supervisor/-/supervisor-0.5.3.tgz"
}