mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-01 21:52:19 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
185
web/node_modules/istanbul-lib-report/CHANGELOG.md
generated
vendored
Normal file
185
web/node_modules/istanbul-lib-report/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,185 @@
|
|||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [3.0.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@3.0.0-alpha.2...istanbul-lib-report@3.0.0) (2019-12-20)
|
||||
|
||||
**Note:** Version bump only for package istanbul-lib-report
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [3.0.0-alpha.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@3.0.0-alpha.1...istanbul-lib-report@3.0.0-alpha.2) (2019-12-07)
|
||||
|
||||
**Note:** Version bump only for package istanbul-lib-report
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [3.0.0-alpha.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@3.0.0-alpha.0...istanbul-lib-report@3.0.0-alpha.1) (2019-10-06)
|
||||
|
||||
**Note:** Version bump only for package istanbul-lib-report
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [3.0.0-alpha.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@2.0.8...istanbul-lib-report@3.0.0-alpha.0) (2019-06-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **package:** update supports-color to version 7.0.0 ([#420](https://github.com/istanbuljs/istanbuljs/issues/420)) ([631029d](https://github.com/istanbuljs/istanbuljs/commit/631029d))
|
||||
* Properly combine directories in nested summarizer ([#380](https://github.com/istanbuljs/istanbuljs/issues/380)) ([50afdbb](https://github.com/istanbuljs/istanbuljs/commit/50afdbb))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Refactor istanbul-lib-report so report can choose summarizer ([#408](https://github.com/istanbuljs/istanbuljs/issues/408)) ([0f328fd](https://github.com/istanbuljs/istanbuljs/commit/0f328fd))
|
||||
* Update dependencies, require Node.js 8 ([#401](https://github.com/istanbuljs/istanbuljs/issues/401)) ([bf3a539](https://github.com/istanbuljs/istanbuljs/commit/bf3a539))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* Existing istanbul-lib-report API's have been changed
|
||||
* Node.js 8 is now required
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [2.0.8](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@2.0.7...istanbul-lib-report@2.0.8) (2019-04-24)
|
||||
|
||||
**Note:** Version bump only for package istanbul-lib-report
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [2.0.7](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@2.0.6...istanbul-lib-report@2.0.7) (2019-04-09)
|
||||
|
||||
**Note:** Version bump only for package istanbul-lib-report
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [2.0.6](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@2.0.5...istanbul-lib-report@2.0.6) (2019-04-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Avoid corrupting HTML report's arrow png during copy ([#343](https://github.com/istanbuljs/istanbuljs/issues/343)) ([ce664c7](https://github.com/istanbuljs/istanbuljs/commit/ce664c7))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [2.0.5](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@2.0.4...istanbul-lib-report@2.0.5) (2019-03-12)
|
||||
|
||||
**Note:** Version bump only for package istanbul-lib-report
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [2.0.4](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@2.0.3...istanbul-lib-report@2.0.4) (2019-01-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* nested summarizer error with no files ([#230](https://github.com/istanbuljs/istanbuljs/issues/230)) ([07724bf](https://github.com/istanbuljs/istanbuljs/commit/07724bf))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="2.0.3"></a>
|
||||
## [2.0.3](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@2.0.2...istanbul-lib-report@2.0.3) (2018-12-25)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package istanbul-lib-report
|
||||
|
||||
<a name="2.0.2"></a>
|
||||
## [2.0.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@2.0.1...istanbul-lib-report@2.0.2) (2018-09-06)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package istanbul-lib-report
|
||||
|
||||
<a name="2.0.1"></a>
|
||||
## [2.0.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@2.0.0...istanbul-lib-report@2.0.1) (2018-07-07)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package istanbul-lib-report
|
||||
|
||||
<a name="2.0.0"></a>
|
||||
# [2.0.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@1.1.4...istanbul-lib-report@2.0.0) (2018-06-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* use null prototype for map objects ([#177](https://github.com/istanbuljs/istanbuljs/issues/177)) ([9a5a30c](https://github.com/istanbuljs/istanbuljs/commit/9a5a30c))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* a null prototype is now used in several places rather than the default `{}` assignment.
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="1.1.4"></a>
|
||||
## [1.1.4](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@1.1.3...istanbul-lib-report@1.1.4) (2018-03-04)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package istanbul-lib-report
|
||||
|
||||
<a name="1.1.3"></a>
|
||||
## [1.1.3](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@1.1.2...istanbul-lib-report@1.1.3) (2018-02-13)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package istanbul-lib-report
|
||||
|
||||
<a name="1.1.2"></a>
|
||||
## [1.1.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@1.1.1...istanbul-lib-report@1.1.2) (2017-10-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* remove call to mkdirp.sync() in constructor so when used for ConsoleWriter ([#104](https://github.com/istanbuljs/istanbuljs/issues/104)) ([58eb79d](https://github.com/istanbuljs/istanbuljs/commit/58eb79d))
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="1.1.1"></a>
|
||||
## [1.1.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-report@1.1.0...istanbul-lib-report@1.1.1) (2017-05-27)
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="1.1.0"></a>
|
||||
# [1.1.0](https://github.com/istanbuljs/istanbul-lib-report/compare/istanbul-lib-report@1.0.0...istanbul-lib-report@1.1.0) (2017-04-29)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* once 100% line coverage is achieved, missing branch coverage is now shown in text report ([#45](https://github.com/istanbuljs/istanbuljs/issues/45)) ([8a809f8](https://github.com/istanbuljs/istanbul-lib-report/commit/8a809f8))
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="1.0.0"></a>
|
||||
# [1.0.0](https://github.com/istanbuljs/istanbul-lib-report/compare/istanbul-lib-report@1.0.0-alpha.3...istanbul-lib-report@1.0.0) (2017-03-27)
|
24
web/node_modules/istanbul-lib-report/LICENSE
generated
vendored
Normal file
24
web/node_modules/istanbul-lib-report/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
Copyright 2012-2015 Yahoo! Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Yahoo! Inc. nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL YAHOO! INC. BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
43
web/node_modules/istanbul-lib-report/README.md
generated
vendored
Normal file
43
web/node_modules/istanbul-lib-report/README.md
generated
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
# istanbul-lib-report
|
||||
|
||||
[](https://greenkeeper.io/)
|
||||
[](https://travis-ci.org/istanbuljs/istanbul-lib-report)
|
||||
|
||||
Core reporting utilities for istanbul.
|
||||
|
||||
## Example usage
|
||||
|
||||
```js
|
||||
const libReport = require('istanbul-lib-report');
|
||||
const reports = require('istanbul-reports');
|
||||
|
||||
// coverageMap, for instance, obtained from istanbul-lib-coverage
|
||||
const coverageMap;
|
||||
|
||||
const configWatermarks = {
|
||||
statements: [50, 80],
|
||||
functions: [50, 80],
|
||||
branches: [50, 80],
|
||||
lines: [50, 80]
|
||||
};
|
||||
|
||||
// create a context for report generation
|
||||
const context = libReport.createContext({
|
||||
dir: 'report/output/dir',
|
||||
// The summarizer to default to (may be overridden by some reports)
|
||||
// values can be nested/flat/pkg. Defaults to 'pkg'
|
||||
defaultSummarizer: 'nested',
|
||||
watermarks: configWatermarks,
|
||||
coverageMap,
|
||||
})
|
||||
|
||||
// create an instance of the relevant report class, passing the
|
||||
// report name e.g. json/html/html-spa/text
|
||||
const report = reports.create('json', {
|
||||
skipEmpty: configSkipEmpty,
|
||||
skipFull: configSkipFull
|
||||
})
|
||||
|
||||
// call execute to synchronously create and write the report to disk
|
||||
report.execute(context)
|
||||
```
|
40
web/node_modules/istanbul-lib-report/index.js
generated
vendored
Normal file
40
web/node_modules/istanbul-lib-report/index.js
generated
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
Copyright 2012-2015, Yahoo Inc.
|
||||
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @module Exports
|
||||
*/
|
||||
|
||||
const Context = require('./lib/context');
|
||||
const watermarks = require('./lib/watermarks');
|
||||
const ReportBase = require('./lib/report-base');
|
||||
|
||||
module.exports = {
|
||||
/**
|
||||
* returns a reporting context for the supplied options
|
||||
* @param {Object} [opts=null] opts
|
||||
* @returns {Context}
|
||||
*/
|
||||
createContext(opts) {
|
||||
return new Context(opts);
|
||||
},
|
||||
|
||||
/**
|
||||
* returns the default watermarks that would be used when not
|
||||
* overridden
|
||||
* @returns {Object} an object with `statements`, `functions`, `branches`,
|
||||
* and `line` keys. Each value is a 2 element array that has the low and
|
||||
* high watermark as percentages.
|
||||
*/
|
||||
getDefaultWatermarks() {
|
||||
return watermarks.getDefault();
|
||||
},
|
||||
|
||||
/**
|
||||
* Base class for all reports
|
||||
*/
|
||||
ReportBase
|
||||
};
|
132
web/node_modules/istanbul-lib-report/lib/context.js
generated
vendored
Normal file
132
web/node_modules/istanbul-lib-report/lib/context.js
generated
vendored
Normal file
|
@ -0,0 +1,132 @@
|
|||
'use strict';
|
||||
/*
|
||||
Copyright 2012-2015, Yahoo Inc.
|
||||
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
||||
*/
|
||||
const fs = require('fs');
|
||||
const FileWriter = require('./file-writer');
|
||||
const XMLWriter = require('./xml-writer');
|
||||
const tree = require('./tree');
|
||||
const watermarks = require('./watermarks');
|
||||
const SummarizerFactory = require('./summarizer-factory');
|
||||
|
||||
function defaultSourceLookup(path) {
|
||||
try {
|
||||
return fs.readFileSync(path, 'utf8');
|
||||
} catch (ex) {
|
||||
throw new Error(`Unable to lookup source: ${path} (${ex.message})`);
|
||||
}
|
||||
}
|
||||
|
||||
function normalizeWatermarks(specified = {}) {
|
||||
Object.entries(watermarks.getDefault()).forEach(([k, value]) => {
|
||||
const specValue = specified[k];
|
||||
if (!Array.isArray(specValue) || specValue.length !== 2) {
|
||||
specified[k] = value;
|
||||
}
|
||||
});
|
||||
|
||||
return specified;
|
||||
}
|
||||
|
||||
/**
|
||||
* A reporting context that is passed to report implementations
|
||||
* @param {Object} [opts=null] opts options
|
||||
* @param {String} [opts.dir='coverage'] opts.dir the reporting directory
|
||||
* @param {Object} [opts.watermarks=null] opts.watermarks watermarks for
|
||||
* statements, lines, branches and functions
|
||||
* @param {Function} [opts.sourceFinder=fsLookup] opts.sourceFinder a
|
||||
* function that returns source code given a file path. Defaults to
|
||||
* filesystem lookups based on path.
|
||||
* @constructor
|
||||
*/
|
||||
class Context {
|
||||
constructor(opts) {
|
||||
this.dir = opts.dir || 'coverage';
|
||||
this.watermarks = normalizeWatermarks(opts.watermarks);
|
||||
this.sourceFinder = opts.sourceFinder || defaultSourceLookup;
|
||||
this._summarizerFactory = new SummarizerFactory(
|
||||
opts.coverageMap,
|
||||
opts.defaultSummarizer
|
||||
);
|
||||
this.data = {};
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a FileWriter implementation for reporting use. Also available
|
||||
* as the `writer` property on the context.
|
||||
* @returns {Writer}
|
||||
*/
|
||||
getWriter() {
|
||||
return this.writer;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the source code for the specified file path or throws if
|
||||
* the source could not be found.
|
||||
* @param {String} filePath the file path as found in a file coverage object
|
||||
* @returns {String} the source code
|
||||
*/
|
||||
getSource(filePath) {
|
||||
return this.sourceFinder(filePath);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the coverage class given a coverage
|
||||
* types and a percentage value.
|
||||
* @param {String} type - the coverage type, one of `statements`, `functions`,
|
||||
* `branches`, or `lines`
|
||||
* @param {Number} value - the percentage value
|
||||
* @returns {String} one of `high`, `medium` or `low`
|
||||
*/
|
||||
classForPercent(type, value) {
|
||||
const watermarks = this.watermarks[type];
|
||||
if (!watermarks) {
|
||||
return 'unknown';
|
||||
}
|
||||
if (value < watermarks[0]) {
|
||||
return 'low';
|
||||
}
|
||||
if (value >= watermarks[1]) {
|
||||
return 'high';
|
||||
}
|
||||
return 'medium';
|
||||
}
|
||||
|
||||
/**
|
||||
* returns an XML writer for the supplied content writer
|
||||
* @param {ContentWriter} contentWriter the content writer to which the returned XML writer
|
||||
* writes data
|
||||
* @returns {XMLWriter}
|
||||
*/
|
||||
getXMLWriter(contentWriter) {
|
||||
return new XMLWriter(contentWriter);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a full visitor given a partial one.
|
||||
* @param {Object} partialVisitor a partial visitor only having the functions of
|
||||
* interest to the caller. These functions are called with a scope that is the
|
||||
* supplied object.
|
||||
* @returns {Visitor}
|
||||
*/
|
||||
getVisitor(partialVisitor) {
|
||||
return new tree.Visitor(partialVisitor);
|
||||
}
|
||||
|
||||
getTree(name = 'defaultSummarizer') {
|
||||
return this._summarizerFactory[name];
|
||||
}
|
||||
}
|
||||
|
||||
Object.defineProperty(Context.prototype, 'writer', {
|
||||
enumerable: true,
|
||||
get() {
|
||||
if (!this.data.writer) {
|
||||
this.data.writer = new FileWriter(this.dir);
|
||||
}
|
||||
return this.data.writer;
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = Context;
|
189
web/node_modules/istanbul-lib-report/lib/file-writer.js
generated
vendored
Normal file
189
web/node_modules/istanbul-lib-report/lib/file-writer.js
generated
vendored
Normal file
|
@ -0,0 +1,189 @@
|
|||
'use strict';
|
||||
/*
|
||||
Copyright 2012-2015, Yahoo Inc.
|
||||
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
||||
*/
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const mkdirp = require('make-dir');
|
||||
const supportsColor = require('supports-color');
|
||||
|
||||
/**
|
||||
* Base class for writing content
|
||||
* @class ContentWriter
|
||||
* @constructor
|
||||
*/
|
||||
class ContentWriter {
|
||||
/**
|
||||
* returns the colorized version of a string. Typically,
|
||||
* content writers that write to files will return the
|
||||
* same string and ones writing to a tty will wrap it in
|
||||
* appropriate escape sequences.
|
||||
* @param {String} str the string to colorize
|
||||
* @param {String} clazz one of `high`, `medium` or `low`
|
||||
* @returns {String} the colorized form of the string
|
||||
*/
|
||||
colorize(str /*, clazz*/) {
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
* writes a string appended with a newline to the destination
|
||||
* @param {String} str the string to write
|
||||
*/
|
||||
println(str) {
|
||||
this.write(`${str}\n`);
|
||||
}
|
||||
|
||||
/**
|
||||
* closes this content writer. Should be called after all writes are complete.
|
||||
*/
|
||||
close() {}
|
||||
}
|
||||
|
||||
/**
|
||||
* a content writer that writes to a file
|
||||
* @param {Number} fd - the file descriptor
|
||||
* @extends ContentWriter
|
||||
* @constructor
|
||||
*/
|
||||
class FileContentWriter extends ContentWriter {
|
||||
constructor(fd) {
|
||||
super();
|
||||
|
||||
this.fd = fd;
|
||||
}
|
||||
|
||||
write(str) {
|
||||
fs.writeSync(this.fd, str);
|
||||
}
|
||||
|
||||
close() {
|
||||
fs.closeSync(this.fd);
|
||||
}
|
||||
}
|
||||
|
||||
// allow stdout to be captured for tests.
|
||||
let capture = false;
|
||||
let output = '';
|
||||
|
||||
/**
|
||||
* a content writer that writes to the console
|
||||
* @extends ContentWriter
|
||||
* @constructor
|
||||
*/
|
||||
class ConsoleWriter extends ContentWriter {
|
||||
write(str) {
|
||||
if (capture) {
|
||||
output += str;
|
||||
} else {
|
||||
process.stdout.write(str);
|
||||
}
|
||||
}
|
||||
|
||||
colorize(str, clazz) {
|
||||
const colors = {
|
||||
low: '31;1',
|
||||
medium: '33;1',
|
||||
high: '32;1'
|
||||
};
|
||||
|
||||
/* istanbul ignore next: different modes for CI and local */
|
||||
if (supportsColor.stdout && colors[clazz]) {
|
||||
return `\u001b[${colors[clazz]}m${str}\u001b[0m`;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* utility for writing files under a specific directory
|
||||
* @class FileWriter
|
||||
* @param {String} baseDir the base directory under which files should be written
|
||||
* @constructor
|
||||
*/
|
||||
class FileWriter {
|
||||
constructor(baseDir) {
|
||||
if (!baseDir) {
|
||||
throw new Error('baseDir must be specified');
|
||||
}
|
||||
this.baseDir = baseDir;
|
||||
}
|
||||
|
||||
/**
|
||||
* static helpers for capturing stdout report output;
|
||||
* super useful for tests!
|
||||
*/
|
||||
static startCapture() {
|
||||
capture = true;
|
||||
}
|
||||
|
||||
static stopCapture() {
|
||||
capture = false;
|
||||
}
|
||||
|
||||
static getOutput() {
|
||||
return output;
|
||||
}
|
||||
|
||||
static resetOutput() {
|
||||
output = '';
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a FileWriter that is rooted at the supplied subdirectory
|
||||
* @param {String} subdir the subdirectory under which to root the
|
||||
* returned FileWriter
|
||||
* @returns {FileWriter}
|
||||
*/
|
||||
writerForDir(subdir) {
|
||||
if (path.isAbsolute(subdir)) {
|
||||
throw new Error(
|
||||
`Cannot create subdir writer for absolute path: ${subdir}`
|
||||
);
|
||||
}
|
||||
return new FileWriter(`${this.baseDir}/${subdir}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* copies a file from a source directory to a destination name
|
||||
* @param {String} source path to source file
|
||||
* @param {String} dest relative path to destination file
|
||||
* @param {String} [header=undefined] optional text to prepend to destination
|
||||
* (e.g., an "this file is autogenerated" comment, copyright notice, etc.)
|
||||
*/
|
||||
copyFile(source, dest, header) {
|
||||
if (path.isAbsolute(dest)) {
|
||||
throw new Error(`Cannot write to absolute path: ${dest}`);
|
||||
}
|
||||
dest = path.resolve(this.baseDir, dest);
|
||||
mkdirp.sync(path.dirname(dest));
|
||||
let contents;
|
||||
if (header) {
|
||||
contents = header + fs.readFileSync(source, 'utf8');
|
||||
} else {
|
||||
contents = fs.readFileSync(source);
|
||||
}
|
||||
fs.writeFileSync(dest, contents);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a content writer for writing content to the supplied file.
|
||||
* @param {String|null} file the relative path to the file or the special
|
||||
* values `"-"` or `null` for writing to the console
|
||||
* @returns {ContentWriter}
|
||||
*/
|
||||
writeFile(file) {
|
||||
if (file === null || file === '-') {
|
||||
return new ConsoleWriter();
|
||||
}
|
||||
if (path.isAbsolute(file)) {
|
||||
throw new Error(`Cannot write to absolute path: ${file}`);
|
||||
}
|
||||
file = path.resolve(this.baseDir, file);
|
||||
mkdirp.sync(path.dirname(file));
|
||||
return new FileContentWriter(fs.openSync(file, 'w'));
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = FileWriter;
|
169
web/node_modules/istanbul-lib-report/lib/path.js
generated
vendored
Normal file
169
web/node_modules/istanbul-lib-report/lib/path.js
generated
vendored
Normal file
|
@ -0,0 +1,169 @@
|
|||
/*
|
||||
Copyright 2012-2015, Yahoo Inc.
|
||||
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
let parsePath = path.parse;
|
||||
let SEP = path.sep;
|
||||
const origParser = parsePath;
|
||||
const origSep = SEP;
|
||||
|
||||
function makeRelativeNormalizedPath(str, sep) {
|
||||
const parsed = parsePath(str);
|
||||
let root = parsed.root;
|
||||
let dir;
|
||||
let file = parsed.base;
|
||||
let quoted;
|
||||
let pos;
|
||||
|
||||
// handle a weird windows case separately
|
||||
if (sep === '\\') {
|
||||
pos = root.indexOf(':\\');
|
||||
if (pos >= 0) {
|
||||
root = root.substring(0, pos + 2);
|
||||
}
|
||||
}
|
||||
dir = parsed.dir.substring(root.length);
|
||||
|
||||
if (str === '') {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (sep !== '/') {
|
||||
quoted = new RegExp(sep.replace(/\W/g, '\\$&'), 'g');
|
||||
dir = dir.replace(quoted, '/');
|
||||
file = file.replace(quoted, '/'); // excessively paranoid?
|
||||
}
|
||||
|
||||
if (dir !== '') {
|
||||
dir = `${dir}/${file}`;
|
||||
} else {
|
||||
dir = file;
|
||||
}
|
||||
if (dir.substring(0, 1) === '/') {
|
||||
dir = dir.substring(1);
|
||||
}
|
||||
dir = dir.split(/\/+/);
|
||||
return dir;
|
||||
}
|
||||
|
||||
class Path {
|
||||
constructor(strOrArray) {
|
||||
if (Array.isArray(strOrArray)) {
|
||||
this.v = strOrArray;
|
||||
} else if (typeof strOrArray === 'string') {
|
||||
this.v = makeRelativeNormalizedPath(strOrArray, SEP);
|
||||
} else {
|
||||
throw new Error(
|
||||
`Invalid Path argument must be string or array:${strOrArray}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
toString() {
|
||||
return this.v.join('/');
|
||||
}
|
||||
|
||||
hasParent() {
|
||||
return this.v.length > 0;
|
||||
}
|
||||
|
||||
parent() {
|
||||
if (!this.hasParent()) {
|
||||
throw new Error('Unable to get parent for 0 elem path');
|
||||
}
|
||||
const p = this.v.slice();
|
||||
p.pop();
|
||||
return new Path(p);
|
||||
}
|
||||
|
||||
elements() {
|
||||
return this.v.slice();
|
||||
}
|
||||
|
||||
name() {
|
||||
return this.v.slice(-1)[0];
|
||||
}
|
||||
|
||||
contains(other) {
|
||||
let i;
|
||||
if (other.length > this.length) {
|
||||
return false;
|
||||
}
|
||||
for (i = 0; i < other.length; i += 1) {
|
||||
if (this.v[i] !== other.v[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
ancestorOf(other) {
|
||||
return other.contains(this) && other.length !== this.length;
|
||||
}
|
||||
|
||||
descendantOf(other) {
|
||||
return this.contains(other) && other.length !== this.length;
|
||||
}
|
||||
|
||||
commonPrefixPath(other) {
|
||||
const len = this.length > other.length ? other.length : this.length;
|
||||
let i;
|
||||
const ret = [];
|
||||
|
||||
for (i = 0; i < len; i += 1) {
|
||||
if (this.v[i] === other.v[i]) {
|
||||
ret.push(this.v[i]);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new Path(ret);
|
||||
}
|
||||
|
||||
static compare(a, b) {
|
||||
const al = a.length;
|
||||
const bl = b.length;
|
||||
|
||||
if (al < bl) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (al > bl) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
const astr = a.toString();
|
||||
const bstr = b.toString();
|
||||
return astr < bstr ? -1 : astr > bstr ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
['push', 'pop', 'shift', 'unshift', 'splice'].forEach(fn => {
|
||||
Object.defineProperty(Path.prototype, fn, {
|
||||
value(...args) {
|
||||
return this.v[fn](...args);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Object.defineProperty(Path.prototype, 'length', {
|
||||
enumerable: true,
|
||||
get() {
|
||||
return this.v.length;
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = Path;
|
||||
Path.tester = {
|
||||
setParserAndSep(p, sep) {
|
||||
parsePath = p;
|
||||
SEP = sep;
|
||||
},
|
||||
reset() {
|
||||
parsePath = origParser;
|
||||
SEP = origSep;
|
||||
}
|
||||
};
|
16
web/node_modules/istanbul-lib-report/lib/report-base.js
generated
vendored
Normal file
16
web/node_modules/istanbul-lib-report/lib/report-base.js
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
'use strict';
|
||||
|
||||
// TODO: switch to class private field when targetting node.js 12
|
||||
const _summarizer = Symbol('ReportBase.#summarizer');
|
||||
|
||||
class ReportBase {
|
||||
constructor(opts = {}) {
|
||||
this[_summarizer] = opts.summarizer;
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
context.getTree(this[_summarizer]).visit(this, context);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ReportBase;
|
284
web/node_modules/istanbul-lib-report/lib/summarizer-factory.js
generated
vendored
Normal file
284
web/node_modules/istanbul-lib-report/lib/summarizer-factory.js
generated
vendored
Normal file
|
@ -0,0 +1,284 @@
|
|||
/*
|
||||
Copyright 2012-2015, Yahoo Inc.
|
||||
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
const coverage = require('istanbul-lib-coverage');
|
||||
const Path = require('./path');
|
||||
const { BaseNode, BaseTree } = require('./tree');
|
||||
|
||||
class ReportNode extends BaseNode {
|
||||
constructor(path, fileCoverage) {
|
||||
super();
|
||||
|
||||
this.path = path;
|
||||
this.parent = null;
|
||||
this.fileCoverage = fileCoverage;
|
||||
this.children = [];
|
||||
}
|
||||
|
||||
static createRoot(children) {
|
||||
const root = new ReportNode(new Path([]));
|
||||
|
||||
children.forEach(child => {
|
||||
root.addChild(child);
|
||||
});
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
addChild(child) {
|
||||
child.parent = this;
|
||||
this.children.push(child);
|
||||
}
|
||||
|
||||
asRelative(p) {
|
||||
if (p.substring(0, 1) === '/') {
|
||||
return p.substring(1);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
getQualifiedName() {
|
||||
return this.asRelative(this.path.toString());
|
||||
}
|
||||
|
||||
getRelativeName() {
|
||||
const parent = this.getParent();
|
||||
const myPath = this.path;
|
||||
let relPath;
|
||||
let i;
|
||||
const parentPath = parent ? parent.path : new Path([]);
|
||||
if (parentPath.ancestorOf(myPath)) {
|
||||
relPath = new Path(myPath.elements());
|
||||
for (i = 0; i < parentPath.length; i += 1) {
|
||||
relPath.shift();
|
||||
}
|
||||
return this.asRelative(relPath.toString());
|
||||
}
|
||||
return this.asRelative(this.path.toString());
|
||||
}
|
||||
|
||||
getParent() {
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
getChildren() {
|
||||
return this.children;
|
||||
}
|
||||
|
||||
isSummary() {
|
||||
return !this.fileCoverage;
|
||||
}
|
||||
|
||||
getFileCoverage() {
|
||||
return this.fileCoverage;
|
||||
}
|
||||
|
||||
getCoverageSummary(filesOnly) {
|
||||
const cacheProp = `c_${filesOnly ? 'files' : 'full'}`;
|
||||
let summary;
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(this, cacheProp)) {
|
||||
return this[cacheProp];
|
||||
}
|
||||
|
||||
if (!this.isSummary()) {
|
||||
summary = this.getFileCoverage().toSummary();
|
||||
} else {
|
||||
let count = 0;
|
||||
summary = coverage.createCoverageSummary();
|
||||
this.getChildren().forEach(child => {
|
||||
if (filesOnly && child.isSummary()) {
|
||||
return;
|
||||
}
|
||||
count += 1;
|
||||
summary.merge(child.getCoverageSummary(filesOnly));
|
||||
});
|
||||
if (count === 0 && filesOnly) {
|
||||
summary = null;
|
||||
}
|
||||
}
|
||||
this[cacheProp] = summary;
|
||||
return summary;
|
||||
}
|
||||
}
|
||||
|
||||
class ReportTree extends BaseTree {
|
||||
constructor(root, childPrefix) {
|
||||
super(root);
|
||||
|
||||
const maybePrefix = node => {
|
||||
if (childPrefix && !node.isRoot()) {
|
||||
node.path.unshift(childPrefix);
|
||||
}
|
||||
};
|
||||
this.visit({
|
||||
onDetail: maybePrefix,
|
||||
onSummary(node) {
|
||||
maybePrefix(node);
|
||||
node.children.sort((a, b) => {
|
||||
const astr = a.path.toString();
|
||||
const bstr = b.path.toString();
|
||||
return astr < bstr
|
||||
? -1
|
||||
: astr > bstr
|
||||
? 1
|
||||
: /* istanbul ignore next */ 0;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function findCommonParent(paths) {
|
||||
return paths.reduce(
|
||||
(common, path) => common.commonPrefixPath(path),
|
||||
paths[0] || new Path([])
|
||||
);
|
||||
}
|
||||
|
||||
function findOrCreateParent(parentPath, nodeMap, created = () => {}) {
|
||||
let parent = nodeMap[parentPath.toString()];
|
||||
|
||||
if (!parent) {
|
||||
parent = new ReportNode(parentPath);
|
||||
nodeMap[parentPath.toString()] = parent;
|
||||
created(parentPath, parent);
|
||||
}
|
||||
|
||||
return parent;
|
||||
}
|
||||
|
||||
function toDirParents(list) {
|
||||
const nodeMap = Object.create(null);
|
||||
list.forEach(o => {
|
||||
const parent = findOrCreateParent(o.path.parent(), nodeMap);
|
||||
parent.addChild(new ReportNode(o.path, o.fileCoverage));
|
||||
});
|
||||
|
||||
return Object.values(nodeMap);
|
||||
}
|
||||
|
||||
function addAllPaths(topPaths, nodeMap, path, node) {
|
||||
const parent = findOrCreateParent(
|
||||
path.parent(),
|
||||
nodeMap,
|
||||
(parentPath, parent) => {
|
||||
if (parentPath.hasParent()) {
|
||||
addAllPaths(topPaths, nodeMap, parentPath, parent);
|
||||
} else {
|
||||
topPaths.push(parent);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
parent.addChild(node);
|
||||
}
|
||||
|
||||
function foldIntoOneDir(node, parent) {
|
||||
const { children } = node;
|
||||
if (children.length === 1 && !children[0].fileCoverage) {
|
||||
children[0].parent = parent;
|
||||
return foldIntoOneDir(children[0], parent);
|
||||
}
|
||||
node.children = children.map(child => foldIntoOneDir(child, node));
|
||||
return node;
|
||||
}
|
||||
|
||||
function pkgSummaryPrefix(dirParents, commonParent) {
|
||||
if (!dirParents.some(dp => dp.path.length === 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (commonParent.length === 0) {
|
||||
return 'root';
|
||||
}
|
||||
|
||||
return commonParent.name();
|
||||
}
|
||||
|
||||
class SummarizerFactory {
|
||||
constructor(coverageMap, defaultSummarizer = 'pkg') {
|
||||
this._coverageMap = coverageMap;
|
||||
this._defaultSummarizer = defaultSummarizer;
|
||||
this._initialList = coverageMap.files().map(filePath => ({
|
||||
filePath,
|
||||
path: new Path(filePath),
|
||||
fileCoverage: coverageMap.fileCoverageFor(filePath)
|
||||
}));
|
||||
this._commonParent = findCommonParent(
|
||||
this._initialList.map(o => o.path.parent())
|
||||
);
|
||||
if (this._commonParent.length > 0) {
|
||||
this._initialList.forEach(o => {
|
||||
o.path.splice(0, this._commonParent.length);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
get defaultSummarizer() {
|
||||
return this[this._defaultSummarizer];
|
||||
}
|
||||
|
||||
get flat() {
|
||||
if (!this._flat) {
|
||||
this._flat = new ReportTree(
|
||||
ReportNode.createRoot(
|
||||
this._initialList.map(
|
||||
node => new ReportNode(node.path, node.fileCoverage)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return this._flat;
|
||||
}
|
||||
|
||||
_createPkg() {
|
||||
const dirParents = toDirParents(this._initialList);
|
||||
if (dirParents.length === 1) {
|
||||
return new ReportTree(dirParents[0]);
|
||||
}
|
||||
|
||||
return new ReportTree(
|
||||
ReportNode.createRoot(dirParents),
|
||||
pkgSummaryPrefix(dirParents, this._commonParent)
|
||||
);
|
||||
}
|
||||
|
||||
get pkg() {
|
||||
if (!this._pkg) {
|
||||
this._pkg = this._createPkg();
|
||||
}
|
||||
|
||||
return this._pkg;
|
||||
}
|
||||
|
||||
_createNested() {
|
||||
const nodeMap = Object.create(null);
|
||||
const topPaths = [];
|
||||
this._initialList.forEach(o => {
|
||||
const node = new ReportNode(o.path, o.fileCoverage);
|
||||
addAllPaths(topPaths, nodeMap, o.path, node);
|
||||
});
|
||||
|
||||
const topNodes = topPaths.map(node => foldIntoOneDir(node));
|
||||
if (topNodes.length === 1) {
|
||||
return new ReportTree(topNodes[0]);
|
||||
}
|
||||
|
||||
return new ReportTree(ReportNode.createRoot(topNodes));
|
||||
}
|
||||
|
||||
get nested() {
|
||||
if (!this._nested) {
|
||||
this._nested = this._createNested();
|
||||
}
|
||||
|
||||
return this._nested;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = SummarizerFactory;
|
137
web/node_modules/istanbul-lib-report/lib/tree.js
generated
vendored
Normal file
137
web/node_modules/istanbul-lib-report/lib/tree.js
generated
vendored
Normal file
|
@ -0,0 +1,137 @@
|
|||
/*
|
||||
Copyright 2012-2015, Yahoo Inc.
|
||||
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* An object with methods that are called during the traversal of the coverage tree.
|
||||
* A visitor has the following methods that are called during tree traversal.
|
||||
*
|
||||
* * `onStart(root, state)` - called before traversal begins
|
||||
* * `onSummary(node, state)` - called for every summary node
|
||||
* * `onDetail(node, state)` - called for every detail node
|
||||
* * `onSummaryEnd(node, state)` - called after all children have been visited for
|
||||
* a summary node.
|
||||
* * `onEnd(root, state)` - called after traversal ends
|
||||
*
|
||||
* @param delegate - a partial visitor that only implements the methods of interest
|
||||
* The visitor object supplies the missing methods as noops. For example, reports
|
||||
* that only need the final coverage summary need implement `onStart` and nothing
|
||||
* else. Reports that use only detailed coverage information need implement `onDetail`
|
||||
* and nothing else.
|
||||
* @constructor
|
||||
*/
|
||||
class Visitor {
|
||||
constructor(delegate) {
|
||||
this.delegate = delegate;
|
||||
}
|
||||
}
|
||||
|
||||
['Start', 'End', 'Summary', 'SummaryEnd', 'Detail']
|
||||
.map(k => `on${k}`)
|
||||
.forEach(fn => {
|
||||
Object.defineProperty(Visitor.prototype, fn, {
|
||||
writable: true,
|
||||
value(node, state) {
|
||||
if (typeof this.delegate[fn] === 'function') {
|
||||
this.delegate[fn](node, state);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
class CompositeVisitor extends Visitor {
|
||||
constructor(visitors) {
|
||||
super();
|
||||
|
||||
if (!Array.isArray(visitors)) {
|
||||
visitors = [visitors];
|
||||
}
|
||||
this.visitors = visitors.map(v => {
|
||||
if (v instanceof Visitor) {
|
||||
return v;
|
||||
}
|
||||
return new Visitor(v);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
['Start', 'Summary', 'SummaryEnd', 'Detail', 'End']
|
||||
.map(k => `on${k}`)
|
||||
.forEach(fn => {
|
||||
Object.defineProperty(CompositeVisitor.prototype, fn, {
|
||||
value(node, state) {
|
||||
this.visitors.forEach(v => {
|
||||
v[fn](node, state);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
class BaseNode {
|
||||
isRoot() {
|
||||
return !this.getParent();
|
||||
}
|
||||
|
||||
/**
|
||||
* visit all nodes depth-first from this node down. Note that `onStart`
|
||||
* and `onEnd` are never called on the visitor even if the current
|
||||
* node is the root of the tree.
|
||||
* @param visitor a full visitor that is called during tree traversal
|
||||
* @param state optional state that is passed around
|
||||
*/
|
||||
visit(visitor, state) {
|
||||
if (this.isSummary()) {
|
||||
visitor.onSummary(this, state);
|
||||
} else {
|
||||
visitor.onDetail(this, state);
|
||||
}
|
||||
|
||||
this.getChildren().forEach(child => {
|
||||
child.visit(visitor, state);
|
||||
});
|
||||
|
||||
if (this.isSummary()) {
|
||||
visitor.onSummaryEnd(this, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* abstract base class for a coverage tree.
|
||||
* @constructor
|
||||
*/
|
||||
class BaseTree {
|
||||
constructor(root) {
|
||||
this.root = root;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the root node of the tree
|
||||
*/
|
||||
getRoot() {
|
||||
return this.root;
|
||||
}
|
||||
|
||||
/**
|
||||
* visits the tree depth-first with the supplied partial visitor
|
||||
* @param visitor - a potentially partial visitor
|
||||
* @param state - the state to be passed around during tree traversal
|
||||
*/
|
||||
visit(visitor, state) {
|
||||
if (!(visitor instanceof Visitor)) {
|
||||
visitor = new Visitor(visitor);
|
||||
}
|
||||
visitor.onStart(this.getRoot(), state);
|
||||
this.getRoot().visit(visitor, state);
|
||||
visitor.onEnd(this.getRoot(), state);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
BaseTree,
|
||||
BaseNode,
|
||||
Visitor,
|
||||
CompositeVisitor
|
||||
};
|
15
web/node_modules/istanbul-lib-report/lib/watermarks.js
generated
vendored
Normal file
15
web/node_modules/istanbul-lib-report/lib/watermarks.js
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
'use strict';
|
||||
/*
|
||||
Copyright 2012-2015, Yahoo Inc.
|
||||
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
||||
*/
|
||||
module.exports = {
|
||||
getDefault() {
|
||||
return {
|
||||
statements: [50, 80],
|
||||
functions: [50, 80],
|
||||
branches: [50, 80],
|
||||
lines: [50, 80]
|
||||
};
|
||||
}
|
||||
};
|
90
web/node_modules/istanbul-lib-report/lib/xml-writer.js
generated
vendored
Normal file
90
web/node_modules/istanbul-lib-report/lib/xml-writer.js
generated
vendored
Normal file
|
@ -0,0 +1,90 @@
|
|||
'use strict';
|
||||
/*
|
||||
Copyright 2012-2015, Yahoo Inc.
|
||||
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
||||
*/
|
||||
const INDENT = ' ';
|
||||
|
||||
function attrString(attrs) {
|
||||
return Object.entries(attrs || {})
|
||||
.map(([k, v]) => ` ${k}="${v}"`)
|
||||
.join('');
|
||||
}
|
||||
|
||||
/**
|
||||
* a utility class to produce well-formed, indented XML
|
||||
* @param {ContentWriter} contentWriter the content writer that this utility wraps
|
||||
* @constructor
|
||||
*/
|
||||
class XMLWriter {
|
||||
constructor(contentWriter) {
|
||||
this.cw = contentWriter;
|
||||
this.stack = [];
|
||||
}
|
||||
|
||||
indent(str) {
|
||||
return this.stack.map(() => INDENT).join('') + str;
|
||||
}
|
||||
|
||||
/**
|
||||
* writes the opening XML tag with the supplied attributes
|
||||
* @param {String} name tag name
|
||||
* @param {Object} [attrs=null] attrs attributes for the tag
|
||||
*/
|
||||
openTag(name, attrs) {
|
||||
const str = this.indent(`<${name + attrString(attrs)}>`);
|
||||
this.cw.println(str);
|
||||
this.stack.push(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* closes an open XML tag.
|
||||
* @param {String} name - tag name to close. This must match the writer's
|
||||
* notion of the tag that is currently open.
|
||||
*/
|
||||
closeTag(name) {
|
||||
if (this.stack.length === 0) {
|
||||
throw new Error(`Attempt to close tag ${name} when not opened`);
|
||||
}
|
||||
const stashed = this.stack.pop();
|
||||
const str = `</${name}>`;
|
||||
|
||||
if (stashed !== name) {
|
||||
throw new Error(
|
||||
`Attempt to close tag ${name} when ${stashed} was the one open`
|
||||
);
|
||||
}
|
||||
this.cw.println(this.indent(str));
|
||||
}
|
||||
|
||||
/**
|
||||
* writes a tag and its value opening and closing it at the same time
|
||||
* @param {String} name tag name
|
||||
* @param {Object} [attrs=null] attrs tag attributes
|
||||
* @param {String} [content=null] content optional tag content
|
||||
*/
|
||||
inlineTag(name, attrs, content) {
|
||||
let str = '<' + name + attrString(attrs);
|
||||
if (content) {
|
||||
str += `>${content}</${name}>`;
|
||||
} else {
|
||||
str += '/>';
|
||||
}
|
||||
str = this.indent(str);
|
||||
this.cw.println(str);
|
||||
}
|
||||
|
||||
/**
|
||||
* closes all open tags and ends the document
|
||||
*/
|
||||
closeAll() {
|
||||
this.stack
|
||||
.slice()
|
||||
.reverse()
|
||||
.forEach(name => {
|
||||
this.closeTag(name);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = XMLWriter;
|
1
web/node_modules/istanbul-lib-report/node_modules/.bin/semver
generated
vendored
Symbolic link
1
web/node_modules/istanbul-lib-report/node_modules/.bin/semver
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
|||
../semver/bin/semver.js
|
66
web/node_modules/istanbul-lib-report/node_modules/make-dir/index.d.ts
generated
vendored
Normal file
66
web/node_modules/istanbul-lib-report/node_modules/make-dir/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,66 @@
|
|||
/// <reference types="node"/>
|
||||
import * as fs from 'fs';
|
||||
|
||||
declare namespace makeDir {
|
||||
interface Options {
|
||||
/**
|
||||
Directory [permissions](https://x-team.com/blog/file-system-permissions-umask-node-js/).
|
||||
|
||||
@default 0o777
|
||||
*/
|
||||
readonly mode?: number;
|
||||
|
||||
/**
|
||||
Use a custom `fs` implementation. For example [`graceful-fs`](https://github.com/isaacs/node-graceful-fs).
|
||||
|
||||
Using a custom `fs` implementation will block the use of the native `recursive` option if `fs.mkdir` or `fs.mkdirSync` is not the native function.
|
||||
|
||||
@default require('fs')
|
||||
*/
|
||||
readonly fs?: typeof fs;
|
||||
}
|
||||
}
|
||||
|
||||
declare const makeDir: {
|
||||
/**
|
||||
Make a directory and its parents if needed - Think `mkdir -p`.
|
||||
|
||||
@param path - Directory to create.
|
||||
@returns The path to the created directory.
|
||||
|
||||
@example
|
||||
```
|
||||
import makeDir = require('make-dir');
|
||||
|
||||
(async () => {
|
||||
const path = await makeDir('unicorn/rainbow/cake');
|
||||
|
||||
console.log(path);
|
||||
//=> '/Users/sindresorhus/fun/unicorn/rainbow/cake'
|
||||
|
||||
// Multiple directories:
|
||||
const paths = await Promise.all([
|
||||
makeDir('unicorn/rainbow'),
|
||||
makeDir('foo/bar')
|
||||
]);
|
||||
|
||||
console.log(paths);
|
||||
// [
|
||||
// '/Users/sindresorhus/fun/unicorn/rainbow',
|
||||
// '/Users/sindresorhus/fun/foo/bar'
|
||||
// ]
|
||||
})();
|
||||
```
|
||||
*/
|
||||
(path: string, options?: makeDir.Options): Promise<string>;
|
||||
|
||||
/**
|
||||
Synchronously make a directory and its parents if needed - Think `mkdir -p`.
|
||||
|
||||
@param path - Directory to create.
|
||||
@returns The path to the created directory.
|
||||
*/
|
||||
sync(path: string, options?: makeDir.Options): string;
|
||||
};
|
||||
|
||||
export = makeDir;
|
156
web/node_modules/istanbul-lib-report/node_modules/make-dir/index.js
generated
vendored
Normal file
156
web/node_modules/istanbul-lib-report/node_modules/make-dir/index.js
generated
vendored
Normal file
|
@ -0,0 +1,156 @@
|
|||
'use strict';
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const {promisify} = require('util');
|
||||
const semver = require('semver');
|
||||
|
||||
const useNativeRecursiveOption = semver.satisfies(process.version, '>=10.12.0');
|
||||
|
||||
// https://github.com/nodejs/node/issues/8987
|
||||
// https://github.com/libuv/libuv/pull/1088
|
||||
const checkPath = pth => {
|
||||
if (process.platform === 'win32') {
|
||||
const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path.parse(pth).root, ''));
|
||||
|
||||
if (pathHasInvalidWinCharacters) {
|
||||
const error = new Error(`Path contains invalid characters: ${pth}`);
|
||||
error.code = 'EINVAL';
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const processOptions = options => {
|
||||
// https://github.com/sindresorhus/make-dir/issues/18
|
||||
const defaults = {
|
||||
mode: 0o777,
|
||||
fs
|
||||
};
|
||||
|
||||
return {
|
||||
...defaults,
|
||||
...options
|
||||
};
|
||||
};
|
||||
|
||||
const permissionError = pth => {
|
||||
// This replicates the exception of `fs.mkdir` with native the
|
||||
// `recusive` option when run on an invalid drive under Windows.
|
||||
const error = new Error(`operation not permitted, mkdir '${pth}'`);
|
||||
error.code = 'EPERM';
|
||||
error.errno = -4048;
|
||||
error.path = pth;
|
||||
error.syscall = 'mkdir';
|
||||
return error;
|
||||
};
|
||||
|
||||
const makeDir = async (input, options) => {
|
||||
checkPath(input);
|
||||
options = processOptions(options);
|
||||
|
||||
const mkdir = promisify(options.fs.mkdir);
|
||||
const stat = promisify(options.fs.stat);
|
||||
|
||||
if (useNativeRecursiveOption && options.fs.mkdir === fs.mkdir) {
|
||||
const pth = path.resolve(input);
|
||||
|
||||
await mkdir(pth, {
|
||||
mode: options.mode,
|
||||
recursive: true
|
||||
});
|
||||
|
||||
return pth;
|
||||
}
|
||||
|
||||
const make = async pth => {
|
||||
try {
|
||||
await mkdir(pth, options.mode);
|
||||
|
||||
return pth;
|
||||
} catch (error) {
|
||||
if (error.code === 'EPERM') {
|
||||
throw error;
|
||||
}
|
||||
|
||||
if (error.code === 'ENOENT') {
|
||||
if (path.dirname(pth) === pth) {
|
||||
throw permissionError(pth);
|
||||
}
|
||||
|
||||
if (error.message.includes('null bytes')) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
await make(path.dirname(pth));
|
||||
|
||||
return make(pth);
|
||||
}
|
||||
|
||||
try {
|
||||
const stats = await stat(pth);
|
||||
if (!stats.isDirectory()) {
|
||||
throw new Error('The path is not a directory');
|
||||
}
|
||||
} catch (_) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
return pth;
|
||||
}
|
||||
};
|
||||
|
||||
return make(path.resolve(input));
|
||||
};
|
||||
|
||||
module.exports = makeDir;
|
||||
|
||||
module.exports.sync = (input, options) => {
|
||||
checkPath(input);
|
||||
options = processOptions(options);
|
||||
|
||||
if (useNativeRecursiveOption && options.fs.mkdirSync === fs.mkdirSync) {
|
||||
const pth = path.resolve(input);
|
||||
|
||||
fs.mkdirSync(pth, {
|
||||
mode: options.mode,
|
||||
recursive: true
|
||||
});
|
||||
|
||||
return pth;
|
||||
}
|
||||
|
||||
const make = pth => {
|
||||
try {
|
||||
options.fs.mkdirSync(pth, options.mode);
|
||||
} catch (error) {
|
||||
if (error.code === 'EPERM') {
|
||||
throw error;
|
||||
}
|
||||
|
||||
if (error.code === 'ENOENT') {
|
||||
if (path.dirname(pth) === pth) {
|
||||
throw permissionError(pth);
|
||||
}
|
||||
|
||||
if (error.message.includes('null bytes')) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
make(path.dirname(pth));
|
||||
return make(pth);
|
||||
}
|
||||
|
||||
try {
|
||||
if (!options.fs.statSync(pth).isDirectory()) {
|
||||
throw new Error('The path is not a directory');
|
||||
}
|
||||
} catch (_) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
return pth;
|
||||
};
|
||||
|
||||
return make(path.resolve(input));
|
||||
};
|
9
web/node_modules/istanbul-lib-report/node_modules/make-dir/license
generated
vendored
Normal file
9
web/node_modules/istanbul-lib-report/node_modules/make-dir/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.
|
59
web/node_modules/istanbul-lib-report/node_modules/make-dir/package.json
generated
vendored
Normal file
59
web/node_modules/istanbul-lib-report/node_modules/make-dir/package.json
generated
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
{
|
||||
"name": "make-dir",
|
||||
"version": "3.1.0",
|
||||
"description": "Make a directory and its parents if needed - Think `mkdir -p`",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/make-dir",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && nyc ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"mkdir",
|
||||
"mkdirp",
|
||||
"make",
|
||||
"directories",
|
||||
"dir",
|
||||
"dirs",
|
||||
"folders",
|
||||
"directory",
|
||||
"folder",
|
||||
"path",
|
||||
"parent",
|
||||
"parents",
|
||||
"intermediate",
|
||||
"recursively",
|
||||
"recursive",
|
||||
"create",
|
||||
"fs",
|
||||
"filesystem",
|
||||
"file-system"
|
||||
],
|
||||
"dependencies": {
|
||||
"semver": "^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/graceful-fs": "^4.1.3",
|
||||
"@types/node": "^13.7.1",
|
||||
"ava": "^1.4.0",
|
||||
"codecov": "^3.2.0",
|
||||
"graceful-fs": "^4.1.15",
|
||||
"nyc": "^15.0.0",
|
||||
"path-type": "^4.0.0",
|
||||
"tempy": "^0.2.1",
|
||||
"tsd": "^0.11.0",
|
||||
"xo": "^0.25.4"
|
||||
}
|
||||
}
|
125
web/node_modules/istanbul-lib-report/node_modules/make-dir/readme.md
generated
vendored
Normal file
125
web/node_modules/istanbul-lib-report/node_modules/make-dir/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,125 @@
|
|||
# make-dir [](https://travis-ci.org/sindresorhus/make-dir) [](https://codecov.io/gh/sindresorhus/make-dir)
|
||||
|
||||
> Make a directory and its parents if needed - Think `mkdir -p`
|
||||
|
||||
## Advantages over [`mkdirp`](https://github.com/substack/node-mkdirp)
|
||||
|
||||
- Promise API *(Async/await ready!)*
|
||||
- Fixes many `mkdirp` issues: [#96](https://github.com/substack/node-mkdirp/pull/96) [#70](https://github.com/substack/node-mkdirp/issues/70) [#66](https://github.com/substack/node-mkdirp/issues/66)
|
||||
- 100% test coverage
|
||||
- CI-tested on macOS, Linux, and Windows
|
||||
- Actively maintained
|
||||
- Doesn't bundle a CLI
|
||||
- Uses the native `fs.mkdir/mkdirSync` [`recursive` option](https://nodejs.org/dist/latest/docs/api/fs.html#fs_fs_mkdir_path_options_callback) in Node.js >=10.12.0 unless [overridden](#fs)
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install make-dir
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
$ pwd
|
||||
/Users/sindresorhus/fun
|
||||
$ tree
|
||||
.
|
||||
```
|
||||
|
||||
```js
|
||||
const makeDir = require('make-dir');
|
||||
|
||||
(async () => {
|
||||
const path = await makeDir('unicorn/rainbow/cake');
|
||||
|
||||
console.log(path);
|
||||
//=> '/Users/sindresorhus/fun/unicorn/rainbow/cake'
|
||||
})();
|
||||
```
|
||||
|
||||
```
|
||||
$ tree
|
||||
.
|
||||
└── unicorn
|
||||
└── rainbow
|
||||
└── cake
|
||||
```
|
||||
|
||||
Multiple directories:
|
||||
|
||||
```js
|
||||
const makeDir = require('make-dir');
|
||||
|
||||
(async () => {
|
||||
const paths = await Promise.all([
|
||||
makeDir('unicorn/rainbow'),
|
||||
makeDir('foo/bar')
|
||||
]);
|
||||
|
||||
console.log(paths);
|
||||
/*
|
||||
[
|
||||
'/Users/sindresorhus/fun/unicorn/rainbow',
|
||||
'/Users/sindresorhus/fun/foo/bar'
|
||||
]
|
||||
*/
|
||||
})();
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### makeDir(path, options?)
|
||||
|
||||
Returns a `Promise` for the path to the created directory.
|
||||
|
||||
### makeDir.sync(path, options?)
|
||||
|
||||
Returns the path to the created directory.
|
||||
|
||||
#### path
|
||||
|
||||
Type: `string`
|
||||
|
||||
Directory to create.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### mode
|
||||
|
||||
Type: `integer`\
|
||||
Default: `0o777`
|
||||
|
||||
Directory [permissions](https://x-team.com/blog/file-system-permissions-umask-node-js/).
|
||||
|
||||
##### fs
|
||||
|
||||
Type: `object`\
|
||||
Default: `require('fs')`
|
||||
|
||||
Use a custom `fs` implementation. For example [`graceful-fs`](https://github.com/isaacs/node-graceful-fs).
|
||||
|
||||
Using a custom `fs` implementation will block the use of the native `recursive` option if `fs.mkdir` or `fs.mkdirSync` is not the native function.
|
||||
|
||||
## Related
|
||||
|
||||
- [make-dir-cli](https://github.com/sindresorhus/make-dir-cli) - CLI for this module
|
||||
- [del](https://github.com/sindresorhus/del) - Delete files and directories
|
||||
- [globby](https://github.com/sindresorhus/globby) - User-friendly glob matching
|
||||
- [cpy](https://github.com/sindresorhus/cpy) - Copy files
|
||||
- [cpy-cli](https://github.com/sindresorhus/cpy-cli) - Copy files on the command-line
|
||||
- [move-file](https://github.com/sindresorhus/move-file) - Move a file
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-make-dir?utm_source=npm-make-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>
|
70
web/node_modules/istanbul-lib-report/node_modules/semver/CHANGELOG.md
generated
vendored
Normal file
70
web/node_modules/istanbul-lib-report/node_modules/semver/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,70 @@
|
|||
# changes log
|
||||
|
||||
## 6.2.0
|
||||
|
||||
* Coerce numbers to strings when passed to semver.coerce()
|
||||
* Add `rtl` option to coerce from right to left
|
||||
|
||||
## 6.1.3
|
||||
|
||||
* Handle X-ranges properly in includePrerelease mode
|
||||
|
||||
## 6.1.2
|
||||
|
||||
* Do not throw when testing invalid version strings
|
||||
|
||||
## 6.1.1
|
||||
|
||||
* Add options support for semver.coerce()
|
||||
* Handle undefined version passed to Range.test
|
||||
|
||||
## 6.1.0
|
||||
|
||||
* Add semver.compareBuild function
|
||||
* Support `*` in semver.intersects
|
||||
|
||||
## 6.0
|
||||
|
||||
* Fix `intersects` logic.
|
||||
|
||||
This is technically a bug fix, but since it is also a change to behavior
|
||||
that may require users updating their code, it is marked as a major
|
||||
version increment.
|
||||
|
||||
## 5.7
|
||||
|
||||
* Add `minVersion` method
|
||||
|
||||
## 5.6
|
||||
|
||||
* Move boolean `loose` param to an options object, with
|
||||
backwards-compatibility protection.
|
||||
* Add ability to opt out of special prerelease version handling with
|
||||
the `includePrerelease` option flag.
|
||||
|
||||
## 5.5
|
||||
|
||||
* Add version coercion capabilities
|
||||
|
||||
## 5.4
|
||||
|
||||
* Add intersection checking
|
||||
|
||||
## 5.3
|
||||
|
||||
* Add `minSatisfying` method
|
||||
|
||||
## 5.2
|
||||
|
||||
* Add `prerelease(v)` that returns prerelease components
|
||||
|
||||
## 5.1
|
||||
|
||||
* Add Backus-Naur for ranges
|
||||
* Remove excessively cute inspection methods
|
||||
|
||||
## 5.0
|
||||
|
||||
* Remove AMD/Browserified build artifacts
|
||||
* Fix ltr and gtr when using the `*` range
|
||||
* Fix for range `*` with a prerelease identifier
|
15
web/node_modules/istanbul-lib-report/node_modules/semver/LICENSE
generated
vendored
Normal file
15
web/node_modules/istanbul-lib-report/node_modules/semver/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
443
web/node_modules/istanbul-lib-report/node_modules/semver/README.md
generated
vendored
Normal file
443
web/node_modules/istanbul-lib-report/node_modules/semver/README.md
generated
vendored
Normal file
|
@ -0,0 +1,443 @@
|
|||
semver(1) -- The semantic versioner for npm
|
||||
===========================================
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm install semver
|
||||
````
|
||||
|
||||
## Usage
|
||||
|
||||
As a node module:
|
||||
|
||||
```js
|
||||
const semver = require('semver')
|
||||
|
||||
semver.valid('1.2.3') // '1.2.3'
|
||||
semver.valid('a.b.c') // null
|
||||
semver.clean(' =v1.2.3 ') // '1.2.3'
|
||||
semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true
|
||||
semver.gt('1.2.3', '9.8.7') // false
|
||||
semver.lt('1.2.3', '9.8.7') // true
|
||||
semver.minVersion('>=1.0.0') // '1.0.0'
|
||||
semver.valid(semver.coerce('v2')) // '2.0.0'
|
||||
semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7'
|
||||
```
|
||||
|
||||
As a command-line utility:
|
||||
|
||||
```
|
||||
$ semver -h
|
||||
|
||||
A JavaScript implementation of the https://semver.org/ specification
|
||||
Copyright Isaac Z. Schlueter
|
||||
|
||||
Usage: semver [options] <version> [<version> [...]]
|
||||
Prints valid versions sorted by SemVer precedence
|
||||
|
||||
Options:
|
||||
-r --range <range>
|
||||
Print versions that match the specified range.
|
||||
|
||||
-i --increment [<level>]
|
||||
Increment a version by the specified level. Level can
|
||||
be one of: major, minor, patch, premajor, preminor,
|
||||
prepatch, or prerelease. Default level is 'patch'.
|
||||
Only one version may be specified.
|
||||
|
||||
--preid <identifier>
|
||||
Identifier to be used to prefix premajor, preminor,
|
||||
prepatch or prerelease version increments.
|
||||
|
||||
-l --loose
|
||||
Interpret versions and ranges loosely
|
||||
|
||||
-p --include-prerelease
|
||||
Always include prerelease versions in range matching
|
||||
|
||||
-c --coerce
|
||||
Coerce a string into SemVer if possible
|
||||
(does not imply --loose)
|
||||
|
||||
--rtl
|
||||
Coerce version strings right to left
|
||||
|
||||
--ltr
|
||||
Coerce version strings left to right (default)
|
||||
|
||||
Program exits successfully if any valid version satisfies
|
||||
all supplied ranges, and prints all satisfying versions.
|
||||
|
||||
If no satisfying versions are found, then exits failure.
|
||||
|
||||
Versions are printed in ascending order, so supplying
|
||||
multiple versions to the utility will just sort them.
|
||||
```
|
||||
|
||||
## Versions
|
||||
|
||||
A "version" is described by the `v2.0.0` specification found at
|
||||
<https://semver.org/>.
|
||||
|
||||
A leading `"="` or `"v"` character is stripped off and ignored.
|
||||
|
||||
## Ranges
|
||||
|
||||
A `version range` is a set of `comparators` which specify versions
|
||||
that satisfy the range.
|
||||
|
||||
A `comparator` is composed of an `operator` and a `version`. The set
|
||||
of primitive `operators` is:
|
||||
|
||||
* `<` Less than
|
||||
* `<=` Less than or equal to
|
||||
* `>` Greater than
|
||||
* `>=` Greater than or equal to
|
||||
* `=` Equal. If no operator is specified, then equality is assumed,
|
||||
so this operator is optional, but MAY be included.
|
||||
|
||||
For example, the comparator `>=1.2.7` would match the versions
|
||||
`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6`
|
||||
or `1.1.0`.
|
||||
|
||||
Comparators can be joined by whitespace to form a `comparator set`,
|
||||
which is satisfied by the **intersection** of all of the comparators
|
||||
it includes.
|
||||
|
||||
A range is composed of one or more comparator sets, joined by `||`. A
|
||||
version matches a range if and only if every comparator in at least
|
||||
one of the `||`-separated comparator sets is satisfied by the version.
|
||||
|
||||
For example, the range `>=1.2.7 <1.3.0` would match the versions
|
||||
`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`,
|
||||
or `1.1.0`.
|
||||
|
||||
The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`,
|
||||
`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`.
|
||||
|
||||
### Prerelease Tags
|
||||
|
||||
If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then
|
||||
it will only be allowed to satisfy comparator sets if at least one
|
||||
comparator with the same `[major, minor, patch]` tuple also has a
|
||||
prerelease tag.
|
||||
|
||||
For example, the range `>1.2.3-alpha.3` would be allowed to match the
|
||||
version `1.2.3-alpha.7`, but it would *not* be satisfied by
|
||||
`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater
|
||||
than" `1.2.3-alpha.3` according to the SemVer sort rules. The version
|
||||
range only accepts prerelease tags on the `1.2.3` version. The
|
||||
version `3.4.5` *would* satisfy the range, because it does not have a
|
||||
prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`.
|
||||
|
||||
The purpose for this behavior is twofold. First, prerelease versions
|
||||
frequently are updated very quickly, and contain many breaking changes
|
||||
that are (by the author's design) not yet fit for public consumption.
|
||||
Therefore, by default, they are excluded from range matching
|
||||
semantics.
|
||||
|
||||
Second, a user who has opted into using a prerelease version has
|
||||
clearly indicated the intent to use *that specific* set of
|
||||
alpha/beta/rc versions. By including a prerelease tag in the range,
|
||||
the user is indicating that they are aware of the risk. However, it
|
||||
is still not appropriate to assume that they have opted into taking a
|
||||
similar risk on the *next* set of prerelease versions.
|
||||
|
||||
Note that this behavior can be suppressed (treating all prerelease
|
||||
versions as if they were normal versions, for the purpose of range
|
||||
matching) by setting the `includePrerelease` flag on the options
|
||||
object to any
|
||||
[functions](https://github.com/npm/node-semver#functions) that do
|
||||
range matching.
|
||||
|
||||
#### Prerelease Identifiers
|
||||
|
||||
The method `.inc` takes an additional `identifier` string argument that
|
||||
will append the value of the string as a prerelease identifier:
|
||||
|
||||
```javascript
|
||||
semver.inc('1.2.3', 'prerelease', 'beta')
|
||||
// '1.2.4-beta.0'
|
||||
```
|
||||
|
||||
command-line example:
|
||||
|
||||
```bash
|
||||
$ semver 1.2.3 -i prerelease --preid beta
|
||||
1.2.4-beta.0
|
||||
```
|
||||
|
||||
Which then can be used to increment further:
|
||||
|
||||
```bash
|
||||
$ semver 1.2.4-beta.0 -i prerelease
|
||||
1.2.4-beta.1
|
||||
```
|
||||
|
||||
### Advanced Range Syntax
|
||||
|
||||
Advanced range syntax desugars to primitive comparators in
|
||||
deterministic ways.
|
||||
|
||||
Advanced ranges may be combined in the same way as primitive
|
||||
comparators using white space or `||`.
|
||||
|
||||
#### Hyphen Ranges `X.Y.Z - A.B.C`
|
||||
|
||||
Specifies an inclusive set.
|
||||
|
||||
* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4`
|
||||
|
||||
If a partial version is provided as the first version in the inclusive
|
||||
range, then the missing pieces are replaced with zeroes.
|
||||
|
||||
* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4`
|
||||
|
||||
If a partial version is provided as the second version in the
|
||||
inclusive range, then all versions that start with the supplied parts
|
||||
of the tuple are accepted, but nothing that would be greater than the
|
||||
provided tuple parts.
|
||||
|
||||
* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0`
|
||||
* `1.2.3 - 2` := `>=1.2.3 <3.0.0`
|
||||
|
||||
#### X-Ranges `1.2.x` `1.X` `1.2.*` `*`
|
||||
|
||||
Any of `X`, `x`, or `*` may be used to "stand in" for one of the
|
||||
numeric values in the `[major, minor, patch]` tuple.
|
||||
|
||||
* `*` := `>=0.0.0` (Any version satisfies)
|
||||
* `1.x` := `>=1.0.0 <2.0.0` (Matching major version)
|
||||
* `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions)
|
||||
|
||||
A partial version range is treated as an X-Range, so the special
|
||||
character is in fact optional.
|
||||
|
||||
* `""` (empty string) := `*` := `>=0.0.0`
|
||||
* `1` := `1.x.x` := `>=1.0.0 <2.0.0`
|
||||
* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0`
|
||||
|
||||
#### Tilde Ranges `~1.2.3` `~1.2` `~1`
|
||||
|
||||
Allows patch-level changes if a minor version is specified on the
|
||||
comparator. Allows minor-level changes if not.
|
||||
|
||||
* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0`
|
||||
* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`)
|
||||
* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`)
|
||||
* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0`
|
||||
* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`)
|
||||
* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`)
|
||||
* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in
|
||||
the `1.2.3` version will be allowed, if they are greater than or
|
||||
equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but
|
||||
`1.2.4-beta.2` would not, because it is a prerelease of a
|
||||
different `[major, minor, patch]` tuple.
|
||||
|
||||
#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4`
|
||||
|
||||
Allows changes that do not modify the left-most non-zero element in the
|
||||
`[major, minor, patch]` tuple. In other words, this allows patch and
|
||||
minor updates for versions `1.0.0` and above, patch updates for
|
||||
versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`.
|
||||
|
||||
Many authors treat a `0.x` version as if the `x` were the major
|
||||
"breaking-change" indicator.
|
||||
|
||||
Caret ranges are ideal when an author may make breaking changes
|
||||
between `0.2.4` and `0.3.0` releases, which is a common practice.
|
||||
However, it presumes that there will *not* be breaking changes between
|
||||
`0.2.4` and `0.2.5`. It allows for changes that are presumed to be
|
||||
additive (but non-breaking), according to commonly observed practices.
|
||||
|
||||
* `^1.2.3` := `>=1.2.3 <2.0.0`
|
||||
* `^0.2.3` := `>=0.2.3 <0.3.0`
|
||||
* `^0.0.3` := `>=0.0.3 <0.0.4`
|
||||
* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in
|
||||
the `1.2.3` version will be allowed, if they are greater than or
|
||||
equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but
|
||||
`1.2.4-beta.2` would not, because it is a prerelease of a
|
||||
different `[major, minor, patch]` tuple.
|
||||
* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4` Note that prereleases in the
|
||||
`0.0.3` version *only* will be allowed, if they are greater than or
|
||||
equal to `beta`. So, `0.0.3-pr.2` would be allowed.
|
||||
|
||||
When parsing caret ranges, a missing `patch` value desugars to the
|
||||
number `0`, but will allow flexibility within that value, even if the
|
||||
major and minor versions are both `0`.
|
||||
|
||||
* `^1.2.x` := `>=1.2.0 <2.0.0`
|
||||
* `^0.0.x` := `>=0.0.0 <0.1.0`
|
||||
* `^0.0` := `>=0.0.0 <0.1.0`
|
||||
|
||||
A missing `minor` and `patch` values will desugar to zero, but also
|
||||
allow flexibility within those values, even if the major version is
|
||||
zero.
|
||||
|
||||
* `^1.x` := `>=1.0.0 <2.0.0`
|
||||
* `^0.x` := `>=0.0.0 <1.0.0`
|
||||
|
||||
### Range Grammar
|
||||
|
||||
Putting all this together, here is a Backus-Naur grammar for ranges,
|
||||
for the benefit of parser authors:
|
||||
|
||||
```bnf
|
||||
range-set ::= range ( logical-or range ) *
|
||||
logical-or ::= ( ' ' ) * '||' ( ' ' ) *
|
||||
range ::= hyphen | simple ( ' ' simple ) * | ''
|
||||
hyphen ::= partial ' - ' partial
|
||||
simple ::= primitive | partial | tilde | caret
|
||||
primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial
|
||||
partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )?
|
||||
xr ::= 'x' | 'X' | '*' | nr
|
||||
nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) *
|
||||
tilde ::= '~' partial
|
||||
caret ::= '^' partial
|
||||
qualifier ::= ( '-' pre )? ( '+' build )?
|
||||
pre ::= parts
|
||||
build ::= parts
|
||||
parts ::= part ( '.' part ) *
|
||||
part ::= nr | [-0-9A-Za-z]+
|
||||
```
|
||||
|
||||
## Functions
|
||||
|
||||
All methods and classes take a final `options` object argument. All
|
||||
options in this object are `false` by default. The options supported
|
||||
are:
|
||||
|
||||
- `loose` Be more forgiving about not-quite-valid semver strings.
|
||||
(Any resulting output will always be 100% strict compliant, of
|
||||
course.) For backwards compatibility reasons, if the `options`
|
||||
argument is a boolean value instead of an object, it is interpreted
|
||||
to be the `loose` param.
|
||||
- `includePrerelease` Set to suppress the [default
|
||||
behavior](https://github.com/npm/node-semver#prerelease-tags) of
|
||||
excluding prerelease tagged versions from ranges unless they are
|
||||
explicitly opted into.
|
||||
|
||||
Strict-mode Comparators and Ranges will be strict about the SemVer
|
||||
strings that they parse.
|
||||
|
||||
* `valid(v)`: Return the parsed version, or null if it's not valid.
|
||||
* `inc(v, release)`: Return the version incremented by the release
|
||||
type (`major`, `premajor`, `minor`, `preminor`, `patch`,
|
||||
`prepatch`, or `prerelease`), or null if it's not valid
|
||||
* `premajor` in one call will bump the version up to the next major
|
||||
version and down to a prerelease of that major version.
|
||||
`preminor`, and `prepatch` work the same way.
|
||||
* If called from a non-prerelease version, the `prerelease` will work the
|
||||
same as `prepatch`. It increments the patch version, then makes a
|
||||
prerelease. If the input version is already a prerelease it simply
|
||||
increments it.
|
||||
* `prerelease(v)`: Returns an array of prerelease components, or null
|
||||
if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]`
|
||||
* `major(v)`: Return the major version number.
|
||||
* `minor(v)`: Return the minor version number.
|
||||
* `patch(v)`: Return the patch version number.
|
||||
* `intersects(r1, r2, loose)`: Return true if the two supplied ranges
|
||||
or comparators intersect.
|
||||
* `parse(v)`: Attempt to parse a string as a semantic version, returning either
|
||||
a `SemVer` object or `null`.
|
||||
|
||||
### Comparison
|
||||
|
||||
* `gt(v1, v2)`: `v1 > v2`
|
||||
* `gte(v1, v2)`: `v1 >= v2`
|
||||
* `lt(v1, v2)`: `v1 < v2`
|
||||
* `lte(v1, v2)`: `v1 <= v2`
|
||||
* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent,
|
||||
even if they're not the exact same string. You already know how to
|
||||
compare strings.
|
||||
* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`.
|
||||
* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call
|
||||
the corresponding function above. `"==="` and `"!=="` do simple
|
||||
string comparison, but are included for completeness. Throws if an
|
||||
invalid comparison string is provided.
|
||||
* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if
|
||||
`v2` is greater. Sorts in ascending order if passed to `Array.sort()`.
|
||||
* `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions
|
||||
in descending order when passed to `Array.sort()`.
|
||||
* `compareBuild(v1, v2)`: The same as `compare` but considers `build` when two versions
|
||||
are equal. Sorts in ascending order if passed to `Array.sort()`.
|
||||
`v2` is greater. Sorts in ascending order if passed to `Array.sort()`.
|
||||
* `diff(v1, v2)`: Returns difference between two versions by the release type
|
||||
(`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`),
|
||||
or null if the versions are the same.
|
||||
|
||||
### Comparators
|
||||
|
||||
* `intersects(comparator)`: Return true if the comparators intersect
|
||||
|
||||
### Ranges
|
||||
|
||||
* `validRange(range)`: Return the valid range or null if it's not valid
|
||||
* `satisfies(version, range)`: Return true if the version satisfies the
|
||||
range.
|
||||
* `maxSatisfying(versions, range)`: Return the highest version in the list
|
||||
that satisfies the range, or `null` if none of them do.
|
||||
* `minSatisfying(versions, range)`: Return the lowest version in the list
|
||||
that satisfies the range, or `null` if none of them do.
|
||||
* `minVersion(range)`: Return the lowest version that can possibly match
|
||||
the given range.
|
||||
* `gtr(version, range)`: Return `true` if version is greater than all the
|
||||
versions possible in the range.
|
||||
* `ltr(version, range)`: Return `true` if version is less than all the
|
||||
versions possible in the range.
|
||||
* `outside(version, range, hilo)`: Return true if the version is outside
|
||||
the bounds of the range in either the high or low direction. The
|
||||
`hilo` argument must be either the string `'>'` or `'<'`. (This is
|
||||
the function called by `gtr` and `ltr`.)
|
||||
* `intersects(range)`: Return true if any of the ranges comparators intersect
|
||||
|
||||
Note that, since ranges may be non-contiguous, a version might not be
|
||||
greater than a range, less than a range, *or* satisfy a range! For
|
||||
example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9`
|
||||
until `2.0.0`, so the version `1.2.10` would not be greater than the
|
||||
range (because `2.0.1` satisfies, which is higher), nor less than the
|
||||
range (since `1.2.8` satisfies, which is lower), and it also does not
|
||||
satisfy the range.
|
||||
|
||||
If you want to know if a version satisfies or does not satisfy a
|
||||
range, use the `satisfies(version, range)` function.
|
||||
|
||||
### Coercion
|
||||
|
||||
* `coerce(version, options)`: Coerces a string to semver if possible
|
||||
|
||||
This aims to provide a very forgiving translation of a non-semver string to
|
||||
semver. It looks for the first digit in a string, and consumes all
|
||||
remaining characters which satisfy at least a partial semver (e.g., `1`,
|
||||
`1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer
|
||||
versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All
|
||||
surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes
|
||||
`3.4.0`). Only text which lacks digits will fail coercion (`version one`
|
||||
is not valid). The maximum length for any semver component considered for
|
||||
coercion is 16 characters; longer components will be ignored
|
||||
(`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any
|
||||
semver component is `Integer.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value
|
||||
components are invalid (`9999999999999999.4.7.4` is likely invalid).
|
||||
|
||||
If the `options.rtl` flag is set, then `coerce` will return the right-most
|
||||
coercible tuple that does not share an ending index with a longer coercible
|
||||
tuple. For example, `1.2.3.4` will return `2.3.4` in rtl mode, not
|
||||
`4.0.0`. `1.2.3/4` will return `4.0.0`, because the `4` is not a part of
|
||||
any other overlapping SemVer tuple.
|
||||
|
||||
### Clean
|
||||
|
||||
* `clean(version)`: Clean a string to be a valid semver if possible
|
||||
|
||||
This will return a cleaned and trimmed semver version. If the provided version is not valid a null will be returned. This does not work for ranges.
|
||||
|
||||
ex.
|
||||
* `s.clean(' = v 2.1.5foo')`: `null`
|
||||
* `s.clean(' = v 2.1.5foo', { loose: true })`: `'2.1.5-foo'`
|
||||
* `s.clean(' = v 2.1.5-foo')`: `null`
|
||||
* `s.clean(' = v 2.1.5-foo', { loose: true })`: `'2.1.5-foo'`
|
||||
* `s.clean('=v2.1.5')`: `'2.1.5'`
|
||||
* `s.clean(' =v2.1.5')`: `2.1.5`
|
||||
* `s.clean(' 2.1.5 ')`: `'2.1.5'`
|
||||
* `s.clean('~1.0.0')`: `null`
|
174
web/node_modules/istanbul-lib-report/node_modules/semver/bin/semver.js
generated
vendored
Executable file
174
web/node_modules/istanbul-lib-report/node_modules/semver/bin/semver.js
generated
vendored
Executable file
|
@ -0,0 +1,174 @@
|
|||
#!/usr/bin/env node
|
||||
// Standalone semver comparison program.
|
||||
// Exits successfully and prints matching version(s) if
|
||||
// any supplied version is valid and passes all tests.
|
||||
|
||||
var argv = process.argv.slice(2)
|
||||
|
||||
var versions = []
|
||||
|
||||
var range = []
|
||||
|
||||
var inc = null
|
||||
|
||||
var version = require('../package.json').version
|
||||
|
||||
var loose = false
|
||||
|
||||
var includePrerelease = false
|
||||
|
||||
var coerce = false
|
||||
|
||||
var rtl = false
|
||||
|
||||
var identifier
|
||||
|
||||
var semver = require('../semver')
|
||||
|
||||
var reverse = false
|
||||
|
||||
var options = {}
|
||||
|
||||
main()
|
||||
|
||||
function main () {
|
||||
if (!argv.length) return help()
|
||||
while (argv.length) {
|
||||
var a = argv.shift()
|
||||
var indexOfEqualSign = a.indexOf('=')
|
||||
if (indexOfEqualSign !== -1) {
|
||||
a = a.slice(0, indexOfEqualSign)
|
||||
argv.unshift(a.slice(indexOfEqualSign + 1))
|
||||
}
|
||||
switch (a) {
|
||||
case '-rv': case '-rev': case '--rev': case '--reverse':
|
||||
reverse = true
|
||||
break
|
||||
case '-l': case '--loose':
|
||||
loose = true
|
||||
break
|
||||
case '-p': case '--include-prerelease':
|
||||
includePrerelease = true
|
||||
break
|
||||
case '-v': case '--version':
|
||||
versions.push(argv.shift())
|
||||
break
|
||||
case '-i': case '--inc': case '--increment':
|
||||
switch (argv[0]) {
|
||||
case 'major': case 'minor': case 'patch': case 'prerelease':
|
||||
case 'premajor': case 'preminor': case 'prepatch':
|
||||
inc = argv.shift()
|
||||
break
|
||||
default:
|
||||
inc = 'patch'
|
||||
break
|
||||
}
|
||||
break
|
||||
case '--preid':
|
||||
identifier = argv.shift()
|
||||
break
|
||||
case '-r': case '--range':
|
||||
range.push(argv.shift())
|
||||
break
|
||||
case '-c': case '--coerce':
|
||||
coerce = true
|
||||
break
|
||||
case '--rtl':
|
||||
rtl = true
|
||||
break
|
||||
case '--ltr':
|
||||
rtl = false
|
||||
break
|
||||
case '-h': case '--help': case '-?':
|
||||
return help()
|
||||
default:
|
||||
versions.push(a)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
var options = { loose: loose, includePrerelease: includePrerelease, rtl: rtl }
|
||||
|
||||
versions = versions.map(function (v) {
|
||||
return coerce ? (semver.coerce(v, options) || { version: v }).version : v
|
||||
}).filter(function (v) {
|
||||
return semver.valid(v)
|
||||
})
|
||||
if (!versions.length) return fail()
|
||||
if (inc && (versions.length !== 1 || range.length)) { return failInc() }
|
||||
|
||||
for (var i = 0, l = range.length; i < l; i++) {
|
||||
versions = versions.filter(function (v) {
|
||||
return semver.satisfies(v, range[i], options)
|
||||
})
|
||||
if (!versions.length) return fail()
|
||||
}
|
||||
return success(versions)
|
||||
}
|
||||
|
||||
function failInc () {
|
||||
console.error('--inc can only be used on a single version with no range')
|
||||
fail()
|
||||
}
|
||||
|
||||
function fail () { process.exit(1) }
|
||||
|
||||
function success () {
|
||||
var compare = reverse ? 'rcompare' : 'compare'
|
||||
versions.sort(function (a, b) {
|
||||
return semver[compare](a, b, options)
|
||||
}).map(function (v) {
|
||||
return semver.clean(v, options)
|
||||
}).map(function (v) {
|
||||
return inc ? semver.inc(v, inc, options, identifier) : v
|
||||
}).forEach(function (v, i, _) { console.log(v) })
|
||||
}
|
||||
|
||||
function help () {
|
||||
console.log(['SemVer ' + version,
|
||||
'',
|
||||
'A JavaScript implementation of the https://semver.org/ specification',
|
||||
'Copyright Isaac Z. Schlueter',
|
||||
'',
|
||||
'Usage: semver [options] <version> [<version> [...]]',
|
||||
'Prints valid versions sorted by SemVer precedence',
|
||||
'',
|
||||
'Options:',
|
||||
'-r --range <range>',
|
||||
' Print versions that match the specified range.',
|
||||
'',
|
||||
'-i --increment [<level>]',
|
||||
' Increment a version by the specified level. Level can',
|
||||
' be one of: major, minor, patch, premajor, preminor,',
|
||||
" prepatch, or prerelease. Default level is 'patch'.",
|
||||
' Only one version may be specified.',
|
||||
'',
|
||||
'--preid <identifier>',
|
||||
' Identifier to be used to prefix premajor, preminor,',
|
||||
' prepatch or prerelease version increments.',
|
||||
'',
|
||||
'-l --loose',
|
||||
' Interpret versions and ranges loosely',
|
||||
'',
|
||||
'-p --include-prerelease',
|
||||
' Always include prerelease versions in range matching',
|
||||
'',
|
||||
'-c --coerce',
|
||||
' Coerce a string into SemVer if possible',
|
||||
' (does not imply --loose)',
|
||||
'',
|
||||
'--rtl',
|
||||
' Coerce version strings right to left',
|
||||
'',
|
||||
'--ltr',
|
||||
' Coerce version strings left to right (default)',
|
||||
'',
|
||||
'Program exits successfully if any valid version satisfies',
|
||||
'all supplied ranges, and prints all satisfying versions.',
|
||||
'',
|
||||
'If no satisfying versions are found, then exits failure.',
|
||||
'',
|
||||
'Versions are printed in ascending order, so supplying',
|
||||
'multiple versions to the utility will just sort them.'
|
||||
].join('\n'))
|
||||
}
|
28
web/node_modules/istanbul-lib-report/node_modules/semver/package.json
generated
vendored
Normal file
28
web/node_modules/istanbul-lib-report/node_modules/semver/package.json
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"name": "semver",
|
||||
"version": "6.3.0",
|
||||
"description": "The semantic version parser used by npm.",
|
||||
"main": "semver.js",
|
||||
"scripts": {
|
||||
"test": "tap",
|
||||
"preversion": "npm test",
|
||||
"postversion": "npm publish",
|
||||
"postpublish": "git push origin --follow-tags"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tap": "^14.3.1"
|
||||
},
|
||||
"license": "ISC",
|
||||
"repository": "https://github.com/npm/node-semver",
|
||||
"bin": {
|
||||
"semver": "./bin/semver.js"
|
||||
},
|
||||
"files": [
|
||||
"bin",
|
||||
"range.bnf",
|
||||
"semver.js"
|
||||
],
|
||||
"tap": {
|
||||
"check-coverage": true
|
||||
}
|
||||
}
|
16
web/node_modules/istanbul-lib-report/node_modules/semver/range.bnf
generated
vendored
Normal file
16
web/node_modules/istanbul-lib-report/node_modules/semver/range.bnf
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
range-set ::= range ( logical-or range ) *
|
||||
logical-or ::= ( ' ' ) * '||' ( ' ' ) *
|
||||
range ::= hyphen | simple ( ' ' simple ) * | ''
|
||||
hyphen ::= partial ' - ' partial
|
||||
simple ::= primitive | partial | tilde | caret
|
||||
primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial
|
||||
partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )?
|
||||
xr ::= 'x' | 'X' | '*' | nr
|
||||
nr ::= '0' | [1-9] ( [0-9] ) *
|
||||
tilde ::= '~' partial
|
||||
caret ::= '^' partial
|
||||
qualifier ::= ( '-' pre )? ( '+' build )?
|
||||
pre ::= parts
|
||||
build ::= parts
|
||||
parts ::= part ( '.' part ) *
|
||||
part ::= nr | [-0-9A-Za-z]+
|
1596
web/node_modules/istanbul-lib-report/node_modules/semver/semver.js
generated
vendored
Normal file
1596
web/node_modules/istanbul-lib-report/node_modules/semver/semver.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
45
web/node_modules/istanbul-lib-report/package.json
generated
vendored
Normal file
45
web/node_modules/istanbul-lib-report/package.json
generated
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"name": "istanbul-lib-report",
|
||||
"version": "3.0.0",
|
||||
"description": "Base reporting library for istanbul",
|
||||
"author": "Krishnan Anantheswaran <kananthmail-github@yahoo.com>",
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
"lib",
|
||||
"index.js"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "nyc --nycrc-path=../../monorepo-per-package-full.js mocha"
|
||||
},
|
||||
"dependencies": {
|
||||
"istanbul-lib-coverage": "^3.0.0",
|
||||
"make-dir": "^3.0.0",
|
||||
"supports-color": "^7.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "^4.2.0",
|
||||
"mocha": "^6.2.2",
|
||||
"nyc": "^15.0.0-beta.2",
|
||||
"rimraf": "^3.0.0"
|
||||
},
|
||||
"license": "BSD-3-Clause",
|
||||
"bugs": {
|
||||
"url": "https://github.com/istanbuljs/istanbuljs/issues"
|
||||
},
|
||||
"homepage": "https://istanbul.js.org/",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/istanbuljs/istanbuljs.git",
|
||||
"directory": "packages/istanbul-lib-report"
|
||||
},
|
||||
"keywords": [
|
||||
"istanbul",
|
||||
"report",
|
||||
"api",
|
||||
"lib"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"gitHead": "5319df684b508ff6fb19fe8b9a6147a3c5924e4b"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue