Added game info bar
This commit is contained in:
parent
811ecfddfb
commit
95741499fd
22
index.js
22
index.js
@ -6,6 +6,12 @@ const io = require('socket.io')(http);
|
||||
const http_port = process.env.PORT || 61813;
|
||||
const net = require('net');
|
||||
const input_port = 1337;
|
||||
const myip = require('quick-local-ip');
|
||||
const ip4 = myip.getLocalIP4();
|
||||
const ip6 = myip.getLocalIP6();
|
||||
|
||||
console.log(ip4);
|
||||
console.log(ip6);
|
||||
|
||||
// define canvas
|
||||
var canvas_size_x = 100;
|
||||
@ -75,13 +81,26 @@ app.use(express.static(__dirname + '/public'));
|
||||
// output socket
|
||||
io.on('connection', function (socket){
|
||||
console.log("[HTTP] new connection");
|
||||
socket.emit('setting', {canvas: {size: {x: canvas_size_x, y: canvas_size_y}}});
|
||||
socket.emit('setting', {
|
||||
canvas: {
|
||||
size: {
|
||||
x: canvas_size_x,
|
||||
y: canvas_size_y
|
||||
}
|
||||
},
|
||||
network: {
|
||||
ip4: ip4,
|
||||
ip6: ip6,
|
||||
port: input_port
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// input socket
|
||||
var server = net.createServer();
|
||||
|
||||
server.on('connection', function (server_socket) {
|
||||
console.log(server_socket);
|
||||
conn_count++;
|
||||
server_socket.setEncoding('utf8');
|
||||
console.log('[INPUT] new input');
|
||||
@ -117,7 +136,6 @@ server.on('connection', function (server_socket) {
|
||||
server_socket.write('STATS px:' + pixel_count_flat + ' conn:' + conn_count_flat + '\n');
|
||||
}
|
||||
});
|
||||
|
||||
server_socket.on('close', function() {
|
||||
conn_count--;
|
||||
});
|
||||
|
1
node_modules/.bin/_mocha
generated
vendored
Symbolic link
1
node_modules/.bin/_mocha
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../mocha/bin/_mocha
|
1
node_modules/.bin/jade
generated
vendored
Symbolic link
1
node_modules/.bin/jade
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../jade/bin/jade
|
1
node_modules/.bin/mkdirp
generated
vendored
Symbolic link
1
node_modules/.bin/mkdirp
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../mkdirp/bin/cmd.js
|
1
node_modules/.bin/mocha
generated
vendored
Symbolic link
1
node_modules/.bin/mocha
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../mocha/bin/mocha
|
1
node_modules/.bin/supports-color
generated
vendored
Symbolic link
1
node_modules/.bin/supports-color
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../supports-color/cli.js
|
208
node_modules/commander/Readme.md
generated
vendored
Normal file
208
node_modules/commander/Readme.md
generated
vendored
Normal file
@ -0,0 +1,208 @@
|
||||
# Commander.js
|
||||
|
||||
The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/visionmedia/commander).
|
||||
|
||||
[![Build Status](https://api.travis-ci.org/visionmedia/commander.js.svg)](http://travis-ci.org/visionmedia/commander.js)
|
||||
|
||||
## Installation
|
||||
|
||||
$ npm install commander
|
||||
|
||||
## Option parsing
|
||||
|
||||
Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options.
|
||||
|
||||
```js
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var program = require('commander');
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-p, --peppers', 'Add peppers')
|
||||
.option('-P, --pineapple', 'Add pineapple')
|
||||
.option('-b, --bbq', 'Add bbq sauce')
|
||||
.option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')
|
||||
.parse(process.argv);
|
||||
|
||||
console.log('you ordered a pizza with:');
|
||||
if (program.peppers) console.log(' - peppers');
|
||||
if (program.pineapple) console.log(' - pineapple');
|
||||
if (program.bbq) console.log(' - bbq');
|
||||
console.log(' - %s cheese', program.cheese);
|
||||
```
|
||||
|
||||
Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc.
|
||||
|
||||
## Automated --help
|
||||
|
||||
The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free:
|
||||
|
||||
```
|
||||
$ ./examples/pizza --help
|
||||
|
||||
Usage: pizza [options]
|
||||
|
||||
Options:
|
||||
|
||||
-V, --version output the version number
|
||||
-p, --peppers Add peppers
|
||||
-P, --pineapple Add pineapple
|
||||
-b, --bbq Add bbq sauce
|
||||
-c, --cheese <type> Add the specified type of cheese [marble]
|
||||
-h, --help output usage information
|
||||
|
||||
```
|
||||
|
||||
## Coercion
|
||||
|
||||
```js
|
||||
function range(val) {
|
||||
return val.split('..').map(Number);
|
||||
}
|
||||
|
||||
function list(val) {
|
||||
return val.split(',');
|
||||
}
|
||||
|
||||
function collect(val, memo) {
|
||||
memo.push(val);
|
||||
return memo;
|
||||
}
|
||||
|
||||
function increaseVerbosity(v, total) {
|
||||
return total + 1;
|
||||
}
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.usage('[options] <file ...>')
|
||||
.option('-i, --integer <n>', 'An integer argument', parseInt)
|
||||
.option('-f, --float <n>', 'A float argument', parseFloat)
|
||||
.option('-r, --range <a>..<b>', 'A range', range)
|
||||
.option('-l, --list <items>', 'A list', list)
|
||||
.option('-o, --optional [value]', 'An optional value')
|
||||
.option('-c, --collect [value]', 'A repeatable value', collect, [])
|
||||
.option('-v, --verbose', 'A value that can be increased', increaseVerbosity, 0)
|
||||
.parse(process.argv);
|
||||
|
||||
console.log(' int: %j', program.integer);
|
||||
console.log(' float: %j', program.float);
|
||||
console.log(' optional: %j', program.optional);
|
||||
program.range = program.range || [];
|
||||
console.log(' range: %j..%j', program.range[0], program.range[1]);
|
||||
console.log(' list: %j', program.list);
|
||||
console.log(' collect: %j', program.collect);
|
||||
console.log(' verbosity: %j', program.verbose);
|
||||
console.log(' args: %j', program.args);
|
||||
```
|
||||
|
||||
## Custom help
|
||||
|
||||
You can display arbitrary `-h, --help` information
|
||||
by listening for "--help". Commander will automatically
|
||||
exit once you are done so that the remainder of your program
|
||||
does not execute causing undesired behaviours, for example
|
||||
in the following executable "stuff" will not output when
|
||||
`--help` is used.
|
||||
|
||||
```js
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var program = require('../');
|
||||
|
||||
function list(val) {
|
||||
return val.split(',').map(Number);
|
||||
}
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-f, --foo', 'enable some foo')
|
||||
.option('-b, --bar', 'enable some bar')
|
||||
.option('-B, --baz', 'enable some baz');
|
||||
|
||||
// must be before .parse() since
|
||||
// node's emit() is immediate
|
||||
|
||||
program.on('--help', function(){
|
||||
console.log(' Examples:');
|
||||
console.log('');
|
||||
console.log(' $ custom-help --help');
|
||||
console.log(' $ custom-help -h');
|
||||
console.log('');
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
||||
|
||||
console.log('stuff');
|
||||
```
|
||||
|
||||
yielding the following help output:
|
||||
|
||||
```
|
||||
|
||||
Usage: custom-help [options]
|
||||
|
||||
Options:
|
||||
|
||||
-h, --help output usage information
|
||||
-V, --version output the version number
|
||||
-f, --foo enable some foo
|
||||
-b, --bar enable some bar
|
||||
-B, --baz enable some baz
|
||||
|
||||
Examples:
|
||||
|
||||
$ custom-help --help
|
||||
$ custom-help -h
|
||||
|
||||
```
|
||||
|
||||
## .outputHelp()
|
||||
|
||||
Output help information without exiting.
|
||||
|
||||
## .help()
|
||||
|
||||
Output help information and exit immediately.
|
||||
|
||||
## Links
|
||||
|
||||
- [API documentation](http://visionmedia.github.com/commander.js/)
|
||||
- [ascii tables](https://github.com/LearnBoost/cli-table)
|
||||
- [progress bars](https://github.com/visionmedia/node-progress)
|
||||
- [more progress bars](https://github.com/substack/node-multimeter)
|
||||
- [examples](https://github.com/visionmedia/commander.js/tree/master/examples)
|
||||
|
||||
## License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>
|
||||
|
||||
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.
|
876
node_modules/commander/index.js
generated
vendored
Normal file
876
node_modules/commander/index.js
generated
vendored
Normal file
@ -0,0 +1,876 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
var spawn = require('child_process').spawn;
|
||||
var path = require('path');
|
||||
var dirname = path.dirname;
|
||||
var basename = path.basename;
|
||||
|
||||
/**
|
||||
* Expose the root command.
|
||||
*/
|
||||
|
||||
exports = module.exports = new Command;
|
||||
|
||||
/**
|
||||
* Expose `Command`.
|
||||
*/
|
||||
|
||||
exports.Command = Command;
|
||||
|
||||
/**
|
||||
* Expose `Option`.
|
||||
*/
|
||||
|
||||
exports.Option = Option;
|
||||
|
||||
/**
|
||||
* Initialize a new `Option` with the given `flags` and `description`.
|
||||
*
|
||||
* @param {String} flags
|
||||
* @param {String} description
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Option(flags, description) {
|
||||
this.flags = flags;
|
||||
this.required = ~flags.indexOf('<');
|
||||
this.optional = ~flags.indexOf('[');
|
||||
this.bool = !~flags.indexOf('-no-');
|
||||
flags = flags.split(/[ ,|]+/);
|
||||
if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift();
|
||||
this.long = flags.shift();
|
||||
this.description = description || '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Return option name.
|
||||
*
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Option.prototype.name = function(){
|
||||
return this.long
|
||||
.replace('--', '')
|
||||
.replace('no-', '');
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if `arg` matches the short or long flag.
|
||||
*
|
||||
* @param {String} arg
|
||||
* @return {Boolean}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Option.prototype.is = function(arg){
|
||||
return arg == this.short
|
||||
|| arg == this.long;
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialize a new `Command`.
|
||||
*
|
||||
* @param {String} name
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Command(name) {
|
||||
this.commands = [];
|
||||
this.options = [];
|
||||
this._execs = [];
|
||||
this._args = [];
|
||||
this._name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherit from `EventEmitter.prototype`.
|
||||
*/
|
||||
|
||||
Command.prototype.__proto__ = EventEmitter.prototype;
|
||||
|
||||
/**
|
||||
* Add command `name`.
|
||||
*
|
||||
* The `.action()` callback is invoked when the
|
||||
* command `name` is specified via __ARGV__,
|
||||
* and the remaining arguments are applied to the
|
||||
* function for access.
|
||||
*
|
||||
* When the `name` is "*" an un-matched command
|
||||
* will be passed as the first arg, followed by
|
||||
* the rest of __ARGV__ remaining.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* program
|
||||
* .version('0.0.1')
|
||||
* .option('-C, --chdir <path>', 'change the working directory')
|
||||
* .option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')
|
||||
* .option('-T, --no-tests', 'ignore test hook')
|
||||
*
|
||||
* program
|
||||
* .command('setup')
|
||||
* .description('run remote setup commands')
|
||||
* .action(function(){
|
||||
* console.log('setup');
|
||||
* });
|
||||
*
|
||||
* program
|
||||
* .command('exec <cmd>')
|
||||
* .description('run the given remote command')
|
||||
* .action(function(cmd){
|
||||
* console.log('exec "%s"', cmd);
|
||||
* });
|
||||
*
|
||||
* program
|
||||
* .command('*')
|
||||
* .description('deploy the given env')
|
||||
* .action(function(env){
|
||||
* console.log('deploying "%s"', env);
|
||||
* });
|
||||
*
|
||||
* program.parse(process.argv);
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {String} [desc]
|
||||
* @return {Command} the new command
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.command = function(name, desc) {
|
||||
var args = name.split(/ +/);
|
||||
var cmd = new Command(args.shift());
|
||||
if (desc) cmd.description(desc);
|
||||
if (desc) this.executables = true;
|
||||
if (desc) this._execs[cmd._name] = true;
|
||||
this.commands.push(cmd);
|
||||
cmd.parseExpectedArgs(args);
|
||||
cmd.parent = this;
|
||||
if (desc) return this;
|
||||
return cmd;
|
||||
};
|
||||
|
||||
/**
|
||||
* Add an implicit `help [cmd]` subcommand
|
||||
* which invokes `--help` for the given command.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.addImplicitHelpCommand = function() {
|
||||
this.command('help [cmd]', 'display help for [cmd]');
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse expected `args`.
|
||||
*
|
||||
* For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`.
|
||||
*
|
||||
* @param {Array} args
|
||||
* @return {Command} for chaining
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.parseExpectedArgs = function(args){
|
||||
if (!args.length) return;
|
||||
var self = this;
|
||||
args.forEach(function(arg){
|
||||
switch (arg[0]) {
|
||||
case '<':
|
||||
self._args.push({ required: true, name: arg.slice(1, -1) });
|
||||
break;
|
||||
case '[':
|
||||
self._args.push({ required: false, name: arg.slice(1, -1) });
|
||||
break;
|
||||
}
|
||||
});
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Register callback `fn` for the command.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* program
|
||||
* .command('help')
|
||||
* .description('display verbose help')
|
||||
* .action(function(){
|
||||
* // output help here
|
||||
* });
|
||||
*
|
||||
* @param {Function} fn
|
||||
* @return {Command} for chaining
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.action = function(fn){
|
||||
var self = this;
|
||||
var listener = function(args, unknown){
|
||||
// Parse any so-far unknown options
|
||||
args = args || [];
|
||||
unknown = unknown || [];
|
||||
|
||||
var parsed = self.parseOptions(unknown);
|
||||
|
||||
// Output help if necessary
|
||||
outputHelpIfNecessary(self, parsed.unknown);
|
||||
|
||||
// If there are still any unknown options, then we simply
|
||||
// die, unless someone asked for help, in which case we give it
|
||||
// to them, and then we die.
|
||||
if (parsed.unknown.length > 0) {
|
||||
self.unknownOption(parsed.unknown[0]);
|
||||
}
|
||||
|
||||
// Leftover arguments need to be pushed back. Fixes issue #56
|
||||
if (parsed.args.length) args = parsed.args.concat(args);
|
||||
|
||||
self._args.forEach(function(arg, i){
|
||||
if (arg.required && null == args[i]) {
|
||||
self.missingArgument(arg.name);
|
||||
}
|
||||
});
|
||||
|
||||
// Always append ourselves to the end of the arguments,
|
||||
// to make sure we match the number of arguments the user
|
||||
// expects
|
||||
if (self._args.length) {
|
||||
args[self._args.length] = self;
|
||||
} else {
|
||||
args.push(self);
|
||||
}
|
||||
|
||||
fn.apply(this, args);
|
||||
};
|
||||
this.parent.on(this._name, listener);
|
||||
if (this._alias) this.parent.on(this._alias, listener);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Define option with `flags`, `description` and optional
|
||||
* coercion `fn`.
|
||||
*
|
||||
* The `flags` string should contain both the short and long flags,
|
||||
* separated by comma, a pipe or space. The following are all valid
|
||||
* all will output this way when `--help` is used.
|
||||
*
|
||||
* "-p, --pepper"
|
||||
* "-p|--pepper"
|
||||
* "-p --pepper"
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* // simple boolean defaulting to false
|
||||
* program.option('-p, --pepper', 'add pepper');
|
||||
*
|
||||
* --pepper
|
||||
* program.pepper
|
||||
* // => Boolean
|
||||
*
|
||||
* // simple boolean defaulting to true
|
||||
* program.option('-C, --no-cheese', 'remove cheese');
|
||||
*
|
||||
* program.cheese
|
||||
* // => true
|
||||
*
|
||||
* --no-cheese
|
||||
* program.cheese
|
||||
* // => false
|
||||
*
|
||||
* // required argument
|
||||
* program.option('-C, --chdir <path>', 'change the working directory');
|
||||
*
|
||||
* --chdir /tmp
|
||||
* program.chdir
|
||||
* // => "/tmp"
|
||||
*
|
||||
* // optional argument
|
||||
* program.option('-c, --cheese [type]', 'add cheese [marble]');
|
||||
*
|
||||
* @param {String} flags
|
||||
* @param {String} description
|
||||
* @param {Function|Mixed} fn or default
|
||||
* @param {Mixed} defaultValue
|
||||
* @return {Command} for chaining
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.option = function(flags, description, fn, defaultValue){
|
||||
var self = this
|
||||
, option = new Option(flags, description)
|
||||
, oname = option.name()
|
||||
, name = camelcase(oname);
|
||||
|
||||
// default as 3rd arg
|
||||
if ('function' != typeof fn) defaultValue = fn, fn = null;
|
||||
|
||||
// preassign default value only for --no-*, [optional], or <required>
|
||||
if (false == option.bool || option.optional || option.required) {
|
||||
// when --no-* we make sure default is true
|
||||
if (false == option.bool) defaultValue = true;
|
||||
// preassign only if we have a default
|
||||
if (undefined !== defaultValue) self[name] = defaultValue;
|
||||
}
|
||||
|
||||
// register the option
|
||||
this.options.push(option);
|
||||
|
||||
// when it's passed assign the value
|
||||
// and conditionally invoke the callback
|
||||
this.on(oname, function(val){
|
||||
// coercion
|
||||
if (null !== val && fn) val = fn(val, undefined === self[name] ? defaultValue : self[name]);
|
||||
|
||||
// unassigned or bool
|
||||
if ('boolean' == typeof self[name] || 'undefined' == typeof self[name]) {
|
||||
// if no value, bool true, and we have a default, then use it!
|
||||
if (null == val) {
|
||||
self[name] = option.bool
|
||||
? defaultValue || true
|
||||
: false;
|
||||
} else {
|
||||
self[name] = val;
|
||||
}
|
||||
} else if (null !== val) {
|
||||
// reassign
|
||||
self[name] = val;
|
||||
}
|
||||
});
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse `argv`, settings options and invoking commands when defined.
|
||||
*
|
||||
* @param {Array} argv
|
||||
* @return {Command} for chaining
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.parse = function(argv){
|
||||
// implicit help
|
||||
if (this.executables) this.addImplicitHelpCommand();
|
||||
|
||||
// store raw args
|
||||
this.rawArgs = argv;
|
||||
|
||||
// guess name
|
||||
this._name = this._name || basename(argv[1], '.js');
|
||||
|
||||
// process argv
|
||||
var parsed = this.parseOptions(this.normalize(argv.slice(2)));
|
||||
var args = this.args = parsed.args;
|
||||
|
||||
var result = this.parseArgs(this.args, parsed.unknown);
|
||||
|
||||
// executable sub-commands
|
||||
var name = result.args[0];
|
||||
if (this._execs[name]) return this.executeSubCommand(argv, args, parsed.unknown);
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* Execute a sub-command executable.
|
||||
*
|
||||
* @param {Array} argv
|
||||
* @param {Array} args
|
||||
* @param {Array} unknown
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.executeSubCommand = function(argv, args, unknown) {
|
||||
args = args.concat(unknown);
|
||||
|
||||
if (!args.length) this.help();
|
||||
if ('help' == args[0] && 1 == args.length) this.help();
|
||||
|
||||
// <cmd> --help
|
||||
if ('help' == args[0]) {
|
||||
args[0] = args[1];
|
||||
args[1] = '--help';
|
||||
}
|
||||
|
||||
// executable
|
||||
var dir = dirname(argv[1]);
|
||||
var bin = basename(argv[1], '.js') + '-' + args[0];
|
||||
|
||||
// check for ./<bin> first
|
||||
var local = path.join(dir, bin);
|
||||
|
||||
// run it
|
||||
args = args.slice(1);
|
||||
args.unshift(local);
|
||||
var proc = spawn('node', args, { stdio: 'inherit', customFds: [0, 1, 2] });
|
||||
proc.on('error', function(err){
|
||||
if (err.code == "ENOENT") {
|
||||
console.error('\n %s(1) does not exist, try --help\n', bin);
|
||||
} else if (err.code == "EACCES") {
|
||||
console.error('\n %s(1) not executable. try chmod or run with root\n', bin);
|
||||
}
|
||||
});
|
||||
|
||||
this.runningCommand = proc;
|
||||
};
|
||||
|
||||
/**
|
||||
* Normalize `args`, splitting joined short flags. For example
|
||||
* the arg "-abc" is equivalent to "-a -b -c".
|
||||
* This also normalizes equal sign and splits "--abc=def" into "--abc def".
|
||||
*
|
||||
* @param {Array} args
|
||||
* @return {Array}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.normalize = function(args){
|
||||
var ret = []
|
||||
, arg
|
||||
, lastOpt
|
||||
, index;
|
||||
|
||||
for (var i = 0, len = args.length; i < len; ++i) {
|
||||
arg = args[i];
|
||||
i > 0 && (lastOpt = this.optionFor(args[i-1]));
|
||||
|
||||
if (lastOpt && lastOpt.required) {
|
||||
ret.push(arg);
|
||||
} else if (arg.length > 1 && '-' == arg[0] && '-' != arg[1]) {
|
||||
arg.slice(1).split('').forEach(function(c){
|
||||
ret.push('-' + c);
|
||||
});
|
||||
} else if (/^--/.test(arg) && ~(index = arg.indexOf('='))) {
|
||||
ret.push(arg.slice(0, index), arg.slice(index + 1));
|
||||
} else {
|
||||
ret.push(arg);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse command `args`.
|
||||
*
|
||||
* When listener(s) are available those
|
||||
* callbacks are invoked, otherwise the "*"
|
||||
* event is emitted and those actions are invoked.
|
||||
*
|
||||
* @param {Array} args
|
||||
* @return {Command} for chaining
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.parseArgs = function(args, unknown){
|
||||
var cmds = this.commands
|
||||
, len = cmds.length
|
||||
, name;
|
||||
|
||||
if (args.length) {
|
||||
name = args[0];
|
||||
if (this.listeners(name).length) {
|
||||
this.emit(args.shift(), args, unknown);
|
||||
} else {
|
||||
this.emit('*', args);
|
||||
}
|
||||
} else {
|
||||
outputHelpIfNecessary(this, unknown);
|
||||
|
||||
// If there were no args and we have unknown options,
|
||||
// then they are extraneous and we need to error.
|
||||
if (unknown.length > 0) {
|
||||
this.unknownOption(unknown[0]);
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return an option matching `arg` if any.
|
||||
*
|
||||
* @param {String} arg
|
||||
* @return {Option}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.optionFor = function(arg){
|
||||
for (var i = 0, len = this.options.length; i < len; ++i) {
|
||||
if (this.options[i].is(arg)) {
|
||||
return this.options[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse options from `argv` returning `argv`
|
||||
* void of these options.
|
||||
*
|
||||
* @param {Array} argv
|
||||
* @return {Array}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.parseOptions = function(argv){
|
||||
var args = []
|
||||
, len = argv.length
|
||||
, literal
|
||||
, option
|
||||
, arg;
|
||||
|
||||
var unknownOptions = [];
|
||||
|
||||
// parse options
|
||||
for (var i = 0; i < len; ++i) {
|
||||
arg = argv[i];
|
||||
|
||||
// literal args after --
|
||||
if ('--' == arg) {
|
||||
literal = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (literal) {
|
||||
args.push(arg);
|
||||
continue;
|
||||
}
|
||||
|
||||
// find matching Option
|
||||
option = this.optionFor(arg);
|
||||
|
||||
// option is defined
|
||||
if (option) {
|
||||
// requires arg
|
||||
if (option.required) {
|
||||
arg = argv[++i];
|
||||
if (null == arg) return this.optionMissingArgument(option);
|
||||
this.emit(option.name(), arg);
|
||||
// optional arg
|
||||
} else if (option.optional) {
|
||||
arg = argv[i+1];
|
||||
if (null == arg || ('-' == arg[0] && '-' != arg)) {
|
||||
arg = null;
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
this.emit(option.name(), arg);
|
||||
// bool
|
||||
} else {
|
||||
this.emit(option.name());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// looks like an option
|
||||
if (arg.length > 1 && '-' == arg[0]) {
|
||||
unknownOptions.push(arg);
|
||||
|
||||
// If the next argument looks like it might be
|
||||
// an argument for this option, we pass it on.
|
||||
// If it isn't, then it'll simply be ignored
|
||||
if (argv[i+1] && '-' != argv[i+1][0]) {
|
||||
unknownOptions.push(argv[++i]);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// arg
|
||||
args.push(arg);
|
||||
}
|
||||
|
||||
return { args: args, unknown: unknownOptions };
|
||||
};
|
||||
|
||||
/**
|
||||
* Argument `name` is missing.
|
||||
*
|
||||
* @param {String} name
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.missingArgument = function(name){
|
||||
console.error();
|
||||
console.error(" error: missing required argument `%s'", name);
|
||||
console.error();
|
||||
process.exit(1);
|
||||
};
|
||||
|
||||
/**
|
||||
* `Option` is missing an argument, but received `flag` or nothing.
|
||||
*
|
||||
* @param {String} option
|
||||
* @param {String} flag
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.optionMissingArgument = function(option, flag){
|
||||
console.error();
|
||||
if (flag) {
|
||||
console.error(" error: option `%s' argument missing, got `%s'", option.flags, flag);
|
||||
} else {
|
||||
console.error(" error: option `%s' argument missing", option.flags);
|
||||
}
|
||||
console.error();
|
||||
process.exit(1);
|
||||
};
|
||||
|
||||
/**
|
||||
* Unknown option `flag`.
|
||||
*
|
||||
* @param {String} flag
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.unknownOption = function(flag){
|
||||
console.error();
|
||||
console.error(" error: unknown option `%s'", flag);
|
||||
console.error();
|
||||
process.exit(1);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Set the program version to `str`.
|
||||
*
|
||||
* This method auto-registers the "-V, --version" flag
|
||||
* which will print the version number when passed.
|
||||
*
|
||||
* @param {String} str
|
||||
* @param {String} flags
|
||||
* @return {Command} for chaining
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.version = function(str, flags){
|
||||
if (0 == arguments.length) return this._version;
|
||||
this._version = str;
|
||||
flags = flags || '-V, --version';
|
||||
this.option(flags, 'output the version number');
|
||||
this.on('version', function(){
|
||||
console.log(str);
|
||||
process.exit(0);
|
||||
});
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the description `str`.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {String|Command}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.description = function(str){
|
||||
if (0 == arguments.length) return this._description;
|
||||
this._description = str;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set an alias for the command
|
||||
*
|
||||
* @param {String} alias
|
||||
* @return {String|Command}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.alias = function(alias){
|
||||
if (0 == arguments.length) return this._alias;
|
||||
this._alias = alias;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set / get the command usage `str`.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {String|Command}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.usage = function(str){
|
||||
var args = this._args.map(function(arg){
|
||||
return arg.required
|
||||
? '<' + arg.name + '>'
|
||||
: '[' + arg.name + ']';
|
||||
});
|
||||
|
||||
var usage = '[options'
|
||||
+ (this.commands.length ? '] [command' : '')
|
||||
+ ']'
|
||||
+ (this._args.length ? ' ' + args : '');
|
||||
|
||||
if (0 == arguments.length) return this._usage || usage;
|
||||
this._usage = str;
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the largest option length.
|
||||
*
|
||||
* @return {Number}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.largestOptionLength = function(){
|
||||
return this.options.reduce(function(max, option){
|
||||
return Math.max(max, option.flags.length);
|
||||
}, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* Return help for options.
|
||||
*
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.optionHelp = function(){
|
||||
var width = this.largestOptionLength();
|
||||
|
||||
// Prepend the help information
|
||||
return [pad('-h, --help', width) + ' ' + 'output usage information']
|
||||
.concat(this.options.map(function(option){
|
||||
return pad(option.flags, width)
|
||||
+ ' ' + option.description;
|
||||
}))
|
||||
.join('\n');
|
||||
};
|
||||
|
||||
/**
|
||||
* Return command help documentation.
|
||||
*
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.commandHelp = function(){
|
||||
if (!this.commands.length) return '';
|
||||
return [
|
||||
''
|
||||
, ' Commands:'
|
||||
, ''
|
||||
, this.commands.map(function(cmd){
|
||||
var args = cmd._args.map(function(arg){
|
||||
return arg.required
|
||||
? '<' + arg.name + '>'
|
||||
: '[' + arg.name + ']';
|
||||
}).join(' ');
|
||||
|
||||
return cmd._name
|
||||
+ (cmd._alias
|
||||
? '|' + cmd._alias
|
||||
: '')
|
||||
+ (cmd.options.length
|
||||
? ' [options]'
|
||||
: '') + ' ' + args
|
||||
+ (cmd.description()
|
||||
? '\n ' + cmd.description()
|
||||
: '')
|
||||
+ '\n';
|
||||
}).join('\n').replace(/^/gm, ' ')
|
||||
, ''
|
||||
].join('\n');
|
||||
};
|
||||
|
||||
/**
|
||||
* Return program help documentation.
|
||||
*
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Command.prototype.helpInformation = function(){
|
||||
return [
|
||||
''
|
||||
, ' Usage: ' + this._name
|
||||
+ (this._alias
|
||||
? '|' + this._alias
|
||||
: '')
|
||||
+ ' ' + this.usage()
|
||||
, '' + this.commandHelp()
|
||||
, ' Options:'
|
||||
, ''
|
||||
, '' + this.optionHelp().replace(/^/gm, ' ')
|
||||
, ''
|
||||
, ''
|
||||
].join('\n');
|
||||
};
|
||||
|
||||
/**
|
||||
* Output help information for this command
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.outputHelp = function(){
|
||||
process.stdout.write(this.helpInformation());
|
||||
this.emit('--help');
|
||||
};
|
||||
|
||||
/**
|
||||
* Output help information and exit.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Command.prototype.help = function(){
|
||||
this.outputHelp();
|
||||
process.exit();
|
||||
};
|
||||
|
||||
/**
|
||||
* Camel-case the given `flag`
|
||||
*
|
||||
* @param {String} flag
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function camelcase(flag) {
|
||||
return flag.split('-').reduce(function(str, word){
|
||||
return str + word[0].toUpperCase() + word.slice(1);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Pad `str` to `width`.
|
||||
*
|
||||
* @param {String} str
|
||||
* @param {Number} width
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function pad(str, width) {
|
||||
var len = Math.max(0, width - str.length);
|
||||
return str + Array(len + 1).join(' ');
|
||||
}
|
||||
|
||||
/**
|
||||
* Output help information if necessary
|
||||
*
|
||||
* @param {Command} command to output help for
|
||||
* @param {Array} array of options to search for -h or --help
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function outputHelpIfNecessary(cmd, options) {
|
||||
options = options || [];
|
||||
for (var i = 0; i < options.length; i++) {
|
||||
if (options[i] == '--help' || options[i] == '-h') {
|
||||
cmd.outputHelp();
|
||||
process.exit(0);
|
||||
}
|
||||
}
|
||||
}
|
62
node_modules/commander/package.json
generated
vendored
Normal file
62
node_modules/commander/package.json
generated
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
{
|
||||
"_from": "commander@2.3.0",
|
||||
"_id": "commander@2.3.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-/UMOiJgy7DU7ms0d4hfBHLPu+HM=",
|
||||
"_location": "/commander",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "commander@2.3.0",
|
||||
"name": "commander",
|
||||
"escapedName": "commander",
|
||||
"rawSpec": "2.3.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "2.3.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/mocha"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/commander/-/commander-2.3.0.tgz",
|
||||
"_shasum": "fd430e889832ec353b9acd1de217c11cb3eef873",
|
||||
"_spec": "commander@2.3.0",
|
||||
"_where": "/home/clemens/Dokumente/git/pixelnode/node_modules/mocha",
|
||||
"author": {
|
||||
"name": "TJ Holowaychuk",
|
||||
"email": "tj@vision-media.ca"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/visionmedia/commander.js/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "the complete solution for node.js command-line programs",
|
||||
"devDependencies": {
|
||||
"should": ">= 0.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6.x"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/visionmedia/commander.js#readme",
|
||||
"keywords": [
|
||||
"command",
|
||||
"option",
|
||||
"parser",
|
||||
"prompt",
|
||||
"stdin"
|
||||
],
|
||||
"main": "index",
|
||||
"name": "commander",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/visionmedia/commander.js.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "make test"
|
||||
},
|
||||
"version": "2.3.0"
|
||||
}
|
181
node_modules/diff/README.md
generated
vendored
Normal file
181
node_modules/diff/README.md
generated
vendored
Normal file
@ -0,0 +1,181 @@
|
||||
# jsdiff
|
||||
|
||||
[![Build Status](https://secure.travis-ci.org/kpdecker/jsdiff.png)](http://travis-ci.org/kpdecker/jsdiff)
|
||||
|
||||
A javascript text differencing implementation.
|
||||
|
||||
Based on the algorithm proposed in
|
||||
["An O(ND) Difference Algorithm and its Variations" (Myers, 1986)](http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927).
|
||||
|
||||
## Installation
|
||||
|
||||
npm install diff
|
||||
|
||||
or
|
||||
|
||||
bower install jsdiff
|
||||
|
||||
or
|
||||
|
||||
git clone git://github.com/kpdecker/jsdiff.git
|
||||
|
||||
## API
|
||||
|
||||
* `JsDiff.diffChars(oldStr, newStr[, callback])` - diffs two blocks of text, comparing character by character.
|
||||
|
||||
Returns a list of change objects (See below).
|
||||
|
||||
* `JsDiff.diffWords(oldStr, newStr[, callback])` - diffs two blocks of text, comparing word by word, ignoring whitespace.
|
||||
|
||||
Returns a list of change objects (See below).
|
||||
|
||||
* `JsDiff.diffWordsWithSpace(oldStr, newStr[, callback])` - diffs two blocks of text, comparing word by word, treating whitespace as significant.
|
||||
|
||||
Returns a list of change objects (See below).
|
||||
|
||||
* `JsDiff.diffLines(oldStr, newStr[, callback])` - diffs two blocks of text, comparing line by line.
|
||||
|
||||
Returns a list of change objects (See below).
|
||||
|
||||
* `JsDiff.diffTrimmedLines(oldStr, newStr[, callback])` - diffs two blocks of text, comparing line by line, ignoring leading and trailing whitespace.
|
||||
|
||||
Returns a list of change objects (See below).
|
||||
|
||||
* `JsDiff.diffSentences(oldStr, newStr[, callback])` - diffs two blocks of text, comparing sentence by sentence.
|
||||
|
||||
Returns a list of change objects (See below).
|
||||
|
||||
* `JsDiff.diffCss(oldStr, newStr[, callback])` - diffs two blocks of text, comparing CSS tokens.
|
||||
|
||||
Returns a list of change objects (See below).
|
||||
|
||||
* `JsDiff.diffJson(oldObj, newObj[, callback])` - diffs two JSON objects, comparing the fields defined on each. The order of fields, etc does not matter in this comparison.
|
||||
|
||||
Returns a list of change objects (See below).
|
||||
|
||||
* `JsDiff.createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader)` - creates a unified diff patch.
|
||||
|
||||
Parameters:
|
||||
* `oldFileName` : String to be output in the filename section of the patch for the removals
|
||||
* `newFileName` : String to be output in the filename section of the patch for the additions
|
||||
* `oldStr` : Original string value
|
||||
* `newStr` : New string value
|
||||
* `oldHeader` : Additional information to include in the old file header
|
||||
* `newHeader` : Additional information to include in thew new file header
|
||||
|
||||
* `JsDiff.createPatch(fileName, oldStr, newStr, oldHeader, newHeader)` - creates a unified diff patch.
|
||||
|
||||
Just like JsDiff.createTwoFilesPatch, but with oldFileName being equal to newFileName.
|
||||
|
||||
* `JsDiff.applyPatch(oldStr, diffStr)` - applies a unified diff patch.
|
||||
|
||||
Return a string containing new version of provided data.
|
||||
|
||||
* `convertChangesToXML(changes)` - converts a list of changes to a serialized XML format
|
||||
|
||||
|
||||
All methods above which accept the optional callback method will run in sync mode when that parameter is omitted and in async mode when supplied. This allows for larger diffs without blocking the event loop.
|
||||
|
||||
### Change Objects
|
||||
Many of the methods above return change objects. These objects are consist of the following fields:
|
||||
|
||||
* `value`: Text content
|
||||
* `added`: True if the value was inserted into the new string
|
||||
* `removed`: True of the value was removed from the old string
|
||||
|
||||
Note that some cases may omit a particular flag field. Comparison on the flag fields should always be done in a truthy or falsy manner.
|
||||
|
||||
## Examples
|
||||
|
||||
Basic example in Node
|
||||
|
||||
```js
|
||||
require('colors')
|
||||
var jsdiff = require('diff');
|
||||
|
||||
var one = 'beep boop';
|
||||
var other = 'beep boob blah';
|
||||
|
||||
var diff = jsdiff.diffChars(one, other);
|
||||
|
||||
diff.forEach(function(part){
|
||||
// green for additions, red for deletions
|
||||
// grey for common parts
|
||||
var color = part.added ? 'green' :
|
||||
part.removed ? 'red' : 'grey';
|
||||
process.stderr.write(part.value[color]);
|
||||
});
|
||||
|
||||
console.log()
|
||||
```
|
||||
Running the above program should yield
|
||||
|
||||
<img src="images/node_example.png" alt="Node Example">
|
||||
|
||||
Basic example in a web page
|
||||
|
||||
```html
|
||||
<pre id="display"></pre>
|
||||
<script src="diff.js"></script>
|
||||
<script>
|
||||
var one = 'beep boop';
|
||||
var other = 'beep boob blah';
|
||||
|
||||
var diff = JsDiff.diffChars(one, other);
|
||||
|
||||
diff.forEach(function(part){
|
||||
// green for additions, red for deletions
|
||||
// grey for common parts
|
||||
var color = part.added ? 'green' :
|
||||
part.removed ? 'red' : 'grey';
|
||||
var span = document.createElement('span');
|
||||
span.style.color = color;
|
||||
span.appendChild(document
|
||||
.createTextNode(part.value));
|
||||
display.appendChild(span);
|
||||
});
|
||||
</script>
|
||||
```
|
||||
|
||||
Open the above .html file in a browser and you should see
|
||||
|
||||
<img src="images/web_example.png" alt="Node Example">
|
||||
|
||||
**[Full online demo](http://kpdecker.github.com/jsdiff)**
|
||||
|
||||
## License
|
||||
|
||||
Software License Agreement (BSD License)
|
||||
|
||||
Copyright (c) 2009-2011, Kevin Decker kpdecker@gmail.com
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* 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.
|
||||
|
||||
* Neither the name of Kevin Decker nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
|
||||
|
||||
|
||||
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/kpdecker/jsdiff/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
|
619
node_modules/diff/diff.js
generated
vendored
Normal file
619
node_modules/diff/diff.js
generated
vendored
Normal file
@ -0,0 +1,619 @@
|
||||
/* See LICENSE file for terms of use */
|
||||
|
||||
/*
|
||||
* Text diff implementation.
|
||||
*
|
||||
* This library supports the following APIS:
|
||||
* JsDiff.diffChars: Character by character diff
|
||||
* JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace
|
||||
* JsDiff.diffLines: Line based diff
|
||||
*
|
||||
* JsDiff.diffCss: Diff targeted at CSS content
|
||||
*
|
||||
* These methods are based on the implementation proposed in
|
||||
* "An O(ND) Difference Algorithm and its Variations" (Myers, 1986).
|
||||
* http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927
|
||||
*/
|
||||
(function(global, undefined) {
|
||||
var objectPrototypeToString = Object.prototype.toString;
|
||||
|
||||
/*istanbul ignore next*/
|
||||
function map(arr, mapper, that) {
|
||||
if (Array.prototype.map) {
|
||||
return Array.prototype.map.call(arr, mapper, that);
|
||||
}
|
||||
|
||||
var other = new Array(arr.length);
|
||||
|
||||
for (var i = 0, n = arr.length; i < n; i++) {
|
||||
other[i] = mapper.call(that, arr[i], i, arr);
|
||||
}
|
||||
return other;
|
||||
}
|
||||
function clonePath(path) {
|
||||
return { newPos: path.newPos, components: path.components.slice(0) };
|
||||
}
|
||||
function removeEmpty(array) {
|
||||
var ret = [];
|
||||
for (var i = 0; i < array.length; i++) {
|
||||
if (array[i]) {
|
||||
ret.push(array[i]);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
function escapeHTML(s) {
|
||||
var n = s;
|
||||
n = n.replace(/&/g, '&');
|
||||
n = n.replace(/</g, '<');
|
||||
n = n.replace(/>/g, '>');
|
||||
n = n.replace(/"/g, '"');
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
// This function handles the presence of circular references by bailing out when encountering an
|
||||
// object that is already on the "stack" of items being processed.
|
||||
function canonicalize(obj, stack, replacementStack) {
|
||||
stack = stack || [];
|
||||
replacementStack = replacementStack || [];
|
||||
|
||||
var i;
|
||||
|
||||
for (i = 0; i < stack.length; i += 1) {
|
||||
if (stack[i] === obj) {
|
||||
return replacementStack[i];
|
||||
}
|
||||
}
|
||||
|
||||
var canonicalizedObj;
|
||||
|
||||
if ('[object Array]' === objectPrototypeToString.call(obj)) {
|
||||
stack.push(obj);
|
||||
canonicalizedObj = new Array(obj.length);
|
||||
replacementStack.push(canonicalizedObj);
|
||||
for (i = 0; i < obj.length; i += 1) {
|
||||
canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack);
|
||||
}
|
||||
stack.pop();
|
||||
replacementStack.pop();
|
||||
} else if (typeof obj === 'object' && obj !== null) {
|
||||
stack.push(obj);
|
||||
canonicalizedObj = {};
|
||||
replacementStack.push(canonicalizedObj);
|
||||
var sortedKeys = [],
|
||||
key;
|
||||
for (key in obj) {
|
||||
sortedKeys.push(key);
|
||||
}
|
||||
sortedKeys.sort();
|
||||
for (i = 0; i < sortedKeys.length; i += 1) {
|
||||
key = sortedKeys[i];
|
||||
canonicalizedObj[key] = canonicalize(obj[key], stack, replacementStack);
|
||||
}
|
||||
stack.pop();
|
||||
replacementStack.pop();
|
||||
} else {
|
||||
canonicalizedObj = obj;
|
||||
}
|
||||
return canonicalizedObj;
|
||||
}
|
||||
|
||||
function buildValues(components, newString, oldString, useLongestToken) {
|
||||
var componentPos = 0,
|
||||
componentLen = components.length,
|
||||
newPos = 0,
|
||||
oldPos = 0;
|
||||
|
||||
for (; componentPos < componentLen; componentPos++) {
|
||||
var component = components[componentPos];
|
||||
if (!component.removed) {
|
||||
if (!component.added && useLongestToken) {
|
||||
var value = newString.slice(newPos, newPos + component.count);
|
||||
value = map(value, function(value, i) {
|
||||
var oldValue = oldString[oldPos + i];
|
||||
return oldValue.length > value.length ? oldValue : value;
|
||||
});
|
||||
|
||||
component.value = value.join('');
|
||||
} else {
|
||||
component.value = newString.slice(newPos, newPos + component.count).join('');
|
||||
}
|
||||
newPos += component.count;
|
||||
|
||||
// Common case
|
||||
if (!component.added) {
|
||||
oldPos += component.count;
|
||||
}
|
||||
} else {
|
||||
component.value = oldString.slice(oldPos, oldPos + component.count).join('');
|
||||
oldPos += component.count;
|
||||
|
||||
// Reverse add and remove so removes are output first to match common convention
|
||||
// The diffing algorithm is tied to add then remove output and this is the simplest
|
||||
// route to get the desired output with minimal overhead.
|
||||
if (componentPos && components[componentPos - 1].added) {
|
||||
var tmp = components[componentPos - 1];
|
||||
components[componentPos - 1] = components[componentPos];
|
||||
components[componentPos] = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return components;
|
||||
}
|
||||
|
||||
function Diff(ignoreWhitespace) {
|
||||
this.ignoreWhitespace = ignoreWhitespace;
|
||||
}
|
||||
Diff.prototype = {
|
||||
diff: function(oldString, newString, callback) {
|
||||
var self = this;
|
||||
|
||||
function done(value) {
|
||||
if (callback) {
|
||||
setTimeout(function() { callback(undefined, value); }, 0);
|
||||
return true;
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle the identity case (this is due to unrolling editLength == 0
|
||||
if (newString === oldString) {
|
||||
return done([{ value: newString }]);
|
||||
}
|
||||
if (!newString) {
|
||||
return done([{ value: oldString, removed: true }]);
|
||||
}
|
||||
if (!oldString) {
|
||||
return done([{ value: newString, added: true }]);
|
||||
}
|
||||
|
||||
newString = this.tokenize(newString);
|
||||
oldString = this.tokenize(oldString);
|
||||
|
||||
var newLen = newString.length, oldLen = oldString.length;
|
||||
var editLength = 1;
|
||||
var maxEditLength = newLen + oldLen;
|
||||
var bestPath = [{ newPos: -1, components: [] }];
|
||||
|
||||
// Seed editLength = 0, i.e. the content starts with the same values
|
||||
var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
|
||||
if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
|
||||
// Identity per the equality and tokenizer
|
||||
return done([{value: newString.join('')}]);
|
||||
}
|
||||
|
||||
// Main worker method. checks all permutations of a given edit length for acceptance.
|
||||
function execEditLength() {
|
||||
for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
|
||||
var basePath;
|
||||
var addPath = bestPath[diagonalPath - 1],
|
||||
removePath = bestPath[diagonalPath + 1],
|
||||
oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
|
||||
if (addPath) {
|
||||
// No one else is going to attempt to use this value, clear it
|
||||
bestPath[diagonalPath - 1] = undefined;
|
||||
}
|
||||
|
||||
var canAdd = addPath && addPath.newPos + 1 < newLen,
|
||||
canRemove = removePath && 0 <= oldPos && oldPos < oldLen;
|
||||
if (!canAdd && !canRemove) {
|
||||
// If this path is a terminal then prune
|
||||
bestPath[diagonalPath] = undefined;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Select the diagonal that we want to branch from. We select the prior
|
||||
// path whose position in the new string is the farthest from the origin
|
||||
// and does not pass the bounds of the diff graph
|
||||
if (!canAdd || (canRemove && addPath.newPos < removePath.newPos)) {
|
||||
basePath = clonePath(removePath);
|
||||
self.pushComponent(basePath.components, undefined, true);
|
||||
} else {
|
||||
basePath = addPath; // No need to clone, we've pulled it from the list
|
||||
basePath.newPos++;
|
||||
self.pushComponent(basePath.components, true, undefined);
|
||||
}
|
||||
|
||||
oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath);
|
||||
|
||||
// If we have hit the end of both strings, then we are done
|
||||
if (basePath.newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
|
||||
return done(buildValues(basePath.components, newString, oldString, self.useLongestToken));
|
||||
} else {
|
||||
// Otherwise track this path as a potential candidate and continue.
|
||||
bestPath[diagonalPath] = basePath;
|
||||
}
|
||||
}
|
||||
|
||||
editLength++;
|
||||
}
|
||||
|
||||
// Performs the length of edit iteration. Is a bit fugly as this has to support the
|
||||
// sync and async mode which is never fun. Loops over execEditLength until a value
|
||||
// is produced.
|
||||
if (callback) {
|
||||
(function exec() {
|
||||
setTimeout(function() {
|
||||
// This should not happen, but we want to be safe.
|
||||
/*istanbul ignore next */
|
||||
if (editLength > maxEditLength) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
if (!execEditLength()) {
|
||||
exec();
|
||||
}
|
||||
}, 0);
|
||||
}());
|
||||
} else {
|
||||
while (editLength <= maxEditLength) {
|
||||
var ret = execEditLength();
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
pushComponent: function(components, added, removed) {
|
||||
var last = components[components.length - 1];
|
||||
if (last && last.added === added && last.removed === removed) {
|
||||
// We need to clone here as the component clone operation is just
|
||||
// as shallow array clone
|
||||
components[components.length - 1] = {count: last.count + 1, added: added, removed: removed };
|
||||
} else {
|
||||
components.push({count: 1, added: added, removed: removed });
|
||||
}
|
||||
},
|
||||
extractCommon: function(basePath, newString, oldString, diagonalPath) {
|
||||
var newLen = newString.length,
|
||||
oldLen = oldString.length,
|
||||
newPos = basePath.newPos,
|
||||
oldPos = newPos - diagonalPath,
|
||||
|
||||
commonCount = 0;
|
||||
while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
|
||||
newPos++;
|
||||
oldPos++;
|
||||
commonCount++;
|
||||
}
|
||||
|
||||
if (commonCount) {
|
||||
basePath.components.push({count: commonCount});
|
||||
}
|
||||
|
||||
basePath.newPos = newPos;
|
||||
return oldPos;
|
||||
},
|
||||
|
||||
equals: function(left, right) {
|
||||
var reWhitespace = /\S/;
|
||||
return left === right || (this.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right));
|
||||
},
|
||||
tokenize: function(value) {
|
||||
return value.split('');
|
||||
}
|
||||
};
|
||||
|
||||
var CharDiff = new Diff();
|
||||
|
||||
var WordDiff = new Diff(true);
|
||||
var WordWithSpaceDiff = new Diff();
|
||||
WordDiff.tokenize = WordWithSpaceDiff.tokenize = function(value) {
|
||||
return removeEmpty(value.split(/(\s+|\b)/));
|
||||
};
|
||||
|
||||
var CssDiff = new Diff(true);
|
||||
CssDiff.tokenize = function(value) {
|
||||
return removeEmpty(value.split(/([{}:;,]|\s+)/));
|
||||
};
|
||||
|
||||
var LineDiff = new Diff();
|
||||
|
||||
var TrimmedLineDiff = new Diff();
|
||||
TrimmedLineDiff.ignoreTrim = true;
|
||||
|
||||
LineDiff.tokenize = TrimmedLineDiff.tokenize = function(value) {
|
||||
var retLines = [],
|
||||
lines = value.split(/^/m);
|
||||
for (var i = 0; i < lines.length; i++) {
|
||||
var line = lines[i],
|
||||
lastLine = lines[i - 1],
|
||||
lastLineLastChar = lastLine && lastLine[lastLine.length - 1];
|
||||
|
||||
// Merge lines that may contain windows new lines
|
||||
if (line === '\n' && lastLineLastChar === '\r') {
|
||||
retLines[retLines.length - 1] = retLines[retLines.length - 1].slice(0, -1) + '\r\n';
|
||||
} else {
|
||||
if (this.ignoreTrim) {
|
||||
line = line.trim();
|
||||
// add a newline unless this is the last line.
|
||||
if (i < lines.length - 1) {
|
||||
line += '\n';
|
||||
}
|
||||
}
|
||||
retLines.push(line);
|
||||
}
|
||||
}
|
||||
|
||||
return retLines;
|
||||
};
|
||||
|
||||
var PatchDiff = new Diff();
|
||||
PatchDiff.tokenize = function(value) {
|
||||
var ret = [],
|
||||
linesAndNewlines = value.split(/(\n|\r\n)/);
|
||||
|
||||
// Ignore the final empty token that occurs if the string ends with a new line
|
||||
if (!linesAndNewlines[linesAndNewlines.length - 1]) {
|
||||
linesAndNewlines.pop();
|
||||
}
|
||||
|
||||
// Merge the content and line separators into single tokens
|
||||
for (var i = 0; i < linesAndNewlines.length; i++) {
|
||||
var line = linesAndNewlines[i];
|
||||
|
||||
if (i % 2) {
|
||||
ret[ret.length - 1] += line;
|
||||
} else {
|
||||
ret.push(line);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
var SentenceDiff = new Diff();
|
||||
SentenceDiff.tokenize = function(value) {
|
||||
return removeEmpty(value.split(/(\S.+?[.!?])(?=\s+|$)/));
|
||||
};
|
||||
|
||||
var JsonDiff = new Diff();
|
||||
// Discriminate between two lines of pretty-printed, serialized JSON where one of them has a
|
||||
// dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:
|
||||
JsonDiff.useLongestToken = true;
|
||||
JsonDiff.tokenize = LineDiff.tokenize;
|
||||
JsonDiff.equals = function(left, right) {
|
||||
return LineDiff.equals(left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'));
|
||||
};
|
||||
|
||||
var JsDiff = {
|
||||
Diff: Diff,
|
||||
|
||||
diffChars: function(oldStr, newStr, callback) { return CharDiff.diff(oldStr, newStr, callback); },
|
||||
diffWords: function(oldStr, newStr, callback) { return WordDiff.diff(oldStr, newStr, callback); },
|
||||
diffWordsWithSpace: function(oldStr, newStr, callback) { return WordWithSpaceDiff.diff(oldStr, newStr, callback); },
|
||||
diffLines: function(oldStr, newStr, callback) { return LineDiff.diff(oldStr, newStr, callback); },
|
||||
diffTrimmedLines: function(oldStr, newStr, callback) { return TrimmedLineDiff.diff(oldStr, newStr, callback); },
|
||||
|
||||
diffSentences: function(oldStr, newStr, callback) { return SentenceDiff.diff(oldStr, newStr, callback); },
|
||||
|
||||
diffCss: function(oldStr, newStr, callback) { return CssDiff.diff(oldStr, newStr, callback); },
|
||||
diffJson: function(oldObj, newObj, callback) {
|
||||
return JsonDiff.diff(
|
||||
typeof oldObj === 'string' ? oldObj : JSON.stringify(canonicalize(oldObj), undefined, ' '),
|
||||
typeof newObj === 'string' ? newObj : JSON.stringify(canonicalize(newObj), undefined, ' '),
|
||||
callback
|
||||
);
|
||||
},
|
||||
|
||||
createTwoFilesPatch: function(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader) {
|
||||
var ret = [];
|
||||
|
||||
if (oldFileName == newFileName) {
|
||||
ret.push('Index: ' + oldFileName);
|
||||
}
|
||||
ret.push('===================================================================');
|
||||
ret.push('--- ' + oldFileName + (typeof oldHeader === 'undefined' ? '' : '\t' + oldHeader));
|
||||
ret.push('+++ ' + newFileName + (typeof newHeader === 'undefined' ? '' : '\t' + newHeader));
|
||||
|
||||
var diff = PatchDiff.diff(oldStr, newStr);
|
||||
diff.push({value: '', lines: []}); // Append an empty value to make cleanup easier
|
||||
|
||||
// Formats a given set of lines for printing as context lines in a patch
|
||||
function contextLines(lines) {
|
||||
return map(lines, function(entry) { return ' ' + entry; });
|
||||
}
|
||||
|
||||
// Outputs the no newline at end of file warning if needed
|
||||
function eofNL(curRange, i, current) {
|
||||
var last = diff[diff.length - 2],
|
||||
isLast = i === diff.length - 2,
|
||||
isLastOfType = i === diff.length - 3 && current.added !== last.added;
|
||||
|
||||
// Figure out if this is the last line for the given file and missing NL
|
||||
if (!(/\n$/.test(current.value)) && (isLast || isLastOfType)) {
|
||||
curRange.push('\\ No newline at end of file');
|
||||
}
|
||||
}
|
||||
|
||||
var oldRangeStart = 0, newRangeStart = 0, curRange = [],
|
||||
oldLine = 1, newLine = 1;
|
||||
for (var i = 0; i < diff.length; i++) {
|
||||
var current = diff[i],
|
||||
lines = current.lines || current.value.replace(/\n$/, '').split('\n');
|
||||
current.lines = lines;
|
||||
|
||||
if (current.added || current.removed) {
|
||||
// If we have previous context, start with that
|
||||
if (!oldRangeStart) {
|
||||
var prev = diff[i - 1];
|
||||
oldRangeStart = oldLine;
|
||||
newRangeStart = newLine;
|
||||
|
||||
if (prev) {
|
||||
curRange = contextLines(prev.lines.slice(-4));
|
||||
oldRangeStart -= curRange.length;
|
||||
newRangeStart -= curRange.length;
|
||||
}
|
||||
}
|
||||
|
||||
// Output our changes
|
||||
curRange.push.apply(curRange, map(lines, function(entry) {
|
||||
return (current.added ? '+' : '-') + entry;
|
||||
}));
|
||||
eofNL(curRange, i, current);
|
||||
|
||||
// Track the updated file position
|
||||
if (current.added) {
|
||||
newLine += lines.length;
|
||||
} else {
|
||||
oldLine += lines.length;
|
||||
}
|
||||
} else {
|
||||
// Identical context lines. Track line changes
|
||||
if (oldRangeStart) {
|
||||
// Close out any changes that have been output (or join overlapping)
|
||||
if (lines.length <= 8 && i < diff.length - 2) {
|
||||
// Overlapping
|
||||
curRange.push.apply(curRange, contextLines(lines));
|
||||
} else {
|
||||
// end the range and output
|
||||
var contextSize = Math.min(lines.length, 4);
|
||||
ret.push(
|
||||
'@@ -' + oldRangeStart + ',' + (oldLine - oldRangeStart + contextSize)
|
||||
+ ' +' + newRangeStart + ',' + (newLine - newRangeStart + contextSize)
|
||||
+ ' @@');
|
||||
ret.push.apply(ret, curRange);
|
||||
ret.push.apply(ret, contextLines(lines.slice(0, contextSize)));
|
||||
if (lines.length <= 4) {
|
||||
eofNL(ret, i, current);
|
||||
}
|
||||
|
||||
oldRangeStart = 0;
|
||||
newRangeStart = 0;
|
||||
curRange = [];
|
||||
}
|
||||
}
|
||||
oldLine += lines.length;
|
||||
newLine += lines.length;
|
||||
}
|
||||
}
|
||||
|
||||
return ret.join('\n') + '\n';
|
||||
},
|
||||
|
||||
createPatch: function(fileName, oldStr, newStr, oldHeader, newHeader) {
|
||||
return JsDiff.createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader);
|
||||
},
|
||||
|
||||
applyPatch: function(oldStr, uniDiff) {
|
||||
var diffstr = uniDiff.split('\n'),
|
||||
hunks = [],
|
||||
i = 0,
|
||||
remEOFNL = false,
|
||||
addEOFNL = false;
|
||||
|
||||
// Skip to the first change hunk
|
||||
while (i < diffstr.length && !(/^@@/.test(diffstr[i]))) {
|
||||
i++;
|
||||
}
|
||||
|
||||
// Parse the unified diff
|
||||
for (; i < diffstr.length; i++) {
|
||||
if (diffstr[i][0] === '@') {
|
||||
var chnukHeader = diffstr[i].split(/@@ -(\d+),(\d+) \+(\d+),(\d+) @@/);
|
||||
hunks.unshift({
|
||||
start: chnukHeader[3],
|
||||
oldlength: +chnukHeader[2],
|
||||
removed: [],
|
||||
newlength: chnukHeader[4],
|
||||
added: []
|
||||
});
|
||||
} else if (diffstr[i][0] === '+') {
|
||||
hunks[0].added.push(diffstr[i].substr(1));
|
||||
} else if (diffstr[i][0] === '-') {
|
||||
hunks[0].removed.push(diffstr[i].substr(1));
|
||||
} else if (diffstr[i][0] === ' ') {
|
||||
hunks[0].added.push(diffstr[i].substr(1));
|
||||
hunks[0].removed.push(diffstr[i].substr(1));
|
||||
} else if (diffstr[i][0] === '\\') {
|
||||
if (diffstr[i - 1][0] === '+') {
|
||||
remEOFNL = true;
|
||||
} else if (diffstr[i - 1][0] === '-') {
|
||||
addEOFNL = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Apply the diff to the input
|
||||
var lines = oldStr.split('\n');
|
||||
for (i = hunks.length - 1; i >= 0; i--) {
|
||||
var hunk = hunks[i];
|
||||
// Sanity check the input string. Bail if we don't match.
|
||||
for (var j = 0; j < hunk.oldlength; j++) {
|
||||
if (lines[hunk.start - 1 + j] !== hunk.removed[j]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Array.prototype.splice.apply(lines, [hunk.start - 1, hunk.oldlength].concat(hunk.added));
|
||||
}
|
||||
|
||||
// Handle EOFNL insertion/removal
|
||||
if (remEOFNL) {
|
||||
while (!lines[lines.length - 1]) {
|
||||
lines.pop();
|
||||
}
|
||||
} else if (addEOFNL) {
|
||||
lines.push('');
|
||||
}
|
||||
return lines.join('\n');
|
||||
},
|
||||
|
||||
convertChangesToXML: function(changes) {
|
||||
var ret = [];
|
||||
for (var i = 0; i < changes.length; i++) {
|
||||
var change = changes[i];
|
||||
if (change.added) {
|
||||
ret.push('<ins>');
|
||||
} else if (change.removed) {
|
||||
ret.push('<del>');
|
||||
}
|
||||
|
||||
ret.push(escapeHTML(change.value));
|
||||
|
||||
if (change.added) {
|
||||
ret.push('</ins>');
|
||||
} else if (change.removed) {
|
||||
ret.push('</del>');
|
||||
}
|
||||
}
|
||||
return ret.join('');
|
||||
},
|
||||
|
||||
// See: http://code.google.com/p/google-diff-match-patch/wiki/API
|
||||
convertChangesToDMP: function(changes) {
|
||||
var ret = [],
|
||||
change,
|
||||
operation;
|
||||
for (var i = 0; i < changes.length; i++) {
|
||||
change = changes[i];
|
||||
if (change.added) {
|
||||
operation = 1;
|
||||
} else if (change.removed) {
|
||||
operation = -1;
|
||||
} else {
|
||||
operation = 0;
|
||||
}
|
||||
|
||||
ret.push([operation, change.value]);
|
||||
}
|
||||
return ret;
|
||||
},
|
||||
|
||||
canonicalize: canonicalize
|
||||
};
|
||||
|
||||
/*istanbul ignore next */
|
||||
/*global module */
|
||||
if (typeof module !== 'undefined' && module.exports) {
|
||||
module.exports = JsDiff;
|
||||
} else if (typeof define === 'function' && define.amd) {
|
||||
/*global define */
|
||||
define([], function() { return JsDiff; });
|
||||
} else if (typeof global.JsDiff === 'undefined') {
|
||||
global.JsDiff = JsDiff;
|
||||
}
|
||||
}(this));
|
74
node_modules/diff/package.json
generated
vendored
Normal file
74
node_modules/diff/package.json
generated
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
{
|
||||
"_from": "diff@1.4.0",
|
||||
"_id": "diff@1.4.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-fyjS657nsVqX79ic5j3P2qPMur8=",
|
||||
"_location": "/diff",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "diff@1.4.0",
|
||||
"name": "diff",
|
||||
"escapedName": "diff",
|
||||
"rawSpec": "1.4.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.4.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/mocha"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/diff/-/diff-1.4.0.tgz",
|
||||
"_shasum": "7f28d2eb9ee7b15a97efd89ce63dcfdaa3ccbabf",
|
||||
"_spec": "diff@1.4.0",
|
||||
"_where": "/home/clemens/Dokumente/git/pixelnode/node_modules/mocha",
|
||||
"bugs": {
|
||||
"url": "http://github.com/kpdecker/jsdiff/issues",
|
||||
"email": "kpdecker@gmail.com"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "A javascript text diff implementation.",
|
||||
"devDependencies": {
|
||||
"colors": "^1.1.0",
|
||||
"istanbul": "^0.3.2",
|
||||
"mocha": "^2.2.4",
|
||||
"should": "^6.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.3.1"
|
||||
},
|
||||
"files": [
|
||||
"diff.js"
|
||||
],
|
||||
"homepage": "https://github.com/kpdecker/jsdiff#readme",
|
||||
"keywords": [
|
||||
"diff",
|
||||
"javascript"
|
||||
],
|
||||
"licenses": [
|
||||
{
|
||||
"type": "BSD",
|
||||
"url": "http://github.com/kpdecker/jsdiff/blob/master/LICENSE"
|
||||
}
|
||||
],
|
||||
"main": "./diff",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Kevin Decker",
|
||||
"email": "kpdecker@gmail.com",
|
||||
"url": "http://incaseofstairs.com"
|
||||
}
|
||||
],
|
||||
"name": "diff",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/kpdecker/jsdiff.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "istanbul cover node_modules/.bin/_mocha test/*.js && istanbul check-coverage --statements 100 --functions 100 --branches 100 --lines 100 coverage/coverage.json"
|
||||
},
|
||||
"version": "1.4.0"
|
||||
}
|
11
node_modules/escape-string-regexp/index.js
generated
vendored
Normal file
11
node_modules/escape-string-regexp/index.js
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
|
||||
|
||||
module.exports = function (str) {
|
||||
if (typeof str !== 'string') {
|
||||
throw new TypeError('Expected a string');
|
||||
}
|
||||
|
||||
return str.replace(matchOperatorsRe, '\\$&');
|
||||
};
|
68
node_modules/escape-string-regexp/package.json
generated
vendored
Normal file
68
node_modules/escape-string-regexp/package.json
generated
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
{
|
||||
"_from": "escape-string-regexp@1.0.2",
|
||||
"_id": "escape-string-regexp@1.0.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-Tbwv5nTnGUnK8/smlc5/LcHZqNE=",
|
||||
"_location": "/escape-string-regexp",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "escape-string-regexp@1.0.2",
|
||||
"name": "escape-string-regexp",
|
||||
"escapedName": "escape-string-regexp",
|
||||
"rawSpec": "1.0.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.0.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/mocha"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.2.tgz",
|
||||
"_shasum": "4dbc2fe674e71949caf3fb2695ce7f2dc1d9a8d1",
|
||||
"_spec": "escape-string-regexp@1.0.2",
|
||||
"_where": "/home/clemens/Dokumente/git/pixelnode/node_modules/mocha",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "http://sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/escape-string-regexp/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Escape RegExp special characters",
|
||||
"devDependencies": {
|
||||
"mocha": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/escape-string-regexp#readme",
|
||||
"keywords": [
|
||||
"regex",
|
||||
"regexp",
|
||||
"re",
|
||||
"regular",
|
||||
"expression",
|
||||
"escape",
|
||||
"string",
|
||||
"str",
|
||||
"special",
|
||||
"characters"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "escape-string-regexp",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/escape-string-regexp.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"version": "1.0.2"
|
||||
}
|
27
node_modules/escape-string-regexp/readme.md
generated
vendored
Normal file
27
node_modules/escape-string-regexp/readme.md
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
# escape-string-regexp [![Build Status](https://travis-ci.org/sindresorhus/escape-string-regexp.svg?branch=master)](https://travis-ci.org/sindresorhus/escape-string-regexp)
|
||||
|
||||
> Escape RegExp special characters
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
$ npm install --save escape-string-regexp
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var escapeStringRegexp = require('escape-string-regexp');
|
||||
|
||||
var escapedString = escapeStringRegexp('how much $ for a unicorn?');
|
||||
//=> how much \$ for a unicorn\?
|
||||
|
||||
new RegExp(escapedString);
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
2
node_modules/glob/.npmignore
generated
vendored
Normal file
2
node_modules/glob/.npmignore
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
.*.swp
|
||||
test/a/
|
3
node_modules/glob/.travis.yml
generated
vendored
Normal file
3
node_modules/glob/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 0.8
|
27
node_modules/glob/LICENSE
generated
vendored
Normal file
27
node_modules/glob/LICENSE
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
Copyright (c) Isaac Z. Schlueter ("Author")
|
||||
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.
|
250
node_modules/glob/README.md
generated
vendored
Normal file
250
node_modules/glob/README.md
generated
vendored
Normal file
@ -0,0 +1,250 @@
|
||||
# Glob
|
||||
|
||||
Match files using the patterns the shell uses, like stars and stuff.
|
||||
|
||||
This is a glob implementation in JavaScript. It uses the `minimatch`
|
||||
library to do its matching.
|
||||
|
||||
## Attention: node-glob users!
|
||||
|
||||
The API has changed dramatically between 2.x and 3.x. This library is
|
||||
now 100% JavaScript, and the integer flags have been replaced with an
|
||||
options object.
|
||||
|
||||
Also, there's an event emitter class, proper tests, and all the other
|
||||
things you've come to expect from node modules.
|
||||
|
||||
And best of all, no compilation!
|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
var glob = require("glob")
|
||||
|
||||
// options is optional
|
||||
glob("**/*.js", options, function (er, files) {
|
||||
// files is an array of filenames.
|
||||
// If the `nonull` option is set, and nothing
|
||||
// was found, then files is ["**/*.js"]
|
||||
// er is an error object or null.
|
||||
})
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
Please see the [minimatch
|
||||
documentation](https://github.com/isaacs/minimatch) for more details.
|
||||
|
||||
Supports these glob features:
|
||||
|
||||
* Brace Expansion
|
||||
* Extended glob matching
|
||||
* "Globstar" `**` matching
|
||||
|
||||
See:
|
||||
|
||||
* `man sh`
|
||||
* `man bash`
|
||||
* `man 3 fnmatch`
|
||||
* `man 5 gitignore`
|
||||
* [minimatch documentation](https://github.com/isaacs/minimatch)
|
||||
|
||||
## glob(pattern, [options], cb)
|
||||
|
||||
* `pattern` {String} Pattern to be matched
|
||||
* `options` {Object}
|
||||
* `cb` {Function}
|
||||
* `err` {Error | null}
|
||||
* `matches` {Array<String>} filenames found matching the pattern
|
||||
|
||||
Perform an asynchronous glob search.
|
||||
|
||||
## glob.sync(pattern, [options])
|
||||
|
||||
* `pattern` {String} Pattern to be matched
|
||||
* `options` {Object}
|
||||
* return: {Array<String>} filenames found matching the pattern
|
||||
|
||||
Perform a synchronous glob search.
|
||||
|
||||
## Class: glob.Glob
|
||||
|
||||
Create a Glob object by instanting the `glob.Glob` class.
|
||||
|
||||
```javascript
|
||||
var Glob = require("glob").Glob
|
||||
var mg = new Glob(pattern, options, cb)
|
||||
```
|
||||
|
||||
It's an EventEmitter, and starts walking the filesystem to find matches
|
||||
immediately.
|
||||
|
||||
### new glob.Glob(pattern, [options], [cb])
|
||||
|
||||
* `pattern` {String} pattern to search for
|
||||
* `options` {Object}
|
||||
* `cb` {Function} Called when an error occurs, or matches are found
|
||||
* `err` {Error | null}
|
||||
* `matches` {Array<String>} filenames found matching the pattern
|
||||
|
||||
Note that if the `sync` flag is set in the options, then matches will
|
||||
be immediately available on the `g.found` member.
|
||||
|
||||
### Properties
|
||||
|
||||
* `minimatch` The minimatch object that the glob uses.
|
||||
* `options` The options object passed in.
|
||||
* `error` The error encountered. When an error is encountered, the
|
||||
glob object is in an undefined state, and should be discarded.
|
||||
* `aborted` Boolean which is set to true when calling `abort()`. There
|
||||
is no way at this time to continue a glob search after aborting, but
|
||||
you can re-use the statCache to avoid having to duplicate syscalls.
|
||||
* `statCache` Collection of all the stat results the glob search
|
||||
performed.
|
||||
* `cache` Convenience object. Each field has the following possible
|
||||
values:
|
||||
* `false` - Path does not exist
|
||||
* `true` - Path exists
|
||||
* `1` - Path exists, and is not a directory
|
||||
* `2` - Path exists, and is a directory
|
||||
* `[file, entries, ...]` - Path exists, is a directory, and the
|
||||
array value is the results of `fs.readdir`
|
||||
|
||||
### Events
|
||||
|
||||
* `end` When the matching is finished, this is emitted with all the
|
||||
matches found. If the `nonull` option is set, and no match was found,
|
||||
then the `matches` list contains the original pattern. The matches
|
||||
are sorted, unless the `nosort` flag is set.
|
||||
* `match` Every time a match is found, this is emitted with the matched.
|
||||
* `error` Emitted when an unexpected error is encountered, or whenever
|
||||
any fs error occurs if `options.strict` is set.
|
||||
* `abort` When `abort()` is called, this event is raised.
|
||||
|
||||
### Methods
|
||||
|
||||
* `abort` Stop the search.
|
||||
|
||||
### Options
|
||||
|
||||
All the options that can be passed to Minimatch can also be passed to
|
||||
Glob to change pattern matching behavior. Also, some have been added,
|
||||
or have glob-specific ramifications.
|
||||
|
||||
All options are false by default, unless otherwise noted.
|
||||
|
||||
All options are added to the glob object, as well.
|
||||
|
||||
* `cwd` The current working directory in which to search. Defaults
|
||||
to `process.cwd()`.
|
||||
* `root` The place where patterns starting with `/` will be mounted
|
||||
onto. Defaults to `path.resolve(options.cwd, "/")` (`/` on Unix
|
||||
systems, and `C:\` or some such on Windows.)
|
||||
* `dot` Include `.dot` files in normal matches and `globstar` matches.
|
||||
Note that an explicit dot in a portion of the pattern will always
|
||||
match dot files.
|
||||
* `nomount` By default, a pattern starting with a forward-slash will be
|
||||
"mounted" onto the root setting, so that a valid filesystem path is
|
||||
returned. Set this flag to disable that behavior.
|
||||
* `mark` Add a `/` character to directory matches. Note that this
|
||||
requires additional stat calls.
|
||||
* `nosort` Don't sort the results.
|
||||
* `stat` Set to true to stat *all* results. This reduces performance
|
||||
somewhat, and is completely unnecessary, unless `readdir` is presumed
|
||||
to be an untrustworthy indicator of file existence. It will cause
|
||||
ELOOP to be triggered one level sooner in the case of cyclical
|
||||
symbolic links.
|
||||
* `silent` When an unusual error is encountered
|
||||
when attempting to read a directory, a warning will be printed to
|
||||
stderr. Set the `silent` option to true to suppress these warnings.
|
||||
* `strict` When an unusual error is encountered
|
||||
when attempting to read a directory, the process will just continue on
|
||||
in search of other matches. Set the `strict` option to raise an error
|
||||
in these cases.
|
||||
* `cache` See `cache` property above. Pass in a previously generated
|
||||
cache object to save some fs calls.
|
||||
* `statCache` A cache of results of filesystem information, to prevent
|
||||
unnecessary stat calls. While it should not normally be necessary to
|
||||
set this, you may pass the statCache from one glob() call to the
|
||||
options object of another, if you know that the filesystem will not
|
||||
change between calls. (See "Race Conditions" below.)
|
||||
* `sync` Perform a synchronous glob search.
|
||||
* `nounique` In some cases, brace-expanded patterns can result in the
|
||||
same file showing up multiple times in the result set. By default,
|
||||
this implementation prevents duplicates in the result set.
|
||||
Set this flag to disable that behavior.
|
||||
* `nonull` Set to never return an empty set, instead returning a set
|
||||
containing the pattern itself. This is the default in glob(3).
|
||||
* `nocase` Perform a case-insensitive match. Note that case-insensitive
|
||||
filesystems will sometimes result in glob returning results that are
|
||||
case-insensitively matched anyway, since readdir and stat will not
|
||||
raise an error.
|
||||
* `debug` Set to enable debug logging in minimatch and glob.
|
||||
* `globDebug` Set to enable debug logging in glob, but not minimatch.
|
||||
|
||||
## Comparisons to other fnmatch/glob implementations
|
||||
|
||||
While strict compliance with the existing standards is a worthwhile
|
||||
goal, some discrepancies exist between node-glob and other
|
||||
implementations, and are intentional.
|
||||
|
||||
If the pattern starts with a `!` character, then it is negated. Set the
|
||||
`nonegate` flag to suppress this behavior, and treat leading `!`
|
||||
characters normally. This is perhaps relevant if you wish to start the
|
||||
pattern with a negative extglob pattern like `!(a|B)`. Multiple `!`
|
||||
characters at the start of a pattern will negate the pattern multiple
|
||||
times.
|
||||
|
||||
If a pattern starts with `#`, then it is treated as a comment, and
|
||||
will not match anything. Use `\#` to match a literal `#` at the
|
||||
start of a line, or set the `nocomment` flag to suppress this behavior.
|
||||
|
||||
The double-star character `**` is supported by default, unless the
|
||||
`noglobstar` flag is set. This is supported in the manner of bsdglob
|
||||
and bash 4.1, where `**` only has special significance if it is the only
|
||||
thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but
|
||||
`a/**b` will not.
|
||||
|
||||
If an escaped pattern has no matches, and the `nonull` flag is set,
|
||||
then glob returns the pattern as-provided, rather than
|
||||
interpreting the character escapes. For example,
|
||||
`glob.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than
|
||||
`"*a?"`. This is akin to setting the `nullglob` option in bash, except
|
||||
that it does not resolve escaped pattern characters.
|
||||
|
||||
If brace expansion is not disabled, then it is performed before any
|
||||
other interpretation of the glob pattern. Thus, a pattern like
|
||||
`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded
|
||||
**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are
|
||||
checked for validity. Since those two are valid, matching proceeds.
|
||||
|
||||
## Windows
|
||||
|
||||
**Please only use forward-slashes in glob expressions.**
|
||||
|
||||
Though windows uses either `/` or `\` as its path separator, only `/`
|
||||
characters are used by this glob implementation. You must use
|
||||
forward-slashes **only** in glob expressions. Back-slashes will always
|
||||
be interpreted as escape characters, not path separators.
|
||||
|
||||
Results from absolute patterns such as `/foo/*` are mounted onto the
|
||||
root setting using `path.join`. On windows, this will by default result
|
||||
in `/foo/*` matching `C:\foo\bar.txt`.
|
||||
|
||||
## Race Conditions
|
||||
|
||||
Glob searching, by its very nature, is susceptible to race conditions,
|
||||
since it relies on directory walking and such.
|
||||
|
||||
As a result, it is possible that a file that exists when glob looks for
|
||||
it may have been deleted or modified by the time it returns the result.
|
||||
|
||||
As part of its internal implementation, this program caches all stat
|
||||
and readdir calls that it makes, in order to cut down on system
|
||||
overhead. However, this also makes it even more susceptible to races,
|
||||
especially if the cache or statCache objects are reused between glob
|
||||
calls.
|
||||
|
||||
Users are thus advised not to use a glob result as a guarantee of
|
||||
filesystem state in the face of rapid changes. For the vast majority
|
||||
of operations, this is never a problem.
|
9
node_modules/glob/examples/g.js
generated
vendored
Normal file
9
node_modules/glob/examples/g.js
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
var Glob = require("../").Glob
|
||||
|
||||
var pattern = "test/a/**/[cg]/../[cg]"
|
||||
console.log(pattern)
|
||||
|
||||
var mg = new Glob(pattern, {mark: true, sync:true}, function (er, matches) {
|
||||
console.log("matches", matches)
|
||||
})
|
||||
console.log("after")
|
9
node_modules/glob/examples/usr-local.js
generated
vendored
Normal file
9
node_modules/glob/examples/usr-local.js
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
var Glob = require("../").Glob
|
||||
|
||||
var pattern = "{./*/*,/*,/usr/local/*}"
|
||||
console.log(pattern)
|
||||
|
||||
var mg = new Glob(pattern, {mark: true}, function (er, matches) {
|
||||
console.log("matches", matches)
|
||||
})
|
||||
console.log("after")
|
728
node_modules/glob/glob.js
generated
vendored
Normal file
728
node_modules/glob/glob.js
generated
vendored
Normal file
@ -0,0 +1,728 @@
|
||||
// Approach:
|
||||
//
|
||||
// 1. Get the minimatch set
|
||||
// 2. For each pattern in the set, PROCESS(pattern)
|
||||
// 3. Store matches per-set, then uniq them
|
||||
//
|
||||
// PROCESS(pattern)
|
||||
// Get the first [n] items from pattern that are all strings
|
||||
// Join these together. This is PREFIX.
|
||||
// If there is no more remaining, then stat(PREFIX) and
|
||||
// add to matches if it succeeds. END.
|
||||
// readdir(PREFIX) as ENTRIES
|
||||
// If fails, END
|
||||
// If pattern[n] is GLOBSTAR
|
||||
// // handle the case where the globstar match is empty
|
||||
// // by pruning it out, and testing the resulting pattern
|
||||
// PROCESS(pattern[0..n] + pattern[n+1 .. $])
|
||||
// // handle other cases.
|
||||
// for ENTRY in ENTRIES (not dotfiles)
|
||||
// // attach globstar + tail onto the entry
|
||||
// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $])
|
||||
//
|
||||
// else // not globstar
|
||||
// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot)
|
||||
// Test ENTRY against pattern[n]
|
||||
// If fails, continue
|
||||
// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $])
|
||||
//
|
||||
// Caveat:
|
||||
// Cache all stats and readdirs results to minimize syscall. Since all
|
||||
// we ever care about is existence and directory-ness, we can just keep
|
||||
// `true` for files, and [children,...] for directories, or `false` for
|
||||
// things that don't exist.
|
||||
|
||||
|
||||
|
||||
module.exports = glob
|
||||
|
||||
var fs = require("fs")
|
||||
, minimatch = require("minimatch")
|
||||
, Minimatch = minimatch.Minimatch
|
||||
, inherits = require("inherits")
|
||||
, EE = require("events").EventEmitter
|
||||
, path = require("path")
|
||||
, isDir = {}
|
||||
, assert = require("assert").ok
|
||||
|
||||
function glob (pattern, options, cb) {
|
||||
if (typeof options === "function") cb = options, options = {}
|
||||
if (!options) options = {}
|
||||
|
||||
if (typeof options === "number") {
|
||||
deprecated()
|
||||
return
|
||||
}
|
||||
|
||||
var g = new Glob(pattern, options, cb)
|
||||
return g.sync ? g.found : g
|
||||
}
|
||||
|
||||
glob.fnmatch = deprecated
|
||||
|
||||
function deprecated () {
|
||||
throw new Error("glob's interface has changed. Please see the docs.")
|
||||
}
|
||||
|
||||
glob.sync = globSync
|
||||
function globSync (pattern, options) {
|
||||
if (typeof options === "number") {
|
||||
deprecated()
|
||||
return
|
||||
}
|
||||
|
||||
options = options || {}
|
||||
options.sync = true
|
||||
return glob(pattern, options)
|
||||
}
|
||||
|
||||
this._processingEmitQueue = false
|
||||
|
||||
glob.Glob = Glob
|
||||
inherits(Glob, EE)
|
||||
function Glob (pattern, options, cb) {
|
||||
if (!(this instanceof Glob)) {
|
||||
return new Glob(pattern, options, cb)
|
||||
}
|
||||
|
||||
if (typeof options === "function") {
|
||||
cb = options
|
||||
options = null
|
||||
}
|
||||
|
||||
if (typeof cb === "function") {
|
||||
this.on("error", cb)
|
||||
this.on("end", function (matches) {
|
||||
cb(null, matches)
|
||||
})
|
||||
}
|
||||
|
||||
options = options || {}
|
||||
|
||||
this._endEmitted = false
|
||||
this.EOF = {}
|
||||
this._emitQueue = []
|
||||
|
||||
this.paused = false
|
||||
this._processingEmitQueue = false
|
||||
|
||||
this.maxDepth = options.maxDepth || 1000
|
||||
this.maxLength = options.maxLength || Infinity
|
||||
this.cache = options.cache || {}
|
||||
this.statCache = options.statCache || {}
|
||||
|
||||
this.changedCwd = false
|
||||
var cwd = process.cwd()
|
||||
if (!options.hasOwnProperty("cwd")) this.cwd = cwd
|
||||
else {
|
||||
this.cwd = options.cwd
|
||||
this.changedCwd = path.resolve(options.cwd) !== cwd
|
||||
}
|
||||
|
||||
this.root = options.root || path.resolve(this.cwd, "/")
|
||||
this.root = path.resolve(this.root)
|
||||
if (process.platform === "win32")
|
||||
this.root = this.root.replace(/\\/g, "/")
|
||||
|
||||
this.nomount = !!options.nomount
|
||||
|
||||
if (!pattern) {
|
||||
throw new Error("must provide pattern")
|
||||
}
|
||||
|
||||
// base-matching: just use globstar for that.
|
||||
if (options.matchBase && -1 === pattern.indexOf("/")) {
|
||||
if (options.noglobstar) {
|
||||
throw new Error("base matching requires globstar")
|
||||
}
|
||||
pattern = "**/" + pattern
|
||||
}
|
||||
|
||||
this.strict = options.strict !== false
|
||||
this.dot = !!options.dot
|
||||
this.mark = !!options.mark
|
||||
this.sync = !!options.sync
|
||||
this.nounique = !!options.nounique
|
||||
this.nonull = !!options.nonull
|
||||
this.nosort = !!options.nosort
|
||||
this.nocase = !!options.nocase
|
||||
this.stat = !!options.stat
|
||||
|
||||
this.debug = !!options.debug || !!options.globDebug
|
||||
if (this.debug)
|
||||
this.log = console.error
|
||||
|
||||
this.silent = !!options.silent
|
||||
|
||||
var mm = this.minimatch = new Minimatch(pattern, options)
|
||||
this.options = mm.options
|
||||
pattern = this.pattern = mm.pattern
|
||||
|
||||
this.error = null
|
||||
this.aborted = false
|
||||
|
||||
// list of all the patterns that ** has resolved do, so
|
||||
// we can avoid visiting multiple times.
|
||||
this._globstars = {}
|
||||
|
||||
EE.call(this)
|
||||
|
||||
// process each pattern in the minimatch set
|
||||
var n = this.minimatch.set.length
|
||||
|
||||
// The matches are stored as {<filename>: true,...} so that
|
||||
// duplicates are automagically pruned.
|
||||
// Later, we do an Object.keys() on these.
|
||||
// Keep them as a list so we can fill in when nonull is set.
|
||||
this.matches = new Array(n)
|
||||
|
||||
this.minimatch.set.forEach(iterator.bind(this))
|
||||
function iterator (pattern, i, set) {
|
||||
this._process(pattern, 0, i, function (er) {
|
||||
if (er) this.emit("error", er)
|
||||
if (-- n <= 0) this._finish()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype.log = function () {}
|
||||
|
||||
Glob.prototype._finish = function () {
|
||||
assert(this instanceof Glob)
|
||||
|
||||
var nou = this.nounique
|
||||
, all = nou ? [] : {}
|
||||
|
||||
for (var i = 0, l = this.matches.length; i < l; i ++) {
|
||||
var matches = this.matches[i]
|
||||
this.log("matches[%d] =", i, matches)
|
||||
// do like the shell, and spit out the literal glob
|
||||
if (!matches) {
|
||||
if (this.nonull) {
|
||||
var literal = this.minimatch.globSet[i]
|
||||
if (nou) all.push(literal)
|
||||
else all[literal] = true
|
||||
}
|
||||
} else {
|
||||
// had matches
|
||||
var m = Object.keys(matches)
|
||||
if (nou) all.push.apply(all, m)
|
||||
else m.forEach(function (m) {
|
||||
all[m] = true
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (!nou) all = Object.keys(all)
|
||||
|
||||
if (!this.nosort) {
|
||||
all = all.sort(this.nocase ? alphasorti : alphasort)
|
||||
}
|
||||
|
||||
if (this.mark) {
|
||||
// at *some* point we statted all of these
|
||||
all = all.map(this._mark, this)
|
||||
}
|
||||
|
||||
this.log("emitting end", all)
|
||||
|
||||
this.EOF = this.found = all
|
||||
this.emitMatch(this.EOF)
|
||||
}
|
||||
|
||||
function alphasorti (a, b) {
|
||||
a = a.toLowerCase()
|
||||
b = b.toLowerCase()
|
||||
return alphasort(a, b)
|
||||
}
|
||||
|
||||
function alphasort (a, b) {
|
||||
return a > b ? 1 : a < b ? -1 : 0
|
||||
}
|
||||
|
||||
Glob.prototype._mark = function (p) {
|
||||
var c = this.cache[p]
|
||||
var m = p
|
||||
if (c) {
|
||||
var isDir = c === 2 || Array.isArray(c)
|
||||
var slash = p.slice(-1) === '/'
|
||||
|
||||
if (isDir && !slash)
|
||||
m += '/'
|
||||
else if (!isDir && slash)
|
||||
m = m.slice(0, -1)
|
||||
|
||||
if (m !== p) {
|
||||
this.statCache[m] = this.statCache[p]
|
||||
this.cache[m] = this.cache[p]
|
||||
}
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
Glob.prototype.abort = function () {
|
||||
this.aborted = true
|
||||
this.emit("abort")
|
||||
}
|
||||
|
||||
Glob.prototype.pause = function () {
|
||||
if (this.paused) return
|
||||
if (this.sync)
|
||||
this.emit("error", new Error("Can't pause/resume sync glob"))
|
||||
this.paused = true
|
||||
this.emit("pause")
|
||||
}
|
||||
|
||||
Glob.prototype.resume = function () {
|
||||
if (!this.paused) return
|
||||
if (this.sync)
|
||||
this.emit("error", new Error("Can't pause/resume sync glob"))
|
||||
this.paused = false
|
||||
this.emit("resume")
|
||||
this._processEmitQueue()
|
||||
//process.nextTick(this.emit.bind(this, "resume"))
|
||||
}
|
||||
|
||||
Glob.prototype.emitMatch = function (m) {
|
||||
this.log('emitMatch', m)
|
||||
this._emitQueue.push(m)
|
||||
this._processEmitQueue()
|
||||
}
|
||||
|
||||
Glob.prototype._processEmitQueue = function (m) {
|
||||
this.log("pEQ paused=%j processing=%j m=%j", this.paused,
|
||||
this._processingEmitQueue, m)
|
||||
var done = false
|
||||
while (!this._processingEmitQueue &&
|
||||
!this.paused) {
|
||||
this._processingEmitQueue = true
|
||||
var m = this._emitQueue.shift()
|
||||
this.log(">processEmitQueue", m === this.EOF ? ":EOF:" : m)
|
||||
if (!m) {
|
||||
this.log(">processEmitQueue, falsey m")
|
||||
this._processingEmitQueue = false
|
||||
break
|
||||
}
|
||||
|
||||
if (m === this.EOF || !(this.mark && !this.stat)) {
|
||||
this.log("peq: unmarked, or eof")
|
||||
next.call(this, 0, false)
|
||||
} else if (this.statCache[m]) {
|
||||
var sc = this.statCache[m]
|
||||
var exists
|
||||
if (sc)
|
||||
exists = sc.isDirectory() ? 2 : 1
|
||||
this.log("peq: stat cached")
|
||||
next.call(this, exists, exists === 2)
|
||||
} else {
|
||||
this.log("peq: _stat, then next")
|
||||
this._stat(m, next)
|
||||
}
|
||||
|
||||
function next(exists, isDir) {
|
||||
this.log("next", m, exists, isDir)
|
||||
var ev = m === this.EOF ? "end" : "match"
|
||||
|
||||
// "end" can only happen once.
|
||||
assert(!this._endEmitted)
|
||||
if (ev === "end")
|
||||
this._endEmitted = true
|
||||
|
||||
if (exists) {
|
||||
// Doesn't mean it necessarily doesn't exist, it's possible
|
||||
// we just didn't check because we don't care that much, or
|
||||
// this is EOF anyway.
|
||||
if (isDir && !m.match(/\/$/)) {
|
||||
m = m + "/"
|
||||
} else if (!isDir && m.match(/\/$/)) {
|
||||
m = m.replace(/\/+$/, "")
|
||||
}
|
||||
}
|
||||
this.log("emit", ev, m)
|
||||
this.emit(ev, m)
|
||||
this._processingEmitQueue = false
|
||||
if (done && m !== this.EOF && !this.paused)
|
||||
this._processEmitQueue()
|
||||
}
|
||||
}
|
||||
done = true
|
||||
}
|
||||
|
||||
Glob.prototype._process = function (pattern, depth, index, cb_) {
|
||||
assert(this instanceof Glob)
|
||||
|
||||
var cb = function cb (er, res) {
|
||||
assert(this instanceof Glob)
|
||||
if (this.paused) {
|
||||
if (!this._processQueue) {
|
||||
this._processQueue = []
|
||||
this.once("resume", function () {
|
||||
var q = this._processQueue
|
||||
this._processQueue = null
|
||||
q.forEach(function (cb) { cb() })
|
||||
})
|
||||
}
|
||||
this._processQueue.push(cb_.bind(this, er, res))
|
||||
} else {
|
||||
cb_.call(this, er, res)
|
||||
}
|
||||
}.bind(this)
|
||||
|
||||
if (this.aborted) return cb()
|
||||
|
||||
if (depth > this.maxDepth) return cb()
|
||||
|
||||
// Get the first [n] parts of pattern that are all strings.
|
||||
var n = 0
|
||||
while (typeof pattern[n] === "string") {
|
||||
n ++
|
||||
}
|
||||
// now n is the index of the first one that is *not* a string.
|
||||
|
||||
// see if there's anything else
|
||||
var prefix
|
||||
switch (n) {
|
||||
// if not, then this is rather simple
|
||||
case pattern.length:
|
||||
prefix = pattern.join("/")
|
||||
this._stat(prefix, function (exists, isDir) {
|
||||
// either it's there, or it isn't.
|
||||
// nothing more to do, either way.
|
||||
if (exists) {
|
||||
if (prefix && isAbsolute(prefix) && !this.nomount) {
|
||||
if (prefix.charAt(0) === "/") {
|
||||
prefix = path.join(this.root, prefix)
|
||||
} else {
|
||||
prefix = path.resolve(this.root, prefix)
|
||||
}
|
||||
}
|
||||
|
||||
if (process.platform === "win32")
|
||||
prefix = prefix.replace(/\\/g, "/")
|
||||
|
||||
this.matches[index] = this.matches[index] || {}
|
||||
this.matches[index][prefix] = true
|
||||
this.emitMatch(prefix)
|
||||
}
|
||||
return cb()
|
||||
})
|
||||
return
|
||||
|
||||
case 0:
|
||||
// pattern *starts* with some non-trivial item.
|
||||
// going to readdir(cwd), but not include the prefix in matches.
|
||||
prefix = null
|
||||
break
|
||||
|
||||
default:
|
||||
// pattern has some string bits in the front.
|
||||
// whatever it starts with, whether that's "absolute" like /foo/bar,
|
||||
// or "relative" like "../baz"
|
||||
prefix = pattern.slice(0, n)
|
||||
prefix = prefix.join("/")
|
||||
break
|
||||
}
|
||||
|
||||
// get the list of entries.
|
||||
var read
|
||||
if (prefix === null) read = "."
|
||||
else if (isAbsolute(prefix) || isAbsolute(pattern.join("/"))) {
|
||||
if (!prefix || !isAbsolute(prefix)) {
|
||||
prefix = path.join("/", prefix)
|
||||
}
|
||||
read = prefix = path.resolve(prefix)
|
||||
|
||||
// if (process.platform === "win32")
|
||||
// read = prefix = prefix.replace(/^[a-zA-Z]:|\\/g, "/")
|
||||
|
||||
this.log('absolute: ', prefix, this.root, pattern, read)
|
||||
} else {
|
||||
read = prefix
|
||||
}
|
||||
|
||||
this.log('readdir(%j)', read, this.cwd, this.root)
|
||||
|
||||
return this._readdir(read, function (er, entries) {
|
||||
if (er) {
|
||||
// not a directory!
|
||||
// this means that, whatever else comes after this, it can never match
|
||||
return cb()
|
||||
}
|
||||
|
||||
// globstar is special
|
||||
if (pattern[n] === minimatch.GLOBSTAR) {
|
||||
// test without the globstar, and with every child both below
|
||||
// and replacing the globstar.
|
||||
var s = [ pattern.slice(0, n).concat(pattern.slice(n + 1)) ]
|
||||
entries.forEach(function (e) {
|
||||
if (e.charAt(0) === "." && !this.dot) return
|
||||
// instead of the globstar
|
||||
s.push(pattern.slice(0, n).concat(e).concat(pattern.slice(n + 1)))
|
||||
// below the globstar
|
||||
s.push(pattern.slice(0, n).concat(e).concat(pattern.slice(n)))
|
||||
}, this)
|
||||
|
||||
s = s.filter(function (pattern) {
|
||||
var key = gsKey(pattern)
|
||||
var seen = !this._globstars[key]
|
||||
this._globstars[key] = true
|
||||
return seen
|
||||
}, this)
|
||||
|
||||
if (!s.length)
|
||||
return cb()
|
||||
|
||||
// now asyncForEach over this
|
||||
var l = s.length
|
||||
, errState = null
|
||||
s.forEach(function (gsPattern) {
|
||||
this._process(gsPattern, depth + 1, index, function (er) {
|
||||
if (errState) return
|
||||
if (er) return cb(errState = er)
|
||||
if (--l <= 0) return cb()
|
||||
})
|
||||
}, this)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// not a globstar
|
||||
// It will only match dot entries if it starts with a dot, or if
|
||||
// dot is set. Stuff like @(.foo|.bar) isn't allowed.
|
||||
var pn = pattern[n]
|
||||
var rawGlob = pattern[n]._glob
|
||||
, dotOk = this.dot || rawGlob.charAt(0) === "."
|
||||
|
||||
entries = entries.filter(function (e) {
|
||||
return (e.charAt(0) !== "." || dotOk) &&
|
||||
e.match(pattern[n])
|
||||
})
|
||||
|
||||
// If n === pattern.length - 1, then there's no need for the extra stat
|
||||
// *unless* the user has specified "mark" or "stat" explicitly.
|
||||
// We know that they exist, since the readdir returned them.
|
||||
if (n === pattern.length - 1 &&
|
||||
!this.mark &&
|
||||
!this.stat) {
|
||||
entries.forEach(function (e) {
|
||||
if (prefix) {
|
||||
if (prefix !== "/") e = prefix + "/" + e
|
||||
else e = prefix + e
|
||||
}
|
||||
if (e.charAt(0) === "/" && !this.nomount) {
|
||||
e = path.join(this.root, e)
|
||||
}
|
||||
|
||||
if (process.platform === "win32")
|
||||
e = e.replace(/\\/g, "/")
|
||||
|
||||
this.matches[index] = this.matches[index] || {}
|
||||
this.matches[index][e] = true
|
||||
this.emitMatch(e)
|
||||
}, this)
|
||||
return cb.call(this)
|
||||
}
|
||||
|
||||
|
||||
// now test all the remaining entries as stand-ins for that part
|
||||
// of the pattern.
|
||||
var l = entries.length
|
||||
, errState = null
|
||||
if (l === 0) return cb() // no matches possible
|
||||
entries.forEach(function (e) {
|
||||
var p = pattern.slice(0, n).concat(e).concat(pattern.slice(n + 1))
|
||||
this._process(p, depth + 1, index, function (er) {
|
||||
if (errState) return
|
||||
if (er) return cb(errState = er)
|
||||
if (--l === 0) return cb.call(this)
|
||||
})
|
||||
}, this)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
function gsKey (pattern) {
|
||||
return '**' + pattern.map(function (p) {
|
||||
return (p === minimatch.GLOBSTAR) ? '**' : (''+p)
|
||||
}).join('/')
|
||||
}
|
||||
|
||||
Glob.prototype._stat = function (f, cb) {
|
||||
assert(this instanceof Glob)
|
||||
var abs = f
|
||||
if (f.charAt(0) === "/") {
|
||||
abs = path.join(this.root, f)
|
||||
} else if (this.changedCwd) {
|
||||
abs = path.resolve(this.cwd, f)
|
||||
}
|
||||
|
||||
if (f.length > this.maxLength) {
|
||||
var er = new Error("Path name too long")
|
||||
er.code = "ENAMETOOLONG"
|
||||
er.path = f
|
||||
return this._afterStat(f, abs, cb, er)
|
||||
}
|
||||
|
||||
this.log('stat', [this.cwd, f, '=', abs])
|
||||
|
||||
if (!this.stat && this.cache.hasOwnProperty(f)) {
|
||||
var exists = this.cache[f]
|
||||
, isDir = exists && (Array.isArray(exists) || exists === 2)
|
||||
if (this.sync) return cb.call(this, !!exists, isDir)
|
||||
return process.nextTick(cb.bind(this, !!exists, isDir))
|
||||
}
|
||||
|
||||
var stat = this.statCache[abs]
|
||||
if (this.sync || stat) {
|
||||
var er
|
||||
try {
|
||||
stat = fs.statSync(abs)
|
||||
} catch (e) {
|
||||
er = e
|
||||
}
|
||||
this._afterStat(f, abs, cb, er, stat)
|
||||
} else {
|
||||
fs.stat(abs, this._afterStat.bind(this, f, abs, cb))
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype._afterStat = function (f, abs, cb, er, stat) {
|
||||
var exists
|
||||
assert(this instanceof Glob)
|
||||
|
||||
if (abs.slice(-1) === "/" && stat && !stat.isDirectory()) {
|
||||
this.log("should be ENOTDIR, fake it")
|
||||
|
||||
er = new Error("ENOTDIR, not a directory '" + abs + "'")
|
||||
er.path = abs
|
||||
er.code = "ENOTDIR"
|
||||
stat = null
|
||||
}
|
||||
|
||||
var emit = !this.statCache[abs]
|
||||
this.statCache[abs] = stat
|
||||
|
||||
if (er || !stat) {
|
||||
exists = false
|
||||
} else {
|
||||
exists = stat.isDirectory() ? 2 : 1
|
||||
if (emit)
|
||||
this.emit('stat', f, stat)
|
||||
}
|
||||
this.cache[f] = this.cache[f] || exists
|
||||
cb.call(this, !!exists, exists === 2)
|
||||
}
|
||||
|
||||
Glob.prototype._readdir = function (f, cb) {
|
||||
assert(this instanceof Glob)
|
||||
var abs = f
|
||||
if (f.charAt(0) === "/") {
|
||||
abs = path.join(this.root, f)
|
||||
} else if (isAbsolute(f)) {
|
||||
abs = f
|
||||
} else if (this.changedCwd) {
|
||||
abs = path.resolve(this.cwd, f)
|
||||
}
|
||||
|
||||
if (f.length > this.maxLength) {
|
||||
var er = new Error("Path name too long")
|
||||
er.code = "ENAMETOOLONG"
|
||||
er.path = f
|
||||
return this._afterReaddir(f, abs, cb, er)
|
||||
}
|
||||
|
||||
this.log('readdir', [this.cwd, f, abs])
|
||||
if (this.cache.hasOwnProperty(f)) {
|
||||
var c = this.cache[f]
|
||||
if (Array.isArray(c)) {
|
||||
if (this.sync) return cb.call(this, null, c)
|
||||
return process.nextTick(cb.bind(this, null, c))
|
||||
}
|
||||
|
||||
if (!c || c === 1) {
|
||||
// either ENOENT or ENOTDIR
|
||||
var code = c ? "ENOTDIR" : "ENOENT"
|
||||
, er = new Error((c ? "Not a directory" : "Not found") + ": " + f)
|
||||
er.path = f
|
||||
er.code = code
|
||||
this.log(f, er)
|
||||
if (this.sync) return cb.call(this, er)
|
||||
return process.nextTick(cb.bind(this, er))
|
||||
}
|
||||
|
||||
// at this point, c === 2, meaning it's a dir, but we haven't
|
||||
// had to read it yet, or c === true, meaning it's *something*
|
||||
// but we don't have any idea what. Need to read it, either way.
|
||||
}
|
||||
|
||||
if (this.sync) {
|
||||
var er, entries
|
||||
try {
|
||||
entries = fs.readdirSync(abs)
|
||||
} catch (e) {
|
||||
er = e
|
||||
}
|
||||
return this._afterReaddir(f, abs, cb, er, entries)
|
||||
}
|
||||
|
||||
fs.readdir(abs, this._afterReaddir.bind(this, f, abs, cb))
|
||||
}
|
||||
|
||||
Glob.prototype._afterReaddir = function (f, abs, cb, er, entries) {
|
||||
assert(this instanceof Glob)
|
||||
if (entries && !er) {
|
||||
this.cache[f] = entries
|
||||
// if we haven't asked to stat everything for suresies, then just
|
||||
// assume that everything in there exists, so we can avoid
|
||||
// having to stat it a second time. This also gets us one step
|
||||
// further into ELOOP territory.
|
||||
if (!this.mark && !this.stat) {
|
||||
entries.forEach(function (e) {
|
||||
if (f === "/") e = f + e
|
||||
else e = f + "/" + e
|
||||
this.cache[e] = true
|
||||
}, this)
|
||||
}
|
||||
|
||||
return cb.call(this, er, entries)
|
||||
}
|
||||
|
||||
// now handle errors, and cache the information
|
||||
if (er) switch (er.code) {
|
||||
case "ENOTDIR": // totally normal. means it *does* exist.
|
||||
this.cache[f] = 1
|
||||
return cb.call(this, er)
|
||||
case "ENOENT": // not terribly unusual
|
||||
case "ELOOP":
|
||||
case "ENAMETOOLONG":
|
||||
case "UNKNOWN":
|
||||
this.cache[f] = false
|
||||
return cb.call(this, er)
|
||||
default: // some unusual error. Treat as failure.
|
||||
this.cache[f] = false
|
||||
if (this.strict) this.emit("error", er)
|
||||
if (!this.silent) console.error("glob error", er)
|
||||
return cb.call(this, er)
|
||||
}
|
||||
}
|
||||
|
||||
var isAbsolute = process.platform === "win32" ? absWin : absUnix
|
||||
|
||||
function absWin (p) {
|
||||
if (absUnix(p)) return true
|
||||
// pull off the device/UNC bit from a windows path.
|
||||
// from node's lib/path.js
|
||||
var splitDeviceRe =
|
||||
/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/
|
||||
, result = splitDeviceRe.exec(p)
|
||||
, device = result[1] || ''
|
||||
, isUnc = device && device.charAt(1) !== ':'
|
||||
, isAbsolute = !!result[2] || isUnc // UNC paths are always absolute
|
||||
|
||||
return isAbsolute
|
||||
}
|
||||
|
||||
function absUnix (p) {
|
||||
return p.charAt(0) === "/" || p === ""
|
||||
}
|
61
node_modules/glob/package.json
generated
vendored
Normal file
61
node_modules/glob/package.json
generated
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
{
|
||||
"_from": "glob@3.2.11",
|
||||
"_id": "glob@3.2.11",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-Spc/Y1uRkPcV0QmH1cAP0oFevj0=",
|
||||
"_location": "/glob",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "glob@3.2.11",
|
||||
"name": "glob",
|
||||
"escapedName": "glob",
|
||||
"rawSpec": "3.2.11",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "3.2.11"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/mocha"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/glob/-/glob-3.2.11.tgz",
|
||||
"_shasum": "4a973f635b9190f715d10987d5c00fd2815ebe3d",
|
||||
"_spec": "glob@3.2.11",
|
||||
"_where": "/home/clemens/Dokumente/git/pixelnode/node_modules/mocha",
|
||||
"author": {
|
||||
"name": "Isaac Z. Schlueter",
|
||||
"email": "i@izs.me",
|
||||
"url": "http://blog.izs.me/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/isaacs/node-glob/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"inherits": "2",
|
||||
"minimatch": "0.3"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "a little globber",
|
||||
"devDependencies": {
|
||||
"mkdirp": "0",
|
||||
"rimraf": "1",
|
||||
"tap": "~0.4.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
},
|
||||
"homepage": "https://github.com/isaacs/node-glob#readme",
|
||||
"license": "BSD",
|
||||
"main": "glob.js",
|
||||
"name": "glob",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/isaacs/node-glob.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test/*.js",
|
||||
"test-regen": "TEST_REGEN=1 node test/00-setup.js"
|
||||
},
|
||||
"version": "3.2.11"
|
||||
}
|
176
node_modules/glob/test/00-setup.js
generated
vendored
Normal file
176
node_modules/glob/test/00-setup.js
generated
vendored
Normal file
@ -0,0 +1,176 @@
|
||||
// just a little pre-run script to set up the fixtures.
|
||||
// zz-finish cleans it up
|
||||
|
||||
var mkdirp = require("mkdirp")
|
||||
var path = require("path")
|
||||
var i = 0
|
||||
var tap = require("tap")
|
||||
var fs = require("fs")
|
||||
var rimraf = require("rimraf")
|
||||
|
||||
var files =
|
||||
[ "a/.abcdef/x/y/z/a"
|
||||
, "a/abcdef/g/h"
|
||||
, "a/abcfed/g/h"
|
||||
, "a/b/c/d"
|
||||
, "a/bc/e/f"
|
||||
, "a/c/d/c/b"
|
||||
, "a/cb/e/f"
|
||||
]
|
||||
|
||||
var symlinkTo = path.resolve(__dirname, "a/symlink/a/b/c")
|
||||
var symlinkFrom = "../.."
|
||||
|
||||
files = files.map(function (f) {
|
||||
return path.resolve(__dirname, f)
|
||||
})
|
||||
|
||||
tap.test("remove fixtures", function (t) {
|
||||
rimraf(path.resolve(__dirname, "a"), function (er) {
|
||||
t.ifError(er, "remove fixtures")
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
files.forEach(function (f) {
|
||||
tap.test(f, function (t) {
|
||||
var d = path.dirname(f)
|
||||
mkdirp(d, 0755, function (er) {
|
||||
if (er) {
|
||||
t.fail(er)
|
||||
return t.bailout()
|
||||
}
|
||||
fs.writeFile(f, "i like tests", function (er) {
|
||||
t.ifError(er, "make file")
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
if (process.platform !== "win32") {
|
||||
tap.test("symlinky", function (t) {
|
||||
var d = path.dirname(symlinkTo)
|
||||
console.error("mkdirp", d)
|
||||
mkdirp(d, 0755, function (er) {
|
||||
t.ifError(er)
|
||||
fs.symlink(symlinkFrom, symlinkTo, "dir", function (er) {
|
||||
t.ifError(er, "make symlink")
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
;["foo","bar","baz","asdf","quux","qwer","rewq"].forEach(function (w) {
|
||||
w = "/tmp/glob-test/" + w
|
||||
tap.test("create " + w, function (t) {
|
||||
mkdirp(w, function (er) {
|
||||
if (er)
|
||||
throw er
|
||||
t.pass(w)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
// generate the bash pattern test-fixtures if possible
|
||||
if (process.platform === "win32" || !process.env.TEST_REGEN) {
|
||||
console.error("Windows, or TEST_REGEN unset. Using cached fixtures.")
|
||||
return
|
||||
}
|
||||
|
||||
var spawn = require("child_process").spawn;
|
||||
var globs =
|
||||
// put more patterns here.
|
||||
// anything that would be directly in / should be in /tmp/glob-test
|
||||
["test/a/*/+(c|g)/./d"
|
||||
,"test/a/**/[cg]/../[cg]"
|
||||
,"test/a/{b,c,d,e,f}/**/g"
|
||||
,"test/a/b/**"
|
||||
,"test/**/g"
|
||||
,"test/a/abc{fed,def}/g/h"
|
||||
,"test/a/abc{fed/g,def}/**/"
|
||||
,"test/a/abc{fed/g,def}/**///**/"
|
||||
,"test/**/a/**/"
|
||||
,"test/+(a|b|c)/a{/,bc*}/**"
|
||||
,"test/*/*/*/f"
|
||||
,"test/**/f"
|
||||
,"test/a/symlink/a/b/c/a/b/c/a/b/c//a/b/c////a/b/c/**/b/c/**"
|
||||
,"{./*/*,/tmp/glob-test/*}"
|
||||
,"{/tmp/glob-test/*,*}" // evil owl face! how you taunt me!
|
||||
,"test/a/!(symlink)/**"
|
||||
]
|
||||
var bashOutput = {}
|
||||
var fs = require("fs")
|
||||
|
||||
globs.forEach(function (pattern) {
|
||||
tap.test("generate fixture " + pattern, function (t) {
|
||||
var cmd = "shopt -s globstar && " +
|
||||
"shopt -s extglob && " +
|
||||
"shopt -s nullglob && " +
|
||||
// "shopt >&2; " +
|
||||
"eval \'for i in " + pattern + "; do echo $i; done\'"
|
||||
var cp = spawn("bash", ["-c", cmd], { cwd: path.dirname(__dirname) })
|
||||
var out = []
|
||||
cp.stdout.on("data", function (c) {
|
||||
out.push(c)
|
||||
})
|
||||
cp.stderr.pipe(process.stderr)
|
||||
cp.on("close", function (code) {
|
||||
out = flatten(out)
|
||||
if (!out)
|
||||
out = []
|
||||
else
|
||||
out = cleanResults(out.split(/\r*\n/))
|
||||
|
||||
bashOutput[pattern] = out
|
||||
t.notOk(code, "bash test should finish nicely")
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
tap.test("save fixtures", function (t) {
|
||||
var fname = path.resolve(__dirname, "bash-results.json")
|
||||
var data = JSON.stringify(bashOutput, null, 2) + "\n"
|
||||
fs.writeFile(fname, data, function (er) {
|
||||
t.ifError(er)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
function cleanResults (m) {
|
||||
// normalize discrepancies in ordering, duplication,
|
||||
// and ending slashes.
|
||||
return m.map(function (m) {
|
||||
return m.replace(/\/+/g, "/").replace(/\/$/, "")
|
||||
}).sort(alphasort).reduce(function (set, f) {
|
||||
if (f !== set[set.length - 1]) set.push(f)
|
||||
return set
|
||||
}, []).sort(alphasort).map(function (f) {
|
||||
// de-windows
|
||||
return (process.platform !== 'win32') ? f
|
||||
: f.replace(/^[a-zA-Z]:\\\\/, '/').replace(/\\/g, '/')
|
||||
})
|
||||
}
|
||||
|
||||
function flatten (chunks) {
|
||||
var s = 0
|
||||
chunks.forEach(function (c) { s += c.length })
|
||||
var out = new Buffer(s)
|
||||
s = 0
|
||||
chunks.forEach(function (c) {
|
||||
c.copy(out, s)
|
||||
s += c.length
|
||||
})
|
||||
|
||||
return out.toString().trim()
|
||||
}
|
||||
|
||||
function alphasort (a, b) {
|
||||
a = a.toLowerCase()
|
||||
b = b.toLowerCase()
|
||||
return a > b ? 1 : a < b ? -1 : 0
|
||||
}
|
63
node_modules/glob/test/bash-comparison.js
generated
vendored
Normal file
63
node_modules/glob/test/bash-comparison.js
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
// basic test
|
||||
// show that it does the same thing by default as the shell.
|
||||
var tap = require("tap")
|
||||
, child_process = require("child_process")
|
||||
, bashResults = require("./bash-results.json")
|
||||
, globs = Object.keys(bashResults)
|
||||
, glob = require("../")
|
||||
, path = require("path")
|
||||
|
||||
// run from the root of the project
|
||||
// this is usually where you're at anyway, but be sure.
|
||||
process.chdir(path.resolve(__dirname, ".."))
|
||||
|
||||
function alphasort (a, b) {
|
||||
a = a.toLowerCase()
|
||||
b = b.toLowerCase()
|
||||
return a > b ? 1 : a < b ? -1 : 0
|
||||
}
|
||||
|
||||
globs.forEach(function (pattern) {
|
||||
var expect = bashResults[pattern]
|
||||
// anything regarding the symlink thing will fail on windows, so just skip it
|
||||
if (process.platform === "win32" &&
|
||||
expect.some(function (m) {
|
||||
return /\/symlink\//.test(m)
|
||||
}))
|
||||
return
|
||||
|
||||
tap.test(pattern, function (t) {
|
||||
glob(pattern, function (er, matches) {
|
||||
if (er)
|
||||
throw er
|
||||
|
||||
// sort and unmark, just to match the shell results
|
||||
matches = cleanResults(matches)
|
||||
|
||||
t.deepEqual(matches, expect, pattern)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
tap.test(pattern + " sync", function (t) {
|
||||
var matches = cleanResults(glob.sync(pattern))
|
||||
|
||||
t.deepEqual(matches, expect, "should match shell")
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
function cleanResults (m) {
|
||||
// normalize discrepancies in ordering, duplication,
|
||||
// and ending slashes.
|
||||
return m.map(function (m) {
|
||||
return m.replace(/\/+/g, "/").replace(/\/$/, "")
|
||||
}).sort(alphasort).reduce(function (set, f) {
|
||||
if (f !== set[set.length - 1]) set.push(f)
|
||||
return set
|
||||
}, []).sort(alphasort).map(function (f) {
|
||||
// de-windows
|
||||
return (process.platform !== 'win32') ? f
|
||||
: f.replace(/^[a-zA-Z]:[\/\\]+/, '/').replace(/[\\\/]+/g, '/')
|
||||
})
|
||||
}
|
351
node_modules/glob/test/bash-results.json
generated
vendored
Normal file
351
node_modules/glob/test/bash-results.json
generated
vendored
Normal file
@ -0,0 +1,351 @@
|
||||
{
|
||||
"test/a/*/+(c|g)/./d": [
|
||||
"test/a/b/c/./d"
|
||||
],
|
||||
"test/a/**/[cg]/../[cg]": [
|
||||
"test/a/abcdef/g/../g",
|
||||
"test/a/abcfed/g/../g",
|
||||
"test/a/b/c/../c",
|
||||
"test/a/c/../c",
|
||||
"test/a/c/d/c/../c",
|
||||
"test/a/symlink/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c",
|
||||
"test/a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/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c"
|
||||
],
|
||||
"test/a/{b,c,d,e,f}/**/g": [],
|
||||
"test/a/b/**": [
|
||||
"test/a/b",
|
||||
"test/a/b/c",
|
||||
"test/a/b/c/d"
|
||||
],
|
||||
"test/**/g": [
|
||||
"test/a/abcdef/g",
|
||||
"test/a/abcfed/g"
|
||||
],
|
||||
"test/a/abc{fed,def}/g/h": [
|
||||
"test/a/abcdef/g/h",
|
||||
"test/a/abcfed/g/h"
|
||||
],
|
||||
"test/a/abc{fed/g,def}/**/": [
|
||||
"test/a/abcdef",
|
||||
"test/a/abcdef/g",
|
||||
"test/a/abcfed/g"
|
||||
],
|
||||
"test/a/abc{fed/g,def}/**///**/": [
|
||||
"test/a/abcdef",
|
||||
"test/a/abcdef/g",
|
||||
"test/a/abcfed/g"
|
||||
],
|
||||
"test/**/a/**/": [
|
||||
"test/a",
|
||||
"test/a/abcdef",
|
||||
"test/a/abcdef/g",
|
||||
"test/a/abcfed",
|
||||
"test/a/abcfed/g",
|
||||
"test/a/b",
|
||||
"test/a/b/c",
|
||||
"test/a/bc",
|
||||
"test/a/bc/e",
|
||||
"test/a/c",
|
||||
"test/a/c/d",
|
||||
"test/a/c/d/c",
|
||||
"test/a/cb",
|
||||
"test/a/cb/e",
|
||||
"test/a/symlink",
|
||||
"test/a/symlink/a",
|
||||
"test/a/symlink/a/b",
|
||||
"test/a/symlink/a/b/c",
|
||||
"test/a/symlink/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c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||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b"
|
||||
],
|
||||
"test/+(a|b|c)/a{/,bc*}/**": [
|
||||
"test/a/abcdef",
|
||||
"test/a/abcdef/g",
|
||||
"test/a/abcdef/g/h",
|
||||
"test/a/abcfed",
|
||||
"test/a/abcfed/g",
|
||||
"test/a/abcfed/g/h"
|
||||
],
|
||||
"test/*/*/*/f": [
|
||||
"test/a/bc/e/f",
|
||||
"test/a/cb/e/f"
|
||||
],
|
||||
"test/**/f": [
|
||||
"test/a/bc/e/f",
|
||||
"test/a/cb/e/f"
|
||||
],
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c//a/b/c////a/b/c/**/b/c/**": [
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a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/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b",
|
||||
"test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c"
|
||||
],
|
||||
"{./*/*,/tmp/glob-test/*}": [
|
||||
"./examples/g.js",
|
||||
"./examples/usr-local.js",
|
||||
"./node_modules/inherits",
|
||||
"./node_modules/minimatch",
|
||||
"./node_modules/mkdirp",
|
||||
"./node_modules/rimraf",
|
||||
"./node_modules/tap",
|
||||
"./test/00-setup.js",
|
||||
"./test/a",
|
||||
"./test/bash-comparison.js",
|
||||
"./test/bash-results.json",
|
||||
"./test/cwd-test.js",
|
||||
"./test/globstar-match.js",
|
||||
"./test/mark.js",
|
||||
"./test/new-glob-optional-options.js",
|
||||
"./test/nocase-nomagic.js",
|
||||
"./test/pause-resume.js",
|
||||
"./test/readme-issue.js",
|
||||
"./test/root-nomount.js",
|
||||
"./test/root.js",
|
||||
"./test/stat.js",
|
||||
"./test/zz-cleanup.js",
|
||||
"/tmp/glob-test/asdf",
|
||||
"/tmp/glob-test/bar",
|
||||
"/tmp/glob-test/baz",
|
||||
"/tmp/glob-test/foo",
|
||||
"/tmp/glob-test/quux",
|
||||
"/tmp/glob-test/qwer",
|
||||
"/tmp/glob-test/rewq"
|
||||
],
|
||||
"{/tmp/glob-test/*,*}": [
|
||||
"/tmp/glob-test/asdf",
|
||||
"/tmp/glob-test/bar",
|
||||
"/tmp/glob-test/baz",
|
||||
"/tmp/glob-test/foo",
|
||||
"/tmp/glob-test/quux",
|
||||
"/tmp/glob-test/qwer",
|
||||
"/tmp/glob-test/rewq",
|
||||
"examples",
|
||||
"glob.js",
|
||||
"LICENSE",
|
||||
"node_modules",
|
||||
"package.json",
|
||||
"README.md",
|
||||
"test"
|
||||
],
|
||||
"test/a/!(symlink)/**": [
|
||||
"test/a/abcdef",
|
||||
"test/a/abcdef/g",
|
||||
"test/a/abcdef/g/h",
|
||||
"test/a/abcfed",
|
||||
"test/a/abcfed/g",
|
||||
"test/a/abcfed/g/h",
|
||||
"test/a/b",
|
||||
"test/a/b/c",
|
||||
"test/a/b/c/d",
|
||||
"test/a/bc",
|
||||
"test/a/bc/e",
|
||||
"test/a/bc/e/f",
|
||||
"test/a/c",
|
||||
"test/a/c/d",
|
||||
"test/a/c/d/c",
|
||||
"test/a/c/d/c/b",
|
||||
"test/a/cb",
|
||||
"test/a/cb/e",
|
||||
"test/a/cb/e/f"
|
||||
]
|
||||
}
|
55
node_modules/glob/test/cwd-test.js
generated
vendored
Normal file
55
node_modules/glob/test/cwd-test.js
generated
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
var tap = require("tap")
|
||||
|
||||
var origCwd = process.cwd()
|
||||
process.chdir(__dirname)
|
||||
|
||||
tap.test("changing cwd and searching for **/d", function (t) {
|
||||
var glob = require('../')
|
||||
var path = require('path')
|
||||
t.test('.', function (t) {
|
||||
glob('**/d', function (er, matches) {
|
||||
t.ifError(er)
|
||||
t.like(matches, [ 'a/b/c/d', 'a/c/d' ])
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
t.test('a', function (t) {
|
||||
glob('**/d', {cwd:path.resolve('a')}, function (er, matches) {
|
||||
t.ifError(er)
|
||||
t.like(matches, [ 'b/c/d', 'c/d' ])
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
t.test('a/b', function (t) {
|
||||
glob('**/d', {cwd:path.resolve('a/b')}, function (er, matches) {
|
||||
t.ifError(er)
|
||||
t.like(matches, [ 'c/d' ])
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
t.test('a/b/', function (t) {
|
||||
glob('**/d', {cwd:path.resolve('a/b/')}, function (er, matches) {
|
||||
t.ifError(er)
|
||||
t.like(matches, [ 'c/d' ])
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
t.test('.', function (t) {
|
||||
glob('**/d', {cwd: process.cwd()}, function (er, matches) {
|
||||
t.ifError(er)
|
||||
t.like(matches, [ 'a/b/c/d', 'a/c/d' ])
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
t.test('cd -', function (t) {
|
||||
process.chdir(origCwd)
|
||||
t.end()
|
||||
})
|
||||
|
||||
t.end()
|
||||
})
|
19
node_modules/glob/test/globstar-match.js
generated
vendored
Normal file
19
node_modules/glob/test/globstar-match.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
var Glob = require("../glob.js").Glob
|
||||
var test = require('tap').test
|
||||
|
||||
test('globstar should not have dupe matches', function(t) {
|
||||
var pattern = 'a/**/[gh]'
|
||||
var g = new Glob(pattern, { cwd: __dirname })
|
||||
var matches = []
|
||||
g.on('match', function(m) {
|
||||
console.error('match %j', m)
|
||||
matches.push(m)
|
||||
})
|
||||
g.on('end', function(set) {
|
||||
console.error('set', set)
|
||||
matches = matches.sort()
|
||||
set = set.sort()
|
||||
t.same(matches, set, 'should have same set of matches')
|
||||
t.end()
|
||||
})
|
||||
})
|
118
node_modules/glob/test/mark.js
generated
vendored
Normal file
118
node_modules/glob/test/mark.js
generated
vendored
Normal file
@ -0,0 +1,118 @@
|
||||
var test = require("tap").test
|
||||
var glob = require('../')
|
||||
process.chdir(__dirname)
|
||||
|
||||
// expose timing issues
|
||||
var lag = 5
|
||||
glob.Glob.prototype._stat = function(o) { return function(f, cb) {
|
||||
var args = arguments
|
||||
setTimeout(function() {
|
||||
o.call(this, f, cb)
|
||||
}.bind(this), lag += 5)
|
||||
}}(glob.Glob.prototype._stat)
|
||||
|
||||
|
||||
test("mark, with **", function (t) {
|
||||
glob("a/*b*/**", {mark: true}, function (er, results) {
|
||||
if (er)
|
||||
throw er
|
||||
var expect =
|
||||
[ 'a/abcdef/',
|
||||
'a/abcdef/g/',
|
||||
'a/abcdef/g/h',
|
||||
'a/abcfed/',
|
||||
'a/abcfed/g/',
|
||||
'a/abcfed/g/h',
|
||||
'a/b/',
|
||||
'a/b/c/',
|
||||
'a/b/c/d',
|
||||
'a/bc/',
|
||||
'a/bc/e/',
|
||||
'a/bc/e/f',
|
||||
'a/cb/',
|
||||
'a/cb/e/',
|
||||
'a/cb/e/f' ]
|
||||
|
||||
t.same(results, expect)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
test("mark, no / on pattern", function (t) {
|
||||
glob("a/*", {mark: true}, function (er, results) {
|
||||
if (er)
|
||||
throw er
|
||||
var expect = [ 'a/abcdef/',
|
||||
'a/abcfed/',
|
||||
'a/b/',
|
||||
'a/bc/',
|
||||
'a/c/',
|
||||
'a/cb/' ]
|
||||
|
||||
if (process.platform !== "win32")
|
||||
expect.push('a/symlink/')
|
||||
|
||||
t.same(results, expect)
|
||||
t.end()
|
||||
}).on('match', function(m) {
|
||||
t.similar(m, /\/$/)
|
||||
})
|
||||
})
|
||||
|
||||
test("mark=false, no / on pattern", function (t) {
|
||||
glob("a/*", function (er, results) {
|
||||
if (er)
|
||||
throw er
|
||||
var expect = [ 'a/abcdef',
|
||||
'a/abcfed',
|
||||
'a/b',
|
||||
'a/bc',
|
||||
'a/c',
|
||||
'a/cb' ]
|
||||
|
||||
if (process.platform !== "win32")
|
||||
expect.push('a/symlink')
|
||||
t.same(results, expect)
|
||||
t.end()
|
||||
}).on('match', function(m) {
|
||||
t.similar(m, /[^\/]$/)
|
||||
})
|
||||
})
|
||||
|
||||
test("mark=true, / on pattern", function (t) {
|
||||
glob("a/*/", {mark: true}, function (er, results) {
|
||||
if (er)
|
||||
throw er
|
||||
var expect = [ 'a/abcdef/',
|
||||
'a/abcfed/',
|
||||
'a/b/',
|
||||
'a/bc/',
|
||||
'a/c/',
|
||||
'a/cb/' ]
|
||||
if (process.platform !== "win32")
|
||||
expect.push('a/symlink/')
|
||||
t.same(results, expect)
|
||||
t.end()
|
||||
}).on('match', function(m) {
|
||||
t.similar(m, /\/$/)
|
||||
})
|
||||
})
|
||||
|
||||
test("mark=false, / on pattern", function (t) {
|
||||
glob("a/*/", function (er, results) {
|
||||
if (er)
|
||||
throw er
|
||||
var expect = [ 'a/abcdef/',
|
||||
'a/abcfed/',
|
||||
'a/b/',
|
||||
'a/bc/',
|
||||
'a/c/',
|
||||
'a/cb/' ]
|
||||
if (process.platform !== "win32")
|
||||
expect.push('a/symlink/')
|
||||
t.same(results, expect)
|
||||
t.end()
|
||||
}).on('match', function(m) {
|
||||
t.similar(m, /\/$/)
|
||||
})
|
||||
})
|
10
node_modules/glob/test/new-glob-optional-options.js
generated
vendored
Normal file
10
node_modules/glob/test/new-glob-optional-options.js
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
var Glob = require('../glob.js').Glob;
|
||||
var test = require('tap').test;
|
||||
|
||||
test('new glob, with cb, and no options', function (t) {
|
||||
new Glob(__filename, function(er, results) {
|
||||
if (er) throw er;
|
||||
t.same(results, [__filename]);
|
||||
t.end();
|
||||
});
|
||||
});
|
113
node_modules/glob/test/nocase-nomagic.js
generated
vendored
Normal file
113
node_modules/glob/test/nocase-nomagic.js
generated
vendored
Normal file
@ -0,0 +1,113 @@
|
||||
var fs = require('fs');
|
||||
var test = require('tap').test;
|
||||
var glob = require('../');
|
||||
|
||||
test('mock fs', function(t) {
|
||||
var stat = fs.stat
|
||||
var statSync = fs.statSync
|
||||
var readdir = fs.readdir
|
||||
var readdirSync = fs.readdirSync
|
||||
|
||||
function fakeStat(path) {
|
||||
var ret
|
||||
switch (path.toLowerCase()) {
|
||||
case '/tmp': case '/tmp/':
|
||||
ret = { isDirectory: function() { return true } }
|
||||
break
|
||||
case '/tmp/a':
|
||||
ret = { isDirectory: function() { return false } }
|
||||
break
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
fs.stat = function(path, cb) {
|
||||
var f = fakeStat(path);
|
||||
if (f) {
|
||||
process.nextTick(function() {
|
||||
cb(null, f)
|
||||
})
|
||||
} else {
|
||||
stat.call(fs, path, cb)
|
||||
}
|
||||
}
|
||||
|
||||
fs.statSync = function(path) {
|
||||
return fakeStat(path) || statSync.call(fs, path)
|
||||
}
|
||||
|
||||
function fakeReaddir(path) {
|
||||
var ret
|
||||
switch (path.toLowerCase()) {
|
||||
case '/tmp': case '/tmp/':
|
||||
ret = [ 'a', 'A' ]
|
||||
break
|
||||
case '/':
|
||||
ret = ['tmp', 'tMp', 'tMP', 'TMP']
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
fs.readdir = function(path, cb) {
|
||||
var f = fakeReaddir(path)
|
||||
if (f)
|
||||
process.nextTick(function() {
|
||||
cb(null, f)
|
||||
})
|
||||
else
|
||||
readdir.call(fs, path, cb)
|
||||
}
|
||||
|
||||
fs.readdirSync = function(path) {
|
||||
return fakeReaddir(path) || readdirSync.call(fs, path)
|
||||
}
|
||||
|
||||
t.pass('mocked')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('nocase, nomagic', function(t) {
|
||||
var n = 2
|
||||
var want = [ '/TMP/A',
|
||||
'/TMP/a',
|
||||
'/tMP/A',
|
||||
'/tMP/a',
|
||||
'/tMp/A',
|
||||
'/tMp/a',
|
||||
'/tmp/A',
|
||||
'/tmp/a' ]
|
||||
glob('/tmp/a', { nocase: true }, function(er, res) {
|
||||
if (er)
|
||||
throw er
|
||||
t.same(res.sort(), want)
|
||||
if (--n === 0) t.end()
|
||||
})
|
||||
glob('/tmp/A', { nocase: true }, function(er, res) {
|
||||
if (er)
|
||||
throw er
|
||||
t.same(res.sort(), want)
|
||||
if (--n === 0) t.end()
|
||||
})
|
||||
})
|
||||
|
||||
test('nocase, with some magic', function(t) {
|
||||
t.plan(2)
|
||||
var want = [ '/TMP/A',
|
||||
'/TMP/a',
|
||||
'/tMP/A',
|
||||
'/tMP/a',
|
||||
'/tMp/A',
|
||||
'/tMp/a',
|
||||
'/tmp/A',
|
||||
'/tmp/a' ]
|
||||
glob('/tmp/*', { nocase: true }, function(er, res) {
|
||||
if (er)
|
||||
throw er
|
||||
t.same(res.sort(), want)
|
||||
})
|
||||
glob('/tmp/*', { nocase: true }, function(er, res) {
|
||||
if (er)
|
||||
throw er
|
||||
t.same(res.sort(), want)
|
||||
})
|
||||
})
|
73
node_modules/glob/test/pause-resume.js
generated
vendored
Normal file
73
node_modules/glob/test/pause-resume.js
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
// show that no match events happen while paused.
|
||||
var tap = require("tap")
|
||||
, child_process = require("child_process")
|
||||
// just some gnarly pattern with lots of matches
|
||||
, pattern = "test/a/!(symlink)/**"
|
||||
, bashResults = require("./bash-results.json")
|
||||
, patterns = Object.keys(bashResults)
|
||||
, glob = require("../")
|
||||
, Glob = glob.Glob
|
||||
, path = require("path")
|
||||
|
||||
// run from the root of the project
|
||||
// this is usually where you're at anyway, but be sure.
|
||||
process.chdir(path.resolve(__dirname, ".."))
|
||||
|
||||
function alphasort (a, b) {
|
||||
a = a.toLowerCase()
|
||||
b = b.toLowerCase()
|
||||
return a > b ? 1 : a < b ? -1 : 0
|
||||
}
|
||||
|
||||
function cleanResults (m) {
|
||||
// normalize discrepancies in ordering, duplication,
|
||||
// and ending slashes.
|
||||
return m.map(function (m) {
|
||||
return m.replace(/\/+/g, "/").replace(/\/$/, "")
|
||||
}).sort(alphasort).reduce(function (set, f) {
|
||||
if (f !== set[set.length - 1]) set.push(f)
|
||||
return set
|
||||
}, []).sort(alphasort).map(function (f) {
|
||||
// de-windows
|
||||
return (process.platform !== 'win32') ? f
|
||||
: f.replace(/^[a-zA-Z]:\\\\/, '/').replace(/\\/g, '/')
|
||||
})
|
||||
}
|
||||
|
||||
var globResults = []
|
||||
tap.test("use a Glob object, and pause/resume it", function (t) {
|
||||
var g = new Glob(pattern)
|
||||
, paused = false
|
||||
, res = []
|
||||
, expect = bashResults[pattern]
|
||||
|
||||
g.on("pause", function () {
|
||||
console.error("pause")
|
||||
})
|
||||
|
||||
g.on("resume", function () {
|
||||
console.error("resume")
|
||||
})
|
||||
|
||||
g.on("match", function (m) {
|
||||
t.notOk(g.paused, "must not be paused")
|
||||
globResults.push(m)
|
||||
g.pause()
|
||||
t.ok(g.paused, "must be paused")
|
||||
setTimeout(g.resume.bind(g), 10)
|
||||
})
|
||||
|
||||
g.on("end", function (matches) {
|
||||
t.pass("reached glob end")
|
||||
globResults = cleanResults(globResults)
|
||||
matches = cleanResults(matches)
|
||||
t.deepEqual(matches, globResults,
|
||||
"end event matches should be the same as match events")
|
||||
|
||||
t.deepEqual(matches, expect,
|
||||
"glob matches should be the same as bash results")
|
||||
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
36
node_modules/glob/test/readme-issue.js
generated
vendored
Normal file
36
node_modules/glob/test/readme-issue.js
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
var test = require("tap").test
|
||||
var glob = require("../")
|
||||
|
||||
var mkdirp = require("mkdirp")
|
||||
var fs = require("fs")
|
||||
var rimraf = require("rimraf")
|
||||
var dir = __dirname + "/package"
|
||||
|
||||
test("setup", function (t) {
|
||||
mkdirp.sync(dir)
|
||||
fs.writeFileSync(dir + "/package.json", "{}", "ascii")
|
||||
fs.writeFileSync(dir + "/README", "x", "ascii")
|
||||
t.pass("setup done")
|
||||
t.end()
|
||||
})
|
||||
|
||||
test("glob", function (t) {
|
||||
var opt = {
|
||||
cwd: dir,
|
||||
nocase: true,
|
||||
mark: true
|
||||
}
|
||||
|
||||
glob("README?(.*)", opt, function (er, files) {
|
||||
if (er)
|
||||
throw er
|
||||
t.same(files, ["README"])
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
test("cleanup", function (t) {
|
||||
rimraf.sync(dir)
|
||||
t.pass("clean")
|
||||
t.end()
|
||||
})
|
39
node_modules/glob/test/root-nomount.js
generated
vendored
Normal file
39
node_modules/glob/test/root-nomount.js
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
var tap = require("tap")
|
||||
|
||||
var origCwd = process.cwd()
|
||||
process.chdir(__dirname)
|
||||
|
||||
tap.test("changing root and searching for /b*/**", function (t) {
|
||||
var glob = require('../')
|
||||
var path = require('path')
|
||||
t.test('.', function (t) {
|
||||
glob('/b*/**', { globDebug: true, root: '.', nomount: true }, function (er, matches) {
|
||||
t.ifError(er)
|
||||
t.like(matches, [])
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
t.test('a', function (t) {
|
||||
glob('/b*/**', { globDebug: true, root: path.resolve('a'), nomount: true }, function (er, matches) {
|
||||
t.ifError(er)
|
||||
t.like(matches, [ '/b', '/b/c', '/b/c/d', '/bc', '/bc/e', '/bc/e/f' ])
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
t.test('root=a, cwd=a/b', function (t) {
|
||||
glob('/b*/**', { globDebug: true, root: 'a', cwd: path.resolve('a/b'), nomount: true }, function (er, matches) {
|
||||
t.ifError(er)
|
||||
t.like(matches, [ '/b', '/b/c', '/b/c/d', '/bc', '/bc/e', '/bc/e/f' ])
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
t.test('cd -', function (t) {
|
||||
process.chdir(origCwd)
|
||||
t.end()
|
||||
})
|
||||
|
||||
t.end()
|
||||
})
|
46
node_modules/glob/test/root.js
generated
vendored
Normal file
46
node_modules/glob/test/root.js
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
var t = require("tap")
|
||||
|
||||
var origCwd = process.cwd()
|
||||
process.chdir(__dirname)
|
||||
|
||||
var glob = require('../')
|
||||
var path = require('path')
|
||||
|
||||
t.test('.', function (t) {
|
||||
glob('/b*/**', { globDebug: true, root: '.' }, function (er, matches) {
|
||||
t.ifError(er)
|
||||
t.like(matches, [])
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
t.test('a', function (t) {
|
||||
console.error("root=" + path.resolve('a'))
|
||||
glob('/b*/**', { globDebug: true, root: path.resolve('a') }, function (er, matches) {
|
||||
t.ifError(er)
|
||||
var wanted = [
|
||||
'/b', '/b/c', '/b/c/d', '/bc', '/bc/e', '/bc/e/f'
|
||||
].map(function (m) {
|
||||
return path.join(path.resolve('a'), m).replace(/\\/g, '/')
|
||||
})
|
||||
|
||||
t.like(matches, wanted)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
t.test('root=a, cwd=a/b', function (t) {
|
||||
glob('/b*/**', { globDebug: true, root: 'a', cwd: path.resolve('a/b') }, function (er, matches) {
|
||||
t.ifError(er)
|
||||
t.like(matches, [ '/b', '/b/c', '/b/c/d', '/bc', '/bc/e', '/bc/e/f' ].map(function (m) {
|
||||
return path.join(path.resolve('a'), m).replace(/\\/g, '/')
|
||||
}))
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
t.test('cd -', function (t) {
|
||||
process.chdir(origCwd)
|
||||
t.end()
|
||||
})
|
32
node_modules/glob/test/stat.js
generated
vendored
Normal file
32
node_modules/glob/test/stat.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
var glob = require('../')
|
||||
var test = require('tap').test
|
||||
var path = require('path')
|
||||
|
||||
test('stat all the things', function(t) {
|
||||
var g = new glob.Glob('a/*abc*/**', { stat: true, cwd: __dirname })
|
||||
var matches = []
|
||||
g.on('match', function(m) {
|
||||
matches.push(m)
|
||||
})
|
||||
var stats = []
|
||||
g.on('stat', function(m) {
|
||||
stats.push(m)
|
||||
})
|
||||
g.on('end', function(eof) {
|
||||
stats = stats.sort()
|
||||
matches = matches.sort()
|
||||
eof = eof.sort()
|
||||
t.same(stats, matches)
|
||||
t.same(eof, matches)
|
||||
var cache = Object.keys(this.statCache)
|
||||
t.same(cache.map(function (f) {
|
||||
return path.relative(__dirname, f)
|
||||
}).sort(), matches)
|
||||
|
||||
cache.forEach(function(c) {
|
||||
t.equal(typeof this.statCache[c], 'object')
|
||||
}, this)
|
||||
|
||||
t.end()
|
||||
})
|
||||
})
|
11
node_modules/glob/test/zz-cleanup.js
generated
vendored
Normal file
11
node_modules/glob/test/zz-cleanup.js
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
// remove the fixtures
|
||||
var tap = require("tap")
|
||||
, rimraf = require("rimraf")
|
||||
, path = require("path")
|
||||
|
||||
tap.test("cleanup fixtures", function (t) {
|
||||
rimraf(path.resolve(__dirname, "a"), function (er) {
|
||||
t.ifError(er, "removed")
|
||||
t.end()
|
||||
})
|
||||
})
|
63
node_modules/growl/History.md
generated
vendored
Normal file
63
node_modules/growl/History.md
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
|
||||
1.7.0 / 2012-12-30
|
||||
==================
|
||||
|
||||
* support transient notifications in Gnome
|
||||
|
||||
1.6.1 / 2012-09-25
|
||||
==================
|
||||
|
||||
* restore compatibility with node < 0.8 [fgnass]
|
||||
|
||||
1.6.0 / 2012-09-06
|
||||
==================
|
||||
|
||||
* add notification center support [drudge]
|
||||
|
||||
1.5.1 / 2012-04-08
|
||||
==================
|
||||
|
||||
* Merge pull request #16 from KyleAMathews/patch-1
|
||||
* Fixes #15
|
||||
|
||||
1.5.0 / 2012-02-08
|
||||
==================
|
||||
|
||||
* Added windows support [perfusorius]
|
||||
|
||||
1.4.1 / 2011-12-28
|
||||
==================
|
||||
|
||||
* Fixed: dont exit(). Closes #9
|
||||
|
||||
1.4.0 / 2011-12-17
|
||||
==================
|
||||
|
||||
* Changed API: `growl.notify()` -> `growl()`
|
||||
|
||||
1.3.0 / 2011-12-17
|
||||
==================
|
||||
|
||||
* Added support for Ubuntu/Debian/Linux users [niftylettuce]
|
||||
* Fixed: send notifications even if title not specified [alessioalex]
|
||||
|
||||
1.2.0 / 2011-10-06
|
||||
==================
|
||||
|
||||
* Add support for priority.
|
||||
|
||||
1.1.0 / 2011-03-15
|
||||
==================
|
||||
|
||||
* Added optional callbacks
|
||||
* Added parsing of version
|
||||
|
||||
1.0.1 / 2010-03-26
|
||||
==================
|
||||
|
||||
* Fixed; sys.exec -> child_process.exec to support latest node
|
||||
|
||||
1.0.0 / 2010-03-19
|
||||
==================
|
||||
|
||||
* Initial release
|
108
node_modules/growl/Readme.md
generated
vendored
Normal file
108
node_modules/growl/Readme.md
generated
vendored
Normal file
@ -0,0 +1,108 @@
|
||||
# Growl for nodejs
|
||||
|
||||
Growl support for Nodejs. This is essentially a port of my [Ruby Growl Library](http://github.com/visionmedia/growl). Ubuntu/Linux support added thanks to [@niftylettuce](http://github.com/niftylettuce).
|
||||
|
||||
## Installation
|
||||
|
||||
### Install
|
||||
|
||||
### Mac OS X (Darwin):
|
||||
|
||||
Install [growlnotify(1)](http://growl.info/extras.php#growlnotify). On OS X 10.8, Notification Center is supported using [terminal-notifier](https://github.com/alloy/terminal-notifier). To install:
|
||||
|
||||
$ sudo gem install terminal-notifier
|
||||
|
||||
Install [npm](http://npmjs.org/) and run:
|
||||
|
||||
$ npm install growl
|
||||
|
||||
### Ubuntu (Linux):
|
||||
|
||||
Install `notify-send` through the [libnotify-bin](http://packages.ubuntu.com/libnotify-bin) package:
|
||||
|
||||
$ sudo apt-get install libnotify-bin
|
||||
|
||||
Install [npm](http://npmjs.org/) and run:
|
||||
|
||||
$ npm install growl
|
||||
|
||||
### Windows:
|
||||
|
||||
Download and install [Growl for Windows](http://www.growlforwindows.com/gfw/default.aspx)
|
||||
|
||||
Download [growlnotify](http://www.growlforwindows.com/gfw/help/growlnotify.aspx) - **IMPORTANT :** Unpack growlnotify to a folder that is present in your path!
|
||||
|
||||
Install [npm](http://npmjs.org/) and run:
|
||||
|
||||
$ npm install growl
|
||||
|
||||
## Examples
|
||||
|
||||
Callback functions are optional
|
||||
|
||||
```javascript
|
||||
var growl = require('growl')
|
||||
growl('You have mail!')
|
||||
growl('5 new messages', { sticky: true })
|
||||
growl('5 new emails', { title: 'Email Client', image: 'Safari', sticky: true })
|
||||
growl('Message with title', { title: 'Title'})
|
||||
growl('Set priority', { priority: 2 })
|
||||
growl('Show Safari icon', { image: 'Safari' })
|
||||
growl('Show icon', { image: 'path/to/icon.icns' })
|
||||
growl('Show image', { image: 'path/to/my.image.png' })
|
||||
growl('Show png filesystem icon', { image: 'png' })
|
||||
growl('Show pdf filesystem icon', { image: 'article.pdf' })
|
||||
growl('Show pdf filesystem icon', { image: 'article.pdf' }, function(err){
|
||||
// ... notified
|
||||
})
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
- title
|
||||
- notification title
|
||||
- name
|
||||
- application name
|
||||
- priority
|
||||
- priority for the notification (default is 0)
|
||||
- sticky
|
||||
- weither or not the notification should remainin until closed
|
||||
- image
|
||||
- Auto-detects the context:
|
||||
- path to an icon sets --iconpath
|
||||
- path to an image sets --image
|
||||
- capitalized word sets --appIcon
|
||||
- filename uses extname as --icon
|
||||
- otherwise treated as --icon
|
||||
- exec
|
||||
- manually specify a shell command instead
|
||||
- appends message to end of shell command
|
||||
- or, replaces `%s` with message
|
||||
- optionally prepends title (example: `title: message`)
|
||||
- examples: `{exec: 'tmux display-message'}`, `{exec: 'echo "%s" > messages.log}`
|
||||
|
||||
## License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2009 TJ Holowaychuk <tj@vision-media.ca>
|
||||
Copyright (c) 2016 Joshua Boy Nicolai Appelman <joshua@jbna.nl>
|
||||
|
||||
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.
|
290
node_modules/growl/lib/growl.js
generated
vendored
Normal file
290
node_modules/growl/lib/growl.js
generated
vendored
Normal file
@ -0,0 +1,290 @@
|
||||
// Growl - Copyright TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed)
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var exec = require('child_process').exec
|
||||
, fs = require('fs')
|
||||
, path = require('path')
|
||||
, exists = fs.existsSync || path.existsSync
|
||||
, os = require('os')
|
||||
, quote = JSON.stringify
|
||||
, cmd;
|
||||
|
||||
function which(name) {
|
||||
var paths = process.env.PATH.split(':');
|
||||
var loc;
|
||||
|
||||
for (var i = 0, len = paths.length; i < len; ++i) {
|
||||
loc = path.join(paths[i], name);
|
||||
if (exists(loc)) return loc;
|
||||
}
|
||||
}
|
||||
|
||||
switch(os.type()) {
|
||||
case 'Darwin':
|
||||
if (which('terminal-notifier')) {
|
||||
cmd = {
|
||||
type: "Darwin-NotificationCenter"
|
||||
, pkg: "terminal-notifier"
|
||||
, msg: '-message'
|
||||
, title: '-title'
|
||||
, subtitle: '-subtitle'
|
||||
, icon: '-appIcon'
|
||||
, sound: '-sound'
|
||||
, url: '-open'
|
||||
, priority: {
|
||||
cmd: '-execute'
|
||||
, range: []
|
||||
}
|
||||
};
|
||||
} else {
|
||||
cmd = {
|
||||
type: "Darwin-Growl"
|
||||
, pkg: "growlnotify"
|
||||
, msg: '-m'
|
||||
, sticky: '--sticky'
|
||||
, priority: {
|
||||
cmd: '--priority'
|
||||
, range: [
|
||||
-2
|
||||
, -1
|
||||
, 0
|
||||
, 1
|
||||
, 2
|
||||
, "Very Low"
|
||||
, "Moderate"
|
||||
, "Normal"
|
||||
, "High"
|
||||
, "Emergency"
|
||||
]
|
||||
}
|
||||
};
|
||||
}
|
||||
break;
|
||||
case 'Linux':
|
||||
if (which('growl')) {
|
||||
cmd = {
|
||||
type: "Linux-Growl"
|
||||
, pkg: "growl"
|
||||
, msg: '-m'
|
||||
, title: '-title'
|
||||
, subtitle: '-subtitle'
|
||||
, host: {
|
||||
cmd: '-H'
|
||||
, hostname: '192.168.33.1'
|
||||
}
|
||||
};
|
||||
} else {
|
||||
cmd = {
|
||||
type: "Linux"
|
||||
, pkg: "notify-send"
|
||||
, msg: ''
|
||||
, sticky: '-t 0'
|
||||
, icon: '-i'
|
||||
, priority: {
|
||||
cmd: '-u'
|
||||
, range: [
|
||||
"low"
|
||||
, "normal"
|
||||
, "critical"
|
||||
]
|
||||
}
|
||||
};
|
||||
}
|
||||
break;
|
||||
case 'Windows_NT':
|
||||
cmd = {
|
||||
type: "Windows"
|
||||
, pkg: "growlnotify"
|
||||
, msg: ''
|
||||
, sticky: '/s:true'
|
||||
, title: '/t:'
|
||||
, icon: '/i:'
|
||||
, url: '/cu:'
|
||||
, priority: {
|
||||
cmd: '/p:'
|
||||
, range: [
|
||||
-2
|
||||
, -1
|
||||
, 0
|
||||
, 1
|
||||
, 2
|
||||
]
|
||||
}
|
||||
};
|
||||
break;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expose `growl`.
|
||||
*/
|
||||
|
||||
exports = module.exports = growl;
|
||||
|
||||
/**
|
||||
* Node-growl version.
|
||||
*/
|
||||
|
||||
exports.version = '1.4.1'
|
||||
|
||||
/**
|
||||
* Send growl notification _msg_ with _options_.
|
||||
*
|
||||
* Options:
|
||||
*
|
||||
* - title Notification title
|
||||
* - sticky Make the notification stick (defaults to false)
|
||||
* - priority Specify an int or named key (default is 0)
|
||||
* - name Application name (defaults to growlnotify)
|
||||
* - sound Sound efect ( in OSx defined in preferences -> sound -> effects) * works only in OSX > 10.8x
|
||||
* - image
|
||||
* - path to an icon sets --iconpath
|
||||
* - path to an image sets --image
|
||||
* - capitalized word sets --appIcon
|
||||
* - filename uses extname as --icon
|
||||
* - otherwise treated as --icon
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* growl('New email')
|
||||
* growl('5 new emails', { title: 'Thunderbird' })
|
||||
* growl('5 new emails', { title: 'Thunderbird', sound: 'Purr' })
|
||||
* growl('Email sent', function(){
|
||||
* // ... notification sent
|
||||
* })
|
||||
*
|
||||
* @param {string} msg
|
||||
* @param {object} options
|
||||
* @param {function} fn
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function growl(msg, options, fn) {
|
||||
var image
|
||||
, args
|
||||
, options = options || {}
|
||||
, fn = fn || function(){};
|
||||
|
||||
if (options.exec) {
|
||||
cmd = {
|
||||
type: "Custom"
|
||||
, pkg: options.exec
|
||||
, range: []
|
||||
};
|
||||
}
|
||||
|
||||
// noop
|
||||
if (!cmd) return fn(new Error('growl not supported on this platform'));
|
||||
args = [cmd.pkg];
|
||||
|
||||
// image
|
||||
if (image = options.image) {
|
||||
switch(cmd.type) {
|
||||
case 'Darwin-Growl':
|
||||
var flag, ext = path.extname(image).substr(1)
|
||||
flag = flag || ext == 'icns' && 'iconpath'
|
||||
flag = flag || /^[A-Z]/.test(image) && 'appIcon'
|
||||
flag = flag || /^png|gif|jpe?g$/.test(ext) && 'image'
|
||||
flag = flag || ext && (image = ext) && 'icon'
|
||||
flag = flag || 'icon'
|
||||
args.push('--' + flag, quote(image))
|
||||
break;
|
||||
case 'Darwin-NotificationCenter':
|
||||
args.push(cmd.icon, quote(image));
|
||||
break;
|
||||
case 'Linux':
|
||||
args.push(cmd.icon, quote(image));
|
||||
// libnotify defaults to sticky, set a hint for transient notifications
|
||||
if (!options.sticky) args.push('--hint=int:transient:1');
|
||||
break;
|
||||
case 'Windows':
|
||||
args.push(cmd.icon + quote(image));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// sticky
|
||||
if (options.sticky) args.push(cmd.sticky);
|
||||
|
||||
// priority
|
||||
if (options.priority) {
|
||||
var priority = options.priority + '';
|
||||
var checkindexOf = cmd.priority.range.indexOf(priority);
|
||||
if (~cmd.priority.range.indexOf(priority)) {
|
||||
args.push(cmd.priority, options.priority);
|
||||
}
|
||||
}
|
||||
|
||||
//sound
|
||||
if(options.sound && cmd.type === 'Darwin-NotificationCenter'){
|
||||
args.push(cmd.sound, options.sound)
|
||||
}
|
||||
|
||||
// name
|
||||
if (options.name && cmd.type === "Darwin-Growl") {
|
||||
args.push('--name', options.name);
|
||||
}
|
||||
|
||||
switch(cmd.type) {
|
||||
case 'Darwin-Growl':
|
||||
args.push(cmd.msg);
|
||||
args.push(quote(msg).replace(/\\n/g, '\n'));
|
||||
if (options.title) args.push(quote(options.title));
|
||||
break;
|
||||
case 'Darwin-NotificationCenter':
|
||||
args.push(cmd.msg);
|
||||
var stringifiedMsg = quote(msg);
|
||||
var escapedMsg = stringifiedMsg.replace(/\\n/g, '\n');
|
||||
args.push(escapedMsg);
|
||||
if (options.title) {
|
||||
args.push(cmd.title);
|
||||
args.push(quote(options.title));
|
||||
}
|
||||
if (options.subtitle) {
|
||||
args.push(cmd.subtitle);
|
||||
args.push(quote(options.subtitle));
|
||||
}
|
||||
if (options.url) {
|
||||
args.push(cmd.url);
|
||||
args.push(quote(options.url));
|
||||
}
|
||||
break;
|
||||
case 'Linux-Growl':
|
||||
args.push(cmd.msg);
|
||||
args.push(quote(msg).replace(/\\n/g, '\n'));
|
||||
if (options.title) args.push(quote(options.title));
|
||||
if (cmd.host) {
|
||||
args.push(cmd.host.cmd, cmd.host.hostname)
|
||||
}
|
||||
break;
|
||||
case 'Linux':
|
||||
if (options.title) {
|
||||
args.push(quote(options.title));
|
||||
args.push(cmd.msg);
|
||||
args.push(quote(msg).replace(/\\n/g, '\n'));
|
||||
} else {
|
||||
args.push(quote(msg).replace(/\\n/g, '\n'));
|
||||
}
|
||||
break;
|
||||
case 'Windows':
|
||||
args.push(quote(msg).replace(/\\n/g, '\n'));
|
||||
if (options.title) args.push(cmd.title + quote(options.title));
|
||||
if (options.url) args.push(cmd.url + quote(options.url));
|
||||
break;
|
||||
case 'Custom':
|
||||
args[0] = (function(origCommand) {
|
||||
var message = options.title
|
||||
? options.title + ': ' + msg
|
||||
: msg;
|
||||
var command = origCommand.replace(/(^|[^%])%s/g, '$1' + quote(message));
|
||||
if (command === origCommand) args.push(quote(message));
|
||||
return command;
|
||||
})(args[0]);
|
||||
break;
|
||||
}
|
||||
|
||||
// execute
|
||||
exec(args.join(' '), fn);
|
||||
};
|
50
node_modules/growl/package.json
generated
vendored
Normal file
50
node_modules/growl/package.json
generated
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
{
|
||||
"_from": "growl@1.9.2",
|
||||
"_id": "growl@1.9.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8=",
|
||||
"_location": "/growl",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "growl@1.9.2",
|
||||
"name": "growl",
|
||||
"escapedName": "growl",
|
||||
"rawSpec": "1.9.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.9.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/mocha"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/growl/-/growl-1.9.2.tgz",
|
||||
"_shasum": "0ea7743715db8d8de2c5ede1775e1b45ac85c02f",
|
||||
"_spec": "growl@1.9.2",
|
||||
"_where": "/home/clemens/Dokumente/git/pixelnode/node_modules/mocha",
|
||||
"author": {
|
||||
"name": "TJ Holowaychuk",
|
||||
"email": "tj@vision-media.ca"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/tj/node-growl/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Growl unobtrusive notifications",
|
||||
"homepage": "https://github.com/tj/node-growl#readme",
|
||||
"license": "MIT",
|
||||
"main": "./lib/growl.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Joshua Boy Nicolai Appelman",
|
||||
"email": "joshua@jbnicolai.nl"
|
||||
}
|
||||
],
|
||||
"name": "growl",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/tj/node-growl.git"
|
||||
},
|
||||
"version": "1.9.2"
|
||||
}
|
31
node_modules/growl/test.js
generated
vendored
Normal file
31
node_modules/growl/test.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
var growl = require('./lib/growl')
|
||||
|
||||
growl('Support sound notifications', {title: 'Make a sound', sound: 'purr'});
|
||||
growl('You have mail!')
|
||||
growl('5 new messages', { sticky: true })
|
||||
growl('5 new emails', { title: 'Email Client', image: 'Safari', sticky: true })
|
||||
growl('Message with title', { title: 'Title'})
|
||||
growl('Set priority', { priority: 2 })
|
||||
growl('Show Safari icon', { image: 'Safari' })
|
||||
growl('Show icon', { image: 'path/to/icon.icns' })
|
||||
growl('Show image', { image: 'path/to/my.image.png' })
|
||||
growl('Show png filesystem icon', { image: 'png' })
|
||||
growl('Show pdf filesystem icon', { image: 'article.pdf' })
|
||||
growl('Show pdf filesystem icon', { image: 'article.pdf' }, function(){
|
||||
console.log('callback');
|
||||
})
|
||||
growl('Show pdf filesystem icon', { title: 'Use show()', image: 'article.pdf' })
|
||||
growl('here \' are \n some \\ characters that " need escaping', {}, function(error, stdout, stderr) {
|
||||
if (error !== null) throw new Error('escaping failed:\n' + stdout + stderr);
|
||||
})
|
||||
growl('Allow custom notifiers', { exec: 'echo XXX %s' }, function(error, stdout, stderr) {
|
||||
console.log(stdout);
|
||||
})
|
||||
growl('Allow custom notifiers', { title: 'test', exec: 'echo YYY' }, function(error, stdout, stderr) {
|
||||
console.log(stdout);
|
||||
})
|
||||
growl('Allow custom notifiers', { title: 'test', exec: 'echo ZZZ %s' }, function(error, stdout, stderr) {
|
||||
console.log(stdout);
|
||||
})
|
||||
growl('Open a URL', { url: 'https://npmjs.org/package/growl' });
|
15
node_modules/jade/.npmignore
generated
vendored
Normal file
15
node_modules/jade/.npmignore
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
test
|
||||
support
|
||||
benchmarks
|
||||
examples
|
||||
lib-cov
|
||||
coverage.html
|
||||
.gitmodules
|
||||
.travis.yml
|
||||
History.md
|
||||
Readme.md
|
||||
Makefile
|
||||
test/
|
||||
support/
|
||||
benchmarks/
|
||||
examples/
|
22
node_modules/jade/LICENSE
generated
vendored
Normal file
22
node_modules/jade/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2009-2010 TJ Holowaychuk <tj@vision-media.ca>
|
||||
|
||||
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.
|
147
node_modules/jade/bin/jade
generated
vendored
Executable file
147
node_modules/jade/bin/jade
generated
vendored
Executable file
@ -0,0 +1,147 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var fs = require('fs')
|
||||
, program = require('commander')
|
||||
, path = require('path')
|
||||
, basename = path.basename
|
||||
, dirname = path.dirname
|
||||
, resolve = path.resolve
|
||||
, join = path.join
|
||||
, mkdirp = require('mkdirp')
|
||||
, jade = require('../');
|
||||
|
||||
// jade options
|
||||
|
||||
var options = {};
|
||||
|
||||
// options
|
||||
|
||||
program
|
||||
.version(jade.version)
|
||||
.usage('[options] [dir|file ...]')
|
||||
.option('-o, --obj <str>', 'javascript options object')
|
||||
.option('-O, --out <dir>', 'output the compiled html to <dir>')
|
||||
.option('-p, --path <path>', 'filename used to resolve includes')
|
||||
.option('-P, --pretty', 'compile pretty html output')
|
||||
.option('-c, --client', 'compile for client-side runtime.js')
|
||||
.option('-D, --no-debug', 'compile without debugging (smaller functions)')
|
||||
|
||||
program.on('--help', function(){
|
||||
console.log(' Examples:');
|
||||
console.log('');
|
||||
console.log(' # translate jade the templates dir');
|
||||
console.log(' $ jade templates');
|
||||
console.log('');
|
||||
console.log(' # create {foo,bar}.html');
|
||||
console.log(' $ jade {foo,bar}.jade');
|
||||
console.log('');
|
||||
console.log(' # jade over stdio');
|
||||
console.log(' $ jade < my.jade > my.html');
|
||||
console.log('');
|
||||
console.log(' # jade over stdio');
|
||||
console.log(' $ echo "h1 Jade!" | jade');
|
||||
console.log('');
|
||||
console.log(' # foo, bar dirs rendering to /tmp');
|
||||
console.log(' $ jade foo bar --out /tmp ');
|
||||
console.log('');
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
||||
|
||||
// options given, parse them
|
||||
|
||||
if (program.obj) options = eval('(' + program.obj + ')');
|
||||
|
||||
// --filename
|
||||
|
||||
if (program.path) options.filename = program.path;
|
||||
|
||||
// --no-debug
|
||||
|
||||
options.compileDebug = program.debug;
|
||||
|
||||
// --client
|
||||
|
||||
options.client = program.client;
|
||||
|
||||
// --pretty
|
||||
|
||||
options.pretty = program.pretty;
|
||||
|
||||
// left-over args are file paths
|
||||
|
||||
var files = program.args;
|
||||
|
||||
// compile files
|
||||
|
||||
if (files.length) {
|
||||
console.log();
|
||||
files.forEach(renderFile);
|
||||
process.on('exit', console.log);
|
||||
// stdio
|
||||
} else {
|
||||
stdin();
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile from stdin.
|
||||
*/
|
||||
|
||||
function stdin() {
|
||||
var buf = '';
|
||||
process.stdin.setEncoding('utf8');
|
||||
process.stdin.on('data', function(chunk){ buf += chunk; });
|
||||
process.stdin.on('end', function(){
|
||||
var fn = jade.compile(buf, options);
|
||||
var output = options.client
|
||||
? fn.toString()
|
||||
: fn(options);
|
||||
process.stdout.write(output);
|
||||
}).resume();
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the given path, compiling the jade files found.
|
||||
* Always walk the subdirectories.
|
||||
*/
|
||||
|
||||
function renderFile(path) {
|
||||
var re = /\.jade$/;
|
||||
fs.lstat(path, function(err, stat) {
|
||||
if (err) throw err;
|
||||
// Found jade file
|
||||
if (stat.isFile() && re.test(path)) {
|
||||
fs.readFile(path, 'utf8', function(err, str){
|
||||
if (err) throw err;
|
||||
options.filename = path;
|
||||
var fn = jade.compile(str, options);
|
||||
var extname = options.client ? '.js' : '.html';
|
||||
path = path.replace(re, extname);
|
||||
if (program.out) path = join(program.out, basename(path));
|
||||
var dir = resolve(dirname(path));
|
||||
mkdirp(dir, 0755, function(err){
|
||||
if (err) throw err;
|
||||
var output = options.client
|
||||
? fn.toString()
|
||||
: fn(options);
|
||||
fs.writeFile(path, output, function(err){
|
||||
if (err) throw err;
|
||||
console.log(' \033[90mrendered \033[36m%s\033[0m', path);
|
||||
});
|
||||
});
|
||||
});
|
||||
// Found directory
|
||||
} else if (stat.isDirectory()) {
|
||||
fs.readdir(path, function(err, files) {
|
||||
if (err) throw err;
|
||||
files.map(function(filename) {
|
||||
return path + '/' + filename;
|
||||
}).forEach(renderFile);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
4
node_modules/jade/index.js
generated
vendored
Normal file
4
node_modules/jade/index.js
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
module.exports = process.env.JADE_COV
|
||||
? require('./lib-cov/jade')
|
||||
: require('./lib/jade');
|
3586
node_modules/jade/jade.js
generated
vendored
Normal file
3586
node_modules/jade/jade.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
510
node_modules/jade/jade.md
generated
vendored
Normal file
510
node_modules/jade/jade.md
generated
vendored
Normal file
@ -0,0 +1,510 @@
|
||||
|
||||
# Jade
|
||||
|
||||
The jade template engine for node.js
|
||||
|
||||
## Synopsis
|
||||
|
||||
jade [-h|--help] [-v|--version] [-o|--obj STR]
|
||||
[-O|--out DIR] [-p|--path PATH] [-P|--pretty]
|
||||
[-c|--client] [-D|--no-debug]
|
||||
|
||||
## Examples
|
||||
|
||||
translate jade the templates dir
|
||||
|
||||
$ jade templates
|
||||
|
||||
create {foo,bar}.html
|
||||
|
||||
$ jade {foo,bar}.jade
|
||||
|
||||
jade over stdio
|
||||
|
||||
$ jade < my.jade > my.html
|
||||
|
||||
jade over s
|
||||
|
||||
$ echo "h1 Jade!" | jade
|
||||
|
||||
foo, bar dirs rendering to /tmp
|
||||
|
||||
$ jade foo bar --out /tmp
|
||||
|
||||
compile client-side templates without debugging
|
||||
instrumentation, making the output javascript
|
||||
very light-weight. This requires runtime.js
|
||||
in your projects.
|
||||
|
||||
$ jade --client --no-debug < my.jade
|
||||
|
||||
## Tags
|
||||
|
||||
Tags are simply nested via whitespace, closing
|
||||
tags defined for you. These indents are called "blocks".
|
||||
|
||||
ul
|
||||
li
|
||||
a Foo
|
||||
li
|
||||
a Bar
|
||||
|
||||
You may have several tags in one "block":
|
||||
|
||||
ul
|
||||
li
|
||||
a Foo
|
||||
a Bar
|
||||
a Baz
|
||||
|
||||
## Self-closing Tags
|
||||
|
||||
Some tags are flagged as self-closing by default, such
|
||||
as `meta`, `link`, and so on. To explicitly self-close
|
||||
a tag simply append the `/` character:
|
||||
|
||||
foo/
|
||||
foo(bar='baz')/
|
||||
|
||||
Would yield:
|
||||
|
||||
<foo/>
|
||||
<foo bar="baz"/>
|
||||
|
||||
## Attributes
|
||||
|
||||
Tag attributes look similar to HTML, however
|
||||
the values are regular JavaScript, here are
|
||||
some examples:
|
||||
|
||||
a(href='google.com') Google
|
||||
a(class='button', href='google.com') Google
|
||||
|
||||
As mentioned the attribute values are just JavaScript,
|
||||
this means ternary operations and other JavaScript expressions
|
||||
work just fine:
|
||||
|
||||
body(class=user.authenticated ? 'authenticated' : 'anonymous')
|
||||
a(href=user.website || 'http://google.com')
|
||||
|
||||
Multiple lines work too:
|
||||
|
||||
input(type='checkbox',
|
||||
name='agreement',
|
||||
checked)
|
||||
|
||||
Multiple lines without the comma work fine:
|
||||
|
||||
input(type='checkbox'
|
||||
name='agreement'
|
||||
checked)
|
||||
|
||||
Funky whitespace? fine:
|
||||
|
||||
input(
|
||||
type='checkbox'
|
||||
name='agreement'
|
||||
checked)
|
||||
|
||||
## Boolean attributes
|
||||
|
||||
Boolean attributes are mirrored by Jade, and accept
|
||||
bools, aka _true_ or _false_. When no value is specified
|
||||
_true_ is assumed. For example:
|
||||
|
||||
input(type="checkbox", checked)
|
||||
// => "<input type="checkbox" checked="checked" />"
|
||||
|
||||
For example if the checkbox was for an agreement, perhaps `user.agreed`
|
||||
was _true_ the following would also output 'checked="checked"':
|
||||
|
||||
input(type="checkbox", checked=user.agreed)
|
||||
|
||||
## Class attributes
|
||||
|
||||
The _class_ attribute accepts an array of classes,
|
||||
this can be handy when generated from a javascript
|
||||
function etc:
|
||||
|
||||
classes = ['foo', 'bar', 'baz']
|
||||
a(class=classes)
|
||||
// => "<a class="foo bar baz"></a>"
|
||||
|
||||
## Class literal
|
||||
|
||||
Classes may be defined using a ".CLASSNAME" syntax:
|
||||
|
||||
.button
|
||||
// => "<div class="button"></div>"
|
||||
|
||||
Or chained:
|
||||
|
||||
.large.button
|
||||
// => "<div class="large button"></div>"
|
||||
|
||||
The previous defaulted to divs, however you
|
||||
may also specify the tag type:
|
||||
|
||||
h1.title My Title
|
||||
// => "<h1 class="title">My Title</h1>"
|
||||
|
||||
## Id literal
|
||||
|
||||
Much like the class literal there's an id literal:
|
||||
|
||||
#user-1
|
||||
// => "<div id="user-1"></div>"
|
||||
|
||||
Again we may specify the tag as well:
|
||||
|
||||
ul#menu
|
||||
li: a(href='/home') Home
|
||||
li: a(href='/store') Store
|
||||
li: a(href='/contact') Contact
|
||||
|
||||
Finally all of these may be used in any combination,
|
||||
the following are all valid tags:
|
||||
|
||||
a.button#contact(style: 'color: red') Contact
|
||||
a.button(style: 'color: red')#contact Contact
|
||||
a(style: 'color: red').button#contact Contact
|
||||
|
||||
## Block expansion
|
||||
|
||||
Jade supports the concept of "block expansion", in which
|
||||
using a trailing ":" after a tag will inject a block:
|
||||
|
||||
ul
|
||||
li: a Foo
|
||||
li: a Bar
|
||||
li: a Baz
|
||||
|
||||
## Text
|
||||
|
||||
Arbitrary text may follow tags:
|
||||
|
||||
p Welcome to my site
|
||||
|
||||
yields:
|
||||
|
||||
<p>Welcome to my site</p>
|
||||
|
||||
## Pipe text
|
||||
|
||||
Another form of text is "pipe" text. Pipes act
|
||||
as the text margin for large bodies of text.
|
||||
|
||||
p
|
||||
| This is a large
|
||||
| body of text for
|
||||
| this tag.
|
||||
|
|
||||
| Nothing too
|
||||
| exciting.
|
||||
|
||||
yields:
|
||||
|
||||
<p>This is a large
|
||||
body of text for
|
||||
this tag.
|
||||
|
||||
Nothing too
|
||||
exciting.
|
||||
</p>
|
||||
|
||||
Using pipes we can also specify regular Jade tags
|
||||
within the text:
|
||||
|
||||
p
|
||||
| Click to visit
|
||||
a(href='http://google.com') Google
|
||||
| if you want.
|
||||
|
||||
## Text only tags
|
||||
|
||||
As an alternative to pipe text you may add
|
||||
a trailing "." to indicate that the block
|
||||
contains nothing but plain-text, no tags:
|
||||
|
||||
p.
|
||||
This is a large
|
||||
body of text for
|
||||
this tag.
|
||||
|
||||
Nothing too
|
||||
exciting.
|
||||
|
||||
Some tags are text-only by default, for example
|
||||
_script_, _textarea_, and _style_ tags do not
|
||||
contain nested HTML so Jade implies the trailing ".":
|
||||
|
||||
script
|
||||
if (foo) {
|
||||
bar();
|
||||
}
|
||||
|
||||
style
|
||||
body {
|
||||
padding: 50px;
|
||||
font: 14px Helvetica;
|
||||
}
|
||||
|
||||
## Template script tags
|
||||
|
||||
Sometimes it's useful to define HTML in script
|
||||
tags using Jade, typically for client-side templates.
|
||||
|
||||
To do this simply give the _script_ tag an arbitrary
|
||||
_type_ attribute such as _text/x-template_:
|
||||
|
||||
script(type='text/template')
|
||||
h1 Look!
|
||||
p Jade still works in here!
|
||||
|
||||
## Interpolation
|
||||
|
||||
Both plain-text and piped-text support interpolation,
|
||||
which comes in two forms, escapes and non-escaped. The
|
||||
following will output the _user.name_ in the paragraph
|
||||
but HTML within it will be escaped to prevent XSS attacks:
|
||||
|
||||
p Welcome #{user.name}
|
||||
|
||||
The following syntax is identical however it will _not_ escape
|
||||
HTML, and should only be used with strings that you trust:
|
||||
|
||||
p Welcome !{user.name}
|
||||
|
||||
## Inline HTML
|
||||
|
||||
Sometimes constructing small inline snippets of HTML
|
||||
in Jade can be annoying, luckily we can add plain
|
||||
HTML as well:
|
||||
|
||||
p Welcome <em>#{user.name}</em>
|
||||
|
||||
## Code
|
||||
|
||||
To buffer output with Jade simply use _=_ at the beginning
|
||||
of a line or after a tag. This method escapes any HTML
|
||||
present in the string.
|
||||
|
||||
p= user.description
|
||||
|
||||
To buffer output unescaped use the _!=_ variant, but again
|
||||
be careful of XSS.
|
||||
|
||||
p!= user.description
|
||||
|
||||
The final way to mess with JavaScript code in Jade is the unbuffered
|
||||
_-_, which can be used for conditionals, defining variables etc:
|
||||
|
||||
- var user = { description: 'foo bar baz' }
|
||||
#user
|
||||
- if (user.description) {
|
||||
h2 Description
|
||||
p.description= user.description
|
||||
- }
|
||||
|
||||
When compiled blocks are wrapped in anonymous functions, so the
|
||||
following is also valid, without braces:
|
||||
|
||||
- var user = { description: 'foo bar baz' }
|
||||
#user
|
||||
- if (user.description)
|
||||
h2 Description
|
||||
p.description= user.description
|
||||
|
||||
If you really want you could even use `.forEach()` and others:
|
||||
|
||||
- users.forEach(function(user){
|
||||
.user
|
||||
h2= user.name
|
||||
p User #{user.name} is #{user.age} years old
|
||||
- })
|
||||
|
||||
Taking this further Jade provides some syntax for conditionals,
|
||||
iteration, switch statements etc. Let's look at those next!
|
||||
|
||||
## Assignment
|
||||
|
||||
Jade's first-class assignment is simple, simply use the _=_
|
||||
operator and Jade will _var_ it for you. The following are equivalent:
|
||||
|
||||
- var user = { name: 'tobi' }
|
||||
user = { name: 'tobi' }
|
||||
|
||||
## Conditionals
|
||||
|
||||
Jade's first-class conditional syntax allows for optional
|
||||
parenthesis, and you may now omit the leading _-_ otherwise
|
||||
it's identical, still just regular javascript:
|
||||
|
||||
user = { description: 'foo bar baz' }
|
||||
#user
|
||||
if user.description
|
||||
h2 Description
|
||||
p.description= user.description
|
||||
|
||||
Jade provides the negated version, _unless_ as well, the following
|
||||
are equivalent:
|
||||
|
||||
- if (!(user.isAnonymous))
|
||||
p You're logged in as #{user.name}
|
||||
|
||||
unless user.isAnonymous
|
||||
p You're logged in as #{user.name}
|
||||
|
||||
## Iteration
|
||||
|
||||
JavaScript's _for_ loops don't look very declarative, so Jade
|
||||
also provides its own _for_ loop construct, aliased as _each_:
|
||||
|
||||
for user in users
|
||||
.user
|
||||
h2= user.name
|
||||
p user #{user.name} is #{user.age} year old
|
||||
|
||||
As mentioned _each_ is identical:
|
||||
|
||||
each user in users
|
||||
.user
|
||||
h2= user.name
|
||||
|
||||
If necessary the index is available as well:
|
||||
|
||||
for user, i in users
|
||||
.user(class='user-#{i}')
|
||||
h2= user.name
|
||||
|
||||
Remember, it's just JavaScript:
|
||||
|
||||
ul#letters
|
||||
for letter in ['a', 'b', 'c']
|
||||
li= letter
|
||||
|
||||
## Mixins
|
||||
|
||||
Mixins provide a way to define jade "functions" which "mix in"
|
||||
their contents when called. This is useful for abstracting
|
||||
out large fragments of Jade.
|
||||
|
||||
The simplest possible mixin which accepts no arguments might
|
||||
look like this:
|
||||
|
||||
mixin hello
|
||||
p Hello
|
||||
|
||||
You use a mixin by placing `+` before the name:
|
||||
|
||||
+hello
|
||||
|
||||
For something a little more dynamic, mixins can take
|
||||
arguments, the mixin itself is converted to a javascript
|
||||
function internally:
|
||||
|
||||
mixin hello(user)
|
||||
p Hello #{user}
|
||||
|
||||
+hello('Tobi')
|
||||
|
||||
Yields:
|
||||
|
||||
<p>Hello Tobi</p>
|
||||
|
||||
Mixins may optionally take blocks, when a block is passed
|
||||
its contents becomes the implicit `block` argument. For
|
||||
example here is a mixin passed a block, and also invoked
|
||||
without passing a block:
|
||||
|
||||
mixin article(title)
|
||||
.article
|
||||
.article-wrapper
|
||||
h1= title
|
||||
if block
|
||||
block
|
||||
else
|
||||
p No content provided
|
||||
|
||||
+article('Hello world')
|
||||
|
||||
+article('Hello world')
|
||||
p This is my
|
||||
p Amazing article
|
||||
|
||||
yields:
|
||||
|
||||
<div class="article">
|
||||
<div class="article-wrapper">
|
||||
<h1>Hello world</h1>
|
||||
<p>No content provided</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="article">
|
||||
<div class="article-wrapper">
|
||||
<h1>Hello world</h1>
|
||||
<p>This is my</p>
|
||||
<p>Amazing article</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Mixins can even take attributes, just like a tag. When
|
||||
attributes are passed they become the implicit `attributes`
|
||||
argument. Individual attributes can be accessed just like
|
||||
normal object properties:
|
||||
|
||||
mixin centered
|
||||
.centered(class=attributes.class)
|
||||
block
|
||||
|
||||
+centered.bold Hello world
|
||||
|
||||
+centered.red
|
||||
p This is my
|
||||
p Amazing article
|
||||
|
||||
yields:
|
||||
|
||||
<div class="centered bold">Hello world</div>
|
||||
<div class="centered red">
|
||||
<p>This is my</p>
|
||||
<p>Amazing article</p>
|
||||
</div>
|
||||
|
||||
If you use `attributes` directly, *all* passed attributes
|
||||
get used:
|
||||
|
||||
mixin link
|
||||
a.menu(attributes)
|
||||
block
|
||||
|
||||
+link.highlight(href='#top') Top
|
||||
+link#sec1.plain(href='#section1') Section 1
|
||||
+link#sec2.plain(href='#section2') Section 2
|
||||
|
||||
yields:
|
||||
|
||||
<a href="#top" class="highlight menu">Top</a>
|
||||
<a id="sec1" href="#section1" class="plain menu">Section 1</a>
|
||||
<a id="sec2" href="#section2" class="plain menu">Section 2</a>
|
||||
|
||||
If you pass arguments, they must directly follow the mixin:
|
||||
|
||||
mixin list(arr)
|
||||
if block
|
||||
.title
|
||||
block
|
||||
ul(attributes)
|
||||
each item in arr
|
||||
li= item
|
||||
|
||||
+list(['foo', 'bar', 'baz'])(id='myList', class='bold')
|
||||
|
||||
yields:
|
||||
|
||||
<ul id="myList" class="bold">
|
||||
<li>foo</li>
|
||||
<li>bar</li>
|
||||
<li>baz</li>
|
||||
</ul>
|
2
node_modules/jade/jade.min.js
generated
vendored
Normal file
2
node_modules/jade/jade.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
642
node_modules/jade/lib/compiler.js
generated
vendored
Normal file
642
node_modules/jade/lib/compiler.js
generated
vendored
Normal file
@ -0,0 +1,642 @@
|
||||
|
||||
/*!
|
||||
* Jade - Compiler
|
||||
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var nodes = require('./nodes')
|
||||
, filters = require('./filters')
|
||||
, doctypes = require('./doctypes')
|
||||
, selfClosing = require('./self-closing')
|
||||
, runtime = require('./runtime')
|
||||
, utils = require('./utils');
|
||||
|
||||
// if browser
|
||||
//
|
||||
// if (!Object.keys) {
|
||||
// Object.keys = function(obj){
|
||||
// var arr = [];
|
||||
// for (var key in obj) {
|
||||
// if (obj.hasOwnProperty(key)) {
|
||||
// arr.push(key);
|
||||
// }
|
||||
// }
|
||||
// return arr;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (!String.prototype.trimLeft) {
|
||||
// String.prototype.trimLeft = function(){
|
||||
// return this.replace(/^\s+/, '');
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// end
|
||||
|
||||
|
||||
/**
|
||||
* Initialize `Compiler` with the given `node`.
|
||||
*
|
||||
* @param {Node} node
|
||||
* @param {Object} options
|
||||
* @api public
|
||||
*/
|
||||
|
||||
var Compiler = module.exports = function Compiler(node, options) {
|
||||
this.options = options = options || {};
|
||||
this.node = node;
|
||||
this.hasCompiledDoctype = false;
|
||||
this.hasCompiledTag = false;
|
||||
this.pp = options.pretty || false;
|
||||
this.debug = false !== options.compileDebug;
|
||||
this.indents = 0;
|
||||
this.parentIndents = 0;
|
||||
if (options.doctype) this.setDoctype(options.doctype);
|
||||
};
|
||||
|
||||
/**
|
||||
* Compiler prototype.
|
||||
*/
|
||||
|
||||
Compiler.prototype = {
|
||||
|
||||
/**
|
||||
* Compile parse tree to JavaScript.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
compile: function(){
|
||||
this.buf = ['var interp;'];
|
||||
if (this.pp) this.buf.push("var __indent = [];");
|
||||
this.lastBufferedIdx = -1;
|
||||
this.visit(this.node);
|
||||
return this.buf.join('\n');
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the default doctype `name`. Sets terse mode to `true` when
|
||||
* html 5 is used, causing self-closing tags to end with ">" vs "/>",
|
||||
* and boolean attributes are not mirrored.
|
||||
*
|
||||
* @param {string} name
|
||||
* @api public
|
||||
*/
|
||||
|
||||
setDoctype: function(name){
|
||||
var doctype = doctypes[(name || 'default').toLowerCase()];
|
||||
doctype = doctype || '<!DOCTYPE ' + name + '>';
|
||||
this.doctype = doctype;
|
||||
this.terse = '5' == name || 'html' == name;
|
||||
this.xml = 0 == this.doctype.indexOf('<?xml');
|
||||
},
|
||||
|
||||
/**
|
||||
* Buffer the given `str` optionally escaped.
|
||||
*
|
||||
* @param {String} str
|
||||
* @param {Boolean} esc
|
||||
* @api public
|
||||
*/
|
||||
|
||||
buffer: function(str, esc){
|
||||
if (esc) str = utils.escape(str);
|
||||
|
||||
if (this.lastBufferedIdx == this.buf.length) {
|
||||
this.lastBuffered += str;
|
||||
this.buf[this.lastBufferedIdx - 1] = "buf.push('" + this.lastBuffered + "');"
|
||||
} else {
|
||||
this.buf.push("buf.push('" + str + "');");
|
||||
this.lastBuffered = str;
|
||||
this.lastBufferedIdx = this.buf.length;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Buffer an indent based on the current `indent`
|
||||
* property and an additional `offset`.
|
||||
*
|
||||
* @param {Number} offset
|
||||
* @param {Boolean} newline
|
||||
* @api public
|
||||
*/
|
||||
|
||||
prettyIndent: function(offset, newline){
|
||||
offset = offset || 0;
|
||||
newline = newline ? '\\n' : '';
|
||||
this.buffer(newline + Array(this.indents + offset).join(' '));
|
||||
if (this.parentIndents)
|
||||
this.buf.push("buf.push.apply(buf, __indent);");
|
||||
},
|
||||
|
||||
/**
|
||||
* Visit `node`.
|
||||
*
|
||||
* @param {Node} node
|
||||
* @api public
|
||||
*/
|
||||
|
||||
visit: function(node){
|
||||
var debug = this.debug;
|
||||
|
||||
if (debug) {
|
||||
this.buf.push('__jade.unshift({ lineno: ' + node.line
|
||||
+ ', filename: ' + (node.filename
|
||||
? JSON.stringify(node.filename)
|
||||
: '__jade[0].filename')
|
||||
+ ' });');
|
||||
}
|
||||
|
||||
// Massive hack to fix our context
|
||||
// stack for - else[ if] etc
|
||||
if (false === node.debug && this.debug) {
|
||||
this.buf.pop();
|
||||
this.buf.pop();
|
||||
}
|
||||
|
||||
this.visitNode(node);
|
||||
|
||||
if (debug) this.buf.push('__jade.shift();');
|
||||
},
|
||||
|
||||
/**
|
||||
* Visit `node`.
|
||||
*
|
||||
* @param {Node} node
|
||||
* @api public
|
||||
*/
|
||||
|
||||
visitNode: function(node){
|
||||
var name = node.constructor.name
|
||||
|| node.constructor.toString().match(/function ([^(\s]+)()/)[1];
|
||||
return this['visit' + name](node);
|
||||
},
|
||||
|
||||
/**
|
||||
* Visit case `node`.
|
||||
*
|
||||
* @param {Literal} node
|
||||
* @api public
|
||||
*/
|
||||
|
||||
visitCase: function(node){
|
||||
var _ = this.withinCase;
|
||||
this.withinCase = true;
|
||||
this.buf.push('switch (' + node.expr + '){');
|
||||
this.visit(node.block);
|
||||
this.buf.push('}');
|
||||
this.withinCase = _;
|
||||
},
|
||||
|
||||
/**
|
||||
* Visit when `node`.
|
||||
*
|
||||
* @param {Literal} node
|
||||
* @api public
|
||||
*/
|
||||
|
||||
visitWhen: function(node){
|
||||
if ('default' == node.expr) {
|
||||
this.buf.push('default:');
|
||||
} else {
|
||||
this.buf.push('case ' + node.expr + ':');
|
||||
}
|
||||
this.visit(node.block);
|
||||
this.buf.push(' break;');
|
||||
},
|
||||
|
||||
/**
|
||||
* Visit literal `node`.
|
||||
*
|
||||
* @param {Literal} node
|
||||
* @api public
|
||||
*/
|
||||
|
||||
visitLiteral: function(node){
|
||||
var str = node.str.replace(/\n/g, '\\\\n');
|
||||
this.buffer(str);
|
||||
},
|
||||
|
||||
/**
|
||||
* Visit all nodes in `block`.
|
||||
*
|
||||
* @param {Block} block
|
||||
* @api public
|
||||
*/
|
||||
|
||||
visitBlock: function(block){
|
||||
var len = block.nodes.length
|
||||
, escape = this.escape
|
||||
, pp = this.pp
|
||||
|
||||
// Block keyword has a special meaning in mixins
|
||||
if (this.parentIndents && block.mode) {
|
||||
if (pp) this.buf.push("__indent.push('" + Array(this.indents + 1).join(' ') + "');")
|
||||
this.buf.push('block && block();');
|
||||
if (pp) this.buf.push("__indent.pop();")
|
||||
return;
|
||||
}
|
||||
|
||||
// Pretty print multi-line text
|
||||
if (pp && len > 1 && !escape && block.nodes[0].isText && block.nodes[1].isText)
|
||||
this.prettyIndent(1, true);
|
||||
|
||||
for (var i = 0; i < len; ++i) {
|
||||
// Pretty print text
|
||||
if (pp && i > 0 && !escape && block.nodes[i].isText && block.nodes[i-1].isText)
|
||||
this.prettyIndent(1, false);
|
||||
|
||||
this.visit(block.nodes[i]);
|
||||
// Multiple text nodes are separated by newlines
|
||||
if (block.nodes[i+1] && block.nodes[i].isText && block.nodes[i+1].isText)
|
||||
this.buffer('\\n');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Visit `doctype`. Sets terse mode to `true` when html 5
|
||||
* is used, causing self-closing tags to end with ">" vs "/>",
|
||||
* and boolean attributes are not mirrored.
|
||||
*
|
||||
* @param {Doctype} doctype
|
||||
* @api public
|
||||
*/
|
||||
|
||||
visitDoctype: function(doctype){
|
||||
if (doctype && (doctype.val || !this.doctype)) {
|
||||
this.setDoctype(doctype.val || 'default');
|
||||
}
|
||||
|
||||
if (this.doctype) this.buffer(this.doctype);
|
||||
this.hasCompiledDoctype = true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Visit `mixin`, generating a function that
|
||||
* may be called within the template.
|
||||
*
|
||||
* @param {Mixin} mixin
|
||||
* @api public
|
||||
*/
|
||||
|
||||
visitMixin: function(mixin){
|
||||
var name = mixin.name.replace(/-/g, '_') + '_mixin'
|
||||
, args = mixin.args || ''
|
||||
, block = mixin.block
|
||||
, attrs = mixin.attrs
|
||||
, pp = this.pp;
|
||||
|
||||
if (mixin.call) {
|
||||
if (pp) this.buf.push("__indent.push('" + Array(this.indents + 1).join(' ') + "');")
|
||||
if (block || attrs.length) {
|
||||
|
||||
this.buf.push(name + '.call({');
|
||||
|
||||
if (block) {
|
||||
this.buf.push('block: function(){');
|
||||
|
||||
// Render block with no indents, dynamically added when rendered
|
||||
this.parentIndents++;
|
||||
var _indents = this.indents;
|
||||
this.indents = 0;
|
||||
this.visit(mixin.block);
|
||||
this.indents = _indents;
|
||||
this.parentIndents--;
|
||||
|
||||
if (attrs.length) {
|
||||
this.buf.push('},');
|
||||
} else {
|
||||
this.buf.push('}');
|
||||
}
|
||||
}
|
||||
|
||||
if (attrs.length) {
|
||||
var val = this.attrs(attrs);
|
||||
if (val.inherits) {
|
||||
this.buf.push('attributes: merge({' + val.buf
|
||||
+ '}, attributes), escaped: merge(' + val.escaped + ', escaped, true)');
|
||||
} else {
|
||||
this.buf.push('attributes: {' + val.buf + '}, escaped: ' + val.escaped);
|
||||
}
|
||||
}
|
||||
|
||||
if (args) {
|
||||
this.buf.push('}, ' + args + ');');
|
||||
} else {
|
||||
this.buf.push('});');
|
||||
}
|
||||
|
||||
} else {
|
||||
this.buf.push(name + '(' + args + ');');
|
||||
}
|
||||
if (pp) this.buf.push("__indent.pop();")
|
||||
} else {
|
||||
this.buf.push('var ' + name + ' = function(' + args + '){');
|
||||
this.buf.push('var block = this.block, attributes = this.attributes || {}, escaped = this.escaped || {};');
|
||||
this.parentIndents++;
|
||||
this.visit(block);
|
||||
this.parentIndents--;
|
||||
this.buf.push('};');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Visit `tag` buffering tag markup, generating
|
||||
* attributes, visiting the `tag`'s code and block.
|
||||
*
|
||||
* @param {Tag} tag
|
||||
* @api public
|
||||
*/
|
||||
|
||||
visitTag: function(tag){
|
||||
this.indents++;
|
||||
var name = tag.name
|
||||
, pp = this.pp;
|
||||
|
||||
if (tag.buffer) name = "' + (" + name + ") + '";
|
||||
|
||||
if (!this.hasCompiledTag) {
|
||||
if (!this.hasCompiledDoctype && 'html' == name) {
|
||||
this.visitDoctype();
|
||||
}
|
||||
this.hasCompiledTag = true;
|
||||
}
|
||||
|
||||
// pretty print
|
||||
if (pp && !tag.isInline())
|
||||
this.prettyIndent(0, true);
|
||||
|
||||
if ((~selfClosing.indexOf(name) || tag.selfClosing) && !this.xml) {
|
||||
this.buffer('<' + name);
|
||||
this.visitAttributes(tag.attrs);
|
||||
this.terse
|
||||
? this.buffer('>')
|
||||
: this.buffer('/>');
|
||||
} else {
|
||||
// Optimize attributes buffering
|
||||
if (tag.attrs.length) {
|
||||
this.buffer('<' + name);
|
||||
if (tag.attrs.length) this.visitAttributes(tag.attrs);
|
||||
this.buffer('>');
|
||||
} else {
|
||||
this.buffer('<' + name + '>');
|
||||
}
|
||||
if (tag.code) this.visitCode(tag.code);
|
||||
this.escape = 'pre' == tag.name;
|
||||
this.visit(tag.block);
|
||||
|
||||
// pretty print
|
||||
if (pp && !tag.isInline() && 'pre' != tag.name && !tag.canInline())
|
||||
this.prettyIndent(0, true);
|
||||
|
||||
this.buffer('</' + name + '>');
|
||||
}
|
||||
this.indents--;
|
||||
},
|
||||
|
||||
/**
|
||||
* Visit `filter`, throwing when the filter does not exist.
|
||||
*
|
||||
* @param {Filter} filter
|
||||
* @api public
|
||||
*/
|
||||
|
||||
visitFilter: function(filter){
|
||||
var fn = filters[filter.name];
|
||||
|
||||
// unknown filter
|
||||
if (!fn) {
|
||||
if (filter.isASTFilter) {
|
||||
throw new Error('unknown ast filter "' + filter.name + ':"');
|
||||
} else {
|
||||
throw new Error('unknown filter ":' + filter.name + '"');
|
||||
}
|
||||
}
|
||||
|
||||
if (filter.isASTFilter) {
|
||||
this.buf.push(fn(filter.block, this, filter.attrs));
|
||||
} else {
|
||||
var text = filter.block.nodes.map(function(node){ return node.val }).join('\n');
|
||||
filter.attrs = filter.attrs || {};
|
||||
filter.attrs.filename = this.options.filename;
|
||||
this.buffer(utils.text(fn(text, filter.attrs)));
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Visit `text` node.
|
||||
*
|
||||
* @param {Text} text
|
||||
* @api public
|
||||
*/
|
||||
|
||||
visitText: function(text){
|
||||
text = utils.text(text.val.replace(/\\/g, '\\\\'));
|
||||
if (this.escape) text = escape(text);
|
||||
this.buffer(text);
|
||||
},
|
||||
|
||||
/**
|
||||
* Visit a `comment`, only buffering when the buffer flag is set.
|
||||
*
|
||||
* @param {Comment} comment
|
||||
* @api public
|
||||
*/
|
||||
|
||||
visitComment: function(comment){
|
||||
if (!comment.buffer) return;
|
||||
if (this.pp) this.prettyIndent(1, true);
|
||||
this.buffer('<!--' + utils.escape(comment.val) + '-->');
|
||||
},
|
||||
|
||||
/**
|
||||
* Visit a `BlockComment`.
|
||||
*
|
||||
* @param {Comment} comment
|
||||
* @api public
|
||||
*/
|
||||
|
||||
visitBlockComment: function(comment){
|
||||
if (!comment.buffer) return;
|
||||
if (0 == comment.val.trim().indexOf('if')) {
|
||||
this.buffer('<!--[' + comment.val.trim() + ']>');
|
||||
this.visit(comment.block);
|
||||
this.buffer('<![endif]-->');
|
||||
} else {
|
||||
this.buffer('<!--' + comment.val);
|
||||
this.visit(comment.block);
|
||||
this.buffer('-->');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Visit `code`, respecting buffer / escape flags.
|
||||
* If the code is followed by a block, wrap it in
|
||||
* a self-calling function.
|
||||
*
|
||||
* @param {Code} code
|
||||
* @api public
|
||||
*/
|
||||
|
||||
visitCode: function(code){
|
||||
// Wrap code blocks with {}.
|
||||
// we only wrap unbuffered code blocks ATM
|
||||
// since they are usually flow control
|
||||
|
||||
// Buffer code
|
||||
if (code.buffer) {
|
||||
var val = code.val.trimLeft();
|
||||
this.buf.push('var __val__ = ' + val);
|
||||
val = 'null == __val__ ? "" : __val__';
|
||||
if (code.escape) val = 'escape(' + val + ')';
|
||||
this.buf.push("buf.push(" + val + ");");
|
||||
} else {
|
||||
this.buf.push(code.val);
|
||||
}
|
||||
|
||||
// Block support
|
||||
if (code.block) {
|
||||
if (!code.buffer) this.buf.push('{');
|
||||
this.visit(code.block);
|
||||
if (!code.buffer) this.buf.push('}');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Visit `each` block.
|
||||
*
|
||||
* @param {Each} each
|
||||
* @api public
|
||||
*/
|
||||
|
||||
visitEach: function(each){
|
||||
this.buf.push(''
|
||||
+ '// iterate ' + each.obj + '\n'
|
||||
+ ';(function(){\n'
|
||||
+ ' if (\'number\' == typeof ' + each.obj + '.length) {\n'
|
||||
+ ' for (var ' + each.key + ' = 0, $$l = ' + each.obj + '.length; ' + each.key + ' < $$l; ' + each.key + '++) {\n'
|
||||
+ ' var ' + each.val + ' = ' + each.obj + '[' + each.key + '];\n');
|
||||
|
||||
this.visit(each.block);
|
||||
|
||||
this.buf.push(''
|
||||
+ ' }\n'
|
||||
+ ' } else {\n'
|
||||
+ ' for (var ' + each.key + ' in ' + each.obj + ') {\n'
|
||||
// if browser
|
||||
// + ' if (' + each.obj + '.hasOwnProperty(' + each.key + ')){'
|
||||
// end
|
||||
+ ' var ' + each.val + ' = ' + each.obj + '[' + each.key + '];\n');
|
||||
|
||||
this.visit(each.block);
|
||||
|
||||
// if browser
|
||||
// this.buf.push(' }\n');
|
||||
// end
|
||||
|
||||
this.buf.push(' }\n }\n}).call(this);\n');
|
||||
},
|
||||
|
||||
/**
|
||||
* Visit `attrs`.
|
||||
*
|
||||
* @param {Array} attrs
|
||||
* @api public
|
||||
*/
|
||||
|
||||
visitAttributes: function(attrs){
|
||||
var val = this.attrs(attrs);
|
||||
if (val.inherits) {
|
||||
this.buf.push("buf.push(attrs(merge({ " + val.buf +
|
||||
" }, attributes), merge(" + val.escaped + ", escaped, true)));");
|
||||
} else if (val.constant) {
|
||||
eval('var buf={' + val.buf + '};');
|
||||
this.buffer(runtime.attrs(buf, JSON.parse(val.escaped)), true);
|
||||
} else {
|
||||
this.buf.push("buf.push(attrs({ " + val.buf + " }, " + val.escaped + "));");
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Compile attributes.
|
||||
*/
|
||||
|
||||
attrs: function(attrs){
|
||||
var buf = []
|
||||
, classes = []
|
||||
, escaped = {}
|
||||
, constant = attrs.every(function(attr){ return isConstant(attr.val) })
|
||||
, inherits = false;
|
||||
|
||||
if (this.terse) buf.push('terse: true');
|
||||
|
||||
attrs.forEach(function(attr){
|
||||
if (attr.name == 'attributes') return inherits = true;
|
||||
escaped[attr.name] = attr.escaped;
|
||||
if (attr.name == 'class') {
|
||||
classes.push('(' + attr.val + ')');
|
||||
} else {
|
||||
var pair = "'" + attr.name + "':(" + attr.val + ')';
|
||||
buf.push(pair);
|
||||
}
|
||||
});
|
||||
|
||||
if (classes.length) {
|
||||
classes = classes.join(" + ' ' + ");
|
||||
buf.push("class: " + classes);
|
||||
}
|
||||
|
||||
return {
|
||||
buf: buf.join(', ').replace('class:', '"class":'),
|
||||
escaped: JSON.stringify(escaped),
|
||||
inherits: inherits,
|
||||
constant: constant
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if expression can be evaluated to a constant
|
||||
*
|
||||
* @param {String} expression
|
||||
* @return {Boolean}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function isConstant(val){
|
||||
// Check strings/literals
|
||||
if (/^ *("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)'|true|false|null|undefined) *$/i.test(val))
|
||||
return true;
|
||||
|
||||
// Check numbers
|
||||
if (!isNaN(Number(val)))
|
||||
return true;
|
||||
|
||||
// Check arrays
|
||||
var matches;
|
||||
if (matches = /^ *\[(.*)\] *$/.exec(val))
|
||||
return matches[1].split(',').every(isConstant);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape the given string of `html`.
|
||||
*
|
||||
* @param {String} html
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function escape(html){
|
||||
return String(html)
|
||||
.replace(/&(?!\w+;)/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"');
|
||||
}
|
18
node_modules/jade/lib/doctypes.js
generated
vendored
Normal file
18
node_modules/jade/lib/doctypes.js
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
|
||||
/*!
|
||||
* Jade - doctypes
|
||||
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
'5': '<!DOCTYPE html>'
|
||||
, 'default': '<!DOCTYPE html>'
|
||||
, 'xml': '<?xml version="1.0" encoding="utf-8" ?>'
|
||||
, 'transitional': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
|
||||
, 'strict': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
|
||||
, 'frameset': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">'
|
||||
, '1.1': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'
|
||||
, 'basic': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">'
|
||||
, 'mobile': '<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">'
|
||||
};
|
97
node_modules/jade/lib/filters.js
generated
vendored
Normal file
97
node_modules/jade/lib/filters.js
generated
vendored
Normal file
@ -0,0 +1,97 @@
|
||||
|
||||
/*!
|
||||
* Jade - filters
|
||||
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
|
||||
/**
|
||||
* Wrap text with CDATA block.
|
||||
*/
|
||||
|
||||
cdata: function(str){
|
||||
return '<![CDATA[\\n' + str + '\\n]]>';
|
||||
},
|
||||
|
||||
/**
|
||||
* Transform sass to css, wrapped in style tags.
|
||||
*/
|
||||
|
||||
sass: function(str){
|
||||
str = str.replace(/\\n/g, '\n');
|
||||
var sass = require('sass').render(str).replace(/\n/g, '\\n');
|
||||
return '<style type="text/css">' + sass + '</style>';
|
||||
},
|
||||
|
||||
/**
|
||||
* Transform stylus to css, wrapped in style tags.
|
||||
*/
|
||||
|
||||
stylus: function(str, options){
|
||||
var ret;
|
||||
str = str.replace(/\\n/g, '\n');
|
||||
var stylus = require('stylus');
|
||||
stylus(str, options).render(function(err, css){
|
||||
if (err) throw err;
|
||||
ret = css.replace(/\n/g, '\\n');
|
||||
});
|
||||
return '<style type="text/css">' + ret + '</style>';
|
||||
},
|
||||
|
||||
/**
|
||||
* Transform less to css, wrapped in style tags.
|
||||
*/
|
||||
|
||||
less: function(str){
|
||||
var ret;
|
||||
str = str.replace(/\\n/g, '\n');
|
||||
require('less').render(str, function(err, css){
|
||||
if (err) throw err;
|
||||
ret = '<style type="text/css">' + css.replace(/\n/g, '\\n') + '</style>';
|
||||
});
|
||||
return ret;
|
||||
},
|
||||
|
||||
/**
|
||||
* Transform markdown to html.
|
||||
*/
|
||||
|
||||
markdown: function(str){
|
||||
var md;
|
||||
|
||||
// support markdown / discount
|
||||
try {
|
||||
md = require('markdown');
|
||||
} catch (err){
|
||||
try {
|
||||
md = require('discount');
|
||||
} catch (err) {
|
||||
try {
|
||||
md = require('markdown-js');
|
||||
} catch (err) {
|
||||
try {
|
||||
md = require('marked');
|
||||
} catch (err) {
|
||||
throw new
|
||||
Error('Cannot find markdown library, install markdown, discount, or marked.');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
str = str.replace(/\\n/g, '\n');
|
||||
return md.parse(str).replace(/\n/g, '\\n').replace(/'/g,''');
|
||||
},
|
||||
|
||||
/**
|
||||
* Transform coffeescript to javascript.
|
||||
*/
|
||||
|
||||
coffeescript: function(str){
|
||||
str = str.replace(/\\n/g, '\n');
|
||||
var js = require('coffee-script').compile(str).replace(/\\/g, '\\\\').replace(/\n/g, '\\n');
|
||||
return '<script type="text/javascript">\\n' + js + '</script>';
|
||||
}
|
||||
};
|
28
node_modules/jade/lib/inline-tags.js
generated
vendored
Normal file
28
node_modules/jade/lib/inline-tags.js
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
|
||||
/*!
|
||||
* Jade - inline tags
|
||||
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
module.exports = [
|
||||
'a'
|
||||
, 'abbr'
|
||||
, 'acronym'
|
||||
, 'b'
|
||||
, 'br'
|
||||
, 'code'
|
||||
, 'em'
|
||||
, 'font'
|
||||
, 'i'
|
||||
, 'img'
|
||||
, 'ins'
|
||||
, 'kbd'
|
||||
, 'map'
|
||||
, 'samp'
|
||||
, 'small'
|
||||
, 'span'
|
||||
, 'strong'
|
||||
, 'sub'
|
||||
, 'sup'
|
||||
];
|
237
node_modules/jade/lib/jade.js
generated
vendored
Normal file
237
node_modules/jade/lib/jade.js
generated
vendored
Normal file
@ -0,0 +1,237 @@
|
||||
/*!
|
||||
* Jade
|
||||
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Parser = require('./parser')
|
||||
, Lexer = require('./lexer')
|
||||
, Compiler = require('./compiler')
|
||||
, runtime = require('./runtime')
|
||||
// if node
|
||||
, fs = require('fs');
|
||||
// end
|
||||
|
||||
/**
|
||||
* Library version.
|
||||
*/
|
||||
|
||||
exports.version = '0.26.3';
|
||||
|
||||
/**
|
||||
* Expose self closing tags.
|
||||
*/
|
||||
|
||||
exports.selfClosing = require('./self-closing');
|
||||
|
||||
/**
|
||||
* Default supported doctypes.
|
||||
*/
|
||||
|
||||
exports.doctypes = require('./doctypes');
|
||||
|
||||
/**
|
||||
* Text filters.
|
||||
*/
|
||||
|
||||
exports.filters = require('./filters');
|
||||
|
||||
/**
|
||||
* Utilities.
|
||||
*/
|
||||
|
||||
exports.utils = require('./utils');
|
||||
|
||||
/**
|
||||
* Expose `Compiler`.
|
||||
*/
|
||||
|
||||
exports.Compiler = Compiler;
|
||||
|
||||
/**
|
||||
* Expose `Parser`.
|
||||
*/
|
||||
|
||||
exports.Parser = Parser;
|
||||
|
||||
/**
|
||||
* Expose `Lexer`.
|
||||
*/
|
||||
|
||||
exports.Lexer = Lexer;
|
||||
|
||||
/**
|
||||
* Nodes.
|
||||
*/
|
||||
|
||||
exports.nodes = require('./nodes');
|
||||
|
||||
/**
|
||||
* Jade runtime helpers.
|
||||
*/
|
||||
|
||||
exports.runtime = runtime;
|
||||
|
||||
/**
|
||||
* Template function cache.
|
||||
*/
|
||||
|
||||
exports.cache = {};
|
||||
|
||||
/**
|
||||
* Parse the given `str` of jade and return a function body.
|
||||
*
|
||||
* @param {String} str
|
||||
* @param {Object} options
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function parse(str, options){
|
||||
try {
|
||||
// Parse
|
||||
var parser = new Parser(str, options.filename, options);
|
||||
|
||||
// Compile
|
||||
var compiler = new (options.compiler || Compiler)(parser.parse(), options)
|
||||
, js = compiler.compile();
|
||||
|
||||
// Debug compiler
|
||||
if (options.debug) {
|
||||
console.error('\nCompiled Function:\n\n\033[90m%s\033[0m', js.replace(/^/gm, ' '));
|
||||
}
|
||||
|
||||
return ''
|
||||
+ 'var buf = [];\n'
|
||||
+ (options.self
|
||||
? 'var self = locals || {};\n' + js
|
||||
: 'with (locals || {}) {\n' + js + '\n}\n')
|
||||
+ 'return buf.join("");';
|
||||
} catch (err) {
|
||||
parser = parser.context();
|
||||
runtime.rethrow(err, parser.filename, parser.lexer.lineno);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile a `Function` representation of the given jade `str`.
|
||||
*
|
||||
* Options:
|
||||
*
|
||||
* - `compileDebug` when `false` debugging code is stripped from the compiled template
|
||||
* - `client` when `true` the helper functions `escape()` etc will reference `jade.escape()`
|
||||
* for use with the Jade client-side runtime.js
|
||||
*
|
||||
* @param {String} str
|
||||
* @param {Options} options
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
exports.compile = function(str, options){
|
||||
var options = options || {}
|
||||
, client = options.client
|
||||
, filename = options.filename
|
||||
? JSON.stringify(options.filename)
|
||||
: 'undefined'
|
||||
, fn;
|
||||
|
||||
if (options.compileDebug !== false) {
|
||||
fn = [
|
||||
'var __jade = [{ lineno: 1, filename: ' + filename + ' }];'
|
||||
, 'try {'
|
||||
, parse(String(str), options)
|
||||
, '} catch (err) {'
|
||||
, ' rethrow(err, __jade[0].filename, __jade[0].lineno);'
|
||||
, '}'
|
||||
].join('\n');
|
||||
} else {
|
||||
fn = parse(String(str), options);
|
||||
}
|
||||
|
||||
if (client) {
|
||||
fn = 'attrs = attrs || jade.attrs; escape = escape || jade.escape; rethrow = rethrow || jade.rethrow; merge = merge || jade.merge;\n' + fn;
|
||||
}
|
||||
|
||||
fn = new Function('locals, attrs, escape, rethrow, merge', fn);
|
||||
|
||||
if (client) return fn;
|
||||
|
||||
return function(locals){
|
||||
return fn(locals, runtime.attrs, runtime.escape, runtime.rethrow, runtime.merge);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Render the given `str` of jade and invoke
|
||||
* the callback `fn(err, str)`.
|
||||
*
|
||||
* Options:
|
||||
*
|
||||
* - `cache` enable template caching
|
||||
* - `filename` filename required for `include` / `extends` and caching
|
||||
*
|
||||
* @param {String} str
|
||||
* @param {Object|Function} options or fn
|
||||
* @param {Function} fn
|
||||
* @api public
|
||||
*/
|
||||
|
||||
exports.render = function(str, options, fn){
|
||||
// swap args
|
||||
if ('function' == typeof options) {
|
||||
fn = options, options = {};
|
||||
}
|
||||
|
||||
// cache requires .filename
|
||||
if (options.cache && !options.filename) {
|
||||
return fn(new Error('the "filename" option is required for caching'));
|
||||
}
|
||||
|
||||
try {
|
||||
var path = options.filename;
|
||||
var tmpl = options.cache
|
||||
? exports.cache[path] || (exports.cache[path] = exports.compile(str, options))
|
||||
: exports.compile(str, options);
|
||||
fn(null, tmpl(options));
|
||||
} catch (err) {
|
||||
fn(err);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Render a Jade file at the given `path` and callback `fn(err, str)`.
|
||||
*
|
||||
* @param {String} path
|
||||
* @param {Object|Function} options or callback
|
||||
* @param {Function} fn
|
||||
* @api public
|
||||
*/
|
||||
|
||||
exports.renderFile = function(path, options, fn){
|
||||
var key = path + ':string';
|
||||
|
||||
if ('function' == typeof options) {
|
||||
fn = options, options = {};
|
||||
}
|
||||
|
||||
try {
|
||||
options.filename = path;
|
||||
var str = options.cache
|
||||
? exports.cache[key] || (exports.cache[key] = fs.readFileSync(path, 'utf8'))
|
||||
: fs.readFileSync(path, 'utf8');
|
||||
exports.render(str, options, fn);
|
||||
} catch (err) {
|
||||
fn(err);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Express support.
|
||||
*/
|
||||
|
||||
exports.__express = exports.renderFile;
|
771
node_modules/jade/lib/lexer.js
generated
vendored
Normal file
771
node_modules/jade/lib/lexer.js
generated
vendored
Normal file
@ -0,0 +1,771 @@
|
||||
|
||||
/*!
|
||||
* Jade - Lexer
|
||||
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Initialize `Lexer` with the given `str`.
|
||||
*
|
||||
* Options:
|
||||
*
|
||||
* - `colons` allow colons for attr delimiters
|
||||
*
|
||||
* @param {String} str
|
||||
* @param {Object} options
|
||||
* @api private
|
||||
*/
|
||||
|
||||
var Lexer = module.exports = function Lexer(str, options) {
|
||||
options = options || {};
|
||||
this.input = str.replace(/\r\n|\r/g, '\n');
|
||||
this.colons = options.colons;
|
||||
this.deferredTokens = [];
|
||||
this.lastIndents = 0;
|
||||
this.lineno = 1;
|
||||
this.stash = [];
|
||||
this.indentStack = [];
|
||||
this.indentRe = null;
|
||||
this.pipeless = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Lexer prototype.
|
||||
*/
|
||||
|
||||
Lexer.prototype = {
|
||||
|
||||
/**
|
||||
* Construct a token with the given `type` and `val`.
|
||||
*
|
||||
* @param {String} type
|
||||
* @param {String} val
|
||||
* @return {Object}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
tok: function(type, val){
|
||||
return {
|
||||
type: type
|
||||
, line: this.lineno
|
||||
, val: val
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Consume the given `len` of input.
|
||||
*
|
||||
* @param {Number} len
|
||||
* @api private
|
||||
*/
|
||||
|
||||
consume: function(len){
|
||||
this.input = this.input.substr(len);
|
||||
},
|
||||
|
||||
/**
|
||||
* Scan for `type` with the given `regexp`.
|
||||
*
|
||||
* @param {String} type
|
||||
* @param {RegExp} regexp
|
||||
* @return {Object}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
scan: function(regexp, type){
|
||||
var captures;
|
||||
if (captures = regexp.exec(this.input)) {
|
||||
this.consume(captures[0].length);
|
||||
return this.tok(type, captures[1]);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Defer the given `tok`.
|
||||
*
|
||||
* @param {Object} tok
|
||||
* @api private
|
||||
*/
|
||||
|
||||
defer: function(tok){
|
||||
this.deferredTokens.push(tok);
|
||||
},
|
||||
|
||||
/**
|
||||
* Lookahead `n` tokens.
|
||||
*
|
||||
* @param {Number} n
|
||||
* @return {Object}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
lookahead: function(n){
|
||||
var fetch = n - this.stash.length;
|
||||
while (fetch-- > 0) this.stash.push(this.next());
|
||||
return this.stash[--n];
|
||||
},
|
||||
|
||||
/**
|
||||
* Return the indexOf `start` / `end` delimiters.
|
||||
*
|
||||
* @param {String} start
|
||||
* @param {String} end
|
||||
* @return {Number}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
indexOfDelimiters: function(start, end){
|
||||
var str = this.input
|
||||
, nstart = 0
|
||||
, nend = 0
|
||||
, pos = 0;
|
||||
for (var i = 0, len = str.length; i < len; ++i) {
|
||||
if (start == str.charAt(i)) {
|
||||
++nstart;
|
||||
} else if (end == str.charAt(i)) {
|
||||
if (++nend == nstart) {
|
||||
pos = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return pos;
|
||||
},
|
||||
|
||||
/**
|
||||
* Stashed token.
|
||||
*/
|
||||
|
||||
stashed: function() {
|
||||
return this.stash.length
|
||||
&& this.stash.shift();
|
||||
},
|
||||
|
||||
/**
|
||||
* Deferred token.
|
||||
*/
|
||||
|
||||
deferred: function() {
|
||||
return this.deferredTokens.length
|
||||
&& this.deferredTokens.shift();
|
||||
},
|
||||
|
||||
/**
|
||||
* end-of-source.
|
||||
*/
|
||||
|
||||
eos: function() {
|
||||
if (this.input.length) return;
|
||||
if (this.indentStack.length) {
|
||||
this.indentStack.shift();
|
||||
return this.tok('outdent');
|
||||
} else {
|
||||
return this.tok('eos');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Blank line.
|
||||
*/
|
||||
|
||||
blank: function() {
|
||||
var captures;
|
||||
if (captures = /^\n *\n/.exec(this.input)) {
|
||||
this.consume(captures[0].length - 1);
|
||||
if (this.pipeless) return this.tok('text', '');
|
||||
return this.next();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Comment.
|
||||
*/
|
||||
|
||||
comment: function() {
|
||||
var captures;
|
||||
if (captures = /^ *\/\/(-)?([^\n]*)/.exec(this.input)) {
|
||||
this.consume(captures[0].length);
|
||||
var tok = this.tok('comment', captures[2]);
|
||||
tok.buffer = '-' != captures[1];
|
||||
return tok;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Interpolated tag.
|
||||
*/
|
||||
|
||||
interpolation: function() {
|
||||
var captures;
|
||||
if (captures = /^#\{(.*?)\}/.exec(this.input)) {
|
||||
this.consume(captures[0].length);
|
||||
return this.tok('interpolation', captures[1]);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Tag.
|
||||
*/
|
||||
|
||||
tag: function() {
|
||||
var captures;
|
||||
if (captures = /^(\w[-:\w]*)(\/?)/.exec(this.input)) {
|
||||
this.consume(captures[0].length);
|
||||
var tok, name = captures[1];
|
||||
if (':' == name[name.length - 1]) {
|
||||
name = name.slice(0, -1);
|
||||
tok = this.tok('tag', name);
|
||||
this.defer(this.tok(':'));
|
||||
while (' ' == this.input[0]) this.input = this.input.substr(1);
|
||||
} else {
|
||||
tok = this.tok('tag', name);
|
||||
}
|
||||
tok.selfClosing = !! captures[2];
|
||||
return tok;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Filter.
|
||||
*/
|
||||
|
||||
filter: function() {
|
||||
return this.scan(/^:(\w+)/, 'filter');
|
||||
},
|
||||
|
||||
/**
|
||||
* Doctype.
|
||||
*/
|
||||
|
||||
doctype: function() {
|
||||
return this.scan(/^(?:!!!|doctype) *([^\n]+)?/, 'doctype');
|
||||
},
|
||||
|
||||
/**
|
||||
* Id.
|
||||
*/
|
||||
|
||||
id: function() {
|
||||
return this.scan(/^#([\w-]+)/, 'id');
|
||||
},
|
||||
|
||||
/**
|
||||
* Class.
|
||||
*/
|
||||
|
||||
className: function() {
|
||||
return this.scan(/^\.([\w-]+)/, 'class');
|
||||
},
|
||||
|
||||
/**
|
||||
* Text.
|
||||
*/
|
||||
|
||||
text: function() {
|
||||
return this.scan(/^(?:\| ?| ?)?([^\n]+)/, 'text');
|
||||
},
|
||||
|
||||
/**
|
||||
* Extends.
|
||||
*/
|
||||
|
||||
"extends": function() {
|
||||
return this.scan(/^extends? +([^\n]+)/, 'extends');
|
||||
},
|
||||
|
||||
/**
|
||||
* Block prepend.
|
||||
*/
|
||||
|
||||
prepend: function() {
|
||||
var captures;
|
||||
if (captures = /^prepend +([^\n]+)/.exec(this.input)) {
|
||||
this.consume(captures[0].length);
|
||||
var mode = 'prepend'
|
||||
, name = captures[1]
|
||||
, tok = this.tok('block', name);
|
||||
tok.mode = mode;
|
||||
return tok;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Block append.
|
||||
*/
|
||||
|
||||
append: function() {
|
||||
var captures;
|
||||
if (captures = /^append +([^\n]+)/.exec(this.input)) {
|
||||
this.consume(captures[0].length);
|
||||
var mode = 'append'
|
||||
, name = captures[1]
|
||||
, tok = this.tok('block', name);
|
||||
tok.mode = mode;
|
||||
return tok;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Block.
|
||||
*/
|
||||
|
||||
block: function() {
|
||||
var captures;
|
||||
if (captures = /^block\b *(?:(prepend|append) +)?([^\n]*)/.exec(this.input)) {
|
||||
this.consume(captures[0].length);
|
||||
var mode = captures[1] || 'replace'
|
||||
, name = captures[2]
|
||||
, tok = this.tok('block', name);
|
||||
|
||||
tok.mode = mode;
|
||||
return tok;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Yield.
|
||||
*/
|
||||
|
||||
yield: function() {
|
||||
return this.scan(/^yield */, 'yield');
|
||||
},
|
||||
|
||||
/**
|
||||
* Include.
|
||||
*/
|
||||
|
||||
include: function() {
|
||||
return this.scan(/^include +([^\n]+)/, 'include');
|
||||
},
|
||||
|
||||
/**
|
||||
* Case.
|
||||
*/
|
||||
|
||||
"case": function() {
|
||||
return this.scan(/^case +([^\n]+)/, 'case');
|
||||
},
|
||||
|
||||
/**
|
||||
* When.
|
||||
*/
|
||||
|
||||
when: function() {
|
||||
return this.scan(/^when +([^:\n]+)/, 'when');
|
||||
},
|
||||
|
||||
/**
|
||||
* Default.
|
||||
*/
|
||||
|
||||
"default": function() {
|
||||
return this.scan(/^default */, 'default');
|
||||
},
|
||||
|
||||
/**
|
||||
* Assignment.
|
||||
*/
|
||||
|
||||
assignment: function() {
|
||||
var captures;
|
||||
if (captures = /^(\w+) += *([^;\n]+)( *;? *)/.exec(this.input)) {
|
||||
this.consume(captures[0].length);
|
||||
var name = captures[1]
|
||||
, val = captures[2];
|
||||
return this.tok('code', 'var ' + name + ' = (' + val + ');');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Call mixin.
|
||||
*/
|
||||
|
||||
call: function(){
|
||||
var captures;
|
||||
if (captures = /^\+([-\w]+)/.exec(this.input)) {
|
||||
this.consume(captures[0].length);
|
||||
var tok = this.tok('call', captures[1]);
|
||||
|
||||
// Check for args (not attributes)
|
||||
if (captures = /^ *\((.*?)\)/.exec(this.input)) {
|
||||
if (!/^ *[-\w]+ *=/.test(captures[1])) {
|
||||
this.consume(captures[0].length);
|
||||
tok.args = captures[1];
|
||||
}
|
||||
}
|
||||
|
||||
return tok;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Mixin.
|
||||
*/
|
||||
|
||||
mixin: function(){
|
||||
var captures;
|
||||
if (captures = /^mixin +([-\w]+)(?: *\((.*)\))?/.exec(this.input)) {
|
||||
this.consume(captures[0].length);
|
||||
var tok = this.tok('mixin', captures[1]);
|
||||
tok.args = captures[2];
|
||||
return tok;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Conditional.
|
||||
*/
|
||||
|
||||
conditional: function() {
|
||||
var captures;
|
||||
if (captures = /^(if|unless|else if|else)\b([^\n]*)/.exec(this.input)) {
|
||||
this.consume(captures[0].length);
|
||||
var type = captures[1]
|
||||
, js = captures[2];
|
||||
|
||||
switch (type) {
|
||||
case 'if': js = 'if (' + js + ')'; break;
|
||||
case 'unless': js = 'if (!(' + js + '))'; break;
|
||||
case 'else if': js = 'else if (' + js + ')'; break;
|
||||
case 'else': js = 'else'; break;
|
||||
}
|
||||
|
||||
return this.tok('code', js);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* While.
|
||||
*/
|
||||
|
||||
"while": function() {
|
||||
var captures;
|
||||
if (captures = /^while +([^\n]+)/.exec(this.input)) {
|
||||
this.consume(captures[0].length);
|
||||
return this.tok('code', 'while (' + captures[1] + ')');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Each.
|
||||
*/
|
||||
|
||||
each: function() {
|
||||
var captures;
|
||||
if (captures = /^(?:- *)?(?:each|for) +(\w+)(?: *, *(\w+))? * in *([^\n]+)/.exec(this.input)) {
|
||||
this.consume(captures[0].length);
|
||||
var tok = this.tok('each', captures[1]);
|
||||
tok.key = captures[2] || '$index';
|
||||
tok.code = captures[3];
|
||||
return tok;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Code.
|
||||
*/
|
||||
|
||||
code: function() {
|
||||
var captures;
|
||||
if (captures = /^(!?=|-)([^\n]+)/.exec(this.input)) {
|
||||
this.consume(captures[0].length);
|
||||
var flags = captures[1];
|
||||
captures[1] = captures[2];
|
||||
var tok = this.tok('code', captures[1]);
|
||||
tok.escape = flags[0] === '=';
|
||||
tok.buffer = flags[0] === '=' || flags[1] === '=';
|
||||
return tok;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Attributes.
|
||||
*/
|
||||
|
||||
attrs: function() {
|
||||
if ('(' == this.input.charAt(0)) {
|
||||
var index = this.indexOfDelimiters('(', ')')
|
||||
, str = this.input.substr(1, index-1)
|
||||
, tok = this.tok('attrs')
|
||||
, len = str.length
|
||||
, colons = this.colons
|
||||
, states = ['key']
|
||||
, escapedAttr
|
||||
, key = ''
|
||||
, val = ''
|
||||
, quote
|
||||
, c
|
||||
, p;
|
||||
|
||||
function state(){
|
||||
return states[states.length - 1];
|
||||
}
|
||||
|
||||
function interpolate(attr) {
|
||||
return attr.replace(/#\{([^}]+)\}/g, function(_, expr){
|
||||
return quote + " + (" + expr + ") + " + quote;
|
||||
});
|
||||
}
|
||||
|
||||
this.consume(index + 1);
|
||||
tok.attrs = {};
|
||||
tok.escaped = {};
|
||||
|
||||
function parse(c) {
|
||||
var real = c;
|
||||
// TODO: remove when people fix ":"
|
||||
if (colons && ':' == c) c = '=';
|
||||
switch (c) {
|
||||
case ',':
|
||||
case '\n':
|
||||
switch (state()) {
|
||||
case 'expr':
|
||||
case 'array':
|
||||
case 'string':
|
||||
case 'object':
|
||||
val += c;
|
||||
break;
|
||||
default:
|
||||
states.push('key');
|
||||
val = val.trim();
|
||||
key = key.trim();
|
||||
if ('' == key) return;
|
||||
key = key.replace(/^['"]|['"]$/g, '').replace('!', '');
|
||||
tok.escaped[key] = escapedAttr;
|
||||
tok.attrs[key] = '' == val
|
||||
? true
|
||||
: interpolate(val);
|
||||
key = val = '';
|
||||
}
|
||||
break;
|
||||
case '=':
|
||||
switch (state()) {
|
||||
case 'key char':
|
||||
key += real;
|
||||
break;
|
||||
case 'val':
|
||||
case 'expr':
|
||||
case 'array':
|
||||
case 'string':
|
||||
case 'object':
|
||||
val += real;
|
||||
break;
|
||||
default:
|
||||
escapedAttr = '!' != p;
|
||||
states.push('val');
|
||||
}
|
||||
break;
|
||||
case '(':
|
||||
if ('val' == state()
|
||||
|| 'expr' == state()) states.push('expr');
|
||||
val += c;
|
||||
break;
|
||||
case ')':
|
||||
if ('expr' == state()
|
||||
|| 'val' == state()) states.pop();
|
||||
val += c;
|
||||
break;
|
||||
case '{':
|
||||
if ('val' == state()) states.push('object');
|
||||
val += c;
|
||||
break;
|
||||
case '}':
|
||||
if ('object' == state()) states.pop();
|
||||
val += c;
|
||||
break;
|
||||
case '[':
|
||||
if ('val' == state()) states.push('array');
|
||||
val += c;
|
||||
break;
|
||||
case ']':
|
||||
if ('array' == state()) states.pop();
|
||||
val += c;
|
||||
break;
|
||||
case '"':
|
||||
case "'":
|
||||
switch (state()) {
|
||||
case 'key':
|
||||
states.push('key char');
|
||||
break;
|
||||
case 'key char':
|
||||
states.pop();
|
||||
break;
|
||||
case 'string':
|
||||
if (c == quote) states.pop();
|
||||
val += c;
|
||||
break;
|
||||
default:
|
||||
states.push('string');
|
||||
val += c;
|
||||
quote = c;
|
||||
}
|
||||
break;
|
||||
case '':
|
||||
break;
|
||||
default:
|
||||
switch (state()) {
|
||||
case 'key':
|
||||
case 'key char':
|
||||
key += c;
|
||||
break;
|
||||
default:
|
||||
val += c;
|
||||
}
|
||||
}
|
||||
p = c;
|
||||
}
|
||||
|
||||
for (var i = 0; i < len; ++i) {
|
||||
parse(str.charAt(i));
|
||||
}
|
||||
|
||||
parse(',');
|
||||
|
||||
if ('/' == this.input.charAt(0)) {
|
||||
this.consume(1);
|
||||
tok.selfClosing = true;
|
||||
}
|
||||
|
||||
return tok;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Indent | Outdent | Newline.
|
||||
*/
|
||||
|
||||
indent: function() {
|
||||
var captures, re;
|
||||
|
||||
// established regexp
|
||||
if (this.indentRe) {
|
||||
captures = this.indentRe.exec(this.input);
|
||||
// determine regexp
|
||||
} else {
|
||||
// tabs
|
||||
re = /^\n(\t*) */;
|
||||
captures = re.exec(this.input);
|
||||
|
||||
// spaces
|
||||
if (captures && !captures[1].length) {
|
||||
re = /^\n( *)/;
|
||||
captures = re.exec(this.input);
|
||||
}
|
||||
|
||||
// established
|
||||
if (captures && captures[1].length) this.indentRe = re;
|
||||
}
|
||||
|
||||
if (captures) {
|
||||
var tok
|
||||
, indents = captures[1].length;
|
||||
|
||||
++this.lineno;
|
||||
this.consume(indents + 1);
|
||||
|
||||
if (' ' == this.input[0] || '\t' == this.input[0]) {
|
||||
throw new Error('Invalid indentation, you can use tabs or spaces but not both');
|
||||
}
|
||||
|
||||
// blank line
|
||||
if ('\n' == this.input[0]) return this.tok('newline');
|
||||
|
||||
// outdent
|
||||
if (this.indentStack.length && indents < this.indentStack[0]) {
|
||||
while (this.indentStack.length && this.indentStack[0] > indents) {
|
||||
this.stash.push(this.tok('outdent'));
|
||||
this.indentStack.shift();
|
||||
}
|
||||
tok = this.stash.pop();
|
||||
// indent
|
||||
} else if (indents && indents != this.indentStack[0]) {
|
||||
this.indentStack.unshift(indents);
|
||||
tok = this.tok('indent', indents);
|
||||
// newline
|
||||
} else {
|
||||
tok = this.tok('newline');
|
||||
}
|
||||
|
||||
return tok;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Pipe-less text consumed only when
|
||||
* pipeless is true;
|
||||
*/
|
||||
|
||||
pipelessText: function() {
|
||||
if (this.pipeless) {
|
||||
if ('\n' == this.input[0]) return;
|
||||
var i = this.input.indexOf('\n');
|
||||
if (-1 == i) i = this.input.length;
|
||||
var str = this.input.substr(0, i);
|
||||
this.consume(str.length);
|
||||
return this.tok('text', str);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* ':'
|
||||
*/
|
||||
|
||||
colon: function() {
|
||||
return this.scan(/^: */, ':');
|
||||
},
|
||||
|
||||
/**
|
||||
* Return the next token object, or those
|
||||
* previously stashed by lookahead.
|
||||
*
|
||||
* @return {Object}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
advance: function(){
|
||||
return this.stashed()
|
||||
|| this.next();
|
||||
},
|
||||
|
||||
/**
|
||||
* Return the next token object.
|
||||
*
|
||||
* @return {Object}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
next: function() {
|
||||
return this.deferred()
|
||||
|| this.blank()
|
||||
|| this.eos()
|
||||
|| this.pipelessText()
|
||||
|| this.yield()
|
||||
|| this.doctype()
|
||||
|| this.interpolation()
|
||||
|| this["case"]()
|
||||
|| this.when()
|
||||
|| this["default"]()
|
||||
|| this["extends"]()
|
||||
|| this.append()
|
||||
|| this.prepend()
|
||||
|| this.block()
|
||||
|| this.include()
|
||||
|| this.mixin()
|
||||
|| this.call()
|
||||
|| this.conditional()
|
||||
|| this.each()
|
||||
|| this["while"]()
|
||||
|| this.assignment()
|
||||
|| this.tag()
|
||||
|| this.filter()
|
||||
|| this.code()
|
||||
|| this.id()
|
||||
|| this.className()
|
||||
|| this.attrs()
|
||||
|| this.indent()
|
||||
|| this.comment()
|
||||
|| this.colon()
|
||||
|| this.text();
|
||||
}
|
||||
};
|
77
node_modules/jade/lib/nodes/attrs.js
generated
vendored
Normal file
77
node_modules/jade/lib/nodes/attrs.js
generated
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
|
||||
/*!
|
||||
* Jade - nodes - Attrs
|
||||
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Node = require('./node'),
|
||||
Block = require('./block');
|
||||
|
||||
/**
|
||||
* Initialize a `Attrs` node.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
var Attrs = module.exports = function Attrs() {
|
||||
this.attrs = [];
|
||||
};
|
||||
|
||||
/**
|
||||
* Inherit from `Node`.
|
||||
*/
|
||||
|
||||
Attrs.prototype.__proto__ = Node.prototype;
|
||||
|
||||
/**
|
||||
* Set attribute `name` to `val`, keep in mind these become
|
||||
* part of a raw js object literal, so to quote a value you must
|
||||
* '"quote me"', otherwise or example 'user.name' is literal JavaScript.
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {String} val
|
||||
* @param {Boolean} escaped
|
||||
* @return {Tag} for chaining
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Attrs.prototype.setAttribute = function(name, val, escaped){
|
||||
this.attrs.push({ name: name, val: val, escaped: escaped });
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Remove attribute `name` when present.
|
||||
*
|
||||
* @param {String} name
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Attrs.prototype.removeAttribute = function(name){
|
||||
for (var i = 0, len = this.attrs.length; i < len; ++i) {
|
||||
if (this.attrs[i] && this.attrs[i].name == name) {
|
||||
delete this.attrs[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get attribute value by `name`.
|
||||
*
|
||||
* @param {String} name
|
||||
* @return {String}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Attrs.prototype.getAttribute = function(name){
|
||||
for (var i = 0, len = this.attrs.length; i < len; ++i) {
|
||||
if (this.attrs[i] && this.attrs[i].name == name) {
|
||||
return this.attrs[i].val;
|
||||
}
|
||||
}
|
||||
};
|
33
node_modules/jade/lib/nodes/block-comment.js
generated
vendored
Normal file
33
node_modules/jade/lib/nodes/block-comment.js
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
|
||||
/*!
|
||||
* Jade - nodes - BlockComment
|
||||
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Node = require('./node');
|
||||
|
||||
/**
|
||||
* Initialize a `BlockComment` with the given `block`.
|
||||
*
|
||||
* @param {String} val
|
||||
* @param {Block} block
|
||||
* @param {Boolean} buffer
|
||||
* @api public
|
||||
*/
|
||||
|
||||
var BlockComment = module.exports = function BlockComment(val, block, buffer) {
|
||||
this.block = block;
|
||||
this.val = val;
|
||||
this.buffer = buffer;
|
||||
};
|
||||
|
||||
/**
|
||||
* Inherit from `Node`.
|
||||
*/
|
||||
|
||||
BlockComment.prototype.__proto__ = Node.prototype;
|
121
node_modules/jade/lib/nodes/block.js
generated
vendored
Normal file
121
node_modules/jade/lib/nodes/block.js
generated
vendored
Normal file
@ -0,0 +1,121 @@
|
||||
|
||||
/*!
|
||||
* Jade - nodes - Block
|
||||
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Node = require('./node');
|
||||
|
||||
/**
|
||||
* Initialize a new `Block` with an optional `node`.
|
||||
*
|
||||
* @param {Node} node
|
||||
* @api public
|
||||
*/
|
||||
|
||||
var Block = module.exports = function Block(node){
|
||||
this.nodes = [];
|
||||
if (node) this.push(node);
|
||||
};
|
||||
|
||||
/**
|
||||
* Inherit from `Node`.
|
||||
*/
|
||||
|
||||
Block.prototype.__proto__ = Node.prototype;
|
||||
|
||||
/**
|
||||
* Block flag.
|
||||
*/
|
||||
|
||||
Block.prototype.isBlock = true;
|
||||
|
||||
/**
|
||||
* Replace the nodes in `other` with the nodes
|
||||
* in `this` block.
|
||||
*
|
||||
* @param {Block} other
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Block.prototype.replace = function(other){
|
||||
other.nodes = this.nodes;
|
||||
};
|
||||
|
||||
/**
|
||||
* Pust the given `node`.
|
||||
*
|
||||
* @param {Node} node
|
||||
* @return {Number}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Block.prototype.push = function(node){
|
||||
return this.nodes.push(node);
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if this block is empty.
|
||||
*
|
||||
* @return {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Block.prototype.isEmpty = function(){
|
||||
return 0 == this.nodes.length;
|
||||
};
|
||||
|
||||
/**
|
||||
* Unshift the given `node`.
|
||||
*
|
||||
* @param {Node} node
|
||||
* @return {Number}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Block.prototype.unshift = function(node){
|
||||
return this.nodes.unshift(node);
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the "last" block, or the first `yield` node.
|
||||
*
|
||||
* @return {Block}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Block.prototype.includeBlock = function(){
|
||||
var ret = this
|
||||
, node;
|
||||
|
||||
for (var i = 0, len = this.nodes.length; i < len; ++i) {
|
||||
node = this.nodes[i];
|
||||
if (node.yield) return node;
|
||||
else if (node.textOnly) continue;
|
||||
else if (node.includeBlock) ret = node.includeBlock();
|
||||
else if (node.block && !node.block.isEmpty()) ret = node.block.includeBlock();
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return a clone of this block.
|
||||
*
|
||||
* @return {Block}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Block.prototype.clone = function(){
|
||||
var clone = new Block;
|
||||
for (var i = 0, len = this.nodes.length; i < len; ++i) {
|
||||
clone.push(this.nodes[i].clone());
|
||||
}
|
||||
return clone;
|
||||
};
|
||||
|
43
node_modules/jade/lib/nodes/case.js
generated
vendored
Normal file
43
node_modules/jade/lib/nodes/case.js
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
|
||||
/*!
|
||||
* Jade - nodes - Case
|
||||
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Node = require('./node');
|
||||
|
||||
/**
|
||||
* Initialize a new `Case` with `expr`.
|
||||
*
|
||||
* @param {String} expr
|
||||
* @api public
|
||||
*/
|
||||
|
||||
var Case = exports = module.exports = function Case(expr, block){
|
||||
this.expr = expr;
|
||||
this.block = block;
|
||||
};
|
||||
|
||||
/**
|
||||
* Inherit from `Node`.
|
||||
*/
|
||||
|
||||
Case.prototype.__proto__ = Node.prototype;
|
||||
|
||||
var When = exports.When = function When(expr, block){
|
||||
this.expr = expr;
|
||||
this.block = block;
|
||||
this.debug = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Inherit from `Node`.
|
||||
*/
|
||||
|
||||
When.prototype.__proto__ = Node.prototype;
|
||||
|
35
node_modules/jade/lib/nodes/code.js
generated
vendored
Normal file
35
node_modules/jade/lib/nodes/code.js
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
|
||||
/*!
|
||||
* Jade - nodes - Code
|
||||
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Node = require('./node');
|
||||
|
||||
/**
|
||||
* Initialize a `Code` node with the given code `val`.
|
||||
* Code may also be optionally buffered and escaped.
|
||||
*
|
||||
* @param {String} val
|
||||
* @param {Boolean} buffer
|
||||
* @param {Boolean} escape
|
||||
* @api public
|
||||
*/
|
||||
|
||||
var Code = module.exports = function Code(val, buffer, escape) {
|
||||
this.val = val;
|
||||
this.buffer = buffer;
|
||||
this.escape = escape;
|
||||
if (val.match(/^ *else/)) this.debug = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Inherit from `Node`.
|
||||
*/
|
||||
|
||||
Code.prototype.__proto__ = Node.prototype;
|
32
node_modules/jade/lib/nodes/comment.js
generated
vendored
Normal file
32
node_modules/jade/lib/nodes/comment.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
/*!
|
||||
* Jade - nodes - Comment
|
||||
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Node = require('./node');
|
||||
|
||||
/**
|
||||
* Initialize a `Comment` with the given `val`, optionally `buffer`,
|
||||
* otherwise the comment may render in the output.
|
||||
*
|
||||
* @param {String} val
|
||||
* @param {Boolean} buffer
|
||||
* @api public
|
||||
*/
|
||||
|
||||
var Comment = module.exports = function Comment(val, buffer) {
|
||||
this.val = val;
|
||||
this.buffer = buffer;
|
||||
};
|
||||
|
||||
/**
|
||||
* Inherit from `Node`.
|
||||
*/
|
||||
|
||||
Comment.prototype.__proto__ = Node.prototype;
|
29
node_modules/jade/lib/nodes/doctype.js
generated
vendored
Normal file
29
node_modules/jade/lib/nodes/doctype.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
|
||||
/*!
|
||||
* Jade - nodes - Doctype
|
||||
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Node = require('./node');
|
||||
|
||||
/**
|
||||
* Initialize a `Doctype` with the given `val`.
|
||||
*
|
||||
* @param {String} val
|
||||
* @api public
|
||||
*/
|
||||
|
||||
var Doctype = module.exports = function Doctype(val) {
|
||||
this.val = val;
|
||||
};
|
||||
|
||||
/**
|
||||
* Inherit from `Node`.
|
||||
*/
|
||||
|
||||
Doctype.prototype.__proto__ = Node.prototype;
|
35
node_modules/jade/lib/nodes/each.js
generated
vendored
Normal file
35
node_modules/jade/lib/nodes/each.js
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
|
||||
/*!
|
||||
* Jade - nodes - Each
|
||||
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Node = require('./node');
|
||||
|
||||
/**
|
||||
* Initialize an `Each` node, representing iteration
|
||||
*
|
||||
* @param {String} obj
|
||||
* @param {String} val
|
||||
* @param {String} key
|
||||
* @param {Block} block
|
||||
* @api public
|
||||
*/
|
||||
|
||||
var Each = module.exports = function Each(obj, val, key, block) {
|
||||
this.obj = obj;
|
||||
this.val = val;
|
||||
this.key = key;
|
||||
this.block = block;
|
||||
};
|
||||
|
||||
/**
|
||||
* Inherit from `Node`.
|
||||
*/
|
||||
|
||||
Each.prototype.__proto__ = Node.prototype;
|
35
node_modules/jade/lib/nodes/filter.js
generated
vendored
Normal file
35
node_modules/jade/lib/nodes/filter.js
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
|
||||
/*!
|
||||
* Jade - nodes - Filter
|
||||
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Node = require('./node')
|
||||
, Block = require('./block');
|
||||
|
||||
/**
|
||||
* Initialize a `Filter` node with the given
|
||||
* filter `name` and `block`.
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {Block|Node} block
|
||||
* @api public
|
||||
*/
|
||||
|
||||
var Filter = module.exports = function Filter(name, block, attrs) {
|
||||
this.name = name;
|
||||
this.block = block;
|
||||
this.attrs = attrs;
|
||||
this.isASTFilter = !block.nodes.every(function(node){ return node.isText });
|
||||
};
|
||||
|
||||
/**
|
||||
* Inherit from `Node`.
|
||||
*/
|
||||
|
||||
Filter.prototype.__proto__ = Node.prototype;
|
20
node_modules/jade/lib/nodes/index.js
generated
vendored
Normal file
20
node_modules/jade/lib/nodes/index.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
/*!
|
||||
* Jade - nodes
|
||||
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
exports.Node = require('./node');
|
||||
exports.Tag = require('./tag');
|
||||
exports.Code = require('./code');
|
||||
exports.Each = require('./each');
|
||||
exports.Case = require('./case');
|
||||
exports.Text = require('./text');
|
||||
exports.Block = require('./block');
|
||||
exports.Mixin = require('./mixin');
|
||||
exports.Filter = require('./filter');
|
||||
exports.Comment = require('./comment');
|
||||
exports.Literal = require('./literal');
|
||||
exports.BlockComment = require('./block-comment');
|
||||
exports.Doctype = require('./doctype');
|
32
node_modules/jade/lib/nodes/literal.js
generated
vendored
Normal file
32
node_modules/jade/lib/nodes/literal.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
/*!
|
||||
* Jade - nodes - Literal
|
||||
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Node = require('./node');
|
||||
|
||||
/**
|
||||
* Initialize a `Literal` node with the given `str.
|
||||
*
|
||||
* @param {String} str
|
||||
* @api public
|
||||
*/
|
||||
|
||||
var Literal = module.exports = function Literal(str) {
|
||||
this.str = str
|
||||
.replace(/\\/g, "\\\\")
|
||||
.replace(/\n|\r\n/g, "\\n")
|
||||
.replace(/'/g, "\\'");
|
||||
};
|
||||
|
||||
/**
|
||||
* Inherit from `Node`.
|
||||
*/
|
||||
|
||||
Literal.prototype.__proto__ = Node.prototype;
|
36
node_modules/jade/lib/nodes/mixin.js
generated
vendored
Normal file
36
node_modules/jade/lib/nodes/mixin.js
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
|
||||
/*!
|
||||
* Jade - nodes - Mixin
|
||||
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Attrs = require('./attrs');
|
||||
|
||||
/**
|
||||
* Initialize a new `Mixin` with `name` and `block`.
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {String} args
|
||||
* @param {Block} block
|
||||
* @api public
|
||||
*/
|
||||
|
||||
var Mixin = module.exports = function Mixin(name, args, block, call){
|
||||
this.name = name;
|
||||
this.args = args;
|
||||
this.block = block;
|
||||
this.attrs = [];
|
||||
this.call = call;
|
||||
};
|
||||
|
||||
/**
|
||||
* Inherit from `Attrs`.
|
||||
*/
|
||||
|
||||
Mixin.prototype.__proto__ = Attrs.prototype;
|
||||
|
25
node_modules/jade/lib/nodes/node.js
generated
vendored
Normal file
25
node_modules/jade/lib/nodes/node.js
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
/*!
|
||||
* Jade - nodes - Node
|
||||
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Initialize a `Node`.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
var Node = module.exports = function Node(){};
|
||||
|
||||
/**
|
||||
* Clone this node (return itself)
|
||||
*
|
||||
* @return {Node}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Node.prototype.clone = function(){
|
||||
return this;
|
||||
};
|
95
node_modules/jade/lib/nodes/tag.js
generated
vendored
Normal file
95
node_modules/jade/lib/nodes/tag.js
generated
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
|
||||
/*!
|
||||
* Jade - nodes - Tag
|
||||
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Attrs = require('./attrs'),
|
||||
Block = require('./block'),
|
||||
inlineTags = require('../inline-tags');
|
||||
|
||||
/**
|
||||
* Initialize a `Tag` node with the given tag `name` and optional `block`.
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {Block} block
|
||||
* @api public
|
||||
*/
|
||||
|
||||
var Tag = module.exports = function Tag(name, block) {
|
||||
this.name = name;
|
||||
this.attrs = [];
|
||||
this.block = block || new Block;
|
||||
};
|
||||
|
||||
/**
|
||||
* Inherit from `Attrs`.
|
||||
*/
|
||||
|
||||
Tag.prototype.__proto__ = Attrs.prototype;
|
||||
|
||||
/**
|
||||
* Clone this tag.
|
||||
*
|
||||
* @return {Tag}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Tag.prototype.clone = function(){
|
||||
var clone = new Tag(this.name, this.block.clone());
|
||||
clone.line = this.line;
|
||||
clone.attrs = this.attrs;
|
||||
clone.textOnly = this.textOnly;
|
||||
return clone;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if this tag is an inline tag.
|
||||
*
|
||||
* @return {Boolean}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Tag.prototype.isInline = function(){
|
||||
return ~inlineTags.indexOf(this.name);
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if this tag's contents can be inlined. Used for pretty printing.
|
||||
*
|
||||
* @return {Boolean}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Tag.prototype.canInline = function(){
|
||||
var nodes = this.block.nodes;
|
||||
|
||||
function isInline(node){
|
||||
// Recurse if the node is a block
|
||||
if (node.isBlock) return node.nodes.every(isInline);
|
||||
return node.isText || (node.isInline && node.isInline());
|
||||
}
|
||||
|
||||
// Empty tag
|
||||
if (!nodes.length) return true;
|
||||
|
||||
// Text-only or inline-only tag
|
||||
if (1 == nodes.length) return isInline(nodes[0]);
|
||||
|
||||
// Multi-line inline-only tag
|
||||
if (this.block.nodes.every(isInline)) {
|
||||
for (var i = 1, len = nodes.length; i < len; ++i) {
|
||||
if (nodes[i-1].isText && nodes[i].isText)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Mixed tag
|
||||
return false;
|
||||
};
|
36
node_modules/jade/lib/nodes/text.js
generated
vendored
Normal file
36
node_modules/jade/lib/nodes/text.js
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
|
||||
/*!
|
||||
* Jade - nodes - Text
|
||||
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Node = require('./node');
|
||||
|
||||
/**
|
||||
* Initialize a `Text` node with optional `line`.
|
||||
*
|
||||
* @param {String} line
|
||||
* @api public
|
||||
*/
|
||||
|
||||
var Text = module.exports = function Text(line) {
|
||||
this.val = '';
|
||||
if ('string' == typeof line) this.val = line;
|
||||
};
|
||||
|
||||
/**
|
||||
* Inherit from `Node`.
|
||||
*/
|
||||
|
||||
Text.prototype.__proto__ = Node.prototype;
|
||||
|
||||
/**
|
||||
* Flag as text.
|
||||
*/
|
||||
|
||||
Text.prototype.isText = true;
|
710
node_modules/jade/lib/parser.js
generated
vendored
Normal file
710
node_modules/jade/lib/parser.js
generated
vendored
Normal file
@ -0,0 +1,710 @@
|
||||
|
||||
/*!
|
||||
* Jade - Parser
|
||||
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Lexer = require('./lexer')
|
||||
, nodes = require('./nodes');
|
||||
|
||||
/**
|
||||
* Initialize `Parser` with the given input `str` and `filename`.
|
||||
*
|
||||
* @param {String} str
|
||||
* @param {String} filename
|
||||
* @param {Object} options
|
||||
* @api public
|
||||
*/
|
||||
|
||||
var Parser = exports = module.exports = function Parser(str, filename, options){
|
||||
this.input = str;
|
||||
this.lexer = new Lexer(str, options);
|
||||
this.filename = filename;
|
||||
this.blocks = {};
|
||||
this.mixins = {};
|
||||
this.options = options;
|
||||
this.contexts = [this];
|
||||
};
|
||||
|
||||
/**
|
||||
* Tags that may not contain tags.
|
||||
*/
|
||||
|
||||
var textOnly = exports.textOnly = ['script', 'style'];
|
||||
|
||||
/**
|
||||
* Parser prototype.
|
||||
*/
|
||||
|
||||
Parser.prototype = {
|
||||
|
||||
/**
|
||||
* Push `parser` onto the context stack,
|
||||
* or pop and return a `Parser`.
|
||||
*/
|
||||
|
||||
context: function(parser){
|
||||
if (parser) {
|
||||
this.contexts.push(parser);
|
||||
} else {
|
||||
return this.contexts.pop();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Return the next token object.
|
||||
*
|
||||
* @return {Object}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
advance: function(){
|
||||
return this.lexer.advance();
|
||||
},
|
||||
|
||||
/**
|
||||
* Skip `n` tokens.
|
||||
*
|
||||
* @param {Number} n
|
||||
* @api private
|
||||
*/
|
||||
|
||||
skip: function(n){
|
||||
while (n--) this.advance();
|
||||
},
|
||||
|
||||
/**
|
||||
* Single token lookahead.
|
||||
*
|
||||
* @return {Object}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
peek: function() {
|
||||
return this.lookahead(1);
|
||||
},
|
||||
|
||||
/**
|
||||
* Return lexer lineno.
|
||||
*
|
||||
* @return {Number}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
line: function() {
|
||||
return this.lexer.lineno;
|
||||
},
|
||||
|
||||
/**
|
||||
* `n` token lookahead.
|
||||
*
|
||||
* @param {Number} n
|
||||
* @return {Object}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
lookahead: function(n){
|
||||
return this.lexer.lookahead(n);
|
||||
},
|
||||
|
||||
/**
|
||||
* Parse input returning a string of js for evaluation.
|
||||
*
|
||||
* @return {String}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
parse: function(){
|
||||
var block = new nodes.Block, parser;
|
||||
block.line = this.line();
|
||||
|
||||
while ('eos' != this.peek().type) {
|
||||
if ('newline' == this.peek().type) {
|
||||
this.advance();
|
||||
} else {
|
||||
block.push(this.parseExpr());
|
||||
}
|
||||
}
|
||||
|
||||
if (parser = this.extending) {
|
||||
this.context(parser);
|
||||
var ast = parser.parse();
|
||||
this.context();
|
||||
// hoist mixins
|
||||
for (var name in this.mixins)
|
||||
ast.unshift(this.mixins[name]);
|
||||
return ast;
|
||||
}
|
||||
|
||||
return block;
|
||||
},
|
||||
|
||||
/**
|
||||
* Expect the given type, or throw an exception.
|
||||
*
|
||||
* @param {String} type
|
||||
* @api private
|
||||
*/
|
||||
|
||||
expect: function(type){
|
||||
if (this.peek().type === type) {
|
||||
return this.advance();
|
||||
} else {
|
||||
throw new Error('expected "' + type + '", but got "' + this.peek().type + '"');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Accept the given `type`.
|
||||
*
|
||||
* @param {String} type
|
||||
* @api private
|
||||
*/
|
||||
|
||||
accept: function(type){
|
||||
if (this.peek().type === type) {
|
||||
return this.advance();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* tag
|
||||
* | doctype
|
||||
* | mixin
|
||||
* | include
|
||||
* | filter
|
||||
* | comment
|
||||
* | text
|
||||
* | each
|
||||
* | code
|
||||
* | yield
|
||||
* | id
|
||||
* | class
|
||||
* | interpolation
|
||||
*/
|
||||
|
||||
parseExpr: function(){
|
||||
switch (this.peek().type) {
|
||||
case 'tag':
|
||||
return this.parseTag();
|
||||
case 'mixin':
|
||||
return this.parseMixin();
|
||||
case 'block':
|
||||
return this.parseBlock();
|
||||
case 'case':
|
||||
return this.parseCase();
|
||||
case 'when':
|
||||
return this.parseWhen();
|
||||
case 'default':
|
||||
return this.parseDefault();
|
||||
case 'extends':
|
||||
return this.parseExtends();
|
||||
case 'include':
|
||||
return this.parseInclude();
|
||||
case 'doctype':
|
||||
return this.parseDoctype();
|
||||
case 'filter':
|
||||
return this.parseFilter();
|
||||
case 'comment':
|
||||
return this.parseComment();
|
||||
case 'text':
|
||||
return this.parseText();
|
||||
case 'each':
|
||||
return this.parseEach();
|
||||
case 'code':
|
||||
return this.parseCode();
|
||||
case 'call':
|
||||
return this.parseCall();
|
||||
case 'interpolation':
|
||||
return this.parseInterpolation();
|
||||
case 'yield':
|
||||
this.advance();
|
||||
var block = new nodes.Block;
|
||||
block.yield = true;
|
||||
return block;
|
||||
case 'id':
|
||||
case 'class':
|
||||
var tok = this.advance();
|
||||
this.lexer.defer(this.lexer.tok('tag', 'div'));
|
||||
this.lexer.defer(tok);
|
||||
return this.parseExpr();
|
||||
default:
|
||||
throw new Error('unexpected token "' + this.peek().type + '"');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Text
|
||||
*/
|
||||
|
||||
parseText: function(){
|
||||
var tok = this.expect('text')
|
||||
, node = new nodes.Text(tok.val);
|
||||
node.line = this.line();
|
||||
return node;
|
||||
},
|
||||
|
||||
/**
|
||||
* ':' expr
|
||||
* | block
|
||||
*/
|
||||
|
||||
parseBlockExpansion: function(){
|
||||
if (':' == this.peek().type) {
|
||||
this.advance();
|
||||
return new nodes.Block(this.parseExpr());
|
||||
} else {
|
||||
return this.block();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* case
|
||||
*/
|
||||
|
||||
parseCase: function(){
|
||||
var val = this.expect('case').val
|
||||
, node = new nodes.Case(val);
|
||||
node.line = this.line();
|
||||
node.block = this.block();
|
||||
return node;
|
||||
},
|
||||
|
||||
/**
|
||||
* when
|
||||
*/
|
||||
|
||||
parseWhen: function(){
|
||||
var val = this.expect('when').val
|
||||
return new nodes.Case.When(val, this.parseBlockExpansion());
|
||||
},
|
||||
|
||||
/**
|
||||
* default
|
||||
*/
|
||||
|
||||
parseDefault: function(){
|
||||
this.expect('default');
|
||||
return new nodes.Case.When('default', this.parseBlockExpansion());
|
||||
},
|
||||
|
||||
/**
|
||||
* code
|
||||
*/
|
||||
|
||||
parseCode: function(){
|
||||
var tok = this.expect('code')
|
||||
, node = new nodes.Code(tok.val, tok.buffer, tok.escape)
|
||||
, block
|
||||
, i = 1;
|
||||
node.line = this.line();
|
||||
while (this.lookahead(i) && 'newline' == this.lookahead(i).type) ++i;
|
||||
block = 'indent' == this.lookahead(i).type;
|
||||
if (block) {
|
||||
this.skip(i-1);
|
||||
node.block = this.block();
|
||||
}
|
||||
return node;
|
||||
},
|
||||
|
||||
/**
|
||||
* comment
|
||||
*/
|
||||
|
||||
parseComment: function(){
|
||||
var tok = this.expect('comment')
|
||||
, node;
|
||||
|
||||
if ('indent' == this.peek().type) {
|
||||
node = new nodes.BlockComment(tok.val, this.block(), tok.buffer);
|
||||
} else {
|
||||
node = new nodes.Comment(tok.val, tok.buffer);
|
||||
}
|
||||
|
||||
node.line = this.line();
|
||||
return node;
|
||||
},
|
||||
|
||||
/**
|
||||
* doctype
|
||||
*/
|
||||
|
||||
parseDoctype: function(){
|
||||
var tok = this.expect('doctype')
|
||||
, node = new nodes.Doctype(tok.val);
|
||||
node.line = this.line();
|
||||
return node;
|
||||
},
|
||||
|
||||
/**
|
||||
* filter attrs? text-block
|
||||
*/
|
||||
|
||||
parseFilter: function(){
|
||||
var block
|
||||
, tok = this.expect('filter')
|
||||
, attrs = this.accept('attrs');
|
||||
|
||||
this.lexer.pipeless = true;
|
||||
block = this.parseTextBlock();
|
||||
this.lexer.pipeless = false;
|
||||
|
||||
var node = new nodes.Filter(tok.val, block, attrs && attrs.attrs);
|
||||
node.line = this.line();
|
||||
return node;
|
||||
},
|
||||
|
||||
/**
|
||||
* tag ':' attrs? block
|
||||
*/
|
||||
|
||||
parseASTFilter: function(){
|
||||
var block
|
||||
, tok = this.expect('tag')
|
||||
, attrs = this.accept('attrs');
|
||||
|
||||
this.expect(':');
|
||||
block = this.block();
|
||||
|
||||
var node = new nodes.Filter(tok.val, block, attrs && attrs.attrs);
|
||||
node.line = this.line();
|
||||
return node;
|
||||
},
|
||||
|
||||
/**
|
||||
* each block
|
||||
*/
|
||||
|
||||
parseEach: function(){
|
||||
var tok = this.expect('each')
|
||||
, node = new nodes.Each(tok.code, tok.val, tok.key);
|
||||
node.line = this.line();
|
||||
node.block = this.block();
|
||||
return node;
|
||||
},
|
||||
|
||||
/**
|
||||
* 'extends' name
|
||||
*/
|
||||
|
||||
parseExtends: function(){
|
||||
var path = require('path')
|
||||
, fs = require('fs')
|
||||
, dirname = path.dirname
|
||||
, basename = path.basename
|
||||
, join = path.join;
|
||||
|
||||
if (!this.filename)
|
||||
throw new Error('the "filename" option is required to extend templates');
|
||||
|
||||
var path = this.expect('extends').val.trim()
|
||||
, dir = dirname(this.filename);
|
||||
|
||||
var path = join(dir, path + '.jade')
|
||||
, str = fs.readFileSync(path, 'utf8')
|
||||
, parser = new Parser(str, path, this.options);
|
||||
|
||||
parser.blocks = this.blocks;
|
||||
parser.contexts = this.contexts;
|
||||
this.extending = parser;
|
||||
|
||||
// TODO: null node
|
||||
return new nodes.Literal('');
|
||||
},
|
||||
|
||||
/**
|
||||
* 'block' name block
|
||||
*/
|
||||
|
||||
parseBlock: function(){
|
||||
var block = this.expect('block')
|
||||
, mode = block.mode
|
||||
, name = block.val.trim();
|
||||
|
||||
block = 'indent' == this.peek().type
|
||||
? this.block()
|
||||
: new nodes.Block(new nodes.Literal(''));
|
||||
|
||||
var prev = this.blocks[name];
|
||||
|
||||
if (prev) {
|
||||
switch (prev.mode) {
|
||||
case 'append':
|
||||
block.nodes = block.nodes.concat(prev.nodes);
|
||||
prev = block;
|
||||
break;
|
||||
case 'prepend':
|
||||
block.nodes = prev.nodes.concat(block.nodes);
|
||||
prev = block;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
block.mode = mode;
|
||||
return this.blocks[name] = prev || block;
|
||||
},
|
||||
|
||||
/**
|
||||
* include block?
|
||||
*/
|
||||
|
||||
parseInclude: function(){
|
||||
var path = require('path')
|
||||
, fs = require('fs')
|
||||
, dirname = path.dirname
|
||||
, basename = path.basename
|
||||
, join = path.join;
|
||||
|
||||
var path = this.expect('include').val.trim()
|
||||
, dir = dirname(this.filename);
|
||||
|
||||
if (!this.filename)
|
||||
throw new Error('the "filename" option is required to use includes');
|
||||
|
||||
// no extension
|
||||
if (!~basename(path).indexOf('.')) {
|
||||
path += '.jade';
|
||||
}
|
||||
|
||||
// non-jade
|
||||
if ('.jade' != path.substr(-5)) {
|
||||
var path = join(dir, path)
|
||||
, str = fs.readFileSync(path, 'utf8');
|
||||
return new nodes.Literal(str);
|
||||
}
|
||||
|
||||
var path = join(dir, path)
|
||||
, str = fs.readFileSync(path, 'utf8')
|
||||
, parser = new Parser(str, path, this.options);
|
||||
parser.blocks = this.blocks;
|
||||
parser.mixins = this.mixins;
|
||||
|
||||
this.context(parser);
|
||||
var ast = parser.parse();
|
||||
this.context();
|
||||
ast.filename = path;
|
||||
|
||||
if ('indent' == this.peek().type) {
|
||||
ast.includeBlock().push(this.block());
|
||||
}
|
||||
|
||||
return ast;
|
||||
},
|
||||
|
||||
/**
|
||||
* call ident block
|
||||
*/
|
||||
|
||||
parseCall: function(){
|
||||
var tok = this.expect('call')
|
||||
, name = tok.val
|
||||
, args = tok.args
|
||||
, mixin = new nodes.Mixin(name, args, new nodes.Block, true);
|
||||
|
||||
this.tag(mixin);
|
||||
if (mixin.block.isEmpty()) mixin.block = null;
|
||||
return mixin;
|
||||
},
|
||||
|
||||
/**
|
||||
* mixin block
|
||||
*/
|
||||
|
||||
parseMixin: function(){
|
||||
var tok = this.expect('mixin')
|
||||
, name = tok.val
|
||||
, args = tok.args
|
||||
, mixin;
|
||||
|
||||
// definition
|
||||
if ('indent' == this.peek().type) {
|
||||
mixin = new nodes.Mixin(name, args, this.block(), false);
|
||||
this.mixins[name] = mixin;
|
||||
return mixin;
|
||||
// call
|
||||
} else {
|
||||
return new nodes.Mixin(name, args, null, true);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* indent (text | newline)* outdent
|
||||
*/
|
||||
|
||||
parseTextBlock: function(){
|
||||
var block = new nodes.Block;
|
||||
block.line = this.line();
|
||||
var spaces = this.expect('indent').val;
|
||||
if (null == this._spaces) this._spaces = spaces;
|
||||
var indent = Array(spaces - this._spaces + 1).join(' ');
|
||||
while ('outdent' != this.peek().type) {
|
||||
switch (this.peek().type) {
|
||||
case 'newline':
|
||||
this.advance();
|
||||
break;
|
||||
case 'indent':
|
||||
this.parseTextBlock().nodes.forEach(function(node){
|
||||
block.push(node);
|
||||
});
|
||||
break;
|
||||
default:
|
||||
var text = new nodes.Text(indent + this.advance().val);
|
||||
text.line = this.line();
|
||||
block.push(text);
|
||||
}
|
||||
}
|
||||
|
||||
if (spaces == this._spaces) this._spaces = null;
|
||||
this.expect('outdent');
|
||||
return block;
|
||||
},
|
||||
|
||||
/**
|
||||
* indent expr* outdent
|
||||
*/
|
||||
|
||||
block: function(){
|
||||
var block = new nodes.Block;
|
||||
block.line = this.line();
|
||||
this.expect('indent');
|
||||
while ('outdent' != this.peek().type) {
|
||||
if ('newline' == this.peek().type) {
|
||||
this.advance();
|
||||
} else {
|
||||
block.push(this.parseExpr());
|
||||
}
|
||||
}
|
||||
this.expect('outdent');
|
||||
return block;
|
||||
},
|
||||
|
||||
/**
|
||||
* interpolation (attrs | class | id)* (text | code | ':')? newline* block?
|
||||
*/
|
||||
|
||||
parseInterpolation: function(){
|
||||
var tok = this.advance();
|
||||
var tag = new nodes.Tag(tok.val);
|
||||
tag.buffer = true;
|
||||
return this.tag(tag);
|
||||
},
|
||||
|
||||
/**
|
||||
* tag (attrs | class | id)* (text | code | ':')? newline* block?
|
||||
*/
|
||||
|
||||
parseTag: function(){
|
||||
// ast-filter look-ahead
|
||||
var i = 2;
|
||||
if ('attrs' == this.lookahead(i).type) ++i;
|
||||
if (':' == this.lookahead(i).type) {
|
||||
if ('indent' == this.lookahead(++i).type) {
|
||||
return this.parseASTFilter();
|
||||
}
|
||||
}
|
||||
|
||||
var tok = this.advance()
|
||||
, tag = new nodes.Tag(tok.val);
|
||||
|
||||
tag.selfClosing = tok.selfClosing;
|
||||
|
||||
return this.tag(tag);
|
||||
},
|
||||
|
||||
/**
|
||||
* Parse tag.
|
||||
*/
|
||||
|
||||
tag: function(tag){
|
||||
var dot;
|
||||
|
||||
tag.line = this.line();
|
||||
|
||||
// (attrs | class | id)*
|
||||
out:
|
||||
while (true) {
|
||||
switch (this.peek().type) {
|
||||
case 'id':
|
||||
case 'class':
|
||||
var tok = this.advance();
|
||||
tag.setAttribute(tok.type, "'" + tok.val + "'");
|
||||
continue;
|
||||
case 'attrs':
|
||||
var tok = this.advance()
|
||||
, obj = tok.attrs
|
||||
, escaped = tok.escaped
|
||||
, names = Object.keys(obj);
|
||||
|
||||
if (tok.selfClosing) tag.selfClosing = true;
|
||||
|
||||
for (var i = 0, len = names.length; i < len; ++i) {
|
||||
var name = names[i]
|
||||
, val = obj[name];
|
||||
tag.setAttribute(name, val, escaped[name]);
|
||||
}
|
||||
continue;
|
||||
default:
|
||||
break out;
|
||||
}
|
||||
}
|
||||
|
||||
// check immediate '.'
|
||||
if ('.' == this.peek().val) {
|
||||
dot = tag.textOnly = true;
|
||||
this.advance();
|
||||
}
|
||||
|
||||
// (text | code | ':')?
|
||||
switch (this.peek().type) {
|
||||
case 'text':
|
||||
tag.block.push(this.parseText());
|
||||
break;
|
||||
case 'code':
|
||||
tag.code = this.parseCode();
|
||||
break;
|
||||
case ':':
|
||||
this.advance();
|
||||
tag.block = new nodes.Block;
|
||||
tag.block.push(this.parseExpr());
|
||||
break;
|
||||
}
|
||||
|
||||
// newline*
|
||||
while ('newline' == this.peek().type) this.advance();
|
||||
|
||||
tag.textOnly = tag.textOnly || ~textOnly.indexOf(tag.name);
|
||||
|
||||
// script special-case
|
||||
if ('script' == tag.name) {
|
||||
var type = tag.getAttribute('type');
|
||||
if (!dot && type && 'text/javascript' != type.replace(/^['"]|['"]$/g, '')) {
|
||||
tag.textOnly = false;
|
||||
}
|
||||
}
|
||||
|
||||
// block?
|
||||
if ('indent' == this.peek().type) {
|
||||
if (tag.textOnly) {
|
||||
this.lexer.pipeless = true;
|
||||
tag.block = this.parseTextBlock();
|
||||
this.lexer.pipeless = false;
|
||||
} else {
|
||||
var block = this.block();
|
||||
if (tag.block) {
|
||||
for (var i = 0, len = block.nodes.length; i < len; ++i) {
|
||||
tag.block.push(block.nodes[i]);
|
||||
}
|
||||
} else {
|
||||
tag.block = block;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tag;
|
||||
}
|
||||
};
|
174
node_modules/jade/lib/runtime.js
generated
vendored
Normal file
174
node_modules/jade/lib/runtime.js
generated
vendored
Normal file
@ -0,0 +1,174 @@
|
||||
|
||||
/*!
|
||||
* Jade - runtime
|
||||
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Lame Array.isArray() polyfill for now.
|
||||
*/
|
||||
|
||||
if (!Array.isArray) {
|
||||
Array.isArray = function(arr){
|
||||
return '[object Array]' == Object.prototype.toString.call(arr);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Lame Object.keys() polyfill for now.
|
||||
*/
|
||||
|
||||
if (!Object.keys) {
|
||||
Object.keys = function(obj){
|
||||
var arr = [];
|
||||
for (var key in obj) {
|
||||
if (obj.hasOwnProperty(key)) {
|
||||
arr.push(key);
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge two attribute objects giving precedence
|
||||
* to values in object `b`. Classes are special-cased
|
||||
* allowing for arrays and merging/joining appropriately
|
||||
* resulting in a string.
|
||||
*
|
||||
* @param {Object} a
|
||||
* @param {Object} b
|
||||
* @return {Object} a
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.merge = function merge(a, b) {
|
||||
var ac = a['class'];
|
||||
var bc = b['class'];
|
||||
|
||||
if (ac || bc) {
|
||||
ac = ac || [];
|
||||
bc = bc || [];
|
||||
if (!Array.isArray(ac)) ac = [ac];
|
||||
if (!Array.isArray(bc)) bc = [bc];
|
||||
ac = ac.filter(nulls);
|
||||
bc = bc.filter(nulls);
|
||||
a['class'] = ac.concat(bc).join(' ');
|
||||
}
|
||||
|
||||
for (var key in b) {
|
||||
if (key != 'class') {
|
||||
a[key] = b[key];
|
||||
}
|
||||
}
|
||||
|
||||
return a;
|
||||
};
|
||||
|
||||
/**
|
||||
* Filter null `val`s.
|
||||
*
|
||||
* @param {Mixed} val
|
||||
* @return {Mixed}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function nulls(val) {
|
||||
return val != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the given attributes object.
|
||||
*
|
||||
* @param {Object} obj
|
||||
* @param {Object} escaped
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.attrs = function attrs(obj, escaped){
|
||||
var buf = []
|
||||
, terse = obj.terse;
|
||||
|
||||
delete obj.terse;
|
||||
var keys = Object.keys(obj)
|
||||
, len = keys.length;
|
||||
|
||||
if (len) {
|
||||
buf.push('');
|
||||
for (var i = 0; i < len; ++i) {
|
||||
var key = keys[i]
|
||||
, val = obj[key];
|
||||
|
||||
if ('boolean' == typeof val || null == val) {
|
||||
if (val) {
|
||||
terse
|
||||
? buf.push(key)
|
||||
: buf.push(key + '="' + key + '"');
|
||||
}
|
||||
} else if (0 == key.indexOf('data') && 'string' != typeof val) {
|
||||
buf.push(key + "='" + JSON.stringify(val) + "'");
|
||||
} else if ('class' == key && Array.isArray(val)) {
|
||||
buf.push(key + '="' + exports.escape(val.join(' ')) + '"');
|
||||
} else if (escaped && escaped[key]) {
|
||||
buf.push(key + '="' + exports.escape(val) + '"');
|
||||
} else {
|
||||
buf.push(key + '="' + val + '"');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return buf.join(' ');
|
||||
};
|
||||
|
||||
/**
|
||||
* Escape the given string of `html`.
|
||||
*
|
||||
* @param {String} html
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.escape = function escape(html){
|
||||
return String(html)
|
||||
.replace(/&(?!(\w+|\#\d+);)/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"');
|
||||
};
|
||||
|
||||
/**
|
||||
* Re-throw the given `err` in context to the
|
||||
* the jade in `filename` at the given `lineno`.
|
||||
*
|
||||
* @param {Error} err
|
||||
* @param {String} filename
|
||||
* @param {String} lineno
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.rethrow = function rethrow(err, filename, lineno){
|
||||
if (!filename) throw err;
|
||||
|
||||
var context = 3
|
||||
, str = require('fs').readFileSync(filename, 'utf8')
|
||||
, lines = str.split('\n')
|
||||
, start = Math.max(lineno - context, 0)
|
||||
, end = Math.min(lines.length, lineno + context);
|
||||
|
||||
// Error context
|
||||
var context = lines.slice(start, end).map(function(line, i){
|
||||
var curr = i + start + 1;
|
||||
return (curr == lineno ? ' > ' : ' ')
|
||||
+ curr
|
||||
+ '| '
|
||||
+ line;
|
||||
}).join('\n');
|
||||
|
||||
// Alter exception message
|
||||
err.path = filename;
|
||||
err.message = (filename || 'Jade') + ':' + lineno
|
||||
+ '\n' + context + '\n\n' + err.message;
|
||||
throw err;
|
||||
};
|
19
node_modules/jade/lib/self-closing.js
generated
vendored
Normal file
19
node_modules/jade/lib/self-closing.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
|
||||
/*!
|
||||
* Jade - self closing tags
|
||||
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
module.exports = [
|
||||
'meta'
|
||||
, 'img'
|
||||
, 'link'
|
||||
, 'input'
|
||||
, 'source'
|
||||
, 'area'
|
||||
, 'base'
|
||||
, 'col'
|
||||
, 'br'
|
||||
, 'hr'
|
||||
];
|
49
node_modules/jade/lib/utils.js
generated
vendored
Normal file
49
node_modules/jade/lib/utils.js
generated
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
|
||||
/*!
|
||||
* Jade - utils
|
||||
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Convert interpolation in the given string to JavaScript.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
var interpolate = exports.interpolate = function(str){
|
||||
return str.replace(/(\\)?([#!]){(.*?)}/g, function(str, escape, flag, code){
|
||||
return escape
|
||||
? str
|
||||
: "' + "
|
||||
+ ('!' == flag ? '' : 'escape')
|
||||
+ "((interp = " + code.replace(/\\'/g, "'")
|
||||
+ ") == null ? '' : interp) + '";
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Escape single quotes in `str`.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
var escape = exports.escape = function(str) {
|
||||
return str.replace(/'/g, "\\'");
|
||||
};
|
||||
|
||||
/**
|
||||
* Interpolate, and escape the given `str`.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.text = function(str){
|
||||
return interpolate(escape(str));
|
||||
};
|
4
node_modules/jade/node_modules/commander/.npmignore
generated
vendored
Normal file
4
node_modules/jade/node_modules/commander/.npmignore
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
support
|
||||
test
|
||||
examples
|
||||
*.sock
|
4
node_modules/jade/node_modules/commander/.travis.yml
generated
vendored
Normal file
4
node_modules/jade/node_modules/commander/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 0.4
|
||||
- 0.6
|
107
node_modules/jade/node_modules/commander/History.md
generated
vendored
Normal file
107
node_modules/jade/node_modules/commander/History.md
generated
vendored
Normal file
@ -0,0 +1,107 @@
|
||||
|
||||
0.6.1 / 2012-06-01
|
||||
==================
|
||||
|
||||
* Added: append (yes or no) on confirmation
|
||||
* Added: allow node.js v0.7.x
|
||||
|
||||
0.6.0 / 2012-04-10
|
||||
==================
|
||||
|
||||
* Added `.prompt(obj, callback)` support. Closes #49
|
||||
* Added default support to .choose(). Closes #41
|
||||
* Fixed the choice example
|
||||
|
||||
0.5.1 / 2011-12-20
|
||||
==================
|
||||
|
||||
* Fixed `password()` for recent nodes. Closes #36
|
||||
|
||||
0.5.0 / 2011-12-04
|
||||
==================
|
||||
|
||||
* Added sub-command option support [itay]
|
||||
|
||||
0.4.3 / 2011-12-04
|
||||
==================
|
||||
|
||||
* Fixed custom help ordering. Closes #32
|
||||
|
||||
0.4.2 / 2011-11-24
|
||||
==================
|
||||
|
||||
* Added travis support
|
||||
* Fixed: line-buffered input automatically trimmed. Closes #31
|
||||
|
||||
0.4.1 / 2011-11-18
|
||||
==================
|
||||
|
||||
* Removed listening for "close" on --help
|
||||
|
||||
0.4.0 / 2011-11-15
|
||||
==================
|
||||
|
||||
* Added support for `--`. Closes #24
|
||||
|
||||
0.3.3 / 2011-11-14
|
||||
==================
|
||||
|
||||
* Fixed: wait for close event when writing help info [Jerry Hamlet]
|
||||
|
||||
0.3.2 / 2011-11-01
|
||||
==================
|
||||
|
||||
* Fixed long flag definitions with values [felixge]
|
||||
|
||||
0.3.1 / 2011-10-31
|
||||
==================
|
||||
|
||||
* Changed `--version` short flag to `-V` from `-v`
|
||||
* Changed `.version()` so it's configurable [felixge]
|
||||
|
||||
0.3.0 / 2011-10-31
|
||||
==================
|
||||
|
||||
* Added support for long flags only. Closes #18
|
||||
|
||||
0.2.1 / 2011-10-24
|
||||
==================
|
||||
|
||||
* "node": ">= 0.4.x < 0.7.0". Closes #20
|
||||
|
||||
0.2.0 / 2011-09-26
|
||||
==================
|
||||
|
||||
* Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs]
|
||||
|
||||
0.1.0 / 2011-08-24
|
||||
==================
|
||||
|
||||
* Added support for custom `--help` output
|
||||
|
||||
0.0.5 / 2011-08-18
|
||||
==================
|
||||
|
||||
* Changed: when the user enters nothing prompt for password again
|
||||
* Fixed issue with passwords beginning with numbers [NuckChorris]
|
||||
|
||||
0.0.4 / 2011-08-15
|
||||
==================
|
||||
|
||||
* Fixed `Commander#args`
|
||||
|
||||
0.0.3 / 2011-08-15
|
||||
==================
|
||||
|
||||
* Added default option value support
|
||||
|
||||
0.0.2 / 2011-08-15
|
||||
==================
|
||||
|
||||
* Added mask support to `Command#password(str[, mask], fn)`
|
||||
* Added `Command#password(str, fn)`
|
||||
|
||||
0.0.1 / 2010-01-03
|
||||
==================
|
||||
|
||||
* Initial release
|
7
node_modules/jade/node_modules/commander/Makefile
generated
vendored
Normal file
7
node_modules/jade/node_modules/commander/Makefile
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
TESTS = $(shell find test/test.*.js)
|
||||
|
||||
test:
|
||||
@./test/run $(TESTS)
|
||||
|
||||
.PHONY: test
|
262
node_modules/jade/node_modules/commander/Readme.md
generated
vendored
Normal file
262
node_modules/jade/node_modules/commander/Readme.md
generated
vendored
Normal file
@ -0,0 +1,262 @@
|
||||
# Commander.js
|
||||
|
||||
The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/visionmedia/commander).
|
||||
|
||||
[![Build Status](https://secure.travis-ci.org/visionmedia/commander.js.png)](http://travis-ci.org/visionmedia/commander.js)
|
||||
|
||||
## Installation
|
||||
|
||||
$ npm install commander
|
||||
|
||||
## Option parsing
|
||||
|
||||
Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options.
|
||||
|
||||
```js
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var program = require('commander');
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-p, --peppers', 'Add peppers')
|
||||
.option('-P, --pineapple', 'Add pineapple')
|
||||
.option('-b, --bbq', 'Add bbq sauce')
|
||||
.option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')
|
||||
.parse(process.argv);
|
||||
|
||||
console.log('you ordered a pizza with:');
|
||||
if (program.peppers) console.log(' - peppers');
|
||||
if (program.pineapple) console.log(' - pineappe');
|
||||
if (program.bbq) console.log(' - bbq');
|
||||
console.log(' - %s cheese', program.cheese);
|
||||
```
|
||||
|
||||
Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc.
|
||||
|
||||
## Automated --help
|
||||
|
||||
The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free:
|
||||
|
||||
```
|
||||
$ ./examples/pizza --help
|
||||
|
||||
Usage: pizza [options]
|
||||
|
||||
Options:
|
||||
|
||||
-V, --version output the version number
|
||||
-p, --peppers Add peppers
|
||||
-P, --pineapple Add pineappe
|
||||
-b, --bbq Add bbq sauce
|
||||
-c, --cheese <type> Add the specified type of cheese [marble]
|
||||
-h, --help output usage information
|
||||
|
||||
```
|
||||
|
||||
## Coercion
|
||||
|
||||
```js
|
||||
function range(val) {
|
||||
return val.split('..').map(Number);
|
||||
}
|
||||
|
||||
function list(val) {
|
||||
return val.split(',');
|
||||
}
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.usage('[options] <file ...>')
|
||||
.option('-i, --integer <n>', 'An integer argument', parseInt)
|
||||
.option('-f, --float <n>', 'A float argument', parseFloat)
|
||||
.option('-r, --range <a>..<b>', 'A range', range)
|
||||
.option('-l, --list <items>', 'A list', list)
|
||||
.option('-o, --optional [value]', 'An optional value')
|
||||
.parse(process.argv);
|
||||
|
||||
console.log(' int: %j', program.integer);
|
||||
console.log(' float: %j', program.float);
|
||||
console.log(' optional: %j', program.optional);
|
||||
program.range = program.range || [];
|
||||
console.log(' range: %j..%j', program.range[0], program.range[1]);
|
||||
console.log(' list: %j', program.list);
|
||||
console.log(' args: %j', program.args);
|
||||
```
|
||||
|
||||
## Custom help
|
||||
|
||||
You can display arbitrary `-h, --help` information
|
||||
by listening for "--help". Commander will automatically
|
||||
exit once you are done so that the remainder of your program
|
||||
does not execute causing undesired behaviours, for example
|
||||
in the following executable "stuff" will not output when
|
||||
`--help` is used.
|
||||
|
||||
```js
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var program = require('../');
|
||||
|
||||
function list(val) {
|
||||
return val.split(',').map(Number);
|
||||
}
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-f, --foo', 'enable some foo')
|
||||
.option('-b, --bar', 'enable some bar')
|
||||
.option('-B, --baz', 'enable some baz');
|
||||
|
||||
// must be before .parse() since
|
||||
// node's emit() is immediate
|
||||
|
||||
program.on('--help', function(){
|
||||
console.log(' Examples:');
|
||||
console.log('');
|
||||
console.log(' $ custom-help --help');
|
||||
console.log(' $ custom-help -h');
|
||||
console.log('');
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
||||
|
||||
console.log('stuff');
|
||||
```
|
||||
|
||||
yielding the following help output:
|
||||
|
||||
```
|
||||
|
||||
Usage: custom-help [options]
|
||||
|
||||
Options:
|
||||
|
||||
-h, --help output usage information
|
||||
-V, --version output the version number
|
||||
-f, --foo enable some foo
|
||||
-b, --bar enable some bar
|
||||
-B, --baz enable some baz
|
||||
|
||||
Examples:
|
||||
|
||||
$ custom-help --help
|
||||
$ custom-help -h
|
||||
|
||||
```
|
||||
|
||||
## .prompt(msg, fn)
|
||||
|
||||
Single-line prompt:
|
||||
|
||||
```js
|
||||
program.prompt('name: ', function(name){
|
||||
console.log('hi %s', name);
|
||||
});
|
||||
```
|
||||
|
||||
Multi-line prompt:
|
||||
|
||||
```js
|
||||
program.prompt('description:', function(name){
|
||||
console.log('hi %s', name);
|
||||
});
|
||||
```
|
||||
|
||||
Coercion:
|
||||
|
||||
```js
|
||||
program.prompt('Age: ', Number, function(age){
|
||||
console.log('age: %j', age);
|
||||
});
|
||||
```
|
||||
|
||||
```js
|
||||
program.prompt('Birthdate: ', Date, function(date){
|
||||
console.log('date: %s', date);
|
||||
});
|
||||
```
|
||||
|
||||
## .password(msg[, mask], fn)
|
||||
|
||||
Prompt for password without echoing:
|
||||
|
||||
```js
|
||||
program.password('Password: ', function(pass){
|
||||
console.log('got "%s"', pass);
|
||||
process.stdin.destroy();
|
||||
});
|
||||
```
|
||||
|
||||
Prompt for password with mask char "*":
|
||||
|
||||
```js
|
||||
program.password('Password: ', '*', function(pass){
|
||||
console.log('got "%s"', pass);
|
||||
process.stdin.destroy();
|
||||
});
|
||||
```
|
||||
|
||||
## .confirm(msg, fn)
|
||||
|
||||
Confirm with the given `msg`:
|
||||
|
||||
```js
|
||||
program.confirm('continue? ', function(ok){
|
||||
console.log(' got %j', ok);
|
||||
});
|
||||
```
|
||||
|
||||
## .choose(list, fn)
|
||||
|
||||
Let the user choose from a `list`:
|
||||
|
||||
```js
|
||||
var list = ['tobi', 'loki', 'jane', 'manny', 'luna'];
|
||||
|
||||
console.log('Choose the coolest pet:');
|
||||
program.choose(list, function(i){
|
||||
console.log('you chose %d "%s"', i, list[i]);
|
||||
});
|
||||
```
|
||||
|
||||
## Links
|
||||
|
||||
- [API documentation](http://visionmedia.github.com/commander.js/)
|
||||
- [ascii tables](https://github.com/LearnBoost/cli-table)
|
||||
- [progress bars](https://github.com/visionmedia/node-progress)
|
||||
- [more progress bars](https://github.com/substack/node-multimeter)
|
||||
- [examples](https://github.com/visionmedia/commander.js/tree/master/examples)
|
||||
|
||||
## License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>
|
||||
|
||||
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.
|
2
node_modules/jade/node_modules/commander/index.js
generated
vendored
Normal file
2
node_modules/jade/node_modules/commander/index.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
module.exports = require('./lib/commander');
|
1026
node_modules/jade/node_modules/commander/lib/commander.js
generated
vendored
Normal file
1026
node_modules/jade/node_modules/commander/lib/commander.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
60
node_modules/jade/node_modules/commander/package.json
generated
vendored
Normal file
60
node_modules/jade/node_modules/commander/package.json
generated
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
{
|
||||
"_from": "commander@0.6.1",
|
||||
"_id": "commander@0.6.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-+mihT2qUXVTbvlDYzbMyDp47GgY=",
|
||||
"_location": "/jade/commander",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "commander@0.6.1",
|
||||
"name": "commander",
|
||||
"escapedName": "commander",
|
||||
"rawSpec": "0.6.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "0.6.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/jade"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/commander/-/commander-0.6.1.tgz",
|
||||
"_shasum": "fa68a14f6a945d54dbbe50d8cdb3320e9e3b1a06",
|
||||
"_spec": "commander@0.6.1",
|
||||
"_where": "/home/clemens/Dokumente/git/pixelnode/node_modules/jade",
|
||||
"author": {
|
||||
"name": "TJ Holowaychuk",
|
||||
"email": "tj@vision-media.ca"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/visionmedia/commander.js/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "the complete solution for node.js command-line programs",
|
||||
"devDependencies": {
|
||||
"should": ">= 0.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4.x"
|
||||
},
|
||||
"homepage": "https://github.com/visionmedia/commander.js#readme",
|
||||
"keywords": [
|
||||
"command",
|
||||
"option",
|
||||
"parser",
|
||||
"prompt",
|
||||
"stdin"
|
||||
],
|
||||
"main": "index",
|
||||
"name": "commander",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/visionmedia/commander.js.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "make test"
|
||||
},
|
||||
"version": "0.6.1"
|
||||
}
|
2
node_modules/jade/node_modules/mkdirp/.gitignore.orig
generated
vendored
Normal file
2
node_modules/jade/node_modules/mkdirp/.gitignore.orig
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
node_modules/
|
||||
npm-debug.log
|
5
node_modules/jade/node_modules/mkdirp/.gitignore.rej
generated
vendored
Normal file
5
node_modules/jade/node_modules/mkdirp/.gitignore.rej
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
--- /dev/null
|
||||
+++ .gitignore
|
||||
@@ -0,0 +1,2 @@
|
||||
+node_modules/
|
||||
+npm-debug.log
|
2
node_modules/jade/node_modules/mkdirp/.npmignore
generated
vendored
Normal file
2
node_modules/jade/node_modules/mkdirp/.npmignore
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
node_modules/
|
||||
npm-debug.log
|
21
node_modules/jade/node_modules/mkdirp/LICENSE
generated
vendored
Normal file
21
node_modules/jade/node_modules/mkdirp/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
Copyright 2010 James Halliday (mail@substack.net)
|
||||
|
||||
This project is free software released under the MIT/X11 license:
|
||||
|
||||
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.
|
54
node_modules/jade/node_modules/mkdirp/README.markdown
generated
vendored
Normal file
54
node_modules/jade/node_modules/mkdirp/README.markdown
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
mkdirp
|
||||
======
|
||||
|
||||
Like `mkdir -p`, but in node.js!
|
||||
|
||||
example
|
||||
=======
|
||||
|
||||
pow.js
|
||||
------
|
||||
var mkdirp = require('mkdirp');
|
||||
|
||||
mkdirp('/tmp/foo/bar/baz', function (err) {
|
||||
if (err) console.error(err)
|
||||
else console.log('pow!')
|
||||
});
|
||||
|
||||
Output
|
||||
pow!
|
||||
|
||||
And now /tmp/foo/bar/baz exists, huzzah!
|
||||
|
||||
methods
|
||||
=======
|
||||
|
||||
var mkdirp = require('mkdirp');
|
||||
|
||||
mkdirp(dir, mode, cb)
|
||||
---------------------
|
||||
|
||||
Create a new directory and any necessary subdirectories at `dir` with octal
|
||||
permission string `mode`.
|
||||
|
||||
If `mode` isn't specified, it defaults to `0777 & (~process.umask())`.
|
||||
|
||||
mkdirp.sync(dir, mode)
|
||||
----------------------
|
||||
|
||||
Synchronously create a new directory and any necessary subdirectories at `dir`
|
||||
with octal permission string `mode`.
|
||||
|
||||
If `mode` isn't specified, it defaults to `0777 & (~process.umask())`.
|
||||
|
||||
install
|
||||
=======
|
||||
|
||||
With [npm](http://npmjs.org) do:
|
||||
|
||||
npm install mkdirp
|
||||
|
||||
license
|
||||
=======
|
||||
|
||||
MIT/X11
|
6
node_modules/jade/node_modules/mkdirp/examples/pow.js
generated
vendored
Normal file
6
node_modules/jade/node_modules/mkdirp/examples/pow.js
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
var mkdirp = require('mkdirp');
|
||||
|
||||
mkdirp('/tmp/foo/bar/baz', function (err) {
|
||||
if (err) console.error(err)
|
||||
else console.log('pow!')
|
||||
});
|
6
node_modules/jade/node_modules/mkdirp/examples/pow.js.orig
generated
vendored
Normal file
6
node_modules/jade/node_modules/mkdirp/examples/pow.js.orig
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
var mkdirp = require('mkdirp');
|
||||
|
||||
mkdirp('/tmp/foo/bar/baz', 0755, function (err) {
|
||||
if (err) console.error(err)
|
||||
else console.log('pow!')
|
||||
});
|
19
node_modules/jade/node_modules/mkdirp/examples/pow.js.rej
generated
vendored
Normal file
19
node_modules/jade/node_modules/mkdirp/examples/pow.js.rej
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
--- examples/pow.js
|
||||
+++ examples/pow.js
|
||||
@@ -1,6 +1,15 @@
|
||||
-var mkdirp = require('mkdirp').mkdirp;
|
||||
+var mkdirp = require('../').mkdirp,
|
||||
+ mkdirpSync = require('../').mkdirpSync;
|
||||
|
||||
mkdirp('/tmp/foo/bar/baz', 0755, function (err) {
|
||||
if (err) console.error(err)
|
||||
else console.log('pow!')
|
||||
});
|
||||
+
|
||||
+try {
|
||||
+ mkdirpSync('/tmp/bar/foo/baz', 0755);
|
||||
+ console.log('double pow!');
|
||||
+}
|
||||
+catch (ex) {
|
||||
+ console.log(ex);
|
||||
+}
|
79
node_modules/jade/node_modules/mkdirp/index.js
generated
vendored
Normal file
79
node_modules/jade/node_modules/mkdirp/index.js
generated
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
|
||||
module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
|
||||
|
||||
function mkdirP (p, mode, f) {
|
||||
if (typeof mode === 'function' || mode === undefined) {
|
||||
f = mode;
|
||||
mode = 0777 & (~process.umask());
|
||||
}
|
||||
|
||||
var cb = f || function () {};
|
||||
if (typeof mode === 'string') mode = parseInt(mode, 8);
|
||||
p = path.resolve(p);
|
||||
|
||||
fs.mkdir(p, mode, function (er) {
|
||||
if (!er) return cb();
|
||||
switch (er.code) {
|
||||
case 'ENOENT':
|
||||
mkdirP(path.dirname(p), mode, function (er) {
|
||||
if (er) cb(er);
|
||||
else mkdirP(p, mode, cb);
|
||||
});
|
||||
break;
|
||||
|
||||
case 'EEXIST':
|
||||
fs.stat(p, function (er2, stat) {
|
||||
// if the stat fails, then that's super weird.
|
||||
// let the original EEXIST be the failure reason.
|
||||
if (er2 || !stat.isDirectory()) cb(er)
|
||||
else cb();
|
||||
});
|
||||
break;
|
||||
|
||||
default:
|
||||
cb(er);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
mkdirP.sync = function sync (p, mode) {
|
||||
if (mode === undefined) {
|
||||
mode = 0777 & (~process.umask());
|
||||
}
|
||||
|
||||
if (typeof mode === 'string') mode = parseInt(mode, 8);
|
||||
p = path.resolve(p);
|
||||
|
||||
try {
|
||||
fs.mkdirSync(p, mode)
|
||||
}
|
||||
catch (err0) {
|
||||
switch (err0.code) {
|
||||
case 'ENOENT' :
|
||||
var err1 = sync(path.dirname(p), mode)
|
||||
if (err1) throw err1;
|
||||
else return sync(p, mode);
|
||||
break;
|
||||
|
||||
case 'EEXIST' :
|
||||
var stat;
|
||||
try {
|
||||
stat = fs.statSync(p);
|
||||
}
|
||||
catch (err1) {
|
||||
throw err0
|
||||
}
|
||||
if (!stat.isDirectory()) throw err0;
|
||||
else return null;
|
||||
break;
|
||||
default :
|
||||
throw err0
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
58
node_modules/jade/node_modules/mkdirp/package.json
generated
vendored
Normal file
58
node_modules/jade/node_modules/mkdirp/package.json
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
{
|
||||
"_from": "mkdirp@0.3.0",
|
||||
"_id": "mkdirp@0.3.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-G79asbqCevI1dRQ0kEJkVfSB/h4=",
|
||||
"_location": "/jade/mkdirp",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "mkdirp@0.3.0",
|
||||
"name": "mkdirp",
|
||||
"escapedName": "mkdirp",
|
||||
"rawSpec": "0.3.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "0.3.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/jade"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz",
|
||||
"_shasum": "1bbf5ab1ba827af23575143490426455f481fe1e",
|
||||
"_spec": "mkdirp@0.3.0",
|
||||
"_where": "/home/clemens/Dokumente/git/pixelnode/node_modules/jade",
|
||||
"author": {
|
||||
"name": "James Halliday",
|
||||
"email": "mail@substack.net",
|
||||
"url": "http://substack.net"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/substack/node-mkdirp/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Recursively mkdir, like `mkdir -p`",
|
||||
"devDependencies": {
|
||||
"tap": "0.0.x"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
},
|
||||
"homepage": "https://github.com/substack/node-mkdirp#readme",
|
||||
"keywords": [
|
||||
"mkdir",
|
||||
"directory"
|
||||
],
|
||||
"license": "MIT/X11",
|
||||
"main": "./index",
|
||||
"name": "mkdirp",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/substack/node-mkdirp.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test/*.js"
|
||||
},
|
||||
"version": "0.3.0"
|
||||
}
|
38
node_modules/jade/node_modules/mkdirp/test/chmod.js
generated
vendored
Normal file
38
node_modules/jade/node_modules/mkdirp/test/chmod.js
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
var mkdirp = require('../').mkdirp;
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var test = require('tap').test;
|
||||
|
||||
var ps = [ '', 'tmp' ];
|
||||
|
||||
for (var i = 0; i < 25; i++) {
|
||||
var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
|
||||
ps.push(dir);
|
||||
}
|
||||
|
||||
var file = ps.join('/');
|
||||
|
||||
test('chmod-pre', function (t) {
|
||||
var mode = 0744
|
||||
mkdirp(file, mode, function (er) {
|
||||
t.ifError(er, 'should not error');
|
||||
fs.stat(file, function (er, stat) {
|
||||
t.ifError(er, 'should exist');
|
||||
t.ok(stat && stat.isDirectory(), 'should be directory');
|
||||
t.equal(stat && stat.mode & 0777, mode, 'should be 0744');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('chmod', function (t) {
|
||||
var mode = 0755
|
||||
mkdirp(file, mode, function (er) {
|
||||
t.ifError(er, 'should not error');
|
||||
fs.stat(file, function (er, stat) {
|
||||
t.ifError(er, 'should exist');
|
||||
t.ok(stat && stat.isDirectory(), 'should be directory');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
});
|
37
node_modules/jade/node_modules/mkdirp/test/clobber.js
generated
vendored
Normal file
37
node_modules/jade/node_modules/mkdirp/test/clobber.js
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
var mkdirp = require('../').mkdirp;
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var test = require('tap').test;
|
||||
|
||||
var ps = [ '', 'tmp' ];
|
||||
|
||||
for (var i = 0; i < 25; i++) {
|
||||
var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
|
||||
ps.push(dir);
|
||||
}
|
||||
|
||||
var file = ps.join('/');
|
||||
|
||||
// a file in the way
|
||||
var itw = ps.slice(0, 3).join('/');
|
||||
|
||||
|
||||
test('clobber-pre', function (t) {
|
||||
console.error("about to write to "+itw)
|
||||
fs.writeFileSync(itw, 'I AM IN THE WAY, THE TRUTH, AND THE LIGHT.');
|
||||
|
||||
fs.stat(itw, function (er, stat) {
|
||||
t.ifError(er)
|
||||
t.ok(stat && stat.isFile(), 'should be file')
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
test('clobber', function (t) {
|
||||
t.plan(2);
|
||||
mkdirp(file, 0755, function (err) {
|
||||
t.ok(err);
|
||||
t.equal(err.code, 'ENOTDIR');
|
||||
t.end();
|
||||
});
|
||||
});
|
28
node_modules/jade/node_modules/mkdirp/test/mkdirp.js
generated
vendored
Normal file
28
node_modules/jade/node_modules/mkdirp/test/mkdirp.js
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
var mkdirp = require('../');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var test = require('tap').test;
|
||||
|
||||
test('woo', function (t) {
|
||||
t.plan(2);
|
||||
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
|
||||
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
|
||||
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
|
||||
|
||||
var file = '/tmp/' + [x,y,z].join('/');
|
||||
|
||||
mkdirp(file, 0755, function (err) {
|
||||
if (err) t.fail(err);
|
||||
else path.exists(file, function (ex) {
|
||||
if (!ex) t.fail('file not created')
|
||||
else fs.stat(file, function (err, stat) {
|
||||
if (err) t.fail(err)
|
||||
else {
|
||||
t.equal(stat.mode & 0777, 0755);
|
||||
t.ok(stat.isDirectory(), 'target not a directory');
|
||||
t.end();
|
||||
}
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
32
node_modules/jade/node_modules/mkdirp/test/perm.js
generated
vendored
Normal file
32
node_modules/jade/node_modules/mkdirp/test/perm.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
var mkdirp = require('../');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var test = require('tap').test;
|
||||
|
||||
test('async perm', function (t) {
|
||||
t.plan(2);
|
||||
var file = '/tmp/' + (Math.random() * (1<<30)).toString(16);
|
||||
|
||||
mkdirp(file, 0755, function (err) {
|
||||
if (err) t.fail(err);
|
||||
else path.exists(file, function (ex) {
|
||||
if (!ex) t.fail('file not created')
|
||||
else fs.stat(file, function (err, stat) {
|
||||
if (err) t.fail(err)
|
||||
else {
|
||||
t.equal(stat.mode & 0777, 0755);
|
||||
t.ok(stat.isDirectory(), 'target not a directory');
|
||||
t.end();
|
||||
}
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
test('async root perm', function (t) {
|
||||
mkdirp('/tmp', 0755, function (err) {
|
||||
if (err) t.fail(err);
|
||||
t.end();
|
||||
});
|
||||
t.end();
|
||||
});
|
39
node_modules/jade/node_modules/mkdirp/test/perm_sync.js
generated
vendored
Normal file
39
node_modules/jade/node_modules/mkdirp/test/perm_sync.js
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
var mkdirp = require('../');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var test = require('tap').test;
|
||||
|
||||
test('sync perm', function (t) {
|
||||
t.plan(2);
|
||||
var file = '/tmp/' + (Math.random() * (1<<30)).toString(16) + '.json';
|
||||
|
||||
mkdirp.sync(file, 0755);
|
||||
path.exists(file, function (ex) {
|
||||
if (!ex) t.fail('file not created')
|
||||
else fs.stat(file, function (err, stat) {
|
||||
if (err) t.fail(err)
|
||||
else {
|
||||
t.equal(stat.mode & 0777, 0755);
|
||||
t.ok(stat.isDirectory(), 'target not a directory');
|
||||
t.end();
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
test('sync root perm', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var file = '/tmp';
|
||||
mkdirp.sync(file, 0755);
|
||||
path.exists(file, function (ex) {
|
||||
if (!ex) t.fail('file not created')
|
||||
else fs.stat(file, function (err, stat) {
|
||||
if (err) t.fail(err)
|
||||
else {
|
||||
t.ok(stat.isDirectory(), 'target not a directory');
|
||||
t.end();
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
41
node_modules/jade/node_modules/mkdirp/test/race.js
generated
vendored
Normal file
41
node_modules/jade/node_modules/mkdirp/test/race.js
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
var mkdirp = require('../').mkdirp;
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var test = require('tap').test;
|
||||
|
||||
test('race', function (t) {
|
||||
t.plan(4);
|
||||
var ps = [ '', 'tmp' ];
|
||||
|
||||
for (var i = 0; i < 25; i++) {
|
||||
var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
|
||||
ps.push(dir);
|
||||
}
|
||||
var file = ps.join('/');
|
||||
|
||||
var res = 2;
|
||||
mk(file, function () {
|
||||
if (--res === 0) t.end();
|
||||
});
|
||||
|
||||
mk(file, function () {
|
||||
if (--res === 0) t.end();
|
||||
});
|
||||
|
||||
function mk (file, cb) {
|
||||
mkdirp(file, 0755, function (err) {
|
||||
if (err) t.fail(err);
|
||||
else path.exists(file, function (ex) {
|
||||
if (!ex) t.fail('file not created')
|
||||
else fs.stat(file, function (err, stat) {
|
||||
if (err) t.fail(err)
|
||||
else {
|
||||
t.equal(stat.mode & 0777, 0755);
|
||||
t.ok(stat.isDirectory(), 'target not a directory');
|
||||
if (cb) cb();
|
||||
}
|
||||
})
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
32
node_modules/jade/node_modules/mkdirp/test/rel.js
generated
vendored
Normal file
32
node_modules/jade/node_modules/mkdirp/test/rel.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
var mkdirp = require('../');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var test = require('tap').test;
|
||||
|
||||
test('rel', function (t) {
|
||||
t.plan(2);
|
||||
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
|
||||
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
|
||||
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
|
||||
|
||||
var cwd = process.cwd();
|
||||
process.chdir('/tmp');
|
||||
|
||||
var file = [x,y,z].join('/');
|
||||
|
||||
mkdirp(file, 0755, function (err) {
|
||||
if (err) t.fail(err);
|
||||
else path.exists(file, function (ex) {
|
||||
if (!ex) t.fail('file not created')
|
||||
else fs.stat(file, function (err, stat) {
|
||||
if (err) t.fail(err)
|
||||
else {
|
||||
process.chdir(cwd);
|
||||
t.equal(stat.mode & 0777, 0755);
|
||||
t.ok(stat.isDirectory(), 'target not a directory');
|
||||
t.end();
|
||||
}
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
27
node_modules/jade/node_modules/mkdirp/test/sync.js
generated
vendored
Normal file
27
node_modules/jade/node_modules/mkdirp/test/sync.js
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
var mkdirp = require('../');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var test = require('tap').test;
|
||||
|
||||
test('sync', function (t) {
|
||||
t.plan(2);
|
||||
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
|
||||
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
|
||||
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
|
||||
|
||||
var file = '/tmp/' + [x,y,z].join('/');
|
||||
|
||||
var err = mkdirp.sync(file, 0755);
|
||||
if (err) t.fail(err);
|
||||
else path.exists(file, function (ex) {
|
||||
if (!ex) t.fail('file not created')
|
||||
else fs.stat(file, function (err, stat) {
|
||||
if (err) t.fail(err)
|
||||
else {
|
||||
t.equal(stat.mode & 0777, 0755);
|
||||
t.ok(stat.isDirectory(), 'target not a directory');
|
||||
t.end();
|
||||
}
|
||||
})
|
||||
})
|
||||
});
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user