mirror of
https://github.com/joelwmale/webhook-action.git
synced 2024-08-25 08:08:00 +00:00
wip
This commit is contained in:
parent
852bbaa622
commit
1143d5b401
135
dist/index.js
vendored
135
dist/index.js
vendored
@ -6937,21 +6937,18 @@ exports.debug = debug; // for test
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.http = void 0;
|
||||
var fetch = __nccwpck_require__(4429);
|
||||
const fetch = __nccwpck_require__(4429);
|
||||
var https = __nccwpck_require__(5687);
|
||||
var Http = (function () {
|
||||
function Http() {
|
||||
}
|
||||
Http.prototype.make = function (url, headers, body, ignoreCertificate) {
|
||||
var _this = this;
|
||||
return new Promise(function (resolve, reject) {
|
||||
fetch(url, _this.getOptions('post', headers, body, ignoreCertificate)).then(function (res) { return resolve(res); });
|
||||
class Http {
|
||||
make(url, headers, body, ignoreCertificate) {
|
||||
return new Promise((resolve, reject) => {
|
||||
fetch(url, this.getOptions('post', headers, body, ignoreCertificate)).then((res) => resolve(res));
|
||||
});
|
||||
};
|
||||
Http.prototype.getOptions = function (method, headers, body, ignoreCertificate) {
|
||||
var options = {
|
||||
}
|
||||
getOptions(method, headers, body, ignoreCertificate) {
|
||||
const options = {
|
||||
headers: headers ? JSON.parse(headers) : {},
|
||||
method: method
|
||||
method
|
||||
};
|
||||
if (body) {
|
||||
options.body = body;
|
||||
@ -6961,9 +6958,8 @@ var Http = (function () {
|
||||
}
|
||||
options.headers['content-type'] = 'application/json';
|
||||
return options;
|
||||
};
|
||||
return Http;
|
||||
}());
|
||||
}
|
||||
}
|
||||
exports.http = new Http();
|
||||
|
||||
|
||||
@ -6983,83 +6979,52 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
var core = __nccwpck_require__(2186);
|
||||
var http_1 = __nccwpck_require__(9047);
|
||||
const core = __nccwpck_require__(2186);
|
||||
const http_1 = __nccwpck_require__(9047);
|
||||
function run() {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var url, headers, body, insecure;
|
||||
return __generator(this, function (_a) {
|
||||
url = core.getInput('url')
|
||||
? core.getInput('url')
|
||||
: process.env.WEBHOOK_URL
|
||||
? process.env.WEBHOOK_URL
|
||||
: '';
|
||||
headers = core.getInput('headers')
|
||||
? core.getInput('headers')
|
||||
: process.env.headers
|
||||
? process.env.headers
|
||||
: null;
|
||||
body = core.getInput('body')
|
||||
? core.getInput('body')
|
||||
: process.env.data
|
||||
? process.env.data
|
||||
: null;
|
||||
insecure = core.getInput('insecure')
|
||||
? core.getInput('insecure') == 'true'
|
||||
: process.env.insecure
|
||||
? process.env.insecure == 'true'
|
||||
: false;
|
||||
if (!url) {
|
||||
core.setFailed('A url is required to run this action.');
|
||||
throw new Error('A url is required to run this action.');
|
||||
}
|
||||
http_1.http
|
||||
.make(url, headers, body, insecure)
|
||||
.then(function (res) {
|
||||
if (res.status >= 400) {
|
||||
error(res.status);
|
||||
return;
|
||||
}
|
||||
})
|
||||
.catch(function (err) {
|
||||
error(err.status);
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const url = core.getInput('url')
|
||||
? core.getInput('url')
|
||||
: process.env.WEBHOOK_URL
|
||||
? process.env.WEBHOOK_URL
|
||||
: '';
|
||||
const headers = core.getInput('headers')
|
||||
? core.getInput('headers')
|
||||
: process.env.headers
|
||||
? process.env.headers
|
||||
: null;
|
||||
const body = core.getInput('body')
|
||||
? core.getInput('body')
|
||||
: process.env.data
|
||||
? process.env.data
|
||||
: null;
|
||||
const insecure = core.getInput('insecure')
|
||||
? core.getInput('insecure') == 'true'
|
||||
: process.env.insecure
|
||||
? process.env.insecure == 'true'
|
||||
: false;
|
||||
if (!url) {
|
||||
core.setFailed('A url is required to run this action.');
|
||||
throw new Error('A url is required to run this action.');
|
||||
}
|
||||
http_1.http
|
||||
.make(url, headers, body, insecure)
|
||||
.then(res => {
|
||||
if (res.status >= 400) {
|
||||
error(res.status);
|
||||
return;
|
||||
});
|
||||
return [2];
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
error(err.status);
|
||||
return;
|
||||
});
|
||||
});
|
||||
}
|
||||
function error(statusCode) {
|
||||
core.setFailed("Received status code: ".concat(statusCode));
|
||||
throw new Error("Request failed with status code: ".concat(statusCode));
|
||||
core.setFailed(`Received status code: ${statusCode}`);
|
||||
throw new Error(`Request failed with status code: ${statusCode}`);
|
||||
}
|
||||
run();
|
||||
|
||||
|
22
node_modules/@babel/code-frame/LICENSE
generated
vendored
22
node_modules/@babel/code-frame/LICENSE
generated
vendored
@ -1,22 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
19
node_modules/@babel/code-frame/README.md
generated
vendored
19
node_modules/@babel/code-frame/README.md
generated
vendored
@ -1,19 +0,0 @@
|
||||
# @babel/code-frame
|
||||
|
||||
> Generate errors that contain a code frame that point to source locations.
|
||||
|
||||
See our website [@babel/code-frame](https://babeljs.io/docs/en/babel-code-frame) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/code-frame
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/code-frame --dev
|
||||
```
|
163
node_modules/@babel/code-frame/lib/index.js
generated
vendored
163
node_modules/@babel/code-frame/lib/index.js
generated
vendored
@ -1,163 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.codeFrameColumns = codeFrameColumns;
|
||||
exports.default = _default;
|
||||
|
||||
var _highlight = require("@babel/highlight");
|
||||
|
||||
let deprecationWarningShown = false;
|
||||
|
||||
function getDefs(chalk) {
|
||||
return {
|
||||
gutter: chalk.grey,
|
||||
marker: chalk.red.bold,
|
||||
message: chalk.red.bold
|
||||
};
|
||||
}
|
||||
|
||||
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
||||
|
||||
function getMarkerLines(loc, source, opts) {
|
||||
const startLoc = Object.assign({
|
||||
column: 0,
|
||||
line: -1
|
||||
}, loc.start);
|
||||
const endLoc = Object.assign({}, startLoc, loc.end);
|
||||
const {
|
||||
linesAbove = 2,
|
||||
linesBelow = 3
|
||||
} = opts || {};
|
||||
const startLine = startLoc.line;
|
||||
const startColumn = startLoc.column;
|
||||
const endLine = endLoc.line;
|
||||
const endColumn = endLoc.column;
|
||||
let start = Math.max(startLine - (linesAbove + 1), 0);
|
||||
let end = Math.min(source.length, endLine + linesBelow);
|
||||
|
||||
if (startLine === -1) {
|
||||
start = 0;
|
||||
}
|
||||
|
||||
if (endLine === -1) {
|
||||
end = source.length;
|
||||
}
|
||||
|
||||
const lineDiff = endLine - startLine;
|
||||
const markerLines = {};
|
||||
|
||||
if (lineDiff) {
|
||||
for (let i = 0; i <= lineDiff; i++) {
|
||||
const lineNumber = i + startLine;
|
||||
|
||||
if (!startColumn) {
|
||||
markerLines[lineNumber] = true;
|
||||
} else if (i === 0) {
|
||||
const sourceLength = source[lineNumber - 1].length;
|
||||
markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];
|
||||
} else if (i === lineDiff) {
|
||||
markerLines[lineNumber] = [0, endColumn];
|
||||
} else {
|
||||
const sourceLength = source[lineNumber - i].length;
|
||||
markerLines[lineNumber] = [0, sourceLength];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (startColumn === endColumn) {
|
||||
if (startColumn) {
|
||||
markerLines[startLine] = [startColumn, 0];
|
||||
} else {
|
||||
markerLines[startLine] = true;
|
||||
}
|
||||
} else {
|
||||
markerLines[startLine] = [startColumn, endColumn - startColumn];
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
start,
|
||||
end,
|
||||
markerLines
|
||||
};
|
||||
}
|
||||
|
||||
function codeFrameColumns(rawLines, loc, opts = {}) {
|
||||
const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight.shouldHighlight)(opts);
|
||||
const chalk = (0, _highlight.getChalk)(opts);
|
||||
const defs = getDefs(chalk);
|
||||
|
||||
const maybeHighlight = (chalkFn, string) => {
|
||||
return highlighted ? chalkFn(string) : string;
|
||||
};
|
||||
|
||||
const lines = rawLines.split(NEWLINE);
|
||||
const {
|
||||
start,
|
||||
end,
|
||||
markerLines
|
||||
} = getMarkerLines(loc, lines, opts);
|
||||
const hasColumns = loc.start && typeof loc.start.column === "number";
|
||||
const numberMaxWidth = String(end).length;
|
||||
const highlightedLines = highlighted ? (0, _highlight.default)(rawLines, opts) : rawLines;
|
||||
let frame = highlightedLines.split(NEWLINE, end).slice(start, end).map((line, index) => {
|
||||
const number = start + 1 + index;
|
||||
const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
|
||||
const gutter = ` ${paddedNumber} |`;
|
||||
const hasMarker = markerLines[number];
|
||||
const lastMarkerLine = !markerLines[number + 1];
|
||||
|
||||
if (hasMarker) {
|
||||
let markerLine = "";
|
||||
|
||||
if (Array.isArray(hasMarker)) {
|
||||
const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
|
||||
const numberOfMarkers = hasMarker[1] || 1;
|
||||
markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), " ", markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
|
||||
|
||||
if (lastMarkerLine && opts.message) {
|
||||
markerLine += " " + maybeHighlight(defs.message, opts.message);
|
||||
}
|
||||
}
|
||||
|
||||
return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line.length > 0 ? ` ${line}` : "", markerLine].join("");
|
||||
} else {
|
||||
return ` ${maybeHighlight(defs.gutter, gutter)}${line.length > 0 ? ` ${line}` : ""}`;
|
||||
}
|
||||
}).join("\n");
|
||||
|
||||
if (opts.message && !hasColumns) {
|
||||
frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}\n${frame}`;
|
||||
}
|
||||
|
||||
if (highlighted) {
|
||||
return chalk.reset(frame);
|
||||
} else {
|
||||
return frame;
|
||||
}
|
||||
}
|
||||
|
||||
function _default(rawLines, lineNumber, colNumber, opts = {}) {
|
||||
if (!deprecationWarningShown) {
|
||||
deprecationWarningShown = true;
|
||||
const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
|
||||
|
||||
if (process.emitWarning) {
|
||||
process.emitWarning(message, "DeprecationWarning");
|
||||
} else {
|
||||
const deprecationError = new Error(message);
|
||||
deprecationError.name = "DeprecationWarning";
|
||||
console.warn(new Error(message));
|
||||
}
|
||||
}
|
||||
|
||||
colNumber = Math.max(colNumber, 0);
|
||||
const location = {
|
||||
start: {
|
||||
column: colNumber,
|
||||
line: lineNumber
|
||||
}
|
||||
};
|
||||
return codeFrameColumns(rawLines, location, opts);
|
||||
}
|
30
node_modules/@babel/code-frame/package.json
generated
vendored
30
node_modules/@babel/code-frame/package.json
generated
vendored
@ -1,30 +0,0 @@
|
||||
{
|
||||
"name": "@babel/code-frame",
|
||||
"version": "7.18.6",
|
||||
"description": "Generate errors that contain a code frame that point to source locations.",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"homepage": "https://babel.dev/docs/en/next/babel-code-frame",
|
||||
"bugs": "https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen",
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-code-frame"
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/highlight": "^7.18.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/chalk": "^2.0.0",
|
||||
"chalk": "^2.0.0",
|
||||
"strip-ansi": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
},
|
||||
"type": "commonjs"
|
||||
}
|
22
node_modules/@babel/helper-validator-identifier/LICENSE
generated
vendored
22
node_modules/@babel/helper-validator-identifier/LICENSE
generated
vendored
@ -1,22 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
19
node_modules/@babel/helper-validator-identifier/README.md
generated
vendored
19
node_modules/@babel/helper-validator-identifier/README.md
generated
vendored
@ -1,19 +0,0 @@
|
||||
# @babel/helper-validator-identifier
|
||||
|
||||
> Validate identifier/keywords name
|
||||
|
||||
See our website [@babel/helper-validator-identifier](https://babeljs.io/docs/en/babel-helper-validator-identifier) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save @babel/helper-validator-identifier
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/helper-validator-identifier
|
||||
```
|
86
node_modules/@babel/helper-validator-identifier/lib/identifier.js
generated
vendored
86
node_modules/@babel/helper-validator-identifier/lib/identifier.js
generated
vendored
@ -1,86 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.isIdentifierChar = isIdentifierChar;
|
||||
exports.isIdentifierName = isIdentifierName;
|
||||
exports.isIdentifierStart = isIdentifierStart;
|
||||
let nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ca\ua7d0\ua7d1\ua7d3\ua7d5-\ua7d9\ua7f2-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
|
||||
let nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0898-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0cf3\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ece\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f";
|
||||
const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
|
||||
const nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
|
||||
nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
|
||||
const astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 68, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 4026, 582, 8634, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8936, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 757, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4153, 7, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938, 6, 4191];
|
||||
const astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 81, 2, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 9, 5351, 0, 7, 14, 13835, 9, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 983, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
|
||||
|
||||
function isInAstralSet(code, set) {
|
||||
let pos = 0x10000;
|
||||
|
||||
for (let i = 0, length = set.length; i < length; i += 2) {
|
||||
pos += set[i];
|
||||
if (pos > code) return false;
|
||||
pos += set[i + 1];
|
||||
if (pos >= code) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function isIdentifierStart(code) {
|
||||
if (code < 65) return code === 36;
|
||||
if (code <= 90) return true;
|
||||
if (code < 97) return code === 95;
|
||||
if (code <= 122) return true;
|
||||
|
||||
if (code <= 0xffff) {
|
||||
return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code));
|
||||
}
|
||||
|
||||
return isInAstralSet(code, astralIdentifierStartCodes);
|
||||
}
|
||||
|
||||
function isIdentifierChar(code) {
|
||||
if (code < 48) return code === 36;
|
||||
if (code < 58) return true;
|
||||
if (code < 65) return false;
|
||||
if (code <= 90) return true;
|
||||
if (code < 97) return code === 95;
|
||||
if (code <= 122) return true;
|
||||
|
||||
if (code <= 0xffff) {
|
||||
return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));
|
||||
}
|
||||
|
||||
return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
|
||||
}
|
||||
|
||||
function isIdentifierName(name) {
|
||||
let isFirst = true;
|
||||
|
||||
for (let i = 0; i < name.length; i++) {
|
||||
let cp = name.charCodeAt(i);
|
||||
|
||||
if ((cp & 0xfc00) === 0xd800 && i + 1 < name.length) {
|
||||
const trail = name.charCodeAt(++i);
|
||||
|
||||
if ((trail & 0xfc00) === 0xdc00) {
|
||||
cp = 0x10000 + ((cp & 0x3ff) << 10) + (trail & 0x3ff);
|
||||
}
|
||||
}
|
||||
|
||||
if (isFirst) {
|
||||
isFirst = false;
|
||||
|
||||
if (!isIdentifierStart(cp)) {
|
||||
return false;
|
||||
}
|
||||
} else if (!isIdentifierChar(cp)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return !isFirst;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=identifier.js.map
|
59
node_modules/@babel/helper-validator-identifier/lib/index.js
generated
vendored
59
node_modules/@babel/helper-validator-identifier/lib/index.js
generated
vendored
@ -1,59 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "isIdentifierChar", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _identifier.isIdentifierChar;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isIdentifierName", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _identifier.isIdentifierName;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isIdentifierStart", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _identifier.isIdentifierStart;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isKeyword", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _keyword.isKeyword;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isReservedWord", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _keyword.isReservedWord;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isStrictBindOnlyReservedWord", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _keyword.isStrictBindOnlyReservedWord;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isStrictBindReservedWord", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _keyword.isStrictBindReservedWord;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isStrictReservedWord", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _keyword.isStrictReservedWord;
|
||||
}
|
||||
});
|
||||
|
||||
var _identifier = require("./identifier");
|
||||
|
||||
var _keyword = require("./keyword");
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
40
node_modules/@babel/helper-validator-identifier/lib/keyword.js
generated
vendored
40
node_modules/@babel/helper-validator-identifier/lib/keyword.js
generated
vendored
@ -1,40 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.isKeyword = isKeyword;
|
||||
exports.isReservedWord = isReservedWord;
|
||||
exports.isStrictBindOnlyReservedWord = isStrictBindOnlyReservedWord;
|
||||
exports.isStrictBindReservedWord = isStrictBindReservedWord;
|
||||
exports.isStrictReservedWord = isStrictReservedWord;
|
||||
const reservedWords = {
|
||||
keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"],
|
||||
strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"],
|
||||
strictBind: ["eval", "arguments"]
|
||||
};
|
||||
const keywords = new Set(reservedWords.keyword);
|
||||
const reservedWordsStrictSet = new Set(reservedWords.strict);
|
||||
const reservedWordsStrictBindSet = new Set(reservedWords.strictBind);
|
||||
|
||||
function isReservedWord(word, inModule) {
|
||||
return inModule && word === "await" || word === "enum";
|
||||
}
|
||||
|
||||
function isStrictReservedWord(word, inModule) {
|
||||
return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
|
||||
}
|
||||
|
||||
function isStrictBindOnlyReservedWord(word) {
|
||||
return reservedWordsStrictBindSet.has(word);
|
||||
}
|
||||
|
||||
function isStrictBindReservedWord(word, inModule) {
|
||||
return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
|
||||
}
|
||||
|
||||
function isKeyword(word) {
|
||||
return keywords.has(word);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=keyword.js.map
|
28
node_modules/@babel/helper-validator-identifier/package.json
generated
vendored
28
node_modules/@babel/helper-validator-identifier/package.json
generated
vendored
@ -1,28 +0,0 @@
|
||||
{
|
||||
"name": "@babel/helper-validator-identifier",
|
||||
"version": "7.19.1",
|
||||
"description": "Validate identifier/keywords name",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-helper-validator-identifier"
|
||||
},
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"exports": {
|
||||
".": "./lib/index.js",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@unicode/unicode-15.0.0": "^1.3.1",
|
||||
"charcodes": "^0.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
},
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"type": "commonjs"
|
||||
}
|
75
node_modules/@babel/helper-validator-identifier/scripts/generate-identifier-regex.js
generated
vendored
75
node_modules/@babel/helper-validator-identifier/scripts/generate-identifier-regex.js
generated
vendored
@ -1,75 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
// Always use the latest available version of Unicode!
|
||||
// https://tc39.github.io/ecma262/#sec-conformance
|
||||
const version = "15.0.0";
|
||||
|
||||
const start = require("@unicode/unicode-" +
|
||||
version +
|
||||
"/Binary_Property/ID_Start/code-points.js").filter(function (ch) {
|
||||
return ch > 0x7f;
|
||||
});
|
||||
let last = -1;
|
||||
const cont = [0x200c, 0x200d].concat(
|
||||
require("@unicode/unicode-" +
|
||||
version +
|
||||
"/Binary_Property/ID_Continue/code-points.js").filter(function (ch) {
|
||||
return ch > 0x7f && search(start, ch, last + 1) == -1;
|
||||
})
|
||||
);
|
||||
|
||||
function search(arr, ch, starting) {
|
||||
for (let i = starting; arr[i] <= ch && i < arr.length; last = i++) {
|
||||
if (arr[i] === ch) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
function pad(str, width) {
|
||||
while (str.length < width) str = "0" + str;
|
||||
return str;
|
||||
}
|
||||
|
||||
function esc(code) {
|
||||
const hex = code.toString(16);
|
||||
if (hex.length <= 2) return "\\x" + pad(hex, 2);
|
||||
else return "\\u" + pad(hex, 4);
|
||||
}
|
||||
|
||||
function generate(chars) {
|
||||
const astral = [];
|
||||
let re = "";
|
||||
for (let i = 0, at = 0x10000; i < chars.length; i++) {
|
||||
const from = chars[i];
|
||||
let to = from;
|
||||
while (i < chars.length - 1 && chars[i + 1] == to + 1) {
|
||||
i++;
|
||||
to++;
|
||||
}
|
||||
if (to <= 0xffff) {
|
||||
if (from == to) re += esc(from);
|
||||
else if (from + 1 == to) re += esc(from) + esc(to);
|
||||
else re += esc(from) + "-" + esc(to);
|
||||
} else {
|
||||
astral.push(from - at, to - from);
|
||||
at = to;
|
||||
}
|
||||
}
|
||||
return { nonASCII: re, astral: astral };
|
||||
}
|
||||
|
||||
const startData = generate(start);
|
||||
const contData = generate(cont);
|
||||
|
||||
console.log("/* prettier-ignore */");
|
||||
console.log('let nonASCIIidentifierStartChars = "' + startData.nonASCII + '";');
|
||||
console.log("/* prettier-ignore */");
|
||||
console.log('let nonASCIIidentifierChars = "' + contData.nonASCII + '";');
|
||||
console.log("/* prettier-ignore */");
|
||||
console.log(
|
||||
"const astralIdentifierStartCodes = " + JSON.stringify(startData.astral) + ";"
|
||||
);
|
||||
console.log("/* prettier-ignore */");
|
||||
console.log(
|
||||
"const astralIdentifierCodes = " + JSON.stringify(contData.astral) + ";"
|
||||
);
|
22
node_modules/@babel/highlight/LICENSE
generated
vendored
22
node_modules/@babel/highlight/LICENSE
generated
vendored
@ -1,22 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
19
node_modules/@babel/highlight/README.md
generated
vendored
19
node_modules/@babel/highlight/README.md
generated
vendored
@ -1,19 +0,0 @@
|
||||
# @babel/highlight
|
||||
|
||||
> Syntax highlight JavaScript strings for output in terminals.
|
||||
|
||||
See our website [@babel/highlight](https://babeljs.io/docs/en/babel-highlight) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/highlight
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/highlight --dev
|
||||
```
|
116
node_modules/@babel/highlight/lib/index.js
generated
vendored
116
node_modules/@babel/highlight/lib/index.js
generated
vendored
@ -1,116 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = highlight;
|
||||
exports.getChalk = getChalk;
|
||||
exports.shouldHighlight = shouldHighlight;
|
||||
|
||||
var _jsTokens = require("js-tokens");
|
||||
|
||||
var _helperValidatorIdentifier = require("@babel/helper-validator-identifier");
|
||||
|
||||
var _chalk = require("chalk");
|
||||
|
||||
const sometimesKeywords = new Set(["as", "async", "from", "get", "of", "set"]);
|
||||
|
||||
function getDefs(chalk) {
|
||||
return {
|
||||
keyword: chalk.cyan,
|
||||
capitalized: chalk.yellow,
|
||||
jsxIdentifier: chalk.yellow,
|
||||
punctuator: chalk.yellow,
|
||||
number: chalk.magenta,
|
||||
string: chalk.green,
|
||||
regex: chalk.magenta,
|
||||
comment: chalk.grey,
|
||||
invalid: chalk.white.bgRed.bold
|
||||
};
|
||||
}
|
||||
|
||||
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
||||
const BRACKET = /^[()[\]{}]$/;
|
||||
let tokenize;
|
||||
{
|
||||
const JSX_TAG = /^[a-z][\w-]*$/i;
|
||||
|
||||
const getTokenType = function (token, offset, text) {
|
||||
if (token.type === "name") {
|
||||
if ((0, _helperValidatorIdentifier.isKeyword)(token.value) || (0, _helperValidatorIdentifier.isStrictReservedWord)(token.value, true) || sometimesKeywords.has(token.value)) {
|
||||
return "keyword";
|
||||
}
|
||||
|
||||
if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.slice(offset - 2, offset) == "</")) {
|
||||
return "jsxIdentifier";
|
||||
}
|
||||
|
||||
if (token.value[0] !== token.value[0].toLowerCase()) {
|
||||
return "capitalized";
|
||||
}
|
||||
}
|
||||
|
||||
if (token.type === "punctuator" && BRACKET.test(token.value)) {
|
||||
return "bracket";
|
||||
}
|
||||
|
||||
if (token.type === "invalid" && (token.value === "@" || token.value === "#")) {
|
||||
return "punctuator";
|
||||
}
|
||||
|
||||
return token.type;
|
||||
};
|
||||
|
||||
tokenize = function* (text) {
|
||||
let match;
|
||||
|
||||
while (match = _jsTokens.default.exec(text)) {
|
||||
const token = _jsTokens.matchToToken(match);
|
||||
|
||||
yield {
|
||||
type: getTokenType(token, match.index, text),
|
||||
value: token.value
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function highlightTokens(defs, text) {
|
||||
let highlighted = "";
|
||||
|
||||
for (const {
|
||||
type,
|
||||
value
|
||||
} of tokenize(text)) {
|
||||
const colorize = defs[type];
|
||||
|
||||
if (colorize) {
|
||||
highlighted += value.split(NEWLINE).map(str => colorize(str)).join("\n");
|
||||
} else {
|
||||
highlighted += value;
|
||||
}
|
||||
}
|
||||
|
||||
return highlighted;
|
||||
}
|
||||
|
||||
function shouldHighlight(options) {
|
||||
return !!_chalk.supportsColor || options.forceColor;
|
||||
}
|
||||
|
||||
function getChalk(options) {
|
||||
return options.forceColor ? new _chalk.constructor({
|
||||
enabled: true,
|
||||
level: 1
|
||||
}) : _chalk;
|
||||
}
|
||||
|
||||
function highlight(code, options = {}) {
|
||||
if (code !== "" && shouldHighlight(options)) {
|
||||
const chalk = getChalk(options);
|
||||
const defs = getDefs(chalk);
|
||||
return highlightTokens(defs, code);
|
||||
} else {
|
||||
return code;
|
||||
}
|
||||
}
|
165
node_modules/@babel/highlight/node_modules/ansi-styles/index.js
generated
vendored
165
node_modules/@babel/highlight/node_modules/ansi-styles/index.js
generated
vendored
@ -1,165 +0,0 @@
|
||||
'use strict';
|
||||
const colorConvert = require('color-convert');
|
||||
|
||||
const wrapAnsi16 = (fn, offset) => function () {
|
||||
const code = fn.apply(colorConvert, arguments);
|
||||
return `\u001B[${code + offset}m`;
|
||||
};
|
||||
|
||||
const wrapAnsi256 = (fn, offset) => function () {
|
||||
const code = fn.apply(colorConvert, arguments);
|
||||
return `\u001B[${38 + offset};5;${code}m`;
|
||||
};
|
||||
|
||||
const wrapAnsi16m = (fn, offset) => function () {
|
||||
const rgb = fn.apply(colorConvert, arguments);
|
||||
return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
|
||||
};
|
||||
|
||||
function assembleStyles() {
|
||||
const codes = new Map();
|
||||
const styles = {
|
||||
modifier: {
|
||||
reset: [0, 0],
|
||||
// 21 isn't widely supported and 22 does the same thing
|
||||
bold: [1, 22],
|
||||
dim: [2, 22],
|
||||
italic: [3, 23],
|
||||
underline: [4, 24],
|
||||
inverse: [7, 27],
|
||||
hidden: [8, 28],
|
||||
strikethrough: [9, 29]
|
||||
},
|
||||
color: {
|
||||
black: [30, 39],
|
||||
red: [31, 39],
|
||||
green: [32, 39],
|
||||
yellow: [33, 39],
|
||||
blue: [34, 39],
|
||||
magenta: [35, 39],
|
||||
cyan: [36, 39],
|
||||
white: [37, 39],
|
||||
gray: [90, 39],
|
||||
|
||||
// Bright color
|
||||
redBright: [91, 39],
|
||||
greenBright: [92, 39],
|
||||
yellowBright: [93, 39],
|
||||
blueBright: [94, 39],
|
||||
magentaBright: [95, 39],
|
||||
cyanBright: [96, 39],
|
||||
whiteBright: [97, 39]
|
||||
},
|
||||
bgColor: {
|
||||
bgBlack: [40, 49],
|
||||
bgRed: [41, 49],
|
||||
bgGreen: [42, 49],
|
||||
bgYellow: [43, 49],
|
||||
bgBlue: [44, 49],
|
||||
bgMagenta: [45, 49],
|
||||
bgCyan: [46, 49],
|
||||
bgWhite: [47, 49],
|
||||
|
||||
// Bright color
|
||||
bgBlackBright: [100, 49],
|
||||
bgRedBright: [101, 49],
|
||||
bgGreenBright: [102, 49],
|
||||
bgYellowBright: [103, 49],
|
||||
bgBlueBright: [104, 49],
|
||||
bgMagentaBright: [105, 49],
|
||||
bgCyanBright: [106, 49],
|
||||
bgWhiteBright: [107, 49]
|
||||
}
|
||||
};
|
||||
|
||||
// Fix humans
|
||||
styles.color.grey = styles.color.gray;
|
||||
|
||||
for (const groupName of Object.keys(styles)) {
|
||||
const group = styles[groupName];
|
||||
|
||||
for (const styleName of Object.keys(group)) {
|
||||
const style = group[styleName];
|
||||
|
||||
styles[styleName] = {
|
||||
open: `\u001B[${style[0]}m`,
|
||||
close: `\u001B[${style[1]}m`
|
||||
};
|
||||
|
||||
group[styleName] = styles[styleName];
|
||||
|
||||
codes.set(style[0], style[1]);
|
||||
}
|
||||
|
||||
Object.defineProperty(styles, groupName, {
|
||||
value: group,
|
||||
enumerable: false
|
||||
});
|
||||
|
||||
Object.defineProperty(styles, 'codes', {
|
||||
value: codes,
|
||||
enumerable: false
|
||||
});
|
||||
}
|
||||
|
||||
const ansi2ansi = n => n;
|
||||
const rgb2rgb = (r, g, b) => [r, g, b];
|
||||
|
||||
styles.color.close = '\u001B[39m';
|
||||
styles.bgColor.close = '\u001B[49m';
|
||||
|
||||
styles.color.ansi = {
|
||||
ansi: wrapAnsi16(ansi2ansi, 0)
|
||||
};
|
||||
styles.color.ansi256 = {
|
||||
ansi256: wrapAnsi256(ansi2ansi, 0)
|
||||
};
|
||||
styles.color.ansi16m = {
|
||||
rgb: wrapAnsi16m(rgb2rgb, 0)
|
||||
};
|
||||
|
||||
styles.bgColor.ansi = {
|
||||
ansi: wrapAnsi16(ansi2ansi, 10)
|
||||
};
|
||||
styles.bgColor.ansi256 = {
|
||||
ansi256: wrapAnsi256(ansi2ansi, 10)
|
||||
};
|
||||
styles.bgColor.ansi16m = {
|
||||
rgb: wrapAnsi16m(rgb2rgb, 10)
|
||||
};
|
||||
|
||||
for (let key of Object.keys(colorConvert)) {
|
||||
if (typeof colorConvert[key] !== 'object') {
|
||||
continue;
|
||||
}
|
||||
|
||||
const suite = colorConvert[key];
|
||||
|
||||
if (key === 'ansi16') {
|
||||
key = 'ansi';
|
||||
}
|
||||
|
||||
if ('ansi16' in suite) {
|
||||
styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
|
||||
styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
|
||||
}
|
||||
|
||||
if ('ansi256' in suite) {
|
||||
styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
|
||||
styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
|
||||
}
|
||||
|
||||
if ('rgb' in suite) {
|
||||
styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
|
||||
styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
|
||||
}
|
||||
}
|
||||
|
||||
return styles;
|
||||
}
|
||||
|
||||
// Make the export immutable
|
||||
Object.defineProperty(module, 'exports', {
|
||||
enumerable: true,
|
||||
get: assembleStyles
|
||||
});
|
9
node_modules/@babel/highlight/node_modules/ansi-styles/license
generated
vendored
9
node_modules/@babel/highlight/node_modules/ansi-styles/license
generated
vendored
@ -1,9 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
56
node_modules/@babel/highlight/node_modules/ansi-styles/package.json
generated
vendored
56
node_modules/@babel/highlight/node_modules/ansi-styles/package.json
generated
vendored
@ -1,56 +0,0 @@
|
||||
{
|
||||
"name": "ansi-styles",
|
||||
"version": "3.2.1",
|
||||
"description": "ANSI escape codes for styling strings in the terminal",
|
||||
"license": "MIT",
|
||||
"repository": "chalk/ansi-styles",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava",
|
||||
"screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"ansi",
|
||||
"styles",
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"tty",
|
||||
"escape",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"log",
|
||||
"logging",
|
||||
"command-line",
|
||||
"text"
|
||||
],
|
||||
"dependencies": {
|
||||
"color-convert": "^1.9.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"babel-polyfill": "^6.23.0",
|
||||
"svg-term-cli": "^2.1.1",
|
||||
"xo": "*"
|
||||
},
|
||||
"ava": {
|
||||
"require": "babel-polyfill"
|
||||
}
|
||||
}
|
147
node_modules/@babel/highlight/node_modules/ansi-styles/readme.md
generated
vendored
147
node_modules/@babel/highlight/node_modules/ansi-styles/readme.md
generated
vendored
@ -1,147 +0,0 @@
|
||||
# ansi-styles [![Build Status](https://travis-ci.org/chalk/ansi-styles.svg?branch=master)](https://travis-ci.org/chalk/ansi-styles)
|
||||
|
||||
> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
|
||||
|
||||
You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.
|
||||
|
||||
<img src="https://cdn.rawgit.com/chalk/ansi-styles/8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" width="900">
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install ansi-styles
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const style = require('ansi-styles');
|
||||
|
||||
console.log(`${style.green.open}Hello world!${style.green.close}`);
|
||||
|
||||
|
||||
// Color conversion between 16/256/truecolor
|
||||
// NOTE: If conversion goes to 16 colors or 256 colors, the original color
|
||||
// may be degraded to fit that color palette. This means terminals
|
||||
// that do not support 16 million colors will best-match the
|
||||
// original color.
|
||||
console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close);
|
||||
console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close);
|
||||
console.log(style.color.ansi16m.hex('#ABCDEF') + 'Hello world!' + style.color.close);
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
Each style has an `open` and `close` property.
|
||||
|
||||
|
||||
## Styles
|
||||
|
||||
### Modifiers
|
||||
|
||||
- `reset`
|
||||
- `bold`
|
||||
- `dim`
|
||||
- `italic` *(Not widely supported)*
|
||||
- `underline`
|
||||
- `inverse`
|
||||
- `hidden`
|
||||
- `strikethrough` *(Not widely supported)*
|
||||
|
||||
### Colors
|
||||
|
||||
- `black`
|
||||
- `red`
|
||||
- `green`
|
||||
- `yellow`
|
||||
- `blue`
|
||||
- `magenta`
|
||||
- `cyan`
|
||||
- `white`
|
||||
- `gray` ("bright black")
|
||||
- `redBright`
|
||||
- `greenBright`
|
||||
- `yellowBright`
|
||||
- `blueBright`
|
||||
- `magentaBright`
|
||||
- `cyanBright`
|
||||
- `whiteBright`
|
||||
|
||||
### Background colors
|
||||
|
||||
- `bgBlack`
|
||||
- `bgRed`
|
||||
- `bgGreen`
|
||||
- `bgYellow`
|
||||
- `bgBlue`
|
||||
- `bgMagenta`
|
||||
- `bgCyan`
|
||||
- `bgWhite`
|
||||
- `bgBlackBright`
|
||||
- `bgRedBright`
|
||||
- `bgGreenBright`
|
||||
- `bgYellowBright`
|
||||
- `bgBlueBright`
|
||||
- `bgMagentaBright`
|
||||
- `bgCyanBright`
|
||||
- `bgWhiteBright`
|
||||
|
||||
|
||||
## Advanced usage
|
||||
|
||||
By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module.
|
||||
|
||||
- `style.modifier`
|
||||
- `style.color`
|
||||
- `style.bgColor`
|
||||
|
||||
###### Example
|
||||
|
||||
```js
|
||||
console.log(style.color.green.open);
|
||||
```
|
||||
|
||||
Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `style.codes`, which returns a `Map` with the open codes as keys and close codes as values.
|
||||
|
||||
###### Example
|
||||
|
||||
```js
|
||||
console.log(style.codes.get(36));
|
||||
//=> 39
|
||||
```
|
||||
|
||||
|
||||
## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728)
|
||||
|
||||
`ansi-styles` uses the [`color-convert`](https://github.com/Qix-/color-convert) package to allow for converting between various colors and ANSI escapes, with support for 256 and 16 million colors.
|
||||
|
||||
To use these, call the associated conversion function with the intended output, for example:
|
||||
|
||||
```js
|
||||
style.color.ansi.rgb(100, 200, 15); // RGB to 16 color ansi foreground code
|
||||
style.bgColor.ansi.rgb(100, 200, 15); // RGB to 16 color ansi background code
|
||||
|
||||
style.color.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
|
||||
style.bgColor.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
|
||||
|
||||
style.color.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color foreground code
|
||||
style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color background code
|
||||
```
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal
|
||||
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Josh Junon](https://github.com/qix-)
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
228
node_modules/@babel/highlight/node_modules/chalk/index.js
generated
vendored
228
node_modules/@babel/highlight/node_modules/chalk/index.js
generated
vendored
@ -1,228 +0,0 @@
|
||||
'use strict';
|
||||
const escapeStringRegexp = require('escape-string-regexp');
|
||||
const ansiStyles = require('ansi-styles');
|
||||
const stdoutColor = require('supports-color').stdout;
|
||||
|
||||
const template = require('./templates.js');
|
||||
|
||||
const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm');
|
||||
|
||||
// `supportsColor.level` → `ansiStyles.color[name]` mapping
|
||||
const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m'];
|
||||
|
||||
// `color-convert` models to exclude from the Chalk API due to conflicts and such
|
||||
const skipModels = new Set(['gray']);
|
||||
|
||||
const styles = Object.create(null);
|
||||
|
||||
function applyOptions(obj, options) {
|
||||
options = options || {};
|
||||
|
||||
// Detect level if not set manually
|
||||
const scLevel = stdoutColor ? stdoutColor.level : 0;
|
||||
obj.level = options.level === undefined ? scLevel : options.level;
|
||||
obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0;
|
||||
}
|
||||
|
||||
function Chalk(options) {
|
||||
// We check for this.template here since calling `chalk.constructor()`
|
||||
// by itself will have a `this` of a previously constructed chalk object
|
||||
if (!this || !(this instanceof Chalk) || this.template) {
|
||||
const chalk = {};
|
||||
applyOptions(chalk, options);
|
||||
|
||||
chalk.template = function () {
|
||||
const args = [].slice.call(arguments);
|
||||
return chalkTag.apply(null, [chalk.template].concat(args));
|
||||
};
|
||||
|
||||
Object.setPrototypeOf(chalk, Chalk.prototype);
|
||||
Object.setPrototypeOf(chalk.template, chalk);
|
||||
|
||||
chalk.template.constructor = Chalk;
|
||||
|
||||
return chalk.template;
|
||||
}
|
||||
|
||||
applyOptions(this, options);
|
||||
}
|
||||
|
||||
// Use bright blue on Windows as the normal blue color is illegible
|
||||
if (isSimpleWindowsTerm) {
|
||||
ansiStyles.blue.open = '\u001B[94m';
|
||||
}
|
||||
|
||||
for (const key of Object.keys(ansiStyles)) {
|
||||
ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
|
||||
|
||||
styles[key] = {
|
||||
get() {
|
||||
const codes = ansiStyles[key];
|
||||
return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
styles.visible = {
|
||||
get() {
|
||||
return build.call(this, this._styles || [], true, 'visible');
|
||||
}
|
||||
};
|
||||
|
||||
ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), 'g');
|
||||
for (const model of Object.keys(ansiStyles.color.ansi)) {
|
||||
if (skipModels.has(model)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
styles[model] = {
|
||||
get() {
|
||||
const level = this.level;
|
||||
return function () {
|
||||
const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments);
|
||||
const codes = {
|
||||
open,
|
||||
close: ansiStyles.color.close,
|
||||
closeRe: ansiStyles.color.closeRe
|
||||
};
|
||||
return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), 'g');
|
||||
for (const model of Object.keys(ansiStyles.bgColor.ansi)) {
|
||||
if (skipModels.has(model)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
|
||||
styles[bgModel] = {
|
||||
get() {
|
||||
const level = this.level;
|
||||
return function () {
|
||||
const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments);
|
||||
const codes = {
|
||||
open,
|
||||
close: ansiStyles.bgColor.close,
|
||||
closeRe: ansiStyles.bgColor.closeRe
|
||||
};
|
||||
return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const proto = Object.defineProperties(() => {}, styles);
|
||||
|
||||
function build(_styles, _empty, key) {
|
||||
const builder = function () {
|
||||
return applyStyle.apply(builder, arguments);
|
||||
};
|
||||
|
||||
builder._styles = _styles;
|
||||
builder._empty = _empty;
|
||||
|
||||
const self = this;
|
||||
|
||||
Object.defineProperty(builder, 'level', {
|
||||
enumerable: true,
|
||||
get() {
|
||||
return self.level;
|
||||
},
|
||||
set(level) {
|
||||
self.level = level;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(builder, 'enabled', {
|
||||
enumerable: true,
|
||||
get() {
|
||||
return self.enabled;
|
||||
},
|
||||
set(enabled) {
|
||||
self.enabled = enabled;
|
||||
}
|
||||
});
|
||||
|
||||
// See below for fix regarding invisible grey/dim combination on Windows
|
||||
builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey';
|
||||
|
||||
// `__proto__` is used because we must return a function, but there is
|
||||
// no way to create a function with a different prototype
|
||||
builder.__proto__ = proto; // eslint-disable-line no-proto
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
function applyStyle() {
|
||||
// Support varags, but simply cast to string in case there's only one arg
|
||||
const args = arguments;
|
||||
const argsLen = args.length;
|
||||
let str = String(arguments[0]);
|
||||
|
||||
if (argsLen === 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (argsLen > 1) {
|
||||
// Don't slice `arguments`, it prevents V8 optimizations
|
||||
for (let a = 1; a < argsLen; a++) {
|
||||
str += ' ' + args[a];
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.enabled || this.level <= 0 || !str) {
|
||||
return this._empty ? '' : str;
|
||||
}
|
||||
|
||||
// Turns out that on Windows dimmed gray text becomes invisible in cmd.exe,
|
||||
// see https://github.com/chalk/chalk/issues/58
|
||||
// If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop.
|
||||
const originalDim = ansiStyles.dim.open;
|
||||
if (isSimpleWindowsTerm && this.hasGrey) {
|
||||
ansiStyles.dim.open = '';
|
||||
}
|
||||
|
||||
for (const code of this._styles.slice().reverse()) {
|
||||
// Replace any instances already present with a re-opening code
|
||||
// otherwise only the part of the string until said closing code
|
||||
// will be colored, and the rest will simply be 'plain'.
|
||||
str = code.open + str.replace(code.closeRe, code.open) + code.close;
|
||||
|
||||
// Close the styling before a linebreak and reopen
|
||||
// after next line to fix a bleed issue on macOS
|
||||
// https://github.com/chalk/chalk/pull/92
|
||||
str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`);
|
||||
}
|
||||
|
||||
// Reset the original `dim` if we changed it to work around the Windows dimmed gray issue
|
||||
ansiStyles.dim.open = originalDim;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
function chalkTag(chalk, strings) {
|
||||
if (!Array.isArray(strings)) {
|
||||
// If chalk() was called by itself or with a string,
|
||||
// return the string itself as a string.
|
||||
return [].slice.call(arguments, 1).join(' ');
|
||||
}
|
||||
|
||||
const args = [].slice.call(arguments, 2);
|
||||
const parts = [strings.raw[0]];
|
||||
|
||||
for (let i = 1; i < strings.length; i++) {
|
||||
parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&'));
|
||||
parts.push(String(strings.raw[i]));
|
||||
}
|
||||
|
||||
return template(chalk, parts.join(''));
|
||||
}
|
||||
|
||||
Object.defineProperties(Chalk.prototype, styles);
|
||||
|
||||
module.exports = Chalk(); // eslint-disable-line new-cap
|
||||
module.exports.supportsColor = stdoutColor;
|
||||
module.exports.default = module.exports; // For TypeScript
|
93
node_modules/@babel/highlight/node_modules/chalk/index.js.flow
generated
vendored
93
node_modules/@babel/highlight/node_modules/chalk/index.js.flow
generated
vendored
@ -1,93 +0,0 @@
|
||||
// @flow strict
|
||||
|
||||
type TemplateStringsArray = $ReadOnlyArray<string>;
|
||||
|
||||
export type Level = $Values<{
|
||||
None: 0,
|
||||
Basic: 1,
|
||||
Ansi256: 2,
|
||||
TrueColor: 3
|
||||
}>;
|
||||
|
||||
export type ChalkOptions = {|
|
||||
enabled?: boolean,
|
||||
level?: Level
|
||||
|};
|
||||
|
||||
export type ColorSupport = {|
|
||||
level: Level,
|
||||
hasBasic: boolean,
|
||||
has256: boolean,
|
||||
has16m: boolean
|
||||
|};
|
||||
|
||||
export interface Chalk {
|
||||
(...text: string[]): string,
|
||||
(text: TemplateStringsArray, ...placeholders: string[]): string,
|
||||
constructor(options?: ChalkOptions): Chalk,
|
||||
enabled: boolean,
|
||||
level: Level,
|
||||
rgb(r: number, g: number, b: number): Chalk,
|
||||
hsl(h: number, s: number, l: number): Chalk,
|
||||
hsv(h: number, s: number, v: number): Chalk,
|
||||
hwb(h: number, w: number, b: number): Chalk,
|
||||
bgHex(color: string): Chalk,
|
||||
bgKeyword(color: string): Chalk,
|
||||
bgRgb(r: number, g: number, b: number): Chalk,
|
||||
bgHsl(h: number, s: number, l: number): Chalk,
|
||||
bgHsv(h: number, s: number, v: number): Chalk,
|
||||
bgHwb(h: number, w: number, b: number): Chalk,
|
||||
hex(color: string): Chalk,
|
||||
keyword(color: string): Chalk,
|
||||
|
||||
+reset: Chalk,
|
||||
+bold: Chalk,
|
||||
+dim: Chalk,
|
||||
+italic: Chalk,
|
||||
+underline: Chalk,
|
||||
+inverse: Chalk,
|
||||
+hidden: Chalk,
|
||||
+strikethrough: Chalk,
|
||||
|
||||
+visible: Chalk,
|
||||
|
||||
+black: Chalk,
|
||||
+red: Chalk,
|
||||
+green: Chalk,
|
||||
+yellow: Chalk,
|
||||
+blue: Chalk,
|
||||
+magenta: Chalk,
|
||||
+cyan: Chalk,
|
||||
+white: Chalk,
|
||||
+gray: Chalk,
|
||||
+grey: Chalk,
|
||||
+blackBright: Chalk,
|
||||
+redBright: Chalk,
|
||||
+greenBright: Chalk,
|
||||
+yellowBright: Chalk,
|
||||
+blueBright: Chalk,
|
||||
+magentaBright: Chalk,
|
||||
+cyanBright: Chalk,
|
||||
+whiteBright: Chalk,
|
||||
|
||||
+bgBlack: Chalk,
|
||||
+bgRed: Chalk,
|
||||
+bgGreen: Chalk,
|
||||
+bgYellow: Chalk,
|
||||
+bgBlue: Chalk,
|
||||
+bgMagenta: Chalk,
|
||||
+bgCyan: Chalk,
|
||||
+bgWhite: Chalk,
|
||||
+bgBlackBright: Chalk,
|
||||
+bgRedBright: Chalk,
|
||||
+bgGreenBright: Chalk,
|
||||
+bgYellowBright: Chalk,
|
||||
+bgBlueBright: Chalk,
|
||||
+bgMagentaBright: Chalk,
|
||||
+bgCyanBright: Chalk,
|
||||
+bgWhiteBrigh: Chalk,
|
||||
|
||||
supportsColor: ColorSupport
|
||||
};
|
||||
|
||||
declare module.exports: Chalk;
|
9
node_modules/@babel/highlight/node_modules/chalk/license
generated
vendored
9
node_modules/@babel/highlight/node_modules/chalk/license
generated
vendored
@ -1,9 +0,0 @@
|
||||
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.
|
71
node_modules/@babel/highlight/node_modules/chalk/package.json
generated
vendored
71
node_modules/@babel/highlight/node_modules/chalk/package.json
generated
vendored
@ -1,71 +0,0 @@
|
||||
{
|
||||
"name": "chalk",
|
||||
"version": "2.4.2",
|
||||
"description": "Terminal string styling done right",
|
||||
"license": "MIT",
|
||||
"repository": "chalk/chalk",
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && tsc --project types && flow --max-warnings=0 && nyc ava",
|
||||
"bench": "matcha benchmark.js",
|
||||
"coveralls": "nyc report --reporter=text-lcov | coveralls"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"templates.js",
|
||||
"types/index.d.ts",
|
||||
"index.js.flow"
|
||||
],
|
||||
"keywords": [
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"str",
|
||||
"ansi",
|
||||
"style",
|
||||
"styles",
|
||||
"tty",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"log",
|
||||
"logging",
|
||||
"command-line",
|
||||
"text"
|
||||
],
|
||||
"dependencies": {
|
||||
"ansi-styles": "^3.2.1",
|
||||
"escape-string-regexp": "^1.0.5",
|
||||
"supports-color": "^5.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"coveralls": "^3.0.0",
|
||||
"execa": "^0.9.0",
|
||||
"flow-bin": "^0.68.0",
|
||||
"import-fresh": "^2.0.0",
|
||||
"matcha": "^0.7.0",
|
||||
"nyc": "^11.0.2",
|
||||
"resolve-from": "^4.0.0",
|
||||
"typescript": "^2.5.3",
|
||||
"xo": "*"
|
||||
},
|
||||
"types": "types/index.d.ts",
|
||||
"xo": {
|
||||
"envs": [
|
||||
"node",
|
||||
"mocha"
|
||||
],
|
||||
"ignores": [
|
||||
"test/_flow.js"
|
||||
]
|
||||
}
|
||||
}
|
314
node_modules/@babel/highlight/node_modules/chalk/readme.md
generated
vendored
314
node_modules/@babel/highlight/node_modules/chalk/readme.md
generated
vendored
@ -1,314 +0,0 @@
|
||||
<h1 align="center">
|
||||
<br>
|
||||
<br>
|
||||
<img width="320" src="media/logo.svg" alt="Chalk">
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
</h1>
|
||||
|
||||
> Terminal string styling done right
|
||||
|
||||
[![Build Status](https://travis-ci.org/chalk/chalk.svg?branch=master)](https://travis-ci.org/chalk/chalk) [![Coverage Status](https://coveralls.io/repos/github/chalk/chalk/badge.svg?branch=master)](https://coveralls.io/github/chalk/chalk?branch=master) [![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo) [![Mentioned in Awesome Node.js](https://awesome.re/mentioned-badge.svg)](https://github.com/sindresorhus/awesome-nodejs)
|
||||
|
||||
### [See what's new in Chalk 2](https://github.com/chalk/chalk/releases/tag/v2.0.0)
|
||||
|
||||
<img src="https://cdn.rawgit.com/chalk/ansi-styles/8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" alt="" width="900">
|
||||
|
||||
|
||||
## Highlights
|
||||
|
||||
- Expressive API
|
||||
- Highly performant
|
||||
- Ability to nest styles
|
||||
- [256/Truecolor color support](#256-and-truecolor-color-support)
|
||||
- Auto-detects color support
|
||||
- Doesn't extend `String.prototype`
|
||||
- Clean and focused
|
||||
- Actively maintained
|
||||
- [Used by ~23,000 packages](https://www.npmjs.com/browse/depended/chalk) as of December 31, 2017
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```console
|
||||
$ npm install chalk
|
||||
```
|
||||
|
||||
<a href="https://www.patreon.com/sindresorhus">
|
||||
<img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" width="160">
|
||||
</a>
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const chalk = require('chalk');
|
||||
|
||||
console.log(chalk.blue('Hello world!'));
|
||||
```
|
||||
|
||||
Chalk comes with an easy to use composable API where you just chain and nest the styles you want.
|
||||
|
||||
```js
|
||||
const chalk = require('chalk');
|
||||
const log = console.log;
|
||||
|
||||
// Combine styled and normal strings
|
||||
log(chalk.blue('Hello') + ' World' + chalk.red('!'));
|
||||
|
||||
// Compose multiple styles using the chainable API
|
||||
log(chalk.blue.bgRed.bold('Hello world!'));
|
||||
|
||||
// Pass in multiple arguments
|
||||
log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz'));
|
||||
|
||||
// Nest styles
|
||||
log(chalk.red('Hello', chalk.underline.bgBlue('world') + '!'));
|
||||
|
||||
// Nest styles of the same type even (color, underline, background)
|
||||
log(chalk.green(
|
||||
'I am a green line ' +
|
||||
chalk.blue.underline.bold('with a blue substring') +
|
||||
' that becomes green again!'
|
||||
));
|
||||
|
||||
// ES2015 template literal
|
||||
log(`
|
||||
CPU: ${chalk.red('90%')}
|
||||
RAM: ${chalk.green('40%')}
|
||||
DISK: ${chalk.yellow('70%')}
|
||||
`);
|
||||
|
||||
// ES2015 tagged template literal
|
||||
log(chalk`
|
||||
CPU: {red ${cpu.totalPercent}%}
|
||||
RAM: {green ${ram.used / ram.total * 100}%}
|
||||
DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}
|
||||
`);
|
||||
|
||||
// Use RGB colors in terminal emulators that support it.
|
||||
log(chalk.keyword('orange')('Yay for orange colored text!'));
|
||||
log(chalk.rgb(123, 45, 67).underline('Underlined reddish color'));
|
||||
log(chalk.hex('#DEADED').bold('Bold gray!'));
|
||||
```
|
||||
|
||||
Easily define your own themes:
|
||||
|
||||
```js
|
||||
const chalk = require('chalk');
|
||||
|
||||
const error = chalk.bold.red;
|
||||
const warning = chalk.keyword('orange');
|
||||
|
||||
console.log(error('Error!'));
|
||||
console.log(warning('Warning!'));
|
||||
```
|
||||
|
||||
Take advantage of console.log [string substitution](https://nodejs.org/docs/latest/api/console.html#console_console_log_data_args):
|
||||
|
||||
```js
|
||||
const name = 'Sindre';
|
||||
console.log(chalk.green('Hello %s'), name);
|
||||
//=> 'Hello Sindre'
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### chalk.`<style>[.<style>...](string, [string...])`
|
||||
|
||||
Example: `chalk.red.bold.underline('Hello', 'world');`
|
||||
|
||||
Chain [styles](#styles) and call the last one as a method with a string argument. Order doesn't matter, and later styles take precedent in case of a conflict. This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`.
|
||||
|
||||
Multiple arguments will be separated by space.
|
||||
|
||||
### chalk.enabled
|
||||
|
||||
Color support is automatically detected, as is the level (see `chalk.level`). However, if you'd like to simply enable/disable Chalk, you can do so via the `.enabled` property.
|
||||
|
||||
Chalk is enabled by default unless explicitly disabled via the constructor or `chalk.level` is `0`.
|
||||
|
||||
If you need to change this in a reusable module, create a new instance:
|
||||
|
||||
```js
|
||||
const ctx = new chalk.constructor({enabled: false});
|
||||
```
|
||||
|
||||
### chalk.level
|
||||
|
||||
Color support is automatically detected, but you can override it by setting the `level` property. You should however only do this in your own code as it applies globally to all Chalk consumers.
|
||||
|
||||
If you need to change this in a reusable module, create a new instance:
|
||||
|
||||
```js
|
||||
const ctx = new chalk.constructor({level: 0});
|
||||
```
|
||||
|
||||
Levels are as follows:
|
||||
|
||||
0. All colors disabled
|
||||
1. Basic color support (16 colors)
|
||||
2. 256 color support
|
||||
3. Truecolor support (16 million colors)
|
||||
|
||||
### chalk.supportsColor
|
||||
|
||||
Detect whether the terminal [supports color](https://github.com/chalk/supports-color). Used internally and handled for you, but exposed for convenience.
|
||||
|
||||
Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, add the environment variable `FORCE_COLOR=1` to forcefully enable color or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks.
|
||||
|
||||
Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively.
|
||||
|
||||
|
||||
## Styles
|
||||
|
||||
### Modifiers
|
||||
|
||||
- `reset`
|
||||
- `bold`
|
||||
- `dim`
|
||||
- `italic` *(Not widely supported)*
|
||||
- `underline`
|
||||
- `inverse`
|
||||
- `hidden`
|
||||
- `strikethrough` *(Not widely supported)*
|
||||
- `visible` (Text is emitted only if enabled)
|
||||
|
||||
### Colors
|
||||
|
||||
- `black`
|
||||
- `red`
|
||||
- `green`
|
||||
- `yellow`
|
||||
- `blue` *(On Windows the bright version is used since normal blue is illegible)*
|
||||
- `magenta`
|
||||
- `cyan`
|
||||
- `white`
|
||||
- `gray` ("bright black")
|
||||
- `redBright`
|
||||
- `greenBright`
|
||||
- `yellowBright`
|
||||
- `blueBright`
|
||||
- `magentaBright`
|
||||
- `cyanBright`
|
||||
- `whiteBright`
|
||||
|
||||
### Background colors
|
||||
|
||||
- `bgBlack`
|
||||
- `bgRed`
|
||||
- `bgGreen`
|
||||
- `bgYellow`
|
||||
- `bgBlue`
|
||||
- `bgMagenta`
|
||||
- `bgCyan`
|
||||
- `bgWhite`
|
||||
- `bgBlackBright`
|
||||
- `bgRedBright`
|
||||
- `bgGreenBright`
|
||||
- `bgYellowBright`
|
||||
- `bgBlueBright`
|
||||
- `bgMagentaBright`
|
||||
- `bgCyanBright`
|
||||
- `bgWhiteBright`
|
||||
|
||||
|
||||
## Tagged template literal
|
||||
|
||||
Chalk can be used as a [tagged template literal](http://exploringjs.com/es6/ch_template-literals.html#_tagged-template-literals).
|
||||
|
||||
```js
|
||||
const chalk = require('chalk');
|
||||
|
||||
const miles = 18;
|
||||
const calculateFeet = miles => miles * 5280;
|
||||
|
||||
console.log(chalk`
|
||||
There are {bold 5280 feet} in a mile.
|
||||
In {bold ${miles} miles}, there are {green.bold ${calculateFeet(miles)} feet}.
|
||||
`);
|
||||
```
|
||||
|
||||
Blocks are delimited by an opening curly brace (`{`), a style, some content, and a closing curly brace (`}`).
|
||||
|
||||
Template styles are chained exactly like normal Chalk styles. The following two statements are equivalent:
|
||||
|
||||
```js
|
||||
console.log(chalk.bold.rgb(10, 100, 200)('Hello!'));
|
||||
console.log(chalk`{bold.rgb(10,100,200) Hello!}`);
|
||||
```
|
||||
|
||||
Note that function styles (`rgb()`, `hsl()`, `keyword()`, etc.) may not contain spaces between parameters.
|
||||
|
||||
All interpolated values (`` chalk`${foo}` ``) are converted to strings via the `.toString()` method. All curly braces (`{` and `}`) in interpolated value strings are escaped.
|
||||
|
||||
|
||||
## 256 and Truecolor color support
|
||||
|
||||
Chalk supports 256 colors and [Truecolor](https://gist.github.com/XVilka/8346728) (16 million colors) on supported terminal apps.
|
||||
|
||||
Colors are downsampled from 16 million RGB values to an ANSI color format that is supported by the terminal emulator (or by specifying `{level: n}` as a Chalk option). For example, Chalk configured to run at level 1 (basic color support) will downsample an RGB value of #FF0000 (red) to 31 (ANSI escape for red).
|
||||
|
||||
Examples:
|
||||
|
||||
- `chalk.hex('#DEADED').underline('Hello, world!')`
|
||||
- `chalk.keyword('orange')('Some orange text')`
|
||||
- `chalk.rgb(15, 100, 204).inverse('Hello!')`
|
||||
|
||||
Background versions of these models are prefixed with `bg` and the first level of the module capitalized (e.g. `keyword` for foreground colors and `bgKeyword` for background colors).
|
||||
|
||||
- `chalk.bgHex('#DEADED').underline('Hello, world!')`
|
||||
- `chalk.bgKeyword('orange')('Some orange text')`
|
||||
- `chalk.bgRgb(15, 100, 204).inverse('Hello!')`
|
||||
|
||||
The following color models can be used:
|
||||
|
||||
- [`rgb`](https://en.wikipedia.org/wiki/RGB_color_model) - Example: `chalk.rgb(255, 136, 0).bold('Orange!')`
|
||||
- [`hex`](https://en.wikipedia.org/wiki/Web_colors#Hex_triplet) - Example: `chalk.hex('#FF8800').bold('Orange!')`
|
||||
- [`keyword`](https://www.w3.org/wiki/CSS/Properties/color/keywords) (CSS keywords) - Example: `chalk.keyword('orange').bold('Orange!')`
|
||||
- [`hsl`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsl(32, 100, 50).bold('Orange!')`
|
||||
- [`hsv`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsv(32, 100, 100).bold('Orange!')`
|
||||
- [`hwb`](https://en.wikipedia.org/wiki/HWB_color_model) - Example: `chalk.hwb(32, 0, 50).bold('Orange!')`
|
||||
- `ansi16`
|
||||
- `ansi256`
|
||||
|
||||
|
||||
## Windows
|
||||
|
||||
If you're on Windows, do yourself a favor and use [`cmder`](http://cmder.net/) instead of `cmd.exe`.
|
||||
|
||||
|
||||
## Origin story
|
||||
|
||||
[colors.js](https://github.com/Marak/colors.js) used to be the most popular string styling module, but it has serious deficiencies like extending `String.prototype` which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68) and the package is unmaintained. Although there are other packages, they either do too much or not enough. Chalk is a clean and focused alternative.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [chalk-cli](https://github.com/chalk/chalk-cli) - CLI for this module
|
||||
- [ansi-styles](https://github.com/chalk/ansi-styles) - ANSI escape codes for styling strings in the terminal
|
||||
- [supports-color](https://github.com/chalk/supports-color) - Detect whether a terminal supports color
|
||||
- [strip-ansi](https://github.com/chalk/strip-ansi) - Strip ANSI escape codes
|
||||
- [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Strip ANSI escape codes from a stream
|
||||
- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes
|
||||
- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes
|
||||
- [wrap-ansi](https://github.com/chalk/wrap-ansi) - Wordwrap a string with ANSI escape codes
|
||||
- [slice-ansi](https://github.com/chalk/slice-ansi) - Slice a string with ANSI escape codes
|
||||
- [color-convert](https://github.com/qix-/color-convert) - Converts colors between different models
|
||||
- [chalk-animation](https://github.com/bokub/chalk-animation) - Animate strings in the terminal
|
||||
- [gradient-string](https://github.com/bokub/gradient-string) - Apply color gradients to strings
|
||||
- [chalk-pipe](https://github.com/LitoMore/chalk-pipe) - Create chalk style schemes with simpler style strings
|
||||
- [terminal-link](https://github.com/sindresorhus/terminal-link) - Create clickable links in the terminal
|
||||
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Josh Junon](https://github.com/qix-)
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
128
node_modules/@babel/highlight/node_modules/chalk/templates.js
generated
vendored
128
node_modules/@babel/highlight/node_modules/chalk/templates.js
generated
vendored
@ -1,128 +0,0 @@
|
||||
'use strict';
|
||||
const TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
|
||||
const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
|
||||
const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
|
||||
const ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi;
|
||||
|
||||
const ESCAPES = new Map([
|
||||
['n', '\n'],
|
||||
['r', '\r'],
|
||||
['t', '\t'],
|
||||
['b', '\b'],
|
||||
['f', '\f'],
|
||||
['v', '\v'],
|
||||
['0', '\0'],
|
||||
['\\', '\\'],
|
||||
['e', '\u001B'],
|
||||
['a', '\u0007']
|
||||
]);
|
||||
|
||||
function unescape(c) {
|
||||
if ((c[0] === 'u' && c.length === 5) || (c[0] === 'x' && c.length === 3)) {
|
||||
return String.fromCharCode(parseInt(c.slice(1), 16));
|
||||
}
|
||||
|
||||
return ESCAPES.get(c) || c;
|
||||
}
|
||||
|
||||
function parseArguments(name, args) {
|
||||
const results = [];
|
||||
const chunks = args.trim().split(/\s*,\s*/g);
|
||||
let matches;
|
||||
|
||||
for (const chunk of chunks) {
|
||||
if (!isNaN(chunk)) {
|
||||
results.push(Number(chunk));
|
||||
} else if ((matches = chunk.match(STRING_REGEX))) {
|
||||
results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr));
|
||||
} else {
|
||||
throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
function parseStyle(style) {
|
||||
STYLE_REGEX.lastIndex = 0;
|
||||
|
||||
const results = [];
|
||||
let matches;
|
||||
|
||||
while ((matches = STYLE_REGEX.exec(style)) !== null) {
|
||||
const name = matches[1];
|
||||
|
||||
if (matches[2]) {
|
||||
const args = parseArguments(name, matches[2]);
|
||||
results.push([name].concat(args));
|
||||
} else {
|
||||
results.push([name]);
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
function buildStyle(chalk, styles) {
|
||||
const enabled = {};
|
||||
|
||||
for (const layer of styles) {
|
||||
for (const style of layer.styles) {
|
||||
enabled[style[0]] = layer.inverse ? null : style.slice(1);
|
||||
}
|
||||
}
|
||||
|
||||
let current = chalk;
|
||||
for (const styleName of Object.keys(enabled)) {
|
||||
if (Array.isArray(enabled[styleName])) {
|
||||
if (!(styleName in current)) {
|
||||
throw new Error(`Unknown Chalk style: ${styleName}`);
|
||||
}
|
||||
|
||||
if (enabled[styleName].length > 0) {
|
||||
current = current[styleName].apply(current, enabled[styleName]);
|
||||
} else {
|
||||
current = current[styleName];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return current;
|
||||
}
|
||||
|
||||
module.exports = (chalk, tmp) => {
|
||||
const styles = [];
|
||||
const chunks = [];
|
||||
let chunk = [];
|
||||
|
||||
// eslint-disable-next-line max-params
|
||||
tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => {
|
||||
if (escapeChar) {
|
||||
chunk.push(unescape(escapeChar));
|
||||
} else if (style) {
|
||||
const str = chunk.join('');
|
||||
chunk = [];
|
||||
chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str));
|
||||
styles.push({inverse, styles: parseStyle(style)});
|
||||
} else if (close) {
|
||||
if (styles.length === 0) {
|
||||
throw new Error('Found extraneous } in Chalk template literal');
|
||||
}
|
||||
|
||||
chunks.push(buildStyle(chalk, styles)(chunk.join('')));
|
||||
chunk = [];
|
||||
styles.pop();
|
||||
} else {
|
||||
chunk.push(chr);
|
||||
}
|
||||
});
|
||||
|
||||
chunks.push(chunk.join(''));
|
||||
|
||||
if (styles.length > 0) {
|
||||
const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
|
||||
throw new Error(errMsg);
|
||||
}
|
||||
|
||||
return chunks.join('');
|
||||
};
|
97
node_modules/@babel/highlight/node_modules/chalk/types/index.d.ts
generated
vendored
97
node_modules/@babel/highlight/node_modules/chalk/types/index.d.ts
generated
vendored
@ -1,97 +0,0 @@
|
||||
// Type definitions for Chalk
|
||||
// Definitions by: Thomas Sauer <https://github.com/t-sauer>
|
||||
|
||||
export const enum Level {
|
||||
None = 0,
|
||||
Basic = 1,
|
||||
Ansi256 = 2,
|
||||
TrueColor = 3
|
||||
}
|
||||
|
||||
export interface ChalkOptions {
|
||||
enabled?: boolean;
|
||||
level?: Level;
|
||||
}
|
||||
|
||||
export interface ChalkConstructor {
|
||||
new (options?: ChalkOptions): Chalk;
|
||||
(options?: ChalkOptions): Chalk;
|
||||
}
|
||||
|
||||
export interface ColorSupport {
|
||||
level: Level;
|
||||
hasBasic: boolean;
|
||||
has256: boolean;
|
||||
has16m: boolean;
|
||||
}
|
||||
|
||||
export interface Chalk {
|
||||
(...text: string[]): string;
|
||||
(text: TemplateStringsArray, ...placeholders: string[]): string;
|
||||
constructor: ChalkConstructor;
|
||||
enabled: boolean;
|
||||
level: Level;
|
||||
rgb(r: number, g: number, b: number): this;
|
||||
hsl(h: number, s: number, l: number): this;
|
||||
hsv(h: number, s: number, v: number): this;
|
||||
hwb(h: number, w: number, b: number): this;
|
||||
bgHex(color: string): this;
|
||||
bgKeyword(color: string): this;
|
||||
bgRgb(r: number, g: number, b: number): this;
|
||||
bgHsl(h: number, s: number, l: number): this;
|
||||
bgHsv(h: number, s: number, v: number): this;
|
||||
bgHwb(h: number, w: number, b: number): this;
|
||||
hex(color: string): this;
|
||||
keyword(color: string): this;
|
||||
|
||||
readonly reset: this;
|
||||
readonly bold: this;
|
||||
readonly dim: this;
|
||||
readonly italic: this;
|
||||
readonly underline: this;
|
||||
readonly inverse: this;
|
||||
readonly hidden: this;
|
||||
readonly strikethrough: this;
|
||||
|
||||
readonly visible: this;
|
||||
|
||||
readonly black: this;
|
||||
readonly red: this;
|
||||
readonly green: this;
|
||||
readonly yellow: this;
|
||||
readonly blue: this;
|
||||
readonly magenta: this;
|
||||
readonly cyan: this;
|
||||
readonly white: this;
|
||||
readonly gray: this;
|
||||
readonly grey: this;
|
||||
readonly blackBright: this;
|
||||
readonly redBright: this;
|
||||
readonly greenBright: this;
|
||||
readonly yellowBright: this;
|
||||
readonly blueBright: this;
|
||||
readonly magentaBright: this;
|
||||
readonly cyanBright: this;
|
||||
readonly whiteBright: this;
|
||||
|
||||
readonly bgBlack: this;
|
||||
readonly bgRed: this;
|
||||
readonly bgGreen: this;
|
||||
readonly bgYellow: this;
|
||||
readonly bgBlue: this;
|
||||
readonly bgMagenta: this;
|
||||
readonly bgCyan: this;
|
||||
readonly bgWhite: this;
|
||||
readonly bgBlackBright: this;
|
||||
readonly bgRedBright: this;
|
||||
readonly bgGreenBright: this;
|
||||
readonly bgYellowBright: this;
|
||||
readonly bgBlueBright: this;
|
||||
readonly bgMagentaBright: this;
|
||||
readonly bgCyanBright: this;
|
||||
readonly bgWhiteBright: this;
|
||||
}
|
||||
|
||||
declare const chalk: Chalk & { supportsColor: ColorSupport };
|
||||
|
||||
export default chalk
|
54
node_modules/@babel/highlight/node_modules/color-convert/CHANGELOG.md
generated
vendored
54
node_modules/@babel/highlight/node_modules/color-convert/CHANGELOG.md
generated
vendored
@ -1,54 +0,0 @@
|
||||
# 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/@babel/highlight/node_modules/color-convert/LICENSE
generated
vendored
21
node_modules/@babel/highlight/node_modules/color-convert/LICENSE
generated
vendored
@ -1,21 +0,0 @@
|
||||
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/@babel/highlight/node_modules/color-convert/README.md
generated
vendored
68
node_modules/@babel/highlight/node_modules/color-convert/README.md
generated
vendored
@ -1,68 +0,0 @@
|
||||
# color-convert
|
||||
|
||||
[![Build Status](https://travis-ci.org/Qix-/color-convert.svg?branch=master)](https://travis-ci.org/Qix-/color-convert)
|
||||
|
||||
Color-convert is a color conversion library for JavaScript and node.
|
||||
It converts all ways between `rgb`, `hsl`, `hsv`, `hwb`, `cmyk`, `ansi`, `ansi16`, `hex` strings, and CSS `keyword`s (will round to closest):
|
||||
|
||||
```js
|
||||
var convert = require('color-convert');
|
||||
|
||||
convert.rgb.hsl(140, 200, 100); // [96, 48, 59]
|
||||
convert.keyword.rgb('blue'); // [0, 0, 255]
|
||||
|
||||
var rgbChannels = convert.rgb.channels; // 3
|
||||
var cmykChannels = convert.cmyk.channels; // 4
|
||||
var ansiChannels = convert.ansi16.channels; // 1
|
||||
```
|
||||
|
||||
# Install
|
||||
|
||||
```console
|
||||
$ npm install color-convert
|
||||
```
|
||||
|
||||
# API
|
||||
|
||||
Simply get the property of the _from_ and _to_ conversion that you're looking for.
|
||||
|
||||
All functions have a rounded and unrounded variant. By default, return values are rounded. To get the unrounded (raw) results, simply tack on `.raw` to the function.
|
||||
|
||||
All 'from' functions have a hidden property called `.channels` that indicates the number of channels the function expects (not including alpha).
|
||||
|
||||
```js
|
||||
var convert = require('color-convert');
|
||||
|
||||
// Hex to LAB
|
||||
convert.hex.lab('DEADBF'); // [ 76, 21, -2 ]
|
||||
convert.hex.lab.raw('DEADBF'); // [ 75.56213190997677, 20.653827952644754, -2.290532499330533 ]
|
||||
|
||||
// RGB to CMYK
|
||||
convert.rgb.cmyk(167, 255, 4); // [ 35, 0, 98, 0 ]
|
||||
convert.rgb.cmyk.raw(167, 255, 4); // [ 34.509803921568626, 0, 98.43137254901961, 0 ]
|
||||
```
|
||||
|
||||
### Arrays
|
||||
All functions that accept multiple arguments also support passing an array.
|
||||
|
||||
Note that this does **not** apply to functions that convert from a color that only requires one value (e.g. `keyword`, `ansi256`, `hex`, etc.)
|
||||
|
||||
```js
|
||||
var convert = require('color-convert');
|
||||
|
||||
convert.rgb.hex(123, 45, 67); // '7B2D43'
|
||||
convert.rgb.hex([123, 45, 67]); // '7B2D43'
|
||||
```
|
||||
|
||||
## Routing
|
||||
|
||||
Conversions that don't have an _explicitly_ defined conversion (in [conversions.js](conversions.js)), but can be converted by means of sub-conversions (e.g. XYZ -> **RGB** -> CMYK), are automatically routed together. This allows just about any color model supported by `color-convert` to be converted to any other model, so long as a sub-conversion path exists. This is also true for conversions requiring more than one step in between (e.g. LCH -> **LAB** -> **XYZ** -> **RGB** -> Hex).
|
||||
|
||||
Keep in mind that extensive conversions _may_ result in a loss of precision, and exist only to be complete. For a list of "direct" (single-step) conversions, see [conversions.js](conversions.js).
|
||||
|
||||
# Contribute
|
||||
|
||||
If there is a new model you would like to support, or want to add a direct conversion between two existing models, please send us a pull request.
|
||||
|
||||
# License
|
||||
Copyright © 2011-2016, Heather Arthur and Josh Junon. Licensed under the [MIT License](LICENSE).
|
868
node_modules/@babel/highlight/node_modules/color-convert/conversions.js
generated
vendored
868
node_modules/@babel/highlight/node_modules/color-convert/conversions.js
generated
vendored
@ -1,868 +0,0 @@
|
||||
/* MIT license */
|
||||
var cssKeywords = require('color-name');
|
||||
|
||||
// NOTE: conversions should only return primitive values (i.e. arrays, or
|
||||
// values that give correct `typeof` results).
|
||||
// do not use box values types (i.e. Number(), String(), etc.)
|
||||
|
||||
var reverseKeywords = {};
|
||||
for (var key in cssKeywords) {
|
||||
if (cssKeywords.hasOwnProperty(key)) {
|
||||
reverseKeywords[cssKeywords[key]] = key;
|
||||
}
|
||||
}
|
||||
|
||||
var convert = module.exports = {
|
||||
rgb: {channels: 3, labels: 'rgb'},
|
||||
hsl: {channels: 3, labels: 'hsl'},
|
||||
hsv: {channels: 3, labels: 'hsv'},
|
||||
hwb: {channels: 3, labels: 'hwb'},
|
||||
cmyk: {channels: 4, labels: 'cmyk'},
|
||||
xyz: {channels: 3, labels: 'xyz'},
|
||||
lab: {channels: 3, labels: 'lab'},
|
||||
lch: {channels: 3, labels: 'lch'},
|
||||
hex: {channels: 1, labels: ['hex']},
|
||||
keyword: {channels: 1, labels: ['keyword']},
|
||||
ansi16: {channels: 1, labels: ['ansi16']},
|
||||
ansi256: {channels: 1, labels: ['ansi256']},
|
||||
hcg: {channels: 3, labels: ['h', 'c', 'g']},
|
||||
apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
|
||||
gray: {channels: 1, labels: ['gray']}
|
||||
};
|
||||
|
||||
// hide .channels and .labels properties
|
||||
for (var model in convert) {
|
||||
if (convert.hasOwnProperty(model)) {
|
||||
if (!('channels' in convert[model])) {
|
||||
throw new Error('missing channels property: ' + model);
|
||||
}
|
||||
|
||||
if (!('labels' in convert[model])) {
|
||||
throw new Error('missing channel labels property: ' + model);
|
||||
}
|
||||
|
||||
if (convert[model].labels.length !== convert[model].channels) {
|
||||
throw new Error('channel and label counts mismatch: ' + model);
|
||||
}
|
||||
|
||||
var channels = convert[model].channels;
|
||||
var labels = convert[model].labels;
|
||||
delete convert[model].channels;
|
||||
delete convert[model].labels;
|
||||
Object.defineProperty(convert[model], 'channels', {value: channels});
|
||||
Object.defineProperty(convert[model], 'labels', {value: labels});
|
||||
}
|
||||
}
|
||||
|
||||
convert.rgb.hsl = function (rgb) {
|
||||
var r = rgb[0] / 255;
|
||||
var g = rgb[1] / 255;
|
||||
var b = rgb[2] / 255;
|
||||
var min = Math.min(r, g, b);
|
||||
var max = Math.max(r, g, b);
|
||||
var delta = max - min;
|
||||
var h;
|
||||
var s;
|
||||
var l;
|
||||
|
||||
if (max === min) {
|
||||
h = 0;
|
||||
} else if (r === max) {
|
||||
h = (g - b) / delta;
|
||||
} else if (g === max) {
|
||||
h = 2 + (b - r) / delta;
|
||||
} else if (b === max) {
|
||||
h = 4 + (r - g) / delta;
|
||||
}
|
||||
|
||||
h = Math.min(h * 60, 360);
|
||||
|
||||
if (h < 0) {
|
||||
h += 360;
|
||||
}
|
||||
|
||||
l = (min + max) / 2;
|
||||
|
||||
if (max === min) {
|
||||
s = 0;
|
||||
} else if (l <= 0.5) {
|
||||
s = delta / (max + min);
|
||||
} else {
|
||||
s = delta / (2 - max - min);
|
||||
}
|
||||
|
||||
return [h, s * 100, l * 100];
|
||||
};
|
||||
|
||||
convert.rgb.hsv = function (rgb) {
|
||||
var rdif;
|
||||
var gdif;
|
||||
var bdif;
|
||||
var h;
|
||||
var s;
|
||||
|
||||
var r = rgb[0] / 255;
|
||||
var g = rgb[1] / 255;
|
||||
var b = rgb[2] / 255;
|
||||
var v = Math.max(r, g, b);
|
||||
var diff = v - Math.min(r, g, b);
|
||||
var diffc = function (c) {
|
||||
return (v - c) / 6 / diff + 1 / 2;
|
||||
};
|
||||
|
||||
if (diff === 0) {
|
||||
h = s = 0;
|
||||
} else {
|
||||
s = diff / v;
|
||||
rdif = diffc(r);
|
||||
gdif = diffc(g);
|
||||
bdif = diffc(b);
|
||||
|
||||
if (r === v) {
|
||||
h = bdif - gdif;
|
||||
} else if (g === v) {
|
||||
h = (1 / 3) + rdif - bdif;
|
||||
} else if (b === v) {
|
||||
h = (2 / 3) + gdif - rdif;
|
||||
}
|
||||
if (h < 0) {
|
||||
h += 1;
|
||||
} else if (h > 1) {
|
||||
h -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
h * 360,
|
||||
s * 100,
|
||||
v * 100
|
||||
];
|
||||
};
|
||||
|
||||
convert.rgb.hwb = function (rgb) {
|
||||
var r = rgb[0];
|
||||
var g = rgb[1];
|
||||
var b = rgb[2];
|
||||
var h = convert.rgb.hsl(rgb)[0];
|
||||
var w = 1 / 255 * Math.min(r, Math.min(g, b));
|
||||
|
||||
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
|
||||
|
||||
return [h, w * 100, b * 100];
|
||||
};
|
||||
|
||||
convert.rgb.cmyk = function (rgb) {
|
||||
var r = rgb[0] / 255;
|
||||
var g = rgb[1] / 255;
|
||||
var b = rgb[2] / 255;
|
||||
var c;
|
||||
var m;
|
||||
var y;
|
||||
var k;
|
||||
|
||||
k = Math.min(1 - r, 1 - g, 1 - b);
|
||||
c = (1 - r - k) / (1 - k) || 0;
|
||||
m = (1 - g - k) / (1 - k) || 0;
|
||||
y = (1 - b - k) / (1 - k) || 0;
|
||||
|
||||
return [c * 100, m * 100, y * 100, k * 100];
|
||||
};
|
||||
|
||||
/**
|
||||
* See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
||||
* */
|
||||
function comparativeDistance(x, y) {
|
||||
return (
|
||||
Math.pow(x[0] - y[0], 2) +
|
||||
Math.pow(x[1] - y[1], 2) +
|
||||
Math.pow(x[2] - y[2], 2)
|
||||
);
|
||||
}
|
||||
|
||||
convert.rgb.keyword = function (rgb) {
|
||||
var reversed = reverseKeywords[rgb];
|
||||
if (reversed) {
|
||||
return reversed;
|
||||
}
|
||||
|
||||
var currentClosestDistance = Infinity;
|
||||
var currentClosestKeyword;
|
||||
|
||||
for (var keyword in cssKeywords) {
|
||||
if (cssKeywords.hasOwnProperty(keyword)) {
|
||||
var value = cssKeywords[keyword];
|
||||
|
||||
// Compute comparative distance
|
||||
var distance = comparativeDistance(rgb, value);
|
||||
|
||||
// Check if its less, if so set as closest
|
||||
if (distance < currentClosestDistance) {
|
||||
currentClosestDistance = distance;
|
||||
currentClosestKeyword = keyword;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return currentClosestKeyword;
|
||||
};
|
||||
|
||||
convert.keyword.rgb = function (keyword) {
|
||||
return cssKeywords[keyword];
|
||||
};
|
||||
|
||||
convert.rgb.xyz = function (rgb) {
|
||||
var r = rgb[0] / 255;
|
||||
var g = rgb[1] / 255;
|
||||
var b = rgb[2] / 255;
|
||||
|
||||
// assume sRGB
|
||||
r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92);
|
||||
g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92);
|
||||
b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92);
|
||||
|
||||
var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
|
||||
var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
|
||||
var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
|
||||
|
||||
return [x * 100, y * 100, z * 100];
|
||||
};
|
||||
|
||||
convert.rgb.lab = function (rgb) {
|
||||
var xyz = convert.rgb.xyz(rgb);
|
||||
var x = xyz[0];
|
||||
var y = xyz[1];
|
||||
var z = xyz[2];
|
||||
var l;
|
||||
var a;
|
||||
var b;
|
||||
|
||||
x /= 95.047;
|
||||
y /= 100;
|
||||
z /= 108.883;
|
||||
|
||||
x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
|
||||
y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
|
||||
z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
|
||||
|
||||
l = (116 * y) - 16;
|
||||
a = 500 * (x - y);
|
||||
b = 200 * (y - z);
|
||||
|
||||
return [l, a, b];
|
||||
};
|
||||
|
||||
convert.hsl.rgb = function (hsl) {
|
||||
var h = hsl[0] / 360;
|
||||
var s = hsl[1] / 100;
|
||||
var l = hsl[2] / 100;
|
||||
var t1;
|
||||
var t2;
|
||||
var t3;
|
||||
var rgb;
|
||||
var val;
|
||||
|
||||
if (s === 0) {
|
||||
val = l * 255;
|
||||
return [val, val, val];
|
||||
}
|
||||
|
||||
if (l < 0.5) {
|
||||
t2 = l * (1 + s);
|
||||
} else {
|
||||
t2 = l + s - l * s;
|
||||
}
|
||||
|
||||
t1 = 2 * l - t2;
|
||||
|
||||
rgb = [0, 0, 0];
|
||||
for (var i = 0; i < 3; i++) {
|
||||
t3 = h + 1 / 3 * -(i - 1);
|
||||
if (t3 < 0) {
|
||||
t3++;
|
||||
}
|
||||
if (t3 > 1) {
|
||||
t3--;
|
||||
}
|
||||
|
||||
if (6 * t3 < 1) {
|
||||
val = t1 + (t2 - t1) * 6 * t3;
|
||||
} else if (2 * t3 < 1) {
|
||||
val = t2;
|
||||
} else if (3 * t3 < 2) {
|
||||
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
|
||||
} else {
|
||||
val = t1;
|
||||
}
|
||||
|
||||
rgb[i] = val * 255;
|
||||
}
|
||||
|
||||
return rgb;
|
||||
};
|
||||
|
||||
convert.hsl.hsv = function (hsl) {
|
||||
var h = hsl[0];
|
||||
var s = hsl[1] / 100;
|
||||
var l = hsl[2] / 100;
|
||||
var smin = s;
|
||||
var lmin = Math.max(l, 0.01);
|
||||
var sv;
|
||||
var v;
|
||||
|
||||
l *= 2;
|
||||
s *= (l <= 1) ? l : 2 - l;
|
||||
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
||||
v = (l + s) / 2;
|
||||
sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
|
||||
|
||||
return [h, sv * 100, v * 100];
|
||||
};
|
||||
|
||||
convert.hsv.rgb = function (hsv) {
|
||||
var h = hsv[0] / 60;
|
||||
var s = hsv[1] / 100;
|
||||
var v = hsv[2] / 100;
|
||||
var hi = Math.floor(h) % 6;
|
||||
|
||||
var f = h - Math.floor(h);
|
||||
var p = 255 * v * (1 - s);
|
||||
var q = 255 * v * (1 - (s * f));
|
||||
var t = 255 * v * (1 - (s * (1 - f)));
|
||||
v *= 255;
|
||||
|
||||
switch (hi) {
|
||||
case 0:
|
||||
return [v, t, p];
|
||||
case 1:
|
||||
return [q, v, p];
|
||||
case 2:
|
||||
return [p, v, t];
|
||||
case 3:
|
||||
return [p, q, v];
|
||||
case 4:
|
||||
return [t, p, v];
|
||||
case 5:
|
||||
return [v, p, q];
|
||||
}
|
||||
};
|
||||
|
||||
convert.hsv.hsl = function (hsv) {
|
||||
var h = hsv[0];
|
||||
var s = hsv[1] / 100;
|
||||
var v = hsv[2] / 100;
|
||||
var vmin = Math.max(v, 0.01);
|
||||
var lmin;
|
||||
var sl;
|
||||
var l;
|
||||
|
||||
l = (2 - s) * v;
|
||||
lmin = (2 - s) * vmin;
|
||||
sl = s * vmin;
|
||||
sl /= (lmin <= 1) ? lmin : 2 - lmin;
|
||||
sl = sl || 0;
|
||||
l /= 2;
|
||||
|
||||
return [h, sl * 100, l * 100];
|
||||
};
|
||||
|
||||
// http://dev.w3.org/csswg/css-color/#hwb-to-rgb
|
||||
convert.hwb.rgb = function (hwb) {
|
||||
var h = hwb[0] / 360;
|
||||
var wh = hwb[1] / 100;
|
||||
var bl = hwb[2] / 100;
|
||||
var ratio = wh + bl;
|
||||
var i;
|
||||
var v;
|
||||
var f;
|
||||
var n;
|
||||
|
||||
// wh + bl cant be > 1
|
||||
if (ratio > 1) {
|
||||
wh /= ratio;
|
||||
bl /= ratio;
|
||||
}
|
||||
|
||||
i = Math.floor(6 * h);
|
||||
v = 1 - bl;
|
||||
f = 6 * h - i;
|
||||
|
||||
if ((i & 0x01) !== 0) {
|
||||
f = 1 - f;
|
||||
}
|
||||
|
||||
n = wh + f * (v - wh); // linear interpolation
|
||||
|
||||
var r;
|
||||
var g;
|
||||
var b;
|
||||
switch (i) {
|
||||
default:
|
||||
case 6:
|
||||
case 0: r = v; g = n; b = wh; break;
|
||||
case 1: r = n; g = v; b = wh; break;
|
||||
case 2: r = wh; g = v; b = n; break;
|
||||
case 3: r = wh; g = n; b = v; break;
|
||||
case 4: r = n; g = wh; b = v; break;
|
||||
case 5: r = v; g = wh; b = n; break;
|
||||
}
|
||||
|
||||
return [r * 255, g * 255, b * 255];
|
||||
};
|
||||
|
||||
convert.cmyk.rgb = function (cmyk) {
|
||||
var c = cmyk[0] / 100;
|
||||
var m = cmyk[1] / 100;
|
||||
var y = cmyk[2] / 100;
|
||||
var k = cmyk[3] / 100;
|
||||
var r;
|
||||
var g;
|
||||
var b;
|
||||
|
||||
r = 1 - Math.min(1, c * (1 - k) + k);
|
||||
g = 1 - Math.min(1, m * (1 - k) + k);
|
||||
b = 1 - Math.min(1, y * (1 - k) + k);
|
||||
|
||||
return [r * 255, g * 255, b * 255];
|
||||
};
|
||||
|
||||
convert.xyz.rgb = function (xyz) {
|
||||
var x = xyz[0] / 100;
|
||||
var y = xyz[1] / 100;
|
||||
var z = xyz[2] / 100;
|
||||
var r;
|
||||
var g;
|
||||
var b;
|
||||
|
||||
r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
|
||||
g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
|
||||
b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
|
||||
|
||||
// assume sRGB
|
||||
r = r > 0.0031308
|
||||
? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055)
|
||||
: r * 12.92;
|
||||
|
||||
g = g > 0.0031308
|
||||
? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055)
|
||||
: g * 12.92;
|
||||
|
||||
b = b > 0.0031308
|
||||
? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055)
|
||||
: b * 12.92;
|
||||
|
||||
r = Math.min(Math.max(0, r), 1);
|
||||
g = Math.min(Math.max(0, g), 1);
|
||||
b = Math.min(Math.max(0, b), 1);
|
||||
|
||||
return [r * 255, g * 255, b * 255];
|
||||
};
|
||||
|
||||
convert.xyz.lab = function (xyz) {
|
||||
var x = xyz[0];
|
||||
var y = xyz[1];
|
||||
var z = xyz[2];
|
||||
var l;
|
||||
var a;
|
||||
var b;
|
||||
|
||||
x /= 95.047;
|
||||
y /= 100;
|
||||
z /= 108.883;
|
||||
|
||||
x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
|
||||
y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
|
||||
z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
|
||||
|
||||
l = (116 * y) - 16;
|
||||
a = 500 * (x - y);
|
||||
b = 200 * (y - z);
|
||||
|
||||
return [l, a, b];
|
||||
};
|
||||
|
||||
convert.lab.xyz = function (lab) {
|
||||
var l = lab[0];
|
||||
var a = lab[1];
|
||||
var b = lab[2];
|
||||
var x;
|
||||
var y;
|
||||
var z;
|
||||
|
||||
y = (l + 16) / 116;
|
||||
x = a / 500 + y;
|
||||
z = y - b / 200;
|
||||
|
||||
var y2 = Math.pow(y, 3);
|
||||
var x2 = Math.pow(x, 3);
|
||||
var z2 = Math.pow(z, 3);
|
||||
y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
|
||||
x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
|
||||
z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
|
||||
|
||||
x *= 95.047;
|
||||
y *= 100;
|
||||
z *= 108.883;
|
||||
|
||||
return [x, y, z];
|
||||
};
|
||||
|
||||
convert.lab.lch = function (lab) {
|
||||
var l = lab[0];
|
||||
var a = lab[1];
|
||||
var b = lab[2];
|
||||
var hr;
|
||||
var h;
|
||||
var c;
|
||||
|
||||
hr = Math.atan2(b, a);
|
||||
h = hr * 360 / 2 / Math.PI;
|
||||
|
||||
if (h < 0) {
|
||||
h += 360;
|
||||
}
|
||||
|
||||
c = Math.sqrt(a * a + b * b);
|
||||
|
||||
return [l, c, h];
|
||||
};
|
||||
|
||||
convert.lch.lab = function (lch) {
|
||||
var l = lch[0];
|
||||
var c = lch[1];
|
||||
var h = lch[2];
|
||||
var a;
|
||||
var b;
|
||||
var hr;
|
||||
|
||||
hr = h / 360 * 2 * Math.PI;
|
||||
a = c * Math.cos(hr);
|
||||
b = c * Math.sin(hr);
|
||||
|
||||
return [l, a, b];
|
||||
};
|
||||
|
||||
convert.rgb.ansi16 = function (args) {
|
||||
var r = args[0];
|
||||
var g = args[1];
|
||||
var b = args[2];
|
||||
var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization
|
||||
|
||||
value = Math.round(value / 50);
|
||||
|
||||
if (value === 0) {
|
||||
return 30;
|
||||
}
|
||||
|
||||
var ansi = 30
|
||||
+ ((Math.round(b / 255) << 2)
|
||||
| (Math.round(g / 255) << 1)
|
||||
| Math.round(r / 255));
|
||||
|
||||
if (value === 2) {
|
||||
ansi += 60;
|
||||
}
|
||||
|
||||
return ansi;
|
||||
};
|
||||
|
||||
convert.hsv.ansi16 = function (args) {
|
||||
// optimization here; we already know the value and don't need to get
|
||||
// it converted for us.
|
||||
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
|
||||
};
|
||||
|
||||
convert.rgb.ansi256 = function (args) {
|
||||
var r = args[0];
|
||||
var g = args[1];
|
||||
var b = args[2];
|
||||
|
||||
// we use the extended greyscale palette here, with the exception of
|
||||
// black and white. normal palette only has 4 greyscale shades.
|
||||
if (r === g && g === b) {
|
||||
if (r < 8) {
|
||||
return 16;
|
||||
}
|
||||
|
||||
if (r > 248) {
|
||||
return 231;
|
||||
}
|
||||
|
||||
return Math.round(((r - 8) / 247) * 24) + 232;
|
||||
}
|
||||
|
||||
var ansi = 16
|
||||
+ (36 * Math.round(r / 255 * 5))
|
||||
+ (6 * Math.round(g / 255 * 5))
|
||||
+ Math.round(b / 255 * 5);
|
||||
|
||||
return ansi;
|
||||
};
|
||||
|
||||
convert.ansi16.rgb = function (args) {
|
||||
var color = args % 10;
|
||||
|
||||
// handle greyscale
|
||||
if (color === 0 || color === 7) {
|
||||
if (args > 50) {
|
||||
color += 3.5;
|
||||
}
|
||||
|
||||
color = color / 10.5 * 255;
|
||||
|
||||
return [color, color, color];
|
||||
}
|
||||
|
||||
var mult = (~~(args > 50) + 1) * 0.5;
|
||||
var r = ((color & 1) * mult) * 255;
|
||||
var g = (((color >> 1) & 1) * mult) * 255;
|
||||
var b = (((color >> 2) & 1) * mult) * 255;
|
||||
|
||||
return [r, g, b];
|
||||
};
|
||||
|
||||
convert.ansi256.rgb = function (args) {
|
||||
// handle greyscale
|
||||
if (args >= 232) {
|
||||
var c = (args - 232) * 10 + 8;
|
||||
return [c, c, c];
|
||||
}
|
||||
|
||||
args -= 16;
|
||||
|
||||
var rem;
|
||||
var r = Math.floor(args / 36) / 5 * 255;
|
||||
var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
|
||||
var b = (rem % 6) / 5 * 255;
|
||||
|
||||
return [r, g, b];
|
||||
};
|
||||
|
||||
convert.rgb.hex = function (args) {
|
||||
var integer = ((Math.round(args[0]) & 0xFF) << 16)
|
||||
+ ((Math.round(args[1]) & 0xFF) << 8)
|
||||
+ (Math.round(args[2]) & 0xFF);
|
||||
|
||||
var string = integer.toString(16).toUpperCase();
|
||||
return '000000'.substring(string.length) + string;
|
||||
};
|
||||
|
||||
convert.hex.rgb = function (args) {
|
||||
var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
|
||||
if (!match) {
|
||||
return [0, 0, 0];
|
||||
}
|
||||
|
||||
var colorString = match[0];
|
||||
|
||||
if (match[0].length === 3) {
|
||||
colorString = colorString.split('').map(function (char) {
|
||||
return char + char;
|
||||
}).join('');
|
||||
}
|
||||
|
||||
var integer = parseInt(colorString, 16);
|
||||
var r = (integer >> 16) & 0xFF;
|
||||
var g = (integer >> 8) & 0xFF;
|
||||
var b = integer & 0xFF;
|
||||
|
||||
return [r, g, b];
|
||||
};
|
||||
|
||||
convert.rgb.hcg = function (rgb) {
|
||||
var r = rgb[0] / 255;
|
||||
var g = rgb[1] / 255;
|
||||
var b = rgb[2] / 255;
|
||||
var max = Math.max(Math.max(r, g), b);
|
||||
var min = Math.min(Math.min(r, g), b);
|
||||
var chroma = (max - min);
|
||||
var grayscale;
|
||||
var hue;
|
||||
|
||||
if (chroma < 1) {
|
||||
grayscale = min / (1 - chroma);
|
||||
} else {
|
||||
grayscale = 0;
|
||||
}
|
||||
|
||||
if (chroma <= 0) {
|
||||
hue = 0;
|
||||
} else
|
||||
if (max === r) {
|
||||
hue = ((g - b) / chroma) % 6;
|
||||
} else
|
||||
if (max === g) {
|
||||
hue = 2 + (b - r) / chroma;
|
||||
} else {
|
||||
hue = 4 + (r - g) / chroma + 4;
|
||||
}
|
||||
|
||||
hue /= 6;
|
||||
hue %= 1;
|
||||
|
||||
return [hue * 360, chroma * 100, grayscale * 100];
|
||||
};
|
||||
|
||||
convert.hsl.hcg = function (hsl) {
|
||||
var s = hsl[1] / 100;
|
||||
var l = hsl[2] / 100;
|
||||
var c = 1;
|
||||
var f = 0;
|
||||
|
||||
if (l < 0.5) {
|
||||
c = 2.0 * s * l;
|
||||
} else {
|
||||
c = 2.0 * s * (1.0 - l);
|
||||
}
|
||||
|
||||
if (c < 1.0) {
|
||||
f = (l - 0.5 * c) / (1.0 - c);
|
||||
}
|
||||
|
||||
return [hsl[0], c * 100, f * 100];
|
||||
};
|
||||
|
||||
convert.hsv.hcg = function (hsv) {
|
||||
var s = hsv[1] / 100;
|
||||
var v = hsv[2] / 100;
|
||||
|
||||
var c = s * v;
|
||||
var f = 0;
|
||||
|
||||
if (c < 1.0) {
|
||||
f = (v - c) / (1 - c);
|
||||
}
|
||||
|
||||
return [hsv[0], c * 100, f * 100];
|
||||
};
|
||||
|
||||
convert.hcg.rgb = function (hcg) {
|
||||
var h = hcg[0] / 360;
|
||||
var c = hcg[1] / 100;
|
||||
var g = hcg[2] / 100;
|
||||
|
||||
if (c === 0.0) {
|
||||
return [g * 255, g * 255, g * 255];
|
||||
}
|
||||
|
||||
var pure = [0, 0, 0];
|
||||
var hi = (h % 1) * 6;
|
||||
var v = hi % 1;
|
||||
var w = 1 - v;
|
||||
var mg = 0;
|
||||
|
||||
switch (Math.floor(hi)) {
|
||||
case 0:
|
||||
pure[0] = 1; pure[1] = v; pure[2] = 0; break;
|
||||
case 1:
|
||||
pure[0] = w; pure[1] = 1; pure[2] = 0; break;
|
||||
case 2:
|
||||
pure[0] = 0; pure[1] = 1; pure[2] = v; break;
|
||||
case 3:
|
||||
pure[0] = 0; pure[1] = w; pure[2] = 1; break;
|
||||
case 4:
|
||||
pure[0] = v; pure[1] = 0; pure[2] = 1; break;
|
||||
default:
|
||||
pure[0] = 1; pure[1] = 0; pure[2] = w;
|
||||
}
|
||||
|
||||
mg = (1.0 - c) * g;
|
||||
|
||||
return [
|
||||
(c * pure[0] + mg) * 255,
|
||||
(c * pure[1] + mg) * 255,
|
||||
(c * pure[2] + mg) * 255
|
||||
];
|
||||
};
|
||||
|
||||
convert.hcg.hsv = function (hcg) {
|
||||
var c = hcg[1] / 100;
|
||||
var g = hcg[2] / 100;
|
||||
|
||||
var v = c + g * (1.0 - c);
|
||||
var f = 0;
|
||||
|
||||
if (v > 0.0) {
|
||||
f = c / v;
|
||||
}
|
||||
|
||||
return [hcg[0], f * 100, v * 100];
|
||||
};
|
||||
|
||||
convert.hcg.hsl = function (hcg) {
|
||||
var c = hcg[1] / 100;
|
||||
var g = hcg[2] / 100;
|
||||
|
||||
var l = g * (1.0 - c) + 0.5 * c;
|
||||
var s = 0;
|
||||
|
||||
if (l > 0.0 && l < 0.5) {
|
||||
s = c / (2 * l);
|
||||
} else
|
||||
if (l >= 0.5 && l < 1.0) {
|
||||
s = c / (2 * (1 - l));
|
||||
}
|
||||
|
||||
return [hcg[0], s * 100, l * 100];
|
||||
};
|
||||
|
||||
convert.hcg.hwb = function (hcg) {
|
||||
var c = hcg[1] / 100;
|
||||
var g = hcg[2] / 100;
|
||||
var v = c + g * (1.0 - c);
|
||||
return [hcg[0], (v - c) * 100, (1 - v) * 100];
|
||||
};
|
||||
|
||||
convert.hwb.hcg = function (hwb) {
|
||||
var w = hwb[1] / 100;
|
||||
var b = hwb[2] / 100;
|
||||
var v = 1 - b;
|
||||
var c = v - w;
|
||||
var g = 0;
|
||||
|
||||
if (c < 1) {
|
||||
g = (v - c) / (1 - c);
|
||||
}
|
||||
|
||||
return [hwb[0], c * 100, g * 100];
|
||||
};
|
||||
|
||||
convert.apple.rgb = function (apple) {
|
||||
return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
|
||||
};
|
||||
|
||||
convert.rgb.apple = function (rgb) {
|
||||
return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
|
||||
};
|
||||
|
||||
convert.gray.rgb = function (args) {
|
||||
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
|
||||
};
|
||||
|
||||
convert.gray.hsl = convert.gray.hsv = function (args) {
|
||||
return [0, 0, args[0]];
|
||||
};
|
||||
|
||||
convert.gray.hwb = function (gray) {
|
||||
return [0, 100, gray[0]];
|
||||
};
|
||||
|
||||
convert.gray.cmyk = function (gray) {
|
||||
return [0, 0, 0, gray[0]];
|
||||
};
|
||||
|
||||
convert.gray.lab = function (gray) {
|
||||
return [gray[0], 0, 0];
|
||||
};
|
||||
|
||||
convert.gray.hex = function (gray) {
|
||||
var val = Math.round(gray[0] / 100 * 255) & 0xFF;
|
||||
var integer = (val << 16) + (val << 8) + val;
|
||||
|
||||
var string = integer.toString(16).toUpperCase();
|
||||
return '000000'.substring(string.length) + string;
|
||||
};
|
||||
|
||||
convert.rgb.gray = function (rgb) {
|
||||
var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
||||
return [val / 255 * 100];
|
||||
};
|
78
node_modules/@babel/highlight/node_modules/color-convert/index.js
generated
vendored
78
node_modules/@babel/highlight/node_modules/color-convert/index.js
generated
vendored
@ -1,78 +0,0 @@
|
||||
var conversions = require('./conversions');
|
||||
var route = require('./route');
|
||||
|
||||
var convert = {};
|
||||
|
||||
var models = Object.keys(conversions);
|
||||
|
||||
function wrapRaw(fn) {
|
||||
var wrappedFn = function (args) {
|
||||
if (args === undefined || args === null) {
|
||||
return args;
|
||||
}
|
||||
|
||||
if (arguments.length > 1) {
|
||||
args = Array.prototype.slice.call(arguments);
|
||||
}
|
||||
|
||||
return fn(args);
|
||||
};
|
||||
|
||||
// preserve .conversion property if there is one
|
||||
if ('conversion' in fn) {
|
||||
wrappedFn.conversion = fn.conversion;
|
||||
}
|
||||
|
||||
return wrappedFn;
|
||||
}
|
||||
|
||||
function wrapRounded(fn) {
|
||||
var wrappedFn = function (args) {
|
||||
if (args === undefined || args === null) {
|
||||
return args;
|
||||
}
|
||||
|
||||
if (arguments.length > 1) {
|
||||
args = Array.prototype.slice.call(arguments);
|
||||
}
|
||||
|
||||
var result = fn(args);
|
||||
|
||||
// we're assuming the result is an array here.
|
||||
// see notice in conversions.js; don't use box types
|
||||
// in conversion functions.
|
||||
if (typeof result === 'object') {
|
||||
for (var len = result.length, i = 0; i < len; i++) {
|
||||
result[i] = Math.round(result[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
// preserve .conversion property if there is one
|
||||
if ('conversion' in fn) {
|
||||
wrappedFn.conversion = fn.conversion;
|
||||
}
|
||||
|
||||
return wrappedFn;
|
||||
}
|
||||
|
||||
models.forEach(function (fromModel) {
|
||||
convert[fromModel] = {};
|
||||
|
||||
Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
|
||||
Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
|
||||
|
||||
var routes = route(fromModel);
|
||||
var routeModels = Object.keys(routes);
|
||||
|
||||
routeModels.forEach(function (toModel) {
|
||||
var fn = routes[toModel];
|
||||
|
||||
convert[fromModel][toModel] = wrapRounded(fn);
|
||||
convert[fromModel][toModel].raw = wrapRaw(fn);
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = convert;
|
46
node_modules/@babel/highlight/node_modules/color-convert/package.json
generated
vendored
46
node_modules/@babel/highlight/node_modules/color-convert/package.json
generated
vendored
@ -1,46 +0,0 @@
|
||||
{
|
||||
"name": "color-convert",
|
||||
"description": "Plain color conversion functions",
|
||||
"version": "1.9.3",
|
||||
"author": "Heather Arthur <fayearthur@gmail.com>",
|
||||
"license": "MIT",
|
||||
"repository": "Qix-/color-convert",
|
||||
"scripts": {
|
||||
"pretest": "xo",
|
||||
"test": "node test/basic.js"
|
||||
},
|
||||
"keywords": [
|
||||
"color",
|
||||
"colour",
|
||||
"convert",
|
||||
"converter",
|
||||
"conversion",
|
||||
"rgb",
|
||||
"hsl",
|
||||
"hsv",
|
||||
"hwb",
|
||||
"cmyk",
|
||||
"ansi",
|
||||
"ansi16"
|
||||
],
|
||||
"files": [
|
||||
"index.js",
|
||||
"conversions.js",
|
||||
"css-keywords.js",
|
||||
"route.js"
|
||||
],
|
||||
"xo": {
|
||||
"rules": {
|
||||
"default-case": 0,
|
||||
"no-inline-comments": 0,
|
||||
"operator-linebreak": 0
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"chalk": "1.1.1",
|
||||
"xo": "0.11.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"color-name": "1.1.3"
|
||||
}
|
||||
}
|
97
node_modules/@babel/highlight/node_modules/color-convert/route.js
generated
vendored
97
node_modules/@babel/highlight/node_modules/color-convert/route.js
generated
vendored
@ -1,97 +0,0 @@
|
||||
var conversions = require('./conversions');
|
||||
|
||||
/*
|
||||
this function routes a model to all other models.
|
||||
|
||||
all functions that are routed have a property `.conversion` attached
|
||||
to the returned synthetic function. This property is an array
|
||||
of strings, each with the steps in between the 'from' and 'to'
|
||||
color models (inclusive).
|
||||
|
||||
conversions that are not possible simply are not included.
|
||||
*/
|
||||
|
||||
function buildGraph() {
|
||||
var graph = {};
|
||||
// https://jsperf.com/object-keys-vs-for-in-with-closure/3
|
||||
var models = Object.keys(conversions);
|
||||
|
||||
for (var len = models.length, i = 0; i < len; i++) {
|
||||
graph[models[i]] = {
|
||||
// http://jsperf.com/1-vs-infinity
|
||||
// micro-opt, but this is simple.
|
||||
distance: -1,
|
||||
parent: null
|
||||
};
|
||||
}
|
||||
|
||||
return graph;
|
||||
}
|
||||
|
||||
// https://en.wikipedia.org/wiki/Breadth-first_search
|
||||
function deriveBFS(fromModel) {
|
||||
var graph = buildGraph();
|
||||
var queue = [fromModel]; // unshift -> queue -> pop
|
||||
|
||||
graph[fromModel].distance = 0;
|
||||
|
||||
while (queue.length) {
|
||||
var current = queue.pop();
|
||||
var adjacents = Object.keys(conversions[current]);
|
||||
|
||||
for (var len = adjacents.length, i = 0; i < len; i++) {
|
||||
var adjacent = adjacents[i];
|
||||
var node = graph[adjacent];
|
||||
|
||||
if (node.distance === -1) {
|
||||
node.distance = graph[current].distance + 1;
|
||||
node.parent = current;
|
||||
queue.unshift(adjacent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return graph;
|
||||
}
|
||||
|
||||
function link(from, to) {
|
||||
return function (args) {
|
||||
return to(from(args));
|
||||
};
|
||||
}
|
||||
|
||||
function wrapConversion(toModel, graph) {
|
||||
var path = [graph[toModel].parent, toModel];
|
||||
var fn = conversions[graph[toModel].parent][toModel];
|
||||
|
||||
var cur = graph[toModel].parent;
|
||||
while (graph[cur].parent) {
|
||||
path.unshift(graph[cur].parent);
|
||||
fn = link(conversions[graph[cur].parent][cur], fn);
|
||||
cur = graph[cur].parent;
|
||||
}
|
||||
|
||||
fn.conversion = path;
|
||||
return fn;
|
||||
}
|
||||
|
||||
module.exports = function (fromModel) {
|
||||
var graph = deriveBFS(fromModel);
|
||||
var conversion = {};
|
||||
|
||||
var models = Object.keys(graph);
|
||||
for (var len = models.length, i = 0; i < len; i++) {
|
||||
var toModel = models[i];
|
||||
var node = graph[toModel];
|
||||
|
||||
if (node.parent === null) {
|
||||
// no possible conversion, or this node is the source model.
|
||||
continue;
|
||||
}
|
||||
|
||||
conversion[toModel] = wrapConversion(toModel, graph);
|
||||
}
|
||||
|
||||
return conversion;
|
||||
};
|
||||
|
43
node_modules/@babel/highlight/node_modules/color-name/.eslintrc.json
generated
vendored
43
node_modules/@babel/highlight/node_modules/color-name/.eslintrc.json
generated
vendored
@ -1,43 +0,0 @@
|
||||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"node": true,
|
||||
"commonjs": true,
|
||||
"es6": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"rules": {
|
||||
"strict": 2,
|
||||
"indent": 0,
|
||||
"linebreak-style": 0,
|
||||
"quotes": 0,
|
||||
"semi": 0,
|
||||
"no-cond-assign": 1,
|
||||
"no-constant-condition": 1,
|
||||
"no-duplicate-case": 1,
|
||||
"no-empty": 1,
|
||||
"no-ex-assign": 1,
|
||||
"no-extra-boolean-cast": 1,
|
||||
"no-extra-semi": 1,
|
||||
"no-fallthrough": 1,
|
||||
"no-func-assign": 1,
|
||||
"no-global-assign": 1,
|
||||
"no-implicit-globals": 2,
|
||||
"no-inner-declarations": ["error", "functions"],
|
||||
"no-irregular-whitespace": 2,
|
||||
"no-loop-func": 1,
|
||||
"no-multi-str": 1,
|
||||
"no-mixed-spaces-and-tabs": 1,
|
||||
"no-proto": 1,
|
||||
"no-sequences": 1,
|
||||
"no-throw-literal": 1,
|
||||
"no-unmodified-loop-condition": 1,
|
||||
"no-useless-call": 1,
|
||||
"no-void": 1,
|
||||
"no-with": 2,
|
||||
"wrap-iife": 1,
|
||||
"no-redeclare": 1,
|
||||
"no-unused-vars": ["error", { "vars": "all", "args": "none" }],
|
||||
"no-sparse-arrays": 1
|
||||
}
|
||||
}
|
107
node_modules/@babel/highlight/node_modules/color-name/.npmignore
generated
vendored
107
node_modules/@babel/highlight/node_modules/color-name/.npmignore
generated
vendored
@ -1,107 +0,0 @@
|
||||
//this will affect all the git repos
|
||||
git config --global core.excludesfile ~/.gitignore
|
||||
|
||||
|
||||
//update files since .ignore won't if already tracked
|
||||
git rm --cached <file>
|
||||
|
||||
# Compiled source #
|
||||
###################
|
||||
*.com
|
||||
*.class
|
||||
*.dll
|
||||
*.exe
|
||||
*.o
|
||||
*.so
|
||||
|
||||
# Packages #
|
||||
############
|
||||
# it's better to unpack these files and commit the raw source
|
||||
# git has its own built in compression methods
|
||||
*.7z
|
||||
*.dmg
|
||||
*.gz
|
||||
*.iso
|
||||
*.jar
|
||||
*.rar
|
||||
*.tar
|
||||
*.zip
|
||||
|
||||
# Logs and databases #
|
||||
######################
|
||||
*.log
|
||||
*.sql
|
||||
*.sqlite
|
||||
|
||||
# OS generated files #
|
||||
######################
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
# Icon?
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
.cache
|
||||
.project
|
||||
.settings
|
||||
.tmproj
|
||||
*.esproj
|
||||
nbproject
|
||||
|
||||
# Numerous always-ignore extensions #
|
||||
#####################################
|
||||
*.diff
|
||||
*.err
|
||||
*.orig
|
||||
*.rej
|
||||
*.swn
|
||||
*.swo
|
||||
*.swp
|
||||
*.vi
|
||||
*~
|
||||
*.sass-cache
|
||||
*.grunt
|
||||
*.tmp
|
||||
|
||||
# Dreamweaver added files #
|
||||
###########################
|
||||
_notes
|
||||
dwsync.xml
|
||||
|
||||
# Komodo #
|
||||
###########################
|
||||
*.komodoproject
|
||||
.komodotools
|
||||
|
||||
# Node #
|
||||
#####################
|
||||
node_modules
|
||||
|
||||
# Bower #
|
||||
#####################
|
||||
bower_components
|
||||
|
||||
# Folders to ignore #
|
||||
#####################
|
||||
.hg
|
||||
.svn
|
||||
.CVS
|
||||
intermediate
|
||||
publish
|
||||
.idea
|
||||
.graphics
|
||||
_test
|
||||
_archive
|
||||
uploads
|
||||
tmp
|
||||
|
||||
# Vim files to ignore #
|
||||
#######################
|
||||
.VimballRecord
|
||||
.netrwhist
|
||||
|
||||
bundle.*
|
||||
|
||||
_demo
|
8
node_modules/@babel/highlight/node_modules/color-name/LICENSE
generated
vendored
8
node_modules/@babel/highlight/node_modules/color-name/LICENSE
generated
vendored
@ -1,8 +0,0 @@
|
||||
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/@babel/highlight/node_modules/color-name/README.md
generated
vendored
11
node_modules/@babel/highlight/node_modules/color-name/README.md
generated
vendored
@ -1,11 +0,0 @@
|
||||
A JSON with color names and its values. Based on http://dev.w3.org/csswg/css-color/#named-colors.
|
||||
|
||||
[![NPM](https://nodei.co/npm/color-name.png?mini=true)](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/@babel/highlight/node_modules/color-name/index.js
generated
vendored
152
node_modules/@babel/highlight/node_modules/color-name/index.js
generated
vendored
@ -1,152 +0,0 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = {
|
||||
"aliceblue": [240, 248, 255],
|
||||
"antiquewhite": [250, 235, 215],
|
||||
"aqua": [0, 255, 255],
|
||||
"aquamarine": [127, 255, 212],
|
||||
"azure": [240, 255, 255],
|
||||
"beige": [245, 245, 220],
|
||||
"bisque": [255, 228, 196],
|
||||
"black": [0, 0, 0],
|
||||
"blanchedalmond": [255, 235, 205],
|
||||
"blue": [0, 0, 255],
|
||||
"blueviolet": [138, 43, 226],
|
||||
"brown": [165, 42, 42],
|
||||
"burlywood": [222, 184, 135],
|
||||
"cadetblue": [95, 158, 160],
|
||||
"chartreuse": [127, 255, 0],
|
||||
"chocolate": [210, 105, 30],
|
||||
"coral": [255, 127, 80],
|
||||
"cornflowerblue": [100, 149, 237],
|
||||
"cornsilk": [255, 248, 220],
|
||||
"crimson": [220, 20, 60],
|
||||
"cyan": [0, 255, 255],
|
||||
"darkblue": [0, 0, 139],
|
||||
"darkcyan": [0, 139, 139],
|
||||
"darkgoldenrod": [184, 134, 11],
|
||||
"darkgray": [169, 169, 169],
|
||||
"darkgreen": [0, 100, 0],
|
||||
"darkgrey": [169, 169, 169],
|
||||
"darkkhaki": [189, 183, 107],
|
||||
"darkmagenta": [139, 0, 139],
|
||||
"darkolivegreen": [85, 107, 47],
|
||||
"darkorange": [255, 140, 0],
|
||||
"darkorchid": [153, 50, 204],
|
||||
"darkred": [139, 0, 0],
|
||||
"darksalmon": [233, 150, 122],
|
||||
"darkseagreen": [143, 188, 143],
|
||||
"darkslateblue": [72, 61, 139],
|
||||
"darkslategray": [47, 79, 79],
|
||||
"darkslategrey": [47, 79, 79],
|
||||
"darkturquoise": [0, 206, 209],
|
||||
"darkviolet": [148, 0, 211],
|
||||
"deeppink": [255, 20, 147],
|
||||
"deepskyblue": [0, 191, 255],
|
||||
"dimgray": [105, 105, 105],
|
||||
"dimgrey": [105, 105, 105],
|
||||
"dodgerblue": [30, 144, 255],
|
||||
"firebrick": [178, 34, 34],
|
||||
"floralwhite": [255, 250, 240],
|
||||
"forestgreen": [34, 139, 34],
|
||||
"fuchsia": [255, 0, 255],
|
||||
"gainsboro": [220, 220, 220],
|
||||
"ghostwhite": [248, 248, 255],
|
||||
"gold": [255, 215, 0],
|
||||
"goldenrod": [218, 165, 32],
|
||||
"gray": [128, 128, 128],
|
||||
"green": [0, 128, 0],
|
||||
"greenyellow": [173, 255, 47],
|
||||
"grey": [128, 128, 128],
|
||||
"honeydew": [240, 255, 240],
|
||||
"hotpink": [255, 105, 180],
|
||||
"indianred": [205, 92, 92],
|
||||
"indigo": [75, 0, 130],
|
||||
"ivory": [255, 255, 240],
|
||||
"khaki": [240, 230, 140],
|
||||
"lavender": [230, 230, 250],
|
||||
"lavenderblush": [255, 240, 245],
|
||||
"lawngreen": [124, 252, 0],
|
||||
"lemonchiffon": [255, 250, 205],
|
||||
"lightblue": [173, 216, 230],
|
||||
"lightcoral": [240, 128, 128],
|
||||
"lightcyan": [224, 255, 255],
|
||||
"lightgoldenrodyellow": [250, 250, 210],
|
||||
"lightgray": [211, 211, 211],
|
||||
"lightgreen": [144, 238, 144],
|
||||
"lightgrey": [211, 211, 211],
|
||||
"lightpink": [255, 182, 193],
|
||||
"lightsalmon": [255, 160, 122],
|
||||
"lightseagreen": [32, 178, 170],
|
||||
"lightskyblue": [135, 206, 250],
|
||||
"lightslategray": [119, 136, 153],
|
||||
"lightslategrey": [119, 136, 153],
|
||||
"lightsteelblue": [176, 196, 222],
|
||||
"lightyellow": [255, 255, 224],
|
||||
"lime": [0, 255, 0],
|
||||
"limegreen": [50, 205, 50],
|
||||
"linen": [250, 240, 230],
|
||||
"magenta": [255, 0, 255],
|
||||
"maroon": [128, 0, 0],
|
||||
"mediumaquamarine": [102, 205, 170],
|
||||
"mediumblue": [0, 0, 205],
|
||||
"mediumorchid": [186, 85, 211],
|
||||
"mediumpurple": [147, 112, 219],
|
||||
"mediumseagreen": [60, 179, 113],
|
||||
"mediumslateblue": [123, 104, 238],
|
||||
"mediumspringgreen": [0, 250, 154],
|
||||
"mediumturquoise": [72, 209, 204],
|
||||
"mediumvioletred": [199, 21, 133],
|
||||
"midnightblue": [25, 25, 112],
|
||||
"mintcream": [245, 255, 250],
|
||||
"mistyrose": [255, 228, 225],
|
||||
"moccasin": [255, 228, 181],
|
||||
"navajowhite": [255, 222, 173],
|
||||
"navy": [0, 0, 128],
|
||||
"oldlace": [253, 245, 230],
|
||||
"olive": [128, 128, 0],
|
||||
"olivedrab": [107, 142, 35],
|
||||
"orange": [255, 165, 0],
|
||||
"orangered": [255, 69, 0],
|
||||
"orchid": [218, 112, 214],
|
||||
"palegoldenrod": [238, 232, 170],
|
||||
"palegreen": [152, 251, 152],
|
||||
"paleturquoise": [175, 238, 238],
|
||||
"palevioletred": [219, 112, 147],
|
||||
"papayawhip": [255, 239, 213],
|
||||
"peachpuff": [255, 218, 185],
|
||||
"peru": [205, 133, 63],
|
||||
"pink": [255, 192, 203],
|
||||
"plum": [221, 160, 221],
|
||||
"powderblue": [176, 224, 230],
|
||||
"purple": [128, 0, 128],
|
||||
"rebeccapurple": [102, 51, 153],
|
||||
"red": [255, 0, 0],
|
||||
"rosybrown": [188, 143, 143],
|
||||
"royalblue": [65, 105, 225],
|
||||
"saddlebrown": [139, 69, 19],
|
||||
"salmon": [250, 128, 114],
|
||||
"sandybrown": [244, 164, 96],
|
||||
"seagreen": [46, 139, 87],
|
||||
"seashell": [255, 245, 238],
|
||||
"sienna": [160, 82, 45],
|
||||
"silver": [192, 192, 192],
|
||||
"skyblue": [135, 206, 235],
|
||||
"slateblue": [106, 90, 205],
|
||||
"slategray": [112, 128, 144],
|
||||
"slategrey": [112, 128, 144],
|
||||
"snow": [255, 250, 250],
|
||||
"springgreen": [0, 255, 127],
|
||||
"steelblue": [70, 130, 180],
|
||||
"tan": [210, 180, 140],
|
||||
"teal": [0, 128, 128],
|
||||
"thistle": [216, 191, 216],
|
||||
"tomato": [255, 99, 71],
|
||||
"turquoise": [64, 224, 208],
|
||||
"violet": [238, 130, 238],
|
||||
"wheat": [245, 222, 179],
|
||||
"white": [255, 255, 255],
|
||||
"whitesmoke": [245, 245, 245],
|
||||
"yellow": [255, 255, 0],
|
||||
"yellowgreen": [154, 205, 50]
|
||||
};
|
25
node_modules/@babel/highlight/node_modules/color-name/package.json
generated
vendored
25
node_modules/@babel/highlight/node_modules/color-name/package.json
generated
vendored
@ -1,25 +0,0 @@
|
||||
{
|
||||
"name": "color-name",
|
||||
"version": "1.1.3",
|
||||
"description": "A list of color names and its values",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "node test.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:dfcreative/color-name.git"
|
||||
},
|
||||
"keywords": [
|
||||
"color-name",
|
||||
"color",
|
||||
"color-keyword",
|
||||
"keyword"
|
||||
],
|
||||
"author": "DY <dfcreative@gmail.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/dfcreative/color-name/issues"
|
||||
},
|
||||
"homepage": "https://github.com/dfcreative/color-name"
|
||||
}
|
7
node_modules/@babel/highlight/node_modules/color-name/test.js
generated
vendored
7
node_modules/@babel/highlight/node_modules/color-name/test.js
generated
vendored
@ -1,7 +0,0 @@
|
||||
'use strict'
|
||||
|
||||
var names = require('./');
|
||||
var assert = require('assert');
|
||||
|
||||
assert.deepEqual(names.red, [255,0,0]);
|
||||
assert.deepEqual(names.aliceblue, [240,248,255]);
|
8
node_modules/@babel/highlight/node_modules/has-flag/index.js
generated
vendored
8
node_modules/@babel/highlight/node_modules/has-flag/index.js
generated
vendored
@ -1,8 +0,0 @@
|
||||
'use strict';
|
||||
module.exports = (flag, argv) => {
|
||||
argv = argv || process.argv;
|
||||
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
|
||||
const pos = argv.indexOf(prefix + flag);
|
||||
const terminatorPos = argv.indexOf('--');
|
||||
return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
|
||||
};
|
9
node_modules/@babel/highlight/node_modules/has-flag/license
generated
vendored
9
node_modules/@babel/highlight/node_modules/has-flag/license
generated
vendored
@ -1,9 +0,0 @@
|
||||
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.
|
44
node_modules/@babel/highlight/node_modules/has-flag/package.json
generated
vendored
44
node_modules/@babel/highlight/node_modules/has-flag/package.json
generated
vendored
@ -1,44 +0,0 @@
|
||||
{
|
||||
"name": "has-flag",
|
||||
"version": "3.0.0",
|
||||
"description": "Check if argv has a specific flag",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/has-flag",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"has",
|
||||
"check",
|
||||
"detect",
|
||||
"contains",
|
||||
"find",
|
||||
"flag",
|
||||
"cli",
|
||||
"command-line",
|
||||
"argv",
|
||||
"process",
|
||||
"arg",
|
||||
"args",
|
||||
"argument",
|
||||
"arguments",
|
||||
"getopt",
|
||||
"minimist",
|
||||
"optimist"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
}
|
||||
}
|
70
node_modules/@babel/highlight/node_modules/has-flag/readme.md
generated
vendored
70
node_modules/@babel/highlight/node_modules/has-flag/readme.md
generated
vendored
@ -1,70 +0,0 @@
|
||||
# has-flag [![Build Status](https://travis-ci.org/sindresorhus/has-flag.svg?branch=master)](https://travis-ci.org/sindresorhus/has-flag)
|
||||
|
||||
> Check if [`argv`](https://nodejs.org/docs/latest/api/process.html#process_process_argv) has a specific flag
|
||||
|
||||
Correctly stops looking after an `--` argument terminator.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install has-flag
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
// foo.js
|
||||
const hasFlag = require('has-flag');
|
||||
|
||||
hasFlag('unicorn');
|
||||
//=> true
|
||||
|
||||
hasFlag('--unicorn');
|
||||
//=> true
|
||||
|
||||
hasFlag('f');
|
||||
//=> true
|
||||
|
||||
hasFlag('-f');
|
||||
//=> true
|
||||
|
||||
hasFlag('foo=bar');
|
||||
//=> true
|
||||
|
||||
hasFlag('foo');
|
||||
//=> false
|
||||
|
||||
hasFlag('rainbow');
|
||||
//=> false
|
||||
```
|
||||
|
||||
```
|
||||
$ node foo.js -f --unicorn --foo=bar -- --rainbow
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### hasFlag(flag, [argv])
|
||||
|
||||
Returns a boolean for whether the flag exists.
|
||||
|
||||
#### flag
|
||||
|
||||
Type: `string`
|
||||
|
||||
CLI flag to look for. The `--` prefix is optional.
|
||||
|
||||
#### argv
|
||||
|
||||
Type: `string[]`<br>
|
||||
Default: `process.argv`
|
||||
|
||||
CLI arguments.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
5
node_modules/@babel/highlight/node_modules/supports-color/browser.js
generated
vendored
5
node_modules/@babel/highlight/node_modules/supports-color/browser.js
generated
vendored
@ -1,5 +0,0 @@
|
||||
'use strict';
|
||||
module.exports = {
|
||||
stdout: false,
|
||||
stderr: false
|
||||
};
|
131
node_modules/@babel/highlight/node_modules/supports-color/index.js
generated
vendored
131
node_modules/@babel/highlight/node_modules/supports-color/index.js
generated
vendored
@ -1,131 +0,0 @@
|
||||
'use strict';
|
||||
const os = require('os');
|
||||
const hasFlag = require('has-flag');
|
||||
|
||||
const env = process.env;
|
||||
|
||||
let forceColor;
|
||||
if (hasFlag('no-color') ||
|
||||
hasFlag('no-colors') ||
|
||||
hasFlag('color=false')) {
|
||||
forceColor = false;
|
||||
} else if (hasFlag('color') ||
|
||||
hasFlag('colors') ||
|
||||
hasFlag('color=true') ||
|
||||
hasFlag('color=always')) {
|
||||
forceColor = true;
|
||||
}
|
||||
if ('FORCE_COLOR' in env) {
|
||||
forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
|
||||
}
|
||||
|
||||
function translateLevel(level) {
|
||||
if (level === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return {
|
||||
level,
|
||||
hasBasic: true,
|
||||
has256: level >= 2,
|
||||
has16m: level >= 3
|
||||
};
|
||||
}
|
||||
|
||||
function supportsColor(stream) {
|
||||
if (forceColor === false) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (hasFlag('color=16m') ||
|
||||
hasFlag('color=full') ||
|
||||
hasFlag('color=truecolor')) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
if (hasFlag('color=256')) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (stream && !stream.isTTY && forceColor !== true) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const min = forceColor ? 1 : 0;
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
// Node.js 7.5.0 is the first version of Node.js to include a patch to
|
||||
// libuv that enables 256 color output on Windows. Anything earlier and it
|
||||
// won't work. However, here we target Node.js 8 at minimum as it is an LTS
|
||||
// release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows
|
||||
// release that supports 256 colors. Windows 10 build 14931 is the first release
|
||||
// that supports 16m/TrueColor.
|
||||
const osRelease = os.release().split('.');
|
||||
if (
|
||||
Number(process.versions.node.split('.')[0]) >= 8 &&
|
||||
Number(osRelease[0]) >= 10 &&
|
||||
Number(osRelease[2]) >= 10586
|
||||
) {
|
||||
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ('CI' in env) {
|
||||
if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return min;
|
||||
}
|
||||
|
||||
if ('TEAMCITY_VERSION' in env) {
|
||||
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
||||
}
|
||||
|
||||
if (env.COLORTERM === 'truecolor') {
|
||||
return 3;
|
||||
}
|
||||
|
||||
if ('TERM_PROGRAM' in env) {
|
||||
const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
||||
|
||||
switch (env.TERM_PROGRAM) {
|
||||
case 'iTerm.app':
|
||||
return version >= 3 ? 3 : 2;
|
||||
case 'Apple_Terminal':
|
||||
return 2;
|
||||
// No default
|
||||
}
|
||||
}
|
||||
|
||||
if (/-256(color)?$/i.test(env.TERM)) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ('COLORTERM' in env) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (env.TERM === 'dumb') {
|
||||
return min;
|
||||
}
|
||||
|
||||
return min;
|
||||
}
|
||||
|
||||
function getSupportLevel(stream) {
|
||||
const level = supportsColor(stream);
|
||||
return translateLevel(level);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
supportsColor: getSupportLevel,
|
||||
stdout: getSupportLevel(process.stdout),
|
||||
stderr: getSupportLevel(process.stderr)
|
||||
};
|
9
node_modules/@babel/highlight/node_modules/supports-color/license
generated
vendored
9
node_modules/@babel/highlight/node_modules/supports-color/license
generated
vendored
@ -1,9 +0,0 @@
|
||||
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.
|
53
node_modules/@babel/highlight/node_modules/supports-color/package.json
generated
vendored
53
node_modules/@babel/highlight/node_modules/supports-color/package.json
generated
vendored
@ -1,53 +0,0 @@
|
||||
{
|
||||
"name": "supports-color",
|
||||
"version": "5.5.0",
|
||||
"description": "Detect whether a terminal supports color",
|
||||
"license": "MIT",
|
||||
"repository": "chalk/supports-color",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"browser.js"
|
||||
],
|
||||
"keywords": [
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"ansi",
|
||||
"styles",
|
||||
"tty",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"command-line",
|
||||
"support",
|
||||
"supports",
|
||||
"capability",
|
||||
"detect",
|
||||
"truecolor",
|
||||
"16m"
|
||||
],
|
||||
"dependencies": {
|
||||
"has-flag": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^0.25.0",
|
||||
"import-fresh": "^2.0.0",
|
||||
"xo": "^0.20.0"
|
||||
},
|
||||
"browser": "browser.js"
|
||||
}
|
66
node_modules/@babel/highlight/node_modules/supports-color/readme.md
generated
vendored
66
node_modules/@babel/highlight/node_modules/supports-color/readme.md
generated
vendored
@ -1,66 +0,0 @@
|
||||
# supports-color [![Build Status](https://travis-ci.org/chalk/supports-color.svg?branch=master)](https://travis-ci.org/chalk/supports-color)
|
||||
|
||||
> Detect whether a terminal supports color
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install supports-color
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const supportsColor = require('supports-color');
|
||||
|
||||
if (supportsColor.stdout) {
|
||||
console.log('Terminal stdout supports color');
|
||||
}
|
||||
|
||||
if (supportsColor.stdout.has256) {
|
||||
console.log('Terminal stdout supports 256 colors');
|
||||
}
|
||||
|
||||
if (supportsColor.stderr.has16m) {
|
||||
console.log('Terminal stderr supports 16 million colors (truecolor)');
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
Returns an `Object` with a `stdout` and `stderr` property for testing either streams. Each property is an `Object`, or `false` if color is not supported.
|
||||
|
||||
The `stdout`/`stderr` objects specifies a level of support for color through a `.level` property and a corresponding flag:
|
||||
|
||||
- `.level = 1` and `.hasBasic = true`: Basic color support (16 colors)
|
||||
- `.level = 2` and `.has256 = true`: 256 color support
|
||||
- `.level = 3` and `.has16m = true`: Truecolor support (16 million colors)
|
||||
|
||||
|
||||
## Info
|
||||
|
||||
It obeys the `--color` and `--no-color` CLI flags.
|
||||
|
||||
Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, add the environment variable `FORCE_COLOR=1` to forcefully enable color or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks.
|
||||
|
||||
Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [supports-color-cli](https://github.com/chalk/supports-color-cli) - CLI for this module
|
||||
- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right
|
||||
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Josh Junon](https://github.com/qix-)
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
30
node_modules/@babel/highlight/package.json
generated
vendored
30
node_modules/@babel/highlight/package.json
generated
vendored
@ -1,30 +0,0 @@
|
||||
{
|
||||
"name": "@babel/highlight",
|
||||
"version": "7.18.6",
|
||||
"description": "Syntax highlight JavaScript strings for output in terminals.",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"homepage": "https://babel.dev/docs/en/next/babel-highlight",
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-highlight"
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/helper-validator-identifier": "^7.18.6",
|
||||
"chalk": "^2.0.0",
|
||||
"js-tokens": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/chalk": "^2.0.0",
|
||||
"strip-ansi": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
},
|
||||
"type": "commonjs"
|
||||
}
|
21
node_modules/@jest/types/LICENSE
generated
vendored
21
node_modules/@jest/types/LICENSE
generated
vendored
@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Facebook, Inc. and its affiliates.
|
||||
|
||||
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.
|
1
node_modules/@jest/types/build/Circus.js
generated
vendored
1
node_modules/@jest/types/build/Circus.js
generated
vendored
@ -1 +0,0 @@
|
||||
'use strict';
|
1
node_modules/@jest/types/build/Config.js
generated
vendored
1
node_modules/@jest/types/build/Config.js
generated
vendored
@ -1 +0,0 @@
|
||||
'use strict';
|
1
node_modules/@jest/types/build/Global.js
generated
vendored
1
node_modules/@jest/types/build/Global.js
generated
vendored
@ -1 +0,0 @@
|
||||
'use strict';
|
1
node_modules/@jest/types/build/TestResult.js
generated
vendored
1
node_modules/@jest/types/build/TestResult.js
generated
vendored
@ -1 +0,0 @@
|
||||
'use strict';
|
1
node_modules/@jest/types/build/Transform.js
generated
vendored
1
node_modules/@jest/types/build/Transform.js
generated
vendored
@ -1 +0,0 @@
|
||||
'use strict';
|
1169
node_modules/@jest/types/build/index.d.ts
generated
vendored
1169
node_modules/@jest/types/build/index.d.ts
generated
vendored
File diff suppressed because it is too large
Load Diff
1
node_modules/@jest/types/build/index.js
generated
vendored
1
node_modules/@jest/types/build/index.js
generated
vendored
@ -1 +0,0 @@
|
||||
'use strict';
|
38
node_modules/@jest/types/package.json
generated
vendored
38
node_modules/@jest/types/package.json
generated
vendored
@ -1,38 +0,0 @@
|
||||
{
|
||||
"name": "@jest/types",
|
||||
"version": "29.3.1",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/facebook/jest.git",
|
||||
"directory": "packages/jest-types"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "./build/index.js",
|
||||
"types": "./build/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./build/index.d.ts",
|
||||
"default": "./build/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@jest/schemas": "^29.0.0",
|
||||
"@types/istanbul-lib-coverage": "^2.0.0",
|
||||
"@types/istanbul-reports": "^3.0.0",
|
||||
"@types/node": "*",
|
||||
"@types/yargs": "^17.0.8",
|
||||
"chalk": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tsd/typescript": "~4.8.2",
|
||||
"tsd-lite": "^0.6.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "05deb8393c4ad71e19be2567b704dfd3a2ab5fc9"
|
||||
}
|
21
node_modules/@types/istanbul-lib-coverage/LICENSE
generated
vendored
21
node_modules/@types/istanbul-lib-coverage/LICENSE
generated
vendored
@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
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
|
16
node_modules/@types/istanbul-lib-coverage/README.md
generated
vendored
16
node_modules/@types/istanbul-lib-coverage/README.md
generated
vendored
@ -1,16 +0,0 @@
|
||||
# Installation
|
||||
> `npm install --save @types/istanbul-lib-coverage`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for istanbul-lib-coverage (https://istanbul.js.org).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/istanbul-lib-coverage.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Thu, 23 Dec 2021 23:34:53 GMT
|
||||
* Dependencies: none
|
||||
* Global values: none
|
||||
|
||||
# Credits
|
||||
These definitions were written by [Jason Cheatham](https://github.com/jason0x43).
|
117
node_modules/@types/istanbul-lib-coverage/index.d.ts
generated
vendored
117
node_modules/@types/istanbul-lib-coverage/index.d.ts
generated
vendored
@ -1,117 +0,0 @@
|
||||
// Type definitions for istanbul-lib-coverage 2.0
|
||||
// Project: https://istanbul.js.org, https://github.com/istanbuljs/istanbuljs
|
||||
// Definitions by: Jason Cheatham <https://github.com/jason0x43>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
export interface CoverageSummaryData {
|
||||
lines: Totals;
|
||||
statements: Totals;
|
||||
branches: Totals;
|
||||
functions: Totals;
|
||||
}
|
||||
|
||||
export class CoverageSummary {
|
||||
constructor(data: CoverageSummary | CoverageSummaryData);
|
||||
merge(obj: CoverageSummary): CoverageSummary;
|
||||
toJSON(): CoverageSummaryData;
|
||||
isEmpty(): boolean;
|
||||
data: CoverageSummaryData;
|
||||
lines: Totals;
|
||||
statements: Totals;
|
||||
branches: Totals;
|
||||
functions: Totals;
|
||||
}
|
||||
|
||||
export interface CoverageMapData {
|
||||
[key: string]: FileCoverage | FileCoverageData;
|
||||
}
|
||||
|
||||
export class CoverageMap {
|
||||
constructor(data: CoverageMapData | CoverageMap);
|
||||
addFileCoverage(pathOrObject: string | FileCoverage | FileCoverageData): void;
|
||||
files(): string[];
|
||||
fileCoverageFor(filename: string): FileCoverage;
|
||||
filter(callback: (key: string) => boolean): void;
|
||||
getCoverageSummary(): CoverageSummary;
|
||||
merge(data: CoverageMapData | CoverageMap): void;
|
||||
toJSON(): CoverageMapData;
|
||||
data: CoverageMapData;
|
||||
}
|
||||
|
||||
export interface Location {
|
||||
line: number;
|
||||
column: number;
|
||||
}
|
||||
|
||||
export interface Range {
|
||||
start: Location;
|
||||
end: Location;
|
||||
}
|
||||
|
||||
export interface BranchMapping {
|
||||
loc: Range;
|
||||
type: string;
|
||||
locations: Range[];
|
||||
line: number;
|
||||
}
|
||||
|
||||
export interface FunctionMapping {
|
||||
name: string;
|
||||
decl: Range;
|
||||
loc: Range;
|
||||
line: number;
|
||||
}
|
||||
|
||||
export interface FileCoverageData {
|
||||
path: string;
|
||||
statementMap: { [key: string]: Range };
|
||||
fnMap: { [key: string]: FunctionMapping };
|
||||
branchMap: { [key: string]: BranchMapping };
|
||||
s: { [key: string]: number };
|
||||
f: { [key: string]: number };
|
||||
b: { [key: string]: number[] };
|
||||
}
|
||||
|
||||
export interface Totals {
|
||||
total: number;
|
||||
covered: number;
|
||||
skipped: number;
|
||||
pct: number;
|
||||
}
|
||||
|
||||
export interface Coverage {
|
||||
covered: number;
|
||||
total: number;
|
||||
coverage: number;
|
||||
}
|
||||
|
||||
export class FileCoverage implements FileCoverageData {
|
||||
constructor(data: string | FileCoverage | FileCoverageData);
|
||||
merge(other: FileCoverageData): void;
|
||||
getBranchCoverageByLine(): { [line: number]: Coverage };
|
||||
getLineCoverage(): { [line: number]: number };
|
||||
getUncoveredLines(): number[];
|
||||
resetHits(): void;
|
||||
computeBranchTotals(): Totals;
|
||||
computeSimpleTotals(): Totals;
|
||||
toSummary(): CoverageSummary;
|
||||
toJSON(): object;
|
||||
|
||||
data: FileCoverageData;
|
||||
path: string;
|
||||
statementMap: { [key: string]: Range };
|
||||
fnMap: { [key: string]: FunctionMapping };
|
||||
branchMap: { [key: string]: BranchMapping };
|
||||
s: { [key: string]: number };
|
||||
f: { [key: string]: number };
|
||||
b: { [key: string]: number[] };
|
||||
}
|
||||
|
||||
export const classes: {
|
||||
FileCoverage: FileCoverage;
|
||||
};
|
||||
|
||||
export function createCoverageMap(data?: CoverageMap | CoverageMapData): CoverageMap;
|
||||
export function createCoverageSummary(obj?: CoverageSummary | CoverageSummaryData): CoverageSummary;
|
||||
export function createFileCoverage(pathOrObject: string | FileCoverage | FileCoverageData): FileCoverage;
|
25
node_modules/@types/istanbul-lib-coverage/package.json
generated
vendored
25
node_modules/@types/istanbul-lib-coverage/package.json
generated
vendored
@ -1,25 +0,0 @@
|
||||
{
|
||||
"name": "@types/istanbul-lib-coverage",
|
||||
"version": "2.0.4",
|
||||
"description": "TypeScript definitions for istanbul-lib-coverage",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/istanbul-lib-coverage",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Jason Cheatham",
|
||||
"url": "https://github.com/jason0x43",
|
||||
"githubUsername": "jason0x43"
|
||||
}
|
||||
],
|
||||
"main": "",
|
||||
"types": "index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/istanbul-lib-coverage"
|
||||
},
|
||||
"scripts": {},
|
||||
"dependencies": {},
|
||||
"typesPublisherContentHash": "4df627cf114fc2a3196e0bde6df85bc30eb84e778319bcc5dcfdf962ee9fe093",
|
||||
"typeScriptVersion": "3.8"
|
||||
}
|
21
node_modules/@types/istanbul-lib-report/LICENSE
generated
vendored
21
node_modules/@types/istanbul-lib-report/LICENSE
generated
vendored
@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
||||
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
|
16
node_modules/@types/istanbul-lib-report/README.md
generated
vendored
16
node_modules/@types/istanbul-lib-report/README.md
generated
vendored
@ -1,16 +0,0 @@
|
||||
# Installation
|
||||
> `npm install --save @types/istanbul-lib-report`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for istanbul-lib-report (https://istanbul.js.org).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/istanbul-lib-report.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Tue, 21 Jan 2020 01:00:06 GMT
|
||||
* Dependencies: [@types/istanbul-lib-coverage](https://npmjs.com/package/@types/istanbul-lib-coverage)
|
||||
* Global values: none
|
||||
|
||||
# Credits
|
||||
These definitions were written by Jason Cheatham (https://github.com/jason0x43), and Zacharias Björngren (https://github.com/zache).
|
191
node_modules/@types/istanbul-lib-report/index.d.ts
generated
vendored
191
node_modules/@types/istanbul-lib-report/index.d.ts
generated
vendored
@ -1,191 +0,0 @@
|
||||
// Type definitions for istanbul-lib-report 3.0
|
||||
// Project: https://istanbul.js.org, https://github.com/istanbuljs/istanbuljs
|
||||
// Definitions by: Jason Cheatham <https://github.com/jason0x43>
|
||||
// Zacharias Björngren <https://github.com/zache>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
import { CoverageMap, FileCoverage, CoverageSummary } from 'istanbul-lib-coverage';
|
||||
|
||||
/**
|
||||
* returns a reporting context for the supplied options
|
||||
*/
|
||||
export function createContext(options?: Partial<ContextOptions>): Context;
|
||||
/**
|
||||
* returns the default watermarks that would be used when not
|
||||
* overridden
|
||||
*/
|
||||
export function getDefaultWatermarks(): Watermarks;
|
||||
export class ReportBase {
|
||||
constructor(options?: Partial<ReportBaseOptions>);
|
||||
execute(context: Context): void;
|
||||
}
|
||||
|
||||
export interface ReportBaseOptions {
|
||||
summarizer: Summarizers;
|
||||
}
|
||||
|
||||
export type Summarizers = 'flat' | 'nested' | 'pkg' | 'defaultSummarizer';
|
||||
|
||||
export interface ContextOptions {
|
||||
coverageMap: CoverageMap;
|
||||
defaultSummarizer: Summarizers;
|
||||
dir: string;
|
||||
watermarks: Partial<Watermarks>;
|
||||
sourceFinder(filepath: string): string;
|
||||
}
|
||||
|
||||
export interface Context {
|
||||
data: any;
|
||||
dir: string;
|
||||
sourceFinder(filepath: string): string;
|
||||
watermarks: Watermarks;
|
||||
writer: FileWriter;
|
||||
/**
|
||||
* returns the coverage class given a coverage
|
||||
* types and a percentage value.
|
||||
*/
|
||||
classForPercent(type: keyof Watermarks, value: number): string;
|
||||
/**
|
||||
* returns the source code for the specified file path or throws if
|
||||
* the source could not be found.
|
||||
*/
|
||||
getSource(filepath: string): string;
|
||||
getTree(summarizer?: Summarizers): Tree;
|
||||
/**
|
||||
* returns a full visitor given a partial one.
|
||||
*/
|
||||
getVisitor<N extends Node = Node>(visitor: Partial<Visitor<N>>): Visitor<N>;
|
||||
/**
|
||||
* returns a FileWriter implementation for reporting use. Also available
|
||||
* as the `writer` property on the context.
|
||||
*/
|
||||
getWriter(): FileWriter;
|
||||
/**
|
||||
* returns an XML writer for the supplied content writer
|
||||
*/
|
||||
getXmlWriter(contentWriter: ContentWriter): XmlWriter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Base class for writing content
|
||||
*/
|
||||
export 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.
|
||||
*/
|
||||
colorize(str: string, clazz?: string): string;
|
||||
/**
|
||||
* writes a string appended with a newline to the destination
|
||||
*/
|
||||
println(str: string): void;
|
||||
/**
|
||||
* closes this content writer. Should be called after all writes are complete.
|
||||
*/
|
||||
close(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* a content writer that writes to a file
|
||||
*/
|
||||
export class FileContentWriter extends ContentWriter {
|
||||
constructor(fileDescriptor: number);
|
||||
write(str: string): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* a content writer that writes to the console
|
||||
*/
|
||||
export class ConsoleWriter extends ContentWriter {
|
||||
write(str: string): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* utility for writing files under a specific directory
|
||||
*/
|
||||
export class FileWriter {
|
||||
constructor(baseDir: string);
|
||||
static startCapture(): void;
|
||||
static stopCapture(): void;
|
||||
static getOutput(): string;
|
||||
static resetOutput(): void;
|
||||
/**
|
||||
* returns a FileWriter that is rooted at the supplied subdirectory
|
||||
*/
|
||||
writeForDir(subdir: string): FileWriter;
|
||||
/**
|
||||
* copies a file from a source directory to a destination name
|
||||
*/
|
||||
copyFile(source: string, dest: string, header?: string): void;
|
||||
/**
|
||||
* returns a content writer for writing content to the supplied file.
|
||||
*/
|
||||
writeFile(file: string | null): ContentWriter;
|
||||
}
|
||||
|
||||
export interface XmlWriter {
|
||||
indent(str: string): string;
|
||||
/**
|
||||
* writes the opening XML tag with the supplied attributes
|
||||
*/
|
||||
openTag(name: string, attrs?: any): void;
|
||||
/**
|
||||
* closes an open XML tag.
|
||||
*/
|
||||
closeTag(name: string): void;
|
||||
/**
|
||||
* writes a tag and its value opening and closing it at the same time
|
||||
*/
|
||||
inlineTag(name: string, attrs?: any, content?: string): void;
|
||||
/**
|
||||
* closes all open tags and ends the document
|
||||
*/
|
||||
closeAll(): void;
|
||||
}
|
||||
|
||||
export type Watermark = [number, number];
|
||||
|
||||
export interface Watermarks {
|
||||
statements: Watermark;
|
||||
functions: Watermark;
|
||||
branches: Watermark;
|
||||
lines: Watermark;
|
||||
}
|
||||
|
||||
export interface Node {
|
||||
isRoot(): boolean;
|
||||
visit(visitor: Visitor, state: any): void;
|
||||
}
|
||||
|
||||
export interface ReportNode extends Node {
|
||||
path: string;
|
||||
parent: ReportNode | null;
|
||||
fileCoverage: FileCoverage;
|
||||
children: ReportNode[];
|
||||
addChild(child: ReportNode): void;
|
||||
asRelative(p: string): string;
|
||||
getQualifiedName(): string;
|
||||
getRelativeName(): string;
|
||||
getParent(): Node;
|
||||
getChildren(): Node[];
|
||||
isSummary(): boolean;
|
||||
getFileCoverage(): FileCoverage;
|
||||
getCoverageSummary(filesOnly: boolean): CoverageSummary;
|
||||
visit(visitor: Visitor<ReportNode>, state: any): void;
|
||||
}
|
||||
|
||||
export interface Visitor<N extends Node = Node> {
|
||||
onStart(root: N, state: any): void;
|
||||
onSummary(root: N, state: any): void;
|
||||
onDetail(root: N, state: any): void;
|
||||
onSummaryEnd(root: N, state: any): void;
|
||||
onEnd(root: N, state: any): void;
|
||||
}
|
||||
|
||||
export interface Tree<N extends Node = Node> {
|
||||
getRoot(): N;
|
||||
visit(visitor: Partial<Visitor<N>>, state: any): void;
|
||||
}
|
31
node_modules/@types/istanbul-lib-report/package.json
generated
vendored
31
node_modules/@types/istanbul-lib-report/package.json
generated
vendored
@ -1,31 +0,0 @@
|
||||
{
|
||||
"name": "@types/istanbul-lib-report",
|
||||
"version": "3.0.0",
|
||||
"description": "TypeScript definitions for istanbul-lib-report",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Jason Cheatham",
|
||||
"url": "https://github.com/jason0x43",
|
||||
"githubUsername": "jason0x43"
|
||||
},
|
||||
{
|
||||
"name": "Zacharias Björngren",
|
||||
"url": "https://github.com/zache",
|
||||
"githubUsername": "zache"
|
||||
}
|
||||
],
|
||||
"main": "",
|
||||
"types": "index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/istanbul-lib-report"
|
||||
},
|
||||
"scripts": {},
|
||||
"dependencies": {
|
||||
"@types/istanbul-lib-coverage": "*"
|
||||
},
|
||||
"typesPublisherContentHash": "f8b2f5e15a24d9f52a96c5cfadb0f582bf6200ce8643e15422c3c8f1a2bb1c63",
|
||||
"typeScriptVersion": "2.8"
|
||||
}
|
21
node_modules/@types/istanbul-reports/LICENSE
generated
vendored
21
node_modules/@types/istanbul-reports/LICENSE
generated
vendored
@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE
|
94
node_modules/@types/istanbul-reports/README.md
generated
vendored
94
node_modules/@types/istanbul-reports/README.md
generated
vendored
@ -1,94 +0,0 @@
|
||||
# Installation
|
||||
> `npm install --save @types/istanbul-reports`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for istanbul-reports (https://github.com/istanbuljs/istanbuljs).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/istanbul-reports.
|
||||
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/istanbul-reports/index.d.ts)
|
||||
````ts
|
||||
// Type definitions for istanbul-reports 3.0
|
||||
// Project: https://github.com/istanbuljs/istanbuljs, https://istanbul.js.org
|
||||
// Definitions by: Jason Cheatham <https://github.com/jason0x43>
|
||||
// Elena Shcherbakova <https://github.com/not-a-doctor>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
import { Node, ReportBase } from 'istanbul-lib-report';
|
||||
|
||||
export function create<T extends keyof ReportOptions>(name: T, options?: Partial<ReportOptions[T]>): ReportBase;
|
||||
|
||||
export interface FileOptions {
|
||||
file: string;
|
||||
}
|
||||
|
||||
export interface ProjectOptions {
|
||||
projectRoot: string;
|
||||
}
|
||||
|
||||
export interface ReportOptions {
|
||||
clover: CloverOptions;
|
||||
cobertura: CoberturaOptions;
|
||||
'html-spa': HtmlSpaOptions;
|
||||
html: HtmlOptions;
|
||||
json: JsonOptions;
|
||||
'json-summary': JsonSummaryOptions;
|
||||
lcov: LcovOptions;
|
||||
lcovonly: LcovOnlyOptions;
|
||||
none: never;
|
||||
teamcity: TeamcityOptions;
|
||||
text: TextOptions;
|
||||
'text-lcov': TextLcovOptions;
|
||||
'text-summary': TextSummaryOptions;
|
||||
}
|
||||
|
||||
export type ReportType = keyof ReportOptions;
|
||||
|
||||
export interface CloverOptions extends FileOptions, ProjectOptions {}
|
||||
|
||||
export interface CoberturaOptions extends FileOptions, ProjectOptions {}
|
||||
|
||||
export interface HtmlSpaOptions extends HtmlOptions {
|
||||
metricsToShow: Array<'lines' | 'branches' | 'functions' | 'statements'>;
|
||||
}
|
||||
export interface HtmlOptions {
|
||||
verbose: boolean;
|
||||
skipEmpty: boolean;
|
||||
subdir: string;
|
||||
linkMapper: LinkMapper;
|
||||
}
|
||||
|
||||
export type JsonOptions = FileOptions;
|
||||
export type JsonSummaryOptions = FileOptions;
|
||||
|
||||
export interface LcovOptions extends FileOptions, ProjectOptions {}
|
||||
export interface LcovOnlyOptions extends FileOptions, ProjectOptions {}
|
||||
|
||||
export interface TeamcityOptions extends FileOptions {
|
||||
blockName: string;
|
||||
}
|
||||
|
||||
export interface TextOptions extends FileOptions {
|
||||
maxCols: number;
|
||||
skipEmpty: boolean;
|
||||
skipFull: boolean;
|
||||
}
|
||||
export type TextLcovOptions = ProjectOptions;
|
||||
export type TextSummaryOptions = FileOptions;
|
||||
|
||||
export interface LinkMapper {
|
||||
getPath(node: string | Node): string;
|
||||
relativePath(source: string | Node, target: string | Node): string;
|
||||
assetPath(node: Node, name: string): string;
|
||||
}
|
||||
|
||||
````
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Tue, 01 Jun 2021 21:02:19 GMT
|
||||
* Dependencies: [@types/istanbul-lib-report](https://npmjs.com/package/@types/istanbul-lib-report)
|
||||
* Global values: none
|
||||
|
||||
# Credits
|
||||
These definitions were written by [Jason Cheatham](https://github.com/jason0x43), and [Elena Shcherbakova](https://github.com/not-a-doctor).
|
74
node_modules/@types/istanbul-reports/index.d.ts
generated
vendored
74
node_modules/@types/istanbul-reports/index.d.ts
generated
vendored
@ -1,74 +0,0 @@
|
||||
// Type definitions for istanbul-reports 3.0
|
||||
// Project: https://github.com/istanbuljs/istanbuljs, https://istanbul.js.org
|
||||
// Definitions by: Jason Cheatham <https://github.com/jason0x43>
|
||||
// Elena Shcherbakova <https://github.com/not-a-doctor>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
import { Node, ReportBase } from 'istanbul-lib-report';
|
||||
|
||||
export function create<T extends keyof ReportOptions>(name: T, options?: Partial<ReportOptions[T]>): ReportBase;
|
||||
|
||||
export interface FileOptions {
|
||||
file: string;
|
||||
}
|
||||
|
||||
export interface ProjectOptions {
|
||||
projectRoot: string;
|
||||
}
|
||||
|
||||
export interface ReportOptions {
|
||||
clover: CloverOptions;
|
||||
cobertura: CoberturaOptions;
|
||||
'html-spa': HtmlSpaOptions;
|
||||
html: HtmlOptions;
|
||||
json: JsonOptions;
|
||||
'json-summary': JsonSummaryOptions;
|
||||
lcov: LcovOptions;
|
||||
lcovonly: LcovOnlyOptions;
|
||||
none: never;
|
||||
teamcity: TeamcityOptions;
|
||||
text: TextOptions;
|
||||
'text-lcov': TextLcovOptions;
|
||||
'text-summary': TextSummaryOptions;
|
||||
}
|
||||
|
||||
export type ReportType = keyof ReportOptions;
|
||||
|
||||
export interface CloverOptions extends FileOptions, ProjectOptions {}
|
||||
|
||||
export interface CoberturaOptions extends FileOptions, ProjectOptions {}
|
||||
|
||||
export interface HtmlSpaOptions extends HtmlOptions {
|
||||
metricsToShow: Array<'lines' | 'branches' | 'functions' | 'statements'>;
|
||||
}
|
||||
export interface HtmlOptions {
|
||||
verbose: boolean;
|
||||
skipEmpty: boolean;
|
||||
subdir: string;
|
||||
linkMapper: LinkMapper;
|
||||
}
|
||||
|
||||
export type JsonOptions = FileOptions;
|
||||
export type JsonSummaryOptions = FileOptions;
|
||||
|
||||
export interface LcovOptions extends FileOptions, ProjectOptions {}
|
||||
export interface LcovOnlyOptions extends FileOptions, ProjectOptions {}
|
||||
|
||||
export interface TeamcityOptions extends FileOptions {
|
||||
blockName: string;
|
||||
}
|
||||
|
||||
export interface TextOptions extends FileOptions {
|
||||
maxCols: number;
|
||||
skipEmpty: boolean;
|
||||
skipFull: boolean;
|
||||
}
|
||||
export type TextLcovOptions = ProjectOptions;
|
||||
export type TextSummaryOptions = FileOptions;
|
||||
|
||||
export interface LinkMapper {
|
||||
getPath(node: string | Node): string;
|
||||
relativePath(source: string | Node, target: string | Node): string;
|
||||
assetPath(node: Node, name: string): string;
|
||||
}
|
32
node_modules/@types/istanbul-reports/package.json
generated
vendored
32
node_modules/@types/istanbul-reports/package.json
generated
vendored
@ -1,32 +0,0 @@
|
||||
{
|
||||
"name": "@types/istanbul-reports",
|
||||
"version": "3.0.1",
|
||||
"description": "TypeScript definitions for istanbul-reports",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/istanbul-reports",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Jason Cheatham",
|
||||
"url": "https://github.com/jason0x43",
|
||||
"githubUsername": "jason0x43"
|
||||
},
|
||||
{
|
||||
"name": "Elena Shcherbakova",
|
||||
"url": "https://github.com/not-a-doctor",
|
||||
"githubUsername": "not-a-doctor"
|
||||
}
|
||||
],
|
||||
"main": "",
|
||||
"types": "index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/istanbul-reports"
|
||||
},
|
||||
"scripts": {},
|
||||
"dependencies": {
|
||||
"@types/istanbul-lib-report": "*"
|
||||
},
|
||||
"typesPublisherContentHash": "b331eb26db90bca3bd6f1e18a10a4f37631f149624847439756763800996e143",
|
||||
"typeScriptVersion": "3.6"
|
||||
}
|
21
node_modules/@types/jest/LICENSE
generated
vendored
21
node_modules/@types/jest/LICENSE
generated
vendored
@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
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
|
17
node_modules/@types/jest/README.md
generated
vendored
17
node_modules/@types/jest/README.md
generated
vendored
@ -1,17 +0,0 @@
|
||||
# Installation
|
||||
> `npm install --save @types/jest`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for Jest (https://jestjs.io/).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jest.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Fri, 04 Nov 2022 15:02:54 GMT
|
||||
* Dependencies: [@types/expect](https://npmjs.com/package/@types/expect), [@types/pretty-format](https://npmjs.com/package/@types/pretty-format)
|
||||
* Global values: `afterAll`, `afterEach`, `beforeAll`, `beforeEach`, `describe`, `expect`, `fail`, `fdescribe`, `fit`, `it`, `jasmine`, `jest`, `pending`, `spyOn`, `test`, `xdescribe`, `xit`, `xtest`
|
||||
|
||||
# Credits
|
||||
These definitions were written by [Asana (https://asana.com)
|
||||
// Ivo Stratev](https://github.com/NoHomey), [jwbay](https://github.com/jwbay), [Alexey Svetliakov](https://github.com/asvetliakov), [Alex Jover Morales](https://github.com/alexjoverm), [Allan Lukwago](https://github.com/epicallan), [Ika](https://github.com/ikatyang), [Waseem Dahman](https://github.com/wsmd), [Jamie Mason](https://github.com/JamieMason), [Douglas Duteil](https://github.com/douglasduteil), [Ahn](https://github.com/ahnpnl), [Jeff Lau](https://github.com/UselessPickles), [Andrew Makarov](https://github.com/r3nya), [Martin Hochel](https://github.com/hotell), [Sebastian Sebald](https://github.com/sebald), [Andy](https://github.com/andys8), [Antoine Brault](https://github.com/antoinebrault), [Gregor Stamać](https://github.com/gstamac), [ExE Boss](https://github.com/ExE-Boss), [Alex Bolenok](https://github.com/quassnoi), [Mario Beltrán Alarcón](https://github.com/Belco90), [Tony Hallett](https://github.com/tonyhallett), [Jason Yu](https://github.com/ycmjason), [Pawel Fajfer](https://github.com/pawfa), [Alexandre Germain](https://github.com/gerkindev), [Adam Jones](https://github.com/domdomegg), and [Tom Mrazauskas](https://github.com/mrazauskas).
|
1674
node_modules/@types/jest/index.d.ts
generated
vendored
1674
node_modules/@types/jest/index.d.ts
generated
vendored
File diff suppressed because it is too large
Load Diff
159
node_modules/@types/jest/package.json
generated
vendored
159
node_modules/@types/jest/package.json
generated
vendored
@ -1,159 +0,0 @@
|
||||
{
|
||||
"name": "@types/jest",
|
||||
"version": "29.2.2",
|
||||
"description": "TypeScript definitions for Jest",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jest",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Asana (https://asana.com)\n// Ivo Stratev",
|
||||
"url": "https://github.com/NoHomey",
|
||||
"githubUsername": "NoHomey"
|
||||
},
|
||||
{
|
||||
"name": "jwbay",
|
||||
"url": "https://github.com/jwbay",
|
||||
"githubUsername": "jwbay"
|
||||
},
|
||||
{
|
||||
"name": "Alexey Svetliakov",
|
||||
"url": "https://github.com/asvetliakov",
|
||||
"githubUsername": "asvetliakov"
|
||||
},
|
||||
{
|
||||
"name": "Alex Jover Morales",
|
||||
"url": "https://github.com/alexjoverm",
|
||||
"githubUsername": "alexjoverm"
|
||||
},
|
||||
{
|
||||
"name": "Allan Lukwago",
|
||||
"url": "https://github.com/epicallan",
|
||||
"githubUsername": "epicallan"
|
||||
},
|
||||
{
|
||||
"name": "Ika",
|
||||
"url": "https://github.com/ikatyang",
|
||||
"githubUsername": "ikatyang"
|
||||
},
|
||||
{
|
||||
"name": "Waseem Dahman",
|
||||
"url": "https://github.com/wsmd",
|
||||
"githubUsername": "wsmd"
|
||||
},
|
||||
{
|
||||
"name": "Jamie Mason",
|
||||
"url": "https://github.com/JamieMason",
|
||||
"githubUsername": "JamieMason"
|
||||
},
|
||||
{
|
||||
"name": "Douglas Duteil",
|
||||
"url": "https://github.com/douglasduteil",
|
||||
"githubUsername": "douglasduteil"
|
||||
},
|
||||
{
|
||||
"name": "Ahn",
|
||||
"url": "https://github.com/ahnpnl",
|
||||
"githubUsername": "ahnpnl"
|
||||
},
|
||||
{
|
||||
"name": "Jeff Lau",
|
||||
"url": "https://github.com/UselessPickles",
|
||||
"githubUsername": "UselessPickles"
|
||||
},
|
||||
{
|
||||
"name": "Andrew Makarov",
|
||||
"url": "https://github.com/r3nya",
|
||||
"githubUsername": "r3nya"
|
||||
},
|
||||
{
|
||||
"name": "Martin Hochel",
|
||||
"url": "https://github.com/hotell",
|
||||
"githubUsername": "hotell"
|
||||
},
|
||||
{
|
||||
"name": "Sebastian Sebald",
|
||||
"url": "https://github.com/sebald",
|
||||
"githubUsername": "sebald"
|
||||
},
|
||||
{
|
||||
"name": "Andy",
|
||||
"url": "https://github.com/andys8",
|
||||
"githubUsername": "andys8"
|
||||
},
|
||||
{
|
||||
"name": "Antoine Brault",
|
||||
"url": "https://github.com/antoinebrault",
|
||||
"githubUsername": "antoinebrault"
|
||||
},
|
||||
{
|
||||
"name": "Gregor Stamać",
|
||||
"url": "https://github.com/gstamac",
|
||||
"githubUsername": "gstamac"
|
||||
},
|
||||
{
|
||||
"name": "ExE Boss",
|
||||
"url": "https://github.com/ExE-Boss",
|
||||
"githubUsername": "ExE-Boss"
|
||||
},
|
||||
{
|
||||
"name": "Alex Bolenok",
|
||||
"url": "https://github.com/quassnoi",
|
||||
"githubUsername": "quassnoi"
|
||||
},
|
||||
{
|
||||
"name": "Mario Beltrán Alarcón",
|
||||
"url": "https://github.com/Belco90",
|
||||
"githubUsername": "Belco90"
|
||||
},
|
||||
{
|
||||
"name": "Tony Hallett",
|
||||
"url": "https://github.com/tonyhallett",
|
||||
"githubUsername": "tonyhallett"
|
||||
},
|
||||
{
|
||||
"name": "Jason Yu",
|
||||
"url": "https://github.com/ycmjason",
|
||||
"githubUsername": "ycmjason"
|
||||
},
|
||||
{
|
||||
"name": "Pawel Fajfer",
|
||||
"url": "https://github.com/pawfa",
|
||||
"githubUsername": "pawfa"
|
||||
},
|
||||
{
|
||||
"name": "Alexandre Germain",
|
||||
"url": "https://github.com/gerkindev",
|
||||
"githubUsername": "gerkindev"
|
||||
},
|
||||
{
|
||||
"name": "Adam Jones",
|
||||
"url": "https://github.com/domdomegg",
|
||||
"githubUsername": "domdomegg"
|
||||
},
|
||||
{
|
||||
"name": "Tom Mrazauskas",
|
||||
"url": "https://github.com/mrazauskas",
|
||||
"githubUsername": "mrazauskas"
|
||||
}
|
||||
],
|
||||
"main": "",
|
||||
"types": "index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/jest"
|
||||
},
|
||||
"scripts": {},
|
||||
"dependencies": {
|
||||
"expect": "^29.0.0",
|
||||
"pretty-format": "^29.0.0"
|
||||
},
|
||||
"typesPublisherContentHash": "a2faad754af484962a802e573a72d2fc7b5a539f3ac0893abcd451805fbc4aef",
|
||||
"typeScriptVersion": "4.3",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./index.d.ts"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
}
|
||||
}
|
21
node_modules/@types/yargs-parser/LICENSE
generated
vendored
21
node_modules/@types/yargs-parser/LICENSE
generated
vendored
@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
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
|
16
node_modules/@types/yargs-parser/README.md
generated
vendored
16
node_modules/@types/yargs-parser/README.md
generated
vendored
@ -1,16 +0,0 @@
|
||||
# Installation
|
||||
> `npm install --save @types/yargs-parser`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for yargs-parser (https://github.com/yargs/yargs-parser#readme).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs-parser.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Wed, 02 Mar 2022 17:31:51 GMT
|
||||
* Dependencies: none
|
||||
* Global values: none
|
||||
|
||||
# Credits
|
||||
These definitions were written by [Miles Johnson](https://github.com/milesj).
|
118
node_modules/@types/yargs-parser/index.d.ts
generated
vendored
118
node_modules/@types/yargs-parser/index.d.ts
generated
vendored
@ -1,118 +0,0 @@
|
||||
// Type definitions for yargs-parser 21.0
|
||||
// Project: https://github.com/yargs/yargs-parser#readme
|
||||
// Definitions by: Miles Johnson <https://github.com/milesj>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
declare namespace yargsParser {
|
||||
interface Arguments {
|
||||
/** Non-option arguments */
|
||||
_: Array<string | number>;
|
||||
/** Arguments after the end-of-options flag `--` */
|
||||
'--'?: Array<string | number>;
|
||||
/** All remaining options */
|
||||
[argName: string]: any;
|
||||
}
|
||||
|
||||
interface DetailedArguments {
|
||||
/** An object representing the parsed value of `args` */
|
||||
argv: Arguments;
|
||||
/** Populated with an error object if an exception occurred during parsing. */
|
||||
error: Error | null;
|
||||
/** The inferred list of aliases built by combining lists in opts.alias. */
|
||||
aliases: { [alias: string]: string[] };
|
||||
/** Any new aliases added via camel-case expansion. */
|
||||
newAliases: { [alias: string]: boolean };
|
||||
/** The configuration loaded from the yargs stanza in package.json. */
|
||||
configuration: Configuration;
|
||||
}
|
||||
|
||||
interface Configuration {
|
||||
/** Should variables prefixed with --no be treated as negations? Default is `true` */
|
||||
'boolean-negation': boolean;
|
||||
/** Should hyphenated arguments be expanded into camel-case aliases? Default is `true` */
|
||||
'camel-case-expansion': boolean;
|
||||
/** Should arrays be combined when provided by both command line arguments and a configuration file. Default is `false` */
|
||||
'combine-arrays': boolean;
|
||||
/** Should keys that contain . be treated as objects? Default is `true` */
|
||||
'dot-notation': boolean;
|
||||
/** Should arguments be coerced into an array when duplicated. Default is `true` */
|
||||
'duplicate-arguments-array': boolean;
|
||||
/** Should array arguments be coerced into a single array when duplicated. Default is `true` */
|
||||
'flatten-duplicate-arrays': boolean;
|
||||
/** Should arrays consume more than one positional argument following their flag. Default is `true` */
|
||||
'greedy-arrays': boolean;
|
||||
/** Should nargs consume dash options as well as positional arguments. Default is `false` */
|
||||
'nargs-eats-options': boolean;
|
||||
/** Should parsing stop at the first text argument? This is similar to how e.g. ssh parses its command line. Default is `false` */
|
||||
'halt-at-non-option': boolean;
|
||||
/** The prefix to use for negated boolean variables. Default is `'no-'` */
|
||||
'negation-prefix': string;
|
||||
/** Should keys that look like numbers be treated as such? Default is `true` */
|
||||
'parse-numbers': boolean;
|
||||
/** Should positional keys that look like numbers be treated as such? Default is `true` */
|
||||
'parse-positional-numbers': boolean;
|
||||
/** Should unparsed flags be stored in -- or _. Default is `false` */
|
||||
'populate--': boolean;
|
||||
/** Should a placeholder be added for keys not set via the corresponding CLI argument? Default is `false` */
|
||||
'set-placeholder-key': boolean;
|
||||
/** Should a group of short-options be treated as boolean flags? Default is `true` */
|
||||
'short-option-groups': boolean;
|
||||
/** Should aliases be removed before returning results? Default is `false` */
|
||||
'strip-aliased': boolean;
|
||||
/** Should dashed keys be removed before returning results? This option has no effect if camel-case-expansion is disabled. Default is `false` */
|
||||
'strip-dashed': boolean;
|
||||
/** Should unknown options be treated like regular arguments? An unknown option is one that is not configured in opts. Default is `false` */
|
||||
'unknown-options-as-args': boolean;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
/** An object representing the set of aliases for a key: `{ alias: { foo: ['f']} }`. */
|
||||
alias?: { [key: string]: string | string[] } | undefined;
|
||||
/**
|
||||
* Indicate that keys should be parsed as an array: `{ array: ['foo', 'bar'] }`.
|
||||
* Indicate that keys should be parsed as an array and coerced to booleans / numbers:
|
||||
* { array: [ { key: 'foo', boolean: true }, {key: 'bar', number: true} ] }`.
|
||||
*/
|
||||
array?:
|
||||
| string[]
|
||||
| Array<{ key: string; boolean?: boolean | undefined; number?: boolean | undefined }>
|
||||
| undefined;
|
||||
/** Arguments should be parsed as booleans: `{ boolean: ['x', 'y'] }`. */
|
||||
boolean?: string[] | undefined;
|
||||
/** Indicate a key that represents a path to a configuration file (this file will be loaded and parsed). */
|
||||
config?: string | string[] | { [key: string]: boolean } | undefined;
|
||||
/** Provide configuration options to the yargs-parser. */
|
||||
configuration?: Partial<Configuration> | undefined;
|
||||
/**
|
||||
* Provide a custom synchronous function that returns a coerced value from the argument provided (or throws an error), e.g.
|
||||
* `{ coerce: { foo: function (arg) { return modifiedArg } } }`.
|
||||
*/
|
||||
coerce?: { [key: string]: (arg: any) => any } | undefined;
|
||||
/** Indicate a key that should be used as a counter, e.g., `-vvv = {v: 3}`. */
|
||||
count?: string[] | undefined;
|
||||
/** Provide default values for keys: `{ default: { x: 33, y: 'hello world!' } }`. */
|
||||
default?: { [key: string]: any } | undefined;
|
||||
/** Environment variables (`process.env`) with the prefix provided should be parsed. */
|
||||
envPrefix?: string | undefined;
|
||||
/** Specify that a key requires n arguments: `{ narg: {x: 2} }`. */
|
||||
narg?: { [key: string]: number } | undefined;
|
||||
/** `path.normalize()` will be applied to values set to this key. */
|
||||
normalize?: string[] | undefined;
|
||||
/** Keys should be treated as strings (even if they resemble a number `-x 33`). */
|
||||
string?: string[] | undefined;
|
||||
/** Keys should be treated as numbers. */
|
||||
number?: string[] | undefined;
|
||||
}
|
||||
|
||||
interface Parser {
|
||||
(argv: string | string[], opts?: Options): Arguments;
|
||||
detailed(argv: string | string[], opts?: Options): DetailedArguments;
|
||||
camelCase(str: string): string;
|
||||
decamelize(str: string, joinString?: string): string;
|
||||
looksLikeNumber(value: string | number | null | undefined): boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare var yargsParser: yargsParser.Parser;
|
||||
export = yargsParser;
|
25
node_modules/@types/yargs-parser/package.json
generated
vendored
25
node_modules/@types/yargs-parser/package.json
generated
vendored
@ -1,25 +0,0 @@
|
||||
{
|
||||
"name": "@types/yargs-parser",
|
||||
"version": "21.0.0",
|
||||
"description": "TypeScript definitions for yargs-parser",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs-parser",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Miles Johnson",
|
||||
"url": "https://github.com/milesj",
|
||||
"githubUsername": "milesj"
|
||||
}
|
||||
],
|
||||
"main": "",
|
||||
"types": "index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/yargs-parser"
|
||||
},
|
||||
"scripts": {},
|
||||
"dependencies": {},
|
||||
"typesPublisherContentHash": "d2b7dfcae0e606f2e97101ab9036dd1d69720cda94e57b265c5abb90d7778874",
|
||||
"typeScriptVersion": "3.9"
|
||||
}
|
21
node_modules/@types/yargs/LICENSE
generated
vendored
21
node_modules/@types/yargs/LICENSE
generated
vendored
@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
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
|
16
node_modules/@types/yargs/README.md
generated
vendored
16
node_modules/@types/yargs/README.md
generated
vendored
@ -1,16 +0,0 @@
|
||||
# Installation
|
||||
> `npm install --save @types/yargs`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for yargs (https://github.com/chevex/yargs).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Fri, 23 Sep 2022 23:33:10 GMT
|
||||
* Dependencies: [@types/yargs-parser](https://npmjs.com/package/@types/yargs-parser)
|
||||
* Global values: none
|
||||
|
||||
# Credits
|
||||
These definitions were written by [Martin Poelstra](https://github.com/poelstra), [Mizunashi Mana](https://github.com/mizunashi-mana), [Jeffery Grajkowski](https://github.com/pushplay), [Jimi (Dimitris) Charalampidis](https://github.com/JimiC), [Steffen Viken Valvåg](https://github.com/steffenvv), [Emily Marigold Klassen](https://github.com/forivall), [ExE Boss](https://github.com/ExE-Boss), [Aankhen](https://github.com/Aankhen), and [Ben Coe](https://github.com/bcoe).
|
906
node_modules/@types/yargs/index.d.ts
generated
vendored
906
node_modules/@types/yargs/index.d.ts
generated
vendored
@ -1,906 +0,0 @@
|
||||
// Type definitions for yargs 17.0
|
||||
// Project: https://github.com/chevex/yargs, https://yargs.js.org
|
||||
// Definitions by: Martin Poelstra <https://github.com/poelstra>
|
||||
// Mizunashi Mana <https://github.com/mizunashi-mana>
|
||||
// Jeffery Grajkowski <https://github.com/pushplay>
|
||||
// Jimi (Dimitris) Charalampidis <https://github.com/JimiC>
|
||||
// Steffen Viken Valvåg <https://github.com/steffenvv>
|
||||
// Emily Marigold Klassen <https://github.com/forivall>
|
||||
// ExE Boss <https://github.com/ExE-Boss>
|
||||
// Aankhen <https://github.com/Aankhen>
|
||||
// Ben Coe <https://github.com/bcoe>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// The following TSLint rules have been disabled:
|
||||
// unified-signatures: Because there is useful information in the argument names of the overloaded signatures
|
||||
|
||||
// Convention:
|
||||
// Use 'union types' when:
|
||||
// - parameter types have similar signature type (i.e. 'string | ReadonlyArray<string>')
|
||||
// - parameter names have the same semantic meaning (i.e. ['command', 'commands'] , ['key', 'keys'])
|
||||
// An example for not using 'union types' is the declaration of 'env' where `prefix` and `enable` parameters
|
||||
// have different semantics. On the other hand, in the declaration of 'usage', a `command: string` parameter
|
||||
// has the same semantic meaning with declaring an overload method by using `commands: ReadonlyArray<string>`,
|
||||
// thus it's preferred to use `command: string | ReadonlyArray<string>`
|
||||
// Use parameterless declaration instead of declaring all parameters optional,
|
||||
// when all parameters are optional and more than one
|
||||
|
||||
import { DetailedArguments, Configuration } from 'yargs-parser';
|
||||
|
||||
declare namespace yargs {
|
||||
type BuilderCallback<T, R> = ((args: Argv<T>) => PromiseLike<Argv<R>>) | ((args: Argv<T>) => Argv<R>) | ((args: Argv<T>) => void);
|
||||
|
||||
type ParserConfigurationOptions = Configuration & {
|
||||
/** Sort commands alphabetically. Default is `false` */
|
||||
'sort-commands': boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* The type parameter `T` is the expected shape of the parsed options.
|
||||
* `Arguments<T>` is those options plus `_` and `$0`, and an indexer falling
|
||||
* back to `unknown` for unknown options.
|
||||
*
|
||||
* For the return type / `argv` property, we create a mapped type over
|
||||
* `Arguments<T>` to simplify the inferred type signature in client code.
|
||||
*/
|
||||
interface Argv<T = {}> {
|
||||
(args?: ReadonlyArray<string> | string, cwd?: string): Argv<T>;
|
||||
|
||||
/**
|
||||
* Set key names as equivalent such that updates to a key will propagate to aliases and vice-versa.
|
||||
*
|
||||
* Optionally `.alias()` can take an object that maps keys to aliases.
|
||||
* Each key of this object should be the canonical version of the option, and each value should be a string or an array of strings.
|
||||
*/
|
||||
// Aliases for previously declared options can inherit the types of those options.
|
||||
alias<K1 extends keyof T, K2 extends string>(shortName: K1, longName: K2 | ReadonlyArray<K2>): Argv<T & { [key in K2]: T[K1] }>;
|
||||
alias<K1 extends keyof T, K2 extends string>(shortName: K2, longName: K1 | ReadonlyArray<K1>): Argv<T & { [key in K2]: T[K1] }>;
|
||||
alias(shortName: string | ReadonlyArray<string>, longName: string | ReadonlyArray<string>): Argv<T>;
|
||||
alias(aliases: { [shortName: string]: string | ReadonlyArray<string> }): Argv<T>;
|
||||
|
||||
/**
|
||||
* Get the arguments as a plain old object.
|
||||
*
|
||||
* Arguments without a corresponding flag show up in the `argv._` array.
|
||||
*
|
||||
* The script name or node command is available at `argv.$0` similarly to how `$0` works in bash or perl.
|
||||
*
|
||||
* If `yargs` is executed in an environment that embeds node and there's no script name (e.g. Electron or nw.js),
|
||||
* it will ignore the first parameter since it expects it to be the script name. In order to override
|
||||
* this behavior, use `.parse(process.argv.slice(1))` instead of .argv and the first parameter won't be ignored.
|
||||
*/
|
||||
argv: { [key in keyof Arguments<T> as key | CamelCaseKey<key>]: Arguments<T>[key] } | Promise<{ [key in keyof Arguments<T> as key | CamelCaseKey<key>]: Arguments<T>[key] }>;
|
||||
|
||||
/**
|
||||
* Tell the parser to interpret `key` as an array.
|
||||
* If `.array('foo')` is set, `--foo foo bar` will be parsed as `['foo', 'bar']` rather than as `'foo'`.
|
||||
* Also, if you use the option multiple times all the values will be flattened in one array so `--foo foo --foo bar` will be parsed as `['foo', 'bar']`
|
||||
*
|
||||
* When the option is used with a positional, use `--` to tell `yargs` to stop adding values to the array.
|
||||
*/
|
||||
array<K extends keyof T>(key: K | ReadonlyArray<K>): Argv<Omit<T, K> & { [key in K]: ToArray<T[key]> }>;
|
||||
array<K extends string>(key: K | ReadonlyArray<K>): Argv<T & { [key in K]: Array<string | number> | undefined }>;
|
||||
|
||||
/**
|
||||
* Interpret `key` as a boolean. If a non-flag option follows `key` in `process.argv`, that string won't get set as the value of `key`.
|
||||
*
|
||||
* `key` will default to `false`, unless a `default(key, undefined)` is explicitly set.
|
||||
*
|
||||
* If `key` is an array, interpret all the elements as booleans.
|
||||
*/
|
||||
boolean<K extends keyof T>(key: K | ReadonlyArray<K>): Argv<Omit<T, K> & { [key in K]: boolean | undefined }>;
|
||||
boolean<K extends string>(key: K | ReadonlyArray<K>): Argv<T & { [key in K]: boolean | undefined }>;
|
||||
|
||||
/**
|
||||
* Check that certain conditions are met in the provided arguments.
|
||||
* @param func Called with two arguments, the parsed `argv` hash and an array of options and their aliases.
|
||||
* If `func` throws or returns a non-truthy value, show the thrown error, usage information, and exit.
|
||||
* @param global Indicates whether `check()` should be enabled both at the top-level and for each sub-command.
|
||||
*/
|
||||
check(func: (argv: Arguments<T>, aliases: { [alias: string]: string }) => any, global?: boolean): Argv<T>;
|
||||
|
||||
/**
|
||||
* Limit valid values for key to a predefined set of choices, given as an array or as an individual value.
|
||||
* If this method is called multiple times, all enumerated values will be merged together.
|
||||
* Choices are generally strings or numbers, and value matching is case-sensitive.
|
||||
*
|
||||
* Optionally `.choices()` can take an object that maps multiple keys to their choices.
|
||||
*
|
||||
* Choices can also be specified as choices in the object given to `option()`.
|
||||
*/
|
||||
choices<K extends keyof T, C extends ReadonlyArray<any>>(key: K, values: C): Argv<Omit<T, K> & { [key in K]: C[number] | undefined }>;
|
||||
choices<K extends string, C extends ReadonlyArray<any>>(key: K, values: C): Argv<T & { [key in K]: C[number] | undefined }>;
|
||||
choices<C extends { [key: string]: ReadonlyArray<any> }>(choices: C): Argv<Omit<T, keyof C> & { [key in keyof C]: C[key][number] | undefined }>;
|
||||
|
||||
/**
|
||||
* Provide a synchronous function to coerce or transform the value(s) given on the command line for `key`.
|
||||
*
|
||||
* The coercion function should accept one argument, representing the parsed value from the command line, and should return a new value or throw an error.
|
||||
* The returned value will be used as the value for `key` (or one of its aliases) in `argv`.
|
||||
*
|
||||
* If the function throws, the error will be treated as a validation failure, delegating to either a custom `.fail()` handler or printing the error message in the console.
|
||||
*
|
||||
* Coercion will be applied to a value after all other modifications, such as `.normalize()`.
|
||||
*
|
||||
* Optionally `.coerce()` can take an object that maps several keys to their respective coercion function.
|
||||
*
|
||||
* You can also map the same function to several keys at one time. Just pass an array of keys as the first argument to `.coerce()`.
|
||||
*
|
||||
* If you are using dot-notion or arrays, .e.g., `user.email` and `user.password`, coercion will be applied to the final object that has been parsed
|
||||
*/
|
||||
coerce<K extends keyof T, V>(key: K | ReadonlyArray<K>, func: (arg: any) => V): Argv<Omit<T, K> & { [key in K]: V | undefined }>;
|
||||
coerce<K extends string, V>(key: K | ReadonlyArray<K>, func: (arg: any) => V): Argv<T & { [key in K]: V | undefined }>;
|
||||
coerce<O extends { [key: string]: (arg: any) => any }>(opts: O): Argv<Omit<T, keyof O> & { [key in keyof O]: ReturnType<O[key]> | undefined }>;
|
||||
|
||||
/**
|
||||
* Define the commands exposed by your application.
|
||||
* @param command Should be a string representing the command or an array of strings representing the command and its aliases.
|
||||
* @param description Use to provide a description for each command your application accepts (the values stored in `argv._`).
|
||||
* Set `description` to false to create a hidden command. Hidden commands don't show up in the help output and aren't available for completion.
|
||||
* @param [builder] Object to give hints about the options that your command accepts.
|
||||
* Can also be a function. This function is executed with a yargs instance, and can be used to provide advanced command specific help.
|
||||
*
|
||||
* Note that when `void` is returned, the handler `argv` object type will not include command-specific arguments.
|
||||
* @param [handler] Function, which will be executed with the parsed `argv` object.
|
||||
*/
|
||||
command<U = T>(
|
||||
command: string | ReadonlyArray<string>,
|
||||
description: string,
|
||||
builder?: BuilderCallback<T, U>,
|
||||
handler?: (args: ArgumentsCamelCase<U>) => void | Promise<void>,
|
||||
middlewares?: MiddlewareFunction[],
|
||||
deprecated?: boolean | string,
|
||||
): Argv<U>;
|
||||
command<O extends { [key: string]: Options }>(
|
||||
command: string | ReadonlyArray<string>,
|
||||
description: string,
|
||||
builder?: O,
|
||||
handler?: (args: ArgumentsCamelCase<InferredOptionTypes<O>>) => void | Promise<void>,
|
||||
middlewares?: MiddlewareFunction[],
|
||||
deprecated?: boolean | string,
|
||||
): Argv<T>;
|
||||
command<U>(command: string | ReadonlyArray<string>, description: string, module: CommandModule<T, U>): Argv<U>;
|
||||
command<U = T>(
|
||||
command: string | ReadonlyArray<string>,
|
||||
showInHelp: false,
|
||||
builder?: BuilderCallback<T, U>,
|
||||
handler?: (args: ArgumentsCamelCase<U>) => void | Promise<void>,
|
||||
middlewares?: MiddlewareFunction[],
|
||||
deprecated?: boolean | string,
|
||||
): Argv<T>;
|
||||
command<O extends { [key: string]: Options }>(
|
||||
command: string | ReadonlyArray<string>,
|
||||
showInHelp: false,
|
||||
builder?: O,
|
||||
handler?: (args: ArgumentsCamelCase<InferredOptionTypes<O>>) => void | Promise<void>,
|
||||
): Argv<T>;
|
||||
command<U>(command: string | ReadonlyArray<string>, showInHelp: false, module: CommandModule<T, U>): Argv<U>;
|
||||
command<U>(module: CommandModule<T, U>): Argv<U>;
|
||||
|
||||
// Advanced API
|
||||
/** Apply command modules from a directory relative to the module calling this method. */
|
||||
commandDir(dir: string, opts?: RequireDirectoryOptions): Argv<T>;
|
||||
|
||||
/**
|
||||
* Enable bash/zsh-completion shortcuts for commands and options.
|
||||
*
|
||||
* If invoked without parameters, `.completion()` will make completion the command to output the completion script.
|
||||
*
|
||||
* @param [cmd] When present in `argv._`, will result in the `.bashrc` or `.zshrc` completion script being outputted.
|
||||
* To enable bash/zsh completions, concat the generated script to your `.bashrc` or `.bash_profile` (or `.zshrc` for zsh).
|
||||
* @param [description] Provide a description in your usage instructions for the command that generates the completion scripts.
|
||||
* @param [func] Rather than relying on yargs' default completion functionality, which shiver me timbers is pretty awesome, you can provide your own completion method.
|
||||
*/
|
||||
completion(): Argv<T>;
|
||||
completion(cmd: string, func?: AsyncCompletionFunction): Argv<T>;
|
||||
completion(cmd: string, func?: SyncCompletionFunction): Argv<T>;
|
||||
completion(cmd: string, func?: PromiseCompletionFunction): Argv<T>;
|
||||
completion(cmd: string, description?: string | false, func?: AsyncCompletionFunction): Argv<T>;
|
||||
completion(cmd: string, description?: string | false, func?: SyncCompletionFunction): Argv<T>;
|
||||
completion(cmd: string, description?: string | false, func?: PromiseCompletionFunction): Argv<T>;
|
||||
|
||||
/**
|
||||
* Tells the parser that if the option specified by `key` is passed in, it should be interpreted as a path to a JSON config file.
|
||||
* The file is loaded and parsed, and its properties are set as arguments.
|
||||
* Because the file is loaded using Node's require(), the filename MUST end in `.json` to be interpreted correctly.
|
||||
*
|
||||
* If invoked without parameters, `.config()` will make --config the option to pass the JSON config file.
|
||||
*
|
||||
* @param [description] Provided to customize the config (`key`) option in the usage string.
|
||||
* @param [explicitConfigurationObject] An explicit configuration `object`
|
||||
*/
|
||||
config(): Argv<T>;
|
||||
config(key: string | ReadonlyArray<string>, description?: string, parseFn?: (configPath: string) => object): Argv<T>;
|
||||
config(key: string | ReadonlyArray<string>, parseFn: (configPath: string) => object): Argv<T>;
|
||||
config(explicitConfigurationObject: object): Argv<T>;
|
||||
|
||||
/**
|
||||
* Given the key `x` is set, the key `y` must not be set. `y` can either be a single string or an array of argument names that `x` conflicts with.
|
||||
*
|
||||
* Optionally `.conflicts()` can accept an object specifying multiple conflicting keys.
|
||||
*/
|
||||
conflicts(key: string, value: string | ReadonlyArray<string>): Argv<T>;
|
||||
conflicts(conflicts: { [key: string]: string | ReadonlyArray<string> }): Argv<T>;
|
||||
|
||||
/**
|
||||
* Interpret `key` as a boolean flag, but set its parsed value to the number of flag occurrences rather than `true` or `false`. Default value is thus `0`.
|
||||
*/
|
||||
count<K extends keyof T>(key: K | ReadonlyArray<K>): Argv<Omit<T, K> & { [key in K]: number }>;
|
||||
count<K extends string>(key: K | ReadonlyArray<K>): Argv<T & { [key in K]: number }>;
|
||||
|
||||
/**
|
||||
* Set `argv[key]` to `value` if no option was specified in `process.argv`.
|
||||
*
|
||||
* Optionally `.default()` can take an object that maps keys to default values.
|
||||
*
|
||||
* The default value can be a `function` which returns a value. The name of the function will be used in the usage string.
|
||||
*
|
||||
* Optionally, `description` can also be provided and will take precedence over displaying the value in the usage instructions.
|
||||
*/
|
||||
default<K extends keyof T, V>(key: K, value: V, description?: string): Argv<Omit<T, K> & { [key in K]: V }>;
|
||||
default<K extends string, V>(key: K, value: V, description?: string): Argv<T & { [key in K]: V }>;
|
||||
default<D extends { [key: string]: any }>(defaults: D, description?: string): Argv<Omit<T, keyof D> & D>;
|
||||
|
||||
/**
|
||||
* @deprecated since version 6.6.0
|
||||
* Use '.demandCommand()' or '.demandOption()' instead
|
||||
*/
|
||||
demand<K extends keyof T>(key: K | ReadonlyArray<K>, msg?: string | true): Argv<Defined<T, K>>;
|
||||
demand<K extends string>(key: K | ReadonlyArray<K>, msg?: string | true): Argv<T & { [key in K]: unknown }>;
|
||||
demand(key: string | ReadonlyArray<string>, required?: boolean): Argv<T>;
|
||||
demand(positionals: number, msg: string): Argv<T>;
|
||||
demand(positionals: number, required?: boolean): Argv<T>;
|
||||
demand(positionals: number, max: number, msg?: string): Argv<T>;
|
||||
|
||||
/**
|
||||
* @param key If is a string, show the usage information and exit if key wasn't specified in `process.argv`.
|
||||
* If is an array, demand each element.
|
||||
* @param msg If string is given, it will be printed when the argument is missing, instead of the standard error message.
|
||||
* @param demand Controls whether the option is demanded; this is useful when using .options() to specify command line parameters.
|
||||
*/
|
||||
demandOption<K extends keyof T>(key: K | ReadonlyArray<K>, msg?: string | true): Argv<Defined<T, K>>;
|
||||
demandOption<K extends string>(key: K | ReadonlyArray<K>, msg?: string | true): Argv<T & { [key in K]: unknown }>;
|
||||
demandOption(key: string | ReadonlyArray<string>, demand?: boolean): Argv<T>;
|
||||
|
||||
/**
|
||||
* Demand in context of commands.
|
||||
* You can demand a minimum and a maximum number a user can have within your program, as well as provide corresponding error messages if either of the demands is not met.
|
||||
*/
|
||||
demandCommand(): Argv<T>;
|
||||
demandCommand(min: number, minMsg?: string): Argv<T>;
|
||||
demandCommand(min: number, max?: number, minMsg?: string, maxMsg?: string): Argv<T>;
|
||||
|
||||
/**
|
||||
* Shows a [deprecated] notice in front of the option
|
||||
*/
|
||||
deprecateOption(option: string, msg?: string): Argv<T>;
|
||||
|
||||
/**
|
||||
* Describe a `key` for the generated usage information.
|
||||
*
|
||||
* Optionally `.describe()` can take an object that maps keys to descriptions.
|
||||
*/
|
||||
describe(key: string | ReadonlyArray<string>, description: string): Argv<T>;
|
||||
describe(descriptions: { [key: string]: string }): Argv<T>;
|
||||
|
||||
/** Should yargs attempt to detect the os' locale? Defaults to `true`. */
|
||||
detectLocale(detect: boolean): Argv<T>;
|
||||
|
||||
/**
|
||||
* Tell yargs to parse environment variables matching the given prefix and apply them to argv as though they were command line arguments.
|
||||
*
|
||||
* Use the "__" separator in the environment variable to indicate nested options. (e.g. prefix_nested__foo => nested.foo)
|
||||
*
|
||||
* If this method is called with no argument or with an empty string or with true, then all env vars will be applied to argv.
|
||||
*
|
||||
* Program arguments are defined in this order of precedence:
|
||||
* 1. Command line args
|
||||
* 2. Env vars
|
||||
* 3. Config file/objects
|
||||
* 4. Configured defaults
|
||||
*
|
||||
* Env var parsing is disabled by default, but you can also explicitly disable it by calling `.env(false)`, e.g. if you need to undo previous configuration.
|
||||
*/
|
||||
env(): Argv<T>;
|
||||
env(prefix: string): Argv<T>;
|
||||
env(enable: boolean): Argv<T>;
|
||||
|
||||
/** A message to print at the end of the usage instructions */
|
||||
epilog(msg: string): Argv<T>;
|
||||
/** A message to print at the end of the usage instructions */
|
||||
epilogue(msg: string): Argv<T>;
|
||||
|
||||
/**
|
||||
* Give some example invocations of your program.
|
||||
* Inside `cmd`, the string `$0` will get interpolated to the current script name or node command for the present script similar to how `$0` works in bash or perl.
|
||||
* Examples will be printed out as part of the help message.
|
||||
*/
|
||||
example(command: string, description: string): Argv<T>;
|
||||
example(command: ReadonlyArray<[string, string?]>): Argv<T>;
|
||||
|
||||
/** Manually indicate that the program should exit, and provide context about why we wanted to exit. Follows the behavior set by `.exitProcess().` */
|
||||
exit(code: number, err: Error): void;
|
||||
|
||||
/**
|
||||
* By default, yargs exits the process when the user passes a help flag, the user uses the `.version` functionality, validation fails, or the command handler fails.
|
||||
* Calling `.exitProcess(false)` disables this behavior, enabling further actions after yargs have been validated.
|
||||
*/
|
||||
exitProcess(enabled: boolean): Argv<T>;
|
||||
|
||||
/**
|
||||
* Method to execute when a failure occurs, rather than printing the failure message.
|
||||
* @param func Is called with the failure message that would have been printed, the Error instance originally thrown and yargs state when the failure occurred.
|
||||
*/
|
||||
fail(func: ((msg: string, err: Error, yargs: Argv<T>) => any) | boolean): Argv<T>;
|
||||
|
||||
/**
|
||||
* Allows to programmatically get completion choices for any line.
|
||||
* @param args An array of the words in the command line to complete.
|
||||
* @param done The callback to be called with the resulting completions.
|
||||
*/
|
||||
getCompletion(args: ReadonlyArray<string>, done: (err: Error|null, completions: ReadonlyArray<string>) => void): Argv<T>;
|
||||
getCompletion(args: ReadonlyArray<string>, done?: never): Promise<ReadonlyArray<string>>;
|
||||
|
||||
/**
|
||||
* Returns a promise which resolves to a string containing the help text.
|
||||
*/
|
||||
getHelp(): Promise<string>;
|
||||
|
||||
/**
|
||||
* Indicate that an option (or group of options) should not be reset when a command is executed
|
||||
*
|
||||
* Options default to being global.
|
||||
*/
|
||||
global(key: string | ReadonlyArray<string>): Argv<T>;
|
||||
|
||||
/** Given a key, or an array of keys, places options under an alternative heading when displaying usage instructions */
|
||||
group(key: string | ReadonlyArray<string>, groupName: string): Argv<T>;
|
||||
|
||||
/** Hides a key from the generated usage information. Unless a `--show-hidden` option is also passed with `--help` (see `showHidden()`). */
|
||||
hide(key: string): Argv<T>;
|
||||
|
||||
/**
|
||||
* Configure an (e.g. `--help`) and implicit command that displays the usage string and exits the process.
|
||||
* By default yargs enables help on the `--help` option.
|
||||
*
|
||||
* Note that any multi-char aliases (e.g. `help`) used for the help option will also be used for the implicit command.
|
||||
* If there are no multi-char aliases (e.g. `h`), then all single-char aliases will be used for the command.
|
||||
*
|
||||
* If invoked without parameters, `.help()` will use `--help` as the option and help as the implicit command to trigger help output.
|
||||
*
|
||||
* @param [description] Customizes the description of the help option in the usage string.
|
||||
* @param [enableExplicit] If `false` is provided, it will disable --help.
|
||||
*/
|
||||
help(): Argv<T>;
|
||||
help(enableExplicit: boolean): Argv<T>;
|
||||
help(option: string, enableExplicit: boolean): Argv<T>;
|
||||
help(option: string, description?: string, enableExplicit?: boolean): Argv<T>;
|
||||
|
||||
/**
|
||||
* Given the key `x` is set, it is required that the key `y` is set.
|
||||
* y` can either be the name of an argument to imply, a number indicating the position of an argument or an array of multiple implications to associate with `x`.
|
||||
*
|
||||
* Optionally `.implies()` can accept an object specifying multiple implications.
|
||||
*/
|
||||
implies(key: string, value: string | ReadonlyArray<string>): Argv<T>;
|
||||
implies(implies: { [key: string]: string | ReadonlyArray<string> }): Argv<T>;
|
||||
|
||||
/**
|
||||
* Return the locale that yargs is currently using.
|
||||
*
|
||||
* By default, yargs will auto-detect the operating system's locale so that yargs-generated help content will display in the user's language.
|
||||
*/
|
||||
locale(): string;
|
||||
/**
|
||||
* Override the auto-detected locale from the user's operating system with a static locale.
|
||||
* Note that the OS locale can be modified by setting/exporting the `LC_ALL` environment variable.
|
||||
*/
|
||||
locale(loc: string): Argv<T>;
|
||||
|
||||
/**
|
||||
* Define global middleware functions to be called first, in list order, for all cli command.
|
||||
* @param callbacks Can be a function or a list of functions. Each callback gets passed a reference to argv.
|
||||
* @param [applyBeforeValidation] Set to `true` to apply middleware before validation. This will execute the middleware prior to validation checks, but after parsing.
|
||||
*/
|
||||
middleware(callbacks: MiddlewareFunction<T> | ReadonlyArray<MiddlewareFunction<T>>, applyBeforeValidation?: boolean): Argv<T>;
|
||||
|
||||
/**
|
||||
* The number of arguments that should be consumed after a key. This can be a useful hint to prevent parsing ambiguity.
|
||||
*
|
||||
* Optionally `.nargs()` can take an object of `key`/`narg` pairs.
|
||||
*/
|
||||
nargs(key: string, count: number): Argv<T>;
|
||||
nargs(nargs: { [key: string]: number }): Argv<T>;
|
||||
|
||||
/** The key provided represents a path and should have `path.normalize()` applied. */
|
||||
normalize<K extends keyof T>(key: K | ReadonlyArray<K>): Argv<Omit<T, K> & { [key in K]: ToString<T[key]> }>;
|
||||
normalize<K extends string>(key: K | ReadonlyArray<K>): Argv<T & { [key in K]: string | undefined }>;
|
||||
|
||||
/**
|
||||
* Tell the parser to always interpret key as a number.
|
||||
*
|
||||
* If `key` is an array, all elements will be parsed as numbers.
|
||||
*
|
||||
* If the option is given on the command line without a value, `argv` will be populated with `undefined`.
|
||||
*
|
||||
* If the value given on the command line cannot be parsed as a number, `argv` will be populated with `NaN`.
|
||||
*
|
||||
* Note that decimals, hexadecimals, and scientific notation are all accepted.
|
||||
*/
|
||||
number<K extends keyof T>(key: K | ReadonlyArray<K>): Argv<Omit<T, K> & { [key in K]: ToNumber<T[key]> }>;
|
||||
number<K extends string>(key: K | ReadonlyArray<K>): Argv<T & { [key in K]: number | undefined }>;
|
||||
|
||||
/**
|
||||
* Method to execute when a command finishes successfully.
|
||||
* @param func Is called with the successful result of the command that finished.
|
||||
*/
|
||||
onFinishCommand(func: (result: any) => void): Argv<T>;
|
||||
|
||||
/**
|
||||
* This method can be used to make yargs aware of options that could exist.
|
||||
* You can also pass an opt object which can hold further customization, like `.alias()`, `.demandOption()` etc. for that option.
|
||||
*/
|
||||
option<K extends keyof T, O extends Options>(key: K, options: O): Argv<Omit<T, K> & { [key in K]: InferredOptionType<O> }>;
|
||||
option<K extends string, O extends Options>(key: K, options: O): Argv<T & { [key in K]: InferredOptionType<O> }>;
|
||||
option<O extends { [key: string]: Options }>(options: O): Argv<Omit<T, keyof O> & InferredOptionTypes<O>>;
|
||||
|
||||
/**
|
||||
* This method can be used to make yargs aware of options that could exist.
|
||||
* You can also pass an opt object which can hold further customization, like `.alias()`, `.demandOption()` etc. for that option.
|
||||
*/
|
||||
options<K extends keyof T, O extends Options>(key: K, options: O): Argv<Omit<T, K> & { [key in K]: InferredOptionType<O> }>;
|
||||
options<K extends string, O extends Options>(key: K, options: O): Argv<T & { [key in K]: InferredOptionType<O> }>;
|
||||
options<O extends { [key: string]: Options }>(options: O): Argv<Omit<T, keyof O> & InferredOptionTypes<O>>;
|
||||
|
||||
/**
|
||||
* Parse `args` instead of `process.argv`. Returns the `argv` object. `args` may either be a pre-processed argv array, or a raw argument string.
|
||||
*
|
||||
* Note: Providing a callback to parse() disables the `exitProcess` setting until after the callback is invoked.
|
||||
* @param [context] Provides a useful mechanism for passing state information to commands
|
||||
*/
|
||||
parse(): { [key in keyof Arguments<T> as key | CamelCaseKey<key>]: Arguments<T>[key] } | Promise<{ [key in keyof Arguments<T> as key | CamelCaseKey<key>]: Arguments<T>[key] }>;
|
||||
parse(
|
||||
arg: string | ReadonlyArray<string>,
|
||||
context?: object,
|
||||
parseCallback?: ParseCallback<T>,
|
||||
): { [key in keyof Arguments<T> as key | CamelCaseKey<key>]: Arguments<T>[key] } | Promise<{ [key in keyof Arguments<T> as key | CamelCaseKey<key>]: Arguments<T>[key] }>;
|
||||
parseSync(): { [key in keyof Arguments<T> as key | CamelCaseKey<key>]: Arguments<T>[key] };
|
||||
parseSync(arg: string | ReadonlyArray<string>, context?: object, parseCallback?: ParseCallback<T>): { [key in keyof Arguments<T> as key | CamelCaseKey<key>]: Arguments<T>[key] };
|
||||
parseAsync(): Promise<{ [key in keyof Arguments<T> as key | CamelCaseKey<key>]: Arguments<T>[key] }>;
|
||||
parseAsync(arg: string | ReadonlyArray<string>, context?: object, parseCallback?: ParseCallback<T>): Promise<{ [key in keyof Arguments<T> as key | CamelCaseKey<key>]: Arguments<T>[key] }>;
|
||||
|
||||
/**
|
||||
* If the arguments have not been parsed, this property is `false`.
|
||||
*
|
||||
* If the arguments have been parsed, this contain detailed parsed arguments.
|
||||
*/
|
||||
parsed: DetailedArguments | false;
|
||||
|
||||
/** Allows to configure advanced yargs features. */
|
||||
parserConfiguration(configuration: Partial<ParserConfigurationOptions>): Argv<T>;
|
||||
|
||||
/**
|
||||
* Similar to `config()`, indicates that yargs should interpret the object from the specified key in package.json as a configuration object.
|
||||
* @param [cwd] If provided, the package.json will be read from this location
|
||||
*/
|
||||
pkgConf(key: string | ReadonlyArray<string>, cwd?: string): Argv<T>;
|
||||
|
||||
/**
|
||||
* Allows you to configure a command's positional arguments with an API similar to `.option()`.
|
||||
* `.positional()` should be called in a command's builder function, and is not available on the top-level yargs instance. If so, it will throw an error.
|
||||
*/
|
||||
positional<K extends keyof T, O extends PositionalOptions>(key: K, opt: O): Argv<Omit<T, K> & { [key in K]: InferredOptionType<O> }>;
|
||||
positional<K extends string, O extends PositionalOptions>(key: K, opt: O): Argv<T & { [key in K]: InferredOptionType<O> }>;
|
||||
|
||||
/** Should yargs provide suggestions regarding similar commands if no matching command is found? */
|
||||
recommendCommands(): Argv<T>;
|
||||
|
||||
/**
|
||||
* @deprecated since version 6.6.0
|
||||
* Use '.demandCommand()' or '.demandOption()' instead
|
||||
*/
|
||||
require<K extends keyof T>(key: K | ReadonlyArray<K>, msg?: string | true): Argv<Defined<T, K>>;
|
||||
require(key: string, msg: string): Argv<T>;
|
||||
require(key: string, required: boolean): Argv<T>;
|
||||
require(keys: ReadonlyArray<number>, msg: string): Argv<T>;
|
||||
require(keys: ReadonlyArray<number>, required: boolean): Argv<T>;
|
||||
require(positionals: number, required: boolean): Argv<T>;
|
||||
require(positionals: number, msg: string): Argv<T>;
|
||||
|
||||
/**
|
||||
* @deprecated since version 6.6.0
|
||||
* Use '.demandCommand()' or '.demandOption()' instead
|
||||
*/
|
||||
required<K extends keyof T>(key: K | ReadonlyArray<K>, msg?: string | true): Argv<Defined<T, K>>;
|
||||
required(key: string, msg: string): Argv<T>;
|
||||
required(key: string, required: boolean): Argv<T>;
|
||||
required(keys: ReadonlyArray<number>, msg: string): Argv<T>;
|
||||
required(keys: ReadonlyArray<number>, required: boolean): Argv<T>;
|
||||
required(positionals: number, required: boolean): Argv<T>;
|
||||
required(positionals: number, msg: string): Argv<T>;
|
||||
|
||||
requiresArg(key: string | ReadonlyArray<string>): Argv<T>;
|
||||
|
||||
/** Set the name of your script ($0). Default is the base filename executed by node (`process.argv[1]`) */
|
||||
scriptName($0: string): Argv<T>;
|
||||
|
||||
/**
|
||||
* Generate a bash completion script.
|
||||
* Users of your application can install this script in their `.bashrc`, and yargs will provide completion shortcuts for commands and options.
|
||||
*/
|
||||
showCompletionScript(): Argv<T>;
|
||||
|
||||
/**
|
||||
* Configure the `--show-hidden` option that displays the hidden keys (see `hide()`).
|
||||
* @param option If `boolean`, it enables/disables this option altogether. i.e. hidden keys will be permanently hidden if first argument is `false`.
|
||||
* If `string` it changes the key name ("--show-hidden").
|
||||
* @param description Changes the default description ("Show hidden options")
|
||||
*/
|
||||
showHidden(option?: string | boolean): Argv<T>;
|
||||
showHidden(option: string, description?: string): Argv<T>;
|
||||
|
||||
/**
|
||||
* Print the usage data using the console function consoleLevel for printing.
|
||||
* @param [consoleLevel='error']
|
||||
*/
|
||||
showHelp(consoleLevel?: string): Argv<T>;
|
||||
|
||||
/**
|
||||
* Provide the usage data as a string.
|
||||
* @param printCallback a function with a single argument.
|
||||
*/
|
||||
showHelp(printCallback: (s: string) => void): Argv<T>;
|
||||
|
||||
/**
|
||||
* By default, yargs outputs a usage string if any error is detected.
|
||||
* Use the `.showHelpOnFail()` method to customize this behavior.
|
||||
* @param enable If `false`, the usage string is not output.
|
||||
* @param [message] Message that is output after the error message.
|
||||
*/
|
||||
showHelpOnFail(enable: boolean, message?: string): Argv<T>;
|
||||
|
||||
/**
|
||||
* Print the version data using the console function consoleLevel or the specified function.
|
||||
* @param [level='error']
|
||||
*/
|
||||
showVersion(level?: 'error' | 'log' | ((message: string) => void)): Argv<T>;
|
||||
|
||||
/** Specifies either a single option key (string), or an array of options. If any of the options is present, yargs validation is skipped. */
|
||||
skipValidation(key: string | ReadonlyArray<string>): Argv<T>;
|
||||
|
||||
/**
|
||||
* Any command-line argument given that is not demanded, or does not have a corresponding description, will be reported as an error.
|
||||
*
|
||||
* Unrecognized commands will also be reported as errors.
|
||||
*/
|
||||
strict(): Argv<T>;
|
||||
strict(enabled: boolean): Argv<T>;
|
||||
|
||||
/**
|
||||
* Similar to .strict(), except that it only applies to unrecognized commands.
|
||||
* A user can still provide arbitrary options, but unknown positional commands
|
||||
* will raise an error.
|
||||
*/
|
||||
strictCommands(): Argv<T>;
|
||||
strictCommands(enabled: boolean): Argv<T>;
|
||||
|
||||
/**
|
||||
* Similar to `.strict()`, except that it only applies to unrecognized options. A
|
||||
* user can still provide arbitrary positional options, but unknown options
|
||||
* will raise an error.
|
||||
*/
|
||||
strictOptions(): Argv<T>;
|
||||
strictOptions(enabled: boolean): Argv<T>;
|
||||
|
||||
/**
|
||||
* Tell the parser logic not to interpret `key` as a number or boolean. This can be useful if you need to preserve leading zeros in an input.
|
||||
*
|
||||
* If `key` is an array, interpret all the elements as strings.
|
||||
*
|
||||
* `.string('_')` will result in non-hyphenated arguments being interpreted as strings, regardless of whether they resemble numbers.
|
||||
*/
|
||||
string<K extends keyof T>(key: K | ReadonlyArray<K>): Argv<Omit<T, K> & { [key in K]: ToString<T[key]> }>;
|
||||
string<K extends string>(key: K | ReadonlyArray<K>): Argv<T & { [key in K]: string | undefined }>;
|
||||
|
||||
// Intended to be used with '.wrap()'
|
||||
terminalWidth(): number;
|
||||
|
||||
updateLocale(obj: { [key: string]: string }): Argv<T>;
|
||||
|
||||
/**
|
||||
* Override the default strings used by yargs with the key/value pairs provided in obj
|
||||
*
|
||||
* If you explicitly specify a locale(), you should do so before calling `updateStrings()`.
|
||||
*/
|
||||
updateStrings(obj: { [key: string]: string }): Argv<T>;
|
||||
|
||||
/**
|
||||
* Set a usage message to show which commands to use.
|
||||
* Inside `message`, the string `$0` will get interpolated to the current script name or node command for the present script similar to how `$0` works in bash or perl.
|
||||
*
|
||||
* If the optional `description`/`builder`/`handler` are provided, `.usage()` acts an an alias for `.command()`.
|
||||
* This allows you to use `.usage()` to configure the default command that will be run as an entry-point to your application
|
||||
* and allows you to provide configuration for the positional arguments accepted by your program:
|
||||
*/
|
||||
usage(message: string): Argv<T>;
|
||||
usage<U>(command: string | ReadonlyArray<string>, description: string, builder?: (args: Argv<T>) => Argv<U>, handler?: (args: ArgumentsCamelCase<U>) => void | Promise<void>): Argv<T>;
|
||||
usage<U>(command: string | ReadonlyArray<string>, showInHelp: boolean, builder?: (args: Argv<T>) => Argv<U>, handler?: (args: ArgumentsCamelCase<U>) => void | Promise<void>): Argv<T>;
|
||||
usage<O extends { [key: string]: Options }>(
|
||||
command: string | ReadonlyArray<string>,
|
||||
description: string,
|
||||
builder?: O,
|
||||
handler?: (args: ArgumentsCamelCase<InferredOptionTypes<O>>) => void | Promise<void>,
|
||||
): Argv<T>;
|
||||
usage<O extends { [key: string]: Options }>(
|
||||
command: string | ReadonlyArray<string>,
|
||||
showInHelp: boolean,
|
||||
builder?: O,
|
||||
handler?: (args: ArgumentsCamelCase<InferredOptionTypes<O>>) => void | Promise<void>,
|
||||
): Argv<T>;
|
||||
|
||||
/**
|
||||
* Add an option (e.g. `--version`) that displays the version number (given by the version parameter) and exits the process.
|
||||
* By default yargs enables version for the `--version` option.
|
||||
*
|
||||
* If no arguments are passed to version (`.version()`), yargs will parse the package.json of your module and use its version value.
|
||||
*
|
||||
* If the boolean argument `false` is provided, it will disable `--version`.
|
||||
*/
|
||||
version(): Argv<T>;
|
||||
version(version: string): Argv<T>;
|
||||
version(enable: boolean): Argv<T>;
|
||||
version(optionKey: string, version: string): Argv<T>;
|
||||
version(optionKey: string, description: string, version: string): Argv<T>;
|
||||
|
||||
/**
|
||||
* Format usage output to wrap at columns many columns.
|
||||
*
|
||||
* By default wrap will be set to `Math.min(80, windowWidth)`. Use `.wrap(null)` to specify no column limit (no right-align).
|
||||
* Use `.wrap(yargs.terminalWidth())` to maximize the width of yargs' usage instructions.
|
||||
*/
|
||||
wrap(columns: number | null): Argv<T>;
|
||||
}
|
||||
|
||||
type Arguments<T = {}> = T & {
|
||||
/** Non-option arguments */
|
||||
_: Array<string | number>;
|
||||
/** The script name or node command */
|
||||
$0: string;
|
||||
/** All remaining options */
|
||||
[argName: string]: unknown;
|
||||
};
|
||||
|
||||
/** Arguments type, with camelcased keys */
|
||||
type ArgumentsCamelCase<T = {}> = { [key in keyof T as key | CamelCaseKey<key>]: T[key] } & {
|
||||
/** Non-option arguments */
|
||||
_: Array<string | number>;
|
||||
/** The script name or node command */
|
||||
$0: string;
|
||||
/** All remaining options */
|
||||
[argName: string]: unknown;
|
||||
};
|
||||
|
||||
interface RequireDirectoryOptions {
|
||||
/** Look for command modules in all subdirectories and apply them as a flattened (non-hierarchical) list. */
|
||||
recurse?: boolean | undefined;
|
||||
/** The types of files to look for when requiring command modules. */
|
||||
extensions?: ReadonlyArray<string> | undefined;
|
||||
/**
|
||||
* A synchronous function called for each command module encountered.
|
||||
* Accepts `commandObject`, `pathToFile`, and `filename` as arguments.
|
||||
* Returns `commandObject` to include the command; any falsy value to exclude/skip it.
|
||||
*/
|
||||
visit?: ((commandObject: any, pathToFile?: string, filename?: string) => any) | undefined;
|
||||
/** Whitelist certain modules */
|
||||
include?: RegExp | ((pathToFile: string) => boolean) | undefined;
|
||||
/** Blacklist certain modules. */
|
||||
exclude?: RegExp | ((pathToFile: string) => boolean) | undefined;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
/** string or array of strings, alias(es) for the canonical option key, see `alias()` */
|
||||
alias?: string | ReadonlyArray<string> | undefined;
|
||||
/** boolean, interpret option as an array, see `array()` */
|
||||
array?: boolean | undefined;
|
||||
/** boolean, interpret option as a boolean flag, see `boolean()` */
|
||||
boolean?: boolean | undefined;
|
||||
/** value or array of values, limit valid option arguments to a predefined set, see `choices()` */
|
||||
choices?: Choices | undefined;
|
||||
/** function, coerce or transform parsed command line values into another value, see `coerce()` */
|
||||
coerce?: ((arg: any) => any) | undefined;
|
||||
/** boolean, interpret option as a path to a JSON config file, see `config()` */
|
||||
config?: boolean | undefined;
|
||||
/** function, provide a custom config parsing function, see `config()` */
|
||||
configParser?: ((configPath: string) => object) | undefined;
|
||||
/** string or object, require certain keys not to be set, see `conflicts()` */
|
||||
conflicts?: string | ReadonlyArray<string> | { [key: string]: string | ReadonlyArray<string> } | undefined;
|
||||
/** boolean, interpret option as a count of boolean flags, see `count()` */
|
||||
count?: boolean | undefined;
|
||||
/** value, set a default value for the option, see `default()` */
|
||||
default?: any;
|
||||
/** string, use this description for the default value in help content, see `default()` */
|
||||
defaultDescription?: string | undefined;
|
||||
/**
|
||||
* @deprecated since version 6.6.0
|
||||
* Use 'demandOption' instead
|
||||
*/
|
||||
demand?: boolean | string | undefined;
|
||||
/** boolean or string, mark the argument as deprecated, see `deprecateOption()` */
|
||||
deprecate?: boolean | string | undefined;
|
||||
/** boolean or string, mark the argument as deprecated, see `deprecateOption()` */
|
||||
deprecated?: boolean | string | undefined;
|
||||
/** boolean or string, demand the option be given, with optional error message, see `demandOption()` */
|
||||
demandOption?: boolean | string | undefined;
|
||||
/** string, the option description for help content, see `describe()` */
|
||||
desc?: string | undefined;
|
||||
/** string, the option description for help content, see `describe()` */
|
||||
describe?: string | undefined;
|
||||
/** string, the option description for help content, see `describe()` */
|
||||
description?: string | undefined;
|
||||
/** boolean, indicate that this key should not be reset when a command is invoked, see `global()` */
|
||||
global?: boolean | undefined;
|
||||
/** string, when displaying usage instructions place the option under an alternative group heading, see `group()` */
|
||||
group?: string | undefined;
|
||||
/** don't display option in help output. */
|
||||
hidden?: boolean | undefined;
|
||||
/** string or object, require certain keys to be set, see `implies()` */
|
||||
implies?: string | ReadonlyArray<string> | { [key: string]: string | ReadonlyArray<string> } | undefined;
|
||||
/** number, specify how many arguments should be consumed for the option, see `nargs()` */
|
||||
nargs?: number | undefined;
|
||||
/** boolean, apply path.normalize() to the option, see `normalize()` */
|
||||
normalize?: boolean | undefined;
|
||||
/** boolean, interpret option as a number, `number()` */
|
||||
number?: boolean | undefined;
|
||||
/**
|
||||
* @deprecated since version 6.6.0
|
||||
* Use 'demandOption' instead
|
||||
*/
|
||||
require?: boolean | string | undefined;
|
||||
/**
|
||||
* @deprecated since version 6.6.0
|
||||
* Use 'demandOption' instead
|
||||
*/
|
||||
required?: boolean | string | undefined;
|
||||
/** boolean, require the option be specified with a value, see `requiresArg()` */
|
||||
requiresArg?: boolean | undefined;
|
||||
/** boolean, skips validation if the option is present, see `skipValidation()` */
|
||||
skipValidation?: boolean | undefined;
|
||||
/** boolean, interpret option as a string, see `string()` */
|
||||
string?: boolean | undefined;
|
||||
type?: 'array' | 'count' | PositionalOptionsType | undefined;
|
||||
}
|
||||
|
||||
interface PositionalOptions {
|
||||
/** string or array of strings, see `alias()` */
|
||||
alias?: string | ReadonlyArray<string> | undefined;
|
||||
/** boolean, interpret option as an array, see `array()` */
|
||||
array?: boolean | undefined;
|
||||
/** value or array of values, limit valid option arguments to a predefined set, see `choices()` */
|
||||
choices?: Choices | undefined;
|
||||
/** function, coerce or transform parsed command line values into another value, see `coerce()` */
|
||||
coerce?: ((arg: any) => any) | undefined;
|
||||
/** string or object, require certain keys not to be set, see `conflicts()` */
|
||||
conflicts?: string | ReadonlyArray<string> | { [key: string]: string | ReadonlyArray<string> } | undefined;
|
||||
/** value, set a default value for the option, see `default()` */
|
||||
default?: any;
|
||||
/** boolean or string, demand the option be given, with optional error message, see `demandOption()` */
|
||||
demandOption?: boolean | string | undefined;
|
||||
/** string, the option description for help content, see `describe()` */
|
||||
desc?: string | undefined;
|
||||
/** string, the option description for help content, see `describe()` */
|
||||
describe?: string | undefined;
|
||||
/** string, the option description for help content, see `describe()` */
|
||||
description?: string | undefined;
|
||||
/** string or object, require certain keys to be set, see `implies()` */
|
||||
implies?: string | ReadonlyArray<string> | { [key: string]: string | ReadonlyArray<string> } | undefined;
|
||||
/** boolean, apply path.normalize() to the option, see normalize() */
|
||||
normalize?: boolean | undefined;
|
||||
type?: PositionalOptionsType | undefined;
|
||||
}
|
||||
|
||||
// not implemented: yargs camelizes '_', but only if there's a '-' in the arg name
|
||||
// not implemented: yargs decamelizes (converts fooBar to foo-bar)
|
||||
|
||||
/** Convert literal string types like 'foo-bar' to 'FooBar' */
|
||||
type PascalCase<S extends string> = string extends S
|
||||
? string
|
||||
: S extends `${infer T}-${infer U}`
|
||||
? `${Capitalize<T>}${PascalCase<U>}`
|
||||
: Capitalize<S>;
|
||||
|
||||
/** Convert literal string types like 'foo-bar' to 'fooBar' */
|
||||
type CamelCase<S extends string> = string extends S
|
||||
? string
|
||||
: S extends `${infer T}-${infer U}`
|
||||
? `${T}${PascalCase<U>}`
|
||||
: S;
|
||||
|
||||
/** Convert literal string types like 'foo-bar' to 'fooBar', allowing all `PropertyKey` types */
|
||||
type CamelCaseKey<K extends PropertyKey> = K extends string ? Exclude<CamelCase<K>, ''> : K;
|
||||
|
||||
/** Remove keys K in T */
|
||||
type Omit<T, K> = { [key in Exclude<keyof T, K>]: T[key] };
|
||||
|
||||
/** Remove undefined as a possible value for keys K in T */
|
||||
type Defined<T, K extends keyof T> = Omit<T, K> & { [key in K]: Exclude<T[key], undefined> };
|
||||
|
||||
/** Convert T to T[] and T | undefined to T[] | undefined */
|
||||
type ToArray<T> = Array<Exclude<T, undefined>> | Extract<T, undefined>;
|
||||
|
||||
/** Gives string[] if T is an array type, otherwise string. Preserves | undefined. */
|
||||
type ToString<T> = (Exclude<T, undefined> extends any[] ? string[] : string) | Extract<T, undefined>;
|
||||
|
||||
/** Gives number[] if T is an array type, otherwise number. Preserves | undefined. */
|
||||
type ToNumber<T> = (Exclude<T, undefined> extends any[] ? number[] : number) | Extract<T, undefined>;
|
||||
|
||||
// prettier-ignore
|
||||
type InferredOptionType<O extends Options | PositionalOptions> =
|
||||
O extends (
|
||||
| { required: string | true }
|
||||
| { require: string | true }
|
||||
| { demand: string | true }
|
||||
| { demandOption: string | true }
|
||||
) ?
|
||||
Exclude<InferredOptionTypeInner<O>, undefined> :
|
||||
InferredOptionTypeInner<O>;
|
||||
|
||||
// prettier-ignore
|
||||
type InferredOptionTypeInner<O extends Options | PositionalOptions> =
|
||||
O extends { default: any, coerce: (arg: any) => infer T } ? T :
|
||||
O extends { default: infer D } ? D :
|
||||
O extends { type: "count" } ? number :
|
||||
O extends { count: true } ? number :
|
||||
RequiredOptionType<O> | undefined;
|
||||
|
||||
// prettier-ignore
|
||||
type RequiredOptionType<O extends Options | PositionalOptions> =
|
||||
O extends { type: "array", string: true } ? string[] :
|
||||
O extends { type: "array", number: true } ? number[] :
|
||||
O extends { type: "array", normalize: true } ? string[] :
|
||||
O extends { type: "string", array: true } ? string[] :
|
||||
O extends { type: "number", array: true } ? number[] :
|
||||
O extends { string: true, array: true } ? string[] :
|
||||
O extends { number: true, array: true } ? number[] :
|
||||
O extends { normalize: true, array: true } ? string[] :
|
||||
O extends { type: "array" } ? Array<string | number> :
|
||||
O extends { type: "boolean" } ? boolean :
|
||||
O extends { type: "number" } ? number :
|
||||
O extends { type: "string" } ? string :
|
||||
O extends { array: true } ? Array<string | number> :
|
||||
O extends { boolean: true } ? boolean :
|
||||
O extends { number: true } ? number :
|
||||
O extends { string: true } ? string :
|
||||
O extends { normalize: true } ? string :
|
||||
O extends { choices: ReadonlyArray<infer C> } ? C :
|
||||
O extends { coerce: (arg: any) => infer T } ? T :
|
||||
unknown;
|
||||
|
||||
type InferredOptionTypes<O extends { [key: string]: Options }> = { [key in keyof O]: InferredOptionType<O[key]> };
|
||||
|
||||
interface CommandModule<T = {}, U = {}> {
|
||||
/** array of strings (or a single string) representing aliases of `exports.command`, positional args defined in an alias are ignored */
|
||||
aliases?: ReadonlyArray<string> | string | undefined;
|
||||
/** object declaring the options the command accepts, or a function accepting and returning a yargs instance */
|
||||
builder?: CommandBuilder<T, U> | undefined;
|
||||
/** string (or array of strings) that executes this command when given on the command line, first string may contain positional args */
|
||||
command?: ReadonlyArray<string> | string | undefined;
|
||||
/** boolean (or string) to show deprecation notice */
|
||||
deprecated?: boolean | string | undefined;
|
||||
/** string used as the description for the command in help text, use `false` for a hidden command */
|
||||
describe?: string | false | undefined;
|
||||
/** a function which will be passed the parsed argv. */
|
||||
handler: (args: ArgumentsCamelCase<U>) => void | Promise<void>;
|
||||
}
|
||||
|
||||
type ParseCallback<T = {}> = (err: Error | undefined, argv: ArgumentsCamelCase<T>, output: string) => void | Promise<void>;
|
||||
type CommandBuilder<T = {}, U = {}> = { [key: string]: Options } | ((args: Argv<T>) => Argv<U>) | ((args: Argv<T>) => PromiseLike<Argv<U>>);
|
||||
type SyncCompletionFunction = (current: string, argv: any) => string[];
|
||||
type AsyncCompletionFunction = (current: string, argv: any, done: (completion: ReadonlyArray<string>) => void) => void;
|
||||
type PromiseCompletionFunction = (current: string, argv: any) => Promise<string[]>;
|
||||
type MiddlewareFunction<T = {}> = (args: Arguments<T>) => void | Promise<void>;
|
||||
type Choices = ReadonlyArray<string | number | true | undefined>;
|
||||
type PositionalOptionsType = 'boolean' | 'number' | 'string';
|
||||
}
|
||||
|
||||
declare var yargs: yargs.Argv;
|
||||
export = yargs;
|
94
node_modules/@types/yargs/package.json
generated
vendored
94
node_modules/@types/yargs/package.json
generated
vendored
@ -1,94 +0,0 @@
|
||||
{
|
||||
"name": "@types/yargs",
|
||||
"version": "17.0.13",
|
||||
"description": "TypeScript definitions for yargs",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Martin Poelstra",
|
||||
"url": "https://github.com/poelstra",
|
||||
"githubUsername": "poelstra"
|
||||
},
|
||||
{
|
||||
"name": "Mizunashi Mana",
|
||||
"url": "https://github.com/mizunashi-mana",
|
||||
"githubUsername": "mizunashi-mana"
|
||||
},
|
||||
{
|
||||
"name": "Jeffery Grajkowski",
|
||||
"url": "https://github.com/pushplay",
|
||||
"githubUsername": "pushplay"
|
||||
},
|
||||
{
|
||||
"name": "Jimi (Dimitris) Charalampidis",
|
||||
"url": "https://github.com/JimiC",
|
||||
"githubUsername": "JimiC"
|
||||
},
|
||||
{
|
||||
"name": "Steffen Viken Valvåg",
|
||||
"url": "https://github.com/steffenvv",
|
||||
"githubUsername": "steffenvv"
|
||||
},
|
||||
{
|
||||
"name": "Emily Marigold Klassen",
|
||||
"url": "https://github.com/forivall",
|
||||
"githubUsername": "forivall"
|
||||
},
|
||||
{
|
||||
"name": "ExE Boss",
|
||||
"url": "https://github.com/ExE-Boss",
|
||||
"githubUsername": "ExE-Boss"
|
||||
},
|
||||
{
|
||||
"name": "Aankhen",
|
||||
"url": "https://github.com/Aankhen",
|
||||
"githubUsername": "Aankhen"
|
||||
},
|
||||
{
|
||||
"name": "Ben Coe",
|
||||
"url": "https://github.com/bcoe",
|
||||
"githubUsername": "bcoe"
|
||||
}
|
||||
],
|
||||
"main": "",
|
||||
"types": "index.d.ts",
|
||||
"typesVersions": {
|
||||
"<4.2.0-0": {
|
||||
"*": [
|
||||
"ts4.1/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/yargs"
|
||||
},
|
||||
"scripts": {},
|
||||
"dependencies": {
|
||||
"@types/yargs-parser": "*"
|
||||
},
|
||||
"typesPublisherContentHash": "9016ff10b6e6354147619595a33b71abde9faf7542f46ec8296d7c8d2bd5cc45",
|
||||
"typeScriptVersion": "4.1",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": {
|
||||
"import": "./index.d.mts",
|
||||
"default": "./index.d.ts"
|
||||
}
|
||||
},
|
||||
"./helpers": {
|
||||
"types": {
|
||||
"import": "./helpers.d.mts",
|
||||
"default": "./helpers.d.ts"
|
||||
}
|
||||
},
|
||||
"./yargs": {
|
||||
"types": {
|
||||
"default": "./yargs.d.ts"
|
||||
}
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
}
|
||||
}
|
9
node_modules/@types/yargs/yargs.d.ts
generated
vendored
9
node_modules/@types/yargs/yargs.d.ts
generated
vendored
@ -1,9 +0,0 @@
|
||||
import { Argv } from '.';
|
||||
|
||||
export = Yargs;
|
||||
|
||||
declare function Yargs(
|
||||
processArgs?: ReadonlyArray<string> | string,
|
||||
cwd?: string,
|
||||
parentRequire?: NodeRequire,
|
||||
): Argv;
|
BIN
node_modules/@vercel/ncc/dist/ncc/cli.js.cache
generated
vendored
BIN
node_modules/@vercel/ncc/dist/ncc/cli.js.cache
generated
vendored
Binary file not shown.
BIN
node_modules/@vercel/ncc/dist/ncc/index.js.cache
generated
vendored
BIN
node_modules/@vercel/ncc/dist/ncc/index.js.cache
generated
vendored
Binary file not shown.
BIN
node_modules/@vercel/ncc/dist/ncc/loaders/relocate-loader.js.cache
generated
vendored
BIN
node_modules/@vercel/ncc/dist/ncc/loaders/relocate-loader.js.cache
generated
vendored
Binary file not shown.
BIN
node_modules/@vercel/ncc/dist/ncc/loaders/shebang-loader.js.cache
generated
vendored
BIN
node_modules/@vercel/ncc/dist/ncc/loaders/shebang-loader.js.cache
generated
vendored
Binary file not shown.
BIN
node_modules/@vercel/ncc/dist/ncc/loaders/ts-loader.js.cache
generated
vendored
BIN
node_modules/@vercel/ncc/dist/ncc/loaders/ts-loader.js.cache
generated
vendored
Binary file not shown.
21
node_modules/diff-sequences/LICENSE
generated
vendored
21
node_modules/diff-sequences/LICENSE
generated
vendored
@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Facebook, Inc. and its affiliates.
|
||||
|
||||
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.
|
404
node_modules/diff-sequences/README.md
generated
vendored
404
node_modules/diff-sequences/README.md
generated
vendored
@ -1,404 +0,0 @@
|
||||
# diff-sequences
|
||||
|
||||
Compare items in two sequences to find a **longest common subsequence**.
|
||||
|
||||
The items not in common are the items to delete or insert in a **shortest edit script**.
|
||||
|
||||
To maximize flexibility and minimize memory, you write **callback** functions as configuration:
|
||||
|
||||
**Input** function `isCommon(aIndex, bIndex)` compares items at indexes in the sequences and returns a truthy/falsey value. This package might call your function more than once for some pairs of indexes.
|
||||
|
||||
- Because your function encapsulates **comparison**, this package can compare items according to `===` operator, `Object.is` method, or other criterion.
|
||||
- Because your function encapsulates **sequences**, this package can find differences in arrays, strings, or other data.
|
||||
|
||||
**Output** function `foundSubsequence(nCommon, aCommon, bCommon)` receives the number of adjacent items and starting indexes of each common subsequence. If sequences do not have common items, then this package does not call your function.
|
||||
|
||||
If N is the sum of lengths of sequences and L is length of a longest common subsequence, then D = N – 2L is the number of **differences** in the corresponding shortest edit script.
|
||||
|
||||
[_An O(ND) Difference Algorithm and Its Variations_](http://xmailserver.org/diff2.pdf) by Eugene W. Myers is fast when sequences have **few** differences.
|
||||
|
||||
This package implements the **linear space** variation with optimizations so it is fast even when sequences have **many** differences.
|
||||
|
||||
## Usage
|
||||
|
||||
To add this package as a dependency of a project, do either of the following:
|
||||
|
||||
- `npm install diff-sequences`
|
||||
- `yarn add diff-sequences`
|
||||
|
||||
To use `diff` as the name of the default export from this package, do either of the following:
|
||||
|
||||
- `var diff = require('diff-sequences').default; // CommonJS modules`
|
||||
- `import diff from 'diff-sequences'; // ECMAScript modules`
|
||||
|
||||
Call `diff` with the **lengths** of sequences and your **callback** functions:
|
||||
|
||||
```js
|
||||
const a = ['a', 'b', 'c', 'a', 'b', 'b', 'a'];
|
||||
const b = ['c', 'b', 'a', 'b', 'a', 'c'];
|
||||
|
||||
function isCommon(aIndex, bIndex) {
|
||||
return a[aIndex] === b[bIndex];
|
||||
}
|
||||
function foundSubsequence(nCommon, aCommon, bCommon) {
|
||||
// see examples
|
||||
}
|
||||
|
||||
diff(a.length, b.length, isCommon, foundSubsequence);
|
||||
```
|
||||
|
||||
## Example of longest common subsequence
|
||||
|
||||
Some sequences (for example, `a` and `b` in the example of usage) have more than one longest common subsequence.
|
||||
|
||||
This package finds the following common items:
|
||||
|
||||
| comparisons of common items | values | output arguments |
|
||||
| :------------------------------- | :--------- | --------------------------: |
|
||||
| `a[2] === b[0]` | `'c'` | `foundSubsequence(1, 2, 0)` |
|
||||
| `a[4] === b[1]` | `'b'` | `foundSubsequence(1, 4, 1)` |
|
||||
| `a[5] === b[3] && a[6] === b[4]` | `'b', 'a'` | `foundSubsequence(2, 5, 3)` |
|
||||
|
||||
The “edit graph” analogy in the Myers paper shows the following common items:
|
||||
|
||||
| comparisons of common items | values |
|
||||
| :------------------------------- | :--------- |
|
||||
| `a[2] === b[0]` | `'c'` |
|
||||
| `a[3] === b[2] && a[4] === b[3]` | `'a', 'b'` |
|
||||
| `a[6] === b[4]` | `'a'` |
|
||||
|
||||
Various packages which implement the Myers algorithm will **always agree** on the **length** of a longest common subsequence, but might **sometimes disagree** on which **items** are in it.
|
||||
|
||||
## Example of callback functions to count common items
|
||||
|
||||
```js
|
||||
// Return length of longest common subsequence according to === operator.
|
||||
function countCommonItems(a, b) {
|
||||
let n = 0;
|
||||
function isCommon(aIndex, bIndex) {
|
||||
return a[aIndex] === b[bIndex];
|
||||
}
|
||||
function foundSubsequence(nCommon) {
|
||||
n += nCommon;
|
||||
}
|
||||
|
||||
diff(a.length, b.length, isCommon, foundSubsequence);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
const commonLength = countCommonItems(
|
||||
['a', 'b', 'c', 'a', 'b', 'b', 'a'],
|
||||
['c', 'b', 'a', 'b', 'a', 'c'],
|
||||
);
|
||||
```
|
||||
|
||||
| category of items | expression | value |
|
||||
| :----------------- | ------------------------: | ----: |
|
||||
| in common | `commonLength` | `4` |
|
||||
| to delete from `a` | `a.length - commonLength` | `3` |
|
||||
| to insert from `b` | `b.length - commonLength` | `2` |
|
||||
|
||||
If the length difference `b.length - a.length` is:
|
||||
|
||||
- negative: its absolute value is the minimum number of items to **delete** from `a`
|
||||
- positive: it is the minimum number of items to **insert** from `b`
|
||||
- zero: there is an **equal** number of items to delete from `a` and insert from `b`
|
||||
- non-zero: there is an equal number of **additional** items to delete from `a` and insert from `b`
|
||||
|
||||
In this example, `6 - 7` is:
|
||||
|
||||
- negative: `1` is the minimum number of items to **delete** from `a`
|
||||
- non-zero: `2` is the number of **additional** items to delete from `a` and insert from `b`
|
||||
|
||||
## Example of callback functions to find common items
|
||||
|
||||
```js
|
||||
// Return array of items in longest common subsequence according to Object.is method.
|
||||
const findCommonItems = (a, b) => {
|
||||
const array = [];
|
||||
diff(
|
||||
a.length,
|
||||
b.length,
|
||||
(aIndex, bIndex) => Object.is(a[aIndex], b[bIndex]),
|
||||
(nCommon, aCommon) => {
|
||||
for (; nCommon !== 0; nCommon -= 1, aCommon += 1) {
|
||||
array.push(a[aCommon]);
|
||||
}
|
||||
},
|
||||
);
|
||||
return array;
|
||||
};
|
||||
|
||||
const commonItems = findCommonItems(
|
||||
['a', 'b', 'c', 'a', 'b', 'b', 'a'],
|
||||
['c', 'b', 'a', 'b', 'a', 'c'],
|
||||
);
|
||||
```
|
||||
|
||||
| `i` | `commonItems[i]` | `aIndex` |
|
||||
| --: | :--------------- | -------: |
|
||||
| `0` | `'c'` | `2` |
|
||||
| `1` | `'b'` | `4` |
|
||||
| `2` | `'b'` | `5` |
|
||||
| `3` | `'a'` | `6` |
|
||||
|
||||
## Example of callback functions to diff index intervals
|
||||
|
||||
Instead of slicing array-like objects, you can adjust indexes in your callback functions.
|
||||
|
||||
```js
|
||||
// Diff index intervals that are half open [start, end) like array slice method.
|
||||
const diffIndexIntervals = (a, aStart, aEnd, b, bStart, bEnd) => {
|
||||
// Validate: 0 <= aStart and aStart <= aEnd and aEnd <= a.length
|
||||
// Validate: 0 <= bStart and bStart <= bEnd and bEnd <= b.length
|
||||
|
||||
diff(
|
||||
aEnd - aStart,
|
||||
bEnd - bStart,
|
||||
(aIndex, bIndex) => Object.is(a[aStart + aIndex], b[bStart + bIndex]),
|
||||
(nCommon, aCommon, bCommon) => {
|
||||
// aStart + aCommon, bStart + bCommon
|
||||
},
|
||||
);
|
||||
|
||||
// After the last common subsequence, do any remaining work.
|
||||
};
|
||||
```
|
||||
|
||||
## Example of callback functions to emulate diff command
|
||||
|
||||
Linux or Unix has a `diff` command to compare files line by line. Its output is a **shortest edit script**:
|
||||
|
||||
- **c**hange adjacent lines from the first file to lines from the second file
|
||||
- **d**elete lines from the first file
|
||||
- **a**ppend or insert lines from the second file
|
||||
|
||||
```js
|
||||
// Given zero-based half-open range [start, end) of array indexes,
|
||||
// return one-based closed range [start + 1, end] as string.
|
||||
const getRange = (start, end) =>
|
||||
start + 1 === end ? `${start + 1}` : `${start + 1},${end}`;
|
||||
|
||||
// Given index intervals of lines to delete or insert, or both, or neither,
|
||||
// push formatted diff lines onto array.
|
||||
const pushDelIns = (aLines, aIndex, aEnd, bLines, bIndex, bEnd, array) => {
|
||||
const deleteLines = aIndex !== aEnd;
|
||||
const insertLines = bIndex !== bEnd;
|
||||
const changeLines = deleteLines && insertLines;
|
||||
if (changeLines) {
|
||||
array.push(`${getRange(aIndex, aEnd)}c${getRange(bIndex, bEnd)}`);
|
||||
} else if (deleteLines) {
|
||||
array.push(`${getRange(aIndex, aEnd)}d${String(bIndex)}`);
|
||||
} else if (insertLines) {
|
||||
array.push(`${String(aIndex)}a${getRange(bIndex, bEnd)}`);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
for (; aIndex !== aEnd; aIndex += 1) {
|
||||
array.push(`< ${aLines[aIndex]}`); // delete is less than
|
||||
}
|
||||
|
||||
if (changeLines) {
|
||||
array.push('---');
|
||||
}
|
||||
|
||||
for (; bIndex !== bEnd; bIndex += 1) {
|
||||
array.push(`> ${bLines[bIndex]}`); // insert is greater than
|
||||
}
|
||||
};
|
||||
|
||||
// Given content of two files, return emulated output of diff utility.
|
||||
const findShortestEditScript = (a, b) => {
|
||||
const aLines = a.split('\n');
|
||||
const bLines = b.split('\n');
|
||||
const aLength = aLines.length;
|
||||
const bLength = bLines.length;
|
||||
|
||||
const isCommon = (aIndex, bIndex) => aLines[aIndex] === bLines[bIndex];
|
||||
|
||||
let aIndex = 0;
|
||||
let bIndex = 0;
|
||||
const array = [];
|
||||
const foundSubsequence = (nCommon, aCommon, bCommon) => {
|
||||
pushDelIns(aLines, aIndex, aCommon, bLines, bIndex, bCommon, array);
|
||||
aIndex = aCommon + nCommon; // number of lines compared in a
|
||||
bIndex = bCommon + nCommon; // number of lines compared in b
|
||||
};
|
||||
|
||||
diff(aLength, bLength, isCommon, foundSubsequence);
|
||||
|
||||
// After the last common subsequence, push remaining change lines.
|
||||
pushDelIns(aLines, aIndex, aLength, bLines, bIndex, bLength, array);
|
||||
|
||||
return array.length === 0 ? '' : `${array.join('\n')}\n`;
|
||||
};
|
||||
```
|
||||
|
||||
## Example of callback functions to format diff lines
|
||||
|
||||
Here is simplified code to format **changed and unchanged lines** in expected and received values after a test fails in Jest:
|
||||
|
||||
```js
|
||||
// Format diff with minus or plus for change lines and space for common lines.
|
||||
const formatDiffLines = (a, b) => {
|
||||
// Jest depends on pretty-format package to serialize objects as strings.
|
||||
// Unindented for comparison to avoid distracting differences:
|
||||
const aLinesUn = format(a, {indent: 0 /*, other options*/}).split('\n');
|
||||
const bLinesUn = format(b, {indent: 0 /*, other options*/}).split('\n');
|
||||
// Indented to display changed and unchanged lines:
|
||||
const aLinesIn = format(a, {indent: 2 /*, other options*/}).split('\n');
|
||||
const bLinesIn = format(b, {indent: 2 /*, other options*/}).split('\n');
|
||||
|
||||
const aLength = aLinesIn.length; // Validate: aLinesUn.length === aLength
|
||||
const bLength = bLinesIn.length; // Validate: bLinesUn.length === bLength
|
||||
|
||||
const isCommon = (aIndex, bIndex) => aLinesUn[aIndex] === bLinesUn[bIndex];
|
||||
|
||||
// Only because the GitHub Flavored Markdown doc collapses adjacent spaces,
|
||||
// this example code and the following table represent spaces as middle dots.
|
||||
let aIndex = 0;
|
||||
let bIndex = 0;
|
||||
const array = [];
|
||||
const foundSubsequence = (nCommon, aCommon, bCommon) => {
|
||||
for (; aIndex !== aCommon; aIndex += 1) {
|
||||
array.push(`-·${aLinesIn[aIndex]}`); // delete is minus
|
||||
}
|
||||
for (; bIndex !== bCommon; bIndex += 1) {
|
||||
array.push(`+·${bLinesIn[bIndex]}`); // insert is plus
|
||||
}
|
||||
for (; nCommon !== 0; nCommon -= 1, aIndex += 1, bIndex += 1) {
|
||||
// For common lines, received indentation seems more intuitive.
|
||||
array.push(`··${bLinesIn[bIndex]}`); // common is space
|
||||
}
|
||||
};
|
||||
|
||||
diff(aLength, bLength, isCommon, foundSubsequence);
|
||||
|
||||
// After the last common subsequence, push remaining change lines.
|
||||
for (; aIndex !== aLength; aIndex += 1) {
|
||||
array.push(`-·${aLinesIn[aIndex]}`);
|
||||
}
|
||||
for (; bIndex !== bLength; bIndex += 1) {
|
||||
array.push(`+·${bLinesIn[bIndex]}`);
|
||||
}
|
||||
|
||||
return array;
|
||||
};
|
||||
|
||||
const expected = {
|
||||
searching: '',
|
||||
sorting: {
|
||||
ascending: true,
|
||||
fieldKey: 'what',
|
||||
},
|
||||
};
|
||||
const received = {
|
||||
searching: '',
|
||||
sorting: [
|
||||
{
|
||||
descending: false,
|
||||
fieldKey: 'what',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const diffLines = formatDiffLines(expected, received);
|
||||
```
|
||||
|
||||
If N is the sum of lengths of sequences and L is length of a longest common subsequence, then N – L is length of an array of diff lines. In this example, N is 7 + 9, L is 5, and N – L is 11.
|
||||
|
||||
| `i` | `diffLines[i]` | `aIndex` | `bIndex` |
|
||||
| ---: | :--------------------------------- | -------: | -------: |
|
||||
| `0` | `'··Object {'` | `0` | `0` |
|
||||
| `1` | `'····"searching": "",'` | `1` | `1` |
|
||||
| `2` | `'-···"sorting": Object {'` | `2` | |
|
||||
| `3` | `'-·····"ascending": true,'` | `3` | |
|
||||
| `4` | `'+·····"sorting": Array ['` | | `2` |
|
||||
| `5` | `'+·······Object {'` | | `3` |
|
||||
| `6` | `'+·········"descending": false,'` | | `4` |
|
||||
| `7` | `'··········"fieldKey": "what",'` | `4` | `5` |
|
||||
| `8` | `'········},'` | `5` | `6` |
|
||||
| `9` | `'+·····],'` | | `7` |
|
||||
| `10` | `'··}'` | `6` | `8` |
|
||||
|
||||
## Example of callback functions to find diff items
|
||||
|
||||
Here is simplified code to find changed and unchanged substrings **within adjacent changed lines** in expected and received values after a test fails in Jest:
|
||||
|
||||
```js
|
||||
// Return diff items for strings (compatible with diff-match-patch package).
|
||||
const findDiffItems = (a, b) => {
|
||||
const isCommon = (aIndex, bIndex) => a[aIndex] === b[bIndex];
|
||||
|
||||
let aIndex = 0;
|
||||
let bIndex = 0;
|
||||
const array = [];
|
||||
const foundSubsequence = (nCommon, aCommon, bCommon) => {
|
||||
if (aIndex !== aCommon) {
|
||||
array.push([-1, a.slice(aIndex, aCommon)]); // delete is -1
|
||||
}
|
||||
if (bIndex !== bCommon) {
|
||||
array.push([1, b.slice(bIndex, bCommon)]); // insert is 1
|
||||
}
|
||||
|
||||
aIndex = aCommon + nCommon; // number of characters compared in a
|
||||
bIndex = bCommon + nCommon; // number of characters compared in b
|
||||
array.push([0, a.slice(aCommon, aIndex)]); // common is 0
|
||||
};
|
||||
|
||||
diff(a.length, b.length, isCommon, foundSubsequence);
|
||||
|
||||
// After the last common subsequence, push remaining change items.
|
||||
if (aIndex !== a.length) {
|
||||
array.push([-1, a.slice(aIndex)]);
|
||||
}
|
||||
if (bIndex !== b.length) {
|
||||
array.push([1, b.slice(bIndex)]);
|
||||
}
|
||||
|
||||
return array;
|
||||
};
|
||||
|
||||
const expectedDeleted = ['"sorting": Object {', '"ascending": true,'].join(
|
||||
'\n',
|
||||
);
|
||||
const receivedInserted = [
|
||||
'"sorting": Array [',
|
||||
'Object {',
|
||||
'"descending": false,',
|
||||
].join('\n');
|
||||
|
||||
const diffItems = findDiffItems(expectedDeleted, receivedInserted);
|
||||
```
|
||||
|
||||
| `i` | `diffItems[i][0]` | `diffItems[i][1]` |
|
||||
| --: | ----------------: | :---------------- |
|
||||
| `0` | `0` | `'"sorting": '` |
|
||||
| `1` | `1` | `'Array [\n'` |
|
||||
| `2` | `0` | `'Object {\n"'` |
|
||||
| `3` | `-1` | `'a'` |
|
||||
| `4` | `1` | `'de'` |
|
||||
| `5` | `0` | `'scending": '` |
|
||||
| `6` | `-1` | `'tru'` |
|
||||
| `7` | `1` | `'fals'` |
|
||||
| `8` | `0` | `'e,'` |
|
||||
|
||||
The length difference `b.length - a.length` is equal to the sum of `diffItems[i][0]` values times `diffItems[i][1]` lengths. In this example, the difference `48 - 38` is equal to the sum `10`.
|
||||
|
||||
| category of diff item | `[0]` | `[1]` lengths | subtotal |
|
||||
| :-------------------- | ----: | -----------------: | -------: |
|
||||
| in common | `0` | `11 + 10 + 11 + 2` | `0` |
|
||||
| to delete from `a` | `–1` | `1 + 3` | `-4` |
|
||||
| to insert from `b` | `1` | `8 + 2 + 4` | `14` |
|
||||
|
||||
Instead of formatting the changed substrings with escape codes for colors in the `foundSubsequence` function to save memory, this example spends memory to **gain flexibility** before formatting, so a separate heuristic algorithm might modify the generic array of diff items to show changes more clearly:
|
||||
|
||||
| `i` | `diffItems[i][0]` | `diffItems[i][1]` |
|
||||
| --: | ----------------: | :---------------- |
|
||||
| `6` | `-1` | `'true'` |
|
||||
| `7` | `1` | `'false'` |
|
||||
| `8` | `0` | `','` |
|
||||
|
||||
For expected and received strings of serialized data, the result of finding changed **lines**, and then finding changed **substrings** within adjacent changed lines (as in the preceding two examples) sometimes displays the changes in a more intuitive way than the result of finding changed substrings, and then splitting them into changed and unchanged lines.
|
38
node_modules/diff-sequences/build/index.d.ts
generated
vendored
38
node_modules/diff-sequences/build/index.d.ts
generated
vendored
@ -1,38 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
export declare type Callbacks = {
|
||||
foundSubsequence: FoundSubsequence;
|
||||
isCommon: IsCommon;
|
||||
};
|
||||
|
||||
declare function diffSequence(
|
||||
aLength: number,
|
||||
bLength: number,
|
||||
isCommon: IsCommon,
|
||||
foundSubsequence: FoundSubsequence,
|
||||
): void;
|
||||
export default diffSequence;
|
||||
|
||||
declare type FoundSubsequence = (
|
||||
nCommon: number, // caller can assume: 0 < nCommon
|
||||
aCommon: number, // caller can assume: 0 <= aCommon && aCommon < aLength
|
||||
bCommon: number,
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
declare type IsCommon = (
|
||||
aIndex: number, // caller can assume: 0 <= aIndex && aIndex < aLength
|
||||
bIndex: number,
|
||||
) => boolean;
|
||||
|
||||
export {};
|
802
node_modules/diff-sequences/build/index.js
generated
vendored
802
node_modules/diff-sequences/build/index.js
generated
vendored
@ -1,802 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = diffSequence;
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
|
||||
// This diff-sequences package implements the linear space variation in
|
||||
// An O(ND) Difference Algorithm and Its Variations by Eugene W. Myers
|
||||
|
||||
// Relationship in notation between Myers paper and this package:
|
||||
// A is a
|
||||
// N is aLength, aEnd - aStart, and so on
|
||||
// x is aIndex, aFirst, aLast, and so on
|
||||
// B is b
|
||||
// M is bLength, bEnd - bStart, and so on
|
||||
// y is bIndex, bFirst, bLast, and so on
|
||||
// Δ = N - M is negative of baDeltaLength = bLength - aLength
|
||||
// D is d
|
||||
// k is kF
|
||||
// k + Δ is kF = kR - baDeltaLength
|
||||
// V is aIndexesF or aIndexesR (see comment below about Indexes type)
|
||||
// index intervals [1, N] and [1, M] are [0, aLength) and [0, bLength)
|
||||
// starting point in forward direction (0, 0) is (-1, -1)
|
||||
// starting point in reverse direction (N + 1, M + 1) is (aLength, bLength)
|
||||
|
||||
// The “edit graph” for sequences a and b corresponds to items:
|
||||
// in a on the horizontal axis
|
||||
// in b on the vertical axis
|
||||
//
|
||||
// Given a-coordinate of a point in a diagonal, you can compute b-coordinate.
|
||||
//
|
||||
// Forward diagonals kF:
|
||||
// zero diagonal intersects top left corner
|
||||
// positive diagonals intersect top edge
|
||||
// negative diagonals insersect left edge
|
||||
//
|
||||
// Reverse diagonals kR:
|
||||
// zero diagonal intersects bottom right corner
|
||||
// positive diagonals intersect right edge
|
||||
// negative diagonals intersect bottom edge
|
||||
|
||||
// The graph contains a directed acyclic graph of edges:
|
||||
// horizontal: delete an item from a
|
||||
// vertical: insert an item from b
|
||||
// diagonal: common item in a and b
|
||||
//
|
||||
// The algorithm solves dual problems in the graph analogy:
|
||||
// Find longest common subsequence: path with maximum number of diagonal edges
|
||||
// Find shortest edit script: path with minimum number of non-diagonal edges
|
||||
|
||||
// Input callback function compares items at indexes in the sequences.
|
||||
|
||||
// Output callback function receives the number of adjacent items
|
||||
// and starting indexes of each common subsequence.
|
||||
|
||||
// Either original functions or wrapped to swap indexes if graph is transposed.
|
||||
|
||||
// Indexes in sequence a of last point of forward or reverse paths in graph.
|
||||
// Myers algorithm indexes by diagonal k which for negative is bad deopt in V8.
|
||||
// This package indexes by iF and iR which are greater than or equal to zero.
|
||||
// and also updates the index arrays in place to cut memory in half.
|
||||
// kF = 2 * iF - d
|
||||
// kR = d - 2 * iR
|
||||
|
||||
// Division of index intervals in sequences a and b at the middle change.
|
||||
// Invariant: intervals do not have common items at the start or end.
|
||||
|
||||
const pkg = 'diff-sequences'; // for error messages
|
||||
const NOT_YET_SET = 0; // small int instead of undefined to avoid deopt in V8
|
||||
|
||||
// Return the number of common items that follow in forward direction.
|
||||
// The length of what Myers paper calls a “snake” in a forward path.
|
||||
const countCommonItemsF = (aIndex, aEnd, bIndex, bEnd, isCommon) => {
|
||||
let nCommon = 0;
|
||||
while (aIndex < aEnd && bIndex < bEnd && isCommon(aIndex, bIndex)) {
|
||||
aIndex += 1;
|
||||
bIndex += 1;
|
||||
nCommon += 1;
|
||||
}
|
||||
return nCommon;
|
||||
};
|
||||
|
||||
// Return the number of common items that precede in reverse direction.
|
||||
// The length of what Myers paper calls a “snake” in a reverse path.
|
||||
const countCommonItemsR = (aStart, aIndex, bStart, bIndex, isCommon) => {
|
||||
let nCommon = 0;
|
||||
while (aStart <= aIndex && bStart <= bIndex && isCommon(aIndex, bIndex)) {
|
||||
aIndex -= 1;
|
||||
bIndex -= 1;
|
||||
nCommon += 1;
|
||||
}
|
||||
return nCommon;
|
||||
};
|
||||
|
||||
// A simple function to extend forward paths from (d - 1) to d changes
|
||||
// when forward and reverse paths cannot yet overlap.
|
||||
const extendPathsF = (
|
||||
d,
|
||||
aEnd,
|
||||
bEnd,
|
||||
bF,
|
||||
isCommon,
|
||||
aIndexesF,
|
||||
iMaxF // return the value because optimization might decrease it
|
||||
) => {
|
||||
// Unroll the first iteration.
|
||||
let iF = 0;
|
||||
let kF = -d; // kF = 2 * iF - d
|
||||
let aFirst = aIndexesF[iF]; // in first iteration always insert
|
||||
let aIndexPrev1 = aFirst; // prev value of [iF - 1] in next iteration
|
||||
aIndexesF[iF] += countCommonItemsF(
|
||||
aFirst + 1,
|
||||
aEnd,
|
||||
bF + aFirst - kF + 1,
|
||||
bEnd,
|
||||
isCommon
|
||||
);
|
||||
|
||||
// Optimization: skip diagonals in which paths cannot ever overlap.
|
||||
const nF = d < iMaxF ? d : iMaxF;
|
||||
|
||||
// The diagonals kF are odd when d is odd and even when d is even.
|
||||
for (iF += 1, kF += 2; iF <= nF; iF += 1, kF += 2) {
|
||||
// To get first point of path segment, move one change in forward direction
|
||||
// from last point of previous path segment in an adjacent diagonal.
|
||||
// In last possible iteration when iF === d and kF === d always delete.
|
||||
if (iF !== d && aIndexPrev1 < aIndexesF[iF]) {
|
||||
aFirst = aIndexesF[iF]; // vertical to insert from b
|
||||
} else {
|
||||
aFirst = aIndexPrev1 + 1; // horizontal to delete from a
|
||||
|
||||
if (aEnd <= aFirst) {
|
||||
// Optimization: delete moved past right of graph.
|
||||
return iF - 1;
|
||||
}
|
||||
}
|
||||
|
||||
// To get last point of path segment, move along diagonal of common items.
|
||||
aIndexPrev1 = aIndexesF[iF];
|
||||
aIndexesF[iF] =
|
||||
aFirst +
|
||||
countCommonItemsF(aFirst + 1, aEnd, bF + aFirst - kF + 1, bEnd, isCommon);
|
||||
}
|
||||
return iMaxF;
|
||||
};
|
||||
|
||||
// A simple function to extend reverse paths from (d - 1) to d changes
|
||||
// when reverse and forward paths cannot yet overlap.
|
||||
const extendPathsR = (
|
||||
d,
|
||||
aStart,
|
||||
bStart,
|
||||
bR,
|
||||
isCommon,
|
||||
aIndexesR,
|
||||
iMaxR // return the value because optimization might decrease it
|
||||
) => {
|
||||
// Unroll the first iteration.
|
||||
let iR = 0;
|
||||
let kR = d; // kR = d - 2 * iR
|
||||
let aFirst = aIndexesR[iR]; // in first iteration always insert
|
||||
let aIndexPrev1 = aFirst; // prev value of [iR - 1] in next iteration
|
||||
aIndexesR[iR] -= countCommonItemsR(
|
||||
aStart,
|
||||
aFirst - 1,
|
||||
bStart,
|
||||
bR + aFirst - kR - 1,
|
||||
isCommon
|
||||
);
|
||||
|
||||
// Optimization: skip diagonals in which paths cannot ever overlap.
|
||||
const nR = d < iMaxR ? d : iMaxR;
|
||||
|
||||
// The diagonals kR are odd when d is odd and even when d is even.
|
||||
for (iR += 1, kR -= 2; iR <= nR; iR += 1, kR -= 2) {
|
||||
// To get first point of path segment, move one change in reverse direction
|
||||
// from last point of previous path segment in an adjacent diagonal.
|
||||
// In last possible iteration when iR === d and kR === -d always delete.
|
||||
if (iR !== d && aIndexesR[iR] < aIndexPrev1) {
|
||||
aFirst = aIndexesR[iR]; // vertical to insert from b
|
||||
} else {
|
||||
aFirst = aIndexPrev1 - 1; // horizontal to delete from a
|
||||
|
||||
if (aFirst < aStart) {
|
||||
// Optimization: delete moved past left of graph.
|
||||
return iR - 1;
|
||||
}
|
||||
}
|
||||
|
||||
// To get last point of path segment, move along diagonal of common items.
|
||||
aIndexPrev1 = aIndexesR[iR];
|
||||
aIndexesR[iR] =
|
||||
aFirst -
|
||||
countCommonItemsR(
|
||||
aStart,
|
||||
aFirst - 1,
|
||||
bStart,
|
||||
bR + aFirst - kR - 1,
|
||||
isCommon
|
||||
);
|
||||
}
|
||||
return iMaxR;
|
||||
};
|
||||
|
||||
// A complete function to extend forward paths from (d - 1) to d changes.
|
||||
// Return true if a path overlaps reverse path of (d - 1) changes in its diagonal.
|
||||
const extendOverlappablePathsF = (
|
||||
d,
|
||||
aStart,
|
||||
aEnd,
|
||||
bStart,
|
||||
bEnd,
|
||||
isCommon,
|
||||
aIndexesF,
|
||||
iMaxF,
|
||||
aIndexesR,
|
||||
iMaxR,
|
||||
division // update prop values if return true
|
||||
) => {
|
||||
const bF = bStart - aStart; // bIndex = bF + aIndex - kF
|
||||
const aLength = aEnd - aStart;
|
||||
const bLength = bEnd - bStart;
|
||||
const baDeltaLength = bLength - aLength; // kF = kR - baDeltaLength
|
||||
|
||||
// Range of diagonals in which forward and reverse paths might overlap.
|
||||
const kMinOverlapF = -baDeltaLength - (d - 1); // -(d - 1) <= kR
|
||||
const kMaxOverlapF = -baDeltaLength + (d - 1); // kR <= (d - 1)
|
||||
|
||||
let aIndexPrev1 = NOT_YET_SET; // prev value of [iF - 1] in next iteration
|
||||
|
||||
// Optimization: skip diagonals in which paths cannot ever overlap.
|
||||
const nF = d < iMaxF ? d : iMaxF;
|
||||
|
||||
// The diagonals kF = 2 * iF - d are odd when d is odd and even when d is even.
|
||||
for (let iF = 0, kF = -d; iF <= nF; iF += 1, kF += 2) {
|
||||
// To get first point of path segment, move one change in forward direction
|
||||
// from last point of previous path segment in an adjacent diagonal.
|
||||
// In first iteration when iF === 0 and kF === -d always insert.
|
||||
// In last possible iteration when iF === d and kF === d always delete.
|
||||
const insert = iF === 0 || (iF !== d && aIndexPrev1 < aIndexesF[iF]);
|
||||
const aLastPrev = insert ? aIndexesF[iF] : aIndexPrev1;
|
||||
const aFirst = insert
|
||||
? aLastPrev // vertical to insert from b
|
||||
: aLastPrev + 1; // horizontal to delete from a
|
||||
|
||||
// To get last point of path segment, move along diagonal of common items.
|
||||
const bFirst = bF + aFirst - kF;
|
||||
const nCommonF = countCommonItemsF(
|
||||
aFirst + 1,
|
||||
aEnd,
|
||||
bFirst + 1,
|
||||
bEnd,
|
||||
isCommon
|
||||
);
|
||||
const aLast = aFirst + nCommonF;
|
||||
aIndexPrev1 = aIndexesF[iF];
|
||||
aIndexesF[iF] = aLast;
|
||||
if (kMinOverlapF <= kF && kF <= kMaxOverlapF) {
|
||||
// Solve for iR of reverse path with (d - 1) changes in diagonal kF:
|
||||
// kR = kF + baDeltaLength
|
||||
// kR = (d - 1) - 2 * iR
|
||||
const iR = (d - 1 - (kF + baDeltaLength)) / 2;
|
||||
|
||||
// If this forward path overlaps the reverse path in this diagonal,
|
||||
// then this is the middle change of the index intervals.
|
||||
if (iR <= iMaxR && aIndexesR[iR] - 1 <= aLast) {
|
||||
// Unlike the Myers algorithm which finds only the middle “snake”
|
||||
// this package can find two common subsequences per division.
|
||||
// Last point of previous path segment is on an adjacent diagonal.
|
||||
const bLastPrev = bF + aLastPrev - (insert ? kF + 1 : kF - 1);
|
||||
|
||||
// Because of invariant that intervals preceding the middle change
|
||||
// cannot have common items at the end,
|
||||
// move in reverse direction along a diagonal of common items.
|
||||
const nCommonR = countCommonItemsR(
|
||||
aStart,
|
||||
aLastPrev,
|
||||
bStart,
|
||||
bLastPrev,
|
||||
isCommon
|
||||
);
|
||||
const aIndexPrevFirst = aLastPrev - nCommonR;
|
||||
const bIndexPrevFirst = bLastPrev - nCommonR;
|
||||
const aEndPreceding = aIndexPrevFirst + 1;
|
||||
const bEndPreceding = bIndexPrevFirst + 1;
|
||||
division.nChangePreceding = d - 1;
|
||||
if (d - 1 === aEndPreceding + bEndPreceding - aStart - bStart) {
|
||||
// Optimization: number of preceding changes in forward direction
|
||||
// is equal to number of items in preceding interval,
|
||||
// therefore it cannot contain any common items.
|
||||
division.aEndPreceding = aStart;
|
||||
division.bEndPreceding = bStart;
|
||||
} else {
|
||||
division.aEndPreceding = aEndPreceding;
|
||||
division.bEndPreceding = bEndPreceding;
|
||||
}
|
||||
division.nCommonPreceding = nCommonR;
|
||||
if (nCommonR !== 0) {
|
||||
division.aCommonPreceding = aEndPreceding;
|
||||
division.bCommonPreceding = bEndPreceding;
|
||||
}
|
||||
division.nCommonFollowing = nCommonF;
|
||||
if (nCommonF !== 0) {
|
||||
division.aCommonFollowing = aFirst + 1;
|
||||
division.bCommonFollowing = bFirst + 1;
|
||||
}
|
||||
const aStartFollowing = aLast + 1;
|
||||
const bStartFollowing = bFirst + nCommonF + 1;
|
||||
division.nChangeFollowing = d - 1;
|
||||
if (d - 1 === aEnd + bEnd - aStartFollowing - bStartFollowing) {
|
||||
// Optimization: number of changes in reverse direction
|
||||
// is equal to number of items in following interval,
|
||||
// therefore it cannot contain any common items.
|
||||
division.aStartFollowing = aEnd;
|
||||
division.bStartFollowing = bEnd;
|
||||
} else {
|
||||
division.aStartFollowing = aStartFollowing;
|
||||
division.bStartFollowing = bStartFollowing;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
// A complete function to extend reverse paths from (d - 1) to d changes.
|
||||
// Return true if a path overlaps forward path of d changes in its diagonal.
|
||||
const extendOverlappablePathsR = (
|
||||
d,
|
||||
aStart,
|
||||
aEnd,
|
||||
bStart,
|
||||
bEnd,
|
||||
isCommon,
|
||||
aIndexesF,
|
||||
iMaxF,
|
||||
aIndexesR,
|
||||
iMaxR,
|
||||
division // update prop values if return true
|
||||
) => {
|
||||
const bR = bEnd - aEnd; // bIndex = bR + aIndex - kR
|
||||
const aLength = aEnd - aStart;
|
||||
const bLength = bEnd - bStart;
|
||||
const baDeltaLength = bLength - aLength; // kR = kF + baDeltaLength
|
||||
|
||||
// Range of diagonals in which forward and reverse paths might overlap.
|
||||
const kMinOverlapR = baDeltaLength - d; // -d <= kF
|
||||
const kMaxOverlapR = baDeltaLength + d; // kF <= d
|
||||
|
||||
let aIndexPrev1 = NOT_YET_SET; // prev value of [iR - 1] in next iteration
|
||||
|
||||
// Optimization: skip diagonals in which paths cannot ever overlap.
|
||||
const nR = d < iMaxR ? d : iMaxR;
|
||||
|
||||
// The diagonals kR = d - 2 * iR are odd when d is odd and even when d is even.
|
||||
for (let iR = 0, kR = d; iR <= nR; iR += 1, kR -= 2) {
|
||||
// To get first point of path segment, move one change in reverse direction
|
||||
// from last point of previous path segment in an adjacent diagonal.
|
||||
// In first iteration when iR === 0 and kR === d always insert.
|
||||
// In last possible iteration when iR === d and kR === -d always delete.
|
||||
const insert = iR === 0 || (iR !== d && aIndexesR[iR] < aIndexPrev1);
|
||||
const aLastPrev = insert ? aIndexesR[iR] : aIndexPrev1;
|
||||
const aFirst = insert
|
||||
? aLastPrev // vertical to insert from b
|
||||
: aLastPrev - 1; // horizontal to delete from a
|
||||
|
||||
// To get last point of path segment, move along diagonal of common items.
|
||||
const bFirst = bR + aFirst - kR;
|
||||
const nCommonR = countCommonItemsR(
|
||||
aStart,
|
||||
aFirst - 1,
|
||||
bStart,
|
||||
bFirst - 1,
|
||||
isCommon
|
||||
);
|
||||
const aLast = aFirst - nCommonR;
|
||||
aIndexPrev1 = aIndexesR[iR];
|
||||
aIndexesR[iR] = aLast;
|
||||
if (kMinOverlapR <= kR && kR <= kMaxOverlapR) {
|
||||
// Solve for iF of forward path with d changes in diagonal kR:
|
||||
// kF = kR - baDeltaLength
|
||||
// kF = 2 * iF - d
|
||||
const iF = (d + (kR - baDeltaLength)) / 2;
|
||||
|
||||
// If this reverse path overlaps the forward path in this diagonal,
|
||||
// then this is a middle change of the index intervals.
|
||||
if (iF <= iMaxF && aLast - 1 <= aIndexesF[iF]) {
|
||||
const bLast = bFirst - nCommonR;
|
||||
division.nChangePreceding = d;
|
||||
if (d === aLast + bLast - aStart - bStart) {
|
||||
// Optimization: number of changes in reverse direction
|
||||
// is equal to number of items in preceding interval,
|
||||
// therefore it cannot contain any common items.
|
||||
division.aEndPreceding = aStart;
|
||||
division.bEndPreceding = bStart;
|
||||
} else {
|
||||
division.aEndPreceding = aLast;
|
||||
division.bEndPreceding = bLast;
|
||||
}
|
||||
division.nCommonPreceding = nCommonR;
|
||||
if (nCommonR !== 0) {
|
||||
// The last point of reverse path segment is start of common subsequence.
|
||||
division.aCommonPreceding = aLast;
|
||||
division.bCommonPreceding = bLast;
|
||||
}
|
||||
division.nChangeFollowing = d - 1;
|
||||
if (d === 1) {
|
||||
// There is no previous path segment.
|
||||
division.nCommonFollowing = 0;
|
||||
division.aStartFollowing = aEnd;
|
||||
division.bStartFollowing = bEnd;
|
||||
} else {
|
||||
// Unlike the Myers algorithm which finds only the middle “snake”
|
||||
// this package can find two common subsequences per division.
|
||||
// Last point of previous path segment is on an adjacent diagonal.
|
||||
const bLastPrev = bR + aLastPrev - (insert ? kR - 1 : kR + 1);
|
||||
|
||||
// Because of invariant that intervals following the middle change
|
||||
// cannot have common items at the start,
|
||||
// move in forward direction along a diagonal of common items.
|
||||
const nCommonF = countCommonItemsF(
|
||||
aLastPrev,
|
||||
aEnd,
|
||||
bLastPrev,
|
||||
bEnd,
|
||||
isCommon
|
||||
);
|
||||
division.nCommonFollowing = nCommonF;
|
||||
if (nCommonF !== 0) {
|
||||
// The last point of reverse path segment is start of common subsequence.
|
||||
division.aCommonFollowing = aLastPrev;
|
||||
division.bCommonFollowing = bLastPrev;
|
||||
}
|
||||
const aStartFollowing = aLastPrev + nCommonF; // aFirstPrev
|
||||
const bStartFollowing = bLastPrev + nCommonF; // bFirstPrev
|
||||
|
||||
if (d - 1 === aEnd + bEnd - aStartFollowing - bStartFollowing) {
|
||||
// Optimization: number of changes in forward direction
|
||||
// is equal to number of items in following interval,
|
||||
// therefore it cannot contain any common items.
|
||||
division.aStartFollowing = aEnd;
|
||||
division.bStartFollowing = bEnd;
|
||||
} else {
|
||||
division.aStartFollowing = aStartFollowing;
|
||||
division.bStartFollowing = bStartFollowing;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
// Given index intervals and input function to compare items at indexes,
|
||||
// divide at the middle change.
|
||||
//
|
||||
// DO NOT CALL if start === end, because interval cannot contain common items
|
||||
// and because this function will throw the “no overlap” error.
|
||||
const divide = (
|
||||
nChange,
|
||||
aStart,
|
||||
aEnd,
|
||||
bStart,
|
||||
bEnd,
|
||||
isCommon,
|
||||
aIndexesF,
|
||||
aIndexesR,
|
||||
division // output
|
||||
) => {
|
||||
const bF = bStart - aStart; // bIndex = bF + aIndex - kF
|
||||
const bR = bEnd - aEnd; // bIndex = bR + aIndex - kR
|
||||
const aLength = aEnd - aStart;
|
||||
const bLength = bEnd - bStart;
|
||||
|
||||
// Because graph has square or portrait orientation,
|
||||
// length difference is minimum number of items to insert from b.
|
||||
// Corresponding forward and reverse diagonals in graph
|
||||
// depend on length difference of the sequences:
|
||||
// kF = kR - baDeltaLength
|
||||
// kR = kF + baDeltaLength
|
||||
const baDeltaLength = bLength - aLength;
|
||||
|
||||
// Optimization: max diagonal in graph intersects corner of shorter side.
|
||||
let iMaxF = aLength;
|
||||
let iMaxR = aLength;
|
||||
|
||||
// Initialize no changes yet in forward or reverse direction:
|
||||
aIndexesF[0] = aStart - 1; // at open start of interval, outside closed start
|
||||
aIndexesR[0] = aEnd; // at open end of interval
|
||||
|
||||
if (baDeltaLength % 2 === 0) {
|
||||
// The number of changes in paths is 2 * d if length difference is even.
|
||||
const dMin = (nChange || baDeltaLength) / 2;
|
||||
const dMax = (aLength + bLength) / 2;
|
||||
for (let d = 1; d <= dMax; d += 1) {
|
||||
iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF);
|
||||
if (d < dMin) {
|
||||
iMaxR = extendPathsR(d, aStart, bStart, bR, isCommon, aIndexesR, iMaxR);
|
||||
} else if (
|
||||
// If a reverse path overlaps a forward path in the same diagonal,
|
||||
// return a division of the index intervals at the middle change.
|
||||
extendOverlappablePathsR(
|
||||
d,
|
||||
aStart,
|
||||
aEnd,
|
||||
bStart,
|
||||
bEnd,
|
||||
isCommon,
|
||||
aIndexesF,
|
||||
iMaxF,
|
||||
aIndexesR,
|
||||
iMaxR,
|
||||
division
|
||||
)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// The number of changes in paths is 2 * d - 1 if length difference is odd.
|
||||
const dMin = ((nChange || baDeltaLength) + 1) / 2;
|
||||
const dMax = (aLength + bLength + 1) / 2;
|
||||
|
||||
// Unroll first half iteration so loop extends the relevant pairs of paths.
|
||||
// Because of invariant that intervals have no common items at start or end,
|
||||
// and limitation not to call divide with empty intervals,
|
||||
// therefore it cannot be called if a forward path with one change
|
||||
// would overlap a reverse path with no changes, even if dMin === 1.
|
||||
let d = 1;
|
||||
iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF);
|
||||
for (d += 1; d <= dMax; d += 1) {
|
||||
iMaxR = extendPathsR(
|
||||
d - 1,
|
||||
aStart,
|
||||
bStart,
|
||||
bR,
|
||||
isCommon,
|
||||
aIndexesR,
|
||||
iMaxR
|
||||
);
|
||||
if (d < dMin) {
|
||||
iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF);
|
||||
} else if (
|
||||
// If a forward path overlaps a reverse path in the same diagonal,
|
||||
// return a division of the index intervals at the middle change.
|
||||
extendOverlappablePathsF(
|
||||
d,
|
||||
aStart,
|
||||
aEnd,
|
||||
bStart,
|
||||
bEnd,
|
||||
isCommon,
|
||||
aIndexesF,
|
||||
iMaxF,
|
||||
aIndexesR,
|
||||
iMaxR,
|
||||
division
|
||||
)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* istanbul ignore next */
|
||||
throw new Error(
|
||||
`${pkg}: no overlap aStart=${aStart} aEnd=${aEnd} bStart=${bStart} bEnd=${bEnd}`
|
||||
);
|
||||
};
|
||||
|
||||
// Given index intervals and input function to compare items at indexes,
|
||||
// return by output function the number of adjacent items and starting indexes
|
||||
// of each common subsequence. Divide and conquer with only linear space.
|
||||
//
|
||||
// The index intervals are half open [start, end) like array slice method.
|
||||
// DO NOT CALL if start === end, because interval cannot contain common items
|
||||
// and because divide function will throw the “no overlap” error.
|
||||
const findSubsequences = (
|
||||
nChange,
|
||||
aStart,
|
||||
aEnd,
|
||||
bStart,
|
||||
bEnd,
|
||||
transposed,
|
||||
callbacks,
|
||||
aIndexesF,
|
||||
aIndexesR,
|
||||
division // temporary memory, not input nor output
|
||||
) => {
|
||||
if (bEnd - bStart < aEnd - aStart) {
|
||||
// Transpose graph so it has portrait instead of landscape orientation.
|
||||
// Always compare shorter to longer sequence for consistency and optimization.
|
||||
transposed = !transposed;
|
||||
if (transposed && callbacks.length === 1) {
|
||||
// Lazily wrap callback functions to swap args if graph is transposed.
|
||||
const {foundSubsequence, isCommon} = callbacks[0];
|
||||
callbacks[1] = {
|
||||
foundSubsequence: (nCommon, bCommon, aCommon) => {
|
||||
foundSubsequence(nCommon, aCommon, bCommon);
|
||||
},
|
||||
isCommon: (bIndex, aIndex) => isCommon(aIndex, bIndex)
|
||||
};
|
||||
}
|
||||
const tStart = aStart;
|
||||
const tEnd = aEnd;
|
||||
aStart = bStart;
|
||||
aEnd = bEnd;
|
||||
bStart = tStart;
|
||||
bEnd = tEnd;
|
||||
}
|
||||
const {foundSubsequence, isCommon} = callbacks[transposed ? 1 : 0];
|
||||
|
||||
// Divide the index intervals at the middle change.
|
||||
divide(
|
||||
nChange,
|
||||
aStart,
|
||||
aEnd,
|
||||
bStart,
|
||||
bEnd,
|
||||
isCommon,
|
||||
aIndexesF,
|
||||
aIndexesR,
|
||||
division
|
||||
);
|
||||
const {
|
||||
nChangePreceding,
|
||||
aEndPreceding,
|
||||
bEndPreceding,
|
||||
nCommonPreceding,
|
||||
aCommonPreceding,
|
||||
bCommonPreceding,
|
||||
nCommonFollowing,
|
||||
aCommonFollowing,
|
||||
bCommonFollowing,
|
||||
nChangeFollowing,
|
||||
aStartFollowing,
|
||||
bStartFollowing
|
||||
} = division;
|
||||
|
||||
// Unless either index interval is empty, they might contain common items.
|
||||
if (aStart < aEndPreceding && bStart < bEndPreceding) {
|
||||
// Recursely find and return common subsequences preceding the division.
|
||||
findSubsequences(
|
||||
nChangePreceding,
|
||||
aStart,
|
||||
aEndPreceding,
|
||||
bStart,
|
||||
bEndPreceding,
|
||||
transposed,
|
||||
callbacks,
|
||||
aIndexesF,
|
||||
aIndexesR,
|
||||
division
|
||||
);
|
||||
}
|
||||
|
||||
// Return common subsequences that are adjacent to the middle change.
|
||||
if (nCommonPreceding !== 0) {
|
||||
foundSubsequence(nCommonPreceding, aCommonPreceding, bCommonPreceding);
|
||||
}
|
||||
if (nCommonFollowing !== 0) {
|
||||
foundSubsequence(nCommonFollowing, aCommonFollowing, bCommonFollowing);
|
||||
}
|
||||
|
||||
// Unless either index interval is empty, they might contain common items.
|
||||
if (aStartFollowing < aEnd && bStartFollowing < bEnd) {
|
||||
// Recursely find and return common subsequences following the division.
|
||||
findSubsequences(
|
||||
nChangeFollowing,
|
||||
aStartFollowing,
|
||||
aEnd,
|
||||
bStartFollowing,
|
||||
bEnd,
|
||||
transposed,
|
||||
callbacks,
|
||||
aIndexesF,
|
||||
aIndexesR,
|
||||
division
|
||||
);
|
||||
}
|
||||
};
|
||||
const validateLength = (name, arg) => {
|
||||
if (typeof arg !== 'number') {
|
||||
throw new TypeError(`${pkg}: ${name} typeof ${typeof arg} is not a number`);
|
||||
}
|
||||
if (!Number.isSafeInteger(arg)) {
|
||||
throw new RangeError(`${pkg}: ${name} value ${arg} is not a safe integer`);
|
||||
}
|
||||
if (arg < 0) {
|
||||
throw new RangeError(`${pkg}: ${name} value ${arg} is a negative integer`);
|
||||
}
|
||||
};
|
||||
const validateCallback = (name, arg) => {
|
||||
const type = typeof arg;
|
||||
if (type !== 'function') {
|
||||
throw new TypeError(`${pkg}: ${name} typeof ${type} is not a function`);
|
||||
}
|
||||
};
|
||||
|
||||
// Compare items in two sequences to find a longest common subsequence.
|
||||
// Given lengths of sequences and input function to compare items at indexes,
|
||||
// return by output function the number of adjacent items and starting indexes
|
||||
// of each common subsequence.
|
||||
function diffSequence(aLength, bLength, isCommon, foundSubsequence) {
|
||||
validateLength('aLength', aLength);
|
||||
validateLength('bLength', bLength);
|
||||
validateCallback('isCommon', isCommon);
|
||||
validateCallback('foundSubsequence', foundSubsequence);
|
||||
|
||||
// Count common items from the start in the forward direction.
|
||||
const nCommonF = countCommonItemsF(0, aLength, 0, bLength, isCommon);
|
||||
if (nCommonF !== 0) {
|
||||
foundSubsequence(nCommonF, 0, 0);
|
||||
}
|
||||
|
||||
// Unless both sequences consist of common items only,
|
||||
// find common items in the half-trimmed index intervals.
|
||||
if (aLength !== nCommonF || bLength !== nCommonF) {
|
||||
// Invariant: intervals do not have common items at the start.
|
||||
// The start of an index interval is closed like array slice method.
|
||||
const aStart = nCommonF;
|
||||
const bStart = nCommonF;
|
||||
|
||||
// Count common items from the end in the reverse direction.
|
||||
const nCommonR = countCommonItemsR(
|
||||
aStart,
|
||||
aLength - 1,
|
||||
bStart,
|
||||
bLength - 1,
|
||||
isCommon
|
||||
);
|
||||
|
||||
// Invariant: intervals do not have common items at the end.
|
||||
// The end of an index interval is open like array slice method.
|
||||
const aEnd = aLength - nCommonR;
|
||||
const bEnd = bLength - nCommonR;
|
||||
|
||||
// Unless one sequence consists of common items only,
|
||||
// therefore the other trimmed index interval consists of changes only,
|
||||
// find common items in the trimmed index intervals.
|
||||
const nCommonFR = nCommonF + nCommonR;
|
||||
if (aLength !== nCommonFR && bLength !== nCommonFR) {
|
||||
const nChange = 0; // number of change items is not yet known
|
||||
const transposed = false; // call the original unwrapped functions
|
||||
const callbacks = [
|
||||
{
|
||||
foundSubsequence,
|
||||
isCommon
|
||||
}
|
||||
];
|
||||
|
||||
// Indexes in sequence a of last points in furthest reaching paths
|
||||
// from outside the start at top left in the forward direction:
|
||||
const aIndexesF = [NOT_YET_SET];
|
||||
// from the end at bottom right in the reverse direction:
|
||||
const aIndexesR = [NOT_YET_SET];
|
||||
|
||||
// Initialize one object as output of all calls to divide function.
|
||||
const division = {
|
||||
aCommonFollowing: NOT_YET_SET,
|
||||
aCommonPreceding: NOT_YET_SET,
|
||||
aEndPreceding: NOT_YET_SET,
|
||||
aStartFollowing: NOT_YET_SET,
|
||||
bCommonFollowing: NOT_YET_SET,
|
||||
bCommonPreceding: NOT_YET_SET,
|
||||
bEndPreceding: NOT_YET_SET,
|
||||
bStartFollowing: NOT_YET_SET,
|
||||
nChangeFollowing: NOT_YET_SET,
|
||||
nChangePreceding: NOT_YET_SET,
|
||||
nCommonFollowing: NOT_YET_SET,
|
||||
nCommonPreceding: NOT_YET_SET
|
||||
};
|
||||
|
||||
// Find and return common subsequences in the trimmed index intervals.
|
||||
findSubsequences(
|
||||
nChange,
|
||||
aStart,
|
||||
aEnd,
|
||||
bStart,
|
||||
bEnd,
|
||||
transposed,
|
||||
callbacks,
|
||||
aIndexesF,
|
||||
aIndexesR,
|
||||
division
|
||||
);
|
||||
}
|
||||
if (nCommonR !== 0) {
|
||||
foundSubsequence(nCommonR, aEnd, bEnd);
|
||||
}
|
||||
}
|
||||
}
|
39
node_modules/diff-sequences/package.json
generated
vendored
39
node_modules/diff-sequences/package.json
generated
vendored
@ -1,39 +0,0 @@
|
||||
{
|
||||
"name": "diff-sequences",
|
||||
"version": "29.3.1",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/facebook/jest.git",
|
||||
"directory": "packages/diff-sequences"
|
||||
},
|
||||
"license": "MIT",
|
||||
"description": "Compare items in two sequences to find a longest common subsequence",
|
||||
"keywords": [
|
||||
"fast",
|
||||
"linear",
|
||||
"space",
|
||||
"callback",
|
||||
"diff"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
|
||||
},
|
||||
"main": "./build/index.js",
|
||||
"types": "./build/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./build/index.d.ts",
|
||||
"default": "./build/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fast-check/jest": "^1.3.0",
|
||||
"benchmark": "^2.1.4",
|
||||
"diff": "^5.0.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "05deb8393c4ad71e19be2567b704dfd3a2ab5fc9"
|
||||
}
|
12
node_modules/escape-string-regexp/index.js
generated
vendored
12
node_modules/escape-string-regexp/index.js
generated
vendored
@ -1,11 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
|
||||
|
||||
module.exports = function (str) {
|
||||
if (typeof str !== 'string') {
|
||||
module.exports = string => {
|
||||
if (typeof string !== 'string') {
|
||||
throw new TypeError('Expected a string');
|
||||
}
|
||||
|
||||
return str.replace(matchOperatorsRe, '\\$&');
|
||||
// Escape characters with special meaning either inside or outside character sets.
|
||||
// Use a simple backslash escape when it’s always valid, and a \unnnn escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.
|
||||
return string
|
||||
.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&')
|
||||
.replace(/-/g, '\\x2d');
|
||||
};
|
||||
|
22
node_modules/escape-string-regexp/license
generated
vendored
22
node_modules/escape-string-regexp/license
generated
vendored
@ -1,21 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
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:
|
||||
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 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.
|
||||
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.
|
||||
|
75
node_modules/escape-string-regexp/package.json
generated
vendored
75
node_modules/escape-string-regexp/package.json
generated
vendored
@ -1,41 +1,38 @@
|
||||
{
|
||||
"name": "escape-string-regexp",
|
||||
"version": "1.0.5",
|
||||
"description": "Escape RegExp special characters",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/escape-string-regexp",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"maintainers": [
|
||||
"Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)",
|
||||
"Joshua Boy Nicolai Appelman <joshua@jbna.nl> (jbna.nl)"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"escape",
|
||||
"regex",
|
||||
"regexp",
|
||||
"re",
|
||||
"regular",
|
||||
"expression",
|
||||
"string",
|
||||
"str",
|
||||
"special",
|
||||
"characters"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
}
|
||||
"name": "escape-string-regexp",
|
||||
"version": "4.0.0",
|
||||
"description": "Escape RegExp special characters",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/escape-string-regexp",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"escape",
|
||||
"regex",
|
||||
"regexp",
|
||||
"regular",
|
||||
"expression",
|
||||
"string",
|
||||
"special",
|
||||
"characters"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.11.0",
|
||||
"xo": "^0.28.3"
|
||||
}
|
||||
}
|
||||
|
21
node_modules/escape-string-regexp/readme.md
generated
vendored
21
node_modules/escape-string-regexp/readme.md
generated
vendored
@ -2,26 +2,33 @@
|
||||
|
||||
> Escape RegExp special characters
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save escape-string-regexp
|
||||
$ npm install escape-string-regexp
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const escapeStringRegexp = require('escape-string-regexp');
|
||||
|
||||
const escapedString = escapeStringRegexp('how much $ for a unicorn?');
|
||||
//=> 'how much \$ for a unicorn\?'
|
||||
const escapedString = escapeStringRegexp('How much $ for a 🦄?');
|
||||
//=> 'How much \\$ for a 🦄\\?'
|
||||
|
||||
new RegExp(escapedString);
|
||||
```
|
||||
|
||||
You can also use this to escape a string that is inserted into the middle of a regex, for example, into a character class.
|
||||
|
||||
## License
|
||||
---
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-escape-string-regexp?utm_source=npm-escape-string-regexp&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>
|
||||
|
21
node_modules/eslint-plugin-jest/LICENSE
generated
vendored
21
node_modules/eslint-plugin-jest/LICENSE
generated
vendored
@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Jonathan Kim
|
||||
|
||||
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.
|
315
node_modules/eslint-plugin-jest/README.md
generated
vendored
315
node_modules/eslint-plugin-jest/README.md
generated
vendored
@ -1,315 +0,0 @@
|
||||
<div align="center">
|
||||
<a href="https://eslint.org/">
|
||||
<img height="150" src="https://eslint.org/assets/images/logo/eslint-logo-color.svg">
|
||||
</a>
|
||||
<a href="https://facebook.github.io/jest/">
|
||||
<img width="150" height="150" vspace="" hspace="25" src="https://jestjs.io/img/jest.png">
|
||||
</a>
|
||||
<h1>eslint-plugin-jest</h1>
|
||||
<p>ESLint plugin for Jest</p>
|
||||
</div>
|
||||
|
||||
[![Actions Status](https://github.com/jest-community/eslint-plugin-jest/actions/workflows/nodejs.yml/badge.svg?branch=main)](https://github.com/jest-community/eslint-plugin-jest/actions)
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
yarn add --dev eslint eslint-plugin-jest
|
||||
```
|
||||
|
||||
**Note:** If you installed ESLint globally then you must also install
|
||||
`eslint-plugin-jest` globally.
|
||||
|
||||
## Usage
|
||||
|
||||
Add `jest` to the plugins section of your `.eslintrc` configuration file. You
|
||||
can omit the `eslint-plugin-` prefix:
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["jest"]
|
||||
}
|
||||
```
|
||||
|
||||
Then configure the rules you want to use under the rules section.
|
||||
|
||||
```json
|
||||
{
|
||||
"rules": {
|
||||
"jest/no-disabled-tests": "warn",
|
||||
"jest/no-focused-tests": "error",
|
||||
"jest/no-identical-title": "error",
|
||||
"jest/prefer-to-have-length": "warn",
|
||||
"jest/valid-expect": "error"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
You can also tell ESLint about the environment variables provided by Jest by
|
||||
doing:
|
||||
|
||||
```json
|
||||
{
|
||||
"env": {
|
||||
"jest/globals": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This is included in all configs shared by this plugin, so can be omitted if
|
||||
extending them.
|
||||
|
||||
#### Aliased Jest globals
|
||||
|
||||
You can tell this plugin about any global Jests you have aliased using the
|
||||
`globalAliases` setting:
|
||||
|
||||
```json
|
||||
{
|
||||
"settings": {
|
||||
"jest": {
|
||||
"globalAliases": {
|
||||
"describe": ["context"],
|
||||
"fdescribe": ["fcontext"],
|
||||
"xdescribe": ["xcontext"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Running rules only on test-related files
|
||||
|
||||
The rules provided by this plugin assume that the files they are checking are
|
||||
test-related. This means it's generally not suitable to include them in your
|
||||
top-level configuration as that applies to all files being linted which can
|
||||
include source files.
|
||||
|
||||
You can use
|
||||
[overrides](https://eslint.org/docs/user-guide/configuring/configuration-files#how-do-overrides-work)
|
||||
to have ESLint apply additional rules to specific files:
|
||||
|
||||
```json
|
||||
{
|
||||
"extends": ["eslint:recommended"],
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["test/**"],
|
||||
"plugins": ["jest"],
|
||||
"extends": ["plugin:jest/recommended"],
|
||||
"rules": { "jest/prefer-expect-assertions": "off" }
|
||||
}
|
||||
],
|
||||
"rules": {
|
||||
"indent": ["error", 2]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Jest `version` setting
|
||||
|
||||
The behaviour of some rules (specifically [`no-deprecated-functions`][]) change
|
||||
depending on the version of Jest being used.
|
||||
|
||||
By default, this plugin will attempt to determine to locate Jest using
|
||||
`require.resolve`, meaning it will start looking in the closest `node_modules`
|
||||
folder to the file being linted and work its way up.
|
||||
|
||||
Since we cache the automatically determined version, if you're linting
|
||||
sub-folders that have different versions of Jest, you may find that the wrong
|
||||
version of Jest is considered when linting. You can work around this by
|
||||
providing the Jest version explicitly in nested ESLint configs:
|
||||
|
||||
```json
|
||||
{
|
||||
"settings": {
|
||||
"jest": {
|
||||
"version": 27
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
To avoid hard-coding a number, you can also fetch it from the installed version
|
||||
of Jest if you use a JavaScript config file such as `.eslintrc.js`:
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
settings: {
|
||||
jest: {
|
||||
version: require('jest/package.json').version,
|
||||
},
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
## Shareable configurations
|
||||
|
||||
### Recommended
|
||||
|
||||
This plugin exports a recommended configuration that enforces good testing
|
||||
practices.
|
||||
|
||||
To enable this configuration use the `extends` property in your `.eslintrc`
|
||||
config file:
|
||||
|
||||
```json
|
||||
{
|
||||
"extends": ["plugin:jest/recommended"]
|
||||
}
|
||||
```
|
||||
|
||||
### Style
|
||||
|
||||
This plugin also exports a configuration named `style`, which adds some
|
||||
stylistic rules, such as `prefer-to-be-null`, which enforces usage of `toBeNull`
|
||||
over `toBe(null)`.
|
||||
|
||||
To enable this configuration use the `extends` property in your `.eslintrc`
|
||||
config file:
|
||||
|
||||
```json
|
||||
{
|
||||
"extends": ["plugin:jest/style"]
|
||||
}
|
||||
```
|
||||
|
||||
See
|
||||
[ESLint documentation](https://eslint.org/docs/user-guide/configuring/configuration-files#extending-configuration-files)
|
||||
for more information about extending configuration files.
|
||||
|
||||
### All
|
||||
|
||||
If you want to enable all rules instead of only some you can do so by adding the
|
||||
`all` configuration to your `.eslintrc` config file:
|
||||
|
||||
```json
|
||||
{
|
||||
"extends": ["plugin:jest/all"]
|
||||
}
|
||||
```
|
||||
|
||||
While the `recommended` and `style` configurations only change in major versions
|
||||
the `all` configuration may change in any release and is thus unsuited for
|
||||
installations requiring long-term consistency.
|
||||
|
||||
## Rules
|
||||
|
||||
<!-- begin auto-generated rules list -->
|
||||
|
||||
💼
|
||||
[Configurations](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations)
|
||||
enabled in.\
|
||||
⚠️ [Configurations](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations)
|
||||
set to warn in.\
|
||||
✅ Set in the `recommended`
|
||||
[configuration](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).\
|
||||
🎨 Set in the `style` [configuration](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).\
|
||||
🔧 Automatically fixable by the
|
||||
[`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).\
|
||||
💡 Manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).\
|
||||
❌ Deprecated.
|
||||
|
||||
| Name | Description | 💼 | ⚠️ | 🔧 | 💡 | ❌ |
|
||||
| :--------------------------------------------------------------------------- | :------------------------------------------------------------------ | :-- | :-- | :-- | :-- | :-- |
|
||||
| [consistent-test-it](docs/rules/consistent-test-it.md) | Enforce `test` and `it` usage conventions | | | 🔧 | | |
|
||||
| [expect-expect](docs/rules/expect-expect.md) | Enforce assertion to be made in a test body | | ✅ | | | |
|
||||
| [max-expects](docs/rules/max-expects.md) | Enforces a maximum number assertion calls in a test body | | | | | |
|
||||
| [max-nested-describe](docs/rules/max-nested-describe.md) | Enforces a maximum depth to nested describe calls | | | | | |
|
||||
| [no-alias-methods](docs/rules/no-alias-methods.md) | Disallow alias methods | ✅ | 🎨 | 🔧 | | |
|
||||
| [no-commented-out-tests](docs/rules/no-commented-out-tests.md) | Disallow commented out tests | | ✅ | | | |
|
||||
| [no-conditional-expect](docs/rules/no-conditional-expect.md) | Disallow calling `expect` conditionally | ✅ | | | | |
|
||||
| [no-conditional-in-test](docs/rules/no-conditional-in-test.md) | Disallow conditional logic in tests | | | | | |
|
||||
| [no-deprecated-functions](docs/rules/no-deprecated-functions.md) | Disallow use of deprecated functions | ✅ | | 🔧 | | |
|
||||
| [no-disabled-tests](docs/rules/no-disabled-tests.md) | Disallow disabled tests | | ✅ | | | |
|
||||
| [no-done-callback](docs/rules/no-done-callback.md) | Disallow using a callback in asynchronous tests and hooks | ✅ | | | 💡 | |
|
||||
| [no-duplicate-hooks](docs/rules/no-duplicate-hooks.md) | Disallow duplicate setup and teardown hooks | | | | | |
|
||||
| [no-export](docs/rules/no-export.md) | Disallow using `exports` in files containing tests | ✅ | | | | |
|
||||
| [no-focused-tests](docs/rules/no-focused-tests.md) | Disallow focused tests | ✅ | | | 💡 | |
|
||||
| [no-hooks](docs/rules/no-hooks.md) | Disallow setup and teardown hooks | | | | | |
|
||||
| [no-identical-title](docs/rules/no-identical-title.md) | Disallow identical titles | ✅ | | | | |
|
||||
| [no-if](docs/rules/no-if.md) | Disallow conditional logic | | | | | ❌ |
|
||||
| [no-interpolation-in-snapshots](docs/rules/no-interpolation-in-snapshots.md) | Disallow string interpolation inside snapshots | ✅ | | | | |
|
||||
| [no-jasmine-globals](docs/rules/no-jasmine-globals.md) | Disallow Jasmine globals | ✅ | | 🔧 | | |
|
||||
| [no-large-snapshots](docs/rules/no-large-snapshots.md) | Disallow large snapshots | | | | | |
|
||||
| [no-mocks-import](docs/rules/no-mocks-import.md) | Disallow manually importing from `__mocks__` | ✅ | | | | |
|
||||
| [no-restricted-jest-methods](docs/rules/no-restricted-jest-methods.md) | Disallow specific `jest.` methods | | | | | |
|
||||
| [no-restricted-matchers](docs/rules/no-restricted-matchers.md) | Disallow specific matchers & modifiers | | | | | |
|
||||
| [no-standalone-expect](docs/rules/no-standalone-expect.md) | Disallow using `expect` outside of `it` or `test` blocks | ✅ | | | | |
|
||||
| [no-test-prefixes](docs/rules/no-test-prefixes.md) | Require using `.only` and `.skip` over `f` and `x` | ✅ | | 🔧 | | |
|
||||
| [no-test-return-statement](docs/rules/no-test-return-statement.md) | Disallow explicitly returning from tests | | | | | |
|
||||
| [prefer-called-with](docs/rules/prefer-called-with.md) | Suggest using `toBeCalledWith()` or `toHaveBeenCalledWith()` | | | | | |
|
||||
| [prefer-comparison-matcher](docs/rules/prefer-comparison-matcher.md) | Suggest using the built-in comparison matchers | | | 🔧 | | |
|
||||
| [prefer-each](docs/rules/prefer-each.md) | Prefer using `.each` rather than manual loops | | | | | |
|
||||
| [prefer-equality-matcher](docs/rules/prefer-equality-matcher.md) | Suggest using the built-in equality matchers | | | | 💡 | |
|
||||
| [prefer-expect-assertions](docs/rules/prefer-expect-assertions.md) | Suggest using `expect.assertions()` OR `expect.hasAssertions()` | | | | 💡 | |
|
||||
| [prefer-expect-resolves](docs/rules/prefer-expect-resolves.md) | Prefer `await expect(...).resolves` over `expect(await ...)` syntax | | | 🔧 | | |
|
||||
| [prefer-hooks-in-order](docs/rules/prefer-hooks-in-order.md) | Prefer having hooks in a consistent order | | | | | |
|
||||
| [prefer-hooks-on-top](docs/rules/prefer-hooks-on-top.md) | Suggest having hooks before any test cases | | | | | |
|
||||
| [prefer-lowercase-title](docs/rules/prefer-lowercase-title.md) | Enforce lowercase test names | | | 🔧 | | |
|
||||
| [prefer-mock-promise-shorthand](docs/rules/prefer-mock-promise-shorthand.md) | Prefer mock resolved/rejected shorthands for promises | | | 🔧 | | |
|
||||
| [prefer-snapshot-hint](docs/rules/prefer-snapshot-hint.md) | Prefer including a hint with external snapshots | | | | | |
|
||||
| [prefer-spy-on](docs/rules/prefer-spy-on.md) | Suggest using `jest.spyOn()` | | | 🔧 | | |
|
||||
| [prefer-strict-equal](docs/rules/prefer-strict-equal.md) | Suggest using `toStrictEqual()` | | | | 💡 | |
|
||||
| [prefer-to-be](docs/rules/prefer-to-be.md) | Suggest using `toBe()` for primitive literals | 🎨 | | 🔧 | | |
|
||||
| [prefer-to-contain](docs/rules/prefer-to-contain.md) | Suggest using `toContain()` | 🎨 | | 🔧 | | |
|
||||
| [prefer-to-have-length](docs/rules/prefer-to-have-length.md) | Suggest using `toHaveLength()` | 🎨 | | 🔧 | | |
|
||||
| [prefer-todo](docs/rules/prefer-todo.md) | Suggest using `test.todo` | | | 🔧 | | |
|
||||
| [require-hook](docs/rules/require-hook.md) | Require setup and teardown code to be within a hook | | | | | |
|
||||
| [require-to-throw-message](docs/rules/require-to-throw-message.md) | Require a message for `toThrow()` | | | | | |
|
||||
| [require-top-level-describe](docs/rules/require-top-level-describe.md) | Require test cases and hooks to be inside a `describe` block | | | | | |
|
||||
| [valid-describe-callback](docs/rules/valid-describe-callback.md) | Enforce valid `describe()` callback | ✅ | | | | |
|
||||
| [valid-expect](docs/rules/valid-expect.md) | Enforce valid `expect()` usage | ✅ | | | | |
|
||||
| [valid-expect-in-promise](docs/rules/valid-expect-in-promise.md) | Require promises that have expectations in their chain to be valid | ✅ | | | | |
|
||||
| [valid-title](docs/rules/valid-title.md) | Enforce valid titles | ✅ | | 🔧 | | |
|
||||
|
||||
### Requires Type Checking
|
||||
|
||||
| Name | Description | 💼 | ⚠️ | 🔧 | 💡 | ❌ |
|
||||
| :--------------------------------------------- | :----------------------------------------------------------- | :-- | :-- | :-- | :-- | :-- |
|
||||
| [unbound-method](docs/rules/unbound-method.md) | Enforce unbound methods are called with their expected scope | | | | | |
|
||||
|
||||
<!-- end auto-generated rules list -->
|
||||
|
||||
In order to use the rules powered by TypeScript type-checking, you must be using
|
||||
`@typescript-eslint/parser` & adjust your eslint config as outlined
|
||||
[here](https://github.com/typescript-eslint/typescript-eslint/blob/main/docs/linting/TYPED_LINTING.md).
|
||||
|
||||
Note that unlike the type-checking rules in `@typescript-eslint/eslint-plugin`,
|
||||
the rules here will fallback to doing nothing if type information is not
|
||||
available, meaning it's safe to include them in shared configs that could be
|
||||
used on JavaScript and TypeScript projects.
|
||||
|
||||
Also note that `unbound-method` depends on `@typescript-eslint/eslint-plugin`,
|
||||
as it extends the original `unbound-method` rule from that plugin.
|
||||
|
||||
## Credit
|
||||
|
||||
- [eslint-plugin-mocha](https://github.com/lo1tuma/eslint-plugin-mocha)
|
||||
- [eslint-plugin-jasmine](https://github.com/tlvince/eslint-plugin-jasmine)
|
||||
|
||||
## Related Projects
|
||||
|
||||
### eslint-plugin-jest-extended
|
||||
|
||||
This is a sister plugin to `eslint-plugin-jest` that provides support for the
|
||||
matchers provided by
|
||||
[`jest-extended`](https://github.com/jest-community/jest-extended).
|
||||
|
||||
<https://github.com/jest-community/eslint-plugin-jest-extended>
|
||||
|
||||
### eslint-plugin-jest-formatting
|
||||
|
||||
This project aims to provide formatting rules (auto-fixable where possible) to
|
||||
ensure consistency and readability in jest test suites.
|
||||
|
||||
<https://github.com/dangreenisrael/eslint-plugin-jest-formatting>
|
||||
|
||||
### eslint-plugin-istanbul
|
||||
|
||||
A set of rules to enforce good practices for Istanbul, one of the code coverage
|
||||
tools used by Jest.
|
||||
|
||||
<https://github.com/istanbuljs/eslint-plugin-istanbul>
|
||||
|
||||
[`no-deprecated-functions`]: docs/rules/no-deprecated-functions.md
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user