diff options
| author | Florian Dold <florian.dold@gmail.com> | 2017-05-28 00:38:50 +0200 | 
|---|---|---|
| committer | Florian Dold <florian.dold@gmail.com> | 2017-05-28 00:40:43 +0200 | 
| commit | 7fff4499fd915bcea3fa93b1aa8b35f4fe7a6027 (patch) | |
| tree | 6de9a1aebd150a23b7f8c273ec657a5d0a18fe3e /node_modules/time-require | |
| parent | 963b7a41feb29cc4be090a2446bdfe0c1f1bcd81 (diff) | |
add linting (and some initial fixes)
Diffstat (limited to 'node_modules/time-require')
29 files changed, 1301 insertions, 0 deletions
diff --git a/node_modules/time-require/CHANGELOG.md b/node_modules/time-require/CHANGELOG.md new file mode 100644 index 000000000..ef58ed90d --- /dev/null +++ b/node_modules/time-require/CHANGELOG.md @@ -0,0 +1,18 @@ +`time-require` changelog +====================== + +- v0.1.2 (2014.04.20) +	* README.md: add NPM downloads and GitHub release, add `gulpt` usage, remove BitBucket hosting/refs +	* package.json: update dependencies +	* .npmignore: remove all development-related files from NPM (clone the repo instead) +- v0.1.1 (2014.04.10) +	* gulpfile.js: add `notifyError` for stream error notification, add `seqTask` for sequential task control, fix `project.js` config replacing `lib/` with `src/` +	* README.md: detail project hosting [@BitBucket](https://bitbucket.org/jaguard/time-require) & mirror [@GitHub](https://github.com/jaguard/time-require). +	* LICENSE.md renamed to LICENSE to keep it as a simple text file +	* package.json: set the [GitHub](https://github.com/jaguard/time-require) mirror as repository, add `run-sequence` for task order control, add `gulp-notify` for notification support +- v0.1.0 (2014.04.10) +	+ Added `.travis.yml` file for travis-ci.org build support +	+ Published `time-require` module to [npm](https://www.npmjs.org/package/time-require) +	* Include screenshoots as absolute links +- v0.0.1 (2014.03.10) +	+ Initial release
\ No newline at end of file diff --git a/node_modules/time-require/LICENSE b/node_modules/time-require/LICENSE new file mode 100644 index 000000000..95160d592 --- /dev/null +++ b/node_modules/time-require/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2014 Jaguard +MIT License - http://opensource.org/licenses/mit-license.php + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/time-require/README.md b/node_modules/time-require/README.md new file mode 100644 index 000000000..7bc759af6 --- /dev/null +++ b/node_modules/time-require/README.md @@ -0,0 +1,79 @@ +# `time-require` @ [](http://oss.jaguard.com) [](http://gulpjs.com) + +> Displays the execution time for Node.js modules loading by hooking and tracing all `require()` calls. +This module was inspired by [@sindresorhus](https://twitter.com/sindresorhus)'s [time-grunt](https://github.com/sindresorhus/time-grunt). + +## Project status +- NPM version: [](https://www.npmjs.org/package/time-require) +- NPM downloads: [](https://www.npmjs.org/package/time-require) +- GitHub release: [](https://www.npmjs.org/package/time-require) +- Travis-CI build: [](http://travis-ci.org/jaguard/time-require) +- Drone.io build: [](https://github.com/jaguard/time-require) +- Dependencies: [](https://david-dm.org/jaguard/time-require#info=dependencies) +- Dev Dependencies: [](https://david-dm.org/jaguard/time-require#info=devDependencies) + +Default usage (non-verbose) showing required modules in loaded order, above 1% treshold + + +Verbose (all) & sorted usage showing all required modules in sorted order + + +## Install + +Install with [npm](https://npmjs.org/package/time-require) + +``` +npm install --save time-require +``` + +## Usage + +1. Embeded usage, generally as first `require()` call in your main module. +```js +require("time-require"); +``` +2. External usage with `--require` preload supported by [Liftoff](https://github.com/tkellen/node-liftoff) driven CLI modules like [gulp.js](http://gulpjs.com/) or [Grunt-Next](https://github.com/gruntjs/grunt-next) +``` +gulp --require time-require --sorted +``` +3. If you're using [gulp.js](http://gulpjs.com/), use instead [gulpt](https://github.com/jaguard/gulpt), a `gulp` CLI wrapper that automatically preload `time-require`. +``` +npm install -g gulpt +gulpt build --sorted +``` + +## Display layout + +Modules loading that take less than `1%` of the total time are hidden to reduce clutter. +To show **all** the modules use the `--verbose` (or `--V`) flag on the running CLI. +To **sort** the modules according to the loading time (longest on top) use the `--sorted` (or `--s`) flag on the running CLI. + +## Documentation + +Detailed API documentation can be found in ['doc'](doc/api.md) folder. + +## Development + +Detailed development documentation can be found in ['doc'](doc/dev.md) folder. + +## License + +[MIT](https://github.com/jaguard/time-require/raw/master/LICENSE) © [Jaguard OSS](http://oss.jaguard.com) + +## Changelog + +- v0.1.2 (2014.04.20) +	* README.md: add NPM downloads and GitHub release, add `gulpt` usage, remove BitBucket hosting/refs +	* package.json: update dependencies +	* .npmignore: remove all development-related files from NPM (clone the repo instead) +- v0.1.1 (2014.04.10) +	* gulpfile.js: add `notifyError` for stream error notification, add `seqTask` for sequential task control, fix `project.js` config replacing `lib/` with `src/` +	* README.md: detail project hosting [@BitBucket](https://bitbucket.org/jaguard/time-require) & mirror [@GitHub](https://github.com/jaguard/time-require). +	* LICENSE.md renamed to LICENSE to keep it as a simple text file +	* package.json: set the [GitHub](https://github.com/jaguard/time-require) mirror as repository, add `run-sequence` for task order control, add `gulp-notify` for notification support +- v0.1.0 (2014.04.10) +	+ Added `.travis.yml` file for travis-ci.org build support +	+ Published `time-require` module to [npm](https://www.npmjs.org/package/time-require) +	* Include screenshoots as absolute links +- v0.0.1 (2014.03.10) +	+ Initial release
\ No newline at end of file diff --git a/node_modules/time-require/doc/api.md b/node_modules/time-require/doc/api.md new file mode 100644 index 000000000..b143de468 --- /dev/null +++ b/node_modules/time-require/doc/api.md @@ -0,0 +1,3 @@ +## API documentation for time-require
 +
 +TODO: Detail usage
 diff --git a/node_modules/time-require/doc/dev.md b/node_modules/time-require/doc/dev.md new file mode 100644 index 000000000..96f629804 --- /dev/null +++ b/node_modules/time-require/doc/dev.md @@ -0,0 +1,32 @@ +## Developer documentation for `time-require`
 +
 +`time-require` use [gulp.js](http://gulpjs.com) for build
 +
 +#### clean
 +```
 +gulp clean
 +```
 +#### build
 +```
 +gulp
 +```
 +or explicitelly
 +```
 +gulp build
 +```
 +#### run tests
 +```
 +gulp test
 +```
 +#### lint all sources
 +```
 +gulp lint
 +```
 +#### generate documentation
 +```
 +gulp doc
 +```
 +#### watch
 +```
 +gulp watch
 +```
\ No newline at end of file diff --git a/node_modules/time-require/doc/time_require_default.png b/node_modules/time-require/doc/time_require_default.png Binary files differnew file mode 100644 index 000000000..081969c64 --- /dev/null +++ b/node_modules/time-require/doc/time_require_default.png diff --git a/node_modules/time-require/doc/time_require_verbose_sorted.png b/node_modules/time-require/doc/time_require_verbose_sorted.png Binary files differnew file mode 100644 index 000000000..ec7300a09 --- /dev/null +++ b/node_modules/time-require/doc/time_require_verbose_sorted.png diff --git a/node_modules/time-require/node_modules/.bin/pretty-ms b/node_modules/time-require/node_modules/.bin/pretty-ms new file mode 120000 index 000000000..e00b450ee --- /dev/null +++ b/node_modules/time-require/node_modules/.bin/pretty-ms @@ -0,0 +1 @@ +../pretty-ms/cli.js
\ No newline at end of file diff --git a/node_modules/time-require/node_modules/ansi-styles/ansi-styles.js b/node_modules/time-require/node_modules/ansi-styles/ansi-styles.js new file mode 100644 index 000000000..3da548c40 --- /dev/null +++ b/node_modules/time-require/node_modules/ansi-styles/ansi-styles.js @@ -0,0 +1,38 @@ +'use strict'; +var styles = module.exports; + +var codes = { +	reset: [0, 0], + +	bold: [1, 22], +	italic: [3, 23], +	underline: [4, 24], +	inverse: [7, 27], +	strikethrough: [9, 29], + +	black: [30, 39], +	red: [31, 39], +	green: [32, 39], +	yellow: [33, 39], +	blue: [34, 39], +	magenta: [35, 39], +	cyan: [36, 39], +	white: [37, 39], +	gray: [90, 39], + +	bgBlack: [40, 49], +	bgRed: [41, 49], +	bgGreen: [42, 49], +	bgYellow: [43, 49], +	bgBlue: [44, 49], +	bgMagenta: [45, 49], +	bgCyan: [46, 49], +	bgWhite: [47, 49] +}; + +Object.keys(codes).forEach(function (key) { +	var val = codes[key]; +	var style = styles[key] = {}; +	style.open = '\x1b[' + val[0] + 'm'; +	style.close = '\x1b[' + val[1] + 'm'; +}); diff --git a/node_modules/time-require/node_modules/ansi-styles/package.json b/node_modules/time-require/node_modules/ansi-styles/package.json new file mode 100644 index 000000000..f0af5291d --- /dev/null +++ b/node_modules/time-require/node_modules/ansi-styles/package.json @@ -0,0 +1,52 @@ +{ +  "name": "ansi-styles", +  "version": "1.0.0", +  "description": "ANSI escape codes for colorizing strings in the terminal", +  "keywords": [ +    "ansi", +    "styles", +    "color", +    "colour", +    "colors", +    "terminal", +    "console", +    "cli", +    "string", +    "tty", +    "escape", +    "formatting", +    "rgb", +    "256", +    "shell", +    "xterm", +    "log", +    "logging", +    "command-line", +    "text" +  ], +  "homepage": "https://github.com/sindresorhus/ansi-styles", +  "bugs": "https://github.com/sindresorhus/ansi-styles/issues", +  "license": "MIT", +  "author": { +    "name": "Sindre Sorhus", +    "email": "sindresorhus@gmail.com", +    "url": "http://sindresorhus.com" +  }, +  "files": [ +    "ansi-styles.js" +  ], +  "main": "ansi-styles", +  "repository": { +    "type": "git", +    "url": "git://github.com/sindresorhus/ansi-styles.git" +  }, +  "scripts": { +    "test": "mocha" +  }, +  "devDependencies": { +    "mocha": "~1.12.0" +  }, +  "engines": { +    "node": ">=0.8.0" +  } +} diff --git a/node_modules/time-require/node_modules/ansi-styles/readme.md b/node_modules/time-require/node_modules/ansi-styles/readme.md new file mode 100644 index 000000000..4ac8cbd0a --- /dev/null +++ b/node_modules/time-require/node_modules/ansi-styles/readme.md @@ -0,0 +1,65 @@ +# ansi-styles [](http://travis-ci.org/sindresorhus/ansi-styles) + +> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for colorizing strings in the terminal. + +You probably want the higher-level [chalk](https://github.com/sindresorhus/chalk) module for styling your strings. + + + + +## Install + +Install with [npm](https://npmjs.org/package/ansi-styles): `npm install --save ansi-styles` + + +## Example + +```js +var ansi = require('ansi-styles'); + +console.log(ansi.green.open + 'Hello world!' + ansi.green.close); +``` + +## API + +Each style has an `open` and `close` property. + + +## Styles + +### General + +- reset +- bold +- italic +- underline +- inverse +- strikethrough + +### Text colors + +- black +- red +- green +- yellow +- blue +- magenta +- cyan +- white +- gray + +### Background colors + +- bgBlack +- bgRed +- bgGreen +- bgYellow +- bgBlue +- bgMagenta +- bgCyan +- bgWhite + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/time-require/node_modules/chalk/index.js b/node_modules/time-require/node_modules/chalk/index.js new file mode 100644 index 000000000..a21f70223 --- /dev/null +++ b/node_modules/time-require/node_modules/chalk/index.js @@ -0,0 +1,63 @@ +'use strict'; +var ansi = require('ansi-styles'); +var stripAnsi = require('strip-ansi'); +var hasColor = require('has-color'); +var defineProps = Object.defineProperties; +var chalk = module.exports; + +var styles = (function () { +	var ret = {}; + +	ansi.grey = ansi.gray; + +	Object.keys(ansi).forEach(function (key) { +		ret[key] = { +			get: function () { +				this._styles.push(key); +				return this; +			} +		}; +	}); + +	return ret; +})(); + +function init() { +	var ret = {}; + +	Object.keys(styles).forEach(function (name) { +		ret[name] = { +			get: function () { +				var obj = defineProps(function self() { +					var str = [].slice.call(arguments).join(' '); + +					if (!chalk.enabled) { +						return str; +					} + +					return self._styles.reduce(function (str, name) { +						var code = ansi[name]; +						return str ? code.open + str + code.close : ''; +					}, str); +				}, styles); + +				obj._styles = []; + +				return obj[name]; +			} +		} +	}); + +	return ret; +} + +defineProps(chalk, init()); + +chalk.styles = ansi; +chalk.stripColor = stripAnsi; +chalk.supportsColor = hasColor; + +// detect mode if not set manually +if (chalk.enabled === undefined) { +	chalk.enabled = chalk.supportsColor; +} diff --git a/node_modules/time-require/node_modules/chalk/node_modules/.bin/strip-ansi b/node_modules/time-require/node_modules/chalk/node_modules/.bin/strip-ansi new file mode 120000 index 000000000..f7646606c --- /dev/null +++ b/node_modules/time-require/node_modules/chalk/node_modules/.bin/strip-ansi @@ -0,0 +1 @@ +../../../strip-ansi/cli.js
\ No newline at end of file diff --git a/node_modules/time-require/node_modules/chalk/package.json b/node_modules/time-require/node_modules/chalk/package.json new file mode 100644 index 000000000..448f75aac --- /dev/null +++ b/node_modules/time-require/node_modules/chalk/package.json @@ -0,0 +1,50 @@ +{ +  "name": "chalk", +  "version": "0.4.0", +  "description": "Terminal string styling done right. Created because the `colors` module does some really horrible things.", +  "license": "MIT", +  "repository": "sindresorhus/chalk", +  "author": { +    "name": "Sindre Sorhus", +    "email": "sindresorhus@gmail.com", +    "url": "http://sindresorhus.com" +  }, +  "engines": { +    "node": ">=0.8.0" +  }, +  "scripts": { +    "test": "mocha" +  }, +  "files": [ +    "index.js" +  ], +  "keywords": [ +    "color", +    "colour", +    "colors", +    "terminal", +    "console", +    "cli", +    "string", +    "ansi", +    "styles", +    "tty", +    "formatting", +    "rgb", +    "256", +    "shell", +    "xterm", +    "log", +    "logging", +    "command-line", +    "text" +  ], +  "dependencies": { +    "has-color": "~0.1.0", +    "ansi-styles": "~1.0.0", +    "strip-ansi": "~0.1.0" +  }, +  "devDependencies": { +    "mocha": "~1.x" +  } +} diff --git a/node_modules/time-require/node_modules/chalk/readme.md b/node_modules/time-require/node_modules/chalk/readme.md new file mode 100644 index 000000000..46813acfc --- /dev/null +++ b/node_modules/time-require/node_modules/chalk/readme.md @@ -0,0 +1,158 @@ +# <img width="250" src="logo.png" alt="chalk"> + +> Terminal string styling done right + +[](http://travis-ci.org/sindresorhus/chalk) + +[colors.js](https://github.com/Marak/colors.js) is currently the most popular string styling module, but it has serious deficiencies like extending String.prototype which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68). Although there are other ones, they either do too much or not enough. + +**Chalk is a clean and focused alternative.** + + + + +## Why + +- **Doesn't extend String.prototype** +- Expressive API +- Clean and focused +- Auto-detects color support +- Actively maintained +- [Used by 150+ modules](https://npmjs.org/browse/depended/chalk) + + +## Install + +Install with [npm](https://npmjs.org/package/chalk): `npm install --save chalk` + + +## Example + +Chalk comes with an easy to use composable API where you just chain and nest the styles you want. + +```js +var chalk = require('chalk'); + +// style a string +console.log(  chalk.blue('Hello world!')  ); + +// combine styled and normal strings +console.log(  chalk.blue('Hello'), 'World' + chalk.red('!')  ); + +// compose multiple styles using the chainable API +console.log(  chalk.blue.bgRed.bold('Hello world!')  ); + +// nest styles +console.log(  chalk.red('Hello', chalk.underline.bgBlue('world') + '!')  ); + +// pass in multiple arguments +console.log(  chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz')  ); +``` + +You can easily define your own themes. + +```js +var chalk = require('chalk'); +var error = chalk.bold.red; +console.log(error('Error!')); +``` + + +## API + +### chalk.`<style>[.<style>...](string, [string...])` + +Example: `chalk.red.bold.underline('Hello', 'world');` + +Chain [styles](#styles) and call the last one as a method with a string argument. Order doesn't matter. + +Multiple arguments will be separated by space. + +### chalk.enabled + +Color support is automatically detected, but you can override it. + +### chalk.supportsColor + +Detect whether the terminal [supports color](https://github.com/sindresorhus/has-color). + +Can be overridden by the user with the flags `--color` and `--no-color`. + +Used internally and handled for you, but exposed for convenience. + +### chalk.styles + +Exposes the styles as [ANSI escape codes](https://github.com/sindresorhus/ansi-styles). + +Generally not useful, but you might need just the `.open` or `.close` escape code if you're mixing externally styled strings with yours. + +```js +var chalk = require('chalk'); + +console.log(chalk.styles.red); +//=> {open: '\x1b[31m', close: '\x1b[39m'} + +console.log(chalk.styles.red.open + 'Hello' + chalk.styles.red.close); +``` + +### chalk.stripColor(string) + +[Strip color](https://github.com/sindresorhus/strip-ansi) from a string. + +Can be useful in combination with `.supportsColor` to strip color on externally styled text when it's not supported. + +Example: + +```js +var chalk = require('chalk'); +var styledString = fromExternal(); + +if (!chalk.supportsColor) { +	chalk.stripColor(styledString); +} +``` + + +## Styles + +### General + +- reset +- bold +- italic +- underline +- inverse +- strikethrough + +### Text colors + +- black +- red +- green +- yellow +- blue +- magenta +- cyan +- white +- gray + +### Background colors + +- bgBlack +- bgRed +- bgGreen +- bgYellow +- bgBlue +- bgMagenta +- bgCyan +- bgWhite + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) + + +- + +[](https://bitdeli.com/free "Bitdeli Badge") diff --git a/node_modules/time-require/node_modules/parse-ms/index.js b/node_modules/time-require/node_modules/parse-ms/index.js new file mode 100644 index 000000000..24f775d43 --- /dev/null +++ b/node_modules/time-require/node_modules/parse-ms/index.js @@ -0,0 +1,14 @@ +'use strict'; +module.exports = function (ms) { +	if (typeof ms !== 'number') { +		throw new TypeError('Expected a number'); +	} + +	return { +		days: Math.floor(ms / 86400000), +		hours: Math.floor(ms / 3600000 % 24), +		minutes: Math.floor(ms / 60000 % 60), +		seconds: Math.floor(ms / 1000 % 60), +		milliseconds: Math.floor(ms % 1000) +	}; +}; diff --git a/node_modules/time-require/node_modules/parse-ms/package.json b/node_modules/time-require/node_modules/parse-ms/package.json new file mode 100644 index 000000000..3df5f30e2 --- /dev/null +++ b/node_modules/time-require/node_modules/parse-ms/package.json @@ -0,0 +1,36 @@ +{ +  "name": "parse-ms", +  "version": "0.1.2", +  "description": "Parse milliseconds into an object", +  "license": "MIT", +  "repository": "sindresorhus/parse-ms", +  "author": { +    "name": "Sindre Sorhus", +    "email": "sindresorhus@gmail.com", +    "url": "http://sindresorhus.com" +  }, +  "engines": { +    "node": ">=0.10.0" +  }, +  "scripts": { +    "test": "mocha", +    "browser": "browserify -s $npm_package_name -o browser.js ." +  }, +  "files": [ +    "index.js" +  ], +  "keywords": [ +    "browser", +    "parse", +    "time", +    "ms", +    "milliseconds", +    "duration", +    "period", +    "range" +  ], +  "devDependencies": { +    "mocha": "*", +    "browserify": "^3.0.0" +  } +} diff --git a/node_modules/time-require/node_modules/parse-ms/readme.md b/node_modules/time-require/node_modules/parse-ms/readme.md new file mode 100644 index 000000000..ded23c56f --- /dev/null +++ b/node_modules/time-require/node_modules/parse-ms/readme.md @@ -0,0 +1,31 @@ +# parse-ms [](https://travis-ci.org/sindresorhus/parse-ms) + +> Parse milliseconds into an object + + +## Install + +```sh +$ npm install --save parse-ms +``` + +```sh +$ bower install --save parse-ms +``` + +```sh +$ component install sindresorhus/parse-ms +``` + + +## Usage + +```js +parseMs(1337000001); +//=> { days: 15, hours: 11, minutes: 23, seconds: 20, milliseconds: 1 } +``` + + +## License + +[MIT](http://opensource.org/licenses/MIT) © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/time-require/node_modules/pretty-ms/cli.js b/node_modules/time-require/node_modules/pretty-ms/cli.js new file mode 100755 index 000000000..529fec3fe --- /dev/null +++ b/node_modules/time-require/node_modules/pretty-ms/cli.js @@ -0,0 +1,51 @@ +#!/usr/bin/env node +'use strict'; +var pkg = require('./package.json'); +var prettyMs = require('./index'); +var input = process.argv[2]; + +function stdin(cb) { +	var ret = ''; +	process.stdin.setEncoding('utf8'); +	process.stdin.on('data', function (data) { ret += data }); +	process.stdin.on('end', function () { cb(ret) }).resume(); +} + +function help() { +	console.log(pkg.description); +	console.log(''); +	console.log('Usage'); +	console.log('  $ pretty-ms <milliseconds> [--compact]'); +	console.log('  $ echo <milliseconds> | pretty-ms'); +	console.log(''); +	console.log('Example'); +	console.log('  $ pretty-ms 1337'); +	console.log('  1s 337ms'); +} + +function init(data) { +	console.log(prettyMs(Number(data), { +		compact: process.argv.indexOf('--compact') !== -1 +	})); +} + +if (process.argv.indexOf('-h') !== -1 || process.argv.indexOf('--help') !== -1) { +	help(); +	return; +} + +if (process.argv.indexOf('-v') !== -1 || process.argv.indexOf('--version') !== -1) { +	console.log(pkg.version); +	return; +} + +if (process.stdin.isTTY) { +	if (!input) { +		help(); +		return; +	} + +	init(input); +} else { +	stdin(init); +} diff --git a/node_modules/time-require/node_modules/pretty-ms/index.js b/node_modules/time-require/node_modules/pretty-ms/index.js new file mode 100644 index 000000000..4c3db8bc7 --- /dev/null +++ b/node_modules/time-require/node_modules/pretty-ms/index.js @@ -0,0 +1,38 @@ +'use strict'; +var parseMs = require('parse-ms'); + +function add(ret, val, postfix) { +	if (val > 0) { +		ret.push(val + postfix); +	} + +	return ret; +} + +module.exports = function (ms, opts) { +	if (typeof ms !== 'number') { +		throw new TypeError('Expected a number'); +	} + +	if (ms < 1000) { +		return Math.ceil(ms) + 'ms'; +	} + +	opts = opts || {}; + +	var ret = []; +	var parsed = parseMs(ms); + +	ret = add(ret, parsed.days, 'd'); +	ret = add(ret, parsed.hours, 'h'); +	ret = add(ret, parsed.minutes, 'm'); + +	if (opts.compact) { +		ret = add(ret, parsed.seconds, 's'); +		return '~' + ret[0]; +	} + +	ret = add(ret, (ms / 1000 % 60).toFixed(1).replace(/\.0$/, ''), 's'); + +	return ret.join(' '); +}; diff --git a/node_modules/time-require/node_modules/pretty-ms/package.json b/node_modules/time-require/node_modules/pretty-ms/package.json new file mode 100644 index 000000000..a561a12a2 --- /dev/null +++ b/node_modules/time-require/node_modules/pretty-ms/package.json @@ -0,0 +1,48 @@ +{ +  "name": "pretty-ms", +  "version": "0.2.2", +  "description": "Convert milliseconds to a human readable string: 1337000000 ➔ 15d 11h 23m 20s", +  "license": "MIT", +  "repository": "sindresorhus/pretty-ms", +  "bin": { +    "pretty-ms": "cli.js" +  }, +  "author": { +    "name": "Sindre Sorhus", +    "email": "sindresorhus@gmail.com", +    "url": "http://sindresorhus.com" +  }, +  "engines": { +    "node": ">=0.10.0" +  }, +  "scripts": { +    "test": "mocha", +    "browser": "browserify -s $npm_package_name -o browser.js ." +  }, +  "files": [ +    "index.js", +    "cli.js" +  ], +  "keywords": [ +    "cli", +    "bin", +    "browser", +    "pretty", +    "human", +    "humanized", +    "readable", +    "time", +    "ms", +    "milliseconds", +    "duration", +    "period", +    "range" +  ], +  "dependencies": { +    "parse-ms": "^0.1.0" +  }, +  "devDependencies": { +    "mocha": "*", +    "browserify": "^3.0.0" +  } +} diff --git a/node_modules/time-require/node_modules/pretty-ms/readme.md b/node_modules/time-require/node_modules/pretty-ms/readme.md new file mode 100644 index 000000000..cdad7db92 --- /dev/null +++ b/node_modules/time-require/node_modules/pretty-ms/readme.md @@ -0,0 +1,80 @@ +# pretty-ms [](https://travis-ci.org/sindresorhus/pretty-ms) + +> Convert milliseconds to a human readable string: `1337000000` ➔ `15d 11h 23m 20s` + + +## Install + +```sh +$ npm install --save pretty-ms +``` + +```sh +$ bower install --save pretty-ms +``` + +```sh +$ component install sindresorhus/pretty-ms +``` + + +## Usage + +```js +prettyMs(1337000000); +//=> '15d 11h 23m 20s' + +prettyMs(1337); +//=> '1.3s' + +prettyMs(133); +//=> '133ms' + +// compact option +prettyMs(1337, {compact: true}); +//=> '~1s' + +// can be useful for time durations +prettyMs(new Date(2014, 0, 1, 10, 40) - new Date(2014, 0, 1, 10, 5)) +//=> '35m' +``` + + +## API + +### prettyMs(milliseconds, options) + +#### milliseconds + +*Required*   +Type: `number` + +#### options.compact + +Type: `boolean` + +Only show the first unit: `1h 10m` ➔ `~1h`. + + +## CLI + +```bash +$ npm install --global pretty-ms +``` + +```bash +$ pretty-ms --help + +Usage +  $ pretty-ms <milliseconds> [--compact] +  $ echo <milliseconds> | pretty-ms + +Example +  $ pretty-ms 1337 +  1.3s +``` + + +## License + +[MIT](http://opensource.org/licenses/MIT) © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/time-require/node_modules/strip-ansi/cli.js b/node_modules/time-require/node_modules/strip-ansi/cli.js new file mode 100755 index 000000000..f8019cdae --- /dev/null +++ b/node_modules/time-require/node_modules/strip-ansi/cli.js @@ -0,0 +1,27 @@ +#!/usr/bin/env node +'use strict'; +var fs = require('fs'); +var strip = require('./index'); +var input = process.argv[2]; + +if (process.argv.indexOf('-h') !== -1 || process.argv.indexOf('--help') !== -1) { +	console.log('strip-ansi <input file> > <output file>'); +	console.log('or'); +	console.log('cat <input file> | strip-ansi > <output file>'); +	return; +} + +if (process.argv.indexOf('-v') !== -1 || process.argv.indexOf('--version') !== -1) { +	console.log(require('./package').version); +	return; +} + +if (input) { +	process.stdout.write(strip(fs.readFileSync(input, 'utf8'))); +	return; +} + +process.stdin.setEncoding('utf8'); +process.stdin.on('data', function (data) { +	process.stdout.write(strip(data)); +}); diff --git a/node_modules/time-require/node_modules/strip-ansi/index.js b/node_modules/time-require/node_modules/strip-ansi/index.js new file mode 100644 index 000000000..62320c591 --- /dev/null +++ b/node_modules/time-require/node_modules/strip-ansi/index.js @@ -0,0 +1,4 @@ +'use strict'; +module.exports = function (str) { +	return typeof str === 'string' ? str.replace(/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]/g, '') : str; +}; diff --git a/node_modules/time-require/node_modules/strip-ansi/package.json b/node_modules/time-require/node_modules/strip-ansi/package.json new file mode 100644 index 000000000..406b90164 --- /dev/null +++ b/node_modules/time-require/node_modules/strip-ansi/package.json @@ -0,0 +1,53 @@ +{ +  "name": "strip-ansi", +  "version": "0.1.1", +  "description": "Strip ANSI escape codes (used for colorizing strings in the terminal)", +  "license": "MIT", +  "bin": { +    "strip-ansi": "cli.js" +  }, +  "repository": "sindresorhus/strip-ansi", +  "author": { +    "name": "Sindre Sorhus", +    "email": "sindresorhus@gmail.com", +    "url": "http://sindresorhus.com" +  }, +  "engines": { +    "node": ">=0.8.0" +  }, +  "scripts": { +    "test": "mocha" +  }, +  "files": [ +    "index.js", +    "cli.js" +  ], +  "keywords": [ +    "strip", +    "trim", +    "remove", +    "ansi", +    "styles", +    "color", +    "colour", +    "colors", +    "terminal", +    "console", +    "cli", +    "string", +    "tty", +    "escape", +    "formatting", +    "rgb", +    "256", +    "shell", +    "xterm", +    "log", +    "logging", +    "command-line", +    "text" +  ], +  "devDependencies": { +    "mocha": "~1.x" +  } +} diff --git a/node_modules/time-require/node_modules/strip-ansi/readme.md b/node_modules/time-require/node_modules/strip-ansi/readme.md new file mode 100644 index 000000000..eb661b3d8 --- /dev/null +++ b/node_modules/time-require/node_modules/strip-ansi/readme.md @@ -0,0 +1,46 @@ +# strip-ansi [](http://travis-ci.org/sindresorhus/strip-ansi) + +> Strip [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) (used for colorizing strings in the terminal) + +Used in the terminal color module [chalk](https://github.com/sindresorhus/chalk). + + +## Install + +Install locally with [npm](https://npmjs.org/package/strip-ansi): + +``` +npm install --save strip-ansi +``` + +Or globally if you want to use it as a CLI app: + +``` +npm install --global strip-ansi +``` + +You can then use it in your Terminal like: + +``` +strip-ansi file-with-color-codes +``` + +Or pipe something to it: + +``` +ls | strip-ansi +``` + + +## Example + +```js +var stripAnsi = require('strip-ansi'); +stripAnsi('\x1b[4mcake\x1b[0m'); +//=> cake +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/time-require/package.json b/node_modules/time-require/package.json new file mode 100644 index 000000000..2b93ba06e --- /dev/null +++ b/node_modules/time-require/package.json @@ -0,0 +1,60 @@ +{ +	"name": "time-require", +	"version": "0.1.2", +	"description": "Displays the execution time for Node.js modules loading; inspired by @sindresorhus 'time-grunt'", +	"homepage": "https://github.com/jaguard/time-require", +	"keywords": ["require", "measure", "time", "profile"], +	"author": { +		"name": "Jaguard OSS", +		"email": "oss@jaguard.com", +		"url": "http://oss.jaguard.com" +	}, +	"repository": { +		"type": "git", +		"url": "git://github.com/jaguard/time-require" +	}, +	"bugs": { +		"url": "https://github.com/jaguard/time-require/issues" +	}, +	"main": "src/timeRequire.js", +	"scripts": { +		"start": "gulp watch", +		"test": "gulp test" +	}, +	"dependencies": { +		"chalk": "^0.4.0", +		"text-table": "^0.2.0", +		"date-time": "^0.1.1", +		"pretty-ms": "^0.2.1" +	}, +	"devDependencies": { +		"gulp": "~3.6.0", +		"gulp-util": "~2.2.14", +		"gulp-load-plugins": "~0.5.0", +		"run-sequence": "~0.3.6", +		"gulp-clean": "~0.2.4", +		"gulp-cached": "~0.0.3", +		"gulp-jshint": "~1.5.2", +		"gulp-jsonlint": "~0.0.3", +		"gulp-if": "~1.0.0", +		"gulp-match": "~0.0.2", +		"gulp-jscs": "~0.4.0", +		"gulp-docco": "~0.0.4", +		"gulp-jsdoc": "~0.1.4", +		"gulp-markdown": "~0.1.2", +		"gulp-markdown-pdf": "~0.2.0", +		"gulp-jasmine": "~0.2.0", +		"gulp-notify": "~1.2.5", +		"jshint-stylish": "~0.1.5" +	}, +	"licenses": [ +		{ +			"type": "MIT", +			"url": "https://github.com/jaguard/time-require/raw/master/LICENSE" +		} +	], +	"engines": { +		"node": ">= 0.10.0" +	}, +	"readmeFilename": "README.md" +}
\ No newline at end of file diff --git a/node_modules/time-require/src/requireHook.js b/node_modules/time-require/src/requireHook.js new file mode 100644 index 000000000..ebafbb603 --- /dev/null +++ b/node_modules/time-require/src/requireHook.js @@ -0,0 +1,93 @@ +/** + * requireHook - module wrapping a function that register require() listener and returns hook/unhook control + * + * @author Ciprian Popa (cyparu) + * @since 0.0.1 + * @version 0.0.1 + */ + +"use strict"; + +var Module = require("module").Module, +		_load = Module._load, +		_hookedAt, _listener; + +/** + * Module hooker function that will replace Module._load and invoke the _listener with module and timing information + * + * @function _hooker + */ +function _hooker(name, parent) { +	var timeIn = Date.now(), +			exports = _load.apply(Module, arguments), +			timeOut = Date.now(), +			mod = parent.children[parent.children.length - 1]; // should be the last loaded children +	// call the listener +	_listener({ +		name: name, +		parent: parent, +		module: mod, +		filename: mod ? mod.filename : name, +		exports: exports, +		requiredOn: timeIn, +		startedIn: timeOut - timeIn +	}); +	return exports; +} + +/** + * Hook Node's require() so the configured callback will be invocked with additional module and time loading information information + * + * @param {Function} [listener] - optional listener if + * @method hook + */ +function _hook(listener) { +	if (typeof listener !== "undefined") { +		if (typeof listener !== "function") { +			throw new Error("The optional parameter for hook() should be a function but was " + (typeof listener)); +		} +		// set the listener +		_listener = listener; +	} +	// set the hoocker loader +	Module._load = _hooker; +	// mark hooked time +	_hookedAt = new Date(); +} + +/** + * Unhook Node's require() to the original function + * + * @method unhook + */ +function _unhook() { +	// set the original loader +	Module._load = _load; +	// reset hooking time +	_hookedAt = undefined; +} + +/** + * Export a function that set the callback and return hook/unhook control functionality + * + * @function + * @param {Function} listener - require() listener + * @param {Boolean} [autohook=true] - optional flag telling if the hooking will be started automatically + * @return hook/unhook control function + */ +module.exports = function(listener, autohook) { +	if (typeof listener !== "function") { +		throw new Error("The hooking function should be set"); +	} +	// set the listener +	_listener = listener; +	// if autohook (by default), +	if (autohook !== false) { +		_hook(); +	} +	return { +		hookedAt: _hookedAt, +		hook: _hook, +		unhook: _unhook +	}; +}; diff --git a/node_modules/time-require/src/timeRequire.js b/node_modules/time-require/src/timeRequire.js new file mode 100644 index 000000000..0ba556fab --- /dev/null +++ b/node_modules/time-require/src/timeRequire.js @@ -0,0 +1,140 @@ +/** + * timeRequire - measure the time to load all the subsequnt modules by hoocking require() calls + * + * @author Ciprian Popa (cyparu) + * @since 0.0.1 + * @version 0.0.1 + */ + +"use strict"; + +var // setup vars +		requireData = [], +		write = process.stdout.write.bind(process.stdout), +		relative = require("path").relative, +		cwd = process.cwd(), +		// require hooker should be first module loaded so all the other requires should count as well +		/* jshint -W003 */ +		hook = require("./requireHook")(_hooker), +		table = require("text-table"), +		dateTime = require("date-time"), +		prettyMs = require("pretty-ms"), +		chalk = require("chalk"), +		// extra locals +		DEFAULT_COLUMNS = 80, +		BAR_CHAR = process.platform === "win32" ? "■" : "▇", +		sorted = hasArg("--sorted") || hasArg("--s"), +		treshold = (hasArg("--verbose") || hasArg("--V")) ? 0.0: 0.01, // TODO - configure treshold using CLI ? +		EXTRA_COLUMNS = sorted ? 24 : 20; + +function hasArg(arg) { +	return process.argv.indexOf(arg) !== -1; +} + +function pad(count, seq) { +	return (count > 1) ? new Array(count).join(seq) : ""; +} + +function log(str) { +	write(str + "\n", "utf8"); +} + +/** + * Callback/listener used by requireHook hook to collect all the modules in their loading order + */ +function _hooker(data) { +	var filename = relative(cwd, data.filename); +	// use the shortest name +	if (filename.length > data.filename) { +		filename = data.filename; +	} +	requireData.push({ +		order: requireData.length, // loading order +		time: data.startedIn, // time +		label: data.name + " (" + filename + ")" +//		name: data.name, +//		filename: filename +	}); +} + +function formatTable(tableData, totalTime) { +	var NAME_FILE_REX = /(.+)( \(.+\))/, +			maxColumns = process.stdout.columns || DEFAULT_COLUMNS, +			validCount = 0, +			longestRequire = tableData.reduce(function(acc, data) { +				var avg = data.time / totalTime; +				if (avg < treshold) { +					return acc; +				} +				validCount++; +				return Math.max(acc, data.label.length); +			}, 0), +			maxBarWidth = (longestRequire > maxColumns / 2) ? ((maxColumns - EXTRA_COLUMNS) / 2) : (maxColumns - (longestRequire + EXTRA_COLUMNS)), +			processedTableData = [], +			counter, maxOrderChars; + +	function shorten(name) { +		var nameLength = name.length, +				partLength, start, end; +		if (name.length < maxBarWidth) { +			return name; +		} +		partLength = Math.floor((maxBarWidth - 3) / 2); +		start = name.substr(0, partLength + 1); +		end = name.substr(nameLength - partLength); +		return start.trim() + "..." + end.trim(); +	} + +	function createBar(percentage) { +		var rounded = Math.round(percentage * 100); +		return ((rounded === 0) ? "0" : (pad(Math.ceil(maxBarWidth * percentage) + 1, BAR_CHAR) + " " + rounded)) + "%"; +	} + +	// sort the data if needed +	if (sorted) { +		tableData.sort(function(e1, e2) { +			return e2.time - e1.time; +		}); +	} +	// initialize the counter +	counter = 1; +	// get num ber of chars for padding +	maxOrderChars = tableData.length.toString().length; +	// push the header +	processedTableData.push(["#" + (sorted ? " [order]" : ""), "module", "time", "%"]); +	tableData.forEach(function(data) { +		var avg = data.time / totalTime, +				counterLabel, label, match; +		// slect just data over the threshold +		if (avg >= treshold) { +			counterLabel = counter++; +			// for sorted collumns show the order loading with padding +			if (sorted) { +				counterLabel += pad(maxOrderChars - data.order.toString().length + 1, " ") + " [" + data.order + "]"; +			} +			label = shorten(data.label); +			match = label.match(NAME_FILE_REX); +			if (match) { +				label = chalk.green(match[1]) + match[2]; +			} +			processedTableData.push([counterLabel, label, chalk.yellow(prettyMs(data.time)), chalk.blue(createBar(avg))]); +		} +	}); + +	return table(processedTableData, { +		align: ["r", "l", "r", "l"], +		stringLength: function(str) { +			return chalk.stripColor(str).length; +		} +	}); +} + +// hook process exit to display the report at the end +process.once("exit", function() { +	var startTime = hook.hookedAt, +			totalTime = Date.now() - startTime.getTime(); +	log("\n\n" + chalk.underline("Start time: " + chalk.yellow("(" + dateTime(startTime) + ")") + " [treshold=" + (treshold * 100) + "%" + (sorted ? ",sorted" : "") + "]")); +	log(formatTable(requireData, totalTime)); +	log(chalk.bold.blue("Total require(): ") + chalk.yellow(requireData.length)); +	log(chalk.bold.blue("Total time: ") + chalk.yellow(prettyMs(totalTime))); +});  | 
