deleted inigui, created features
This commit is contained in:
+13
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"curly": true,
|
||||
"eqeqeq": true,
|
||||
"immed": true,
|
||||
"latedef": true,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"sub": true,
|
||||
"undef": true,
|
||||
"boss": true,
|
||||
"eqnull": true,
|
||||
"node": true
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
Sindre Sorhus (http://github.com/sindresorhus)
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
v0.7.3:
|
||||
date: 2014-03-06
|
||||
changes:
|
||||
- Only create empty dest files when they don't already exist.
|
||||
v0.7.2:
|
||||
date: 2014-02-02
|
||||
changes:
|
||||
- Fix error reporting when Sass is not available.
|
||||
v0.7.1:
|
||||
date: 2014-01-28
|
||||
changes:
|
||||
- Fix regression of Bundler support.
|
||||
v0.7.0:
|
||||
date: 2014-01-26
|
||||
changes:
|
||||
- Improve Windows support.
|
||||
v0.6.0:
|
||||
date: 2013-12-10
|
||||
changes:
|
||||
- Ignore files where filename have leading underscore.
|
||||
v0.5.0:
|
||||
date: 2013-08-21
|
||||
changes:
|
||||
- Add banner option.
|
||||
v0.4.1:
|
||||
date: 2013-07-06
|
||||
changes:
|
||||
- Use file.orig.src if file.src does not exist and return early to avoid passing non-existent files to sass binary.
|
||||
v0.4.0:
|
||||
date: 2013-06-30
|
||||
changes:
|
||||
- Rewrite task to be able to support Source Maps.
|
||||
- Compile Sass files in parallel for better performance.
|
||||
v0.3.0:
|
||||
date: 2013-03-26
|
||||
changes:
|
||||
- Add support for `bundle exec`. Make sure `.css` files are compiled with SCSS.
|
||||
v0.2.2:
|
||||
date: 2013-02-15
|
||||
changes:
|
||||
- First official release for Grunt 0.4.0.
|
||||
v0.2.2rc7:
|
||||
date: 2013-01-25
|
||||
changes:
|
||||
- Updating grunt/gruntplugin dependencies to rc7.
|
||||
- Changing in-development grunt/gruntplugin dependency versions from tilde version ranges to specific versions.
|
||||
v0.2.2rc5:
|
||||
date: 2013-01-09
|
||||
changes:
|
||||
- Updating to work with grunt v0.4.0rc5.
|
||||
- Switching to this.files api.
|
||||
- Add separator option.
|
||||
v0.2.0:
|
||||
date: 2012-11-05
|
||||
changes:
|
||||
- Grunt 0.4 compatibility.
|
||||
- Improve error message when Sass binary couldn't be found
|
||||
v0.1.3:
|
||||
date: 2012-10-12
|
||||
changes:
|
||||
- Rename grunt-contrib-lib dep to grunt-lib-contrib.
|
||||
v0.1.2:
|
||||
date: 2012-10-08
|
||||
changes:
|
||||
- Fix regression for darwin.
|
||||
v0.1.1:
|
||||
date: 2012-10-05
|
||||
changes:
|
||||
- Windows support.
|
||||
v0.1.0:
|
||||
date: 2012-09-24
|
||||
changes:
|
||||
- Initial release.
|
||||
+1
@@ -0,0 +1 @@
|
||||
Please see the [Contributing to grunt](http://gruntjs.com/contributing) guide for information on contributing to this project.
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* grunt-contrib-sass
|
||||
* http://gruntjs.com/
|
||||
*
|
||||
* Copyright (c) 2012 Sindre Sorhus, contributors
|
||||
* Licensed under the MIT license.
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
module.exports = function (grunt) {
|
||||
grunt.initConfig({
|
||||
pkg: {
|
||||
name: 'grunt-contrib-sass'
|
||||
},
|
||||
jshint: {
|
||||
options: {
|
||||
jshintrc: '.jshintrc'
|
||||
},
|
||||
all: [
|
||||
'Gruntfile.js',
|
||||
'tasks/*.js',
|
||||
'<%= nodeunit.tests %>'
|
||||
]
|
||||
},
|
||||
clean: {
|
||||
test: [
|
||||
'test/tmp',
|
||||
'.sass-cache'
|
||||
]
|
||||
},
|
||||
nodeunit: {
|
||||
tests: ['test/*_test.js']
|
||||
},
|
||||
sass: {
|
||||
options: {
|
||||
//debugInfo: true,
|
||||
// style: 'expanded'
|
||||
},
|
||||
compile: {
|
||||
files: {
|
||||
'test/tmp/scss.css': ['test/fixtures/compile.scss'],
|
||||
'test/tmp/sass.css': ['test/fixtures/compile.sass'],
|
||||
'test/tmp/css.css': ['test/fixtures/compile.css']
|
||||
}
|
||||
},
|
||||
compileBanner: {
|
||||
options: {
|
||||
banner: '/* <%= pkg.name %> banner */'
|
||||
},
|
||||
files: {
|
||||
'test/tmp/scss-banner.css': ['test/fixtures/banner.scss'],
|
||||
'test/tmp/sass-banner.css': ['test/fixtures/banner.sass'],
|
||||
'test/tmp/css-banner.css': ['test/fixtures/banner.css']
|
||||
}
|
||||
},
|
||||
ignorePartials: {
|
||||
cwd: 'test/fixtures/partials',
|
||||
src: '*.scss',
|
||||
dest: 'test/tmp',
|
||||
expand: true,
|
||||
ext: '.css'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
grunt.loadTasks('tasks');
|
||||
grunt.loadNpmTasks('grunt-contrib-clean');
|
||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||
grunt.loadNpmTasks('grunt-contrib-nodeunit');
|
||||
grunt.loadNpmTasks('grunt-contrib-internal');
|
||||
|
||||
grunt.registerTask('mkdir', grunt.file.mkdir);
|
||||
grunt.registerTask('test', [
|
||||
'clean',
|
||||
'mkdir:tmp',
|
||||
'sass',
|
||||
'nodeunit',
|
||||
'clean'
|
||||
]);
|
||||
grunt.registerTask('default', ['jshint', 'test', 'build-contrib']);
|
||||
};
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
Copyright (c) 2012 Sindre Sorhus, contributors
|
||||
|
||||
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.
|
||||
+270
@@ -0,0 +1,270 @@
|
||||
# grunt-contrib-sass v0.7.3 [](https://travis-ci.org/gruntjs/grunt-contrib-sass)
|
||||
|
||||
> Compile Sass to CSS
|
||||
|
||||
|
||||
|
||||
## Getting Started
|
||||
This plugin requires Grunt `~0.4.0`
|
||||
|
||||
If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
|
||||
|
||||
```shell
|
||||
npm install grunt-contrib-sass --save-dev
|
||||
```
|
||||
|
||||
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
|
||||
|
||||
```js
|
||||
grunt.loadNpmTasks('grunt-contrib-sass');
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
## Sass task
|
||||
_Run this task with the `grunt sass` command._
|
||||
|
||||
[Sass](http://sass-lang.com) is a preprocessor that adds nested rules, variables, mixins and functions, selector inheritance, and more to CSS. Sass files compile into well-formatted, standard CSS to use in your site or application.
|
||||
|
||||
This task requires you to have [Ruby](http://www.ruby-lang.org/en/downloads/) and [Sass](http://sass-lang.com/download.html) installed. If you're on OS X or Linux you probably already have Ruby installed; test with `ruby -v` in your terminal. When you've confirmed you have Ruby installed, run `gem install sass` to install Sass.
|
||||
|
||||
Note: Files that begin with "_" are ignored even if they match the globbing pattern. This is done to match the expected [Sass partial behaviour](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#partials).
|
||||
|
||||
### Options
|
||||
|
||||
|
||||
#### sourcemap
|
||||
|
||||
Type: `Boolean`
|
||||
Default: `false`
|
||||
|
||||
Enable Source Maps.
|
||||
|
||||
**Requires Sass 3.3.0, which can be installed with `gem install sass --pre`**
|
||||
|
||||
|
||||
#### trace
|
||||
|
||||
Type: `Boolean`
|
||||
Default: `false`
|
||||
|
||||
Show a full traceback on error.
|
||||
|
||||
|
||||
#### unixNewlines
|
||||
|
||||
Type: `Boolean`
|
||||
Default: `false` on Windows, otherwise `true`
|
||||
|
||||
Force Unix newlines in written files.
|
||||
|
||||
|
||||
#### check
|
||||
|
||||
Type: `Boolean`
|
||||
Default: `false`
|
||||
|
||||
Just check syntax, don't evaluate.
|
||||
|
||||
|
||||
#### style
|
||||
|
||||
Type: `String`
|
||||
Default: `nested`
|
||||
|
||||
Output style. Can be `nested`, `compact`, `compressed`, `expanded`.
|
||||
|
||||
|
||||
#### precision
|
||||
|
||||
Type: `Number`
|
||||
Default: `3`
|
||||
|
||||
How many digits of precision to use when outputting decimal numbers.
|
||||
|
||||
|
||||
#### quiet
|
||||
|
||||
Type: `Boolean`
|
||||
Default: `false`
|
||||
|
||||
Silence warnings and status messages during compilation.
|
||||
|
||||
|
||||
#### compass
|
||||
|
||||
Type: `Boolean`
|
||||
Default: `false`
|
||||
|
||||
Make Compass imports available and load project configuration (`config.rb` located close to the `Gruntfile.js`).
|
||||
|
||||
|
||||
#### debugInfo
|
||||
|
||||
Type: `Boolean`
|
||||
Default: `false`
|
||||
|
||||
Emit extra information in the generated CSS that can be used by the FireSass Firebug plugin.
|
||||
|
||||
|
||||
#### lineNumbers
|
||||
|
||||
Type: `Boolean`
|
||||
Default: `false`
|
||||
|
||||
Emit comments in the generated CSS indicating the corresponding source line.
|
||||
|
||||
|
||||
#### loadPath
|
||||
|
||||
Type: `String|Array`
|
||||
|
||||
Add a (or multiple) Sass import path.
|
||||
|
||||
|
||||
#### require
|
||||
|
||||
Type: `String|Array`
|
||||
|
||||
Require a (or multiple) Ruby library before running Sass.
|
||||
|
||||
|
||||
#### cacheLocation
|
||||
|
||||
Type: `String`
|
||||
Default: `.sass-cache`
|
||||
|
||||
The path to put cached Sass files.
|
||||
|
||||
|
||||
#### noCache
|
||||
|
||||
Type: `Boolean`
|
||||
Default: `false`
|
||||
|
||||
Don't cache to sassc files.
|
||||
|
||||
|
||||
#### bundleExec
|
||||
|
||||
Type: `Boolean`
|
||||
Default: `false`
|
||||
|
||||
Run `sass` with [bundle exec](http://gembundler.com/man/bundle-exec.1.html): `bundle exec sass`.
|
||||
|
||||
|
||||
#### banner
|
||||
|
||||
Type: `String`
|
||||
|
||||
Prepend the specified string to the output file. Useful for licensing information.
|
||||
|
||||
*Can't be used if you use the `sourcemap` option.*
|
||||
|
||||
### Examples
|
||||
|
||||
#### Example config
|
||||
|
||||
```javascript
|
||||
grunt.initConfig({
|
||||
sass: { // Task
|
||||
dist: { // Target
|
||||
options: { // Target options
|
||||
style: 'expanded'
|
||||
},
|
||||
files: { // Dictionary of files
|
||||
'main.css': 'main.scss', // 'destination': 'source'
|
||||
'widgets.css': 'widgets.scss'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
grunt.loadNpmTasks('grunt-contrib-sass');
|
||||
|
||||
grunt.registerTask('default', ['sass']);
|
||||
```
|
||||
|
||||
#### Compile
|
||||
|
||||
```javascript
|
||||
grunt.initConfig({
|
||||
sass: {
|
||||
dist: {
|
||||
files: {
|
||||
'main.css': 'main.scss'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
#### Concat and compile
|
||||
|
||||
Instead of concatenating the files, just `@import` them into another `.sass` file eg. `main.scss`.
|
||||
|
||||
|
||||
#### Compile multiple files
|
||||
|
||||
You can specify multiple `destination: source` items in `files`.
|
||||
|
||||
```javascript
|
||||
grunt.initConfig({
|
||||
sass: {
|
||||
dist: {
|
||||
files: {
|
||||
'main.css': 'main.scss',
|
||||
'widgets.css': 'widgets.scss'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
#### Compile files in a directory
|
||||
|
||||
Instead of naming all files you want to compile, you can use the `expand` property allowing you to specify a directory. More information available in the [grunt docs](http://gruntjs.com/configuring-tasks) - `Building the files object dynamically`.
|
||||
|
||||
```javascript
|
||||
grunt.initConfig({
|
||||
sass: {
|
||||
dist: {
|
||||
files: [{
|
||||
expand: true,
|
||||
cwd: 'styles',
|
||||
src: ['*.scss'],
|
||||
dest: '../public',
|
||||
ext: '.css'
|
||||
}]
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## Release History
|
||||
|
||||
* 2014-03-06 v0.7.3 Only create empty dest files when they don't already exist.
|
||||
* 2014-02-02 v0.7.2 Fix error reporting when Sass is not available.
|
||||
* 2014-01-28 v0.7.1 Fix regression of Bundler support.
|
||||
* 2014-01-26 v0.7.0 Improve Windows support.
|
||||
* 2013-12-10 v0.6.0 Ignore files where filename have leading underscore.
|
||||
* 2013-08-21 v0.5.0 Add banner option.
|
||||
* 2013-07-06 v0.4.1 Use file.orig.src if file.src does not exist and return early to avoid passing non-existent files to sass binary.
|
||||
* 2013-06-30 v0.4.0 Rewrite task to be able to support Source Maps. Compile Sass files in parallel for better performance.
|
||||
* 2013-03-26 v0.3.0 Add support for `bundle exec`. Make sure `.css` files are compiled with SCSS.
|
||||
* 2013-02-15 v0.2.2 First official release for Grunt 0.4.0.
|
||||
* 2013-01-25 v0.2.2rc7 Updating grunt/gruntplugin dependencies to rc7. Changing in-development grunt/gruntplugin dependency versions from tilde version ranges to specific versions.
|
||||
* 2013-01-09 v0.2.2rc5 Updating to work with grunt v0.4.0rc5. Switching to this.files api. Add separator option.
|
||||
* 2012-11-05 v0.2.0 Grunt 0.4 compatibility. Improve error message when Sass binary couldn't be found
|
||||
* 2012-10-12 v0.1.3 Rename grunt-contrib-lib dep to grunt-lib-contrib.
|
||||
* 2012-10-08 v0.1.2 Fix regression for darwin.
|
||||
* 2012-10-05 v0.1.1 Windows support.
|
||||
* 2012-09-24 v0.1.0 Initial release.
|
||||
|
||||
---
|
||||
|
||||
Task submitted by [Sindre Sorhus](http://github.com/sindresorhus)
|
||||
|
||||
*This file was generated on Thu Mar 06 2014 14:43:40.*
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
# Examples
|
||||
|
||||
## Example config
|
||||
|
||||
```javascript
|
||||
grunt.initConfig({
|
||||
sass: { // Task
|
||||
dist: { // Target
|
||||
options: { // Target options
|
||||
style: 'expanded'
|
||||
},
|
||||
files: { // Dictionary of files
|
||||
'main.css': 'main.scss', // 'destination': 'source'
|
||||
'widgets.css': 'widgets.scss'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
grunt.loadNpmTasks('grunt-contrib-sass');
|
||||
|
||||
grunt.registerTask('default', ['sass']);
|
||||
```
|
||||
|
||||
## Compile
|
||||
|
||||
```javascript
|
||||
grunt.initConfig({
|
||||
sass: {
|
||||
dist: {
|
||||
files: {
|
||||
'main.css': 'main.scss'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## Concat and compile
|
||||
|
||||
Instead of concatenating the files, just `@import` them into another `.sass` file eg. `main.scss`.
|
||||
|
||||
|
||||
## Compile multiple files
|
||||
|
||||
You can specify multiple `destination: source` items in `files`.
|
||||
|
||||
```javascript
|
||||
grunt.initConfig({
|
||||
sass: {
|
||||
dist: {
|
||||
files: {
|
||||
'main.css': 'main.scss',
|
||||
'widgets.css': 'widgets.scss'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## Compile files in a directory
|
||||
|
||||
Instead of naming all files you want to compile, you can use the `expand` property allowing you to specify a directory. More information available in the [grunt docs](http://gruntjs.com/configuring-tasks) - `Building the files object dynamically`.
|
||||
|
||||
```javascript
|
||||
grunt.initConfig({
|
||||
sass: {
|
||||
dist: {
|
||||
files: [{
|
||||
expand: true,
|
||||
cwd: 'styles',
|
||||
src: ['*.scss'],
|
||||
dest: '../public',
|
||||
ext: '.css'
|
||||
}]
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
# Options
|
||||
|
||||
|
||||
## sourcemap
|
||||
|
||||
Type: `Boolean`
|
||||
Default: `false`
|
||||
|
||||
Enable Source Maps.
|
||||
|
||||
**Requires Sass 3.3.0, which can be installed with `gem install sass --pre`**
|
||||
|
||||
|
||||
## trace
|
||||
|
||||
Type: `Boolean`
|
||||
Default: `false`
|
||||
|
||||
Show a full traceback on error.
|
||||
|
||||
|
||||
## unixNewlines
|
||||
|
||||
Type: `Boolean`
|
||||
Default: `false` on Windows, otherwise `true`
|
||||
|
||||
Force Unix newlines in written files.
|
||||
|
||||
|
||||
## check
|
||||
|
||||
Type: `Boolean`
|
||||
Default: `false`
|
||||
|
||||
Just check syntax, don't evaluate.
|
||||
|
||||
|
||||
## style
|
||||
|
||||
Type: `String`
|
||||
Default: `nested`
|
||||
|
||||
Output style. Can be `nested`, `compact`, `compressed`, `expanded`.
|
||||
|
||||
|
||||
## precision
|
||||
|
||||
Type: `Number`
|
||||
Default: `3`
|
||||
|
||||
How many digits of precision to use when outputting decimal numbers.
|
||||
|
||||
|
||||
## quiet
|
||||
|
||||
Type: `Boolean`
|
||||
Default: `false`
|
||||
|
||||
Silence warnings and status messages during compilation.
|
||||
|
||||
|
||||
## compass
|
||||
|
||||
Type: `Boolean`
|
||||
Default: `false`
|
||||
|
||||
Make Compass imports available and load project configuration (`config.rb` located close to the `Gruntfile.js`).
|
||||
|
||||
|
||||
## debugInfo
|
||||
|
||||
Type: `Boolean`
|
||||
Default: `false`
|
||||
|
||||
Emit extra information in the generated CSS that can be used by the FireSass Firebug plugin.
|
||||
|
||||
|
||||
## lineNumbers
|
||||
|
||||
Type: `Boolean`
|
||||
Default: `false`
|
||||
|
||||
Emit comments in the generated CSS indicating the corresponding source line.
|
||||
|
||||
|
||||
## loadPath
|
||||
|
||||
Type: `String|Array`
|
||||
|
||||
Add a (or multiple) Sass import path.
|
||||
|
||||
|
||||
## require
|
||||
|
||||
Type: `String|Array`
|
||||
|
||||
Require a (or multiple) Ruby library before running Sass.
|
||||
|
||||
|
||||
## cacheLocation
|
||||
|
||||
Type: `String`
|
||||
Default: `.sass-cache`
|
||||
|
||||
The path to put cached Sass files.
|
||||
|
||||
|
||||
## noCache
|
||||
|
||||
Type: `Boolean`
|
||||
Default: `false`
|
||||
|
||||
Don't cache to sassc files.
|
||||
|
||||
|
||||
## bundleExec
|
||||
|
||||
Type: `Boolean`
|
||||
Default: `false`
|
||||
|
||||
Run `sass` with [bundle exec](http://gembundler.com/man/bundle-exec.1.html): `bundle exec sass`.
|
||||
|
||||
|
||||
## banner
|
||||
|
||||
Type: `String`
|
||||
|
||||
Prepend the specified string to the output file. Useful for licensing information.
|
||||
|
||||
*Can't be used if you use the `sourcemap` option.*
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
[Sass](http://sass-lang.com) is a preprocessor that adds nested rules, variables, mixins and functions, selector inheritance, and more to CSS. Sass files compile into well-formatted, standard CSS to use in your site or application.
|
||||
|
||||
This task requires you to have [Ruby](http://www.ruby-lang.org/en/downloads/) and [Sass](http://sass-lang.com/download.html) installed. If you're on OS X or Linux you probably already have Ruby installed; test with `ruby -v` in your terminal. When you've confirmed you have Ruby installed, run `gem install sass` to install Sass.
|
||||
|
||||
Note: Files that begin with "_" are ignored even if they match the globbing pattern. This is done to match the expected [Sass partial behaviour](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#partials).
|
||||
Generated
Vendored
Symlink
+1
@@ -0,0 +1 @@
|
||||
../which/bin/which
|
||||
Generated
Vendored
Symlink
+1
@@ -0,0 +1 @@
|
||||
../win-spawn/bin/win-spawn
|
||||
Generated
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
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
|
||||
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.
|
||||
Generated
Vendored
+1425
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+11
@@ -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" ]
|
||||
}
|
||||
Generated
Vendored
Executable
+958
@@ -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;
|
||||
}
|
||||
|
||||
}());
|
||||
Generated
Vendored
+60
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"name": "async",
|
||||
"description": "Higher-order functions and common patterns for asynchronous code",
|
||||
"main": "./lib/async",
|
||||
"author": {
|
||||
"name": "Caolan McMahon"
|
||||
},
|
||||
"version": "0.2.10",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/caolan/async.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/caolan/async/issues"
|
||||
},
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "https://github.com/caolan/async/raw/master/LICENSE"
|
||||
}
|
||||
],
|
||||
"devDependencies": {
|
||||
"nodeunit": ">0.0.0",
|
||||
"uglify-js": "1.2.x",
|
||||
"nodelint": ">0.0.0"
|
||||
},
|
||||
"jam": {
|
||||
"main": "lib/async.js",
|
||||
"include": [
|
||||
"lib/async.js",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"test": "nodeunit test/test-async.js"
|
||||
},
|
||||
"_id": "async@0.2.10",
|
||||
"dist": {
|
||||
"shasum": "b6bbe0b0674b9d719708ca38de8c237cb526c3d1",
|
||||
"tarball": "http://registry.npmjs.org/async/-/async-0.2.10.tgz"
|
||||
},
|
||||
"_from": "async@>=0.2.9 <0.3.0",
|
||||
"_npmVersion": "1.3.2",
|
||||
"_npmUser": {
|
||||
"name": "caolan",
|
||||
"email": "caolan.mcmahon@gmail.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "caolan",
|
||||
"email": "caolan@caolanmcmahon.com"
|
||||
}
|
||||
],
|
||||
"directories": {},
|
||||
"_shasum": "b6bbe0b0674b9d719708ca38de8c237cb526c3d1",
|
||||
"_resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz",
|
||||
"readme": "ERROR: No README data found!",
|
||||
"homepage": "https://github.com/caolan/async"
|
||||
}
|
||||
Generated
Vendored
+63
@@ -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;
|
||||
}
|
||||
Generated
Vendored
Symlink
+1
@@ -0,0 +1 @@
|
||||
../strip-ansi/cli.js
|
||||
Generated
Vendored
+38
@@ -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';
|
||||
});
|
||||
Generated
Vendored
+74
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"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": {
|
||||
"url": "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"
|
||||
},
|
||||
"_id": "ansi-styles@1.0.0",
|
||||
"dist": {
|
||||
"shasum": "cb102df1c56f5123eab8b67cd7b98027a0279178",
|
||||
"tarball": "http://registry.npmjs.org/ansi-styles/-/ansi-styles-1.0.0.tgz"
|
||||
},
|
||||
"_from": "ansi-styles@>=1.0.0 <1.1.0",
|
||||
"_npmVersion": "1.3.15",
|
||||
"_npmUser": {
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
}
|
||||
],
|
||||
"directories": {},
|
||||
"_shasum": "cb102df1c56f5123eab8b67cd7b98027a0279178",
|
||||
"_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.0.0.tgz"
|
||||
}
|
||||
Generated
Vendored
+65
@@ -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)
|
||||
Generated
Vendored
+32
@@ -0,0 +1,32 @@
|
||||
'use strict';
|
||||
module.exports = (function () {
|
||||
if (process.argv.indexOf('--no-color') !== -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (process.argv.indexOf('--color') !== -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (process.stdout && !process.stdout.isTTY) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ('COLORTERM' in process.env) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (process.env.TERM === 'dumb') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(process.env.TERM)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
})();
|
||||
Generated
Vendored
+70
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"name": "has-color",
|
||||
"version": "0.1.7",
|
||||
"description": "Detect whether a terminal supports color",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/sindresorhus/has-color"
|
||||
},
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "http://sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"ansi",
|
||||
"styles",
|
||||
"tty",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"command-line",
|
||||
"support",
|
||||
"capability",
|
||||
"detect"
|
||||
],
|
||||
"devDependencies": {
|
||||
"mocha": "*"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/has-color/issues"
|
||||
},
|
||||
"homepage": "https://github.com/sindresorhus/has-color",
|
||||
"_id": "has-color@0.1.7",
|
||||
"dist": {
|
||||
"shasum": "67144a5260c34fc3cca677d041daf52fe7b78b2f",
|
||||
"tarball": "http://registry.npmjs.org/has-color/-/has-color-0.1.7.tgz"
|
||||
},
|
||||
"_from": "has-color@>=0.1.0 <0.2.0",
|
||||
"_npmVersion": "1.4.6",
|
||||
"_npmUser": {
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
}
|
||||
],
|
||||
"directories": {},
|
||||
"_shasum": "67144a5260c34fc3cca677d041daf52fe7b78b2f",
|
||||
"_resolved": "https://registry.npmjs.org/has-color/-/has-color-0.1.7.tgz"
|
||||
}
|
||||
Generated
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
# has-color [](https://travis-ci.org/sindresorhus/has-color)
|
||||
|
||||
> Detect whether a terminal supports color.
|
||||
|
||||
Used in the terminal color module [chalk](https://github.com/sindresorhus/chalk).
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
$ npm install --save has-color
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var hasColor = require('has-color');
|
||||
|
||||
if (hasColor) {
|
||||
console.log('Terminal supports color.');
|
||||
}
|
||||
```
|
||||
|
||||
It obeys the `--color` and `--no-color` CLI flags.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
[MIT](http://opensource.org/licenses/MIT) © [Sindre Sorhus](http://sindresorhus.com)
|
||||
Generated
Vendored
Executable
+27
@@ -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));
|
||||
});
|
||||
Generated
Vendored
+4
@@ -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;
|
||||
};
|
||||
Generated
Vendored
+80
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"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": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/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"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/strip-ansi/issues"
|
||||
},
|
||||
"homepage": "https://github.com/sindresorhus/strip-ansi",
|
||||
"_id": "strip-ansi@0.1.1",
|
||||
"dist": {
|
||||
"shasum": "39e8a98d044d150660abe4a6808acf70bb7bc991",
|
||||
"tarball": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz"
|
||||
},
|
||||
"_from": "strip-ansi@>=0.1.0 <0.2.0",
|
||||
"_npmVersion": "1.3.15",
|
||||
"_npmUser": {
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
}
|
||||
],
|
||||
"directories": {},
|
||||
"_shasum": "39e8a98d044d150660abe4a6808acf70bb7bc991",
|
||||
"_resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz"
|
||||
}
|
||||
Generated
Vendored
+46
@@ -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)
|
||||
Generated
Vendored
+77
@@ -0,0 +1,77 @@
|
||||
{
|
||||
"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": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/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"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/chalk/issues"
|
||||
},
|
||||
"homepage": "https://github.com/sindresorhus/chalk",
|
||||
"_id": "chalk@0.4.0",
|
||||
"dist": {
|
||||
"shasum": "5199a3ddcd0c1efe23bc08c1b027b06176e0c64f",
|
||||
"tarball": "http://registry.npmjs.org/chalk/-/chalk-0.4.0.tgz"
|
||||
},
|
||||
"_from": "chalk@>=0.4.0 <0.5.0",
|
||||
"_npmVersion": "1.3.17",
|
||||
"_npmUser": {
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
}
|
||||
],
|
||||
"directories": {},
|
||||
"_shasum": "5199a3ddcd0c1efe23bc08c1b027b06176e0c64f",
|
||||
"_resolved": "https://registry.npmjs.org/chalk/-/chalk-0.4.0.tgz"
|
||||
}
|
||||
Generated
Vendored
+158
@@ -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")
|
||||
Generated
Vendored
+36
@@ -0,0 +1,36 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function (options, excludes) {
|
||||
var args = [];
|
||||
|
||||
Object.keys(options).forEach(function (key) {
|
||||
var flag;
|
||||
var val = options[key];
|
||||
|
||||
if (Array.isArray(excludes) && excludes.indexOf(key) !== -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
flag = key.replace(/[A-Z]/g, '-$&').toLowerCase();
|
||||
|
||||
if (val === true) {
|
||||
args.push('--' + flag);
|
||||
}
|
||||
|
||||
if (typeof val === 'string') {
|
||||
args.push('--' + flag, val);
|
||||
}
|
||||
|
||||
if (typeof val === 'number' && isNaN(val) === false) {
|
||||
args.push('--' + flag, '' + val);
|
||||
}
|
||||
|
||||
if (Array.isArray(val)) {
|
||||
val.forEach(function (arrVal) {
|
||||
args.push('--' + flag, arrVal);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return args;
|
||||
};
|
||||
Generated
Vendored
+61
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"name": "dargs",
|
||||
"version": "0.1.0",
|
||||
"description": "Converts an object of options into an array of command-line arguments. Useful when calling command-line tools.",
|
||||
"keywords": [
|
||||
"options",
|
||||
"arguments",
|
||||
"args",
|
||||
"flags",
|
||||
"cli"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/dargs",
|
||||
"bugs": "https://github.com/sindresorhus/dargs/issues",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "http://sindresorhus.com"
|
||||
},
|
||||
"main": "dargs.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/sindresorhus/dargs.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mocha": "~1.9.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
},
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT"
|
||||
}
|
||||
],
|
||||
"files": [
|
||||
"dargs.js"
|
||||
],
|
||||
"_id": "dargs@0.1.0",
|
||||
"dist": {
|
||||
"shasum": "2364ad9f441f976dcd5fe9961e21715665a5e3c3",
|
||||
"tarball": "http://registry.npmjs.org/dargs/-/dargs-0.1.0.tgz"
|
||||
},
|
||||
"_from": "dargs@>=0.1.0 <0.2.0",
|
||||
"_npmVersion": "1.2.18",
|
||||
"_npmUser": {
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
}
|
||||
],
|
||||
"directories": {},
|
||||
"_shasum": "2364ad9f441f976dcd5fe9961e21715665a5e3c3",
|
||||
"_resolved": "https://registry.npmjs.org/dargs/-/dargs-0.1.0.tgz"
|
||||
}
|
||||
Generated
Vendored
+57
@@ -0,0 +1,57 @@
|
||||
# dargs [](http://travis-ci.org/sindresorhus/dargs)
|
||||
|
||||
> Converts an object of options into an array of command-line arguments
|
||||
|
||||
|
||||
## Getting started
|
||||
|
||||
Install: `npm install --save dargs`
|
||||
|
||||
|
||||
#### Example
|
||||
|
||||
```js
|
||||
var dargs = require('dargs');
|
||||
|
||||
var options = {
|
||||
foo: 'bar',
|
||||
hello: true, // results in only the key being used
|
||||
cake: false, // ignored
|
||||
camelCase: 5, // camelCase is slugged to `camel-case`
|
||||
multiple: ['value', 'value2'], // converted to multiple arguments
|
||||
sad: ':('
|
||||
};
|
||||
|
||||
var excludes = ['sad'];
|
||||
|
||||
console.log(dargs(options, excludes));
|
||||
|
||||
/*
|
||||
[
|
||||
'--foo', 'bar',
|
||||
'--hello',
|
||||
'--camel-case', '5',
|
||||
'--multiple', 'value',
|
||||
'--multiple', 'value2'
|
||||
]
|
||||
*/
|
||||
```
|
||||
|
||||
|
||||
## Documentation
|
||||
|
||||
|
||||
### options
|
||||
|
||||
Object of options to convert to command-line arguments.
|
||||
|
||||
|
||||
### excludes
|
||||
|
||||
Array of keys to exclude.
|
||||
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT License • © [Sindre Sorhus](http://sindresorhus.com)
|
||||
Generated
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
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.
|
||||
Generated
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
The "which" util from npm's guts.
|
||||
|
||||
Finds the first instance of a specified executable in the PATH
|
||||
environment variable. Does not cache the results, so `hash -r` is not
|
||||
needed when the PATH changes.
|
||||
Generated
Vendored
Executable
+14
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env node
|
||||
var which = require("../")
|
||||
if (process.argv.length < 3) {
|
||||
console.error("Usage: which <thing>")
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
which(process.argv[2], function (er, thing) {
|
||||
if (er) {
|
||||
console.error(er.message)
|
||||
process.exit(er.errno || 127)
|
||||
}
|
||||
console.log(thing)
|
||||
})
|
||||
Generated
Vendored
+47
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"author": {
|
||||
"name": "Isaac Z. Schlueter",
|
||||
"email": "i@izs.me",
|
||||
"url": "http://blog.izs.me"
|
||||
},
|
||||
"name": "which",
|
||||
"description": "Like which(1) unix command. Find the first instance of an executable in the PATH.",
|
||||
"version": "1.0.8",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/isaacs/node-which.git"
|
||||
},
|
||||
"main": "which.js",
|
||||
"bin": {
|
||||
"which": "./bin/which"
|
||||
},
|
||||
"license": "ISC",
|
||||
"gitHead": "681a9ebbc447cb428232ddf6c0983006d89e7755",
|
||||
"bugs": {
|
||||
"url": "https://github.com/isaacs/node-which/issues"
|
||||
},
|
||||
"homepage": "https://github.com/isaacs/node-which",
|
||||
"_id": "which@1.0.8",
|
||||
"scripts": {},
|
||||
"_shasum": "c2ff319534ac4a1fa45df2221b56c36279903ded",
|
||||
"_from": "which@>=1.0.5 <1.1.0",
|
||||
"_npmVersion": "2.1.11",
|
||||
"_nodeVersion": "0.10.16",
|
||||
"_npmUser": {
|
||||
"name": "isaacs",
|
||||
"email": "i@izs.me"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "isaacs",
|
||||
"email": "i@izs.me"
|
||||
}
|
||||
],
|
||||
"dist": {
|
||||
"shasum": "c2ff319534ac4a1fa45df2221b56c36279903ded",
|
||||
"tarball": "http://registry.npmjs.org/which/-/which-1.0.8.tgz"
|
||||
},
|
||||
"directories": {},
|
||||
"_resolved": "https://registry.npmjs.org/which/-/which-1.0.8.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
}
|
||||
Generated
Vendored
+99
@@ -0,0 +1,99 @@
|
||||
module.exports = which
|
||||
which.sync = whichSync
|
||||
|
||||
var path = require("path")
|
||||
, fs
|
||||
, COLON = process.platform === "win32" ? ";" : ":"
|
||||
, isExe
|
||||
, fs = require("fs")
|
||||
|
||||
if (process.platform == "win32") {
|
||||
// On windows, there is no good way to check that a file is executable
|
||||
isExe = function isExe () { return true }
|
||||
} else {
|
||||
isExe = function isExe (mod, uid, gid) {
|
||||
//console.error(mod, uid, gid);
|
||||
//console.error("isExe?", (mod & 0111).toString(8))
|
||||
var ret = (mod & 0001)
|
||||
|| (mod & 0010) && process.getgid && gid === process.getgid()
|
||||
|| (mod & 0100) && process.getuid && uid === process.getuid()
|
||||
//console.error("isExe?", ret)
|
||||
return ret
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function which (cmd, cb) {
|
||||
if (isAbsolute(cmd)) return cb(null, cmd)
|
||||
var pathEnv = (process.env.PATH || "").split(COLON)
|
||||
, pathExt = [""]
|
||||
if (process.platform === "win32") {
|
||||
pathEnv.push(process.cwd())
|
||||
pathExt = (process.env.PATHEXT || ".EXE").split(COLON)
|
||||
if (cmd.indexOf(".") !== -1) pathExt.unshift("")
|
||||
}
|
||||
//console.error("pathEnv", pathEnv)
|
||||
;(function F (i, l) {
|
||||
if (i === l) return cb(new Error("not found: "+cmd))
|
||||
var p = path.resolve(pathEnv[i], cmd)
|
||||
;(function E (ii, ll) {
|
||||
if (ii === ll) return F(i + 1, l)
|
||||
var ext = pathExt[ii]
|
||||
//console.error(p + ext)
|
||||
fs.stat(p + ext, function (er, stat) {
|
||||
if (!er &&
|
||||
stat &&
|
||||
stat.isFile() &&
|
||||
isExe(stat.mode, stat.uid, stat.gid)) {
|
||||
//console.error("yes, exe!", p + ext)
|
||||
return cb(null, p + ext)
|
||||
}
|
||||
return E(ii + 1, ll)
|
||||
})
|
||||
})(0, pathExt.length)
|
||||
})(0, pathEnv.length)
|
||||
}
|
||||
|
||||
function whichSync (cmd) {
|
||||
if (isAbsolute(cmd)) return cmd
|
||||
var pathEnv = (process.env.PATH || "").split(COLON)
|
||||
, pathExt = [""]
|
||||
if (process.platform === "win32") {
|
||||
pathEnv.push(process.cwd())
|
||||
pathExt = (process.env.PATHEXT || ".EXE").split(COLON)
|
||||
if (cmd.indexOf(".") !== -1) pathExt.unshift("")
|
||||
}
|
||||
for (var i = 0, l = pathEnv.length; i < l; i ++) {
|
||||
var p = path.join(pathEnv[i], cmd)
|
||||
for (var j = 0, ll = pathExt.length; j < ll; j ++) {
|
||||
var cur = p + pathExt[j]
|
||||
var stat
|
||||
try { stat = fs.statSync(cur) } catch (ex) {}
|
||||
if (stat &&
|
||||
stat.isFile() &&
|
||||
isExe(stat.mode, stat.uid, stat.gid)) return cur
|
||||
}
|
||||
}
|
||||
throw new Error("not found: "+cmd)
|
||||
}
|
||||
|
||||
var isAbsolute = process.platform === "win32" ? absWin : absUnix
|
||||
|
||||
function absWin (p) {
|
||||
if (absUnix(p)) return true
|
||||
// pull off the device/UNC bit from a windows path.
|
||||
// from node's lib/path.js
|
||||
var splitDeviceRe =
|
||||
/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?([\\\/])?/
|
||||
, result = splitDeviceRe.exec(p)
|
||||
, device = result[1] || ''
|
||||
, isUnc = device && device.charAt(1) !== ':'
|
||||
, isAbsolute = !!result[2] || isUnc // UNC paths are always absolute
|
||||
|
||||
return isAbsolute
|
||||
}
|
||||
|
||||
function absUnix (p) {
|
||||
return p.charAt(0) === "/" || p === ""
|
||||
}
|
||||
Generated
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
lib-cov
|
||||
*.seed
|
||||
*.log
|
||||
*.csv
|
||||
*.dat
|
||||
*.out
|
||||
*.pid
|
||||
*.gz
|
||||
|
||||
pids
|
||||
logs
|
||||
results
|
||||
|
||||
node_modules
|
||||
npm-debug.log
|
||||
Generated
Vendored
+41
@@ -0,0 +1,41 @@
|
||||
# win-spawn
|
||||
|
||||
Spawn for node.js but in a way that works regardless of which OS you're using. Use this if you want to use spawn with a JavaScript file. It works by explicitly invoking node on windows. It also shims support for environment variable setting by attempting to parse the command with a regex. Since all modification is wrapped in `if (os === 'Windows_NT')` it can be safely used on non-windows systems and will not break anything.
|
||||
|
||||
## Installation
|
||||
|
||||
$ npm install win-spawn
|
||||
|
||||
## Usage
|
||||
|
||||
### Command Line
|
||||
|
||||
All the following will work exactly as if the 'win-spawn ' prefix was ommitted when on unix.
|
||||
|
||||
$ win-spawn foo
|
||||
$ win-spawn ./bin/foo
|
||||
$ win-spawn NODE_PATH=./lib foo
|
||||
$ win-spawn NODE_PATH=./lib foo arg1 arg2
|
||||
|
||||
You can also transform all the line endings in a directory from `\r\n` to `\n` just by running:
|
||||
|
||||
$ win-line-endings
|
||||
|
||||
You can preview the changes by running:
|
||||
|
||||
$ win-line-endings -p
|
||||
|
||||
It will ignore `node_modules` and `.git` by default, but is not clever enough to recognise binary files yet.
|
||||
|
||||
### API
|
||||
|
||||
This will just pass through to `child_process.spawn` on unix systems, but will correctly parse the arguments on windows.
|
||||
|
||||
```javascript
|
||||
spawn('foo', [], {stdio: 'inherit'});
|
||||
spawn('./bin/foo', [], {stdio: 'inherit'});
|
||||
spawn('NODE_PATH=./lib foo', [], {stdio: 'inherit'});
|
||||
spawn('NODE_PATH=./lib foo', [arg1, arg2], {stdio: 'inherit'});
|
||||
```
|
||||
|
||||

|
||||
Generated
Vendored
Executable
+12
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var spawn = require('../index.js');
|
||||
|
||||
var args = process.argv.slice(2);
|
||||
var cmd = '';
|
||||
while (/^[A-Z_]+\=[^ \=]+$/.test(args[0])) {
|
||||
cmd += args.shift() + ' ';
|
||||
}
|
||||
cmd += args.shift();
|
||||
|
||||
spawn(cmd, args, { stdio: 'inherit' });
|
||||
Generated
Vendored
+64
@@ -0,0 +1,64 @@
|
||||
var cSpawn = require('child_process').spawn;
|
||||
var os = require('os').type();
|
||||
|
||||
exports = module.exports = spawn;
|
||||
function spawn(command, args, options) {
|
||||
if (os === 'Windows_NT') {
|
||||
command = command.replace(/\//g, '\\');
|
||||
|
||||
if (command === 'rm') {
|
||||
command = 'rmdir';
|
||||
if (args[0] === '-rf' || args[0] == '-fr') {
|
||||
args[0] = '/q';
|
||||
args.unshift('/s');
|
||||
}
|
||||
if (args[0] === '-f') {
|
||||
args[0] = '/q';
|
||||
}
|
||||
if (args[0] === '-r') {
|
||||
args[0] = '/s';
|
||||
}
|
||||
}
|
||||
args = args || [];
|
||||
options = options || {};
|
||||
var match, matchA;
|
||||
if (matchA = /((?:[A-Z_]+\=[^ \=]+ )+)?([^\r\n]+)/.exec(command)) {
|
||||
try {
|
||||
var file = require('fs').readFileSync(matchA[2], 'utf8');
|
||||
if (match = /\#\!\/usr\/bin\/env ([^\r\n]+)/.exec(file)) {
|
||||
args.unshift(matchA[2]);
|
||||
command = (matchA[1] || '') + match[1];
|
||||
}
|
||||
} catch (ex) { }
|
||||
}
|
||||
|
||||
if (match = /((?:[A-Z_]+\=[^ \=]+ )+)([^\r\n]+)/.exec(command)) {
|
||||
command = match[2];
|
||||
|
||||
options.env = options.env || shallowClone(process.env);
|
||||
|
||||
var env = match[1].split(' ');
|
||||
env.forEach(function (v) {
|
||||
v = v.split('=');
|
||||
if (v.length === 2) {
|
||||
options.env[v[0]] = v[1];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
args.unshift(command);
|
||||
args.unshift('/c');
|
||||
args.unshift('/d');
|
||||
command = 'cmd';
|
||||
}
|
||||
return cSpawn(command, args, options);
|
||||
}
|
||||
|
||||
function shallowClone(obj) {
|
||||
var out = {};
|
||||
Object.keys(obj)
|
||||
.forEach(function (key) {
|
||||
out[key] = obj[key];
|
||||
});
|
||||
return out;
|
||||
}
|
||||
Generated
Vendored
+45
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"name": "win-spawn",
|
||||
"version": "2.0.0",
|
||||
"description": "Spawn for node.js but in a way that works regardless of which OS you're using",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ForbesLindesay/win-spawn.git"
|
||||
},
|
||||
"bin": {
|
||||
"win-spawn": "./bin/win-spawn"
|
||||
},
|
||||
"devDependencies": {
|
||||
"linify": "~1.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
"prepublish": "linify transform bin"
|
||||
},
|
||||
"author": {
|
||||
"name": "ForbesLindesay"
|
||||
},
|
||||
"license": "BSD",
|
||||
"readme": "# win-spawn\n\n Spawn for node.js but in a way that works regardless of which OS you're using. Use this if you want to use spawn with a JavaScript file. It works by explicitly invoking node on windows. It also shims support for environment variable setting by attempting to parse the command with a regex. Since all modification is wrapped in `if (os === 'Windows_NT')` it can be safely used on non-windows systems and will not break anything.\n\n## Installation\n\n $ npm install win-spawn\n\n## Usage\n\n### Command Line\n\n All the following will work exactly as if the 'win-spawn ' prefix was ommitted when on unix.\n\n $ win-spawn foo\n $ win-spawn ./bin/foo\n $ win-spawn NODE_PATH=./lib foo\n $ win-spawn NODE_PATH=./lib foo arg1 arg2\n\n You can also transform all the line endings in a directory from `\\r\\n` to `\\n` just by running:\n\n $ win-line-endings\n\n You can preview the changes by running:\n\n $ win-line-endings -p\n\n It will ignore `node_modules` and `.git` by default, but is not clever enough to recognise binary files yet.\n\n### API\n\nThis will just pass through to `child_process.spawn` on unix systems, but will correctly parse the arguments on windows.\n\n```javascript\nspawn('foo', [], {stdio: 'inherit'});\nspawn('./bin/foo', [], {stdio: 'inherit'});\nspawn('NODE_PATH=./lib foo', [], {stdio: 'inherit'});\nspawn('NODE_PATH=./lib foo', [arg1, arg2], {stdio: 'inherit'});\n```\n\n\n",
|
||||
"readmeFilename": "README.md",
|
||||
"_id": "win-spawn@2.0.0",
|
||||
"dist": {
|
||||
"shasum": "397a29130ec98d0aa0bc86baa4621393effd0b07",
|
||||
"tarball": "http://registry.npmjs.org/win-spawn/-/win-spawn-2.0.0.tgz"
|
||||
},
|
||||
"_from": "win-spawn@>=2.0.0 <2.1.0",
|
||||
"_npmVersion": "1.2.10",
|
||||
"_npmUser": {
|
||||
"name": "forbeslindesay",
|
||||
"email": "forbes@lindesay.co.uk"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "forbeslindesay",
|
||||
"email": "forbes@lindesay.co.uk"
|
||||
}
|
||||
],
|
||||
"directories": {},
|
||||
"_shasum": "397a29130ec98d0aa0bc86baa4621393effd0b07",
|
||||
"_resolved": "https://registry.npmjs.org/win-spawn/-/win-spawn-2.0.0.tgz"
|
||||
}
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
{
|
||||
"name": "grunt-contrib-sass",
|
||||
"description": "Compile Sass to CSS",
|
||||
"version": "0.7.3",
|
||||
"homepage": "https://github.com/gruntjs/grunt-contrib-sass",
|
||||
"author": {
|
||||
"name": "Grunt Team",
|
||||
"url": "http://gruntjs.com/"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/gruntjs/grunt-contrib-sass.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/gruntjs/grunt-contrib-sass/issues"
|
||||
},
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "https://github.com/gruntjs/grunt-contrib-sass/blob/master/LICENSE-MIT"
|
||||
}
|
||||
],
|
||||
"main": "Gruntfile.js",
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "grunt test"
|
||||
},
|
||||
"dependencies": {
|
||||
"dargs": "~0.1.0",
|
||||
"async": "~0.2.9",
|
||||
"chalk": "~0.4.0",
|
||||
"win-spawn": "~2.0.0",
|
||||
"which": "~1.0.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"grunt-contrib-clean": "~0.5.0",
|
||||
"grunt-contrib-jshint": "~0.7.2",
|
||||
"grunt-contrib-nodeunit": "~0.2.0",
|
||||
"grunt-contrib-internal": "~0.4.4",
|
||||
"grunt": "~0.4.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"grunt": "~0.4.0"
|
||||
},
|
||||
"keywords": [
|
||||
"gruntplugin",
|
||||
"scss",
|
||||
"sass",
|
||||
"css",
|
||||
"compile",
|
||||
"preprocessor",
|
||||
"style"
|
||||
],
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Sindre Sorhus",
|
||||
"url": "http://github.com/sindresorhus"
|
||||
}
|
||||
],
|
||||
"_id": "grunt-contrib-sass@0.7.3",
|
||||
"dist": {
|
||||
"shasum": "71bf7c57f7fa3f9f50a8f1700b3c1e08b66e2c88",
|
||||
"tarball": "http://registry.npmjs.org/grunt-contrib-sass/-/grunt-contrib-sass-0.7.3.tgz"
|
||||
},
|
||||
"_from": "grunt-contrib-sass@0.7.3",
|
||||
"_npmVersion": "1.4.3",
|
||||
"_npmUser": {
|
||||
"name": "jmeas",
|
||||
"email": "jellyes2@gmail.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "tkellen",
|
||||
"email": "tyler@sleekcode.net"
|
||||
},
|
||||
{
|
||||
"name": "cowboy",
|
||||
"email": "cowboy@rj3.net"
|
||||
},
|
||||
{
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "shama",
|
||||
"email": "kyle@dontkry.com"
|
||||
},
|
||||
{
|
||||
"name": "jmeas",
|
||||
"email": "jellyes2@gmail.com"
|
||||
}
|
||||
],
|
||||
"directories": {},
|
||||
"_shasum": "71bf7c57f7fa3f9f50a8f1700b3c1e08b66e2c88",
|
||||
"_resolved": "https://registry.npmjs.org/grunt-contrib-sass/-/grunt-contrib-sass-0.7.3.tgz"
|
||||
}
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* grunt-contrib-sass
|
||||
* http://gruntjs.com/
|
||||
*
|
||||
* Copyright (c) 2013 Sindre Sorhus, contributors
|
||||
* Licensed under the MIT license.
|
||||
*/
|
||||
'use strict';
|
||||
var path = require('path');
|
||||
var dargs = require('dargs');
|
||||
var numCPUs = require('os').cpus().length;
|
||||
var async = require('async');
|
||||
var chalk = require('chalk');
|
||||
var spawn = require('win-spawn');
|
||||
var which = require('which');
|
||||
|
||||
module.exports = function (grunt) {
|
||||
var bannerCallback = function (filename, banner) {
|
||||
var content;
|
||||
grunt.log.verbose.writeln('Writing CSS banner for ' + filename);
|
||||
|
||||
content = grunt.file.read(filename);
|
||||
grunt.file.write(filename, banner + grunt.util.linefeed + content);
|
||||
};
|
||||
|
||||
grunt.registerMultiTask('sass', 'Compile Sass to CSS', function () {
|
||||
var cb = this.async();
|
||||
var options = this.options();
|
||||
var passedArgs;
|
||||
var bundleExec;
|
||||
var banner;
|
||||
|
||||
try {
|
||||
which.sync('sass');
|
||||
} catch (err) {
|
||||
return grunt.warn(
|
||||
'\nYou need to have Ruby and Sass installed and in your PATH for this task to work.\n' +
|
||||
'More info: https://github.com/gruntjs/grunt-contrib-sass\n'
|
||||
);
|
||||
}
|
||||
|
||||
// Unset banner option if set
|
||||
if (options.banner) {
|
||||
banner = options.banner;
|
||||
delete options.banner;
|
||||
}
|
||||
|
||||
passedArgs = dargs(options, ['bundleExec']);
|
||||
bundleExec = options.bundleExec;
|
||||
|
||||
async.eachLimit(this.files, numCPUs, function (file, next) {
|
||||
var src = file.src[0];
|
||||
if (typeof src !== 'string') {
|
||||
src = file.orig.src[0];
|
||||
}
|
||||
|
||||
if (!grunt.file.exists(src)) {
|
||||
grunt.log.warn('Source file "' + src + '" not found.');
|
||||
return next();
|
||||
}
|
||||
|
||||
if (path.basename(src)[0] === '_') {
|
||||
return next();
|
||||
}
|
||||
|
||||
var args = [
|
||||
src,
|
||||
file.dest,
|
||||
'--load-path', path.dirname(src)
|
||||
].concat(passedArgs);
|
||||
|
||||
var bin = 'sass';
|
||||
|
||||
if (bundleExec) {
|
||||
bin = 'bundle';
|
||||
args.unshift('exec', 'sass');
|
||||
}
|
||||
|
||||
// If we're compiling scss or css files
|
||||
if (path.extname(src) === '.css') {
|
||||
args.push('--scss');
|
||||
}
|
||||
|
||||
// Make sure grunt creates the destination folders if they don't exist
|
||||
if(!grunt.file.exists(file.dest)) {
|
||||
grunt.file.write(file.dest, '');
|
||||
}
|
||||
|
||||
var cp = spawn(bin, args, {stdio: 'inherit'});
|
||||
|
||||
cp.on('error', function (err) {
|
||||
grunt.warn(err);
|
||||
});
|
||||
|
||||
cp.on('close', function (code) {
|
||||
if (code > 0) {
|
||||
return grunt.warn('Exited with error code ' + code);
|
||||
}
|
||||
|
||||
// Callback to insert banner
|
||||
if (banner) {
|
||||
bannerCallback(file.dest, banner);
|
||||
}
|
||||
|
||||
grunt.log.writeln('File ' + chalk.cyan(file.dest) + ' created.');
|
||||
next();
|
||||
});
|
||||
}, cb);
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user