mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-11 18:32:50 +00:00
updated package.json
This commit is contained in:
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/ncp
generated
vendored
Symbolic link
1
node_modules/.bin/ncp
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../ncp/bin/ncp
|
||||
1
node_modules/.bin/rimraf
generated
vendored
Symbolic link
1
node_modules/.bin/rimraf
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../rimraf/bin.js
|
||||
@@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2015, Jon Schlinkert.Copyright (c) 2012-2015, The Dojo Foundation.copyright (c) 2009-2015, Jeremy Ashkenas.
|
||||
Copyright (c) <%= year() %>, Jon Schlinkert.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
14
node_modules/ansi-green/index.js
generated
vendored
Normal file
14
node_modules/ansi-green/index.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
/*!
|
||||
* ansi-green <https://github.com/jonschlinkert/ansi-green>
|
||||
*
|
||||
* Copyright (c) 2015, Jon Schlinkert.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var wrap = require('ansi-wrap');
|
||||
|
||||
module.exports = function green(message) {
|
||||
return wrap(32, 39, message);
|
||||
};
|
||||
108
node_modules/ansi-green/package.json
generated
vendored
Normal file
108
node_modules/ansi-green/package.json
generated
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"ansi-green@^0.1.1",
|
||||
"/home/mywebsite/node_modules/extglob"
|
||||
]
|
||||
],
|
||||
"_from": "ansi-green@>=0.1.1 <0.2.0",
|
||||
"_id": "ansi-green@0.1.1",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/ansi-green",
|
||||
"_nodeVersion": "0.12.0",
|
||||
"_npmUser": {
|
||||
"email": "github@sellside.com",
|
||||
"name": "jonschlinkert"
|
||||
},
|
||||
"_npmVersion": "2.10.0",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "ansi-green",
|
||||
"raw": "ansi-green@^0.1.1",
|
||||
"rawSpec": "^0.1.1",
|
||||
"scope": null,
|
||||
"spec": ">=0.1.1 <0.2.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/extglob"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/ansi-green/-/ansi-green-0.1.1.tgz",
|
||||
"_shasum": "8a5d9a979e458d57c40e33580b37390b8e10d0f7",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "ansi-green@^0.1.1",
|
||||
"_where": "/home/mywebsite/node_modules/extglob",
|
||||
"author": {
|
||||
"name": "Jon Schlinkert",
|
||||
"url": "https://github.com/jonschlinkert"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/ansi-green/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"ansi-wrap": "0.1.0"
|
||||
},
|
||||
"description": "The color green, in ansi.",
|
||||
"devDependencies": {
|
||||
"mocha": "*"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "8a5d9a979e458d57c40e33580b37390b8e10d0f7",
|
||||
"tarball": "http://registry.npmjs.org/ansi-green/-/ansi-green-0.1.1.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/jonschlinkert/ansi-green",
|
||||
"keywords": [
|
||||
"256",
|
||||
"ansi",
|
||||
"cli",
|
||||
"color",
|
||||
"colors",
|
||||
"colour",
|
||||
"command",
|
||||
"command-line",
|
||||
"console",
|
||||
"format",
|
||||
"formatting",
|
||||
"green",
|
||||
"iterm",
|
||||
"log",
|
||||
"logging",
|
||||
"rgb",
|
||||
"shell",
|
||||
"string",
|
||||
"style",
|
||||
"styles",
|
||||
"styling",
|
||||
"terminal",
|
||||
"text",
|
||||
"tty",
|
||||
"xterm"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "jonschlinkert",
|
||||
"email": "github@sellside.com"
|
||||
}
|
||||
],
|
||||
"name": "ansi-green",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jonschlinkert/ansi-green.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"version": "0.1.1"
|
||||
}
|
||||
74
node_modules/ansi-green/readme.md
generated
vendored
Normal file
74
node_modules/ansi-green/readme.md
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
# ansi-green [](http://badge.fury.io/js/ansi-green)
|
||||
|
||||
> The color green, in ansi.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/)
|
||||
|
||||
```sh
|
||||
$ npm i ansi-green --save
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var green = require('ansi-green');
|
||||
```
|
||||
|
||||
## Related projects
|
||||
|
||||
* [ansi-reset](https://github.com/jonschlinkert/ansi-reset)
|
||||
* [ansi-bold](https://github.com/jonschlinkert/ansi-bold)
|
||||
* [ansi-dim](https://github.com/jonschlinkert/ansi-dim)
|
||||
* [ansi-italic](https://github.com/jonschlinkert/ansi-italic)
|
||||
* [ansi-underline](https://github.com/jonschlinkert/ansi-underline)
|
||||
* [ansi-inverse](https://github.com/jonschlinkert/ansi-inverse)
|
||||
* [ansi-hidden](https://github.com/jonschlinkert/ansi-hidden)
|
||||
* [ansi-strikethrough](https://github.com/jonschlinkert/ansi-strikethrough)
|
||||
* [ansi-black](https://github.com/jonschlinkert/ansi-black)
|
||||
* [ansi-red](https://github.com/jonschlinkert/ansi-red)
|
||||
* [ansi-green](https://github.com/jonschlinkert/ansi-green)
|
||||
* [ansi-yellow](https://github.com/jonschlinkert/ansi-yellow)
|
||||
* [ansi-blue](https://github.com/jonschlinkert/ansi-blue)
|
||||
* [ansi-magenta](https://github.com/jonschlinkert/ansi-magenta)
|
||||
* [ansi-cyan](https://github.com/jonschlinkert/ansi-cyan)
|
||||
* [ansi-white](https://github.com/jonschlinkert/ansi-white)
|
||||
* [ansi-gray](https://github.com/jonschlinkert/ansi-gray)
|
||||
* [ansi-grey](https://github.com/jonschlinkert/ansi-grey)
|
||||
* [ansi-bgblack](https://github.com/jonschlinkert/ansi-bgblack)
|
||||
* [ansi-bgred](https://github.com/jonschlinkert/ansi-bgred)
|
||||
* [ansi-bggreen](https://github.com/jonschlinkert/ansi-bggreen)
|
||||
* [ansi-bgyellow](https://github.com/jonschlinkert/ansi-bgyellow)
|
||||
* [ansi-bgblue](https://github.com/jonschlinkert/ansi-bgblue)
|
||||
* [ansi-bgmagenta](https://github.com/jonschlinkert/ansi-bgmagenta)
|
||||
* [ansi-bgcyan](https://github.com/jonschlinkert/ansi-bgcyan)
|
||||
* [ansi-bgwhite](https://github.com/jonschlinkert/ansi-bgwhite)
|
||||
|
||||
## Running tests
|
||||
|
||||
Install dev dependencies:
|
||||
|
||||
```sh
|
||||
$ npm i -d && npm test
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/ansi-green/issues/new)
|
||||
|
||||
## Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
+ [github/jonschlinkert](https://github.com/jonschlinkert)
|
||||
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
|
||||
|
||||
## License
|
||||
|
||||
Copyright © 2015 Jon Schlinkert
|
||||
Released under the MIT license.
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on May 21, 2015._
|
||||
89
node_modules/ansi-wrap/README.md
generated
vendored
Normal file
89
node_modules/ansi-wrap/README.md
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
# ansi-wrap [](http://badge.fury.io/js/ansi-wrap)
|
||||
|
||||
> Create ansi colors by passing the open and close codes.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/)
|
||||
|
||||
```sh
|
||||
$ npm i ansi-wrap --save
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var wrap = require('ansi-wrap');
|
||||
```
|
||||
|
||||
**Example**
|
||||
|
||||
Pass codes for [ansi magenta background](https://github.com/jonschlinkert/ansi-bgmagenta):
|
||||
|
||||
```js
|
||||
console.log(wrap(45, 49, 'This is a message...'));
|
||||
//=> '\u001b[45mfoo\u001b[49m'
|
||||
```
|
||||
|
||||
Which prints out...
|
||||
|
||||
[](https://www.npmjs.com/)
|
||||
|
||||
## Related projects
|
||||
|
||||
This is used in these projects:
|
||||
|
||||
* [ansi-reset](https://github.com/jonschlinkert/ansi-reset)
|
||||
* [ansi-bold](https://github.com/jonschlinkert/ansi-bold)
|
||||
* [ansi-dim](https://github.com/jonschlinkert/ansi-dim)
|
||||
* [ansi-italic](https://github.com/jonschlinkert/ansi-italic)
|
||||
* [ansi-underline](https://github.com/jonschlinkert/ansi-underline)
|
||||
* [ansi-inverse](https://github.com/jonschlinkert/ansi-inverse)
|
||||
* [ansi-hidden](https://github.com/jonschlinkert/ansi-hidden)
|
||||
* [ansi-strikethrough](https://github.com/jonschlinkert/ansi-strikethrough)
|
||||
* [ansi-black](https://github.com/jonschlinkert/ansi-black)
|
||||
* [ansi-red](https://github.com/jonschlinkert/ansi-red)
|
||||
* [ansi-green](https://github.com/jonschlinkert/ansi-green)
|
||||
* [ansi-yellow](https://github.com/jonschlinkert/ansi-yellow)
|
||||
* [ansi-blue](https://github.com/jonschlinkert/ansi-blue)
|
||||
* [ansi-magenta](https://github.com/jonschlinkert/ansi-magenta)
|
||||
* [ansi-cyan](https://github.com/jonschlinkert/ansi-cyan)
|
||||
* [ansi-white](https://github.com/jonschlinkert/ansi-white)
|
||||
* [ansi-gray](https://github.com/jonschlinkert/ansi-gray)
|
||||
* [ansi-grey](https://github.com/jonschlinkert/ansi-grey)
|
||||
* [ansi-bgblack](https://github.com/jonschlinkert/ansi-bgblack)
|
||||
* [ansi-bgred](https://github.com/jonschlinkert/ansi-bgred)
|
||||
* [ansi-bggreen](https://github.com/jonschlinkert/ansi-bggreen)
|
||||
* [ansi-bgyellow](https://github.com/jonschlinkert/ansi-bgyellow)
|
||||
* [ansi-bgblue](https://github.com/jonschlinkert/ansi-bgblue)
|
||||
* [ansi-bgmagenta](https://github.com/jonschlinkert/ansi-bgmagenta)
|
||||
* [ansi-bgcyan](https://github.com/jonschlinkert/ansi-bgcyan)
|
||||
* [ansi-bgwhite](https://github.com/jonschlinkert/ansi-bgwhite)
|
||||
|
||||
## Running tests
|
||||
|
||||
Install dev dependencies:
|
||||
|
||||
```sh
|
||||
$ npm i -d && npm test
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/ansi-wrap/issues/new)
|
||||
|
||||
## Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
+ [github/jonschlinkert](https://github.com/jonschlinkert)
|
||||
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
|
||||
|
||||
## License
|
||||
|
||||
Copyright © 2015 Jon Schlinkert
|
||||
Released under the MIT license.
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on May 21, 2015._
|
||||
5
node_modules/ansi-wrap/index.js
generated
vendored
Normal file
5
node_modules/ansi-wrap/index.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function(a, b, msg) {
|
||||
return '\u001b['+ a + 'm' + msg + '\u001b[' + b + 'm';
|
||||
};
|
||||
81
node_modules/ansi-wrap/package.json
generated
vendored
Normal file
81
node_modules/ansi-wrap/package.json
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"ansi-wrap@0.1.0",
|
||||
"/home/mywebsite/node_modules/ansi-green"
|
||||
]
|
||||
],
|
||||
"_from": "ansi-wrap@0.1.0",
|
||||
"_id": "ansi-wrap@0.1.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/ansi-wrap",
|
||||
"_nodeVersion": "0.12.0",
|
||||
"_npmUser": {
|
||||
"email": "github@sellside.com",
|
||||
"name": "jonschlinkert"
|
||||
},
|
||||
"_npmVersion": "2.5.1",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "ansi-wrap",
|
||||
"raw": "ansi-wrap@0.1.0",
|
||||
"rawSpec": "0.1.0",
|
||||
"scope": null,
|
||||
"spec": "0.1.0",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/ansi-green"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/ansi-wrap/-/ansi-wrap-0.1.0.tgz",
|
||||
"_shasum": "a82250ddb0015e9a27ca82e82ea603bbfa45efaf",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "ansi-wrap@0.1.0",
|
||||
"_where": "/home/mywebsite/node_modules/ansi-green",
|
||||
"author": {
|
||||
"name": "Jon Schlinkert",
|
||||
"url": "https://github.com/jonschlinkert"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/ansi-wrap/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Create ansi colors by passing the open and close codes.",
|
||||
"devDependencies": {},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "a82250ddb0015e9a27ca82e82ea603bbfa45efaf",
|
||||
"tarball": "http://registry.npmjs.org/ansi-wrap/-/ansi-wrap-0.1.0.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/jonschlinkert/ansi-wrap",
|
||||
"keywords": [],
|
||||
"license": {
|
||||
"type": "MIT",
|
||||
"url": "https://github.com/jonschlinkert/ansi-wrap/blob/master/LICENSE"
|
||||
},
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "jonschlinkert",
|
||||
"email": "github@sellside.com"
|
||||
}
|
||||
],
|
||||
"name": "ansi-wrap",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jonschlinkert/ansi-wrap.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"version": "0.1.0"
|
||||
}
|
||||
15
node_modules/anymatch/LICENSE
generated
vendored
Normal file
15
node_modules/anymatch/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
The ISC License
|
||||
|
||||
Copyright (c) 2014 Elan Shanker
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
91
node_modules/anymatch/README.md
generated
vendored
Normal file
91
node_modules/anymatch/README.md
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
anymatch [](https://travis-ci.org/es128/anymatch) [](https://coveralls.io/r/es128/anymatch?branch=master)
|
||||
======
|
||||
Javascript module to match a string against a regular expression, glob, string,
|
||||
or function that takes the string as an argument and returns a truthy or falsy
|
||||
value. The matcher can also be an array of any or all of these. Useful for
|
||||
allowing a very flexible user-defined config to define things like file paths.
|
||||
|
||||
[](https://nodei.co/npm/anymatch/)
|
||||
[](https://nodei.co/npm-dl/anymatch/)
|
||||
|
||||
Usage
|
||||
-----
|
||||
```sh
|
||||
npm install anymatch --save
|
||||
```
|
||||
|
||||
#### anymatch (matchers, testString, [returnIndex], [startIndex], [endIndex])
|
||||
* __matchers__: (_Array|String|RegExp|Function_)
|
||||
String to be directly matched, string with glob patterns, regular expression
|
||||
test, function that takes the testString as an argument and returns a truthy
|
||||
value if it should be matched, or an array of any number and mix of these types.
|
||||
* __testString__: (_String|Array_) The string to test against the matchers. If
|
||||
passed as an array, the first element of the array will be used as the
|
||||
`testString` for non-function matchers, while the entire array will be applied
|
||||
as the arguments for function matchers.
|
||||
* __returnIndex__: (_Boolean [optional]_) If true, return the array index of
|
||||
the first matcher that that testString matched, or -1 if no match, instead of a
|
||||
boolean result.
|
||||
* __startIndex, endIndex__: (_Integer [optional]_) Can be used to define a
|
||||
subset out of the array of provided matchers to test against. Can be useful
|
||||
with bound matcher functions (see below). When used with `returnIndex = true`
|
||||
preserves original indexing. Behaves the same as `Array.prototype.slice` (i.e.
|
||||
includes array members up to, but not including endIndex).
|
||||
|
||||
```js
|
||||
var anymatch = require('anymatch');
|
||||
|
||||
var matchers = [
|
||||
'path/to/file.js',
|
||||
'path/anyjs/**/*.js',
|
||||
/foo.js$/,
|
||||
function (string) {
|
||||
return string.indexOf('bar') !== -1 && string.length > 10
|
||||
}
|
||||
];
|
||||
|
||||
anymatch(matchers, 'path/to/file.js'); // true
|
||||
anymatch(matchers, 'path/anyjs/baz.js'); // true
|
||||
anymatch(matchers, 'path/to/foo.js'); // true
|
||||
anymatch(matchers, 'path/to/bar.js'); // true
|
||||
anymatch(matchers, 'bar.js'); // false
|
||||
|
||||
// returnIndex = true
|
||||
anymatch(matchers, 'foo.js', true); // 2
|
||||
anymatch(matchers, 'path/anyjs/foo.js', true); // 1
|
||||
|
||||
// skip matchers
|
||||
anymatch(matchers, 'path/to/file.js', false, 1); // false
|
||||
anymatch(matchers, 'path/anyjs/foo.js', true, 2, 3); // 2
|
||||
anymatch(matchers, 'path/to/bar.js', true, 0, 3); // -1
|
||||
```
|
||||
|
||||
#### anymatch (matchers)
|
||||
You can also pass in only your matcher(s) to get a curried function that has
|
||||
already been bound to the provided matching criteria. This can be used as an
|
||||
`Array.prototype.filter` callback.
|
||||
|
||||
```js
|
||||
var matcher = anymatch(matchers);
|
||||
|
||||
matcher('path/to/file.js'); // true
|
||||
matcher('path/anyjs/baz.js', true); // 1
|
||||
matcher('path/anyjs/baz.js', true, 2); // -1
|
||||
|
||||
['foo.js', 'bar.js'].filter(matcher); // ['foo.js']
|
||||
```
|
||||
|
||||
Change Log
|
||||
----------
|
||||
[See release notes page on GitHub](https://github.com/es128/anymatch/releases)
|
||||
|
||||
NOTE: As of v1.2.0, anymatch uses [micromatch](https://github.com/jonschlinkert/micromatch)
|
||||
for glob pattern matching. The glob matching behavior should be functionally
|
||||
equivalent to the commonly used [minimatch](https://github.com/isaacs/minimatch)
|
||||
library (aside from some fixed bugs and greater performance), so a major
|
||||
version bump wasn't merited. Issues with glob pattern matching should be
|
||||
reported directly to the [micromatch issue tracker](https://github.com/jonschlinkert/micromatch/issues).
|
||||
|
||||
License
|
||||
-------
|
||||
[ISC](https://raw.github.com/es128/anymatch/master/LICENSE)
|
||||
64
node_modules/anymatch/index.js
generated
vendored
Normal file
64
node_modules/anymatch/index.js
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
'use strict';
|
||||
|
||||
var arrify = require('arrify');
|
||||
var micromatch = require('micromatch');
|
||||
var path = require('path');
|
||||
|
||||
var anymatch = function(criteria, value, returnIndex, startIndex, endIndex) {
|
||||
criteria = arrify(criteria);
|
||||
value = arrify(value);
|
||||
if (arguments.length === 1) {
|
||||
return anymatch.bind(null, criteria.map(function(criterion) {
|
||||
return typeof criterion === 'string' && criterion[0] !== '!' ?
|
||||
micromatch.matcher(criterion) : criterion;
|
||||
}));
|
||||
}
|
||||
startIndex = startIndex || 0;
|
||||
var string = value[0];
|
||||
var altString;
|
||||
var matched = false;
|
||||
var matchIndex = -1;
|
||||
function testCriteria (criterion, index) {
|
||||
var result;
|
||||
switch (toString.call(criterion)) {
|
||||
case '[object String]':
|
||||
result = string === criterion || altString && altString === criterion;
|
||||
result = result || micromatch.isMatch(string, criterion);
|
||||
break;
|
||||
case '[object RegExp]':
|
||||
result = criterion.test(string) || altString && criterion.test(altString);
|
||||
break;
|
||||
case '[object Function]':
|
||||
result = criterion.apply(null, value);
|
||||
break;
|
||||
default:
|
||||
result = false;
|
||||
}
|
||||
if (result) {
|
||||
matchIndex = index + startIndex;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
var crit = criteria;
|
||||
var negGlobs = crit.reduce(function(arr, criterion, index) {
|
||||
if (typeof criterion === 'string' && criterion[0] === '!') {
|
||||
if (crit === criteria) {
|
||||
// make a copy before modifying
|
||||
crit = crit.slice();
|
||||
}
|
||||
crit[index] = null;
|
||||
arr.push(criterion.substr(1));
|
||||
}
|
||||
return arr;
|
||||
}, []);
|
||||
if (!negGlobs.length || !micromatch.any(string, negGlobs)) {
|
||||
if (path.sep === '\\' && typeof string === 'string') {
|
||||
altString = string.split('\\').join('/');
|
||||
altString = altString === string ? null : altString;
|
||||
}
|
||||
matched = crit.slice(startIndex, endIndex).some(testCriteria);
|
||||
}
|
||||
return returnIndex === true ? matchIndex : matched;
|
||||
};
|
||||
|
||||
module.exports = anymatch;
|
||||
95
node_modules/anymatch/package.json
generated
vendored
Normal file
95
node_modules/anymatch/package.json
generated
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"anymatch@^1.3.0",
|
||||
"/home/mywebsite/node_modules/chokidar"
|
||||
]
|
||||
],
|
||||
"_from": "anymatch@>=1.3.0 <2.0.0",
|
||||
"_id": "anymatch@1.3.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/anymatch",
|
||||
"_nodeVersion": "1.6.2",
|
||||
"_npmUser": {
|
||||
"email": "elan.shanker+npm@gmail.com",
|
||||
"name": "es128"
|
||||
},
|
||||
"_npmVersion": "2.7.3",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "anymatch",
|
||||
"raw": "anymatch@^1.3.0",
|
||||
"rawSpec": "^1.3.0",
|
||||
"scope": null,
|
||||
"spec": ">=1.3.0 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/chokidar"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.0.tgz",
|
||||
"_shasum": "a3e52fa39168c825ff57b0248126ce5a8ff95507",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "anymatch@^1.3.0",
|
||||
"_where": "/home/mywebsite/node_modules/chokidar",
|
||||
"author": {
|
||||
"name": "Elan Shanker",
|
||||
"url": "http://github.com/es128"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/es128/anymatch/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"arrify": "^1.0.0",
|
||||
"micromatch": "^2.1.5"
|
||||
},
|
||||
"description": "Matches strings against configurable strings, globs, regular expressions, and/or functions",
|
||||
"devDependencies": {
|
||||
"coveralls": "^2.11.2",
|
||||
"istanbul": "^0.3.13",
|
||||
"mocha": "^2.2.4"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "a3e52fa39168c825ff57b0248126ce5a8ff95507",
|
||||
"tarball": "http://registry.npmjs.org/anymatch/-/anymatch-1.3.0.tgz"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "253d2ad42f644ed18557f561312a7f8426daca84",
|
||||
"homepage": "https://github.com/es128/anymatch",
|
||||
"keywords": [
|
||||
"any",
|
||||
"expression",
|
||||
"file",
|
||||
"fs",
|
||||
"function",
|
||||
"glob",
|
||||
"list",
|
||||
"match",
|
||||
"regex",
|
||||
"regexp",
|
||||
"regular",
|
||||
"string"
|
||||
],
|
||||
"license": "ISC",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "es128",
|
||||
"email": "elan.shanker+npm@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "anymatch",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/es128/anymatch.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "istanbul cover _mocha && cat ./coverage/lcov.info | coveralls"
|
||||
},
|
||||
"version": "1.3.0"
|
||||
}
|
||||
0
node_modules/forever/node_modules/forever-monitor/node_modules/chokidar/node_modules/anymatch/node_modules/micromatch/node_modules/extglob/node_modules/is-extglob/LICENSE → node_modules/arr-diff/LICENSE
generated
vendored
Normal file → Executable file
0
node_modules/forever/node_modules/forever-monitor/node_modules/chokidar/node_modules/anymatch/node_modules/micromatch/node_modules/extglob/node_modules/is-extglob/LICENSE → node_modules/arr-diff/LICENSE
generated
vendored
Normal file → Executable file
74
node_modules/arr-diff/README.md
generated
vendored
Normal file
74
node_modules/arr-diff/README.md
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
# arr-diff [](https://www.npmjs.com/package/arr-diff) [](https://travis-ci.org/jonschlinkert/base)
|
||||
|
||||
> Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/)
|
||||
|
||||
```sh
|
||||
$ npm i arr-diff --save
|
||||
```
|
||||
Install with [bower](http://bower.io/)
|
||||
|
||||
```sh
|
||||
$ bower install arr-diff --save
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### [diff](index.js#L33)
|
||||
|
||||
Return the difference between the first array and additional arrays.
|
||||
|
||||
**Params**
|
||||
|
||||
* `a` **{Array}**
|
||||
* `b` **{Array}**
|
||||
* `returns` **{Array}**
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
var diff = require('arr-diff');
|
||||
|
||||
var a = ['a', 'b', 'c', 'd'];
|
||||
var b = ['b', 'c'];
|
||||
|
||||
console.log(diff(a, b))
|
||||
//=> ['a', 'd']
|
||||
```
|
||||
|
||||
## Related projects
|
||||
|
||||
* [arr-flatten](https://www.npmjs.com/package/arr-flatten): Recursively flatten an array or arrays. This is the fastest implementation of array flatten. | [homepage](https://github.com/jonschlinkert/arr-flatten)
|
||||
* [array-filter](https://www.npmjs.com/package/array-filter): Array#filter for older browsers. | [homepage](https://github.com/juliangruber/array-filter)
|
||||
* [array-intersection](https://www.npmjs.com/package/array-intersection): Return an array with the unique values present in _all_ given arrays using strict equality… [more](https://www.npmjs.com/package/array-intersection) | [homepage](https://github.com/jonschlinkert/array-intersection)
|
||||
|
||||
## Running tests
|
||||
|
||||
Install dev dependencies:
|
||||
|
||||
```sh
|
||||
$ npm i -d && npm test
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/arr-diff/issues/new).
|
||||
|
||||
## Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
+ [github/jonschlinkert](https://github.com/jonschlinkert)
|
||||
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
|
||||
|
||||
## License
|
||||
|
||||
Copyright © 2015 [Jon Schlinkert](https://github.com/jonschlinkert)
|
||||
Released under the MIT license.
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb](https://github.com/verbose/verb) on Sat Dec 05 2015 23:24:53 GMT-0500 (EST)._
|
||||
58
node_modules/arr-diff/index.js
generated
vendored
Normal file
58
node_modules/arr-diff/index.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
/*!
|
||||
* arr-diff <https://github.com/jonschlinkert/arr-diff>
|
||||
*
|
||||
* Copyright (c) 2014 Jon Schlinkert, contributors.
|
||||
* Licensed under the MIT License
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var flatten = require('arr-flatten');
|
||||
var slice = [].slice;
|
||||
|
||||
/**
|
||||
* Return the difference between the first array and
|
||||
* additional arrays.
|
||||
*
|
||||
* ```js
|
||||
* var diff = require('{%= name %}');
|
||||
*
|
||||
* var a = ['a', 'b', 'c', 'd'];
|
||||
* var b = ['b', 'c'];
|
||||
*
|
||||
* console.log(diff(a, b))
|
||||
* //=> ['a', 'd']
|
||||
* ```
|
||||
*
|
||||
* @param {Array} `a`
|
||||
* @param {Array} `b`
|
||||
* @return {Array}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function diff(arr, arrays) {
|
||||
var argsLen = arguments.length;
|
||||
var len = arr.length, i = -1;
|
||||
var res = [], arrays;
|
||||
|
||||
if (argsLen === 1) {
|
||||
return arr;
|
||||
}
|
||||
|
||||
if (argsLen > 2) {
|
||||
arrays = flatten(slice.call(arguments, 1));
|
||||
}
|
||||
|
||||
while (++i < len) {
|
||||
if (!~arrays.indexOf(arr[i])) {
|
||||
res.push(arr[i]);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expose `diff`
|
||||
*/
|
||||
|
||||
module.exports = diff;
|
||||
111
node_modules/arr-diff/package.json
generated
vendored
Normal file
111
node_modules/arr-diff/package.json
generated
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"arr-diff@^2.0.0",
|
||||
"/home/mywebsite/node_modules/micromatch"
|
||||
]
|
||||
],
|
||||
"_from": "arr-diff@>=2.0.0 <3.0.0",
|
||||
"_id": "arr-diff@2.0.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/arr-diff",
|
||||
"_nodeVersion": "5.0.0",
|
||||
"_npmUser": {
|
||||
"email": "github@sellside.com",
|
||||
"name": "jonschlinkert"
|
||||
},
|
||||
"_npmVersion": "3.3.6",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "arr-diff",
|
||||
"raw": "arr-diff@^2.0.0",
|
||||
"rawSpec": "^2.0.0",
|
||||
"scope": null,
|
||||
"spec": ">=2.0.0 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/micromatch"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz",
|
||||
"_shasum": "8f3b827f955a8bd669697e4a4256ac3ceae356cf",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "arr-diff@^2.0.0",
|
||||
"_where": "/home/mywebsite/node_modules/micromatch",
|
||||
"author": {
|
||||
"name": "Jon Schlinkert",
|
||||
"url": "https://github.com/jonschlinkert"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/arr-diff/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"arr-flatten": "^1.0.1"
|
||||
},
|
||||
"description": "Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons.",
|
||||
"devDependencies": {
|
||||
"array-differ": "^1.0.0",
|
||||
"array-slice": "^0.2.3",
|
||||
"benchmarked": "^0.1.4",
|
||||
"chalk": "^1.1.1",
|
||||
"mocha": "*",
|
||||
"should": "*"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "8f3b827f955a8bd669697e4a4256ac3ceae356cf",
|
||||
"tarball": "http://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "b89f54eb88ca51afd0e0ea6be9a4a63e5ccecf27",
|
||||
"homepage": "https://github.com/jonschlinkert/arr-diff",
|
||||
"keywords": [
|
||||
"arr",
|
||||
"array",
|
||||
"diff",
|
||||
"differ",
|
||||
"difference"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "doowb",
|
||||
"email": "brian.woodward@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "jonschlinkert",
|
||||
"email": "github@sellside.com"
|
||||
},
|
||||
{
|
||||
"name": "paulmillr",
|
||||
"email": "paul@paulmillr.com"
|
||||
}
|
||||
],
|
||||
"name": "arr-diff",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jonschlinkert/arr-diff.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"verb": {
|
||||
"related": {
|
||||
"list": [
|
||||
"arr-flatten",
|
||||
"array-filter",
|
||||
"array-intersection"
|
||||
]
|
||||
}
|
||||
},
|
||||
"version": "2.0.0"
|
||||
}
|
||||
0
node_modules/forever/node_modules/forever-monitor/node_modules/chokidar/node_modules/anymatch/node_modules/micromatch/node_modules/is-glob/LICENSE → node_modules/arr-flatten/LICENSE
generated
vendored
Normal file → Executable file
0
node_modules/forever/node_modules/forever-monitor/node_modules/chokidar/node_modules/anymatch/node_modules/micromatch/node_modules/is-glob/LICENSE → node_modules/arr-flatten/LICENSE
generated
vendored
Normal file → Executable file
73
node_modules/arr-flatten/README.md
generated
vendored
Executable file
73
node_modules/arr-flatten/README.md
generated
vendored
Executable file
@@ -0,0 +1,73 @@
|
||||
# arr-flatten [](http://badge.fury.io/js/arr-flatten) [](https://travis-ci.org/jonschlinkert/arr-flatten)
|
||||
|
||||
> Recursively flatten an array or arrays. This is the fastest implementation of array flatten.
|
||||
|
||||
Why another flatten utility? I wanted the fastest implementation I could find, with implementation choices that should work for 95% of use cases, but no cruft to cover the other 5%.
|
||||
|
||||
## Run benchmarks
|
||||
|
||||
```bash
|
||||
npm run benchmarks
|
||||
```
|
||||
|
||||
Benchmark results comparing this library to [array-flatten]:
|
||||
|
||||
```bash
|
||||
#1: large.js
|
||||
arr-flatten.js x 487,030 ops/sec ±0.67% (92 runs sampled)
|
||||
array-flatten.js x 347,020 ops/sec ±0.57% (98 runs sampled)
|
||||
|
||||
#2: medium.js
|
||||
arr-flatten.js x 1,914,516 ops/sec ±0.76% (94 runs sampled)
|
||||
array-flatten.js x 1,391,661 ops/sec ±0.63% (96 runs sampled)
|
||||
|
||||
#3: small.js
|
||||
arr-flatten.js x 5,158,980 ops/sec ±0.85% (94 runs sampled)
|
||||
array-flatten.js x 3,683,173 ops/sec ±0.79% (97 runs sampled)
|
||||
```
|
||||
|
||||
## Run tests
|
||||
|
||||
Install dev dependencies:
|
||||
|
||||
```bash
|
||||
npm i -d && npm test
|
||||
```
|
||||
|
||||
## Install with [npm](npmjs.org)
|
||||
|
||||
```bash
|
||||
npm i arr-flatten --save
|
||||
```
|
||||
### Install with [bower](https://github.com/bower/bower)
|
||||
|
||||
```bash
|
||||
bower install arr-flatten --save
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var flatten = require('arr-flatten');
|
||||
|
||||
flatten(['a', ['b', ['c']], 'd', ['e']]);
|
||||
//=> ['a', 'b', 'c', 'd', 'e']
|
||||
```
|
||||
|
||||
## Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
+ [github/jonschlinkert](https://github.com/jonschlinkert)
|
||||
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
|
||||
|
||||
## License
|
||||
Copyright (c) 2014-2015 Jon Schlinkert
|
||||
Released under the MIT license
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on March 11, 2015._
|
||||
|
||||
[array-flatten]: https://github.com/blakeembrey/array-flatten
|
||||
27
node_modules/arr-flatten/index.js
generated
vendored
Executable file
27
node_modules/arr-flatten/index.js
generated
vendored
Executable file
@@ -0,0 +1,27 @@
|
||||
/*!
|
||||
* arr-flatten <https://github.com/jonschlinkert/arr-flatten>
|
||||
*
|
||||
* Copyright (c) 2014-2015, Jon Schlinkert.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = function flatten(arr) {
|
||||
return flat(arr, []);
|
||||
};
|
||||
|
||||
function flat(arr, res) {
|
||||
var len = arr.length;
|
||||
var i = -1;
|
||||
|
||||
while (len--) {
|
||||
var cur = arr[++i];
|
||||
if (Array.isArray(cur)) {
|
||||
flat(cur, res);
|
||||
} else {
|
||||
res.push(cur);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
100
node_modules/arr-flatten/package.json
generated
vendored
Normal file
100
node_modules/arr-flatten/package.json
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"arr-flatten@^1.0.1",
|
||||
"/home/mywebsite/node_modules/arr-diff"
|
||||
]
|
||||
],
|
||||
"_from": "arr-flatten@>=1.0.1 <2.0.0",
|
||||
"_id": "arr-flatten@1.0.1",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/arr-flatten",
|
||||
"_nodeVersion": "0.12.0",
|
||||
"_npmUser": {
|
||||
"email": "github@sellside.com",
|
||||
"name": "jonschlinkert"
|
||||
},
|
||||
"_npmVersion": "2.5.1",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "arr-flatten",
|
||||
"raw": "arr-flatten@^1.0.1",
|
||||
"rawSpec": "^1.0.1",
|
||||
"scope": null,
|
||||
"spec": ">=1.0.1 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/arr-diff"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.0.1.tgz",
|
||||
"_shasum": "e5ffe54d45e19f32f216e91eb99c8ce892bb604b",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "arr-flatten@^1.0.1",
|
||||
"_where": "/home/mywebsite/node_modules/arr-diff",
|
||||
"author": {
|
||||
"name": "Jon Schlinkert",
|
||||
"url": "https://github.com/jonschlinkert"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/arr-flatten/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Recursively flatten an array or arrays. This is the fastest implementation of array flatten.",
|
||||
"devDependencies": {
|
||||
"array-flatten": "^1.0.2",
|
||||
"array-slice": "^0.2.2",
|
||||
"benchmarked": "^0.1.3",
|
||||
"chalk": "^0.5.1",
|
||||
"glob": "^4.3.5",
|
||||
"kind-of": "^1.0.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "e5ffe54d45e19f32f216e91eb99c8ce892bb604b",
|
||||
"tarball": "http://registry.npmjs.org/arr-flatten/-/arr-flatten-1.0.1.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "7b3706eaa0093d8f5ba65af8ed590b6fcb3fe7cf",
|
||||
"homepage": "https://github.com/jonschlinkert/arr-flatten",
|
||||
"keywords": [
|
||||
"arr",
|
||||
"array",
|
||||
"elements",
|
||||
"flat",
|
||||
"flatten",
|
||||
"nested",
|
||||
"recurse",
|
||||
"recursive",
|
||||
"recursively"
|
||||
],
|
||||
"license": {
|
||||
"type": "MIT",
|
||||
"url": "https://github.com/jonschlinkert/arr-flatten/blob/master/LICENSE"
|
||||
},
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "jonschlinkert",
|
||||
"email": "github@sellside.com"
|
||||
}
|
||||
],
|
||||
"name": "arr-flatten",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/jonschlinkert/arr-flatten.git"
|
||||
},
|
||||
"scripts": {
|
||||
"benchmarks": "node benchmark",
|
||||
"test": "mocha"
|
||||
},
|
||||
"version": "1.0.1"
|
||||
}
|
||||
51
node_modules/array-unique/README.md
generated
vendored
Executable file
51
node_modules/array-unique/README.md
generated
vendored
Executable file
@@ -0,0 +1,51 @@
|
||||
# array-unique [](http://badge.fury.io/js/array-unique) [](https://travis-ci.org/jonschlinkert/array-unique)
|
||||
|
||||
> Return an array free of duplicate values. Fastest ES5 implementation.
|
||||
|
||||
## Install with [npm](npmjs.org)
|
||||
|
||||
```bash
|
||||
npm i array-unique --save
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var unique = require('array-unique');
|
||||
|
||||
unique(['a', 'b', 'c', 'c']);
|
||||
//=> ['a', 'b', 'c']
|
||||
```
|
||||
|
||||
## Related
|
||||
* [arr-diff](https://github.com/jonschlinkert/arr-diff): Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons.
|
||||
* [arr-union](https://github.com/jonschlinkert/arr-union): Returns an array of unique values using strict equality for comparisons.
|
||||
* [arr-flatten](https://github.com/jonschlinkert/arr-flatten): Recursively flatten an array or arrays. This is the fastest implementation of array flatten.
|
||||
* [arr-reduce](https://github.com/jonschlinkert/arr-reduce): Fast array reduce that also loops over sparse elements.
|
||||
* [arr-map](https://github.com/jonschlinkert/arr-map): Faster, node.js focused alternative to JavaScript's native array map.
|
||||
* [arr-pluck](https://github.com/jonschlinkert/arr-pluck): Retrieves the value of a specified property from all elements in the collection.
|
||||
|
||||
## Run tests
|
||||
Install dev dependencies.
|
||||
|
||||
```bash
|
||||
npm i -d && npm test
|
||||
```
|
||||
|
||||
## Contributing
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/array-unique/issues)
|
||||
|
||||
## Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
+ [github/jonschlinkert](https://github.com/jonschlinkert)
|
||||
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
|
||||
|
||||
## License
|
||||
Copyright (c) 2015 Jon Schlinkert
|
||||
Released under the MIT license
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on March 24, 2015._
|
||||
28
node_modules/array-unique/index.js
generated
vendored
Executable file
28
node_modules/array-unique/index.js
generated
vendored
Executable file
@@ -0,0 +1,28 @@
|
||||
/*!
|
||||
* array-unique <https://github.com/jonschlinkert/array-unique>
|
||||
*
|
||||
* Copyright (c) 2014-2015, Jon Schlinkert.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = function unique(arr) {
|
||||
if (!Array.isArray(arr)) {
|
||||
throw new TypeError('array-unique expects an array.');
|
||||
}
|
||||
|
||||
var len = arr.length;
|
||||
var i = -1;
|
||||
|
||||
while (i++ < len) {
|
||||
var j = i + 1;
|
||||
|
||||
for (; j < arr.length; ++j) {
|
||||
if (arr[i] === arr[j]) {
|
||||
arr.splice(j--, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
};
|
||||
86
node_modules/array-unique/package.json
generated
vendored
Normal file
86
node_modules/array-unique/package.json
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"array-unique@^0.2.1",
|
||||
"/home/mywebsite/node_modules/micromatch"
|
||||
]
|
||||
],
|
||||
"_from": "array-unique@>=0.2.1 <0.3.0",
|
||||
"_id": "array-unique@0.2.1",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/array-unique",
|
||||
"_nodeVersion": "1.6.2",
|
||||
"_npmUser": {
|
||||
"email": "github@sellside.com",
|
||||
"name": "jonschlinkert"
|
||||
},
|
||||
"_npmVersion": "2.7.1",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "array-unique",
|
||||
"raw": "array-unique@^0.2.1",
|
||||
"rawSpec": "^0.2.1",
|
||||
"scope": null,
|
||||
"spec": ">=0.2.1 <0.3.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/micromatch"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz",
|
||||
"_shasum": "a1d97ccafcbc2625cc70fadceb36a50c58b01a53",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "array-unique@^0.2.1",
|
||||
"_where": "/home/mywebsite/node_modules/micromatch",
|
||||
"author": {
|
||||
"name": "Jon Schlinkert",
|
||||
"url": "https://github.com/jonschlinkert"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/array-unique/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Return an array free of duplicate values. Fastest ES5 implementation.",
|
||||
"devDependencies": {
|
||||
"array-uniq": "^1.0.2",
|
||||
"benchmarked": "^0.1.3",
|
||||
"mocha": "*",
|
||||
"should": "*"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "a1d97ccafcbc2625cc70fadceb36a50c58b01a53",
|
||||
"tarball": "http://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "36fde8e586fb7cf880b8b3aa6515df889e64ed85",
|
||||
"homepage": "https://github.com/jonschlinkert/array-unique",
|
||||
"license": {
|
||||
"type": "MIT",
|
||||
"url": "https://github.com/jonschlinkert/array-unique/blob/master/LICENSE"
|
||||
},
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "jonschlinkert",
|
||||
"email": "github@sellside.com"
|
||||
}
|
||||
],
|
||||
"name": "array-unique",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/jonschlinkert/array-unique.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"version": "0.2.1"
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
module.exports = function (val) {
|
||||
if (val == null) {
|
||||
if (val === null || val === undefined) {
|
||||
return [];
|
||||
}
|
||||
|
||||
89
node_modules/arrify/package.json
generated
vendored
Normal file
89
node_modules/arrify/package.json
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"arrify@^1.0.0",
|
||||
"/home/mywebsite/node_modules/anymatch"
|
||||
]
|
||||
],
|
||||
"_from": "arrify@>=1.0.0 <2.0.0",
|
||||
"_id": "arrify@1.0.1",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/arrify",
|
||||
"_nodeVersion": "4.2.1",
|
||||
"_npmUser": {
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"name": "sindresorhus"
|
||||
},
|
||||
"_npmVersion": "3.5.2",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "arrify",
|
||||
"raw": "arrify@^1.0.0",
|
||||
"rawSpec": "^1.0.0",
|
||||
"scope": null,
|
||||
"spec": ">=1.0.0 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/anymatch"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz",
|
||||
"_shasum": "898508da2226f380df904728456849c1501a4b0d",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "arrify@^1.0.0",
|
||||
"_where": "/home/mywebsite/node_modules/anymatch",
|
||||
"author": {
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"name": "Sindre Sorhus",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/arrify/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Convert a value to an array",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "898508da2226f380df904728456849c1501a4b0d",
|
||||
"tarball": "http://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "087edee1a58d5adaac6cae5a107886121ef43783",
|
||||
"homepage": "https://github.com/sindresorhus/arrify#readme",
|
||||
"keywords": [
|
||||
"arr",
|
||||
"array",
|
||||
"arrayify",
|
||||
"arrify",
|
||||
"convert",
|
||||
"value"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "arrify",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/arrify.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "1.0.1"
|
||||
}
|
||||
@@ -13,7 +13,7 @@ $ npm install --save arrify
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var arrify = require('arrify');
|
||||
const arrify = require('arrify');
|
||||
|
||||
arrify('unicorn');
|
||||
//=> ['unicorn']
|
||||
@@ -24,7 +24,7 @@ arrify(['unicorn']);
|
||||
arrify(null);
|
||||
//=> []
|
||||
|
||||
arrift(undefined);
|
||||
arrify(undefined);
|
||||
//=> []
|
||||
```
|
||||
|
||||
25
node_modules/async-each/.npmignore
generated
vendored
Normal file
25
node_modules/async-each/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
# Numerous always-ignore extensions
|
||||
*.diff
|
||||
*.err
|
||||
*.orig
|
||||
*.log
|
||||
*~
|
||||
|
||||
# OS or Editor folders
|
||||
.DS_Store
|
||||
.cache
|
||||
Icon?
|
||||
|
||||
# Folders to ignore
|
||||
.hg
|
||||
.svn
|
||||
|
||||
# Node.js package manager
|
||||
/node_modules
|
||||
/npm-debug.log
|
||||
|
||||
# Other stuff
|
||||
*.pyc
|
||||
/tmp
|
||||
|
||||
# Project stuff
|
||||
20
node_modules/async-each/CHANGELOG.md
generated
vendored
Normal file
20
node_modules/async-each/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
# async-each 0.1.6 (5 November 2014)
|
||||
* Add license to package.json
|
||||
|
||||
# async-each 0.1.5 (22 October 2014)
|
||||
* Clean up package.json to fix npm warning about `repo`
|
||||
|
||||
# async-each 0.1.4 (12 November 2013)
|
||||
* Fixed AMD definition.
|
||||
|
||||
# async-each 0.1.3 (25 July 2013)
|
||||
* Fixed double wrapping of errors.
|
||||
|
||||
# async-each 0.1.2 (7 July 2013)
|
||||
* Fixed behaviour on empty arrays.
|
||||
|
||||
# async-each 0.1.1 (14 June 2013)
|
||||
* Wrapped function in closure, enabled strict mode.
|
||||
|
||||
# async-each 0.1.0 (14 June 2013)
|
||||
* Initial release.
|
||||
64
node_modules/async-each/README.md
generated
vendored
Normal file
64
node_modules/async-each/README.md
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
# async-each
|
||||
|
||||
No-bullshit, ultra-simple, 35-lines-of-code async parallel forEach function for JavaScript.
|
||||
|
||||
We don't need junky 30K async libs. Really.
|
||||
|
||||
For browsers and node.js.
|
||||
|
||||
## Installation
|
||||
* Just include async-each before your scripts.
|
||||
* `npm install async-each` if you’re using node.js.
|
||||
* `component install paulmillr/async-each` if you’re using [component(1)](https://github.com/component/component).
|
||||
* `bower install async-each` if you’re using [Twitter Bower](http://bower.io).
|
||||
|
||||
## Usage
|
||||
|
||||
* `each(array, iterator, callback);` — `Array`, `Function`, `(optional) Function`
|
||||
* `iterator(item, next)` receives current item and a callback that will mark the item as done. `next` callback receives optional `error, transformedItem` arguments.
|
||||
* `callback(error, transformedArray)` optionally receives first error and transformed result `Array`.
|
||||
|
||||
Node.js:
|
||||
|
||||
```javascript
|
||||
var each = require('async-each');
|
||||
each(['a.js', 'b.js', 'c.js'], fs.readFile, function(error, contents) {
|
||||
if (error) console.error(error);
|
||||
console.log('Contents for a, b and c:', contents);
|
||||
});
|
||||
```
|
||||
|
||||
Browser:
|
||||
|
||||
```javascript
|
||||
// component(1)
|
||||
var each = require('async-each');
|
||||
each(list, fn, callback);
|
||||
|
||||
// Default:
|
||||
window.asyncEach(list, fn, callback);
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013 Paul Miller (http://paulmillr.com/)
|
||||
|
||||
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.
|
||||
22
node_modules/async-each/bower.json
generated
vendored
Normal file
22
node_modules/async-each/bower.json
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "async-each",
|
||||
"repo": "paulmillr/async-each",
|
||||
"description": "No-bullshit, ultra-simple, 35-lines-of-code async parallel forEach / map function for JavaScript.",
|
||||
"version": "0.1.6",
|
||||
"keywords": [
|
||||
"async", "forEach", "each", "map",
|
||||
"asynchronous",
|
||||
"iteration", "iterate",
|
||||
"loop", "parallel",
|
||||
"concurrent", "array",
|
||||
"flow", "control flow"
|
||||
],
|
||||
"main": "index.js",
|
||||
"dependencies": {},
|
||||
"development": {},
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components"
|
||||
]
|
||||
}
|
||||
18
node_modules/async-each/component.json
generated
vendored
Normal file
18
node_modules/async-each/component.json
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "async-each",
|
||||
"repo": "paulmillr/async-each",
|
||||
"description": "No-bullshit, ultra-simple, 35-lines-of-code async parallel forEach / map function for JavaScript.",
|
||||
"version": "0.1.6",
|
||||
"keywords": [
|
||||
"async", "forEach", "each", "map",
|
||||
"asynchronous",
|
||||
"iteration", "iterate",
|
||||
"loop", "parallel",
|
||||
"concurrent", "array",
|
||||
"flow", "control flow"
|
||||
],
|
||||
"main": "index.js",
|
||||
"scripts": ["index.js"],
|
||||
"dependencies": {},
|
||||
"development": {}
|
||||
}
|
||||
38
node_modules/async-each/index.js
generated
vendored
Normal file
38
node_modules/async-each/index.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
// async-each MIT license (by Paul Miller from http://paulmillr.com).
|
||||
(function(globals) {
|
||||
'use strict';
|
||||
var each = function(items, next, callback) {
|
||||
if (!Array.isArray(items)) throw new TypeError('each() expects array as first argument');
|
||||
if (typeof next !== 'function') throw new TypeError('each() expects function as second argument');
|
||||
if (typeof callback !== 'function') callback = Function.prototype; // no-op
|
||||
|
||||
if (items.length === 0) return callback(undefined, items);
|
||||
|
||||
var transformed = new Array(items.length);
|
||||
var count = 0;
|
||||
var returned = false;
|
||||
|
||||
items.forEach(function(item, index) {
|
||||
next(item, function(error, transformedItem) {
|
||||
if (returned) return;
|
||||
if (error) {
|
||||
returned = true;
|
||||
return callback(error);
|
||||
}
|
||||
transformed[index] = transformedItem;
|
||||
count += 1;
|
||||
if (count === items.length) return callback(undefined, transformed);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
if (typeof define !== 'undefined' && define.amd) {
|
||||
define([], function() {
|
||||
return each;
|
||||
}); // RequireJS
|
||||
} else if (typeof module !== 'undefined' && module.exports) {
|
||||
module.exports = each; // CommonJS
|
||||
} else {
|
||||
globals.asyncEach = each; // <script>
|
||||
}
|
||||
})(this);
|
||||
88
node_modules/async-each/package.json
generated
vendored
Normal file
88
node_modules/async-each/package.json
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"async-each@^0.1.6",
|
||||
"/home/mywebsite/node_modules/chokidar"
|
||||
]
|
||||
],
|
||||
"_from": "async-each@>=0.1.6 <0.2.0",
|
||||
"_id": "async-each@0.1.6",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/async-each",
|
||||
"_npmUser": {
|
||||
"email": "elan.shanker+npm@gmail.com",
|
||||
"name": "es128"
|
||||
},
|
||||
"_npmVersion": "1.4.28",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "async-each",
|
||||
"raw": "async-each@^0.1.6",
|
||||
"rawSpec": "^0.1.6",
|
||||
"scope": null,
|
||||
"spec": ">=0.1.6 <0.2.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/chokidar"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/async-each/-/async-each-0.1.6.tgz",
|
||||
"_shasum": "b67e99edcddf96541e44af56290cd7d5c6e70439",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "async-each@^0.1.6",
|
||||
"_where": "/home/mywebsite/node_modules/chokidar",
|
||||
"author": {
|
||||
"name": "Paul Miller",
|
||||
"url": "http://paulmillr.com/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/paulmillr/async-each/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "No-bullshit, ultra-simple, 35-lines-of-code async parallel forEach / map function for JavaScript.",
|
||||
"devDependencies": {},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "b67e99edcddf96541e44af56290cd7d5c6e70439",
|
||||
"tarball": "http://registry.npmjs.org/async-each/-/async-each-0.1.6.tgz"
|
||||
},
|
||||
"gitHead": "3da122b3e6fe84207bdca246e484a6a50462f190",
|
||||
"homepage": "https://github.com/paulmillr/async-each/",
|
||||
"keywords": [
|
||||
"array",
|
||||
"async",
|
||||
"asynchronous",
|
||||
"concurrent",
|
||||
"control flow",
|
||||
"each",
|
||||
"flow",
|
||||
"forEach",
|
||||
"iterate",
|
||||
"iteration",
|
||||
"loop",
|
||||
"map",
|
||||
"parallel"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "paulmillr",
|
||||
"email": "paul@paulmillr.com"
|
||||
},
|
||||
{
|
||||
"name": "es128",
|
||||
"email": "elan.shanker+npm@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "async-each",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/paulmillr/async-each.git"
|
||||
},
|
||||
"scripts": {},
|
||||
"version": "0.1.6"
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
Copyright (C) 2012-2014 by various contributors (see AUTHORS)
|
||||
Copyright (c) 2010 Caolan McMahon
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
1425
node_modules/async/README.md
generated
vendored
Normal file
1425
node_modules/async/README.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
11
node_modules/async/component.json
generated
vendored
Normal file
11
node_modules/async/component.json
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "async",
|
||||
"repo": "caolan/async",
|
||||
"description": "Higher-order functions and common patterns for asynchronous code",
|
||||
"version": "0.1.23",
|
||||
"keywords": [],
|
||||
"dependencies": {},
|
||||
"development": {},
|
||||
"main": "lib/async.js",
|
||||
"scripts": [ "lib/async.js" ]
|
||||
}
|
||||
958
node_modules/async/lib/async.js
generated
vendored
Executable file
958
node_modules/async/lib/async.js
generated
vendored
Executable file
@@ -0,0 +1,958 @@
|
||||
/*global setImmediate: false, setTimeout: false, console: false */
|
||||
(function () {
|
||||
|
||||
var async = {};
|
||||
|
||||
// global on the server, window in the browser
|
||||
var root, previous_async;
|
||||
|
||||
root = this;
|
||||
if (root != null) {
|
||||
previous_async = root.async;
|
||||
}
|
||||
|
||||
async.noConflict = function () {
|
||||
root.async = previous_async;
|
||||
return async;
|
||||
};
|
||||
|
||||
function only_once(fn) {
|
||||
var called = false;
|
||||
return function() {
|
||||
if (called) throw new Error("Callback was already called.");
|
||||
called = true;
|
||||
fn.apply(root, arguments);
|
||||
}
|
||||
}
|
||||
|
||||
//// cross-browser compatiblity functions ////
|
||||
|
||||
var _each = function (arr, iterator) {
|
||||
if (arr.forEach) {
|
||||
return arr.forEach(iterator);
|
||||
}
|
||||
for (var i = 0; i < arr.length; i += 1) {
|
||||
iterator(arr[i], i, arr);
|
||||
}
|
||||
};
|
||||
|
||||
var _map = function (arr, iterator) {
|
||||
if (arr.map) {
|
||||
return arr.map(iterator);
|
||||
}
|
||||
var results = [];
|
||||
_each(arr, function (x, i, a) {
|
||||
results.push(iterator(x, i, a));
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
var _reduce = function (arr, iterator, memo) {
|
||||
if (arr.reduce) {
|
||||
return arr.reduce(iterator, memo);
|
||||
}
|
||||
_each(arr, function (x, i, a) {
|
||||
memo = iterator(memo, x, i, a);
|
||||
});
|
||||
return memo;
|
||||
};
|
||||
|
||||
var _keys = function (obj) {
|
||||
if (Object.keys) {
|
||||
return Object.keys(obj);
|
||||
}
|
||||
var keys = [];
|
||||
for (var k in obj) {
|
||||
if (obj.hasOwnProperty(k)) {
|
||||
keys.push(k);
|
||||
}
|
||||
}
|
||||
return keys;
|
||||
};
|
||||
|
||||
//// exported async module functions ////
|
||||
|
||||
//// nextTick implementation with browser-compatible fallback ////
|
||||
if (typeof process === 'undefined' || !(process.nextTick)) {
|
||||
if (typeof setImmediate === 'function') {
|
||||
async.nextTick = function (fn) {
|
||||
// not a direct alias for IE10 compatibility
|
||||
setImmediate(fn);
|
||||
};
|
||||
async.setImmediate = async.nextTick;
|
||||
}
|
||||
else {
|
||||
async.nextTick = function (fn) {
|
||||
setTimeout(fn, 0);
|
||||
};
|
||||
async.setImmediate = async.nextTick;
|
||||
}
|
||||
}
|
||||
else {
|
||||
async.nextTick = process.nextTick;
|
||||
if (typeof setImmediate !== 'undefined') {
|
||||
async.setImmediate = function (fn) {
|
||||
// not a direct alias for IE10 compatibility
|
||||
setImmediate(fn);
|
||||
};
|
||||
}
|
||||
else {
|
||||
async.setImmediate = async.nextTick;
|
||||
}
|
||||
}
|
||||
|
||||
async.each = function (arr, iterator, callback) {
|
||||
callback = callback || function () {};
|
||||
if (!arr.length) {
|
||||
return callback();
|
||||
}
|
||||
var completed = 0;
|
||||
_each(arr, function (x) {
|
||||
iterator(x, only_once(function (err) {
|
||||
if (err) {
|
||||
callback(err);
|
||||
callback = function () {};
|
||||
}
|
||||
else {
|
||||
completed += 1;
|
||||
if (completed >= arr.length) {
|
||||
callback(null);
|
||||
}
|
||||
}
|
||||
}));
|
||||
});
|
||||
};
|
||||
async.forEach = async.each;
|
||||
|
||||
async.eachSeries = function (arr, iterator, callback) {
|
||||
callback = callback || function () {};
|
||||
if (!arr.length) {
|
||||
return callback();
|
||||
}
|
||||
var completed = 0;
|
||||
var iterate = function () {
|
||||
iterator(arr[completed], function (err) {
|
||||
if (err) {
|
||||
callback(err);
|
||||
callback = function () {};
|
||||
}
|
||||
else {
|
||||
completed += 1;
|
||||
if (completed >= arr.length) {
|
||||
callback(null);
|
||||
}
|
||||
else {
|
||||
iterate();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
iterate();
|
||||
};
|
||||
async.forEachSeries = async.eachSeries;
|
||||
|
||||
async.eachLimit = function (arr, limit, iterator, callback) {
|
||||
var fn = _eachLimit(limit);
|
||||
fn.apply(null, [arr, iterator, callback]);
|
||||
};
|
||||
async.forEachLimit = async.eachLimit;
|
||||
|
||||
var _eachLimit = function (limit) {
|
||||
|
||||
return function (arr, iterator, callback) {
|
||||
callback = callback || function () {};
|
||||
if (!arr.length || limit <= 0) {
|
||||
return callback();
|
||||
}
|
||||
var completed = 0;
|
||||
var started = 0;
|
||||
var running = 0;
|
||||
|
||||
(function replenish () {
|
||||
if (completed >= arr.length) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
while (running < limit && started < arr.length) {
|
||||
started += 1;
|
||||
running += 1;
|
||||
iterator(arr[started - 1], function (err) {
|
||||
if (err) {
|
||||
callback(err);
|
||||
callback = function () {};
|
||||
}
|
||||
else {
|
||||
completed += 1;
|
||||
running -= 1;
|
||||
if (completed >= arr.length) {
|
||||
callback();
|
||||
}
|
||||
else {
|
||||
replenish();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})();
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
var doParallel = function (fn) {
|
||||
return function () {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
return fn.apply(null, [async.each].concat(args));
|
||||
};
|
||||
};
|
||||
var doParallelLimit = function(limit, fn) {
|
||||
return function () {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
return fn.apply(null, [_eachLimit(limit)].concat(args));
|
||||
};
|
||||
};
|
||||
var doSeries = function (fn) {
|
||||
return function () {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
return fn.apply(null, [async.eachSeries].concat(args));
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
var _asyncMap = function (eachfn, arr, iterator, callback) {
|
||||
var results = [];
|
||||
arr = _map(arr, function (x, i) {
|
||||
return {index: i, value: x};
|
||||
});
|
||||
eachfn(arr, function (x, callback) {
|
||||
iterator(x.value, function (err, v) {
|
||||
results[x.index] = v;
|
||||
callback(err);
|
||||
});
|
||||
}, function (err) {
|
||||
callback(err, results);
|
||||
});
|
||||
};
|
||||
async.map = doParallel(_asyncMap);
|
||||
async.mapSeries = doSeries(_asyncMap);
|
||||
async.mapLimit = function (arr, limit, iterator, callback) {
|
||||
return _mapLimit(limit)(arr, iterator, callback);
|
||||
};
|
||||
|
||||
var _mapLimit = function(limit) {
|
||||
return doParallelLimit(limit, _asyncMap);
|
||||
};
|
||||
|
||||
// reduce only has a series version, as doing reduce in parallel won't
|
||||
// work in many situations.
|
||||
async.reduce = function (arr, memo, iterator, callback) {
|
||||
async.eachSeries(arr, function (x, callback) {
|
||||
iterator(memo, x, function (err, v) {
|
||||
memo = v;
|
||||
callback(err);
|
||||
});
|
||||
}, function (err) {
|
||||
callback(err, memo);
|
||||
});
|
||||
};
|
||||
// inject alias
|
||||
async.inject = async.reduce;
|
||||
// foldl alias
|
||||
async.foldl = async.reduce;
|
||||
|
||||
async.reduceRight = function (arr, memo, iterator, callback) {
|
||||
var reversed = _map(arr, function (x) {
|
||||
return x;
|
||||
}).reverse();
|
||||
async.reduce(reversed, memo, iterator, callback);
|
||||
};
|
||||
// foldr alias
|
||||
async.foldr = async.reduceRight;
|
||||
|
||||
var _filter = function (eachfn, arr, iterator, callback) {
|
||||
var results = [];
|
||||
arr = _map(arr, function (x, i) {
|
||||
return {index: i, value: x};
|
||||
});
|
||||
eachfn(arr, function (x, callback) {
|
||||
iterator(x.value, function (v) {
|
||||
if (v) {
|
||||
results.push(x);
|
||||
}
|
||||
callback();
|
||||
});
|
||||
}, function (err) {
|
||||
callback(_map(results.sort(function (a, b) {
|
||||
return a.index - b.index;
|
||||
}), function (x) {
|
||||
return x.value;
|
||||
}));
|
||||
});
|
||||
};
|
||||
async.filter = doParallel(_filter);
|
||||
async.filterSeries = doSeries(_filter);
|
||||
// select alias
|
||||
async.select = async.filter;
|
||||
async.selectSeries = async.filterSeries;
|
||||
|
||||
var _reject = function (eachfn, arr, iterator, callback) {
|
||||
var results = [];
|
||||
arr = _map(arr, function (x, i) {
|
||||
return {index: i, value: x};
|
||||
});
|
||||
eachfn(arr, function (x, callback) {
|
||||
iterator(x.value, function (v) {
|
||||
if (!v) {
|
||||
results.push(x);
|
||||
}
|
||||
callback();
|
||||
});
|
||||
}, function (err) {
|
||||
callback(_map(results.sort(function (a, b) {
|
||||
return a.index - b.index;
|
||||
}), function (x) {
|
||||
return x.value;
|
||||
}));
|
||||
});
|
||||
};
|
||||
async.reject = doParallel(_reject);
|
||||
async.rejectSeries = doSeries(_reject);
|
||||
|
||||
var _detect = function (eachfn, arr, iterator, main_callback) {
|
||||
eachfn(arr, function (x, callback) {
|
||||
iterator(x, function (result) {
|
||||
if (result) {
|
||||
main_callback(x);
|
||||
main_callback = function () {};
|
||||
}
|
||||
else {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
}, function (err) {
|
||||
main_callback();
|
||||
});
|
||||
};
|
||||
async.detect = doParallel(_detect);
|
||||
async.detectSeries = doSeries(_detect);
|
||||
|
||||
async.some = function (arr, iterator, main_callback) {
|
||||
async.each(arr, function (x, callback) {
|
||||
iterator(x, function (v) {
|
||||
if (v) {
|
||||
main_callback(true);
|
||||
main_callback = function () {};
|
||||
}
|
||||
callback();
|
||||
});
|
||||
}, function (err) {
|
||||
main_callback(false);
|
||||
});
|
||||
};
|
||||
// any alias
|
||||
async.any = async.some;
|
||||
|
||||
async.every = function (arr, iterator, main_callback) {
|
||||
async.each(arr, function (x, callback) {
|
||||
iterator(x, function (v) {
|
||||
if (!v) {
|
||||
main_callback(false);
|
||||
main_callback = function () {};
|
||||
}
|
||||
callback();
|
||||
});
|
||||
}, function (err) {
|
||||
main_callback(true);
|
||||
});
|
||||
};
|
||||
// all alias
|
||||
async.all = async.every;
|
||||
|
||||
async.sortBy = function (arr, iterator, callback) {
|
||||
async.map(arr, function (x, callback) {
|
||||
iterator(x, function (err, criteria) {
|
||||
if (err) {
|
||||
callback(err);
|
||||
}
|
||||
else {
|
||||
callback(null, {value: x, criteria: criteria});
|
||||
}
|
||||
});
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
else {
|
||||
var fn = function (left, right) {
|
||||
var a = left.criteria, b = right.criteria;
|
||||
return a < b ? -1 : a > b ? 1 : 0;
|
||||
};
|
||||
callback(null, _map(results.sort(fn), function (x) {
|
||||
return x.value;
|
||||
}));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
async.auto = function (tasks, callback) {
|
||||
callback = callback || function () {};
|
||||
var keys = _keys(tasks);
|
||||
if (!keys.length) {
|
||||
return callback(null);
|
||||
}
|
||||
|
||||
var results = {};
|
||||
|
||||
var listeners = [];
|
||||
var addListener = function (fn) {
|
||||
listeners.unshift(fn);
|
||||
};
|
||||
var removeListener = function (fn) {
|
||||
for (var i = 0; i < listeners.length; i += 1) {
|
||||
if (listeners[i] === fn) {
|
||||
listeners.splice(i, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
var taskComplete = function () {
|
||||
_each(listeners.slice(0), function (fn) {
|
||||
fn();
|
||||
});
|
||||
};
|
||||
|
||||
addListener(function () {
|
||||
if (_keys(results).length === keys.length) {
|
||||
callback(null, results);
|
||||
callback = function () {};
|
||||
}
|
||||
});
|
||||
|
||||
_each(keys, function (k) {
|
||||
var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k];
|
||||
var taskCallback = function (err) {
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
if (args.length <= 1) {
|
||||
args = args[0];
|
||||
}
|
||||
if (err) {
|
||||
var safeResults = {};
|
||||
_each(_keys(results), function(rkey) {
|
||||
safeResults[rkey] = results[rkey];
|
||||
});
|
||||
safeResults[k] = args;
|
||||
callback(err, safeResults);
|
||||
// stop subsequent errors hitting callback multiple times
|
||||
callback = function () {};
|
||||
}
|
||||
else {
|
||||
results[k] = args;
|
||||
async.setImmediate(taskComplete);
|
||||
}
|
||||
};
|
||||
var requires = task.slice(0, Math.abs(task.length - 1)) || [];
|
||||
var ready = function () {
|
||||
return _reduce(requires, function (a, x) {
|
||||
return (a && results.hasOwnProperty(x));
|
||||
}, true) && !results.hasOwnProperty(k);
|
||||
};
|
||||
if (ready()) {
|
||||
task[task.length - 1](taskCallback, results);
|
||||
}
|
||||
else {
|
||||
var listener = function () {
|
||||
if (ready()) {
|
||||
removeListener(listener);
|
||||
task[task.length - 1](taskCallback, results);
|
||||
}
|
||||
};
|
||||
addListener(listener);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
async.waterfall = function (tasks, callback) {
|
||||
callback = callback || function () {};
|
||||
if (tasks.constructor !== Array) {
|
||||
var err = new Error('First argument to waterfall must be an array of functions');
|
||||
return callback(err);
|
||||
}
|
||||
if (!tasks.length) {
|
||||
return callback();
|
||||
}
|
||||
var wrapIterator = function (iterator) {
|
||||
return function (err) {
|
||||
if (err) {
|
||||
callback.apply(null, arguments);
|
||||
callback = function () {};
|
||||
}
|
||||
else {
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
var next = iterator.next();
|
||||
if (next) {
|
||||
args.push(wrapIterator(next));
|
||||
}
|
||||
else {
|
||||
args.push(callback);
|
||||
}
|
||||
async.setImmediate(function () {
|
||||
iterator.apply(null, args);
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
wrapIterator(async.iterator(tasks))();
|
||||
};
|
||||
|
||||
var _parallel = function(eachfn, tasks, callback) {
|
||||
callback = callback || function () {};
|
||||
if (tasks.constructor === Array) {
|
||||
eachfn.map(tasks, function (fn, callback) {
|
||||
if (fn) {
|
||||
fn(function (err) {
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
if (args.length <= 1) {
|
||||
args = args[0];
|
||||
}
|
||||
callback.call(null, err, args);
|
||||
});
|
||||
}
|
||||
}, callback);
|
||||
}
|
||||
else {
|
||||
var results = {};
|
||||
eachfn.each(_keys(tasks), function (k, callback) {
|
||||
tasks[k](function (err) {
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
if (args.length <= 1) {
|
||||
args = args[0];
|
||||
}
|
||||
results[k] = args;
|
||||
callback(err);
|
||||
});
|
||||
}, function (err) {
|
||||
callback(err, results);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
async.parallel = function (tasks, callback) {
|
||||
_parallel({ map: async.map, each: async.each }, tasks, callback);
|
||||
};
|
||||
|
||||
async.parallelLimit = function(tasks, limit, callback) {
|
||||
_parallel({ map: _mapLimit(limit), each: _eachLimit(limit) }, tasks, callback);
|
||||
};
|
||||
|
||||
async.series = function (tasks, callback) {
|
||||
callback = callback || function () {};
|
||||
if (tasks.constructor === Array) {
|
||||
async.mapSeries(tasks, function (fn, callback) {
|
||||
if (fn) {
|
||||
fn(function (err) {
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
if (args.length <= 1) {
|
||||
args = args[0];
|
||||
}
|
||||
callback.call(null, err, args);
|
||||
});
|
||||
}
|
||||
}, callback);
|
||||
}
|
||||
else {
|
||||
var results = {};
|
||||
async.eachSeries(_keys(tasks), function (k, callback) {
|
||||
tasks[k](function (err) {
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
if (args.length <= 1) {
|
||||
args = args[0];
|
||||
}
|
||||
results[k] = args;
|
||||
callback(err);
|
||||
});
|
||||
}, function (err) {
|
||||
callback(err, results);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
async.iterator = function (tasks) {
|
||||
var makeCallback = function (index) {
|
||||
var fn = function () {
|
||||
if (tasks.length) {
|
||||
tasks[index].apply(null, arguments);
|
||||
}
|
||||
return fn.next();
|
||||
};
|
||||
fn.next = function () {
|
||||
return (index < tasks.length - 1) ? makeCallback(index + 1): null;
|
||||
};
|
||||
return fn;
|
||||
};
|
||||
return makeCallback(0);
|
||||
};
|
||||
|
||||
async.apply = function (fn) {
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
return function () {
|
||||
return fn.apply(
|
||||
null, args.concat(Array.prototype.slice.call(arguments))
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
var _concat = function (eachfn, arr, fn, callback) {
|
||||
var r = [];
|
||||
eachfn(arr, function (x, cb) {
|
||||
fn(x, function (err, y) {
|
||||
r = r.concat(y || []);
|
||||
cb(err);
|
||||
});
|
||||
}, function (err) {
|
||||
callback(err, r);
|
||||
});
|
||||
};
|
||||
async.concat = doParallel(_concat);
|
||||
async.concatSeries = doSeries(_concat);
|
||||
|
||||
async.whilst = function (test, iterator, callback) {
|
||||
if (test()) {
|
||||
iterator(function (err) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
async.whilst(test, iterator, callback);
|
||||
});
|
||||
}
|
||||
else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
|
||||
async.doWhilst = function (iterator, test, callback) {
|
||||
iterator(function (err) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
if (test()) {
|
||||
async.doWhilst(iterator, test, callback);
|
||||
}
|
||||
else {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
async.until = function (test, iterator, callback) {
|
||||
if (!test()) {
|
||||
iterator(function (err) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
async.until(test, iterator, callback);
|
||||
});
|
||||
}
|
||||
else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
|
||||
async.doUntil = function (iterator, test, callback) {
|
||||
iterator(function (err) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
if (!test()) {
|
||||
async.doUntil(iterator, test, callback);
|
||||
}
|
||||
else {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
async.queue = function (worker, concurrency) {
|
||||
if (concurrency === undefined) {
|
||||
concurrency = 1;
|
||||
}
|
||||
function _insert(q, data, pos, callback) {
|
||||
if(data.constructor !== Array) {
|
||||
data = [data];
|
||||
}
|
||||
_each(data, function(task) {
|
||||
var item = {
|
||||
data: task,
|
||||
callback: typeof callback === 'function' ? callback : null
|
||||
};
|
||||
|
||||
if (pos) {
|
||||
q.tasks.unshift(item);
|
||||
} else {
|
||||
q.tasks.push(item);
|
||||
}
|
||||
|
||||
if (q.saturated && q.tasks.length === concurrency) {
|
||||
q.saturated();
|
||||
}
|
||||
async.setImmediate(q.process);
|
||||
});
|
||||
}
|
||||
|
||||
var workers = 0;
|
||||
var q = {
|
||||
tasks: [],
|
||||
concurrency: concurrency,
|
||||
saturated: null,
|
||||
empty: null,
|
||||
drain: null,
|
||||
push: function (data, callback) {
|
||||
_insert(q, data, false, callback);
|
||||
},
|
||||
unshift: function (data, callback) {
|
||||
_insert(q, data, true, callback);
|
||||
},
|
||||
process: function () {
|
||||
if (workers < q.concurrency && q.tasks.length) {
|
||||
var task = q.tasks.shift();
|
||||
if (q.empty && q.tasks.length === 0) {
|
||||
q.empty();
|
||||
}
|
||||
workers += 1;
|
||||
var next = function () {
|
||||
workers -= 1;
|
||||
if (task.callback) {
|
||||
task.callback.apply(task, arguments);
|
||||
}
|
||||
if (q.drain && q.tasks.length + workers === 0) {
|
||||
q.drain();
|
||||
}
|
||||
q.process();
|
||||
};
|
||||
var cb = only_once(next);
|
||||
worker(task.data, cb);
|
||||
}
|
||||
},
|
||||
length: function () {
|
||||
return q.tasks.length;
|
||||
},
|
||||
running: function () {
|
||||
return workers;
|
||||
}
|
||||
};
|
||||
return q;
|
||||
};
|
||||
|
||||
async.cargo = function (worker, payload) {
|
||||
var working = false,
|
||||
tasks = [];
|
||||
|
||||
var cargo = {
|
||||
tasks: tasks,
|
||||
payload: payload,
|
||||
saturated: null,
|
||||
empty: null,
|
||||
drain: null,
|
||||
push: function (data, callback) {
|
||||
if(data.constructor !== Array) {
|
||||
data = [data];
|
||||
}
|
||||
_each(data, function(task) {
|
||||
tasks.push({
|
||||
data: task,
|
||||
callback: typeof callback === 'function' ? callback : null
|
||||
});
|
||||
if (cargo.saturated && tasks.length === payload) {
|
||||
cargo.saturated();
|
||||
}
|
||||
});
|
||||
async.setImmediate(cargo.process);
|
||||
},
|
||||
process: function process() {
|
||||
if (working) return;
|
||||
if (tasks.length === 0) {
|
||||
if(cargo.drain) cargo.drain();
|
||||
return;
|
||||
}
|
||||
|
||||
var ts = typeof payload === 'number'
|
||||
? tasks.splice(0, payload)
|
||||
: tasks.splice(0);
|
||||
|
||||
var ds = _map(ts, function (task) {
|
||||
return task.data;
|
||||
});
|
||||
|
||||
if(cargo.empty) cargo.empty();
|
||||
working = true;
|
||||
worker(ds, function () {
|
||||
working = false;
|
||||
|
||||
var args = arguments;
|
||||
_each(ts, function (data) {
|
||||
if (data.callback) {
|
||||
data.callback.apply(null, args);
|
||||
}
|
||||
});
|
||||
|
||||
process();
|
||||
});
|
||||
},
|
||||
length: function () {
|
||||
return tasks.length;
|
||||
},
|
||||
running: function () {
|
||||
return working;
|
||||
}
|
||||
};
|
||||
return cargo;
|
||||
};
|
||||
|
||||
var _console_fn = function (name) {
|
||||
return function (fn) {
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
fn.apply(null, args.concat([function (err) {
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
if (typeof console !== 'undefined') {
|
||||
if (err) {
|
||||
if (console.error) {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
else if (console[name]) {
|
||||
_each(args, function (x) {
|
||||
console[name](x);
|
||||
});
|
||||
}
|
||||
}
|
||||
}]));
|
||||
};
|
||||
};
|
||||
async.log = _console_fn('log');
|
||||
async.dir = _console_fn('dir');
|
||||
/*async.info = _console_fn('info');
|
||||
async.warn = _console_fn('warn');
|
||||
async.error = _console_fn('error');*/
|
||||
|
||||
async.memoize = function (fn, hasher) {
|
||||
var memo = {};
|
||||
var queues = {};
|
||||
hasher = hasher || function (x) {
|
||||
return x;
|
||||
};
|
||||
var memoized = function () {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
var callback = args.pop();
|
||||
var key = hasher.apply(null, args);
|
||||
if (key in memo) {
|
||||
callback.apply(null, memo[key]);
|
||||
}
|
||||
else if (key in queues) {
|
||||
queues[key].push(callback);
|
||||
}
|
||||
else {
|
||||
queues[key] = [callback];
|
||||
fn.apply(null, args.concat([function () {
|
||||
memo[key] = arguments;
|
||||
var q = queues[key];
|
||||
delete queues[key];
|
||||
for (var i = 0, l = q.length; i < l; i++) {
|
||||
q[i].apply(null, arguments);
|
||||
}
|
||||
}]));
|
||||
}
|
||||
};
|
||||
memoized.memo = memo;
|
||||
memoized.unmemoized = fn;
|
||||
return memoized;
|
||||
};
|
||||
|
||||
async.unmemoize = function (fn) {
|
||||
return function () {
|
||||
return (fn.unmemoized || fn).apply(null, arguments);
|
||||
};
|
||||
};
|
||||
|
||||
async.times = function (count, iterator, callback) {
|
||||
var counter = [];
|
||||
for (var i = 0; i < count; i++) {
|
||||
counter.push(i);
|
||||
}
|
||||
return async.map(counter, iterator, callback);
|
||||
};
|
||||
|
||||
async.timesSeries = function (count, iterator, callback) {
|
||||
var counter = [];
|
||||
for (var i = 0; i < count; i++) {
|
||||
counter.push(i);
|
||||
}
|
||||
return async.mapSeries(counter, iterator, callback);
|
||||
};
|
||||
|
||||
async.compose = function (/* functions... */) {
|
||||
var fns = Array.prototype.reverse.call(arguments);
|
||||
return function () {
|
||||
var that = this;
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
var callback = args.pop();
|
||||
async.reduce(fns, args, function (newargs, fn, cb) {
|
||||
fn.apply(that, newargs.concat([function () {
|
||||
var err = arguments[0];
|
||||
var nextargs = Array.prototype.slice.call(arguments, 1);
|
||||
cb(err, nextargs);
|
||||
}]))
|
||||
},
|
||||
function (err, results) {
|
||||
callback.apply(that, [err].concat(results));
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var _applyEach = function (eachfn, fns /*args...*/) {
|
||||
var go = function () {
|
||||
var that = this;
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
var callback = args.pop();
|
||||
return eachfn(fns, function (fn, cb) {
|
||||
fn.apply(that, args.concat([cb]));
|
||||
},
|
||||
callback);
|
||||
};
|
||||
if (arguments.length > 2) {
|
||||
var args = Array.prototype.slice.call(arguments, 2);
|
||||
return go.apply(this, args);
|
||||
}
|
||||
else {
|
||||
return go;
|
||||
}
|
||||
};
|
||||
async.applyEach = doParallel(_applyEach);
|
||||
async.applyEachSeries = doSeries(_applyEach);
|
||||
|
||||
async.forever = function (fn, callback) {
|
||||
function next(err) {
|
||||
if (err) {
|
||||
if (callback) {
|
||||
return callback(err);
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
fn(next);
|
||||
}
|
||||
next();
|
||||
};
|
||||
|
||||
// AMD / RequireJS
|
||||
if (typeof define !== 'undefined' && define.amd) {
|
||||
define([], function () {
|
||||
return async;
|
||||
});
|
||||
}
|
||||
// Node.js
|
||||
else if (typeof module !== 'undefined' && module.exports) {
|
||||
module.exports = async;
|
||||
}
|
||||
// included directly via <script> tag
|
||||
else {
|
||||
root.async = async;
|
||||
}
|
||||
|
||||
}());
|
||||
87
node_modules/async/package.json
generated
vendored
Normal file
87
node_modules/async/package.json
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"async@0.2.x",
|
||||
"/home/mywebsite/node_modules/winston"
|
||||
]
|
||||
],
|
||||
"_from": "async@>=0.2.0 <0.3.0",
|
||||
"_id": "async@0.2.10",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/async",
|
||||
"_npmUser": {
|
||||
"email": "caolan.mcmahon@gmail.com",
|
||||
"name": "caolan"
|
||||
},
|
||||
"_npmVersion": "1.3.2",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "async",
|
||||
"raw": "async@0.2.x",
|
||||
"rawSpec": "0.2.x",
|
||||
"scope": null,
|
||||
"spec": ">=0.2.0 <0.3.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/utile",
|
||||
"/winston"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz",
|
||||
"_shasum": "b6bbe0b0674b9d719708ca38de8c237cb526c3d1",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "async@0.2.x",
|
||||
"_where": "/home/mywebsite/node_modules/winston",
|
||||
"author": {
|
||||
"name": "Caolan McMahon"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/caolan/async/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Higher-order functions and common patterns for asynchronous code",
|
||||
"devDependencies": {
|
||||
"nodelint": ">0.0.0",
|
||||
"nodeunit": ">0.0.0",
|
||||
"uglify-js": "1.2.x"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "b6bbe0b0674b9d719708ca38de8c237cb526c3d1",
|
||||
"tarball": "http://registry.npmjs.org/async/-/async-0.2.10.tgz"
|
||||
},
|
||||
"homepage": "https://github.com/caolan/async#readme",
|
||||
"jam": {
|
||||
"include": [
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"lib/async.js"
|
||||
],
|
||||
"main": "lib/async.js"
|
||||
},
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "https://github.com/caolan/async/raw/master/LICENSE"
|
||||
}
|
||||
],
|
||||
"main": "./lib/async",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "caolan",
|
||||
"email": "caolan@caolanmcmahon.com"
|
||||
}
|
||||
],
|
||||
"name": "async",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/caolan/async.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "nodeunit test/test-async.js"
|
||||
},
|
||||
"version": "0.2.10"
|
||||
}
|
||||
@@ -1 +1,2 @@
|
||||
node_modules
|
||||
.DS_Store
|
||||
21
node_modules/balanced-match/LICENSE.md
generated
vendored
Normal file
21
node_modules/balanced-match/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
(MIT)
|
||||
|
||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
||||
|
||||
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.
|
||||
6
node_modules/balanced-match/Makefile
generated
vendored
Normal file
6
node_modules/balanced-match/Makefile
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
test:
|
||||
@node_modules/.bin/tape test/*.js
|
||||
|
||||
.PHONY: test
|
||||
|
||||
89
node_modules/balanced-match/README.md
generated
vendored
Normal file
89
node_modules/balanced-match/README.md
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
# balanced-match
|
||||
|
||||
Match balanced string pairs, like `{` and `}` or `<b>` and `</b>`.
|
||||
|
||||
[](http://travis-ci.org/juliangruber/balanced-match)
|
||||
[](https://www.npmjs.org/package/balanced-match)
|
||||
|
||||
[](https://ci.testling.com/juliangruber/balanced-match)
|
||||
|
||||
## Example
|
||||
|
||||
Get the first matching pair of braces:
|
||||
|
||||
```js
|
||||
var balanced = require('balanced-match');
|
||||
|
||||
console.log(balanced('{', '}', 'pre{in{nested}}post'));
|
||||
console.log(balanced('{', '}', 'pre{first}between{second}post'));
|
||||
```
|
||||
|
||||
The matches are:
|
||||
|
||||
```bash
|
||||
$ node example.js
|
||||
{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' }
|
||||
{ start: 3,
|
||||
end: 9,
|
||||
pre: 'pre',
|
||||
body: 'first',
|
||||
post: 'between{second}post' }
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### var m = balanced(a, b, str)
|
||||
|
||||
For the first non-nested matching pair of `a` and `b` in `str`, return an
|
||||
object with those keys:
|
||||
|
||||
* **start** the index of the first match of `a`
|
||||
* **end** the index of the matching `b`
|
||||
* **pre** the preamble, `a` and `b` not included
|
||||
* **body** the match, `a` and `b` not included
|
||||
* **post** the postscript, `a` and `b` not included
|
||||
|
||||
If there's no match, `undefined` will be returned.
|
||||
|
||||
If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']`.
|
||||
|
||||
### var r = balanced.range(a, b, str)
|
||||
|
||||
For the first non-nested matching pair of `a` and `b` in `str`, return an
|
||||
array with indexes: `[ <a index>, <b index> ]`.
|
||||
|
||||
If there's no match, `undefined` will be returned.
|
||||
|
||||
If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]`.
|
||||
|
||||
## Installation
|
||||
|
||||
With [npm](https://npmjs.org) do:
|
||||
|
||||
```bash
|
||||
npm install balanced-match
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
(MIT)
|
||||
|
||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
||||
|
||||
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.
|
||||
5
node_modules/balanced-match/example.js
generated
vendored
Normal file
5
node_modules/balanced-match/example.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
var balanced = require('./');
|
||||
|
||||
console.log(balanced('{', '}', 'pre{in{nested}}post'));
|
||||
console.log(balanced('{', '}', 'pre{first}between{second}post'));
|
||||
|
||||
50
node_modules/balanced-match/index.js
generated
vendored
Normal file
50
node_modules/balanced-match/index.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
module.exports = balanced;
|
||||
function balanced(a, b, str) {
|
||||
var r = range(a, b, str);
|
||||
|
||||
return r && {
|
||||
start: r[0],
|
||||
end: r[1],
|
||||
pre: str.slice(0, r[0]),
|
||||
body: str.slice(r[0] + a.length, r[1]),
|
||||
post: str.slice(r[1] + b.length)
|
||||
};
|
||||
}
|
||||
|
||||
balanced.range = range;
|
||||
function range(a, b, str) {
|
||||
var begs, beg, left, right, result;
|
||||
var ai = str.indexOf(a);
|
||||
var bi = str.indexOf(b, ai + 1);
|
||||
var i = ai;
|
||||
|
||||
if (ai >= 0 && bi > 0) {
|
||||
begs = [];
|
||||
left = str.length;
|
||||
|
||||
while (i < str.length && i >= 0 && ! result) {
|
||||
if (i == ai) {
|
||||
begs.push(i);
|
||||
ai = str.indexOf(a, i + 1);
|
||||
} else if (begs.length == 1) {
|
||||
result = [ begs.pop(), bi ];
|
||||
} else {
|
||||
beg = begs.pop();
|
||||
if (beg < left) {
|
||||
left = beg;
|
||||
right = bi;
|
||||
}
|
||||
|
||||
bi = str.indexOf(b, i + 1);
|
||||
}
|
||||
|
||||
i = ai < bi && ai >= 0 ? ai : bi;
|
||||
}
|
||||
|
||||
if (begs.length) {
|
||||
result = [ left, right ];
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
98
node_modules/balanced-match/package.json
generated
vendored
Normal file
98
node_modules/balanced-match/package.json
generated
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"balanced-match@^0.3.0",
|
||||
"/home/mywebsite/node_modules/brace-expansion"
|
||||
]
|
||||
],
|
||||
"_from": "balanced-match@>=0.3.0 <0.4.0",
|
||||
"_id": "balanced-match@0.3.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/balanced-match",
|
||||
"_nodeVersion": "4.2.1",
|
||||
"_npmUser": {
|
||||
"email": "julian@juliangruber.com",
|
||||
"name": "juliangruber"
|
||||
},
|
||||
"_npmVersion": "2.14.7",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "balanced-match",
|
||||
"raw": "balanced-match@^0.3.0",
|
||||
"rawSpec": "^0.3.0",
|
||||
"scope": null,
|
||||
"spec": ">=0.3.0 <0.4.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/brace-expansion"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.3.0.tgz",
|
||||
"_shasum": "a91cdd1ebef1a86659e70ff4def01625fc2d6756",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "balanced-match@^0.3.0",
|
||||
"_where": "/home/mywebsite/node_modules/brace-expansion",
|
||||
"author": {
|
||||
"email": "mail@juliangruber.com",
|
||||
"name": "Julian Gruber",
|
||||
"url": "http://juliangruber.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/juliangruber/balanced-match/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Match balanced character pairs, like \"{\" and \"}\"",
|
||||
"devDependencies": {
|
||||
"tape": "~4.2.2"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "a91cdd1ebef1a86659e70ff4def01625fc2d6756",
|
||||
"tarball": "http://registry.npmjs.org/balanced-match/-/balanced-match-0.3.0.tgz"
|
||||
},
|
||||
"gitHead": "a7114b0986554787e90b7ac595a043ca75ea77e5",
|
||||
"homepage": "https://github.com/juliangruber/balanced-match",
|
||||
"keywords": [
|
||||
"balanced",
|
||||
"match",
|
||||
"parse",
|
||||
"regexp",
|
||||
"test"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "juliangruber",
|
||||
"email": "julian@juliangruber.com"
|
||||
}
|
||||
],
|
||||
"name": "balanced-match",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/juliangruber/balanced-match.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "make test"
|
||||
},
|
||||
"testling": {
|
||||
"browsers": [
|
||||
"android-browser/4.2..latest",
|
||||
"chrome/25..latest",
|
||||
"chrome/canary",
|
||||
"firefox/20..latest",
|
||||
"firefox/nightly",
|
||||
"ie/8..latest",
|
||||
"ipad/6.0..latest",
|
||||
"iphone/6.0..latest",
|
||||
"opera/12..latest",
|
||||
"opera/next",
|
||||
"safari/5.1..latest"
|
||||
],
|
||||
"files": "test/*.js"
|
||||
},
|
||||
"version": "0.3.0"
|
||||
}
|
||||
84
node_modules/balanced-match/test/balanced.js
generated
vendored
Normal file
84
node_modules/balanced-match/test/balanced.js
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
var test = require('tape');
|
||||
var balanced = require('..');
|
||||
|
||||
test('balanced', function(t) {
|
||||
t.deepEqual(balanced('{', '}', 'pre{in{nest}}post'), {
|
||||
start: 3,
|
||||
end: 12,
|
||||
pre: 'pre',
|
||||
body: 'in{nest}',
|
||||
post: 'post'
|
||||
});
|
||||
t.deepEqual(balanced('{', '}', '{{{{{{{{{in}post'), {
|
||||
start: 8,
|
||||
end: 11,
|
||||
pre: '{{{{{{{{',
|
||||
body: 'in',
|
||||
post: 'post'
|
||||
});
|
||||
t.deepEqual(balanced('{', '}', 'pre{body{in}post'), {
|
||||
start: 8,
|
||||
end: 11,
|
||||
pre: 'pre{body',
|
||||
body: 'in',
|
||||
post: 'post'
|
||||
});
|
||||
t.deepEqual(balanced('{', '}', 'pre}{in{nest}}post'), {
|
||||
start: 4,
|
||||
end: 13,
|
||||
pre: 'pre}',
|
||||
body: 'in{nest}',
|
||||
post: 'post'
|
||||
});
|
||||
t.deepEqual(balanced('{', '}', 'pre{body}between{body2}post'), {
|
||||
start: 3,
|
||||
end: 8,
|
||||
pre: 'pre',
|
||||
body: 'body',
|
||||
post: 'between{body2}post'
|
||||
});
|
||||
t.notOk(balanced('{', '}', 'nope'), 'should be notOk');
|
||||
t.deepEqual(balanced('<b>', '</b>', 'pre<b>in<b>nest</b></b>post'), {
|
||||
start: 3,
|
||||
end: 19,
|
||||
pre: 'pre',
|
||||
body: 'in<b>nest</b>',
|
||||
post: 'post'
|
||||
});
|
||||
t.deepEqual(balanced('<b>', '</b>', 'pre</b><b>in<b>nest</b></b>post'), {
|
||||
start: 7,
|
||||
end: 23,
|
||||
pre: 'pre</b>',
|
||||
body: 'in<b>nest</b>',
|
||||
post: 'post'
|
||||
});
|
||||
t.deepEqual(balanced('{{', '}}', 'pre{{{in}}}post'), {
|
||||
start: 3,
|
||||
end: 9,
|
||||
pre: 'pre',
|
||||
body: '{in}',
|
||||
post: 'post'
|
||||
});
|
||||
t.deepEqual(balanced('{{{', '}}', 'pre{{{in}}}post'), {
|
||||
start: 3,
|
||||
end: 8,
|
||||
pre: 'pre',
|
||||
body: 'in',
|
||||
post: '}post'
|
||||
});
|
||||
t.deepEqual(balanced('{', '}', 'pre{{first}in{second}post'), {
|
||||
start: 4,
|
||||
end: 10,
|
||||
pre: 'pre{',
|
||||
body: 'first',
|
||||
post: 'in{second}post'
|
||||
});
|
||||
t.deepEqual(balanced('<?', '?>', 'pre<?>post'), {
|
||||
start: 3,
|
||||
end: 4,
|
||||
pre: 'pre',
|
||||
body: '',
|
||||
post: 'post'
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
188
node_modules/binary-extensions/binary-extensions.json
generated
vendored
Normal file
188
node_modules/binary-extensions/binary-extensions.json
generated
vendored
Normal file
@@ -0,0 +1,188 @@
|
||||
[
|
||||
"3ds",
|
||||
"3g2",
|
||||
"3gp",
|
||||
"7z",
|
||||
"a",
|
||||
"aac",
|
||||
"adp",
|
||||
"ai",
|
||||
"aif",
|
||||
"apk",
|
||||
"ar",
|
||||
"asf",
|
||||
"au",
|
||||
"avi",
|
||||
"bak",
|
||||
"bin",
|
||||
"bk",
|
||||
"bmp",
|
||||
"btif",
|
||||
"bz2",
|
||||
"cab",
|
||||
"caf",
|
||||
"cgm",
|
||||
"cmx",
|
||||
"cpio",
|
||||
"cr2",
|
||||
"dat",
|
||||
"deb",
|
||||
"djvu",
|
||||
"dll",
|
||||
"dmg",
|
||||
"dng",
|
||||
"doc",
|
||||
"docx",
|
||||
"dra",
|
||||
"DS_Store",
|
||||
"dsk",
|
||||
"dts",
|
||||
"dtshd",
|
||||
"dvb",
|
||||
"dwg",
|
||||
"dxf",
|
||||
"ecelp4800",
|
||||
"ecelp7470",
|
||||
"ecelp9600",
|
||||
"egg",
|
||||
"eol",
|
||||
"eot",
|
||||
"epub",
|
||||
"exe",
|
||||
"f4v",
|
||||
"fbs",
|
||||
"fh",
|
||||
"fla",
|
||||
"flac",
|
||||
"fli",
|
||||
"flv",
|
||||
"fpx",
|
||||
"fst",
|
||||
"fvt",
|
||||
"g3",
|
||||
"gif",
|
||||
"gz",
|
||||
"h261",
|
||||
"h263",
|
||||
"h264",
|
||||
"ico",
|
||||
"ief",
|
||||
"img",
|
||||
"ipa",
|
||||
"iso",
|
||||
"jar",
|
||||
"jpeg",
|
||||
"jpg",
|
||||
"jpgv",
|
||||
"jpm",
|
||||
"jxr",
|
||||
"ktx",
|
||||
"lvp",
|
||||
"lz",
|
||||
"lzma",
|
||||
"lzo",
|
||||
"m3u",
|
||||
"m4a",
|
||||
"m4v",
|
||||
"mar",
|
||||
"mdi",
|
||||
"mid",
|
||||
"mj2",
|
||||
"mka",
|
||||
"mkv",
|
||||
"mmr",
|
||||
"mng",
|
||||
"mov",
|
||||
"movie",
|
||||
"mp3",
|
||||
"mp4",
|
||||
"mp4a",
|
||||
"mpeg",
|
||||
"mpg",
|
||||
"mpga",
|
||||
"mxu",
|
||||
"nef",
|
||||
"npx",
|
||||
"o",
|
||||
"oga",
|
||||
"ogg",
|
||||
"ogv",
|
||||
"otf",
|
||||
"pbm",
|
||||
"pcx",
|
||||
"pdf",
|
||||
"pea",
|
||||
"pgm",
|
||||
"pic",
|
||||
"png",
|
||||
"pnm",
|
||||
"ppm",
|
||||
"psd",
|
||||
"pya",
|
||||
"pyc",
|
||||
"pyo",
|
||||
"pyv",
|
||||
"qt",
|
||||
"rar",
|
||||
"ras",
|
||||
"raw",
|
||||
"rgb",
|
||||
"rip",
|
||||
"rlc",
|
||||
"rz",
|
||||
"s3m",
|
||||
"s7z",
|
||||
"scpt",
|
||||
"sgi",
|
||||
"shar",
|
||||
"sil",
|
||||
"smv",
|
||||
"so",
|
||||
"sub",
|
||||
"swf",
|
||||
"tar",
|
||||
"tbz2",
|
||||
"tga",
|
||||
"tgz",
|
||||
"tif",
|
||||
"tiff",
|
||||
"tlz",
|
||||
"ts",
|
||||
"ttf",
|
||||
"uvh",
|
||||
"uvi",
|
||||
"uvm",
|
||||
"uvp",
|
||||
"uvs",
|
||||
"uvu",
|
||||
"viv",
|
||||
"vob",
|
||||
"war",
|
||||
"wav",
|
||||
"wax",
|
||||
"wbmp",
|
||||
"wdp",
|
||||
"weba",
|
||||
"webm",
|
||||
"webp",
|
||||
"whl",
|
||||
"wm",
|
||||
"wma",
|
||||
"wmv",
|
||||
"wmx",
|
||||
"woff",
|
||||
"woff2",
|
||||
"wvx",
|
||||
"xbm",
|
||||
"xif",
|
||||
"xls",
|
||||
"xlsx",
|
||||
"xm",
|
||||
"xpi",
|
||||
"xpm",
|
||||
"xwd",
|
||||
"xz",
|
||||
"z",
|
||||
"zip",
|
||||
"zipx"
|
||||
]
|
||||
21
node_modules/binary-extensions/license
generated
vendored
Normal file
21
node_modules/binary-extensions/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
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.
|
||||
104
node_modules/binary-extensions/package.json
generated
vendored
Normal file
104
node_modules/binary-extensions/package.json
generated
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"binary-extensions@^1.0.0",
|
||||
"/home/mywebsite/node_modules/is-binary-path"
|
||||
]
|
||||
],
|
||||
"_from": "binary-extensions@>=1.0.0 <2.0.0",
|
||||
"_id": "binary-extensions@1.4.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/binary-extensions",
|
||||
"_nodeVersion": "4.2.1",
|
||||
"_npmUser": {
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"name": "sindresorhus"
|
||||
},
|
||||
"_npmVersion": "2.14.7",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "binary-extensions",
|
||||
"raw": "binary-extensions@^1.0.0",
|
||||
"rawSpec": "^1.0.0",
|
||||
"scope": null,
|
||||
"spec": ">=1.0.0 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/is-binary-path"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.4.0.tgz",
|
||||
"_shasum": "d733ccb628986d7b326d88656e0ddbd3aac351b7",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "binary-extensions@^1.0.0",
|
||||
"_where": "/home/mywebsite/node_modules/is-binary-path",
|
||||
"author": {
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"name": "Sindre Sorhus",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/binary-extensions/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "List of binary file extensions",
|
||||
"devDependencies": {
|
||||
"ava": "0.0.4"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "d733ccb628986d7b326d88656e0ddbd3aac351b7",
|
||||
"tarball": "http://registry.npmjs.org/binary-extensions/-/binary-extensions-1.4.0.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"binary-extensions.json"
|
||||
],
|
||||
"gitHead": "8c3a781127ff15ee516c8bedda97807e4dddf1ff",
|
||||
"homepage": "https://github.com/sindresorhus/binary-extensions",
|
||||
"keywords": [
|
||||
"array",
|
||||
"bin",
|
||||
"binary",
|
||||
"ext",
|
||||
"extension",
|
||||
"extensions",
|
||||
"file",
|
||||
"json",
|
||||
"list"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "binary-extensions.json",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "paulmillr",
|
||||
"email": "paul@paulmillr.com"
|
||||
},
|
||||
{
|
||||
"name": "es128",
|
||||
"email": "elan.shanker+npm@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "arthurvr",
|
||||
"email": "contact@arthurverschaeve.be"
|
||||
}
|
||||
],
|
||||
"name": "binary-extensions",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/binary-extensions.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node test.js"
|
||||
},
|
||||
"version": "1.4.0"
|
||||
}
|
||||
33
node_modules/binary-extensions/readme.md
generated
vendored
Normal file
33
node_modules/binary-extensions/readme.md
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
# binary-extensions [](https://travis-ci.org/sindresorhus/binary-extensions)
|
||||
|
||||
> List of binary file extensions
|
||||
|
||||
The list is just a [JSON file](binary-extensions.json) and can be used wherever.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save binary-extensions
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var binaryExtensions = require('binary-extensions');
|
||||
|
||||
console.log(binaryExtensions);
|
||||
//=> ['3ds', '3g2', ...]
|
||||
```
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [`is-binary-path`](https://github.com/sindresorhus/is-binary-path) - Check if a filepath is a binary file
|
||||
- [`text-extensions`](https://github.com/sindresorhus/text-extensions) - List of text file extensions
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
||||
3
node_modules/brace-expansion/.npmignore
generated
vendored
Normal file
3
node_modules/brace-expansion/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
test
|
||||
.gitignore
|
||||
.travis.yml
|
||||
122
node_modules/brace-expansion/README.md
generated
vendored
Normal file
122
node_modules/brace-expansion/README.md
generated
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
# brace-expansion
|
||||
|
||||
[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html),
|
||||
as known from sh/bash, in JavaScript.
|
||||
|
||||
[](http://travis-ci.org/juliangruber/brace-expansion)
|
||||
[](https://www.npmjs.org/package/brace-expansion)
|
||||
|
||||
[](https://ci.testling.com/juliangruber/brace-expansion)
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var expand = require('brace-expansion');
|
||||
|
||||
expand('file-{a,b,c}.jpg')
|
||||
// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
|
||||
|
||||
expand('-v{,,}')
|
||||
// => ['-v', '-v', '-v']
|
||||
|
||||
expand('file{0..2}.jpg')
|
||||
// => ['file0.jpg', 'file1.jpg', 'file2.jpg']
|
||||
|
||||
expand('file-{a..c}.jpg')
|
||||
// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
|
||||
|
||||
expand('file{2..0}.jpg')
|
||||
// => ['file2.jpg', 'file1.jpg', 'file0.jpg']
|
||||
|
||||
expand('file{0..4..2}.jpg')
|
||||
// => ['file0.jpg', 'file2.jpg', 'file4.jpg']
|
||||
|
||||
expand('file-{a..e..2}.jpg')
|
||||
// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg']
|
||||
|
||||
expand('file{00..10..5}.jpg')
|
||||
// => ['file00.jpg', 'file05.jpg', 'file10.jpg']
|
||||
|
||||
expand('{{A..C},{a..c}}')
|
||||
// => ['A', 'B', 'C', 'a', 'b', 'c']
|
||||
|
||||
expand('ppp{,config,oe{,conf}}')
|
||||
// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf']
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var expand = require('brace-expansion');
|
||||
```
|
||||
|
||||
### var expanded = expand(str)
|
||||
|
||||
Return an array of all possible and valid expansions of `str`. If none are
|
||||
found, `[str]` is returned.
|
||||
|
||||
Valid expansions are:
|
||||
|
||||
```js
|
||||
/^(.*,)+(.+)?$/
|
||||
// {a,b,...}
|
||||
```
|
||||
|
||||
A comma seperated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`.
|
||||
|
||||
```js
|
||||
/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
|
||||
// {x..y[..incr]}
|
||||
```
|
||||
|
||||
A numeric sequence from `x` to `y` inclusive, with optional increment.
|
||||
If `x` or `y` start with a leading `0`, all the numbers will be padded
|
||||
to have equal length. Negative numbers and backwards iteration work too.
|
||||
|
||||
```js
|
||||
/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
|
||||
// {x..y[..incr]}
|
||||
```
|
||||
|
||||
An alphabetic sequence from `x` to `y` inclusive, with optional increment.
|
||||
`x` and `y` must be exactly one character, and if given, `incr` must be a
|
||||
number.
|
||||
|
||||
For compatibility reasons, the string `${` is not eligible for brace expansion.
|
||||
|
||||
## Installation
|
||||
|
||||
With [npm](https://npmjs.org) do:
|
||||
|
||||
```bash
|
||||
npm install brace-expansion
|
||||
```
|
||||
|
||||
## Contributors
|
||||
|
||||
- [Julian Gruber](https://github.com/juliangruber)
|
||||
- [Isaac Z. Schlueter](https://github.com/isaacs)
|
||||
|
||||
## License
|
||||
|
||||
(MIT)
|
||||
|
||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
||||
|
||||
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.
|
||||
8
node_modules/brace-expansion/example.js
generated
vendored
Normal file
8
node_modules/brace-expansion/example.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
var expand = require('./');
|
||||
|
||||
console.log(expand('http://any.org/archive{1996..1999}/vol{1..4}/part{a,b,c}.html'));
|
||||
console.log(expand('http://www.numericals.com/file{1..100..10}.txt'));
|
||||
console.log(expand('http://www.letters.com/file{a..z..2}.txt'));
|
||||
console.log(expand('mkdir /usr/local/src/bash/{old,new,dist,bugs}'));
|
||||
console.log(expand('chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}}'));
|
||||
|
||||
191
node_modules/brace-expansion/index.js
generated
vendored
Normal file
191
node_modules/brace-expansion/index.js
generated
vendored
Normal file
@@ -0,0 +1,191 @@
|
||||
var concatMap = require('concat-map');
|
||||
var balanced = require('balanced-match');
|
||||
|
||||
module.exports = expandTop;
|
||||
|
||||
var escSlash = '\0SLASH'+Math.random()+'\0';
|
||||
var escOpen = '\0OPEN'+Math.random()+'\0';
|
||||
var escClose = '\0CLOSE'+Math.random()+'\0';
|
||||
var escComma = '\0COMMA'+Math.random()+'\0';
|
||||
var escPeriod = '\0PERIOD'+Math.random()+'\0';
|
||||
|
||||
function numeric(str) {
|
||||
return parseInt(str, 10) == str
|
||||
? parseInt(str, 10)
|
||||
: str.charCodeAt(0);
|
||||
}
|
||||
|
||||
function escapeBraces(str) {
|
||||
return str.split('\\\\').join(escSlash)
|
||||
.split('\\{').join(escOpen)
|
||||
.split('\\}').join(escClose)
|
||||
.split('\\,').join(escComma)
|
||||
.split('\\.').join(escPeriod);
|
||||
}
|
||||
|
||||
function unescapeBraces(str) {
|
||||
return str.split(escSlash).join('\\')
|
||||
.split(escOpen).join('{')
|
||||
.split(escClose).join('}')
|
||||
.split(escComma).join(',')
|
||||
.split(escPeriod).join('.');
|
||||
}
|
||||
|
||||
|
||||
// Basically just str.split(","), but handling cases
|
||||
// where we have nested braced sections, which should be
|
||||
// treated as individual members, like {a,{b,c},d}
|
||||
function parseCommaParts(str) {
|
||||
if (!str)
|
||||
return [''];
|
||||
|
||||
var parts = [];
|
||||
var m = balanced('{', '}', str);
|
||||
|
||||
if (!m)
|
||||
return str.split(',');
|
||||
|
||||
var pre = m.pre;
|
||||
var body = m.body;
|
||||
var post = m.post;
|
||||
var p = pre.split(',');
|
||||
|
||||
p[p.length-1] += '{' + body + '}';
|
||||
var postParts = parseCommaParts(post);
|
||||
if (post.length) {
|
||||
p[p.length-1] += postParts.shift();
|
||||
p.push.apply(p, postParts);
|
||||
}
|
||||
|
||||
parts.push.apply(parts, p);
|
||||
|
||||
return parts;
|
||||
}
|
||||
|
||||
function expandTop(str) {
|
||||
if (!str)
|
||||
return [];
|
||||
|
||||
return expand(escapeBraces(str), true).map(unescapeBraces);
|
||||
}
|
||||
|
||||
function identity(e) {
|
||||
return e;
|
||||
}
|
||||
|
||||
function embrace(str) {
|
||||
return '{' + str + '}';
|
||||
}
|
||||
function isPadded(el) {
|
||||
return /^-?0\d/.test(el);
|
||||
}
|
||||
|
||||
function lte(i, y) {
|
||||
return i <= y;
|
||||
}
|
||||
function gte(i, y) {
|
||||
return i >= y;
|
||||
}
|
||||
|
||||
function expand(str, isTop) {
|
||||
var expansions = [];
|
||||
|
||||
var m = balanced('{', '}', str);
|
||||
if (!m || /\$$/.test(m.pre)) return [str];
|
||||
|
||||
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
||||
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
||||
var isSequence = isNumericSequence || isAlphaSequence;
|
||||
var isOptions = /^(.*,)+(.+)?$/.test(m.body);
|
||||
if (!isSequence && !isOptions) {
|
||||
// {a},b}
|
||||
if (m.post.match(/,.*}/)) {
|
||||
str = m.pre + '{' + m.body + escClose + m.post;
|
||||
return expand(str);
|
||||
}
|
||||
return [str];
|
||||
}
|
||||
|
||||
var n;
|
||||
if (isSequence) {
|
||||
n = m.body.split(/\.\./);
|
||||
} else {
|
||||
n = parseCommaParts(m.body);
|
||||
if (n.length === 1) {
|
||||
// x{{a,b}}y ==> x{a}y x{b}y
|
||||
n = expand(n[0], false).map(embrace);
|
||||
if (n.length === 1) {
|
||||
var post = m.post.length
|
||||
? expand(m.post, false)
|
||||
: [''];
|
||||
return post.map(function(p) {
|
||||
return m.pre + n[0] + p;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// at this point, n is the parts, and we know it's not a comma set
|
||||
// with a single entry.
|
||||
|
||||
// no need to expand pre, since it is guaranteed to be free of brace-sets
|
||||
var pre = m.pre;
|
||||
var post = m.post.length
|
||||
? expand(m.post, false)
|
||||
: [''];
|
||||
|
||||
var N;
|
||||
|
||||
if (isSequence) {
|
||||
var x = numeric(n[0]);
|
||||
var y = numeric(n[1]);
|
||||
var width = Math.max(n[0].length, n[1].length)
|
||||
var incr = n.length == 3
|
||||
? Math.abs(numeric(n[2]))
|
||||
: 1;
|
||||
var test = lte;
|
||||
var reverse = y < x;
|
||||
if (reverse) {
|
||||
incr *= -1;
|
||||
test = gte;
|
||||
}
|
||||
var pad = n.some(isPadded);
|
||||
|
||||
N = [];
|
||||
|
||||
for (var i = x; test(i, y); i += incr) {
|
||||
var c;
|
||||
if (isAlphaSequence) {
|
||||
c = String.fromCharCode(i);
|
||||
if (c === '\\')
|
||||
c = '';
|
||||
} else {
|
||||
c = String(i);
|
||||
if (pad) {
|
||||
var need = width - c.length;
|
||||
if (need > 0) {
|
||||
var z = new Array(need + 1).join('0');
|
||||
if (i < 0)
|
||||
c = '-' + z + c.slice(1);
|
||||
else
|
||||
c = z + c;
|
||||
}
|
||||
}
|
||||
}
|
||||
N.push(c);
|
||||
}
|
||||
} else {
|
||||
N = concatMap(n, function(el) { return expand(el, false) });
|
||||
}
|
||||
|
||||
for (var j = 0; j < N.length; j++) {
|
||||
for (var k = 0; k < post.length; k++) {
|
||||
var expansion = pre + N[j] + post[k];
|
||||
if (!isTop || isSequence || expansion)
|
||||
expansions.push(expansion);
|
||||
}
|
||||
}
|
||||
|
||||
return expansions;
|
||||
}
|
||||
|
||||
100
node_modules/brace-expansion/package.json
generated
vendored
Normal file
100
node_modules/brace-expansion/package.json
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"brace-expansion@^1.0.0",
|
||||
"/home/mywebsite/node_modules/minimatch"
|
||||
]
|
||||
],
|
||||
"_from": "brace-expansion@>=1.0.0 <2.0.0",
|
||||
"_id": "brace-expansion@1.1.2",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/brace-expansion",
|
||||
"_nodeVersion": "4.2.1",
|
||||
"_npmUser": {
|
||||
"email": "julian@juliangruber.com",
|
||||
"name": "juliangruber"
|
||||
},
|
||||
"_npmVersion": "2.14.7",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "brace-expansion",
|
||||
"raw": "brace-expansion@^1.0.0",
|
||||
"rawSpec": "^1.0.0",
|
||||
"scope": null,
|
||||
"spec": ">=1.0.0 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/minimatch"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.2.tgz",
|
||||
"_shasum": "f21445d0488b658e2771efd870eff51df29f04ef",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "brace-expansion@^1.0.0",
|
||||
"_where": "/home/mywebsite/node_modules/minimatch",
|
||||
"author": {
|
||||
"email": "mail@juliangruber.com",
|
||||
"name": "Julian Gruber",
|
||||
"url": "http://juliangruber.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/juliangruber/brace-expansion/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"balanced-match": "^0.3.0",
|
||||
"concat-map": "0.0.1"
|
||||
},
|
||||
"description": "Brace expansion as known from sh/bash",
|
||||
"devDependencies": {
|
||||
"tape": "4.2.2"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "f21445d0488b658e2771efd870eff51df29f04ef",
|
||||
"tarball": "http://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.2.tgz"
|
||||
},
|
||||
"gitHead": "b03773a30fa516b1374945b68e9acb6253d595fa",
|
||||
"homepage": "https://github.com/juliangruber/brace-expansion",
|
||||
"keywords": [],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "juliangruber",
|
||||
"email": "julian@juliangruber.com"
|
||||
},
|
||||
{
|
||||
"name": "isaacs",
|
||||
"email": "isaacs@npmjs.com"
|
||||
}
|
||||
],
|
||||
"name": "brace-expansion",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/juliangruber/brace-expansion.git"
|
||||
},
|
||||
"scripts": {
|
||||
"gentest": "bash test/generate.sh",
|
||||
"test": "tape test/*.js"
|
||||
},
|
||||
"testling": {
|
||||
"browsers": [
|
||||
"android-browser/4.2..latest",
|
||||
"chrome/25..latest",
|
||||
"chrome/canary",
|
||||
"firefox/20..latest",
|
||||
"firefox/nightly",
|
||||
"ie/8..latest",
|
||||
"ipad/6.0..latest",
|
||||
"iphone/6.0..latest",
|
||||
"opera/12..latest",
|
||||
"opera/next",
|
||||
"safari/5.1..latest"
|
||||
],
|
||||
"files": "test/*.js"
|
||||
},
|
||||
"version": "1.1.2"
|
||||
}
|
||||
24
node_modules/braces/LICENSE
generated
vendored
Normal file
24
node_modules/braces/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2015, Jon Schlinkert.
|
||||
|
||||
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.
|
||||
230
node_modules/braces/README.md
generated
vendored
Normal file
230
node_modules/braces/README.md
generated
vendored
Normal file
@@ -0,0 +1,230 @@
|
||||
# braces [](http://badge.fury.io/js/braces)
|
||||
|
||||
> Fastest brace expansion for node.js, with the most complete support for the Bash 4.3 braces specification.
|
||||
|
||||
* Complete support for the braces part of the [Bash 4.3 Brace Expansion](www.gnu.org/software/bash/). Braces passes [all of the relevant unit tests](#bash-4-3-support) from the spec.
|
||||
* Expands comma-separated values: `a/{b,c}/d` => `['a/b/d', 'a/c/d']`
|
||||
* Expands alphabetical or numerical ranges: `{1..3}` => `['1', '2', '3']`
|
||||
* [Very fast](#benchmarks)
|
||||
* [Special characters](./patterns.md) can be used to generate interesting patterns.
|
||||
|
||||
Install with [npm](https://www.npmjs.com/)
|
||||
|
||||
```sh
|
||||
$ npm i braces --save
|
||||
```
|
||||
|
||||
## Example usage
|
||||
|
||||
```js
|
||||
var braces = require('braces');
|
||||
|
||||
braces('a/{x,y}/c{d}e')
|
||||
//=> ['a/x/cde', 'a/y/cde']
|
||||
|
||||
braces('a/b/c/{x,y}')
|
||||
//=> ['a/b/c/x', 'a/b/c/y']
|
||||
|
||||
braces('a/{x,{1..5},y}/c{d}e')
|
||||
//=> ['a/x/cde', 'a/1/cde', 'a/y/cde', 'a/2/cde', 'a/3/cde', 'a/4/cde', 'a/5/cde']
|
||||
```
|
||||
|
||||
### Pro tip!
|
||||
|
||||
> Use braces to generate test fixtures!
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
var braces = require('./');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
|
||||
braces('blah/{a..z}.js').forEach(function(fp) {
|
||||
if (!fs.existsSync(path.dirname(fp))) {
|
||||
fs.mkdirSync(path.dirname(fp));
|
||||
}
|
||||
fs.writeFileSync(fp, '');
|
||||
});
|
||||
```
|
||||
|
||||
See the [tests](./test/test.js) for more examples and use cases (also see the [bash spec tests](./test/bash-mm-adjusted.js));
|
||||
|
||||
### Range expansion
|
||||
|
||||
Uses [expand-range](https://github.com/jonschlinkert/expand-range) for range expansion.
|
||||
|
||||
```js
|
||||
braces('a{1..3}b')
|
||||
//=> ['a1b', 'a2b', 'a3b']
|
||||
|
||||
braces('a{5..8}b')
|
||||
//=> ['a5b', 'a6b', 'a7b', 'a8b']
|
||||
|
||||
braces('a{00..05}b')
|
||||
//=> ['a00b', 'a01b', 'a02b', 'a03b', 'a04b', 'a05b']
|
||||
|
||||
braces('a{01..03}b')
|
||||
//=> ['a01b', 'a02b', 'a03b']
|
||||
|
||||
braces('a{000..005}b')
|
||||
//=> ['a000b', 'a001b', 'a002b', 'a003b', 'a004b', 'a005b']
|
||||
|
||||
braces('a{a..e}b')
|
||||
//=> ['aab', 'abb', 'acb', 'adb', 'aeb']
|
||||
|
||||
braces('a{A..E}b')
|
||||
//=> ['aAb', 'aBb', 'aCb', 'aDb', 'aEb']
|
||||
```
|
||||
|
||||
Pass a function as the last argument to customize range expansions:
|
||||
|
||||
```js
|
||||
var range = braces('x{a..e}y', function (str, i) {
|
||||
return String.fromCharCode(str) + i;
|
||||
});
|
||||
|
||||
console.log(range);
|
||||
//=> ['xa0y', 'xb1y', 'xc2y', 'xd3y', 'xe4y']
|
||||
```
|
||||
|
||||
See [expand-range](https://github.com/jonschlinkert/expand-range)for benchmarks, tests and the full list of range expansion features.
|
||||
|
||||
## Options
|
||||
|
||||
### options.makeRe
|
||||
|
||||
Type: `Boolean`
|
||||
|
||||
Deafault: `false`
|
||||
|
||||
Return a regex-optimal string. If you're using braces to generate regex, this will result in dramatically faster performance.
|
||||
|
||||
**Examples**
|
||||
|
||||
With the default settings (`{makeRe: false}`):
|
||||
|
||||
```js
|
||||
braces('{1..5}');
|
||||
//=> ['1', '2', '3', '4', '5']
|
||||
```
|
||||
|
||||
With `{makeRe: true}`:
|
||||
|
||||
```js
|
||||
braces('{1..5}', {makeRe: true});
|
||||
//=> ['[1-5]']
|
||||
|
||||
braces('{3..9..3}', {makeRe: true});
|
||||
//=> ['(3|6|9)']
|
||||
```
|
||||
|
||||
### options.bash
|
||||
|
||||
Type: `Boolean`
|
||||
|
||||
Default: `false`
|
||||
|
||||
Enables complete support for the Bash specification. The downside is a 20-25% speed decrease.
|
||||
|
||||
**Example**
|
||||
|
||||
Using the default setting (`{bash: false}`):
|
||||
|
||||
```js
|
||||
braces('a{b}c');
|
||||
//=> ['abc']
|
||||
```
|
||||
|
||||
In bash (and minimatch), braces with one item are not expanded. To get the same result with braces, set `{bash: true}`:
|
||||
|
||||
```js
|
||||
braces('a{b}c', {bash: true});
|
||||
//=> ['a{b}c']
|
||||
```
|
||||
|
||||
### options.nodupes
|
||||
|
||||
Type: `Boolean`
|
||||
|
||||
Deafault: `true`
|
||||
|
||||
Duplicates are removed by default. To keep duplicates, pass `{nodupes: false}` on the options
|
||||
|
||||
## Bash 4.3 Support
|
||||
|
||||
> Better support for Bash 4.3 than minimatch
|
||||
|
||||
This project has comprehensive unit tests, including tests coverted from [Bash 4.3](www.gnu.org/software/bash/). Currently only 8 of 102 unit tests fail, and
|
||||
|
||||
## Run benchmarks
|
||||
|
||||
Install dev dependencies:
|
||||
|
||||
```bash
|
||||
npm i -d && npm benchmark
|
||||
```
|
||||
|
||||
```bash
|
||||
#1: escape.js
|
||||
brace-expansion.js x 114,934 ops/sec ±1.24% (93 runs sampled)
|
||||
braces.js x 342,254 ops/sec ±0.84% (90 runs sampled)
|
||||
|
||||
#2: exponent.js
|
||||
brace-expansion.js x 12,359 ops/sec ±0.86% (96 runs sampled)
|
||||
braces.js x 20,389 ops/sec ±0.71% (97 runs sampled)
|
||||
|
||||
#3: multiple.js
|
||||
brace-expansion.js x 114,469 ops/sec ±1.44% (94 runs sampled)
|
||||
braces.js x 401,621 ops/sec ±0.87% (91 runs sampled)
|
||||
|
||||
#4: nested.js
|
||||
brace-expansion.js x 102,769 ops/sec ±1.55% (92 runs sampled)
|
||||
braces.js x 314,088 ops/sec ±0.71% (98 runs sampled)
|
||||
|
||||
#5: normal.js
|
||||
brace-expansion.js x 157,577 ops/sec ±1.65% (91 runs sampled)
|
||||
braces.js x 1,115,950 ops/sec ±0.74% (94 runs sampled)
|
||||
|
||||
#6: range.js
|
||||
brace-expansion.js x 138,822 ops/sec ±1.71% (91 runs sampled)
|
||||
braces.js x 1,108,353 ops/sec ±0.85% (94 runs sampled)
|
||||
```
|
||||
|
||||
## Run tests
|
||||
|
||||
Install dev dependencies:
|
||||
|
||||
```bash
|
||||
npm i -d && npm test
|
||||
```
|
||||
|
||||
## Related
|
||||
|
||||
* [micromatch](https://github.com/jonschlinkert/micromatch): wildcard/glob matcher for javascript. a faster alternative to minimatch.
|
||||
* [fill-range](https://github.com/jonschlinkert/fill-range): Fill in a range of numbers or letters, optionally passing an increment or multiplier to use
|
||||
* [expand-range](https://github.com/jonschlinkert/expand-range): Wraps fill-range for fast, bash-like range expansion in strings. Expand a range of numbers or letters, uppercase or lowercase
|
||||
|
||||
## Contributing
|
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/braces/issues).
|
||||
|
||||
Please run benchmarks before and after any code changes to what the impact of the code changes are before submitting a PR.
|
||||
|
||||
## Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
+ [github/jonschlinkert](https://github.com/jonschlinkert)
|
||||
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
|
||||
|
||||
## License
|
||||
|
||||
Copyright © 2014-2015 Jon Schlinkert
|
||||
Released under the MIT license.
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 19, 2015._
|
||||
|
||||
<!-- deps:mocha -->
|
||||
399
node_modules/braces/index.js
generated
vendored
Normal file
399
node_modules/braces/index.js
generated
vendored
Normal file
@@ -0,0 +1,399 @@
|
||||
/*!
|
||||
* braces <https://github.com/jonschlinkert/braces>
|
||||
*
|
||||
* Copyright (c) 2014-2015, Jon Schlinkert.
|
||||
* Licensed under the MIT license.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependencies
|
||||
*/
|
||||
|
||||
var expand = require('expand-range');
|
||||
var repeat = require('repeat-element');
|
||||
var tokens = require('preserve');
|
||||
|
||||
/**
|
||||
* Expose `braces`
|
||||
*/
|
||||
|
||||
module.exports = function (str, options) {
|
||||
if (typeof str !== 'string') {
|
||||
throw new Error('braces expects a string');
|
||||
}
|
||||
return braces(str, options);
|
||||
};
|
||||
|
||||
/**
|
||||
* Expand `{foo,bar}` or `{1..5}` braces in the
|
||||
* given `string`.
|
||||
*
|
||||
* @param {String} `str`
|
||||
* @param {Array} `arr`
|
||||
* @param {Object} `options`
|
||||
* @return {Array}
|
||||
*/
|
||||
|
||||
function braces(str, arr, options) {
|
||||
if (str === '') {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (!Array.isArray(arr)) {
|
||||
options = arr;
|
||||
arr = [];
|
||||
}
|
||||
|
||||
var opts = options || {};
|
||||
arr = arr || [];
|
||||
|
||||
if (typeof opts.nodupes === 'undefined') {
|
||||
opts.nodupes = true;
|
||||
}
|
||||
|
||||
var fn = opts.fn;
|
||||
var es6;
|
||||
|
||||
if (typeof opts === 'function') {
|
||||
fn = opts;
|
||||
opts = {};
|
||||
}
|
||||
|
||||
if (!(patternRe instanceof RegExp)) {
|
||||
patternRe = patternRegex();
|
||||
}
|
||||
|
||||
var matches = str.match(patternRe) || [];
|
||||
var m = matches[0];
|
||||
|
||||
switch(m) {
|
||||
case '\\,':
|
||||
return escapeCommas(str, arr, opts);
|
||||
case '\\.':
|
||||
return escapeDots(str, arr, opts);
|
||||
case '\/.':
|
||||
return escapePaths(str, arr, opts);
|
||||
case ' ':
|
||||
return splitWhitespace(str);
|
||||
case '{,}':
|
||||
return exponential(str, opts, braces);
|
||||
case '{}':
|
||||
return emptyBraces(str, arr, opts);
|
||||
case '\\{':
|
||||
case '\\}':
|
||||
return escapeBraces(str, arr, opts);
|
||||
case '${':
|
||||
if (!/\{[^{]+\{/.test(str)) {
|
||||
return arr.concat(str);
|
||||
} else {
|
||||
es6 = true;
|
||||
str = tokens.before(str, es6Regex());
|
||||
}
|
||||
}
|
||||
|
||||
if (!(braceRe instanceof RegExp)) {
|
||||
braceRe = braceRegex();
|
||||
}
|
||||
|
||||
var match = braceRe.exec(str);
|
||||
if (match == null) {
|
||||
return [str];
|
||||
}
|
||||
|
||||
var outter = match[1];
|
||||
var inner = match[2];
|
||||
if (inner === '') { return [str]; }
|
||||
|
||||
var segs, segsLength;
|
||||
|
||||
if (inner.indexOf('..') !== -1) {
|
||||
segs = expand(inner, opts, fn) || inner.split(',');
|
||||
segsLength = segs.length;
|
||||
|
||||
} else if (inner[0] === '"' || inner[0] === '\'') {
|
||||
return arr.concat(str.split(/['"]/).join(''));
|
||||
|
||||
} else {
|
||||
segs = inner.split(',');
|
||||
if (opts.makeRe) {
|
||||
return braces(str.replace(outter, wrap(segs, '|')), opts);
|
||||
}
|
||||
|
||||
segsLength = segs.length;
|
||||
if (segsLength === 1 && opts.bash) {
|
||||
segs[0] = wrap(segs[0], '\\');
|
||||
}
|
||||
}
|
||||
|
||||
var len = segs.length;
|
||||
var i = 0, val;
|
||||
|
||||
while (len--) {
|
||||
var path = segs[i++];
|
||||
|
||||
if (/(\.[^.\/])/.test(path)) {
|
||||
if (segsLength > 1) {
|
||||
return segs;
|
||||
} else {
|
||||
return [str];
|
||||
}
|
||||
}
|
||||
|
||||
val = splice(str, outter, path);
|
||||
|
||||
if (/\{[^{}]+?\}/.test(val)) {
|
||||
arr = braces(val, arr, opts);
|
||||
} else if (val !== '') {
|
||||
if (opts.nodupes && arr.indexOf(val) !== -1) { continue; }
|
||||
arr.push(es6 ? tokens.after(val) : val);
|
||||
}
|
||||
}
|
||||
|
||||
if (opts.strict) { return filter(arr, filterEmpty); }
|
||||
return arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expand exponential ranges
|
||||
*
|
||||
* `a{,}{,}` => ['a', 'a', 'a', 'a']
|
||||
*/
|
||||
|
||||
function exponential(str, options, fn) {
|
||||
if (typeof options === 'function') {
|
||||
fn = options;
|
||||
options = null;
|
||||
}
|
||||
|
||||
var opts = options || {};
|
||||
var esc = '__ESC_EXP__';
|
||||
var exp = 0;
|
||||
var res;
|
||||
|
||||
var parts = str.split('{,}');
|
||||
if (opts.nodupes) {
|
||||
return fn(parts.join(''), opts);
|
||||
}
|
||||
|
||||
exp = parts.length - 1;
|
||||
res = fn(parts.join(esc), opts);
|
||||
var len = res.length;
|
||||
var arr = [];
|
||||
var i = 0;
|
||||
|
||||
while (len--) {
|
||||
var ele = res[i++];
|
||||
var idx = ele.indexOf(esc);
|
||||
|
||||
if (idx === -1) {
|
||||
arr.push(ele);
|
||||
|
||||
} else {
|
||||
ele = ele.split('__ESC_EXP__').join('');
|
||||
if (!!ele && opts.nodupes !== false) {
|
||||
arr.push(ele);
|
||||
|
||||
} else {
|
||||
var num = Math.pow(2, exp);
|
||||
arr.push.apply(arr, repeat(ele, num));
|
||||
}
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap a value with parens, brackets or braces,
|
||||
* based on the given character/separator.
|
||||
*
|
||||
* @param {String|Array} `val`
|
||||
* @param {String} `ch`
|
||||
* @return {String}
|
||||
*/
|
||||
|
||||
function wrap(val, ch) {
|
||||
if (ch === '|') {
|
||||
return '(' + val.join(ch) + ')';
|
||||
}
|
||||
if (ch === ',') {
|
||||
return '{' + val.join(ch) + '}';
|
||||
}
|
||||
if (ch === '-') {
|
||||
return '[' + val.join(ch) + ']';
|
||||
}
|
||||
if (ch === '\\') {
|
||||
return '\\{' + val + '\\}';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle empty braces: `{}`
|
||||
*/
|
||||
|
||||
function emptyBraces(str, arr, opts) {
|
||||
return braces(str.split('{}').join('\\{\\}'), arr, opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter out empty-ish values
|
||||
*/
|
||||
|
||||
function filterEmpty(ele) {
|
||||
return !!ele && ele !== '\\';
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle patterns with whitespace
|
||||
*/
|
||||
|
||||
function splitWhitespace(str) {
|
||||
var segs = str.split(' ');
|
||||
var len = segs.length;
|
||||
var res = [];
|
||||
var i = 0;
|
||||
|
||||
while (len--) {
|
||||
res.push.apply(res, braces(segs[i++]));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle escaped braces: `\\{foo,bar}`
|
||||
*/
|
||||
|
||||
function escapeBraces(str, arr, opts) {
|
||||
if (!/\{[^{]+\{/.test(str)) {
|
||||
return arr.concat(str.split('\\').join(''));
|
||||
} else {
|
||||
str = str.split('\\{').join('__LT_BRACE__');
|
||||
str = str.split('\\}').join('__RT_BRACE__');
|
||||
return map(braces(str, arr, opts), function (ele) {
|
||||
ele = ele.split('__LT_BRACE__').join('{');
|
||||
return ele.split('__RT_BRACE__').join('}');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle escaped dots: `{1\\.2}`
|
||||
*/
|
||||
|
||||
function escapeDots(str, arr, opts) {
|
||||
if (!/[^\\]\..+\\\./.test(str)) {
|
||||
return arr.concat(str.split('\\').join(''));
|
||||
} else {
|
||||
str = str.split('\\.').join('__ESC_DOT__');
|
||||
return map(braces(str, arr, opts), function (ele) {
|
||||
return ele.split('__ESC_DOT__').join('.');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle escaped dots: `{1\\.2}`
|
||||
*/
|
||||
|
||||
function escapePaths(str, arr, opts) {
|
||||
str = str.split('\/.').join('__ESC_PATH__');
|
||||
return map(braces(str, arr, opts), function (ele) {
|
||||
return ele.split('__ESC_PATH__').join('\/.');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle escaped commas: `{a\\,b}`
|
||||
*/
|
||||
|
||||
function escapeCommas(str, arr, opts) {
|
||||
if (!/\w,/.test(str)) {
|
||||
return arr.concat(str.split('\\').join(''));
|
||||
} else {
|
||||
str = str.split('\\,').join('__ESC_COMMA__');
|
||||
return map(braces(str, arr, opts), function (ele) {
|
||||
return ele.split('__ESC_COMMA__').join(',');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Regex for common patterns
|
||||
*/
|
||||
|
||||
function patternRegex() {
|
||||
return /\$\{|[ \t]|{}|{,}|\\,(?=.*[{}])|\/\.(?=.*[{}])|\\\.(?={)|\\{|\\}/;
|
||||
}
|
||||
|
||||
/**
|
||||
* Braces regex.
|
||||
*/
|
||||
|
||||
function braceRegex() {
|
||||
return /.*(\\?\{([^}]+)\})/;
|
||||
}
|
||||
|
||||
/**
|
||||
* es6 delimiter regex.
|
||||
*/
|
||||
|
||||
function es6Regex() {
|
||||
return /\$\{([^}]+)\}/;
|
||||
}
|
||||
|
||||
var braceRe;
|
||||
var patternRe;
|
||||
|
||||
/**
|
||||
* Faster alternative to `String.replace()` when the
|
||||
* index of the token to be replaces can't be supplied
|
||||
*/
|
||||
|
||||
function splice(str, token, replacement) {
|
||||
var i = str.indexOf(token);
|
||||
return str.substr(0, i) + replacement
|
||||
+ str.substr(i + token.length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fast array map
|
||||
*/
|
||||
|
||||
function map(arr, fn) {
|
||||
if (arr == null) {
|
||||
return [];
|
||||
}
|
||||
|
||||
var len = arr.length;
|
||||
var res = new Array(len);
|
||||
var i = -1;
|
||||
|
||||
while (++i < len) {
|
||||
res[i] = fn(arr[i], i, arr);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fast array filter
|
||||
*/
|
||||
|
||||
function filter(arr, cb) {
|
||||
if (arr == null) return [];
|
||||
if (typeof cb !== 'function') {
|
||||
throw new TypeError('braces: filter expects a callback function.');
|
||||
}
|
||||
|
||||
var len = arr.length;
|
||||
var res = arr.slice();
|
||||
var i = 0;
|
||||
|
||||
while (len--) {
|
||||
if (!cb(arr[len], i++)) {
|
||||
res.splice(len, 1);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
122
node_modules/braces/package.json
generated
vendored
Normal file
122
node_modules/braces/package.json
generated
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"braces@^1.8.2",
|
||||
"/home/mywebsite/node_modules/micromatch"
|
||||
]
|
||||
],
|
||||
"_from": "braces@>=1.8.2 <2.0.0",
|
||||
"_id": "braces@1.8.3",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/braces",
|
||||
"_nodeVersion": "5.0.0",
|
||||
"_npmUser": {
|
||||
"email": "github@sellside.com",
|
||||
"name": "jonschlinkert"
|
||||
},
|
||||
"_npmVersion": "3.3.6",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "braces",
|
||||
"raw": "braces@^1.8.2",
|
||||
"rawSpec": "^1.8.2",
|
||||
"scope": null,
|
||||
"spec": ">=1.8.2 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/micromatch"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/braces/-/braces-1.8.3.tgz",
|
||||
"_shasum": "35d4e7dda632b33e215d38a8a9cf4329c9c75d2c",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "braces@^1.8.2",
|
||||
"_where": "/home/mywebsite/node_modules/micromatch",
|
||||
"author": {
|
||||
"name": "Jon Schlinkert",
|
||||
"url": "https://github.com/jonschlinkert"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/braces/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"expand-range": "^1.8.1",
|
||||
"preserve": "^0.2.0",
|
||||
"repeat-element": "^1.1.2"
|
||||
},
|
||||
"description": "Fastest brace expansion for node.js, with the most complete support for the Bash 4.3 braces specification.",
|
||||
"devDependencies": {
|
||||
"benchmarked": "^0.1.3",
|
||||
"brace-expansion": "^1.1.0",
|
||||
"chalk": "^0.5.1",
|
||||
"minimatch": "^2.0.1",
|
||||
"minimist": "^1.1.0",
|
||||
"mocha": "*",
|
||||
"should": "*"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "35d4e7dda632b33e215d38a8a9cf4329c9c75d2c",
|
||||
"tarball": "http://registry.npmjs.org/braces/-/braces-1.8.3.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"utils.js"
|
||||
],
|
||||
"gitHead": "9ab31c0dbf663ad08a7d9519286858f24e2ea9ac",
|
||||
"homepage": "https://github.com/jonschlinkert/braces",
|
||||
"keywords": [
|
||||
"alpha",
|
||||
"alphabetical",
|
||||
"bash",
|
||||
"brace",
|
||||
"expand",
|
||||
"expansion",
|
||||
"filepath",
|
||||
"fill",
|
||||
"fs",
|
||||
"glob",
|
||||
"globbing",
|
||||
"letter",
|
||||
"match",
|
||||
"matches",
|
||||
"matching",
|
||||
"number",
|
||||
"numerical",
|
||||
"path",
|
||||
"range",
|
||||
"ranges",
|
||||
"sh"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "jonschlinkert",
|
||||
"email": "github@sellside.com"
|
||||
},
|
||||
{
|
||||
"name": "es128",
|
||||
"email": "elan.shanker+npm@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "doowb",
|
||||
"email": "brian.woodward@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "braces",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jonschlinkert/braces.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"version": "1.8.3"
|
||||
}
|
||||
4
node_modules/broadway/.npmignore
generated
vendored
Normal file
4
node_modules/broadway/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
node_modules
|
||||
npm-debug.log
|
||||
.DS_Store
|
||||
|
||||
10
node_modules/broadway/.travis.yml
generated
vendored
Normal file
10
node_modules/broadway/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
language: node_js
|
||||
|
||||
node_js:
|
||||
- "0.8"
|
||||
- "0.10"
|
||||
notifications:
|
||||
email:
|
||||
- travis@nodejitsu.com
|
||||
irc: "irc.freenode.org#nodejitsu"
|
||||
|
||||
19
node_modules/broadway/LICENSE
generated
vendored
Normal file
19
node_modules/broadway/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2011 Nodejitsu Inc.
|
||||
|
||||
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.
|
||||
124
node_modules/broadway/README.md
generated
vendored
Normal file
124
node_modules/broadway/README.md
generated
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
# broadway [](http://travis-ci.org/flatiron/broadway)
|
||||
|
||||
*Lightweight application extensibility and composition with a twist of feature
|
||||
reflection.*
|
||||
|
||||
## Example
|
||||
|
||||
### app.js
|
||||
```js
|
||||
var broadway = require("broadway");
|
||||
|
||||
var app = new broadway.App();
|
||||
|
||||
// Passes the second argument to `helloworld.attach`.
|
||||
app.use(require("./plugins/helloworld"), { "delimiter": "!" } );
|
||||
|
||||
app.init(function (err) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
|
||||
app.hello("world");
|
||||
```
|
||||
|
||||
### plugins/helloworld.js
|
||||
|
||||
```js
|
||||
// `exports.attach` gets called by broadway on `app.use`
|
||||
exports.attach = function (options) {
|
||||
|
||||
this.hello = function (world) {
|
||||
console.log("Hello "+ world + options.delimiter || ".");
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
// `exports.init` gets called by broadway on `app.init`.
|
||||
exports.init = function (done) {
|
||||
|
||||
// This plugin doesn't require any initialization step.
|
||||
return done();
|
||||
|
||||
};
|
||||
```
|
||||
|
||||
### run it!
|
||||
|
||||
```bash
|
||||
josh@onix:~/dev/broadway/examples$ node simple/app.js
|
||||
Hello world!
|
||||
josh@onix:~/dev/broadway/examples$
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
### Installing npm (node package manager)
|
||||
``` bash
|
||||
$ curl http://npmjs.org/install.sh | sh
|
||||
```
|
||||
|
||||
### Installing broadway
|
||||
``` bash
|
||||
$ [sudo] npm install broadway
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### App#init(callback)
|
||||
|
||||
Initialize application and it's plugins, `callback` will be called with null or
|
||||
initialization error as first argument.
|
||||
|
||||
### App#use(plugin, options)
|
||||
|
||||
Attach plugin to application. `plugin` should conform to following interface:
|
||||
|
||||
```javascript
|
||||
var plugin = {
|
||||
"name": "example-plugin", // Plugin's name
|
||||
|
||||
"attach": function attach(options) {
|
||||
// Called with plugin options once plugin attached to application
|
||||
// `this` - is a reference to application
|
||||
},
|
||||
|
||||
"detach": function detach() {
|
||||
// Called when plugin detached from application
|
||||
// (Only if plugin with same name was attached)
|
||||
// `this` - is a reference to application
|
||||
},
|
||||
|
||||
"init": function init(callback) {
|
||||
// Called on application initialization
|
||||
// App#init(callback) will be called once every plugin will call `callback`
|
||||
// `this` - is a reference to application
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
### App#on(event, callback) and App#emit(event, data)
|
||||
|
||||
App inherits from [EventEmitter2][2], and many plugins build on this
|
||||
functionality.
|
||||
|
||||
#### Built-In Events:
|
||||
|
||||
* `error:init`: Broadway emits this event when it throws an error while attempting to initialize.
|
||||
|
||||
Read the [EventEmitter2][2] documentation for more information.
|
||||
|
||||
## Tests
|
||||
All tests are written with [vows][0] and should be run with [npm][1]:
|
||||
|
||||
``` bash
|
||||
$ npm test
|
||||
```
|
||||
|
||||
#### [Charlie Robbins](http://nodejitsu.com)
|
||||
#### License: MIT
|
||||
|
||||
[0]: http://vowsjs.org
|
||||
[1]: http://npmjs.org
|
||||
[2]: https://github.com/hij1nx/EventEmitter2
|
||||
66
node_modules/broadway/bin/build
generated
vendored
Executable file
66
node_modules/broadway/bin/build
generated
vendored
Executable file
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var Codesurgeon = require('codesurgeon').Codesurgeon;
|
||||
var surgeon = new Codesurgeon;
|
||||
|
||||
var path = require('path');
|
||||
|
||||
var root = path.join(__dirname, '..');
|
||||
var lib = path.join(root, 'lib', 'broadway');
|
||||
|
||||
//
|
||||
// Distill and package the browser version.
|
||||
//
|
||||
surgeon
|
||||
//
|
||||
.configure({
|
||||
package: root + '/package.json',
|
||||
owner: 'Nodejitsu, Inc (Using Codesurgeon).'
|
||||
})
|
||||
.read(
|
||||
path.join(root, 'node_modules', 'eventemitter2', 'lib', 'eventemitter2.js'),
|
||||
path.join(lib, 'browser.js')
|
||||
)
|
||||
//
|
||||
// we want everything so far. specify extract with no
|
||||
// parameters to get everything into the output buffer.
|
||||
//
|
||||
.extract()
|
||||
//
|
||||
// clear the input so far, but don't clear the output.
|
||||
//
|
||||
.clear('inputs')
|
||||
//
|
||||
// read the `app.js` file
|
||||
//
|
||||
.read(
|
||||
path.join(lib, 'app.js')
|
||||
)
|
||||
//
|
||||
// the current input buffer contains stuff that we dont
|
||||
// want in the browser build, so let's cherry pick from
|
||||
// the buffer.
|
||||
//
|
||||
.extract(
|
||||
'App.prototype.init',
|
||||
'App.prototype.use',
|
||||
'App.prototype.remove',
|
||||
'App.prototype.inspect'
|
||||
)
|
||||
//
|
||||
// wrap everything that is in the current buffer with a
|
||||
// closure so that we dont get any collisions with other
|
||||
// libraries
|
||||
//
|
||||
.wrap()
|
||||
//
|
||||
// write the debuggable version of the file. This file will
|
||||
// get renamed to include the version from the package.json
|
||||
//
|
||||
.write(root + '/build/broadway.js')
|
||||
//
|
||||
// now lets make a minified version for production use.
|
||||
//
|
||||
.uglify()
|
||||
.write(root + '/build/broadway.min.js')
|
||||
;
|
||||
12
node_modules/broadway/examples/browser/app.js
generated
vendored
Normal file
12
node_modules/broadway/examples/browser/app.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
var app = new App();
|
||||
|
||||
app.use(HelloWorld, { "delimiter": "!" } );
|
||||
|
||||
app.init(function (err) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
|
||||
app.hello("world");
|
||||
11
node_modules/broadway/examples/browser/index.html
generated
vendored
Normal file
11
node_modules/broadway/examples/browser/index.html
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Example</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script type="text/javascript" src="broadway.js"></script>
|
||||
<script type="text/javascript" src="plugins/helloworld.js"></script>
|
||||
<script type="text/javascript" src="app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
23
node_modules/broadway/examples/browser/plugins/helloworld.js
generated
vendored
Normal file
23
node_modules/broadway/examples/browser/plugins/helloworld.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
window.HelloWorld = {};
|
||||
|
||||
//
|
||||
// `exports.attach` gets called by broadway on `app.use`
|
||||
//
|
||||
HelloWorld.attach = function (options) {
|
||||
|
||||
this.hello = function (world) {
|
||||
console.log("Hello "+ world + options.delimiter || ".");
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// `exports.init` gets called by broadway on `app.init`.
|
||||
//
|
||||
HelloWorld.init = function (done) {
|
||||
|
||||
//
|
||||
// This plugin doesn't require any initialization step.
|
||||
//
|
||||
return done();
|
||||
};
|
||||
17
node_modules/broadway/examples/nodejs/app.js
generated
vendored
Normal file
17
node_modules/broadway/examples/nodejs/app.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
var broadway = require('../../'),
|
||||
app = new broadway.App();
|
||||
|
||||
// Passes the second argument to `helloworld.attach`.
|
||||
app.use(require("./plugins/helloworld"), { "delimiter": "!" } );
|
||||
app.use(broadway.plugins.log, {
|
||||
logAll: true
|
||||
});
|
||||
|
||||
app.init(function (err) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
|
||||
app.hello("world");
|
||||
app.emit('world:hello', { meta: 'is here' });
|
||||
23
node_modules/broadway/examples/nodejs/plugins/helloworld.js
generated
vendored
Normal file
23
node_modules/broadway/examples/nodejs/plugins/helloworld.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
var HelloWorld = exports;
|
||||
|
||||
//
|
||||
// `exports.attach` gets called by broadway on `app.use`
|
||||
//
|
||||
HelloWorld.attach = function (options) {
|
||||
|
||||
this.hello = function (world) {
|
||||
console.log("Hello "+ world + options.delimiter || ".");
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// `exports.init` gets called by broadway on `app.init`.
|
||||
//
|
||||
HelloWorld.init = function (done) {
|
||||
|
||||
//
|
||||
// This plugin doesn't require any initialization step.
|
||||
//
|
||||
return done();
|
||||
};
|
||||
19
node_modules/broadway/lib/broadway.js
generated
vendored
Normal file
19
node_modules/broadway/lib/broadway.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* broadway.js: Top-level include for the broadway module.
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var path = require('path'),
|
||||
utile = require('utile');
|
||||
|
||||
var broadway = exports;
|
||||
|
||||
broadway.App = require('./broadway/app').App;
|
||||
broadway.common = require('./broadway/common');
|
||||
broadway.features = require('./broadway/features');
|
||||
broadway.formats = require('nconf').formats;
|
||||
broadway.plugins = utile.requireDirLazy(path.join(__dirname, 'broadway', 'plugins'));
|
||||
|
||||
225
node_modules/broadway/lib/broadway/app.js
generated
vendored
Normal file
225
node_modules/broadway/lib/broadway/app.js
generated
vendored
Normal file
@@ -0,0 +1,225 @@
|
||||
/*
|
||||
* app.js: Core Application object for managing plugins and features in broadway
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var utile = require('utile'),
|
||||
async = utile.async,
|
||||
events = require('eventemitter2'),
|
||||
bootstrapper = require('./bootstrapper'),
|
||||
common = require('./common'),
|
||||
features = require('./features');
|
||||
|
||||
var App = exports.App = function (options) {
|
||||
//
|
||||
// Setup options and `App` constants.
|
||||
//
|
||||
options = options || {};
|
||||
this.root = options.root;
|
||||
this.delimiter = options.delimiter || '::';
|
||||
|
||||
//
|
||||
// Inherit from `EventEmitter2`
|
||||
//
|
||||
events.EventEmitter2.call(this, {
|
||||
delimiter: this.delimiter,
|
||||
wildcard: true
|
||||
});
|
||||
|
||||
//
|
||||
// Setup other relevant options such as the plugins
|
||||
// for this instance.
|
||||
//
|
||||
this.options = options;
|
||||
this.env = options.env || process.env['NODE_ENV'] || 'development'
|
||||
this.plugins = options.plugins || {};
|
||||
this.initialized = false;
|
||||
this.bootstrapper = options.bootstrapper || bootstrapper;
|
||||
this.initializers = {};
|
||||
this.initlist = [];
|
||||
|
||||
//
|
||||
// Bootstrap this instance
|
||||
//
|
||||
this.bootstrapper.bootstrap(this);
|
||||
};
|
||||
|
||||
//
|
||||
// Inherit from `EventEmitter2`.
|
||||
//
|
||||
utile.inherits(App, events.EventEmitter2);
|
||||
|
||||
//
|
||||
// ### function init (options, callback)
|
||||
// #### @options {Object} **Optional** Additional options to initialize with.
|
||||
// #### @callback {function} Continuation to respond to when complete.
|
||||
// Initializes this instance by the following procedure:
|
||||
//
|
||||
// 1. Initializes all plugins (starting with `core`).
|
||||
// 2. Creates all directories in `this.config.directories` (if any).
|
||||
// 3. Ensures the files in the core directory structure conform to the
|
||||
// features required by this application.
|
||||
//
|
||||
App.prototype.init = function (options, callback) {
|
||||
if (!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
|
||||
if (this.initialized) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
var self = this;
|
||||
options = options || {};
|
||||
callback = callback || function () {};
|
||||
this.env = options.env || this.env;
|
||||
this.options = common.mixin({}, this.options, options);
|
||||
|
||||
function onComplete() {
|
||||
self.initialized = true;
|
||||
self.emit('init');
|
||||
callback();
|
||||
}
|
||||
|
||||
function ensureFeatures (err) {
|
||||
return err
|
||||
? onError(err)
|
||||
: features.ensure(this, onComplete);
|
||||
}
|
||||
|
||||
function initPlugin(plugin, next) {
|
||||
if (typeof self.initializers[plugin] === 'function') {
|
||||
return self.initializers[plugin].call(self, function (err) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
self.emit(['plugin', plugin, 'init']);
|
||||
self.initializers[plugin] = true;
|
||||
next();
|
||||
});
|
||||
}
|
||||
|
||||
next();
|
||||
}
|
||||
|
||||
function initPlugins() {
|
||||
async.forEach(self.initlist, initPlugin, ensureFeatures);
|
||||
}
|
||||
|
||||
//
|
||||
// Emit and respond with any errors that may short
|
||||
// circuit the process.
|
||||
//
|
||||
function onError(err) {
|
||||
self.emit(['error', 'init'], err);
|
||||
callback(err);
|
||||
}
|
||||
|
||||
//
|
||||
// Run the bootstrapper, initialize plugins, and
|
||||
// ensure features for this instance.
|
||||
//
|
||||
this.bootstrapper.init(this, initPlugins);
|
||||
};
|
||||
|
||||
//
|
||||
// ### function use(plugin, callback)
|
||||
// Attachs the plugin with the specific name to this `App` instance.
|
||||
//
|
||||
App.prototype.use = function (plugin, options, callback) {
|
||||
options = options || {};
|
||||
|
||||
if (typeof plugin === 'undefined') {
|
||||
console.log('Cannot load invalid plugin!');
|
||||
return callback && callback(new Error('Invalid plugin'));
|
||||
}
|
||||
|
||||
var name = plugin.name,
|
||||
self = this;
|
||||
|
||||
// If the plugin doesn't have a name, use itself as an identifier for the plugins hash.
|
||||
if (!name) {
|
||||
name = common.uuid();
|
||||
}
|
||||
|
||||
if (this.plugins[name]) {
|
||||
return callback && callback();
|
||||
}
|
||||
|
||||
//
|
||||
// Setup state on this instance for the specified plugin
|
||||
//
|
||||
this.plugins[name] = plugin;
|
||||
this.options[name] = common.mixin({}, options, this.options[name] || {});
|
||||
|
||||
//
|
||||
// Attach the specified plugin to this instance, extending
|
||||
// the `App` with new functionality.
|
||||
//
|
||||
if (this.plugins[name].attach && options.attach !== false) {
|
||||
this.plugins[name].attach.call(this, options);
|
||||
}
|
||||
|
||||
//
|
||||
// Setup the initializer only if `options.init` is
|
||||
// not false. This allows for some plugins to be lazy-loaded
|
||||
//
|
||||
if (options.init === false) {
|
||||
return callback && callback();
|
||||
}
|
||||
|
||||
if (!this.initialized) {
|
||||
this.initializers[name] = plugin.init || true;
|
||||
this.initlist.push(name);
|
||||
return callback && callback();
|
||||
}
|
||||
else if (plugin.init) {
|
||||
plugin.init.call(this, function (err) {
|
||||
var args = err
|
||||
? [['plugin', name, 'error'], err]
|
||||
: [['plugin', name, 'init']];
|
||||
|
||||
self.emit.apply(self, args);
|
||||
return callback && (err ? callback(err) : callback());
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// ### function remove(name)
|
||||
// Detaches the plugin with the specific name from this `App` instance.
|
||||
//
|
||||
App.prototype.remove = function (name) {
|
||||
// if this is a plugin object set the name to the plugins name
|
||||
if (name.name) {
|
||||
name = name.name;
|
||||
}
|
||||
|
||||
if (this.plugins[name] && this.plugins[name].detach) {
|
||||
this.plugins[name].detach.call(this);
|
||||
}
|
||||
|
||||
delete this.plugins[name];
|
||||
delete this.options[name];
|
||||
delete this.initializers[name];
|
||||
|
||||
var init = this.initlist.indexOf(name);
|
||||
|
||||
if (init !== -1) {
|
||||
this.initlist.splice(1, init);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// ### function inspect ()
|
||||
// Inspects the modules and features used by the current
|
||||
// application directory structure
|
||||
//
|
||||
App.prototype.inspect = function () {
|
||||
|
||||
};
|
||||
84
node_modules/broadway/lib/broadway/bootstrapper.js
generated
vendored
Normal file
84
node_modules/broadway/lib/broadway/bootstrapper.js
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* bootstrapper.js: Default logic for bootstrapping broadway applications.
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var broadway = require('../broadway');
|
||||
|
||||
//
|
||||
// ### bootstrap (app, callback)
|
||||
// #### @app {broadway.App} Application to bootstrap
|
||||
// #### @callback {function} Continuation to respond to when complete.
|
||||
// Bootstraps the specified `app`.
|
||||
//
|
||||
exports.bootstrap = function (app) {
|
||||
app.options['config'] = app.options['config'] || {};
|
||||
app.options['config'].init = false;
|
||||
app.use(broadway.plugins.config);
|
||||
|
||||
//
|
||||
// Remove initializers run by the bootstrapper.
|
||||
//
|
||||
delete app.initializers['config'];
|
||||
app.initlist.pop();
|
||||
|
||||
//
|
||||
// Set the current environment in the config
|
||||
//
|
||||
app.config.set('env', app.env);
|
||||
};
|
||||
|
||||
//
|
||||
// ### bootstrap (app, callback)
|
||||
// #### @app {broadway.App} Application to bootstrap
|
||||
// #### @callback {function} Continuation to respond to when complete.
|
||||
// Runs the initialization step of the bootstrapping process
|
||||
// for the specified `app`.
|
||||
//
|
||||
exports.init = function (app, callback) {
|
||||
broadway.plugins.config.init.call(app, function (err) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
if (app.config.get('handleExceptions')) {
|
||||
app.use(broadway.plugins.exceptions, app.options['exceptions'] || {});
|
||||
}
|
||||
|
||||
app.use(broadway.plugins.directories, app.options['directories'] || {});
|
||||
app.use(broadway.plugins.log, app.options['log'] || {});
|
||||
|
||||
//
|
||||
// Ensure the `directories` and `log` plugins initialize before
|
||||
// any other plugins. Since we cannot depend on ordering (if they were
|
||||
// manually added) splice the specific indexes
|
||||
//
|
||||
var log = app.initlist.indexOf('log');
|
||||
app.initlist.unshift.apply(
|
||||
app.initlist,
|
||||
app.initlist.splice(log)
|
||||
);
|
||||
|
||||
var directories = app.initlist.indexOf('directories');
|
||||
app.initlist.unshift.apply(
|
||||
app.initlist,
|
||||
app.initlist.splice(directories)
|
||||
);
|
||||
|
||||
//
|
||||
// Put the godot plugin before the log if it exists
|
||||
//
|
||||
var godot = app.initlist.indexOf('godot');
|
||||
if(~godot) {
|
||||
app.initlist.unshift.apply(
|
||||
app.initlist,
|
||||
app.initlist.splice(godot)
|
||||
);
|
||||
}
|
||||
|
||||
callback();
|
||||
});
|
||||
};
|
||||
75
node_modules/broadway/lib/broadway/browser.js
generated
vendored
Normal file
75
node_modules/broadway/lib/broadway/browser.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
|
||||
/*
|
||||
* browser.js: Browser specific functionality for broadway.
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var id = 0;
|
||||
|
||||
var common = {
|
||||
mixin: function (target) {
|
||||
var objs = Array.prototype.slice.call(arguments, 1);
|
||||
objs.forEach(function (o) {
|
||||
Object.keys(o).forEach(function (attr) {
|
||||
var getter = o.__lookupGetter__(attr);
|
||||
if (!getter) {
|
||||
target[attr] = o[attr];
|
||||
}
|
||||
else {
|
||||
target.__defineGetter__(attr, getter);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return target;
|
||||
},
|
||||
uuid: function () {
|
||||
return String(id++);
|
||||
}
|
||||
};
|
||||
|
||||
var App = exports.App = function (options) {
|
||||
//
|
||||
// Setup options and `App` constants.
|
||||
//
|
||||
var self = this;
|
||||
options = options || {};
|
||||
this.root = options.root;
|
||||
this.delimiter = options.delimiter || '::';
|
||||
|
||||
//
|
||||
// Inherit from `EventEmitter2`
|
||||
//
|
||||
exports.EventEmitter2.call(this, {
|
||||
delimiter: this.delimiter,
|
||||
wildcard: true
|
||||
});
|
||||
|
||||
//
|
||||
// Setup other relevant options such as the plugins
|
||||
// for this instance.
|
||||
//
|
||||
this.options = options;
|
||||
this.plugins = options.plugins || {};
|
||||
this.initialized = false;
|
||||
this.bootstrapper = { init: function (app, func) {} };
|
||||
this.initializers = {};
|
||||
};
|
||||
|
||||
var inherit = function (ctor, superCtor) {
|
||||
ctor.super_ = superCtor;
|
||||
ctor.prototype = Object.create(superCtor.prototype, {
|
||||
constructor: {
|
||||
value: ctor,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
inherit(exports.App, exports.EventEmitter2);
|
||||
|
||||
78
node_modules/broadway/lib/broadway/common/directories.js
generated
vendored
Normal file
78
node_modules/broadway/lib/broadway/common/directories.js
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* app.js: Common utility functions for working with directories
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var utile = require('utile'),
|
||||
async = utile.async,
|
||||
mkdirp = utile.mkdirp,
|
||||
rimraf = utile.rimraf;
|
||||
|
||||
var directories = exports;
|
||||
|
||||
//
|
||||
// ### function create (dirs, callback)
|
||||
// #### @dirs {Object} Directories to create
|
||||
// #### @callback {function} Continuation to respond to when complete
|
||||
// Creates all of the specified `directories` in the current environment.
|
||||
//
|
||||
directories.create = function (dirs, callback) {
|
||||
function createDir(dir, next) {
|
||||
mkdirp(dir, 0755, function () {
|
||||
next(null, dir);
|
||||
});
|
||||
}
|
||||
|
||||
if (!dirs) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
async.mapSeries(Object.keys(dirs).map(function (key) {
|
||||
return dirs[key]
|
||||
}), createDir, callback);
|
||||
};
|
||||
|
||||
//
|
||||
// ### function remove (dirs, callback)
|
||||
// #### @dirs {Object} Directories to remove
|
||||
// #### @callback {function} Continuation to respond to when complete
|
||||
// Removes all of the specified `directories` in the current environment.
|
||||
//
|
||||
directories.remove = function (dirs, callback) {
|
||||
function removeDir (dir, next) {
|
||||
rimraf(dir, function () {
|
||||
next(null, dir);
|
||||
});
|
||||
}
|
||||
|
||||
if (!dirs) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
async.mapSeries(Object.keys(dirs).map(function (key) {
|
||||
return dirs[key]
|
||||
}), removeDir, callback);
|
||||
};
|
||||
|
||||
//
|
||||
// ### function normalize (root, dirs)
|
||||
// #### @keys {Object} Set of keys to normalize upon.
|
||||
// #### @dirs {Object} Set of directories to normalize.
|
||||
// Normalizes the specified `dirs` against the relative
|
||||
// `root` of the application.
|
||||
//
|
||||
directories.normalize = function (keys, dirs) {
|
||||
var normalized = {};
|
||||
|
||||
Object.keys(dirs).forEach(function (key) {
|
||||
normalized[key] = dirs[key];
|
||||
Object.keys(keys).forEach(function (constant) {
|
||||
normalized[key] = normalized[key].replace(constant, keys[constant]);
|
||||
});
|
||||
});
|
||||
|
||||
return normalized;
|
||||
};
|
||||
18
node_modules/broadway/lib/broadway/common/index.js
generated
vendored
Normal file
18
node_modules/broadway/lib/broadway/common/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* common.js: Top-level include for the `common` module.
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var common = module.exports = require('utile');
|
||||
|
||||
common.directories = require('./directories');
|
||||
|
||||
// A naive shared "unique ID" generator for cases where `plugin.name` is
|
||||
// undefined.
|
||||
var id = 0;
|
||||
common.uuid = function () {
|
||||
return String(id++);
|
||||
}
|
||||
48
node_modules/broadway/lib/broadway/features/index.js
generated
vendored
Normal file
48
node_modules/broadway/lib/broadway/features/index.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* index.js: Top-level include for the features module.
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
exports.ensure = function (app, callback) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
exports.all = [
|
||||
{
|
||||
name: 'Entry Point',
|
||||
test: function (target, name) {
|
||||
return typeof target.start === 'function' ||
|
||||
typeof target.createServer === 'function';
|
||||
},
|
||||
allExports: ['start', 'createServer', 'init', 'getRoutes']
|
||||
},
|
||||
{
|
||||
name: 'Resource',
|
||||
test: function (target, name) {
|
||||
var methods = ['create', 'get', 'update', 'destroy'],
|
||||
resource = target[capitalize(name)];
|
||||
|
||||
if (typeof resource !== 'function') {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (var i = 0; i < methods.length; i++) {
|
||||
if (typeof resource[method] !== 'function') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
},
|
||||
allExports: ['addRoutes', 'init']
|
||||
},
|
||||
{
|
||||
name: 'Configurator',
|
||||
exports: ['config'],
|
||||
},
|
||||
{
|
||||
name: 'Serve Files',
|
||||
exports: 'serve'
|
||||
}
|
||||
];
|
||||
46
node_modules/broadway/lib/broadway/plugins/config.js
generated
vendored
Normal file
46
node_modules/broadway/lib/broadway/plugins/config.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* config.js: Default configuration management plugin which attachs nconf to App instances
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var nconf = require('nconf');
|
||||
|
||||
//
|
||||
// ### Name this plugin
|
||||
//
|
||||
exports.name = 'config';
|
||||
|
||||
//
|
||||
// ### function attach (options)
|
||||
// #### @options {Object} Options for this plugin
|
||||
// Extends `this` (the application) with configuration functionality
|
||||
// from `nconf`.
|
||||
//
|
||||
exports.attach = function (options) {
|
||||
options = options || {};
|
||||
this.config = new nconf.Provider(options);
|
||||
|
||||
//
|
||||
// Setup a default store
|
||||
//
|
||||
this.config.use('literal');
|
||||
this.config.stores.literal.readOnly = false;
|
||||
};
|
||||
|
||||
//
|
||||
// ### function init (done)
|
||||
// #### @done {function} Continuation to respond to when complete.
|
||||
// Initalizes the `nconf.Provider` associated with this instance.
|
||||
//
|
||||
exports.init = function (done) {
|
||||
//
|
||||
// Remark: There should be code here for automated remote
|
||||
// seeding and loading
|
||||
//
|
||||
this.config.load(function (err) {
|
||||
return err ? done(err) : done();
|
||||
});
|
||||
};
|
||||
49
node_modules/broadway/lib/broadway/plugins/directories.js
generated
vendored
Normal file
49
node_modules/broadway/lib/broadway/plugins/directories.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* directories.js: Plugin for creating directories for a required for a broadway App.
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var common = require('../common');
|
||||
|
||||
//
|
||||
// ### Name this plugin
|
||||
//
|
||||
exports.name = 'directories';
|
||||
|
||||
//
|
||||
// ### function attach (options)
|
||||
// #### @options {Object} Options for this plugin
|
||||
// #### @done {function} Continuation to respond to when complete.
|
||||
// Prepopulates the directory structure of `this` (the application).
|
||||
//
|
||||
exports.attach = function (options) {
|
||||
options = options || {};
|
||||
|
||||
if (this.config) {
|
||||
//
|
||||
// Merge options with any pre-existing application config.
|
||||
//
|
||||
options = common.mixin({}, options, this.config.get('directories') || {});
|
||||
}
|
||||
|
||||
options = common.directories.normalize({'#ROOT': this.root}, options);
|
||||
this.options['directories'] = options;
|
||||
|
||||
if (this.config) {
|
||||
this.config.merge('directories', options);
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// ### function init (done)
|
||||
// #### @done {function} Continuation to respond to when complete.
|
||||
// Creates the directories associated with this instance.
|
||||
//
|
||||
exports.init = function (done) {
|
||||
common.directories.create(this.options['directories'], function (err) {
|
||||
return err ? done(err) : done();
|
||||
});
|
||||
};
|
||||
70
node_modules/broadway/lib/broadway/plugins/exceptions.js
generated
vendored
Normal file
70
node_modules/broadway/lib/broadway/plugins/exceptions.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* exceptions.js: Plugin responsible for logging all uncaughtExceptions in a flatiron App.
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var winston = require('winston'),
|
||||
common = require('../common');
|
||||
|
||||
var exceptions = exports;
|
||||
|
||||
//
|
||||
// ### Setup default state for the exceptions plugin
|
||||
//
|
||||
exceptions.name = 'exceptions';
|
||||
exceptions.initalized = false;
|
||||
|
||||
var defaultConfig = exceptions.defaultConfig = {
|
||||
console: {
|
||||
colorize: false,
|
||||
json: true,
|
||||
level: 'silly'
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// ### function attach (options)
|
||||
// #### @options {Object} Options for this plugin
|
||||
// Extends `this` the application with exception handling
|
||||
// functionality from `winston`.
|
||||
//
|
||||
exceptions.attach = function (options) {
|
||||
options = options || {};
|
||||
|
||||
if (this.config) {
|
||||
options = common.mixin({}, options, this.config.get('exceptions') || {});
|
||||
}
|
||||
|
||||
if (exceptions.initalized) {
|
||||
return;
|
||||
}
|
||||
|
||||
var exceptionHandlers = [];
|
||||
|
||||
//
|
||||
// Create the exceptionHandlers defaulting to Console and Loggly.
|
||||
//
|
||||
exceptionHandlers.push(new winston.transports.Console(options.console || defaultConfig.console));
|
||||
|
||||
Object.keys(options).forEach(function (name) {
|
||||
if (name === 'console') {
|
||||
return;
|
||||
}
|
||||
|
||||
exceptionHandlers.push(new (winston.transports[common.capitalize(name)])(options[name]));
|
||||
});
|
||||
|
||||
//
|
||||
// Update the state of the plugin with the logger.
|
||||
//
|
||||
exceptions.logger = new winston.Logger({ exceptionHandlers: exceptionHandlers });
|
||||
exceptions.initalized = true;
|
||||
|
||||
//
|
||||
// Have the logger handle uncaught exceptions.
|
||||
//
|
||||
exceptions.logger.handleExceptions();
|
||||
};
|
||||
40
node_modules/broadway/lib/broadway/plugins/inspect.js
generated
vendored
Normal file
40
node_modules/broadway/lib/broadway/plugins/inspect.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* inspect.js: Plugin responsible for attaching inspection behavior using `cliff` and `eyes`.
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
//
|
||||
// ### Name this plugin
|
||||
//
|
||||
exports.name = 'inspect';
|
||||
|
||||
//
|
||||
// ### function init (done)
|
||||
// #### @done {function} Continuation to respond to when complete.
|
||||
// Attaches inspection behavior through `cliff` and `eyes`.
|
||||
//
|
||||
exports.init = function (done) {
|
||||
var namespace = 'default',
|
||||
app = this;
|
||||
|
||||
if (app.options['inspect'] && app.options['inspect'].namespace) {
|
||||
namespace = app.options['inspect'].namespace;
|
||||
}
|
||||
|
||||
app.inspect = require('cliff');
|
||||
app.inspect.logger = app.log.get('namespace');
|
||||
done();
|
||||
};
|
||||
|
||||
//
|
||||
// ### function detact()
|
||||
// Removes inspection behavior exposed by this plugin.
|
||||
//
|
||||
exports.detach = function () {
|
||||
if (this.inspect) {
|
||||
delete this.inspect;
|
||||
}
|
||||
};
|
||||
227
node_modules/broadway/lib/broadway/plugins/log.js
generated
vendored
Normal file
227
node_modules/broadway/lib/broadway/plugins/log.js
generated
vendored
Normal file
@@ -0,0 +1,227 @@
|
||||
/*
|
||||
* log.js: Default logging plugin which attachs winston to App instances
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var winston = require('winston'),
|
||||
common = require('../common');
|
||||
|
||||
var log = exports;
|
||||
|
||||
//
|
||||
// ### Setup default state for the exceptions plugin
|
||||
//
|
||||
log.name = 'log';
|
||||
log.ignore = ['broadway'];
|
||||
|
||||
//
|
||||
// ### function attach (options)
|
||||
// #### @options {Object} Options for this plugin
|
||||
// Extends `this` (the application) with logging functionality from `winston`.
|
||||
//
|
||||
log.attach = function (options) {
|
||||
options = options || {};
|
||||
|
||||
var app = this,
|
||||
namespaces,
|
||||
logAll,
|
||||
level,
|
||||
oldGodot,
|
||||
service;
|
||||
|
||||
if (this.config) {
|
||||
//
|
||||
// Merge options with any pre-existing application config.
|
||||
//
|
||||
options = common.mixin({}, options, this.config.get('log') || {});
|
||||
}
|
||||
|
||||
//
|
||||
// Setup namespaces and then remove them from
|
||||
// `options` so they are not caught by `winston`.
|
||||
//
|
||||
namespaces = options.namespaces || {};
|
||||
delete options.namespaces;
|
||||
|
||||
//
|
||||
// Setup logAll and then remove them from
|
||||
// `options` so they are not caught by `winston`.
|
||||
//
|
||||
logAll = options.logAll || false;
|
||||
if (options.logAll) {
|
||||
delete options.logAll;
|
||||
}
|
||||
|
||||
//
|
||||
// Setup level and then remove them from
|
||||
// `options` so they are not caught by `winston`.
|
||||
//
|
||||
level = options.level || false;
|
||||
if (options.level) {
|
||||
delete options.level;
|
||||
}
|
||||
|
||||
//
|
||||
// Make proper godot options for the winston plugin if it exists
|
||||
//
|
||||
if (this.godot && options.godot) {
|
||||
oldGodot = options.godot;
|
||||
service = this.config.get('service')
|
||||
|| options.service
|
||||
|| oldGodot.service
|
||||
|| 'app';
|
||||
options.godot = {
|
||||
godot: this.godot,
|
||||
service: service + '/logs',
|
||||
handleExceptions: oldGodot.handleExceptions === false ? false : true
|
||||
};
|
||||
}
|
||||
|
||||
//
|
||||
// Hoist up relevant logging functions onto the app
|
||||
// if requested.
|
||||
//
|
||||
this.log = new winston.Container(options);
|
||||
this.log.namespaces = namespaces;
|
||||
this.log.get('default').extend(this.log);
|
||||
|
||||
//
|
||||
// Set the default console loglevel to options.level
|
||||
//
|
||||
this.log.get('default').transports.console.level = level || 'info';
|
||||
|
||||
Object.defineProperty(this.log, 'logAll', {
|
||||
get: function () {
|
||||
return this._logAll;
|
||||
},
|
||||
set: function (val) {
|
||||
if (val === this._logAll) {
|
||||
//
|
||||
// If the value is identical return
|
||||
//
|
||||
return;
|
||||
}
|
||||
|
||||
if (val) {
|
||||
app.onAny(log.logEvent);
|
||||
app.off(['log'], log.logEvent);
|
||||
app.off(['log', '*'], log.logEvent);
|
||||
app.off(['log', '*', '*'], log.logEvent);
|
||||
}
|
||||
else {
|
||||
app.offAny(log.logEvent);
|
||||
app.on(['log'], log.logEvent);
|
||||
app.on(['log', '*'], log.logEvent);
|
||||
app.on(['log', '*', '*'], log.logEvent);
|
||||
}
|
||||
|
||||
this._logAll = val;
|
||||
}
|
||||
});
|
||||
|
||||
//
|
||||
// Listen to relevant `app` events and
|
||||
// log them appropriately.
|
||||
//
|
||||
this.log.logAll = logAll;
|
||||
|
||||
//
|
||||
// Add any namespaced containers to this App instance.
|
||||
//
|
||||
Object.keys(this.log.namespaces).forEach(function (namespace) {
|
||||
app.log.add(app.log.namespaces[namespace]);
|
||||
});
|
||||
};
|
||||
|
||||
//
|
||||
// ### function logEvent ([level], msg, meta)
|
||||
// #### @msg {string} Message to log
|
||||
// #### @meta {Object} **Optional** Metadata to log
|
||||
// Logs the specified `msg` and `meta` according to
|
||||
// the following conditions:
|
||||
//
|
||||
// #### `log` events
|
||||
// 1. `log` - Logs to the default logger and level.
|
||||
// 2. `log::[level]` - Logs to the default logger.
|
||||
// 3. `log::[level]::[namespace]` - Logs to a namespaced logger.
|
||||
//
|
||||
// ### `[namespaced]` events
|
||||
// If `app.log.logAll` is set, then find a logger at `namespace`,
|
||||
// otherwise the default logger is used.
|
||||
//
|
||||
// 1. `[namespace]::**(level, msg, meta)` - Logs the event as the
|
||||
// message to the logger for the specified namespace and level.
|
||||
// 2. `[namespace]::[level]::**(msg, meta)` - Logs the event and
|
||||
// the message to the logger for the specified namespace and level.
|
||||
//
|
||||
log.logEvent = function (/* level, msg, meta */) {
|
||||
var parts = Array.isArray(this.event) ? this.event : this.event.split(this.delimiter),
|
||||
ev = parts[0],
|
||||
namespace,
|
||||
logger,
|
||||
level,
|
||||
meta,
|
||||
msg;
|
||||
|
||||
if (log.ignore.indexOf(ev) !== -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Determine the `namespace` to log the event to
|
||||
//
|
||||
if (ev === 'log') {
|
||||
namespace = parts[2] || 'default';
|
||||
logger = this.log.get('default');
|
||||
}
|
||||
else if (this.log.logAll) {
|
||||
namespace = this.log.namespaces[ev] ? this.log.namespaces[ev] : 'default';
|
||||
logger = this.log.get(namespace);
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Parse arguments now that we have the logger.
|
||||
//
|
||||
Array.prototype.slice.call(arguments).forEach(function (a) {
|
||||
switch (typeof a) {
|
||||
case 'object': {
|
||||
meta = a;
|
||||
break;
|
||||
}
|
||||
case 'string': {
|
||||
if (logger[a]) {
|
||||
level = a;
|
||||
}
|
||||
else {
|
||||
msg = a;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (ev === 'log') {
|
||||
level = parts[1] || level || 'info';
|
||||
}
|
||||
else if (this.log.logAll) {
|
||||
if (logger[parts[1]]) {
|
||||
level = parts[1];
|
||||
parts.splice(1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (level in logger.levels === false) {
|
||||
level = 'info';
|
||||
}
|
||||
|
||||
parts = parts.join(this.delimiter);
|
||||
meta = meta || {};
|
||||
msg = msg || parts;
|
||||
logger.log(level, msg, meta);
|
||||
this.emit(['broadway', 'logged'], level, msg, meta, parts);
|
||||
};
|
||||
91
node_modules/broadway/package.json
generated
vendored
Normal file
91
node_modules/broadway/package.json
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"broadway@~0.3.6",
|
||||
"/home/mywebsite/node_modules/forever-monitor"
|
||||
]
|
||||
],
|
||||
"_from": "broadway@>=0.3.6 <0.4.0",
|
||||
"_id": "broadway@0.3.6",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/broadway",
|
||||
"_npmUser": {
|
||||
"email": "jcrugzz@gmail.com",
|
||||
"name": "jcrugzz"
|
||||
},
|
||||
"_npmVersion": "1.4.23",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "broadway",
|
||||
"raw": "broadway@~0.3.6",
|
||||
"rawSpec": "~0.3.6",
|
||||
"scope": null,
|
||||
"spec": ">=0.3.6 <0.4.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/forever-monitor"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/broadway/-/broadway-0.3.6.tgz",
|
||||
"_shasum": "7dbef068b954b7907925fd544963b578a902ba7a",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "broadway@~0.3.6",
|
||||
"_where": "/home/mywebsite/node_modules/forever-monitor",
|
||||
"author": {
|
||||
"email": "info@nodejitsu.com",
|
||||
"name": "Nodejitsu Inc."
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/flatiron/broadway/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"cliff": "0.1.9",
|
||||
"eventemitter2": "0.4.14",
|
||||
"nconf": "0.6.9",
|
||||
"utile": "0.2.1",
|
||||
"winston": "0.8.0"
|
||||
},
|
||||
"description": "Lightweight application extensibility and composition with a twist of feature reflection.",
|
||||
"devDependencies": {
|
||||
"codesurgeon": "0.3.x",
|
||||
"uglify-js": "1.0.6",
|
||||
"vows": "0.7.x"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "7dbef068b954b7907925fd544963b578a902ba7a",
|
||||
"tarball": "http://registry.npmjs.org/broadway/-/broadway-0.3.6.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6.4"
|
||||
},
|
||||
"gitHead": "d293e467b2364b2432259f8c21df0c6bf1206762",
|
||||
"homepage": "https://github.com/flatiron/broadway",
|
||||
"main": "./lib/broadway",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "indexzero",
|
||||
"email": "charlie.robbins@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "mmalecki",
|
||||
"email": "me@mmalecki.com"
|
||||
},
|
||||
{
|
||||
"name": "jcrugzz",
|
||||
"email": "jcrugzz@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "broadway",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/flatiron/broadway.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "vows test/**/*-test.js --spec"
|
||||
},
|
||||
"version": "0.3.6"
|
||||
}
|
||||
60
node_modules/broadway/test/common/directories-test.js
generated
vendored
Normal file
60
node_modules/broadway/test/common/directories-test.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* directories-test.js: Tests for working with directories in broadway.
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var assert = require('assert'),
|
||||
fs = require('fs'),
|
||||
path = require('path'),
|
||||
vows = require('vows'),
|
||||
broadway = require('../../lib/broadway');
|
||||
|
||||
var fixturesDir = path.join(__dirname, '..', 'fixtures'),
|
||||
emptyAppDir = path.join(fixturesDir, 'empty-app'),
|
||||
emptyAppFile = path.join(fixturesDir, 'sample-app.json'),
|
||||
appConfig = JSON.parse(fs.readFileSync(emptyAppFile, 'utf8')),
|
||||
directories = appConfig.directories;
|
||||
|
||||
vows.describe('broadway/common/directories').addBatch({
|
||||
"When using broadway.common.directories": {
|
||||
"it should have the correct methods defined": function () {
|
||||
assert.isObject(broadway.common.directories);
|
||||
assert.isFunction(broadway.common.directories.create);
|
||||
assert.isFunction(broadway.common.directories.remove);
|
||||
},
|
||||
"the normalize() method should correctly modify a set of directories": function () {
|
||||
directories = broadway.common.directories.normalize({'#ROOT': emptyAppDir}, directories);
|
||||
|
||||
Object.keys(directories).forEach(function (key) {
|
||||
assert.isTrue(directories[key].indexOf(emptyAppDir) !== -1);
|
||||
});
|
||||
},
|
||||
"the create() method": {
|
||||
topic: function () {
|
||||
broadway.common.directories.create(directories, this.callback);
|
||||
},
|
||||
"should create the specified directories": function (err, dirs) {
|
||||
assert.isTrue(!err);
|
||||
|
||||
dirs.forEach(function (dir) {
|
||||
assert.isTrue((fs.existsSync || path.existsSync)(dir));
|
||||
});
|
||||
},
|
||||
"the destroy() method": {
|
||||
topic: function () {
|
||||
broadway.common.directories.remove(directories, this.callback);
|
||||
},
|
||||
"should remove the specified directories": function (err, dirs) {
|
||||
assert.isTrue(!err);
|
||||
|
||||
dirs.forEach(function (dir) {
|
||||
assert.isFalse((fs.existsSync || path.existsSync)(dir));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}).export(module);
|
||||
100
node_modules/broadway/test/core/app-init-test.js
generated
vendored
Normal file
100
node_modules/broadway/test/core/app-init-test.js
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* app-test.js: Tests for core App methods and configuration.
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var events = require('eventemitter2'),
|
||||
vows = require('vows'),
|
||||
assert = require('../helpers/assert'),
|
||||
broadway = require('../../lib/broadway');
|
||||
|
||||
vows.describe('broadway/app').addBatch({
|
||||
"An initialized instance of broadway.App with three plugins": {
|
||||
topic: function () {
|
||||
var app = new broadway.App(),
|
||||
that = this,
|
||||
three;
|
||||
|
||||
that.init = [];
|
||||
|
||||
three = {
|
||||
name: 'three',
|
||||
init: function (cb) {
|
||||
process.nextTick(function () {
|
||||
that.init.push('three');
|
||||
cb();
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
// First plugin. Includes an init step.
|
||||
app.use({
|
||||
attach: function () {
|
||||
this.place = 'rackspace';
|
||||
},
|
||||
|
||||
init: function (cb) {
|
||||
var self = this;
|
||||
|
||||
// a nextTick isn't technically necessary, but it does make this
|
||||
// purely async.
|
||||
process.nextTick(function () {
|
||||
that.init.push('one');
|
||||
self.letsGo = function () {
|
||||
return 'Let\'s go to '+self.place+'!';
|
||||
}
|
||||
|
||||
cb();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Second plugin. Only involves an "attach".
|
||||
app.use({
|
||||
attach: function () {
|
||||
this.oneup = function (n) {
|
||||
n++;
|
||||
return n;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Third pluging. Only involves an "init".
|
||||
app.use(three);
|
||||
|
||||
// Attempt to use it again. This should not invoke `init()` twice
|
||||
app.use(three);
|
||||
|
||||
// Remove the plugin and use it again. This should not invoke `init()` twice
|
||||
app.remove(three);
|
||||
app.use(three);
|
||||
|
||||
// Removing a plugin which was never added should not affect the initlist
|
||||
app.remove({
|
||||
name: 'foo'
|
||||
});
|
||||
|
||||
app.init(function (err) {
|
||||
that.callback(err, app);
|
||||
});
|
||||
},
|
||||
"shouldn't throw an error": function (err, app) {
|
||||
assert.ok(!err);
|
||||
},
|
||||
"should have all its methods attached/defined": function (err, app) {
|
||||
assert.ok(app.place);
|
||||
assert.isFunction(app.oneup);
|
||||
assert.isFunction(app.letsGo);
|
||||
assert.equal(2, app.oneup(1));
|
||||
assert.equal(app.letsGo(), 'Let\'s go to rackspace!');
|
||||
|
||||
//
|
||||
// This is intentional. The second plugin does not invoke `init`.
|
||||
//
|
||||
assert.deepEqual(this.init, ['one', 'three']);
|
||||
},
|
||||
}
|
||||
}).export(module);
|
||||
73
node_modules/broadway/test/core/app-test.js
generated
vendored
Normal file
73
node_modules/broadway/test/core/app-test.js
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* app-test.js: Tests for core App methods and configuration.
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var events = require('eventemitter2'),
|
||||
vows = require('vows'),
|
||||
assert = require('../helpers/assert'),
|
||||
broadway = require('../../lib/broadway');
|
||||
|
||||
vows.describe('broadway/app').addBatch({
|
||||
"An instance of broadway.App": {
|
||||
topic: new broadway.App(),
|
||||
"should have the correct properties and methods": function (app) {
|
||||
//
|
||||
// Instance
|
||||
//
|
||||
assert.isObject(app);
|
||||
assert.instanceOf(app, events.EventEmitter2);
|
||||
assert.instanceOf(app, broadway.App);
|
||||
|
||||
//
|
||||
// Properties
|
||||
//
|
||||
assert.isObject(app.plugins);
|
||||
assert.isObject(app.initializers);
|
||||
assert.isFalse(!!app.initialized);
|
||||
|
||||
//
|
||||
// Methods
|
||||
//
|
||||
assert.isFunction(app.init);
|
||||
assert.isFunction(app.use);
|
||||
assert.isFunction(app.remove);
|
||||
assert.isFunction(app.inspect);
|
||||
},
|
||||
"the init() method": {
|
||||
topic: function (app) {
|
||||
this.app = app;
|
||||
app.init(this.callback);
|
||||
},
|
||||
"should correctly setup the application state": function () {
|
||||
assert.isTrue(this.app.initialized);
|
||||
assert.isTrue(this.app.initializers['log']);
|
||||
|
||||
assert.plugins.has.config(this.app);
|
||||
assert.plugins.has.log(this.app);
|
||||
}
|
||||
},
|
||||
"the detach() method": {
|
||||
topic: function (app) {
|
||||
app.use({
|
||||
name: "foo",
|
||||
attach: function () {
|
||||
this.attached = true;
|
||||
},
|
||||
detach: function () {
|
||||
this.detached = true;
|
||||
}
|
||||
});
|
||||
app.remove("foo");
|
||||
return app;
|
||||
},
|
||||
"should correctly remove a plugin": function (app) {
|
||||
assert.isTrue(app.detached);
|
||||
assert.equal(undefined, app.plugins["foo"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}).export(module);
|
||||
26
node_modules/broadway/test/core/broadway-test.js
generated
vendored
Normal file
26
node_modules/broadway/test/core/broadway-test.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* broadway-test.js: Tests for core App methods and configuration.
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var assert = require('assert'),
|
||||
events = require('eventemitter2'),
|
||||
vows = require('vows'),
|
||||
broadway = require('../../lib/broadway');
|
||||
|
||||
vows.describe('broadway').addBatch({
|
||||
"The broadway module": {
|
||||
"should have the appropriate properties and methods defined": function () {
|
||||
assert.isFunction(broadway.App);
|
||||
assert.isObject(broadway.common);
|
||||
assert.isObject(broadway.features);
|
||||
assert.isObject(broadway.plugins);
|
||||
assert.isObject(broadway.plugins.log);
|
||||
assert.isObject(broadway.plugins.config);
|
||||
assert.isObject(broadway.plugins.exceptions);
|
||||
}
|
||||
}
|
||||
}).export(module);
|
||||
8
node_modules/broadway/test/fixtures/sample-app.json
generated
vendored
Normal file
8
node_modules/broadway/test/fixtures/sample-app.json
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"directories": {
|
||||
"app": "#ROOT/app",
|
||||
"config": "#ROOT/config",
|
||||
"lib": "#ROOT/lib",
|
||||
"test": "#ROOT/test"
|
||||
}
|
||||
}
|
||||
2
node_modules/broadway/test/fixtures/sample-app/app/index.js
generated
vendored
Normal file
2
node_modules/broadway/test/fixtures/sample-app/app/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
var broadway = require("../../../")
|
||||
5
node_modules/broadway/test/fixtures/sample-app/config/topics.json
generated
vendored
Normal file
5
node_modules/broadway/test/fixtures/sample-app/config/topics.json
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"topics": [
|
||||
|
||||
]
|
||||
}
|
||||
107
node_modules/broadway/test/helpers/assert.js
generated
vendored
Normal file
107
node_modules/broadway/test/helpers/assert.js
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* assert.js: Assertion helpers for broadway tests
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var assert = module.exports = require('assert'),
|
||||
fs = require('fs'),
|
||||
path = require('path'),
|
||||
nconf = require('nconf'),
|
||||
vows = require('vows');
|
||||
|
||||
//
|
||||
// ### Assertion helpers for working with `broadway.App` objects.
|
||||
//
|
||||
assert.app = {};
|
||||
|
||||
//
|
||||
// ### Assertion helpers for working with `broadway.plugins`.
|
||||
//
|
||||
assert.plugins = {};
|
||||
|
||||
//
|
||||
// ### Assert that an application has various plugins.
|
||||
//
|
||||
assert.plugins.has = {
|
||||
config: function (app, config) {
|
||||
assert.instanceOf(app.config, nconf.Provider);
|
||||
if (config) {
|
||||
//
|
||||
// TODO: Assert that all configuration has been loaded
|
||||
//
|
||||
}
|
||||
},
|
||||
exceptions: function (app) {
|
||||
|
||||
},
|
||||
directories: function (app) {
|
||||
if (app.options['directories']) {
|
||||
Object.keys(app.options['directories']).forEach(function (key) {
|
||||
assert.isTrue((fs.existsSync || path.existsSync)(app.options['directories'][key]));
|
||||
});
|
||||
}
|
||||
},
|
||||
log: function (app) {
|
||||
assert.isObject(app.log);
|
||||
|
||||
//
|
||||
// TODO: Assert winston.extend methods
|
||||
//
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// ### Assert that an application doesn't have various plugins
|
||||
//
|
||||
assert.plugins.notHas = {
|
||||
config: function (app) {
|
||||
assert.isTrue(!app.config);
|
||||
},
|
||||
exceptions: function (app) {
|
||||
|
||||
},
|
||||
directories: function (app) {
|
||||
assert.isTrue(!app.config.get('directories'))
|
||||
},
|
||||
log: function (app) {
|
||||
assert.isTrue(!app.log);
|
||||
//
|
||||
// TODO: Assert winston.extend methods
|
||||
//
|
||||
}
|
||||
};
|
||||
|
||||
assert.log = {};
|
||||
|
||||
assert.log.levelMsgMeta = function (err, level, msg, meta) {
|
||||
assert.equal(level, this.event[1]);
|
||||
assert.equal(msg, this.event[2]);
|
||||
assert.equal(meta, this.event[3]);
|
||||
};
|
||||
|
||||
assert.log.msgMeta = function (err, level, msg, meta) {
|
||||
assert.equal(level, this.event[0].split('::')[1] || 'info');
|
||||
assert.equal(msg, this.event[1]);
|
||||
assert.equal(meta, this.event[2]);
|
||||
};
|
||||
|
||||
assert.log.levelMeta = function (err, level, msg, meta) {
|
||||
assert.equal(level, this.event[1]);
|
||||
assert.equal(msg, this.event[0]);
|
||||
assert.deepEqual(meta, this.event[2]);
|
||||
};
|
||||
|
||||
assert.log.levelMsg = function (err, level, msg, meta) {
|
||||
assert.equal(level, this.event[1]);
|
||||
assert.equal(msg, this.event[2]);
|
||||
};
|
||||
|
||||
assert.log.metaOnly = function (err, level, msg, meta, event) {
|
||||
assert.equal(level, 'info');
|
||||
assert.equal(msg, this.event[0]);
|
||||
assert.equal(meta, this.event[1]);
|
||||
assert.equal(event, this.event[0]);
|
||||
};
|
||||
24
node_modules/broadway/test/helpers/helpers.js
generated
vendored
Normal file
24
node_modules/broadway/test/helpers/helpers.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* helpers.js: Test helpers for using broadway.
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var events = require('eventemitter2'),
|
||||
broadway = require('../../lib/broadway');
|
||||
|
||||
var helpers = exports;
|
||||
|
||||
helpers.findApp = function () {
|
||||
return Array.prototype.slice.call(arguments).filter(function (arg) {
|
||||
return arg instanceof events.EventEmitter2;
|
||||
})[0];
|
||||
};
|
||||
|
||||
helpers.mockApp = function () {
|
||||
var mock = new events.EventEmitter2({ delimiter: '::', wildcard: true });
|
||||
mock.options = {};
|
||||
return mock;
|
||||
};
|
||||
74
node_modules/broadway/test/helpers/macros.js
generated
vendored
Normal file
74
node_modules/broadway/test/helpers/macros.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* macros.js: Test macros for using broadway and vows
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var events = require('eventemitter2'),
|
||||
assert = require('./assert'),
|
||||
helpers = require('./helpers'),
|
||||
broadway = require('../../lib/broadway');
|
||||
|
||||
var macros = exports;
|
||||
|
||||
macros.shouldExtend = function (app, plugin, vows) {
|
||||
if (arguments.length === 1) {
|
||||
plugin = app;
|
||||
app = vows = null;
|
||||
}
|
||||
else if (arguments.length === 2) {
|
||||
app = helpers.mockApp();
|
||||
vows = plugin;
|
||||
plugin = app;
|
||||
}
|
||||
|
||||
var context = {
|
||||
topic: function () {
|
||||
app = app || helpers.mockApp();
|
||||
broadway.plugins[plugin].attach.call(app, app.options[plugin] || {});
|
||||
|
||||
if (broadway.plugins[plugin].init) {
|
||||
return broadway.plugins[plugin].init.call(app, this.callback.bind(this, null, app));
|
||||
}
|
||||
|
||||
this.callback(null, app);
|
||||
},
|
||||
"should add the appropriate properties and methods": function (_, app) {
|
||||
assert.plugins.has[plugin](app);
|
||||
}
|
||||
}
|
||||
|
||||
return extendContext(context, vows);
|
||||
};
|
||||
|
||||
macros.shouldLogEvent = function (app, event, vow) {
|
||||
return {
|
||||
topic: function () {
|
||||
app = app || helpers.findApp.apply(null, arguments);
|
||||
var logger = app.log.get('default');
|
||||
|
||||
this.event = event;
|
||||
app.once('broadway::logged', this.callback.bind(this, null));
|
||||
app.emit.apply(app, event);
|
||||
},
|
||||
"should log the appropriate info": vow
|
||||
};
|
||||
};
|
||||
|
||||
function extendContext (context, vows) {
|
||||
if (vows) {
|
||||
if (vows.topic) {
|
||||
console.log('Cannot include topic at top-level of nested vows:');
|
||||
console.dir(vows, 'vows');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
Object.keys(vows).forEach(function (key) {
|
||||
context[key] = vows[key];
|
||||
});
|
||||
}
|
||||
|
||||
return context;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user