Initial commit
This commit is contained in:
22
node_modules/npm-run-all/LICENSE
generated
vendored
Normal file
22
node_modules/npm-run-all/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Toru Nagashima
|
||||
|
||||
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.
|
||||
|
91
node_modules/npm-run-all/README.md
generated
vendored
Normal file
91
node_modules/npm-run-all/README.md
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
| index | [npm-run-all] | [run-s] | [run-p] | [Node API] |
|
||||
|-------|---------------|---------|---------|------------|
|
||||
|
||||
# npm-run-all
|
||||
|
||||
[](https://www.npmjs.com/package/npm-run-all)
|
||||
[](http://www.npmtrends.com/npm-run-all)
|
||||
[](https://travis-ci.org/mysticatea/npm-run-all)
|
||||
[](https://ci.appveyor.com/project/mysticatea/npm-run-all/branch/master)
|
||||
[](https://codecov.io/gh/mysticatea/npm-run-all)
|
||||
[](https://david-dm.org/mysticatea/npm-run-all)
|
||||
|
||||
A CLI tool to run multiple npm-scripts in parallel or sequential.
|
||||
|
||||
## ⤴️ Motivation
|
||||
|
||||
- **Simplify.** The official `npm run-script` command cannot run multiple scripts, so if we want to run multiple scripts, it's redundant a bit. Let's shorten it by glob-like patterns.<br>
|
||||
Before: `npm run clean && npm run build:css && npm run build:js && npm run build:html`<br>
|
||||
After: `npm-run-all clean build:*`
|
||||
- **Cross platform.** We sometimes use `&` to run multiple command in parallel, but `cmd.exe` (`npm run-script` uses it by default) does not support the `&`. Half of Node.js users are using it on Windows, so the use of `&` might block contributions. `npm-run-all --parallel` works well on Windows as well.
|
||||
|
||||
## 💿 Installation
|
||||
|
||||
```bash
|
||||
$ npm install npm-run-all --save-dev
|
||||
# or
|
||||
$ yarn add npm-run-all --dev
|
||||
```
|
||||
|
||||
- It requires `Node@>=4`.
|
||||
|
||||
## 📖 Usage
|
||||
|
||||
### CLI Commands
|
||||
|
||||
This `npm-run-all` package provides 3 CLI commands.
|
||||
|
||||
- [npm-run-all]
|
||||
- [run-s]
|
||||
- [run-p]
|
||||
|
||||
The main command is [npm-run-all].
|
||||
We can make complex plans with [npm-run-all] command.
|
||||
|
||||
Both [run-s] and [run-p] are shorthand commands.
|
||||
[run-s] is for sequential, [run-p] is for parallel.
|
||||
We can make simple plans with those commands.
|
||||
|
||||
#### Yarn Compatibility
|
||||
|
||||
If a script is invoked with Yarn, `npm-run-all` will correctly use Yarn to execute the plan's child scripts.
|
||||
|
||||
### Node API
|
||||
|
||||
This `npm-run-all` package provides Node API.
|
||||
|
||||
- [Node API]
|
||||
|
||||
## 📰 Changelog
|
||||
|
||||
- https://github.com/mysticatea/npm-run-all/releases
|
||||
|
||||
## 🍻 Contributing
|
||||
|
||||
Welcome♡
|
||||
|
||||
### Bug Reports or Feature Requests
|
||||
|
||||
Please use GitHub Issues.
|
||||
|
||||
### Correct Documents
|
||||
|
||||
Please use GitHub Pull Requests.
|
||||
|
||||
I'm not familiar with English, so I especially thank you for documents' corrections.
|
||||
|
||||
### Implementing
|
||||
|
||||
Please use GitHub Pull Requests.
|
||||
|
||||
There are some npm-scripts to help developments.
|
||||
|
||||
- **npm test** - Run tests and collect coverage.
|
||||
- **npm run clean** - Delete temporary files.
|
||||
- **npm run lint** - Run ESLint.
|
||||
- **npm run watch** - Run tests (not collect coverage) on every file change.
|
||||
|
||||
[npm-run-all]: docs/npm-run-all.md
|
||||
[run-s]: docs/run-s.md
|
||||
[run-p]: docs/run-p.md
|
||||
[Node API]: docs/node-api.md
|
51
node_modules/npm-run-all/bin/common/bootstrap.js
generated
vendored
Normal file
51
node_modules/npm-run-all/bin/common/bootstrap.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* @author Toru Nagashima
|
||||
* @copyright 2016 Toru Nagashima. All rights reserved.
|
||||
* See LICENSE file in root directory for full license.
|
||||
*/
|
||||
"use strict"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
/*eslint-disable no-process-exit */
|
||||
|
||||
module.exports = function bootstrap(name) {
|
||||
const argv = process.argv.slice(2)
|
||||
|
||||
switch (argv[0]) {
|
||||
case undefined:
|
||||
case "-h":
|
||||
case "--help":
|
||||
return require(`../${name}/help`)(process.stdout)
|
||||
|
||||
case "-v":
|
||||
case "--version":
|
||||
return require("./version")(process.stdout)
|
||||
|
||||
default:
|
||||
// https://github.com/mysticatea/npm-run-all/issues/105
|
||||
// Avoid MaxListenersExceededWarnings.
|
||||
process.stdout.setMaxListeners(0)
|
||||
process.stderr.setMaxListeners(0)
|
||||
process.stdin.setMaxListeners(0)
|
||||
|
||||
// Main
|
||||
return require(`../${name}/main`)(
|
||||
argv,
|
||||
process.stdout,
|
||||
process.stderr
|
||||
).then(
|
||||
() => {
|
||||
// I'm not sure why, but maybe the process never exits
|
||||
// on Git Bash (MINGW64)
|
||||
process.exit(0)
|
||||
},
|
||||
() => {
|
||||
process.exit(1)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/*eslint-enable */
|
251
node_modules/npm-run-all/bin/common/parse-cli-args.js
generated
vendored
Normal file
251
node_modules/npm-run-all/bin/common/parse-cli-args.js
generated
vendored
Normal file
@@ -0,0 +1,251 @@
|
||||
/**
|
||||
* @author Toru Nagashima
|
||||
* @copyright 2016 Toru Nagashima. All rights reserved.
|
||||
* See LICENSE file in root directory for full license.
|
||||
*/
|
||||
"use strict"
|
||||
|
||||
/*eslint-disable no-process-env */
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const OVERWRITE_OPTION = /^--([^:]+?):([^=]+?)(?:=(.+))?$/
|
||||
const CONFIG_OPTION = /^--([^=]+?)(?:=(.+))$/
|
||||
const PACKAGE_CONFIG_PATTERN = /^npm_package_config_(.+)$/
|
||||
const CONCAT_OPTIONS = /^-[clnprs]+$/
|
||||
|
||||
/**
|
||||
* Overwrites a specified package config.
|
||||
*
|
||||
* @param {object} config - A config object to be overwritten.
|
||||
* @param {string} packageName - A package name to overwrite.
|
||||
* @param {string} variable - A variable name to overwrite.
|
||||
* @param {string} value - A new value to overwrite.
|
||||
* @returns {void}
|
||||
*/
|
||||
function overwriteConfig(config, packageName, variable, value) {
|
||||
const scope = config[packageName] || (config[packageName] = {})
|
||||
scope[variable] = value
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a package config object.
|
||||
* This checks `process.env` and creates the default value.
|
||||
*
|
||||
* @returns {object} Created config object.
|
||||
*/
|
||||
function createPackageConfig() {
|
||||
const retv = {}
|
||||
const packageName = process.env.npm_package_name
|
||||
if (!packageName) {
|
||||
return retv
|
||||
}
|
||||
|
||||
for (const key of Object.keys(process.env)) {
|
||||
const m = PACKAGE_CONFIG_PATTERN.exec(key)
|
||||
if (m != null) {
|
||||
overwriteConfig(retv, packageName, m[1], process.env[key])
|
||||
}
|
||||
}
|
||||
|
||||
return retv
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new group into a given list.
|
||||
*
|
||||
* @param {object[]} groups - A group list to add.
|
||||
* @param {object} initialValues - A key-value map for the default of new value.
|
||||
* @returns {void}
|
||||
*/
|
||||
function addGroup(groups, initialValues) {
|
||||
groups.push(Object.assign(
|
||||
{ parallel: false, patterns: [] },
|
||||
initialValues || {}
|
||||
))
|
||||
}
|
||||
|
||||
/**
|
||||
* ArgumentSet is values of parsed CLI arguments.
|
||||
* This class provides the getter to get the last group.
|
||||
*/
|
||||
class ArgumentSet {
|
||||
/**
|
||||
* @param {object} initialValues - A key-value map for the default of new value.
|
||||
* @param {object} options - A key-value map for the options.
|
||||
*/
|
||||
constructor(initialValues, options) {
|
||||
this.config = {}
|
||||
this.continueOnError = false
|
||||
this.groups = []
|
||||
this.maxParallel = 0
|
||||
this.npmPath = null
|
||||
this.packageConfig = createPackageConfig()
|
||||
this.printLabel = false
|
||||
this.printName = false
|
||||
this.race = false
|
||||
this.rest = []
|
||||
this.silent = process.env.npm_config_loglevel === "silent"
|
||||
this.singleMode = Boolean(options && options.singleMode)
|
||||
|
||||
addGroup(this.groups, initialValues)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the last group.
|
||||
*/
|
||||
get lastGroup() {
|
||||
return this.groups[this.groups.length - 1]
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets "parallel" flag.
|
||||
*/
|
||||
get parallel() {
|
||||
return this.groups.some(g => g.parallel)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses CLI arguments.
|
||||
*
|
||||
* @param {ArgumentSet} set - The parsed CLI arguments.
|
||||
* @param {string[]} args - CLI arguments.
|
||||
* @returns {ArgumentSet} set itself.
|
||||
*/
|
||||
function parseCLIArgsCore(set, args) { // eslint-disable-line complexity
|
||||
LOOP:
|
||||
for (let i = 0; i < args.length; ++i) {
|
||||
const arg = args[i]
|
||||
|
||||
switch (arg) {
|
||||
case "--":
|
||||
set.rest = args.slice(1 + i)
|
||||
break LOOP
|
||||
|
||||
case "--color":
|
||||
case "--no-color":
|
||||
// do nothing.
|
||||
break
|
||||
|
||||
case "-c":
|
||||
case "--continue-on-error":
|
||||
set.continueOnError = true
|
||||
break
|
||||
|
||||
case "-l":
|
||||
case "--print-label":
|
||||
set.printLabel = true
|
||||
break
|
||||
|
||||
case "-n":
|
||||
case "--print-name":
|
||||
set.printName = true
|
||||
break
|
||||
|
||||
case "-r":
|
||||
case "--race":
|
||||
set.race = true
|
||||
break
|
||||
|
||||
case "--silent":
|
||||
set.silent = true
|
||||
break
|
||||
|
||||
case "--max-parallel":
|
||||
set.maxParallel = parseInt(args[++i], 10)
|
||||
if (!Number.isFinite(set.maxParallel) || set.maxParallel <= 0) {
|
||||
throw new Error(`Invalid Option: --max-parallel ${args[i]}`)
|
||||
}
|
||||
break
|
||||
|
||||
case "-s":
|
||||
case "--sequential":
|
||||
case "--serial":
|
||||
if (set.singleMode && arg === "-s") {
|
||||
set.silent = true
|
||||
break
|
||||
}
|
||||
if (set.singleMode) {
|
||||
throw new Error(`Invalid Option: ${arg}`)
|
||||
}
|
||||
addGroup(set.groups)
|
||||
break
|
||||
|
||||
case "--aggregate-output":
|
||||
set.aggregateOutput = true
|
||||
break
|
||||
|
||||
case "-p":
|
||||
case "--parallel":
|
||||
if (set.singleMode) {
|
||||
throw new Error(`Invalid Option: ${arg}`)
|
||||
}
|
||||
addGroup(set.groups, { parallel: true })
|
||||
break
|
||||
|
||||
case "--npm-path":
|
||||
set.npmPath = args[++i] || null
|
||||
break
|
||||
|
||||
default: {
|
||||
let matched = null
|
||||
if ((matched = OVERWRITE_OPTION.exec(arg))) {
|
||||
overwriteConfig(
|
||||
set.packageConfig,
|
||||
matched[1],
|
||||
matched[2],
|
||||
matched[3] || args[++i]
|
||||
)
|
||||
}
|
||||
else if ((matched = CONFIG_OPTION.exec(arg))) {
|
||||
set.config[matched[1]] = matched[2]
|
||||
}
|
||||
else if (CONCAT_OPTIONS.test(arg)) {
|
||||
parseCLIArgsCore(
|
||||
set,
|
||||
arg.slice(1).split("").map(c => `-${c}`)
|
||||
)
|
||||
}
|
||||
else if (arg[0] === "-") {
|
||||
throw new Error(`Invalid Option: ${arg}`)
|
||||
}
|
||||
else {
|
||||
set.lastGroup.patterns.push(arg)
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!set.parallel && set.aggregateOutput) {
|
||||
throw new Error("Invalid Option: --aggregate-output (without parallel)")
|
||||
}
|
||||
if (!set.parallel && set.race) {
|
||||
const race = args.indexOf("--race") !== -1 ? "--race" : "-r"
|
||||
throw new Error(`Invalid Option: ${race} (without parallel)`)
|
||||
}
|
||||
if (!set.parallel && set.maxParallel !== 0) {
|
||||
throw new Error("Invalid Option: --max-parallel (without parallel)")
|
||||
}
|
||||
|
||||
return set
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses CLI arguments.
|
||||
*
|
||||
* @param {string[]} args - CLI arguments.
|
||||
* @param {object} initialValues - A key-value map for the default of new value.
|
||||
* @param {object} options - A key-value map for the options.
|
||||
* @param {boolean} options.singleMode - The flag to be single group mode.
|
||||
* @returns {ArgumentSet} The parsed CLI arguments.
|
||||
*/
|
||||
module.exports = function parseCLIArgs(args, initialValues, options) {
|
||||
return parseCLIArgsCore(new ArgumentSet(initialValues, options), args)
|
||||
}
|
||||
|
||||
/*eslint-enable */
|
25
node_modules/npm-run-all/bin/common/version.js
generated
vendored
Normal file
25
node_modules/npm-run-all/bin/common/version.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* @author Toru Nagashima
|
||||
* @copyright 2016 Toru Nagashima. All rights reserved.
|
||||
* See LICENSE file in root directory for full license.
|
||||
*/
|
||||
"use strict"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Print a version text.
|
||||
*
|
||||
* @param {stream.Writable} output - A writable stream to print.
|
||||
* @returns {Promise} Always a fulfilled promise.
|
||||
* @private
|
||||
*/
|
||||
module.exports = function printVersion(output) {
|
||||
const version = require("../../package.json").version
|
||||
|
||||
output.write(`v${version}\n`)
|
||||
|
||||
return Promise.resolve(null)
|
||||
}
|
71
node_modules/npm-run-all/bin/npm-run-all/help.js
generated
vendored
Normal file
71
node_modules/npm-run-all/bin/npm-run-all/help.js
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* @author Toru Nagashima
|
||||
* @copyright 2015 Toru Nagashima. All rights reserved.
|
||||
* See LICENSE file in root directory for full license.
|
||||
*/
|
||||
"use strict"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Print a help text.
|
||||
*
|
||||
* @param {stream.Writable} output - A writable stream to print.
|
||||
* @returns {Promise} Always a fulfilled promise.
|
||||
* @private
|
||||
*/
|
||||
module.exports = function printHelp(output) {
|
||||
output.write(`
|
||||
Usage:
|
||||
$ npm-run-all [--help | -h | --version | -v]
|
||||
$ npm-run-all [tasks] [OPTIONS]
|
||||
|
||||
Run given npm-scripts in parallel or sequential.
|
||||
|
||||
<tasks> : A list of npm-scripts' names and Glob-like patterns.
|
||||
|
||||
Options:
|
||||
--aggregate-output - - - Avoid interleaving output by delaying printing of
|
||||
each command's output until it has finished.
|
||||
-c, --continue-on-error - Set the flag to continue executing
|
||||
other/subsequent tasks even if a task threw an
|
||||
error. 'npm-run-all' itself will exit with
|
||||
non-zero code if one or more tasks threw error(s)
|
||||
--max-parallel <number> - Set the maximum number of parallelism. Default is
|
||||
unlimited.
|
||||
--npm-path <string> - - - Set the path to npm. Default is the value of
|
||||
environment variable npm_execpath.
|
||||
If the variable is not defined, then it's "npm".
|
||||
In this case, the "npm" command must be found in
|
||||
environment variable PATH.
|
||||
-l, --print-label - - - - Set the flag to print the task name as a prefix
|
||||
on each line of output. Tools in tasks may stop
|
||||
coloring their output if this option was given.
|
||||
-n, --print-name - - - - Set the flag to print the task name before
|
||||
running each task.
|
||||
-p, --parallel <tasks> - Run a group of tasks in parallel.
|
||||
e.g. 'npm-run-all -p foo bar' is similar to
|
||||
'npm run foo & npm run bar'.
|
||||
-r, --race - - - - - - - Set the flag to kill all tasks when a task
|
||||
finished with zero. This option is valid only
|
||||
with 'parallel' option.
|
||||
-s, --sequential <tasks> - Run a group of tasks sequentially.
|
||||
--serial <tasks> e.g. 'npm-run-all -s foo bar' is similar to
|
||||
'npm run foo && npm run bar'.
|
||||
'--serial' is a synonym of '--sequential'.
|
||||
--silent - - - - - - - - Set 'silent' to the log level of npm.
|
||||
|
||||
Examples:
|
||||
$ npm-run-all --serial clean lint build:**
|
||||
$ npm-run-all --parallel watch:**
|
||||
$ npm-run-all clean lint --parallel "build:** -- --watch"
|
||||
$ npm-run-all -l -p start-server start-browser start-electron
|
||||
|
||||
See Also:
|
||||
https://github.com/mysticatea/npm-run-all#readme
|
||||
`)
|
||||
|
||||
return Promise.resolve(null)
|
||||
}
|
13
node_modules/npm-run-all/bin/npm-run-all/index.js
generated
vendored
Executable file
13
node_modules/npm-run-all/bin/npm-run-all/index.js
generated
vendored
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* @author Toru Nagashima
|
||||
* @copyright 2015 Toru Nagashima. All rights reserved.
|
||||
* See LICENSE file in root directory for full license.
|
||||
*/
|
||||
"use strict"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Main
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
require("../common/bootstrap")("npm-run-all")
|
77
node_modules/npm-run-all/bin/npm-run-all/main.js
generated
vendored
Normal file
77
node_modules/npm-run-all/bin/npm-run-all/main.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
/**
|
||||
* @author Toru Nagashima
|
||||
* @copyright 2015 Toru Nagashima. All rights reserved.
|
||||
* See LICENSE file in root directory for full license.
|
||||
*/
|
||||
"use strict"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const runAll = require("../../lib")
|
||||
const parseCLIArgs = require("../common/parse-cli-args")
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Parses arguments, then run specified npm-scripts.
|
||||
*
|
||||
* @param {string[]} args - Arguments to parse.
|
||||
* @param {stream.Writable} stdout - A writable stream to print logs.
|
||||
* @param {stream.Writable} stderr - A writable stream to print errors.
|
||||
* @returns {Promise} A promise which comes to be fulfilled when all npm-scripts are completed.
|
||||
* @private
|
||||
*/
|
||||
module.exports = function npmRunAll(args, stdout, stderr) {
|
||||
try {
|
||||
const stdin = process.stdin
|
||||
const argv = parseCLIArgs(args)
|
||||
|
||||
const promise = argv.groups.reduce(
|
||||
(prev, group) => {
|
||||
if (group.patterns.length === 0) {
|
||||
return prev
|
||||
}
|
||||
return prev.then(() => runAll(
|
||||
group.patterns,
|
||||
{
|
||||
stdout,
|
||||
stderr,
|
||||
stdin,
|
||||
parallel: group.parallel,
|
||||
maxParallel: group.parallel ? argv.maxParallel : 1,
|
||||
continueOnError: argv.continueOnError,
|
||||
printLabel: argv.printLabel,
|
||||
printName: argv.printName,
|
||||
config: argv.config,
|
||||
packageConfig: argv.packageConfig,
|
||||
silent: argv.silent,
|
||||
arguments: argv.rest,
|
||||
race: group.parallel && argv.race,
|
||||
npmPath: argv.npmPath,
|
||||
aggregateOutput: group.parallel && argv.aggregateOutput,
|
||||
}
|
||||
))
|
||||
},
|
||||
Promise.resolve(null)
|
||||
)
|
||||
|
||||
if (!argv.silent) {
|
||||
promise.catch(err => {
|
||||
//eslint-disable-next-line no-console
|
||||
console.error("ERROR:", err.message)
|
||||
})
|
||||
}
|
||||
|
||||
return promise
|
||||
}
|
||||
catch (err) {
|
||||
//eslint-disable-next-line no-console
|
||||
console.error("ERROR:", err.message)
|
||||
|
||||
return Promise.reject(err)
|
||||
}
|
||||
}
|
66
node_modules/npm-run-all/bin/run-p/help.js
generated
vendored
Normal file
66
node_modules/npm-run-all/bin/run-p/help.js
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* @author Toru Nagashima
|
||||
* @copyright 2016 Toru Nagashima. All rights reserved.
|
||||
* See LICENSE file in root directory for full license.
|
||||
*/
|
||||
"use strict"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Print a help text.
|
||||
*
|
||||
* @param {stream.Writable} output - A writable stream to print.
|
||||
* @returns {Promise} Always a fulfilled promise.
|
||||
* @private
|
||||
*/
|
||||
module.exports = function printHelp(output) {
|
||||
output.write(`
|
||||
Usage:
|
||||
$ run-p [--help | -h | --version | -v]
|
||||
$ run-p [OPTIONS] <tasks>
|
||||
|
||||
Run given npm-scripts in parallel.
|
||||
|
||||
<tasks> : A list of npm-scripts' names and Glob-like patterns.
|
||||
|
||||
Options:
|
||||
--aggregate-output - - - Avoid interleaving output by delaying printing of
|
||||
each command's output until it has finished.
|
||||
-c, --continue-on-error - Set the flag to continue executing other tasks
|
||||
even if a task threw an error. 'run-p' itself
|
||||
will exit with non-zero code if one or more tasks
|
||||
threw error(s).
|
||||
--max-parallel <number> - Set the maximum number of parallelism. Default is
|
||||
unlimited.
|
||||
--npm-path <string> - - - Set the path to npm. Default is the value of
|
||||
environment variable npm_execpath.
|
||||
If the variable is not defined, then it's "npm."
|
||||
In this case, the "npm" command must be found in
|
||||
environment variable PATH.
|
||||
-l, --print-label - - - - Set the flag to print the task name as a prefix
|
||||
on each line of output. Tools in tasks may stop
|
||||
coloring their output if this option was given.
|
||||
-n, --print-name - - - - Set the flag to print the task name before
|
||||
running each task.
|
||||
-r, --race - - - - - - - Set the flag to kill all tasks when a task
|
||||
finished with zero.
|
||||
-s, --silent - - - - - - Set 'silent' to the log level of npm.
|
||||
|
||||
Shorthand aliases can be combined.
|
||||
For example, '-clns' equals to '-c -l -n -s'.
|
||||
|
||||
Examples:
|
||||
$ run-p watch:**
|
||||
$ run-p --print-label "build:** -- --watch"
|
||||
$ run-p -sl "build:** -- --watch"
|
||||
$ run-p start-server start-browser start-electron
|
||||
|
||||
See Also:
|
||||
https://github.com/mysticatea/npm-run-all#readme
|
||||
`)
|
||||
|
||||
return Promise.resolve(null)
|
||||
}
|
13
node_modules/npm-run-all/bin/run-p/index.js
generated
vendored
Executable file
13
node_modules/npm-run-all/bin/run-p/index.js
generated
vendored
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* @author Toru Nagashima
|
||||
* @copyright 2015 Toru Nagashima. All rights reserved.
|
||||
* See LICENSE file in root directory for full license.
|
||||
*/
|
||||
"use strict"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Main
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
require("../common/bootstrap")("run-p")
|
74
node_modules/npm-run-all/bin/run-p/main.js
generated
vendored
Normal file
74
node_modules/npm-run-all/bin/run-p/main.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* @author Toru Nagashima
|
||||
* @copyright 2016 Toru Nagashima. All rights reserved.
|
||||
* See LICENSE file in root directory for full license.
|
||||
*/
|
||||
"use strict"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const runAll = require("../../lib")
|
||||
const parseCLIArgs = require("../common/parse-cli-args")
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Parses arguments, then run specified npm-scripts.
|
||||
*
|
||||
* @param {string[]} args - Arguments to parse.
|
||||
* @param {stream.Writable} stdout - A writable stream to print logs.
|
||||
* @param {stream.Writable} stderr - A writable stream to print errors.
|
||||
* @returns {Promise} A promise which comes to be fulfilled when all npm-scripts are completed.
|
||||
* @private
|
||||
*/
|
||||
module.exports = function npmRunAll(args, stdout, stderr) {
|
||||
try {
|
||||
const stdin = process.stdin
|
||||
const argv = parseCLIArgs(args, { parallel: true }, { singleMode: true })
|
||||
const group = argv.lastGroup
|
||||
|
||||
if (group.patterns.length === 0) {
|
||||
return Promise.resolve(null)
|
||||
}
|
||||
|
||||
const promise = runAll(
|
||||
group.patterns,
|
||||
{
|
||||
stdout,
|
||||
stderr,
|
||||
stdin,
|
||||
parallel: group.parallel,
|
||||
maxParallel: argv.maxParallel,
|
||||
continueOnError: argv.continueOnError,
|
||||
printLabel: argv.printLabel,
|
||||
printName: argv.printName,
|
||||
config: argv.config,
|
||||
packageConfig: argv.packageConfig,
|
||||
silent: argv.silent,
|
||||
arguments: argv.rest,
|
||||
race: argv.race,
|
||||
npmPath: argv.npmPath,
|
||||
aggregateOutput: argv.aggregateOutput,
|
||||
}
|
||||
)
|
||||
|
||||
if (!argv.silent) {
|
||||
promise.catch(err => {
|
||||
//eslint-disable-next-line no-console
|
||||
console.error("ERROR:", err.message)
|
||||
})
|
||||
}
|
||||
|
||||
return promise
|
||||
}
|
||||
catch (err) {
|
||||
//eslint-disable-next-line no-console
|
||||
console.error("ERROR:", err.message)
|
||||
|
||||
return Promise.reject(err)
|
||||
}
|
||||
}
|
60
node_modules/npm-run-all/bin/run-s/help.js
generated
vendored
Normal file
60
node_modules/npm-run-all/bin/run-s/help.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* @author Toru Nagashima
|
||||
* @copyright 2016 Toru Nagashima. All rights reserved.
|
||||
* See LICENSE file in root directory for full license.
|
||||
*/
|
||||
"use strict"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Print a help text.
|
||||
*
|
||||
* @param {stream.Writable} output - A writable stream to print.
|
||||
* @returns {Promise} Always a fulfilled promise.
|
||||
* @private
|
||||
*/
|
||||
module.exports = function printHelp(output) {
|
||||
output.write(`
|
||||
Usage:
|
||||
$ run-s [--help | -h | --version | -v]
|
||||
$ run-s [OPTIONS] <tasks>
|
||||
|
||||
Run given npm-scripts sequentially.
|
||||
|
||||
<tasks> : A list of npm-scripts' names and Glob-like patterns.
|
||||
|
||||
Options:
|
||||
-c, --continue-on-error - Set the flag to continue executing subsequent
|
||||
tasks even if a task threw an error. 'run-s'
|
||||
itself will exit with non-zero code if one or
|
||||
more tasks threw error(s).
|
||||
--npm-path <string> - - - Set the path to npm. Default is the value of
|
||||
environment variable npm_execpath.
|
||||
If the variable is not defined, then it's "npm."
|
||||
In this case, the "npm" command must be found in
|
||||
environment variable PATH.
|
||||
-l, --print-label - - - - Set the flag to print the task name as a prefix
|
||||
on each line of output. Tools in tasks may stop
|
||||
coloring their output if this option was given.
|
||||
-n, --print-name - - - - Set the flag to print the task name before
|
||||
running each task.
|
||||
-s, --silent - - - - - - Set 'silent' to the log level of npm.
|
||||
|
||||
Shorthand aliases can be combined.
|
||||
For example, '-clns' equals to '-c -l -n -s'.
|
||||
|
||||
Examples:
|
||||
$ run-s build:**
|
||||
$ run-s lint clean build:**
|
||||
$ run-s --silent --print-name lint clean build:**
|
||||
$ run-s -sn lint clean build:**
|
||||
|
||||
See Also:
|
||||
https://github.com/mysticatea/npm-run-all#readme
|
||||
`)
|
||||
|
||||
return Promise.resolve(null)
|
||||
}
|
13
node_modules/npm-run-all/bin/run-s/index.js
generated
vendored
Executable file
13
node_modules/npm-run-all/bin/run-s/index.js
generated
vendored
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* @author Toru Nagashima
|
||||
* @copyright 2015 Toru Nagashima. All rights reserved.
|
||||
* See LICENSE file in root directory for full license.
|
||||
*/
|
||||
"use strict"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Main
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
require("../common/bootstrap")("run-s")
|
71
node_modules/npm-run-all/bin/run-s/main.js
generated
vendored
Normal file
71
node_modules/npm-run-all/bin/run-s/main.js
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* @author Toru Nagashima
|
||||
* @copyright 2016 Toru Nagashima. All rights reserved.
|
||||
* See LICENSE file in root directory for full license.
|
||||
*/
|
||||
"use strict"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const runAll = require("../../lib")
|
||||
const parseCLIArgs = require("../common/parse-cli-args")
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Parses arguments, then run specified npm-scripts.
|
||||
*
|
||||
* @param {string[]} args - Arguments to parse.
|
||||
* @param {stream.Writable} stdout - A writable stream to print logs.
|
||||
* @param {stream.Writable} stderr - A writable stream to print errors.
|
||||
* @returns {Promise} A promise which comes to be fulfilled when all npm-scripts are completed.
|
||||
* @private
|
||||
*/
|
||||
module.exports = function npmRunAll(args, stdout, stderr) {
|
||||
try {
|
||||
const stdin = process.stdin
|
||||
const argv = parseCLIArgs(args, { parallel: false }, { singleMode: true })
|
||||
const group = argv.lastGroup
|
||||
|
||||
if (group.patterns.length === 0) {
|
||||
return Promise.resolve(null)
|
||||
}
|
||||
|
||||
const promise = runAll(
|
||||
group.patterns,
|
||||
{
|
||||
stdout,
|
||||
stderr,
|
||||
stdin,
|
||||
parallel: group.parallel,
|
||||
continueOnError: argv.continueOnError,
|
||||
printLabel: argv.printLabel,
|
||||
printName: argv.printName,
|
||||
config: argv.config,
|
||||
packageConfig: argv.packageConfig,
|
||||
silent: argv.silent,
|
||||
arguments: argv.rest,
|
||||
npmPath: argv.npmPath,
|
||||
}
|
||||
)
|
||||
|
||||
if (!argv.silent) {
|
||||
promise.catch(err => {
|
||||
//eslint-disable-next-line no-console
|
||||
console.error("ERROR:", err.message)
|
||||
})
|
||||
}
|
||||
|
||||
return promise
|
||||
}
|
||||
catch (err) {
|
||||
//eslint-disable-next-line no-console
|
||||
console.error("ERROR:", err.message)
|
||||
|
||||
return Promise.reject(err)
|
||||
}
|
||||
}
|
117
node_modules/npm-run-all/docs/node-api.md
generated
vendored
Normal file
117
node_modules/npm-run-all/docs/node-api.md
generated
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
| [index](../README.md) | [npm-run-all](npm-run-all.md) | [run-s](run-s.md) | [run-p](run-p.md) | Node API |
|
||||
|-----------------------|-------------------------------|-------------------|-------------------|----------|
|
||||
|
||||
# Node API
|
||||
|
||||
A Node module to run given npm-scripts in parallel or sequential.
|
||||
|
||||
```js
|
||||
const runAll = require("npm-run-all");
|
||||
|
||||
runAll(["clean", "lint", "build:*"], {parallel: false})
|
||||
.then(() => {
|
||||
console.log("done!");
|
||||
})
|
||||
.catch(err => {
|
||||
console.log("failed!");
|
||||
});
|
||||
|
||||
runAll(["build:* -- --watch"], {parallel: true})
|
||||
.then(() => {
|
||||
console.log("done!");
|
||||
})
|
||||
.catch(err => {
|
||||
console.log("failed!");
|
||||
});
|
||||
```
|
||||
|
||||
## runAll
|
||||
|
||||
```
|
||||
let promise = runAll(patterns, options);
|
||||
```
|
||||
|
||||
Run npm-scripts.
|
||||
|
||||
- **patterns** `string|string[]` -- Glob-like patterns for script names.
|
||||
- **options** `object`
|
||||
- **options.aggregateOutput** `boolean` --
|
||||
The flag to avoid interleaving output by delaying printing of each command's output until it has finished.
|
||||
This option is valid only with `options.parallel` option.
|
||||
Default is `false`.
|
||||
- **options.arguments** `string[]` --
|
||||
An argument list to replace argument placeholders (such as `{1}`, `{2}`). If pattern text has `{1}`, it's replaced by `options.arguments[0]`.
|
||||
Default is an empty array.
|
||||
- **options.continueOnError** `boolean` --
|
||||
The flag to continue executing other/subsequent scripts even if a script threw an error.
|
||||
Returned `Promise` object will be rejected if one or more scripts threw error(s).
|
||||
Default is `false`.
|
||||
- **options.parallel** `boolean` --
|
||||
The flag to run scripts in parallel.
|
||||
Default is `false`.
|
||||
- **options.maxParallel** `number` --
|
||||
The maximum number of parallelism.
|
||||
This option is valid only with `options.parallel` option.
|
||||
Default is `Number.POSITIVE_INFINITY`.
|
||||
- **options.npmPath** `string` --
|
||||
The path to npm.
|
||||
Default is `process.env.npm_execpath` or `"npm"`.
|
||||
- **options.packageConfig** `object|null` --
|
||||
The map-like object to overwrite package configs.
|
||||
Keys are package names.
|
||||
Every value is a map-like object (Pairs of variable name and value).
|
||||
e.g. `{"npm-run-all": {"test": 777, "test2": 333}}`
|
||||
Default is `null`.
|
||||
- **options.printLabel** `boolean` --
|
||||
Set the flag to print the task name as a prefix on each line of output.
|
||||
Tools in scripts may stop coloring their output if this option is given.
|
||||
Default is `false`.
|
||||
- **options.printName** `boolean` --
|
||||
Set the flag to print the task name before running each task.
|
||||
Default is `false`.
|
||||
- **options.race** `boolean` --
|
||||
Set the flag to kill all npm-scripts when a npm-script finished with zero.
|
||||
This option is valid only with `options.parallel` option.
|
||||
Default is `false`.
|
||||
- **options.silent** `boolean` --
|
||||
The flag to set `silent` to the log level of npm.
|
||||
Default is `false`.
|
||||
- **options.stdin** `stream.Readable|null` --
|
||||
The readable stream to send to the stdin of npm-scripts.
|
||||
Default is nothing.
|
||||
Set `process.stdin` in order to send from stdin.
|
||||
- **options.stdout** `stream.Writable|null` --
|
||||
The writable stream to receive from the stdout of npm-scripts.
|
||||
Default is nothing.
|
||||
Set `process.stdout` in order to print to stdout.
|
||||
- **options.stderr** `stream.Writable|null` --
|
||||
The writable stream to receive from the stderr of npm-scripts
|
||||
Default is nothing.
|
||||
Set `process.stderr` in order to print to stderr.
|
||||
- **options.taskList** `string[]|null` --
|
||||
The string array of all script names.
|
||||
If this is `null`, it reads from `package.json` in the current directory.
|
||||
Default is `null`.
|
||||
|
||||
`runAll` returns a promise that will becomes *fulfilled* when all scripts are completed.
|
||||
The promise will become *rejected* when any of the scripts exit with a non-zero code.
|
||||
|
||||
The promise gives `results` to the fulfilled handler.
|
||||
`results` is an array of objects which have 2 properties: `name` and `code`.
|
||||
The `name` property is the name of a npm-script.
|
||||
The `code` property is the exit code of the npm-script. If the npm-script was not executed, the `code` property is `undefined`.
|
||||
|
||||
```js
|
||||
runAll(["clean", "lint", "build"])
|
||||
.then(results => {
|
||||
console.log(`${results[0].name}: ${results[0].code}`); // clean: 0
|
||||
console.log(`${results[1].name}: ${results[1].code}`); // lint: 0
|
||||
console.log(`${results[2].name}: ${results[2].code}`); // build: 0
|
||||
});
|
||||
```
|
||||
|
||||
## About MaxListenersExceededWarning
|
||||
|
||||
- If you use `options.stdin`, `options.stdout`, or `options.stderr` in parallel mode, please configure max listeners by [emitter.setMaxListeners(n)](https://nodejs.org/api/events.html#events_emitter_setmaxlisteners_n) properly.
|
||||
- If you don't use those options and `process.stdXXX.isTTY` is `false`, please configure max listeners of the `process.stdXXX` properly. In that case, `npm-run-all` uses piping to connect to child processes.<br>
|
||||
On the other hand, if `process.stdXXX.isTTY` is `true`, `npm-run-all` uses `inherit` option, so the configuration is unnecessary.
|
192
node_modules/npm-run-all/docs/npm-run-all.md
generated
vendored
Normal file
192
node_modules/npm-run-all/docs/npm-run-all.md
generated
vendored
Normal file
@@ -0,0 +1,192 @@
|
||||
| [index](../README.md) | npm-run-all | [run-s](run-s.md) | [run-p](run-p.md) | [Node API](node-api.md) |
|
||||
|-----------------------|-------------|-------------------|-------------------|-------------------------|
|
||||
|
||||
# `npm-run-all` command
|
||||
|
||||
```
|
||||
Usage:
|
||||
$ npm-run-all [--help | -h | --version | -v]
|
||||
$ npm-run-all [tasks] [OPTIONS]
|
||||
|
||||
Run given npm-scripts in parallel or sequential.
|
||||
|
||||
<tasks> : A list of npm-scripts' names and Glob-like patterns.
|
||||
|
||||
Options:
|
||||
--aggregate-output - - - Avoid interleaving output by delaying printing of
|
||||
each command's output until it has finished.
|
||||
-c, --continue-on-error - Set the flag to continue executing
|
||||
other/subsequent tasks even if a task threw an
|
||||
error. 'npm-run-all' itself will exit with
|
||||
non-zero code if one or more tasks threw error(s)
|
||||
--max-parallel <number> - Set the maximum number of parallelism. Default is
|
||||
unlimited.
|
||||
--npm-path <string> - - - Set the path to npm. Default is the value of
|
||||
environment variable npm_execpath.
|
||||
If the variable is not defined, then it's "npm."
|
||||
In this case, the "npm" command must be found in
|
||||
environment variable PATH.
|
||||
-l, --print-label - - - - Set the flag to print the task name as a prefix
|
||||
on each line of output. Tools in tasks may stop
|
||||
coloring their output if this option was given.
|
||||
-n, --print-name - - - - Set the flag to print the task name before
|
||||
running each task.
|
||||
-p, --parallel <tasks> - Run a group of tasks in parallel.
|
||||
e.g. 'npm-run-all -p foo bar' is similar to
|
||||
'npm run foo & npm run bar'.
|
||||
-r, --race - - - - - - - Set the flag to kill all tasks when a task
|
||||
finished with zero. This option is valid only
|
||||
with 'parallel' option.
|
||||
-s, --sequential <tasks> - Run a group of tasks sequentially.
|
||||
--serial <tasks> e.g. 'npm-run-all -s foo bar' is similar to
|
||||
'npm run foo && npm run bar'.
|
||||
'--serial' is a synonym of '--sequential'.
|
||||
--silent - - - - - - - - Set 'silent' to the log level of npm.
|
||||
|
||||
Examples:
|
||||
$ npm-run-all --serial clean lint build:**
|
||||
$ npm-run-all --parallel watch:**
|
||||
$ npm-run-all clean lint --parallel "build:** -- --watch"
|
||||
$ npm-run-all -l -p start-server start-browser start-electron
|
||||
```
|
||||
|
||||
### npm-scripts
|
||||
|
||||
It's `"scripts"` field of `package.json`.
|
||||
For example:
|
||||
|
||||
```json
|
||||
{
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
"lint": "eslint src",
|
||||
"build": "babel src -o lib"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
We can run a script with `npm run` command.
|
||||
On the other hand, this `npm-run-all` command runs multiple scripts in parallel or sequential.
|
||||
|
||||
### Run scripts sequentially
|
||||
|
||||
```
|
||||
$ npm-run-all clean lint build
|
||||
```
|
||||
|
||||
This is same as `npm run clean && npm run lint && npm run build`.
|
||||
|
||||
**Note:** If a script exited with non zero code, the following scripts are not run.
|
||||
If `--continue-on-error` option is given, this behavior will be disabled.
|
||||
|
||||
### Run scripts in parallel
|
||||
|
||||
```
|
||||
$ npm-run-all --parallel lint build
|
||||
```
|
||||
|
||||
This is similar to `npm run lint & npm run build`.
|
||||
|
||||
**Note1:** If a script exited with a non-zero code, the other scripts and those descendant processes are killed with `SIGTERM` (On Windows, with `taskkill.exe /F /T`).
|
||||
If `--continue-on-error` option is given, this behavior will be disabled.
|
||||
|
||||
**Note2:** `&` operator does not work on Windows' `cmd.exe`. But `npm-run-all --parallel` works fine there.
|
||||
|
||||
### Run a mix of sequential and parallel scripts
|
||||
|
||||
```
|
||||
$ npm-run-all clean lint --parallel watch:html watch:js
|
||||
```
|
||||
|
||||
1. First, this runs `clean` and `lint` sequentially / serially.
|
||||
2. Next, runs `watch:html` and `watch:js` in parallel.
|
||||
|
||||
```
|
||||
$ npm-run-all a b --parallel c d --sequential e f --parallel g h i
|
||||
```
|
||||
or
|
||||
|
||||
```
|
||||
$ npm-run-all a b --parallel c d --serial e f --parallel g h i
|
||||
```
|
||||
|
||||
1. First, runs `a` and `b` sequentially / serially.
|
||||
2. Second, runs `c` and `d` in parallel.
|
||||
3. Third, runs `e` and `f` sequentially / serially.
|
||||
4. Lastly, runs `g`, `h`, and `i` in parallel.
|
||||
|
||||
### Glob-like pattern matching for script names
|
||||
|
||||
We can use [glob]-like patterns to specify npm-scripts.
|
||||
The difference is one -- the separator is `:` instead of `/`.
|
||||
|
||||
```
|
||||
$ npm-run-all --parallel watch:*
|
||||
```
|
||||
|
||||
In this case, runs sub scripts of `watch`. For example: `watch:html`, `watch:js`.
|
||||
But, doesn't run sub-sub scripts. For example: `watch:js:index`.
|
||||
|
||||
```
|
||||
$ npm-run-all --parallel watch:**
|
||||
```
|
||||
|
||||
If we use a globstar `**`, runs both sub scripts and sub-sub scripts.
|
||||
|
||||
`npm-run-all` reads the actual npm-script list from `package.json` in the current directory, then filters the scripts by glob-like patterns, then runs those.
|
||||
|
||||
### Run with arguments
|
||||
|
||||
We can enclose a script name or a pattern in quotes to use arguments.
|
||||
The following 2 commands are similar.
|
||||
|
||||
```
|
||||
$ npm-run-all --parallel "build:* -- --watch"
|
||||
$ npm run build:aaa -- --watch & npm run build:bbb -- --watch
|
||||
```
|
||||
|
||||
When we use a pattern, arguments are forwarded to every matched script.
|
||||
|
||||
### Argument placeholders
|
||||
|
||||
We can use placeholders to give the arguments preceded by `--` to scripts.
|
||||
|
||||
```
|
||||
$ npm-run-all build "start-server -- --port {1}" -- 8080
|
||||
```
|
||||
|
||||
This is useful to pass through arguments from `npm run` command.
|
||||
|
||||
```json
|
||||
{
|
||||
"scripts": {
|
||||
"start": "npm-run-all build \"start-server -- --port {1}\" --"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```
|
||||
$ npm run start 8080
|
||||
|
||||
> example@0.0.0 start /path/to/package.json
|
||||
> npm-run-all build "start-server -- --port {1}" -- "8080"
|
||||
```
|
||||
|
||||
There are the following placeholders:
|
||||
|
||||
- `{1}`, `{2}`, ... -- An argument. `{1}` is the 1st argument. `{2}` is the 2nd.
|
||||
- `{@}` -- All arguments.
|
||||
- `{*}` -- All arguments as combined.
|
||||
|
||||
Those are similar to [Shell Parameters](http://www.gnu.org/software/bash/manual/bashref.html#Shell-Parameters). But please note arguments are enclosed by double quotes automatically (similar to npm).
|
||||
|
||||
### Known Limitations
|
||||
|
||||
- If `--print-label` option is given, some tools in scripts might stop coloring their output.
|
||||
Because some coloring library (e.g. [chalk]) will stop coloring if `process.stdout` is not a TTY.
|
||||
`npm-run-all` changes the `process.stdout` of child processes to a pipe in order to add labels to the head of each line if `--print-label` option is given.<br>
|
||||
For example, [eslint] stops coloring under `npm-run-all --print-label`. But [eslint] has `--color` option to force coloring, we can use it. For anything [chalk] based you can set the environment variable `FORCE_COLOR=1` to produce colored output anyway.
|
||||
|
||||
[glob]: https://www.npmjs.com/package/glob#glob-primer
|
||||
[chalk]: https://www.npmjs.com/package/chalk
|
||||
[eslint]: https://www.npmjs.com/package/eslint
|
156
node_modules/npm-run-all/docs/run-p.md
generated
vendored
Normal file
156
node_modules/npm-run-all/docs/run-p.md
generated
vendored
Normal file
@@ -0,0 +1,156 @@
|
||||
| [index](../README.md) | [npm-run-all](npm-run-all.md) | [run-s](run-s.md) | run-p | [Node API](node-api.md) |
|
||||
|-----------------------|-------------------------------|-------------------|-------|-------------------------|
|
||||
|
||||
# `run-p` command
|
||||
|
||||
A CLI command to run given npm-scripts in parallel.
|
||||
This command is the shorthand of `npm-run-all -p`.
|
||||
|
||||
```
|
||||
Usage:
|
||||
$ run-p [--help | -h | --version | -v]
|
||||
$ run-p [OPTIONS] <tasks>
|
||||
|
||||
Run given npm-scripts in parallel.
|
||||
|
||||
<tasks> : A list of npm-scripts' names and Glob-like patterns.
|
||||
|
||||
Options:
|
||||
--aggregate-output - - - Avoid interleaving output by delaying printing of
|
||||
each command's output until it has finished.
|
||||
-c, --continue-on-error - Set the flag to continue executing other tasks
|
||||
even if a task threw an error. 'run-p' itself
|
||||
will exit with non-zero code if one or more tasks
|
||||
threw error(s).
|
||||
--max-parallel <number> - Set the maximum number of parallelism. Default is
|
||||
unlimited.
|
||||
--npm-path <string> - - - Set the path to npm. Default is the value of
|
||||
environment variable npm_execpath.
|
||||
If the variable is not defined, then it's "npm."
|
||||
In this case, the "npm" command must be found in
|
||||
environment variable PATH.
|
||||
-l, --print-label - - - - Set the flag to print the task name as a prefix
|
||||
on each line of output. Tools in tasks may stop
|
||||
coloring their output if this option was given.
|
||||
-n, --print-name - - - - Set the flag to print the task name before
|
||||
running each task.
|
||||
-r, --race - - - - - - - Set the flag to kill all tasks when a task
|
||||
finished with zero.
|
||||
-s, --silent - - - - - - Set 'silent' to the log level of npm.
|
||||
|
||||
Shorthand aliases can be combined.
|
||||
For example, '-clns' equals to '-c -l -n -s'.
|
||||
|
||||
Examples:
|
||||
$ run-p watch:**
|
||||
$ run-p --print-label "build:** -- --watch"
|
||||
$ run-p -l "build:** -- --watch"
|
||||
$ run-p start-server start-browser start-electron
|
||||
```
|
||||
|
||||
### npm-scripts
|
||||
|
||||
It's `"scripts"` field of `package.json`.
|
||||
For example:
|
||||
|
||||
```json
|
||||
{
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
"lint": "eslint src",
|
||||
"build": "babel src -o lib"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
We can run a script with `npm run` command.
|
||||
On the other hand, this `run-p` command runs multiple scripts in parallel.
|
||||
|
||||
The following 2 commands are similar.
|
||||
The `run-p` command is shorter and **available on Windows**.
|
||||
|
||||
```
|
||||
$ run-p lint build
|
||||
$ npm run lint & npm run build
|
||||
```
|
||||
|
||||
**Note1:** If a script exited with a non-zero code, the other scripts and those descendant processes are killed with `SIGTERM` (On Windows, with `taskkill.exe /F /T`).
|
||||
If `--continue-on-error` option is given, this behavior will be disabled.
|
||||
|
||||
**Note2:** `&` operator does not work on Windows' `cmd.exe`. But `run-p` works fine there.
|
||||
|
||||
### Glob-like pattern matching for script names
|
||||
|
||||
We can use [glob]-like patterns to specify npm-scripts.
|
||||
The difference is one -- the separator is `:` instead of `/`.
|
||||
|
||||
```
|
||||
$ run-p watch:*
|
||||
```
|
||||
|
||||
In this case, runs sub scripts of `watch`. For example: `watch:html`, `watch:js`.
|
||||
But, doesn't run sub-sub scripts. For example: `watch:js:index`.
|
||||
|
||||
```
|
||||
$ run-p watch:**
|
||||
```
|
||||
|
||||
If we use a globstar `**`, runs both sub scripts and sub-sub scripts.
|
||||
|
||||
`run-p` reads the actual npm-script list from `package.json` in the current directory, then filters the scripts by glob-like patterns, then runs those.
|
||||
|
||||
### Run with arguments
|
||||
|
||||
We can enclose a script name or a pattern in quotes to use arguments.
|
||||
The following 2 commands are similar.
|
||||
|
||||
```
|
||||
$ run-p "build:* -- --watch"
|
||||
$ npm run build:aaa -- --watch & npm run build:bbb -- --watch
|
||||
```
|
||||
|
||||
When we use a pattern, arguments are forwarded to every matched script.
|
||||
|
||||
### Argument placeholders
|
||||
|
||||
We can use placeholders to give the arguments preceded by `--` to scripts.
|
||||
|
||||
```
|
||||
$ run-p "start-server -- --port {1}" -- 8080
|
||||
```
|
||||
|
||||
This is useful to pass through arguments from `npm run` command.
|
||||
|
||||
```json
|
||||
{
|
||||
"scripts": {
|
||||
"start": "run-p \"start-server -- --port {1}\" --"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```
|
||||
$ npm run start 8080
|
||||
|
||||
> example@0.0.0 start /path/to/package.json
|
||||
> run-p "start-server -- --port {1}" -- "8080"
|
||||
```
|
||||
|
||||
There are the following placeholders:
|
||||
|
||||
- `{1}`, `{2}`, ... -- An argument. `{1}` is the 1st argument. `{2}` is the 2nd.
|
||||
- `{@}` -- All arguments.
|
||||
- `{*}` -- All arguments as combined.
|
||||
|
||||
Those are similar to [Shell Parameters](http://www.gnu.org/software/bash/manual/bashref.html#Shell-Parameters). But please note arguments are enclosed by double quotes automatically (similar to npm).
|
||||
|
||||
### Known Limitations
|
||||
|
||||
- If `--print-label` option is given, some tools in scripts might stop coloring their output.
|
||||
Because some coloring library (e.g. [chalk]) will stop coloring if `process.stdout` is not a TTY.
|
||||
`run-p` changes the `process.stdout` of child processes to a pipe in order to add labels to the head of each line if `--print-label` option is given.<br>
|
||||
For example, [eslint] stops coloring under `run-p --print-label`. But [eslint] has `--color` option to force coloring, we can use it.
|
||||
|
||||
[glob]: https://www.npmjs.com/package/glob#glob-primer
|
||||
[chalk]: https://www.npmjs.com/package/chalk
|
||||
[eslint]: https://www.npmjs.com/package/eslint
|
147
node_modules/npm-run-all/docs/run-s.md
generated
vendored
Normal file
147
node_modules/npm-run-all/docs/run-s.md
generated
vendored
Normal file
@@ -0,0 +1,147 @@
|
||||
| [index](../README.md) | [npm-run-all](npm-run-all.md) | run-s | [run-p](run-p.md) | [Node API](node-api.md) |
|
||||
|-----------------------|-------------------------------|-------|-------------------|-------------------------|
|
||||
|
||||
# `run-s` command
|
||||
|
||||
A CLI command to run given npm-scripts sequentially.
|
||||
This command is the shorthand of `npm-run-all -s`.
|
||||
|
||||
```
|
||||
Usage:
|
||||
$ run-s [--help | -h | --version | -v]
|
||||
$ run-s [OPTIONS] <tasks>
|
||||
|
||||
Run given npm-scripts sequentially.
|
||||
|
||||
<tasks> : A list of npm-scripts' names and Glob-like patterns.
|
||||
|
||||
Options:
|
||||
-c, --continue-on-error - Set the flag to continue executing subsequent
|
||||
tasks even if a task threw an error. 'run-s'
|
||||
itself will exit with non-zero code if one or
|
||||
more tasks threw error(s).
|
||||
--npm-path <string> - - - Set the path to npm. Default is the value of
|
||||
environment variable npm_execpath.
|
||||
If the variable is not defined, then it's "npm."
|
||||
In this case, the "npm" command must be found in
|
||||
environment variable PATH.
|
||||
-l, --print-label - - - - Set the flag to print the task name as a prefix
|
||||
on each line of output. Tools in tasks may stop
|
||||
coloring their output if this option was given.
|
||||
-n, --print-name - - - - Set the flag to print the task name before
|
||||
running each task.
|
||||
-s, --silent - - - - - - Set 'silent' to the log level of npm.
|
||||
|
||||
Shorthand aliases can be combined.
|
||||
For example, '-clns' equals to '-c -l -n -s'.
|
||||
|
||||
Examples:
|
||||
$ run-s build:**
|
||||
$ run-s lint clean build:**
|
||||
$ run-s --silent --print-name lint clean build:**
|
||||
$ run-s -sn lint clean build:**
|
||||
```
|
||||
|
||||
### npm-scripts
|
||||
|
||||
It's `"scripts"` field of `package.json`.
|
||||
For example:
|
||||
|
||||
```json
|
||||
{
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
"lint": "eslint src",
|
||||
"build": "babel src -o lib"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
We can run a script with `npm run` command.
|
||||
On the other hand, this `run-s` command runs multiple scripts sequentially.
|
||||
|
||||
The following 2 commands are the same.
|
||||
The `run-s` command is shorter.
|
||||
|
||||
```
|
||||
$ run-s clean lint build
|
||||
$ npm run clean && npm run lint && npm run build
|
||||
```
|
||||
|
||||
**Note:** If a script exited with a non-zero code, the following scripts are not run.
|
||||
|
||||
### Glob-like pattern matching for script names
|
||||
|
||||
We can use [glob]-like patterns to specify npm-scripts.
|
||||
The difference is one -- the separator is `:` instead of `/`.
|
||||
|
||||
```
|
||||
$ run-s build:*
|
||||
```
|
||||
|
||||
In this case, runs sub scripts of `build`. For example: `build:html`, `build:js`.
|
||||
But, doesn't run sub-sub scripts. For example: `build:js:index`.
|
||||
|
||||
```
|
||||
$ run-s build:**
|
||||
```
|
||||
|
||||
If we use a globstar `**`, runs both sub scripts and sub-sub scripts.
|
||||
|
||||
`run-s` reads the actual npm-script list from `package.json` in the current directory, then filters the scripts by glob-like patterns, then runs those.
|
||||
|
||||
### Run with arguments
|
||||
|
||||
We can enclose a script name or a pattern in quotes to use arguments.
|
||||
The following 2 commands are the same.
|
||||
|
||||
```
|
||||
$ run-s start:server "delay 3000" start:client
|
||||
$ npm run start:server && npm run delay 3000 && npm run start:client
|
||||
```
|
||||
|
||||
When we use a pattern, arguments are forwarded to every matched script.
|
||||
|
||||
### Argument placeholders
|
||||
|
||||
We can use placeholders to give the arguments preceded by `--` to scripts.
|
||||
|
||||
```
|
||||
$ run-s build "start-server -- --port {1}" -- 8080
|
||||
```
|
||||
|
||||
This is useful to pass through arguments from `npm run` command.
|
||||
|
||||
```json
|
||||
{
|
||||
"scripts": {
|
||||
"start": "run-s build \"start-server -- --port {1}\" --"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```
|
||||
$ npm run start 8080
|
||||
|
||||
> example@0.0.0 start /path/to/package.json
|
||||
> run-s build "start-server -- --port {1}" -- "8080"
|
||||
```
|
||||
|
||||
There are the following placeholders:
|
||||
|
||||
- `{1}`, `{2}`, ... -- An argument. `{1}` is the 1st argument. `{2}` is the 2nd.
|
||||
- `{@}` -- All arguments.
|
||||
- `{*}` -- All arguments as combined.
|
||||
|
||||
Those are similar to [Shell Parameters](http://www.gnu.org/software/bash/manual/bashref.html#Shell-Parameters). But please note arguments are enclosed by double quotes automatically (similar to npm).
|
||||
|
||||
### Known Limitations
|
||||
|
||||
- If `--print-label` option is given, some tools in scripts might stop coloring their output.
|
||||
Because some coloring library (e.g. [chalk]) will stop coloring if `process.stdout` is not a TTY.
|
||||
`run-s` changes the `process.stdout` of child processes to a pipe in order to add labels to the head of each line if `--print-label` option is given.<br>
|
||||
For example, [eslint] stops coloring under `run-s --print-label`. But [eslint] has `--color` option to force coloring, we can use it.
|
||||
|
||||
[glob]: https://www.npmjs.com/package/glob#glob-primer
|
||||
[chalk]: https://www.npmjs.com/package/chalk
|
||||
[eslint]: https://www.npmjs.com/package/eslint
|
48
node_modules/npm-run-all/lib/create-header.js
generated
vendored
Normal file
48
node_modules/npm-run-all/lib/create-header.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* @module create-header
|
||||
* @author Toru Nagashima
|
||||
* @copyright 2016 Toru Nagashima. All rights reserved.
|
||||
* See LICENSE file in root directory for full license.
|
||||
*/
|
||||
"use strict"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const ansiStyles = require("ansi-styles")
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Creates the header text for a given task.
|
||||
*
|
||||
* @param {string} nameAndArgs - A task name and arguments.
|
||||
* @param {object} packageInfo - A package.json's information.
|
||||
* @param {object} packageInfo.body - A package.json's JSON object.
|
||||
* @param {string} packageInfo.path - A package.json's file path.
|
||||
* @param {boolean} isTTY - The flag to color the header.
|
||||
* @returns {string} The header of a given task.
|
||||
*/
|
||||
module.exports = function createHeader(nameAndArgs, packageInfo, isTTY) {
|
||||
if (!packageInfo) {
|
||||
return `\n> ${nameAndArgs}\n\n`
|
||||
}
|
||||
|
||||
const index = nameAndArgs.indexOf(" ")
|
||||
const name = (index === -1) ? nameAndArgs : nameAndArgs.slice(0, index)
|
||||
const args = (index === -1) ? "" : nameAndArgs.slice(index + 1)
|
||||
const packageName = packageInfo.body.name
|
||||
const packageVersion = packageInfo.body.version
|
||||
const scriptBody = packageInfo.body.scripts[name]
|
||||
const packagePath = packageInfo.path
|
||||
const color = isTTY ? ansiStyles.gray : { open: "", close: "" }
|
||||
|
||||
return `
|
||||
${color.open}> ${packageName}@${packageVersion} ${name} ${packagePath}${color.close}
|
||||
${color.open}> ${scriptBody} ${args}${color.close}
|
||||
|
||||
`
|
||||
}
|
89
node_modules/npm-run-all/lib/create-prefix-transform-stream.js
generated
vendored
Normal file
89
node_modules/npm-run-all/lib/create-prefix-transform-stream.js
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
* @module create-prefix-transform-stream
|
||||
* @author Toru Nagashima
|
||||
* @copyright 2016 Toru Nagashima. All rights reserved.
|
||||
* See LICENSE file in root directory for full license.
|
||||
*/
|
||||
"use strict"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const stream = require("stream")
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const ALL_BR = /\n/g
|
||||
|
||||
/**
|
||||
* The transform stream to insert a specific prefix.
|
||||
*
|
||||
* Several streams can exist for the same output stream.
|
||||
* This stream will insert the prefix if the last output came from other instance.
|
||||
* To do that, this stream is using a shared state object.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
class PrefixTransform extends stream.Transform {
|
||||
/**
|
||||
* @param {string} prefix - A prefix text to be inserted.
|
||||
* @param {object} state - A state object.
|
||||
* @param {string} state.lastPrefix - The last prefix which is printed.
|
||||
* @param {boolean} state.lastIsLinebreak -The flag to check whether the last output is a line break or not.
|
||||
*/
|
||||
constructor(prefix, state) {
|
||||
super()
|
||||
|
||||
this.prefix = prefix
|
||||
this.state = state
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms the output chunk.
|
||||
*
|
||||
* @param {string|Buffer} chunk - A chunk to be transformed.
|
||||
* @param {string} _encoding - The encoding of the chunk.
|
||||
* @param {function} callback - A callback function that is called when done.
|
||||
* @returns {void}
|
||||
*/
|
||||
_transform(chunk, _encoding, callback) {
|
||||
const prefix = this.prefix
|
||||
const nPrefix = `\n${prefix}`
|
||||
const state = this.state
|
||||
const firstPrefix =
|
||||
state.lastIsLinebreak ? prefix :
|
||||
(state.lastPrefix !== prefix) ? "\n" :
|
||||
/* otherwise */ ""
|
||||
const prefixed = `${firstPrefix}${chunk}`.replace(ALL_BR, nPrefix)
|
||||
const index = prefixed.indexOf(prefix, Math.max(0, prefixed.length - prefix.length))
|
||||
|
||||
state.lastPrefix = prefix
|
||||
state.lastIsLinebreak = (index !== -1)
|
||||
|
||||
callback(null, (index !== -1) ? prefixed.slice(0, index) : prefixed)
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public API
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Create a transform stream to insert the specific prefix.
|
||||
*
|
||||
* Several streams can exist for the same output stream.
|
||||
* This stream will insert the prefix if the last output came from other instance.
|
||||
* To do that, this stream is using a shared state object.
|
||||
*
|
||||
* @param {string} prefix - A prefix text to be inserted.
|
||||
* @param {object} state - A state object.
|
||||
* @param {string} state.lastPrefix - The last prefix which is printed.
|
||||
* @param {boolean} state.lastIsLinebreak -The flag to check whether the last output is a line break or not.
|
||||
* @returns {stream.Transform} The created transform stream.
|
||||
*/
|
||||
module.exports = function createPrefixTransform(prefix, state) {
|
||||
return new PrefixTransform(prefix, state)
|
||||
}
|
287
node_modules/npm-run-all/lib/index.js
generated
vendored
Normal file
287
node_modules/npm-run-all/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,287 @@
|
||||
/**
|
||||
* @module index
|
||||
* @author Toru Nagashima
|
||||
* @copyright 2015 Toru Nagashima. All rights reserved.
|
||||
* See LICENSE file in root directory for full license.
|
||||
*/
|
||||
"use strict"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const shellQuote = require("shell-quote")
|
||||
const matchTasks = require("./match-tasks")
|
||||
const readPackageJson = require("./read-package-json")
|
||||
const runTasks = require("./run-tasks")
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const ARGS_PATTERN = /\{(!)?([*@]|\d+)([^}]+)?}/g
|
||||
|
||||
/**
|
||||
* Converts a given value to an array.
|
||||
*
|
||||
* @param {string|string[]|null|undefined} x - A value to convert.
|
||||
* @returns {string[]} An array.
|
||||
*/
|
||||
function toArray(x) {
|
||||
if (x == null) {
|
||||
return []
|
||||
}
|
||||
return Array.isArray(x) ? x : [x]
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces argument placeholders (such as `{1}`) by arguments.
|
||||
*
|
||||
* @param {string[]} patterns - Patterns to replace.
|
||||
* @param {string[]} args - Arguments to replace.
|
||||
* @returns {string[]} replaced
|
||||
*/
|
||||
function applyArguments(patterns, args) {
|
||||
const defaults = Object.create(null)
|
||||
|
||||
return patterns.map(pattern => pattern.replace(ARGS_PATTERN, (whole, indirectionMark, id, options) => {
|
||||
if (indirectionMark != null) {
|
||||
throw Error(`Invalid Placeholder: ${whole}`)
|
||||
}
|
||||
if (id === "@") {
|
||||
return shellQuote.quote(args)
|
||||
}
|
||||
if (id === "*") {
|
||||
return shellQuote.quote([args.join(" ")])
|
||||
}
|
||||
|
||||
const position = parseInt(id, 10)
|
||||
if (position >= 1 && position <= args.length) {
|
||||
return shellQuote.quote([args[position - 1]])
|
||||
}
|
||||
|
||||
// Address default values
|
||||
if (options != null) {
|
||||
const prefix = options.slice(0, 2)
|
||||
|
||||
if (prefix === ":=") {
|
||||
defaults[id] = shellQuote.quote([options.slice(2)])
|
||||
return defaults[id]
|
||||
}
|
||||
if (prefix === ":-") {
|
||||
return shellQuote.quote([options.slice(2)])
|
||||
}
|
||||
|
||||
throw Error(`Invalid Placeholder: ${whole}`)
|
||||
}
|
||||
if (defaults[id] != null) {
|
||||
return defaults[id]
|
||||
}
|
||||
|
||||
return ""
|
||||
}))
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse patterns.
|
||||
* In parsing process, it replaces argument placeholders (such as `{1}`) by arguments.
|
||||
*
|
||||
* @param {string|string[]} patternOrPatterns - Patterns to run.
|
||||
* A pattern is a npm-script name or a Glob-like pattern.
|
||||
* @param {string[]} args - Arguments to replace placeholders.
|
||||
* @returns {string[]} Parsed patterns.
|
||||
*/
|
||||
function parsePatterns(patternOrPatterns, args) {
|
||||
const patterns = toArray(patternOrPatterns)
|
||||
const hasPlaceholder = patterns.some(pattern => ARGS_PATTERN.test(pattern))
|
||||
|
||||
return hasPlaceholder ? applyArguments(patterns, args) : patterns
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a given config object to an `--:=` style option array.
|
||||
*
|
||||
* @param {object|null} config -
|
||||
* A map-like object to overwrite package configs.
|
||||
* Keys are package names.
|
||||
* Every value is a map-like object (Pairs of variable name and value).
|
||||
* @returns {string[]} `--:=` style options.
|
||||
*/
|
||||
function toOverwriteOptions(config) {
|
||||
const options = []
|
||||
|
||||
for (const packageName of Object.keys(config)) {
|
||||
const packageConfig = config[packageName]
|
||||
|
||||
for (const variableName of Object.keys(packageConfig)) {
|
||||
const value = packageConfig[variableName]
|
||||
|
||||
options.push(`--${packageName}:${variableName}=${value}`)
|
||||
}
|
||||
}
|
||||
|
||||
return options
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a given config object to an `--a=b` style option array.
|
||||
*
|
||||
* @param {object|null} config -
|
||||
* A map-like object to set configs.
|
||||
* @returns {string[]} `--a=b` style options.
|
||||
*/
|
||||
function toConfigOptions(config) {
|
||||
return Object.keys(config).map(key => `--${key}=${config[key]}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the maximum length.
|
||||
*
|
||||
* @param {number} length - The current maximum length.
|
||||
* @param {string} name - A name.
|
||||
* @returns {number} The maximum length.
|
||||
*/
|
||||
function maxLength(length, name) {
|
||||
return Math.max(name.length, length)
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Runs npm-scripts which are matched with given patterns.
|
||||
*
|
||||
* @param {string|string[]} patternOrPatterns - Patterns to run.
|
||||
* A pattern is a npm-script name or a Glob-like pattern.
|
||||
* @param {object|undefined} [options] Optional.
|
||||
* @param {boolean} options.parallel -
|
||||
* If this is `true`, run scripts in parallel.
|
||||
* Otherwise, run scripts in sequencial.
|
||||
* Default is `false`.
|
||||
* @param {stream.Readable|null} options.stdin -
|
||||
* A readable stream to send messages to stdin of child process.
|
||||
* If this is `null`, ignores it.
|
||||
* If this is `process.stdin`, inherits it.
|
||||
* Otherwise, makes a pipe.
|
||||
* Default is `null`.
|
||||
* @param {stream.Writable|null} options.stdout -
|
||||
* A writable stream to receive messages from stdout of child process.
|
||||
* If this is `null`, cannot send.
|
||||
* If this is `process.stdout`, inherits it.
|
||||
* Otherwise, makes a pipe.
|
||||
* Default is `null`.
|
||||
* @param {stream.Writable|null} options.stderr -
|
||||
* A writable stream to receive messages from stderr of child process.
|
||||
* If this is `null`, cannot send.
|
||||
* If this is `process.stderr`, inherits it.
|
||||
* Otherwise, makes a pipe.
|
||||
* Default is `null`.
|
||||
* @param {string[]} options.taskList -
|
||||
* Actual name list of npm-scripts.
|
||||
* This function search npm-script names in this list.
|
||||
* If this is `null`, this function reads `package.json` of current directly.
|
||||
* @param {object|null} options.packageConfig -
|
||||
* A map-like object to overwrite package configs.
|
||||
* Keys are package names.
|
||||
* Every value is a map-like object (Pairs of variable name and value).
|
||||
* e.g. `{"npm-run-all": {"test": 777}}`
|
||||
* Default is `null`.
|
||||
* @param {boolean} options.silent -
|
||||
* The flag to set `silent` to the log level of npm.
|
||||
* Default is `false`.
|
||||
* @param {boolean} options.continueOnError -
|
||||
* The flag to ignore errors.
|
||||
* Default is `false`.
|
||||
* @param {boolean} options.printLabel -
|
||||
* The flag to print task names at the head of each line.
|
||||
* Default is `false`.
|
||||
* @param {boolean} options.printName -
|
||||
* The flag to print task names before running each task.
|
||||
* Default is `false`.
|
||||
* @param {number} options.maxParallel -
|
||||
* The maximum number of parallelism.
|
||||
* Default is unlimited.
|
||||
* @param {string} options.npmPath -
|
||||
* The path to npm.
|
||||
* Default is `process.env.npm_execpath`.
|
||||
* @returns {Promise}
|
||||
* A promise object which becomes fullfilled when all npm-scripts are completed.
|
||||
*/
|
||||
module.exports = function npmRunAll(patternOrPatterns, options) { //eslint-disable-line complexity
|
||||
const stdin = (options && options.stdin) || null
|
||||
const stdout = (options && options.stdout) || null
|
||||
const stderr = (options && options.stderr) || null
|
||||
const taskList = (options && options.taskList) || null
|
||||
const config = (options && options.config) || null
|
||||
const packageConfig = (options && options.packageConfig) || null
|
||||
const args = (options && options.arguments) || []
|
||||
const parallel = Boolean(options && options.parallel)
|
||||
const silent = Boolean(options && options.silent)
|
||||
const continueOnError = Boolean(options && options.continueOnError)
|
||||
const printLabel = Boolean(options && options.printLabel)
|
||||
const printName = Boolean(options && options.printName)
|
||||
const race = Boolean(options && options.race)
|
||||
const maxParallel = parallel ? ((options && options.maxParallel) || 0) : 1
|
||||
const aggregateOutput = Boolean(options && options.aggregateOutput)
|
||||
const npmPath = options && options.npmPath
|
||||
try {
|
||||
const patterns = parsePatterns(patternOrPatterns, args)
|
||||
if (patterns.length === 0) {
|
||||
return Promise.resolve(null)
|
||||
}
|
||||
if (taskList != null && Array.isArray(taskList) === false) {
|
||||
throw new Error("Invalid options.taskList")
|
||||
}
|
||||
if (typeof maxParallel !== "number" || !(maxParallel >= 0)) {
|
||||
throw new Error("Invalid options.maxParallel")
|
||||
}
|
||||
if (!parallel && aggregateOutput) {
|
||||
throw new Error("Invalid options.aggregateOutput; It requires options.parallel")
|
||||
}
|
||||
if (!parallel && race) {
|
||||
throw new Error("Invalid options.race; It requires options.parallel")
|
||||
}
|
||||
|
||||
const prefixOptions = [].concat(
|
||||
silent ? ["--silent"] : [],
|
||||
packageConfig ? toOverwriteOptions(packageConfig) : [],
|
||||
config ? toConfigOptions(config) : []
|
||||
)
|
||||
|
||||
return Promise.resolve()
|
||||
.then(() => {
|
||||
if (taskList != null) {
|
||||
return { taskList, packageInfo: null }
|
||||
}
|
||||
return readPackageJson()
|
||||
})
|
||||
.then(x => {
|
||||
const tasks = matchTasks(x.taskList, patterns)
|
||||
const labelWidth = tasks.reduce(maxLength, 0)
|
||||
|
||||
return runTasks(tasks, {
|
||||
stdin,
|
||||
stdout,
|
||||
stderr,
|
||||
prefixOptions,
|
||||
continueOnError,
|
||||
labelState: {
|
||||
enabled: printLabel,
|
||||
width: labelWidth,
|
||||
lastPrefix: null,
|
||||
lastIsLinebreak: true,
|
||||
},
|
||||
printName,
|
||||
packageInfo: x.packageInfo,
|
||||
race,
|
||||
maxParallel,
|
||||
npmPath,
|
||||
aggregateOutput,
|
||||
})
|
||||
})
|
||||
}
|
||||
catch (err) {
|
||||
return Promise.reject(new Error(err.message))
|
||||
}
|
||||
}
|
128
node_modules/npm-run-all/lib/match-tasks.js
generated
vendored
Normal file
128
node_modules/npm-run-all/lib/match-tasks.js
generated
vendored
Normal file
@@ -0,0 +1,128 @@
|
||||
/**
|
||||
* @module match-tasks
|
||||
* @author Toru Nagashima
|
||||
* @copyright 2015 Toru Nagashima. All rights reserved.
|
||||
* See LICENSE file in root directory for full license.
|
||||
*/
|
||||
"use strict"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const Minimatch = require("minimatch").Minimatch
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const COLON_OR_SLASH = /[:/]/g
|
||||
const CONVERT_MAP = { ":": "/", "/": ":" }
|
||||
|
||||
/**
|
||||
* Swaps ":" and "/", in order to use ":" as the separator in minimatch.
|
||||
*
|
||||
* @param {string} s - A text to swap.
|
||||
* @returns {string} The text which was swapped.
|
||||
*/
|
||||
function swapColonAndSlash(s) {
|
||||
return s.replace(COLON_OR_SLASH, (matched) => CONVERT_MAP[matched])
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a filter from user-specified pattern text.
|
||||
*
|
||||
* The task name is the part until the first space.
|
||||
* The rest part is the arguments for this task.
|
||||
*
|
||||
* @param {string} pattern - A pattern to create filter.
|
||||
* @returns {{match: function, task: string, args: string}} The filter object of the pattern.
|
||||
*/
|
||||
function createFilter(pattern) {
|
||||
const trimmed = pattern.trim()
|
||||
const spacePos = trimmed.indexOf(" ")
|
||||
const task = spacePos < 0 ? trimmed : trimmed.slice(0, spacePos)
|
||||
const args = spacePos < 0 ? "" : trimmed.slice(spacePos)
|
||||
const matcher = new Minimatch(swapColonAndSlash(task), { nonegate: true })
|
||||
const match = matcher.match.bind(matcher)
|
||||
|
||||
return { match, task, args }
|
||||
}
|
||||
|
||||
/**
|
||||
* The set to remove overlapped task.
|
||||
*/
|
||||
class TaskSet {
|
||||
/**
|
||||
* Creates a instance.
|
||||
*/
|
||||
constructor() {
|
||||
this.result = []
|
||||
this.sourceMap = Object.create(null)
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a command (a pattern) into this set if it's not overlapped.
|
||||
* "Overlapped" is meaning that the command was added from a different source.
|
||||
*
|
||||
* @param {string} command - A pattern text to add.
|
||||
* @param {string} source - A task name to check.
|
||||
* @returns {void}
|
||||
*/
|
||||
add(command, source) {
|
||||
const sourceList = this.sourceMap[command] || (this.sourceMap[command] = [])
|
||||
if (sourceList.length === 0 || sourceList.indexOf(source) !== -1) {
|
||||
this.result.push(command)
|
||||
}
|
||||
sourceList.push(source)
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Enumerates tasks which matches with given patterns.
|
||||
*
|
||||
* @param {string[]} taskList - A list of actual task names.
|
||||
* @param {string[]} patterns - Pattern texts to match.
|
||||
* @returns {string[]} Tasks which matches with the patterns.
|
||||
* @private
|
||||
*/
|
||||
module.exports = function matchTasks(taskList, patterns) {
|
||||
const filters = patterns.map(createFilter)
|
||||
const candidates = taskList.map(swapColonAndSlash)
|
||||
const taskSet = new TaskSet()
|
||||
const unknownSet = Object.create(null)
|
||||
|
||||
// Take tasks while keep the order of patterns.
|
||||
for (const filter of filters) {
|
||||
let found = false
|
||||
|
||||
for (const candidate of candidates) {
|
||||
if (filter.match(candidate)) {
|
||||
found = true
|
||||
taskSet.add(
|
||||
swapColonAndSlash(candidate) + filter.args,
|
||||
filter.task
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// Built-in tasks should be allowed.
|
||||
if (!found && (filter.task === "restart" || filter.task === "env")) {
|
||||
taskSet.add(filter.task + filter.args, filter.task)
|
||||
found = true
|
||||
}
|
||||
if (!found) {
|
||||
unknownSet[filter.task] = true
|
||||
}
|
||||
}
|
||||
|
||||
const unknownTasks = Object.keys(unknownSet)
|
||||
if (unknownTasks.length > 0) {
|
||||
throw new Error(`Task not found: "${unknownTasks.join("\", ")}"`)
|
||||
}
|
||||
return taskSet.result
|
||||
}
|
47
node_modules/npm-run-all/lib/npm-run-all-error.js
generated
vendored
Normal file
47
node_modules/npm-run-all/lib/npm-run-all-error.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* @module npm-run-all-error
|
||||
* @author Toru Nagashima
|
||||
* @copyright 2016 Toru Nagashima. All rights reserved.
|
||||
* See LICENSE file in root directory for full license.
|
||||
*/
|
||||
"use strict"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Error object with some additional info.
|
||||
*/
|
||||
module.exports = class NpmRunAllError extends Error {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param {{name: string, code: number}} causeResult -
|
||||
* The result item of the npm-script which causes an error.
|
||||
* @param {Array.<{name: string, code: (number|undefined)}>} allResults -
|
||||
* All result items of npm-scripts.
|
||||
*/
|
||||
constructor(causeResult, allResults) {
|
||||
super(`"${causeResult.task}" exited with ${causeResult.code}.`)
|
||||
|
||||
/**
|
||||
* The name of a npm-script which exited with a non-zero code.
|
||||
* @type {string}
|
||||
*/
|
||||
this.name = causeResult.name
|
||||
|
||||
/**
|
||||
* The code of a npm-script which exited with a non-zero code.
|
||||
* This can be `undefined`.
|
||||
* @type {number}
|
||||
*/
|
||||
this.code = causeResult.code
|
||||
|
||||
/**
|
||||
* All result items of npm-scripts.
|
||||
* @type {Array.<{name: string, code: (number|undefined)}>}
|
||||
*/
|
||||
this.results = allResults
|
||||
}
|
||||
}
|
31
node_modules/npm-run-all/lib/read-package-json.js
generated
vendored
Normal file
31
node_modules/npm-run-all/lib/read-package-json.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* @module read-package-json
|
||||
* @author Toru Nagashima
|
||||
* @copyright 2016 Toru Nagashima. All rights reserved.
|
||||
* See LICENSE file in root directory for full license.
|
||||
*/
|
||||
"use strict"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const joinPath = require("path").join
|
||||
const readPkg = require("read-pkg")
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Reads the package.json in the current directory.
|
||||
*
|
||||
* @returns {object} package.json's information.
|
||||
*/
|
||||
module.exports = function readPackageJson() {
|
||||
const path = joinPath(process.cwd(), "package.json")
|
||||
return readPkg(path).then(body => ({
|
||||
taskList: Object.keys(body.scripts || {}),
|
||||
packageInfo: { path, body },
|
||||
}))
|
||||
}
|
206
node_modules/npm-run-all/lib/run-task.js
generated
vendored
Normal file
206
node_modules/npm-run-all/lib/run-task.js
generated
vendored
Normal file
@@ -0,0 +1,206 @@
|
||||
/**
|
||||
* @module run-task
|
||||
* @author Toru Nagashima
|
||||
* @copyright 2015 Toru Nagashima. All rights reserved.
|
||||
* See LICENSE file in root directory for full license.
|
||||
*/
|
||||
"use strict"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const path = require("path")
|
||||
const chalk = require("chalk")
|
||||
const parseArgs = require("shell-quote").parse
|
||||
const padEnd = require("string.prototype.padend")
|
||||
const createHeader = require("./create-header")
|
||||
const createPrefixTransform = require("./create-prefix-transform-stream")
|
||||
const spawn = require("./spawn")
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const colors = [chalk.cyan, chalk.green, chalk.magenta, chalk.yellow, chalk.red]
|
||||
|
||||
let colorIndex = 0
|
||||
const taskNamesToColors = new Map()
|
||||
|
||||
/**
|
||||
* Select a color from given task name.
|
||||
*
|
||||
* @param {string} taskName - The task name.
|
||||
* @returns {function} A colorize function that provided by `chalk`
|
||||
*/
|
||||
function selectColor(taskName) {
|
||||
let color = taskNamesToColors.get(taskName)
|
||||
if (!color) {
|
||||
color = colors[colorIndex]
|
||||
colorIndex = (colorIndex + 1) % colors.length
|
||||
taskNamesToColors.set(taskName, color)
|
||||
}
|
||||
return color
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps stdout/stderr with a transform stream to add the task name as prefix.
|
||||
*
|
||||
* @param {string} taskName - The task name.
|
||||
* @param {stream.Writable} source - An output stream to be wrapped.
|
||||
* @param {object} labelState - An label state for the transform stream.
|
||||
* @returns {stream.Writable} `source` or the created wrapped stream.
|
||||
*/
|
||||
function wrapLabeling(taskName, source, labelState) {
|
||||
if (source == null || !labelState.enabled) {
|
||||
return source
|
||||
}
|
||||
|
||||
const label = padEnd(taskName, labelState.width)
|
||||
const color = source.isTTY ? selectColor(taskName) : (x) => x
|
||||
const prefix = color(`[${label}] `)
|
||||
const stream = createPrefixTransform(prefix, labelState)
|
||||
|
||||
stream.pipe(source)
|
||||
|
||||
return stream
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a given stream to an option for `child_process.spawn`.
|
||||
*
|
||||
* @param {stream.Readable|stream.Writable|null} stream - An original stream to convert.
|
||||
* @param {process.stdin|process.stdout|process.stderr} std - A standard stream for this option.
|
||||
* @returns {string|stream.Readable|stream.Writable} An option for `child_process.spawn`.
|
||||
*/
|
||||
function detectStreamKind(stream, std) {
|
||||
return (
|
||||
stream == null ? "ignore" :
|
||||
// `|| !std.isTTY` is needed for the workaround of https://github.com/nodejs/node/issues/5620
|
||||
stream !== std || !std.isTTY ? "pipe" :
|
||||
/* else */ stream
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure the output of shell-quote's `parse()` is acceptable input to npm-cli.
|
||||
*
|
||||
* The `parse()` method of shell-quote sometimes returns special objects in its
|
||||
* output array, e.g. if it thinks some elements should be globbed. But npm-cli
|
||||
* only accepts strings and will throw an error otherwise.
|
||||
*
|
||||
* See https://github.com/substack/node-shell-quote#parsecmd-env
|
||||
*
|
||||
* @param {object|string} arg - Item in the output of shell-quote's `parse()`.
|
||||
* @returns {string} A valid argument for npm-cli.
|
||||
*/
|
||||
function cleanTaskArg(arg) {
|
||||
return arg.pattern || arg.op || arg
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Interface
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Run a npm-script of a given name.
|
||||
* The return value is a promise which has an extra method: `abort()`.
|
||||
* The `abort()` kills the child process to run the npm-script.
|
||||
*
|
||||
* @param {string} task - A npm-script name to run.
|
||||
* @param {object} options - An option object.
|
||||
* @param {stream.Readable|null} options.stdin -
|
||||
* A readable stream to send messages to stdin of child process.
|
||||
* If this is `null`, ignores it.
|
||||
* If this is `process.stdin`, inherits it.
|
||||
* Otherwise, makes a pipe.
|
||||
* @param {stream.Writable|null} options.stdout -
|
||||
* A writable stream to receive messages from stdout of child process.
|
||||
* If this is `null`, cannot send.
|
||||
* If this is `process.stdout`, inherits it.
|
||||
* Otherwise, makes a pipe.
|
||||
* @param {stream.Writable|null} options.stderr -
|
||||
* A writable stream to receive messages from stderr of child process.
|
||||
* If this is `null`, cannot send.
|
||||
* If this is `process.stderr`, inherits it.
|
||||
* Otherwise, makes a pipe.
|
||||
* @param {string[]} options.prefixOptions -
|
||||
* An array of options which are inserted before the task name.
|
||||
* @param {object} options.labelState - A state object for printing labels.
|
||||
* @param {boolean} options.printName - The flag to print task names before running each task.
|
||||
* @returns {Promise}
|
||||
* A promise object which becomes fullfilled when the npm-script is completed.
|
||||
* This promise object has an extra method: `abort()`.
|
||||
* @private
|
||||
*/
|
||||
module.exports = function runTask(task, options) {
|
||||
let cp = null
|
||||
const promise = new Promise((resolve, reject) => {
|
||||
const stdin = options.stdin
|
||||
const stdout = wrapLabeling(task, options.stdout, options.labelState)
|
||||
const stderr = wrapLabeling(task, options.stderr, options.labelState)
|
||||
const stdinKind = detectStreamKind(stdin, process.stdin)
|
||||
const stdoutKind = detectStreamKind(stdout, process.stdout)
|
||||
const stderrKind = detectStreamKind(stderr, process.stderr)
|
||||
const spawnOptions = { stdio: [stdinKind, stdoutKind, stderrKind] }
|
||||
|
||||
// Print task name.
|
||||
if (options.printName && stdout != null) {
|
||||
stdout.write(createHeader(
|
||||
task,
|
||||
options.packageInfo,
|
||||
options.stdout.isTTY
|
||||
))
|
||||
}
|
||||
|
||||
// Execute.
|
||||
const npmPath = options.npmPath || process.env.npm_execpath //eslint-disable-line no-process-env
|
||||
const npmPathIsJs = typeof npmPath === "string" && /\.m?js/.test(path.extname(npmPath))
|
||||
const execPath = (npmPathIsJs ? process.execPath : npmPath || "npm")
|
||||
const isYarn = path.basename(npmPath || "npm").startsWith("yarn")
|
||||
const spawnArgs = ["run"]
|
||||
|
||||
if (npmPathIsJs) {
|
||||
spawnArgs.unshift(npmPath)
|
||||
}
|
||||
if (!isYarn) {
|
||||
Array.prototype.push.apply(spawnArgs, options.prefixOptions)
|
||||
}
|
||||
else if (options.prefixOptions.indexOf("--silent") !== -1) {
|
||||
spawnArgs.push("--silent")
|
||||
}
|
||||
Array.prototype.push.apply(spawnArgs, parseArgs(task).map(cleanTaskArg))
|
||||
|
||||
cp = spawn(execPath, spawnArgs, spawnOptions)
|
||||
|
||||
// Piping stdio.
|
||||
if (stdinKind === "pipe") {
|
||||
stdin.pipe(cp.stdin)
|
||||
}
|
||||
if (stdoutKind === "pipe") {
|
||||
cp.stdout.pipe(stdout, { end: false })
|
||||
}
|
||||
if (stderrKind === "pipe") {
|
||||
cp.stderr.pipe(stderr, { end: false })
|
||||
}
|
||||
|
||||
// Register
|
||||
cp.on("error", (err) => {
|
||||
cp = null
|
||||
reject(err)
|
||||
})
|
||||
cp.on("close", (code) => {
|
||||
cp = null
|
||||
resolve({ task, code })
|
||||
})
|
||||
})
|
||||
|
||||
promise.abort = function abort() {
|
||||
if (cp != null) {
|
||||
cp.kill()
|
||||
cp = null
|
||||
}
|
||||
}
|
||||
|
||||
return promise
|
||||
}
|
177
node_modules/npm-run-all/lib/run-tasks.js
generated
vendored
Normal file
177
node_modules/npm-run-all/lib/run-tasks.js
generated
vendored
Normal file
@@ -0,0 +1,177 @@
|
||||
/**
|
||||
* @module run-tasks-in-parallel
|
||||
* @author Toru Nagashima
|
||||
* @copyright 2015 Toru Nagashima. All rights reserved.
|
||||
* See LICENSE file in root directory for full license.
|
||||
*/
|
||||
"use strict"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const MemoryStream = require("memorystream")
|
||||
const NpmRunAllError = require("./npm-run-all-error")
|
||||
const runTask = require("./run-task")
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Remove the given value from the array.
|
||||
* @template T
|
||||
* @param {T[]} array - The array to remove.
|
||||
* @param {T} x - The item to be removed.
|
||||
* @returns {void}
|
||||
*/
|
||||
function remove(array, x) {
|
||||
const index = array.indexOf(x)
|
||||
if (index !== -1) {
|
||||
array.splice(index, 1)
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Run npm-scripts of given names in parallel.
|
||||
*
|
||||
* If a npm-script exited with a non-zero code, this aborts other all npm-scripts.
|
||||
*
|
||||
* @param {string} tasks - A list of npm-script name to run in parallel.
|
||||
* @param {object} options - An option object.
|
||||
* @returns {Promise} A promise object which becomes fullfilled when all npm-scripts are completed.
|
||||
* @private
|
||||
*/
|
||||
module.exports = function runTasks(tasks, options) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (tasks.length === 0) {
|
||||
resolve([])
|
||||
return
|
||||
}
|
||||
|
||||
const results = tasks.map(task => ({ name: task, code: undefined }))
|
||||
const queue = tasks.map((task, index) => ({ name: task, index }))
|
||||
const promises = []
|
||||
let error = null
|
||||
let aborted = false
|
||||
|
||||
/**
|
||||
* Done.
|
||||
* @returns {void}
|
||||
*/
|
||||
function done() {
|
||||
if (error == null) {
|
||||
resolve(results)
|
||||
}
|
||||
else {
|
||||
reject(error)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Aborts all tasks.
|
||||
* @returns {void}
|
||||
*/
|
||||
function abort() {
|
||||
if (aborted) {
|
||||
return
|
||||
}
|
||||
aborted = true
|
||||
|
||||
if (promises.length === 0) {
|
||||
done()
|
||||
}
|
||||
else {
|
||||
for (const p of promises) {
|
||||
p.abort()
|
||||
}
|
||||
Promise.all(promises).then(done, reject)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs a next task.
|
||||
* @returns {void}
|
||||
*/
|
||||
function next() {
|
||||
if (aborted) {
|
||||
return
|
||||
}
|
||||
if (queue.length === 0) {
|
||||
if (promises.length === 0) {
|
||||
done()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
const originalOutputStream = options.stdout
|
||||
const optionsClone = Object.assign({}, options)
|
||||
const writer = new MemoryStream(null, {
|
||||
readable: false,
|
||||
})
|
||||
|
||||
if (options.aggregateOutput) {
|
||||
optionsClone.stdout = writer
|
||||
}
|
||||
|
||||
const task = queue.shift()
|
||||
const promise = runTask(task.name, optionsClone)
|
||||
|
||||
promises.push(promise)
|
||||
promise.then(
|
||||
(result) => {
|
||||
remove(promises, promise)
|
||||
if (aborted) {
|
||||
return
|
||||
}
|
||||
|
||||
if (options.aggregateOutput) {
|
||||
originalOutputStream.write(writer.toString())
|
||||
}
|
||||
|
||||
// Save the result.
|
||||
results[task.index].code = result.code
|
||||
|
||||
// Aborts all tasks if it's an error.
|
||||
if (result.code) {
|
||||
error = new NpmRunAllError(result, results)
|
||||
if (!options.continueOnError) {
|
||||
abort()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Aborts all tasks if options.race is true.
|
||||
if (options.race && !result.code) {
|
||||
abort()
|
||||
return
|
||||
}
|
||||
|
||||
// Call the next task.
|
||||
next()
|
||||
},
|
||||
(thisError) => {
|
||||
remove(promises, promise)
|
||||
if (!options.continueOnError || options.race) {
|
||||
error = thisError
|
||||
abort()
|
||||
return
|
||||
}
|
||||
next()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
const max = options.maxParallel
|
||||
const end = (typeof max === "number" && max > 0)
|
||||
? Math.min(tasks.length, max)
|
||||
: tasks.length
|
||||
for (let i = 0; i < end; ++i) {
|
||||
next()
|
||||
}
|
||||
})
|
||||
}
|
64
node_modules/npm-run-all/lib/spawn-posix.js
generated
vendored
Normal file
64
node_modules/npm-run-all/lib/spawn-posix.js
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* @module spawn-posix
|
||||
* @author Toru Nagashima
|
||||
* @copyright 2015 Toru Nagashima. All rights reserved.
|
||||
* See LICENSE file in root directory for full license.
|
||||
*/
|
||||
"use strict"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const crossSpawn = require("cross-spawn")
|
||||
const getDescendentProcessInfo = require("pidtree")
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Kills the new process and its sub processes.
|
||||
* @this ChildProcess
|
||||
* @returns {void}
|
||||
*/
|
||||
function kill() {
|
||||
getDescendentProcessInfo(this.pid, { root: true }, (err, pids) => {
|
||||
if (err) {
|
||||
return
|
||||
}
|
||||
|
||||
for (const pid of pids) {
|
||||
try {
|
||||
process.kill(pid)
|
||||
}
|
||||
catch (_err) {
|
||||
// ignore.
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Launches a new process with the given command.
|
||||
* This is almost same as `child_process.spawn`.
|
||||
*
|
||||
* This returns a `ChildProcess` instance.
|
||||
* `kill` method of the instance kills the new process and its sub processes.
|
||||
*
|
||||
* @param {string} command - The command to run.
|
||||
* @param {string[]} args - List of string arguments.
|
||||
* @param {object} options - Options.
|
||||
* @returns {ChildProcess} A ChildProcess instance of new process.
|
||||
* @private
|
||||
*/
|
||||
module.exports = function spawn(command, args, options) {
|
||||
const child = crossSpawn(command, args, options)
|
||||
child.kill = kill
|
||||
|
||||
return child
|
||||
}
|
50
node_modules/npm-run-all/lib/spawn-win32.js
generated
vendored
Normal file
50
node_modules/npm-run-all/lib/spawn-win32.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* @module spawn-win32
|
||||
* @author Toru Nagashima
|
||||
* @copyright 2015 Toru Nagashima. All rights reserved.
|
||||
* See LICENSE file in root directory for full license.
|
||||
*/
|
||||
"use strict"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const crossSpawn = require("cross-spawn")
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Kills the new process and its sub processes forcibly.
|
||||
* @this ChildProcess
|
||||
* @returns {void}
|
||||
*/
|
||||
function kill() {
|
||||
crossSpawn("taskkill", ["/F", "/T", "/PID", this.pid])
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Launches a new process with the given command.
|
||||
* This is almost same as `child_process.spawn`.
|
||||
*
|
||||
* This returns a `ChildProcess` instance.
|
||||
* `kill` method of the instance kills the new process and its sub processes forcibly.
|
||||
*
|
||||
* @param {string} command - The command to run.
|
||||
* @param {string[]} args - List of string arguments.
|
||||
* @param {object} options - Options.
|
||||
* @returns {ChildProcess} A ChildProcess instance of new process.
|
||||
* @private
|
||||
*/
|
||||
module.exports = function spawn(command, args, options) {
|
||||
const child = crossSpawn(command, args, options)
|
||||
child.kill = kill
|
||||
|
||||
return child
|
||||
}
|
20
node_modules/npm-run-all/lib/spawn.js
generated
vendored
Normal file
20
node_modules/npm-run-all/lib/spawn.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* @module spawn
|
||||
* @author Toru Nagashima
|
||||
* @copyright 2015 Toru Nagashima. All rights reserved.
|
||||
* See LICENSE file in root directory for full license.
|
||||
*/
|
||||
"use strict"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Launches a new process with the given command.
|
||||
* This is {@link ./spawn-posix.js:spawn} or {@link ./spawn-win32.js:spawn}
|
||||
* @private
|
||||
*/
|
||||
module.exports = require(
|
||||
process.platform === "win32" ? "./spawn-win32" : "./spawn-posix"
|
||||
)
|
1
node_modules/npm-run-all/node_modules/.bin/semver
generated
vendored
Symbolic link
1
node_modules/npm-run-all/node_modules/.bin/semver
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../semver/bin/semver
|
1
node_modules/npm-run-all/node_modules/.bin/which
generated
vendored
Symbolic link
1
node_modules/npm-run-all/node_modules/.bin/which
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../which/bin/which
|
165
node_modules/npm-run-all/node_modules/ansi-styles/index.js
generated
vendored
Normal file
165
node_modules/npm-run-all/node_modules/ansi-styles/index.js
generated
vendored
Normal file
@@ -0,0 +1,165 @@
|
||||
'use strict';
|
||||
const colorConvert = require('color-convert');
|
||||
|
||||
const wrapAnsi16 = (fn, offset) => function () {
|
||||
const code = fn.apply(colorConvert, arguments);
|
||||
return `\u001B[${code + offset}m`;
|
||||
};
|
||||
|
||||
const wrapAnsi256 = (fn, offset) => function () {
|
||||
const code = fn.apply(colorConvert, arguments);
|
||||
return `\u001B[${38 + offset};5;${code}m`;
|
||||
};
|
||||
|
||||
const wrapAnsi16m = (fn, offset) => function () {
|
||||
const rgb = fn.apply(colorConvert, arguments);
|
||||
return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
|
||||
};
|
||||
|
||||
function assembleStyles() {
|
||||
const codes = new Map();
|
||||
const styles = {
|
||||
modifier: {
|
||||
reset: [0, 0],
|
||||
// 21 isn't widely supported and 22 does the same thing
|
||||
bold: [1, 22],
|
||||
dim: [2, 22],
|
||||
italic: [3, 23],
|
||||
underline: [4, 24],
|
||||
inverse: [7, 27],
|
||||
hidden: [8, 28],
|
||||
strikethrough: [9, 29]
|
||||
},
|
||||
color: {
|
||||
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],
|
||||
|
||||
// Bright color
|
||||
redBright: [91, 39],
|
||||
greenBright: [92, 39],
|
||||
yellowBright: [93, 39],
|
||||
blueBright: [94, 39],
|
||||
magentaBright: [95, 39],
|
||||
cyanBright: [96, 39],
|
||||
whiteBright: [97, 39]
|
||||
},
|
||||
bgColor: {
|
||||
bgBlack: [40, 49],
|
||||
bgRed: [41, 49],
|
||||
bgGreen: [42, 49],
|
||||
bgYellow: [43, 49],
|
||||
bgBlue: [44, 49],
|
||||
bgMagenta: [45, 49],
|
||||
bgCyan: [46, 49],
|
||||
bgWhite: [47, 49],
|
||||
|
||||
// Bright color
|
||||
bgBlackBright: [100, 49],
|
||||
bgRedBright: [101, 49],
|
||||
bgGreenBright: [102, 49],
|
||||
bgYellowBright: [103, 49],
|
||||
bgBlueBright: [104, 49],
|
||||
bgMagentaBright: [105, 49],
|
||||
bgCyanBright: [106, 49],
|
||||
bgWhiteBright: [107, 49]
|
||||
}
|
||||
};
|
||||
|
||||
// Fix humans
|
||||
styles.color.grey = styles.color.gray;
|
||||
|
||||
for (const groupName of Object.keys(styles)) {
|
||||
const group = styles[groupName];
|
||||
|
||||
for (const styleName of Object.keys(group)) {
|
||||
const style = group[styleName];
|
||||
|
||||
styles[styleName] = {
|
||||
open: `\u001B[${style[0]}m`,
|
||||
close: `\u001B[${style[1]}m`
|
||||
};
|
||||
|
||||
group[styleName] = styles[styleName];
|
||||
|
||||
codes.set(style[0], style[1]);
|
||||
}
|
||||
|
||||
Object.defineProperty(styles, groupName, {
|
||||
value: group,
|
||||
enumerable: false
|
||||
});
|
||||
|
||||
Object.defineProperty(styles, 'codes', {
|
||||
value: codes,
|
||||
enumerable: false
|
||||
});
|
||||
}
|
||||
|
||||
const ansi2ansi = n => n;
|
||||
const rgb2rgb = (r, g, b) => [r, g, b];
|
||||
|
||||
styles.color.close = '\u001B[39m';
|
||||
styles.bgColor.close = '\u001B[49m';
|
||||
|
||||
styles.color.ansi = {
|
||||
ansi: wrapAnsi16(ansi2ansi, 0)
|
||||
};
|
||||
styles.color.ansi256 = {
|
||||
ansi256: wrapAnsi256(ansi2ansi, 0)
|
||||
};
|
||||
styles.color.ansi16m = {
|
||||
rgb: wrapAnsi16m(rgb2rgb, 0)
|
||||
};
|
||||
|
||||
styles.bgColor.ansi = {
|
||||
ansi: wrapAnsi16(ansi2ansi, 10)
|
||||
};
|
||||
styles.bgColor.ansi256 = {
|
||||
ansi256: wrapAnsi256(ansi2ansi, 10)
|
||||
};
|
||||
styles.bgColor.ansi16m = {
|
||||
rgb: wrapAnsi16m(rgb2rgb, 10)
|
||||
};
|
||||
|
||||
for (let key of Object.keys(colorConvert)) {
|
||||
if (typeof colorConvert[key] !== 'object') {
|
||||
continue;
|
||||
}
|
||||
|
||||
const suite = colorConvert[key];
|
||||
|
||||
if (key === 'ansi16') {
|
||||
key = 'ansi';
|
||||
}
|
||||
|
||||
if ('ansi16' in suite) {
|
||||
styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
|
||||
styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
|
||||
}
|
||||
|
||||
if ('ansi256' in suite) {
|
||||
styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
|
||||
styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
|
||||
}
|
||||
|
||||
if ('rgb' in suite) {
|
||||
styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
|
||||
styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
|
||||
}
|
||||
}
|
||||
|
||||
return styles;
|
||||
}
|
||||
|
||||
// Make the export immutable
|
||||
Object.defineProperty(module, 'exports', {
|
||||
enumerable: true,
|
||||
get: assembleStyles
|
||||
});
|
9
node_modules/npm-run-all/node_modules/ansi-styles/license
generated
vendored
Normal file
9
node_modules/npm-run-all/node_modules/ansi-styles/license
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
56
node_modules/npm-run-all/node_modules/ansi-styles/package.json
generated
vendored
Normal file
56
node_modules/npm-run-all/node_modules/ansi-styles/package.json
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"name": "ansi-styles",
|
||||
"version": "3.2.1",
|
||||
"description": "ANSI escape codes for styling strings in the terminal",
|
||||
"license": "MIT",
|
||||
"repository": "chalk/ansi-styles",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava",
|
||||
"screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"ansi",
|
||||
"styles",
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"tty",
|
||||
"escape",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"log",
|
||||
"logging",
|
||||
"command-line",
|
||||
"text"
|
||||
],
|
||||
"dependencies": {
|
||||
"color-convert": "^1.9.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"babel-polyfill": "^6.23.0",
|
||||
"svg-term-cli": "^2.1.1",
|
||||
"xo": "*"
|
||||
},
|
||||
"ava": {
|
||||
"require": "babel-polyfill"
|
||||
}
|
||||
}
|
147
node_modules/npm-run-all/node_modules/ansi-styles/readme.md
generated
vendored
Normal file
147
node_modules/npm-run-all/node_modules/ansi-styles/readme.md
generated
vendored
Normal file
@@ -0,0 +1,147 @@
|
||||
# ansi-styles [](https://travis-ci.org/chalk/ansi-styles)
|
||||
|
||||
> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
|
||||
|
||||
You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.
|
||||
|
||||
<img src="https://cdn.rawgit.com/chalk/ansi-styles/8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" width="900">
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install ansi-styles
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const style = require('ansi-styles');
|
||||
|
||||
console.log(`${style.green.open}Hello world!${style.green.close}`);
|
||||
|
||||
|
||||
// Color conversion between 16/256/truecolor
|
||||
// NOTE: If conversion goes to 16 colors or 256 colors, the original color
|
||||
// may be degraded to fit that color palette. This means terminals
|
||||
// that do not support 16 million colors will best-match the
|
||||
// original color.
|
||||
console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close);
|
||||
console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close);
|
||||
console.log(style.color.ansi16m.hex('#ABCDEF') + 'Hello world!' + style.color.close);
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
Each style has an `open` and `close` property.
|
||||
|
||||
|
||||
## Styles
|
||||
|
||||
### Modifiers
|
||||
|
||||
- `reset`
|
||||
- `bold`
|
||||
- `dim`
|
||||
- `italic` *(Not widely supported)*
|
||||
- `underline`
|
||||
- `inverse`
|
||||
- `hidden`
|
||||
- `strikethrough` *(Not widely supported)*
|
||||
|
||||
### Colors
|
||||
|
||||
- `black`
|
||||
- `red`
|
||||
- `green`
|
||||
- `yellow`
|
||||
- `blue`
|
||||
- `magenta`
|
||||
- `cyan`
|
||||
- `white`
|
||||
- `gray` ("bright black")
|
||||
- `redBright`
|
||||
- `greenBright`
|
||||
- `yellowBright`
|
||||
- `blueBright`
|
||||
- `magentaBright`
|
||||
- `cyanBright`
|
||||
- `whiteBright`
|
||||
|
||||
### Background colors
|
||||
|
||||
- `bgBlack`
|
||||
- `bgRed`
|
||||
- `bgGreen`
|
||||
- `bgYellow`
|
||||
- `bgBlue`
|
||||
- `bgMagenta`
|
||||
- `bgCyan`
|
||||
- `bgWhite`
|
||||
- `bgBlackBright`
|
||||
- `bgRedBright`
|
||||
- `bgGreenBright`
|
||||
- `bgYellowBright`
|
||||
- `bgBlueBright`
|
||||
- `bgMagentaBright`
|
||||
- `bgCyanBright`
|
||||
- `bgWhiteBright`
|
||||
|
||||
|
||||
## Advanced usage
|
||||
|
||||
By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module.
|
||||
|
||||
- `style.modifier`
|
||||
- `style.color`
|
||||
- `style.bgColor`
|
||||
|
||||
###### Example
|
||||
|
||||
```js
|
||||
console.log(style.color.green.open);
|
||||
```
|
||||
|
||||
Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `style.codes`, which returns a `Map` with the open codes as keys and close codes as values.
|
||||
|
||||
###### Example
|
||||
|
||||
```js
|
||||
console.log(style.codes.get(36));
|
||||
//=> 39
|
||||
```
|
||||
|
||||
|
||||
## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728)
|
||||
|
||||
`ansi-styles` uses the [`color-convert`](https://github.com/Qix-/color-convert) package to allow for converting between various colors and ANSI escapes, with support for 256 and 16 million colors.
|
||||
|
||||
To use these, call the associated conversion function with the intended output, for example:
|
||||
|
||||
```js
|
||||
style.color.ansi.rgb(100, 200, 15); // RGB to 16 color ansi foreground code
|
||||
style.bgColor.ansi.rgb(100, 200, 15); // RGB to 16 color ansi background code
|
||||
|
||||
style.color.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
|
||||
style.bgColor.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
|
||||
|
||||
style.color.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color foreground code
|
||||
style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color background code
|
||||
```
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal
|
||||
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Josh Junon](https://github.com/qix-)
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
54
node_modules/npm-run-all/node_modules/color-convert/CHANGELOG.md
generated
vendored
Normal file
54
node_modules/npm-run-all/node_modules/color-convert/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
# 1.0.0 - 2016-01-07
|
||||
|
||||
- Removed: unused speed test
|
||||
- Added: Automatic routing between previously unsupported conversions
|
||||
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||
- Removed: `xxx2xxx()` and `xxx2xxxRaw()` functions
|
||||
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||
- Removed: `convert()` class
|
||||
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||
- Changed: all functions to lookup dictionary
|
||||
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||
- Changed: `ansi` to `ansi256`
|
||||
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||
- Fixed: argument grouping for functions requiring only one argument
|
||||
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||
|
||||
# 0.6.0 - 2015-07-23
|
||||
|
||||
- Added: methods to handle
|
||||
[ANSI](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors) 16/256 colors:
|
||||
- rgb2ansi16
|
||||
- rgb2ansi
|
||||
- hsl2ansi16
|
||||
- hsl2ansi
|
||||
- hsv2ansi16
|
||||
- hsv2ansi
|
||||
- hwb2ansi16
|
||||
- hwb2ansi
|
||||
- cmyk2ansi16
|
||||
- cmyk2ansi
|
||||
- keyword2ansi16
|
||||
- keyword2ansi
|
||||
- ansi162rgb
|
||||
- ansi162hsl
|
||||
- ansi162hsv
|
||||
- ansi162hwb
|
||||
- ansi162cmyk
|
||||
- ansi162keyword
|
||||
- ansi2rgb
|
||||
- ansi2hsl
|
||||
- ansi2hsv
|
||||
- ansi2hwb
|
||||
- ansi2cmyk
|
||||
- ansi2keyword
|
||||
([#18](https://github.com/harthur/color-convert/pull/18))
|
||||
|
||||
# 0.5.3 - 2015-06-02
|
||||
|
||||
- Fixed: hsl2hsv does not return `NaN` anymore when using `[0,0,0]`
|
||||
([#15](https://github.com/harthur/color-convert/issues/15))
|
||||
|
||||
---
|
||||
|
||||
Check out commit logs for older releases
|
21
node_modules/npm-run-all/node_modules/color-convert/LICENSE
generated
vendored
Normal file
21
node_modules/npm-run-all/node_modules/color-convert/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
Copyright (c) 2011-2016 Heather Arthur <fayearthur@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
68
node_modules/npm-run-all/node_modules/color-convert/README.md
generated
vendored
Normal file
68
node_modules/npm-run-all/node_modules/color-convert/README.md
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
# color-convert
|
||||
|
||||
[](https://travis-ci.org/Qix-/color-convert)
|
||||
|
||||
Color-convert is a color conversion library for JavaScript and node.
|
||||
It converts all ways between `rgb`, `hsl`, `hsv`, `hwb`, `cmyk`, `ansi`, `ansi16`, `hex` strings, and CSS `keyword`s (will round to closest):
|
||||
|
||||
```js
|
||||
var convert = require('color-convert');
|
||||
|
||||
convert.rgb.hsl(140, 200, 100); // [96, 48, 59]
|
||||
convert.keyword.rgb('blue'); // [0, 0, 255]
|
||||
|
||||
var rgbChannels = convert.rgb.channels; // 3
|
||||
var cmykChannels = convert.cmyk.channels; // 4
|
||||
var ansiChannels = convert.ansi16.channels; // 1
|
||||
```
|
||||
|
||||
# Install
|
||||
|
||||
```console
|
||||
$ npm install color-convert
|
||||
```
|
||||
|
||||
# API
|
||||
|
||||
Simply get the property of the _from_ and _to_ conversion that you're looking for.
|
||||
|
||||
All functions have a rounded and unrounded variant. By default, return values are rounded. To get the unrounded (raw) results, simply tack on `.raw` to the function.
|
||||
|
||||
All 'from' functions have a hidden property called `.channels` that indicates the number of channels the function expects (not including alpha).
|
||||
|
||||
```js
|
||||
var convert = require('color-convert');
|
||||
|
||||
// Hex to LAB
|
||||
convert.hex.lab('DEADBF'); // [ 76, 21, -2 ]
|
||||
convert.hex.lab.raw('DEADBF'); // [ 75.56213190997677, 20.653827952644754, -2.290532499330533 ]
|
||||
|
||||
// RGB to CMYK
|
||||
convert.rgb.cmyk(167, 255, 4); // [ 35, 0, 98, 0 ]
|
||||
convert.rgb.cmyk.raw(167, 255, 4); // [ 34.509803921568626, 0, 98.43137254901961, 0 ]
|
||||
```
|
||||
|
||||
### Arrays
|
||||
All functions that accept multiple arguments also support passing an array.
|
||||
|
||||
Note that this does **not** apply to functions that convert from a color that only requires one value (e.g. `keyword`, `ansi256`, `hex`, etc.)
|
||||
|
||||
```js
|
||||
var convert = require('color-convert');
|
||||
|
||||
convert.rgb.hex(123, 45, 67); // '7B2D43'
|
||||
convert.rgb.hex([123, 45, 67]); // '7B2D43'
|
||||
```
|
||||
|
||||
## Routing
|
||||
|
||||
Conversions that don't have an _explicitly_ defined conversion (in [conversions.js](conversions.js)), but can be converted by means of sub-conversions (e.g. XYZ -> **RGB** -> CMYK), are automatically routed together. This allows just about any color model supported by `color-convert` to be converted to any other model, so long as a sub-conversion path exists. This is also true for conversions requiring more than one step in between (e.g. LCH -> **LAB** -> **XYZ** -> **RGB** -> Hex).
|
||||
|
||||
Keep in mind that extensive conversions _may_ result in a loss of precision, and exist only to be complete. For a list of "direct" (single-step) conversions, see [conversions.js](conversions.js).
|
||||
|
||||
# Contribute
|
||||
|
||||
If there is a new model you would like to support, or want to add a direct conversion between two existing models, please send us a pull request.
|
||||
|
||||
# License
|
||||
Copyright © 2011-2016, Heather Arthur and Josh Junon. Licensed under the [MIT License](LICENSE).
|
868
node_modules/npm-run-all/node_modules/color-convert/conversions.js
generated
vendored
Normal file
868
node_modules/npm-run-all/node_modules/color-convert/conversions.js
generated
vendored
Normal file
@@ -0,0 +1,868 @@
|
||||
/* MIT license */
|
||||
var cssKeywords = require('color-name');
|
||||
|
||||
// NOTE: conversions should only return primitive values (i.e. arrays, or
|
||||
// values that give correct `typeof` results).
|
||||
// do not use box values types (i.e. Number(), String(), etc.)
|
||||
|
||||
var reverseKeywords = {};
|
||||
for (var key in cssKeywords) {
|
||||
if (cssKeywords.hasOwnProperty(key)) {
|
||||
reverseKeywords[cssKeywords[key]] = key;
|
||||
}
|
||||
}
|
||||
|
||||
var convert = module.exports = {
|
||||
rgb: {channels: 3, labels: 'rgb'},
|
||||
hsl: {channels: 3, labels: 'hsl'},
|
||||
hsv: {channels: 3, labels: 'hsv'},
|
||||
hwb: {channels: 3, labels: 'hwb'},
|
||||
cmyk: {channels: 4, labels: 'cmyk'},
|
||||
xyz: {channels: 3, labels: 'xyz'},
|
||||
lab: {channels: 3, labels: 'lab'},
|
||||
lch: {channels: 3, labels: 'lch'},
|
||||
hex: {channels: 1, labels: ['hex']},
|
||||
keyword: {channels: 1, labels: ['keyword']},
|
||||
ansi16: {channels: 1, labels: ['ansi16']},
|
||||
ansi256: {channels: 1, labels: ['ansi256']},
|
||||
hcg: {channels: 3, labels: ['h', 'c', 'g']},
|
||||
apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
|
||||
gray: {channels: 1, labels: ['gray']}
|
||||
};
|
||||
|
||||
// hide .channels and .labels properties
|
||||
for (var model in convert) {
|
||||
if (convert.hasOwnProperty(model)) {
|
||||
if (!('channels' in convert[model])) {
|
||||
throw new Error('missing channels property: ' + model);
|
||||
}
|
||||
|
||||
if (!('labels' in convert[model])) {
|
||||
throw new Error('missing channel labels property: ' + model);
|
||||
}
|
||||
|
||||
if (convert[model].labels.length !== convert[model].channels) {
|
||||
throw new Error('channel and label counts mismatch: ' + model);
|
||||
}
|
||||
|
||||
var channels = convert[model].channels;
|
||||
var labels = convert[model].labels;
|
||||
delete convert[model].channels;
|
||||
delete convert[model].labels;
|
||||
Object.defineProperty(convert[model], 'channels', {value: channels});
|
||||
Object.defineProperty(convert[model], 'labels', {value: labels});
|
||||
}
|
||||
}
|
||||
|
||||
convert.rgb.hsl = function (rgb) {
|
||||
var r = rgb[0] / 255;
|
||||
var g = rgb[1] / 255;
|
||||
var b = rgb[2] / 255;
|
||||
var min = Math.min(r, g, b);
|
||||
var max = Math.max(r, g, b);
|
||||
var delta = max - min;
|
||||
var h;
|
||||
var s;
|
||||
var l;
|
||||
|
||||
if (max === min) {
|
||||
h = 0;
|
||||
} else if (r === max) {
|
||||
h = (g - b) / delta;
|
||||
} else if (g === max) {
|
||||
h = 2 + (b - r) / delta;
|
||||
} else if (b === max) {
|
||||
h = 4 + (r - g) / delta;
|
||||
}
|
||||
|
||||
h = Math.min(h * 60, 360);
|
||||
|
||||
if (h < 0) {
|
||||
h += 360;
|
||||
}
|
||||
|
||||
l = (min + max) / 2;
|
||||
|
||||
if (max === min) {
|
||||
s = 0;
|
||||
} else if (l <= 0.5) {
|
||||
s = delta / (max + min);
|
||||
} else {
|
||||
s = delta / (2 - max - min);
|
||||
}
|
||||
|
||||
return [h, s * 100, l * 100];
|
||||
};
|
||||
|
||||
convert.rgb.hsv = function (rgb) {
|
||||
var rdif;
|
||||
var gdif;
|
||||
var bdif;
|
||||
var h;
|
||||
var s;
|
||||
|
||||
var r = rgb[0] / 255;
|
||||
var g = rgb[1] / 255;
|
||||
var b = rgb[2] / 255;
|
||||
var v = Math.max(r, g, b);
|
||||
var diff = v - Math.min(r, g, b);
|
||||
var diffc = function (c) {
|
||||
return (v - c) / 6 / diff + 1 / 2;
|
||||
};
|
||||
|
||||
if (diff === 0) {
|
||||
h = s = 0;
|
||||
} else {
|
||||
s = diff / v;
|
||||
rdif = diffc(r);
|
||||
gdif = diffc(g);
|
||||
bdif = diffc(b);
|
||||
|
||||
if (r === v) {
|
||||
h = bdif - gdif;
|
||||
} else if (g === v) {
|
||||
h = (1 / 3) + rdif - bdif;
|
||||
} else if (b === v) {
|
||||
h = (2 / 3) + gdif - rdif;
|
||||
}
|
||||
if (h < 0) {
|
||||
h += 1;
|
||||
} else if (h > 1) {
|
||||
h -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
h * 360,
|
||||
s * 100,
|
||||
v * 100
|
||||
];
|
||||
};
|
||||
|
||||
convert.rgb.hwb = function (rgb) {
|
||||
var r = rgb[0];
|
||||
var g = rgb[1];
|
||||
var b = rgb[2];
|
||||
var h = convert.rgb.hsl(rgb)[0];
|
||||
var w = 1 / 255 * Math.min(r, Math.min(g, b));
|
||||
|
||||
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
|
||||
|
||||
return [h, w * 100, b * 100];
|
||||
};
|
||||
|
||||
convert.rgb.cmyk = function (rgb) {
|
||||
var r = rgb[0] / 255;
|
||||
var g = rgb[1] / 255;
|
||||
var b = rgb[2] / 255;
|
||||
var c;
|
||||
var m;
|
||||
var y;
|
||||
var k;
|
||||
|
||||
k = Math.min(1 - r, 1 - g, 1 - b);
|
||||
c = (1 - r - k) / (1 - k) || 0;
|
||||
m = (1 - g - k) / (1 - k) || 0;
|
||||
y = (1 - b - k) / (1 - k) || 0;
|
||||
|
||||
return [c * 100, m * 100, y * 100, k * 100];
|
||||
};
|
||||
|
||||
/**
|
||||
* See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
||||
* */
|
||||
function comparativeDistance(x, y) {
|
||||
return (
|
||||
Math.pow(x[0] - y[0], 2) +
|
||||
Math.pow(x[1] - y[1], 2) +
|
||||
Math.pow(x[2] - y[2], 2)
|
||||
);
|
||||
}
|
||||
|
||||
convert.rgb.keyword = function (rgb) {
|
||||
var reversed = reverseKeywords[rgb];
|
||||
if (reversed) {
|
||||
return reversed;
|
||||
}
|
||||
|
||||
var currentClosestDistance = Infinity;
|
||||
var currentClosestKeyword;
|
||||
|
||||
for (var keyword in cssKeywords) {
|
||||
if (cssKeywords.hasOwnProperty(keyword)) {
|
||||
var value = cssKeywords[keyword];
|
||||
|
||||
// Compute comparative distance
|
||||
var distance = comparativeDistance(rgb, value);
|
||||
|
||||
// Check if its less, if so set as closest
|
||||
if (distance < currentClosestDistance) {
|
||||
currentClosestDistance = distance;
|
||||
currentClosestKeyword = keyword;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return currentClosestKeyword;
|
||||
};
|
||||
|
||||
convert.keyword.rgb = function (keyword) {
|
||||
return cssKeywords[keyword];
|
||||
};
|
||||
|
||||
convert.rgb.xyz = function (rgb) {
|
||||
var r = rgb[0] / 255;
|
||||
var g = rgb[1] / 255;
|
||||
var b = rgb[2] / 255;
|
||||
|
||||
// assume sRGB
|
||||
r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92);
|
||||
g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92);
|
||||
b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92);
|
||||
|
||||
var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
|
||||
var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
|
||||
var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
|
||||
|
||||
return [x * 100, y * 100, z * 100];
|
||||
};
|
||||
|
||||
convert.rgb.lab = function (rgb) {
|
||||
var xyz = convert.rgb.xyz(rgb);
|
||||
var x = xyz[0];
|
||||
var y = xyz[1];
|
||||
var z = xyz[2];
|
||||
var l;
|
||||
var a;
|
||||
var b;
|
||||
|
||||
x /= 95.047;
|
||||
y /= 100;
|
||||
z /= 108.883;
|
||||
|
||||
x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
|
||||
y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
|
||||
z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
|
||||
|
||||
l = (116 * y) - 16;
|
||||
a = 500 * (x - y);
|
||||
b = 200 * (y - z);
|
||||
|
||||
return [l, a, b];
|
||||
};
|
||||
|
||||
convert.hsl.rgb = function (hsl) {
|
||||
var h = hsl[0] / 360;
|
||||
var s = hsl[1] / 100;
|
||||
var l = hsl[2] / 100;
|
||||
var t1;
|
||||
var t2;
|
||||
var t3;
|
||||
var rgb;
|
||||
var val;
|
||||
|
||||
if (s === 0) {
|
||||
val = l * 255;
|
||||
return [val, val, val];
|
||||
}
|
||||
|
||||
if (l < 0.5) {
|
||||
t2 = l * (1 + s);
|
||||
} else {
|
||||
t2 = l + s - l * s;
|
||||
}
|
||||
|
||||
t1 = 2 * l - t2;
|
||||
|
||||
rgb = [0, 0, 0];
|
||||
for (var i = 0; i < 3; i++) {
|
||||
t3 = h + 1 / 3 * -(i - 1);
|
||||
if (t3 < 0) {
|
||||
t3++;
|
||||
}
|
||||
if (t3 > 1) {
|
||||
t3--;
|
||||
}
|
||||
|
||||
if (6 * t3 < 1) {
|
||||
val = t1 + (t2 - t1) * 6 * t3;
|
||||
} else if (2 * t3 < 1) {
|
||||
val = t2;
|
||||
} else if (3 * t3 < 2) {
|
||||
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
|
||||
} else {
|
||||
val = t1;
|
||||
}
|
||||
|
||||
rgb[i] = val * 255;
|
||||
}
|
||||
|
||||
return rgb;
|
||||
};
|
||||
|
||||
convert.hsl.hsv = function (hsl) {
|
||||
var h = hsl[0];
|
||||
var s = hsl[1] / 100;
|
||||
var l = hsl[2] / 100;
|
||||
var smin = s;
|
||||
var lmin = Math.max(l, 0.01);
|
||||
var sv;
|
||||
var v;
|
||||
|
||||
l *= 2;
|
||||
s *= (l <= 1) ? l : 2 - l;
|
||||
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
||||
v = (l + s) / 2;
|
||||
sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
|
||||
|
||||
return [h, sv * 100, v * 100];
|
||||
};
|
||||
|
||||
convert.hsv.rgb = function (hsv) {
|
||||
var h = hsv[0] / 60;
|
||||
var s = hsv[1] / 100;
|
||||
var v = hsv[2] / 100;
|
||||
var hi = Math.floor(h) % 6;
|
||||
|
||||
var f = h - Math.floor(h);
|
||||
var p = 255 * v * (1 - s);
|
||||
var q = 255 * v * (1 - (s * f));
|
||||
var t = 255 * v * (1 - (s * (1 - f)));
|
||||
v *= 255;
|
||||
|
||||
switch (hi) {
|
||||
case 0:
|
||||
return [v, t, p];
|
||||
case 1:
|
||||
return [q, v, p];
|
||||
case 2:
|
||||
return [p, v, t];
|
||||
case 3:
|
||||
return [p, q, v];
|
||||
case 4:
|
||||
return [t, p, v];
|
||||
case 5:
|
||||
return [v, p, q];
|
||||
}
|
||||
};
|
||||
|
||||
convert.hsv.hsl = function (hsv) {
|
||||
var h = hsv[0];
|
||||
var s = hsv[1] / 100;
|
||||
var v = hsv[2] / 100;
|
||||
var vmin = Math.max(v, 0.01);
|
||||
var lmin;
|
||||
var sl;
|
||||
var l;
|
||||
|
||||
l = (2 - s) * v;
|
||||
lmin = (2 - s) * vmin;
|
||||
sl = s * vmin;
|
||||
sl /= (lmin <= 1) ? lmin : 2 - lmin;
|
||||
sl = sl || 0;
|
||||
l /= 2;
|
||||
|
||||
return [h, sl * 100, l * 100];
|
||||
};
|
||||
|
||||
// http://dev.w3.org/csswg/css-color/#hwb-to-rgb
|
||||
convert.hwb.rgb = function (hwb) {
|
||||
var h = hwb[0] / 360;
|
||||
var wh = hwb[1] / 100;
|
||||
var bl = hwb[2] / 100;
|
||||
var ratio = wh + bl;
|
||||
var i;
|
||||
var v;
|
||||
var f;
|
||||
var n;
|
||||
|
||||
// wh + bl cant be > 1
|
||||
if (ratio > 1) {
|
||||
wh /= ratio;
|
||||
bl /= ratio;
|
||||
}
|
||||
|
||||
i = Math.floor(6 * h);
|
||||
v = 1 - bl;
|
||||
f = 6 * h - i;
|
||||
|
||||
if ((i & 0x01) !== 0) {
|
||||
f = 1 - f;
|
||||
}
|
||||
|
||||
n = wh + f * (v - wh); // linear interpolation
|
||||
|
||||
var r;
|
||||
var g;
|
||||
var b;
|
||||
switch (i) {
|
||||
default:
|
||||
case 6:
|
||||
case 0: r = v; g = n; b = wh; break;
|
||||
case 1: r = n; g = v; b = wh; break;
|
||||
case 2: r = wh; g = v; b = n; break;
|
||||
case 3: r = wh; g = n; b = v; break;
|
||||
case 4: r = n; g = wh; b = v; break;
|
||||
case 5: r = v; g = wh; b = n; break;
|
||||
}
|
||||
|
||||
return [r * 255, g * 255, b * 255];
|
||||
};
|
||||
|
||||
convert.cmyk.rgb = function (cmyk) {
|
||||
var c = cmyk[0] / 100;
|
||||
var m = cmyk[1] / 100;
|
||||
var y = cmyk[2] / 100;
|
||||
var k = cmyk[3] / 100;
|
||||
var r;
|
||||
var g;
|
||||
var b;
|
||||
|
||||
r = 1 - Math.min(1, c * (1 - k) + k);
|
||||
g = 1 - Math.min(1, m * (1 - k) + k);
|
||||
b = 1 - Math.min(1, y * (1 - k) + k);
|
||||
|
||||
return [r * 255, g * 255, b * 255];
|
||||
};
|
||||
|
||||
convert.xyz.rgb = function (xyz) {
|
||||
var x = xyz[0] / 100;
|
||||
var y = xyz[1] / 100;
|
||||
var z = xyz[2] / 100;
|
||||
var r;
|
||||
var g;
|
||||
var b;
|
||||
|
||||
r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
|
||||
g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
|
||||
b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
|
||||
|
||||
// assume sRGB
|
||||
r = r > 0.0031308
|
||||
? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055)
|
||||
: r * 12.92;
|
||||
|
||||
g = g > 0.0031308
|
||||
? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055)
|
||||
: g * 12.92;
|
||||
|
||||
b = b > 0.0031308
|
||||
? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055)
|
||||
: b * 12.92;
|
||||
|
||||
r = Math.min(Math.max(0, r), 1);
|
||||
g = Math.min(Math.max(0, g), 1);
|
||||
b = Math.min(Math.max(0, b), 1);
|
||||
|
||||
return [r * 255, g * 255, b * 255];
|
||||
};
|
||||
|
||||
convert.xyz.lab = function (xyz) {
|
||||
var x = xyz[0];
|
||||
var y = xyz[1];
|
||||
var z = xyz[2];
|
||||
var l;
|
||||
var a;
|
||||
var b;
|
||||
|
||||
x /= 95.047;
|
||||
y /= 100;
|
||||
z /= 108.883;
|
||||
|
||||
x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
|
||||
y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
|
||||
z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
|
||||
|
||||
l = (116 * y) - 16;
|
||||
a = 500 * (x - y);
|
||||
b = 200 * (y - z);
|
||||
|
||||
return [l, a, b];
|
||||
};
|
||||
|
||||
convert.lab.xyz = function (lab) {
|
||||
var l = lab[0];
|
||||
var a = lab[1];
|
||||
var b = lab[2];
|
||||
var x;
|
||||
var y;
|
||||
var z;
|
||||
|
||||
y = (l + 16) / 116;
|
||||
x = a / 500 + y;
|
||||
z = y - b / 200;
|
||||
|
||||
var y2 = Math.pow(y, 3);
|
||||
var x2 = Math.pow(x, 3);
|
||||
var z2 = Math.pow(z, 3);
|
||||
y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
|
||||
x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
|
||||
z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
|
||||
|
||||
x *= 95.047;
|
||||
y *= 100;
|
||||
z *= 108.883;
|
||||
|
||||
return [x, y, z];
|
||||
};
|
||||
|
||||
convert.lab.lch = function (lab) {
|
||||
var l = lab[0];
|
||||
var a = lab[1];
|
||||
var b = lab[2];
|
||||
var hr;
|
||||
var h;
|
||||
var c;
|
||||
|
||||
hr = Math.atan2(b, a);
|
||||
h = hr * 360 / 2 / Math.PI;
|
||||
|
||||
if (h < 0) {
|
||||
h += 360;
|
||||
}
|
||||
|
||||
c = Math.sqrt(a * a + b * b);
|
||||
|
||||
return [l, c, h];
|
||||
};
|
||||
|
||||
convert.lch.lab = function (lch) {
|
||||
var l = lch[0];
|
||||
var c = lch[1];
|
||||
var h = lch[2];
|
||||
var a;
|
||||
var b;
|
||||
var hr;
|
||||
|
||||
hr = h / 360 * 2 * Math.PI;
|
||||
a = c * Math.cos(hr);
|
||||
b = c * Math.sin(hr);
|
||||
|
||||
return [l, a, b];
|
||||
};
|
||||
|
||||
convert.rgb.ansi16 = function (args) {
|
||||
var r = args[0];
|
||||
var g = args[1];
|
||||
var b = args[2];
|
||||
var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization
|
||||
|
||||
value = Math.round(value / 50);
|
||||
|
||||
if (value === 0) {
|
||||
return 30;
|
||||
}
|
||||
|
||||
var ansi = 30
|
||||
+ ((Math.round(b / 255) << 2)
|
||||
| (Math.round(g / 255) << 1)
|
||||
| Math.round(r / 255));
|
||||
|
||||
if (value === 2) {
|
||||
ansi += 60;
|
||||
}
|
||||
|
||||
return ansi;
|
||||
};
|
||||
|
||||
convert.hsv.ansi16 = function (args) {
|
||||
// optimization here; we already know the value and don't need to get
|
||||
// it converted for us.
|
||||
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
|
||||
};
|
||||
|
||||
convert.rgb.ansi256 = function (args) {
|
||||
var r = args[0];
|
||||
var g = args[1];
|
||||
var b = args[2];
|
||||
|
||||
// we use the extended greyscale palette here, with the exception of
|
||||
// black and white. normal palette only has 4 greyscale shades.
|
||||
if (r === g && g === b) {
|
||||
if (r < 8) {
|
||||
return 16;
|
||||
}
|
||||
|
||||
if (r > 248) {
|
||||
return 231;
|
||||
}
|
||||
|
||||
return Math.round(((r - 8) / 247) * 24) + 232;
|
||||
}
|
||||
|
||||
var ansi = 16
|
||||
+ (36 * Math.round(r / 255 * 5))
|
||||
+ (6 * Math.round(g / 255 * 5))
|
||||
+ Math.round(b / 255 * 5);
|
||||
|
||||
return ansi;
|
||||
};
|
||||
|
||||
convert.ansi16.rgb = function (args) {
|
||||
var color = args % 10;
|
||||
|
||||
// handle greyscale
|
||||
if (color === 0 || color === 7) {
|
||||
if (args > 50) {
|
||||
color += 3.5;
|
||||
}
|
||||
|
||||
color = color / 10.5 * 255;
|
||||
|
||||
return [color, color, color];
|
||||
}
|
||||
|
||||
var mult = (~~(args > 50) + 1) * 0.5;
|
||||
var r = ((color & 1) * mult) * 255;
|
||||
var g = (((color >> 1) & 1) * mult) * 255;
|
||||
var b = (((color >> 2) & 1) * mult) * 255;
|
||||
|
||||
return [r, g, b];
|
||||
};
|
||||
|
||||
convert.ansi256.rgb = function (args) {
|
||||
// handle greyscale
|
||||
if (args >= 232) {
|
||||
var c = (args - 232) * 10 + 8;
|
||||
return [c, c, c];
|
||||
}
|
||||
|
||||
args -= 16;
|
||||
|
||||
var rem;
|
||||
var r = Math.floor(args / 36) / 5 * 255;
|
||||
var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
|
||||
var b = (rem % 6) / 5 * 255;
|
||||
|
||||
return [r, g, b];
|
||||
};
|
||||
|
||||
convert.rgb.hex = function (args) {
|
||||
var integer = ((Math.round(args[0]) & 0xFF) << 16)
|
||||
+ ((Math.round(args[1]) & 0xFF) << 8)
|
||||
+ (Math.round(args[2]) & 0xFF);
|
||||
|
||||
var string = integer.toString(16).toUpperCase();
|
||||
return '000000'.substring(string.length) + string;
|
||||
};
|
||||
|
||||
convert.hex.rgb = function (args) {
|
||||
var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
|
||||
if (!match) {
|
||||
return [0, 0, 0];
|
||||
}
|
||||
|
||||
var colorString = match[0];
|
||||
|
||||
if (match[0].length === 3) {
|
||||
colorString = colorString.split('').map(function (char) {
|
||||
return char + char;
|
||||
}).join('');
|
||||
}
|
||||
|
||||
var integer = parseInt(colorString, 16);
|
||||
var r = (integer >> 16) & 0xFF;
|
||||
var g = (integer >> 8) & 0xFF;
|
||||
var b = integer & 0xFF;
|
||||
|
||||
return [r, g, b];
|
||||
};
|
||||
|
||||
convert.rgb.hcg = function (rgb) {
|
||||
var r = rgb[0] / 255;
|
||||
var g = rgb[1] / 255;
|
||||
var b = rgb[2] / 255;
|
||||
var max = Math.max(Math.max(r, g), b);
|
||||
var min = Math.min(Math.min(r, g), b);
|
||||
var chroma = (max - min);
|
||||
var grayscale;
|
||||
var hue;
|
||||
|
||||
if (chroma < 1) {
|
||||
grayscale = min / (1 - chroma);
|
||||
} else {
|
||||
grayscale = 0;
|
||||
}
|
||||
|
||||
if (chroma <= 0) {
|
||||
hue = 0;
|
||||
} else
|
||||
if (max === r) {
|
||||
hue = ((g - b) / chroma) % 6;
|
||||
} else
|
||||
if (max === g) {
|
||||
hue = 2 + (b - r) / chroma;
|
||||
} else {
|
||||
hue = 4 + (r - g) / chroma + 4;
|
||||
}
|
||||
|
||||
hue /= 6;
|
||||
hue %= 1;
|
||||
|
||||
return [hue * 360, chroma * 100, grayscale * 100];
|
||||
};
|
||||
|
||||
convert.hsl.hcg = function (hsl) {
|
||||
var s = hsl[1] / 100;
|
||||
var l = hsl[2] / 100;
|
||||
var c = 1;
|
||||
var f = 0;
|
||||
|
||||
if (l < 0.5) {
|
||||
c = 2.0 * s * l;
|
||||
} else {
|
||||
c = 2.0 * s * (1.0 - l);
|
||||
}
|
||||
|
||||
if (c < 1.0) {
|
||||
f = (l - 0.5 * c) / (1.0 - c);
|
||||
}
|
||||
|
||||
return [hsl[0], c * 100, f * 100];
|
||||
};
|
||||
|
||||
convert.hsv.hcg = function (hsv) {
|
||||
var s = hsv[1] / 100;
|
||||
var v = hsv[2] / 100;
|
||||
|
||||
var c = s * v;
|
||||
var f = 0;
|
||||
|
||||
if (c < 1.0) {
|
||||
f = (v - c) / (1 - c);
|
||||
}
|
||||
|
||||
return [hsv[0], c * 100, f * 100];
|
||||
};
|
||||
|
||||
convert.hcg.rgb = function (hcg) {
|
||||
var h = hcg[0] / 360;
|
||||
var c = hcg[1] / 100;
|
||||
var g = hcg[2] / 100;
|
||||
|
||||
if (c === 0.0) {
|
||||
return [g * 255, g * 255, g * 255];
|
||||
}
|
||||
|
||||
var pure = [0, 0, 0];
|
||||
var hi = (h % 1) * 6;
|
||||
var v = hi % 1;
|
||||
var w = 1 - v;
|
||||
var mg = 0;
|
||||
|
||||
switch (Math.floor(hi)) {
|
||||
case 0:
|
||||
pure[0] = 1; pure[1] = v; pure[2] = 0; break;
|
||||
case 1:
|
||||
pure[0] = w; pure[1] = 1; pure[2] = 0; break;
|
||||
case 2:
|
||||
pure[0] = 0; pure[1] = 1; pure[2] = v; break;
|
||||
case 3:
|
||||
pure[0] = 0; pure[1] = w; pure[2] = 1; break;
|
||||
case 4:
|
||||
pure[0] = v; pure[1] = 0; pure[2] = 1; break;
|
||||
default:
|
||||
pure[0] = 1; pure[1] = 0; pure[2] = w;
|
||||
}
|
||||
|
||||
mg = (1.0 - c) * g;
|
||||
|
||||
return [
|
||||
(c * pure[0] + mg) * 255,
|
||||
(c * pure[1] + mg) * 255,
|
||||
(c * pure[2] + mg) * 255
|
||||
];
|
||||
};
|
||||
|
||||
convert.hcg.hsv = function (hcg) {
|
||||
var c = hcg[1] / 100;
|
||||
var g = hcg[2] / 100;
|
||||
|
||||
var v = c + g * (1.0 - c);
|
||||
var f = 0;
|
||||
|
||||
if (v > 0.0) {
|
||||
f = c / v;
|
||||
}
|
||||
|
||||
return [hcg[0], f * 100, v * 100];
|
||||
};
|
||||
|
||||
convert.hcg.hsl = function (hcg) {
|
||||
var c = hcg[1] / 100;
|
||||
var g = hcg[2] / 100;
|
||||
|
||||
var l = g * (1.0 - c) + 0.5 * c;
|
||||
var s = 0;
|
||||
|
||||
if (l > 0.0 && l < 0.5) {
|
||||
s = c / (2 * l);
|
||||
} else
|
||||
if (l >= 0.5 && l < 1.0) {
|
||||
s = c / (2 * (1 - l));
|
||||
}
|
||||
|
||||
return [hcg[0], s * 100, l * 100];
|
||||
};
|
||||
|
||||
convert.hcg.hwb = function (hcg) {
|
||||
var c = hcg[1] / 100;
|
||||
var g = hcg[2] / 100;
|
||||
var v = c + g * (1.0 - c);
|
||||
return [hcg[0], (v - c) * 100, (1 - v) * 100];
|
||||
};
|
||||
|
||||
convert.hwb.hcg = function (hwb) {
|
||||
var w = hwb[1] / 100;
|
||||
var b = hwb[2] / 100;
|
||||
var v = 1 - b;
|
||||
var c = v - w;
|
||||
var g = 0;
|
||||
|
||||
if (c < 1) {
|
||||
g = (v - c) / (1 - c);
|
||||
}
|
||||
|
||||
return [hwb[0], c * 100, g * 100];
|
||||
};
|
||||
|
||||
convert.apple.rgb = function (apple) {
|
||||
return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
|
||||
};
|
||||
|
||||
convert.rgb.apple = function (rgb) {
|
||||
return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
|
||||
};
|
||||
|
||||
convert.gray.rgb = function (args) {
|
||||
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
|
||||
};
|
||||
|
||||
convert.gray.hsl = convert.gray.hsv = function (args) {
|
||||
return [0, 0, args[0]];
|
||||
};
|
||||
|
||||
convert.gray.hwb = function (gray) {
|
||||
return [0, 100, gray[0]];
|
||||
};
|
||||
|
||||
convert.gray.cmyk = function (gray) {
|
||||
return [0, 0, 0, gray[0]];
|
||||
};
|
||||
|
||||
convert.gray.lab = function (gray) {
|
||||
return [gray[0], 0, 0];
|
||||
};
|
||||
|
||||
convert.gray.hex = function (gray) {
|
||||
var val = Math.round(gray[0] / 100 * 255) & 0xFF;
|
||||
var integer = (val << 16) + (val << 8) + val;
|
||||
|
||||
var string = integer.toString(16).toUpperCase();
|
||||
return '000000'.substring(string.length) + string;
|
||||
};
|
||||
|
||||
convert.rgb.gray = function (rgb) {
|
||||
var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
||||
return [val / 255 * 100];
|
||||
};
|
78
node_modules/npm-run-all/node_modules/color-convert/index.js
generated
vendored
Normal file
78
node_modules/npm-run-all/node_modules/color-convert/index.js
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
var conversions = require('./conversions');
|
||||
var route = require('./route');
|
||||
|
||||
var convert = {};
|
||||
|
||||
var models = Object.keys(conversions);
|
||||
|
||||
function wrapRaw(fn) {
|
||||
var wrappedFn = function (args) {
|
||||
if (args === undefined || args === null) {
|
||||
return args;
|
||||
}
|
||||
|
||||
if (arguments.length > 1) {
|
||||
args = Array.prototype.slice.call(arguments);
|
||||
}
|
||||
|
||||
return fn(args);
|
||||
};
|
||||
|
||||
// preserve .conversion property if there is one
|
||||
if ('conversion' in fn) {
|
||||
wrappedFn.conversion = fn.conversion;
|
||||
}
|
||||
|
||||
return wrappedFn;
|
||||
}
|
||||
|
||||
function wrapRounded(fn) {
|
||||
var wrappedFn = function (args) {
|
||||
if (args === undefined || args === null) {
|
||||
return args;
|
||||
}
|
||||
|
||||
if (arguments.length > 1) {
|
||||
args = Array.prototype.slice.call(arguments);
|
||||
}
|
||||
|
||||
var result = fn(args);
|
||||
|
||||
// we're assuming the result is an array here.
|
||||
// see notice in conversions.js; don't use box types
|
||||
// in conversion functions.
|
||||
if (typeof result === 'object') {
|
||||
for (var len = result.length, i = 0; i < len; i++) {
|
||||
result[i] = Math.round(result[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
// preserve .conversion property if there is one
|
||||
if ('conversion' in fn) {
|
||||
wrappedFn.conversion = fn.conversion;
|
||||
}
|
||||
|
||||
return wrappedFn;
|
||||
}
|
||||
|
||||
models.forEach(function (fromModel) {
|
||||
convert[fromModel] = {};
|
||||
|
||||
Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
|
||||
Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
|
||||
|
||||
var routes = route(fromModel);
|
||||
var routeModels = Object.keys(routes);
|
||||
|
||||
routeModels.forEach(function (toModel) {
|
||||
var fn = routes[toModel];
|
||||
|
||||
convert[fromModel][toModel] = wrapRounded(fn);
|
||||
convert[fromModel][toModel].raw = wrapRaw(fn);
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = convert;
|
46
node_modules/npm-run-all/node_modules/color-convert/package.json
generated
vendored
Normal file
46
node_modules/npm-run-all/node_modules/color-convert/package.json
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "color-convert",
|
||||
"description": "Plain color conversion functions",
|
||||
"version": "1.9.3",
|
||||
"author": "Heather Arthur <fayearthur@gmail.com>",
|
||||
"license": "MIT",
|
||||
"repository": "Qix-/color-convert",
|
||||
"scripts": {
|
||||
"pretest": "xo",
|
||||
"test": "node test/basic.js"
|
||||
},
|
||||
"keywords": [
|
||||
"color",
|
||||
"colour",
|
||||
"convert",
|
||||
"converter",
|
||||
"conversion",
|
||||
"rgb",
|
||||
"hsl",
|
||||
"hsv",
|
||||
"hwb",
|
||||
"cmyk",
|
||||
"ansi",
|
||||
"ansi16"
|
||||
],
|
||||
"files": [
|
||||
"index.js",
|
||||
"conversions.js",
|
||||
"css-keywords.js",
|
||||
"route.js"
|
||||
],
|
||||
"xo": {
|
||||
"rules": {
|
||||
"default-case": 0,
|
||||
"no-inline-comments": 0,
|
||||
"operator-linebreak": 0
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"chalk": "1.1.1",
|
||||
"xo": "0.11.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"color-name": "1.1.3"
|
||||
}
|
||||
}
|
97
node_modules/npm-run-all/node_modules/color-convert/route.js
generated
vendored
Normal file
97
node_modules/npm-run-all/node_modules/color-convert/route.js
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
var conversions = require('./conversions');
|
||||
|
||||
/*
|
||||
this function routes a model to all other models.
|
||||
|
||||
all functions that are routed have a property `.conversion` attached
|
||||
to the returned synthetic function. This property is an array
|
||||
of strings, each with the steps in between the 'from' and 'to'
|
||||
color models (inclusive).
|
||||
|
||||
conversions that are not possible simply are not included.
|
||||
*/
|
||||
|
||||
function buildGraph() {
|
||||
var graph = {};
|
||||
// https://jsperf.com/object-keys-vs-for-in-with-closure/3
|
||||
var models = Object.keys(conversions);
|
||||
|
||||
for (var len = models.length, i = 0; i < len; i++) {
|
||||
graph[models[i]] = {
|
||||
// http://jsperf.com/1-vs-infinity
|
||||
// micro-opt, but this is simple.
|
||||
distance: -1,
|
||||
parent: null
|
||||
};
|
||||
}
|
||||
|
||||
return graph;
|
||||
}
|
||||
|
||||
// https://en.wikipedia.org/wiki/Breadth-first_search
|
||||
function deriveBFS(fromModel) {
|
||||
var graph = buildGraph();
|
||||
var queue = [fromModel]; // unshift -> queue -> pop
|
||||
|
||||
graph[fromModel].distance = 0;
|
||||
|
||||
while (queue.length) {
|
||||
var current = queue.pop();
|
||||
var adjacents = Object.keys(conversions[current]);
|
||||
|
||||
for (var len = adjacents.length, i = 0; i < len; i++) {
|
||||
var adjacent = adjacents[i];
|
||||
var node = graph[adjacent];
|
||||
|
||||
if (node.distance === -1) {
|
||||
node.distance = graph[current].distance + 1;
|
||||
node.parent = current;
|
||||
queue.unshift(adjacent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return graph;
|
||||
}
|
||||
|
||||
function link(from, to) {
|
||||
return function (args) {
|
||||
return to(from(args));
|
||||
};
|
||||
}
|
||||
|
||||
function wrapConversion(toModel, graph) {
|
||||
var path = [graph[toModel].parent, toModel];
|
||||
var fn = conversions[graph[toModel].parent][toModel];
|
||||
|
||||
var cur = graph[toModel].parent;
|
||||
while (graph[cur].parent) {
|
||||
path.unshift(graph[cur].parent);
|
||||
fn = link(conversions[graph[cur].parent][cur], fn);
|
||||
cur = graph[cur].parent;
|
||||
}
|
||||
|
||||
fn.conversion = path;
|
||||
return fn;
|
||||
}
|
||||
|
||||
module.exports = function (fromModel) {
|
||||
var graph = deriveBFS(fromModel);
|
||||
var conversion = {};
|
||||
|
||||
var models = Object.keys(graph);
|
||||
for (var len = models.length, i = 0; i < len; i++) {
|
||||
var toModel = models[i];
|
||||
var node = graph[toModel];
|
||||
|
||||
if (node.parent === null) {
|
||||
// no possible conversion, or this node is the source model.
|
||||
continue;
|
||||
}
|
||||
|
||||
conversion[toModel] = wrapConversion(toModel, graph);
|
||||
}
|
||||
|
||||
return conversion;
|
||||
};
|
||||
|
43
node_modules/npm-run-all/node_modules/color-name/.eslintrc.json
generated
vendored
Normal file
43
node_modules/npm-run-all/node_modules/color-name/.eslintrc.json
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"node": true,
|
||||
"commonjs": true,
|
||||
"es6": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"rules": {
|
||||
"strict": 2,
|
||||
"indent": 0,
|
||||
"linebreak-style": 0,
|
||||
"quotes": 0,
|
||||
"semi": 0,
|
||||
"no-cond-assign": 1,
|
||||
"no-constant-condition": 1,
|
||||
"no-duplicate-case": 1,
|
||||
"no-empty": 1,
|
||||
"no-ex-assign": 1,
|
||||
"no-extra-boolean-cast": 1,
|
||||
"no-extra-semi": 1,
|
||||
"no-fallthrough": 1,
|
||||
"no-func-assign": 1,
|
||||
"no-global-assign": 1,
|
||||
"no-implicit-globals": 2,
|
||||
"no-inner-declarations": ["error", "functions"],
|
||||
"no-irregular-whitespace": 2,
|
||||
"no-loop-func": 1,
|
||||
"no-multi-str": 1,
|
||||
"no-mixed-spaces-and-tabs": 1,
|
||||
"no-proto": 1,
|
||||
"no-sequences": 1,
|
||||
"no-throw-literal": 1,
|
||||
"no-unmodified-loop-condition": 1,
|
||||
"no-useless-call": 1,
|
||||
"no-void": 1,
|
||||
"no-with": 2,
|
||||
"wrap-iife": 1,
|
||||
"no-redeclare": 1,
|
||||
"no-unused-vars": ["error", { "vars": "all", "args": "none" }],
|
||||
"no-sparse-arrays": 1
|
||||
}
|
||||
}
|
107
node_modules/npm-run-all/node_modules/color-name/.npmignore
generated
vendored
Normal file
107
node_modules/npm-run-all/node_modules/color-name/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
//this will affect all the git repos
|
||||
git config --global core.excludesfile ~/.gitignore
|
||||
|
||||
|
||||
//update files since .ignore won't if already tracked
|
||||
git rm --cached <file>
|
||||
|
||||
# Compiled source #
|
||||
###################
|
||||
*.com
|
||||
*.class
|
||||
*.dll
|
||||
*.exe
|
||||
*.o
|
||||
*.so
|
||||
|
||||
# Packages #
|
||||
############
|
||||
# it's better to unpack these files and commit the raw source
|
||||
# git has its own built in compression methods
|
||||
*.7z
|
||||
*.dmg
|
||||
*.gz
|
||||
*.iso
|
||||
*.jar
|
||||
*.rar
|
||||
*.tar
|
||||
*.zip
|
||||
|
||||
# Logs and databases #
|
||||
######################
|
||||
*.log
|
||||
*.sql
|
||||
*.sqlite
|
||||
|
||||
# OS generated files #
|
||||
######################
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
# Icon?
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
.cache
|
||||
.project
|
||||
.settings
|
||||
.tmproj
|
||||
*.esproj
|
||||
nbproject
|
||||
|
||||
# Numerous always-ignore extensions #
|
||||
#####################################
|
||||
*.diff
|
||||
*.err
|
||||
*.orig
|
||||
*.rej
|
||||
*.swn
|
||||
*.swo
|
||||
*.swp
|
||||
*.vi
|
||||
*~
|
||||
*.sass-cache
|
||||
*.grunt
|
||||
*.tmp
|
||||
|
||||
# Dreamweaver added files #
|
||||
###########################
|
||||
_notes
|
||||
dwsync.xml
|
||||
|
||||
# Komodo #
|
||||
###########################
|
||||
*.komodoproject
|
||||
.komodotools
|
||||
|
||||
# Node #
|
||||
#####################
|
||||
node_modules
|
||||
|
||||
# Bower #
|
||||
#####################
|
||||
bower_components
|
||||
|
||||
# Folders to ignore #
|
||||
#####################
|
||||
.hg
|
||||
.svn
|
||||
.CVS
|
||||
intermediate
|
||||
publish
|
||||
.idea
|
||||
.graphics
|
||||
_test
|
||||
_archive
|
||||
uploads
|
||||
tmp
|
||||
|
||||
# Vim files to ignore #
|
||||
#######################
|
||||
.VimballRecord
|
||||
.netrwhist
|
||||
|
||||
bundle.*
|
||||
|
||||
_demo
|
8
node_modules/npm-run-all/node_modules/color-name/LICENSE
generated
vendored
Normal file
8
node_modules/npm-run-all/node_modules/color-name/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
The MIT License (MIT)
|
||||
Copyright (c) 2015 Dmitry Ivanov
|
||||
|
||||
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.
|
11
node_modules/npm-run-all/node_modules/color-name/README.md
generated
vendored
Normal file
11
node_modules/npm-run-all/node_modules/color-name/README.md
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
A JSON with color names and its values. Based on http://dev.w3.org/csswg/css-color/#named-colors.
|
||||
|
||||
[](https://nodei.co/npm/color-name/)
|
||||
|
||||
|
||||
```js
|
||||
var colors = require('color-name');
|
||||
colors.red //[255,0,0]
|
||||
```
|
||||
|
||||
<a href="LICENSE"><img src="https://upload.wikimedia.org/wikipedia/commons/0/0c/MIT_logo.svg" width="120"/></a>
|
152
node_modules/npm-run-all/node_modules/color-name/index.js
generated
vendored
Normal file
152
node_modules/npm-run-all/node_modules/color-name/index.js
generated
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = {
|
||||
"aliceblue": [240, 248, 255],
|
||||
"antiquewhite": [250, 235, 215],
|
||||
"aqua": [0, 255, 255],
|
||||
"aquamarine": [127, 255, 212],
|
||||
"azure": [240, 255, 255],
|
||||
"beige": [245, 245, 220],
|
||||
"bisque": [255, 228, 196],
|
||||
"black": [0, 0, 0],
|
||||
"blanchedalmond": [255, 235, 205],
|
||||
"blue": [0, 0, 255],
|
||||
"blueviolet": [138, 43, 226],
|
||||
"brown": [165, 42, 42],
|
||||
"burlywood": [222, 184, 135],
|
||||
"cadetblue": [95, 158, 160],
|
||||
"chartreuse": [127, 255, 0],
|
||||
"chocolate": [210, 105, 30],
|
||||
"coral": [255, 127, 80],
|
||||
"cornflowerblue": [100, 149, 237],
|
||||
"cornsilk": [255, 248, 220],
|
||||
"crimson": [220, 20, 60],
|
||||
"cyan": [0, 255, 255],
|
||||
"darkblue": [0, 0, 139],
|
||||
"darkcyan": [0, 139, 139],
|
||||
"darkgoldenrod": [184, 134, 11],
|
||||
"darkgray": [169, 169, 169],
|
||||
"darkgreen": [0, 100, 0],
|
||||
"darkgrey": [169, 169, 169],
|
||||
"darkkhaki": [189, 183, 107],
|
||||
"darkmagenta": [139, 0, 139],
|
||||
"darkolivegreen": [85, 107, 47],
|
||||
"darkorange": [255, 140, 0],
|
||||
"darkorchid": [153, 50, 204],
|
||||
"darkred": [139, 0, 0],
|
||||
"darksalmon": [233, 150, 122],
|
||||
"darkseagreen": [143, 188, 143],
|
||||
"darkslateblue": [72, 61, 139],
|
||||
"darkslategray": [47, 79, 79],
|
||||
"darkslategrey": [47, 79, 79],
|
||||
"darkturquoise": [0, 206, 209],
|
||||
"darkviolet": [148, 0, 211],
|
||||
"deeppink": [255, 20, 147],
|
||||
"deepskyblue": [0, 191, 255],
|
||||
"dimgray": [105, 105, 105],
|
||||
"dimgrey": [105, 105, 105],
|
||||
"dodgerblue": [30, 144, 255],
|
||||
"firebrick": [178, 34, 34],
|
||||
"floralwhite": [255, 250, 240],
|
||||
"forestgreen": [34, 139, 34],
|
||||
"fuchsia": [255, 0, 255],
|
||||
"gainsboro": [220, 220, 220],
|
||||
"ghostwhite": [248, 248, 255],
|
||||
"gold": [255, 215, 0],
|
||||
"goldenrod": [218, 165, 32],
|
||||
"gray": [128, 128, 128],
|
||||
"green": [0, 128, 0],
|
||||
"greenyellow": [173, 255, 47],
|
||||
"grey": [128, 128, 128],
|
||||
"honeydew": [240, 255, 240],
|
||||
"hotpink": [255, 105, 180],
|
||||
"indianred": [205, 92, 92],
|
||||
"indigo": [75, 0, 130],
|
||||
"ivory": [255, 255, 240],
|
||||
"khaki": [240, 230, 140],
|
||||
"lavender": [230, 230, 250],
|
||||
"lavenderblush": [255, 240, 245],
|
||||
"lawngreen": [124, 252, 0],
|
||||
"lemonchiffon": [255, 250, 205],
|
||||
"lightblue": [173, 216, 230],
|
||||
"lightcoral": [240, 128, 128],
|
||||
"lightcyan": [224, 255, 255],
|
||||
"lightgoldenrodyellow": [250, 250, 210],
|
||||
"lightgray": [211, 211, 211],
|
||||
"lightgreen": [144, 238, 144],
|
||||
"lightgrey": [211, 211, 211],
|
||||
"lightpink": [255, 182, 193],
|
||||
"lightsalmon": [255, 160, 122],
|
||||
"lightseagreen": [32, 178, 170],
|
||||
"lightskyblue": [135, 206, 250],
|
||||
"lightslategray": [119, 136, 153],
|
||||
"lightslategrey": [119, 136, 153],
|
||||
"lightsteelblue": [176, 196, 222],
|
||||
"lightyellow": [255, 255, 224],
|
||||
"lime": [0, 255, 0],
|
||||
"limegreen": [50, 205, 50],
|
||||
"linen": [250, 240, 230],
|
||||
"magenta": [255, 0, 255],
|
||||
"maroon": [128, 0, 0],
|
||||
"mediumaquamarine": [102, 205, 170],
|
||||
"mediumblue": [0, 0, 205],
|
||||
"mediumorchid": [186, 85, 211],
|
||||
"mediumpurple": [147, 112, 219],
|
||||
"mediumseagreen": [60, 179, 113],
|
||||
"mediumslateblue": [123, 104, 238],
|
||||
"mediumspringgreen": [0, 250, 154],
|
||||
"mediumturquoise": [72, 209, 204],
|
||||
"mediumvioletred": [199, 21, 133],
|
||||
"midnightblue": [25, 25, 112],
|
||||
"mintcream": [245, 255, 250],
|
||||
"mistyrose": [255, 228, 225],
|
||||
"moccasin": [255, 228, 181],
|
||||
"navajowhite": [255, 222, 173],
|
||||
"navy": [0, 0, 128],
|
||||
"oldlace": [253, 245, 230],
|
||||
"olive": [128, 128, 0],
|
||||
"olivedrab": [107, 142, 35],
|
||||
"orange": [255, 165, 0],
|
||||
"orangered": [255, 69, 0],
|
||||
"orchid": [218, 112, 214],
|
||||
"palegoldenrod": [238, 232, 170],
|
||||
"palegreen": [152, 251, 152],
|
||||
"paleturquoise": [175, 238, 238],
|
||||
"palevioletred": [219, 112, 147],
|
||||
"papayawhip": [255, 239, 213],
|
||||
"peachpuff": [255, 218, 185],
|
||||
"peru": [205, 133, 63],
|
||||
"pink": [255, 192, 203],
|
||||
"plum": [221, 160, 221],
|
||||
"powderblue": [176, 224, 230],
|
||||
"purple": [128, 0, 128],
|
||||
"rebeccapurple": [102, 51, 153],
|
||||
"red": [255, 0, 0],
|
||||
"rosybrown": [188, 143, 143],
|
||||
"royalblue": [65, 105, 225],
|
||||
"saddlebrown": [139, 69, 19],
|
||||
"salmon": [250, 128, 114],
|
||||
"sandybrown": [244, 164, 96],
|
||||
"seagreen": [46, 139, 87],
|
||||
"seashell": [255, 245, 238],
|
||||
"sienna": [160, 82, 45],
|
||||
"silver": [192, 192, 192],
|
||||
"skyblue": [135, 206, 235],
|
||||
"slateblue": [106, 90, 205],
|
||||
"slategray": [112, 128, 144],
|
||||
"slategrey": [112, 128, 144],
|
||||
"snow": [255, 250, 250],
|
||||
"springgreen": [0, 255, 127],
|
||||
"steelblue": [70, 130, 180],
|
||||
"tan": [210, 180, 140],
|
||||
"teal": [0, 128, 128],
|
||||
"thistle": [216, 191, 216],
|
||||
"tomato": [255, 99, 71],
|
||||
"turquoise": [64, 224, 208],
|
||||
"violet": [238, 130, 238],
|
||||
"wheat": [245, 222, 179],
|
||||
"white": [255, 255, 255],
|
||||
"whitesmoke": [245, 245, 245],
|
||||
"yellow": [255, 255, 0],
|
||||
"yellowgreen": [154, 205, 50]
|
||||
};
|
25
node_modules/npm-run-all/node_modules/color-name/package.json
generated
vendored
Normal file
25
node_modules/npm-run-all/node_modules/color-name/package.json
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "color-name",
|
||||
"version": "1.1.3",
|
||||
"description": "A list of color names and its values",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "node test.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:dfcreative/color-name.git"
|
||||
},
|
||||
"keywords": [
|
||||
"color-name",
|
||||
"color",
|
||||
"color-keyword",
|
||||
"keyword"
|
||||
],
|
||||
"author": "DY <dfcreative@gmail.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/dfcreative/color-name/issues"
|
||||
},
|
||||
"homepage": "https://github.com/dfcreative/color-name"
|
||||
}
|
7
node_modules/npm-run-all/node_modules/color-name/test.js
generated
vendored
Normal file
7
node_modules/npm-run-all/node_modules/color-name/test.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
var names = require('./');
|
||||
var assert = require('assert');
|
||||
|
||||
assert.deepEqual(names.red, [255,0,0]);
|
||||
assert.deepEqual(names.aliceblue, [240,248,255]);
|
100
node_modules/npm-run-all/node_modules/cross-spawn/CHANGELOG.md
generated
vendored
Normal file
100
node_modules/npm-run-all/node_modules/cross-spawn/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
<a name="6.0.5"></a>
|
||||
## [6.0.5](https://github.com/moxystudio/node-cross-spawn/compare/v6.0.4...v6.0.5) (2018-03-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* avoid using deprecated Buffer constructor ([#94](https://github.com/moxystudio/node-cross-spawn/issues/94)) ([d5770df](https://github.com/moxystudio/node-cross-spawn/commit/d5770df)), closes [/nodejs.org/api/deprecations.html#deprecations_dep0005](https://github.com//nodejs.org/api/deprecations.html/issues/deprecations_dep0005)
|
||||
|
||||
|
||||
|
||||
<a name="6.0.4"></a>
|
||||
## [6.0.4](https://github.com/moxystudio/node-cross-spawn/compare/v6.0.3...v6.0.4) (2018-01-31)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix paths being incorrectly normalized on unix ([06ee3c6](https://github.com/moxystudio/node-cross-spawn/commit/06ee3c6)), closes [#90](https://github.com/moxystudio/node-cross-spawn/issues/90)
|
||||
|
||||
|
||||
|
||||
<a name="6.0.3"></a>
|
||||
## [6.0.3](https://github.com/moxystudio/node-cross-spawn/compare/v6.0.2...v6.0.3) (2018-01-23)
|
||||
|
||||
|
||||
|
||||
<a name="6.0.2"></a>
|
||||
## [6.0.2](https://github.com/moxystudio/node-cross-spawn/compare/v6.0.1...v6.0.2) (2018-01-23)
|
||||
|
||||
|
||||
|
||||
<a name="6.0.1"></a>
|
||||
## [6.0.1](https://github.com/moxystudio/node-cross-spawn/compare/v6.0.0...v6.0.1) (2018-01-23)
|
||||
|
||||
|
||||
|
||||
<a name="6.0.0"></a>
|
||||
# [6.0.0](https://github.com/moxystudio/node-cross-spawn/compare/5.1.0...6.0.0) (2018-01-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix certain arguments not being correctly escaped or causing batch syntax error ([900cf10](https://github.com/moxystudio/node-cross-spawn/commit/900cf10)), closes [#82](https://github.com/moxystudio/node-cross-spawn/issues/82) [#51](https://github.com/moxystudio/node-cross-spawn/issues/51)
|
||||
* fix commands as posix relatixe paths not working correctly, e.g.: `./my-command` ([900cf10](https://github.com/moxystudio/node-cross-spawn/commit/900cf10))
|
||||
* fix `options` argument being mutated ([900cf10](https://github.com/moxystudio/node-cross-spawn/commit/900cf10))
|
||||
* fix commands resolution when PATH was actually Path ([900cf10](https://github.com/moxystudio/node-cross-spawn/commit/900cf10))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* improve compliance with node's ENOENT errors ([900cf10](https://github.com/moxystudio/node-cross-spawn/commit/900cf10))
|
||||
* improve detection of node's shell option support ([900cf10](https://github.com/moxystudio/node-cross-spawn/commit/900cf10))
|
||||
|
||||
|
||||
### Chores
|
||||
|
||||
* upgrade tooling
|
||||
* upgrate project to es6 (node v4)
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* remove support for older nodejs versions, only `node >= 4` is supported
|
||||
|
||||
|
||||
<a name="5.1.0"></a>
|
||||
## [5.1.0](https://github.com/moxystudio/node-cross-spawn/compare/5.0.1...5.1.0) (2017-02-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix `options.shell` support for NodeJS [v4.8](https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V4.md#4.8.0)
|
||||
|
||||
|
||||
<a name="5.0.1"></a>
|
||||
## [5.0.1](https://github.com/moxystudio/node-cross-spawn/compare/5.0.0...5.0.1) (2016-11-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix `options.shell` support for NodeJS v7
|
||||
|
||||
|
||||
<a name="5.0.0"></a>
|
||||
# [5.0.0](https://github.com/moxystudio/node-cross-spawn/compare/4.0.2...5.0.0) (2016-10-30)
|
||||
|
||||
|
||||
## Features
|
||||
|
||||
* add support for `options.shell`
|
||||
* improve parsing of shebangs by using [`shebang-command`](https://github.com/kevva/shebang-command) module
|
||||
|
||||
|
||||
## Chores
|
||||
|
||||
* refactor some code to make it more clear
|
||||
* update README caveats
|
21
node_modules/npm-run-all/node_modules/cross-spawn/LICENSE
generated
vendored
Normal file
21
node_modules/npm-run-all/node_modules/cross-spawn/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 Made With MOXY Lda <hello@moxy.studio>
|
||||
|
||||
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.
|
94
node_modules/npm-run-all/node_modules/cross-spawn/README.md
generated
vendored
Normal file
94
node_modules/npm-run-all/node_modules/cross-spawn/README.md
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
# cross-spawn
|
||||
|
||||
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Build status][appveyor-image]][appveyor-url] [![Coverage Status][codecov-image]][codecov-url] [![Dependency status][david-dm-image]][david-dm-url] [![Dev Dependency status][david-dm-dev-image]][david-dm-dev-url] [![Greenkeeper badge][greenkeeper-image]][greenkeeper-url]
|
||||
|
||||
[npm-url]:https://npmjs.org/package/cross-spawn
|
||||
[downloads-image]:http://img.shields.io/npm/dm/cross-spawn.svg
|
||||
[npm-image]:http://img.shields.io/npm/v/cross-spawn.svg
|
||||
[travis-url]:https://travis-ci.org/moxystudio/node-cross-spawn
|
||||
[travis-image]:http://img.shields.io/travis/moxystudio/node-cross-spawn/master.svg
|
||||
[appveyor-url]:https://ci.appveyor.com/project/satazor/node-cross-spawn
|
||||
[appveyor-image]:https://img.shields.io/appveyor/ci/satazor/node-cross-spawn/master.svg
|
||||
[codecov-url]:https://codecov.io/gh/moxystudio/node-cross-spawn
|
||||
[codecov-image]:https://img.shields.io/codecov/c/github/moxystudio/node-cross-spawn/master.svg
|
||||
[david-dm-url]:https://david-dm.org/moxystudio/node-cross-spawn
|
||||
[david-dm-image]:https://img.shields.io/david/moxystudio/node-cross-spawn.svg
|
||||
[david-dm-dev-url]:https://david-dm.org/moxystudio/node-cross-spawn?type=dev
|
||||
[david-dm-dev-image]:https://img.shields.io/david/dev/moxystudio/node-cross-spawn.svg
|
||||
[greenkeeper-image]:https://badges.greenkeeper.io/moxystudio/node-cross-spawn.svg
|
||||
[greenkeeper-url]:https://greenkeeper.io/
|
||||
|
||||
A cross platform solution to node's spawn and spawnSync.
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
`$ npm install cross-spawn`
|
||||
|
||||
|
||||
## Why
|
||||
|
||||
Node has issues when using spawn on Windows:
|
||||
|
||||
- It ignores [PATHEXT](https://github.com/joyent/node/issues/2318)
|
||||
- It does not support [shebangs](https://en.wikipedia.org/wiki/Shebang_(Unix))
|
||||
- Has problems running commands with [spaces](https://github.com/nodejs/node/issues/7367)
|
||||
- Has problems running commands with posix relative paths (e.g.: `./my-folder/my-executable`)
|
||||
- Has an [issue](https://github.com/moxystudio/node-cross-spawn/issues/82) with command shims (files in `node_modules/.bin/`), where arguments with quotes and parenthesis would result in [invalid syntax error](https://github.com/moxystudio/node-cross-spawn/blob/e77b8f22a416db46b6196767bcd35601d7e11d54/test/index.test.js#L149)
|
||||
- No `options.shell` support on node `<v4.8`
|
||||
|
||||
All these issues are handled correctly by `cross-spawn`.
|
||||
There are some known modules, such as [win-spawn](https://github.com/ForbesLindesay/win-spawn), that try to solve this but they are either broken or provide faulty escaping of shell arguments.
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Exactly the same way as node's [`spawn`](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options) or [`spawnSync`](https://nodejs.org/api/child_process.html#child_process_child_process_spawnsync_command_args_options), so it's a drop in replacement.
|
||||
|
||||
|
||||
```js
|
||||
const spawn = require('cross-spawn');
|
||||
|
||||
// Spawn NPM asynchronously
|
||||
const child = spawn('npm', ['list', '-g', '-depth', '0'], { stdio: 'inherit' });
|
||||
|
||||
// Spawn NPM synchronously
|
||||
const result = spawn.sync('npm', ['list', '-g', '-depth', '0'], { stdio: 'inherit' });
|
||||
```
|
||||
|
||||
|
||||
## Caveats
|
||||
|
||||
### Using `options.shell` as an alternative to `cross-spawn`
|
||||
|
||||
Starting from node `v4.8`, `spawn` has a `shell` option that allows you run commands from within a shell. This new option solves
|
||||
the [PATHEXT](https://github.com/joyent/node/issues/2318) issue but:
|
||||
|
||||
- It's not supported in node `<v4.8`
|
||||
- You must manually escape the command and arguments which is very error prone, specially when passing user input
|
||||
- There are a lot of other unresolved issues from the [Why](#why) section that you must take into account
|
||||
|
||||
If you are using the `shell` option to spawn a command in a cross platform way, consider using `cross-spawn` instead. You have been warned.
|
||||
|
||||
### `options.shell` support
|
||||
|
||||
While `cross-spawn` adds support for `options.shell` in node `<v4.8`, all of its enhancements are disabled.
|
||||
|
||||
This mimics the Node.js behavior. More specifically, the command and its arguments will not be automatically escaped nor shebang support will be offered. This is by design because if you are using `options.shell` you are probably targeting a specific platform anyway and you don't want things to get into your way.
|
||||
|
||||
### Shebangs support
|
||||
|
||||
While `cross-spawn` handles shebangs on Windows, its support is limited. More specifically, it just supports `#!/usr/bin/env <program>` where `<program>` must not contain any arguments.
|
||||
If you would like to have the shebang support improved, feel free to contribute via a pull-request.
|
||||
|
||||
Remember to always test your code on Windows!
|
||||
|
||||
|
||||
## Tests
|
||||
|
||||
`$ npm test`
|
||||
`$ npm test -- --watch` during development
|
||||
|
||||
## License
|
||||
|
||||
Released under the [MIT License](http://www.opensource.org/licenses/mit-license.php).
|
39
node_modules/npm-run-all/node_modules/cross-spawn/index.js
generated
vendored
Normal file
39
node_modules/npm-run-all/node_modules/cross-spawn/index.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
'use strict';
|
||||
|
||||
const cp = require('child_process');
|
||||
const parse = require('./lib/parse');
|
||||
const enoent = require('./lib/enoent');
|
||||
|
||||
function spawn(command, args, options) {
|
||||
// Parse the arguments
|
||||
const parsed = parse(command, args, options);
|
||||
|
||||
// Spawn the child process
|
||||
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
||||
|
||||
// Hook into child process "exit" event to emit an error if the command
|
||||
// does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
|
||||
enoent.hookChildProcess(spawned, parsed);
|
||||
|
||||
return spawned;
|
||||
}
|
||||
|
||||
function spawnSync(command, args, options) {
|
||||
// Parse the arguments
|
||||
const parsed = parse(command, args, options);
|
||||
|
||||
// Spawn the child process
|
||||
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
||||
|
||||
// Analyze if the command does not exist, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
|
||||
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = spawn;
|
||||
module.exports.spawn = spawn;
|
||||
module.exports.sync = spawnSync;
|
||||
|
||||
module.exports._parse = parse;
|
||||
module.exports._enoent = enoent;
|
59
node_modules/npm-run-all/node_modules/cross-spawn/lib/enoent.js
generated
vendored
Normal file
59
node_modules/npm-run-all/node_modules/cross-spawn/lib/enoent.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
'use strict';
|
||||
|
||||
const isWin = process.platform === 'win32';
|
||||
|
||||
function notFoundError(original, syscall) {
|
||||
return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
|
||||
code: 'ENOENT',
|
||||
errno: 'ENOENT',
|
||||
syscall: `${syscall} ${original.command}`,
|
||||
path: original.command,
|
||||
spawnargs: original.args,
|
||||
});
|
||||
}
|
||||
|
||||
function hookChildProcess(cp, parsed) {
|
||||
if (!isWin) {
|
||||
return;
|
||||
}
|
||||
|
||||
const originalEmit = cp.emit;
|
||||
|
||||
cp.emit = function (name, arg1) {
|
||||
// If emitting "exit" event and exit code is 1, we need to check if
|
||||
// the command exists and emit an "error" instead
|
||||
// See https://github.com/IndigoUnited/node-cross-spawn/issues/16
|
||||
if (name === 'exit') {
|
||||
const err = verifyENOENT(arg1, parsed, 'spawn');
|
||||
|
||||
if (err) {
|
||||
return originalEmit.call(cp, 'error', err);
|
||||
}
|
||||
}
|
||||
|
||||
return originalEmit.apply(cp, arguments); // eslint-disable-line prefer-rest-params
|
||||
};
|
||||
}
|
||||
|
||||
function verifyENOENT(status, parsed) {
|
||||
if (isWin && status === 1 && !parsed.file) {
|
||||
return notFoundError(parsed.original, 'spawn');
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function verifyENOENTSync(status, parsed) {
|
||||
if (isWin && status === 1 && !parsed.file) {
|
||||
return notFoundError(parsed.original, 'spawnSync');
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
hookChildProcess,
|
||||
verifyENOENT,
|
||||
verifyENOENTSync,
|
||||
notFoundError,
|
||||
};
|
125
node_modules/npm-run-all/node_modules/cross-spawn/lib/parse.js
generated
vendored
Normal file
125
node_modules/npm-run-all/node_modules/cross-spawn/lib/parse.js
generated
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const niceTry = require('nice-try');
|
||||
const resolveCommand = require('./util/resolveCommand');
|
||||
const escape = require('./util/escape');
|
||||
const readShebang = require('./util/readShebang');
|
||||
const semver = require('semver');
|
||||
|
||||
const isWin = process.platform === 'win32';
|
||||
const isExecutableRegExp = /\.(?:com|exe)$/i;
|
||||
const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
||||
|
||||
// `options.shell` is supported in Node ^4.8.0, ^5.7.0 and >= 6.0.0
|
||||
const supportsShellOption = niceTry(() => semver.satisfies(process.version, '^4.8.0 || ^5.7.0 || >= 6.0.0', true)) || false;
|
||||
|
||||
function detectShebang(parsed) {
|
||||
parsed.file = resolveCommand(parsed);
|
||||
|
||||
const shebang = parsed.file && readShebang(parsed.file);
|
||||
|
||||
if (shebang) {
|
||||
parsed.args.unshift(parsed.file);
|
||||
parsed.command = shebang;
|
||||
|
||||
return resolveCommand(parsed);
|
||||
}
|
||||
|
||||
return parsed.file;
|
||||
}
|
||||
|
||||
function parseNonShell(parsed) {
|
||||
if (!isWin) {
|
||||
return parsed;
|
||||
}
|
||||
|
||||
// Detect & add support for shebangs
|
||||
const commandFile = detectShebang(parsed);
|
||||
|
||||
// We don't need a shell if the command filename is an executable
|
||||
const needsShell = !isExecutableRegExp.test(commandFile);
|
||||
|
||||
// If a shell is required, use cmd.exe and take care of escaping everything correctly
|
||||
// Note that `forceShell` is an hidden option used only in tests
|
||||
if (parsed.options.forceShell || needsShell) {
|
||||
// Need to double escape meta chars if the command is a cmd-shim located in `node_modules/.bin/`
|
||||
// The cmd-shim simply calls execute the package bin file with NodeJS, proxying any argument
|
||||
// Because the escape of metachars with ^ gets interpreted when the cmd.exe is first called,
|
||||
// we need to double escape them
|
||||
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
||||
|
||||
// Normalize posix paths into OS compatible paths (e.g.: foo/bar -> foo\bar)
|
||||
// This is necessary otherwise it will always fail with ENOENT in those cases
|
||||
parsed.command = path.normalize(parsed.command);
|
||||
|
||||
// Escape command & arguments
|
||||
parsed.command = escape.command(parsed.command);
|
||||
parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
|
||||
|
||||
const shellCommand = [parsed.command].concat(parsed.args).join(' ');
|
||||
|
||||
parsed.args = ['/d', '/s', '/c', `"${shellCommand}"`];
|
||||
parsed.command = process.env.comspec || 'cmd.exe';
|
||||
parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped
|
||||
}
|
||||
|
||||
return parsed;
|
||||
}
|
||||
|
||||
function parseShell(parsed) {
|
||||
// If node supports the shell option, there's no need to mimic its behavior
|
||||
if (supportsShellOption) {
|
||||
return parsed;
|
||||
}
|
||||
|
||||
// Mimic node shell option
|
||||
// See https://github.com/nodejs/node/blob/b9f6a2dc059a1062776133f3d4fd848c4da7d150/lib/child_process.js#L335
|
||||
const shellCommand = [parsed.command].concat(parsed.args).join(' ');
|
||||
|
||||
if (isWin) {
|
||||
parsed.command = typeof parsed.options.shell === 'string' ? parsed.options.shell : process.env.comspec || 'cmd.exe';
|
||||
parsed.args = ['/d', '/s', '/c', `"${shellCommand}"`];
|
||||
parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped
|
||||
} else {
|
||||
if (typeof parsed.options.shell === 'string') {
|
||||
parsed.command = parsed.options.shell;
|
||||
} else if (process.platform === 'android') {
|
||||
parsed.command = '/system/bin/sh';
|
||||
} else {
|
||||
parsed.command = '/bin/sh';
|
||||
}
|
||||
|
||||
parsed.args = ['-c', shellCommand];
|
||||
}
|
||||
|
||||
return parsed;
|
||||
}
|
||||
|
||||
function parse(command, args, options) {
|
||||
// Normalize arguments, similar to nodejs
|
||||
if (args && !Array.isArray(args)) {
|
||||
options = args;
|
||||
args = null;
|
||||
}
|
||||
|
||||
args = args ? args.slice(0) : []; // Clone array to avoid changing the original
|
||||
options = Object.assign({}, options); // Clone object to avoid changing the original
|
||||
|
||||
// Build our parsed object
|
||||
const parsed = {
|
||||
command,
|
||||
args,
|
||||
options,
|
||||
file: undefined,
|
||||
original: {
|
||||
command,
|
||||
args,
|
||||
},
|
||||
};
|
||||
|
||||
// Delegate further parsing to shell or non-shell
|
||||
return options.shell ? parseShell(parsed) : parseNonShell(parsed);
|
||||
}
|
||||
|
||||
module.exports = parse;
|
45
node_modules/npm-run-all/node_modules/cross-spawn/lib/util/escape.js
generated
vendored
Normal file
45
node_modules/npm-run-all/node_modules/cross-spawn/lib/util/escape.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
'use strict';
|
||||
|
||||
// See http://www.robvanderwoude.com/escapechars.php
|
||||
const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
||||
|
||||
function escapeCommand(arg) {
|
||||
// Escape meta chars
|
||||
arg = arg.replace(metaCharsRegExp, '^$1');
|
||||
|
||||
return arg;
|
||||
}
|
||||
|
||||
function escapeArgument(arg, doubleEscapeMetaChars) {
|
||||
// Convert to string
|
||||
arg = `${arg}`;
|
||||
|
||||
// Algorithm below is based on https://qntm.org/cmd
|
||||
|
||||
// Sequence of backslashes followed by a double quote:
|
||||
// double up all the backslashes and escape the double quote
|
||||
arg = arg.replace(/(\\*)"/g, '$1$1\\"');
|
||||
|
||||
// Sequence of backslashes followed by the end of the string
|
||||
// (which will become a double quote later):
|
||||
// double up all the backslashes
|
||||
arg = arg.replace(/(\\*)$/, '$1$1');
|
||||
|
||||
// All other backslashes occur literally
|
||||
|
||||
// Quote the whole thing:
|
||||
arg = `"${arg}"`;
|
||||
|
||||
// Escape meta chars
|
||||
arg = arg.replace(metaCharsRegExp, '^$1');
|
||||
|
||||
// Double escape meta chars if necessary
|
||||
if (doubleEscapeMetaChars) {
|
||||
arg = arg.replace(metaCharsRegExp, '^$1');
|
||||
}
|
||||
|
||||
return arg;
|
||||
}
|
||||
|
||||
module.exports.command = escapeCommand;
|
||||
module.exports.argument = escapeArgument;
|
32
node_modules/npm-run-all/node_modules/cross-spawn/lib/util/readShebang.js
generated
vendored
Normal file
32
node_modules/npm-run-all/node_modules/cross-spawn/lib/util/readShebang.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const shebangCommand = require('shebang-command');
|
||||
|
||||
function readShebang(command) {
|
||||
// Read the first 150 bytes from the file
|
||||
const size = 150;
|
||||
let buffer;
|
||||
|
||||
if (Buffer.alloc) {
|
||||
// Node.js v4.5+ / v5.10+
|
||||
buffer = Buffer.alloc(size);
|
||||
} else {
|
||||
// Old Node.js API
|
||||
buffer = new Buffer(size);
|
||||
buffer.fill(0); // zero-fill
|
||||
}
|
||||
|
||||
let fd;
|
||||
|
||||
try {
|
||||
fd = fs.openSync(command, 'r');
|
||||
fs.readSync(fd, buffer, 0, size, 0);
|
||||
fs.closeSync(fd);
|
||||
} catch (e) { /* Empty */ }
|
||||
|
||||
// Attempt to extract shebang (null is returned if not a shebang)
|
||||
return shebangCommand(buffer.toString());
|
||||
}
|
||||
|
||||
module.exports = readShebang;
|
47
node_modules/npm-run-all/node_modules/cross-spawn/lib/util/resolveCommand.js
generated
vendored
Normal file
47
node_modules/npm-run-all/node_modules/cross-spawn/lib/util/resolveCommand.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const which = require('which');
|
||||
const pathKey = require('path-key')();
|
||||
|
||||
function resolveCommandAttempt(parsed, withoutPathExt) {
|
||||
const cwd = process.cwd();
|
||||
const hasCustomCwd = parsed.options.cwd != null;
|
||||
|
||||
// If a custom `cwd` was specified, we need to change the process cwd
|
||||
// because `which` will do stat calls but does not support a custom cwd
|
||||
if (hasCustomCwd) {
|
||||
try {
|
||||
process.chdir(parsed.options.cwd);
|
||||
} catch (err) {
|
||||
/* Empty */
|
||||
}
|
||||
}
|
||||
|
||||
let resolved;
|
||||
|
||||
try {
|
||||
resolved = which.sync(parsed.command, {
|
||||
path: (parsed.options.env || process.env)[pathKey],
|
||||
pathExt: withoutPathExt ? path.delimiter : undefined,
|
||||
});
|
||||
} catch (e) {
|
||||
/* Empty */
|
||||
} finally {
|
||||
process.chdir(cwd);
|
||||
}
|
||||
|
||||
// If we successfully resolved, ensure that an absolute path is returned
|
||||
// Note that when a custom `cwd` was used, we need to resolve to an absolute path based on it
|
||||
if (resolved) {
|
||||
resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : '', resolved);
|
||||
}
|
||||
|
||||
return resolved;
|
||||
}
|
||||
|
||||
function resolveCommand(parsed) {
|
||||
return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
|
||||
}
|
||||
|
||||
module.exports = resolveCommand;
|
76
node_modules/npm-run-all/node_modules/cross-spawn/package.json
generated
vendored
Normal file
76
node_modules/npm-run-all/node_modules/cross-spawn/package.json
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
{
|
||||
"name": "cross-spawn",
|
||||
"version": "6.0.5",
|
||||
"description": "Cross platform child_process#spawn and child_process#spawnSync",
|
||||
"keywords": [
|
||||
"spawn",
|
||||
"spawnSync",
|
||||
"windows",
|
||||
"cross-platform",
|
||||
"path-ext",
|
||||
"shebang",
|
||||
"cmd",
|
||||
"execute"
|
||||
],
|
||||
"author": "André Cruz <andre@moxy.studio>",
|
||||
"homepage": "https://github.com/moxystudio/node-cross-spawn",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:moxystudio/node-cross-spawn.git"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"test": "jest --env node --coverage",
|
||||
"prerelease": "npm t && npm run lint",
|
||||
"release": "standard-version",
|
||||
"precommit": "lint-staged",
|
||||
"commitmsg": "commitlint -e $GIT_PARAMS"
|
||||
},
|
||||
"standard-version": {
|
||||
"scripts": {
|
||||
"posttag": "git push --follow-tags origin master && npm publish"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.js": [
|
||||
"eslint --fix",
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"commitlint": {
|
||||
"extends": [
|
||||
"@commitlint/config-conventional"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"nice-try": "^1.0.4",
|
||||
"path-key": "^2.0.1",
|
||||
"semver": "^5.5.0",
|
||||
"shebang-command": "^1.2.0",
|
||||
"which": "^1.2.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^6.0.0",
|
||||
"@commitlint/config-conventional": "^6.0.2",
|
||||
"babel-core": "^6.26.0",
|
||||
"babel-jest": "^22.1.0",
|
||||
"babel-preset-moxy": "^2.2.1",
|
||||
"eslint": "^4.3.0",
|
||||
"eslint-config-moxy": "^5.0.0",
|
||||
"husky": "^0.14.3",
|
||||
"jest": "^22.0.0",
|
||||
"lint-staged": "^7.0.0",
|
||||
"mkdirp": "^0.5.1",
|
||||
"regenerator-runtime": "^0.11.1",
|
||||
"rimraf": "^2.6.2",
|
||||
"standard-version": "^4.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.8"
|
||||
}
|
||||
}
|
13
node_modules/npm-run-all/node_modules/path-key/index.js
generated
vendored
Normal file
13
node_modules/npm-run-all/node_modules/path-key/index.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
module.exports = opts => {
|
||||
opts = opts || {};
|
||||
|
||||
const env = opts.env || process.env;
|
||||
const platform = opts.platform || process.platform;
|
||||
|
||||
if (platform !== 'win32') {
|
||||
return 'PATH';
|
||||
}
|
||||
|
||||
return Object.keys(env).find(x => x.toUpperCase() === 'PATH') || 'Path';
|
||||
};
|
21
node_modules/npm-run-all/node_modules/path-key/license
generated
vendored
Normal file
21
node_modules/npm-run-all/node_modules/path-key/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
39
node_modules/npm-run-all/node_modules/path-key/package.json
generated
vendored
Normal file
39
node_modules/npm-run-all/node_modules/path-key/package.json
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "path-key",
|
||||
"version": "2.0.1",
|
||||
"description": "Get the PATH environment variable key cross-platform",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/path-key",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"path",
|
||||
"key",
|
||||
"environment",
|
||||
"env",
|
||||
"variable",
|
||||
"var",
|
||||
"get",
|
||||
"cross-platform",
|
||||
"windows"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"xo": {
|
||||
"esnext": true
|
||||
}
|
||||
}
|
51
node_modules/npm-run-all/node_modules/path-key/readme.md
generated
vendored
Normal file
51
node_modules/npm-run-all/node_modules/path-key/readme.md
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
# path-key [](https://travis-ci.org/sindresorhus/path-key)
|
||||
|
||||
> Get the [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) environment variable key cross-platform
|
||||
|
||||
It's usually `PATH`, but on Windows it can be any casing like `Path`...
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save path-key
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const pathKey = require('path-key');
|
||||
|
||||
const key = pathKey();
|
||||
//=> 'PATH'
|
||||
|
||||
const PATH = process.env[key];
|
||||
//=> '/usr/local/bin:/usr/bin:/bin'
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### pathKey([options])
|
||||
|
||||
#### options
|
||||
|
||||
##### env
|
||||
|
||||
Type: `Object`<br>
|
||||
Default: [`process.env`](https://nodejs.org/api/process.html#process_process_env)
|
||||
|
||||
Use a custom environment variables object.
|
||||
|
||||
#### platform
|
||||
|
||||
Type: `string`<br>
|
||||
Default: [`process.platform`](https://nodejs.org/api/process.html#process_process_platform)
|
||||
|
||||
Get the PATH key for a specific platform.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
15
node_modules/npm-run-all/node_modules/semver/LICENSE
generated
vendored
Normal file
15
node_modules/npm-run-all/node_modules/semver/LICENSE
generated
vendored
Normal file
@@ -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.
|
412
node_modules/npm-run-all/node_modules/semver/README.md
generated
vendored
Normal file
412
node_modules/npm-run-all/node_modules/semver/README.md
generated
vendored
Normal file
@@ -0,0 +1,412 @@
|
||||
semver(1) -- The semantic versioner for npm
|
||||
===========================================
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm install --save semver
|
||||
````
|
||||
|
||||
## Usage
|
||||
|
||||
As a node module:
|
||||
|
||||
```js
|
||||
const semver = require('semver')
|
||||
|
||||
semver.valid('1.2.3') // '1.2.3'
|
||||
semver.valid('a.b.c') // null
|
||||
semver.clean(' =v1.2.3 ') // '1.2.3'
|
||||
semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true
|
||||
semver.gt('1.2.3', '9.8.7') // false
|
||||
semver.lt('1.2.3', '9.8.7') // true
|
||||
semver.minVersion('>=1.0.0') // '1.0.0'
|
||||
semver.valid(semver.coerce('v2')) // '2.0.0'
|
||||
semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7'
|
||||
```
|
||||
|
||||
As a command-line utility:
|
||||
|
||||
```
|
||||
$ semver -h
|
||||
|
||||
A JavaScript implementation of the https://semver.org/ specification
|
||||
Copyright Isaac Z. Schlueter
|
||||
|
||||
Usage: semver [options] <version> [<version> [...]]
|
||||
Prints valid versions sorted by SemVer precedence
|
||||
|
||||
Options:
|
||||
-r --range <range>
|
||||
Print versions that match the specified range.
|
||||
|
||||
-i --increment [<level>]
|
||||
Increment a version by the specified level. Level can
|
||||
be one of: major, minor, patch, premajor, preminor,
|
||||
prepatch, or prerelease. Default level is 'patch'.
|
||||
Only one version may be specified.
|
||||
|
||||
--preid <identifier>
|
||||
Identifier to be used to prefix premajor, preminor,
|
||||
prepatch or prerelease version increments.
|
||||
|
||||
-l --loose
|
||||
Interpret versions and ranges loosely
|
||||
|
||||
-p --include-prerelease
|
||||
Always include prerelease versions in range matching
|
||||
|
||||
-c --coerce
|
||||
Coerce a string into SemVer if possible
|
||||
(does not imply --loose)
|
||||
|
||||
Program exits successfully if any valid version satisfies
|
||||
all supplied ranges, and prints all satisfying versions.
|
||||
|
||||
If no satisfying versions are found, then exits failure.
|
||||
|
||||
Versions are printed in ascending order, so supplying
|
||||
multiple versions to the utility will just sort them.
|
||||
```
|
||||
|
||||
## Versions
|
||||
|
||||
A "version" is described by the `v2.0.0` specification found at
|
||||
<https://semver.org/>.
|
||||
|
||||
A leading `"="` or `"v"` character is stripped off and ignored.
|
||||
|
||||
## Ranges
|
||||
|
||||
A `version range` is a set of `comparators` which specify versions
|
||||
that satisfy the range.
|
||||
|
||||
A `comparator` is composed of an `operator` and a `version`. The set
|
||||
of primitive `operators` is:
|
||||
|
||||
* `<` Less than
|
||||
* `<=` Less than or equal to
|
||||
* `>` Greater than
|
||||
* `>=` Greater than or equal to
|
||||
* `=` Equal. If no operator is specified, then equality is assumed,
|
||||
so this operator is optional, but MAY be included.
|
||||
|
||||
For example, the comparator `>=1.2.7` would match the versions
|
||||
`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6`
|
||||
or `1.1.0`.
|
||||
|
||||
Comparators can be joined by whitespace to form a `comparator set`,
|
||||
which is satisfied by the **intersection** of all of the comparators
|
||||
it includes.
|
||||
|
||||
A range is composed of one or more comparator sets, joined by `||`. A
|
||||
version matches a range if and only if every comparator in at least
|
||||
one of the `||`-separated comparator sets is satisfied by the version.
|
||||
|
||||
For example, the range `>=1.2.7 <1.3.0` would match the versions
|
||||
`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`,
|
||||
or `1.1.0`.
|
||||
|
||||
The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`,
|
||||
`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`.
|
||||
|
||||
### Prerelease Tags
|
||||
|
||||
If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then
|
||||
it will only be allowed to satisfy comparator sets if at least one
|
||||
comparator with the same `[major, minor, patch]` tuple also has a
|
||||
prerelease tag.
|
||||
|
||||
For example, the range `>1.2.3-alpha.3` would be allowed to match the
|
||||
version `1.2.3-alpha.7`, but it would *not* be satisfied by
|
||||
`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater
|
||||
than" `1.2.3-alpha.3` according to the SemVer sort rules. The version
|
||||
range only accepts prerelease tags on the `1.2.3` version. The
|
||||
version `3.4.5` *would* satisfy the range, because it does not have a
|
||||
prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`.
|
||||
|
||||
The purpose for this behavior is twofold. First, prerelease versions
|
||||
frequently are updated very quickly, and contain many breaking changes
|
||||
that are (by the author's design) not yet fit for public consumption.
|
||||
Therefore, by default, they are excluded from range matching
|
||||
semantics.
|
||||
|
||||
Second, a user who has opted into using a prerelease version has
|
||||
clearly indicated the intent to use *that specific* set of
|
||||
alpha/beta/rc versions. By including a prerelease tag in the range,
|
||||
the user is indicating that they are aware of the risk. However, it
|
||||
is still not appropriate to assume that they have opted into taking a
|
||||
similar risk on the *next* set of prerelease versions.
|
||||
|
||||
Note that this behavior can be suppressed (treating all prerelease
|
||||
versions as if they were normal versions, for the purpose of range
|
||||
matching) by setting the `includePrerelease` flag on the options
|
||||
object to any
|
||||
[functions](https://github.com/npm/node-semver#functions) that do
|
||||
range matching.
|
||||
|
||||
#### Prerelease Identifiers
|
||||
|
||||
The method `.inc` takes an additional `identifier` string argument that
|
||||
will append the value of the string as a prerelease identifier:
|
||||
|
||||
```javascript
|
||||
semver.inc('1.2.3', 'prerelease', 'beta')
|
||||
// '1.2.4-beta.0'
|
||||
```
|
||||
|
||||
command-line example:
|
||||
|
||||
```bash
|
||||
$ semver 1.2.3 -i prerelease --preid beta
|
||||
1.2.4-beta.0
|
||||
```
|
||||
|
||||
Which then can be used to increment further:
|
||||
|
||||
```bash
|
||||
$ semver 1.2.4-beta.0 -i prerelease
|
||||
1.2.4-beta.1
|
||||
```
|
||||
|
||||
### Advanced Range Syntax
|
||||
|
||||
Advanced range syntax desugars to primitive comparators in
|
||||
deterministic ways.
|
||||
|
||||
Advanced ranges may be combined in the same way as primitive
|
||||
comparators using white space or `||`.
|
||||
|
||||
#### Hyphen Ranges `X.Y.Z - A.B.C`
|
||||
|
||||
Specifies an inclusive set.
|
||||
|
||||
* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4`
|
||||
|
||||
If a partial version is provided as the first version in the inclusive
|
||||
range, then the missing pieces are replaced with zeroes.
|
||||
|
||||
* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4`
|
||||
|
||||
If a partial version is provided as the second version in the
|
||||
inclusive range, then all versions that start with the supplied parts
|
||||
of the tuple are accepted, but nothing that would be greater than the
|
||||
provided tuple parts.
|
||||
|
||||
* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0`
|
||||
* `1.2.3 - 2` := `>=1.2.3 <3.0.0`
|
||||
|
||||
#### X-Ranges `1.2.x` `1.X` `1.2.*` `*`
|
||||
|
||||
Any of `X`, `x`, or `*` may be used to "stand in" for one of the
|
||||
numeric values in the `[major, minor, patch]` tuple.
|
||||
|
||||
* `*` := `>=0.0.0` (Any version satisfies)
|
||||
* `1.x` := `>=1.0.0 <2.0.0` (Matching major version)
|
||||
* `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions)
|
||||
|
||||
A partial version range is treated as an X-Range, so the special
|
||||
character is in fact optional.
|
||||
|
||||
* `""` (empty string) := `*` := `>=0.0.0`
|
||||
* `1` := `1.x.x` := `>=1.0.0 <2.0.0`
|
||||
* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0`
|
||||
|
||||
#### Tilde Ranges `~1.2.3` `~1.2` `~1`
|
||||
|
||||
Allows patch-level changes if a minor version is specified on the
|
||||
comparator. Allows minor-level changes if not.
|
||||
|
||||
* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0`
|
||||
* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`)
|
||||
* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`)
|
||||
* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0`
|
||||
* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`)
|
||||
* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`)
|
||||
* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in
|
||||
the `1.2.3` version will be allowed, if they are greater than or
|
||||
equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but
|
||||
`1.2.4-beta.2` would not, because it is a prerelease of a
|
||||
different `[major, minor, patch]` tuple.
|
||||
|
||||
#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4`
|
||||
|
||||
Allows changes that do not modify the left-most non-zero digit in the
|
||||
`[major, minor, patch]` tuple. In other words, this allows patch and
|
||||
minor updates for versions `1.0.0` and above, patch updates for
|
||||
versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`.
|
||||
|
||||
Many authors treat a `0.x` version as if the `x` were the major
|
||||
"breaking-change" indicator.
|
||||
|
||||
Caret ranges are ideal when an author may make breaking changes
|
||||
between `0.2.4` and `0.3.0` releases, which is a common practice.
|
||||
However, it presumes that there will *not* be breaking changes between
|
||||
`0.2.4` and `0.2.5`. It allows for changes that are presumed to be
|
||||
additive (but non-breaking), according to commonly observed practices.
|
||||
|
||||
* `^1.2.3` := `>=1.2.3 <2.0.0`
|
||||
* `^0.2.3` := `>=0.2.3 <0.3.0`
|
||||
* `^0.0.3` := `>=0.0.3 <0.0.4`
|
||||
* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in
|
||||
the `1.2.3` version will be allowed, if they are greater than or
|
||||
equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but
|
||||
`1.2.4-beta.2` would not, because it is a prerelease of a
|
||||
different `[major, minor, patch]` tuple.
|
||||
* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4` Note that prereleases in the
|
||||
`0.0.3` version *only* will be allowed, if they are greater than or
|
||||
equal to `beta`. So, `0.0.3-pr.2` would be allowed.
|
||||
|
||||
When parsing caret ranges, a missing `patch` value desugars to the
|
||||
number `0`, but will allow flexibility within that value, even if the
|
||||
major and minor versions are both `0`.
|
||||
|
||||
* `^1.2.x` := `>=1.2.0 <2.0.0`
|
||||
* `^0.0.x` := `>=0.0.0 <0.1.0`
|
||||
* `^0.0` := `>=0.0.0 <0.1.0`
|
||||
|
||||
A missing `minor` and `patch` values will desugar to zero, but also
|
||||
allow flexibility within those values, even if the major version is
|
||||
zero.
|
||||
|
||||
* `^1.x` := `>=1.0.0 <2.0.0`
|
||||
* `^0.x` := `>=0.0.0 <1.0.0`
|
||||
|
||||
### Range Grammar
|
||||
|
||||
Putting all this together, here is a Backus-Naur grammar for ranges,
|
||||
for the benefit of parser authors:
|
||||
|
||||
```bnf
|
||||
range-set ::= range ( logical-or range ) *
|
||||
logical-or ::= ( ' ' ) * '||' ( ' ' ) *
|
||||
range ::= hyphen | simple ( ' ' simple ) * | ''
|
||||
hyphen ::= partial ' - ' partial
|
||||
simple ::= primitive | partial | tilde | caret
|
||||
primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial
|
||||
partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )?
|
||||
xr ::= 'x' | 'X' | '*' | nr
|
||||
nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) *
|
||||
tilde ::= '~' partial
|
||||
caret ::= '^' partial
|
||||
qualifier ::= ( '-' pre )? ( '+' build )?
|
||||
pre ::= parts
|
||||
build ::= parts
|
||||
parts ::= part ( '.' part ) *
|
||||
part ::= nr | [-0-9A-Za-z]+
|
||||
```
|
||||
|
||||
## Functions
|
||||
|
||||
All methods and classes take a final `options` object argument. All
|
||||
options in this object are `false` by default. The options supported
|
||||
are:
|
||||
|
||||
- `loose` Be more forgiving about not-quite-valid semver strings.
|
||||
(Any resulting output will always be 100% strict compliant, of
|
||||
course.) For backwards compatibility reasons, if the `options`
|
||||
argument is a boolean value instead of an object, it is interpreted
|
||||
to be the `loose` param.
|
||||
- `includePrerelease` Set to suppress the [default
|
||||
behavior](https://github.com/npm/node-semver#prerelease-tags) of
|
||||
excluding prerelease tagged versions from ranges unless they are
|
||||
explicitly opted into.
|
||||
|
||||
Strict-mode Comparators and Ranges will be strict about the SemVer
|
||||
strings that they parse.
|
||||
|
||||
* `valid(v)`: Return the parsed version, or null if it's not valid.
|
||||
* `inc(v, release)`: Return the version incremented by the release
|
||||
type (`major`, `premajor`, `minor`, `preminor`, `patch`,
|
||||
`prepatch`, or `prerelease`), or null if it's not valid
|
||||
* `premajor` in one call will bump the version up to the next major
|
||||
version and down to a prerelease of that major version.
|
||||
`preminor`, and `prepatch` work the same way.
|
||||
* If called from a non-prerelease version, the `prerelease` will work the
|
||||
same as `prepatch`. It increments the patch version, then makes a
|
||||
prerelease. If the input version is already a prerelease it simply
|
||||
increments it.
|
||||
* `prerelease(v)`: Returns an array of prerelease components, or null
|
||||
if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]`
|
||||
* `major(v)`: Return the major version number.
|
||||
* `minor(v)`: Return the minor version number.
|
||||
* `patch(v)`: Return the patch version number.
|
||||
* `intersects(r1, r2, loose)`: Return true if the two supplied ranges
|
||||
or comparators intersect.
|
||||
* `parse(v)`: Attempt to parse a string as a semantic version, returning either
|
||||
a `SemVer` object or `null`.
|
||||
|
||||
### Comparison
|
||||
|
||||
* `gt(v1, v2)`: `v1 > v2`
|
||||
* `gte(v1, v2)`: `v1 >= v2`
|
||||
* `lt(v1, v2)`: `v1 < v2`
|
||||
* `lte(v1, v2)`: `v1 <= v2`
|
||||
* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent,
|
||||
even if they're not the exact same string. You already know how to
|
||||
compare strings.
|
||||
* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`.
|
||||
* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call
|
||||
the corresponding function above. `"==="` and `"!=="` do simple
|
||||
string comparison, but are included for completeness. Throws if an
|
||||
invalid comparison string is provided.
|
||||
* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if
|
||||
`v2` is greater. Sorts in ascending order if passed to `Array.sort()`.
|
||||
* `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions
|
||||
in descending order when passed to `Array.sort()`.
|
||||
* `diff(v1, v2)`: Returns difference between two versions by the release type
|
||||
(`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`),
|
||||
or null if the versions are the same.
|
||||
|
||||
### Comparators
|
||||
|
||||
* `intersects(comparator)`: Return true if the comparators intersect
|
||||
|
||||
### Ranges
|
||||
|
||||
* `validRange(range)`: Return the valid range or null if it's not valid
|
||||
* `satisfies(version, range)`: Return true if the version satisfies the
|
||||
range.
|
||||
* `maxSatisfying(versions, range)`: Return the highest version in the list
|
||||
that satisfies the range, or `null` if none of them do.
|
||||
* `minSatisfying(versions, range)`: Return the lowest version in the list
|
||||
that satisfies the range, or `null` if none of them do.
|
||||
* `minVersion(range)`: Return the lowest version that can possibly match
|
||||
the given range.
|
||||
* `gtr(version, range)`: Return `true` if version is greater than all the
|
||||
versions possible in the range.
|
||||
* `ltr(version, range)`: Return `true` if version is less than all the
|
||||
versions possible in the range.
|
||||
* `outside(version, range, hilo)`: Return true if the version is outside
|
||||
the bounds of the range in either the high or low direction. The
|
||||
`hilo` argument must be either the string `'>'` or `'<'`. (This is
|
||||
the function called by `gtr` and `ltr`.)
|
||||
* `intersects(range)`: Return true if any of the ranges comparators intersect
|
||||
|
||||
Note that, since ranges may be non-contiguous, a version might not be
|
||||
greater than a range, less than a range, *or* satisfy a range! For
|
||||
example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9`
|
||||
until `2.0.0`, so the version `1.2.10` would not be greater than the
|
||||
range (because `2.0.1` satisfies, which is higher), nor less than the
|
||||
range (since `1.2.8` satisfies, which is lower), and it also does not
|
||||
satisfy the range.
|
||||
|
||||
If you want to know if a version satisfies or does not satisfy a
|
||||
range, use the `satisfies(version, range)` function.
|
||||
|
||||
### Coercion
|
||||
|
||||
* `coerce(version)`: Coerces a string to semver if possible
|
||||
|
||||
This aims to provide a very forgiving translation of a non-semver string to
|
||||
semver. It looks for the first digit in a string, and consumes all
|
||||
remaining characters which satisfy at least a partial semver (e.g., `1`,
|
||||
`1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer
|
||||
versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All
|
||||
surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes
|
||||
`3.4.0`). Only text which lacks digits will fail coercion (`version one`
|
||||
is not valid). The maximum length for any semver component considered for
|
||||
coercion is 16 characters; longer components will be ignored
|
||||
(`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any
|
||||
semver component is `Number.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value
|
||||
components are invalid (`9999999999999999.4.7.4` is likely invalid).
|
160
node_modules/npm-run-all/node_modules/semver/bin/semver
generated
vendored
Executable file
160
node_modules/npm-run-all/node_modules/semver/bin/semver
generated
vendored
Executable file
@@ -0,0 +1,160 @@
|
||||
#!/usr/bin/env node
|
||||
// Standalone semver comparison program.
|
||||
// Exits successfully and prints matching version(s) if
|
||||
// any supplied version is valid and passes all tests.
|
||||
|
||||
var argv = process.argv.slice(2)
|
||||
|
||||
var versions = []
|
||||
|
||||
var range = []
|
||||
|
||||
var inc = null
|
||||
|
||||
var version = require('../package.json').version
|
||||
|
||||
var loose = false
|
||||
|
||||
var includePrerelease = false
|
||||
|
||||
var coerce = false
|
||||
|
||||
var identifier
|
||||
|
||||
var semver = require('../semver')
|
||||
|
||||
var reverse = false
|
||||
|
||||
var options = {}
|
||||
|
||||
main()
|
||||
|
||||
function main () {
|
||||
if (!argv.length) return help()
|
||||
while (argv.length) {
|
||||
var a = argv.shift()
|
||||
var indexOfEqualSign = a.indexOf('=')
|
||||
if (indexOfEqualSign !== -1) {
|
||||
a = a.slice(0, indexOfEqualSign)
|
||||
argv.unshift(a.slice(indexOfEqualSign + 1))
|
||||
}
|
||||
switch (a) {
|
||||
case '-rv': case '-rev': case '--rev': case '--reverse':
|
||||
reverse = true
|
||||
break
|
||||
case '-l': case '--loose':
|
||||
loose = true
|
||||
break
|
||||
case '-p': case '--include-prerelease':
|
||||
includePrerelease = true
|
||||
break
|
||||
case '-v': case '--version':
|
||||
versions.push(argv.shift())
|
||||
break
|
||||
case '-i': case '--inc': case '--increment':
|
||||
switch (argv[0]) {
|
||||
case 'major': case 'minor': case 'patch': case 'prerelease':
|
||||
case 'premajor': case 'preminor': case 'prepatch':
|
||||
inc = argv.shift()
|
||||
break
|
||||
default:
|
||||
inc = 'patch'
|
||||
break
|
||||
}
|
||||
break
|
||||
case '--preid':
|
||||
identifier = argv.shift()
|
||||
break
|
||||
case '-r': case '--range':
|
||||
range.push(argv.shift())
|
||||
break
|
||||
case '-c': case '--coerce':
|
||||
coerce = true
|
||||
break
|
||||
case '-h': case '--help': case '-?':
|
||||
return help()
|
||||
default:
|
||||
versions.push(a)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
var options = { loose: loose, includePrerelease: includePrerelease }
|
||||
|
||||
versions = versions.map(function (v) {
|
||||
return coerce ? (semver.coerce(v) || { version: v }).version : v
|
||||
}).filter(function (v) {
|
||||
return semver.valid(v)
|
||||
})
|
||||
if (!versions.length) return fail()
|
||||
if (inc && (versions.length !== 1 || range.length)) { return failInc() }
|
||||
|
||||
for (var i = 0, l = range.length; i < l; i++) {
|
||||
versions = versions.filter(function (v) {
|
||||
return semver.satisfies(v, range[i], options)
|
||||
})
|
||||
if (!versions.length) return fail()
|
||||
}
|
||||
return success(versions)
|
||||
}
|
||||
|
||||
function failInc () {
|
||||
console.error('--inc can only be used on a single version with no range')
|
||||
fail()
|
||||
}
|
||||
|
||||
function fail () { process.exit(1) }
|
||||
|
||||
function success () {
|
||||
var compare = reverse ? 'rcompare' : 'compare'
|
||||
versions.sort(function (a, b) {
|
||||
return semver[compare](a, b, options)
|
||||
}).map(function (v) {
|
||||
return semver.clean(v, options)
|
||||
}).map(function (v) {
|
||||
return inc ? semver.inc(v, inc, options, identifier) : v
|
||||
}).forEach(function (v, i, _) { console.log(v) })
|
||||
}
|
||||
|
||||
function help () {
|
||||
console.log(['SemVer ' + version,
|
||||
'',
|
||||
'A JavaScript implementation of the https://semver.org/ specification',
|
||||
'Copyright Isaac Z. Schlueter',
|
||||
'',
|
||||
'Usage: semver [options] <version> [<version> [...]]',
|
||||
'Prints valid versions sorted by SemVer precedence',
|
||||
'',
|
||||
'Options:',
|
||||
'-r --range <range>',
|
||||
' Print versions that match the specified range.',
|
||||
'',
|
||||
'-i --increment [<level>]',
|
||||
' Increment a version by the specified level. Level can',
|
||||
' be one of: major, minor, patch, premajor, preminor,',
|
||||
" prepatch, or prerelease. Default level is 'patch'.",
|
||||
' Only one version may be specified.',
|
||||
'',
|
||||
'--preid <identifier>',
|
||||
' Identifier to be used to prefix premajor, preminor,',
|
||||
' prepatch or prerelease version increments.',
|
||||
'',
|
||||
'-l --loose',
|
||||
' Interpret versions and ranges loosely',
|
||||
'',
|
||||
'-p --include-prerelease',
|
||||
' Always include prerelease versions in range matching',
|
||||
'',
|
||||
'-c --coerce',
|
||||
' Coerce a string into SemVer if possible',
|
||||
' (does not imply --loose)',
|
||||
'',
|
||||
'Program exits successfully if any valid version satisfies',
|
||||
'all supplied ranges, and prints all satisfying versions.',
|
||||
'',
|
||||
'If no satisfying versions are found, then exits failure.',
|
||||
'',
|
||||
'Versions are printed in ascending order, so supplying',
|
||||
'multiple versions to the utility will just sort them.'
|
||||
].join('\n'))
|
||||
}
|
38
node_modules/npm-run-all/node_modules/semver/package.json
generated
vendored
Normal file
38
node_modules/npm-run-all/node_modules/semver/package.json
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "semver",
|
||||
"version": "5.7.2",
|
||||
"description": "The semantic version parser used by npm.",
|
||||
"main": "semver.js",
|
||||
"scripts": {
|
||||
"test": "tap test/ --100 --timeout=30",
|
||||
"lint": "echo linting disabled",
|
||||
"postlint": "template-oss-check",
|
||||
"template-oss-apply": "template-oss-apply --force",
|
||||
"lintfix": "npm run lint -- --fix",
|
||||
"snap": "tap test/ --100 --timeout=30",
|
||||
"posttest": "npm run lint"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@npmcli/template-oss": "4.17.0",
|
||||
"tap": "^12.7.0"
|
||||
},
|
||||
"license": "ISC",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/npm/node-semver.git"
|
||||
},
|
||||
"bin": {
|
||||
"semver": "./bin/semver"
|
||||
},
|
||||
"files": [
|
||||
"bin",
|
||||
"range.bnf",
|
||||
"semver.js"
|
||||
],
|
||||
"author": "GitHub Inc.",
|
||||
"templateOSS": {
|
||||
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
|
||||
"content": "./scripts/template-oss",
|
||||
"version": "4.17.0"
|
||||
}
|
||||
}
|
16
node_modules/npm-run-all/node_modules/semver/range.bnf
generated
vendored
Normal file
16
node_modules/npm-run-all/node_modules/semver/range.bnf
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
range-set ::= range ( logical-or range ) *
|
||||
logical-or ::= ( ' ' ) * '||' ( ' ' ) *
|
||||
range ::= hyphen | simple ( ' ' simple ) * | ''
|
||||
hyphen ::= partial ' - ' partial
|
||||
simple ::= primitive | partial | tilde | caret
|
||||
primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial
|
||||
partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )?
|
||||
xr ::= 'x' | 'X' | '*' | nr
|
||||
nr ::= '0' | [1-9] ( [0-9] ) *
|
||||
tilde ::= '~' partial
|
||||
caret ::= '^' partial
|
||||
qualifier ::= ( '-' pre )? ( '+' build )?
|
||||
pre ::= parts
|
||||
build ::= parts
|
||||
parts ::= part ( '.' part ) *
|
||||
part ::= nr | [-0-9A-Za-z]+
|
1525
node_modules/npm-run-all/node_modules/semver/semver.js
generated
vendored
Normal file
1525
node_modules/npm-run-all/node_modules/semver/semver.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
19
node_modules/npm-run-all/node_modules/shebang-command/index.js
generated
vendored
Normal file
19
node_modules/npm-run-all/node_modules/shebang-command/index.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
var shebangRegex = require('shebang-regex');
|
||||
|
||||
module.exports = function (str) {
|
||||
var match = str.match(shebangRegex);
|
||||
|
||||
if (!match) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var arr = match[0].replace(/#! ?/, '').split(' ');
|
||||
var bin = arr[0].split('/').pop();
|
||||
var arg = arr[1];
|
||||
|
||||
return (bin === 'env' ?
|
||||
arg :
|
||||
bin + (arg ? ' ' + arg : '')
|
||||
);
|
||||
};
|
21
node_modules/npm-run-all/node_modules/shebang-command/license
generated
vendored
Normal file
21
node_modules/npm-run-all/node_modules/shebang-command/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Kevin Martensson <kevinmartensson@gmail.com> (github.com/kevva)
|
||||
|
||||
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.
|
39
node_modules/npm-run-all/node_modules/shebang-command/package.json
generated
vendored
Normal file
39
node_modules/npm-run-all/node_modules/shebang-command/package.json
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "shebang-command",
|
||||
"version": "1.2.0",
|
||||
"description": "Get the command from a shebang",
|
||||
"license": "MIT",
|
||||
"repository": "kevva/shebang-command",
|
||||
"author": {
|
||||
"name": "Kevin Martensson",
|
||||
"email": "kevinmartensson@gmail.com",
|
||||
"url": "github.com/kevva"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"cmd",
|
||||
"command",
|
||||
"parse",
|
||||
"shebang"
|
||||
],
|
||||
"dependencies": {
|
||||
"shebang-regex": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"xo": {
|
||||
"ignores": [
|
||||
"test.js"
|
||||
]
|
||||
}
|
||||
}
|
39
node_modules/npm-run-all/node_modules/shebang-command/readme.md
generated
vendored
Normal file
39
node_modules/npm-run-all/node_modules/shebang-command/readme.md
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
# shebang-command [](https://travis-ci.org/kevva/shebang-command)
|
||||
|
||||
> Get the command from a shebang
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save shebang-command
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const shebangCommand = require('shebang-command');
|
||||
|
||||
shebangCommand('#!/usr/bin/env node');
|
||||
//=> 'node'
|
||||
|
||||
shebangCommand('#!/bin/bash');
|
||||
//=> 'bash'
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### shebangCommand(string)
|
||||
|
||||
#### string
|
||||
|
||||
Type: `string`
|
||||
|
||||
String containing a shebang.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Kevin Martensson](http://github.com/kevva)
|
2
node_modules/npm-run-all/node_modules/shebang-regex/index.js
generated
vendored
Normal file
2
node_modules/npm-run-all/node_modules/shebang-regex/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
'use strict';
|
||||
module.exports = /^#!.*/;
|
21
node_modules/npm-run-all/node_modules/shebang-regex/license
generated
vendored
Normal file
21
node_modules/npm-run-all/node_modules/shebang-regex/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
32
node_modules/npm-run-all/node_modules/shebang-regex/package.json
generated
vendored
Normal file
32
node_modules/npm-run-all/node_modules/shebang-regex/package.json
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "shebang-regex",
|
||||
"version": "1.0.0",
|
||||
"description": "Regular expression for matching a shebang",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/shebang-regex",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node test.js"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"re",
|
||||
"regex",
|
||||
"regexp",
|
||||
"shebang",
|
||||
"match",
|
||||
"test"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "0.0.4"
|
||||
}
|
||||
}
|
29
node_modules/npm-run-all/node_modules/shebang-regex/readme.md
generated
vendored
Normal file
29
node_modules/npm-run-all/node_modules/shebang-regex/readme.md
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
# shebang-regex [](https://travis-ci.org/sindresorhus/shebang-regex)
|
||||
|
||||
> Regular expression for matching a [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix))
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save shebang-regex
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var shebangRegex = require('shebang-regex');
|
||||
var str = '#!/usr/bin/env node\nconsole.log("unicorns");';
|
||||
|
||||
shebangRegex.test(str);
|
||||
//=> true
|
||||
|
||||
shebangRegex.exec(str)[0];
|
||||
//=> '#!/usr/bin/env node'
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
152
node_modules/npm-run-all/node_modules/which/CHANGELOG.md
generated
vendored
Normal file
152
node_modules/npm-run-all/node_modules/which/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
# Changes
|
||||
|
||||
|
||||
## 1.3.1
|
||||
|
||||
* update deps
|
||||
* update travis
|
||||
|
||||
## v1.3.0
|
||||
|
||||
* Add nothrow option to which.sync
|
||||
* update tap
|
||||
|
||||
## v1.2.14
|
||||
|
||||
* appveyor: drop node 5 and 0.x
|
||||
* travis-ci: add node 6, drop 0.x
|
||||
|
||||
## v1.2.13
|
||||
|
||||
* test: Pass missing option to pass on windows
|
||||
* update tap
|
||||
* update isexe to 2.0.0
|
||||
* neveragain.tech pledge request
|
||||
|
||||
## v1.2.12
|
||||
|
||||
* Removed unused require
|
||||
|
||||
## v1.2.11
|
||||
|
||||
* Prevent changelog script from being included in package
|
||||
|
||||
## v1.2.10
|
||||
|
||||
* Use env.PATH only, not env.Path
|
||||
|
||||
## v1.2.9
|
||||
|
||||
* fix for paths starting with ../
|
||||
* Remove unused `is-absolute` module
|
||||
|
||||
## v1.2.8
|
||||
|
||||
* bullet items in changelog that contain (but don't start with) #
|
||||
|
||||
## v1.2.7
|
||||
|
||||
* strip 'update changelog' changelog entries out of changelog
|
||||
|
||||
## v1.2.6
|
||||
|
||||
* make the changelog bulleted
|
||||
|
||||
## v1.2.5
|
||||
|
||||
* make a changelog, and keep it up to date
|
||||
* don't include tests in package
|
||||
* Properly handle relative-path executables
|
||||
* appveyor
|
||||
* Attach error code to Not Found error
|
||||
* Make tests pass on Windows
|
||||
|
||||
## v1.2.4
|
||||
|
||||
* Fix typo
|
||||
|
||||
## v1.2.3
|
||||
|
||||
* update isexe, fix regression in pathExt handling
|
||||
|
||||
## v1.2.2
|
||||
|
||||
* update deps, use isexe module, test windows
|
||||
|
||||
## v1.2.1
|
||||
|
||||
* Sometimes windows PATH entries are quoted
|
||||
* Fixed a bug in the check for group and user mode bits. This bug was introduced during refactoring for supporting strict mode.
|
||||
* doc cli
|
||||
|
||||
## v1.2.0
|
||||
|
||||
* Add support for opt.all and -as cli flags
|
||||
* test the bin
|
||||
* update travis
|
||||
* Allow checking for multiple programs in bin/which
|
||||
* tap 2
|
||||
|
||||
## v1.1.2
|
||||
|
||||
* travis
|
||||
* Refactored and fixed undefined error on Windows
|
||||
* Support strict mode
|
||||
|
||||
## v1.1.1
|
||||
|
||||
* test +g exes against secondary groups, if available
|
||||
* Use windows exe semantics on cygwin & msys
|
||||
* cwd should be first in path on win32, not last
|
||||
* Handle lower-case 'env.Path' on Windows
|
||||
* Update docs
|
||||
* use single-quotes
|
||||
|
||||
## v1.1.0
|
||||
|
||||
* Add tests, depend on is-absolute
|
||||
|
||||
## v1.0.9
|
||||
|
||||
* which.js: root is allowed to execute files owned by anyone
|
||||
|
||||
## v1.0.8
|
||||
|
||||
* don't use graceful-fs
|
||||
|
||||
## v1.0.7
|
||||
|
||||
* add license to package.json
|
||||
|
||||
## v1.0.6
|
||||
|
||||
* isc license
|
||||
|
||||
## 1.0.5
|
||||
|
||||
* Awful typo
|
||||
|
||||
## 1.0.4
|
||||
|
||||
* Test for path absoluteness properly
|
||||
* win: Allow '' as a pathext if cmd has a . in it
|
||||
|
||||
## 1.0.3
|
||||
|
||||
* Remove references to execPath
|
||||
* Make `which.sync()` work on Windows by honoring the PATHEXT variable.
|
||||
* Make `isExe()` always return true on Windows.
|
||||
* MIT
|
||||
|
||||
## 1.0.2
|
||||
|
||||
* Only files can be exes
|
||||
|
||||
## 1.0.1
|
||||
|
||||
* Respect the PATHEXT env for win32 support
|
||||
* should 0755 the bin
|
||||
* binary
|
||||
* guts
|
||||
* package
|
||||
* 1st
|
15
node_modules/npm-run-all/node_modules/which/LICENSE
generated
vendored
Normal file
15
node_modules/npm-run-all/node_modules/which/LICENSE
generated
vendored
Normal file
@@ -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.
|
51
node_modules/npm-run-all/node_modules/which/README.md
generated
vendored
Normal file
51
node_modules/npm-run-all/node_modules/which/README.md
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
# which
|
||||
|
||||
Like the unix `which` utility.
|
||||
|
||||
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.
|
||||
|
||||
## USAGE
|
||||
|
||||
```javascript
|
||||
var which = require('which')
|
||||
|
||||
// async usage
|
||||
which('node', function (er, resolvedPath) {
|
||||
// er is returned if no "node" is found on the PATH
|
||||
// if it is found, then the absolute path to the exec is returned
|
||||
})
|
||||
|
||||
// sync usage
|
||||
// throws if not found
|
||||
var resolved = which.sync('node')
|
||||
|
||||
// if nothrow option is used, returns null if not found
|
||||
resolved = which.sync('node', {nothrow: true})
|
||||
|
||||
// Pass options to override the PATH and PATHEXT environment vars.
|
||||
which('node', { path: someOtherPath }, function (er, resolved) {
|
||||
if (er)
|
||||
throw er
|
||||
console.log('found at %j', resolved)
|
||||
})
|
||||
```
|
||||
|
||||
## CLI USAGE
|
||||
|
||||
Same as the BSD `which(1)` binary.
|
||||
|
||||
```
|
||||
usage: which [-as] program ...
|
||||
```
|
||||
|
||||
## OPTIONS
|
||||
|
||||
You may pass an options object as the second argument.
|
||||
|
||||
- `path`: Use instead of the `PATH` environment variable.
|
||||
- `pathExt`: Use instead of the `PATHEXT` environment variable.
|
||||
- `all`: Return all matches, instead of just the first one. Note that
|
||||
this means the function returns an array of strings instead of a
|
||||
single string.
|
52
node_modules/npm-run-all/node_modules/which/bin/which
generated
vendored
Executable file
52
node_modules/npm-run-all/node_modules/which/bin/which
generated
vendored
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env node
|
||||
var which = require("../")
|
||||
if (process.argv.length < 3)
|
||||
usage()
|
||||
|
||||
function usage () {
|
||||
console.error('usage: which [-as] program ...')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
var all = false
|
||||
var silent = false
|
||||
var dashdash = false
|
||||
var args = process.argv.slice(2).filter(function (arg) {
|
||||
if (dashdash || !/^-/.test(arg))
|
||||
return true
|
||||
|
||||
if (arg === '--') {
|
||||
dashdash = true
|
||||
return false
|
||||
}
|
||||
|
||||
var flags = arg.substr(1).split('')
|
||||
for (var f = 0; f < flags.length; f++) {
|
||||
var flag = flags[f]
|
||||
switch (flag) {
|
||||
case 's':
|
||||
silent = true
|
||||
break
|
||||
case 'a':
|
||||
all = true
|
||||
break
|
||||
default:
|
||||
console.error('which: illegal option -- ' + flag)
|
||||
usage()
|
||||
}
|
||||
}
|
||||
return false
|
||||
})
|
||||
|
||||
process.exit(args.reduce(function (pv, current) {
|
||||
try {
|
||||
var f = which.sync(current, { all: all })
|
||||
if (all)
|
||||
f = f.join('\n')
|
||||
if (!silent)
|
||||
console.log(f)
|
||||
return pv;
|
||||
} catch (e) {
|
||||
return 1;
|
||||
}
|
||||
}, 0))
|
30
node_modules/npm-run-all/node_modules/which/package.json
generated
vendored
Normal file
30
node_modules/npm-run-all/node_modules/which/package.json
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)",
|
||||
"name": "which",
|
||||
"description": "Like which(1) unix command. Find the first instance of an executable in the PATH.",
|
||||
"version": "1.3.1",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/isaacs/node-which.git"
|
||||
},
|
||||
"main": "which.js",
|
||||
"bin": "./bin/which",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"isexe": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mkdirp": "^0.5.0",
|
||||
"rimraf": "^2.6.2",
|
||||
"tap": "^12.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test/*.js --cov",
|
||||
"changelog": "bash gen-changelog.sh",
|
||||
"postversion": "npm run changelog && git add CHANGELOG.md && git commit -m 'update changelog - '${npm_package_version}"
|
||||
},
|
||||
"files": [
|
||||
"which.js",
|
||||
"bin/which"
|
||||
]
|
||||
}
|
135
node_modules/npm-run-all/node_modules/which/which.js
generated
vendored
Normal file
135
node_modules/npm-run-all/node_modules/which/which.js
generated
vendored
Normal file
@@ -0,0 +1,135 @@
|
||||
module.exports = which
|
||||
which.sync = whichSync
|
||||
|
||||
var isWindows = process.platform === 'win32' ||
|
||||
process.env.OSTYPE === 'cygwin' ||
|
||||
process.env.OSTYPE === 'msys'
|
||||
|
||||
var path = require('path')
|
||||
var COLON = isWindows ? ';' : ':'
|
||||
var isexe = require('isexe')
|
||||
|
||||
function getNotFoundError (cmd) {
|
||||
var er = new Error('not found: ' + cmd)
|
||||
er.code = 'ENOENT'
|
||||
|
||||
return er
|
||||
}
|
||||
|
||||
function getPathInfo (cmd, opt) {
|
||||
var colon = opt.colon || COLON
|
||||
var pathEnv = opt.path || process.env.PATH || ''
|
||||
var pathExt = ['']
|
||||
|
||||
pathEnv = pathEnv.split(colon)
|
||||
|
||||
var pathExtExe = ''
|
||||
if (isWindows) {
|
||||
pathEnv.unshift(process.cwd())
|
||||
pathExtExe = (opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM')
|
||||
pathExt = pathExtExe.split(colon)
|
||||
|
||||
|
||||
// Always test the cmd itself first. isexe will check to make sure
|
||||
// it's found in the pathExt set.
|
||||
if (cmd.indexOf('.') !== -1 && pathExt[0] !== '')
|
||||
pathExt.unshift('')
|
||||
}
|
||||
|
||||
// If it has a slash, then we don't bother searching the pathenv.
|
||||
// just check the file itself, and that's it.
|
||||
if (cmd.match(/\//) || isWindows && cmd.match(/\\/))
|
||||
pathEnv = ['']
|
||||
|
||||
return {
|
||||
env: pathEnv,
|
||||
ext: pathExt,
|
||||
extExe: pathExtExe
|
||||
}
|
||||
}
|
||||
|
||||
function which (cmd, opt, cb) {
|
||||
if (typeof opt === 'function') {
|
||||
cb = opt
|
||||
opt = {}
|
||||
}
|
||||
|
||||
var info = getPathInfo(cmd, opt)
|
||||
var pathEnv = info.env
|
||||
var pathExt = info.ext
|
||||
var pathExtExe = info.extExe
|
||||
var found = []
|
||||
|
||||
;(function F (i, l) {
|
||||
if (i === l) {
|
||||
if (opt.all && found.length)
|
||||
return cb(null, found)
|
||||
else
|
||||
return cb(getNotFoundError(cmd))
|
||||
}
|
||||
|
||||
var pathPart = pathEnv[i]
|
||||
if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"')
|
||||
pathPart = pathPart.slice(1, -1)
|
||||
|
||||
var p = path.join(pathPart, cmd)
|
||||
if (!pathPart && (/^\.[\\\/]/).test(cmd)) {
|
||||
p = cmd.slice(0, 2) + p
|
||||
}
|
||||
;(function E (ii, ll) {
|
||||
if (ii === ll) return F(i + 1, l)
|
||||
var ext = pathExt[ii]
|
||||
isexe(p + ext, { pathExt: pathExtExe }, function (er, is) {
|
||||
if (!er && is) {
|
||||
if (opt.all)
|
||||
found.push(p + ext)
|
||||
else
|
||||
return cb(null, p + ext)
|
||||
}
|
||||
return E(ii + 1, ll)
|
||||
})
|
||||
})(0, pathExt.length)
|
||||
})(0, pathEnv.length)
|
||||
}
|
||||
|
||||
function whichSync (cmd, opt) {
|
||||
opt = opt || {}
|
||||
|
||||
var info = getPathInfo(cmd, opt)
|
||||
var pathEnv = info.env
|
||||
var pathExt = info.ext
|
||||
var pathExtExe = info.extExe
|
||||
var found = []
|
||||
|
||||
for (var i = 0, l = pathEnv.length; i < l; i ++) {
|
||||
var pathPart = pathEnv[i]
|
||||
if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"')
|
||||
pathPart = pathPart.slice(1, -1)
|
||||
|
||||
var p = path.join(pathPart, cmd)
|
||||
if (!pathPart && /^\.[\\\/]/.test(cmd)) {
|
||||
p = cmd.slice(0, 2) + p
|
||||
}
|
||||
for (var j = 0, ll = pathExt.length; j < ll; j ++) {
|
||||
var cur = p + pathExt[j]
|
||||
var is
|
||||
try {
|
||||
is = isexe.sync(cur, { pathExt: pathExtExe })
|
||||
if (is) {
|
||||
if (opt.all)
|
||||
found.push(cur)
|
||||
else
|
||||
return cur
|
||||
}
|
||||
} catch (ex) {}
|
||||
}
|
||||
}
|
||||
|
||||
if (opt.all && found.length)
|
||||
return found
|
||||
|
||||
if (opt.nothrow)
|
||||
return null
|
||||
|
||||
throw getNotFoundError(cmd)
|
||||
}
|
78
node_modules/npm-run-all/package.json
generated
vendored
Normal file
78
node_modules/npm-run-all/package.json
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
{
|
||||
"name": "npm-run-all",
|
||||
"version": "4.1.5",
|
||||
"description": "A CLI tool to run multiple npm-scripts in parallel or sequential.",
|
||||
"bin": {
|
||||
"run-p": "bin/run-p/index.js",
|
||||
"run-s": "bin/run-s/index.js",
|
||||
"npm-run-all": "bin/npm-run-all/index.js"
|
||||
},
|
||||
"main": "lib/index.js",
|
||||
"files": [
|
||||
"bin",
|
||||
"lib",
|
||||
"docs"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 4"
|
||||
},
|
||||
"scripts": {
|
||||
"_mocha": "mocha \"test/*.js\" --timeout 120000",
|
||||
"clean": "rimraf .nyc_output coverage jsdoc \"test-workspace/{build,test.txt}\"",
|
||||
"docs": "jsdoc -c jsdoc.json",
|
||||
"lint": "eslint bin lib scripts test \"test-workspace/tasks/*.js\"",
|
||||
"pretest": "node scripts/make-slink.js && npm run lint",
|
||||
"preversion": "npm test",
|
||||
"postversion": "git push && git push --tags",
|
||||
"test": "nyc --require babel-register npm run _mocha",
|
||||
"watch": "npm run _mocha -- --require babel-register --watch --growl",
|
||||
"codecov": "nyc report -r lcovonly && codecov"
|
||||
},
|
||||
"dependencies": {
|
||||
"ansi-styles": "^3.2.1",
|
||||
"chalk": "^2.4.1",
|
||||
"cross-spawn": "^6.0.5",
|
||||
"memorystream": "^0.3.1",
|
||||
"minimatch": "^3.0.4",
|
||||
"pidtree": "^0.3.0",
|
||||
"read-pkg": "^3.0.0",
|
||||
"shell-quote": "^1.6.1",
|
||||
"string.prototype.padend": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^4.9.1",
|
||||
"babel-plugin-transform-async-to-generator": "^6.24.1",
|
||||
"babel-preset-power-assert": "^2.0.0",
|
||||
"babel-register": "^6.26.0",
|
||||
"codecov": "^3.1.0",
|
||||
"eslint": "^4.19.1",
|
||||
"eslint-config-mysticatea": "^12.0.0",
|
||||
"fs-extra": "^7.0.1",
|
||||
"mocha": "^5.2.0",
|
||||
"nyc": "^11.9.0",
|
||||
"p-queue": "^2.4.2",
|
||||
"power-assert": "^1.6.1",
|
||||
"rimraf": "^2.6.2",
|
||||
"yarn": "^1.12.3"
|
||||
},
|
||||
"repository": "mysticatea/npm-run-all",
|
||||
"keywords": [
|
||||
"cli",
|
||||
"command",
|
||||
"commandline",
|
||||
"tool",
|
||||
"npm",
|
||||
"npm-scripts",
|
||||
"run",
|
||||
"sequential",
|
||||
"serial",
|
||||
"parallel",
|
||||
"task"
|
||||
],
|
||||
"author": "Toru Nagashima",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/mysticatea/npm-run-all/issues"
|
||||
},
|
||||
"homepage": "https://github.com/mysticatea/npm-run-all"
|
||||
}
|
Reference in New Issue
Block a user