$
This commit is contained in:
1017
node_modules/nyc/CHANGELOG.md
generated
vendored
Normal file
1017
node_modules/nyc/CHANGELOG.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
16
node_modules/nyc/LICENSE.txt
generated
vendored
Normal file
16
node_modules/nyc/LICENSE.txt
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
ISC License
|
||||
|
||||
Copyright (c) 2015, 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.
|
388
node_modules/nyc/README.md
generated
vendored
Normal file
388
node_modules/nyc/README.md
generated
vendored
Normal file
@@ -0,0 +1,388 @@
|
||||
# nyc
|
||||
|
||||
[](https://travis-ci.org/istanbuljs/nyc)
|
||||
[](https://ci.appveyor.com/project/istanbuljs/nyc/branch/master)
|
||||
[](https://coveralls.io/r/istanbuljs/nyc?branch=master)
|
||||
[](https://www.npmjs.com/package/nyc)
|
||||
[](https://conventionalcommits.org)
|
||||
[](https://devtoolscommunity.herokuapp.com)
|
||||
|
||||
_Having problems? want to contribute? join our [community slack](https://devtoolscommunity.herokuapp.com)_.
|
||||
|
||||
Istanbul's state of the art command line interface, with support for:
|
||||
|
||||
* applications that spawn subprocesses.
|
||||
* source mapped coverage of Babel and TypeScript projects
|
||||
|
||||
## Installation & Usage
|
||||
|
||||
Use your package manager to add it as a dev dependency: `npm i -D nyc` or `yarn add -D nyc`.
|
||||
You can use nyc to call npm scripts (assuming they don't already have nyc executed in them), like so (replace `mocha` with your test runner everywhere you see it):
|
||||
|
||||
```json
|
||||
{
|
||||
"scripts": {
|
||||
"test": "mocha",
|
||||
"coverage": "nyc npm run test"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
You can use also `npx` instead of installing nyc as a dependency, but you might get updates you are not ready for; to get around this, pin to a specific major version by specifying, e.g. `nyc@14`.
|
||||
|
||||
```json
|
||||
{
|
||||
"scripts": {
|
||||
"test": "npx nyc@latest mocha"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This is a good way of testing upcoming releases of nyc, usually on the `next` tag.
|
||||
|
||||
**Note**: If you use [`jest`](https://npm.im/jest) or [`tap`](https://www.node-tap.org/), you do not need to install `nyc`.
|
||||
Those runners already have the IstanbulJS libraries to provide coverage for you.
|
||||
Follow their documentation to enable and configure coverage reporting.
|
||||
|
||||
## Configuring `nyc`
|
||||
|
||||
nyc accepts a wide variety of configuration arguments, run `npx nyc --help` for thorough documentation.
|
||||
|
||||
Configuration arguments on the command-line should be provided prior to the program that nyc is executing.
|
||||
As an example, the following command executes `ava`, and indicates to nyc that it should output both an `lcov` (`lcov.info` + html report) and a `text-summary` coverage report.
|
||||
|
||||
```shell
|
||||
nyc --reporter=lcov --reporter=text-summary ava
|
||||
```
|
||||
|
||||
### Babel projects
|
||||
|
||||
Please start with the pre-configured [`@istanbuljs/nyc-config-babel`] preset.
|
||||
You can add your custom configuration options as shown below.
|
||||
|
||||
### TypeScript projects
|
||||
|
||||
Please start with the pre-configured [`@istanbuljs/nyc-config-typescript`](https://www.npmjs.com/package/@istanbuljs/nyc-config-typescript) preset.
|
||||
|
||||
#### Adding your overrides
|
||||
|
||||
nyc allows you to inherit other configurations using the key `extends` in the `package.json` stanza, `.nycrc`, or YAML files.
|
||||
You can then add the specific configuration options you want that aren't in that particular shared config, e.g.
|
||||
|
||||
```json
|
||||
{
|
||||
"extends": "@istanbuljs/nyc-config-typescript",
|
||||
"all": true,
|
||||
"check-coverage": true
|
||||
}
|
||||
```
|
||||
|
||||
### Configuration files
|
||||
|
||||
Any configuration options that can be set via the command line can also be specified in the `nyc` stanza of your package.json, or within a separate configuration file - a variety of flavors are available:
|
||||
|
||||
| File name | File Association |
|
||||
|-----------------|------------------|
|
||||
| `.nycrc` | JSON |
|
||||
| `.nycrc.json` | JSON |
|
||||
| `.nycrc.yaml` | YAML |
|
||||
| `.nycrc.yml` | YAML |
|
||||
| `nyc.config.js` | CommonJS export |
|
||||
|
||||
### Common Configuration Options
|
||||
|
||||
See `nyc --help` for all options available.
|
||||
You can set these in any of the files listed above, or from the command line.
|
||||
This table is a quick TLDR for the rest of this readme and there are more advanced docs available.
|
||||
|
||||
| Option name | Description | Type | Default |
|
||||
| ----------- | ----------- | ---- | ------- |
|
||||
| `all` | Whether or not to instrument all files (not just the ones touched by your test suite) | `Boolean` | `false` |
|
||||
| `check-coverage` | Check whether coverage is within thresholds, fail if not | `Boolean` | `false` |
|
||||
| `extension` | List of extensions that nyc should attempt to handle in addition to `.js` | `Array<String>` | `['.js', '.cjs', '.mjs', '.ts', '.tsx', '.jsx']` |
|
||||
| `include` | See [selecting files for coverage] for more info | `Array<String>` | `['**']`|
|
||||
| `exclude` | See [selecting files for coverage] for more info | `Array<String>` | [list](https://github.com/istanbuljs/schema/blob/master/default-exclude.js) |
|
||||
| `reporter` | [Coverage reporters to use](https://istanbul.js.org/docs/advanced/alternative-reporters/) | `Array<String>` | `['text']` |
|
||||
| `report-dir` | Where to put the coverage report files | `String` | `./coverage` |
|
||||
| `skip-full` | Don't show files with 100% statement, branch, and function coverage | `Boolean` | `false` |
|
||||
| `temp-dir` | Directory to output raw coverage information to | `String` | `./.nyc_output` |
|
||||
|
||||
Configuration can also be provided by `nyc.config.js` if programmed logic is required:
|
||||
|
||||
```js
|
||||
'use strict';
|
||||
|
||||
const defaultExclude = require('@istanbuljs/schema/default-exclude');
|
||||
const isWindows = require('is-windows');
|
||||
|
||||
let platformExclude = [
|
||||
isWindows() ? 'lib/posix.js' : 'lib/win32.js'
|
||||
];
|
||||
|
||||
module.exports = {
|
||||
exclude: platformExclude.concat(defaultExclude)
|
||||
};
|
||||
```
|
||||
|
||||
### Publish and reuse your nyc configuration(s)
|
||||
|
||||
To publish and reuse your own `nyc` configuration, simply create an npm module that exports your JSON config (via [`index.json`](https://github.com/istanbuljs/istanbuljs/blob/master/packages/nyc-config-typescript/) or a CJS [`index.js`](https://github.com/istanbuljs/istanbuljs/blob/master/packages/nyc-config-hook-run-in-this-context/)).
|
||||
|
||||
A more advanced use case would be to combine multiple shared configs in a `nyc.config.js` file:
|
||||
|
||||
```js
|
||||
'use strict';
|
||||
|
||||
const babelConfig = require('@istanbuljs/nyc-config-babel');
|
||||
const hookRunInThisContextConfig = require('@istanbuljs/nyc-config-hook-run-in-this-context');
|
||||
|
||||
module.exports = {
|
||||
...babelConfig,
|
||||
...hookRunInThisContextConfig,
|
||||
all: true,
|
||||
'check-coverage': true
|
||||
};
|
||||
```
|
||||
|
||||
## Selecting files for coverage
|
||||
|
||||
By default, nyc only collects coverage for source files that are visited during a test.
|
||||
It does this by watching for files that are `require()`'d during the test.
|
||||
When a file is `require()`'d, nyc creates and returns an instrumented version of the source, rather than the original.
|
||||
Only source files that are visited during a test will appear in the coverage report and contribute to coverage statistics.
|
||||
|
||||
nyc will instrument all files if the `--all` flag is set or if running `nyc instrument`.
|
||||
In this case all files will appear in the coverage report and contribute to coverage statistics.
|
||||
|
||||
nyc will only collect coverage for files that are located under `cwd`, and then only files with extensions listed in the `extension` array.
|
||||
|
||||
You can reduce the set of instrumented files by adding `include` and `exclude` filter arrays to your config.
|
||||
These allow you to shape the set of instrumented files by specifying glob patterns that can filter files from the default instrumented set.
|
||||
The `exclude` array may also use exclude negated glob patterns, these are specified with a `!` prefix, and can restore sub-paths of excluded paths.
|
||||
|
||||
Globs are matched using [minimatch](https://www.npmjs.com/package/minimatch).
|
||||
|
||||
We use the following process to remove files from consideration:
|
||||
|
||||
1. Limit the set of instrumented files to those files in paths listed in the `include` array.
|
||||
2. Remove any files that are found in the `exclude` array.
|
||||
3. Restore any exclude negated files that have been excluded in step 2.
|
||||
|
||||
### Using include and exclude arrays
|
||||
|
||||
If there are paths specified in the `include` array, then the set of instrumented files will be limited to eligible files found in those paths.
|
||||
If the `include` array is left undefined all eligible files will be included, equivalent to setting `include: ['**']`.
|
||||
Multiple `include` globs can be specified on the command line, each must follow a `--include`, `-n` switch.
|
||||
|
||||
If there are paths specified in the `exclude` array, then the set of instrumented files will not feature eligible files found in those paths.
|
||||
You can also specify negated paths in the `exclude` array, by prefixing them with a `!`.
|
||||
Negated paths can restore paths that have been already been excluded in the `exclude` array.
|
||||
Multiple `exclude` globs can be specified on the command line, each must follow a `--exclude`, `-x` switch.
|
||||
|
||||
The default `exclude` list is defined in the [@istanbuljs/schema module](https://github.com/istanbuljs/schema/blob/master/default-exclude.js).
|
||||
Specifying your own exclude property completely replaces these defaults.
|
||||
|
||||
For example, the following `nyc` config will collect coverage for every file in the `src` directory regardless of whether it is `require()`'d in a test.
|
||||
It will also exclude any files with the extension `.spec.js`.
|
||||
|
||||
```json
|
||||
{
|
||||
"all": true,
|
||||
"include": [
|
||||
"src/**/*.js"
|
||||
],
|
||||
"exclude": [
|
||||
"**/*.spec.js"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**Note:** Be wary of automatic OS glob expansion when specifying include/exclude globs with the CLI.
|
||||
To prevent this, wrap each glob in single quotes.
|
||||
|
||||
### Including files within `node_modules`
|
||||
|
||||
We always add `**/node_modules/**` to the exclude list, even if not specified in the config.
|
||||
You can override this by setting `--exclude-node-modules=false`.
|
||||
|
||||
For example, `"excludeNodeModules: false"` in the following `nyc` config will prevent `node_modules` from being added to the exclude rules.
|
||||
The set of include rules then restrict nyc to only consider instrumenting files found under the `lib/` and `node_modules/@my-org/` directories.
|
||||
The exclude rules then prevent nyc instrumenting anything in a `test` folder and the file `node_modules/@my-org/something/unwanted.js`.
|
||||
|
||||
```json
|
||||
{
|
||||
"all": true,
|
||||
"include": [
|
||||
"lib/**",
|
||||
"node_modules/@my-org/**"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules/@my-org/something/unwanted.js",
|
||||
"**/test/**"
|
||||
],
|
||||
"excludeNodeModules": false
|
||||
}
|
||||
```
|
||||
|
||||
## Setting the project root directory
|
||||
|
||||
nyc runs a lot of file system operations relative to the project root directory.
|
||||
During startup nyc will look for the *default* project root directory.
|
||||
The *default* project root directory is the first directory found that contains a `package.json` file when searching from the current working directory up.
|
||||
If nyc fails to find a directory containing a `package.json` file, it will use the current working directory as the *default* project root directory.
|
||||
You can change the project root directory with the `--cwd` option.
|
||||
|
||||
nyc uses the project root directory when:
|
||||
|
||||
* looking for source files to instrument
|
||||
* creating globs for include and exclude rules during file selection
|
||||
* loading custom require hooks from the `require` array
|
||||
|
||||
nyc may create artifact directories within the project root, with these defaults:
|
||||
|
||||
* the report directory, `<project-root>/coverage`
|
||||
* the cache directory, `<project-root>/node_modules/.cache/nyc`
|
||||
* the temp directory, `<project-root>/.nyc_output`
|
||||
|
||||
## Require additional modules
|
||||
|
||||
The `--require` flag can be provided to `nyc` to indicate that additional modules should be required in the subprocess collecting coverage:
|
||||
|
||||
```shell
|
||||
nyc --require esm mocha
|
||||
```
|
||||
|
||||
### Interaction with `--all` flag
|
||||
|
||||
The `--require` flag also operates on the main nyc process for use by `--all`.
|
||||
For example, in situations with `nyc --all --instrument false` and [`babel-plugin-istanbul`] setup the `--all` option only works if `--require @babel/register` is passed to nyc.
|
||||
Passing it to mocha would cause the tests to be instrumented but unloaded sources would not be seen.
|
||||
The [`@istanbuljs/nyc-config-babel`] package handles this for you!
|
||||
|
||||
## Caching
|
||||
|
||||
`nyc`'s default behavior is to cache instrumented files to disk to prevent instrumenting source files multiple times, and speed `nyc` execution times.
|
||||
You can disable this behavior by running `nyc` with the `--cache false` flag.
|
||||
You can also change the default cache directory from `./node_modules/.cache/nyc` by setting the `--cache-dir` flag.
|
||||
|
||||
## Coverage thresholds
|
||||
|
||||
You can set custom coverage thresholds that will fail if `check-coverage` is set to `true` and your coverage drops below those thresholds.
|
||||
For example, in the following `nyc` configuration, dropping below 80% branch, line, functions, or statements coverage would fail the build (you can have any combination of these):
|
||||
|
||||
```json
|
||||
{
|
||||
"branches": 80,
|
||||
"lines": 80,
|
||||
"functions": 80,
|
||||
"statements": 80
|
||||
}
|
||||
```
|
||||
|
||||
To do this check on a per-file basis (as opposed to in aggregate), set the `per-file` option to `true`.
|
||||
|
||||
### High and low watermarks
|
||||
|
||||
Several of the coverage reporters supported by nyc display special information for high and low watermarks:
|
||||
|
||||
* high-watermarks represent healthy test coverage (in many reports this is represented with green highlighting).
|
||||
* low-watermarks represent sub-optimal coverage levels (in many reports this is represented with red highlighting).
|
||||
|
||||
You can specify custom high and low watermarks in nyc's configuration:
|
||||
|
||||
```json
|
||||
{
|
||||
"watermarks": {
|
||||
"lines": [80, 95],
|
||||
"functions": [80, 95],
|
||||
"branches": [80, 95],
|
||||
"statements": [80, 95]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Parsing Hints (Ignoring Lines)
|
||||
|
||||
There may be some sections of your codebase that you wish to purposefully
|
||||
exclude from coverage tracking, to do so you can use the following parsing
|
||||
hints:
|
||||
|
||||
* `/* istanbul ignore if */`: ignore the next if statement.
|
||||
* `/* istanbul ignore else */`: ignore the else portion of an if statement.
|
||||
* `/* istanbul ignore next */`: ignore the next _thing_ in the source-code (
|
||||
functions, if statements, classes, you name it).
|
||||
* `/* istanbul ignore file */`: ignore an entire source-file (this should be
|
||||
placed at the top of the file).
|
||||
|
||||
## Ignoring Methods
|
||||
|
||||
You can ignore every instance of a method simply by adding its name to the `ignore-class-method` array in your `nyc` config.
|
||||
|
||||
```json
|
||||
{
|
||||
"ignore-class-method": ["render"]
|
||||
}
|
||||
```
|
||||
|
||||
## Combining reports from multiple runs
|
||||
|
||||
If for whatever reason you have different test runners in your project or a different series of test runs for different kinds of tests, nyc will automatically combine the coverage report for you if configured correctly with the `--no-clean` flag and the `report` command.
|
||||
Originally inspired by @janiukjf in #1001, here's an example, where the `test:*` scripts (not shown) invoke only your test runner(s) and not nyc:
|
||||
|
||||
```json
|
||||
{
|
||||
"scripts": {
|
||||
"cover": "npm run cover:unit && npm run cover:integration && npm run cover:report",
|
||||
"cover:unit": "nyc --silent npm run test:unit",
|
||||
"cover:integration": "nyc --silent --no-clean npm run test:integration",
|
||||
"cover:report": "nyc report --reporter=lcov --reporter=text"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### What about `nyc merge`?
|
||||
|
||||
The `nyc merge` command is for producing one _raw coverage output file_ that combines the results from many test runs.
|
||||
So if you had the above setup and needed to produce a single `coverage.json` for some external tool, you could do:
|
||||
|
||||
```json
|
||||
{
|
||||
"scripts": {
|
||||
"cover:merge": "npm run cover:unit && npm run cover:integration && nyc merge .nyc_output coverage.json"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Source-Map support for pre-instrumented codebases
|
||||
|
||||
If you opt to pre-instrument your source-code (rather than using a just-in-time transpiler like [`@babel/register`]) nyc supports both inline source-maps and `.map` files.
|
||||
|
||||
_Important: If you are using nyc with a project that pre-instruments its code, run nyc with the configuration option `--exclude-after-remap` set to `false`.
|
||||
Otherwise nyc's reports will exclude any files that source-maps remap to folders covered under exclude rules._
|
||||
|
||||
## [Integrating with coveralls](./docs/setup-coveralls.md)
|
||||
|
||||
## [Integrating with codecov](./docs/setup-codecov.md)
|
||||
|
||||
## [Producing instrumented source](./docs/instrument.md)
|
||||
|
||||
## Integrating with TAP formatters
|
||||
|
||||
Many testing frameworks (Mocha, Tape, Tap, etc.) can produce [TAP](https://en.wikipedia.org/wiki/Test_Anything_Protocol) output. [tap-nyc](https://github.com/MegaArman/tap-nyc) is a TAP formatter designed to look nice with nyc.
|
||||
|
||||
## Tutorials and Advanced Documentation
|
||||
|
||||
See [more nyc tutorials](https://istanbul.js.org/docs/tutorials) and [advanced nyc documentation](https://istanbul.js.org/docs/advanced/).
|
||||
|
||||
Please feel free to [contribute documentation](https://github.com/istanbuljs/istanbuljs.github.io/tree/development/content) to help us improve.
|
||||
|
||||
## `nyc` for enterprise
|
||||
|
||||
Available as part of the Tidelift Subscription.
|
||||
|
||||
The maintainers of `nyc` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-nyc?utm_source=npm-nyc&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
||||
|
||||
[`@babel/register`]: https://www.npmjs.com/package/@babel/register
|
||||
[`babel-plugin-istanbul`]: https://github.com/istanbuljs/babel-plugin-istanbul
|
||||
[`@istanbuljs/nyc-config-babel`]: https://www.npmjs.com/package/@istanbuljs/nyc-config-babel
|
||||
[selecting files for coverage]: #selecting-files-for-coverage
|
118
node_modules/nyc/bin/nyc.js
generated
vendored
Normal file
118
node_modules/nyc/bin/nyc.js
generated
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict'
|
||||
|
||||
const configUtil = require('../lib/config-util')
|
||||
const { cliWrapper, suppressEPIPE } = require('../lib/commands/helpers')
|
||||
const foreground = require('foreground-child')
|
||||
const resolveFrom = require('resolve-from')
|
||||
const NYC = require('../index.js')
|
||||
|
||||
// parse configuration and command-line arguments;
|
||||
// we keep these values in a few different forms,
|
||||
// used in the various execution contexts of nyc:
|
||||
// reporting, instrumenting subprocesses, etc.
|
||||
|
||||
async function main () {
|
||||
const { argv, childArgs, yargs } = await configUtil()
|
||||
|
||||
if (['check-coverage', 'report', 'instrument', 'merge'].includes(argv._[0])) {
|
||||
// look in lib/commands for logic.
|
||||
return
|
||||
}
|
||||
|
||||
if (argv._.length === 0) {
|
||||
// I don't have a clue what you're doing.
|
||||
process.exitCode = 1
|
||||
yargs.showHelp()
|
||||
return
|
||||
}
|
||||
|
||||
// if instrument is set to false,
|
||||
// enable a noop instrumenter.
|
||||
if (!argv.instrument) argv.instrumenter = './lib/instrumenters/noop'
|
||||
else argv.instrumenter = './lib/instrumenters/istanbul'
|
||||
|
||||
var nyc = (new NYC(argv))
|
||||
if (argv.clean) {
|
||||
await nyc.reset()
|
||||
} else {
|
||||
await nyc.createTempDirectory()
|
||||
}
|
||||
|
||||
const env = {
|
||||
NYC_CONFIG: JSON.stringify(argv),
|
||||
NYC_CWD: process.cwd()
|
||||
}
|
||||
|
||||
/* istanbul ignore else */
|
||||
if (argv['babel-cache'] === false) {
|
||||
// babel's cache interferes with some configurations, so is
|
||||
// disabled by default. opt in by setting babel-cache=true.
|
||||
env.BABEL_DISABLE_CACHE = process.env.BABEL_DISABLE_CACHE = '1'
|
||||
}
|
||||
|
||||
if (!argv.useSpawnWrap) {
|
||||
const requireModules = [
|
||||
require.resolve('../lib/register-env.js'),
|
||||
...nyc.require.map(mod => resolveFrom.silent(nyc.cwd, mod) || mod)
|
||||
]
|
||||
const preloadList = require('node-preload')
|
||||
preloadList.push(
|
||||
...requireModules,
|
||||
require.resolve('../lib/wrap.js')
|
||||
)
|
||||
|
||||
Object.assign(process.env, env)
|
||||
requireModules.forEach(mod => {
|
||||
require(mod)
|
||||
})
|
||||
}
|
||||
|
||||
if (argv.all) {
|
||||
await nyc.addAllFiles()
|
||||
}
|
||||
|
||||
if (argv.useSpawnWrap) {
|
||||
const wrapper = require.resolve('./wrap.js')
|
||||
// Support running nyc as a user without HOME (e.g. linux 'nobody'),
|
||||
// https://github.com/istanbuljs/nyc/issues/951
|
||||
env.SPAWN_WRAP_SHIM_ROOT = process.env.SPAWN_WRAP_SHIM_ROOT || process.env.XDG_CACHE_HOME || require('os').homedir()
|
||||
const sw = require('spawn-wrap')
|
||||
|
||||
sw([wrapper], env)
|
||||
}
|
||||
|
||||
// Both running the test script invocation and the check-coverage run may
|
||||
// set process.exitCode. Keep track so that both children are run, but
|
||||
// a non-zero exit codes in either one leads to an overall non-zero exit code.
|
||||
process.exitCode = 0
|
||||
foreground(childArgs, async () => {
|
||||
const mainChildExitCode = process.exitCode
|
||||
|
||||
try {
|
||||
await nyc.writeProcessIndex()
|
||||
|
||||
nyc.maybePurgeSourceMapCache()
|
||||
if (argv.checkCoverage) {
|
||||
await nyc.checkCoverage({
|
||||
lines: argv.lines,
|
||||
functions: argv.functions,
|
||||
branches: argv.branches,
|
||||
statements: argv.statements
|
||||
}, argv['per-file']).catch(suppressEPIPE)
|
||||
process.exitCode = process.exitCode || mainChildExitCode
|
||||
}
|
||||
|
||||
if (!argv.silent) {
|
||||
await nyc.report().catch(suppressEPIPE)
|
||||
}
|
||||
} catch (error) {
|
||||
/* istanbul ignore next */
|
||||
process.exitCode = process.exitCode || mainChildExitCode || 1
|
||||
/* istanbul ignore next */
|
||||
console.error(error.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
cliWrapper(main)()
|
4
node_modules/nyc/bin/wrap.js
generated
vendored
Normal file
4
node_modules/nyc/bin/wrap.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
'use strict'
|
||||
|
||||
require('../lib/wrap')
|
||||
require('spawn-wrap').runMain()
|
546
node_modules/nyc/index.js
generated
vendored
Normal file
546
node_modules/nyc/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
28
node_modules/nyc/lib/commands/check-coverage.js
generated
vendored
Normal file
28
node_modules/nyc/lib/commands/check-coverage.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
'use strict'
|
||||
|
||||
const NYC = require('../../index.js')
|
||||
const { cliWrapper, suppressEPIPE, setupOptions } = require('./helpers.js')
|
||||
|
||||
exports.command = 'check-coverage'
|
||||
|
||||
exports.describe = 'check whether coverage is within thresholds provided'
|
||||
|
||||
exports.builder = function (yargs) {
|
||||
yargs
|
||||
.demandCommand(0, 0)
|
||||
.example('$0 check-coverage --lines 95', "check whether the JSON in nyc's output folder meets the thresholds provided")
|
||||
|
||||
setupOptions(yargs, 'check-coverage')
|
||||
}
|
||||
|
||||
exports.handler = cliWrapper(async argv => {
|
||||
process.env.NYC_CWD = process.cwd()
|
||||
|
||||
const nyc = new NYC(argv)
|
||||
await nyc.checkCoverage({
|
||||
lines: argv.lines,
|
||||
functions: argv.functions,
|
||||
branches: argv.branches,
|
||||
statements: argv.statements
|
||||
}, argv['per-file']).catch(suppressEPIPE)
|
||||
})
|
74
node_modules/nyc/lib/commands/helpers.js
generated
vendored
Normal file
74
node_modules/nyc/lib/commands/helpers.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
'use strict'
|
||||
|
||||
const decamelize = require('decamelize')
|
||||
const schema = require('@istanbuljs/schema')
|
||||
|
||||
/* These options still need to be connected to the instrumenter
|
||||
* Disabling them for now also avoids the issue with OSX cutting
|
||||
* off the error help screen at 8192 characters.
|
||||
*/
|
||||
const blockOptions = [
|
||||
'coverageVariable',
|
||||
'coverageGlobalScope',
|
||||
'coverageGlobalScopeFunc'
|
||||
]
|
||||
|
||||
module.exports = {
|
||||
setupOptions (yargs, command, cwd) {
|
||||
Object.entries(schema.nyc.properties).forEach(([name, setup]) => {
|
||||
if (blockOptions.includes(name)) {
|
||||
return
|
||||
}
|
||||
|
||||
const option = {
|
||||
description: setup.description,
|
||||
default: setup.default,
|
||||
type: setup.type
|
||||
}
|
||||
|
||||
if (name === 'cwd') {
|
||||
if (command !== null) {
|
||||
return
|
||||
}
|
||||
|
||||
option.default = cwd
|
||||
option.global = true
|
||||
}
|
||||
|
||||
if (option.type === 'array') {
|
||||
option.type = 'string'
|
||||
}
|
||||
|
||||
if ('nycAlias' in setup) {
|
||||
option.alias = setup.nycAlias
|
||||
}
|
||||
|
||||
const optionName = decamelize(name, '-')
|
||||
yargs.option(optionName, option)
|
||||
if (!setup.nycCommands.includes(command)) {
|
||||
yargs.hide(optionName)
|
||||
}
|
||||
})
|
||||
},
|
||||
/* istanbul ignore next: unsure how to test this */
|
||||
suppressEPIPE (error) {
|
||||
/* Prevent dumping error when `nyc npm t|head` causes stdout to
|
||||
* be closed when reporting runs. */
|
||||
if (error.code !== 'EPIPE') {
|
||||
throw error
|
||||
}
|
||||
},
|
||||
cliWrapper (execute) {
|
||||
return argv => {
|
||||
execute(argv).catch(error => {
|
||||
try {
|
||||
console.error(error.message)
|
||||
} catch (_) {
|
||||
/* We need to run process.exit(1) even if stderr is destroyed */
|
||||
}
|
||||
|
||||
process.exit(1)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
63
node_modules/nyc/lib/commands/instrument.js
generated
vendored
Normal file
63
node_modules/nyc/lib/commands/instrument.js
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
'use strict'
|
||||
|
||||
const NYC = require('../../index.js')
|
||||
const path = require('path')
|
||||
const { promisify } = require('util')
|
||||
const resolveFrom = require('resolve-from')
|
||||
const rimraf = promisify(require('rimraf'))
|
||||
const { cliWrapper, setupOptions } = require('./helpers.js')
|
||||
|
||||
exports.command = 'instrument <input> [output]'
|
||||
|
||||
exports.describe = 'instruments a file or a directory tree and writes the instrumented code to the desired output location'
|
||||
|
||||
exports.builder = function (yargs) {
|
||||
yargs
|
||||
.demandCommand(0, 0)
|
||||
.example('$0 instrument ./lib ./output', 'instrument all .js files in ./lib with coverage and output in ./output')
|
||||
|
||||
setupOptions(yargs, 'instrument')
|
||||
}
|
||||
|
||||
exports.handler = cliWrapper(async argv => {
|
||||
if (argv.output && !argv.inPlace && (path.resolve(argv.cwd, argv.input) === path.resolve(argv.cwd, argv.output))) {
|
||||
throw new Error('cannot instrument files in place, <input> must differ from <output>. Set \'--in-place\' to force')
|
||||
}
|
||||
|
||||
if (path.relative(argv.cwd, path.resolve(argv.cwd, argv.input)).startsWith('..')) {
|
||||
throw new Error('cannot instrument files outside project root directory')
|
||||
}
|
||||
|
||||
if (argv.delete && argv.inPlace) {
|
||||
throw new Error('cannot use \'--delete\' when instrumenting files in place')
|
||||
}
|
||||
|
||||
if (argv.delete && argv.output && argv.output.length !== 0) {
|
||||
const relPath = path.relative(process.cwd(), path.resolve(argv.output))
|
||||
if (relPath !== '' && !relPath.startsWith('..')) {
|
||||
await rimraf(argv.output)
|
||||
} else {
|
||||
throw new Error(`attempt to delete '${process.cwd()}' or containing directory.`)
|
||||
}
|
||||
}
|
||||
|
||||
// If instrument is set to false enable a noop instrumenter.
|
||||
argv.instrumenter = (argv.instrument)
|
||||
? './lib/instrumenters/istanbul'
|
||||
: './lib/instrumenters/noop'
|
||||
|
||||
if (argv.inPlace) {
|
||||
argv.output = argv.input
|
||||
argv.completeCopy = false
|
||||
}
|
||||
|
||||
const nyc = new NYC(argv)
|
||||
if (!argv.useSpawnWrap) {
|
||||
nyc.require.forEach(requireModule => {
|
||||
const mod = resolveFrom.silent(nyc.cwd, requireModule) || requireModule
|
||||
require(mod)
|
||||
})
|
||||
}
|
||||
|
||||
await nyc.instrumentAllFiles(argv.input, argv.output)
|
||||
})
|
46
node_modules/nyc/lib/commands/merge.js
generated
vendored
Normal file
46
node_modules/nyc/lib/commands/merge.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
'use strict'
|
||||
const path = require('path')
|
||||
const makeDir = require('make-dir')
|
||||
const fs = require('../fs-promises')
|
||||
const { cliWrapper, setupOptions } = require('./helpers.js')
|
||||
|
||||
const NYC = require('../../index.js')
|
||||
|
||||
exports.command = 'merge <input-directory> [output-file]'
|
||||
|
||||
exports.describe = 'merge istanbul format coverage output in a given folder'
|
||||
|
||||
exports.builder = function (yargs) {
|
||||
yargs
|
||||
.demandCommand(0, 0)
|
||||
.example('$0 merge ./out coverage.json', 'merge together reports in ./out and output as coverage.json')
|
||||
.positional('input-directory', {
|
||||
describe: 'directory containing multiple istanbul coverage files',
|
||||
type: 'text',
|
||||
default: './.nyc_output'
|
||||
})
|
||||
.positional('output-file', {
|
||||
describe: 'file to output combined istanbul format coverage to',
|
||||
type: 'text',
|
||||
default: 'coverage.json'
|
||||
})
|
||||
|
||||
setupOptions(yargs, 'merge')
|
||||
yargs.default('exclude-after-remap', false)
|
||||
}
|
||||
|
||||
exports.handler = cliWrapper(async argv => {
|
||||
process.env.NYC_CWD = process.cwd()
|
||||
const nyc = new NYC(argv)
|
||||
const inputStat = await fs.stat(argv.inputDirectory).catch(error => {
|
||||
throw new Error(`failed access input directory ${argv.inputDirectory} with error:\n\n${error.message}`)
|
||||
})
|
||||
|
||||
if (!inputStat.isDirectory()) {
|
||||
throw new Error(`${argv.inputDirectory} was not a directory`)
|
||||
}
|
||||
await makeDir(path.dirname(argv.outputFile))
|
||||
const map = await nyc.getCoverageMapFromAllCoverageFiles(argv.inputDirectory)
|
||||
await fs.writeFile(argv.outputFile, JSON.stringify(map, null, 2), 'utf8')
|
||||
console.info(`coverage files in ${argv.inputDirectory} merged into ${argv.outputFile}`)
|
||||
})
|
30
node_modules/nyc/lib/commands/report.js
generated
vendored
Normal file
30
node_modules/nyc/lib/commands/report.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
'use strict'
|
||||
|
||||
const NYC = require('../../index.js')
|
||||
const { cliWrapper, suppressEPIPE, setupOptions } = require('./helpers.js')
|
||||
|
||||
exports.command = 'report'
|
||||
|
||||
exports.describe = 'run coverage report for .nyc_output'
|
||||
|
||||
exports.builder = function (yargs) {
|
||||
yargs
|
||||
.demandCommand(0, 0)
|
||||
.example('$0 report --reporter=lcov', 'output an HTML lcov report to ./coverage')
|
||||
|
||||
setupOptions(yargs, 'report')
|
||||
}
|
||||
|
||||
exports.handler = cliWrapper(async argv => {
|
||||
process.env.NYC_CWD = process.cwd()
|
||||
var nyc = new NYC(argv)
|
||||
await nyc.report().catch(suppressEPIPE)
|
||||
if (argv.checkCoverage) {
|
||||
await nyc.checkCoverage({
|
||||
lines: argv.lines,
|
||||
functions: argv.functions,
|
||||
branches: argv.branches,
|
||||
statements: argv.statements
|
||||
}, argv['per-file']).catch(suppressEPIPE)
|
||||
}
|
||||
})
|
65
node_modules/nyc/lib/config-util.js
generated
vendored
Normal file
65
node_modules/nyc/lib/config-util.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
'use strict'
|
||||
|
||||
const path = require('path')
|
||||
const findUp = require('find-up')
|
||||
const Yargs = require('yargs/yargs')
|
||||
|
||||
const { setupOptions } = require('./commands/helpers')
|
||||
const processArgs = require('./process-args')
|
||||
const { loadNycConfig } = require('@istanbuljs/load-nyc-config')
|
||||
|
||||
async function guessCWD (cwd) {
|
||||
cwd = cwd || process.env.NYC_CWD || process.cwd()
|
||||
const pkgPath = await findUp('package.json', { cwd })
|
||||
if (pkgPath) {
|
||||
cwd = path.dirname(pkgPath)
|
||||
}
|
||||
|
||||
return cwd
|
||||
}
|
||||
|
||||
async function processConfig (cwd) {
|
||||
cwd = await guessCWD(cwd)
|
||||
const yargs = Yargs([])
|
||||
.usage('$0 [command] [options]')
|
||||
.usage('$0 [options] [bin-to-instrument]')
|
||||
.showHidden(false)
|
||||
|
||||
setupOptions(yargs, null, cwd)
|
||||
|
||||
yargs
|
||||
.example('$0 npm test', 'instrument your tests with coverage')
|
||||
.example('$0 --require @babel/register npm test', 'instrument your tests with coverage and transpile with Babel')
|
||||
.example('$0 report --reporter=text-lcov', 'output lcov report after running your tests')
|
||||
.epilog('visit https://git.io/vHysA for list of available reporters')
|
||||
.boolean('h')
|
||||
.boolean('version')
|
||||
.help(false)
|
||||
.version(false)
|
||||
|
||||
const instrumenterArgs = processArgs.hideInstrumenteeArgs()
|
||||
|
||||
// This yargs.parse must come before any options that exit post-hoc
|
||||
const childArgs = processArgs.hideInstrumenterArgs(yargs.parse(process.argv.slice(2)))
|
||||
const config = await loadNycConfig(yargs.parse(instrumenterArgs))
|
||||
|
||||
yargs
|
||||
.config(config)
|
||||
.help('h')
|
||||
.alias('h', 'help')
|
||||
.version()
|
||||
.command(require('./commands/check-coverage'))
|
||||
.command(require('./commands/instrument'))
|
||||
.command(require('./commands/report'))
|
||||
.command(require('./commands/merge'))
|
||||
|
||||
return {
|
||||
get argv () {
|
||||
return yargs.parse(instrumenterArgs)
|
||||
},
|
||||
childArgs,
|
||||
yargs
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = processConfig
|
51
node_modules/nyc/lib/fs-promises.js
generated
vendored
Normal file
51
node_modules/nyc/lib/fs-promises.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('fs')
|
||||
|
||||
const { promisify } = require('util')
|
||||
|
||||
module.exports = { ...fs }
|
||||
|
||||
// Promisify all functions for consistency
|
||||
const fns = [
|
||||
'access',
|
||||
'appendFile',
|
||||
'chmod',
|
||||
'chown',
|
||||
'close',
|
||||
'copyFile',
|
||||
'fchmod',
|
||||
'fchown',
|
||||
'fdatasync',
|
||||
'fstat',
|
||||
'fsync',
|
||||
'ftruncate',
|
||||
'futimes',
|
||||
'lchmod',
|
||||
'lchown',
|
||||
'link',
|
||||
'lstat',
|
||||
'mkdir',
|
||||
'mkdtemp',
|
||||
'open',
|
||||
'read',
|
||||
'readdir',
|
||||
'readFile',
|
||||
'readlink',
|
||||
'realpath',
|
||||
'rename',
|
||||
'rmdir',
|
||||
'stat',
|
||||
'symlink',
|
||||
'truncate',
|
||||
'unlink',
|
||||
'utimes',
|
||||
'write',
|
||||
'writeFile'
|
||||
]
|
||||
fns.forEach(fn => {
|
||||
/* istanbul ignore else: all functions exist on OSX */
|
||||
if (fs[fn]) {
|
||||
module.exports[fn] = promisify(fs[fn])
|
||||
}
|
||||
})
|
30
node_modules/nyc/lib/hash.js
generated
vendored
Normal file
30
node_modules/nyc/lib/hash.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
'use strict'
|
||||
|
||||
function getInvalidatingOptions (config) {
|
||||
return [
|
||||
'compact',
|
||||
'esModules',
|
||||
'ignoreClassMethods',
|
||||
'instrument',
|
||||
'instrumenter',
|
||||
'parserPlugins',
|
||||
'preserveComments',
|
||||
'produceSourceMap',
|
||||
'sourceMap'
|
||||
].reduce((acc, optName) => {
|
||||
acc[optName] = config[optName]
|
||||
return acc
|
||||
}, {})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
salt (config) {
|
||||
return JSON.stringify({
|
||||
modules: {
|
||||
'istanbul-lib-instrument': require('istanbul-lib-instrument/package.json').version,
|
||||
nyc: require('../package.json').version
|
||||
},
|
||||
nycrc: getInvalidatingOptions(config)
|
||||
})
|
||||
}
|
||||
}
|
44
node_modules/nyc/lib/instrumenters/istanbul.js
generated
vendored
Normal file
44
node_modules/nyc/lib/instrumenters/istanbul.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
'use strict'
|
||||
|
||||
function InstrumenterIstanbul (options) {
|
||||
const { createInstrumenter } = require('istanbul-lib-instrument')
|
||||
const convertSourceMap = require('convert-source-map')
|
||||
|
||||
const instrumenter = createInstrumenter({
|
||||
autoWrap: true,
|
||||
coverageVariable: '__coverage__',
|
||||
embedSource: true,
|
||||
compact: options.compact,
|
||||
preserveComments: options.preserveComments,
|
||||
produceSourceMap: options.produceSourceMap,
|
||||
ignoreClassMethods: options.ignoreClassMethods,
|
||||
esModules: options.esModules,
|
||||
parserPlugins: options.parserPlugins
|
||||
})
|
||||
|
||||
return {
|
||||
instrumentSync (code, filename, { sourceMap, registerMap }) {
|
||||
var instrumented = instrumenter.instrumentSync(code, filename, sourceMap)
|
||||
if (instrumented !== code) {
|
||||
registerMap()
|
||||
}
|
||||
|
||||
// the instrumenter can optionally produce source maps,
|
||||
// this is useful for features like remapping stack-traces.
|
||||
if (options.produceSourceMap) {
|
||||
var lastSourceMap = instrumenter.lastSourceMap()
|
||||
/* istanbul ignore else */
|
||||
if (lastSourceMap) {
|
||||
instrumented += '\n' + convertSourceMap.fromObject(lastSourceMap).toComment()
|
||||
}
|
||||
}
|
||||
|
||||
return instrumented
|
||||
},
|
||||
lastFileCoverage () {
|
||||
return instrumenter.lastFileCoverage()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = InstrumenterIstanbul
|
22
node_modules/nyc/lib/instrumenters/noop.js
generated
vendored
Normal file
22
node_modules/nyc/lib/instrumenters/noop.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
'use strict'
|
||||
|
||||
function NOOP () {
|
||||
const { readInitialCoverage } = require('istanbul-lib-instrument')
|
||||
|
||||
return {
|
||||
instrumentSync (code, filename) {
|
||||
const extracted = readInitialCoverage(code)
|
||||
if (extracted) {
|
||||
this.fileCoverage = extracted.coverageData
|
||||
} else {
|
||||
this.fileCoverage = null
|
||||
}
|
||||
return code
|
||||
},
|
||||
lastFileCoverage () {
|
||||
return this.fileCoverage
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = NOOP
|
39
node_modules/nyc/lib/process-args.js
generated
vendored
Normal file
39
node_modules/nyc/lib/process-args.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
'use strict'
|
||||
|
||||
const { Parser } = require('yargs/yargs')
|
||||
const commands = [
|
||||
'report',
|
||||
'check-coverage',
|
||||
'instrument',
|
||||
'merge'
|
||||
]
|
||||
|
||||
module.exports = {
|
||||
// don't pass arguments that are meant
|
||||
// for nyc to the bin being instrumented.
|
||||
hideInstrumenterArgs: function (yargv) {
|
||||
var argv = process.argv.slice(1)
|
||||
argv = argv.slice(argv.indexOf(yargv._[0]))
|
||||
if (argv[0][0] === '-') {
|
||||
argv.unshift(process.execPath)
|
||||
}
|
||||
return argv
|
||||
},
|
||||
// don't pass arguments for the bin being
|
||||
// instrumented to nyc.
|
||||
hideInstrumenteeArgs: function () {
|
||||
var argv = process.argv.slice(2)
|
||||
var yargv = Parser(argv)
|
||||
if (!yargv._.length) return argv
|
||||
for (var i = 0, command; (command = yargv._[i]) !== undefined; i++) {
|
||||
if (~commands.indexOf(command)) return argv
|
||||
}
|
||||
|
||||
// drop all the arguments after the bin being
|
||||
// instrumented by nyc.
|
||||
argv = argv.slice(0, argv.indexOf(yargv._[0]))
|
||||
argv.push(yargv._[0])
|
||||
|
||||
return argv
|
||||
}
|
||||
}
|
27
node_modules/nyc/lib/register-env.js
generated
vendored
Normal file
27
node_modules/nyc/lib/register-env.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
'use strict'
|
||||
|
||||
const processOnSpawn = require('process-on-spawn')
|
||||
|
||||
const envToCopy = {}
|
||||
|
||||
processOnSpawn.addListener(({ env }) => {
|
||||
Object.assign(env, envToCopy)
|
||||
})
|
||||
|
||||
const copyAtLoad = [
|
||||
'NYC_CONFIG',
|
||||
'NYC_CWD',
|
||||
'NYC_PROCESS_ID',
|
||||
'BABEL_DISABLE_CACHE',
|
||||
'NYC_PROCESS_ID'
|
||||
]
|
||||
|
||||
for (const env of copyAtLoad) {
|
||||
if (env in process.env) {
|
||||
envToCopy[env] = process.env[env]
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = function updateVariable (envName) {
|
||||
envToCopy[envName] = process.env[envName]
|
||||
}
|
84
node_modules/nyc/lib/source-maps.js
generated
vendored
Normal file
84
node_modules/nyc/lib/source-maps.js
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
'use strict'
|
||||
|
||||
const convertSourceMap = require('convert-source-map')
|
||||
const libCoverage = require('istanbul-lib-coverage')
|
||||
const libSourceMaps = require('istanbul-lib-source-maps')
|
||||
const fs = require('./fs-promises')
|
||||
const os = require('os')
|
||||
const path = require('path')
|
||||
const pMap = require('p-map')
|
||||
|
||||
class SourceMaps {
|
||||
constructor (opts) {
|
||||
this.cache = opts.cache
|
||||
this.cacheDirectory = opts.cacheDirectory
|
||||
this.loadedMaps = {}
|
||||
this._sourceMapCache = libSourceMaps.createSourceMapStore()
|
||||
}
|
||||
|
||||
cachedPath (source, hash) {
|
||||
return path.join(
|
||||
this.cacheDirectory,
|
||||
`${path.parse(source).name}-${hash}.map`
|
||||
)
|
||||
}
|
||||
|
||||
purgeCache () {
|
||||
this._sourceMapCache = libSourceMaps.createSourceMapStore()
|
||||
this.loadedMaps = {}
|
||||
}
|
||||
|
||||
extract (code, filename) {
|
||||
const sourceMap = convertSourceMap.fromSource(code) || convertSourceMap.fromMapFileSource(code, path.dirname(filename))
|
||||
return sourceMap ? sourceMap.toObject() : undefined
|
||||
}
|
||||
|
||||
registerMap (filename, hash, sourceMap) {
|
||||
if (!sourceMap) {
|
||||
return
|
||||
}
|
||||
|
||||
if (this.cache && hash) {
|
||||
const mapPath = this.cachedPath(filename, hash)
|
||||
fs.writeFileSync(mapPath, JSON.stringify(sourceMap))
|
||||
} else {
|
||||
this._sourceMapCache.registerMap(filename, sourceMap)
|
||||
}
|
||||
}
|
||||
|
||||
async remapCoverage (obj) {
|
||||
const transformed = await this._sourceMapCache.transformCoverage(
|
||||
libCoverage.createCoverageMap(obj)
|
||||
)
|
||||
return transformed.data
|
||||
}
|
||||
|
||||
async reloadCachedSourceMaps (report) {
|
||||
await pMap(
|
||||
Object.entries(report),
|
||||
async ([absFile, fileReport]) => {
|
||||
if (!fileReport || !fileReport.contentHash) {
|
||||
return
|
||||
}
|
||||
|
||||
const hash = fileReport.contentHash
|
||||
if (!(hash in this.loadedMaps)) {
|
||||
try {
|
||||
const mapPath = this.cachedPath(absFile, hash)
|
||||
this.loadedMaps[hash] = JSON.parse(await fs.readFile(mapPath, 'utf8'))
|
||||
} catch (e) {
|
||||
// set to false to avoid repeatedly trying to load the map
|
||||
this.loadedMaps[hash] = false
|
||||
}
|
||||
}
|
||||
|
||||
if (this.loadedMaps[hash]) {
|
||||
this._sourceMapCache.registerMap(absFile, this.loadedMaps[hash])
|
||||
}
|
||||
},
|
||||
{ concurrency: os.cpus().length }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = SourceMaps
|
28
node_modules/nyc/lib/wrap.js
generated
vendored
Normal file
28
node_modules/nyc/lib/wrap.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
'use strict'
|
||||
|
||||
const NYC = require('../index.js')
|
||||
|
||||
const config = JSON.parse(
|
||||
process.env.NYC_CONFIG ||
|
||||
/* istanbul ignore next */ '{}'
|
||||
)
|
||||
|
||||
config.isChildProcess = true
|
||||
|
||||
config._processInfo = {
|
||||
pid: process.pid,
|
||||
ppid: process.ppid,
|
||||
parent: process.env.NYC_PROCESS_ID || null
|
||||
}
|
||||
|
||||
if (process.env.NYC_PROCESSINFO_EXTERNAL_ID) {
|
||||
config._processInfo.externalId = process.env.NYC_PROCESSINFO_EXTERNAL_ID
|
||||
delete process.env.NYC_PROCESSINFO_EXTERNAL_ID
|
||||
}
|
||||
|
||||
if (process.env.NYC_CONFIG_OVERRIDE) {
|
||||
Object.assign(config, JSON.parse(process.env.NYC_CONFIG_OVERRIDE))
|
||||
process.env.NYC_CONFIG = JSON.stringify(config)
|
||||
}
|
||||
|
||||
;(new NYC(config)).wrap()
|
197
node_modules/nyc/node_modules/ansi-styles/index.d.ts
generated
vendored
Normal file
197
node_modules/nyc/node_modules/ansi-styles/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,197 @@
|
||||
import * as cssColors from 'color-name';
|
||||
|
||||
declare namespace ansiStyles {
|
||||
interface ColorConvert {
|
||||
/**
|
||||
The RGB color space.
|
||||
|
||||
@param red - (`0`-`255`)
|
||||
@param green - (`0`-`255`)
|
||||
@param blue - (`0`-`255`)
|
||||
*/
|
||||
rgb(red: number, green: number, blue: number): string;
|
||||
|
||||
/**
|
||||
The RGB HEX color space.
|
||||
|
||||
@param hex - A hexadecimal string containing RGB data.
|
||||
*/
|
||||
hex(hex: string): string;
|
||||
|
||||
/**
|
||||
@param keyword - A CSS color name.
|
||||
*/
|
||||
keyword(keyword: keyof typeof cssColors): string;
|
||||
|
||||
/**
|
||||
The HSL color space.
|
||||
|
||||
@param hue - (`0`-`360`)
|
||||
@param saturation - (`0`-`100`)
|
||||
@param lightness - (`0`-`100`)
|
||||
*/
|
||||
hsl(hue: number, saturation: number, lightness: number): string;
|
||||
|
||||
/**
|
||||
The HSV color space.
|
||||
|
||||
@param hue - (`0`-`360`)
|
||||
@param saturation - (`0`-`100`)
|
||||
@param value - (`0`-`100`)
|
||||
*/
|
||||
hsv(hue: number, saturation: number, value: number): string;
|
||||
|
||||
/**
|
||||
The HSV color space.
|
||||
|
||||
@param hue - (`0`-`360`)
|
||||
@param whiteness - (`0`-`100`)
|
||||
@param blackness - (`0`-`100`)
|
||||
*/
|
||||
hwb(hue: number, whiteness: number, blackness: number): string;
|
||||
|
||||
/**
|
||||
Use a [4-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4-bit) to set text color.
|
||||
*/
|
||||
ansi(ansi: number): string;
|
||||
|
||||
/**
|
||||
Use an [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color.
|
||||
*/
|
||||
ansi256(ansi: number): string;
|
||||
}
|
||||
|
||||
interface CSPair {
|
||||
/**
|
||||
The ANSI terminal control sequence for starting this style.
|
||||
*/
|
||||
readonly open: string;
|
||||
|
||||
/**
|
||||
The ANSI terminal control sequence for ending this style.
|
||||
*/
|
||||
readonly close: string;
|
||||
}
|
||||
|
||||
interface ColorBase {
|
||||
readonly ansi: ColorConvert;
|
||||
readonly ansi256: ColorConvert;
|
||||
readonly ansi16m: ColorConvert;
|
||||
|
||||
/**
|
||||
The ANSI terminal control sequence for ending this color.
|
||||
*/
|
||||
readonly close: string;
|
||||
}
|
||||
|
||||
interface Modifier {
|
||||
/**
|
||||
Resets the current color chain.
|
||||
*/
|
||||
readonly reset: CSPair;
|
||||
|
||||
/**
|
||||
Make text bold.
|
||||
*/
|
||||
readonly bold: CSPair;
|
||||
|
||||
/**
|
||||
Emitting only a small amount of light.
|
||||
*/
|
||||
readonly dim: CSPair;
|
||||
|
||||
/**
|
||||
Make text italic. (Not widely supported)
|
||||
*/
|
||||
readonly italic: CSPair;
|
||||
|
||||
/**
|
||||
Make text underline. (Not widely supported)
|
||||
*/
|
||||
readonly underline: CSPair;
|
||||
|
||||
/**
|
||||
Inverse background and foreground colors.
|
||||
*/
|
||||
readonly inverse: CSPair;
|
||||
|
||||
/**
|
||||
Prints the text, but makes it invisible.
|
||||
*/
|
||||
readonly hidden: CSPair;
|
||||
|
||||
/**
|
||||
Puts a horizontal line through the center of the text. (Not widely supported)
|
||||
*/
|
||||
readonly strikethrough: CSPair;
|
||||
}
|
||||
|
||||
interface ForegroundColor {
|
||||
readonly black: CSPair;
|
||||
readonly red: CSPair;
|
||||
readonly green: CSPair;
|
||||
readonly yellow: CSPair;
|
||||
readonly blue: CSPair;
|
||||
readonly cyan: CSPair;
|
||||
readonly magenta: CSPair;
|
||||
readonly white: CSPair;
|
||||
|
||||
/**
|
||||
Alias for `blackBright`.
|
||||
*/
|
||||
readonly gray: CSPair;
|
||||
|
||||
/**
|
||||
Alias for `blackBright`.
|
||||
*/
|
||||
readonly grey: CSPair;
|
||||
|
||||
readonly blackBright: CSPair;
|
||||
readonly redBright: CSPair;
|
||||
readonly greenBright: CSPair;
|
||||
readonly yellowBright: CSPair;
|
||||
readonly blueBright: CSPair;
|
||||
readonly cyanBright: CSPair;
|
||||
readonly magentaBright: CSPair;
|
||||
readonly whiteBright: CSPair;
|
||||
}
|
||||
|
||||
interface BackgroundColor {
|
||||
readonly bgBlack: CSPair;
|
||||
readonly bgRed: CSPair;
|
||||
readonly bgGreen: CSPair;
|
||||
readonly bgYellow: CSPair;
|
||||
readonly bgBlue: CSPair;
|
||||
readonly bgCyan: CSPair;
|
||||
readonly bgMagenta: CSPair;
|
||||
readonly bgWhite: CSPair;
|
||||
|
||||
/**
|
||||
Alias for `bgBlackBright`.
|
||||
*/
|
||||
readonly bgGray: CSPair;
|
||||
|
||||
/**
|
||||
Alias for `bgBlackBright`.
|
||||
*/
|
||||
readonly bgGrey: CSPair;
|
||||
|
||||
readonly bgBlackBright: CSPair;
|
||||
readonly bgRedBright: CSPair;
|
||||
readonly bgGreenBright: CSPair;
|
||||
readonly bgYellowBright: CSPair;
|
||||
readonly bgBlueBright: CSPair;
|
||||
readonly bgCyanBright: CSPair;
|
||||
readonly bgMagentaBright: CSPair;
|
||||
readonly bgWhiteBright: CSPair;
|
||||
}
|
||||
}
|
||||
|
||||
declare const ansiStyles: {
|
||||
readonly modifier: ansiStyles.Modifier;
|
||||
readonly color: ansiStyles.ForegroundColor & ansiStyles.ColorBase;
|
||||
readonly bgColor: ansiStyles.BackgroundColor & ansiStyles.ColorBase;
|
||||
readonly codes: ReadonlyMap<number, number>;
|
||||
} & ansiStyles.BackgroundColor & ansiStyles.ForegroundColor & ansiStyles.Modifier;
|
||||
|
||||
export = ansiStyles;
|
163
node_modules/nyc/node_modules/ansi-styles/index.js
generated
vendored
Normal file
163
node_modules/nyc/node_modules/ansi-styles/index.js
generated
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
'use strict';
|
||||
|
||||
const wrapAnsi16 = (fn, offset) => (...args) => {
|
||||
const code = fn(...args);
|
||||
return `\u001B[${code + offset}m`;
|
||||
};
|
||||
|
||||
const wrapAnsi256 = (fn, offset) => (...args) => {
|
||||
const code = fn(...args);
|
||||
return `\u001B[${38 + offset};5;${code}m`;
|
||||
};
|
||||
|
||||
const wrapAnsi16m = (fn, offset) => (...args) => {
|
||||
const rgb = fn(...args);
|
||||
return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
|
||||
};
|
||||
|
||||
const ansi2ansi = n => n;
|
||||
const rgb2rgb = (r, g, b) => [r, g, b];
|
||||
|
||||
const setLazyProperty = (object, property, get) => {
|
||||
Object.defineProperty(object, property, {
|
||||
get: () => {
|
||||
const value = get();
|
||||
|
||||
Object.defineProperty(object, property, {
|
||||
value,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
return value;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
};
|
||||
|
||||
/** @type {typeof import('color-convert')} */
|
||||
let colorConvert;
|
||||
const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
|
||||
if (colorConvert === undefined) {
|
||||
colorConvert = require('color-convert');
|
||||
}
|
||||
|
||||
const offset = isBackground ? 10 : 0;
|
||||
const styles = {};
|
||||
|
||||
for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
|
||||
const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
|
||||
if (sourceSpace === targetSpace) {
|
||||
styles[name] = wrap(identity, offset);
|
||||
} else if (typeof suite === 'object') {
|
||||
styles[name] = wrap(suite[targetSpace], offset);
|
||||
}
|
||||
}
|
||||
|
||||
return styles;
|
||||
};
|
||||
|
||||
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],
|
||||
|
||||
// Bright color
|
||||
blackBright: [90, 39],
|
||||
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]
|
||||
}
|
||||
};
|
||||
|
||||
// Alias bright black as gray (and grey)
|
||||
styles.color.gray = styles.color.blackBright;
|
||||
styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
|
||||
styles.color.grey = styles.color.blackBright;
|
||||
styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
|
||||
|
||||
for (const [groupName, group] of Object.entries(styles)) {
|
||||
for (const [styleName, style] of Object.entries(group)) {
|
||||
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
|
||||
});
|
||||
|
||||
styles.color.close = '\u001B[39m';
|
||||
styles.bgColor.close = '\u001B[49m';
|
||||
|
||||
setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));
|
||||
setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));
|
||||
setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));
|
||||
setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));
|
||||
setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));
|
||||
setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));
|
||||
|
||||
return styles;
|
||||
}
|
||||
|
||||
// Make the export immutable
|
||||
Object.defineProperty(module, 'exports', {
|
||||
enumerable: true,
|
||||
get: assembleStyles
|
||||
});
|
9
node_modules/nyc/node_modules/ansi-styles/license
generated
vendored
Normal file
9
node_modules/nyc/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.
|
57
node_modules/nyc/node_modules/ansi-styles/package.json
generated
vendored
Normal file
57
node_modules/nyc/node_modules/ansi-styles/package.json
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"name": "ansi-styles",
|
||||
"version": "4.2.1",
|
||||
"description": "ANSI escape codes for styling strings in the terminal",
|
||||
"license": "MIT",
|
||||
"repository": "chalk/ansi-styles",
|
||||
"funding": "https://github.com/chalk/ansi-styles?sponsor=1",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd",
|
||||
"screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"ansi",
|
||||
"styles",
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"tty",
|
||||
"escape",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"log",
|
||||
"logging",
|
||||
"command-line",
|
||||
"text"
|
||||
],
|
||||
"dependencies": {
|
||||
"@types/color-name": "^1.1.1",
|
||||
"color-convert": "^2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/color-convert": "^1.9.0",
|
||||
"ava": "^2.3.0",
|
||||
"svg-term-cli": "^2.1.1",
|
||||
"tsd": "^0.11.0",
|
||||
"xo": "^0.25.3"
|
||||
}
|
||||
}
|
158
node_modules/nyc/node_modules/ansi-styles/readme.md
generated
vendored
Normal file
158
node_modules/nyc/node_modules/ansi-styles/readme.md
generated
vendored
Normal file
@@ -0,0 +1,158 @@
|
||||
# ansi-styles [](https://travis-ci.org/chalk/ansi-styles)
|
||||
|
||||
> [ANSI escape codes](https://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="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`
|
||||
- `blackBright` (alias: `gray`, `grey`)
|
||||
- `redBright`
|
||||
- `greenBright`
|
||||
- `yellowBright`
|
||||
- `blueBright`
|
||||
- `magentaBright`
|
||||
- `cyanBright`
|
||||
- `whiteBright`
|
||||
|
||||
### Background colors
|
||||
|
||||
- `bgBlack`
|
||||
- `bgRed`
|
||||
- `bgGreen`
|
||||
- `bgYellow`
|
||||
- `bgBlue`
|
||||
- `bgMagenta`
|
||||
- `bgCyan`
|
||||
- `bgWhite`
|
||||
- `bgBlackBright` (alias: `bgGray`, `bgGrey`)
|
||||
- `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.
|
||||
|
||||
The following color spaces from `color-convert` are supported:
|
||||
|
||||
- `rgb`
|
||||
- `hex`
|
||||
- `keyword`
|
||||
- `hsl`
|
||||
- `hsv`
|
||||
- `hwb`
|
||||
- `ansi`
|
||||
- `ansi256`
|
||||
|
||||
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-)
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-ansi-styles?utm_source=npm-ansi-styles&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
76
node_modules/nyc/node_modules/cliui/CHANGELOG.md
generated
vendored
Normal file
76
node_modules/nyc/node_modules/cliui/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
# 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.
|
||||
|
||||
## [6.0.0](https://www.github.com/yargs/cliui/compare/v5.0.0...v6.0.0) (2019-11-10)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* update deps, drop Node 6
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
* update deps, drop Node 6 ([62056df](https://www.github.com/yargs/cliui/commit/62056df))
|
||||
|
||||
## [5.0.0](https://github.com/yargs/cliui/compare/v4.1.0...v5.0.0) (2019-04-10)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Update wrap-ansi to fix compatibility with latest versions of chalk. ([#60](https://github.com/yargs/cliui/issues/60)) ([7bf79ae](https://github.com/yargs/cliui/commit/7bf79ae))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* Drop support for node < 6.
|
||||
|
||||
|
||||
|
||||
<a name="4.1.0"></a>
|
||||
## [4.1.0](https://github.com/yargs/cliui/compare/v4.0.0...v4.1.0) (2018-04-23)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add resetOutput method ([#57](https://github.com/yargs/cliui/issues/57)) ([7246902](https://github.com/yargs/cliui/commit/7246902))
|
||||
|
||||
|
||||
|
||||
<a name="4.0.0"></a>
|
||||
## [4.0.0](https://github.com/yargs/cliui/compare/v3.2.0...v4.0.0) (2017-12-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* downgrades strip-ansi to version 3.0.1 ([#54](https://github.com/yargs/cliui/issues/54)) ([5764c46](https://github.com/yargs/cliui/commit/5764c46))
|
||||
* set env variable FORCE_COLOR. ([#56](https://github.com/yargs/cliui/issues/56)) ([7350e36](https://github.com/yargs/cliui/commit/7350e36))
|
||||
|
||||
|
||||
### Chores
|
||||
|
||||
* drop support for node < 4 ([#53](https://github.com/yargs/cliui/issues/53)) ([b105376](https://github.com/yargs/cliui/commit/b105376))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add fallback for window width ([#45](https://github.com/yargs/cliui/issues/45)) ([d064922](https://github.com/yargs/cliui/commit/d064922))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* officially drop support for Node < 4
|
||||
|
||||
|
||||
|
||||
<a name="3.2.0"></a>
|
||||
## [3.2.0](https://github.com/yargs/cliui/compare/v3.1.2...v3.2.0) (2016-04-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* reduces tarball size ([acc6c33](https://github.com/yargs/cliui/commit/acc6c33))
|
||||
|
||||
### Features
|
||||
|
||||
* adds standard-version for release management ([ff84e32](https://github.com/yargs/cliui/commit/ff84e32))
|
14
node_modules/nyc/node_modules/cliui/LICENSE.txt
generated
vendored
Normal file
14
node_modules/nyc/node_modules/cliui/LICENSE.txt
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
Copyright (c) 2015, 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.
|
115
node_modules/nyc/node_modules/cliui/README.md
generated
vendored
Normal file
115
node_modules/nyc/node_modules/cliui/README.md
generated
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
# cliui
|
||||
|
||||
[](https://travis-ci.org/yargs/cliui)
|
||||
[](https://coveralls.io/r/yargs/cliui?branch=)
|
||||
[](https://www.npmjs.com/package/cliui)
|
||||
[](https://github.com/conventional-changelog/standard-version)
|
||||
|
||||
easily create complex multi-column command-line-interfaces.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var ui = require('cliui')()
|
||||
|
||||
ui.div('Usage: $0 [command] [options]')
|
||||
|
||||
ui.div({
|
||||
text: 'Options:',
|
||||
padding: [2, 0, 2, 0]
|
||||
})
|
||||
|
||||
ui.div(
|
||||
{
|
||||
text: "-f, --file",
|
||||
width: 20,
|
||||
padding: [0, 4, 0, 4]
|
||||
},
|
||||
{
|
||||
text: "the file to load." +
|
||||
chalk.green("(if this description is long it wraps).")
|
||||
,
|
||||
width: 20
|
||||
},
|
||||
{
|
||||
text: chalk.red("[required]"),
|
||||
align: 'right'
|
||||
}
|
||||
)
|
||||
|
||||
console.log(ui.toString())
|
||||
```
|
||||
|
||||
<img width="500" src="screenshot.png">
|
||||
|
||||
## Layout DSL
|
||||
|
||||
cliui exposes a simple layout DSL:
|
||||
|
||||
If you create a single `ui.div`, passing a string rather than an
|
||||
object:
|
||||
|
||||
* `\n`: characters will be interpreted as new rows.
|
||||
* `\t`: characters will be interpreted as new columns.
|
||||
* `\s`: characters will be interpreted as padding.
|
||||
|
||||
**as an example...**
|
||||
|
||||
```js
|
||||
var ui = require('./')({
|
||||
width: 60
|
||||
})
|
||||
|
||||
ui.div(
|
||||
'Usage: node ./bin/foo.js\n' +
|
||||
' <regex>\t provide a regex\n' +
|
||||
' <glob>\t provide a glob\t [required]'
|
||||
)
|
||||
|
||||
console.log(ui.toString())
|
||||
```
|
||||
|
||||
**will output:**
|
||||
|
||||
```shell
|
||||
Usage: node ./bin/foo.js
|
||||
<regex> provide a regex
|
||||
<glob> provide a glob [required]
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
```js
|
||||
cliui = require('cliui')
|
||||
```
|
||||
|
||||
### cliui({width: integer})
|
||||
|
||||
Specify the maximum width of the UI being generated.
|
||||
If no width is provided, cliui will try to get the current window's width and use it, and if that doesn't work, width will be set to `80`.
|
||||
|
||||
### cliui({wrap: boolean})
|
||||
|
||||
Enable or disable the wrapping of text in a column.
|
||||
|
||||
### cliui.div(column, column, column)
|
||||
|
||||
Create a row with any number of columns, a column
|
||||
can either be a string, or an object with the following
|
||||
options:
|
||||
|
||||
* **text:** some text to place in the column.
|
||||
* **width:** the width of a column.
|
||||
* **align:** alignment, `right` or `center`.
|
||||
* **padding:** `[top, right, bottom, left]`.
|
||||
* **border:** should a border be placed around the div?
|
||||
|
||||
### cliui.span(column, column, column)
|
||||
|
||||
Similar to `div`, except the next row will be appended without
|
||||
a new line being created.
|
||||
|
||||
### cliui.resetOutput()
|
||||
|
||||
Resets the UI elements of the current cliui instance, maintaining the values
|
||||
set for `width` and `wrap`.
|
354
node_modules/nyc/node_modules/cliui/index.js
generated
vendored
Normal file
354
node_modules/nyc/node_modules/cliui/index.js
generated
vendored
Normal file
@@ -0,0 +1,354 @@
|
||||
'use strict'
|
||||
|
||||
const stringWidth = require('string-width')
|
||||
const stripAnsi = require('strip-ansi')
|
||||
const wrap = require('wrap-ansi')
|
||||
|
||||
const align = {
|
||||
right: alignRight,
|
||||
center: alignCenter
|
||||
}
|
||||
const top = 0
|
||||
const right = 1
|
||||
const bottom = 2
|
||||
const left = 3
|
||||
|
||||
class UI {
|
||||
constructor (opts) {
|
||||
this.width = opts.width
|
||||
this.wrap = opts.wrap
|
||||
this.rows = []
|
||||
}
|
||||
|
||||
span (...args) {
|
||||
const cols = this.div(...args)
|
||||
cols.span = true
|
||||
}
|
||||
|
||||
resetOutput () {
|
||||
this.rows = []
|
||||
}
|
||||
|
||||
div (...args) {
|
||||
if (args.length === 0) {
|
||||
this.div('')
|
||||
}
|
||||
|
||||
if (this.wrap && this._shouldApplyLayoutDSL(...args)) {
|
||||
return this._applyLayoutDSL(args[0])
|
||||
}
|
||||
|
||||
const cols = args.map(arg => {
|
||||
if (typeof arg === 'string') {
|
||||
return this._colFromString(arg)
|
||||
}
|
||||
|
||||
return arg
|
||||
})
|
||||
|
||||
this.rows.push(cols)
|
||||
return cols
|
||||
}
|
||||
|
||||
_shouldApplyLayoutDSL (...args) {
|
||||
return args.length === 1 && typeof args[0] === 'string' &&
|
||||
/[\t\n]/.test(args[0])
|
||||
}
|
||||
|
||||
_applyLayoutDSL (str) {
|
||||
const rows = str.split('\n').map(row => row.split('\t'))
|
||||
let leftColumnWidth = 0
|
||||
|
||||
// simple heuristic for layout, make sure the
|
||||
// second column lines up along the left-hand.
|
||||
// don't allow the first column to take up more
|
||||
// than 50% of the screen.
|
||||
rows.forEach(columns => {
|
||||
if (columns.length > 1 && stringWidth(columns[0]) > leftColumnWidth) {
|
||||
leftColumnWidth = Math.min(
|
||||
Math.floor(this.width * 0.5),
|
||||
stringWidth(columns[0])
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
// generate a table:
|
||||
// replacing ' ' with padding calculations.
|
||||
// using the algorithmically generated width.
|
||||
rows.forEach(columns => {
|
||||
this.div(...columns.map((r, i) => {
|
||||
return {
|
||||
text: r.trim(),
|
||||
padding: this._measurePadding(r),
|
||||
width: (i === 0 && columns.length > 1) ? leftColumnWidth : undefined
|
||||
}
|
||||
}))
|
||||
})
|
||||
|
||||
return this.rows[this.rows.length - 1]
|
||||
}
|
||||
|
||||
_colFromString (text) {
|
||||
return {
|
||||
text,
|
||||
padding: this._measurePadding(text)
|
||||
}
|
||||
}
|
||||
|
||||
_measurePadding (str) {
|
||||
// measure padding without ansi escape codes
|
||||
const noAnsi = stripAnsi(str)
|
||||
return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length]
|
||||
}
|
||||
|
||||
toString () {
|
||||
const lines = []
|
||||
|
||||
this.rows.forEach(row => {
|
||||
this.rowToString(row, lines)
|
||||
})
|
||||
|
||||
// don't display any lines with the
|
||||
// hidden flag set.
|
||||
return lines
|
||||
.filter(line => !line.hidden)
|
||||
.map(line => line.text)
|
||||
.join('\n')
|
||||
}
|
||||
|
||||
rowToString (row, lines) {
|
||||
this._rasterize(row).forEach((rrow, r) => {
|
||||
let str = ''
|
||||
rrow.forEach((col, c) => {
|
||||
const { width } = row[c] // the width with padding.
|
||||
const wrapWidth = this._negatePadding(row[c]) // the width without padding.
|
||||
|
||||
let ts = col // temporary string used during alignment/padding.
|
||||
|
||||
if (wrapWidth > stringWidth(col)) {
|
||||
ts += ' '.repeat(wrapWidth - stringWidth(col))
|
||||
}
|
||||
|
||||
// align the string within its column.
|
||||
if (row[c].align && row[c].align !== 'left' && this.wrap) {
|
||||
ts = align[row[c].align](ts, wrapWidth)
|
||||
if (stringWidth(ts) < wrapWidth) {
|
||||
ts += ' '.repeat(width - stringWidth(ts) - 1)
|
||||
}
|
||||
}
|
||||
|
||||
// apply border and padding to string.
|
||||
const padding = row[c].padding || [0, 0, 0, 0]
|
||||
if (padding[left]) {
|
||||
str += ' '.repeat(padding[left])
|
||||
}
|
||||
|
||||
str += addBorder(row[c], ts, '| ')
|
||||
str += ts
|
||||
str += addBorder(row[c], ts, ' |')
|
||||
if (padding[right]) {
|
||||
str += ' '.repeat(padding[right])
|
||||
}
|
||||
|
||||
// if prior row is span, try to render the
|
||||
// current row on the prior line.
|
||||
if (r === 0 && lines.length > 0) {
|
||||
str = this._renderInline(str, lines[lines.length - 1])
|
||||
}
|
||||
})
|
||||
|
||||
// remove trailing whitespace.
|
||||
lines.push({
|
||||
text: str.replace(/ +$/, ''),
|
||||
span: row.span
|
||||
})
|
||||
})
|
||||
|
||||
return lines
|
||||
}
|
||||
|
||||
// if the full 'source' can render in
|
||||
// the target line, do so.
|
||||
_renderInline (source, previousLine) {
|
||||
const leadingWhitespace = source.match(/^ */)[0].length
|
||||
const target = previousLine.text
|
||||
const targetTextWidth = stringWidth(target.trimRight())
|
||||
|
||||
if (!previousLine.span) {
|
||||
return source
|
||||
}
|
||||
|
||||
// if we're not applying wrapping logic,
|
||||
// just always append to the span.
|
||||
if (!this.wrap) {
|
||||
previousLine.hidden = true
|
||||
return target + source
|
||||
}
|
||||
|
||||
if (leadingWhitespace < targetTextWidth) {
|
||||
return source
|
||||
}
|
||||
|
||||
previousLine.hidden = true
|
||||
|
||||
return target.trimRight() + ' '.repeat(leadingWhitespace - targetTextWidth) + source.trimLeft()
|
||||
}
|
||||
|
||||
_rasterize (row) {
|
||||
const rrows = []
|
||||
const widths = this._columnWidths(row)
|
||||
let wrapped
|
||||
|
||||
// word wrap all columns, and create
|
||||
// a data-structure that is easy to rasterize.
|
||||
row.forEach((col, c) => {
|
||||
// leave room for left and right padding.
|
||||
col.width = widths[c]
|
||||
if (this.wrap) {
|
||||
wrapped = wrap(col.text, this._negatePadding(col), { hard: true }).split('\n')
|
||||
} else {
|
||||
wrapped = col.text.split('\n')
|
||||
}
|
||||
|
||||
if (col.border) {
|
||||
wrapped.unshift('.' + '-'.repeat(this._negatePadding(col) + 2) + '.')
|
||||
wrapped.push("'" + '-'.repeat(this._negatePadding(col) + 2) + "'")
|
||||
}
|
||||
|
||||
// add top and bottom padding.
|
||||
if (col.padding) {
|
||||
wrapped.unshift(...new Array(col.padding[top] || 0).fill(''))
|
||||
wrapped.push(...new Array(col.padding[bottom] || 0).fill(''))
|
||||
}
|
||||
|
||||
wrapped.forEach((str, r) => {
|
||||
if (!rrows[r]) {
|
||||
rrows.push([])
|
||||
}
|
||||
|
||||
const rrow = rrows[r]
|
||||
|
||||
for (let i = 0; i < c; i++) {
|
||||
if (rrow[i] === undefined) {
|
||||
rrow.push('')
|
||||
}
|
||||
}
|
||||
|
||||
rrow.push(str)
|
||||
})
|
||||
})
|
||||
|
||||
return rrows
|
||||
}
|
||||
|
||||
_negatePadding (col) {
|
||||
let wrapWidth = col.width
|
||||
if (col.padding) {
|
||||
wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0)
|
||||
}
|
||||
|
||||
if (col.border) {
|
||||
wrapWidth -= 4
|
||||
}
|
||||
|
||||
return wrapWidth
|
||||
}
|
||||
|
||||
_columnWidths (row) {
|
||||
if (!this.wrap) {
|
||||
return row.map(col => {
|
||||
return col.width || stringWidth(col.text)
|
||||
})
|
||||
}
|
||||
|
||||
let unset = row.length
|
||||
let remainingWidth = this.width
|
||||
|
||||
// column widths can be set in config.
|
||||
const widths = row.map(col => {
|
||||
if (col.width) {
|
||||
unset--
|
||||
remainingWidth -= col.width
|
||||
return col.width
|
||||
}
|
||||
|
||||
return undefined
|
||||
})
|
||||
|
||||
// any unset widths should be calculated.
|
||||
const unsetWidth = unset ? Math.floor(remainingWidth / unset) : 0
|
||||
|
||||
return widths.map((w, i) => {
|
||||
if (w === undefined) {
|
||||
return Math.max(unsetWidth, _minWidth(row[i]))
|
||||
}
|
||||
|
||||
return w
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function addBorder (col, ts, style) {
|
||||
if (col.border) {
|
||||
if (/[.']-+[.']/.test(ts)) {
|
||||
return ''
|
||||
}
|
||||
|
||||
if (ts.trim().length !== 0) {
|
||||
return style
|
||||
}
|
||||
|
||||
return ' '
|
||||
}
|
||||
|
||||
return ''
|
||||
}
|
||||
|
||||
// calculates the minimum width of
|
||||
// a column, based on padding preferences.
|
||||
function _minWidth (col) {
|
||||
const padding = col.padding || []
|
||||
const minWidth = 1 + (padding[left] || 0) + (padding[right] || 0)
|
||||
if (col.border) {
|
||||
return minWidth + 4
|
||||
}
|
||||
|
||||
return minWidth
|
||||
}
|
||||
|
||||
function getWindowWidth () {
|
||||
/* istanbul ignore next: depends on terminal */
|
||||
if (typeof process === 'object' && process.stdout && process.stdout.columns) {
|
||||
return process.stdout.columns
|
||||
}
|
||||
}
|
||||
|
||||
function alignRight (str, width) {
|
||||
str = str.trim()
|
||||
const strWidth = stringWidth(str)
|
||||
|
||||
if (strWidth < width) {
|
||||
return ' '.repeat(width - strWidth) + str
|
||||
}
|
||||
|
||||
return str
|
||||
}
|
||||
|
||||
function alignCenter (str, width) {
|
||||
str = str.trim()
|
||||
const strWidth = stringWidth(str)
|
||||
|
||||
/* istanbul ignore next */
|
||||
if (strWidth >= width) {
|
||||
return str
|
||||
}
|
||||
|
||||
return ' '.repeat((width - strWidth) >> 1) + str
|
||||
}
|
||||
|
||||
module.exports = function (opts = {}) {
|
||||
return new UI({
|
||||
width: opts.width || getWindowWidth() || /* istanbul ignore next */ 80,
|
||||
wrap: opts.wrap !== false
|
||||
})
|
||||
}
|
65
node_modules/nyc/node_modules/cliui/package.json
generated
vendored
Normal file
65
node_modules/nyc/node_modules/cliui/package.json
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"name": "cliui",
|
||||
"version": "6.0.0",
|
||||
"description": "easily create complex multi-column command-line-interfaces",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"pretest": "standard",
|
||||
"test": "nyc mocha",
|
||||
"coverage": "nyc --reporter=text-lcov mocha | coveralls"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "http://github.com/yargs/cliui.git"
|
||||
},
|
||||
"config": {
|
||||
"blanket": {
|
||||
"pattern": [
|
||||
"index.js"
|
||||
],
|
||||
"data-cover-never": [
|
||||
"node_modules",
|
||||
"test"
|
||||
],
|
||||
"output-reporter": "spec"
|
||||
}
|
||||
},
|
||||
"standard": {
|
||||
"ignore": [
|
||||
"**/example/**"
|
||||
],
|
||||
"globals": [
|
||||
"it"
|
||||
]
|
||||
},
|
||||
"keywords": [
|
||||
"cli",
|
||||
"command-line",
|
||||
"layout",
|
||||
"design",
|
||||
"console",
|
||||
"wrap",
|
||||
"table"
|
||||
],
|
||||
"author": "Ben Coe <ben@npmjs.com>",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"string-width": "^4.2.0",
|
||||
"strip-ansi": "^6.0.0",
|
||||
"wrap-ansi": "^6.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "^4.2.0",
|
||||
"chalk": "^3.0.0",
|
||||
"coveralls": "^3.0.3",
|
||||
"mocha": "^6.2.2",
|
||||
"nyc": "^14.1.1",
|
||||
"standard": "^12.0.1"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"engine": {
|
||||
"node": ">=8"
|
||||
}
|
||||
}
|
54
node_modules/nyc/node_modules/color-convert/CHANGELOG.md
generated
vendored
Normal file
54
node_modules/nyc/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/nyc/node_modules/color-convert/LICENSE
generated
vendored
Normal file
21
node_modules/nyc/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/nyc/node_modules/color-convert/README.md
generated
vendored
Normal file
68
node_modules/nyc/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).
|
839
node_modules/nyc/node_modules/color-convert/conversions.js
generated
vendored
Normal file
839
node_modules/nyc/node_modules/color-convert/conversions.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
81
node_modules/nyc/node_modules/color-convert/index.js
generated
vendored
Normal file
81
node_modules/nyc/node_modules/color-convert/index.js
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
const conversions = require('./conversions');
|
||||
const route = require('./route');
|
||||
|
||||
const convert = {};
|
||||
|
||||
const models = Object.keys(conversions);
|
||||
|
||||
function wrapRaw(fn) {
|
||||
const wrappedFn = function (...args) {
|
||||
const arg0 = args[0];
|
||||
if (arg0 === undefined || arg0 === null) {
|
||||
return arg0;
|
||||
}
|
||||
|
||||
if (arg0.length > 1) {
|
||||
args = arg0;
|
||||
}
|
||||
|
||||
return fn(args);
|
||||
};
|
||||
|
||||
// Preserve .conversion property if there is one
|
||||
if ('conversion' in fn) {
|
||||
wrappedFn.conversion = fn.conversion;
|
||||
}
|
||||
|
||||
return wrappedFn;
|
||||
}
|
||||
|
||||
function wrapRounded(fn) {
|
||||
const wrappedFn = function (...args) {
|
||||
const arg0 = args[0];
|
||||
|
||||
if (arg0 === undefined || arg0 === null) {
|
||||
return arg0;
|
||||
}
|
||||
|
||||
if (arg0.length > 1) {
|
||||
args = arg0;
|
||||
}
|
||||
|
||||
const 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 (let 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(fromModel => {
|
||||
convert[fromModel] = {};
|
||||
|
||||
Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
|
||||
Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
|
||||
|
||||
const routes = route(fromModel);
|
||||
const routeModels = Object.keys(routes);
|
||||
|
||||
routeModels.forEach(toModel => {
|
||||
const fn = routes[toModel];
|
||||
|
||||
convert[fromModel][toModel] = wrapRounded(fn);
|
||||
convert[fromModel][toModel].raw = wrapRaw(fn);
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = convert;
|
48
node_modules/nyc/node_modules/color-convert/package.json
generated
vendored
Normal file
48
node_modules/nyc/node_modules/color-convert/package.json
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "color-convert",
|
||||
"description": "Plain color conversion functions",
|
||||
"version": "2.0.1",
|
||||
"author": "Heather Arthur <fayearthur@gmail.com>",
|
||||
"license": "MIT",
|
||||
"repository": "Qix-/color-convert",
|
||||
"scripts": {
|
||||
"pretest": "xo",
|
||||
"test": "node test/basic.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=7.0.0"
|
||||
},
|
||||
"keywords": [
|
||||
"color",
|
||||
"colour",
|
||||
"convert",
|
||||
"converter",
|
||||
"conversion",
|
||||
"rgb",
|
||||
"hsl",
|
||||
"hsv",
|
||||
"hwb",
|
||||
"cmyk",
|
||||
"ansi",
|
||||
"ansi16"
|
||||
],
|
||||
"files": [
|
||||
"index.js",
|
||||
"conversions.js",
|
||||
"route.js"
|
||||
],
|
||||
"xo": {
|
||||
"rules": {
|
||||
"default-case": 0,
|
||||
"no-inline-comments": 0,
|
||||
"operator-linebreak": 0
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"chalk": "^2.4.2",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"color-name": "~1.1.4"
|
||||
}
|
||||
}
|
97
node_modules/nyc/node_modules/color-convert/route.js
generated
vendored
Normal file
97
node_modules/nyc/node_modules/color-convert/route.js
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
const 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() {
|
||||
const graph = {};
|
||||
// https://jsperf.com/object-keys-vs-for-in-with-closure/3
|
||||
const models = Object.keys(conversions);
|
||||
|
||||
for (let 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) {
|
||||
const graph = buildGraph();
|
||||
const queue = [fromModel]; // Unshift -> queue -> pop
|
||||
|
||||
graph[fromModel].distance = 0;
|
||||
|
||||
while (queue.length) {
|
||||
const current = queue.pop();
|
||||
const adjacents = Object.keys(conversions[current]);
|
||||
|
||||
for (let len = adjacents.length, i = 0; i < len; i++) {
|
||||
const adjacent = adjacents[i];
|
||||
const 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) {
|
||||
const path = [graph[toModel].parent, toModel];
|
||||
let fn = conversions[graph[toModel].parent][toModel];
|
||||
|
||||
let 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) {
|
||||
const graph = deriveBFS(fromModel);
|
||||
const conversion = {};
|
||||
|
||||
const models = Object.keys(graph);
|
||||
for (let len = models.length, i = 0; i < len; i++) {
|
||||
const toModel = models[i];
|
||||
const 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;
|
||||
};
|
||||
|
8
node_modules/nyc/node_modules/color-name/LICENSE
generated
vendored
Normal file
8
node_modules/nyc/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/nyc/node_modules/color-name/README.md
generated
vendored
Normal file
11
node_modules/nyc/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/nyc/node_modules/color-name/index.js
generated
vendored
Normal file
152
node_modules/nyc/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]
|
||||
};
|
28
node_modules/nyc/node_modules/color-name/package.json
generated
vendored
Normal file
28
node_modules/nyc/node_modules/color-name/package.json
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "color-name",
|
||||
"version": "1.1.4",
|
||||
"description": "A list of color names and its values",
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "node test.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:colorjs/color-name.git"
|
||||
},
|
||||
"keywords": [
|
||||
"color-name",
|
||||
"color",
|
||||
"color-keyword",
|
||||
"keyword"
|
||||
],
|
||||
"author": "DY <dfcreative@gmail.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/colorjs/color-name/issues"
|
||||
},
|
||||
"homepage": "https://github.com/colorjs/color-name"
|
||||
}
|
67
node_modules/nyc/node_modules/find-cache-dir/index.js
generated
vendored
Normal file
67
node_modules/nyc/node_modules/find-cache-dir/index.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const commonDir = require('commondir');
|
||||
const pkgDir = require('pkg-dir');
|
||||
const makeDir = require('make-dir');
|
||||
|
||||
const {env, cwd} = process;
|
||||
|
||||
const isWritable = path => {
|
||||
try {
|
||||
fs.accessSync(path, fs.constants.W_OK);
|
||||
return true;
|
||||
} catch (_) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
function useDirectory(directory, options) {
|
||||
if (options.create) {
|
||||
makeDir.sync(directory);
|
||||
}
|
||||
|
||||
if (options.thunk) {
|
||||
return (...arguments_) => path.join(directory, ...arguments_);
|
||||
}
|
||||
|
||||
return directory;
|
||||
}
|
||||
|
||||
function getNodeModuleDirectory(directory) {
|
||||
const nodeModules = path.join(directory, 'node_modules');
|
||||
|
||||
if (
|
||||
!isWritable(nodeModules) &&
|
||||
(fs.existsSync(nodeModules) || !isWritable(path.join(directory)))
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
return nodeModules;
|
||||
}
|
||||
|
||||
module.exports = (options = {}) => {
|
||||
if (env.CACHE_DIR && !['true', 'false', '1', '0'].includes(env.CACHE_DIR)) {
|
||||
return useDirectory(path.join(env.CACHE_DIR, 'find-cache-dir'), options);
|
||||
}
|
||||
|
||||
let {cwd: directory = cwd()} = options;
|
||||
|
||||
if (options.files) {
|
||||
directory = commonDir(directory, options.files);
|
||||
}
|
||||
|
||||
directory = pkgDir.sync(directory);
|
||||
|
||||
if (!directory) {
|
||||
return;
|
||||
}
|
||||
|
||||
const nodeModules = getNodeModuleDirectory(directory);
|
||||
if (!nodeModules) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return useDirectory(path.join(directory, 'node_modules', '.cache', options.name), options);
|
||||
};
|
9
node_modules/nyc/node_modules/find-cache-dir/license
generated
vendored
Normal file
9
node_modules/nyc/node_modules/find-cache-dir/license
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://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.
|
44
node_modules/nyc/node_modules/find-cache-dir/package.json
generated
vendored
Normal file
44
node_modules/nyc/node_modules/find-cache-dir/package.json
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"name": "find-cache-dir",
|
||||
"version": "3.3.1",
|
||||
"description": "Finds the common standard cache directory",
|
||||
"license": "MIT",
|
||||
"repository": "avajs/find-cache-dir",
|
||||
"funding": "https://github.com/avajs/find-cache-dir?sponsor=1",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && nyc ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"cache",
|
||||
"directory",
|
||||
"dir",
|
||||
"caching",
|
||||
"find",
|
||||
"search"
|
||||
],
|
||||
"dependencies": {
|
||||
"commondir": "^1.0.1",
|
||||
"make-dir": "^3.0.2",
|
||||
"pkg-dir": "^4.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^2.4.0",
|
||||
"coveralls": "^3.0.9",
|
||||
"del": "^4.0.0",
|
||||
"nyc": "^15.0.0",
|
||||
"tempy": "^0.4.0",
|
||||
"xo": "^0.25.3"
|
||||
},
|
||||
"nyc": {
|
||||
"reporter": [
|
||||
"lcov",
|
||||
"text"
|
||||
]
|
||||
}
|
||||
}
|
124
node_modules/nyc/node_modules/find-cache-dir/readme.md
generated
vendored
Normal file
124
node_modules/nyc/node_modules/find-cache-dir/readme.md
generated
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
# find-cache-dir [](https://travis-ci.org/avajs/find-cache-dir) [](https://coveralls.io/github/avajs/find-cache-dir?branch=master)
|
||||
|
||||
> Finds the common standard cache directory
|
||||
|
||||
The [`nyc`](https://github.com/istanbuljs/nyc) and [`AVA`](https://ava.li) projects decided to standardize on a common directory structure for storing cache information:
|
||||
|
||||
```sh
|
||||
# nyc
|
||||
./node_modules/.cache/nyc
|
||||
|
||||
# ava
|
||||
./node_modules/.cache/ava
|
||||
|
||||
# your-module
|
||||
./node_modules/.cache/your-module
|
||||
```
|
||||
|
||||
This module makes it easy to correctly locate the cache directory according to this shared spec. If this pattern becomes ubiquitous, clearing the cache for multiple dependencies becomes easy and consistent:
|
||||
|
||||
```
|
||||
rm -rf ./node_modules/.cache
|
||||
```
|
||||
|
||||
If you decide to adopt this pattern, please file a PR adding your name to the list of adopters below.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install find-cache-dir
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const findCacheDir = require('find-cache-dir');
|
||||
|
||||
findCacheDir({name: 'unicorns'});
|
||||
//=> '/user/path/node-modules/.cache/unicorns'
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### findCacheDir(options?)
|
||||
|
||||
Finds the cache directory using the supplied options. The algorithm checks for the `CACHE_DIR` environmental variable and uses it if it is not set to `true`, `false`, `1` or `0`. If one is not found, it tries to find a `package.json` file, searching every parent directory of the `cwd` specified (or implied from other options). It returns a `string` containing the absolute path to the cache directory, or `undefined` if `package.json` was never found or if the `node_modules` directory is unwritable.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### name
|
||||
|
||||
*Required*\
|
||||
Type: `string`
|
||||
|
||||
Should be the same as your project name in `package.json`.
|
||||
|
||||
##### files
|
||||
|
||||
Type: `string[] | string`
|
||||
|
||||
An array of files that will be searched for a common parent directory. This common parent directory will be used in lieu of the `cwd` option below.
|
||||
|
||||
##### cwd
|
||||
|
||||
Type: `string`\
|
||||
Default `process.cwd()`
|
||||
|
||||
Directory to start searching for a `package.json` from.
|
||||
|
||||
##### create
|
||||
|
||||
Type: `boolean`\
|
||||
Default `false`
|
||||
|
||||
If `true`, the directory will be created synchronously before returning.
|
||||
|
||||
##### thunk
|
||||
|
||||
Type: `boolean`\
|
||||
Default `false`
|
||||
|
||||
If `true`, this modifies the return type to be a function that is a thunk for `path.join(theFoundCacheDirectory)`.
|
||||
|
||||
```js
|
||||
const thunk = findCacheDir({name: 'foo', thunk: true});
|
||||
|
||||
thunk();
|
||||
//=> '/some/path/node_modules/.cache/foo'
|
||||
|
||||
thunk('bar.js')
|
||||
//=> '/some/path/node_modules/.cache/foo/bar.js'
|
||||
|
||||
thunk('baz', 'quz.js')
|
||||
//=> '/some/path/node_modules/.cache/foo/baz/quz.js'
|
||||
```
|
||||
|
||||
This is helpful for actually putting actual files in the cache!
|
||||
|
||||
## Tips
|
||||
|
||||
- To test modules using `find-cache-dir`, set the `CACHE_DIR` environment variable to temporarily override the directory that is resolved.
|
||||
|
||||
## Adopters
|
||||
|
||||
- [`AVA`](https://ava.li)
|
||||
- [`nyc`](https://github.com/istanbuljs/nyc)
|
||||
- [`Storybook`](https://storybook.js.org)
|
||||
- [`babel-loader`](https://github.com/babel/babel-loader)
|
||||
- [`eslint-loader`](https://github.com/MoOx/eslint-loader)
|
||||
- [`Phenomic`](https://phenomic.io)
|
||||
- [`javascripthon-loader`](https://github.com/Beg-in/javascripthon-loader)
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-find_cache-dir?utm_source=npm-find-cache-dir&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
17
node_modules/nyc/node_modules/is-fullwidth-code-point/index.d.ts
generated
vendored
Normal file
17
node_modules/nyc/node_modules/is-fullwidth-code-point/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms).
|
||||
|
||||
@param codePoint - The [code point](https://en.wikipedia.org/wiki/Code_point) of a character.
|
||||
|
||||
@example
|
||||
```
|
||||
import isFullwidthCodePoint from 'is-fullwidth-code-point';
|
||||
|
||||
isFullwidthCodePoint('谢'.codePointAt(0));
|
||||
//=> true
|
||||
|
||||
isFullwidthCodePoint('a'.codePointAt(0));
|
||||
//=> false
|
||||
```
|
||||
*/
|
||||
export default function isFullwidthCodePoint(codePoint: number): boolean;
|
50
node_modules/nyc/node_modules/is-fullwidth-code-point/index.js
generated
vendored
Normal file
50
node_modules/nyc/node_modules/is-fullwidth-code-point/index.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
/* eslint-disable yoda */
|
||||
'use strict';
|
||||
|
||||
const isFullwidthCodePoint = codePoint => {
|
||||
if (Number.isNaN(codePoint)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Code points are derived from:
|
||||
// http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt
|
||||
if (
|
||||
codePoint >= 0x1100 && (
|
||||
codePoint <= 0x115F || // Hangul Jamo
|
||||
codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET
|
||||
codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET
|
||||
// CJK Radicals Supplement .. Enclosed CJK Letters and Months
|
||||
(0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F) ||
|
||||
// Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
|
||||
(0x3250 <= codePoint && codePoint <= 0x4DBF) ||
|
||||
// CJK Unified Ideographs .. Yi Radicals
|
||||
(0x4E00 <= codePoint && codePoint <= 0xA4C6) ||
|
||||
// Hangul Jamo Extended-A
|
||||
(0xA960 <= codePoint && codePoint <= 0xA97C) ||
|
||||
// Hangul Syllables
|
||||
(0xAC00 <= codePoint && codePoint <= 0xD7A3) ||
|
||||
// CJK Compatibility Ideographs
|
||||
(0xF900 <= codePoint && codePoint <= 0xFAFF) ||
|
||||
// Vertical Forms
|
||||
(0xFE10 <= codePoint && codePoint <= 0xFE19) ||
|
||||
// CJK Compatibility Forms .. Small Form Variants
|
||||
(0xFE30 <= codePoint && codePoint <= 0xFE6B) ||
|
||||
// Halfwidth and Fullwidth Forms
|
||||
(0xFF01 <= codePoint && codePoint <= 0xFF60) ||
|
||||
(0xFFE0 <= codePoint && codePoint <= 0xFFE6) ||
|
||||
// Kana Supplement
|
||||
(0x1B000 <= codePoint && codePoint <= 0x1B001) ||
|
||||
// Enclosed Ideographic Supplement
|
||||
(0x1F200 <= codePoint && codePoint <= 0x1F251) ||
|
||||
// CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
|
||||
(0x20000 <= codePoint && codePoint <= 0x3FFFD)
|
||||
)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
module.exports = isFullwidthCodePoint;
|
||||
module.exports.default = isFullwidthCodePoint;
|
9
node_modules/nyc/node_modules/is-fullwidth-code-point/license
generated
vendored
Normal file
9
node_modules/nyc/node_modules/is-fullwidth-code-point/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.
|
42
node_modules/nyc/node_modules/is-fullwidth-code-point/package.json
generated
vendored
Normal file
42
node_modules/nyc/node_modules/is-fullwidth-code-point/package.json
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "is-fullwidth-code-point",
|
||||
"version": "3.0.0",
|
||||
"description": "Check if the character represented by a given Unicode code point is fullwidth",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/is-fullwidth-code-point",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd-check"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"fullwidth",
|
||||
"full-width",
|
||||
"full",
|
||||
"width",
|
||||
"unicode",
|
||||
"character",
|
||||
"string",
|
||||
"codepoint",
|
||||
"code",
|
||||
"point",
|
||||
"is",
|
||||
"detect",
|
||||
"check"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "^1.3.1",
|
||||
"tsd-check": "^0.5.0",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
39
node_modules/nyc/node_modules/is-fullwidth-code-point/readme.md
generated
vendored
Normal file
39
node_modules/nyc/node_modules/is-fullwidth-code-point/readme.md
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
# is-fullwidth-code-point [](https://travis-ci.org/sindresorhus/is-fullwidth-code-point)
|
||||
|
||||
> Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms)
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install is-fullwidth-code-point
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const isFullwidthCodePoint = require('is-fullwidth-code-point');
|
||||
|
||||
isFullwidthCodePoint('谢'.codePointAt(0));
|
||||
//=> true
|
||||
|
||||
isFullwidthCodePoint('a'.codePointAt(0));
|
||||
//=> false
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### isFullwidthCodePoint(codePoint)
|
||||
|
||||
#### codePoint
|
||||
|
||||
Type: `number`
|
||||
|
||||
The [code point](https://en.wikipedia.org/wiki/Code_point) of a character.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user